tests/test-convert-svn
author Matt Mackall <mpm@selenic.com>
Mon, 08 Oct 2007 18:47:06 -0500
changeset 5421 9b5d626be8ba
parent 5382 d7d395fb7cd5
child 5462 91a522a69c13
permissions -rwxr-xr-x
osutil: cleanups - use tabs - eliminate old-style function pointer calls - eliminate weird scoping - eliminate assignment-in-iff - use !foo rather than foo == NULL
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