From b155354034a7ac18d83ab28cc3756dc36591435f Mon Sep 17 00:00:00 2001 From: David Pursehouse Date: Thu, 4 Sep 2014 21:28:09 +0900 Subject: Add option on sync to avoid fetching from remotes for existing sha1 In 2fb6466f795eb30c1dfa598501f5b5d2981e6a5f an optimisation was added to avoid fetching from remotes if the project is fixed to a revision and the revision is already available locally. This causes problems for users who expect all objects to be fetched by default. Change the logic so that the optimized behaviour is only enabled if an option is explicitly given to repo sync. Change-Id: I3b2794ddd8e0071b1787e166463cd8347ca9e24f --- subcmds/sync.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'subcmds/sync.py') diff --git a/subcmds/sync.py b/subcmds/sync.py index 2bdab3a6..b4546c15 100644 --- a/subcmds/sync.py +++ b/subcmds/sync.py @@ -131,6 +131,10 @@ of a project from server. The -c/--current-branch option can be used to only fetch objects that are on the branch specified by a project's revision. +The --optimized-fetch option can be used to only fetch projects that +are fixed to a sha1 revision if the sha1 revision does not already +exist locally. + SSH Connections --------------- @@ -206,6 +210,9 @@ later is required to fix a server side protocol bug. p.add_option('--no-tags', dest='no_tags', action='store_true', help="don't fetch tags") + p.add_option('--optimized-fetch', + dest='optimized_fetch', action='store_true', + help='only fetch projects fixed to sha1 if revision does not exist locally') if show_smart: p.add_option('-s', '--smart-sync', dest='smart_sync', action='store_true', @@ -275,7 +282,8 @@ later is required to fix a server side protocol bug. quiet=opt.quiet, current_branch_only=opt.current_branch_only, clone_bundle=not opt.no_clone_bundle, - no_tags=opt.no_tags, archive=self.manifest.IsArchive) + no_tags=opt.no_tags, archive=self.manifest.IsArchive, + optimized_fetch=opt.optimized_fetch) self._fetch_times.Set(project, time.time() - start) # Lock around all the rest of the code, since printing, updating a set @@ -615,7 +623,8 @@ later is required to fix a server side protocol bug. if not opt.local_only: mp.Sync_NetworkHalf(quiet=opt.quiet, current_branch_only=opt.current_branch_only, - no_tags=opt.no_tags) + no_tags=opt.no_tags, + optimized_fetch=opt.optimized_fetch) if mp.HasChanges: syncbuf = SyncBuffer(mp.config) -- cgit v1.2.3-54-g00ecf