hgext/evolve.py
changeset 1079 e8f49b32e95b
parent 1078 5717d023da63
child 1080 41d2555141ea
equal deleted inserted replaced
1078:5717d023da63 1079:e8f49b32e95b
  2403     def __iter__(self):
  2403     def __iter__(self):
  2404         d = self.read(4096)
  2404         d = self.read(4096)
  2405         while d:
  2405         while d:
  2406             yield d
  2406             yield d
  2407             d = self.read(4096)
  2407             d = self.read(4096)
  2408 
       
  2409 def _obsmarkersdiscovery(pushop):
       
  2410     """return the list of marker that needs to be pushed to the server
       
  2411 
       
  2412     When used before (or at the same time) the changegroup have been pushed, it
       
  2413     returns the value as if the planned changegroup was succesful. Othewise it
       
  2414     use te actual common heads to decide whats needs to be pushed.
       
  2415     """
       
  2416     repo = pushop.repo
       
  2417     remote = pushop.remote
       
  2418     unfi = repo.unfiltered()
       
  2419     cl = unfi.changelog
       
  2420     commonheads = pushop.commonheads
       
  2421     if commonheads is None:
       
  2422         if pushop.revs is None:
       
  2423             commonheads = pushop.outgoing.commonheads
       
  2424             sch = set(commonheads)
       
  2425             commonheads.extend(h for h in pushop.outgoing.missingheads
       
  2426                                if h not in sch)
       
  2427         else:
       
  2428             commonheads = pushop.outgoing.missingheads
       
  2429     if (obsolete._enabled and repo.obsstore and
       
  2430         'obsolete' in remote.listkeys('namespaces')):
       
  2431         obsexcmsg(repo.ui, "computing relevant nodes\n")
       
  2432         revs = unfi.revs('::%ln', commonheads)
       
  2433         common = []
       
  2434         if remote.capable('_evoext_obshash_0'):
       
  2435             obsexcmsg(repo.ui, "looking for common markers in %i nodes\n"
       
  2436                                % len(revs))
       
  2437             common = findcommonobsmarkers(pushop.ui, unfi, remote, revs)
       
  2438             revs = list(unfi.revs('%ld - (::%ln)', revs, common))
       
  2439         nodes = [cl.node(r) for r in revs]
       
  2440         if nodes:
       
  2441             obsexcmsg(repo.ui, "computing markers relevant to %i nodes\n"
       
  2442                                % len(nodes))
       
  2443             markers = repo.obsstore.relevantmarkers(nodes)
       
  2444         else:
       
  2445             obsexcmsg(repo.ui, "markers already in sync\n")
       
  2446             markers = []
       
  2447         return markers
       
  2448 
  2408 
  2449 @eh.wrapfunction(exchange, '_pushobsolete')
  2409 @eh.wrapfunction(exchange, '_pushobsolete')
  2450 def _pushobsolete(orig, pushop):
  2410 def _pushobsolete(orig, pushop):
  2451     """utility function to push obsolete markers to a remote"""
  2411     """utility function to push obsolete markers to a remote"""
  2452     stepsdone = getattr(pushop, 'stepsdone', None)
  2412     stepsdone = getattr(pushop, 'stepsdone', None)