Browsing articles tagged with " svn"

Automatically Insert Your SVN Revision Number Into Your Xcode Project

Oct 21, 2009   //   by Derek van Vliet   //   Development  //  No Comments

Wouldn’t it be handy for your iPhone app to have access to its subversion revision number at run-time? Of course it would!

Being able to access the current revision number in your app is especially useful for testing. We use it to display the current rev on our test builds so our testers can reference the build that they discover bugs in, like so:


Here’s how to do it

1. In Xcode, add an empty header file to your project’s “Other Sources” group called “revision.h”.

2. Add a “New Run Script Build Phase” to your target.

3. When defining your build phase, use “/bin/sh” for the Shell value and enter the following script:

REV=`svnversion -n`
echo "#define kRevision @\"$REV\"" > ${PROJECT_DIR}/revision.h

4. Ensure that the new build phase happens before your “Compile Sources” build phase.

5. Build your app.

That’s it! From now on you can use a string define called kRevision wherever you would like to reference your revision number at run-time.

IMPORTANT: Do NOT add your revision.h file to your subversion repository. It will be generated automatically each time you build your app.

Versions and using an external diff/merge tool

Sep 10, 2009   //   by Rob Segal   //   Development  //  5 Comments

Subversion has been around for a while now and there are some very reliably maintained Windows clients, most notably Tortoise SVN. Unfortunately the same can not be said for OSX. There is one client that seems to stand out quite a bit from the others, Versions. Keep in mind that Versions is not free like Tortoise SVN but so far it has proven to be well worth the money.

Versions is a great tool but one of things it lacks is integration into one of my preferred diff/merge tools KDiff. Thankfully the developers of Versions have exposed hooks to allow people to write scripts which will allow users to integrate their preferred diff/merge application. I’ll show you how I was able to do that and how you can integrate your preferred application.

Versions has great support forums and after posting a question about how to integrate kDiff I was led to this page detailing how I could do just that.

The key steps to get your diff script to work…

  1. Copy your script to the folder “~/Library/Application Support/Versions/Compare Scripts”
  2. In Versions preferences in the file comparison drop down select your compare script

That’s it you should be set to go.  Here’s a screenshot of how kDiff is integrated in my preferences screen.


Our Games

Latest Tweets