tests/test-convert-cvs
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
Sun, 23 Mar 2008 21:03:24 -0300
changeset 6370 6440e25a1ba3
parent 6342 92444fa7190b
child 6717 2011bb8ada9a
permissions -rwxr-xr-x
localrepo.commit: grab locks before getting the list of files to commit Somebody may change the dirstate after we've determined the parents of the working dir and run repo.status, but before we called wlock(). This should also fix issue997, where backout would change a file without changing its size and then call repo.commit without passing the list of files. If this happened in less than one second, we wouldn't detect any file changes - the in-memory dirstate still has the cached stat data for that file. Grabbing the wlock early causes the dirstate to be invalidated and we end up reading the dirstate file again, which has that file marked for lookup (size == -1). A better fix would be for backout to give repo.commit the exact list of files, but that'll require some changes to the revert operation. A significant user-visible change is that the precommit hook is always run with both locks grabbed - previously, hg commit would run it before grabbing any locks, but hg import would run it after grabbing locks.
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
5307
5b0b0834419c convert: test cvs repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    10
echo "[extensions]" >> $HGRCPATH
5b0b0834419c convert: test cvs repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    11
echo "convert = " >> $HGRCPATH
5b0b0834419c convert: test cvs repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    12
5b0b0834419c convert: test cvs repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    13
echo % create cvs repository
5b0b0834419c convert: test cvs repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    14
mkdir cvsrepo
5b0b0834419c convert: test cvs repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    15
cd cvsrepo
5b0b0834419c convert: test cvs repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    16
export CVSROOT=`pwd`
5697
98f45e141567 convert: don't read ~/.cvsrc in test-convert-cvs
Maxim Dounin <mdounin@mdounin.ru>
parents: 5381
diff changeset
    17
export CVS_OPTIONS=-f
5307
5b0b0834419c convert: test cvs repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    18
cd ..
5b0b0834419c convert: test cvs repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    19
5750
206b44764340 test-convert-cvs: force cvs -f options to avoid cvsrc
Patrick Mezard <pmezard@gmail.com>
parents: 5697
diff changeset
    20
cvscall -q -d "$CVSROOT" init
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 source directory
5b0b0834419c convert: test cvs repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    23
mkdir src-temp
5b0b0834419c convert: test cvs repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    24
cd src-temp
5b0b0834419c convert: test cvs repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    25
echo a > a
5b0b0834419c convert: test cvs repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    26
mkdir b
5b0b0834419c convert: test cvs repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    27
cd b
5b0b0834419c convert: test cvs repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    28
echo c > c
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
5b0b0834419c convert: test cvs repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    31
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
    32
cvscall -q import -m import src INITIAL start
5307
5b0b0834419c convert: test cvs repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    33
cd ..
5b0b0834419c convert: test cvs repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    34
5b0b0834419c convert: test cvs repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    35
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
    36
cvscall -q checkout src
5307
5b0b0834419c convert: test cvs repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    37
5381
6874368120dc convert_cvs: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5364
diff changeset
    38
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
    39
cd src
6342
92444fa7190b tests: make test-convertcvs repeatable
Matt Mackall <mpm@selenic.com>
parents: 5921
diff changeset
    40
sleep 1
5381
6874368120dc convert_cvs: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5364
diff changeset
    41
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
    42
cvscall -q commit -mci0 . | grep '<--' |\
5381
6874368120dc convert_cvs: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5364
diff changeset
    43
    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
    44
cd ..
6874368120dc convert_cvs: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5364
diff changeset
    45
5307
5b0b0834419c convert: test cvs repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    46
echo % convert fresh repo
5b0b0834419c convert: test cvs repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    47
hg convert src src-hg | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g'
5b0b0834419c convert: test cvs repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    48
cat src-hg/a
5b0b0834419c convert: test cvs repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    49
cat src-hg/b/c
5b0b0834419c convert: test cvs repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    50
5381
6874368120dc convert_cvs: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5364
diff changeset
    51
echo % convert fresh repo with --filemap
6874368120dc convert_cvs: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5364
diff changeset
    52
echo include b/c > filemap
6874368120dc convert_cvs: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5364
diff changeset
    53
hg convert --filemap filemap src src-filemap | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g'
6874368120dc convert_cvs: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5364
diff changeset
    54
cat src-hg/b/c
6874368120dc convert_cvs: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5364
diff changeset
    55
hg -R src-filemap log --template '#rev# #desc# files: #files#\n'
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 % commit new file revisions
5b0b0834419c convert: test cvs repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    58
cd src
5b0b0834419c convert: test cvs repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    59
echo a >> a
5b0b0834419c convert: test cvs repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    60
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
    61
cvscall -q commit -mci1 . | grep '<--' |\
5364
645a40777fd4 test-convert-cvs: handle older cvs client
Christian Ebert <blacktrash@gmx.net>
parents: 5307
diff changeset
    62
    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
    63
cd ..
5b0b0834419c convert: test cvs repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    64
5b0b0834419c convert: test cvs repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    65
echo % convert again
5b0b0834419c convert: test cvs repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    66
hg convert src src-hg | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g'
5b0b0834419c convert: test cvs repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    67
cat src-hg/a
5b0b0834419c convert: test cvs repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    68
cat src-hg/b/c
5b0b0834419c convert: test cvs repository conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    69
5381
6874368120dc convert_cvs: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5364
diff changeset
    70
echo % convert again with --filemap
6874368120dc convert_cvs: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5364
diff changeset
    71
hg convert --filemap filemap src src-filemap | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g'
6874368120dc convert_cvs: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5364
diff changeset
    72
cat src-hg/b/c
6874368120dc convert_cvs: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5364
diff changeset
    73
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
    74
5919
badf5711bd86 Test for converting a CVS branch
Thomas Arendsen Hein <thomas@intevation.de>
parents: 5381
diff changeset
    75
echo % commit branch
badf5711bd86 Test for converting a CVS branch
Thomas Arendsen Hein <thomas@intevation.de>
parents: 5381
diff changeset
    76
cd src
badf5711bd86 Test for converting a CVS branch
Thomas Arendsen Hein <thomas@intevation.de>
parents: 5381
diff changeset
    77
cvs -q update -r1.1 b/c
badf5711bd86 Test for converting a CVS branch
Thomas Arendsen Hein <thomas@intevation.de>
parents: 5381
diff changeset
    78
cvs -q tag -b branch
badf5711bd86 Test for converting a CVS branch
Thomas Arendsen Hein <thomas@intevation.de>
parents: 5381
diff changeset
    79
cvs -q update -r branch
badf5711bd86 Test for converting a CVS branch
Thomas Arendsen Hein <thomas@intevation.de>
parents: 5381
diff changeset
    80
echo d >> b/c
badf5711bd86 Test for converting a CVS branch
Thomas Arendsen Hein <thomas@intevation.de>
parents: 5381
diff changeset
    81
cvs -q commit -mci2 . | grep '<--' |\
badf5711bd86 Test for converting a CVS branch
Thomas Arendsen Hein <thomas@intevation.de>
parents: 5381
diff changeset
    82
    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
    83
cd ..
badf5711bd86 Test for converting a CVS branch
Thomas Arendsen Hein <thomas@intevation.de>
parents: 5381
diff changeset
    84
badf5711bd86 Test for converting a CVS branch
Thomas Arendsen Hein <thomas@intevation.de>
parents: 5381
diff changeset
    85
echo % convert again
badf5711bd86 Test for converting a CVS branch
Thomas Arendsen Hein <thomas@intevation.de>
parents: 5381
diff changeset
    86
hg convert src src-hg | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g'
badf5711bd86 Test for converting a CVS branch
Thomas Arendsen Hein <thomas@intevation.de>
parents: 5381
diff changeset
    87
cat src-hg/a
badf5711bd86 Test for converting a CVS branch
Thomas Arendsen Hein <thomas@intevation.de>
parents: 5381
diff changeset
    88
cat src-hg/b/c
badf5711bd86 Test for converting a CVS branch
Thomas Arendsen Hein <thomas@intevation.de>
parents: 5381
diff changeset
    89
badf5711bd86 Test for converting a CVS branch
Thomas Arendsen Hein <thomas@intevation.de>
parents: 5381
diff changeset
    90
echo % convert again with --filemap
badf5711bd86 Test for converting a CVS branch
Thomas Arendsen Hein <thomas@intevation.de>
parents: 5381
diff changeset
    91
hg convert --filemap filemap src src-filemap | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g'
badf5711bd86 Test for converting a CVS branch
Thomas Arendsen Hein <thomas@intevation.de>
parents: 5381
diff changeset
    92
cat src-hg/b/c
badf5711bd86 Test for converting a CVS branch
Thomas Arendsen Hein <thomas@intevation.de>
parents: 5381
diff changeset
    93
hg -R src-filemap log --template '#rev# #desc# files: #files#\n'
badf5711bd86 Test for converting a CVS branch
Thomas Arendsen Hein <thomas@intevation.de>
parents: 5381
diff changeset
    94
badf5711bd86 Test for converting a CVS branch
Thomas Arendsen Hein <thomas@intevation.de>
parents: 5381
diff changeset
    95
echo "graphlog = " >> $HGRCPATH
badf5711bd86 Test for converting a CVS branch
Thomas Arendsen Hein <thomas@intevation.de>
parents: 5381
diff changeset
    96
hg -R src-hg glog --template '#rev# (#branches#) #desc# files: #files#\n'