Issues with hg update -C and bookmarks
Ryan McElroy
rm at fb.com
Mon Jul 20 21:39:59 UTC 2015
On 7/14/2015 10:28 AM, Sean Farley wrote:
> Marc Strapetz <marc.strapetz at syntevo.com> writes:
>
>> 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 .
>> $ hg summary
>> parent: 1:4009599f6088
>> y added
>> branch: default
>> bookmarks: bm
>> commit: (clean)
>> update: 1 new changesets, 2 branch heads (merge)
>>
>> I would expect to see bookmark "*bm" still active.
>>
>> (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)
>>
>> $ hg bookmarks
>> * bm 1:4009599f6088
>>
>> I would probably expect that bookmark "bm" isn't active anymore. What's
>> the meaning of an active bookmark which is not checked out?
> You've hit a bit of a sore spot with bookmarks. I was hoping Ryan
> McElroy (hereby thrown under the bus) would be the one to submit some
> patches in this direction but haven't seen any yet.
>
> In my vision, 'hg up' without any argument should *not* move the
> bookmark. It's another discussion as to where 'hg up' should go to in a
> world with bookmarks.
>
I've been run over by a bus, apparently, but maybe I deserved it. At any
rate, bookmarks are pretty inconsistent in Mercurial today, but it's
unclear what we can make more consistent while not breaking backwards
compatibility, so progress is slow.
~Ryan
More information about the Mercurial
mailing list