Issues with hg update -C and bookmarks

Marc Strapetz marc.strapetz at syntevo.com
Tue Jul 14 22:17:11 UTC 2015


On 14.07.2015 20:55, Matt Mackall wrote:
> On Tue, 2015-07-14 at 16:21 +0200, Marc Strapetz wrote:
>> With the following setup:
>>
>> $ hg init
>> $ touch x
>> $ hg commit -A "initial import"
>> $ touch y
>> $ hg commit -A -m "y added"
>> $ hg checkout 0
>> $ touch z
>> $ hg commit -A -m "z added"
>> $ hg up 1
>> $ hg bookmark bm
>>
>> There will be default with two diverged heads at r1 and r2 and a
>> bookmark on r1.
>>
>> $ hg summary
>> parent: 1:4009599f6088
>>    y added
>> branch: default
>> bookmarks: *bm
>> ...
>>
>> Starting from this setup, following behavior is rather unexpected to me:
>>
>> (1) hg update -C . will loose the active bookmark
>>
>> $ hg update -C .
>
> You've supplied an explicit revision to go to. In other words "go to the
> revision named '.' (and take me off my bookmark)". This is maybe
> suboptimal for '.'... but is the right behavior for every other type of
> name.

We are using "hg update -C ." to discard a merge. Current workaround is 
to explicitly specify the active bookmark (so no real problem).

> Vaguely recent Mercurial (3.0.1 or later) will tell you it's
> deactivating the bookmark.

Yes, this message is reported.

>> (2) hg upgdate -C checks out r2 (expected), but leaves bookmark bm
>> active (unexpected)
>>
>> $ hg update -C
>> $ hg summary
>> parent: 2:eb990d6c7e06 tip
>>    z added
>> branch: default
>> commit: (clean)
>> update: 1 new changesets, 2 branch heads (merge)
>
> Ignoring the -C for now, bare "hg update" says "take me to the head of
> what I'm working on". Without branches, this means the branch head of
> the branch you're on. With bookmarks, this currently means a descendant
> of the bookmark, by analogy.
>
>> $ hg bookmarks
>>    * bm                        1:4009599f6088
>
> Yeah, that's weird. But you also have an old hg, so...

:) Mercurial 3.4.2, released on 2015-07-01?

-Marc




More information about the Mercurial mailing list