# HG changeset patch # User timeless # Date 2016-11-02 18:45:53 # Node ID 3d38a0bc774fd28ffb0a22465d9a1ed005cc2db0 # Parent 0fa1a41d04e4d566161a6028bea103fd0f26dbfe 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(). diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -3403,6 +3403,14 @@ def command(table): 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()" diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -1633,13 +1633,7 @@ class localrepository(object): 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)