diff --git a/mercurial/util.py b/mercurial/util.py index e03ca36ba9f3f030358cff682d28a153ee3d6797_bWVyY3VyaWFsL3V0aWwucHk=..41e56e07eef541e455c9786cb38aff1fd6290d58_bWVyY3VyaWFsL3V0aWwucHk= 100644 --- a/mercurial/util.py +++ b/mercurial/util.py @@ -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: