]> rtime.felk.cvut.cz Git - git-ftp-sync.git/commitdiff
All error messages starts with git-ftp-sync
authorMichal Sojka <sojkam1@fel.cvut.cz>
Tue, 23 Sep 2008 13:56:00 +0000 (13:56 +0000)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Tue, 23 Sep 2008 14:34:54 +0000 (16:34 +0200)
darcs-hash:20080923135640-f2ef6-d016c4e818c997e6a7b54a7bec13454efaa21009.gz

git-ftp-sync

index 921c1c7e8163d1287580cd667275597119f3dc8b..cd570ff0bf67fa00a7bd367e9854f4439916a3e4 100755 (executable)
@@ -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