| 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 2067 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2078 remote_url = (cl.GetRemoteUrl() + '@' | 2078 remote_url = (cl.GetRemoteUrl() + '@' |
| 2079 + cl.GetUpstreamBranch().split('/')[-1]) | 2079 + cl.GetUpstreamBranch().split('/')[-1]) |
| 2080 if remote_url: | 2080 if remote_url: |
| 2081 upload_args.extend(['--base_url', remote_url]) | 2081 upload_args.extend(['--base_url', remote_url]) |
| 2082 remote, remote_branch = cl.GetRemoteBranch() | 2082 remote, remote_branch = cl.GetRemoteBranch() |
| 2083 target_ref = GetTargetRef(remote, remote_branch, options.target_branch, | 2083 target_ref = GetTargetRef(remote, remote_branch, options.target_branch, |
| 2084 settings.GetPendingRefPrefix()) | 2084 settings.GetPendingRefPrefix()) |
| 2085 if target_ref: | 2085 if target_ref: |
| 2086 upload_args.extend(['--target_ref', target_ref]) | 2086 upload_args.extend(['--target_ref', target_ref]) |
| 2087 | 2087 |
| 2088 # Look for dependent patchsets. See crbug.com/480453 for more details. | |
| 2089 remote, upstream_branch = cl.FetchUpstreamTuple(cl.GetBranch()) | |
| 2090 upstream_branch = ShortBranchName(upstream_branch) | |
| 2091 if remote is '.': | |
| 2092 # A local branch is being tracked. | |
| 2093 local_branch = ShortBranchName(upstream_branch) | |
| 2094 auth_config = auth.extract_auth_config_from_options(options) | |
| 2095 branch_cl = Changelist(branchref=local_branch, auth_config=auth_config) | |
| 2096 branch_cl_issue_url = branch_cl.GetIssueURL() | |
| 2097 branch_cl_issue = branch_cl.GetIssue() | |
| 2098 branch_cl_patchset = branch_cl.GetPatchset() | |
| 2099 if branch_cl_issue_url and branch_cl_issue and branch_cl_patchset: | |
| 2100 upload_args.extend( | |
| 2101 ['--depends_on_patchset', '%s:%s' % ( | |
| 2102 branch_cl_issue, branch_cl_patchset)]) | |
| 2103 print | |
| 2104 print ('The current branch (%s) is tracking a local branch (%s) with ' | |
| 2105 'an open CL.') % (cl.GetBranch(), local_branch) | |
| 2106 print 'Adding %s/#ps%s as a dependency patchset.' % ( | |
| 2107 branch_cl_issue_url, branch_cl_patchset) | |
| 2108 print | |
| 2109 | |
| 2110 project = settings.GetProject() | 2088 project = settings.GetProject() |
| 2111 if project: | 2089 if project: |
| 2112 upload_args.extend(['--project', project]) | 2090 upload_args.extend(['--project', project]) |
| 2113 | 2091 |
| 2114 if options.cq_dry_run: | 2092 if options.cq_dry_run: |
| 2115 upload_args.extend(['--cq_dry_run']) | 2093 upload_args.extend(['--cq_dry_run']) |
| 2116 | 2094 |
| 2117 try: | 2095 try: |
| 2118 upload_args = ['upload'] + upload_args + args | 2096 upload_args = ['upload'] + upload_args + args |
| 2119 logging.info('upload.RealMain(%s)', upload_args) | 2097 logging.info('upload.RealMain(%s)', upload_args) |
| (...skipping 1296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3416 if __name__ == '__main__': | 3394 if __name__ == '__main__': |
| 3417 # These affect sys.stdout so do it outside of main() to simplify mocks in | 3395 # These affect sys.stdout so do it outside of main() to simplify mocks in |
| 3418 # unit testing. | 3396 # unit testing. |
| 3419 fix_encoding.fix_encoding() | 3397 fix_encoding.fix_encoding() |
| 3420 colorama.init() | 3398 colorama.init() |
| 3421 try: | 3399 try: |
| 3422 sys.exit(main(sys.argv[1:])) | 3400 sys.exit(main(sys.argv[1:])) |
| 3423 except KeyboardInterrupt: | 3401 except KeyboardInterrupt: |
| 3424 sys.stderr.write('interrupted\n') | 3402 sys.stderr.write('interrupted\n') |
| 3425 sys.exit(1) | 3403 sys.exit(1) |
| OLD | NEW |