[PATCH V2] evolve: add template to show evolution troubles (issue4686)

liscju piotr.listkiewicz at gmail.com
Tue Sep 6 04:32:18 EDT 2016


# HG changeset patch
# User liscju <piotr.listkiewicz at gmail.com>
# Date 1473150616 -7200
#      Tue Sep 06 10:30:16 2016 +0200
# Branch stable
# Node ID 5273ba1d2b0027ce48238adfcf272adbfde9ddfe
# Parent  7a2e0629bdee8cd842bb884094cef9683ed49520
evolve: add template to show evolution troubles (issue4686)

diff --git a/hgext/evolve.py b/hgext/evolve.py
--- a/hgext/evolve.py
+++ b/hgext/evolve.py
@@ -4048,6 +4048,14 @@ def clean(orig, repo, *args, **kwargs):
     util.unlinkpath(repo.join('evolvestate'), ignoremissing=True)
     return ret
 
+ at eh.wrapfunction(mercurial.templater, 'templatepaths')
+def wraptemplatepaths(origfn):
+    origtemplatepaths = origfn()
+    datapath = os.path.dirname(__file__)
+    origtemplatepaths.append(
+        os.path.normpath(os.path.join(datapath, 'templates')))
+    return origtemplatepaths
+
 def _evolvestatewrite(repo, state):
     # [version]
     # [type][length][content]
diff --git a/hgext/templates/map-cmdline.evolution b/hgext/templates/map-cmdline.evolution
new file mode 100644
--- /dev/null
+++ b/hgext/templates/map-cmdline.evolution
@@ -0,0 +1,6 @@
+%include map-cmdline.default
+changeset = '{cset}{levolution}{branches}{bookmarks}{tags}{parents}{user}{ldate}{summary}\n'
+changeset_verbose = '{cset}{levolution}{branches}{bookmarks}{tags}{parents}{user}{ldate}{lfiles}{lfile_copies_switch}{description}\n'
+
+levolution = '{label("log.evolution",
+                     "evolution:   {join(troubles, ', ')}")}\n'
\ No newline at end of file
diff --git a/tests/test-evolve-list.t b/tests/test-evolve-list.t
--- a/tests/test-evolve-list.t
+++ b/tests/test-evolve-list.t
@@ -77,4 +77,42 @@ Test the divergence listing
   c882616e9d84: b
     divergent: a922b3733e98 (public) (precursor d2ae7f538514)
   
+Show evolution troubles in log with evolution template
+
+  $ hg log -T evolution
+  changeset:   5:a922b3733e98
+  evolution:   
+  tag:         tip
+  parent:      3:980f7dc84c29
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     b
+  
+  changeset:   4:c882616e9d84
+  evolution:   divergent
+  parent:      2:d36c0562f908
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     b
+  
+  changeset:   3:980f7dc84c29
+  evolution:   
+  parent:      0:cb9a9f314b8b
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     d
+  
+  changeset:   2:d36c0562f908
+  evolution:   
+  parent:      0:cb9a9f314b8b
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     c
+  
+  changeset:   0:cb9a9f314b8b
+  evolution:   
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     a
+  
   $ cd ..


More information about the Mercurial-devel mailing list