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

Delta Between Two Patch Sets: sitescripts/hg/test/update_issues.py

Issue 29344546: Issue 4070 - Correctly handle multiline commit messages in the mercurial hook (Closed)
Left Patch Set: Created May 25, 2016, 5:13 p.m.
Right 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.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « sitescripts/hg/template/issue_commit_comment.tmpl ('k') | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 # This file is part of the Adblock Plus web scripts, 1 # This file is part of the Adblock Plus web scripts,
2 # Copyright (C) 2006-2016 Eyeo GmbH 2 # Copyright (C) 2006-2016 Eyeo GmbH
3 # 3 #
4 # Adblock Plus is free software: you can redistribute it and/or modify 4 # Adblock Plus is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License version 3 as 5 # it under the terms of the GNU General Public License version 3 as
6 # published by the Free Software Foundation. 6 # published by the Free Software Foundation.
7 # 7 #
8 # Adblock Plus is distributed in the hope that it will be useful, 8 # Adblock Plus is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 def test_noissue_commits_ignored(self): 135 def test_noissue_commits_ignored(self):
136 self._run_hook(['Noissue - Foo', 'noissue - Bar']) # No updates. 136 self._run_hook(['Noissue - Foo', 'noissue - Bar']) # No updates.
137 137
138 def test_single_issue_referenced(self): 138 def test_single_issue_referenced(self):
139 updates = self._run_hook(['Issue 1337 - Foo'], update_count=1) 139 updates = self._run_hook(['Issue 1337 - Foo'], update_count=1)
140 self.assertEqual(updates[0][0][0], 1337) 140 self.assertEqual(updates[0][0][0], 1337)
141 141
142 def test_multiline_commit_message(self): 142 def test_multiline_commit_message(self):
143 updates = self._run_hook(['Issue 1337 - Foo\nBar', 143 updates = self._run_hook(['Issue 1337 - Foo\nBar',
144 'Issue 1337 - Bar.\nBaz', 144 'Issue 1337 - Bar.\nBaz',
145 'Fixes 2448 - Foo\n\nBar'], 145 'Fixes 2448 - Foo\n\nBar',
146 'Fixes 2448 - Bar\n \nBaz'],
146 update_count=2) 147 update_count=2)
147 comment_1337 = updates[0][0][1] 148 comment_1337 = updates[0][0][1]
148 self.assertIn('Issue 1337 - Foo...]', comment_1337) 149 self.assertIn('Issue 1337 - Foo...]', comment_1337)
149 self.assertIn('Issue 1337 - Bar...]', comment_1337) 150 self.assertIn('Issue 1337 - Bar...]', comment_1337)
150 comment_2448 = updates[1][0][1] 151 comment_2448 = updates[1][0][1]
151 self.assertIn('Fixes 2448 - Foo]', comment_2448) 152 self.assertIn('Fixes 2448 - Foo]', comment_2448)
153 self.assertIn('Fixes 2448 - Bar]', comment_2448)
154
155 def test_multiline_commit_message_crlf(self):
156 updates = self._run_hook(['Issue 1337 - Foo\r\nBar',
157 'Issue 1337 - Bar.\r\nBaz',
158 'Fixes 2448 - Foo\r\n\r\nBar',
159 'Fixes 2448 - Bar\r\n \r\nBaz'],
160 update_count=2)
161 comment_1337 = updates[0][0][1]
162 self.assertIn('Issue 1337 - Foo...]', comment_1337)
163 self.assertIn('Issue 1337 - Bar...]', comment_1337)
164 comment_2448 = updates[1][0][1]
165 self.assertIn('Fixes 2448 - Foo]', comment_2448)
166 self.assertIn('Fixes 2448 - Bar]', comment_2448)
152 167
153 def test_missing_issue_referenced(self): 168 def test_missing_issue_referenced(self):
154 self._run_hook(['Issue 42 - Bar'], warning_count=1) 169 self._run_hook(['Issue 42 - Bar'], warning_count=1)
155 170
156 def test_multiple_issues_referenced(self): 171 def test_multiple_issues_referenced(self):
157 updates = self._run_hook(['Issue 1337, fixes 2448 - Foo'], 172 updates = self._run_hook(['Issue 1337, fixes 2448 - Foo'],
158 update_count=2) 173 update_count=2)
159 self.assertEqual(updates[0][0][0], 1337) 174 self.assertEqual(updates[0][0][0], 1337)
160 self.assertEqual(updates[1][0][0], 2448) 175 self.assertEqual(updates[1][0][0], 2448)
161 176
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 233
219 def test_fix_nonexistent(self): 234 def test_fix_nonexistent(self):
220 self._run_hook(['Fixes 7331 - Foo'], warning_count=1) 235 self._run_hook(['Fixes 7331 - Foo'], warning_count=1)
221 236
222 def test_fix_closed_with_assigned_milestone(self): 237 def test_fix_closed_with_assigned_milestone(self):
223 self._run_hook(['fixes 3559 - Foo']) # No updates. 238 self._run_hook(['fixes 3559 - Foo']) # No updates.
224 239
225 240
226 if __name__ == '__main__': 241 if __name__ == '__main__':
227 unittest.main() 242 unittest.main()
LEFTRIGHT

Powered by Google App Engine
This is Rietveld