D3870: rebase: add --confirm option

yuja (Yuya Nishihara) phabricator at mercurial-scm.org
Mon Jul 9 09:15:53 EDT 2018


yuja added a comment.


  >   def _dryrunrebase(ui, repo, opts):
  >       rbsrt = rebaseruntime(repo, ui, inmemory=True, opts=opts)
  > 
  > - ui.status(_('starting dry-run rebase; repository will not be changed\n')) +    confirm = opts.get('confirm') +    if confirm: +        ui.status(_('starting rebase...\n')) +    else: +        ui.status(_('starting dry-run rebase; repository will not be ' +                    'changed\n'))
  
  Nit: Perhaps --dry-run should precede --confirm, or "--dryrun --confirm" should
  be rejected.
  
  >   with repo.wlock(), repo.lock():
  >       try:
  >           overrides = {('rebase', 'singletransaction'): True}
  >           with ui.configoverride(overrides, 'rebase'):
  >               _origrebase(ui, repo, opts, rbsrt, inmemory=True,
  >                           leaveunfinished=True, supptrwarns=True)
  >       except error.InMemoryMergeConflictsError:
  > 
  > +            conflict = True
  > 
  >       ui.status(_('hit a merge conflict\n'))
  >       return 1
  >   else:
  > 
  > - ui.status(_('dry-run rebase completed successfully; run without '
  > - '-n/--dry-run to perform this rebase\n')) +            conflict = False +            if confirm: +                ui.status(_('rebase completed successfully\n')) +            else: +                ui.status(_('dry-run rebase completed successfully; run without' +                            ' -n/--dry-run to perform this rebase\n')) return 0 finally:
  >   1. no need to store backup in case of dryrun rbsrt._prepareabortorcontinue(isabort=True, backup=False, suppwarns=True) +            if confirm: +                if not ui.promptchoice(_(b'apply changes (yn)?' +                                         b'$$ &Yes $$ &No')): +                    if not conflict: +                        inmemory = ui.configbool('rebase', +                                                 'experimental.inmemory') +                        return _dorebase(ui, repo, opts, inmemory=inmemory) +                    return _dorebase(ui, repo, opts)
  
  Can't we just "finish" the last in-memory rebase if "apply changes" selected?

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D3870

To: khanchi97, #hg-reviewers
Cc: yuja, mercurial-devel


More information about the Mercurial-devel mailing list