You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by jo...@apache.org on 2013/02/05 23:28:42 UTC

git commit: [#4691] Fixed case for Blob.prev_commit failed for added files

Updated Branches:
  refs/heads/master 29ef62b73 -> a7c64793f


[#4691] Fixed case for Blob.prev_commit failed for added files


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

Branch: refs/heads/master
Commit: a7c64793fa58173712159862c5ff42db540819e7
Parents: 29ef62b
Author: Cory Johns <jo...@geek.net>
Authored: Tue Feb 5 22:27:22 2013 +0000
Committer: Cory Johns <jo...@geek.net>
Committed: Tue Feb 5 22:27:22 2013 +0000

----------------------------------------------------------------------
 Allura/allura/model/repo.py |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/a7c64793/Allura/allura/model/repo.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/repo.py b/Allura/allura/model/repo.py
index 0f4352c..c97f408 100644
--- a/Allura/allura/model/repo.py
+++ b/Allura/allura/model/repo.py
@@ -622,9 +622,11 @@ class Blob(object):
             try:
                 tree = prev_commit and prev_commit.get_path(self.tree.path().rstrip('/'))
             except KeyError:
-                return None
-            lc = tree and LastCommit.get(tree)
-            commit_id = lc and lc.by_name[self.name]
+                return None  # parent tree added this commit
+            if not tree or self.name not in tree.by_name:
+                return None  # tree or file added this commit
+            lc = LastCommit.get(tree)
+            commit_id = lc and lc.by_name.get(self.name)
             if commit_id:
                 prev_commit = self.repo.commit(commit_id)
                 return prev_commit