Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: sitescripts/hg/test/update_issues.py

Issue 29344546: Issue 4070 - Correctly handle multiline commit messages in the mercurial hook (Closed)
Patch Set: Remove redundant check for the final period in the first line of the commit message Created May 26, 2016, 7:32 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sitescripts/hg/template/issue_commit_comment.tmpl ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sitescripts/hg/test/update_issues.py
===================================================================
--- a/sitescripts/hg/test/update_issues.py
+++ b/sitescripts/hg/test/update_issues.py
@@ -134,16 +134,42 @@
def test_noissue_commits_ignored(self):
self._run_hook(['Noissue - Foo', 'noissue - Bar']) # No updates.
def test_single_issue_referenced(self):
updates = self._run_hook(['Issue 1337 - Foo'], update_count=1)
self.assertEqual(updates[0][0][0], 1337)
+ def test_multiline_commit_message(self):
+ updates = self._run_hook(['Issue 1337 - Foo\nBar',
+ 'Issue 1337 - Bar.\nBaz',
+ 'Fixes 2448 - Foo\n\nBar',
+ 'Fixes 2448 - Bar\n \nBaz'],
+ update_count=2)
+ comment_1337 = updates[0][0][1]
+ self.assertIn('Issue 1337 - Foo...]', comment_1337)
+ self.assertIn('Issue 1337 - Bar...]', comment_1337)
+ comment_2448 = updates[1][0][1]
+ self.assertIn('Fixes 2448 - Foo]', comment_2448)
+ self.assertIn('Fixes 2448 - Bar]', comment_2448)
+
+ def test_multiline_commit_message_crlf(self):
+ updates = self._run_hook(['Issue 1337 - Foo\r\nBar',
+ 'Issue 1337 - Bar.\r\nBaz',
+ 'Fixes 2448 - Foo\r\n\r\nBar',
+ 'Fixes 2448 - Bar\r\n \r\nBaz'],
+ update_count=2)
+ comment_1337 = updates[0][0][1]
+ self.assertIn('Issue 1337 - Foo...]', comment_1337)
+ self.assertIn('Issue 1337 - Bar...]', comment_1337)
+ comment_2448 = updates[1][0][1]
+ self.assertIn('Fixes 2448 - Foo]', comment_2448)
+ self.assertIn('Fixes 2448 - Bar]', comment_2448)
+
def test_missing_issue_referenced(self):
self._run_hook(['Issue 42 - Bar'], warning_count=1)
def test_multiple_issues_referenced(self):
updates = self._run_hook(['Issue 1337, fixes 2448 - Foo'],
update_count=2)
self.assertEqual(updates[0][0][0], 1337)
self.assertEqual(updates[1][0][0], 2448)
« no previous file with comments | « sitescripts/hg/template/issue_commit_comment.tmpl ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld