[PATCH 2 of 3 V2] templates: display evolution "troubles" in command line style
Denis Laxalde
denis.laxalde at logilab.fr
Tue Nov 8 09:19:56 EST 2016
# HG changeset patch
# User Denis Laxalde <denis.laxalde at logilab.fr>
# Date 1478597306 -3600
# Tue Nov 08 10:28:26 2016 +0100
# Node ID b5d3d230bbc64d44968a9912e8e72aac8236522a
# Parent 8be06285117259ddd122201b1e0428711c0e2a6b
# EXP-Topic evolve-ui
templates: display evolution "troubles" in command line style
Add a "troubles" template keyword to fetch evolution troubles, test it in
test-obsolete.t.
diff --git a/mercurial/templatekw.py b/mercurial/templatekw.py
--- a/mercurial/templatekw.py
+++ b/mercurial/templatekw.py
@@ -315,6 +315,11 @@ def showextras(**args):
return _hybrid(f, extras, makemap,
lambda x: '%s=%s' % (x['key'], x['value']))
+ at templatekeyword('troubles')
+def showtroubles(**args):
+ """List of evolution troubles of this changeset."""
+ return showlist('trouble', args['ctx'].troubles(), **args)
+
@templatekeyword('file_adds')
def showfileadds(**args):
"""List of strings. Files added by this changeset."""
diff --git a/mercurial/templates/map-cmdline.default b/mercurial/templates/map-cmdline.default
--- a/mercurial/templates/map-cmdline.default
+++ b/mercurial/templates/map-cmdline.default
@@ -1,9 +1,9 @@
# Base templates. Due to name clashes with existing keywords, we have
# to replace some keywords with 'lkeyword', for 'labelled keyword'
-changeset = '{cset}{branches}{bookmarks}{tags}{parents}{user}{ldate}{summary}\n'
+changeset = '{cset}{branches}{bookmarks}{tags}{parents}{user}{ldate}{ltroubles}{summary}\n'
changeset_quiet = '{lnode}'
-changeset_verbose = '{cset}{branches}{bookmarks}{tags}{parents}{user}{ldate}{lfiles}{lfile_copies_switch}{description}\n'
-changeset_debug = '{fullcset}{branches}{bookmarks}{tags}{lphase}{parents}{manifest}{user}{ldate}{lfile_mods}{lfile_adds}{lfile_dels}{lfile_copies_switch}{extras}{description}\n'
+changeset_verbose = '{cset}{branches}{bookmarks}{tags}{parents}{user}{ldate}{ltroubles}{lfiles}{lfile_copies_switch}{description}\n'
+changeset_debug = '{fullcset}{branches}{bookmarks}{tags}{lphase}{parents}{manifest}{user}{ldate}{ltroubles}{lfile_mods}{lfile_adds}{lfile_dels}{lfile_copies_switch}{extras}{description}\n'
# File templates
lfiles = '{if(files,
@@ -28,13 +28,15 @@ lfile_copies_switch = '{if(file_copies_s
% ' {name} ({source})'}\n"))}'
# General templates
-cset = '{label("log.changeset changeset.{phase}",
+_trouble_label = 'trouble.{trouble}'
+_cset_labels = 'log.changeset changeset.{phase}{if(troubles, " changeset.troubled {troubles%_trouble_label}")}'
+cset = '{label("{_cset_labels}",
"changeset: {rev}:{node|short}")}\n'
lphase = '{label("log.phase",
"phase: {phase}")}\n'
-fullcset = '{label("log.changeset changeset.{phase}",
+fullcset = '{label("{_cset_labels}",
"changeset: {rev}:{node}")}\n'
parent = '{label("log.parent changeset.{phase}",
@@ -64,6 +66,9 @@ summary = '{if(desc|strip, "{label('log.
ldate = '{label("log.date",
"date: {date|date}")}\n'
+ltroubles = '{if(troubles, "{label('ui.note log.troubles',
+ 'troubles: {troubles}')}\n")}'
+
extra = '{label("ui.debug log.extra",
"extra: {key}={value|stringescape}")}\n'
diff --git a/tests/test-obsolete.t b/tests/test-obsolete.t
--- a/tests/test-obsolete.t
+++ b/tests/test-obsolete.t
@@ -3,7 +3,7 @@
> # public changeset are not obsolete
> publish=false
> [ui]
- > logtemplate="{rev}:{node|short} ({phase}) [{tags} {bookmarks}] {desc|firstline}\n"
+ > logtemplate="{rev}:{node|short} ({phase}{if(troubles, ' {troubles}')}) [{tags} {bookmarks}] {desc|firstline}\n"
> EOF
$ mkcommit() {
> echo "$1" > "$1"
@@ -203,7 +203,7 @@ Check that public changeset are not acco
$ hg --hidden phase --public 2
$ hg log -G
- @ 5:5601fb93a350 (draft) [tip ] add new_3_c
+ @ 5:5601fb93a350 (draft bumped) [tip ] add new_3_c
|
| o 2:245bde4270cd (public) [ ] add original_c
|/
@@ -220,7 +220,7 @@ note that the bumped changeset (5:5601fb
the public changeset
$ hg log --hidden -r 'bumped()'
- 5:5601fb93a350 (draft) [tip ] add new_3_c
+ 5:5601fb93a350 (draft bumped) [tip ] add new_3_c
And that we can't push bumped changeset
@@ -485,7 +485,7 @@ detect outgoing obsolete and unstable
phases: 3 draft
unstable: 1 changesets
$ hg log -G -r '::unstable()'
- @ 5:cda648ca50f5 (draft) [tip ] add original_e
+ @ 5:cda648ca50f5 (draft unstable) [tip ] add original_e
|
x 4:94b33453f93b (draft) [ ] add original_d
|
@@ -527,7 +527,7 @@ Don't try to push extinct changeset
2:245bde4270cd (public) [ ] add original_c
3:6f9641995072 (draft) [ ] add n3w_3_c
4:94b33453f93b (draft) [ ] add original_d
- 5:cda648ca50f5 (draft) [tip ] add original_e
+ 5:cda648ca50f5 (draft unstable) [tip ] add original_e
$ hg push ../tmpf -f # -f because be push unstable too
pushing to ../tmpf
searching for changes
@@ -548,7 +548,7 @@ no warning displayed
Do not warn about new head when the new head is a successors of a remote one
$ hg log -G
- @ 5:cda648ca50f5 (draft) [tip ] add original_e
+ @ 5:cda648ca50f5 (draft unstable) [tip ] add original_e
|
x 4:94b33453f93b (draft) [ ] add original_d
|
More information about the Mercurial-devel
mailing list