On Thu, Jun 13, 2002 at 01:11:31PM +0100, Philip Martin wrote:
> Greg Stein <firstname.lastname@example.org> writes:
> > But it is a start... comments?
> One jumps out.
> The state objects operate with "Subversion paths" like 'A/D/G/rho' but
> "OS paths" like os.path_join(wc_dir, 'A', 'D', 'G', 'rho') are
> required for svntest.actions and for working copy manipulations. Your
Well... "required" isn't strictly true :-)
When I was converting the code, I noticed the mixing of path styles. In
particular, look at line 79 of actions.py (thanks also to Ben for pointing
out the specific case). We took the '/'-separated paths of main.greek_tree
and combined them with directories.
And it all seems to work... My assumption is that Windows is allowing
forward-slashes (which I believe that I've heard people mention is okay).
Now... *should* it ever pose a problem, then we can easily have a State
object return a proper path for us. It could take its .wc_dir attribute and
join that with a path. For example:
def os_path(self, *parts):
args = [ self.wc_dir ]
for part in parts:
return apply(os.path.join, args)
This allows constructs like:
> I would like to be able to construct OS paths from Subversion
> paths. Then I could write things like
> G_path = 'A/D/G'
> rho_path = G_path + '/rho'
> svntest.main.file_append(xxxx(wc_dir, rho_path), 'some text')
> svntest.main.run_svn(None, 'rm', xxxx(wc_dir, G_path))
> svntest.main.run_svn(None, 'rm', '--force', xxxx(wc_dir, G_path))
> expected_status.tweak_one(G_path, status='D ')
> expected_status.tweak_one(rho_path, status='D ')
> shutil.rmtree(xxxx(wc_dir, G_path))
The above would have lines like:
svntest.main.file_append(expected_status.os_path(rho_path), 'some text')
Hmm. Just thought of something. If wc.State() represents a working copy,
then we could do things like:
To have operations performed on items in the working copy referenced by the
State. Of course, we just paths arbitrary paths to 'svn', and it operates on
the appropriate WC, so maybe this is no big deal...
> xxxx is some function (or method, or operator, or whatever) that
> (wc_dir, G_path, '/rho')
> (os.path.join(wc_dir, 'A', 'D', 'G', 'rho'))
> I think I would require the first argument to be an OS path, and all
> subsequent arguments to be Subversion paths.
Well, a State object is already rooted at a wc_dir, so it would be handy for
these types of conversions.
Another alternative is to have the Sandbox object do it. Note that most of
the tests do:
wc_dir = sbox.wc_dir
It would be quite reasonable to do:
I think it really depends on which method the .os_path makes the most sense.
I first started thinking about the State object, but the Sandbox might be
Summary for comments:
* forward-slash seems to work fine on Windows
* does the .os_path() seem to make sense?
* should .os_path go on the Sandbox? Or on a State? Both? Maybe just a
function in svntest.main?
Greg Stein, http://www.lyra.org/
To unsubscribe, e-mail: email@example.com
For additional commands, e-mail: firstname.lastname@example.org
Received on Sat Jun 15 01:39:22 2002