Show More
@@ -224,6 +224,7 b' def extract(ui, fileobj):' | |||
|
224 | 224 | m = diffre.search(payload) |
|
225 | 225 | if m: |
|
226 | 226 | hgpatch = False |
|
227 | hgpatchheader = False | |
|
227 | 228 | ignoretext = False |
|
228 | 229 | |
|
229 | 230 | ui.debug('found patch at byte %d\n' % m.start(0)) |
@@ -232,12 +233,12 b' def extract(ui, fileobj):' | |||
|
232 | 233 | for line in payload[:m.start(0)].splitlines(): |
|
233 | 234 | if line.startswith('# HG changeset patch'): |
|
234 | 235 | ui.debug('patch generated by hg export\n') |
|
235 | hgpatch = True | |
|
236 | hgpatchheader = True | |
|
236 | 237 | # drop earlier commit message content |
|
237 | 238 | cfp.seek(0) |
|
238 | 239 | cfp.truncate() |
|
239 | 240 | subject = None |
|
240 | elif hgpatch: | |
|
241 | elif hgpatchheader: | |
|
241 | 242 | if line.startswith('# User '): |
|
242 | 243 | user = line[7:] |
|
243 | 244 | ui.debug('From: %s\n' % user) |
@@ -249,9 +250,12 b' def extract(ui, fileobj):' | |||
|
249 | 250 | nodeid = line[10:] |
|
250 | 251 | elif line.startswith("# Parent "): |
|
251 | 252 | parents.append(line[10:]) |
|
253 | elif not line.startswith("# "): | |
|
254 | hgpatchheader = False | |
|
255 | hgpatch = True | |
|
252 | 256 | elif line == '---' and gitsendmail: |
|
253 | 257 | ignoretext = True |
|
254 |
if not |
|
|
258 | if not hgpatchheader and not ignoretext: | |
|
255 | 259 | cfp.write(line) |
|
256 | 260 | cfp.write('\n') |
|
257 | 261 | message = cfp.getvalue() |
@@ -39,3 +39,47 b' check custom patch options are honored' | |||
|
39 | 39 | applying ../a.diff |
|
40 | 40 | Using custom patch |
|
41 | 41 | |
|
42 | ||
|
43 | Issue2417: hg import with # comments in description | |
|
44 | ||
|
45 | Prepare source repo and patch: | |
|
46 | ||
|
47 | $ rm $HGRCPATH | |
|
48 | $ hg init c | |
|
49 | $ cd c | |
|
50 | $ echo 0 > a | |
|
51 | $ hg ci -A -m 0 a -d '0 0' | |
|
52 | $ echo 1 >> a | |
|
53 | $ cat << eof > log | |
|
54 | > 1 | |
|
55 | > # comment for 1 | |
|
56 | > eof | |
|
57 | $ hg ci -l log -d '0 0' | |
|
58 | $ hg export -o p 1 | |
|
59 | $ cd .. | |
|
60 | ||
|
61 | Clone and apply patch: | |
|
62 | ||
|
63 | $ hg clone -r 0 c d | |
|
64 | requesting all changes | |
|
65 | adding changesets | |
|
66 | adding manifests | |
|
67 | adding file changes | |
|
68 | added 1 changesets with 1 changes to 1 files | |
|
69 | updating to branch default | |
|
70 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
|
71 | $ cd d | |
|
72 | $ hg import ../c/p | |
|
73 | applying ../c/p | |
|
74 | $ hg log -v -r 1 | |
|
75 | changeset: 1:89bf2f6d8088 | |
|
76 | tag: tip | |
|
77 | user: test | |
|
78 | date: Thu Jan 01 00:00:00 1970 +0000 | |
|
79 | files: a | |
|
80 | description: | |
|
81 | 1 | |
|
82 | # comment for 1 | |
|
83 | ||
|
84 | ||
|
85 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now