[PATCH] bookmarks: allow pushing active bookmark on new remote head (issue5236)

liscju piotr.listkiewicz at gmail.com
Tue May 24 21:45:22 UTC 2016


# HG changeset patch
# User liscju <piotr.listkiewicz at gmail.com>
# Date 1464125787 -7200
#      Tue May 24 23:36:27 2016 +0200
# Node ID b8913ddebb3dc5f73b1ca2e17206bcfa64bcd217
# Parent  ceca932c080d0de52ece0e8dd0226f006c7b9cb1
bookmarks: allow pushing active bookmark on new remote head (issue5236)

Before 'hg push -B .' on new remote head complained with:
abort: push creates new remote head ...

It was because _nowarnheads was not expanding active bookmark
name, so it didn't add active bookmark "proper" name to no
warn heads list.

diff --git a/mercurial/discovery.py b/mercurial/discovery.py
--- a/mercurial/discovery.py
+++ b/mercurial/discovery.py
@@ -240,15 +240,16 @@ def _oldheadssummary(repo, remoteheads, 
 
 def _nowarnheads(pushop):
     # Compute newly pushed bookmarks. We don't warn about bookmarked heads.
-
-    # internal config: bookmarks.pushing
-    newbookmarks = pushop.ui.configlist('bookmarks', 'pushing')
-
     repo = pushop.repo.unfiltered()
     remote = pushop.remote
     localbookmarks = repo._bookmarks
     remotebookmarks = remote.listkeys('bookmarks')
     bookmarkedheads = set()
+
+    # internal config: bookmarks.pushing
+    newbookmarks = [localbookmarks.expandname(b)
+                    for b in pushop.ui.configlist('bookmarks', 'pushing')]
+
     for bm in localbookmarks:
         rnode = remotebookmarks.get(bm)
         if rnode and rnode in repo:
diff --git a/tests/test-bookmarks-pushpull.t b/tests/test-bookmarks-pushpull.t
--- a/tests/test-bookmarks-pushpull.t
+++ b/tests/test-bookmarks-pushpull.t
@@ -690,7 +690,7 @@ pushing a new bookmark on a new head doe
   $ echo c5 > f2
   $ hg ci -Am5
   created new head
-  $ hg push -B W
+  $ hg push -B .
   pushing to http://localhost:$HGPORT/
   searching for changes
   remote: adding changesets


More information about the Mercurial-devel mailing list