# HG changeset patch # User Yuya Nishihara # Date 2017-09-18 14:53:05 # Node ID f30e59703d9819735a9335de73aa31691050ce2e # Parent ac38e889b33a309fb474320939c4c5c2b3fffda0 templatekw: rename peerpaths to peerurls per naming convention (BC) Since each element is called as "url", the template keyword should be named as "urls". {peerurls} is now stabilized. 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: