| 1 |
Tests rebasing with part of the rebase set already in the |
| 2 |
destination (issue5422) |
| 3 |
|
| 4 |
$ cat >> $HGRCPATH <<EOF |
| 5 |
> [extensions] |
| 6 |
> rebase= |
| 7 |
> drawdag=$TESTDIR/drawdag.py |
| 8 |
> |
| 9 |
> [experimental] |
| 10 |
> evolution.createmarkers=True |
| 11 |
> evolution.allowunstable=True |
| 12 |
> |
| 13 |
> [alias] |
| 14 |
> tglog = log -G --template "{rev}: {node|short} {desc}" |
| 15 |
> EOF |
| 16 |
|
| 17 |
$ rebasewithdag() { |
| 18 |
> N=`"$PYTHON" -c "print($N+1)"` |
| 19 |
> hg init repo$N && cd repo$N |
| 20 |
> hg debugdrawdag |
| 21 |
> hg rebase "$@" > _rebasetmp |
| 22 |
> r=$? |
| 23 |
> grep -v 'saved backup bundle' _rebasetmp |
| 24 |
> [ $r -eq 0 ] && hg tglog |
| 25 |
> cd .. |
| 26 |
> return $r |
| 27 |
> } |
| 28 |
|
| 29 |
Rebase two commits, of which one is already in the right place |
| 30 |
|
| 31 |
$ rebasewithdag -r C+D -d B <<EOF |
| 32 |
> C |
| 33 |
> | |
| 34 |
> B D |
| 35 |
> |/ |
| 36 |
> A |
| 37 |
> EOF |
| 38 |
rebasing 2:b18e25de2cf5 D "D" |
| 39 |
already rebased 3:26805aba1e60 C tip "C" |
| 40 |
o 4: fe3b4c6498fa D |
| 41 |
| |
| 42 |
| o 3: 26805aba1e60 C |
| 43 |
|/ |
| 44 |
| x 2: b18e25de2cf5 D |
| 45 |
| | |
| 46 |
o | 1: 112478962961 B |
| 47 |
|/ |
| 48 |
o 0: 426bada5c675 A |
| 49 |
|
| 50 |
Can collapse commits even if one is already in the right place |
| 51 |
|
| 52 |
$ rebasewithdag --collapse -r C+D -d B <<EOF |
| 53 |
> C |
| 54 |
> | |
| 55 |
> B D |
| 56 |
> |/ |
| 57 |
> A |
| 58 |
> EOF |
| 59 |
rebasing 2:b18e25de2cf5 D "D" |
| 60 |
rebasing 3:26805aba1e60 C tip "C" |
| 61 |
o 4: a2493f4ace65 Collapsed revision |
| 62 |
| * D |
| 63 |
| * C |
| 64 |
| x 3: 26805aba1e60 C |
| 65 |
|/ |
| 66 |
| x 2: b18e25de2cf5 D |
| 67 |
| | |
| 68 |
o | 1: 112478962961 B |
| 69 |
|/ |
| 70 |
o 0: 426bada5c675 A |
| 71 |
|
| 72 |
Abort doesn't lose the commits that were already in the right place |
| 73 |
|
| 74 |
$ hg init abort |
| 75 |
$ cd abort |
| 76 |
$ hg debugdrawdag <<EOF |
| 77 |
> C |
| 78 |
> | |
| 79 |
> B D # B/file = B |
| 80 |
> |/ # D/file = D |
| 81 |
> A |
| 82 |
> EOF |
| 83 |
$ hg rebase -r C+D -d B |
| 84 |
rebasing 2:ef8c0fe0897b D "D" |
| 85 |
merging file |
| 86 |
warning: conflicts while merging file! (edit, then use 'hg resolve --mark') |
| 87 |
unresolved conflicts (see 'hg resolve', then 'hg rebase --continue') |
| 88 |
[240] |
| 89 |
$ hg rebase --abort |
| 90 |
rebase aborted |
| 91 |
$ hg tglog |
| 92 |
o 3: 79f6d6ab7b14 C |
| 93 |
| |
| 94 |
| o 2: ef8c0fe0897b D |
| 95 |
| | |
| 96 |
o | 1: 594087dbaf71 B |
| 97 |
|/ |
| 98 |
o 0: 426bada5c675 A |
| 99 |
|
| 100 |
$ cd .. |
| 101 |
|
| 102 |
Rebase with "holes". The commits after the hole should end up on the parent of |
| 103 |
the hole (B below), not on top of the destination (A). |
| 104 |
|
| 105 |
$ rebasewithdag -r B+D -d A <<EOF |
| 106 |
> D |
| 107 |
> | |
| 108 |
> C |
| 109 |
> | |
| 110 |
> B |
| 111 |
> | |
| 112 |
> A |
| 113 |
> EOF |
| 114 |
already rebased 1:112478962961 B "B" |
| 115 |
rebasing 3:f585351a92f8 D tip "D" |
| 116 |
o 4: 1e6da8103bc7 D |
| 117 |
| |
| 118 |
| x 3: f585351a92f8 D |
| 119 |
| | |
| 120 |
| o 2: 26805aba1e60 C |
| 121 |
|/ |
| 122 |
o 1: 112478962961 B |
| 123 |
| |
| 124 |
o 0: 426bada5c675 A |
| 125 |
|