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 2014/01/10 16:57:58 UTC

[01/16] git commit: [#7028] Change class name

Updated Branches:
  refs/heads/cj/7005 e5fe9c3b5 -> 1191631c0 (forced update)


[#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/cj/7005
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.


[06/16] git commit: [#6905] ticket:503 Fix UX

Posted by jo...@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/cj/7005
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>


[08/16] git commit: [#6905] ticket:503 Fix tarball generation

Posted by jo...@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/cj/7005
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):


[14/16] git commit: [#6993] Fixed hidden arg error prevent GH attachments from importing

Posted by jo...@apache.org.
[#6993] Fixed hidden arg error prevent GH attachments from importing

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/16230977
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/16230977
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/16230977

Branch: refs/heads/cj/7005
Commit: 16230977141b544845f2ac1a5a5404b37330f1c2
Parents: 86fca2f
Author: Cory Johns <cj...@slashdotmedia.com>
Authored: Thu Jan 9 21:31:48 2014 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Thu Jan 9 22:51:40 2014 +0000

----------------------------------------------------------------------
 ForgeImporters/forgeimporters/github/tracker.py | 38 ++++++++++++++------
 .../forgeimporters/tests/github/test_tracker.py | 25 +++++++++++--
 2 files changed, 49 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/16230977/ForgeImporters/forgeimporters/github/tracker.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/github/tracker.py b/ForgeImporters/forgeimporters/github/tracker.py
index 31ed344..db16c83 100644
--- a/ForgeImporters/forgeimporters/github/tracker.py
+++ b/ForgeImporters/forgeimporters/github/tracker.py
@@ -16,7 +16,9 @@
 #       under the License.
 
 import re
+import logging
 from datetime import datetime
+from urllib2 import HTTPError
 
 try:
     from cStringIO import StringIO
@@ -52,6 +54,9 @@ from forgeimporters.base import ToolImportForm
 from forgeimporters.github.utils import GitHubMarkdownConverter
 
 
+log = logging.getLogger(__name__)
+
+
 class GitHubTrackerImportForm(ToolImportForm):
     gh_project_name = fev.UnicodeString(not_empty=True)
     gh_user_name = fev.UnicodeString(not_empty=True)
@@ -127,7 +132,7 @@ class GitHubTrackerImporter(ToolImporter):
                         ticket_num=ticket_num,
                         import_id=import_id_converter.expand(ticket_num, app)
                     )
-                    self.process_fields(ticket, issue)
+                    self.process_fields(extractor, ticket, issue)
                     self.process_comments(extractor, ticket, issue)
                     self.process_events(extractor, ticket, issue)
                     self.process_milestones(ticket, issue)
@@ -153,7 +158,7 @@ class GitHubTrackerImporter(ToolImporter):
     def get_user_link(self, user):
         return u'[{0}](https://github.com/{0})'.format(user)
 
-    def process_fields(self, ticket, issue):
+    def process_fields(self, extractor, ticket, issue):
         ticket.summary = issue['title']
         ticket.status = issue['state']
         ticket.created_date = self.parse_datetime(issue['created_at'])
@@ -164,7 +169,7 @@ class GitHubTrackerImporter(ToolImporter):
         else:
             owner_line = ''
         # body processing happens here
-        body, attachments = self._get_attachments(issue['body'])
+        body, attachments = self._get_attachments(extractor, issue['body'])
         ticket.add_multiple_attachments(attachments)
         ticket.description = (
                 u'*Originally created by:* {creator}\n'
@@ -179,7 +184,7 @@ class GitHubTrackerImporter(ToolImporter):
 
     def process_comments(self, extractor, ticket, issue):
         for comment in extractor.iter_comments(issue):
-            body, attachments = self._get_attachments(comment['body'])
+            body, attachments = self._get_attachments(extractor, comment['body'])
             if comment['user']:
                 posted_by = u'*Originally posted by:* {}\n\n'.format(
                     self.get_user_link(comment['user']['login']))
@@ -240,7 +245,7 @@ class GitHubTrackerImporter(ToolImporter):
             })
         return [global_milestones]
 
-    def _get_attachments(self, body):
+    def _get_attachments(self, extractor, body):
         # at github, attachments are images only and are included into comment's body
         # usual syntax is
         # ![cdbpzjc5ex4](https://f.cloud.github.com/assets/979771/1027411/a393ab5e-0e70-11e3-8a38-b93a3df904cf.jpg)\r\n
@@ -258,19 +263,30 @@ class GitHubTrackerImporter(ToolImporter):
             body = body.replace(match.group(0), '')
             # stripping url and extension
             attachments.append(Attachment(
+                extractor,
                 match.group(1),  # url
                 'attach{}.{}'.format(i + 1, match.group(2)) # extension
             ))
         return (body, attachments)
 
 class Attachment(object):
-    def __init__(self, url, filename):
+    def __init__(self, extractor, url, filename):
         self.url = url
         self.filename = filename
         self.type = None
+        file = self.get_file(extractor)
+        if file:
+            # don't set unless valid (add_multiple_attachments uses hasattr)
+            self.file = file
 
-    @property
-    def file(self):
-        fp_ish = GitHubProjectExtractor.urlopen(self.url)
-        fp = StringIO(fp_ish.read())
-        return fp
+    def get_file(self, extractor):
+        try:
+            fp_ish = extractor.urlopen(self.url)
+            fp = StringIO(fp_ish.read())
+            return fp
+        except HTTPError as e:
+            if e.code == 404:
+                log.error('Unable to load attachment: %s', self.url)
+                return None
+            else:
+                raise

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/16230977/ForgeImporters/forgeimporters/tests/github/test_tracker.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/tests/github/test_tracker.py b/ForgeImporters/forgeimporters/tests/github/test_tracker.py
index 9679c6b..b32df0a 100644
--- a/ForgeImporters/forgeimporters/tests/github/test_tracker.py
+++ b/ForgeImporters/forgeimporters/tests/github/test_tracker.py
@@ -17,6 +17,7 @@
 
 from datetime import datetime
 from unittest import TestCase
+from urllib2 import HTTPError
 import mock
 
 from ...github import tracker
@@ -80,9 +81,11 @@ class TestTrackerImporter(TestCase):
         }
         importer = tracker.GitHubTrackerImporter()
         importer.github_markdown_converter = GitHubMarkdownConverter('user', 'project')
+        extractor = mock.Mock()
+        extractor.urlopen().read.return_value = 'data'
         with mock.patch.object(tracker, 'datetime') as dt:
             dt.strptime.side_effect = lambda s,f: s
-            importer.process_fields(ticket, issue)
+            importer.process_fields(extractor, ticket, issue)
             self.assertEqual(ticket.summary, 'title')
             self.assertEqual(ticket.description, '*Originally created by:* [creator](https://github.com/creator)\n*Originally owned by:* [owner](https://github.com/owner)\n\nhello')
             self.assertEqual(ticket.status, 'New')
@@ -116,14 +119,28 @@ class TestTrackerImporter(TestCase):
 
     def test_get_attachments(self):
         importer = tracker.GitHubTrackerImporter()
+        extractor = mock.Mock()
+        extractor.urlopen().read.return_value = 'data'
         body = 'hello\n' \
         '![cdbpzjc5ex4](https://f.cloud.github.com/assets/979771/1027411/a393ab5e-0e70-11e3-8a38-b93a3df904cf.jpg)\r\n' \
         '![screensh0t](http://f.cl.ly/items/13453x43053r2G0d3x0v/Screen%20Shot%202012-04-28%20at%2010.48.17%20AM.png)'
-        new_body, attachments = importer._get_attachments(body)
+        new_body, attachments = importer._get_attachments(extractor, body)
         self.assertEqual(new_body, 'hello\n')
         self.assertEqual(len(attachments), 2)
         self.assertEqual(attachments[0].url, 'https://f.cloud.github.com/assets/979771/1027411/a393ab5e-0e70-11e3-8a38-b93a3df904cf.jpg')
         self.assertEqual(attachments[1].url, 'http://f.cl.ly/items/13453x43053r2G0d3x0v/Screen%20Shot%202012-04-28%20at%2010.48.17%20AM.png')
+        self.assertEqual(attachments[0].file.read(), 'data')
+        self.assertEqual(attachments[1].file.read(), 'data')
+
+    def test_get_attachments_404(self):
+        importer = tracker.GitHubTrackerImporter()
+        extractor = mock.Mock()
+        extractor.urlopen.side_effect = HTTPError('url', 404, 'mock', None, None)
+        body = 'hello\n' \
+            '![cdbpzjc5ex4](https://f.cloud.github.com/assets/979771/1027411/a393ab5e-0e70-11e3-8a38-b93a3df904cf.jpg)\r\n'
+        new_body, attachments = importer._get_attachments(extractor, body)
+        self.assertIsNotNone(attachments[0])
+        assert not hasattr(attachments[0], 'file')
 
     def test_process_comments(self):
         ticket = mock.Mock()
@@ -213,9 +230,11 @@ Hello
         }
         importer = tracker.GitHubTrackerImporter()
         importer.github_markdown_converter = GitHubMarkdownConverter('user', 'project')
+        extractor = mock.Mock()
+        extractor.urlopen().read.return_value = 'data'
         with mock.patch.object(tracker, 'datetime') as dt:
             dt.strptime.side_effect = lambda s,f: s
-            importer.process_fields(ticket, issue)
+            importer.process_fields(extractor, ticket, issue)
         self.assertEqual(ticket.description.strip(), body_converted.strip())
 
     def test_github_markdown_converted_in_comments(self):


[15/16] git commit: [#7005] Added Repository.set_status to ensure long clones or refreshes don't flush stale project data

Posted by jo...@apache.org.
[#7005] Added Repository.set_status to ensure long clones or refreshes don't flush stale project data

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/18b30669
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/18b30669
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/18b30669

Branch: refs/heads/cj/7005
Commit: 18b306691c2c02d46b0512266196f995b36da18e
Parents: 1623097
Author: Cory Johns <cj...@slashdotmedia.com>
Authored: Wed Jan 8 23:50:04 2014 +0000
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Fri Jan 10 15:48:19 2014 +0000

----------------------------------------------------------------------
 Allura/allura/model/repository.py   | 26 ++++++++++++++++++++++----
 ForgeGit/forgegit/model/git_repo.py |  8 +++-----
 ForgeSVN/forgesvn/model/svn.py      |  8 +++-----
 3 files changed, 28 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/18b30669/Allura/allura/model/repository.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/repository.py b/Allura/allura/model/repository.py
index 252210e..1fdbb49 100644
--- a/Allura/allura/model/repository.py
+++ b/Allura/allura/model/repository.py
@@ -572,13 +572,11 @@ class Repository(Artifact, ActivityObject):
         '''Find any new commits in the repository and update'''
         try:
             log.info('... %r analyzing', self)
-            self.status = 'analyzing'
-            session(self).flush(self)
+            self.set_status('analyzing')
             refresh_repo(self, all_commits, notify, new_clone)
         finally:
             log.info('... %s ready', self)
-            self.status = 'ready'
-            session(self).flush(self)
+            self.set_status('ready')
 
     def push_upstream_context(self):
         project, rest=h.find_project(self.upstream_repo.name)
@@ -607,6 +605,26 @@ class Repository(Artifact, ActivityObject):
     def rev_to_commit_id(self, rev):
         raise NotImplementedError, 'rev_to_commit_id'
 
+    def set_status(self, status):
+        '''
+        Update (and flush) the repo status indicator.
+
+        Updates to the repo status (or any Repository field) are considered
+        project updates (because Repositories are Artifacts; see
+        `Artifact.__metaclass__.before_save`) and thus change `last_updated`
+        on `c.project`, which causes `c.project` to be flushed.
+
+        Because repo status changes can come at the end or middle of a long
+        operation, `c.project` can be quite stale, so this flushes and reloads
+        `c.project`.
+        '''
+        from allura.model import Project
+        session(c.project).flush(c.project)
+        session(c.project).expunge(c.project)
+        c.project = Project.query.get(_id=c.project._id)
+        self.status = status
+        session(self).flush(self)
+
 class MergeRequest(VersionedArtifact, ActivityObject):
     statuses=['open', 'merged', 'rejected']
     class __mongometa__:

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/18b30669/ForgeGit/forgegit/model/git_repo.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/model/git_repo.py b/ForgeGit/forgegit/model/git_repo.py
index ae9f63e..f318be6 100644
--- a/ForgeGit/forgegit/model/git_repo.py
+++ b/ForgeGit/forgegit/model/git_repo.py
@@ -138,7 +138,7 @@ class GitImplementation(M.RepositoryImplementation):
             shared='all')
         self.__dict__['_git'] = repo
         self._setup_special_files()
-        self._repo.status = 'ready'
+        self._repo.set_status('ready')
 
     def can_hotcopy(self, source_url):
         enabled = asbool(tg.config.get('scm.git.hotcopy', True))
@@ -148,8 +148,7 @@ class GitImplementation(M.RepositoryImplementation):
 
     def clone_from(self, source_url):
         '''Initialize a repo as a clone of another'''
-        self._repo.status = 'cloning'
-        session(self._repo).flush(self._repo)
+        self._repo.set_status('cloning')
         log.info('Initialize %r as a clone of %s',
                  self._repo, source_url)
         try:
@@ -170,8 +169,7 @@ class GitImplementation(M.RepositoryImplementation):
             self.__dict__['_git'] = repo
             self._setup_special_files(source_url)
         except:
-            self._repo.status = 'ready'
-            session(self._repo).flush(self._repo)
+            self._repo.set_status('ready')
             raise
 
     def commit(self, rev):

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/18b30669/ForgeSVN/forgesvn/model/svn.py
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/model/svn.py b/ForgeSVN/forgesvn/model/svn.py
index f4d0ac0..4dca57f 100644
--- a/ForgeSVN/forgesvn/model/svn.py
+++ b/ForgeSVN/forgesvn/model/svn.py
@@ -191,7 +191,7 @@ class SVNImplementation(M.RepositoryImplementation):
                                  cwd=self._repo.fs_path)
         if not skip_special_files:
             self._setup_special_files()
-        self._repo.status = 'ready'
+        self._repo.set_status('ready')
         # make first commit with dir structure
         if default_dirs:
             tmp_working_dir = tempfile.mkdtemp(prefix='allura-svn-r1-',
@@ -225,8 +225,7 @@ class SVNImplementation(M.RepositoryImplementation):
         p = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE)
         stdout, stderr = p.communicate(input='p\n')
         if p.returncode != 0:
-            self._repo.status = 'ready'
-            session(self._repo).flush(self._repo)
+            self._repo.set_status('ready')
             raise SVNCalledProcessError(cmd, p.returncode, stdout, stderr)
         return stdout, stderr
 
@@ -246,8 +245,7 @@ class SVNImplementation(M.RepositoryImplementation):
                               'hooks', hook_name)
             os.remove(fn)
 
-        self._repo.status = 'importing'
-        session(self._repo).flush(self._repo)
+        self._repo.set_status('importing')
         log.info('Initialize %r as a clone of %s',
                  self._repo, source_url)
 


[07/16] git commit: [#6905] ticket:503 Revert development.ini

Posted by jo...@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/cj/7005
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


[12/16] git commit: [#6905] Update SVN tests to match new tarball logic

Posted by jo...@apache.org.
[#6905] Update SVN tests to match new tarball logic

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/6766c149
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/6766c149
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/6766c149

Branch: refs/heads/cj/7005
Commit: 6766c1493b2e43a5f012b089d3b59c288b34d025
Parents: 62f4b4f
Author: Tim Van Steenburgh <tv...@gmail.com>
Authored: Thu Jan 9 21:28:37 2014 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Thu Jan 9 21:28:37 2014 +0000

----------------------------------------------------------------------
 .../tests/functional/test_controllers.py        | 36 ++++++++++----------
 1 file changed, 18 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/6766c149/ForgeSVN/forgesvn/tests/functional/test_controllers.py
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/tests/functional/test_controllers.py b/ForgeSVN/forgesvn/tests/functional/test_controllers.py
index bd2941b..2cc0b9c 100644
--- a/ForgeSVN/forgesvn/tests/functional/test_controllers.py
+++ b/ForgeSVN/forgesvn/tests/functional/test_controllers.py
@@ -195,13 +195,13 @@ class TestRootController(SVNTestController):
         r = self.app.get('/src/3/tree/')
         assert 'Download Snapshot' in r
         r = self.app.post('/src/3/tarball').follow()
-        assert 'Checking snapshot status...' in r
+        assert 'Generating snapshot...' in r
         r = self.app.get('/src/3/tarball')
-        assert 'Checking snapshot status...' in r
+        assert 'Generating snapshot...' in r
         M.MonQTask.run_ready()
         ThreadLocalORMSession.flush_all()
         r = self.app.get('/src/3/tarball_status')
-        assert '{"status": "ready"}' in r
+        assert '{"status": "complete"}' in r
         r = self.app.get('/src/3/tarball')
         assert 'Your download will begin shortly' in r
 
@@ -210,13 +210,13 @@ class TestRootController(SVNTestController):
         r = self.app.get('/src/6/tree/')
         assert 'Download Snapshot' in r
         r = self.app.post('/src/6/tarball').follow()
-        assert 'Checking snapshot status...' in r
+        assert 'Generating snapshot...' in r
         r = self.app.get('/src/6/tarball')
-        assert 'Checking snapshot status...' in r
+        assert 'Generating snapshot...' in r
         M.MonQTask.run_ready()
         ThreadLocalORMSession.flush_all()
         r = self.app.get('/src/6/tarball_status')
-        assert '{"status": "ready"}' in r
+        assert '{"status": "complete"}' in r
         r = self.app.get('/src/6/tarball')
         assert 'Your download will begin shortly' in r
 
@@ -236,39 +236,39 @@ class TestRootController(SVNTestController):
         assert_equal(form.find('input', attrs=dict(name='path')).get('value'), '/tags/tag-1.0')
 
         r = self.app.get('/p/test/svn-tags/19/tarball_status?path=/tags/tag-1.0')
-        assert_equal(r.json['status'], 'na')
+        assert_equal(r.json['status'], None)
         r = self.app.post('/p/test/svn-tags/19/tarball', dict(path='/tags/tag-1.0')).follow()
-        assert 'Checking snapshot status...' in r
+        assert 'Generating snapshot...' in r
         M.MonQTask.run_ready()
         r = self.app.get('/p/test/svn-tags/19/tarball_status?path=/tags/tag-1.0')
-        assert_equal(r.json['status'], 'ready')
+        assert_equal(r.json['status'], 'complete')
 
         r = self.app.get('/p/test/svn-tags/19/tarball_status?path=/trunk')
-        assert_equal(r.json['status'], 'na')
+        assert_equal(r.json['status'], None)
         r = self.app.post('/p/test/svn-tags/19/tarball', dict(path='/trunk/')).follow()
-        assert 'Checking snapshot status...' in r
+        assert 'Generating snapshot...' in r
         M.MonQTask.run_ready()
         r = self.app.get('/p/test/svn-tags/19/tarball_status?path=/trunk')
-        assert_equal(r.json['status'], 'ready')
+        assert_equal(r.json['status'], 'complete')
 
         r = self.app.get('/p/test/svn-tags/19/tarball_status?path=/branches/aaa/')
-        assert_equal(r.json['status'], 'na')
+        assert_equal(r.json['status'], None)
 
         # All of the following also should be ready because...
         # ...this is essentially the same as trunk snapshot
         r = self.app.get('/p/test/svn-tags/19/tarball_status?path=/trunk/some/path/')
-        assert_equal(r.json['status'], 'ready')
+        assert_equal(r.json['status'], 'complete')
         r = self.app.get('/p/test/svn-tags/19/tarball_status')
-        assert_equal(r.json['status'], 'ready')
+        assert_equal(r.json['status'], 'complete')
         # ...the same as trunk, 'cause concrete tag isn't specified
         r = self.app.get('/p/test/svn-tags/19/tarball_status?path=/tags/')
-        assert_equal(r.json['status'], 'ready')
+        assert_equal(r.json['status'], 'complete')
         # ...the same as trunk, 'cause concrete branch isn't specified
         r = self.app.get('/p/test/svn-tags/19/tarball_status?path=/branches/')
-        assert_equal(r.json['status'], 'ready')
+        assert_equal(r.json['status'], 'complete')
         # ...this is essentially the same as tag snapshot
         r = self.app.get('/p/test/svn-tags/19/tarball_status?path=/tags/tag-1.0/dir')
-        assert_equal(r.json['status'], 'ready')
+        assert_equal(r.json['status'], 'complete')
 
 
 class TestImportController(SVNTestController):


[11/16] git commit: [#6905] Refactored

Posted by jo...@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/cj/7005
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'


[03/16] git commit: [#4397] bump activitystream version

Posted by jo...@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/cj/7005
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


[04/16] git commit: [#4397] Background timeline aggregation

Posted by jo...@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/cj/7005
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)


[05/16] git commit: Update nose-progressive to work with parallel tests

Posted by jo...@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/cj/7005
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
 


[09/16] git commit: [#6905] ticket:503 removed unused debug output

Posted by jo...@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/cj/7005
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();


[02/16] git commit: [#7028] provide help to developers if CSS not loading

Posted by jo...@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/cj/7005
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 }}


[16/16] git commit: [#7005] Fixed test failures due to detatched c.project

Posted by jo...@apache.org.
[#7005] Fixed test failures due to detatched c.project

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/1191631c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/1191631c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/1191631c

Branch: refs/heads/cj/7005
Commit: 1191631c083b096dba41c6b5f0746428c9e51276
Parents: 18b3066
Author: Cory Johns <cj...@slashdotmedia.com>
Authored: Fri Jan 10 15:57:40 2014 +0000
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Fri Jan 10 15:57:40 2014 +0000

----------------------------------------------------------------------
 Allura/allura/model/repository.py | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/1191631c/Allura/allura/model/repository.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/repository.py b/Allura/allura/model/repository.py
index 1fdbb49..886f4ee 100644
--- a/Allura/allura/model/repository.py
+++ b/Allura/allura/model/repository.py
@@ -619,9 +619,11 @@ class Repository(Artifact, ActivityObject):
         `c.project`.
         '''
         from allura.model import Project
-        session(c.project).flush(c.project)
-        session(c.project).expunge(c.project)
-        c.project = Project.query.get(_id=c.project._id)
+        project_session = session(c.project)
+        if project_session:
+            session(c.project).flush(c.project)
+            session(c.project).expunge(c.project)
+            c.project = Project.query.get(_id=c.project._id)
         self.status = status
         session(self).flush(self)
 


[10/16] 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 jo...@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/cj/7005
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();


[13/16] git commit: [#6981] Fix method name

Posted by jo...@apache.org.
[#6981] Fix method 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/86fca2f3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/86fca2f3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/86fca2f3

Branch: refs/heads/cj/7005
Commit: 86fca2f31687dd6a43ae347b0bf41bce0351130a
Parents: 6766c14
Author: Tim Van Steenburgh <tv...@gmail.com>
Authored: Wed Jan 8 16:49:03 2014 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Thu Jan 9 21:37:27 2014 +0000

----------------------------------------------------------------------
 Allura/allura/lib/plugin.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/86fca2f3/Allura/allura/lib/plugin.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/plugin.py b/Allura/allura/lib/plugin.py
index 406ede9..e809fed 100644
--- a/Allura/allura/lib/plugin.py
+++ b/Allura/allura/lib/plugin.py
@@ -923,7 +923,7 @@ class UserPreferencesProvider(object):
         '''
         raise NotImplementedError, 'get_pref'
 
-    def save_pref(self, user, pref_name, pref_value):
+    def set_pref(self, user, pref_name, pref_value):
         '''
         :param user: a :class:`User <allura.model.auth.User>`
         :param str pref_name: