changeset 5874:866aa7ae2612

Test subversion branches conversion
author Patrick Mezard <pmezard@gmail.com>
date Thu, 17 Jan 2008 23:46:56 +0100
parents ecb4eb0cbff2
children f1504d3355bb
files tests/test-convert-svn-branches tests/test-convert-svn-branches.out
diffstat 2 files changed, 190 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-convert-svn-branches	Thu Jan 17 23:46:56 2008 +0100
@@ -0,0 +1,89 @@
+#!/bin/sh
+
+"$TESTDIR/hghave" svn svn-bindings || exit 80
+
+fix_path()
+{
+    tr '\\' /
+}
+
+echo "[extensions]" >> $HGRCPATH
+echo "convert = " >> $HGRCPATH
+echo "hgext.graphlog =" >> $HGRCPATH
+
+svnadmin create svn-repo
+
+svnpath=`pwd | fix_path`
+# SVN wants all paths to start with a slash. Unfortunately,
+# Windows ones don't. Handle that.
+expr $svnpath : "\/" > /dev/null
+if [ $? -ne 0 ]; then
+    svnpath='/'$svnpath
+fi
+
+echo % initial svn import
+mkdir projA
+cd projA
+mkdir trunk
+mkdir branches
+mkdir tags
+cd ..
+
+svnurl=file://$svnpath/svn-repo/projA
+svn import -m "init projA" projA $svnurl | fix_path
+
+echo % update svn repository
+svn co $svnurl A | fix_path
+cd A
+echo hello > trunk/letter.txt
+echo hey > trunk/letter2.txt
+echo ho > trunk/letter3.txt
+svn add trunk/letter.txt trunk/letter2.txt trunk/letter3.txt
+svn ci -m hello
+
+echo % branch to old letters
+svn copy trunk branches/old
+svn rm branches/old/letter3.txt
+svn ci -m "branch trunk, remove letter3"
+svn up
+
+echo % update trunk
+echo "what can I say ?" >> trunk/letter.txt
+svn ci -m "change letter"
+
+echo % update old branch
+echo "what's up ?" >> branches/old/letter2.txt
+svn ci -m "change letter2"
+
+echo % create a cross-branch revision
+svn move -m "move letter2" trunk/letter2.txt \
+    branches/old/letter3.txt
+echo "I am fine" >> branches/old/letter3.txt
+svn ci -m "move and update letter3.txt"
+
+echo % update old branch again
+echo "bye" >> branches/old/letter2.txt
+svn ci -m "change letter2 again"
+
+echo % update trunk again
+echo "how are you ?" >> trunk/letter.txt
+svn ci -m "last change to letter"
+cd ..
+
+echo % convert trunk and branches
+hg convert --datesort $svnurl A-hg
+
+echo % branch again from a converted revision
+cd A
+svn copy -r 1 $svnurl/trunk branches/old2
+svn ci -m "branch trunk@1 into old2"
+cd ..
+
+echo % convert again
+hg convert --datesort $svnurl A-hg
+
+cd A-hg
+hg glog --template '#rev# #desc|firstline# files: #files#\n'
+hg branches | sed 's/:.*/:/'
+hg tags -q
+cd ..
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-convert-svn-branches.out	Thu Jan 17 23:46:56 2008 +0100
@@ -0,0 +1,101 @@
+% initial svn import
+Adding         projA/trunk
+Adding         projA/branches
+Adding         projA/tags
+
+Committed revision 1.
+% update svn repository
+A    A/trunk
+A    A/branches
+A    A/tags
+Checked out revision 1.
+A         trunk/letter.txt
+A         trunk/letter2.txt
+A         trunk/letter3.txt
+Adding         trunk/letter.txt
+Adding         trunk/letter2.txt
+Adding         trunk/letter3.txt
+Transmitting file data ...
+Committed revision 2.
+% branch to old letters
+A         branches/old
+D         branches/old/letter3.txt
+Adding         branches/old
+Adding         branches/old/letter.txt
+Adding         branches/old/letter2.txt
+Deleting       branches/old/letter3.txt
+
+Committed revision 3.
+At revision 3.
+% update trunk
+Sending        trunk/letter.txt
+Transmitting file data .
+Committed revision 4.
+% update old branch
+Sending        branches/old/letter2.txt
+Transmitting file data .
+Committed revision 5.
+% create a cross-branch revision
+A         branches/old/letter3.txt
+D         trunk/letter2.txt
+Adding         branches/old/letter3.txt
+Deleting       trunk/letter2.txt
+Transmitting file data .
+Committed revision 6.
+% update old branch again
+Sending        branches/old/letter2.txt
+Transmitting file data .
+Committed revision 7.
+% update trunk again
+Sending        trunk/letter.txt
+Transmitting file data .
+Committed revision 8.
+% convert trunk and branches
+initializing destination A-hg repository
+scanning source...
+sorting...
+converting...
+8 init projA
+7 hello
+6 branch trunk, remove letter3
+5 change letter
+4 change letter2
+3 move and update letter3.txt
+2 move and update letter3.txt
+1 change letter2 again
+0 last change to letter
+% branch again from a converted revision
+Checked out revision 1.
+A         branches/old2
+Adding         branches/old2
+
+Committed revision 9.
+% convert again
+scanning source...
+sorting...
+converting...
+0 branch trunk@1 into old2
+o  9 branch trunk@1 into old2 files:
+|
+| o  8 last change to letter files: letter.txt
+| |
+| | o  7 change letter2 again files: letter2.txt
+| | |
+| o |  6 move and update letter3.txt files: letter2.txt
+| | |
+| | o  5 move and update letter3.txt files: letter3.txt
+| | |
+| | o  4 change letter2 files: letter2.txt
+| | |
+| o |  3 change letter files: letter.txt
+| | |
++---o  2 branch trunk, remove letter3 files: letter.txt letter.txt letter2.txt letter2.txt
+| |
+| o  1 hello files: letter.txt letter2.txt letter3.txt
+|/
+o  0 init projA files:
+
+old2                           9:
+default                        8:
+old                            7:
+tip