summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJannis Pohlmann <jannis.pohlmann@codethink.co.uk>2012-02-20 13:27:51 +0000
committerJannis Pohlmann <jannis.pohlmann@codethink.co.uk>2012-02-20 13:27:51 +0000
commita1a5cbea74e706708678d00f88cf4cd1ea07f556 (patch)
tree3ea597ccbd6e992cf9f0d7206907bfaefec03d01 /tests
parent2c742c9edf459ca8b48393b579510c8943ba64f8 (diff)
downloadlorry-a1a5cbea74e706708678d00f88cf4cd1ea07f556.tar.gz
Add a single commit, single file, single master branch test for SVN.
Diffstat (limited to 'tests')
-rwxr-xr-xtests/svn-single-commit.script41
-rwxr-xr-xtests/svn-single-commit.setup68
-rw-r--r--tests/svn-single-commit.stdout3
3 files changed, 112 insertions, 0 deletions
diff --git a/tests/svn-single-commit.script b/tests/svn-single-commit.script
new file mode 100755
index 0000000..f1c769c
--- /dev/null
+++ b/tests/svn-single-commit.script
@@ -0,0 +1,41 @@
+#!/bin/sh
+#
+# Tests converting a simple SVN repository to git.
+#
+# Copyright (C) 2012 Codethink Limited
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+
+set -e
+
+logfile="$DATADIR/svn-test-repo.log"
+workdir="$DATADIR/work-dir"
+
+./lorry --pull-only --log="$logfile" --working-area="$workdir" \
+ "$DATADIR/svn-test-repo.lorry" > /dev/null 2> /dev/null
+
+# verify that the git repository was created successfully
+(
+ cd "$workdir/svn-test-repo/git/"
+
+ # list the branches
+ git show-ref | cut -d' ' -f2
+
+ # cat the test file
+ git cat-file blob master:test.txt
+
+ # list the commit messages
+ git log --pretty='%s' master
+)
diff --git a/tests/svn-single-commit.setup b/tests/svn-single-commit.setup
new file mode 100755
index 0000000..de4c4b3
--- /dev/null
+++ b/tests/svn-single-commit.setup
@@ -0,0 +1,68 @@
+#!/bin/sh
+#
+# Creates a CVS repository with a single file and a single commit.
+#
+# Copyright (C) 2012 Codethink Limited
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+
+set -e
+
+# create the repository
+repo="$DATADIR/svn-test-repo"
+svnadmin create "$repo"
+
+# setup authentication
+sed -i -r -e 's/^# (password-db.*)/\1/g' "$repo/conf/svnserve.conf"
+sed -i -r -e 's/^# (anon-access.*)/\1/g' "$repo/conf/svnserve.conf"
+sed -i -r -e 's/^# (auth-access.*)/\1/g' "$repo/conf/svnserve.conf"
+echo "lorry = test" >> "$repo/conf/passwd"
+
+# create a local working copy
+workingcopy="$DATADIR/svn-test-checkout"
+svn checkout "file://$repo" "$workingcopy"
+cd "$workingcopy"
+
+# create the typical repository structure
+svn mkdir branches tags trunk
+
+# add the test file
+echo "first line" > trunk/test.txt
+svn add trunk/test.txt
+
+# make a commit
+svn commit \
+ --username lorry \
+ --password test \
+ --no-auth-cache \
+ -m "first commit"
+
+# delete the working copy
+cd "$DATADIR"
+rm -r "$workingcopy"
+
+# create the .lorry file for the repository
+cat <<EOF > $DATADIR/svn-test-repo.lorry
+{
+ "svn-test-repo": {
+ "type": "svn",
+ "url": "file://$repo",
+ "layout": "standard"
+ }
+}
+EOF
+
+# create the working directory
+test -d "$DATADIR/work-dir" || mkdir "$DATADIR/work-dir"
diff --git a/tests/svn-single-commit.stdout b/tests/svn-single-commit.stdout
new file mode 100644
index 0000000..eae50d1
--- /dev/null
+++ b/tests/svn-single-commit.stdout
@@ -0,0 +1,3 @@
+refs/heads/master
+first line
+first commit