Mercurial > hg
comparison mercurial/match.py @ 32324:77dac8fd30ee
match: avoid accessing match._pathrestricted from subdirmatcher
Accessing only the public API wherever possible helps us refactor
matchers later.
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Fri, 12 May 2017 16:31:21 -0700 |
parents | 0aa4032a97e1 |
children | 763d72925691 |
comparison
equal
deleted
inserted
replaced
32323:0aa4032a97e1 | 32324:77dac8fd30ee |
---|---|
379 self._root = matcher._root | 379 self._root = matcher._root |
380 self._cwd = matcher._cwd | 380 self._cwd = matcher._cwd |
381 self._path = path | 381 self._path = path |
382 self._matcher = matcher | 382 self._matcher = matcher |
383 self._always = matcher._always | 383 self._always = matcher._always |
384 self._pathrestricted = matcher._pathrestricted | |
385 | 384 |
386 self._files = [f[len(path) + 1:] for f in matcher._files | 385 self._files = [f[len(path) + 1:] for f in matcher._files |
387 if f.startswith(path + "/")] | 386 if f.startswith(path + "/")] |
388 | 387 |
389 # If the parent repo had a path to this subrepo and no patterns are | 388 # If the parent repo had a path to this subrepo and no patterns are |
396 # can not accurately create the matching function for the subdirectory | 395 # can not accurately create the matching function for the subdirectory |
397 # from the inputs. Instead, we override matchfn() and visitdir() to | 396 # from the inputs. Instead, we override matchfn() and visitdir() to |
398 # call the original matcher with the subdirectory path prepended. | 397 # call the original matcher with the subdirectory path prepended. |
399 self.matchfn = lambda fn: matcher.matchfn(self._path + "/" + fn) | 398 self.matchfn = lambda fn: matcher.matchfn(self._path + "/" + fn) |
400 | 399 |
400 def bad(self, f, msg): | |
401 self._matcher.bad(self._path + "/" + f, msg) | |
402 | |
401 def abs(self, f): | 403 def abs(self, f): |
402 return self._matcher.abs(self._path + "/" + f) | 404 return self._matcher.abs(self._path + "/" + f) |
403 | 405 |
404 def bad(self, f, msg): | |
405 self._matcher.bad(self._path + "/" + f, msg) | |
406 | |
407 def rel(self, f): | 406 def rel(self, f): |
408 return self._matcher.rel(self._path + "/" + f) | 407 return self._matcher.rel(self._path + "/" + f) |
408 | |
409 def uipath(self, f): | |
410 return self._matcher.uipath(self._path + "/" + f) | |
409 | 411 |
410 def visitdir(self, dir): | 412 def visitdir(self, dir): |
411 if dir == '.': | 413 if dir == '.': |
412 dir = self._path | 414 dir = self._path |
413 else: | 415 else: |