Fossil SCM
Added comments to the sql commands in the integrity checks.
Commit
727f370c2927c0788f0adc64f16d67258b237c34
Parent
6809145eb16fb37…
1 file changed
+207
-156
+207
-156
| --- tools/cvs2fossil/lib/c2f_integrity.tcl | ||
| +++ tools/cvs2fossil/lib/c2f_integrity.tcl | ||
| @@ -78,38 +78,38 @@ | ||
| 78 | 78 | CheckRev \ |
| 79 | 79 | {Revisions and their LODs have to be in the same project} \ |
| 80 | 80 | {disagrees with its LOD about owning project} { |
| 81 | 81 | SELECT F.name, R.rev |
| 82 | 82 | FROM revision R, file F, symbol S |
| 83 | - WHERE R.fid = F.fid | |
| 84 | - AND R.lod = S.sid | |
| 85 | - AND F.pid != S.pid | |
| 83 | + WHERE R.fid = F.fid -- get file of rev | |
| 84 | + AND R.lod = S.sid -- get symbol of its lod | |
| 85 | + AND F.pid != S.pid -- disagreement about the owning project | |
| 86 | 86 | ; |
| 87 | 87 | } |
| 88 | 88 | # Find all revisions which disgree with their meta data about |
| 89 | 89 | # the project they are owned by. |
| 90 | 90 | CheckRev \ |
| 91 | 91 | {Revisions and their meta data have to be in the same project} \ |
| 92 | 92 | {disagrees with its meta data about owning project} { |
| 93 | 93 | SELECT F.name, R.rev |
| 94 | 94 | FROM revision R, file F, meta M |
| 95 | - WHERE R.fid = F.fid | |
| 96 | - AND R.mid = M.mid | |
| 97 | - AND F.pid != M.pid | |
| 95 | + WHERE R.fid = F.fid -- get file of rev | |
| 96 | + AND R.mid = M.mid -- get meta of rev | |
| 97 | + AND F.pid != M.pid -- disagreement about owning project | |
| 98 | 98 | ; |
| 99 | 99 | } |
| 100 | 100 | # Find all revisions with a primary child which disagrees |
| 101 | 101 | # about the file they belong to. |
| 102 | 102 | CheckRev \ |
| 103 | 103 | {Revisions and their primary children have to be in the same file} \ |
| 104 | 104 | {disagrees with its primary child about the owning file} { |
| 105 | 105 | SELECT F.name, R.rev |
| 106 | 106 | FROM revision R, revision C, file F |
| 107 | - WHERE R.fid = F.fid | |
| 108 | - AND R.child IS NOT NULL | |
| 109 | - AND R.child = C.rid | |
| 110 | - AND C.fid != R.fid | |
| 107 | + WHERE R.fid = F.fid -- get file of rev | |
| 108 | + AND R.child IS NOT NULL -- get all with primary children | |
| 109 | + AND R.child = C.rid -- get primary child | |
| 110 | + AND C.fid != R.fid -- wrongly in different file | |
| 111 | 111 | ; |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | # Find all revisions with a branch parent symbol whose parent |
| 115 | 115 | # disagrees about the file they belong to. |
| @@ -116,170 +116,170 @@ | ||
| 116 | 116 | CheckRev \ |
| 117 | 117 | {Revisions and their branch children have to be in the same file} \ |
| 118 | 118 | {at the beginning of its branch and its parent disagree about the owning file} { |
| 119 | 119 | SELECT F.name, R.rev |
| 120 | 120 | FROM revision R, revision P, file F |
| 121 | - WHERE R.fid = F.fid | |
| 122 | - AND R.bparent IS NOT NULL | |
| 123 | - AND R.parent = P.rid | |
| 124 | - AND R.fid != P.fid | |
| 121 | + WHERE R.fid = F.fid -- get file of rev | |
| 122 | + AND R.bparent IS NOT NULL -- get first-of-branch revisions | |
| 123 | + AND R.parent = P.rid -- get out-of-branch parent | |
| 124 | + AND R.fid != P.fid -- wrongly in different file | |
| 125 | 125 | ; |
| 126 | 126 | } |
| 127 | 127 | # Find all revisions with a non-NTDB child which disagrees |
| 128 | 128 | # about the file they belong to. |
| 129 | 129 | CheckRev \ |
| 130 | 130 | {Revisions and their non-NTDB children have to be in the same file} \ |
| 131 | 131 | {disagrees with its non-NTDB child about the owning file} { |
| 132 | 132 | SELECT F.name, R.rev |
| 133 | 133 | FROM revision R, revision C, file F |
| 134 | - WHERE R.fid = F.fid | |
| 135 | - AND R.dbchild IS NOT NULL | |
| 136 | - AND R.dbchild = C.rid | |
| 137 | - AND C.fid != R.fid | |
| 134 | + WHERE R.fid = F.fid -- get file of rev | |
| 135 | + AND R.dbchild IS NOT NULL -- get last NTDB revisions | |
| 136 | + AND R.dbchild = C.rid -- get their child | |
| 137 | + AND C.fid != R.fid -- wrongly in different file | |
| 138 | 138 | ; |
| 139 | 139 | } |
| 140 | 140 | # Find all revisions which have a primary child, but the child |
| 141 | 141 | # does not have them as parent. |
| 142 | 142 | CheckRev \ |
| 143 | 143 | {Revisions have to be parents of their primary children} \ |
| 144 | 144 | {is not the parent of its primary child} { |
| 145 | 145 | SELECT F.name, R.rev |
| 146 | 146 | FROM revision R, revision C, file F |
| 147 | - WHERE R.fid = F.fid | |
| 148 | - AND R.child IS NOT NULL | |
| 149 | - AND R.child = C.rid | |
| 150 | - AND C.parent != R.rid | |
| 147 | + WHERE R.fid = F.fid -- get file of rev | |
| 148 | + AND R.child IS NOT NULL -- get all with primary children | |
| 149 | + AND R.child = C.rid -- get primary child | |
| 150 | + AND C.parent != R.rid -- child's parent wrongly not us | |
| 151 | 151 | ; |
| 152 | 152 | } |
| 153 | 153 | # Find all revisions which have a primrary child, but the |
| 154 | 154 | # child has a branch parent symbol making them brach starters. |
| 155 | 155 | CheckRev \ |
| 156 | 156 | {Primary children of revisions must not start branches} \ |
| 157 | 157 | {is parent of a primary child which is the beginning of a branch} { |
| 158 | 158 | SELECT F.name, R.rev |
| 159 | 159 | FROM revision R, revision C, file F |
| 160 | - WHERE R.fid = F.fid | |
| 161 | - AND R.child IS NOT NULL | |
| 162 | - AND R.child = C.rid | |
| 163 | - AND C.bparent IS NOT NULL | |
| 160 | + WHERE R.fid = F.fid -- get file of rev | |
| 161 | + AND R.child IS NOT NULL -- get all with primary children | |
| 162 | + AND R.child = C.rid -- get primary child | |
| 163 | + AND C.bparent IS NOT NULL -- but indicates to be on branch | |
| 164 | 164 | ; |
| 165 | 165 | } |
| 166 | 166 | # Find all revisions without branch parent symbol which have a |
| 167 | 167 | # parent, but the parent does not have them as primary child. |
| 168 | 168 | CheckRev \ |
| 169 | 169 | {Revisions have to be primary children of their parents, if any} \ |
| 170 | 170 | {is not the child of its parent} { |
| 171 | 171 | SELECT F.name, R.rev |
| 172 | 172 | FROM revision R, revision P, file F |
| 173 | - WHERE R.fid = F.fid | |
| 174 | - AND R.bparent IS NULL | |
| 175 | - AND R.parent IS NOT NULL | |
| 176 | - AND R.parent = P.rid | |
| 177 | - AND P.child != R.rid | |
| 173 | + WHERE R.fid = F.fid -- get file of revision | |
| 174 | + AND R.bparent IS NULL -- exclude all first-on-branch revisions | |
| 175 | + AND R.parent IS NOT NULL -- which are not root of their line | |
| 176 | + AND R.parent = P.rid -- get in-lod parent | |
| 177 | + AND P.child != R.rid -- but does not have rev as primary child | |
| 178 | 178 | ; |
| 179 | 179 | } |
| 180 | 180 | # Find all revisions with a branch parent symbol which do not |
| 181 | 181 | # have a parent. |
| 182 | 182 | CheckRev \ |
| 183 | 183 | {Branch starting revisions have to have a parent, if not detached} \ |
| 184 | 184 | {at the beginning of its branch has no parent, but its branch has} { |
| 185 | 185 | SELECT F.name, R.rev |
| 186 | 186 | FROM revision R, file F, branch B |
| 187 | - WHERE R.fid = F.fid | |
| 188 | - AND R.bparent IS NOT NULL | |
| 189 | - AND R.parent IS NULL | |
| 190 | - AND B.sid = R.bparent | |
| 191 | - AND B.fid = R.fid | |
| 192 | - AND B.root IS NOT NULL | |
| 187 | + WHERE R.fid = F.fid -- get file of revision | |
| 188 | + AND R.bparent IS NOT NULL -- limit to first-on-branch revisions | |
| 189 | + AND R.parent IS NULL -- which are detached | |
| 190 | + AND B.sid = R.bparent -- get branch governing the rev | |
| 191 | + AND B.fid = R.fid -- in the revision's file | |
| 192 | + AND B.root IS NOT NULL -- but says that branch is attached | |
| 193 | 193 | ; |
| 194 | 194 | } |
| 195 | 195 | # Find all revisions with a branch parent symbol whose parent |
| 196 | 196 | # has them as primary child. |
| 197 | 197 | CheckRev \ |
| 198 | 198 | {Branch starting revisions must not be primary children of their parents} \ |
| 199 | 199 | {at the beginning of its branch is the primary child of its parent} { |
| 200 | 200 | SELECT F.name, R.rev |
| 201 | 201 | FROM revision R, revision P, file F |
| 202 | - WHERE R.fid = F.fid | |
| 203 | - AND R.bparent IS NOT NULL | |
| 204 | - AND R.parent IS NOT NULL | |
| 205 | - AND R.parent = P.rid | |
| 206 | - AND P.child = R.rid | |
| 202 | + WHERE R.fid = F.fid -- get file of revision | |
| 203 | + AND R.bparent IS NOT NULL -- limit to first-on-branch revisions | |
| 204 | + AND R.parent IS NOT NULL -- which are attached | |
| 205 | + AND R.parent = P.rid -- get out-of-branch parent | |
| 206 | + AND P.child = R.rid -- wrongly has rev as primary child | |
| 207 | 207 | ; |
| 208 | 208 | } |
| 209 | 209 | # Find all revisions with a non-NTDB child which are not on |
| 210 | 210 | # the NTDB. |
| 211 | 211 | CheckRev \ |
| 212 | 212 | {NTDB to trunk transition has to begin on NTDB} \ |
| 213 | 213 | {has a non-NTDB child, yet is not on the NTDB} { |
| 214 | 214 | SELECT F.name, R.rev |
| 215 | 215 | FROM revision R, file F |
| 216 | - WHERE R.fid = F.fid | |
| 217 | - AND R.dbchild IS NOT NULL | |
| 218 | - AND NOT R.isdefault | |
| 216 | + WHERE R.fid = F.fid -- get file of revision | |
| 217 | + AND R.dbchild IS NOT NULL -- limit to last NTDB revision | |
| 218 | + AND NOT R.isdefault -- but signals not-NTDB | |
| 219 | 219 | ; |
| 220 | 220 | } |
| 221 | 221 | # Find all revisions with a NTDB parent which are on the NTDB. |
| 222 | 222 | CheckRev \ |
| 223 | 223 | {NTDB to trunk transition has to end on non-NTDB} \ |
| 224 | 224 | {has a NTDB parent, yet is on the NTDB} { |
| 225 | 225 | SELECT F.name, R.rev |
| 226 | 226 | FROM revision R, file F |
| 227 | - WHERE R.fid = F.fid | |
| 228 | - AND R.dbparent IS NOT NULL | |
| 229 | - AND R.isdefault | |
| 227 | + WHERE R.fid = F.fid -- get file of revision | |
| 228 | + AND R.dbparent IS NOT NULL -- limit to roots of non-NTDB | |
| 229 | + AND R.isdefault -- but signals to be NTDB | |
| 230 | 230 | ; |
| 231 | 231 | } |
| 232 | 232 | # Find all revisions with a child which disagrees about the |
| 233 | 233 | # line of development they belong to. |
| 234 | 234 | CheckRev \ |
| 235 | 235 | {Revisions and their primary children have to be in the same LOD} \ |
| 236 | 236 | {and its primary child disagree about their LOD} { |
| 237 | 237 | SELECT F.name, R.rev |
| 238 | 238 | FROM revision R, revision C, file F |
| 239 | - WHERE R.fid = F.fid | |
| 240 | - AND R.child IS NOT NULL | |
| 241 | - AND R.child = C.rid | |
| 242 | - AND C.lod != R.lod | |
| 239 | + WHERE R.fid = F.fid -- get file of revision | |
| 240 | + AND R.child IS NOT NULL -- revision has a primary child | |
| 241 | + AND R.child = C.rid -- get that child | |
| 242 | + AND C.lod != R.lod -- child wrongly disagrees with lod | |
| 243 | 243 | ; |
| 244 | 244 | } |
| 245 | 245 | # Find all revisions with a non-NTDB child which agrees about |
| 246 | 246 | # the line of development they belong to. |
| 247 | 247 | CheckRev \ |
| 248 | 248 | {NTDB and trunk revisions have to be in different LODs} \ |
| 249 | 249 | {on NTDB and its non-NTDB child wrongly agree about their LOD} { |
| 250 | 250 | SELECT F.name, R.rev |
| 251 | 251 | FROM revision R, revision C, file F |
| 252 | - WHERE R.fid = F.fid | |
| 253 | - AND R.dbchild IS NOT NULL | |
| 254 | - AND R.dbchild = C.rid | |
| 255 | - AND C.lod = R.lod | |
| 252 | + WHERE R.fid = F.fid -- get file of revision | |
| 253 | + AND R.dbchild IS NOT NULL -- limit to last NTDB revision | |
| 254 | + AND R.dbchild = C.rid -- get non-NTDB child | |
| 255 | + AND C.lod = R.lod -- child wrongly has same lod | |
| 256 | 256 | ; |
| 257 | 257 | } |
| 258 | 258 | # Find all revisions with a branch parent symbol which is not |
| 259 | 259 | # their LOD. |
| 260 | 260 | CheckRev \ |
| 261 | 261 | {Branch starting revisions have to have their LOD as branch parent symbol} \ |
| 262 | 262 | {at the beginning of its branch does not have the branch symbol as its LOD} { |
| 263 | 263 | SELECT F.name, R.rev |
| 264 | 264 | FROM revision R, file F |
| 265 | - WHERE R.fid = F.fid | |
| 266 | - AND R.bparent IS NOT NULL | |
| 267 | - AND R.lod != R.bparent | |
| 265 | + WHERE R.fid = F.fid -- get file of revision | |
| 266 | + AND R.bparent IS NOT NULL -- limit to branch-first revisions | |
| 267 | + AND R.lod != R.bparent -- out-of-branch parent wrongly is not the lod | |
| 268 | 268 | ; |
| 269 | 269 | } |
| 270 | 270 | # Find all revisions with a branch parent symbol whose parent |
| 271 | 271 | # is in the same line of development. |
| 272 | 272 | CheckRev \ |
| 273 | 273 | {Revisions and their branch children have to be in different LODs} \ |
| 274 | 274 | {at the beginning of its branch and its parent wrongly agree about their LOD} { |
| 275 | 275 | SELECT F.name, R.rev |
| 276 | 276 | FROM revision R, revision P, file F |
| 277 | - WHERE R.fid = F.fid | |
| 278 | - AND R.bparent IS NOT NULL | |
| 279 | - AND R.parent = P.rid | |
| 280 | - AND R.lod = P.lod | |
| 277 | + WHERE R.fid = F.fid -- get file of revision | |
| 278 | + AND R.bparent IS NOT NULL -- limit to branch-first revisions | |
| 279 | + AND R.parent = P.rid -- get out-of-branch parent of revision | |
| 280 | + AND R.lod = P.lod -- rev and parent wrongly agree on lod | |
| 281 | 281 | ; |
| 282 | 282 | } |
| 283 | 283 | return |
| 284 | 284 | } |
| 285 | 285 | |
| @@ -295,13 +295,13 @@ | ||
| 295 | 295 | CheckRev \ |
| 296 | 296 | {Revisions and their meta data have to be in the same LOD} \ |
| 297 | 297 | {disagrees with its meta data about owning LOD} { |
| 298 | 298 | SELECT F.name, R.rev |
| 299 | 299 | FROM revision R, meta M, file F |
| 300 | - WHERE R.mid = M.mid | |
| 301 | - AND R.lod != M.bid | |
| 302 | - AND R.fid = F.fid | |
| 300 | + WHERE R.mid = M.mid -- get meta data of revision | |
| 301 | + AND R.lod != M.bid -- rev wrongly disagrees with meta about lod | |
| 302 | + AND R.fid = F.fid -- get file of revision | |
| 303 | 303 | ; |
| 304 | 304 | } |
| 305 | 305 | return |
| 306 | 306 | } |
| 307 | 307 | |
| @@ -348,18 +348,20 @@ | ||
| 348 | 348 | -- select those with more than one user, and get their |
| 349 | 349 | -- associated file (name) for display. |
| 350 | 350 | |
| 351 | 351 | SELECT F.name, R.rev |
| 352 | 352 | FROM revision R, file F, |
| 353 | - (SELECT CI.iid AS rid, count(CI.cid) AS count | |
| 353 | + (SELECT CI.iid AS rid, -- revision item | |
| 354 | + count(CI.cid) AS count -- number of csets using item | |
| 354 | 355 | FROM csitem CI, changeset C |
| 355 | - WHERE C.type = 0 | |
| 356 | - AND C.cid = CI.cid | |
| 357 | - GROUP BY CI.iid) AS U | |
| 358 | - WHERE U.count > 1 | |
| 359 | - AND R.rid = U.rid | |
| 360 | - AND R.fid = F.fid | |
| 356 | + WHERE C.type = 0 -- limit to revision csets | |
| 357 | + AND C.cid = CI.cid -- get item in changeset | |
| 358 | + GROUP BY CI.iid -- aggregate by item, count csets/item | |
| 359 | + ) AS U | |
| 360 | + WHERE U.count > 1 -- limit to item with multiple users | |
| 361 | + AND R.rid = U.rid -- get revision of item | |
| 362 | + AND R.fid = F.fid -- get file of revision | |
| 361 | 363 | } |
| 362 | 364 | # All revisions have to refer to the same meta information as |
| 363 | 365 | # their changeset. |
| 364 | 366 | CheckRevCS \ |
| 365 | 367 | {All revisions have to agree with their changeset about the used meta information} \ |
| @@ -386,16 +388,21 @@ | ||
| 386 | 388 | {All revisions in a changeset have to belong to the same LOD} \ |
| 387 | 389 | {: Its revisions disagree about the LOD they belong to} { |
| 388 | 390 | SELECT T.name, C.cid |
| 389 | 391 | FROM changeset C, cstype T |
| 390 | 392 | WHERE C.cid IN (SELECT U.cid |
| 391 | - FROM (SELECT DISTINCT CI.cid AS cid, R.lod AS lod | |
| 393 | + FROM (SELECT DISTINCT -- unique cset/lod pairs | |
| 394 | + CI.cid AS cid, -- revision cset | |
| 395 | + R.lod AS lod -- lod of item in cset | |
| 392 | 396 | FROM csitem CI, changeset C, revision R |
| 393 | - WHERE CI.iid = R.rid | |
| 394 | - AND C.cid = CI.cid | |
| 395 | - AND C.type = 0) AS U | |
| 396 | - GROUP BY U.cid HAVING COUNT(U.lod) > 1) | |
| 397 | + WHERE CI.iid = R.rid -- get rev of item in cset | |
| 398 | + AND C.cid = CI.cid -- get changeset of item | |
| 399 | + AND C.type = 0 -- limit to rev csets | |
| 400 | + ) AS U | |
| 401 | + GROUP BY U.cid -- aggregate by cset, count lods/cset | |
| 402 | + HAVING COUNT(U.lod) > 1 -- find csets with multiple lods | |
| 403 | + ) | |
| 397 | 404 | AND T.tid = C.type |
| 398 | 405 | } |
| 399 | 406 | # All revisions have to agree on the project their changeset |
| 400 | 407 | # belongs to. In other words, all revisions in a changeset |
| 401 | 408 | # have to refer to the same project. |
| @@ -409,18 +416,23 @@ | ||
| 409 | 416 | {All revisions in a changeset have to belong to the same project} \ |
| 410 | 417 | {: Its revisions disagree about the project they belong to} { |
| 411 | 418 | SELECT T.name, C.cid |
| 412 | 419 | FROM changeset C, cstype T |
| 413 | 420 | WHERE C.cid IN (SELECT U.cid |
| 414 | - FROM (SELECT DISTINCT CI.cid AS cid, F.pid AS pid | |
| 421 | + FROM (SELECT DISTINCT -- unique cset/proj pairs | |
| 422 | + CI.cid AS cid, -- rev cset | |
| 423 | + F.pid AS pid -- project of item in cset | |
| 415 | 424 | FROM csitem CI, changeset C, revision R, file F |
| 416 | - WHERE CI.iid = R.rid | |
| 417 | - AND C.cid = CI.cid | |
| 418 | - AND C.type = 0 | |
| 419 | - AND F.fid = R.fid) AS U | |
| 420 | - GROUP BY U.cid HAVING COUNT(U.pid) > 1) | |
| 421 | - AND T.tid = C.type | |
| 425 | + WHERE CI.iid = R.rid -- get rev of item in cset | |
| 426 | + AND C.cid = CI.cid -- get changeset of item | |
| 427 | + AND C.type = 0 -- limit to rev changesets | |
| 428 | + AND F.fid = R.fid -- get file of revision | |
| 429 | + ) AS U | |
| 430 | + GROUP BY U.cid -- aggregate by csets, count proj/cset | |
| 431 | + HAVING COUNT(U.pid) > 1 -- find csets with multiple projects | |
| 432 | + ) | |
| 433 | + AND T.tid = C.type -- get readable changeset type | |
| 422 | 434 | } |
| 423 | 435 | # All revisions in a single changeset have to belong to |
| 424 | 436 | # different files. Conversely: No two revisions of a single |
| 425 | 437 | # file are allowed to be in the same changeset. |
| 426 | 438 | # |
| @@ -434,26 +446,34 @@ | ||
| 434 | 446 | {All revisions in a changeset have to belong to different files} \ |
| 435 | 447 | {: Its revisions share files} { |
| 436 | 448 | SELECT T.name, C.cid |
| 437 | 449 | FROM changeset C, cstype T |
| 438 | 450 | WHERE C.cid IN (SELECT VV.cid |
| 439 | - FROM (SELECT U.cid as cid, COUNT (U.fid) AS fcount | |
| 440 | - FROM (SELECT DISTINCT CI.cid AS cid, R.fid AS fid | |
| 451 | + FROM (SELECT U.cid AS cid, -- rev changeset | |
| 452 | + COUNT (U.fid) AS fcount -- number of files by items | |
| 453 | + FROM (SELECT DISTINCT -- unique cset/file pairs | |
| 454 | + CI.cid AS cid, -- rev changeset | |
| 455 | + R.fid AS fid -- file of item in changeset | |
| 441 | 456 | FROM csitem CI, changeset C, revision R |
| 442 | - WHERE CI.iid = R.rid | |
| 443 | - AND C.cid = CI.cid | |
| 444 | - AND C.type = 0 | |
| 457 | + WHERE CI.iid = R.rid -- get rev of item in changeset | |
| 458 | + AND C.cid = CI.cid -- get changeset of item | |
| 459 | + AND C.type = 0 -- limit to rev csets | |
| 445 | 460 | ) AS U |
| 446 | - GROUP BY U.cid) AS UU, | |
| 447 | - (SELECT V.cid AS cid, COUNT (V.iid) AS rcount | |
| 461 | + GROUP BY U.cid -- aggregate by csets, count files/cset | |
| 462 | + ) AS UU, | |
| 463 | + (SELECT V.cid AS cid, -- rev changeset | |
| 464 | + COUNT (V.iid) AS rcount -- number of items | |
| 448 | 465 | FROM csitem V, changeset X |
| 449 | - WHERE X.cid = V.cid | |
| 450 | - AND X.type = 0 | |
| 451 | - GROUP BY V.cid) AS VV | |
| 452 | - WHERE VV.cid = UU.cid | |
| 453 | - AND UU.fcount < VV.rcount) | |
| 454 | - AND T.tid = C.type | |
| 466 | + WHERE X.cid = V.cid -- get changeset of item | |
| 467 | + AND X.type = 0 -- limit to rev csets | |
| 468 | + GROUP BY V.cid -- aggregate by csets, count items/cset | |
| 469 | + ) AS VV | |
| 470 | + WHERE VV.cid = UU.cid -- sync #items/cset with #files/cset | |
| 471 | + AND UU.fcount < VV.rcount -- less files than items | |
| 472 | + -- => items belong to the same file. | |
| 473 | + ) | |
| 474 | + AND T.tid = C.type -- get readable changeset type | |
| 455 | 475 | } |
| 456 | 476 | return |
| 457 | 477 | } |
| 458 | 478 | |
| 459 | 479 | proc TagChangesets {} { |
| @@ -498,19 +518,21 @@ | ||
| 498 | 518 | -- user, and get their associated file (name) for |
| 499 | 519 | -- display. |
| 500 | 520 | |
| 501 | 521 | SELECT P.name, S.name |
| 502 | 522 | FROM tag T, project P, symbol S, |
| 503 | - (SELECT CI.iid AS iid, count(CI.cid) AS count | |
| 523 | + (SELECT CI.iid AS iid, -- item | |
| 524 | + count(CI.cid) AS count -- number of csets using item | |
| 504 | 525 | FROM csitem CI, changeset C |
| 505 | - WHERE C.type = 1 | |
| 506 | - AND C.cid = CI.cid | |
| 507 | - GROUP BY CI.iid) AS U | |
| 508 | - WHERE U.count > 1 | |
| 509 | - AND T.tid = U.iid | |
| 510 | - AND S.sid = T.sid -- get symbol of tag | |
| 511 | - AND P.pid = S.pid -- get project of symbol | |
| 526 | + WHERE C.type = 1 -- limit to tag csets | |
| 527 | + AND C.cid = CI.cid -- get items of cset | |
| 528 | + GROUP BY CI.iid -- aggregate by item, count csets/item | |
| 529 | + ) AS U | |
| 530 | + WHERE U.count > 1 -- find tag item used multiple times | |
| 531 | + AND T.tid = U.iid -- get tag of item | |
| 532 | + AND S.sid = T.sid -- get symbol of tag | |
| 533 | + AND P.pid = S.pid -- get project of symbol | |
| 512 | 534 | } |
| 513 | 535 | if 0 { |
| 514 | 536 | # This check is disabled for the moment. Apparently tags |
| 515 | 537 | # can cross lines of development, at least if the involved |
| 516 | 538 | # LODs are the trunk, and the NTDB. That makes sense, as |
| @@ -556,18 +578,23 @@ | ||
| 556 | 578 | {All tags in a changeset have to belong to the same project} \ |
| 557 | 579 | {: Its tags disagree about the project they belong to} { |
| 558 | 580 | SELECT T.name, C.cid |
| 559 | 581 | FROM changeset C, cstype T |
| 560 | 582 | WHERE C.cid IN (SELECT U.cid |
| 561 | - FROM (SELECT DISTINCT CI.cid AS cid, F.pid AS pid | |
| 583 | + FROM (SELECT DISTINCT -- unique cset/proj pairs | |
| 584 | + CI.cid AS cid, -- tag cset | |
| 585 | + F.pid AS pid -- project of item in cset | |
| 562 | 586 | FROM csitem CI, changeset C, tag T, file F |
| 563 | - WHERE CI.iid = T.tid | |
| 564 | - AND C.cid = CI.cid | |
| 565 | - AND C.type = 1 | |
| 566 | - AND F.fid = T.fid) AS U | |
| 567 | - GROUP BY U.cid HAVING COUNT(U.pid) > 1) | |
| 568 | - AND T.tid = C.type | |
| 587 | + WHERE CI.iid = T.tid -- get tag of item in cset | |
| 588 | + AND C.cid = CI.cid -- get changeset of item | |
| 589 | + AND C.type = 1 -- limit to tag changesets | |
| 590 | + AND F.fid = T.fid -- get file of tag | |
| 591 | + ) AS U | |
| 592 | + GROUP BY U.cid -- aggregate by csets, count proj/cset | |
| 593 | + HAVING COUNT(U.pid) > 1 -- find csets with multiple projects | |
| 594 | + ) | |
| 595 | + AND T.tid = C.type -- get readable changeset type | |
| 569 | 596 | } |
| 570 | 597 | # All tags in a single changeset have to belong to different |
| 571 | 598 | # files. Conversely: No two tags of a single file are allowed |
| 572 | 599 | # to be in the same changeset. |
| 573 | 600 | # |
| @@ -580,26 +607,34 @@ | ||
| 580 | 607 | {All tags in a changeset have to belong to different files} \ |
| 581 | 608 | {: Its tags share files} { |
| 582 | 609 | SELECT T.name, C.cid |
| 583 | 610 | FROM changeset C, cstype T |
| 584 | 611 | WHERE C.cid IN (SELECT VV.cid |
| 585 | - FROM (SELECT U.cid as cid, COUNT (U.fid) AS fcount | |
| 586 | - FROM (SELECT DISTINCT CI.cid AS cid, T.fid AS fid | |
| 612 | + FROM (SELECT U.cid AS cid, -- changeset | |
| 613 | + COUNT (U.fid) AS fcount -- number of files by items | |
| 614 | + FROM (SELECT DISTINCT -- unique cset/file pairs | |
| 615 | + CI.cid AS cid, -- tag changeset | |
| 616 | + T.fid AS fid -- file of item in changeset | |
| 587 | 617 | FROM csitem CI, changeset C, tag T |
| 588 | - WHERE CI.iid = T.tid | |
| 589 | - AND C.cid = CI.cid | |
| 590 | - AND C.type = 1 | |
| 618 | + WHERE CI.iid = T.tid -- get tag of item in changeset | |
| 619 | + AND C.cid = CI.cid -- get changeset of item | |
| 620 | + AND C.type = 1 -- limit to tag changesets | |
| 591 | 621 | ) AS U |
| 592 | - GROUP BY U.cid) AS UU, | |
| 593 | - (SELECT V.cid AS cid, COUNT (V.iid) AS rcount | |
| 622 | + GROUP BY U.cid -- aggregate by csets, count files/cset | |
| 623 | + ) AS UU, | |
| 624 | + (SELECT V.cid AS cid, -- changeset | |
| 625 | + COUNT (V.iid) AS rcount -- number of items in cset | |
| 594 | 626 | FROM csitem V, changeset X |
| 595 | - WHERE X.cid = V.cid | |
| 596 | - AND X.type = 1 | |
| 597 | - GROUP BY V.cid) AS VV | |
| 598 | - WHERE VV.cid = UU.cid | |
| 599 | - AND UU.fcount < VV.rcount) | |
| 600 | - AND T.tid = C.type | |
| 627 | + WHERE X.cid = V.cid -- get changeset of item | |
| 628 | + AND X.type = 1 -- limit to tag changesets | |
| 629 | + GROUP BY V.cid -- aggregate by csets, count items/cset | |
| 630 | + ) AS VV | |
| 631 | + WHERE VV.cid = UU.cid -- sync #items/cset with #files/cset | |
| 632 | + AND UU.fcount < VV.rcount -- less files than items | |
| 633 | + -- => items belong to the same file. | |
| 634 | + ) | |
| 635 | + AND T.tid = C.type -- get readable changeset type | |
| 601 | 636 | } |
| 602 | 637 | return |
| 603 | 638 | } |
| 604 | 639 | |
| 605 | 640 | proc BranchChangesets {} { |
| @@ -628,11 +663,12 @@ | ||
| 628 | 663 | FROM branch |
| 629 | 664 | EXCEPT -- subtract |
| 630 | 665 | SELECT CI.iid -- branches used |
| 631 | 666 | FROM csitem CI, changeset C |
| 632 | 667 | WHERE C.cid = CI.cid -- by any branch |
| 633 | - AND C.type = 2) -- changeset | |
| 668 | + AND C.type = 2 -- changeset | |
| 669 | + ) | |
| 634 | 670 | AND S.sid = B.sid -- get symbol of branch |
| 635 | 671 | AND P.pid = S.pid -- get project of symbol |
| 636 | 672 | } |
| 637 | 673 | # Find all branches which are used by more than one changeset. |
| 638 | 674 | CheckRev \ |
| @@ -645,19 +681,21 @@ | ||
| 645 | 681 | -- than one user, and get their associated file (name) |
| 646 | 682 | -- for display. |
| 647 | 683 | |
| 648 | 684 | SELECT P.name, S.name |
| 649 | 685 | FROM branch B, project P, symbol S, |
| 650 | - (SELECT CI.iid AS iid, count(CI.cid) AS count | |
| 686 | + (SELECT CI.iid AS iid, -- item | |
| 687 | + count(CI.cid) AS count -- number of csets for item | |
| 651 | 688 | FROM csitem CI, changeset C |
| 652 | - WHERE C.type = 2 | |
| 653 | - AND C.cid = CI.cid | |
| 654 | - GROUP BY CI.iid ) AS U | |
| 655 | - WHERE U.count > 1 | |
| 656 | - AND B.bid = U.iid | |
| 657 | - AND S.sid = B.sid -- get symbol of branch | |
| 658 | - AND P.pid = S.pid -- get project of symbol | |
| 689 | + WHERE C.type = 2 -- limit to branch changesets, | |
| 690 | + AND C.cid = CI.cid -- get the items they contain, | |
| 691 | + GROUP BY CI.iid -- aggregate by items, count csets/item (x) | |
| 692 | + ) AS U | |
| 693 | + WHERE U.count > 1 -- find items used multiple times | |
| 694 | + AND B.bid = U.iid -- get the users (branch changesets) | |
| 695 | + AND S.sid = B.sid -- get symbol of branch | |
| 696 | + AND P.pid = S.pid -- get project of symbol | |
| 659 | 697 | } |
| 660 | 698 | if 0 { |
| 661 | 699 | # This check has been disabled. When the converter was run |
| 662 | 700 | # on the Tcl CVS several branches tripped this |
| 663 | 701 | # constraint. One of them was a free-floating branch, and |
| @@ -719,18 +757,23 @@ | ||
| 719 | 757 | {All branches in a changeset have to belong to the same project} \ |
| 720 | 758 | {: Its branches disagree about the project they belong to} { |
| 721 | 759 | SELECT T.name, C.cid |
| 722 | 760 | FROM changeset C, cstype T |
| 723 | 761 | WHERE C.cid IN (SELECT U.cid |
| 724 | - FROM (SELECT DISTINCT CI.cid AS cid, F.pid AS pid | |
| 762 | + FROM (SELECT DISTINCT -- Unique cset/proj pairs | |
| 763 | + CI.cid AS cid, -- Branch cset | |
| 764 | + F.pid AS pid -- Project of item in cset | |
| 725 | 765 | FROM csitem CI, changeset C, branch B, file F |
| 726 | - WHERE CI.iid = B.bid | |
| 727 | - AND C.cid = CI.cid | |
| 728 | - AND C.type = 2 | |
| 729 | - AND F.fid = B.fid) AS U | |
| 730 | - GROUP BY U.cid HAVING COUNT(U.pid) > 1) | |
| 731 | - AND T.tid = C.type | |
| 766 | + WHERE CI.iid = B.bid -- get branch of item in cset | |
| 767 | + AND C.cid = CI.cid -- get changeset of item | |
| 768 | + AND C.type = 2 -- limit to branch changesets | |
| 769 | + AND F.fid = B.fid -- get file of branch | |
| 770 | + ) AS U | |
| 771 | + GROUP BY U.cid -- aggregate by csets, count proj/cset | |
| 772 | + HAVING COUNT(U.pid) > 1 -- find cset with multiple projects | |
| 773 | + ) | |
| 774 | + AND T.tid = C.type -- get readable changeset type | |
| 732 | 775 | } |
| 733 | 776 | # All branches in a single changeset have to belong to |
| 734 | 777 | # different files. Conversely: No two branches of a single |
| 735 | 778 | # file are allowed to be in the same changeset. |
| 736 | 779 | # |
| @@ -744,26 +787,34 @@ | ||
| 744 | 787 | {All branches in a changeset have to belong to different files} \ |
| 745 | 788 | {: Its branches share files} { |
| 746 | 789 | SELECT T.name, C.cid |
| 747 | 790 | FROM changeset C, cstype T |
| 748 | 791 | WHERE C.cid IN (SELECT VV.cid |
| 749 | - FROM (SELECT U.cid as cid, COUNT (U.fid) AS fcount | |
| 750 | - FROM (SELECT DISTINCT CI.cid AS cid, B.fid AS fid | |
| 792 | + FROM (SELECT U.cid AS cid, -- changeset | |
| 793 | + COUNT (U.fid) AS fcount -- number of files by items | |
| 794 | + FROM (SELECT DISTINCT -- unique cset/file pairs | |
| 795 | + CI.cid AS cid, -- Branch changeset | |
| 796 | + B.fid AS fid -- File of item in changeset | |
| 751 | 797 | FROM csitem CI, changeset C, branch B |
| 752 | - WHERE CI.iid = B.bid | |
| 753 | - AND C.cid = CI.cid | |
| 754 | - AND C.type = 2 | |
| 798 | + WHERE CI.iid = B.bid -- get tag of item in changeset | |
| 799 | + AND C.cid = CI.cid -- get changeset of item | |
| 800 | + AND C.type = 2 -- limit to branch changesets | |
| 755 | 801 | ) AS U |
| 756 | - GROUP BY U.cid) AS UU, | |
| 757 | - (SELECT V.cid AS cid, COUNT (V.iid) AS rcount | |
| 802 | + GROUP BY U.cid -- aggregate by csets, count files/cset | |
| 803 | + ) AS UU, | |
| 804 | + (SELECT V.cid AS cid, -- changeset | |
| 805 | + COUNT (V.iid) AS rcount -- number of items in cset | |
| 758 | 806 | FROM csitem V, changeset X |
| 759 | - WHERE X.cid = V.cid | |
| 760 | - AND X.type = 2 | |
| 761 | - GROUP BY V.cid) AS VV | |
| 762 | - WHERE VV.cid = UU.cid | |
| 763 | - AND UU.fcount < VV.rcount) | |
| 764 | - AND T.tid = C.type | |
| 807 | + WHERE X.cid = V.cid -- get changeset of item | |
| 808 | + AND X.type = 2 -- limit to branch changesets | |
| 809 | + GROUP BY V.cid -- aggregate by csets, count items/cset | |
| 810 | + ) AS VV | |
| 811 | + WHERE VV.cid = UU.cid -- sync #items/cset with #files/cset | |
| 812 | + AND UU.fcount < VV.rcount -- less files than items | |
| 813 | + -- => items belong to the same file. | |
| 814 | + ) | |
| 815 | + AND T.tid = C.type -- get readable changeset type | |
| 765 | 816 | } |
| 766 | 817 | return |
| 767 | 818 | } |
| 768 | 819 | |
| 769 | 820 | proc ___UnusedChangesetChecks___ {} { |
| @@ -788,11 +839,11 @@ | ||
| 788 | 839 | {All revisions used by tag symbol changesets have to have the changeset's tag attached to them} \ |
| 789 | 840 | {does not have the tag of its symbol changeset @ attached to it} { |
| 790 | 841 | SELECT CT.name, C.cid, F.name, R.rev |
| 791 | 842 | FROM changeset C, cstype CT, revision R, file F, csitem CI, tag T |
| 792 | 843 | WHERE C.type = 1 -- symbol changesets only |
| 793 | - AND C.src = T.sid -- tag only, linked by symbol id | |
| 844 | + AND C.src = T.sid -- tag only, linked by symbol id | |
| 794 | 845 | AND C.cid = CI.cid -- changeset --> its revisions |
| 795 | 846 | AND R.rid = CI.iid -- look at the revisions |
| 796 | 847 | -- and look for the tag among the attached ones. |
| 797 | 848 | AND T.sid NOT IN (SELECT TB.sid |
| 798 | 849 | FROM tag TB |
| 799 | 850 |
| --- tools/cvs2fossil/lib/c2f_integrity.tcl | |
| +++ tools/cvs2fossil/lib/c2f_integrity.tcl | |
| @@ -78,38 +78,38 @@ | |
| 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 |
| 84 | AND R.lod = S.sid |
| 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 |
| 96 | AND R.mid = M.mid |
| 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 |
| 108 | AND R.child IS NOT NULL |
| 109 | AND R.child = C.rid |
| 110 | AND C.fid != R.fid |
| 111 | ; |
| 112 | } |
| 113 | |
| 114 | # Find all revisions with a branch parent symbol whose parent |
| 115 | # disagrees about the file they belong to. |
| @@ -116,170 +116,170 @@ | |
| 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 |
| 122 | AND R.bparent IS NOT NULL |
| 123 | AND R.parent = P.rid |
| 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 |
| 135 | AND R.dbchild IS NOT NULL |
| 136 | AND R.dbchild = C.rid |
| 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 |
| 148 | AND R.child IS NOT NULL |
| 149 | AND R.child = C.rid |
| 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 |
| 161 | AND R.child IS NOT NULL |
| 162 | AND R.child = C.rid |
| 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 |
| 174 | AND R.bparent IS NULL |
| 175 | AND R.parent IS NOT NULL |
| 176 | AND R.parent = P.rid |
| 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, if not detached} \ |
| 184 | {at the beginning of its branch has no parent, but its branch has} { |
| 185 | SELECT F.name, R.rev |
| 186 | FROM revision R, file F, branch B |
| 187 | WHERE R.fid = F.fid |
| 188 | AND R.bparent IS NOT NULL |
| 189 | AND R.parent IS NULL |
| 190 | AND B.sid = R.bparent |
| 191 | AND B.fid = R.fid |
| 192 | AND B.root IS NOT NULL |
| 193 | ; |
| 194 | } |
| 195 | # Find all revisions with a branch parent symbol whose parent |
| 196 | # has them as primary child. |
| 197 | CheckRev \ |
| 198 | {Branch starting revisions must not be primary children of their parents} \ |
| 199 | {at the beginning of its branch is the primary child of its parent} { |
| 200 | SELECT F.name, R.rev |
| 201 | FROM revision R, revision P, file F |
| 202 | WHERE R.fid = F.fid |
| 203 | AND R.bparent IS NOT NULL |
| 204 | AND R.parent IS NOT NULL |
| 205 | AND R.parent = P.rid |
| 206 | AND P.child = R.rid |
| 207 | ; |
| 208 | } |
| 209 | # Find all revisions with a non-NTDB child which are not on |
| 210 | # the NTDB. |
| 211 | CheckRev \ |
| 212 | {NTDB to trunk transition has to begin on NTDB} \ |
| 213 | {has a non-NTDB child, yet is not on the NTDB} { |
| 214 | SELECT F.name, R.rev |
| 215 | FROM revision R, file F |
| 216 | WHERE R.fid = F.fid |
| 217 | AND R.dbchild IS NOT NULL |
| 218 | AND NOT R.isdefault |
| 219 | ; |
| 220 | } |
| 221 | # Find all revisions with a NTDB parent which are on the NTDB. |
| 222 | CheckRev \ |
| 223 | {NTDB to trunk transition has to end on non-NTDB} \ |
| 224 | {has a NTDB parent, yet is on the NTDB} { |
| 225 | SELECT F.name, R.rev |
| 226 | FROM revision R, file F |
| 227 | WHERE R.fid = F.fid |
| 228 | AND R.dbparent IS NOT NULL |
| 229 | AND R.isdefault |
| 230 | ; |
| 231 | } |
| 232 | # Find all revisions with a child which disagrees about the |
| 233 | # line of development they belong to. |
| 234 | CheckRev \ |
| 235 | {Revisions and their primary children have to be in the same LOD} \ |
| 236 | {and its primary child disagree about their LOD} { |
| 237 | SELECT F.name, R.rev |
| 238 | FROM revision R, revision C, file F |
| 239 | WHERE R.fid = F.fid |
| 240 | AND R.child IS NOT NULL |
| 241 | AND R.child = C.rid |
| 242 | AND C.lod != R.lod |
| 243 | ; |
| 244 | } |
| 245 | # Find all revisions with a non-NTDB child which agrees about |
| 246 | # the line of development they belong to. |
| 247 | CheckRev \ |
| 248 | {NTDB and trunk revisions have to be in different LODs} \ |
| 249 | {on NTDB and its non-NTDB child wrongly agree about their LOD} { |
| 250 | SELECT F.name, R.rev |
| 251 | FROM revision R, revision C, file F |
| 252 | WHERE R.fid = F.fid |
| 253 | AND R.dbchild IS NOT NULL |
| 254 | AND R.dbchild = C.rid |
| 255 | AND C.lod = R.lod |
| 256 | ; |
| 257 | } |
| 258 | # Find all revisions with a branch parent symbol which is not |
| 259 | # their LOD. |
| 260 | CheckRev \ |
| 261 | {Branch starting revisions have to have their LOD as branch parent symbol} \ |
| 262 | {at the beginning of its branch does not have the branch symbol as its LOD} { |
| 263 | SELECT F.name, R.rev |
| 264 | FROM revision R, file F |
| 265 | WHERE R.fid = F.fid |
| 266 | AND R.bparent IS NOT NULL |
| 267 | AND R.lod != R.bparent |
| 268 | ; |
| 269 | } |
| 270 | # Find all revisions with a branch parent symbol whose parent |
| 271 | # is in the same line of development. |
| 272 | CheckRev \ |
| 273 | {Revisions and their branch children have to be in different LODs} \ |
| 274 | {at the beginning of its branch and its parent wrongly agree about their LOD} { |
| 275 | SELECT F.name, R.rev |
| 276 | FROM revision R, revision P, file F |
| 277 | WHERE R.fid = F.fid |
| 278 | AND R.bparent IS NOT NULL |
| 279 | AND R.parent = P.rid |
| 280 | AND R.lod = P.lod |
| 281 | ; |
| 282 | } |
| 283 | return |
| 284 | } |
| 285 | |
| @@ -295,13 +295,13 @@ | |
| 295 | CheckRev \ |
| 296 | {Revisions and their meta data have to be in the same LOD} \ |
| 297 | {disagrees with its meta data about owning LOD} { |
| 298 | SELECT F.name, R.rev |
| 299 | FROM revision R, meta M, file F |
| 300 | WHERE R.mid = M.mid |
| 301 | AND R.lod != M.bid |
| 302 | AND R.fid = F.fid |
| 303 | ; |
| 304 | } |
| 305 | return |
| 306 | } |
| 307 | |
| @@ -348,18 +348,20 @@ | |
| 348 | -- select those with more than one user, and get their |
| 349 | -- associated file (name) for display. |
| 350 | |
| 351 | SELECT F.name, R.rev |
| 352 | FROM revision R, file F, |
| 353 | (SELECT CI.iid AS rid, count(CI.cid) AS count |
| 354 | FROM csitem CI, changeset C |
| 355 | WHERE C.type = 0 |
| 356 | AND C.cid = CI.cid |
| 357 | GROUP BY CI.iid) AS U |
| 358 | WHERE U.count > 1 |
| 359 | AND R.rid = U.rid |
| 360 | AND R.fid = F.fid |
| 361 | } |
| 362 | # All revisions have to refer to the same meta information as |
| 363 | # their changeset. |
| 364 | CheckRevCS \ |
| 365 | {All revisions have to agree with their changeset about the used meta information} \ |
| @@ -386,16 +388,21 @@ | |
| 386 | {All revisions in a changeset have to belong to the same LOD} \ |
| 387 | {: Its revisions disagree about the LOD they belong to} { |
| 388 | SELECT T.name, C.cid |
| 389 | FROM changeset C, cstype T |
| 390 | WHERE C.cid IN (SELECT U.cid |
| 391 | FROM (SELECT DISTINCT CI.cid AS cid, R.lod AS lod |
| 392 | FROM csitem CI, changeset C, revision R |
| 393 | WHERE CI.iid = R.rid |
| 394 | AND C.cid = CI.cid |
| 395 | AND C.type = 0) AS U |
| 396 | GROUP BY U.cid HAVING COUNT(U.lod) > 1) |
| 397 | AND T.tid = C.type |
| 398 | } |
| 399 | # All revisions have to agree on the project their changeset |
| 400 | # belongs to. In other words, all revisions in a changeset |
| 401 | # have to refer to the same project. |
| @@ -409,18 +416,23 @@ | |
| 409 | {All revisions in a changeset have to belong to the same project} \ |
| 410 | {: Its revisions disagree about the project they belong to} { |
| 411 | SELECT T.name, C.cid |
| 412 | FROM changeset C, cstype T |
| 413 | WHERE C.cid IN (SELECT U.cid |
| 414 | FROM (SELECT DISTINCT CI.cid AS cid, F.pid AS pid |
| 415 | FROM csitem CI, changeset C, revision R, file F |
| 416 | WHERE CI.iid = R.rid |
| 417 | AND C.cid = CI.cid |
| 418 | AND C.type = 0 |
| 419 | AND F.fid = R.fid) AS U |
| 420 | GROUP BY U.cid HAVING COUNT(U.pid) > 1) |
| 421 | AND T.tid = C.type |
| 422 | } |
| 423 | # All revisions in a single changeset have to belong to |
| 424 | # different files. Conversely: No two revisions of a single |
| 425 | # file are allowed to be in the same changeset. |
| 426 | # |
| @@ -434,26 +446,34 @@ | |
| 434 | {All revisions in a changeset have to belong to different files} \ |
| 435 | {: Its revisions share files} { |
| 436 | SELECT T.name, C.cid |
| 437 | FROM changeset C, cstype T |
| 438 | WHERE C.cid IN (SELECT VV.cid |
| 439 | FROM (SELECT U.cid as cid, COUNT (U.fid) AS fcount |
| 440 | FROM (SELECT DISTINCT CI.cid AS cid, R.fid AS fid |
| 441 | FROM csitem CI, changeset C, revision R |
| 442 | WHERE CI.iid = R.rid |
| 443 | AND C.cid = CI.cid |
| 444 | AND C.type = 0 |
| 445 | ) AS U |
| 446 | GROUP BY U.cid) AS UU, |
| 447 | (SELECT V.cid AS cid, COUNT (V.iid) AS rcount |
| 448 | FROM csitem V, changeset X |
| 449 | WHERE X.cid = V.cid |
| 450 | AND X.type = 0 |
| 451 | GROUP BY V.cid) AS VV |
| 452 | WHERE VV.cid = UU.cid |
| 453 | AND UU.fcount < VV.rcount) |
| 454 | AND T.tid = C.type |
| 455 | } |
| 456 | return |
| 457 | } |
| 458 | |
| 459 | proc TagChangesets {} { |
| @@ -498,19 +518,21 @@ | |
| 498 | -- user, and get their associated file (name) for |
| 499 | -- display. |
| 500 | |
| 501 | SELECT P.name, S.name |
| 502 | FROM tag T, project P, symbol S, |
| 503 | (SELECT CI.iid AS iid, count(CI.cid) AS count |
| 504 | FROM csitem CI, changeset C |
| 505 | WHERE C.type = 1 |
| 506 | AND C.cid = CI.cid |
| 507 | GROUP BY CI.iid) AS U |
| 508 | WHERE U.count > 1 |
| 509 | AND T.tid = U.iid |
| 510 | AND S.sid = T.sid -- get symbol of tag |
| 511 | AND P.pid = S.pid -- get project of symbol |
| 512 | } |
| 513 | if 0 { |
| 514 | # This check is disabled for the moment. Apparently tags |
| 515 | # can cross lines of development, at least if the involved |
| 516 | # LODs are the trunk, and the NTDB. That makes sense, as |
| @@ -556,18 +578,23 @@ | |
| 556 | {All tags in a changeset have to belong to the same project} \ |
| 557 | {: Its tags disagree about the project they belong to} { |
| 558 | SELECT T.name, C.cid |
| 559 | FROM changeset C, cstype T |
| 560 | WHERE C.cid IN (SELECT U.cid |
| 561 | FROM (SELECT DISTINCT CI.cid AS cid, F.pid AS pid |
| 562 | FROM csitem CI, changeset C, tag T, file F |
| 563 | WHERE CI.iid = T.tid |
| 564 | AND C.cid = CI.cid |
| 565 | AND C.type = 1 |
| 566 | AND F.fid = T.fid) AS U |
| 567 | GROUP BY U.cid HAVING COUNT(U.pid) > 1) |
| 568 | AND T.tid = C.type |
| 569 | } |
| 570 | # All tags in a single changeset have to belong to different |
| 571 | # files. Conversely: No two tags of a single file are allowed |
| 572 | # to be in the same changeset. |
| 573 | # |
| @@ -580,26 +607,34 @@ | |
| 580 | {All tags in a changeset have to belong to different files} \ |
| 581 | {: Its tags share files} { |
| 582 | SELECT T.name, C.cid |
| 583 | FROM changeset C, cstype T |
| 584 | WHERE C.cid IN (SELECT VV.cid |
| 585 | FROM (SELECT U.cid as cid, COUNT (U.fid) AS fcount |
| 586 | FROM (SELECT DISTINCT CI.cid AS cid, T.fid AS fid |
| 587 | FROM csitem CI, changeset C, tag T |
| 588 | WHERE CI.iid = T.tid |
| 589 | AND C.cid = CI.cid |
| 590 | AND C.type = 1 |
| 591 | ) AS U |
| 592 | GROUP BY U.cid) AS UU, |
| 593 | (SELECT V.cid AS cid, COUNT (V.iid) AS rcount |
| 594 | FROM csitem V, changeset X |
| 595 | WHERE X.cid = V.cid |
| 596 | AND X.type = 1 |
| 597 | GROUP BY V.cid) AS VV |
| 598 | WHERE VV.cid = UU.cid |
| 599 | AND UU.fcount < VV.rcount) |
| 600 | AND T.tid = C.type |
| 601 | } |
| 602 | return |
| 603 | } |
| 604 | |
| 605 | proc BranchChangesets {} { |
| @@ -628,11 +663,12 @@ | |
| 628 | FROM branch |
| 629 | EXCEPT -- subtract |
| 630 | SELECT CI.iid -- branches used |
| 631 | FROM csitem CI, changeset C |
| 632 | WHERE C.cid = CI.cid -- by any branch |
| 633 | AND C.type = 2) -- changeset |
| 634 | AND S.sid = B.sid -- get symbol of branch |
| 635 | AND P.pid = S.pid -- get project of symbol |
| 636 | } |
| 637 | # Find all branches which are used by more than one changeset. |
| 638 | CheckRev \ |
| @@ -645,19 +681,21 @@ | |
| 645 | -- than one user, and get their associated file (name) |
| 646 | -- for display. |
| 647 | |
| 648 | SELECT P.name, S.name |
| 649 | FROM branch B, project P, symbol S, |
| 650 | (SELECT CI.iid AS iid, count(CI.cid) AS count |
| 651 | FROM csitem CI, changeset C |
| 652 | WHERE C.type = 2 |
| 653 | AND C.cid = CI.cid |
| 654 | GROUP BY CI.iid ) AS U |
| 655 | WHERE U.count > 1 |
| 656 | AND B.bid = U.iid |
| 657 | AND S.sid = B.sid -- get symbol of branch |
| 658 | AND P.pid = S.pid -- get project of symbol |
| 659 | } |
| 660 | if 0 { |
| 661 | # This check has been disabled. When the converter was run |
| 662 | # on the Tcl CVS several branches tripped this |
| 663 | # constraint. One of them was a free-floating branch, and |
| @@ -719,18 +757,23 @@ | |
| 719 | {All branches in a changeset have to belong to the same project} \ |
| 720 | {: Its branches disagree about the project they belong to} { |
| 721 | SELECT T.name, C.cid |
| 722 | FROM changeset C, cstype T |
| 723 | WHERE C.cid IN (SELECT U.cid |
| 724 | FROM (SELECT DISTINCT CI.cid AS cid, F.pid AS pid |
| 725 | FROM csitem CI, changeset C, branch B, file F |
| 726 | WHERE CI.iid = B.bid |
| 727 | AND C.cid = CI.cid |
| 728 | AND C.type = 2 |
| 729 | AND F.fid = B.fid) AS U |
| 730 | GROUP BY U.cid HAVING COUNT(U.pid) > 1) |
| 731 | AND T.tid = C.type |
| 732 | } |
| 733 | # All branches in a single changeset have to belong to |
| 734 | # different files. Conversely: No two branches of a single |
| 735 | # file are allowed to be in the same changeset. |
| 736 | # |
| @@ -744,26 +787,34 @@ | |
| 744 | {All branches in a changeset have to belong to different files} \ |
| 745 | {: Its branches share files} { |
| 746 | SELECT T.name, C.cid |
| 747 | FROM changeset C, cstype T |
| 748 | WHERE C.cid IN (SELECT VV.cid |
| 749 | FROM (SELECT U.cid as cid, COUNT (U.fid) AS fcount |
| 750 | FROM (SELECT DISTINCT CI.cid AS cid, B.fid AS fid |
| 751 | FROM csitem CI, changeset C, branch B |
| 752 | WHERE CI.iid = B.bid |
| 753 | AND C.cid = CI.cid |
| 754 | AND C.type = 2 |
| 755 | ) AS U |
| 756 | GROUP BY U.cid) AS UU, |
| 757 | (SELECT V.cid AS cid, COUNT (V.iid) AS rcount |
| 758 | FROM csitem V, changeset X |
| 759 | WHERE X.cid = V.cid |
| 760 | AND X.type = 2 |
| 761 | GROUP BY V.cid) AS VV |
| 762 | WHERE VV.cid = UU.cid |
| 763 | AND UU.fcount < VV.rcount) |
| 764 | AND T.tid = C.type |
| 765 | } |
| 766 | return |
| 767 | } |
| 768 | |
| 769 | proc ___UnusedChangesetChecks___ {} { |
| @@ -788,11 +839,11 @@ | |
| 788 | {All revisions used by tag symbol changesets have to have the changeset's tag attached to them} \ |
| 789 | {does not have the tag of its symbol changeset @ attached to it} { |
| 790 | SELECT CT.name, C.cid, F.name, R.rev |
| 791 | FROM changeset C, cstype CT, revision R, file F, csitem CI, tag T |
| 792 | WHERE C.type = 1 -- symbol changesets only |
| 793 | AND C.src = T.sid -- tag only, linked by symbol id |
| 794 | AND C.cid = CI.cid -- changeset --> its revisions |
| 795 | AND R.rid = CI.iid -- look at the revisions |
| 796 | -- and look for the tag among the attached ones. |
| 797 | AND T.sid NOT IN (SELECT TB.sid |
| 798 | FROM tag TB |
| 799 |
| --- tools/cvs2fossil/lib/c2f_integrity.tcl | |
| +++ tools/cvs2fossil/lib/c2f_integrity.tcl | |
| @@ -78,38 +78,38 @@ | |
| 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 -- get file of rev |
| 84 | AND R.lod = S.sid -- get symbol of its lod |
| 85 | AND F.pid != S.pid -- disagreement about the owning project |
| 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 -- get file of rev |
| 96 | AND R.mid = M.mid -- get meta of rev |
| 97 | AND F.pid != M.pid -- disagreement about owning project |
| 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 -- get file of rev |
| 108 | AND R.child IS NOT NULL -- get all with primary children |
| 109 | AND R.child = C.rid -- get primary child |
| 110 | AND C.fid != R.fid -- wrongly in different file |
| 111 | ; |
| 112 | } |
| 113 | |
| 114 | # Find all revisions with a branch parent symbol whose parent |
| 115 | # disagrees about the file they belong to. |
| @@ -116,170 +116,170 @@ | |
| 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 -- get file of rev |
| 122 | AND R.bparent IS NOT NULL -- get first-of-branch revisions |
| 123 | AND R.parent = P.rid -- get out-of-branch parent |
| 124 | AND R.fid != P.fid -- wrongly in different file |
| 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 -- get file of rev |
| 135 | AND R.dbchild IS NOT NULL -- get last NTDB revisions |
| 136 | AND R.dbchild = C.rid -- get their child |
| 137 | AND C.fid != R.fid -- wrongly in different file |
| 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 -- get file of rev |
| 148 | AND R.child IS NOT NULL -- get all with primary children |
| 149 | AND R.child = C.rid -- get primary child |
| 150 | AND C.parent != R.rid -- child's parent wrongly not us |
| 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 -- get file of rev |
| 161 | AND R.child IS NOT NULL -- get all with primary children |
| 162 | AND R.child = C.rid -- get primary child |
| 163 | AND C.bparent IS NOT NULL -- but indicates to be on branch |
| 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 -- get file of revision |
| 174 | AND R.bparent IS NULL -- exclude all first-on-branch revisions |
| 175 | AND R.parent IS NOT NULL -- which are not root of their line |
| 176 | AND R.parent = P.rid -- get in-lod parent |
| 177 | AND P.child != R.rid -- but does not have rev as primary child |
| 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, if not detached} \ |
| 184 | {at the beginning of its branch has no parent, but its branch has} { |
| 185 | SELECT F.name, R.rev |
| 186 | FROM revision R, file F, branch B |
| 187 | WHERE R.fid = F.fid -- get file of revision |
| 188 | AND R.bparent IS NOT NULL -- limit to first-on-branch revisions |
| 189 | AND R.parent IS NULL -- which are detached |
| 190 | AND B.sid = R.bparent -- get branch governing the rev |
| 191 | AND B.fid = R.fid -- in the revision's file |
| 192 | AND B.root IS NOT NULL -- but says that branch is attached |
| 193 | ; |
| 194 | } |
| 195 | # Find all revisions with a branch parent symbol whose parent |
| 196 | # has them as primary child. |
| 197 | CheckRev \ |
| 198 | {Branch starting revisions must not be primary children of their parents} \ |
| 199 | {at the beginning of its branch is the primary child of its parent} { |
| 200 | SELECT F.name, R.rev |
| 201 | FROM revision R, revision P, file F |
| 202 | WHERE R.fid = F.fid -- get file of revision |
| 203 | AND R.bparent IS NOT NULL -- limit to first-on-branch revisions |
| 204 | AND R.parent IS NOT NULL -- which are attached |
| 205 | AND R.parent = P.rid -- get out-of-branch parent |
| 206 | AND P.child = R.rid -- wrongly has rev as primary child |
| 207 | ; |
| 208 | } |
| 209 | # Find all revisions with a non-NTDB child which are not on |
| 210 | # the NTDB. |
| 211 | CheckRev \ |
| 212 | {NTDB to trunk transition has to begin on NTDB} \ |
| 213 | {has a non-NTDB child, yet is not on the NTDB} { |
| 214 | SELECT F.name, R.rev |
| 215 | FROM revision R, file F |
| 216 | WHERE R.fid = F.fid -- get file of revision |
| 217 | AND R.dbchild IS NOT NULL -- limit to last NTDB revision |
| 218 | AND NOT R.isdefault -- but signals not-NTDB |
| 219 | ; |
| 220 | } |
| 221 | # Find all revisions with a NTDB parent which are on the NTDB. |
| 222 | CheckRev \ |
| 223 | {NTDB to trunk transition has to end on non-NTDB} \ |
| 224 | {has a NTDB parent, yet is on the NTDB} { |
| 225 | SELECT F.name, R.rev |
| 226 | FROM revision R, file F |
| 227 | WHERE R.fid = F.fid -- get file of revision |
| 228 | AND R.dbparent IS NOT NULL -- limit to roots of non-NTDB |
| 229 | AND R.isdefault -- but signals to be NTDB |
| 230 | ; |
| 231 | } |
| 232 | # Find all revisions with a child which disagrees about the |
| 233 | # line of development they belong to. |
| 234 | CheckRev \ |
| 235 | {Revisions and their primary children have to be in the same LOD} \ |
| 236 | {and its primary child disagree about their LOD} { |
| 237 | SELECT F.name, R.rev |
| 238 | FROM revision R, revision C, file F |
| 239 | WHERE R.fid = F.fid -- get file of revision |
| 240 | AND R.child IS NOT NULL -- revision has a primary child |
| 241 | AND R.child = C.rid -- get that child |
| 242 | AND C.lod != R.lod -- child wrongly disagrees with lod |
| 243 | ; |
| 244 | } |
| 245 | # Find all revisions with a non-NTDB child which agrees about |
| 246 | # the line of development they belong to. |
| 247 | CheckRev \ |
| 248 | {NTDB and trunk revisions have to be in different LODs} \ |
| 249 | {on NTDB and its non-NTDB child wrongly agree about their LOD} { |
| 250 | SELECT F.name, R.rev |
| 251 | FROM revision R, revision C, file F |
| 252 | WHERE R.fid = F.fid -- get file of revision |
| 253 | AND R.dbchild IS NOT NULL -- limit to last NTDB revision |
| 254 | AND R.dbchild = C.rid -- get non-NTDB child |
| 255 | AND C.lod = R.lod -- child wrongly has same lod |
| 256 | ; |
| 257 | } |
| 258 | # Find all revisions with a branch parent symbol which is not |
| 259 | # their LOD. |
| 260 | CheckRev \ |
| 261 | {Branch starting revisions have to have their LOD as branch parent symbol} \ |
| 262 | {at the beginning of its branch does not have the branch symbol as its LOD} { |
| 263 | SELECT F.name, R.rev |
| 264 | FROM revision R, file F |
| 265 | WHERE R.fid = F.fid -- get file of revision |
| 266 | AND R.bparent IS NOT NULL -- limit to branch-first revisions |
| 267 | AND R.lod != R.bparent -- out-of-branch parent wrongly is not the lod |
| 268 | ; |
| 269 | } |
| 270 | # Find all revisions with a branch parent symbol whose parent |
| 271 | # is in the same line of development. |
| 272 | CheckRev \ |
| 273 | {Revisions and their branch children have to be in different LODs} \ |
| 274 | {at the beginning of its branch and its parent wrongly agree about their LOD} { |
| 275 | SELECT F.name, R.rev |
| 276 | FROM revision R, revision P, file F |
| 277 | WHERE R.fid = F.fid -- get file of revision |
| 278 | AND R.bparent IS NOT NULL -- limit to branch-first revisions |
| 279 | AND R.parent = P.rid -- get out-of-branch parent of revision |
| 280 | AND R.lod = P.lod -- rev and parent wrongly agree on lod |
| 281 | ; |
| 282 | } |
| 283 | return |
| 284 | } |
| 285 | |
| @@ -295,13 +295,13 @@ | |
| 295 | CheckRev \ |
| 296 | {Revisions and their meta data have to be in the same LOD} \ |
| 297 | {disagrees with its meta data about owning LOD} { |
| 298 | SELECT F.name, R.rev |
| 299 | FROM revision R, meta M, file F |
| 300 | WHERE R.mid = M.mid -- get meta data of revision |
| 301 | AND R.lod != M.bid -- rev wrongly disagrees with meta about lod |
| 302 | AND R.fid = F.fid -- get file of revision |
| 303 | ; |
| 304 | } |
| 305 | return |
| 306 | } |
| 307 | |
| @@ -348,18 +348,20 @@ | |
| 348 | -- select those with more than one user, and get their |
| 349 | -- associated file (name) for display. |
| 350 | |
| 351 | SELECT F.name, R.rev |
| 352 | FROM revision R, file F, |
| 353 | (SELECT CI.iid AS rid, -- revision item |
| 354 | count(CI.cid) AS count -- number of csets using item |
| 355 | FROM csitem CI, changeset C |
| 356 | WHERE C.type = 0 -- limit to revision csets |
| 357 | AND C.cid = CI.cid -- get item in changeset |
| 358 | GROUP BY CI.iid -- aggregate by item, count csets/item |
| 359 | ) AS U |
| 360 | WHERE U.count > 1 -- limit to item with multiple users |
| 361 | AND R.rid = U.rid -- get revision of item |
| 362 | AND R.fid = F.fid -- get file of revision |
| 363 | } |
| 364 | # All revisions have to refer to the same meta information as |
| 365 | # their changeset. |
| 366 | CheckRevCS \ |
| 367 | {All revisions have to agree with their changeset about the used meta information} \ |
| @@ -386,16 +388,21 @@ | |
| 388 | {All revisions in a changeset have to belong to the same LOD} \ |
| 389 | {: Its revisions disagree about the LOD they belong to} { |
| 390 | SELECT T.name, C.cid |
| 391 | FROM changeset C, cstype T |
| 392 | WHERE C.cid IN (SELECT U.cid |
| 393 | FROM (SELECT DISTINCT -- unique cset/lod pairs |
| 394 | CI.cid AS cid, -- revision cset |
| 395 | R.lod AS lod -- lod of item in cset |
| 396 | FROM csitem CI, changeset C, revision R |
| 397 | WHERE CI.iid = R.rid -- get rev of item in cset |
| 398 | AND C.cid = CI.cid -- get changeset of item |
| 399 | AND C.type = 0 -- limit to rev csets |
| 400 | ) AS U |
| 401 | GROUP BY U.cid -- aggregate by cset, count lods/cset |
| 402 | HAVING COUNT(U.lod) > 1 -- find csets with multiple lods |
| 403 | ) |
| 404 | AND T.tid = C.type |
| 405 | } |
| 406 | # All revisions have to agree on the project their changeset |
| 407 | # belongs to. In other words, all revisions in a changeset |
| 408 | # have to refer to the same project. |
| @@ -409,18 +416,23 @@ | |
| 416 | {All revisions in a changeset have to belong to the same project} \ |
| 417 | {: Its revisions disagree about the project they belong to} { |
| 418 | SELECT T.name, C.cid |
| 419 | FROM changeset C, cstype T |
| 420 | WHERE C.cid IN (SELECT U.cid |
| 421 | FROM (SELECT DISTINCT -- unique cset/proj pairs |
| 422 | CI.cid AS cid, -- rev cset |
| 423 | F.pid AS pid -- project of item in cset |
| 424 | FROM csitem CI, changeset C, revision R, file F |
| 425 | WHERE CI.iid = R.rid -- get rev of item in cset |
| 426 | AND C.cid = CI.cid -- get changeset of item |
| 427 | AND C.type = 0 -- limit to rev changesets |
| 428 | AND F.fid = R.fid -- get file of revision |
| 429 | ) AS U |
| 430 | GROUP BY U.cid -- aggregate by csets, count proj/cset |
| 431 | HAVING COUNT(U.pid) > 1 -- find csets with multiple projects |
| 432 | ) |
| 433 | AND T.tid = C.type -- get readable changeset type |
| 434 | } |
| 435 | # All revisions in a single changeset have to belong to |
| 436 | # different files. Conversely: No two revisions of a single |
| 437 | # file are allowed to be in the same changeset. |
| 438 | # |
| @@ -434,26 +446,34 @@ | |
| 446 | {All revisions in a changeset have to belong to different files} \ |
| 447 | {: Its revisions share files} { |
| 448 | SELECT T.name, C.cid |
| 449 | FROM changeset C, cstype T |
| 450 | WHERE C.cid IN (SELECT VV.cid |
| 451 | FROM (SELECT U.cid AS cid, -- rev changeset |
| 452 | COUNT (U.fid) AS fcount -- number of files by items |
| 453 | FROM (SELECT DISTINCT -- unique cset/file pairs |
| 454 | CI.cid AS cid, -- rev changeset |
| 455 | R.fid AS fid -- file of item in changeset |
| 456 | FROM csitem CI, changeset C, revision R |
| 457 | WHERE CI.iid = R.rid -- get rev of item in changeset |
| 458 | AND C.cid = CI.cid -- get changeset of item |
| 459 | AND C.type = 0 -- limit to rev csets |
| 460 | ) AS U |
| 461 | GROUP BY U.cid -- aggregate by csets, count files/cset |
| 462 | ) AS UU, |
| 463 | (SELECT V.cid AS cid, -- rev changeset |
| 464 | COUNT (V.iid) AS rcount -- number of items |
| 465 | FROM csitem V, changeset X |
| 466 | WHERE X.cid = V.cid -- get changeset of item |
| 467 | AND X.type = 0 -- limit to rev csets |
| 468 | GROUP BY V.cid -- aggregate by csets, count items/cset |
| 469 | ) AS VV |
| 470 | WHERE VV.cid = UU.cid -- sync #items/cset with #files/cset |
| 471 | AND UU.fcount < VV.rcount -- less files than items |
| 472 | -- => items belong to the same file. |
| 473 | ) |
| 474 | AND T.tid = C.type -- get readable changeset type |
| 475 | } |
| 476 | return |
| 477 | } |
| 478 | |
| 479 | proc TagChangesets {} { |
| @@ -498,19 +518,21 @@ | |
| 518 | -- user, and get their associated file (name) for |
| 519 | -- display. |
| 520 | |
| 521 | SELECT P.name, S.name |
| 522 | FROM tag T, project P, symbol S, |
| 523 | (SELECT CI.iid AS iid, -- item |
| 524 | count(CI.cid) AS count -- number of csets using item |
| 525 | FROM csitem CI, changeset C |
| 526 | WHERE C.type = 1 -- limit to tag csets |
| 527 | AND C.cid = CI.cid -- get items of cset |
| 528 | GROUP BY CI.iid -- aggregate by item, count csets/item |
| 529 | ) AS U |
| 530 | WHERE U.count > 1 -- find tag item used multiple times |
| 531 | AND T.tid = U.iid -- get tag of item |
| 532 | AND S.sid = T.sid -- get symbol of tag |
| 533 | AND P.pid = S.pid -- get project of symbol |
| 534 | } |
| 535 | if 0 { |
| 536 | # This check is disabled for the moment. Apparently tags |
| 537 | # can cross lines of development, at least if the involved |
| 538 | # LODs are the trunk, and the NTDB. That makes sense, as |
| @@ -556,18 +578,23 @@ | |
| 578 | {All tags in a changeset have to belong to the same project} \ |
| 579 | {: Its tags disagree about the project they belong to} { |
| 580 | SELECT T.name, C.cid |
| 581 | FROM changeset C, cstype T |
| 582 | WHERE C.cid IN (SELECT U.cid |
| 583 | FROM (SELECT DISTINCT -- unique cset/proj pairs |
| 584 | CI.cid AS cid, -- tag cset |
| 585 | F.pid AS pid -- project of item in cset |
| 586 | FROM csitem CI, changeset C, tag T, file F |
| 587 | WHERE CI.iid = T.tid -- get tag of item in cset |
| 588 | AND C.cid = CI.cid -- get changeset of item |
| 589 | AND C.type = 1 -- limit to tag changesets |
| 590 | AND F.fid = T.fid -- get file of tag |
| 591 | ) AS U |
| 592 | GROUP BY U.cid -- aggregate by csets, count proj/cset |
| 593 | HAVING COUNT(U.pid) > 1 -- find csets with multiple projects |
| 594 | ) |
| 595 | AND T.tid = C.type -- get readable changeset type |
| 596 | } |
| 597 | # All tags in a single changeset have to belong to different |
| 598 | # files. Conversely: No two tags of a single file are allowed |
| 599 | # to be in the same changeset. |
| 600 | # |
| @@ -580,26 +607,34 @@ | |
| 607 | {All tags in a changeset have to belong to different files} \ |
| 608 | {: Its tags share files} { |
| 609 | SELECT T.name, C.cid |
| 610 | FROM changeset C, cstype T |
| 611 | WHERE C.cid IN (SELECT VV.cid |
| 612 | FROM (SELECT U.cid AS cid, -- changeset |
| 613 | COUNT (U.fid) AS fcount -- number of files by items |
| 614 | FROM (SELECT DISTINCT -- unique cset/file pairs |
| 615 | CI.cid AS cid, -- tag changeset |
| 616 | T.fid AS fid -- file of item in changeset |
| 617 | FROM csitem CI, changeset C, tag T |
| 618 | WHERE CI.iid = T.tid -- get tag of item in changeset |
| 619 | AND C.cid = CI.cid -- get changeset of item |
| 620 | AND C.type = 1 -- limit to tag changesets |
| 621 | ) AS U |
| 622 | GROUP BY U.cid -- aggregate by csets, count files/cset |
| 623 | ) AS UU, |
| 624 | (SELECT V.cid AS cid, -- changeset |
| 625 | COUNT (V.iid) AS rcount -- number of items in cset |
| 626 | FROM csitem V, changeset X |
| 627 | WHERE X.cid = V.cid -- get changeset of item |
| 628 | AND X.type = 1 -- limit to tag changesets |
| 629 | GROUP BY V.cid -- aggregate by csets, count items/cset |
| 630 | ) AS VV |
| 631 | WHERE VV.cid = UU.cid -- sync #items/cset with #files/cset |
| 632 | AND UU.fcount < VV.rcount -- less files than items |
| 633 | -- => items belong to the same file. |
| 634 | ) |
| 635 | AND T.tid = C.type -- get readable changeset type |
| 636 | } |
| 637 | return |
| 638 | } |
| 639 | |
| 640 | proc BranchChangesets {} { |
| @@ -628,11 +663,12 @@ | |
| 663 | FROM branch |
| 664 | EXCEPT -- subtract |
| 665 | SELECT CI.iid -- branches used |
| 666 | FROM csitem CI, changeset C |
| 667 | WHERE C.cid = CI.cid -- by any branch |
| 668 | AND C.type = 2 -- changeset |
| 669 | ) |
| 670 | AND S.sid = B.sid -- get symbol of branch |
| 671 | AND P.pid = S.pid -- get project of symbol |
| 672 | } |
| 673 | # Find all branches which are used by more than one changeset. |
| 674 | CheckRev \ |
| @@ -645,19 +681,21 @@ | |
| 681 | -- than one user, and get their associated file (name) |
| 682 | -- for display. |
| 683 | |
| 684 | SELECT P.name, S.name |
| 685 | FROM branch B, project P, symbol S, |
| 686 | (SELECT CI.iid AS iid, -- item |
| 687 | count(CI.cid) AS count -- number of csets for item |
| 688 | FROM csitem CI, changeset C |
| 689 | WHERE C.type = 2 -- limit to branch changesets, |
| 690 | AND C.cid = CI.cid -- get the items they contain, |
| 691 | GROUP BY CI.iid -- aggregate by items, count csets/item (x) |
| 692 | ) AS U |
| 693 | WHERE U.count > 1 -- find items used multiple times |
| 694 | AND B.bid = U.iid -- get the users (branch changesets) |
| 695 | AND S.sid = B.sid -- get symbol of branch |
| 696 | AND P.pid = S.pid -- get project of symbol |
| 697 | } |
| 698 | if 0 { |
| 699 | # This check has been disabled. When the converter was run |
| 700 | # on the Tcl CVS several branches tripped this |
| 701 | # constraint. One of them was a free-floating branch, and |
| @@ -719,18 +757,23 @@ | |
| 757 | {All branches in a changeset have to belong to the same project} \ |
| 758 | {: Its branches disagree about the project they belong to} { |
| 759 | SELECT T.name, C.cid |
| 760 | FROM changeset C, cstype T |
| 761 | WHERE C.cid IN (SELECT U.cid |
| 762 | FROM (SELECT DISTINCT -- Unique cset/proj pairs |
| 763 | CI.cid AS cid, -- Branch cset |
| 764 | F.pid AS pid -- Project of item in cset |
| 765 | FROM csitem CI, changeset C, branch B, file F |
| 766 | WHERE CI.iid = B.bid -- get branch of item in cset |
| 767 | AND C.cid = CI.cid -- get changeset of item |
| 768 | AND C.type = 2 -- limit to branch changesets |
| 769 | AND F.fid = B.fid -- get file of branch |
| 770 | ) AS U |
| 771 | GROUP BY U.cid -- aggregate by csets, count proj/cset |
| 772 | HAVING COUNT(U.pid) > 1 -- find cset with multiple projects |
| 773 | ) |
| 774 | AND T.tid = C.type -- get readable changeset type |
| 775 | } |
| 776 | # All branches in a single changeset have to belong to |
| 777 | # different files. Conversely: No two branches of a single |
| 778 | # file are allowed to be in the same changeset. |
| 779 | # |
| @@ -744,26 +787,34 @@ | |
| 787 | {All branches in a changeset have to belong to different files} \ |
| 788 | {: Its branches share files} { |
| 789 | SELECT T.name, C.cid |
| 790 | FROM changeset C, cstype T |
| 791 | WHERE C.cid IN (SELECT VV.cid |
| 792 | FROM (SELECT U.cid AS cid, -- changeset |
| 793 | COUNT (U.fid) AS fcount -- number of files by items |
| 794 | FROM (SELECT DISTINCT -- unique cset/file pairs |
| 795 | CI.cid AS cid, -- Branch changeset |
| 796 | B.fid AS fid -- File of item in changeset |
| 797 | FROM csitem CI, changeset C, branch B |
| 798 | WHERE CI.iid = B.bid -- get tag of item in changeset |
| 799 | AND C.cid = CI.cid -- get changeset of item |
| 800 | AND C.type = 2 -- limit to branch changesets |
| 801 | ) AS U |
| 802 | GROUP BY U.cid -- aggregate by csets, count files/cset |
| 803 | ) AS UU, |
| 804 | (SELECT V.cid AS cid, -- changeset |
| 805 | COUNT (V.iid) AS rcount -- number of items in cset |
| 806 | FROM csitem V, changeset X |
| 807 | WHERE X.cid = V.cid -- get changeset of item |
| 808 | AND X.type = 2 -- limit to branch changesets |
| 809 | GROUP BY V.cid -- aggregate by csets, count items/cset |
| 810 | ) AS VV |
| 811 | WHERE VV.cid = UU.cid -- sync #items/cset with #files/cset |
| 812 | AND UU.fcount < VV.rcount -- less files than items |
| 813 | -- => items belong to the same file. |
| 814 | ) |
| 815 | AND T.tid = C.type -- get readable changeset type |
| 816 | } |
| 817 | return |
| 818 | } |
| 819 | |
| 820 | proc ___UnusedChangesetChecks___ {} { |
| @@ -788,11 +839,11 @@ | |
| 839 | {All revisions used by tag symbol changesets have to have the changeset's tag attached to them} \ |
| 840 | {does not have the tag of its symbol changeset @ attached to it} { |
| 841 | SELECT CT.name, C.cid, F.name, R.rev |
| 842 | FROM changeset C, cstype CT, revision R, file F, csitem CI, tag T |
| 843 | WHERE C.type = 1 -- symbol changesets only |
| 844 | AND C.src = T.sid -- tag only, linked by symbol id |
| 845 | AND C.cid = CI.cid -- changeset --> its revisions |
| 846 | AND R.rid = CI.iid -- look at the revisions |
| 847 | -- and look for the tag among the attached ones. |
| 848 | AND T.sid NOT IN (SELECT TB.sid |
| 849 | FROM tag TB |
| 850 |