Return-Path: X-Original-To: apmail-incubator-allura-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-allura-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 43DCBD8BC for ; Tue, 30 Oct 2012 17:30:09 +0000 (UTC) Received: (qmail 88284 invoked by uid 500); 30 Oct 2012 17:30:08 -0000 Delivered-To: apmail-incubator-allura-commits-archive@incubator.apache.org Received: (qmail 87914 invoked by uid 500); 30 Oct 2012 17:30:08 -0000 Mailing-List: contact allura-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: allura-dev@incubator.apache.org Delivered-To: mailing list allura-commits@incubator.apache.org Received: (qmail 87170 invoked by uid 99); 30 Oct 2012 17:30:06 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 30 Oct 2012 17:30:06 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 3521A50D02; Tue, 30 Oct 2012 17:30:06 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: johnsca@apache.org To: allura-commits@incubator.apache.org X-Mailer: ASF-Git Admin Mailer Subject: [16/48] git commit: [#3883] Make precomputing decisions at repository refresh not depend on tool being named "svn". Message-Id: <20121030173006.3521A50D02@tyr.zones.apache.org> Date: Tue, 30 Oct 2012 17:30:06 +0000 (UTC) [#3883] Make precomputing decisions at repository refresh not depend on tool being named "svn". Signed-off-by: Peter Hartmann 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/5005 Commit: 07df37252095028e67f65cfe0ce6254ebb298097 Parents: ef8eb12 Author: Peter Hartmann Authored: Wed Sep 12 21:22:28 2012 +0200 Committer: Cory Johns 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):