Patchwork D5277: narrow: extract helper for parsing narrowspec file

login
register
mail settings
Submitter phabricator
Date Nov. 22, 2018, 2:26 p.m.
Message ID <444f99e47bbdf7c47aff778dfd5da60a@localhost.localdomain>
Download mbox | patch
Permalink /patch/36713/
State Not Applicable
Headers show

Comments

phabricator - Nov. 22, 2018, 2:26 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGefd0f79246e3: narrow: extract helper for parsing narrowspec file (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5277?vs=12546&id=12587

REVISION DETAIL
  https://phab.mercurial-scm.org/D5277

AFFECTED FILES
  mercurial/narrowspec.py

CHANGE DETAILS




To: martinvonz, #hg-reviewers, pulkit
Cc: mercurial-devel

Patch

diff --git a/mercurial/narrowspec.py b/mercurial/narrowspec.py
--- a/mercurial/narrowspec.py
+++ b/mercurial/narrowspec.py
@@ -127,6 +127,18 @@ 
     return matchmod.match(root, '', [], include=include or [],
                           exclude=exclude or [])
 
+def parseconfig(ui, spec):
+    # maybe we should care about the profiles returned too
+    includepats, excludepats, profiles = sparse.parseconfig(ui, spec, 'narrow')
+    if profiles:
+        raise error.Abort(_("including other spec files using '%include' is not"
+                            " supported in narrowspec"))
+
+    validatepatterns(includepats)
+    validatepatterns(excludepats)
+
+    return includepats, excludepats
+
 def load(repo):
     try:
         spec = repo.svfs.read(FILENAME)
@@ -136,17 +148,8 @@ 
         if e.errno == errno.ENOENT:
             return set(), set()
         raise
-    # maybe we should care about the profiles returned too
-    includepats, excludepats, profiles = sparse.parseconfig(repo.ui, spec,
-                                                            'narrow')
-    if profiles:
-        raise error.Abort(_("including other spec files using '%include' is not"
-                            " supported in narrowspec"))
 
-    validatepatterns(includepats)
-    validatepatterns(excludepats)
-
-    return includepats, excludepats
+    return parseconfig(repo.ui, spec)
 
 def save(repo, includepats, excludepats):
     validatepatterns(includepats)