Patchwork [STABLE] bookmarks: fix formatting of exchange message (issue4439)

login
register
mail settings
Submitter Pierre-Yves David
Date Nov. 5, 2014, 6:08 p.m.
Message ID <1743ad376a1aae9981a8.1415210900@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/6587/
State Accepted
Headers show

Comments

Pierre-Yves David - Nov. 5, 2014, 6:08 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@fb.com>
# Date 1415208300 0
#      Wed Nov 05 17:25:00 2014 +0000
# Node ID 1743ad376a1aae9981a8fdd57f3690e8a8c0d819
# Parent  832b7ef275c855f6f68d59b9dd8fc539ee1dd4a2
bookmarks: fix formatting of exchange message (issue4439)

The message formatting was crashing when doing explicit pulling `hg pull -B X`.
This changeset fix it and improved the test coverage.
Matt Mackall - Nov. 5, 2014, 6:30 p.m.
On Wed, 2014-11-05 at 18:08 +0000, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david@fb.com>
> # Date 1415208300 0
> #      Wed Nov 05 17:25:00 2014 +0000
> # Node ID 1743ad376a1aae9981a8fdd57f3690e8a8c0d819
> # Parent  832b7ef275c855f6f68d59b9dd8fc539ee1dd4a2
> bookmarks: fix formatting of exchange message (issue4439)

Queued for stable, thanks.

Patch

diff --git a/mercurial/bookmarks.py b/mercurial/bookmarks.py
--- a/mercurial/bookmarks.py
+++ b/mercurial/bookmarks.py
@@ -388,21 +388,21 @@  def updatefromremote(ui, repo, remotemar
 
     for b, scid, dcid in diverge:
         if b in explicit:
             explicit.discard(b)
             changed.append((b, bin(scid), status,
-                            _("importing bookmark %s\n") % (b, b)))
+                            _("importing bookmark %s\n") % (b)))
         else:
             db = _diverge(ui, b, path, localmarks)
             changed.append((db, bin(scid), warn,
                             _("divergent bookmark %s stored as %s\n")
                             % (b, db)))
     for b, scid, dcid in adddst + advdst:
         if b in explicit:
             explicit.discard(b)
             changed.append((b, bin(scid), status,
-                            _("importing bookmark %s\n") % (b, b)))
+                            _("importing bookmark %s\n") % (b)))
 
     if changed:
         tr = trfunc()
         for b, node, writer, msg in sorted(changed):
             localmarks[b] = node
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
@@ -52,10 +52,21 @@  import bookmark by name
   phases	
   $ hg debugpushkey ../a bookmarks
   X	4e3505fd95835d721066b76e75dbb8cc554d7f77
   Y	4e3505fd95835d721066b76e75dbb8cc554d7f77
   Z	4e3505fd95835d721066b76e75dbb8cc554d7f77
+
+delete the bookmark to repull it
+
+  $ hg book -d X
+  $ hg pull -B X ../a
+  pulling from ../a
+  no changes found
+  adding remote bookmark X
+
+finally no-op pull
+
   $ hg pull -B X ../a
   pulling from ../a
   no changes found
   $ hg bookmark
      X                         0:4e3505fd9583
@@ -164,10 +175,22 @@  divergent bookmarks
      @                         1:0d2164f0ce0d
    * X                         1:0d2164f0ce0d
      Y                         0:4e3505fd9583
      Z                         1:0d2164f0ce0d
 
+explicite pull should overwrite the local version (issue4439)
+
+  $ hg pull --config paths.foo=../a foo -B X
+  pulling from $TESTTMP/a (glob)
+  no changes found
+  divergent bookmark @ stored as @foo
+  importing bookmark X
+
+reinstall state for further testing:
+
+  $ hg book -fr 9b140be10808 X
+
 revsets should not ignore divergent bookmarks
 
   $ hg bookmark -fr 1 Z
   $ hg log -r 'bookmark()' --template '{rev}:{node|short} {bookmarks}\n'
   0:4e3505fd9583 Y