Show More
@@ -139,6 +139,9 b' class rebaseruntime(object):' | |||
|
139 | 139 | self.skipped = set() |
|
140 | 140 | self.targetancestors = set() |
|
141 | 141 | |
|
142 | self.collapsef = opts.get('collapse', False) | |
|
143 | self.collapsemsg = cmdutil.logmessage(ui, opts) | |
|
144 | ||
|
142 | 145 | @command('rebase', |
|
143 | 146 | [('s', 'source', '', |
|
144 | 147 | _('rebase the specified changeset and descendants'), _('REV')), |
@@ -266,8 +269,6 b' def rebase(ui, repo, **opts):' | |||
|
266 | 269 | destspace = opts.get('_destspace') |
|
267 | 270 | contf = opts.get('continue') |
|
268 | 271 | abortf = opts.get('abort') |
|
269 | collapsef = opts.get('collapse', False) | |
|
270 | collapsemsg = cmdutil.logmessage(ui, opts) | |
|
271 | 272 | date = opts.get('date', None) |
|
272 | 273 | e = opts.get('extrafn') # internal, used by e.g. hgsubversion |
|
273 | 274 | extrafns = [_savegraft] |
@@ -290,14 +291,14 b' def rebase(ui, repo, **opts):' | |||
|
290 | 291 | "'histedit' extension (see \"%s\")") % help |
|
291 | 292 | raise error.Abort(msg) |
|
292 | 293 | |
|
293 | if collapsemsg and not collapsef: | |
|
294 | if rbsrt.collapsemsg and not rbsrt.collapsef: | |
|
294 | 295 | raise error.Abort( |
|
295 | 296 | _('message can only be specified with collapse')) |
|
296 | 297 | |
|
297 | 298 | if contf or abortf: |
|
298 | 299 | if contf and abortf: |
|
299 | 300 | raise error.Abort(_('cannot use both abort and continue')) |
|
300 | if collapsef: | |
|
301 | if rbsrt.collapsef: | |
|
301 | 302 | raise error.Abort( |
|
302 | 303 | _('cannot use collapse with continue or abort')) |
|
303 | 304 | if srcf or basef or destf: |
@@ -308,9 +309,9 b' def rebase(ui, repo, **opts):' | |||
|
308 | 309 | |
|
309 | 310 | try: |
|
310 | 311 | (rbsrt.originalwd, rbsrt.target, rbsrt.state, |
|
311 | rbsrt.skipped, collapsef, keepf, keepbranchesf, | |
|
312 | rbsrt.skipped, rbsrt.collapsef, keepf, keepbranchesf, | |
|
312 | 313 | rbsrt.external, rbsrt.activebookmark) = restorestatus(repo) |
|
313 | collapsemsg = restorecollapsemsg(repo) | |
|
314 | rbsrt.collapsemsg = restorecollapsemsg(repo) | |
|
314 | 315 | except error.RepoLookupError: |
|
315 | 316 | if abortf: |
|
316 | 317 | clearstatus(repo) |
@@ -366,7 +367,7 b' def rebase(ui, repo, **opts):' | |||
|
366 | 367 | rebasesetrevs, |
|
367 | 368 | rebaseobsskipped) |
|
368 | 369 | |
|
369 | result = buildstate(repo, dest, rebaseset, collapsef, | |
|
370 | result = buildstate(repo, dest, rebaseset, rbsrt.collapsef, | |
|
370 | 371 | obsoletenotrebased) |
|
371 | 372 | |
|
372 | 373 | if not result: |
@@ -381,7 +382,7 b' def rebase(ui, repo, **opts):' | |||
|
381 | 382 | hint=_('see "hg help phases" for details')) |
|
382 | 383 | |
|
383 | 384 | (rbsrt.originalwd, rbsrt.target, rbsrt.state) = result |
|
384 | if collapsef: | |
|
385 | if rbsrt.collapsef: | |
|
385 | 386 | rbsrt.targetancestors = repo.changelog.ancestors([rbsrt.target], |
|
386 | 387 | inclusive=True) |
|
387 | 388 | rbsrt.external = externalparent(repo, rbsrt.state, |
@@ -395,7 +396,7 b' def rebase(ui, repo, **opts):' | |||
|
395 | 396 | # there's a user-provided extrafn it can clobber branch if |
|
396 | 397 | # desired |
|
397 | 398 | extrafns.insert(0, _savebranch) |
|
398 | if collapsef: | |
|
399 | if rbsrt.collapsef: | |
|
399 | 400 | branches = set() |
|
400 | 401 | for rev in rbsrt.state: |
|
401 | 402 | branches.add(repo[rev].branch()) |
@@ -436,9 +437,10 b' def rebase(ui, repo, **opts):' | |||
|
436 | 437 | rbsrt.targetancestors, |
|
437 | 438 | obsoletenotrebased) |
|
438 | 439 | storestatus(repo, rbsrt.originalwd, rbsrt.target, |
|
439 |
rbsrt.state, collapsef, keepf, |
|
|
440 |
rbsrt.external, |
|
|
441 | storecollapsemsg(repo, collapsemsg) | |
|
440 | rbsrt.state, rbsrt.collapsef, keepf, | |
|
441 | keepbranchesf, rbsrt.external, | |
|
442 | rbsrt.activebookmark) | |
|
443 | storecollapsemsg(repo, rbsrt.collapsemsg) | |
|
442 | 444 | if len(repo[None].parents()) == 2: |
|
443 | 445 | repo.ui.debug('resuming interrupted rebase\n') |
|
444 | 446 | else: |
@@ -446,14 +448,14 b' def rebase(ui, repo, **opts):' | |||
|
446 | 448 | ui.setconfig('ui', 'forcemerge', opts.get('tool', ''), |
|
447 | 449 | 'rebase') |
|
448 | 450 | stats = rebasenode(repo, rev, p1, base, rbsrt.state, |
|
449 | collapsef, rbsrt.target) | |
|
451 | rbsrt.collapsef, rbsrt.target) | |
|
450 | 452 | if stats and stats[3] > 0: |
|
451 | 453 | raise error.InterventionRequired( |
|
452 | 454 | _('unresolved conflicts (see hg ' |
|
453 | 455 | 'resolve, then hg rebase --continue)')) |
|
454 | 456 | finally: |
|
455 | 457 | ui.setconfig('ui', 'forcemerge', '', 'rebase') |
|
456 | if not collapsef: | |
|
458 | if not rbsrt.collapsef: | |
|
457 | 459 | merging = p2 != nullrev |
|
458 | 460 | editform = cmdutil.mergeeditform(merging, 'rebase') |
|
459 | 461 | editor = cmdutil.getcommiteditor(editform=editform, **opts) |
@@ -472,7 +474,7 b' def rebase(ui, repo, **opts):' | |||
|
472 | 474 | rbsrt.state[rev] = repo[newnode].rev() |
|
473 | 475 | ui.debug('rebased as %s\n' % short(newnode)) |
|
474 | 476 | else: |
|
475 | if not collapsef: | |
|
477 | if not rbsrt.collapsef: | |
|
476 | 478 | ui.warn(_('note: rebase of %d:%s created no changes ' |
|
477 | 479 | 'to commit\n') % (rev, ctx)) |
|
478 | 480 | rbsrt.skipped.add(rev) |
@@ -498,15 +500,15 b' def rebase(ui, repo, **opts):' | |||
|
498 | 500 | ui.progress(_('rebasing'), None) |
|
499 | 501 | ui.note(_('rebase merging completed\n')) |
|
500 | 502 | |
|
501 | if collapsef and not keepopen: | |
|
503 | if rbsrt.collapsef and not keepopen: | |
|
502 | 504 | p1, p2, _base = defineparents(repo, min(rbsrt.state), |
|
503 | 505 | rbsrt.target, rbsrt.state, |
|
504 | 506 | rbsrt.targetancestors, |
|
505 | 507 | obsoletenotrebased) |
|
506 | 508 | editopt = opts.get('edit') |
|
507 | 509 | editform = 'rebase.collapse' |
|
508 | if collapsemsg: | |
|
509 | commitmsg = collapsemsg | |
|
510 | if rbsrt.collapsemsg: | |
|
511 | commitmsg = rbsrt.collapsemsg | |
|
510 | 512 | else: |
|
511 | 513 | commitmsg = 'Collapsed revision' |
|
512 | 514 | for rebased in rbsrt.state: |
@@ -558,7 +560,7 b' def rebase(ui, repo, **opts):' | |||
|
558 | 560 | |
|
559 | 561 | if not keepf: |
|
560 | 562 | collapsedas = None |
|
561 | if collapsef: | |
|
563 | if rbsrt.collapsef: | |
|
562 | 564 | collapsedas = newnode |
|
563 | 565 | clearrebased(ui, repo, rbsrt.state, rbsrt.skipped, collapsedas) |
|
564 | 566 |
General Comments 0
You need to be logged in to leave comments.
Login now