Hello everyone,

The following sequence of commands requires that the Mercurial Queues
exension be enabled, and also the Evolve extension (for `hg amend`,
alias `hg refresh`).

This combination of commands messes up the existing Mercurial queue,
making the commit corresponding to the pushed patch obsolete, and
creating a new commit with exactly the same contents.

This error is in theory quite easy to make: just type `hg ref` instead
of `hg qref`, but I just made it recently after using Mercurial Queues
for years. Regardless, I haven't figured out a clean way to fix this
and get back the original state.

Note that a simple `hg rollback` does work in my example, but I'm not
sure it will work in my case, because I've tried other things trying
to fix this. In any case, `hg rollback` isn't something one should
rely on.  In summary, how do I undo the `hg amend` and get back my
applied MQ patch?

I've also posted this on Stack Overflow -

Please CC me on any reply. Thanks in advance.

Regards, Faheem Mitha


    cd /tmp
    hg init test
    cd test
    echo "This is foo" >> foo
    hg add
    hg ci -m "Add foo"
    hg init --mq
    echo "Line 2 of foo" >> foo
    hg qnew p
    hg ci --mq -m "Add patch p"
    hg ref

hg log -vG --hidden

    @  changeset:   2:16592b49676e
    |  tag:         tip
    |  parent:      0:31a3f37ddd33
    |  user:        Faheem Mitha <fah...@faheem.info>
    |  date:        Mon Mar 12 11:04:45 2018 +0530
    |  files:       foo
    |  description:
    |  [mq]: p
    | x  changeset:   1:c00213b8eb4d
    |/   tag:         p
    |    tag:         qbase
    |    tag:         qtip
    |    user:        Faheem Mitha <fah...@faheem.info>
    |    date:        Mon Mar 12 11:04:43 2018 +0530
    |    obsolete:    rewritten using amend as 2:16592b49676e by Faheem Mitha 
<fah...@faheem.info> (at 2018-03-12 11:04 +0530)
    |    obsolete:    rewritten by Faheem Mitha <fah...@faheem.info> as 
16592b49676e (at 2018-03-12 11:04 +0530)
    |    files:       foo
    |    description:
    |    [mq]: p
    o  changeset:   0:31a3f37ddd33
       tag:         qparent
       user:        Faheem Mitha <fah...@faheem.info>
       date:        Mon Mar 12 11:04:43 2018 +0530
       files:       foo
       Add foo
Mercurial mailing list

Reply via email to