diff hgext/evolve.py @ 1342:16017e1bb2a1 stable

prune: with active bookmark should stay active hg prune with an active bookmark was deactivating the bookmark after the prune. This patch makes sure that if a bookmark was active before a "prune" operation (except prune -B) then the bookmark stays activate afterwards.
author Laurent Charignon <lcharignon@fb.com>
date Mon, 18 May 2015 17:24:38 -0700
parents f455ce2a3587
children 376d3df9f47b 39f2c1ab3a53
line wrap: on
line diff
--- a/hgext/evolve.py	Mon May 18 13:58:57 2015 -0400
+++ b/hgext/evolve.py	Mon May 18 17:24:38 2015 -0700
@@ -1808,8 +1808,20 @@
                 newnode = newnode.parents()[0]
 
         if newnode.node() != wdp.node():
+            bookactive = bmactive(repo)
+            # Active bookmark that we don't want to delete (with -B option)
+            # we deactivate and move it before the update and reactivate it
+            # after
+            movebookmark = bookactive and not bookmark
+            if movebookmark:
+                bookmarks.deactivate(repo)
+                repo._bookmarks[bookactive] = newnode.node()
+                repo._bookmarks.write()
             commands.update(ui, repo, newnode.rev())
             ui.status(_('working directory now at %s\n') % newnode)
+            if movebookmark:
+                bookmarks.activate(repo, bookactive)
+
         # update bookmarks
         if bookmark:
             _deletebookmark(ui, marks, bookmark)