[Checkins] SVN: z3c.vcsync/trunk/src/z3c/vcsync/ Start refactoring conflict resolution code in preparation of

Martijn Faassen faassen at infrae.com
Wed Apr 23 09:08:08 EDT 2008


Log message for revision 85637:
  Start refactoring conflict resolution code in preparation of 
  "lost and found" support.
  

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

-=-
Modified: z3c.vcsync/trunk/src/z3c/vcsync/README.txt
===================================================================
--- z3c.vcsync/trunk/src/z3c/vcsync/README.txt	2008-04-23 12:33:05 UTC (rev 85636)
+++ z3c.vcsync/trunk/src/z3c/vcsync/README.txt	2008-04-23 13:08:07 UTC (rev 85637)
@@ -415,3 +415,18 @@
   >>> info = s2.sync("synchronize")
   >>> data2['bar'].payload
   200
+
+Conflicts in subdirectories should also be resolved properly::
+
+  >>> data['sub']['qux'].payload = 35 
+  >>> current_synchronizer = s2
+  >>> data2['sub']['qux'].payload = 36
+  >>> info = s2.sync("Synchronize")
+  >>> current_synchronizer = s
+  >>> info = s.sync("Synchronize")
+  >>> data['sub']['qux'].payload
+  35
+  >>> current_synchronizer = s2
+  >>> info = s2.sync("Synchronize")
+  >>> data2['sub']['qux'].payload
+  35

Modified: z3c.vcsync/trunk/src/z3c/vcsync/svn.py
===================================================================
--- z3c.vcsync/trunk/src/z3c/vcsync/svn.py	2008-04-23 12:33:05 UTC (rev 85636)
+++ z3c.vcsync/trunk/src/z3c/vcsync/svn.py	2008-04-23 13:08:07 UTC (rev 85637)
@@ -108,7 +108,7 @@
             continue
         try:
             for conflict in p.status().conflict:
-                mine = p.join(conflict.basename + '.mine')
+                mine, revs = conflict_info(conflict)
                 conflict.write(mine.read())
                 conflict._svn('resolved')
         # XXX This is a horrible hack to skip status of R. This
@@ -118,3 +118,13 @@
         except NotImplementedError:
             pass
         _resolve_helper(p)
+    
+def conflict_info(conflict):
+    path = conflict.dirpath()
+    name = conflict.basename
+    mine = path.join(name + '.mine')
+    name_pattern = name + '.r'
+    revs = {}
+    for rev in path.listdir(name_pattern + '*'):
+        revs[int(rev.basename[len(name_pattern):])] = rev
+    return mine, revs



More information about the Checkins mailing list