# HG changeset patch # User Benoit Boissinot # Date 1268932954 -3600 # Node ID 7a5931c5f2dc307cd7c21fb7b84995865b0f2586 # Parent 4a70178f9bdef5a9f9539ab815be017062fa3dac patch: enhance diff detection regexp, allow '--- ' in patch message diff -r 4a70178f9bde -r 7a5931c5f2dc mercurial/patch.py --- a/mercurial/patch.py Thu Mar 18 16:38:07 2010 +0100 +++ b/mercurial/patch.py Thu Mar 18 18:22:34 2010 +0100 @@ -178,7 +178,8 @@ # (this heuristic is borrowed from quilt) diffre = re.compile(r'^(?:Index:[ \t]|diff[ \t]|RCS file: |' r'retrieving revision [0-9]+(\.[0-9]+)*$|' - r'(---|\*\*\*)[ \t])', re.MULTILINE) + r'(---|\*\*\*)[ \t].*?' + r'^(\+\+\+|\*\*\*)[ \t])', re.MULTILINE|re.DOTALL) fd, tmpname = tempfile.mkstemp(prefix='hg-patch-') tmpfp = os.fdopen(fd, 'w') diff -r 4a70178f9bde -r 7a5931c5f2dc tests/test-import --- a/tests/test-import Thu Mar 18 16:38:07 2010 +0100 +++ b/tests/test-import Thu Mar 18 18:22:34 2010 +0100 @@ -375,6 +375,25 @@ hg parents -v cd .. +echo % '--- in commit message' +hg init commitconfusion +cd commitconfusion +cat > a.patch < trickyheaders.patch < diff -r 4a70178f9bde -r 7a5931c5f2dc tests/test-import.out --- a/tests/test-import.out Thu Mar 18 16:38:07 2010 +0100 +++ b/tests/test-import.out Thu Mar 18 18:22:34 2010 +0100 @@ -318,6 +318,17 @@ description +% --- in commit message +applying a.patch +changeset: 0:f34d9187897d +tag: tip +user: test +date: Thu Jan 01 00:00:00 1970 +0000 +files: a +description: +module: summary + + % tricky header splitting applying ../trickyheaders.patch # HG changeset patch