Mercurial > hg
comparison mercurial/templatekw.py @ 33476:c0d8de2724ce
templatekw: hide {peerpaths} keyword for 4.3
Thinking a bit further about list/dict subscript operation (proposed by
issue 5534), I noticed the current data structure, a dict of dicts, might
not be ideal.
For example, if there were "'[' index ']'" and "'.' key" operators,
"{parents[0]}" would return "{p1rev}:{p1node}", and we would probably want to
write "{parents[0].desc}" to get the first element of "{parents % "{desc}"}".
This will basically execute parents[0].makemap()['desc'] in Python.
Given the rule above, "{peerpaths.default.pushurl}" will be translated to
peerpaths['default'].makemap()['pushurl'], which means {peerpaths} should
be a single-level dict and sub-options should be makemap()-ed.
"{peerpaths % "{name} = {url}, {pushurl}, ..."}"
(Well, it could be peerpaths['default']['pushurl'], but in which case,
peerpaths['default'] should be a plain dict, not a hybrid object.)
So, let's mark the current implementation experimental and revisit it later.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sat, 15 Jul 2017 00:38:57 +0900 |
parents | 16ed67164002 |
children | 511d6ae462f3 fb672eac2702 |
comparison
equal
deleted
inserted
replaced
33475:f501322512b6 | 33476:c0d8de2724ce |
---|---|
594 return '' | 594 return '' |
595 | 595 |
596 @templatekeyword('peerpaths') | 596 @templatekeyword('peerpaths') |
597 def showpeerpaths(repo, **args): | 597 def showpeerpaths(repo, **args): |
598 """A dictionary of repository locations defined in the [paths] section | 598 """A dictionary of repository locations defined in the [paths] section |
599 of your configuration file.""" | 599 of your configuration file. (EXPERIMENTAL)""" |
600 # see commands.paths() for naming of dictionary keys | 600 # see commands.paths() for naming of dictionary keys |
601 paths = util.sortdict() | 601 paths = util.sortdict() |
602 for k, p in sorted(repo.ui.paths.iteritems()): | 602 for k, p in sorted(repo.ui.paths.iteritems()): |
603 d = util.sortdict() | 603 d = util.sortdict() |
604 d['url'] = p.rawloc | 604 d['url'] = p.rawloc |