##// END OF EJS Templates
narrow: remove dependency from narrowspec module to hg module...
Martin von Zweigbergk -
r36488:d851951b default
parent child Browse files
Show More
@@ -73,7 +73,10 b' def wraprepo(repo):'
73
73
74 A tuple of (includes, excludes).
74 A tuple of (includes, excludes).
75 """
75 """
76 return narrowspec.load(self)
76 source = self
77 if self.shared():
78 source = hg.sharedreposource(self)
79 return narrowspec.load(source)
77
80
78 @localrepo.repofilecache(narrowspec.FILENAME)
81 @localrepo.repofilecache(narrowspec.FILENAME)
79 def _narrowmatch(self):
82 def _narrowmatch(self):
@@ -87,7 +90,10 b' def wraprepo(repo):'
87 return self._narrowmatch
90 return self._narrowmatch
88
91
89 def setnarrowpats(self, newincludes, newexcludes):
92 def setnarrowpats(self, newincludes, newexcludes):
90 narrowspec.save(self, newincludes, newexcludes)
93 target = self
94 if self.shared():
95 target = hg.sharedreposource(self)
96 narrowspec.save(target, newincludes, newexcludes)
91 self.invalidate(clearfilecache=True)
97 self.invalidate(clearfilecache=True)
92
98
93 # I'm not sure this is the right place to do this filter.
99 # I'm not sure this is the right place to do this filter.
@@ -12,7 +12,6 b' import errno'
12 from .i18n import _
12 from .i18n import _
13 from . import (
13 from . import (
14 error,
14 error,
15 hg,
16 match as matchmod,
15 match as matchmod,
17 util,
16 util,
18 )
17 )
@@ -129,8 +128,6 b' def needsexpansion(includes):'
129 return [i for i in includes if i.startswith('include:')]
128 return [i for i in includes if i.startswith('include:')]
130
129
131 def load(repo):
130 def load(repo):
132 if repo.shared():
133 repo = hg.sharedreposource(repo)
134 try:
131 try:
135 spec = repo.vfs.read(FILENAME)
132 spec = repo.vfs.read(FILENAME)
136 except IOError as e:
133 except IOError as e:
@@ -146,8 +143,6 b' def load(repo):'
146
143
147 def save(repo, includepats, excludepats):
144 def save(repo, includepats, excludepats):
148 spec = format(includepats, excludepats)
145 spec = format(includepats, excludepats)
149 if repo.shared():
150 repo = hg.sharedreposource(repo)
151 repo.vfs.write(FILENAME, spec)
146 repo.vfs.write(FILENAME, spec)
152
147
153 def restrictpatterns(req_includes, req_excludes, repo_includes, repo_excludes):
148 def restrictpatterns(req_includes, req_excludes, repo_includes, repo_excludes):
General Comments 0
You need to be logged in to leave comments. Login now