Mercurial > hg
view mercurial/mergeutil.py @ 43892:d587937600be
clone: extract helper for checking mutually exclusive args
We have some duplicated code for aborting if the user provided
mutually exclusive arguments. Extensions surely have more such
code. We also have duplicated translations and inconsistent output in
this area.
This patch introduces a simpler helper for checking if more than one
option among a given set was given on the command line. I've made the
clone code call the function to show that it works.
The function has no good way of checking arguments with hyphens in
them. I'll add that later if necessary. The function still won't be
applicable in all cases, but I think it's still better than nothing.
Differential Revision: https://phab.mercurial-scm.org/D7633
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Thu, 12 Dec 2019 15:16:13 -0800 |
parents | 8ff1ecfadcd1 |
children | 32ce4cbaec4b |
line wrap: on
line source
# 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'), )