| 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 1743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1754 # * refs/remotes/origin/refs/diff/test -> refs/diff/test | 1754 # * refs/remotes/origin/refs/diff/test -> refs/diff/test |
| 1755 # * refs/remotes/origin/master -> refs/heads/master | 1755 # * refs/remotes/origin/master -> refs/heads/master |
| 1756 # * refs/remotes/branch-heads/test -> refs/branch-heads/test | 1756 # * refs/remotes/branch-heads/test -> refs/branch-heads/test |
| 1757 if remote_branch.startswith('refs/remotes/%s/refs/' % remote): | 1757 if remote_branch.startswith('refs/remotes/%s/refs/' % remote): |
| 1758 remote_branch = remote_branch.replace('refs/remotes/%s/' % remote, '') | 1758 remote_branch = remote_branch.replace('refs/remotes/%s/' % remote, '') |
| 1759 elif remote_branch.startswith('refs/remotes/%s/' % remote): | 1759 elif remote_branch.startswith('refs/remotes/%s/' % remote): |
| 1760 remote_branch = remote_branch.replace('refs/remotes/%s/' % remote, | 1760 remote_branch = remote_branch.replace('refs/remotes/%s/' % remote, |
| 1761 'refs/heads/') | 1761 'refs/heads/') |
| 1762 elif remote_branch.startswith('refs/remotes/branch-heads'): | 1762 elif remote_branch.startswith('refs/remotes/branch-heads'): |
| 1763 remote_branch = remote_branch.replace('refs/remotes/', 'refs/') | 1763 remote_branch = remote_branch.replace('refs/remotes/', 'refs/') |
| 1764 pending_prefix = settings.GetPendingRefPrefix() |
| 1765 # If a pending prefix exists then replace refs/ with it. |
| 1766 if pending_prefix: |
| 1767 remote_branch = remote_branch.replace('refs/', pending_prefix) |
| 1764 upload_args.extend(['--target_ref', remote_branch]) | 1768 upload_args.extend(['--target_ref', remote_branch]) |
| 1765 | 1769 |
| 1766 project = settings.GetProject() | 1770 project = settings.GetProject() |
| 1767 if project: | 1771 if project: |
| 1768 upload_args.extend(['--project', project]) | 1772 upload_args.extend(['--project', project]) |
| 1769 | 1773 |
| 1770 try: | 1774 try: |
| 1771 upload_args = ['upload'] + upload_args + args | 1775 upload_args = ['upload'] + upload_args + args |
| 1772 logging.info('upload.RealMain(%s)', upload_args) | 1776 logging.info('upload.RealMain(%s)', upload_args) |
| 1773 issue, patchset = upload.RealMain(upload_args) | 1777 issue, patchset = upload.RealMain(upload_args) |
| (...skipping 1157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2931 ('AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' | 2935 ('AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' |
| 2932 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e))) | 2936 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e))) |
| 2933 | 2937 |
| 2934 | 2938 |
| 2935 if __name__ == '__main__': | 2939 if __name__ == '__main__': |
| 2936 # These affect sys.stdout so do it outside of main() to simplify mocks in | 2940 # These affect sys.stdout so do it outside of main() to simplify mocks in |
| 2937 # unit testing. | 2941 # unit testing. |
| 2938 fix_encoding.fix_encoding() | 2942 fix_encoding.fix_encoding() |
| 2939 colorama.init() | 2943 colorama.init() |
| 2940 sys.exit(main(sys.argv[1:])) | 2944 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |