pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  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 
https://phab.mercurial-scm.org/rHG8f8bb77d560e70bcc95577e4dfa877df18d876ab 
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.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D6007

AFFECTED FILES
  mercurial/patch.py
  tests/test-commit.t
  tests/test-diff-hashes.t
  tests/test-diffstat.t
  tests/test-mq.t
  tests/test-transplant.t

CHANGE DETAILS

diff --git a/tests/test-transplant.t b/tests/test-transplant.t
--- a/tests/test-transplant.t
+++ b/tests/test-transplant.t
@@ -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 @@
diff --git a/tests/test-mq.t b/tests/test-mq.t
--- a/tests/test-mq.t
+++ b/tests/test-mq.t
@@ -305,6 +305,7 @@
 working dir diff:
 
   $ hg diff --nodates -q
+  diff -r dde259bd5934 a
   --- a/a
   +++ b/a
   @@ -1,1 +1,2 @@
diff --git a/tests/test-diffstat.t b/tests/test-diffstat.t
--- a/tests/test-diffstat.t
+++ b/tests/test-diffstat.t
@@ -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 --git a/tests/test-diff-hashes.t b/tests/test-diff-hashes.t
--- a/tests/test-diff-hashes.t
+++ b/tests/test-diff-hashes.t
@@ -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 --git a/tests/test-commit.t b/tests/test-commit.t
--- a/tests/test-commit.t
+++ b/tests/test-commit.t
@@ -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 --git a/mercurial/patch.py b/mercurial/patch.py
--- a/mercurial/patch.py
+++ b/mercurial/patch.py
@@ -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()



To: pulkit, #hg-reviewers
Cc: mercurial-devel
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to