Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion git-ftp.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import logging
import textwrap
import fnmatch
import socket

# Note about Tree.path/Blob.path: *real* Git trees and blobs don't
# actually provide path information, but the git-python bindings, as a
Expand Down Expand Up @@ -175,7 +176,9 @@ def main():
if oldtree.hexsha == tree.hexsha:
logging.info('Nothing to do!')
else:
ftp.storbinary('STOR .maintenance', cStringIO.StringIO('<?php $upgrading = time(); ?>'))
upload_diff(repo, oldtree, tree, ftp, [base], patterns)
ftp.delete('.maintenance')

ftp.storbinary('STOR git-rev.txt', cStringIO.StringIO(commit.hexsha))
ftp.quit()
Expand Down Expand Up @@ -457,7 +460,23 @@ def upload_blob(blob, ftp, quiet=False):
ftp.delete(blob.path)
except ftplib.error_perm:
pass
ftp.storbinary('STOR ' + blob.path, blob.data_stream)

attempts = 0

while True:
try:
ftp.storbinary('STOR ' + blob.path, blob.data_stream)
break
except socket.error, e:
attempts += 1
if attempts >= 3:
logging.warning('Failed to upload ' + blob.path)
raise
else:
logging.warning('Retrying ' + blob.path)



try:
ftp.voidcmd('SITE CHMOD ' + format_mode(blob.mode) + ' ' + blob.path)
except ftplib.error_perm:
Expand Down