Skip to content
Snippets Groups Projects
Commit 41e56e07 authored by Martin Geisler's avatar Martin Geisler
Browse files

path_auditor: delegate checking of nested repos to a callback

parent e03ca36b
No related branches found
No related tags found
No related merge requests found
......@@ -492,5 +492,7 @@
- starts at the root of a windows drive
- contains ".."
- traverses a symlink (e.g. a/symlink_here/b)
- inside a nested repository'''
- inside a nested repository (a callback can be used to approve
some nested repositories, e.g., subrepositories)
'''
......@@ -496,5 +498,5 @@
def __init__(self, root):
def __init__(self, root, callback=None):
self.audited = set()
self.auditeddir = set()
self.root = root
......@@ -498,6 +500,7 @@
self.audited = set()
self.auditeddir = set()
self.root = root
self.callback = callback
def __call__(self, path):
if path in self.audited:
......@@ -530,8 +533,9 @@
(path, prefix))
elif (stat.S_ISDIR(st.st_mode) and
os.path.isdir(os.path.join(curpath, '.hg'))):
raise Abort(_('path %r is inside repo %r') %
(path, prefix))
if not self.callback or not self.callback(curpath):
raise Abort(_('path %r is inside repo %r') %
(path, prefix))
parts.pop()
prefixes = []
while parts:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment