diff options
-rwxr-xr-x | lorry | 2 | ||||
-rwxr-xr-x | tests/bzr-single-commit.script | 20 | ||||
-rwxr-xr-x | tests/cvs-single-commit.script | 34 | ||||
-rw-r--r-- | tests/cvs-single-commit.stdout | 5 | ||||
-rwxr-xr-x | tests/git-single-commit.script | 23 | ||||
-rwxr-xr-x | tests/hg-single-commit.script | 23 | ||||
-rw-r--r-- | tests/hg-single-commit.stdout | 2 | ||||
-rwxr-xr-x | tests/svn-single-commit.script | 41 | ||||
-rwxr-xr-x | tests/svn-single-commit.setup | 68 | ||||
-rw-r--r-- | tests/svn-single-commit.stdout | 3 |
10 files changed, 165 insertions, 56 deletions
@@ -244,7 +244,7 @@ class Lorry(cliapp.Application): self.run_program(['git', 'svn', 'fetch'], cwd=gitdir) def gitify_cvs(self, project_name, dirname, gitdir, spec): - self.run_program(['git', 'cvsimport', '-d', spec['url'], + self.run_program(['git', 'cvsimport', '-a', '-d', spec['url'], '-C', gitdir, spec['module']]) out = self.run_program(['git', 'remote'], cwd=gitdir) if 'gitorious' not in out.splitlines(): diff --git a/tests/bzr-single-commit.script b/tests/bzr-single-commit.script index c104c21..a870558 100755 --- a/tests/bzr-single-commit.script +++ b/tests/bzr-single-commit.script @@ -27,16 +27,16 @@ workdir="$DATADIR/work-dir" ./lorry --pull-only --log="$logfile" --working-area="$workdir" \ "$DATADIR/bzr-test-repo.lorry" > /dev/null 2> /dev/null -cd "$workdir/bzr-test-repo/git/" +# verify that the git repository was set up correctly +( + cd "$workdir/bzr-test-repo/git/" -# list the branches -git show-ref | cut -d' ' -f2 + # list the branches + git show-ref | cut -d' ' -f2 -# cat the test file -git cat-file blob trunk:test.txt + # 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' + # list the commit messages + git log --pretty='%s' trunk +) diff --git a/tests/cvs-single-commit.script b/tests/cvs-single-commit.script index cc43000..6f1736c 100755 --- a/tests/cvs-single-commit.script +++ b/tests/cvs-single-commit.script @@ -20,24 +20,22 @@ 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' +./lorry --pull-only --log="$logfile" --working-area="$workdir" \ + "$DATADIR/cvs-test-repo.lorry" > /dev/null 2> /dev/null + +# verify that the git repository was created successfully +( + cd "$workdir/cvs-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/cvs-single-commit.stdout b/tests/cvs-single-commit.stdout new file mode 100644 index 0000000..0217108 --- /dev/null +++ b/tests/cvs-single-commit.stdout @@ -0,0 +1,5 @@ +refs/heads/master +refs/heads/origin +first line +first commit +initial checkin diff --git a/tests/git-single-commit.script b/tests/git-single-commit.script index a8afa5d..4a6e8b3 100755 --- a/tests/git-single-commit.script +++ b/tests/git-single-commit.script @@ -27,19 +27,16 @@ workdir="$DATADIR/work-dir" ./lorry --pull-only --log="$logfile" --working-area="$workdir" \ "$DATADIR/git-test-repo.lorry" > /dev/null 2> /dev/null -cd "$workdir/git-test-repo/git/" +# verify that the git repository was set up correctly +( + cd "$workdir/git-test-repo/git/" -# list the branches -git show-ref | cut -d' ' -f2 + # list the branches + git show-ref | cut -d' ' -f2 -# cat the test file -git cat-file blob master:test.txt + # cat the test file + git cat-file blob master:test.txt -# check out the trunk branch -cd "$workdir/git-test-repo" -git clone --quiet git temporary-clone -cd temporary-clone -git checkout --quiet master - -# list the commit messages -git log --pretty='%s' + # list the commit messages + git log --pretty='%s' master +) diff --git a/tests/hg-single-commit.script b/tests/hg-single-commit.script index e999007..c370190 100755 --- a/tests/hg-single-commit.script +++ b/tests/hg-single-commit.script @@ -27,19 +27,16 @@ workdir="$DATADIR/work-dir" ./lorry --verbose --pull-only --log="$logfile" --working-area="$workdir" \ "$DATADIR/hg-test-repo.lorry" > /dev/null 2> /dev/null -cd "$workdir/hg-test-repo/hg/" +# verify that the git repository was created correctly +( + cd "$workdir/git-test-repo/git/" -# list the branches -hg branches | cut -d' ' -f1 + # list the branches + git show-ref | cut -d' ' -f2 -# cat the test file -hg cat -r default test.txt + # cat the test file + git cat-file blob master:test.txt -# check out the trunk branch -cd "$workdir/hg-test-repo" -hg clone --quiet hg temporary-clone -cd temporary-clone -hg update --quiet -c default - -# list the commit messages -hg log --template '{desc|firstline}\n' + # list the commit messages + git log --pretty='%s' master +) diff --git a/tests/hg-single-commit.stdout b/tests/hg-single-commit.stdout index c231fb3..eae50d1 100644 --- a/tests/hg-single-commit.stdout +++ b/tests/hg-single-commit.stdout @@ -1,3 +1,3 @@ -default +refs/heads/master first line first commit 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 |