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 2465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2476 # squashed version. | 2476 # squashed version. |
2477 upstream_branch_name = scm.GIT.ShortBranchName(upstream_branch) | 2477 upstream_branch_name = scm.GIT.ShortBranchName(upstream_branch) |
2478 # Check the squashed hash of the parent. | 2478 # Check the squashed hash of the parent. |
2479 parent = RunGit(['config', | 2479 parent = RunGit(['config', |
2480 'branch.%s.gerritsquashhash' % upstream_branch_name], | 2480 'branch.%s.gerritsquashhash' % upstream_branch_name], |
2481 error_ok=True).strip() | 2481 error_ok=True).strip() |
2482 # Verify that the upstream branch has been uploaded too, otherwise | 2482 # Verify that the upstream branch has been uploaded too, otherwise |
2483 # Gerrit will create additional CLs when uploading. | 2483 # Gerrit will create additional CLs when uploading. |
2484 if not parent or (RunGitSilent(['rev-parse', upstream_branch + ':']) != | 2484 if not parent or (RunGitSilent(['rev-parse', upstream_branch + ':']) != |
2485 RunGitSilent(['rev-parse', parent + ':'])): | 2485 RunGitSilent(['rev-parse', parent + ':'])): |
2486 # TODO(tandrii): remove "old depot_tools" part on April 12, 2016. | |
2487 DieWithError( | 2486 DieWithError( |
2488 'Upload upstream branch %s first.\n' | 2487 'Upload upstream branch %s first.\n' |
2489 'Note: maybe you\'ve uploaded it with --no-squash or with an old ' | 2488 'Note: maybe you\'ve uploaded it with --no-squash. ' |
2490 'version of depot_tools. If so, then re-upload it with:\n' | 2489 'If so, then re-upload it with:\n' |
2491 ' git cl upload --squash\n' % upstream_branch_name) | 2490 ' git cl upload --squash\n' % upstream_branch_name) |
2492 else: | 2491 else: |
2493 parent = self.GetCommonAncestorWithUpstream() | 2492 parent = self.GetCommonAncestorWithUpstream() |
2494 | 2493 |
2495 tree = RunGit(['rev-parse', 'HEAD:']).strip() | 2494 tree = RunGit(['rev-parse', 'HEAD:']).strip() |
2496 ref_to_push = RunGit(['commit-tree', tree, '-p', parent, | 2495 ref_to_push = RunGit(['commit-tree', tree, '-p', parent, |
2497 '-m', message]).strip() | 2496 '-m', message]).strip() |
2498 else: | 2497 else: |
2499 change_desc = ChangeDescription( | 2498 change_desc = ChangeDescription( |
2500 options.message or CreateDescriptionFromLog(args)) | 2499 options.message or CreateDescriptionFromLog(args)) |
(...skipping 2605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5106 if __name__ == '__main__': | 5105 if __name__ == '__main__': |
5107 # These affect sys.stdout so do it outside of main() to simplify mocks in | 5106 # These affect sys.stdout so do it outside of main() to simplify mocks in |
5108 # unit testing. | 5107 # unit testing. |
5109 fix_encoding.fix_encoding() | 5108 fix_encoding.fix_encoding() |
5110 setup_color.init() | 5109 setup_color.init() |
5111 try: | 5110 try: |
5112 sys.exit(main(sys.argv[1:])) | 5111 sys.exit(main(sys.argv[1:])) |
5113 except KeyboardInterrupt: | 5112 except KeyboardInterrupt: |
5114 sys.stderr.write('interrupted\n') | 5113 sys.stderr.write('interrupted\n') |
5115 sys.exit(1) | 5114 sys.exit(1) |
OLD | NEW |