##// END OF EJS Templates
narrowspec: use sparse.parseconfig() to parse narrowspec file (BC)...
Pulkit Goyal -
r39112:f64ebe7d default
parent child Browse files
Show More
@@ -13,6 +13,7 b' from .i18n import _'
13 13 from . import (
14 14 error,
15 15 match as matchmod,
16 sparse,
16 17 util,
17 18 )
18 19
@@ -107,10 +108,10 b' def parsepatterns(pats):'
107 108 return set(normalizepattern(p) for p in pats)
108 109
109 110 def format(includes, excludes):
110 output = '[includes]\n'
111 output = '[include]\n'
111 112 for i in sorted(includes - excludes):
112 113 output += i + '\n'
113 output += '[excludes]\n'
114 output += '[exclude]\n'
114 115 for e in sorted(excludes):
115 116 output += e + '\n'
116 117 return output
@@ -139,7 +140,13 b' def load(repo):'
139 140 repo.invalidate(clearfilecache=True)
140 141 return set(), set()
141 142 raise
142 return _parsestoredpatterns(spec)
143 # maybe we should care about the profiles returned too
144 includepats, excludepats, profiles = sparse.parseconfig(repo.ui, spec,
145 'narrow')
146 if profiles:
147 raise error.Abort(_("including other spec files using '%include' is not"
148 " suported in narrowspec"))
149 return includepats, excludepats
143 150
144 151 def save(repo, includepats, excludepats):
145 152 spec = format(includepats, excludepats)
@@ -2,9 +2,9 b''
2 2 $ hg init repo
3 3 $ cd repo
4 4 $ cat << EOF > .hg/narrowspec
5 > [includes]
5 > [include]
6 6 > path:foo
7 > [excludes]
7 > [exclude]
8 8 > EOF
9 9 $ echo treemanifest >> .hg/requires
10 10 $ echo narrowhg-experimental >> .hg/requires
General Comments 0
You need to be logged in to leave comments. Login now