| 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 and Gerrit.""" | 8 """A git-command for integrating reviews on Rietveld and Gerrit.""" |
| 9 | 9 |
| 10 from __future__ import print_function | 10 from __future__ import print_function |
| (...skipping 2320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2331 if reply.lower().startswith('y'): | 2331 if reply.lower().startswith('y'): |
| 2332 gclient_utils.rm_file_or_tree(hook) | 2332 gclient_utils.rm_file_or_tree(hook) |
| 2333 print('Gerrit commit-msg hook removed.') | 2333 print('Gerrit commit-msg hook removed.') |
| 2334 else: | 2334 else: |
| 2335 print('OK, will keep Gerrit commit-msg hook in place.') | 2335 print('OK, will keep Gerrit commit-msg hook in place.') |
| 2336 | 2336 |
| 2337 def CMDUploadChange(self, options, args, change): | 2337 def CMDUploadChange(self, options, args, change): |
| 2338 """Upload the current branch to Gerrit.""" | 2338 """Upload the current branch to Gerrit.""" |
| 2339 if options.squash and options.no_squash: | 2339 if options.squash and options.no_squash: |
| 2340 DieWithError('Can only use one of --squash or --no-squash') | 2340 DieWithError('Can only use one of --squash or --no-squash') |
| 2341 # TODO(tandrii): remove this by June 20. | |
| 2342 if (RunGit(['config', '--bool', 'gerrit.squash-uploads'], | |
| 2343 error_ok=True).strip() != 'false' and not options.squash and | |
| 2344 not options.no_squash): | |
| 2345 print('\n\nHi! You are using git cl upload in --no-squash mode.\n' | |
| 2346 'Chrome infrastructure wants to make --squash the default.\n' | |
| 2347 'To ensure that --no-squash is still the default for YOU do:\n' | |
| 2348 ' git config --bool gerrit.squash-uploads false\n' | |
| 2349 'See https://goo.gl/dnK2gV (use chromium.org account!) and ' | |
| 2350 'let us know what you think. Thanks!\n' | |
| 2351 'BUG: http://crbug.com/611892\n\n') | |
| 2352 | |
| 2353 options.squash = ((settings.GetSquashGerritUploads() or options.squash) and | 2341 options.squash = ((settings.GetSquashGerritUploads() or options.squash) and |
| 2354 not options.no_squash) | 2342 not options.no_squash) |
| 2355 | 2343 |
| 2356 # We assume the remote called "origin" is the one we want. | 2344 # We assume the remote called "origin" is the one we want. |
| 2357 # It is probably not worthwhile to support different workflows. | 2345 # It is probably not worthwhile to support different workflows. |
| 2358 gerrit_remote = 'origin' | 2346 gerrit_remote = 'origin' |
| 2359 | 2347 |
| 2360 remote, remote_branch = self.GetRemoteBranch() | 2348 remote, remote_branch = self.GetRemoteBranch() |
| 2361 branch = GetTargetRef(remote, remote_branch, options.target_branch, | 2349 branch = GetTargetRef(remote, remote_branch, options.target_branch, |
| 2362 pending_prefix='') | 2350 pending_prefix='') |
| (...skipping 2664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5027 if __name__ == '__main__': | 5015 if __name__ == '__main__': |
| 5028 # These affect sys.stdout so do it outside of main() to simplify mocks in | 5016 # These affect sys.stdout so do it outside of main() to simplify mocks in |
| 5029 # unit testing. | 5017 # unit testing. |
| 5030 fix_encoding.fix_encoding() | 5018 fix_encoding.fix_encoding() |
| 5031 setup_color.init() | 5019 setup_color.init() |
| 5032 try: | 5020 try: |
| 5033 sys.exit(main(sys.argv[1:])) | 5021 sys.exit(main(sys.argv[1:])) |
| 5034 except KeyboardInterrupt: | 5022 except KeyboardInterrupt: |
| 5035 sys.stderr.write('interrupted\n') | 5023 sys.stderr.write('interrupted\n') |
| 5036 sys.exit(1) | 5024 sys.exit(1) |
| OLD | NEW |