Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(986)

Unified Diff: git_cl.py

Issue 1135563005: Improve "dcommit in git repo" error message. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: also improve 'land' warning Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « git_auto_svn.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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')
« no previous file with comments | « git_auto_svn.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698