Mercurial > hg-stable
changeset 32842:cb48dfd9672d
bisect: simpler approach for option validation message
Yuya Nishihara gave this suggestion on the mailing list after the
previous patch was queued, and honestly this seems much simpler and
looks more efficient.
author | Brandon McCaig <bamccaig@gmail.com> |
---|---|
date | Wed, 14 Jun 2017 01:43:47 -0400 |
parents | e65ff29dbeb0 |
children | d3b2d4587e73 |
files | mercurial/commands.py |
diffstat | 1 files changed, 5 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/commands.py Mon Jun 12 16:35:57 2017 -0700 +++ b/mercurial/commands.py Wed Jun 14 01:43:47 2017 -0400 @@ -9,7 +9,6 @@ import difflib import errno -import itertools import os import re import sys @@ -781,9 +780,11 @@ '--skip': skip, } - for left, right in itertools.combinations(sorted(incompatibles), 2): - if incompatibles[left] and incompatibles[right]: - raise error.Abort(_('%s and %s are incompatible') % (left, right)) + enabled = [x for x in incompatibles if incompatibles[x]] + + if len(enabled) > 1: + raise error.Abort(_('%s and %s are incompatible') % + tuple(sorted(enabled)[0:2])) if reset: hbisect.resetstate(repo)