Exemple #1
0
 def _mksubs(self):
     self._subs = {}
     it = cp().get(self.hash.encode('hex'))
     type = it.next()
     if type == 'commit':
         del it
         it = cp().get(self.hash.encode('hex') + ':')
         type = it.next()
     assert(type == 'tree')
     for (mode,mangled_name,sha) in git.treeparse(''.join(it)):
         mode = int(mode, 8)
         name = mangled_name
         (name,bupmode) = git.demangle_name(mangled_name)
         if bupmode == git.BUP_CHUNKED:
             mode = 0100644
         if stat.S_ISDIR(mode):
             self._subs[name] = Dir(self, name, mode, sha)
         elif stat.S_ISLNK(mode):
             self._subs[name] = Symlink(self, name, sha, bupmode)
         else:
             self._subs[name] = File(self, name, mode, sha, bupmode)
Exemple #2
0
def _treeget(hash):
    it = cp().get(hash.encode('hex'))
    type = it.next()
    assert(type == 'tree')
    return git.treeparse(''.join(it))