This one-liner will return the current BASE revision of your working
copy:

svn info | grep Revision | sed s/'Revision: '//

We use this snippet in Checkout to set the CFBundleVersion value in
the Info.plist at build time.  We don't use Xcode to build the app,
and there might be a more efficient way to manipulate your Info.plist
than this when you're not running a Python interpreter anyways
already, but adding a custom script like the one below as a build
phase for your target should work (if you're developing on Leopard
that is, if I remember correctly, plistlib was not included with the
Python distribution that shipped with Tiger, but you could install
it):

(set shell to: /usr/bin/python, add your Info.plist to the list of
input files in the "Run Script Phase" window)
# --- begin of script

import plistlib
import os
from sys import argv

plistPath = argv[len(argv) - 1]
plistDict = plistlib.readPlist(plistPath)

currentSVNRevision = os.popen("svn info | grep Revision | sed
s/'Revision: '//").read().strip()
plistDict['CFBundleVersion'] = currentSVNRevision

# working with strings is easy in Python, something like what's below
should help with the short version
shortVersionString = u'MyApp v.1.0, build number %s' %
(currentSVNRevision)
plistDict['CFBundleShortVersionString'] = shortVersionString

# finally, overwrite the old plist file with the modified dictionary
plistlib.writePlist(plistDict, plistPath)

# --- end of script

Written mostly from memory, so fingers crossed that it actually works.

- Dirk

On Apr 22, 3:06 pm, Alberto Ganesh Barbati <albertobarb...@gmail.com>
wrote:
> I don't have a complete answer, but you may find these links
> interesting:
>
> http://chanson.livejournal.com/125568.htmlhttp://developer.apple.com/DOCUMENTATION/DARWIN/Reference/ManPages/ma...
>
> Ganesh
>
> On 8 Apr, 09:31, Gatada <johanbasb...@gmail.com> wrote:
>
> > Hi,
>
> > I am sure this problem has a simple solution:
>
> > How can I use the subversion/Versions revision number as the
> > CFBundleVersion in my Xcode project?
>
> > Maybe it even is a nice, clean and efficient way to get the
> > CFBundleShortVersionString set correctly?
>
> > Thanks!
> > Johan
>
> > CFBundleVersion: identifies an iteration (released or unreleased) of
> > the application.
> > CFBundleShortVersionString: [major revisions to the application].
> > [revisions that implement less prominent features].[maintenance
> > releases]
>
> > PS: Hm, seems like my post timed out? This is second attempt. Sorry if
> > it shows up twice (with slightly different content).
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Versions" group.
To post to this group, send email to versions@googlegroups.com
To unsubscribe from this group, send email to 
versions+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/versions?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to