changeset 420:43fd36a465cc

Make revinfo and kwarchive compatible to Mercurial 5.8: ui.paths yields now a list of location objects
author Franz Glasner <fzglas.hg@dom66.de>
date Wed, 20 Oct 2021 09:33:37 +0200
parents 4885536aafc6
children 0e19e4228d76
files extensions/kwarchive.py extensions/revinfo.py
diffstat 2 files changed, 23 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/extensions/kwarchive.py	Sat Sep 11 17:52:51 2021 +0200
+++ b/extensions/kwarchive.py	Wed Oct 20 09:33:37 2021 +0200
@@ -116,7 +116,7 @@
         _dateutil = util
 
 
-testedwith = b"4.3.1 4.3.2 4.4.1 4.4.2 4.5.2 4.6.1 4.8.1 4.9 5.0.1 5.1.2 5.2.1 5.5 5.6"
+testedwith = b"4.3.1 4.3.2 4.4.1 4.4.2 4.5.2 4.6.1 4.8.1 4.9 5.0.1 5.1.2 5.2.1 5.5 5.6 5.9.1"
 
 SHORTENED_HG_SCHEMES = {
     b"ssh": b"hg+ssh",
@@ -696,7 +696,17 @@
             raise ValueError("either `hgpath' or `hglocation` can be set")
         if (hglocation is not None) or (hgpath and hgpath != b"."):
             if hglocation is None:
-                hglocation = ui.paths[hgpath].loc
+                #
+                # Since Mercurial 5.8 ui.paths[n] yields a list of
+                # locations
+                #
+                locations = ui.paths[hgpath]
+                if isinstance(locations, list):
+                    # for now a quick check of assumptions
+                    assert len(locations) == 1
+                    hglocation = locations[0].loc
+                else:
+                    hglocation = locations.loc
             try:
                 if path_filter == b"full":
                     path_uri = bytes(util.url(hglocation))
--- a/extensions/revinfo.py	Sat Sep 11 17:52:51 2021 +0200
+++ b/extensions/revinfo.py	Wed Oct 20 09:33:37 2021 +0200
@@ -30,7 +30,7 @@
         registrar = None
 
 
-testedwith = b"4.3.1 4.3.2 4.4.1 4.4.2 4.5.2 4.6.1 4.8.1 4.9 5.0.1 5.1.2 5.2.1 5.5 5.6"
+testedwith = b"4.3.1 4.3.2 4.4.1 4.4.2 4.5.2 4.6.1 4.8.1 4.9 5.0.1 5.1.2 5.2.1 5.5 5.6 5.9.1"
 
 cmdtable = {}
 
@@ -133,9 +133,17 @@
             if canonicalpath == b'.':
                 msg += b"path: %s\n" % repo.root
             else:
-                for name, path in sorted(ui.paths.items()):
+                #
+                # Since Mercurial 5.8 ui.paths[n] yields a list of
+                # locations
+                #
+                for name, paths in sorted(ui.paths.items()):
+                    if not isinstance(paths, list):
+                        paths = [paths]
+                    # for now a quick check of assumptions
+                    assert len(paths) == 1
                     if name == canonicalpath:
-                        msg += b"path: %s\n" % util.hidepassword(path.loc)
+                        msg += b"path: %s\n" % util.hidepassword(paths[0].loc)
                         break
                 else:
                     msg += b"path: %s\n" % canonicalpath