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

Ask for forgiveness, not permission.

Changeset e1ee3e263e1e

Parent 634b2cd1f061

by Jelmer Vernooij

Changes to one file · Browse files at e1ee3e263e1e Showing diff from parent 634b2cd1f061 Diff from another changeset...

 
20
21
22
 
23
24
25
 
333
334
335
336
337
338
339
340
341
342
343
 
 
 
 
 
 
 
 
 
 
344
345
346
 
360
361
362
363
364
365
 
 
 
 
 
 
366
367
368
 
20
21
22
23
24
25
26
 
334
335
336
 
 
337
 
 
 
 
 
338
339
340
341
342
343
344
345
346
347
348
349
350
 
364
365
366
 
 
 
367
368
369
370
371
372
373
374
375
@@ -20,6 +20,7 @@
 """Git object store interfaces and implementation."""     +import errno  import itertools  import os  import stat @@ -333,14 +334,17 @@
  self.pack_dir = os.path.join(self.path, PACKDIR)     def _load_packs(self): - if not os.path.exists(self.pack_dir): - return []   pack_files = [] - for name in os.listdir(self.pack_dir): - # TODO: verify that idx exists first - if name.startswith("pack-") and name.endswith(".pack"): - filename = os.path.join(self.pack_dir, name) - pack_files.append((os.stat(filename).st_mtime, filename)) + try: + for name in os.listdir(self.pack_dir): + # TODO: verify that idx exists first + if name.startswith("pack-") and name.endswith(".pack"): + filename = os.path.join(self.pack_dir, name) + pack_files.append((os.stat(filename).st_mtime, filename)) + except OSError, e: + if e.errno == errno.ENOENT: + return [] + raise   pack_files.sort(reverse=True)   suffix_len = len(".pack")   return [Pack(f[:-suffix_len]) for _, f in pack_files] @@ -360,9 +364,12 @@
    def _get_loose_object(self, sha):   path = self._get_shafile_path(sha) - if os.path.exists(path): - return ShaFile.from_file(path) - return None + try: + return ShaFile.from_file(path) + except OSError, e: + if e.errno == errno.ENOENT: + return None + raise     def move_in_thin_pack(self, path):   """Move a specific file containing a pack into the pack directory.