##// END OF EJS Templates
test-import.t: use proper revset order...
Pierre-Yves David -
r22858:d7cedb32 default
parent child Browse files
Show More
@@ -1,1473 +1,1473 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 a
414 a
415 created 1d4bd90af0e4
415 created 1d4bd90af0e4
416 applying ../patch2
416 applying ../patch2
417 patching file a
417 patching file a
418 a
418 a
419 created 6d019af21222
419 created 6d019af21222
420 $ hg --cwd b rollback
420 $ hg --cwd b rollback
421 repository tip rolled back to revision 0 (undo import)
421 repository tip rolled back to revision 0 (undo import)
422 working directory now based on revision 0
422 working directory now based on revision 0
423 $ hg --cwd b parents --template 'parent: {rev}\n'
423 $ hg --cwd b parents --template 'parent: {rev}\n'
424 parent: 0
424 parent: 0
425 $ rm -r b
425 $ rm -r b
426
426
427
427
428 importing a patch in a subdirectory failed at the commit stage
428 importing a patch in a subdirectory failed at the commit stage
429
429
430 $ echo line 2 >> a/d1/d2/a
430 $ echo line 2 >> a/d1/d2/a
431 $ hg --cwd a ci -u someoneelse -d '1 0' -m'subdir change'
431 $ hg --cwd a ci -u someoneelse -d '1 0' -m'subdir change'
432
432
433 hg import in a subdirectory
433 hg import in a subdirectory
434
434
435 $ hg clone -r0 a b
435 $ hg clone -r0 a b
436 adding changesets
436 adding changesets
437 adding manifests
437 adding manifests
438 adding file changes
438 adding file changes
439 added 1 changesets with 2 changes to 2 files
439 added 1 changesets with 2 changes to 2 files
440 updating to branch default
440 updating to branch default
441 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
441 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
442 $ hg --cwd a export tip > tmp
442 $ hg --cwd a export tip > tmp
443 $ sed -e 's/d1\/d2\///' < tmp > subdir-tip.patch
443 $ sed -e 's/d1\/d2\///' < tmp > subdir-tip.patch
444 $ dir=`pwd`
444 $ dir=`pwd`
445 $ cd b/d1/d2 2>&1 > /dev/null
445 $ cd b/d1/d2 2>&1 > /dev/null
446 $ hg import ../../../subdir-tip.patch
446 $ hg import ../../../subdir-tip.patch
447 applying ../../../subdir-tip.patch
447 applying ../../../subdir-tip.patch
448 $ cd "$dir"
448 $ cd "$dir"
449
449
450 message should be 'subdir change'
450 message should be 'subdir change'
451 committer should be 'someoneelse'
451 committer should be 'someoneelse'
452
452
453 $ hg --cwd b tip
453 $ hg --cwd b tip
454 changeset: 1:3577f5aea227
454 changeset: 1:3577f5aea227
455 tag: tip
455 tag: tip
456 user: someoneelse
456 user: someoneelse
457 date: Thu Jan 01 00:00:01 1970 +0000
457 date: Thu Jan 01 00:00:01 1970 +0000
458 summary: subdir change
458 summary: subdir change
459
459
460
460
461 should be empty
461 should be empty
462
462
463 $ hg --cwd b status
463 $ hg --cwd b status
464
464
465
465
466 Test fuzziness (ambiguous patch location, fuzz=2)
466 Test fuzziness (ambiguous patch location, fuzz=2)
467
467
468 $ hg init fuzzy
468 $ hg init fuzzy
469 $ cd fuzzy
469 $ cd fuzzy
470 $ echo line1 > a
470 $ echo line1 > a
471 $ echo line0 >> a
471 $ echo line0 >> a
472 $ echo line3 >> a
472 $ echo line3 >> a
473 $ hg ci -Am adda
473 $ hg ci -Am adda
474 adding a
474 adding a
475 $ echo line1 > a
475 $ echo line1 > a
476 $ echo line2 >> a
476 $ echo line2 >> a
477 $ echo line0 >> a
477 $ echo line0 >> a
478 $ echo line3 >> a
478 $ echo line3 >> a
479 $ hg ci -m change a
479 $ hg ci -m change a
480 $ hg export tip > fuzzy-tip.patch
480 $ hg export tip > fuzzy-tip.patch
481 $ hg up -C 0
481 $ hg up -C 0
482 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
482 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
483 $ echo line1 > a
483 $ echo line1 > a
484 $ echo line0 >> a
484 $ echo line0 >> a
485 $ echo line1 >> a
485 $ echo line1 >> a
486 $ echo line0 >> a
486 $ echo line0 >> a
487 $ hg ci -m brancha
487 $ hg ci -m brancha
488 created new head
488 created new head
489 $ hg import --no-commit -v fuzzy-tip.patch
489 $ hg import --no-commit -v fuzzy-tip.patch
490 applying fuzzy-tip.patch
490 applying fuzzy-tip.patch
491 patching file a
491 patching file a
492 Hunk #1 succeeded at 2 with fuzz 1 (offset 0 lines).
492 Hunk #1 succeeded at 2 with fuzz 1 (offset 0 lines).
493 applied to working directory
493 applied to working directory
494 $ hg revert -a
494 $ hg revert -a
495 reverting a
495 reverting a
496
496
497
497
498 import with --no-commit should have written .hg/last-message.txt
498 import with --no-commit should have written .hg/last-message.txt
499
499
500 $ cat .hg/last-message.txt
500 $ cat .hg/last-message.txt
501 change (no-eol)
501 change (no-eol)
502
502
503
503
504 test fuzziness with eol=auto
504 test fuzziness with eol=auto
505
505
506 $ hg --config patch.eol=auto import --no-commit -v fuzzy-tip.patch
506 $ hg --config patch.eol=auto import --no-commit -v fuzzy-tip.patch
507 applying fuzzy-tip.patch
507 applying fuzzy-tip.patch
508 patching file a
508 patching file a
509 Hunk #1 succeeded at 2 with fuzz 1 (offset 0 lines).
509 Hunk #1 succeeded at 2 with fuzz 1 (offset 0 lines).
510 applied to working directory
510 applied to working directory
511 $ cd ..
511 $ cd ..
512
512
513
513
514 Test hunk touching empty files (issue906)
514 Test hunk touching empty files (issue906)
515
515
516 $ hg init empty
516 $ hg init empty
517 $ cd empty
517 $ cd empty
518 $ touch a
518 $ touch a
519 $ touch b1
519 $ touch b1
520 $ touch c1
520 $ touch c1
521 $ echo d > d
521 $ echo d > d
522 $ hg ci -Am init
522 $ hg ci -Am init
523 adding a
523 adding a
524 adding b1
524 adding b1
525 adding c1
525 adding c1
526 adding d
526 adding d
527 $ echo a > a
527 $ echo a > a
528 $ echo b > b1
528 $ echo b > b1
529 $ hg mv b1 b2
529 $ hg mv b1 b2
530 $ echo c > c1
530 $ echo c > c1
531 $ hg copy c1 c2
531 $ hg copy c1 c2
532 $ rm d
532 $ rm d
533 $ touch d
533 $ touch d
534 $ hg diff --git
534 $ hg diff --git
535 diff --git a/a b/a
535 diff --git a/a b/a
536 --- a/a
536 --- a/a
537 +++ b/a
537 +++ b/a
538 @@ -0,0 +1,1 @@
538 @@ -0,0 +1,1 @@
539 +a
539 +a
540 diff --git a/b1 b/b2
540 diff --git a/b1 b/b2
541 rename from b1
541 rename from b1
542 rename to b2
542 rename to b2
543 --- a/b1
543 --- a/b1
544 +++ b/b2
544 +++ b/b2
545 @@ -0,0 +1,1 @@
545 @@ -0,0 +1,1 @@
546 +b
546 +b
547 diff --git a/c1 b/c1
547 diff --git a/c1 b/c1
548 --- a/c1
548 --- a/c1
549 +++ b/c1
549 +++ b/c1
550 @@ -0,0 +1,1 @@
550 @@ -0,0 +1,1 @@
551 +c
551 +c
552 diff --git a/c1 b/c2
552 diff --git a/c1 b/c2
553 copy from c1
553 copy from c1
554 copy to c2
554 copy to c2
555 --- a/c1
555 --- a/c1
556 +++ b/c2
556 +++ b/c2
557 @@ -0,0 +1,1 @@
557 @@ -0,0 +1,1 @@
558 +c
558 +c
559 diff --git a/d b/d
559 diff --git a/d b/d
560 --- a/d
560 --- a/d
561 +++ b/d
561 +++ b/d
562 @@ -1,1 +0,0 @@
562 @@ -1,1 +0,0 @@
563 -d
563 -d
564 $ hg ci -m empty
564 $ hg ci -m empty
565 $ hg export --git tip > empty.diff
565 $ hg export --git tip > empty.diff
566 $ hg up -C 0
566 $ hg up -C 0
567 4 files updated, 0 files merged, 2 files removed, 0 files unresolved
567 4 files updated, 0 files merged, 2 files removed, 0 files unresolved
568 $ hg import empty.diff
568 $ hg import empty.diff
569 applying empty.diff
569 applying empty.diff
570 $ for name in a b1 b2 c1 c2 d; do
570 $ for name in a b1 b2 c1 c2 d; do
571 > echo % $name file
571 > echo % $name file
572 > test -f $name && cat $name
572 > test -f $name && cat $name
573 > done
573 > done
574 % a file
574 % a file
575 a
575 a
576 % b1 file
576 % b1 file
577 % b2 file
577 % b2 file
578 b
578 b
579 % c1 file
579 % c1 file
580 c
580 c
581 % c2 file
581 % c2 file
582 c
582 c
583 % d file
583 % d file
584 $ cd ..
584 $ cd ..
585
585
586
586
587 Test importing a patch ending with a binary file removal
587 Test importing a patch ending with a binary file removal
588
588
589 $ hg init binaryremoval
589 $ hg init binaryremoval
590 $ cd binaryremoval
590 $ cd binaryremoval
591 $ echo a > a
591 $ echo a > a
592 $ python -c "file('b', 'wb').write('a\x00b')"
592 $ python -c "file('b', 'wb').write('a\x00b')"
593 $ hg ci -Am addall
593 $ hg ci -Am addall
594 adding a
594 adding a
595 adding b
595 adding b
596 $ hg rm a
596 $ hg rm a
597 $ hg rm b
597 $ hg rm b
598 $ hg st
598 $ hg st
599 R a
599 R a
600 R b
600 R b
601 $ hg ci -m remove
601 $ hg ci -m remove
602 $ hg export --git . > remove.diff
602 $ hg export --git . > remove.diff
603 $ cat remove.diff | grep git
603 $ cat remove.diff | grep git
604 diff --git a/a b/a
604 diff --git a/a b/a
605 diff --git a/b b/b
605 diff --git a/b b/b
606 $ hg up -C 0
606 $ hg up -C 0
607 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
607 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
608 $ hg import remove.diff
608 $ hg import remove.diff
609 applying remove.diff
609 applying remove.diff
610 $ hg manifest
610 $ hg manifest
611 $ cd ..
611 $ cd ..
612
612
613
613
614 Issue927: test update+rename with common name
614 Issue927: test update+rename with common name
615
615
616 $ hg init t
616 $ hg init t
617 $ cd t
617 $ cd t
618 $ touch a
618 $ touch a
619 $ hg ci -Am t
619 $ hg ci -Am t
620 adding a
620 adding a
621 $ echo a > a
621 $ echo a > a
622
622
623 Here, bfile.startswith(afile)
623 Here, bfile.startswith(afile)
624
624
625 $ hg copy a a2
625 $ hg copy a a2
626 $ hg ci -m copya
626 $ hg ci -m copya
627 $ hg export --git tip > copy.diff
627 $ hg export --git tip > copy.diff
628 $ hg up -C 0
628 $ hg up -C 0
629 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
629 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
630 $ hg import copy.diff
630 $ hg import copy.diff
631 applying copy.diff
631 applying copy.diff
632
632
633 a should contain an 'a'
633 a should contain an 'a'
634
634
635 $ cat a
635 $ cat a
636 a
636 a
637
637
638 and a2 should have duplicated it
638 and a2 should have duplicated it
639
639
640 $ cat a2
640 $ cat a2
641 a
641 a
642 $ cd ..
642 $ cd ..
643
643
644
644
645 test -p0
645 test -p0
646
646
647 $ hg init p0
647 $ hg init p0
648 $ cd p0
648 $ cd p0
649 $ echo a > a
649 $ echo a > a
650 $ hg ci -Am t
650 $ hg ci -Am t
651 adding a
651 adding a
652 $ hg import -p foo
652 $ hg import -p foo
653 abort: invalid value 'foo' for option -p, expected int
653 abort: invalid value 'foo' for option -p, expected int
654 [255]
654 [255]
655 $ hg import -p0 - << EOF
655 $ hg import -p0 - << EOF
656 > foobar
656 > foobar
657 > --- a Sat Apr 12 22:43:58 2008 -0400
657 > --- a Sat Apr 12 22:43:58 2008 -0400
658 > +++ a Sat Apr 12 22:44:05 2008 -0400
658 > +++ a Sat Apr 12 22:44:05 2008 -0400
659 > @@ -1,1 +1,1 @@
659 > @@ -1,1 +1,1 @@
660 > -a
660 > -a
661 > +bb
661 > +bb
662 > EOF
662 > EOF
663 applying patch from stdin
663 applying patch from stdin
664 $ hg status
664 $ hg status
665 $ cat a
665 $ cat a
666 bb
666 bb
667 $ cd ..
667 $ cd ..
668
668
669
669
670 test paths outside repo root
670 test paths outside repo root
671
671
672 $ mkdir outside
672 $ mkdir outside
673 $ touch outside/foo
673 $ touch outside/foo
674 $ hg init inside
674 $ hg init inside
675 $ cd inside
675 $ cd inside
676 $ hg import - <<EOF
676 $ hg import - <<EOF
677 > diff --git a/a b/b
677 > diff --git a/a b/b
678 > rename from ../outside/foo
678 > rename from ../outside/foo
679 > rename to bar
679 > rename to bar
680 > EOF
680 > EOF
681 applying patch from stdin
681 applying patch from stdin
682 abort: path contains illegal component: ../outside/foo (glob)
682 abort: path contains illegal component: ../outside/foo (glob)
683 [255]
683 [255]
684 $ cd ..
684 $ cd ..
685
685
686
686
687 test import with similarity and git and strip (issue295 et al.)
687 test import with similarity and git and strip (issue295 et al.)
688
688
689 $ hg init sim
689 $ hg init sim
690 $ cd sim
690 $ cd sim
691 $ echo 'this is a test' > a
691 $ echo 'this is a test' > a
692 $ hg ci -Ama
692 $ hg ci -Ama
693 adding a
693 adding a
694 $ cat > ../rename.diff <<EOF
694 $ cat > ../rename.diff <<EOF
695 > diff --git a/foo/a b/foo/a
695 > diff --git a/foo/a b/foo/a
696 > deleted file mode 100644
696 > deleted file mode 100644
697 > --- a/foo/a
697 > --- a/foo/a
698 > +++ /dev/null
698 > +++ /dev/null
699 > @@ -1,1 +0,0 @@
699 > @@ -1,1 +0,0 @@
700 > -this is a test
700 > -this is a test
701 > diff --git a/foo/b b/foo/b
701 > diff --git a/foo/b b/foo/b
702 > new file mode 100644
702 > new file mode 100644
703 > --- /dev/null
703 > --- /dev/null
704 > +++ b/foo/b
704 > +++ b/foo/b
705 > @@ -0,0 +1,2 @@
705 > @@ -0,0 +1,2 @@
706 > +this is a test
706 > +this is a test
707 > +foo
707 > +foo
708 > EOF
708 > EOF
709 $ hg import --no-commit -v -s 1 ../rename.diff -p2
709 $ hg import --no-commit -v -s 1 ../rename.diff -p2
710 applying ../rename.diff
710 applying ../rename.diff
711 patching file a
711 patching file a
712 patching file b
712 patching file b
713 adding b
713 adding b
714 recording removal of a as rename to b (88% similar)
714 recording removal of a as rename to b (88% similar)
715 applied to working directory
715 applied to working directory
716 $ hg st -C
716 $ hg st -C
717 A b
717 A b
718 a
718 a
719 R a
719 R a
720 $ hg revert -a
720 $ hg revert -a
721 undeleting a
721 undeleting a
722 forgetting b
722 forgetting b
723 $ rm b
723 $ rm b
724 $ hg import --no-commit -v -s 100 ../rename.diff -p2
724 $ hg import --no-commit -v -s 100 ../rename.diff -p2
725 applying ../rename.diff
725 applying ../rename.diff
726 patching file a
726 patching file a
727 patching file b
727 patching file b
728 adding b
728 adding b
729 applied to working directory
729 applied to working directory
730 $ hg st -C
730 $ hg st -C
731 A b
731 A b
732 R a
732 R a
733 $ cd ..
733 $ cd ..
734
734
735
735
736 Issue1495: add empty file from the end of patch
736 Issue1495: add empty file from the end of patch
737
737
738 $ hg init addemptyend
738 $ hg init addemptyend
739 $ cd addemptyend
739 $ cd addemptyend
740 $ touch a
740 $ touch a
741 $ hg addremove
741 $ hg addremove
742 adding a
742 adding a
743 $ hg ci -m "commit"
743 $ hg ci -m "commit"
744 $ cat > a.patch <<EOF
744 $ cat > a.patch <<EOF
745 > add a, b
745 > add a, b
746 > diff --git a/a b/a
746 > diff --git a/a b/a
747 > --- a/a
747 > --- a/a
748 > +++ b/a
748 > +++ b/a
749 > @@ -0,0 +1,1 @@
749 > @@ -0,0 +1,1 @@
750 > +a
750 > +a
751 > diff --git a/b b/b
751 > diff --git a/b b/b
752 > new file mode 100644
752 > new file mode 100644
753 > EOF
753 > EOF
754 $ hg import --no-commit a.patch
754 $ hg import --no-commit a.patch
755 applying a.patch
755 applying a.patch
756
756
757 apply a good patch followed by an empty patch (mainly to ensure
757 apply a good patch followed by an empty patch (mainly to ensure
758 that dirstate is *not* updated when import crashes)
758 that dirstate is *not* updated when import crashes)
759 $ hg update -q -C .
759 $ hg update -q -C .
760 $ rm b
760 $ rm b
761 $ touch empty.patch
761 $ touch empty.patch
762 $ hg import a.patch empty.patch
762 $ hg import a.patch empty.patch
763 applying a.patch
763 applying a.patch
764 applying empty.patch
764 applying empty.patch
765 transaction abort!
765 transaction abort!
766 rollback completed
766 rollback completed
767 abort: empty.patch: no diffs found
767 abort: empty.patch: no diffs found
768 [255]
768 [255]
769 $ hg tip --template '{rev} {desc|firstline}\n'
769 $ hg tip --template '{rev} {desc|firstline}\n'
770 0 commit
770 0 commit
771 $ hg -q status
771 $ hg -q status
772 M a
772 M a
773 $ cd ..
773 $ cd ..
774
774
775 create file when source is not /dev/null
775 create file when source is not /dev/null
776
776
777 $ cat > create.patch <<EOF
777 $ cat > create.patch <<EOF
778 > diff -Naur proj-orig/foo proj-new/foo
778 > diff -Naur proj-orig/foo proj-new/foo
779 > --- proj-orig/foo 1969-12-31 16:00:00.000000000 -0800
779 > --- proj-orig/foo 1969-12-31 16:00:00.000000000 -0800
780 > +++ proj-new/foo 2009-07-17 16:50:45.801368000 -0700
780 > +++ proj-new/foo 2009-07-17 16:50:45.801368000 -0700
781 > @@ -0,0 +1,1 @@
781 > @@ -0,0 +1,1 @@
782 > +a
782 > +a
783 > EOF
783 > EOF
784
784
785 some people have patches like the following too
785 some people have patches like the following too
786
786
787 $ cat > create2.patch <<EOF
787 $ cat > create2.patch <<EOF
788 > diff -Naur proj-orig/foo proj-new/foo
788 > diff -Naur proj-orig/foo proj-new/foo
789 > --- proj-orig/foo.orig 1969-12-31 16:00:00.000000000 -0800
789 > --- proj-orig/foo.orig 1969-12-31 16:00:00.000000000 -0800
790 > +++ proj-new/foo 2009-07-17 16:50:45.801368000 -0700
790 > +++ proj-new/foo 2009-07-17 16:50:45.801368000 -0700
791 > @@ -0,0 +1,1 @@
791 > @@ -0,0 +1,1 @@
792 > +a
792 > +a
793 > EOF
793 > EOF
794 $ hg init oddcreate
794 $ hg init oddcreate
795 $ cd oddcreate
795 $ cd oddcreate
796 $ hg import --no-commit ../create.patch
796 $ hg import --no-commit ../create.patch
797 applying ../create.patch
797 applying ../create.patch
798 $ cat foo
798 $ cat foo
799 a
799 a
800 $ rm foo
800 $ rm foo
801 $ hg revert foo
801 $ hg revert foo
802 $ hg import --no-commit ../create2.patch
802 $ hg import --no-commit ../create2.patch
803 applying ../create2.patch
803 applying ../create2.patch
804 $ cat foo
804 $ cat foo
805 a
805 a
806
806
807 $ cd ..
807 $ cd ..
808
808
809 Issue1859: first line mistaken for email headers
809 Issue1859: first line mistaken for email headers
810
810
811 $ hg init emailconfusion
811 $ hg init emailconfusion
812 $ cd emailconfusion
812 $ cd emailconfusion
813 $ cat > a.patch <<EOF
813 $ cat > a.patch <<EOF
814 > module: summary
814 > module: summary
815 >
815 >
816 > description
816 > description
817 >
817 >
818 >
818 >
819 > diff -r 000000000000 -r 9b4c1e343b55 test.txt
819 > diff -r 000000000000 -r 9b4c1e343b55 test.txt
820 > --- /dev/null
820 > --- /dev/null
821 > +++ b/a
821 > +++ b/a
822 > @@ -0,0 +1,1 @@
822 > @@ -0,0 +1,1 @@
823 > +a
823 > +a
824 > EOF
824 > EOF
825 $ hg import -d '0 0' a.patch
825 $ hg import -d '0 0' a.patch
826 applying a.patch
826 applying a.patch
827 $ hg parents -v
827 $ hg parents -v
828 changeset: 0:5a681217c0ad
828 changeset: 0:5a681217c0ad
829 tag: tip
829 tag: tip
830 user: test
830 user: test
831 date: Thu Jan 01 00:00:00 1970 +0000
831 date: Thu Jan 01 00:00:00 1970 +0000
832 files: a
832 files: a
833 description:
833 description:
834 module: summary
834 module: summary
835
835
836 description
836 description
837
837
838
838
839 $ cd ..
839 $ cd ..
840
840
841
841
842 in commit message
842 in commit message
843
843
844 $ hg init commitconfusion
844 $ hg init commitconfusion
845 $ cd commitconfusion
845 $ cd commitconfusion
846 $ cat > a.patch <<EOF
846 $ cat > a.patch <<EOF
847 > module: summary
847 > module: summary
848 >
848 >
849 > --- description
849 > --- description
850 >
850 >
851 > diff --git a/a b/a
851 > diff --git a/a b/a
852 > new file mode 100644
852 > new file mode 100644
853 > --- /dev/null
853 > --- /dev/null
854 > +++ b/a
854 > +++ b/a
855 > @@ -0,0 +1,1 @@
855 > @@ -0,0 +1,1 @@
856 > +a
856 > +a
857 > EOF
857 > EOF
858 > hg import -d '0 0' a.patch
858 > hg import -d '0 0' a.patch
859 > hg parents -v
859 > hg parents -v
860 > cd ..
860 > cd ..
861 >
861 >
862 > echo '% tricky header splitting'
862 > echo '% tricky header splitting'
863 > cat > trickyheaders.patch <<EOF
863 > cat > trickyheaders.patch <<EOF
864 > From: User A <user@a>
864 > From: User A <user@a>
865 > Subject: [PATCH] from: tricky!
865 > Subject: [PATCH] from: tricky!
866 >
866 >
867 > # HG changeset patch
867 > # HG changeset patch
868 > # User User B
868 > # User User B
869 > # Date 1266264441 18000
869 > # Date 1266264441 18000
870 > # Branch stable
870 > # Branch stable
871 > # Node ID f2be6a1170ac83bf31cb4ae0bad00d7678115bc0
871 > # Node ID f2be6a1170ac83bf31cb4ae0bad00d7678115bc0
872 > # Parent 0000000000000000000000000000000000000000
872 > # Parent 0000000000000000000000000000000000000000
873 > from: tricky!
873 > from: tricky!
874 >
874 >
875 > That is not a header.
875 > That is not a header.
876 >
876 >
877 > diff -r 000000000000 -r f2be6a1170ac foo
877 > diff -r 000000000000 -r f2be6a1170ac foo
878 > --- /dev/null
878 > --- /dev/null
879 > +++ b/foo
879 > +++ b/foo
880 > @@ -0,0 +1,1 @@
880 > @@ -0,0 +1,1 @@
881 > +foo
881 > +foo
882 > EOF
882 > EOF
883 applying a.patch
883 applying a.patch
884 changeset: 0:f34d9187897d
884 changeset: 0:f34d9187897d
885 tag: tip
885 tag: tip
886 user: test
886 user: test
887 date: Thu Jan 01 00:00:00 1970 +0000
887 date: Thu Jan 01 00:00:00 1970 +0000
888 files: a
888 files: a
889 description:
889 description:
890 module: summary
890 module: summary
891
891
892
892
893 % tricky header splitting
893 % tricky header splitting
894
894
895 $ hg init trickyheaders
895 $ hg init trickyheaders
896 $ cd trickyheaders
896 $ cd trickyheaders
897 $ hg import -d '0 0' ../trickyheaders.patch
897 $ hg import -d '0 0' ../trickyheaders.patch
898 applying ../trickyheaders.patch
898 applying ../trickyheaders.patch
899 $ hg export --git tip
899 $ hg export --git tip
900 # HG changeset patch
900 # HG changeset patch
901 # User User B
901 # User User B
902 # Date 0 0
902 # Date 0 0
903 # Thu Jan 01 00:00:00 1970 +0000
903 # Thu Jan 01 00:00:00 1970 +0000
904 # Node ID eb56ab91903632294ac504838508cb370c0901d2
904 # Node ID eb56ab91903632294ac504838508cb370c0901d2
905 # Parent 0000000000000000000000000000000000000000
905 # Parent 0000000000000000000000000000000000000000
906 from: tricky!
906 from: tricky!
907
907
908 That is not a header.
908 That is not a header.
909
909
910 diff --git a/foo b/foo
910 diff --git a/foo b/foo
911 new file mode 100644
911 new file mode 100644
912 --- /dev/null
912 --- /dev/null
913 +++ b/foo
913 +++ b/foo
914 @@ -0,0 +1,1 @@
914 @@ -0,0 +1,1 @@
915 +foo
915 +foo
916 $ cd ..
916 $ cd ..
917
917
918
918
919 Issue2102: hg export and hg import speak different languages
919 Issue2102: hg export and hg import speak different languages
920
920
921 $ hg init issue2102
921 $ hg init issue2102
922 $ cd issue2102
922 $ cd issue2102
923 $ mkdir -p src/cmd/gc
923 $ mkdir -p src/cmd/gc
924 $ touch src/cmd/gc/mksys.bash
924 $ touch src/cmd/gc/mksys.bash
925 $ hg ci -Am init
925 $ hg ci -Am init
926 adding src/cmd/gc/mksys.bash
926 adding src/cmd/gc/mksys.bash
927 $ hg import - <<EOF
927 $ hg import - <<EOF
928 > # HG changeset patch
928 > # HG changeset patch
929 > # User Rob Pike
929 > # User Rob Pike
930 > # Date 1216685449 25200
930 > # Date 1216685449 25200
931 > # Node ID 03aa2b206f499ad6eb50e6e207b9e710d6409c98
931 > # Node ID 03aa2b206f499ad6eb50e6e207b9e710d6409c98
932 > # Parent 93d10138ad8df586827ca90b4ddb5033e21a3a84
932 > # Parent 93d10138ad8df586827ca90b4ddb5033e21a3a84
933 > help management of empty pkg and lib directories in perforce
933 > help management of empty pkg and lib directories in perforce
934 >
934 >
935 > R=gri
935 > R=gri
936 > DELTA=4 (4 added, 0 deleted, 0 changed)
936 > DELTA=4 (4 added, 0 deleted, 0 changed)
937 > OCL=13328
937 > OCL=13328
938 > CL=13328
938 > CL=13328
939 >
939 >
940 > diff --git a/lib/place-holder b/lib/place-holder
940 > diff --git a/lib/place-holder b/lib/place-holder
941 > new file mode 100644
941 > new file mode 100644
942 > --- /dev/null
942 > --- /dev/null
943 > +++ b/lib/place-holder
943 > +++ b/lib/place-holder
944 > @@ -0,0 +1,2 @@
944 > @@ -0,0 +1,2 @@
945 > +perforce does not maintain empty directories.
945 > +perforce does not maintain empty directories.
946 > +this file helps.
946 > +this file helps.
947 > diff --git a/pkg/place-holder b/pkg/place-holder
947 > diff --git a/pkg/place-holder b/pkg/place-holder
948 > new file mode 100644
948 > new file mode 100644
949 > --- /dev/null
949 > --- /dev/null
950 > +++ b/pkg/place-holder
950 > +++ b/pkg/place-holder
951 > @@ -0,0 +1,2 @@
951 > @@ -0,0 +1,2 @@
952 > +perforce does not maintain empty directories.
952 > +perforce does not maintain empty directories.
953 > +this file helps.
953 > +this file helps.
954 > diff --git a/src/cmd/gc/mksys.bash b/src/cmd/gc/mksys.bash
954 > diff --git a/src/cmd/gc/mksys.bash b/src/cmd/gc/mksys.bash
955 > old mode 100644
955 > old mode 100644
956 > new mode 100755
956 > new mode 100755
957 > EOF
957 > EOF
958 applying patch from stdin
958 applying patch from stdin
959
959
960 #if execbit
960 #if execbit
961
961
962 $ hg sum
962 $ hg sum
963 parent: 1:d59915696727 tip
963 parent: 1:d59915696727 tip
964 help management of empty pkg and lib directories in perforce
964 help management of empty pkg and lib directories in perforce
965 branch: default
965 branch: default
966 commit: (clean)
966 commit: (clean)
967 update: (current)
967 update: (current)
968
968
969 $ hg diff --git -c tip
969 $ hg diff --git -c tip
970 diff --git a/lib/place-holder b/lib/place-holder
970 diff --git a/lib/place-holder b/lib/place-holder
971 new file mode 100644
971 new file mode 100644
972 --- /dev/null
972 --- /dev/null
973 +++ b/lib/place-holder
973 +++ b/lib/place-holder
974 @@ -0,0 +1,2 @@
974 @@ -0,0 +1,2 @@
975 +perforce does not maintain empty directories.
975 +perforce does not maintain empty directories.
976 +this file helps.
976 +this file helps.
977 diff --git a/pkg/place-holder b/pkg/place-holder
977 diff --git a/pkg/place-holder b/pkg/place-holder
978 new file mode 100644
978 new file mode 100644
979 --- /dev/null
979 --- /dev/null
980 +++ b/pkg/place-holder
980 +++ b/pkg/place-holder
981 @@ -0,0 +1,2 @@
981 @@ -0,0 +1,2 @@
982 +perforce does not maintain empty directories.
982 +perforce does not maintain empty directories.
983 +this file helps.
983 +this file helps.
984 diff --git a/src/cmd/gc/mksys.bash b/src/cmd/gc/mksys.bash
984 diff --git a/src/cmd/gc/mksys.bash b/src/cmd/gc/mksys.bash
985 old mode 100644
985 old mode 100644
986 new mode 100755
986 new mode 100755
987
987
988 #else
988 #else
989
989
990 $ hg sum
990 $ hg sum
991 parent: 1:28f089cc9ccc tip
991 parent: 1:28f089cc9ccc tip
992 help management of empty pkg and lib directories in perforce
992 help management of empty pkg and lib directories in perforce
993 branch: default
993 branch: default
994 commit: (clean)
994 commit: (clean)
995 update: (current)
995 update: (current)
996
996
997 $ hg diff --git -c tip
997 $ hg diff --git -c tip
998 diff --git a/lib/place-holder b/lib/place-holder
998 diff --git a/lib/place-holder b/lib/place-holder
999 new file mode 100644
999 new file mode 100644
1000 --- /dev/null
1000 --- /dev/null
1001 +++ b/lib/place-holder
1001 +++ b/lib/place-holder
1002 @@ -0,0 +1,2 @@
1002 @@ -0,0 +1,2 @@
1003 +perforce does not maintain empty directories.
1003 +perforce does not maintain empty directories.
1004 +this file helps.
1004 +this file helps.
1005 diff --git a/pkg/place-holder b/pkg/place-holder
1005 diff --git a/pkg/place-holder b/pkg/place-holder
1006 new file mode 100644
1006 new file mode 100644
1007 --- /dev/null
1007 --- /dev/null
1008 +++ b/pkg/place-holder
1008 +++ b/pkg/place-holder
1009 @@ -0,0 +1,2 @@
1009 @@ -0,0 +1,2 @@
1010 +perforce does not maintain empty directories.
1010 +perforce does not maintain empty directories.
1011 +this file helps.
1011 +this file helps.
1012
1012
1013 /* The mode change for mksys.bash is missing here, because on platforms */
1013 /* The mode change for mksys.bash is missing here, because on platforms */
1014 /* that don't support execbits, mode changes in patches are ignored when */
1014 /* that don't support execbits, mode changes in patches are ignored when */
1015 /* they are imported. This is obviously also the reason for why the hash */
1015 /* they are imported. This is obviously also the reason for why the hash */
1016 /* in the created changeset is different to the one you see above the */
1016 /* in the created changeset is different to the one you see above the */
1017 /* #else clause */
1017 /* #else clause */
1018
1018
1019 #endif
1019 #endif
1020 $ cd ..
1020 $ cd ..
1021
1021
1022
1022
1023 diff lines looking like headers
1023 diff lines looking like headers
1024
1024
1025 $ hg init difflineslikeheaders
1025 $ hg init difflineslikeheaders
1026 $ cd difflineslikeheaders
1026 $ cd difflineslikeheaders
1027 $ echo a >a
1027 $ echo a >a
1028 $ echo b >b
1028 $ echo b >b
1029 $ echo c >c
1029 $ echo c >c
1030 $ hg ci -Am1
1030 $ hg ci -Am1
1031 adding a
1031 adding a
1032 adding b
1032 adding b
1033 adding c
1033 adding c
1034
1034
1035 $ echo "key: value" >>a
1035 $ echo "key: value" >>a
1036 $ echo "key: value" >>b
1036 $ echo "key: value" >>b
1037 $ echo "foo" >>c
1037 $ echo "foo" >>c
1038 $ hg ci -m2
1038 $ hg ci -m2
1039
1039
1040 $ hg up -C 0
1040 $ hg up -C 0
1041 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
1041 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
1042 $ hg diff --git -c1 >want
1042 $ hg diff --git -c1 >want
1043 $ hg diff -c1 | hg import --no-commit -
1043 $ hg diff -c1 | hg import --no-commit -
1044 applying patch from stdin
1044 applying patch from stdin
1045 $ hg diff --git >have
1045 $ hg diff --git >have
1046 $ diff want have
1046 $ diff want have
1047 $ cd ..
1047 $ cd ..
1048
1048
1049 import a unified diff with no lines of context (diff -U0)
1049 import a unified diff with no lines of context (diff -U0)
1050
1050
1051 $ hg init diffzero
1051 $ hg init diffzero
1052 $ cd diffzero
1052 $ cd diffzero
1053 $ cat > f << EOF
1053 $ cat > f << EOF
1054 > c2
1054 > c2
1055 > c4
1055 > c4
1056 > c5
1056 > c5
1057 > EOF
1057 > EOF
1058 $ hg commit -Am0
1058 $ hg commit -Am0
1059 adding f
1059 adding f
1060
1060
1061 $ hg import --no-commit - << EOF
1061 $ hg import --no-commit - << EOF
1062 > # HG changeset patch
1062 > # HG changeset patch
1063 > # User test
1063 > # User test
1064 > # Date 0 0
1064 > # Date 0 0
1065 > # Node ID f4974ab632f3dee767567b0576c0ec9a4508575c
1065 > # Node ID f4974ab632f3dee767567b0576c0ec9a4508575c
1066 > # Parent 8679a12a975b819fae5f7ad3853a2886d143d794
1066 > # Parent 8679a12a975b819fae5f7ad3853a2886d143d794
1067 > 1
1067 > 1
1068 > diff -r 8679a12a975b -r f4974ab632f3 f
1068 > diff -r 8679a12a975b -r f4974ab632f3 f
1069 > --- a/f Thu Jan 01 00:00:00 1970 +0000
1069 > --- a/f Thu Jan 01 00:00:00 1970 +0000
1070 > +++ b/f Thu Jan 01 00:00:00 1970 +0000
1070 > +++ b/f Thu Jan 01 00:00:00 1970 +0000
1071 > @@ -0,0 +1,1 @@
1071 > @@ -0,0 +1,1 @@
1072 > +c1
1072 > +c1
1073 > @@ -1,0 +3,1 @@
1073 > @@ -1,0 +3,1 @@
1074 > +c3
1074 > +c3
1075 > @@ -3,1 +4,0 @@
1075 > @@ -3,1 +4,0 @@
1076 > -c5
1076 > -c5
1077 > EOF
1077 > EOF
1078 applying patch from stdin
1078 applying patch from stdin
1079
1079
1080 $ cat f
1080 $ cat f
1081 c1
1081 c1
1082 c2
1082 c2
1083 c3
1083 c3
1084 c4
1084 c4
1085
1085
1086 $ cd ..
1086 $ cd ..
1087
1087
1088 no segfault while importing a unified diff which start line is zero but chunk
1088 no segfault while importing a unified diff which start line is zero but chunk
1089 size is non-zero
1089 size is non-zero
1090
1090
1091 $ hg init startlinezero
1091 $ hg init startlinezero
1092 $ cd startlinezero
1092 $ cd startlinezero
1093 $ echo foo > foo
1093 $ echo foo > foo
1094 $ hg commit -Amfoo
1094 $ hg commit -Amfoo
1095 adding foo
1095 adding foo
1096
1096
1097 $ hg import --no-commit - << EOF
1097 $ hg import --no-commit - << EOF
1098 > diff a/foo b/foo
1098 > diff a/foo b/foo
1099 > --- a/foo
1099 > --- a/foo
1100 > +++ b/foo
1100 > +++ b/foo
1101 > @@ -0,1 +0,1 @@
1101 > @@ -0,1 +0,1 @@
1102 > foo
1102 > foo
1103 > EOF
1103 > EOF
1104 applying patch from stdin
1104 applying patch from stdin
1105
1105
1106 $ cd ..
1106 $ cd ..
1107
1107
1108 Test corner case involving fuzz and skew
1108 Test corner case involving fuzz and skew
1109
1109
1110 $ hg init morecornercases
1110 $ hg init morecornercases
1111 $ cd morecornercases
1111 $ cd morecornercases
1112
1112
1113 $ cat > 01-no-context-beginning-of-file.diff <<EOF
1113 $ cat > 01-no-context-beginning-of-file.diff <<EOF
1114 > diff --git a/a b/a
1114 > diff --git a/a b/a
1115 > --- a/a
1115 > --- a/a
1116 > +++ b/a
1116 > +++ b/a
1117 > @@ -1,0 +1,1 @@
1117 > @@ -1,0 +1,1 @@
1118 > +line
1118 > +line
1119 > EOF
1119 > EOF
1120
1120
1121 $ cat > 02-no-context-middle-of-file.diff <<EOF
1121 $ cat > 02-no-context-middle-of-file.diff <<EOF
1122 > diff --git a/a b/a
1122 > diff --git a/a b/a
1123 > --- a/a
1123 > --- a/a
1124 > +++ b/a
1124 > +++ b/a
1125 > @@ -1,1 +1,1 @@
1125 > @@ -1,1 +1,1 @@
1126 > -2
1126 > -2
1127 > +add some skew
1127 > +add some skew
1128 > @@ -2,0 +2,1 @@
1128 > @@ -2,0 +2,1 @@
1129 > +line
1129 > +line
1130 > EOF
1130 > EOF
1131
1131
1132 $ cat > 03-no-context-end-of-file.diff <<EOF
1132 $ cat > 03-no-context-end-of-file.diff <<EOF
1133 > diff --git a/a b/a
1133 > diff --git a/a b/a
1134 > --- a/a
1134 > --- a/a
1135 > +++ b/a
1135 > +++ b/a
1136 > @@ -10,0 +10,1 @@
1136 > @@ -10,0 +10,1 @@
1137 > +line
1137 > +line
1138 > EOF
1138 > EOF
1139
1139
1140 $ cat > 04-middle-of-file-completely-fuzzed.diff <<EOF
1140 $ cat > 04-middle-of-file-completely-fuzzed.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,1 +1,1 @@
1144 > @@ -1,1 +1,1 @@
1145 > -2
1145 > -2
1146 > +add some skew
1146 > +add some skew
1147 > @@ -2,2 +2,3 @@
1147 > @@ -2,2 +2,3 @@
1148 > not matching, should fuzz
1148 > not matching, should fuzz
1149 > ... a bit
1149 > ... a bit
1150 > +line
1150 > +line
1151 > EOF
1151 > EOF
1152
1152
1153 $ cat > a <<EOF
1153 $ cat > a <<EOF
1154 > 1
1154 > 1
1155 > 2
1155 > 2
1156 > 3
1156 > 3
1157 > 4
1157 > 4
1158 > EOF
1158 > EOF
1159 $ hg ci -Am adda a
1159 $ hg ci -Am adda a
1160 $ for p in *.diff; do
1160 $ for p in *.diff; do
1161 > hg import -v --no-commit $p
1161 > hg import -v --no-commit $p
1162 > cat a
1162 > cat a
1163 > hg revert -aqC a
1163 > hg revert -aqC a
1164 > # patch -p1 < $p
1164 > # patch -p1 < $p
1165 > # cat a
1165 > # cat a
1166 > # hg revert -aC a
1166 > # hg revert -aC a
1167 > done
1167 > done
1168 applying 01-no-context-beginning-of-file.diff
1168 applying 01-no-context-beginning-of-file.diff
1169 patching file a
1169 patching file a
1170 applied to working directory
1170 applied to working directory
1171 1
1171 1
1172 line
1172 line
1173 2
1173 2
1174 3
1174 3
1175 4
1175 4
1176 applying 02-no-context-middle-of-file.diff
1176 applying 02-no-context-middle-of-file.diff
1177 patching file a
1177 patching file a
1178 Hunk #1 succeeded at 2 (offset 1 lines).
1178 Hunk #1 succeeded at 2 (offset 1 lines).
1179 Hunk #2 succeeded at 4 (offset 1 lines).
1179 Hunk #2 succeeded at 4 (offset 1 lines).
1180 applied to working directory
1180 applied to working directory
1181 1
1181 1
1182 add some skew
1182 add some skew
1183 3
1183 3
1184 line
1184 line
1185 4
1185 4
1186 applying 03-no-context-end-of-file.diff
1186 applying 03-no-context-end-of-file.diff
1187 patching file a
1187 patching file a
1188 Hunk #1 succeeded at 5 (offset -6 lines).
1188 Hunk #1 succeeded at 5 (offset -6 lines).
1189 applied to working directory
1189 applied to working directory
1190 1
1190 1
1191 2
1191 2
1192 3
1192 3
1193 4
1193 4
1194 line
1194 line
1195 applying 04-middle-of-file-completely-fuzzed.diff
1195 applying 04-middle-of-file-completely-fuzzed.diff
1196 patching file a
1196 patching file a
1197 Hunk #1 succeeded at 2 (offset 1 lines).
1197 Hunk #1 succeeded at 2 (offset 1 lines).
1198 Hunk #2 succeeded at 5 with fuzz 2 (offset 1 lines).
1198 Hunk #2 succeeded at 5 with fuzz 2 (offset 1 lines).
1199 applied to working directory
1199 applied to working directory
1200 1
1200 1
1201 add some skew
1201 add some skew
1202 3
1202 3
1203 4
1203 4
1204 line
1204 line
1205 $ cd ..
1205 $ cd ..
1206
1206
1207 Test partial application
1207 Test partial application
1208 ------------------------
1208 ------------------------
1209
1209
1210 prepare a stack of patches depending on each other
1210 prepare a stack of patches depending on each other
1211
1211
1212 $ hg init partial
1212 $ hg init partial
1213 $ cd partial
1213 $ cd partial
1214 $ cat << EOF > a
1214 $ cat << EOF > a
1215 > one
1215 > one
1216 > two
1216 > two
1217 > three
1217 > three
1218 > four
1218 > four
1219 > five
1219 > five
1220 > six
1220 > six
1221 > seven
1221 > seven
1222 > EOF
1222 > EOF
1223 $ hg add a
1223 $ hg add a
1224 $ echo 'b' > b
1224 $ echo 'b' > b
1225 $ hg add b
1225 $ hg add b
1226 $ hg commit -m 'initial' -u Babar
1226 $ hg commit -m 'initial' -u Babar
1227 $ cat << EOF > a
1227 $ cat << EOF > a
1228 > one
1228 > one
1229 > two
1229 > two
1230 > 3
1230 > 3
1231 > four
1231 > four
1232 > five
1232 > five
1233 > six
1233 > six
1234 > seven
1234 > seven
1235 > EOF
1235 > EOF
1236 $ hg commit -m 'three' -u Celeste
1236 $ hg commit -m 'three' -u Celeste
1237 $ cat << EOF > a
1237 $ cat << EOF > a
1238 > one
1238 > one
1239 > two
1239 > two
1240 > 3
1240 > 3
1241 > 4
1241 > 4
1242 > five
1242 > five
1243 > six
1243 > six
1244 > seven
1244 > seven
1245 > EOF
1245 > EOF
1246 $ hg commit -m 'four' -u Rataxes
1246 $ hg commit -m 'four' -u Rataxes
1247 $ cat << EOF > a
1247 $ cat << EOF > a
1248 > one
1248 > one
1249 > two
1249 > two
1250 > 3
1250 > 3
1251 > 4
1251 > 4
1252 > 5
1252 > 5
1253 > six
1253 > six
1254 > seven
1254 > seven
1255 > EOF
1255 > EOF
1256 $ echo bb >> b
1256 $ echo bb >> b
1257 $ hg commit -m 'five' -u Arthur
1257 $ hg commit -m 'five' -u Arthur
1258 $ echo 'Babar' > jungle
1258 $ echo 'Babar' > jungle
1259 $ hg add jungle
1259 $ hg add jungle
1260 $ hg ci -m 'jungle' -u Zephir
1260 $ hg ci -m 'jungle' -u Zephir
1261 $ echo 'Celeste' >> jungle
1261 $ echo 'Celeste' >> jungle
1262 $ hg ci -m 'extended jungle' -u Cornelius
1262 $ hg ci -m 'extended jungle' -u Cornelius
1263 $ hg log -G --template '{desc|firstline} [{author}] {diffstat}\n'
1263 $ hg log -G --template '{desc|firstline} [{author}] {diffstat}\n'
1264 @ extended jungle [Cornelius] 1: +1/-0
1264 @ extended jungle [Cornelius] 1: +1/-0
1265 |
1265 |
1266 o jungle [Zephir] 1: +1/-0
1266 o jungle [Zephir] 1: +1/-0
1267 |
1267 |
1268 o five [Arthur] 2: +2/-1
1268 o five [Arthur] 2: +2/-1
1269 |
1269 |
1270 o four [Rataxes] 1: +1/-1
1270 o four [Rataxes] 1: +1/-1
1271 |
1271 |
1272 o three [Celeste] 1: +1/-1
1272 o three [Celeste] 1: +1/-1
1273 |
1273 |
1274 o initial [Babar] 2: +8/-0
1274 o initial [Babar] 2: +8/-0
1275
1275
1276
1276
1277 Importing with some success and some errors:
1277 Importing with some success and some errors:
1278
1278
1279 $ hg update --rev 'desc(initial)'
1279 $ hg update --rev 'desc(initial)'
1280 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
1280 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
1281 $ hg export --rev 'desc(five)' | hg import --partial -
1281 $ hg export --rev 'desc(five)' | hg import --partial -
1282 applying patch from stdin
1282 applying patch from stdin
1283 patching file a
1283 patching file a
1284 Hunk #1 FAILED at 1
1284 Hunk #1 FAILED at 1
1285 1 out of 1 hunks FAILED -- saving rejects to file a.rej
1285 1 out of 1 hunks FAILED -- saving rejects to file a.rej
1286 patch applied partially
1286 patch applied partially
1287 (fix the .rej files and run `hg commit --amend`)
1287 (fix the .rej files and run `hg commit --amend`)
1288 [1]
1288 [1]
1289
1289
1290 $ hg log -G --template '{desc|firstline} [{author}] {diffstat}\n'
1290 $ hg log -G --template '{desc|firstline} [{author}] {diffstat}\n'
1291 @ five [Arthur] 1: +1/-0
1291 @ five [Arthur] 1: +1/-0
1292 |
1292 |
1293 | o extended jungle [Cornelius] 1: +1/-0
1293 | o extended jungle [Cornelius] 1: +1/-0
1294 | |
1294 | |
1295 | o jungle [Zephir] 1: +1/-0
1295 | o jungle [Zephir] 1: +1/-0
1296 | |
1296 | |
1297 | o five [Arthur] 2: +2/-1
1297 | o five [Arthur] 2: +2/-1
1298 | |
1298 | |
1299 | o four [Rataxes] 1: +1/-1
1299 | o four [Rataxes] 1: +1/-1
1300 | |
1300 | |
1301 | o three [Celeste] 1: +1/-1
1301 | o three [Celeste] 1: +1/-1
1302 |/
1302 |/
1303 o initial [Babar] 2: +8/-0
1303 o initial [Babar] 2: +8/-0
1304
1304
1305 $ hg export
1305 $ hg export
1306 # HG changeset patch
1306 # HG changeset patch
1307 # User Arthur
1307 # User Arthur
1308 # Date 0 0
1308 # Date 0 0
1309 # Thu Jan 01 00:00:00 1970 +0000
1309 # Thu Jan 01 00:00:00 1970 +0000
1310 # Node ID 26e6446bb2526e2be1037935f5fca2b2706f1509
1310 # Node ID 26e6446bb2526e2be1037935f5fca2b2706f1509
1311 # Parent 8e4f0351909eae6b9cf68c2c076cb54c42b54b2e
1311 # Parent 8e4f0351909eae6b9cf68c2c076cb54c42b54b2e
1312 five
1312 five
1313
1313
1314 diff -r 8e4f0351909e -r 26e6446bb252 b
1314 diff -r 8e4f0351909e -r 26e6446bb252 b
1315 --- a/b Thu Jan 01 00:00:00 1970 +0000
1315 --- a/b Thu Jan 01 00:00:00 1970 +0000
1316 +++ b/b Thu Jan 01 00:00:00 1970 +0000
1316 +++ b/b Thu Jan 01 00:00:00 1970 +0000
1317 @@ -1,1 +1,2 @@
1317 @@ -1,1 +1,2 @@
1318 b
1318 b
1319 +bb
1319 +bb
1320 $ hg status -c .
1320 $ hg status -c .
1321 C a
1321 C a
1322 C b
1322 C b
1323 $ ls
1323 $ ls
1324 a
1324 a
1325 a.rej
1325 a.rej
1326 b
1326 b
1327
1327
1328 Importing with zero success:
1328 Importing with zero success:
1329
1329
1330 $ hg update --rev 'desc(initial)'
1330 $ hg update --rev 'desc(initial)'
1331 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1331 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1332 $ hg export --rev 'desc(four)' | hg import --partial -
1332 $ hg export --rev 'desc(four)' | hg import --partial -
1333 applying patch from stdin
1333 applying patch from stdin
1334 patching file a
1334 patching file a
1335 Hunk #1 FAILED at 0
1335 Hunk #1 FAILED at 0
1336 1 out of 1 hunks FAILED -- saving rejects to file a.rej
1336 1 out of 1 hunks FAILED -- saving rejects to file a.rej
1337 patch applied partially
1337 patch applied partially
1338 (fix the .rej files and run `hg commit --amend`)
1338 (fix the .rej files and run `hg commit --amend`)
1339 [1]
1339 [1]
1340
1340
1341 $ hg log -G --template '{desc|firstline} [{author}] {diffstat}\n'
1341 $ hg log -G --template '{desc|firstline} [{author}] {diffstat}\n'
1342 @ four [Rataxes] 0: +0/-0
1342 @ four [Rataxes] 0: +0/-0
1343 |
1343 |
1344 | o five [Arthur] 1: +1/-0
1344 | o five [Arthur] 1: +1/-0
1345 |/
1345 |/
1346 | o extended jungle [Cornelius] 1: +1/-0
1346 | o extended jungle [Cornelius] 1: +1/-0
1347 | |
1347 | |
1348 | o jungle [Zephir] 1: +1/-0
1348 | o jungle [Zephir] 1: +1/-0
1349 | |
1349 | |
1350 | o five [Arthur] 2: +2/-1
1350 | o five [Arthur] 2: +2/-1
1351 | |
1351 | |
1352 | o four [Rataxes] 1: +1/-1
1352 | o four [Rataxes] 1: +1/-1
1353 | |
1353 | |
1354 | o three [Celeste] 1: +1/-1
1354 | o three [Celeste] 1: +1/-1
1355 |/
1355 |/
1356 o initial [Babar] 2: +8/-0
1356 o initial [Babar] 2: +8/-0
1357
1357
1358 $ hg export
1358 $ hg export
1359 # HG changeset patch
1359 # HG changeset patch
1360 # User Rataxes
1360 # User Rataxes
1361 # Date 0 0
1361 # Date 0 0
1362 # Thu Jan 01 00:00:00 1970 +0000
1362 # Thu Jan 01 00:00:00 1970 +0000
1363 # Node ID cb9b1847a74d9ad52e93becaf14b98dbcc274e1e
1363 # Node ID cb9b1847a74d9ad52e93becaf14b98dbcc274e1e
1364 # Parent 8e4f0351909eae6b9cf68c2c076cb54c42b54b2e
1364 # Parent 8e4f0351909eae6b9cf68c2c076cb54c42b54b2e
1365 four
1365 four
1366
1366
1367 $ hg status -c .
1367 $ hg status -c .
1368 C a
1368 C a
1369 C b
1369 C b
1370 $ ls
1370 $ ls
1371 a
1371 a
1372 a.rej
1372 a.rej
1373 b
1373 b
1374
1374
1375 Importing with unknown file:
1375 Importing with unknown file:
1376
1376
1377 $ hg update --rev 'desc(initial)'
1377 $ hg update --rev 'desc(initial)'
1378 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1378 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1379 $ hg export --rev 'desc("extended jungle")' | hg import --partial -
1379 $ hg export --rev 'desc("extended jungle")' | hg import --partial -
1380 applying patch from stdin
1380 applying patch from stdin
1381 unable to find 'jungle' for patching
1381 unable to find 'jungle' for patching
1382 1 out of 1 hunks FAILED -- saving rejects to file jungle.rej
1382 1 out of 1 hunks FAILED -- saving rejects to file jungle.rej
1383 patch applied partially
1383 patch applied partially
1384 (fix the .rej files and run `hg commit --amend`)
1384 (fix the .rej files and run `hg commit --amend`)
1385 [1]
1385 [1]
1386
1386
1387 $ hg log -G --template '{desc|firstline} [{author}] {diffstat}\n'
1387 $ hg log -G --template '{desc|firstline} [{author}] {diffstat}\n'
1388 @ extended jungle [Cornelius] 0: +0/-0
1388 @ extended jungle [Cornelius] 0: +0/-0
1389 |
1389 |
1390 | o four [Rataxes] 0: +0/-0
1390 | o four [Rataxes] 0: +0/-0
1391 |/
1391 |/
1392 | o five [Arthur] 1: +1/-0
1392 | o five [Arthur] 1: +1/-0
1393 |/
1393 |/
1394 | o extended jungle [Cornelius] 1: +1/-0
1394 | o extended jungle [Cornelius] 1: +1/-0
1395 | |
1395 | |
1396 | o jungle [Zephir] 1: +1/-0
1396 | o jungle [Zephir] 1: +1/-0
1397 | |
1397 | |
1398 | o five [Arthur] 2: +2/-1
1398 | o five [Arthur] 2: +2/-1
1399 | |
1399 | |
1400 | o four [Rataxes] 1: +1/-1
1400 | o four [Rataxes] 1: +1/-1
1401 | |
1401 | |
1402 | o three [Celeste] 1: +1/-1
1402 | o three [Celeste] 1: +1/-1
1403 |/
1403 |/
1404 o initial [Babar] 2: +8/-0
1404 o initial [Babar] 2: +8/-0
1405
1405
1406 $ hg export
1406 $ hg export
1407 # HG changeset patch
1407 # HG changeset patch
1408 # User Cornelius
1408 # User Cornelius
1409 # Date 0 0
1409 # Date 0 0
1410 # Thu Jan 01 00:00:00 1970 +0000
1410 # Thu Jan 01 00:00:00 1970 +0000
1411 # Node ID 1fb1f86bef43c5a75918178f8d23c29fb0a7398d
1411 # Node ID 1fb1f86bef43c5a75918178f8d23c29fb0a7398d
1412 # Parent 8e4f0351909eae6b9cf68c2c076cb54c42b54b2e
1412 # Parent 8e4f0351909eae6b9cf68c2c076cb54c42b54b2e
1413 extended jungle
1413 extended jungle
1414
1414
1415 $ hg status -c .
1415 $ hg status -c .
1416 C a
1416 C a
1417 C b
1417 C b
1418 $ ls
1418 $ ls
1419 a
1419 a
1420 a.rej
1420 a.rej
1421 b
1421 b
1422 jungle.rej
1422 jungle.rej
1423
1423
1424 Importing multiple failing patches:
1424 Importing multiple failing patches:
1425
1425
1426 $ hg update --rev 'desc(initial)'
1426 $ hg update --rev 'desc(initial)'
1427 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1427 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1428 $ echo 'B' > b # just to make another commit
1428 $ echo 'B' > b # just to make another commit
1429 $ hg commit -m "a new base"
1429 $ hg commit -m "a new base"
1430 created new head
1430 created new head
1431 $ hg export --rev 'desc("extended jungle") + desc("four")' | hg import --partial -
1431 $ hg export --rev 'desc("four") + desc("extended jungle")' | hg import --partial -
1432 applying patch from stdin
1432 applying patch from stdin
1433 patching file a
1433 patching file a
1434 Hunk #1 FAILED at 0
1434 Hunk #1 FAILED at 0
1435 1 out of 1 hunks FAILED -- saving rejects to file a.rej
1435 1 out of 1 hunks FAILED -- saving rejects to file a.rej
1436 patch applied partially
1436 patch applied partially
1437 (fix the .rej files and run `hg commit --amend`)
1437 (fix the .rej files and run `hg commit --amend`)
1438 [1]
1438 [1]
1439 $ hg log -G --template '{desc|firstline} [{author}] {diffstat}\n'
1439 $ hg log -G --template '{desc|firstline} [{author}] {diffstat}\n'
1440 @ four [Rataxes] 0: +0/-0
1440 @ four [Rataxes] 0: +0/-0
1441 |
1441 |
1442 o a new base [test] 1: +1/-1
1442 o a new base [test] 1: +1/-1
1443 |
1443 |
1444 | o extended jungle [Cornelius] 0: +0/-0
1444 | o extended jungle [Cornelius] 0: +0/-0
1445 |/
1445 |/
1446 | o four [Rataxes] 0: +0/-0
1446 | o four [Rataxes] 0: +0/-0
1447 |/
1447 |/
1448 | o five [Arthur] 1: +1/-0
1448 | o five [Arthur] 1: +1/-0
1449 |/
1449 |/
1450 | o extended jungle [Cornelius] 1: +1/-0
1450 | o extended jungle [Cornelius] 1: +1/-0
1451 | |
1451 | |
1452 | o jungle [Zephir] 1: +1/-0
1452 | o jungle [Zephir] 1: +1/-0
1453 | |
1453 | |
1454 | o five [Arthur] 2: +2/-1
1454 | o five [Arthur] 2: +2/-1
1455 | |
1455 | |
1456 | o four [Rataxes] 1: +1/-1
1456 | o four [Rataxes] 1: +1/-1
1457 | |
1457 | |
1458 | o three [Celeste] 1: +1/-1
1458 | o three [Celeste] 1: +1/-1
1459 |/
1459 |/
1460 o initial [Babar] 2: +8/-0
1460 o initial [Babar] 2: +8/-0
1461
1461
1462 $ hg export
1462 $ hg export
1463 # HG changeset patch
1463 # HG changeset patch
1464 # User Rataxes
1464 # User Rataxes
1465 # Date 0 0
1465 # Date 0 0
1466 # Thu Jan 01 00:00:00 1970 +0000
1466 # Thu Jan 01 00:00:00 1970 +0000
1467 # Node ID a9d7b6d0ffbb4eb12b7d5939250fcd42e8930a1d
1467 # Node ID a9d7b6d0ffbb4eb12b7d5939250fcd42e8930a1d
1468 # Parent f59f8d2e95a8ca5b1b4ca64320140da85f3b44fd
1468 # Parent f59f8d2e95a8ca5b1b4ca64320140da85f3b44fd
1469 four
1469 four
1470
1470
1471 $ hg status -c .
1471 $ hg status -c .
1472 C a
1472 C a
1473 C b
1473 C b
General Comments 0
You need to be logged in to leave comments. Login now