2019-12-10 02:24:31 +03:00
|
|
|
#chg-compatible
|
|
|
|
|
2017-05-11 21:37:18 +03:00
|
|
|
Tests rebasing with part of the rebase set already in the
|
|
|
|
destination (issue5422)
|
|
|
|
|
2020-01-25 01:45:01 +03:00
|
|
|
$ configure mutation-norecord
|
2020-01-20 13:42:49 +03:00
|
|
|
$ enable rebase
|
2017-05-11 21:37:18 +03:00
|
|
|
|
|
|
|
$ rebasewithdag() {
|
2020-08-19 10:31:05 +03:00
|
|
|
> N=$((N + 1))
|
2017-05-11 21:37:18 +03:00
|
|
|
> hg init repo$N && cd repo$N
|
|
|
|
> hg debugdrawdag
|
2020-01-25 01:45:01 +03:00
|
|
|
> hg rebase "$@" && tglog
|
2017-05-11 21:37:18 +03:00
|
|
|
> cd ..
|
|
|
|
> return $r
|
|
|
|
> }
|
|
|
|
|
|
|
|
Rebase two commits, of which one is already in the right place
|
|
|
|
|
|
|
|
$ rebasewithdag -r C+D -d B <<EOF
|
|
|
|
> C
|
|
|
|
> |
|
|
|
|
> B D
|
|
|
|
> |/
|
|
|
|
> A
|
|
|
|
> EOF
|
2019-10-16 02:28:01 +03:00
|
|
|
rebasing b18e25de2cf5 "D" (D)
|
2019-12-18 00:45:17 +03:00
|
|
|
already rebased 26805aba1e60 "C" (C)
|
2020-10-09 06:30:01 +03:00
|
|
|
o fe3b4c6498fa 'D' D
|
2020-10-20 03:05:23 +03:00
|
|
|
│
|
|
|
|
│ o 26805aba1e60 'C' C
|
|
|
|
├─╯
|
2020-10-09 06:30:01 +03:00
|
|
|
o 112478962961 'B' B
|
2020-10-20 03:05:23 +03:00
|
|
|
│
|
2020-10-09 06:30:01 +03:00
|
|
|
o 426bada5c675 'A' A
|
2017-05-11 21:37:18 +03:00
|
|
|
|
|
|
|
Can collapse commits even if one is already in the right place
|
|
|
|
|
|
|
|
$ rebasewithdag --collapse -r C+D -d B <<EOF
|
|
|
|
> C
|
|
|
|
> |
|
|
|
|
> B D
|
|
|
|
> |/
|
|
|
|
> A
|
|
|
|
> EOF
|
2019-10-16 02:28:01 +03:00
|
|
|
rebasing b18e25de2cf5 "D" (D)
|
2019-12-18 00:45:17 +03:00
|
|
|
rebasing 26805aba1e60 "C" (C)
|
2020-10-09 06:30:01 +03:00
|
|
|
o a2493f4ace65 'Collapsed revision
|
2020-10-20 03:05:23 +03:00
|
|
|
│ * D
|
|
|
|
│ * C' C D
|
2020-10-09 06:30:01 +03:00
|
|
|
o 112478962961 'B' B
|
2020-10-20 03:05:23 +03:00
|
|
|
│
|
2020-10-09 06:30:01 +03:00
|
|
|
o 426bada5c675 'A' A
|
2017-05-11 21:37:18 +03:00
|
|
|
|
|
|
|
Rebase with "holes". The commits after the hole should end up on the parent of
|
|
|
|
the hole (B below), not on top of the destination (A).
|
|
|
|
|
|
|
|
$ rebasewithdag -r B+D -d A <<EOF
|
|
|
|
> D
|
|
|
|
> |
|
|
|
|
> C
|
|
|
|
> |
|
|
|
|
> B
|
|
|
|
> |
|
|
|
|
> A
|
|
|
|
> EOF
|
2019-10-16 02:28:01 +03:00
|
|
|
already rebased 112478962961 "B" (B)
|
2019-12-18 00:45:17 +03:00
|
|
|
rebasing f585351a92f8 "D" (D)
|
2020-10-09 06:30:01 +03:00
|
|
|
o 1e6da8103bc7 'D' D
|
2020-10-20 03:05:23 +03:00
|
|
|
│
|
|
|
|
│ o 26805aba1e60 'C' C
|
|
|
|
├─╯
|
2020-10-09 06:30:01 +03:00
|
|
|
o 112478962961 'B' B
|
2020-10-20 03:05:23 +03:00
|
|
|
│
|
2020-10-09 06:30:01 +03:00
|
|
|
o 426bada5c675 'A' A
|
2017-05-11 21:37:18 +03:00
|
|
|
|
2018-04-10 21:03:27 +03:00
|
|
|
Abort doesn't lose the commits that were already in the right place
|
|
|
|
|
|
|
|
$ newrepo abort
|
|
|
|
$ hg debugdrawdag <<EOF
|
|
|
|
> C
|
|
|
|
> |
|
|
|
|
> B D # B/file = B
|
|
|
|
> |/ # D/file = D
|
|
|
|
> A
|
|
|
|
> EOF
|
|
|
|
$ hg rebase -r C+D -d B
|
2019-10-16 02:28:01 +03:00
|
|
|
rebasing ef8c0fe0897b "D" (D)
|
2018-04-10 21:03:27 +03:00
|
|
|
merging file
|
2018-10-22 22:45:46 +03:00
|
|
|
warning: 1 conflicts while merging file! (edit, then use 'hg resolve --mark')
|
2018-04-10 21:03:27 +03:00
|
|
|
unresolved conflicts (see hg resolve, then hg rebase --continue)
|
|
|
|
[1]
|
|
|
|
$ hg rebase --abort
|
|
|
|
rebase aborted
|
2018-08-16 20:37:29 +03:00
|
|
|
$ tglog
|
2020-10-09 06:30:01 +03:00
|
|
|
o 79f6d6ab7b14 'C' C
|
2020-10-20 03:05:23 +03:00
|
|
|
│
|
|
|
|
│ o ef8c0fe0897b 'D' D
|
|
|
|
│ │
|
|
|
|
o │ 594087dbaf71 'B' B
|
|
|
|
├─╯
|
2020-10-09 06:30:01 +03:00
|
|
|
o 426bada5c675 'A' A
|
2018-04-10 21:03:27 +03:00
|
|
|
|