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 2167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2178 remote_url = (cl.GetRemoteUrl() + '@' | 2178 remote_url = (cl.GetRemoteUrl() + '@' |
2179 + cl.GetUpstreamBranch().split('/')[-1]) | 2179 + cl.GetUpstreamBranch().split('/')[-1]) |
2180 if remote_url: | 2180 if remote_url: |
2181 upload_args.extend(['--base_url', remote_url]) | 2181 upload_args.extend(['--base_url', remote_url]) |
2182 remote, remote_branch = cl.GetRemoteBranch() | 2182 remote, remote_branch = cl.GetRemoteBranch() |
2183 target_ref = GetTargetRef(remote, remote_branch, options.target_branch, | 2183 target_ref = GetTargetRef(remote, remote_branch, options.target_branch, |
2184 settings.GetPendingRefPrefix()) | 2184 settings.GetPendingRefPrefix()) |
2185 if target_ref: | 2185 if target_ref: |
2186 upload_args.extend(['--target_ref', target_ref]) | 2186 upload_args.extend(['--target_ref', target_ref]) |
2187 | 2187 |
| 2188 # Look for dependent patchsets. See crbug.com/480453 for more details. |
| 2189 remote, upstream_branch = cl.FetchUpstreamTuple(cl.GetBranch()) |
| 2190 upstream_branch = ShortBranchName(upstream_branch) |
| 2191 if remote is '.': |
| 2192 # A local branch is being tracked. |
| 2193 local_branch = ShortBranchName(upstream_branch) |
| 2194 auth_config = auth.extract_auth_config_from_options(options) |
| 2195 branch_cl = Changelist(branchref=local_branch, auth_config=auth_config) |
| 2196 branch_cl_issue_url = branch_cl.GetIssueURL() |
| 2197 branch_cl_issue = branch_cl.GetIssue() |
| 2198 branch_cl_patchset = branch_cl.GetPatchset() |
| 2199 if branch_cl_issue_url and branch_cl_issue and branch_cl_patchset: |
| 2200 upload_args.extend( |
| 2201 ['--depends_on_patchset', '%s:%s' % ( |
| 2202 branch_cl_issue, branch_cl_patchset)]) |
| 2203 print |
| 2204 print ('The current branch (%s) is tracking a local branch (%s) with ' |
| 2205 'an open CL.') % (cl.GetBranch(), local_branch) |
| 2206 print 'Adding %s/#ps%s as a dependency patchset.' % ( |
| 2207 branch_cl_issue_url, branch_cl_patchset) |
| 2208 print |
| 2209 |
2188 project = settings.GetProject() | 2210 project = settings.GetProject() |
2189 if project: | 2211 if project: |
2190 upload_args.extend(['--project', project]) | 2212 upload_args.extend(['--project', project]) |
2191 | 2213 |
2192 if options.cq_dry_run: | 2214 if options.cq_dry_run: |
2193 upload_args.extend(['--cq_dry_run']) | 2215 upload_args.extend(['--cq_dry_run']) |
2194 | 2216 |
2195 try: | 2217 try: |
2196 upload_args = ['upload'] + upload_args + args | 2218 upload_args = ['upload'] + upload_args + args |
2197 logging.info('upload.RealMain(%s)', upload_args) | 2219 logging.info('upload.RealMain(%s)', upload_args) |
(...skipping 1310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3508 if __name__ == '__main__': | 3530 if __name__ == '__main__': |
3509 # These affect sys.stdout so do it outside of main() to simplify mocks in | 3531 # These affect sys.stdout so do it outside of main() to simplify mocks in |
3510 # unit testing. | 3532 # unit testing. |
3511 fix_encoding.fix_encoding() | 3533 fix_encoding.fix_encoding() |
3512 colorama.init() | 3534 colorama.init() |
3513 try: | 3535 try: |
3514 sys.exit(main(sys.argv[1:])) | 3536 sys.exit(main(sys.argv[1:])) |
3515 except KeyboardInterrupt: | 3537 except KeyboardInterrupt: |
3516 sys.stderr.write('interrupted\n') | 3538 sys.stderr.write('interrupted\n') |
3517 sys.exit(1) | 3539 sys.exit(1) |
OLD | NEW |