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

Side by Side Diff: sitescripts/hg/bin/update_issues.py

Issue 29756646: Noissue - Adapt best practices for trailing commas (abpssembly) (Closed)
Patch Set: Re-run script on Python 2, added flake8-commas extension Created April 19, 2018, 2:41 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « sitescripts/formmail/web/formmail2.py ('k') | sitescripts/hg/test/update_issues.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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-present eyeo GmbH 2 # Copyright (C) 2006-present 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 77
78 78
79 def _post_comments(ui, repo, config, refs): 79 def _post_comments(ui, repo, config, refs):
80 repo_name = posixpath.split(repo.url())[1] 80 repo_name = posixpath.split(repo.url())[1]
81 template = get_template('hg/template/issue_commit_comment.tmpl', 81 template = get_template('hg/template/issue_commit_comment.tmpl',
82 autoescape=False) 82 autoescape=False)
83 for ref in refs: 83 for ref in refs:
84 comment_text = template.render({ 84 comment_text = template.render({
85 'repository_name': repo_name, 85 'repository_name': repo_name,
86 'changes': ref.commits, 86 'changes': ref.commits,
87 'format_description': _format_description 87 'format_description': _format_description,
88 }) 88 })
89 with _trac_proxy(ui, config, 'getting issue {}'.format(ref.id)) as tp: 89 with _trac_proxy(ui, config, 'getting issue {}'.format(ref.id)) as tp:
90 attrs = tp.ticket.get(ref.id)[3] 90 attrs = tp.ticket.get(ref.id)[3]
91 changes = {'_ts': attrs['_ts'], 'action': 'leave'} 91 changes = {'_ts': attrs['_ts'], 'action': 'leave'}
92 _update_issue(ui, config, ref.id, changes, comment_text) 92 _update_issue(ui, config, ref.id, changes, comment_text)
93 93
94 94
95 def _compile_module_regexps(ui, config, modules): 95 def _compile_module_regexps(ui, config, modules):
96 for module, regexp in config.items('hg_module_milestones'): 96 for module, regexp in config.items('hg_module_milestones'):
97 try: 97 try:
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 def _declare_fixed(ui, config, refs): 131 def _declare_fixed(ui, config, refs):
132 updates = [] 132 updates = []
133 # Changes that need milestones added to them, indexed by module. 133 # Changes that need milestones added to them, indexed by module.
134 need_milestones = collections.defaultdict(list) 134 need_milestones = collections.defaultdict(list)
135 135
136 for ref in refs: 136 for ref in refs:
137 with _trac_proxy(ui, config, 'getting issue {}'.format(ref.id)) as tp: 137 with _trac_proxy(ui, config, 'getting issue {}'.format(ref.id)) as tp:
138 attrs = tp.ticket.get(ref.id)[3] 138 attrs = tp.ticket.get(ref.id)[3]
139 changes = { 139 changes = {
140 '_ts': attrs['_ts'], 140 '_ts': attrs['_ts'],
141 'action': 'leave' 141 'action': 'leave',
142 } 142 }
143 actions = tp.ticket.getActions(ref.id) 143 actions = tp.ticket.getActions(ref.id)
144 if any(action[0] == 'resolve' for action in actions): 144 if any(action[0] == 'resolve' for action in actions):
145 changes['action'] = 'resolve' 145 changes['action'] = 'resolve'
146 if not attrs['milestone']: 146 if not attrs['milestone']:
147 need_milestones[attrs['component']].append(changes) 147 need_milestones[attrs['component']].append(changes)
148 updates.append((ref.id, changes)) 148 updates.append((ref.id, changes))
149 149
150 for module, milestone in _get_module_milestones(ui, config, 150 for module, milestone in _get_module_milestones(ui, config,
151 need_milestones.keys()): 151 need_milestones.keys()):
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 added_revs = repo.changelog.findmissingrevs([old_master_rev], 203 added_revs = repo.changelog.findmissingrevs([old_master_rev],
204 [new_master_rev]) 204 [new_master_rev])
205 added_commits = [repo[rev] for rev in added_revs] 205 added_commits = [repo[rev] for rev in added_revs]
206 refs = [ref for ref in _collect_references(ui, added_commits) 206 refs = [ref for ref in _collect_references(ui, added_commits)
207 if ref.is_fixed] 207 if ref.is_fixed]
208 _declare_fixed(ui, config, refs) 208 _declare_fixed(ui, config, refs)
209 209
210 210
211 # Alias for backward compatibility. 211 # Alias for backward compatibility.
212 hook = changegroup_hook 212 hook = changegroup_hook
OLDNEW
« no previous file with comments | « sitescripts/formmail/web/formmail2.py ('k') | sitescripts/hg/test/update_issues.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld