summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShawn O. Pearce <sop@google.com>2009-03-09 18:51:58 -0700
committerShawn O. Pearce <sop@google.com>2009-03-09 18:51:58 -0700
commit5470df6219fd3be675b8700c326713e700847a10 (patch)
tree3f327a5e7ccf8da49ac54f9b24514b61b37c2b2b
parent0ed2bd1d95fb85dac1721f4c71abc8e07ec30e64 (diff)
downloadgit-repo-5470df6219fd3be675b8700c326713e700847a10.tar.gz
Don't permit "repo init --mirror" in an existing client
Simply setting repo.mirror true doesn't make a client into a mirror. The on-disk layout is completely wrong for a mirror repository, and until we fix our layout for a non-mirror client to more closely resemble the upstream we can't do anything to easily turn on or turn off the mirror status flag. Signed-off-by: Shawn O. Pearce <sop@google.com>
-rw-r--r--subcmds/init.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/subcmds/init.py b/subcmds/init.py
index d1fb4316..4f994300 100644
--- a/subcmds/init.py
+++ b/subcmds/init.py
@@ -89,8 +89,9 @@ default.xml will be used.
89 89
90 def _SyncManifest(self, opt): 90 def _SyncManifest(self, opt):
91 m = self.manifest.manifestProject 91 m = self.manifest.manifestProject
92 is_new = not m.Exists
92 93
93 if not m.Exists: 94 if is_new:
94 if not opt.manifest_url: 95 if not opt.manifest_url:
95 print >>sys.stderr, 'fatal: manifest url (-u) is required.' 96 print >>sys.stderr, 'fatal: manifest url (-u) is required.'
96 sys.exit(1) 97 sys.exit(1)
@@ -117,7 +118,11 @@ default.xml will be used.
117 r.Save() 118 r.Save()
118 119
119 if opt.mirror: 120 if opt.mirror:
120 m.config.SetString('repo.mirror', 'true') 121 if is_new:
122 m.config.SetString('repo.mirror', 'true')
123 else:
124 print >>sys.stderr, 'fatal: --mirror not supported on existing client'
125 sys.exit(1)
121 126
122 m.Sync_NetworkHalf() 127 m.Sync_NetworkHalf()
123 m.Sync_LocalHalf() 128 m.Sync_LocalHalf()