diff hgext3rd/topic/discovery.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/discovery.py	Wed Mar 16 12:14:20 2016 -0700
+++ b/hgext3rd/topic/discovery.py	Tue Mar 15 17:26:57 2016 +0000
@@ -8,7 +8,7 @@
 def _headssummary(orig, repo, remote, outgoing):
     publishing = ('phases' not in remote.listkeys('namespaces')
                   or bool(remote.listkeys('phases').get('publishing', False)))
-    if publishing:
+    if publishing or not remote.capable('topics'):
         return orig(repo, remote, outgoing)
     oldgetitem = repo.__getitem__
     oldrepo = repo.__class__
@@ -102,5 +102,10 @@
         exchange._pushb2ctxcheckheads(pushop, bundler)
     return orig(pushop, bundler)
 
+def wireprotocaps(orig, repo, proto):
+    caps = orig(repo, proto)
+    if repo.peer().capable('topics'):
+        caps.append('topics')
+    return caps