summaryrefslogtreecommitdiffstats
path: root/project.py
diff options
context:
space:
mode:
Diffstat (limited to 'project.py')
-rw-r--r--project.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/project.py b/project.py
index b7ed6f33..faa6b32b 100644
--- a/project.py
+++ b/project.py
@@ -49,6 +49,9 @@ MAXIMUM_RETRY_SLEEP_SEC = 3600.0
49# +-10% random jitter is added to each Fetches retry sleep duration. 49# +-10% random jitter is added to each Fetches retry sleep duration.
50RETRY_JITTER_PERCENT = 0.1 50RETRY_JITTER_PERCENT = 0.1
51 51
52# Whether to use alternates.
53# TODO(vapier): Remove knob once behavior is verified.
54_ALTERNATES = os.environ.get('REPO_USE_ALTERNATES') == '1'
52 55
53def _lwrite(path, content): 56def _lwrite(path, content):
54 lock = '%s.lock' % path 57 lock = '%s.lock' % path
@@ -460,7 +463,7 @@ class RemoteSpec(object):
460 463
461class Project(object): 464class Project(object):
462 # These objects can be shared between several working trees. 465 # These objects can be shared between several working trees.
463 shareable_dirs = ['hooks', 'objects', 'rr-cache'] 466 shareable_dirs = ['hooks', 'rr-cache']
464 467
465 def __init__(self, 468 def __init__(self,
466 manifest, 469 manifest,
@@ -1143,6 +1146,17 @@ class Project(object):
1143 self._UpdateHooks(quiet=quiet) 1146 self._UpdateHooks(quiet=quiet)
1144 self._InitRemote() 1147 self._InitRemote()
1145 1148
1149 if _ALTERNATES or self.manifest.is_multimanifest:
1150 # If gitdir/objects is a symlink, migrate it from the old layout.
1151 gitdir_objects = os.path.join(self.gitdir, 'objects')
1152 if platform_utils.islink(gitdir_objects):
1153 platform_utils.remove(gitdir_objects, missing_ok=True)
1154 gitdir_alt = os.path.join(self.gitdir, 'objects/info/alternates')
1155 if not os.path.exists(gitdir_alt):
1156 os.makedirs(os.path.dirname(gitdir_alt), exist_ok=True)
1157 _lwrite(gitdir_alt, os.path.join(
1158 os.path.relpath(self.objdir, gitdir_objects), 'objects') + '\n')
1159
1146 if is_new: 1160 if is_new:
1147 alt = os.path.join(self.objdir, 'objects/info/alternates') 1161 alt = os.path.join(self.objdir, 'objects/info/alternates')
1148 try: 1162 try: