tests/test-convert-svn-source
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
Fri, 20 Aug 2010 00:17:50 +0200
changeset 11995 ff84cd2bdfaf
parent 10775 c52057614c72
permissions -rwxr-xr-x
revlog.revision(): minor cleanup Rename some variables, making the name more obvious (in particular "cache" was actually two different variable. Move code around, moving the index preloading before the deltachain computation, without that index preloading was useless (everything was read in deltachain).
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
10119
bb5ea66789e3 tests: load with "ext =" instead of "hgext.ext ="
Martin Geisler <mg@lazybytes.net>
parents: 8523
diff changeset
    12
echo 'graphlog =' >> $HGRCPATH
5255
37c610c41ed6 Test svn repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    13
37c610c41ed6 Test svn repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    14
svnadmin create svn-repo
37c610c41ed6 Test svn repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    15
5275
4287590a63af Fix \ inside ` problem in test-convert-svn (avoids code duplication, too)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 5255
diff changeset
    16
svnpath=`pwd | fix_path`
5255
37c610c41ed6 Test svn repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    17
# SVN wants all paths to start with a slash. Unfortunately,
37c610c41ed6 Test svn repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    18
# Windows ones don't. Handle that.
10775
c52057614c72 Tests with spaces in paths
Mads Kiilerich <mads@kiilerich.com>
parents: 10119
diff changeset
    19
expr "$svnpath" : "\/" > /dev/null
5255
37c610c41ed6 Test svn repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    20
if [ $? -ne 0 ]; then
10775
c52057614c72 Tests with spaces in paths
Mads Kiilerich <mads@kiilerich.com>
parents: 10119
diff changeset
    21
    svnpath="/$svnpath"
5255
37c610c41ed6 Test svn repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    22
fi
37c610c41ed6 Test svn repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    23
5854
8b95f598097c convert: separate trunk detection from branch layout detection
Edouard Gomez <ed.gomez@free.fr>
parents: 5804
diff changeset
    24
echo "# now tests that it works with trunk/tags layout, but no branches yet"
8b95f598097c convert: separate trunk detection from branch layout detection
Edouard Gomez <ed.gomez@free.fr>
parents: 5804
diff changeset
    25
echo
8b95f598097c convert: separate trunk detection from branch layout detection
Edouard Gomez <ed.gomez@free.fr>
parents: 5804
diff changeset
    26
echo % initial svn import
8b95f598097c convert: separate trunk detection from branch layout detection
Edouard Gomez <ed.gomez@free.fr>
parents: 5804
diff changeset
    27
mkdir projB
8b95f598097c convert: separate trunk detection from branch layout detection
Edouard Gomez <ed.gomez@free.fr>
parents: 5804
diff changeset
    28
cd projB
8b95f598097c convert: separate trunk detection from branch layout detection
Edouard Gomez <ed.gomez@free.fr>
parents: 5804
diff changeset
    29
mkdir trunk
8b95f598097c convert: separate trunk detection from branch layout detection
Edouard Gomez <ed.gomez@free.fr>
parents: 5804
diff changeset
    30
mkdir tags
8b95f598097c convert: separate trunk detection from branch layout detection
Edouard Gomez <ed.gomez@free.fr>
parents: 5804
diff changeset
    31
cd ..
8b95f598097c convert: separate trunk detection from branch layout detection
Edouard Gomez <ed.gomez@free.fr>
parents: 5804
diff changeset
    32
10775
c52057614c72 Tests with spaces in paths
Mads Kiilerich <mads@kiilerich.com>
parents: 10119
diff changeset
    33
svnurl="file://$svnpath/svn-repo/proj%20B"
c52057614c72 Tests with spaces in paths
Mads Kiilerich <mads@kiilerich.com>
parents: 10119
diff changeset
    34
svn import -m "init projB" projB "$svnurl" | fix_path
5854
8b95f598097c convert: separate trunk detection from branch layout detection
Edouard Gomez <ed.gomez@free.fr>
parents: 5804
diff changeset
    35
8b95f598097c convert: separate trunk detection from branch layout detection
Edouard Gomez <ed.gomez@free.fr>
parents: 5804
diff changeset
    36
8b95f598097c convert: separate trunk detection from branch layout detection
Edouard Gomez <ed.gomez@free.fr>
parents: 5804
diff changeset
    37
echo % update svn repository
10775
c52057614c72 Tests with spaces in paths
Mads Kiilerich <mads@kiilerich.com>
parents: 10119
diff changeset
    38
svn co "$svnurl"/trunk B | fix_path
5854
8b95f598097c convert: separate trunk detection from branch layout detection
Edouard Gomez <ed.gomez@free.fr>
parents: 5804
diff changeset
    39
cd B
7074
b1a4f67b98d0 convert: properly encode subversion URLs (issue 1224)
Patrick Mezard <pmezard@gmail.com>
parents: 6439
diff changeset
    40
echo hello > 'letter .txt'
b1a4f67b98d0 convert: properly encode subversion URLs (issue 1224)
Patrick Mezard <pmezard@gmail.com>
parents: 6439
diff changeset
    41
svn add 'letter .txt'
5854
8b95f598097c convert: separate trunk detection from branch layout detection
Edouard Gomez <ed.gomez@free.fr>
parents: 5804
diff changeset
    42
svn ci -m hello
8b95f598097c convert: separate trunk detection from branch layout detection
Edouard Gomez <ed.gomez@free.fr>
parents: 5804
diff changeset
    43
7074
b1a4f67b98d0 convert: properly encode subversion URLs (issue 1224)
Patrick Mezard <pmezard@gmail.com>
parents: 6439
diff changeset
    44
"$TESTDIR/svn-safe-append.py" world 'letter .txt'
5854
8b95f598097c convert: separate trunk detection from branch layout detection
Edouard Gomez <ed.gomez@free.fr>
parents: 5804
diff changeset
    45
svn ci -m world
8b95f598097c convert: separate trunk detection from branch layout detection
Edouard Gomez <ed.gomez@free.fr>
parents: 5804
diff changeset
    46
10775
c52057614c72 Tests with spaces in paths
Mads Kiilerich <mads@kiilerich.com>
parents: 10119
diff changeset
    47
svn copy -m "tag v0.1" "$svnurl"/trunk "$svnurl"/tags/v0.1
5854
8b95f598097c convert: separate trunk detection from branch layout detection
Edouard Gomez <ed.gomez@free.fr>
parents: 5804
diff changeset
    48
7074
b1a4f67b98d0 convert: properly encode subversion URLs (issue 1224)
Patrick Mezard <pmezard@gmail.com>
parents: 6439
diff changeset
    49
"$TESTDIR/svn-safe-append.py" 'nice day today!' 'letter .txt'
5854
8b95f598097c convert: separate trunk detection from branch layout detection
Edouard Gomez <ed.gomez@free.fr>
parents: 5804
diff changeset
    50
svn ci -m "nice day"
8b95f598097c convert: separate trunk detection from branch layout detection
Edouard Gomez <ed.gomez@free.fr>
parents: 5804
diff changeset
    51
cd ..
8b95f598097c convert: separate trunk detection from branch layout detection
Edouard Gomez <ed.gomez@free.fr>
parents: 5804
diff changeset
    52
8b95f598097c convert: separate trunk detection from branch layout detection
Edouard Gomez <ed.gomez@free.fr>
parents: 5804
diff changeset
    53
echo % convert to hg once
10775
c52057614c72 Tests with spaces in paths
Mads Kiilerich <mads@kiilerich.com>
parents: 10119
diff changeset
    54
hg convert "$svnurl" B-hg
5854
8b95f598097c convert: separate trunk detection from branch layout detection
Edouard Gomez <ed.gomez@free.fr>
parents: 5804
diff changeset
    55
8b95f598097c convert: separate trunk detection from branch layout detection
Edouard Gomez <ed.gomez@free.fr>
parents: 5804
diff changeset
    56
echo % update svn repository again
8b95f598097c convert: separate trunk detection from branch layout detection
Edouard Gomez <ed.gomez@free.fr>
parents: 5804
diff changeset
    57
cd B
7074
b1a4f67b98d0 convert: properly encode subversion URLs (issue 1224)
Patrick Mezard <pmezard@gmail.com>
parents: 6439
diff changeset
    58
"$TESTDIR/svn-safe-append.py" "see second letter" 'letter .txt'
5854
8b95f598097c convert: separate trunk detection from branch layout detection
Edouard Gomez <ed.gomez@free.fr>
parents: 5804
diff changeset
    59
echo "nice to meet you" > letter2.txt
8b95f598097c convert: separate trunk detection from branch layout detection
Edouard Gomez <ed.gomez@free.fr>
parents: 5804
diff changeset
    60
svn add letter2.txt
8b95f598097c convert: separate trunk detection from branch layout detection
Edouard Gomez <ed.gomez@free.fr>
parents: 5804
diff changeset
    61
svn ci -m "second letter"
8b95f598097c convert: separate trunk detection from branch layout detection
Edouard Gomez <ed.gomez@free.fr>
parents: 5804
diff changeset
    62
10775
c52057614c72 Tests with spaces in paths
Mads Kiilerich <mads@kiilerich.com>
parents: 10119
diff changeset
    63
svn copy -m "tag v0.2" "$svnurl"/trunk "$svnurl"/tags/v0.2
5854
8b95f598097c convert: separate trunk detection from branch layout detection
Edouard Gomez <ed.gomez@free.fr>
parents: 5804
diff changeset
    64
6439
c1b47c0fd2b6 convert: fix test-convert-svn-* problems with mtime not changing
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 6401
diff changeset
    65
"$TESTDIR/svn-safe-append.py" "blah-blah-blah" letter2.txt
5854
8b95f598097c convert: separate trunk detection from branch layout detection
Edouard Gomez <ed.gomez@free.fr>
parents: 5804
diff changeset
    66
svn ci -m "work in progress"
8b95f598097c convert: separate trunk detection from branch layout detection
Edouard Gomez <ed.gomez@free.fr>
parents: 5804
diff changeset
    67
cd ..
8b95f598097c convert: separate trunk detection from branch layout detection
Edouard Gomez <ed.gomez@free.fr>
parents: 5804
diff changeset
    68
6401
635c57cf0de8 test-convert-svn-source: remove redundant tests
Patrick Mezard <pmezard@gmail.com>
parents: 5954
diff changeset
    69
########################################
635c57cf0de8 test-convert-svn-source: remove redundant tests
Patrick Mezard <pmezard@gmail.com>
parents: 5954
diff changeset
    70
5854
8b95f598097c convert: separate trunk detection from branch layout detection
Edouard Gomez <ed.gomez@free.fr>
parents: 5804
diff changeset
    71
echo % test incremental conversion
10775
c52057614c72 Tests with spaces in paths
Mads Kiilerich <mads@kiilerich.com>
parents: 10119
diff changeset
    72
hg convert "$svnurl" B-hg
5854
8b95f598097c convert: separate trunk detection from branch layout detection
Edouard Gomez <ed.gomez@free.fr>
parents: 5804
diff changeset
    73
8b95f598097c convert: separate trunk detection from branch layout detection
Edouard Gomez <ed.gomez@free.fr>
parents: 5804
diff changeset
    74
cd B-hg
8523
5b7da468531b tests: replace #...# syntax with {...}
Martin Geisler <mg@lazybytes.net>
parents: 7074
diff changeset
    75
hg glog --template '{rev} {desc|firstline} files: {files}\n'
5854
8b95f598097c convert: separate trunk detection from branch layout detection
Edouard Gomez <ed.gomez@free.fr>
parents: 5804
diff changeset
    76
hg tags -q
8b95f598097c convert: separate trunk detection from branch layout detection
Edouard Gomez <ed.gomez@free.fr>
parents: 5804
diff changeset
    77
cd ..
6401
635c57cf0de8 test-convert-svn-source: remove redundant tests
Patrick Mezard <pmezard@gmail.com>
parents: 5954
diff changeset
    78
635c57cf0de8 test-convert-svn-source: remove redundant tests
Patrick Mezard <pmezard@gmail.com>
parents: 5954
diff changeset
    79
echo % test filemap
635c57cf0de8 test-convert-svn-source: remove redundant tests
Patrick Mezard <pmezard@gmail.com>
parents: 5954
diff changeset
    80
echo 'include letter2.txt' > filemap
10775
c52057614c72 Tests with spaces in paths
Mads Kiilerich <mads@kiilerich.com>
parents: 10119
diff changeset
    81
hg convert --filemap filemap "$svnurl"/trunk fmap
8523
5b7da468531b tests: replace #...# syntax with {...}
Martin Geisler <mg@lazybytes.net>
parents: 7074
diff changeset
    82
hg glog -R fmap --template '{rev} {desc|firstline} files: {files}\n'
6401
635c57cf0de8 test-convert-svn-source: remove redundant tests
Patrick Mezard <pmezard@gmail.com>
parents: 5954
diff changeset
    83
635c57cf0de8 test-convert-svn-source: remove redundant tests
Patrick Mezard <pmezard@gmail.com>
parents: 5954
diff changeset
    84
echo % test stop revision
10775
c52057614c72 Tests with spaces in paths
Mads Kiilerich <mads@kiilerich.com>
parents: 10119
diff changeset
    85
hg convert --rev 1 "$svnurl"/trunk stoprev
6401
635c57cf0de8 test-convert-svn-source: remove redundant tests
Patrick Mezard <pmezard@gmail.com>
parents: 5954
diff changeset
    86
# Check convert_revision extra-records.
635c57cf0de8 test-convert-svn-source: remove redundant tests
Patrick Mezard <pmezard@gmail.com>
parents: 5954
diff changeset
    87
# This is also the only place testing more than one extra field
635c57cf0de8 test-convert-svn-source: remove redundant tests
Patrick Mezard <pmezard@gmail.com>
parents: 5954
diff changeset
    88
# in a revision.
635c57cf0de8 test-convert-svn-source: remove redundant tests
Patrick Mezard <pmezard@gmail.com>
parents: 5954
diff changeset
    89
hg --cwd stoprev tip --debug | grep extra | sed 's/=.*/=/'