[PATCH 2 of 2] templatekw: add a {negrev} keyword

Yuya Nishihara yuya at tcha.org
Thu Jan 18 07:05:53 EST 2018


On Wed, 17 Jan 2018 22:14:30 -0500, Jordi GutiƩrrez Hermoso wrote:
> # HG changeset patch
> # User Jordi GutiƩrrez Hermoso <jordigh at octave.org>
> # Date 1516243120 18000
> #      Wed Jan 17 21:38:40 2018 -0500
> # Node ID cbf1d676a938e78d40cd3504dd916f787bcb47ee
> # Parent  701f8a9defdc09bb63f2596e2fc426f2e78da313
> templatekw: add a {negrev} keyword
> 
> Revision numbers are getting much maligned for two reasons: they are
> too long in large repos and users get confused by their local-only
> nature. It just occurred to me that negative revision numbers avoid
> both of those problems. Since negative revision numbers change
> whenever the repo changes, it's much more obvious that they are a
> local-only convenience. Additionally, for the recent commits that we
> usually care about the most, negative revision numbers are always near
> zero.
> 
> This commit adds a negrev templatekw to more easily expose negative
> revision numbers. It's not easy to reliably produce this output with
> existing keywords due to hidden commits or without a significant
> slowdown due to computing a complicated template expression.

Isn't it "{rev - revset("tip")|stringify - 1}" ? Well, the stringify
looks strange, but not terrible.


More information about the Mercurial-devel mailing list