| 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 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 def force_description(self, new_description): | 292 def force_description(self, new_description): |
| 293 self._desc = git_cl.ChangeDescription(new_description) | 293 self._desc = git_cl.ChangeDescription(new_description) |
| 294 self.needs_upload = True | 294 self.needs_upload = True |
| 295 | 295 |
| 296 def append_footer(self, line): | 296 def append_footer(self, line): |
| 297 self._desc.append_footer(line) | 297 self._desc.append_footer(line) |
| 298 | 298 |
| 299 def get_reviewers(self): | 299 def get_reviewers(self): |
| 300 return self._desc.get_reviewers() | 300 return self._desc.get_reviewers() |
| 301 | 301 |
| 302 def update_reviewers(self, reviewers): |
| 303 self._desc.update_reviewers(reviewers) |
| 304 |
| 302 def NeedsUpload(self): | 305 def NeedsUpload(self): |
| 303 return self.needs_upload | 306 return self.needs_upload |
| 304 | 307 |
| 305 def GetFileNames(self): | 308 def GetFileNames(self): |
| 306 """Returns the list of file names included in this change.""" | 309 """Returns the list of file names included in this change.""" |
| 307 return [f[1] for f in self._files] | 310 return [f[1] for f in self._files] |
| 308 | 311 |
| 309 def GetFiles(self): | 312 def GetFiles(self): |
| 310 """Returns the list of files included in this change with their status.""" | 313 """Returns the list of files included in this change with their status.""" |
| 311 return self._files | 314 return self._files |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 | 379 |
| 377 def GetIssueDescription(self): | 380 def GetIssueDescription(self): |
| 378 """Returns the issue description from Rietveld.""" | 381 """Returns the issue description from Rietveld.""" |
| 379 return self.SendToRietveld('/%d/description' % self.issue) | 382 return self.SendToRietveld('/%d/description' % self.issue) |
| 380 | 383 |
| 381 def UpdateDescriptionFromIssue(self): | 384 def UpdateDescriptionFromIssue(self): |
| 382 """Updates self.description with the issue description from Rietveld.""" | 385 """Updates self.description with the issue description from Rietveld.""" |
| 383 self._desc = git_cl.ChangeDescription( | 386 self._desc = git_cl.ChangeDescription( |
| 384 self.SendToRietveld('/%d/description' % self.issue)) | 387 self.SendToRietveld('/%d/description' % self.issue)) |
| 385 | 388 |
| 389 def GetApprovingReviewers(self): |
| 390 """Returns the issue reviewers list from Rietveld.""" |
| 391 return git_cl.get_approving_reviewers( |
| 392 self.rietveld.get_issue_properties(self.issue, False)) |
| 393 |
| 386 def AddComment(self, comment): | 394 def AddComment(self, comment): |
| 387 """Adds a comment for an issue on Rietveld. | 395 """Adds a comment for an issue on Rietveld. |
| 388 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.""" |
| 389 return self.RpcServer().add_comment(self.issue, comment) | 397 return self.RpcServer().add_comment(self.issue, comment) |
| 390 | 398 |
| 391 def PrimeLint(self): | 399 def PrimeLint(self): |
| 392 """Do background work on Rietveld to lint the file so that the results are | 400 """Do background work on Rietveld to lint the file so that the results are |
| 393 ready when the issue is viewed.""" | 401 ready when the issue is viewed.""" |
| 394 if self.issue and self.patchset: | 402 if self.issue and self.patchset: |
| 395 self.SendToRietveld('/lint/issue%s_%s' % (self.issue, self.patchset), | 403 self.SendToRietveld('/lint/issue%s_%s' % (self.issue, self.patchset), |
| (...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 988 # dir1\foo.cc. When the user `gcl commit bleh`, foo.cc is *also committed*. | 996 # dir1\foo.cc. When the user `gcl commit bleh`, foo.cc is *also committed*. |
| 989 # The only fix is to use --non-recursive but that has its issues too: | 997 # The only fix is to use --non-recursive but that has its issues too: |
| 990 # Let's say if dir1 is deleted, --non-recursive must *not* be used otherwise | 998 # Let's say if dir1 is deleted, --non-recursive must *not* be used otherwise |
| 991 # you'll get "svn: Cannot non-recursively commit a directory deletion of a | 999 # you'll get "svn: Cannot non-recursively commit a directory deletion of a |
| 992 # directory with child nodes". Yay... | 1000 # directory with child nodes". Yay... |
| 993 commit_cmd = ["svn", "commit"] | 1001 commit_cmd = ["svn", "commit"] |
| 994 if change_info.issue: | 1002 if change_info.issue: |
| 995 # Get the latest description from Rietveld. | 1003 # Get the latest description from Rietveld. |
| 996 change_info.UpdateDescriptionFromIssue() | 1004 change_info.UpdateDescriptionFromIssue() |
| 997 | 1005 |
| 1006 change_info.update_reviewers(change_info.GetApprovingReviewers()) |
| 1007 |
| 998 commit_desc = git_cl.ChangeDescription(change_info.description) | 1008 commit_desc = git_cl.ChangeDescription(change_info.description) |
| 999 if change_info.issue: | 1009 if change_info.issue: |
| 1000 server = change_info.rietveld | 1010 server = change_info.rietveld |
| 1001 if not server.startswith("http://") and not server.startswith("https://"): | 1011 if not server.startswith("http://") and not server.startswith("https://"): |
| 1002 server = "http://" + server | 1012 server = "http://" + server |
| 1003 commit_desc.append_footer('Review URL: %s/%d' % (server, change_info.issue)) | 1013 commit_desc.append_footer('Review URL: %s/%d' % (server, change_info.issue)) |
| 1004 | 1014 |
| 1005 handle, commit_filename = tempfile.mkstemp(text=True) | 1015 handle, commit_filename = tempfile.mkstemp(text=True) |
| 1006 os.write(handle, commit_desc.description) | 1016 os.write(handle, commit_desc.description) |
| 1007 os.close(handle) | 1017 os.close(handle) |
| (...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1457 raise | 1467 raise |
| 1458 print >> sys.stderr, ( | 1468 print >> sys.stderr, ( |
| 1459 'AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' | 1469 'AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' |
| 1460 '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)) |
| 1461 return 1 | 1471 return 1 |
| 1462 | 1472 |
| 1463 | 1473 |
| 1464 if __name__ == "__main__": | 1474 if __name__ == "__main__": |
| 1465 fix_encoding.fix_encoding() | 1475 fix_encoding.fix_encoding() |
| 1466 sys.exit(main(sys.argv[1:])) | 1476 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |