Writing /home/k4ml/webapps/drupal5/wiki/data/cache/5/54fab0149fbf50444db465743970373e.i failed
Writing /home/k4ml/webapps/drupal5/wiki/data/cache/5/54fab0149fbf50444db465743970373e.i failed
Writing /home/k4ml/webapps/drupal5/wiki/data/cache/5/54fab0149fbf50444db465743970373e.xhtml failed
Table of Contents

darcs revision control system

After using arch/tla for personal stuff, cvs and svn at work, I think I would settled for [darcs][1] as my source code control system. The distributed nature of darcs suited well with my current workflow. My main requirement for source control system at the moment is to get rid of the centralize repository as required by cvs or svn. I will used this post to take note of darcs as I go along with it.

Installation

The major drawback of darcs. It was written in [Haskell][3] so if there’s no pre-compiled binaries available for your machine, you have to compile it by hand. It’s not that hard if you have Haskell compiler on your system. Otherwise it could be a little bit tricky since the compiler itself was written in Haskell !. I was lucky that the RPM binaries for Suse 9.1 still work fine on OpenSuse.

Getting Started/Usage

  $ mkdir new_project
  $ cd new_project
  $ darcs init

Is all you need to get started with darcs. The command will created a directory called `_darcs` that will stored all the versioned tree plus some metadata such as a list of repos and email address. The main difference with other scm such as cvs, svn and arch/tla is the working directory we just created is full repository of darcs that you can commit all your work. cvs, svn and tla require you to define certain place as a repository where you can checkout as a working copy.

If you already have a project tree that you want to put under darcs, you can use the `add` command:-

  $ cd existing_project
  $ darcs add -r

Will recursively add your source file to the repo. You can specify which file to ignore by editing file `_darcs/prefs/boring`, eq to `.cvsignore`. To really put all the stuff into the repository, you have to record it, ie commit:-

  $ darcs record -m 'initial import'

`-m` option is actually use to name the patch. One more difference here, darcs is centered around patch rather than version. You will not find any version number here as in cvs or svn. To view what you have done/commit so far:-

  $ darcs changes

Will provide a list of changes in GNU changelog style.

  $ darcs whatsnew

Will show you any changes that you have not record yet.

Best Practices

Every darcs repo is a complete working directory so you can just doing your work straight away, no need to do any checkout. This bring an advantage that it’s easy to move your repo around but at the expense of losing all your work if something like, your laptop hardisk crash (it did happened to me). So it is suggested on the wiki to setup some centralized repo to keep all your precious work. This is how I setup mine.

On my main dev machine:-

  $ mkdir new_project
  $ cd new_project
  $ darcs init
  $ ... (did some cool hack here)
  $ darcs record -m 'my greatest patch'
  (darcs will interactively ask you which patch you want to record)

On my laptop:-

  $ darcs get myname@dev:/path/to/darcs/new_project
  $ ... (hacking again)
  $ darcs record -m 'another great patch'
  $ darcs push

I’m going offline for a few days:-

  $ ... (still hacking)
  $ darcs record -m 'offline patch'

Back online:-

  $ darcs push
  (darcs will interactively ask which recorded patch (if any) to push)

The above workflow work really well for now.

Publishing

Similar to tla, darcs don’t need special server to publish your repo. Existing infrastructure such as ssh or http is all that you need. Just copy your darcs repo to any public directory on your web server and anyone can `darcs get http://yourserver/darcs/project`. It’s possible to collaborate with darcs without giving anyone write access to your repo. Patch can be pass around using `darcs pull`, `darcs send` and `darcs apply` command (more on this later).

Scalability

One of the most sought question when looking for version control system. According to wiki and mailing list, there’s two issues regarding scalability, large repo and large patch. For the former, darcs scale well (there’s even a mirror of linux kernel in darcs) but for the latter darcs still suffered. Based on my test, if you’re importing a source of tree of more than 100MB in size darcs will take forever. So one of the workaround suggested on the mailing list is not to import your tree in single operation which would result in one large patch. Instead do it in phase, let say by directory basis if your tree were organized into few directories.

Conversion tools

[tailor][2] script claimed to support conversion from most of the major scm such as cvs, svn. tla, bzr etc but I never tried that. The setup look’s a little bit complicated and I have no intention to import my tla repo at the moment.

Summary

Compared to tla, darcs a lot more easy to get started. There’s only a few command set need to familiar with and worked really well for those in need of non-centralized version control system. The cons are installation and no good GUI frontend available as in cvs or svn.

[1]:http://darcs.net/
[2]:http://darcs.net/DarcsWiki/Tailor
[3]:http://www.haskell.org/

The following directory is already in the repository;
note that to ensure portability we don't allow
files that differ only in case:
install