Bug 3677 - hg clone with a bookmark 'default' updates to bookmark not branch tip
Summary: hg clone with a bookmark 'default' updates to bookmark not branch tip
Status: RESOLVED FIXED
Alias: None
Product: Mercurial
Classification: Unclassified
Component: Mercurial (show other bugs)
Version: earlier
Hardware: PC Linux
: normal bug
Assignee: Bugzilla
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-10-23 12:54 UTC by David Soria Parra
Modified: 2017-11-01 18:04 UTC (History)
6 users (show)

See Also:
Python Version: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Soria Parra 2012-10-23 12:54 UTC
$ hg init test
$ cd test
$ echo a > a
$ hg ci -Ama a
$ echo b > b
$ hg ci -Amb b
$ hg bookmark -r '.^' -f default
$ cd ../
$ hg clone test test2
$ hg -R test2 log -r 
changeset:   0:9059a54cfb1f
bookmark:    default
user:        David Soria Parra <dsp@php.net>
date:        Tue Oct 23 18:39:29 2012 +0200
summary:     a

it's caused by mercurial/hg.py:412. We are doing a lookup in default. As bookmarks are checked before branches, this causes the bug to be triggered and default bm is choosen instead of the branch tip.
Comment 1 Thomas Arendsen Hein 2012-10-26 04:51 UTC
The problem can be created without using hg bookmark -f, too:

hg init foo
cd foo
hg branch bar
hg ci -m bar
hg bookmark default
Comment 2 Thomas Arendsen Hein 2012-10-26 07:24 UTC
Additionally a branch named "@" will be checked out by automatically.
I have a fix for this and will push it to stable after writing tests for all cases.
Comment 3 Thomas Arendsen Hein 2012-10-26 07:53 UTC
just pushed:

changeset:   17867:c9339efed653
branch:      stable
user:        Thomas Arendsen Hein <thomas@intevation.de>
date:        Fri Oct 26 12:36:15 2012 +0200
summary:     clone: make sure to use "@" as bookmark and "default" as branch (issue3677)

changeset:   17868:04755508f8ed
branch:      stable
user:        Thomas Arendsen Hein <thomas@intevation.de>
date:        Fri Oct 26 13:09:55 2012 +0200
summary:     test-bookmarks.t: check that bookmark "default" is not automatically checked out

changeset:   17869:c79b404b99ae
branch:      stable
bookmark:    @
bookmark:    crew-stable
tag:         tip
user:        Thomas Arendsen Hein <thomas@intevation.de>
date:        Fri Oct 26 13:20:44 2012 +0200
summary:     test-clone.t: check that branch "@" is not automatically checked out