prune: handle bookmark stable
authorPierre-Yves David <pierre-yves.david@ens-lyon.org>
Mon, 04 Feb 2013 21:38:19 +0100
branchstable
changeset 693 d3c1fe0035d1
parent 692 a2938a539f44
child 694 c800d7ca4583
prune: handle bookmark
hgext/evolve.py
tests/test-prune.t
--- a/hgext/evolve.py	Mon Feb 04 21:40:58 2013 +0100
+++ b/hgext/evolve.py	Mon Feb 04 21:38:19 2013 +0100
@@ -1298,6 +1298,16 @@
         if newnode.node() != wdp.node():
             commands.update(ui, repo, newnode.rev())
             ui.status(_('working directory now at %s\n') % newnode)
+        # upVdate bookmarks
+        for ctx in repo.unfiltered().set('bookmark() and %ld', precs):
+            ldest = list(repo.set('max((::%d) - obsolete())', ctx))
+            if ldest:
+                dest = ldest[0]
+                updatebookmarks = _bookmarksupdater(repo, ctx.node())
+                updatebookmarks(dest.node())
+            else:
+                # delete bookmarks
+                pass
     finally:
         lockmod.release(lock, wlock)
 
--- a/tests/test-prune.t	Mon Feb 04 21:40:58 2013 +0100
+++ b/tests/test-prune.t	Mon Feb 04 21:38:19 2013 +0100
@@ -1,6 +1,6 @@
   $ cat >> $HGRCPATH <<EOF
   > [ui]
-  > logtemplate={rev}:{node|short}[] ({obsolete}/{phase}) {desc|firstline}\n
+  > logtemplate={rev}:{node|short}[{bookmarks}] ({obsolete}/{phase}) {desc|firstline}\n
   > [extensions]
   > hgext.rebase=
   > EOF
@@ -20,8 +20,9 @@
   $ mkcommit c
   $ mkcommit d
   $ mkcommit e
+  $ hg bookmarks BABAR
   $ hg log -G
-  @  4:9d206ffc875e[] (stable/draft) add e
+  @  4:9d206ffc875e[BABAR] (stable/draft) add e
   |
   o  3:47d2a3944de8[] (stable/draft) add d
   |
@@ -109,7 +110,7 @@
   | |
   | o  5:814c38b95e72[] (stable/draft) add bb
   |/
-  o  0:1f0dee641bb7[] (stable/public) add a
+  o  0:1f0dee641bb7[BABAR] (stable/public) add a
   
 
 one old, one new
@@ -137,7 +138,7 @@
   | |
   | o  5:814c38b95e72[] (stable/draft) add bb
   |/
-  o  0:1f0dee641bb7[] (stable/public) add a
+  o  0:1f0dee641bb7[BABAR] (stable/public) add a
   
 
 one old, two new
@@ -164,7 +165,7 @@
   | |
   | o  5:814c38b95e72[] (stable/draft) add bb
   |/
-  o  0:1f0dee641bb7[] (stable/public) add a
+  o  0:1f0dee641bb7[BABAR] (stable/public) add a
   
 
 two old, two new (should be denied)