hg log: diffstat template ignores exclude pattern

Steve Schmerler elcortogm at gmail.com
Tue Nov 11 00:54:09 UTC 2014


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!

best,
Steve



More information about the Mercurial mailing list