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/26 19:28:01 UTC
[4/8] git commit: [#5788] Fixed caching of LCDs during build
[#5788] Fixed caching of LCDs during build
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/70055eae
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/70055eae
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/70055eae
Branch: refs/heads/cj/5788
Commit: 70055eaece27670c27df03344faf614c674e8ed8
Parents: aced117
Author: Cory Johns <jo...@geek.net>
Authored: Mon Feb 25 22:26:28 2013 +0000
Committer: Cory Johns <jo...@geek.net>
Committed: Tue Feb 26 18:27:50 2013 +0000
----------------------------------------------------------------------
Allura/allura/model/repo.py | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/70055eae/Allura/allura/model/repo.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/repo.py b/Allura/allura/model/repo.py
index 91d4e46..4f50d5b 100644
--- a/Allura/allura/model/repo.py
+++ b/Allura/allura/model/repo.py
@@ -765,7 +765,6 @@ class LastCommit(RepoObject):
commit = cache.get(Commit, {'_id': last_commit_id})
commit.set_context(tree.repo)
lcd = cls._build(commit.get_path(path))
- cache.set(cls, {'path': path, 'commit_id': last_commit_id}, lcd)
return lcd
@classmethod
@@ -774,12 +773,12 @@ class LastCommit(RepoObject):
Build the LCD record, presuming that this tree is where it was most
recently changed.
'''
+ cache = getattr(c, 'model_cache', '') or ModelCache()
path = tree.path().strip('/')
entries = []
prev_lcd = None
prev_lcd_cid = cls._prev_commit_id(tree.commit, path)
if prev_lcd_cid:
- cache = getattr(c, 'model_cache', '') or ModelCache()
prev_lcd = cache.get(cls, {'path': path, 'commit_id': prev_lcd_cid})
entries = {}
nodes = set([node.name for node in chain(tree.tree_ids, tree.blob_ids, tree.other_ids)])
@@ -806,6 +805,7 @@ class LastCommit(RepoObject):
path=path,
entries=entries,
)
+ cache.set(cls, {'path': path, 'commit_id': tree.commit._id}, lcd)
return lcd
@LazyProperty