[CalendarServer-changes] [8706] CalendarServer/branches/users/glyph/migrate-merge

source_changes at macosforge.org source_changes at macosforge.org
Thu Feb 16 04:29:20 PST 2012


Revision: 8706
          http://trac.macosforge.org/projects/calendarserver/changeset/8706
Author:   glyph at apple.com
Date:     2012-02-16 04:29:20 -0800 (Thu, 16 Feb 2012)
Log Message:
-----------
Allow setting this option from the command line, since it is probably a bit dangerous to set it persistently.

Modified Paths:
--------------
    CalendarServer/branches/users/glyph/migrate-merge/calendarserver/tools/upgrade.py

Property Changed:
----------------
    CalendarServer/branches/users/glyph/migrate-merge/

Modified: CalendarServer/branches/users/glyph/migrate-merge/calendarserver/tools/upgrade.py
===================================================================
--- CalendarServer/branches/users/glyph/migrate-merge/calendarserver/tools/upgrade.py	2012-02-16 12:29:17 UTC (rev 8705)
+++ CalendarServer/branches/users/glyph/migrate-merge/calendarserver/tools/upgrade.py	2012-02-16 12:29:20 UTC (rev 8706)
@@ -76,6 +76,7 @@
         super(UpgradeOptions, self).__init__()
         self.upgradeers = []
         self.outputName = '-'
+        self.merge = False
 
 
     def opt_output(self, filename):
@@ -87,6 +88,16 @@
     opt_o = opt_output
 
 
+    def opt_merge(self):
+        """
+        Rather than skipping homes that exist on the filesystem but not in the
+        database, merge their data into the existing homes.
+        """
+        self.merge = True
+
+    opt_m = opt_merge
+
+
     def openOutput(self):
         """
         Open the appropriate output file based on the '--output' option.
@@ -138,6 +149,7 @@
     """
     Do the export.
     """
+    from twistedcaldav.config import config
     if reactor is None:
         from twisted.internet import reactor
 
@@ -154,8 +166,14 @@
                      (e))
         sys.exit(1)
 
+    if options.merge:
+        def setMerge(data):
+            print 'Setting merge option.'
+            data.MergeUpgrades = True
+            print 'Set it?', config.MergeUpgrades
+        config.addPostUpdateHooks([setMerge])
+
     def makeService(store):
-        from twistedcaldav.config import config
         return UpgraderService(store, options, output, reactor, config)
 
     def onlyUpgradeEvents(event):
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20120216/9864fefc/attachment-0001.html>


More information about the calendarserver-changes mailing list