def write_pack_data(f, num_records, records):
 entries = {}
 f = SHA1Writer(f)
 write_pack_header(f, num_records)
 for (type_num, object_id, delta_base, raw) in records:
  offset = f.offset()
  if (delta_base is not None):
   try:
    (base_offset, base_crc32) = entries[delta_base]
   except KeyError:
    type_num = REF_DELTA
    raw = (delta_base, raw)
   else:
    type_num = OFS_DELTA
    raw = ((offset - base_offset), raw)
  crc32 = write_pack_object(f, type_num, raw)
  entries[object_id] = (offset, crc32)
 return (entries, f.write_sha())

def write_pack_data ( f , num_records , records ) : entries = { } f = SHA1Writer ( f ) write_pack_header ( f , num_records ) for ( type_num , object_id , delta_base , raw ) in records : offset = f . offset ( ) if ( delta_base is not None ) : try : ( base_offset , base_crc32 ) = entries [ delta_base ] except KeyError : type_num = REF_DELTA raw = ( delta_base , raw ) else : type_num = OFS_DELTA raw = ( ( offset - base_offset ) , raw ) crc32 = write_pack_object ( f , type_num , raw ) entries [ object_id ] = ( offset , crc32 ) return ( entries , f . write_sha ( ) )
write a new pack data file .