changeset 840:edcdb7620f4d

git_handler.get_files_changed: return detected renames We currently return an empty dictionary -- we'll fill it in upcoming patches.
author Siddharth Agarwal <sid0@fb.com>
date Tue, 02 Dec 2014 15:04:50 -0800
parents 83a0e6c0e82c
children ef904bd8d3fb
files hggit/git_handler.py
diffstat 1 files changed, 9 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/hggit/git_handler.py	Tue Dec 02 14:53:11 2014 -0800
+++ b/hggit/git_handler.py	Tue Dec 02 15:04:50 2014 -0800
@@ -690,8 +690,6 @@
              commit.message, commit.extra)
         if hg_renames is None:
             detect_renames = True
-            # empty dictionary so that code below continues to work
-            renames = {}
         else:
             renames = hg_renames
 
@@ -703,7 +701,10 @@
                                      'please run hg git-cleanup'))
 
         # get a list of the changed, added, removed files and gitlinks
-        files, gitlinks = self.get_files_changed(commit, detect_renames)
+        files, gitlinks, git_renames = self.get_files_changed(commit,
+                                                              detect_renames)
+        if detect_renames:
+            renames = git_renames
 
         git_commit_tree = self.git[commit.tree]
 
@@ -1300,6 +1301,10 @@
         changes = diff_tree.tree_changes(self.git.object_store, btree, tree)
         files = {}
         gitlinks = {}
+        renames = None
+        if detect_renames:
+            renames = {}
+
         for change in changes:
             oldfile, oldmode, oldsha = change.old
             newfile, newmode, newsha = change.new
@@ -1332,7 +1337,7 @@
                 # old = file
                 files[oldfile] = True, None, None
 
-        return files, gitlinks
+        return files, gitlinks, renames
 
     @hgutil.propertycache
     def _rename_detector(self):