hgext/evolve.py
branchstable
changeset 892 947fb5b1915b
parent 891 36c1c80e99a3
child 893 12ed6dfa8eea
--- a/hgext/evolve.py	Thu Apr 03 23:36:23 2014 -0700
+++ b/hgext/evolve.py	Wed Mar 26 23:58:45 2014 +0100
@@ -1277,7 +1277,12 @@
     displayer = cmdutil.show_changeset(ui, repo, {'template': shorttemplate})
     if len(parents) == 1:
         p = parents[0]
-        hg.update(repo, p.rev())
+        bm = bookmarks.readcurrent(repo)
+        shouldmove = bm is not None and bookmarks.iscurrent(repo, bm)
+        ret = hg.update(repo, p.rev())
+        if not ret and shouldmove:
+            repo._bookmarks[bm] = p.node()
+            repo._bookmarks.write()
         displayer.show(p)
         return 0
     else:
@@ -1303,7 +1308,12 @@
         return 1
     if len(children) == 1:
         c = children[0]
-        hg.update(repo, c.rev())
+        bm = bookmarks.readcurrent(repo)
+        shouldmove = bm is not None and bookmarks.iscurrent(repo, bm)
+        ret = hg.update(repo, c.rev())
+        if not ret and shouldmove:
+            repo._bookmarks[bm] = c.node()
+            repo._bookmarks.write()
         displayer.show(c)
         return 0
     else: