Skip to content
Snippets Groups Projects
Commit feab56c76c92 authored by Augie Fackler's avatar Augie Fackler
Browse files

Add a basic test for cloning.

parent ace0f6ed65a1
No related branches found
No related tags found
No related merge requests found
syntax: glob
*.pyc
tests/*.err
......@@ -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.
#!/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`
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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment