commit | d1e3758a841c6fd005da698fb295dfc5e7c1e99a | [log] [tgz] |
---|---|---|
author | rmistry@google.com <rmistry@google.com> | Wed Dec 10 20:58:24 2014 +0000 |
committer | rmistry@google.com <rmistry@google.com> | Wed Dec 10 20:58:24 2014 +0000 |
tree | 6ea808d033c4eb495fcdbbe8ed0dc48ba82059fb | |
parent | fcf03763e0dace8fa62288d898f08bbb4783392b [diff] [blame] |
depot_tools: Send the remote tracked ref to Rietveld via upload.py. This change goes hand in hand with the corresponding Rietveld change here: https://codereview.chromium.org/773083004/ The motivation for both CLs came from the discussion in the internal CL: https://chromereviews.googleplex.com/115567013/ AFAIK either change can be submitted first without breaking anything in the other framework. Observe the "Tracked Ref" field in the below CLs- Tracking a remote ref: * https://skia-codereview-staging.appspot.com/8861001 (Tracking skiabot-test's refs/heads/master) * https://skia-codereview-staging.appspot.com/851002 (Tracking skiabot-test's refs/diff/test1) * https://skia-codereview-staging.appspot.com/2891001 (Tracking Chromium's refs/heads/master) * https://skia-codereview-staging.appspot.com/1931003 (Tracking Chromium's refs/branch-heads/1916) Tracking a local branch which in turn tracks a remote ref: * https://skia-codereview-staging.appspot.com/3891002 (Transitively tracking skiabot-test's refs/heads/master) * https://skia-codereview-staging.appspot.com/4921001 (Transitively tracking Chromium's refs/branch-heads/1916) CL when no target_ref is specified in depot_tools/third_party/upload.py: * https://skia-codereview-staging.appspot.com/3871003 (CL with missing target_ref should default to /refs/heads/master) Try the above links with and without the 'Deprecated UI' checked in https://skia-codereview-staging.appspot.com/settings BUG=435702 Review URL: https://codereview.chromium.org/781523002 git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@293334 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/git_cl.py b/git_cl.py index 778c468..de9433f 100755 --- a/git_cl.py +++ b/git_cl.py
@@ -1747,6 +1747,21 @@ + cl.GetUpstreamBranch().split('/')[-1]) if remote_url: upload_args.extend(['--base_url', remote_url]) + remote, remote_branch = cl.GetRemoteBranch() + if remote and remote_branch: + # Create the true path to the remote branch. + # Does the following translation: + # * refs/remotes/origin/refs/diff/test -> refs/diff/test + # * refs/remotes/origin/master -> refs/heads/master + # * refs/remotes/branch-heads/test -> refs/branch-heads/test + if remote_branch.startswith('refs/remotes/%s/refs/' % remote): + remote_branch = remote_branch.replace('refs/remotes/%s/' % remote, '') + elif remote_branch.startswith('refs/remotes/%s/' % remote): + remote_branch = remote_branch.replace('refs/remotes/%s/' % remote, + 'refs/heads/') + elif remote_branch.startswith('refs/remotes/branch-heads'): + remote_branch = remote_branch.replace('refs/remotes/', 'refs/') + upload_args.extend(['--target_ref', remote_branch]) project = settings.GetProject() if project: