[PATCH 1 of 8 v8] rebase: move abort/continue prep to be a method of the RR class

Yuya Nishihara yuya at tcha.org
Sun Jul 3 05:17:33 EDT 2016


On Fri, 1 Jul 2016 12:29:47 +0000, Kostiantyn Balytskyi wrote:
> # HG changeset patch
> # User Kostia Balytskyi <ikostia at fb.com>
> # Date 1467374993 -7200
> #      Fri Jul 01 14:09:53 2016 +0200
> # Node ID 16792bbea1d2886c5f98178b22be8edc5d4efc31
> # Parent  5b71a8d7f7ffc2662ceb58ad8eec806e147ae13d
> rebase: move abort/continue prep to be a method of the RR class

The series looks good to me. Queued them, thanks.

I found a few nits, so please send follow-up patches if you think they are
reasonable. It wouldn't be worth rewriting the whole series just because the
nits I found.

> +    def _prepareabortorcontinue(self, isabort):
> +        try:
> +            self.restorestatus()
> +            self.collapsemsg = restorecollapsemsg(self.repo)
> +        except error.RepoLookupError:
> +            if isabort:
> +                clearstatus(self.repo)
> +                clearcollapsemsg(self.repo)
> +                self.repo.ui.warn(_('rebase aborted (no revision is removed,'
> +                                    ' only broken state is cleared)\n'))
> +                return 0
> +            else:
> +                msg = _('cannot continue inconsistent rebase')
> +                hint = _('use "hg rebase --abort" to clear broken state')
> +                raise error.Abort(msg, hint=hint)
> +        if isabort:
> +            return abort(self.repo, self.originalwd, self.target,
> +                         self.state, activebookmark=self.activebookmark)

We'd better refactor this function to abort() and continue(). Only thing abort()
would need is self.restorestatus().


More information about the Mercurial-devel mailing list