Re: [PATCH] Support command line options in svn_apply_autoprops.py

2010-09-28 Thread Gavin Beau Baumanis
As a result of no comments for this patch , I have logged it into the issue 
tracker so that it doesn't get lost.

http://subversion.tigris.org/issue-tracker.html
Issue Number : #3723



Gavin Beau Baumanis


On 04/09/2010, at 11:43 PM, Wei-Yin Chen wrote:

 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.patch


Re: [PATCH] Support command line options in svn_apply_autoprops.py

2010-09-09 Thread Gavin Beau Baumanis
Ping. This patch has received no comments.


Gavin Beau Baumanis


On 04/09/2010, at 11:43 PM, Wei-Yin Chen wrote:

 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.patch


[PATCH] Support command line options in svn_apply_autoprops.py

2010-09-04 Thread Wei-Yin Chen
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.0 +0800
+++ svn_apply_autoprops.py.option   2010-09-04 20:53:47.0 +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())


Re: [PATCH] Support command line options in svn_apply_autoprops.py

2010-09-04 Thread Wei-Yin Chen
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.0 +0800
+++ svn_apply_autoprops.py.option	2010-09-04 20:53:47.0 +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())


Re: [PATCH] Support command line options in svn_apply_autoprops.py

2010-09-04 Thread Hyrum K. Wright
Try renaming the file as a .txt ?

-Hyrum

On Sat, Sep 4, 2010 at 8:43 AM, Wei-Yin Chen wyc...@video.ee.ntu.edu.tw wrote:
 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