comparison tests/test-rebase-inmemory.t @ 38372:f4f1fb1cbfb4

rebase: add dry-run functionality For now, it gives stats about rebase would be successful or hit a conflict. Remaining work is to improve the output and adding verbose mode where will show the diff of conflicting files if we hit any. Differential Revision: https://phab.mercurial-scm.org/D3757
author Sushil khanchi <sushilkhanchi97@gmail.com>
date Sat, 16 Jun 2018 08:22:10 +0530
parents 795eb53f1d3e
children e6b643ccf87d
comparison
equal deleted inserted replaced
38371:fb4813304c5f 38372:f4f1fb1cbfb4
153 | | 153 | |
154 | o 1: fc055c3b4d33 'b' 154 | o 1: fc055c3b4d33 'b'
155 |/ 155 |/
156 o 0: b173517d0057 'a' 156 o 0: b173517d0057 'a'
157 157
158 158 Test dry-run rebasing
159 $ hg init skrepo
160 $ cd skrepo
161 $ echo a>a
162 $ hg ci -Aqma
163 $ echo b>b
164 $ hg ci -Aqmb
165 $ echo c>c
166 $ hg ci -Aqmc
167 $ echo d>d
168 $ hg ci -Aqmd
169 $ echo e>e
170 $ hg ci -Aqme
171
172 $ hg up 1 -q
173 $ echo f>f
174 $ hg ci -Amf
175 adding f
176 created new head
177 $ echo g>g
178 $ hg ci -Aqmg
179 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
180 @ 6:baf10c5166d4 test
181 | g
182 |
183 o 5:6343ca3eff20 test
184 | f
185 |
186 | o 4:e860deea161a test
187 | | e
188 | |
189 | o 3:055a42cdd887 test
190 | | d
191 | |
192 | o 2:177f92b77385 test
193 |/ c
194 |
195 o 1:d2ae7f538514 test
196 | b
197 |
198 o 0:cb9a9f314b8b test
199 a
200
201 Make sure it throws error while passing --continue or --abort with --dry-run
202 $ hg rebase -s 2 -d 6 -n --continue
203 abort: cannot specify both --dry-run and --continue
204 [255]
205 $ hg rebase -s 2 -d 6 -n --abort
206 abort: cannot specify both --dry-run and --abort
207 [255]
208
209 Check dryrun gives correct results when there is no conflict in rebasing
210 $ hg rebase -s 2 -d 6 -n
211 rebasing 2:177f92b77385 "c"
212 rebasing 3:055a42cdd887 "d"
213 rebasing 4:e860deea161a "e"
214 there will be no conflict, you can rebase
215 saved backup bundle to $TESTTMP/repo1/repo2/skrepo/.hg/strip-backup/c83b1da5b1ae-f1e0beb9-backup.hg
216 rebase aborted
217
218 $ hg diff
219 $ hg status
220
221 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
222 @ 6:baf10c5166d4 test
223 | g
224 |
225 o 5:6343ca3eff20 test
226 | f
227 |
228 | o 4:e860deea161a test
229 | | e
230 | |
231 | o 3:055a42cdd887 test
232 | | d
233 | |
234 | o 2:177f92b77385 test
235 |/ c
236 |
237 o 1:d2ae7f538514 test
238 | b
239 |
240 o 0:cb9a9f314b8b test
241 a
242
243 Check dryrun working with --collapse when there is no conflict
244 $ hg rebase -s 2 -d 6 -n --collapse
245 rebasing 2:177f92b77385 "c"
246 rebasing 3:055a42cdd887 "d"
247 rebasing 4:e860deea161a "e"
248 there will be no conflict, you can rebase
249 rebase aborted
250
251 Check dryrun gives correct results when there is conflict in rebasing
252 Make a conflict:
253 $ hg up 6 -q
254 $ echo conflict>e
255 $ hg ci -Aqm "conflict with e"
256 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
257 @ 7:d2c195b28050 test
258 | conflict with e
259 |
260 o 6:baf10c5166d4 test
261 | g
262 |
263 o 5:6343ca3eff20 test
264 | f
265 |
266 | o 4:e860deea161a test
267 | | e
268 | |
269 | o 3:055a42cdd887 test
270 | | d
271 | |
272 | o 2:177f92b77385 test
273 |/ c
274 |
275 o 1:d2ae7f538514 test
276 | b
277 |
278 o 0:cb9a9f314b8b test
279 a
280
281 $ hg rebase -s 2 -d 7 -n
282 rebasing 2:177f92b77385 "c"
283 rebasing 3:055a42cdd887 "d"
284 rebasing 4:e860deea161a "e"
285 merging e
286 transaction abort!
287 rollback completed
288 hit a merge conflict
289 rebase aborted
290 $ hg diff
291 $ hg status
292 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
293 @ 7:d2c195b28050 test
294 | conflict with e
295 |
296 o 6:baf10c5166d4 test
297 | g
298 |
299 o 5:6343ca3eff20 test
300 | f
301 |
302 | o 4:e860deea161a test
303 | | e
304 | |
305 | o 3:055a42cdd887 test
306 | | d
307 | |
308 | o 2:177f92b77385 test
309 |/ c
310 |
311 o 1:d2ae7f538514 test
312 | b
313 |
314 o 0:cb9a9f314b8b test
315 a
316
317 Check dryrun working with --collapse when there is conflicts
318 $ hg rebase -s 2 -d 7 -n --collapse
319 rebasing 2:177f92b77385 "c"
320 rebasing 3:055a42cdd887 "d"
321 rebasing 4:e860deea161a "e"
322 merging e
323 hit a merge conflict
324 rebase aborted