]> khamidou — GitHub mirrors - cagibi.git/commitdiff
fixed a bug where a file would be uploaded only to be retrieved immediately after
authorkarim hamidou <khamidou@gmail.com>
Mon, 30 Jul 2012 11:47:09 +0000 (13:47 +0200)
committerkarim hamidou <khamidou@gmail.com>
Mon, 30 Jul 2012 11:47:09 +0000 (13:47 +0200)
cagibi/cagibi.py

index 19bbb7e3e9c55d70df601f2c71f7370827968300..b6eaa0785d3fe431e38bbb0d59d00662d455d387 100644 (file)
@@ -106,7 +106,13 @@ def upload_local_changes():
         request = urllib2.Request(url, data=put_string)
         request.add_header('Content-Type', 'application/json')
         request.get_method = lambda: 'PUT'
-        url = opener.open(request)
+        try:
+            url = opener.open(request)
+            local_files = load_config("files.json")
+            local_files[file] = {"rev": 1}
+            save_config(local_files, filename="files.json") 
+        except HTTPError:
+            continue
 
     while not mqueue.removed.empty():
         file = mqueue.removed.get()
@@ -115,7 +121,10 @@ def upload_local_changes():
         url = "%s/files/%s" % (server_url, file)
         request = urllib2.Request(url)
         request.get_method = lambda: 'DELETE'
-        url = opener.open(request)
+        try:
+            url = opener.open(request)
+        except HTTPError:
+            continue
 
 def checkout_upstream_changes():
     """Checkout changes on the server"""