[darcs-users] Working with unified diffs

Tommy Pettersson ptp at lysator.liu.se
Mon Mar 7 20:05:12 UTC 2005

On Mon, Mar 07, 2005 at 07:27:19PM +0100, Jan-Benedict Glaw wrote:
> - Assume I get an unified diff from someone, which would apply cleanly

  cd target_repo
  darcs get --tag unidif_target_version main_repo tmp_repo
  cd tmp_repo

  patch < unidiff
  (Hmm, I can't remember if patch remove files, but somehow they need to be removed)
  darcs rec -A 'author of patch' -alm 'name of patch'

if in tmp_repo
  darcs push -a main_repo

This should be scriptable.  Maybe some of the automatic
importers for darcs can already do this?  I myself prefer to
apply unidiffs manually, mostly from within my text editor.

> - What's the easiest way exporting (as unified diff) the whole

if you've forgot to tag the interesting version
  cd orig_repo
  darcs tag -m some_version
  darcs push -p some_version feature_repo
  cd feature_repo

  darcs diff -u --from-tag some_version > unidiff

You can also cherry-pick features for a unidiff

  darcs get --tag unidif_target_version main_repo tmp_repo
  cd tmp_repo
  darcs tag -m old
  darcs pull cherries...
  darcs diff -u --from-tag old > unidiff

Then there is the topic of conflicts, if you want to merge
features (own or imported).  I'm in the state of planning to
(real soon now, and so on...) write something about this in the
manual.  It shouldn't be a problem, and if it is there are ways
to work around it, and if there aren't it's not darcs' fault,
well, in some rare situation it is, but that is being fixed.

I follow a bunch of upstream sources and sometimes supply
(unidiff)patches back, all the unidif way, and keep some local
modifications of my own.  I usually keep one repo for plain
upstream and one main repo for my private version.  Then I
branch of (long- or short term) temp repos for new features,
merging, testing, what ever.  It works like a charm -- if
you have a large HD *grin*.

Darcs doesn't restrict you to a certain infrastructure of
branches and patch flows.  It is a strength and a weakness.
You can find your very own way to work with darcs, but it
may take some time and trial&error.

Tommy Pettersson <ptp at lysator.liu.se>

More information about the darcs-users mailing list