OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2011 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 """\ | 6 """\ |
7 Wrapper script around Rietveld's upload.py that simplifies working with groups | 7 Wrapper script around Rietveld's upload.py that simplifies working with groups |
8 of files. | 8 of files. |
9 """ | 9 """ |
10 | 10 |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 name: change name. | 271 name: change name. |
272 issue: the Rietveld issue number or 0 if it hasn't been uploaded yet. | 272 issue: the Rietveld issue number or 0 if it hasn't been uploaded yet. |
273 patchset: the Rietveld latest patchset number or 0. | 273 patchset: the Rietveld latest patchset number or 0. |
274 description: the description. | 274 description: the description. |
275 files: a list of 2 tuple containing (status, filename) of changed files, | 275 files: a list of 2 tuple containing (status, filename) of changed files, |
276 with paths being relative to the top repository directory. | 276 with paths being relative to the top repository directory. |
277 local_root: Local root directory | 277 local_root: Local root directory |
278 rietveld: rietveld server for this change | 278 rietveld: rietveld server for this change |
279 """ | 279 """ |
280 # Kept for unit test support. This is for the old format, it's deprecated. | 280 # Kept for unit test support. This is for the old format, it's deprecated. |
281 _SEPARATOR = "\n-----\n" | 281 SEPARATOR = "\n-----\n" |
282 | 282 |
283 def __init__(self, name, issue, patchset, description, files, local_root, | 283 def __init__(self, name, issue, patchset, description, files, local_root, |
284 rietveld_url, needs_upload): | 284 rietveld_url, needs_upload): |
285 self.name = name | 285 self.name = name |
286 self.issue = int(issue) | 286 self.issue = int(issue) |
287 self.patchset = int(patchset) | 287 self.patchset = int(patchset) |
288 self._description = None | 288 self._description = None |
289 self._subject = None | 289 self._subject = None |
290 self._reviewers = None | 290 self._reviewers = None |
291 self._set_description(description) | 291 self._set_description(description) |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
569 values.get('rietveld'), | 569 values.get('rietveld'), |
570 values['needs_upload']) | 570 values['needs_upload']) |
571 if save: | 571 if save: |
572 change_info.Save() | 572 change_info.Save() |
573 return change_info | 573 return change_info |
574 | 574 |
575 @staticmethod | 575 @staticmethod |
576 def _LoadOldFormat(content): | 576 def _LoadOldFormat(content): |
577 # The info files have the following format: | 577 # The info files have the following format: |
578 # issue_id, patchset\n (, patchset is optional) | 578 # issue_id, patchset\n (, patchset is optional) |
579 # _SEPARATOR\n | 579 # SEPARATOR\n |
580 # filepath1\n | 580 # filepath1\n |
581 # filepath2\n | 581 # filepath2\n |
582 # . | 582 # . |
583 # . | 583 # . |
584 # filepathn\n | 584 # filepathn\n |
585 # _SEPARATOR\n | 585 # SEPARATOR\n |
586 # description | 586 # description |
587 split_data = content.split(ChangeInfo._SEPARATOR, 2) | 587 split_data = content.split(ChangeInfo.SEPARATOR, 2) |
588 if len(split_data) != 3: | 588 if len(split_data) != 3: |
589 raise ValueError('Bad change format') | 589 raise ValueError('Bad change format') |
590 values = { | 590 values = { |
591 'issue': 0, | 591 'issue': 0, |
592 'patchset': 0, | 592 'patchset': 0, |
593 'needs_upload': False, | 593 'needs_upload': False, |
594 'files': [], | 594 'files': [], |
595 } | 595 } |
596 items = split_data[0].split(', ') | 596 items = split_data[0].split(', ') |
597 if items[0]: | 597 if items[0]: |
(...skipping 840 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1438 raise | 1438 raise |
1439 print >> sys.stderr, ( | 1439 print >> sys.stderr, ( |
1440 'AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' | 1440 'AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' |
1441 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e)) | 1441 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e)) |
1442 return 1 | 1442 return 1 |
1443 | 1443 |
1444 | 1444 |
1445 if __name__ == "__main__": | 1445 if __name__ == "__main__": |
1446 fix_encoding.fix_encoding() | 1446 fix_encoding.fix_encoding() |
1447 sys.exit(main(sys.argv[1:])) | 1447 sys.exit(main(sys.argv[1:])) |
OLD | NEW |