# HG changeset patch # User Matt Mackall # Date 1129413862 25200 # Node ID ce95599eedac0b513eb07ccd55160fccb3ce1a80 # Parent 9b3ef6f3cef5c19c0ddf894ec63ad2dbc51a0d63 Borrow patch header detection heuristic from quilt diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -1139,7 +1139,12 @@ def import_(ui, repo, patch1, *patches, strip = opts["strip"] mailre = re.compile(r'(?:From |[\w-]+:)') - diffre = re.compile(r'(?:diff -|--- .*\s+\w+ \w+ +\d+ \d+:\d+:\d+ \d+)') + + # attempt to detect the start of a patch + # (this heuristic is borrowed from quilt) + diffre = re.compile(r'(?:Index:[ \t]|diff[ \t]|RCS file: |' + + 'retrieving revision [0-9]+(\.[0-9]+)*$|' + + '(---|\*\*\*)[ \t])') for patch in patches: ui.status("applying %s\n" % patch)