Permalink

darcs - a thoughtful replacement for CVS

6 FEB 2004

I thought I'd point out David Roundy's darcs (David's Advanced Revision Control System). It's basically a CVS replacement, written in Haskell, but the interesting thing about it is the theory of patches that David created. The blurb on that bit is below.

One of the things that interested me was the token-rename patch. It's a patch that says something like 'change all the names "Foo" to "Bar" in this section of code', so the patch includes semantic information, not just a textual diff.

I've been using automatic refactoring with IntelliJ IDEA for a while now, so the first thing that struck me was that revision control systems of the future might in fact deal more with refactorings than with diffs. I can imagine a patch like "Perform Extract Method on method Foo from line 12 to 30, and rename the new 'bar' paramter to 'baz'." Food for thought.

Theory of patches The development of a simplified theory of patches is what originally motivated me to create darcs. This patch formalism means that darcs patches have a set of properties, which make possible manipulations that couldn't be done in other revision control systems. First, every patch is invertible. Secondly, sequential patches (i.e. patches that are created in sequence, one after the other) can be reordered, although this reordering can fail, which means the second patch is dependent on the first. Thirdly, patches which are in parallel (i.e. both patches were created by modifying identical trees) can be merged, and the result of a set of merges is independent of the order in which the merges are performed. This last property is critical to darcs' philosophy, as it means that a particular version of a source tree is fully defined by the list of patches that are in it. i.e. there is no issue regarding the order in which merges are performed. For a more thorough discussion of darcs' theory of patches, see Appendix A.