From 335f5ef4ad25a85c69fe6d8c848c5d1d447e22c8 Mon Sep 17 00:00:00 2001 From: Julien Campergue Date: Wed, 16 Oct 2013 11:02:35 +0200 Subject: Add --archive option to init to sync using git archive This significantly reduces sync time and used brandwidth as only a tar of each project's revision is checked out, but git is not accessible from projects anymore. This is relevant when git is not needed in projects but sync speed/brandwidth may be important like on CI servers when building several versions from scratch regularly for example. Archive is not supported over http/https. Change-Id: I48c3c7de2cd5a1faec33e295fcdafbc7807d0e4d Signed-off-by: Julien Campergue --- subcmds/sync.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'subcmds/sync.py') diff --git a/subcmds/sync.py b/subcmds/sync.py index d8aec59b..0279ff60 100644 --- a/subcmds/sync.py +++ b/subcmds/sync.py @@ -253,7 +253,7 @@ 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) + no_tags=opt.no_tags, archive=self.manifest.IsArchive) self._fetch_times.Set(project, time.time() - start) # Lock around all the rest of the code, since printing, updating a set @@ -294,7 +294,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): + no_tags=opt.no_tags, + archive=self.manifest.IsArchive): fetched.add(project.gitdir) else: print('error: Cannot fetch %s' % project.name, file=sys.stderr) @@ -338,7 +339,9 @@ later is required to fix a server side protocol bug. pm.end() self._fetch_times.Save() - self._GCProjects(projects) + if not self.manifest.IsArchive: + self._GCProjects(projects) + return fetched def _GCProjects(self, projects): @@ -641,7 +644,7 @@ later is required to fix a server side protocol bug. previously_missing_set = missing_set fetched.update(self._Fetch(missing, opt)) - if self.manifest.IsMirror: + if self.manifest.IsMirror or self.manifest.IsArchive: # bail out now, we have no working tree return -- cgit v1.2.3-54-g00ecf