diff mercurial/patch.py @ 41375:f1b0d9988825

diffstat: make --git work properly on renames (issue6025) `$ hg diff --stat --git` shows only the new filename on renames. I added the old filename also to the output to make it identical with the output of `$ git diff --stat`. Differential Revision: https://phab.mercurial-scm.org/D5628
author Navaneeth Suresh <navaneeths1998@gmail.com>
date Thu, 17 Jan 2019 18:05:54 +0530
parents 876494fd967d
children 4a33a6bf2b52
line wrap: on
line diff
--- a/mercurial/patch.py	Fri Jan 25 09:50:23 2019 -0800
+++ b/mercurial/patch.py	Thu Jan 17 18:05:54 2019 +0530
@@ -2805,6 +2805,10 @@
         elif (line.startswith('GIT binary patch') or
               line.startswith('Binary file')):
             isbinary = True
+        elif line.startswith('rename from'):
+            filename = line.split()[-1]
+        elif line.startswith('rename to'):
+            filename += ' => %s' % line.split()[-1]
     addresult()
     return results