How to unhide a hidden (obsolete) changeset?

Michael McNeil Forbes michael.forbes at gmail.com
Sun Feb 2 00:56:35 UTC 2014


On Feb 1, 2014, at 4:41 PM, Pierre-Yves David <pierre-yves.david at ens-lyon.org> wrote:

> quick answer:
> 
> 1) do not use strip

Even if I do not strip, pulling from a does not reset changeset "2"'s after I force it to draft.

> 2) see `hg help touch` for a way to make it non-obsolete again.

I see.  Does this mean there is no way of making repo b exactly
the same as repo a without re-cloning?  That is kind of unsettling.
I expected I could muck about with my local repository as much as I
want, and then just blow everything I don't like away and re-pull
from a to undo anything I break (keeping new local branches for example).

My question remains: For some purposes, I really would like to simply
mark the old changeset as no-longer obsolete so that pulling from
repo a actually updates repo b to behave like repo a.  There must
be some way of doing this, even if it is destructive.

(The actual use case right now is futzing about with using
pull-requests on bitbucket for code reviews and it turns out
that one can't even fully delete and restore a project there,
so I am not even sure that re-cloning will work properly.
I was hoping I could at least do this with the mercurial repo.
I appreciate this is not something someone should do with an
actual working repo.)

Michael.


> On 02/01/2014 04:31 PM, Michael McNeil Forbes wrote:
>> How can I unhide a change set?
>> 
>> Consider this example (using the rebase and evolve extensions):
>> 
>> hg init a
>> cd a
>> touch A0.txt
>> hg add
>> hg com -m "A0"
>> touch A1.txt
>> hg add
>> hg com -m "A1"
>> 
>> hg up 0
>> touch B0.txt
>> hg add
>> hg com -m "B0"
>> 
>> cd ..
>> hg clone a b
>> cd b
>> hg phase -fd 2
>> hg rebase -s 2 -d 1
>> 
>> # Repo a has:
>> hg glog -q
>> @  2:cd21b5c368bd
>> |
>> | o  1:06898f86274e
>> |/
>> o  0:9bfb043e4c4a
>> 
>> # Repo b has:
>> hg --hidden glog -q
>> @  3:063f76a41d36
>> |
>> | x  2:cd21b5c368bd
>> | |
>> o |  1:06898f86274e
>> |/
>> o  0:9bfb043e4c4a
>> 
>> # Now, suppose I decide I do not want to do this, so I strip changesets 3 (and 2 for good measure) and pull again:
>> 
>> cd b
>> hg strip 3
>> hg --hidden strip 2
>> hg pull
>> hg --hidden glog -q
>> o  2:cd21b5c368bd
>> |
>> | @  1:06898f86274e
>> |/
>> o  0:9bfb043e4c4a
>> 
>> # So far so good, but if I make changeset 2 draft again to edit it, it is still hidden
>> hg phase -fd 2
>> hg --hidden glog -q
>> x  2:cd21b5c368bd
>> |
>> | @  1:06898f86274e
>> |/
>> o  0:9bfb043e4c4a
>> 
>> # How do I unhide changeset 2 so that repo b behaves like a repo a?
>> 
>> Michael.






More information about the Mercurial mailing list