diff --git a/.hgignore b/.hgignore index ace0f6ed65a10cd71b74cedac78099fdcf9f197e_LmhnaWdub3Jl..feab56c76c92699c2bf31cd03ec17e43e5038b96_LmhnaWdub3Jl 100644 --- a/.hgignore +++ b/.hgignore @@ -1,3 +1,4 @@ syntax: glob *.pyc +tests/*.err diff --git a/DESIGN.txt b/DESIGN.txt index ace0f6ed65a10cd71b74cedac78099fdcf9f197e_REVTSUdOLnR4dA==..feab56c76c92699c2bf31cd03ec17e43e5038b96_REVTSUdOLnR4dA== 100644 --- a/DESIGN.txt +++ b/DESIGN.txt @@ -47,3 +47,19 @@ - transfers it, updates local references (bookmarks?) +* Tests * +Tests are implemented in the Mercurial-standard way of small shell scripts. +The scripts are located in the tests directory, and to run them you should +change to that directory and then run tests/run-tests.py from the Mercurial +sources. For example, if you have a copy of the Mercurial source code at +/Stuff/hg-crew, you would do something like this: + +cd tests ; /Stuff/hg-crew/tests/run-tests.py + +And you should see output like this: +. +# Ran 1 tests, 0 skipped, 0 failed. + +Note that due to limitations of Dulwich at the moment, the tests need to +start a git-daemon process. Right now, they use the default port, so will +skip if they detect an already-running git-daemon. diff --git a/tests/test-git-clone b/tests/test-git-clone new file mode 100644 index 0000000000000000000000000000000000000000..feab56c76c92699c2bf31cd03ec17e43e5038b96_dGVzdHMvdGVzdC1naXQtY2xvbmU= --- /dev/null +++ b/tests/test-git-clone @@ -0,0 +1,53 @@ +#!/bin/sh + +# Fails for some reason, need to investigate +# "$TESTDIR/hghave" git || exit 80 + +# bail early if the user is already running git-daemon +echo hi | nc localhost 9418 && exit 80 + +echo "[extensions]" >> $HGRCPATH +echo "hggit=$(echo $(dirname $(dirname $0)))" >> $HGRCPATH +echo 'hgext.graphlog =' >> $HGRCPATH +echo 'hgext.bookmarks =' >> $HGRCPATH + +GIT_AUTHOR_NAME='test'; export GIT_AUTHOR_NAME +GIT_AUTHOR_EMAIL='test@example.org'; export GIT_AUTHOR_EMAIL +GIT_AUTHOR_DATE="2007-01-01 00:00:00 +0000"; export GIT_AUTHOR_DATE +GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"; export GIT_COMMITTER_NAME +GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"; export GIT_COMMITTER_EMAIL +GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"; export GIT_COMMITTER_DATE + +count=10 +commit() +{ + GIT_AUTHOR_DATE="2007-01-01 00:00:$count +0000" + GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE" + git commit "$@" >/dev/null 2>/dev/null || echo "git commit error" + count=`expr $count + 1` +} + +mkdir gitrepo +cd gitrepo +git init | python -c "import sys; print sys.stdin.read().replace('$(dirname $(pwd))/', '')" +echo alpha > alpha +git add alpha +commit -m 'add alpha' +echo beta > beta +git add beta +commit -m 'add beta' + +# dulwich does not presently support local git repos, workaround +cd .. +git-daemon --base-path="$(pwd)"\ + --listen=127.0.0.1\ + --export-all\ + --pid-file=gitdaemon.pid \ + --detach --reuseaddr + +hg gclone git://127.0.0.1/gitrepo hgrepo +cd hgrepo +hg log --graph + +cd .. +kill `cat gitdaemon.pid` diff --git a/tests/test-git-clone.out b/tests/test-git-clone.out new file mode 100644 index 0000000000000000000000000000000000000000..feab56c76c92699c2bf31cd03ec17e43e5038b96_dGVzdHMvdGVzdC1naXQtY2xvbmUub3V0 --- /dev/null +++ b/tests/test-git-clone.out @@ -0,0 +1,22 @@ +Initialized empty Git repository in gitrepo/.git/ + +fetching from : origin +Counting objects: 6, done. +Compressing objects: 33% (1/3) Compressing objects: 66% (2/3) Compressing objects: 100% (3/3) Compressing objects: 100% (3/3), done. +Total 6 (delta 0), reused 0 (delta 0) +importing Git objects into Hg +importing: 7eeab2ea75ec1ac0ff3d500b5b6f8a3447dd7c03 +importing: 9497a4ee62e16ee641860d7677cdb2589ea15554 +2 files updated, 0 files merged, 0 files removed, 0 files unresolved +@ changeset: 1:7bcd915dc873 +| tag: origin/master +| tag: tip +| user: test <test@example.org> +| date: Mon Jan 01 00:00:11 2007 +0000 +| summary: add beta +| +o changeset: 0:3442585be8a6 + user: test <test@example.org> + date: Mon Jan 01 00:00:10 2007 +0000 + summary: add alpha +