Mercurial > hg-git
changeset 787:6bf8f8b3cc37
git_handler.get_git_incoming: explicitly use the Git object store
This is preparation for moving most of the code here out into a separate
module. With this patch, we can avoid passing in the entire Repo object and
just pass in the object store to the factored out function.
author | Siddharth Agarwal <sid0@fb.com> |
---|---|
date | Wed, 15 Oct 2014 16:41:17 -0700 |
parents | 3c3a6505ef8d |
children | e734d71cc558 |
files | hggit/git_handler.py |
diffstat | 1 files changed, 7 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/hggit/git_handler.py Wed Oct 15 16:35:53 2014 -0700 +++ b/hggit/git_handler.py Wed Oct 15 16:41:17 2014 -0700 @@ -663,6 +663,8 @@ def get_git_incoming(self, refs): if refs is None: refs = self.git.refs.as_dict() + git_object_store = self.git.object_store + # import heads and fetched tags as remote references todo = [] done = set() @@ -674,18 +676,18 @@ for sha in refs.itervalues(): # refs contains all the refs in the server, not just the ones # we are pulling - if sha in self.git.object_store: - obj = self.git.get_object(sha) + if sha in git_object_store: + obj = git_object_store[sha] while isinstance(obj, Tag): obj_type, sha = obj.object - obj = self.git.get_object(sha) + obj = git_object_store[sha] if isinstance (obj, Commit) and sha not in seenheads: seenheads.add(sha) todo.append(sha) # sort by commit date def commitdate(sha): - obj = self.git.get_object(sha) + obj = git_object_store[sha] return obj.commit_time-obj.commit_timezone todo.sort(key=commitdate, reverse=True) @@ -703,7 +705,7 @@ if sha in commit_cache: obj = commit_cache[sha] else: - obj = self.git.get_object(sha) + obj = git_object_store[sha] commit_cache[sha] = obj assert isinstance(obj, Commit) for p in obj.parents: