示例#1
0
 def gc_action(sha, obj):
     idx[sha] = off[0]
     t = babygit.obj_type(obj)
     s = babygit.obj_size(obj)
     enc_t_s = self.encode_type_and_size(t, s)
     pack.write(enc_t_s)
     off[0] += len(enc_t_s)
     compressed = zlib.compress(babygit.obj_contents(obj))
     pack.write(compressed)
     off[0] += len(compressed)
示例#2
0
文件: web.py 项目: jkingdon/ghilbert
 def gc_action(sha, obj):
     idx[sha] = off[0]
     t = babygit.obj_type(obj)
     s = babygit.obj_size(obj)
     enc_t_s = self.encode_type_and_size(t, s)
     pack.write(enc_t_s)
     off[0] += len(enc_t_s)
     compressed = zlib.compress(babygit.obj_contents(obj))
     pack.write(compressed)
     off[0] += len(compressed)
示例#3
0
 def send_packfile(self, objs, out):
     m = hashlib.sha1()
     header = 'PACK' + struct.pack('>II', 2, len(objs))
     out.write(header)
     m.update(header)
     for ref, obj in objs:
         t = babygit.obj_type(obj)
         s = babygit.obj_size(obj)
         #if s != len(babygit.obj_contents(obj)):
         #    logging.debug('size mismatch')
         enc_t_s = self.encode_type_and_size(t, s)
         out.write(enc_t_s)
         m.update(enc_t_s)
         compressed = zlib.compress(babygit.obj_contents(obj))
         out.write(compressed)
         m.update(compressed)
     out.write(m.digest())
示例#4
0
文件: web.py 项目: jkingdon/ghilbert
 def send_packfile(self, objs, out):
     m = hashlib.sha1()
     header = 'PACK' + struct.pack('>II', 2, len(objs))
     out.write(header)
     m.update(header)
     for ref, obj in objs:
         t = babygit.obj_type(obj)
         s = babygit.obj_size(obj)
         #if s != len(babygit.obj_contents(obj)):
         #    logging.debug('size mismatch')
         enc_t_s = self.encode_type_and_size(t, s)
         out.write(enc_t_s)
         m.update(enc_t_s)
         compressed = zlib.compress(babygit.obj_contents(obj))
         out.write(compressed)
         m.update(compressed)
     out.write(m.digest())