tests/test-convert-cvsnt-mergepoints
author Dirkjan Ochtman <dirkjan@ochtman.nl>
Fri, 19 Jun 2009 13:58:22 +0200
changeset 8833 14639c050251
parent 8821 c66e324d3961
child 9543 56a5f80556f5
permissions -rwxr-xr-x
mq: unify code for qdel -r and qfin
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
8451
ec8b8a0f494b cvsnt-mergepoints test: use sh instead of bash
Martin Geisler <mg@lazybytes.net>
parents: 8350
diff changeset
     1
#!/bin/sh
7956
3e7611a83230 convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
     2
3e7611a83230 convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
     3
"$TESTDIR/hghave" cvs || exit 80
3e7611a83230 convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
     4
8819
e93ab347c814 test-convert-cvsnt-mergepoints: ignore differences between CVS 1.11 and 1.12.
Greg Ward <greg-hg@gerg.ca>
parents: 8818
diff changeset
     5
filterpath()
e93ab347c814 test-convert-cvsnt-mergepoints: ignore differences between CVS 1.11 and 1.12.
Greg Ward <greg-hg@gerg.ca>
parents: 8818
diff changeset
     6
{
e93ab347c814 test-convert-cvsnt-mergepoints: ignore differences between CVS 1.11 and 1.12.
Greg Ward <greg-hg@gerg.ca>
parents: 8818
diff changeset
     7
    eval "$@" | sed "s:$CVSROOT:*REPO*:g"
e93ab347c814 test-convert-cvsnt-mergepoints: ignore differences between CVS 1.11 and 1.12.
Greg Ward <greg-hg@gerg.ca>
parents: 8818
diff changeset
     8
}
e93ab347c814 test-convert-cvsnt-mergepoints: ignore differences between CVS 1.11 and 1.12.
Greg Ward <greg-hg@gerg.ca>
parents: 8818
diff changeset
     9
7956
3e7611a83230 convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    10
cvscall()
3e7611a83230 convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    11
{
8819
e93ab347c814 test-convert-cvsnt-mergepoints: ignore differences between CVS 1.11 and 1.12.
Greg Ward <greg-hg@gerg.ca>
parents: 8818
diff changeset
    12
    echo cvs -f "$@"
7956
3e7611a83230 convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    13
    cvs -f "$@"
3e7611a83230 convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    14
}
3e7611a83230 convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    15
8819
e93ab347c814 test-convert-cvsnt-mergepoints: ignore differences between CVS 1.11 and 1.12.
Greg Ward <greg-hg@gerg.ca>
parents: 8818
diff changeset
    16
# output of 'cvs ci' varies unpredictably, so discard most of it
e93ab347c814 test-convert-cvsnt-mergepoints: ignore differences between CVS 1.11 and 1.12.
Greg Ward <greg-hg@gerg.ca>
parents: 8818
diff changeset
    17
# -- just keep the part that matters
e93ab347c814 test-convert-cvsnt-mergepoints: ignore differences between CVS 1.11 and 1.12.
Greg Ward <greg-hg@gerg.ca>
parents: 8818
diff changeset
    18
cvsci()
e93ab347c814 test-convert-cvsnt-mergepoints: ignore differences between CVS 1.11 and 1.12.
Greg Ward <greg-hg@gerg.ca>
parents: 8818
diff changeset
    19
{
8821
c66e324d3961 Fix test-convert-cvsnt-mergepoints so it works reliably.
Greg Ward <greg-hg@gerg.ca>
parents: 8820
diff changeset
    20
    echo cvs -f ci -f "$@"
c66e324d3961 Fix test-convert-cvsnt-mergepoints so it works reliably.
Greg Ward <greg-hg@gerg.ca>
parents: 8820
diff changeset
    21
    cvs -f ci -f "$@" 2>&1 | egrep "^(new|initial) revision:"
8819
e93ab347c814 test-convert-cvsnt-mergepoints: ignore differences between CVS 1.11 and 1.12.
Greg Ward <greg-hg@gerg.ca>
parents: 8818
diff changeset
    22
}
e93ab347c814 test-convert-cvsnt-mergepoints: ignore differences between CVS 1.11 and 1.12.
Greg Ward <greg-hg@gerg.ca>
parents: 8818
diff changeset
    23
7956
3e7611a83230 convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    24
hgcat()
3e7611a83230 convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    25
{
3e7611a83230 convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    26
    hg --cwd src-hg cat -r tip "$1"
3e7611a83230 convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    27
}
3e7611a83230 convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    28
3e7611a83230 convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    29
echo "[extensions]" >> $HGRCPATH
3e7611a83230 convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    30
echo "convert = " >> $HGRCPATH
3e7611a83230 convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    31
echo "graphlog = " >> $HGRCPATH
3e7611a83230 convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    32
echo "[convert]" >> $HGRCPATH
3e7611a83230 convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    33
echo "cvsps=builtin" >> $HGRCPATH
3e7611a83230 convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    34
8819
e93ab347c814 test-convert-cvsnt-mergepoints: ignore differences between CVS 1.11 and 1.12.
Greg Ward <greg-hg@gerg.ca>
parents: 8818
diff changeset
    35
echo "% create cvs repository"
7956
3e7611a83230 convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    36
mkdir cvsmaster
3e7611a83230 convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    37
cd cvsmaster
8350
1f0f01bc86a5 tests: avoid export FOO=bar bashism
Martin Geisler <mg@lazybytes.net>
parents: 7956
diff changeset
    38
CVSROOT=`pwd`
1f0f01bc86a5 tests: avoid export FOO=bar bashism
Martin Geisler <mg@lazybytes.net>
parents: 7956
diff changeset
    39
export CVSROOT
1f0f01bc86a5 tests: avoid export FOO=bar bashism
Martin Geisler <mg@lazybytes.net>
parents: 7956
diff changeset
    40
CVS_OPTIONS=-f
1f0f01bc86a5 tests: avoid export FOO=bar bashism
Martin Geisler <mg@lazybytes.net>
parents: 7956
diff changeset
    41
export CVS_OPTIONS
7956
3e7611a83230 convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    42
cd ..
8819
e93ab347c814 test-convert-cvsnt-mergepoints: ignore differences between CVS 1.11 and 1.12.
Greg Ward <greg-hg@gerg.ca>
parents: 8818
diff changeset
    43
filterpath cvscall -Q -d "$CVSROOT" init
7956
3e7611a83230 convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    44
8819
e93ab347c814 test-convert-cvsnt-mergepoints: ignore differences between CVS 1.11 and 1.12.
Greg Ward <greg-hg@gerg.ca>
parents: 8818
diff changeset
    45
echo "% checkout #1: add foo.txt"
e93ab347c814 test-convert-cvsnt-mergepoints: ignore differences between CVS 1.11 and 1.12.
Greg Ward <greg-hg@gerg.ca>
parents: 8818
diff changeset
    46
cvscall -Q checkout -d cvsworktmp .
7956
3e7611a83230 convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    47
cd cvsworktmp
3e7611a83230 convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    48
mkdir foo
8819
e93ab347c814 test-convert-cvsnt-mergepoints: ignore differences between CVS 1.11 and 1.12.
Greg Ward <greg-hg@gerg.ca>
parents: 8818
diff changeset
    49
cvscall -Q add foo
7956
3e7611a83230 convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    50
cd foo
3e7611a83230 convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    51
echo foo > foo.txt
8819
e93ab347c814 test-convert-cvsnt-mergepoints: ignore differences between CVS 1.11 and 1.12.
Greg Ward <greg-hg@gerg.ca>
parents: 8818
diff changeset
    52
cvscall -Q add foo.txt 
8821
c66e324d3961 Fix test-convert-cvsnt-mergepoints so it works reliably.
Greg Ward <greg-hg@gerg.ca>
parents: 8820
diff changeset
    53
cvsci -m "add foo.txt" foo.txt
7956
3e7611a83230 convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    54
 
3e7611a83230 convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    55
cd ../..
3e7611a83230 convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    56
rm -rf cvsworktmp
3e7611a83230 convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    57
8819
e93ab347c814 test-convert-cvsnt-mergepoints: ignore differences between CVS 1.11 and 1.12.
Greg Ward <greg-hg@gerg.ca>
parents: 8818
diff changeset
    58
echo "% checkout #2: create MYBRANCH1 and modify foo.txt on it"
e93ab347c814 test-convert-cvsnt-mergepoints: ignore differences between CVS 1.11 and 1.12.
Greg Ward <greg-hg@gerg.ca>
parents: 8818
diff changeset
    59
cvscall -Q checkout -d cvswork foo
7956
3e7611a83230 convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    60
3e7611a83230 convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    61
cd cvswork
3e7611a83230 convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    62
3e7611a83230 convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    63
cvscall -q rtag -b -R MYBRANCH1 foo
8819
e93ab347c814 test-convert-cvsnt-mergepoints: ignore differences between CVS 1.11 and 1.12.
Greg Ward <greg-hg@gerg.ca>
parents: 8818
diff changeset
    64
cvscall -Q update -P -r MYBRANCH1
7956
3e7611a83230 convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    65
echo bar > foo.txt
8821
c66e324d3961 Fix test-convert-cvsnt-mergepoints so it works reliably.
Greg Ward <greg-hg@gerg.ca>
parents: 8820
diff changeset
    66
cvsci -m "bar" foo.txt
7956
3e7611a83230 convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    67
echo baz > foo.txt
8821
c66e324d3961 Fix test-convert-cvsnt-mergepoints so it works reliably.
Greg Ward <greg-hg@gerg.ca>
parents: 8820
diff changeset
    68
cvsci -m "baz" foo.txt
7956
3e7611a83230 convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    69
8819
e93ab347c814 test-convert-cvsnt-mergepoints: ignore differences between CVS 1.11 and 1.12.
Greg Ward <greg-hg@gerg.ca>
parents: 8818
diff changeset
    70
echo "% create MYBRANCH1_2 and modify foo.txt some more"
7956
3e7611a83230 convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    71
cvscall -q rtag -b -R -r MYBRANCH1 MYBRANCH1_2 foo
8819
e93ab347c814 test-convert-cvsnt-mergepoints: ignore differences between CVS 1.11 and 1.12.
Greg Ward <greg-hg@gerg.ca>
parents: 8818
diff changeset
    72
cvscall -Q update -P -r MYBRANCH1_2
7956
3e7611a83230 convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    73
3e7611a83230 convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    74
echo bazzie > foo.txt
8821
c66e324d3961 Fix test-convert-cvsnt-mergepoints so it works reliably.
Greg Ward <greg-hg@gerg.ca>
parents: 8820
diff changeset
    75
cvsci -m "bazzie" foo.txt
7956
3e7611a83230 convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    76
8819
e93ab347c814 test-convert-cvsnt-mergepoints: ignore differences between CVS 1.11 and 1.12.
Greg Ward <greg-hg@gerg.ca>
parents: 8818
diff changeset
    77
echo "% create MYBRANCH1_1 and modify foo.txt yet again"
7956
3e7611a83230 convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    78
cvscall -q rtag -b -R MYBRANCH1_1 foo
8819
e93ab347c814 test-convert-cvsnt-mergepoints: ignore differences between CVS 1.11 and 1.12.
Greg Ward <greg-hg@gerg.ca>
parents: 8818
diff changeset
    79
cvscall -Q update -P -r MYBRANCH1_1
7956
3e7611a83230 convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    80
3e7611a83230 convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    81
echo quux > foo.txt
8821
c66e324d3961 Fix test-convert-cvsnt-mergepoints so it works reliably.
Greg Ward <greg-hg@gerg.ca>
parents: 8820
diff changeset
    82
cvsci -m "quux" foo.txt
7956
3e7611a83230 convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    83
8819
e93ab347c814 test-convert-cvsnt-mergepoints: ignore differences between CVS 1.11 and 1.12.
Greg Ward <greg-hg@gerg.ca>
parents: 8818
diff changeset
    84
echo "% merge MYBRANCH1 to MYBRANCH1_1"
e93ab347c814 test-convert-cvsnt-mergepoints: ignore differences between CVS 1.11 and 1.12.
Greg Ward <greg-hg@gerg.ca>
parents: 8818
diff changeset
    85
filterpath cvscall -Q update -P -jMYBRANCH1
8821
c66e324d3961 Fix test-convert-cvsnt-mergepoints so it works reliably.
Greg Ward <greg-hg@gerg.ca>
parents: 8820
diff changeset
    86
# carefully placed sleep to dodge cvs bug (optimization?) where it
c66e324d3961 Fix test-convert-cvsnt-mergepoints so it works reliably.
Greg Ward <greg-hg@gerg.ca>
parents: 8820
diff changeset
    87
# sometimes ignores a "commit" command if it comes too fast (the -f
c66e324d3961 Fix test-convert-cvsnt-mergepoints so it works reliably.
Greg Ward <greg-hg@gerg.ca>
parents: 8820
diff changeset
    88
# option in cvsci seems to work for all the other commits in this
c66e324d3961 Fix test-convert-cvsnt-mergepoints so it works reliably.
Greg Ward <greg-hg@gerg.ca>
parents: 8820
diff changeset
    89
# script)
c66e324d3961 Fix test-convert-cvsnt-mergepoints so it works reliably.
Greg Ward <greg-hg@gerg.ca>
parents: 8820
diff changeset
    90
sleep 1
8819
e93ab347c814 test-convert-cvsnt-mergepoints: ignore differences between CVS 1.11 and 1.12.
Greg Ward <greg-hg@gerg.ca>
parents: 8818
diff changeset
    91
echo xyzzy > foo.txt
8821
c66e324d3961 Fix test-convert-cvsnt-mergepoints so it works reliably.
Greg Ward <greg-hg@gerg.ca>
parents: 8820
diff changeset
    92
cvsci -m "merge1+clobber" foo.txt
7956
3e7611a83230 convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    93
8819
e93ab347c814 test-convert-cvsnt-mergepoints: ignore differences between CVS 1.11 and 1.12.
Greg Ward <greg-hg@gerg.ca>
parents: 8818
diff changeset
    94
echo "% return to trunk and merge MYBRANCH1_2"
e93ab347c814 test-convert-cvsnt-mergepoints: ignore differences between CVS 1.11 and 1.12.
Greg Ward <greg-hg@gerg.ca>
parents: 8818
diff changeset
    95
cvscall -Q update -P -A
e93ab347c814 test-convert-cvsnt-mergepoints: ignore differences between CVS 1.11 and 1.12.
Greg Ward <greg-hg@gerg.ca>
parents: 8818
diff changeset
    96
filterpath cvscall -Q update -P -jMYBRANCH1_2
8821
c66e324d3961 Fix test-convert-cvsnt-mergepoints so it works reliably.
Greg Ward <greg-hg@gerg.ca>
parents: 8820
diff changeset
    97
cvsci -m "merge2" foo.txt
7956
3e7611a83230 convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    98
3e7611a83230 convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    99
REALCVS=`which cvs`
8820
e8cb1fa0d4a9 test-convert-cvsnt-mergepoints: make it work on OS X.
Greg Ward <greg-hg@gerg.ca>
parents: 8819
diff changeset
   100
echo "for x in \$*; do if [ \"\$x\" = \"rlog\" ]; then echo \"RCS file: $CVSROOT/foo/foo.txt,v\"; cat $TESTDIR/test-convert-cvsnt-mergepoints.rlog; exit 0; fi; done; $REALCVS \$*" > ../cvs
e8cb1fa0d4a9 test-convert-cvsnt-mergepoints: make it work on OS X.
Greg Ward <greg-hg@gerg.ca>
parents: 8819
diff changeset
   101
chmod +x ../cvs
e8cb1fa0d4a9 test-convert-cvsnt-mergepoints: make it work on OS X.
Greg Ward <greg-hg@gerg.ca>
parents: 8819
diff changeset
   102
PATH=..:${PATH} hg debugcvsps --parents foo | sed -e 's/Author:.*/Author:/' -e 's/Date:.*/Date:/'
7956
3e7611a83230 convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
   103
3e7611a83230 convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
   104
cd ..