mercurial/patch.py
changeset 13395 104c9ed93fc5
parent 13112 039a964dbbb3
child 13699 d3c0e0033f13
--- a/mercurial/patch.py	Thu Feb 10 15:41:34 2011 +0300
+++ b/mercurial/patch.py	Fri Feb 04 16:32:14 2011 -0300
@@ -1529,6 +1529,8 @@
                 yield text
 
 def diffstatdata(lines):
+    diffre = re.compile('^diff .*-r [a-z0-9]+\s(.*)$')
+
     filename, adds, removes = None, 0, 0
     for line in lines:
         if line.startswith('diff'):
@@ -1539,9 +1541,9 @@
             adds, removes = 0, 0
             if line.startswith('diff --git'):
                 filename = gitre.search(line).group(1)
-            else:
+            elif line.startswith('diff -r'):
                 # format: "diff -r ... -r ... filename"
-                filename = line.split(None, 5)[-1]
+                filename = diffre.search(line).group(1)
         elif line.startswith('+') and not line.startswith('+++'):
             adds += 1
         elif line.startswith('-') and not line.startswith('---'):