##// END OF EJS Templates
templatekw: port implementation of showparents() from changeset_templater...
Yuya Nishihara -
r26435:882b170a default
parent child Browse files
Show More
@@ -1428,24 +1428,8 b' class changeset_templater(changeset_prin'
1428
1428
1429 def _show(self, ctx, copies, matchfn, props):
1429 def _show(self, ctx, copies, matchfn, props):
1430 '''show a single changeset or file revision'''
1430 '''show a single changeset or file revision'''
1431
1432 showlist = templatekw.showlist
1433
1434 # showparents() behavior depends on ui trace level which
1435 # causes unexpected behaviors at templating level and makes
1436 # it harder to extract it in a standalone function. Its
1437 # behavior cannot be changed so leave it here for now.
1438 def showparents(**args):
1439 ctx = args['ctx']
1440 parents = [[('rev', p.rev()),
1441 ('node', p.hex()),
1442 ('phase', p.phasestr())]
1443 for p in scmutil.meaningfulparents(self.repo, ctx)]
1444 return showlist('parent', parents, **args)
1445
1446 props = props.copy()
1431 props = props.copy()
1447 props.update(templatekw.keywords)
1432 props.update(templatekw.keywords)
1448 props['parents'] = showparents
1449 props['templ'] = self.t
1433 props['templ'] = self.t
1450 props['ctx'] = ctx
1434 props['ctx'] = ctx
1451 props['repo'] = self.repo
1435 props['repo'] = self.repo
@@ -397,11 +397,17 b' def showp2node(repo, ctx, templ, **args)'
397 parent, all digits are 0."""
397 parent, all digits are 0."""
398 return ctx.p2().hex()
398 return ctx.p2().hex()
399
399
400 def _showparents(**args):
400 def showparents(**args):
401 """:parents: List of strings. The parents of the changeset in "rev:node"
401 """:parents: List of strings. The parents of the changeset in "rev:node"
402 format. If the changeset has only one "natural" parent (the predecessor
402 format. If the changeset has only one "natural" parent (the predecessor
403 revision) nothing is shown."""
403 revision) nothing is shown."""
404 pass
404 repo = args['repo']
405 ctx = args['ctx']
406 parents = [[('rev', p.rev()),
407 ('node', p.hex()),
408 ('phase', p.phasestr())]
409 for p in scmutil.meaningfulparents(repo, ctx)]
410 return showlist('parent', parents, **args)
405
411
406 def showphase(repo, ctx, templ, **args):
412 def showphase(repo, ctx, templ, **args):
407 """:phase: String. The changeset phase name."""
413 """:phase: String. The changeset phase name."""
@@ -491,6 +497,7 b' keywords = {'
491 'p1node': showp1node,
497 'p1node': showp1node,
492 'p2rev': showp2rev,
498 'p2rev': showp2rev,
493 'p2node': showp2node,
499 'p2node': showp2node,
500 'parents': showparents,
494 'phase': showphase,
501 'phase': showphase,
495 'phaseidx': showphaseidx,
502 'phaseidx': showphaseidx,
496 'rev': showrev,
503 'rev': showrev,
@@ -499,7 +506,6 b' keywords = {'
499 }
506 }
500
507
501 dockeywords = {
508 dockeywords = {
502 'parents': _showparents,
503 }
509 }
504 dockeywords.update(keywords)
510 dockeywords.update(keywords)
505 del dockeywords['branches']
511 del dockeywords['branches']
General Comments 0
You need to be logged in to leave comments. Login now