[darcs-users] rollback

David Roundy droundy at abridgegame.org
Sat Feb 7 13:14:56 UTC 2004


On Sat, Feb 07, 2004 at 01:37:52AM +0100, Tommy Pettersson wrote:
> David Roundy wrote:
> > Tommy Pettersson wrote:
> > >   darcs rollback
> > >   darcs revert      (hand picking to keep my change in progress)
> > >   darcs unrecord
> > 
> > To get the same effect as those three commands, you could use unpull...
> 
> No, I did not want to remove the patch from the repo, at least not until
> I had tried if it would worke with my current changes.

Right, I didn't read what you did sufficiently carefully.

> When the annotate command is ready it will be able to print
> a specific patch in diff -u format (I understand).  Then I
> can pipe that output to "patch -p1 -R" and get exactly what
> I wish for.  :-)

Hmmm.  I hadn't thought of giving annotate output in diff -u format, but I
can see that it would be very nice to have, especially for interfacing
between darcs and non-darcs users.  The only catch is that I don't have
code for generating diff -u output, so I have to run an external command,
which means generating two copies of the source tree and running diff -rN.

What I would probably do in this situation is run darcs get to produce a
temporary copy of the repo.  As long as hard links are allowed on your
filesystem this will be pretty fast and cheap (on the darcs repository this
just took me 17 seconds while simultaneously running a compile).  Then I'd
use unpull on the temporary copy.  This also gives you a separate working
directory in which to play with your changes... or you could do the unpull
on your existing copy, and you'd always have the other copy to re-pull
from.

> > As hinted above, the unpull command *does* modify the working
> > directory, and perhaps rollback should as well, but I'd like rollback
> > to be a "safe" command.
> 
> Well, you have thought about this.  I am only trying to understand
> it. :-) I have been working on my graphic map of the darcs functions, and
> it has brought many new thoughts to my mind.  I hope I'll be able to
> present it soon for comments.
> 
> Here is a question: The rollback command seams to work exactly like
> unrecord, except it doesn't delete the patch, but "neutralizes" it with a
> reverse patch.  Would it be a good way to depict rollback as a variance
> of unrecord, where rollback is for the careful what unrecord is for the
> bold?  Or are there rather some things you think of as an unrecord, and
> some conceptually different things you think of as a rollback?  The
> different names suggests to me the latter, but that is not how I think of
> them (for now).

Well, in its uses rollback is in a sense an opposite of unrecord.  Rollback
is designed to keep the history of the old patch, so it is used after
everyone has already gotten your bad patch.  Unrecord really should only be
used if noone else has pulled the relevant patch.

I.e. unrecord really is intended for "shortly after" you recorded the
patch, when you say "oops, I forgot to add foo.c and the thing won't even
compile", where rollback is for much later after others have the patch and
it's too late to keep your mistake (or someone else's mistake) a secret...

The fact that rollback doesn't modify the working directory is mostly just
a result of my paranoia (or carefulness).  Really I expect rollback to be
used much more like unpull, except that you want the world to know that you
think the patch should be reversed.

> I think pull and unpull are conceptually differentiated from the other
> commands (and thus unpull from unrecord and rollback) in that they do not
> introduce any new differences between the working copy and the current
> copy.  Unless there are merge conflicts of course.

Yeah, that's the idea of the naming scheme... I guess the question of
whether rollback is more like unrecord than unpull depends on whether you
think of "what does it do" or "when is it used".
-- 
David Roundy
http://www.abridgegame.org




More information about the darcs-users mailing list