# HG changeset patch # User Siddharth Agarwal <sid0@fb.com> # Date 1413416477 25200 # Wed Oct 15 16:41:17 2014 -0700 # Node ID 6bf8f8b3cc3795d3a75f4e1aa34f6769df1ce066 # Parent 3c3a6505ef8dbe538750d1c70c4471e2f1cddc21 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. diff --git a/hggit/git_handler.py b/hggit/git_handler.py --- a/hggit/git_handler.py +++ b/hggit/git_handler.py @@ -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: