I'm not sure why this is available on the public API. AFAICT it isn't
used outside of the class.
.. api::
localrepo.localrepository.filterpats was renamed to localrepo.localrepository._filterpats.
( )
pulkit |
hg-reviewers |
I'm not sure why this is available on the public API. AFAICT it isn't
used outside of the class.
.. api::
localrepo.localrepository.filterpats was renamed to localrepo.localrepository._filterpats.
Automatic diff as part of commit; lint not applicable. |
Automatic diff as part of commit; unit tests not applicable. |
self._applyopenerreqs() | self._applyopenerreqs() | ||||
if create: | if create: | ||||
self._writerequirements() | self._writerequirements() | ||||
self._dirstatevalidatewarned = False | self._dirstatevalidatewarned = False | ||||
self._branchcaches = {} | self._branchcaches = {} | ||||
self._revbranchcache = None | self._revbranchcache = None | ||||
self.filterpats = {} | self._filterpats = {} | ||||
self._datafilters = {} | self._datafilters = {} | ||||
self._transref = self._lockref = self._wlockref = None | self._transref = self._lockref = self._wlockref = None | ||||
# A cache for various files under .hg/ that tracks file changes, | # A cache for various files under .hg/ that tracks file changes, | ||||
# (used by the filecache decorator) | # (used by the filecache decorator) | ||||
# | # | ||||
# Maps a property name to its util.filecacheentry | # Maps a property name to its util.filecacheentry | ||||
self._filecache = {} | self._filecache = {} | ||||
def getcwd(self): | def getcwd(self): | ||||
return self.dirstate.getcwd() | return self.dirstate.getcwd() | ||||
def pathto(self, f, cwd=None): | def pathto(self, f, cwd=None): | ||||
return self.dirstate.pathto(f, cwd) | return self.dirstate.pathto(f, cwd) | ||||
def _loadfilter(self, filter): | def _loadfilter(self, filter): | ||||
if filter not in self.filterpats: | if filter not in self._filterpats: | ||||
l = [] | l = [] | ||||
for pat, cmd in self.ui.configitems(filter): | for pat, cmd in self.ui.configitems(filter): | ||||
if cmd == '!': | if cmd == '!': | ||||
continue | continue | ||||
mf = matchmod.match(self.root, '', [pat]) | mf = matchmod.match(self.root, '', [pat]) | ||||
fn = None | fn = None | ||||
params = cmd | params = cmd | ||||
for name, filterfn in self._datafilters.iteritems(): | for name, filterfn in self._datafilters.iteritems(): | ||||
if cmd.startswith(name): | if cmd.startswith(name): | ||||
fn = filterfn | fn = filterfn | ||||
params = cmd[len(name):].lstrip() | params = cmd[len(name):].lstrip() | ||||
break | break | ||||
if not fn: | if not fn: | ||||
fn = lambda s, c, **kwargs: procutil.filter(s, c) | fn = lambda s, c, **kwargs: procutil.filter(s, c) | ||||
# Wrap old filters not supporting keyword arguments | # Wrap old filters not supporting keyword arguments | ||||
if not pycompat.getargspec(fn)[2]: | if not pycompat.getargspec(fn)[2]: | ||||
oldfn = fn | oldfn = fn | ||||
fn = lambda s, c, **kwargs: oldfn(s, c) | fn = lambda s, c, **kwargs: oldfn(s, c) | ||||
l.append((mf, fn, params)) | l.append((mf, fn, params)) | ||||
self.filterpats[filter] = l | self._filterpats[filter] = l | ||||
return self.filterpats[filter] | return self._filterpats[filter] | ||||
def _filter(self, filterpats, filename, data): | def _filter(self, filterpats, filename, data): | ||||
for mf, fn, cmd in filterpats: | for mf, fn, cmd in filterpats: | ||||
if mf(filename): | if mf(filename): | ||||
self.ui.debug("filtering %s through %s\n" % (filename, cmd)) | self.ui.debug("filtering %s through %s\n" % (filename, cmd)) | ||||
data = fn(data, cmd, ui=self.ui, repo=self, filename=filename) | data = fn(data, cmd, ui=self.ui, repo=self, filename=filename) | ||||
break | break | ||||