changeset 1391:bcabe48fc2f6

Fixed bug in diff3.py that silently truncated pages if there was content added on one side at the end.
author Alexander Schremmer <alex AT alexanderweb DOT de>
date Mon, 21 Aug 2006 14:23:33 +0200
parents 7a37f25b5399
children 6b83abc85e83
files MoinMoin/action/SyncPages.py MoinMoin/util/diff3.py docs/CHANGES.aschremmer
diffstat 3 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/action/SyncPages.py	Mon Aug 21 14:22:07 2006 +0200
+++ b/MoinMoin/action/SyncPages.py	Mon Aug 21 14:23:33 2006 +0200
@@ -326,9 +326,9 @@
             if sp.local_mime_type == MIMETYPE_MOIN:
                 remote_contents_unicode = remote_contents.decode("utf-8")
                 # here, the actual 3-way merge happens
+                merged_text = diff3.text_merge(old_contents.decode("utf-8"), remote_contents_unicode, current_page.get_raw_body(), 1, *conflict_markers) # YYY direct access
                 if debug:
-                    self.log_status(ActionClass.INFO, raw_suffix="Merging %r, %r and %r" % (old_contents.decode("utf-8"), remote_contents_unicode, current_page.get_raw_body()))
-                merged_text = diff3.text_merge(old_contents.decode("utf-8"), remote_contents_unicode, current_page.get_raw_body(), 2, *conflict_markers) # YYY direct access
+                    self.log_status(ActionClass.INFO, raw_suffix="Merging %r, %r and %r into %r" % (old_contents.decode("utf-8"), remote_contents_unicode, current_page.get_raw_body(), merged_text))
                 merged_text_raw = merged_text.encode("utf-8")
             else:
                 if diff is None:
--- a/MoinMoin/util/diff3.py	Mon Aug 21 14:22:07 2006 +0200
+++ b/MoinMoin/util/diff3.py	Mon Aug 21 14:23:33 2006 +0200
@@ -98,7 +98,7 @@
         result.extend(new[new_nr:])
     # other added lines
     elif old_nr == old_len and new_nr == new_len:
-        result.extend(other[other_nr])
+        result.extend(other[other_nr:])
     # new deleted lines
     elif (new_nr == new_len and (old_len - old_nr == other_len - other_nr) and
           match(old, other, old_nr, other_nr, old_len-old_nr) == old_len - old_nr):
--- a/docs/CHANGES.aschremmer	Mon Aug 21 14:22:07 2006 +0200
+++ b/docs/CHANGES.aschremmer	Mon Aug 21 14:23:33 2006 +0200
@@ -55,7 +55,9 @@
       after the first headers were sent.
     * Fixed severe race conditions in the meta dict and the sync tags code.
     * Mute the tempnam warning in the caching module.
-    * diff3 algorithm extended, a new mode should reduce the conflicts
+    * diff3 algorithm extended, a new mode should reduce the conflicts,
+      fixed a bug that silently truncated pages if there was content added
+      on one side at the end
     * Standalone opens it logfile unbuffered from now on, thanks to
       Carsten Grohmann