summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Maw <richard.maw@codethink.co.uk>2012-03-13 10:34:02 +0000
committerRichard Maw <richard.maw@codethink.co.uk>2012-03-13 10:34:02 +0000
commit565d7f739a1e82de22daae57d5a5b3a692abf8c9 (patch)
tree9c182dab8a0b966afc9e8c1881af2c26f263db4f
parentf92acb1aa6489468f0fb005f8c9eda4a9c49cf13 (diff)
downloadlorry-565d7f739a1e82de22daae57d5a5b3a692abf8c9.tar.gz
lorry: move push refspecs logic
Previously it was set in the add_remote stage, this means that the respecs used to push don't appear in the logs and a change in the lorry file would need the config changing This logic should be equivalent for what gets pushed as the push refspecs set in config are only used if refspecs aren't specified in the push command line.
-rwxr-xr-xlorry17
1 files changed, 5 insertions, 12 deletions
diff --git a/lorry b/lorry
index c4f58a8..cf5d9b5 100755
--- a/lorry
+++ b/lorry
@@ -157,9 +157,7 @@ class Lorry(cliapp.Application):
if not self.settings['pull-only']:
self.push_to_mirror_server(gitdir)
- def add_remote(self, name, gitdir,
- pushrefspec=['refs/heads/*:refs/heads/*',
- 'refs/tags/*:refs/tags/*']):
+ def add_remote(self, name, gitdir):
''' Add mirror server as a remote to gitdir.
@@ -178,13 +176,6 @@ class Lorry(cliapp.Application):
cwd=gitdir)
self.run_program(['git', 'remote', 'set-url', '--push', 'gitorious',
push_url], cwd=gitdir)
- if len(pushrefspec) >= 1:
- self.run_program(['git', 'config', 'remote.gitorious.push',
- pushrefspec[0]], cwd=gitdir)
- for refspec in pushrefspec[1:]:
- self.run_program(['git', 'config', '--add',
- 'remote.gitorious.push', refspec],
- cwd=gitdir)
def mirror_git(self, project_name, dirname, gitdir, spec):
if not os.path.exists(gitdir):
@@ -343,9 +334,11 @@ class Lorry(cliapp.Application):
self.add_remote(project_name, gitdir)
- def push_to_mirror_server(self, gitdir):
+ def push_to_mirror_server(self, gitdir, pushrefspecs=[
+ 'refs/heads/*:refs/heads/*',
+ 'refs/tags/*:refs/tags/*']):
self.progress('.. pushing to mirror server')
- self.run_program(['git', 'push', 'gitorious'], cwd=gitdir)
+ self.run_program(['git', 'push', 'gitorious']+pushrefspecs, cwd=gitdir)
def run_program(self, argv, **kwargs):
if self.settings['command-stdout']: