[Updated] D12185: narrowspec: add timing block for validating narrowspec

durin42 (Augie Fackler) phabricator at mercurial-scm.org
Wed Feb 16 09:59:22 UTC 2022


Closed by commit rHGeb9c55453249: narrowspec: add timing block for validating narrowspec (authored by durin42).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D12185?vs=32220&id=32239

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D12185/new/

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, Alphare
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20220216/0464f465/attachment-0002.html>


More information about the Mercurial-patches mailing list