2019-12-10 02:24:31 +03:00
|
|
|
#chg-compatible
|
|
|
|
|
2018-07-02 22:27:44 +03:00
|
|
|
|
2020-01-20 13:42:49 +03:00
|
|
|
$ configure mutation-norecord
|
|
|
|
$ enable amend rebase
|
2018-07-02 21:27:20 +03:00
|
|
|
$ mkcommit() {
|
|
|
|
> echo "$1" > "$1"
|
|
|
|
> hg add "$1"
|
|
|
|
> hg ci -m "add $1"
|
|
|
|
> }
|
|
|
|
|
|
|
|
Restack does topological sort and only rebases "D" once:
|
|
|
|
|
|
|
|
$ newrepo
|
2019-12-17 05:10:38 +03:00
|
|
|
$ drawdag<<'EOS'
|
2018-07-02 21:27:20 +03:00
|
|
|
> D
|
|
|
|
> |
|
|
|
|
> C
|
|
|
|
> |
|
|
|
|
> B
|
|
|
|
> |
|
|
|
|
> A
|
|
|
|
> EOS
|
2019-12-17 05:10:38 +03:00
|
|
|
$ hg update $B -q
|
2018-07-02 21:27:20 +03:00
|
|
|
$ hg commit --amend -m B2 -q --no-rebase 2>/dev/null
|
2019-12-17 05:10:38 +03:00
|
|
|
$ B2=`hg log -r . -T '{node}'`
|
|
|
|
$ hg rebase -r $C -d $B2 -q
|
2018-07-02 21:27:20 +03:00
|
|
|
$ hg commit --amend -m B3 -q --no-rebase 2>/dev/null
|
2019-12-17 05:10:38 +03:00
|
|
|
$ B3=`hg log -r . -T '{node}'`
|
2018-07-02 21:27:20 +03:00
|
|
|
$ showgraph
|
2018-08-15 09:13:17 +03:00
|
|
|
@ 6 da1d4fe88e84 B3
|
2018-07-02 21:27:20 +03:00
|
|
|
|
|
2018-08-15 09:13:17 +03:00
|
|
|
| o 5 ca53c8ceb284 C
|
2018-07-02 21:27:20 +03:00
|
|
|
| |
|
2018-08-15 09:13:17 +03:00
|
|
|
| x 4 fdcbd16a7d51 B2
|
2018-07-02 21:27:20 +03:00
|
|
|
|/
|
2018-08-15 09:13:17 +03:00
|
|
|
| o 3 f585351a92f8 D
|
2018-07-02 21:27:20 +03:00
|
|
|
| |
|
2018-08-15 09:13:17 +03:00
|
|
|
| x 2 26805aba1e60 C
|
2018-07-02 21:27:20 +03:00
|
|
|
| |
|
2018-08-15 09:13:17 +03:00
|
|
|
| x 1 112478962961 B
|
2018-07-02 21:27:20 +03:00
|
|
|
|/
|
2018-08-15 09:13:17 +03:00
|
|
|
o 0 426bada5c675 A
|
2018-07-02 21:27:20 +03:00
|
|
|
$ hg rebase --restack
|
2019-10-16 02:28:01 +03:00
|
|
|
rebasing ca53c8ceb284 "C"
|
2019-12-17 05:10:38 +03:00
|
|
|
rebasing f585351a92f8 "D"
|
2018-07-02 21:27:20 +03:00
|
|
|
$ showgraph
|
2018-08-15 09:13:17 +03:00
|
|
|
o 8 981f3734c126 D
|
2018-07-02 21:27:20 +03:00
|
|
|
|
|
2018-08-15 09:13:17 +03:00
|
|
|
o 7 bab9c1b0a249 C
|
2018-07-02 21:27:20 +03:00
|
|
|
|
|
2018-08-15 09:13:17 +03:00
|
|
|
@ 6 da1d4fe88e84 B3
|
2018-07-02 21:27:20 +03:00
|
|
|
|
|
2018-08-15 09:13:17 +03:00
|
|
|
o 0 426bada5c675 A
|
2018-07-02 21:27:20 +03:00
|
|
|
|
|
|
|
Restack will only restack the "current" stack and leave other stacks untouched.
|
|
|
|
|
|
|
|
$ newrepo
|
2019-12-17 05:10:38 +03:00
|
|
|
$ drawdag<<'EOS'
|
2018-07-02 21:27:20 +03:00
|
|
|
> D H K
|
|
|
|
> | | |
|
|
|
|
> B C F G J L # amend: B -> C
|
|
|
|
> |/ |/ |/ # amend: F -> G
|
|
|
|
> A E I Z # amend: J -> L
|
|
|
|
> EOS
|
|
|
|
|
2020-06-29 21:24:57 +03:00
|
|
|
$ hg debugmakepublic -r $Z+$I+$A+$E
|
2018-07-02 21:27:20 +03:00
|
|
|
|
2019-12-17 05:10:38 +03:00
|
|
|
$ hg update -q $Z
|
2018-07-02 21:27:20 +03:00
|
|
|
$ hg rebase --restack
|
|
|
|
nothing to restack
|
|
|
|
[1]
|
|
|
|
|
2019-12-17 05:10:38 +03:00
|
|
|
$ hg update -q $D
|
2018-07-02 21:27:20 +03:00
|
|
|
$ hg rebase --restack
|
2019-12-17 05:10:38 +03:00
|
|
|
rebasing be0ef73c17ad "D"
|
2018-07-02 21:27:20 +03:00
|
|
|
|
2019-12-17 05:10:38 +03:00
|
|
|
$ hg update -q $G
|
2018-07-02 21:27:20 +03:00
|
|
|
$ hg rebase --restack
|
2019-12-17 05:10:38 +03:00
|
|
|
rebasing cc209258a732 "H"
|
2018-07-02 21:27:20 +03:00
|
|
|
|
2019-12-17 05:10:38 +03:00
|
|
|
$ hg update -q $I
|
2018-07-02 21:27:20 +03:00
|
|
|
$ hg rebase --restack
|
2019-12-17 05:10:38 +03:00
|
|
|
rebasing 59760668f0e1 "K"
|
2018-07-02 21:27:20 +03:00
|
|
|
|
|
|
|
$ showgraph
|
2018-08-15 09:13:17 +03:00
|
|
|
o 15 c97827ce80f6 K
|
2018-07-02 21:27:20 +03:00
|
|
|
|
|
2018-08-15 09:13:17 +03:00
|
|
|
| o 14 47528c67632b H
|
2018-07-02 21:27:20 +03:00
|
|
|
| |
|
2018-08-15 09:13:17 +03:00
|
|
|
| | o 13 5cb8c357af9e D
|
2018-07-02 21:27:20 +03:00
|
|
|
| | |
|
2020-01-16 12:01:10 +03:00
|
|
|
o | | 12 a975bfef72d2 L
|
2018-07-02 21:27:20 +03:00
|
|
|
| | |
|
2020-01-16 12:01:10 +03:00
|
|
|
| o | 9 889f49cd29f6 G
|
2018-07-02 21:27:20 +03:00
|
|
|
| | |
|
2020-01-16 12:01:10 +03:00
|
|
|
| | o 7 dc0947a82db8 C
|
2018-07-02 21:27:20 +03:00
|
|
|
| | |
|
2018-08-15 09:13:17 +03:00
|
|
|
| | | o 3 48b9aae0607f Z
|
2018-07-02 21:27:20 +03:00
|
|
|
| | |
|
2018-08-15 09:13:17 +03:00
|
|
|
@ | | 2 02a9ac6a13a6 I
|
2018-07-02 21:27:20 +03:00
|
|
|
/ /
|
2018-08-15 09:13:17 +03:00
|
|
|
o / 1 e8e0a81d950f E
|
2018-07-02 21:27:20 +03:00
|
|
|
/
|
2018-08-15 09:13:17 +03:00
|
|
|
o 0 426bada5c675 A
|
2018-07-02 21:27:20 +03:00
|
|
|
|
|
|
|
|
|
|
|
Restack could resume after resolving merge conflicts.
|
|
|
|
|
|
|
|
$ newrepo
|
2019-12-17 05:10:38 +03:00
|
|
|
$ drawdag<<'EOS'
|
2018-07-02 21:27:20 +03:00
|
|
|
> F G # F/C = F # cause conflict
|
|
|
|
> | | # G/E = G # cause conflict
|
|
|
|
> B C D E # amend: B -> C
|
|
|
|
> |/ |/ # amend: D -> E
|
|
|
|
> | /
|
|
|
|
> | /
|
|
|
|
> | /
|
|
|
|
> |/
|
|
|
|
> A
|
|
|
|
> EOS
|
|
|
|
|
2019-12-17 05:10:38 +03:00
|
|
|
$ hg update -q $F
|
2018-07-02 21:27:20 +03:00
|
|
|
$ hg rebase --restack
|
2019-12-17 05:10:38 +03:00
|
|
|
rebasing ed8545a5c22a "F"
|
2018-07-02 21:27:20 +03:00
|
|
|
merging C
|
2018-10-22 22:45:46 +03:00
|
|
|
warning: 1 conflicts while merging C! (edit, then use 'hg resolve --mark')
|
2018-07-02 21:27:20 +03:00
|
|
|
unresolved conflicts (see hg resolve, then hg rebase --continue)
|
|
|
|
[1]
|
|
|
|
|
|
|
|
$ echo R > C
|
|
|
|
$ hg resolve --mark -q
|
|
|
|
continue: hg rebase --continue
|
|
|
|
$ hg rebase --continue
|
2019-10-16 02:28:01 +03:00
|
|
|
rebasing ed8545a5c22a "F"
|
2019-12-18 00:45:17 +03:00
|
|
|
rebasing 4d1ef7d890c5 "G"
|
2018-07-02 21:27:20 +03:00
|
|
|
merging E
|
2018-10-22 22:45:46 +03:00
|
|
|
warning: 1 conflicts while merging E! (edit, then use 'hg resolve --mark')
|
2018-07-02 21:27:20 +03:00
|
|
|
unresolved conflicts (see hg resolve, then hg rebase --continue)
|
|
|
|
[1]
|
|
|
|
|
|
|
|
$ echo R > E
|
|
|
|
$ hg resolve --mark -q
|
|
|
|
continue: hg rebase --continue
|
|
|
|
$ hg rebase --continue
|
2019-10-16 02:28:01 +03:00
|
|
|
already rebased ed8545a5c22a "F" as 2282fe522d5c
|
|
|
|
rebasing 4d1ef7d890c5 "G"
|
2018-07-02 21:27:20 +03:00
|
|
|
|
|
|
|
$ showgraph
|
2018-08-15 09:13:17 +03:00
|
|
|
o 8 3b00517bf275 G
|
2018-07-02 21:27:20 +03:00
|
|
|
|
|
2018-08-15 09:13:17 +03:00
|
|
|
| @ 7 2282fe522d5c F
|
2018-07-02 21:27:20 +03:00
|
|
|
| |
|
2018-08-15 09:13:17 +03:00
|
|
|
o | 4 7fb047a69f22 E
|
2018-07-02 21:27:20 +03:00
|
|
|
| |
|
2020-01-16 12:01:10 +03:00
|
|
|
| o 3 dc0947a82db8 C
|
2018-07-02 21:27:20 +03:00
|
|
|
|/
|
2018-08-15 09:13:17 +03:00
|
|
|
o 0 426bada5c675 A
|
2018-07-02 21:27:20 +03:00
|
|
|
|