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

Remove unnecessary indirection.

Changeset 4f730ba2f61d

Parent b91ee1c3222b

by Jelmer Vernooij

Changes to one file · Browse files at 4f730ba2f61d Showing diff from parent b91ee1c3222b Diff from another changeset...

 
20
21
22
23
24
25
26
 
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
 
430
431
432
433
 
 
 
 
 
 
 
 
 
 
 
434
435
436
 
20
21
22
 
23
24
25
 
311
312
313
 
 
 
 
 
 
 
 
 
 
 
 
 
314
315
316
 
416
417
418
 
419
420
421
422
423
424
425
426
427
428
429
430
431
432
@@ -20,7 +20,6 @@
 """Git object store interfaces and implementation."""     -import errno  import itertools  import os  import stat @@ -312,19 +311,6 @@
  return ShaFile.from_file(path)   return None   - def _add_shafile(self, sha, o): - dir = os.path.join(self.path, sha[:2]) - if not os.path.isdir(dir): - os.mkdir(dir) - path = os.path.join(dir, sha[2:]) - if os.path.exists(path): - return # Already there, no need to write again - f = GitFile(path, 'wb') - try: - f.write(o.as_legacy_object()) - finally: - f.close() -   def get_raw(self, name):   """Obtain the raw text for an object.   @@ -430,7 +416,17 @@
    :param obj: Object to add   """ - self._add_shafile(obj.id, obj) + dir = os.path.join(self.path, obj.id[:2]) + if not os.path.isdir(dir): + os.mkdir(dir) + path = os.path.join(dir, obj.id[2:]) + if os.path.exists(path): + return # Already there, no need to write again + f = GitFile(path, 'wb') + try: + f.write(obj.as_legacy_object()) + finally: + f.close()     def add_objects(self, objects):   """Add a set of objects to this object store.