[CalendarServer-changes] [11398] CalDAVClientLibrary/trunk/caldavclientlibrary/browser/commands/sync .py

source_changes at macosforge.org source_changes at macosforge.org
Tue Jun 25 06:48:14 PDT 2013


Revision: 11398
          http://trac.calendarserver.org//changeset/11398
Author:   cdaboo at apple.com
Date:     2013-06-25 06:48:14 -0700 (Tue, 25 Jun 2013)
Log Message:
-----------
Print out current sync-token. Allow a sync-token to be specified on the command line.

Modified Paths:
--------------
    CalDAVClientLibrary/trunk/caldavclientlibrary/browser/commands/sync.py

Modified: CalDAVClientLibrary/trunk/caldavclientlibrary/browser/commands/sync.py
===================================================================
--- CalDAVClientLibrary/trunk/caldavclientlibrary/browser/commands/sync.py	2013-06-25 13:47:39 UTC (rev 11397)
+++ CalDAVClientLibrary/trunk/caldavclientlibrary/browser/commands/sync.py	2013-06-25 13:48:14 UTC (rev 11398)
@@ -35,15 +35,18 @@
 
         force = False
         infinite = False
+        synctoken = None
 
-        opts, args = getopt.getopt(shlex.split(options), 'fi')
+        opts, args = getopt.getopt(shlex.split(options), 'fit:')
 
-        for name, _ignore_value in opts:
+        for name, value in opts:
 
             if name == "-f":
                 force = True
             elif name == "-i":
                 infinite = True
+            elif name == "-t":
+                synctoken = value
             else:
                 print "Unknown option: %s" % (name,)
                 print self.usage(cmdname)
@@ -62,7 +65,8 @@
         if not path.endswith("/"):
             path += "/"
         resource = URL(url=path)
-        synctoken = synctokens[0 if infinite else 1].get(path, "") if not force else ""
+        if synctoken is None:
+            synctoken = synctokens[0 if infinite else 1].get(path, "") if not force else ""
         newsyctoken, changed, removed, other = self.shell.account.session.syncCollection(resource, synctoken, infinite=infinite)
         synctokens[0 if infinite else 1][path] = newsyctoken
 
@@ -72,6 +76,8 @@
             print "Removed: %s" % (item,)
         for item in other:
             print "Error: %s" % (item,)
+        if newsyctoken:
+            print "Current token: %s" % (newsyctoken,)
         print ""
 
         return True
@@ -82,8 +88,9 @@
 PATH is a relative or absolute path.
 
 Options:
--f   force full sync
--i   depth:infinite [DEFAULT depth:1]
+-f       force full sync
+-i       depth:infinite [DEFAULT depth:1]
+-t TEXT  the token to use
 """ % (name,)
 
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20130625/f5507ac2/attachment.html>


More information about the calendarserver-changes mailing list