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

Kevin Grover kevin at kevingrover.net
Wed Feb 3 17:08:46 CST 2010


On Wed, Feb 3, 2010 at 3:40 AM, Christian Ebert <blacktrash at gmx.net> wrote:

> 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.
>
>
I agree.  However, it must be done for each repository, each time.  It's
much easier for me to convince people to move from CVS/SVN if I can say,
don't worry, you can still use your keywords, just like you used to (at
least until you move away from them).

Granted, the keywords still have to be turned on (and the style set to SVN
for subversion keywords), however, if they're in keyword.py, they will be
consistent across all repositories.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20100203/deccb28a/attachment.htm>


More information about the Mercurial-devel mailing list