Chromium Code Reviews| Index: git_cl.py |
| diff --git a/git_cl.py b/git_cl.py |
| index d4486e5b10abd24e0667f0b6509695950029660d..332347a2e223dafa498de255689402936c3541fb 100755 |
| --- a/git_cl.py |
| +++ b/git_cl.py |
| @@ -2583,7 +2583,7 @@ 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 |
| + # When a patch fails to apply, it mixes with local changes. In order |
| # not to destroy users' data, make sure the tree is not dirty here. |
|
Sam Clegg
2015/04/20 23:32:16
How about:
PatchIssue should never be called with
wychen
2015/04/22 00:23:18
Done.
|
| assert(not git_common.is_dirty_git_tree('apply')) |
| @@ -2635,8 +2635,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 +2975,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 |