diff mercurial/patch.py @ 35020:7ebf850d3166

patch: improve heuristics to not take the word "diff" as header (issue1879) The word "diff" is likely to appear in a commit message. Let's make it less likely by requiring "diff -" for "diff -r" or "diff --git".
author Yuya Nishihara <yuya@tcha.org>
date Sat, 21 Oct 2017 16:50:57 +0900
parents 907ff34e1460
children 3649c3f2cd90
line wrap: on
line diff
--- a/mercurial/patch.py	Sat Oct 21 17:01:20 2017 +0900
+++ b/mercurial/patch.py	Sat Oct 21 16:50:57 2017 +0900
@@ -203,7 +203,7 @@
 
     # attempt to detect the start of a patch
     # (this heuristic is borrowed from quilt)
-    diffre = re.compile(br'^(?:Index:[ \t]|diff[ \t]|RCS file: |'
+    diffre = re.compile(br'^(?:Index:[ \t]|diff[ \t]-|RCS file: |'
                         br'retrieving revision [0-9]+(\.[0-9]+)*$|'
                         br'---[ \t].*?^\+\+\+[ \t]|'
                         br'\*\*\*[ \t].*?^---[ \t])',