Mercurial switch notes
At work I have taken the librarity of proposing to switch from Subversion to Mercurial and the following are the results of typing out my notes.
The major advantages of working with Mercurial over SVN are:
- No unexpected merge (or merge conflicts)
- Developers can work independent of each other. They don't have to worry about commiting broken code, only syncing broken code.
There are two types of branching:
- Unnamed branches
- Named branches
Named branches are comparible to what we know from SVN. Unnamed branches are done when you have reverted to an old changeset and then make a change, they are like an automatic branch that occur where normally (in SVN) you would have conflict.
An example can easily be created by making a few commits, then revert to and old one because you want to try an alternative approach for a problem you were having and start commiting then. Once your done with the alternative you can decide which branch should be closed and which one should be continued.
When syncing your changesets with someone else, you make it possible to look at what the other has done without having to worry that your own code gets broken by the changes. For example you encounter a problem and notify another developer of it who tries to fix it while you continue work on your own problem. Once both of you are done, you can review each other code without having to merge. Then one is tasked with merging it while another continues with his tasks. Once done you simply merge again and you are done.
You can always sync your code with a central repositorie. It's not uncommon that you are working on a large issue which might take a day or two. With Mercurial you can still commit as you normally do and if only a central repository is backed up you can still push your changes to that location without interfering in someone else his work.
Another great feature is shelving. Simply put it puts your changes on a shelve. Imagine you are working on a feature and suddenly you have to put that on hold as your boss wants you to work on a bug. You can either complete what you were working on or revert all changes. With shelving you put those changes on the shelve and when you are done with whatever had a higher priority you can take the changes from the shelve and continue as if nothing had happend.
There are, as always, a few bad things about moving from Subversion to Mercurial. First of all, Subversion is linear which gives you a linear method of developing. Secondly because Mercurial automatically creates branches and you would have to actively control this by doing merges often.
Mercurial has a lot of nice features like being able to import from SVN (nice if you want to do a complete switch) as being able to rebase (similar to Git). Also Mercurial could easily be intergrate in our toolchain.
Since I mentioned Git, I would like to say that I have thought about it but decided against using Git. Git has no native version for Windows. Git was also hard to start with, heck, the installer alone requires several extra steps. As a developer I don't want to worry about the tools or how it should be used. Mercurial was ready with just a few steps and working with it is quite easy compared to Git which I was messing around with for a few days. So basically the choice was made on personal preference