comparison mercurial/subrepo.py @ 34964:828cf35f1de6 stable

subrepo: extend config option to disable subrepos by type (SEC) This allows us to minimize the behavior change introduced by the next patch. I have no idea which config style is preferred in UX POV, but I decided to get things done. a) list: 'allowed = hg, git, svn' b) sub option: 'allowed.hg = True' or 'allowed:hg = True' c) per-type action: 'hg = allow', 'git = abort'
author Yuya Nishihara <yuya@tcha.org>
date Sun, 05 Nov 2017 21:48:58 +0900
parents 5e27afeddaee
children 846942fd6d15
comparison
equal deleted inserted replaced
34963:5e27afeddaee 34964:828cf35f1de6
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 def _checktype(ui, kind): 368 def _checktype(ui, kind):
369 if not ui.configbool('subrepos', 'allowed', True): 369 if kind not in ui.configlist('subrepos', 'allowed', ['hg', 'git', 'svn']):
370 raise error.Abort(_("subrepo not allowed"), 370 raise error.Abort(_("subrepo type %s not allowed") % kind,
371 hint=_("see 'hg help config.subrepos' for details")) 371 hint=_("see 'hg help config.subrepos' for details"))
372 if kind not in types: 372 if kind not in types:
373 raise error.Abort(_('unknown subrepo type %s') % kind) 373 raise error.Abort(_('unknown subrepo type %s') % kind)
374 374
375 def subrepo(ctx, path, allowwdir=False, allowcreate=True): 375 def subrepo(ctx, path, allowwdir=False, allowcreate=True):