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

Unified Diff: tools/auto_bisect/bisect_utils.py

Issue 640733004: Delete index.lock files before checking out master branch. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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: tools/auto_bisect/bisect_utils.py
diff --git a/tools/auto_bisect/bisect_utils.py b/tools/auto_bisect/bisect_utils.py
index 9dfc65294fcf50dbfb81d261314e2690e515890c..59bbce941beea14709d8ce966cb5620cc8631189 100644
--- a/tools/auto_bisect/bisect_utils.py
+++ b/tools/auto_bisect/bisect_utils.py
@@ -310,11 +310,11 @@ def OnAccessError(func, path, _):
raise
-def _CleanupPreviousGitRuns():
+def _CleanupPreviousGitRuns(cwd=os.getcwd()):
"""Cleans up any leftover index.lock files after running git."""
# If a previous run of git crashed, or bot was reset, etc., then we might
# end up with leftover index.lock files.
- for path, _, files in os.walk(os.getcwd()):
+ for path, _, files in os.walk(cwd):
for cur_file in files:
if cur_file.endswith('index.lock'):
path_to_file = os.path.join(path, cur_file)
@@ -422,9 +422,10 @@ def CreateBisectDirectoryAndSetupDepot(opts, custom_deps):
(output, _) = RunGit(['rev-parse', '--is-inside-work-tree'],
cwd=path_to_dir)
if output.strip() == 'true':
+ # Before checking out master, cleanup up any leftover index.lock files.
+ _CleanupPreviousGitRuns(path_to_dir)
# Checks out the master branch, throws an exception if git command fails.
CheckRunGit(['checkout', '-f', 'master'], cwd=path_to_dir)
-
if not _CreateAndChangeToSourceDirectory(opts.working_directory):
raise RuntimeError('Could not create bisect directory.')
« 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