summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Maw <richard.maw@codethink.co.uk>2016-01-15 14:02:48 +0000
committerRichard Maw <richard.maw@codethink.co.uk>2016-01-15 14:02:48 +0000
commitedf957c5fe043f48219bdbcf6fe4cdec5edff640 (patch)
tree582ac5a64f27c82ac363ea43f9742fbf1d716a87
parent00e8f346c31122fa8086055d39f2ea1ee2c35ab1 (diff)
downloadlorry-edf957c5fe043f48219bdbcf6fe4cdec5edff640.tar.gz
lorry: Mirror without touching config
We can do everything we need to on the command-line, which makes more sense than syncing lorry file config every time, and it makes it easier to add extra options later. Change-Id: Ieaabc9fe7a83b5c29371ddb92b991d128c90e6c6
-rwxr-xr-xlorry23
1 files changed, 3 insertions, 20 deletions
diff --git a/lorry b/lorry
index 78a2ef5..43a58f7 100755
--- a/lorry
+++ b/lorry
@@ -319,26 +319,9 @@ class Lorry(cliapp.Application):
self.progress('.. initialising git dir')
self.run_program(['git', 'init', '--bare', gitdir])
self.progress('.. updating existing clone')
- if 'remote.origin.fetch' in self.run_program(['git', 'config', '-l'],
- cwd=gitdir):
- self.run_program(['git', 'config', '--unset-all',
- 'remote.origin.fetch'], cwd=gitdir)
- self.run_program(['git', 'config', 'remote.origin.url',
- spec['url']], cwd=gitdir)
- self.run_program(['git', 'config', 'remote.origin.mirror', 'true'],
- cwd=gitdir)
- self.run_program(['git', 'config', '--add', 'remote.origin.fetch',
- '+refs/heads/*:refs/heads/*'], cwd=gitdir)
- self.run_program(['git', 'config', '--add', 'remote.origin.fetch',
- '+refs/tags/*:refs/tags/*'], cwd=gitdir)
- try:
- self.run_program(['git', 'remote', 'update', 'origin', '--prune'],
- cwd=gitdir, env=env)
- except:
- self.run_program(['git', 'remote', 'prune', 'origin'],
- cwd=gitdir, env=env)
- self.run_program(['git', 'remote', 'update', 'origin', '--prune'],
- cwd=gitdir, env=env)
+ argv = ['git', 'fetch', '--prune', spec['url'],
+ '+refs/heads/*:refs/heads/*', '+refs/tags/*:refs/tags/*']
+ self.run_program(argv, cwd=gitdir, env=env)
def gitify_bzr(self, project_name, dirname, gitdir, spec):
bzrdir = os.path.join(dirname, 'bzr')