[PATCH] fix push of moved bookmark on new branch head
Sune Foldager
cryo at cyanite.org
Sun Jun 24 13:07:42 CDT 2012
# HG changeset patch
# User Sune Foldager <cryo at cyanite.org>
# Date 1340561203 -7200
# Node ID da2ad8d2145be13166e289b8e91de324699e0296
# Parent ec5ef276077f9141f2ee4205ebcec9b48c6a0da0
fix push of moved bookmark on new branch head
The code only worked for local remotes, and wasn't touched by the test suite.
diff -r ec5ef276077f -r da2ad8d2145b mercurial/discovery.py
--- a/mercurial/discovery.py Fri Jun 22 02:39:52 2012 +0200
+++ b/mercurial/discovery.py Sun Jun 24 20:06:43 2012 +0200
@@ -225,7 +225,6 @@
# If there are more heads after the push than before, a suitable
# error message, depending on unsynced status, is displayed.
error = None
- remotebookmarks = remote.listkeys('bookmarks')
localbookmarks = repo._bookmarks
for branch in branches:
@@ -234,9 +233,14 @@
dhs = None
if len(newhs) > len(oldhs):
# strip updates to existing remote heads from the new heads list
- bookmarkedheads = set([repo[bm].node() for bm in localbookmarks
- if bm in remotebookmarks and
- remote[bm] == repo[bm].ancestor(remote[bm])])
+ remotebookmarks = remote.listkeys('bookmarks')
+ bookmarkedheads = set()
+ for bm in localbookmarks:
+ rnode = remotebookmarks.get(bm)
+ if rnode and rnode in repo:
+ lctx, rctx = repo[bm], repo[rnode]
+ if rctx == lctx.ancestor(rctx):
+ bookmarkedheads.add(lctx.node())
dhs = list(newhs - bookmarkedheads - oldhs)
if dhs:
if error is None:
diff -r ec5ef276077f -r da2ad8d2145b tests/test-bookmarks-pushpull.t
--- a/tests/test-bookmarks-pushpull.t Fri Jun 22 02:39:52 2012 +0200
+++ b/tests/test-bookmarks-pushpull.t Sun Jun 24 20:06:43 2012 +0200
@@ -177,8 +177,18 @@
adding f2
created new head
$ hg book -f Y
- $ hg push ../a
- pushing to ../a
+
+ $ cat <<EOF > ../a/.hg/hgrc
+ > [web]
+ > push_ssl = false
+ > allow_push = *
+ > EOF
+
+ $ hg -R ../a serve -p $HGPORT2 -d --pid-file=../hg2.pid
+ $ cat ../hg2.pid >> $DAEMON_PIDS
+
+ $ hg push http://localhost:$HGPORT2/
+ pushing to http://localhost:$HGPORT2/
searching for changes
abort: push creates new remote head 4efff6d98829!
(did you forget to merge? use push -f to force)
More information about the Mercurial-devel
mailing list