diff --git a/hggit/git_handler.py b/hggit/git_handler.py index 83a0e6c0e82c2b1ef8afec843c0502d0c8416e2b_aGdnaXQvZ2l0X2hhbmRsZXIucHk=..edcdb7620f4d4a82d2c936131d319e62198a6e05_aGdnaXQvZ2l0X2hhbmRsZXIucHk= 100644 --- a/hggit/git_handler.py +++ b/hggit/git_handler.py @@ -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):