summaryrefslogtreecommitdiff
path: root/lorry
diff options
context:
space:
mode:
authorPedro Alvarez <pedro.alvarez@codethink.co.uk>2019-07-09 12:17:33 +0100
committerPedro Alvarez <pedro.alvarez@codethink.co.uk>2019-07-09 12:17:33 +0100
commita44c6b4a5ddcc769eb7a6b2108b57df682753060 (patch)
tree68bdd7d34ea2f0b7befdc1416fb5afd97c29709c /lorry
parent2b9e5856dbfd7fd6dacbb0c92443d87b502dcc4b (diff)
downloadlorry-a44c6b4a5ddcc769eb7a6b2108b57df682753060.tar.gz
Create bare repo before pushing if local remote
Diffstat (limited to 'lorry')
-rwxr-xr-xlorry7
1 files changed, 7 insertions, 0 deletions
diff --git a/lorry b/lorry
index 3b9f471..b9f72ea 100755
--- a/lorry
+++ b/lorry
@@ -523,6 +523,13 @@ class Lorry(cliapp.Application):
pushrefspecs=['refs/heads/*:refs/heads/*',
'refs/tags/*:refs/tags/*']):
pushurl = "%s/%s.git" % (self.settings['mirror-base-url-push'], name)
+
+ # If pushing to local filesystem, check if repo exists
+ if pushurl.startswith('/'):
+ if not os.path.isdir(pushurl):
+ self.progress('.. creating local repo for %s in %s' % (name, pushurl))
+ 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)