##// END OF EJS Templates
test-import: sync with 6084926366b9 for platforms without execbit
Matt Harbison -
r25397:0b6dee81 default
parent child Browse files
Show More
@@ -1,1500 +1,1500 b''
1 $ hg init a
1 $ hg init a
2 $ mkdir a/d1
2 $ mkdir a/d1
3 $ mkdir a/d1/d2
3 $ mkdir a/d1/d2
4 $ echo line 1 > a/a
4 $ echo line 1 > a/a
5 $ echo line 1 > a/d1/d2/a
5 $ echo line 1 > a/d1/d2/a
6 $ hg --cwd a ci -Ama
6 $ hg --cwd a ci -Ama
7 adding a
7 adding a
8 adding d1/d2/a
8 adding d1/d2/a
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 import with no args:
13 import with no args:
14
14
15 $ hg --cwd a import
15 $ hg --cwd a import
16 abort: need at least one patch to import
16 abort: need at least one patch to import
17 [255]
17 [255]
18
18
19 generate patches for the test
19 generate patches for the test
20
20
21 $ hg --cwd a export tip > exported-tip.patch
21 $ hg --cwd a export tip > exported-tip.patch
22 $ hg --cwd a diff -r0:1 > diffed-tip.patch
22 $ hg --cwd a diff -r0:1 > diffed-tip.patch
23
23
24
24
25 import exported patch
25 import exported patch
26 (this also tests that editor is not invoked, if the patch contains the
26 (this also tests that editor is not invoked, if the patch contains the
27 commit message and '--edit' is not specified)
27 commit message and '--edit' is not specified)
28
28
29 $ hg clone -r0 a b
29 $ hg clone -r0 a b
30 adding changesets
30 adding changesets
31 adding manifests
31 adding manifests
32 adding file changes
32 adding file changes
33 added 1 changesets with 2 changes to 2 files
33 added 1 changesets with 2 changes to 2 files
34 updating to branch default
34 updating to branch default
35 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
35 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
36 $ HGEDITOR=cat hg --cwd b import ../exported-tip.patch
36 $ HGEDITOR=cat hg --cwd b import ../exported-tip.patch
37 applying ../exported-tip.patch
37 applying ../exported-tip.patch
38
38
39 message and committer and date should be same
39 message and committer and date should be same
40
40
41 $ hg --cwd b tip
41 $ hg --cwd b tip
42 changeset: 1:1d4bd90af0e4
42 changeset: 1:1d4bd90af0e4
43 tag: tip
43 tag: tip
44 user: someone
44 user: someone
45 date: Thu Jan 01 00:00:01 1970 +0000
45 date: Thu Jan 01 00:00:01 1970 +0000
46 summary: second change
46 summary: second change
47
47
48 $ rm -r b
48 $ rm -r b
49
49
50
50
51 import exported patch with external patcher
51 import exported patch with external patcher
52 (this also tests that editor is invoked, if the '--edit' is specified,
52 (this also tests that editor is invoked, if the '--edit' is specified,
53 regardless of the commit message in the patch)
53 regardless of the commit message in the patch)
54
54
55 $ cat > dummypatch.py <<EOF
55 $ cat > dummypatch.py <<EOF
56 > print 'patching file a'
56 > print 'patching file a'
57 > file('a', 'wb').write('line2\n')
57 > file('a', 'wb').write('line2\n')
58 > EOF
58 > EOF
59 $ hg clone -r0 a b
59 $ hg clone -r0 a b
60 adding changesets
60 adding changesets
61 adding manifests
61 adding manifests
62 adding file changes
62 adding file changes
63 added 1 changesets with 2 changes to 2 files
63 added 1 changesets with 2 changes to 2 files
64 updating to branch default
64 updating to branch default
65 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
65 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
66 $ HGEDITOR=cat hg --config ui.patch='python ../dummypatch.py' --cwd b import --edit ../exported-tip.patch
66 $ HGEDITOR=cat hg --config ui.patch='python ../dummypatch.py' --cwd b import --edit ../exported-tip.patch
67 applying ../exported-tip.patch
67 applying ../exported-tip.patch
68 second change
68 second change
69
69
70
70
71 HG: Enter commit message. Lines beginning with 'HG:' are removed.
71 HG: Enter commit message. Lines beginning with 'HG:' are removed.
72 HG: Leave message empty to abort commit.
72 HG: Leave message empty to abort commit.
73 HG: --
73 HG: --
74 HG: user: someone
74 HG: user: someone
75 HG: branch 'default'
75 HG: branch 'default'
76 HG: changed a
76 HG: changed a
77 $ cat b/a
77 $ cat b/a
78 line2
78 line2
79 $ rm -r b
79 $ rm -r b
80
80
81
81
82 import of plain diff should fail without message
82 import of plain diff should fail without message
83 (this also tests that editor is invoked, if the patch doesn't contain
83 (this also tests that editor is invoked, if the patch doesn't contain
84 the commit message, regardless of '--edit')
84 the commit message, regardless of '--edit')
85
85
86 $ hg clone -r0 a b
86 $ hg clone -r0 a b
87 adding changesets
87 adding changesets
88 adding manifests
88 adding manifests
89 adding file changes
89 adding file changes
90 added 1 changesets with 2 changes to 2 files
90 added 1 changesets with 2 changes to 2 files
91 updating to branch default
91 updating to branch default
92 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
92 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
93 $ cat > $TESTTMP/editor.sh <<EOF
93 $ cat > $TESTTMP/editor.sh <<EOF
94 > env | grep HGEDITFORM
94 > env | grep HGEDITFORM
95 > cat \$1
95 > cat \$1
96 > EOF
96 > EOF
97 $ HGEDITOR="sh $TESTTMP/editor.sh" hg --cwd b import ../diffed-tip.patch
97 $ HGEDITOR="sh $TESTTMP/editor.sh" hg --cwd b import ../diffed-tip.patch
98 applying ../diffed-tip.patch
98 applying ../diffed-tip.patch
99 HGEDITFORM=import.normal.normal
99 HGEDITFORM=import.normal.normal
100
100
101
101
102 HG: Enter commit message. Lines beginning with 'HG:' are removed.
102 HG: Enter commit message. Lines beginning with 'HG:' are removed.
103 HG: Leave message empty to abort commit.
103 HG: Leave message empty to abort commit.
104 HG: --
104 HG: --
105 HG: user: test
105 HG: user: test
106 HG: branch 'default'
106 HG: branch 'default'
107 HG: changed a
107 HG: changed a
108 abort: empty commit message
108 abort: empty commit message
109 [255]
109 [255]
110
110
111 Test avoiding editor invocation at applying the patch with --exact,
111 Test avoiding editor invocation at applying the patch with --exact,
112 even if commit message is empty
112 even if commit message is empty
113
113
114 $ echo a >> b/a
114 $ echo a >> b/a
115 $ hg --cwd b commit -m ' '
115 $ hg --cwd b commit -m ' '
116 $ hg --cwd b tip -T "{node}\n"
116 $ hg --cwd b tip -T "{node}\n"
117 d8804f3f5396d800812f579c8452796a5993bdb2
117 d8804f3f5396d800812f579c8452796a5993bdb2
118 $ hg --cwd b export -o ../empty-log.diff .
118 $ hg --cwd b export -o ../empty-log.diff .
119 $ hg --cwd b update -q -C ".^1"
119 $ hg --cwd b update -q -C ".^1"
120 $ hg --cwd b --config extensions.strip= strip -q tip
120 $ hg --cwd b --config extensions.strip= strip -q tip
121 $ HGEDITOR=cat hg --cwd b import --exact ../empty-log.diff
121 $ HGEDITOR=cat hg --cwd b import --exact ../empty-log.diff
122 applying ../empty-log.diff
122 applying ../empty-log.diff
123 $ hg --cwd b tip -T "{node}\n"
123 $ hg --cwd b tip -T "{node}\n"
124 d8804f3f5396d800812f579c8452796a5993bdb2
124 d8804f3f5396d800812f579c8452796a5993bdb2
125
125
126 $ rm -r b
126 $ rm -r b
127
127
128
128
129 import of plain diff should be ok with message
129 import of plain diff should be ok with message
130
130
131 $ hg clone -r0 a b
131 $ hg clone -r0 a b
132 adding changesets
132 adding changesets
133 adding manifests
133 adding manifests
134 adding file changes
134 adding file changes
135 added 1 changesets with 2 changes to 2 files
135 added 1 changesets with 2 changes to 2 files
136 updating to branch default
136 updating to branch default
137 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
137 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
138 $ hg --cwd b import -mpatch ../diffed-tip.patch
138 $ hg --cwd b import -mpatch ../diffed-tip.patch
139 applying ../diffed-tip.patch
139 applying ../diffed-tip.patch
140 $ rm -r b
140 $ rm -r b
141
141
142
142
143 import of plain diff with specific date and user
143 import of plain diff with specific date and user
144 (this also tests that editor is not invoked, if
144 (this also tests that editor is not invoked, if
145 '--message'/'--logfile' is specified and '--edit' is not)
145 '--message'/'--logfile' is specified and '--edit' is not)
146
146
147 $ hg clone -r0 a b
147 $ hg clone -r0 a b
148 adding changesets
148 adding changesets
149 adding manifests
149 adding manifests
150 adding file changes
150 adding file changes
151 added 1 changesets with 2 changes to 2 files
151 added 1 changesets with 2 changes to 2 files
152 updating to branch default
152 updating to branch default
153 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
153 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
154 $ hg --cwd b import -mpatch -d '1 0' -u 'user@nowhere.net' ../diffed-tip.patch
154 $ hg --cwd b import -mpatch -d '1 0' -u 'user@nowhere.net' ../diffed-tip.patch
155 applying ../diffed-tip.patch
155 applying ../diffed-tip.patch
156 $ hg -R b tip -pv
156 $ hg -R b tip -pv
157 changeset: 1:ca68f19f3a40
157 changeset: 1:ca68f19f3a40
158 tag: tip
158 tag: tip
159 user: user@nowhere.net
159 user: user@nowhere.net
160 date: Thu Jan 01 00:00:01 1970 +0000
160 date: Thu Jan 01 00:00:01 1970 +0000
161 files: a
161 files: a
162 description:
162 description:
163 patch
163 patch
164
164
165
165
166 diff -r 80971e65b431 -r ca68f19f3a40 a
166 diff -r 80971e65b431 -r ca68f19f3a40 a
167 --- a/a Thu Jan 01 00:00:00 1970 +0000
167 --- a/a Thu Jan 01 00:00:00 1970 +0000
168 +++ b/a Thu Jan 01 00:00:01 1970 +0000
168 +++ b/a Thu Jan 01 00:00:01 1970 +0000
169 @@ -1,1 +1,2 @@
169 @@ -1,1 +1,2 @@
170 line 1
170 line 1
171 +line 2
171 +line 2
172
172
173 $ rm -r b
173 $ rm -r b
174
174
175
175
176 import of plain diff should be ok with --no-commit
176 import of plain diff should be ok with --no-commit
177 (this also tests that editor is not invoked, if '--no-commit' is
177 (this also tests that editor is not invoked, if '--no-commit' is
178 specified, regardless of '--edit')
178 specified, regardless of '--edit')
179
179
180 $ hg clone -r0 a b
180 $ hg clone -r0 a b
181 adding changesets
181 adding changesets
182 adding manifests
182 adding manifests
183 adding file changes
183 adding file changes
184 added 1 changesets with 2 changes to 2 files
184 added 1 changesets with 2 changes to 2 files
185 updating to branch default
185 updating to branch default
186 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
186 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
187 $ HGEDITOR=cat hg --cwd b import --no-commit --edit ../diffed-tip.patch
187 $ HGEDITOR=cat hg --cwd b import --no-commit --edit ../diffed-tip.patch
188 applying ../diffed-tip.patch
188 applying ../diffed-tip.patch
189 $ hg --cwd b diff --nodates
189 $ hg --cwd b diff --nodates
190 diff -r 80971e65b431 a
190 diff -r 80971e65b431 a
191 --- a/a
191 --- a/a
192 +++ b/a
192 +++ b/a
193 @@ -1,1 +1,2 @@
193 @@ -1,1 +1,2 @@
194 line 1
194 line 1
195 +line 2
195 +line 2
196 $ rm -r b
196 $ rm -r b
197
197
198
198
199 import of malformed plain diff should fail
199 import of malformed plain diff should fail
200
200
201 $ hg clone -r0 a b
201 $ hg clone -r0 a b
202 adding changesets
202 adding changesets
203 adding manifests
203 adding manifests
204 adding file changes
204 adding file changes
205 added 1 changesets with 2 changes to 2 files
205 added 1 changesets with 2 changes to 2 files
206 updating to branch default
206 updating to branch default
207 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
207 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
208 $ sed 's/1,1/foo/' < diffed-tip.patch > broken.patch
208 $ sed 's/1,1/foo/' < diffed-tip.patch > broken.patch
209 $ hg --cwd b import -mpatch ../broken.patch
209 $ hg --cwd b import -mpatch ../broken.patch
210 applying ../broken.patch
210 applying ../broken.patch
211 abort: bad hunk #1
211 abort: bad hunk #1
212 [255]
212 [255]
213 $ rm -r b
213 $ rm -r b
214
214
215
215
216 hg -R repo import
216 hg -R repo import
217 put the clone in a subdir - having a directory named "a"
217 put the clone in a subdir - having a directory named "a"
218 used to hide a bug.
218 used to hide a bug.
219
219
220 $ mkdir dir
220 $ mkdir dir
221 $ hg clone -r0 a dir/b
221 $ hg clone -r0 a dir/b
222 adding changesets
222 adding changesets
223 adding manifests
223 adding manifests
224 adding file changes
224 adding file changes
225 added 1 changesets with 2 changes to 2 files
225 added 1 changesets with 2 changes to 2 files
226 updating to branch default
226 updating to branch default
227 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
227 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
228 $ cd dir
228 $ cd dir
229 $ hg -R b import ../exported-tip.patch
229 $ hg -R b import ../exported-tip.patch
230 applying ../exported-tip.patch
230 applying ../exported-tip.patch
231 $ cd ..
231 $ cd ..
232 $ rm -r dir
232 $ rm -r dir
233
233
234
234
235 import from stdin
235 import from stdin
236
236
237 $ hg clone -r0 a b
237 $ hg clone -r0 a b
238 adding changesets
238 adding changesets
239 adding manifests
239 adding manifests
240 adding file changes
240 adding file changes
241 added 1 changesets with 2 changes to 2 files
241 added 1 changesets with 2 changes to 2 files
242 updating to branch default
242 updating to branch default
243 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
243 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
244 $ hg --cwd b import - < exported-tip.patch
244 $ hg --cwd b import - < exported-tip.patch
245 applying patch from stdin
245 applying patch from stdin
246 $ rm -r b
246 $ rm -r b
247
247
248
248
249 import two patches in one stream
249 import two patches in one stream
250
250
251 $ hg init b
251 $ hg init b
252 $ hg --cwd a export 0:tip | hg --cwd b import -
252 $ hg --cwd a export 0:tip | hg --cwd b import -
253 applying patch from stdin
253 applying patch from stdin
254 $ hg --cwd a id
254 $ hg --cwd a id
255 1d4bd90af0e4 tip
255 1d4bd90af0e4 tip
256 $ hg --cwd b id
256 $ hg --cwd b id
257 1d4bd90af0e4 tip
257 1d4bd90af0e4 tip
258 $ rm -r b
258 $ rm -r b
259
259
260
260
261 override commit message
261 override commit message
262
262
263 $ hg clone -r0 a b
263 $ hg clone -r0 a b
264 adding changesets
264 adding changesets
265 adding manifests
265 adding manifests
266 adding file changes
266 adding file changes
267 added 1 changesets with 2 changes to 2 files
267 added 1 changesets with 2 changes to 2 files
268 updating to branch default
268 updating to branch default
269 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
269 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
270 $ hg --cwd b import -m 'override' - < exported-tip.patch
270 $ hg --cwd b import -m 'override' - < exported-tip.patch
271 applying patch from stdin
271 applying patch from stdin
272 $ hg --cwd b tip | grep override
272 $ hg --cwd b tip | grep override
273 summary: override
273 summary: override
274 $ rm -r b
274 $ rm -r b
275
275
276 $ cat > mkmsg.py <<EOF
276 $ cat > mkmsg.py <<EOF
277 > import email.Message, sys
277 > import email.Message, sys
278 > msg = email.Message.Message()
278 > msg = email.Message.Message()
279 > patch = open(sys.argv[1], 'rb').read()
279 > patch = open(sys.argv[1], 'rb').read()
280 > msg.set_payload('email commit message\n' + patch)
280 > msg.set_payload('email commit message\n' + patch)
281 > msg['Subject'] = 'email patch'
281 > msg['Subject'] = 'email patch'
282 > msg['From'] = 'email patcher'
282 > msg['From'] = 'email patcher'
283 > file(sys.argv[2], 'wb').write(msg.as_string())
283 > file(sys.argv[2], 'wb').write(msg.as_string())
284 > EOF
284 > EOF
285
285
286
286
287 plain diff in email, subject, message body
287 plain diff in email, subject, message body
288
288
289 $ hg clone -r0 a b
289 $ hg clone -r0 a b
290 adding changesets
290 adding changesets
291 adding manifests
291 adding manifests
292 adding file changes
292 adding file changes
293 added 1 changesets with 2 changes to 2 files
293 added 1 changesets with 2 changes to 2 files
294 updating to branch default
294 updating to branch default
295 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
295 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
296 $ python mkmsg.py diffed-tip.patch msg.patch
296 $ python mkmsg.py diffed-tip.patch msg.patch
297 $ hg --cwd b import ../msg.patch
297 $ hg --cwd b import ../msg.patch
298 applying ../msg.patch
298 applying ../msg.patch
299 $ hg --cwd b tip | grep email
299 $ hg --cwd b tip | grep email
300 user: email patcher
300 user: email patcher
301 summary: email patch
301 summary: email patch
302 $ rm -r b
302 $ rm -r b
303
303
304
304
305 plain diff in email, no subject, message body
305 plain diff in email, no subject, message body
306
306
307 $ hg clone -r0 a b
307 $ hg clone -r0 a b
308 adding changesets
308 adding changesets
309 adding manifests
309 adding manifests
310 adding file changes
310 adding file changes
311 added 1 changesets with 2 changes to 2 files
311 added 1 changesets with 2 changes to 2 files
312 updating to branch default
312 updating to branch default
313 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
313 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
314 $ grep -v '^Subject:' msg.patch | hg --cwd b import -
314 $ grep -v '^Subject:' msg.patch | hg --cwd b import -
315 applying patch from stdin
315 applying patch from stdin
316 $ rm -r b
316 $ rm -r b
317
317
318
318
319 plain diff in email, subject, no message body
319 plain diff in email, subject, no message body
320
320
321 $ hg clone -r0 a b
321 $ hg clone -r0 a b
322 adding changesets
322 adding changesets
323 adding manifests
323 adding manifests
324 adding file changes
324 adding file changes
325 added 1 changesets with 2 changes to 2 files
325 added 1 changesets with 2 changes to 2 files
326 updating to branch default
326 updating to branch default
327 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
327 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
328 $ grep -v '^email ' msg.patch | hg --cwd b import -
328 $ grep -v '^email ' msg.patch | hg --cwd b import -
329 applying patch from stdin
329 applying patch from stdin
330 $ rm -r b
330 $ rm -r b
331
331
332
332
333 plain diff in email, no subject, no message body, should fail
333 plain diff in email, no subject, no message body, should fail
334
334
335 $ hg clone -r0 a b
335 $ hg clone -r0 a b
336 adding changesets
336 adding changesets
337 adding manifests
337 adding manifests
338 adding file changes
338 adding file changes
339 added 1 changesets with 2 changes to 2 files
339 added 1 changesets with 2 changes to 2 files
340 updating to branch default
340 updating to branch default
341 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
341 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
342 $ egrep -v '^(Subject|email)' msg.patch | hg --cwd b import -
342 $ egrep -v '^(Subject|email)' msg.patch | hg --cwd b import -
343 applying patch from stdin
343 applying patch from stdin
344 abort: empty commit message
344 abort: empty commit message
345 [255]
345 [255]
346 $ rm -r b
346 $ rm -r b
347
347
348
348
349 hg export in email, should use patch header
349 hg export in email, should use patch header
350
350
351 $ hg clone -r0 a b
351 $ hg clone -r0 a b
352 adding changesets
352 adding changesets
353 adding manifests
353 adding manifests
354 adding file changes
354 adding file changes
355 added 1 changesets with 2 changes to 2 files
355 added 1 changesets with 2 changes to 2 files
356 updating to branch default
356 updating to branch default
357 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
357 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
358 $ python mkmsg.py exported-tip.patch msg.patch
358 $ python mkmsg.py exported-tip.patch msg.patch
359 $ cat msg.patch | hg --cwd b import -
359 $ cat msg.patch | hg --cwd b import -
360 applying patch from stdin
360 applying patch from stdin
361 $ hg --cwd b tip | grep second
361 $ hg --cwd b tip | grep second
362 summary: second change
362 summary: second change
363 $ rm -r b
363 $ rm -r b
364
364
365
365
366 subject: duplicate detection, removal of [PATCH]
366 subject: duplicate detection, removal of [PATCH]
367 The '---' tests the gitsendmail handling without proper mail headers
367 The '---' tests the gitsendmail handling without proper mail headers
368
368
369 $ cat > mkmsg2.py <<EOF
369 $ cat > mkmsg2.py <<EOF
370 > import email.Message, sys
370 > import email.Message, sys
371 > msg = email.Message.Message()
371 > msg = email.Message.Message()
372 > patch = open(sys.argv[1], 'rb').read()
372 > patch = open(sys.argv[1], 'rb').read()
373 > msg.set_payload('email patch\n\nnext line\n---\n' + patch)
373 > msg.set_payload('email patch\n\nnext line\n---\n' + patch)
374 > msg['Subject'] = '[PATCH] email patch'
374 > msg['Subject'] = '[PATCH] email patch'
375 > msg['From'] = 'email patcher'
375 > msg['From'] = 'email patcher'
376 > file(sys.argv[2], 'wb').write(msg.as_string())
376 > file(sys.argv[2], 'wb').write(msg.as_string())
377 > EOF
377 > EOF
378
378
379
379
380 plain diff in email, [PATCH] subject, message body with subject
380 plain diff in email, [PATCH] subject, message body with subject
381
381
382 $ hg clone -r0 a b
382 $ hg clone -r0 a b
383 adding changesets
383 adding changesets
384 adding manifests
384 adding manifests
385 adding file changes
385 adding file changes
386 added 1 changesets with 2 changes to 2 files
386 added 1 changesets with 2 changes to 2 files
387 updating to branch default
387 updating to branch default
388 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
388 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
389 $ python mkmsg2.py diffed-tip.patch msg.patch
389 $ python mkmsg2.py diffed-tip.patch msg.patch
390 $ cat msg.patch | hg --cwd b import -
390 $ cat msg.patch | hg --cwd b import -
391 applying patch from stdin
391 applying patch from stdin
392 $ hg --cwd b tip --template '{desc}\n'
392 $ hg --cwd b tip --template '{desc}\n'
393 email patch
393 email patch
394
394
395 next line
395 next line
396 $ rm -r b
396 $ rm -r b
397
397
398
398
399 Issue963: Parent of working dir incorrect after import of multiple
399 Issue963: Parent of working dir incorrect after import of multiple
400 patches and rollback
400 patches and rollback
401
401
402 We weren't backing up the correct dirstate file when importing many
402 We weren't backing up the correct dirstate file when importing many
403 patches: import patch1 patch2; rollback
403 patches: import patch1 patch2; rollback
404
404
405 $ echo line 3 >> a/a
405 $ echo line 3 >> a/a
406 $ hg --cwd a ci -m'third change'
406 $ hg --cwd a ci -m'third change'
407 $ hg --cwd a export -o '../patch%R' 1 2
407 $ hg --cwd a export -o '../patch%R' 1 2
408 $ hg clone -qr0 a b
408 $ hg clone -qr0 a b
409 $ hg --cwd b parents --template 'parent: {rev}\n'
409 $ hg --cwd b parents --template 'parent: {rev}\n'
410 parent: 0
410 parent: 0
411 $ hg --cwd b import -v ../patch1 ../patch2
411 $ hg --cwd b import -v ../patch1 ../patch2
412 applying ../patch1
412 applying ../patch1
413 patching file a
413 patching file a
414 committing files:
414 committing files:
415 a
415 a
416 committing manifest
416 committing manifest
417 committing changelog
417 committing changelog
418 created 1d4bd90af0e4
418 created 1d4bd90af0e4
419 applying ../patch2
419 applying ../patch2
420 patching file a
420 patching file a
421 committing files:
421 committing files:
422 a
422 a
423 committing manifest
423 committing manifest
424 committing changelog
424 committing changelog
425 created 6d019af21222
425 created 6d019af21222
426 $ hg --cwd b rollback
426 $ hg --cwd b rollback
427 repository tip rolled back to revision 0 (undo import)
427 repository tip rolled back to revision 0 (undo import)
428 working directory now based on revision 0
428 working directory now based on revision 0
429 $ hg --cwd b parents --template 'parent: {rev}\n'
429 $ hg --cwd b parents --template 'parent: {rev}\n'
430 parent: 0
430 parent: 0
431 $ rm -r b
431 $ rm -r b
432
432
433
433
434 importing a patch in a subdirectory failed at the commit stage
434 importing a patch in a subdirectory failed at the commit stage
435
435
436 $ echo line 2 >> a/d1/d2/a
436 $ echo line 2 >> a/d1/d2/a
437 $ hg --cwd a ci -u someoneelse -d '1 0' -m'subdir change'
437 $ hg --cwd a ci -u someoneelse -d '1 0' -m'subdir change'
438
438
439 hg import in a subdirectory
439 hg import in a subdirectory
440
440
441 $ hg clone -r0 a b
441 $ hg clone -r0 a b
442 adding changesets
442 adding changesets
443 adding manifests
443 adding manifests
444 adding file changes
444 adding file changes
445 added 1 changesets with 2 changes to 2 files
445 added 1 changesets with 2 changes to 2 files
446 updating to branch default
446 updating to branch default
447 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
447 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
448 $ hg --cwd a export tip > tmp
448 $ hg --cwd a export tip > tmp
449 $ sed -e 's/d1\/d2\///' < tmp > subdir-tip.patch
449 $ sed -e 's/d1\/d2\///' < tmp > subdir-tip.patch
450 $ dir=`pwd`
450 $ dir=`pwd`
451 $ cd b/d1/d2 2>&1 > /dev/null
451 $ cd b/d1/d2 2>&1 > /dev/null
452 $ hg import ../../../subdir-tip.patch
452 $ hg import ../../../subdir-tip.patch
453 applying ../../../subdir-tip.patch
453 applying ../../../subdir-tip.patch
454 $ cd "$dir"
454 $ cd "$dir"
455
455
456 message should be 'subdir change'
456 message should be 'subdir change'
457 committer should be 'someoneelse'
457 committer should be 'someoneelse'
458
458
459 $ hg --cwd b tip
459 $ hg --cwd b tip
460 changeset: 1:3577f5aea227
460 changeset: 1:3577f5aea227
461 tag: tip
461 tag: tip
462 user: someoneelse
462 user: someoneelse
463 date: Thu Jan 01 00:00:01 1970 +0000
463 date: Thu Jan 01 00:00:01 1970 +0000
464 summary: subdir change
464 summary: subdir change
465
465
466
466
467 should be empty
467 should be empty
468
468
469 $ hg --cwd b status
469 $ hg --cwd b status
470
470
471
471
472 Test fuzziness (ambiguous patch location, fuzz=2)
472 Test fuzziness (ambiguous patch location, fuzz=2)
473
473
474 $ hg init fuzzy
474 $ hg init fuzzy
475 $ cd fuzzy
475 $ cd fuzzy
476 $ echo line1 > a
476 $ echo line1 > a
477 $ echo line0 >> a
477 $ echo line0 >> a
478 $ echo line3 >> a
478 $ echo line3 >> a
479 $ hg ci -Am adda
479 $ hg ci -Am adda
480 adding a
480 adding a
481 $ echo line1 > a
481 $ echo line1 > a
482 $ echo line2 >> a
482 $ echo line2 >> a
483 $ echo line0 >> a
483 $ echo line0 >> a
484 $ echo line3 >> a
484 $ echo line3 >> a
485 $ hg ci -m change a
485 $ hg ci -m change a
486 $ hg export tip > fuzzy-tip.patch
486 $ hg export tip > fuzzy-tip.patch
487 $ hg up -C 0
487 $ hg up -C 0
488 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
488 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
489 $ echo line1 > a
489 $ echo line1 > a
490 $ echo line0 >> a
490 $ echo line0 >> a
491 $ echo line1 >> a
491 $ echo line1 >> a
492 $ echo line0 >> a
492 $ echo line0 >> a
493 $ hg ci -m brancha
493 $ hg ci -m brancha
494 created new head
494 created new head
495 $ hg import --no-commit -v fuzzy-tip.patch
495 $ hg import --no-commit -v fuzzy-tip.patch
496 applying fuzzy-tip.patch
496 applying fuzzy-tip.patch
497 patching file a
497 patching file a
498 Hunk #1 succeeded at 2 with fuzz 1 (offset 0 lines).
498 Hunk #1 succeeded at 2 with fuzz 1 (offset 0 lines).
499 applied to working directory
499 applied to working directory
500 $ hg revert -a
500 $ hg revert -a
501 reverting a
501 reverting a
502
502
503
503
504 import with --no-commit should have written .hg/last-message.txt
504 import with --no-commit should have written .hg/last-message.txt
505
505
506 $ cat .hg/last-message.txt
506 $ cat .hg/last-message.txt
507 change (no-eol)
507 change (no-eol)
508
508
509
509
510 test fuzziness with eol=auto
510 test fuzziness with eol=auto
511
511
512 $ hg --config patch.eol=auto import --no-commit -v fuzzy-tip.patch
512 $ hg --config patch.eol=auto import --no-commit -v fuzzy-tip.patch
513 applying fuzzy-tip.patch
513 applying fuzzy-tip.patch
514 patching file a
514 patching file a
515 Hunk #1 succeeded at 2 with fuzz 1 (offset 0 lines).
515 Hunk #1 succeeded at 2 with fuzz 1 (offset 0 lines).
516 applied to working directory
516 applied to working directory
517 $ cd ..
517 $ cd ..
518
518
519
519
520 Test hunk touching empty files (issue906)
520 Test hunk touching empty files (issue906)
521
521
522 $ hg init empty
522 $ hg init empty
523 $ cd empty
523 $ cd empty
524 $ touch a
524 $ touch a
525 $ touch b1
525 $ touch b1
526 $ touch c1
526 $ touch c1
527 $ echo d > d
527 $ echo d > d
528 $ hg ci -Am init
528 $ hg ci -Am init
529 adding a
529 adding a
530 adding b1
530 adding b1
531 adding c1
531 adding c1
532 adding d
532 adding d
533 $ echo a > a
533 $ echo a > a
534 $ echo b > b1
534 $ echo b > b1
535 $ hg mv b1 b2
535 $ hg mv b1 b2
536 $ echo c > c1
536 $ echo c > c1
537 $ hg copy c1 c2
537 $ hg copy c1 c2
538 $ rm d
538 $ rm d
539 $ touch d
539 $ touch d
540 $ hg diff --git
540 $ hg diff --git
541 diff --git a/a b/a
541 diff --git a/a b/a
542 --- a/a
542 --- a/a
543 +++ b/a
543 +++ b/a
544 @@ -0,0 +1,1 @@
544 @@ -0,0 +1,1 @@
545 +a
545 +a
546 diff --git a/b1 b/b2
546 diff --git a/b1 b/b2
547 rename from b1
547 rename from b1
548 rename to b2
548 rename to b2
549 --- a/b1
549 --- a/b1
550 +++ b/b2
550 +++ b/b2
551 @@ -0,0 +1,1 @@
551 @@ -0,0 +1,1 @@
552 +b
552 +b
553 diff --git a/c1 b/c1
553 diff --git a/c1 b/c1
554 --- a/c1
554 --- a/c1
555 +++ b/c1
555 +++ b/c1
556 @@ -0,0 +1,1 @@
556 @@ -0,0 +1,1 @@
557 +c
557 +c
558 diff --git a/c1 b/c2
558 diff --git a/c1 b/c2
559 copy from c1
559 copy from c1
560 copy to c2
560 copy to c2
561 --- a/c1
561 --- a/c1
562 +++ b/c2
562 +++ b/c2
563 @@ -0,0 +1,1 @@
563 @@ -0,0 +1,1 @@
564 +c
564 +c
565 diff --git a/d b/d
565 diff --git a/d b/d
566 --- a/d
566 --- a/d
567 +++ b/d
567 +++ b/d
568 @@ -1,1 +0,0 @@
568 @@ -1,1 +0,0 @@
569 -d
569 -d
570 $ hg ci -m empty
570 $ hg ci -m empty
571 $ hg export --git tip > empty.diff
571 $ hg export --git tip > empty.diff
572 $ hg up -C 0
572 $ hg up -C 0
573 4 files updated, 0 files merged, 2 files removed, 0 files unresolved
573 4 files updated, 0 files merged, 2 files removed, 0 files unresolved
574 $ hg import empty.diff
574 $ hg import empty.diff
575 applying empty.diff
575 applying empty.diff
576 $ for name in a b1 b2 c1 c2 d; do
576 $ for name in a b1 b2 c1 c2 d; do
577 > echo % $name file
577 > echo % $name file
578 > test -f $name && cat $name
578 > test -f $name && cat $name
579 > done
579 > done
580 % a file
580 % a file
581 a
581 a
582 % b1 file
582 % b1 file
583 % b2 file
583 % b2 file
584 b
584 b
585 % c1 file
585 % c1 file
586 c
586 c
587 % c2 file
587 % c2 file
588 c
588 c
589 % d file
589 % d file
590 $ cd ..
590 $ cd ..
591
591
592
592
593 Test importing a patch ending with a binary file removal
593 Test importing a patch ending with a binary file removal
594
594
595 $ hg init binaryremoval
595 $ hg init binaryremoval
596 $ cd binaryremoval
596 $ cd binaryremoval
597 $ echo a > a
597 $ echo a > a
598 $ $PYTHON -c "file('b', 'wb').write('a\x00b')"
598 $ $PYTHON -c "file('b', 'wb').write('a\x00b')"
599 $ hg ci -Am addall
599 $ hg ci -Am addall
600 adding a
600 adding a
601 adding b
601 adding b
602 $ hg rm a
602 $ hg rm a
603 $ hg rm b
603 $ hg rm b
604 $ hg st
604 $ hg st
605 R a
605 R a
606 R b
606 R b
607 $ hg ci -m remove
607 $ hg ci -m remove
608 $ hg export --git . > remove.diff
608 $ hg export --git . > remove.diff
609 $ cat remove.diff | grep git
609 $ cat remove.diff | grep git
610 diff --git a/a b/a
610 diff --git a/a b/a
611 diff --git a/b b/b
611 diff --git a/b b/b
612 $ hg up -C 0
612 $ hg up -C 0
613 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
613 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
614 $ hg import remove.diff
614 $ hg import remove.diff
615 applying remove.diff
615 applying remove.diff
616 $ hg manifest
616 $ hg manifest
617 $ cd ..
617 $ cd ..
618
618
619
619
620 Issue927: test update+rename with common name
620 Issue927: test update+rename with common name
621
621
622 $ hg init t
622 $ hg init t
623 $ cd t
623 $ cd t
624 $ touch a
624 $ touch a
625 $ hg ci -Am t
625 $ hg ci -Am t
626 adding a
626 adding a
627 $ echo a > a
627 $ echo a > a
628
628
629 Here, bfile.startswith(afile)
629 Here, bfile.startswith(afile)
630
630
631 $ hg copy a a2
631 $ hg copy a a2
632 $ hg ci -m copya
632 $ hg ci -m copya
633 $ hg export --git tip > copy.diff
633 $ hg export --git tip > copy.diff
634 $ hg up -C 0
634 $ hg up -C 0
635 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
635 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
636 $ hg import copy.diff
636 $ hg import copy.diff
637 applying copy.diff
637 applying copy.diff
638
638
639 a should contain an 'a'
639 a should contain an 'a'
640
640
641 $ cat a
641 $ cat a
642 a
642 a
643
643
644 and a2 should have duplicated it
644 and a2 should have duplicated it
645
645
646 $ cat a2
646 $ cat a2
647 a
647 a
648 $ cd ..
648 $ cd ..
649
649
650
650
651 test -p0
651 test -p0
652
652
653 $ hg init p0
653 $ hg init p0
654 $ cd p0
654 $ cd p0
655 $ echo a > a
655 $ echo a > a
656 $ hg ci -Am t
656 $ hg ci -Am t
657 adding a
657 adding a
658 $ hg import -p foo
658 $ hg import -p foo
659 abort: invalid value 'foo' for option -p, expected int
659 abort: invalid value 'foo' for option -p, expected int
660 [255]
660 [255]
661 $ hg import -p0 - << EOF
661 $ hg import -p0 - << EOF
662 > foobar
662 > foobar
663 > --- a Sat Apr 12 22:43:58 2008 -0400
663 > --- a Sat Apr 12 22:43:58 2008 -0400
664 > +++ a Sat Apr 12 22:44:05 2008 -0400
664 > +++ a Sat Apr 12 22:44:05 2008 -0400
665 > @@ -1,1 +1,1 @@
665 > @@ -1,1 +1,1 @@
666 > -a
666 > -a
667 > +bb
667 > +bb
668 > EOF
668 > EOF
669 applying patch from stdin
669 applying patch from stdin
670 $ hg status
670 $ hg status
671 $ cat a
671 $ cat a
672 bb
672 bb
673
673
674 test --prefix
674 test --prefix
675
675
676 $ mkdir -p dir/dir2
676 $ mkdir -p dir/dir2
677 $ echo b > dir/dir2/b
677 $ echo b > dir/dir2/b
678 $ hg ci -Am b
678 $ hg ci -Am b
679 adding dir/dir2/b
679 adding dir/dir2/b
680 $ hg import -p2 --prefix dir - << EOF
680 $ hg import -p2 --prefix dir - << EOF
681 > foobar
681 > foobar
682 > --- drop1/drop2/dir2/b
682 > --- drop1/drop2/dir2/b
683 > +++ drop1/drop2/dir2/b
683 > +++ drop1/drop2/dir2/b
684 > @@ -1,1 +1,1 @@
684 > @@ -1,1 +1,1 @@
685 > -b
685 > -b
686 > +cc
686 > +cc
687 > EOF
687 > EOF
688 applying patch from stdin
688 applying patch from stdin
689 $ hg status
689 $ hg status
690 $ cat dir/dir2/b
690 $ cat dir/dir2/b
691 cc
691 cc
692 $ cd ..
692 $ cd ..
693
693
694
694
695 test paths outside repo root
695 test paths outside repo root
696
696
697 $ mkdir outside
697 $ mkdir outside
698 $ touch outside/foo
698 $ touch outside/foo
699 $ hg init inside
699 $ hg init inside
700 $ cd inside
700 $ cd inside
701 $ hg import - <<EOF
701 $ hg import - <<EOF
702 > diff --git a/a b/b
702 > diff --git a/a b/b
703 > rename from ../outside/foo
703 > rename from ../outside/foo
704 > rename to bar
704 > rename to bar
705 > EOF
705 > EOF
706 applying patch from stdin
706 applying patch from stdin
707 abort: path contains illegal component: ../outside/foo (glob)
707 abort: path contains illegal component: ../outside/foo (glob)
708 [255]
708 [255]
709 $ cd ..
709 $ cd ..
710
710
711
711
712 test import with similarity and git and strip (issue295 et al.)
712 test import with similarity and git and strip (issue295 et al.)
713
713
714 $ hg init sim
714 $ hg init sim
715 $ cd sim
715 $ cd sim
716 $ echo 'this is a test' > a
716 $ echo 'this is a test' > a
717 $ hg ci -Ama
717 $ hg ci -Ama
718 adding a
718 adding a
719 $ cat > ../rename.diff <<EOF
719 $ cat > ../rename.diff <<EOF
720 > diff --git a/foo/a b/foo/a
720 > diff --git a/foo/a b/foo/a
721 > deleted file mode 100644
721 > deleted file mode 100644
722 > --- a/foo/a
722 > --- a/foo/a
723 > +++ /dev/null
723 > +++ /dev/null
724 > @@ -1,1 +0,0 @@
724 > @@ -1,1 +0,0 @@
725 > -this is a test
725 > -this is a test
726 > diff --git a/foo/b b/foo/b
726 > diff --git a/foo/b b/foo/b
727 > new file mode 100644
727 > new file mode 100644
728 > --- /dev/null
728 > --- /dev/null
729 > +++ b/foo/b
729 > +++ b/foo/b
730 > @@ -0,0 +1,2 @@
730 > @@ -0,0 +1,2 @@
731 > +this is a test
731 > +this is a test
732 > +foo
732 > +foo
733 > EOF
733 > EOF
734 $ hg import --no-commit -v -s 1 ../rename.diff -p2
734 $ hg import --no-commit -v -s 1 ../rename.diff -p2
735 applying ../rename.diff
735 applying ../rename.diff
736 patching file a
736 patching file a
737 patching file b
737 patching file b
738 adding b
738 adding b
739 recording removal of a as rename to b (88% similar)
739 recording removal of a as rename to b (88% similar)
740 applied to working directory
740 applied to working directory
741 $ hg st -C
741 $ hg st -C
742 A b
742 A b
743 a
743 a
744 R a
744 R a
745 $ hg revert -a
745 $ hg revert -a
746 undeleting a
746 undeleting a
747 forgetting b
747 forgetting b
748 $ rm b
748 $ rm b
749 $ hg import --no-commit -v -s 100 ../rename.diff -p2
749 $ hg import --no-commit -v -s 100 ../rename.diff -p2
750 applying ../rename.diff
750 applying ../rename.diff
751 patching file a
751 patching file a
752 patching file b
752 patching file b
753 adding b
753 adding b
754 applied to working directory
754 applied to working directory
755 $ hg st -C
755 $ hg st -C
756 A b
756 A b
757 R a
757 R a
758 $ cd ..
758 $ cd ..
759
759
760
760
761 Issue1495: add empty file from the end of patch
761 Issue1495: add empty file from the end of patch
762
762
763 $ hg init addemptyend
763 $ hg init addemptyend
764 $ cd addemptyend
764 $ cd addemptyend
765 $ touch a
765 $ touch a
766 $ hg addremove
766 $ hg addremove
767 adding a
767 adding a
768 $ hg ci -m "commit"
768 $ hg ci -m "commit"
769 $ cat > a.patch <<EOF
769 $ cat > a.patch <<EOF
770 > add a, b
770 > add a, b
771 > diff --git a/a b/a
771 > diff --git a/a b/a
772 > --- a/a
772 > --- a/a
773 > +++ b/a
773 > +++ b/a
774 > @@ -0,0 +1,1 @@
774 > @@ -0,0 +1,1 @@
775 > +a
775 > +a
776 > diff --git a/b b/b
776 > diff --git a/b b/b
777 > new file mode 100644
777 > new file mode 100644
778 > EOF
778 > EOF
779 $ hg import --no-commit a.patch
779 $ hg import --no-commit a.patch
780 applying a.patch
780 applying a.patch
781
781
782 apply a good patch followed by an empty patch (mainly to ensure
782 apply a good patch followed by an empty patch (mainly to ensure
783 that dirstate is *not* updated when import crashes)
783 that dirstate is *not* updated when import crashes)
784 $ hg update -q -C .
784 $ hg update -q -C .
785 $ rm b
785 $ rm b
786 $ touch empty.patch
786 $ touch empty.patch
787 $ hg import a.patch empty.patch
787 $ hg import a.patch empty.patch
788 applying a.patch
788 applying a.patch
789 applying empty.patch
789 applying empty.patch
790 transaction abort!
790 transaction abort!
791 rollback completed
791 rollback completed
792 abort: empty.patch: no diffs found
792 abort: empty.patch: no diffs found
793 [255]
793 [255]
794 $ hg tip --template '{rev} {desc|firstline}\n'
794 $ hg tip --template '{rev} {desc|firstline}\n'
795 0 commit
795 0 commit
796 $ hg -q status
796 $ hg -q status
797 M a
797 M a
798 $ cd ..
798 $ cd ..
799
799
800 create file when source is not /dev/null
800 create file when source is not /dev/null
801
801
802 $ cat > create.patch <<EOF
802 $ cat > create.patch <<EOF
803 > diff -Naur proj-orig/foo proj-new/foo
803 > diff -Naur proj-orig/foo proj-new/foo
804 > --- proj-orig/foo 1969-12-31 16:00:00.000000000 -0800
804 > --- proj-orig/foo 1969-12-31 16:00:00.000000000 -0800
805 > +++ proj-new/foo 2009-07-17 16:50:45.801368000 -0700
805 > +++ proj-new/foo 2009-07-17 16:50:45.801368000 -0700
806 > @@ -0,0 +1,1 @@
806 > @@ -0,0 +1,1 @@
807 > +a
807 > +a
808 > EOF
808 > EOF
809
809
810 some people have patches like the following too
810 some people have patches like the following too
811
811
812 $ cat > create2.patch <<EOF
812 $ cat > create2.patch <<EOF
813 > diff -Naur proj-orig/foo proj-new/foo
813 > diff -Naur proj-orig/foo proj-new/foo
814 > --- proj-orig/foo.orig 1969-12-31 16:00:00.000000000 -0800
814 > --- proj-orig/foo.orig 1969-12-31 16:00:00.000000000 -0800
815 > +++ proj-new/foo 2009-07-17 16:50:45.801368000 -0700
815 > +++ proj-new/foo 2009-07-17 16:50:45.801368000 -0700
816 > @@ -0,0 +1,1 @@
816 > @@ -0,0 +1,1 @@
817 > +a
817 > +a
818 > EOF
818 > EOF
819 $ hg init oddcreate
819 $ hg init oddcreate
820 $ cd oddcreate
820 $ cd oddcreate
821 $ hg import --no-commit ../create.patch
821 $ hg import --no-commit ../create.patch
822 applying ../create.patch
822 applying ../create.patch
823 $ cat foo
823 $ cat foo
824 a
824 a
825 $ rm foo
825 $ rm foo
826 $ hg revert foo
826 $ hg revert foo
827 $ hg import --no-commit ../create2.patch
827 $ hg import --no-commit ../create2.patch
828 applying ../create2.patch
828 applying ../create2.patch
829 $ cat foo
829 $ cat foo
830 a
830 a
831
831
832 $ cd ..
832 $ cd ..
833
833
834 Issue1859: first line mistaken for email headers
834 Issue1859: first line mistaken for email headers
835
835
836 $ hg init emailconfusion
836 $ hg init emailconfusion
837 $ cd emailconfusion
837 $ cd emailconfusion
838 $ cat > a.patch <<EOF
838 $ cat > a.patch <<EOF
839 > module: summary
839 > module: summary
840 >
840 >
841 > description
841 > description
842 >
842 >
843 >
843 >
844 > diff -r 000000000000 -r 9b4c1e343b55 test.txt
844 > diff -r 000000000000 -r 9b4c1e343b55 test.txt
845 > --- /dev/null
845 > --- /dev/null
846 > +++ b/a
846 > +++ b/a
847 > @@ -0,0 +1,1 @@
847 > @@ -0,0 +1,1 @@
848 > +a
848 > +a
849 > EOF
849 > EOF
850 $ hg import -d '0 0' a.patch
850 $ hg import -d '0 0' a.patch
851 applying a.patch
851 applying a.patch
852 $ hg parents -v
852 $ hg parents -v
853 changeset: 0:5a681217c0ad
853 changeset: 0:5a681217c0ad
854 tag: tip
854 tag: tip
855 user: test
855 user: test
856 date: Thu Jan 01 00:00:00 1970 +0000
856 date: Thu Jan 01 00:00:00 1970 +0000
857 files: a
857 files: a
858 description:
858 description:
859 module: summary
859 module: summary
860
860
861 description
861 description
862
862
863
863
864 $ cd ..
864 $ cd ..
865
865
866
866
867 in commit message
867 in commit message
868
868
869 $ hg init commitconfusion
869 $ hg init commitconfusion
870 $ cd commitconfusion
870 $ cd commitconfusion
871 $ cat > a.patch <<EOF
871 $ cat > a.patch <<EOF
872 > module: summary
872 > module: summary
873 >
873 >
874 > --- description
874 > --- description
875 >
875 >
876 > diff --git a/a b/a
876 > diff --git a/a b/a
877 > new file mode 100644
877 > new file mode 100644
878 > --- /dev/null
878 > --- /dev/null
879 > +++ b/a
879 > +++ b/a
880 > @@ -0,0 +1,1 @@
880 > @@ -0,0 +1,1 @@
881 > +a
881 > +a
882 > EOF
882 > EOF
883 > hg import -d '0 0' a.patch
883 > hg import -d '0 0' a.patch
884 > hg parents -v
884 > hg parents -v
885 > cd ..
885 > cd ..
886 >
886 >
887 > echo '% tricky header splitting'
887 > echo '% tricky header splitting'
888 > cat > trickyheaders.patch <<EOF
888 > cat > trickyheaders.patch <<EOF
889 > From: User A <user@a>
889 > From: User A <user@a>
890 > Subject: [PATCH] from: tricky!
890 > Subject: [PATCH] from: tricky!
891 >
891 >
892 > # HG changeset patch
892 > # HG changeset patch
893 > # User User B
893 > # User User B
894 > # Date 1266264441 18000
894 > # Date 1266264441 18000
895 > # Branch stable
895 > # Branch stable
896 > # Node ID f2be6a1170ac83bf31cb4ae0bad00d7678115bc0
896 > # Node ID f2be6a1170ac83bf31cb4ae0bad00d7678115bc0
897 > # Parent 0000000000000000000000000000000000000000
897 > # Parent 0000000000000000000000000000000000000000
898 > from: tricky!
898 > from: tricky!
899 >
899 >
900 > That is not a header.
900 > That is not a header.
901 >
901 >
902 > diff -r 000000000000 -r f2be6a1170ac foo
902 > diff -r 000000000000 -r f2be6a1170ac foo
903 > --- /dev/null
903 > --- /dev/null
904 > +++ b/foo
904 > +++ b/foo
905 > @@ -0,0 +1,1 @@
905 > @@ -0,0 +1,1 @@
906 > +foo
906 > +foo
907 > EOF
907 > EOF
908 applying a.patch
908 applying a.patch
909 changeset: 0:f34d9187897d
909 changeset: 0:f34d9187897d
910 tag: tip
910 tag: tip
911 user: test
911 user: test
912 date: Thu Jan 01 00:00:00 1970 +0000
912 date: Thu Jan 01 00:00:00 1970 +0000
913 files: a
913 files: a
914 description:
914 description:
915 module: summary
915 module: summary
916
916
917
917
918 % tricky header splitting
918 % tricky header splitting
919
919
920 $ hg init trickyheaders
920 $ hg init trickyheaders
921 $ cd trickyheaders
921 $ cd trickyheaders
922 $ hg import -d '0 0' ../trickyheaders.patch
922 $ hg import -d '0 0' ../trickyheaders.patch
923 applying ../trickyheaders.patch
923 applying ../trickyheaders.patch
924 $ hg export --git tip
924 $ hg export --git tip
925 # HG changeset patch
925 # HG changeset patch
926 # User User B
926 # User User B
927 # Date 0 0
927 # Date 0 0
928 # Thu Jan 01 00:00:00 1970 +0000
928 # Thu Jan 01 00:00:00 1970 +0000
929 # Node ID eb56ab91903632294ac504838508cb370c0901d2
929 # Node ID eb56ab91903632294ac504838508cb370c0901d2
930 # Parent 0000000000000000000000000000000000000000
930 # Parent 0000000000000000000000000000000000000000
931 from: tricky!
931 from: tricky!
932
932
933 That is not a header.
933 That is not a header.
934
934
935 diff --git a/foo b/foo
935 diff --git a/foo b/foo
936 new file mode 100644
936 new file mode 100644
937 --- /dev/null
937 --- /dev/null
938 +++ b/foo
938 +++ b/foo
939 @@ -0,0 +1,1 @@
939 @@ -0,0 +1,1 @@
940 +foo
940 +foo
941 $ cd ..
941 $ cd ..
942
942
943
943
944 Issue2102: hg export and hg import speak different languages
944 Issue2102: hg export and hg import speak different languages
945
945
946 $ hg init issue2102
946 $ hg init issue2102
947 $ cd issue2102
947 $ cd issue2102
948 $ mkdir -p src/cmd/gc
948 $ mkdir -p src/cmd/gc
949 $ touch src/cmd/gc/mksys.bash
949 $ touch src/cmd/gc/mksys.bash
950 $ hg ci -Am init
950 $ hg ci -Am init
951 adding src/cmd/gc/mksys.bash
951 adding src/cmd/gc/mksys.bash
952 $ hg import - <<EOF
952 $ hg import - <<EOF
953 > # HG changeset patch
953 > # HG changeset patch
954 > # User Rob Pike
954 > # User Rob Pike
955 > # Date 1216685449 25200
955 > # Date 1216685449 25200
956 > # Node ID 03aa2b206f499ad6eb50e6e207b9e710d6409c98
956 > # Node ID 03aa2b206f499ad6eb50e6e207b9e710d6409c98
957 > # Parent 93d10138ad8df586827ca90b4ddb5033e21a3a84
957 > # Parent 93d10138ad8df586827ca90b4ddb5033e21a3a84
958 > help management of empty pkg and lib directories in perforce
958 > help management of empty pkg and lib directories in perforce
959 >
959 >
960 > R=gri
960 > R=gri
961 > DELTA=4 (4 added, 0 deleted, 0 changed)
961 > DELTA=4 (4 added, 0 deleted, 0 changed)
962 > OCL=13328
962 > OCL=13328
963 > CL=13328
963 > CL=13328
964 >
964 >
965 > diff --git a/lib/place-holder b/lib/place-holder
965 > diff --git a/lib/place-holder b/lib/place-holder
966 > new file mode 100644
966 > new file mode 100644
967 > --- /dev/null
967 > --- /dev/null
968 > +++ b/lib/place-holder
968 > +++ b/lib/place-holder
969 > @@ -0,0 +1,2 @@
969 > @@ -0,0 +1,2 @@
970 > +perforce does not maintain empty directories.
970 > +perforce does not maintain empty directories.
971 > +this file helps.
971 > +this file helps.
972 > diff --git a/pkg/place-holder b/pkg/place-holder
972 > diff --git a/pkg/place-holder b/pkg/place-holder
973 > new file mode 100644
973 > new file mode 100644
974 > --- /dev/null
974 > --- /dev/null
975 > +++ b/pkg/place-holder
975 > +++ b/pkg/place-holder
976 > @@ -0,0 +1,2 @@
976 > @@ -0,0 +1,2 @@
977 > +perforce does not maintain empty directories.
977 > +perforce does not maintain empty directories.
978 > +this file helps.
978 > +this file helps.
979 > diff --git a/src/cmd/gc/mksys.bash b/src/cmd/gc/mksys.bash
979 > diff --git a/src/cmd/gc/mksys.bash b/src/cmd/gc/mksys.bash
980 > old mode 100644
980 > old mode 100644
981 > new mode 100755
981 > new mode 100755
982 > EOF
982 > EOF
983 applying patch from stdin
983 applying patch from stdin
984
984
985 #if execbit
985 #if execbit
986
986
987 $ hg sum
987 $ hg sum
988 parent: 1:d59915696727 tip
988 parent: 1:d59915696727 tip
989 help management of empty pkg and lib directories in perforce
989 help management of empty pkg and lib directories in perforce
990 branch: default
990 branch: default
991 commit: (clean)
991 commit: (clean)
992 update: (current)
992 update: (current)
993 phases: 2 draft
993 phases: 2 draft
994
994
995 $ hg diff --git -c tip
995 $ hg diff --git -c tip
996 diff --git a/lib/place-holder b/lib/place-holder
996 diff --git a/lib/place-holder b/lib/place-holder
997 new file mode 100644
997 new file mode 100644
998 --- /dev/null
998 --- /dev/null
999 +++ b/lib/place-holder
999 +++ b/lib/place-holder
1000 @@ -0,0 +1,2 @@
1000 @@ -0,0 +1,2 @@
1001 +perforce does not maintain empty directories.
1001 +perforce does not maintain empty directories.
1002 +this file helps.
1002 +this file helps.
1003 diff --git a/pkg/place-holder b/pkg/place-holder
1003 diff --git a/pkg/place-holder b/pkg/place-holder
1004 new file mode 100644
1004 new file mode 100644
1005 --- /dev/null
1005 --- /dev/null
1006 +++ b/pkg/place-holder
1006 +++ b/pkg/place-holder
1007 @@ -0,0 +1,2 @@
1007 @@ -0,0 +1,2 @@
1008 +perforce does not maintain empty directories.
1008 +perforce does not maintain empty directories.
1009 +this file helps.
1009 +this file helps.
1010 diff --git a/src/cmd/gc/mksys.bash b/src/cmd/gc/mksys.bash
1010 diff --git a/src/cmd/gc/mksys.bash b/src/cmd/gc/mksys.bash
1011 old mode 100644
1011 old mode 100644
1012 new mode 100755
1012 new mode 100755
1013
1013
1014 #else
1014 #else
1015
1015
1016 $ hg sum
1016 $ hg sum
1017 parent: 1:28f089cc9ccc tip
1017 parent: 1:28f089cc9ccc tip
1018 help management of empty pkg and lib directories in perforce
1018 help management of empty pkg and lib directories in perforce
1019 branch: default
1019 branch: default
1020 commit: (clean)
1020 commit: (clean)
1021 update: (current)
1021 update: (current)
1022 phases: 2 draft (draft)
1022 phases: 2 draft
1023
1023
1024 $ hg diff --git -c tip
1024 $ hg diff --git -c tip
1025 diff --git a/lib/place-holder b/lib/place-holder
1025 diff --git a/lib/place-holder b/lib/place-holder
1026 new file mode 100644
1026 new file mode 100644
1027 --- /dev/null
1027 --- /dev/null
1028 +++ b/lib/place-holder
1028 +++ b/lib/place-holder
1029 @@ -0,0 +1,2 @@
1029 @@ -0,0 +1,2 @@
1030 +perforce does not maintain empty directories.
1030 +perforce does not maintain empty directories.
1031 +this file helps.
1031 +this file helps.
1032 diff --git a/pkg/place-holder b/pkg/place-holder
1032 diff --git a/pkg/place-holder b/pkg/place-holder
1033 new file mode 100644
1033 new file mode 100644
1034 --- /dev/null
1034 --- /dev/null
1035 +++ b/pkg/place-holder
1035 +++ b/pkg/place-holder
1036 @@ -0,0 +1,2 @@
1036 @@ -0,0 +1,2 @@
1037 +perforce does not maintain empty directories.
1037 +perforce does not maintain empty directories.
1038 +this file helps.
1038 +this file helps.
1039
1039
1040 /* The mode change for mksys.bash is missing here, because on platforms */
1040 /* The mode change for mksys.bash is missing here, because on platforms */
1041 /* that don't support execbits, mode changes in patches are ignored when */
1041 /* that don't support execbits, mode changes in patches are ignored when */
1042 /* they are imported. This is obviously also the reason for why the hash */
1042 /* they are imported. This is obviously also the reason for why the hash */
1043 /* in the created changeset is different to the one you see above the */
1043 /* in the created changeset is different to the one you see above the */
1044 /* #else clause */
1044 /* #else clause */
1045
1045
1046 #endif
1046 #endif
1047 $ cd ..
1047 $ cd ..
1048
1048
1049
1049
1050 diff lines looking like headers
1050 diff lines looking like headers
1051
1051
1052 $ hg init difflineslikeheaders
1052 $ hg init difflineslikeheaders
1053 $ cd difflineslikeheaders
1053 $ cd difflineslikeheaders
1054 $ echo a >a
1054 $ echo a >a
1055 $ echo b >b
1055 $ echo b >b
1056 $ echo c >c
1056 $ echo c >c
1057 $ hg ci -Am1
1057 $ hg ci -Am1
1058 adding a
1058 adding a
1059 adding b
1059 adding b
1060 adding c
1060 adding c
1061
1061
1062 $ echo "key: value" >>a
1062 $ echo "key: value" >>a
1063 $ echo "key: value" >>b
1063 $ echo "key: value" >>b
1064 $ echo "foo" >>c
1064 $ echo "foo" >>c
1065 $ hg ci -m2
1065 $ hg ci -m2
1066
1066
1067 $ hg up -C 0
1067 $ hg up -C 0
1068 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
1068 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
1069 $ hg diff --git -c1 >want
1069 $ hg diff --git -c1 >want
1070 $ hg diff -c1 | hg import --no-commit -
1070 $ hg diff -c1 | hg import --no-commit -
1071 applying patch from stdin
1071 applying patch from stdin
1072 $ hg diff --git >have
1072 $ hg diff --git >have
1073 $ diff want have
1073 $ diff want have
1074 $ cd ..
1074 $ cd ..
1075
1075
1076 import a unified diff with no lines of context (diff -U0)
1076 import a unified diff with no lines of context (diff -U0)
1077
1077
1078 $ hg init diffzero
1078 $ hg init diffzero
1079 $ cd diffzero
1079 $ cd diffzero
1080 $ cat > f << EOF
1080 $ cat > f << EOF
1081 > c2
1081 > c2
1082 > c4
1082 > c4
1083 > c5
1083 > c5
1084 > EOF
1084 > EOF
1085 $ hg commit -Am0
1085 $ hg commit -Am0
1086 adding f
1086 adding f
1087
1087
1088 $ hg import --no-commit - << EOF
1088 $ hg import --no-commit - << EOF
1089 > # HG changeset patch
1089 > # HG changeset patch
1090 > # User test
1090 > # User test
1091 > # Date 0 0
1091 > # Date 0 0
1092 > # Node ID f4974ab632f3dee767567b0576c0ec9a4508575c
1092 > # Node ID f4974ab632f3dee767567b0576c0ec9a4508575c
1093 > # Parent 8679a12a975b819fae5f7ad3853a2886d143d794
1093 > # Parent 8679a12a975b819fae5f7ad3853a2886d143d794
1094 > 1
1094 > 1
1095 > diff -r 8679a12a975b -r f4974ab632f3 f
1095 > diff -r 8679a12a975b -r f4974ab632f3 f
1096 > --- a/f Thu Jan 01 00:00:00 1970 +0000
1096 > --- a/f Thu Jan 01 00:00:00 1970 +0000
1097 > +++ b/f Thu Jan 01 00:00:00 1970 +0000
1097 > +++ b/f Thu Jan 01 00:00:00 1970 +0000
1098 > @@ -0,0 +1,1 @@
1098 > @@ -0,0 +1,1 @@
1099 > +c1
1099 > +c1
1100 > @@ -1,0 +3,1 @@
1100 > @@ -1,0 +3,1 @@
1101 > +c3
1101 > +c3
1102 > @@ -3,1 +4,0 @@
1102 > @@ -3,1 +4,0 @@
1103 > -c5
1103 > -c5
1104 > EOF
1104 > EOF
1105 applying patch from stdin
1105 applying patch from stdin
1106
1106
1107 $ cat f
1107 $ cat f
1108 c1
1108 c1
1109 c2
1109 c2
1110 c3
1110 c3
1111 c4
1111 c4
1112
1112
1113 $ cd ..
1113 $ cd ..
1114
1114
1115 no segfault while importing a unified diff which start line is zero but chunk
1115 no segfault while importing a unified diff which start line is zero but chunk
1116 size is non-zero
1116 size is non-zero
1117
1117
1118 $ hg init startlinezero
1118 $ hg init startlinezero
1119 $ cd startlinezero
1119 $ cd startlinezero
1120 $ echo foo > foo
1120 $ echo foo > foo
1121 $ hg commit -Amfoo
1121 $ hg commit -Amfoo
1122 adding foo
1122 adding foo
1123
1123
1124 $ hg import --no-commit - << EOF
1124 $ hg import --no-commit - << EOF
1125 > diff a/foo b/foo
1125 > diff a/foo b/foo
1126 > --- a/foo
1126 > --- a/foo
1127 > +++ b/foo
1127 > +++ b/foo
1128 > @@ -0,1 +0,1 @@
1128 > @@ -0,1 +0,1 @@
1129 > foo
1129 > foo
1130 > EOF
1130 > EOF
1131 applying patch from stdin
1131 applying patch from stdin
1132
1132
1133 $ cd ..
1133 $ cd ..
1134
1134
1135 Test corner case involving fuzz and skew
1135 Test corner case involving fuzz and skew
1136
1136
1137 $ hg init morecornercases
1137 $ hg init morecornercases
1138 $ cd morecornercases
1138 $ cd morecornercases
1139
1139
1140 $ cat > 01-no-context-beginning-of-file.diff <<EOF
1140 $ cat > 01-no-context-beginning-of-file.diff <<EOF
1141 > diff --git a/a b/a
1141 > diff --git a/a b/a
1142 > --- a/a
1142 > --- a/a
1143 > +++ b/a
1143 > +++ b/a
1144 > @@ -1,0 +1,1 @@
1144 > @@ -1,0 +1,1 @@
1145 > +line
1145 > +line
1146 > EOF
1146 > EOF
1147
1147
1148 $ cat > 02-no-context-middle-of-file.diff <<EOF
1148 $ cat > 02-no-context-middle-of-file.diff <<EOF
1149 > diff --git a/a b/a
1149 > diff --git a/a b/a
1150 > --- a/a
1150 > --- a/a
1151 > +++ b/a
1151 > +++ b/a
1152 > @@ -1,1 +1,1 @@
1152 > @@ -1,1 +1,1 @@
1153 > -2
1153 > -2
1154 > +add some skew
1154 > +add some skew
1155 > @@ -2,0 +2,1 @@
1155 > @@ -2,0 +2,1 @@
1156 > +line
1156 > +line
1157 > EOF
1157 > EOF
1158
1158
1159 $ cat > 03-no-context-end-of-file.diff <<EOF
1159 $ cat > 03-no-context-end-of-file.diff <<EOF
1160 > diff --git a/a b/a
1160 > diff --git a/a b/a
1161 > --- a/a
1161 > --- a/a
1162 > +++ b/a
1162 > +++ b/a
1163 > @@ -10,0 +10,1 @@
1163 > @@ -10,0 +10,1 @@
1164 > +line
1164 > +line
1165 > EOF
1165 > EOF
1166
1166
1167 $ cat > 04-middle-of-file-completely-fuzzed.diff <<EOF
1167 $ cat > 04-middle-of-file-completely-fuzzed.diff <<EOF
1168 > diff --git a/a b/a
1168 > diff --git a/a b/a
1169 > --- a/a
1169 > --- a/a
1170 > +++ b/a
1170 > +++ b/a
1171 > @@ -1,1 +1,1 @@
1171 > @@ -1,1 +1,1 @@
1172 > -2
1172 > -2
1173 > +add some skew
1173 > +add some skew
1174 > @@ -2,2 +2,3 @@
1174 > @@ -2,2 +2,3 @@
1175 > not matching, should fuzz
1175 > not matching, should fuzz
1176 > ... a bit
1176 > ... a bit
1177 > +line
1177 > +line
1178 > EOF
1178 > EOF
1179
1179
1180 $ cat > a <<EOF
1180 $ cat > a <<EOF
1181 > 1
1181 > 1
1182 > 2
1182 > 2
1183 > 3
1183 > 3
1184 > 4
1184 > 4
1185 > EOF
1185 > EOF
1186 $ hg ci -Am adda a
1186 $ hg ci -Am adda a
1187 $ for p in *.diff; do
1187 $ for p in *.diff; do
1188 > hg import -v --no-commit $p
1188 > hg import -v --no-commit $p
1189 > cat a
1189 > cat a
1190 > hg revert -aqC a
1190 > hg revert -aqC a
1191 > # patch -p1 < $p
1191 > # patch -p1 < $p
1192 > # cat a
1192 > # cat a
1193 > # hg revert -aC a
1193 > # hg revert -aC a
1194 > done
1194 > done
1195 applying 01-no-context-beginning-of-file.diff
1195 applying 01-no-context-beginning-of-file.diff
1196 patching file a
1196 patching file a
1197 applied to working directory
1197 applied to working directory
1198 1
1198 1
1199 line
1199 line
1200 2
1200 2
1201 3
1201 3
1202 4
1202 4
1203 applying 02-no-context-middle-of-file.diff
1203 applying 02-no-context-middle-of-file.diff
1204 patching file a
1204 patching file a
1205 Hunk #1 succeeded at 2 (offset 1 lines).
1205 Hunk #1 succeeded at 2 (offset 1 lines).
1206 Hunk #2 succeeded at 4 (offset 1 lines).
1206 Hunk #2 succeeded at 4 (offset 1 lines).
1207 applied to working directory
1207 applied to working directory
1208 1
1208 1
1209 add some skew
1209 add some skew
1210 3
1210 3
1211 line
1211 line
1212 4
1212 4
1213 applying 03-no-context-end-of-file.diff
1213 applying 03-no-context-end-of-file.diff
1214 patching file a
1214 patching file a
1215 Hunk #1 succeeded at 5 (offset -6 lines).
1215 Hunk #1 succeeded at 5 (offset -6 lines).
1216 applied to working directory
1216 applied to working directory
1217 1
1217 1
1218 2
1218 2
1219 3
1219 3
1220 4
1220 4
1221 line
1221 line
1222 applying 04-middle-of-file-completely-fuzzed.diff
1222 applying 04-middle-of-file-completely-fuzzed.diff
1223 patching file a
1223 patching file a
1224 Hunk #1 succeeded at 2 (offset 1 lines).
1224 Hunk #1 succeeded at 2 (offset 1 lines).
1225 Hunk #2 succeeded at 5 with fuzz 2 (offset 1 lines).
1225 Hunk #2 succeeded at 5 with fuzz 2 (offset 1 lines).
1226 applied to working directory
1226 applied to working directory
1227 1
1227 1
1228 add some skew
1228 add some skew
1229 3
1229 3
1230 4
1230 4
1231 line
1231 line
1232 $ cd ..
1232 $ cd ..
1233
1233
1234 Test partial application
1234 Test partial application
1235 ------------------------
1235 ------------------------
1236
1236
1237 prepare a stack of patches depending on each other
1237 prepare a stack of patches depending on each other
1238
1238
1239 $ hg init partial
1239 $ hg init partial
1240 $ cd partial
1240 $ cd partial
1241 $ cat << EOF > a
1241 $ cat << EOF > a
1242 > one
1242 > one
1243 > two
1243 > two
1244 > three
1244 > three
1245 > four
1245 > four
1246 > five
1246 > five
1247 > six
1247 > six
1248 > seven
1248 > seven
1249 > EOF
1249 > EOF
1250 $ hg add a
1250 $ hg add a
1251 $ echo 'b' > b
1251 $ echo 'b' > b
1252 $ hg add b
1252 $ hg add b
1253 $ hg commit -m 'initial' -u Babar
1253 $ hg commit -m 'initial' -u Babar
1254 $ cat << EOF > a
1254 $ cat << EOF > a
1255 > one
1255 > one
1256 > two
1256 > two
1257 > 3
1257 > 3
1258 > four
1258 > four
1259 > five
1259 > five
1260 > six
1260 > six
1261 > seven
1261 > seven
1262 > EOF
1262 > EOF
1263 $ hg commit -m 'three' -u Celeste
1263 $ hg commit -m 'three' -u Celeste
1264 $ cat << EOF > a
1264 $ cat << EOF > a
1265 > one
1265 > one
1266 > two
1266 > two
1267 > 3
1267 > 3
1268 > 4
1268 > 4
1269 > five
1269 > five
1270 > six
1270 > six
1271 > seven
1271 > seven
1272 > EOF
1272 > EOF
1273 $ hg commit -m 'four' -u Rataxes
1273 $ hg commit -m 'four' -u Rataxes
1274 $ cat << EOF > a
1274 $ cat << EOF > a
1275 > one
1275 > one
1276 > two
1276 > two
1277 > 3
1277 > 3
1278 > 4
1278 > 4
1279 > 5
1279 > 5
1280 > six
1280 > six
1281 > seven
1281 > seven
1282 > EOF
1282 > EOF
1283 $ echo bb >> b
1283 $ echo bb >> b
1284 $ hg commit -m 'five' -u Arthur
1284 $ hg commit -m 'five' -u Arthur
1285 $ echo 'Babar' > jungle
1285 $ echo 'Babar' > jungle
1286 $ hg add jungle
1286 $ hg add jungle
1287 $ hg ci -m 'jungle' -u Zephir
1287 $ hg ci -m 'jungle' -u Zephir
1288 $ echo 'Celeste' >> jungle
1288 $ echo 'Celeste' >> jungle
1289 $ hg ci -m 'extended jungle' -u Cornelius
1289 $ hg ci -m 'extended jungle' -u Cornelius
1290 $ hg log -G --template '{desc|firstline} [{author}] {diffstat}\n'
1290 $ hg log -G --template '{desc|firstline} [{author}] {diffstat}\n'
1291 @ extended jungle [Cornelius] 1: +1/-0
1291 @ extended jungle [Cornelius] 1: +1/-0
1292 |
1292 |
1293 o jungle [Zephir] 1: +1/-0
1293 o jungle [Zephir] 1: +1/-0
1294 |
1294 |
1295 o five [Arthur] 2: +2/-1
1295 o five [Arthur] 2: +2/-1
1296 |
1296 |
1297 o four [Rataxes] 1: +1/-1
1297 o four [Rataxes] 1: +1/-1
1298 |
1298 |
1299 o three [Celeste] 1: +1/-1
1299 o three [Celeste] 1: +1/-1
1300 |
1300 |
1301 o initial [Babar] 2: +8/-0
1301 o initial [Babar] 2: +8/-0
1302
1302
1303
1303
1304 Importing with some success and some errors:
1304 Importing with some success and some errors:
1305
1305
1306 $ hg update --rev 'desc(initial)'
1306 $ hg update --rev 'desc(initial)'
1307 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
1307 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
1308 $ hg export --rev 'desc(five)' | hg import --partial -
1308 $ hg export --rev 'desc(five)' | hg import --partial -
1309 applying patch from stdin
1309 applying patch from stdin
1310 patching file a
1310 patching file a
1311 Hunk #1 FAILED at 1
1311 Hunk #1 FAILED at 1
1312 1 out of 1 hunks FAILED -- saving rejects to file a.rej
1312 1 out of 1 hunks FAILED -- saving rejects to file a.rej
1313 patch applied partially
1313 patch applied partially
1314 (fix the .rej files and run `hg commit --amend`)
1314 (fix the .rej files and run `hg commit --amend`)
1315 [1]
1315 [1]
1316
1316
1317 $ hg log -G --template '{desc|firstline} [{author}] {diffstat}\n'
1317 $ hg log -G --template '{desc|firstline} [{author}] {diffstat}\n'
1318 @ five [Arthur] 1: +1/-0
1318 @ five [Arthur] 1: +1/-0
1319 |
1319 |
1320 | o extended jungle [Cornelius] 1: +1/-0
1320 | o extended jungle [Cornelius] 1: +1/-0
1321 | |
1321 | |
1322 | o jungle [Zephir] 1: +1/-0
1322 | o jungle [Zephir] 1: +1/-0
1323 | |
1323 | |
1324 | o five [Arthur] 2: +2/-1
1324 | o five [Arthur] 2: +2/-1
1325 | |
1325 | |
1326 | o four [Rataxes] 1: +1/-1
1326 | o four [Rataxes] 1: +1/-1
1327 | |
1327 | |
1328 | o three [Celeste] 1: +1/-1
1328 | o three [Celeste] 1: +1/-1
1329 |/
1329 |/
1330 o initial [Babar] 2: +8/-0
1330 o initial [Babar] 2: +8/-0
1331
1331
1332 $ hg export
1332 $ hg export
1333 # HG changeset patch
1333 # HG changeset patch
1334 # User Arthur
1334 # User Arthur
1335 # Date 0 0
1335 # Date 0 0
1336 # Thu Jan 01 00:00:00 1970 +0000
1336 # Thu Jan 01 00:00:00 1970 +0000
1337 # Node ID 26e6446bb2526e2be1037935f5fca2b2706f1509
1337 # Node ID 26e6446bb2526e2be1037935f5fca2b2706f1509
1338 # Parent 8e4f0351909eae6b9cf68c2c076cb54c42b54b2e
1338 # Parent 8e4f0351909eae6b9cf68c2c076cb54c42b54b2e
1339 five
1339 five
1340
1340
1341 diff -r 8e4f0351909e -r 26e6446bb252 b
1341 diff -r 8e4f0351909e -r 26e6446bb252 b
1342 --- a/b Thu Jan 01 00:00:00 1970 +0000
1342 --- a/b Thu Jan 01 00:00:00 1970 +0000
1343 +++ b/b Thu Jan 01 00:00:00 1970 +0000
1343 +++ b/b Thu Jan 01 00:00:00 1970 +0000
1344 @@ -1,1 +1,2 @@
1344 @@ -1,1 +1,2 @@
1345 b
1345 b
1346 +bb
1346 +bb
1347 $ hg status -c .
1347 $ hg status -c .
1348 C a
1348 C a
1349 C b
1349 C b
1350 $ ls
1350 $ ls
1351 a
1351 a
1352 a.rej
1352 a.rej
1353 b
1353 b
1354
1354
1355 Importing with zero success:
1355 Importing with zero success:
1356
1356
1357 $ hg update --rev 'desc(initial)'
1357 $ hg update --rev 'desc(initial)'
1358 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1358 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1359 $ hg export --rev 'desc(four)' | hg import --partial -
1359 $ hg export --rev 'desc(four)' | hg import --partial -
1360 applying patch from stdin
1360 applying patch from stdin
1361 patching file a
1361 patching file a
1362 Hunk #1 FAILED at 0
1362 Hunk #1 FAILED at 0
1363 1 out of 1 hunks FAILED -- saving rejects to file a.rej
1363 1 out of 1 hunks FAILED -- saving rejects to file a.rej
1364 patch applied partially
1364 patch applied partially
1365 (fix the .rej files and run `hg commit --amend`)
1365 (fix the .rej files and run `hg commit --amend`)
1366 [1]
1366 [1]
1367
1367
1368 $ hg log -G --template '{desc|firstline} [{author}] {diffstat}\n'
1368 $ hg log -G --template '{desc|firstline} [{author}] {diffstat}\n'
1369 @ four [Rataxes] 0: +0/-0
1369 @ four [Rataxes] 0: +0/-0
1370 |
1370 |
1371 | o five [Arthur] 1: +1/-0
1371 | o five [Arthur] 1: +1/-0
1372 |/
1372 |/
1373 | o extended jungle [Cornelius] 1: +1/-0
1373 | o extended jungle [Cornelius] 1: +1/-0
1374 | |
1374 | |
1375 | o jungle [Zephir] 1: +1/-0
1375 | o jungle [Zephir] 1: +1/-0
1376 | |
1376 | |
1377 | o five [Arthur] 2: +2/-1
1377 | o five [Arthur] 2: +2/-1
1378 | |
1378 | |
1379 | o four [Rataxes] 1: +1/-1
1379 | o four [Rataxes] 1: +1/-1
1380 | |
1380 | |
1381 | o three [Celeste] 1: +1/-1
1381 | o three [Celeste] 1: +1/-1
1382 |/
1382 |/
1383 o initial [Babar] 2: +8/-0
1383 o initial [Babar] 2: +8/-0
1384
1384
1385 $ hg export
1385 $ hg export
1386 # HG changeset patch
1386 # HG changeset patch
1387 # User Rataxes
1387 # User Rataxes
1388 # Date 0 0
1388 # Date 0 0
1389 # Thu Jan 01 00:00:00 1970 +0000
1389 # Thu Jan 01 00:00:00 1970 +0000
1390 # Node ID cb9b1847a74d9ad52e93becaf14b98dbcc274e1e
1390 # Node ID cb9b1847a74d9ad52e93becaf14b98dbcc274e1e
1391 # Parent 8e4f0351909eae6b9cf68c2c076cb54c42b54b2e
1391 # Parent 8e4f0351909eae6b9cf68c2c076cb54c42b54b2e
1392 four
1392 four
1393
1393
1394 $ hg status -c .
1394 $ hg status -c .
1395 C a
1395 C a
1396 C b
1396 C b
1397 $ ls
1397 $ ls
1398 a
1398 a
1399 a.rej
1399 a.rej
1400 b
1400 b
1401
1401
1402 Importing with unknown file:
1402 Importing with unknown file:
1403
1403
1404 $ hg update --rev 'desc(initial)'
1404 $ hg update --rev 'desc(initial)'
1405 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1405 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1406 $ hg export --rev 'desc("extended jungle")' | hg import --partial -
1406 $ hg export --rev 'desc("extended jungle")' | hg import --partial -
1407 applying patch from stdin
1407 applying patch from stdin
1408 unable to find 'jungle' for patching
1408 unable to find 'jungle' for patching
1409 1 out of 1 hunks FAILED -- saving rejects to file jungle.rej
1409 1 out of 1 hunks FAILED -- saving rejects to file jungle.rej
1410 patch applied partially
1410 patch applied partially
1411 (fix the .rej files and run `hg commit --amend`)
1411 (fix the .rej files and run `hg commit --amend`)
1412 [1]
1412 [1]
1413
1413
1414 $ hg log -G --template '{desc|firstline} [{author}] {diffstat}\n'
1414 $ hg log -G --template '{desc|firstline} [{author}] {diffstat}\n'
1415 @ extended jungle [Cornelius] 0: +0/-0
1415 @ extended jungle [Cornelius] 0: +0/-0
1416 |
1416 |
1417 | o four [Rataxes] 0: +0/-0
1417 | o four [Rataxes] 0: +0/-0
1418 |/
1418 |/
1419 | o five [Arthur] 1: +1/-0
1419 | o five [Arthur] 1: +1/-0
1420 |/
1420 |/
1421 | o extended jungle [Cornelius] 1: +1/-0
1421 | o extended jungle [Cornelius] 1: +1/-0
1422 | |
1422 | |
1423 | o jungle [Zephir] 1: +1/-0
1423 | o jungle [Zephir] 1: +1/-0
1424 | |
1424 | |
1425 | o five [Arthur] 2: +2/-1
1425 | o five [Arthur] 2: +2/-1
1426 | |
1426 | |
1427 | o four [Rataxes] 1: +1/-1
1427 | o four [Rataxes] 1: +1/-1
1428 | |
1428 | |
1429 | o three [Celeste] 1: +1/-1
1429 | o three [Celeste] 1: +1/-1
1430 |/
1430 |/
1431 o initial [Babar] 2: +8/-0
1431 o initial [Babar] 2: +8/-0
1432
1432
1433 $ hg export
1433 $ hg export
1434 # HG changeset patch
1434 # HG changeset patch
1435 # User Cornelius
1435 # User Cornelius
1436 # Date 0 0
1436 # Date 0 0
1437 # Thu Jan 01 00:00:00 1970 +0000
1437 # Thu Jan 01 00:00:00 1970 +0000
1438 # Node ID 1fb1f86bef43c5a75918178f8d23c29fb0a7398d
1438 # Node ID 1fb1f86bef43c5a75918178f8d23c29fb0a7398d
1439 # Parent 8e4f0351909eae6b9cf68c2c076cb54c42b54b2e
1439 # Parent 8e4f0351909eae6b9cf68c2c076cb54c42b54b2e
1440 extended jungle
1440 extended jungle
1441
1441
1442 $ hg status -c .
1442 $ hg status -c .
1443 C a
1443 C a
1444 C b
1444 C b
1445 $ ls
1445 $ ls
1446 a
1446 a
1447 a.rej
1447 a.rej
1448 b
1448 b
1449 jungle.rej
1449 jungle.rej
1450
1450
1451 Importing multiple failing patches:
1451 Importing multiple failing patches:
1452
1452
1453 $ hg update --rev 'desc(initial)'
1453 $ hg update --rev 'desc(initial)'
1454 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1454 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1455 $ echo 'B' > b # just to make another commit
1455 $ echo 'B' > b # just to make another commit
1456 $ hg commit -m "a new base"
1456 $ hg commit -m "a new base"
1457 created new head
1457 created new head
1458 $ hg export --rev 'desc("four") + desc("extended jungle")' | hg import --partial -
1458 $ hg export --rev 'desc("four") + desc("extended jungle")' | hg import --partial -
1459 applying patch from stdin
1459 applying patch from stdin
1460 patching file a
1460 patching file a
1461 Hunk #1 FAILED at 0
1461 Hunk #1 FAILED at 0
1462 1 out of 1 hunks FAILED -- saving rejects to file a.rej
1462 1 out of 1 hunks FAILED -- saving rejects to file a.rej
1463 patch applied partially
1463 patch applied partially
1464 (fix the .rej files and run `hg commit --amend`)
1464 (fix the .rej files and run `hg commit --amend`)
1465 [1]
1465 [1]
1466 $ hg log -G --template '{desc|firstline} [{author}] {diffstat}\n'
1466 $ hg log -G --template '{desc|firstline} [{author}] {diffstat}\n'
1467 @ four [Rataxes] 0: +0/-0
1467 @ four [Rataxes] 0: +0/-0
1468 |
1468 |
1469 o a new base [test] 1: +1/-1
1469 o a new base [test] 1: +1/-1
1470 |
1470 |
1471 | o extended jungle [Cornelius] 0: +0/-0
1471 | o extended jungle [Cornelius] 0: +0/-0
1472 |/
1472 |/
1473 | o four [Rataxes] 0: +0/-0
1473 | o four [Rataxes] 0: +0/-0
1474 |/
1474 |/
1475 | o five [Arthur] 1: +1/-0
1475 | o five [Arthur] 1: +1/-0
1476 |/
1476 |/
1477 | o extended jungle [Cornelius] 1: +1/-0
1477 | o extended jungle [Cornelius] 1: +1/-0
1478 | |
1478 | |
1479 | o jungle [Zephir] 1: +1/-0
1479 | o jungle [Zephir] 1: +1/-0
1480 | |
1480 | |
1481 | o five [Arthur] 2: +2/-1
1481 | o five [Arthur] 2: +2/-1
1482 | |
1482 | |
1483 | o four [Rataxes] 1: +1/-1
1483 | o four [Rataxes] 1: +1/-1
1484 | |
1484 | |
1485 | o three [Celeste] 1: +1/-1
1485 | o three [Celeste] 1: +1/-1
1486 |/
1486 |/
1487 o initial [Babar] 2: +8/-0
1487 o initial [Babar] 2: +8/-0
1488
1488
1489 $ hg export
1489 $ hg export
1490 # HG changeset patch
1490 # HG changeset patch
1491 # User Rataxes
1491 # User Rataxes
1492 # Date 0 0
1492 # Date 0 0
1493 # Thu Jan 01 00:00:00 1970 +0000
1493 # Thu Jan 01 00:00:00 1970 +0000
1494 # Node ID a9d7b6d0ffbb4eb12b7d5939250fcd42e8930a1d
1494 # Node ID a9d7b6d0ffbb4eb12b7d5939250fcd42e8930a1d
1495 # Parent f59f8d2e95a8ca5b1b4ca64320140da85f3b44fd
1495 # Parent f59f8d2e95a8ca5b1b4ca64320140da85f3b44fd
1496 four
1496 four
1497
1497
1498 $ hg status -c .
1498 $ hg status -c .
1499 C a
1499 C a
1500 C b
1500 C b
General Comments 0
You need to be logged in to leave comments. Login now