##// END OF EJS Templates
test-rebase-abort: add test from issue4009...
Jordi Gutiérrez Hermoso -
r25069:01ad8daa stable
parent child Browse files
Show More
@@ -1,243 +1,290 b''
1 1 $ cat >> $HGRCPATH <<EOF
2 2 > [extensions]
3 3 > rebase=
4 4 >
5 5 > [phases]
6 6 > publish=False
7 7 >
8 8 > [alias]
9 9 > tglog = log -G --template "{rev}:{phase} '{desc}' {branches}\n"
10 10 > EOF
11 11
12 12
13 13 $ hg init a
14 14 $ cd a
15 15
16 16 $ touch .hg/rebasestate
17 17 $ hg sum
18 18 parent: -1:000000000000 tip (empty repository)
19 19 branch: default
20 20 commit: (clean)
21 21 update: (current)
22 22 abort: .hg/rebasestate is incomplete
23 23 [255]
24 24 $ rm .hg/rebasestate
25 25
26 26 $ echo c1 > common
27 27 $ hg add common
28 28 $ hg ci -m C1
29 29
30 30 $ echo c2 >> common
31 31 $ hg ci -m C2
32 32
33 33 $ echo c3 >> common
34 34 $ hg ci -m C3
35 35
36 36 $ hg up -q -C 1
37 37
38 38 $ echo l1 >> extra
39 39 $ hg add extra
40 40 $ hg ci -m L1
41 41 created new head
42 42
43 43 $ sed -e 's/c2/l2/' common > common.new
44 44 $ mv common.new common
45 45 $ hg ci -m L2
46 46
47 47 $ hg phase --force --secret 2
48 48
49 49 $ hg tglog
50 50 @ 4:draft 'L2'
51 51 |
52 52 o 3:draft 'L1'
53 53 |
54 54 | o 2:secret 'C3'
55 55 |/
56 56 o 1:draft 'C2'
57 57 |
58 58 o 0:draft 'C1'
59 59
60 60
61 61 Conflicting rebase:
62 62
63 63 $ hg rebase -s 3 -d 2
64 64 rebasing 3:3163e20567cc "L1"
65 65 rebasing 4:46f0b057b5c0 "L2" (tip)
66 66 merging common
67 67 warning: conflicts during merge.
68 68 merging common incomplete! (edit conflicts, then use 'hg resolve --mark')
69 69 unresolved conflicts (see hg resolve, then hg rebase --continue)
70 70 [1]
71 71
72 72 Abort:
73 73
74 74 $ hg rebase --abort
75 75 saved backup bundle to $TESTTMP/a/.hg/strip-backup/3e046f2ecedb-6beef7d5-backup.hg (glob)
76 76 rebase aborted
77 77
78 78 $ hg tglog
79 79 @ 4:draft 'L2'
80 80 |
81 81 o 3:draft 'L1'
82 82 |
83 83 | o 2:secret 'C3'
84 84 |/
85 85 o 1:draft 'C2'
86 86 |
87 87 o 0:draft 'C1'
88 88
89 89 Test safety for inconsistent rebase state, which may be created (and
90 90 forgotten) by Mercurial earlier than 2.7. This emulates Mercurial
91 91 earlier than 2.7 by renaming ".hg/rebasestate" temporarily.
92 92
93 93 $ hg rebase -s 3 -d 2
94 94 rebasing 3:3163e20567cc "L1"
95 95 rebasing 4:46f0b057b5c0 "L2" (tip)
96 96 merging common
97 97 warning: conflicts during merge.
98 98 merging common incomplete! (edit conflicts, then use 'hg resolve --mark')
99 99 unresolved conflicts (see hg resolve, then hg rebase --continue)
100 100 [1]
101 101
102 102 $ mv .hg/rebasestate .hg/rebasestate.back
103 103 $ hg update --quiet --clean 2
104 104 $ hg --config extensions.mq= strip --quiet "destination()"
105 105 $ mv .hg/rebasestate.back .hg/rebasestate
106 106
107 107 $ hg rebase --continue
108 108 abort: cannot continue inconsistent rebase
109 109 (use "hg rebase --abort" to clear broken state)
110 110 [255]
111 111 $ hg summary | grep '^rebase: '
112 112 rebase: (use "hg rebase --abort" to clear broken state)
113 113 $ hg rebase --abort
114 114 rebase aborted (no revision is removed, only broken state is cleared)
115 115
116 116 $ cd ..
117 117
118 118
119 119 Construct new repo:
120 120
121 121 $ hg init b
122 122 $ cd b
123 123
124 124 $ echo a > a
125 125 $ hg ci -Am A
126 126 adding a
127 127
128 128 $ echo b > b
129 129 $ hg ci -Am B
130 130 adding b
131 131
132 132 $ echo c > c
133 133 $ hg ci -Am C
134 134 adding c
135 135
136 136 $ hg up -q 0
137 137
138 138 $ echo b > b
139 139 $ hg ci -Am 'B bis'
140 140 adding b
141 141 created new head
142 142
143 143 $ echo c1 > c
144 144 $ hg ci -Am C1
145 145 adding c
146 146
147 147 $ hg phase --force --secret 1
148 148 $ hg phase --public 1
149 149
150 150 Rebase and abort without generating new changesets:
151 151
152 152 $ hg tglog
153 153 @ 4:draft 'C1'
154 154 |
155 155 o 3:draft 'B bis'
156 156 |
157 157 | o 2:secret 'C'
158 158 | |
159 159 | o 1:public 'B'
160 160 |/
161 161 o 0:public 'A'
162 162
163 163 $ hg rebase -b 4 -d 2
164 164 rebasing 3:a6484957d6b9 "B bis"
165 165 note: rebase of 3:a6484957d6b9 created no changes to commit
166 166 rebasing 4:145842775fec "C1" (tip)
167 167 merging c
168 168 warning: conflicts during merge.
169 169 merging c incomplete! (edit conflicts, then use 'hg resolve --mark')
170 170 unresolved conflicts (see hg resolve, then hg rebase --continue)
171 171 [1]
172 172
173 173 $ hg tglog
174 174 @ 4:draft 'C1'
175 175 |
176 176 o 3:draft 'B bis'
177 177 |
178 178 | @ 2:secret 'C'
179 179 | |
180 180 | o 1:public 'B'
181 181 |/
182 182 o 0:public 'A'
183 183
184 184 $ hg rebase -a
185 185 rebase aborted
186 186
187 187 $ hg tglog
188 188 @ 4:draft 'C1'
189 189 |
190 190 o 3:draft 'B bis'
191 191 |
192 192 | o 2:secret 'C'
193 193 | |
194 194 | o 1:public 'B'
195 195 |/
196 196 o 0:public 'A'
197 197
198 198
199 199 $ cd ..
200 200
201 201 rebase abort should not leave working copy in a merge state if tip-1 is public
202 202 (issue4082)
203 203
204 204 $ hg init abortpublic
205 205 $ cd abortpublic
206 206 $ echo a > a && hg ci -Aqm a
207 207 $ hg book master
208 208 $ hg book foo
209 209 $ echo b > b && hg ci -Aqm b
210 210 $ hg up -q master
211 211 $ echo c > c && hg ci -Aqm c
212 212 $ hg phase -p -r .
213 213 $ hg up -q foo
214 214 $ echo C > c && hg ci -Aqm C
215 215 $ hg log -G --template "{rev} {desc} {bookmarks}"
216 216 @ 3 C foo
217 217 |
218 218 | o 2 c master
219 219 | |
220 220 o | 1 b
221 221 |/
222 222 o 0 a
223 223
224 224
225 225 $ hg rebase -d master -r foo
226 226 rebasing 3:6c0f977a22d8 "C" (tip foo)
227 227 merging c
228 228 warning: conflicts during merge.
229 229 merging c incomplete! (edit conflicts, then use 'hg resolve --mark')
230 230 unresolved conflicts (see hg resolve, then hg rebase --continue)
231 231 [1]
232 232 $ hg rebase --abort
233 233 rebase aborted
234 234 $ hg log -G --template "{rev} {desc} {bookmarks}"
235 235 @ 3 C foo
236 236 |
237 237 | o 2 c master
238 238 | |
239 239 o | 1 b
240 240 |/
241 241 o 0 a
242 242
243 243 $ cd ..
244
245 Make sure we don't clobber changes in the working directory when the
246 user has somehow managed to update to a different revision (issue4009)
247
248 $ hg init noupdate
249 $ cd noupdate
250 $ hg book @
251 $ echo original > a
252 $ hg add a
253 $ hg commit -m a
254 $ echo x > b
255 $ hg add b
256 $ hg commit -m b1
257 $ hg up 0
258 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
259 (leaving bookmark @)
260 $ hg book foo
261 $ echo y > b
262 $ hg add b
263 $ hg commit -m b2
264 created new head
265
266 $ hg rebase -d @ -b foo --tool=internal:fail
267 rebasing 2:070cf4580bb5 "b2" (tip foo)
268 unresolved conflicts (see hg resolve, then hg rebase --continue)
269 [1]
270
271 $ mv .hg/rebasestate ./ # so we're allowed to hg up like in mercurial <2.6.3
272 $ hg up -C 0 # user does other stuff in the repo
273 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
274
275 $ mv rebasestate .hg/ # user upgrades to 2.7
276
277 $ echo new > a
278 $ hg up 1 # user gets an error saying to run hg rebase --abort
279 abort: rebase in progress
280 (use 'hg rebase --continue' or 'hg rebase --abort')
281 [255]
282
283 $ cat a
284 new
285 $ hg rebase --abort
286 rebase aborted
287 $ cat a
288 new
289
290 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now