tests/test-convert-svn-branches
author Bryan O'Sullivan <bos@serpentine.com>
Fri, 25 Jan 2008 16:04:46 -0800
changeset 5948 597d8402087d
parent 5874 866aa7ae2612
child 6439 c1b47c0fd2b6
permissions -rwxr-xr-x
Merge after backout
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5874
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     1
#!/bin/sh
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     2
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     3
"$TESTDIR/hghave" svn svn-bindings || exit 80
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     4
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     5
fix_path()
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     6
{
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     7
    tr '\\' /
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     8
}
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     9
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    10
echo "[extensions]" >> $HGRCPATH
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    11
echo "convert = " >> $HGRCPATH
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    12
echo "hgext.graphlog =" >> $HGRCPATH
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    13
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    14
svnadmin create svn-repo
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    15
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    16
svnpath=`pwd | fix_path`
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    17
# SVN wants all paths to start with a slash. Unfortunately,
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    18
# Windows ones don't. Handle that.
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    19
expr $svnpath : "\/" > /dev/null
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    20
if [ $? -ne 0 ]; then
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    21
    svnpath='/'$svnpath
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    22
fi
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    23
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    24
echo % initial svn import
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    25
mkdir projA
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    26
cd projA
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    27
mkdir trunk
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    28
mkdir branches
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    29
mkdir tags
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    30
cd ..
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    31
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    32
svnurl=file://$svnpath/svn-repo/projA
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    33
svn import -m "init projA" projA $svnurl | fix_path
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    34
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    35
echo % update svn repository
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    36
svn co $svnurl A | fix_path
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    37
cd A
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    38
echo hello > trunk/letter.txt
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    39
echo hey > trunk/letter2.txt
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    40
echo ho > trunk/letter3.txt
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    41
svn add trunk/letter.txt trunk/letter2.txt trunk/letter3.txt
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    42
svn ci -m hello
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    43
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    44
echo % branch to old letters
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    45
svn copy trunk branches/old
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    46
svn rm branches/old/letter3.txt
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    47
svn ci -m "branch trunk, remove letter3"
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    48
svn up
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    49
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    50
echo % update trunk
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    51
echo "what can I say ?" >> trunk/letter.txt
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    52
svn ci -m "change letter"
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    53
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    54
echo % update old branch
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    55
echo "what's up ?" >> branches/old/letter2.txt
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    56
svn ci -m "change letter2"
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    57
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    58
echo % create a cross-branch revision
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    59
svn move -m "move letter2" trunk/letter2.txt \
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    60
    branches/old/letter3.txt
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    61
echo "I am fine" >> branches/old/letter3.txt
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    62
svn ci -m "move and update letter3.txt"
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    63
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    64
echo % update old branch again
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    65
echo "bye" >> branches/old/letter2.txt
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    66
svn ci -m "change letter2 again"
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    67
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    68
echo % update trunk again
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    69
echo "how are you ?" >> trunk/letter.txt
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    70
svn ci -m "last change to letter"
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    71
cd ..
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    72
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    73
echo % convert trunk and branches
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    74
hg convert --datesort $svnurl A-hg
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    75
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    76
echo % branch again from a converted revision
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    77
cd A
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    78
svn copy -r 1 $svnurl/trunk branches/old2
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    79
svn ci -m "branch trunk@1 into old2"
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    80
cd ..
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    81
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    82
echo % convert again
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    83
hg convert --datesort $svnurl A-hg
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    84
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    85
cd A-hg
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    86
hg glog --template '#rev# #desc|firstline# files: #files#\n'
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    87
hg branches | sed 's/:.*/:/'
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    88
hg tags -q
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    89
cd ..