You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by he...@apache.org on 2015/06/29 22:23:05 UTC

[01/20] allura git commit: [#7898] Improve UX for Icon upload/edit

Repository: allura
Updated Branches:
  refs/heads/hs/7894 0dcbe4506 -> f63db7930 (forced update)


[#7898] Improve UX for Icon upload/edit


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

Branch: refs/heads/hs/7894
Commit: 069de217ac320b56a9d9654184ef99fe440edcdf
Parents: 195c0b1
Author: Heith Seewald <hs...@slashdotmedia.com>
Authored: Mon Jun 15 16:49:06 2015 -0400
Committer: Heith Seewald <hs...@slashdotmedia.com>
Committed: Mon Jun 15 16:49:06 2015 -0400

----------------------------------------------------------------------
 .../ext/admin/templates/admin_widgets/metadata_admin.html      | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/069de217/Allura/allura/ext/admin/templates/admin_widgets/metadata_admin.html
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/admin/templates/admin_widgets/metadata_admin.html b/Allura/allura/ext/admin/templates/admin_widgets/metadata_admin.html
index f894be5..16d1349 100644
--- a/Allura/allura/ext/admin/templates/admin_widgets/metadata_admin.html
+++ b/Allura/allura/ext/admin/templates/admin_widgets/metadata_admin.html
@@ -99,9 +99,9 @@
         </div>
       {% else %}
         <div class="viewer">
-          No icon has been created.{% if c.project.is_user_project %} A gravatar image associated with your primary email
-          address will be used instead if you have created one at <a href="http://gravatar.com/">gravatar.com</a>.{% endif %}
-          <a id="edit-icon" href="#" title="Edit"><b data-icon="p" class="ico ico-pencil"></b></a>
+          No {% if c.project.is_user_project %}user{% endif %} icon. <a id="edit-icon" href="#" title="Edit">Upload one <b data-icon="p" class="ico ico-pencil"></b></a>
+        {% if c.project.is_user_project %}<br><small>
+            Or a  <a href="http://gravatar.com/">gravatar.com</a> image will be used if available.</small>{% endif %}
         </div>
       {% endif %}
       <div id="project-icon-upload" class="hidden">


[11/20] allura git commit: [#7873] Clear cache for branches/tags on repo_refresh

Posted by he...@apache.org.
[#7873] Clear cache for branches/tags on repo_refresh


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

Branch: refs/heads/hs/7894
Commit: 0e0de67ed1c9eaec2f5fd3a0bb4411be63b0c7db
Parents: 22fc5d9
Author: Heith Seewald <hs...@slashdotmedia.com>
Authored: Mon Jun 15 08:12:17 2015 -0400
Committer: Heith Seewald <hs...@slashdotmedia.com>
Committed: Thu Jun 25 14:10:57 2015 +0000

----------------------------------------------------------------------
 Allura/allura/model/repo_refresh.py | 9 +++++++++
 1 file changed, 9 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/0e0de67e/Allura/allura/model/repo_refresh.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/repo_refresh.py b/Allura/allura/model/repo_refresh.py
index fca220f..74e79ba 100644
--- a/Allura/allura/model/repo_refresh.py
+++ b/Allura/allura/model/repo_refresh.py
@@ -124,6 +124,15 @@ def refresh_repo(repo, all_commits=False, notify=True, new_clone=False):
             if (i + 1) % 100 == 0:
                 log.info('Compute last commit info %d: %s', (i + 1), ci._id)
 
+    # Clear any existing caches for branches/tags
+    if repo.cached_branches:
+        repo.cached_branches = []
+        session(repo).flush()
+
+    if repo.cached_tags:
+        repo.cached_tags = []
+        session(repo).flush()
+
     if not all_commits and not new_clone:
         for commit in commit_ids:
             new = repo.commit(commit)


[04/20] allura git commit: [#7889] Add parameter to bypass the limit for markdown conversion

Posted by he...@apache.org.
[#7889] Add parameter to bypass the limit for markdown conversion


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

Branch: refs/heads/hs/7894
Commit: a52e33f9c4fd0f5f649f403225a2ca21da812d06
Parents: 9d26281
Author: Heith Seewald <hs...@slashdotmedia.com>
Authored: Mon Jun 15 13:37:03 2015 -0400
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Tue Jun 16 15:59:05 2015 +0000

----------------------------------------------------------------------
 Allura/allura/lib/app_globals.py | 6 +++---
 Allura/development.ini           | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/a52e33f9/Allura/allura/lib/app_globals.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/app_globals.py b/Allura/allura/lib/app_globals.py
index 05fc254..7a13969 100644
--- a/Allura/allura/lib/app_globals.py
+++ b/Allura/allura/lib/app_globals.py
@@ -70,8 +70,8 @@ log = logging.getLogger(__name__)
 
 class ForgeMarkdown(markdown.Markdown):
 
-    def convert(self, source):
-        if len(source) > asint(config.get('markdown_render_max_length', 40000)):
+    def convert(self, source, render_limit=True):
+        if render_limit and len(source) > asint(config.get('markdown_render_max_length', 40000)):
             # if text is too big, markdown can take a long time to process it,
             # so we return it as a plain text
             log.info('Text is too big. Skipping markdown processing')
@@ -113,7 +113,7 @@ class ForgeMarkdown(markdown.Markdown):
 
         # Convert the markdown and time the result.
         start = time.time()
-        html = self.convert(source_text)
+        html = self.convert(source_text, render_limit=False)
         render_time = time.time() - start
 
         threshold = config.get('markdown_cache_threshold')

http://git-wip-us.apache.org/repos/asf/allura/blob/a52e33f9/Allura/development.ini
----------------------------------------------------------------------
diff --git a/Allura/development.ini b/Allura/development.ini
index 20ef1ca..c81ed24 100644
--- a/Allura/development.ini
+++ b/Allura/development.ini
@@ -442,7 +442,7 @@ site_notification.impressions = 0
 ; posts. Remove entirely to cache nothing.
 markdown_cache_threshold = .1
 ; markdown text longer than max length will not be converted to html
-markdown_render_max_length = 999999999
+markdown_render_max_length = 100000
 ; Don't add rel=nofollow to these domains when generating links from Markdown content
 ;nofollow_exempt_domains =
 


[07/20] allura git commit: [#7891] ticket:786 Stop sending zarkov events from Allura

Posted by he...@apache.org.
[#7891] ticket:786 Stop sending zarkov events from Allura


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

Branch: refs/heads/hs/7894
Commit: b71482774b3ff0ae03841fa47a1447eb45da1b5f
Parents: 2e3ac2c
Author: Igor Bondarenko <je...@gmail.com>
Authored: Wed Jun 3 14:38:36 2015 +0000
Committer: Dave Brondsema <da...@brondsema.net>
Committed: Wed Jun 17 10:39:51 2015 -0400

----------------------------------------------------------------------
 Allura/allura/config/middleware.py         |  8 ----
 Allura/allura/lib/app_globals.py           | 47 ----------------------
 Allura/allura/lib/plugin.py                |  1 -
 Allura/allura/lib/zarkov_helpers.py        | 39 ------------------
 Allura/allura/model/project.py             |  7 ----
 Allura/allura/model/session.py             |  7 ----
 Allura/allura/tests/test_zarkov_helpers.py | 53 -------------------------
 Allura/development.ini                     |  5 ---
 8 files changed, 167 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/b7148277/Allura/allura/config/middleware.py
----------------------------------------------------------------------
diff --git a/Allura/allura/config/middleware.py b/Allura/allura/config/middleware.py
index 840a39c..ba07cc4 100644
--- a/Allura/allura/config/middleware.py
+++ b/Allura/allura/config/middleware.py
@@ -117,14 +117,6 @@ def _make_core_app(root, global_conf, full_stack=True, **app_conf):
     # Configure the Pylons environment
     load_environment(global_conf, app_conf)
 
-    if config.get('zarkov.host'):
-        try:
-            import zmq
-        except ImportError:
-            raise ImportError, "Unable to import the zmq library. Please"\
-                               " check that zeromq is installed or comment out"\
-                               " the zarkov.host setting in your ini file."
-
     app = tg.TGApp()
 
     for mw_ep in h.iter_entry_points('allura.middleware'):

http://git-wip-us.apache.org/repos/asf/allura/blob/b7148277/Allura/allura/lib/app_globals.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/app_globals.py b/Allura/allura/lib/app_globals.py
index 7a13969..2a7ee5c 100644
--- a/Allura/allura/lib/app_globals.py
+++ b/Allura/allura/lib/app_globals.py
@@ -62,7 +62,6 @@ from allura.lib import helpers as h
 from allura.lib.widgets import analytics
 from allura.lib.security import Credentials
 from allura.lib.solr import MockSOLR, make_solr_from_config
-from allura.lib.zarkov_helpers import ZarkovClient
 from allura.model.session import artifact_orm_session
 
 log = logging.getLogger(__name__)
@@ -299,9 +298,6 @@ class Globals(object):
         duration = asint(config.get('neighborhood.cache.duration', 0))
         self.neighborhood_cache = NeighborhoodCache(duration)
 
-        # Zarkov logger
-        self._zarkov = None
-
         # Set listeners to update stats
         statslisteners = []
         for name, ep in self.entry_points['stats'].iteritems():
@@ -356,49 +352,6 @@ class Globals(object):
     def post_event(self, topic, *args, **kwargs):
         allura.tasks.event_tasks.event.post(topic, *args, **kwargs)
 
-    def zarkov_event(
-            self, event_type,
-            user=None, neighborhood=None, project=None, app=None,
-            extra=None):
-        context = dict(
-            user=None,
-            neighborhood=None, project=None, tool=None,
-            mount_point=None,
-            is_project_member=False)
-
-        if not config.get('zarkov.host'):
-            return
-
-        user = user or getattr(c, 'user', None)
-        project = project or getattr(c, 'project', None)
-        app = app or getattr(c, 'app', None)
-        if user:
-            context['user'] = user.username
-        if project:
-            context.update(
-                project=project.shortname,
-                neighborhood=project.neighborhood.url_prefix.strip('/'))
-            if user:
-                cred = Credentials.get()
-                if cred is not None:
-                    for pr in cred.user_roles(user._id, project._id).reaching_roles:
-                        if pr.get('name') and pr.get('name')[0] != '*':
-                            context['is_project_member'] = True
-        if app:
-            context.update(
-                tool=app.config.tool_name,
-                mount_point=app.config.options.mount_point)
-
-        try:
-            if self._zarkov is None:
-                self._zarkov = ZarkovClient(
-                    config.get('zarkov.host', 'tcp://127.0.0.1:6543'))
-            self._zarkov.event(event_type, context, extra)
-        except Exception, ex:
-            self._zarkov = None
-            log.error('Error sending zarkov event(%r): %r', ex, dict(
-                type=event_type, context=context, extra=extra))
-
     @LazyProperty
     def theme(self):
         return plugin.ThemeProvider.get()

http://git-wip-us.apache.org/repos/asf/allura/blob/b7148277/Allura/allura/lib/plugin.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/plugin.py b/Allura/allura/lib/plugin.py
index d66704e..3fc5e87 100644
--- a/Allura/allura/lib/plugin.py
+++ b/Allura/allura/lib/plugin.py
@@ -161,7 +161,6 @@ class AuthenticationProvider(object):
             else:
                 self.session['login_expires'] = True
             self.session.save()
-            g.zarkov_event('login', user=user)
             g.statsUpdater.addUserLogin(user)
             user.track_login(self.request)
             # set a non-secure cookie with same expiration as session,

http://git-wip-us.apache.org/repos/asf/allura/blob/b7148277/Allura/allura/lib/zarkov_helpers.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/zarkov_helpers.py b/Allura/allura/lib/zarkov_helpers.py
deleted file mode 100644
index 2f136f2..0000000
--- a/Allura/allura/lib/zarkov_helpers.py
+++ /dev/null
@@ -1,39 +0,0 @@
-#       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.
-
-import calendar
-from datetime import datetime, timedelta
-
-try:
-    import zmq
-except ImportError:
-    zmq = None
-import bson
-
-
-class ZarkovClient(object):
-
-    def __init__(self, addr):
-        context = zmq.Context.instance()
-        self._sock = context.socket(zmq.PUSH)
-        self._sock.connect(addr)
-
-    def event(self, type, context, extra=None):
-        obj = dict(
-            type=type, context=context, extra=extra)
-        self._sock.send(bson.BSON.encode(obj))
-

http://git-wip-us.apache.org/repos/asf/allura/blob/b7148277/Allura/allura/model/project.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/project.py b/Allura/allura/model/project.py
index 2ad3be4..2b0566c 100644
--- a/Allura/allura/model/project.py
+++ b/Allura/allura/model/project.py
@@ -169,12 +169,6 @@ class TroveCategory(MappedClass):
         )
 
 
-class ProjectMapperExtension(MapperExtension):
-
-    def after_insert(self, obj, st, sess):
-        g.zarkov_event('project_create', project=obj)
-
-
 class Project(SearchIndexable, MappedClass, ActivityNode, ActivityObject):
     '''
     Projects contain tools, subprojects, and their own metadata.  They live
@@ -196,7 +190,6 @@ class Project(SearchIndexable, MappedClass, ActivityNode, ActivityObject):
             ('deleted', 'shortname', 'neighborhood_id'),
             ('neighborhood_id', 'is_nbhd_project', 'deleted')]
         unique_indexes = [('neighborhood_id', 'shortname')]
-        extensions = [ProjectMapperExtension]
 
     type_s = 'Project'
 

http://git-wip-us.apache.org/repos/asf/allura/blob/b7148277/Allura/allura/model/session.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/session.py b/Allura/allura/model/session.py
index eb1f4ba..3399456 100644
--- a/Allura/allura/model/session.py
+++ b/Allura/allura/model/session.py
@@ -133,13 +133,6 @@ class ArtifactSessionExtension(ManagedSessionExtension):
                 log.exception(
                     "Failed to update artifact references. Is this a borked project migration?")
             self.update_index(self.objects_deleted, arefs)
-            for obj in self.objects_added:
-                g.zarkov_event('create', extra=obj.index_id())
-            for obj in self.objects_modified:
-                g.zarkov_event('modify', extra=obj.index_id())
-            for obj in self.objects_deleted:
-                g.zarkov_event('delete', extra=obj.index_id())
-
         super(ArtifactSessionExtension, self).after_flush(obj)
 
     def update_index(self, objects_deleted, arefs):

http://git-wip-us.apache.org/repos/asf/allura/blob/b7148277/Allura/allura/tests/test_zarkov_helpers.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/test_zarkov_helpers.py b/Allura/allura/tests/test_zarkov_helpers.py
deleted file mode 100644
index 2a6cb38..0000000
--- a/Allura/allura/tests/test_zarkov_helpers.py
+++ /dev/null
@@ -1,53 +0,0 @@
-# -*- coding: utf-8 -*-
-
-#       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.
-
-import unittest
-from calendar import timegm
-from datetime import datetime
-
-import bson
-import mock
-
-from allura.lib import zarkov_helpers as zh
-
-
-class TestZarkovClient(unittest.TestCase):
-
-    def setUp(self):
-        addr = 'tcp://0.0.0.0:0'
-        ctx = mock.Mock()
-        self.socket = mock.Mock()
-        ctx.socket = mock.Mock(return_value=self.socket)
-        PUSH = mock.Mock()
-        with mock.patch('allura.lib.zarkov_helpers.zmq') as zmq:
-            zmq.PUSH = PUSH
-            zmq.Context.instance.return_value = ctx
-            self.client = zh.ZarkovClient(addr)
-        zmq.Context.instance.assert_called_once_with()
-        ctx.socket.assert_called_once_with(PUSH)
-        self.socket.connect.assert_called_once_with(addr)
-
-    def test_event(self):
-        self.client.event('test', dict(user='testuser'))
-        obj = bson.BSON.encode(dict(
-            type='test',
-            context=dict(user='testuser'),
-            extra=None))
-        self.socket.send.assert_called_once_with(obj)
-

http://git-wip-us.apache.org/repos/asf/allura/blob/b7148277/Allura/development.ini
----------------------------------------------------------------------
diff --git a/Allura/development.ini b/Allura/development.ini
index c81ed24..9146033 100644
--- a/Allura/development.ini
+++ b/Allura/development.ini
@@ -371,11 +371,6 @@ ming.project.uri = mongodb://127.0.0.1:27017/project-data
 ming.project.auto_ensure_indexes = False
 ming.task.uri = mongodb://127.0.0.1:27017/task
 ming.task.auto_ensure_indexes = False
-;ming.zarkov.uri = mongodb://127.0.0.1:27017/zarkov
-;ming.zarkov.auto_ensure_indexes = False
-
-; Zarkov host setting, requires the zarkov and gevent libraries.
-;zarkov.host = tcp://127.0.0.1:9000
 
 ; A float from 0-1 representing a % of requests to measure timing on.
 ; Sampled requests will have timing logged to stats.log (can change file in [handler_timermiddleware] logging section)


[16/20] allura git commit: Merge branch 'hs/7873'

Posted by he...@apache.org.
Merge branch 'hs/7873'


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

Branch: refs/heads/hs/7894
Commit: 702043077cb0c3d68ba06e51cb2bf830124856c6
Parents: 91d225f f39410f
Author: Heith Seewald <hs...@slashdotmedia.com>
Authored: Thu Jun 25 16:03:19 2015 +0000
Committer: Heith Seewald <hs...@slashdotmedia.com>
Committed: Thu Jun 25 16:03:19 2015 +0000

----------------------------------------------------------------------
 Allura/allura/model/repo_refresh.py             | 13 ++++++
 Allura/allura/model/repository.py               |  2 +
 Allura/development.ini                          |  6 +++
 ForgeGit/forgegit/model/git_repo.py             | 45 ++++++++++++++++++--
 .../forgegit/tests/model/test_repository.py     | 13 ++++++
 5 files changed, 76 insertions(+), 3 deletions(-)
----------------------------------------------------------------------



[10/20] allura git commit: [#7873] Pre-cache git branches/tags after repo_refresh

Posted by he...@apache.org.
[#7873] Pre-cache git branches/tags after repo_refresh


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

Branch: refs/heads/hs/7894
Commit: f39410f8cc7fc579866da16f6d51b3feb9ec6913
Parents: 2d21779
Author: Heith Seewald <hs...@slashdotmedia.com>
Authored: Tue Jun 16 14:02:20 2015 -0400
Committer: Heith Seewald <hs...@slashdotmedia.com>
Committed: Thu Jun 25 14:10:57 2015 +0000

----------------------------------------------------------------------
 Allura/allura/model/repo_refresh.py                    | 4 ++++
 Allura/development.ini                                 | 2 +-
 ForgeGit/forgegit/model/git_repo.py                    | 8 +++-----
 ForgeGit/forgegit/tests/functional/test_controllers.py | 5 +----
 ForgeGit/forgegit/tests/model/test_repository.py       | 2 ++
 5 files changed, 11 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/f39410f8/Allura/allura/model/repo_refresh.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/repo_refresh.py b/Allura/allura/model/repo_refresh.py
index 74e79ba..1ca82e8 100644
--- a/Allura/allura/model/repo_refresh.py
+++ b/Allura/allura/model/repo_refresh.py
@@ -132,6 +132,10 @@ def refresh_repo(repo, all_commits=False, notify=True, new_clone=False):
     if repo.cached_tags:
         repo.cached_tags = []
         session(repo).flush()
+    # The first view can be expensive to cache,
+    # so we want to do it here instead of on the first view.
+    repo.get_branches()
+    repo.get_tags()
 
     if not all_commits and not new_clone:
         for commit in commit_ids:

http://git-wip-us.apache.org/repos/asf/allura/blob/f39410f8/Allura/development.ini
----------------------------------------------------------------------
diff --git a/Allura/development.ini b/Allura/development.ini
index 395b9a8..bb2ccab 100644
--- a/Allura/development.ini
+++ b/Allura/development.ini
@@ -298,7 +298,7 @@ scm.import.retry_count = 50
 scm.import.retry_sleep_secs = 5
 
 ; When getting a list of valid references (branches/tags) from a repo, you can cache
-; the resaults in mongo based on a threshold. Set `repo_refs_cache_threshold` (in seconds) and the resulting
+; the results in mongo based on a threshold. Set `repo_refs_cache_threshold` (in seconds) and the resulting
 ; lists will be cached and served from cache on subsequent requests until reset by `repo_refresh`.
 ; Set to 0 to cache all references. Remove entirely to cache nothing.
 repo_refs_cache_threshold = .5

http://git-wip-us.apache.org/repos/asf/allura/blob/f39410f8/ForgeGit/forgegit/model/git_repo.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/model/git_repo.py b/ForgeGit/forgegit/model/git_repo.py
index d9ede88..7d87a09 100644
--- a/ForgeGit/forgegit/model/git_repo.py
+++ b/ForgeGit/forgegit/model/git_repo.py
@@ -545,10 +545,9 @@ class GitImplementation(M.RepositoryImplementation):
         if cache:
             return cache
 
-        ref_list = getattr(self._git, field_name)
-
         refs = []
         start_time = time()
+        ref_list = getattr(self._git, field_name)
         for ref in ref_list:
             try:
                 hex_sha = ref.commit.hexsha
@@ -587,10 +586,9 @@ class GitImplementation(M.RepositoryImplementation):
                 return None  # no valid heads
         return self._git.head.commit.hexsha
 
-    @property
+    @LazyProperty
     def heads(self):
-        """ In git, heads are just branches """
-        return self.branches
+        return self._get_refs('heads')
 
     @LazyProperty
     def branches(self):

http://git-wip-us.apache.org/repos/asf/allura/blob/f39410f8/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 29c6453..917f765 100644
--- a/ForgeGit/forgegit/tests/functional/test_controllers.py
+++ b/ForgeGit/forgegit/tests/functional/test_controllers.py
@@ -390,10 +390,7 @@ class TestRootController(_TestCase):
 
     def test_default_branch(self):
         assert_equal(c.app.default_branch_name, 'master')
-        vv = c.app.repo.set_default_branch('zz')
-        print('-' * 10)
-        print(vv)
-        print('-' * 10)
+        c.app.repo.set_default_branch('zz')
         assert_equal(c.app.default_branch_name, 'zz')
         c.app.repo.set_default_branch('master')
         assert_equal(c.app.default_branch_name, 'master')

http://git-wip-us.apache.org/repos/asf/allura/blob/f39410f8/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 47dc34d..c28daf1 100644
--- a/ForgeGit/forgegit/tests/model/test_repository.py
+++ b/ForgeGit/forgegit/tests/model/test_repository.py
@@ -746,6 +746,7 @@ class TestGitImplementation(unittest.TestCase):
         repo_dir = pkg_resources.resource_filename(
             'forgegit', 'tests/data/testgit.git')
         repo = mock.Mock(full_fs_path=repo_dir)
+        repo.cached_branches = []
         impl = GM.git_repo.GitImplementation(repo)
         self.assertEqual(impl.branches, [
             Object(name='master',
@@ -758,6 +759,7 @@ class TestGitImplementation(unittest.TestCase):
         repo_dir = pkg_resources.resource_filename(
             'forgegit', 'tests/data/testgit.git')
         repo = mock.Mock(full_fs_path=repo_dir)
+        repo.cached_tags = []
         impl = GM.git_repo.GitImplementation(repo)
         self.assertEqual(impl.tags, [
             Object(name='foo',


[09/20] allura git commit: [#7873] Added option to set cache for git references - NEEDS INI

Posted by he...@apache.org.
[#7873] Added option to set cache for git references - NEEDS INI


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

Branch: refs/heads/hs/7894
Commit: 22fc5d9b9b957967ef6038d3fd684cb2f043528c
Parents: 646d665
Author: Heith Seewald <hs...@slashdotmedia.com>
Authored: Mon Jun 15 08:08:26 2015 -0400
Committer: Heith Seewald <hs...@slashdotmedia.com>
Committed: Thu Jun 25 14:10:35 2015 +0000

----------------------------------------------------------------------
 Allura/development.ini | 6 ++++++
 1 file changed, 6 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/22fc5d9b/Allura/development.ini
----------------------------------------------------------------------
diff --git a/Allura/development.ini b/Allura/development.ini
index 9146033..395b9a8 100644
--- a/Allura/development.ini
+++ b/Allura/development.ini
@@ -297,6 +297,12 @@ scm.repos.tarball.zip_binary = /usr/bin/zip
 scm.import.retry_count = 50
 scm.import.retry_sleep_secs = 5
 
+; When getting a list of valid references (branches/tags) from a repo, you can cache
+; the resaults in mongo based on a threshold. Set `repo_refs_cache_threshold` (in seconds) and the resulting
+; lists will be cached and served from cache on subsequent requests until reset by `repo_refresh`.
+; Set to 0 to cache all references. Remove entirely to cache nothing.
+repo_refs_cache_threshold = .5
+
 ; One-click merge is enabled by default, but can be turned off on for each type of repo
 scm.merge.git.disabled = false
 scm.merge.hg.disabled = false


[15/20] allura git commit: Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/allura

Posted by he...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/allura


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

Branch: refs/heads/hs/7894
Commit: 91d225f211f22c11a295413b575513d35e4f2653
Parents: c520d67 b714827
Author: Heith Seewald <hs...@slashdotmedia.com>
Authored: Thu Jun 25 14:43:38 2015 +0000
Committer: Heith Seewald <hs...@slashdotmedia.com>
Committed: Thu Jun 25 14:43:38 2015 +0000

----------------------------------------------------------------------
 Allura/allura/config/middleware.py         |  8 ----
 Allura/allura/controllers/project.py       |  7 +++-
 Allura/allura/lib/app_globals.py           | 53 ++-----------------------
 Allura/allura/lib/plugin.py                |  1 -
 Allura/allura/lib/zarkov_helpers.py        | 39 ------------------
 Allura/allura/model/project.py             |  7 ----
 Allura/allura/model/session.py             |  7 ----
 Allura/allura/tests/test_zarkov_helpers.py | 53 -------------------------
 Allura/development.ini                     |  7 +---
 Dockerfile                                 |  2 +-
 INSTALL.markdown                           |  6 +--
 solr_config/Dockerfile                     |  2 +-
 12 files changed, 15 insertions(+), 177 deletions(-)
----------------------------------------------------------------------



[08/20] allura git commit: [#7873] Performance improvements when accessing tags and branches in git

Posted by he...@apache.org.
[#7873] Performance improvements when accessing tags and branches in git


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

Branch: refs/heads/hs/7894
Commit: 646d665c48a83f1fc7c40d850c58f18d818a3a93
Parents: b714827
Author: Heith Seewald <hs...@slashdotmedia.com>
Authored: Tue May 5 13:47:19 2015 +0000
Committer: Heith Seewald <hs...@slashdotmedia.com>
Committed: Thu Jun 25 14:10:34 2015 +0000

----------------------------------------------------------------------
 ForgeGit/forgegit/git_main.py       |  2 +-
 ForgeGit/forgegit/model/git_repo.py | 32 +++++++++++++++++++++++++++++---
 2 files changed, 30 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/646d665c/ForgeGit/forgegit/git_main.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/git_main.py b/ForgeGit/forgegit/git_main.py
index 62fc0f7..bb19ec3 100644
--- a/ForgeGit/forgegit/git_main.py
+++ b/ForgeGit/forgegit/git_main.py
@@ -66,7 +66,7 @@ class ForgeGitApp(RepositoryApp):
     def repo(self):
         return GM.Repository.query.get(app_config_id=self.config._id)
 
-    @property
+    @LazyProperty
     def default_branch_name(self):
         return self.repo.get_default_branch('master')
 

http://git-wip-us.apache.org/repos/asf/allura/blob/646d665c/ForgeGit/forgegit/model/git_repo.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/model/git_repo.py b/ForgeGit/forgegit/model/git_repo.py
index 416db33..d6e791c 100644
--- a/ForgeGit/forgegit/model/git_repo.py
+++ b/ForgeGit/forgegit/model/git_repo.py
@@ -533,6 +533,32 @@ class GitImplementation(M.RepositoryImplementation):
             return False
 
     @LazyProperty
+    def _is_valid(self):
+        """ Verifies the validity of the reference objects in the git database
+
+        Returns True if no issues are found. This allows us to bypass the individual testing of each ref
+        unless absolutely necessary.
+
+        :rtype: bool
+        """
+        try:
+            self._git.git.fsck(full=True)
+            return True
+        except git.GitCommandError as gce:
+            log.debug(u"Found inconsistency in {}: {}".format(self._repo.name, gce.stderr))
+            return False
+
+    def _get_refs(self, ref_list):
+        """ Returns a list of valid reference objects from the git database
+
+        :return: List of git ref objects.
+        :rtype: list
+        """
+        if self._is_valid:
+            return [Object(name=ref.name, object_id=ref.commit.hexsha) for ref in ref_list]
+        return [Object(name=ref.name, object_id=ref.commit.hexsha) for ref in ref_list if ref.is_valid()]
+
+    @LazyProperty
     def head(self):
         if not self._git or not self._git.heads:
             return None
@@ -549,15 +575,15 @@ class GitImplementation(M.RepositoryImplementation):
 
     @LazyProperty
     def heads(self):
-        return [Object(name=b.name, object_id=b.commit.hexsha) for b in self._git.heads if b.is_valid()]
+        return self._get_refs(self._git.heads)
 
     @LazyProperty
     def branches(self):
-        return [Object(name=b.name, object_id=b.commit.hexsha) for b in self._git.branches if b.is_valid()]
+        return self._get_refs(self._git.branches)
 
     @LazyProperty
     def tags(self):
-        return [Object(name=t.name, object_id=t.commit.hexsha) for t in self._git.tags if t.is_valid()]
+        return self._get_refs(self._git.tags)
 
     def set_default_branch(self, name):
         if not name:


[03/20] allura git commit: Merge branches 'master' and 'master' of https://git-wip-us.apache.org/repos/asf/allura

Posted by he...@apache.org.
Merge branches 'master' and 'master' of https://git-wip-us.apache.org/repos/asf/allura


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

Branch: refs/heads/hs/7894
Commit: c520d677112bbd6842d4c56f7d57439e57be1684
Parents: 9d26281
Author: Heith Seewald <hs...@slashdotmedia.com>
Authored: Tue Jun 16 13:51:43 2015 +0000
Committer: Heith Seewald <hs...@slashdotmedia.com>
Committed: Tue Jun 16 13:51:43 2015 +0000

----------------------------------------------------------------------

----------------------------------------------------------------------



[20/20] allura git commit: [#7894] Fix issue where can_merge updated mod_date

Posted by he...@apache.org.
[#7894] Fix issue where can_merge updated mod_date


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

Branch: refs/heads/hs/7894
Commit: f63db79303cebf0baf86a4a7f504582c1e6ab67d
Parents: c7181de
Author: Heith Seewald <hs...@slashdotmedia.com>
Authored: Mon Jun 29 16:07:56 2015 -0400
Committer: Heith Seewald <hs...@slashdotmedia.com>
Committed: Mon Jun 29 16:22:46 2015 -0400

----------------------------------------------------------------------
 Allura/allura/model/repository.py | 6 ++----
 Allura/allura/tasks/repo_tasks.py | 8 +++++---
 2 files changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/f63db793/Allura/allura/model/repository.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/repository.py b/Allura/allura/model/repository.py
index 3f4799a..bfd447d 100644
--- a/Allura/allura/model/repository.py
+++ b/Allura/allura/model/repository.py
@@ -832,9 +832,6 @@ class MergeRequest(VersionedArtifact, ActivityObject):
             return False
         if self.app.config.options.get('merge_disabled'):
             return False
-
-        _session = artifact_orm_session._get()
-        _session.skip_mod_date = True
         return True
 
     def can_merge_cache_key(self):
@@ -854,7 +851,8 @@ class MergeRequest(VersionedArtifact, ActivityObject):
 
     def set_can_merge_cache(self, val):
         key = self.can_merge_cache_key()
-        self.can_merge_cache[key] = val
+        with utils.skip_mod_date(self):
+            self.can_merge_cache[key] = val
 
     def can_merge(self):
         """

http://git-wip-us.apache.org/repos/asf/allura/blob/f63db793/Allura/allura/tasks/repo_tasks.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tasks/repo_tasks.py b/Allura/allura/tasks/repo_tasks.py
index e44ea94..099f812 100644
--- a/Allura/allura/tasks/repo_tasks.py
+++ b/Allura/allura/tasks/repo_tasks.py
@@ -24,6 +24,7 @@ from ming.odm import session
 
 from allura.lib.decorators import task
 from allura.lib.repository import RepositoryApp
+from allura.lib.utils import skip_mod_date
 
 
 @task
@@ -167,6 +168,7 @@ def merge(merge_request_id):
 @task
 def can_merge(merge_request_id):
     from allura import model as M
-    mr = M.MergeRequest.query.get(_id=merge_request_id)
-    result = mr.app.repo.can_merge(mr)
-    mr.set_can_merge_cache(result)
+    with skip_mod_date(M.MergeRequest):
+        mr = M.MergeRequest.query.get(_id=merge_request_id)
+        result = mr.app.repo.can_merge(mr)
+        mr.set_can_merge_cache(result)


[14/20] allura git commit: [#7873] Add a mongo cache backend to speed up branches/tags

Posted by he...@apache.org.
[#7873] Add a mongo cache backend to speed up branches/tags


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

Branch: refs/heads/hs/7894
Commit: 2d54358bcbe608ab453c17a9765909ffdc9c3a36
Parents: 35d5899
Author: Heith Seewald <hs...@slashdotmedia.com>
Authored: Mon Jun 15 08:24:29 2015 -0400
Committer: Heith Seewald <hs...@slashdotmedia.com>
Committed: Thu Jun 25 14:10:57 2015 +0000

----------------------------------------------------------------------
 ForgeGit/forgegit/git_main.py       |  2 +-
 ForgeGit/forgegit/model/git_repo.py | 63 ++++++++++++++++++++------------
 2 files changed, 40 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/2d54358b/ForgeGit/forgegit/git_main.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/git_main.py b/ForgeGit/forgegit/git_main.py
index bb19ec3..62fc0f7 100644
--- a/ForgeGit/forgegit/git_main.py
+++ b/ForgeGit/forgegit/git_main.py
@@ -66,7 +66,7 @@ class ForgeGitApp(RepositoryApp):
     def repo(self):
         return GM.Repository.query.get(app_config_id=self.config._id)
 
-    @LazyProperty
+    @property
     def default_branch_name(self):
         return self.repo.get_default_branch('master')
 

http://git-wip-us.apache.org/repos/asf/allura/blob/2d54358b/ForgeGit/forgegit/model/git_repo.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/model/git_repo.py b/ForgeGit/forgegit/model/git_repo.py
index d6e791c..d9ede88 100644
--- a/ForgeGit/forgegit/model/git_repo.py
+++ b/ForgeGit/forgegit/model/git_repo.py
@@ -532,31 +532,45 @@ class GitImplementation(M.RepositoryImplementation):
         except KeyError:
             return False
 
-    @LazyProperty
-    def _is_valid(self):
-        """ Verifies the validity of the reference objects in the git database
-
-        Returns True if no issues are found. This allows us to bypass the individual testing of each ref
-        unless absolutely necessary.
+    def _get_refs(self, field_name):
+        """ Returns a list of valid reference objects (branches or tags) from the git database
 
-        :rtype: bool
+        :return: List of git ref objects.
+        :rtype: list
         """
+
+        cache_name = 'cached_' + field_name
+        cache = getattr(self._repo, cache_name, None)
+
+        if cache:
+            return cache
+
+        ref_list = getattr(self._git, field_name)
+
+        refs = []
+        start_time = time()
+        for ref in ref_list:
+            try:
+                hex_sha = ref.commit.hexsha
+            except ValueError:
+                log.debug(u"Found invalid sha: {}".format(ref))
+                continue
+            refs.append(Object(name=ref.name, object_id=hex_sha))
+        time_taken = time() - start_time
+
+        threshold = tg.config.get('repo_refs_cache_threshold')
         try:
-            self._git.git.fsck(full=True)
-            return True
-        except git.GitCommandError as gce:
-            log.debug(u"Found inconsistency in {}: {}".format(self._repo.name, gce.stderr))
-            return False
+            threshold = float(threshold) if threshold else None
+        except ValueError:
+            threshold = None
+            log.warn('Skipping reference caching - The value for config param '
+                     '"repo_refs_cache_threshold" must be a float.')
 
-    def _get_refs(self, ref_list):
-        """ Returns a list of valid reference objects from the git database
+        if threshold is not None and time_taken > threshold:
+            setattr(self._repo, cache_name, refs)
+            session(self._repo).flush(self._repo)
 
-        :return: List of git ref objects.
-        :rtype: list
-        """
-        if self._is_valid:
-            return [Object(name=ref.name, object_id=ref.commit.hexsha) for ref in ref_list]
-        return [Object(name=ref.name, object_id=ref.commit.hexsha) for ref in ref_list if ref.is_valid()]
+        return refs
 
     @LazyProperty
     def head(self):
@@ -573,17 +587,18 @@ class GitImplementation(M.RepositoryImplementation):
                 return None  # no valid heads
         return self._git.head.commit.hexsha
 
-    @LazyProperty
+    @property
     def heads(self):
-        return self._get_refs(self._git.heads)
+        """ In git, heads are just branches """
+        return self.branches
 
     @LazyProperty
     def branches(self):
-        return self._get_refs(self._git.branches)
+        return self._get_refs('branches')
 
     @LazyProperty
     def tags(self):
-        return self._get_refs(self._git.tags)
+        return self._get_refs('tags')
 
     def set_default_branch(self, name):
         if not name:


[06/20] allura git commit: [#7809] ticket:803 Update install instructions to use Ubuntu 14.04

Posted by he...@apache.org.
[#7809] ticket:803 Update install instructions to use Ubuntu 14.04


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

Branch: refs/heads/hs/7894
Commit: 2e3ac2c9d7026037fafa34ac8a7ef9dd340a12d4
Parents: 976b98b
Author: Igor Bondarenko <je...@gmail.com>
Authored: Tue Jun 16 18:06:37 2015 +0300
Committer: Dave Brondsema <da...@brondsema.net>
Committed: Wed Jun 17 10:36:26 2015 -0400

----------------------------------------------------------------------
 Dockerfile             | 2 +-
 INSTALL.markdown       | 6 +++---
 solr_config/Dockerfile | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/2e3ac2c9/Dockerfile
----------------------------------------------------------------------
diff --git a/Dockerfile b/Dockerfile
index 916ed33..12170ef 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -15,7 +15,7 @@
 #       specific language governing permissions and limitations
 #       under the License.
 
-FROM ubuntu:12.04
+FROM ubuntu:14.04
 
 RUN apt-get update && apt-get install -y \
     git-core \

http://git-wip-us.apache.org/repos/asf/allura/blob/2e3ac2c9/INSTALL.markdown
----------------------------------------------------------------------
diff --git a/INSTALL.markdown b/INSTALL.markdown
index d9a64ee..d141988 100644
--- a/INSTALL.markdown
+++ b/INSTALL.markdown
@@ -21,11 +21,11 @@
 
 For a simpler setup using Docker images, see INSTALL-Docker.markdown instead.
 
-In these instructions, we'll use [VirtualBox](http://www.virtualbox.org) and [Ubuntu 12.04](http://ubuntu.com) (11.10 works too) to create a disposable sandbox for Allura development/testing.  Allura should work on other Linux systems (including OSX), but setting up all the dependencies will be different.
+In these instructions, we'll use [VirtualBox](http://www.virtualbox.org) and [Ubuntu 14.04](http://ubuntu.com) (12.04 works too) to create a disposable sandbox for Allura development/testing.  Allura should work on other Linux systems (including OSX), but setting up all the dependencies will be different.
 
 * Download and install [VirtualBox](http://www.virtualbox.org/wiki/Downloads) for your platform.
 
-* Download a minimal [Ubuntu 12.04 64-bit ISO](https://help.ubuntu.com/community/Installation/MinimalCD).
+* Download a minimal [Ubuntu 14.04 64-bit ISO](https://help.ubuntu.com/community/Installation/MinimalCD).
 
 * Create a new virtual machine in Virtual Box, selecting Ubuntu (64 bit) as the OS type.  The rest of the wizards' defaults are fine.
 
@@ -42,7 +42,7 @@ Before we begin, you'll need to install some system packages.
 
     ~$ sudo aptitude install git-core default-jre-headless python-dev libssl-dev libldap2-dev libsasl2-dev libjpeg8-dev zlib1g-dev
 
-To install MongoDB, follow the instructions here: <http://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/>
+To install MongoDB, follow the instructions here: <http://docs.mongodb.org/v2.6/tutorial/install-mongodb-on-ubuntu/>
 
 Optional, for SVN support:
 

http://git-wip-us.apache.org/repos/asf/allura/blob/2e3ac2c9/solr_config/Dockerfile
----------------------------------------------------------------------
diff --git a/solr_config/Dockerfile b/solr_config/Dockerfile
index 107768f..714840c 100644
--- a/solr_config/Dockerfile
+++ b/solr_config/Dockerfile
@@ -15,7 +15,7 @@
 #       specific language governing permissions and limitations
 #       under the License.
 
-FROM ubuntu:12.04
+FROM ubuntu:14.04
 
 RUN apt-get update && apt-get install -y \
     default-jre-headless \


[12/20] allura git commit: [#7873] Add fields to Repository for storing reference cache

Posted by he...@apache.org.
[#7873] Add fields to Repository for storing reference cache


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

Branch: refs/heads/hs/7894
Commit: 35d58999081c4fb2d7cdec61f79e4fd0c531c5e8
Parents: 0e0de67
Author: Heith Seewald <hs...@slashdotmedia.com>
Authored: Mon Jun 15 08:14:38 2015 -0400
Committer: Heith Seewald <hs...@slashdotmedia.com>
Committed: Thu Jun 25 14:10:57 2015 +0000

----------------------------------------------------------------------
 Allura/allura/model/repository.py | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/35d58999/Allura/allura/model/repository.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/repository.py b/Allura/allura/model/repository.py
index 022343f..a3d574c 100644
--- a/Allura/allura/model/repository.py
+++ b/Allura/allura/model/repository.py
@@ -349,6 +349,8 @@ class Repository(Artifact, ActivityObject):
     repo_tags = FieldProperty(S.Deprecated)
     upstream_repo = FieldProperty(dict(name=str, url=str))
     default_branch_name = FieldProperty(str)
+    cached_branches = FieldProperty([dict(name=str, object_id=str)])
+    cached_tags = FieldProperty([dict(name=str, object_id=str)])
 
     def __init__(self, **kw):
         if 'name' in kw and 'tool' in kw:


[17/20] allura git commit: [#7310] "Maxmize view" setting now persists

Posted by he...@apache.org.
[#7310] "Maxmize view" setting now persists


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

Branch: refs/heads/hs/7894
Commit: fbb8da9ea2dca83652faf4a61a8ad99b44e26ffb
Parents: 7020430
Author: Heith Seewald <hs...@slashdotmedia.com>
Authored: Thu Jun 25 15:36:54 2015 -0400
Committer: Heith Seewald <hs...@slashdotmedia.com>
Committed: Thu Jun 25 15:36:54 2015 -0400

----------------------------------------------------------------------
 Allura/allura/public/nf/js/maximize-content.js | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/fbb8da9e/Allura/allura/public/nf/js/maximize-content.js
----------------------------------------------------------------------
diff --git a/Allura/allura/public/nf/js/maximize-content.js b/Allura/allura/public/nf/js/maximize-content.js
index f985741..7202125 100644
--- a/Allura/allura/public/nf/js/maximize-content.js
+++ b/Allura/allura/public/nf/js/maximize-content.js
@@ -17,9 +17,16 @@
        under the License.
 */
 
-$(document).ready(function() {
-    $('#maximize-content, #restore-content').click(function(e) {
+$(document).ready(function () {
+    if ($.cookie('maximizeView') === 'true') {
+        $('body').addClass('content-maximized');
+    }
+    $(".content-maximized").toggle($.cookie('maximizeView') != 'false');
+    $('#maximize-content, #restore-content').click(function (e) {
         $('body').toggleClass('content-maximized');
+        var is_visible = $(".content-maximized").is(":visible") ? 'true' : 'false';
+        $.cookie('maximizeView', is_visible);
+
         e.preventDefault();
         return false;
     });


[19/20] allura git commit: [#7894] Move skip_mod_date into Allura

Posted by he...@apache.org.
[#7894] Move skip_mod_date into Allura


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

Branch: refs/heads/hs/7894
Commit: c7181dee10702386790b7360f644c05bf74ee7e5
Parents: a623be2
Author: Heith Seewald <hs...@slashdotmedia.com>
Authored: Mon Jun 29 14:36:55 2015 -0400
Committer: Heith Seewald <hs...@slashdotmedia.com>
Committed: Mon Jun 29 16:22:45 2015 -0400

----------------------------------------------------------------------
 Allura/allura/lib/utils.py        | 12 ++++++++++++
 Allura/allura/tests/test_utils.py |  8 ++++++++
 2 files changed, 20 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/c7181dee/Allura/allura/lib/utils.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/utils.py b/Allura/allura/lib/utils.py
index 143868e..f812e2e 100644
--- a/Allura/allura/lib/utils.py
+++ b/Allura/allura/lib/utils.py
@@ -14,6 +14,7 @@
 #       KIND, either express or implied.  See the License for the
 #       specific language governing permissions and limitations
 #       under the License.
+from contextlib import contextmanager
 
 import time
 import string
@@ -21,6 +22,7 @@ import hashlib
 import binascii
 import logging.handlers
 import codecs
+from ming.odm import session
 import os.path
 import datetime
 import random
@@ -614,3 +616,13 @@ def clean_phone_number(number):
 def phone_number_hash(number):
     number = clean_phone_number(number)
     return hashlib.sha1(number).hexdigest()
+
+
+@contextmanager
+def skip_mod_date(model_cls):
+    skip_mod_date = getattr(session(model_cls)._get(), 'skip_mod_date', False)
+    session(model_cls)._get().skip_mod_date = True
+    try:
+        yield
+    finally:
+        session(model_cls)._get().skip_mod_date = skip_mod_date
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/allura/blob/c7181dee/Allura/allura/tests/test_utils.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/test_utils.py b/Allura/allura/tests/test_utils.py
index 5043e3d..39d61b3 100644
--- a/Allura/allura/tests/test_utils.py
+++ b/Allura/allura/tests/test_utils.py
@@ -21,6 +21,8 @@ import json
 import time
 import unittest
 import datetime as dt
+from ming.odm import session
+import model as M
 from os import path
 
 from webob import Request
@@ -323,3 +325,9 @@ def test_phone_number_hash():
     hash = utils.phone_number_hash
     assert_equal(hash('1234567890'), hash('+123 456:7890'))
     assert_not_equal(hash('1234567890'), hash('1234567891'))
+
+
+def test_skip_mod_date():
+    with utils.skip_mod_date(M.Artifact):
+        assert getattr(session(M.Artifact)._get(), 'skip_mod_date', None) == True
+    assert getattr(session(M.Artifact)._get(), 'skip_mod_date', None) == False
\ No newline at end of file


[18/20] allura git commit: [#7894] Merge request timestamps are no longer updated incorrectly

Posted by he...@apache.org.
[#7894] Merge request timestamps are no longer updated incorrectly


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

Branch: refs/heads/hs/7894
Commit: a623be212ba29247d5a78189948e4a9f51ff178d
Parents: fbb8da9
Author: Heith Seewald <hs...@slashdotmedia.com>
Authored: Mon Jun 15 16:33:06 2015 -0400
Committer: Heith Seewald <hs...@slashdotmedia.com>
Committed: Mon Jun 29 16:22:45 2015 -0400

----------------------------------------------------------------------
 Allura/allura/model/repository.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/a623be21/Allura/allura/model/repository.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/repository.py b/Allura/allura/model/repository.py
index a3d574c..3f4799a 100644
--- a/Allura/allura/model/repository.py
+++ b/Allura/allura/model/repository.py
@@ -56,7 +56,8 @@ from .timeline import ActivityObject
 from .monq_model import MonQTask
 from .project import AppConfig
 from .session import main_doc_session
-from .session import repository_orm_session
+from .session import repository_orm_session, artifact_orm_session
+
 
 log = logging.getLogger(__name__)
 config = utils.ConfigProxy(
@@ -831,6 +832,9 @@ class MergeRequest(VersionedArtifact, ActivityObject):
             return False
         if self.app.config.options.get('merge_disabled'):
             return False
+
+        _session = artifact_orm_session._get()
+        _session.skip_mod_date = True
         return True
 
     def can_merge_cache_key(self):


[05/20] allura git commit: [#7890] ticket:801 Ensure Ming's session contains neighborhood, before changing it

Posted by he...@apache.org.
[#7890] ticket:801 Ensure Ming's session contains neighborhood, before changing it


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

Branch: refs/heads/hs/7894
Commit: 976b98b867de6e964cba414d7fa5c4550b7cf038
Parents: a52e33f
Author: Igor Bondarenko <je...@gmail.com>
Authored: Mon Jun 15 17:27:23 2015 +0300
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Tue Jun 16 18:23:47 2015 +0000

----------------------------------------------------------------------
 Allura/allura/controllers/project.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/976b98b8/Allura/allura/controllers/project.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/project.py b/Allura/allura/controllers/project.py
index 2f6d9be..195115f 100644
--- a/Allura/allura/controllers/project.py
+++ b/Allura/allura/controllers/project.py
@@ -642,7 +642,12 @@ class NeighborhoodAdminController(object):
     @require_post()
     @validate(W.neighborhood_overview_form, error_handler=overview)
     def update(self, name=None, css=None, homepage=None, project_template=None, icon=None, **kw):
-        nbhd = self.neighborhood
+        # We need to get neighborhood from Mongo to populate Ming's session. If
+        # neighborhood object is coming from cache (i.e.
+        # neighborhood.cache.duration is set), then it will be absent in Ming's
+        # session for current thread, thus all changes will not be flushed to
+        # disk. See #7890 for details.
+        nbhd = M.Neighborhood.query.get(_id=self.neighborhood._id)
         c.project = nbhd.neighborhood_project
         h.log_if_changed(nbhd, 'name', name,
                          'change neighborhood name to %s' % name)


[02/20] allura git commit: [#4802] UX improvments when editing wiki pages

Posted by he...@apache.org.
[#4802] UX improvments when editing wiki pages


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

Branch: refs/heads/hs/7894
Commit: 9d26281ff4b37fdc718f9b40987511629851619d
Parents: 069de21
Author: Heith Seewald <hs...@slashdotmedia.com>
Authored: Mon Jun 15 14:52:16 2015 -0400
Committer: Igor Bondarenko <je...@gmail.com>
Committed: Tue Jun 16 13:19:14 2015 +0300

----------------------------------------------------------------------
 ForgeWiki/forgewiki/templates/wiki/page_view.html | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/9d26281f/ForgeWiki/forgewiki/templates/wiki/page_view.html
----------------------------------------------------------------------
diff --git a/ForgeWiki/forgewiki/templates/wiki/page_view.html b/ForgeWiki/forgewiki/templates/wiki/page_view.html
index 2f4d95f..0420ecf 100644
--- a/ForgeWiki/forgewiki/templates/wiki/page_view.html
+++ b/ForgeWiki/forgewiki/templates/wiki/page_view.html
@@ -42,7 +42,7 @@
 {% block actions %}
   {% if not page['deleted'] %}
     {% if c.user and c.user != c.user.anonymous() %}
-      <a href="edit" title="Edit"><b data-icon="{{g.icons['pencil'].char}}" class="ico {{g.icons['pencil'].css}}" title="Edit"></b></a>
+      <a href="edit" title="Edit"><b data-icon="{{g.icons['pencil'].char}}" class="ico {{g.icons['pencil'].css}}" title="Edit"></b>&nbsp;Edit</a>
     {% endif %}
     <a href="history" title="History"><b data-icon="{{g.icons['history'].char}}" class="ico {{g.icons['history'].css}}" title="History"></b></a>
   {% elif h.has_access(page, 'delete')() %}
@@ -108,8 +108,12 @@
   <hr style="margin-top: 1em; margin-bottom: 2em; clear:both;">
   {{lib.related_artifacts(page)}}
   {% if page.discussion_thread and c.app.show_discussion %}
-    {% set thread = page.discussion_thread %}
-    <div>{{c.thread.display(value=thread,page=pagenum,limit=limit,count=count)}}</div>
+      {% if h.has_access(page, 'edit')() or page.discussion_thread.num_replies > 0 %}
+          <div id="discussion_holder"><h2>Discussion</h2>
+          {% set thread = page.discussion_thread %}
+          <div>{{ c.thread.display(value=thread,page=pagenum,limit=limit,count=count) }}</div>
+          </div>
+      {% endif %}
   {% endif %}
   {{c.confirmation.display(content='')}}
 


[13/20] allura git commit: [#7873] Add tests for git branch/tag cache system

Posted by he...@apache.org.
[#7873] Add tests for git branch/tag cache system


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

Branch: refs/heads/hs/7894
Commit: 2d21779f522a94f8354f9110983fc0e97ebd5361
Parents: 2d54358
Author: Heith Seewald <hs...@slashdotmedia.com>
Authored: Mon Jun 15 08:25:17 2015 -0400
Committer: Heith Seewald <hs...@slashdotmedia.com>
Committed: Thu Jun 25 14:10:57 2015 +0000

----------------------------------------------------------------------
 ForgeGit/forgegit/tests/functional/test_controllers.py |  5 ++++-
 ForgeGit/forgegit/tests/model/test_repository.py       | 11 +++++++++++
 2 files changed, 15 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/2d21779f/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 917f765..29c6453 100644
--- a/ForgeGit/forgegit/tests/functional/test_controllers.py
+++ b/ForgeGit/forgegit/tests/functional/test_controllers.py
@@ -390,7 +390,10 @@ class TestRootController(_TestCase):
 
     def test_default_branch(self):
         assert_equal(c.app.default_branch_name, 'master')
-        c.app.repo.set_default_branch('zz')
+        vv = c.app.repo.set_default_branch('zz')
+        print('-' * 10)
+        print(vv)
+        print('-' * 10)
         assert_equal(c.app.default_branch_name, 'zz')
         c.app.repo.set_default_branch('master')
         assert_equal(c.app.default_branch_name, 'master')

http://git-wip-us.apache.org/repos/asf/allura/blob/2d21779f/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 349efe6..47dc34d 100644
--- a/ForgeGit/forgegit/tests/model/test_repository.py
+++ b/ForgeGit/forgegit/tests/model/test_repository.py
@@ -728,6 +728,17 @@ class TestGitRepo(unittest.TestCase, RepoImplTestBase):
             res_with_tmp = self.repo.merge_request_commits(mr)
         assert_equals(res_without_tmp, res_with_tmp)
 
+    def test_cached_branches(self):
+        with mock.patch.dict('allura.lib.app_globals.config', {'repo_refs_cache_threshold': '0'}):
+            rev = GM.Repository.query.get(_id=self.repo['_id'])
+            branches = rev._impl._get_refs('branches')
+            assert_equal(rev.cached_branches, branches)
+
+    def test_cached_tags(self):
+        with mock.patch.dict('allura.lib.app_globals.config', {'repo_refs_cache_threshold': '0'}):
+            rev = GM.Repository.query.get(_id=self.repo['_id'])
+            tags = rev._impl._get_refs('tags')
+            assert_equal(rev.cached_tags, tags)
 
 class TestGitImplementation(unittest.TestCase):