9 |
9 |
10 $ echo line 2 >> a/a |
10 $ echo line 2 >> a/a |
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 |
17 adding changesets |
23 adding changesets |
18 adding manifests |
24 adding manifests |
19 adding file changes |
25 adding file changes |
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 a export tip > tip.patch |
29 $ hg --cwd b import ../exported-tip.patch |
24 $ hg --cwd b import ../tip.patch |
30 applying ../exported-tip.patch |
25 applying ../tip.patch |
31 |
26 |
32 message and committer should be same |
27 message should be same |
33 |
28 |
34 $ hg --cwd b tip |
29 $ hg --cwd b tip | grep 'second change' |
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 |
39 import exported patch with external patcher |
44 import exported patch with external patcher |
40 |
45 |
48 adding manifests |
53 adding manifests |
49 adding file changes |
54 adding file changes |
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 |
59 |
63 |
60 |
64 |
65 adding manifests |
69 adding manifests |
66 adding file changes |
70 adding file changes |
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 a diff -r0:1 > tip.patch |
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 |
76 |
79 |
77 |
80 |
82 adding manifests |
85 adding manifests |
83 adding file changes |
86 adding file changes |
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 a diff -r0:1 > tip.patch |
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 |
93 import of plain diff with specific date and user |
95 import of plain diff with specific date and user |
94 |
96 |
97 adding manifests |
99 adding manifests |
98 adding file changes |
100 adding file changes |
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 |
108 user: user@nowhere.net |
109 user: user@nowhere.net |
109 date: Thu Jan 01 00:00:01 1970 +0000 |
110 date: Thu Jan 01 00:00:01 1970 +0000 |
129 adding manifests |
130 adding manifests |
130 adding file changes |
131 adding file changes |
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 a diff -r0:1 > tip.patch |
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 |
140 +++ b/a |
140 +++ b/a |
141 @@ -1,1 +1,2 @@ |
141 @@ -1,1 +1,2 @@ |
151 adding manifests |
151 adding manifests |
152 adding file changes |
152 adding file changes |
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 $ hg --cwd b import -mpatch ../broken.patch |
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 |
161 [255] |
160 [255] |
162 $ rm -r b |
161 $ rm -r b |
172 adding manifests |
171 adding manifests |
173 adding file changes |
172 adding file changes |
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 |
184 |
182 |
185 import from stdin |
183 import from stdin |
189 adding manifests |
187 adding manifests |
190 adding file changes |
188 adding file changes |
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 |
198 |
196 |
199 import two patches in one stream |
197 import two patches in one stream |
216 adding manifests |
214 adding manifests |
217 adding file changes |
215 adding file changes |
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 $ hg --cwd a export tip | hg --cwd b import -m 'override' - |
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 |
225 $ rm -r b |
223 $ rm -r b |
226 |
224 |
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()) |
234 > EOF |
233 > EOF |
235 |
234 |
241 adding manifests |
240 adding manifests |
242 adding file changes |
241 adding file changes |
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 |
251 user: email patcher |
249 user: email patcher |
252 summary: email patch |
250 summary: email patch |
304 adding manifests |
302 adding manifests |
305 adding file changes |
303 adding file changes |
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 |
314 $ rm -r b |
311 $ rm -r b |
315 |
312 |
318 The '---' tests the gitsendmail handling without proper mail headers |
315 The '---' tests the gitsendmail handling without proper mail headers |
319 |
316 |
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()) |
327 > EOF |
325 > EOF |
328 |
326 |
334 adding manifests |
332 adding manifests |
335 adding file changes |
333 adding file changes |
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 |
344 |
341 |
345 next line |
342 next line |
384 adding file changes |
381 adding file changes |
385 added 1 changesets with 2 changes to 2 files |
382 added 1 changesets with 2 changes to 2 files |
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 |
394 committer should be 'someoneelse' |
398 $ hg --cwd b tip | grep 'subdir change' |
395 |
|
396 $ hg --cwd b tip |
|
397 changeset: 1:3577f5aea227 |
|
398 tag: tip |
|
399 user: someoneelse |
|
400 date: Thu Jan 01 00:00:01 1970 +0000 |
399 summary: subdir change |
401 summary: subdir change |
400 |
402 |
401 committer should be 'someoneelse' |
|
402 |
|
403 $ hg --cwd b tip | grep someoneelse |
|
404 user: someoneelse |
|
405 |
403 |
406 should be empty |
404 should be empty |
407 |
405 |
408 $ hg --cwd b status |
406 $ hg --cwd b status |
409 |
407 |
420 $ echo line1 > a |
418 $ echo line1 > a |
421 $ echo line2 >> a |
419 $ echo line2 >> a |
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 |
429 $ echo line0 >> a |
427 $ echo line0 >> a |
430 $ echo line1 >> a |
428 $ echo line1 >> a |
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 |
439 reverting a |
437 reverting a |
440 |
438 |