diff options
author | Shawn O. Pearce <sop@google.com> | 2008-11-04 07:37:10 -0800 |
---|---|---|
committer | Shawn O. Pearce <sop@google.com> | 2008-11-05 18:08:32 -0800 |
commit | e284ad1d1a2c6fa0e0ac800e87b2607f9bda339e (patch) | |
tree | fcf35ac784ec2e13c78ee3882ccb1fec0ad3d049 /subcmds/init.py | |
parent | 3e5481999d5f853e19ee5caaaaa968fc4b5176ab (diff) | |
download | git-repo-e284ad1d1a2c6fa0e0ac800e87b2607f9bda339e.tar.gz |
Add 'repo init --mirror' to download a complete forrestv1.1
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>
Diffstat (limited to 'subcmds/init.py')
-rw-r--r-- | subcmds/init.py | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/subcmds/init.py b/subcmds/init.py index 03f358d1..ad28a611 100644 --- a/subcmds/init.py +++ b/subcmds/init.py | |||
@@ -57,6 +57,10 @@ default.xml will be used. | |||
57 | g.add_option('-m', '--manifest-name', | 57 | g.add_option('-m', '--manifest-name', |
58 | dest='manifest_name', default='default.xml', | 58 | dest='manifest_name', default='default.xml', |
59 | help='initial manifest file', metavar='NAME.xml') | 59 | help='initial manifest file', metavar='NAME.xml') |
60 | g.add_option('--mirror', | ||
61 | dest='mirror', action='store_true', | ||
62 | help='mirror the forrest') | ||
63 | |||
60 | 64 | ||
61 | # Tool | 65 | # Tool |
62 | g = p.add_option_group('Version options') | 66 | g = p.add_option_group('Version options') |
@@ -112,6 +116,9 @@ default.xml will be used. | |||
112 | r.ResetFetch() | 116 | r.ResetFetch() |
113 | r.Save() | 117 | r.Save() |
114 | 118 | ||
119 | if opt.mirror: | ||
120 | m.config.SetString('repo.mirror', 'true') | ||
121 | |||
115 | m.Sync_NetworkHalf() | 122 | m.Sync_NetworkHalf() |
116 | m.Sync_LocalHalf() | 123 | m.Sync_LocalHalf() |
117 | m.StartBranch('default') | 124 | m.StartBranch('default') |
@@ -185,9 +192,14 @@ default.xml will be used. | |||
185 | self._SyncManifest(opt) | 192 | self._SyncManifest(opt) |
186 | self._LinkManifest(opt.manifest_name) | 193 | self._LinkManifest(opt.manifest_name) |
187 | 194 | ||
188 | if os.isatty(0) and os.isatty(1): | 195 | if os.isatty(0) and os.isatty(1) and not opt.mirror: |
189 | self._ConfigureUser() | 196 | self._ConfigureUser() |
190 | self._ConfigureColor() | 197 | self._ConfigureColor() |
191 | 198 | ||
199 | if opt.mirror: | ||
200 | type = 'mirror ' | ||
201 | else: | ||
202 | type = '' | ||
203 | |||
192 | print '' | 204 | print '' |
193 | print 'repo initialized in %s' % self.manifest.topdir | 205 | print 'repo %sinitialized in %s' % (type, self.manifest.topdir) |