# # # add_dir "tests/import_svn_one_revision" # # add_file "tests/import_svn_one_revision/__driver__.lua" # content [d631fce5fc35c3cbc4f0fcd8fa2967f1747063fe] # # add_file "tests/import_svn_one_revision/makerepo.sh" # content [7b47700604f882cbd7a3ed6fb7235cee85c1d801] # # add_file "tests/import_svn_one_revision/svn-repository.dump" # content [699226a7741776a9d5e667db29938482cc08a917] # # set "tests/import_svn_one_revision/makerepo.sh" # attr "mtn:execute" # value "true" # ============================================================ --- tests/import_svn_one_revision/__driver__.lua d631fce5fc35c3cbc4f0fcd8fa2967f1747063fe +++ tests/import_svn_one_revision/__driver__.lua d631fce5fc35c3cbc4f0fcd8fa2967f1747063fe @@ -0,0 +1,54 @@ + +mtn_setup() + + +-- See makerepo.sh on how this repository was created. +check(get("cvs-repository")) + +writefile("file1.0", "version 0 of test file1\n") +writefile("file1.1", "version 1 of test file1\n") +writefile("file1.2", "version 2 of test file1\n") +writefile("file2.0", "version 0 of test file2\n") +writefile("file2.1", "version 1 of test file2\n") + +writefile("changelog.0", "first changelog entry\n") +writefile("changelog.1", readfile("changelog.0").."second changelog\n") +writefile("changelog.2", readfile("changelog.1").."third changelog -not on branch-\n") +writefile("changelog.3", readfile("changelog.1").."third changelog -on branch-\n") + +F1SHA0=sha1("file1.0") +F1SHA1=sha1("file1.1") +F1SHA2=sha1("file1.2") +F2SHA0=sha1("file2.0") +F2SHA1=sha1("file2.1") +CSHA0=sha1("changelog.0") +CSHA1=sha1("changelog.1") +CSHA2=sha1("changelog.2") +CSHA3=sha1("changelog.3") + + +-- import into monotone and check presence of files +check(mtn("--branch=test", "cvs_import", "cvs-repository/test"), 0, false, false) + +-- check if all branches were imported +check(mtn("list", "branches"), 0, true, false) +check(samelines("stdout", {"test", "test.branched"})) + +-- checkout the imported repository into maindir and branchdir +check(mtn("checkout", "--branch=test", "maindir"), 0, false, false) +check(mtn("checkout", "--branch=test.branched", "branchdir"), 0, false, false) + +-- check for correctness of the files in the main tree +check(samefile("file1.2", "maindir/file1")) +check(samefile("file2.0", "maindir/file2")) +check(samefile("changelog.2", "maindir/changelog")) + +-- check for correctness of the files in the branch +check(samefile("file1.1", "branchdir/file1")) +check(samefile("file2.1", "branchdir/file2")) +check(samefile("changelog.3", "branchdir/changelog")) + +-- get the log of the branch to check for correct branchpoint +check(indir("branchdir", mtn("log")), 0, true, false) +check(grep("commit on branch", "stdout"), 0, false, false) +xfail_if(true, grep("initial import", "stdout"), 0, false, false) ============================================================ --- tests/import_svn_one_revision/makerepo.sh 7b47700604f882cbd7a3ed6fb7235cee85c1d801 +++ tests/import_svn_one_revision/makerepo.sh 7b47700604f882cbd7a3ed6fb7235cee85c1d801 @@ -0,0 +1,34 @@ +#!/bin/sh + +REPOSITORY=`pwd`/svn-repository +export REPO + +# deleting the existing cvs-repository +rm -vrf $REPOSITORY + +# create the repository +svnadmin create $REPOSITORY + +# checkout the empty repository +svn co file://$REPOSITORY svn-co + +# commit common trunk, branches and tags structure +cd svn-co +svn mkdir trunk +svn mkdir branches +svn mkdir tags +svn commit -m "initial subversion structure" + +# add a test file +echo "This is the content of fileA" > trunk/fileA +svn add trunk/fileA +svn commit -m "a simple first commit" + +cd .. + +# create the dump +svnadmin dump --deltas $REPOSITORY > svn-repository.dump + +# clean up +rm -rf svn-co +rm -rf svn-repository ============================================================ # tests/import_svn_one_revision/svn-repository.dump is binary