$ touch a $ hg ci -A -m "add a" ajout de a $ hg di -c tip diff --git a/a b/a new file mode 100644 $ hg di -c tip --stat a | Bin 1 files changed, 0 insertions(+), 0 deletions(-)
What do we want the output here to be? Changing it to: a | 0 0 files changed, 0 insertions(+), 0 deletions(-) Doesn't seem right. There was a similar thread on the git mailing list a while back: http://git.661346.n2.nabble.com/quot-git-diff-stat-quot-doesn-t-show-added- empty-file-td2143867.html Also I played with --stat some more and it seems it doesn't play nice with other "non-content file changes" such as renames and mode changes. Continuing on your example: $ hg mv a b $ hg ci -m "rename" $ hg di -g -c tip --stat a | Bin 1 files changed, 0 insertions(+), 0 deletions(-) And there seems to be another minor issue here and that's the files changed count. I'm not sure file creations count as file changes (diffstat(1) agrees on this). I'll open new issues for these.
> What do we want the output here to be? Changing it to: > > a | 0 > 0 files changed, 0 insertions(+), 0 deletions(-) > > Doesn't seem right. It would be fine with me. After all the file *is* empty. The issue I have with the "Bin" marking is that it gives a piece of false information: these files are not binary and are not handled as such by hg.
> It would be fine with me. After all the file *is* empty. With me too, as long as we could get “1 file changed” instead of 0. > Also I played with --stat some more and it seems it doesn't play nice with > other "non-content file changes" such as renames and mode changes. Maybe the command could say “n other changes” or something similar. Is this important enough than I should open a bug?
I have sent a patch about this: http://www.selenic.com/pipermail/mercurial-devel/2011-October/035197.html It does not really address empty files but instead mark as binary only files touched by binary hunks (from git or regular diffs). It means the stat reported will still be weird for renames/copies/mode changes but these require a format extension I guess and should be addressed in another issue.
Fixed by http://selenic.com/repo/hg/rev/628a4a9e411d Patrick Mezard <pmezard@gmail.com> diffstat: be more picky when marking file as 'binary' (issue2816) (please test the fix)
--- Bug imported by bugzilla@serpentine.com 2012-05-12 09:20 EDT --- This bug was previously known as _bug_ 2816 at http://mercurial.selenic.com/bts/issue2816