template: rename troubles templatekw into instabilities
authorBoris Feld <boris.feld@octobus.net>
Wed, 02 Aug 2017 11:32:25 +0200
changeset 33709 511d6ae462f3
parent 33708 71b77b61ed60
child 33710 2e43c5cd57a7
template: rename troubles templatekw into instabilities Rename troubles template keyword into instabilities and add a deprecation warning on templatekw. Update default mapfile and test files to use the new template keyword. The renaming is done according to https://www.mercurial-scm.org/wiki/CEDVocabulary. Differential Revision: https://phab.mercurial-scm.org/D237
mercurial/templatekw.py
mercurial/templates/map-cmdline.default
tests/test-obsolete-divergent.t
tests/test-obsolete.t
tests/test-template-engine.t
--- a/mercurial/templatekw.py	Sun Aug 06 11:40:53 2017 -0700
+++ b/mercurial/templatekw.py	Wed Aug 02 11:32:25 2017 +0200
@@ -765,9 +765,21 @@
     return repo.ui.termwidth()
 
 @templatekeyword('troubles')
-def showtroubles(**args):
+def showtroubles(repo, **args):
     """List of strings. Evolution troubles affecting the changeset.
 
+    (DEPRECATED)
+    """
+    msg = ("'troubles' is deprecated, "
+           "use 'instabilities'")
+    repo.ui.deprecwarn(msg, '4.4')
+
+    return showinstabilities(repo=repo, **args)
+
+@templatekeyword('instabilities')
+def showinstabilities(**args):
+    """List of strings. Evolution instabilities affecting the changeset.
+
     (EXPERIMENTAL)
     """
     args = pycompat.byteskwargs(args)
--- a/mercurial/templates/map-cmdline.default	Sun Aug 06 11:40:53 2017 -0700
+++ b/mercurial/templates/map-cmdline.default	Wed Aug 02 11:32:25 2017 +0200
@@ -29,7 +29,7 @@
 
 # General templates
 _trouble_label = 'trouble.{trouble}'
-_troubles_labels = '{if(troubles, "changeset.troubled {troubles%_trouble_label}")}'
+_troubles_labels = '{if(instabilities, "changeset.troubled {instabilities%_trouble_label}")}'
 _obsolete_label = '{if(obsolete, "changeset.obsolete")}'
 _cset_labels = '{separate(" ", "log.changeset", "changeset.{phase}", "{_obsolete_label}", "{_troubles_labels}")}'
 cset = '{label("{_cset_labels}",
@@ -68,8 +68,8 @@
 ldate = '{label("log.date",
                 "date:        {date|date}")}\n'
 
-ltroubles = '{if(troubles, "{label('log.trouble',
-                                   'trouble:     {join(troubles, ", ")}')}\n")}'
+ltroubles = '{if(instabilities, "{label('log.trouble',
+                                   'instability: {join(instabilities, ", ")}')}\n")}'
 
 extra = '{label("ui.debug log.extra",
                 "extra:       {key}={value|stringescape}")}\n'
--- a/tests/test-obsolete-divergent.t	Sun Aug 06 11:40:53 2017 -0700
+++ b/tests/test-obsolete-divergent.t	Wed Aug 02 11:32:25 2017 +0200
@@ -670,7 +670,7 @@
 
   $ rm .hg/localtags
   $ hg cleanup --config extensions.t=$TESTTMP/scmutilcleanup.py
-  $ hg log -G -T '{rev}:{node|short} {desc} {troubles}' -r 'sort(all(), topo)'
+  $ hg log -G -T '{rev}:{node|short} {desc} {instabilities}' -r 'sort(all(), topo)'
   @  5:1a2a9b5b0030 B2 content-divergent
   |
   | o  4:70d5a63ca112 B4 content-divergent
--- a/tests/test-obsolete.t	Sun Aug 06 11:40:53 2017 -0700
+++ b/tests/test-obsolete.t	Wed Aug 02 11:32:25 2017 +0200
@@ -3,7 +3,7 @@
   > # public changeset are not obsolete
   > publish=false
   > [ui]
-  > logtemplate="{rev}:{node|short} ({phase}{if(obsolete, ' *{obsolete}*')}{if(troubles, ' {troubles}')}) [{tags} {bookmarks}] {desc|firstline}\n"
+  > logtemplate="{rev}:{node|short} ({phase}{if(obsolete, ' *{obsolete}*')}{if(instabilities, ' {instabilities}')}) [{tags} {bookmarks}] {desc|firstline}\n"
   > EOF
   $ mkcommit() {
   >    echo "$1" > "$1"
@@ -934,7 +934,7 @@
   changeset:   7:50c51b361e60
   user:        test
   date:        Thu Jan 01 00:00:00 1970 +0000
-  trouble:     orphan, phase-divergent
+  instability: orphan, phase-divergent
   summary:     add babar
   
   $ hg log -T default -r 'obsolete()'
--- a/tests/test-template-engine.t	Sun Aug 06 11:40:53 2017 -0700
+++ b/tests/test-template-engine.t	Wed Aug 02 11:32:25 2017 +0200
@@ -10,7 +10,7 @@
   >     def process(self, t, map):
   >         tmpl = self.loader(t)
   >         for k, v in map.iteritems():
-  >             if k in ('templ', 'ctx', 'repo', 'revcache', 'cache'):
+  >             if k in ('templ', 'ctx', 'repo', 'revcache', 'cache', 'troubles'):
   >                 continue
   >             if hasattr(v, '__call__'):
   >                 v = v(**map)