Mercurial > public > mercurial-scm > hg
comparison mercurial/patch.py @ 34964: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 |
comparison
equal
deleted
inserted
replaced
34963:ddf37b6b8c3d | 34964:7ebf850d3166 |
---|---|
201 Any item can be missing from the dictionary. If filename is missing, | 201 Any item can be missing from the dictionary. If filename is missing, |
202 fileobj did not contain a patch. Caller must unlink filename when done.''' | 202 fileobj did not contain a patch. Caller must unlink filename when done.''' |
203 | 203 |
204 # attempt to detect the start of a patch | 204 # attempt to detect the start of a patch |
205 # (this heuristic is borrowed from quilt) | 205 # (this heuristic is borrowed from quilt) |
206 diffre = re.compile(br'^(?:Index:[ \t]|diff[ \t]|RCS file: |' | 206 diffre = re.compile(br'^(?:Index:[ \t]|diff[ \t]-|RCS file: |' |
207 br'retrieving revision [0-9]+(\.[0-9]+)*$|' | 207 br'retrieving revision [0-9]+(\.[0-9]+)*$|' |
208 br'---[ \t].*?^\+\+\+[ \t]|' | 208 br'---[ \t].*?^\+\+\+[ \t]|' |
209 br'\*\*\*[ \t].*?^---[ \t])', | 209 br'\*\*\*[ \t].*?^---[ \t])', |
210 re.MULTILINE | re.DOTALL) | 210 re.MULTILINE | re.DOTALL) |
211 | 211 |