It has been a while since my last post. I blame work, life and the excellent courses at Coursera. I now have a few ideas however, so here we go again. In addition to a few Delphi posts that are in the pipeline, I have decided to work a bit more with Java so I have prepared a fresh VM and installed the JDK and Eclipse into it. Since I intend to start fiddling a bit with a compiler project that has been growing in my mind for a while, I also installed Flex and Bison. You will hopefully read about my progress in future posts.
For now, however, I will address another issue. It has been a while since I replaced my development machine, but last time I did it, I realized that I don’t have a good way to transfer my old projects from one computer to another. Deciding to step into the 21st century, I decided to use an online version control system for this. I have previously used Visual SourceSafe and Perforce, but for a while I have used Mercurial at work, and have grown quite fond of it.
I therefore signed up for a Kiln Student and Startup Edition account (which is available for anyone, and whose only limitation, as far as I can make out, is that no more that 2 developers can use the account). Kiln is a source control and code review tool built around Mercurial. The sign-up process was painless and quick, and I got to choose a name for my site, which results in a URL like “https://[your_site].kilnhg.com”.
I decided to start by checking in some old Delphi code. Therefore I created my first repository, imaginatively named “Delphi”, since Kiln quite clearly indicated that it was a good way to start. After this, I downloaded and installed the Kiln client on my computer. This was also suggested by the Kiln site. The Kiln client is the same as the TortoiseHg application, which you may use with any Mercurial system, but with a few predefined Kiln-specific settings.
Locally, I created a directory called “Delphi”, which will act as the base directory for all my Delphi code. I right-clicked that directory, and selected “Clone” from the “TortoiseHg” item. In the appearing dialog, I changed the value of the “Source” edit box to “https://[your_site].kilnhg.com/Code/Repositories/Group/Delphi”. No other values needed to be changed, and I clicked “Clone”. At this point, I had to enter the password that I specified when creating the Kiln account. After a while, a local repository was created (you can verify this by checking that you have a “.hg” sub-directory). Now, I added files and sub-directories to the Delphi directory. To check how my local repository has changed, I right-clicked the “Delphi” directory again, this time selecting “Hg Workbench” from the pop-up menu. In the workbench, I could see that a number of files had been added. To check these files into the local directory, I right-clicked them, selected “Add” and made sure their checkboxes were checked. Once I was satisfied, I entered a suitable description and clicked the “Commit” button. This commited my changes to my local repository. Note that the changes had not yet been added to the Kiln site, i.e. to my online repository.
To “push” the changes to the online repository, I selected “Synchronize” from the workbench’s “View” repository. I then clicked the button whose hint is “Push outgoing changes to remote repository”. After confirming that I wanted to push the changes, the changes were pushed. This took me about 15 seconds, but of course this depends on the amount of changes that should be pushed, and your connection speed. On the Kiln site, I could now see that the changes had been pushed.
Now, the next time I work on my code, I start by making sure that my local repository is up-to-date (by “pulling” the latest version form the Kiln site). Then I make the changes I want to make. When I am satisfied, I commit my changes locally (this may be done several times before I push), and finally I push all changes to the Kiln site. To learn more about using Mercurial, see the Mercurial site. To learn more about the Tortoise Workbench, see here.
And the next time I buy a new computer, I only need to install the Kiln client and pull the code down from the Kiln site.