tla undo/redo like functionality for hg
Giorgos Keramidas
keramida at ceid.upatras.gr
Tue Nov 28 13:49:41 UTC 2006
On 2006-11-28 13:53, Stefan Reich?r <stefan at xsteve.at> wrote:
> Stefan Reich?r <stefan at xsteve.at> writes:
> 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.
Correct. Look at the files in ``.hg/patches/''.
The .hg/patches/ tree is a Mercurial repository with the patch queue.
You can use "hg qcommit" from the "parent" repo of the patch queue as a
commit operation of the patch queue, effectivelly creating a versioned
patch queue, with recorded 'patch states' which are known to work in a
particular manner.
More information about the Mercurial-devel
mailing list