##// END OF EJS Templates
tests: don't create new repo inside existing repo in test-rebase-inmemory.t...
Pulkit Goyal -
r39166:0600d097 default
parent child Browse files
Show More
@@ -1,539 +1,542
1 1 #require symlink execbit
2 2 $ cat << EOF >> $HGRCPATH
3 3 > [extensions]
4 4 > amend=
5 5 > rebase=
6 6 > debugdrawdag=$TESTDIR/drawdag.py
7 7 > strip=
8 8 > [rebase]
9 9 > experimental.inmemory=1
10 10 > [diff]
11 11 > git=1
12 12 > [alias]
13 13 > tglog = log -G --template "{rev}: {node|short} '{desc}'\n"
14 14 > EOF
15 15
16 16 Rebase a simple DAG:
17 17 $ hg init repo1
18 18 $ cd repo1
19 19 $ hg debugdrawdag <<'EOS'
20 20 > c b
21 21 > |/
22 22 > d
23 23 > |
24 24 > a
25 25 > EOS
26 26 $ hg up -C a
27 27 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
28 28 $ hg tglog
29 29 o 3: 814f6bd05178 'c'
30 30 |
31 31 | o 2: db0e82a16a62 'b'
32 32 |/
33 33 o 1: 02952614a83d 'd'
34 34 |
35 35 @ 0: b173517d0057 'a'
36 36
37 37 $ hg cat -r 3 c
38 38 c (no-eol)
39 39 $ hg cat -r 2 b
40 40 b (no-eol)
41 41 $ hg rebase --debug -r b -d c | grep rebasing
42 42 rebasing in-memory
43 43 rebasing 2:db0e82a16a62 "b" (b)
44 44 $ hg tglog
45 45 o 3: ca58782ad1e4 'b'
46 46 |
47 47 o 2: 814f6bd05178 'c'
48 48 |
49 49 o 1: 02952614a83d 'd'
50 50 |
51 51 @ 0: b173517d0057 'a'
52 52
53 53 $ hg cat -r 3 b
54 54 b (no-eol)
55 55 $ hg cat -r 2 c
56 56 c (no-eol)
57 57
58 58 Case 2:
59 59 $ hg init repo2
60 60 $ cd repo2
61 61 $ hg debugdrawdag <<'EOS'
62 62 > c b
63 63 > |/
64 64 > d
65 65 > |
66 66 > a
67 67 > EOS
68 68
69 69 Add a symlink and executable file:
70 70 $ hg up -C c
71 71 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
72 72 $ ln -s somefile e
73 73 $ echo f > f
74 74 $ chmod +x f
75 75 $ hg add e f
76 76 $ hg amend -q
77 77 $ hg up -Cq a
78 78
79 79 Write files to the working copy, and ensure they're still there after the rebase
80 80 $ echo "abc" > a
81 81 $ ln -s def b
82 82 $ echo "ghi" > c
83 83 $ echo "jkl" > d
84 84 $ echo "mno" > e
85 85 $ hg tglog
86 86 o 3: f56b71190a8f 'c'
87 87 |
88 88 | o 2: db0e82a16a62 'b'
89 89 |/
90 90 o 1: 02952614a83d 'd'
91 91 |
92 92 @ 0: b173517d0057 'a'
93 93
94 94 $ hg cat -r 3 c
95 95 c (no-eol)
96 96 $ hg cat -r 2 b
97 97 b (no-eol)
98 98 $ hg cat -r 3 e
99 99 somefile (no-eol)
100 100 $ hg rebase --debug -s b -d a | grep rebasing
101 101 rebasing in-memory
102 102 rebasing 2:db0e82a16a62 "b" (b)
103 103 $ hg tglog
104 104 o 3: fc055c3b4d33 'b'
105 105 |
106 106 | o 2: f56b71190a8f 'c'
107 107 | |
108 108 | o 1: 02952614a83d 'd'
109 109 |/
110 110 @ 0: b173517d0057 'a'
111 111
112 112 $ hg cat -r 2 c
113 113 c (no-eol)
114 114 $ hg cat -r 3 b
115 115 b (no-eol)
116 116 $ hg rebase --debug -s 1 -d 3 | grep rebasing
117 117 rebasing in-memory
118 118 rebasing 1:02952614a83d "d" (d)
119 119 rebasing 2:f56b71190a8f "c"
120 120 $ hg tglog
121 121 o 3: 753feb6fd12a 'c'
122 122 |
123 123 o 2: 09c044d2cb43 'd'
124 124 |
125 125 o 1: fc055c3b4d33 'b'
126 126 |
127 127 @ 0: b173517d0057 'a'
128 128
129 129 Ensure working copy files are still there:
130 130 $ cat a
131 131 abc
132 132 $ readlink.py b
133 133 b -> def
134 134 $ cat e
135 135 mno
136 136
137 137 Ensure symlink and executable files were rebased properly:
138 138 $ hg up -Cq 3
139 139 $ readlink.py e
140 140 e -> somefile
141 141 $ ls -l f | cut -c -10
142 142 -rwxr-xr-x
143 143
144 144 Rebase the working copy parent
145 145 $ hg up -C 3
146 146 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
147 147 $ hg rebase -r 3 -d 0 --debug | grep rebasing
148 148 rebasing in-memory
149 149 rebasing 3:753feb6fd12a "c" (tip)
150 150 $ hg tglog
151 151 @ 3: 844a7de3e617 'c'
152 152 |
153 153 | o 2: 09c044d2cb43 'd'
154 154 | |
155 155 | o 1: fc055c3b4d33 'b'
156 156 |/
157 157 o 0: b173517d0057 'a'
158
158
159 $ cd ..
160
159 161 Test dry-run rebasing
162
160 163 $ hg init repo3
161 164 $ cd repo3
162 165 $ echo a>a
163 166 $ hg ci -Aqma
164 167 $ echo b>b
165 168 $ hg ci -Aqmb
166 169 $ echo c>c
167 170 $ hg ci -Aqmc
168 171 $ echo d>d
169 172 $ hg ci -Aqmd
170 173 $ echo e>e
171 174 $ hg ci -Aqme
172 175
173 176 $ hg up 1 -q
174 177 $ echo f>f
175 178 $ hg ci -Amf
176 179 adding f
177 180 created new head
178 181 $ echo g>g
179 182 $ hg ci -Aqmg
180 183 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
181 184 @ 6:baf10c5166d4 test
182 185 | g
183 186 |
184 187 o 5:6343ca3eff20 test
185 188 | f
186 189 |
187 190 | o 4:e860deea161a test
188 191 | | e
189 192 | |
190 193 | o 3:055a42cdd887 test
191 194 | | d
192 195 | |
193 196 | o 2:177f92b77385 test
194 197 |/ c
195 198 |
196 199 o 1:d2ae7f538514 test
197 200 | b
198 201 |
199 202 o 0:cb9a9f314b8b test
200 203 a
201 204
202 205 Make sure it throws error while passing --continue or --abort with --dry-run
203 206 $ hg rebase -s 2 -d 6 -n --continue
204 207 abort: cannot specify both --dry-run and --continue
205 208 [255]
206 209 $ hg rebase -s 2 -d 6 -n --abort
207 210 abort: cannot specify both --dry-run and --abort
208 211 [255]
209 212
210 213 Check dryrun gives correct results when there is no conflict in rebasing
211 214 $ hg rebase -s 2 -d 6 -n
212 215 starting dry-run rebase; repository will not be changed
213 216 rebasing 2:177f92b77385 "c"
214 217 rebasing 3:055a42cdd887 "d"
215 218 rebasing 4:e860deea161a "e"
216 219 dry-run rebase completed successfully; run without -n/--dry-run to perform this rebase
217 220
218 221 $ hg diff
219 222 $ hg status
220 223
221 224 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
222 225 @ 6:baf10c5166d4 test
223 226 | g
224 227 |
225 228 o 5:6343ca3eff20 test
226 229 | f
227 230 |
228 231 | o 4:e860deea161a test
229 232 | | e
230 233 | |
231 234 | o 3:055a42cdd887 test
232 235 | | d
233 236 | |
234 237 | o 2:177f92b77385 test
235 238 |/ c
236 239 |
237 240 o 1:d2ae7f538514 test
238 241 | b
239 242 |
240 243 o 0:cb9a9f314b8b test
241 244 a
242 245
243 246 Check dryrun working with --collapse when there is no conflict
244 247 $ hg rebase -s 2 -d 6 -n --collapse
245 248 starting dry-run rebase; repository will not be changed
246 249 rebasing 2:177f92b77385 "c"
247 250 rebasing 3:055a42cdd887 "d"
248 251 rebasing 4:e860deea161a "e"
249 252 dry-run rebase completed successfully; run without -n/--dry-run to perform this rebase
250 253
251 254 Check dryrun gives correct results when there is conflict in rebasing
252 255 Make a conflict:
253 256 $ hg up 6 -q
254 257 $ echo conflict>e
255 258 $ hg ci -Aqm "conflict with e"
256 259 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
257 260 @ 7:d2c195b28050 test
258 261 | conflict with e
259 262 |
260 263 o 6:baf10c5166d4 test
261 264 | g
262 265 |
263 266 o 5:6343ca3eff20 test
264 267 | f
265 268 |
266 269 | o 4:e860deea161a test
267 270 | | e
268 271 | |
269 272 | o 3:055a42cdd887 test
270 273 | | d
271 274 | |
272 275 | o 2:177f92b77385 test
273 276 |/ c
274 277 |
275 278 o 1:d2ae7f538514 test
276 279 | b
277 280 |
278 281 o 0:cb9a9f314b8b test
279 282 a
280 283
281 284 $ hg rebase -s 2 -d 7 -n
282 285 starting dry-run rebase; repository will not be changed
283 286 rebasing 2:177f92b77385 "c"
284 287 rebasing 3:055a42cdd887 "d"
285 288 rebasing 4:e860deea161a "e"
286 289 merging e
287 290 transaction abort!
288 291 rollback completed
289 292 hit a merge conflict
290 293 [1]
291 294 $ hg diff
292 295 $ hg status
293 296 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
294 297 @ 7:d2c195b28050 test
295 298 | conflict with e
296 299 |
297 300 o 6:baf10c5166d4 test
298 301 | g
299 302 |
300 303 o 5:6343ca3eff20 test
301 304 | f
302 305 |
303 306 | o 4:e860deea161a test
304 307 | | e
305 308 | |
306 309 | o 3:055a42cdd887 test
307 310 | | d
308 311 | |
309 312 | o 2:177f92b77385 test
310 313 |/ c
311 314 |
312 315 o 1:d2ae7f538514 test
313 316 | b
314 317 |
315 318 o 0:cb9a9f314b8b test
316 319 a
317 320
318 321 Check dryrun working with --collapse when there is conflicts
319 322 $ hg rebase -s 2 -d 7 -n --collapse
320 323 starting dry-run rebase; repository will not be changed
321 324 rebasing 2:177f92b77385 "c"
322 325 rebasing 3:055a42cdd887 "d"
323 326 rebasing 4:e860deea161a "e"
324 327 merging e
325 328 hit a merge conflict
326 329 [1]
327 330
328 331 ==========================
329 332 Test for --confirm option|
330 333 ==========================
331 334 $ cd ..
332 335 $ hg clone repo3 repo4 -q
333 336 $ cd repo4
334 337 $ hg strip 7 -q
335 338 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
336 339 @ 6:baf10c5166d4 test
337 340 | g
338 341 |
339 342 o 5:6343ca3eff20 test
340 343 | f
341 344 |
342 345 | o 4:e860deea161a test
343 346 | | e
344 347 | |
345 348 | o 3:055a42cdd887 test
346 349 | | d
347 350 | |
348 351 | o 2:177f92b77385 test
349 352 |/ c
350 353 |
351 354 o 1:d2ae7f538514 test
352 355 | b
353 356 |
354 357 o 0:cb9a9f314b8b test
355 358 a
356 359
357 360 Check it gives error when both --dryrun and --confirm is used:
358 361 $ hg rebase -s 2 -d . --confirm --dry-run
359 362 abort: cannot specify both --confirm and --dry-run
360 363 [255]
361 364 $ hg rebase -s 2 -d . --confirm --abort
362 365 abort: cannot specify both --confirm and --abort
363 366 [255]
364 367 $ hg rebase -s 2 -d . --confirm --continue
365 368 abort: cannot specify both --confirm and --continue
366 369 [255]
367 370
368 371 Test --confirm option when there are no conflicts:
369 372 $ hg rebase -s 2 -d . --keep --config ui.interactive=True --confirm << EOF
370 373 > n
371 374 > EOF
372 375 starting in-memory rebase
373 376 rebasing 2:177f92b77385 "c"
374 377 rebasing 3:055a42cdd887 "d"
375 378 rebasing 4:e860deea161a "e"
376 379 rebase completed successfully
377 380 apply changes (yn)? n
378 381 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
379 382 @ 6:baf10c5166d4 test
380 383 | g
381 384 |
382 385 o 5:6343ca3eff20 test
383 386 | f
384 387 |
385 388 | o 4:e860deea161a test
386 389 | | e
387 390 | |
388 391 | o 3:055a42cdd887 test
389 392 | | d
390 393 | |
391 394 | o 2:177f92b77385 test
392 395 |/ c
393 396 |
394 397 o 1:d2ae7f538514 test
395 398 | b
396 399 |
397 400 o 0:cb9a9f314b8b test
398 401 a
399 402
400 403 $ hg rebase -s 2 -d . --keep --config ui.interactive=True --confirm << EOF
401 404 > y
402 405 > EOF
403 406 starting in-memory rebase
404 407 rebasing 2:177f92b77385 "c"
405 408 rebasing 3:055a42cdd887 "d"
406 409 rebasing 4:e860deea161a "e"
407 410 rebase completed successfully
408 411 apply changes (yn)? y
409 412 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
410 413 o 9:9fd28f55f6dc test
411 414 | e
412 415 |
413 416 o 8:12cbf031f469 test
414 417 | d
415 418 |
416 419 o 7:c83b1da5b1ae test
417 420 | c
418 421 |
419 422 @ 6:baf10c5166d4 test
420 423 | g
421 424 |
422 425 o 5:6343ca3eff20 test
423 426 | f
424 427 |
425 428 | o 4:e860deea161a test
426 429 | | e
427 430 | |
428 431 | o 3:055a42cdd887 test
429 432 | | d
430 433 | |
431 434 | o 2:177f92b77385 test
432 435 |/ c
433 436 |
434 437 o 1:d2ae7f538514 test
435 438 | b
436 439 |
437 440 o 0:cb9a9f314b8b test
438 441 a
439 442
440 443 Test --confirm option when there is a conflict
441 444 $ hg up tip -q
442 445 $ echo ee>e
443 446 $ hg ci --amend -m "conflict with e" -q
444 447 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
445 448 @ 9:906d72f66a59 test
446 449 | conflict with e
447 450 |
448 451 o 8:12cbf031f469 test
449 452 | d
450 453 |
451 454 o 7:c83b1da5b1ae test
452 455 | c
453 456 |
454 457 o 6:baf10c5166d4 test
455 458 | g
456 459 |
457 460 o 5:6343ca3eff20 test
458 461 | f
459 462 |
460 463 | o 4:e860deea161a test
461 464 | | e
462 465 | |
463 466 | o 3:055a42cdd887 test
464 467 | | d
465 468 | |
466 469 | o 2:177f92b77385 test
467 470 |/ c
468 471 |
469 472 o 1:d2ae7f538514 test
470 473 | b
471 474 |
472 475 o 0:cb9a9f314b8b test
473 476 a
474 477
475 478 $ hg rebase -s 4 -d . --keep --confirm
476 479 starting in-memory rebase
477 480 rebasing 4:e860deea161a "e"
478 481 merging e
479 482 hit a merge conflict
480 483 [1]
481 484 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
482 485 @ 9:906d72f66a59 test
483 486 | conflict with e
484 487 |
485 488 o 8:12cbf031f469 test
486 489 | d
487 490 |
488 491 o 7:c83b1da5b1ae test
489 492 | c
490 493 |
491 494 o 6:baf10c5166d4 test
492 495 | g
493 496 |
494 497 o 5:6343ca3eff20 test
495 498 | f
496 499 |
497 500 | o 4:e860deea161a test
498 501 | | e
499 502 | |
500 503 | o 3:055a42cdd887 test
501 504 | | d
502 505 | |
503 506 | o 2:177f92b77385 test
504 507 |/ c
505 508 |
506 509 o 1:d2ae7f538514 test
507 510 | b
508 511 |
509 512 o 0:cb9a9f314b8b test
510 513 a
511 514
512 515 #if execbit
513 516
514 517 Test a metadata-only in-memory merge
515 518 $ cd $TESTTMP
516 519 $ hg init no_exception
517 520 $ cd no_exception
518 521 # Produce the following graph:
519 522 # o 'add +x to foo.txt'
520 523 # | o r1 (adds bar.txt, just for something to rebase to)
521 524 # |/
522 525 # o r0 (adds foo.txt, no +x)
523 526 $ echo hi > foo.txt
524 527 $ hg ci -qAm r0
525 528 $ echo hi > bar.txt
526 529 $ hg ci -qAm r1
527 530 $ hg co -qr ".^"
528 531 $ chmod +x foo.txt
529 532 $ hg ci -qAm 'add +x to foo.txt'
530 533 issue5960: this was raising an AttributeError exception
531 534 $ hg rebase -r . -d 1
532 535 rebasing 2:539b93e77479 "add +x to foo.txt" (tip)
533 536 saved backup bundle to $TESTTMP/no_exception/.hg/strip-backup/*.hg (glob)
534 537 $ hg diff -c tip
535 538 diff --git a/foo.txt b/foo.txt
536 539 old mode 100644
537 540 new mode 100755
538 541
539 542 #endif
General Comments 0
You need to be logged in to leave comments. Login now