You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by tv...@apache.org on 2014/01/09 21:36:48 UTC
[01/18] git commit: [#6992] Refactor bulk_export task some using
Boundaries concepts
Updated Branches:
refs/heads/tv/6905 262710df2 -> 62f4b4fec (forced update)
[#6992] Refactor bulk_export task some using Boundaries concepts
Signed-off-by: Cory Johns <cj...@slashdotmedia.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/d2baf30f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/d2baf30f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/d2baf30f
Branch: refs/heads/tv/6905
Commit: d2baf30fcf0ab455050725b4461cd7798cfd329f
Parents: 18e8da1
Author: Cory Johns <cj...@slashdotmedia.com>
Authored: Thu Dec 19 20:22:58 2013 +0000
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Mon Jan 6 15:16:51 2014 +0000
----------------------------------------------------------------------
Allura/allura/tasks/export_tasks.py | 153 ++++++++++++++-----------------
Allura/allura/tests/test_tasks.py | 51 +++--------
2 files changed, 85 insertions(+), 119 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d2baf30f/Allura/allura/tasks/export_tasks.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tasks/export_tasks.py b/Allura/allura/tasks/export_tasks.py
index 2f286d0..3fd9499 100644
--- a/Allura/allura/tasks/export_tasks.py
+++ b/Allura/allura/tasks/export_tasks.py
@@ -44,89 +44,76 @@ def bulk_export(tools, filename=None, send_email=True):
'''
# it's very handy to use c.* within a @task,
# but let's be explicit and keep it separate from the main code
- return _bulk_export(c.project, tools, c.user, filename, send_email)
-
-
-def _bulk_export(project, tools, user, filename=None, send_email=True):
- export_filename = filename or project.bulk_export_filename()
- export_path = create_export_dir(project, export_filename)
- not_exported_tools = []
- for tool in tools or []:
- app = project.app_instance(tool)
- if not app:
- log.info('Can not load app for %s mount point. Skipping.' % tool)
- not_exported_tools.append(tool)
- continue
- if not app.exportable:
- log.info('Tool %s is not exportable. Skipping.' % tool)
- not_exported_tools.append(tool)
- continue
- log.info('Exporting %s...' % tool)
+ return BulkExport().process(c.project, tools, c.user, filename, send_email)
+
+
+class BulkExport(object):
+ def process(self, project, tools, user, filename=None, send_email=True):
+ export_filename = filename or project.bulk_export_filename()
+ export_path = self.get_export_path(project.bulk_export_path(), export_filename)
+ if not os.path.exists(export_path):
+ os.makedirs(export_path)
+ apps = [project.app_instance(tool) for tool in tools]
+ exportable = self.filter_exportable(apps)
+ results = [self.export(export_path, app) for app in exportable]
+ exported = self.filter_successful(results)
+ if exported:
+ zipdir(export_path, os.path.join(os.path.dirname(export_path), export_filename))
+ shutil.rmtree(export_path)
+
+ if not user:
+ log.info('No user. Skipping notification.')
+ return
+ if not send_email:
+ return
+
+ tmpl = g.jinja2_env.get_template('allura:templates/mail/bulk_export.html')
+ instructions = tg.config.get('bulk_export_download_instructions', '')
+ instructions = instructions.format(
+ project=project.shortname,
+ filename=export_filename,
+ c=c,
+ )
+ exported_names = [a.config.options.mount_point for a in exported]
+ tmpl_context = {
+ 'instructions': instructions,
+ 'project': project,
+ 'tools': exported_names,
+ 'not_exported_tools': list(set(tools) - set(exported_names)),
+ }
+ email = {
+ 'sender': unicode(tg.config['forgemail.return_path']),
+ 'fromaddr': unicode(tg.config['forgemail.return_path']),
+ 'reply_to': unicode(tg.config['forgemail.return_path']),
+ 'message_id': h.gen_message_id(),
+ 'destinations': [unicode(user._id)],
+ 'subject': u'Bulk export for project %s completed' % project.shortname,
+ 'text': tmpl.render(tmpl_context),
+ }
+ mail_tasks.sendmail.post(**email)
+
+ def get_export_path(self, export_base_path, export_filename):
+ """Create temporary directory for export files"""
+ # Name temporary directory after project shortname,
+ # thus zipdir() will use proper prefix inside the archive.
+ tmp_dir_suffix = os.path.splitext(export_filename)[0]
+ path = os.path.join(export_base_path, tmp_dir_suffix)
+ return path
+
+ def filter_exportable(self, apps):
+ return [app for app in apps if app and app.exportable]
+
+ def export(self, export_path, app):
+ tool = app.config.options.mount_point
+ json_file = os.path.join(export_path, '%s.json' % tool)
try:
- json_file = os.path.join(export_path, '%s.json' % tool)
with open(json_file, 'w') as f:
app.bulk_export(f)
- except:
- log.error('Something went wrong during export of %s' % tool, exc_info=True)
- not_exported_tools.append(tool)
- continue
-
- if tools and len(not_exported_tools) < len(tools):
- # If that fails, we need to let it fail
- # there won't be a valid zip file for the user to get.
- zip_and_cleanup(export_path, export_filename)
- else:
- log.error('Nothing to export')
- return None
-
- if not user:
- log.info('No user. Skipping notification.')
- return
- if not send_email:
- return
-
- tmpl = g.jinja2_env.get_template('allura:templates/mail/bulk_export.html')
- instructions = tg.config.get('bulk_export_download_instructions', '')
- instructions = instructions.format(
- project=project.shortname,
- filename=export_filename,
- c=c,
- )
- tmpl_context = {
- 'instructions': instructions,
- 'project': project,
- 'tools': list(set(tools) - set(not_exported_tools)),
- 'not_exported_tools': not_exported_tools,
- }
- email = {
- 'sender': unicode(tg.config['forgemail.return_path']),
- 'fromaddr': unicode(tg.config['forgemail.return_path']),
- 'reply_to': unicode(tg.config['forgemail.return_path']),
- 'message_id': h.gen_message_id(),
- 'destinations': [unicode(user._id)],
- 'subject': u'Bulk export for project %s completed' % project.shortname,
- 'text': tmpl.render(tmpl_context),
- }
- mail_tasks.sendmail.post(**email)
-
-
-def create_export_dir(project, export_filename):
- """Create temporary directory for export files"""
- # Name temporary directory after project shortname,
- # thus zipdir() will use proper prefix inside the archive.
- tmp_dir_suffix = os.path.splitext(export_filename)[0]
- path = os.path.join(project.bulk_export_path(), tmp_dir_suffix)
- if not os.path.exists(path):
- os.makedirs(path)
- return path
-
-
-def zip_and_cleanup(export_path, export_filename):
- """
- Zip exported data for a given path and filename.
- Copy it to proper location. Remove temporary files.
- """
- zipdir(export_path, os.path.join(os.path.dirname(export_path), export_filename))
-
- # cleanup
- shutil.rmtree(export_path)
+ except Exception as e:
+ log.error('Error exporting: %s on %s', tool, app.project.shortname, exc_info=True)
+ return None
+ else:
+ return app
+
+ def filter_successful(self, results):
+ return [result for result in results if result is not None]
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d2baf30f/Allura/allura/tests/test_tasks.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/test_tasks.py b/Allura/allura/tests/test_tasks.py
index 13c6f7f..d908252 100644
--- a/Allura/allura/tests/test_tasks.py
+++ b/Allura/allura/tests/test_tasks.py
@@ -447,33 +447,29 @@ class TestExportTasks(unittest.TestCase):
project = M.Project.query.get(shortname='test')
shutil.rmtree(project.bulk_export_path(), ignore_errors=True)
- @mock.patch('allura.tasks.export_tasks.log')
- def test_bulk_export_invalid_tool(self, log):
- export_tasks.bulk_export([u'bugs', u'blog'])
- log.info.assert_any_call('Can not load app for bugs mount point. Skipping.')
- log.info.assert_any_call('Can not load app for blog mount point. Skipping.')
-
- @mock.patch('allura.tasks.export_tasks.log')
- @mock.patch('allura.tasks.export_tasks.M.Project.app_instance')
- @mock.patch('allura.tasks.export_tasks.mail_tasks')
- @td.with_tool('test', 'Tickets', 'bugs')
- @td.with_tool('test', 'Blog', 'blog')
- def test_bulk_export_not_exportable_tool(self, mail_tasks, app, log):
- app.return_value.exportable = False
- export_tasks.bulk_export([u'bugs', u'blog'])
- log.info.assert_any_call('Tool bugs is not exportable. Skipping.')
- log.info.assert_any_call('Tool blog is not exportable. Skipping.')
+ def test_bulk_export_filter_exportable(self):
+ exportable = mock.Mock(exportable=True)
+ not_exportable = mock.Mock(exportable=False)
+ BE = export_tasks.BulkExport()
+ self.assertEqual(BE.filter_exportable([None, exportable, not_exportable]), [exportable])
+
+ def test_bulk_export_filter_successful(self):
+ BE = export_tasks.BulkExport()
+ self.assertEqual(BE.filter_successful(['foo', None, '0']), ['foo', '0'])
+
+ def test_get_export_path(self):
+ BE = export_tasks.BulkExport()
+ path = BE.get_export_path('/tmp/bulk_export/p/test/', 'test-0.zip')
+ self.assertEqual(path, '/tmp/bulk_export/p/test/test-0')
@mock.patch('allura.model.project.Project.__json__')
@mock.patch('allura.tasks.export_tasks.shutil')
@mock.patch('allura.tasks.export_tasks.zipdir')
@mock.patch('forgewiki.wiki_main.ForgeWikiApp.bulk_export')
- @mock.patch('allura.tasks.export_tasks.log')
@td.with_wiki
- def test_bulk_export(self, log, wiki_bulk_export, zipdir, shutil, project_json):
+ def test_bulk_export(self, wiki_bulk_export, zipdir, shutil, project_json):
M.MonQTask.query.remove()
export_tasks.bulk_export([u'wiki'])
- log.info.assert_any_call('Exporting wiki...')
wiki_bulk_export.assert_called_once()
project_json.assert_called_once()
temp = '/tmp/bulk_export/p/test/test'
@@ -493,23 +489,6 @@ class TestExportTasks(unittest.TestCase):
assert_in('The following tools were exported:\n- wiki', text)
assert_in('Sample instructions for test', text)
- def test_create_export_dir(self):
- project = M.Project.query.get(shortname='test')
- export_path = project.bulk_export_path()
- export_filename = project.bulk_export_filename()
- path = export_tasks.create_export_dir(project, export_filename)
- assert_equal(path, '/tmp/bulk_export/p/test/test')
- assert os.path.exists(os.path.join(export_path, project.shortname))
-
- @onlyif(os.path.exists(tg.config.get('scm.repos.tarball.zip_binary', '/usr/bin/zip')), 'zip binary is missing')
- def test_zip_and_cleanup(self):
- project = M.Project.query.get(shortname='test')
- export_filename = project.bulk_export_filename()
- path = export_tasks.create_export_dir(project, export_filename)
- export_tasks.zip_and_cleanup(path, export_filename)
- assert not os.path.exists(path)
- assert os.path.exists(os.path.join(project.bulk_export_path(), 'test.zip'))
-
def test_bulk_export_status(self):
assert_equal(c.project.bulk_export_status(), None)
export_tasks.bulk_export.post(['wiki'])
[11/18] git commit: [#4397] Background timeline aggregation
Posted by tv...@apache.org.
[#4397] Background timeline aggregation
Fires off background tasks to aggregate affected timelines after a new
activity is created. Multiple aggregations for the same node are
prevented from occuring concurrently. On-demand aggregation will still
happen if necessary (if a timeline is requested and it's aggregation
is stale) but should be rare.
Signed-off-by: Tim Van Steenburgh <tv...@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/dca06665
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/dca06665
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/dca06665
Branch: refs/heads/tv/6905
Commit: dca066651ec43fb6541075bacda767151fb7562c
Parents: 131f06f
Author: Tim Van Steenburgh <tv...@gmail.com>
Authored: Thu Dec 19 02:45:59 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Wed Jan 8 18:35:26 2014 +0000
----------------------------------------------------------------------
Allura/allura/lib/app_globals.py | 4 +++
Allura/allura/lib/custom_middleware.py | 6 ++++
Allura/allura/model/timeline.py | 36 ++++++++++++++++++--
Allura/allura/tasks/activity_tasks.py | 25 ++++++++++++++
Allura/setup.py | 6 ++--
.../forgeactivity/tests/functional/test_root.py | 22 ++++++++++++
6 files changed, 94 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/dca06665/Allura/allura/lib/app_globals.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/app_globals.py b/Allura/allura/lib/app_globals.py
index 0643460..6c94870 100644
--- a/Allura/allura/lib/app_globals.py
+++ b/Allura/allura/lib/app_globals.py
@@ -280,6 +280,10 @@ class Globals(object):
return False
def create_activity(self, *a, **kw):
pass
+ def create_timeline(self, *a, **kw):
+ pass
+ def create_timelines(self, *a, **kw):
+ pass
def get_timeline(self, *a, **kw):
return []
return NullActivityStreamDirector()
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/dca06665/Allura/allura/lib/custom_middleware.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/custom_middleware.py b/Allura/allura/lib/custom_middleware.py
index d7cbdc9..940c534 100644
--- a/Allura/allura/lib/custom_middleware.py
+++ b/Allura/allura/lib/custom_middleware.py
@@ -188,8 +188,14 @@ class AlluraTimerMiddleware(TimerMiddleware):
import pymongo
import socket
import urllib2
+ import activitystream
return self.entry_point_timers() + [
+ Timer('activitystream.director.{method_name}', allura.model.timeline.Director,
+ 'create_activity', 'create_timeline', 'get_timeline'),
+ Timer('activitystream.aggregator.{method_name}', allura.model.timeline.Aggregator, '*'),
+ Timer('activitystream.node_manager.{method_name}', activitystream.managers.NodeManager, '*'),
+ Timer('activitystream.activity_manager.{method_name}', activitystream.managers.ActivityManager, '*'),
Timer('jinja', jinja2.Template, 'render', 'stream', 'generate'),
Timer('markdown', markdown.Markdown, 'convert'),
Timer('ming', ming.odm.odmsession.ODMCursor, 'next', # FIXME: this may captures timings ok, but is misleading for counts
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/dca06665/Allura/allura/model/timeline.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/timeline.py b/Allura/allura/model/timeline.py
index b45118e..8f8ac41 100644
--- a/Allura/allura/model/timeline.py
+++ b/Allura/allura/model/timeline.py
@@ -16,18 +16,48 @@
# under the License.
import bson
+import logging
from ming.odm import Mapper
-from activitystream import base
+
+from activitystream import ActivityDirector
+from activitystream.base import NodeBase, ActivityObjectBase
+from activitystream.managers import Aggregator as BaseAggregator
+
from allura.lib import security
+from allura.tasks.activity_tasks import create_timelines
+
+log = logging.getLogger(__name__)
+
+
+class Director(ActivityDirector):
+ """Overrides the default ActivityDirector to kick off background
+ timeline aggregations after an activity is created.
+
+ """
+ def create_activity(self, actor, verb, obj, target=None,
+ related_nodes=None):
+ from allura.model.project import Project
+ super(Director, self).create_activity(actor, verb, obj,
+ target=target, related_nodes=related_nodes)
+ # aggregate actor and follower's timelines
+ create_timelines.post(actor.node_id)
+ # aggregate project and follower's timelines
+ for node in [obj, target] + (related_nodes or []):
+ if isinstance(node, Project):
+ create_timelines.post(node.node_id)
+
+
+class Aggregator(BaseAggregator):
+ pass
-class ActivityNode(base.NodeBase):
+class ActivityNode(NodeBase):
@property
def node_id(self):
return "%s:%s" % (self.__class__.__name__, self._id)
-class ActivityObject(base.ActivityObjectBase):
+class ActivityObject(ActivityObjectBase):
@property
def activity_name(self):
"""Override this for each Artifact type."""
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/dca06665/Allura/allura/tasks/activity_tasks.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tasks/activity_tasks.py b/Allura/allura/tasks/activity_tasks.py
new file mode 100644
index 0000000..26ac02a
--- /dev/null
+++ b/Allura/allura/tasks/activity_tasks.py
@@ -0,0 +1,25 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+from pylons import app_globals as g
+
+from allura.lib.decorators import task
+
+
+@task
+def create_timelines(node_id):
+ g.director.create_timelines(node_id)
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/dca06665/Allura/setup.py
----------------------------------------------------------------------
diff --git a/Allura/setup.py b/Allura/setup.py
index bc829ce..4f3cf84 100644
--- a/Allura/setup.py
+++ b/Allura/setup.py
@@ -146,7 +146,9 @@ setup(
[easy_widgets.engines]
jinja = allura.config.app_cfg:JinjaEngine
- [activitystream.storage]
- driver = activitystream.storage.mingstorage:MingStorage
+ [activitystream]
+ storage = activitystream.storage.mingstorage:MingStorage
+ director = allura.model.timeline:Director
+ aggregator = allura.model.timeline:Aggregator
""",
)
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/dca06665/ForgeActivity/forgeactivity/tests/functional/test_root.py
----------------------------------------------------------------------
diff --git a/ForgeActivity/forgeactivity/tests/functional/test_root.py b/ForgeActivity/forgeactivity/tests/functional/test_root.py
index 178bb89..eda71be 100644
--- a/ForgeActivity/forgeactivity/tests/functional/test_root.py
+++ b/ForgeActivity/forgeactivity/tests/functional/test_root.py
@@ -21,7 +21,9 @@ from tg import config
import dateutil.parser
from nose.tools import assert_equal
+from pylons import app_globals as g
+from allura import model as M
from alluratest.controller import TestController
from allura.tests import decorators as td
@@ -148,3 +150,23 @@ class TestActivityController(TestController):
assert director.get_timeline.call_count == 1
assert director.get_timeline.call_args[0][0].shortname == 'test'
assert director.get_timeline.call_args[1]['actor_only'] == False
+
+ @td.with_tracker
+ @td.with_tool('u/test-user-1', 'activity')
+ @td.with_user_project('test-user-1')
+ def test_background_aggregation(self):
+ self.app.get('/u/test-admin/activity/follow?follow=True',
+ extra_environ=dict(username='test-user-1'))
+ # new ticket, creates activity
+ d = {'ticket_form.summary': 'New Ticket'}
+ self.app.post('/bugs/save_ticket', params=d)
+ orig_create_timeline = g.director.aggregator.create_timeline
+ with patch.object(g.director.aggregator, 'create_timeline') as create_timeline:
+ create_timeline.side_effect = orig_create_timeline
+ M.MonQTask.run_ready()
+ # 3 aggregations: 1 actor, 1 follower, 1 project
+ assert_equal(create_timeline.call_count, 3)
+ create_timeline.reset_mock()
+ self.app.get('/u/test-admin/activity/')
+ self.app.get('/u/test-user-1/activity/')
+ assert_equal(create_timeline.call_count, 0)
[09/18] git commit: [#7028] provide help to developers if CSS not
loading
Posted by tv...@apache.org.
[#7028] provide help to developers if CSS not loading
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/bc077060
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/bc077060
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/bc077060
Branch: refs/heads/tv/6905
Commit: bc077060d74fda1a6a4592bbe95ab4bd17d8046b
Parents: b17a9ff
Author: Dave Brondsema <da...@brondsema.net>
Authored: Tue Jan 7 17:17:38 2014 -0500
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Wed Jan 8 17:18:47 2014 +0000
----------------------------------------------------------------------
Allura/allura/nf/allura/css/site_style.css | 2 ++
Allura/allura/templates/jinja_master/master.html | 6 ++++++
2 files changed, 8 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/bc077060/Allura/allura/nf/allura/css/site_style.css
----------------------------------------------------------------------
diff --git a/Allura/allura/nf/allura/css/site_style.css b/Allura/allura/nf/allura/css/site_style.css
index ebb0b92..ac0374d 100644
--- a/Allura/allura/nf/allura/css/site_style.css
+++ b/Allura/allura/nf/allura/css/site_style.css
@@ -398,6 +398,8 @@ td, td img {
white-space: nowrap;
}
+.hide {display:none;}
+
blockquote {
border-left: 1px solid #cccccc;
margin-left: 1em;
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/bc077060/Allura/allura/templates/jinja_master/master.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/jinja_master/master.html b/Allura/allura/templates/jinja_master/master.html
index 9122b1c..8dad846 100644
--- a/Allura/allura/templates/jinja_master/master.html
+++ b/Allura/allura/templates/jinja_master/master.html
@@ -72,6 +72,12 @@
</head>
<body{% block body_attrs %}{% endblock %} id="forge">
+ <h2 class="hide">
+ <span style="color:red">Error:</span> CSS did not load.<br>
+ This may happen on the first request due to CSS mimetype issues.
+ Try clearing your browser cache and refreshing.
+ <hr>
+ </h2>
{% block body_top_js %}
{% for blob in g.resource_manager.emit('body_top_js') %}
{{ blob }}
[08/18] git commit: [#7028] Change class name
Posted by tv...@apache.org.
[#7028] Change class name
Signed-off-by: Tim Van Steenburgh <tv...@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/131f06fc
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/131f06fc
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/131f06fc
Branch: refs/heads/tv/6905
Commit: 131f06fc1afd44e0b5a881e381e81732a35776ef
Parents: bc07706
Author: Tim Van Steenburgh <tv...@gmail.com>
Authored: Wed Jan 8 17:18:35 2014 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Wed Jan 8 17:18:47 2014 +0000
----------------------------------------------------------------------
Allura/allura/nf/allura/css/site_style.css | 2 +-
Allura/allura/templates/jinja_master/master.html | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/131f06fc/Allura/allura/nf/allura/css/site_style.css
----------------------------------------------------------------------
diff --git a/Allura/allura/nf/allura/css/site_style.css b/Allura/allura/nf/allura/css/site_style.css
index ac0374d..05f1d05 100644
--- a/Allura/allura/nf/allura/css/site_style.css
+++ b/Allura/allura/nf/allura/css/site_style.css
@@ -398,7 +398,7 @@ td, td img {
white-space: nowrap;
}
-.hide {display:none;}
+.hidden {display:none;}
blockquote {
border-left: 1px solid #cccccc;
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/131f06fc/Allura/allura/templates/jinja_master/master.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/jinja_master/master.html b/Allura/allura/templates/jinja_master/master.html
index 8dad846..723e56e 100644
--- a/Allura/allura/templates/jinja_master/master.html
+++ b/Allura/allura/templates/jinja_master/master.html
@@ -72,7 +72,7 @@
</head>
<body{% block body_attrs %}{% endblock %} id="forge">
- <h2 class="hide">
+ <h2 class="hidden">
<span style="color:red">Error:</span> CSS did not load.<br>
This may happen on the first request due to CSS mimetype issues.
Try clearing your browser cache and refreshing.
[12/18] git commit: Update nose-progressive to work with parallel
tests
Posted by tv...@apache.org.
Update nose-progressive to work with parallel tests
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/da8258dc
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/da8258dc
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/da8258dc
Branch: refs/heads/tv/6905
Commit: da8258dc45800fcdad72634bfc8b1e5ae311d01d
Parents: 21d27ab
Author: Cory Johns <cj...@slashdotmedia.com>
Authored: Thu Jan 9 15:34:41 2014 +0000
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Thu Jan 9 15:34:41 2014 +0000
----------------------------------------------------------------------
requirements-sf.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/da8258dc/requirements-sf.txt
----------------------------------------------------------------------
diff --git a/requirements-sf.txt b/requirements-sf.txt
index 8fa5d69..d7993fa 100644
--- a/requirements-sf.txt
+++ b/requirements-sf.txt
@@ -37,7 +37,7 @@ mediawiki==0.0.1
# development
blessings==1.3
-nose-progressive==1.3
+nose-progressive==1.5
pyprof2calltree==1.1.0
repoze.profile==1.3
[06/18] git commit: Disable multiproc plugin if coverage enabled
Posted by tv...@apache.org.
Disable multiproc plugin if coverage enabled
Signed-off-by: Tim Van Steenburgh <tv...@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/3d419ecc
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/3d419ecc
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/3d419ecc
Branch: refs/heads/tv/6905
Commit: 3d419ecc20a2fe3e6de10cfed7fa9de814dc8df5
Parents: dd3b5a8
Author: Tim Van Steenburgh <tv...@gmail.com>
Authored: Tue Jan 7 21:14:03 2014 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Tue Jan 7 21:14:03 2014 +0000
----------------------------------------------------------------------
run_tests | 3 +++
1 file changed, 3 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/3d419ecc/run_tests
----------------------------------------------------------------------
diff --git a/run_tests b/run_tests
index 38e63e4..e105040 100755
--- a/run_tests
+++ b/run_tests
@@ -112,6 +112,9 @@ def run_tests_in_parallel(options, nosetests_args):
def get_pkg_path(pkg):
return ALT_PKG_PATHS.get(pkg, '')
def get_multiproc_args(pkg):
+ if '--with-coverage' in nosetests_args:
+ # coverage and multiproc plugins not compatible
+ return ''
return ('--processes={procs_per_suite} --process-timeout={proc_timeout}'.format(
procs_per_suite=options.concurrent_tests,
proc_timeout=PROC_TIMEOUT)
[03/18] git commit: [#4671] remove old-style LastCommitDoc model and
logic
Posted by tv...@apache.org.
[#4671] remove old-style LastCommitDoc model and logic
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/8b15d499
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/8b15d499
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/8b15d499
Branch: refs/heads/tv/6905
Commit: 8b15d4991d306c2ccee6cba625406a69ecc6dbf5
Parents: 8c9de14
Author: Dave Brondsema <da...@brondsema.net>
Authored: Thu Jan 2 17:51:11 2014 -0500
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Tue Jan 7 17:01:40 2014 +0000
----------------------------------------------------------------------
Allura/allura/model/repo.py | 93 ++--------------------------------------
1 file changed, 4 insertions(+), 89 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/8b15d499/Allura/allura/model/repo.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/repo.py b/Allura/allura/model/repo.py
index 9977a0f..9228076 100644
--- a/Allura/allura/model/repo.py
+++ b/Allura/allura/model/repo.py
@@ -83,20 +83,6 @@ TreeDoc = collection(
Field('blob_ids', [dict(name=str, id=str)]),
Field('other_ids', [dict(name=str, id=str, type=SObjType)]))
-LastCommitDoc_old = collection(
- 'repo_last_commit', project_doc_session,
- Field('_id', str),
- Field('object_id', str, index=True),
- Field('name', str),
- Field('commit_info', dict(
- id=str,
- date=datetime,
- author=str,
- author_email=str,
- author_url=str,
- shortlink=str,
- summary=str)))
-
# Information about the last commit to touch a tree
LastCommitDoc = collection(
'repo_last_commit', main_doc_session,
@@ -555,22 +541,9 @@ class Tree(RepoObject):
def ls(self):
'''
List the entries in this tree, with historical commit info for
- each node. Eventually, ls_old can be removed and this can be
- replaced with the following:
-
- return self._lcd_map(LastCommit.get(self))
+ each node.
'''
- # look for existing new format first
- last_commit = LastCommit.get(self, create=False)
- if last_commit:
- return self._lcd_map(last_commit)
- # otherwise, try old format
- old_style_results = self.ls_old()
- if old_style_results:
- log.info('Using old-style results from ls_old()')
- return old_style_results
- # finally, use the new implentation that auto-vivifies
- last_commit = LastCommit.get(self, create=True)
+ last_commit = LastCommit.get(self)
# ensure that the LCD is saved, even if
# there is an error later in the request
if last_commit:
@@ -615,64 +588,6 @@ class Tree(RepoObject):
))
return results
- def ls_old(self):
- # Load last commit info
- id_re = re.compile("^{0}:{1}:".format(
- self.repo._id,
- re.escape(h.really_unicode(self.path()).encode('utf-8'))))
- lc_index = dict(
- (lc.name, lc.commit_info)
- for lc in LastCommitDoc_old.m.find(dict(_id=id_re)))
-
- # FIXME: Temporarily fall back to old, semi-broken lookup behavior until refresh is done
- oids = [ x.id for x in chain(self.tree_ids, self.blob_ids, self.other_ids) ]
- id_re = re.compile("^{0}:".format(self.repo._id))
- lc_index.update(dict(
- (lc.object_id, lc.commit_info)
- for lc in LastCommitDoc_old.m.find(dict(_id=id_re, object_id={'$in': oids}))))
- # /FIXME
-
- if not lc_index:
- # allow fallback to new method instead
- # of showing a bunch of Nones
- return []
-
- results = []
- def _get_last_commit(name, oid):
- lc = lc_index.get(name, lc_index.get(oid, None))
- if lc is None:
- lc = dict(
- author=None,
- author_email=None,
- author_url=None,
- date=None,
- id=None,
- href=None,
- shortlink=None,
- summary=None)
- if 'href' not in lc:
- lc['href'] = self.repo.url_for_commit(lc['id'])
- return lc
- for x in sorted(self.tree_ids, key=lambda x:x.name):
- results.append(dict(
- kind='DIR',
- name=x.name,
- href=x.name + '/',
- last_commit=_get_last_commit(x.name, x.id)))
- for x in sorted(self.blob_ids, key=lambda x:x.name):
- results.append(dict(
- kind='FILE',
- name=x.name,
- href=x.name,
- last_commit=_get_last_commit(x.name, x.id)))
- for x in sorted(self.other_ids, key=lambda x:x.name):
- results.append(dict(
- kind=x.type,
- name=x.name,
- href=None,
- last_commit=_get_last_commit(x.name, x.id)))
- return results
-
def path(self):
if self.parent:
assert self.parent is not self
@@ -840,13 +755,13 @@ class LastCommit(RepoObject):
return None
@classmethod
- def get(cls, tree, create=True):
+ def get(cls, tree):
'''Find or build the LastCommitDoc for the given tree.'''
cache = getattr(c, 'model_cache', '') or ModelCache()
path = tree.path().strip('/')
last_commit_id = cls._last_commit_id(tree.commit, path)
lcd = cache.get(cls, {'path': path, 'commit_id': last_commit_id})
- if lcd is None and create:
+ if lcd is None:
commit = cache.get(Commit, {'_id': last_commit_id})
commit.set_context(tree.repo)
lcd = cls._build(commit.get_path(path))
[07/18] git commit: Use all cpus for concurrent test suites if
possible
Posted by tv...@apache.org.
Use all cpus for concurrent test suites if possible
Signed-off-by: Tim Van Steenburgh <tv...@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/b17a9ff2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/b17a9ff2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/b17a9ff2
Branch: refs/heads/tv/6905
Commit: b17a9ff2b755b7cbba23623897b83aa5ce7381fe
Parents: 3d419ec
Author: Tim Van Steenburgh <tv...@gmail.com>
Authored: Tue Jan 7 22:21:47 2014 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Tue Jan 7 22:21:47 2014 +0000
----------------------------------------------------------------------
run_tests | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/b17a9ff2/run_tests
----------------------------------------------------------------------
diff --git a/run_tests b/run_tests
index e105040..4180aa9 100755
--- a/run_tests
+++ b/run_tests
@@ -109,16 +109,22 @@ def check_packages(packages):
def run_tests_in_parallel(options, nosetests_args):
+ # coverage and multiproc plugins not compatible
+ use_multiproc = '--with-coverage' not in nosetests_args
+
def get_pkg_path(pkg):
return ALT_PKG_PATHS.get(pkg, '')
def get_multiproc_args(pkg):
- if '--with-coverage' in nosetests_args:
- # coverage and multiproc plugins not compatible
+ if not use_multiproc:
return ''
return ('--processes={procs_per_suite} --process-timeout={proc_timeout}'.format(
procs_per_suite=options.concurrent_tests,
proc_timeout=PROC_TIMEOUT)
if pkg not in NOT_MULTIPROC_SAFE else '')
+ def get_concurrent_suites():
+ if use_multiproc or '-n' in sys.argv:
+ return options.concurrent_suites
+ return CPUS
cmds = []
for package in check_packages(options.packages):
@@ -131,7 +137,7 @@ def run_tests_in_parallel(options, nosetests_args):
multiproc_args=get_multiproc_args(package),
)
cmds.append((cmd, dict(cwd=package)))
- return run_many(cmds, processes=options.concurrent_suites)
+ return run_many(cmds, processes=get_concurrent_suites())
def parse_args():
[13/18] git commit: [#6905] ticket:503 removed unused debug output
Posted by tv...@apache.org.
[#6905] ticket:503 removed unused debug output
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/754b009a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/754b009a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/754b009a
Branch: refs/heads/tv/6905
Commit: 754b009a0244cffd3fcc394eb6a404f13c201b6f
Parents: 0b92711
Author: Mykola Kharechko <cr...@gmail.com>
Authored: Wed Jan 8 11:58:43 2014 +0200
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Thu Jan 9 18:41:35 2014 +0000
----------------------------------------------------------------------
Allura/allura/tasks/repo_tasks.py | 3 ++-
Allura/allura/templates/repo/tarball.html | 1 -
2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/754b009a/Allura/allura/tasks/repo_tasks.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tasks/repo_tasks.py b/Allura/allura/tasks/repo_tasks.py
index 0354eb9..ab0a430 100644
--- a/Allura/allura/tasks/repo_tasks.py
+++ b/Allura/allura/tasks/repo_tasks.py
@@ -132,7 +132,8 @@ def tarball(revision=None, path=None):
else:
try:
repo.tarball(revision, path)
- finally:
+ except:
log.error('Could not create snapshot for repository: %s:%s revision %s path %s' % (c.project.shortname, c.app.config.options.mount_point, revision, path), exc_info=True)
+ raise
else:
log.warn('Skipped creation of snapshot: %s:%s because revision is not specified' % (c.project.shortname, c.app.config.options.mount_point))
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/754b009a/Allura/allura/templates/repo/tarball.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/repo/tarball.html b/Allura/allura/templates/repo/tarball.html
index 3f0581c..05d9386 100644
--- a/Allura/allura/templates/repo/tarball.html
+++ b/Allura/allura/templates/repo/tarball.html
@@ -56,7 +56,6 @@ Commit <a href="{{commit.url()}}">{{commit.shorthand_id()}}</a> {{commit_labels(
var delay = 500;
function check_status() {
$.get('{{commit.url()}}tarball_status?path={{path}}', function(data) {
- console.log(data)
if (data.status === 'complete') {
spinner.stop();
$('#snapshot_status h2').hide();
[04/18] git commit: [#6994] Run individual tests in parallel
Posted by tv...@apache.org.
[#6994] Run individual tests in parallel
Signed-off-by: Tim Van Steenburgh <tv...@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/d4c06e8c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/d4c06e8c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/d4c06e8c
Branch: refs/heads/tv/6905
Commit: d4c06e8c5e4e205bd29907bd126b147e5ad6ddf5
Parents: 8b15d49
Author: Tim Van Steenburgh <tv...@gmail.com>
Authored: Fri Dec 20 04:41:32 2013 +0000
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Tue Jan 7 17:59:45 2014 +0000
----------------------------------------------------------------------
Allura/allura/tests/__init__.py | 4 ++++
Allura/allura/tests/test_utils.py | 1 +
requirements-common.txt | 2 +-
run_tests | 38 +++++++++++++++++++++++++++++-----
4 files changed, 39 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d4c06e8c/Allura/allura/tests/__init__.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/__init__.py b/Allura/allura/tests/__init__.py
index 3fb7e93..c715a48 100644
--- a/Allura/allura/tests/__init__.py
+++ b/Allura/allura/tests/__init__.py
@@ -21,6 +21,10 @@
import alluratest.controller
+# HACK: prevents test suite from crashing when running under the nose
+# MultiProcessing plugin
+import socket
+socket.setdefaulttimeout(None)
class TestController(alluratest.controller.TestController):
"""
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d4c06e8c/Allura/allura/tests/test_utils.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/test_utils.py b/Allura/allura/tests/test_utils.py
index 494e893..b8b5de7 100644
--- a/Allura/allura/tests/test_utils.py
+++ b/Allura/allura/tests/test_utils.py
@@ -94,6 +94,7 @@ class TestAntispam(unittest.TestCase):
def setUp(self):
setup_unit_test()
+ pylons.request._push_object(Request.blank('/'))
pylons.request.remote_addr = '127.0.0.1'
self.a = utils.AntiSpam()
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d4c06e8c/requirements-common.txt
----------------------------------------------------------------------
diff --git a/requirements-common.txt b/requirements-common.txt
index 7f48285..5ffd19f 100644
--- a/requirements-common.txt
+++ b/requirements-common.txt
@@ -74,7 +74,7 @@ smmap==0.8.1
datadiff==1.1.5
ipython==0.11
mock==1.0.1
-nose==1.1.2
+nose==1.3.0
pyflakes==0.5.0
WebTest==1.4.0
clonedigger==1.1.0
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d4c06e8c/run_tests
----------------------------------------------------------------------
diff --git a/run_tests b/run_tests
index a85aefe..38e63e4 100755
--- a/run_tests
+++ b/run_tests
@@ -20,12 +20,26 @@
import argparse
from copy import copy
from glob import glob
+import multiprocessing
from multiprocessing.pool import ThreadPool
import subprocess
import sys
import threading
import textwrap
+CPUS = multiprocessing.cpu_count()
+CONCURRENT_SUITES = (CPUS // 4) or CPUS
+CONCURRENT_TESTS = (CPUS // CONCURRENT_SUITES) or 1
+PROC_TIMEOUT = 120
+
+ALT_PKG_PATHS = {
+ 'Allura': 'allura/tests/',
+ }
+
+NOT_MULTIPROC_SAFE = [
+ 'ForgeGit',
+ 'ForgeSVN',
+ ]
def run_one(cmd, **popen_kwargs):
print '{} running {} {}'.format(threading.current_thread(), cmd, popen_kwargs)
@@ -76,7 +90,7 @@ def run_many(cmds, processes=None):
def get_packages():
- packages = [p.split('/')[0] for p in glob("*/setup.py")]
+ packages = sorted([p.split('/')[0] for p in glob("*/setup.py")])
# make it first, to catch syntax errors
packages.remove('AlluraTest')
@@ -95,16 +109,26 @@ def check_packages(packages):
def run_tests_in_parallel(options, nosetests_args):
+ def get_pkg_path(pkg):
+ return ALT_PKG_PATHS.get(pkg, '')
+ def get_multiproc_args(pkg):
+ return ('--processes={procs_per_suite} --process-timeout={proc_timeout}'.format(
+ procs_per_suite=options.concurrent_tests,
+ proc_timeout=PROC_TIMEOUT)
+ if pkg not in NOT_MULTIPROC_SAFE else '')
+
cmds = []
for package in check_packages(options.packages):
cover_package = package.lower()
our_nosetests_args = copy(nosetests_args)
our_nosetests_args.append('--cover-package={}'.format(cover_package))
- cmd = "nosetests {nosetests_args}".format(
+ cmd = "nosetests {pkg_path} {nosetests_args} {multiproc_args}".format(
+ pkg_path=get_pkg_path(package),
nosetests_args=' '.join(our_nosetests_args),
+ multiproc_args=get_multiproc_args(package),
)
cmds.append((cmd, dict(cwd=package)))
- return run_many(cmds, processes=options.num_processes)
+ return run_many(cmds, processes=options.concurrent_suites)
def parse_args():
@@ -113,8 +137,12 @@ def parse_args():
All additional arguments are passed along to nosetests
(e.g. -v --with-coverage)
Note: --cover-package will be set automatically to the appropriate value'''))
- parser.add_argument('-n', help='Number of processes to use at once. Default: # CPUs',
- dest='num_processes', type=int, default=None)
+ parser.add_argument('-n', help='Number of test suites to run concurrently in separate '
+ 'processes. Default: # CPUs / 4',
+ dest='concurrent_suites', type=int, default=CONCURRENT_SUITES)
+ parser.add_argument('-m', help='Number of tests to run concurrently in separate '
+ 'processes, per suite. Default: # CPUs / # concurrent suites',
+ dest='concurrent_tests', type=int, default=CONCURRENT_TESTS)
parser.add_argument('-p', help='List of packages to run tests on. Default: all',
dest='packages', choices=get_packages(), default=get_packages(),
nargs='+')
[16/18] git commit: [#6905] ticket:503 Revert development.ini
Posted by tv...@apache.org.
[#6905] ticket:503 Revert development.ini
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/1e0c1249
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/1e0c1249
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/1e0c1249
Branch: refs/heads/tv/6905
Commit: 1e0c1249f449277c14a12d61962b0cdd535d2bd1
Parents: 462bcfb
Author: Igor Bondarenko <je...@gmail.com>
Authored: Tue Jan 7 08:57:13 2014 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Thu Jan 9 18:41:35 2014 +0000
----------------------------------------------------------------------
Allura/development.ini | 7 -------
1 file changed, 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/1e0c1249/Allura/development.ini
----------------------------------------------------------------------
diff --git a/Allura/development.ini b/Allura/development.ini
index e5ed4f4..edfb794 100644
--- a/Allura/development.ini
+++ b/Allura/development.ini
@@ -33,13 +33,6 @@ error_email_from = paste@localhost
# Used to uniquify references to static resources
build_key=1276635823
-# root directory for tarballs
-scm.repos.tarball.root = /tmp/tarball
-# enable/disable feature
-scm.repos.tarball.enable = false
-# url prefix for tarballs' download urls
-scm.repos.tarball.url_prefix = http://sf-fortytwo-7049.sb.sf.net/p/snapshots/
-
[server:main]
use = egg:Paste#http
host = 0.0.0.0
[02/18] git commit: Add a "Using Allura" section in our docs
Posted by tv...@apache.org.
Add a "Using Allura" section in our docs
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/8c9de147
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/8c9de147
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/8c9de147
Branch: refs/heads/tv/6905
Commit: 8c9de147df7e4c68ef5c180411f6c0285e46770d
Parents: d2baf30
Author: Dave Brondsema <da...@brondsema.net>
Authored: Tue Jan 7 10:16:02 2014 -0500
Committer: Dave Brondsema <da...@brondsema.net>
Committed: Tue Jan 7 10:16:02 2014 -0500
----------------------------------------------------------------------
Allura/docs/index.rst | 8 +++++++
Allura/docs/using.rst | 58 ++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 66 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/8c9de147/Allura/docs/index.rst
----------------------------------------------------------------------
diff --git a/Allura/docs/index.rst b/Allura/docs/index.rst
index 7d8b82f..98fc5cb 100644
--- a/Allura/docs/index.rst
+++ b/Allura/docs/index.rst
@@ -39,6 +39,14 @@ Running Allura
scm_host
migration
+Using Allura
+=====================================================================
+
+.. toctree::
+ :maxdepth: 2
+
+ using
+
Developing Allura
=====================================================================
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/8c9de147/Allura/docs/using.rst
----------------------------------------------------------------------
diff --git a/Allura/docs/using.rst b/Allura/docs/using.rst
new file mode 100644
index 0000000..d9be6fe
--- /dev/null
+++ b/Allura/docs/using.rst
@@ -0,0 +1,58 @@
+.. Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+We don't have much end-user help for Allura yet. SourceForge projects use Allura,
+though, so their support documentation may be useful to anyone using Allura:
+
+Configuring your project
+------------------------
+
+See SourceForge help page: https://sourceforge.net/p/forge/documentation/Create%20a%20New%20Project/
+
+Note there are some SourceForge-specific references that don't apply to other Allura instances.
+
+
+Using tickets
+-------------
+
+See SourceForge help page: https://sourceforge.net/p/forge/documentation/Tickets/
+
+
+Using the wiki
+--------------
+
+See SourceForge help page: https://sourceforge.net/p/forge/documentation/Wiki/
+
+
+Using a discussion forum
+------------------------
+
+See SourceForge help page: https://sourceforge.net/p/forge/documentation/Discussion/
+
+
+Adding an external link
+-----------------------
+
+See SourceForge help page: https://sourceforge.net/p/forge/documentation/External%20Link/
+
+
+Using markdown syntax
+---------------------
+
+Everything in Allura uses Markdown formatting, with several customizations and macros
+specifically for Allura. There are "Formatting Help" buttons throughout Allura for
+easy reference to the Markdown syntax. One such page is https://forge-allura.apache.org/p/allura/wiki/markdown_syntax/
\ No newline at end of file
[18/18] git commit: [#6905] Refactored
Posted by tv...@apache.org.
[#6905] Refactored
Signed-off-by: Tim Van Steenburgh <tv...@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/62f4b4fe
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/62f4b4fe
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/62f4b4fe
Branch: refs/heads/tv/6905
Commit: 62f4b4fec8df16ff387fba2df64e5c3e711959d1
Parents: 3f9104f
Author: Tim Van Steenburgh <tv...@gmail.com>
Authored: Thu Jan 9 17:53:11 2014 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Thu Jan 9 20:34:50 2014 +0000
----------------------------------------------------------------------
Allura/allura/controllers/repository.py | 7 +++--
Allura/allura/lib/decorators.py | 3 +--
Allura/allura/model/monq_model.py | 6 -----
Allura/allura/model/repository.py | 27 ++++++--------------
Allura/allura/tasks/repo_tasks.py | 7 +++--
Allura/allura/templates/repo/tarball.html | 17 ++++++------
.../tests/functional/test_controllers.py | 4 +--
.../forgegit/tests/model/test_repository.py | 11 +++-----
8 files changed, 30 insertions(+), 52 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/62f4b4fe/Allura/allura/controllers/repository.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/repository.py b/Allura/allura/controllers/repository.py
index 0dc1274..2ca33ca 100644
--- a/Allura/allura/controllers/repository.py
+++ b/Allura/allura/controllers/repository.py
@@ -466,10 +466,9 @@ class CommitBrowser(BaseController):
raise exc.HTTPNotFound()
rev = self._commit.url().split('/')[-2]
status = c.app.repo.get_tarball_status(rev, path)
- if status in (None, 'error') and request.method == 'POST':
- allura.tasks.repo_tasks.tarball.post(revision=rev, path=path)
+ if not status and request.method == 'POST':
+ allura.tasks.repo_tasks.tarball.post(rev, path)
redirect('tarball' + '?path={0}'.format(path) if path else '')
- status = 'na' if status in (None, 'error') else status
return dict(commit=self._commit, revision=rev, status=status)
@expose('json:')
@@ -477,7 +476,7 @@ class CommitBrowser(BaseController):
if not asbool(tg.config.get('scm.repos.tarball.enable', False)):
raise exc.HTTPNotFound()
rev = self._commit.url().split('/')[-2]
- return dict(status=c.app.repo.get_tarball_status(rev, path) or 'na')
+ return dict(status=c.app.repo.get_tarball_status(rev, path))
@expose('jinja:allura:templates/repo/log.html')
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/62f4b4fe/Allura/allura/lib/decorators.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/decorators.py b/Allura/allura/lib/decorators.py
index 5810fb0..8604a92 100644
--- a/Allura/allura/lib/decorators.py
+++ b/Allura/allura/lib/decorators.py
@@ -59,8 +59,7 @@ def task(*args, **kw):
kw.get('notifications_disabled') else h.null_contextmanager)
with cm(project):
from allura import model as M
- task_obj = M.MonQTask.post(func, args, kwargs, delay=delay)
- return task_obj
+ return M.MonQTask.post(func, args, kwargs, delay=delay)
# if decorating a class, have to make it a staticmethod
# or it gets a spurious cls argument
func.post = staticmethod(post) if inspect.isclass(func) else post
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/62f4b4fe/Allura/allura/model/monq_model.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/monq_model.py b/Allura/allura/model/monq_model.py
index 7e25f38..c5d3431 100644
--- a/Allura/allura/model/monq_model.py
+++ b/Allura/allura/model/monq_model.py
@@ -76,12 +76,7 @@ class MonQTask(MappedClass):
# have an index on task_name
'state', 'task_name', 'time_queue'
],
- [
- # used while user quering snapsot
- 'kwargs.revision', 'kwargs.path'
- ],
'args',
- 'time_queue',
]
_id = FieldProperty(S.ObjectId)
@@ -252,7 +247,6 @@ class MonQTask(MappedClass):
old_cuser = getattr(c, 'user', None)
try:
func = self.function
- func.task_id = str(self._id)
c.project = M.Project.query.get(_id=self.context.project_id)
c.app = None
if c.project:
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/62f4b4fe/Allura/allura/model/repository.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/repository.py b/Allura/allura/model/repository.py
index 93e012e..252210e 100644
--- a/Allura/allura/model/repository.py
+++ b/Allura/allura/model/repository.py
@@ -357,31 +357,20 @@ class Repository(Artifact, ActivityObject):
filename)
return urljoin(tg.config.get('scm.repos.tarball.url_prefix', '/'), r)
- def get_tarball_status(self, revision, path=None, task_id=None):
+ def get_tarball_status(self, revision, path=None):
pathname = os.path.join(self.tarball_path, self.tarball_filename(revision, path))
filename = '%s%s' % (pathname, '.zip')
- tmpfilename = '%s%s' % (pathname, '.tmp')
-
- # check for state of task in MonQTask
- path = '' if path is None else path
- task_query = MonQTask.query.find({
- 'task_name': 'allura.tasks.repo_tasks.tarball',
- '$or': [
- {'kwargs.path': path, 'kwargs.revision': revision},
- {'args':[revision, path]}]})
- task = task_query.sort(
- [('time_queue', pymongo.DESCENDING),]).limit(1).first()
-
if os.path.isfile(filename):
return 'complete'
- if not task or \
- (task.state == 'complete' and not os.path.isfile(filename)):
- return None
- if task.state == 'busy' and str(task._id) == task_id:
- return 'self'
+ # file doesn't exist, check for busy task
+ task = MonQTask.query.get(**{
+ 'task_name': 'allura.tasks.repo_tasks.tarball',
+ 'args': [revision, path or ''],
+ 'state': {'$in': ['busy', 'ready']},
+ })
- return task.state
+ return task.state if task else None
def __repr__(self): # pragma no cover
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/62f4b4fe/Allura/allura/tasks/repo_tasks.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tasks/repo_tasks.py b/Allura/allura/tasks/repo_tasks.py
index ab0a430..978f027 100644
--- a/Allura/allura/tasks/repo_tasks.py
+++ b/Allura/allura/tasks/repo_tasks.py
@@ -120,13 +120,12 @@ def reclone_repo(*args, **kwargs):
g.post_event('repo_clone_task_failed', source_url, source_path, traceback.format_exc())
@task
-def tarball(revision=None, path=None):
+def tarball(revision, path):
log = logging.getLogger(__name__)
if revision:
repo = c.app.repo
- status = repo.get_tarball_status(revision, path,
- task_id=tarball.task_id)
- if status in ('busy', 'complete'):
+ status = repo.get_tarball_status(revision, path)
+ if status == 'complete':
log.info('Skipping snapshot for repository: %s:%s rev %s because it is already %s' %
(c.project.shortname, c.app.config.options.mount_point, revision, status))
else:
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/62f4b4fe/Allura/allura/templates/repo/tarball.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/repo/tarball.html b/Allura/allura/templates/repo/tarball.html
index d95c7e2..92b7af4 100644
--- a/Allura/allura/templates/repo/tarball.html
+++ b/Allura/allura/templates/repo/tarball.html
@@ -53,25 +53,27 @@ Commit <a href="{{commit.url()}}">{{commit.shorthand_id()}}</a> {{commit_labels(
left: 10 // Left position relative to parent in px
};
var spinner = new Spinner(opts).spin($('#snapshot_status')[0]);
- var delay = 500;
+ var delay = 500, elapsed = 0;
+ $('#snapshot_status h2.busy').show();
function check_status() {
$.get('{{commit.url()}}tarball_status?path={{path}}', function(data) {
if (data.status === 'complete') {
spinner.stop();
$('#snapshot_status h2').hide();
- $('#snapshot_status h2.' + data.status).show();
+ $('#snapshot_status h2.complete').show();
{% if 'no-redirect' not in request.params %}
window.location.href = '{{c.app.repo.tarball_url(revision, path)}}';
{% endif %}
} else {
- $('#snapshot_status h2').hide();
- if (data.status === 'na' || data.status === 'error') {
- spinner.stop();
+ if (data.status === 'ready' || data.status === 'busy') {
+ // keep waiting
+ } else if (data.status === 'error' || elapsed > 5000) {
// something went wrong
+ spinner.stop();
+ $('#snapshot_status h2').hide();
$('#snapshot_status form').show();
- } else {
- $('#snapshot_status h2.busy').show();
}
+ elapsed += delay;
if (delay < 60000){
delay = delay * 2;
}
@@ -90,7 +92,6 @@ Commit <a href="{{commit.url()}}">{{commit.shorthand_id()}}</a> {{commit_labels(
<div id='snapshot_status'>
<h2 class="busy">Generating snapshot...</h2>
<h2 class="complete">Your download will begin shortly, or use this <a href="{{c.app.repo.tarball_url(revision, path)}}">direct link</a>.</h2>
- <h2 class="na">Checking snapshot status...</h2>
<form action="tarball" method="post">
<p>We're having trouble finding that snapshot. Would you like to resubmit?</p>
<input type="hidden" name="path" value="{{path}}" />
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/62f4b4fe/ForgeGit/forgegit/tests/functional/test_controllers.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/functional/test_controllers.py b/ForgeGit/forgegit/tests/functional/test_controllers.py
index 495187a..f1c8a49 100644
--- a/ForgeGit/forgegit/tests/functional/test_controllers.py
+++ b/ForgeGit/forgegit/tests/functional/test_controllers.py
@@ -346,9 +346,9 @@ class TestRootController(_TestCase):
assert '/p/test/src-git/ci/master/tarball' in r
assert 'Download Snapshot' in r
r = self.app.post('/p/test/src-git/ci/master/tarball').follow()
- assert 'Checking snapshot status...' in r
+ assert 'Generating snapshot...' in r
r = self.app.get('/p/test/src-git/ci/master/tarball')
- assert 'Checking snapshot status...' in r
+ assert 'Generating snapshot...' in r
M.MonQTask.run_ready()
ThreadLocalORMSession.flush_all()
r = self.app.get(ci + 'tarball_status')
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/62f4b4fe/ForgeGit/forgegit/tests/model/test_repository.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/model/test_repository.py b/ForgeGit/forgegit/tests/model/test_repository.py
index 3680846..33875bd 100644
--- a/ForgeGit/forgegit/tests/model/test_repository.py
+++ b/ForgeGit/forgegit/tests/model/test_repository.py
@@ -411,14 +411,11 @@ class TestGitRepo(unittest.TestCase, RepoImplTestBase):
# task created
assert_equal(self.repo.get_tarball_status('HEAD'), 'ready')
- task = M.MonQTask.query.find({
+ task = M.MonQTask.query.get(**{
'task_name': 'allura.tasks.repo_tasks.tarball',
- '$or': [
- {'kwargs':
- {'path': '',
- 'revision': 'HEAD'}},
- {'args':['HEAD', '']}]
- }).sort([('time_queue', pymongo.DESCENDING),]).limit(1).first()
+ 'args': ['HEAD', ''],
+ 'state': {'$in': ['busy', 'ready']},
+ })
# task is running
task.state = 'busy'
[10/18] git commit: [#4397] bump activitystream version
Posted by tv...@apache.org.
[#4397] bump activitystream version
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/21d27abc
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/21d27abc
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/21d27abc
Branch: refs/heads/tv/6905
Commit: 21d27abcae7e93f6dc898f6b7d77c6e50ba54fa9
Parents: dca0666
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Wed Jan 8 16:52:05 2014 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Wed Jan 8 18:35:26 2014 +0000
----------------------------------------------------------------------
requirements-common.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/21d27abc/requirements-common.txt
----------------------------------------------------------------------
diff --git a/requirements-common.txt b/requirements-common.txt
index 5ffd19f..e200f77 100644
--- a/requirements-common.txt
+++ b/requirements-common.txt
@@ -1,7 +1,7 @@
# requirements for all deployment environments
pytz==2012j
-ActivityStream==0.1.6
+ActivityStream==0.1.7
BeautifulSoup==3.2.0
chardet==1.0.1
colander==0.9.3
[14/18] git commit: [#6905] ticket:503 Fix tarball generation
Posted by tv...@apache.org.
[#6905] ticket:503 Fix tarball generation
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/462bcfb5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/462bcfb5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/462bcfb5
Branch: refs/heads/tv/6905
Commit: 462bcfb5dbc49cac097f33690446960e1b5c6494
Parents: da8258d
Author: Mykola Kharechko <cr...@gmail.com>
Authored: Fri Jan 3 14:26:35 2014 +0200
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Thu Jan 9 18:41:35 2014 +0000
----------------------------------------------------------------------
Allura/allura/controllers/repository.py | 5 +--
Allura/allura/lib/decorators.py | 3 +-
Allura/allura/model/monq_model.py | 6 ++++
Allura/allura/model/repository.py | 27 +++++++++++---
Allura/allura/tasks/repo_tasks.py | 5 +--
Allura/allura/templates/repo/tarball.html | 10 +++---
Allura/development.ini | 7 ++++
.../tests/functional/test_controllers.py | 4 +--
.../forgegit/tests/model/test_repository.py | 37 +++++++++++++++++---
9 files changed, 83 insertions(+), 21 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/462bcfb5/Allura/allura/controllers/repository.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/repository.py b/Allura/allura/controllers/repository.py
index d0e78e2..0dc1274 100644
--- a/Allura/allura/controllers/repository.py
+++ b/Allura/allura/controllers/repository.py
@@ -466,10 +466,11 @@ class CommitBrowser(BaseController):
raise exc.HTTPNotFound()
rev = self._commit.url().split('/')[-2]
status = c.app.repo.get_tarball_status(rev, path)
- if status is None and request.method == 'POST':
+ if status in (None, 'error') and request.method == 'POST':
allura.tasks.repo_tasks.tarball.post(revision=rev, path=path)
redirect('tarball' + '?path={0}'.format(path) if path else '')
- return dict(commit=self._commit, revision=rev, status=status or 'na')
+ status = 'na' if status in (None, 'error') else status
+ return dict(commit=self._commit, revision=rev, status=status)
@expose('json:')
def tarball_status(self, path=None, **kw):
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/462bcfb5/Allura/allura/lib/decorators.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/decorators.py b/Allura/allura/lib/decorators.py
index 8604a92..5810fb0 100644
--- a/Allura/allura/lib/decorators.py
+++ b/Allura/allura/lib/decorators.py
@@ -59,7 +59,8 @@ def task(*args, **kw):
kw.get('notifications_disabled') else h.null_contextmanager)
with cm(project):
from allura import model as M
- return M.MonQTask.post(func, args, kwargs, delay=delay)
+ task_obj = M.MonQTask.post(func, args, kwargs, delay=delay)
+ return task_obj
# if decorating a class, have to make it a staticmethod
# or it gets a spurious cls argument
func.post = staticmethod(post) if inspect.isclass(func) else post
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/462bcfb5/Allura/allura/model/monq_model.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/monq_model.py b/Allura/allura/model/monq_model.py
index faac14b..f38c073 100644
--- a/Allura/allura/model/monq_model.py
+++ b/Allura/allura/model/monq_model.py
@@ -76,6 +76,11 @@ class MonQTask(MappedClass):
# have an index on task_name
'state', 'task_name', 'time_queue'
],
+ [
+ # used while user quering snapsot
+ 'kwargs.revision', 'kwargs.path'
+ ],
+ 'args',
]
_id = FieldProperty(S.ObjectId)
@@ -246,6 +251,7 @@ class MonQTask(MappedClass):
old_cuser = getattr(c, 'user', None)
try:
func = self.function
+ func.task_id = str(self._id)
c.project = M.Project.query.get(_id=self.context.project_id)
c.app = None
if c.project:
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/462bcfb5/Allura/allura/model/repository.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/repository.py b/Allura/allura/model/repository.py
index 06ade3f..93e012e 100644
--- a/Allura/allura/model/repository.py
+++ b/Allura/allura/model/repository.py
@@ -39,6 +39,7 @@ import tg
from paste.deploy.converters import asbool, asint
from pylons import tmpl_context as c
from pylons import app_globals as g
+import pymongo
import pymongo.errors
from ming import schema as S
@@ -56,6 +57,7 @@ from .notification import Notification
from .repo_refresh import refresh_repo, unknown_commit_ids as unknown_commit_ids_repo
from .repo import CommitRunDoc, QSIZE
from .timeline import ActivityObject
+from .monq_model import MonQTask
log = logging.getLogger(__name__)
config = utils.ConfigProxy(
@@ -355,15 +357,32 @@ class Repository(Artifact, ActivityObject):
filename)
return urljoin(tg.config.get('scm.repos.tarball.url_prefix', '/'), r)
- def get_tarball_status(self, revision, path=None):
+ def get_tarball_status(self, revision, path=None, task_id=None):
pathname = os.path.join(self.tarball_path, self.tarball_filename(revision, path))
filename = '%s%s' % (pathname, '.zip')
tmpfilename = '%s%s' % (pathname, '.tmp')
+ # check for state of task in MonQTask
+ path = '' if path is None else path
+ task_query = MonQTask.query.find({
+ 'task_name': 'allura.tasks.repo_tasks.tarball',
+ '$or': [
+ {'kwargs.path': path, 'kwargs.revision': revision},
+ {'args':[revision, path]}]})
+ task = task_query.sort(
+ [('time_queue', pymongo.DESCENDING),]).limit(1).first()
+
if os.path.isfile(filename):
- return 'ready'
- elif os.path.isfile(tmpfilename):
- return 'busy'
+ return 'complete'
+
+ if not task or \
+ (task.state == 'complete' and not os.path.isfile(filename)):
+ return None
+ if task.state == 'busy' and str(task._id) == task_id:
+ return 'self'
+
+ return task.state
+
def __repr__(self): # pragma no cover
return '<%s %s>' % (
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/462bcfb5/Allura/allura/tasks/repo_tasks.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tasks/repo_tasks.py b/Allura/allura/tasks/repo_tasks.py
index a987228..c4b9296 100644
--- a/Allura/allura/tasks/repo_tasks.py
+++ b/Allura/allura/tasks/repo_tasks.py
@@ -124,8 +124,9 @@ def tarball(revision=None, path=None):
log = logging.getLogger(__name__)
if revision:
repo = c.app.repo
- status = repo.get_tarball_status(revision, path)
- if status:
+ status = repo.get_tarball_status(revision, path,
+ task_id=tarball.task_id)
+ if status in ('busy', 'complete'):
log.info('Skipping snapshot for repository: %s:%s rev %s because it is already %s' %
(c.project.shortname, c.app.config.options.mount_point, revision, status))
else:
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/462bcfb5/Allura/allura/templates/repo/tarball.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/repo/tarball.html b/Allura/allura/templates/repo/tarball.html
index d68430d..21bc7d7 100644
--- a/Allura/allura/templates/repo/tarball.html
+++ b/Allura/allura/templates/repo/tarball.html
@@ -56,7 +56,7 @@ Commit <a href="{{commit.url()}}">{{commit.shorthand_id()}}</a> {{commit_labels(
var delay = 500;
function check_status() {
$.get('{{commit.url()}}tarball_status?path={{path}}', function(data) {
- if (data.status !== 'na') {
+ if (data.status === 'complete') {
spinner.stop();
$('#snapshot_status h2').hide();
$('#snapshot_status h2.' + data.status).show();
@@ -64,13 +64,13 @@ Commit <a href="{{commit.url()}}">{{commit.shorthand_id()}}</a> {{commit_labels(
window.location.href = '{{c.app.repo.tarball_url(revision, path)}}';
{% endif %}
} else {
+ if (data.status === 'na' || data.status === 'error') {
+ // something went wrong
+ $('#snapshot_status form').show();
+ }
if (delay < 60000){
delay = delay * 2;
}
- if (delay >= 16000) {
- // we've been waiting at least 15 seconds
- $('#snapshot_status form').show();
- }
window.setTimeout(check_status, delay);
}
});
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/462bcfb5/Allura/development.ini
----------------------------------------------------------------------
diff --git a/Allura/development.ini b/Allura/development.ini
index edfb794..e5ed4f4 100644
--- a/Allura/development.ini
+++ b/Allura/development.ini
@@ -33,6 +33,13 @@ error_email_from = paste@localhost
# Used to uniquify references to static resources
build_key=1276635823
+# root directory for tarballs
+scm.repos.tarball.root = /tmp/tarball
+# enable/disable feature
+scm.repos.tarball.enable = false
+# url prefix for tarballs' download urls
+scm.repos.tarball.url_prefix = http://sf-fortytwo-7049.sb.sf.net/p/snapshots/
+
[server:main]
use = egg:Paste#http
host = 0.0.0.0
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/462bcfb5/ForgeGit/forgegit/tests/functional/test_controllers.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/functional/test_controllers.py b/ForgeGit/forgegit/tests/functional/test_controllers.py
index 9a78579..495187a 100644
--- a/ForgeGit/forgegit/tests/functional/test_controllers.py
+++ b/ForgeGit/forgegit/tests/functional/test_controllers.py
@@ -352,9 +352,9 @@ class TestRootController(_TestCase):
M.MonQTask.run_ready()
ThreadLocalORMSession.flush_all()
r = self.app.get(ci + 'tarball_status')
- assert '{"status": "ready"}' in r
+ assert '{"status": "complete"}' in r
r = self.app.get('/p/test/src-git/ci/master/tarball_status')
- assert '{"status": "ready"}' in r
+ assert '{"status": "complete"}' in r
r = self.app.get('/p/test/src-git/ci/master/tarball')
assert 'Your download will begin shortly' in r
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/462bcfb5/ForgeGit/forgegit/tests/model/test_repository.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/model/test_repository.py b/ForgeGit/forgegit/tests/model/test_repository.py
index 4f4f56f..3680846 100644
--- a/ForgeGit/forgegit/tests/model/test_repository.py
+++ b/ForgeGit/forgegit/tests/model/test_repository.py
@@ -24,6 +24,8 @@ import unittest
import pkg_resources
import datetime
+import pymongo
+
import mock
from pylons import tmpl_context as c, app_globals as g
import tg
@@ -34,6 +36,7 @@ from testfixtures import TempDirectory
from alluratest.controller import setup_basic_test, setup_global_objects
from allura.lib import helpers as h
+from allura.tasks.repo_tasks import tarball
from allura.tests import decorators as td
from allura.tests.model.test_repo import RepoImplTestBase
from allura import model as M
@@ -394,13 +397,37 @@ class TestGitRepo(unittest.TestCase, RepoImplTestBase):
if os.path.isdir(os.path.join(tmpdir, "git/t/te/test/testgit.git/test-src-git-HEAD/")):
os.removedirs(os.path.join(tmpdir, "git/t/te/test/testgit.git/test-src-git-HEAD/"))
self.repo.tarball('HEAD')
+ assert_equal(self.repo.get_tarball_status('HEAD'), 'complete')
+
+ os.remove(os.path.join(tmpdir, "git/t/te/test/testgit.git/test-src-git-HEAD.zip"))
+ assert_equal(self.repo.get_tarball_status('HEAD'), None)
+
+ def test_tarball_status_task(self):
+ assert_equal(self.repo.get_tarball_status('HEAD'), None)
+
+ # create tarball task in MonQTask and check get_tarball_status
+ tarball.post('HEAD', '')
+
+ # task created
assert_equal(self.repo.get_tarball_status('HEAD'), 'ready')
- os.rename(os.path.join(tmpdir, "git/t/te/test/testgit.git/test-src-git-HEAD.zip"),
- os.path.join(tmpdir, "git/t/te/test/testgit.git/test-src-git-HEAD.tmp"))
+
+ task = M.MonQTask.query.find({
+ 'task_name': 'allura.tasks.repo_tasks.tarball',
+ '$or': [
+ {'kwargs':
+ {'path': '',
+ 'revision': 'HEAD'}},
+ {'args':['HEAD', '']}]
+ }).sort([('time_queue', pymongo.DESCENDING),]).limit(1).first()
+
+ # task is running
+ task.state = 'busy'
+ task.query.session.flush_all()
assert_equal(self.repo.get_tarball_status('HEAD'), 'busy')
- os.remove(os.path.join(tmpdir, "git/t/te/test/testgit.git/test-src-git-HEAD.tmp"))
- assert_equal(self.repo.get_tarball_status('HEAD'), None)
- os.makedirs(os.path.join(tmpdir, "git/t/te/test/testgit.git/test-src-git-HEAD"))
+
+ # when state is complete, but file don't exists, then status is None
+ task.state = 'complete'
+ task.query.session.flush_all()
assert_equal(self.repo.get_tarball_status('HEAD'), None)
def test_is_empty(self):
[15/18] git commit: [#6905] ticket:503 Fix UX
Posted by tv...@apache.org.
[#6905] ticket:503 Fix UX
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/3f9104fa
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/3f9104fa
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/3f9104fa
Branch: refs/heads/tv/6905
Commit: 3f9104fa92aba61a56fb6fc0100fcb383fcce806
Parents: 754b009
Author: Igor Bondarenko <je...@gmail.com>
Authored: Wed Jan 8 11:38:50 2014 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Thu Jan 9 18:41:35 2014 +0000
----------------------------------------------------------------------
Allura/allura/templates/repo/tarball.html | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/3f9104fa/Allura/allura/templates/repo/tarball.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/repo/tarball.html b/Allura/allura/templates/repo/tarball.html
index 05d9386..d95c7e2 100644
--- a/Allura/allura/templates/repo/tarball.html
+++ b/Allura/allura/templates/repo/tarball.html
@@ -64,9 +64,13 @@ Commit <a href="{{commit.url()}}">{{commit.shorthand_id()}}</a> {{commit_labels(
window.location.href = '{{c.app.repo.tarball_url(revision, path)}}';
{% endif %}
} else {
+ $('#snapshot_status h2').hide();
if (data.status === 'na' || data.status === 'error') {
+ spinner.stop();
// something went wrong
$('#snapshot_status form').show();
+ } else {
+ $('#snapshot_status h2.busy').show();
}
if (delay < 60000){
delay = delay * 2;
@@ -85,7 +89,7 @@ Commit <a href="{{commit.url()}}">{{commit.shorthand_id()}}</a> {{commit_labels(
{% set path = request.params.get('path', '') %}
<div id='snapshot_status'>
<h2 class="busy">Generating snapshot...</h2>
- <h2 class="ready">Your download will begin shortly, or use this <a href="{{c.app.repo.tarball_url(revision, path)}}">direct link</a>.</h2>
+ <h2 class="complete">Your download will begin shortly, or use this <a href="{{c.app.repo.tarball_url(revision, path)}}">direct link</a>.</h2>
<h2 class="na">Checking snapshot status...</h2>
<form action="tarball" method="post">
<p>We're having trouble finding that snapshot. Would you like to resubmit?</p>
[17/18] git commit: [#6905] ticket:503 added new index for sort tasks
in monqtask collection. fixed issue related to posibility to download not
complete snapshot
Posted by tv...@apache.org.
[#6905] ticket:503 added new index for sort tasks in monqtask collection. fixed issue related to posibility to download not complete snapshot
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/0b92711b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/0b92711b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/0b92711b
Branch: refs/heads/tv/6905
Commit: 0b92711bad743e5a1510b0da97e84d1dac47d29e
Parents: 1e0c124
Author: Mykola Kharechko <cr...@gmail.com>
Authored: Wed Jan 8 11:13:33 2014 +0200
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Thu Jan 9 18:41:35 2014 +0000
----------------------------------------------------------------------
Allura/allura/model/monq_model.py | 1 +
Allura/allura/tasks/repo_tasks.py | 2 +-
Allura/allura/templates/repo/tarball.html | 3 ++-
3 files changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/0b92711b/Allura/allura/model/monq_model.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/monq_model.py b/Allura/allura/model/monq_model.py
index f38c073..7e25f38 100644
--- a/Allura/allura/model/monq_model.py
+++ b/Allura/allura/model/monq_model.py
@@ -81,6 +81,7 @@ class MonQTask(MappedClass):
'kwargs.revision', 'kwargs.path'
],
'args',
+ 'time_queue',
]
_id = FieldProperty(S.ObjectId)
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/0b92711b/Allura/allura/tasks/repo_tasks.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tasks/repo_tasks.py b/Allura/allura/tasks/repo_tasks.py
index c4b9296..0354eb9 100644
--- a/Allura/allura/tasks/repo_tasks.py
+++ b/Allura/allura/tasks/repo_tasks.py
@@ -132,7 +132,7 @@ def tarball(revision=None, path=None):
else:
try:
repo.tarball(revision, path)
- except:
+ finally:
log.error('Could not create snapshot for repository: %s:%s revision %s path %s' % (c.project.shortname, c.app.config.options.mount_point, revision, path), exc_info=True)
else:
log.warn('Skipped creation of snapshot: %s:%s because revision is not specified' % (c.project.shortname, c.app.config.options.mount_point))
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/0b92711b/Allura/allura/templates/repo/tarball.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/repo/tarball.html b/Allura/allura/templates/repo/tarball.html
index 21bc7d7..3f0581c 100644
--- a/Allura/allura/templates/repo/tarball.html
+++ b/Allura/allura/templates/repo/tarball.html
@@ -29,7 +29,7 @@ Commit <a href="{{commit.url()}}">{{commit.shorthand_id()}}</a> {{commit_labels(
{{ super() }}
<script type="text/javascript">$(function() {
{% set path = request.params.get('path', '') %}
- {% if status == 'ready' %}
+ {% if status == 'complete' %}
{% if 'no-redirect' not in request.params %}
$(document).ready(function() {
window.location.href = '{{c.app.repo.tarball_url(revision, path)}}';
@@ -56,6 +56,7 @@ Commit <a href="{{commit.url()}}">{{commit.shorthand_id()}}</a> {{commit_labels(
var delay = 500;
function check_status() {
$.get('{{commit.url()}}tarball_status?path={{path}}', function(data) {
+ console.log(data)
if (data.status === 'complete') {
spinner.stop();
$('#snapshot_status h2').hide();
[05/18] git commit: Fixed intermittently failing test
Posted by tv...@apache.org.
Fixed intermittently failing test
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/dd3b5a82
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/dd3b5a82
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/dd3b5a82
Branch: refs/heads/tv/6905
Commit: dd3b5a824dee17784929b2526b0b2122df22ba25
Parents: d4c06e8
Author: Cory Johns <cj...@slashdotmedia.com>
Authored: Tue Jan 7 18:02:26 2014 +0000
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Tue Jan 7 18:02:26 2014 +0000
----------------------------------------------------------------------
Allura/allura/model/repository.py | 2 +-
Allura/allura/tests/model/test_repo.py | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/dd3b5a82/Allura/allura/model/repository.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/repository.py b/Allura/allura/model/repository.py
index 7d0fae0..06ade3f 100644
--- a/Allura/allura/model/repository.py
+++ b/Allura/allura/model/repository.py
@@ -237,7 +237,7 @@ class RepositoryImplementation(object):
try:
commit_id = commit._id
while paths and commit_id:
- if time() - start_time > timeout:
+ if time() - start_time >= timeout:
log.error('last_commit_ids timeout for %s on %s', commit._id, ', '.join(paths))
break
commit_id, changes = self._get_last_commit(commit._id, paths)
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/dd3b5a82/Allura/allura/tests/model/test_repo.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/model/test_repo.py b/Allura/allura/tests/model/test_repo.py
index edc76b2..a2a66ff 100644
--- a/Allura/allura/tests/model/test_repo.py
+++ b/Allura/allura/tests/model/test_repo.py
@@ -327,7 +327,7 @@ class TestLastCommit(unittest.TestCase):
commit1 = self._add_commit('Commit 1', ['file1'])
commit2 = self._add_commit('Commit 2', ['file1', 'dir1/file1'], ['dir1/file1'], [commit1])
commit3 = self._add_commit('Commit 3', ['file1', 'dir1/file1', 'file2'], ['file2'], [commit2])
- with h.push_config(config, lcd_timeout=0):
+ with h.push_config(config, lcd_timeout=-1000):
lcd = M.repo.LastCommit.get(commit3.tree)
self.assertEqual(self.repo._commits[lcd.commit_id].message, commit3.message)
self.assertEqual(lcd.commit_id, commit3._id)