[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[PATCH] Autoprop test script

From: Matthew Hambley <matthew_at_aether.demon.co.uk>
Date: 2003-10-12 14:56:34 CEST

Further to my previous post. I worked out what the problem with getting a
clean checkout was. It all boiled down to different versions of the neon
library.

So, here is a patch for the autoprop test script which I think fixes a few
bugs and oversights. (Probably introduces a few more but such is the
nature of these things)

Log message:
Various corrections and tidying up of autoprop test script.

* subversion/tests/clients/cmdline/autoprop_tests.py
  (create_config, enable_flag) Parameter is now a boolean to hide
  configuration file nature.
  (autoprops_test, cfgtype, paramtype) Parameter names and types changed in
  an attempt to reflect better their nature.

Index: subversion/tests/clients/cmdline/autoprop_tests.py
===================================================================
--- subversion/tests/clients/cmdline/autoprop_tests.py (revision 7388)
+++ subversion/tests/clients/cmdline/autoprop_tests.py (working copy)
@@ -2,9 +2,9 @@
 #
 # autoprop_tests.py: testing automatic properties
 #
-# Subversion is a tool for revision control.
+# Subversion is a tool for revision control.
 # See http://subversion.tigris.org for more information.
-#
+#
 # ====================================================================
 # Copyright (c) 2000-2003 CollabNet. All rights reserved.
 #
@@ -84,7 +84,10 @@
   # create the file 'config'
   fd = open(cfgfile_cfg, 'w')
   fd.write('[miscellany]\n')
- fd.write('enable-auto-props = ' + enable_flag + '\n')
+ if enable_flag:
+ fd.write('enable-auto-props = yes\n')
+ else:
+ fd.write('enable-auto-props = no\n')
   fd.write('\n')
   fd.write('[auto-props]\n')
   fd.write('*.c = cfile=yes\n')
@@ -113,13 +116,14 @@
 
 #----------------------------------------------------------------------
 
-def autoprops_test(sbox, cmd, cfgtype, paramtype, subdir):
+def autoprops_test(sbox, cmd, cfgenable, clienable, subdir):
   """configurable autoprops test.
- if CMD == 1 do test svn import else test svn add
- if CFGTYPE == 1 add is enabled in the config, if it is 2 import is
- enabled else both are disabled
- if PARAMTYPE == 1 --auto-props is added to the commandline, if it is
- 2 --no-auto-props is added else none is added
+ cmd : string : 'import', 'add'
+ cfgenable : boolean : indicates wether autoprops are enabled or not
+ in the configuration file
+ clienable : integer : 1 : --auto-props is added to the commandline
+ 0 : nothing is added
+ -1 : --no-auto-props is added to command line
      if string SUBDIR is not empty files are created in that subdir and the
        directory is added/imported"""
 
@@ -128,39 +132,20 @@
   tmp_dir = os.path.abspath(svntest.main.temp_dir)
   config_dir = os.path.join(tmp_dir, 'autoprops_config')
   repos_url = svntest.main.current_repo_url
+
   svntest.main.set_config_dir(config_dir)
 
- # initialize parameters
- parameters = []
+ create_config(config_dir, cfgenable)
 
   # add svn command
- if cmd == 1:
- parameters = parameters + ['import', '--username', main.wc_author,
- '--password', main.wc_passwd, '-m', 'bla']
- need_svn_up = 1
+ if cmd == 'import':
+ parameters = ['import', '--username', svntest.main.wc_author,
+ '--password', svntest.main.wc_passwd, '-m', 'bla']
     files_dir = tmp_dir
   else:
- parameters = parameters + ['add']
- need_svn_up = 0
+ parameters = ['add']
     files_dir = wc_dir
- parameters = parameters + ['--config-dir', config_dir]
 
- # set config flags
- if cfgtype == 1:
- create_config(config_dir, 'yes')
- enable_flag = 1
- else:
- create_config(config_dir, 'no')
- enable_flag = 0
-
- # add comandline flags
- if paramtype == 1:
- parameters = parameters + ['--auto-props']
- enable_flag = 1
- elif paramtype == 2:
- parameters = parameters + ['--no-auto-props']
- enable_flag = 0
-
   # setup subdirectory if needed
   if len(subdir) > 0:
     files_dir = os.path.join(files_dir, subdir)
@@ -184,29 +169,36 @@
   filenames = filenames + ['spacetest']
   create_test_file(files_dir, filenames[len(filenames)-1])
 
- if len(subdir) == 0:
- # add/import the files
- for filename in filenames:
- filename = os.path.join(files_dir, filename)
- if cmd == 1:
- tmp_params = parameters + [filename, os.path.join(repos_url, filename)]
+ # Add configuration directory to command line
+ parameters += ['--config-dir', config_dir]
+
+ # add comandline flags
+ if clienable == 1:
+ parameters += ['--auto-props']
+ elif clienable == -1:
+ parameters += ['--no-auto-props']
+
+ if len(subdir) == 0: # add/import the files
+ for leafname in filenames:
+ filename = os.path.join(files_dir, leafname)
+ if cmd == 'import':
+ tmp_params = parameters + [filename, os.path.join(repos_url, leafname)]
       else:
         tmp_params = parameters + [filename]
       svntest.main.run_svn(None, *tmp_params)
- else:
- # add/import subdirectory
- if cmd == 1:
+ else: # add/import subdirectory
+ if cmd == 'import':
       parameters = parameters + [files_dir, repos_url]
     else:
       parameters = parameters + [files_wc_dir]
     svntest.main.run_svn(None, *parameters)
 
- # do an svn up if needed
- if need_svn_up:
- svntest.main.run_svn(None, 'update')
+ # do an svn co if needed
+ if cmd == 'import':
+ svntest.main.run_svn(None, 'checkout', repos_url, files_wc_dir)
 
   # check the properties
- if enable_flag:
+ if (clienable == 1) or ((clienable == 0) and cfgenable):
     filename = os.path.join(files_wc_dir, 'foo.h' )
     check_proplist(filename,['auto'])
     check_prop('auto', filename, ['oui'])
@@ -299,7 +291,7 @@
   sbox.build()
 
   # cmd=add, config=no, commandline=no
- autoprops_test(sbox, 'add', 0, 2, '')
+ autoprops_test(sbox, 'add', 0, -1, '')
 
 #----------------------------------------------------------------------
 
@@ -310,7 +302,7 @@
   sbox.build()
 
   # cmd=add, config=yes, commandline=no
- autoprops_test(sbox, 'add', 1, 2, '')
+ autoprops_test(sbox, 'add', 1, -1, '')
 
 #----------------------------------------------------------------------
 
@@ -365,7 +357,7 @@
   sbox.build()
 
   # cmd=import, config=no, commandline=no
- autoprops_test(sbox, 'import', 0, 2, '')
+ autoprops_test(sbox, 'import', 0, -1, '')
 
 #----------------------------------------------------------------------
 
@@ -376,7 +368,7 @@
   sbox.build()
 
   # cmd=import, config=yes, commandline=no
- autoprops_test(sbox, 'import', 1, 2, '')
+ autoprops_test(sbox, 'import', 1, -1, '')
 
 #----------------------------------------------------------------------

-- 
(\/)atthew )-(ambley ---------------\ If something's worth doing it's worth
E-mail : matthew@aether.demon.co.uk  \ doing badly until you can learn to
Public key : C991137B                 \ do it well.
Web : http://www.aether.demon.co.uk/   \-----------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sun Oct 12 14:57:58 2003

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.