| 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 datetime | |
| 11 from distutils.version import LooseVersion | 10 from distutils.version import LooseVersion |
| 12 import glob | 11 import glob |
| 13 import json | 12 import json |
| 14 import logging | 13 import logging |
| 15 import optparse | 14 import optparse |
| 16 import os | 15 import os |
| 17 import Queue | 16 import Queue |
| 18 import re | 17 import re |
| 19 import stat | 18 import stat |
| 20 import sys | 19 import sys |
| 21 import textwrap | 20 import textwrap |
| 22 import time | |
| 23 import threading | 21 import threading |
| 24 import urllib2 | 22 import urllib2 |
| 25 import urlparse | 23 import urlparse |
| 26 import webbrowser | 24 import webbrowser |
| 27 | 25 |
| 28 try: | 26 try: |
| 29 import readline # pylint: disable=F0401,W0611 | 27 import readline # pylint: disable=F0401,W0611 |
| 30 except ImportError: | 28 except ImportError: |
| 31 pass | 29 pass |
| 32 | 30 |
| (...skipping 2031 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2064 @subcommand.usage('[upstream branch to apply against]') | 2062 @subcommand.usage('[upstream branch to apply against]') |
| 2065 def CMDland(parser, args): | 2063 def CMDland(parser, args): |
| 2066 """Commits the current changelist via git.""" | 2064 """Commits the current changelist via git.""" |
| 2067 if settings.GetIsGitSvn(): | 2065 if settings.GetIsGitSvn(): |
| 2068 print('This appears to be an SVN repository.') | 2066 print('This appears to be an SVN repository.') |
| 2069 print('Are you sure you didn\'t mean \'git cl dcommit\'?') | 2067 print('Are you sure you didn\'t mean \'git cl dcommit\'?') |
| 2070 ask_for_data('[Press enter to push or ctrl-C to quit]') | 2068 ask_for_data('[Press enter to push or ctrl-C to quit]') |
| 2071 return SendUpstream(parser, args, 'push') | 2069 return SendUpstream(parser, args, 'push') |
| 2072 | 2070 |
| 2073 | 2071 |
| 2074 @subcommand.usage('[upstream branch to apply against]') | |
| 2075 def CMDpush(parser, args): | |
| 2076 """Temporary alias for 'land'. | |
| 2077 """ | |
| 2078 print( | |
| 2079 "\n=======\n" | |
| 2080 "'git cl push' has been renamed to 'git cl land'.\n" | |
| 2081 "Currently they are treated as synonyms, but 'git cl push' will stop\n" | |
| 2082 "working after 2014/07/01.\n" | |
| 2083 "=======\n") | |
| 2084 now = datetime.datetime.utcfromtimestamp(time.time()) | |
| 2085 if now > datetime.datetime(2014, 7, 1): | |
| 2086 print('******\nReally, you should not use this command anymore... \n' | |
| 2087 'Pausing 10 sec to help you remember :-)') | |
| 2088 for n in xrange(10): | |
| 2089 time.sleep(1) | |
| 2090 print('%s seconds...' % (n+1)) | |
| 2091 print('******') | |
| 2092 return CMDland(parser, args) | |
| 2093 | |
| 2094 | |
| 2095 @subcommand.usage('<patch url or issue id>') | 2072 @subcommand.usage('<patch url or issue id>') |
| 2096 def CMDpatch(parser, args): | 2073 def CMDpatch(parser, args): |
| 2097 """Patches in a code review.""" | 2074 """Patches in a code review.""" |
| 2098 parser.add_option('-b', dest='newbranch', | 2075 parser.add_option('-b', dest='newbranch', |
| 2099 help='create a new branch off trunk for the patch') | 2076 help='create a new branch off trunk for the patch') |
| 2100 parser.add_option('-f', '--force', action='store_true', | 2077 parser.add_option('-f', '--force', action='store_true', |
| 2101 help='with -b, clobber any existing branch') | 2078 help='with -b, clobber any existing branch') |
| 2102 parser.add_option('-d', '--directory', action='store', metavar='DIR', | 2079 parser.add_option('-d', '--directory', action='store', metavar='DIR', |
| 2103 help='Change to the directory DIR immediately, ' | 2080 help='Change to the directory DIR immediately, ' |
| 2104 'before doing anything else.') | 2081 'before doing anything else.') |
| (...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2650 ('AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' | 2627 ('AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' |
| 2651 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e))) | 2628 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e))) |
| 2652 | 2629 |
| 2653 | 2630 |
| 2654 if __name__ == '__main__': | 2631 if __name__ == '__main__': |
| 2655 # These affect sys.stdout so do it outside of main() to simplify mocks in | 2632 # These affect sys.stdout so do it outside of main() to simplify mocks in |
| 2656 # unit testing. | 2633 # unit testing. |
| 2657 fix_encoding.fix_encoding() | 2634 fix_encoding.fix_encoding() |
| 2658 colorama.init() | 2635 colorama.init() |
| 2659 sys.exit(main(sys.argv[1:])) | 2636 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |