obsdiscovery: factor the "do we push markers" check out
authorPierre-Yves David <pierre-yves.david@octobus.net>
Tue, 30 May 2017 12:13:14 +0200
changeset 2507 de6c61462e67
parent 2506 747dc7067751
child 2508 45abd0586c73
obsdiscovery: factor the "do we push markers" check out This clarify the code a bit.
hgext3rd/evolve/obsdiscovery.py
--- a/hgext3rd/evolve/obsdiscovery.py	Tue May 30 11:55:58 2017 +0200
+++ b/hgext3rd/evolve/obsdiscovery.py	Tue May 30 12:13:14 2017 +0200
@@ -76,11 +76,17 @@
 ###  trigger discovery during exchange ###
 ##########################################
 
+def _dopushmarkers(pushop):
+    return (# we have any markers to push
+            pushop.repo.obsstore
+            # exchange of obsmarkers is enabled locally
+            and obsolete.isenabled(pushop.repo, obsolete.exchangeopt)
+            # remote server accept markers
+            and 'obsolete' in pushop.remote.listkeys('namespaces'))
+
 @eh.wrapfunction(exchange, '_pushdiscoveryobsmarkers')
 def _pushdiscoveryobsmarkers(orig, pushop):
-    if (obsolete.isenabled(pushop.repo, obsolete.exchangeopt)
-        and pushop.repo.obsstore
-        and 'obsolete' in pushop.remote.listkeys('namespaces')):
+    if _dopushmarkers(pushop):
         repo = pushop.repo
         obsexcmsg(repo.ui, "computing relevant nodes\n")
         revs = list(repo.revs('::%ln', pushop.futureheads))