changeset 2507:de6c61462e67

obsdiscovery: factor the "do we push markers" check out This clarify the code a bit.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Tue, 30 May 2017 12:13:14 +0200
parents 747dc7067751
children 45abd0586c73
files hgext3rd/evolve/obsdiscovery.py
diffstat 1 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- 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))