D3870: rebase: add --confirm option

Yuya Nishihara yuya at tcha.org
Wed Jul 11 07:15:24 EDT 2018


Still can't apply. Which revision is this patch based on?

>      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:
>              ui.status(_('hit a merge conflict\n'))
> +            if confirm:
> +                # abort as in-memory merge doesn't support conflict
> +                rbsrt._prepareabortorcontinue(isabort=True, backup=False,
> +                                              suppwarns=True)
> +                if not ui.promptchoice(_(b'apply changes (yn)?'
> +                                         b'$$ &Yes $$ &No')):
> +                    _dorebase(ui, repo, opts, inmemory=False)
>              return 1
>          else:
> -            ui.status(_('dry-run rebase completed successfully; run without '
> -                        '-n/--dry-run to perform this rebase\n'))
> +            if confirm:
> +                ui.status(_('rebase completed successfully\n'))
> +                if not ui.promptchoice(_(b'apply changes (yn)?'
> +                                         b'$$ &Yes $$ &No')):

If KeyboardInterrupt is raised here for example, abort() wouldn't be called.

>          finally:
> -            # no need to store backup in case of dryrun
> -            rbsrt._prepareabortorcontinue(isabort=True, backup=False,
> -                                          suppwarns=True)
> +            if not confirm:
> +                # no need to store backup in case of dryrun
> +                rbsrt._prepareabortorcontinue(isabort=True, backup=False,
> +                                              suppwarns=True)


More information about the Mercurial-devel mailing list