Chromium Code Reviews| Index: git_cl.py |
| diff --git a/git_cl.py b/git_cl.py |
| index b6810e8b6b50f44e4c00594c46152fb9df379bd8..1a0c85fee9e6588adf0db1d14eb39ab87b95058f 100755 |
| --- a/git_cl.py |
| +++ b/git_cl.py |
| @@ -43,6 +43,7 @@ import clang_format |
| import dart_format |
| import fix_encoding |
| import gclient_utils |
| +import git_auto_svn |
|
agable
2015/06/10 18:06:05
Any way get_footer_svn_id can be put into a separa
|
| import git_common |
| import owners |
| import owners_finder |
| @@ -2645,13 +2646,20 @@ def IsFatalPushFailure(push_stdout): |
| def CMDdcommit(parser, args): |
| """Commits the current changelist via git-svn.""" |
| if not settings.GetIsGitSvn(): |
| - message = """This doesn't appear to be an SVN repository. |
| -If your project has a git mirror with an upstream SVN master, you probably need |
| -to run 'git svn init', see your project's git mirror documentation. |
| -If your project has a true writeable upstream repository, you probably want |
| -to run 'git cl land' instead. |
| -Choose wisely, if you get this wrong, your commit might appear to succeed but |
| -will instead be silently ignored.""" |
| + if git_auto_svn.get_footer_svn_id(): |
| + # If it looks like previous commits were mirrored with git-svn. |
| + message = """This repository appears to be a git-svn mirror, but no |
| +upstream SVN master is set. You probably need to run 'git auto-svn' once.""" |
| + else: |
| + message = """This doesn't appear to be an SVN repository. |
| +If your project has a true, writeable git repository, you probably want to run |
| +'git cl land' instead. |
| +If your project has a git mirror of an upstream SVN master, you probably need |
| +to run 'git svn init'. |
| + |
| +Using the wrong command might cause your commit to appear to succeed, and the |
| +review to be closed, without actually landing upstream. If you choose to |
| +proceed, please verify that the commit lands upstream as expected.""" |
| print(message) |
| ask_for_data('[Press enter to dcommit or ctrl-C to quit]') |
| return SendUpstream(parser, args, 'dcommit') |
| @@ -2660,9 +2668,10 @@ will instead be silently ignored.""" |
| @subcommand.usage('[upstream branch to apply against]') |
| def CMDland(parser, args): |
| """Commits the current changelist via git.""" |
| - if settings.GetIsGitSvn(): |
| + if settings.GetIsGitSvn() or git_auto_svn.get_footer_svn_id(): |
| print('This appears to be an SVN repository.') |
| print('Are you sure you didn\'t mean \'git cl dcommit\'?') |
| + print('(Ignore if this is the first commit after migrating from svn->git)') |
| ask_for_data('[Press enter to push or ctrl-C to quit]') |
| return SendUpstream(parser, args, 'land') |