allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From john...@apache.org
Subject [29/50] git commit: [#4691] Fixed KeyError on finding blob's previous commit
Date Thu, 10 Jan 2013 18:08:21 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/d7b4de68
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/d7b4de68
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/d7b4de68

Branch: refs/heads/cj/4691
Commit: d7b4de68286d86dbcfa07ee4a3cae3363e92cafb
Parents: b569f2d
Author: Cory Johns <johnsca@geek.net>
Authored: Wed Dec 5 21:25:10 2012 +0000
Committer: Cory Johns <johnsca@geek.net>
Committed: Thu Jan 10 16:27:14 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/d7b4de68/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