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/03/01 16:58:04 UTC

[12/24] 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/63f5acdc
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/63f5acdc
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/63f5acdc

Branch: refs/heads/cj/5411
Commit: 63f5acdce89d453d3095377dbd50040e3f601205
Parents: fcf37e8
Author: Cory Johns <jo...@geek.net>
Authored: Mon Feb 25 22:26:28 2013 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Thu Feb 28 21:48:32 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/63f5acdc/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