changeset 1754:abbbace78848

Better output for maint_reduce_revisions command. For each item, it prints out the current name and revids of all historical revisions, each in an indented line. When the item name of a historical revision is different from current name, the historical name is printed too. This makes the message clearer, and unambiguous in case there are cross renamings.
author Cheer Xiao <xiaqqaix@gmail.com>
date Wed, 29 Aug 2012 18:20:31 +0800
parents 2be00a5febbe
children ef3990098268
files MoinMoin/script/maint/reduce_revisions.py
diffstat 1 files changed, 13 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/script/maint/reduce_revisions.py	Mon Aug 27 17:30:14 2012 +0800
+++ b/MoinMoin/script/maint/reduce_revisions.py	Wed Aug 29 18:20:31 2012 +0800
@@ -36,11 +36,20 @@
         for current_rev in app.storage.search(q, limit=None):
             current_name = current_rev.meta[NAME]
             current_revid = current_rev.meta[REVID]
+            print "Destroying historical revisions of {0!r}:".format(current_name)
+            has_historical_revision = False
             for rev in current_rev.item.iter_revs():
                 revid = rev.meta[REVID]
-                if revid != current_revid:
-                    name = rev.meta[NAME]
-                    print "Destroying {0!r} revision {1}.".format(name, revid)
-                    current_rev.item.destroy_revision(revid)
+                if revid == current_revid:
+                    continue
+                has_historical_revision = True
+                name = rev.meta[NAME]
+                if name == current_name:
+                    print "    Destroying revision {0}".format(revid)
+                else:
+                    print "    Destroying revision {0} (named {1!r})".format(revid, name)
+                current_rev.item.destroy_revision(revid)
+            if not has_historical_revision:
+                print "    (no historical revisions)"
 
         print "Finished reducing backend."