comparison hgext3rd/topic/__init__.py @ 6548:445240ccb701

topic: add experimental.tns-default-pull-namespaces config option This config option controls what topic namespaces get pulled by default. The current default option is '*', which means all namespaces get pulled.
author Anton Shestakov <av6@dwimlabs.net>
date Thu, 27 Jul 2023 16:39:43 -0300
parents 7b2bd0332b56
children e45bfd1e0588
comparison
equal deleted inserted replaced
6547:d13cfd9eb6c0 6548:445240ccb701
277 # used for allowing users to rewrite history only in their "own" topic 277 # used for allowing users to rewrite history only in their "own" topic
278 # namespaces 278 # namespaces
279 configitem(b'experimental', b'tns-allow-rewrite', 279 configitem(b'experimental', b'tns-allow-rewrite',
280 default=configitems.dynamicdefault, 280 default=configitems.dynamicdefault,
281 ) 281 )
282 configitem(b'experimental', b'tns-default-pull-namespaces',
283 default=configitems.dynamicdefault,
284 )
282 configitem(b'experimental', b'topic-mode.server', 285 configitem(b'experimental', b'topic-mode.server',
283 default=configitems.dynamicdefault, 286 default=configitems.dynamicdefault,
284 ) 287 )
285 configitem(b'experimental', b'topic.server-gate-topic-changesets', 288 configitem(b'experimental', b'topic.server-gate-topic-changesets',
286 default=False, 289 default=False,
622 b'topic.publish-bare-branch'): 625 b'topic.publish-bare-branch'):
623 mode = b'auto' 626 mode = b'auto'
624 else: 627 else:
625 mode = b'none' 628 mode = b'none'
626 caps.add(b'ext-topics-publish=%s' % mode) 629 caps.add(b'ext-topics-publish=%s' % mode)
630 caps.add(b'ext-topics-tns-heads')
627 return caps 631 return caps
628 632
629 def commit(self, *args, **kwargs): 633 def commit(self, *args, **kwargs):
630 configoverride = util.nullcontextmanager() 634 configoverride = util.nullcontextmanager()
631 if self.currenttopic != self[b'.'].topic(): 635 if self.currenttopic != self[b'.'].topic():
738 return self._repo.branchmap(topic=usetopic, convertbm=usetopic) 742 return self._repo.branchmap(topic=usetopic, convertbm=usetopic)
739 743
740 def branchmaptns(self): 744 def branchmaptns(self):
741 usetopic = not self._repo.publishing() 745 usetopic = not self._repo.publishing()
742 return self._repo.branchmaptns(topic=usetopic) 746 return self._repo.branchmaptns(topic=usetopic)
747
748 def tns_heads(self, namespaces):
749 if b'*' in namespaces:
750 # pulling all topic namespaces, all changesets are visible
751 return self._repo.heads()
752 else:
753 # only changesets in the selected topic namespaces are visible
754 h = []
755 for branch, nodes in self._repo.branchmaptns().items():
756 namedbranch, tns, topic = common.parsefqbn(branch)
757 if tns == b'none' or tns in namespaces:
758 h.extend(nodes)
759 return h
743 peer.__class__ = topicpeer 760 peer.__class__ = topicpeer
744 return peer 761 return peer
745 762
746 def transaction(self, desc, *a, **k): 763 def transaction(self, desc, *a, **k):
747 ctr = self.currenttransaction() 764 ctr = self.currenttransaction()