tests/test-convert-svn-branches
author Matt Mackall <mpm@selenic.com>
Sun, 03 Feb 2008 19:29:05 -0600
changeset 6004 5af5f0f9d724
parent 5874 866aa7ae2612
child 6439 c1b47c0fd2b6
permissions -rwxr-xr-x
merge: allow smarter tool configuration Add [merge-tool] hgrc section with: <tool>.executable = name or path (<tool>) <tool>.args = args with $local/base/other/output ($local $base $other) <tool>.priority = priority (default 0) <tool>.binary = handles binary (False) <tool>.symlink = handles symlinks (False) <tool>.checkconflict = check for conflict markers (False) <tool>.premerge = try internal simplemerge (True if not binary or symlink) Four built-in tools: internal:{merge,local,other,fail} Add [merge-patterns] section of the form: <pattern> = <tool> Priority of settings is: HGMERGE merge-patterns ui:merge merge-tools by priority hgmerge, if it can be found Changes: unsuccessful merges leave .orig files

#!/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 ..