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

PATCH: cvs2svn tests: exec attr check

From: Marko Macek <Marko.Macek_at_gmx.net>
Date: 2003-03-01 19:25:57 CET

Hi!

Let's try this again.

Change Log:

* tools/cvs2svn/tests/cmptag.py:
   (get_exec_flag): For sorting, remember the full relative path,
   instead of just the file name.
   (cmp_attr): Pass the base directory name to get_exec_flag.
   Sort the file list before checking for attributes.
   (cmp_attr): Fix syntax error/typo.

Regards,
Mark

Index: cmptag.py
===================================================================
--- cmptag.py (revision 5121)
+++ cmptag.py (working copy)
@@ -36,6 +36,9 @@
         raise "svn co failed"
 
 def get_exec_flag(arg, dirname, fnames):
+ """callback for os.path.walk, builds a list of (filename, attributes)
+ arg = [result_list, base_directory]
+ """
     i = 0
     while i < len(fnames):
         fn = fnames[i]
@@ -44,7 +47,9 @@
            continue
         f = os.path.join(dirname, fn)
         mode = os.stat(f)[0]
- arg.append((fn, mode & stat.S_IXUSR))
+ # store the relative file path and the relevant attributes
+ arg[0].append((dirname[len(arg[1]):] + "/" + fn,
+ mode & stat.S_IXUSR))
         i += 1
         
     
@@ -52,10 +57,12 @@
 def cmp_attr(dir1, dir2):
     attr1 = []
     attr2 = []
- os.path.walk(dir1, get_exec_flag, attr1)
- os.path.walk(dir2, get_exec_flag, attr2)
+ os.path.walk(dir1, get_exec_flag, [ attr1, dir1 ])
+ os.path.walk(dir2, get_exec_flag, [ attr2, dir2 ])
+ attr1.sort();
+ attr2.sort();
     if attr1 != attr2:
- print repr(attr1), attr(2)
+ print repr(attr1), repr(attr2)
        raise "mismatch in file attributes"
 
 def check_tag(cvs_repo, module, tag, svn_repo, path):

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Mar 1 19:18:31 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.