##// END OF EJS Templates
tests: don't use stdout redirection for test data...
Mads Kiilerich -
r15522:cf0f3cb8 default
parent child Browse files
Show More
@@ -1,459 +1,459 b''
1 Prepare repo a:
1 Prepare repo a:
2
2
3 $ hg init a
3 $ hg init a
4 $ cd a
4 $ cd a
5 $ echo a > a
5 $ echo a > a
6 $ hg add a
6 $ hg add a
7 $ hg commit -m test
7 $ hg commit -m test
8 $ echo first line > b
8 $ echo first line > b
9 $ hg add b
9 $ hg add b
10
10
11 Create a non-inlined filelog:
11 Create a non-inlined filelog:
12
12
13 $ python -c 'for x in range(10000): print x' >> data1
13 $ python -c 'file("data1", "wb").write("".join("%s\n" % x for x in range(10000)))'
14 $ for j in 0 1 2 3 4 5 6 7 8 9; do
14 $ for j in 0 1 2 3 4 5 6 7 8 9; do
15 > cat data1 >> b
15 > cat data1 >> b
16 > hg commit -m test
16 > hg commit -m test
17 > done
17 > done
18
18
19 List files in store/data (should show a 'b.d'):
19 List files in store/data (should show a 'b.d'):
20
20
21 $ for i in .hg/store/data/*; do
21 $ for i in .hg/store/data/*; do
22 > echo $i
22 > echo $i
23 > done
23 > done
24 .hg/store/data/a.i
24 .hg/store/data/a.i
25 .hg/store/data/b.d
25 .hg/store/data/b.d
26 .hg/store/data/b.i
26 .hg/store/data/b.i
27
27
28 Default operation:
28 Default operation:
29
29
30 $ hg clone . ../b
30 $ hg clone . ../b
31 updating to branch default
31 updating to branch default
32 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
32 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
33 $ cd ../b
33 $ cd ../b
34 $ cat a
34 $ cat a
35 a
35 a
36 $ hg verify
36 $ hg verify
37 checking changesets
37 checking changesets
38 checking manifests
38 checking manifests
39 crosschecking files in changesets and manifests
39 crosschecking files in changesets and manifests
40 checking files
40 checking files
41 2 files, 11 changesets, 11 total revisions
41 2 files, 11 changesets, 11 total revisions
42
42
43 Invalid dest '' must abort:
43 Invalid dest '' must abort:
44
44
45 $ hg clone . ''
45 $ hg clone . ''
46 abort: * (glob)
46 abort: * (glob)
47 [255]
47 [255]
48
48
49 No update, with debug option:
49 No update, with debug option:
50
50
51 $ hg --debug clone -U . ../c
51 $ hg --debug clone -U . ../c
52 linked 8 files
52 linked 8 files
53 $ cd ../c
53 $ cd ../c
54 $ cat a 2>/dev/null || echo "a not present"
54 $ cat a 2>/dev/null || echo "a not present"
55 a not present
55 a not present
56 $ hg verify
56 $ hg verify
57 checking changesets
57 checking changesets
58 checking manifests
58 checking manifests
59 crosschecking files in changesets and manifests
59 crosschecking files in changesets and manifests
60 checking files
60 checking files
61 2 files, 11 changesets, 11 total revisions
61 2 files, 11 changesets, 11 total revisions
62
62
63 Default destination:
63 Default destination:
64
64
65 $ mkdir ../d
65 $ mkdir ../d
66 $ cd ../d
66 $ cd ../d
67 $ hg clone ../a
67 $ hg clone ../a
68 destination directory: a
68 destination directory: a
69 updating to branch default
69 updating to branch default
70 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
70 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
71 $ cd a
71 $ cd a
72 $ hg cat a
72 $ hg cat a
73 a
73 a
74 $ cd ../..
74 $ cd ../..
75
75
76 Check that we drop the 'file:' from the path before writing the .hgrc:
76 Check that we drop the 'file:' from the path before writing the .hgrc:
77
77
78 $ hg clone file:a e
78 $ hg clone file:a e
79 updating to branch default
79 updating to branch default
80 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
80 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
81 $ grep 'file:' e/.hg/hgrc
81 $ grep 'file:' e/.hg/hgrc
82 [1]
82 [1]
83
83
84 Check that path aliases are expanded:
84 Check that path aliases are expanded:
85
85
86 $ hg clone -q -U --config 'paths.foobar=a#0' foobar f
86 $ hg clone -q -U --config 'paths.foobar=a#0' foobar f
87 $ hg -R f showconfig paths.default
87 $ hg -R f showconfig paths.default
88 $TESTTMP/a#0 (glob)
88 $TESTTMP/a#0 (glob)
89
89
90 Use --pull:
90 Use --pull:
91
91
92 $ hg clone --pull a g
92 $ hg clone --pull a g
93 requesting all changes
93 requesting all changes
94 adding changesets
94 adding changesets
95 adding manifests
95 adding manifests
96 adding file changes
96 adding file changes
97 added 11 changesets with 11 changes to 2 files
97 added 11 changesets with 11 changes to 2 files
98 updating to branch default
98 updating to branch default
99 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
99 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
100 $ hg -R g verify
100 $ hg -R g verify
101 checking changesets
101 checking changesets
102 checking manifests
102 checking manifests
103 crosschecking files in changesets and manifests
103 crosschecking files in changesets and manifests
104 checking files
104 checking files
105 2 files, 11 changesets, 11 total revisions
105 2 files, 11 changesets, 11 total revisions
106
106
107 Invalid dest '' with --pull must abort (issue2528):
107 Invalid dest '' with --pull must abort (issue2528):
108
108
109 $ hg clone --pull a ''
109 $ hg clone --pull a ''
110 abort: * (glob)
110 abort: * (glob)
111 [255]
111 [255]
112
112
113 Clone to '.':
113 Clone to '.':
114
114
115 $ mkdir h
115 $ mkdir h
116 $ cd h
116 $ cd h
117 $ hg clone ../a .
117 $ hg clone ../a .
118 updating to branch default
118 updating to branch default
119 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
119 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
120 $ cd ..
120 $ cd ..
121
121
122
122
123 *** Tests for option -u ***
123 *** Tests for option -u ***
124
124
125 Adding some more history to repo a:
125 Adding some more history to repo a:
126
126
127 $ cd a
127 $ cd a
128 $ hg tag ref1
128 $ hg tag ref1
129 $ echo the quick brown fox >a
129 $ echo the quick brown fox >a
130 $ hg ci -m "hacked default"
130 $ hg ci -m "hacked default"
131 $ hg up ref1
131 $ hg up ref1
132 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
132 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
133 $ hg branch stable
133 $ hg branch stable
134 marked working directory as branch stable
134 marked working directory as branch stable
135 $ echo some text >a
135 $ echo some text >a
136 $ hg ci -m "starting branch stable"
136 $ hg ci -m "starting branch stable"
137 $ hg tag ref2
137 $ hg tag ref2
138 $ echo some more text >a
138 $ echo some more text >a
139 $ hg ci -m "another change for branch stable"
139 $ hg ci -m "another change for branch stable"
140 $ hg up ref2
140 $ hg up ref2
141 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
141 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
142 $ hg parents
142 $ hg parents
143 changeset: 13:e8ece76546a6
143 changeset: 13:e8ece76546a6
144 branch: stable
144 branch: stable
145 tag: ref2
145 tag: ref2
146 parent: 10:a7949464abda
146 parent: 10:a7949464abda
147 user: test
147 user: test
148 date: Thu Jan 01 00:00:00 1970 +0000
148 date: Thu Jan 01 00:00:00 1970 +0000
149 summary: starting branch stable
149 summary: starting branch stable
150
150
151
151
152 Repo a has two heads:
152 Repo a has two heads:
153
153
154 $ hg heads
154 $ hg heads
155 changeset: 15:0aae7cf88f0d
155 changeset: 15:0aae7cf88f0d
156 branch: stable
156 branch: stable
157 tag: tip
157 tag: tip
158 user: test
158 user: test
159 date: Thu Jan 01 00:00:00 1970 +0000
159 date: Thu Jan 01 00:00:00 1970 +0000
160 summary: another change for branch stable
160 summary: another change for branch stable
161
161
162 changeset: 12:f21241060d6a
162 changeset: 12:f21241060d6a
163 user: test
163 user: test
164 date: Thu Jan 01 00:00:00 1970 +0000
164 date: Thu Jan 01 00:00:00 1970 +0000
165 summary: hacked default
165 summary: hacked default
166
166
167
167
168 $ cd ..
168 $ cd ..
169
169
170
170
171 Testing --noupdate with --updaterev (must abort):
171 Testing --noupdate with --updaterev (must abort):
172
172
173 $ hg clone --noupdate --updaterev 1 a ua
173 $ hg clone --noupdate --updaterev 1 a ua
174 abort: cannot specify both --noupdate and --updaterev
174 abort: cannot specify both --noupdate and --updaterev
175 [255]
175 [255]
176
176
177
177
178 Testing clone -u:
178 Testing clone -u:
179
179
180 $ hg clone -u . a ua
180 $ hg clone -u . a ua
181 updating to branch stable
181 updating to branch stable
182 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
182 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
183
183
184 Repo ua has both heads:
184 Repo ua has both heads:
185
185
186 $ hg -R ua heads
186 $ hg -R ua heads
187 changeset: 15:0aae7cf88f0d
187 changeset: 15:0aae7cf88f0d
188 branch: stable
188 branch: stable
189 tag: tip
189 tag: tip
190 user: test
190 user: test
191 date: Thu Jan 01 00:00:00 1970 +0000
191 date: Thu Jan 01 00:00:00 1970 +0000
192 summary: another change for branch stable
192 summary: another change for branch stable
193
193
194 changeset: 12:f21241060d6a
194 changeset: 12:f21241060d6a
195 user: test
195 user: test
196 date: Thu Jan 01 00:00:00 1970 +0000
196 date: Thu Jan 01 00:00:00 1970 +0000
197 summary: hacked default
197 summary: hacked default
198
198
199
199
200 Same revision checked out in repo a and ua:
200 Same revision checked out in repo a and ua:
201
201
202 $ hg -R a parents --template "{node|short}\n"
202 $ hg -R a parents --template "{node|short}\n"
203 e8ece76546a6
203 e8ece76546a6
204 $ hg -R ua parents --template "{node|short}\n"
204 $ hg -R ua parents --template "{node|short}\n"
205 e8ece76546a6
205 e8ece76546a6
206
206
207 $ rm -r ua
207 $ rm -r ua
208
208
209
209
210 Testing clone --pull -u:
210 Testing clone --pull -u:
211
211
212 $ hg clone --pull -u . a ua
212 $ hg clone --pull -u . a ua
213 requesting all changes
213 requesting all changes
214 adding changesets
214 adding changesets
215 adding manifests
215 adding manifests
216 adding file changes
216 adding file changes
217 added 16 changesets with 16 changes to 3 files (+1 heads)
217 added 16 changesets with 16 changes to 3 files (+1 heads)
218 updating to branch stable
218 updating to branch stable
219 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
219 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
220
220
221 Repo ua has both heads:
221 Repo ua has both heads:
222
222
223 $ hg -R ua heads
223 $ hg -R ua heads
224 changeset: 15:0aae7cf88f0d
224 changeset: 15:0aae7cf88f0d
225 branch: stable
225 branch: stable
226 tag: tip
226 tag: tip
227 user: test
227 user: test
228 date: Thu Jan 01 00:00:00 1970 +0000
228 date: Thu Jan 01 00:00:00 1970 +0000
229 summary: another change for branch stable
229 summary: another change for branch stable
230
230
231 changeset: 12:f21241060d6a
231 changeset: 12:f21241060d6a
232 user: test
232 user: test
233 date: Thu Jan 01 00:00:00 1970 +0000
233 date: Thu Jan 01 00:00:00 1970 +0000
234 summary: hacked default
234 summary: hacked default
235
235
236
236
237 Same revision checked out in repo a and ua:
237 Same revision checked out in repo a and ua:
238
238
239 $ hg -R a parents --template "{node|short}\n"
239 $ hg -R a parents --template "{node|short}\n"
240 e8ece76546a6
240 e8ece76546a6
241 $ hg -R ua parents --template "{node|short}\n"
241 $ hg -R ua parents --template "{node|short}\n"
242 e8ece76546a6
242 e8ece76546a6
243
243
244 $ rm -r ua
244 $ rm -r ua
245
245
246
246
247 Testing clone -u <branch>:
247 Testing clone -u <branch>:
248
248
249 $ hg clone -u stable a ua
249 $ hg clone -u stable a ua
250 updating to branch stable
250 updating to branch stable
251 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
251 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
252
252
253 Repo ua has both heads:
253 Repo ua has both heads:
254
254
255 $ hg -R ua heads
255 $ hg -R ua heads
256 changeset: 15:0aae7cf88f0d
256 changeset: 15:0aae7cf88f0d
257 branch: stable
257 branch: stable
258 tag: tip
258 tag: tip
259 user: test
259 user: test
260 date: Thu Jan 01 00:00:00 1970 +0000
260 date: Thu Jan 01 00:00:00 1970 +0000
261 summary: another change for branch stable
261 summary: another change for branch stable
262
262
263 changeset: 12:f21241060d6a
263 changeset: 12:f21241060d6a
264 user: test
264 user: test
265 date: Thu Jan 01 00:00:00 1970 +0000
265 date: Thu Jan 01 00:00:00 1970 +0000
266 summary: hacked default
266 summary: hacked default
267
267
268
268
269 Branch 'stable' is checked out:
269 Branch 'stable' is checked out:
270
270
271 $ hg -R ua parents
271 $ hg -R ua parents
272 changeset: 15:0aae7cf88f0d
272 changeset: 15:0aae7cf88f0d
273 branch: stable
273 branch: stable
274 tag: tip
274 tag: tip
275 user: test
275 user: test
276 date: Thu Jan 01 00:00:00 1970 +0000
276 date: Thu Jan 01 00:00:00 1970 +0000
277 summary: another change for branch stable
277 summary: another change for branch stable
278
278
279
279
280 $ rm -r ua
280 $ rm -r ua
281
281
282
282
283 Testing default checkout:
283 Testing default checkout:
284
284
285 $ hg clone a ua
285 $ hg clone a ua
286 updating to branch default
286 updating to branch default
287 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
287 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
288
288
289 Repo ua has both heads:
289 Repo ua has both heads:
290
290
291 $ hg -R ua heads
291 $ hg -R ua heads
292 changeset: 15:0aae7cf88f0d
292 changeset: 15:0aae7cf88f0d
293 branch: stable
293 branch: stable
294 tag: tip
294 tag: tip
295 user: test
295 user: test
296 date: Thu Jan 01 00:00:00 1970 +0000
296 date: Thu Jan 01 00:00:00 1970 +0000
297 summary: another change for branch stable
297 summary: another change for branch stable
298
298
299 changeset: 12:f21241060d6a
299 changeset: 12:f21241060d6a
300 user: test
300 user: test
301 date: Thu Jan 01 00:00:00 1970 +0000
301 date: Thu Jan 01 00:00:00 1970 +0000
302 summary: hacked default
302 summary: hacked default
303
303
304
304
305 Branch 'default' is checked out:
305 Branch 'default' is checked out:
306
306
307 $ hg -R ua parents
307 $ hg -R ua parents
308 changeset: 12:f21241060d6a
308 changeset: 12:f21241060d6a
309 user: test
309 user: test
310 date: Thu Jan 01 00:00:00 1970 +0000
310 date: Thu Jan 01 00:00:00 1970 +0000
311 summary: hacked default
311 summary: hacked default
312
312
313
313
314 $ rm -r ua
314 $ rm -r ua
315
315
316
316
317 Testing #<branch>:
317 Testing #<branch>:
318
318
319 $ hg clone -u . a#stable ua
319 $ hg clone -u . a#stable ua
320 adding changesets
320 adding changesets
321 adding manifests
321 adding manifests
322 adding file changes
322 adding file changes
323 added 14 changesets with 14 changes to 3 files
323 added 14 changesets with 14 changes to 3 files
324 updating to branch stable
324 updating to branch stable
325 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
325 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
326
326
327 Repo ua has branch 'stable' and 'default' (was changed in fd511e9eeea6):
327 Repo ua has branch 'stable' and 'default' (was changed in fd511e9eeea6):
328
328
329 $ hg -R ua heads
329 $ hg -R ua heads
330 changeset: 13:0aae7cf88f0d
330 changeset: 13:0aae7cf88f0d
331 branch: stable
331 branch: stable
332 tag: tip
332 tag: tip
333 user: test
333 user: test
334 date: Thu Jan 01 00:00:00 1970 +0000
334 date: Thu Jan 01 00:00:00 1970 +0000
335 summary: another change for branch stable
335 summary: another change for branch stable
336
336
337 changeset: 10:a7949464abda
337 changeset: 10:a7949464abda
338 user: test
338 user: test
339 date: Thu Jan 01 00:00:00 1970 +0000
339 date: Thu Jan 01 00:00:00 1970 +0000
340 summary: test
340 summary: test
341
341
342
342
343 Same revision checked out in repo a and ua:
343 Same revision checked out in repo a and ua:
344
344
345 $ hg -R a parents --template "{node|short}\n"
345 $ hg -R a parents --template "{node|short}\n"
346 e8ece76546a6
346 e8ece76546a6
347 $ hg -R ua parents --template "{node|short}\n"
347 $ hg -R ua parents --template "{node|short}\n"
348 e8ece76546a6
348 e8ece76546a6
349
349
350 $ rm -r ua
350 $ rm -r ua
351
351
352
352
353 Testing -u -r <branch>:
353 Testing -u -r <branch>:
354
354
355 $ hg clone -u . -r stable a ua
355 $ hg clone -u . -r stable a ua
356 adding changesets
356 adding changesets
357 adding manifests
357 adding manifests
358 adding file changes
358 adding file changes
359 added 14 changesets with 14 changes to 3 files
359 added 14 changesets with 14 changes to 3 files
360 updating to branch stable
360 updating to branch stable
361 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
361 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
362
362
363 Repo ua has branch 'stable' and 'default' (was changed in fd511e9eeea6):
363 Repo ua has branch 'stable' and 'default' (was changed in fd511e9eeea6):
364
364
365 $ hg -R ua heads
365 $ hg -R ua heads
366 changeset: 13:0aae7cf88f0d
366 changeset: 13:0aae7cf88f0d
367 branch: stable
367 branch: stable
368 tag: tip
368 tag: tip
369 user: test
369 user: test
370 date: Thu Jan 01 00:00:00 1970 +0000
370 date: Thu Jan 01 00:00:00 1970 +0000
371 summary: another change for branch stable
371 summary: another change for branch stable
372
372
373 changeset: 10:a7949464abda
373 changeset: 10:a7949464abda
374 user: test
374 user: test
375 date: Thu Jan 01 00:00:00 1970 +0000
375 date: Thu Jan 01 00:00:00 1970 +0000
376 summary: test
376 summary: test
377
377
378
378
379 Same revision checked out in repo a and ua:
379 Same revision checked out in repo a and ua:
380
380
381 $ hg -R a parents --template "{node|short}\n"
381 $ hg -R a parents --template "{node|short}\n"
382 e8ece76546a6
382 e8ece76546a6
383 $ hg -R ua parents --template "{node|short}\n"
383 $ hg -R ua parents --template "{node|short}\n"
384 e8ece76546a6
384 e8ece76546a6
385
385
386 $ rm -r ua
386 $ rm -r ua
387
387
388
388
389 Testing -r <branch>:
389 Testing -r <branch>:
390
390
391 $ hg clone -r stable a ua
391 $ hg clone -r stable a ua
392 adding changesets
392 adding changesets
393 adding manifests
393 adding manifests
394 adding file changes
394 adding file changes
395 added 14 changesets with 14 changes to 3 files
395 added 14 changesets with 14 changes to 3 files
396 updating to branch stable
396 updating to branch stable
397 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
397 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
398
398
399 Repo ua has branch 'stable' and 'default' (was changed in fd511e9eeea6):
399 Repo ua has branch 'stable' and 'default' (was changed in fd511e9eeea6):
400
400
401 $ hg -R ua heads
401 $ hg -R ua heads
402 changeset: 13:0aae7cf88f0d
402 changeset: 13:0aae7cf88f0d
403 branch: stable
403 branch: stable
404 tag: tip
404 tag: tip
405 user: test
405 user: test
406 date: Thu Jan 01 00:00:00 1970 +0000
406 date: Thu Jan 01 00:00:00 1970 +0000
407 summary: another change for branch stable
407 summary: another change for branch stable
408
408
409 changeset: 10:a7949464abda
409 changeset: 10:a7949464abda
410 user: test
410 user: test
411 date: Thu Jan 01 00:00:00 1970 +0000
411 date: Thu Jan 01 00:00:00 1970 +0000
412 summary: test
412 summary: test
413
413
414
414
415 Branch 'stable' is checked out:
415 Branch 'stable' is checked out:
416
416
417 $ hg -R ua parents
417 $ hg -R ua parents
418 changeset: 13:0aae7cf88f0d
418 changeset: 13:0aae7cf88f0d
419 branch: stable
419 branch: stable
420 tag: tip
420 tag: tip
421 user: test
421 user: test
422 date: Thu Jan 01 00:00:00 1970 +0000
422 date: Thu Jan 01 00:00:00 1970 +0000
423 summary: another change for branch stable
423 summary: another change for branch stable
424
424
425
425
426 $ rm -r ua
426 $ rm -r ua
427
427
428
428
429 Issue2267: Error in 1.6 hg.py: TypeError: 'NoneType' object is not
429 Issue2267: Error in 1.6 hg.py: TypeError: 'NoneType' object is not
430 iterable in addbranchrevs()
430 iterable in addbranchrevs()
431
431
432 $ cat <<EOF > simpleclone.py
432 $ cat <<EOF > simpleclone.py
433 > from mercurial import ui, hg
433 > from mercurial import ui, hg
434 > myui = ui.ui()
434 > myui = ui.ui()
435 > repo = hg.repository(myui, 'a')
435 > repo = hg.repository(myui, 'a')
436 > hg.clone(myui, {}, repo, dest="ua")
436 > hg.clone(myui, {}, repo, dest="ua")
437 > EOF
437 > EOF
438
438
439 $ python simpleclone.py
439 $ python simpleclone.py
440 updating to branch default
440 updating to branch default
441 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
441 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
442
442
443 $ rm -r ua
443 $ rm -r ua
444
444
445 $ cat <<EOF > branchclone.py
445 $ cat <<EOF > branchclone.py
446 > from mercurial import ui, hg
446 > from mercurial import ui, hg
447 > myui = ui.ui()
447 > myui = ui.ui()
448 > repo = hg.repository(myui, 'a')
448 > repo = hg.repository(myui, 'a')
449 > hg.clone(myui, {}, repo, dest="ua", branch=["stable",])
449 > hg.clone(myui, {}, repo, dest="ua", branch=["stable",])
450 > EOF
450 > EOF
451
451
452 $ python branchclone.py
452 $ python branchclone.py
453 adding changesets
453 adding changesets
454 adding manifests
454 adding manifests
455 adding file changes
455 adding file changes
456 added 14 changesets with 14 changes to 3 files
456 added 14 changesets with 14 changes to 3 files
457 updating to branch stable
457 updating to branch stable
458 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
458 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
459 $ rm -r ua
459 $ rm -r ua
@@ -1,18 +1,18 b''
1 $ hg init
1 $ hg init
2
2
3 $ python -c 'print "confuse str.splitlines\nembedded\rnewline"' > a
3 $ python -c 'file("a", "wb").write("confuse str.splitlines\nembedded\rnewline\n")'
4 $ hg ci -Ama -d '1 0'
4 $ hg ci -Ama -d '1 0'
5 adding a
5 adding a
6
6
7 $ echo clean diff >> a
7 $ echo clean diff >> a
8 $ hg ci -mb -d '2 0'
8 $ hg ci -mb -d '2 0'
9
9
10 $ hg diff -r0 -r1
10 $ hg diff -r0 -r1
11 diff -r 107ba6f817b5 -r 310ce7989cdc a
11 diff -r 107ba6f817b5 -r 310ce7989cdc a
12 --- a/a Thu Jan 01 00:00:01 1970 +0000
12 --- a/a Thu Jan 01 00:00:01 1970 +0000
13 +++ b/a Thu Jan 01 00:00:02 1970 +0000
13 +++ b/a Thu Jan 01 00:00:02 1970 +0000
14 @@ -1,2 +1,3 @@
14 @@ -1,2 +1,3 @@
15 confuse str.splitlines
15 confuse str.splitlines
16 embedded\rnewline (esc)
16 embedded\rnewline (esc)
17 +clean diff
17 +clean diff
18
18
@@ -1,996 +1,998 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
26
27 $ hg clone -r0 a b
27 $ hg clone -r0 a b
28 adding changesets
28 adding changesets
29 adding manifests
29 adding manifests
30 adding file changes
30 adding file changes
31 added 1 changesets with 2 changes to 2 files
31 added 1 changesets with 2 changes to 2 files
32 updating to branch default
32 updating to branch default
33 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
33 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
34 $ hg --cwd b import ../exported-tip.patch
34 $ hg --cwd b import ../exported-tip.patch
35 applying ../exported-tip.patch
35 applying ../exported-tip.patch
36
36
37 message and committer should be same
37 message and committer should be same
38
38
39 $ hg --cwd b tip
39 $ hg --cwd b tip
40 changeset: 1:1d4bd90af0e4
40 changeset: 1:1d4bd90af0e4
41 tag: tip
41 tag: tip
42 user: someone
42 user: someone
43 date: Thu Jan 01 00:00:01 1970 +0000
43 date: Thu Jan 01 00:00:01 1970 +0000
44 summary: second change
44 summary: second change
45
45
46 $ rm -r b
46 $ rm -r b
47
47
48
48
49 import exported patch with external patcher
49 import exported patch with external patcher
50
50
51 $ cat > dummypatch.py <<EOF
51 $ cat > dummypatch.py <<EOF
52 > print 'patching file a'
52 > print 'patching file a'
53 > file('a', 'wb').write('line2\n')
53 > file('a', 'wb').write('line2\n')
54 > EOF
54 > EOF
55 $ chmod +x dummypatch.py
55 $ chmod +x dummypatch.py
56 $ hg clone -r0 a b
56 $ hg clone -r0 a b
57 adding changesets
57 adding changesets
58 adding manifests
58 adding manifests
59 adding file changes
59 adding file changes
60 added 1 changesets with 2 changes to 2 files
60 added 1 changesets with 2 changes to 2 files
61 updating to branch default
61 updating to branch default
62 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
62 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
63 $ hg --config ui.patch='python ../dummypatch.py' --cwd b import ../exported-tip.patch
63 $ hg --config ui.patch='python ../dummypatch.py' --cwd b import ../exported-tip.patch
64 applying ../exported-tip.patch
64 applying ../exported-tip.patch
65 $ cat b/a
65 $ cat b/a
66 line2
66 line2
67 $ rm -r b
67 $ rm -r b
68
68
69
69
70 import of plain diff should fail without message
70 import of plain diff should fail without message
71
71
72 $ hg clone -r0 a b
72 $ hg clone -r0 a b
73 adding changesets
73 adding changesets
74 adding manifests
74 adding manifests
75 adding file changes
75 adding file changes
76 added 1 changesets with 2 changes to 2 files
76 added 1 changesets with 2 changes to 2 files
77 updating to branch default
77 updating to branch default
78 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
78 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
79 $ hg --cwd b import ../diffed-tip.patch
79 $ hg --cwd b import ../diffed-tip.patch
80 applying ../diffed-tip.patch
80 applying ../diffed-tip.patch
81 abort: empty commit message
81 abort: empty commit message
82 [255]
82 [255]
83 $ rm -r b
83 $ rm -r b
84
84
85
85
86 import of plain diff should be ok with message
86 import of plain diff should be ok with message
87
87
88 $ hg clone -r0 a b
88 $ hg clone -r0 a b
89 adding changesets
89 adding changesets
90 adding manifests
90 adding manifests
91 adding file changes
91 adding file changes
92 added 1 changesets with 2 changes to 2 files
92 added 1 changesets with 2 changes to 2 files
93 updating to branch default
93 updating to branch default
94 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
94 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
95 $ hg --cwd b import -mpatch ../diffed-tip.patch
95 $ hg --cwd b import -mpatch ../diffed-tip.patch
96 applying ../diffed-tip.patch
96 applying ../diffed-tip.patch
97 $ rm -r b
97 $ rm -r b
98
98
99
99
100 import of plain diff with specific date and user
100 import of plain diff with specific date and user
101
101
102 $ hg clone -r0 a b
102 $ hg clone -r0 a b
103 adding changesets
103 adding changesets
104 adding manifests
104 adding manifests
105 adding file changes
105 adding file changes
106 added 1 changesets with 2 changes to 2 files
106 added 1 changesets with 2 changes to 2 files
107 updating to branch default
107 updating to branch default
108 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
108 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
109 $ hg --cwd b import -mpatch -d '1 0' -u 'user@nowhere.net' ../diffed-tip.patch
109 $ hg --cwd b import -mpatch -d '1 0' -u 'user@nowhere.net' ../diffed-tip.patch
110 applying ../diffed-tip.patch
110 applying ../diffed-tip.patch
111 $ hg -R b tip -pv
111 $ hg -R b tip -pv
112 changeset: 1:ca68f19f3a40
112 changeset: 1:ca68f19f3a40
113 tag: tip
113 tag: tip
114 user: user@nowhere.net
114 user: user@nowhere.net
115 date: Thu Jan 01 00:00:01 1970 +0000
115 date: Thu Jan 01 00:00:01 1970 +0000
116 files: a
116 files: a
117 description:
117 description:
118 patch
118 patch
119
119
120
120
121 diff -r 80971e65b431 -r ca68f19f3a40 a
121 diff -r 80971e65b431 -r ca68f19f3a40 a
122 --- a/a Thu Jan 01 00:00:00 1970 +0000
122 --- a/a Thu Jan 01 00:00:00 1970 +0000
123 +++ b/a Thu Jan 01 00:00:01 1970 +0000
123 +++ b/a Thu Jan 01 00:00:01 1970 +0000
124 @@ -1,1 +1,2 @@
124 @@ -1,1 +1,2 @@
125 line 1
125 line 1
126 +line 2
126 +line 2
127
127
128 $ rm -r b
128 $ rm -r b
129
129
130
130
131 import of plain diff should be ok with --no-commit
131 import of plain diff should be ok with --no-commit
132
132
133 $ hg clone -r0 a b
133 $ hg clone -r0 a b
134 adding changesets
134 adding changesets
135 adding manifests
135 adding manifests
136 adding file changes
136 adding file changes
137 added 1 changesets with 2 changes to 2 files
137 added 1 changesets with 2 changes to 2 files
138 updating to branch default
138 updating to branch default
139 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
139 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
140 $ hg --cwd b import --no-commit ../diffed-tip.patch
140 $ hg --cwd b import --no-commit ../diffed-tip.patch
141 applying ../diffed-tip.patch
141 applying ../diffed-tip.patch
142 $ hg --cwd b diff --nodates
142 $ hg --cwd b diff --nodates
143 diff -r 80971e65b431 a
143 diff -r 80971e65b431 a
144 --- a/a
144 --- a/a
145 +++ b/a
145 +++ b/a
146 @@ -1,1 +1,2 @@
146 @@ -1,1 +1,2 @@
147 line 1
147 line 1
148 +line 2
148 +line 2
149 $ rm -r b
149 $ rm -r b
150
150
151
151
152 import of malformed plain diff should fail
152 import of malformed plain diff should fail
153
153
154 $ hg clone -r0 a b
154 $ hg clone -r0 a b
155 adding changesets
155 adding changesets
156 adding manifests
156 adding manifests
157 adding file changes
157 adding file changes
158 added 1 changesets with 2 changes to 2 files
158 added 1 changesets with 2 changes to 2 files
159 updating to branch default
159 updating to branch default
160 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
160 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
161 $ sed 's/1,1/foo/' < diffed-tip.patch > broken.patch
161 $ sed 's/1,1/foo/' < diffed-tip.patch > broken.patch
162 $ hg --cwd b import -mpatch ../broken.patch
162 $ hg --cwd b import -mpatch ../broken.patch
163 applying ../broken.patch
163 applying ../broken.patch
164 abort: bad hunk #1
164 abort: bad hunk #1
165 [255]
165 [255]
166 $ rm -r b
166 $ rm -r b
167
167
168
168
169 hg -R repo import
169 hg -R repo import
170 put the clone in a subdir - having a directory named "a"
170 put the clone in a subdir - having a directory named "a"
171 used to hide a bug.
171 used to hide a bug.
172
172
173 $ mkdir dir
173 $ mkdir dir
174 $ hg clone -r0 a dir/b
174 $ hg clone -r0 a dir/b
175 adding changesets
175 adding changesets
176 adding manifests
176 adding manifests
177 adding file changes
177 adding file changes
178 added 1 changesets with 2 changes to 2 files
178 added 1 changesets with 2 changes to 2 files
179 updating to branch default
179 updating to branch default
180 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
180 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
181 $ cd dir
181 $ cd dir
182 $ hg -R b import ../exported-tip.patch
182 $ hg -R b import ../exported-tip.patch
183 applying ../exported-tip.patch
183 applying ../exported-tip.patch
184 $ cd ..
184 $ cd ..
185 $ rm -r dir
185 $ rm -r dir
186
186
187
187
188 import from stdin
188 import from stdin
189
189
190 $ hg clone -r0 a b
190 $ hg clone -r0 a b
191 adding changesets
191 adding changesets
192 adding manifests
192 adding manifests
193 adding file changes
193 adding file changes
194 added 1 changesets with 2 changes to 2 files
194 added 1 changesets with 2 changes to 2 files
195 updating to branch default
195 updating to branch default
196 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
196 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
197 $ hg --cwd b import - < exported-tip.patch
197 $ hg --cwd b import - < exported-tip.patch
198 applying patch from stdin
198 applying patch from stdin
199 $ rm -r b
199 $ rm -r b
200
200
201
201
202 import two patches in one stream
202 import two patches in one stream
203
203
204 $ hg init b
204 $ hg init b
205 $ hg --cwd a export 0:tip | hg --cwd b import -
205 $ hg --cwd a export 0:tip | hg --cwd b import -
206 applying patch from stdin
206 applying patch from stdin
207 $ hg --cwd a id
207 $ hg --cwd a id
208 1d4bd90af0e4 tip
208 1d4bd90af0e4 tip
209 $ hg --cwd b id
209 $ hg --cwd b id
210 1d4bd90af0e4 tip
210 1d4bd90af0e4 tip
211 $ rm -r b
211 $ rm -r b
212
212
213
213
214 override commit message
214 override commit message
215
215
216 $ hg clone -r0 a b
216 $ hg clone -r0 a b
217 adding changesets
217 adding changesets
218 adding manifests
218 adding manifests
219 adding file changes
219 adding file changes
220 added 1 changesets with 2 changes to 2 files
220 added 1 changesets with 2 changes to 2 files
221 updating to branch default
221 updating to branch default
222 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
222 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
223 $ hg --cwd b import -m 'override' - < exported-tip.patch
223 $ hg --cwd b import -m 'override' - < exported-tip.patch
224 applying patch from stdin
224 applying patch from stdin
225 $ hg --cwd b tip | grep override
225 $ hg --cwd b tip | grep override
226 summary: override
226 summary: override
227 $ rm -r b
227 $ rm -r b
228
228
229 $ cat > mkmsg.py <<EOF
229 $ cat > mkmsg.py <<EOF
230 > import email.Message, sys
230 > import email.Message, sys
231 > msg = email.Message.Message()
231 > msg = email.Message.Message()
232 > patch = open(sys.argv[1], 'rb').read()
232 > patch = open(sys.argv[1], 'rb').read()
233 > msg.set_payload('email commit message\n' + patch)
233 > msg.set_payload('email commit message\n' + patch)
234 > msg['Subject'] = 'email patch'
234 > msg['Subject'] = 'email patch'
235 > msg['From'] = 'email patcher'
235 > msg['From'] = 'email patcher'
236 > sys.stdout.write(msg.as_string())
236 > file(sys.argv[2], 'wb').write(msg.as_string())
237 > EOF
237 > EOF
238
238
239
239
240 plain diff in email, subject, message body
240 plain diff in email, subject, message body
241
241
242 $ hg clone -r0 a b
242 $ hg clone -r0 a b
243 adding changesets
243 adding changesets
244 adding manifests
244 adding manifests
245 adding file changes
245 adding file changes
246 added 1 changesets with 2 changes to 2 files
246 added 1 changesets with 2 changes to 2 files
247 updating to branch default
247 updating to branch default
248 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
248 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
249 $ python mkmsg.py diffed-tip.patch > msg.patch
249 $ python mkmsg.py diffed-tip.patch msg.patch
250 $ hg --cwd b import ../msg.patch
250 $ hg --cwd b import ../msg.patch
251 applying ../msg.patch
251 applying ../msg.patch
252 $ hg --cwd b tip | grep email
252 $ hg --cwd b tip | grep email
253 user: email patcher
253 user: email patcher
254 summary: email patch
254 summary: email patch
255 $ rm -r b
255 $ rm -r b
256
256
257
257
258 plain diff in email, no subject, message body
258 plain diff in email, no subject, message body
259
259
260 $ hg clone -r0 a b
260 $ hg clone -r0 a b
261 adding changesets
261 adding changesets
262 adding manifests
262 adding manifests
263 adding file changes
263 adding file changes
264 added 1 changesets with 2 changes to 2 files
264 added 1 changesets with 2 changes to 2 files
265 updating to branch default
265 updating to branch default
266 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
266 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
267 $ grep -v '^Subject:' msg.patch | hg --cwd b import -
267 $ grep -v '^Subject:' msg.patch | hg --cwd b import -
268 applying patch from stdin
268 applying patch from stdin
269 $ rm -r b
269 $ rm -r b
270
270
271
271
272 plain diff in email, subject, no message body
272 plain diff in email, subject, no message body
273
273
274 $ hg clone -r0 a b
274 $ hg clone -r0 a b
275 adding changesets
275 adding changesets
276 adding manifests
276 adding manifests
277 adding file changes
277 adding file changes
278 added 1 changesets with 2 changes to 2 files
278 added 1 changesets with 2 changes to 2 files
279 updating to branch default
279 updating to branch default
280 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
280 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
281 $ grep -v '^email ' msg.patch | hg --cwd b import -
281 $ grep -v '^email ' msg.patch | hg --cwd b import -
282 applying patch from stdin
282 applying patch from stdin
283 $ rm -r b
283 $ rm -r b
284
284
285
285
286 plain diff in email, no subject, no message body, should fail
286 plain diff in email, no subject, no message body, should fail
287
287
288 $ hg clone -r0 a b
288 $ hg clone -r0 a b
289 adding changesets
289 adding changesets
290 adding manifests
290 adding manifests
291 adding file changes
291 adding file changes
292 added 1 changesets with 2 changes to 2 files
292 added 1 changesets with 2 changes to 2 files
293 updating to branch default
293 updating to branch default
294 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
294 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
295 $ egrep -v '^(Subject|email)' msg.patch | hg --cwd b import -
295 $ egrep -v '^(Subject|email)' msg.patch | hg --cwd b import -
296 applying patch from stdin
296 applying patch from stdin
297 abort: empty commit message
297 abort: empty commit message
298 [255]
298 [255]
299 $ rm -r b
299 $ rm -r b
300
300
301
301
302 hg export in email, should use patch header
302 hg export in email, should use patch header
303
303
304 $ hg clone -r0 a b
304 $ hg clone -r0 a b
305 adding changesets
305 adding changesets
306 adding manifests
306 adding manifests
307 adding file changes
307 adding file changes
308 added 1 changesets with 2 changes to 2 files
308 added 1 changesets with 2 changes to 2 files
309 updating to branch default
309 updating to branch default
310 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
310 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
311 $ python mkmsg.py exported-tip.patch | hg --cwd b import -
311 $ python mkmsg.py exported-tip.patch msg.patch
312 $ cat msg.patch | hg --cwd b import -
312 applying patch from stdin
313 applying patch from stdin
313 $ hg --cwd b tip | grep second
314 $ hg --cwd b tip | grep second
314 summary: second change
315 summary: second change
315 $ rm -r b
316 $ rm -r b
316
317
317
318
318 subject: duplicate detection, removal of [PATCH]
319 subject: duplicate detection, removal of [PATCH]
319 The '---' tests the gitsendmail handling without proper mail headers
320 The '---' tests the gitsendmail handling without proper mail headers
320
321
321 $ cat > mkmsg2.py <<EOF
322 $ cat > mkmsg2.py <<EOF
322 > import email.Message, sys
323 > import email.Message, sys
323 > msg = email.Message.Message()
324 > msg = email.Message.Message()
324 > patch = open(sys.argv[1], 'rb').read()
325 > patch = open(sys.argv[1], 'rb').read()
325 > msg.set_payload('email patch\n\nnext line\n---\n' + patch)
326 > msg.set_payload('email patch\n\nnext line\n---\n' + patch)
326 > msg['Subject'] = '[PATCH] email patch'
327 > msg['Subject'] = '[PATCH] email patch'
327 > msg['From'] = 'email patcher'
328 > msg['From'] = 'email patcher'
328 > sys.stdout.write(msg.as_string())
329 > file(sys.argv[2], 'wb').write(msg.as_string())
329 > EOF
330 > EOF
330
331
331
332
332 plain diff in email, [PATCH] subject, message body with subject
333 plain diff in email, [PATCH] subject, message body with subject
333
334
334 $ hg clone -r0 a b
335 $ hg clone -r0 a b
335 adding changesets
336 adding changesets
336 adding manifests
337 adding manifests
337 adding file changes
338 adding file changes
338 added 1 changesets with 2 changes to 2 files
339 added 1 changesets with 2 changes to 2 files
339 updating to branch default
340 updating to branch default
340 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
341 $ python mkmsg2.py diffed-tip.patch | hg --cwd b import -
342 $ python mkmsg2.py diffed-tip.patch msg.patch
343 $ cat msg.patch | hg --cwd b import -
342 applying patch from stdin
344 applying patch from stdin
343 $ hg --cwd b tip --template '{desc}\n'
345 $ hg --cwd b tip --template '{desc}\n'
344 email patch
346 email patch
345
347
346 next line
348 next line
347 ---
349 ---
348 $ rm -r b
350 $ rm -r b
349
351
350
352
351 Issue963: Parent of working dir incorrect after import of multiple
353 Issue963: Parent of working dir incorrect after import of multiple
352 patches and rollback
354 patches and rollback
353
355
354 We weren't backing up the correct dirstate file when importing many
356 We weren't backing up the correct dirstate file when importing many
355 patches: import patch1 patch2; rollback
357 patches: import patch1 patch2; rollback
356
358
357 $ echo line 3 >> a/a
359 $ echo line 3 >> a/a
358 $ hg --cwd a ci -m'third change'
360 $ hg --cwd a ci -m'third change'
359 $ hg --cwd a export -o '../patch%R' 1 2
361 $ hg --cwd a export -o '../patch%R' 1 2
360 $ hg clone -qr0 a b
362 $ hg clone -qr0 a b
361 $ hg --cwd b parents --template 'parent: {rev}\n'
363 $ hg --cwd b parents --template 'parent: {rev}\n'
362 parent: 0
364 parent: 0
363 $ hg --cwd b import -v ../patch1 ../patch2
365 $ hg --cwd b import -v ../patch1 ../patch2
364 applying ../patch1
366 applying ../patch1
365 patching file a
367 patching file a
366 a
368 a
367 created 1d4bd90af0e4
369 created 1d4bd90af0e4
368 applying ../patch2
370 applying ../patch2
369 patching file a
371 patching file a
370 a
372 a
371 created 6d019af21222
373 created 6d019af21222
372 $ hg --cwd b rollback
374 $ hg --cwd b rollback
373 repository tip rolled back to revision 0 (undo import)
375 repository tip rolled back to revision 0 (undo import)
374 working directory now based on revision 0
376 working directory now based on revision 0
375 $ hg --cwd b parents --template 'parent: {rev}\n'
377 $ hg --cwd b parents --template 'parent: {rev}\n'
376 parent: 0
378 parent: 0
377 $ rm -r b
379 $ rm -r b
378
380
379
381
380 importing a patch in a subdirectory failed at the commit stage
382 importing a patch in a subdirectory failed at the commit stage
381
383
382 $ echo line 2 >> a/d1/d2/a
384 $ echo line 2 >> a/d1/d2/a
383 $ hg --cwd a ci -u someoneelse -d '1 0' -m'subdir change'
385 $ hg --cwd a ci -u someoneelse -d '1 0' -m'subdir change'
384
386
385 hg import in a subdirectory
387 hg import in a subdirectory
386
388
387 $ hg clone -r0 a b
389 $ hg clone -r0 a b
388 adding changesets
390 adding changesets
389 adding manifests
391 adding manifests
390 adding file changes
392 adding file changes
391 added 1 changesets with 2 changes to 2 files
393 added 1 changesets with 2 changes to 2 files
392 updating to branch default
394 updating to branch default
393 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
395 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
394 $ hg --cwd a export tip > tmp
396 $ hg --cwd a export tip > tmp
395 $ sed -e 's/d1\/d2\///' < tmp > subdir-tip.patch
397 $ sed -e 's/d1\/d2\///' < tmp > subdir-tip.patch
396 $ dir=`pwd`
398 $ dir=`pwd`
397 $ cd b/d1/d2 2>&1 > /dev/null
399 $ cd b/d1/d2 2>&1 > /dev/null
398 $ hg import ../../../subdir-tip.patch
400 $ hg import ../../../subdir-tip.patch
399 applying ../../../subdir-tip.patch
401 applying ../../../subdir-tip.patch
400 $ cd "$dir"
402 $ cd "$dir"
401
403
402 message should be 'subdir change'
404 message should be 'subdir change'
403 committer should be 'someoneelse'
405 committer should be 'someoneelse'
404
406
405 $ hg --cwd b tip
407 $ hg --cwd b tip
406 changeset: 1:3577f5aea227
408 changeset: 1:3577f5aea227
407 tag: tip
409 tag: tip
408 user: someoneelse
410 user: someoneelse
409 date: Thu Jan 01 00:00:01 1970 +0000
411 date: Thu Jan 01 00:00:01 1970 +0000
410 summary: subdir change
412 summary: subdir change
411
413
412
414
413 should be empty
415 should be empty
414
416
415 $ hg --cwd b status
417 $ hg --cwd b status
416
418
417
419
418 Test fuzziness (ambiguous patch location, fuzz=2)
420 Test fuzziness (ambiguous patch location, fuzz=2)
419
421
420 $ hg init fuzzy
422 $ hg init fuzzy
421 $ cd fuzzy
423 $ cd fuzzy
422 $ echo line1 > a
424 $ echo line1 > a
423 $ echo line0 >> a
425 $ echo line0 >> a
424 $ echo line3 >> a
426 $ echo line3 >> a
425 $ hg ci -Am adda
427 $ hg ci -Am adda
426 adding a
428 adding a
427 $ echo line1 > a
429 $ echo line1 > a
428 $ echo line2 >> a
430 $ echo line2 >> a
429 $ echo line0 >> a
431 $ echo line0 >> a
430 $ echo line3 >> a
432 $ echo line3 >> a
431 $ hg ci -m change a
433 $ hg ci -m change a
432 $ hg export tip > fuzzy-tip.patch
434 $ hg export tip > fuzzy-tip.patch
433 $ hg up -C 0
435 $ hg up -C 0
434 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
436 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
435 $ echo line1 > a
437 $ echo line1 > a
436 $ echo line0 >> a
438 $ echo line0 >> a
437 $ echo line1 >> a
439 $ echo line1 >> a
438 $ echo line0 >> a
440 $ echo line0 >> a
439 $ hg ci -m brancha
441 $ hg ci -m brancha
440 created new head
442 created new head
441 $ hg import --no-commit -v fuzzy-tip.patch
443 $ hg import --no-commit -v fuzzy-tip.patch
442 applying fuzzy-tip.patch
444 applying fuzzy-tip.patch
443 patching file a
445 patching file a
444 Hunk #1 succeeded at 1 with fuzz 2 (offset -2 lines).
446 Hunk #1 succeeded at 1 with fuzz 2 (offset -2 lines).
445 applied to working directory
447 applied to working directory
446 $ hg revert -a
448 $ hg revert -a
447 reverting a
449 reverting a
448
450
449
451
450 import with --no-commit should have written .hg/last-message.txt
452 import with --no-commit should have written .hg/last-message.txt
451
453
452 $ cat .hg/last-message.txt
454 $ cat .hg/last-message.txt
453 change (no-eol)
455 change (no-eol)
454
456
455
457
456 test fuzziness with eol=auto
458 test fuzziness with eol=auto
457
459
458 $ hg --config patch.eol=auto import --no-commit -v fuzzy-tip.patch
460 $ hg --config patch.eol=auto import --no-commit -v fuzzy-tip.patch
459 applying fuzzy-tip.patch
461 applying fuzzy-tip.patch
460 patching file a
462 patching file a
461 Hunk #1 succeeded at 1 with fuzz 2 (offset -2 lines).
463 Hunk #1 succeeded at 1 with fuzz 2 (offset -2 lines).
462 applied to working directory
464 applied to working directory
463 $ cd ..
465 $ cd ..
464
466
465
467
466 Test hunk touching empty files (issue906)
468 Test hunk touching empty files (issue906)
467
469
468 $ hg init empty
470 $ hg init empty
469 $ cd empty
471 $ cd empty
470 $ touch a
472 $ touch a
471 $ touch b1
473 $ touch b1
472 $ touch c1
474 $ touch c1
473 $ echo d > d
475 $ echo d > d
474 $ hg ci -Am init
476 $ hg ci -Am init
475 adding a
477 adding a
476 adding b1
478 adding b1
477 adding c1
479 adding c1
478 adding d
480 adding d
479 $ echo a > a
481 $ echo a > a
480 $ echo b > b1
482 $ echo b > b1
481 $ hg mv b1 b2
483 $ hg mv b1 b2
482 $ echo c > c1
484 $ echo c > c1
483 $ hg copy c1 c2
485 $ hg copy c1 c2
484 $ rm d
486 $ rm d
485 $ touch d
487 $ touch d
486 $ hg diff --git
488 $ hg diff --git
487 diff --git a/a b/a
489 diff --git a/a b/a
488 --- a/a
490 --- a/a
489 +++ b/a
491 +++ b/a
490 @@ -0,0 +1,1 @@
492 @@ -0,0 +1,1 @@
491 +a
493 +a
492 diff --git a/b1 b/b2
494 diff --git a/b1 b/b2
493 rename from b1
495 rename from b1
494 rename to b2
496 rename to b2
495 --- a/b1
497 --- a/b1
496 +++ b/b2
498 +++ b/b2
497 @@ -0,0 +1,1 @@
499 @@ -0,0 +1,1 @@
498 +b
500 +b
499 diff --git a/c1 b/c1
501 diff --git a/c1 b/c1
500 --- a/c1
502 --- a/c1
501 +++ b/c1
503 +++ b/c1
502 @@ -0,0 +1,1 @@
504 @@ -0,0 +1,1 @@
503 +c
505 +c
504 diff --git a/c1 b/c2
506 diff --git a/c1 b/c2
505 copy from c1
507 copy from c1
506 copy to c2
508 copy to c2
507 --- a/c1
509 --- a/c1
508 +++ b/c2
510 +++ b/c2
509 @@ -0,0 +1,1 @@
511 @@ -0,0 +1,1 @@
510 +c
512 +c
511 diff --git a/d b/d
513 diff --git a/d b/d
512 --- a/d
514 --- a/d
513 +++ b/d
515 +++ b/d
514 @@ -1,1 +0,0 @@
516 @@ -1,1 +0,0 @@
515 -d
517 -d
516 $ hg ci -m empty
518 $ hg ci -m empty
517 $ hg export --git tip > empty.diff
519 $ hg export --git tip > empty.diff
518 $ hg up -C 0
520 $ hg up -C 0
519 4 files updated, 0 files merged, 2 files removed, 0 files unresolved
521 4 files updated, 0 files merged, 2 files removed, 0 files unresolved
520 $ hg import empty.diff
522 $ hg import empty.diff
521 applying empty.diff
523 applying empty.diff
522 $ for name in a b1 b2 c1 c2 d; do
524 $ for name in a b1 b2 c1 c2 d; do
523 > echo % $name file
525 > echo % $name file
524 > test -f $name && cat $name
526 > test -f $name && cat $name
525 > done
527 > done
526 % a file
528 % a file
527 a
529 a
528 % b1 file
530 % b1 file
529 % b2 file
531 % b2 file
530 b
532 b
531 % c1 file
533 % c1 file
532 c
534 c
533 % c2 file
535 % c2 file
534 c
536 c
535 % d file
537 % d file
536 $ cd ..
538 $ cd ..
537
539
538
540
539 Test importing a patch ending with a binary file removal
541 Test importing a patch ending with a binary file removal
540
542
541 $ hg init binaryremoval
543 $ hg init binaryremoval
542 $ cd binaryremoval
544 $ cd binaryremoval
543 $ echo a > a
545 $ echo a > a
544 $ python -c "file('b', 'wb').write('a\x00b')"
546 $ python -c "file('b', 'wb').write('a\x00b')"
545 $ hg ci -Am addall
547 $ hg ci -Am addall
546 adding a
548 adding a
547 adding b
549 adding b
548 $ hg rm a
550 $ hg rm a
549 $ hg rm b
551 $ hg rm b
550 $ hg st
552 $ hg st
551 R a
553 R a
552 R b
554 R b
553 $ hg ci -m remove
555 $ hg ci -m remove
554 $ hg export --git . > remove.diff
556 $ hg export --git . > remove.diff
555 $ cat remove.diff | grep git
557 $ cat remove.diff | grep git
556 diff --git a/a b/a
558 diff --git a/a b/a
557 diff --git a/b b/b
559 diff --git a/b b/b
558 $ hg up -C 0
560 $ hg up -C 0
559 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
561 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
560 $ hg import remove.diff
562 $ hg import remove.diff
561 applying remove.diff
563 applying remove.diff
562 $ hg manifest
564 $ hg manifest
563 $ cd ..
565 $ cd ..
564
566
565
567
566 Issue927: test update+rename with common name
568 Issue927: test update+rename with common name
567
569
568 $ hg init t
570 $ hg init t
569 $ cd t
571 $ cd t
570 $ touch a
572 $ touch a
571 $ hg ci -Am t
573 $ hg ci -Am t
572 adding a
574 adding a
573 $ echo a > a
575 $ echo a > a
574
576
575 Here, bfile.startswith(afile)
577 Here, bfile.startswith(afile)
576
578
577 $ hg copy a a2
579 $ hg copy a a2
578 $ hg ci -m copya
580 $ hg ci -m copya
579 $ hg export --git tip > copy.diff
581 $ hg export --git tip > copy.diff
580 $ hg up -C 0
582 $ hg up -C 0
581 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
583 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
582 $ hg import copy.diff
584 $ hg import copy.diff
583 applying copy.diff
585 applying copy.diff
584
586
585 a should contain an 'a'
587 a should contain an 'a'
586
588
587 $ cat a
589 $ cat a
588 a
590 a
589
591
590 and a2 should have duplicated it
592 and a2 should have duplicated it
591
593
592 $ cat a2
594 $ cat a2
593 a
595 a
594 $ cd ..
596 $ cd ..
595
597
596
598
597 test -p0
599 test -p0
598
600
599 $ hg init p0
601 $ hg init p0
600 $ cd p0
602 $ cd p0
601 $ echo a > a
603 $ echo a > a
602 $ hg ci -Am t
604 $ hg ci -Am t
603 adding a
605 adding a
604 $ hg import -p0 - << EOF
606 $ hg import -p0 - << EOF
605 > foobar
607 > foobar
606 > --- a Sat Apr 12 22:43:58 2008 -0400
608 > --- a Sat Apr 12 22:43:58 2008 -0400
607 > +++ a Sat Apr 12 22:44:05 2008 -0400
609 > +++ a Sat Apr 12 22:44:05 2008 -0400
608 > @@ -1,1 +1,1 @@
610 > @@ -1,1 +1,1 @@
609 > -a
611 > -a
610 > +bb
612 > +bb
611 > EOF
613 > EOF
612 applying patch from stdin
614 applying patch from stdin
613 $ hg status
615 $ hg status
614 $ cat a
616 $ cat a
615 bb
617 bb
616 $ cd ..
618 $ cd ..
617
619
618
620
619 test paths outside repo root
621 test paths outside repo root
620
622
621 $ mkdir outside
623 $ mkdir outside
622 $ touch outside/foo
624 $ touch outside/foo
623 $ hg init inside
625 $ hg init inside
624 $ cd inside
626 $ cd inside
625 $ hg import - <<EOF
627 $ hg import - <<EOF
626 > diff --git a/a b/b
628 > diff --git a/a b/b
627 > rename from ../outside/foo
629 > rename from ../outside/foo
628 > rename to bar
630 > rename to bar
629 > EOF
631 > EOF
630 applying patch from stdin
632 applying patch from stdin
631 abort: path contains illegal component: ../outside/foo
633 abort: path contains illegal component: ../outside/foo
632 [255]
634 [255]
633 $ cd ..
635 $ cd ..
634
636
635
637
636 test import with similarity and git and strip (issue295 et al.)
638 test import with similarity and git and strip (issue295 et al.)
637
639
638 $ hg init sim
640 $ hg init sim
639 $ cd sim
641 $ cd sim
640 $ echo 'this is a test' > a
642 $ echo 'this is a test' > a
641 $ hg ci -Ama
643 $ hg ci -Ama
642 adding a
644 adding a
643 $ cat > ../rename.diff <<EOF
645 $ cat > ../rename.diff <<EOF
644 > diff --git a/foo/a b/foo/a
646 > diff --git a/foo/a b/foo/a
645 > deleted file mode 100644
647 > deleted file mode 100644
646 > --- a/foo/a
648 > --- a/foo/a
647 > +++ /dev/null
649 > +++ /dev/null
648 > @@ -1,1 +0,0 @@
650 > @@ -1,1 +0,0 @@
649 > -this is a test
651 > -this is a test
650 > diff --git a/foo/b b/foo/b
652 > diff --git a/foo/b b/foo/b
651 > new file mode 100644
653 > new file mode 100644
652 > --- /dev/null
654 > --- /dev/null
653 > +++ b/foo/b
655 > +++ b/foo/b
654 > @@ -0,0 +1,2 @@
656 > @@ -0,0 +1,2 @@
655 > +this is a test
657 > +this is a test
656 > +foo
658 > +foo
657 > EOF
659 > EOF
658 $ hg import --no-commit -v -s 1 ../rename.diff -p2
660 $ hg import --no-commit -v -s 1 ../rename.diff -p2
659 applying ../rename.diff
661 applying ../rename.diff
660 patching file a
662 patching file a
661 patching file b
663 patching file b
662 removing a
664 removing a
663 adding b
665 adding b
664 recording removal of a as rename to b (88% similar)
666 recording removal of a as rename to b (88% similar)
665 applied to working directory
667 applied to working directory
666 $ hg st -C
668 $ hg st -C
667 A b
669 A b
668 a
670 a
669 R a
671 R a
670 $ hg revert -a
672 $ hg revert -a
671 undeleting a
673 undeleting a
672 forgetting b
674 forgetting b
673 $ rm b
675 $ rm b
674 $ hg import --no-commit -v -s 100 ../rename.diff -p2
676 $ hg import --no-commit -v -s 100 ../rename.diff -p2
675 applying ../rename.diff
677 applying ../rename.diff
676 patching file a
678 patching file a
677 patching file b
679 patching file b
678 removing a
680 removing a
679 adding b
681 adding b
680 applied to working directory
682 applied to working directory
681 $ hg st -C
683 $ hg st -C
682 A b
684 A b
683 R a
685 R a
684 $ cd ..
686 $ cd ..
685
687
686
688
687 Issue1495: add empty file from the end of patch
689 Issue1495: add empty file from the end of patch
688
690
689 $ hg init addemptyend
691 $ hg init addemptyend
690 $ cd addemptyend
692 $ cd addemptyend
691 $ touch a
693 $ touch a
692 $ hg addremove
694 $ hg addremove
693 adding a
695 adding a
694 $ hg ci -m "commit"
696 $ hg ci -m "commit"
695 $ cat > a.patch <<EOF
697 $ cat > a.patch <<EOF
696 > add a, b
698 > add a, b
697 > diff --git a/a b/a
699 > diff --git a/a b/a
698 > --- a/a
700 > --- a/a
699 > +++ b/a
701 > +++ b/a
700 > @@ -0,0 +1,1 @@
702 > @@ -0,0 +1,1 @@
701 > +a
703 > +a
702 > diff --git a/b b/b
704 > diff --git a/b b/b
703 > new file mode 100644
705 > new file mode 100644
704 > EOF
706 > EOF
705 $ hg import --no-commit a.patch
707 $ hg import --no-commit a.patch
706 applying a.patch
708 applying a.patch
707
709
708 apply a good patch followed by an empty patch (mainly to ensure
710 apply a good patch followed by an empty patch (mainly to ensure
709 that dirstate is *not* updated when import crashes)
711 that dirstate is *not* updated when import crashes)
710 $ hg update -q -C .
712 $ hg update -q -C .
711 $ rm b
713 $ rm b
712 $ touch empty.patch
714 $ touch empty.patch
713 $ hg import a.patch empty.patch
715 $ hg import a.patch empty.patch
714 applying a.patch
716 applying a.patch
715 applying empty.patch
717 applying empty.patch
716 transaction abort!
718 transaction abort!
717 rollback completed
719 rollback completed
718 abort: empty.patch: no diffs found
720 abort: empty.patch: no diffs found
719 [255]
721 [255]
720 $ hg tip --template '{rev} {desc|firstline}\n'
722 $ hg tip --template '{rev} {desc|firstline}\n'
721 0 commit
723 0 commit
722 $ hg -q status
724 $ hg -q status
723 M a
725 M a
724 $ cd ..
726 $ cd ..
725
727
726 create file when source is not /dev/null
728 create file when source is not /dev/null
727
729
728 $ cat > create.patch <<EOF
730 $ cat > create.patch <<EOF
729 > diff -Naur proj-orig/foo proj-new/foo
731 > diff -Naur proj-orig/foo proj-new/foo
730 > --- proj-orig/foo 1969-12-31 16:00:00.000000000 -0800
732 > --- proj-orig/foo 1969-12-31 16:00:00.000000000 -0800
731 > +++ proj-new/foo 2009-07-17 16:50:45.801368000 -0700
733 > +++ proj-new/foo 2009-07-17 16:50:45.801368000 -0700
732 > @@ -0,0 +1,1 @@
734 > @@ -0,0 +1,1 @@
733 > +a
735 > +a
734 > EOF
736 > EOF
735
737
736 some people have patches like the following too
738 some people have patches like the following too
737
739
738 $ cat > create2.patch <<EOF
740 $ cat > create2.patch <<EOF
739 > diff -Naur proj-orig/foo proj-new/foo
741 > diff -Naur proj-orig/foo proj-new/foo
740 > --- proj-orig/foo.orig 1969-12-31 16:00:00.000000000 -0800
742 > --- proj-orig/foo.orig 1969-12-31 16:00:00.000000000 -0800
741 > +++ proj-new/foo 2009-07-17 16:50:45.801368000 -0700
743 > +++ proj-new/foo 2009-07-17 16:50:45.801368000 -0700
742 > @@ -0,0 +1,1 @@
744 > @@ -0,0 +1,1 @@
743 > +a
745 > +a
744 > EOF
746 > EOF
745 $ hg init oddcreate
747 $ hg init oddcreate
746 $ cd oddcreate
748 $ cd oddcreate
747 $ hg import --no-commit ../create.patch
749 $ hg import --no-commit ../create.patch
748 applying ../create.patch
750 applying ../create.patch
749 $ cat foo
751 $ cat foo
750 a
752 a
751 $ rm foo
753 $ rm foo
752 $ hg revert foo
754 $ hg revert foo
753 $ hg import --no-commit ../create2.patch
755 $ hg import --no-commit ../create2.patch
754 applying ../create2.patch
756 applying ../create2.patch
755 $ cat foo
757 $ cat foo
756 a
758 a
757
759
758
760
759 Issue1859: first line mistaken for email headers
761 Issue1859: first line mistaken for email headers
760
762
761 $ hg init emailconfusion
763 $ hg init emailconfusion
762 $ cd emailconfusion
764 $ cd emailconfusion
763 $ cat > a.patch <<EOF
765 $ cat > a.patch <<EOF
764 > module: summary
766 > module: summary
765 >
767 >
766 > description
768 > description
767 >
769 >
768 >
770 >
769 > diff -r 000000000000 -r 9b4c1e343b55 test.txt
771 > diff -r 000000000000 -r 9b4c1e343b55 test.txt
770 > --- /dev/null
772 > --- /dev/null
771 > +++ b/a
773 > +++ b/a
772 > @@ -0,0 +1,1 @@
774 > @@ -0,0 +1,1 @@
773 > +a
775 > +a
774 > EOF
776 > EOF
775 $ hg import -d '0 0' a.patch
777 $ hg import -d '0 0' a.patch
776 applying a.patch
778 applying a.patch
777 $ hg parents -v
779 $ hg parents -v
778 changeset: 0:5a681217c0ad
780 changeset: 0:5a681217c0ad
779 tag: tip
781 tag: tip
780 user: test
782 user: test
781 date: Thu Jan 01 00:00:00 1970 +0000
783 date: Thu Jan 01 00:00:00 1970 +0000
782 files: a
784 files: a
783 description:
785 description:
784 module: summary
786 module: summary
785
787
786 description
788 description
787
789
788
790
789 $ cd ..
791 $ cd ..
790
792
791
793
792 --- in commit message
794 --- in commit message
793
795
794 $ hg init commitconfusion
796 $ hg init commitconfusion
795 $ cd commitconfusion
797 $ cd commitconfusion
796 $ cat > a.patch <<EOF
798 $ cat > a.patch <<EOF
797 > module: summary
799 > module: summary
798 >
800 >
799 > --- description
801 > --- description
800 >
802 >
801 > diff --git a/a b/a
803 > diff --git a/a b/a
802 > new file mode 100644
804 > new file mode 100644
803 > --- /dev/null
805 > --- /dev/null
804 > +++ b/a
806 > +++ b/a
805 > @@ -0,0 +1,1 @@
807 > @@ -0,0 +1,1 @@
806 > +a
808 > +a
807 > EOF
809 > EOF
808 > hg import -d '0 0' a.patch
810 > hg import -d '0 0' a.patch
809 > hg parents -v
811 > hg parents -v
810 > cd ..
812 > cd ..
811 >
813 >
812 > echo '% tricky header splitting'
814 > echo '% tricky header splitting'
813 > cat > trickyheaders.patch <<EOF
815 > cat > trickyheaders.patch <<EOF
814 > From: User A <user@a>
816 > From: User A <user@a>
815 > Subject: [PATCH] from: tricky!
817 > Subject: [PATCH] from: tricky!
816 >
818 >
817 > # HG changeset patch
819 > # HG changeset patch
818 > # User User B
820 > # User User B
819 > # Date 1266264441 18000
821 > # Date 1266264441 18000
820 > # Branch stable
822 > # Branch stable
821 > # Node ID f2be6a1170ac83bf31cb4ae0bad00d7678115bc0
823 > # Node ID f2be6a1170ac83bf31cb4ae0bad00d7678115bc0
822 > # Parent 0000000000000000000000000000000000000000
824 > # Parent 0000000000000000000000000000000000000000
823 > from: tricky!
825 > from: tricky!
824 >
826 >
825 > That is not a header.
827 > That is not a header.
826 >
828 >
827 > diff -r 000000000000 -r f2be6a1170ac foo
829 > diff -r 000000000000 -r f2be6a1170ac foo
828 > --- /dev/null
830 > --- /dev/null
829 > +++ b/foo
831 > +++ b/foo
830 > @@ -0,0 +1,1 @@
832 > @@ -0,0 +1,1 @@
831 > +foo
833 > +foo
832 > EOF
834 > EOF
833 applying a.patch
835 applying a.patch
834 changeset: 0:f34d9187897d
836 changeset: 0:f34d9187897d
835 tag: tip
837 tag: tip
836 user: test
838 user: test
837 date: Thu Jan 01 00:00:00 1970 +0000
839 date: Thu Jan 01 00:00:00 1970 +0000
838 files: a
840 files: a
839 description:
841 description:
840 module: summary
842 module: summary
841
843
842
844
843 % tricky header splitting
845 % tricky header splitting
844
846
845 $ hg init trickyheaders
847 $ hg init trickyheaders
846 $ cd trickyheaders
848 $ cd trickyheaders
847 $ hg import -d '0 0' ../trickyheaders.patch
849 $ hg import -d '0 0' ../trickyheaders.patch
848 applying ../trickyheaders.patch
850 applying ../trickyheaders.patch
849 $ hg export --git tip
851 $ hg export --git tip
850 # HG changeset patch
852 # HG changeset patch
851 # User User B
853 # User User B
852 # Date 0 0
854 # Date 0 0
853 # Node ID eb56ab91903632294ac504838508cb370c0901d2
855 # Node ID eb56ab91903632294ac504838508cb370c0901d2
854 # Parent 0000000000000000000000000000000000000000
856 # Parent 0000000000000000000000000000000000000000
855 from: tricky!
857 from: tricky!
856
858
857 That is not a header.
859 That is not a header.
858
860
859 diff --git a/foo b/foo
861 diff --git a/foo b/foo
860 new file mode 100644
862 new file mode 100644
861 --- /dev/null
863 --- /dev/null
862 +++ b/foo
864 +++ b/foo
863 @@ -0,0 +1,1 @@
865 @@ -0,0 +1,1 @@
864 +foo
866 +foo
865 $ cd ..
867 $ cd ..
866
868
867
869
868 Issue2102: hg export and hg import speak different languages
870 Issue2102: hg export and hg import speak different languages
869
871
870 $ hg init issue2102
872 $ hg init issue2102
871 $ cd issue2102
873 $ cd issue2102
872 $ mkdir -p src/cmd/gc
874 $ mkdir -p src/cmd/gc
873 $ touch src/cmd/gc/mksys.bash
875 $ touch src/cmd/gc/mksys.bash
874 $ hg ci -Am init
876 $ hg ci -Am init
875 adding src/cmd/gc/mksys.bash
877 adding src/cmd/gc/mksys.bash
876 $ hg import - <<EOF
878 $ hg import - <<EOF
877 > # HG changeset patch
879 > # HG changeset patch
878 > # User Rob Pike
880 > # User Rob Pike
879 > # Date 1216685449 25200
881 > # Date 1216685449 25200
880 > # Node ID 03aa2b206f499ad6eb50e6e207b9e710d6409c98
882 > # Node ID 03aa2b206f499ad6eb50e6e207b9e710d6409c98
881 > # Parent 93d10138ad8df586827ca90b4ddb5033e21a3a84
883 > # Parent 93d10138ad8df586827ca90b4ddb5033e21a3a84
882 > help management of empty pkg and lib directories in perforce
884 > help management of empty pkg and lib directories in perforce
883 >
885 >
884 > R=gri
886 > R=gri
885 > DELTA=4 (4 added, 0 deleted, 0 changed)
887 > DELTA=4 (4 added, 0 deleted, 0 changed)
886 > OCL=13328
888 > OCL=13328
887 > CL=13328
889 > CL=13328
888 >
890 >
889 > diff --git a/lib/place-holder b/lib/place-holder
891 > diff --git a/lib/place-holder b/lib/place-holder
890 > new file mode 100644
892 > new file mode 100644
891 > --- /dev/null
893 > --- /dev/null
892 > +++ b/lib/place-holder
894 > +++ b/lib/place-holder
893 > @@ -0,0 +1,2 @@
895 > @@ -0,0 +1,2 @@
894 > +perforce does not maintain empty directories.
896 > +perforce does not maintain empty directories.
895 > +this file helps.
897 > +this file helps.
896 > diff --git a/pkg/place-holder b/pkg/place-holder
898 > diff --git a/pkg/place-holder b/pkg/place-holder
897 > new file mode 100644
899 > new file mode 100644
898 > --- /dev/null
900 > --- /dev/null
899 > +++ b/pkg/place-holder
901 > +++ b/pkg/place-holder
900 > @@ -0,0 +1,2 @@
902 > @@ -0,0 +1,2 @@
901 > +perforce does not maintain empty directories.
903 > +perforce does not maintain empty directories.
902 > +this file helps.
904 > +this file helps.
903 > diff --git a/src/cmd/gc/mksys.bash b/src/cmd/gc/mksys.bash
905 > diff --git a/src/cmd/gc/mksys.bash b/src/cmd/gc/mksys.bash
904 > old mode 100644
906 > old mode 100644
905 > new mode 100755
907 > new mode 100755
906 > EOF
908 > EOF
907 applying patch from stdin
909 applying patch from stdin
908 $ hg sum
910 $ hg sum
909 parent: 1:d59915696727 tip
911 parent: 1:d59915696727 tip
910 help management of empty pkg and lib directories in perforce
912 help management of empty pkg and lib directories in perforce
911 branch: default
913 branch: default
912 commit: (clean)
914 commit: (clean)
913 update: (current)
915 update: (current)
914 $ hg diff --git -c tip
916 $ hg diff --git -c tip
915 diff --git a/lib/place-holder b/lib/place-holder
917 diff --git a/lib/place-holder b/lib/place-holder
916 new file mode 100644
918 new file mode 100644
917 --- /dev/null
919 --- /dev/null
918 +++ b/lib/place-holder
920 +++ b/lib/place-holder
919 @@ -0,0 +1,2 @@
921 @@ -0,0 +1,2 @@
920 +perforce does not maintain empty directories.
922 +perforce does not maintain empty directories.
921 +this file helps.
923 +this file helps.
922 diff --git a/pkg/place-holder b/pkg/place-holder
924 diff --git a/pkg/place-holder b/pkg/place-holder
923 new file mode 100644
925 new file mode 100644
924 --- /dev/null
926 --- /dev/null
925 +++ b/pkg/place-holder
927 +++ b/pkg/place-holder
926 @@ -0,0 +1,2 @@
928 @@ -0,0 +1,2 @@
927 +perforce does not maintain empty directories.
929 +perforce does not maintain empty directories.
928 +this file helps.
930 +this file helps.
929 diff --git a/src/cmd/gc/mksys.bash b/src/cmd/gc/mksys.bash
931 diff --git a/src/cmd/gc/mksys.bash b/src/cmd/gc/mksys.bash
930 old mode 100644
932 old mode 100644
931 new mode 100755
933 new mode 100755
932 $ cd ..
934 $ cd ..
933
935
934
936
935 diff lines looking like headers
937 diff lines looking like headers
936
938
937 $ hg init difflineslikeheaders
939 $ hg init difflineslikeheaders
938 $ cd difflineslikeheaders
940 $ cd difflineslikeheaders
939 $ echo a >a
941 $ echo a >a
940 $ echo b >b
942 $ echo b >b
941 $ echo c >c
943 $ echo c >c
942 $ hg ci -Am1
944 $ hg ci -Am1
943 adding a
945 adding a
944 adding b
946 adding b
945 adding c
947 adding c
946
948
947 $ echo "key: value" >>a
949 $ echo "key: value" >>a
948 $ echo "key: value" >>b
950 $ echo "key: value" >>b
949 $ echo "foo" >>c
951 $ echo "foo" >>c
950 $ hg ci -m2
952 $ hg ci -m2
951
953
952 $ hg up -C 0
954 $ hg up -C 0
953 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
955 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
954 $ hg diff --git -c1 >want
956 $ hg diff --git -c1 >want
955 $ hg diff -c1 | hg import --no-commit -
957 $ hg diff -c1 | hg import --no-commit -
956 applying patch from stdin
958 applying patch from stdin
957 $ hg diff --git >have
959 $ hg diff --git >have
958 $ diff want have
960 $ diff want have
959 $ cd ..
961 $ cd ..
960
962
961 import a unified diff with no lines of context (diff -U0)
963 import a unified diff with no lines of context (diff -U0)
962
964
963 $ hg init diffzero
965 $ hg init diffzero
964 $ cd diffzero
966 $ cd diffzero
965 $ cat > f << EOF
967 $ cat > f << EOF
966 > c2
968 > c2
967 > c4
969 > c4
968 > c5
970 > c5
969 > EOF
971 > EOF
970 $ hg commit -Am0
972 $ hg commit -Am0
971 adding f
973 adding f
972
974
973 $ hg import --no-commit - << EOF
975 $ hg import --no-commit - << EOF
974 > # HG changeset patch
976 > # HG changeset patch
975 > # User test
977 > # User test
976 > # Date 0 0
978 > # Date 0 0
977 > # Node ID f4974ab632f3dee767567b0576c0ec9a4508575c
979 > # Node ID f4974ab632f3dee767567b0576c0ec9a4508575c
978 > # Parent 8679a12a975b819fae5f7ad3853a2886d143d794
980 > # Parent 8679a12a975b819fae5f7ad3853a2886d143d794
979 > 1
981 > 1
980 > diff -r 8679a12a975b -r f4974ab632f3 f
982 > diff -r 8679a12a975b -r f4974ab632f3 f
981 > --- a/f Thu Jan 01 00:00:00 1970 +0000
983 > --- a/f Thu Jan 01 00:00:00 1970 +0000
982 > +++ b/f Thu Jan 01 00:00:00 1970 +0000
984 > +++ b/f Thu Jan 01 00:00:00 1970 +0000
983 > @@ -0,0 +1,1 @@
985 > @@ -0,0 +1,1 @@
984 > +c1
986 > +c1
985 > @@ -1,0 +3,1 @@
987 > @@ -1,0 +3,1 @@
986 > +c3
988 > +c3
987 > @@ -3,1 +4,0 @@
989 > @@ -3,1 +4,0 @@
988 > -c5
990 > -c5
989 > EOF
991 > EOF
990 applying patch from stdin
992 applying patch from stdin
991
993
992 $ cat f
994 $ cat f
993 c1
995 c1
994 c2
996 c2
995 c3
997 c3
996 c4
998 c4
General Comments 0
You need to be logged in to leave comments. Login now