##// END OF EJS Templates
subrepo: extend config option to disable subrepos by type (SEC)...
Yuya Nishihara -
r34987:828cf35f stable
parent child Browse files
Show More
@@ -1900,11 +1900,12 b' This section contains options that contr'
1900 subrepositories feature. See also :hg:`help subrepos`.
1900 subrepositories feature. See also :hg:`help subrepos`.
1901
1901
1902 ``allowed``
1902 ``allowed``
1903 Whether subrepository operation in the working directory is allowed.
1903 List of subrepository types (hg, git, svn) allowed in the working
1904
1904 directory.
1905 When disabled, any commands including :hg:`update` will fail if
1905
1906 When disallowed, any commands including :hg:`update` will fail if
1906 subrepositories are involved.
1907 subrepositories are involved.
1907 (default: True)
1908 (default: `hg, git, svn`)
1908
1909
1909 ``templatealias``
1910 ``templatealias``
1910 -----------------
1911 -----------------
@@ -366,8 +366,8 b' def _auditsubrepopath(repo, 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)
@@ -90,22 +90,30 b' clone root'
90
90
91 clone with subrepo disabled (update should fail)
91 clone with subrepo disabled (update should fail)
92
92
93 $ hg clone t -U tc2 --config subrepos.allowed=false
93 $ hg clone t -U tc2 --config subrepos.allowed=
94 $ hg update -R tc2 --config subrepos.allowed=false
94 $ hg update -R tc2 --config subrepos.allowed=
95 abort: subrepo not allowed
95 abort: subrepo type git not allowed
96 (see 'hg help config.subrepos' for details)
96 (see 'hg help config.subrepos' for details)
97 [255]
97 [255]
98 $ ls tc2
98 $ ls tc2
99 a
99 a
100
100
101 $ hg clone t tc3 --config subrepos.allowed=false
101 $ hg clone t tc3 --config subrepos.allowed=
102 updating to branch default
102 updating to branch default
103 abort: subrepo not allowed
103 abort: subrepo type git not allowed
104 (see 'hg help config.subrepos' for details)
104 (see 'hg help config.subrepos' for details)
105 [255]
105 [255]
106 $ ls tc3
106 $ ls tc3
107 a
107 a
108
108
109 $ hg clone t tc4 --config subrepos.allowed=hg
110 updating to branch default
111 abort: subrepo type git not allowed
112 (see 'hg help config.subrepos' for details)
113 [255]
114 $ ls tc4
115 a
116
109 update to previous substate
117 update to previous substate
110
118
111 $ cd tc
119 $ cd tc
@@ -488,22 +488,30 b' clone'
488
488
489 clone with subrepo disabled (update should fail)
489 clone with subrepo disabled (update should fail)
490
490
491 $ hg clone t -U tc2 --config subrepos.allowed=false
491 $ hg clone t -U tc2 --config subrepos.allowed=
492 $ hg update -R tc2 --config subrepos.allowed=false
492 $ hg update -R tc2 --config subrepos.allowed=
493 abort: subrepo not allowed
493 abort: subrepo type hg not allowed
494 (see 'hg help config.subrepos' for details)
494 (see 'hg help config.subrepos' for details)
495 [255]
495 [255]
496 $ ls tc2
496 $ ls tc2
497 a
497 a
498
498
499 $ hg clone t tc3 --config subrepos.allowed=false
499 $ hg clone t tc3 --config subrepos.allowed=
500 updating to branch default
500 updating to branch default
501 abort: subrepo not allowed
501 abort: subrepo type hg not allowed
502 (see 'hg help config.subrepos' for details)
502 (see 'hg help config.subrepos' for details)
503 [255]
503 [255]
504 $ ls tc3
504 $ ls tc3
505 a
505 a
506
506
507 $ hg clone t tc4 --config subrepos.allowed=git
508 updating to branch default
509 abort: subrepo type hg not allowed
510 (see 'hg help config.subrepos' for details)
511 [255]
512 $ ls tc4
513 a
514
507 push
515 push
508
516
509 $ cd tc
517 $ cd tc
General Comments 0
You need to be logged in to leave comments. Login now