Philip Martin wrote:
>Philip Martin <email@example.com> writes:
>>but I not sure that that is guaranteed to work either. We could do a
>>proper hot-backup, but we would either need to know the path to the
>>db4 utilities or we would have to know the names of the relevant db4
>>files, neither of which is appealing. Alternatively we could use an
>>svnadmin dump/load cycle to duplicate the repository. I haven't tried
>>that because, while I'm sure Python can handle redirecting input, I
>>don't know how to do it :)
>OK Python experts, what about this. Will it work on non-Unix
>platforms? Would it be better to dump to an intermediate file?
copy_repos should work on non-unix platforms, yes. We're already using
os.popen in the tests to run other binaries, no problems there.
One thing I'd like to see, though, is more serious checking of the trace
output -- at least matching against valid patterns would be nice.
Another issue is the 1k reads. Our test repositories are small enough
that it should be perfectly OK to slurp the whole dump file into memory
at once. Or maybe limit the read buffer to 100k, definitely not 1k.
>* subversion/tests/clients/cmdline/svntest/main.py (copy_repos): New
> (externals_test_setup): Use copy_repos.
>--- subversion/tests/clients/cmdline/svntest/main.py (revision 4125)
>+++ subversion/tests/clients/cmdline/svntest/main.py (working copy)
>@@ -271,6 +271,32 @@
> # make the repos world-writeable, for mod_dav_svn's sake.
> chmod_tree(path, 0666, 0666)
>+# For copying a repository
>+def copy_repos(src_path, dst_path, head_revision):
>+ "Copy the repository SRC_PATH to DST_PATH"
>+ # A BDB hot-backup procedure would be more efficient, but that would
>+ # require access to the BDB tools, and this doesn't.
>+ dump_in, dump_out, dump_err = os.popen3(svnadmin_binary + " dump " + src_path)
>+ load_in, load_out, load_err = os.popen3(svnadmin_binary + " load " + dst_path)
>+ while 1:
>+ data = dump_out.read(1024) # Size picked at random
>+ if data == "":
>+ load_in.close() # Tell load we are done? Seems to work.
>+ # Check we have vaguely sensible looking output
>+ if len(dump_err.readlines()) != head_revision + 1: # +1 for revision 0
>+ print "Dump failed!"
>+ load_out_lines = load_out.readlines()
>+ if (load_out_lines[len(load_out_lines)-2]
>+ != "------- Committed new rev " + str(head_revision)
>+ + " (loaded from original rev " + str(head_revision) + ") >>>\n"):
>+ print "Load failed!"
> def set_repos_paths(repo_dir):
> "Set current_repo_dir and current_repo_url from a relative path to the repo."
> global current_repo_dir, current_repo_url
>--- subversion/tests/clients/cmdline/externals_tests.py (revision 4125)
>+++ subversion/tests/clients/cmdline/externals_tests.py (working copy)
>@@ -144,7 +144,7 @@
> # the one to which the first repository's `svn:externals' properties
> # will refer. After this, both repositories have five revisions
> # of random stuff, with no svn:externals props set yet.
>- shutil.copytree(repo_dir, other_repo_dir)
>+ svntest.main.copy_repos(repo_dir, other_repo_dir, 5)
> # Set up the externals properties on A/B/ and A/D/.
> externals_desc = \
Brane Čibej <brane_at_xbc.nu> http://www.xbc.nu/brane/
To unsubscribe, e-mail: firstname.lastname@example.org
For additional commands, e-mail: email@example.com
Received on Sun Dec 15 00:58:28 2002