[PATCH] bookmarks: active bookmark diverges if a pull would move it (issue3682)

Kevin Bullock kbullock+mercurial at ringworld.org
Wed Oct 24 16:04:47 CDT 2012


# HG changeset patch
# User Kevin Bullock <kbullock at ringworld.org>
# Date 1351112598 18000
# Branch stable
# Node ID 188c42046dfd1441455c63cdde13c0ef757d17a5
# Parent  acd4577a568d22d3e58bab28600a5ce0a3f87ce1
bookmarks: active bookmark diverges if a pull would move it (issue3682)

Before this change, a pull could move the active bookmark (even
backwards). This resulted in the bookmark no longer being active (but
still being listed in .hg/bookmarks.current -- also see issue3683).

After this change, if a pull would move the active bookmark, the
divergent bookmarks machinery is invoked, leaving the active bookmark
where it was.

diff --git a/mercurial/bookmarks.py b/mercurial/bookmarks.py
--- a/mercurial/bookmarks.py
+++ b/mercurial/bookmarks.py
@@ -196,7 +196,7 @@ def updatefromremote(ui, repo, remote, p
                 cl = repo[nl]
                 if cl.rev() >= cr.rev():
                     continue
-                if validdest(repo, cl, cr):
+                if validdest(repo, cl, cr) and k != repo._bookmarkcurrent:
                     repo._bookmarks[k] = cr.node()
                     changed = True
                     ui.status(_("updating bookmark %s\n") % k)
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
@@ -29,9 +29,9 @@ import bookmark by name
 
   $ hg init ../b
   $ cd ../b
-  $ hg book Y
+  $ hg book --inactive Y
   $ hg book
-   * Y                         -1:000000000000
+     Y                         -1:000000000000
   $ hg pull ../a
   pulling from ../a
   requesting all changes


More information about the Mercurial-devel mailing list