##// END OF EJS Templates
path_auditor: eliminate local function 'check' in __call__
Adrian Buehlmann -
r13928:155d2e17 default
parent child Browse files
Show More
@@ -555,6 +555,9 b' class path_auditor(object):'
555 self.callback = callback
555 self.callback = callback
556
556
557 def __call__(self, path):
557 def __call__(self, path):
558 '''Check the relative path.
559 path may contain a pattern (e.g. foodir/**.txt)'''
560
558 if path in self.audited:
561 if path in self.audited:
559 return
562 return
560 # AIX ignores "/" at end of path, others raise EISDIR.
563 # AIX ignores "/" at end of path, others raise EISDIR.
@@ -574,7 +577,13 b' class path_auditor(object):'
574 base = os.path.join(*parts[:pos])
577 base = os.path.join(*parts[:pos])
575 raise Abort(_('path %r is inside nested repo %r')
578 raise Abort(_('path %r is inside nested repo %r')
576 % (path, base))
579 % (path, base))
577 def check(prefix):
580
581 parts.pop()
582 prefixes = []
583 while parts:
584 prefix = os.sep.join(parts)
585 if prefix in self.auditeddir:
586 break
578 curpath = os.path.join(self.root, prefix)
587 curpath = os.path.join(self.root, prefix)
579 try:
588 try:
580 st = os.lstat(curpath)
589 st = os.lstat(curpath)
@@ -592,13 +601,6 b' class path_auditor(object):'
592 if not self.callback or not self.callback(curpath):
601 if not self.callback or not self.callback(curpath):
593 raise Abort(_('path %r is inside nested repo %r') %
602 raise Abort(_('path %r is inside nested repo %r') %
594 (path, prefix))
603 (path, prefix))
595 parts.pop()
596 prefixes = []
597 while parts:
598 prefix = os.sep.join(parts)
599 if prefix in self.auditeddir:
600 break
601 check(prefix)
602 prefixes.append(prefix)
604 prefixes.append(prefix)
603 parts.pop()
605 parts.pop()
604
606
General Comments 0
You need to be logged in to leave comments. Login now