def all_commit_ids(self): """Return a list of commit ids, starting with the head(s) and ending with the root (first commit) of the tree. """ graph = {} to_visit = [self._hg[hd] for hd in self._hg.heads()] while to_visit: obj = to_visit.pop() if obj.hex() in graph: continue parents = self.real_parents(obj) graph[obj.hex()] = set(p.hex() for p in parents if p.hex() != obj.hex()) to_visit += parents return reversed([ci for ci in topological_sort(graph)])
def new_commits(self, all_commits=False): graph = {} to_visit = [ self._git.commit(rev=hd.object_id) for hd in self.heads ] while to_visit: obj = to_visit.pop() if obj.hexsha in graph: continue if not all_commits: # Look up the object if M.repo.Commit.query.find(dict(_id=obj.hexsha)).count(): graph[obj.hexsha] = set() # mark as parentless continue graph[obj.hexsha] = set(p.hexsha for p in obj.parents) to_visit += obj.parents return list(topological_sort(graph))
def new_commits(self, all_commits=False): graph = {} to_visit = [ self._git.commit(rev=hd.object_id) for hd in self._repo.heads ] while to_visit: obj = to_visit.pop() if obj.hexsha in graph: continue if not all_commits: # Look up the object if M.repo.Commit.query.find(dict(_id=obj.hexsha)).count(): graph[obj.hexsha] = set() # mark as parentless continue graph[obj.hexsha] = set(p.hexsha for p in obj.parents) to_visit += obj.parents return list(topological_sort(graph))
def all_commit_ids(self): """Return a list of commit ids, starting with the head(s) and ending with the root (first commit) of the tree. """ graph = {} to_visit = [ self._hg[hd] for hd in self._hg.heads() ] while to_visit: obj = to_visit.pop() if obj.hex() in graph: continue parents = self.real_parents(obj) graph[obj.hex()] = set( p.hex() for p in parents if p.hex() != obj.hex()) to_visit += parents return reversed([ ci for ci in topological_sort(graph) ])
def new_commits(self, all_commits=False): graph = {} to_visit = [self._hg[hd] for hd in self._hg.heads()] while to_visit: obj = to_visit.pop() if obj.hex() in graph: continue if not all_commits: # Look up the object if M.repo.Commit.query.find(dict(_id=obj.hex())).count(): graph[obj.hex()] = set() # mark as parentless continue parents = self.real_parents(obj) graph[obj.hex()] = set(p.hex() for p in parents if p.hex() != obj.hex()) to_visit += parents return list(topological_sort(graph))
def all_commit_ids(self): """Return a list of commit ids, starting with the root (first commit) of the tree and ending with the head(s). NB: The ForgeGit implementation returns commits in the opposite order. """ graph = {} to_visit = [self._hg[hd] for hd in self._hg.heads()] while to_visit: obj = to_visit.pop() if obj.hex() in graph: continue parents = self.real_parents(obj) graph[obj.hex()] = set(p.hex() for p in parents if p.hex() != obj.hex()) to_visit += parents return [ci for ci in topological_sort(graph)]
def new_commits(self, all_commits=False): graph = {} to_visit = [ self._hg[hd] for hd in self._hg.heads() ] while to_visit: obj = to_visit.pop() if obj.hex() in graph: continue if not all_commits: # Look up the object if M.repo.Commit.query.find(dict(_id=obj.hex())).count(): graph[obj.hex()] = set() # mark as parentless continue parents = self.real_parents(obj) graph[obj.hex()] = set( p.hex() for p in parents if p.hex() != obj.hex()) to_visit += parents return list(topological_sort(graph))