hg log: diffstat template ignores exclude pattern

Pierre-Yves David pierre-yves.david at ens-lyon.org
Tue Nov 11 11:46:55 UTC 2014



On 11/11/2014 12:54 AM, Steve Schmerler wrote:
> Hello
>
> This is my fist post here, so I'd like to thank all folks involved in
> the project for this great piece of software.
>
> I have a question regarding the template machinery. I'm struggling with
>
>      hg log --template "{diffstat}" -X '**.foo'
>
> which seems to bypass the -X/--exclude pattern if there are also files
> in the changeset which do _not_ match the pattern (same with
> -I/--include). For instance:
>
>      hg init
>
>      echo a > a.xyz
>      hg add
>      hg ci -m "initial commit"
>
>      seq 1 1000 > b.foo
>      hg add
>      hg ci -m "foo file only"
>
>      seq 1 1000 > c.foo
>      echo d > d.xyz
>      hg add
>      hg ci -m "foo file and others"
>
>      # rev 1 is gone (ok), rev 2 is there (ok) but counts all lines (wrong?)
>      hg log --template "{rev}\n{desc}\n{diffstat}\n{files}\n\n" -X '**.foo'
>      2
>      foo file and others
>      2: +1001/-0
>      c.foo d.xyz
>
>      0
>      initial commit
>      1: +1/-0
>      a.xyz
>
> With "hg log ... --stat", the excluded files are not shown, but the
> diffstat still includes the line count from all files.
>
> I'm trying to get some statistics of added/removed lines, but separated
> by file types (patterns).
>
> There is surely an easy way to solve this, but I'm kind of stuck with this
> one. This is with hg 3.1.2 (on Debian). Thank you for any hints!

Very good bug report here (yes looks like a bug) can I get your do make 
the final step and fill it on http://bz.selenic.com/ ?

In the meantime, you can probably work around this using 'hg diff 
--change REV PATTERN | diffstats.

Cheers,

-- 
Pierre-Yves David



More information about the Mercurial mailing list