[PATCH] patch: a little bit more robust line counting on diff --stat (issue3183)

Jesús Espino jespinog at gmail.com
Sat Jan 21 16:58:31 CST 2012


# HG changeset patch
# User Jesus Espino Garcia <jesus.espino at kaleidos.net>
# Date 1327186258 -3600
# Node ID 8606a301b550a05136bba3cde81c28f856bea68c
# Parent  878bc4a62a735a1624e9b69c672d5fb5074d4855
patch: a little bit more robust line counting on diff --stat (issue3183)

diff -r 878bc4a62a73 -r 8606a301b550 mercurial/patch.py
--- a/mercurial/patch.py	Thu Jan 19 14:31:05 2012 -0600
+++ b/mercurial/patch.py	Sat Jan 21 23:50:58 2012 +0100
@@ -1802,9 +1802,9 @@
             elif line.startswith('diff -r'):
                 # format: "diff -r ... -r ... filename"
                 filename = diffre.search(line).group(1)
-        elif line.startswith('+') and not line.startswith('+++'):
+        elif line.startswith('+') and not line.startswith('+++ '):
             adds += 1
-        elif line.startswith('-') and not line.startswith('---'):
+        elif line.startswith('-') and not line.startswith('--- '):
             removes += 1
         elif (line.startswith('GIT binary patch') or
               line.startswith('Binary file')):


More information about the Mercurial-devel mailing list