Mercurial > hg
comparison mercurial/templatekw.py @ 33015:f66be4caeaab
py3: use "%d" % val for int rather than pycompat.bytestr
Earlier I used pycompat.bytestr() to convert integers to bytes, but we can do
b"%d" % val to convert that int to bytes. b'' is already added by the
transformer.
Thanks to Yuya for suggesting this.
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Thu, 22 Jun 2017 01:29:07 +0530 |
parents | 8779d35c168d |
children | c31d45623304 |
comparison
equal
deleted
inserted
replaced
33014:80a5d237a4ae | 33015:f66be4caeaab |
---|---|
621 args = pycompat.byteskwargs(args) | 621 args = pycompat.byteskwargs(args) |
622 repo = args['repo'] | 622 repo = args['repo'] |
623 ctx = args['ctx'] | 623 ctx = args['ctx'] |
624 pctxs = scmutil.meaningfulparents(repo, ctx) | 624 pctxs = scmutil.meaningfulparents(repo, ctx) |
625 # ifcontains() needs a list of str | 625 # ifcontains() needs a list of str |
626 prevs = [pycompat.bytestr(p.rev()) for p in pctxs] | 626 prevs = ["%d" % p.rev() for p in pctxs] |
627 parents = [[('rev', p.rev()), | 627 parents = [[('rev', p.rev()), |
628 ('node', p.hex()), | 628 ('node', p.hex()), |
629 ('phase', p.phasestr())] | 629 ('phase', p.phasestr())] |
630 for p in pctxs] | 630 for p in pctxs] |
631 f = _showlist('parent', parents, args) | 631 f = _showlist('parent', parents, args) |
651 """helper to generate a list of revisions in which a mapped template will | 651 """helper to generate a list of revisions in which a mapped template will |
652 be evaluated""" | 652 be evaluated""" |
653 args = pycompat.byteskwargs(args) | 653 args = pycompat.byteskwargs(args) |
654 repo = args['ctx'].repo() | 654 repo = args['ctx'].repo() |
655 # ifcontains() needs a list of str | 655 # ifcontains() needs a list of str |
656 revs = [pycompat.bytestr(r) for r in revs] | 656 revs = ["%d" % r for r in revs] |
657 f = _showlist(name, revs, args) | 657 f = _showlist(name, revs, args) |
658 return _hybrid(f, revs, | 658 return _hybrid(f, revs, |
659 lambda x: {name: x, 'ctx': repo[int(x)], 'revcache': {}}, | 659 lambda x: {name: x, 'ctx': repo[int(x)], 'revcache': {}}, |
660 lambda d: d[name]) | 660 lambda d: d[name]) |
661 | 661 |