summaryrefslogtreecommitdiffstats
path: root/subcmds/init.py
diff options
context:
space:
mode:
authorShawn O. Pearce <sop@google.com>2010-10-08 10:02:09 +0200
committerShawn O. Pearce <sop@google.com>2010-10-29 12:08:50 -0700
commit88443387b1b0508f43b57e104821c6b375806fea (patch)
treed3d1e5a3e6caecd8eabbdf7a1491ddcc2788aa3d /subcmds/init.py
parent99482ae58a74e236fb40b65c267163a5690f39e1 (diff)
downloadgit-repo-88443387b1b0508f43b57e104821c6b375806fea.tar.gz
sync: Enable use of git clone --reference
Use git clone to initialize a new repository, and when possible allow callers to use --reference to reuse an existing checkout as the initial object storage area for the new checkout. Change-Id: Ie27f760247f311ce484c6d3e85a90d94da2febfc Signed-off-by: Shawn O. Pearce <sop@google.com>
Diffstat (limited to 'subcmds/init.py')
-rw-r--r--subcmds/init.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/subcmds/init.py b/subcmds/init.py
index 4023ab6d..17edfa05 100644
--- a/subcmds/init.py
+++ b/subcmds/init.py
@@ -41,6 +41,13 @@ The optional -m argument can be used to specify an alternate manifest
41to be used. If no manifest is specified, the manifest default.xml 41to be used. If no manifest is specified, the manifest default.xml
42will be used. 42will be used.
43 43
44The --reference option can be used to point to a directory that
45has the content of a --mirror sync. This will make the working
46directory use as much data as possible from the local reference
47directory when fetching from the server. This will make the sync
48go a lot faster by reducing data traffic on the network.
49
50
44Switching Manifest Branches 51Switching Manifest Branches
45--------------------------- 52---------------------------
46 53
@@ -71,7 +78,9 @@ to update the working directory files.
71 g.add_option('--mirror', 78 g.add_option('--mirror',
72 dest='mirror', action='store_true', 79 dest='mirror', action='store_true',
73 help='mirror the forrest') 80 help='mirror the forrest')
74 81 g.add_option('--reference',
82 dest='reference',
83 help='location of mirror directory', metavar='DIR')
75 84
76 # Tool 85 # Tool
77 g = p.add_option_group('repo Version options') 86 g = p.add_option_group('repo Version options')
@@ -115,6 +124,9 @@ to update the working directory files.
115 r.ResetFetch() 124 r.ResetFetch()
116 r.Save() 125 r.Save()
117 126
127 if opt.reference:
128 m.config.SetString('repo.reference', opt.reference)
129
118 if opt.mirror: 130 if opt.mirror:
119 if is_new: 131 if is_new:
120 m.config.SetString('repo.mirror', 'true') 132 m.config.SetString('repo.mirror', 'true')