allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From john...@apache.org
Subject [10/50] git commit: [#4691] Fixed KeyError on finding blob's previous commit
Date Wed, 06 Feb 2013 15:42:52 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/6cf078d3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/6cf078d3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/6cf078d3

Branch: refs/heads/cj/4691
Commit: 6cf078d35a635c14bba651a7f520db3c5e4c16b1
Parents: ce58e36
Author: Cory Johns <johnsca@geek.net>
Authored: Wed Dec 5 21:25:10 2012 +0000
Committer: Tim Van Steenburgh <tvansteenburgh@gmail.com>
Committed: Tue Feb 5 20:22:50 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/6cf078d3/Allura/allura/model/repo.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/repo.py b/Allura/allura/model/repo.py
index bb69f77..3d456b1 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