|
@@ -19,6 +19,15 @@ import platform
|
|
|
import re
|
|
import re
|
|
|
import shutil
|
|
import shutil
|
|
|
import sys
|
|
import sys
|
|
|
|
|
+try:
|
|
|
|
|
+ # For python3
|
|
|
|
|
+ import urllib.parse
|
|
|
|
|
+except ImportError:
|
|
|
|
|
+ # For python2
|
|
|
|
|
+ import imp
|
|
|
|
|
+ import urlparse
|
|
|
|
|
+ urllib = imp.new_module('urllib')
|
|
|
|
|
+ urllib.parse = urlparse.urlparse
|
|
|
|
|
|
|
|
from color import Coloring
|
|
from color import Coloring
|
|
|
from command import InteractiveCommand, MirrorSafeCommand
|
|
from command import InteractiveCommand, MirrorSafeCommand
|
|
@@ -135,7 +144,19 @@ to update the working directory files.
|
|
|
if not opt.quiet:
|
|
if not opt.quiet:
|
|
|
print('Get %s' % GitConfig.ForUser().UrlInsteadOf(opt.manifest_url),
|
|
print('Get %s' % GitConfig.ForUser().UrlInsteadOf(opt.manifest_url),
|
|
|
file=sys.stderr)
|
|
file=sys.stderr)
|
|
|
- m._InitGitDir()
|
|
|
|
|
|
|
+
|
|
|
|
|
+ # The manifest project object doesn't keep track of the path on the
|
|
|
|
|
+ # server where this git is located, so let's save that here.
|
|
|
|
|
+ mirrored_manifest_git = None
|
|
|
|
|
+ if opt.reference:
|
|
|
|
|
+ manifest_git_path = urllib.parse(opt.manifest_url).path[1:]
|
|
|
|
|
+ mirrored_manifest_git = os.path.join(opt.reference, manifest_git_path)
|
|
|
|
|
+ if not mirrored_manifest_git.endswith(".git"):
|
|
|
|
|
+ mirrored_manifest_git += ".git"
|
|
|
|
|
+ if not os.path.exists(mirrored_manifest_git):
|
|
|
|
|
+ mirrored_manifest_git = os.path.join(opt.reference + '/.repo/manifests.git')
|
|
|
|
|
+
|
|
|
|
|
+ m._InitGitDir(mirror_git=mirrored_manifest_git)
|
|
|
|
|
|
|
|
if opt.manifest_branch:
|
|
if opt.manifest_branch:
|
|
|
m.revisionExpr = opt.manifest_branch
|
|
m.revisionExpr = opt.manifest_branch
|