[Checkins] SVN: z3c.vcsync/trunk/ Fix a bug that breaks this on Windows.

Martijn Faassen faassen at infrae.com
Thu Nov 29 15:04:50 EST 2007


Log message for revision 82032:
  Fix a bug that breaks this on Windows.
  

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

-=-
Modified: z3c.vcsync/trunk/CHANGES.txt
===================================================================
--- z3c.vcsync/trunk/CHANGES.txt	2007-11-29 19:17:10 UTC (rev 82031)
+++ z3c.vcsync/trunk/CHANGES.txt	2007-11-29 20:04:50 UTC (rev 82032)
@@ -1,6 +1,18 @@
 z3c.vcsync changes
 ==================
 
+0.9.1 (unreleased)
+------------------
+
+Bugs fixed
+~~~~~~~~~~
+
+* When resolving objects in the ZODB, a path was generated that has
+  separators that are actually dependent on the operating system in
+  use (``/`` for *nix, but ``\`` for windows). This caused
+  synchronization to fail on Windows, completely flattening
+  hierarchies. Now use os.path.sep to be platform-independent.
+
 0.9 (2007-11-25)
 ----------------
 

Modified: z3c.vcsync/trunk/src/z3c/vcsync/interfaces.py
===================================================================
--- z3c.vcsync/trunk/src/z3c/vcsync/interfaces.py	2007-11-29 19:17:10 UTC (rev 82031)
+++ z3c.vcsync/trunk/src/z3c/vcsync/interfaces.py	2007-11-29 20:04:50 UTC (rev 82032)
@@ -118,7 +118,9 @@
 
         The path is a path from the state root object to the actual
         object that was removed. It is therefore not the same as the
-        physically locatable path.
+        physically locatable path. These paths always use the forward
+        slash as the seperator, and thus are not subject to os.path.sep
+        like filesystem paths are.
 
         Ideally, only those paths that have been removed since the
         synchronisation marked by revision_nr should be returned. It

Modified: z3c.vcsync/trunk/src/z3c/vcsync/vc.py
===================================================================
--- z3c.vcsync/trunk/src/z3c/vcsync/vc.py	2007-11-29 19:17:10 UTC (rev 82031)
+++ z3c.vcsync/trunk/src/z3c/vcsync/vc.py	2007-11-29 20:04:50 UTC (rev 82032)
@@ -39,7 +39,7 @@
 
 def resolve(root, root_path, path):
     rel_path = path.relto(root_path)
-    steps = rel_path.split('/')
+    steps = rel_path.split(os.path.sep)
     steps = [step for step in steps if step != '']
     steps = steps[1:]
     obj = root
@@ -53,7 +53,7 @@
 
 def resolve_container(root, root_path, path):
     rel_path = path.relto(root_path)
-    steps = rel_path.split('/')
+    steps = rel_path.split(os.path.sep)
     steps = [step for step in steps if step != '']
     if not steps:
         return None
@@ -94,6 +94,8 @@
         path = self.checkout.path
         for removed_path in self.state.removed(revision_nr):
             # construct path to directory containing file/dir to remove
+            # note: this is a state-specific path which always uses /, so we
+            # shouldn't use os.path.sep here
             steps = removed_path.split('/')
             container_dir_path = path.join(*steps[:-1])
             # construct path to potential directory to remove



More information about the Checkins mailing list