[PATCH 2 of 7] annotate: rename {lines}/{line} to {texts}/{text} respectively (BC)

Anton Shestakov av6 at dwimlabs.net
Mon Oct 1 07:38:36 UTC 2018


On Sun, 30 Sep 2018 22:43:46 +0900
Yuya Nishihara <yuya at tcha.org> wrote:

> # HG changeset patch
> # User Yuya Nishihara <yuya at tcha.org>
> # Date 1538288821 -32400
> #      Sun Sep 30 15:27:01 2018 +0900
> # Node ID 4ee07da344653b4bcfea8214c20e713cfd307d86
> # Parent  66d94b8a5526475ae523e1cca3bfd8c1cf3ec9ca
> annotate: rename {lines}/{line} to {texts}/{text} respectively (BC)
> 
> Perhaps these were the most unloved names. While the data structure is
> different from the {texts} in "hg grep", they are more or less a list of
> text chunks with some metadata attached. Let's call both of them as {texts}
> since I couldn't come up with a better name.
> 
> https://www.mercurial-scm.org/wiki/GenericTemplatingPlan#Dictionary
> 
> diff --git a/mercurial/commands.py b/mercurial/commands.py
> --- a/mercurial/commands.py
> +++ b/mercurial/commands.py
> @@ -390,7 +390,7 @@ def annotate(ui, repo, *pats, **opts):
>                           % ((pats and m.rel(abs)) or abs))
>              continue
>  
> -        fm = rootfm.nested('lines', tmpl='{rev}: {line}')
> +        fm = rootfm.nested('texts', tmpl='{rev}: {text}')

I personally would expect the iterable to be named "lines", e.g.:

    rootfm.nested('lines', tmpl='{rev}: {text}')

It makes sense in my mind because these are not just randomly cut text
chunks, they are individual lines, no more no less. We're iterating the
output of annotate (and grep too) line by line, not text (e.g. a
paragraph or more) by text.


More information about the Mercurial-devel mailing list