changeset 23082:0fc4686de1d7 stable

exchange: don't report failure from identical bookmarks b901645a8784 regressed the behavior of pushing an unchanged bookmark to a remote. Before that commit, pushing a unchanged bookmark would result in "exporting bookmark @" being printed. After that commit, we now see an incorrect message "bookmark %s does not exist on the local or remote repository!" This patch fixes the regression introduced by b901645a8784 by having the bookmark error reporting code filter identical bookmarks and adds a test for the behavior.
author Gregory Szorc <gregory.szorc@gmail.com>
date Fri, 24 Oct 2014 17:24:46 -0500
parents e62c330a044f
children ee45f5c2ffcc
files mercurial/exchange.py tests/test-bookmarks-pushpull.t
diffstat 2 files changed, 30 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/exchange.py	Fri Oct 24 10:40:37 2014 -0700
+++ b/mercurial/exchange.py	Fri Oct 24 17:24:46 2014 -0500
@@ -355,6 +355,10 @@
             explicit.remove(b)
             # treat as "deleted locally"
             pushop.outbookmarks.append((b, dcid, ''))
+    # identical bookmarks shouldn't get reported
+    for b, scid, dcid in same:
+        if b in explicit:
+            explicit.remove(b)
 
     if explicit:
         explicit = sorted(explicit)
--- a/tests/test-bookmarks-pushpull.t	Fri Oct 24 10:40:37 2014 -0700
+++ b/tests/test-bookmarks-pushpull.t	Fri Oct 24 17:24:46 2014 -0500
@@ -438,3 +438,29 @@
   cc978a373a53 tip W
 
   $ cd ..
+
+pushing an unchanged bookmark should result in no changes
+
+  $ hg init unchanged-a
+  $ hg init unchanged-b
+  $ cd unchanged-a
+  $ echo initial > foo
+  $ hg commit -A -m initial
+  adding foo
+  $ hg bookmark @
+  $ hg push -B @ ../unchanged-b
+  pushing to ../unchanged-b
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files
+  exporting bookmark @
+
+  $ hg push -B @ ../unchanged-b
+  pushing to ../unchanged-b
+  searching for changes
+  no changes found
+  [1]
+
+  $ cd ..