templatekw: add `instabilities` alias for `troubles`
authorMatt Harbison <matt_harbison@yahoo.com>
Sat, 27 Apr 2019 22:45:16 -0400
changeset 4625 a4fde4e3e763
parent 4624 c9798965b1f4
child 4626 561e97db1cf7
templatekw: add `instabilities` alias for `troubles` Per https://www.mercurial-scm.org/wiki/CEDVocabulary
hgext3rd/evolve/templatekw.py
tests/test-evolve-content-divergent-basic.t
tests/test-evolve-content-divergent-corner-cases.t
tests/test-evolve-content-divergent-meta.t
tests/test-evolve-public-content-divergent-corner-cases.t
tests/test-evolve-public-content-divergent-discard.t
tests/test-evolve-public-content-divergent-main.t
tests/test-evolve.t
--- a/hgext3rd/evolve/templatekw.py	Sat Apr 27 22:59:48 2019 -0400
+++ b/hgext3rd/evolve/templatekw.py	Sat Apr 27 22:45:16 2019 -0400
@@ -24,17 +24,32 @@
 ### template keywords
 
 if util.safehasattr(templatekw, 'compatlist'):
+    @eh.templatekeyword('instabilities', requires=set(['ctx', 'templ']))
+    def showinstabilities(context, mapping):
+        """List of strings. Evolution instabilities affecting the changeset
+        (zero or more of "orphan", "content-divergent" or "phase-divergent")."""
+        ctx = context.resource(mapping, 'ctx')
+        return templatekw.compatlist(context, mapping, 'instability',
+                                     ctx.instabilities(),
+                                     plural='instabilities')
+
     @eh.templatekeyword('troubles', requires=set(['ctx', 'templ']))
-    def showtroubles(context, mapping):
+    def showtroubles(context, mapping):   # legacy name for instabilities
         ctx = context.resource(mapping, 'ctx')
         return templatekw.compatlist(context, mapping, 'trouble',
                                      ctx.instabilities(), plural='troubles')
 else:
     # older template API in hg < 4.6
+    @eh.templatekeyword('instabilities')
+    def showinstabilities(**args):
+        """List of strings. Evolution instabilities affecting the changeset
+        (zero or more of "orphan", "content-divergent" or "phase-divergent")."""
+        ctx = args['ctx']
+        return templatekw.showlist('instability', ctx.instabilities(), args,
+                                   plural='instabilities')
+
     @eh.templatekeyword('troubles')
     def showtroubles(**args):
-        """List of strings. Evolution troubles affecting the changeset
-        (zero or more of "unstable", "divergent" or "bumped")."""
         ctx = args['ctx']
         return templatekw.showlist('trouble', ctx.instabilities(), args,
                                    plural='troubles')
--- a/tests/test-evolve-content-divergent-basic.t	Sat Apr 27 22:59:48 2019 -0400
+++ b/tests/test-evolve-content-divergent-basic.t	Sat Apr 27 22:45:16 2019 -0400
@@ -20,7 +20,7 @@
   > git = 1
   > unified = 0
   > [ui]
-  > logtemplate = {rev}:{node|short}@{branch}({phase}) {desc|firstline} [{troubles}]\n
+  > logtemplate = {rev}:{node|short}@{branch}({phase}) {desc|firstline} [{instabilities}]\n
   > [extensions]
   > EOF
   $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/" >> $HGRCPATH
--- a/tests/test-evolve-content-divergent-corner-cases.t	Sat Apr 27 22:59:48 2019 -0400
+++ b/tests/test-evolve-content-divergent-corner-cases.t	Sat Apr 27 22:45:16 2019 -0400
@@ -20,7 +20,7 @@
   > git = 1
   > unified = 0
   > [ui]
-  > logtemplate = {rev}:{node|short}@{branch}({phase}) {desc|firstline} [{troubles}]\n
+  > logtemplate = {rev}:{node|short}@{branch}({phase}) {desc|firstline} [{instabilities}]\n
   > [extensions]
   > EOF
   $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/" >> $HGRCPATH
--- a/tests/test-evolve-content-divergent-meta.t	Sat Apr 27 22:59:48 2019 -0400
+++ b/tests/test-evolve-content-divergent-meta.t	Sat Apr 27 22:45:16 2019 -0400
@@ -9,7 +9,7 @@
 
   $ cat >> $HGRCPATH <<EOF
   > [alias]
-  > glog = log -GT "{rev}:{node|short} {desc|firstline}\n {phase} {troubles}\n\n"
+  > glog = log -GT "{rev}:{node|short} {desc|firstline}\n {phase} {instabilities}\n\n"
   > [phases]
   > publish = False
   > [extensions]
--- a/tests/test-evolve-public-content-divergent-corner-cases.t	Sat Apr 27 22:59:48 2019 -0400
+++ b/tests/test-evolve-public-content-divergent-corner-cases.t	Sat Apr 27 22:45:16 2019 -0400
@@ -9,7 +9,7 @@
 =====
   $ cat >> $HGRCPATH <<EOF
   > [alias]
-  > glog = log -GT "{rev}:{node|short} {desc|firstline}\n {phase} {troubles}\n\n"
+  > glog = log -GT "{rev}:{node|short} {desc|firstline}\n {phase} {instabilities}\n\n"
   > [phases]
   > publish = False
   > [extensions]
--- a/tests/test-evolve-public-content-divergent-discard.t	Sat Apr 27 22:59:48 2019 -0400
+++ b/tests/test-evolve-public-content-divergent-discard.t	Sat Apr 27 22:45:16 2019 -0400
@@ -14,7 +14,7 @@
 =====
   $ cat >> $HGRCPATH <<EOF
   > [alias]
-  > glog = log -GT "{rev}:{node|short} {desc|firstline}\n {phase} {troubles}\n\n"
+  > glog = log -GT "{rev}:{node|short} {desc|firstline}\n {phase} {instabilities}\n\n"
   > [phases]
   > publish = False
   > [extensions]
--- a/tests/test-evolve-public-content-divergent-main.t	Sat Apr 27 22:59:48 2019 -0400
+++ b/tests/test-evolve-public-content-divergent-main.t	Sat Apr 27 22:45:16 2019 -0400
@@ -12,7 +12,7 @@
 =====
   $ cat >> $HGRCPATH <<EOF
   > [alias]
-  > glog = log -GT "{rev}:{node|short} {desc|firstline}\n {phase} {troubles}\n\n"
+  > glog = log -GT "{rev}:{node|short} {desc|firstline}\n {phase} {instabilities}\n\n"
   > [phases]
   > publish = False
   > [extensions]
--- a/tests/test-evolve.t	Sat Apr 27 22:59:48 2019 -0400
+++ b/tests/test-evolve.t	Sat Apr 27 22:45:16 2019 -0400
@@ -441,7 +441,7 @@
 
 (ninja test for the {trouble} template:
 
-  $ hg log -G --template '{rev} {troubles}\n'
+  $ hg log -G --template '{rev} {instabilities}\n'
   @  10
   |
   | *  9 orphan