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 |
| 11 import base64 |
11 import glob | 12 import glob |
12 import json | 13 import json |
13 import logging | 14 import logging |
14 import optparse | 15 import optparse |
15 import os | 16 import os |
16 import Queue | 17 import Queue |
17 import re | 18 import re |
18 import stat | 19 import stat |
19 import sys | 20 import sys |
20 import textwrap | 21 import textwrap |
21 import threading | 22 import threading |
22 import urllib2 | 23 import urllib2 |
23 import urlparse | 24 import urlparse |
24 import webbrowser | 25 import webbrowser |
| 26 import zlib |
25 | 27 |
26 try: | 28 try: |
27 import readline # pylint: disable=F0401,W0611 | 29 import readline # pylint: disable=F0401,W0611 |
28 except ImportError: | 30 except ImportError: |
29 pass | 31 pass |
30 | 32 |
31 | 33 |
32 from third_party import colorama | 34 from third_party import colorama |
33 from third_party import upload | 35 from third_party import upload |
34 import breakpad # pylint: disable=W0611 | 36 import breakpad # pylint: disable=W0611 |
(...skipping 2781 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2816 if opts.diff: | 2818 if opts.diff: |
2817 sys.stdout.write(stdout) | 2819 sys.stdout.write(stdout) |
2818 if opts.dry_run and len(stdout) > 0: | 2820 if opts.dry_run and len(stdout) > 0: |
2819 return 2 | 2821 return 2 |
2820 | 2822 |
2821 return 0 | 2823 return 0 |
2822 | 2824 |
2823 | 2825 |
2824 def CMDlol(parser, args): | 2826 def CMDlol(parser, args): |
2825 # This command is intentionally undocumented. | 2827 # This command is intentionally undocumented. |
2826 print('\n'.join(( | 2828 print zlib.decompress(base64.b64decode( |
2827 ' / /', | 2829 'eNptkLEOwyAMRHe+wupCIqW57v0Vq84WqWtXyrcXnCBsmgMJ+/SSAxMZgRB6NzE' |
2828 ' (\\/_//`)', | 2830 'E2ObgCKJooYdu4uAQVffUEoE1sRQLxAcqzd7uK2gmStrll1ucV3uZyaY5sXyDd9' |
2829 ' / \'/', | 2831 'JAnN+lAXsOMJ90GANAi43mq5/VeeacylKVgi8o6F1SC63FxnagHfJUTfUYdCR/W' |
2830 ' 0 0 \\', | 2832 'Ofe+0dHL7PicpytKP750Fh1q2qnLVof4w8OZWNY')) |
2831 ' / \\', | |
2832 ' / __/ \\', | |
2833 ' /, _/ \\ \\_', | |
2834 ' `-./ ) | ~^~^~^~^~^~^~^~\\~.', | |
2835 ' ( / \\_}', | |
2836 ' | / |', | |
2837 ' ; | \\ /', | |
2838 ' \\/ ,/ \\ |', | |
2839 ' / /~~|~|~~~~~~|~|\\ |', | |
2840 ' / / | | | | `\\ \\', | |
2841 ' / / | | | | \\ \\', | |
2842 ' / ( | | | | \\ \\', | |
2843 ' jgs /,_) /__) /__) /,_/', | |
2844 ' \'\'\'\'\'"""""\'\'\'""""""\'\'\'""""""\'\'"""""\'\'\'\'\''))) | |
2845 return 0 | 2833 return 0 |
2846 | 2834 |
2847 | 2835 |
2848 class OptionParser(optparse.OptionParser): | 2836 class OptionParser(optparse.OptionParser): |
2849 """Creates the option parse and add --verbose support.""" | 2837 """Creates the option parse and add --verbose support.""" |
2850 def __init__(self, *args, **kwargs): | 2838 def __init__(self, *args, **kwargs): |
2851 optparse.OptionParser.__init__( | 2839 optparse.OptionParser.__init__( |
2852 self, *args, prog='git cl', version=__version__, **kwargs) | 2840 self, *args, prog='git cl', version=__version__, **kwargs) |
2853 self.add_option( | 2841 self.add_option( |
2854 '-v', '--verbose', action='count', default=0, | 2842 '-v', '--verbose', action='count', default=0, |
(...skipping 28 matching lines...) Expand all Loading... |
2883 ('AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' | 2871 ('AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' |
2884 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e))) | 2872 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e))) |
2885 | 2873 |
2886 | 2874 |
2887 if __name__ == '__main__': | 2875 if __name__ == '__main__': |
2888 # These affect sys.stdout so do it outside of main() to simplify mocks in | 2876 # These affect sys.stdout so do it outside of main() to simplify mocks in |
2889 # unit testing. | 2877 # unit testing. |
2890 fix_encoding.fix_encoding() | 2878 fix_encoding.fix_encoding() |
2891 colorama.init() | 2879 colorama.init() |
2892 sys.exit(main(sys.argv[1:])) | 2880 sys.exit(main(sys.argv[1:])) |
OLD | NEW |