[Checkins] SVN: z3c.vcsync/trunk/src/z3c/vcsync/ Some more fixes. Some of this stuff really needs more test coverage for

Martijn Faassen faassen at infrae.com
Thu Jul 5 18:32:46 EDT 2007


Log message for revision 77488:
  Some more fixes. Some of this stuff really needs more test coverage for
  various edge cases when thrawling SVN history, though.
  

Changed:
  U   z3c.vcsync/trunk/src/z3c/vcsync/interfaces.py
  U   z3c.vcsync/trunk/src/z3c/vcsync/svn.py
  U   z3c.vcsync/trunk/src/z3c/vcsync/vc.py

-=-
Modified: z3c.vcsync/trunk/src/z3c/vcsync/interfaces.py
===================================================================
--- z3c.vcsync/trunk/src/z3c/vcsync/interfaces.py	2007-07-05 22:07:14 UTC (rev 77487)
+++ z3c.vcsync/trunk/src/z3c/vcsync/interfaces.py	2007-07-05 22:32:45 UTC (rev 77488)
@@ -42,7 +42,8 @@
     def sync(dt, message=''):
         """Synchronize persistent Python state with version control system.
 
-        dt - date since when to look for state changes
+        dt - date since when to look for state changes. datestamp should
+             have actual timezone identifier (non-naive).
         message - message to commit any version control changes.
         """
 

Modified: z3c.vcsync/trunk/src/z3c/vcsync/svn.py
===================================================================
--- z3c.vcsync/trunk/src/z3c/vcsync/svn.py	2007-07-05 22:07:14 UTC (rev 77487)
+++ z3c.vcsync/trunk/src/z3c/vcsync/svn.py	2007-07-05 22:32:45 UTC (rev 77488)
@@ -65,7 +65,11 @@
         rev = int(self.path.status().rev)
         while True:
             prev_rev = rev - LOG_STEP
-            logs = self.path.log(prev_rev, rev, verbose=True)
+            try:
+                logs = self.path.log(prev_rev, rev, verbose=True)
+            except ValueError:
+                # no more revisions available, bail out too
+                break
             done = self._update_from_logs(logs, dt, checkout_path,
                                           files, removed)
             if done:
@@ -81,8 +85,10 @@
 
         Return True if we're done.
         """
+        # go from newest to oldest
+        logs.reverse()
         for log in logs:
-            log_dt = datetime.fromtimestamp(log.date)
+            log_dt = datetime.fromtimestamp(log.date, dt.tzinfo)
             if log_dt < dt:
                 return True
             for p in log.strpaths:

Modified: z3c.vcsync/trunk/src/z3c/vcsync/vc.py
===================================================================
--- z3c.vcsync/trunk/src/z3c/vcsync/vc.py	2007-07-05 22:07:14 UTC (rev 77487)
+++ z3c.vcsync/trunk/src/z3c/vcsync/vc.py	2007-07-05 22:32:45 UTC (rev 77488)
@@ -53,6 +53,8 @@
     rel_path = path.relto(root_path)
     steps = rel_path.split('/')
     steps = [step for step in steps if step != '']
+    if not steps:
+        return None
     steps = steps[1:-1]
     obj = root
     for step in steps:
@@ -112,6 +114,8 @@
         removed_paths.sort()
         for removed_path in removed_paths:
             obj = resolve(root, self.checkout.path, removed_path)
+            if obj is root:
+                continue
             if obj is not None:
                 del obj.__parent__[obj.__name__]
         # now modify/add all objects that have been modified/added in the
@@ -125,6 +129,8 @@
             if not file_path.check():
                 continue
             container = resolve_container(root, self.checkout.path, file_path)
+            if container is None:
+                continue
             factory = getUtility(IVcFactory, name=file_path.ext)
             name = file_path.purebasename
             if name in container:



More information about the Checkins mailing list