Esempio n. 1
0
 def _get_loose_object(self, sha):
     path = self._get_shafile_path(sha)
     try:
         return ShaFile.from_path(path)
     except (OSError, IOError), e:
         if e.errno == errno.ENOENT:
             return None
         raise
Esempio n. 2
0
 def _get_loose_object(self, sha):
     path = self._get_shafile_path(sha)
     try:
         return ShaFile.from_path(path)
     except (OSError, IOError), e:
         if e.errno == errno.ENOENT:
             return None
         raise
Esempio n. 3
0
 def __getitem__(self, sha):
     """Obtain an object by SHA1."""
     type_num, uncomp = self.get_raw(sha)
     return ShaFile.from_raw_string(type_num, uncomp)
Esempio n. 4
0
 def iterobjects(self):
     """Iterate over the objects in this pack."""
     for offset, type, obj, crc32 in self.data.iterobjects():
         assert isinstance(offset, int)
         yield ShaFile.from_raw_chunks(
           *self.data.resolve_object(offset, type, obj))
Esempio n. 5
0
 def __getitem__(self, sha1):
     """Retrieve the specified SHA1."""
     type, uncomp = self.get_raw(sha1)
     return ShaFile.from_raw_string(type, uncomp)
Esempio n. 6
0
 def __getitem__(self, sha):
     """Obtain an object by SHA1."""
     type_num, uncomp = self.get_raw(sha)
     return ShaFile.from_raw_string(type_num, uncomp)