diff extensions/kwarchive.py @ 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 bee0d9026720
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))