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 2012/10/29 21:10:46 UTC

[19/25] git commit: [#3883] Make precomputing decisions at repository refresh not depend on tool being named "svn".

[#3883] Make precomputing decisions at repository refresh not depend on
tool being named "svn".

Signed-off-by: Peter Hartmann <ma...@gmail.com>


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

Branch: refs/heads/cj/5076
Commit: 07df37252095028e67f65cfe0ce6254ebb298097
Parents: ef8eb12
Author: Peter Hartmann <ma...@gmail.com>
Authored: Wed Sep 12 21:22:28 2012 +0200
Committer: Cory Johns <jo...@geek.net>
Committed: Fri Oct 26 20:28:38 2012 +0000

----------------------------------------------------------------------
 Allura/allura/model/repo_refresh.py |   12 ++++++------
 Allura/allura/model/repository.py   |    1 +
 ForgeSVN/forgesvn/model/svn.py      |    1 +
 3 files changed, 8 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/07df3725/Allura/allura/model/repo_refresh.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/repo_refresh.py b/Allura/allura/model/repo_refresh.py
index 7251fd1..8b95eef 100644
--- a/Allura/allura/model/repo_refresh.py
+++ b/Allura/allura/model/repo_refresh.py
@@ -76,9 +76,9 @@ def refresh_repo(repo, all_commits=False, notify=True):
         log.info('Finished CommitRunBuilder for %s', repo.full_fs_path)
 
     # Refresh trees
-    # Like diffs below, pre-computing trees for SVN repos is too expensive,
+    # Like diffs below, pre-computing trees for some SCMs is too expensive,
     # so we skip it here, then do it on-demand later.
-    if repo.tool.lower() != 'svn':
+    if repo._refresh_precompute == False:
         cache = {}
         for i, oid in enumerate(commit_ids):
             ci = CommitDoc.m.find(dict(_id=oid), validate=False).next()
@@ -89,10 +89,10 @@ def refresh_repo(repo, all_commits=False, notify=True):
     # Compute diffs
     cache = {}
     # Have to compute_diffs() for all commits to ensure that LastCommitDocs
-    # are set properly for forked repos. For SVN, compute_diffs() we don't
-    # want to pre-compute the diffs because that would be too expensive, so
-    # we skip them here and do them on-demand with caching.
-    if repo.tool.lower() != 'svn':
+    # are set properly for forked repos. For some SCMs, compute_diffs()
+    # we don't want to pre-compute the diffs because that would be too
+    # expensive, so we skip them here and do them on-demand with caching.
+    if repo._refresh_precompute == False:
         for i, oid in enumerate(reversed(all_commit_ids)):
             ci = CommitDoc.m.find(dict(_id=oid), validate=False).next()
             compute_diffs(repo._id, cache, ci)

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/07df3725/Allura/allura/model/repository.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/repository.py b/Allura/allura/model/repository.py
index 5255bdb..2f2328a 100644
--- a/Allura/allura/model/repository.py
+++ b/Allura/allura/model/repository.py
@@ -151,6 +151,7 @@ class Repository(Artifact, ActivityObject):
     _impl = None
     repo_id='repo'
     type_s='Repository'
+    _refresh_precompute = True
 
     name=FieldProperty(str)
     tool=FieldProperty(str)

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/07df3725/ForgeSVN/forgesvn/model/svn.py
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/model/svn.py b/ForgeSVN/forgesvn/model/svn.py
index 23d80eb..8f6d465 100644
--- a/ForgeSVN/forgesvn/model/svn.py
+++ b/ForgeSVN/forgesvn/model/svn.py
@@ -38,6 +38,7 @@ class Repository(M.Repository):
     class __mongometa__:
         name='svn-repository'
     branches = FieldProperty([dict(name=str,object_id=str)])
+    _refresh_precompute = False
 
     @LazyProperty
     def _impl(self):