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

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

Issue 29344546: Issue 4070 - Correctly handle multiline commit messages in the mercurial hook (Closed)
Left Patch Set: Handle CRLF line breaks and whitespace in the second line Created May 26, 2016, 9:22 a.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 | « no previous file | sitescripts/hg/template/issue_commit_comment.tmpl » ('j') | 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 Adblock Plus <https://adblockplus.org/>, 1 # This file is part of Adblock Plus <https://adblockplus.org/>,
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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 with _trac_proxy(ui, config, 'updating issue {}'.format(issue_id)) as tp: 66 with _trac_proxy(ui, config, 'updating issue {}'.format(issue_id)) as tp:
67 tp.ticket.update(issue_id, comment, changes, True) 67 tp.ticket.update(issue_id, comment, changes, True)
68 ui.status('updated {}:\n{}\n'.format(issue_url, '\n'.join(updates))) 68 ui.status('updated {}:\n{}\n'.format(issue_url, '\n'.join(updates)))
69 69
70 70
71 def _format_description(change): 71 def _format_description(change):
72 lines = change.description().splitlines() 72 lines = change.description().splitlines()
73 message = lines[0].rstrip() 73 message = lines[0].rstrip()
74 if len(lines) == 1 or lines[1].strip() == '': 74 if len(lines) == 1 or lines[1].strip() == '':
75 return message 75 return message
76 if message.endswith('.'): 76 return message.rstrip('.') + '...'
Sebastian Noack 2016/05/26 10:44:07 This check seems redundant.
Vasily Kuznetsov 2016/05/26 19:34:00 Indeed. Done.
77 message = message.rstrip('.')
78 return message + '...'
79 77
80 78
81 def _post_comments(ui, repo, config, refs): 79 def _post_comments(ui, repo, config, refs):
82 repo_name = posixpath.split(repo.url())[1] 80 repo_name = posixpath.split(repo.url())[1]
83 template = get_template('hg/template/issue_commit_comment.tmpl', 81 template = get_template('hg/template/issue_commit_comment.tmpl',
84 autoescape=False) 82 autoescape=False)
85 for ref in refs: 83 for ref in refs:
86 comment_text = template.render({ 84 comment_text = template.render({
87 'repository_name': repo_name, 85 'repository_name': repo_name,
88 'changes': ref.commits, 86 'changes': ref.commits,
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 added_revs = repo.changelog.findmissingrevs([old_master_rev], 203 added_revs = repo.changelog.findmissingrevs([old_master_rev],
206 [new_master_rev]) 204 [new_master_rev])
207 added_commits = [repo[rev] for rev in added_revs] 205 added_commits = [repo[rev] for rev in added_revs]
208 refs = [ref for ref in _collect_references(ui, added_commits) 206 refs = [ref for ref in _collect_references(ui, added_commits)
209 if ref.is_fixed] 207 if ref.is_fixed]
210 _declare_fixed(ui, config, refs) 208 _declare_fixed(ui, config, refs)
211 209
212 210
213 # Alias for backward compatibility. 211 # Alias for backward compatibility.
214 hook = changegroup_hook 212 hook = changegroup_hook
LEFTRIGHT

Powered by Google App Engine
This is Rietveld