comparison hgext/evolve.py @ 1078:5717d023da63

obsexc: use the common discovery We drop the hand made discovery and rely on the general one introduced some time ago.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Wed, 27 Aug 2014 17:09:36 +0200
parents cdfc19f25478
children e8f49b32e95b
comparison
equal deleted inserted replaced
1077:cdfc19f25478 1078:5717d023da63
2230 def _pushdiscoveryobsmarkers(orig, pushop): 2230 def _pushdiscoveryobsmarkers(orig, pushop):
2231 if (obsolete._enabled 2231 if (obsolete._enabled
2232 and pushop.repo.obsstore 2232 and pushop.repo.obsstore
2233 and 'obsolete' in pushop.remote.listkeys('namespaces')): 2233 and 'obsolete' in pushop.remote.listkeys('namespaces')):
2234 repo = pushop.repo 2234 repo = pushop.repo
2235 obsexcmsg(repo.ui, "computing relevant nodes\n")
2235 revs = list(repo.revs('::%ln', pushop.futureheads)) 2236 revs = list(repo.revs('::%ln', pushop.futureheads))
2236 unfi = repo.unfiltered() 2237 unfi = repo.unfiltered()
2237 cl = unfi.changelog 2238 cl = unfi.changelog
2238 if not pushop.remote.capable('_evoext_obshash_0'): 2239 if not pushop.remote.capable('_evoext_obshash_0'):
2239 # do not trust core yet 2240 # do not trust core yet
2240 # return orig(pushop) 2241 # return orig(pushop)
2241 nodes = [cl.node(r) for r in revs] 2242 nodes = [cl.node(r) for r in revs]
2242 pushop.outobsmarkers = repo.obsstore.relevantmarkers(nodes) 2243 if nodes:
2244 obsexcmsg(repo.ui, "computing markers relevant to %i nodes\n"
2245 % len(nodes))
2246 pushop.outobsmarkers = repo.obsstore.relevantmarkers(nodes)
2247 else:
2248 obsexcmsg(repo.ui, "markers already in sync\n")
2249 pushop.outobsmarkers = []
2250 pushop.outobsmarkers = repo.obsstore.relevantmarkers(nodes)
2243 return 2251 return
2244 2252
2245 common = [] 2253 common = []
2246 obsexcmsg(repo.ui, "looking for common markers in %i nodes\n" 2254 obsexcmsg(repo.ui, "looking for common markers in %i nodes\n"
2247 % len(revs)) 2255 % len(revs))
2248 commonrevs = list(unfi.revs('::%ln', pushop.outgoing.commonheads)) 2256 commonrevs = list(unfi.revs('::%ln', pushop.outgoing.commonheads))
2249 common = findcommonobsmarkers(pushop.ui, unfi, pushop.remote, commonrevs) 2257 common = findcommonobsmarkers(pushop.ui, unfi, pushop.remote, commonrevs)
2250 2258
2251 revs = list(unfi.revs('%ld - (::%ln)', revs, common)) 2259 revs = list(unfi.revs('%ld - (::%ln)', revs, common))
2252 nodes = [cl.node(r) for r in revs] 2260 nodes = [cl.node(r) for r in revs]
2253 pushop.outobsmarkers = repo.obsstore.relevantmarkers(nodes) 2261 if nodes:
2262 obsexcmsg(repo.ui, "computing markers relevant to %i nodes\n"
2263 % len(nodes))
2264 pushop.outobsmarkers = repo.obsstore.relevantmarkers(nodes)
2265 else:
2266 obsexcmsg(repo.ui, "markers already in sync\n")
2267 pushop.outobsmarkers = []
2254 2268
2255 @eh.wrapfunction(wireproto, 'capabilities') 2269 @eh.wrapfunction(wireproto, 'capabilities')
2256 def discocapabilities(orig, repo, proto): 2270 def discocapabilities(orig, repo, proto):
2257 """wrapper to advertise new capability""" 2271 """wrapper to advertise new capability"""
2258 caps = orig(repo, proto) 2272 caps = orig(repo, proto)
2447 remote = pushop.remote 2461 remote = pushop.remote
2448 unfi = repo.unfiltered() 2462 unfi = repo.unfiltered()
2449 cl = unfi.changelog 2463 cl = unfi.changelog
2450 if (obsolete._enabled and repo.obsstore and 2464 if (obsolete._enabled and repo.obsstore and
2451 'obsolete' in remote.listkeys('namespaces')): 2465 'obsolete' in remote.listkeys('namespaces')):
2452 markers = _obsmarkersdiscovery(pushop) 2466 markers = pushop.outobsmarkers
2453 if not markers: 2467 if not markers:
2454 obsexcmsg(repo.ui, "no marker to push\n") 2468 obsexcmsg(repo.ui, "no marker to push\n")
2455 elif remote.capable('_evoext_b2x_obsmarkers_0'): 2469 elif remote.capable('_evoext_b2x_obsmarkers_0'):
2456 obsdata = pushobsmarkerStringIO() 2470 obsdata = pushobsmarkerStringIO()
2457 _encodemarkersstream(obsdata, markers) 2471 _encodemarkersstream(obsdata, markers)