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

Re: svn commit: r35538 - in trunk/subversion/tests/cmdline: . svntest

From: Arfrever Frehtes Taifersar Arahesis <Arfrever.FTA_at_GMail.Com>
Date: Sat, 31 Jan 2009 01:12:49 +0100

2009-01-29 06:14:56 David Glasser napisaƂ(a):
> Author: glasser
> Date: Wed Jan 28 21:14:55 2009
> New Revision: 35538
>
> Log:
> Speed up test suite by running 'svn proplist' only once per wc tree instead of
> once per file in it. (Yeah, there's an extra tree walk, but that should just
> make the second tree walk come from cache.)
>
> * subversion/tests/cmdline/svntest/tree.py
> (get_nodes_which_might_have_props): New.
> (get_props): Take a list of paths and return a hash of prop hashes.
> (handle_dir): Change load_props arg to props hash. Look in hash instead of
> calling get_props.
> (build_tree_from_wc): Adjust.
>
> * subversion/tests/cmdline/autoprop_tests.py
> (check_proplist): Adjust.
>
> Modified:
> trunk/subversion/tests/cmdline/autoprop_tests.py
> trunk/subversion/tests/cmdline/svntest/tree.py
>
> Modified: trunk/subversion/tests/cmdline/svntest/tree.py
> URL: http://svn.collab.net/viewvc/svn/trunk/subversion/tests/cmdline/svntest/tree.py?pathrev=35538&r1=35537&r2=35538
> ==============================================================================
> --- trunk/subversion/tests/cmdline/svntest/tree.py Wed Jan 28 17:52:12 2009 (r35537)
> +++ trunk/subversion/tests/cmdline/svntest/tree.py Wed Jan 28 21:14:55 2009 (r35538)
> @@ -390,44 +390,61 @@ def create_from_path(path, contents=None
> return root_node
>
>
> -# helper for handle_dir(), which is a helper for build_tree_from_wc()
> -def get_props(path):
> - """Return a hash of props for PATH, using the svn client. Convert each
> - embedded end-of-line to a single LF character."""
> +def get_nodes_which_might_have_props(wc_path):
> + dot_svn = main.get_admin_name()
> + def walker(output, dirname, names):
> + names[:] = [n for n in names if n != dot_svn]
> + output.extend([os.path.join(dirname, n) for n in names])
> + nodes = [wc_path]
> + os.path.walk(wc_path, walker, nodes)
> + return nodes
> +
> +# helper for build_tree_from_wc()
> +def get_props(paths):
> + """Return a hash of hashes of props for PATHS, using the svn client. Convert
> + each embedded end-of-line to a single LF character."""
>
> # It's not kosher to look inside .svn/ and try to read the internal
> # property storage format. Instead, we use 'svn proplist'. After
> # all, this is the only way the user can retrieve them, so we're
> # respecting the black-box paradigm.
>
> - props = {}
> - exit_code, output, errput = main.run_svn(1, "proplist", path, "--verbose")
> + files = {}
> + filename = None
> + exit_code, output, errput = main.run_svn(1, "proplist", "--verbose", *paths)
> +
> + properties_on_re = re.compile("^Properties on '(.+)':$")
>
> # Parse the output
> for line in output:
> line = line.rstrip('\r\n') # ignore stdout's EOL sequence
>
> - if line.startswith('Properties on '):
> - continue
> + match = properties_on_re.match(line)
> + if match:
> + filename = match.group(1)
>
> elif line.startswith(' '):
> - # It's (part of) the value
> - props[name] += line[4:] + '\n' # strip the indentation
> + # It's (part of) the value (strip the indentation)
> + if filename is None:
> + raise "Missing 'Properties on' line: '"+line+"'"

Please don't raise strings.
http://docs.python.org/whatsnew/2.6.html:
"String exceptions have been removed. Attempting to use them raises a TypeError."

-- 
Arfrever Frehtes Taifersar Arahesis

Received on 2009-01-31 01:14:12 CET

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