templates: change {obsolete} to emit only "obsolete" or ""
authorMartin von Zweigbergk <martinvonz@google.com>
Fri, 09 Sep 2016 16:42:41 -0700
changeset 1732 f4047fba5e90
parent 1731 7a76f9a43e89
child 1733 060fe417679f
templates: change {obsolete} to emit only "obsolete" or "" The {obsolete} template function can currently emit "stable", "unstable", "extinct", or "suspended". The distinction between "extinct" and "suspended" seems likely to be more confusing that enlightening, and "stable" and "unstable" are not even obsolete. Let's simplify it to just emit "obsolete" for obsolete changesets and "" for others. That will also make it much easier to test for obsolete changsets and do things like "if(obsolete, obsolete, troubles)".
hgext/evolve.py
tests/test-evolve.t
tests/test-obsolete-push.t
tests/test-obsolete.t
tests/test-prune.t
tests/test-uncommit.t
--- a/hgext/evolve.py	Wed Sep 07 17:51:15 2016 +0200
+++ b/hgext/evolve.py	Fri Sep 09 16:42:41 2016 -0700
@@ -665,17 +665,11 @@
 
 @eh.templatekw('obsolete')
 def obsoletekw(repo, ctx, templ, **args):
-    """:obsolete: String. The obsolescence level of the node, could be
-    ``stable``, ``unstable``, ``suspended`` or ``extinct``.
+    """:obsolete: String. Whether the changeset is ``obsolete``.
     """
     if ctx.obsolete():
-        if ctx.extinct():
-            return 'extinct'
-        else:
-            return 'suspended'
-    elif ctx.unstable():
-        return 'unstable'
-    return 'stable'
+        return 'obsolete'
+    return ''
 
 @eh.templatekw('troubles')
 def showtroubles(repo, ctx, **args):
--- a/tests/test-evolve.t	Wed Sep 07 17:51:15 2016 +0200
+++ b/tests/test-evolve.t	Fri Sep 09 16:42:41 2016 -0700
@@ -112,13 +112,13 @@
 test kill and immutable changeset
 
   $ hg log -r 1 --template '{rev} {phase} {obsolete}\n'
-  1 public stable
+  1 public 
   $ hg prune 1
   abort: cannot prune immutable changeset: 7c3bad9141dc
   (see "hg help phases" for details)
   [255]
   $ hg log -r 1 --template '{rev} {phase} {obsolete}\n'
-  1 public stable
+  1 public 
 
 test simple kill
 
@@ -694,7 +694,7 @@
   (use 'hg resolve' and 'hg graft --continue')
   [255]
   $ hg log -r7 --template '{rev}:{node|short} {obsolete}\n'
-  7:a5bfd90a2f29 stable
+  7:a5bfd90a2f29 
   $ echo 3 > 1
   $ hg resolve -m 1
   (no more unresolved files)
--- a/tests/test-obsolete-push.t	Wed Sep 07 17:51:15 2016 +0200
+++ b/tests/test-obsolete-push.t	Fri Sep 09 16:42:41 2016 -0700
@@ -6,7 +6,7 @@
   > EOF
   $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext/evolve.py" >> $HGRCPATH
 
-  $ template='{rev}:{node|short}@{branch}({obsolete}/{phase}) {desc|firstline}\n'
+  $ template='{rev}:{node|short}@{branch}({separate("/", obsolete, phase)}) {desc|firstline}\n'
   $ glog() {
   >   hg glog --template "$template" "$@"
   > }
@@ -29,11 +29,11 @@
   2 changesets pruned
   1 new unstable changesets
   $ glog --hidden
-  @  2:244232c2222a@default(unstable/secret) C
+  @  2:244232c2222a@default(secret) C
   |
-  | x  1:6c81ed0049f8@default(extinct/draft) B
+  | x  1:6c81ed0049f8@default(obsolete/draft) B
   |/
-  x  0:1994f17a630e@default(suspended/draft) A
+  x  0:1994f17a630e@default(obsolete/draft) A
   
   $ hg init ../clone
   $ cat >  ../clone/.hg/hgrc <<EOF
@@ -43,4 +43,4 @@
   $ hg outgoing ../clone --template "$template"
   comparing with ../clone
   searching for changes
-  0:1994f17a630e@default(suspended/draft) A
+  0:1994f17a630e@default(obsolete/draft) A
--- a/tests/test-obsolete.t	Wed Sep 07 17:51:15 2016 +0200
+++ b/tests/test-obsolete.t	Fri Sep 09 16:42:41 2016 -0700
@@ -150,19 +150,19 @@
 
 Test obsolete keyword
 
-  $ hg log -G --template '{rev}:{node|short}@{branch}({obsolete}/{phase}) {desc|firstline}\n' \
-  >   --hidden
-  @  5:a7a6f2b5d8a5@default(unstable/draft) add d
+  $ hg --hidden log -G \
+  >  --template '{rev}:{node|short}@{branch}({separate("/", obsolete, phase)}) {desc|firstline}\n'
+  @  5:a7a6f2b5d8a5@default(draft) add d
   |
-  | o  4:725c380fe99b@default(stable/draft) add obsol_c'
+  | o  4:725c380fe99b@default(draft) add obsol_c'
   | |
-  x |  3:0d3f46688ccc@default(suspended/draft) add obsol_c
+  x |  3:0d3f46688ccc@default(obsolete/draft) add obsol_c
   |/
-  | x  2:4538525df7e2@default(extinct/draft) add c
+  | x  2:4538525df7e2@default(obsolete/draft) add c
   |/
-  o  1:7c3bad9141dc@default(stable/draft) add b
+  o  1:7c3bad9141dc@default(draft) add b
   |
-  o  0:1f0dee641bb7@default(stable/public) add a
+  o  0:1f0dee641bb7@default(public) add a
   
 
 Test communication of obsolete relation with a compatible client
--- a/tests/test-prune.t	Wed Sep 07 17:51:15 2016 +0200
+++ b/tests/test-prune.t	Fri Sep 09 16:42:41 2016 -0700
@@ -1,6 +1,6 @@
   $ cat >> $HGRCPATH <<EOF
   > [ui]
-  > logtemplate={rev}:{node|short}[{bookmarks}] ({obsolete}/{phase}) {desc|firstline}\n
+  > logtemplate={rev}:{node|short}[{bookmarks}] ({separate('/', obsolete ,phase)}) {desc|firstline}\n
   > [extensions]
   > EOF
   $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext/evolve.py" >> $HGRCPATH
@@ -21,15 +21,15 @@
   $ mkcommit e
   $ hg bookmarks BABAR
   $ hg log -G
-  @  4:9d206ffc875e[BABAR] (stable/draft) add e
+  @  4:9d206ffc875e[BABAR] (draft) add e
   |
-  o  3:47d2a3944de8[] (stable/draft) add d
+  o  3:47d2a3944de8[] (draft) add d
   |
-  o  2:4538525df7e2[] (stable/draft) add c
+  o  2:4538525df7e2[] (draft) add c
   |
-  o  1:7c3bad9141dc[] (stable/draft) add b
+  o  1:7c3bad9141dc[] (draft) add b
   |
-  o  0:1f0dee641bb7[] (stable/public) add a
+  o  0:1f0dee641bb7[] (public) add a
   
 
 Check arguments exclusive to each other
@@ -109,23 +109,23 @@
   $ mkcommit nE
 
   $ hg log -G
-  @  12:6e8148413dd5[] (stable/draft) add nE
+  @  12:6e8148413dd5[] (draft) add nE
   |
-  o  11:8ee176ff1d4b[] (stable/draft) add nD
+  o  11:8ee176ff1d4b[] (draft) add nD
   |
-  o  10:aa96dc3f04c2[] (stable/draft) add nC
+  o  10:aa96dc3f04c2[] (draft) add nC
   |
-  o  9:6f6f25e4f748[] (stable/draft) add nB
+  o  9:6f6f25e4f748[] (draft) add nB
   |
-  | o  8:bb5e90a7ea1f[] (stable/draft) add ee
+  | o  8:bb5e90a7ea1f[] (draft) add ee
   | |
-  | o  7:00ded550b1e2[] (stable/draft) add dd
+  | o  7:00ded550b1e2[] (draft) add dd
   | |
-  | o  6:354011cd103f[] (stable/draft) add cc
+  | o  6:354011cd103f[] (draft) add cc
   | |
-  | o  5:814c38b95e72[] (stable/draft) add bb
+  | o  5:814c38b95e72[] (draft) add bb
   |/
-  o  0:1f0dee641bb7[BABAR] (stable/public) add a
+  o  0:1f0dee641bb7[BABAR] (public) add a
   
 
 one old, one new
@@ -143,21 +143,21 @@
   47d2a3944de8b013de3be9578e8e344ea2e6c097 0 {4538525df7e2b9f09423636c61ef63a4cb872a2d} (*) {'user': 'test'} (glob)
   bb5e90a7ea1f3b4b38b23150a4a597b6146d70ef 6e8148413dd541855b72a920a90c06fca127c7e7 0 (*) {'user': 'test'} (glob)
   $ hg log -G
-  @  12:6e8148413dd5[] (stable/draft) add nE
+  @  12:6e8148413dd5[] (draft) add nE
   |
-  o  11:8ee176ff1d4b[] (stable/draft) add nD
+  o  11:8ee176ff1d4b[] (draft) add nD
   |
-  o  10:aa96dc3f04c2[] (stable/draft) add nC
+  o  10:aa96dc3f04c2[] (draft) add nC
   |
-  o  9:6f6f25e4f748[] (stable/draft) add nB
+  o  9:6f6f25e4f748[] (draft) add nB
   |
-  | o  7:00ded550b1e2[] (stable/draft) add dd
+  | o  7:00ded550b1e2[] (draft) add dd
   | |
-  | o  6:354011cd103f[] (stable/draft) add cc
+  | o  6:354011cd103f[] (draft) add cc
   | |
-  | o  5:814c38b95e72[] (stable/draft) add bb
+  | o  5:814c38b95e72[] (draft) add bb
   |/
-  o  0:1f0dee641bb7[BABAR] (stable/public) add a
+  o  0:1f0dee641bb7[BABAR] (public) add a
   
 
 one old, two new
@@ -175,19 +175,19 @@
   bb5e90a7ea1f3b4b38b23150a4a597b6146d70ef 6e8148413dd541855b72a920a90c06fca127c7e7 0 (*) {'user': 'test'} (glob)
   00ded550b1e28bba454bd34cec1269d22cf3ef25 aa96dc3f04c2c2341fe6880aeb6dc9fbffff9ef9 8ee176ff1d4b2034ce51e3efc579c2de346b631d 0 (*) {'user': 'test'} (glob)
   $ hg log -G
-  @  12:6e8148413dd5[] (stable/draft) add nE
+  @  12:6e8148413dd5[] (draft) add nE
   |
-  o  11:8ee176ff1d4b[] (stable/draft) add nD
+  o  11:8ee176ff1d4b[] (draft) add nD
   |
-  o  10:aa96dc3f04c2[] (stable/draft) add nC
+  o  10:aa96dc3f04c2[] (draft) add nC
   |
-  o  9:6f6f25e4f748[] (stable/draft) add nB
+  o  9:6f6f25e4f748[] (draft) add nB
   |
-  | o  6:354011cd103f[] (stable/draft) add cc
+  | o  6:354011cd103f[] (draft) add cc
   | |
-  | o  5:814c38b95e72[] (stable/draft) add bb
+  | o  5:814c38b95e72[] (draft) add bb
   |/
-  o  0:1f0dee641bb7[BABAR] (stable/public) add a
+  o  0:1f0dee641bb7[BABAR] (public) add a
   
 
 two old, two new (should be denied)
@@ -373,56 +373,56 @@
   (leaving bookmark rg)
   $ hg bookmark r10
   $ hg log -G
-  o  15:cd0038e05e1b[rg] (stable/draft) add rg
+  o  15:cd0038e05e1b[rg] (draft) add rg
   |
-  | x  14:43227190fef8[] (extinct/draft) r14
+  | x  14:43227190fef8[] (obsolete/draft) r14
   | |
-  | | x  13:b4594d867745[] (extinct/draft) r13
+  | | x  13:b4594d867745[] (obsolete/draft) r13
   | | |
-  | | | x  12:e46a4836065c[] (extinct/draft) r12
+  | | | x  12:e46a4836065c[] (obsolete/draft) r12
   | | |/
-  | | o  11:bab5d5bf48bd[] (stable/draft) r11
+  | | o  11:bab5d5bf48bd[] (draft) r11
   | |/
-  +---@  10:ff43616e5d0f[B r10] (stable/draft) r10
+  +---@  10:ff43616e5d0f[B r10] (draft) r10
   | |
-  o |  8:d62d843c9a01[] (stable/draft) r8
+  o |  8:d62d843c9a01[] (draft) r8
   | |
-  o |  7:e7d9710d9fc6[] (stable/draft) r7
+  o |  7:e7d9710d9fc6[] (draft) r7
   |/
-  o    3:2b6d669947cd[] (stable/draft) r3
+  o    3:2b6d669947cd[] (draft) r3
   |\
-  | o  2:fa942426a6fd[] (stable/draft) r2
+  | o  2:fa942426a6fd[] (draft) r2
   | |
-  o |  1:66f7d451a68b[] (stable/draft) r1
+  o |  1:66f7d451a68b[] (draft) r1
   |/
-  o  0:1ea73414a91b[] (stable/draft) r0
+  o  0:1ea73414a91b[] (draft) r0
   
   $ hg prune 11
   1 changesets pruned
   $ hg log -G
-  o  15:cd0038e05e1b[rg] (stable/draft) add rg
+  o  15:cd0038e05e1b[rg] (draft) add rg
   |
-  | x  14:43227190fef8[] (extinct/draft) r14
+  | x  14:43227190fef8[] (obsolete/draft) r14
   | |
-  | | x  13:b4594d867745[] (extinct/draft) r13
+  | | x  13:b4594d867745[] (obsolete/draft) r13
   | | |
-  | | | x  12:e46a4836065c[] (extinct/draft) r12
+  | | | x  12:e46a4836065c[] (obsolete/draft) r12
   | | |/
-  | | x  11:bab5d5bf48bd[] (extinct/draft) r11
+  | | x  11:bab5d5bf48bd[] (obsolete/draft) r11
   | |/
-  +---@  10:ff43616e5d0f[B r10] (stable/draft) r10
+  +---@  10:ff43616e5d0f[B r10] (draft) r10
   | |
-  o |  8:d62d843c9a01[] (stable/draft) r8
+  o |  8:d62d843c9a01[] (draft) r8
   | |
-  o |  7:e7d9710d9fc6[] (stable/draft) r7
+  o |  7:e7d9710d9fc6[] (draft) r7
   |/
-  o    3:2b6d669947cd[] (stable/draft) r3
+  o    3:2b6d669947cd[] (draft) r3
   |\
-  | o  2:fa942426a6fd[] (stable/draft) r2
+  | o  2:fa942426a6fd[] (draft) r2
   | |
-  o |  1:66f7d451a68b[] (stable/draft) r1
+  o |  1:66f7d451a68b[] (draft) r1
   |/
-  o  0:1ea73414a91b[] (stable/draft) r0
+  o  0:1ea73414a91b[] (draft) r0
   
   $ hg book CELESTE
   $ hg prune -r . --keep
--- a/tests/test-uncommit.t	Wed Sep 07 17:51:15 2016 +0200
+++ b/tests/test-uncommit.t	Fri Sep 09 16:42:41 2016 -0700
@@ -5,7 +5,7 @@
   $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext/evolve.py" >> $HGRCPATH
 
   $ glog() {
-  >   hg glog --template '{rev}:{node|short}@{branch}({obsolete}/{phase}) {desc|firstline}\n' "$@"
+  >   hg glog --template '{rev}:{node|short}@{branch}({separate("/", obsolete, phase)}) {desc|firstline}\n' "$@"
   > }
 
   $ hg init repo
@@ -118,13 +118,13 @@
 Add a couple of bookmarks
 
   $ glog --hidden
-  @  3:5eb72dbe0cb4@bar(stable/draft) touncommit
+  @  3:5eb72dbe0cb4@bar(draft) touncommit
   |
-  o    2:f63b90038565@default(stable/draft) merge
+  o    2:f63b90038565@default(draft) merge
   |\
-  | o  1:f15c744d48e8@default(stable/draft) addmore
+  | o  1:f15c744d48e8@default(draft) addmore
   |
-  o  0:07f494440405@default(stable/draft) adda
+  o  0:07f494440405@default(draft) adda
   
   $ hg bookmark -r 2 unrelated
   $ hg bookmark touncommit-bm
@@ -217,15 +217,15 @@
   $ hg cat -r . e
   e
   $ glog --hidden
-  @  4:e8db4aa611f6@bar(stable/draft) touncommit
+  @  4:e8db4aa611f6@bar(draft) touncommit
   |
-  | x  3:5eb72dbe0cb4@bar(extinct/draft) touncommit
+  | x  3:5eb72dbe0cb4@bar(obsolete/draft) touncommit
   |/
-  o    2:f63b90038565@default(stable/draft) merge
+  o    2:f63b90038565@default(draft) merge
   |\
-  | o  1:f15c744d48e8@default(stable/draft) addmore
+  | o  1:f15c744d48e8@default(draft) addmore
   |
-  o  0:07f494440405@default(stable/draft) adda
+  o  0:07f494440405@default(draft) adda
   
   $ hg bookmarks
    * touncommit-bm             4:e8db4aa611f6
@@ -264,17 +264,17 @@
   R m
   R n
   $ glog --hidden
-  @  5:c706fe2c12f8@bar(stable/draft) touncommit
+  @  5:c706fe2c12f8@bar(draft) touncommit
   |
-  | o  4:e8db4aa611f6@bar(stable/draft) touncommit
+  | o  4:e8db4aa611f6@bar(draft) touncommit
   |/
-  | x  3:5eb72dbe0cb4@bar(extinct/draft) touncommit
+  | x  3:5eb72dbe0cb4@bar(obsolete/draft) touncommit
   |/
-  o    2:f63b90038565@default(stable/draft) merge
+  o    2:f63b90038565@default(draft) merge
   |\
-  | o  1:f15c744d48e8@default(stable/draft) addmore
+  | o  1:f15c744d48e8@default(draft) addmore
   |
-  o  0:07f494440405@default(stable/draft) adda
+  o  0:07f494440405@default(draft) adda
   
   $ hg debugobsolete
   5eb72dbe0cb409d094e3b4ae8eaa30071c1b8730 e8db4aa611f6d5706374288e6898e498f5c44098 0 (*) {'user': 'test'} (glob)