def write_pack_index_v1(f, entries, pack_checksum):
 f = SHA1Writer(f)
 fan_out_table = defaultdict((lambda : 0))
 for (name, offset, entry_checksum) in entries:
  fan_out_table[ord(name[:1])] += 1
 for i in range(256):
  f.write(struct.pack('>L', fan_out_table[i]))
  fan_out_table[(i + 1)] += fan_out_table[i]
 for (name, offset, entry_checksum) in entries:
  if (not (offset <= 4294967295)):
   raise TypeError('pack format 1 only supports offsets < 2Gb')
  f.write(struct.pack('>L20s', offset, name))
 assert (len(pack_checksum) == 20)
 f.write(pack_checksum)
 return f.write_sha()

def write_pack_index_v1 ( f , entries , pack_checksum ) : f = SHA1Writer ( f ) fan_out_table = defaultdict ( ( lambda : 0 ) ) for ( name , offset , entry_checksum ) in entries : fan_out_table [ ord ( name [ : 1 ] ) ] += 1 for i in range ( 256 ) : f . write ( struct . pack ( '>L' , fan_out_table [ i ] ) ) fan_out_table [ ( i + 1 ) ] += fan_out_table [ i ] for ( name , offset , entry_checksum ) in entries : if ( not ( offset <= 4294967295 ) ) : raise TypeError ( 'pack format 1 only supports offsets < 2Gb' ) f . write ( struct . pack ( '>L20s' , offset , name ) ) assert ( len ( pack_checksum ) == 20 ) f . write ( pack_checksum ) return f . write_sha ( )
write a new pack index file .