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