You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by tv...@apache.org on 2013/05/23 21:46:29 UTC
[1/3] git commit: [#6125] Change format of commit email subject line
Updated Branches:
refs/heads/tv/6125 [created] e409b0ee5
[#6125] Change format of commit email subject line
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/e409b0ee
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/e409b0ee
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/e409b0ee
Branch: refs/heads/tv/6125
Commit: e409b0ee51523fe52e819af10408933aa96fd033
Parents: 22cb1a0
Author: Tim Van Steenburgh <tv...@gmail.com>
Authored: Thu May 23 19:43:36 2013 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Thu May 23 19:46:06 2013 +0000
----------------------------------------------------------------------
Allura/allura/model/repo_refresh.py | 13 ++++---------
ForgeGit/forgegit/tests/model/test_repository.py | 2 +-
ForgeSVN/forgesvn/tests/model/test_repository.py | 2 +-
3 files changed, 6 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/e409b0ee/Allura/allura/model/repo_refresh.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/repo_refresh.py b/Allura/allura/model/repo_refresh.py
index 823e09f..e2821f6 100644
--- a/Allura/allura/model/repo_refresh.py
+++ b/Allura/allura/model/repo_refresh.py
@@ -420,18 +420,13 @@ 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:
- 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' % (
+ subject = '{0} - {1} committed: {2}'.format(
+ repo.shorthand_for_commit(ci._id),
ci.authored.name,
- revision_id,
summary)
branches = repo.symbolics_for_commit(ci)[0]
- text_branches = ''
- if branches:
- text_branches = '%s: ' % ",".join(b for b in branches)
+ text_branches = ('%s: ' % ",".join(b for b in branches)
+ if branches else '')
text = "%s%s %s%s" % (text_branches,
ci.message,
base_url, ci.url())
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/e409b0ee/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 150b6e2..2eb90da 100644
--- a/ForgeGit/forgegit/tests/model/test_repository.py
+++ b/ForgeGit/forgegit/tests/model/test_repository.py
@@ -264,7 +264,7 @@ class TestGitRepo(unittest.TestCase, RepoImplTestBase):
ThreadLocalORMSession.flush_all()
notifications = M.Notification.query.find().sort('pubdate')
n = notifications.all()[2]
- assert_equal(n.subject, '[test:src-git] Rick Copeland committed revision 1e146e67985dcd71c74de79613719bef7bddca4a: Change README')
+ assert_equal(n.subject, '[test:src-git] [1e146e] - Rick Copeland committed: Change README')
assert 'master,zz: ' in n.text
send_notifications(self.repo, ['1e146e67985dcd71c74de79613719bef7bddca4a', 'df30427c488aeab84b2352bdf88a3b19223f9d7a'])
ThreadLocalORMSession.flush_all()
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/e409b0ee/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 3ff7127..082d423 100644
--- a/ForgeSVN/forgesvn/tests/model/test_repository.py
+++ b/ForgeSVN/forgesvn/tests/model/test_repository.py
@@ -419,7 +419,7 @@ class TestSVNRev(unittest.TestCase):
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.subject, '[test:src] [r1] - rick446 committed: Create readme')
assert_equal(n.text, 'Create readme http://localhost//p/test/src/1/')
[2/3] git commit: [#6125] ticket:342 tests for git repository commit
emails
Posted by tv...@apache.org.
[#6125] ticket:342 tests for git repository commit emails
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/22cb1a01
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/22cb1a01
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/22cb1a01
Branch: refs/heads/tv/6125
Commit: 22cb1a01d3ec16253b53bad078279c43b647d797
Parents: c42a258
Author: Yuriy Arhipov <yu...@yandex.ru>
Authored: Wed May 15 09:00:17 2013 +0400
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Thu May 23 19:46:06 2013 +0000
----------------------------------------------------------------------
ForgeGit/forgegit/tests/model/test_repository.py | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/22cb1a01/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 1e472b3..150b6e2 100644
--- a/ForgeGit/forgegit/tests/model/test_repository.py
+++ b/ForgeGit/forgegit/tests/model/test_repository.py
@@ -35,6 +35,7 @@ from allura.lib import helpers as h
from allura.tests import decorators as td
from allura.tests.model.test_repo import RepoImplTestBase
from allura import model as M
+from allura.model.repo_refresh import send_notifications
from forgegit import model as GM
from forgegit.tests import with_git
from forgewiki import model as WM
@@ -258,6 +259,19 @@ class TestGitRepo(unittest.TestCase, RepoImplTestBase):
self.assertEqual(new_tree.blob_ids, orig_tree.blob_ids)
self.assertEqual(new_tree.other_ids, orig_tree.other_ids)
+ def test_notification_email(self):
+ send_notifications(self.repo, ['1e146e67985dcd71c74de79613719bef7bddca4a', ])
+ ThreadLocalORMSession.flush_all()
+ notifications = M.Notification.query.find().sort('pubdate')
+ n = notifications.all()[2]
+ assert_equal(n.subject, '[test:src-git] Rick Copeland committed revision 1e146e67985dcd71c74de79613719bef7bddca4a: Change README')
+ assert 'master,zz: ' in n.text
+ send_notifications(self.repo, ['1e146e67985dcd71c74de79613719bef7bddca4a', 'df30427c488aeab84b2352bdf88a3b19223f9d7a'])
+ ThreadLocalORMSession.flush_all()
+ notifications = M.Notification.query.find().sort('pubdate')
+ n = notifications.all()[3]
+ assert_equal(n.subject, '[test:src-git] 2 new commits to test Git')
+
def test_tarball(self):
tmpdir = tg.config['scm.repos.tarball.root']
if os.path.isfile(os.path.join(tmpdir, "git/t/te/test/testgit.git/test-src-git-HEAD.zip")):
[3/3] git commit: [#6125] ticket:342 svn repository commit emails
includes revision number
Posted by tv...@apache.org.
[#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/tv/6125
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())