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

Unified Diff: git_cl.py

Issue 1091283004: Don't clean up after conflict in "git cl patch" (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: address sbc's comments and fix long lines Created 5 years, 8 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 | tests/git_cl_test.py » ('j') | 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 d4486e5b10abd24e0667f0b6509695950029660d..b94be71c872a5c1db9679662fa49cd01da227c58 100755
--- a/git_cl.py
+++ b/git_cl.py
@@ -2583,8 +2583,9 @@ def CMDpatch(parser, args):
def PatchIssue(issue_arg, reject, nocommit, directory, auth_config):
- # There's a "reset --hard" when failing to apply the patch. In order
- # not to destroy users' data, make sure the tree is not dirty here.
+ # PatchIssue should never be called with a dirty tree. It is up to the
+ # caller to check this, but just in case we assert here since the
+ # consequences of the caller not checking this could be dire.
assert(not git_common.is_dirty_git_tree('apply'))
if type(issue_arg) is int or issue_arg.isdigit():
@@ -2635,8 +2636,8 @@ def PatchIssue(issue_arg, reject, nocommit, directory, auth_config):
subprocess2.check_call(cmd, env=GetNoGitPagerEnv(),
stdin=patch_data, stdout=subprocess2.VOID)
except subprocess2.CalledProcessError:
- RunGit(['reset', '--hard'])
- DieWithError('Failed to apply the patch')
+ print 'Failed to apply the patch'
+ return 1
# If we had an issue, commit the current state and register the issue.
if not nocommit:
@@ -2975,6 +2976,7 @@ def CMDdiff(parser, args):
# Patch in the latest changes from rietveld.
rtn = PatchIssue(issue, False, False, None, auth_config)
if rtn != 0:
+ RunGit(['reset', '--hard'])
return rtn
# Switch back to starting branch and diff against the temporary
« no previous file with comments | « no previous file | tests/git_cl_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698