incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From john...@apache.org
Subject [12/20] git commit: [#5788] Fixed caching of LCDs during build
Date Thu, 28 Feb 2013 22:38:16 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/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/5788
Commit: 63f5acdce89d453d3095377dbd50040e3f601205
Parents: fcf37e8
Author: Cory Johns <johnsca@geek.net>
Authored: Mon Feb 25 22:26:28 2013 +0000
Committer: Tim Van Steenburgh <tvansteenburgh@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


Mime
View raw message