##// 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 from . import (
13 from . import (
14 error,
14 error,
15 match as matchmod,
15 match as matchmod,
16 sparse,
16 util,
17 util,
17 )
18 )
18
19
@@ -107,10 +108,10 b' def parsepatterns(pats):'
107 return set(normalizepattern(p) for p in pats)
108 return set(normalizepattern(p) for p in pats)
108
109
109 def format(includes, excludes):
110 def format(includes, excludes):
110 output = '[includes]\n'
111 output = '[include]\n'
111 for i in sorted(includes - excludes):
112 for i in sorted(includes - excludes):
112 output += i + '\n'
113 output += i + '\n'
113 output += '[excludes]\n'
114 output += '[exclude]\n'
114 for e in sorted(excludes):
115 for e in sorted(excludes):
115 output += e + '\n'
116 output += e + '\n'
116 return output
117 return output
@@ -139,7 +140,13 b' def load(repo):'
139 repo.invalidate(clearfilecache=True)
140 repo.invalidate(clearfilecache=True)
140 return set(), set()
141 return set(), set()
141 raise
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 def save(repo, includepats, excludepats):
151 def save(repo, includepats, excludepats):
145 spec = format(includepats, excludepats)
152 spec = format(includepats, excludepats)
@@ -2,9 +2,9 b''
2 $ hg init repo
2 $ hg init repo
3 $ cd repo
3 $ cd repo
4 $ cat << EOF > .hg/narrowspec
4 $ cat << EOF > .hg/narrowspec
5 > [includes]
5 > [include]
6 > path:foo
6 > path:foo
7 > [excludes]
7 > [exclude]
8 > EOF
8 > EOF
9 $ echo treemanifest >> .hg/requires
9 $ echo treemanifest >> .hg/requires
10 $ echo narrowhg-experimental >> .hg/requires
10 $ echo narrowhg-experimental >> .hg/requires
General Comments 0
You need to be logged in to leave comments. Login now