##// END OF EJS Templates
import: if in doubt, consume stream until start of diff...
Brendan Cully -
r10501:a27af722 stable
parent child Browse files
Show More
@@ -157,8 +157,8 b' def split(stream):'
157 if line.split(':', 1)[0].lower() in mimeheaders:
157 if line.split(':', 1)[0].lower() in mimeheaders:
158 # let email parser handle this
158 # let email parser handle this
159 return mimesplit(stream, cur)
159 return mimesplit(stream, cur)
160 elif inheader:
160 elif line.startswith('--- ') and inheader:
161 # No evil headers seen, split by hand
161 # No evil headers seen by diff start, split by hand
162 return headersplit(stream, cur)
162 return headersplit(stream, cur)
163 # Not enough info, keep reading
163 # Not enough info, keep reading
164
164
@@ -372,3 +372,30 b" hg import -d '0 0' a.patch"
372 hg parents -v
372 hg parents -v
373 cd ..
373 cd ..
374
374
375 echo '% tricky header splitting'
376 cat > trickyheaders.patch <<EOF
377 From: User A <user@a>
378 Subject: [PATCH] from: tricky!
379
380 # HG changeset patch
381 # User User B
382 # Date 1266264441 18000
383 # Branch stable
384 # Node ID f2be6a1170ac83bf31cb4ae0bad00d7678115bc0
385 # Parent 0000000000000000000000000000000000000000
386 from: tricky!
387
388 That is not a header.
389
390 diff -r 000000000000 -r f2be6a1170ac foo
391 --- /dev/null
392 +++ b/foo
393 @@ -0,0 +1,1 @@
394 +foo
395 EOF
396
397 hg init trickyheaders
398 cd trickyheaders
399 hg import -d '0 0' ../trickyheaders.patch
400 hg export --git tip
401 cd ..
@@ -314,3 +314,20 b' module: summary'
314 description
314 description
315
315
316
316
317 % tricky header splitting
318 applying ../trickyheaders.patch
319 # HG changeset patch
320 # User User B
321 # Date 0 0
322 # Node ID eb56ab91903632294ac504838508cb370c0901d2
323 # Parent 0000000000000000000000000000000000000000
324 from: tricky!
325
326 That is not a header.
327
328 diff --git a/foo b/foo
329 new file mode 100644
330 --- /dev/null
331 +++ b/foo
332 @@ -0,0 +1,1 @@
333 +foo
General Comments 0
You need to be logged in to leave comments. Login now