瀏覽代碼

make num_records argument to write_pack-data optional.

Jelmer Vernooij 3 年之前
父節點
當前提交
0502730b13
共有 2 個文件被更改,包括 3 次插入3 次删除
  1. 1 1
      dulwich/bundle.py
  2. 2 2
      dulwich/pack.py

+ 1 - 1
dulwich/bundle.py

@@ -119,4 +119,4 @@ def write_bundle(f, bundle):
     for ref, obj_id in bundle.references.items():
         f.write(b"%s %s\n" % (obj_id, ref))
     f.write(b"\n")
-    write_pack_data(f, len(bundle.pack_data), iter(bundle.pack_data))
+    write_pack_data(f, records=bundle.pack_data)

+ 2 - 2
dulwich/pack.py

@@ -1714,12 +1714,12 @@ def write_pack_objects(
     )
 
 
-def write_pack_data(f, num_records, records, progress=None, compression_level=-1):
+def write_pack_data(f, num_records=None, records=None, progress=None, compression_level=-1):
     """Write a new pack data file.
 
     Args:
       f: File to write to
-      num_records: Number of records
+      num_records: Number of records (defaults to len(records) if None)
       records: Iterator over type_num, object_id, delta_base, raw
       progress: Function to report progress to
       compression_level: the zlib compression level