Patchwork [6,of,8] templatekw: rename peerpaths to peerurls per naming convention (BC)

login
register
mail settings
Submitter Yuya Nishihara
Date Oct. 6, 2017, 4:05 p.m.
Message ID <37a60d44b96923c3e161.1507305956@mimosa>
Download mbox | patch
Permalink /patch/24607/
State Accepted
Headers show

Comments

Yuya Nishihara - Oct. 6, 2017, 4:05 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1505746385 -32400
#      Mon Sep 18 23:53:05 2017 +0900
# Node ID 37a60d44b96923c3e1612986020eb266dc7e122d
# Parent  9810c09653f2e980929539ed2a8d76478dc98ad1
templatekw: rename peerpaths to peerurls per naming convention (BC)

Since each element is called as "url", the template keyword should be named
as "<whatever>urls".

{peerurls} is now stabilized.

Patch

diff --git a/mercurial/templatekw.py b/mercurial/templatekw.py
--- a/mercurial/templatekw.py
+++ b/mercurial/templatekw.py
@@ -653,10 +653,10 @@  def showobsolete(repo, ctx, templ, **arg
         return 'obsolete'
     return ''
 
-@templatekeyword('peerpaths')
-def showpeerpaths(repo, **args):
+@templatekeyword('peerurls')
+def showpeerurls(repo, **args):
     """A dictionary of repository locations defined in the [paths] section
-    of your configuration file. (EXPERIMENTAL)"""
+    of your configuration file."""
     # see commands.paths() for naming of dictionary keys
     paths = repo.ui.paths
     urls = util.sortdict((k, p.rawloc) for k, p in sorted(paths.iteritems()))
diff --git a/tests/test-paths.t b/tests/test-paths.t
--- a/tests/test-paths.t
+++ b/tests/test-paths.t
@@ -88,29 +88,29 @@  log template:
 
  (behaves as a {name: path-string} dict by default)
 
-  $ hg log -rnull -T '{peerpaths}\n'
+  $ hg log -rnull -T '{peerurls}\n'
   dupe=$TESTTMP/b#tip expand=$TESTTMP/a/$SOMETHING/bar (glob)
-  $ hg log -rnull -T '{join(peerpaths, "\n")}\n'
+  $ hg log -rnull -T '{join(peerurls, "\n")}\n'
   dupe=$TESTTMP/b#tip (glob)
   expand=$TESTTMP/a/$SOMETHING/bar (glob)
-  $ hg log -rnull -T '{peerpaths % "{name}: {url}\n"}'
+  $ hg log -rnull -T '{peerurls % "{name}: {url}\n"}'
   dupe: $TESTTMP/b#tip (glob)
   expand: $TESTTMP/a/$SOMETHING/bar (glob)
-  $ hg log -rnull -T '{get(peerpaths, "dupe")}\n'
+  $ hg log -rnull -T '{get(peerurls, "dupe")}\n'
   $TESTTMP/b#tip (glob)
 
  (sub options can be populated by map/dot operation)
 
   $ hg log -rnull \
-  > -T '{get(peerpaths, "dupe") % "url: {url}\npushurl: {pushurl}\n"}'
+  > -T '{get(peerurls, "dupe") % "url: {url}\npushurl: {pushurl}\n"}'
   url: $TESTTMP/b#tip (glob)
   pushurl: https://example.com/dupe
-  $ hg log -rnull -T '{peerpaths.dupe.pushurl}\n'
+  $ hg log -rnull -T '{peerurls.dupe.pushurl}\n'
   https://example.com/dupe
 
  (in JSON, it's a dict of urls)
 
-  $ hg log -rnull -T '{peerpaths|json}\n' | sed 's|\\\\|/|g'
+  $ hg log -rnull -T '{peerurls|json}\n' | sed 's|\\\\|/|g'
   {"dupe": "$TESTTMP/b#tip", "expand": "$TESTTMP/a/$SOMETHING/bar"}
 
 password should be masked in plain output, but not in machine-readable/template
@@ -126,7 +126,7 @@  output:
     "url": "http://foo:insecure@example.com/"
    }
   ]
-  $ hg log -rnull -T '{get(peerpaths, "insecure")}\n'
+  $ hg log -rnull -T '{get(peerurls, "insecure")}\n'
   http://foo:insecure@example.com/
 
 zeroconf wraps ui.configitems(), which shouldn't crash at least: