Mercurial > public > mercurial-scm > evolve
diff hgext3rd/topic/__init__.py @ 6296:a2855aff1268
topic: call a different wire protocol command to get tns-aware branchmap
To see if remote supports topic namespaces, we announce topics-namespaces
capability and then check it. If it's supported, then we can use a different
branchmap command that gives us branchmap keyed by fqbn. The support for old
"branch:topic" format for the keys is continued through the already existing
code.
author | Anton Shestakov <av6@dwimlabs.net> |
---|---|
date | Mon, 25 Jul 2022 12:30:12 +0400 |
parents | 47268350b3bc |
children | c00332abb66b |
line wrap: on
line diff
--- a/hgext3rd/topic/__init__.py Wed Jul 27 20:23:08 2022 +0400 +++ b/hgext3rd/topic/__init__.py Mon Jul 25 12:30:12 2022 +0400 @@ -503,6 +503,7 @@ def _restrictcapabilities(self, caps): caps = super(topicrepo, self)._restrictcapabilities(caps) caps.add(b'topics') + caps.add(b'topics-namespaces') if self.ui.configbool(b'phases', b'publish'): mode = b'all' elif self.ui.configbool(b'experimental', @@ -592,6 +593,15 @@ entries[key] = value return bm + def branchmaptns(self, topic=None): + """branchmap using fqbn as keys""" + if topic is None: + topic = getattr(self, '_autobranchmaptopic', False) + topicfilter = topicmap.topicfilter(self.filtername) + if not topic or topicfilter == self.filtername: + return super(topicrepo, self).branchmap() + return self.filtered(topicfilter).branchmap() + def branchheads(self, branch=None, start=None, closed=False): if branch is None: branch = self[None].branch() @@ -613,6 +623,10 @@ def branchmap(self): usetopic = not self._repo.publishing() return self._repo.branchmap(topic=usetopic, convertbm=usetopic) + + def branchmaptns(self): + usetopic = not self._repo.publishing() + return self._repo.branchmaptns(topic=usetopic) peer.__class__ = topicpeer return peer