Bill Bumgarner


Subversion, Xcode projects, and Diffs

Subversion defaults to treating all files as text, including XML files, unless the mime-type of the file is not text/*. Unlike CVS, Subversion will not expand "magic keywords" unless you explicitly tell it to do so and, therefore, that Subversion may treat a binary file as text will not lead to eventual file corruption as it often does with CVS.

Xcode writes a user.pbxuser file into the project directory that contains many useful bits of information like the user's window layout, breakpoints, custom executables and other information that isn't shared across all users on the project.

Since the pbxuser file tracks window positions, file scroll positions, and other information that tends to change often, the differences between any two revisions of the pbxuser file tends to be large. In the context of automatic change notification emails, this tends to be really annoying in that it is this huge chunk of completely irrelevant noise that obscures the useful bits within the notification email. Given that pbxuser is XML, the changes between two revisions aren't really readable in diff form anyway.

Easy fix: tell Subversion that the file is binary. This is simply a matter of setting the mime-type appropriately.

cd *.xcode
svn propset svn:mime-type application/octet-stream *.pbxuser
svn commit -m 'Set mime-type of pbxuser to application/octet-stream to binary.'

Once done, the diff will be reduced to one line indicating that the binary file changed. Subversion's conflict resolution subsystem will continue to work as expected. See section 7.4.1 of RFC 1521 for the definition of the application/octet-stream mime type. It is basically just an arbitrary byte stream.

In other news, the SCPlugin now has a project page at Tigris. In the repository, one will find svnopendiff which appears to be a Subversion aware tool for opening differences in FileMerge.

Comment on this post [ so far] ... more like this: [Mac OS X, Subversion] ... topic exchange: [Mac OS X, Subversion]