diff options
author | Jannis Pohlmann <jannis.pohlmann@codethink.co.uk> | 2012-02-17 14:41:19 +0000 |
---|---|---|
committer | Jannis Pohlmann <jannis.pohlmann@codethink.co.uk> | 2012-02-17 14:41:19 +0000 |
commit | d587789d4972af6acee94471edc1db08a1b7f40b (patch) | |
tree | 5ff5b1424fa4d25fde8849c920784ee39ab837dc /tests | |
parent | f879ddd5a35c185b867a6b66adb363061c36bdeb (diff) | |
download | lorry-d587789d4972af6acee94471edc1db08a1b7f40b.tar.gz |
Add tests for Git and CVS repos with a single commit.
Also make sure that the data dir is clean when running any of the tests.
Unfortunately, CVS fails at the moment, so I've commented out a few
lines in the script to not make it do anything for now.
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/bzr-single-commit.setup | 6 | ||||
-rwxr-xr-x | tests/cvs-single-commit.script | 43 | ||||
-rwxr-xr-x | tests/cvs-single-commit.setup | 63 | ||||
-rw-r--r-- | tests/git-single-commit.stdout | 3 |
4 files changed, 114 insertions, 1 deletions
diff --git a/tests/bzr-single-commit.setup b/tests/bzr-single-commit.setup index acb6949..f3df24d 100755 --- a/tests/bzr-single-commit.setup +++ b/tests/bzr-single-commit.setup @@ -20,6 +20,9 @@ set -e +# clean up the data directory +test -d "$DATADIR" && rm -rf "$DATADIR"/* + # create the repository repo="$DATADIR/bzr-test-repo" mkdir "$repo" @@ -44,5 +47,6 @@ cat <<EOF > $DATADIR/bzr-test-repo.lorry } EOF -# create the working directory for lorry + +# create the working directory mkdir "$DATADIR/work-dir" diff --git a/tests/cvs-single-commit.script b/tests/cvs-single-commit.script new file mode 100755 index 0000000..cc43000 --- /dev/null +++ b/tests/cvs-single-commit.script @@ -0,0 +1,43 @@ +#!/bin/sh +# +# Tests converting a simple CVS 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/cvs-test-repo.log" +workdir="$DATADIR/work-dir" + +# ./lorry --pull-only --log="$logfile" --working-area="$workdir" \ +# "$DATADIR/cvs-test-repo.lorry" # > /dev/null 2> /dev/null +# +# #export GIT_DIR="$workdir/cvs-test-repo/git/.git" +# cd "$workdir/cvs-test-repo/git/" +# +# # list the branches +# git show-ref | cut -d' ' -f2 +# +# # cat the test file +# git cat-file blob trunk:test.txt +# +# # check out the trunk branch +# git checkout --quiet trunk +# +# # list the commit messages +# git log --pretty='%s' diff --git a/tests/cvs-single-commit.setup b/tests/cvs-single-commit.setup new file mode 100755 index 0000000..4214406 --- /dev/null +++ b/tests/cvs-single-commit.setup @@ -0,0 +1,63 @@ +#!/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 + +# clean up the data directory +test -d "$DATADIR" && rm -rf "$DATADIR"/* + +# create the repository +repo="$DATADIR/cvs-test-repo" +export CVSROOT="$repo" +export CVS_RSH= +cvs init + +# create a local working copy +workingcopy="$DATADIR/cvs-test-checkout" +mkdir "$workingcopy" +cd "$workingcopy" +cvs checkout CVSROOT +cd "$workingcopy/CVSROOT" + +# add the test file +echo "first line" > test.txt +cvs -Q add test.txt + +# make a commit +cvs -Q commit -m "first commit" + +# delete the working copy +cd "$DATADIR" +rm -r "$workingcopy" + +# create the .lorry file for the repository +cat <<EOF > $DATADIR/cvs-test-repo.lorry +{ + "cvs-test-repo": { + "type": "cvs", + "url": "$repo", + "module": "CVSROOT" + } +} +EOF + + +# create the working directory +mkdir "$DATADIR/work-dir" diff --git a/tests/git-single-commit.stdout b/tests/git-single-commit.stdout new file mode 100644 index 0000000..eae50d1 --- /dev/null +++ b/tests/git-single-commit.stdout @@ -0,0 +1,3 @@ +refs/heads/master +first line +first commit |