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 # Copyright (C) 2008 Evan Martin <martine@danga.com> | 6 # Copyright (C) 2008 Evan Martin <martine@danga.com> |
7 | 7 |
8 """A git-command for integrating reviews on Rietveld.""" | 8 """A git-command for integrating reviews on Rietveld.""" |
9 | 9 |
10 from distutils.version import LooseVersion | 10 from distutils.version import LooseVersion |
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
435 self.watchers = () | 435 self.watchers = () |
436 self._remote = None | 436 self._remote = None |
437 self._props = None | 437 self._props = None |
438 | 438 |
439 def GetCCList(self): | 439 def GetCCList(self): |
440 """Return the users cc'd on this CL. | 440 """Return the users cc'd on this CL. |
441 | 441 |
442 Return is a string suitable for passing to gcl with the --cc flag. | 442 Return is a string suitable for passing to gcl with the --cc flag. |
443 """ | 443 """ |
444 if self.cc is None: | 444 if self.cc is None: |
445 base_cc = settings .GetDefaultCCList() | 445 base_cc = settings.GetDefaultCCList() |
446 more_cc = ','.join(self.watchers) | 446 more_cc = ','.join(self.watchers) |
447 self.cc = ','.join(filter(None, (base_cc, more_cc))) or '' | 447 self.cc = ','.join(filter(None, (base_cc, more_cc))) or '' |
448 return self.cc | 448 return self.cc |
449 | 449 |
| 450 def GetCCListWithoutDefault(self): |
| 451 """Return the users cc'd on this CL excluding default ones.""" |
| 452 if self.cc is None: |
| 453 self.cc = ','.join(self.watchers) |
| 454 return self.cc |
| 455 |
450 def SetWatchers(self, watchers): | 456 def SetWatchers(self, watchers): |
451 """Set the list of email addresses that should be cc'd based on the changed | 457 """Set the list of email addresses that should be cc'd based on the changed |
452 files in this CL. | 458 files in this CL. |
453 """ | 459 """ |
454 self.watchers = watchers | 460 self.watchers = watchers |
455 | 461 |
456 def GetBranch(self): | 462 def GetBranch(self): |
457 """Returns the short branch name, e.g. 'master'.""" | 463 """Returns the short branch name, e.g. 'master'.""" |
458 if not self.branch: | 464 if not self.branch: |
459 self.branchref = RunGit(['symbolic-ref', 'HEAD']).strip() | 465 self.branchref = RunGit(['symbolic-ref', 'HEAD']).strip() |
(...skipping 954 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1414 print "Description is empty; aborting." | 1420 print "Description is empty; aborting." |
1415 return 1 | 1421 return 1 |
1416 | 1422 |
1417 upload_args.extend(['--message', change_desc.description]) | 1423 upload_args.extend(['--message', change_desc.description]) |
1418 if change_desc.get_reviewers(): | 1424 if change_desc.get_reviewers(): |
1419 upload_args.append('--reviewers=' + ','.join(change_desc.get_reviewers())) | 1425 upload_args.append('--reviewers=' + ','.join(change_desc.get_reviewers())) |
1420 if options.send_mail: | 1426 if options.send_mail: |
1421 if not change_desc.get_reviewers(): | 1427 if not change_desc.get_reviewers(): |
1422 DieWithError("Must specify reviewers to send email.") | 1428 DieWithError("Must specify reviewers to send email.") |
1423 upload_args.append('--send_mail') | 1429 upload_args.append('--send_mail') |
1424 cc = ','.join(filter(None, (cl.GetCCList(), ','.join(options.cc)))) | 1430 |
| 1431 # We check this before applying rietveld.private assuming that in |
| 1432 # rietveld.cc only addresses which we can send private CLs to are listed |
| 1433 # if rietveld.private is set, and so we should ignore rietveld.cc only when |
| 1434 # --private is specified explicitly on the command line. |
| 1435 if options.private: |
| 1436 logging.warn('rietveld.cc is ignored since private flag is specified. ' |
| 1437 'You need to review and add them manually if necessary.') |
| 1438 cc = cl.GetCCListWithoutDefault() |
| 1439 else: |
| 1440 cc = cl.GetCCList() |
| 1441 cc = ','.join(filter(None, (cc, ','.join(options.cc)))) |
1425 if cc: | 1442 if cc: |
1426 upload_args.extend(['--cc', cc]) | 1443 upload_args.extend(['--cc', cc]) |
1427 | 1444 |
1428 if options.private or settings.GetDefaultPrivateFlag() == "True": | 1445 if options.private or settings.GetDefaultPrivateFlag() == "True": |
1429 upload_args.append('--private') | 1446 upload_args.append('--private') |
1430 | 1447 |
1431 upload_args.extend(['--git_similarity', str(options.similarity)]) | 1448 upload_args.extend(['--git_similarity', str(options.similarity)]) |
1432 if not options.find_copies: | 1449 if not options.find_copies: |
1433 upload_args.extend(['--git_no_find_copies']) | 1450 upload_args.extend(['--git_no_find_copies']) |
1434 | 1451 |
(...skipping 821 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2256 ('AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' | 2273 ('AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' |
2257 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e))) | 2274 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e))) |
2258 | 2275 |
2259 | 2276 |
2260 if __name__ == '__main__': | 2277 if __name__ == '__main__': |
2261 # These affect sys.stdout so do it outside of main() to simplify mocks in | 2278 # These affect sys.stdout so do it outside of main() to simplify mocks in |
2262 # unit testing. | 2279 # unit testing. |
2263 fix_encoding.fix_encoding() | 2280 fix_encoding.fix_encoding() |
2264 colorama.init() | 2281 colorama.init() |
2265 sys.exit(main(sys.argv[1:])) | 2282 sys.exit(main(sys.argv[1:])) |
OLD | NEW |