Fossil SCM

Started to adapt the integrity module. Renamed Check to CheckRev, and added analoguous commands for Tags and Branches. Added placeholders for the new integrity commands, updated main changeset integrity command.

aku 2007-11-29 06:31 trunk
Commit 7c28fe1312286211e78d5b18c4cfae9edef9a200
--- tools/cvs2fossil/lib/c2f_integrity.tcl
+++ tools/cvs2fossil/lib/c2f_integrity.tcl
@@ -55,13 +55,13 @@
5555
5656
typemethod changesets {} {
5757
log write 4 integrity {Check database consistency}
5858
5959
set n 0
60
- AllChangesets
6160
RevisionChangesets
62
- SymbolChangesets
61
+ TagChangesets
62
+ BranchChangesets
6363
return
6464
}
6565
6666
# # ## ### ##### ######## #############
6767
## Internal methods
@@ -73,11 +73,11 @@
7373
upvar 1 n n ; # Counter for the checks (we print an id before
7474
# the main label).
7575
7676
# Find all revisions which disagree with their line of
7777
# development about the project they are owned by.
78
- Check \
78
+ CheckRev \
7979
{Revisions and their LODs have to be in the same project} \
8080
{disagrees with its LOD about owning project} {
8181
SELECT F.name, R.rev
8282
FROM revision R, file F, symbol S
8383
WHERE R.fid = F.fid
@@ -85,11 +85,11 @@
8585
AND F.pid != S.pid
8686
;
8787
}
8888
# Find all revisions which disgree with their meta data about
8989
# the project they are owned by.
90
- Check \
90
+ CheckRev \
9191
{Revisions and their meta data have to be in the same project} \
9292
{disagrees with its meta data about owning project} {
9393
SELECT F.name, R.rev
9494
FROM revision R, file F, meta M
9595
WHERE R.fid = F.fid
@@ -97,11 +97,11 @@
9797
AND F.pid != M.pid
9898
;
9999
}
100100
# Find all revisions with a primary child which disagrees
101101
# about the file they belong to.
102
- Check \
102
+ CheckRev \
103103
{Revisions and their primary children have to be in the same file} \
104104
{disagrees with its primary child about the owning file} {
105105
SELECT F.name, R.rev
106106
FROM revision R, revision C, file F
107107
WHERE R.fid = F.fid
@@ -111,11 +111,11 @@
111111
;
112112
}
113113
114114
# Find all revisions with a branch parent symbol whose parent
115115
# disagrees about the file they belong to.
116
- Check \
116
+ CheckRev \
117117
{Revisions and their branch children have to be in the same file} \
118118
{at the beginning of its branch and its parent disagree about the owning file} {
119119
SELECT F.name, R.rev
120120
FROM revision R, revision P, file F
121121
WHERE R.fid = F.fid
@@ -124,11 +124,11 @@
124124
AND R.fid != P.fid
125125
;
126126
}
127127
# Find all revisions with a non-NTDB child which disagrees
128128
# about the file they belong to.
129
- Check \
129
+ CheckRev \
130130
{Revisions and their non-NTDB children have to be in the same file} \
131131
{disagrees with its non-NTDB child about the owning file} {
132132
SELECT F.name, R.rev
133133
FROM revision R, revision C, file F
134134
WHERE R.fid = F.fid
@@ -137,11 +137,11 @@
137137
AND C.fid != R.fid
138138
;
139139
}
140140
# Find all revisions which have a primary child, but the child
141141
# does not have them as parent.
142
- Check \
142
+ CheckRev \
143143
{Revisions have to be parents of their primary children} \
144144
{is not the parent of its primary child} {
145145
SELECT F.name, R.rev
146146
FROM revision R, revision C, file F
147147
WHERE R.fid = F.fid
@@ -150,11 +150,11 @@
150150
AND C.parent != R.rid
151151
;
152152
}
153153
# Find all revisions which have a primrary child, but the
154154
# child has a branch parent symbol making them brach starters.
155
- Check \
155
+ CheckRev \
156156
{Primary children of revisions must not start branches} \
157157
{is parent of a primary child which is the beginning of a branch} {
158158
SELECT F.name, R.rev
159159
FROM revision R, revision C, file F
160160
WHERE R.fid = F.fid
@@ -163,11 +163,11 @@
163163
AND C.bparent IS NOT NULL
164164
;
165165
}
166166
# Find all revisions without branch parent symbol which have a
167167
# parent, but the parent does not have them as primary child.
168
- Check \
168
+ CheckRev \
169169
{Revisions have to be primary children of their parents, if any} \
170170
{is not the child of its parent} {
171171
SELECT F.name, R.rev
172172
FROM revision R, revision P, file F
173173
WHERE R.fid = F.fid
@@ -177,11 +177,11 @@
177177
AND P.child != R.rid
178178
;
179179
}
180180
# Find all revisions with a branch parent symbol which do not
181181
# have a parent.
182
- Check \
182
+ CheckRev \
183183
{Branch starting revisions have to have a parent} \
184184
{at the beginning of its branch has no parent} {
185185
SELECT F.name, R.rev
186186
FROM revision R, file F
187187
WHERE R.fid = F.fid
@@ -189,11 +189,11 @@
189189
AND R.parent IS NULL
190190
;
191191
}
192192
# Find all revisions with a branch parent symbol whose parent
193193
# has them as primary child.
194
- Check \
194
+ CheckRev \
195195
{Branch starting revisions must not be primary children of their parents} \
196196
{at the beginning of its branch is the primary child of its parent} {
197197
SELECT F.name, R.rev
198198
FROM revision R, revision P, file F
199199
WHERE R.fid = F.fid
@@ -203,11 +203,11 @@
203203
AND P.child = R.rid
204204
;
205205
}
206206
# Find all revisions with a non-NTDB child which are not on
207207
# the NTDB.
208
- Check \
208
+ CheckRev \
209209
{NTDB to trunk transition has to begin on NTDB} \
210210
{has a non-NTDB child, yet is not on the NTDB} {
211211
SELECT F.name, R.rev
212212
FROM revision R, file F
213213
WHERE R.fid = F.fid
@@ -214,11 +214,11 @@
214214
AND R.dbchild IS NOT NULL
215215
AND NOT R.isdefault
216216
;
217217
}
218218
# Find all revisions with a NTDB parent which are on the NTDB.
219
- Check \
219
+ CheckRev \
220220
{NTDB to trunk transition has to end on non-NTDB} \
221221
{has a NTDB parent, yet is on the NTDB} {
222222
SELECT F.name, R.rev
223223
FROM revision R, file F
224224
WHERE R.fid = F.fid
@@ -226,11 +226,11 @@
226226
AND R.isdefault
227227
;
228228
}
229229
# Find all revisions with a child which disagrees about the
230230
# line of development they belong to.
231
- Check \
231
+ CheckRev \
232232
{Revisions and their primary children have to be in the same LOD} \
233233
{and its primary child disagree about their LOD} {
234234
SELECT F.name, R.rev
235235
FROM revision R, revision C, file F
236236
WHERE R.fid = F.fid
@@ -239,11 +239,11 @@
239239
AND C.lod != R.lod
240240
;
241241
}
242242
# Find all revisions with a non-NTDB child which agrees about
243243
# the line of development they belong to.
244
- Check \
244
+ CheckRev \
245245
{NTDB and trunk revisions have to be in different LODs} \
246246
{on NTDB and its non-NTDB child wrongly agree about their LOD} {
247247
SELECT F.name, R.rev
248248
FROM revision R, revision C, file F
249249
WHERE R.fid = F.fid
@@ -252,11 +252,11 @@
252252
AND C.lod = R.lod
253253
;
254254
}
255255
# Find all revisions with a branch parent symbol which is not
256256
# their LOD.
257
- Check \
257
+ CheckRev \
258258
{Branch starting revisions have to have their LOD as branch parent symbol} \
259259
{at the beginning of its branch does not have the branch symbol as its LOD} {
260260
SELECT F.name, R.rev
261261
FROM revision R, file F
262262
WHERE R.fid = F.fid
@@ -264,11 +264,11 @@
264264
AND R.lod != R.bparent
265265
;
266266
}
267267
# Find all revisions with a branch parent symbol whose parent
268268
# is in the same line of development.
269
- Check \
269
+ CheckRev \
270270
{Revisions and their branch children have to be in different LODs} \
271271
{at the beginning of its branch and its parent wrongly agree about their LOD} {
272272
SELECT F.name, R.rev
273273
FROM revision R, revision P, file F
274274
WHERE R.fid = F.fid
@@ -287,11 +287,11 @@
287287
upvar 1 n n ; # Counter for the checks (we print an id before
288288
# the main label).
289289
290290
# Find all revisions which disgree with their meta data about
291291
# the branch/line of development they belong to.
292
- Check \
292
+ CheckRev \
293293
{Revisions and their meta data have to be in the same LOD} \
294294
{disagrees with its meta data about owning LOD} {
295295
SELECT F.name, R.rev
296296
FROM revision R, meta M, file F
297297
WHERE R.mid = M.mid
@@ -310,11 +310,11 @@
310310
upvar 1 n n ; # Counter for the checks (we print an id before
311311
# the main label).
312312
313313
# Find all revisions which are not used by at least one
314314
# revision changeset.
315
- Check \
315
+ CheckRev \
316316
{All revisions have to be used by least one revision changeset} \
317317
{is not used by a revision changeset} {
318318
-- Unused revisions = All revisions
319319
-- - revisions used by revision changesets.
320320
--
@@ -331,11 +331,11 @@
331331
AND C.type = 0) -- changeset
332332
AND R.fid = F.fid -- get file of unused revision
333333
}
334334
# Find all revisions which are used by more than one revision
335335
# changeset.
336
- Check \
336
+ CheckRev \
337337
{All revisions have to be used by at most one revision changeset} \
338338
{is used by multiple revision changesets} {
339339
-- Principle of operation: Get all revision/changeset
340340
-- pairs for all revision changesets, group by
341341
-- revision to aggregate the changeset, counting
@@ -450,10 +450,32 @@
450450
AND R.fid = F.fid -- get file of the revision
451451
AND CT.tid = C.type -- get changeset type, for labeling
452452
}
453453
return
454454
}
455
+
456
+ proc TagChangesets {} {
457
+ # This code performs a number of paranoid checks of the
458
+ # database, searching for inconsistent changeset/revision
459
+ # information.
460
+
461
+ return ; # Disabled for now, bottlenecks ...
462
+
463
+ upvar 1 n n ; # Counter for the checks (we print an id before
464
+ # the main label).
465
+ }
466
+
467
+ proc BranchChangesets {} {
468
+ # This code performs a number of paranoid checks of the
469
+ # database, searching for inconsistent changeset/revision
470
+ # information.
471
+
472
+ return ; # Disabled for now, bottlenecks ...
473
+
474
+ upvar 1 n n ; # Counter for the checks (we print an id before
475
+ # the main label).
476
+ }
455477
456478
proc SymbolChangesets {} {
457479
# This code performs a number of paranoid checks of the
458480
# database, searching for inconsistent changeset/revision
459481
# information.
@@ -515,16 +537,38 @@
515537
# for all known branches.
516538
return
517539
}
518540
519541
520
- proc Check {header label sql} {
542
+ proc CheckRev {header label sql} {
521543
upvar 1 n n
522544
set ok 1
523545
foreach {fname revnr} [state run $sql] {
524546
set ok 0
525547
trouble fatal "$fname <$revnr> $label"
548
+ }
549
+ log write 5 integrity {\[[format %02d [incr n]]\] [expr {$ok ? "Ok " : "Failed"}] ... $header}
550
+ return
551
+ }
552
+
553
+ proc CheckTag {header label sql} {
554
+ upvar 1 n n
555
+ set ok 1
556
+ foreach {pname sname} [state run $sql] {
557
+ set ok 0
558
+ trouble fatal "<$pname tag '$sname'> $label"
559
+ }
560
+ log write 5 integrity {\[[format %02d [incr n]]\] [expr {$ok ? "Ok " : "Failed"}] ... $header}
561
+ return
562
+ }
563
+
564
+ proc CheckBranch {header label sql} {
565
+ upvar 1 n n
566
+ set ok 1
567
+ foreach {pname sname} [state run $sql] {
568
+ set ok 0
569
+ trouble fatal "<$pname branch '$sname'> $label"
526570
}
527571
log write 5 integrity {\[[format %02d [incr n]]\] [expr {$ok ? "Ok " : "Failed"}] ... $header}
528572
return
529573
}
530574
531575
--- tools/cvs2fossil/lib/c2f_integrity.tcl
+++ tools/cvs2fossil/lib/c2f_integrity.tcl
@@ -55,13 +55,13 @@
55
56 typemethod changesets {} {
57 log write 4 integrity {Check database consistency}
58
59 set n 0
60 AllChangesets
61 RevisionChangesets
62 SymbolChangesets
 
63 return
64 }
65
66 # # ## ### ##### ######## #############
67 ## Internal methods
@@ -73,11 +73,11 @@
73 upvar 1 n n ; # Counter for the checks (we print an id before
74 # the main label).
75
76 # Find all revisions which disagree with their line of
77 # development about the project they are owned by.
78 Check \
79 {Revisions and their LODs have to be in the same project} \
80 {disagrees with its LOD about owning project} {
81 SELECT F.name, R.rev
82 FROM revision R, file F, symbol S
83 WHERE R.fid = F.fid
@@ -85,11 +85,11 @@
85 AND F.pid != S.pid
86 ;
87 }
88 # Find all revisions which disgree with their meta data about
89 # the project they are owned by.
90 Check \
91 {Revisions and their meta data have to be in the same project} \
92 {disagrees with its meta data about owning project} {
93 SELECT F.name, R.rev
94 FROM revision R, file F, meta M
95 WHERE R.fid = F.fid
@@ -97,11 +97,11 @@
97 AND F.pid != M.pid
98 ;
99 }
100 # Find all revisions with a primary child which disagrees
101 # about the file they belong to.
102 Check \
103 {Revisions and their primary children have to be in the same file} \
104 {disagrees with its primary child about the owning file} {
105 SELECT F.name, R.rev
106 FROM revision R, revision C, file F
107 WHERE R.fid = F.fid
@@ -111,11 +111,11 @@
111 ;
112 }
113
114 # Find all revisions with a branch parent symbol whose parent
115 # disagrees about the file they belong to.
116 Check \
117 {Revisions and their branch children have to be in the same file} \
118 {at the beginning of its branch and its parent disagree about the owning file} {
119 SELECT F.name, R.rev
120 FROM revision R, revision P, file F
121 WHERE R.fid = F.fid
@@ -124,11 +124,11 @@
124 AND R.fid != P.fid
125 ;
126 }
127 # Find all revisions with a non-NTDB child which disagrees
128 # about the file they belong to.
129 Check \
130 {Revisions and their non-NTDB children have to be in the same file} \
131 {disagrees with its non-NTDB child about the owning file} {
132 SELECT F.name, R.rev
133 FROM revision R, revision C, file F
134 WHERE R.fid = F.fid
@@ -137,11 +137,11 @@
137 AND C.fid != R.fid
138 ;
139 }
140 # Find all revisions which have a primary child, but the child
141 # does not have them as parent.
142 Check \
143 {Revisions have to be parents of their primary children} \
144 {is not the parent of its primary child} {
145 SELECT F.name, R.rev
146 FROM revision R, revision C, file F
147 WHERE R.fid = F.fid
@@ -150,11 +150,11 @@
150 AND C.parent != R.rid
151 ;
152 }
153 # Find all revisions which have a primrary child, but the
154 # child has a branch parent symbol making them brach starters.
155 Check \
156 {Primary children of revisions must not start branches} \
157 {is parent of a primary child which is the beginning of a branch} {
158 SELECT F.name, R.rev
159 FROM revision R, revision C, file F
160 WHERE R.fid = F.fid
@@ -163,11 +163,11 @@
163 AND C.bparent IS NOT NULL
164 ;
165 }
166 # Find all revisions without branch parent symbol which have a
167 # parent, but the parent does not have them as primary child.
168 Check \
169 {Revisions have to be primary children of their parents, if any} \
170 {is not the child of its parent} {
171 SELECT F.name, R.rev
172 FROM revision R, revision P, file F
173 WHERE R.fid = F.fid
@@ -177,11 +177,11 @@
177 AND P.child != R.rid
178 ;
179 }
180 # Find all revisions with a branch parent symbol which do not
181 # have a parent.
182 Check \
183 {Branch starting revisions have to have a parent} \
184 {at the beginning of its branch has no parent} {
185 SELECT F.name, R.rev
186 FROM revision R, file F
187 WHERE R.fid = F.fid
@@ -189,11 +189,11 @@
189 AND R.parent IS NULL
190 ;
191 }
192 # Find all revisions with a branch parent symbol whose parent
193 # has them as primary child.
194 Check \
195 {Branch starting revisions must not be primary children of their parents} \
196 {at the beginning of its branch is the primary child of its parent} {
197 SELECT F.name, R.rev
198 FROM revision R, revision P, file F
199 WHERE R.fid = F.fid
@@ -203,11 +203,11 @@
203 AND P.child = R.rid
204 ;
205 }
206 # Find all revisions with a non-NTDB child which are not on
207 # the NTDB.
208 Check \
209 {NTDB to trunk transition has to begin on NTDB} \
210 {has a non-NTDB child, yet is not on the NTDB} {
211 SELECT F.name, R.rev
212 FROM revision R, file F
213 WHERE R.fid = F.fid
@@ -214,11 +214,11 @@
214 AND R.dbchild IS NOT NULL
215 AND NOT R.isdefault
216 ;
217 }
218 # Find all revisions with a NTDB parent which are on the NTDB.
219 Check \
220 {NTDB to trunk transition has to end on non-NTDB} \
221 {has a NTDB parent, yet is on the NTDB} {
222 SELECT F.name, R.rev
223 FROM revision R, file F
224 WHERE R.fid = F.fid
@@ -226,11 +226,11 @@
226 AND R.isdefault
227 ;
228 }
229 # Find all revisions with a child which disagrees about the
230 # line of development they belong to.
231 Check \
232 {Revisions and their primary children have to be in the same LOD} \
233 {and its primary child disagree about their LOD} {
234 SELECT F.name, R.rev
235 FROM revision R, revision C, file F
236 WHERE R.fid = F.fid
@@ -239,11 +239,11 @@
239 AND C.lod != R.lod
240 ;
241 }
242 # Find all revisions with a non-NTDB child which agrees about
243 # the line of development they belong to.
244 Check \
245 {NTDB and trunk revisions have to be in different LODs} \
246 {on NTDB and its non-NTDB child wrongly agree about their LOD} {
247 SELECT F.name, R.rev
248 FROM revision R, revision C, file F
249 WHERE R.fid = F.fid
@@ -252,11 +252,11 @@
252 AND C.lod = R.lod
253 ;
254 }
255 # Find all revisions with a branch parent symbol which is not
256 # their LOD.
257 Check \
258 {Branch starting revisions have to have their LOD as branch parent symbol} \
259 {at the beginning of its branch does not have the branch symbol as its LOD} {
260 SELECT F.name, R.rev
261 FROM revision R, file F
262 WHERE R.fid = F.fid
@@ -264,11 +264,11 @@
264 AND R.lod != R.bparent
265 ;
266 }
267 # Find all revisions with a branch parent symbol whose parent
268 # is in the same line of development.
269 Check \
270 {Revisions and their branch children have to be in different LODs} \
271 {at the beginning of its branch and its parent wrongly agree about their LOD} {
272 SELECT F.name, R.rev
273 FROM revision R, revision P, file F
274 WHERE R.fid = F.fid
@@ -287,11 +287,11 @@
287 upvar 1 n n ; # Counter for the checks (we print an id before
288 # the main label).
289
290 # Find all revisions which disgree with their meta data about
291 # the branch/line of development they belong to.
292 Check \
293 {Revisions and their meta data have to be in the same LOD} \
294 {disagrees with its meta data about owning LOD} {
295 SELECT F.name, R.rev
296 FROM revision R, meta M, file F
297 WHERE R.mid = M.mid
@@ -310,11 +310,11 @@
310 upvar 1 n n ; # Counter for the checks (we print an id before
311 # the main label).
312
313 # Find all revisions which are not used by at least one
314 # revision changeset.
315 Check \
316 {All revisions have to be used by least one revision changeset} \
317 {is not used by a revision changeset} {
318 -- Unused revisions = All revisions
319 -- - revisions used by revision changesets.
320 --
@@ -331,11 +331,11 @@
331 AND C.type = 0) -- changeset
332 AND R.fid = F.fid -- get file of unused revision
333 }
334 # Find all revisions which are used by more than one revision
335 # changeset.
336 Check \
337 {All revisions have to be used by at most one revision changeset} \
338 {is used by multiple revision changesets} {
339 -- Principle of operation: Get all revision/changeset
340 -- pairs for all revision changesets, group by
341 -- revision to aggregate the changeset, counting
@@ -450,10 +450,32 @@
450 AND R.fid = F.fid -- get file of the revision
451 AND CT.tid = C.type -- get changeset type, for labeling
452 }
453 return
454 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
455
456 proc SymbolChangesets {} {
457 # This code performs a number of paranoid checks of the
458 # database, searching for inconsistent changeset/revision
459 # information.
@@ -515,16 +537,38 @@
515 # for all known branches.
516 return
517 }
518
519
520 proc Check {header label sql} {
521 upvar 1 n n
522 set ok 1
523 foreach {fname revnr} [state run $sql] {
524 set ok 0
525 trouble fatal "$fname <$revnr> $label"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
526 }
527 log write 5 integrity {\[[format %02d [incr n]]\] [expr {$ok ? "Ok " : "Failed"}] ... $header}
528 return
529 }
530
531
--- tools/cvs2fossil/lib/c2f_integrity.tcl
+++ tools/cvs2fossil/lib/c2f_integrity.tcl
@@ -55,13 +55,13 @@
55
56 typemethod changesets {} {
57 log write 4 integrity {Check database consistency}
58
59 set n 0
 
60 RevisionChangesets
61 TagChangesets
62 BranchChangesets
63 return
64 }
65
66 # # ## ### ##### ######## #############
67 ## Internal methods
@@ -73,11 +73,11 @@
73 upvar 1 n n ; # Counter for the checks (we print an id before
74 # the main label).
75
76 # Find all revisions which disagree with their line of
77 # development about the project they are owned by.
78 CheckRev \
79 {Revisions and their LODs have to be in the same project} \
80 {disagrees with its LOD about owning project} {
81 SELECT F.name, R.rev
82 FROM revision R, file F, symbol S
83 WHERE R.fid = F.fid
@@ -85,11 +85,11 @@
85 AND F.pid != S.pid
86 ;
87 }
88 # Find all revisions which disgree with their meta data about
89 # the project they are owned by.
90 CheckRev \
91 {Revisions and their meta data have to be in the same project} \
92 {disagrees with its meta data about owning project} {
93 SELECT F.name, R.rev
94 FROM revision R, file F, meta M
95 WHERE R.fid = F.fid
@@ -97,11 +97,11 @@
97 AND F.pid != M.pid
98 ;
99 }
100 # Find all revisions with a primary child which disagrees
101 # about the file they belong to.
102 CheckRev \
103 {Revisions and their primary children have to be in the same file} \
104 {disagrees with its primary child about the owning file} {
105 SELECT F.name, R.rev
106 FROM revision R, revision C, file F
107 WHERE R.fid = F.fid
@@ -111,11 +111,11 @@
111 ;
112 }
113
114 # Find all revisions with a branch parent symbol whose parent
115 # disagrees about the file they belong to.
116 CheckRev \
117 {Revisions and their branch children have to be in the same file} \
118 {at the beginning of its branch and its parent disagree about the owning file} {
119 SELECT F.name, R.rev
120 FROM revision R, revision P, file F
121 WHERE R.fid = F.fid
@@ -124,11 +124,11 @@
124 AND R.fid != P.fid
125 ;
126 }
127 # Find all revisions with a non-NTDB child which disagrees
128 # about the file they belong to.
129 CheckRev \
130 {Revisions and their non-NTDB children have to be in the same file} \
131 {disagrees with its non-NTDB child about the owning file} {
132 SELECT F.name, R.rev
133 FROM revision R, revision C, file F
134 WHERE R.fid = F.fid
@@ -137,11 +137,11 @@
137 AND C.fid != R.fid
138 ;
139 }
140 # Find all revisions which have a primary child, but the child
141 # does not have them as parent.
142 CheckRev \
143 {Revisions have to be parents of their primary children} \
144 {is not the parent of its primary child} {
145 SELECT F.name, R.rev
146 FROM revision R, revision C, file F
147 WHERE R.fid = F.fid
@@ -150,11 +150,11 @@
150 AND C.parent != R.rid
151 ;
152 }
153 # Find all revisions which have a primrary child, but the
154 # child has a branch parent symbol making them brach starters.
155 CheckRev \
156 {Primary children of revisions must not start branches} \
157 {is parent of a primary child which is the beginning of a branch} {
158 SELECT F.name, R.rev
159 FROM revision R, revision C, file F
160 WHERE R.fid = F.fid
@@ -163,11 +163,11 @@
163 AND C.bparent IS NOT NULL
164 ;
165 }
166 # Find all revisions without branch parent symbol which have a
167 # parent, but the parent does not have them as primary child.
168 CheckRev \
169 {Revisions have to be primary children of their parents, if any} \
170 {is not the child of its parent} {
171 SELECT F.name, R.rev
172 FROM revision R, revision P, file F
173 WHERE R.fid = F.fid
@@ -177,11 +177,11 @@
177 AND P.child != R.rid
178 ;
179 }
180 # Find all revisions with a branch parent symbol which do not
181 # have a parent.
182 CheckRev \
183 {Branch starting revisions have to have a parent} \
184 {at the beginning of its branch has no parent} {
185 SELECT F.name, R.rev
186 FROM revision R, file F
187 WHERE R.fid = F.fid
@@ -189,11 +189,11 @@
189 AND R.parent IS NULL
190 ;
191 }
192 # Find all revisions with a branch parent symbol whose parent
193 # has them as primary child.
194 CheckRev \
195 {Branch starting revisions must not be primary children of their parents} \
196 {at the beginning of its branch is the primary child of its parent} {
197 SELECT F.name, R.rev
198 FROM revision R, revision P, file F
199 WHERE R.fid = F.fid
@@ -203,11 +203,11 @@
203 AND P.child = R.rid
204 ;
205 }
206 # Find all revisions with a non-NTDB child which are not on
207 # the NTDB.
208 CheckRev \
209 {NTDB to trunk transition has to begin on NTDB} \
210 {has a non-NTDB child, yet is not on the NTDB} {
211 SELECT F.name, R.rev
212 FROM revision R, file F
213 WHERE R.fid = F.fid
@@ -214,11 +214,11 @@
214 AND R.dbchild IS NOT NULL
215 AND NOT R.isdefault
216 ;
217 }
218 # Find all revisions with a NTDB parent which are on the NTDB.
219 CheckRev \
220 {NTDB to trunk transition has to end on non-NTDB} \
221 {has a NTDB parent, yet is on the NTDB} {
222 SELECT F.name, R.rev
223 FROM revision R, file F
224 WHERE R.fid = F.fid
@@ -226,11 +226,11 @@
226 AND R.isdefault
227 ;
228 }
229 # Find all revisions with a child which disagrees about the
230 # line of development they belong to.
231 CheckRev \
232 {Revisions and their primary children have to be in the same LOD} \
233 {and its primary child disagree about their LOD} {
234 SELECT F.name, R.rev
235 FROM revision R, revision C, file F
236 WHERE R.fid = F.fid
@@ -239,11 +239,11 @@
239 AND C.lod != R.lod
240 ;
241 }
242 # Find all revisions with a non-NTDB child which agrees about
243 # the line of development they belong to.
244 CheckRev \
245 {NTDB and trunk revisions have to be in different LODs} \
246 {on NTDB and its non-NTDB child wrongly agree about their LOD} {
247 SELECT F.name, R.rev
248 FROM revision R, revision C, file F
249 WHERE R.fid = F.fid
@@ -252,11 +252,11 @@
252 AND C.lod = R.lod
253 ;
254 }
255 # Find all revisions with a branch parent symbol which is not
256 # their LOD.
257 CheckRev \
258 {Branch starting revisions have to have their LOD as branch parent symbol} \
259 {at the beginning of its branch does not have the branch symbol as its LOD} {
260 SELECT F.name, R.rev
261 FROM revision R, file F
262 WHERE R.fid = F.fid
@@ -264,11 +264,11 @@
264 AND R.lod != R.bparent
265 ;
266 }
267 # Find all revisions with a branch parent symbol whose parent
268 # is in the same line of development.
269 CheckRev \
270 {Revisions and their branch children have to be in different LODs} \
271 {at the beginning of its branch and its parent wrongly agree about their LOD} {
272 SELECT F.name, R.rev
273 FROM revision R, revision P, file F
274 WHERE R.fid = F.fid
@@ -287,11 +287,11 @@
287 upvar 1 n n ; # Counter for the checks (we print an id before
288 # the main label).
289
290 # Find all revisions which disgree with their meta data about
291 # the branch/line of development they belong to.
292 CheckRev \
293 {Revisions and their meta data have to be in the same LOD} \
294 {disagrees with its meta data about owning LOD} {
295 SELECT F.name, R.rev
296 FROM revision R, meta M, file F
297 WHERE R.mid = M.mid
@@ -310,11 +310,11 @@
310 upvar 1 n n ; # Counter for the checks (we print an id before
311 # the main label).
312
313 # Find all revisions which are not used by at least one
314 # revision changeset.
315 CheckRev \
316 {All revisions have to be used by least one revision changeset} \
317 {is not used by a revision changeset} {
318 -- Unused revisions = All revisions
319 -- - revisions used by revision changesets.
320 --
@@ -331,11 +331,11 @@
331 AND C.type = 0) -- changeset
332 AND R.fid = F.fid -- get file of unused revision
333 }
334 # Find all revisions which are used by more than one revision
335 # changeset.
336 CheckRev \
337 {All revisions have to be used by at most one revision changeset} \
338 {is used by multiple revision changesets} {
339 -- Principle of operation: Get all revision/changeset
340 -- pairs for all revision changesets, group by
341 -- revision to aggregate the changeset, counting
@@ -450,10 +450,32 @@
450 AND R.fid = F.fid -- get file of the revision
451 AND CT.tid = C.type -- get changeset type, for labeling
452 }
453 return
454 }
455
456 proc TagChangesets {} {
457 # This code performs a number of paranoid checks of the
458 # database, searching for inconsistent changeset/revision
459 # information.
460
461 return ; # Disabled for now, bottlenecks ...
462
463 upvar 1 n n ; # Counter for the checks (we print an id before
464 # the main label).
465 }
466
467 proc BranchChangesets {} {
468 # This code performs a number of paranoid checks of the
469 # database, searching for inconsistent changeset/revision
470 # information.
471
472 return ; # Disabled for now, bottlenecks ...
473
474 upvar 1 n n ; # Counter for the checks (we print an id before
475 # the main label).
476 }
477
478 proc SymbolChangesets {} {
479 # This code performs a number of paranoid checks of the
480 # database, searching for inconsistent changeset/revision
481 # information.
@@ -515,16 +537,38 @@
537 # for all known branches.
538 return
539 }
540
541
542 proc CheckRev {header label sql} {
543 upvar 1 n n
544 set ok 1
545 foreach {fname revnr} [state run $sql] {
546 set ok 0
547 trouble fatal "$fname <$revnr> $label"
548 }
549 log write 5 integrity {\[[format %02d [incr n]]\] [expr {$ok ? "Ok " : "Failed"}] ... $header}
550 return
551 }
552
553 proc CheckTag {header label sql} {
554 upvar 1 n n
555 set ok 1
556 foreach {pname sname} [state run $sql] {
557 set ok 0
558 trouble fatal "<$pname tag '$sname'> $label"
559 }
560 log write 5 integrity {\[[format %02d [incr n]]\] [expr {$ok ? "Ok " : "Failed"}] ... $header}
561 return
562 }
563
564 proc CheckBranch {header label sql} {
565 upvar 1 n n
566 set ok 1
567 foreach {pname sname} [state run $sql] {
568 set ok 0
569 trouble fatal "<$pname branch '$sname'> $label"
570 }
571 log write 5 integrity {\[[format %02d [incr n]]\] [expr {$ok ? "Ok " : "Failed"}] ... $header}
572 return
573 }
574
575

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button