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

Side by Side Diff: git_cl.py

Issue 1110293002: Make git cl upload correctly track upstream refs when uploading to Gerrit (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Long line fix & rebase Created 5 years, 7 months 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 | tests/git_cl_test.py » ('j') | no next file with comments »
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 1684 matching lines...) Expand 10 before | Expand all | Expand 10 after
1695 print 'git-cl: Added Change-Id to commit message.' 1695 print 'git-cl: Added Change-Id to commit message.'
1696 else: 1696 else:
1697 print >> sys.stderr, 'ERROR: Gerrit commit-msg hook not available.' 1697 print >> sys.stderr, 'ERROR: Gerrit commit-msg hook not available.'
1698 1698
1699 1699
1700 def GerritUpload(options, args, cl, change): 1700 def GerritUpload(options, args, cl, change):
1701 """upload the current branch to gerrit.""" 1701 """upload the current branch to gerrit."""
1702 # We assume the remote called "origin" is the one we want. 1702 # We assume the remote called "origin" is the one we want.
1703 # It is probably not worthwhile to support different workflows. 1703 # It is probably not worthwhile to support different workflows.
1704 gerrit_remote = 'origin' 1704 gerrit_remote = 'origin'
1705 branch = 'master' 1705
1706 if options.target_branch: 1706 remote, remote_branch = cl.GetRemoteBranch()
1707 branch = options.target_branch 1707 branch = GetTargetRef(remote, remote_branch, options.target_branch,
1708 pending_prefix='')
1708 1709
1709 change_desc = ChangeDescription( 1710 change_desc = ChangeDescription(
1710 options.message or CreateDescriptionFromLog(args)) 1711 options.message or CreateDescriptionFromLog(args))
1711 if not change_desc.description: 1712 if not change_desc.description:
1712 print "Description is empty; aborting." 1713 print "Description is empty; aborting."
1713 return 1 1714 return 1
1714 1715
1715 if options.squash: 1716 if options.squash:
1716 # Try to get the message from a previous upload. 1717 # Try to get the message from a previous upload.
1717 shadow_branch = 'refs/heads/git_cl_uploads/' + cl.GetBranch() 1718 shadow_branch = 'refs/heads/git_cl_uploads/' + cl.GetBranch()
(...skipping 1486 matching lines...) Expand 10 before | Expand all | Expand 10 after
3204 if __name__ == '__main__': 3205 if __name__ == '__main__':
3205 # These affect sys.stdout so do it outside of main() to simplify mocks in 3206 # These affect sys.stdout so do it outside of main() to simplify mocks in
3206 # unit testing. 3207 # unit testing.
3207 fix_encoding.fix_encoding() 3208 fix_encoding.fix_encoding()
3208 colorama.init() 3209 colorama.init()
3209 try: 3210 try:
3210 sys.exit(main(sys.argv[1:])) 3211 sys.exit(main(sys.argv[1:]))
3211 except KeyboardInterrupt: 3212 except KeyboardInterrupt:
3212 sys.stderr.write('interrupted\n') 3213 sys.stderr.write('interrupted\n')
3213 sys.exit(1) 3214 sys.exit(1)
OLDNEW
« no previous file with comments | « no previous file | tests/git_cl_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698