<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[12245] CalendarServer/branches/release/CalendarServer-5.2-dev</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.calendarserver.org//changeset/12245">12245</a></dd>
<dt>Author</dt> <dd>cdaboo@apple.com</dd>
<dt>Date</dt> <dd>2014-01-06 16:29:48 -0800 (Mon, 06 Jan 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Merge from trunk. Allow event splitting at arbitrary recurrence-ids in the future. Add a calverify command to support a manual
split of a specific event.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#CalendarServerbranchesreleaseCalendarServer52devcalendarservertoolscalverifypy">CalendarServer/branches/release/CalendarServer-5.2-dev/calendarserver/tools/calverify.py</a></li>
<li><a href="#CalendarServerbranchesreleaseCalendarServer52devcalendarservertoolstesttest_calverifypy">CalendarServer/branches/release/CalendarServer-5.2-dev/calendarserver/tools/test/test_calverify.py</a></li>
<li><a href="#CalendarServerbranchesreleaseCalendarServer52devtwistedcaldavicalpy">CalendarServer/branches/release/CalendarServer-5.2-dev/twistedcaldav/ical.py</a></li>
<li><a href="#CalendarServerbranchesreleaseCalendarServer52devtxdavcaldavdatastoreschedulingicalsplitterpy">CalendarServer/branches/release/CalendarServer-5.2-dev/txdav/caldav/datastore/scheduling/icalsplitter.py</a></li>
<li><a href="#CalendarServerbranchesreleaseCalendarServer52devtxdavcaldavdatastoreschedulingtesttest_icalsplitterpy">CalendarServer/branches/release/CalendarServer-5.2-dev/txdav/caldav/datastore/scheduling/test/test_icalsplitter.py</a></li>
<li><a href="#CalendarServerbranchesreleaseCalendarServer52devtxdavcaldavdatastoresqlpy">CalendarServer/branches/release/CalendarServer-5.2-dev/txdav/caldav/datastore/sql.py</a></li>
</ul>

<h3>Property Changed</h3>
<ul>
<li><a href="#CalendarServerbranchesreleaseCalendarServer52dev">CalendarServer/branches/release/CalendarServer-5.2-dev/</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="CalendarServerbranchesreleaseCalendarServer52dev"></a>
<div class="propset"><h4>Property changes: CalendarServer/branches/release/CalendarServer-5.2-dev</h4>
<pre class="diff"><span>
</span></pre></div>
<a id="svnmergeinfo"></a>
<div class="modfile"><h4>Modified: svn:mergeinfo</h4></div>
<span class="cx">/CalendarServer/branches/config-separation:4379-4443
</span><span class="cx">/CalendarServer/branches/egg-info-351:4589-4625
</span><span class="cx">/CalendarServer/branches/generic-sqlstore:6167-6191
</span><span class="cx">/CalendarServer/branches/new-store:5594-5934
</span><span class="cx">/CalendarServer/branches/new-store-no-caldavfile:5911-5935
</span><span class="cx">/CalendarServer/branches/new-store-no-caldavfile-2:5936-5981
</span><span class="cx">/CalendarServer/branches/release/CalendarServer-4.3-dev:10180-10190,10192
</span><span class="cx">/CalendarServer/branches/release/CalendarServer-5.1-dev:11846
</span><span class="cx">/CalendarServer/branches/users/cdaboo/batchupload-6699:6700-7198
</span><span class="cx">/CalendarServer/branches/users/cdaboo/cached-subscription-calendars-5692:5693-5702
</span><span class="cx">/CalendarServer/branches/users/cdaboo/component-set-fixes:8130-8346
</span><span class="cx">/CalendarServer/branches/users/cdaboo/directory-cache-on-demand-3627:3628-3644
</span><span class="cx">/CalendarServer/branches/users/cdaboo/fix-no-ischedule:11607-11871
</span><span class="cx">/CalendarServer/branches/users/cdaboo/implicituidrace:8137-8141
</span><span class="cx">/CalendarServer/branches/users/cdaboo/ischedule-dkim:9747-9979
</span><span class="cx">/CalendarServer/branches/users/cdaboo/managed-attachments:9985-10145
</span><span class="cx">/CalendarServer/branches/users/cdaboo/more-sharing-5591:5592-5601
</span><span class="cx">/CalendarServer/branches/users/cdaboo/partition-4464:4465-4957
</span><span class="cx">/CalendarServer/branches/users/cdaboo/performance-tweaks:11824-11836
</span><span class="cx">/CalendarServer/branches/users/cdaboo/pods:7297-7377
</span><span class="cx">/CalendarServer/branches/users/cdaboo/pycalendar:7085-7206
</span><span class="cx">/CalendarServer/branches/users/cdaboo/pycard:7227-7237
</span><span class="cx">/CalendarServer/branches/users/cdaboo/queued-attendee-refreshes:7740-8287
</span><span class="cx">/CalendarServer/branches/users/cdaboo/relative-config-paths-5070:5071-5105
</span><span class="cx">/CalendarServer/branches/users/cdaboo/shared-calendars-5187:5188-5440
</span><span class="cx">/CalendarServer/branches/users/cdaboo/store-scheduling:10876-11129
</span><span class="cx">/CalendarServer/branches/users/cdaboo/timezones:7443-7699
</span><span class="cx">/CalendarServer/branches/users/cdaboo/txn-debugging:8730-8743
</span><span class="cx">/CalendarServer/branches/users/gaya/sharedgroups-3:11088-11204
</span><span class="cx">/CalendarServer/branches/users/glyph/always-abort-txn-on-error:9958-9969
</span><span class="cx">/CalendarServer/branches/users/glyph/case-insensitive-uid:8772-8805
</span><span class="cx">/CalendarServer/branches/users/glyph/conn-limit:6574-6577
</span><span class="cx">/CalendarServer/branches/users/glyph/contacts-server-merge:4971-5080
</span><span class="cx">/CalendarServer/branches/users/glyph/dalify:6932-7023
</span><span class="cx">/CalendarServer/branches/users/glyph/db-reconnect:6824-6876
</span><span class="cx">/CalendarServer/branches/users/glyph/deploybuild:7563-7572
</span><span class="cx">/CalendarServer/branches/users/glyph/digest-auth-redux:10624-10635
</span><span class="cx">/CalendarServer/branches/users/glyph/disable-quota:7718-7727
</span><span class="cx">/CalendarServer/branches/users/glyph/dont-start-postgres:6592-6614
</span><span class="cx">/CalendarServer/branches/users/glyph/enforce-max-requests:11640-11643
</span><span class="cx">/CalendarServer/branches/users/glyph/hang-fix:11465-11491
</span><span class="cx">/CalendarServer/branches/users/glyph/imip-and-admin-html:7866-7984
</span><span class="cx">/CalendarServer/branches/users/glyph/ipv6-client:9054-9105
</span><span class="cx">/CalendarServer/branches/users/glyph/launchd-wrapper-bis:11413-11436
</span><span class="cx">/CalendarServer/branches/users/glyph/linux-tests:6893-6900
</span><span class="cx">/CalendarServer/branches/users/glyph/log-cleanups:11691-11731
</span><span class="cx">/CalendarServer/branches/users/glyph/migrate-merge:8690-8713
</span><span class="cx">/CalendarServer/branches/users/glyph/misc-portability-fixes:7365-7374
</span><span class="cx">/CalendarServer/branches/users/glyph/more-deferreds-6:6322-6368
</span><span class="cx">/CalendarServer/branches/users/glyph/more-deferreds-7:6369-6445
</span><span class="cx">/CalendarServer/branches/users/glyph/multiget-delete:8321-8330
</span><span class="cx">/CalendarServer/branches/users/glyph/new-export:7444-7485
</span><span class="cx">/CalendarServer/branches/users/glyph/one-home-list-api:10048-10073
</span><span class="cx">/CalendarServer/branches/users/glyph/oracle:7106-7155
</span><span class="cx">/CalendarServer/branches/users/glyph/oracle-nulls:7340-7351
</span><span class="cx">/CalendarServer/branches/users/glyph/other-html:8062-8091
</span><span class="cx">/CalendarServer/branches/users/glyph/parallel-sim:8240-8251
</span><span class="cx">/CalendarServer/branches/users/glyph/parallel-upgrade:8376-8400
</span><span class="cx">/CalendarServer/branches/users/glyph/parallel-upgrade_to_1:8571-8583
</span><span class="cx">/CalendarServer/branches/users/glyph/q:9560-9688
</span><span class="cx">/CalendarServer/branches/users/glyph/queue-locking-and-timing:10204-10289
</span><span class="cx">/CalendarServer/branches/users/glyph/quota:7604-7637
</span><span class="cx">/CalendarServer/branches/users/glyph/sendfdport:5388-5424
</span><span class="cx">/CalendarServer/branches/users/glyph/shared-pool-fixes:8436-8443
</span><span class="cx">/CalendarServer/branches/users/glyph/shared-pool-take2:8155-8174
</span><span class="cx">/CalendarServer/branches/users/glyph/sharedpool:6490-6550
</span><span class="cx">/CalendarServer/branches/users/glyph/sharing-api:9192-9205
</span><span class="cx">/CalendarServer/branches/users/glyph/skip-lonely-vtimezones:8524-8535
</span><span class="cx">/CalendarServer/branches/users/glyph/sql-store:5929-6073
</span><span class="cx">/CalendarServer/branches/users/glyph/start-service-start-loop:11060-11065
</span><span class="cx">/CalendarServer/branches/users/glyph/subtransactions:7248-7258
</span><span class="cx">/CalendarServer/branches/users/glyph/table-alias:8651-8664
</span><span class="cx">/CalendarServer/branches/users/glyph/uidexport:7673-7676
</span><span class="cx">/CalendarServer/branches/users/glyph/unshare-when-access-revoked:10562-10595
</span><span class="cx">/CalendarServer/branches/users/glyph/use-system-twisted:5084-5149
</span><span class="cx">/CalendarServer/branches/users/glyph/uuid-normalize:9268-9296
</span><span class="cx">/CalendarServer/branches/users/glyph/warning-cleanups:11347-11357
</span><span class="cx">/CalendarServer/branches/users/glyph/whenNotProposed:11881-11897
</span><span class="cx">/CalendarServer/branches/users/glyph/xattrs-from-files:7757-7769
</span><span class="cx">/CalendarServer/branches/users/sagen/applepush:8126-8184
</span><span class="cx">/CalendarServer/branches/users/sagen/inboxitems:7380-7381
</span><span class="cx">/CalendarServer/branches/users/sagen/locations-resources:5032-5051
</span><span class="cx">/CalendarServer/branches/users/sagen/locations-resources-2:5052-5061
</span><span class="cx">/CalendarServer/branches/users/sagen/purge_old_events:6735-6746
</span><span class="cx">/CalendarServer/branches/users/sagen/resource-delegates-4038:4040-4067
</span><span class="cx">/CalendarServer/branches/users/sagen/resource-delegates-4066:4068-4075
</span><span class="cx">/CalendarServer/branches/users/sagen/resources-2:5084-5093
</span><span class="cx">/CalendarServer/branches/users/sagen/testing:10827-10851,10853-10855
</span><span class="cx">/CalendarServer/branches/users/wsanchez/transations:5515-5593
</span><span class="cx">/CalendarServer/trunk:11898,11991
</span><span class="cx">   + /CalDAVTester/trunk:11193-11198
</span><span class="cx">/CalendarServer/branches/config-separation:4379-4443
</span><span class="cx">/CalendarServer/branches/egg-info-351:4589-4625
</span><span class="cx">/CalendarServer/branches/generic-sqlstore:6167-6191
</span><span class="cx">/CalendarServer/branches/new-store:5594-5934
</span><span class="cx">/CalendarServer/branches/new-store-no-caldavfile:5911-5935
</span><span class="cx">/CalendarServer/branches/new-store-no-caldavfile-2:5936-5981
</span><span class="cx">/CalendarServer/branches/release/CalendarServer-4.3-dev:10180-10190,10192
</span><span class="cx">/CalendarServer/branches/release/CalendarServer-5.1-dev:11846
</span><span class="cx">/CalendarServer/branches/users/cdaboo/batchupload-6699:6700-7198
</span><span class="cx">/CalendarServer/branches/users/cdaboo/cached-subscription-calendars-5692:5693-5702
</span><span class="cx">/CalendarServer/branches/users/cdaboo/component-set-fixes:8130-8346
</span><span class="cx">/CalendarServer/branches/users/cdaboo/directory-cache-on-demand-3627:3628-3644
</span><span class="cx">/CalendarServer/branches/users/cdaboo/fix-no-ischedule:11607-11871
</span><span class="cx">/CalendarServer/branches/users/cdaboo/implicituidrace:8137-8141
</span><span class="cx">/CalendarServer/branches/users/cdaboo/ischedule-dkim:9747-9979
</span><span class="cx">/CalendarServer/branches/users/cdaboo/managed-attachments:9985-10145
</span><span class="cx">/CalendarServer/branches/users/cdaboo/more-sharing-5591:5592-5601
</span><span class="cx">/CalendarServer/branches/users/cdaboo/partition-4464:4465-4957
</span><span class="cx">/CalendarServer/branches/users/cdaboo/performance-tweaks:11824-11836
</span><span class="cx">/CalendarServer/branches/users/cdaboo/pods:7297-7377
</span><span class="cx">/CalendarServer/branches/users/cdaboo/pycalendar:7085-7206
</span><span class="cx">/CalendarServer/branches/users/cdaboo/pycard:7227-7237
</span><span class="cx">/CalendarServer/branches/users/cdaboo/queued-attendee-refreshes:7740-8287
</span><span class="cx">/CalendarServer/branches/users/cdaboo/relative-config-paths-5070:5071-5105
</span><span class="cx">/CalendarServer/branches/users/cdaboo/shared-calendars-5187:5188-5440
</span><span class="cx">/CalendarServer/branches/users/cdaboo/store-scheduling:10876-11129
</span><span class="cx">/CalendarServer/branches/users/cdaboo/timezones:7443-7699
</span><span class="cx">/CalendarServer/branches/users/cdaboo/txn-debugging:8730-8743
</span><span class="cx">/CalendarServer/branches/users/gaya/sharedgroups-3:11088-11204
</span><span class="cx">/CalendarServer/branches/users/glyph/always-abort-txn-on-error:9958-9969
</span><span class="cx">/CalendarServer/branches/users/glyph/case-insensitive-uid:8772-8805
</span><span class="cx">/CalendarServer/branches/users/glyph/conn-limit:6574-6577
</span><span class="cx">/CalendarServer/branches/users/glyph/contacts-server-merge:4971-5080
</span><span class="cx">/CalendarServer/branches/users/glyph/dalify:6932-7023
</span><span class="cx">/CalendarServer/branches/users/glyph/db-reconnect:6824-6876
</span><span class="cx">/CalendarServer/branches/users/glyph/deploybuild:7563-7572
</span><span class="cx">/CalendarServer/branches/users/glyph/digest-auth-redux:10624-10635
</span><span class="cx">/CalendarServer/branches/users/glyph/disable-quota:7718-7727
</span><span class="cx">/CalendarServer/branches/users/glyph/dont-start-postgres:6592-6614
</span><span class="cx">/CalendarServer/branches/users/glyph/enforce-max-requests:11640-11643
</span><span class="cx">/CalendarServer/branches/users/glyph/hang-fix:11465-11491
</span><span class="cx">/CalendarServer/branches/users/glyph/imip-and-admin-html:7866-7984
</span><span class="cx">/CalendarServer/branches/users/glyph/ipv6-client:9054-9105
</span><span class="cx">/CalendarServer/branches/users/glyph/launchd-wrapper-bis:11413-11436
</span><span class="cx">/CalendarServer/branches/users/glyph/linux-tests:6893-6900
</span><span class="cx">/CalendarServer/branches/users/glyph/log-cleanups:11691-11731
</span><span class="cx">/CalendarServer/branches/users/glyph/migrate-merge:8690-8713
</span><span class="cx">/CalendarServer/branches/users/glyph/misc-portability-fixes:7365-7374
</span><span class="cx">/CalendarServer/branches/users/glyph/more-deferreds-6:6322-6368
</span><span class="cx">/CalendarServer/branches/users/glyph/more-deferreds-7:6369-6445
</span><span class="cx">/CalendarServer/branches/users/glyph/multiget-delete:8321-8330
</span><span class="cx">/CalendarServer/branches/users/glyph/new-export:7444-7485
</span><span class="cx">/CalendarServer/branches/users/glyph/one-home-list-api:10048-10073
</span><span class="cx">/CalendarServer/branches/users/glyph/oracle:7106-7155
</span><span class="cx">/CalendarServer/branches/users/glyph/oracle-nulls:7340-7351
</span><span class="cx">/CalendarServer/branches/users/glyph/other-html:8062-8091
</span><span class="cx">/CalendarServer/branches/users/glyph/parallel-sim:8240-8251
</span><span class="cx">/CalendarServer/branches/users/glyph/parallel-upgrade:8376-8400
</span><span class="cx">/CalendarServer/branches/users/glyph/parallel-upgrade_to_1:8571-8583
</span><span class="cx">/CalendarServer/branches/users/glyph/q:9560-9688
</span><span class="cx">/CalendarServer/branches/users/glyph/queue-locking-and-timing:10204-10289
</span><span class="cx">/CalendarServer/branches/users/glyph/quota:7604-7637
</span><span class="cx">/CalendarServer/branches/users/glyph/sendfdport:5388-5424
</span><span class="cx">/CalendarServer/branches/users/glyph/shared-pool-fixes:8436-8443
</span><span class="cx">/CalendarServer/branches/users/glyph/shared-pool-take2:8155-8174
</span><span class="cx">/CalendarServer/branches/users/glyph/sharedpool:6490-6550
</span><span class="cx">/CalendarServer/branches/users/glyph/sharing-api:9192-9205
</span><span class="cx">/CalendarServer/branches/users/glyph/skip-lonely-vtimezones:8524-8535
</span><span class="cx">/CalendarServer/branches/users/glyph/sql-store:5929-6073
</span><span class="cx">/CalendarServer/branches/users/glyph/start-service-start-loop:11060-11065
</span><span class="cx">/CalendarServer/branches/users/glyph/subtransactions:7248-7258
</span><span class="cx">/CalendarServer/branches/users/glyph/table-alias:8651-8664
</span><span class="cx">/CalendarServer/branches/users/glyph/uidexport:7673-7676
</span><span class="cx">/CalendarServer/branches/users/glyph/unshare-when-access-revoked:10562-10595
</span><span class="cx">/CalendarServer/branches/users/glyph/use-system-twisted:5084-5149
</span><span class="cx">/CalendarServer/branches/users/glyph/uuid-normalize:9268-9296
</span><span class="cx">/CalendarServer/branches/users/glyph/warning-cleanups:11347-11357
</span><span class="cx">/CalendarServer/branches/users/glyph/whenNotProposed:11881-11897
</span><span class="cx">/CalendarServer/branches/users/glyph/xattrs-from-files:7757-7769
</span><span class="cx">/CalendarServer/branches/users/sagen/applepush:8126-8184
</span><span class="cx">/CalendarServer/branches/users/sagen/inboxitems:7380-7381
</span><span class="cx">/CalendarServer/branches/users/sagen/locations-resources:5032-5051
</span><span class="cx">/CalendarServer/branches/users/sagen/locations-resources-2:5052-5061
</span><span class="cx">/CalendarServer/branches/users/sagen/purge_old_events:6735-6746
</span><span class="cx">/CalendarServer/branches/users/sagen/resource-delegates-4038:4040-4067
</span><span class="cx">/CalendarServer/branches/users/sagen/resource-delegates-4066:4068-4075
</span><span class="cx">/CalendarServer/branches/users/sagen/resources-2:5084-5093
</span><span class="cx">/CalendarServer/branches/users/sagen/testing:10827-10851,10853-10855
</span><span class="cx">/CalendarServer/branches/users/wsanchez/transations:5515-5593
</span><span class="cx">/CalendarServer/trunk:11898,11991,12241
</span><a id="CalendarServerbranchesreleaseCalendarServer52devcalendarservertoolscalverifypy"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/release/CalendarServer-5.2-dev/calendarserver/tools/calverify.py (12244 => 12245)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/release/CalendarServer-5.2-dev/calendarserver/tools/calverify.py        2014-01-06 23:22:43 UTC (rev 12244)
+++ CalendarServer/branches/release/CalendarServer-5.2-dev/calendarserver/tools/calverify.py        2014-01-07 00:29:48 UTC (rev 12245)
</span><span class="lines">@@ -72,6 +72,9 @@
</span><span class="cx"> from twistedcaldav.util import normalizationLookup
</span><span class="cx"> 
</span><span class="cx"> from txdav.caldav.icalendarstore import ComponentUpdateState
</span><ins>+from txdav.caldav.datastore.scheduling.icalsplitter import iCalSplitter
+from txdav.caldav.datastore.scheduling.implicit import ImplicitScheduler
+from txdav.caldav.datastore.sql import CalendarStoreFeatures
</ins><span class="cx"> from txdav.common.datastore.sql_tables import schema, _BIND_MODE_OWN
</span><span class="cx"> from txdav.common.icommondatastore import InternalDataStoreError
</span><span class="cx"> 
</span><span class="lines">@@ -206,7 +209,7 @@
</span><span class="cx"> if not hasattr(Component, &quot;maxAlarmCounts&quot;):
</span><span class="cx">     Component.hasDuplicateAlarms = new_hasDuplicateAlarms
</span><span class="cx"> 
</span><del>-VERSION = &quot;10&quot;
</del><ins>+VERSION = &quot;11&quot;
</ins><span class="cx"> 
</span><span class="cx"> def printusage(e=None):
</span><span class="cx">     if e:
</span><span class="lines">@@ -240,6 +243,7 @@
</span><span class="cx">                       with either --ical or --mismatch.
</span><span class="cx"> --double            : detect double-bookings.
</span><span class="cx"> --dark-purge        : purge room/resource events with invalid organizer
</span><ins>+--split             : split recurring event
</ins><span class="cx"> 
</span><span class="cx"> --nuke PATH|RID     : remove specific calendar resources - can
</span><span class="cx">                       only be used by itself. PATH is the full
</span><span class="lines">@@ -275,6 +279,10 @@
</span><span class="cx"> --summary  : report only which GUIDs have double-bookings - no details.
</span><span class="cx"> --days     : number of days ahead to scan [DEFAULT: 365]
</span><span class="cx"> 
</span><ins>+Options for --double:
+If none of (--no-organizer, --invalid-organizer, --disabled-organizer) is present, it
+will default to (--invalid-organizer, --disabled-organizer).
+
</ins><span class="cx"> Options for --dark-purge:
</span><span class="cx"> 
</span><span class="cx"> --uuid     : only scan specified calendar homes. Can be a partial GUID
</span><span class="lines">@@ -285,9 +293,12 @@
</span><span class="cx"> --invalid-organizer  : only detect events with an organizer not in the directory
</span><span class="cx"> --disabled-organizer : only detect events with an organizer disabled for calendaring
</span><span class="cx"> 
</span><del>-If none of (--no-organizer, --invalid-organizer, --disabled-organizer) is present, it
-will default to (--invalid-organizer, --disabled-organizer).
</del><ins>+Options for --split:
</ins><span class="cx"> 
</span><ins>+--path     : URI path to resource to split.
+--rid      : UTC date-time where split occurs (YYYYMMDDTHHMMSSZ).
+--summary  : only print a list of recurrences in the resource - no splitting.
+
</ins><span class="cx"> CHANGES
</span><span class="cx"> v8: Detects ORGANIZER or ATTENDEE properties with mailto: calendar user
</span><span class="cx">     addresses for users that have valid directory records. Fix is to
</span><span class="lines">@@ -295,6 +306,10 @@
</span><span class="cx"> 
</span><span class="cx"> v9: Detects double-bookings.
</span><span class="cx"> 
</span><ins>+v10: Purges data for invalid users.
+
+v11: Allows manual splitting of recurring events.
+
</ins><span class="cx"> &quot;&quot;&quot; % (VERSION,)
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="lines">@@ -319,10 +334,11 @@
</span><span class="cx">         ['missing', 'm', &quot;Show 'orphaned' homes.&quot;],
</span><span class="cx">         ['double', 'd', &quot;Detect double-bookings.&quot;],
</span><span class="cx">         ['dark-purge', 'p', &quot;Purge room/resource events with invalid organizer.&quot;],
</span><ins>+        ['split', 'l', &quot;Split an event.&quot;],
</ins><span class="cx">         ['fix', 'x', &quot;Fix problems.&quot;],
</span><span class="cx">         ['verbose', 'v', &quot;Verbose logging.&quot;],
</span><span class="cx">         ['details', 'V', &quot;Detailed logging.&quot;],
</span><del>-        ['summary', 'S', &quot;Summary of double-bookings.&quot;],
</del><ins>+        ['summary', 'S', &quot;Summary of double-bookings/split.&quot;],
</ins><span class="cx">         ['tzid', 't', &quot;Timezone to adjust displayed times to.&quot;],
</span><span class="cx"> 
</span><span class="cx">         ['no-organizer', '', &quot;Detect dark events without an organizer&quot;],
</span><span class="lines">@@ -335,7 +351,9 @@
</span><span class="cx">         ['uuid', 'u', &quot;&quot;, &quot;Only check this user.&quot;],
</span><span class="cx">         ['uid', 'U', &quot;&quot;, &quot;Only this event UID.&quot;],
</span><span class="cx">         ['nuke', 'e', &quot;&quot;, &quot;Remove event given its path.&quot;],
</span><del>-        ['days', 'T', &quot;365&quot;, &quot;Number of days for scanning events into the future.&quot;]
</del><ins>+        ['days', 'T', &quot;365&quot;, &quot;Number of days for scanning events into the future.&quot;],
+        ['path', '', &quot;&quot;, &quot;Split event given its path.&quot;],
+        ['rid', '', &quot;&quot;, &quot;Split date-time.&quot;],
</ins><span class="cx">     ]
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="lines">@@ -2670,6 +2688,122 @@
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> 
</span><ins>+class EventSplitService(CalVerifyService):
+    &quot;&quot;&quot;
+    Service which splits a recurring event at a specific date-time value.
+    &quot;&quot;&quot;
+
+    def title(self):
+        return &quot;Event Split Service&quot;
+
+
+    @inlineCallbacks
+    def doAction(self):
+        &quot;&quot;&quot;
+        Split a resource using either its path or resource id.
+        &quot;&quot;&quot;
+
+        self.txn = self.store.newTransaction()
+
+        path = self.options[&quot;path&quot;]
+        if path.startswith(&quot;/calendars/__uids__/&quot;):
+            try:
+                pathbits = path.split(&quot;/&quot;)
+            except TypeError:
+                printusage(&quot;Not a valid calendar object resource path: %s&quot; % (path,))
+            if len(pathbits) != 6:
+                printusage(&quot;Not a valid calendar object resource path: %s&quot; % (path,))
+            homeName = pathbits[3]
+            calendarName = pathbits[4]
+            resourceName = pathbits[5]
+
+            resid = yield self.getResourceID(homeName, calendarName, resourceName)
+            if resid is None:
+                yield self.txn.commit()
+                self.txn = None
+                self.output.write(&quot;\n&quot;)
+                self.output.write(&quot;Path does not exist. Nothing split.\n&quot;)
+                returnValue(None)
+            resid = int(resid)
+        else:
+            try:
+                resid = int(path)
+            except ValueError:
+                printusage(&quot;path argument must be a calendar object path or an SQL resource-id&quot;)
+
+        calendarObj = yield CalendarStoreFeatures(self.txn._store).calendarObjectWithID(self.txn, resid)
+        ical = yield calendarObj.component()
+
+        # Must be the ORGANIZER's copy
+        organizer = ical.getOrganizer()
+        if organizer is None:
+            printusage(&quot;Calendar object has no ORGANIZER property - cannot split&quot;)
+
+        # Only allow organizers to split
+        scheduler = ImplicitScheduler()
+        is_attendee = (yield scheduler.testAttendeeEvent(calendarObj.calendar(), calendarObj, ical,))
+        if is_attendee:
+            printusage(&quot;Calendar object is not owned by the ORGANIZER - cannot split&quot;)
+
+        if self.options[&quot;summary&quot;]:
+            result = self.doSummary(ical)
+        else:
+            result = yield self.doSplit(resid, calendarObj, ical)
+
+        returnValue(result)
+
+
+    def doSummary(self, ical):
+        &quot;&quot;&quot;
+        Print a summary of the recurrence instances of the specified event.
+
+        @param ical: calendar to process
+        @type ical: L{Component}
+        &quot;&quot;&quot;
+        self.output.write(&quot;\n---- Calendar resource instances ----\n&quot;)
+
+        # Find the instance RECURRENCE-ID where a split is going to happen
+        now = PyCalendarDateTime.getNowUTC()
+        now.offsetDay(1)
+        instances = ical.cacheExpandedTimeRanges(now)
+        instances = sorted(instances.instances.values(), key=lambda x: x.start)
+        for instance in instances:
+            self.output.write(instance.rid.getText() + (&quot; *\n&quot; if instance.overridden else &quot;\n&quot;))
+
+
+    @inlineCallbacks
+    def doSplit(self, resid, calendarObj, ical):
+        rid = self.options[&quot;rid&quot;]
+        try:
+            if rid[-1] != &quot;Z&quot;:
+                raise ValueError
+            rid = PyCalendarDateTime.parseText(rid)
+        except ValueError:
+            printusage(&quot;rid must be a valid UTC date-time value: 'YYYYMMDDTHHMMSSZ'&quot;)
+
+        self.output.write(&quot;\n---- Splitting calendar resource ----\n&quot;)
+
+        # Find actual RECURRENCE-ID of split
+        splitter = iCalSplitter(1024, 14)
+        rid = splitter.whereSplit(ical, break_point=rid, allow_past_the_end=False)
+        if rid is None:
+            printusage(&quot;rid is not a valid recurrence instance&quot;)
+
+        self.output.write(&quot;\n&quot;)
+        self.output.write(&quot;Actual RECURRENCE-ID: %s.\n&quot; % (rid,))
+
+        oldUID = yield calendarObj.split(rid=rid)
+
+        self.output.write(&quot;\n&quot;)
+        self.output.write(&quot;Split Resource: %s at %s, old UID: %s.\n&quot; % (resid, rid, oldUID,))
+
+        yield self.txn.commit()
+        self.txn = None
+
+        returnValue(oldUID)
+
+
+
</ins><span class="cx"> def main(argv=sys.argv, stderr=sys.stderr, reactor=None):
</span><span class="cx"> 
</span><span class="cx">     if reactor is None:
</span><span class="lines">@@ -2702,6 +2836,8 @@
</span><span class="cx">             return DoubleBookingService(store, options, output, reactor, config)
</span><span class="cx">         elif options[&quot;dark-purge&quot;]:
</span><span class="cx">             return DarkPurgeService(store, options, output, reactor, config)
</span><ins>+        elif options[&quot;split&quot;]:
+            return EventSplitService(store, options, output, reactor, config)
</ins><span class="cx">         else:
</span><span class="cx">             printusage(&quot;Invalid operation&quot;)
</span><span class="cx">             sys.exit(1)
</span></span></pre></div>
<a id="CalendarServerbranchesreleaseCalendarServer52devcalendarservertoolstesttest_calverifypy"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/release/CalendarServer-5.2-dev/calendarserver/tools/test/test_calverify.py (12244 => 12245)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/release/CalendarServer-5.2-dev/calendarserver/tools/test/test_calverify.py        2014-01-06 23:22:43 UTC (rev 12244)
+++ CalendarServer/branches/release/CalendarServer-5.2-dev/calendarserver/tools/test/test_calverify.py        2014-01-07 00:29:48 UTC (rev 12245)
</span><span class="lines">@@ -20,7 +20,8 @@
</span><span class="cx"> &quot;&quot;&quot;
</span><span class="cx"> 
</span><span class="cx"> from calendarserver.tools.calverify import BadDataService, \
</span><del>-    SchedulingMismatchService, DoubleBookingService, DarkPurgeService
</del><ins>+    SchedulingMismatchService, DoubleBookingService, DarkPurgeService, \
+    EventSplitService
</ins><span class="cx"> 
</span><span class="cx"> from pycalendar.datetime import PyCalendarDateTime
</span><span class="cx"> 
</span><span class="lines">@@ -28,6 +29,7 @@
</span><span class="cx"> from twisted.internet.defer import inlineCallbacks
</span><span class="cx"> 
</span><span class="cx"> from twistedcaldav.config import config
</span><ins>+from twistedcaldav.ical import normalize_iCalStr
</ins><span class="cx"> from twistedcaldav.test.util import StoreTestCase
</span><span class="cx"> 
</span><span class="cx"> from txdav.common.datastore.test.util import populateCalendarsFrom
</span><span class="lines">@@ -2806,3 +2808,322 @@
</span><span class="cx">         self.assertEqual(len(calverify.results[&quot;Dark Events&quot;]), 0)
</span><span class="cx">         self.assertTrue(&quot;Fix dark events&quot; not in calverify.results)
</span><span class="cx">         self.assertTrue(&quot;Fix remove&quot; not in calverify.results)
</span><ins>+
+
+
+class CalVerifyEventPurge(CalVerifyMismatchTestsBase):
+    &quot;&quot;&quot;
+    Tests calverify for events.
+    &quot;&quot;&quot;
+
+    # No organizer
+    NO_ORGANIZER_ICS = &quot;&quot;&quot;BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//Apple Inc.//iCal 4.0.1//EN
+CALSCALE:GREGORIAN
+BEGIN:VEVENT
+CREATED:20100303T181216Z
+UID:INVITE_NO_ORGANIZER_ICS
+TRANSP:OPAQUE
+SUMMARY:INVITE_NO_ORGANIZER_ICS
+DTSTART:%(now_fwd10)s
+DURATION:PT1H
+DTSTAMP:20100303T181220Z
+SEQUENCE:2
+END:VEVENT
+END:VCALENDAR
+&quot;&quot;&quot;.replace(&quot;\n&quot;, &quot;\r\n&quot;)
+
+    # Valid organizer
+    VALID_ORGANIZER_ICS = &quot;&quot;&quot;BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//Apple Inc.//iCal 4.0.1//EN
+BEGIN:VEVENT
+UID:INVITE_VALID_ORGANIZER_ICS
+DTSTART:%(now)s
+DURATION:PT1H
+ATTENDEE:urn:uuid:%(uuid1)s
+ATTENDEE:urn:uuid:%(uuid2)s
+ORGANIZER:urn:uuid:%(uuid1)s
+RRULE:FREQ=DAILY
+SUMMARY:INVITE_VALID_ORGANIZER_ICS
+END:VEVENT
+END:VCALENDAR
+&quot;&quot;&quot;.replace(&quot;\n&quot;, &quot;\r\n&quot;)
+
+    # Valid attendee
+    VALID_ATTENDEE_ICS = &quot;&quot;&quot;BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//Apple Inc.//iCal 4.0.1//EN
+BEGIN:VEVENT
+UID:INVITE_VALID_ORGANIZER_ICS
+DTSTART:%(now)s
+DURATION:PT1H
+ATTENDEE:urn:uuid:%(uuid1)s
+ATTENDEE:urn:uuid:%(uuid2)s
+ORGANIZER:urn:uuid:%(uuid1)s
+RRULE:FREQ=DAILY
+SUMMARY:INVITE_VALID_ORGANIZER_ICS
+END:VEVENT
+END:VCALENDAR
+&quot;&quot;&quot;.replace(&quot;\n&quot;, &quot;\r\n&quot;)
+
+    # Valid organizer
+    VALID_ORGANIZER_FUTURE_ICS = &quot;&quot;&quot;BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//Apple Inc.//iCal 4.0.1//EN
+BEGIN:VEVENT
+UID:INVITE_VALID_ORGANIZER_ICS
+DTSTART:%(now_fwd11)s
+DURATION:PT1H
+ATTENDEE:urn:uuid:%(uuid1)s
+ATTENDEE:urn:uuid:%(uuid2)s
+ORGANIZER:urn:uuid:%(uuid1)s
+RELATED-TO;RELTYPE=X-CALENDARSERVER-RECURRENCE-SET:%(relID)s
+RRULE:FREQ=DAILY
+SEQUENCE:1
+SUMMARY:INVITE_VALID_ORGANIZER_ICS
+END:VEVENT
+END:VCALENDAR
+&quot;&quot;&quot;.replace(&quot;\n&quot;, &quot;\r\n&quot;)
+
+    # Valid attendee
+    VALID_ATTENDEE_FUTURE_ICS = &quot;&quot;&quot;BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//Apple Inc.//iCal 4.0.1//EN
+BEGIN:VEVENT
+UID:INVITE_VALID_ORGANIZER_ICS
+DTSTART:%(now_fwd11)s
+DURATION:PT1H
+ATTENDEE:urn:uuid:%(uuid1)s
+ATTENDEE:urn:uuid:%(uuid2)s
+ORGANIZER:urn:uuid:%(uuid1)s
+RELATED-TO;RELTYPE=X-CALENDARSERVER-RECURRENCE-SET:%(relID)s
+RRULE:FREQ=DAILY
+SEQUENCE:1
+SUMMARY:INVITE_VALID_ORGANIZER_ICS
+END:VEVENT
+END:VCALENDAR
+&quot;&quot;&quot;.replace(&quot;\n&quot;, &quot;\r\n&quot;)
+
+    # Valid organizer
+    VALID_ORGANIZER_PAST_ICS = &quot;&quot;&quot;BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//Apple Inc.//iCal 4.0.1//EN
+BEGIN:VEVENT
+UID:%(relID)s
+DTSTART:%(now)s
+DURATION:PT1H
+ATTENDEE:urn:uuid:%(uuid1)s
+ATTENDEE:urn:uuid:%(uuid2)s
+ORGANIZER:urn:uuid:%(uuid1)s
+RELATED-TO;RELTYPE=X-CALENDARSERVER-RECURRENCE-SET:%(relID)s
+RRULE:FREQ=DAILY;UNTIL=%(now_fwd11_1)s
+SEQUENCE:1
+SUMMARY:INVITE_VALID_ORGANIZER_ICS
+END:VEVENT
+END:VCALENDAR
+&quot;&quot;&quot;.replace(&quot;\n&quot;, &quot;\r\n&quot;)
+
+    # Valid attendee
+    VALID_ATTENDEE_PAST_ICS = &quot;&quot;&quot;BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//Apple Inc.//iCal 4.0.1//EN
+BEGIN:VEVENT
+UID:%(relID)s
+DTSTART:%(now)s
+DURATION:PT1H
+ATTENDEE:urn:uuid:%(uuid1)s
+ATTENDEE:urn:uuid:%(uuid2)s
+ORGANIZER:urn:uuid:%(uuid1)s
+RELATED-TO;RELTYPE=X-CALENDARSERVER-RECURRENCE-SET:%(relID)s
+RRULE:FREQ=DAILY;UNTIL=%(now_fwd11_1)s
+SEQUENCE:1
+SUMMARY:INVITE_VALID_ORGANIZER_ICS
+END:VEVENT
+END:VCALENDAR
+&quot;&quot;&quot;.replace(&quot;\n&quot;, &quot;\r\n&quot;)
+
+    # Valid organizer
+    VALID_ORGANIZER_OVERRIDE_ICS = &quot;&quot;&quot;BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//Apple Inc.//iCal 4.0.1//EN
+BEGIN:VEVENT
+UID:VALID_ORGANIZER_OVERRIDE_ICS
+DTSTART:%(now)s
+DURATION:PT1H
+ATTENDEE:urn:uuid:%(uuid1)s
+ATTENDEE:urn:uuid:%(uuid2)s
+ORGANIZER:urn:uuid:%(uuid1)s
+RRULE:FREQ=DAILY
+SUMMARY:INVITE_VALID_ORGANIZER_ICS
+END:VEVENT
+BEGIN:VEVENT
+UID:VALID_ORGANIZER_OVERRIDE_ICS
+RECURRENCE-ID:%(now_fwd11)s
+DTSTART:%(now_fwd11)s
+DURATION:PT2H
+ATTENDEE:urn:uuid:%(uuid1)s
+ATTENDEE:urn:uuid:%(uuid2)s
+ORGANIZER:urn:uuid:%(uuid1)s
+RRULE:FREQ=DAILY
+SUMMARY:INVITE_VALID_ORGANIZER_ICS
+END:VEVENT
+END:VCALENDAR
+&quot;&quot;&quot;.replace(&quot;\n&quot;, &quot;\r\n&quot;)
+
+    @inlineCallbacks
+    def setUp(self):
+
+        self.subs = {
+            &quot;uuid1&quot; : CalVerifyMismatchTestsBase.uuid1,
+            &quot;uuid2&quot; : CalVerifyMismatchTestsBase.uuid2,
+        }
+
+        self.now = PyCalendarDateTime.getNowUTC()
+        self.now.setHHMMSS(0, 0, 0)
+
+        self.subs[&quot;now&quot;] = self.now
+
+        for i in range(30):
+            attrname = &quot;now_back%s&quot; % (i + 1,)
+            setattr(self, attrname, self.now.duplicate())
+            getattr(self, attrname).offsetDay(-(i + 1))
+            self.subs[attrname] = getattr(self, attrname)
+
+            attrname_12h = &quot;now_back%s_12h&quot; % (i + 1,)
+            setattr(self, attrname_12h, getattr(self, attrname).duplicate())
+            getattr(self, attrname_12h).offsetHours(12)
+            self.subs[attrname_12h] = getattr(self, attrname_12h)
+
+            attrname_1 = &quot;now_back%s_1&quot; % (i + 1,)
+            setattr(self, attrname_1, getattr(self, attrname).duplicate())
+            getattr(self, attrname_1).offsetSeconds(-1)
+            self.subs[attrname_1] = getattr(self, attrname_1)
+
+        for i in range(30):
+            attrname = &quot;now_fwd%s&quot; % (i + 1,)
+            setattr(self, attrname, self.now.duplicate())
+            getattr(self, attrname).offsetDay(i + 1)
+            self.subs[attrname] = getattr(self, attrname)
+
+            attrname_12h = &quot;now_fwd%s_12h&quot; % (i + 1,)
+            setattr(self, attrname_12h, getattr(self, attrname).duplicate())
+            getattr(self, attrname_12h).offsetHours(12)
+            self.subs[attrname_12h] = getattr(self, attrname_12h)
+
+            attrname_1 = &quot;now_fwd%s_1&quot; % (i + 1,)
+            setattr(self, attrname_1, getattr(self, attrname).duplicate())
+            getattr(self, attrname_1).offsetSeconds(-1)
+            self.subs[attrname_1] = getattr(self, attrname_1)
+
+        self.requirements = {
+            CalVerifyMismatchTestsBase.uuid1 : {
+                &quot;calendar&quot; : {
+                    &quot;invite1.ics&quot; : (self.NO_ORGANIZER_ICS % self.subs, CalVerifyMismatchTestsBase.metadata,),
+                    &quot;invite2.ics&quot; : (self.VALID_ORGANIZER_ICS % self.subs, CalVerifyMismatchTestsBase.metadata,),
+                    &quot;invite3.ics&quot; : (self.VALID_ORGANIZER_OVERRIDE_ICS % self.subs, CalVerifyMismatchTestsBase.metadata,),
+                },
+                &quot;inbox&quot; : {},
+            },
+            CalVerifyMismatchTestsBase.uuid2 : {
+                &quot;calendar&quot; : {
+                    &quot;invite2a.ics&quot; : (self.VALID_ATTENDEE_ICS % self.subs, CalVerifyMismatchTestsBase.metadata,),
+                },
+                &quot;inbox&quot; : {},
+            },
+            CalVerifyMismatchTestsBase.uuid3 : {
+                &quot;calendar&quot; : {},
+                &quot;inbox&quot; : {},
+            },
+            CalVerifyMismatchTestsBase.uuidl1 : {
+                &quot;calendar&quot; : {},
+                &quot;inbox&quot; : {},
+            },
+        }
+
+        yield super(CalVerifyEventPurge, self).setUp()
+
+
+    @inlineCallbacks
+    def test_validSplit(self):
+        &quot;&quot;&quot;
+        CalVerifyService.doScan without fix for dark events. Make sure it detects
+        as much as it can. Make sure sync-token is not changed.
+        &quot;&quot;&quot;
+
+        options = {
+            &quot;nuke&quot;: False,
+            &quot;missing&quot;: False,
+            &quot;ical&quot;: False,
+            &quot;mismatch&quot;: False,
+            &quot;double&quot;: True,
+            &quot;dark-purge&quot;: False,
+            &quot;split&quot;: True,
+            &quot;path&quot;: &quot;/calendars/__uids__/%(uuid1)s/calendar/invite2.ics&quot; % self.subs,
+            &quot;rid&quot;: &quot;%(now_fwd11)s&quot; % self.subs,
+            &quot;summary&quot;: False,
+        }
+        output = StringIO()
+        calverify = EventSplitService(self._sqlCalendarStore, options, output, reactor, config)
+        oldUID = yield calverify.doAction()
+
+        relsubs = dict(self.subs)
+        relsubs[&quot;relID&quot;] = oldUID
+
+        calendar = yield self.calendarUnderTest(home=CalVerifyMismatchTestsBase.uuid1, name=&quot;calendar&quot;)
+        objs = yield calendar.listObjectResources()
+        self.assertEqual(len(objs), 4)
+        self.assertTrue(&quot;invite2.ics&quot; in objs)
+        oldName = filter(lambda x: not x.startswith(&quot;invite&quot;), objs)[0]
+
+        obj1 = yield calendar.objectResourceWithName(&quot;invite2.ics&quot;)
+        ical1 = yield obj1.component()
+        self.assertEqual(normalize_iCalStr(ical1), self.VALID_ORGANIZER_FUTURE_ICS % relsubs)
+
+        obj2 = yield calendar.objectResourceWithName(oldName)
+        ical2 = yield obj2.component()
+        self.assertEqual(normalize_iCalStr(ical2), self.VALID_ORGANIZER_PAST_ICS % relsubs)
+
+        calendar = yield self.calendarUnderTest(home=CalVerifyMismatchTestsBase.uuid2, name=&quot;calendar&quot;)
+        objs = yield calendar.listObjectResources()
+        self.assertEqual(len(objs), 2)
+        self.assertTrue(&quot;invite2a.ics&quot; in objs)
+        oldName = filter(lambda x: not x.startswith(&quot;invite&quot;), objs)[0]
+
+        obj1 = yield calendar.objectResourceWithName(&quot;invite2a.ics&quot;)
+        ical1 = yield obj1.component()
+        self.assertEqual(normalize_iCalStr(ical1), self.VALID_ATTENDEE_FUTURE_ICS % relsubs)
+
+        obj2 = yield calendar.objectResourceWithName(oldName)
+        ical2 = yield obj2.component()
+        self.assertEqual(normalize_iCalStr(ical2), self.VALID_ATTENDEE_PAST_ICS % relsubs)
+
+
+    @inlineCallbacks
+    def test_summary(self):
+        &quot;&quot;&quot;
+        CalVerifyService.doScan without fix for dark events. Make sure it detects
+        as much as it can. Make sure sync-token is not changed.
+        &quot;&quot;&quot;
+
+        options = {
+            &quot;nuke&quot;: False,
+            &quot;missing&quot;: False,
+            &quot;ical&quot;: False,
+            &quot;mismatch&quot;: False,
+            &quot;double&quot;: True,
+            &quot;dark-purge&quot;: False,
+            &quot;split&quot;: True,
+            &quot;path&quot;: &quot;/calendars/__uids__/%(uuid1)s/calendar/invite3.ics&quot; % self.subs,
+            &quot;rid&quot;: &quot;%(now_fwd11)s&quot; % self.subs,
+            &quot;summary&quot;: True,
+        }
+        output = StringIO()
+        calverify = EventSplitService(self._sqlCalendarStore, options, output, reactor, config)
+        yield calverify.doAction()
+        result = output.getvalue().splitlines()
+        self.assertTrue(&quot;%(now)s&quot; % self.subs in result)
+        self.assertTrue(&quot;%(now_fwd10)s&quot; % self.subs in result)
+        self.assertTrue(&quot;%(now_fwd11)s *&quot; % self.subs in result)
+        self.assertTrue(&quot;%(now_fwd12)s&quot; % self.subs in result)
</ins></span></pre></div>
<a id="CalendarServerbranchesreleaseCalendarServer52devtwistedcaldavicalpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/release/CalendarServer-5.2-dev/twistedcaldav/ical.py (12244 => 12245)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/release/CalendarServer-5.2-dev/twistedcaldav/ical.py        2014-01-06 23:22:43 UTC (rev 12244)
+++ CalendarServer/branches/release/CalendarServer-5.2-dev/twistedcaldav/ical.py        2014-01-07 00:29:48 UTC (rev 12245)
</span><span class="lines">@@ -3533,7 +3533,7 @@
</span><span class="cx">     icalstr = str(icalstr).replace(&quot;\r\n &quot;, &quot;&quot;)
</span><span class="cx">     icalstr = icalstr.replace(&quot;\n &quot;, &quot;&quot;)
</span><span class="cx">     icalstr = &quot;\r\n&quot;.join([line for line in icalstr.splitlines() if not line.startswith(&quot;DTSTAMP&quot;)])
</span><del>-    return icalstr
</del><ins>+    return icalstr + &quot;\r\n&quot;
</ins><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> 
</span></span></pre></div>
<a id="CalendarServerbranchesreleaseCalendarServer52devtxdavcaldavdatastoreschedulingicalsplitterpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/release/CalendarServer-5.2-dev/txdav/caldav/datastore/scheduling/icalsplitter.py (12244 => 12245)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/release/CalendarServer-5.2-dev/txdav/caldav/datastore/scheduling/icalsplitter.py        2014-01-06 23:22:43 UTC (rev 12244)
+++ CalendarServer/branches/release/CalendarServer-5.2-dev/txdav/caldav/datastore/scheduling/icalsplitter.py        2014-01-07 00:29:48 UTC (rev 12245)
</span><span class="lines">@@ -83,17 +83,21 @@
</span><span class="cx">         return len(str(ical)) &gt; self.threshold
</span><span class="cx"> 
</span><span class="cx"> 
</span><del>-    def whereSplit(self, ical):
</del><ins>+    def whereSplit(self, ical, break_point=None, allow_past_the_end=True):
</ins><span class="cx">         &quot;&quot;&quot;
</span><span class="cx">         Determine where a split is going to happen - i.e., the RECURRENCE-ID.
</span><span class="cx"> 
</span><span class="cx">         @param ical: the iCalendar object to test
</span><span class="cx">         @type ical: L{Component}
</span><ins>+        @param break_point: the date-time where the break should occur
+        @type break_point: L{DateTime}
</ins><span class="cx"> 
</span><span class="cx">         @return: recurrence-id of the split
</span><span class="cx">         @rtype: L{PyCalendarDateTime}
</span><span class="cx">         &quot;&quot;&quot;
</span><span class="cx"> 
</span><ins>+        break_point = self.past if break_point is None else break_point
+
</ins><span class="cx">         # Find the instance RECURRENCE-ID where a split is going to happen
</span><span class="cx">         now = self.now.duplicate()
</span><span class="cx">         now.offsetDay(1)
</span><span class="lines">@@ -102,13 +106,13 @@
</span><span class="cx">         rid = instances[0].rid
</span><span class="cx">         for instance in instances:
</span><span class="cx">             rid = instance.rid
</span><del>-            if instance.start &gt;= self.past:
</del><ins>+            if instance.start &gt;= break_point:
</ins><span class="cx">                 break
</span><span class="cx">         else:
</span><del>-            # We can get here when splitting and event for overrides only in the past,
</del><ins>+            # We can get here when splitting an event for overrides only in the past,
</ins><span class="cx">             # which happens when splitting an Attendee's copy of an Organizer event
</span><span class="cx">             # where the Organizer event has L{willSplit} == C{True}
</span><del>-            rid = self.past
</del><ins>+            rid = break_point if allow_past_the_end else None
</ins><span class="cx"> 
</span><span class="cx">         return rid
</span><span class="cx"> 
</span></span></pre></div>
<a id="CalendarServerbranchesreleaseCalendarServer52devtxdavcaldavdatastoreschedulingtesttest_icalsplitterpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/release/CalendarServer-5.2-dev/txdav/caldav/datastore/scheduling/test/test_icalsplitter.py (12244 => 12245)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/release/CalendarServer-5.2-dev/txdav/caldav/datastore/scheduling/test/test_icalsplitter.py        2014-01-06 23:22:43 UTC (rev 12244)
+++ CalendarServer/branches/release/CalendarServer-5.2-dev/txdav/caldav/datastore/scheduling/test/test_icalsplitter.py        2014-01-07 00:29:48 UTC (rev 12245)
</span><span class="lines">@@ -63,6 +63,11 @@
</span><span class="cx">             getattr(self, attrname_12h).offsetHours(12)
</span><span class="cx">             self.subs[attrname_12h] = getattr(self, attrname_12h)
</span><span class="cx"> 
</span><ins>+            attrname_1 = &quot;now_fwd%s_1&quot; % (i + 1,)
+            setattr(self, attrname_1, getattr(self, attrname).duplicate())
+            getattr(self, attrname_1).offsetSeconds(-1)
+            self.subs[attrname_1] = getattr(self, attrname_1)
+
</ins><span class="cx">         self.patch(config, &quot;MaxAllowedInstances&quot;, 500)
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="lines">@@ -2018,3 +2023,188 @@
</span><span class="cx">             # Make sure new items won't split again
</span><span class="cx">             self.assertFalse(splitter.willSplit(icalNew), &quot;Failed future will split: %s&quot; % (title,))
</span><span class="cx">             self.assertFalse(splitter.willSplit(icalOld), &quot;Failed past will split: %s&quot; % (title,))
</span><ins>+
+
+    def test_future_split(self):
+
+        data = (
+            (
+                &quot;1.1 - RRULE with override&quot;,
+                &quot;&quot;&quot;BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:12345-67890
+DTSTART:%(now)s
+DURATION:PT1H
+ATTENDEE:mailto:user1@example.com
+ATTENDEE:mailto:user2@example.com
+ATTENDEE:mailto:user3@example.com
+ATTENDEE:mailto:user4@example.com
+ATTENDEE:mailto:user5@example.com
+ATTENDEE:mailto:user6@example.com
+ATTENDEE:mailto:user7@example.com
+ATTENDEE:mailto:user8@example.com
+ATTENDEE:mailto:user9@example.com
+ATTENDEE:mailto:user10@example.com
+ATTENDEE:mailto:user11@example.com
+ATTENDEE:mailto:user12@example.com
+ATTENDEE:mailto:user13@example.com
+ATTENDEE:mailto:user14@example.com
+ATTENDEE:mailto:user15@example.com
+ATTENDEE:mailto:user16@example.com
+ATTENDEE:mailto:user17@example.com
+ATTENDEE:mailto:user18@example.com
+ATTENDEE:mailto:user19@example.com
+ATTENDEE:mailto:user20@example.com
+ATTENDEE:mailto:user21@example.com
+ATTENDEE:mailto:user22@example.com
+ATTENDEE:mailto:user23@example.com
+ATTENDEE:mailto:user24@example.com
+ATTENDEE:mailto:user25@example.com
+ORGANIZER:mailto:user1@example.com
+RRULE:FREQ=DAILY
+END:VEVENT
+BEGIN:VEVENT
+UID:12345-67890
+RECURRENCE-ID:%(now_fwd10)s
+DTSTART:%(now_fwd10)s
+DURATION:PT1H
+ATTENDEE:mailto:user1@example.com
+ATTENDEE:mailto:user2@example.com
+ORGANIZER:mailto:user1@example.com
+END:VEVENT
+BEGIN:VEVENT
+UID:12345-67890
+RECURRENCE-ID:%(now_fwd11)s
+DTSTART:%(now_fwd11)s
+DURATION:PT1H
+ATTENDEE:mailto:user1@example.com
+ATTENDEE:mailto:user2@example.com
+ORGANIZER:mailto:user1@example.com
+END:VEVENT
+END:VCALENDAR
+&quot;&quot;&quot;,
+                &quot;&quot;&quot;BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:12345-67890
+DTSTART:%(now_fwd11)s
+DURATION:PT1H
+ATTENDEE:mailto:user1@example.com
+ATTENDEE:mailto:user2@example.com
+ATTENDEE:mailto:user3@example.com
+ATTENDEE:mailto:user4@example.com
+ATTENDEE:mailto:user5@example.com
+ATTENDEE:mailto:user6@example.com
+ATTENDEE:mailto:user7@example.com
+ATTENDEE:mailto:user8@example.com
+ATTENDEE:mailto:user9@example.com
+ATTENDEE:mailto:user10@example.com
+ATTENDEE:mailto:user11@example.com
+ATTENDEE:mailto:user12@example.com
+ATTENDEE:mailto:user13@example.com
+ATTENDEE:mailto:user14@example.com
+ATTENDEE:mailto:user15@example.com
+ATTENDEE:mailto:user16@example.com
+ATTENDEE:mailto:user17@example.com
+ATTENDEE:mailto:user18@example.com
+ATTENDEE:mailto:user19@example.com
+ATTENDEE:mailto:user20@example.com
+ATTENDEE:mailto:user21@example.com
+ATTENDEE:mailto:user22@example.com
+ATTENDEE:mailto:user23@example.com
+ATTENDEE:mailto:user24@example.com
+ATTENDEE:mailto:user25@example.com
+ORGANIZER:mailto:user1@example.com
+RELATED-TO;RELTYPE=X-CALENDARSERVER-RECURRENCE-SET:%(relID)s
+RRULE:FREQ=DAILY
+END:VEVENT
+BEGIN:VEVENT
+UID:12345-67890
+RECURRENCE-ID:%(now_fwd11)s
+DTSTART:%(now_fwd11)s
+DURATION:PT1H
+ATTENDEE:mailto:user1@example.com
+ATTENDEE:mailto:user2@example.com
+ORGANIZER:mailto:user1@example.com
+RELATED-TO;RELTYPE=X-CALENDARSERVER-RECURRENCE-SET:%(relID)s
+END:VEVENT
+END:VCALENDAR
+&quot;&quot;&quot;,
+                &quot;&quot;&quot;BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:%(relID)s
+DTSTART:%(now)s
+DURATION:PT1H
+ATTENDEE:mailto:user1@example.com
+ATTENDEE:mailto:user2@example.com
+ATTENDEE:mailto:user3@example.com
+ATTENDEE:mailto:user4@example.com
+ATTENDEE:mailto:user5@example.com
+ATTENDEE:mailto:user6@example.com
+ATTENDEE:mailto:user7@example.com
+ATTENDEE:mailto:user8@example.com
+ATTENDEE:mailto:user9@example.com
+ATTENDEE:mailto:user10@example.com
+ATTENDEE:mailto:user11@example.com
+ATTENDEE:mailto:user12@example.com
+ATTENDEE:mailto:user13@example.com
+ATTENDEE:mailto:user14@example.com
+ATTENDEE:mailto:user15@example.com
+ATTENDEE:mailto:user16@example.com
+ATTENDEE:mailto:user17@example.com
+ATTENDEE:mailto:user18@example.com
+ATTENDEE:mailto:user19@example.com
+ATTENDEE:mailto:user20@example.com
+ATTENDEE:mailto:user21@example.com
+ATTENDEE:mailto:user22@example.com
+ATTENDEE:mailto:user23@example.com
+ATTENDEE:mailto:user24@example.com
+ATTENDEE:mailto:user25@example.com
+ORGANIZER:mailto:user1@example.com
+RELATED-TO;RELTYPE=X-CALENDARSERVER-RECURRENCE-SET:%(relID)s
+RRULE:FREQ=DAILY;UNTIL=%(now_fwd11_1)s
+END:VEVENT
+BEGIN:VEVENT
+UID:%(relID)s
+RECURRENCE-ID:%(now_fwd10)s
+DTSTART:%(now_fwd10)s
+DURATION:PT1H
+ATTENDEE:mailto:user1@example.com
+ATTENDEE:mailto:user2@example.com
+ORGANIZER:mailto:user1@example.com
+RELATED-TO;RELTYPE=X-CALENDARSERVER-RECURRENCE-SET:%(relID)s
+END:VEVENT
+END:VCALENDAR
+&quot;&quot;&quot;,
+            ),
+        )
+
+        for title, calendar, split_future, split_past in data:
+            ical = Component.fromString(calendar % self.subs)
+            splitter = iCalSplitter(1024, 14)
+            icalOld, icalNew = splitter.split(ical, rid=PyCalendarDateTime.parseText(&quot;%(now_fwd11)s&quot; % self.subs))
+            relsubs = dict(self.subs)
+            relsubs[&quot;relID&quot;] = icalOld.resourceUID()
+            self.assertEqual(str(icalNew).replace(&quot;\r\n &quot;, &quot;&quot;), split_future.replace(&quot;\n&quot;, &quot;\r\n&quot;) % relsubs, &quot;Failed future: %s&quot; % (title,))
+            self.assertEqual(str(icalOld).replace(&quot;\r\n &quot;, &quot;&quot;), split_past.replace(&quot;\n&quot;, &quot;\r\n&quot;) % relsubs, &quot;Failed past: %s&quot; % (title,))
+
+            # Make sure new items won't split again
+            self.assertFalse(splitter.willSplit(icalNew), &quot;Failed future will split: %s&quot; % (title,))
+            self.assertFalse(splitter.willSplit(icalOld), &quot;Failed past will split: %s&quot; % (title,))
+
+            ical = Component.fromString(calendar % self.subs)
+            splitter = iCalSplitter(1024, 14)
+            icalOld, icalNew = splitter.split(ical, rid=splitter.whereSplit(ical, break_point=PyCalendarDateTime.parseText(&quot;%(now_fwd10_12h)s&quot; % self.subs)))
+            relsubs = dict(self.subs)
+            relsubs[&quot;relID&quot;] = icalOld.resourceUID()
+            self.assertEqual(str(icalNew).replace(&quot;\r\n &quot;, &quot;&quot;), split_future.replace(&quot;\n&quot;, &quot;\r\n&quot;) % relsubs, &quot;Failed future: %s&quot; % (title,))
+            self.assertEqual(str(icalOld).replace(&quot;\r\n &quot;, &quot;&quot;), split_past.replace(&quot;\n&quot;, &quot;\r\n&quot;) % relsubs, &quot;Failed past: %s&quot; % (title,))
+
+            # Make sure new items won't split again
+            self.assertFalse(splitter.willSplit(icalNew), &quot;Failed future will split: %s&quot; % (title,))
+            self.assertFalse(splitter.willSplit(icalOld), &quot;Failed past will split: %s&quot; % (title,))
</ins></span></pre></div>
<a id="CalendarServerbranchesreleaseCalendarServer52devtxdavcaldavdatastoresqlpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/release/CalendarServer-5.2-dev/txdav/caldav/datastore/sql.py (12244 => 12245)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/release/CalendarServer-5.2-dev/txdav/caldav/datastore/sql.py        2014-01-06 23:22:43 UTC (rev 12244)
+++ CalendarServer/branches/release/CalendarServer-5.2-dev/txdav/caldav/datastore/sql.py        2014-01-07 00:29:48 UTC (rev 12245)
</span><span class="lines">@@ -358,7 +358,7 @@
</span><span class="cx">     @inlineCallbacks
</span><span class="cx">     def calendarObjectWithID(self, txn, rid):
</span><span class="cx">         &quot;&quot;&quot;
</span><del>-        Return all child object resources with the specified UID. Only &quot;owned&quot; resources are returned,
</del><ins>+        Return all child object resources with the specified resource id. Only &quot;owned&quot; resources are returned,
</ins><span class="cx">         no shared resources.
</span><span class="cx"> 
</span><span class="cx">         @param txn: transaction to use
</span><span class="lines">@@ -370,7 +370,7 @@
</span><span class="cx">         @rtype: L{CalendarObject} or C{None}
</span><span class="cx">         &quot;&quot;&quot;
</span><span class="cx"> 
</span><del>-        # First find the resource-ids of the (home, parent, object) for each object matching the UID.
</del><ins>+        # First find the resource-ids of the (home, parent, object) for each object matching the resource id.
</ins><span class="cx">         obj = CalendarHome._objectSchema
</span><span class="cx">         bind = CalendarHome._bindSchema
</span><span class="cx">         rows = (yield Select(
</span><span class="lines">@@ -3331,6 +3331,8 @@
</span><span class="cx">             if will:
</span><span class="cx">                 notBefore = datetime.datetime.utcnow() + datetime.timedelta(seconds=config.Scheduling.Options.Splitting.Delay)
</span><span class="cx">                 work = (yield self._txn.enqueue(CalendarObject.CalendarObjectSplitterWork, resourceID=self._resourceID, notBefore=notBefore))
</span><ins>+
+                # _workItems is used during unit testing only, to track the created work
</ins><span class="cx">                 if not hasattr(self, &quot;_workItems&quot;):
</span><span class="cx">                     self._workItems = []
</span><span class="cx">                 self._workItems.append(work)
</span></span></pre>
</div>
</div>

</body>
</html>