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

Unified Diff: gclient_scm.py

Issue 1498203002: Add detection for locked git repos. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Created 5 years 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: gclient_scm.py
diff --git a/gclient_scm.py b/gclient_scm.py
index 12ef85401ffef807bc9532064859cee1fce5cc1f..c0fce971c8cd227f342be4b85cdcea6e80a9bf5a 100644
--- a/gclient_scm.py
+++ b/gclient_scm.py
@@ -1076,6 +1076,14 @@ class GitWrapper(SCMWrapper):
os.path.isdir(os.path.join(g, "rebase-apply")))
def _CheckClean(self, rev_str):
+ lockfile = os.path.join(self.checkout_path, ".git", "index.lock")
+ if os.path.exists(lockfile):
+ raise gclient_utils.Error(
+ '\n____ %s%s\n'
+ '\tYour repo is locked, possibly due to a concurrent git process.\n'
+ '\tIf no git executable is running, then clean up %r and try again.\n'
+ % (self.relpath, rev_str, lockfile))
+
# Make sure the tree is clean; see git-rebase.sh for reference
try:
scm.GIT.Capture(['update-index', '--ignore-submodules', '--refresh'],
« 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