summaryrefslogtreecommitdiff
path: root/lorry
diff options
context:
space:
mode:
authorBen Hutchings <ben.hutchings@codethink.co.uk>2020-05-15 17:16:11 +0100
committerBen Hutchings <ben.hutchings@codethink.co.uk>2020-05-29 21:04:38 +0100
commit541ed6ed37d23fa9b1693aca582e1aad25497ce2 (patch)
tree7369045c379f466a17221aaf4bfe755f1c549c79 /lorry
parent6c2ff9ff07c8fa4c4b4ecd0e40dbb9acc1c516c3 (diff)
downloadlorry-541ed6ed37d23fa9b1693aca582e1aad25497ce2.tar.gz
lorry: Add support for git push options
Gerrit requires passing the skip-validation option when pushing a branch with a long history. Add a 'push-option' application setting that allows adding any such option to the git push command. Closes #2.
Diffstat (limited to 'lorry')
-rwxr-xr-xlorry11
1 files changed, 9 insertions, 2 deletions
diff --git a/lorry b/lorry
index 7505633..c33f60d 100755
--- a/lorry
+++ b/lorry
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
-# Copyright (C) 2013-2019 Codethink Limited
+# Copyright (C) 2013-2020 Codethink Limited
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -98,6 +98,9 @@ class Lorry(cliapp.Application):
self.settings.boolean(['keep-multiple-backups'],
'keep multiple (time-stamped) backups (disabled by default)',
default=False)
+ self.settings.string_list(['push-option'],
+ "option for 'git push' to pass to the "
+ 'remote server')
def process_args(self, args):
status = 0
@@ -531,7 +534,11 @@ class Lorry(cliapp.Application):
self.run_program(['git', 'init', '--bare', pushurl], cwd=gitdir)
self.progress('.. pushing %s to mirror server %s' % (name, pushurl))
- self.run_program(['git', 'push', pushurl]+pushrefspecs, cwd=gitdir)
+ self.run_program(['git', 'push']
+ + ['--push-option=%s' % option
+ for option in self.settings['push-option']]
+ + [pushurl] + pushrefspecs,
+ cwd=gitdir)
def run_program(self, argv, **kwargs):
if self.settings['command-stdout']: