hgext/evolve.py
changeset 1091 236a8e81551e
parent 1090 4a6479395a9d
child 1093 a49f2e7a2755
equal deleted inserted replaced
1090:4a6479395a9d 1091:236a8e81551e
  2335         return set([nullid])
  2335         return set([nullid])
  2336     return dag.externalizeall(result)
  2336     return dag.externalizeall(result)
  2337 
  2337 
  2338 
  2338 
  2339 _pushkeyescape = getattr(obsolete, '_pushkeyescape', None)
  2339 _pushkeyescape = getattr(obsolete, '_pushkeyescape', None)
  2340 def _encodemarkersstream(fp, markers):
       
  2341     fp.write(_pack('>B', 0))
       
  2342     for mark in markers:
       
  2343         fp.write(obsolete._encodeonemarker(mark))
       
  2344 
  2340 
  2345 class pushobsmarkerStringIO(StringIO):
  2341 class pushobsmarkerStringIO(StringIO):
  2346     """hacky string io for progress"""
  2342     """hacky string io for progress"""
  2347 
  2343 
  2348     @util.propertycache
  2344     @util.propertycache
  2379         markers = pushop.outobsmarkers
  2375         markers = pushop.outobsmarkers
  2380         if not markers:
  2376         if not markers:
  2381             obsexcmsg(repo.ui, "no marker to push\n")
  2377             obsexcmsg(repo.ui, "no marker to push\n")
  2382         elif remote.capable('_evoext_pushobsmarkers_0'):
  2378         elif remote.capable('_evoext_pushobsmarkers_0'):
  2383             obsdata = pushobsmarkerStringIO()
  2379             obsdata = pushobsmarkerStringIO()
  2384             _encodemarkersstream(obsdata, markers)
  2380             for chunk in obsolete.encodemarkers(markers, True):
       
  2381                 obsdata.write(chunk)
  2385             obsdata.seek(0)
  2382             obsdata.seek(0)
  2386             obsdata.ui = repo.ui
  2383             obsdata.ui = repo.ui
  2387             obsexcmsg(repo.ui, "pushing %i obsolescence markers (%i bytes)\n"
  2384             obsexcmsg(repo.ui, "pushing %i obsolescence markers (%i bytes)\n"
  2388                                % (len(markers), len(obsdata.getvalue())),
  2385                                % (len(markers), len(obsdata.getvalue())),
  2389                       True)
  2386                       True)
  2576         revset += ' - (::%ln)'
  2573         revset += ' - (::%ln)'
  2577         args.append(common)
  2574         args.append(common)
  2578     nodes = [c.node() for c in repo.set(revset, *args)]
  2575     nodes = [c.node() for c in repo.set(revset, *args)]
  2579     markers = repo.obsstore.relevantmarkers(nodes)
  2576     markers = repo.obsstore.relevantmarkers(nodes)
  2580     obsdata = StringIO()
  2577     obsdata = StringIO()
  2581     _encodemarkersstream(obsdata, markers)
  2578     for chunk in obsolete.encodemarkers(markers, True):
       
  2579         obsdata.write(chunk)
  2582     obsdata.seek(0)
  2580     obsdata.seek(0)
  2583     return obsdata
  2581     return obsdata
  2584 
  2582 
  2585 @eh.addattr(wireproto.wirepeer, 'evoext_pullobsmarkers_0')
  2583 @eh.addattr(wireproto.wirepeer, 'evoext_pullobsmarkers_0')
  2586 def client_pullobsmarkers(self, heads=None, common=None):
  2584 def client_pullobsmarkers(self, heads=None, common=None):