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 2757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2768 | 2768 |
2769 stdout = RunCommand(cmd, stdin=diff_output, cwd=top_dir, env=env) | 2769 stdout = RunCommand(cmd, stdin=diff_output, cwd=top_dir, env=env) |
2770 if opts.diff: | 2770 if opts.diff: |
2771 sys.stdout.write(stdout) | 2771 sys.stdout.write(stdout) |
2772 if opts.dry_run and len(stdout) > 0: | 2772 if opts.dry_run and len(stdout) > 0: |
2773 return 2 | 2773 return 2 |
2774 | 2774 |
2775 return 0 | 2775 return 0 |
2776 | 2776 |
2777 | 2777 |
| 2778 def CMDlol(parser, args): |
| 2779 # This command is intentionally undocumented. |
| 2780 print(""" / / |
| 2781 (\/_//`) |
| 2782 / '/ |
| 2783 0 0 \ |
| 2784 / \ |
| 2785 / __/ \ |
| 2786 /, _/ \ \_ |
| 2787 `-./ ) | ~^~^~^~^~^~^~^~\~. |
| 2788 ( / \_} |
| 2789 | / | |
| 2790 ; | \ / |
| 2791 \/ ,/ \ | |
| 2792 / /~~|~|~~~~~~|~|\ | |
| 2793 / / | | | | `\ \ |
| 2794 / / | | | | \ \ |
| 2795 / ( | | | | \ \ |
| 2796 jgs /,_) /__) /__) /,_/ |
| 2797 '''''"""""'''""""""'''""""""''"""""''''' """) |
| 2798 return 0 |
| 2799 |
| 2800 |
2778 class OptionParser(optparse.OptionParser): | 2801 class OptionParser(optparse.OptionParser): |
2779 """Creates the option parse and add --verbose support.""" | 2802 """Creates the option parse and add --verbose support.""" |
2780 def __init__(self, *args, **kwargs): | 2803 def __init__(self, *args, **kwargs): |
2781 optparse.OptionParser.__init__( | 2804 optparse.OptionParser.__init__( |
2782 self, *args, prog='git cl', version=__version__, **kwargs) | 2805 self, *args, prog='git cl', version=__version__, **kwargs) |
2783 self.add_option( | 2806 self.add_option( |
2784 '-v', '--verbose', action='count', default=0, | 2807 '-v', '--verbose', action='count', default=0, |
2785 help='Use 2 times for more debugging info') | 2808 help='Use 2 times for more debugging info') |
2786 | 2809 |
2787 def parse_args(self, args=None, values=None): | 2810 def parse_args(self, args=None, values=None): |
(...skipping 25 matching lines...) Expand all Loading... |
2813 ('AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' | 2836 ('AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' |
2814 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e))) | 2837 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e))) |
2815 | 2838 |
2816 | 2839 |
2817 if __name__ == '__main__': | 2840 if __name__ == '__main__': |
2818 # These affect sys.stdout so do it outside of main() to simplify mocks in | 2841 # These affect sys.stdout so do it outside of main() to simplify mocks in |
2819 # unit testing. | 2842 # unit testing. |
2820 fix_encoding.fix_encoding() | 2843 fix_encoding.fix_encoding() |
2821 colorama.init() | 2844 colorama.init() |
2822 sys.exit(main(sys.argv[1:])) | 2845 sys.exit(main(sys.argv[1:])) |
OLD | NEW |