incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From john...@apache.org
Subject [2/4] git commit: [#5788] Fixed caching of LCDs during build
Date Tue, 26 Feb 2013 00:05:11 GMT
[#5788] Fixed caching of LCDs during build

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

Branch: refs/heads/cj/5788
Commit: 5b62eace01af428044cec30b1d028167bcc4c767
Parents: 2c81ee8
Author: Cory Johns <johnsca@geek.net>
Authored: Mon Feb 25 22:26:28 2013 +0000
Committer: Cory Johns <johnsca@geek.net>
Committed: Mon Feb 25 22:26:28 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/5b62eace/Allura/allura/model/repo.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/repo.py b/Allura/allura/model/repo.py
index 55413dc..84ca713 100644
--- a/Allura/allura/model/repo.py
+++ b/Allura/allura/model/repo.py
@@ -762,7 +762,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
@@ -771,12 +770,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)])
@@ -803,6 +802,7 @@ class LastCommit(RepoObject):
                 path=path,
                 entries=entries,
             )
+        cache.set(cls, {'path': path, 'commit_id': tree.commit._id}, lcd)
         return lcd
 
     @LazyProperty


Mime
View raw message