Skip to content
Snippets Groups Projects
Commit eb9c55453249 authored by Augie Fackler's avatar Augie Fackler
Browse files

narrowspec: add timing block for validating narrowspec

This was showing up in an operation I was doing today, and I'd like to
be able to get trace spans for it instead of just profiler samples.

Differential Revision: https://phab.mercurial-scm.org/D12185
parent 6cfa30681a1d
No related branches found
No related tags found
No related merge requests found
......@@ -109,8 +109,9 @@
and patterns that are loaded from sources that use the internal,
prefixed pattern representation (but can't necessarily be fully trusted).
"""
if not isinstance(pats, set):
raise error.ProgrammingError(
b'narrow patterns should be a set; got %r' % pats
)
with util.timedcm('narrowspec.validatepatterns(pats size=%d)', len(pats)):
if not isinstance(pats, set):
raise error.ProgrammingError(
b'narrow patterns should be a set; got %r' % pats
)
......@@ -116,11 +117,13 @@
for pat in pats:
if not pat.startswith(VALID_PREFIXES):
# Use a Mercurial exception because this can happen due to user
# bugs (e.g. manually updating spec file).
raise error.Abort(
_(b'invalid prefix on narrow pattern: %s') % pat,
hint=_(
b'narrow patterns must begin with one of '
b'the following: %s'
for pat in pats:
if not pat.startswith(VALID_PREFIXES):
# Use a Mercurial exception because this can happen due to user
# bugs (e.g. manually updating spec file).
raise error.Abort(
_(b'invalid prefix on narrow pattern: %s') % pat,
hint=_(
b'narrow patterns must begin with one of '
b'the following: %s'
)
% b', '.join(VALID_PREFIXES),
)
......@@ -126,6 +129,4 @@
)
% b', '.join(VALID_PREFIXES),
)
def format(includes, excludes):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment