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 2013/04/26 16:53:05 UTC

[01/12] git commit: [#6078] Chunk processing of commits when cleaning data during repo refresh to avoid BSON doc size limits

Updated Branches:
  refs/heads/cj/5655 d4524de45 -> ab2236dc1 (forced update)


[#6078] Chunk processing of commits when cleaning data during repo refresh to avoid BSON doc size limits

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

Branch: refs/heads/cj/5655
Commit: 115cdad111a046102abf4d8063482c6c6bf0c615
Parents: 51f5361
Author: Cory Johns <cj...@slashdotmedia.com>
Authored: Thu Apr 11 16:18:12 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Wed Apr 24 21:37:34 2013 +0000

----------------------------------------------------------------------
 Allura/allura/scripts/refreshrepo.py |   66 +++++++++++++++++------------
 1 files changed, 39 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/115cdad1/Allura/allura/scripts/refreshrepo.py
----------------------------------------------------------------------
diff --git a/Allura/allura/scripts/refreshrepo.py b/Allura/allura/scripts/refreshrepo.py
index 43ff7c2..f55a054 100644
--- a/Allura/allura/scripts/refreshrepo.py
+++ b/Allura/allura/scripts/refreshrepo.py
@@ -68,42 +68,54 @@ class RefreshRepo(ScriptTask):
                     if options.clean:
                         ci_ids = list(c.app.repo.all_commit_ids())
                         log.info("Deleting mongo data for %i commits...", len(ci_ids))
-                        tree_ids = [
-                                tree_id for doc in
-                                M.repo.TreesDoc.m.find({"_id": {"$in": ci_ids}},
-                                                       {"tree_ids": 1})
-                                for tree_id in doc.get("tree_ids", [])]
-
-                        i = M.repo.CommitDoc.m.find({"_id": {"$in": ci_ids}}).count()
-                        log.info("Deleting %i CommitDoc docs...", i)
-                        M.repo.CommitDoc.m.remove({"_id": {"$in": ci_ids}})
+                        # like the tree_ids themselves below, we need to process these in
+                        # chunks to avoid hitting the BSON max size limit
+                        tree_ids = []
+                        for ci_ids_chunk in chunked_list(ci_ids, 3000):
+                            tree_ids.extend([
+                                    tree_id for doc in
+                                    M.repo.TreesDoc.m.find({"_id": {"$in": ci_ids_chunk}},
+                                                           {"tree_ids": 1})
+                                    for tree_id in doc.get("tree_ids", [])])
+
+                            i = M.repo.CommitDoc.m.find({"_id": {"$in": ci_ids_chunk}}).count()
+                            if i:
+                                log.info("Deleting %i CommitDoc docs...", i)
+                                M.repo.CommitDoc.m.remove({"_id": {"$in": ci_ids_chunk}})
 
                         # delete these in chunks, otherwise the query doc can
                         # exceed the max BSON size limit (16MB at the moment)
                         for tree_ids_chunk in chunked_list(tree_ids, 300000):
                             i = M.repo.TreeDoc.m.find({"_id": {"$in": tree_ids_chunk}}).count()
-                            log.info("Deleting %i TreeDoc docs...", i)
-                            M.repo.TreeDoc.m.remove({"_id": {"$in": tree_ids_chunk}})
+                            if i:
+                                log.info("Deleting %i TreeDoc docs...", i)
+                                M.repo.TreeDoc.m.remove({"_id": {"$in": tree_ids_chunk}})
                         del tree_ids
 
                         # delete these after TreeDoc and LastCommitDoc so that if
                         # we crash, we don't lose the ability to delete those
-                        i = M.repo.TreesDoc.m.find({"_id": {"$in": ci_ids}}).count()
-                        log.info("Deleting %i TreesDoc docs...", i)
-                        M.repo.TreesDoc.m.remove({"_id": {"$in": ci_ids}})
-
-                        # delete LastCommitDocs
-                        i = M.repo.LastCommitDoc.m.find(dict(commit_ids={'$in': ci_ids})).count()
-                        log.info("Deleting %i remaining LastCommitDoc docs, by repo id...", i)
-                        M.repo.LastCommitDoc.m.remove(dict(commit_ids={'$in': ci_ids}))
-
-                        i = M.repo.DiffInfoDoc.m.find({"_id": {"$in": ci_ids}}).count()
-                        log.info("Deleting %i DiffInfoDoc docs...", i)
-                        M.repo.DiffInfoDoc.m.remove({"_id": {"$in": ci_ids}})
-
-                        i = M.repo.CommitRunDoc.m.find({"commit_ids": {"$in": ci_ids}}).count()
-                        log.info("Deleting %i CommitRunDoc docs...", i)
-                        M.repo.CommitRunDoc.m.remove({"commit_ids": {"$in": ci_ids}})
+                        for ci_ids_chunk in chunked_list(ci_ids, 3000):
+                            # delete TreesDocs
+                            i = M.repo.TreesDoc.m.find({"_id": {"$in": ci_ids_chunk}}).count()
+                            if i:
+                                log.info("Deleting %i TreesDoc docs...", i)
+                                M.repo.TreesDoc.m.remove({"_id": {"$in": ci_ids_chunk}})
+
+                            # delete LastCommitDocs
+                            i = M.repo.LastCommitDoc.m.find(dict(commit_ids={'$in': ci_ids_chunk})).count()
+                            if i:
+                                log.info("Deleting %i remaining LastCommitDoc docs, by repo id...", i)
+                                M.repo.LastCommitDoc.m.remove(dict(commit_ids={'$in': ci_ids_chunk}))
+
+                            i = M.repo.DiffInfoDoc.m.find({"_id": {"$in": ci_ids_chunk}}).count()
+                            if i:
+                                log.info("Deleting %i DiffInfoDoc docs...", i)
+                                M.repo.DiffInfoDoc.m.remove({"_id": {"$in": ci_ids_chunk}})
+
+                            i = M.repo.CommitRunDoc.m.find({"commit_ids": {"$in": ci_ids_chunk}}).count()
+                            if i:
+                                log.info("Deleting %i CommitRunDoc docs...", i)
+                                M.repo.CommitRunDoc.m.remove({"commit_ids": {"$in": ci_ids_chunk}})
                         del ci_ids
 
                     try:


[03/12] git commit: Pass project explicity to fix errors in setup-app

Posted by jo...@apache.org.
Pass project explicity to fix errors in setup-app

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

Branch: refs/heads/cj/5655
Commit: 0cccda7381d9e82b6e35c47323048ff1b730671f
Parents: 5f980b7
Author: Tim Van Steenburgh <tv...@gmail.com>
Authored: Thu Apr 25 03:11:31 2013 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Thu Apr 25 03:11:31 2013 +0000

----------------------------------------------------------------------
 ForgeUserStats/forgeuserstats/main.py |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/0cccda73/ForgeUserStats/forgeuserstats/main.py
----------------------------------------------------------------------
diff --git a/ForgeUserStats/forgeuserstats/main.py b/ForgeUserStats/forgeuserstats/main.py
index 950dfc8..1951cee 100644
--- a/ForgeUserStats/forgeuserstats/main.py
+++ b/ForgeUserStats/forgeuserstats/main.py
@@ -106,8 +106,8 @@ class ForgeUserStatsApp(Application):
 
     def __init__(self, project, config):
         Application.__init__(self, project, config)
-        role_admin = M.ProjectRole.by_name('Admin')._id
-        role_anon = M.ProjectRole.by_name('*anonymous')._id
+        role_admin = M.ProjectRole.by_name('Admin', project)._id
+        role_anon = M.ProjectRole.by_name('*anonymous', project)._id
         self.config.acl = [
             M.ACE.allow(role_anon, 'read'),
             M.ACE.allow(role_admin, 'admin')]


[09/12] git commit: [#6069] ticket:324 added prefix to zip tarball

Posted by jo...@apache.org.
[#6069] ticket:324 added prefix to zip tarball


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

Branch: refs/heads/cj/5655
Commit: 49933de99f876d44db7663094145143ff50d55a4
Parents: 352b74b
Author: Yuriy Arhipov <yu...@yandex.ru>
Authored: Thu Apr 25 04:10:47 2013 +0400
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Fri Apr 26 14:36:08 2013 +0000

----------------------------------------------------------------------
 ForgeSVN/forgesvn/model/svn.py                   |   12 +++++++-----
 ForgeSVN/forgesvn/tests/model/test_repository.py |    3 +++
 2 files changed, 10 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/49933de9/ForgeSVN/forgesvn/model/svn.py
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/model/svn.py b/ForgeSVN/forgesvn/model/svn.py
index 8fdf628..2994aeb 100644
--- a/ForgeSVN/forgesvn/model/svn.py
+++ b/ForgeSVN/forgesvn/model/svn.py
@@ -29,7 +29,7 @@ from datetime import datetime
 import tempfile
 import tarfile
 from shutil import rmtree
-from zipfile import ZipFile
+from zipfile import ZipFile, ZIP_DEFLATED
 
 import tg
 import pysvn
@@ -640,8 +640,8 @@ class SVNImplementation(M.RepositoryImplementation):
     def tarball(self, commit):
         if not os.path.exists(self._repo.tarball_path):
             os.makedirs(self._repo.tarball_path)
-        path = os.path.join(self._repo.tarball_path, commit)
         archive_name = self._repo.tarball_filename(commit)
+        path = os.path.join(self._repo.tarball_path, archive_name)
         filename = os.path.join(self._repo.tarball_path, '%s%s' % (archive_name, '.zip'))
         tmpfilename = os.path.join(self._repo.tarball_path, '%s%s' % (archive_name, '.tmp'))
         if os.path.exists(path):
@@ -651,9 +651,11 @@ class SVNImplementation(M.RepositoryImplementation):
                              path,
                              revision=pysvn.Revision(pysvn.opt_revision_kind.number, commit))
             with ZipFile(tmpfilename, 'w') as tarball_zip:
-                for dirname, subdirs, files in os.walk(path):
-                    for f in files:
-                        tarball_zip.write(os.path.join(dirname, f), os.path.relpath(os.path.join(dirname, f), path))
+               for root, dirs, files in os.walk(path):
+                    for name in files:
+                        file_to_zip = os.path.join(root, name)
+                        arcname = file_to_zip[len(os.path.dirname(path)):].strip('/')
+                        tarball_zip.write(file_to_zip, arcname, compress_type=ZIP_DEFLATED)
 
             os.rename(tmpfilename, filename)
         finally:

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/49933de9/ForgeSVN/forgesvn/tests/model/test_repository.py
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/tests/model/test_repository.py b/ForgeSVN/forgesvn/tests/model/test_repository.py
index 8107829..68e884c 100644
--- a/ForgeSVN/forgesvn/tests/model/test_repository.py
+++ b/ForgeSVN/forgesvn/tests/model/test_repository.py
@@ -21,6 +21,7 @@ import unittest
 import pkg_resources
 from itertools import count, product
 from datetime import datetime
+from zipfile import ZipFile
 
 from collections import defaultdict
 from pylons import tmpl_context as c
@@ -292,6 +293,8 @@ class TestSVNRepo(unittest.TestCase, RepoImplTestBase):
         assert_equal(self.repo.tarball_url('1'), 'file:///svn/t/te/test/testsvn/test-src-1.zip')
         self.repo.tarball('1')
         assert os.path.isfile("/tmp/tarball/svn/t/te/test/testsvn/test-src-1.zip")
+        tarball_zip = ZipFile('/tmp/tarball/svn/t/te/test/testsvn/test-src-1.zip', 'r')
+        assert_equal(tarball_zip.namelist(), ['test-src-1/README'])
 
     def test_is_empty(self):
         assert not self.repo.is_empty()


[04/12] git commit: [#5501] Add contextual doc explaining valid mount points

Posted by jo...@apache.org.
[#5501] Add contextual doc explaining valid mount points

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

Branch: refs/heads/cj/5655
Commit: 37c78abeaecfb75ecc1e8b07958ee506a14cac05
Parents: 14569f1
Author: Tim Van Steenburgh <tv...@gmail.com>
Authored: Wed Apr 24 20:11:16 2013 +0000
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Thu Apr 25 16:58:44 2013 +0000

----------------------------------------------------------------------
 .../allura/ext/admin/templates/project_tools.html  |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/37c78abe/Allura/allura/ext/admin/templates/project_tools.html
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/admin/templates/project_tools.html b/Allura/allura/ext/admin/templates/project_tools.html
index c4344cb..6516039 100644
--- a/Allura/allura/ext/admin/templates/project_tools.html
+++ b/Allura/allura/ext/admin/templates/project_tools.html
@@ -50,7 +50,9 @@
     <div class="grid-13"><input type="text" name="new.mount_label" class="new_mount_label"></div>
     <label class="grid-13">Mount Point</label>
     <div class="grid-13"><input type="text" name="new.mount_point" class="new_mount_point"></div>
-    <div class="grid-13">&nbsp;</div>
+    <div class="grid-13"><small>* The mount point is the name of the tool as it will appear in a URL.
+      A valid mount point must begin with a letter, contain only letters, numbers, and dashes,
+      and be from 1-63 characters in length.</small></div>
     <hr>
     <div class="grid-13">&nbsp;</div>
     <div class="grid-13">


[02/12] git commit: [#6078] fix gitpython URL with our patches

Posted by jo...@apache.org.
[#6078] fix gitpython URL with our patches


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

Branch: refs/heads/cj/5655
Commit: 5f980b72ba2acc182999a5bb3b43aacc074660f3
Parents: 115cdad
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Mon Apr 15 20:41:58 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Wed Apr 24 21:39:40 2013 +0000

----------------------------------------------------------------------
 requirements-sf.txt |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/5f980b72/requirements-sf.txt
----------------------------------------------------------------------
diff --git a/requirements-sf.txt b/requirements-sf.txt
index ed3e552..0923185 100644
--- a/requirements-sf.txt
+++ b/requirements-sf.txt
@@ -17,7 +17,7 @@ wsgipreload==1.2
 pyzmq==2.1.7
 html2text==3.200.3dev-20121112
 
-# use version built from https://github.com/johnsca/GitPython/commits/0.3.2-RC1-20130424
+# use version built from https://github.com/johnsca/GitPython/commits/tv/6000
 # for unmerged fixes for [#5411], [#6000], and [#6078]
 GitPython==0.3.2.RC1-20130424
 


[08/12] git commit: [#6069] ticket:317 Change code snapshots to zip files

Posted by jo...@apache.org.
[#6069] ticket:317 Change code snapshots to zip files


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

Branch: refs/heads/cj/5655
Commit: 352b74b8b981b1ffdcaaa4d2fab522ab4dc41d87
Parents: c01c95e
Author: Yuriy Arhipov <yu...@yandex.ru>
Authored: Mon Apr 15 16:05:37 2013 +0400
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Fri Apr 26 14:36:07 2013 +0000

----------------------------------------------------------------------
 Allura/allura/model/repository.py                |    4 ++--
 ForgeGit/forgegit/model/git_repo.py              |    6 +++---
 ForgeGit/forgegit/tests/model/test_repository.py |   14 +++++++-------
 ForgeSVN/forgesvn/model/svn.py                   |   10 +++++++---
 ForgeSVN/forgesvn/tests/model/test_repository.py |    4 ++--
 5 files changed, 21 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/352b74b8/Allura/allura/model/repository.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/repository.py b/Allura/allura/model/repository.py
index 8a95993..53d166f 100644
--- a/Allura/allura/model/repository.py
+++ b/Allura/allura/model/repository.py
@@ -272,7 +272,7 @@ class Repository(Artifact, ActivityObject):
         return filename
 
     def tarball_url(self, revision):
-        filename = '%s%s' % (self.tarball_filename(revision), '.tar.gz')
+        filename = '%s%s' % (self.tarball_filename(revision), '.zip')
         r = os.path.join(self.tool,
                          self.project.shortname[:1],
                          self.project.shortname[:2],
@@ -283,7 +283,7 @@ class Repository(Artifact, ActivityObject):
 
     def get_tarball_status(self, revision):
         pathname = os.path.join(self.tarball_path, self.tarball_filename(revision))
-        filename = '%s%s' % (pathname, '.tar.gz')
+        filename = '%s%s' % (pathname, '.zip')
         tmpfilename = '%s%s' % (pathname, '.tmp')
 
         if os.path.isfile(filename):

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/352b74b8/ForgeGit/forgegit/model/git_repo.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/model/git_repo.py b/ForgeGit/forgegit/model/git_repo.py
index 5c79e34..2511ce0 100644
--- a/ForgeGit/forgegit/model/git_repo.py
+++ b/ForgeGit/forgegit/model/git_repo.py
@@ -345,11 +345,11 @@ class GitImplementation(M.RepositoryImplementation):
         if not os.path.exists(self._repo.tarball_path):
             os.makedirs(self._repo.tarball_path)
         archive_name = self._repo.tarball_filename(commit)
-        filename = os.path.join(self._repo.tarball_path, '%s%s' % (archive_name, '.tar.gz'))
+        filename = os.path.join(self._repo.tarball_path, '%s%s' % (archive_name, '.zip'))
         tmpfilename = os.path.join(self._repo.tarball_path, '%s%s' % (archive_name, '.tmp'))
         try:
-            with gzip.open(tmpfilename, 'w') as fp:
-                self._git.archive(fp, format='tar', treeish=commit, prefix=archive_name + '/')
+            with open(tmpfilename, 'wb') as archive_file:
+                self._git.archive(archive_file, format='zip', treeish=commit, prefix=archive_name + '/')
             os.rename(tmpfilename, filename)
         finally:
             if os.path.exists(tmpfilename):

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/352b74b8/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 46c2daa..1614069 100644
--- a/ForgeGit/forgegit/tests/model/test_repository.py
+++ b/ForgeGit/forgegit/tests/model/test_repository.py
@@ -258,12 +258,12 @@ class TestGitRepo(unittest.TestCase, RepoImplTestBase):
         self.assertEqual(new_tree.other_ids, orig_tree.other_ids)
 
     def test_tarball(self):
-        if os.path.isfile("/tmp/tarball/git/t/te/test/testgit.git/test-src-git-HEAD.tar.gz"):
-            os.remove("/tmp/tarball/git/t/te/test/testgit.git/test-src-git-HEAD.tar.gz")
+        if os.path.isfile("/tmp/tarball/git/t/te/test/testgit.git/test-src-git-HEAD.zip"):
+            os.remove("/tmp/tarball/git/t/te/test/testgit.git/test-src-git-HEAD.zip")
         assert_equal(self.repo.tarball_path, '/tmp/tarball/git/t/te/test/testgit.git')
-        assert_equal(self.repo.tarball_url('HEAD'), 'file:///git/t/te/test/testgit.git/test-src-git-HEAD.tar.gz')
+        assert_equal(self.repo.tarball_url('HEAD'), 'file:///git/t/te/test/testgit.git/test-src-git-HEAD.zip')
         self.repo.tarball('HEAD')
-        assert os.path.isfile("/tmp/tarball/git/t/te/test/testgit.git/test-src-git-HEAD.tar.gz")
+        assert os.path.isfile("/tmp/tarball/git/t/te/test/testgit.git/test-src-git-HEAD.zip")
 
     def test_all_commit_ids(self):
         cids = list(self.repo.all_commit_ids())
@@ -292,15 +292,15 @@ class TestGitRepo(unittest.TestCase, RepoImplTestBase):
                 'name': u'README'}])
 
     def test_tarball_status(self):
-        if os.path.isfile("/tmp/tarball/git/t/te/test/testgit.git/test-src-git-HEAD.tar.gz"):
-            os.remove("/tmp/tarball/git/t/te/test/testgit.git/test-src-git-HEAD.tar.gz")
+        if os.path.isfile("/tmp/tarball/git/t/te/test/testgit.git/test-src-git-HEAD.zip"):
+            os.remove("/tmp/tarball/git/t/te/test/testgit.git/test-src-git-HEAD.zip")
         if os.path.isfile("/tmp/tarball/git/t/te/test/testgit.git/test-src-git-HEAD.tmp"):
             os.remove("/tmp/tarball/git/t/te/test/testgit.git/test-src-git-HEAD.tmp")
         if os.path.isdir("/tmp/tarball/git/t/te/test/testgit.git/test-src-git-HEAD/"):
             os.removedirs("/tmp/tarball/git/t/te/test/testgit.git/test-src-git-HEAD/")
         self.repo.tarball('HEAD')
         assert_equal(self.repo.get_tarball_status('HEAD'), 'ready')
-        os.rename("/tmp/tarball/git/t/te/test/testgit.git/test-src-git-HEAD.tar.gz",
+        os.rename("/tmp/tarball/git/t/te/test/testgit.git/test-src-git-HEAD.zip",
                   "/tmp/tarball/git/t/te/test/testgit.git/test-src-git-HEAD.tmp")
         assert_equal(self.repo.get_tarball_status('HEAD'), 'busy')
         os.remove("/tmp/tarball/git/t/te/test/testgit.git/test-src-git-HEAD.tmp")

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/352b74b8/ForgeSVN/forgesvn/model/svn.py
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/model/svn.py b/ForgeSVN/forgesvn/model/svn.py
index de05fd0..8fdf628 100644
--- a/ForgeSVN/forgesvn/model/svn.py
+++ b/ForgeSVN/forgesvn/model/svn.py
@@ -29,6 +29,7 @@ from datetime import datetime
 import tempfile
 import tarfile
 from shutil import rmtree
+from zipfile import ZipFile
 
 import tg
 import pysvn
@@ -641,7 +642,7 @@ class SVNImplementation(M.RepositoryImplementation):
             os.makedirs(self._repo.tarball_path)
         path = os.path.join(self._repo.tarball_path, commit)
         archive_name = self._repo.tarball_filename(commit)
-        filename = os.path.join(self._repo.tarball_path, '%s%s' % (archive_name, '.tar.gz'))
+        filename = os.path.join(self._repo.tarball_path, '%s%s' % (archive_name, '.zip'))
         tmpfilename = os.path.join(self._repo.tarball_path, '%s%s' % (archive_name, '.tmp'))
         if os.path.exists(path):
             rmtree(path)
@@ -649,8 +650,11 @@ class SVNImplementation(M.RepositoryImplementation):
             self._svn.export(self._url,
                              path,
                              revision=pysvn.Revision(pysvn.opt_revision_kind.number, commit))
-            with tarfile.open(tmpfilename, "w:gz") as tar:
-                tar.add(path, arcname=archive_name)
+            with ZipFile(tmpfilename, 'w') as tarball_zip:
+                for dirname, subdirs, files in os.walk(path):
+                    for f in files:
+                        tarball_zip.write(os.path.join(dirname, f), os.path.relpath(os.path.join(dirname, f), path))
+
             os.rename(tmpfilename, filename)
         finally:
             rmtree(path)

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/352b74b8/ForgeSVN/forgesvn/tests/model/test_repository.py
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/tests/model/test_repository.py b/ForgeSVN/forgesvn/tests/model/test_repository.py
index e8fb14e..8107829 100644
--- a/ForgeSVN/forgesvn/tests/model/test_repository.py
+++ b/ForgeSVN/forgesvn/tests/model/test_repository.py
@@ -289,9 +289,9 @@ class TestSVNRepo(unittest.TestCase, RepoImplTestBase):
 
     def test_tarball(self):
         assert_equal(self.repo.tarball_path, '/tmp/tarball/svn/t/te/test/testsvn')
-        assert_equal(self.repo.tarball_url('1'), 'file:///svn/t/te/test/testsvn/test-src-1.tar.gz')
+        assert_equal(self.repo.tarball_url('1'), 'file:///svn/t/te/test/testsvn/test-src-1.zip')
         self.repo.tarball('1')
-        assert os.path.isfile("/tmp/tarball/svn/t/te/test/testsvn/test-src-1.tar.gz")
+        assert os.path.isfile("/tmp/tarball/svn/t/te/test/testsvn/test-src-1.zip")
 
     def test_is_empty(self):
         assert not self.repo.is_empty()


[10/12] git commit: [#6069] Bumped version of ForgeHg

Posted by jo...@apache.org.
[#6069] Bumped version of ForgeHg

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

Branch: refs/heads/cj/5655
Commit: b9aaa6149cbe42edb9110b617584160492879353
Parents: 49933de
Author: Cory Johns <cj...@slashdotmedia.com>
Authored: Fri Apr 26 14:36:38 2013 +0000
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Fri Apr 26 14:36:38 2013 +0000

----------------------------------------------------------------------
 requirements-sf.txt |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/b9aaa614/requirements-sf.txt
----------------------------------------------------------------------
diff --git a/requirements-sf.txt b/requirements-sf.txt
index 0923185..351f054 100644
--- a/requirements-sf.txt
+++ b/requirements-sf.txt
@@ -4,7 +4,7 @@ akismet==0.2.0
 amqplib==0.6.1
 kombu==1.0.4
 coverage==3.5a1-20110413
-ForgeHg==0.1.8
+ForgeHg==0.1.9
 ForgePastebin==0.2.6
 mechanize==0.2.4
 MySQL-python==1.2.3c1


[07/12] git commit: [#5998] ticket:315 Set NewRelic transaction name to actual controller name

Posted by jo...@apache.org.
[#5998] ticket:315 Set NewRelic transaction name to actual controller name


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

Branch: refs/heads/cj/5655
Commit: c01c95eb13ada2d6665906642d77254ebe2a8d96
Parents: 8ade72f
Author: Igor Bondarenko <je...@gmail.com>
Authored: Fri Apr 19 09:08:21 2013 +0000
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Fri Apr 26 14:31:48 2013 +0000

----------------------------------------------------------------------
 Allura/allura/config/middleware.py |    2 ++
 Allura/allura/lib/patches.py       |   12 ++++++++++++
 Allura/development.ini             |    2 ++
 3 files changed, 16 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/c01c95eb/Allura/allura/config/middleware.py
----------------------------------------------------------------------
diff --git a/Allura/allura/config/middleware.py b/Allura/allura/config/middleware.py
index 805a9b9..09849a1 100644
--- a/Allura/allura/config/middleware.py
+++ b/Allura/allura/config/middleware.py
@@ -84,6 +84,8 @@ def _make_core_app(root, global_conf, full_stack=True, **app_conf):
         [pkg_resources.resource_filename('allura', 'etc/mime.types')]
         + mimetypes.knownfiles)
     patches.apply()
+    if asbool(app_conf.get('newrelic')):
+        patches.newrelic()
     # Configure MongoDB
     ming.configure(**app_conf)
 

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/c01c95eb/Allura/allura/lib/patches.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/patches.py b/Allura/allura/lib/patches.py
index 560e2f4..adbc4bc 100644
--- a/Allura/allura/lib/patches.py
+++ b/Allura/allura/lib/patches.py
@@ -72,3 +72,15 @@ def apply():
         if request.method == 'GET' and not(request.path.endswith('/')) and not(request.response_type) and len(request.params)==0:
             raise webob.exc.HTTPMovedPermanently(location=request.url+'/')
         return func(*args, **kwargs)
+
+
+def newrelic():
+    old_call = tg.controllers.DecoratedController._call
+
+    @h.monkeypatch(tg.controllers.DecoratedController,
+                   tg.controllers.decoratedcontroller.DecoratedController)
+    def _call(self, controller, *args, **kwargs):
+        '''Set NewRelic transaction name to actual controller name'''
+        import newrelic.agent
+        newrelic.agent.set_transaction_name(newrelic.agent.callable_name(controller))
+        return old_call(self, controller, *args, **kwargs)

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/c01c95eb/Allura/development.ini
----------------------------------------------------------------------
diff --git a/Allura/development.ini b/Allura/development.ini
index 761876b..9cb99c3 100644
--- a/Allura/development.ini
+++ b/Allura/development.ini
@@ -49,6 +49,8 @@ use_queue = true
 
 base_url = http://localhost:8080
 
+# newrelic = true
+
 #lang = ru
 cache_dir = %(here)s/data
 beaker.session.key = allura


[11/12] git commit: [#5655] Added root REST view with hook for providing site stats

Posted by jo...@apache.org.
[#5655] Added root REST view with hook for providing site stats

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

Branch: refs/heads/cj/5655
Commit: 2740a6838d15821a64b854fab7b40dd31ee04573
Parents: b9aaa61
Author: Cory Johns <cj...@slashdotmedia.com>
Authored: Mon Apr 22 23:29:12 2013 +0000
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Fri Apr 26 14:52:54 2013 +0000

----------------------------------------------------------------------
 Allura/allura/controllers/rest.py |    9 ++++++++-
 Allura/allura/lib/app_globals.py  |    1 +
 2 files changed, 9 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/2740a683/Allura/allura/controllers/rest.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/rest.py b/Allura/allura/controllers/rest.py
index e7d11f9..0d519cc 100644
--- a/Allura/allura/controllers/rest.py
+++ b/Allura/allura/controllers/rest.py
@@ -23,7 +23,7 @@ import logging
 import oauth2 as oauth
 from webob import exc
 from tg import expose, flash, redirect
-from pylons import tmpl_context as c
+from pylons import tmpl_context as c, app_globals as g
 from pylons import request
 
 from ming.orm import session
@@ -60,6 +60,13 @@ class RestController(object):
         else:
             return None
 
+    @expose('json:')
+    def index(self, **kw):
+        provider = g.entry_points['site_stats'].get('provider')
+        if provider:
+            return provider()
+        return dict()
+
     @expose()
     def _lookup(self, name, *remainder):
         api_token = self._authenticate_request()

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/2740a683/Allura/allura/lib/app_globals.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/app_globals.py b/Allura/allura/lib/app_globals.py
index 3eb816b..e5b00c7 100644
--- a/Allura/allura/lib/app_globals.py
+++ b/Allura/allura/lib/app_globals.py
@@ -185,6 +185,7 @@ class Globals(object):
             user_prefs=_cache_eps('allura.user_prefs'),
             spam=_cache_eps('allura.spam'),
             stats=_cache_eps('allura.stats'),
+            site_stats=_cache_eps('allura.site_stats'),
             )
 
         # Zarkov logger


[06/12] git commit: [#5501] Restore old regex for project names

Posted by jo...@apache.org.
[#5501] Restore old regex for project names

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

Branch: refs/heads/cj/5655
Commit: 8ade72f0c6049e284e0a927b55a791f4b9735134
Parents: 37c78ab
Author: Tim Van Steenburgh <tv...@gmail.com>
Authored: Thu Apr 25 14:11:25 2013 +0000
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Thu Apr 25 16:58:45 2013 +0000

----------------------------------------------------------------------
 Allura/allura/controllers/project.py               |    6 ++++--
 Allura/allura/lib/helpers.py                       |    3 ++-
 Allura/allura/model/project.py                     |    2 +-
 .../allura/tests/functional/test_neighborhood.py   |    7 +++----
 4 files changed, 10 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/8ade72f0/Allura/allura/controllers/project.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/project.py b/Allura/allura/controllers/project.py
index 11ef3e3..2f59a38 100644
--- a/Allura/allura/controllers/project.py
+++ b/Allura/allura/controllers/project.py
@@ -583,14 +583,16 @@ class NeighborhoodAdminController(object):
         result = True
         if anchored_tools.strip() != '':
             try:
-                validate_tools = dict((tool.split(':')[0].lower(), tool.split(':')[1]) for tool in anchored_tools.replace(' ', '').split(','))
+                validate_tools = dict(
+                    (tool.split(':')[0].lower(), tool.split(':')[1])
+                    for tool in anchored_tools.replace(' ', '').split(','))
             except Exception:
                 flash('Anchored tools "%s" is invalid' % anchored_tools,'error')
                 result = False
 
 
         for tool in validate_tools.keys():
-            if not h.re_path_portion.match(tool):
+            if not h.re_tool_mount_point.match(tool):
                 flash('Anchored tools "%s" is invalid' % anchored_tools,'error')
                 result = False
         if result:

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/8ade72f0/Allura/allura/lib/helpers.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/helpers.py b/Allura/allura/lib/helpers.py
index a941d44..ea2b4d2 100644
--- a/Allura/allura/lib/helpers.py
+++ b/Allura/allura/lib/helpers.py
@@ -53,7 +53,8 @@ from allura.lib import AsciiDammit
 from .security import has_access
 
 re_path_portion_fragment = re.compile(r'[a-z][-a-z0-9]*')
-re_path_portion = re.compile(r'^[a-z][-a-z0-9]{0,62}$')
+re_path_portion = re.compile(r'^[a-z][-a-z0-9]{2,}$')
+re_tool_mount_point = re.compile(r'^[a-z][-a-z0-9]{0,62}$')
 re_clean_vardec_key = re.compile(r'''\A
 ( # first part
 \w+# name...

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/8ade72f0/Allura/allura/model/project.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/project.py b/Allura/allura/model/project.py
index 137e98b..d207aab 100644
--- a/Allura/allura/model/project.py
+++ b/Allura/allura/model/project.py
@@ -547,7 +547,7 @@ class Project(MappedClass, ActivityNode, ActivityObject):
             for x in range(10):
                 if self.app_instance(mount_point) is None: break
                 mount_point = base_mount_point + '-%d' % x
-        if not h.re_path_portion.match(mount_point):
+        if not h.re_tool_mount_point.match(mount_point):
             raise exceptions.ToolError, 'Mount point "%s" is invalid' % mount_point
         # HACK: reserved url components
         if mount_point in ('feed', 'index', 'icon', '_nav.json'):

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/8ade72f0/Allura/allura/tests/functional/test_neighborhood.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_neighborhood.py b/Allura/allura/tests/functional/test_neighborhood.py
index 41c7121..f91b5cb 100644
--- a/Allura/allura/tests/functional/test_neighborhood.py
+++ b/Allura/allura/tests/functional/test_neighborhood.py
@@ -741,10 +741,9 @@ class TestNeighborhood(TestController):
         assert_equal(r.json, dict(suggested_name='test'))
 
     def test_name_check(self):
-        r = self.app.get('/p/check_names?unix_name=My+Moz')
-        assert r.json['unixname_message'] == 'Please use only letters, numbers, and dashes 3-15 characters long.'
-        r = self.app.get('/p/check_names?unix_name=Te%st!')
-        assert r.json['unixname_message'] == 'Please use only letters, numbers, and dashes 3-15 characters long.'
+        for name in ('My+Moz', 'Te%st!', 'ab', 'a' * 16):
+            r = self.app.get('/p/check_names?unix_name=%s' % name)
+            assert r.json['unixname_message'] == 'Please use only letters, numbers, and dashes 3-15 characters long.'
         r = self.app.get('/p/check_names?unix_name=mymoz')
         assert_equal(r.json['unixname_message'], False)
         r = self.app.get('/p/check_names?unix_name=test')


[05/12] git commit: [#5501] Allow 1 and 2-char mount points

Posted by jo...@apache.org.
[#5501] Allow 1 and 2-char mount points

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

Branch: refs/heads/cj/5655
Commit: 14569f1187270cd0ad43ed9c8a4938d012b5ce8f
Parents: 0cccda7
Author: Tim Van Steenburgh <tv...@gmail.com>
Authored: Wed Apr 24 19:33:03 2013 +0000
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Thu Apr 25 16:58:44 2013 +0000

----------------------------------------------------------------------
 Allura/allura/lib/helpers.py              |    2 +-
 Allura/allura/tests/model/test_project.py |    8 ++++++++
 2 files changed, 9 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/14569f11/Allura/allura/lib/helpers.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/helpers.py b/Allura/allura/lib/helpers.py
index c6b144f..a941d44 100644
--- a/Allura/allura/lib/helpers.py
+++ b/Allura/allura/lib/helpers.py
@@ -53,7 +53,7 @@ from allura.lib import AsciiDammit
 from .security import has_access
 
 re_path_portion_fragment = re.compile(r'[a-z][-a-z0-9]*')
-re_path_portion = re.compile(r'^[a-z][-a-z0-9]{2,}$')
+re_path_portion = re.compile(r'^[a-z][-a-z0-9]{0,62}$')
 re_clean_vardec_key = re.compile(r'''\A
 ( # first part
 \w+# name...

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/14569f11/Allura/allura/tests/model/test_project.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/model/test_project.py b/Allura/allura/tests/model/test_project.py
index 4f14bf0..0a218b1 100644
--- a/Allura/allura/tests/model/test_project.py
+++ b/Allura/allura/tests/model/test_project.py
@@ -72,6 +72,14 @@ def test_project():
     with td.raises(ToolError):
         # mount point reserved
         c.project.install_app('Wiki', 'feed')
+    with td.raises(ToolError):
+        # mount point too long
+        c.project.install_app('Wiki', 'a' * 64)
+    with td.raises(ToolError):
+        # mount point must begin with letter
+        c.project.install_app('Wiki', '1')
+    # single letter mount points are allowed
+    c.project.install_app('Wiki', 'a')
     # Make sure the project support page is reset if the tool it was pointing
     # to is uninstalled.
     assert c.project.support_page == ''


[12/12] git commit: [#5655] Refactored site_stats and added ticket and post 24hr stats

Posted by jo...@apache.org.
[#5655] Refactored site_stats and added ticket and post 24hr stats

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

Branch: refs/heads/cj/5655
Commit: ab2236dc1ae67124a0c8d3ea2b9bd7de037d7c8d
Parents: 2740a68
Author: Cory Johns <cj...@slashdotmedia.com>
Authored: Wed Apr 24 22:30:06 2013 +0000
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Fri Apr 26 14:52:54 2013 +0000

----------------------------------------------------------------------
 Allura/allura/controllers/rest.py             |   11 +++++++----
 ForgeDiscussion/forgediscussion/site_stats.py |    8 ++++++++
 ForgeDiscussion/setup.py                      |    3 +++
 ForgeTracker/forgetracker/site_stats.py       |   10 ++++++++++
 ForgeTracker/setup.py                         |    3 +++
 5 files changed, 31 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/ab2236dc/Allura/allura/controllers/rest.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/rest.py b/Allura/allura/controllers/rest.py
index 0d519cc..70e3ac7 100644
--- a/Allura/allura/controllers/rest.py
+++ b/Allura/allura/controllers/rest.py
@@ -62,10 +62,13 @@ class RestController(object):
 
     @expose('json:')
     def index(self, **kw):
-        provider = g.entry_points['site_stats'].get('provider')
-        if provider:
-            return provider()
-        return dict()
+        summary = dict()
+        stats = dict()
+        for stat, provider in g.entry_points['site_stats'].iteritems():
+            stats[stat] = provider()
+        if stats:
+            summary['site_stats'] = stats
+        return summary
 
     @expose()
     def _lookup(self, name, *remainder):

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/ab2236dc/ForgeDiscussion/forgediscussion/site_stats.py
----------------------------------------------------------------------
diff --git a/ForgeDiscussion/forgediscussion/site_stats.py b/ForgeDiscussion/forgediscussion/site_stats.py
new file mode 100644
index 0000000..e76201d
--- /dev/null
+++ b/ForgeDiscussion/forgediscussion/site_stats.py
@@ -0,0 +1,8 @@
+from datetime import datetime, timedelta
+
+from . import model as DM
+
+
+def posts_24hr():
+    window = datetime.utcnow() - timedelta(hours=24)
+    return DM.ForumPost.query.find({'timestamp': {'$gte': window}}).count()

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/ab2236dc/ForgeDiscussion/setup.py
----------------------------------------------------------------------
diff --git a/ForgeDiscussion/setup.py b/ForgeDiscussion/setup.py
index 5c58b7a..812c8a0 100644
--- a/ForgeDiscussion/setup.py
+++ b/ForgeDiscussion/setup.py
@@ -44,5 +44,8 @@ setup(name='ForgeDiscussion',
       # -*- Entry points: -*-
       [allura]
       Discussion=forgediscussion.forum_main:ForgeDiscussionApp
+
+      [allura.site_stats]
+      posts_24hr=forgediscussion.site_stats:posts_24hr
       """,
       )

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/ab2236dc/ForgeTracker/forgetracker/site_stats.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/site_stats.py b/ForgeTracker/forgetracker/site_stats.py
new file mode 100644
index 0000000..e0baa63
--- /dev/null
+++ b/ForgeTracker/forgetracker/site_stats.py
@@ -0,0 +1,10 @@
+from datetime import datetime, timedelta
+
+from bson import ObjectId
+
+from . import model as TM
+
+
+def tickets_stats_24hr():
+    window = datetime.utcnow() - timedelta(hours=24)
+    return TM.Ticket.query.find({'_id': {'$gte': ObjectId.from_datetime(window)}}).count()

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/ab2236dc/ForgeTracker/setup.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/setup.py b/ForgeTracker/setup.py
index 57e5d45..1934cc2 100644
--- a/ForgeTracker/setup.py
+++ b/ForgeTracker/setup.py
@@ -43,6 +43,9 @@ setup(name='ForgeTracker',
       [allura]
       Tickets=forgetracker.tracker_main:ForgeTrackerApp
 
+      [allura.site_stats]
+      tickets_24hr=forgetracker.site_stats:tickets_stats_24hr
+
       [easy_widgets.resources]
       ew_resources=forgetracker.config.resources:register_ew_resources