Mercurial > hg > hg-git
changeset 655:baba2cf03d41
git_handler: terminate new commit DAG traversal at known commits
Any commit in _map_git is already known, so there's no point walking further
down the DAG.
For a repo with over 50,000 commits, this brings down a no-op hg pull from 38
seconds to 2.5.
author | Siddharth Agarwal <sid0@fb.com> |
---|---|
date | Tue, 18 Feb 2014 20:30:27 -0800 |
parents | f221c7b5bdfb |
children | 0a39005cbdc8 |
files | hggit/git_handler.py |
diffstat | 1 files changed, 3 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/hggit/git_handler.py +++ b/hggit/git_handler.py @@ -616,7 +616,7 @@ seen = set(todo) while todo: sha = todo[-1] - if sha in done: + if sha in done or sha in self._map_git: todo.pop() continue assert isinstance(sha, str) @@ -627,7 +627,7 @@ convert_list[sha] = obj assert isinstance(obj, Commit) for p in obj.parents: - if p not in done: + if p not in done and p not in self._map_git: todo.append(p) # process parents of a commit before processing the # commit itself, and come back to this commit later @@ -637,7 +637,7 @@ done.add(sha) todo.pop() - return convert_list, [commit for commit in commits if not commit in self._map_git] + return convert_list, commits def import_git_objects(self, remote_name=None, refs=None): convert_list, commits = self.getnewgitcommits(refs)