DifferencesFromOtherDVCS

As of 2010, the most known and used distributed version control systems (DVCS) are git, mercurial (hg), bazaar (bzr), and darcs. This page aims at explaining what sets darcs apart from the three other systems.

To put it shortly, git/hg/bzr on one hand, and darcs on the other hand, are two families of DVCS based on different principles.

No chronological history

The fundamental difference is that git/hg/bzr maintain a chronological order in the changes of the repository. With those systems, a change depends on the previous one in time, that in turn depends on its previous one, and so forth. So a merge does not forget about that chronological order, it just combines lines of development by gluing them into “merge points” precisely located in time.

This does not mean that they are bad distributed systems: they are indeed distributed in the sense that they are very good at merging two concurrent lines of development of a same project (also known as branches).

On the other hand, darcs manipulates patches instead of chronological revisions, so darcs maintains a more fine-grained order on changes, that could be called “patches dependencies”.

The consequence is that darcs ignores the very concepts of branches and merges. From the user point of view, branches and merges still exist: every repository is a branch, and every transmission of patches between two repository is a merge. But what happens is that these merges are silent and do not need extra user input, nor do they appear in the history. More generally, there is no branch administration, which explains why darcs has a smaller set of commands than git, hg and bzr.

Example

To see that difference, do the following steps in git, hg, bzr or darcs:

  1. initialise a repository in ./parent
  2. create a file file1, and record a change in ./parent
  3. checkout/clone/get ./parent into ./child1
  4. checkout/clone/get ./parent into ./child2
  5. create a file file2 and record this change in ./child1
  6. push the change from ./child1 to ./parent
  7. create a file file3 and record this change in ./child2
  8. push the change from ./child2 to ./parent

The last step require no extra user input in darcs, contrary to git, hg and bzr.

See a video example comparing git to camp, an experimental DVCS of the darcs family.

Too much freedom?

Now, isn’t that too much freedom? Aren’t we losing some kind of safety by getting rid of chronological order?

If you wonder about these questions, keep in mind that DVCS generally seem dangerous at first sight from the point of view of SVN/CVS users. But in practice, DVCS are most often used in a centralised way, that is, there is always a “morally central” repository in projects versionned by git/hg/bzr/darcs.

The same reflexion applies for the darcs approach compared to git/hg/bzr. Most of the time, the “morally central” repository of a project versionned by darcs is used as an incremental-only log of the project. But in the meantime, all developers work with their own repositories, in which darcs’ flexibility with patches is very handy.

Another example of a practical use of darcs is this wiki you are currently looking at, whose backend is simply a darcs repository.

See also