Show More
@@ -11,6 +11,12 b'' | |||||
11 | $ hg --cwd a ci -u someone -d '1 0' -m'second change' |
|
11 | $ hg --cwd a ci -u someone -d '1 0' -m'second change' | |
12 |
|
12 | |||
13 |
|
13 | |||
|
14 | generate patches for the test | |||
|
15 | ||||
|
16 | $ hg --cwd a export tip > exported-tip.patch | |||
|
17 | $ hg --cwd a diff -r0:1 > diffed-tip.patch | |||
|
18 | ||||
|
19 | ||||
14 | import exported patch |
|
20 | import exported patch | |
15 |
|
21 | |||
16 | $ hg clone -r0 a b |
|
22 | $ hg clone -r0 a b | |
@@ -20,19 +26,18 b' import exported patch' | |||||
20 | added 1 changesets with 2 changes to 2 files |
|
26 | added 1 changesets with 2 changes to 2 files | |
21 | updating to branch default |
|
27 | updating to branch default | |
22 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
28 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
23 |
$ hg --cwd |
|
29 | $ hg --cwd b import ../exported-tip.patch | |
24 | $ hg --cwd b import ../tip.patch |
|
30 | applying ../exported-tip.patch | |
25 | applying ../tip.patch |
|
|||
26 |
|
31 | |||
27 | message should be same |
|
32 | message and committer should be same | |
28 |
|
33 | |||
29 |
$ hg --cwd b tip |
|
34 | $ hg --cwd b tip | |
|
35 | changeset: 1:1d4bd90af0e4 | |||
|
36 | tag: tip | |||
|
37 | user: someone | |||
|
38 | date: Thu Jan 01 00:00:01 1970 +0000 | |||
30 | summary: second change |
|
39 | summary: second change | |
31 |
|
40 | |||
32 | committer should be same |
|
|||
33 |
|
||||
34 | $ hg --cwd b tip | grep someone |
|
|||
35 | user: someone |
|
|||
36 | $ rm -r b |
|
41 | $ rm -r b | |
37 |
|
42 | |||
38 |
|
43 | |||
@@ -50,9 +55,8 b' import exported patch with external patc' | |||||
50 | added 1 changesets with 2 changes to 2 files |
|
55 | added 1 changesets with 2 changes to 2 files | |
51 | updating to branch default |
|
56 | updating to branch default | |
52 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
57 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
53 | $ hg --cwd a export tip > tip.patch |
|
58 | $ hg --config ui.patch='python ../dummypatch.py' --cwd b import ../exported-tip.patch | |
54 | $ hg --config ui.patch='python ../dummypatch.py' --cwd b import ../tip.patch |
|
59 | applying ../exported-tip.patch | |
55 | applying ../tip.patch |
|
|||
56 | $ cat b/a |
|
60 | $ cat b/a | |
57 | line2 |
|
61 | line2 | |
58 | $ rm -r b |
|
62 | $ rm -r b | |
@@ -67,9 +71,8 b' import of plain diff should fail without' | |||||
67 | added 1 changesets with 2 changes to 2 files |
|
71 | added 1 changesets with 2 changes to 2 files | |
68 | updating to branch default |
|
72 | updating to branch default | |
69 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
73 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
70 |
$ hg --cwd |
|
74 | $ hg --cwd b import ../diffed-tip.patch | |
71 | $ hg --cwd b import ../tip.patch |
|
75 | applying ../diffed-tip.patch | |
72 | applying ../tip.patch |
|
|||
73 | abort: empty commit message |
|
76 | abort: empty commit message | |
74 | [255] |
|
77 | [255] | |
75 | $ rm -r b |
|
78 | $ rm -r b | |
@@ -84,9 +87,8 b' import of plain diff should be ok with m' | |||||
84 | added 1 changesets with 2 changes to 2 files |
|
87 | added 1 changesets with 2 changes to 2 files | |
85 | updating to branch default |
|
88 | updating to branch default | |
86 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
89 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
87 |
$ hg --cwd |
|
90 | $ hg --cwd b import -mpatch ../diffed-tip.patch | |
88 | $ hg --cwd b import -mpatch ../tip.patch |
|
91 | applying ../diffed-tip.patch | |
89 | applying ../tip.patch |
|
|||
90 | $ rm -r b |
|
92 | $ rm -r b | |
91 |
|
93 | |||
92 |
|
94 | |||
@@ -99,9 +101,8 b' import of plain diff with specific date ' | |||||
99 | added 1 changesets with 2 changes to 2 files |
|
101 | added 1 changesets with 2 changes to 2 files | |
100 | updating to branch default |
|
102 | updating to branch default | |
101 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
103 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
102 | $ hg --cwd a diff -r0:1 > tip.patch |
|
104 | $ hg --cwd b import -mpatch -d '1 0' -u 'user@nowhere.net' ../diffed-tip.patch | |
103 | $ hg --cwd b import -mpatch -d '1 0' -u 'user@nowhere.net' ../tip.patch |
|
105 | applying ../diffed-tip.patch | |
104 | applying ../tip.patch |
|
|||
105 | $ hg -R b tip -pv |
|
106 | $ hg -R b tip -pv | |
106 | changeset: 1:ca68f19f3a40 |
|
107 | changeset: 1:ca68f19f3a40 | |
107 | tag: tip |
|
108 | tag: tip | |
@@ -131,9 +132,8 b' import of plain diff should be ok with -' | |||||
131 | added 1 changesets with 2 changes to 2 files |
|
132 | added 1 changesets with 2 changes to 2 files | |
132 | updating to branch default |
|
133 | updating to branch default | |
133 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
134 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
134 |
$ hg --cwd |
|
135 | $ hg --cwd b import --no-commit ../diffed-tip.patch | |
135 | $ hg --cwd b import --no-commit ../tip.patch |
|
136 | applying ../diffed-tip.patch | |
136 | applying ../tip.patch |
|
|||
137 | $ hg --cwd b diff --nodates |
|
137 | $ hg --cwd b diff --nodates | |
138 | diff -r 80971e65b431 a |
|
138 | diff -r 80971e65b431 a | |
139 | --- a/a |
|
139 | --- a/a | |
@@ -153,8 +153,7 b' import of malformed plain diff should fa' | |||||
153 | added 1 changesets with 2 changes to 2 files |
|
153 | added 1 changesets with 2 changes to 2 files | |
154 | updating to branch default |
|
154 | updating to branch default | |
155 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
155 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
156 | $ hg --cwd a diff -r0:1 > tip.patch |
|
156 | $ sed 's/1,1/foo/' < diffed-tip.patch > broken.patch | |
157 | $ sed 's/1,1/foo/' < tip.patch > broken.patch |
|
|||
158 |
$ |
|
157 | $ hg --cwd b import -mpatch ../broken.patch | |
159 | applying ../broken.patch |
|
158 | applying ../broken.patch | |
160 | abort: bad hunk #1 |
|
159 | abort: bad hunk #1 | |
@@ -174,10 +173,9 b' used to hide a bug.' | |||||
174 | added 1 changesets with 2 changes to 2 files |
|
173 | added 1 changesets with 2 changes to 2 files | |
175 | updating to branch default |
|
174 | updating to branch default | |
176 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
175 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
177 | $ hg --cwd a export tip > dir/tip.patch |
|
|||
178 | $ cd dir |
|
176 | $ cd dir | |
179 | $ hg -R b import tip.patch |
|
177 | $ hg -R b import ../exported-tip.patch | |
180 | applying tip.patch |
|
178 | applying ../exported-tip.patch | |
181 | $ cd .. |
|
179 | $ cd .. | |
182 | $ rm -r dir |
|
180 | $ rm -r dir | |
183 |
|
181 | |||
@@ -191,7 +189,7 b' import from stdin' | |||||
191 | added 1 changesets with 2 changes to 2 files |
|
189 | added 1 changesets with 2 changes to 2 files | |
192 | updating to branch default |
|
190 | updating to branch default | |
193 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
191 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
194 | $ hg --cwd a export tip | hg --cwd b import - |
|
192 | $ hg --cwd b import - < exported-tip.patch | |
195 | applying patch from stdin |
|
193 | applying patch from stdin | |
196 | $ rm -r b |
|
194 | $ rm -r b | |
197 |
|
195 | |||
@@ -218,7 +216,7 b' override commit message' | |||||
218 | added 1 changesets with 2 changes to 2 files |
|
216 | added 1 changesets with 2 changes to 2 files | |
219 | updating to branch default |
|
217 | updating to branch default | |
220 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
218 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
221 |
$ |
|
219 | $ hg --cwd b import -m 'override' - < exported-tip.patch | |
222 | applying patch from stdin |
|
220 | applying patch from stdin | |
223 | $ hg --cwd b tip | grep override |
|
221 | $ hg --cwd b tip | grep override | |
224 | summary: override |
|
222 | summary: override | |
@@ -227,7 +225,8 b' override commit message' | |||||
227 | $ cat > mkmsg.py <<EOF |
|
225 | $ cat > mkmsg.py <<EOF | |
228 | > import email.Message, sys |
|
226 | > import email.Message, sys | |
229 | > msg = email.Message.Message() |
|
227 | > msg = email.Message.Message() | |
230 | > msg.set_payload('email commit message\n' + open('tip.patch', 'rb').read()) |
|
228 | > patch = open(sys.argv[1], 'rb').read() | |
|
229 | > msg.set_payload('email commit message\n' + patch) | |||
231 | > msg['Subject'] = 'email patch' |
|
230 | > msg['Subject'] = 'email patch' | |
232 | > msg['From'] = 'email patcher' |
|
231 | > msg['From'] = 'email patcher' | |
233 | > sys.stdout.write(msg.as_string()) |
|
232 | > sys.stdout.write(msg.as_string()) | |
@@ -243,8 +242,7 b' plain diff in email, subject, message bo' | |||||
243 | added 1 changesets with 2 changes to 2 files |
|
242 | added 1 changesets with 2 changes to 2 files | |
244 | updating to branch default |
|
243 | updating to branch default | |
245 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
244 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
246 | $ hg --cwd a diff -r0:1 > tip.patch |
|
245 | $ python mkmsg.py diffed-tip.patch > msg.patch | |
247 | $ python mkmsg.py > msg.patch |
|
|||
248 | $ hg --cwd b import ../msg.patch |
|
246 | $ hg --cwd b import ../msg.patch | |
249 | applying ../msg.patch |
|
247 | applying ../msg.patch | |
250 | $ hg --cwd b tip | grep email |
|
248 | $ hg --cwd b tip | grep email | |
@@ -306,8 +304,7 b' hg export in email, should use patch hea' | |||||
306 | added 1 changesets with 2 changes to 2 files |
|
304 | added 1 changesets with 2 changes to 2 files | |
307 | updating to branch default |
|
305 | updating to branch default | |
308 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
306 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
309 | $ hg --cwd a export tip > tip.patch |
|
307 | $ python mkmsg.py exported-tip.patch | hg --cwd b import - | |
310 | $ python mkmsg.py | hg --cwd b import - |
|
|||
311 | applying patch from stdin |
|
308 | applying patch from stdin | |
312 | $ hg --cwd b tip | grep second |
|
309 | $ hg --cwd b tip | grep second | |
313 | summary: second change |
|
310 | summary: second change | |
@@ -320,7 +317,8 b" The '---' tests the gitsendmail handling" | |||||
320 | $ cat > mkmsg2.py <<EOF |
|
317 | $ cat > mkmsg2.py <<EOF | |
321 | > import email.Message, sys |
|
318 | > import email.Message, sys | |
322 | > msg = email.Message.Message() |
|
319 | > msg = email.Message.Message() | |
323 | > msg.set_payload('email patch\n\nnext line\n---\n' + open('tip.patch').read()) |
|
320 | > patch = open(sys.argv[1], 'rb').read() | |
|
321 | > msg.set_payload('email patch\n\nnext line\n---\n' + patch) | |||
324 | > msg['Subject'] = '[PATCH] email patch' |
|
322 | > msg['Subject'] = '[PATCH] email patch' | |
325 | > msg['From'] = 'email patcher' |
|
323 | > msg['From'] = 'email patcher' | |
326 | > sys.stdout.write(msg.as_string()) |
|
324 | > sys.stdout.write(msg.as_string()) | |
@@ -336,8 +334,7 b' plain diff in email, [PATCH] subject, me' | |||||
336 | added 1 changesets with 2 changes to 2 files |
|
334 | added 1 changesets with 2 changes to 2 files | |
337 | updating to branch default |
|
335 | updating to branch default | |
338 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
336 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
339 | $ hg --cwd a diff -r0:1 > tip.patch |
|
337 | $ python mkmsg2.py diffed-tip.patch | hg --cwd b import - | |
340 | $ python mkmsg2.py | hg --cwd b import - |
|
|||
341 | applying patch from stdin |
|
338 | applying patch from stdin | |
342 | $ hg --cwd b tip --template '{desc}\n' |
|
339 | $ hg --cwd b tip --template '{desc}\n' | |
343 | email patch |
|
340 | email patch | |
@@ -386,22 +383,23 b' hg import in a subdirectory' | |||||
386 | updating to branch default |
|
383 | updating to branch default | |
387 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
384 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
388 | $ hg --cwd a export tip > tmp |
|
385 | $ hg --cwd a export tip > tmp | |
389 | $ sed -e 's/d1\/d2\///' < tmp > tip.patch |
|
386 | $ sed -e 's/d1\/d2\///' < tmp > subdir-tip.patch | |
390 | $ dir=`pwd` |
|
387 | $ dir=`pwd` | |
391 | $ cd b/d1/d2 2>&1 > /dev/null |
|
388 | $ cd b/d1/d2 2>&1 > /dev/null | |
392 | $ hg import ../../../tip.patch |
|
389 | $ hg import ../../../subdir-tip.patch | |
393 | applying ../../../tip.patch |
|
390 | applying ../../../subdir-tip.patch | |
394 | $ cd "$dir" |
|
391 | $ cd "$dir" | |
395 |
|
392 | |||
396 | message should be 'subdir change' |
|
393 | message should be 'subdir change' | |
397 |
|
||||
398 | $ hg --cwd b tip | grep 'subdir change' |
|
|||
399 | summary: subdir change |
|
|||
400 |
|
||||
401 | committer should be 'someoneelse' |
|
394 | committer should be 'someoneelse' | |
402 |
|
395 | |||
403 |
$ hg --cwd b tip |
|
396 | $ hg --cwd b tip | |
|
397 | changeset: 1:3577f5aea227 | |||
|
398 | tag: tip | |||
404 | user: someoneelse |
|
399 | user: someoneelse | |
|
400 | date: Thu Jan 01 00:00:01 1970 +0000 | |||
|
401 | summary: subdir change | |||
|
402 | ||||
405 |
|
403 | |||
406 | should be empty |
|
404 | should be empty | |
407 |
|
405 | |||
@@ -422,7 +420,7 b' Test fuzziness (ambiguous patch location' | |||||
422 | $ echo line0 >> a |
|
420 | $ echo line0 >> a | |
423 | $ echo line3 >> a |
|
421 | $ echo line3 >> a | |
424 | $ hg ci -m change a |
|
422 | $ hg ci -m change a | |
425 | $ hg export tip > tip.patch |
|
423 | $ hg export tip > fuzzy-tip.patch | |
426 | $ hg up -C 0 |
|
424 | $ hg up -C 0 | |
427 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
425 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
428 | $ echo line1 > a |
|
426 | $ echo line1 > a | |
@@ -431,8 +429,8 b' Test fuzziness (ambiguous patch location' | |||||
431 | $ echo line0 >> a |
|
429 | $ echo line0 >> a | |
432 | $ hg ci -m brancha |
|
430 | $ hg ci -m brancha | |
433 | created new head |
|
431 | created new head | |
434 | $ hg import --no-commit -v tip.patch |
|
432 | $ hg import --no-commit -v fuzzy-tip.patch | |
435 | applying tip.patch |
|
433 | applying fuzzy-tip.patch | |
436 | patching file a |
|
434 | patching file a | |
437 | Hunk #1 succeeded at 1 with fuzz 2 (offset -2 lines). |
|
435 | Hunk #1 succeeded at 1 with fuzz 2 (offset -2 lines). | |
438 | $ hg revert -a |
|
436 | $ hg revert -a | |
@@ -447,8 +445,8 b' import with --no-commit should have writ' | |||||
447 |
|
445 | |||
448 | test fuzziness with eol=auto |
|
446 | test fuzziness with eol=auto | |
449 |
|
447 | |||
450 | $ hg --config patch.eol=auto import --no-commit -v tip.patch |
|
448 | $ hg --config patch.eol=auto import --no-commit -v fuzzy-tip.patch | |
451 | applying tip.patch |
|
449 | applying fuzzy-tip.patch | |
452 | patching file a |
|
450 | patching file a | |
453 | Hunk #1 succeeded at 1 with fuzz 2 (offset -2 lines). |
|
451 | Hunk #1 succeeded at 1 with fuzz 2 (offset -2 lines). | |
454 | $ cd .. |
|
452 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now