D3959: rebase: add --stop option to stop rebase at any point (issue5206)
yuja (Yuya Nishihara)
phabricator at mercurial-scm.org
Wed Jul 18 09:01:10 EDT 2018
yuja added a comment.
> + def _stoprebase(self):
> + """stop the interrupted rebase"""
> + self.restorestatus()
> + if not self.stateobj.exists():
> + raise error.Abort(_("no interrupted rebase found"))
> + allowunstable = obsolete.isenabled(self.repo, obsolete.allowunstableopt)
> + if not (self.keepf or allowunstable):
> + raise error.Abort(_("can't remove original changesets with"
> + " unrebased descendants"),
> + hint=_('either enable evolve extension to allow unstable '
> + 'revisions or use --keep to keep original changesets'))
> +
> + # update to the last rebased node if any
> + ctx = self.repo[None]
> + pars = [p.node() for p in ctx.parents()]
> + p1 = pars[0]
> + hg.updaterepo(self.repo, p1, overwrite=True)
Perhaps this differs from what a successful rebase would do. Unlike graft,
`hg rebase` goes back to the original working directory.
> + # either mark obsolete or keep rebased revisions
> + repo, ui, opts = self.repo, self.ui, self.opts
> + fm = ui.formatter('rebase', opts)
> + fm.startitem()
> + clearrebased(ui, repo, self.destmap, self.state, self.skipped,
> + collapsedas=None, keepf=self.keepf, fm=fm)
> + clearstatus(self.repo)
> + fm.end()
> + return 0
I doubt if this would work with --collapse. Can you try writing some tests?
I'm not pretty sure, but it might be possible to utilize `_finishrebase()`
to implement --stop, roughly by:
1. restore status
2. drop revisions that aren't rebased yet
3. finish it
> + elif stop:
> + #todo: raise error for conflicting options
Yes!
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D3959
To: khanchi97, #hg-reviewers
Cc: yuja, mercurial-devel
More information about the Mercurial-devel
mailing list