annotate tests/test-convert-cvs-detectmerge @ 8809:6fce36336e42

gpg: add test
author Brendan Cully <brendan@kublai.com>
date Sun, 14 Jun 2009 13:32:19 -0700
parents 1f0f01bc86a5
children 56a5f80556f5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
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
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
37 echo "cvsps=builtin" >> $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
38 echo "cvsps.cache=0" >> $HGRCPATH
8170
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
39 echo "cvsps.mergefrom=\[MERGE from (\S+)\]" >> $HGRCPATH
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
40
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
41 echo % create cvs repository with one project
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
42 mkdir cvsrepo
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
43
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
44 filterpath cvscall -q -d "$CVSROOT" init
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
45 mkdir cvsrepo/proj
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
46
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
47 echo % populate cvs repository
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
48 cvscall -Q co proj
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
49 cd proj
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
50 touch file1
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
51 cvscall -Q add file1
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
52 cvsci -m"add file1 on trunk"
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
53
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
54 echo % create two release branches
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
55 cvscall -q tag -b v1_0
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
56 cvscall -q tag -b v1_1
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
57
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
58 echo % modify file1 on branch v1_0
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
59 filterpath cvscall -Q update -rv1_0
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
60 echo "change" >> file1
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
61 cvsci -m"add text"
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
62
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
63 echo % make unrelated change on v1_1
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
64 cvscall -Q update -rv1_1
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
65 touch unrelated
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
66 cvscall -Q add unrelated
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
67 cvsci -m"unrelated change"
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
68
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
69 echo % merge file1 to v1_1
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
70 filterpath cvscall -Q update -jv1_0
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
71 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
72
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
73 echo % merge change to trunk
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
74 cvscall -Q update -A
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
75 filterpath cvscall -Q update -jv1_1
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
76 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
77
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
78 echo % non-merged change on trunk
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
79 echo "foo" > file2
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
80 cvscall -Q add file2
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
81 cvsci -m"add file2 on trunk" file2
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
82
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
83 # this will create rev 1.3
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
84 echo % change on trunk to backport
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
85 echo "backport me" >> file1
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
86 cvsci -m"add other text" file1
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
87 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
88
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
89 # 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
90 echo % backport trunk change to v1_1
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
91 cvscall -Q update -rv1_1
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
92 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
93 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
94
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
95 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
96 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
97 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
98 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
99 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
100 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
101 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
102 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
103 # 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
104 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
105 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
106
4e5bd9b97bb3 cvsps: fix crash when log message refers to non-existent branch (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents: 8170
diff changeset
107 set -e
8170
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
108 echo % convert to hg
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
109 cd ..
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
110 filterpath hg convert proj proj.hg
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
111
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
112 echo % complete log
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
113 template="{rev}: '{branches}' {desc}\n"
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
114 hg -R proj.hg log --template="$template"
6c4fdde87f90 cvsps: add test for merge detection (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
115
8171
4e5bd9b97bb3 cvsps: fix crash when log message refers to non-existent branch (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents: 8170
diff changeset
116 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
117 hg -R proj.hg glog --template="$template"