changeset 19:d246bcee93ec

Add test with branching and merging.
author Greg Ward <greg-hg@gerg.ca>
date Sat, 02 May 2009 18:04:52 -0400
parents ae8dd2a2f102
children 1fd08644b5ac
files tests/test-fastimport-anonbranch tests/test-fastimport-anonbranch.out
diffstat 2 files changed, 223 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-fastimport-anonbranch	Sat May 02 18:04:52 2009 -0400
@@ -0,0 +1,152 @@
+#!/bin/sh
+
+# Branching and merging, all on 'master' (aka 'default').
+# The DAG is
+#
+#    0 -- 1 -- 2 -- 4 -- 6
+#          \            /
+#           3 -- 5 -----
+
+cat > $HGRCPATH <<EOF
+[extensions]
+graphlog =
+fastimport = $TESTDIR/../fastimport
+EOF
+
+cat > anonbranch.dump <<__EOF__
+# rev 0
+commit refs/heads/master
+committer Example <example@example.org> 1200000000 +0000
+data 17
+initial revision
+
+M 644 inline foo
+data 4
+foo
+
+M 644 inline bar
+data 4
+bar
+
+# rev 1
+commit refs/heads/master
+mark :1
+committer Example <example@example.org> 1200000060 +0000
+data 20
+modify foo, add bla
+
+M 644 inline foo
+data 4
+oof
+
+M 644 inline bla
+data 4
+bla
+
+# rev 2 (continue "mainline" of master)
+commit refs/heads/master
+mark :2
+committer Example <example@example.org> 1200000090 +0000
+data 8
+add oog
+
+M 644 inline oog
+data 4
+oog
+
+# rev 3 (create branch off rev 1)
+commit refs/heads/master
+mark :3
+committer Example <example@example.org> 1200000120 +0000
+data 11
+modify bla
+
+from :1
+M 644 inline bla
+data 10
+blah blah
+
+# rev 4 (back to "mainline")
+commit refs/heads/master
+mark :4
+committer Example <example@example.org> 1200000180 +0000
+data 11
+remove oog
+
+from :2
+D oog
+
+# rev 5 (back on branch)
+commit refs/heads/master
+mark :5
+committer Example <example@example.org> 1200000210 +0000
+data 11
+modify foo
+
+from :3
+M 644 inline foo
+data 8
+foo foo
+
+# rev 6 (merge branch back to mainline: first parent is 4, second parent is 5)
+commit refs/heads/master
+committer Example <example@example.org> 1200000240 +0000
+data 6
+merge
+
+from :4
+merge :5
+# foo comes from mainline; bla comes from branch
+M 644 inline foo
+data 4
+oof
+
+M 644 inline bla
+data 10
+blah blah
+
+
+__EOF__
+
+# XXX crash if blank line after "merge" command missing, but
+# git-fast-import(1) says it's optional
+
+set -e
+echo "% import"
+rm -rf anonbranch
+hg init anonbranch
+cd anonbranch
+hg fastimport ../anonbranch.dump
+
+echo "% log"
+hg glog --template "{rev}:{node|short}\n{desc}\n\n"
+
+echo "% manifest at rev 0"
+hg manifest -r0
+
+echo "% manifest at rev 6"
+hg manifest -r6
+
+echo "% contents of foo at rev 3"
+hg cat -r3 foo
+
+echo "% contents of bla at rev 3"
+hg cat -r3 bla
+
+echo "% contents of foo at rev 5"
+hg cat -r5 foo
+
+echo "% contents of foo at rev 6"
+hg cat -r6 foo
+
+echo "% contents of bar at rev 6"
+hg cat -r6 bar
+
+echo "% contents of bla at rev 6"
+hg cat -r6 bla
+
+echo "% diff merge with first parent (rev 4:6)"
+hg diff -r4:6
+
+echo "% diff merge with second parent (rev 5:6)"
+hg diff -r5:6
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-fastimport-anonbranch.out	Sat May 02 18:04:52 2009 -0400
@@ -0,0 +1,71 @@
+% import
+Reading source: ../anonbranch.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
+1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+Done commit of rev 2
+0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+Done commit of rev 3
+2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+Done commit of rev 4
+1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+Done commit of rev 5
+2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+Done commit of rev 6
+% log
+@    6:c454087588c4
+|\   merge
+| |
+| o  5:d7502914e05c
+| |  modify foo
+| |
+o |  4:5dde14f70320
+| |  remove oog
+| |
+| o  3:66562011aee8
+| |  modify bla
+| |
+o |  2:3851fabfd46c
+|/   add oog
+|
+o  1:c09a5b11c17e
+|  modify foo, add bla
+|
+o  0:67886358f17d
+   initial revision
+
+% manifest at rev 0
+bar
+foo
+% manifest at rev 6
+bar
+bla
+foo
+% contents of foo at rev 3
+oof
+% contents of bla at rev 3
+blah blah
+% contents of foo at rev 5
+foo foo
+% contents of foo at rev 6
+oof
+% contents of bar at rev 6
+bar
+% contents of bla at rev 6
+blah blah
+% diff merge with first parent (rev 4:6)
+diff -r 5dde14f70320 -r c454087588c4 bla
+--- a/bla	Thu Jan 10 21:23:00 2008 +0000
++++ b/bla	Thu Jan 10 21:24:00 2008 +0000
+@@ -1,1 +1,1 @@
+-bla
++blah blah
+% diff merge with second parent (rev 5:6)
+diff -r d7502914e05c -r c454087588c4 foo
+--- a/foo	Thu Jan 10 21:23:30 2008 +0000
++++ b/foo	Thu Jan 10 21:24:00 2008 +0000
+@@ -1,1 +1,1 @@
+-foo foo
++oof