mercurial/templatekw.py
changeset 48913 f254fc73d956
parent 48875 6000f5b25c9b
child 48930 e6df205a876c
equal deleted inserted replaced
48912:a0674e916fb6 48913:f254fc73d956
   600 
   600 
   601     def makensmapfn(ns):
   601     def makensmapfn(ns):
   602         # 'name' for iterating over namespaces, templatename for local reference
   602         # 'name' for iterating over namespaces, templatename for local reference
   603         return lambda v: {b'name': v, ns.templatename: v}
   603         return lambda v: {b'name': v, ns.templatename: v}
   604 
   604 
   605     for k, ns in pycompat.iteritems(repo.names):
   605     for k, ns in repo.names.items():
   606         names = ns.names(repo, ctx.node())
   606         names = ns.names(repo, ctx.node())
   607         f = _showcompatlist(context, mapping, b'name', names)
   607         f = _showcompatlist(context, mapping, b'name', names)
   608         namespaces[k] = _hybrid(f, names, makensmapfn(ns), pycompat.identity)
   608         namespaces[k] = _hybrid(f, names, makensmapfn(ns), pycompat.identity)
   609 
   609 
   610     f = _showcompatlist(context, mapping, b'namespace', list(namespaces))
   610     f = _showcompatlist(context, mapping, b'namespace', list(namespaces))
   688             sub_opts = pycompat.iteritems(ps[0].suboptions)
   688             sub_opts = pycompat.iteritems(ps[0].suboptions)
   689             sub_opts = util.sortdict(sorted(sub_opts))
   689             sub_opts = util.sortdict(sorted(sub_opts))
   690             d.update(sub_opts)
   690             d.update(sub_opts)
   691         path_dict = util.sortdict()
   691         path_dict = util.sortdict()
   692         for p in ps:
   692         for p in ps:
   693             sub_opts = util.sortdict(sorted(pycompat.iteritems(p.suboptions)))
   693             sub_opts = util.sortdict(sorted(p.suboptions.items()))
   694             path_dict[b'url'] = p.rawloc
   694             path_dict[b'url'] = p.rawloc
   695             path_dict.update(sub_opts)
   695             path_dict.update(sub_opts)
   696             d[b'urls'] = [path_dict]
   696             d[b'urls'] = [path_dict]
   697         return d
   697         return d
   698 
   698 
  1021     return templateutil.mappinglist(entries, tmpl=tmpl, sep=b'\n')
  1021     return templateutil.mappinglist(entries, tmpl=tmpl, sep=b'\n')
  1022 
  1022 
  1023 
  1023 
  1024 def loadkeyword(ui, extname, registrarobj):
  1024 def loadkeyword(ui, extname, registrarobj):
  1025     """Load template keyword from specified registrarobj"""
  1025     """Load template keyword from specified registrarobj"""
  1026     for name, func in pycompat.iteritems(registrarobj._table):
  1026     for name, func in registrarobj._table.items():
  1027         keywords[name] = func
  1027         keywords[name] = func
  1028 
  1028 
  1029 
  1029 
  1030 # tell hggettext to extract docstrings from these functions:
  1030 # tell hggettext to extract docstrings from these functions:
  1031 i18nfunctions = keywords.values()
  1031 i18nfunctions = keywords.values()