D5709: diffstat: support filenames with whitespaces on renames
navaneeth.suresh (Navaneeth Suresh)
phabricator at mercurial-scm.org
Sat Jan 26 04:31:19 EST 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG4a33a6bf2b52: diffstat: support filenames with whitespaces on renames (authored by navaneeth.suresh, committed by ).
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D5709?vs=13494&id=13499
REVISION DETAIL
https://phab.mercurial-scm.org/D5709
AFFECTED FILES
mercurial/patch.py
tests/test-diffstat.t
CHANGE DETAILS
diff --git a/tests/test-diffstat.t b/tests/test-diffstat.t
--- a/tests/test-diffstat.t
+++ b/tests/test-diffstat.t
@@ -255,3 +255,19 @@
$ hg diff --stat --git
a => b | 0
1 files changed, 0 insertions(+), 0 deletions(-)
+-- filename may contain whitespaces
+ $ echo > c
+ $ hg ci -Am 'add c'
+ adding c
+ $ hg mv c 'new c'
+ $ hg diff --git
+ diff --git a/c b/new c
+ rename from c
+ rename to new c
+ $ hg diff --stat
+ c | 1 -
+ new c | 1 +
+ 2 files changed, 1 insertions(+), 1 deletions(-)
+ $ hg diff --stat --git
+ c => new c | 0
+ 1 files changed, 0 insertions(+), 0 deletions(-)
diff --git a/mercurial/patch.py b/mercurial/patch.py
--- a/mercurial/patch.py
+++ b/mercurial/patch.py
@@ -2806,9 +2806,9 @@
line.startswith('Binary file')):
isbinary = True
elif line.startswith('rename from'):
- filename = line.split()[-1]
+ filename = line[12:]
elif line.startswith('rename to'):
- filename += ' => %s' % line.split()[-1]
+ filename += ' => %s' % line[10:]
addresult()
return results
To: navaneeth.suresh, #hg-reviewers
Cc: yuja, mercurial-devel
More information about the Mercurial-devel
mailing list