summaryrefslogtreecommitdiffstats
path: root/subcmds
diff options
context:
space:
mode:
authorVictor Boivie <victor.boivie@sonymobile.com>2012-10-05 12:37:58 +0200
committerChirayu Desai <cdesai@cyanogenmod.org>2013-05-12 17:49:28 +0530
commit2b30e3aabafa43c224cb6d57dc232d78b28a4901 (patch)
treeba6fe5ee439091371977cd3db36b32b41c6b4e9d /subcmds
parent793f90cdc0cffc3ade6acdc544e315fbd54cbb0b (diff)
downloadgit-repo-2b30e3aabafa43c224cb6d57dc232d78b28a4901.tar.gz
Use reference also for manifest git
When running 'repo init --reference=<mirror>', the mirror will be used for all projects except the manifest project. This is because the _InitGitDir function uses the 'repo.reference' git config value specified in the manifest git, which has no effect when creating the manifest git as that value will be set after the git has been successfully cloned. Information about where the manifest git is located on the server is only known when performing the 'repo init', so that information has to be provided when cloning the git in order for it to set up a proper mapping. Change-Id: I47a2c8b3267a4065965058718ce1def4ecb34d5a Signed-off-by: Chirayu Desai <cdesai@cyanogenmod.org>
Diffstat (limited to 'subcmds')
-rw-r--r--subcmds/init.py23
1 files changed, 22 insertions, 1 deletions
diff --git a/subcmds/init.py b/subcmds/init.py
index 29730cc4..1f915268 100644
--- a/subcmds/init.py
+++ b/subcmds/init.py
@@ -19,6 +19,15 @@ import platform
19import re 19import re
20import shutil 20import shutil
21import sys 21import sys
22try:
23 # For python3
24 import urllib.parse
25except ImportError:
26 # For python2
27 import imp
28 import urlparse
29 urllib = imp.new_module('urllib')
30 urllib.parse = urlparse.urlparse
22 31
23from color import Coloring 32from color import Coloring
24from command import InteractiveCommand, MirrorSafeCommand 33from command import InteractiveCommand, MirrorSafeCommand
@@ -135,7 +144,19 @@ to update the working directory files.
135 if not opt.quiet: 144 if not opt.quiet:
136 print('Get %s' % GitConfig.ForUser().UrlInsteadOf(opt.manifest_url), 145 print('Get %s' % GitConfig.ForUser().UrlInsteadOf(opt.manifest_url),
137 file=sys.stderr) 146 file=sys.stderr)
138 m._InitGitDir() 147
148 # The manifest project object doesn't keep track of the path on the
149 # server where this git is located, so let's save that here.
150 mirrored_manifest_git = None
151 if opt.reference:
152 manifest_git_path = urllib.parse(opt.manifest_url).path[1:]
153 mirrored_manifest_git = os.path.join(opt.reference, manifest_git_path)
154 if not mirrored_manifest_git.endswith(".git"):
155 mirrored_manifest_git += ".git"
156 if not os.path.exists(mirrored_manifest_git):
157 mirrored_manifest_git = os.path.join(opt.reference + '/.repo/manifests.git')
158
159 m._InitGitDir(mirror_git=mirrored_manifest_git)
139 160
140 if opt.manifest_branch: 161 if opt.manifest_branch:
141 m.revisionExpr = opt.manifest_branch 162 m.revisionExpr = opt.manifest_branch