print "%s: DEL "%self.__class__.__name__, change.dest_path
self._delete(change.dest_path)
else:
- print >> sys.stderr, "Unknown change:", change.type, change.dest_path
+ perror("Unknown change: %s %s" % (change.type, change.dest_path))
sys.exit(1)
def mkd(self, path):
try:
self.ftp.mkd(path)
except ftplib.error_perm, detail:
- print >> sys.stderr, "FTP warning:", detail, path
+ perror("FTP warning: %s %s" % (detail, path))
def _storbinary(self, string, path):
#print >> sys.stderr, self.dest_path
# FIXME: this should be recursive deletion
self.ftp.rmd(path)
except ftplib.error_perm, detail:
- print >> sys.stderr, "FTP warning:", detail, path
+ perror("FTP warning: %s %s" % (detail, path))
def _delete(self, path):
try:
#print >> sys.stderr, path
self.ftp.delete(path)
except ftplib.error_perm, detail:
- print >> sys.stderr, "FTP warning:", detail, path
+ perror("FTP warning: %s %s" % (detail, path))
class LocalSync(Syncer):
print
print "Selftest succeeded!"
+def perror(str):
+ print >>sys.stderr, "git-ftp-sync: %s"%str
+
+
def update_ref(hash):
remote = "ftp"
branch = "master"
build_change_list(changes, oldrev, newrev)
if not changes:
+ perror("No changes to sync")
sys.exit(0)
# Apply changes
syncer.close()
except ftplib.all_errors, detail:
- print >> sys.stderr, "FTP synchronization error: ", detail
- print >> sys.stderr, "I will try it next time again"
+ perror("FTP synchronization error: %s" % detail);
+ perror("I will try it next time again");
sys.exit(1)
# If succeessfull, update remote ref