Add 'repo sync -n' to only do the network transfer

This makes it easier to update all repositories, without actually
impacting the working directory, or learning about how to use
`repo forall -c 'git fetch $REPO_REMOTE' `.

Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
Shawn O. Pearce 2009-04-10 16:29:20 -07:00
parent 2a1ccb2b0c
commit 96fdcef9e3

View File

@ -47,6 +47,9 @@ the manifest.
""" """
def _Options(self, p): def _Options(self, p):
p.add_option('-n','--network-only',
dest='network_only', action='store_true',
help="fetch only, don't update working tree")
p.add_option('--no-repo-verify', p.add_option('--no-repo-verify',
dest='no_repo_verify', action='store_true', dest='no_repo_verify', action='store_true',
help='do not verify repo source code') help='do not verify repo source code')
@ -90,6 +93,10 @@ the manifest.
else: else:
print >>sys.stderr, 'warning: Skipped upgrade to unverified version' print >>sys.stderr, 'warning: Skipped upgrade to unverified version'
if opt.network_only:
# bail out now; the rest touches the working tree
return
if mp.HasChanges: if mp.HasChanges:
if not mp.Sync_LocalHalf(): if not mp.Sync_LocalHalf():
sys.exit(1) sys.exit(1)