|
|
@ -38,7 +38,7 @@ except NameError:
|
|
|
|
class LockError(Exception):
|
|
|
|
class LockError(Exception):
|
|
|
|
pass
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
class RefsHeadsFailedToFetch(Exception):
|
|
|
|
class ClobberNeeded(Exception):
|
|
|
|
pass
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
class Lockfile(object):
|
|
|
|
class Lockfile(object):
|
|
|
@ -246,7 +246,11 @@ class Mirror(object):
|
|
|
|
cwd = self.mirror_path
|
|
|
|
cwd = self.mirror_path
|
|
|
|
|
|
|
|
|
|
|
|
# Don't run git-gc in a daemon. Bad things can happen if it gets killed.
|
|
|
|
# Don't run git-gc in a daemon. Bad things can happen if it gets killed.
|
|
|
|
self.RunGit(['config', 'gc.autodetach', '0'], cwd=cwd)
|
|
|
|
try:
|
|
|
|
|
|
|
|
self.RunGit(['config', 'gc.autodetach', '0'], cwd=cwd)
|
|
|
|
|
|
|
|
except subprocess.CalledProcessError:
|
|
|
|
|
|
|
|
# Hard error, need to clobber.
|
|
|
|
|
|
|
|
raise ClobberNeeded()
|
|
|
|
|
|
|
|
|
|
|
|
# Don't combine pack files into one big pack file. It's really slow for
|
|
|
|
# Don't combine pack files into one big pack file. It's really slow for
|
|
|
|
# repositories, and there's no way to track progress and make sure it's
|
|
|
|
# repositories, and there's no way to track progress and make sure it's
|
|
|
@ -407,7 +411,7 @@ class Mirror(object):
|
|
|
|
self.RunGit(fetch_cmd + [spec], cwd=rundir, retry=True)
|
|
|
|
self.RunGit(fetch_cmd + [spec], cwd=rundir, retry=True)
|
|
|
|
except subprocess.CalledProcessError:
|
|
|
|
except subprocess.CalledProcessError:
|
|
|
|
if spec == '+refs/heads/*:refs/heads/*':
|
|
|
|
if spec == '+refs/heads/*:refs/heads/*':
|
|
|
|
raise RefsHeadsFailedToFetch
|
|
|
|
raise ClobberNeeded() # Corrupted cache.
|
|
|
|
logging.warn('Fetch of %s failed' % spec)
|
|
|
|
logging.warn('Fetch of %s failed' % spec)
|
|
|
|
|
|
|
|
|
|
|
|
def populate(self, depth=None, shallow=False, bootstrap=False,
|
|
|
|
def populate(self, depth=None, shallow=False, bootstrap=False,
|
|
|
@ -426,7 +430,7 @@ class Mirror(object):
|
|
|
|
tempdir = self._ensure_bootstrapped(depth, bootstrap)
|
|
|
|
tempdir = self._ensure_bootstrapped(depth, bootstrap)
|
|
|
|
rundir = tempdir or self.mirror_path
|
|
|
|
rundir = tempdir or self.mirror_path
|
|
|
|
self._fetch(rundir, verbose, depth)
|
|
|
|
self._fetch(rundir, verbose, depth)
|
|
|
|
except RefsHeadsFailedToFetch:
|
|
|
|
except ClobberNeeded:
|
|
|
|
# This is a major failure, we need to clean and force a bootstrap.
|
|
|
|
# This is a major failure, we need to clean and force a bootstrap.
|
|
|
|
gclient_utils.rmtree(rundir)
|
|
|
|
gclient_utils.rmtree(rundir)
|
|
|
|
self.print(GIT_CACHE_CORRUPT_MESSAGE)
|
|
|
|
self.print(GIT_CACHE_CORRUPT_MESSAGE)
|
|
|
|