##// END OF EJS Templates
templatekw: add 'subrepos' keyword to show updated subrepositories...
FUJIWARA Katsunori -
r21897:764adc33 default
parent child Browse files
Show More
@@ -356,6 +356,22 b' def showrev(repo, ctx, templ, **args):'
356 356 """:rev: Integer. The repository-local changeset revision number."""
357 357 return ctx.rev()
358 358
359 def showsubrepos(**args):
360 """:subrepos: List of strings. Updated subrepositories in the changeset."""
361 ctx = args['ctx']
362 substate = ctx.substate
363 if not substate:
364 return showlist('subrepo', [], **args)
365 psubstate = ctx.parents()[0].substate or {}
366 subrepos = []
367 for sub in substate:
368 if sub not in psubstate or substate[sub] != psubstate[sub]:
369 subrepos.append(sub) # modified or newly added in ctx
370 for sub in psubstate:
371 if sub not in substate:
372 subrepos.append(sub) # removed in ctx
373 return showlist('subrepo', sorted(subrepos), **args)
374
359 375 def showtags(**args):
360 376 """:tags: List of strings. Any tags associated with the changeset."""
361 377 return showlist('tag', args['ctx'].tags(), **args)
@@ -397,6 +413,7 b' keywords = {'
397 413 'phase': showphase,
398 414 'phaseidx': showphaseidx,
399 415 'rev': showrev,
416 'subrepos': showsubrepos,
400 417 'tags': showtags,
401 418 }
402 419
@@ -1360,6 +1360,92 b' Test that commit --secret works on both '
1360 1360 6: secret
1361 1361 $ cd ../../
1362 1362
1363 Test "subrepos" template keyword
1364
1365 $ cd t
1366 $ hg update -q 15
1367 $ cat > .hgsub <<EOF
1368 > s = s
1369 > EOF
1370 $ hg commit -m "16"
1371 warning: changes are committed in secret phase from subrepository s
1372
1373 (addition of ".hgsub" itself)
1374
1375 $ hg diff --nodates -c 1 .hgsubstate
1376 diff -r f7b1eb17ad24 -r 7cf8cfea66e4 .hgsubstate
1377 --- /dev/null
1378 +++ b/.hgsubstate
1379 @@ -0,0 +1,1 @@
1380 +e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
1381 $ hg log -r 1 --template "{p1node|short} {p2node|short}\n{subrepos % '{subrepo}\n'}"
1382 f7b1eb17ad24 000000000000
1383 s
1384
1385 (modification of existing entry)
1386
1387 $ hg diff --nodates -c 2 .hgsubstate
1388 diff -r 7cf8cfea66e4 -r df30734270ae .hgsubstate
1389 --- a/.hgsubstate
1390 +++ b/.hgsubstate
1391 @@ -1,1 +1,1 @@
1392 -e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
1393 +dc73e2e6d2675eb2e41e33c205f4bdab4ea5111d s
1394 $ hg log -r 2 --template "{p1node|short} {p2node|short}\n{subrepos % '{subrepo}\n'}"
1395 7cf8cfea66e4 000000000000
1396 s
1397
1398 (addition of entry)
1399
1400 $ hg diff --nodates -c 5 .hgsubstate
1401 diff -r 7cf8cfea66e4 -r 1f14a2e2d3ec .hgsubstate
1402 --- a/.hgsubstate
1403 +++ b/.hgsubstate
1404 @@ -1,1 +1,2 @@
1405 e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
1406 +60ca1237c19474e7a3978b0dc1ca4e6f36d51382 t
1407 $ hg log -r 5 --template "{p1node|short} {p2node|short}\n{subrepos % '{subrepo}\n'}"
1408 7cf8cfea66e4 000000000000
1409 t
1410
1411 (removal of existing entry)
1412
1413 $ hg diff --nodates -c 16 .hgsubstate
1414 diff -r 8bec38d2bd0b -r f2f70bc3d3c9 .hgsubstate
1415 --- a/.hgsubstate
1416 +++ b/.hgsubstate
1417 @@ -1,2 +1,1 @@
1418 0731af8ca9423976d3743119d0865097c07bdc1b s
1419 -e202dc79b04c88a636ea8913d9182a1346d9b3dc t
1420 $ hg log -r 16 --template "{p1node|short} {p2node|short}\n{subrepos % '{subrepo}\n'}"
1421 8bec38d2bd0b 000000000000
1422 t
1423
1424 (merging)
1425
1426 $ hg diff --nodates -c 9 .hgsubstate
1427 diff -r f6affe3fbfaa -r f0d2028bf86d .hgsubstate
1428 --- a/.hgsubstate
1429 +++ b/.hgsubstate
1430 @@ -1,1 +1,2 @@
1431 fc627a69481fcbe5f1135069e8a3881c023e4cf5 s
1432 +60ca1237c19474e7a3978b0dc1ca4e6f36d51382 t
1433 $ hg log -r 9 --template "{p1node|short} {p2node|short}\n{subrepos % '{subrepo}\n'}"
1434 f6affe3fbfaa 1f14a2e2d3ec
1435 t
1436
1437 (removal of ".hgsub" itself)
1438
1439 $ hg diff --nodates -c 8 .hgsubstate
1440 diff -r f94576341bcf -r 96615c1dad2d .hgsubstate
1441 --- a/.hgsubstate
1442 +++ /dev/null
1443 @@ -1,2 +0,0 @@
1444 -e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
1445 -7af322bc1198a32402fe903e0b7ebcfc5c9bf8f4 t
1446 $ hg log -r 8 --template "{p1node|short} {p2node|short}\n{subrepos % '{subrepo}\n'}"
1447 f94576341bcf 000000000000
1448
1363 1449 Test that '[paths]' is configured correctly at subrepo creation
1364 1450
1365 1451 $ cd $TESTTMP/tc
General Comments 0
You need to be logged in to leave comments. Login now