tests/test-convert-svn-source
author David Soria Parra <dsp@php.net>
Sun, 07 Dec 2008 08:47:02 +0100
changeset 7485 ecfb683675ed
parent 7074 b1a4f67b98d0
child 8523 5b7da468531b
permissions -rwxr-xr-x
Merge bookmarks
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
6401
635c57cf0de8 test-convert-svn-source: remove redundant tests
Patrick Mezard <pmezard@gmail.com>
parents: 5954
diff changeset
    12
echo 'hgext.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.
37c610c41ed6 Test svn repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    19
expr $svnpath : "\/" > /dev/null
37c610c41ed6 Test svn repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    20
if [ $? -ne 0 ]; then
37c610c41ed6 Test svn repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    21
    svnpath='/'$svnpath
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
7074
b1a4f67b98d0 convert: properly encode subversion URLs (issue 1224)
Patrick Mezard <pmezard@gmail.com>
parents: 6439
diff changeset
    33
svnurl=file://$svnpath/svn-repo/proj%20B
5854
8b95f598097c convert: separate trunk detection from branch layout detection
Edouard Gomez <ed.gomez@free.fr>
parents: 5804
diff changeset
    34
svn import -m "init projB" projB $svnurl | fix_path
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
8b95f598097c convert: separate trunk detection from branch layout detection
Edouard Gomez <ed.gomez@free.fr>
parents: 5804
diff changeset
    38
svn co $svnurl/trunk B | fix_path
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
8b95f598097c convert: separate trunk detection from branch layout detection
Edouard Gomez <ed.gomez@free.fr>
parents: 5804
diff changeset
    47
svn copy -m "tag v0.1" $svnurl/trunk $svnurl/tags/v0.1
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
8b95f598097c convert: separate trunk detection from branch layout detection
Edouard Gomez <ed.gomez@free.fr>
parents: 5804
diff changeset
    54
hg convert $svnurl B-hg
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
8b95f598097c convert: separate trunk detection from branch layout detection
Edouard Gomez <ed.gomez@free.fr>
parents: 5804
diff changeset
    63
svn copy -m "tag v0.2" $svnurl/trunk $svnurl/tags/v0.2
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
8b95f598097c convert: separate trunk detection from branch layout detection
Edouard Gomez <ed.gomez@free.fr>
parents: 5804
diff changeset
    72
hg convert $svnurl B-hg
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
8b95f598097c convert: separate trunk detection from branch layout detection
Edouard Gomez <ed.gomez@free.fr>
parents: 5804
diff changeset
    75
hg glog --template '#rev# #desc|firstline# files: #files#\n'
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
635c57cf0de8 test-convert-svn-source: remove redundant tests
Patrick Mezard <pmezard@gmail.com>
parents: 5954
diff changeset
    81
hg convert --filemap filemap $svnurl/trunk fmap
635c57cf0de8 test-convert-svn-source: remove redundant tests
Patrick Mezard <pmezard@gmail.com>
parents: 5954
diff changeset
    82
hg glog -R fmap --template '#rev# #desc|firstline# files: #files#\n'
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
635c57cf0de8 test-convert-svn-source: remove redundant tests
Patrick Mezard <pmezard@gmail.com>
parents: 5954
diff changeset
    85
hg convert --rev 1 $svnurl/trunk stoprev
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/=.*/=/'