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

Re: CVS update: subversion/subversion/tests/clients/cmdline svn_tree.py svn_wc.py README example_tests1.py svn_output.py svn_test_main.py xml_tests.py

From: Sam TH <sam_at_uchicago.edu>
Date: 2001-04-26 08:54:22 CEST

On Wed, Apr 25, 2001 at 09:23:15PM -0000, sussman@tigris.org wrote:

Looks very cool. Thanks for finally committing. I'll have some more
code later this evening. Just a few comments:

> +# Tree nodes will contain no contents, and only one 'status' prop.
> +#
> +def tree_from_checkout(lines):
> + "Return a tree derived by parsing the output LINES from 'co' or 'up'."

How are you planning on handling verification for updates? Since it's
only going to be a subset of the on-disk tree, we can't just compare
it against the working copy directly. Comparing it against a set of
expected results is easy, but that's not enough. Here's my current
thought -

1. We build a tree from the wc.
2. We run the update.
3. We build a new tree from the wc.
4. We have a nifty function to generate a changes tree from the first
two trees.
5. We compare the changes tree w/ the expected and output trees.

Now, the changes tree could be handled in multiple ways. It could
just be files whose contents (or maybe timestamps) differ. Or it
could include the output of diff, or something else entirely.

How does this sound?

> +# Tree nodes will contain no contents, and only one 'verb' prop.

At various places, you're constructing trees with entirely different
property sets, which we are going to want to compare later. For
example, you can't get the 'verb' from a working copy. Nor can you
get the text from an import command. How do you plan to do these
comparisons?

> + if svn_tree.compare_trees(exp_tree, result_tree):
> + return 0
> + else:
> + return 1

Since you changed the return values, these are of course broken. Not
that this file current runs anyway. Fixes later.

> ###########################################################################
> # EXPORTED ROUTINES
>
>
> # General utility: change one path into a linked list of nodes.
> #
> # (Take the output and .add_child() it to a root node.)
>
> def create_from_path(path, contents=None, props={}):

I don't think this should be an exported routine. It would be nice to
get svn_output to use build_tree_from_paths, if possible. This
function is really an implementation detail. (As is the neat merging
features of .add_child, for that matter.)

> def dump_tree(n,indent=""):
> "Print out a nice representation of the tree's structure."

I think this should at least print some property info, if nothing
else. And whether the node is a directory or not.

> # helper for wc_to_tree() -- callback for os.walk()
> def visitfunc(baton, dirpath, entrynames):
> "Callback for os.walk(). Builds a tree of SVNTreeNodes."

Why did you decide to use os.path.walk() instead of the tree walker I
wrote? I found the one with walk() harder to understand (although
that may have to do with having written the other one) and the baton
stuff seems ugly (although we wouldn't want to be the only part of
subversion without batons).

>
> def wc_to_tree(wc_path, load_props=0):

I think this ought to be called build_tree_from_wc, for consistency.

> svn_tree.dump_tree(wc_to_tree('wc-t1'))

It's a good idea to hide this behind

if __name__ == '__main__':

so that it doesn't get executed on import.

That's all for now.
           
sam th --- sam_at_uchicago.edu --- http://www.abisource.com/~sam/
OpenPGP Key: CABD33FC --- http://samth.dyndns.org/key
DeCSS: http://samth.dyndns.org/decss

  • application/pgp-signature attachment: stored
Received on Sat Oct 21 14:36:29 2006

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.