Mercurial > hg
changeset 34539:f30e59703d98
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.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Mon, 18 Sep 2017 23:53:05 +0900 |
parents | ac38e889b33a |
children | 1c7c4445686f |
files | mercurial/templatekw.py tests/test-paths.t |
diffstat | 2 files changed, 11 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/templatekw.py Mon Sep 18 23:31:01 2017 +0900 +++ b/mercurial/templatekw.py Mon Sep 18 23:53:05 2017 +0900 @@ -653,10 +653,10 @@ 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()))
--- a/tests/test-paths.t Mon Sep 18 23:31:01 2017 +0900 +++ b/tests/test-paths.t Mon Sep 18 23:53:05 2017 +0900 @@ -88,29 +88,29 @@ (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 @@ "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: