tests/test-convert-cvs-synthetic
author Matt Mackall <mpm@selenic.com>
Sun, 26 Apr 2009 16:50:43 -0500
changeset 8190 9b8ac5fb7760
parent 8081 6c3b8132078e
child 8249 2c7c973c2abd
permissions -rwxr-xr-x
ui: kill most users of parentui name and arg, replace with .copy()
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7862
02981000012e cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
     1
#!/bin/sh
02981000012e cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
     2
02981000012e cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
     3
# This feature requires use of builtin cvsps!
02981000012e cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
     4
"$TESTDIR/hghave" cvs || exit 80
02981000012e cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
     5
02981000012e cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
     6
set -e
02981000012e cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
     7
02981000012e cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
     8
echo "[extensions]" >> $HGRCPATH
02981000012e cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
     9
echo "convert = " >> $HGRCPATH
02981000012e cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    10
echo "[convert]" >> $HGRCPATH
02981000012e cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    11
echo "cvsps=builtin" >> $HGRCPATH
02981000012e cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    12
02981000012e cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    13
echo % create cvs repository with one project
02981000012e cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    14
mkdir cvsrepo
02981000012e cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    15
cd cvsrepo
02981000012e cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    16
export CVSROOT=`pwd`
02981000012e cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    17
export CVS_OPTIONS=-f
02981000012e cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    18
cd ..
02981000012e cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    19
8081
6c3b8132078e issue1577: fix broken test by assuming less about CVS output.
Greg Ward <greg-hg@gerg.ca>
parents: 7862
diff changeset
    20
filterpath()
6c3b8132078e issue1577: fix broken test by assuming less about CVS output.
Greg Ward <greg-hg@gerg.ca>
parents: 7862
diff changeset
    21
{
6c3b8132078e issue1577: fix broken test by assuming less about CVS output.
Greg Ward <greg-hg@gerg.ca>
parents: 7862
diff changeset
    22
    eval "$@" | sed "s:$CVSROOT:*REPO*:g"
6c3b8132078e issue1577: fix broken test by assuming less about CVS output.
Greg Ward <greg-hg@gerg.ca>
parents: 7862
diff changeset
    23
}
6c3b8132078e issue1577: fix broken test by assuming less about CVS output.
Greg Ward <greg-hg@gerg.ca>
parents: 7862
diff changeset
    24
7862
02981000012e cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    25
cvscall()
02981000012e cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    26
{
8081
6c3b8132078e issue1577: fix broken test by assuming less about CVS output.
Greg Ward <greg-hg@gerg.ca>
parents: 7862
diff changeset
    27
    echo cvs -f "$@"
6c3b8132078e issue1577: fix broken test by assuming less about CVS output.
Greg Ward <greg-hg@gerg.ca>
parents: 7862
diff changeset
    28
    cvs -f "$@" 2>&1
7862
02981000012e cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    29
}
02981000012e cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    30
8081
6c3b8132078e issue1577: fix broken test by assuming less about CVS output.
Greg Ward <greg-hg@gerg.ca>
parents: 7862
diff changeset
    31
# output of 'cvs ci' varies unpredictably, so just discard it
6c3b8132078e issue1577: fix broken test by assuming less about CVS output.
Greg Ward <greg-hg@gerg.ca>
parents: 7862
diff changeset
    32
cvsci()
6c3b8132078e issue1577: fix broken test by assuming less about CVS output.
Greg Ward <greg-hg@gerg.ca>
parents: 7862
diff changeset
    33
{
6c3b8132078e issue1577: fix broken test by assuming less about CVS output.
Greg Ward <greg-hg@gerg.ca>
parents: 7862
diff changeset
    34
    echo cvs -f ci "$@"
6c3b8132078e issue1577: fix broken test by assuming less about CVS output.
Greg Ward <greg-hg@gerg.ca>
parents: 7862
diff changeset
    35
    cvs -f ci "$@" >/dev/null 2>&1
6c3b8132078e issue1577: fix broken test by assuming less about CVS output.
Greg Ward <greg-hg@gerg.ca>
parents: 7862
diff changeset
    36
}
6c3b8132078e issue1577: fix broken test by assuming less about CVS output.
Greg Ward <greg-hg@gerg.ca>
parents: 7862
diff changeset
    37
6c3b8132078e issue1577: fix broken test by assuming less about CVS output.
Greg Ward <greg-hg@gerg.ca>
parents: 7862
diff changeset
    38
filterpath cvscall -d "$CVSROOT" init
7862
02981000012e cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    39
mkdir cvsrepo/proj
02981000012e cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    40
8081
6c3b8132078e issue1577: fix broken test by assuming less about CVS output.
Greg Ward <greg-hg@gerg.ca>
parents: 7862
diff changeset
    41
cvscall -q co proj
7862
02981000012e cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    42
02981000012e cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    43
echo % create file1 on the trunk
02981000012e cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    44
cd proj
02981000012e cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    45
touch file1
8081
6c3b8132078e issue1577: fix broken test by assuming less about CVS output.
Greg Ward <greg-hg@gerg.ca>
parents: 7862
diff changeset
    46
cvscall -Q add file1
6c3b8132078e issue1577: fix broken test by assuming less about CVS output.
Greg Ward <greg-hg@gerg.ca>
parents: 7862
diff changeset
    47
cvsci -m"add file1 on trunk" file1
7862
02981000012e cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    48
02981000012e cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    49
echo % create two branches
8081
6c3b8132078e issue1577: fix broken test by assuming less about CVS output.
Greg Ward <greg-hg@gerg.ca>
parents: 7862
diff changeset
    50
cvscall -q tag -b v1_0
6c3b8132078e issue1577: fix broken test by assuming less about CVS output.
Greg Ward <greg-hg@gerg.ca>
parents: 7862
diff changeset
    51
cvscall -q tag -b v1_1
7862
02981000012e cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    52
02981000012e cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    53
echo % create file2 on branch v1_0
8081
6c3b8132078e issue1577: fix broken test by assuming less about CVS output.
Greg Ward <greg-hg@gerg.ca>
parents: 7862
diff changeset
    54
cvscall -q up -rv1_0
7862
02981000012e cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    55
touch file2
8081
6c3b8132078e issue1577: fix broken test by assuming less about CVS output.
Greg Ward <greg-hg@gerg.ca>
parents: 7862
diff changeset
    56
cvscall -Q add file2
6c3b8132078e issue1577: fix broken test by assuming less about CVS output.
Greg Ward <greg-hg@gerg.ca>
parents: 7862
diff changeset
    57
cvsci -m"add file2 on branch v1_0" file2
7862
02981000012e cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    58
02981000012e cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    59
echo % create file3, file4 on branch v1_1
8081
6c3b8132078e issue1577: fix broken test by assuming less about CVS output.
Greg Ward <greg-hg@gerg.ca>
parents: 7862
diff changeset
    60
cvscall -Q up -rv1_1
7862
02981000012e cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    61
touch file3
02981000012e cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    62
touch file4
8081
6c3b8132078e issue1577: fix broken test by assuming less about CVS output.
Greg Ward <greg-hg@gerg.ca>
parents: 7862
diff changeset
    63
cvscall -Q add file3 file4
6c3b8132078e issue1577: fix broken test by assuming less about CVS output.
Greg Ward <greg-hg@gerg.ca>
parents: 7862
diff changeset
    64
cvsci -m"add file3, file4 on branch v1_1" file3 file4
7862
02981000012e cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    65
02981000012e cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    66
echo % merge file2 from v1_0 to v1_1
8081
6c3b8132078e issue1577: fix broken test by assuming less about CVS output.
Greg Ward <greg-hg@gerg.ca>
parents: 7862
diff changeset
    67
cvscall -q up -jv1_0
6c3b8132078e issue1577: fix broken test by assuming less about CVS output.
Greg Ward <greg-hg@gerg.ca>
parents: 7862
diff changeset
    68
cvsci -m"merge file2 from v1_0 to v1_1"
6c3b8132078e issue1577: fix broken test by assuming less about CVS output.
Greg Ward <greg-hg@gerg.ca>
parents: 7862
diff changeset
    69
6c3b8132078e issue1577: fix broken test by assuming less about CVS output.
Greg Ward <greg-hg@gerg.ca>
parents: 7862
diff changeset
    70
echo % cvs rlog output
6c3b8132078e issue1577: fix broken test by assuming less about CVS output.
Greg Ward <greg-hg@gerg.ca>
parents: 7862
diff changeset
    71
filterpath cvscall -q rlog proj | egrep '^(RCS file|revision)'
7862
02981000012e cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    72
02981000012e cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    73
echo % convert to hg
02981000012e cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    74
cd ..
8081
6c3b8132078e issue1577: fix broken test by assuming less about CVS output.
Greg Ward <greg-hg@gerg.ca>
parents: 7862
diff changeset
    75
filterpath hg convert proj proj.hg
7862
02981000012e cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    76
02981000012e cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    77
echo % hg log output
02981000012e cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    78
hg -R proj.hg log --template "{rev} {desc}\n"