Permalink
Browse files

Allow setting this option from the command line, since it is probably…

… a bit dangerous to set it persistently.

git-svn-id: https://svn.calendarserver.org/repository/calendarserver/CalendarServer/branches/users/glyph/migrate-merge@8706 e27351fd-9f3e-4f54-a53b-843176b1656c
  • Loading branch information...
1 parent af2f9de commit 80e11cececc7e7ddd8ad20b689a0ba1b41a9119b @glyph glyph committed Feb 16, 2012
Showing with 19 additions and 1 deletion.
  1. +19 −1 calendarserver/tools/upgrade.py
@@ -76,6 +76,7 @@ def __init__(self):
super(UpgradeOptions, self).__init__()
self.upgradeers = []
self.outputName = '-'
+ self.merge = False
def opt_output(self, filename):
@@ -87,6 +88,16 @@ def opt_output(self, filename):
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 @@ def main(argv=sys.argv, stderr=sys.stderr, reactor=None):
"""
Do the export.
"""
+ from twistedcaldav.config import config
if reactor is None:
from twisted.internet import reactor
@@ -154,8 +166,14 @@ def main(argv=sys.argv, stderr=sys.stderr, reactor=None):
(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):

0 comments on commit 80e11ce

Please sign in to comment.