changeset 789:77416ddca136

git2hg: return a struct from find_incoming We're going to return more data from find_incoming soon. Make that easier than parsing a tuple.
author Siddharth Agarwal <sid0@fb.com>
date Tue, 14 Oct 2014 16:35:37 -0700
parents e734d71cc558
children 9a89e9cf41b7
files hggit/git2hg.py hggit/git_handler.py
diffstat 2 files changed, 11 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/hggit/git2hg.py	Tue Oct 14 15:54:58 2014 -0700
+++ b/hggit/git2hg.py	Tue Oct 14 16:35:37 2014 -0700
@@ -63,4 +63,10 @@
             done.add(sha)
             todo.pop()
 
-    return commit_cache, commits
+    return GitIncomingResult(commits, commit_cache)
+
+class GitIncomingResult(object):
+    '''struct to store result from find_incoming'''
+    def __init__(self, commits, commit_cache):
+        self.commits = commits
+        self.commit_cache = commit_cache
--- a/hggit/git_handler.py	Tue Oct 14 15:54:58 2014 -0700
+++ b/hggit/git_handler.py	Tue Oct 14 16:35:37 2014 -0700
@@ -369,7 +369,7 @@
         else:
             reqrefs = refs
 
-        commits = [bin(c) for c in self.get_git_incoming(reqrefs)[1]]
+        commits = [bin(c) for c in self.get_git_incoming(reqrefs).commits]
 
         b = overlayrepo(self, commits, refs)
 
@@ -667,7 +667,9 @@
         return git2hg.find_incoming(self.git.object_store, self._map_git, refs)
 
     def import_git_objects(self, remote_name=None, refs=None):
-        commit_cache, commits = self.get_git_incoming(refs)
+        result = self.get_git_incoming(refs)
+        commits = result.commits
+        commit_cache = result.commit_cache
         # import each of the commits, oldest first
         total = len(commits)
         if total: