Bug 4221 - wrong 'hg log --stat' with diff.git=true
Summary: wrong 'hg log --stat' with diff.git=true
Status: RESOLVED FIXED
Alias: None
Product: Mercurial
Classification: Unclassified
Component: Mercurial (show other bugs)
Version: 2.9.1
Hardware: PC Linux
: normal bug
Assignee: Bugzilla
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-04-09 23:18 UTC by Michael O'Connor
Modified: 2014-07-19 14:17 UTC (History)
3 users (show)

See Also:
Python Version: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael O'Connor 2014-04-09 23:18 UTC
If you copy a file and modify the copy, 'hg log --stat' will incorrectly report that the original was modified instead of the copy.

A reproduction:

    $ hg init test
    $ cd test
    $ echo "a\nb\nc" > a
    $ hg add a
    $ hg commit -m a
    $ hg cp a b
    $ echo d >> b
    $ hg commit -m b
    $ hg --config diff.git=true log -r . --stat 
    changeset:   1:4f4a6de064c5
    tag:         tip
    user:        Michael O'Connor <moconnor@janestreet.com>
    date:        Wed Apr 09 23:08:08 2014 -0400
    summary:     b
    
     a |  1 +
     1 files changed, 1 insertions(+), 0 deletions(-)

Note that (at least my version of) diffstat gets this case right:

    $ hg --config diff.git=true log -r . -p | diffstat
     b |    1 +
     1 file changed, 1 insertion(+)
    $ diffstat --version
    diffstat version 1.51

Also, with a move instead of a copy+modification, what --stat reports seems at least strange to me:

    $ hg update 0
    0 files updated, 0 files merged, 1 files removed, 0 files unresolved
    $ hg mv a b
    $ hg commit -m 'mv a b'
    created new head
    $ hg --config diff.git=true log -r . --stat
    changeset:   2:15831134b1bb
    tag:         tip
    parent:      0:e096287bb74a
    user:        Michael O'Connor <moconnor@janestreet.com>
    date:        Wed Apr 09 23:15:32 2014 -0400
    summary:     mv a b
    
     a |  0 
     1 files changed, 0 insertions(+), 0 deletions(-)

Thanks!
Comment 1 Matt Mackall 2014-04-10 13:09 UTC
Is this intentionally marked as a largefiles issue? Does it only occur with largefiles enabled?
Comment 2 Michael O'Connor 2014-04-10 16:57 UTC
Sorry, I misclicked.  It has nothing to do with largefiles.
Comment 3 HG Bot 2014-04-11 17:00 UTC
Fixed by http://selenic.com/repo/hg/rev/4e2fb0ad00a9
Matt Mackall <mpm@selenic.com>
diff: use second filename for --stat reporting on git patches (issue4221)

(please test the fix)
Comment 4 Michael O'Connor 2014-04-15 09:29 UTC
Thanks, works for me