[darcs-users] [Haskell-cafe] Switching from Mercurial to Darcs

Nathan Gray kolibrie at graystudios.org
Fri Feb 6 15:26:33 UTC 2009


On Thu, Feb 05, 2009 at 04:06:54PM +0000, Eric Kow wrote:
> Darcs-users: here's Peter's message in case you have any tips.
> 
> Peter V:
> > I'm trying to switch from HG to Darcs, but I'm failing miserably in getting
> > the same productivity. I often do bad checkins with Darcs, merely because
> > the amount of information I get from Darcs is overwhelming and I don't have
> > time to read the details of the large set of commands.
> > With Mercurial, here's my basic workflow:
> > 
> > 1) hg st

  darcs w -ls (darcs whatsnew --look-for-adds --summary)

> > lists just the filenames of changed, deleted, new files (with a char prefix
> > to show what kind of change it is). I only want to see the filenames, not
> > the lines/content. If I want to see changes in the content, I use hg diff
> > using a visual differ. My brain is not capable of making sense of the
> > textual diff.
> > 
> > 2) modify .hgignore to make sure only these files are added that are part of
> > the project. I want this process to be automated, I don't want to check each
> > time which files to add, since this is error prone.

  modify _darcs/prefs/boring

> > 3) hg addrem

  darcs record -l (darcs record --look-for-adds)

> > this adds new files and removes deleted files from local repos.
> > forgetting to add files is a common problem, and is really tricky since no
> > record is made of these files, so if after a couple of versions if a
> > developer finds out a file was missing, the history is useless since you
> > can't reconstruct the old content of that local file anymore, and often it's
> > impossible to give the local file to the other developers since it might be
> > changed. I actually would like to have an option that automatically
> > adds/deletes files on each commit, as it is easier to delete a file after it
> > is checked in, than it is to reconstruct an old version from a local file
> > you forgot to add.
> > 
> > 4) hg commit -m "message"

  darcs record -m "message"

> > this commits my changes locally. I always do this before pulling since then
> > I'm sure my changes are saved in the case a merge goes wrong.
> > 
> > 5) hg pull -u

  darcs pull

> > this pulls in changes, and updates and merges the files, using a visual
> > merger of my preference.

You can use an external merger tool using the option
--external-merge=COMMAND.

You would probably want to set this up in your _darcs/prefs/defaults
file (or ~/.darcs/defaults):

  pull external-merge=COMMAND

> > 6) hg commit -m "merged"
> >     hg push
> > 
> > only needed if I did a merge and want to push that merge.

You can either record a new "merged" or "conflict resolved" patch, or,
if one patch is local and has not been pushed anywhere else, you can
'darcs amend-record' the local patch.

> > 7) back to 1)
> > 
> > It would be nice to know how to do this using darcs, or if a better way
> > exists using darcs, that would be handy too :)

Looks like you can keep your existing workflow.  You can make darcs
less interactive, but I've found that I find lots of little mistakes
during the interactive record, and am thus able to fix them instead of
pushing them to production.

-kolibrie



More information about the darcs-users mailing list