You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2013/05/15 21:27:30 UTC

[1/5] git commit: [#5644] ticket:332 Fix guid for repo feeds

Updated Branches:
  refs/heads/master 78e97ac49 -> 6c43eac6b


[#5644] ticket:332 Fix guid for repo feeds


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

Branch: refs/heads/master
Commit: 3e45f5de9ec9cd8b632222f856a24c99b92d1a2a
Parents: 63b4e59
Author: Igor Bondarenko <je...@gmail.com>
Authored: Fri May 10 13:24:33 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Wed May 15 19:23:47 2013 +0000

----------------------------------------------------------------------
 Allura/allura/model/artifact.py                    |   11 ++++++-----
 Allura/allura/model/repo_refresh.py                |    3 ++-
 .../forgegit/tests/functional/test_controllers.py  |    1 +
 3 files changed, 9 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/3e45f5de/Allura/allura/model/artifact.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/artifact.py b/Allura/allura/model/artifact.py
index 2acd9d8..4a7f2c1 100644
--- a/Allura/allura/model/artifact.py
+++ b/Allura/allura/model/artifact.py
@@ -388,7 +388,7 @@ class VersionedArtifact(Artifact):
         session(ss).insert_now(ss, state(ss))
         log.info('Snapshot version %s of %s',
                  self.version, self.__class__)
-        if update_stats: 
+        if update_stats:
             if self.version > 1:
                 g.statsUpdater.modifiedArtifact(
                     self.type_s, self.mod_date, self.project, c.user)
@@ -644,7 +644,7 @@ class Feed(MappedClass):
 
 
     @classmethod
-    def post(cls, artifact, title=None, description=None, author=None, author_link=None, author_name=None, pubdate=None, link=None):
+    def post(cls, artifact, title=None, description=None, author=None, author_link=None, author_name=None, pubdate=None, link=None, **kw):
         """
         Create a Feed item.  Returns the item.
         But if anon doesn't have read access, create does not happen and None is returned
@@ -666,10 +666,8 @@ class Feed(MappedClass):
         if description is None: description = title
         if pubdate is None:
             pubdate = datetime.utcnow()
-
         if link is None:
             link=artifact.url()
-
         item = cls(
             ref_id=artifact.index_id(),
             neighborhood_id=artifact.app_config.project.neighborhood_id,
@@ -682,6 +680,9 @@ class Feed(MappedClass):
             pubdate=pubdate,
             author_name=author_name,
             author_link=author_link or author.url())
+        unique_id = kw.pop('unique_id', None)
+        if unique_id:
+            item.unique_id = unique_id
         return item
 
     @classmethod
@@ -709,7 +710,7 @@ class Feed(MappedClass):
                           link=h.absurl(r.link.encode('utf-8')),
                           pubdate=r.pubdate,
                           description=r.description,
-                          unique_id=r.unique_id,
+                          unique_id=h.absurl(r.unique_id),
                           author_name=r.author_name,
                           author_link=h.absurl(r.author_link))
         return feed

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/3e45f5de/Allura/allura/model/repo_refresh.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/repo_refresh.py b/Allura/allura/model/repo_refresh.py
index 58a5411..3d5f08b 100644
--- a/Allura/allura/model/repo_refresh.py
+++ b/Allura/allura/model/repo_refresh.py
@@ -408,7 +408,8 @@ def send_notifications(repo, commit_ids):
                     summary, href),
                 author_link=ci.author_url,
                 author_name=ci.authored.name,
-                link=href)
+                link=href,
+                unique_id=href)
             branches = repo.symbolics_for_commit(ci)[0]
             commit_msgs.append('%s: %s by %s %s%s' % (
                     ",".join(b for b in branches),

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/3e45f5de/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 11cf6aa..0552f8a 100644
--- a/ForgeGit/forgegit/tests/functional/test_controllers.py
+++ b/ForgeGit/forgegit/tests/functional/test_controllers.py
@@ -179,6 +179,7 @@ class TestRootController(_TestCase):
             assert_equal(commit.find('title').text, 'Initial commit')
             link = 'http://localhost:80/p/test/src-git/ci/9a7df788cf800241e3bb5a849c8870f2f8259d98/'
             assert_equal(commit.find('link').text, link)
+            assert_equal(commit.find('guid').text, link)
         # .atom has slightly different structure
         prefix = '{http://www.w3.org/2005/Atom}'
         r = self.app.get('/src-git/feed.atom')


[3/5] git commit: [#5644] ticket:332 Fixes for svn feed

Posted by br...@apache.org.
[#5644] ticket:332 Fixes for svn feed


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

Branch: refs/heads/master
Commit: e7b5be4cb352aec3c57dcc11c92ae5cd5863a9c5
Parents: 3e45f5d
Author: Igor Bondarenko <je...@gmail.com>
Authored: Fri May 10 13:53:02 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Wed May 15 19:23:48 2013 +0000

----------------------------------------------------------------------
 ForgeSVN/forgesvn/controllers.py                   |    9 ++++-
 .../forgesvn/tests/functional/test_controllers.py  |   28 +++++++++++++-
 2 files changed, 34 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/e7b5be4c/ForgeSVN/forgesvn/controllers.py
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/controllers.py b/ForgeSVN/forgesvn/controllers.py
index 66709f0..1706483 100644
--- a/ForgeSVN/forgesvn/controllers.py
+++ b/ForgeSVN/forgesvn/controllers.py
@@ -20,7 +20,7 @@ from tg.decorators import with_trailing_slash
 from pylons import tmpl_context as c
 
 from allura.controllers import repository
-from allura.controllers.feed import FeedController
+from allura.controllers.feed import FeedController, FeedArgs
 
 
 class BranchBrowser(repository.BranchBrowser, FeedController):
@@ -28,6 +28,13 @@ class BranchBrowser(repository.BranchBrowser, FeedController):
     def __init__(self):
         super(BranchBrowser, self).__init__(None)
 
+    def get_feed(self, project, app, user):
+        query = dict(project_id=project._id, app_config_id=app.config._id)
+        pname, repo =  (project.shortname, app.config.options.mount_label)
+        title = '%s %s changes' % (pname, repo)
+        description = 'Recent changes to %s repository in %s project' % (repo, pname)
+        return FeedArgs(query, title, app.url, description=description)
+
     @expose('jinja:forgesvn:templates/svn/index.html')
     @with_trailing_slash
     def index(self, limit=None, page=0, count=0, **kw):

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/e7b5be4c/ForgeSVN/forgesvn/tests/functional/test_controllers.py
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/tests/functional/test_controllers.py b/ForgeSVN/forgesvn/tests/functional/test_controllers.py
index 9ab3b57..46a42e3 100644
--- a/ForgeSVN/forgesvn/tests/functional/test_controllers.py
+++ b/ForgeSVN/forgesvn/tests/functional/test_controllers.py
@@ -20,6 +20,7 @@ import json
 import pkg_resources
 from pylons import tmpl_context as c
 from ming.orm import ThreadLocalORMSession
+from nose.tools import assert_equal
 
 from allura import model as M
 from allura.lib import helpers as h
@@ -90,8 +91,31 @@ class TestRootController(SVNTestController):
                 assert val['message'] == 'Create readme'
 
     def test_feed(self):
-        for ext in ['', '.rss', '.atom']:
-            assert 'Remove hello.txt' in self.app.get('/src/feed%s' % ext)
+        for ext in ['', '.rss']:
+            r = self.app.get('/src/feed%s' % ext)
+            channel = r.xml.find('channel')
+            title = channel.find('title').text
+            assert_equal(title, 'test SVN changes')
+            description = channel.find('description').text
+            assert_equal(description, 'Recent changes to SVN repository in test project')
+            link = channel.find('link').text
+            assert_equal(link, 'http://localhost:80/p/test/src/')
+            commit = channel.find('item')
+            assert_equal(commit.find('title').text, 'Create readme')
+            link = 'http://localhost:80/p/test/src/1/'
+            assert_equal(commit.find('link').text, link)
+            assert_equal(commit.find('guid').text, link)
+        # .atom has slightly different structure
+        prefix = '{http://www.w3.org/2005/Atom}'
+        r = self.app.get('/src/feed.atom')
+        title = r.xml.find(prefix + 'title').text
+        assert_equal(title, 'test SVN changes')
+        link = r.xml.find(prefix + 'link').attrib['href']
+        assert_equal(link, 'http://localhost:80/p/test/src/')
+        commit = r.xml.find(prefix + 'entry')
+        assert_equal(commit.find(prefix + 'title').text, 'Create readme')
+        link = 'http://localhost:80/p/test/src/1/'
+        assert_equal(commit.find(prefix + 'link').attrib['href'], link)
 
     def test_commit(self):
         resp = self.app.get('/src/3/tree/')


[5/5] git commit: [#5644] remove duplication

Posted by br...@apache.org.
[#5644] remove duplication


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

Branch: refs/heads/master
Commit: 6c43eac6be549f1c36b82f90eb8470466822cc1c
Parents: fb4b541
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Wed May 15 19:23:20 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Wed May 15 19:23:48 2013 +0000

----------------------------------------------------------------------
 ForgeSVN/forgesvn/controllers.py |    6 +-----
 1 files changed, 1 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/6c43eac6/ForgeSVN/forgesvn/controllers.py
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/controllers.py b/ForgeSVN/forgesvn/controllers.py
index 1706483..44d1a69 100644
--- a/ForgeSVN/forgesvn/controllers.py
+++ b/ForgeSVN/forgesvn/controllers.py
@@ -29,11 +29,7 @@ class BranchBrowser(repository.BranchBrowser, FeedController):
         super(BranchBrowser, self).__init__(None)
 
     def get_feed(self, project, app, user):
-        query = dict(project_id=project._id, app_config_id=app.config._id)
-        pname, repo =  (project.shortname, app.config.options.mount_label)
-        title = '%s %s changes' % (pname, repo)
-        description = 'Recent changes to %s repository in %s project' % (repo, pname)
-        return FeedArgs(query, title, app.url, description=description)
+        return repository.RepoRootController().get_feed(project, app, user)
 
     @expose('jinja:forgesvn:templates/svn/index.html')
     @with_trailing_slash


[2/5] git commit: [#5644] ticket:332 Better repo feed

Posted by br...@apache.org.
[#5644] ticket:332 Better repo feed


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

Branch: refs/heads/master
Commit: 63b4e59163f226be9f2971882ea97c76e675050b
Parents: 78e97ac
Author: Igor Bondarenko <je...@gmail.com>
Authored: Fri May 10 11:16:53 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Wed May 15 19:23:47 2013 +0000

----------------------------------------------------------------------
 Allura/allura/controllers/repository.py            |    9 ++++-
 Allura/allura/model/repo_refresh.py                |   16 +++++++--
 .../forgegit/tests/functional/test_controllers.py  |   26 +++++++++++++-
 3 files changed, 45 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/63b4e591/Allura/allura/controllers/repository.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/repository.py b/Allura/allura/controllers/repository.py
index e444db7..6c8cc7d 100644
--- a/Allura/allura/controllers/repository.py
+++ b/Allura/allura/controllers/repository.py
@@ -49,7 +49,7 @@ from allura.lib.widgets.subscriptions import SubscribeForm
 from allura import model as M
 from allura.lib.widgets import form_fields as ffw
 from allura.controllers.base import DispatchIndex
-from allura.controllers.feed import FeedController
+from allura.controllers.feed import FeedController, FeedArgs
 from allura.lib.diff import HtmlSideBySideDiff
 from paste.deploy.converters import asbool
 from allura.app import SitemapEntry
@@ -66,6 +66,13 @@ class RepoRootController(BaseController, FeedController):
     _discuss = AppDiscussionController()
     commit_browser_widget=SCMCommitBrowserWidget()
 
+    def get_feed(self, project, app, user):
+        query = dict(project_id=project._id, app_config_id=app.config._id)
+        pname, repo =  (project.shortname, app.config.options.mount_label)
+        title = '%s %s changes' % (pname, repo)
+        description = 'Recent changes to %s repository in %s project' % (repo, pname)
+        return FeedArgs(query, title, app.url, description=description)
+
     def _check_security(self):
         security.require(security.has_access(c.app, 'read'))
 

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/63b4e591/Allura/allura/model/repo_refresh.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/repo_refresh.py b/Allura/allura/model/repo_refresh.py
index f0d9c75..58a5411 100644
--- a/Allura/allura/model/repo_refresh.py
+++ b/Allura/allura/model/repo_refresh.py
@@ -23,7 +23,7 @@ from collections import OrderedDict
 import bson
 
 import tg
-
+import jinja2
 from pylons import tmpl_context as c, app_globals as g
 
 from ming.base import Object
@@ -400,13 +400,15 @@ def send_notifications(repo, commit_ids):
         for oid in chunk:
             ci = index[oid]
             href = repo.url_for_commit(oid)
+            title = _title(ci.message)
             summary = _summarize(ci.message)
             Feed.post(
-                repo, title='New commit',
+                repo, title=title,
                 description='%s<br><a href="%s">View Changes</a>' % (
                     summary, href),
                 author_link=ci.author_url,
-                author_name=ci.authored.name)
+                author_name=ci.authored.name,
+                link=href)
             branches = repo.symbolics_for_commit(ci)[0]
             commit_msgs.append('%s: %s by %s %s%s' % (
                     ",".join(b for b in branches),
@@ -433,6 +435,14 @@ def send_notifications(repo, commit_ids):
             subject=subject,
             text=text)
 
+
+def _title(message):
+    if not message:
+        return ''
+    line = message.splitlines()[0]
+    return jinja2.filters.do_truncate(line, 200, True)
+
+
 def _summarize(message):
     if not message: return ''
     summary = []

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/63b4e591/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 e1efee9..11cf6aa 100644
--- a/ForgeGit/forgegit/tests/functional/test_controllers.py
+++ b/ForgeGit/forgegit/tests/functional/test_controllers.py
@@ -166,8 +166,30 @@ class TestRootController(_TestCase):
         assert 'Rick' in resp, resp.showbrowser()
 
     def test_feed(self):
-        for ext in ['', '.rss', '.atom']:
-            assert 'Add README' in self.app.get('/feed%s' % ext)
+        for ext in ['', '.rss']:
+            r = self.app.get('/src-git/feed%s' % ext)
+            channel = r.xml.find('channel')
+            title = channel.find('title').text
+            assert_equal(title, 'test Git changes')
+            description = channel.find('description').text
+            assert_equal(description, 'Recent changes to Git repository in test project')
+            link = channel.find('link').text
+            assert_equal(link, 'http://localhost:80/p/test/src-git/')
+            commit = channel.find('item')
+            assert_equal(commit.find('title').text, 'Initial commit')
+            link = 'http://localhost:80/p/test/src-git/ci/9a7df788cf800241e3bb5a849c8870f2f8259d98/'
+            assert_equal(commit.find('link').text, link)
+        # .atom has slightly different structure
+        prefix = '{http://www.w3.org/2005/Atom}'
+        r = self.app.get('/src-git/feed.atom')
+        title = r.xml.find(prefix + 'title').text
+        assert_equal(title, 'test Git changes')
+        link = r.xml.find(prefix + 'link').attrib['href']
+        assert_equal(link, 'http://localhost:80/p/test/src-git/')
+        commit = r.xml.find(prefix + 'entry')
+        assert_equal(commit.find(prefix + 'title').text, 'Initial commit')
+        link = 'http://localhost:80/p/test/src-git/ci/9a7df788cf800241e3bb5a849c8870f2f8259d98/'
+        assert_equal(commit.find(prefix + 'link').attrib['href'], link)
 
     def test_tree(self):
         ci = self._get_ci()


[4/5] git commit: [#5644] ticket:332 Fix svn tests

Posted by br...@apache.org.
[#5644] ticket:332 Fix svn tests


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

Branch: refs/heads/master
Commit: fb4b541dfec956458e17dc475b88ef5f157a568c
Parents: e7b5be4
Author: Igor Bondarenko <je...@gmail.com>
Authored: Fri May 10 14:18:12 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Wed May 15 19:23:48 2013 +0000

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


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/fb4b541d/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 68e884c..820f493 100644
--- a/ForgeSVN/forgesvn/tests/model/test_repository.py
+++ b/ForgeSVN/forgesvn/tests/model/test_repository.py
@@ -594,8 +594,7 @@ class TestRepo(_TestWithRepo):
         else:
             assert False, 'Did not find notification'
         assert M.Feed.query.find(dict(
-            title='New commit',
-            author_name=committer_name)).count()
+            author_name=committer_name)).count() == 100
 
     def test_refresh_private(self):
         ci = mock.Mock()