changeset 1344:376d3df9f47b

Merge with stable
author Laurent Charignon <lcharignon@fb.com>
date Wed, 20 May 2015 13:23:20 -0700
parents 41628bd60ee6 (current diff) 16017e1bb2a1 (diff)
children 37c505975e28
files hgext/evolve.py tests/test-prune.t
diffstat 2 files changed, 15 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/evolve.py	Thu May 14 11:32:04 2015 -0700
+++ b/hgext/evolve.py	Wed May 20 13:23:20 2015 -0700
@@ -1898,8 +1898,20 @@
                 repo.dirstate.rebuild(newnode.node(), newnode.manifest(), changedfiles)
                 repo.dirstate.write()
             else:
+                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)
--- a/tests/test-prune.t	Thu May 14 11:32:04 2015 -0700
+++ b/tests/test-prune.t	Wed May 20 13:23:20 2015 -0700
@@ -39,9 +39,10 @@
 
   $ hg prune --user blah --date '1979-12-15' .
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
-  (leaving bookmark BABAR)
   working directory now at 47d2a3944de8
   1 changesets pruned
+  $ hg bookmark
+   * BABAR                     3:47d2a3944de8
   $ hg debugobsolete
   9d206ffc875e1bc304590549be293be36821e66c 0 {47d2a3944de8b013de3be9578e8e344ea2e6c097} (Sat Dec 15 00:00:00 1979 +0000) {'user': 'blah'}
 
@@ -50,6 +51,7 @@
   $ hg prune 1
   1 changesets pruned
   2 new unstable changesets
+  $ hg book -i BABAR
   $ hg debugobsolete
   9d206ffc875e1bc304590549be293be36821e66c 0 {47d2a3944de8b013de3be9578e8e344ea2e6c097} (Sat Dec 15 00:00:00 1979 +0000) {'user': 'blah'}
   7c3bad9141dcb46ff89abf5f61856facd56e476c 0 {1f0dee641bb7258c56bd60e93edfa2405381c41e} (*) {'user': 'test'} (glob)