# HG changeset patch # User Pulkit Goyal # Date 1550787730 -19800 # Node ID 251332dbf33da51b8fb5b1c775ab45a2e8e593b7 # Parent 7b04b1154c156aa450ca8fe318fc8ab935950eae diff: make sure we output stat even when --git is not passed (issue4037) (BC) Before this patch, `hg diff --stat` will give an empty output. It will not show the stat information. I debugged and found that the underlying code does not return the diff header and due to that, other code paths fails to parse that as a diff. I looked into why we don't return diff headers in quiet mode and found the behavior is from 8f8bb77d560e70bcc95577e4dfa877df18d876ab which does not have any mention about why it is done. We also show the diff headers in git, so I think it's fine showing diff header in normal diff in quiet mode. Differential Revision: https://phab.mercurial-scm.org/D6007 diff -r 7b04b1154c15 -r 251332dbf33d mercurial/patch.py --- a/mercurial/patch.py Sat Feb 23 04:50:46 2019 +0530 +++ b/mercurial/patch.py Fri Feb 22 03:52:10 2019 +0530 @@ -2682,7 +2682,7 @@ header.append('similarity index %d%%' % sim) header.append('%s from %s' % (copyop, path1)) header.append('%s to %s' % (copyop, path2)) - elif revs and not repo.ui.quiet: + elif revs: header.append(diffline(path1, revs)) # fctx.is | diffopts | what to | is fctx.data() diff -r 7b04b1154c15 -r 251332dbf33d tests/test-commit.t --- a/tests/test-commit.t Sat Feb 23 04:50:46 2019 +0530 +++ b/tests/test-commit.t Fri Feb 22 03:52:10 2019 +0530 @@ -512,6 +512,7 @@ HG: dels= HG: files=changed HG: + HG: diff -r d2313f97106f changed HG: --- a/changed Thu Jan 01 00:00:00 1970 +0000 HG: +++ b/changed Thu Jan 01 00:00:00 1970 +0000 HG: @@ -1,1 +1,2 @@ @@ -573,6 +574,7 @@ HG: dels=removed HG: files=added removed HG: + HG: diff -r d2313f97106f added HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 HG: +++ b/added Thu Jan 01 00:00:00 1970 +0000 HG: @@ -0,0 +1,1 @@ @@ -583,6 +585,7 @@ HG: dels=removed HG: files=added removed HG: + HG: diff -r d2313f97106f removed HG: --- a/removed Thu Jan 01 00:00:00 1970 +0000 HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 HG: @@ -1,1 +0,0 @@ diff -r 7b04b1154c15 -r 251332dbf33d tests/test-diff-hashes.t --- a/tests/test-diff-hashes.t Sat Feb 23 04:50:46 2019 +0530 +++ b/tests/test-diff-hashes.t Fri Feb 22 03:52:10 2019 +0530 @@ -13,6 +13,7 @@ $ hg ci -m 'change foo' $ hg --quiet diff -r 0 -r 1 + diff -r a99fb63adac3 -r 9b8568d3af2f foo --- a/foo Thu Jan 01 00:00:00 1970 +0000 +++ b/foo Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +1,1 @@ diff -r 7b04b1154c15 -r 251332dbf33d tests/test-diffstat.t --- a/tests/test-diffstat.t Sat Feb 23 04:50:46 2019 +0530 +++ b/tests/test-diffstat.t Fri Feb 22 03:52:10 2019 +0530 @@ -289,3 +289,6 @@ A new c R c $ hg diff --stat -q + c | 1 - + new c | 1 + + 2 files changed, 1 insertions(+), 1 deletions(-) diff -r 7b04b1154c15 -r 251332dbf33d tests/test-mq.t --- a/tests/test-mq.t Sat Feb 23 04:50:46 2019 +0530 +++ b/tests/test-mq.t Fri Feb 22 03:52:10 2019 +0530 @@ -305,6 +305,7 @@ working dir diff: $ hg diff --nodates -q + diff -r dde259bd5934 a --- a/a +++ b/a @@ -1,1 +1,2 @@ diff -r 7b04b1154c15 -r 251332dbf33d tests/test-transplant.t --- a/tests/test-transplant.t Sat Feb 23 04:50:46 2019 +0530 +++ b/tests/test-transplant.t Fri Feb 22 03:52:10 2019 +0530 @@ -599,6 +599,7 @@ > EOF 0:17ab29e464c6 apply changeset? [ynmpcq?]: p + diff -r 000000000000 -r 17ab29e464c6 r1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/r1 Thu Jan 01 00:00:00 1970 +0000 @@ -0,0 +1,1 @@