SpontaneousBranches

Darcs enables a highly useful workflow which is worth a name “spontaneous branches”.

Branches are a metaphor in source control management that allow you to work on a particular task or line of development, and often merge the changes back. Darcs allows you to have spontaneous branches because often, truly no additional effort is required. Let us see an example.

Say you are working on a task that has a ticket in a bug tracking system, with a ticket number of ‘123’. You need to make 3 separate but related patches to resolve this ticket. You name your ‘records’ for those patches like this:

RT#123 Update Documentation
RT#123 Fix bug
RT#123 Really fix bug

The consistent and unique names here allow this set of patches to be a spontaneous branch. darcs has lots of options for working with this spontaneous branch very easily:

# Merge the branch into a central repo:
$ darcs push -p 'RT#123'

# launch just this branch into the production copy
$ darcs pull -p 'RT#123'

# mail this branch to remote repo
$ darcs send -p 'RT#123'

# Review which patches are in this branch
$ darcs changes -p 'RT#123'

This is an extremely easy to use and powerful feature which is especially helpful when the order you need to deliver changes is not the order in which you are able to start on them.

Notice that the branch name here is something made up, something which ties together darcs with a larger project management scheme. Keeping track of a bug tracking ticket number is enough brain effort. You don’t need to be thinking about another set of revisions in your source control system as well.

Spontaneous branches are perfect for small to mid-size groups of patches that need to be handled together, but are not a substitute for formal longer term branches, although those are also easy in darcs.

See Also