Patchwork D10442: template: use `list_paths` in `peerurls`

login
register
mail settings
Submitter phabricator
Date April 16, 2021, 12:03 a.m.
Message ID <differential-rev-PHID-DREV-xwll4o6ek6oi3tc42jlp-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/48759/
State Superseded
Headers show

Comments

phabricator - April 16, 2021, 12:03 a.m.
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Using common code will make it simpler to update the logic behind the path
  definition and storage.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D10442

AFFECTED FILES
  mercurial/templatekw.py

CHANGE DETAILS




To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/mercurial/templatekw.py b/mercurial/templatekw.py
--- a/mercurial/templatekw.py
+++ b/mercurial/templatekw.py
@@ -29,7 +29,10 @@ 
     templateutil,
     util,
 )
-from .utils import stringutil
+from .utils import (
+    stringutil,
+    urlutil,
+)
 
 _hybrid = templateutil.hybrid
 hybriddict = templateutil.hybriddict
@@ -661,9 +664,8 @@ 
     repo = context.resource(mapping, b'repo')
     # see commands.paths() for naming of dictionary keys
     paths = repo.ui.paths
-    urls = util.sortdict(
-        (k, p.rawloc) for k, p in sorted(pycompat.iteritems(paths))
-    )
+    all_paths = urlutil.list_paths(repo.ui)
+    urls = util.sortdict((k, p.rawloc) for k, p in all_paths)
 
     def makemap(k):
         p = paths[k]