[Checkins] SVN: z3c.vcsync/trunk/src/z3c/vcsync/svn.py * SVN log datetimes are in UTC. Unfortunately the previous procedure for

Martijn Faassen faassen at infrae.com
Wed Nov 7 10:23:31 EST 2007


Log message for revision 81588:
  * SVN log datetimes are in UTC. Unfortunately the previous procedure for
  conversion to Python datetimes worked during DST in CET, but not 
  afterwards. Hopefully the conversion now does work.
  
  * work around a bug in Py (doesn't support the 'R' status in SVN)
  
  * a better way to maintain the cache of files.
  
  

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

-=-
Modified: z3c.vcsync/trunk/src/z3c/vcsync/svn.py
===================================================================
--- z3c.vcsync/trunk/src/z3c/vcsync/svn.py	2007-11-07 14:44:35 UTC (rev 81587)
+++ z3c.vcsync/trunk/src/z3c/vcsync/svn.py	2007-11-07 15:23:31 UTC (rev 81588)
@@ -14,8 +14,8 @@
         self.path = path
         self._files = set()
         self._removed = set()
-        self._updated = False
-        
+        self._updated_dt = None
+    
     def _repository_url(self):
         prefix = 'Repository Root: '
         lines = self.path._svn('info').splitlines()
@@ -33,7 +33,7 @@
     
     def up(self):        
         self.path.update()
-        self._updated = False
+        self._updated_dt = None
         
     def resolve(self):
         _resolve_helper(self.path)
@@ -46,17 +46,14 @@
         return list(self._files)
     
     def removed(self, dt):
-        # XXX strictly speaking update_files caching only works
-        # if dt arg is always the same as in files..
         self._update_files(dt)
         return list(self._removed)
 
     def _update_files(self, dt):
         """Go through svn log and update self._files and self._removed.
         """
-        if self._updated:
+        if self._updated_dt == dt:
             return
-        
         files = set()
         removed = set()
         checkout_path = self._checkout_path()
@@ -78,7 +75,7 @@
         
         self._files = files
         self._removed = removed
-        self._updated = True
+        self._updated_dt = dt
 
     def _update_from_logs(self, logs, dt, checkout_path, files, removed):
         """Update files and removed from logs.
@@ -88,7 +85,7 @@
         # go from newest to oldest
         logs.reverse()
         for log in logs:
-            log_dt = datetime.fromtimestamp(log.date, dt.tzinfo)
+            log_dt = datetime.fromtimestamp(log.date).replace(tzinfo=dt.tzinfo)
             if log_dt < dt:
                 return True
             for p in log.strpaths:
@@ -106,8 +103,15 @@
     for p in path.listdir():
         if not p.check(dir=True):
             continue
-        for conflict in p.status().conflict:
-            mine = p.join(conflict.basename + '.mine')
-            conflict.write(mine.read())
-            conflict._svn('resolved')
+        try:
+            for conflict in p.status().conflict:
+                mine = p.join(conflict.basename + '.mine')
+                conflict.write(mine.read())
+                conflict._svn('resolved')
+        # XXX This is a horrible hack to skip status of R. This
+        # is not supported by Py 0.9.0, and raises a NotImplementedError.
+        # This has been fixed on the trunk of Py.
+        # When we upgrade to a new release of Py this can go away
+        except NotImplementedError:
+            pass
         _resolve_helper(p)



More information about the Checkins mailing list