Mercurial > hg-stable
changeset 13928:155d2e17884e
path_auditor: eliminate local function 'check' in __call__
author | Adrian Buehlmann <adrian@cadifra.com> |
---|---|
date | Mon, 11 Apr 2011 10:06:57 +0200 |
parents | 518344d02761 |
children | cff56a0ed18e |
files | mercurial/util.py |
diffstat | 1 files changed, 10 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/util.py Mon Apr 11 07:34:40 2011 -0500 +++ b/mercurial/util.py Mon Apr 11 10:06:57 2011 +0200 @@ -555,6 +555,9 @@ self.callback = callback def __call__(self, path): + '''Check the relative path. + path may contain a pattern (e.g. foodir/**.txt)''' + if path in self.audited: return # AIX ignores "/" at end of path, others raise EISDIR. @@ -574,7 +577,13 @@ base = os.path.join(*parts[:pos]) raise Abort(_('path %r is inside nested repo %r') % (path, base)) - def check(prefix): + + parts.pop() + prefixes = [] + while parts: + prefix = os.sep.join(parts) + if prefix in self.auditeddir: + break curpath = os.path.join(self.root, prefix) try: st = os.lstat(curpath) @@ -592,13 +601,6 @@ if not self.callback or not self.callback(curpath): raise Abort(_('path %r is inside nested repo %r') % (path, prefix)) - parts.pop() - prefixes = [] - while parts: - prefix = os.sep.join(parts) - if prefix in self.auditeddir: - break - check(prefix) prefixes.append(prefix) parts.pop()