##// END OF EJS Templates
py3: convert keys of kwargs in template keywords functions to bytes...
Pulkit Goyal -
r32972:26e710f0 default
parent child Browse files
Show More
@@ -20,6 +20,7 b' from . import ('
20 hbisect,
20 hbisect,
21 obsutil,
21 obsutil,
22 patch,
22 patch,
23 pycompat,
23 registrar,
24 registrar,
24 scmutil,
25 scmutil,
25 util,
26 util,
@@ -293,6 +294,7 b' def showbranches(**args):'
293 changeset was committed. Will be empty if the branch name was
294 changeset was committed. Will be empty if the branch name was
294 default. (DEPRECATED)
295 default. (DEPRECATED)
295 """
296 """
297 args = pycompat.byteskwargs(args)
296 branch = args['ctx'].branch()
298 branch = args['ctx'].branch()
297 if branch != 'default':
299 if branch != 'default':
298 return showlist('branch', [branch], args, plural='branches')
300 return showlist('branch', [branch], args, plural='branches')
@@ -303,6 +305,7 b' def showbookmarks(**args):'
303 """List of strings. Any bookmarks associated with the
305 """List of strings. Any bookmarks associated with the
304 changeset. Also sets 'active', the name of the active bookmark.
306 changeset. Also sets 'active', the name of the active bookmark.
305 """
307 """
308 args = pycompat.byteskwargs(args)
306 repo = args['ctx']._repo
309 repo = args['ctx']._repo
307 bookmarks = args['ctx'].bookmarks()
310 bookmarks = args['ctx'].bookmarks()
308 active = repo._activebookmark
311 active = repo._activebookmark
@@ -313,6 +316,7 b' def showbookmarks(**args):'
313 @templatekeyword('children')
316 @templatekeyword('children')
314 def showchildren(**args):
317 def showchildren(**args):
315 """List of strings. The children of the changeset."""
318 """List of strings. The children of the changeset."""
319 args = pycompat.byteskwargs(args)
316 ctx = args['ctx']
320 ctx = args['ctx']
317 childrevs = ['%d:%s' % (cctx, cctx) for cctx in ctx.children()]
321 childrevs = ['%d:%s' % (cctx, cctx) for cctx in ctx.children()]
318 return showlist('children', childrevs, args, element='child')
322 return showlist('children', childrevs, args, element='child')
@@ -360,6 +364,7 b' def showdiffstat(repo, ctx, templ, **arg'
360 @templatekeyword('envvars')
364 @templatekeyword('envvars')
361 def showenvvars(repo, **args):
365 def showenvvars(repo, **args):
362 """A dictionary of environment variables. (EXPERIMENTAL)"""
366 """A dictionary of environment variables. (EXPERIMENTAL)"""
367 args = pycompat.byteskwargs(args)
363 env = repo.ui.exportableenviron()
368 env = repo.ui.exportableenviron()
364 env = util.sortdict((k, env[k]) for k in sorted(env))
369 env = util.sortdict((k, env[k]) for k in sorted(env))
365 return showdict('envvar', env, args, plural='envvars')
370 return showdict('envvar', env, args, plural='envvars')
@@ -368,6 +373,7 b' def showenvvars(repo, **args):'
368 def showextras(**args):
373 def showextras(**args):
369 """List of dicts with key, value entries of the 'extras'
374 """List of dicts with key, value entries of the 'extras'
370 field of this changeset."""
375 field of this changeset."""
376 args = pycompat.byteskwargs(args)
371 extras = args['ctx'].extra()
377 extras = args['ctx'].extra()
372 extras = util.sortdict((k, extras[k]) for k in sorted(extras))
378 extras = util.sortdict((k, extras[k]) for k in sorted(extras))
373 makemap = lambda k: {'key': k, 'value': extras[k]}
379 makemap = lambda k: {'key': k, 'value': extras[k]}
@@ -379,6 +385,7 b' def showextras(**args):'
379 @templatekeyword('file_adds')
385 @templatekeyword('file_adds')
380 def showfileadds(**args):
386 def showfileadds(**args):
381 """List of strings. Files added by this changeset."""
387 """List of strings. Files added by this changeset."""
388 args = pycompat.byteskwargs(args)
382 repo, ctx, revcache = args['repo'], args['ctx'], args['revcache']
389 repo, ctx, revcache = args['repo'], args['ctx'], args['revcache']
383 return showlist('file_add', getfiles(repo, ctx, revcache)[1], args,
390 return showlist('file_add', getfiles(repo, ctx, revcache)[1], args,
384 element='file')
391 element='file')
@@ -388,6 +395,7 b' def showfilecopies(**args):'
388 """List of strings. Files copied in this changeset with
395 """List of strings. Files copied in this changeset with
389 their sources.
396 their sources.
390 """
397 """
398 args = pycompat.byteskwargs(args)
391 cache, ctx = args['cache'], args['ctx']
399 cache, ctx = args['cache'], args['ctx']
392 copies = args['revcache'].get('copies')
400 copies = args['revcache'].get('copies')
393 if copies is None:
401 if copies is None:
@@ -412,6 +420,7 b' def showfilecopiesswitch(**args):'
412 """List of strings. Like "file_copies" but displayed
420 """List of strings. Like "file_copies" but displayed
413 only if the --copied switch is set.
421 only if the --copied switch is set.
414 """
422 """
423 args = pycompat.byteskwargs(args)
415 copies = args['revcache'].get('copies') or []
424 copies = args['revcache'].get('copies') or []
416 copies = util.sortdict(copies)
425 copies = util.sortdict(copies)
417 return showdict('file_copy', copies, args, plural='file_copies',
426 return showdict('file_copy', copies, args, plural='file_copies',
@@ -420,6 +429,7 b' def showfilecopiesswitch(**args):'
420 @templatekeyword('file_dels')
429 @templatekeyword('file_dels')
421 def showfiledels(**args):
430 def showfiledels(**args):
422 """List of strings. Files removed by this changeset."""
431 """List of strings. Files removed by this changeset."""
432 args = pycompat.byteskwargs(args)
423 repo, ctx, revcache = args['repo'], args['ctx'], args['revcache']
433 repo, ctx, revcache = args['repo'], args['ctx'], args['revcache']
424 return showlist('file_del', getfiles(repo, ctx, revcache)[2], args,
434 return showlist('file_del', getfiles(repo, ctx, revcache)[2], args,
425 element='file')
435 element='file')
@@ -427,6 +437,7 b' def showfiledels(**args):'
427 @templatekeyword('file_mods')
437 @templatekeyword('file_mods')
428 def showfilemods(**args):
438 def showfilemods(**args):
429 """List of strings. Files modified by this changeset."""
439 """List of strings. Files modified by this changeset."""
440 args = pycompat.byteskwargs(args)
430 repo, ctx, revcache = args['repo'], args['ctx'], args['revcache']
441 repo, ctx, revcache = args['repo'], args['ctx'], args['revcache']
431 return showlist('file_mod', getfiles(repo, ctx, revcache)[0], args,
442 return showlist('file_mod', getfiles(repo, ctx, revcache)[0], args,
432 element='file')
443 element='file')
@@ -436,6 +447,7 b' def showfiles(**args):'
436 """List of strings. All files modified, added, or removed by this
447 """List of strings. All files modified, added, or removed by this
437 changeset.
448 changeset.
438 """
449 """
450 args = pycompat.byteskwargs(args)
439 return showlist('file', args['ctx'].files(), args)
451 return showlist('file', args['ctx'].files(), args)
440
452
441 @templatekeyword('graphnode')
453 @templatekeyword('graphnode')
@@ -470,6 +482,7 b' def showlatesttag(**args):'
470
482
471 def showlatesttags(pattern, **args):
483 def showlatesttags(pattern, **args):
472 """helper method for the latesttag keyword and function"""
484 """helper method for the latesttag keyword and function"""
485 args = pycompat.byteskwargs(args)
473 repo, ctx = args['repo'], args['ctx']
486 repo, ctx = args['repo'], args['ctx']
474 cache = args['cache']
487 cache = args['cache']
475 latesttags = getlatesttags(repo, ctx, cache, pattern)
488 latesttags = getlatesttags(repo, ctx, cache, pattern)
@@ -526,6 +539,7 b' def showmanifest(**args):'
526
539
527 def shownames(namespace, **args):
540 def shownames(namespace, **args):
528 """helper method to generate a template keyword for a namespace"""
541 """helper method to generate a template keyword for a namespace"""
542 args = pycompat.byteskwargs(args)
529 ctx = args['ctx']
543 ctx = args['ctx']
530 repo = ctx.repo()
544 repo = ctx.repo()
531 ns = repo.names[namespace]
545 ns = repo.names[namespace]
@@ -536,6 +550,7 b' def shownames(namespace, **args):'
536 def shownamespaces(**args):
550 def shownamespaces(**args):
537 """Dict of lists. Names attached to this changeset per
551 """Dict of lists. Names attached to this changeset per
538 namespace."""
552 namespace."""
553 args = pycompat.byteskwargs(args)
539 ctx = args['ctx']
554 ctx = args['ctx']
540 repo = ctx.repo()
555 repo = ctx.repo()
541 namespaces = util.sortdict((k, showlist('name', ns.names(repo, ctx.node()),
556 namespaces = util.sortdict((k, showlist('name', ns.names(repo, ctx.node()),
@@ -603,6 +618,7 b' def showparents(**args):'
603 """List of strings. The parents of the changeset in "rev:node"
618 """List of strings. The parents of the changeset in "rev:node"
604 format. If the changeset has only one "natural" parent (the predecessor
619 format. If the changeset has only one "natural" parent (the predecessor
605 revision) nothing is shown."""
620 revision) nothing is shown."""
621 args = pycompat.byteskwargs(args)
606 repo = args['repo']
622 repo = args['repo']
607 ctx = args['ctx']
623 ctx = args['ctx']
608 pctxs = scmutil.meaningfulparents(repo, ctx)
624 pctxs = scmutil.meaningfulparents(repo, ctx)
@@ -633,6 +649,7 b' def showrev(repo, ctx, templ, **args):'
633 def showrevslist(name, revs, **args):
649 def showrevslist(name, revs, **args):
634 """helper to generate a list of revisions in which a mapped template will
650 """helper to generate a list of revisions in which a mapped template will
635 be evaluated"""
651 be evaluated"""
652 args = pycompat.byteskwargs(args)
636 repo = args['ctx'].repo()
653 repo = args['ctx'].repo()
637 revs = [str(r) for r in revs] # ifcontains() needs a list of str
654 revs = [str(r) for r in revs] # ifcontains() needs a list of str
638 f = _showlist(name, revs, args)
655 f = _showlist(name, revs, args)
@@ -643,6 +660,7 b' def showrevslist(name, revs, **args):'
643 @templatekeyword('subrepos')
660 @templatekeyword('subrepos')
644 def showsubrepos(**args):
661 def showsubrepos(**args):
645 """List of strings. Updated subrepositories in the changeset."""
662 """List of strings. Updated subrepositories in the changeset."""
663 args = pycompat.byteskwargs(args)
646 ctx = args['ctx']
664 ctx = args['ctx']
647 substate = ctx.substate
665 substate = ctx.substate
648 if not substate:
666 if not substate:
@@ -682,6 +700,7 b' def showtroubles(**args):'
682
700
683 (EXPERIMENTAL)
701 (EXPERIMENTAL)
684 """
702 """
703 args = pycompat.byteskwargs(args)
685 return showlist('trouble', args['ctx'].troubles(), args)
704 return showlist('trouble', args['ctx'].troubles(), args)
686
705
687 # tell hggettext to extract docstrings from these functions:
706 # tell hggettext to extract docstrings from these functions:
General Comments 0
You need to be logged in to leave comments. Login now