[Zope3-checkins] CVS: Zope3/utilities/fssync - sync.py:1.4

Guido van Rossum guido@python.org
Mon, 5 May 2003 18:09:04 -0400


Update of /cvs-repository/Zope3/utilities/fssync
In directory cvs.zope.org:/tmp/cvs-serv5456

Modified Files:
	sync.py 
Log Message:
Make sure -h/--help is processed before the check for missing
operation.


=== Zope3/utilities/fssync/sync.py 1.3 => 1.4 ===
--- Zope3/utilities/fssync/sync.py:1.3	Mon May  5 16:47:56 2003
+++ Zope3/utilities/fssync/sync.py	Mon May  5 18:09:04 2003
@@ -58,20 +58,6 @@
     if not opts and not args:
         return usage()
 
-    if not args:
-        return usage("no command specified")
-
-    known_operations = ['checkout', 'update', 'add', 'addtypes', 'diff',
-                        'commit', 'fcommit']
-
-    operation = args[0]
-    if operation not in known_operations:
-        return usage("command %r is not a known operation" % operation)
-
-    newobjectname = args[1:]
-    if newobjectname and operation != 'add':
-        return usage("only command 'add' takes arguments")
-
     objpath = ''
     targetfile = ''
     diffoption = '-1'
@@ -116,6 +102,20 @@
     siteconfpath = os.path.realpath(siteconfpath)
     if patherror("siteconfpath(site.zcml)", siteconfpath):
         return 1
+
+    if not args:
+        return usage("no command specified")
+
+    known_operations = ['checkout', 'update', 'add', 'addtypes', 'diff',
+                        'commit', 'fcommit']
+
+    operation = args[0]
+    if operation not in known_operations:
+        return usage("command %r is not a known operation" % operation)
+
+    newobjectname = args[1:]
+    if newobjectname and operation != 'add':
+        return usage("only command 'add' takes arguments")
 
     if operation == 'checkout':
         err = checkout(fspath, dbpath, siteconfpath, objpath)