diff --git a/mercurial/patch.py b/mercurial/patch.py --- a/mercurial/patch.py +++ b/mercurial/patch.py @@ -2806,9 +2806,9 @@ def diffstatdata(lines): 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 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 @@ When a file is renamed, --git shouldn't $ 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(-)