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 1684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 Loading... |
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) |
OLD | NEW |