Kiln » Dependencies » Dulwich Read More
Clone URL:  
Pushed to one repository · View In Graph Contained in master

Fix open modes of e.g. packs to be binary.

Changeset 75bcd5035147

Parent 879786c01f9e

by Jelmer Vernooij

Changes to 4 files · Browse files at 75bcd5035147 Showing diff from parent 879786c01f9e Diff from another changeset...

Change 1 of 1 Show Entire File NEWS Stacked
 
1
 
 
 
 
 
 
2
3
4
 
1
2
3
4
5
6
7
8
9
10
@@ -1,4 +1,10 @@
 0.3.2 UNRELEASED + + BUG FIXES + + * Support the encoding field in Commits. + + * Some Windows compatibility fixes.    0.3.1 2009-05-13  
 
287
288
289
290
 
291
292
293
 
302
303
304
305
 
306
307
308
 
287
288
289
 
290
291
292
293
 
302
303
304
 
305
306
307
308
@@ -287,7 +287,7 @@
  in a different pack.   """   fd, path = tempfile.mkstemp(dir=self.pack_dir, suffix=".pack") - f = os.fdopen(fd, 'w') + f = os.fdopen(fd, 'wb')   def commit():   os.fsync(fd)   f.close() @@ -302,7 +302,7 @@
  call when the pack is finished.   """   fd, path = tempfile.mkstemp(dir=self.pack_dir, suffix=".pack") - f = os.fdopen(fd, 'w') + f = os.fdopen(fd, 'wb')   def commit():   os.fsync(fd)   f.close()
Change 1 of 5 Show Entire File dulwich/​pack.py Stacked
 
123
124
125
126
 
127
128
129
 
176
177
178
179
 
180
181
182
 
754
755
756
757
 
758
759
760
 
818
819
820
821
 
822
823
824
 
966
967
968
969
 
970
971
972
 
123
124
125
 
126
127
128
129
 
176
177
178
 
179
180
181
182
 
754
755
756
 
757
758
759
760
 
818
819
820
 
821
822
823
824
 
966
967
968
 
969
970
971
972
@@ -123,7 +123,7 @@
     def load_pack_index(filename): - f = open(filename, 'r') + f = open(filename, 'rb')   if f.read(4) == '\377tOc':   version = struct.unpack(">L", f.read(4))[0]   if version == 2: @@ -176,7 +176,7 @@
  # ensure that it hasn't changed.   self._size = os.path.getsize(filename)   if file is None: - self._file = open(filename, 'r') + self._file = open(filename, 'rb')   else:   self._file = file   self._contents, map_offset = simple_mmap(self._file, 0, self._size) @@ -754,7 +754,7 @@
  :param objects: Iterable over (object, path) tuples to write   :param num_objects: Number of objects to write   """ - f = open(filename + ".pack", 'w') + f = open(filename + ".pack", 'wb')   try:   entries, data_sum = write_pack_data(f, objects, num_objects)   finally: @@ -818,7 +818,7 @@
  crc32_checksum.   :param pack_checksum: Checksum of the pack file.   """ - f = open(filename, 'w') + f = open(filename, 'wb')   f = SHA1Writer(f)   fan_out_table = defaultdict(lambda: 0)   for (name, offset, entry_checksum) in entries: @@ -966,7 +966,7 @@
  crc32_checksum.   :param pack_checksum: Checksum of the pack file.   """ - f = open(filename, 'w') + f = open(filename, 'wb')   f = SHA1Writer(f)   f.write('\377tOc') # Magic!   f.write(struct.pack(">L", 2))
Change 1 of 2 Show Entire File dulwich/​repo.py Stacked
 
146
147
148
149
 
150
151
152
 
390
391
392
393
394
 
 
395
396
397
 
146
147
148
 
149
150
151
152
 
390
391
392
 
 
393
394
395
396
397
@@ -146,7 +146,7 @@
  dirpath = os.path.dirname(file)   if not os.path.exists(dirpath):   os.makedirs(dirpath) - f = open(file, 'w') + f = open(file, 'wb')   try:   f.write(ref+"\n")   finally: @@ -390,8 +390,8 @@
  os.mkdir(os.path.join(path, *d))   ret = cls(path)   ret.refs.set_ref("HEAD", "refs/heads/master") - open(os.path.join(path, 'description'), 'w').write("Unnamed repository") - open(os.path.join(path, 'info', 'excludes'), 'w').write("") + open(os.path.join(path, 'description'), 'wb').write("Unnamed repository") + open(os.path.join(path, 'info', 'excludes'), 'wb').write("")   return ret     create = init_bare