OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """Applies an issue from Rietveld. | 6 """Applies an issue from Rietveld. |
7 """ | 7 """ |
8 | 8 |
9 import getpass | 9 import getpass |
10 import json | 10 import json |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 properties = obj.get_issue_properties(options.issue, False) | 160 properties = obj.get_issue_properties(options.issue, False) |
161 except rietveld.upload.ClientLoginError as e: | 161 except rietveld.upload.ClientLoginError as e: |
162 print('Accessing the issue requires proper credentials.') | 162 print('Accessing the issue requires proper credentials.') |
163 return 1 | 163 return 1 |
164 | 164 |
165 if not options.patchset: | 165 if not options.patchset: |
166 options.patchset = properties['patchsets'][-1] | 166 options.patchset = properties['patchsets'][-1] |
167 print('No patchset specified. Using patchset %d' % options.patchset) | 167 print('No patchset specified. Using patchset %d' % options.patchset) |
168 | 168 |
169 issues_patchsets_to_apply = [(options.issue, options.patchset)] | 169 issues_patchsets_to_apply = [(options.issue, options.patchset)] |
170 depends_on_info = obj.get_depends_on_patchset(options.issue, options.patchset) | 170 |
171 while depends_on_info: | 171 # Temporary comment out the below while we try to figure out what to do with |
172 depends_on_issue = int(depends_on_info['issue']) | 172 # patchset dependencies on trybots. |
173 depends_on_patchset = int(depends_on_info['patchset']) | 173 # TODO(rmistry): Uncomment the below after a solution is found. |
174 try: | 174 # depends_on_info = obj.get_depends_on_patchset(options.issue, |
175 depends_on_info = obj.get_depends_on_patchset(depends_on_issue, | 175 # options.patchset) |
176 depends_on_patchset) | 176 # while depends_on_info: |
177 issues_patchsets_to_apply.insert(0, (depends_on_issue, | 177 # depends_on_issue = int(depends_on_info['issue']) |
178 depends_on_patchset)) | 178 # depends_on_patchset = int(depends_on_info['patchset']) |
179 except urllib2.HTTPError: | 179 # try: |
180 print ('The patchset that was marked as a dependency no longer ' | 180 # depends_on_info = obj.get_depends_on_patchset(depends_on_issue, |
181 'exists: %s/%d/#ps%d' % ( | 181 # depends_on_patchset) |
182 options.server, depends_on_issue, depends_on_patchset)) | 182 # issues_patchsets_to_apply.insert(0, (depends_on_issue, |
183 print 'Therefore it is likely that this patch will not apply cleanly.' | 183 # depends_on_patchset)) |
184 print | 184 # except urllib2.HTTPError: |
185 depends_on_info = None | 185 # print ('The patchset that was marked as a dependency no longer ' |
| 186 # 'exists: %s/%d/#ps%d' % ( |
| 187 # options.server, depends_on_issue, depends_on_patchset)) |
| 188 # print 'Therefore it is likely that this patch will not apply cleanly.' |
| 189 # print |
| 190 # depends_on_info = None |
186 | 191 |
187 num_issues_patchsets_to_apply = len(issues_patchsets_to_apply) | 192 num_issues_patchsets_to_apply = len(issues_patchsets_to_apply) |
188 if num_issues_patchsets_to_apply > 1: | 193 if num_issues_patchsets_to_apply > 1: |
189 print | 194 print |
190 print 'apply_issue.py found %d dependent CLs.' % ( | 195 print 'apply_issue.py found %d dependent CLs.' % ( |
191 num_issues_patchsets_to_apply - 1) | 196 num_issues_patchsets_to_apply - 1) |
192 print 'They will be applied in the following order:' | 197 print 'They will be applied in the following order:' |
193 num = 1 | 198 num = 1 |
194 for issue_to_apply, patchset_to_apply in issues_patchsets_to_apply: | 199 for issue_to_apply, patchset_to_apply in issues_patchsets_to_apply: |
195 print ' #%d %s/%d/#ps%d' % ( | 200 print ' #%d %s/%d/#ps%d' % ( |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 return 0 | 284 return 0 |
280 | 285 |
281 | 286 |
282 if __name__ == "__main__": | 287 if __name__ == "__main__": |
283 fix_encoding.fix_encoding() | 288 fix_encoding.fix_encoding() |
284 try: | 289 try: |
285 sys.exit(main()) | 290 sys.exit(main()) |
286 except KeyboardInterrupt: | 291 except KeyboardInterrupt: |
287 sys.stderr.write('interrupted\n') | 292 sys.stderr.write('interrupted\n') |
288 sys.exit(1) | 293 sys.exit(1) |
OLD | NEW |