[darcs-users] undoing...
Tommy Pettersson
ptp at lysator.liu.se
Wed May 4 21:53:16 UTC 2005
On Wed, May 04, 2005 at 08:29:06AM -0700, Mark Lentczner wrote:
> Seems to me that there is a missing undo command. Or rather, rollback
> does too much:
>
> When I want to "undo" a patch - what I want (I think) is to apply the
> inverse patch to the working directory. Then, when I "record" later, I
> will have a patch that undoes a previous patch's changes (plus what
> ever else I needed to do in the working copy to get the files
> consistent).
>
> I suppose something like
> darcs diff --unified --patch="foobar" | patch -p0
>
> But I'm queasy about doing things with patch since one slip up and
> everything gets mushed.
>
> Seems that rollback does this but then goes ahead and records those
> changes as a new patch. I want the same thing without the record.
> I'll do the record myself, possibly not taking all the "undoing" hunks.
>
> I'm sorry if this has been covered here before -- I searched the list
> w/Google and didn't find it. In any event, this is the sort of thing
> that should be in the Wiki. I promise to add it when I understand what
> to do!
It has been discussed a number of times. :-)
First, the purpose of rollback is not to create a patch with
inverted _changes_. It is to create _the_ inverted patch.
Every patch has a special inversion flag for this purpose.
Rollback inserts a copy of the patch with the inversion
flag set. Why is this good? If you and I invert the same
patch we end up with the _same_ inverted patch. If I pull
from you darcs sees I already have the inverted patch.
The 'darcs diff | patch; record' would have created two
_different_ patches with the same changes, and they would
have conflicted very badly.
I think rollback was first meant to be both a safe unrecord
and a distributed unpull. I also think people mostly use
it to temporarily undo a patch and later unpull the rollback
patch to get the changes "back".
A 'patch' command has been suggested for precisely what you
want -- the mirror command of unrecord: undo some patches in
working but leave pristine untouched.
Such a command would be better at what (I think) rollback is
mostly used for, since it could do several patches at a time
and handle conflicts with depending patches. There have not
been much need for the intended use of rollbak, that I know of.
I even think the name 'rollback' would be suited for the
'patch'-command, since you are not the first one expecting
rollback to act as 'patch'.
--
Tommy Pettersson <ptp at lysator.liu.se>
More information about the darcs-users
mailing list