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