Patchwork [5,of,6,V2] templates: add "changeset.obsolete" label in command line style

login
register
mail settings
Submitter Denis Laxalde
Date March 28, 2017, 9:09 p.m.
Message ID <2c19dbbb54ff65847d93.1490735343@marimba>
Download mbox | patch
Permalink /patch/19795/
State Accepted
Headers show

Comments

Denis Laxalde - March 28, 2017, 9:09 p.m.
# HG changeset patch
# User Denis Laxalde <denis@laxalde.org>
# Date 1490434829 -3600
#      Sat Mar 25 10:40:29 2017 +0100
# Node ID 2c19dbbb54ff65847d93665072f4452ab9e357e8
# Parent  59177c6110f2dc3e60730b00d54738528071b8ed
# Available At https://bitbucket.org/dlax/hg-work
#              hg pull https://bitbucket.org/dlax/hg-work -r 2c19dbbb54ff
# EXP-Topic obsolete-ui
templates: add "changeset.obsolete" label in command line style

Following respective change in cmdutil.changeset_printer.
Yuya Nishihara - March 29, 2017, 2:34 p.m.
On Tue, 28 Mar 2017 23:09:03 +0200, Denis Laxalde wrote:
> # HG changeset patch
> # User Denis Laxalde <denis@laxalde.org>
> # Date 1490434829 -3600
> #      Sat Mar 25 10:40:29 2017 +0100
> # Node ID 2c19dbbb54ff65847d93665072f4452ab9e357e8
> # Parent  59177c6110f2dc3e60730b00d54738528071b8ed
> # Available At https://bitbucket.org/dlax/hg-work
> #              hg pull https://bitbucket.org/dlax/hg-work -r 2c19dbbb54ff
> # EXP-Topic obsolete-ui
> templates: add "changeset.obsolete" label in command line style
> 
> Following respective change in cmdutil.changeset_printer.
> 
> 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
> @@ -30,7 +30,8 @@ lfile_copies_switch = '{if(file_copies_s
>  # General templates
>  _trouble_label = 'trouble.{trouble}'
>  _troubles_labels = '{if(troubles, "changeset.troubled {troubles%_trouble_label}")}'
> -_cset_labels = '{separate(" ", "log.changeset", "changeset.{phase}", "{_troubles_labels}")}'
> +_obsolete_label = '{if(obsolete, "changeset.obsolete")}'
> +_cset_labels = '{separate(" ", "log.changeset", "changeset.{phase}", "{_obsolete_label}", "{_troubles_labels}")}'

Just nitpick. 'f("{x}")' can be written as 'f(x)' so long as 'x' generates
a str.

Patch

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
@@ -30,7 +30,8 @@  lfile_copies_switch = '{if(file_copies_s
 # General templates
 _trouble_label = 'trouble.{trouble}'
 _troubles_labels = '{if(troubles, "changeset.troubled {troubles%_trouble_label}")}'
-_cset_labels = '{separate(" ", "log.changeset", "changeset.{phase}", "{_troubles_labels}")}'
+_obsolete_label = '{if(obsolete, "changeset.obsolete")}'
+_cset_labels = '{separate(" ", "log.changeset", "changeset.{phase}", "{_obsolete_label}", "{_troubles_labels}")}'
 cset = '{label("{_cset_labels}",
                "changeset:   {rev}:{node|short}")}\n'
 
diff --git a/tests/test-obsolete.t b/tests/test-obsolete.t
--- a/tests/test-obsolete.t
+++ b/tests/test-obsolete.t
@@ -830,6 +830,13 @@  test the default cmdline template
   trouble:     unstable, bumped
   summary:     add babar
   
+  $ hg log -T default -r 'obsolete()'
+  changeset:   6:3de5eca88c00
+  parent:      3:6f9641995072
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     add obsolete_e
+  
 
 test summary output