# HG changeset patch # User Brendan Cully # Date 1268948184 25200 # Node ID 71cf11f03b3d671893dd859fd62e3811a1866726 # Parent 62b8f15683f24532516e8e4d175b5975099f3aac# Parent 4d6bd7b8b6d88d979ac53ab07e4004ee7eb741ab Merge with stable diff -r 62b8f15683f2 -r 71cf11f03b3d hgext/mq.py --- a/hgext/mq.py Thu Mar 18 16:32:03 2010 +0100 +++ b/hgext/mq.py Thu Mar 18 14:36:24 2010 -0700 @@ -88,13 +88,11 @@ for line in file(pf): line = line.rstrip() - if line.startswith('diff --git'): + if (line.startswith('diff --git') + or (diffstart and line.startswith('+++ '))): diffstart = 2 break - if diffstart: - if line.startswith('+++ '): - diffstart = 2 - break + diffstart = 0 # reset if line.startswith("--- "): diffstart = 1 continue diff -r 62b8f15683f2 -r 71cf11f03b3d mercurial/hg.py --- a/mercurial/hg.py Thu Mar 18 16:32:03 2010 +0100 +++ b/mercurial/hg.py Thu Mar 18 14:36:24 2010 -0700 @@ -209,6 +209,7 @@ src_repo = repository(ui, source) else: src_repo = source + branch = None origsource = source = src_repo.url() rev, checkout = addbranchrevs(src_repo, src_repo, branch, rev) diff -r 62b8f15683f2 -r 71cf11f03b3d mercurial/patch.py --- a/mercurial/patch.py Thu Mar 18 16:32:03 2010 +0100 +++ b/mercurial/patch.py Thu Mar 18 14:36:24 2010 -0700 @@ -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 62b8f15683f2 -r 71cf11f03b3d tests/test-import --- a/tests/test-import Thu Mar 18 16:32:03 2010 +0100 +++ b/tests/test-import Thu Mar 18 14:36:24 2010 -0700 @@ -375,6 +375,25 @@ hg parents -v cd .. +echo % '--- in commit message' +hg init commitconfusion +cd commitconfusion +cat > a.patch < trickyheaders.patch < diff -r 62b8f15683f2 -r 71cf11f03b3d tests/test-import.out --- a/tests/test-import.out Thu Mar 18 16:32:03 2010 +0100 +++ b/tests/test-import.out Thu Mar 18 14:36:24 2010 -0700 @@ -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 diff -r 62b8f15683f2 -r 71cf11f03b3d tests/test-mq-qimport --- a/tests/test-mq-qimport Thu Mar 18 16:32:03 2010 +0100 +++ b/tests/test-mq-qimport Thu Mar 18 14:36:24 2010 -0700 @@ -43,6 +43,7 @@ First line of commit message. More text in commit message. +--- confuse the diff detection diff --git a/x b/x new file mode 100644