changeset 6573:d511eba4cdb0

topic: compatibility for branchmaptns with branchmap from hg 5.0 Since our new branchmaptns so heavily reuses the core branchmap, we need to make sure to use all the compatibility function with it as well, even though it lives completely in topic extension.
author Anton Shestakov <av6@dwimlabs.net>
date Sun, 15 Oct 2023 16:59:25 -0300
parents ef04d887c9a0
children 054a7c342463
files hgext3rd/topic/__init__.py hgext3rd/topic/discovery.py hgext3rd/topic/server.py
diffstat 3 files changed, 7 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/topic/__init__.py	Fri Oct 13 15:16:18 2023 -0300
+++ b/hgext3rd/topic/__init__.py	Sun Oct 15 16:59:25 2023 -0300
@@ -782,7 +782,8 @@
                         else:
                             # only changesets in the selected topic namespaces are visible
                             h = []
-                            for branch, nodes in self._repo.branchmaptns().items():
+                            entries = compat.bcentries(self._repo.branchmaptns())
+                            for branch, nodes in compat.branchmapitems(entries):
                                 namedbranch, tns, topic = common.parsefqbn(branch)
                                 if tns == b'none' or tns in namespaces:
                                     h.extend(nodes)
--- a/hgext3rd/topic/discovery.py	Fri Oct 13 15:16:18 2023 -0300
+++ b/hgext3rd/topic/discovery.py	Sun Oct 15 16:59:25 2023 -0300
@@ -184,9 +184,9 @@
     """copied from wireprotov1server.branchmap()"""
     if not common.hastopicext(repo):
         return wireprotov1server.branchmap(repo, proto)
-    branchmaptns = repo.branchmaptns()
     heads = []
-    for branch, nodes in branchmaptns.items():
+    entries = compat.bcentries(repo.branchmaptns())
+    for branch, nodes in compat.branchmapitems(entries):
         branchname = urlreq.quote(encoding.fromlocal(branch))
         branchnodes = wireprototypes.encodelist(nodes)
         heads.append(b'%s %s' % (branchname, branchnodes))
--- a/hgext3rd/topic/server.py	Fri Oct 13 15:16:18 2023 -0300
+++ b/hgext3rd/topic/server.py	Sun Oct 15 16:59:25 2023 -0300
@@ -18,6 +18,7 @@
 
 from . import (
     common,
+    compat,
     constants,
 )
 
@@ -75,7 +76,8 @@
     else:
         # only changesets in the selected topic namespaces are visible
         h = []
-        for branch, nodes in repo.branchmaptns().items():
+        entries = compat.bcentries(repo.branchmaptns())
+        for branch, nodes in compat.branchmapitems(entries):
             namedbranch, tns, topic = common.parsefqbn(branch)
             if tns == b'none' or tns in namespaces:
                 h.extend(nodes)