# HG changeset patch # User Franz Glasner # Date 1634715217 -7200 # Node ID 43fd36a465cc7519399476161a28d369bb240815 # Parent 4885536aafc69503238758c2463ef4096543a464 Make revinfo and kwarchive compatible to Mercurial 5.8: ui.paths yields now a list of location objects diff -r 4885536aafc6 -r 43fd36a465cc extensions/kwarchive.py --- 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)) diff -r 4885536aafc6 -r 43fd36a465cc extensions/revinfo.py --- 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