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

Unified Diff: git_cl.py

Issue 512493002: Be verbose about what's happening in 'git cl land' when pusing to pending ref. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 6 years, 4 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 | « no previous file | 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 01a12a82c816287504037fcbb19ee55047dfab2b..063e9c5f1ed6c37bb39fb06dac56138246bc6d96 100755
--- a/git_cl.py
+++ b/git_cl.py
@@ -2088,39 +2088,62 @@ def PushToGitPending(remote, pending_ref, upstream_ref):
cherry = RunGit(['rev-parse', 'HEAD']).strip()
code = 0
out = ''
- attempt = 0
- while attempt < 5:
- attempt += 1
+ max_attempts = 3
+ attempts_left = max_attempts
+ while attempts_left:
+ if attempts_left != max_attempts:
+ print 'Retrying, %d attempts left...' % (attempts_left - 1,)
+ attempts_left -= 1
# Fetch. Retry fetch errors.
+ print 'Fetching pending ref %s...' % pending_ref
code, out = RunGitWithCode(
- ['retry', 'fetch', remote, '+%s:%s' % (pending_ref, local_pending_ref)],
- suppress_stderr=True)
+ ['retry', 'fetch', remote, '+%s:%s' % (pending_ref, local_pending_ref)])
if code:
+ print 'Fetch failed with exit code %d.' % code
+ if out.strip():
+ print out.strip()
continue
# Try to cherry pick. Abort on merge conflicts.
+ print 'Cherry-picking commit on top of pending ref...'
RunGitWithCode(['checkout', local_pending_ref], suppress_stderr=True)
- code, out = RunGitWithCode(['cherry-pick', cherry], suppress_stderr=True)
+ code, out = RunGitWithCode(['cherry-pick', cherry])
if code:
print (
- 'Your patch doesn\'t apply cleanly to upstream ref \'%s\', '
- 'the following files have merge conflicts:' % upstream_ref)
+ 'Your patch doesn\'t apply cleanly to ref \'%s\', '
+ 'the following files have merge conflicts:' % pending_ref)
print RunGit(['diff', '--name-status', '--diff-filter=U']).strip()
print 'Please rebase your patch and try again.'
- RunGitWithCode(['cherry-pick', '--abort'], suppress_stderr=True)
+ RunGitWithCode(['cherry-pick', '--abort'])
return code, out
# Applied cleanly, try to push now. Retry on error (flake or non-ff push).
+ print 'Pushing commit to %s... It can take a while.' % pending_ref
code, out = RunGitWithCode(
['retry', 'push', '--porcelain', remote, 'HEAD:%s' % pending_ref])
if code == 0:
# Success.
return code, out
+ print 'Push failed with exit code %d.' % code
+ if out.strip():
+ print out.strip()
Vadim Sh. 2014/08/26 21:12:05 that was the most crucial missing part, for whatev
+ if IsFatalPushFailure(out):
+ print (
+ 'Fatal push error. Make sure your .netrc credentials and git '
+ 'user.email are correct and you have push access to the repo.')
+ return code, out
+
+ print 'All attempts to push to pending ref failed.'
return code, out
+def IsFatalPushFailure(push_stdout):
+ """True if retrying push won't help."""
+ return '(prohibited by Gerrit)' in push_stdout
+
+
@subcommand.usage('[upstream branch to apply against]')
def CMDdcommit(parser, args):
"""Commits the current changelist via git-svn."""
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698