Hi all,

Just as I was trying my hands on the scripts that we provide under the *tools* directory, I noticed that a few scripts have not implemented the *usage* functionality. So attaching a patch to implement it. Also attached the log message.





Thanks and regards
Prabhu
Index: tools/examples/check-modified.py
===================================================================
--- tools/examples/check-modified.py	(revision 1099737)
+++ tools/examples/check-modified.py	(working copy)
@@ -35,7 +35,7 @@
 FORCE_COMPARISON = 0
 
 def usage():
-  print("Usage: " + sys.argv[0] + " FILE_OR_DIR1 FILE_OR_DIR2\n")
+  print("USAGE: check-modified.py  FILE_OR_DIR1 FILE_OR_DIR2")
   sys.exit(0)
 
 def run(files):
@@ -61,5 +61,7 @@
     svn.wc.adm_close(adm_baton)
 
 if __name__ == '__main__':
+  if len(sys.argv) < 2:
+    usage()
   run(sys.argv[1:])
 
Index: tools/examples/geturl.py
===================================================================
--- tools/examples/geturl.py	(revision 1099737)
+++ tools/examples/geturl.py	(working copy)
@@ -43,5 +43,12 @@
     finally:
       svn.wc.adm_close(adm_baton)
 
+def usage():
+  print("USAGE: geturl.py file1_or_dir1 file2_or_dir2 ...")
+  sys.exit(1)
+
+
 if __name__ == '__main__':
+  if len(sys.argv) < 2:
+    usage()
   main(sys.argv[1:])
Index: tools/examples/revplist.py
===================================================================
--- tools/examples/revplist.py	(revision 1099737)
+++ tools/examples/revplist.py	(working copy)
@@ -62,8 +62,9 @@
   sys.exit(1)
 
 def main():
-  ### how to invoke usage() ?
   opts, args = my_getopt(sys.argv[1:], 'r:h:')
+  if len(sys.argv) <= 2:
+    usage()
   rev = None
   home = '.'
   for name, value in opts:
* tools/examples/check-modified.py
  invoke usage function if there are not enough args

* tools/examples/geturl.py
  (usage): newly added to show the usage of the script
  (main): invoke usage function if there are not enough args

* tools/examples/revplist.py
  (main): invoke usage function if there are not enough args




Patch by: Prabhu Gnana Sundar <prabhugs{_AT_}collab.net>

Reply via email to