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/24 20:18:16 UTC

[40/50] git commit: [#6125] ticket:342 svn repository commit emails includes revision number

[#6125]  ticket:342 svn repository commit emails  includes revision number


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

Branch: refs/heads/db/6007
Commit: c42a258effd6f67fedd2ff64e1e5a2ce113ae242
Parents: 53d8b05
Author: Yuriy Arhipov <yu...@yandex.ru>
Authored: Mon May 13 14:28:38 2013 +0400
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Thu May 23 19:46:06 2013 +0000

----------------------------------------------------------------------
 Allura/allura/model/repo_refresh.py              |   14 +++++++---
 ForgeSVN/forgesvn/tests/model/test_repository.py |   22 +++++++++++++++++
 2 files changed, 32 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/c42a258e/Allura/allura/model/repo_refresh.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/repo_refresh.py b/Allura/allura/model/repo_refresh.py
index 3d5f08b..823e09f 100644
--- a/Allura/allura/model/repo_refresh.py
+++ b/Allura/allura/model/repo_refresh.py
@@ -420,13 +420,19 @@ def send_notifications(repo, commit_ids):
                 len(commit_msgs), repo.app.project.name, repo.app.config.options.mount_label)
             text='\n\n'.join(commit_msgs)
         else:
-            subject = '%s committed to %s %s: %s' % (
+            if c.app.tool_label.lower() == 'svn':
+                revision_id = c.app.repo._impl._revno(ci._id)
+            else:
+                revision_id = ci._id
+            subject = '%s committed revision %s: %s' % (
                 ci.authored.name,
-                repo.app.project.name,
-                repo.app.config.options.mount_label,
+                revision_id,
                 summary)
             branches = repo.symbolics_for_commit(ci)[0]
-            text = "%s: %s %s%s" % (",".join(b for b in branches),
+            text_branches = ''
+            if branches:
+                text_branches = '%s: ' % ",".join(b for b in branches)
+            text = "%s%s %s%s" % (text_branches,
                                ci.message,
                                base_url, ci.url())
 

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/c42a258e/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 288a1b9..3ff7127 100644
--- a/ForgeSVN/forgesvn/tests/model/test_repository.py
+++ b/ForgeSVN/forgesvn/tests/model/test_repository.py
@@ -36,6 +36,7 @@ from IPython.testing.decorators import onlyif
 
 from alluratest.controller import setup_basic_test, setup_global_objects
 from allura import model as M
+from allura.model.repo_refresh import send_notifications
 from allura.lib import helpers as h
 from allura.tests import decorators as td
 from allura.tests.model.test_repo import RepoImplTestBase
@@ -400,6 +401,27 @@ class TestSVNRev(unittest.TestCase):
         commits = self.repo.commits_count('not/exist/')
         assert commits == 0, commits
 
+    def test_notification_email(self):
+        setup_global_objects()
+        h.set_context('test', 'src', neighborhood='Projects')
+        repo_dir = pkg_resources.resource_filename(
+            'forgesvn', 'tests/data/')
+        self.repo = SM.Repository(
+            name='testsvn',
+            fs_path=repo_dir,
+            url_path = '/test/',
+            tool = 'svn',
+            status = 'creating')
+        self.repo.refresh()
+        ThreadLocalORMSession.flush_all()
+        commits = self.repo.commits()
+        send_notifications(self.repo, [commits[4], ])
+        ThreadLocalORMSession.flush_all()
+        notifications = M.Notification.query.find().sort('pubdate')
+        n = notifications.all()[3]
+        assert_equal(n.subject, '[test:src] rick446 committed revision 1: Create readme')
+        assert_equal(n.text, 'Create readme http://localhost//p/test/src/1/')
+
 
 class _Test(unittest.TestCase):
     idgen = ( 'obj_%d' % i for i in count())