Sorry, don't know why the attachment was removed again. Does this
mailing list have a strict "Content-Type" filter? I'm trying
text/x-patch this time from my linux box. Type
application/octet-stream doesn't seem to pass through.

>From web interface of the mailing archive, the format of the inlined
version looks strange, and the indentation seems wrong, so here's
another way to get it:

http://pastebin.com/YWhpnZvF

On Sat, Sep 4, 2010 at 9:05 PM, Wei-Yin Chen <wyc...@video.ee.ntu.edu.tw> wrote:
>
> Hi,
>
> This patch makes trunk/contrib/client-side/svn_apply_autoprops.py take
> command line options.
> The usage would be:
> svn_apply_autoprops.py [-c config_file] [paths to process...]
>
> The -c option specifies the configuration file name, and it overrides
> the setting in environment variable SVN_CONFIG_FILENAME.
> The rest of the command line arguments are treated as paths to process.
>
> [[[
> Make svn_apply_autoprops.py take command line options.
> Option -c for svn configuration filename, and the rest for paths to process.
> ]]]
>
> Regards,
> Wei-Yin
>
--- svn_apply_autoprops.py.old	2010-09-04 20:16:28.000000000 +0800
+++ svn_apply_autoprops.py.option	2010-09-04 20:53:47.000000000 +0800
@@ -8,12 +8,10 @@
 # auto-property to a single pathname, this script will apply all
 # matching lines to a single pathname.
 #
 # To do:
 # 1) Switch to using the Subversion Python bindings.
-# 2) Allow a command line option to specify the configuration file to
-#    load the auto-properties from.
 #
 # $HeadURL$
 # $LastChangedRevision$
 # $LastChangedDate$
 # $LastChangedBy$
@@ -137,22 +135,39 @@
         print 'Command "%s" failed with exit status %s' \
               % (command, status)
         sys.exit(1)
 
 def main():
+  from optparse import OptionParser
+  op=OptionParser(usage="%prog [-c config_file] [paths to process...]")
+  op.add_option("-c",
+                dest="config_filename",action="store",help="SVN config filename.",metavar="<args>")
+  options, args = op.parse_args()
+  for p in args:
+    if not os.path.exists(p):
+      print "Path '%s' doesn't exist." % p
+      sys.exit(1)
+  paths = [p for p in args if os.path.exists(p)]
+  if not paths:
+    paths = '.'
+
   config_filename = os.path.expandvars(SVN_CONFIG_FILENAME)
+  if options.config_filename:
+    config_filename = options.config_filename
   try:
     fd = file(config_filename)
   except IOError:
     print "Cannot open svn configuration file '%s' for reading: %s" \
           % (config_filename, sys.exc_value.strerror)
+    sys.exit(1)
 
   autoprop_lines = get_autoprop_lines(fd)
 
   fd.close()
 
   autoprop_lines = process_autoprop_lines(autoprop_lines)
 
-  os.path.walk('.', filter_walk, autoprop_lines)
+  for p in paths:
+    os.path.walk(p, filter_walk, autoprop_lines)
 
 if __name__ == '__main__':
   sys.exit(main())

Reply via email to