comparison tests/test-subrepo.t @ 20176:4c96c50ef937

subrepo: check phase of state in each subrepositories before committing Before this patch, phase of newly created commit is determined by "phases.new-commit" configuration regardless of phase of state in each subrepositories. For example, this may cause the "public" revision in the parent repository referring the "secret" one in subrepository. This patch checks phase of state in each subrepositories before committing in the parent, and aborts or changes phase of newly created commit if subrepositories have more restricted phase than the parent. This patch uses "follow" as default value of "phases.checksubrepos" configuration, because it can keep consistency between phases of the parent and subrepositories without breaking existing tool chains.
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Wed, 13 Nov 2013 15:55:30 +0900
parents bfc6ed892349
children 2123d27ff75d
comparison
equal deleted inserted replaced
20175:5ff0fd023850 20176:4c96c50ef937
1230 searching for changes 1230 searching for changes
1231 no changes found 1231 no changes found
1232 searching for changes 1232 searching for changes
1233 no changes found 1233 no changes found
1234 [1] 1234 [1]
1235 1235 $ cd ..
1236
1237 Test phase choice for newly created commit with "phases.subrepochecks"
1238 configuration
1239
1240 $ cd t
1241 $ hg update -q -r 12
1242
1243 $ cat >> s/ss/.hg/hgrc <<EOF
1244 > [phases]
1245 > new-commit = secret
1246 > EOF
1247 $ cat >> s/.hg/hgrc <<EOF
1248 > [phases]
1249 > new-commit = draft
1250 > EOF
1251 $ echo phasecheck1 >> s/ss/a
1252 $ hg -R s commit -S --config phases.checksubrepos=abort -m phasecheck1
1253 committing subrepository ss
1254 transaction abort!
1255 rollback completed
1256 abort: can't commit in draft phase conflicting secret from subrepository ss
1257 [255]
1258 $ echo phasecheck2 >> s/ss/a
1259 $ hg -R s commit -S --config phases.checksubrepos=ignore -m phasecheck2
1260 committing subrepository ss
1261 $ hg -R s/ss phase tip
1262 3: secret
1263 $ hg -R s phase tip
1264 6: draft
1265 $ echo phasecheck3 >> s/ss/a
1266 $ hg -R s commit -S -m phasecheck3
1267 committing subrepository ss
1268 warning: changes are committed in secret phase from subrepository ss
1269 $ hg -R s/ss phase tip
1270 4: secret
1271 $ hg -R s phase tip
1272 7: secret
1273
1274 $ cat >> t/.hg/hgrc <<EOF
1275 > [phases]
1276 > new-commit = draft
1277 > EOF
1278 $ cat >> .hg/hgrc <<EOF
1279 > [phases]
1280 > new-commit = public
1281 > EOF
1282 $ echo phasecheck4 >> s/ss/a
1283 $ echo phasecheck4 >> t/t
1284 $ hg commit -S -m phasecheck4
1285 committing subrepository s
1286 committing subrepository s/ss
1287 warning: changes are committed in secret phase from subrepository ss
1288 committing subrepository t
1289 warning: changes are committed in secret phase from subrepository s
1290 created new head
1291 $ hg -R s/ss phase tip
1292 5: secret
1293 $ hg -R s phase tip
1294 8: secret
1295 $ hg -R t phase tip
1296 6: draft
1297 $ hg phase tip
1298 15: secret
1299
1300 $ cd ..