comparison tests/test-subrepo-git.t @ 34989:1a314176da9c stable

subrepo: use per-type config options to enable subrepos We change subrepos.allowed from a list of allowed subrepo types to a combination of a master switch and per-type boolean flag. If the master switch is set, subrepos can be disabled wholesale. If subrepos are globally enabled, then per-type options are consulted. Mercurial repos are enabled by default. Everything else is disabled by default.
author Gregory Szorc <gregory.szorc@gmail.com>
date Mon, 06 Nov 2017 22:32:41 -0800
parents 846942fd6d15
children 4c04fd032af6
comparison
equal deleted inserted replaced
34988:bd725a71f274 34989:1a314176da9c
43 $ hg add .hgsub 43 $ hg add .hgsub
44 44
45 git subrepo is disabled by default 45 git subrepo is disabled by default
46 46
47 $ hg commit -m 'new git subrepo' 47 $ hg commit -m 'new git subrepo'
48 abort: subrepo type git not allowed 48 abort: git subrepos not allowed
49 (see 'hg help config.subrepos' for details) 49 (see 'hg help config.subrepos' for details)
50 [255] 50 [255]
51 51
52 so enable it 52 so enable it
53 53
54 $ cat >> $HGRCPATH <<EOF 54 $ cat >> $HGRCPATH <<EOF
55 > [subrepos] 55 > [subrepos]
56 > allowed = hg, git 56 > git:allowed = true
57 > EOF 57 > EOF
58 58
59 $ hg commit -m 'new git subrepo' 59 $ hg commit -m 'new git subrepo'
60 60
61 $ hg debugsub 61 $ hg debugsub
104 revision 126f2a14290cd5ce061fdedc430170e8d39e1c5a 104 revision 126f2a14290cd5ce061fdedc430170e8d39e1c5a
105 $ cd .. 105 $ cd ..
106 106
107 clone with subrepo disabled (update should fail) 107 clone with subrepo disabled (update should fail)
108 108
109 $ hg clone t -U tc2 --config subrepos.allowed= 109 $ hg clone t -U tc2 --config subrepos.allowed=false
110 $ hg update -R tc2 --config subrepos.allowed= 110 $ hg update -R tc2 --config subrepos.allowed=false
111 abort: subrepo type git not allowed 111 abort: subrepos not enabled
112 (see 'hg help config.subrepos' for details) 112 (see 'hg help config.subrepos' for details)
113 [255] 113 [255]
114 $ ls tc2 114 $ ls tc2
115 a 115 a
116 116
117 $ hg clone t tc3 --config subrepos.allowed= 117 $ hg clone t tc3 --config subrepos.allowed=false
118 updating to branch default 118 updating to branch default
119 abort: subrepo type git not allowed 119 abort: subrepos not enabled
120 (see 'hg help config.subrepos' for details) 120 (see 'hg help config.subrepos' for details)
121 [255] 121 [255]
122 $ ls tc3 122 $ ls tc3
123 a
124
125 $ hg clone t tc4 --config subrepos.allowed=hg
126 updating to branch default
127 abort: subrepo type git not allowed
128 (see 'hg help config.subrepos' for details)
129 [255]
130 $ ls tc4
131 a 123 a
132 124
133 update to previous substate 125 update to previous substate
134 126
135 $ cd tc 127 $ cd tc