Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(441)

Side by Side Diff: git_cl.py

Issue 781523002: depot_tools: Send the remote tracked ref to Rietveld via upload.py (Closed) Base URL: http://src.chromium.org/svn/trunk/tools/depot_tools/
Patch Set: remote_ref -> target_ref Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | third_party/upload.py » ('j') | third_party/upload.py » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1729 matching lines...) Expand 10 before | Expand all | Expand 10 after
1740 remote_url = cl.GetGitBaseUrlFromConfig() 1740 remote_url = cl.GetGitBaseUrlFromConfig()
1741 if not remote_url: 1741 if not remote_url:
1742 if settings.GetIsGitSvn(): 1742 if settings.GetIsGitSvn():
1743 remote_url = cl.GetGitSvnRemoteUrl() 1743 remote_url = cl.GetGitSvnRemoteUrl()
1744 else: 1744 else:
1745 if cl.GetRemoteUrl() and '/' in cl.GetUpstreamBranch(): 1745 if cl.GetRemoteUrl() and '/' in cl.GetUpstreamBranch():
1746 remote_url = (cl.GetRemoteUrl() + '@' 1746 remote_url = (cl.GetRemoteUrl() + '@'
1747 + cl.GetUpstreamBranch().split('/')[-1]) 1747 + cl.GetUpstreamBranch().split('/')[-1])
1748 if remote_url: 1748 if remote_url:
1749 upload_args.extend(['--base_url', remote_url]) 1749 upload_args.extend(['--base_url', remote_url])
1750 remote, remote_branch = cl.GetRemoteBranch()
1751 if remote and remote_branch:
1752 # Create the true path to the remote branch.
1753 # Does the following translation:
1754 # * refs/remotes/origin/refs/diff/test -> refs/diff/test
1755 # * refs/remotes/origin/master -> refs/heads/master
1756 # * refs/remotes/branch-heads/test -> refs/branch-heads/test
1757 if remote_branch.startswith('refs/remotes/%s/refs/' % remote):
1758 remote_branch = remote_branch.replace('refs/remotes/%s/' % remote, '')
1759 elif remote_branch.startswith('refs/remotes/%s/' % remote):
1760 remote_branch = remote_branch.replace('refs/remotes/%s/' % remote,
1761 'refs/heads/')
1762 elif remote_branch.startswith('refs/remotes/branch-heads'):
1763 remote_branch = remote_branch.replace('refs/remotes/', 'refs/')
1764 upload_args.extend(['--target_ref', remote_branch])
agable 2014/12/09 20:42:56 So what happens if either remote or remote_branch
rmistry 2014/12/09 20:54:43 Those are good questions and I am not sure. Lookin
1750 1765
1751 project = settings.GetProject() 1766 project = settings.GetProject()
1752 if project: 1767 if project:
1753 upload_args.extend(['--project', project]) 1768 upload_args.extend(['--project', project])
1754 1769
1755 try: 1770 try:
1756 upload_args = ['upload'] + upload_args + args 1771 upload_args = ['upload'] + upload_args + args
1757 logging.info('upload.RealMain(%s)', upload_args) 1772 logging.info('upload.RealMain(%s)', upload_args)
1758 issue, patchset = upload.RealMain(upload_args) 1773 issue, patchset = upload.RealMain(upload_args)
1759 issue = int(issue) 1774 issue = int(issue)
(...skipping 1156 matching lines...) Expand 10 before | Expand all | Expand 10 after
2916 ('AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' 2931 ('AppEngine is misbehaving and returned HTTP %d, again. Keep faith '
2917 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e))) 2932 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e)))
2918 2933
2919 2934
2920 if __name__ == '__main__': 2935 if __name__ == '__main__':
2921 # These affect sys.stdout so do it outside of main() to simplify mocks in 2936 # These affect sys.stdout so do it outside of main() to simplify mocks in
2922 # unit testing. 2937 # unit testing.
2923 fix_encoding.fix_encoding() 2938 fix_encoding.fix_encoding()
2924 colorama.init() 2939 colorama.init()
2925 sys.exit(main(sys.argv[1:])) 2940 sys.exit(main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « no previous file | third_party/upload.py » ('j') | third_party/upload.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698