changeset 1277:ed68b5d6f47e

merged main
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Tue, 15 Aug 2006 11:21:11 +0200
parents 7c29a18a7e26 (current diff) e083ea8c934e (diff)
children 82d1f983bcfb
files MoinMoin/Page.py
diffstat 8 files changed, 513 insertions(+), 345 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/Page.py	Tue Aug 15 11:20:21 2006 +0200
+++ b/MoinMoin/Page.py	Tue Aug 15 11:21:11 2006 +0200
@@ -636,7 +636,7 @@
 
         return count
 
-    def getPageList(self, user=None, exists=1, filter=None):
+    def getPageList(self, user=None, exists=1, filter=None, include_underlay=True):
         """ List user readable pages under current page
 
         Currently only request.rootpage is used to list pages, but if we
@@ -693,8 +693,14 @@
                 if filter and not filter(name):
                     continue
 
+                page = Page(request, name)
+
+                # Filter underlay pages
+                if not include_underlay and page.getPageStatus()[0]: # is an underlay page
+                    continue
+
                 # Filter deleted pages
-                if exists and not Page(request, name).exists():
+                if exists and not page.exists():
                     continue
 
                 # Filter out page user may not read.
--- a/MoinMoin/_tests/test_wikisync.py	Tue Aug 15 11:20:21 2006 +0200
+++ b/MoinMoin/_tests/test_wikisync.py	Tue Aug 15 11:21:11 2006 +0200
@@ -11,7 +11,7 @@
 from MoinMoin.PageEditor import PageEditor
 from MoinMoin._tests import TestConfig, TestSkipped
 
-from MoinMoin.wikisync import TagStore
+from MoinMoin.wikisync import TagStore, BOTH
 
 
 class UnsafeSyncTestcase(TestCase):
@@ -27,7 +27,7 @@
     def testBasicTagThings(self):
         tags = TagStore(self.page)
         self.assert_(not tags.get_all_tags())
-        tags.add(remote_wiki="foo", remote_rev=1, current_rev=2)
+        tags.add(remote_wiki="foo", remote_rev=1, current_rev=2, direction=BOTH, normalised_name="FrontPage")
         tags = TagStore(self.page) # reload
         self.assert_(tags.get_all_tags()[0].remote_rev == 1)
     
--- a/MoinMoin/action/SyncPages.py	Tue Aug 15 11:20:21 2006 +0200
+++ b/MoinMoin/action/SyncPages.py	Tue Aug 15 11:21:11 2006 +0200
@@ -10,9 +10,7 @@
 
 import os
 import re
-import zipfile
 import xmlrpclib
-from datetime import datetime
 
 # Compatiblity to Python 2.3
 try:
@@ -26,269 +24,18 @@
 from MoinMoin.PageEditor import PageEditor, conflict_markers
 from MoinMoin.Page import Page
 from MoinMoin.wikidicts import Dict, Group
-from MoinMoin.wikisync import TagStore
+from MoinMoin.wikisync import (TagStore, UnsupportedWikiException, SyncPage,
+                               MoinLocalWiki, MoinRemoteWiki, UP, DOWN, BOTH)
 from MoinMoin.util.bdiff import decompress, patch, compress, textdiff
 from MoinMoin.util import diff3
 
-# directions
-UP, DOWN, BOTH = range(3)
-directions_map = {"up": UP, "down": DOWN, "both": BOTH}
-
 
-def normalise_pagename(page_name, prefix):
-    """ Checks if the page_name starts with the prefix.
-        Returns None if it does not, otherwise strips the prefix.
-    """
-    if prefix:
-        if not page_name.startswith(prefix):
-            return None
-        else:
-            return page_name[len(prefix):]
-    else:
-        return page_name
+# map sync directions
+directions_map = {"up": UP, "down": DOWN, "both": BOTH}
 
 
 class ActionStatus(Exception): pass
 
-class UnsupportedWikiException(Exception): pass
-
-# XXX Move these classes to MoinMoin.wikisync
-class SyncPage(object):
-    """ This class represents a page in one or two wiki(s). """
-    def __init__(self, name, local_rev=None, remote_rev=None, local_name=None, remote_name=None):
-        """ Creates a SyncPage instance.
-            @param name: The canonical name of the page, without prefixes.
-            @param local_rev: The revision of the page in the local wiki.
-            @param remote_rev: The revision of the page in the remote wiki.
-            @param local_name: The page name of the page in the local wiki.
-            @param remote_name: The page name of the page in the remote wiki.
-        """
-        self.name = name
-        self.local_rev = local_rev
-        self.remote_rev = remote_rev
-        self.local_name = local_name
-        self.remote_name = remote_name
-        assert local_rev or remote_rev
-        assert local_name or remote_name
-
-    def __repr__(self):
-        return repr("<Remote Page %r>" % unicode(self))
-
-    def __unicode__(self):
-        return u"%s[%s|%s]<%r:%r>" % (self.name, self.local_name, self.remote_name, self.local_rev, self.remote_rev)
-
-    def __lt__(self, other):
-        return self.name < other.name
-
-    def __hash__(self):
-        """ Ensures that the hash value of this page only depends on the canonical name. """
-        return hash(self.name)
-
-    def __eq__(self, other):
-        if not isinstance(other, SyncPage):
-            return false
-        return self.name == other.name
-
-    def add_missing_pagename(self, local, remote):
-        """ Checks if the particular concrete page names are unknown and fills
-            them in.
-        """
-        if self.local_name is None:
-            n_name = normalise_pagename(self.remote_name, remote.prefix)
-            assert n_name is not None
-            self.local_name = (local.prefix or "") + n_name
-        elif self.remote_name is None:
-            n_name = normalise_pagename(self.local_name, local.prefix)
-            assert n_name is not None
-            self.remote_name = (local.prefix or "") + n_name
-
-        return self # makes using list comps easier
-
-    def filter(cls, sp_list, func):
-        """ Returns all pages in sp_list that let func return True
-            for the canonical page name.
-        """
-        return [x for x in sp_list if func(x.name)]
-    filter = classmethod(filter)
-
-    def merge(cls, local_list, remote_list):
-        """ Merges two lists of SyncPages into one, migrating attributes like the names. """
-        # map page names to SyncPage objects :-)
-        d = dict(zip(local_list, local_list))
-        for sp in remote_list:
-            if sp in d:
-                d[sp].remote_rev = sp.remote_rev
-                d[sp].remote_name = sp.remote_name
-            else:
-                d[sp] = sp
-        return d.keys()
-    merge = classmethod(merge)
-
-    def is_only_local(self):
-        """ Is true if the page is only in the local wiki. """
-        return not self.remote_rev
-
-    def is_only_remote(self):
-        """ Is true if the page is only in the remote wiki. """
-        return not self.local_rev
-
-    def is_local_and_remote(self):
-        """ Is true if the page is in both wikis. """
-        return self.local_rev and self.remote_rev
-
-    def iter_local_only(cls, sp_list):
-        """ Iterates over all pages that are local only. """
-        for x in sp_list:
-            if x.is_only_local():
-                yield x
-    iter_local_only = classmethod(iter_local_only)
-
-    def iter_remote_only(cls, sp_list):
-        """ Iterates over all pages that are remote only. """
-        for x in sp_list:
-            if x.is_only_remote():
-                yield x
-    iter_remote_only = classmethod(iter_remote_only)
-
-    def iter_local_and_remote(cls, sp_list):
-        """ Iterates over all pages that are local and remote. """
-        for x in sp_list:
-            if x.is_local_and_remote():
-                yield x
-    iter_local_and_remote = classmethod(iter_local_and_remote)
-
-class RemoteWiki(object):
-    """ This class should be the base for all implementations of remote wiki
-        classes. """
-
-    def __repr__(self):
-        """ Returns a representation of the instance for debugging purposes. """
-        return NotImplemented
-
-    def get_interwiki_name(self):
-        """ Returns the interwiki name of the other wiki. """
-        return NotImplemented
-
-    def get_iwid(self):
-        """ Returns the InterWiki ID. """
-        return NotImplemented
-
-    def get_pages(self):
-        """ Returns a list of SyncPage instances. """
-        return NotImplemented
-
-
-class MoinRemoteWiki(RemoteWiki):
-    """ Used for MoinMoin wikis reachable via XMLRPC. """
-    def __init__(self, request, interwikiname, prefix):
-        self.request = request
-        self.prefix = prefix
-        _ = self.request.getText
-
-        wikitag, wikiurl, wikitail, wikitag_bad = wikiutil.resolve_wiki(self.request, '%s:""' % (interwikiname, ))
-        self.wiki_url = wikiutil.mapURL(self.request, wikiurl)
-        self.valid = not wikitag_bad
-        self.xmlrpc_url = self.wiki_url + "?action=xmlrpc2"
-        if not self.valid:
-            self.connection = None
-            return
-
-        self.connection = self.createConnection()
-
-        version = self.connection.getMoinVersion()
-        if not isinstance(version, (tuple, list)):
-            raise UnsupportedWikiException(_("The remote version of MoinMoin is too old, the version 1.6 is required at least."))
-
-        remote_interwikiname = self.get_interwiki_name()
-        remote_iwid = self.connection.interwikiName()[1]
-        self.is_anonymous = remote_interwikiname is None
-        if not self.is_anonymous and interwikiname != remote_interwikiname:
-            raise UnsupportedWikiException(_("The remote wiki uses a different InterWiki name (%(remotename)s)"
-                                             " internally than you specified (%(localname)s).") % {
-                "remotename": wikiutil.escape(remote_interwikiname), "localname": wikiutil.escape(interwikiname)})
-
-        if self.is_anonymous:
-            self.iwid_full = packLine([remote_iwid])
-        else:
-            self.iwid_full = packLine([remote_iwid, interwikiname])
-
-    def createConnection(self):
-        return xmlrpclib.ServerProxy(self.xmlrpc_url, allow_none=True, verbose=True)
-
-    # Public methods
-    def get_diff(self, pagename, from_rev, to_rev):
-        """ 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
-    def get_interwiki_name(self):
-        return self.connection.interwikiName()[0]
-
-    def get_iwid(self):
-        return self.connection.interwikiName()[1]
-
-    def get_pages(self):
-        pages = self.connection.getAllPagesEx({"include_revno": True, "include_deleted": True,
-                                               "exclude_non_writable": True}) # XXX fix when all 3 directions are supported
-        rpages = []
-        for name, revno in pages:
-            normalised_name = normalise_pagename(name, self.prefix)
-            if normalised_name is None:
-                continue
-            rpages.append(SyncPage(normalised_name, remote_rev=revno, remote_name=name))
-        return rpages
-
-    def __repr__(self):
-        return "<MoinRemoteWiki wiki_url=%r valid=%r>" % (self.wiki_url, self.valid)
-
-
-class MoinLocalWiki(RemoteWiki):
-    """ Used for the current MoinMoin wiki. """
-    def __init__(self, request, prefix):
-        self.request = request
-        self.prefix = prefix
-
-    def getGroupItems(self, group_list):
-        """ Returns all page names that are listed on the page group_list. """
-        pages = []
-        for group_pagename in group_list:
-            pages.extend(Group(self.request, group_pagename).members())
-        return [self.createSyncPage(x) for x in pages]
-
-    def createSyncPage(self, page_name):
-        normalised_name = normalise_pagename(page_name, self.prefix)
-        if normalised_name is None:
-            return None
-        return SyncPage(normalised_name, local_rev=Page(self.request, page_name).get_real_rev(), local_name=page_name)
-
-    # Public methods:
-
-    # Methods implementing the RemoteWiki interface
-    def get_interwiki_name(self):
-        return self.request.cfg.interwikiname
-
-    def get_iwid(self):
-        return self.request.cfg.iwid
-
-    def get_pages(self):
-        return [x for x in [self.createSyncPage(x) for x in self.request.rootpage.getPageList(exists=0)] if x]
-
-    def __repr__(self):
-        return "<MoinLocalWiki>"
-
 
 class ActionClass:
     INFO, WARN, ERROR = range(3) # used for logging
@@ -298,6 +45,7 @@
         self.pagename = pagename
         self.page = Page(request, pagename)
         self.status = []
+        request.flush()
 
     def log_status(self, level, message):
         """ Appends the message with a given importance level to the internal log. """
@@ -323,7 +71,7 @@
         if options["groupList"] is not None:
             options["groupList"] = unpackLine(options["groupList"], ",")
 
-        options["direction"] = directions_map.get(options["direction"], BOTH)
+        options["direction"] = directions_map.get(options["direction"].lower(), BOTH)
 
         return options
 
@@ -334,7 +82,6 @@
         if params["pageList"] is not None:
             params["pageMatch"] = u'|'.join([r'^%s$' % re.escape(name)
                                              for name in params["pageList"]])
-            del params["pageList"]
 
         if params["pageMatch"] is not None:
             params["pageMatch"] = re.compile(params["pageMatch"], re.U)
@@ -342,6 +89,7 @@
         # we do not support matching or listing pages if there is a group of pages
         if params["groupList"]:
             params["pageMatch"] = None
+            params["pageList"] = None
 
         return params
 
@@ -355,15 +103,18 @@
         params = self.fix_params(self.parse_page())
 
         try:
+            if params["direction"] == UP:
+                raise ActionStatus(_("The only supported directions are BOTH and DOWN."))
+
             if not self.request.cfg.interwikiname:
                 raise ActionStatus(_("Please set an interwikiname in your wikiconfig (see HelpOnConfiguration) to be able to use this action."))
 
             if not params["remoteWiki"]:
                 raise ActionStatus(_("Incorrect parameters. Please supply at least the ''remoteWiki'' parameter."))
 
-            local = MoinLocalWiki(self.request, params["localPrefix"])
+            local = MoinLocalWiki(self.request, params["localPrefix"], params["pageList"])
             try:
-                remote = MoinRemoteWiki(self.request, params["remoteWiki"], params["remotePrefix"])
+                remote = MoinRemoteWiki(self.request, params["remoteWiki"], params["remotePrefix"], params["pageList"])
             except UnsupportedWikiException, (msg, ):
                 raise ActionStatus(msg)
 
@@ -380,11 +131,43 @@
         return self.page.send_page(self.request, msg=msg)
     
     def sync(self, params, local, remote):
-        """ This method does the syncronisation work. """
+        """ This method does the syncronisation work.
+            Currently, it handles the case where the pages exist on both sides.
+            Now there are a few other cases left that have to be implemented:
+                Wiki A    | Wiki B   | Remark
+                ----------+----------+------------------------------
+                exists    | deleted  | In this case, we do a normal merge if there
+                          |          | are no tags. If there were changes in
+                          |          | Wiki A, there is a merge with a conflict.
+                          |          | Otherwise (no changes past last merge),
+                          |          | the page is deleted in Wiki A.
+                          |          | This needs static info that could be
+                          |          | transferred with the pagelist.
+                ----------+----------+-------------------------------
+                exists    | non-     | Now the wiki knows that the page was renamed.
+                with tags | existant | There should be an RPC method that asks
+                          |          | for the new name (which could be recorded
+                          |          | on page rename). Then the page is
+                          |          | renamed in Wiki A as well and the sync
+                          |          | is done normally.
+                          |          | Every wiki retains a dict that maps
+                          |          | (IWID, oldname) => newname and that is
+                          |          | updated on every rename. oldname refers
+                          |          | to the pagename known by the old wiki (can be
+                          |          | gathered from tags).
+                ----------+----------+-------------------------------
+                exists    | any case | Try a rename search first, then
+                          |          | do a sync without considering tags
+                with tags | with non | to ensure data integrity.
+                          | matching |
+                          | tags     |
+                ----------+----------+-------------------------------
+        """
         _ = self.request.getText
+        direction = params["direction"]
 
         l_pages = local.get_pages()
-        r_pages = remote.get_pages()
+        r_pages = remote.get_pages(exclude_non_writable=direction != DOWN)
 
         if params["groupList"]:
             pages_from_groupList = set(local.getGroupItems(params["groupList"]))
@@ -393,11 +176,11 @@
 
         m_pages = [elem.add_missing_pagename(local, remote) for elem in SyncPage.merge(l_pages, r_pages)]
 
-        print "Got %i local, %i remote pages, %i merged pages" % (len(l_pages), len(r_pages), len(m_pages))
-        
+        print "Got %i local, %i remote pages, %i merged pages" % (len(l_pages), len(r_pages), len(m_pages)) # XXX remove
+
         if params["pageMatch"]:
             m_pages = SyncPage.filter(m_pages, params["pageMatch"].match)
-        print "After filtering: Got %i merges pages" % (len(m_pages), )
+        print "After filtering: Got %i merges pages" % (len(m_pages), ) # XXX remove
 
         on_both_sides = list(SyncPage.iter_local_and_remote(m_pages))
         remote_but_not_local = list(SyncPage.iter_remote_only(m_pages))
@@ -407,8 +190,6 @@
         #r_new_pages = u", ".join([unicode(x) for x in remote_but_not_local])
         #l_new_pages = u", ".join([unicode(x) for x in local_but_not_remote])
         #raise ActionStatus("These pages are in the remote wiki, but not local: " + wikiutil.escape(r_new_pages) + "<br>These pages are in the local wiki, but not in the remote one: " + wikiutil.escape(l_new_pages))
-        #if params["direction"] in (DOWN, BOTH):
-        #    for rp in remote_but_not_local:
 
         # let's do the simple case first, can be refactored later to match all cases
         # XXX handle deleted pages
@@ -417,15 +198,17 @@
             print "Processing %r" % rp
 
             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_page = PageEditor(self.request, local_pagename) # YYY direct access
             current_rev = current_page.get_real_rev()
 
             tags = TagStore(current_page)
-            matching_tags = tags.fetch(iwid_full=remote.iwid_full)
+            if direction == BOTH:
+                match_direction = direction
+            else:
+                match_direction = None
+            matching_tags = tags.fetch(iwid_full=remote.iwid_full,direction=match_direction)
             matching_tags.sort()
+            #print "------ TAGS: " + repr(matching_tags) + repr(tags.tags)
 
             if not matching_tags:
                 remote_rev = None
@@ -435,44 +218,75 @@
                 newest_tag = matching_tags[-1]
                 local_rev = newest_tag.current_rev
                 remote_rev = newest_tag.remote_rev
-                if remote_rev == rp.remote_rev and local_rev == current_rev:
+                if remote_rev == rp.remote_rev and (direction == DOWN or local_rev == current_rev):
                     continue # no changes done, next page
-                old_page = Page(self.request, local_pagename, rev=local_rev)
-                old_contents = old_page.get_raw_body_str()
+                old_contents = Page(self.request, local_pagename, rev=local_rev).get_raw_body_str() # YYY direct access
 
             self.log_status(ActionClass.INFO, _("Synchronising page %(pagename)s with remote page %(remotepagename)s ...") % {"pagename": local_pagename, "remotepagename": rp.remote_name})
 
-            diff_result = remote.get_diff(rp.remote_name, remote_rev, None)
-            is_remote_conflict = diff_result["conflict"]
-            assert diff_result["diffversion"] == 1
-            diff = diff_result["diff"]
-            current_remote_rev = diff_result["current"]
+            if direction == DOWN:
+                remote_rev = None # always fetch the full page, ignore remote conflict check
+                patch_base_contents = ""
+            else:
+                patch_base_contents = old_contents
 
-            if remote_rev is None: # set the remote_rev for the case without any tags
+            if remote_rev != rp.remote_rev:
+                diff_result = remote.get_diff(rp.remote_name, remote_rev, None) # XXX might raise ALREADY_CURRENT
+                is_remote_conflict = diff_result["conflict"]
+                assert diff_result["diffversion"] == 1
+                diff = diff_result["diff"]
+                current_remote_rev = diff_result["current"]
+            else:
+                current_remote_rev = remote_rev
+                is_remote_conflict = wikiutil.containsConflictMarker(old_contents.decode("utf-8"))
+                diff = None
+
+            # 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 and direction == BOTH:
                 self.log_status(ActionClass.INFO, _("This is the first synchronisation between this page and the remote wiki."))
-                remote_rev = current_remote_rev
 
-            new_contents = patch(old_contents, decompress(diff)).decode("utf-8")
-            old_contents = old_contents.encode("utf-8")
+            if diff is None:
+                new_contents = old_contents.decode("utf-8")
+            else:
+                new_contents = patch(patch_base_contents, decompress(diff)).decode("utf-8")
 
             # here, the actual merge happens
-            verynewtext = diff3.text_merge(old_contents, new_contents, current_page.get_raw_body(), 1, *conflict_markers)
+            print "Merging %r, %r and %r" % (old_contents.decode("utf-8"), new_contents, current_page.get_raw_body())
+            verynewtext = diff3.text_merge(old_contents.decode("utf-8"), new_contents, current_page.get_raw_body(), 2, *conflict_markers)
 
-            new_local_rev = current_rev + 1 # XXX commit first?
             local_full_iwid = packLine([local.get_iwid(), local.get_interwiki_name()])
             remote_full_iwid = packLine([remote.get_iwid(), remote.get_interwiki_name()])
 
             diff = textdiff(new_contents.encode("utf-8"), verynewtext.encode("utf-8"))
-            very_current_remote_rev = remote.merge_diff(rp.remote_name, compress(diff), new_local_rev, remote_rev, current_remote_rev, local_full_iwid)
+            #print "Diff against %r" % new_contents.encode("utf-8")
+
             comment = u"Local Merge - %r" % (remote.get_interwiki_name() or remote.get_iwid())
 
             # XXX upgrade to write lock
             try:
-                current_page.saveText(verynewtext, current_rev, comment=comment)
+                current_page.saveText(verynewtext, current_rev, comment=comment) # YYY direct access
+            except PageEditor.Unchanged:
+                pass
             except PageEditor.EditConflict:
-                # XXX remote rollback needed
                 assert False, "You stumbled on a problem with the current storage system - I cannot lock pages"
-            tags.add(remote_wiki=remote_full_iwid, remote_rev=very_current_remote_rev, current_rev=new_local_rev)
+
+            new_local_rev = current_page.get_real_rev()
+
+            if direction == BOTH:
+                try:
+                    very_current_remote_rev = remote.merge_diff(rp.remote_name, compress(diff), new_local_rev, current_remote_rev, current_remote_rev, local_full_iwid, rp.name)
+                except Exception, e:
+                    raise # XXX rollback locally and do not tag locally
+            else:
+                very_current_remote_rev = current_remote_rev
+
+            tags.add(remote_wiki=remote_full_iwid, remote_rev=very_current_remote_rev, current_rev=new_local_rev, direction=direction, normalised_name=rp.name)
 
             if not wikiutil.containsConflictMarker(verynewtext):
                 self.log_status(ActionClass.INFO, _("Page successfully merged."))
@@ -480,7 +294,6 @@
                 self.log_status(ActionClass.WARN, _("Page merged with conflicts."))
 
             # XXX release lock
-            # XXX untested
 
 
 def execute(pagename, request):
--- a/MoinMoin/util/bdiff.py	Tue Aug 15 11:20:21 2006 +0200
+++ b/MoinMoin/util/bdiff.py	Tue Aug 15 11:21:11 2006 +0200
@@ -79,8 +79,8 @@
     a = ("foo\n" * 30)
     b = ("  fao" * 30)
 
-    a = file(r"C:\Dokumente und Einstellungen\Administrator\Eigene Dateien\Progra\Python\MoinMoin\moin-1.6-sync\MoinMoin\util\test.1").read()
-    b = file(r"C:\Dokumente und Einstellungen\Administrator\Eigene Dateien\Progra\Python\MoinMoin\moin-1.6-sync\MoinMoin\util\test.2").read()
+    a = file(r"test.1").read()
+    b = file(r"test.2").read()
     a = a.splitlines(1)
     b = b.splitlines(1)
 
--- a/MoinMoin/util/diff3.py	Tue Aug 15 11:20:21 2006 +0200
+++ b/MoinMoin/util/diff3.py	Tue Aug 15 11:21:11 2006 +0200
@@ -6,25 +6,28 @@
     @license: GNU GPL, see COPYING for details.
 """
 
-def text_merge(old, other, new, allow_conflicts=1,
-               marker1='<<<<<<<<<<<<<<<<<<<<<<<<<\n',
-               marker2='=========================\n',
-               marker3='>>>>>>>>>>>>>>>>>>>>>>>>>\n'):
+default_markers = ('<<<<<<<<<<<<<<<<<<<<<<<<<\n',
+                   '=========================\n',
+                   '>>>>>>>>>>>>>>>>>>>>>>>>>\n')
+
+def text_merge(old, other, new, allow_conflicts=1, *markers):
     """ do line by line diff3 merge with three strings """
     result = merge(old.splitlines(1), other.splitlines(1), new.splitlines(1),
-                   allow_conflicts, marker1, marker2, marker3)
+                   allow_conflicts, *markers)
     return ''.join(result)
 
-def merge(old, other, new, allow_conflicts=1,
-          marker1='<<<<<<<<<<<<<<<<<<<<<<<<<\n',
-          marker2='=========================\n',
-          marker3='>>>>>>>>>>>>>>>>>>>>>>>>>\n'):
+def merge(old, other, new, allow_conflicts=1, *markers):
     """ do line by line diff3 merge
         input must be lists containing single lines   
     """
+    if not markers:
+        markers = default_markers
+    marker1, marker2, marker3 = markers
+
     old_nr, other_nr, new_nr = 0, 0, 0
     old_len, other_len, new_len = len(old), len(other), len(new)
     result = []
+
     while old_nr < old_len and other_nr < other_len and new_nr < new_len:
         # unchanged
         if old[old_nr] == other[other_nr] == new[new_nr]:
@@ -33,6 +36,12 @@
             other_nr += 1
             new_nr += 1
         else:
+            if allow_conflicts == 2: # experimental addition to the algorithm
+                if other[other_nr] == new[new_nr]:
+                    result.append(new[new_nr])
+                    other_nr += 1
+                    new_nr += 1
+                    continue
             new_match = find_match(old, new, old_nr, new_nr)
             other_match = find_match(old, other, old_nr, other_nr)
             # new is changed
@@ -100,13 +109,16 @@
         pass
     # conflict
     else:
-        if not allow_conflicts:
-            return None
-        result.append(marker1)
-        result.extend(other[other_nr:])
-        result.append(marker2)
-        result.extend(new[new_nr:])
-        result.append(marker3)
+        if new == other:
+            result.extend(new[new_nr:])
+        else:
+            if not allow_conflicts:
+                return None
+            result.append(marker1)
+            result.extend(other[other_nr:])
+            result.append(marker2)
+            result.extend(new[new_nr:])
+            result.append(marker3)
     return result
 
 def tripple_match(old, other, new, other_match, new_match):
@@ -255,4 +267,3 @@
 
 if __name__ == '__main__':
     main()
-
--- a/MoinMoin/wikisync.py	Tue Aug 15 11:20:21 2006 +0200
+++ b/MoinMoin/wikisync.py	Tue Aug 15 11:21:11 2006 +0200
@@ -7,33 +7,321 @@
 """
 
 import os
+import xmlrpclib
 
 try:
     import cPickle as pickle
 except ImportError:
     import pickle
 
+
+from MoinMoin import wikiutil
 from MoinMoin.util import lock
-from MoinMoin.packages import unpackLine
+from MoinMoin.Page import Page
+from MoinMoin.packages import unpackLine, packLine
+
+
+# sync directions
+UP, DOWN, BOTH = range(3)
+
+
+def normalise_pagename(page_name, prefix):
+    """ Checks if the page_name starts with the prefix.
+        Returns None if it does not, otherwise strips the prefix.
+    """
+    if prefix:
+        if not page_name.startswith(prefix):
+            return None
+        else:
+            return page_name[len(prefix):]
+    else:
+        return page_name
+
+
+class UnsupportedWikiException(Exception): pass
+
+
+class SyncPage(object):
+    """ This class represents a page in one or two wiki(s). """
+    def __init__(self, name, local_rev=None, remote_rev=None, local_name=None, remote_name=None):
+        """ Creates a SyncPage instance.
+            @param name: The canonical name of the page, without prefixes.
+            @param local_rev: The revision of the page in the local wiki.
+            @param remote_rev: The revision of the page in the remote wiki.
+            @param local_name: The page name of the page in the local wiki.
+            @param remote_name: The page name of the page in the remote wiki.
+        """
+        self.name = name
+        self.local_rev = local_rev
+        self.remote_rev = remote_rev
+        self.local_name = local_name
+        self.remote_name = remote_name
+        assert local_rev or remote_rev
+        assert local_name or remote_name
+
+    def __repr__(self):
+        return repr("<Remote Page %r>" % unicode(self))
+
+    def __unicode__(self):
+        return u"%s[%s|%s]<%r:%r>" % (self.name, self.local_name, self.remote_name, self.local_rev, self.remote_rev)
+
+    def __lt__(self, other):
+        return self.name < other.name
+
+    def __hash__(self):
+        """ Ensures that the hash value of this page only depends on the canonical name. """
+        return hash(self.name)
+
+    def __eq__(self, other):
+        if not isinstance(other, SyncPage):
+            return false
+        return self.name == other.name
+
+    def add_missing_pagename(self, local, remote):
+        """ Checks if the particular concrete page names are unknown and fills
+            them in.
+        """
+        if self.local_name is None:
+            n_name = normalise_pagename(self.remote_name, remote.prefix)
+            assert n_name is not None
+            self.local_name = (local.prefix or "") + n_name
+        elif self.remote_name is None:
+            n_name = normalise_pagename(self.local_name, local.prefix)
+            assert n_name is not None
+            self.remote_name = (local.prefix or "") + n_name
+
+        return self # makes using list comps easier
+
+    def filter(cls, sp_list, func):
+        """ Returns all pages in sp_list that let func return True
+            for the canonical page name.
+        """
+        return [x for x in sp_list if func(x.name)]
+    filter = classmethod(filter)
+
+    def merge(cls, local_list, remote_list):
+        """ Merges two lists of SyncPages into one, migrating attributes like the names. """
+        # map page names to SyncPage objects :-)
+        d = dict(zip(local_list, local_list))
+        for sp in remote_list:
+            if sp in d:
+                d[sp].remote_rev = sp.remote_rev
+                d[sp].remote_name = sp.remote_name
+            else:
+                d[sp] = sp
+        return d.keys()
+    merge = classmethod(merge)
+
+    def is_only_local(self):
+        """ Is true if the page is only in the local wiki. """
+        return not self.remote_rev
+
+    def is_only_remote(self):
+        """ Is true if the page is only in the remote wiki. """
+        return not self.local_rev
+
+    def is_local_and_remote(self):
+        """ Is true if the page is in both wikis. """
+        return self.local_rev and self.remote_rev
+
+    def iter_local_only(cls, sp_list):
+        """ Iterates over all pages that are local only. """
+        for x in sp_list:
+            if x.is_only_local():
+                yield x
+    iter_local_only = classmethod(iter_local_only)
+
+    def iter_remote_only(cls, sp_list):
+        """ Iterates over all pages that are remote only. """
+        for x in sp_list:
+            if x.is_only_remote():
+                yield x
+    iter_remote_only = classmethod(iter_remote_only)
+
+    def iter_local_and_remote(cls, sp_list):
+        """ Iterates over all pages that are local and remote. """
+        for x in sp_list:
+            if x.is_local_and_remote():
+                yield x
+    iter_local_and_remote = classmethod(iter_local_and_remote)
+
+class RemoteWiki(object):
+    """ This class should be the base for all implementations of remote wiki
+        classes. """
+
+    def __repr__(self):
+        """ Returns a representation of the instance for debugging purposes. """
+        return NotImplemented
+
+    def get_interwiki_name(self):
+        """ Returns the interwiki name of the other wiki. """
+        return NotImplemented
+
+    def get_iwid(self):
+        """ Returns the InterWiki ID. """
+        return NotImplemented
+
+    def get_pages(self, **kwargs):
+        """ Returns a list of SyncPage instances. """
+        return NotImplemented
+
+
+class MoinRemoteWiki(RemoteWiki):
+    """ Used for MoinMoin wikis reachable via XMLRPC. """
+    def __init__(self, request, interwikiname, prefix, pagelist):
+        self.request = request
+        self.prefix = prefix
+        self.pagelist = pagelist
+        _ = self.request.getText
+
+        wikitag, wikiurl, wikitail, wikitag_bad = wikiutil.resolve_wiki(self.request, '%s:""' % (interwikiname, ))
+        self.wiki_url = wikiutil.mapURL(self.request, wikiurl)
+        self.valid = not wikitag_bad
+        self.xmlrpc_url = self.wiki_url + "?action=xmlrpc2"
+        if not self.valid:
+            self.connection = None
+            return
+
+        self.connection = self.createConnection()
+
+        try:
+            iw_list = self.connection.interwikiName()
+        except xmlrpclib.Fault, e:
+            raise UnsupportedWikiException(_("The remote version of MoinMoin is too old, the version 1.6 is required at least."))
+
+        self.remote_interwikiname = remote_interwikiname = iw_list[0]
+        self.remote_iwid = remote_iwid = iw_list[1]
+        self.is_anonymous = remote_interwikiname is None
+        if not self.is_anonymous and interwikiname != remote_interwikiname:
+            raise UnsupportedWikiException(_("The remote wiki uses a different InterWiki name (%(remotename)s)"
+                                             " internally than you specified (%(localname)s).") % {
+                "remotename": wikiutil.escape(remote_interwikiname), "localname": wikiutil.escape(interwikiname)})
+
+        if self.is_anonymous:
+            self.iwid_full = packLine([remote_iwid])
+        else:
+            self.iwid_full = packLine([remote_iwid, interwikiname])
+
+    def createConnection(self):
+        return xmlrpclib.ServerProxy(self.xmlrpc_url, allow_none=True, verbose=True)
+
+    # Public methods
+    def get_diff(self, pagename, from_rev, to_rev):
+        """ 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)
+        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, n_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, n_name)
+        return result
+
+    # Methods implementing the RemoteWiki interface
+    def get_interwiki_name(self):
+        return self.remote_interwikiname
+
+    def get_iwid(self):
+        return self.remote_iwid
+
+    def get_pages(self, **kwargs):
+        options = {"include_revno": True,
+                   "include_deleted": True,
+                   "exclude_non_writable": kwargs["exclude_non_writable"],
+                   "include_underlay": False,
+                   "prefix": self.prefix,
+                   "pagelist": self.pagelist}
+        pages = self.connection.getAllPagesEx(options)
+        rpages = []
+        for name, revno in pages:
+            normalised_name = normalise_pagename(name, self.prefix)
+            if normalised_name is None:
+                continue
+            rpages.append(SyncPage(normalised_name, remote_rev=revno, remote_name=name))
+        return rpages
+
+    def __repr__(self):
+        return "<MoinRemoteWiki wiki_url=%r valid=%r>" % (getattr(self, "wiki_url", Ellipsis), getattr(self, "valid", Ellipsis))
+
+
+class MoinLocalWiki(RemoteWiki):
+    """ Used for the current MoinMoin wiki. """
+    def __init__(self, request, prefix, pagelist):
+        self.request = request
+        self.prefix = prefix
+        self.pagelist = pagelist
+
+    def getGroupItems(self, group_list):
+        """ Returns all page names that are listed on the page group_list. """
+        pages = []
+        for group_pagename in group_list:
+            pages.extend(Group(self.request, group_pagename).members())
+        return [self.createSyncPage(x) for x in pages]
+
+    def createSyncPage(self, page_name):
+        normalised_name = normalise_pagename(page_name, self.prefix)
+        if normalised_name is None:
+            return None
+        return SyncPage(normalised_name, local_rev=Page(self.request, page_name).get_real_rev(), local_name=page_name)
+
+    # Public methods:
+
+    # Methods implementing the RemoteWiki interface
+    def get_interwiki_name(self):
+        return self.request.cfg.interwikiname
+
+    def get_iwid(self):
+        return self.request.cfg.iwid
+
+    def get_pages(self, **kwargs):
+        assert not kwargs
+        if self.prefix or self.pagelist:
+            def page_filter(name, prefix=(self.prefix or ""), pagelist=self.pagelist):
+                n_name = normalise_pagename(name, prefix)
+                if not n_name:
+                    return False
+                if not pagelist:
+                    return True
+                return n_name in pagelist
+        else:
+            page_filter = lambda x: True
+        pages = []
+        for x in self.request.rootpage.getPageList(exists=1, include_underlay=False, filter=page_filter):
+            sp = self.createSyncPage(x)
+            if sp:
+                pages.append(sp)
+        return pages
+
+    def __repr__(self):
+        return "<MoinLocalWiki>"
+
+
+# ------------------ Tags ------------------ 
 
 
 class Tag(object):
     """ This class is used to store information about merging state. """
     
-    def __init__(self, remote_wiki, remote_rev, current_rev):
+    def __init__(self, remote_wiki, remote_rev, current_rev, direction, normalised_name):
         """ Creates a new Tag.
         
         @param remote_wiki: The identifier of the remote wiki.
         @param remote_rev: The revision number on the remote end.
         @param current_rev: The related local revision.
+        @param direction: The direction of the sync, encoded as an integer.
         """
-        assert isinstance(remote_wiki, str) and isinstance(remote_rev, int) and isinstance(current_rev, int)
+        assert (isinstance(remote_wiki, basestring) and isinstance(remote_rev, int)
+                and isinstance(current_rev, int) and isinstance(direction, int)
+                and isinstance(normalised_name, basestring))
         self.remote_wiki = remote_wiki
         self.remote_rev = remote_rev
         self.current_rev = current_rev
+        self.direction = direction
+        self.normalised_name = normalised_name
 
     def __repr__(self):
-        return u"<Tag remote_wiki=%r remote_rev=%r current_rev=%r>" % (self.remote_wiki, self.remote_rev, self.current_rev)
+        return u"<Tag normalised_pagename=%r remote_wiki=%r remote_rev=%r current_rev=%r>" % (self.normalised_name, self.remote_wiki, self.remote_rev, self.current_rev)
 
     def __cmp__(self, other):
         if not isinstance(other, Tag):
@@ -50,6 +338,10 @@
         them having accept a page argument at least. """
         pass
 
+    def dump(self):
+        """ Returns all tags for a given item as a string. """
+        return repr(self.get_all_tags())
+
     def add(self, **kwargs):
         """ Adds a Tag object to the current TagStore. """
         print "Got tag for page %r: %r" % (self.page, kwargs)
@@ -122,17 +414,18 @@
         self.tags = []
         self.commit()
 
-    def fetch(self, iwid_full=None, iw_name=None):
-        assert bool(iwid_full) ^ bool(iw_name)
-        if iwid_full:
-            iwid_full = unpackLine(iwid_full)
-            if len(iwid_full) == 1:
-                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]
+    def fetch(self, iwid_full, direction=None):
+        iwid_full = unpackLine(iwid_full)
+        matching_tags = []
+        for t in self.tags:
+            t_iwid_full = unpackLine(t.remote_wiki)
+            if ((t_iwid_full[0] == iwid_full[0]) # either match IWID or IW name
+                or (len(t_iwid_full) == 2 and len(iwid_full) == 2 and t_iwid_full[1] == iwid_full[1])
+                ) and (direction is None or t.direction == direction):
+                matching_tags.append(t)
+        return matching_tags
 
 
 # currently we just have one implementation, so we do not need
 # a factory method
-TagStore = PickleTagStore
\ No newline at end of file
+TagStore = PickleTagStore
--- a/MoinMoin/xmlrpc/__init__.py	Tue Aug 15 11:20:21 2006 +0200
+++ b/MoinMoin/xmlrpc/__init__.py	Tue Aug 15 11:21:11 2006 +0200
@@ -239,23 +239,39 @@
                 include_revno:: set it to True if you want to have lists with [pagename, revno]
                 include_deleted:: set it to True if you want to include deleted pages
                 exclude_non_writable:: do not include pages that the current user may not write to
+                include_underlay:: return underlay pagenames as well
+                prefix:: the page name must begin with this prefix to be included
         @rtype: list
         @return: a list of all pages.
         """
+        from MoinMoin.wikisync import normalise_pagename
         options = {"include_system": True, "include_revno": False, "include_deleted": False,
-                   "exclude_non_writable": False}
+                   "exclude_non_writable": False, "include_underlay": True, "prefix": "",
+                   "pagelist": None}
         if opts is not None:
             options.update(opts)
 
         if not options["include_system"]:
-            filter = lambda name: not wikiutil.isSystemPage(self.request, name)
+            p_filter = lambda name: not wikiutil.isSystemPage(self.request, name)
         else:
-            filter = lambda name: True
+            p_filter = lambda name: True
 
         if options["exclude_non_writable"]:
-            filter = lambda name, filter=filter: filter(name) and self.request.user.may.write(name)
+            p_filter = lambda name, p_filter=p_filter: p_filter(name) and self.request.user.may.write(name)
 
-        pagelist = self.request.rootpage.getPageList(filter=filter, exists=not options["include_deleted"])
+        if options["prefix"] or options["pagelist"]:
+            def p_filter(name, p_filter=p_filter, prefix=(options["prefix"] or ""), pagelist=options["pagelist"]):
+                if not p_filter(name):
+                    return False
+                n_name = normalise_pagename(name, prefix)
+                if not n_name:
+                    return False
+                if not pagelist:
+                    return True
+                return n_name in pagelist
+
+        pagelist = self.request.rootpage.getPageList(filter=p_filter, exists=not options["include_deleted"],
+                                                     include_underlay=options["include_underlay"])
         
         if options['include_revno']:
             return [[self._outstr(x), Page(self.request, x).get_real_rev()] for x in pagelist]
@@ -601,7 +617,8 @@
             oldcontents = lambda: oldpage.get_raw_body_str()
 
         if to_rev is None:
-            newcontents = lambda: currentpage.get_raw_body()
+            newpage = currentpage
+            newcontents = lambda: currentpage.get_raw_body_str()
         else:
             newpage = Page(self.request, pagename, rev=to_rev)
             newcontents = lambda: newpage.get_raw_body_str()
@@ -625,7 +642,7 @@
         else:
             return [self._outstr(name), iwid]
 
-    def xmlrpc_mergeDiff(self, pagename, diff, local_rev, delta_remote_rev, last_remote_rev, interwiki_name):
+    def xmlrpc_mergeDiff(self, pagename, diff, local_rev, delta_remote_rev, last_remote_rev, interwiki_name, normalised_name):
         """ Merges a diff sent by the remote machine and returns the number of the new revision.
             Additionally, this method tags the new revision.
             
@@ -635,9 +652,10 @@
             @param delta_remote_rev: The revno that the diff is taken against.
             @param last_remote_rev: The last revno of the page `pagename` that is known by the other wiki site.
             @param interwiki_name: Used to build the interwiki tag.
+            @param normalised_name: The normalised pagename that is common to both wikis.
         """
         from MoinMoin.util.bdiff import decompress, patch
-        from MoinMoin.wikisync import TagStore
+        from MoinMoin.wikisync import TagStore, BOTH
         LASTREV_INVALID = xmlrpclib.Fault("LASTREV_INVALID", "The page was changed")
 
         pagename = self._instr(pagename)
@@ -664,17 +682,20 @@
 
         # generate the new page revision by applying the diff
         newcontents = patch(basepage.get_raw_body_str(), decompress(str(diff)))
+        #print "Diff against %r" % basepage.get_raw_body_str()
 
         # write page
         try:
-            currentpage.saveText(newcontents.encode("utf-8"), last_remote_rev, comment=comment)
+            currentpage.saveText(newcontents.decode("utf-8"), last_remote_rev, comment=comment)
+        except PageEditor.Unchanged: # could happen in case of both wiki's pages being equal
+            pass
         except PageEditor.EditConflict:
             return LASTREV_INVALID
 
         current_rev = currentpage.get_real_rev()
         
         tags = TagStore(currentpage)
-        tags.add(remote_wiki=interwiki_name, remote_rev=local_rev, current_rev=current_rev)
+        tags.add(remote_wiki=interwiki_name, remote_rev=local_rev, current_rev=current_rev, direction=BOTH, normalised_name=normalised_name)
 
         # XXX unlock page
 
--- a/docs/CHANGES.aschremmer	Tue Aug 15 11:20:21 2006 +0200
+++ b/docs/CHANGES.aschremmer	Tue Aug 15 11:21:11 2006 +0200
@@ -2,19 +2,28 @@
 ===============================
 
   Known main issues:
+    * How to handle renames/deletes?
     * How will we store tags? (Metadata support would be handy)
-    * How to handle renames/deletes?
-    * How to handle colliding/empty interwiki names?
+      (currently done in Pickle files)
 
   ToDo:
-    * Implement actual syncronisation.
-      * Add correct IWID_full handling.
+    * Tags should store the page name to recognise renaming scenarios.
+    * Implement all syncronisation cases (all 3 page sets).
+    * Test with prefixes
+    * Reduce round-trip times by caching queries and using MultiCall objects (coroutines?)
+    * Attach the status information to the job page.
+    * Show tags in an action=info view?
     * Implement a cross-site authentication system, i.e. mainly an
-      identity storage.
+      identity storage. (does OpenID make sense?)
     * Clean up trailing whitespace.
     * Add page locking, i.e. use the one in the new storage layer.
     * Check what needs to be documented on MoinMaster.
     * Search for XXX
+    * Maybe refactor YYY into MoinLocalWiki
+    * Remove amount of "very" in the code
+    * Do older tags of one wiki site have to be stored as well? Why don't we
+      keep just one tag?
+    * Put author names into the comment field, transmit mimetypes.
 
   New Features:
     * XMLRPC method to return the Moin version
@@ -30,6 +39,9 @@
       no system pages etc.)
     * IWID support - i.e. every instance has a unique ID
     * InterWiki page editable in the wiki, modification detection based on mtimes
+    * SyncPages action
+    * XMLRPC functions may return Fault instances
+    * diff3 algorithm extended, a new mode should reduce the conflicts
 
   Bugfixes (only stuff that is buggy in moin/1.6 main branch):
     * Conflict resolution fixes. (merged into main)
@@ -89,7 +101,12 @@
 Week 32: Continued work on the merge logic, finished prefix handling. Added local conflict
          detection in SyncPages. Added logging support to SyncPages. Refactored conflict flag
          detection from the edit action into the PageEditor class. Enhanced XMLRPC server in Moin to allow
-         XMLRPC functions to return Fault instances.
+         XMLRPC functions to return Fault instances. Introduced a new diff3 mode that should reduce the
+         conflicts. Fixed hard to track down bugs in SyncPages. Store full IWIDs and match by
+         either of both components when searching for tags. Ignore underlay pages. Filter the remote page list by
+         the prefix and the pageList on the remote side. Finished the direction==DOWN mode.
+         Started designing the solutions for the other sync cases. Store and transmit the
+         normalised name.
 
 2006-07-18: the requested daily entry is missing here, see http://moinmoin.wikiwikiweb.de/GoogleSoc2006/BetterProgress
 2006-07-19: the requested daily entry is missing here, see http://moinmoin.wikiwikiweb.de/GoogleSoc2006/BetterProgress
@@ -111,6 +128,13 @@
 2006-08-04: the requested daily entry is missing here, see http://moinmoin.wikiwikiweb.de/GoogleSoc2006/BetterProgress
 2006-08-05: student didn't work on project
 2006-08-06: student didn't work on project -- a Sunday
+2006-08-07: entry missing
+2006-08-08: entry missing
+2006-08-09: entry missing
+2006-08-10: entry missing
+2006-08-11: entry missing
+2006-08-12: entry missing
+2006-08-13: entry missing
 
 Time plan
 =========