[Bug 5479] New: `hg diff --stat` gets confused by lines that start with "-- " or "++ "

mercurial-bugs at mercurial-scm.org mercurial-bugs at mercurial-scm.org
Mon Feb 6 02:06:48 UTC 2017


https://bz.mercurial-scm.org/show_bug.cgi?id=5479

            Bug ID: 5479
           Summary: `hg diff --stat` gets confused by lines that start
                    with "-- " or "++ "
           Product: Mercurial
           Version: unspecified
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: bug
          Priority: wish
         Component: Mercurial
          Assignee: bugzilla at mercurial-scm.org
          Reporter: hg at pewpew.net
                CC: mercurial-devel at selenic.com

Created attachment 1947
  --> https://bz.mercurial-scm.org/attachment.cgi?id=1947&action=edit
test that shows the issue (as patch from test-diffstat.t)

Note: possible duplicate of 1123?  That claims that diffstat was an external
tool, though, so while the issue might be similar, I don't think it's a strict
duplicate.

If a line in a file starts with "-- " and is changed, `hg diff --stat` doesn't
count it as a deletion.  Similarly, if the new version of the line starts with
"++ ", it is not counted as an addition.  This can lead to diffstat claiming 0
diffs even if there are some:

  $ hg diff --root .
  diff -r 32e517bb8958 file
  --- a/file    Thu Jan 01 00:00:00 1970 +0000
  +++ b/file    * (glob)
  @@ -1,3 +1,3 @@
   line 1
  --- line 2, with dashes
  +++ line 2, switched dashes to plusses
   line 3
This is wrong: does not count either, because both lines look like file
headers.
  $ hg diff --root . --stat
   file |  0
   1 files changed, 0 insertions(+), 0 deletions(-)

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Mercurial-devel mailing list