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

Unified Diff: git_cl.py

Issue 896453002: Disallow applying patches when git tree is dirty (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Created 5 years, 11 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 4edb6a0af8e1ee834f7f8305e92e435a3c1f9cee..46f1199ce1385c2df58c515d3ecb767a7a0dfdb1 100755
--- a/git_cl.py
+++ b/git_cl.py
@@ -2401,6 +2401,9 @@ def CMDpatch(parser, args):
return 1
issue_arg = args[0]
+ if is_dirty_git_tree('patch'):
+ return 1
+
# TODO(maruel): Use apply_issue.py
# TODO(ukai): use gerrit-cherry-pick for gerrit repository?
@@ -2464,6 +2467,7 @@ def PatchIssue(issue_arg, reject, nocommit, directory):
subprocess2.check_call(cmd, env=GetNoGitPagerEnv(),
stdin=patch_data, stdout=subprocess2.VOID)
except subprocess2.CalledProcessError:
+ RunGit(['reset', '--hard'])
DieWithError('Failed to apply the patch')
# If we had an issue, commit the current state and register the issue.
@@ -2769,6 +2773,9 @@ def CMDset_close(parser, args):
def CMDdiff(parser, args):
"""shows differences between local tree and last upload."""
+ if is_dirty_git_tree('diff'):
+ return 1
iannucci 2015/02/02 15:49:42 Hm... why is this necessary?
wychen 2015/02/02 17:09:25 This is basically a safety measure. If the user ha
+
cl = Changelist()
issue = cl.GetIssue()
branch = cl.GetBranch()
« 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