git_cache: remove the mirror_path if it exists in an incomplete state.

Bug: 958286
Change-Id: If8351dfc0790e1db5867c103139a067c651fca3a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1590500
Commit-Queue: John Budorick <jbudorick@chromium.org>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
changes/00/1590500/3
John Budorick 6 years ago committed by Commit Bot
parent b3aca437d0
commit 47ec0697f0

@ -13,11 +13,11 @@ import logging
import optparse
import os
import re
import subprocess
import sys
import tempfile
import threading
import time
import subprocess
import sys
try:
import urlparse
@ -495,6 +495,11 @@ class Mirror(object):
# Re-bootstrapping an existing mirror; preserve existing fetch spec.
self._preserve_fetchspec()
else:
if os.path.exists(self.mirror_path):
# If the mirror path exists but self.exists() returns false, we're
# in an unexpected state. Nuke the previous mirror directory and
# start fresh.
gclient_utils.rmtree(self.mirror_path)
os.mkdir(self.mirror_path)
bootstrapped = (not depth and bootstrap and
@ -864,4 +869,4 @@ if __name__ == '__main__':
sys.exit(main(sys.argv[1:]))
except KeyboardInterrupt:
sys.stderr.write('interrupted\n')
sys.exit(1)
sys.exit(1)

Loading…
Cancel
Save