##// END OF EJS Templates
patch: enhance diff detection regexp, allow '--- ' in patch message
Benoit Boissinot -
r10729:7a5931c5 stable
parent child Browse files
Show More
@@ -178,7 +178,8 b' def extract(ui, fileobj):'
178 # (this heuristic is borrowed from quilt)
178 # (this heuristic is borrowed from quilt)
179 diffre = re.compile(r'^(?:Index:[ \t]|diff[ \t]|RCS file: |'
179 diffre = re.compile(r'^(?:Index:[ \t]|diff[ \t]|RCS file: |'
180 r'retrieving revision [0-9]+(\.[0-9]+)*$|'
180 r'retrieving revision [0-9]+(\.[0-9]+)*$|'
181 r'(---|\*\*\*)[ \t])', re.MULTILINE)
181 r'(---|\*\*\*)[ \t].*?'
182 r'^(\+\+\+|\*\*\*)[ \t])', re.MULTILINE|re.DOTALL)
182
183
183 fd, tmpname = tempfile.mkstemp(prefix='hg-patch-')
184 fd, tmpname = tempfile.mkstemp(prefix='hg-patch-')
184 tmpfp = os.fdopen(fd, 'w')
185 tmpfp = os.fdopen(fd, 'w')
@@ -375,6 +375,25 b" hg import -d '0 0' a.patch"
375 hg parents -v
375 hg parents -v
376 cd ..
376 cd ..
377
377
378 echo % '--- in commit message'
379 hg init commitconfusion
380 cd commitconfusion
381 cat > a.patch <<EOF
382 module: summary
383
384 --- description
385
386 diff --git a/a b/a
387 new file mode 100644
388 --- /dev/null
389 +++ b/a
390 @@ -0,0 +1,1 @@
391 +a
392 EOF
393 hg import -d '0 0' a.patch
394 hg parents -v
395 cd ..
396
378 echo '% tricky header splitting'
397 echo '% tricky header splitting'
379 cat > trickyheaders.patch <<EOF
398 cat > trickyheaders.patch <<EOF
380 From: User A <user@a>
399 From: User A <user@a>
@@ -318,6 +318,17 b' module: summary'
318 description
318 description
319
319
320
320
321 % --- in commit message
322 applying a.patch
323 changeset: 0:f34d9187897d
324 tag: tip
325 user: test
326 date: Thu Jan 01 00:00:00 1970 +0000
327 files: a
328 description:
329 module: summary
330
331
321 % tricky header splitting
332 % tricky header splitting
322 applying ../trickyheaders.patch
333 applying ../trickyheaders.patch
323 # HG changeset patch
334 # HG changeset patch
General Comments 0
You need to be logged in to leave comments. Login now