tests/test-convert-cvs-synthetic
changeset 8081 6c3b8132078e
parent 7862 02981000012e
child 8249 2c7c973c2abd
equal deleted inserted replaced
8065:66d0a03d3afc 8081:6c3b8132078e
     1 #!/bin/sh
     1 #!/bin/sh
     2 
     2 
     3 # This feature requires use of builtin cvsps!
     3 # This feature requires use of builtin cvsps!
     4 "$TESTDIR/hghave" cvs || exit 80
     4 "$TESTDIR/hghave" cvs || exit 80
     5 
       
     6 # XXX lots of duplication with other test-convert-cvs* scripts
       
     7 
     5 
     8 set -e
     6 set -e
     9 
     7 
    10 echo "[extensions]" >> $HGRCPATH
     8 echo "[extensions]" >> $HGRCPATH
    11 echo "convert = " >> $HGRCPATH
     9 echo "convert = " >> $HGRCPATH
    17 cd cvsrepo
    15 cd cvsrepo
    18 export CVSROOT=`pwd`
    16 export CVSROOT=`pwd`
    19 export CVS_OPTIONS=-f
    17 export CVS_OPTIONS=-f
    20 cd ..
    18 cd ..
    21 
    19 
    22 filter='sed "s:$CVSROOT:*REPO*:g"'
    20 filterpath()
       
    21 {
       
    22     eval "$@" | sed "s:$CVSROOT:*REPO*:g"
       
    23 }
       
    24 
    23 cvscall()
    25 cvscall()
    24 {
    26 {
    25     cvs -f "$@" | eval $filter
    27     echo cvs -f "$@"
       
    28     cvs -f "$@" 2>&1
    26 }
    29 }
    27 
    30 
    28 cvscall -q -d "$CVSROOT" init
    31 # output of 'cvs ci' varies unpredictably, so just discard it
       
    32 cvsci()
       
    33 {
       
    34     echo cvs -f ci "$@"
       
    35     cvs -f ci "$@" >/dev/null 2>&1
       
    36 }
       
    37 
       
    38 filterpath cvscall -d "$CVSROOT" init
    29 mkdir cvsrepo/proj
    39 mkdir cvsrepo/proj
    30 
    40 
    31 cvscall co proj
    41 cvscall -q co proj
    32 
    42 
    33 echo % create file1 on the trunk
    43 echo % create file1 on the trunk
    34 cd proj
    44 cd proj
    35 touch file1
    45 touch file1
    36 cvscall add file1
    46 cvscall -Q add file1
    37 cvscall ci -m"add file1 on trunk" file1
    47 cvsci -m"add file1 on trunk" file1
    38 
    48 
    39 echo % create two branches
    49 echo % create two branches
    40 cvscall tag -b v1_0
    50 cvscall -q tag -b v1_0
    41 cvscall tag -b v1_1
    51 cvscall -q tag -b v1_1
    42 
    52 
    43 echo % create file2 on branch v1_0
    53 echo % create file2 on branch v1_0
    44 cvs up -rv1_0
    54 cvscall -q up -rv1_0
    45 touch file2
    55 touch file2
    46 cvscall add file2
    56 cvscall -Q add file2
    47 cvscall ci -m"add file2 on branch v1_0" file2
    57 cvsci -m"add file2 on branch v1_0" file2
    48 
    58 
    49 echo % create file3, file4 on branch v1_1
    59 echo % create file3, file4 on branch v1_1
    50 cvs up -rv1_1
    60 cvscall -Q up -rv1_1
    51 touch file3
    61 touch file3
    52 touch file4
    62 touch file4
    53 cvscall add file3 file4
    63 cvscall -Q add file3 file4
    54 cvscall ci -m"add file3, file4 on branch v1_1" file3 file4
    64 cvsci -m"add file3, file4 on branch v1_1" file3 file4
    55 
    65 
    56 echo % merge file2 from v1_0 to v1_1
    66 echo % merge file2 from v1_0 to v1_1
    57 cvscall up -jv1_0
    67 cvscall -q up -jv1_0
    58 cvscall ci -m"merge file2 from v1_0 to v1_1"
    68 cvsci -m"merge file2 from v1_0 to v1_1"
       
    69 
       
    70 echo % cvs rlog output
       
    71 filterpath cvscall -q rlog proj | egrep '^(RCS file|revision)'
    59 
    72 
    60 echo % convert to hg
    73 echo % convert to hg
    61 cd ..
    74 cd ..
    62 hg convert proj proj.hg | eval $filter
    75 filterpath hg convert proj proj.hg
    63 
    76 
    64 echo % hg log output
    77 echo % hg log output
    65 hg -R proj.hg log --template "{rev} {desc}\n"
    78 hg -R proj.hg log --template "{rev} {desc}\n"