You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2012/10/10 18:31:04 UTC
[2/2] git commit: [#5102] add --mount_point option to reindex
[#5102] add --mount_point option to reindex
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/ac9b16f7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/ac9b16f7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/ac9b16f7
Branch: refs/heads/db/5102
Commit: ac9b16f762cbf71dc8bbab9aec9da7e51dad4717
Parents: 5215f01
Author: Dave Brondsema <db...@geek.net>
Authored: Wed Oct 10 16:30:38 2012 +0000
Committer: Dave Brondsema <db...@geek.net>
Committed: Wed Oct 10 16:30:38 2012 +0000
----------------------------------------------------------------------
Allura/allura/command/show_models.py | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/ac9b16f7/Allura/allura/command/show_models.py
----------------------------------------------------------------------
diff --git a/Allura/allura/command/show_models.py b/Allura/allura/command/show_models.py
index 95558ec..36a4716 100644
--- a/Allura/allura/command/show_models.py
+++ b/Allura/allura/command/show_models.py
@@ -35,6 +35,8 @@ class ReindexCommand(base.Command):
parser = base.Command.standard_parser(verbose=True)
parser.add_option('-p', '--project', dest='project', default=None,
help='project to reindex')
+ parser.add_option('--mount_point', dest='mount_point', default=None,
+ help='limit to this mount point (only use with --solr)')
parser.add_option('-n', '--neighborhood', dest='neighborhood', default=None,
help='neighborhood to reindex (e.g. p)')
@@ -70,7 +72,9 @@ class ReindexCommand(base.Command):
if self.options.refs:
M.ArtifactReference.query.remove({'artifact_reference.project_id':p._id})
M.Shortlink.query.remove({'project_id':p._id})
- app_config_ids = [ ac._id for ac in p.app_configs ]
+ app_config_ids = [ac._id for ac in p.app_configs
+ if not self.options.mount_point
+ or self.options.mount_point == ac.options.mount_point]
# Traverse the inheritance graph, finding all artifacts that
# belong to this project
for _, a_cls in dfs(M.Artifact, graph):
@@ -91,9 +95,12 @@ class ReindexCommand(base.Command):
M.main_orm_session.flush()
M.artifact_orm_session.clear()
try:
+ if self.options.verbose:
+ base.log.info('adding artifacts: %s' % ref_ids)
allura.tasks.index_tasks.add_artifacts(ref_ids,
update_solr=self.options.solr,
- update_refs=self.options.refs)
+ update_refs=self.options.refs,
+ verbose=self.options.verbose)
except CompoundError, err:
base.log.exception('Error indexing artifacts:\n%r', err)
base.log.error('%s', err.format_error())