Add 'repo init --mirror' to download a complete forrest

The mirror option downloads a complete forrest (as described by the
manifest) and creates a replica of the remote repositories rather
than a client working directory.  This permits other clients to
sync off the mirror site.

A mirror can be positioned in a "DMZ", where the mirror executes
"repo sync" to obtain changes from the external upstream and
clients inside the protected zone operate off the mirror only,
and therefore do not require direct git:// access to the external
upstream repositories.

Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
Shawn O. Pearce
2008-11-04 07:37:10 -08:00
parent 3e5481999d
commit e284ad1d1a
6 changed files with 109 additions and 20 deletions

View File

@ -57,6 +57,10 @@ default.xml will be used.
g.add_option('-m', '--manifest-name',
dest='manifest_name', default='default.xml',
help='initial manifest file', metavar='NAME.xml')
g.add_option('--mirror',
dest='mirror', action='store_true',
help='mirror the forrest')
# Tool
g = p.add_option_group('Version options')
@ -112,6 +116,9 @@ default.xml will be used.
r.ResetFetch()
r.Save()
if opt.mirror:
m.config.SetString('repo.mirror', 'true')
m.Sync_NetworkHalf()
m.Sync_LocalHalf()
m.StartBranch('default')
@ -185,9 +192,14 @@ default.xml will be used.
self._SyncManifest(opt)
self._LinkManifest(opt.manifest_name)
if os.isatty(0) and os.isatty(1):
if os.isatty(0) and os.isatty(1) and not opt.mirror:
self._ConfigureUser()
self._ConfigureColor()
if opt.mirror:
type = 'mirror '
else:
type = ''
print ''
print 'repo initialized in %s' % self.manifest.topdir
print 'repo %sinitialized in %s' % (type, self.manifest.topdir)

View File

@ -102,8 +102,9 @@ the manifest.
self._Fetch(*missing)
for project in all:
if not project.Sync_LocalHalf():
sys.exit(1)
if project.worktree:
if not project.Sync_LocalHalf():
sys.exit(1)
def _VerifyTag(project):