| 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 26 matching lines...) Expand all Loading... |
| 37 from third_party import colorama | 37 from third_party import colorama |
| 38 from third_party import httplib2 | 38 from third_party import httplib2 |
| 39 from third_party import upload | 39 from third_party import upload |
| 40 import auth | 40 import auth |
| 41 import breakpad # pylint: disable=W0611 | 41 import breakpad # pylint: disable=W0611 |
| 42 import clang_format | 42 import clang_format |
| 43 import dart_format | 43 import dart_format |
| 44 import fix_encoding | 44 import fix_encoding |
| 45 import gclient_utils | 45 import gclient_utils |
| 46 import git_common | 46 import git_common |
| 47 from git_footers import get_footer_svn_id |
| 47 import owners | 48 import owners |
| 48 import owners_finder | 49 import owners_finder |
| 49 import presubmit_support | 50 import presubmit_support |
| 50 import rietveld | 51 import rietveld |
| 51 import scm | 52 import scm |
| 52 import subcommand | 53 import subcommand |
| 53 import subprocess2 | 54 import subprocess2 |
| 54 import watchlists | 55 import watchlists |
| 55 | 56 |
| 56 __version__ = '1.0' | 57 __version__ = '1.0' |
| (...skipping 2581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2638 | 2639 |
| 2639 def IsFatalPushFailure(push_stdout): | 2640 def IsFatalPushFailure(push_stdout): |
| 2640 """True if retrying push won't help.""" | 2641 """True if retrying push won't help.""" |
| 2641 return '(prohibited by Gerrit)' in push_stdout | 2642 return '(prohibited by Gerrit)' in push_stdout |
| 2642 | 2643 |
| 2643 | 2644 |
| 2644 @subcommand.usage('[upstream branch to apply against]') | 2645 @subcommand.usage('[upstream branch to apply against]') |
| 2645 def CMDdcommit(parser, args): | 2646 def CMDdcommit(parser, args): |
| 2646 """Commits the current changelist via git-svn.""" | 2647 """Commits the current changelist via git-svn.""" |
| 2647 if not settings.GetIsGitSvn(): | 2648 if not settings.GetIsGitSvn(): |
| 2648 message = """This doesn't appear to be an SVN repository. | 2649 if get_footer_svn_id(): |
| 2649 If your project has a git mirror with an upstream SVN master, you probably need | 2650 # If it looks like previous commits were mirrored with git-svn. |
| 2650 to run 'git svn init', see your project's git mirror documentation. | 2651 message = """This repository appears to be a git-svn mirror, but no |
| 2651 If your project has a true writeable upstream repository, you probably want | 2652 upstream SVN master is set. You probably need to run 'git auto-svn' once.""" |
| 2652 to run 'git cl land' instead. | 2653 else: |
| 2653 Choose wisely, if you get this wrong, your commit might appear to succeed but | 2654 message = """This doesn't appear to be an SVN repository. |
| 2654 will instead be silently ignored.""" | 2655 If your project has a true, writeable git repository, you probably want to run |
| 2656 'git cl land' instead. |
| 2657 If your project has a git mirror of an upstream SVN master, you probably need |
| 2658 to run 'git svn init'. |
| 2659 |
| 2660 Using the wrong command might cause your commit to appear to succeed, and the |
| 2661 review to be closed, without actually landing upstream. If you choose to |
| 2662 proceed, please verify that the commit lands upstream as expected.""" |
| 2655 print(message) | 2663 print(message) |
| 2656 ask_for_data('[Press enter to dcommit or ctrl-C to quit]') | 2664 ask_for_data('[Press enter to dcommit or ctrl-C to quit]') |
| 2657 return SendUpstream(parser, args, 'dcommit') | 2665 return SendUpstream(parser, args, 'dcommit') |
| 2658 | 2666 |
| 2659 | 2667 |
| 2660 @subcommand.usage('[upstream branch to apply against]') | 2668 @subcommand.usage('[upstream branch to apply against]') |
| 2661 def CMDland(parser, args): | 2669 def CMDland(parser, args): |
| 2662 """Commits the current changelist via git.""" | 2670 """Commits the current changelist via git.""" |
| 2663 if settings.GetIsGitSvn(): | 2671 if settings.GetIsGitSvn() or get_footer_svn_id(): |
| 2664 print('This appears to be an SVN repository.') | 2672 print('This appears to be an SVN repository.') |
| 2665 print('Are you sure you didn\'t mean \'git cl dcommit\'?') | 2673 print('Are you sure you didn\'t mean \'git cl dcommit\'?') |
| 2674 print('(Ignore if this is the first commit after migrating from svn->git)') |
| 2666 ask_for_data('[Press enter to push or ctrl-C to quit]') | 2675 ask_for_data('[Press enter to push or ctrl-C to quit]') |
| 2667 return SendUpstream(parser, args, 'land') | 2676 return SendUpstream(parser, args, 'land') |
| 2668 | 2677 |
| 2669 | 2678 |
| 2670 @subcommand.usage('<patch url or issue id>') | 2679 @subcommand.usage('<patch url or issue id>') |
| 2671 def CMDpatch(parser, args): | 2680 def CMDpatch(parser, args): |
| 2672 """Patches in a code review.""" | 2681 """Patches in a code review.""" |
| 2673 parser.add_option('-b', dest='newbranch', | 2682 parser.add_option('-b', dest='newbranch', |
| 2674 help='create a new branch off trunk for the patch') | 2683 help='create a new branch off trunk for the patch') |
| 2675 parser.add_option('-f', '--force', action='store_true', | 2684 parser.add_option('-f', '--force', action='store_true', |
| (...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3374 if __name__ == '__main__': | 3383 if __name__ == '__main__': |
| 3375 # These affect sys.stdout so do it outside of main() to simplify mocks in | 3384 # These affect sys.stdout so do it outside of main() to simplify mocks in |
| 3376 # unit testing. | 3385 # unit testing. |
| 3377 fix_encoding.fix_encoding() | 3386 fix_encoding.fix_encoding() |
| 3378 colorama.init() | 3387 colorama.init() |
| 3379 try: | 3388 try: |
| 3380 sys.exit(main(sys.argv[1:])) | 3389 sys.exit(main(sys.argv[1:])) |
| 3381 except KeyboardInterrupt: | 3390 except KeyboardInterrupt: |
| 3382 sys.stderr.write('interrupted\n') | 3391 sys.stderr.write('interrupted\n') |
| 3383 sys.exit(1) | 3392 sys.exit(1) |
| OLD | NEW |