changeset 838:6866ae460ee7

git_handler.import_git_commit: figure out when to detect renames get_files_changed doesn't do anything with this yet, but it will in upcoming patches.
author Siddharth Agarwal <sid0@fb.com>
date Mon, 01 Dec 2014 21:18:34 -0800
parents c24d2ea1361b
children f6f84d51a154
files hggit/git_handler.py
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/hggit/git_handler.py
+++ b/hggit/git_handler.py
@@ -683,11 +683,13 @@
     def import_git_commit(self, commit):
         self.ui.debug(_("importing: %s\n") % commit.id)
 
+        detect_renames = False
         (strip_message, hg_renames,
          hg_branch, extra) = git2hg.extract_hg_metadata(
              commit.message, commit.extra)
         if hg_renames is None:
-            # don't do any rename detection for now
+            detect_renames = True
+            # empty dictionary so that code below continues to work
             renames = {}
         else:
             renames = hg_renames
@@ -700,7 +702,7 @@
                                      'please run hg git-cleanup'))
 
         # get a list of the changed, added, removed files and gitlinks
-        files, gitlinks = self.get_files_changed(commit)
+        files, gitlinks = self.get_files_changed(commit, detect_renames)
 
         git_commit_tree = self.git[commit.tree]
 
@@ -1287,7 +1289,7 @@
             elif isinstance(obj, Tree):
                 otree = obj
 
-    def get_files_changed(self, commit):
+    def get_files_changed(self, commit, detect_renames):
         tree = commit.tree
         btree = None