mercurial/bundle2.py
changeset 20950 c7ceae0faf69
parent 20949 571f2903ff1e
child 20952 b24ee5076b94
equal deleted inserted replaced
20949:571f2903ff1e 20950:c7ceae0faf69
   139 
   139 
   140 import util
   140 import util
   141 import struct
   141 import struct
   142 import urllib
   142 import urllib
   143 import string
   143 import string
       
   144 import StringIO
   144 
   145 
   145 import changegroup
   146 import changegroup
   146 from i18n import _
   147 from i18n import _
   147 
   148 
   148 _pack = struct.pack
   149 _pack = struct.pack
   522             yield _pack(_fpayloadsize, len(self.data))
   523             yield _pack(_fpayloadsize, len(self.data))
   523             yield self.data
   524             yield self.data
   524         # end of payload
   525         # end of payload
   525         yield _pack(_fpayloadsize, 0)
   526         yield _pack(_fpayloadsize, 0)
   526 
   527 
       
   528 @parthandler('changegroup')
       
   529 def handlechangegroup(op, part):
       
   530     """apply a changegroup part on the repo
       
   531 
       
   532     This is a very early implementation that will massive rework before being
       
   533     inflicted to any end-user.
       
   534     """
       
   535     data = StringIO.StringIO(part.data)
       
   536     data.seek(0)
       
   537     cg = changegroup.readbundle(data, 'bundle2part')
       
   538     ret = changegroup.addchangegroup(op.repo, cg, 'bundle2', 'bundle2')
       
   539     op.records.add('changegroup', {'return': ret})
       
   540 
       
   541