diff hgext3rd/topic/__init__.py @ 1903:58cdf061d49a

topic: don't take topic into account when pushing to non-topic repo Previously, pushing to a non-publishing repository without topic support would wrongfully use topic when searching for new heads.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Tue, 15 Mar 2016 17:26:57 +0000
parents 85390446f8c1
children f52c02bf47b7
line wrap: on
line diff
--- a/hgext3rd/topic/__init__.py	Wed Mar 16 12:14:20 2016 -0700
+++ b/hgext3rd/topic/__init__.py	Tue Mar 15 17:26:57 2016 +0000
@@ -94,6 +94,12 @@
     if not isinstance(repo, localrepo.localrepository):
         return # this can be a peer in the ssh case (puzzling)
     class topicrepo(repo.__class__):
+
+        def _restrictcapabilities(self, caps):
+            caps = super(topicrepo, self)._restrictcapabilities(caps)
+            caps.add('topics')
+            return caps
+
         def commit(self, *args, **kwargs):
             backup = self.ui.backupconfig('ui', 'allowemptycommit')
             try:
@@ -324,6 +330,7 @@
 extensions.wrapfunction(merge, 'update', mergeupdatewrap)
 extensions.wrapfunction(discoverymod, '_headssummary', discovery._headssummary)
 extensions.wrapfunction(wireproto, 'branchmap', discovery.wireprotobranchmap)
+extensions.wrapfunction(wireproto, '_capabilities', discovery.wireprotocaps)
 extensions.wrapfunction(bundle2, 'handlecheckheads', discovery.handlecheckheads)
 bundle2.handlecheckheads.params = frozenset() # we need a proper wrape b2 part stuff
 bundle2.parthandlermapping['check:heads'] = bundle2.handlecheckheads