From 012a3a40682d6959a86927a03504d670e7eaa50c Mon Sep 17 00:00:00 2001
From: Jonas Haag <jonas@lophus.org>
Date: Thu, 9 Jun 2011 22:10:25 +0200
Subject: [PATCH] Handle type changes in history (folder -> file, file ->
 symlink etc)

---
 repo.py | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/repo.py b/repo.py
index 8290d8f..dfd2f6e 100644
--- a/repo.py
+++ b/repo.py
@@ -65,11 +65,17 @@ class RepoWrapper(dulwich.repo.Repo):
     def _path_changed_between(self, path, commit1, commit2):
         path, filename = os.path.split(path)
         try:
-            blob1 = self.get_tree(commit1, path)[filename]
+            blob1 = self.get_tree(commit1, path)
+            if not isinstance(blob1, dulwich.objects.Tree):
+                return True
+            blob1 = blob1[filename]
         except KeyError:
             blob1 = None
         try:
-            blob2 = self.get_tree(commit2, path)[filename]
+            blob2 = self.get_tree(commit2, path)
+            if not isinstance(blob2, dulwich.objects.Tree):
+                return True
+            blob2 = blob2[filename]
         except KeyError:
             blob2 = None
         if blob1 is None and blob2 is None:
-- 
GitLab