diff options
author | Daniel Silverstone <daniel.silverstone@codethink.co.uk> | 2012-09-24 10:03:13 +0100 |
---|---|---|
committer | Daniel Silverstone <daniel.silverstone@codethink.co.uk> | 2012-09-24 15:03:55 +0100 |
commit | 291120ecd777de4439b10a07c6f355c7c9af32ed (patch) | |
tree | bd5fac75f2f60abc2777fb4f04aa37969773bd43 /lorry | |
parent | a7f8b1b63a97c66aea6f39342313d7a5b919cfa7 (diff) | |
download | lorry-291120ecd777de4439b10a07c6f355c7c9af32ed.tar.gz |
Alter repack so that we do a 'git gc' instead.danielsilverstone/all-repos-bare
Git has a garbage collection 'porcelain' command called 'gc' which does more
than just repack the repository. Use that in preference to 'git repack' and
also configure the repositories so that they don't use too much RAM whilst
repacking.
Also, we allow gitify_* routines to set self.needs_aggressive on their initial
imports so that we aggressively repack the first clone.
Diffstat (limited to 'lorry')
-rwxr-xr-x | lorry | 16 |
1 files changed, 13 insertions, 3 deletions
@@ -189,11 +189,17 @@ class Lorry(cliapp.Application): gitdir = os.path.join(dirname, 'git') backupdir = self.backup_gitdir(name, dirname, gitdir) try: + self.needs_aggressive = False table[vcstype](name, dirname, gitdir, spec) if self.settings['repack']: self.progress('.. repacking %s git repository' % name) - self.run_program(['git', 'repack', '-a', '-d', '--depth=250', - '--window=250'], cwd=gitdir) + self.run_program(['git', 'config', + 'pack.windowMemory', '128M'], cwd=gitdir) + args = ['git', 'gc'] + if self.needs_aggressive: + args += ['--aggressive'] + self.run_program(args, cwd=gitdir) + self.bundle(name, gitdir) self.make_tarball(name, gitdir) except: @@ -294,6 +300,7 @@ class Lorry(cliapp.Application): self.progress('.. creating git repo') os.mkdir(gitdir) self.run_program(['git', 'init', '--bare', gitdir]) + self.needs_aggressive = True # branches are the listed branches, plus the branch specified in url if 'branches' in spec: @@ -348,7 +355,7 @@ class Lorry(cliapp.Application): def gitify_svn(self, project_name, dirname, gitdir, spec): if not os.path.exists(gitdir): self.progress('.. doing initial clone') - os.mkdir(gitdir) + self.needs_aggressive = True layout = spec["layout"] # if standard layour specified, fill in the defaults if layout == "standard": @@ -381,6 +388,7 @@ class Lorry(cliapp.Application): self.run_program(['git', 'svn', 'fetch'], cwd=gitdir) def gitify_cvs(self, project_name, dirname, gitdir, spec): + self.needs_aggressive = True self.run_program(['git', 'cvsimport', '-a', '-d', spec['url'], '-C', gitdir, spec['module']]) @@ -394,6 +402,7 @@ class Lorry(cliapp.Application): self.run_program(['hg', 'clone', '--quiet', spec['url'], hgdir]) if not os.path.exists(gitdir): + self.needs_aggressive = True self.run_program(['git', 'init', '--bare', gitdir]) self.progress('.. fast-exporting into git') @@ -418,6 +427,7 @@ class Lorry(cliapp.Application): self.run_program(['git', 'init', '--bare', gitdir]) cmdline = ["%s.tar-importer" % __file__, tardest] self.run_program(cmdline, cwd=gitdir) + self.needs_aggressive = True def push_to_mirror_server(self, name, gitdir, |