[Checkins] SVN: zope.app.fssync/branches/jim-hack/src/zope/app/fssync/ Added -v --verbose switches to status command. Status now defaults to

Amos Latteier amos at latteier.com
Tue Mar 10 16:11:13 EDT 2009


Log message for revision 97818:
  Added -v --verbose switches to status command. Status now defaults to 
  not verbose.
  

Changed:
  U   zope.app.fssync/branches/jim-hack/src/zope/app/fssync/fssync.py
  U   zope.app.fssync/branches/jim-hack/src/zope/app/fssync/fssync.txt
  U   zope.app.fssync/branches/jim-hack/src/zope/app/fssync/main.py

-=-
Modified: zope.app.fssync/branches/jim-hack/src/zope/app/fssync/fssync.py
===================================================================
--- zope.app.fssync/branches/jim-hack/src/zope/app/fssync/fssync.py	2009-03-10 20:09:04 UTC (rev 97817)
+++ zope.app.fssync/branches/jim-hack/src/zope/app/fssync/fssync.py	2009-03-10 20:11:13 UTC (rev 97818)
@@ -711,7 +711,7 @@
         self.metadata.flush()
         print "R", path
 
-    def status(self, target, descend_only=False):
+    def status(self, target, descend_only=False, verbose=True):
         entry = self.metadata.getentry(target)
         flag = entry.get("flag")
         if isfile(target):
@@ -726,7 +726,8 @@
                 original = fsutil.getoriginal(target)
                 if isfile(original):
                     if filecmp.cmp(target, original):
-                        print "=", target
+                        if verbose:
+                            print "=", target
                     else:
                         print "M", target
                 else:
@@ -740,7 +741,7 @@
                 print "A", pname
             elif flag == "removed":
                 print "R(reborn)", pname
-            else:
+            elif verbose:
                 print "/", pname
             if entry:
                 # Recurse down the directory
@@ -755,7 +756,8 @@
                 ncnames = namesdir.keys()
                 ncnames.sort()
                 for ncname in ncnames:
-                    self.status(join(target, namesdir[ncname]))
+                    self.status(join(target, namesdir[ncname]),
+                                verbose=verbose)
         elif exists(target):
             if not entry:
                 if not self.fsmerger.ignore(target):
@@ -775,10 +777,10 @@
                 print "lost", target
         annotations = fsutil.getannotations(target)
         if isdir(annotations):
-            self.status(annotations, True)
+            self.status(annotations, True, verbose=verbose)
         extra = fsutil.getextra(target)
         if isdir(extra):
-            self.status(extra, True)
+            self.status(extra, True, verbose=verbose)
 
 def quote(s):
     """Helper to put quotes around arguments passed to shell if necessary."""

Modified: zope.app.fssync/branches/jim-hack/src/zope/app/fssync/fssync.txt
===================================================================
--- zope.app.fssync/branches/jim-hack/src/zope/app/fssync/fssync.txt	2009-03-10 20:09:04 UTC (rev 97817)
+++ zope.app.fssync/branches/jim-hack/src/zope/app/fssync/fssync.txt	2009-03-10 20:11:13 UTC (rev 97818)
@@ -199,6 +199,11 @@
     M .../test/file1.txt
     = .../test/file2.txt
 
+You can also turn off verbose mode to have it only list interesting lines.
+
+    >>> zsync.status(localdir, verbose=False)
+    M .../test/file1.txt
+
 If we want to add a file to the repository we must update the local
 list of entries by calling the add command explicitely:
 

Modified: zope.app.fssync/branches/jim-hack/src/zope/app/fssync/main.py
===================================================================
--- zope.app.fssync/branches/jim-hack/src/zope/app/fssync/main.py	2009-03-10 20:09:04 UTC (rev 97817)
+++ zope.app.fssync/branches/jim-hack/src/zope/app/fssync/main.py	2009-03-10 20:11:13 UTC (rev 97818)
@@ -28,7 +28,7 @@
 %(program)s remove [options] TARGET ...
 %(program)s resolve PATH ...
 %(program)s revert PATH ...
-%(program)s status [TARGET ...]
+%(program)s status [options] [TARGET ...]
 %(program)s update [TARGET ...]
 
 ``%(program)s help'' prints the global help (this message)
@@ -254,13 +254,20 @@
     fs.multiple(args, fs.diff, mode, diffopts, need_original)
 
 def status(opts, args):
-    """%(program)s status [TARGET ...]
+    """%(program)s status [-v] [--verbose] [TARGET ...]
 
     Print brief (local) status for each target, without changing any
     files or contacting the Zope server.
+
+    If the -v or --verbose switches are provided, prints a complete
+    list of local files regardless of their status.
     """
+    verbose = False
+    for o, a in opts:
+        if o in ('-v', '--verbose'):
+            verbose = True
     fs = FSSync()
-    fs.multiple(args, fs.status)
+    fs.multiple(args, fs.status, False, verbose)
 
 def checkin(opts, args):
     """%(program)s checkin [-m message] URL [TARGETDIR]
@@ -405,6 +412,6 @@
     (remove,   "del delete rm", "",     ""),
     (resolve,  "resolved","",           ""),
     (revert,   "",        "",           ""),
-    (status,   "stat st", "",           ""),
+    (status,   "stat st", "v",          "verbose"),
     (update,   "up",      "",           ""),
     ]



More information about the Checkins mailing list