obsdiscovery: extract '_canobshashtree'
authorPierre-Yves David <pierre-yves.david@octobus.net>
Tue, 30 May 2017 12:32:14 +0200
changeset 2510 b99b83728ea3
parent 2509 6da129b2b440
child 2511 4c0b10d73f5f
obsdiscovery: extract '_canobshashtree' having this as a simple function will help use to generalise the obsdiscovery algorithm we use.
hgext3rd/evolve/obsdiscovery.py
--- a/hgext3rd/evolve/obsdiscovery.py	Tue May 30 12:26:57 2017 +0200
+++ b/hgext3rd/evolve/obsdiscovery.py	Tue May 30 12:32:14 2017 +0200
@@ -703,6 +703,9 @@
 # the obshash of its parents.  This is similar to what happend for changeset
 # node where the parent is used in the computation
 
+def _canobshashtree(repo, remote):
+    return remote.capable('_evoext_obshash_0')
+
 @eh.command(
     'debugobsrelsethashtree',
     [('', 'v0', None, 'hash on marker format "0"'),
@@ -855,7 +858,7 @@
         revs = list(repo.revs('::%ln', pushop.futureheads))
         unfi = repo.unfiltered()
         cl = unfi.changelog
-        if not pushop.remote.capable('_evoext_obshash_0'):
+        if not _canobshashtree(repo, pushop.remote):
             return orig(pushop)
 
         common = []