changeset 18:ae8dd2a2f102

Add the first two test scripts. (Running them requires hijacking Mercurial's test infrastructure.)
author Greg Ward <greg-hg@gerg.ca>
date Sat, 02 May 2009 17:28:07 -0400
parents 0fa60b773da6
children d246bcee93ec
files tests/test-fastimport-empty tests/test-fastimport-empty.out tests/test-fastimport-simple tests/test-fastimport-simple.out
diffstat 4 files changed, 102 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-fastimport-empty	Sat May 02 17:28:07 2009 -0400
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+# Import an empty fastimport dump.
+
+cat > $HGRCPATH <<EOF
+[extensions]
+fastimport = $TESTDIR/../fastimport
+EOF
+
+hg init dest
+cd dest
+hg fastimport /dev/null
+
+hg log
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-fastimport-empty.out	Sat May 02 17:28:07 2009 -0400
@@ -0,0 +1,1 @@
+Reading source: /dev/null
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-fastimport-simple	Sat May 02 17:28:07 2009 -0400
@@ -0,0 +1,60 @@
+#!/bin/sh
+
+# A simple dump: two commits, no marks, no blobs
+
+cat > $HGRCPATH <<EOF
+[extensions]
+graphlog =
+fastimport = $TESTDIR/../fastimport
+EOF
+
+cat > simple.dump <<__EOF__
+commit refs/heads/master
+committer Example <example@example.org> 1200000000 +0000
+data 17
+initial revision
+
+M 644 inline file1
+data 14
+file 1 begins
+
+M 644 inline file2
+data 19
+this here be file2
+
+commit refs/heads/master
+committer Example <example@example.org> 1200000001 +0000
+data 11
+add a line
+
+M 644 inline file1
+data 23
+file 1 begins
+new line
+
+__EOF__
+
+set -e
+rm -rf simple
+echo "% importing"
+hg init simple
+cd simple
+hg fastimport ../simple.dump
+
+# It's OK for the log to include changeset IDs, since the fastimport
+# dump includes everything used to compute them, so they should be the
+# same from run to run.
+echo "% hg log"
+hg log
+
+echo "% content of file1, rev 0"
+hg cat -r0 file1
+
+echo "% content of file2, rev 0"
+hg cat -r0 file2
+
+echo "% content of file1, rev 1"
+hg cat -r1 file1
+
+echo "% content of file2, rev 1"
+hg cat -r1 file2
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-fastimport-simple.out	Sat May 02 17:28:07 2009 -0400
@@ -0,0 +1,27 @@
+% importing
+Reading source: ../simple.dump
+0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+Done commit of rev 0
+2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+Done commit of rev 1
+% hg log
+changeset:   1:494d62fb22a9
+tag:         tip
+user:        Example <example@example.org>
+date:        Thu Jan 10 21:20:01 2008 +0000
+summary:     add a line
+
+changeset:   0:43689aeeccc7
+user:        Example <example@example.org>
+date:        Thu Jan 10 21:20:00 2008 +0000
+summary:     initial revision
+
+% content of file1, rev 0
+file 1 begins
+% content of file2, rev 0
+this here be file2
+% content of file1, rev 1
+file 1 begins
+new line
+% content of file2, rev 1
+this here be file2