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

Unified Diff: git_cache.py

Issue 187283005: Be more aggressive about breaking locks (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Created 6 years, 10 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_cache.py
diff --git a/git_cache.py b/git_cache.py
index 6b430f8769c4c24205a88cb472ce0c110ef07680..f38b4e9d4dc5be2e511eaf2cee6600172a5d9d95 100755
--- a/git_cache.py
+++ b/git_cache.py
@@ -243,6 +243,14 @@ def CMDunlock(parser, args):
repo_dirs = [os.path.join(options.cache_dir, path)
for path in os.listdir(options.cache_dir)
if os.path.isdir(os.path.join(options.cache_dir, path))]
+ repo_dirs.extend([os.path.join(options.cache_dir,
+ lockfile.replace('.lock', ''))
+ for lockfile in os.listdir(options.cache_dir)
+ if os.path.isfile(os.path.join(options.cache_dir,
+ lockfile))
+ and lockfile.endswith('.lock')
+ and os.path.join(options.cache_dir, lockfile)
+ not in repo_dirs])
lockfiles = [repo_dir + '.lock' for repo_dir in repo_dirs
if os.path.exists(repo_dir + '.lock')]
@@ -255,11 +263,16 @@ def CMDunlock(parser, args):
untouched = []
for repo_dir in repo_dirs:
lf = Lockfile(repo_dir)
+ config_lock = os.path.join(repo_dir, 'config.lock')
+ unlocked = False
+ if os.path.exists(config_lock):
+ os.remove(config_lock)
+ unlocked = True
if lf.break_lock():
- config_lock = os.path.join(repo_dir, 'config.lock')
- if os.path.exists(config_lock):
- os.remove(config_lock)
- unlocked.append(repo_dir)
+ unlocked = True
+
+ if unlocked:
+ unlocked.append(repo_dir)
else:
untouched.append(repo_dir)
« 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