diff MoinMoin/action/SyncPages.py @ 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 32c936ab469e
children 9721b9e2a074
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