comparison mercurial/revset.py @ 46115:be3d8178251e

errors: raise InputError if an ambiguous revision id prefix is used It's long bothered me that we include the "00changelog.i" part in a message to the user. This fixes that along with the exit code. Differential Revision: https://phab.mercurial-scm.org/D9600
author Martin von Zweigbergk <martinvonz@google.com>
date Wed, 09 Dec 2020 20:22:25 -0800
parents 59fa3890d40a
children a4c19a162615
comparison
equal deleted inserted replaced
46114:c6ae1982b2a1 46115:be3d8178251e
2689 b"generations": generationssubrel, 2689 b"generations": generationssubrel,
2690 } 2690 }
2691 2691
2692 2692
2693 def lookupfn(repo): 2693 def lookupfn(repo):
2694 return lambda symbol: scmutil.isrevsymbol(repo, symbol) 2694 def fn(symbol):
2695 try:
2696 return scmutil.isrevsymbol(repo, symbol)
2697 except error.AmbiguousPrefixLookupError:
2698 raise error.InputError(
2699 b'ambiguous revision identifier: %s' % symbol
2700 )
2701
2702 return fn
2695 2703
2696 2704
2697 def match(ui, spec, lookup=None): 2705 def match(ui, spec, lookup=None):
2698 """Create a matcher for a single revision spec""" 2706 """Create a matcher for a single revision spec"""
2699 return matchany(ui, [spec], lookup=lookup) 2707 return matchany(ui, [spec], lookup=lookup)