Patchwork templatekw: hide {peerpaths} keyword for 4.3

login
register
mail settings
Submitter Yuya Nishihara
Date July 14, 2017, 4:12 p.m.
Message ID <3696e7f5cb2194e521da.1500048770@mimosa>
Download mbox | patch
Permalink /patch/22343/
State Accepted
Headers show

Comments

Yuya Nishihara - July 14, 2017, 4:12 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1500046737 -32400
#      Sat Jul 15 00:38:57 2017 +0900
# Node ID 3696e7f5cb2194e521da56d72db55aa1e7d27746
# Parent  f793e535b4b9ee6e6eaa19b0a5028e6d6c154ce2
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.
Augie Fackler - July 14, 2017, 4:52 p.m.
On Sat, Jul 15, 2017 at 01:12:50AM +0900, Yuya Nishihara wrote:
> # HG changeset patch
> # User Yuya Nishihara <yuya@tcha.org>
> # Date 1500046737 -32400
> #      Sat Jul 15 00:38:57 2017 +0900
> # Node ID 3696e7f5cb2194e521da56d72db55aa1e7d27746
> # Parent  f793e535b4b9ee6e6eaa19b0a5028e6d6c154ce2
> templatekw: hide {peerpaths} keyword for 4.3

queued, thanks

Patch

diff --git a/mercurial/templatekw.py b/mercurial/templatekw.py
--- a/mercurial/templatekw.py
+++ b/mercurial/templatekw.py
@@ -596,7 +596,7 @@  def showobsolete(repo, ctx, templ, **arg
 @templatekeyword('peerpaths')
 def showpeerpaths(repo, **args):
     """A dictionary of repository locations defined in the [paths] section
-    of your configuration file."""
+    of your configuration file. (EXPERIMENTAL)"""
     # see commands.paths() for naming of dictionary keys
     paths = util.sortdict()
     for k, p in sorted(repo.ui.paths.iteritems()):