diff options
author | David Pursehouse <david.pursehouse@sonymobile.com> | 2014-09-04 21:28:09 +0900 |
---|---|---|
committer | David Pursehouse <david.pursehouse@sonymobile.com> | 2015-04-30 14:29:02 +0000 |
commit | b155354034a7ac18d83ab28cc3756dc36591435f (patch) | |
tree | f273424f6b01482197113508d11a841f75818f57 /subcmds/sync.py | |
parent | 4ccad7554b958c701653c41a72442cccf301e71a (diff) | |
download | git-repo-b155354034a7ac18d83ab28cc3756dc36591435f.tar.gz |
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
Diffstat (limited to 'subcmds/sync.py')
-rw-r--r-- | subcmds/sync.py | 13 |
1 files changed, 11 insertions, 2 deletions
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. | |||
131 | The -c/--current-branch option can be used to only fetch objects that | 131 | The -c/--current-branch option can be used to only fetch objects that |
132 | are on the branch specified by a project's revision. | 132 | are on the branch specified by a project's revision. |
133 | 133 | ||
134 | The --optimized-fetch option can be used to only fetch projects that | ||
135 | are fixed to a sha1 revision if the sha1 revision does not already | ||
136 | exist locally. | ||
137 | |||
134 | SSH Connections | 138 | SSH Connections |
135 | --------------- | 139 | --------------- |
136 | 140 | ||
@@ -206,6 +210,9 @@ later is required to fix a server side protocol bug. | |||
206 | p.add_option('--no-tags', | 210 | p.add_option('--no-tags', |
207 | dest='no_tags', action='store_true', | 211 | dest='no_tags', action='store_true', |
208 | help="don't fetch tags") | 212 | help="don't fetch tags") |
213 | p.add_option('--optimized-fetch', | ||
214 | dest='optimized_fetch', action='store_true', | ||
215 | help='only fetch projects fixed to sha1 if revision does not exist locally') | ||
209 | if show_smart: | 216 | if show_smart: |
210 | p.add_option('-s', '--smart-sync', | 217 | p.add_option('-s', '--smart-sync', |
211 | dest='smart_sync', action='store_true', | 218 | dest='smart_sync', action='store_true', |
@@ -275,7 +282,8 @@ later is required to fix a server side protocol bug. | |||
275 | quiet=opt.quiet, | 282 | quiet=opt.quiet, |
276 | current_branch_only=opt.current_branch_only, | 283 | current_branch_only=opt.current_branch_only, |
277 | clone_bundle=not opt.no_clone_bundle, | 284 | clone_bundle=not opt.no_clone_bundle, |
278 | no_tags=opt.no_tags, archive=self.manifest.IsArchive) | 285 | no_tags=opt.no_tags, archive=self.manifest.IsArchive, |
286 | optimized_fetch=opt.optimized_fetch) | ||
279 | self._fetch_times.Set(project, time.time() - start) | 287 | self._fetch_times.Set(project, time.time() - start) |
280 | 288 | ||
281 | # Lock around all the rest of the code, since printing, updating a set | 289 | # 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. | |||
615 | if not opt.local_only: | 623 | if not opt.local_only: |
616 | mp.Sync_NetworkHalf(quiet=opt.quiet, | 624 | mp.Sync_NetworkHalf(quiet=opt.quiet, |
617 | current_branch_only=opt.current_branch_only, | 625 | current_branch_only=opt.current_branch_only, |
618 | no_tags=opt.no_tags) | 626 | no_tags=opt.no_tags, |
627 | optimized_fetch=opt.optimized_fetch) | ||
619 | 628 | ||
620 | if mp.HasChanges: | 629 | if mp.HasChanges: |
621 | syncbuf = SyncBuffer(mp.config) | 630 | syncbuf = SyncBuffer(mp.config) |