From 407db8634e1ca6de44c230c62484903e4ed53858 Mon Sep 17 00:00:00 2001 From: Michal Sojka Date: Tue, 23 Sep 2008 13:56:00 +0000 Subject: [PATCH] All error messages starts with git-ftp-sync darcs-hash:20080923135640-f2ef6-d016c4e818c997e6a7b54a7bec13454efaa21009.gz --- git-ftp-sync | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/git-ftp-sync b/git-ftp-sync index 921c1c7..cd570ff 100755 --- a/git-ftp-sync +++ b/git-ftp-sync @@ -89,7 +89,7 @@ class Syncer: 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): @@ -124,7 +124,7 @@ class FTPSync(Syncer): 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 @@ -135,14 +135,14 @@ class FTPSync(Syncer): # 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): @@ -233,6 +233,10 @@ def selftest(): print print "Selftest succeeded!" +def perror(str): + print >>sys.stderr, "git-ftp-sync: %s"%str + + def update_ref(hash): remote = "ftp" branch = "master" @@ -278,6 +282,7 @@ for line in sys.stdin: build_change_list(changes, oldrev, newrev) if not changes: + perror("No changes to sync") sys.exit(0) # Apply changes @@ -294,8 +299,8 @@ try: 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 -- 2.39.2