tla undo/redo like functionality for hg

Stefan Reichör stefan at xsteve.at
Tue Nov 28 06:53:51 CST 2006


Stefan Reichör <stefan at xsteve.at> writes:

> "Benoit Boissinot" <bboissin at gmail.com> writes:
>
>>> > But the easiest way is with mq:
>>> >
>>> > hg qnew -f changeset.diff
>>> > hg qpop
>>> > hg qpush
>>>
>>> I have several questions to this suggestion:
>>>
>>> a) Can I save several changesets (changeset1.diff, changeset2.diff)
>>>    and apply them in arbitrary order?
>>
>> It is a quilt like queue, so the patch order is recorded in
>> .hg/patches/series, and if they are unapplied you can reorder them if
>> you edit this file.
>
> That is fine.
>
>>> b) Is the patch recorded in the repository? And if yes, can I
>>>    delete this patch from the repository.
>>>
>> Not sure I understand what you mean with "recorded", patches are
>> stored in .hg/patches/<patchname>, you can delete them with "hg
>> qdelete"
>
> My question is, if such a patch is stored somewhere else in the .hg
> directory also.
>
> I would like to delete every trace of this patch in the repository via
> hg qdelete. Does this work?

To follow up my own post...

I did the following experiment. It seems to work the way I like it.
However there is one point that is unclear - see my question below.

% mkdir w2
% cd w2
% hg init
% echo "hello" > a.txt
% hg addremove
adding a.txt
% hg ci -m"initial commit"
% hg log
changeset:   0:91e2fa566682
tag:         tip
user:        "user at host.com"
date:        Tue Nov 28 13:29:45 2006 +0100
summary:     initial commit

% hg qinit -c
% echo " my friend" >| a.txt
% hg diff
diff -r 91e2fa566682 a.txt
--- a/a.txt     Tue Nov 28 13:29:45 2006 +0100
+++ b/a.txt     Tue Nov 28 13:30:44 2006 +0100
@@ -1,1 +1,1 @@ hello
-hello
+ my friend
% hg qnew -f changeset.diff
% hg qseries
changeset.diff
% hg log
changeset:   1:3149856f4f18
tag:         qtip
tag:         tip
tag:         changeset.diff
tag:         qbase
user:        "user at host.com"
date:        Tue Nov 28 13:31:25 2006 +0100
summary:     patch queue: changeset.diff

changeset:   0:91e2fa566682
user:        "user at host.com"
date:        Tue Nov 28 13:29:45 2006 +0100
summary:     initial commit

% hg qpop
Patch queue now empty
% hg log
changeset:   0:91e2fa566682
tag:         tip
user:        "user at host.com"
date:        Tue Nov 28 13:29:45 2006 +0100
summary:     initial commit

% hg qpush
applying changeset.diff
Now at: changeset.diff
% hg qpop
Patch queue now empty



When changeset.diff is applied, I see it in the normal hg log output.
That is nice. When I run hg qpop, it is no longer on the hg log
output. That is also what I want.
I also looked in the .hg directory and the patch dissappears from the
.hg/data/a.txt.i file and from the .hg/00changelog.i and
.hg/00manifest.i files.

So every trace from that patch disappears from the repository. That is
what i have requested!

The remaining question is, how is that behaviour handled in hg?
When I look at the log output that contains changeset 1:3149856f4f18
it seems that the patch was committed to the repository.

After running qpop, the patch is gone from the repository. So it looks
like an uncommit operation. Is that correct?

The main reason for that question is, that an uncommit is
difficult/impossible in e.g. svn or Gnu Arch. So I thought that the
changeset 1:3149856f4f18 is still stored somewhere in the repository.


Stefan.



More information about the Mercurial-devel mailing list