Mercurial > hg-stable
changeset 18122:730b769fb634 stable
bookmarks: fix head selection for merge with two bookmarked heads
A type mismatch caused the search for the other head to fail. The code is
fragile, and instead it ended up using the 'first' bookmark head, but the
ordering is undefined and it could thus randomly use the wrong bookmarkhead
and fail with:
$ hg up -q -C e@diverged
$ hg merge
abort: merging with a working directory ancestor has no effect
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Mon, 24 Dec 2012 13:26:13 +0100 |
parents | 777084ac8416 |
children | 7f5a0eba3768 8ab0640c3090 |
files | mercurial/commands.py tests/test-bookmarks-merge.t |
diffstat | 2 files changed, 21 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/commands.py Thu Nov 29 08:44:54 2012 -0500 +++ b/mercurial/commands.py Mon Dec 24 13:26:13 2012 +0100 @@ -4288,7 +4288,7 @@ if not node and repo._bookmarkcurrent: bmheads = repo.bookmarkheads(repo._bookmarkcurrent) - curhead = repo[repo._bookmarkcurrent] + curhead = repo[repo._bookmarkcurrent].node() if len(bmheads) == 2: if curhead == bmheads[0]: node = bmheads[1]
--- a/tests/test-bookmarks-merge.t Thu Nov 29 08:44:54 2012 -0500 +++ b/tests/test-bookmarks-merge.t Mon Dec 24 13:26:13 2012 +0100 @@ -75,9 +75,27 @@ $ echo f > f $ hg commit -Am "f" adding f + $ hg bookmarks -r 4 "e@diverged" + $ hg up -q -C "e@diverged" + $ hg merge + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + (branch merge, don't forget to commit) + $ hg parents + changeset: 4:a0546fcfe0fb + bookmark: e@diverged + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: d + + changeset: 5:26bee9c5bcf3 + bookmark: e + parent: 3:b8f96cf4688b + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: e + $ hg up -C e - 1 files updated, 0 files merged, 2 files removed, 0 files unresolved - $ hg bookmarks -r 4 "e@diverged" + 1 files updated, 0 files merged, 1 files removed, 0 files unresolved $ hg bookmarks b 1:d2ae7f538514 c 3:b8f96cf4688b