[darcs-users] Whatsnew on a rolled back repo

Gian Piero Carrubba gpiero at rm-rf.it
Tue Aug 26 07:33:35 UTC 2014


* [Mon, Aug 25, 2014 at 04:57:44PM -0300] Guillaume Hoffmann:
>> status, so I need a way for displaying the changes in the working dir 
>> other than the ones generated by the rollback command.
[...]
>
>Another option would be to clone your repository R1 into another one
>R2, run rollback of the same function in R2, record a patch P1, then
>copy the working copy of R1 into R2 and record a patch P2. If P1 and
>P2 commute, you can pull P1 it back into R1 (after reverting
>everything there).

Thank you, Guillame. I like this solution as it is mostly scriptable.

(pseudo-shell script)
darcs clone R S
if test -n "$hash"
then
  darcs rollback --repo S --match "hash $hash"
else
  darcs rollback --repo S # manually select the patch
fi
darcs record --repo S -am P1
copy working dir
darcs record --repo S -lam P2
darcs push --repo S -a R

At this point, if we know if P1 and P2 commute, we could do:

if commute P1 P2
then
  darcs obliterate --repo R -p P1
else
  cd R  # darcs rebase does not accept --repo. Is it a bug ?
  darcs rebase suspend -p P1 -a
  darcs rebase obliterate -p P1
  darcs rebase unsuspend -p P2 -a
  ... (manually resolve conflicts)
  darcs amend -p P2 -a
fi

Now the question is: there is a simple non-interactive way for knowing 
if two patches commute ?

Ciao,
Gian Piero.


More information about the darcs-users mailing list