Clean-up unit-tests * Move to a stricter unit-test naming convention: * t1xxx-*.sh are the svnreplay tests. * t2xxx-*.sh are the svnancest tests. * Support multi-jobbing unit-tests. Make all the unit-tests multi-job safe, e.g. use unique repo's and wc's for each test. * Ensure all test logic is run via assert's. * Introduce "prove" Makefile target for unit-tests, to allow running all the tests multi-jobbed via prove.
Support before-commit hook option (--pre-commit) Allow the caller to optionally run a shell script before each replayed commit. This could be useful if you wanted to modify the replayed file/directory contents, e.g. strip-out a certain file at a certain source revision, etc. * svn2svn/run/svnreplay.py (commit_from_svn_log_entry): Support beforecommit hook. * tests/t0103*: Add unit-tests for new --pre-commit option. * svn2svn/run/svnreplay.py (main): Minor tweaks to command-line argument help-text. * svn2svn/shell.py (_run_raw_command): Fix typo
Move shared code to replay-lib.sh * tests/replay-lib.sh (init_replay_repo): Move duplicated code from t01??*.sh scripts to create an empty repo for svnreplay to this shared function. * tests/t010?*.sh: Use replay-lib.sh and init_replay_repo(). * tests/t010?*.sh: Respect $TEST_DIRECTORY shell variable rather than hard-coding `pwd`.
test-lib: test_expect_failure() expected failure is ok The Git test-lib test_expect_failure() behavior is to call separate test_known_ok/test_known_broken_failure helper tags which puts the "known failure" results into separate buckets. This is the opposite of what I want. I want test_expect_failure() to be the true-opposite of test_expect_success(): if we expect a test to fail (i.e. exit 1), then say the test passed if the command failed. * tests/test-lib-functions.sh (test_expect_failure): Change test_expect_failure() to be the true-opposite of test_expect_success(): test succeeds if command exits with error code.
Improved unit-tests Refactor the old-style make-replay-repo/check-replay-repo scripts into the new test framework, for easier Makefile-based testing.
Proper quote-wrapping in test scripts Wrap all path-variable references in double-quotes, so that if `pwd` contains spaces bash will interpret things correctly. For URLs, replace spaces with %20, though that's the extent of the URL-encoding we try to do in these simple shell scripts.
Correctly handle source_url/target_url with chars needing URL-encoding Use urllib.unquote() to URL-decode source_url/target_url values. All URLs passed to run_svn() should go through svnclient.safe_path() and we don't want to end-up *double* urllib.quote'ing if the user- supplied source/target URL's are already URL-encoded or have chars which need URL-encoding. * svn2svn/run/svn2svn.py (real_main): Maintain source_url/target_url as URL-decoded values. * svn2svn/run/svn2svn.py (gen_tracking_revprops, build_rev_map): Translate "internal" source_url back to an "external" (URL-encoded) value. * svn2svn/svnclient (parse_svn_info_xml): URL-decode 'url' and 'repos_url' values, since all downstream consumers should want these to be in the "internal" (URL-decoded) format. * tests/make-ref-repo.sh: Add test-cases to further stress-test URL-encoding/decoding.
Better path and URL encoding/escaping * svn2svn/svnclient.py (safe_path): Creating to abstract building paths which are safe to pass as svn command-line args. For URL's, use urllib.quote() to URL-encode paths. For local paths, if file/dir name includes "@", add a trailing "@" so svn doesn't get confused about unintended text being parsed as a peg-revision. * svn2svn/svnclient.py: Use safe_path() for all local and URL paths. * svn2svn/run/svn2svn.py: Use svnclient.safe_path() for all local and URL paths.
Verify-mode Add command-line args for verifying content and ancestry, i.e. for self-testing the replay. Compare the source vs. target history to make sure we ended-up with equivalent target revisions for each applicable source revision. * svn2svn/run/svn2svn.py (verify_commit): Adding. * tests/make-ref-repo.sh: Add tests for source revisions which we'll never have an equivalent target revision for, e.g. svn:mergeinfo property changes.
Correctly crawl source_url's ancestry back to origin, if any * svn2svn/svnclient.py (iter_svn_log_entries): Support new optional 'ancestors' param. Use that to correctly grab revision-chunks, following the ancestry history. * svn2svn/run/svn2svn.py (join_path, in_ancestors): New functions. * svn2svn/run/svn2svn.py (real_main): Use find_svn_ancestors() to get ancestry of source_url and pass that to downstream functions.