363 # auditor doesn't check if the path itself is a symlink |
363 # auditor doesn't check if the path itself is a symlink |
364 pathutil.pathauditor(repo.root)(path) |
364 pathutil.pathauditor(repo.root)(path) |
365 if repo.wvfs.islink(path): |
365 if repo.wvfs.islink(path): |
366 raise error.Abort(_("subrepo '%s' traverses symbolic link") % path) |
366 raise error.Abort(_("subrepo '%s' traverses symbolic link") % path) |
367 |
367 |
|
368 SUBREPO_ALLOWED_DEFAULTS = { |
|
369 'hg': True, |
|
370 'git': False, |
|
371 'svn': False, |
|
372 } |
|
373 |
368 def _checktype(ui, kind): |
374 def _checktype(ui, kind): |
369 if kind not in ui.configlist('subrepos', 'allowed', ['hg']): |
375 # subrepos.allowed is a master kill switch. If disabled, subrepos are |
370 raise error.Abort(_("subrepo type %s not allowed") % kind, |
376 # disabled period. |
|
377 if not ui.configbool('subrepos', 'allowed', True): |
|
378 raise error.Abort(_('subrepos not enabled'), |
371 hint=_("see 'hg help config.subrepos' for details")) |
379 hint=_("see 'hg help config.subrepos' for details")) |
|
380 |
|
381 default = SUBREPO_ALLOWED_DEFAULTS.get(kind, False) |
|
382 if not ui.configbool('subrepos', '%s:allowed' % kind, default): |
|
383 raise error.Abort(_('%s subrepos not allowed') % kind, |
|
384 hint=_("see 'hg help config.subrepos' for details")) |
|
385 |
372 if kind not in types: |
386 if kind not in types: |
373 raise error.Abort(_('unknown subrepo type %s') % kind) |
387 raise error.Abort(_('unknown subrepo type %s') % kind) |
374 |
388 |
375 def subrepo(ctx, path, allowwdir=False, allowcreate=True): |
389 def subrepo(ctx, path, allowwdir=False, allowcreate=True): |
376 """return instance of the right subrepo class for subrepo in path""" |
390 """return instance of the right subrepo class for subrepo in path""" |