##// END OF EJS Templates
path_auditor: delegate checking of nested repos to a callback
Martin Geisler -
r12079:41e56e07 default
parent child Browse files
Show More
@@ -492,12 +492,15 b' class path_auditor(object):'
492 - starts at the root of a windows drive
492 - starts at the root of a windows drive
493 - contains ".."
493 - contains ".."
494 - traverses a symlink (e.g. a/symlink_here/b)
494 - traverses a symlink (e.g. a/symlink_here/b)
495 - inside a nested repository'''
495 - inside a nested repository (a callback can be used to approve
496 some nested repositories, e.g., subrepositories)
497 '''
496
498
497 def __init__(self, root):
499 def __init__(self, root, callback=None):
498 self.audited = set()
500 self.audited = set()
499 self.auditeddir = set()
501 self.auditeddir = set()
500 self.root = root
502 self.root = root
503 self.callback = callback
501
504
502 def __call__(self, path):
505 def __call__(self, path):
503 if path in self.audited:
506 if path in self.audited:
@@ -530,8 +533,9 b' class path_auditor(object):'
530 (path, prefix))
533 (path, prefix))
531 elif (stat.S_ISDIR(st.st_mode) and
534 elif (stat.S_ISDIR(st.st_mode) and
532 os.path.isdir(os.path.join(curpath, '.hg'))):
535 os.path.isdir(os.path.join(curpath, '.hg'))):
533 raise Abort(_('path %r is inside repo %r') %
536 if not self.callback or not self.callback(curpath):
534 (path, prefix))
537 raise Abort(_('path %r is inside repo %r') %
538 (path, prefix))
535 parts.pop()
539 parts.pop()
536 prefixes = []
540 prefixes = []
537 while parts:
541 while parts:
General Comments 0
You need to be logged in to leave comments. Login now