Debian Codegraph @

tests/test-rebase-emptycommit.t

raw
1 $ cat >> $HGRCPATH<<EOF
2 > [extensions]
3 > rebase=
4 > drawdag=$TESTDIR/drawdag.py
5 > EOF
6
7 $ hg init non-merge
8 $ cd non-merge
9 $ hg debugdrawdag<<'EOS'
10 > F
11 > |
12 > E
13 > |
14 > D
15 > |
16 > B C
17 > |/
18 > A
19 > EOS
20
21 $ for i in C D E F; do
22 > hg bookmark -r $i -i BOOK-$i
23 > done
24
25 $ hg debugdrawdag<<'EOS'
26 > E
27 > |
28 > D
29 > |
30 > B
31 > EOS
32
33 $ hg log -G -T '{rev} {desc} {bookmarks}'
34 o 7 E
35 |
36 o 6 D
37 |
38 | o 5 F BOOK-F
39 | |
40 | o 4 E BOOK-E
41 | |
42 | o 3 D BOOK-D
43 | |
44 | o 2 C BOOK-C
45 | |
46 o | 1 B
47 |/
48 o 0 A
49
50 With --keep, bookmark should move
51
52 $ hg rebase -r 3+4 -d E --keep
53 rebasing 3:e7b3f00ed42e BOOK-D "D"
54 note: not rebasing 3:e7b3f00ed42e BOOK-D "D", its destination already has all its changes
55 rebasing 4:69a34c08022a BOOK-E "E"
56 note: not rebasing 4:69a34c08022a BOOK-E "E", its destination already has all its changes
57 $ hg log -G -T '{rev} {desc} {bookmarks}'
58 o 7 E BOOK-D BOOK-E
59 |
60 o 6 D
61 |
62 | o 5 F BOOK-F
63 | |
64 | o 4 E
65 | |
66 | o 3 D
67 | |
68 | o 2 C BOOK-C
69 | |
70 o | 1 B
71 |/
72 o 0 A
73
74 Move D and E back for the next test
75
76 $ hg bookmark BOOK-D -fqir 3
77 $ hg bookmark BOOK-E -fqir 4
78
79 Bookmark is usually an indication of a head. For changes that are introduced by
80 an ancestor of bookmark B, after moving B to B-NEW, the changes are ideally
81 still introduced by an ancestor of changeset on B-NEW. In the below case,
82 "BOOK-D", and "BOOK-E" include changes introduced by "C".
83
84 $ hg rebase -s 2 -d E
85 rebasing 2:dc0947a82db8 BOOK-C C "C"
86 rebasing 3:e7b3f00ed42e BOOK-D "D"
87 note: not rebasing 3:e7b3f00ed42e BOOK-D "D", its destination already has all its changes
88 rebasing 4:69a34c08022a BOOK-E "E"
89 note: not rebasing 4:69a34c08022a BOOK-E "E", its destination already has all its changes
90 rebasing 5:6b2aeab91270 BOOK-F F "F"
91 saved backup bundle to $TESTTMP/non-merge/.hg/strip-backup/dc0947a82db8-52bb4973-rebase.hg
92 $ hg log -G -T '{rev} {desc} {bookmarks}'
93 o 5 F BOOK-F
94 |
95 o 4 C BOOK-C BOOK-D BOOK-E
96 |
97 o 3 E
98 |
99 o 2 D
100 |
101 o 1 B
102 |
103 o 0 A
104
105 Merge and its ancestors all become empty
106
107 $ hg init $TESTTMP/merge1
108 $ cd $TESTTMP/merge1
109
110 $ hg debugdrawdag<<'EOS'
111 > E
112 > /|
113 > B C D
114 > \|/
115 > A
116 > EOS
117
118 $ for i in C D E; do
119 > hg bookmark -r $i -i BOOK-$i
120 > done
121
122 $ hg debugdrawdag<<'EOS'
123 > H
124 > |
125 > D
126 > |
127 > C
128 > |
129 > B
130 > EOS
131
132 Previously, there was a bug where the empty commit check compared the parent
133 branch name with the wdir branch name instead of the actual branch name (which
134 should stay unchanged if --keepbranches is passed), and erroneously assumed
135 that an otherwise empty changeset should be created because of the incorrectly
136 assumed branch name change.
137
138 $ hg update H -q
139 $ hg branch foo -q
140
141 $ hg rebase -r '(A::)-(B::)-A' -d H --keepbranches
142 rebasing 2:dc0947a82db8 BOOK-C "C"
143 note: not rebasing 2:dc0947a82db8 BOOK-C "C", its destination already has all its changes
144 rebasing 3:b18e25de2cf5 BOOK-D "D"
145 note: not rebasing 3:b18e25de2cf5 BOOK-D "D", its destination already has all its changes
146 rebasing 4:86a1f6686812 BOOK-E E "E"
147 note: not rebasing 4:86a1f6686812 BOOK-E E "E", its destination already has all its changes
148 saved backup bundle to $TESTTMP/merge1/.hg/strip-backup/b18e25de2cf5-1fd0a4ba-rebase.hg
149 $ hg update null -q
150
151 $ hg log -G -T '{rev} {desc} {bookmarks}'
152 o 4 H BOOK-C BOOK-D BOOK-E
153 |
154 o 3 D
155 |
156 o 2 C
157 |
158 o 1 B
159 |
160 o 0 A
161
162 Part of ancestors of a merge become empty
163
164 $ hg init $TESTTMP/merge2
165 $ cd $TESTTMP/merge2
166
167 $ hg debugdrawdag<<'EOS'
168 > G
169 > /|
170 > E F
171 > | |
172 > B C D
173 > \|/
174 > A
175 > EOS
176
177 $ for i in C D E F G; do
178 > hg bookmark -r $i -i BOOK-$i
179 > done
180
181 $ hg debugdrawdag<<'EOS'
182 > H
183 > |
184 > F
185 > |
186 > C
187 > |
188 > B
189 > EOS
190
191 $ hg rebase -r '(A::)-(B::)-A' -d H
192 rebasing 2:dc0947a82db8 BOOK-C "C"
193 note: not rebasing 2:dc0947a82db8 BOOK-C "C", its destination already has all its changes
194 rebasing 3:b18e25de2cf5 BOOK-D D "D"
195 rebasing 4:03ca77807e91 BOOK-E E "E"
196 rebasing 5:ad6717a6a58e BOOK-F "F"
197 note: not rebasing 5:ad6717a6a58e BOOK-F "F", its destination already has all its changes
198 rebasing 6:c58e8bdac1f4 BOOK-G G "G"
199 saved backup bundle to $TESTTMP/merge2/.hg/strip-backup/b18e25de2cf5-2d487005-rebase.hg
200
201 $ hg log -G -T '{rev} {desc} {bookmarks}'
202 o 7 G BOOK-G
203 |\
204 | o 6 E BOOK-E
205 | |
206 o | 5 D BOOK-D BOOK-F
207 |/
208 o 4 H BOOK-C
209 |
210 o 3 F
211 |
212 o 2 C
213 |
214 o 1 B
215 |
216 o 0 A
217