Debian Codegraph @

tests/test-convert-cvs-detectmerge.t

raw
1 #require cvs no-root
2
3 Test config convert.cvsps.mergefrom config setting.
4 (Should test similar mergeto feature, but I don't understand it yet.)
5 Requires builtin cvsps.
6
7 $ CVSROOT=`pwd`/cvsrepo
8 $ export CVSROOT
9
10 $ cvscall()
11 > {
12 > cvs -f "$@"
13 > }
14
15 output of 'cvs ci' varies unpredictably, so just discard it
16 XXX copied from test-convert-cvs-synthetic
17
18 $ cvsci()
19 > {
20 > sleep 1
21 > cvs -f ci "$@" > /dev/null
22 > }
23
24 XXX copied from test-convert-cvs-synthetic
25
26 $ cat <<EOF >> $HGRCPATH
27 > [extensions]
28 > convert =
29 > [convert]
30 > cvsps.cache = 0
31 > cvsps.mergefrom = \[MERGE from (\S+)\]
32 > EOF
33
34 create cvs repository with one project
35
36 $ cvscall -q -d "$CVSROOT" init
37 $ mkdir cvsrepo/proj
38
39 populate cvs repository
40
41 $ cvscall -Q co proj
42 $ cd proj
43 $ touch file1
44 $ cvscall -Q add file1
45 $ cvsci -m"add file1 on trunk"
46 cvs commit: Examining .
47
48 create two release branches
49
50 $ cvscall -q tag -b v1_0
51 T file1
52 $ cvscall -q tag -b v1_1
53 T file1
54
55 modify file1 on branch v1_0
56
57 $ cvscall -Q update -rv1_0
58 $ sleep 1
59 $ echo "change" >> file1
60 $ cvsci -m"add text"
61 cvs commit: Examining .
62
63 make unrelated change on v1_1
64
65 $ cvscall -Q update -rv1_1
66 $ touch unrelated
67 $ cvscall -Q add unrelated
68 $ cvsci -m"unrelated change"
69 cvs commit: Examining .
70
71 merge file1 to v1_1
72
73 $ cvscall -Q update -jv1_0
74 RCS file: $TESTTMP/cvsrepo/proj/file1,v
75 retrieving revision 1.1
76 retrieving revision 1.1.2.1
77 Merging differences between 1.1 and 1.1.2.1 into file1
78 $ cvsci -m"add text [MERGE from v1_0]"
79 cvs commit: Examining .
80
81 merge change to trunk
82
83 $ cvscall -Q update -A
84 $ cvscall -Q update -jv1_1
85 RCS file: $TESTTMP/cvsrepo/proj/file1,v
86 retrieving revision 1.1
87 retrieving revision 1.1.4.1
88 Merging differences between 1.1 and 1.1.4.1 into file1
89 $ cvsci -m"add text [MERGE from v1_1]"
90 cvs commit: Examining .
91
92 non-merged change on trunk
93
94 $ echo "foo" > file2
95 $ cvscall -Q add file2
96 $ cvsci -m"add file2 on trunk" file2
97
98 this will create rev 1.3
99 change on trunk to backport
100
101 $ echo "backport me" >> file1
102 $ cvsci -m"add other text" file1
103 $ cvscall log file1
104
105 RCS file: $TESTTMP/cvsrepo/proj/file1,v
106 Working file: file1
107 head: 1.3
108 branch:
109 locks: strict
110 access list:
111 symbolic names:
112 v1_1: 1.1.0.4
113 v1_0: 1.1.0.2
114 keyword substitution: kv
115 total revisions: 5; selected revisions: 5
116 description:
117 ----------------------------
118 revision 1.3
119 date: * (glob)
120 add other text
121 ----------------------------
122 revision 1.2
123 date: * (glob)
124 add text [MERGE from v1_1]
125 ----------------------------
126 revision 1.1
127 date: * (glob)
128 branches: 1.1.2; 1.1.4;
129 add file1 on trunk
130 ----------------------------
131 revision 1.1.4.1
132 date: * (glob)
133 add text [MERGE from v1_0]
134 ----------------------------
135 revision 1.1.2.1
136 date: * (glob)
137 add text
138 =============================================================================
139
140 XXX how many ways are there to spell "trunk" with CVS?
141 backport trunk change to v1_1
142
143 $ cvscall -Q update -rv1_1
144 $ cvscall -Q update -j1.2 -j1.3 file1
145 RCS file: $TESTTMP/cvsrepo/proj/file1,v
146 retrieving revision 1.2
147 retrieving revision 1.3
148 Merging differences between 1.2 and 1.3 into file1
149 $ cvsci -m"add other text [MERGE from HEAD]" file1
150
151 fix bug on v1_1, merge to trunk with error
152
153 $ cvscall -Q update -rv1_1
154 $ echo "merge forward" >> file1
155 $ cvscall -Q tag unmerged
156 $ cvsci -m"fix file1"
157 cvs commit: Examining .
158 $ cvscall -Q update -A
159 $ cvscall -Q update -junmerged -jv1_1
160 RCS file: $TESTTMP/cvsrepo/proj/file1,v
161 retrieving revision 1.1.4.2
162 retrieving revision 1.1.4.3
163 Merging differences between 1.1.4.2 and 1.1.4.3 into file1
164
165 note the typo in the commit log message
166
167 $ cvsci -m"fix file1 [MERGE from v1-1]"
168 cvs commit: Examining .
169 $ cvs -Q tag -d unmerged
170
171 convert to hg
172
173 $ cd ..
174 $ hg convert proj proj.hg
175 initializing destination proj.hg repository
176 connecting to $TESTTMP/cvsrepo
177 scanning source...
178 collecting CVS rlog
179 12 log entries
180 creating changesets
181 warning: CVS commit message references non-existent branch 'v1-1':
182 fix file1 [MERGE from v1-1]
183 10 changeset entries
184 sorting...
185 converting...
186 9 add file1 on trunk
187 8 unrelated change
188 7 add text
189 6 add text [MERGE from v1_0]
190 5 add text [MERGE from v1_1]
191 4 add file2 on trunk
192 3 add other text
193 2 add other text [MERGE from HEAD]
194 1 fix file1
195 0 fix file1 [MERGE from v1-1]
196
197 complete log
198
199 $ template="{rev}: '{branches}' {desc}\n"
200 $ hg -R proj.hg log --template="$template"
201 9: '' fix file1 [MERGE from v1-1]
202 8: 'v1_1' fix file1
203 7: 'v1_1' add other text [MERGE from HEAD]
204 6: '' add other text
205 5: '' add file2 on trunk
206 4: '' add text [MERGE from v1_1]
207 3: 'v1_1' add text [MERGE from v1_0]
208 2: 'v1_0' add text
209 1: 'v1_1' unrelated change
210 0: '' add file1 on trunk
211
212 graphical log
213
214 $ hg -R proj.hg log -G --template="$template"
215 o 9: '' fix file1 [MERGE from v1-1]
216 |
217 | o 8: 'v1_1' fix file1
218 | |
219 | o 7: 'v1_1' add other text [MERGE from HEAD]
220 |/|
221 o | 6: '' add other text
222 | |
223 o | 5: '' add file2 on trunk
224 | |
225 o | 4: '' add text [MERGE from v1_1]
226 |\|
227 | o 3: 'v1_1' add text [MERGE from v1_0]
228 | |\
229 +---o 2: 'v1_0' add text
230 | |
231 | o 1: 'v1_1' unrelated change
232 |/
233 o 0: '' add file1 on trunk
234