mercurial/narrowspec.py
changeset 38839 f64ebe7d2259
parent 38836 fed6fe856333
child 38840 794afa91f0a5
--- a/mercurial/narrowspec.py	Fri Aug 03 22:24:58 2018 +0530
+++ b/mercurial/narrowspec.py	Fri Aug 03 22:29:04 2018 +0530
@@ -13,6 +13,7 @@
 from . import (
     error,
     match as matchmod,
+    sparse,
     util,
 )
 
@@ -107,10 +108,10 @@
     return set(normalizepattern(p) for p in pats)
 
 def format(includes, excludes):
-    output = '[includes]\n'
+    output = '[include]\n'
     for i in sorted(includes - excludes):
         output += i + '\n'
-    output += '[excludes]\n'
+    output += '[exclude]\n'
     for e in sorted(excludes):
         output += e + '\n'
     return output
@@ -139,7 +140,13 @@
             repo.invalidate(clearfilecache=True)
             return set(), set()
         raise
-    return _parsestoredpatterns(spec)
+    # 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"
+                            " suported in narrowspec"))
+    return includepats, excludepats
 
 def save(repo, includepats, excludepats):
     spec = format(includepats, excludepats)