bookmarks: don't deactivate on no-op update (issue4901)
authorMatt Mackall <mpm@selenic.com>
Wed, 14 Oct 2015 18:03:17 -0500
changeset 26676 71a485130beb
parent 26675 b73eb98c0243
child 26677 e9b3d523f2e6
bookmarks: don't deactivate on no-op update (issue4901)
mercurial/commands.py
tests/test-bookmarks.t
--- a/mercurial/commands.py	Thu Oct 15 00:32:20 2015 +0100
+++ b/mercurial/commands.py	Wed Oct 14 18:03:17 2015 -0500
@@ -6619,7 +6619,9 @@
             ret = hg.update(repo, rev)
 
         if not ret and movemarkfrom:
-            if bookmarks.update(repo, [movemarkfrom], repo['.'].node()):
+            if movemarkfrom == repo['.'].node():
+                pass # no-op update
+            elif bookmarks.update(repo, [movemarkfrom], repo['.'].node()):
                 ui.status(_("updating bookmark %s\n") % repo._activebookmark)
             else:
                 # this can happen with a non-linear update
--- a/tests/test-bookmarks.t	Thu Oct 15 00:32:20 2015 +0100
+++ b/tests/test-bookmarks.t	Wed Oct 14 18:03:17 2015 -0500
@@ -732,6 +732,19 @@
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   (activating bookmark four)
 
+no-op update doesn't deactive bookmarks
+
+  $ hg up
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg sum
+  parent: 3:9ba5f110a0b3 tip
+   y
+  branch: test
+  bookmarks: *four
+  commit: 2 unknown (clean)
+  update: (current)
+  phases: 4 draft
+
 test clearing divergent bookmarks of linear ancestors
 
   $ hg bookmark Z -r 0