vcs-mirror r6 - trunk



Author: johncarr
Date: Wed Jun 25 09:25:52 2008
New Revision: 6
URL: http://svn.gnome.org/viewvc/vcs-mirror?rev=6&view=rev

Log:
If bot falls over mid update, we can now restart without losing any history

Modified:
   trunk/   (props changed)
   trunk/mirror.py

Modified: trunk/mirror.py
==============================================================================
--- trunk/mirror.py	(original)
+++ trunk/mirror.py	Wed Jun 25 09:25:52 2008
@@ -10,6 +10,7 @@
         self.cur_dir = os.path.join(self.maildir, "cur")
 
 	self.queue = []
+        self.handled = []
 
         self.probe()
 
@@ -28,10 +29,7 @@
            new_path = os.path.join(self.cur_dir, f)
            if os.path.isfile(path):
                self.parse(path)
-               try:
-                   os.rename(path, new_path)
-               except:
-                   pass
+               self.handled.append((path, new_path))
         self.empty_queue()
 
     def parse(self, path):
@@ -47,6 +45,12 @@
 	    for vcs in ("svn", "bzr", "git"):
 	        self.update(vcs, module)
 	self.queue = []
+        for path, new_path in self.handled:
+            try:
+                os.rename(path, new_path)
+            except:
+                pass
+        self.handled = []
 
     def update(self, vcs, module):
         moddir = os.path.join("/srv", vcs, module)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]