You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by tv...@apache.org on 2013/02/05 21:23:35 UTC
[14/42] git commit: [#4691] Fixed KeyError on finding blob's previous
commit
[#4691] Fixed KeyError on finding blob's previous commit
Signed-off-by: Cory Johns <jo...@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/master
Commit: 6cf078d35a635c14bba651a7f520db3c5e4c16b1
Parents: ce58e36
Author: Cory Johns <jo...@geek.net>
Authored: Wed Dec 5 21:25:10 2012 +0000
Committer: Tim Van Steenburgh <tv...@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