allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From john...@apache.org
Subject git commit: [#4691] Fixed KeyError on finding blob's previous commit
Date Wed, 05 Dec 2012 21:25:22 GMT
Updated Branches:
  refs/heads/cj/4691 e0020328f -> 4c4d94bcc


[#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/4c4d94bc
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/4c4d94bc
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/4c4d94bc

Branch: refs/heads/cj/4691
Commit: 4c4d94bcc8503da6fdebf9e6bc4ef6ef0b5069fa
Parents: e002032
Author: Cory Johns <johnsca@geek.net>
Authored: Wed Dec 5 21:25:10 2012 +0000
Committer: Cory Johns <johnsca@geek.net>
Committed: Wed Dec 5 21:25:10 2012 +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/4c4d94bc/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