tests/test-convert-cvsnt-mergepoints
author Steve Borho <steve@borho.org>
Mon, 15 Feb 2010 21:18:16 -0600
branchstable
changeset 10486 6b354a763617
parent 9543 56a5f80556f5
permissions -rwxr-xr-x
mergetools: improve configuration for several merge tools * meld - provide labels for the three panes * diffmerge - add registry key for detection, improve arguments * beyond compare - add linux version * winmerge - improve arguments * araxis - add configuration, including registry key for detection * misc - provide default priorities for more tools
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
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
    33
echo "% create cvs repository"
7956
3e7611a83230 convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    34
mkdir cvsmaster
3e7611a83230 convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    35
cd cvsmaster
8350
1f0f01bc86a5 tests: avoid export FOO=bar bashism
Martin Geisler <mg@lazybytes.net>
parents: 7956
diff changeset
    36
CVSROOT=`pwd`
1f0f01bc86a5 tests: avoid export FOO=bar bashism
Martin Geisler <mg@lazybytes.net>
parents: 7956
diff changeset
    37
export CVSROOT
1f0f01bc86a5 tests: avoid export FOO=bar bashism
Martin Geisler <mg@lazybytes.net>
parents: 7956
diff changeset
    38
CVS_OPTIONS=-f
1f0f01bc86a5 tests: avoid export FOO=bar bashism
Martin Geisler <mg@lazybytes.net>
parents: 7956
diff changeset
    39
export CVS_OPTIONS
7956
3e7611a83230 convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    40
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
    41
filterpath cvscall -Q -d "$CVSROOT" init
7956
3e7611a83230 convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    42
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
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
    44
cvscall -Q checkout -d cvsworktmp .
7956
3e7611a83230 convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    45
cd cvsworktmp
3e7611a83230 convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    46
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
    47
cvscall -Q add foo
7956
3e7611a83230 convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    48
cd foo
3e7611a83230 convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    49
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
    50
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
    51
cvsci -m "add foo.txt" foo.txt
7956
3e7611a83230 convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    52
 
3e7611a83230 convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    53
cd ../..
3e7611a83230 convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    54
rm -rf cvsworktmp
3e7611a83230 convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    55
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
    56
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
    57
cvscall -Q checkout -d cvswork foo
7956
3e7611a83230 convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    58
3e7611a83230 convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    59
cd cvswork
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
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
    62
cvscall -Q update -P -r MYBRANCH1
7956
3e7611a83230 convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    63
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
    64
cvsci -m "bar" foo.txt
7956
3e7611a83230 convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    65
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
    66
cvsci -m "baz" foo.txt
7956
3e7611a83230 convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    67
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
    68
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
    69
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
    70
cvscall -Q update -P -r MYBRANCH1_2
7956
3e7611a83230 convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    71
3e7611a83230 convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    72
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
    73
cvsci -m "bazzie" foo.txt
7956
3e7611a83230 convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    74
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
    75
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
    76
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
    77
cvscall -Q update -P -r MYBRANCH1_1
7956
3e7611a83230 convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    78
3e7611a83230 convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    79
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
    80
cvsci -m "quux" foo.txt
7956
3e7611a83230 convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    81
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
    82
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
    83
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
    84
# 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
    85
# 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
    86
# 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
    87
# script)
c66e324d3961 Fix test-convert-cvsnt-mergepoints so it works reliably.
Greg Ward <greg-hg@gerg.ca>
parents: 8820
diff changeset
    88
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
    89
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
    90
cvsci -m "merge1+clobber" foo.txt
7956
3e7611a83230 convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    91
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
    92
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
    93
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
    94
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
    95
cvsci -m "merge2" foo.txt
7956
3e7611a83230 convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    96
3e7611a83230 convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    97
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
    98
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
    99
chmod +x ../cvs
e8cb1fa0d4a9 test-convert-cvsnt-mergepoints: make it work on OS X.
Greg Ward <greg-hg@gerg.ca>
parents: 8819
diff changeset
   100
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
   101
3e7611a83230 convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
   102
cd ..