[Request] [+- ] D12185: narrowspec: add timing block for validating narrowspec
durin42 (Augie Fackler)
phabricator at mercurial-scm.org
Tue Feb 15 19:02:46 UTC 2022
durin42 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.
REVISION SUMMARY
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.
REPOSITORY
rHG Mercurial
BRANCH
default
REVISION DETAIL
https://phab.mercurial-scm.org/D12185
AFFECTED FILES
mercurial/narrowspec.py
CHANGE DETAILS
diff --git a/mercurial/narrowspec.py b/mercurial/narrowspec.py
--- a/mercurial/narrowspec.py
+++ b/mercurial/narrowspec.py
@@ -109,23 +109,24 @@
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
+ )
- 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),
)
- % b', '.join(VALID_PREFIXES),
- )
def format(includes, excludes):
To: durin42, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mercurial-scm.org/pipermail/mercurial-patches/attachments/20220215/95229458/attachment-0001.html>
More information about the Mercurial-patches
mailing list