incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From john...@apache.org
Subject [22/50] git commit: [#4691] Fixed KeyError on finding blob's previous commit
Date Tue, 22 Jan 2013 23:23:18 GMT
[#4691] Fixed KeyError on finding blob's previous commit

Signed-off-by: Cory Johns <johnsca@geek.net>


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/181f891f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/181f891f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/181f891f

Branch: refs/heads/cj/4691
Commit: 181f891f5ab91cc3a8766cbf4c4c3d73f3265b37
Parents: 4c3971b
Author: Cory Johns <johnsca@geek.net>
Authored: Wed Dec 5 21:25:10 2012 +0000
Committer: Cory Johns <johnsca@geek.net>
Committed: Tue Jan 22 23:22:42 2013 +0000

----------------------------------------------------------------------
 Allura/allura/model/repo.py |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/181f891f/Allura/allura/model/repo.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/repo.py b/Allura/allura/model/repo.py
index 7befb4f..6ab590a 100644
--- a/Allura/allura/model/repo.py
+++ b/Allura/allura/model/repo.py
@@ -611,7 +611,16 @@ class Blob(object):
         if lc:
             entry = lc.entry_by_name(self.name)
             last_commit = self.repo.commit(entry.commit_info.id)
-            return last_commit.get_parent()
+            prev_commit = last_commit.get_parent()
+            try:
+                tree = prev_commit and prev_commit.get_path(self.tree.path().rstrip('/'))
+            except KeyError:
+                return None
+            lc = tree and LastCommit.get(tree)
+            entry = lc and lc.entry_by_name(self.name)
+            if entry:
+                prev_commit = self.repo.commit(entry.commit_info.id)
+                return prev_commit
         return None
 
     @LazyProperty


Mime
View raw message