tests/test-convert-svn-source
author Bryan O'Sullivan <bos@serpentine.com>
Fri, 11 Jan 2008 16:51:54 -0800
changeset 5848 e90a7a3c28a4
parent 5804 de8311f7a31b
child 5854 8b95f598097c
permissions -rwxr-xr-x
Merge with mpm
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5255
37c610c41ed6 Test svn repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     1
#!/bin/sh
37c610c41ed6 Test svn repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     2
37c610c41ed6 Test svn repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     3
"$TESTDIR/hghave" svn svn-bindings || exit 80
37c610c41ed6 Test svn repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     4
37c610c41ed6 Test svn repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     5
fix_path()
37c610c41ed6 Test svn repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     6
{
37c610c41ed6 Test svn repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     7
    tr '\\' /
37c610c41ed6 Test svn repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     8
}
37c610c41ed6 Test svn repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     9
37c610c41ed6 Test svn repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    10
echo "[extensions]" >> $HGRCPATH
37c610c41ed6 Test svn repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    11
echo "convert = " >> $HGRCPATH
37c610c41ed6 Test svn repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    12
37c610c41ed6 Test svn repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    13
svnadmin create svn-repo
37c610c41ed6 Test svn repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    14
37c610c41ed6 Test svn repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    15
echo % initial svn import
37c610c41ed6 Test svn repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    16
mkdir t
37c610c41ed6 Test svn repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    17
cd t
37c610c41ed6 Test svn repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    18
echo a > a
37c610c41ed6 Test svn repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    19
cd ..
37c610c41ed6 Test svn repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    20
5275
4287590a63af Fix \ inside ` problem in test-convert-svn (avoids code duplication, too)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 5255
diff changeset
    21
svnpath=`pwd | fix_path`
5255
37c610c41ed6 Test svn repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    22
# SVN wants all paths to start with a slash. Unfortunately,
37c610c41ed6 Test svn repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    23
# Windows ones don't. Handle that.
37c610c41ed6 Test svn repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    24
expr $svnpath : "\/" > /dev/null
37c610c41ed6 Test svn repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    25
if [ $? -ne 0 ]; then
37c610c41ed6 Test svn repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    26
    svnpath='/'$svnpath
37c610c41ed6 Test svn repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    27
fi
37c610c41ed6 Test svn repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    28
5804
de8311f7a31b test-convert-svn-source: test convert/multiple extra fields
Patrick Mezard <pmezard@gmail.com>
parents: 5782
diff changeset
    29
svnurl=file://$svnpath/svn-repo/trunk/test
5255
37c610c41ed6 Test svn repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    30
svn import -m init t $svnurl | fix_path
37c610c41ed6 Test svn repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    31
37c610c41ed6 Test svn repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    32
echo % update svn repository
37c610c41ed6 Test svn repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    33
svn co $svnurl t2 | fix_path
37c610c41ed6 Test svn repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    34
cd t2
37c610c41ed6 Test svn repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    35
echo b >> a
37c610c41ed6 Test svn repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    36
echo b > b
37c610c41ed6 Test svn repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    37
svn add b
37c610c41ed6 Test svn repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    38
svn ci -m changea
37c610c41ed6 Test svn repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    39
cd ..
37c610c41ed6 Test svn repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    40
37c610c41ed6 Test svn repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    41
echo % convert to hg once
37c610c41ed6 Test svn repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    42
hg convert $svnurl
37c610c41ed6 Test svn repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    43
37c610c41ed6 Test svn repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    44
echo % update svn repository again
37c610c41ed6 Test svn repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    45
cd t2
37c610c41ed6 Test svn repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    46
echo c >> a
37c610c41ed6 Test svn repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    47
echo c >> b
37c610c41ed6 Test svn repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    48
svn ci -m changeb
37c610c41ed6 Test svn repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    49
cd ..
37c610c41ed6 Test svn repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    50
37c610c41ed6 Test svn repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    51
echo % test incremental conversion
37c610c41ed6 Test svn repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    52
hg convert $svnurl
37c610c41ed6 Test svn repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    53
5382
d7d395fb7cd5 convert_svn: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5275
diff changeset
    54
echo % test filemap
d7d395fb7cd5 convert_svn: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5275
diff changeset
    55
echo 'include b' > filemap
d7d395fb7cd5 convert_svn: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5275
diff changeset
    56
hg convert --filemap filemap $svnurl fmap
d7d395fb7cd5 convert_svn: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5275
diff changeset
    57
echo '[extensions]' >> $HGRCPATH
d7d395fb7cd5 convert_svn: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5275
diff changeset
    58
echo 'hgext.graphlog =' >> $HGRCPATH
d7d395fb7cd5 convert_svn: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5275
diff changeset
    59
hg glog -R fmap --template '#rev# #desc|firstline# files: #files#\n'
d7d395fb7cd5 convert_svn: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5275
diff changeset
    60
5782
7eb1146b72ec test-convert-svn-source: test stop revision
Patrick Mezard <pmezard@gmail.com>
parents: 5513
diff changeset
    61
echo % test stop revision
7eb1146b72ec test-convert-svn-source: test stop revision
Patrick Mezard <pmezard@gmail.com>
parents: 5513
diff changeset
    62
hg convert --rev 1 $svnurl stoprev
5804
de8311f7a31b test-convert-svn-source: test convert/multiple extra fields
Patrick Mezard <pmezard@gmail.com>
parents: 5782
diff changeset
    63
# Check convert_revision extra-records.
de8311f7a31b test-convert-svn-source: test convert/multiple extra fields
Patrick Mezard <pmezard@gmail.com>
parents: 5782
diff changeset
    64
# This is also the only place testing more than one extra field
de8311f7a31b test-convert-svn-source: test convert/multiple extra fields
Patrick Mezard <pmezard@gmail.com>
parents: 5782
diff changeset
    65
# in a revision.
de8311f7a31b test-convert-svn-source: test convert/multiple extra fields
Patrick Mezard <pmezard@gmail.com>
parents: 5782
diff changeset
    66
hg --cwd stoprev tip --debug | grep extra | sed 's/=.*/=/'
5782
7eb1146b72ec test-convert-svn-source: test stop revision
Patrick Mezard <pmezard@gmail.com>
parents: 5513
diff changeset
    67
5462
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
    68
########################################
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
    69
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
    70
echo "# now tests that it works with trunk/branches/tags layout"
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
    71
echo
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
    72
echo % initial svn import
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
    73
mkdir projA
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
    74
cd projA
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
    75
mkdir trunk
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
    76
mkdir branches
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
    77
mkdir tags
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
    78
cd ..
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
    79
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
    80
svnurl=file://$svnpath/svn-repo/projA
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
    81
svn import -m "init projA" projA $svnurl | fix_path
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
    82
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
    83
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
    84
echo % update svn repository
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
    85
svn co $svnurl/trunk A | fix_path
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
    86
cd A
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
    87
echo hello > letter.txt
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
    88
svn add letter.txt
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
    89
svn ci -m hello
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
    90
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
    91
echo world >> letter.txt
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
    92
svn ci -m world
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
    93
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
    94
svn copy -m "tag v0.1" $svnurl/trunk $svnurl/tags/v0.1
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
    95
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
    96
echo 'nice day today!' >> letter.txt
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
    97
svn ci -m "nice day"
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
    98
cd ..
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
    99
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
   100
echo % convert to hg once
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
   101
hg convert $svnurl A-hg
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
   102
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
   103
echo % update svn repository again
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
   104
cd A
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
   105
echo "see second letter" >> letter.txt
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
   106
echo "nice to meet you" > letter2.txt
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
   107
svn add letter2.txt
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
   108
svn ci -m "second letter"
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
   109
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
   110
svn copy -m "tag v0.2" $svnurl/trunk $svnurl/tags/v0.2
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
   111
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
   112
echo "blah-blah-blah" >> letter2.txt
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
   113
svn ci -m "work in progress"
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
   114
cd ..
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
   115
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
   116
echo % test incremental conversion
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
   117
hg convert $svnurl A-hg
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
   118
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
   119
cd A-hg
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
   120
hg glog --template '#rev# #desc|firstline# files: #files#\n'
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
   121
hg tags -q
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
   122
cd ..