Patchwork [3,of,4] templates: add "changeset.obsolete" label in command line style

login
register
mail settings
Submitter Denis Laxalde
Date March 25, 2017, 1:09 p.m.
Message ID <94a70894c394268b845f.1490447358@marimba>
Download mbox | patch
Permalink /patch/19670/
State Superseded
Delegated to: Yuya Nishihara
Headers show

Comments

Denis Laxalde - March 25, 2017, 1: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 94a70894c394268b845f427f7643738a70e336bb
# Parent  c4c825f1402861e4b988395ac3deebcc6b5292cf
# Available At https://bitbucket.org/dlax/hg-work
#              hg pull https://bitbucket.org/dlax/hg-work -r 94a70894c394
# EXP-Topic obsolete-ui
templates: add "changeset.obsolete" label in command line style

Following respective change in cmdutil.changeset_printer.
Yuya Nishihara - March 26, 2017, 1:51 p.m.
On Sat, 25 Mar 2017 14:09:18 +0100, 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 94a70894c394268b845f427f7643738a70e336bb
> # Parent  c4c825f1402861e4b988395ac3deebcc6b5292cf
> # Available At https://bitbucket.org/dlax/hg-work
> #              hg pull https://bitbucket.org/dlax/hg-work -r 94a70894c394
> # 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
> @@ -29,7 +29,7 @@ lfile_copies_switch = '{if(file_copies_s
>  
>  # General templates
>  _trouble_label = 'trouble.{trouble}'
> -_cset_labels = 'log.changeset changeset.{phase}{if(troubles, " changeset.troubled {troubles%_trouble_label}")}'
> +_cset_labels = 'log.changeset changeset.{phase}{if(obsolete, " changeset.obsolete")}{if(troubles, " changeset.troubled {troubles%_trouble_label}")}'
>  cset = '{label("{_cset_labels}",
>                 "changeset:   {rev}:{node|short}")}\n'

Looks good. Optionally you might want to use separate(' ', ...) function
to make this look better.

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
@@ -29,7 +29,7 @@  lfile_copies_switch = '{if(file_copies_s
 
 # General templates
 _trouble_label = 'trouble.{trouble}'
-_cset_labels = 'log.changeset changeset.{phase}{if(troubles, " changeset.troubled {troubles%_trouble_label}")}'
+_cset_labels = 'log.changeset changeset.{phase}{if(obsolete, " changeset.obsolete")}{if(troubles, " changeset.troubled {troubles%_trouble_label}")}'
 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