Mercurial > hg
changeset 30272:3d38a0bc774f
cmdutil: refactor checkunresolved
localrepo.commit had code to check for unresolved merge conflicts,
it would be helpful for at least rebase to be able to use that
code without calling commit().
author | timeless <timeless@mozdev.org> |
---|---|
date | Wed, 02 Nov 2016 18:45:53 +0000 |
parents | 0fa1a41d04e4 |
children | 86f4ef63d507 |
files | mercurial/cmdutil.py mercurial/localrepo.py |
diffstat | 2 files changed, 9 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/cmdutil.py Wed Nov 02 18:56:07 2016 +0000 +++ b/mercurial/cmdutil.py Wed Nov 02 18:45:53 2016 +0000 @@ -3403,6 +3403,14 @@ return cmd +def checkunresolved(ms): + if list(ms.unresolved()): + raise error.Abort(_("unresolved merge conflicts " + "(see 'hg help resolve')")) + if ms.mdstate() != 's' or list(ms.driverresolved()): + raise error.Abort(_('driver-resolved merge conflicts'), + hint=_('run "hg resolve --all" to resolve')) + # a list of (ui, repo, otherpeer, opts, missing) functions called by # commands.outgoing. "missing" is "missing" of the result of # "findcommonoutgoing()"
--- a/mercurial/localrepo.py Wed Nov 02 18:56:07 2016 +0000 +++ b/mercurial/localrepo.py Wed Nov 02 18:45:53 2016 +0000 @@ -1633,13 +1633,7 @@ raise error.Abort(_("cannot commit merge with missing files")) ms = mergemod.mergestate.read(self) - - if list(ms.unresolved()): - raise error.Abort(_("unresolved merge conflicts " - "(see 'hg help resolve')")) - if ms.mdstate() != 's' or list(ms.driverresolved()): - raise error.Abort(_('driver-resolved merge conflicts'), - hint=_('run "hg resolve --all" to resolve')) + cmdutil.checkunresolved(ms) if editor: cctx._text = editor(self, cctx, subs)