2017-05-11 21:37:18 +03:00
|
|
|
Tests rebasing with part of the rebase set already in the
|
|
|
|
destination (issue5422)
|
|
|
|
|
|
|
|
$ cat >> $HGRCPATH <<EOF
|
|
|
|
> [extensions]
|
|
|
|
> rebase=
|
|
|
|
>
|
|
|
|
> [experimental]
|
2017-09-28 20:19:06 +03:00
|
|
|
> evolution.createmarkers=True
|
2017-09-28 20:56:40 +03:00
|
|
|
> evolution.allowunstable=True
|
2017-05-11 21:37:18 +03:00
|
|
|
> EOF
|
|
|
|
|
|
|
|
$ rebasewithdag() {
|
|
|
|
> N=`$PYTHON -c "print($N+1)"`
|
|
|
|
> hg init repo$N && cd repo$N
|
|
|
|
> hg debugdrawdag
|
|
|
|
> hg rebase "$@" > _rebasetmp
|
|
|
|
> r=$?
|
|
|
|
> grep -v 'saved backup bundle' _rebasetmp
|
2018-08-16 20:37:29 +03:00
|
|
|
> [ $r -eq 0 ] && 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
|
|
|
|
rebasing 2:b18e25de2cf5 "D" (D)
|
|
|
|
already rebased 3:26805aba1e60 "C" (C tip)
|
2018-08-16 20:37:29 +03:00
|
|
|
o 4: fe3b4c6498fa 'D'
|
2017-05-11 21:37:18 +03:00
|
|
|
|
|
2018-08-16 20:37:29 +03:00
|
|
|
| o 3: 26805aba1e60 'C'
|
2017-05-11 21:37:18 +03:00
|
|
|
|/
|
2018-08-16 20:37:29 +03:00
|
|
|
| x 2: b18e25de2cf5 'D'
|
2017-05-11 21:37:18 +03:00
|
|
|
| |
|
2018-08-16 20:37:29 +03:00
|
|
|
o | 1: 112478962961 'B'
|
2017-05-11 21:37:18 +03:00
|
|
|
|/
|
2018-08-16 20:37:29 +03:00
|
|
|
o 0: 426bada5c675 '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
|
|
|
|
rebasing 2:b18e25de2cf5 "D" (D)
|
|
|
|
rebasing 3:26805aba1e60 "C" (C tip)
|
2018-08-16 20:37:29 +03:00
|
|
|
o 4: a2493f4ace65 'Collapsed revision
|
2017-05-11 21:37:18 +03:00
|
|
|
| * D
|
2018-08-16 20:37:29 +03:00
|
|
|
| * C'
|
|
|
|
| x 3: 26805aba1e60 'C'
|
2017-05-11 21:37:18 +03:00
|
|
|
|/
|
2018-08-16 20:37:29 +03:00
|
|
|
| x 2: b18e25de2cf5 'D'
|
2017-05-11 21:37:18 +03:00
|
|
|
| |
|
2018-08-16 20:37:29 +03:00
|
|
|
o | 1: 112478962961 'B'
|
2017-05-11 21:37:18 +03:00
|
|
|
|/
|
2018-08-16 20:37:29 +03:00
|
|
|
o 0: 426bada5c675 '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
|
|
|
|
already rebased 1:112478962961 "B" (B)
|
|
|
|
rebasing 3:f585351a92f8 "D" (D tip)
|
2018-08-16 20:37:29 +03:00
|
|
|
o 4: 1e6da8103bc7 'D'
|
2017-05-11 21:37:18 +03:00
|
|
|
|
|
2018-08-16 20:37:29 +03:00
|
|
|
| x 3: f585351a92f8 'D'
|
2017-05-11 21:37:18 +03:00
|
|
|
| |
|
2018-08-16 20:37:29 +03:00
|
|
|
| o 2: 26805aba1e60 'C'
|
2017-05-11 21:37:18 +03:00
|
|
|
|/
|
2018-08-16 20:37:29 +03:00
|
|
|
o 1: 112478962961 'B'
|
2017-05-11 21:37:18 +03:00
|
|
|
|
|
2018-08-16 20:37:29 +03:00
|
|
|
o 0: 426bada5c675 '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
|
|
|
|
rebasing 2:ef8c0fe0897b "D" (D)
|
|
|
|
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
|
|
|
|
o 3: 79f6d6ab7b14 'C'
|
2018-04-10 21:03:27 +03:00
|
|
|
|
|
2018-08-16 20:37:29 +03:00
|
|
|
| o 2: ef8c0fe0897b 'D'
|
2018-04-10 21:03:27 +03:00
|
|
|
| |
|
2018-08-16 20:37:29 +03:00
|
|
|
o | 1: 594087dbaf71 'B'
|
2018-04-10 21:03:27 +03:00
|
|
|
|/
|
2018-08-16 20:37:29 +03:00
|
|
|
o 0: 426bada5c675 'A'
|
2018-04-10 21:03:27 +03:00
|
|
|
|