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

Re: svn-load under windows

From: Liviu <lab2k1_at_gmail.com>
Date: Tue, 10 Jun 2008 02:22:52 -0500

From: "Liviu" Sent: Fri, June 06, 2008 2:08 PM
> trying to use svn-load 0.10 (http://free.linux.hp.com/~dannf/svn-load/)
> in windows with svn 1.4.6 and python 2.5.2, both running otherwise
> correctly. I cannot verify svn-load itself, since its own test.py doesn't
> look like it was meant for windows [...]
> Svn-load executes, but fails early on with various runtime errors.

A few notes below which someone may find helpful if trying to run svn-load
or its test.py under windows...

1. Life is easier if svn-load is given a .py extension.

2. Svn-load doesn't cleanup the working copy (absent --wc).
This is caused by shutil.rmtree failing, due in turn to read-only svn files.
It can be fixed by replacing the line



    shutil.rmtree(workingparent, onerror = shutil_rmtree_retry)


    S_IRWXX = stat.S_IREAD | stat.S_IRGRP | stat.S_IROTH \
            | stat.S_IWRITE | stat.S_IWGRP | stat.S_IWOTH

    def shutil_rmtree_retry(fn, path, excinfo):
        if fn is os.rmdir:
            os_retry = os.rmdir
        elif fn is os.remove:
            os_retry = os.remove
        os.chmod(path, os.stat(path).st_mode | S_IRWXX)

Same issue exists in test.py, same fix works there.

The rest of the notes below refer to test.py alone...

3. Symlink tests fail under OSs which don't support such.
Something like the following could be used to set a global variable, which
could then be checked to skip symlink tests where not applicable.

        is_os_symlink = True
        is_os_symlink = False # skip symlink tests if unsupported

4. The local file:/// protocol requires 3 slashes in windows.

5. Unix paths like '/usr/bin/svnadmin' need to be adjusted. One possibility
relying on the %path% environment is to replace os.spawnl with, for example

    subprocess.call(["svnadmin.exe", "create", repo])

for native .exe's, or else for .py's

    subprocess.call(["svn-load.py", self.url, self.idir, ldir,
                               "--no-prompt"] + self.extra_args,
                              shell = True)

6. Cleanup leaves directories behind, due to a handle leak from
tempfile.mkstemp (the file handle is not saved, thus not closed). This can
be fixed by moving mkstemp into makeMoveMap like

        h, self.movemap = tempfile.mkstemp()
        f = os.fdopen(h, 'w')

7. The move-map syntax is OS dependent, for windows the given example should
probably be more like

        f.write("^src\\\\(?P<filename>.+\.(gif|jpg|png))$ "
                "lambda m: 'graphics\\%s' % m.group('filename')\n")

The above are not meant (nor submitted) as a formal patch, sorry, don't have
the time now. But FWIW including nothing at all ;-) feel free to...


To unsubscribe, e-mail: users-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: users-help_at_subversion.tigris.org
Received on 2008-06-10 09:23:56 CEST

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

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