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 import difflib | 10 import difflib |
(...skipping 1777 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1788 parser.print_help() | 1788 parser.print_help() |
1789 return 1 | 1789 return 1 |
1790 issue_arg = args[0] | 1790 issue_arg = args[0] |
1791 | 1791 |
1792 # TODO(maruel): Use apply_issue.py | 1792 # TODO(maruel): Use apply_issue.py |
1793 # TODO(ukai): use gerrit-cherry-pick for gerrit repository? | 1793 # TODO(ukai): use gerrit-cherry-pick for gerrit repository? |
1794 | 1794 |
1795 if issue_arg.isdigit(): | 1795 if issue_arg.isdigit(): |
1796 # Input is an issue id. Figure out the URL. | 1796 # Input is an issue id. Figure out the URL. |
1797 issue = int(issue_arg) | 1797 issue = int(issue_arg) |
1798 cl = Changelist(issue) | 1798 cl = Changelist(issue=issue) |
1799 patchset = cl.GetMostRecentPatchset() | 1799 patchset = cl.GetMostRecentPatchset() |
1800 patch_data = cl.GetPatchSetDiff(issue, patchset) | 1800 patch_data = cl.GetPatchSetDiff(issue, patchset) |
1801 else: | 1801 else: |
1802 # Assume it's a URL to the patch. Default to https. | 1802 # Assume it's a URL to the patch. Default to https. |
1803 issue_url = gclient_utils.UpgradeToHttps(issue_arg) | 1803 issue_url = gclient_utils.UpgradeToHttps(issue_arg) |
1804 match = re.match(r'.*?/issue(\d+)_(\d+).diff', issue_url) | 1804 match = re.match(r'.*?/issue(\d+)_(\d+).diff', issue_url) |
1805 if not match: | 1805 if not match: |
1806 DieWithError('Must pass an issue ID or full URL for ' | 1806 DieWithError('Must pass an issue ID or full URL for ' |
1807 '\'Download raw patch set\'') | 1807 '\'Download raw patch set\'') |
1808 issue = int(match.group(1)) | 1808 issue = int(match.group(1)) |
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2234 GenUsage(parser, 'help') | 2234 GenUsage(parser, 'help') |
2235 return CMDhelp(parser, argv) | 2235 return CMDhelp(parser, argv) |
2236 | 2236 |
2237 | 2237 |
2238 if __name__ == '__main__': | 2238 if __name__ == '__main__': |
2239 # These affect sys.stdout so do it outside of main() to simplify mocks in | 2239 # These affect sys.stdout so do it outside of main() to simplify mocks in |
2240 # unit testing. | 2240 # unit testing. |
2241 fix_encoding.fix_encoding() | 2241 fix_encoding.fix_encoding() |
2242 colorama.init() | 2242 colorama.init() |
2243 sys.exit(main(sys.argv[1:])) | 2243 sys.exit(main(sys.argv[1:])) |
OLD | NEW |