tests/test-convert-svn-source
author Thomas Arendsen Hein <thomas@intevation.de>
Fri, 04 Jan 2008 07:44:07 +0100
changeset 5795 520a8d9d92ed
parent 5782 7eb1146b72ec
child 5804 de8311f7a31b
permissions -rwxr-xr-x
merge with main
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
37c610c41ed6 Test svn repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    29
svnurl=file://$svnpath/svn-repo/trunk
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
7eb1146b72ec test-convert-svn-source: test stop revision
Patrick Mezard <pmezard@gmail.com>
parents: 5513
diff changeset
    63
5462
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
    64
########################################
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
    65
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
    66
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
    67
echo
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
    68
echo % initial svn import
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
    69
mkdir projA
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
    70
cd projA
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
    71
mkdir trunk
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
    72
mkdir branches
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
    73
mkdir tags
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
    74
cd ..
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
    75
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
    76
svnurl=file://$svnpath/svn-repo/projA
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
    77
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
    78
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
echo % update svn repository
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
    81
svn co $svnurl/trunk A | fix_path
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
    82
cd A
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
    83
echo hello > letter.txt
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
    84
svn add letter.txt
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
    85
svn ci -m hello
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
    86
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
    87
echo world >> letter.txt
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
    88
svn ci -m world
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
    89
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
    90
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
    91
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
    92
echo 'nice day today!' >> letter.txt
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
    93
svn ci -m "nice day"
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
    94
cd ..
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 % convert to hg once
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
    97
hg convert $svnurl A-hg
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
    98
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
    99
echo % update svn repository again
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
   100
cd A
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
   101
echo "see second letter" >> letter.txt
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
   102
echo "nice to meet you" > letter2.txt
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
   103
svn add letter2.txt
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
   104
svn ci -m "second letter"
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
   105
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
   106
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
   107
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
   108
echo "blah-blah-blah" >> letter2.txt
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
   109
svn ci -m "work in progress"
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
   110
cd ..
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 % test incremental conversion
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
   113
hg convert $svnurl A-hg
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
   114
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
   115
cd A-hg
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
   116
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
   117
hg tags -q
91a522a69c13 convert: svn -- fix tags handling
Kirill Smelkov <kirr@landau.phys.spbu.ru>
parents: 5382
diff changeset
   118
cd ..