[PATCH] lets be able to show diffstat along with diff

Alecs King alecsk at gmail.com
Thu Aug 12 03:32:49 CDT 2010


On Thu, Aug 12, 2010 at 12:41:23AM -0500, Matt Mackall wrote:
> Can anyone give a rationale why
> hg log -r tip -p --stat == hg log -r tip -p?

you meant,

 hg log -r tip -p --stat == hg log -r tip -stat

thats the current behavior.

thats because diffordiffstat(stat) does something like this:

    if stat:
        print stat
    else:
        print diff

So the 'stat' option always suppresses 'show patch' option.

> If not, I think I'd consider the current behavior a bug.

It indeed is.  The patch above fixes this.  The patch mainly changes
diffordiffstat(stat) to something like stat_and_or_diff(stat, diff).
Alternatively, we can keep diffordiffstat() untouched, but instead
change the caller path to something like this:

    if stat:
       call diffordiffstat(stat = True)
    if diff:
       call diffordiffstat(stat = False)

We can wrap out some helper to do this anyway.  But i personally prefer
the first way.  What say you?

And Yuya?

> Not sure what to make of hg diff --stat though.

Since hg diff is meant to show diff (duh), adding a default show-diff
option (-u) makes sense.  In a way, it's quite like what hg blame does
for default option (-n).

Regards,

-- 
Alecs King


More information about the Mercurial-devel mailing list