changeset 2905:610d06bcd714

convertbookmark: properly exclude public changeset Public changeset are immutable and cannot have a topic anyway.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Fri, 01 Sep 2017 17:04:21 +0200
parents 4ae89b5834e6
children 92566275be77
files hgext3rd/topic/__init__.py tests/test-topic-debugcb.t
diffstat 2 files changed, 47 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/topic/__init__.py	Fri Sep 01 16:51:49 2017 +0200
+++ b/hgext3rd/topic/__init__.py	Fri Sep 01 17:04:21 2017 +0200
@@ -525,9 +525,9 @@
     """
 
     # copied from mercurial.repair.stripbmrevset
-    bookrevset = ("ancestors(bookmark(%s)) - ancestors(head() and not "
-                  "bookmark(%s)) - ancestors(bookmark() and not "
-                  "bookmark(%s))")
+    bookrevset = ("not public() and (ancestors(bookmark(%s)) - ancestors(head()"
+                  "and not bookmark(%s)) - ancestors(bookmark()"
+                  "and not bookmark(%s)))")
     touchedrevs = repo.revs(bookrevset, bmark, bmark, bmark)
     rewrote = _changetopics(ui, repo, touchedrevs, bmark)
     # We didn't changed topic to any changesets because the revset
--- a/tests/test-topic-debugcb.t	Fri Sep 01 16:51:49 2017 +0200
+++ b/tests/test-topic-debugcb.t	Fri Sep 01 17:04:21 2017 +0200
@@ -19,6 +19,7 @@
   $ cd repo
   $ echo "Hello" > root
   $ hg commit -Aqm "root"
+  $ hg phase --public .
   $ echo "Hello" > a
   $ hg commit -Aqm "First commit"
   $ echo "Hello" > b
@@ -157,6 +158,7 @@
   $ cd setup1
   $ echo "Hello" > root
   $ hg commit -Aqm "root"
+  $ hg phase --public .
   $ echo "Hello" > A
   $ hg commit -Aqm "A"
   $ echo "Hello" > B
@@ -218,6 +220,7 @@
   $ cd setup2
   $ echo "Hello" > root
   $ hg commit -Aqm "root"
+  $ hg phase --public .
   $ echo "Hello" > A
   $ hg commit -Aqm "A"
   $ hg phase --public .
@@ -265,3 +268,44 @@
   |
   o  [0:249055fcca50] root
   
+
+Check that phase are properly take in account
+---------------------------------------------
+
+(we reuse above test, taking advantage of a small bug regarding stacked bookmarks. we can fuse the two tests once that bug is fixed)
+
+  $ cd ..
+  $ hg init setup-phases
+  $ cd setup-phases
+  $ echo "Hello" > root
+  $ hg commit -Aqm "root"
+  $ hg phase --public .
+  $ echo "Hello" > A
+  $ hg commit -Aqm "A"
+  $ echo "Hello" > B
+  $ hg commit -Aqm "B"
+  $ echo "Hello" > C
+  $ hg commit -Aqm "C"
+  $ hg bookmark -r . bar
+  $ hg log -G
+  @  [3:ac05e0d05d00] C
+  |    bookmark: bar
+  o  [2:10f317d09e78] B
+  |
+  o  [1:e34122c9a2bf] A
+  |
+  o  [0:249055fcca50] root
+  
+
+  $ hg debugconvertbookmark --all
+  switching to topic bar
+  changed topic to "bar" on 3 revisions
+  $ hg log -G
+  @  [6:863c43a7951c] C
+  |    topic: bar
+  o  [5:ac7f12ac947f] B
+  |    topic: bar
+  o  [4:fc82c8c14b4c] A
+  |    topic: bar
+  o  [0:249055fcca50] root
+