mercurial/mergeutil.py
author Pulkit Goyal <7895pulkit@gmail.com>
Sat, 25 Jul 2020 01:17:35 +0530
changeset 45296 cb0cd87e16b4
parent 43117 8ff1ecfadcd1
child 45518 32ce4cbaec4b
permissions -rw-r--r--
merge: unify logic of couple of if-else's in manifestmerge() Right now manifestmerge() contains very nested if-else conditions and it's not easy to understand what is happening. I was looking for easy unifications and found these two. Differential Revision: https://phab.mercurial-scm.org/D8834

# mergeutil.py - help for merge processing in mercurial
#
# Copyright 2005-2007 Matt Mackall <mpm@selenic.com>
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.

from __future__ import absolute_import

from .i18n import _

from . import error


def checkunresolved(ms):
    if list(ms.unresolved()):
        raise error.Abort(
            _(b"unresolved merge conflicts (see 'hg help resolve')")
        )
    if ms.mdstate() != b's' or list(ms.driverresolved()):
        raise error.Abort(
            _(b'driver-resolved merge conflicts'),
            hint=_(b'run "hg resolve --all" to resolve'),
        )