[PATCH V2] templatekw: add a {negrev} keyword
Jordi GutiƩrrez Hermoso
jordigh at octave.org
Mon Feb 18 14:25:42 EST 2019
On Mon, 2019-02-18 at 22:29 +0900, Yuya Nishihara wrote:
> The word "negative revision" isn't correct,
Why do you think so? The full phrase is "negative revision number",
isn't it?
> > --- a/mercurial/templatekw.py
> > +++ b/mercurial/templatekw.py
> > @@ -777,6 +777,14 @@ def showrev(context, mapping):
> > ctx = context.resource(mapping, 'ctx')
> > return scmutil.intrev(ctx)
> >
> > + at templatekeyword('negrev', requires={'repo', 'ctx'})
>
> Moved this so the functions are roughly sorted lexicographically.
Oh, okay. I thought it made sense to have rev and negrev next to each
other, but I didn't noticed that there was already a different order.
> There are two weird cases:
>
> -r 'wdir()' => not negative
> -r null => unsupported negative integer (out of range)
>
> Maybe return None for these?
Oh, these are also broken for the normal {rev} template keyword.
I'll send a separate patch for those two.
More information about the Mercurial-devel
mailing list