##// END OF EJS Templates
rebase: move local variables related to keeping things unchanged to the RR...
Kostia Balytskyi -
r29402:7481ffb7 default
parent child Browse files
Show More
@@ -148,6 +148,12 b' class rebaseruntime(object):'
148 if e:
148 if e:
149 self.extrafns = [e]
149 self.extrafns = [e]
150
150
151 self.keepf = opts.get('keep', False)
152 self.keepbranchesf = opts.get('keepbranches', False)
153 # keepopen is not meant for use on the command line, but by
154 # other extensions
155 self.keepopen = opts.get('keepopen', False)
156
151 @command('rebase',
157 @command('rebase',
152 [('s', 'source', '',
158 [('s', 'source', '',
153 _('rebase the specified changeset and descendants'), _('REV')),
159 _('rebase the specified changeset and descendants'), _('REV')),
@@ -275,12 +281,6 b' def rebase(ui, repo, **opts):'
275 destspace = opts.get('_destspace')
281 destspace = opts.get('_destspace')
276 contf = opts.get('continue')
282 contf = opts.get('continue')
277 abortf = opts.get('abort')
283 abortf = opts.get('abort')
278 keepf = opts.get('keep', False)
279 keepbranchesf = opts.get('keepbranches', False)
280 # keepopen is not meant for use on the command line, but by
281 # other extensions
282 keepopen = opts.get('keepopen', False)
283
284 if opts.get('interactive'):
284 if opts.get('interactive'):
285 try:
285 try:
286 if extensions.find('histedit'):
286 if extensions.find('histedit'):
@@ -310,8 +310,9 b' def rebase(ui, repo, **opts):'
310
310
311 try:
311 try:
312 (rbsrt.originalwd, rbsrt.target, rbsrt.state,
312 (rbsrt.originalwd, rbsrt.target, rbsrt.state,
313 rbsrt.skipped, rbsrt.collapsef, keepf, keepbranchesf,
313 rbsrt.skipped, rbsrt.collapsef, rbsrt.keepf,
314 rbsrt.external, rbsrt.activebookmark) = restorestatus(repo)
314 rbsrt.keepbranchesf, rbsrt.external,
315 rbsrt.activebookmark) = restorestatus(repo)
315 rbsrt.collapsemsg = restorecollapsemsg(repo)
316 rbsrt.collapsemsg = restorecollapsemsg(repo)
316 except error.RepoLookupError:
317 except error.RepoLookupError:
317 if abortf:
318 if abortf:
@@ -347,7 +348,7 b' def rebase(ui, repo, **opts):'
347 return _nothingtorebase()
348 return _nothingtorebase()
348
349
349 allowunstable = obsolete.isenabled(repo, obsolete.allowunstableopt)
350 allowunstable = obsolete.isenabled(repo, obsolete.allowunstableopt)
350 if (not (keepf or allowunstable)
351 if (not (rbsrt.keepf or allowunstable)
351 and repo.revs('first(children(%ld) - %ld)',
352 and repo.revs('first(children(%ld) - %ld)',
352 rebaseset, rebaseset)):
353 rebaseset, rebaseset)):
353 raise error.Abort(
354 raise error.Abort(
@@ -377,7 +378,7 b' def rebase(ui, repo, **opts):'
377 return _nothingtorebase()
378 return _nothingtorebase()
378
379
379 root = min(rebaseset)
380 root = min(rebaseset)
380 if not keepf and not repo[root].mutable():
381 if not rbsrt.keepf and not repo[root].mutable():
381 raise error.Abort(_("can't rebase public changeset %s")
382 raise error.Abort(_("can't rebase public changeset %s")
382 % repo[root],
383 % repo[root],
383 hint=_('see "hg help phases" for details'))
384 hint=_('see "hg help phases" for details'))
@@ -389,10 +390,10 b' def rebase(ui, repo, **opts):'
389 rbsrt.external = externalparent(repo, rbsrt.state,
390 rbsrt.external = externalparent(repo, rbsrt.state,
390 rbsrt.targetancestors)
391 rbsrt.targetancestors)
391
392
392 if dest.closesbranch() and not keepbranchesf:
393 if dest.closesbranch() and not rbsrt.keepbranchesf:
393 ui.status(_('reopening closed branch head %s\n') % dest)
394 ui.status(_('reopening closed branch head %s\n') % dest)
394
395
395 if keepbranchesf:
396 if rbsrt.keepbranchesf:
396 # insert _savebranch at the start of extrafns so if
397 # insert _savebranch at the start of extrafns so if
397 # there's a user-provided extrafn it can clobber branch if
398 # there's a user-provided extrafn it can clobber branch if
398 # desired
399 # desired
@@ -438,8 +439,8 b' def rebase(ui, repo, **opts):'
438 rbsrt.targetancestors,
439 rbsrt.targetancestors,
439 obsoletenotrebased)
440 obsoletenotrebased)
440 storestatus(repo, rbsrt.originalwd, rbsrt.target,
441 storestatus(repo, rbsrt.originalwd, rbsrt.target,
441 rbsrt.state, rbsrt.collapsef, keepf,
442 rbsrt.state, rbsrt.collapsef, rbsrt.keepf,
442 keepbranchesf, rbsrt.external,
443 rbsrt.keepbranchesf, rbsrt.external,
443 rbsrt.activebookmark)
444 rbsrt.activebookmark)
444 storecollapsemsg(repo, rbsrt.collapsemsg)
445 storecollapsemsg(repo, rbsrt.collapsemsg)
445 if len(repo[None].parents()) == 2:
446 if len(repo[None].parents()) == 2:
@@ -462,7 +463,7 b' def rebase(ui, repo, **opts):'
462 editor = cmdutil.getcommiteditor(editform=editform, **opts)
463 editor = cmdutil.getcommiteditor(editform=editform, **opts)
463 newnode = concludenode(repo, rev, p1, p2, extrafn=extrafn,
464 newnode = concludenode(repo, rev, p1, p2, extrafn=extrafn,
464 editor=editor,
465 editor=editor,
465 keepbranches=keepbranchesf,
466 keepbranches=rbsrt.keepbranchesf,
466 date=rbsrt.date)
467 date=rbsrt.date)
467 else:
468 else:
468 # Skip commit if we are collapsing
469 # Skip commit if we are collapsing
@@ -501,7 +502,7 b' def rebase(ui, repo, **opts):'
501 ui.progress(_('rebasing'), None)
502 ui.progress(_('rebasing'), None)
502 ui.note(_('rebase merging completed\n'))
503 ui.note(_('rebase merging completed\n'))
503
504
504 if rbsrt.collapsef and not keepopen:
505 if rbsrt.collapsef and not rbsrt.keepopen:
505 p1, p2, _base = defineparents(repo, min(rbsrt.state),
506 p1, p2, _base = defineparents(repo, min(rbsrt.state),
506 rbsrt.target, rbsrt.state,
507 rbsrt.target, rbsrt.state,
507 rbsrt.targetancestors,
508 rbsrt.targetancestors,
@@ -521,7 +522,7 b' def rebase(ui, repo, **opts):'
521 newnode = concludenode(repo, rev, p1, rbsrt.external,
522 newnode = concludenode(repo, rev, p1, rbsrt.external,
522 commitmsg=commitmsg,
523 commitmsg=commitmsg,
523 extrafn=extrafn, editor=editor,
524 extrafn=extrafn, editor=editor,
524 keepbranches=keepbranchesf,
525 keepbranches=rbsrt.keepbranchesf,
525 date=rbsrt.date)
526 date=rbsrt.date)
526 if newnode is None:
527 if newnode is None:
527 newrev = rbsrt.target
528 newrev = rbsrt.target
@@ -559,7 +560,7 b' def rebase(ui, repo, **opts):'
559 ui.note(_("update back to initial working directory parent\n"))
560 ui.note(_("update back to initial working directory parent\n"))
560 hg.updaterepo(repo, newwd, False)
561 hg.updaterepo(repo, newwd, False)
561
562
562 if not keepf:
563 if not rbsrt.keepf:
563 collapsedas = None
564 collapsedas = None
564 if rbsrt.collapsef:
565 if rbsrt.collapsef:
565 collapsedas = newnode
566 collapsedas = newnode
General Comments 0
You need to be logged in to leave comments. Login now