changeset 1251:7b128ea29fc4

Further bug fixes in SyncPages and wikisync
author Alexander Schremmer <alex AT alexanderweb DOT de>
date Wed, 09 Aug 2006 17:44:02 +0200
parents 97e9866e82c7
children e92c75fa13a9
files MoinMoin/action/SyncPages.py MoinMoin/wikisync.py docs/CHANGES.aschremmer
diffstat 3 files changed, 10 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/action/SyncPages.py	Wed Aug 09 17:41:59 2006 +0200
+++ b/MoinMoin/action/SyncPages.py	Wed Aug 09 17:44:02 2006 +0200
@@ -220,17 +220,12 @@
         """ Returns the binary diff of the remote page named pagename, given
             from_rev and to_rev. """
         result = self.connection.getDiff(pagename, from_rev, to_rev)
-        if isinstance(result, xmlrpclib.Fault):
-            raise Exception(result)
         result["diff"] = str(result["diff"]) # unmarshal Binary object
         return result
 
     def merge_diff(self, pagename, diff, local_rev, delta_remote_rev, last_remote_rev, interwiki_name):
         """ Merges the diff into the page on the remote side. """
         result = self.connection.mergeDiff(pagename, xmlrpclib.Binary(diff), local_rev, delta_remote_rev, last_remote_rev, interwiki_name)
-        print result
-        if isinstance(result, xmlrpclib.Fault):
-            raise Exception(result)
         return result
 
     # Methods implementing the RemoteWiki interface
@@ -418,14 +413,12 @@
 
             local_pagename = rp.local_name
             current_page = PageEditor(self.request, local_pagename)
-            if wikiutil.containsConflictMarker(current_page.get_raw_body()):
-                self.log_status(ActionClass.WARN, _("Skipped page %(pagename)s because of a local unresolved conflict.") % {"pagename": local_pagename})
-                continue
             current_rev = current_page.get_real_rev()
 
             tags = TagStore(current_page)
             matching_tags = tags.fetch(iwid_full=remote.iwid_full)
             matching_tags.sort()
+            #print "------ TAGS: " + repr(matching_tags) + repr(tags.tags)
 
             if not matching_tags:
                 remote_rev = None
@@ -448,6 +441,13 @@
             diff = diff_result["diff"]
             current_remote_rev = diff_result["current"]
 
+            # do not sync if the conflict is remote and local, or if it is local
+            # and the page has never been syncronised
+            if (wikiutil.containsConflictMarker(current_page.get_raw_body())
+                and (remote_rev is None or is_remote_conflict)):
+                self.log_status(ActionClass.WARN, _("Skipped page %(pagename)s because of a locally or remotely unresolved conflict.") % {"pagename": local_pagename})
+                continue
+
             if remote_rev is None: # set the remote_rev for the case without any tags
                 self.log_status(ActionClass.INFO, _("This is the first synchronisation between this page and the remote wiki."))
                 remote_rev = current_remote_rev
--- a/MoinMoin/wikisync.py	Wed Aug 09 17:41:59 2006 +0200
+++ b/MoinMoin/wikisync.py	Wed Aug 09 17:44:02 2006 +0200
@@ -130,7 +130,7 @@
                 assert False, "This case is not supported yet" # XXX
             iw_name = iwid_full[1]
 
-        return [t for t in self.tags if t.remote_wiki == iw_name]
+        return [t for t in self.tags if unpackLine(t.remote_wiki)[1] == iw_name]
 
 
 # currently we just have one implementation, so we do not need
--- a/docs/CHANGES.aschremmer	Wed Aug 09 17:41:59 2006 +0200
+++ b/docs/CHANGES.aschremmer	Wed Aug 09 17:44:02 2006 +0200
@@ -9,6 +9,7 @@
   ToDo:
     * Implement actual syncronisation.
       * Add correct IWID_full handling.
+    * Reduce round-trip times by caching queries and using MultiCall objects.
     * Implement a cross-site authentication system, i.e. mainly an
       identity storage.
     * Clean up trailing whitespace.