[Commented On] D10444: template: add a `paths` field to all entry in peersurl

baymax (Baymax, Your Personal Patch-care Companion) phabricator at mercurial-scm.org
Thu Apr 29 17:48:42 UTC 2021


baymax added a comment.
baymax updated this revision to Diff 27204.


  ✅ refresh by Heptapod after a successful CI run (🐙 💚)

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D10444?vs=27013&id=27204

BRANCH
  default

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D10444/new/

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

AFFECTED FILES
  mercurial/templatekw.py
  tests/test-paths.t

CHANGE DETAILS

diff --git a/tests/test-paths.t b/tests/test-paths.t
--- a/tests/test-paths.t
+++ b/tests/test-paths.t
@@ -98,6 +98,9 @@
   expand: $TESTTMP/a/$SOMETHING/bar
   $ hg log -rnull -T '{get(peerurls, "dupe")}\n'
   $TESTTMP/b#tip
+  $ hg log -rnull -T '{peerurls % "{urls|json}\n"}'
+  [{"pushurl": "https://example.com/dupe", "url": "$TESTTMP/b#tip"}]
+  [{"url": "$TESTTMP/a/$SOMETHING/bar"}]
 
  (sub options can be populated by map/dot operation)
 
diff --git a/mercurial/templatekw.py b/mercurial/templatekw.py
--- a/mercurial/templatekw.py
+++ b/mercurial/templatekw.py
@@ -670,7 +670,12 @@
     def makemap(k):
         p = paths[k]
         d = {b'name': k, b'url': p.rawloc}
-        d.update((o, v) for o, v in sorted(pycompat.iteritems(p.suboptions)))
+        sub_opts = util.sortdict(sorted(pycompat.iteritems(p.suboptions)))
+        d.update(sub_opts)
+        path_dict = util.sortdict()
+        path_dict[b'url'] = p.rawloc
+        path_dict.update(sub_opts)
+        d[b'urls'] = [path_dict]
         return d
 
     def format_one(k):



To: marmoute, #hg-reviewers, Alphare
Cc: Alphare, mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20210429/0d14298f/attachment-0002.html>


More information about the Mercurial-patches mailing list