Before starting work on our first app I decided to do some research on version control. To cut a long story short, I’ve settled on Mercurial and a private repository hosted by Bitbucket.
You need* to work with RB’s VCP file format. This simply stores each object as it’s own separate file. The file structure I’ve adopted for our new project is as follows:
' — Code <– this is where you want to tell RB to save your project
' — External Items <– put in here items like images, etc
The reason for the External Items folder is that when RB saves in the VCP format, it doesn’t save the external items in the same folder (in our example, Code). Since we’re going to get Mercurial to track the MyApp folder, it makes sense to put all the relevant external items within it.
We only use Macs here at Figa and we’ve settled on MacHg (free, lovely looking) as a frontend GUI for Mercurial. I hate dealing with the Terminal. If you’re on Windows then I’m sure there is an equivalent (or you could use the command line). The following steps are how to get up and running with this application but the principles will be similar:
For local repositories, that’s the short of it. Whenever you make a change to any file being tracked, MacHg will show a little icon to the left of that file telling you it’s been added, removed or modified. You can click on a file anywhere in your project’s timeline and diff it (i.e. look to see code-level changes between the two files). If, like us, you’d like to store the repository off-site so it can be easily accessed by other members of your team then read on.
The beauty of Mercurial is that every copy of the repository is the complete repository. This means that the working copy I have on my Mac has all the files necessary to build the app, just as the online repository does. What we’ve settled on is using Bitbucket to host our repository. They have several packages available. If you need less than 200 MB storage and five or less contributors (i.e. developers) then it won’t cost you a penny. The more storage and the more contributors you require, the more you pay per month. Repositories stored on Bitbucket can be private (the default, i.e. only visible to you and contributors you’ve invited) or public (i.e. used for open source development).
Using MacHg with Bitbucket is pretty easy really:
There you have it. We’ve found using this Mercurial setup very easy, reliable and productive during development. Let us know you get on.
* not strictly true since you could use REAL Studio’s XML file format but I think it’s much easier to use the VCP format.
The gotcha is if you need to have external items you have to make sure they are stored in XML format. So if you have multiple products or even if you’re trying to be heavily test-driven and have a unit test project, you can still end up with a lot of stuff in XML format.
Something that used to drive us wild with svn was false differences from RS regularly shuffling XML elements and attributes for no sane reason. I think they got a lot better at this around 2010.
I loved the fact that Cornerstone (the svn client) would prompt me when it spotted new files, don’t like having to remember to add them. That would be a deciding factor for me when picking between Hg clients.
Oops, should clarify “external items” above means shared code, NOT external binary references as mentioned in the article.
Thanks for the comment Andy. I toyed around with Cornerstone too – it really is a beautiful client but I just decided again subversion in the end. It would be nice if MacHg noticed newly added files though…
