tests/test-convert-cvs
author Nicolas Dumazet <nicdumz.commits@gmail.com>
Fri, 17 Apr 2009 20:10:47 +0900
changeset 8553 e387ecd7a6ed
parent 8523 5b7da468531b
child 9602 fc493cb90bb1
permissions -rwxr-xr-x
inotify: change protocol so that different query types can be supported.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5307
5b0b0834419c convert: test cvs repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     1
#!/bin/sh
5b0b0834419c convert: test cvs repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     2
5b0b0834419c convert: test cvs repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     3
"$TESTDIR/hghave" cvs cvsps || exit 80
5b0b0834419c convert: test cvs repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     4
5750
206b44764340 test-convert-cvs: force cvs -f options to avoid cvsrc
Patrick Mezard <pmezard@gmail.com>
parents: 5697
diff changeset
     5
cvscall()
206b44764340 test-convert-cvs: force cvs -f options to avoid cvsrc
Patrick Mezard <pmezard@gmail.com>
parents: 5697
diff changeset
     6
{
206b44764340 test-convert-cvs: force cvs -f options to avoid cvsrc
Patrick Mezard <pmezard@gmail.com>
parents: 5697
diff changeset
     7
    cvs -f $@
206b44764340 test-convert-cvs: force cvs -f options to avoid cvsrc
Patrick Mezard <pmezard@gmail.com>
parents: 5697
diff changeset
     8
}
206b44764340 test-convert-cvs: force cvs -f options to avoid cvsrc
Patrick Mezard <pmezard@gmail.com>
parents: 5697
diff changeset
     9
6717
2011bb8ada9a convert: hg sink commits without working dir
Patrick Mezard <pmezard@gmail.com>
parents: 6342
diff changeset
    10
hgcat()
2011bb8ada9a convert: hg sink commits without working dir
Patrick Mezard <pmezard@gmail.com>
parents: 6342
diff changeset
    11
{
2011bb8ada9a convert: hg sink commits without working dir
Patrick Mezard <pmezard@gmail.com>
parents: 6342
diff changeset
    12
    hg --cwd src-hg cat -r tip "$1"
2011bb8ada9a convert: hg sink commits without working dir
Patrick Mezard <pmezard@gmail.com>
parents: 6342
diff changeset
    13
}
2011bb8ada9a convert: hg sink commits without working dir
Patrick Mezard <pmezard@gmail.com>
parents: 6342
diff changeset
    14
7101
e786192d995d convert: make built-in cvsps the default
Patrick Mezard <pmezard@gmail.com>
parents: 6717
diff changeset
    15
# Test legacy configuration with external cvsps
5307
5b0b0834419c convert: test cvs repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    16
echo "[extensions]" >> $HGRCPATH
5b0b0834419c convert: test cvs repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    17
echo "convert = " >> $HGRCPATH
7101
e786192d995d convert: make built-in cvsps the default
Patrick Mezard <pmezard@gmail.com>
parents: 6717
diff changeset
    18
echo "graphlog = " >> $HGRCPATH
e786192d995d convert: make built-in cvsps the default
Patrick Mezard <pmezard@gmail.com>
parents: 6717
diff changeset
    19
echo "[convert]" >> $HGRCPATH
e786192d995d convert: make built-in cvsps the default
Patrick Mezard <pmezard@gmail.com>
parents: 6717
diff changeset
    20
echo "cvsps=cvsps -A -u --cvs-direct -q" >> $HGRCPATH
5307
5b0b0834419c convert: test cvs repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    21
5b0b0834419c convert: test cvs repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    22
echo % create cvs repository
5b0b0834419c convert: test cvs repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    23
mkdir cvsrepo
5b0b0834419c convert: test cvs repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    24
cd cvsrepo
8350
1f0f01bc86a5 tests: avoid export FOO=bar bashism
Martin Geisler <mg@lazybytes.net>
parents: 7812
diff changeset
    25
CVSROOT=`pwd`
1f0f01bc86a5 tests: avoid export FOO=bar bashism
Martin Geisler <mg@lazybytes.net>
parents: 7812
diff changeset
    26
export CVSROOT
1f0f01bc86a5 tests: avoid export FOO=bar bashism
Martin Geisler <mg@lazybytes.net>
parents: 7812
diff changeset
    27
CVS_OPTIONS=-f
1f0f01bc86a5 tests: avoid export FOO=bar bashism
Martin Geisler <mg@lazybytes.net>
parents: 7812
diff changeset
    28
export CVS_OPTIONS
5307
5b0b0834419c convert: test cvs repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    29
cd ..
5b0b0834419c convert: test cvs repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    30
5750
206b44764340 test-convert-cvs: force cvs -f options to avoid cvsrc
Patrick Mezard <pmezard@gmail.com>
parents: 5697
diff changeset
    31
cvscall -q -d "$CVSROOT" init
5307
5b0b0834419c convert: test cvs repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    32
5b0b0834419c convert: test cvs repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    33
echo % create source directory
5b0b0834419c convert: test cvs repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    34
mkdir src-temp
5b0b0834419c convert: test cvs repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    35
cd src-temp
5b0b0834419c convert: test cvs repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    36
echo a > a
5b0b0834419c convert: test cvs repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    37
mkdir b
5b0b0834419c convert: test cvs repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    38
cd b
5b0b0834419c convert: test cvs repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    39
echo c > c
5b0b0834419c convert: test cvs repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    40
cd ..
5b0b0834419c convert: test cvs repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    41
5b0b0834419c convert: test cvs repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    42
echo % import source directory
5750
206b44764340 test-convert-cvs: force cvs -f options to avoid cvsrc
Patrick Mezard <pmezard@gmail.com>
parents: 5697
diff changeset
    43
cvscall -q import -m import src INITIAL start
5307
5b0b0834419c convert: test cvs repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    44
cd ..
5b0b0834419c convert: test cvs repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    45
5b0b0834419c convert: test cvs repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    46
echo % checkout source directory
5750
206b44764340 test-convert-cvs: force cvs -f options to avoid cvsrc
Patrick Mezard <pmezard@gmail.com>
parents: 5697
diff changeset
    47
cvscall -q checkout src
5307
5b0b0834419c convert: test cvs repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    48
5381
6874368120dc convert_cvs: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5364
diff changeset
    49
echo % commit a new revision changing b/c
6874368120dc convert_cvs: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5364
diff changeset
    50
cd src
6342
92444fa7190b tests: make test-convertcvs repeatable
Matt Mackall <mpm@selenic.com>
parents: 5921
diff changeset
    51
sleep 1
5381
6874368120dc convert_cvs: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5364
diff changeset
    52
echo c >> b/c
5750
206b44764340 test-convert-cvs: force cvs -f options to avoid cvsrc
Patrick Mezard <pmezard@gmail.com>
parents: 5697
diff changeset
    53
cvscall -q commit -mci0 . | grep '<--' |\
5381
6874368120dc convert_cvs: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5364
diff changeset
    54
    sed -e 's:.*src/\(.*\),v.*:checking in src/\1,v:g'
6874368120dc convert_cvs: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5364
diff changeset
    55
cd ..
6874368120dc convert_cvs: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5364
diff changeset
    56
5307
5b0b0834419c convert: test cvs repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    57
echo % convert fresh repo
5b0b0834419c convert: test cvs repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    58
hg convert src src-hg | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g'
6717
2011bb8ada9a convert: hg sink commits without working dir
Patrick Mezard <pmezard@gmail.com>
parents: 6342
diff changeset
    59
hgcat a
2011bb8ada9a convert: hg sink commits without working dir
Patrick Mezard <pmezard@gmail.com>
parents: 6342
diff changeset
    60
hgcat b/c
5307
5b0b0834419c convert: test cvs repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    61
5381
6874368120dc convert_cvs: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5364
diff changeset
    62
echo % convert fresh repo with --filemap
6874368120dc convert_cvs: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5364
diff changeset
    63
echo include b/c > filemap
6874368120dc convert_cvs: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5364
diff changeset
    64
hg convert --filemap filemap src src-filemap | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g'
6717
2011bb8ada9a convert: hg sink commits without working dir
Patrick Mezard <pmezard@gmail.com>
parents: 6342
diff changeset
    65
hgcat b/c
8523
5b7da468531b tests: replace #...# syntax with {...}
Martin Geisler <mg@lazybytes.net>
parents: 8350
diff changeset
    66
hg -R src-filemap log --template '{rev} {desc} files: {files}\n'
5381
6874368120dc convert_cvs: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5364
diff changeset
    67
5307
5b0b0834419c convert: test cvs repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    68
echo % commit new file revisions
5b0b0834419c convert: test cvs repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    69
cd src
5b0b0834419c convert: test cvs repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    70
echo a >> a
5b0b0834419c convert: test cvs repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    71
echo c >> b/c
5750
206b44764340 test-convert-cvs: force cvs -f options to avoid cvsrc
Patrick Mezard <pmezard@gmail.com>
parents: 5697
diff changeset
    72
cvscall -q commit -mci1 . | grep '<--' |\
5364
645a40777fd4 test-convert-cvs: handle older cvs client
Christian Ebert <blacktrash@gmx.net>
parents: 5307
diff changeset
    73
    sed -e 's:.*src/\(.*\),v.*:checking in src/\1,v:g'
5307
5b0b0834419c convert: test cvs repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    74
cd ..
5b0b0834419c convert: test cvs repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    75
5b0b0834419c convert: test cvs repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    76
echo % convert again
5b0b0834419c convert: test cvs repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    77
hg convert src src-hg | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g'
6717
2011bb8ada9a convert: hg sink commits without working dir
Patrick Mezard <pmezard@gmail.com>
parents: 6342
diff changeset
    78
hgcat a
2011bb8ada9a convert: hg sink commits without working dir
Patrick Mezard <pmezard@gmail.com>
parents: 6342
diff changeset
    79
hgcat b/c
5307
5b0b0834419c convert: test cvs repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    80
5381
6874368120dc convert_cvs: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5364
diff changeset
    81
echo % convert again with --filemap
6874368120dc convert_cvs: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5364
diff changeset
    82
hg convert --filemap filemap src src-filemap | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g'
6717
2011bb8ada9a convert: hg sink commits without working dir
Patrick Mezard <pmezard@gmail.com>
parents: 6342
diff changeset
    83
hgcat b/c
8523
5b7da468531b tests: replace #...# syntax with {...}
Martin Geisler <mg@lazybytes.net>
parents: 8350
diff changeset
    84
hg -R src-filemap log --template '{rev} {desc} files: {files}\n'
5307
5b0b0834419c convert: test cvs repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    85
5919
badf5711bd86 Test for converting a CVS branch
Thomas Arendsen Hein <thomas@intevation.de>
parents: 5381
diff changeset
    86
echo % commit branch
badf5711bd86 Test for converting a CVS branch
Thomas Arendsen Hein <thomas@intevation.de>
parents: 5381
diff changeset
    87
cd src
badf5711bd86 Test for converting a CVS branch
Thomas Arendsen Hein <thomas@intevation.de>
parents: 5381
diff changeset
    88
cvs -q update -r1.1 b/c
badf5711bd86 Test for converting a CVS branch
Thomas Arendsen Hein <thomas@intevation.de>
parents: 5381
diff changeset
    89
cvs -q tag -b branch
7812
18048153fd4e test-convert-cvs*: mute output from "cvs up"
Mads Kiilerich <mads@kiilerich.com>
parents: 7101
diff changeset
    90
cvs -q update -r branch > /dev/null
5919
badf5711bd86 Test for converting a CVS branch
Thomas Arendsen Hein <thomas@intevation.de>
parents: 5381
diff changeset
    91
echo d >> b/c
badf5711bd86 Test for converting a CVS branch
Thomas Arendsen Hein <thomas@intevation.de>
parents: 5381
diff changeset
    92
cvs -q commit -mci2 . | grep '<--' |\
badf5711bd86 Test for converting a CVS branch
Thomas Arendsen Hein <thomas@intevation.de>
parents: 5381
diff changeset
    93
    sed -e 's:.*src/\(.*\),v.*:checking in src/\1,v:g'
badf5711bd86 Test for converting a CVS branch
Thomas Arendsen Hein <thomas@intevation.de>
parents: 5381
diff changeset
    94
cd ..
badf5711bd86 Test for converting a CVS branch
Thomas Arendsen Hein <thomas@intevation.de>
parents: 5381
diff changeset
    95
badf5711bd86 Test for converting a CVS branch
Thomas Arendsen Hein <thomas@intevation.de>
parents: 5381
diff changeset
    96
echo % convert again
badf5711bd86 Test for converting a CVS branch
Thomas Arendsen Hein <thomas@intevation.de>
parents: 5381
diff changeset
    97
hg convert src src-hg | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g'
6717
2011bb8ada9a convert: hg sink commits without working dir
Patrick Mezard <pmezard@gmail.com>
parents: 6342
diff changeset
    98
hgcat a
2011bb8ada9a convert: hg sink commits without working dir
Patrick Mezard <pmezard@gmail.com>
parents: 6342
diff changeset
    99
hgcat b/c
5919
badf5711bd86 Test for converting a CVS branch
Thomas Arendsen Hein <thomas@intevation.de>
parents: 5381
diff changeset
   100
badf5711bd86 Test for converting a CVS branch
Thomas Arendsen Hein <thomas@intevation.de>
parents: 5381
diff changeset
   101
echo % convert again with --filemap
badf5711bd86 Test for converting a CVS branch
Thomas Arendsen Hein <thomas@intevation.de>
parents: 5381
diff changeset
   102
hg convert --filemap filemap src src-filemap | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g'
6717
2011bb8ada9a convert: hg sink commits without working dir
Patrick Mezard <pmezard@gmail.com>
parents: 6342
diff changeset
   103
hgcat b/c
8523
5b7da468531b tests: replace #...# syntax with {...}
Martin Geisler <mg@lazybytes.net>
parents: 8350
diff changeset
   104
hg -R src-filemap log --template '{rev} {desc} files: {files}\n'
5b7da468531b tests: replace #...# syntax with {...}
Martin Geisler <mg@lazybytes.net>
parents: 8350
diff changeset
   105
hg -R src-hg glog --template '{rev} ({branches}) {desc} files: {files}\n'