tests/test-convert-cvs-detectmerge
author Matt Mackall <mpm@selenic.com>
Sun, 26 Sep 2010 13:44:49 -0500
changeset 12481 70ef9b470efe
parent 9543 56a5f80556f5
permissions -rwxr-xr-x
tests: unify test-pull-pull-corruption
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
8170
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
     1
#!/bin/sh
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
     2
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
     3
# Test config convert.cvsps.mergefrom config setting.
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
     4
# (Should test similar mergeto feature, but I don't understand it yet.)
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
     5
# Requires builtin cvsps.
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
     6
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
     7
"$TESTDIR/hghave" cvs || exit 80
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
     8
8350
1f0f01bc86a5 tests: avoid export FOO=bar bashism
Martin Geisler <mg@lazybytes.net>
parents: 8171
diff changeset
     9
CVSROOT=`pwd`/cvsrepo
1f0f01bc86a5 tests: avoid export FOO=bar bashism
Martin Geisler <mg@lazybytes.net>
parents: 8171
diff changeset
    10
export CVSROOT
8170
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    11
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    12
# XXX copied from test-convert-cvs-synthetic
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    13
cvscall()
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    14
{
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    15
    echo cvs -f "$@"
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    16
    cvs -f "$@"
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    17
}
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    18
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    19
# output of 'cvs ci' varies unpredictably, so just discard it
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    20
# XXX copied from test-convert-cvs-synthetic
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    21
cvsci()
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    22
{
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    23
    echo cvs -f ci "$@"
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    24
    cvs -f ci "$@" >/dev/null 2>&1
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    25
}
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    26
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    27
# XXX copied from test-convert-cvs-synthetic
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    28
filterpath()
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    29
{
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    30
    eval "$@" | sed "s:$CVSROOT:*REPO*:g"
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    31
}
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    32
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    33
echo "[extensions]" >> $HGRCPATH
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    34
echo "convert = " >> $HGRCPATH
8171
4e5bd9b97bb3 cvsps: fix crash when log message refers to non-existent branch (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents: 8170
diff changeset
    35
echo "graphlog = " >> $HGRCPATH
8170
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    36
echo "[convert]" >> $HGRCPATH
8171
4e5bd9b97bb3 cvsps: fix crash when log message refers to non-existent branch (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents: 8170
diff changeset
    37
echo "cvsps.cache=0" >> $HGRCPATH
8170
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    38
echo "cvsps.mergefrom=\[MERGE from (\S+)\]" >> $HGRCPATH
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    39
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    40
echo % create cvs repository with one project
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    41
mkdir cvsrepo
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    42
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    43
filterpath cvscall -q -d "$CVSROOT" init
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    44
mkdir cvsrepo/proj
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    45
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    46
echo % populate cvs repository
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    47
cvscall -Q co proj
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    48
cd proj
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    49
touch file1
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    50
cvscall -Q add file1
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    51
cvsci -m"add file1 on trunk"
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    52
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    53
echo % create two release branches
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    54
cvscall -q tag -b v1_0
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    55
cvscall -q tag -b v1_1
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    56
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    57
echo % modify file1 on branch v1_0
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    58
filterpath cvscall -Q update -rv1_0
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    59
echo "change" >> file1
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    60
cvsci -m"add text"
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    61
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    62
echo % make unrelated change on v1_1
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    63
cvscall -Q update -rv1_1
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    64
touch unrelated
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    65
cvscall -Q add unrelated
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    66
cvsci -m"unrelated change"
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    67
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    68
echo % merge file1 to v1_1
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    69
filterpath cvscall -Q update -jv1_0
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    70
cvsci -m"add text [MERGE from v1_0]"
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    71
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    72
echo % merge change to trunk
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    73
cvscall -Q update -A
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    74
filterpath cvscall -Q update -jv1_1
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    75
cvsci -m"add text [MERGE from v1_1]"
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    76
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    77
echo % non-merged change on trunk
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    78
echo "foo" > file2
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    79
cvscall -Q add file2
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    80
cvsci -m"add file2 on trunk" file2
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    81
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    82
# this will create rev 1.3
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    83
echo % change on trunk to backport
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    84
echo "backport me" >> file1
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    85
cvsci -m"add other text" file1
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    86
cvscall log file1 | sed -n '/^date: / d; /^revision /,$ p;'
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    87
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    88
# XXX how many ways are there to spell "trunk" with CVS?
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    89
echo % backport trunk change to v1_1
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    90
cvscall -Q update -rv1_1
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    91
filterpath cvscall -Q update -j1.2 -j1.3 file1
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    92
cvsci -m"add other text [MERGE from HEAD]" file1
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    93
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    94
set -e
8171
4e5bd9b97bb3 cvsps: fix crash when log message refers to non-existent branch (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents: 8170
diff changeset
    95
echo "% fix bug on v1_1, merge to trunk with error"
4e5bd9b97bb3 cvsps: fix crash when log message refers to non-existent branch (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents: 8170
diff changeset
    96
cvscall -Q update -rv1_1
4e5bd9b97bb3 cvsps: fix crash when log message refers to non-existent branch (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents: 8170
diff changeset
    97
echo "merge forward" >> file1
4e5bd9b97bb3 cvsps: fix crash when log message refers to non-existent branch (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents: 8170
diff changeset
    98
cvscall -Q tag unmerged
4e5bd9b97bb3 cvsps: fix crash when log message refers to non-existent branch (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents: 8170
diff changeset
    99
cvsci -m"fix file1"
4e5bd9b97bb3 cvsps: fix crash when log message refers to non-existent branch (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents: 8170
diff changeset
   100
cvscall -Q update -A
4e5bd9b97bb3 cvsps: fix crash when log message refers to non-existent branch (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents: 8170
diff changeset
   101
filterpath cvscall -Q update -junmerged -jv1_1
4e5bd9b97bb3 cvsps: fix crash when log message refers to non-existent branch (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents: 8170
diff changeset
   102
# note the typo in the commit log message
4e5bd9b97bb3 cvsps: fix crash when log message refers to non-existent branch (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents: 8170
diff changeset
   103
cvsci -m"fix file1 [MERGE from v1-1]"
4e5bd9b97bb3 cvsps: fix crash when log message refers to non-existent branch (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents: 8170
diff changeset
   104
cvs -Q tag -d unmerged
4e5bd9b97bb3 cvsps: fix crash when log message refers to non-existent branch (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents: 8170
diff changeset
   105
4e5bd9b97bb3 cvsps: fix crash when log message refers to non-existent branch (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents: 8170
diff changeset
   106
set -e
8170
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
   107
echo % convert to hg
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
   108
cd ..
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
   109
filterpath hg convert proj proj.hg
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
   110
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
   111
echo % complete log
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
   112
template="{rev}: '{branches}' {desc}\n"
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
   113
hg -R proj.hg log --template="$template"
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
   114
8171
4e5bd9b97bb3 cvsps: fix crash when log message refers to non-existent branch (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents: 8170
diff changeset
   115
echo % graphical log
4e5bd9b97bb3 cvsps: fix crash when log message refers to non-existent branch (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents: 8170
diff changeset
   116
hg -R proj.hg glog --template="$template"