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 """\ | 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 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 def UpdateRietveldDescription(self): | 372 def UpdateRietveldDescription(self): |
373 """Sets the description for an issue on Rietveld.""" | 373 """Sets the description for an issue on Rietveld.""" |
374 data = [("description", self.description),] | 374 data = [("description", self.description),] |
375 ctype, body = upload.EncodeMultipartFormData(data, []) | 375 ctype, body = upload.EncodeMultipartFormData(data, []) |
376 self.SendToRietveld('/%d/description' % self.issue, payload=body, | 376 self.SendToRietveld('/%d/description' % self.issue, payload=body, |
377 content_type=ctype) | 377 content_type=ctype) |
378 self.needs_upload = False | 378 self.needs_upload = False |
379 | 379 |
380 def GetIssueDescription(self): | 380 def GetIssueDescription(self): |
381 """Returns the issue description from Rietveld.""" | 381 """Returns the issue description from Rietveld.""" |
382 return self.SendToRietveld('/%d/description' % self.issue) | 382 return self.SendToRietveld('/%d/description' % self.issue).replace('\r\n', |
| 383 '\n') |
383 | 384 |
384 def UpdateDescriptionFromIssue(self): | 385 def UpdateDescriptionFromIssue(self): |
385 """Updates self.description with the issue description from Rietveld.""" | 386 """Updates self.description with the issue description from Rietveld.""" |
386 self._desc = git_cl.ChangeDescription( | 387 self._desc = git_cl.ChangeDescription(self.GetIssueDescription()) |
387 self.SendToRietveld('/%d/description' % self.issue)) | |
388 | 388 |
389 def GetApprovingReviewers(self): | 389 def GetApprovingReviewers(self): |
390 """Returns the issue reviewers list from Rietveld.""" | 390 """Returns the issue reviewers list from Rietveld.""" |
391 return git_cl.get_approving_reviewers( | 391 return git_cl.get_approving_reviewers( |
392 self.RpcServer().get_issue_properties(self.issue, True)) | 392 self.RpcServer().get_issue_properties(self.issue, True)) |
393 | 393 |
394 def AddComment(self, comment): | 394 def AddComment(self, comment): |
395 """Adds a comment for an issue on Rietveld. | 395 """Adds a comment for an issue on Rietveld. |
396 As a side effect, this will email everyone associated with the issue.""" | 396 As a side effect, this will email everyone associated with the issue.""" |
397 return self.RpcServer().add_comment(self.issue, comment) | 397 return self.RpcServer().add_comment(self.issue, comment) |
(...skipping 1069 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1467 raise | 1467 raise |
1468 print >> sys.stderr, ( | 1468 print >> sys.stderr, ( |
1469 'AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' | 1469 'AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' |
1470 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e)) | 1470 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e)) |
1471 return 1 | 1471 return 1 |
1472 | 1472 |
1473 | 1473 |
1474 if __name__ == "__main__": | 1474 if __name__ == "__main__": |
1475 fix_encoding.fix_encoding() | 1475 fix_encoding.fix_encoding() |
1476 sys.exit(main(sys.argv[1:])) | 1476 sys.exit(main(sys.argv[1:])) |
OLD | NEW |