[Zope3-checkins] CVS: Zope3/src/zope/fssync - main.py:1.15

Guido van Rossum guido@python.org
Thu, 15 May 2003 18:22:59 -0400


Update of /cvs-repository/Zope3/src/zope/fssync
In directory cvs.zope.org:/tmp/cvs-serv13517

Modified Files:
	main.py 
Log Message:
Support for adding a commit note (default 'fssync').

Changed multiple() to support passing arbitrary extra arguments.


=== Zope3/src/zope/fssync/main.py 1.14 => 1.15 ===
--- Zope3/src/zope/fssync/main.py:1.14	Thu May 15 11:32:23 2003
+++ Zope3/src/zope/fssync/main.py	Thu May 15 18:22:58 2003
@@ -24,10 +24,6 @@
 fssync [global_options] add [local_options] TARGET ...
 fssync [global_options] remove [local_options] TARGET ...
 
-For now, the only option (local as well as global) is -h or --help;
-there are no other options yet except for diff, which supports a small
-subset of the options of GNU diff as local options.
-
 ``fssync -h'' prints the global help (this message)
 ``fssync command -h'' prints the local help for the command
 """
@@ -162,7 +158,7 @@
     fs.checkout(target)
 
 def commit(opts, args):
-    """fssync commit [TARGET ...]
+    """fssync commit [-m message] [TARGET ...]
 
     Commit the TARGET files or directories to the Zope 3 server
     identified by the checkout command.  TARGET defaults to the
@@ -171,9 +167,16 @@
     3 server; if not, a detailed error message will be printed, and
     you should use the update command to bring your working directory
     in sync with the server.
+
+    The -m option specifies a message to label the transaction.
+    The default message is 'fssync'.
     """
+    message = "fssync"
+    for o, a in opts:
+        if o in ("-m", "--message"):
+            message = a
     fs = FSSync()
-    fs.multiple(args, fs.commit)
+    fs.multiple(args, fs.commit, message)
 
 def update(opts, args):
     """fssync update [TARGET ...]
@@ -241,9 +244,7 @@
                 diffopts.append(o)
     diffopts = " ".join(diffopts)
     fs = FSSync()
-    def calldiff(arg):
-        fs.diff(arg, mode, diffopts)
-    fs.multiple(args, calldiff)
+    fs.multiple(args, fs.diff, mode, diffopts)
 
 def status(opts, args):
     """fssync status [TARGET ...]
@@ -257,7 +258,7 @@
     "checkout": ("", [], checkout),
     "co":       ("", [], checkout),
     "update":   ("", [], update),
-    "commit":   ("", [], commit),
+    "commit":   ("m:", ["message="], commit),
     "add":      ("", [], add),
     "remove":   ("", [], remove),
     "rm":       ("", [], remove),