changeset 378:1127c4123b67

improved mig scripts for old moin data and working around win32 OS bugs imported from: moin--main--1.5--patch-382
author Thomas Waldmann <tw@waldmann-edv.de>
date Sun, 15 Jan 2006 16:05:40 +0000
parents a4e8439bf84c
children 7034d570abeb
files ChangeLog MoinMoin/scripts/migration/12_to_13_mig01.py MoinMoin/scripts/migration/12_to_13_mig04.py MoinMoin/scripts/migration/12_to_13_mig05.py MoinMoin/scripts/migration/12_to_13_mig09.py docs/CHANGES
diffstat 6 files changed, 42 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sat Jan 14 18:50:59 2006 +0000
+++ b/ChangeLog	Sun Jan 15 16:05:40 2006 +0000
@@ -2,6 +2,23 @@
 # arch-tag: automatic-ChangeLog--arch@arch.thinkmo.de--2003-archives/moin--main--1.5
 #
 
+2006-01-15 17:05:40 GMT	Thomas Waldmann <tw@waldmann-edv.de>	patch-382
+
+    Summary:
+      improved mig scripts for old moin data and working around win32 OS bugs
+    Revision:
+      moin--main--1.5--patch-382
+
+    improved mig scripts for old moin data and working around win32 OS bugs
+    
+
+    modified files:
+     ChangeLog MoinMoin/scripts/migration/12_to_13_mig01.py
+     MoinMoin/scripts/migration/12_to_13_mig04.py
+     MoinMoin/scripts/migration/12_to_13_mig05.py
+     MoinMoin/scripts/migration/12_to_13_mig09.py docs/CHANGES
+
+
 2006-01-14 19:50:59 GMT	Alexander Schremmer <alex@alexanderweb.de.tla>	patch-381
 
     Summary:
--- a/MoinMoin/scripts/migration/12_to_13_mig01.py	Sat Jan 14 18:50:59 2006 +0000
+++ b/MoinMoin/scripts/migration/12_to_13_mig01.py	Sun Jan 15 16:05:40 2006 +0000
@@ -149,7 +149,9 @@
             fields[0] = qf_convert_string(fields[0], enc_from, enc_to)
             fields[2] = str(wikiutil.timestamp2version(float(fields[2])))
             if len(fields) < 6:
-                fields.append('SAVE')
+                fields.append('') # comment
+            if len(fields) < 7:
+                fields.append('SAVE') # action
             fields[5] = convert_string(fields[5], enc_from, enc_to)
             line = '\t'.join(fields) + '\n'
             file_to.write(line)
--- a/MoinMoin/scripts/migration/12_to_13_mig04.py	Sat Jan 14 18:50:59 2006 +0000
+++ b/MoinMoin/scripts/migration/12_to_13_mig04.py	Sun Jan 15 16:05:40 2006 +0000
@@ -59,6 +59,8 @@
         return
     f = open(file_to, 'a')
     for l in open(file_from):
+        if not l.strip():
+            continue
         data = l.split('\t')
         data[0] = str(convert_ts(float(data[0]))) # we want usecs
         data = '\t'.join(data)
--- a/MoinMoin/scripts/migration/12_to_13_mig05.py	Sat Jan 14 18:50:59 2006 +0000
+++ b/MoinMoin/scripts/migration/12_to_13_mig05.py	Sun Jan 15 16:05:40 2006 +0000
@@ -187,11 +187,17 @@
                 backup_from = opj(backupdir_from, bfile)
                 bts = long(bfile) # must be long for py 2.2.x
                 for ts in lleftover:
-                    if abs(bts-ts) < 2000000: # editlog, inexact match
+                    tdiff = abs(bts-ts)
+                    if tdiff < 2000000: # editlog, inexact match
                         entry[ts][0] = backup_from
                         lleftover.remove(ts)
                         bleftover.remove(bfile)
-
+                    elif 3599000000 <= tdiff <= 3601000000: # editlog, win32 daylight saving bug
+                        entry[ts][0] = backup_from
+                        lleftover.remove(ts)
+                        bleftover.remove(bfile)
+                        print "Warning: Win32 daylight saving bug encountered & fixed!"
+                        
             if len(bleftover) == 1 and len(lleftover) == 1: # only 1 left, must be this
                 backup_from = opj(backupdir_from, bleftover[0])
                 entry[lleftover[0]][0] = backup_from
@@ -218,6 +224,7 @@
                 
         # delete unmatching log entries
         for ts in lleftover:
+            #print "XXX Deleting leftover log entry: %r" % entry[ts]
             del entry[ts]
         
         info[pagename] = entry
--- a/MoinMoin/scripts/migration/12_to_13_mig09.py	Sat Jan 14 18:50:59 2006 +0000
+++ b/MoinMoin/scripts/migration/12_to_13_mig09.py	Sun Jan 15 16:05:40 2006 +0000
@@ -26,10 +26,6 @@
     data.pre-mig9   - backup of original data directory
     data            - converted data dir
 
-    NOTE: error.log might be missing if previous migrations scripts did
-    not copy it from your original directory. You can copy it manually
-    from the last data.pre-mig that did copy it.
-
  6. Verify conversion results (number of pages, size of logs,
     attachments, number of backup copies) - everything should be
     reasonable before you proceed.
@@ -155,9 +151,7 @@
 
     # Copy ALL stuff from original dir into new data dir. Don't change
     # or drop anything from the original directory expect cache files.
-    # error.log might be missing becase of previous broken migrations
-    # scripts.
-    names = ['edit-log', 'event-log', 'error.log', 'intermap.txt', 'pages', 'plugin']
+    names = ['edit-log', 'event-log', 'intermap.txt', 'pages', 'plugin']
     migutil.copy(names, origdir, datadir)
 
     # Convert user directory
--- a/docs/CHANGES	Sat Jan 14 18:50:59 2006 +0000
+++ b/docs/CHANGES	Sun Jan 15 16:05:40 2006 +0000
@@ -6,7 +6,16 @@
     * Fixed rst parser docutils version check
     * Repaired zipping feature.
     * Fixed the AddRevision command of the PackageInstaller.
-
+    * improved the migration scripts (used to migrate pre-1.3 wikis to 1.3+):
+      * do not crash on empty lines in event log
+      * fix edit log format for very old moin data (like 0.11)
+      * workaround for an ugly win32 operating system bug leading to wiki text
+        file mtime not matching edit logs timestamp values if there was some
+        timezone change since last edit (e.g. a daylight saving tz switch),
+        but differing 3600s.
+        This affected pre-1.3 moin wiki servers running on win32 OS only.
+        We now try to correct those inconsistencies in mig05 by fuzzy matching.
+ 
   Other changes:
     * Updated FCKeditor to current CVS (2006-01-08 == 2.2+)
     * Split up show_hosts into show_hosts and show_names