Issues with hg update -C and bookmarks

Matt Mackall mpm at selenic.com
Tue Jul 14 18:55:44 UTC 2015


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.

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

> (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...

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial mailing list