예제 #1
0
 def addTree(self, tree, path, snapshot):
     """
     Recursively traverses the git tree
     """
     # todo: don't add metadir to assets
     for entry in tree:
         try:
             obj = self.repo[entry.id]
         except:
             print "bad id?", entry.id
             continue
         if obj.type == GIT_OBJ_TREE:
             self.addTree(obj, os.path.join(path, entry.name), snapshot)
         elif obj.type == GIT_OBJ_BLOB:
             name = os.path.join(path, entry.name)
             if name in self.assets:
                 asset = self.assets[name]
                 asset.addVersion(snapshot.commit.id, obj.id)
             else:
                 xid = genxid(snapshot.commit.id, obj.id)
                 asset = Asset()
                 asset.configure(snapshot.commit.id, obj.id, xid, name,
                                 self.repoDir)
                 self.assets[name] = asset
             snapshot.add(asset)
예제 #2
0
파일: guild.py 프로젝트: Nomicoin/viki
 def genxid(self):
     """
     The project xid is generated from the first commit and tree sha's
     """
     walker = self.repo.walk(self.repo.head.target, GIT_SORT_TIME | GIT_SORT_REVERSE)
     commit = walker.next()
     xid = genxid(commit.id, commit.tree.id)
     return str(xid)
예제 #3
0
 def genxid(self):
     """
     The project xid is generated from the first commit and tree sha's
     """
     walker = self.repo.walk(self.repo.head.target,
                             GIT_SORT_TIME | GIT_SORT_REVERSE)
     commit = walker.next()
     xid = genxid(commit.id, commit.tree.id)
     return str(xid)
예제 #4
0
파일: guild.py 프로젝트: Nomicoin/viki
 def addTree(self, tree, path, snapshot):
     """
     Recursively traverses the git tree
     """
     # todo: don't add metadir to assets
     for entry in tree:
         try:
             obj = self.repo[entry.id]
         except:
             print "bad id?", entry.id
             continue
         if obj.type == GIT_OBJ_TREE:
             self.addTree(obj, os.path.join(path, entry.name), snapshot)
         elif obj.type == GIT_OBJ_BLOB:
             name = os.path.join(path, entry.name)
             if name in self.assets:
                 asset = self.assets[name]
                 asset.addVersion(snapshot.commit.id, obj.id)
             else:
                 xid = genxid(snapshot.commit.id, obj.id)
                 asset = Asset()
                 asset.configure(snapshot.commit.id, obj.id, xid, name, self.repoDir)
                 self.assets[name] = asset
             snapshot.add(asset)