[PATCH 2 of 2] keyword: add: SVN-like keywords and config section to select their use

Christian Ebert blacktrash at gmx.net
Wed Feb 3 03:40:20 CST 2010


Hi Kevin,

* Kevin Grover on Saturday, January 30, 2010 at 14:54:31 -0600
> # HG changeset patch
> # User Kevin O. Grover <kevin at kevingrover.net>
> # Date 1264179387 28800
> # Node ID df6722234c097d278934c9665946864313662a51
> # Parent  02ffdeb799f73cc3c1a04627586cf3039dc5b058
> Added svn keywords and filters.
> 
> diff -r 02ffdeb799f7 -r df6722234c09 hgext/keyword.py
> --- a/hgext/keyword.py    Fri Jan 22 08:50:36 2010 -0800
> +++ b/hgext/keyword.py    Fri Jan 22 08:56:27 2010 -0800
> @@ -52,8 +52,13 @@
> control run "hg kwdemo". See "hg help templates" for a list of
> available templates and filters.
> 
> -An additional date template filter {date|utcdate} is provided. It
> -returns a date like "2006/09/18 15:13:13".
> +Additional date template filters are provided:
> +
> +Filter                 For  Sample of Return
> +---------------------  ---  --------------------------------------------
> +{date|utcdate}         CVS  "2006/09/18 15:13:13"
> +{date|utcisodate}      SVN  "2006-09-18 15:13:13Z"
> +{date|utcisodatelong}  SVN  "2006-09-18 15:13:13 PST (Mon, 18 Sep 2006)"

The formatting of the table should be compared with other help
tables.
 
> The default template mappings (view with "hg kwdemo -d") can be
> replaced with customized keywords and templates. Again, run "hg
> @@ -99,6 +104,10 @@
> # provide cvs-like UTC date filter
> utcdate = lambda x: util.datestr(x, '%Y/%m/%d %H:%M:%S')
> 
> +# provide svn-like dates
> +utcisodate = lambda d: util.datestr(d, '%Y-%m-%d %H:%M:%SZ')
> +utcisodatelong = lambda d: util.datestr(d, '%Y-%m-%d %H:%M:%S %Z (%a, %d %b > %Y)')

Probably will have to be:

utcisodate = lambda x: util.datestr((x[0], 0), '%Y-%m-%d %H:%M:%SZ')
utcisodatelong = lambda x: util.datestr((x[0], 0),
                                        '%Y-%m-%d %H:%M:%S %Z (%a, %d %b > %Y)')

after clearing up the utc bug/problem.

(I'm using "x" to mimic templatefilters.py)

I'm fine with the filters, but I must admit that personally I'm
not keen on adding more config sections and more -- albeit
optional -- templates, as I wasn't a friend of default templates
in the first place.

The same can be done in a (global) hgrc file already.

c

P.S. To check the coding style, you can now run Matt's recently
added check-code.py (in contrib), it detects overlong lines etc.
-- 
\black\trash movie    _C O W B O Y_  _C A N O E_  _C O M A_
                     Ein deutscher Western/A German Western

         --->> http://www.blacktrash.org/underdogma/ccc.php


More information about the Mercurial-devel mailing list