UP | HOME

Dive into mercurial

IMHO Mercurial is using the Tree structure idea to manipulate the so-called ’trunk/branches/tags’ which probably because of its storage scheme revlog.

This tree has only one top (r0) and one end. In case this rule is being broken, merge comes in.

The following graph show a common scenario that one person change something base on r2. After he make the change, revision goes to 6. In Subversion, if person do update base on r5, he will get the change which is at r6. Therefore Subversion need create another folder branches/tags to track change by name.

By contract, Mercurial will ask for merge because it predicates there are two headers r5 and r6 (broke the rules of that Tree). After merge, new revision r7 created which has parent r5 and r6. (The storage schema revlog always doing append) So the Tree has one end again.

Doing the change (commit) turns to be extending the tree by appending nodes start from one specific node.

0 -> 1 -> 2 -> 3 -> 4 -> 5
   -----------------> 6

My understanding of tag/branch in mercurial just give each node (revision) a name(alias). While the branch tracks the change after being branched, tag does not do that. Therefore we are able to check out any branches/tags without introducing extra folders.

Further reading including but not limit to storage scheme and examples.