Artifact 3028615e2ae6c9863414c1464e0fb15a2ece6a96:
File tools/cvs2fossil/lib/c2f_integrity.tcl part of check-in [00bf8c198e] - The performance was still not satisfying, even with faster recomputing of successors. Doing it multiple times (Building the graph in each breaker and sort passes) eats time. Caching in memory blows the memory. Chosen solution: Cache this information in the database.Created a new pass 'CsetDeps' which is run between 'InitCsets' and 'BreakRevCsetCycles' (i.e. changeset creation and first breaker pass). It computes the changeset dependencies from the file-level dependencies once and saves the result in the state, in the new table 'cssuccessor'. Now the breaker and sort passes can get the information quickly, with virtually no effort. The dependencies are recomputed incrementally when a changeset is split by one of the breaker passes, for its fragments and its predecessors.
The loop check is now trivial, and integrated into the successor computation, with the heavy lifting for the detailed analysis and reporting moved down into the type-dependent SQL queries. The relevant new method is 'loops'. Now that the loop check is incremental the pass based checks have been removed from the integrity module, and the option '--loopcheck' has been eliminated. For paranoia the graph setup and modification code got its loop check reinstated as an assert, redusing the changeset report code.
Renumbered the breaker and sort passes. A number of places, like graph setup and traversal, loading of changesets, etc. got feedback indicators to show their progress.
The selection of revision and symbol changesets for the associated breaker passes was a bit on the slow side. We now keep changeset lists sorted by type (during loading or general construction) and access them directly.
by aku on 2007-12-02 20:04:40.
0000: 23 23 20 2d 2a 2d 20 74 63 6c 20 2d 2a 2d 0a 23 ## -*- tcl -*-.# 0010: 20 23 20 23 23 20 23 23 23 20 23 23 23 23 23 20 # ## ### ##### 0020: 23 23 23 23 23 23 23 23 20 23 23 23 23 23 23 23 ######## ####### 0030: 23 23 23 23 23 23 20 23 23 23 23 23 23 23 23 23 ###### ######### 0040: 23 23 23 23 23 23 23 23 23 23 23 23 0a 23 23 20 ############.## 0050: 43 6f 70 79 72 69 67 68 74 20 28 63 29 20 32 30 Copyright (c) 20 0060: 30 37 20 41 6e 64 72 65 61 73 20 4b 75 70 72 69 07 Andreas Kupri 0070: 65 73 2e 0a 23 0a 23 20 54 68 69 73 20 73 6f 66 es..#.# This sof 0080: 74 77 61 72 65 20 69 73 20 6c 69 63 65 6e 73 65 tware is license 0090: 64 20 61 73 20 64 65 73 63 72 69 62 65 64 20 69 d as described i 00a0: 6e 20 74 68 65 20 66 69 6c 65 20 4c 49 43 45 4e n the file LICEN 00b0: 53 45 2c 20 77 68 69 63 68 0a 23 20 79 6f 75 20 SE, which.# you 00c0: 73 68 6f 75 6c 64 20 68 61 76 65 20 72 65 63 65 should have rece 00d0: 69 76 65 64 20 61 73 20 70 61 72 74 20 6f 66 20 ived as part of 00e0: 74 68 69 73 20 64 69 73 74 72 69 62 75 74 69 6f this distributio 00f0: 6e 2e 0a 23 0a 23 20 54 68 69 73 20 73 6f 66 74 n..#.# This soft 0100: 77 61 72 65 20 63 6f 6e 73 69 73 74 73 20 6f 66 ware consists of 0110: 20 76 6f 6c 75 6e 74 61 72 79 20 63 6f 6e 74 72 voluntary contr 0120: 69 62 75 74 69 6f 6e 73 20 6d 61 64 65 20 62 79 ibutions made by 0130: 20 6d 61 6e 79 0a 23 20 69 6e 64 69 76 69 64 75 many.# individu 0140: 61 6c 73 2e 20 20 46 6f 72 20 65 78 61 63 74 20 als. For exact 0150: 63 6f 6e 74 72 69 62 75 74 69 6f 6e 20 68 69 73 contribution his 0160: 74 6f 72 79 2c 20 73 65 65 20 74 68 65 20 72 65 tory, see the re 0170: 76 69 73 69 6f 6e 0a 23 20 68 69 73 74 6f 72 79 vision.# history 0180: 20 61 6e 64 20 6c 6f 67 73 2c 20 61 76 61 69 6c and logs, avail 0190: 61 62 6c 65 20 61 74 20 68 74 74 70 3a 2f 2f 66 able at http://f 01a0: 6f 73 73 69 6c 2d 73 63 6d 2e 68 77 61 63 69 2e ossil-scm.hwaci. 01b0: 63 6f 6d 2f 66 6f 73 73 69 6c 0a 23 20 23 20 23 com/fossil.# # # 01c0: 23 20 23 23 23 20 23 23 23 23 23 20 23 23 23 23 # ### ##### #### 01d0: 23 23 23 23 20 23 23 23 23 23 23 23 23 23 23 23 #### ########### 01e0: 23 23 20 23 23 23 23 23 23 23 23 23 23 23 23 23 ## ############# 01f0: 23 23 23 23 23 23 23 23 0a 0a 23 23 20 54 68 69 ########..## Thi 0200: 73 20 70 61 63 6b 61 67 65 20 68 6f 6c 64 73 20 s package holds 0210: 61 20 6e 75 6d 62 65 72 20 6f 66 20 69 6e 74 65 a number of inte 0220: 67 72 69 74 79 20 63 68 65 63 6b 73 20 64 6f 6e grity checks don 0230: 65 20 6f 6e 20 74 68 65 0a 23 23 20 70 65 72 73 e on the.## pers 0240: 69 73 74 65 6e 74 20 73 74 61 74 65 2e 20 54 68 istent state. Th 0250: 69 73 20 69 73 20 75 73 65 64 20 62 79 20 74 68 is is used by th 0260: 65 20 70 61 73 73 65 73 20 49 49 20 61 6e 64 20 e passes II and 0270: 49 56 2e 0a 0a 23 20 23 20 23 23 20 23 23 23 20 IV...# # ## ### 0280: 23 23 23 23 23 20 23 23 23 23 23 23 23 23 20 23 ##### ######## # 0290: 23 23 23 23 23 23 23 23 23 23 23 23 20 23 23 23 ############ ### 02a0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################ 02b0: 23 23 0a 23 23 20 52 65 71 75 69 72 65 6d 65 6e ##.## Requiremen 02c0: 74 73 0a 0a 70 61 63 6b 61 67 65 20 72 65 71 75 ts..package requ 02d0: 69 72 65 20 54 63 6c 20 38 2e 34 20 20 20 20 20 ire Tcl 8.4 02e0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 02f0: 20 20 20 20 20 20 20 20 20 20 3b 20 23 20 52 65 ; # Re 0300: 71 75 69 72 65 64 20 72 75 6e 74 69 6d 65 2e 0a quired runtime.. 0310: 70 61 63 6b 61 67 65 20 72 65 71 75 69 72 65 20 package require 0320: 73 6e 69 74 20 20 20 20 20 20 20 20 20 20 20 20 snit 0330: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 0340: 20 20 20 20 20 20 3b 20 23 20 4f 4f 20 73 79 73 ; # OO sys 0350: 74 65 6d 2e 0a 70 61 63 6b 61 67 65 20 72 65 71 tem..package req 0360: 75 69 72 65 20 76 63 3a 3a 74 6f 6f 6c 73 3a 3a uire vc::tools:: 0370: 74 72 6f 75 62 6c 65 20 20 20 20 20 20 20 20 20 trouble 0380: 20 20 20 20 20 20 20 20 20 20 20 3b 20 23 20 45 ; # E 0390: 72 72 6f 72 20 72 65 70 6f 72 74 69 6e 67 2e 0a rror reporting.. 03a0: 70 61 63 6b 61 67 65 20 72 65 71 75 69 72 65 20 package require 03b0: 76 63 3a 3a 74 6f 6f 6c 73 3a 3a 6c 6f 67 20 20 vc::tools::log 03c0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 03d0: 20 20 20 20 20 20 3b 20 23 20 55 73 65 72 20 66 ; # User f 03e0: 65 65 64 62 61 63 6b 2e 0a 70 61 63 6b 61 67 65 eedback..package 03f0: 20 72 65 71 75 69 72 65 20 76 63 3a 3a 66 6f 73 require vc::fos 0400: 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 sil::import::cvs 0410: 3a 3a 73 74 61 74 65 20 20 20 20 20 20 20 20 3b ::state ; 0420: 20 23 20 53 74 61 74 65 20 73 74 6f 72 61 67 65 # State storage 0430: 2e 0a 0a 23 20 23 20 23 23 20 23 23 23 20 23 23 ...# # ## ### ## 0440: 23 23 23 20 23 23 23 23 23 23 23 23 20 23 23 23 ### ######## ### 0450: 23 23 23 23 23 23 23 23 23 23 20 23 23 23 23 23 ########## ##### 0460: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################ 0470: 0a 23 23 0a 0a 73 6e 69 74 3a 3a 74 79 70 65 20 .##..snit::type 0480: 3a 3a 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d ::vc::fossil::im 0490: 70 6f 72 74 3a 3a 63 76 73 3a 3a 69 6e 74 65 67 port::cvs::integ 04a0: 72 69 74 79 20 7b 0a 20 20 20 20 23 20 23 20 23 rity {. # # # 04b0: 23 20 23 23 23 20 23 23 23 23 23 20 23 23 23 23 # ### ##### #### 04c0: 23 23 23 23 20 23 23 23 23 23 23 23 23 23 23 23 #### ########### 04d0: 23 23 0a 20 20 20 20 23 23 20 50 75 62 6c 69 63 ##. ## Public 04e0: 20 41 50 49 0a 0a 20 20 20 20 74 79 70 65 6d 65 API.. typeme 04f0: 74 68 6f 64 20 61 73 73 65 72 74 20 7b 65 78 70 thod assert {exp 0500: 72 65 73 73 69 6f 6e 20 66 61 69 6c 6d 65 73 73 ression failmess 0510: 61 67 65 7d 20 7b 0a 09 73 65 74 20 6f 6b 20 5b age} {..set ok [ 0520: 75 70 6c 65 76 65 6c 20 31 20 5b 6c 69 73 74 20 uplevel 1 [list 0530: 3a 3a 65 78 70 72 20 24 65 78 70 72 65 73 73 69 ::expr $expressi 0540: 6f 6e 5d 5d 0a 09 69 66 20 7b 24 6f 6b 7d 20 72 on]]..if {$ok} r 0550: 65 74 75 72 6e 0a 09 74 72 6f 75 62 6c 65 20 69 eturn..trouble i 0560: 6e 74 65 72 6e 61 6c 20 5b 75 70 6c 65 76 65 6c nternal [uplevel 0570: 20 31 20 5b 6c 69 73 74 20 3a 3a 73 75 62 73 74 1 [list ::subst 0580: 20 24 66 61 69 6c 6d 65 73 73 61 67 65 5d 5d 0a $failmessage]]. 0590: 09 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 .return. }.. 05a0: 20 20 20 74 79 70 65 6d 65 74 68 6f 64 20 73 74 typemethod st 05b0: 72 69 63 74 20 7b 7d 20 7b 0a 09 6c 6f 67 20 77 rict {} {..log w 05c0: 72 69 74 65 20 34 20 69 6e 74 65 67 72 69 74 79 rite 4 integrity 05d0: 20 7b 43 68 65 63 6b 20 64 61 74 61 62 61 73 65 {Check database 05e0: 20 63 6f 6e 73 69 73 74 65 6e 63 79 7d 0a 0a 09 consistency}... 05f0: 73 65 74 20 6e 20 30 0a 09 41 6c 6c 42 75 74 4d set n 0..AllButM 0600: 65 74 61 0a 09 4d 65 74 61 0a 09 72 65 74 75 72 eta..Meta..retur 0610: 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 74 79 70 n. }.. typ 0620: 65 6d 65 74 68 6f 64 20 6d 65 74 61 72 65 6c 61 emethod metarela 0630: 78 65 64 20 7b 7d 20 7b 0a 09 6c 6f 67 20 77 72 xed {} {..log wr 0640: 69 74 65 20 34 20 69 6e 74 65 67 72 69 74 79 20 ite 4 integrity 0650: 7b 43 68 65 63 6b 20 64 61 74 61 62 61 73 65 20 {Check database 0660: 63 6f 6e 73 69 73 74 65 6e 63 79 7d 0a 0a 09 73 consistency}...s 0670: 65 74 20 6e 20 30 0a 09 41 6c 6c 42 75 74 4d 65 et n 0..AllButMe 0680: 74 61 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 7d ta..return. } 0690: 0a 0a 20 20 20 20 74 79 70 65 6d 65 74 68 6f 64 .. typemethod 06a0: 20 63 68 61 6e 67 65 73 65 74 73 20 7b 7d 20 7b changesets {} { 06b0: 0a 09 6c 6f 67 20 77 72 69 74 65 20 34 20 69 6e ..log write 4 in 06c0: 74 65 67 72 69 74 79 20 7b 43 68 65 63 6b 20 64 tegrity {Check d 06d0: 61 74 61 62 61 73 65 20 63 6f 6e 73 69 73 74 65 atabase consiste 06e0: 6e 63 79 7d 0a 0a 09 73 65 74 20 6e 20 30 0a 09 ncy}...set n 0.. 06f0: 52 65 76 69 73 69 6f 6e 43 68 61 6e 67 65 73 65 RevisionChangese 0700: 74 73 0a 09 54 61 67 43 68 61 6e 67 65 73 65 74 ts..TagChangeset 0710: 73 0a 09 42 72 61 6e 63 68 43 68 61 6e 67 65 73 s..BranchChanges 0720: 65 74 73 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 ets..return. 0730: 7d 0a 0a 20 20 20 20 23 20 23 20 23 23 20 23 23 }.. # # ## ## 0740: 23 20 23 23 23 23 23 20 23 23 23 23 23 23 23 23 # ##### ######## 0750: 20 23 23 23 23 23 23 23 23 23 23 23 23 23 0a 20 #############. 0760: 20 20 20 23 23 20 49 6e 74 65 72 6e 61 6c 20 6d ## Internal m 0770: 65 74 68 6f 64 73 0a 0a 20 20 20 20 70 72 6f 63 ethods.. proc 0780: 20 41 6c 6c 42 75 74 4d 65 74 61 20 7b 7d 20 7b AllButMeta {} { 0790: 0a 09 23 20 54 68 69 73 20 63 6f 64 65 20 70 65 ..# This code pe 07a0: 72 66 6f 72 6d 73 20 61 20 6e 75 6d 62 65 72 20 rforms a number 07b0: 6f 66 20 70 61 72 61 6e 6f 69 64 20 63 68 65 63 of paranoid chec 07c0: 6b 73 20 6f 66 20 74 68 65 0a 09 23 20 64 61 74 ks of the..# dat 07d0: 61 62 61 73 65 2c 20 73 65 61 72 63 68 69 6e 67 abase, searching 07e0: 20 66 6f 72 20 69 6e 63 6f 6e 73 69 73 74 65 6e for inconsisten 07f0: 74 20 63 72 6f 73 73 2d 72 65 66 65 72 65 6e 63 t cross-referenc 0800: 65 73 2e 0a 0a 09 75 70 76 61 72 20 31 20 6e 20 es....upvar 1 n 0810: 6e 20 3b 20 23 20 43 6f 75 6e 74 65 72 20 66 6f n ; # Counter fo 0820: 72 20 74 68 65 20 63 68 65 63 6b 73 20 28 77 65 r the checks (we 0830: 20 70 72 69 6e 74 20 61 6e 20 69 64 20 62 65 66 print an id bef 0840: 6f 72 65 0a 09 09 20 20 20 20 20 20 23 20 74 68 ore... # th 0850: 65 20 6d 61 69 6e 20 6c 61 62 65 6c 29 2e 0a 0a e main label)... 0860: 09 23 20 46 69 6e 64 20 61 6c 6c 20 72 65 76 69 .# Find all revi 0870: 73 69 6f 6e 73 20 77 68 69 63 68 20 64 69 73 61 sions which disa 0880: 67 72 65 65 20 77 69 74 68 20 74 68 65 69 72 20 gree with their 0890: 6c 69 6e 65 20 6f 66 0a 09 23 20 64 65 76 65 6c line of..# devel 08a0: 6f 70 6d 65 6e 74 20 61 62 6f 75 74 20 74 68 65 opment about the 08b0: 20 70 72 6f 6a 65 63 74 20 74 68 65 79 20 61 72 project they ar 08c0: 65 20 6f 77 6e 65 64 20 62 79 2e 0a 09 43 68 65 e owned by...Che 08d0: 63 6b 52 65 76 20 5c 0a 09 20 20 20 20 7b 52 65 ckRev \.. {Re 08e0: 76 69 73 69 6f 6e 73 20 61 6e 64 20 74 68 65 69 visions and thei 08f0: 72 20 4c 4f 44 73 20 68 61 76 65 20 74 6f 20 62 r LODs have to b 0900: 65 20 69 6e 20 74 68 65 20 73 61 6d 65 20 70 72 e in the same pr 0910: 6f 6a 65 63 74 7d 20 5c 0a 09 20 20 20 20 7b 64 oject} \.. {d 0920: 69 73 61 67 72 65 65 73 20 77 69 74 68 20 69 74 isagrees with it 0930: 73 20 4c 4f 44 20 61 62 6f 75 74 20 6f 77 6e 69 s LOD about owni 0940: 6e 67 20 70 72 6f 6a 65 63 74 7d 20 7b 0a 09 09 ng project} {... 0950: 53 45 4c 45 43 54 20 46 2e 6e 61 6d 65 2c 20 52 SELECT F.name, R 0960: 2e 72 65 76 0a 09 09 46 52 4f 4d 20 72 65 76 69 .rev...FROM revi 0970: 73 69 6f 6e 20 52 2c 20 66 69 6c 65 20 46 2c 20 sion R, file F, 0980: 73 79 6d 62 6f 6c 20 53 0a 09 09 57 48 45 52 45 symbol S...WHERE 0990: 20 52 2e 66 69 64 20 3d 20 46 2e 66 69 64 0a 09 R.fid = F.fid.. 09a0: 09 41 4e 44 20 20 20 52 2e 6c 6f 64 20 3d 20 53 .AND R.lod = S 09b0: 2e 73 69 64 0a 09 09 41 4e 44 20 20 20 46 2e 70 .sid...AND F.p 09c0: 69 64 20 21 3d 20 53 2e 70 69 64 0a 09 09 3b 0a id != S.pid...;. 09d0: 09 20 20 20 20 7d 0a 09 23 20 46 69 6e 64 20 61 . }..# Find a 09e0: 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 77 68 69 ll revisions whi 09f0: 63 68 20 64 69 73 67 72 65 65 20 77 69 74 68 20 ch disgree with 0a00: 74 68 65 69 72 20 6d 65 74 61 20 64 61 74 61 20 their meta data 0a10: 61 62 6f 75 74 0a 09 23 20 74 68 65 20 70 72 6f about..# the pro 0a20: 6a 65 63 74 20 74 68 65 79 20 61 72 65 20 6f 77 ject they are ow 0a30: 6e 65 64 20 62 79 2e 0a 09 43 68 65 63 6b 52 65 ned by...CheckRe 0a40: 76 20 5c 0a 09 20 20 20 20 7b 52 65 76 69 73 69 v \.. {Revisi 0a50: 6f 6e 73 20 61 6e 64 20 74 68 65 69 72 20 6d 65 ons and their me 0a60: 74 61 20 64 61 74 61 20 68 61 76 65 20 74 6f 20 ta data have to 0a70: 62 65 20 69 6e 20 74 68 65 20 73 61 6d 65 20 70 be in the same p 0a80: 72 6f 6a 65 63 74 7d 20 5c 0a 09 20 20 20 20 7b roject} \.. { 0a90: 64 69 73 61 67 72 65 65 73 20 77 69 74 68 20 69 disagrees with i 0aa0: 74 73 20 6d 65 74 61 20 64 61 74 61 20 61 62 6f ts meta data abo 0ab0: 75 74 20 6f 77 6e 69 6e 67 20 70 72 6f 6a 65 63 ut owning projec 0ac0: 74 7d 20 7b 0a 09 09 53 45 4c 45 43 54 20 46 2e t} {...SELECT F. 0ad0: 6e 61 6d 65 2c 20 52 2e 72 65 76 0a 09 09 46 52 name, R.rev...FR 0ae0: 4f 4d 20 72 65 76 69 73 69 6f 6e 20 52 2c 20 66 OM revision R, f 0af0: 69 6c 65 20 46 2c 20 6d 65 74 61 20 4d 0a 09 09 ile F, meta M... 0b00: 57 48 45 52 45 20 52 2e 66 69 64 20 3d 20 46 2e WHERE R.fid = F. 0b10: 66 69 64 0a 09 09 41 4e 44 20 20 20 52 2e 6d 69 fid...AND R.mi 0b20: 64 20 3d 20 4d 2e 6d 69 64 0a 09 09 41 4e 44 20 d = M.mid...AND 0b30: 20 20 46 2e 70 69 64 20 21 3d 20 4d 2e 70 69 64 F.pid != M.pid 0b40: 0a 09 09 3b 0a 09 20 20 20 20 7d 0a 09 23 20 46 ...;.. }..# F 0b50: 69 6e 64 20 61 6c 6c 20 72 65 76 69 73 69 6f 6e ind all revision 0b60: 73 20 77 69 74 68 20 61 20 70 72 69 6d 61 72 79 s with a primary 0b70: 20 63 68 69 6c 64 20 77 68 69 63 68 20 64 69 73 child which dis 0b80: 61 67 72 65 65 73 0a 09 23 20 61 62 6f 75 74 20 agrees..# about 0b90: 74 68 65 20 66 69 6c 65 20 74 68 65 79 20 62 65 the file they be 0ba0: 6c 6f 6e 67 20 74 6f 2e 0a 09 43 68 65 63 6b 52 long to...CheckR 0bb0: 65 76 20 5c 0a 09 20 20 20 20 7b 52 65 76 69 73 ev \.. {Revis 0bc0: 69 6f 6e 73 20 61 6e 64 20 74 68 65 69 72 20 70 ions and their p 0bd0: 72 69 6d 61 72 79 20 63 68 69 6c 64 72 65 6e 20 rimary children 0be0: 68 61 76 65 20 74 6f 20 62 65 20 69 6e 20 74 68 have to be in th 0bf0: 65 20 73 61 6d 65 20 66 69 6c 65 7d 20 5c 0a 09 e same file} \.. 0c00: 20 20 20 20 7b 64 69 73 61 67 72 65 65 73 20 77 {disagrees w 0c10: 69 74 68 20 69 74 73 20 70 72 69 6d 61 72 79 20 ith its primary 0c20: 63 68 69 6c 64 20 61 62 6f 75 74 20 74 68 65 20 child about the 0c30: 6f 77 6e 69 6e 67 20 66 69 6c 65 7d 20 7b 0a 09 owning file} {.. 0c40: 09 53 45 4c 45 43 54 20 46 2e 6e 61 6d 65 2c 20 .SELECT F.name, 0c50: 52 2e 72 65 76 0a 09 09 46 52 4f 4d 20 72 65 76 R.rev...FROM rev 0c60: 69 73 69 6f 6e 20 52 2c 20 72 65 76 69 73 69 6f ision R, revisio 0c70: 6e 20 43 2c 20 66 69 6c 65 20 46 0a 09 09 57 48 n C, file F...WH 0c80: 45 52 45 20 52 2e 66 69 64 20 3d 20 46 2e 66 69 ERE R.fid = F.fi 0c90: 64 0a 09 09 41 4e 44 20 20 20 52 2e 63 68 69 6c d...AND R.chil 0ca0: 64 20 49 53 20 4e 4f 54 20 4e 55 4c 4c 0a 09 09 d IS NOT NULL... 0cb0: 41 4e 44 20 20 20 52 2e 63 68 69 6c 64 20 3d 20 AND R.child = 0cc0: 43 2e 72 69 64 0a 09 09 41 4e 44 20 20 20 43 2e C.rid...AND C. 0cd0: 66 69 64 20 21 3d 20 52 2e 66 69 64 0a 09 09 3b fid != R.fid...; 0ce0: 0a 09 20 20 20 20 7d 0a 0a 09 23 20 46 69 6e 64 .. }...# Find 0cf0: 20 61 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 77 all revisions w 0d00: 69 74 68 20 61 20 62 72 61 6e 63 68 20 70 61 72 ith a branch par 0d10: 65 6e 74 20 73 79 6d 62 6f 6c 20 77 68 6f 73 65 ent symbol whose 0d20: 20 70 61 72 65 6e 74 0a 09 23 20 64 69 73 61 67 parent..# disag 0d30: 72 65 65 73 20 61 62 6f 75 74 20 74 68 65 20 66 rees about the f 0d40: 69 6c 65 20 74 68 65 79 20 62 65 6c 6f 6e 67 20 ile they belong 0d50: 74 6f 2e 0a 09 43 68 65 63 6b 52 65 76 20 5c 0a to...CheckRev \. 0d60: 09 20 20 20 20 7b 52 65 76 69 73 69 6f 6e 73 20 . {Revisions 0d70: 61 6e 64 20 74 68 65 69 72 20 62 72 61 6e 63 68 and their branch 0d80: 20 63 68 69 6c 64 72 65 6e 20 68 61 76 65 20 74 children have t 0d90: 6f 20 62 65 20 69 6e 20 74 68 65 20 73 61 6d 65 o be in the same 0da0: 20 66 69 6c 65 7d 20 5c 0a 09 20 20 20 20 7b 61 file} \.. {a 0db0: 74 20 74 68 65 20 62 65 67 69 6e 6e 69 6e 67 20 t the beginning 0dc0: 6f 66 20 69 74 73 20 62 72 61 6e 63 68 20 61 6e of its branch an 0dd0: 64 20 69 74 73 20 70 61 72 65 6e 74 20 64 69 73 d its parent dis 0de0: 61 67 72 65 65 20 61 62 6f 75 74 20 74 68 65 20 agree about the 0df0: 6f 77 6e 69 6e 67 20 66 69 6c 65 7d 20 7b 0a 09 owning file} {.. 0e00: 09 53 45 4c 45 43 54 20 46 2e 6e 61 6d 65 2c 20 .SELECT F.name, 0e10: 52 2e 72 65 76 0a 09 09 46 52 4f 4d 20 72 65 76 R.rev...FROM rev 0e20: 69 73 69 6f 6e 20 52 2c 20 72 65 76 69 73 69 6f ision R, revisio 0e30: 6e 20 50 2c 20 66 69 6c 65 20 46 0a 09 09 57 48 n P, file F...WH 0e40: 45 52 45 20 52 2e 66 69 64 20 3d 20 46 2e 66 69 ERE R.fid = F.fi 0e50: 64 0a 09 09 41 4e 44 20 20 20 52 2e 62 70 61 72 d...AND R.bpar 0e60: 65 6e 74 20 49 53 20 4e 4f 54 20 4e 55 4c 4c 0a ent IS NOT NULL. 0e70: 09 09 41 4e 44 20 20 20 52 2e 70 61 72 65 6e 74 ..AND R.parent 0e80: 20 3d 20 50 2e 72 69 64 0a 09 09 41 4e 44 20 20 = P.rid...AND 0e90: 20 52 2e 66 69 64 20 21 3d 20 50 2e 66 69 64 0a R.fid != P.fid. 0ea0: 09 09 3b 0a 09 20 20 20 20 7d 0a 09 23 20 46 69 ..;.. }..# Fi 0eb0: 6e 64 20 61 6c 6c 20 72 65 76 69 73 69 6f 6e 73 nd all revisions 0ec0: 20 77 69 74 68 20 61 20 6e 6f 6e 2d 4e 54 44 42 with a non-NTDB 0ed0: 20 63 68 69 6c 64 20 77 68 69 63 68 20 64 69 73 child which dis 0ee0: 61 67 72 65 65 73 0a 09 23 20 61 62 6f 75 74 20 agrees..# about 0ef0: 74 68 65 20 66 69 6c 65 20 74 68 65 79 20 62 65 the file they be 0f00: 6c 6f 6e 67 20 74 6f 2e 0a 09 43 68 65 63 6b 52 long to...CheckR 0f10: 65 76 20 5c 0a 09 20 20 20 20 7b 52 65 76 69 73 ev \.. {Revis 0f20: 69 6f 6e 73 20 61 6e 64 20 74 68 65 69 72 20 6e ions and their n 0f30: 6f 6e 2d 4e 54 44 42 20 63 68 69 6c 64 72 65 6e on-NTDB children 0f40: 20 68 61 76 65 20 74 6f 20 62 65 20 69 6e 20 74 have to be in t 0f50: 68 65 20 73 61 6d 65 20 66 69 6c 65 7d 20 5c 0a he same file} \. 0f60: 09 20 20 20 20 7b 64 69 73 61 67 72 65 65 73 20 . {disagrees 0f70: 77 69 74 68 20 69 74 73 20 6e 6f 6e 2d 4e 54 44 with its non-NTD 0f80: 42 20 63 68 69 6c 64 20 61 62 6f 75 74 20 74 68 B child about th 0f90: 65 20 6f 77 6e 69 6e 67 20 66 69 6c 65 7d 20 7b e owning file} { 0fa0: 0a 09 09 53 45 4c 45 43 54 20 46 2e 6e 61 6d 65 ...SELECT F.name 0fb0: 2c 20 52 2e 72 65 76 0a 09 09 46 52 4f 4d 20 72 , R.rev...FROM r 0fc0: 65 76 69 73 69 6f 6e 20 52 2c 20 72 65 76 69 73 evision R, revis 0fd0: 69 6f 6e 20 43 2c 20 66 69 6c 65 20 46 0a 09 09 ion C, file F... 0fe0: 57 48 45 52 45 20 52 2e 66 69 64 20 3d 20 46 2e WHERE R.fid = F. 0ff0: 66 69 64 0a 09 09 41 4e 44 20 20 20 52 2e 64 62 fid...AND R.db 1000: 63 68 69 6c 64 20 49 53 20 4e 4f 54 20 4e 55 4c child IS NOT NUL 1010: 4c 0a 09 09 41 4e 44 20 20 20 52 2e 64 62 63 68 L...AND R.dbch 1020: 69 6c 64 20 3d 20 43 2e 72 69 64 0a 09 09 41 4e ild = C.rid...AN 1030: 44 20 20 20 43 2e 66 69 64 20 21 3d 20 52 2e 66 D C.fid != R.f 1040: 69 64 0a 09 09 3b 0a 09 20 20 20 20 7d 0a 09 23 id...;.. }..# 1050: 20 46 69 6e 64 20 61 6c 6c 20 72 65 76 69 73 69 Find all revisi 1060: 6f 6e 73 20 77 68 69 63 68 20 68 61 76 65 20 61 ons which have a 1070: 20 70 72 69 6d 61 72 79 20 63 68 69 6c 64 2c 20 primary child, 1080: 62 75 74 20 74 68 65 20 63 68 69 6c 64 0a 09 23 but the child..# 1090: 20 64 6f 65 73 20 6e 6f 74 20 68 61 76 65 20 74 does not have t 10a0: 68 65 6d 20 61 73 20 70 61 72 65 6e 74 2e 0a 09 hem as parent... 10b0: 43 68 65 63 6b 52 65 76 20 5c 0a 09 20 20 20 20 CheckRev \.. 10c0: 7b 52 65 76 69 73 69 6f 6e 73 20 68 61 76 65 20 {Revisions have 10d0: 74 6f 20 62 65 20 70 61 72 65 6e 74 73 20 6f 66 to be parents of 10e0: 20 74 68 65 69 72 20 70 72 69 6d 61 72 79 20 63 their primary c 10f0: 68 69 6c 64 72 65 6e 7d 20 5c 0a 09 20 20 20 20 hildren} \.. 1100: 7b 69 73 20 6e 6f 74 20 74 68 65 20 70 61 72 65 {is not the pare 1110: 6e 74 20 6f 66 20 69 74 73 20 70 72 69 6d 61 72 nt of its primar 1120: 79 20 63 68 69 6c 64 7d 20 7b 0a 09 09 53 45 4c y child} {...SEL 1130: 45 43 54 20 46 2e 6e 61 6d 65 2c 20 52 2e 72 65 ECT F.name, R.re 1140: 76 0a 09 09 46 52 4f 4d 20 72 65 76 69 73 69 6f v...FROM revisio 1150: 6e 20 52 2c 20 72 65 76 69 73 69 6f 6e 20 43 2c n R, revision C, 1160: 20 66 69 6c 65 20 46 0a 09 09 57 48 45 52 45 20 file F...WHERE 1170: 52 2e 66 69 64 20 3d 20 46 2e 66 69 64 0a 09 09 R.fid = F.fid... 1180: 41 4e 44 20 20 20 52 2e 63 68 69 6c 64 20 49 53 AND R.child IS 1190: 20 4e 4f 54 20 4e 55 4c 4c 0a 09 09 41 4e 44 20 NOT NULL...AND 11a0: 20 20 52 2e 63 68 69 6c 64 20 3d 20 43 2e 72 69 R.child = C.ri 11b0: 64 0a 09 09 41 4e 44 20 20 20 43 2e 70 61 72 65 d...AND C.pare 11c0: 6e 74 20 21 3d 20 52 2e 72 69 64 0a 09 09 3b 0a nt != R.rid...;. 11d0: 09 20 20 20 20 7d 0a 09 23 20 46 69 6e 64 20 61 . }..# Find a 11e0: 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 77 68 69 ll revisions whi 11f0: 63 68 20 68 61 76 65 20 61 20 70 72 69 6d 72 61 ch have a primra 1200: 72 79 20 63 68 69 6c 64 2c 20 62 75 74 20 74 68 ry child, but th 1210: 65 0a 09 23 20 63 68 69 6c 64 20 68 61 73 20 61 e..# child has a 1220: 20 62 72 61 6e 63 68 20 70 61 72 65 6e 74 20 73 branch parent s 1230: 79 6d 62 6f 6c 20 6d 61 6b 69 6e 67 20 74 68 65 ymbol making the 1240: 6d 20 62 72 61 63 68 20 73 74 61 72 74 65 72 73 m brach starters 1250: 2e 0a 09 43 68 65 63 6b 52 65 76 20 5c 0a 09 20 ...CheckRev \.. 1260: 20 20 20 7b 50 72 69 6d 61 72 79 20 63 68 69 6c {Primary chil 1270: 64 72 65 6e 20 6f 66 20 72 65 76 69 73 69 6f 6e dren of revision 1280: 73 20 6d 75 73 74 20 6e 6f 74 20 73 74 61 72 74 s must not start 1290: 20 62 72 61 6e 63 68 65 73 7d 20 5c 0a 09 20 20 branches} \.. 12a0: 20 20 7b 69 73 20 70 61 72 65 6e 74 20 6f 66 20 {is parent of 12b0: 61 20 70 72 69 6d 61 72 79 20 63 68 69 6c 64 20 a primary child 12c0: 77 68 69 63 68 20 69 73 20 74 68 65 20 62 65 67 which is the beg 12d0: 69 6e 6e 69 6e 67 20 6f 66 20 61 20 62 72 61 6e inning of a bran 12e0: 63 68 7d 20 7b 0a 09 09 53 45 4c 45 43 54 20 46 ch} {...SELECT F 12f0: 2e 6e 61 6d 65 2c 20 52 2e 72 65 76 0a 09 09 46 .name, R.rev...F 1300: 52 4f 4d 20 72 65 76 69 73 69 6f 6e 20 52 2c 20 ROM revision R, 1310: 72 65 76 69 73 69 6f 6e 20 43 2c 20 66 69 6c 65 revision C, file 1320: 20 46 0a 09 09 57 48 45 52 45 20 52 2e 66 69 64 F...WHERE R.fid 1330: 20 3d 20 46 2e 66 69 64 0a 09 09 41 4e 44 20 20 = F.fid...AND 1340: 20 52 2e 63 68 69 6c 64 20 49 53 20 4e 4f 54 20 R.child IS NOT 1350: 4e 55 4c 4c 0a 09 09 41 4e 44 20 20 20 52 2e 63 NULL...AND R.c 1360: 68 69 6c 64 20 3d 20 43 2e 72 69 64 0a 09 09 41 hild = C.rid...A 1370: 4e 44 20 20 20 43 2e 62 70 61 72 65 6e 74 20 49 ND C.bparent I 1380: 53 20 4e 4f 54 20 4e 55 4c 4c 0a 09 09 3b 0a 09 S NOT NULL...;.. 1390: 20 20 20 20 7d 0a 09 23 20 46 69 6e 64 20 61 6c }..# Find al 13a0: 6c 20 72 65 76 69 73 69 6f 6e 73 20 77 69 74 68 l revisions with 13b0: 6f 75 74 20 62 72 61 6e 63 68 20 70 61 72 65 6e out branch paren 13c0: 74 20 73 79 6d 62 6f 6c 20 77 68 69 63 68 20 68 t symbol which h 13d0: 61 76 65 20 61 0a 09 23 20 70 61 72 65 6e 74 2c ave a..# parent, 13e0: 20 62 75 74 20 74 68 65 20 70 61 72 65 6e 74 20 but the parent 13f0: 64 6f 65 73 20 6e 6f 74 20 68 61 76 65 20 74 68 does not have th 1400: 65 6d 20 61 73 20 70 72 69 6d 61 72 79 20 63 68 em as primary ch 1410: 69 6c 64 2e 0a 09 43 68 65 63 6b 52 65 76 20 5c ild...CheckRev \ 1420: 0a 09 20 20 20 20 7b 52 65 76 69 73 69 6f 6e 73 .. {Revisions 1430: 20 68 61 76 65 20 74 6f 20 62 65 20 70 72 69 6d have to be prim 1440: 61 72 79 20 63 68 69 6c 64 72 65 6e 20 6f 66 20 ary children of 1450: 74 68 65 69 72 20 70 61 72 65 6e 74 73 2c 20 69 their parents, i 1460: 66 20 61 6e 79 7d 20 5c 0a 09 20 20 20 20 7b 69 f any} \.. {i 1470: 73 20 6e 6f 74 20 74 68 65 20 63 68 69 6c 64 20 s not the child 1480: 6f 66 20 69 74 73 20 70 61 72 65 6e 74 7d 20 7b of its parent} { 1490: 0a 09 09 53 45 4c 45 43 54 20 46 2e 6e 61 6d 65 ...SELECT F.name 14a0: 2c 20 52 2e 72 65 76 0a 09 09 46 52 4f 4d 20 72 , R.rev...FROM r 14b0: 65 76 69 73 69 6f 6e 20 52 2c 20 72 65 76 69 73 evision R, revis 14c0: 69 6f 6e 20 50 2c 20 66 69 6c 65 20 46 0a 09 09 ion P, file F... 14d0: 57 48 45 52 45 20 52 2e 66 69 64 20 3d 20 46 2e WHERE R.fid = F. 14e0: 66 69 64 0a 09 09 41 4e 44 20 20 20 52 2e 62 70 fid...AND R.bp 14f0: 61 72 65 6e 74 20 49 53 20 4e 55 4c 4c 0a 09 09 arent IS NULL... 1500: 41 4e 44 20 20 20 52 2e 70 61 72 65 6e 74 20 49 AND R.parent I 1510: 53 20 4e 4f 54 20 4e 55 4c 4c 0a 09 09 41 4e 44 S NOT NULL...AND 1520: 20 20 20 52 2e 70 61 72 65 6e 74 20 3d 20 50 2e R.parent = P. 1530: 72 69 64 0a 09 09 41 4e 44 20 20 20 50 2e 63 68 rid...AND P.ch 1540: 69 6c 64 20 21 3d 20 52 2e 72 69 64 0a 09 09 3b ild != R.rid...; 1550: 0a 09 20 20 20 20 7d 0a 09 23 20 46 69 6e 64 20 .. }..# Find 1560: 61 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 77 69 all revisions wi 1570: 74 68 20 61 20 62 72 61 6e 63 68 20 70 61 72 65 th a branch pare 1580: 6e 74 20 73 79 6d 62 6f 6c 20 77 68 69 63 68 20 nt symbol which 1590: 64 6f 20 6e 6f 74 0a 09 23 20 68 61 76 65 20 61 do not..# have a 15a0: 20 70 61 72 65 6e 74 2e 0a 09 43 68 65 63 6b 52 parent...CheckR 15b0: 65 76 20 5c 0a 09 20 20 20 20 7b 42 72 61 6e 63 ev \.. {Branc 15c0: 68 20 73 74 61 72 74 69 6e 67 20 72 65 76 69 73 h starting revis 15d0: 69 6f 6e 73 20 68 61 76 65 20 74 6f 20 68 61 76 ions have to hav 15e0: 65 20 61 20 70 61 72 65 6e 74 7d 20 5c 0a 09 20 e a parent} \.. 15f0: 20 20 20 7b 61 74 20 74 68 65 20 62 65 67 69 6e {at the begin 1600: 6e 69 6e 67 20 6f 66 20 69 74 73 20 62 72 61 6e ning of its bran 1610: 63 68 20 68 61 73 20 6e 6f 20 70 61 72 65 6e 74 ch has no parent 1620: 7d 20 7b 0a 09 09 53 45 4c 45 43 54 20 46 2e 6e } {...SELECT F.n 1630: 61 6d 65 2c 20 52 2e 72 65 76 0a 09 09 46 52 4f ame, R.rev...FRO 1640: 4d 20 72 65 76 69 73 69 6f 6e 20 52 2c 20 66 69 M revision R, fi 1650: 6c 65 20 46 0a 09 09 57 48 45 52 45 20 52 2e 66 le F...WHERE R.f 1660: 69 64 20 3d 20 46 2e 66 69 64 0a 09 09 41 4e 44 id = F.fid...AND 1670: 20 20 20 52 2e 62 70 61 72 65 6e 74 20 49 53 20 R.bparent IS 1680: 4e 4f 54 20 4e 55 4c 4c 0a 09 09 41 4e 44 20 20 NOT NULL...AND 1690: 20 52 2e 70 61 72 65 6e 74 20 49 53 20 4e 55 4c R.parent IS NUL 16a0: 4c 0a 09 09 3b 0a 09 20 20 20 20 7d 0a 09 23 20 L...;.. }..# 16b0: 46 69 6e 64 20 61 6c 6c 20 72 65 76 69 73 69 6f Find all revisio 16c0: 6e 73 20 77 69 74 68 20 61 20 62 72 61 6e 63 68 ns with a branch 16d0: 20 70 61 72 65 6e 74 20 73 79 6d 62 6f 6c 20 77 parent symbol w 16e0: 68 6f 73 65 20 70 61 72 65 6e 74 0a 09 23 20 68 hose parent..# h 16f0: 61 73 20 74 68 65 6d 20 61 73 20 70 72 69 6d 61 as them as prima 1700: 72 79 20 63 68 69 6c 64 2e 0a 09 43 68 65 63 6b ry child...Check 1710: 52 65 76 20 5c 0a 09 20 20 20 20 7b 42 72 61 6e Rev \.. {Bran 1720: 63 68 20 73 74 61 72 74 69 6e 67 20 72 65 76 69 ch starting revi 1730: 73 69 6f 6e 73 20 6d 75 73 74 20 6e 6f 74 20 62 sions must not b 1740: 65 20 70 72 69 6d 61 72 79 20 63 68 69 6c 64 72 e primary childr 1750: 65 6e 20 6f 66 20 74 68 65 69 72 20 70 61 72 65 en of their pare 1760: 6e 74 73 7d 20 5c 0a 09 20 20 20 20 7b 61 74 20 nts} \.. {at 1770: 74 68 65 20 62 65 67 69 6e 6e 69 6e 67 20 6f 66 the beginning of 1780: 20 69 74 73 20 62 72 61 6e 63 68 20 69 73 20 74 its branch is t 1790: 68 65 20 70 72 69 6d 61 72 79 20 63 68 69 6c 64 he primary child 17a0: 20 6f 66 20 69 74 73 20 70 61 72 65 6e 74 7d 20 of its parent} 17b0: 7b 0a 09 09 53 45 4c 45 43 54 20 46 2e 6e 61 6d {...SELECT F.nam 17c0: 65 2c 20 52 2e 72 65 76 0a 09 09 46 52 4f 4d 20 e, R.rev...FROM 17d0: 72 65 76 69 73 69 6f 6e 20 52 2c 20 72 65 76 69 revision R, revi 17e0: 73 69 6f 6e 20 50 2c 20 66 69 6c 65 20 46 0a 09 sion P, file F.. 17f0: 09 57 48 45 52 45 20 52 2e 66 69 64 20 3d 20 46 .WHERE R.fid = F 1800: 2e 66 69 64 0a 09 09 41 4e 44 20 20 20 52 2e 62 .fid...AND R.b 1810: 70 61 72 65 6e 74 20 49 53 20 4e 4f 54 20 4e 55 parent IS NOT NU 1820: 4c 4c 0a 09 09 41 4e 44 20 20 20 52 2e 70 61 72 LL...AND R.par 1830: 65 6e 74 20 49 53 20 4e 4f 54 20 4e 55 4c 4c 0a ent IS NOT NULL. 1840: 09 09 41 4e 44 20 20 20 52 2e 70 61 72 65 6e 74 ..AND R.parent 1850: 20 3d 20 50 2e 72 69 64 0a 09 09 41 4e 44 20 20 = P.rid...AND 1860: 20 50 2e 63 68 69 6c 64 20 3d 20 52 2e 72 69 64 P.child = R.rid 1870: 0a 09 09 3b 0a 09 20 20 20 20 7d 0a 09 23 20 46 ...;.. }..# F 1880: 69 6e 64 20 61 6c 6c 20 72 65 76 69 73 69 6f 6e ind all revision 1890: 73 20 77 69 74 68 20 61 20 6e 6f 6e 2d 4e 54 44 s with a non-NTD 18a0: 42 20 63 68 69 6c 64 20 77 68 69 63 68 20 61 72 B child which ar 18b0: 65 20 6e 6f 74 20 6f 6e 0a 09 23 20 74 68 65 20 e not on..# the 18c0: 4e 54 44 42 2e 0a 09 43 68 65 63 6b 52 65 76 20 NTDB...CheckRev 18d0: 5c 0a 09 20 20 20 20 7b 4e 54 44 42 20 74 6f 20 \.. {NTDB to 18e0: 74 72 75 6e 6b 20 74 72 61 6e 73 69 74 69 6f 6e trunk transition 18f0: 20 68 61 73 20 74 6f 20 62 65 67 69 6e 20 6f 6e has to begin on 1900: 20 4e 54 44 42 7d 20 5c 0a 09 20 20 20 20 7b 68 NTDB} \.. {h 1910: 61 73 20 61 20 6e 6f 6e 2d 4e 54 44 42 20 63 68 as a non-NTDB ch 1920: 69 6c 64 2c 20 79 65 74 20 69 73 20 6e 6f 74 20 ild, yet is not 1930: 6f 6e 20 74 68 65 20 4e 54 44 42 7d 20 7b 0a 09 on the NTDB} {.. 1940: 09 53 45 4c 45 43 54 20 46 2e 6e 61 6d 65 2c 20 .SELECT F.name, 1950: 52 2e 72 65 76 0a 09 09 46 52 4f 4d 20 72 65 76 R.rev...FROM rev 1960: 69 73 69 6f 6e 20 52 2c 20 66 69 6c 65 20 46 0a ision R, file F. 1970: 09 09 57 48 45 52 45 20 52 2e 66 69 64 20 3d 20 ..WHERE R.fid = 1980: 46 2e 66 69 64 0a 09 09 41 4e 44 20 20 20 52 2e F.fid...AND R. 1990: 64 62 63 68 69 6c 64 20 49 53 20 4e 4f 54 20 4e dbchild IS NOT N 19a0: 55 4c 4c 0a 09 09 41 4e 44 20 20 20 4e 4f 54 20 ULL...AND NOT 19b0: 52 2e 69 73 64 65 66 61 75 6c 74 0a 09 09 3b 0a R.isdefault...;. 19c0: 09 20 20 20 20 7d 0a 09 23 20 46 69 6e 64 20 61 . }..# Find a 19d0: 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 77 69 74 ll revisions wit 19e0: 68 20 61 20 4e 54 44 42 20 70 61 72 65 6e 74 20 h a NTDB parent 19f0: 77 68 69 63 68 20 61 72 65 20 6f 6e 20 74 68 65 which are on the 1a00: 20 4e 54 44 42 2e 0a 09 43 68 65 63 6b 52 65 76 NTDB...CheckRev 1a10: 20 5c 0a 09 20 20 20 20 7b 4e 54 44 42 20 74 6f \.. {NTDB to 1a20: 20 74 72 75 6e 6b 20 74 72 61 6e 73 69 74 69 6f trunk transitio 1a30: 6e 20 68 61 73 20 74 6f 20 65 6e 64 20 6f 6e 20 n has to end on 1a40: 6e 6f 6e 2d 4e 54 44 42 7d 20 5c 0a 09 20 20 20 non-NTDB} \.. 1a50: 20 7b 68 61 73 20 61 20 4e 54 44 42 20 70 61 72 {has a NTDB par 1a60: 65 6e 74 2c 20 79 65 74 20 69 73 20 6f 6e 20 74 ent, yet is on t 1a70: 68 65 20 4e 54 44 42 7d 20 7b 0a 09 09 53 45 4c he NTDB} {...SEL 1a80: 45 43 54 20 46 2e 6e 61 6d 65 2c 20 52 2e 72 65 ECT F.name, R.re 1a90: 76 0a 09 09 46 52 4f 4d 20 72 65 76 69 73 69 6f v...FROM revisio 1aa0: 6e 20 52 2c 20 66 69 6c 65 20 46 0a 09 09 57 48 n R, file F...WH 1ab0: 45 52 45 20 52 2e 66 69 64 20 3d 20 46 2e 66 69 ERE R.fid = F.fi 1ac0: 64 0a 09 09 41 4e 44 20 20 20 52 2e 64 62 70 61 d...AND R.dbpa 1ad0: 72 65 6e 74 20 49 53 20 4e 4f 54 20 4e 55 4c 4c rent IS NOT NULL 1ae0: 0a 09 09 41 4e 44 20 20 20 52 2e 69 73 64 65 66 ...AND R.isdef 1af0: 61 75 6c 74 0a 09 09 3b 0a 09 20 20 20 20 7d 0a ault...;.. }. 1b00: 09 23 20 46 69 6e 64 20 61 6c 6c 20 72 65 76 69 .# Find all revi 1b10: 73 69 6f 6e 73 20 77 69 74 68 20 61 20 63 68 69 sions with a chi 1b20: 6c 64 20 77 68 69 63 68 20 64 69 73 61 67 72 65 ld which disagre 1b30: 65 73 20 61 62 6f 75 74 20 74 68 65 0a 09 23 20 es about the..# 1b40: 6c 69 6e 65 20 6f 66 20 64 65 76 65 6c 6f 70 6d line of developm 1b50: 65 6e 74 20 74 68 65 79 20 62 65 6c 6f 6e 67 20 ent they belong 1b60: 74 6f 2e 0a 09 43 68 65 63 6b 52 65 76 20 5c 0a to...CheckRev \. 1b70: 09 20 20 20 20 7b 52 65 76 69 73 69 6f 6e 73 20 . {Revisions 1b80: 61 6e 64 20 74 68 65 69 72 20 70 72 69 6d 61 72 and their primar 1b90: 79 20 63 68 69 6c 64 72 65 6e 20 68 61 76 65 20 y children have 1ba0: 74 6f 20 62 65 20 69 6e 20 74 68 65 20 73 61 6d to be in the sam 1bb0: 65 20 4c 4f 44 7d 20 5c 0a 09 20 20 20 20 7b 61 e LOD} \.. {a 1bc0: 6e 64 20 69 74 73 20 70 72 69 6d 61 72 79 20 63 nd its primary c 1bd0: 68 69 6c 64 20 64 69 73 61 67 72 65 65 20 61 62 hild disagree ab 1be0: 6f 75 74 20 74 68 65 69 72 20 4c 4f 44 7d 20 7b out their LOD} { 1bf0: 0a 09 09 53 45 4c 45 43 54 20 46 2e 6e 61 6d 65 ...SELECT F.name 1c00: 2c 20 52 2e 72 65 76 0a 09 09 46 52 4f 4d 20 72 , R.rev...FROM r 1c10: 65 76 69 73 69 6f 6e 20 52 2c 20 72 65 76 69 73 evision R, revis 1c20: 69 6f 6e 20 43 2c 20 66 69 6c 65 20 46 0a 09 09 ion C, file F... 1c30: 57 48 45 52 45 20 52 2e 66 69 64 20 3d 20 46 2e WHERE R.fid = F. 1c40: 66 69 64 0a 09 09 41 4e 44 20 20 20 52 2e 63 68 fid...AND R.ch 1c50: 69 6c 64 20 49 53 20 4e 4f 54 20 4e 55 4c 4c 0a ild IS NOT NULL. 1c60: 09 09 41 4e 44 20 20 20 52 2e 63 68 69 6c 64 20 ..AND R.child 1c70: 3d 20 43 2e 72 69 64 0a 09 09 41 4e 44 20 20 20 = C.rid...AND 1c80: 43 2e 6c 6f 64 20 21 3d 20 52 2e 6c 6f 64 0a 09 C.lod != R.lod.. 1c90: 09 3b 0a 09 20 20 20 20 7d 0a 09 23 20 46 69 6e .;.. }..# Fin 1ca0: 64 20 61 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 d all revisions 1cb0: 77 69 74 68 20 61 20 6e 6f 6e 2d 4e 54 44 42 20 with a non-NTDB 1cc0: 63 68 69 6c 64 20 77 68 69 63 68 20 61 67 72 65 child which agre 1cd0: 65 73 20 61 62 6f 75 74 0a 09 23 20 74 68 65 20 es about..# the 1ce0: 6c 69 6e 65 20 6f 66 20 64 65 76 65 6c 6f 70 6d line of developm 1cf0: 65 6e 74 20 74 68 65 79 20 62 65 6c 6f 6e 67 20 ent they belong 1d00: 74 6f 2e 0a 09 43 68 65 63 6b 52 65 76 20 5c 0a to...CheckRev \. 1d10: 09 20 20 20 20 7b 4e 54 44 42 20 61 6e 64 20 74 . {NTDB and t 1d20: 72 75 6e 6b 20 72 65 76 69 73 69 6f 6e 73 20 68 runk revisions h 1d30: 61 76 65 20 74 6f 20 62 65 20 69 6e 20 64 69 66 ave to be in dif 1d40: 66 65 72 65 6e 74 20 4c 4f 44 73 7d 20 5c 0a 09 ferent LODs} \.. 1d50: 20 20 20 20 7b 6f 6e 20 4e 54 44 42 20 61 6e 64 {on NTDB and 1d60: 20 69 74 73 20 6e 6f 6e 2d 4e 54 44 42 20 63 68 its non-NTDB ch 1d70: 69 6c 64 20 77 72 6f 6e 67 6c 79 20 61 67 72 65 ild wrongly agre 1d80: 65 20 61 62 6f 75 74 20 74 68 65 69 72 20 4c 4f e about their LO 1d90: 44 7d 20 7b 0a 09 09 53 45 4c 45 43 54 20 46 2e D} {...SELECT F. 1da0: 6e 61 6d 65 2c 20 52 2e 72 65 76 0a 09 09 46 52 name, R.rev...FR 1db0: 4f 4d 20 72 65 76 69 73 69 6f 6e 20 52 2c 20 72 OM revision R, r 1dc0: 65 76 69 73 69 6f 6e 20 43 2c 20 66 69 6c 65 20 evision C, file 1dd0: 46 0a 09 09 57 48 45 52 45 20 52 2e 66 69 64 20 F...WHERE R.fid 1de0: 3d 20 46 2e 66 69 64 0a 09 09 41 4e 44 20 20 20 = F.fid...AND 1df0: 52 2e 64 62 63 68 69 6c 64 20 49 53 20 4e 4f 54 R.dbchild IS NOT 1e00: 20 4e 55 4c 4c 0a 09 09 41 4e 44 20 20 20 52 2e NULL...AND R. 1e10: 64 62 63 68 69 6c 64 20 3d 20 43 2e 72 69 64 0a dbchild = C.rid. 1e20: 09 09 41 4e 44 20 20 20 43 2e 6c 6f 64 20 3d 20 ..AND C.lod = 1e30: 52 2e 6c 6f 64 0a 09 09 3b 0a 09 20 20 20 20 7d R.lod...;.. } 1e40: 0a 09 23 20 46 69 6e 64 20 61 6c 6c 20 72 65 76 ..# Find all rev 1e50: 69 73 69 6f 6e 73 20 77 69 74 68 20 61 20 62 72 isions with a br 1e60: 61 6e 63 68 20 70 61 72 65 6e 74 20 73 79 6d 62 anch parent symb 1e70: 6f 6c 20 77 68 69 63 68 20 69 73 20 6e 6f 74 0a ol which is not. 1e80: 09 23 20 74 68 65 69 72 20 4c 4f 44 2e 0a 09 43 .# their LOD...C 1e90: 68 65 63 6b 52 65 76 20 5c 0a 09 20 20 20 20 7b heckRev \.. { 1ea0: 42 72 61 6e 63 68 20 73 74 61 72 74 69 6e 67 20 Branch starting 1eb0: 72 65 76 69 73 69 6f 6e 73 20 68 61 76 65 20 74 revisions have t 1ec0: 6f 20 68 61 76 65 20 74 68 65 69 72 20 4c 4f 44 o have their LOD 1ed0: 20 61 73 20 62 72 61 6e 63 68 20 70 61 72 65 6e as branch paren 1ee0: 74 20 73 79 6d 62 6f 6c 7d 20 5c 0a 09 20 20 20 t symbol} \.. 1ef0: 20 7b 61 74 20 74 68 65 20 62 65 67 69 6e 6e 69 {at the beginni 1f00: 6e 67 20 6f 66 20 69 74 73 20 62 72 61 6e 63 68 ng of its branch 1f10: 20 64 6f 65 73 20 6e 6f 74 20 68 61 76 65 20 74 does not have t 1f20: 68 65 20 62 72 61 6e 63 68 20 73 79 6d 62 6f 6c he branch symbol 1f30: 20 61 73 20 69 74 73 20 4c 4f 44 7d 20 7b 0a 09 as its LOD} {.. 1f40: 09 53 45 4c 45 43 54 20 46 2e 6e 61 6d 65 2c 20 .SELECT F.name, 1f50: 52 2e 72 65 76 0a 09 09 46 52 4f 4d 20 72 65 76 R.rev...FROM rev 1f60: 69 73 69 6f 6e 20 52 2c 20 66 69 6c 65 20 46 0a ision R, file F. 1f70: 09 09 57 48 45 52 45 20 52 2e 66 69 64 20 3d 20 ..WHERE R.fid = 1f80: 46 2e 66 69 64 0a 09 09 41 4e 44 20 20 20 52 2e F.fid...AND R. 1f90: 62 70 61 72 65 6e 74 20 49 53 20 4e 4f 54 20 4e bparent IS NOT N 1fa0: 55 4c 4c 0a 09 09 41 4e 44 20 20 20 52 2e 6c 6f ULL...AND R.lo 1fb0: 64 20 21 3d 20 52 2e 62 70 61 72 65 6e 74 0a 09 d != R.bparent.. 1fc0: 09 3b 0a 09 20 20 20 20 7d 0a 09 23 20 46 69 6e .;.. }..# Fin 1fd0: 64 20 61 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 d all revisions 1fe0: 77 69 74 68 20 61 20 62 72 61 6e 63 68 20 70 61 with a branch pa 1ff0: 72 65 6e 74 20 73 79 6d 62 6f 6c 20 77 68 6f 73 rent symbol whos 2000: 65 20 70 61 72 65 6e 74 0a 09 23 20 69 73 20 69 e parent..# is i 2010: 6e 20 74 68 65 20 73 61 6d 65 20 6c 69 6e 65 20 n the same line 2020: 6f 66 20 64 65 76 65 6c 6f 70 6d 65 6e 74 2e 0a of development.. 2030: 09 43 68 65 63 6b 52 65 76 20 5c 0a 09 20 20 20 .CheckRev \.. 2040: 20 7b 52 65 76 69 73 69 6f 6e 73 20 61 6e 64 20 {Revisions and 2050: 74 68 65 69 72 20 62 72 61 6e 63 68 20 63 68 69 their branch chi 2060: 6c 64 72 65 6e 20 68 61 76 65 20 74 6f 20 62 65 ldren have to be 2070: 20 69 6e 20 64 69 66 66 65 72 65 6e 74 20 4c 4f in different LO 2080: 44 73 7d 20 5c 0a 09 20 20 20 20 7b 61 74 20 74 Ds} \.. {at t 2090: 68 65 20 62 65 67 69 6e 6e 69 6e 67 20 6f 66 20 he beginning of 20a0: 69 74 73 20 62 72 61 6e 63 68 20 61 6e 64 20 69 its branch and i 20b0: 74 73 20 70 61 72 65 6e 74 20 77 72 6f 6e 67 6c ts parent wrongl 20c0: 79 20 61 67 72 65 65 20 61 62 6f 75 74 20 74 68 y agree about th 20d0: 65 69 72 20 4c 4f 44 7d 20 7b 0a 09 09 53 45 4c eir LOD} {...SEL 20e0: 45 43 54 20 46 2e 6e 61 6d 65 2c 20 52 2e 72 65 ECT F.name, R.re 20f0: 76 0a 09 09 46 52 4f 4d 20 72 65 76 69 73 69 6f v...FROM revisio 2100: 6e 20 52 2c 20 72 65 76 69 73 69 6f 6e 20 50 2c n R, revision P, 2110: 20 66 69 6c 65 20 46 0a 09 09 57 48 45 52 45 20 file F...WHERE 2120: 52 2e 66 69 64 20 3d 20 46 2e 66 69 64 0a 09 09 R.fid = F.fid... 2130: 41 4e 44 20 20 20 52 2e 62 70 61 72 65 6e 74 20 AND R.bparent 2140: 49 53 20 4e 4f 54 20 4e 55 4c 4c 0a 09 09 41 4e IS NOT NULL...AN 2150: 44 20 20 20 52 2e 70 61 72 65 6e 74 20 3d 20 50 D R.parent = P 2160: 2e 72 69 64 0a 09 09 41 4e 44 20 20 20 52 2e 6c .rid...AND R.l 2170: 6f 64 20 3d 20 50 2e 6c 6f 64 0a 09 09 3b 0a 09 od = P.lod...;.. 2180: 20 20 20 20 7d 0a 09 72 65 74 75 72 6e 0a 20 20 }..return. 2190: 20 20 7d 0a 0a 20 20 20 20 70 72 6f 63 20 4d 65 }.. proc Me 21a0: 74 61 20 7b 7d 20 7b 0a 09 23 20 54 68 69 73 20 ta {} {..# This 21b0: 63 6f 64 65 20 70 65 72 66 6f 72 6d 73 20 61 20 code performs a 21c0: 6e 75 6d 62 65 72 20 6f 66 20 70 61 72 61 6e 6f number of parano 21d0: 69 64 20 63 68 65 63 6b 73 20 6f 66 20 74 68 65 id checks of the 21e0: 0a 09 23 20 64 61 74 61 62 61 73 65 2c 20 73 65 ..# database, se 21f0: 61 72 63 68 69 6e 67 20 66 6f 72 20 69 6e 63 6f arching for inco 2200: 6e 73 69 73 74 65 6e 74 20 63 72 6f 73 73 2d 72 nsistent cross-r 2210: 65 66 65 72 65 6e 63 65 73 2e 0a 0a 09 75 70 76 eferences....upv 2220: 61 72 20 31 20 6e 20 6e 20 3b 20 23 20 43 6f 75 ar 1 n n ; # Cou 2230: 6e 74 65 72 20 66 6f 72 20 74 68 65 20 63 68 65 nter for the che 2240: 63 6b 73 20 28 77 65 20 70 72 69 6e 74 20 61 6e cks (we print an 2250: 20 69 64 20 62 65 66 6f 72 65 0a 09 09 20 20 20 id before... 2260: 20 20 20 23 20 74 68 65 20 6d 61 69 6e 20 6c 61 # the main la 2270: 62 65 6c 29 2e 0a 0a 09 23 20 46 69 6e 64 20 61 bel)....# Find a 2280: 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 77 68 69 ll revisions whi 2290: 63 68 20 64 69 73 67 72 65 65 20 77 69 74 68 20 ch disgree with 22a0: 74 68 65 69 72 20 6d 65 74 61 20 64 61 74 61 20 their meta data 22b0: 61 62 6f 75 74 0a 09 23 20 74 68 65 20 62 72 61 about..# the bra 22c0: 6e 63 68 2f 6c 69 6e 65 20 6f 66 20 64 65 76 65 nch/line of deve 22d0: 6c 6f 70 6d 65 6e 74 20 74 68 65 79 20 62 65 6c lopment they bel 22e0: 6f 6e 67 20 74 6f 2e 0a 09 43 68 65 63 6b 52 65 ong to...CheckRe 22f0: 76 20 5c 0a 09 20 20 20 20 7b 52 65 76 69 73 69 v \.. {Revisi 2300: 6f 6e 73 20 61 6e 64 20 74 68 65 69 72 20 6d 65 ons and their me 2310: 74 61 20 64 61 74 61 20 68 61 76 65 20 74 6f 20 ta data have to 2320: 62 65 20 69 6e 20 74 68 65 20 73 61 6d 65 20 4c be in the same L 2330: 4f 44 7d 20 5c 0a 09 20 20 20 20 7b 64 69 73 61 OD} \.. {disa 2340: 67 72 65 65 73 20 77 69 74 68 20 69 74 73 20 6d grees with its m 2350: 65 74 61 20 64 61 74 61 20 61 62 6f 75 74 20 6f eta data about o 2360: 77 6e 69 6e 67 20 4c 4f 44 7d 20 7b 0a 09 09 53 wning LOD} {...S 2370: 45 4c 45 43 54 20 46 2e 6e 61 6d 65 2c 20 52 2e ELECT F.name, R. 2380: 72 65 76 0a 09 09 46 52 4f 4d 20 72 65 76 69 73 rev...FROM revis 2390: 69 6f 6e 20 52 2c 20 6d 65 74 61 20 4d 2c 20 66 ion R, meta M, f 23a0: 69 6c 65 20 46 0a 09 09 57 48 45 52 45 20 52 2e ile F...WHERE R. 23b0: 6d 69 64 20 3d 20 4d 2e 6d 69 64 0a 09 09 41 4e mid = M.mid...AN 23c0: 44 20 20 20 52 2e 6c 6f 64 20 21 3d 20 4d 2e 62 D R.lod != M.b 23d0: 69 64 0a 09 09 41 4e 44 20 20 20 52 2e 66 69 64 id...AND R.fid 23e0: 20 3d 20 46 2e 66 69 64 0a 09 09 3b 0a 09 20 20 = F.fid...;.. 23f0: 20 20 7d 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 }..return. 2400: 7d 0a 0a 20 20 20 20 70 72 6f 63 20 52 65 76 69 }.. proc Revi 2410: 73 69 6f 6e 43 68 61 6e 67 65 73 65 74 73 20 7b sionChangesets { 2420: 7d 20 7b 0a 09 23 20 54 68 69 73 20 63 6f 64 65 } {..# This code 2430: 20 70 65 72 66 6f 72 6d 73 20 61 20 6e 75 6d 62 performs a numb 2440: 65 72 20 6f 66 20 70 61 72 61 6e 6f 69 64 20 63 er of paranoid c 2450: 68 65 63 6b 73 20 6f 66 20 74 68 65 0a 09 23 20 hecks of the..# 2460: 64 61 74 61 62 61 73 65 2c 20 73 65 61 72 63 68 database, search 2470: 69 6e 67 20 66 6f 72 20 69 6e 63 6f 6e 73 69 73 ing for inconsis 2480: 74 65 6e 74 20 63 68 61 6e 67 65 73 65 74 2f 72 tent changeset/r 2490: 65 76 69 73 69 6f 6e 0a 09 23 20 69 6e 66 6f 72 evision..# infor 24a0: 6d 61 74 69 6f 6e 2e 0a 0a 09 75 70 76 61 72 20 mation....upvar 24b0: 31 20 6e 20 6e 20 3b 20 23 20 43 6f 75 6e 74 65 1 n n ; # Counte 24c0: 72 20 66 6f 72 20 74 68 65 20 63 68 65 63 6b 73 r for the checks 24d0: 20 28 77 65 20 70 72 69 6e 74 20 61 6e 20 69 64 (we print an id 24e0: 20 62 65 66 6f 72 65 0a 09 09 20 20 20 20 20 20 before... 24f0: 23 20 74 68 65 20 6d 61 69 6e 20 6c 61 62 65 6c # the main label 2500: 29 2e 0a 0a 09 23 20 46 69 6e 64 20 61 6c 6c 20 )....# Find all 2510: 72 65 76 69 73 69 6f 6e 73 20 77 68 69 63 68 20 revisions which 2520: 61 72 65 20 6e 6f 74 20 75 73 65 64 20 62 79 20 are not used by 2530: 61 74 20 6c 65 61 73 74 20 6f 6e 65 0a 09 23 20 at least one..# 2540: 63 68 61 6e 67 65 73 65 74 2e 0a 09 43 68 65 63 changeset...Chec 2550: 6b 52 65 76 20 5c 0a 09 20 20 20 20 7b 41 6c 6c kRev \.. {All 2560: 20 72 65 76 69 73 69 6f 6e 73 20 68 61 76 65 20 revisions have 2570: 74 6f 20 62 65 20 75 73 65 64 20 62 79 20 6c 65 to be used by le 2580: 61 73 74 20 6f 6e 65 20 63 68 61 6e 67 65 73 65 ast one changese 2590: 74 7d 20 5c 0a 09 20 20 20 20 7b 69 73 20 6e 6f t} \.. {is no 25a0: 74 20 75 73 65 64 20 62 79 20 61 20 63 68 61 6e t used by a chan 25b0: 67 65 73 65 74 7d 20 7b 0a 09 09 2d 2d 20 55 6e geset} {...-- Un 25c0: 75 73 65 64 20 72 65 76 69 73 69 6f 6e 73 20 3d used revisions = 25d0: 20 41 6c 6c 20 72 65 76 69 73 69 6f 6e 73 0a 09 All revisions.. 25e0: 09 2d 2d 20 20 20 20 20 20 20 20 20 20 20 20 20 .-- 25f0: 20 20 20 20 20 2d 20 72 65 76 69 73 69 6f 6e 73 - revisions 2600: 20 75 73 65 64 20 62 79 20 72 65 76 69 73 69 6f used by revisio 2610: 6e 20 63 68 61 6e 67 65 73 65 74 73 2e 0a 09 09 n changesets.... 2620: 2d 2d 0a 09 09 2d 2d 20 42 6f 74 68 20 73 65 74 --...-- Both set 2630: 73 20 63 61 6e 20 62 65 20 63 6f 6d 70 75 74 65 s can be compute 2640: 64 20 65 61 73 69 6c 79 2c 20 61 6e 64 20 73 75 d easily, and su 2650: 62 74 72 61 63 74 65 64 0a 20 20 20 20 20 20 20 btracted. 2660: 20 20 20 20 20 20 20 20 20 2d 2d 20 66 72 6f 6d -- from 2670: 20 65 61 63 68 20 6f 74 68 65 72 2e 20 54 68 65 each other. The 2680: 6e 20 77 65 20 63 61 6e 20 67 65 74 20 74 68 65 n we can get the 2690: 20 61 73 73 6f 63 69 61 74 65 64 0a 20 20 20 20 associated. 26a0: 20 20 20 20 20 20 20 20 20 20 20 20 2d 2d 20 66 -- f 26b0: 69 6c 65 20 28 6e 61 6d 65 29 20 66 6f 72 20 64 ile (name) for d 26c0: 69 73 70 6c 61 79 2e 0a 0a 09 09 53 45 4c 45 43 isplay.....SELEC 26d0: 54 20 46 2e 6e 61 6d 65 2c 20 52 2e 72 65 76 0a T F.name, R.rev. 26e0: 09 09 46 52 4f 4d 20 72 65 76 69 73 69 6f 6e 20 ..FROM revision 26f0: 52 2c 20 66 69 6c 65 20 46 0a 09 09 57 48 45 52 R, file F...WHER 2700: 45 20 52 2e 72 69 64 20 49 4e 20 28 53 45 4c 45 E R.rid IN (SELE 2710: 43 54 20 72 69 64 0a 09 09 09 09 46 52 4f 4d 20 CT rid.....FROM 2720: 72 65 76 69 73 69 6f 6e 20 20 20 20 20 20 20 20 revision 2730: 20 20 20 20 20 20 20 20 2d 2d 20 41 6c 6c 20 72 -- All r 2740: 65 76 69 73 69 6f 6e 73 0a 09 09 09 09 45 58 43 evisions.....EXC 2750: 45 50 54 20 20 20 20 20 20 20 20 20 20 20 20 20 EPT 2760: 20 20 20 20 20 20 20 20 20 20 2d 2d 20 73 75 62 -- sub 2770: 74 72 61 63 74 0a 09 09 09 09 53 45 4c 45 43 54 tract.....SELECT 2780: 20 43 49 2e 69 69 64 0a 09 09 09 09 46 52 4f 4d CI.iid.....FROM 2790: 20 63 73 69 74 65 6d 20 43 49 2c 20 63 68 61 6e csitem CI, chan 27a0: 67 65 73 65 74 20 43 20 20 2d 2d 20 72 65 76 69 geset C -- revi 27b0: 73 69 6f 6e 73 20 75 73 65 64 0a 09 09 09 09 57 sions used.....W 27c0: 48 45 52 45 20 43 2e 63 69 64 20 3d 20 43 49 2e HERE C.cid = CI. 27d0: 63 69 64 20 20 20 20 20 20 20 20 20 2d 2d 20 62 cid -- b 27e0: 79 20 61 6e 79 20 72 65 76 69 73 69 6f 6e 0a 09 y any revision.. 27f0: 09 09 09 41 4e 44 20 43 2e 74 79 70 65 20 3d 20 ...AND C.type = 2800: 30 29 20 20 20 20 20 20 20 20 20 20 20 20 20 20 0) 2810: 2d 2d 20 63 68 61 6e 67 65 73 65 74 0a 09 09 41 -- changeset...A 2820: 4e 44 20 20 20 52 2e 66 69 64 20 3d 20 46 2e 66 ND R.fid = F.f 2830: 69 64 20 20 20 20 20 20 20 20 20 20 20 20 20 20 id 2840: 2d 2d 20 67 65 74 20 66 69 6c 65 20 6f 66 20 75 -- get file of u 2850: 6e 75 73 65 64 20 72 65 76 69 73 69 6f 6e 0a 09 nused revision.. 2860: 20 20 20 20 7d 0a 09 23 20 46 69 6e 64 20 61 6c }..# Find al 2870: 6c 20 72 65 76 69 73 69 6f 6e 73 20 77 68 69 63 l revisions whic 2880: 68 20 61 72 65 20 75 73 65 64 20 62 79 20 6d 6f h are used by mo 2890: 72 65 20 74 68 61 6e 20 6f 6e 65 0a 09 23 20 63 re than one..# c 28a0: 68 61 6e 67 65 73 65 74 2e 0a 09 43 68 65 63 6b hangeset...Check 28b0: 52 65 76 20 5c 0a 09 20 20 20 20 7b 41 6c 6c 20 Rev \.. {All 28c0: 72 65 76 69 73 69 6f 6e 73 20 68 61 76 65 20 74 revisions have t 28d0: 6f 20 62 65 20 75 73 65 64 20 62 79 20 61 74 20 o be used by at 28e0: 6d 6f 73 74 20 6f 6e 65 20 63 68 61 6e 67 65 73 most one changes 28f0: 65 74 7d 20 5c 0a 09 20 20 20 20 7b 69 73 20 75 et} \.. {is u 2900: 73 65 64 20 62 79 20 6d 75 6c 74 69 70 6c 65 20 sed by multiple 2910: 63 68 61 6e 67 65 73 65 74 73 7d 20 7b 0a 09 09 changesets} {... 2920: 2d 2d 20 50 72 69 6e 63 69 70 6c 65 20 6f 66 20 -- Principle of 2930: 6f 70 65 72 61 74 69 6f 6e 3a 20 47 65 74 20 61 operation: Get a 2940: 6c 6c 20 72 65 76 69 73 69 6f 6e 2f 63 68 61 6e ll revision/chan 2950: 67 65 73 65 74 0a 20 20 20 20 20 20 20 20 20 20 geset. 2960: 20 20 20 20 20 20 2d 2d 20 70 61 69 72 73 20 66 -- pairs f 2970: 6f 72 20 61 6c 6c 20 72 65 76 69 73 69 6f 6e 20 or all revision 2980: 63 68 61 6e 67 65 73 65 74 73 2c 20 67 72 6f 75 changesets, grou 2990: 70 20 62 79 0a 20 20 20 20 20 20 20 20 20 20 20 p by. 29a0: 20 20 20 20 20 2d 2d 20 72 65 76 69 73 69 6f 6e -- revision 29b0: 20 74 6f 20 61 67 67 72 65 67 61 74 65 20 74 68 to aggregate th 29c0: 65 20 63 68 61 6e 67 65 73 65 74 2c 20 63 6f 75 e changeset, cou 29d0: 6e 74 69 6e 67 0a 20 20 20 20 20 20 20 20 20 20 nting. 29e0: 20 20 20 20 20 20 2d 2d 20 74 68 65 6d 2e 20 46 -- them. F 29f0: 72 6f 6d 20 74 68 65 20 72 65 73 75 6c 74 69 6e rom the resultin 2a00: 67 20 72 65 76 69 73 69 6f 6e 2f 63 6f 75 6e 74 g revision/count 2a10: 20 74 61 62 6c 65 0a 20 20 20 20 20 20 20 20 20 table. 2a20: 20 20 20 20 20 20 20 2d 2d 20 73 65 6c 65 63 74 -- select 2a30: 20 74 68 6f 73 65 20 77 69 74 68 20 6d 6f 72 65 those with more 2a40: 20 74 68 61 6e 20 6f 6e 65 20 75 73 65 72 2c 20 than one user, 2a50: 61 6e 64 20 67 65 74 20 74 68 65 69 72 0a 20 20 and get their. 2a60: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2d 2d -- 2a70: 20 61 73 73 6f 63 69 61 74 65 64 20 66 69 6c 65 associated file 2a80: 20 28 6e 61 6d 65 29 20 66 6f 72 20 64 69 73 70 (name) for disp 2a90: 6c 61 79 2e 0a 0a 09 09 53 45 4c 45 43 54 20 46 lay.....SELECT F 2aa0: 2e 6e 61 6d 65 2c 20 52 2e 72 65 76 0a 09 09 46 .name, R.rev...F 2ab0: 52 4f 4d 20 72 65 76 69 73 69 6f 6e 20 52 2c 20 ROM revision R, 2ac0: 66 69 6c 65 20 46 2c 0a 09 09 20 20 20 20 20 28 file F,... ( 2ad0: 53 45 4c 45 43 54 20 43 49 2e 69 69 64 20 41 53 SELECT CI.iid AS 2ae0: 20 72 69 64 2c 20 63 6f 75 6e 74 28 43 49 2e 63 rid, count(CI.c 2af0: 69 64 29 20 41 53 20 63 6f 75 6e 74 0a 09 09 20 id) AS count... 2b00: 20 20 20 20 20 46 52 4f 4d 20 63 73 69 74 65 6d FROM csitem 2b10: 20 43 49 2c 20 63 68 61 6e 67 65 73 65 74 20 43 CI, changeset C 2b20: 0a 09 09 20 20 20 20 20 20 57 48 45 52 45 20 43 ... WHERE C 2b30: 2e 74 79 70 65 20 3d 20 30 0a 09 09 20 20 20 20 .type = 0... 2b40: 20 20 41 4e 44 20 20 20 43 2e 63 69 64 20 3d 20 AND C.cid = 2b50: 43 49 2e 63 69 64 0a 09 09 20 20 20 20 20 20 47 CI.cid... G 2b60: 52 4f 55 50 20 42 59 20 43 49 2e 69 69 64 29 20 ROUP BY CI.iid) 2b70: 41 53 20 55 0a 09 09 57 48 45 52 45 20 55 2e 63 AS U...WHERE U.c 2b80: 6f 75 6e 74 20 3e 20 31 0a 09 09 41 4e 44 20 52 ount > 1...AND R 2b90: 2e 72 69 64 20 3d 20 55 2e 72 69 64 0a 09 09 41 .rid = U.rid...A 2ba0: 4e 44 20 52 2e 66 69 64 20 3d 20 46 2e 66 69 64 ND R.fid = F.fid 2bb0: 0a 09 20 20 20 20 7d 0a 09 23 20 41 6c 6c 20 72 .. }..# All r 2bc0: 65 76 69 73 69 6f 6e 73 20 68 61 76 65 20 74 6f evisions have to 2bd0: 20 72 65 66 65 72 20 74 6f 20 74 68 65 20 73 61 refer to the sa 2be0: 6d 65 20 6d 65 74 61 20 69 6e 66 6f 72 6d 61 74 me meta informat 2bf0: 69 6f 6e 20 61 73 0a 09 23 20 74 68 65 69 72 20 ion as..# their 2c00: 63 68 61 6e 67 65 73 65 74 2e 0a 09 43 68 65 63 changeset...Chec 2c10: 6b 52 65 76 43 53 20 5c 0a 09 20 20 20 20 7b 41 kRevCS \.. {A 2c20: 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 68 61 76 ll revisions hav 2c30: 65 20 74 6f 20 61 67 72 65 65 20 77 69 74 68 20 e to agree with 2c40: 74 68 65 69 72 20 63 68 61 6e 67 65 73 65 74 20 their changeset 2c50: 61 62 6f 75 74 20 74 68 65 20 75 73 65 64 20 6d about the used m 2c60: 65 74 61 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 7d eta information} 2c70: 20 5c 0a 09 20 20 20 20 7b 64 69 73 61 67 72 65 \.. {disagre 2c80: 65 73 20 77 69 74 68 20 69 74 73 20 63 68 61 6e es with its chan 2c90: 67 65 73 65 74 20 40 20 61 62 6f 75 74 20 74 68 geset @ about th 2ca0: 65 20 6d 65 74 61 20 69 6e 66 6f 72 6d 61 74 69 e meta informati 2cb0: 6f 6e 7d 20 7b 0a 09 09 53 45 4c 45 43 54 20 43 on} {...SELECT C 2cc0: 54 2e 6e 61 6d 65 2c 20 43 2e 63 69 64 2c 20 46 T.name, C.cid, F 2cd0: 2e 6e 61 6d 65 2c 20 52 2e 72 65 76 0a 09 09 46 .name, R.rev...F 2ce0: 52 4f 4d 20 63 68 61 6e 67 65 73 65 74 20 43 2c ROM changeset C, 2cf0: 20 63 73 74 79 70 65 20 43 54 2c 20 72 65 76 69 cstype CT, revi 2d00: 73 69 6f 6e 20 52 2c 20 66 69 6c 65 20 46 2c 20 sion R, file F, 2d10: 63 73 69 74 65 6d 20 43 49 0a 09 09 57 48 45 52 csitem CI...WHER 2d20: 45 20 43 2e 74 79 70 65 20 3d 20 30 20 20 20 20 E C.type = 0 2d30: 20 20 20 2d 2d 20 72 65 76 69 73 69 6f 6e 20 63 -- revision c 2d40: 68 61 6e 67 65 73 65 74 73 20 6f 6e 6c 79 0a 09 hangesets only.. 2d50: 09 41 4e 44 20 20 20 43 2e 63 69 64 20 20 3d 20 .AND C.cid = 2d60: 43 49 2e 63 69 64 20 20 2d 2d 20 63 68 61 6e 67 CI.cid -- chang 2d70: 65 73 65 74 20 2d 2d 3e 20 69 74 73 20 72 65 76 eset --> its rev 2d80: 69 73 69 6f 6e 73 0a 09 09 41 4e 44 20 20 20 52 isions...AND R 2d90: 2e 72 69 64 20 20 3d 20 43 49 2e 69 69 64 20 20 .rid = CI.iid 2da0: 2d 2d 20 6c 6f 6f 6b 20 61 74 20 74 68 65 6d 0a -- look at them. 2db0: 09 09 41 4e 44 20 20 20 52 2e 6d 69 64 20 21 3d ..AND R.mid != 2dc0: 20 43 2e 73 72 63 20 20 20 2d 2d 20 4f 6e 6c 79 C.src -- Only 2dd0: 20 74 68 6f 73 65 20 77 68 69 63 68 20 64 69 73 those which dis 2de0: 61 67 72 65 65 20 77 69 74 68 20 63 68 61 6e 67 agree with chang 2df0: 65 73 65 74 20 61 62 6f 75 74 20 74 68 65 20 6d eset about the m 2e00: 65 74 61 0a 09 09 41 4e 44 20 20 20 52 2e 66 69 eta...AND R.fi 2e10: 64 20 3d 20 46 2e 66 69 64 20 20 20 20 2d 2d 20 d = F.fid -- 2e20: 67 65 74 20 66 69 6c 65 20 6f 66 20 74 68 65 20 get file of the 2e30: 72 65 76 69 73 69 6f 6e 0a 09 09 41 4e 44 20 20 revision...AND 2e40: 20 43 54 2e 74 69 64 20 3d 20 43 2e 74 79 70 65 CT.tid = C.type 2e50: 20 20 2d 2d 20 67 65 74 20 63 68 61 6e 67 65 73 -- get changes 2e60: 65 74 20 74 79 70 65 2c 20 66 6f 72 20 6c 61 62 et type, for lab 2e70: 65 6c 69 6e 67 0a 09 20 20 20 20 7d 0a 09 23 20 eling.. }..# 2e80: 41 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 68 61 All revisions ha 2e90: 76 65 20 74 6f 20 61 67 72 65 65 20 6f 6e 20 74 ve to agree on t 2ea0: 68 65 20 4c 4f 44 20 74 68 65 69 72 20 63 68 61 he LOD their cha 2eb0: 6e 67 65 73 65 74 0a 09 23 20 62 65 6c 6f 6e 67 ngeset..# belong 2ec0: 73 20 74 6f 2e 20 49 6e 20 6f 74 68 65 72 20 77 s to. In other w 2ed0: 6f 72 64 73 2c 20 61 6c 6c 20 72 65 76 69 73 69 ords, all revisi 2ee0: 6f 6e 73 20 69 6e 20 61 20 63 68 61 6e 67 65 73 ons in a changes 2ef0: 65 74 0a 09 23 20 68 61 76 65 20 74 6f 20 72 65 et..# have to re 2f00: 66 65 72 20 74 6f 20 74 68 65 20 73 61 6d 65 20 fer to the same 2f10: 6c 69 6e 65 20 6f 66 20 64 65 76 65 6c 6f 70 6d line of developm 2f20: 65 6e 74 2e 0a 09 23 0a 09 23 20 49 6e 73 74 65 ent...#..# Inste 2f30: 61 64 20 6f 66 20 6c 6f 6f 6b 69 6e 67 20 61 74 ad of looking at 2f40: 20 61 6c 6c 20 70 61 69 72 73 20 6f 66 20 72 65 all pairs of re 2f50: 76 69 73 69 6f 6e 73 20 69 6e 20 61 6c 6c 0a 09 visions in all.. 2f60: 23 20 63 68 61 6e 67 65 73 65 74 73 20 77 65 20 # changesets we 2f70: 67 65 6e 65 72 61 74 65 20 74 68 65 20 64 69 73 generate the dis 2f80: 74 69 6e 63 74 20 73 65 74 20 6f 66 20 61 6c 6c tinct set of all 2f90: 20 4c 4f 44 73 0a 09 23 20 72 65 66 65 72 65 6e LODs..# referen 2fa0: 63 65 64 20 62 79 20 74 68 65 20 72 65 76 69 73 ced by the revis 2fb0: 69 6f 6e 73 20 6f 66 20 61 20 63 68 61 6e 67 65 ions of a change 2fc0: 73 65 74 2c 20 6c 6f 6f 6b 20 66 6f 72 20 74 68 set, look for th 2fd0: 6f 73 65 0a 09 23 20 77 69 74 68 20 63 61 72 64 ose..# with card 2fe0: 69 6e 61 6c 69 74 79 20 3e 20 31 2c 20 61 6e 64 inality > 1, and 2ff0: 20 67 65 74 20 74 68 65 20 69 64 65 6e 74 69 66 get the identif 3000: 79 69 6e 67 20 69 6e 66 6f 72 6d 61 74 69 6f 6e ying information 3010: 0a 09 23 20 66 6f 72 20 74 68 65 20 63 68 61 6e ..# for the chan 3020: 67 65 73 65 74 73 20 66 6f 75 6e 64 20 74 68 75 gesets found thu 3030: 73 6c 79 2e 0a 09 43 68 65 63 6b 43 53 20 5c 0a sly...CheckCS \. 3040: 09 20 20 20 20 7b 41 6c 6c 20 72 65 76 69 73 69 . {All revisi 3050: 6f 6e 73 20 69 6e 20 61 20 63 68 61 6e 67 65 73 ons in a changes 3060: 65 74 20 68 61 76 65 20 74 6f 20 62 65 6c 6f 6e et have to belon 3070: 67 20 74 6f 20 74 68 65 20 73 61 6d 65 20 4c 4f g to the same LO 3080: 44 7d 20 5c 0a 09 20 20 20 20 7b 3a 20 49 74 73 D} \.. {: Its 3090: 20 72 65 76 69 73 69 6f 6e 73 20 64 69 73 61 67 revisions disag 30a0: 72 65 65 20 61 62 6f 75 74 20 74 68 65 20 4c 4f ree about the LO 30b0: 44 20 74 68 65 79 20 62 65 6c 6f 6e 67 20 74 6f D they belong to 30c0: 7d 20 7b 0a 09 09 53 45 4c 45 43 54 20 54 2e 6e } {...SELECT T.n 30d0: 61 6d 65 2c 20 43 2e 63 69 64 0a 09 09 46 52 4f ame, C.cid...FRO 30e0: 4d 20 20 20 63 68 61 6e 67 65 73 65 74 20 43 2c M changeset C, 30f0: 20 63 73 74 79 70 65 20 54 0a 09 09 57 48 45 52 cstype T...WHER 3100: 45 20 20 43 2e 63 69 64 20 49 4e 20 28 53 45 4c E C.cid IN (SEL 3110: 45 43 54 20 55 2e 63 69 64 0a 09 09 09 09 20 46 ECT U.cid..... F 3120: 52 4f 4d 20 28 53 45 4c 45 43 54 20 44 49 53 54 ROM (SELECT DIST 3130: 49 4e 43 54 20 43 49 2e 63 69 64 20 41 53 20 63 INCT CI.cid AS c 3140: 69 64 2c 20 52 2e 6c 6f 64 20 41 53 20 6c 6f 64 id, R.lod AS lod 3150: 0a 09 09 09 09 20 20 20 20 20 20 20 46 52 4f 4d ..... FROM 3160: 20 20 20 63 73 69 74 65 6d 20 43 49 2c 20 63 68 csitem CI, ch 3170: 61 6e 67 65 73 65 74 20 43 2c 20 72 65 76 69 73 angeset C, revis 3180: 69 6f 6e 20 52 0a 09 09 09 09 20 20 20 20 20 20 ion R..... 3190: 20 57 48 45 52 45 20 20 43 49 2e 69 69 64 20 3d WHERE CI.iid = 31a0: 20 52 2e 72 69 64 0a 09 09 09 09 20 20 20 20 20 R.rid..... 31b0: 20 20 41 4e 44 20 20 20 20 43 2e 63 69 64 20 3d AND C.cid = 31c0: 20 43 49 2e 63 69 64 0a 09 09 09 09 20 20 20 20 CI.cid..... 31d0: 20 20 20 41 4e 44 20 20 20 20 43 2e 74 79 70 65 AND C.type 31e0: 20 3d 20 30 29 20 41 53 20 55 0a 09 09 09 09 20 = 0) AS U..... 31f0: 47 52 4f 55 50 20 42 59 20 55 2e 63 69 64 20 48 GROUP BY U.cid H 3200: 41 56 49 4e 47 20 43 4f 55 4e 54 28 55 2e 6c 6f AVING COUNT(U.lo 3210: 64 29 20 3e 20 31 29 0a 09 09 41 4e 44 20 20 20 d) > 1)...AND 3220: 20 54 2e 74 69 64 20 3d 20 43 2e 74 79 70 65 0a T.tid = C.type. 3230: 09 20 20 20 20 7d 0a 09 23 20 41 6c 6c 20 72 65 . }..# All re 3240: 76 69 73 69 6f 6e 73 20 68 61 76 65 20 74 6f 20 visions have to 3250: 61 67 72 65 65 20 6f 6e 20 74 68 65 20 70 72 6f agree on the pro 3260: 6a 65 63 74 20 74 68 65 69 72 20 63 68 61 6e 67 ject their chang 3270: 65 73 65 74 0a 09 23 20 62 65 6c 6f 6e 67 73 20 eset..# belongs 3280: 74 6f 2e 20 49 6e 20 6f 74 68 65 72 20 77 6f 72 to. In other wor 3290: 64 73 2c 20 61 6c 6c 20 72 65 76 69 73 69 6f 6e ds, all revision 32a0: 73 20 69 6e 20 61 20 63 68 61 6e 67 65 73 65 74 s in a changeset 32b0: 0a 09 23 20 68 61 76 65 20 74 6f 20 72 65 66 65 ..# have to refe 32c0: 72 20 74 6f 20 74 68 65 20 73 61 6d 65 20 70 72 r to the same pr 32d0: 6f 6a 65 63 74 2e 0a 09 23 0a 09 23 20 49 6e 73 oject...#..# Ins 32e0: 74 65 61 64 20 6f 66 20 6c 6f 6f 6b 69 6e 67 20 tead of looking 32f0: 61 74 20 61 6c 6c 20 70 61 69 72 73 20 6f 66 20 at all pairs of 3300: 72 65 76 69 73 69 6f 6e 73 20 69 6e 20 61 6c 6c revisions in all 3310: 0a 09 23 20 63 68 61 6e 67 65 73 65 74 73 20 77 ..# changesets w 3320: 65 20 67 65 6e 65 72 61 74 65 20 74 68 65 20 64 e generate the d 3330: 69 73 74 69 6e 63 74 20 73 65 74 20 6f 66 20 61 istinct set of a 3340: 6c 6c 20 70 72 6f 6a 65 63 74 73 0a 09 23 20 72 ll projects..# r 3350: 65 66 65 72 65 6e 63 65 64 20 62 79 20 74 68 65 eferenced by the 3360: 20 72 65 76 69 73 69 6f 6e 73 20 6f 66 20 61 20 revisions of a 3370: 63 68 61 6e 67 65 73 65 74 2c 20 6c 6f 6f 6b 20 changeset, look 3380: 66 6f 72 20 74 68 6f 73 65 0a 09 23 20 77 69 74 for those..# wit 3390: 68 20 63 61 72 64 69 6e 61 6c 69 74 79 20 3e 20 h cardinality > 33a0: 31 2c 20 61 6e 64 20 67 65 74 20 74 68 65 20 69 1, and get the i 33b0: 64 65 6e 74 69 66 79 69 6e 67 20 69 6e 66 6f 72 dentifying infor 33c0: 6d 61 74 69 6f 6e 0a 09 23 20 66 6f 72 20 74 68 mation..# for th 33d0: 65 20 63 68 61 6e 67 65 73 65 74 73 20 66 6f 75 e changesets fou 33e0: 6e 64 20 74 68 75 73 6c 79 2e 0a 09 43 68 65 63 nd thusly...Chec 33f0: 6b 43 53 20 5c 0a 09 20 20 20 20 7b 41 6c 6c 20 kCS \.. {All 3400: 72 65 76 69 73 69 6f 6e 73 20 69 6e 20 61 20 63 revisions in a c 3410: 68 61 6e 67 65 73 65 74 20 68 61 76 65 20 74 6f hangeset have to 3420: 20 62 65 6c 6f 6e 67 20 74 6f 20 74 68 65 20 73 belong to the s 3430: 61 6d 65 20 70 72 6f 6a 65 63 74 7d 20 5c 0a 09 ame project} \.. 3440: 20 20 20 20 7b 3a 20 49 74 73 20 72 65 76 69 73 {: Its revis 3450: 69 6f 6e 73 20 64 69 73 61 67 72 65 65 20 61 62 ions disagree ab 3460: 6f 75 74 20 74 68 65 20 70 72 6f 6a 65 63 74 20 out the project 3470: 74 68 65 79 20 62 65 6c 6f 6e 67 20 74 6f 7d 20 they belong to} 3480: 7b 0a 09 09 53 45 4c 45 43 54 20 54 2e 6e 61 6d {...SELECT T.nam 3490: 65 2c 20 43 2e 63 69 64 0a 09 09 46 52 4f 4d 20 e, C.cid...FROM 34a0: 20 20 63 68 61 6e 67 65 73 65 74 20 43 2c 20 63 changeset C, c 34b0: 73 74 79 70 65 20 54 0a 09 09 57 48 45 52 45 20 stype T...WHERE 34c0: 20 43 2e 63 69 64 20 49 4e 20 28 53 45 4c 45 43 C.cid IN (SELEC 34d0: 54 20 55 2e 63 69 64 0a 09 09 09 09 20 46 52 4f T U.cid..... FRO 34e0: 4d 20 28 53 45 4c 45 43 54 20 44 49 53 54 49 4e M (SELECT DISTIN 34f0: 43 54 20 43 49 2e 63 69 64 20 41 53 20 63 69 64 CT CI.cid AS cid 3500: 2c 20 46 2e 70 69 64 20 41 53 20 70 69 64 0a 09 , F.pid AS pid.. 3510: 09 09 09 20 20 20 20 20 20 20 46 52 4f 4d 20 20 ... FROM 3520: 20 63 73 69 74 65 6d 20 43 49 2c 20 63 68 61 6e csitem CI, chan 3530: 67 65 73 65 74 20 43 2c 20 72 65 76 69 73 69 6f geset C, revisio 3540: 6e 20 52 2c 20 66 69 6c 65 20 46 0a 09 09 09 09 n R, file F..... 3550: 20 20 20 20 20 20 20 57 48 45 52 45 20 20 43 49 WHERE CI 3560: 2e 69 69 64 20 3d 20 52 2e 72 69 64 0a 09 09 09 .iid = R.rid.... 3570: 09 20 20 20 20 20 20 20 41 4e 44 20 20 20 20 43 . AND C 3580: 2e 63 69 64 20 3d 20 43 49 2e 63 69 64 0a 09 09 .cid = CI.cid... 3590: 09 09 20 20 20 20 20 20 20 41 4e 44 20 20 20 20 .. AND 35a0: 43 2e 74 79 70 65 20 3d 20 30 0a 09 09 09 09 20 C.type = 0..... 35b0: 20 20 20 20 20 20 41 4e 44 20 20 20 20 46 2e 66 AND F.f 35c0: 69 64 20 20 3d 20 52 2e 66 69 64 29 20 41 53 20 id = R.fid) AS 35d0: 55 0a 09 09 09 09 20 47 52 4f 55 50 20 42 59 20 U..... GROUP BY 35e0: 55 2e 63 69 64 20 48 41 56 49 4e 47 20 43 4f 55 U.cid HAVING COU 35f0: 4e 54 28 55 2e 70 69 64 29 20 3e 20 31 29 0a 09 NT(U.pid) > 1).. 3600: 09 41 4e 44 20 20 20 20 54 2e 74 69 64 20 3d 20 .AND T.tid = 3610: 43 2e 74 79 70 65 0a 09 20 20 20 20 7d 0a 09 23 C.type.. }..# 3620: 20 41 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 69 All revisions i 3630: 6e 20 61 20 73 69 6e 67 6c 65 20 63 68 61 6e 67 n a single chang 3640: 65 73 65 74 20 68 61 76 65 20 74 6f 20 62 65 6c eset have to bel 3650: 6f 6e 67 20 74 6f 0a 09 23 20 64 69 66 66 65 72 ong to..# differ 3660: 65 6e 74 20 66 69 6c 65 73 2e 20 43 6f 6e 76 65 ent files. Conve 3670: 72 73 65 6c 79 3a 20 4e 6f 20 74 77 6f 20 72 65 rsely: No two re 3680: 76 69 73 69 6f 6e 73 20 6f 66 20 61 20 73 69 6e visions of a sin 3690: 67 6c 65 0a 09 23 20 66 69 6c 65 20 61 72 65 20 gle..# file are 36a0: 61 6c 6c 6f 77 65 64 20 74 6f 20 62 65 20 69 6e allowed to be in 36b0: 20 74 68 65 20 73 61 6d 65 20 63 68 61 6e 67 65 the same change 36c0: 73 65 74 2e 0a 09 23 0a 09 23 20 49 6e 73 74 65 set...#..# Inste 36d0: 61 64 20 6f 66 20 6c 6f 6f 6b 69 6e 67 20 61 74 ad of looking at 36e0: 20 61 6c 6c 20 70 61 69 72 73 20 6f 66 20 72 65 all pairs of re 36f0: 76 69 73 69 6f 6e 73 20 69 6e 20 61 6c 6c 0a 09 visions in all.. 3700: 23 20 63 68 61 6e 67 65 73 65 74 73 20 77 65 20 # changesets we 3710: 67 65 6e 65 72 61 74 65 20 74 68 65 20 64 69 73 generate the dis 3720: 74 69 6e 63 74 20 73 65 74 20 6f 66 20 61 6c 6c tinct set of all 3730: 20 66 69 6c 65 73 0a 09 23 20 72 65 66 65 72 65 files..# refere 3740: 6e 63 65 64 20 62 79 20 74 68 65 20 72 65 76 69 nced by the revi 3750: 73 69 6f 6e 73 20 6f 66 20 61 20 63 68 61 6e 67 sions of a chang 3760: 65 73 65 74 2c 20 61 6e 64 20 6c 6f 6f 6b 20 66 eset, and look f 3770: 6f 72 0a 09 23 20 74 68 6f 73 65 20 77 69 74 68 or..# those with 3780: 20 63 61 72 64 69 6e 61 6c 69 74 79 20 3c 20 74 cardinality < t 3790: 68 65 20 63 61 72 64 69 6e 61 6c 69 74 79 20 6f he cardinality o 37a0: 66 20 74 68 65 20 73 65 74 20 6f 66 0a 09 23 20 f the set of..# 37b0: 72 65 76 69 73 69 6f 6e 73 2c 20 61 6e 64 20 67 revisions, and g 37c0: 65 74 20 74 68 65 20 69 64 65 6e 74 69 66 79 69 et the identifyi 37d0: 6e 67 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 66 ng information f 37e0: 6f 72 20 74 68 65 0a 09 23 20 63 68 61 6e 67 65 or the..# change 37f0: 73 65 74 73 20 66 6f 75 6e 64 20 74 68 75 73 6c sets found thusl 3800: 79 2e 0a 09 43 68 65 63 6b 43 53 20 5c 0a 09 20 y...CheckCS \.. 3810: 20 20 20 7b 41 6c 6c 20 72 65 76 69 73 69 6f 6e {All revision 3820: 73 20 69 6e 20 61 20 63 68 61 6e 67 65 73 65 74 s in a changeset 3830: 20 68 61 76 65 20 74 6f 20 62 65 6c 6f 6e 67 20 have to belong 3840: 74 6f 20 64 69 66 66 65 72 65 6e 74 20 66 69 6c to different fil 3850: 65 73 7d 20 5c 0a 09 20 20 20 20 7b 3a 20 49 74 es} \.. {: It 3860: 73 20 72 65 76 69 73 69 6f 6e 73 20 73 68 61 72 s revisions shar 3870: 65 20 66 69 6c 65 73 7d 20 7b 0a 09 09 53 45 4c e files} {...SEL 3880: 45 43 54 20 54 2e 6e 61 6d 65 2c 20 43 2e 63 69 ECT T.name, C.ci 3890: 64 0a 09 09 46 52 4f 4d 20 20 20 63 68 61 6e 67 d...FROM chang 38a0: 65 73 65 74 20 43 2c 20 63 73 74 79 70 65 20 54 eset C, cstype T 38b0: 0a 09 09 57 48 45 52 45 20 20 43 2e 63 69 64 20 ...WHERE C.cid 38c0: 49 4e 20 28 53 45 4c 45 43 54 20 56 56 2e 63 69 IN (SELECT VV.ci 38d0: 64 0a 09 09 09 09 20 46 52 4f 4d 20 28 53 45 4c d..... FROM (SEL 38e0: 45 43 54 20 55 2e 63 69 64 20 61 73 20 63 69 64 ECT U.cid as cid 38f0: 2c 20 43 4f 55 4e 54 20 28 55 2e 66 69 64 29 20 , COUNT (U.fid) 3900: 41 53 20 66 63 6f 75 6e 74 0a 09 09 09 09 20 20 AS fcount..... 3910: 20 20 20 20 20 46 52 4f 4d 20 28 53 45 4c 45 43 FROM (SELEC 3920: 54 20 44 49 53 54 49 4e 43 54 20 43 49 2e 63 69 T DISTINCT CI.ci 3930: 64 20 41 53 20 63 69 64 2c 20 52 2e 66 69 64 20 d AS cid, R.fid 3940: 41 53 20 66 69 64 0a 09 09 09 09 09 20 20 20 20 AS fid...... 3950: 20 46 52 4f 4d 20 20 20 63 73 69 74 65 6d 20 43 FROM csitem C 3960: 49 2c 20 63 68 61 6e 67 65 73 65 74 20 43 2c 20 I, changeset C, 3970: 72 65 76 69 73 69 6f 6e 20 52 0a 09 09 09 09 09 revision R...... 3980: 20 20 20 20 20 57 48 45 52 45 20 20 43 49 2e 69 WHERE CI.i 3990: 69 64 20 3d 20 52 2e 72 69 64 0a 09 09 09 09 09 id = R.rid...... 39a0: 20 20 20 20 20 41 4e 44 20 20 20 20 43 2e 63 69 AND C.ci 39b0: 64 20 3d 20 43 49 2e 63 69 64 0a 09 09 09 09 09 d = CI.cid...... 39c0: 20 20 20 20 20 41 4e 44 20 20 20 20 43 2e 74 79 AND C.ty 39d0: 70 65 20 3d 20 30 0a 09 09 09 09 09 20 20 20 20 pe = 0...... 39e0: 20 29 20 41 53 20 55 0a 09 09 09 09 20 20 20 20 ) AS U..... 39f0: 20 20 20 47 52 4f 55 50 20 42 59 20 55 2e 63 69 GROUP BY U.ci 3a00: 64 29 20 41 53 20 55 55 2c 0a 09 09 09 09 20 20 d) AS UU,..... 3a10: 20 20 20 20 28 53 45 4c 45 43 54 20 56 2e 63 69 (SELECT V.ci 3a20: 64 20 41 53 20 63 69 64 2c 20 43 4f 55 4e 54 20 d AS cid, COUNT 3a30: 28 56 2e 69 69 64 29 20 41 53 20 72 63 6f 75 6e (V.iid) AS rcoun 3a40: 74 0a 09 09 09 09 20 20 20 20 20 20 20 46 52 4f t..... FRO 3a50: 4d 20 20 20 63 73 69 74 65 6d 20 56 2c 20 63 68 M csitem V, ch 3a60: 61 6e 67 65 73 65 74 20 58 0a 09 09 09 09 20 20 angeset X..... 3a70: 20 20 20 20 20 57 48 45 52 45 20 20 58 2e 63 69 WHERE X.ci 3a80: 64 20 3d 20 56 2e 63 69 64 0a 09 09 09 09 20 20 d = V.cid..... 3a90: 20 20 20 20 20 41 4e 44 20 20 20 20 58 2e 74 79 AND X.ty 3aa0: 70 65 20 3d 20 30 0a 09 09 09 09 20 20 20 20 20 pe = 0..... 3ab0: 20 20 47 52 4f 55 50 20 42 59 20 56 2e 63 69 64 GROUP BY V.cid 3ac0: 29 20 41 53 20 56 56 0a 09 09 09 09 20 57 48 45 ) AS VV..... WHE 3ad0: 52 45 20 56 56 2e 63 69 64 20 3d 20 55 55 2e 63 RE VV.cid = UU.c 3ae0: 69 64 0a 09 09 09 09 20 41 4e 44 20 20 20 55 55 id..... AND UU 3af0: 2e 66 63 6f 75 6e 74 20 3c 20 56 56 2e 72 63 6f .fcount < VV.rco 3b00: 75 6e 74 29 0a 09 09 41 4e 44 20 20 20 20 54 2e unt)...AND T. 3b10: 74 69 64 20 3d 20 43 2e 74 79 70 65 0a 09 20 20 tid = C.type.. 3b20: 20 20 7d 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 }..return. 3b30: 7d 0a 0a 20 20 20 20 70 72 6f 63 20 54 61 67 43 }.. proc TagC 3b40: 68 61 6e 67 65 73 65 74 73 20 7b 7d 20 7b 0a 09 hangesets {} {.. 3b50: 23 20 54 68 69 73 20 63 6f 64 65 20 70 65 72 66 # This code perf 3b60: 6f 72 6d 73 20 61 20 6e 75 6d 62 65 72 20 6f 66 orms a number of 3b70: 20 70 61 72 61 6e 6f 69 64 20 63 68 65 63 6b 73 paranoid checks 3b80: 20 6f 66 20 74 68 65 0a 09 23 20 64 61 74 61 62 of the..# datab 3b90: 61 73 65 2c 20 73 65 61 72 63 68 69 6e 67 20 66 ase, searching f 3ba0: 6f 72 20 69 6e 63 6f 6e 73 69 73 74 65 6e 74 20 or inconsistent 3bb0: 63 68 61 6e 67 65 73 65 74 2f 72 65 76 69 73 69 changeset/revisi 3bc0: 6f 6e 0a 09 23 20 69 6e 66 6f 72 6d 61 74 69 6f on..# informatio 3bd0: 6e 2e 0a 0a 09 75 70 76 61 72 20 31 20 6e 20 6e n....upvar 1 n n 3be0: 20 3b 20 23 20 43 6f 75 6e 74 65 72 20 66 6f 72 ; # Counter for 3bf0: 20 74 68 65 20 63 68 65 63 6b 73 20 28 77 65 20 the checks (we 3c00: 70 72 69 6e 74 20 61 6e 20 69 64 20 62 65 66 6f print an id befo 3c10: 72 65 0a 09 09 20 20 20 20 20 20 23 20 74 68 65 re... # the 3c20: 20 6d 61 69 6e 20 6c 61 62 65 6c 29 2e 0a 0a 09 main label).... 3c30: 23 20 46 69 6e 64 20 61 6c 6c 20 74 61 67 73 20 # Find all tags 3c40: 77 68 69 63 68 20 61 72 65 20 6e 6f 74 20 75 73 which are not us 3c50: 65 64 20 62 79 20 61 74 20 6c 65 61 73 74 20 6f ed by at least o 3c60: 6e 65 20 63 68 61 6e 67 65 73 65 74 2e 0a 09 43 ne changeset...C 3c70: 68 65 63 6b 54 61 67 20 5c 0a 09 20 20 20 20 7b heckTag \.. { 3c80: 41 6c 6c 20 74 61 67 73 20 68 61 76 65 20 74 6f All tags have to 3c90: 20 62 65 20 75 73 65 64 20 62 79 20 6c 65 61 73 be used by leas 3ca0: 74 20 6f 6e 65 20 63 68 61 6e 67 65 73 65 74 7d t one changeset} 3cb0: 20 5c 0a 09 20 20 20 20 7b 69 73 20 6e 6f 74 20 \.. {is not 3cc0: 75 73 65 64 20 62 79 20 61 20 63 68 61 6e 67 65 used by a change 3cd0: 73 65 74 7d 20 7b 0a 09 09 2d 2d 20 55 6e 75 73 set} {...-- Unus 3ce0: 65 64 20 74 61 67 73 20 3d 20 41 6c 6c 20 74 61 ed tags = All ta 3cf0: 67 73 0a 09 09 2d 2d 20 20 20 20 20 20 20 20 20 gs...-- 3d00: 20 20 20 20 2d 20 72 65 76 69 73 69 6f 6e 73 20 - revisions 3d10: 75 73 65 64 20 62 79 20 74 61 67 20 63 68 61 6e used by tag chan 3d20: 67 65 73 65 74 73 2e 0a 09 09 2d 2d 0a 09 09 2d gesets....--...- 3d30: 2d 20 42 6f 74 68 20 73 65 74 73 20 63 61 6e 20 - Both sets can 3d40: 62 65 20 63 6f 6d 70 75 74 65 64 20 65 61 73 69 be computed easi 3d50: 6c 79 2c 20 61 6e 64 20 73 75 62 74 72 61 63 74 ly, and subtract 3d60: 65 64 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 ed. 3d70: 20 20 20 2d 2d 20 66 72 6f 6d 20 65 61 63 68 20 -- from each 3d80: 6f 74 68 65 72 2e 20 54 68 65 6e 20 77 65 20 63 other. Then we c 3d90: 61 6e 20 67 65 74 20 74 68 65 20 61 73 73 6f 63 an get the assoc 3da0: 69 61 74 65 64 0a 20 20 20 20 20 20 20 20 20 20 iated. 3db0: 20 20 20 20 20 20 2d 2d 20 66 69 6c 65 20 28 6e -- file (n 3dc0: 61 6d 65 29 20 66 6f 72 20 64 69 73 70 6c 61 79 ame) for display 3dd0: 2e 0a 0a 09 09 53 45 4c 45 43 54 20 50 2e 6e 61 .....SELECT P.na 3de0: 6d 65 2c 20 53 2e 6e 61 6d 65 0a 09 09 46 52 4f me, S.name...FRO 3df0: 4d 20 70 72 6f 6a 65 63 74 20 50 2c 20 74 61 67 M project P, tag 3e00: 20 54 2c 20 73 79 6d 62 6f 6c 20 53 0a 09 09 57 T, symbol S...W 3e10: 48 45 52 45 20 54 2e 74 69 64 20 49 4e 20 28 53 HERE T.tid IN (S 3e20: 45 4c 45 43 54 20 74 69 64 20 20 20 20 20 20 20 ELECT tid 3e30: 20 20 20 20 20 20 20 20 20 20 20 20 20 2d 2d 20 -- 3e40: 41 6c 6c 20 74 61 67 73 0a 09 09 09 09 46 52 4f All tags.....FRO 3e50: 4d 20 20 20 74 61 67 0a 09 09 09 09 45 58 43 45 M tag.....EXCE 3e60: 50 54 20 20 20 20 20 20 20 20 20 20 20 20 20 20 PT 3e70: 20 20 20 20 20 20 20 20 20 20 2d 2d 20 73 75 62 -- sub 3e80: 74 72 61 63 74 0a 09 09 09 09 53 45 4c 45 43 54 tract.....SELECT 3e90: 20 43 49 2e 69 69 64 20 20 20 20 20 20 20 20 20 CI.iid 3ea0: 20 20 20 20 20 20 20 20 2d 2d 20 74 61 67 73 20 -- tags 3eb0: 75 73 65 64 0a 09 09 09 09 46 52 4f 4d 20 20 20 used.....FROM 3ec0: 63 73 69 74 65 6d 20 43 49 2c 20 63 68 61 6e 67 csitem CI, chang 3ed0: 65 73 65 74 20 43 0a 09 09 09 09 57 48 45 52 45 eset C.....WHERE 3ee0: 20 20 43 2e 63 69 64 20 3d 20 43 49 2e 63 69 64 C.cid = CI.cid 3ef0: 20 20 20 20 20 20 20 20 20 2d 2d 20 62 79 20 61 -- by a 3f00: 6e 79 20 74 61 67 0a 09 09 09 09 41 4e 44 20 20 ny tag.....AND 3f10: 20 20 43 2e 74 79 70 65 20 3d 20 31 29 20 20 20 C.type = 1) 3f20: 20 20 20 20 20 20 20 20 20 2d 2d 20 63 68 61 6e -- chan 3f30: 67 65 73 65 74 0a 09 09 41 4e 44 20 20 20 53 2e geset...AND S. 3f40: 73 69 64 20 3d 20 54 2e 73 69 64 20 20 20 20 20 sid = T.sid 3f50: 20 20 20 20 20 20 20 20 20 20 2d 2d 20 67 65 74 -- get 3f60: 20 73 79 6d 62 6f 6c 20 6f 66 20 74 61 67 0a 09 symbol of tag.. 3f70: 09 41 4e 44 20 20 20 50 2e 70 69 64 20 3d 20 53 .AND P.pid = S 3f80: 2e 70 69 64 20 20 20 20 20 20 20 20 20 20 20 20 .pid 3f90: 20 20 20 2d 2d 20 67 65 74 20 70 72 6f 6a 65 63 -- get projec 3fa0: 74 20 6f 66 20 73 79 6d 62 6f 6c 0a 09 20 20 20 t of symbol.. 3fb0: 20 7d 0a 09 23 20 46 69 6e 64 20 61 6c 6c 20 74 }..# Find all t 3fc0: 61 67 73 20 77 68 69 63 68 20 61 72 65 20 75 73 ags which are us 3fd0: 65 64 20 62 79 20 6d 6f 72 65 20 74 68 61 6e 20 ed by more than 3fe0: 6f 6e 65 20 63 68 61 6e 67 65 73 65 74 2e 0a 09 one changeset... 3ff0: 43 68 65 63 6b 52 65 76 20 5c 0a 09 20 20 20 20 CheckRev \.. 4000: 7b 41 6c 6c 20 74 61 67 73 20 68 61 76 65 20 74 {All tags have t 4010: 6f 20 62 65 20 75 73 65 64 20 62 79 20 61 74 20 o be used by at 4020: 6d 6f 73 74 20 6f 6e 65 20 63 68 61 6e 67 65 73 most one changes 4030: 65 74 7d 20 5c 0a 09 20 20 20 20 7b 69 73 20 75 et} \.. {is u 4040: 73 65 64 20 62 79 20 6d 75 6c 74 69 70 6c 65 20 sed by multiple 4050: 63 68 61 6e 67 65 73 65 74 73 7d 20 7b 0a 09 09 changesets} {... 4060: 2d 2d 20 50 72 69 6e 63 69 70 6c 65 20 6f 66 20 -- Principle of 4070: 6f 70 65 72 61 74 69 6f 6e 3a 20 47 65 74 20 61 operation: Get a 4080: 6c 6c 20 74 61 67 2f 63 68 61 6e 67 65 73 65 74 ll tag/changeset 4090: 20 70 61 69 72 73 0a 20 20 20 20 20 20 20 20 20 pairs. 40a0: 20 20 20 20 20 20 20 2d 2d 20 66 6f 72 20 61 6c -- for al 40b0: 6c 20 74 61 67 20 63 68 61 6e 67 65 73 65 74 73 l tag changesets 40c0: 2c 20 67 72 6f 75 70 20 62 79 20 74 61 67 20 74 , group by tag t 40d0: 6f 20 61 67 67 72 65 67 61 74 65 0a 20 20 20 20 o aggregate. 40e0: 20 20 20 20 20 20 20 20 20 20 20 20 2d 2d 20 74 -- t 40f0: 68 65 20 63 68 61 6e 67 65 73 65 74 2c 20 63 6f he changeset, co 4100: 75 6e 74 69 6e 67 20 74 68 65 6d 2e 20 46 72 6f unting them. Fro 4110: 6d 20 74 68 65 20 72 65 73 75 6c 74 69 6e 67 0a m the resulting. 4120: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 4130: 2d 2d 20 74 61 67 2f 63 6f 75 6e 74 20 74 61 62 -- tag/count tab 4140: 6c 65 20 73 65 6c 65 63 74 20 74 68 6f 73 65 20 le select those 4150: 77 69 74 68 20 6d 6f 72 65 20 74 68 61 6e 20 6f with more than o 4160: 6e 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 ne. 4170: 20 20 20 2d 2d 20 75 73 65 72 2c 20 61 6e 64 20 -- user, and 4180: 67 65 74 20 74 68 65 69 72 20 61 73 73 6f 63 69 get their associ 4190: 61 74 65 64 20 66 69 6c 65 20 28 6e 61 6d 65 29 ated file (name) 41a0: 20 66 6f 72 0a 20 20 20 20 20 20 20 20 20 20 20 for. 41b0: 20 20 20 20 20 2d 2d 20 64 69 73 70 6c 61 79 2e -- display. 41c0: 0a 0a 09 09 53 45 4c 45 43 54 20 50 2e 6e 61 6d ....SELECT P.nam 41d0: 65 2c 20 53 2e 6e 61 6d 65 0a 09 09 46 52 4f 4d e, S.name...FROM 41e0: 20 74 61 67 20 54 2c 20 70 72 6f 6a 65 63 74 20 tag T, project 41f0: 50 2c 20 73 79 6d 62 6f 6c 20 53 2c 0a 09 09 20 P, symbol S,... 4200: 20 20 20 20 28 53 45 4c 45 43 54 20 43 49 2e 69 (SELECT CI.i 4210: 69 64 20 41 53 20 69 69 64 2c 20 63 6f 75 6e 74 id AS iid, count 4220: 28 43 49 2e 63 69 64 29 20 41 53 20 63 6f 75 6e (CI.cid) AS coun 4230: 74 0a 09 09 20 20 20 20 20 20 46 52 4f 4d 20 63 t... FROM c 4240: 73 69 74 65 6d 20 43 49 2c 20 63 68 61 6e 67 65 sitem CI, change 4250: 73 65 74 20 43 0a 09 09 20 20 20 20 20 20 57 48 set C... WH 4260: 45 52 45 20 43 2e 74 79 70 65 20 3d 20 31 0a 09 ERE C.type = 1.. 4270: 09 20 20 20 20 20 20 41 4e 44 20 20 20 43 2e 63 . AND C.c 4280: 69 64 20 3d 20 43 49 2e 63 69 64 0a 09 09 20 20 id = CI.cid... 4290: 20 20 20 20 47 52 4f 55 50 20 42 59 20 43 49 2e GROUP BY CI. 42a0: 69 69 64 29 20 41 53 20 55 0a 09 09 57 48 45 52 iid) AS U...WHER 42b0: 45 20 55 2e 63 6f 75 6e 74 20 3e 20 31 0a 09 09 E U.count > 1... 42c0: 41 4e 44 20 20 20 54 2e 74 69 64 20 3d 20 55 2e AND T.tid = U. 42d0: 69 69 64 0a 09 09 41 4e 44 20 20 20 53 2e 73 69 iid...AND S.si 42e0: 64 20 3d 20 54 2e 73 69 64 20 20 20 20 20 20 20 d = T.sid 42f0: 20 20 20 20 20 20 20 20 2d 2d 20 67 65 74 20 73 -- get s 4300: 79 6d 62 6f 6c 20 6f 66 20 74 61 67 0a 09 09 41 ymbol of tag...A 4310: 4e 44 20 20 20 50 2e 70 69 64 20 3d 20 53 2e 70 ND P.pid = S.p 4320: 69 64 20 20 20 20 20 20 20 20 20 20 20 20 20 20 id 4330: 20 2d 2d 20 67 65 74 20 70 72 6f 6a 65 63 74 20 -- get project 4340: 6f 66 20 73 79 6d 62 6f 6c 0a 09 20 20 20 20 7d of symbol.. } 4350: 0a 09 69 66 20 30 20 7b 0a 09 20 20 20 20 23 20 ..if 0 {.. # 4360: 54 68 69 73 20 63 68 65 63 6b 20 69 73 20 64 69 This check is di 4370: 73 61 62 6c 65 64 20 66 6f 72 20 74 68 65 20 6d sabled for the m 4380: 6f 6d 65 6e 74 2e 20 41 70 70 61 72 65 6e 74 6c oment. Apparentl 4390: 79 20 74 61 67 73 0a 09 20 20 20 20 23 20 63 61 y tags.. # ca 43a0: 6e 20 63 72 6f 73 73 20 6c 69 6e 65 73 20 6f 66 n cross lines of 43b0: 20 64 65 76 65 6c 6f 70 6d 65 6e 74 2c 20 61 74 development, at 43c0: 20 6c 65 61 73 74 20 69 66 20 74 68 65 20 69 6e least if the in 43d0: 76 6f 6c 76 65 64 0a 09 20 20 20 20 23 20 4c 4f volved.. # LO 43e0: 44 73 20 61 72 65 20 74 68 65 20 74 72 75 6e 6b Ds are the trunk 43f0: 2c 20 61 6e 64 20 74 68 65 20 4e 54 44 42 2e 20 , and the NTDB. 4400: 54 68 61 74 20 6d 61 6b 65 73 20 73 65 6e 73 65 That makes sense 4410: 2c 20 61 73 0a 09 20 20 20 20 23 20 74 68 65 20 , as.. # the 4420: 4e 54 44 42 20 72 65 76 69 73 69 6f 6e 73 20 61 NTDB revisions a 4430: 72 65 20 69 6e 69 74 69 61 6c 6c 79 20 6c 6f 67 re initially log 4440: 69 63 61 6c 6c 79 20 61 20 70 61 72 74 20 6f 66 ically a part of 4450: 20 74 68 65 0a 09 20 20 20 20 23 20 74 72 75 6e the.. # trun 4460: 6b 2e 20 54 68 65 20 73 74 61 6e 64 61 72 64 20 k. The standard 4470: 63 68 65 63 6b 20 62 65 6c 6f 77 20 68 6f 77 65 check below howe 4480: 76 65 72 20 64 6f 65 73 20 6e 6f 74 20 63 61 70 ver does not cap 4490: 74 75 72 65 0a 09 20 20 20 20 23 20 74 68 69 73 ture.. # this 44a0: 2e 20 57 68 65 6e 20 49 20 6d 61 6e 61 67 65 20 . When I manage 44b0: 74 6f 20 72 65 70 68 72 61 73 65 20 69 74 20 74 to rephrase it t 44c0: 6f 20 61 63 63 65 70 74 20 74 68 69 73 20 74 79 o accept this ty 44d0: 70 65 0a 09 20 20 20 20 23 20 6f 66 20 63 72 6f pe.. # of cro 44e0: 73 73 2d 6f 76 65 72 20 69 74 20 77 69 6c 6c 20 ss-over it will 44f0: 62 65 20 72 65 2d 61 63 74 69 76 61 74 65 64 2e be re-activated. 4500: 0a 0a 09 20 20 20 20 23 20 41 6c 6c 20 74 61 67 ... # All tag 4510: 73 20 68 61 76 65 20 74 6f 20 61 67 72 65 65 20 s have to agree 4520: 6f 6e 20 74 68 65 20 4c 4f 44 20 74 68 65 69 72 on the LOD their 4530: 20 63 68 61 6e 67 65 73 65 74 0a 09 20 20 20 20 changeset.. 4540: 23 20 62 65 6c 6f 6e 67 73 20 74 6f 2e 20 49 6e # belongs to. In 4550: 20 6f 74 68 65 72 20 77 6f 72 64 73 2c 20 61 6c other words, al 4560: 6c 20 74 61 67 73 20 69 6e 20 61 20 63 68 61 6e l tags in a chan 4570: 67 65 73 65 74 20 68 61 76 65 0a 09 20 20 20 20 geset have.. 4580: 23 20 74 6f 20 72 65 66 65 72 20 74 6f 20 74 68 # to refer to th 4590: 65 20 73 61 6d 65 20 6c 69 6e 65 20 6f 66 20 64 e same line of d 45a0: 65 76 65 6c 6f 70 6d 65 6e 74 2e 0a 09 20 20 20 evelopment... 45b0: 20 23 0a 09 20 20 20 20 23 20 49 6e 73 74 65 61 #.. # Instea 45c0: 64 20 6f 66 20 6c 6f 6f 6b 69 6e 67 20 61 74 20 d of looking at 45d0: 61 6c 6c 20 70 61 69 72 73 20 6f 66 20 74 61 67 all pairs of tag 45e0: 73 20 69 6e 20 61 6c 6c 0a 09 20 20 20 20 23 20 s in all.. # 45f0: 63 68 61 6e 67 65 73 65 74 73 20 77 65 20 67 65 changesets we ge 4600: 6e 65 72 61 74 65 20 74 68 65 20 64 69 73 74 69 nerate the disti 4610: 6e 63 74 20 73 65 74 20 6f 66 20 61 6c 6c 20 4c nct set of all L 4620: 4f 44 73 0a 09 20 20 20 20 23 20 72 65 66 65 72 ODs.. # refer 4630: 65 6e 63 65 64 20 62 79 20 74 68 65 20 74 61 67 enced by the tag 4640: 73 20 6f 66 20 61 20 63 68 61 6e 67 65 73 65 74 s of a changeset 4650: 2c 20 6c 6f 6f 6b 20 66 6f 72 20 74 68 6f 73 65 , look for those 4660: 0a 09 20 20 20 20 23 20 77 69 74 68 20 63 61 72 .. # with car 4670: 64 69 6e 61 6c 69 74 79 20 3e 20 31 2c 20 61 6e dinality > 1, an 4680: 64 20 67 65 74 20 74 68 65 20 69 64 65 6e 74 69 d get the identi 4690: 66 79 69 6e 67 0a 09 20 20 20 20 23 20 69 6e 66 fying.. # inf 46a0: 6f 72 6d 61 74 69 6f 6e 20 66 6f 72 20 74 68 65 ormation for the 46b0: 20 63 68 61 6e 67 65 73 65 74 73 20 66 6f 75 6e changesets foun 46c0: 64 20 74 68 75 73 6c 79 2e 0a 09 20 20 20 20 43 d thusly... C 46d0: 68 65 63 6b 43 53 20 5c 0a 09 09 7b 41 6c 6c 20 heckCS \...{All 46e0: 74 61 67 73 20 69 6e 20 61 20 63 68 61 6e 67 65 tags in a change 46f0: 73 65 74 20 68 61 76 65 20 74 6f 20 62 65 6c 6f set have to belo 4700: 6e 67 20 74 6f 20 74 68 65 20 73 61 6d 65 20 4c ng to the same L 4710: 4f 44 7d 20 5c 0a 09 09 7b 3a 20 49 74 73 20 74 OD} \...{: Its t 4720: 61 67 73 20 64 69 73 61 67 72 65 65 20 61 62 6f ags disagree abo 4730: 75 74 20 74 68 65 20 4c 4f 44 20 74 68 65 79 20 ut the LOD they 4740: 62 65 6c 6f 6e 67 20 74 6f 7d 20 7b 0a 09 09 20 belong to} {... 4750: 20 20 20 53 45 4c 45 43 54 20 54 2e 6e 61 6d 65 SELECT T.name 4760: 2c 20 43 2e 63 69 64 0a 09 09 20 20 20 20 46 52 , C.cid... FR 4770: 4f 4d 20 20 20 63 68 61 6e 67 65 73 65 74 20 43 OM changeset C 4780: 2c 20 63 73 74 79 70 65 20 54 0a 09 09 20 20 20 , cstype T... 4790: 20 57 48 45 52 45 20 20 43 2e 63 69 64 20 49 4e WHERE C.cid IN 47a0: 20 28 53 45 4c 45 43 54 20 55 2e 63 69 64 0a 09 (SELECT U.cid.. 47b0: 09 09 09 20 20 20 20 20 46 52 4f 4d 20 28 53 45 ... FROM (SE 47c0: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 43 49 LECT DISTINCT CI 47d0: 2e 63 69 64 20 41 53 20 63 69 64 2c 20 54 2e 6c .cid AS cid, T.l 47e0: 6f 64 20 41 53 20 6c 6f 64 0a 09 09 09 09 09 20 od AS lod...... 47f0: 20 20 46 52 4f 4d 20 20 20 63 73 69 74 65 6d 20 FROM csitem 4800: 43 49 2c 20 63 68 61 6e 67 65 73 65 74 20 43 2c CI, changeset C, 4810: 20 74 61 67 20 54 0a 09 09 09 09 09 20 20 20 57 tag T...... W 4820: 48 45 52 45 20 20 43 49 2e 69 69 64 20 3d 20 54 HERE CI.iid = T 4830: 2e 74 69 64 0a 09 09 09 09 09 20 20 20 41 4e 44 .tid...... AND 4840: 20 20 20 20 43 2e 63 69 64 20 3d 20 43 49 2e 63 C.cid = CI.c 4850: 69 64 0a 09 09 09 09 09 20 20 20 41 4e 44 20 20 id...... AND 4860: 20 20 43 2e 74 79 70 65 20 3d 20 31 29 20 41 53 C.type = 1) AS 4870: 20 55 0a 09 09 09 09 20 20 20 20 20 47 52 4f 55 U..... GROU 4880: 50 20 42 59 20 55 2e 63 69 64 20 48 41 56 49 4e P BY U.cid HAVIN 4890: 47 20 43 4f 55 4e 54 28 55 2e 6c 6f 64 29 20 3e G COUNT(U.lod) > 48a0: 20 31 29 0a 09 09 20 20 20 20 41 4e 44 20 20 20 1)... AND 48b0: 20 54 2e 74 69 64 20 3d 20 43 2e 74 79 70 65 0a T.tid = C.type. 48c0: 09 09 7d 0a 09 7d 0a 09 23 20 41 6c 6c 20 74 61 ..}..}..# All ta 48d0: 67 73 20 68 61 76 65 20 74 6f 20 61 67 72 65 65 gs have to agree 48e0: 20 6f 6e 20 74 68 65 20 70 72 6f 6a 65 63 74 20 on the project 48f0: 74 68 65 69 72 20 63 68 61 6e 67 65 73 65 74 0a their changeset. 4900: 09 23 20 62 65 6c 6f 6e 67 73 20 74 6f 2e 20 49 .# belongs to. I 4910: 6e 20 6f 74 68 65 72 20 77 6f 72 64 73 2c 20 61 n other words, a 4920: 6c 6c 20 74 61 67 73 20 69 6e 20 61 20 63 68 61 ll tags in a cha 4930: 6e 67 65 73 65 74 20 68 61 76 65 20 74 6f 0a 09 ngeset have to.. 4940: 23 20 72 65 66 65 72 20 74 6f 20 74 68 65 20 73 # refer to the s 4950: 61 6d 65 20 70 72 6f 6a 65 63 74 2e 0a 09 23 0a ame project...#. 4960: 09 23 20 49 6e 73 74 65 61 64 20 6f 66 20 6c 6f .# Instead of lo 4970: 6f 6b 69 6e 67 20 61 74 20 61 6c 6c 20 70 61 69 oking at all pai 4980: 72 73 20 6f 66 20 74 61 67 73 20 69 6e 20 61 6c rs of tags in al 4990: 6c 20 63 68 61 6e 67 65 73 65 74 73 20 77 65 0a l changesets we. 49a0: 09 23 20 67 65 6e 65 72 61 74 65 20 74 68 65 20 .# generate the 49b0: 64 69 73 74 69 6e 63 74 20 73 65 74 20 6f 66 20 distinct set of 49c0: 61 6c 6c 20 70 72 6f 6a 65 63 74 73 20 72 65 66 all projects ref 49d0: 65 72 65 6e 63 65 64 20 62 79 20 74 68 65 0a 09 erenced by the.. 49e0: 23 20 74 61 67 73 20 6f 66 20 61 20 63 68 61 6e # tags of a chan 49f0: 67 65 73 65 74 2c 20 6c 6f 6f 6b 20 66 6f 72 20 geset, look for 4a00: 74 68 6f 73 65 20 77 69 74 68 20 63 61 72 64 69 those with cardi 4a10: 6e 61 6c 69 74 79 20 3e 20 31 2c 0a 09 23 20 61 nality > 1,..# a 4a20: 6e 64 20 67 65 74 20 74 68 65 20 69 64 65 6e 74 nd get the ident 4a30: 69 66 79 69 6e 67 20 69 6e 66 6f 72 6d 61 74 69 ifying informati 4a40: 6f 6e 20 66 6f 72 20 74 68 65 20 63 68 61 6e 67 on for the chang 4a50: 65 73 65 74 73 20 66 6f 75 6e 64 0a 09 23 20 74 esets found..# t 4a60: 68 75 73 6c 79 2e 0a 09 43 68 65 63 6b 43 53 20 husly...CheckCS 4a70: 5c 0a 09 20 20 20 20 7b 41 6c 6c 20 74 61 67 73 \.. {All tags 4a80: 20 69 6e 20 61 20 63 68 61 6e 67 65 73 65 74 20 in a changeset 4a90: 68 61 76 65 20 74 6f 20 62 65 6c 6f 6e 67 20 74 have to belong t 4aa0: 6f 20 74 68 65 20 73 61 6d 65 20 70 72 6f 6a 65 o the same proje 4ab0: 63 74 7d 20 5c 0a 09 20 20 20 20 7b 3a 20 49 74 ct} \.. {: It 4ac0: 73 20 74 61 67 73 20 64 69 73 61 67 72 65 65 20 s tags disagree 4ad0: 61 62 6f 75 74 20 74 68 65 20 70 72 6f 6a 65 63 about the projec 4ae0: 74 20 74 68 65 79 20 62 65 6c 6f 6e 67 20 74 6f t they belong to 4af0: 7d 20 7b 0a 09 09 53 45 4c 45 43 54 20 54 2e 6e } {...SELECT T.n 4b00: 61 6d 65 2c 20 43 2e 63 69 64 0a 09 09 46 52 4f ame, C.cid...FRO 4b10: 4d 20 20 20 63 68 61 6e 67 65 73 65 74 20 43 2c M changeset C, 4b20: 20 63 73 74 79 70 65 20 54 0a 09 09 57 48 45 52 cstype T...WHER 4b30: 45 20 20 43 2e 63 69 64 20 49 4e 20 28 53 45 4c E C.cid IN (SEL 4b40: 45 43 54 20 55 2e 63 69 64 0a 09 09 09 09 20 46 ECT U.cid..... F 4b50: 52 4f 4d 20 28 53 45 4c 45 43 54 20 44 49 53 54 ROM (SELECT DIST 4b60: 49 4e 43 54 20 43 49 2e 63 69 64 20 41 53 20 63 INCT CI.cid AS c 4b70: 69 64 2c 20 46 2e 70 69 64 20 41 53 20 70 69 64 id, F.pid AS pid 4b80: 0a 09 09 09 09 20 20 20 20 20 20 20 46 52 4f 4d ..... FROM 4b90: 20 20 20 63 73 69 74 65 6d 20 43 49 2c 20 63 68 csitem CI, ch 4ba0: 61 6e 67 65 73 65 74 20 43 2c 20 74 61 67 20 54 angeset C, tag T 4bb0: 2c 20 66 69 6c 65 20 46 0a 09 09 09 09 20 20 20 , file F..... 4bc0: 20 20 20 20 57 48 45 52 45 20 20 43 49 2e 69 69 WHERE CI.ii 4bd0: 64 20 3d 20 54 2e 74 69 64 0a 09 09 09 09 20 20 d = T.tid..... 4be0: 20 20 20 20 20 41 4e 44 20 20 20 20 43 2e 63 69 AND C.ci 4bf0: 64 20 3d 20 43 49 2e 63 69 64 0a 09 09 09 09 20 d = CI.cid..... 4c00: 20 20 20 20 20 20 41 4e 44 20 20 20 20 43 2e 74 AND C.t 4c10: 79 70 65 20 3d 20 31 0a 09 09 09 09 20 20 20 20 ype = 1..... 4c20: 20 20 20 41 4e 44 20 20 20 20 46 2e 66 69 64 20 AND F.fid 4c30: 20 3d 20 54 2e 66 69 64 29 20 41 53 20 55 0a 09 = T.fid) AS U.. 4c40: 09 09 09 20 47 52 4f 55 50 20 42 59 20 55 2e 63 ... GROUP BY U.c 4c50: 69 64 20 48 41 56 49 4e 47 20 43 4f 55 4e 54 28 id HAVING COUNT( 4c60: 55 2e 70 69 64 29 20 3e 20 31 29 0a 09 09 41 4e U.pid) > 1)...AN 4c70: 44 20 20 20 20 54 2e 74 69 64 20 3d 20 43 2e 74 D T.tid = C.t 4c80: 79 70 65 0a 09 20 20 20 20 7d 0a 09 23 20 41 6c ype.. }..# Al 4c90: 6c 20 74 61 67 73 20 69 6e 20 61 20 73 69 6e 67 l tags in a sing 4ca0: 6c 65 20 63 68 61 6e 67 65 73 65 74 20 68 61 76 le changeset hav 4cb0: 65 20 74 6f 20 62 65 6c 6f 6e 67 20 74 6f 20 64 e to belong to d 4cc0: 69 66 66 65 72 65 6e 74 0a 09 23 20 66 69 6c 65 ifferent..# file 4cd0: 73 2e 20 43 6f 6e 76 65 72 73 65 6c 79 3a 20 4e s. Conversely: N 4ce0: 6f 20 74 77 6f 20 74 61 67 73 20 6f 66 20 61 20 o two tags of a 4cf0: 73 69 6e 67 6c 65 20 66 69 6c 65 20 61 72 65 20 single file are 4d00: 61 6c 6c 6f 77 65 64 0a 09 23 20 74 6f 20 62 65 allowed..# to be 4d10: 20 69 6e 20 74 68 65 20 73 61 6d 65 20 63 68 61 in the same cha 4d20: 6e 67 65 73 65 74 2e 0a 09 23 0a 09 23 20 49 6e ngeset...#..# In 4d30: 73 74 65 61 64 20 6f 66 20 6c 6f 6f 6b 69 6e 67 stead of looking 4d40: 20 61 74 20 61 6c 6c 20 70 61 69 72 73 20 6f 66 at all pairs of 4d50: 20 74 61 67 73 20 69 6e 20 61 6c 6c 20 63 68 61 tags in all cha 4d60: 6e 67 65 73 65 74 73 20 77 65 0a 09 23 20 67 65 ngesets we..# ge 4d70: 6e 65 72 61 74 65 20 74 68 65 20 64 69 73 74 69 nerate the disti 4d80: 6e 63 74 20 73 65 74 20 6f 66 20 61 6c 6c 20 66 nct set of all f 4d90: 69 6c 65 73 20 72 65 66 65 72 65 6e 63 65 64 20 iles referenced 4da0: 62 79 20 74 68 65 0a 09 23 20 74 61 67 73 20 6f by the..# tags o 4db0: 66 20 61 20 63 68 61 6e 67 65 73 65 74 2c 20 61 f a changeset, a 4dc0: 6e 64 20 6c 6f 6f 6b 20 66 6f 72 20 74 68 6f 73 nd look for thos 4dd0: 65 20 77 69 74 68 20 63 61 72 64 69 6e 61 6c 69 e with cardinali 4de0: 74 79 20 3c 0a 09 23 20 74 68 65 20 63 61 72 64 ty <..# the card 4df0: 69 6e 61 6c 69 74 79 20 6f 66 20 74 68 65 20 73 inality of the s 4e00: 65 74 20 6f 66 20 74 61 67 73 2c 20 61 6e 64 20 et of tags, and 4e10: 67 65 74 20 74 68 65 20 69 64 65 6e 74 69 66 79 get the identify 4e20: 69 6e 67 0a 09 23 20 69 6e 66 6f 72 6d 61 74 69 ing..# informati 4e30: 6f 6e 20 66 6f 72 20 74 68 65 20 63 68 61 6e 67 on for the chang 4e40: 65 73 65 74 73 20 66 6f 75 6e 64 20 74 68 75 73 esets found thus 4e50: 6c 79 2e 0a 09 43 68 65 63 6b 43 53 20 5c 0a 09 ly...CheckCS \.. 4e60: 20 20 20 20 7b 41 6c 6c 20 74 61 67 73 20 69 6e {All tags in 4e70: 20 61 20 63 68 61 6e 67 65 73 65 74 20 68 61 76 a changeset hav 4e80: 65 20 74 6f 20 62 65 6c 6f 6e 67 20 74 6f 20 64 e to belong to d 4e90: 69 66 66 65 72 65 6e 74 20 66 69 6c 65 73 7d 20 ifferent files} 4ea0: 5c 0a 09 20 20 20 20 7b 3a 20 49 74 73 20 74 61 \.. {: Its ta 4eb0: 67 73 20 73 68 61 72 65 20 66 69 6c 65 73 7d 20 gs share files} 4ec0: 7b 0a 09 09 53 45 4c 45 43 54 20 54 2e 6e 61 6d {...SELECT T.nam 4ed0: 65 2c 20 43 2e 63 69 64 0a 09 09 46 52 4f 4d 20 e, C.cid...FROM 4ee0: 20 20 63 68 61 6e 67 65 73 65 74 20 43 2c 20 63 changeset C, c 4ef0: 73 74 79 70 65 20 54 0a 09 09 57 48 45 52 45 20 stype T...WHERE 4f00: 20 43 2e 63 69 64 20 49 4e 20 28 53 45 4c 45 43 C.cid IN (SELEC 4f10: 54 20 56 56 2e 63 69 64 0a 09 09 09 09 20 46 52 T VV.cid..... FR 4f20: 4f 4d 20 28 53 45 4c 45 43 54 20 55 2e 63 69 64 OM (SELECT U.cid 4f30: 20 61 73 20 63 69 64 2c 20 43 4f 55 4e 54 20 28 as cid, COUNT ( 4f40: 55 2e 66 69 64 29 20 41 53 20 66 63 6f 75 6e 74 U.fid) AS fcount 4f50: 0a 09 09 09 09 20 20 20 20 20 20 20 46 52 4f 4d ..... FROM 4f60: 20 28 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 (SELECT DISTINC 4f70: 54 20 43 49 2e 63 69 64 20 41 53 20 63 69 64 2c T CI.cid AS cid, 4f80: 20 54 2e 66 69 64 20 41 53 20 66 69 64 0a 09 09 T.fid AS fid... 4f90: 09 09 09 20 20 20 20 20 46 52 4f 4d 20 20 20 63 ... FROM c 4fa0: 73 69 74 65 6d 20 43 49 2c 20 63 68 61 6e 67 65 sitem CI, change 4fb0: 73 65 74 20 43 2c 20 74 61 67 20 54 0a 09 09 09 set C, tag T.... 4fc0: 09 09 20 20 20 20 20 57 48 45 52 45 20 20 43 49 .. WHERE CI 4fd0: 2e 69 69 64 20 3d 20 54 2e 74 69 64 0a 09 09 09 .iid = T.tid.... 4fe0: 09 09 20 20 20 20 20 41 4e 44 20 20 20 20 43 2e .. AND C. 4ff0: 63 69 64 20 3d 20 43 49 2e 63 69 64 0a 09 09 09 cid = CI.cid.... 5000: 09 09 20 20 20 20 20 41 4e 44 20 20 20 20 43 2e .. AND C. 5010: 74 79 70 65 20 3d 20 31 0a 09 09 09 09 09 20 20 type = 1...... 5020: 20 20 20 29 20 41 53 20 55 0a 09 09 09 09 20 20 ) AS U..... 5030: 20 20 20 20 20 47 52 4f 55 50 20 42 59 20 55 2e GROUP BY U. 5040: 63 69 64 29 20 41 53 20 55 55 2c 0a 09 09 09 09 cid) AS UU,..... 5050: 20 20 20 20 20 20 28 53 45 4c 45 43 54 20 56 2e (SELECT V. 5060: 63 69 64 20 41 53 20 63 69 64 2c 20 43 4f 55 4e cid AS cid, COUN 5070: 54 20 28 56 2e 69 69 64 29 20 41 53 20 72 63 6f T (V.iid) AS rco 5080: 75 6e 74 0a 09 09 09 09 20 20 20 20 20 20 20 46 unt..... F 5090: 52 4f 4d 20 20 20 63 73 69 74 65 6d 20 56 2c 20 ROM csitem V, 50a0: 63 68 61 6e 67 65 73 65 74 20 58 0a 09 09 09 09 changeset X..... 50b0: 20 20 20 20 20 20 20 57 48 45 52 45 20 20 58 2e WHERE X. 50c0: 63 69 64 20 3d 20 56 2e 63 69 64 0a 09 09 09 09 cid = V.cid..... 50d0: 20 20 20 20 20 20 20 41 4e 44 20 20 20 20 58 2e AND X. 50e0: 74 79 70 65 20 3d 20 31 0a 09 09 09 09 20 20 20 type = 1..... 50f0: 20 20 20 20 47 52 4f 55 50 20 42 59 20 56 2e 63 GROUP BY V.c 5100: 69 64 29 20 41 53 20 56 56 0a 09 09 09 09 20 57 id) AS VV..... W 5110: 48 45 52 45 20 56 56 2e 63 69 64 20 3d 20 55 55 HERE VV.cid = UU 5120: 2e 63 69 64 0a 09 09 09 09 20 41 4e 44 20 20 20 .cid..... AND 5130: 55 55 2e 66 63 6f 75 6e 74 20 3c 20 56 56 2e 72 UU.fcount < VV.r 5140: 63 6f 75 6e 74 29 0a 09 09 41 4e 44 20 20 20 20 count)...AND 5150: 54 2e 74 69 64 20 3d 20 43 2e 74 79 70 65 0a 09 T.tid = C.type.. 5160: 20 20 20 20 7d 0a 09 72 65 74 75 72 6e 0a 20 20 }..return. 5170: 20 20 7d 0a 0a 20 20 20 20 70 72 6f 63 20 42 72 }.. proc Br 5180: 61 6e 63 68 43 68 61 6e 67 65 73 65 74 73 20 7b anchChangesets { 5190: 7d 20 7b 0a 09 23 20 54 68 69 73 20 63 6f 64 65 } {..# This code 51a0: 20 70 65 72 66 6f 72 6d 73 20 61 20 6e 75 6d 62 performs a numb 51b0: 65 72 20 6f 66 20 70 61 72 61 6e 6f 69 64 20 63 er of paranoid c 51c0: 68 65 63 6b 73 20 6f 66 20 74 68 65 0a 09 23 20 hecks of the..# 51d0: 64 61 74 61 62 61 73 65 2c 20 73 65 61 72 63 68 database, search 51e0: 69 6e 67 20 66 6f 72 20 69 6e 63 6f 6e 73 69 73 ing for inconsis 51f0: 74 65 6e 74 20 63 68 61 6e 67 65 73 65 74 2f 72 tent changeset/r 5200: 65 76 69 73 69 6f 6e 0a 09 23 20 69 6e 66 6f 72 evision..# infor 5210: 6d 61 74 69 6f 6e 2e 0a 0a 09 75 70 76 61 72 20 mation....upvar 5220: 31 20 6e 20 6e 20 3b 20 23 20 43 6f 75 6e 74 65 1 n n ; # Counte 5230: 72 20 66 6f 72 20 74 68 65 20 63 68 65 63 6b 73 r for the checks 5240: 20 28 77 65 20 70 72 69 6e 74 20 61 6e 20 69 64 (we print an id 5250: 20 62 65 66 6f 72 65 0a 09 09 20 20 20 20 20 20 before... 5260: 23 20 74 68 65 20 6d 61 69 6e 20 6c 61 62 65 6c # the main label 5270: 29 2e 0a 0a 09 23 20 46 69 6e 64 20 61 6c 6c 20 )....# Find all 5280: 62 72 61 6e 63 68 65 73 20 77 68 69 63 68 20 61 branches which a 5290: 72 65 20 6e 6f 74 20 75 73 65 64 20 62 79 20 61 re not used by a 52a0: 74 20 6c 65 61 73 74 20 6f 6e 65 0a 09 23 20 63 t least one..# c 52b0: 68 61 6e 67 65 73 65 74 2e 0a 09 43 68 65 63 6b hangeset...Check 52c0: 42 72 61 6e 63 68 20 5c 0a 09 20 20 20 20 7b 41 Branch \.. {A 52d0: 6c 6c 20 62 72 61 6e 63 68 65 73 20 68 61 76 65 ll branches have 52e0: 20 74 6f 20 62 65 20 75 73 65 64 20 62 79 20 6c to be used by l 52f0: 65 61 73 74 20 6f 6e 65 20 63 68 61 6e 67 65 73 east one changes 5300: 65 74 7d 20 5c 0a 09 20 20 20 20 7b 69 73 20 6e et} \.. {is n 5310: 6f 74 20 75 73 65 64 20 62 79 20 61 20 63 68 61 ot used by a cha 5320: 6e 67 65 73 65 74 7d 20 7b 0a 09 09 2d 2d 20 55 ngeset} {...-- U 5330: 6e 75 73 65 64 20 62 72 61 6e 63 68 65 73 20 3d nused branches = 5340: 20 41 6c 6c 20 62 72 61 6e 63 68 65 73 0a 09 09 All branches... 5350: 2d 2d 20 20 20 20 20 20 20 20 20 20 20 20 20 20 -- 5360: 20 20 20 2d 20 62 72 61 6e 63 68 65 73 20 75 73 - branches us 5370: 65 64 20 62 79 20 62 72 61 6e 63 68 20 63 68 61 ed by branch cha 5380: 6e 67 65 73 65 74 73 2e 0a 09 09 2d 2d 0a 09 09 ngesets....--... 5390: 2d 2d 20 42 6f 74 68 20 73 65 74 73 20 63 61 6e -- Both sets can 53a0: 20 62 65 20 63 6f 6d 70 75 74 65 64 20 65 61 73 be computed eas 53b0: 69 6c 79 2c 20 61 6e 64 20 73 75 62 74 72 61 63 ily, and subtrac 53c0: 74 65 64 0a 20 20 20 20 20 20 20 20 20 20 20 20 ted. 53d0: 20 20 20 20 2d 2d 20 66 72 6f 6d 20 65 61 63 68 -- from each 53e0: 20 6f 74 68 65 72 2e 20 54 68 65 6e 20 77 65 20 other. Then we 53f0: 63 61 6e 20 67 65 74 20 74 68 65 20 61 73 73 6f can get the asso 5400: 63 69 61 74 65 64 0a 20 20 20 20 20 20 20 20 20 ciated. 5410: 20 20 20 20 20 20 20 2d 2d 20 66 69 6c 65 20 28 -- file ( 5420: 6e 61 6d 65 29 20 66 6f 72 20 64 69 73 70 6c 61 name) for displa 5430: 79 2e 0a 0a 09 09 53 45 4c 45 43 54 20 50 2e 6e y.....SELECT P.n 5440: 61 6d 65 2c 20 53 2e 6e 61 6d 65 0a 09 09 46 52 ame, S.name...FR 5450: 4f 4d 20 70 72 6f 6a 65 63 74 20 50 2c 20 62 72 OM project P, br 5460: 61 6e 63 68 20 42 2c 20 73 79 6d 62 6f 6c 20 53 anch B, symbol S 5470: 0a 09 09 57 48 45 52 45 20 42 2e 62 69 64 20 49 ...WHERE B.bid I 5480: 4e 20 28 53 45 4c 45 43 54 20 62 69 64 20 20 20 N (SELECT bid 5490: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 54a0: 20 2d 2d 20 41 6c 6c 20 62 72 61 6e 63 68 65 73 -- All branches 54b0: 0a 09 09 09 09 46 52 4f 4d 20 20 20 62 72 61 6e .....FROM bran 54c0: 63 68 0a 09 09 09 09 45 58 43 45 50 54 20 20 20 ch.....EXCEPT 54d0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 54e0: 20 20 20 20 20 2d 2d 20 73 75 62 74 72 61 63 74 -- subtract 54f0: 0a 09 09 09 09 53 45 4c 45 43 54 20 43 49 2e 69 .....SELECT CI.i 5500: 69 64 20 20 20 20 20 20 20 20 20 20 20 20 20 20 id 5510: 20 20 20 2d 2d 20 62 72 61 6e 63 68 65 73 20 75 -- branches u 5520: 73 65 64 0a 09 09 09 09 46 52 4f 4d 20 20 20 63 sed.....FROM c 5530: 73 69 74 65 6d 20 43 49 2c 20 63 68 61 6e 67 65 sitem CI, change 5540: 73 65 74 20 43 0a 09 09 09 09 57 48 45 52 45 20 set C.....WHERE 5550: 20 43 2e 63 69 64 20 3d 20 43 49 2e 63 69 64 20 C.cid = CI.cid 5560: 20 20 20 20 20 20 20 20 2d 2d 20 62 79 20 61 6e -- by an 5570: 79 20 62 72 61 6e 63 68 0a 09 09 09 09 41 4e 44 y branch.....AND 5580: 20 20 20 20 43 2e 74 79 70 65 20 3d 20 32 29 20 C.type = 2) 5590: 20 20 20 20 20 20 20 20 20 20 20 2d 2d 20 63 68 -- ch 55a0: 61 6e 67 65 73 65 74 0a 09 09 41 4e 44 20 20 20 angeset...AND 55b0: 53 2e 73 69 64 20 3d 20 42 2e 73 69 64 20 20 20 S.sid = B.sid 55c0: 20 20 20 20 20 20 20 20 20 20 20 20 2d 2d 20 67 -- g 55d0: 65 74 20 73 79 6d 62 6f 6c 20 6f 66 20 62 72 61 et symbol of bra 55e0: 6e 63 68 0a 09 09 41 4e 44 20 20 20 50 2e 70 69 nch...AND P.pi 55f0: 64 20 3d 20 53 2e 70 69 64 20 20 20 20 20 20 20 d = S.pid 5600: 20 20 20 20 20 20 20 20 2d 2d 20 67 65 74 20 70 -- get p 5610: 72 6f 6a 65 63 74 20 6f 66 20 73 79 6d 62 6f 6c roject of symbol 5620: 0a 09 20 20 20 20 7d 0a 09 23 20 46 69 6e 64 20 .. }..# Find 5630: 61 6c 6c 20 62 72 61 6e 63 68 65 73 20 77 68 69 all branches whi 5640: 63 68 20 61 72 65 20 75 73 65 64 20 62 79 20 6d ch are used by m 5650: 6f 72 65 20 74 68 61 6e 20 6f 6e 65 20 63 68 61 ore than one cha 5660: 6e 67 65 73 65 74 2e 0a 09 43 68 65 63 6b 52 65 ngeset...CheckRe 5670: 76 20 5c 0a 09 20 20 20 20 7b 41 6c 6c 20 62 72 v \.. {All br 5680: 61 6e 63 68 65 73 20 68 61 76 65 20 74 6f 20 62 anches have to b 5690: 65 20 75 73 65 64 20 62 79 20 61 74 20 6d 6f 73 e used by at mos 56a0: 74 20 6f 6e 65 20 63 68 61 6e 67 65 73 65 74 7d t one changeset} 56b0: 20 5c 0a 09 20 20 20 20 7b 69 73 20 75 73 65 64 \.. {is used 56c0: 20 62 79 20 6d 75 6c 74 69 70 6c 65 20 63 68 61 by multiple cha 56d0: 6e 67 65 73 65 74 73 7d 20 7b 0a 09 09 2d 2d 20 ngesets} {...-- 56e0: 50 72 69 6e 63 69 70 6c 65 20 6f 66 20 6f 70 65 Principle of ope 56f0: 72 61 74 69 6f 6e 3a 20 47 65 74 20 61 6c 6c 20 ration: Get all 5700: 62 72 61 6e 63 68 2f 63 68 61 6e 67 65 73 65 74 branch/changeset 5710: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 . 5720: 20 2d 2d 20 70 61 69 72 73 20 66 6f 72 20 61 6c -- pairs for al 5730: 6c 20 62 72 61 6e 63 68 20 63 68 61 6e 67 65 73 l branch changes 5740: 65 74 73 2c 20 67 72 6f 75 70 20 62 79 20 74 61 ets, group by ta 5750: 67 20 74 6f 0a 20 20 20 20 20 20 20 20 20 20 20 g to. 5760: 20 20 20 20 20 2d 2d 20 61 67 67 72 65 67 61 74 -- aggregat 5770: 65 20 74 68 65 20 63 68 61 6e 67 65 73 65 74 2c e the changeset, 5780: 20 63 6f 75 6e 74 69 6e 67 20 74 68 65 6d 2e 20 counting them. 5790: 46 72 6f 6d 20 74 68 65 0a 20 20 20 20 20 20 20 From the. 57a0: 20 20 20 20 20 20 20 20 20 2d 2d 20 72 65 73 75 -- resu 57b0: 6c 74 69 6e 67 20 62 72 61 6e 63 68 2f 63 6f 75 lting branch/cou 57c0: 6e 74 20 74 61 62 6c 65 20 73 65 6c 65 63 74 20 nt table select 57d0: 74 68 6f 73 65 20 77 69 74 68 20 6d 6f 72 65 0a those with more. 57e0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 57f0: 2d 2d 20 74 68 61 6e 20 6f 6e 65 20 75 73 65 72 -- than one user 5800: 2c 20 61 6e 64 20 67 65 74 20 74 68 65 69 72 20 , and get their 5810: 61 73 73 6f 63 69 61 74 65 64 20 66 69 6c 65 20 associated file 5820: 28 6e 61 6d 65 29 0a 20 20 20 20 20 20 20 20 20 (name). 5830: 20 20 20 20 20 20 20 2d 2d 20 66 6f 72 20 64 69 -- for di 5840: 73 70 6c 61 79 2e 0a 0a 09 09 53 45 4c 45 43 54 splay.....SELECT 5850: 20 50 2e 6e 61 6d 65 2c 20 53 2e 6e 61 6d 65 0a P.name, S.name. 5860: 09 09 46 52 4f 4d 20 62 72 61 6e 63 68 20 42 2c ..FROM branch B, 5870: 20 70 72 6f 6a 65 63 74 20 50 2c 20 73 79 6d 62 project P, symb 5880: 6f 6c 20 53 2c 0a 09 09 20 20 20 20 20 28 53 45 ol S,... (SE 5890: 4c 45 43 54 20 43 49 2e 69 69 64 20 41 53 20 69 LECT CI.iid AS i 58a0: 69 64 2c 20 63 6f 75 6e 74 28 43 49 2e 63 69 64 id, count(CI.cid 58b0: 29 20 41 53 20 63 6f 75 6e 74 0a 09 09 20 20 20 ) AS count... 58c0: 20 20 20 46 52 4f 4d 20 63 73 69 74 65 6d 20 43 FROM csitem C 58d0: 49 2c 20 63 68 61 6e 67 65 73 65 74 20 43 0a 09 I, changeset C.. 58e0: 09 20 20 20 20 20 20 57 48 45 52 45 20 43 2e 74 . WHERE C.t 58f0: 79 70 65 20 3d 20 32 0a 09 09 20 20 20 20 20 20 ype = 2... 5900: 41 4e 44 20 20 20 43 2e 63 69 64 20 3d 20 43 49 AND C.cid = CI 5910: 2e 63 69 64 0a 09 09 20 20 20 20 20 20 47 52 4f .cid... GRO 5920: 55 50 20 42 59 20 43 49 2e 69 69 64 20 29 20 41 UP BY CI.iid ) A 5930: 53 20 55 0a 09 09 57 48 45 52 45 20 55 2e 63 6f S U...WHERE U.co 5940: 75 6e 74 20 3e 20 31 0a 09 09 41 4e 44 20 20 20 unt > 1...AND 5950: 42 2e 62 69 64 20 3d 20 55 2e 69 69 64 0a 09 09 B.bid = U.iid... 5960: 41 4e 44 20 20 20 53 2e 73 69 64 20 3d 20 42 2e AND S.sid = B. 5970: 73 69 64 20 20 20 20 20 20 20 20 20 20 20 20 20 sid 5980: 20 20 2d 2d 20 67 65 74 20 73 79 6d 62 6f 6c 20 -- get symbol 5990: 6f 66 20 62 72 61 6e 63 68 0a 09 09 41 4e 44 20 of branch...AND 59a0: 20 20 50 2e 70 69 64 20 3d 20 53 2e 70 69 64 20 P.pid = S.pid 59b0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2d 2d -- 59c0: 20 67 65 74 20 70 72 6f 6a 65 63 74 20 6f 66 20 get project of 59d0: 73 79 6d 62 6f 6c 0a 09 20 20 20 20 7d 0a 09 69 symbol.. }..i 59e0: 66 20 30 20 7b 0a 09 20 20 20 20 23 20 54 68 69 f 0 {.. # Thi 59f0: 73 20 63 68 65 63 6b 20 68 61 73 20 62 65 65 6e s check has been 5a00: 20 64 69 73 61 62 6c 65 64 2e 20 57 68 65 6e 20 disabled. When 5a10: 74 68 65 20 63 6f 6e 76 65 72 74 65 72 20 77 61 the converter wa 5a20: 73 20 72 75 6e 0a 09 20 20 20 20 23 20 6f 6e 20 s run.. # on 5a30: 74 68 65 20 54 63 6c 20 43 56 53 20 73 65 76 65 the Tcl CVS seve 5a40: 72 61 6c 20 62 72 61 6e 63 68 65 73 20 74 72 69 ral branches tri 5a50: 70 70 65 64 20 74 68 69 73 0a 09 20 20 20 20 23 pped this.. # 5a60: 20 63 6f 6e 73 74 72 61 69 6e 74 2e 20 4f 6e 65 constraint. One 5a70: 20 6f 66 20 74 68 65 6d 20 77 61 73 20 61 20 66 of them was a f 5a80: 72 65 65 2d 66 6c 6f 61 74 69 6e 67 20 62 72 61 ree-floating bra 5a90: 6e 63 68 2c 20 61 6e 64 0a 09 20 20 20 20 23 20 nch, and.. # 5aa0: 69 74 73 20 68 61 6e 64 6c 69 6e 67 20 68 61 73 its handling has 5ab0: 20 62 65 65 6e 20 66 69 78 65 64 20 62 79 20 6e been fixed by n 5ac0: 6f 77 2e 20 54 68 65 20 6f 74 68 65 72 73 20 68 ow. The others h 5ad0: 6f 77 65 76 65 72 0a 09 20 20 20 20 23 20 73 65 owever.. # se 5ae0: 65 6d 20 73 65 6d 69 2d 6c 65 67 69 74 69 6d 61 em semi-legitima 5af0: 74 65 2c 20 69 6e 20 74 68 65 20 73 65 6e 73 65 te, in the sense 5b00: 20 74 68 61 74 20 74 68 65 79 20 73 68 6f 77 0a that they show. 5b10: 09 20 20 20 20 23 20 69 6e 63 6f 6e 73 69 73 74 . # inconsist 5b20: 65 6e 63 69 65 73 20 69 6e 20 74 68 65 20 43 56 encies in the CV 5b30: 53 20 68 69 73 74 6f 72 79 20 74 68 65 20 75 73 S history the us 5b40: 65 72 20 69 73 20 6e 6f 74 0a 09 20 20 20 20 23 er is not.. # 5b50: 20 72 65 61 6c 6c 79 20 61 62 6c 65 20 74 6f 20 really able to 5b60: 73 6f 6c 76 65 2c 20 62 75 74 20 69 74 20 6d 69 solve, but it mi 5b70: 67 68 74 20 62 65 20 70 6f 73 73 69 62 6c 65 20 ght be possible 5b80: 74 6f 20 73 69 6d 70 6c 79 0a 09 20 20 20 20 23 to simply.. # 5b90: 20 69 67 6e 6f 72 65 20 74 68 65 6d 2e 0a 0a 09 ignore them.... 5ba0: 20 20 20 20 23 20 46 6f 72 20 65 78 61 6d 70 6c # For exampl 5bb0: 65 20 69 6e 20 54 63 6c 20 77 65 20 68 61 76 65 e in Tcl we have 5bc0: 20 61 20 62 72 61 6e 63 68 20 58 20 77 69 74 68 a branch X with 5bd0: 20 61 20 70 72 65 66 65 72 65 64 0a 09 20 20 20 a prefered.. 5be0: 20 23 20 70 61 72 65 6e 74 20 59 2c 20 65 78 63 # parent Y, exc 5bf0: 65 70 74 20 66 6f 72 20 61 20 73 69 6e 67 6c 65 ept for a single 5c00: 20 66 69 6c 65 20 77 68 65 72 65 20 74 68 65 20 file where the 5c10: 70 72 65 66 65 72 65 64 0a 09 20 20 20 20 23 20 prefered.. # 5c20: 70 61 72 65 6e 74 20 73 65 65 6d 73 20 74 6f 20 parent seems to 5c30: 62 65 20 63 72 65 61 74 65 64 20 61 66 74 65 72 be created after 5c40: 20 69 74 73 20 63 75 72 72 65 6e 74 20 70 61 72 its current par 5c50: 65 6e 74 2c 0a 09 20 20 20 20 23 20 6d 61 6b 69 ent,.. # maki 5c60: 6e 67 20 72 65 2d 70 61 72 65 6e 74 69 6e 67 20 ng re-parenting 5c70: 69 6d 70 6f 73 73 69 62 6c 65 2e 20 48 6f 77 65 impossible. Howe 5c80: 76 65 72 20 77 65 20 6d 61 79 20 62 65 20 61 62 ver we may be ab 5c90: 6c 65 0a 09 20 20 20 20 23 20 74 6f 20 69 67 6e le.. # to ign 5ca0: 6f 72 65 20 74 68 69 73 2c 20 69 74 20 73 68 6f ore this, it sho 5cb0: 75 6c 64 20 6f 6e 6c 79 20 63 61 75 73 65 20 74 uld only cause t 5cc0: 68 65 20 62 72 61 6e 63 68 20 74 6f 20 68 61 76 he branch to hav 5cd0: 65 0a 09 20 20 20 20 23 20 6d 6f 72 65 20 74 68 e.. # more th 5ce0: 61 6e 20 6f 6e 65 20 70 72 65 64 65 63 65 73 73 an one predecess 5cf0: 6f 72 2c 20 61 6e 64 20 73 68 69 66 74 69 6e 67 or, and shifting 5d00: 20 69 74 20 61 72 6f 75 6e 64 20 69 6e 20 74 68 it around in th 5d10: 65 0a 09 20 20 20 20 23 20 63 6f 6d 6d 69 74 20 e.. # commit 5d20: 6f 72 64 65 72 2e 20 54 68 65 20 62 61 63 6b 65 order. The backe 5d30: 6e 64 20 77 6f 75 6c 64 20 73 74 69 6c 6c 20 75 nd would still u 5d40: 73 65 20 74 68 65 20 70 72 65 66 65 72 65 64 0a se the prefered. 5d50: 09 20 20 20 20 23 20 70 61 72 65 6e 74 20 66 6f . # parent fo 5d60: 72 20 74 68 65 20 61 74 74 61 63 68 6d 65 6e 74 r the attachment 5d70: 20 70 6f 69 6e 74 20 69 6e 20 66 6f 73 73 69 6c point in fossil 5d80: 2e 0a 0a 09 20 20 20 20 23 20 53 6f 2c 20 66 6f .... # So, fo 5d90: 72 20 6e 6f 77 20 49 20 68 61 76 65 20 64 65 63 r now I have dec 5da0: 69 64 65 64 20 74 6f 20 64 69 73 61 62 6c 65 20 ided to disable 5db0: 74 68 69 73 20 61 6e 64 20 70 72 65 73 73 0a 09 this and press.. 5dc0: 20 20 20 20 23 20 66 6f 72 77 61 72 64 2e 20 4f # forward. O 5dd0: 66 20 63 6f 75 72 73 65 2c 20 69 66 20 77 65 20 f course, if we 5de0: 72 75 6e 20 69 6e 74 6f 20 61 63 74 75 61 6c 20 run into actual 5df0: 74 72 6f 75 62 6c 65 20 77 65 0a 09 20 20 20 20 trouble we.. 5e00: 23 20 77 69 6c 6c 20 68 61 76 65 20 74 6f 20 67 # will have to g 5e10: 6f 20 62 61 63 6b 20 68 65 72 65 20 73 65 65 20 o back here see 5e20: 77 68 61 74 20 63 61 6e 20 62 65 20 64 6f 6e 65 what can be done 5e30: 20 74 6f 20 66 69 78 0a 09 20 20 20 20 23 20 74 to fix.. # t 5e40: 68 69 73 2e 20 45 76 65 6e 20 69 66 20 6f 6e 6c his. Even if onl 5e50: 79 20 67 69 76 69 6e 67 20 74 68 65 20 75 73 65 y giving the use 5e60: 72 20 74 68 65 20 69 6e 73 74 72 75 63 74 69 6f r the instructio 5e70: 6e 20 68 6f 77 0a 09 20 20 20 20 23 20 74 6f 20 n how.. # to 5e80: 65 64 69 74 20 74 68 65 20 43 56 53 20 72 65 70 edit the CVS rep 5e90: 6f 73 69 74 6f 72 79 20 74 6f 20 72 65 6d 6f 76 ository to remov 5ea0: 65 20 74 68 65 20 69 6e 63 6f 6e 73 69 73 74 65 e the inconsiste 5eb0: 6e 63 79 2e 0a 0a 09 20 20 20 20 23 20 41 6c 6c ncy.... # All 5ec0: 20 62 72 61 6e 63 68 65 73 20 68 61 76 65 20 74 branches have t 5ed0: 6f 20 61 67 72 65 65 20 6f 6e 20 74 68 65 20 4c o agree on the L 5ee0: 4f 44 20 74 68 65 69 72 20 63 68 61 6e 67 65 73 OD their changes 5ef0: 65 74 0a 09 20 20 20 20 23 20 62 65 6c 6f 6e 67 et.. # belong 5f00: 73 20 74 6f 2e 20 49 6e 20 6f 74 68 65 72 20 77 s to. In other w 5f10: 6f 72 64 73 2c 20 61 6c 6c 20 62 72 61 6e 63 68 ords, all branch 5f20: 65 73 20 69 6e 20 61 20 63 68 61 6e 67 65 73 65 es in a changese 5f30: 74 0a 09 20 20 20 20 23 20 68 61 76 65 20 74 6f t.. # have to 5f40: 20 72 65 66 65 72 20 74 6f 20 74 68 65 20 73 61 refer to the sa 5f50: 6d 65 20 6c 69 6e 65 20 6f 66 20 64 65 76 65 6c me line of devel 5f60: 6f 70 6d 65 6e 74 2e 0a 09 20 20 20 20 23 0a 09 opment... #.. 5f70: 20 20 20 20 23 20 49 6e 73 74 65 61 64 20 6f 66 # Instead of 5f80: 20 6c 6f 6f 6b 69 6e 67 20 61 74 20 61 6c 6c 20 looking at all 5f90: 70 61 69 72 73 20 6f 66 20 62 72 61 6e 63 68 65 pairs of branche 5fa0: 73 20 69 6e 20 61 6c 6c 0a 09 20 20 20 20 23 20 s in all.. # 5fb0: 63 68 61 6e 67 65 73 65 74 73 20 77 65 20 67 65 changesets we ge 5fc0: 6e 65 72 61 74 65 20 74 68 65 20 64 69 73 74 69 nerate the disti 5fd0: 6e 63 74 20 73 65 74 20 6f 66 20 61 6c 6c 20 4c nct set of all L 5fe0: 4f 44 73 0a 09 20 20 20 20 23 20 72 65 66 65 72 ODs.. # refer 5ff0: 65 6e 63 65 64 20 62 79 20 74 68 65 20 62 72 61 enced by the bra 6000: 6e 63 68 65 73 20 6f 66 20 61 20 63 68 61 6e 67 nches of a chang 6010: 65 73 65 74 2c 20 6c 6f 6f 6b 20 66 6f 72 0a 09 eset, look for.. 6020: 20 20 20 20 23 20 74 68 6f 73 65 20 77 69 74 68 # those with 6030: 20 63 61 72 64 69 6e 61 6c 69 74 79 20 3e 20 31 cardinality > 1 6040: 2c 20 61 6e 64 20 67 65 74 20 74 68 65 20 69 64 , and get the id 6050: 65 6e 74 69 66 79 69 6e 67 0a 09 20 20 20 20 23 entifying.. # 6060: 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 66 6f 72 information for 6070: 20 74 68 65 20 63 68 61 6e 67 65 73 65 74 73 20 the changesets 6080: 66 6f 75 6e 64 20 74 68 75 73 6c 79 2e 0a 09 20 found thusly... 6090: 20 20 20 43 68 65 63 6b 43 53 20 5c 0a 09 09 7b CheckCS \...{ 60a0: 41 6c 6c 20 62 72 61 6e 63 68 65 73 20 69 6e 20 All branches in 60b0: 61 20 63 68 61 6e 67 65 73 65 74 20 68 61 76 65 a changeset have 60c0: 20 74 6f 20 62 65 6c 6f 6e 67 20 74 6f 20 74 68 to belong to th 60d0: 65 20 73 61 6d 65 20 4c 4f 44 7d 20 5c 0a 09 09 e same LOD} \... 60e0: 7b 3a 20 49 74 73 20 62 72 61 6e 63 68 65 73 20 {: Its branches 60f0: 64 69 73 61 67 72 65 65 20 61 62 6f 75 74 20 74 disagree about t 6100: 68 65 20 4c 4f 44 20 74 68 65 79 20 62 65 6c 6f he LOD they belo 6110: 6e 67 20 74 6f 7d 20 7b 0a 09 09 20 20 20 20 53 ng to} {... S 6120: 45 4c 45 43 54 20 54 2e 6e 61 6d 65 2c 20 43 2e ELECT T.name, C. 6130: 63 69 64 0a 09 09 20 20 20 20 46 52 4f 4d 20 20 cid... FROM 6140: 20 63 68 61 6e 67 65 73 65 74 20 43 2c 20 63 73 changeset C, cs 6150: 74 79 70 65 20 54 0a 09 09 20 20 20 20 57 48 45 type T... WHE 6160: 52 45 20 20 43 2e 63 69 64 20 49 4e 20 28 53 45 RE C.cid IN (SE 6170: 4c 45 43 54 20 55 2e 63 69 64 0a 09 09 09 09 20 LECT U.cid..... 6180: 20 20 20 20 46 52 4f 4d 20 28 53 45 4c 45 43 54 FROM (SELECT 6190: 20 44 49 53 54 49 4e 43 54 20 43 49 2e 63 69 64 DISTINCT CI.cid 61a0: 20 41 53 20 63 69 64 2c 20 42 2e 6c 6f 64 20 41 AS cid, B.lod A 61b0: 53 20 6c 6f 64 0a 09 09 09 09 09 20 20 20 46 52 S lod...... FR 61c0: 4f 4d 20 20 20 63 73 69 74 65 6d 20 43 49 2c 20 OM csitem CI, 61d0: 63 68 61 6e 67 65 73 65 74 20 43 2c 20 62 72 61 changeset C, bra 61e0: 6e 63 68 20 42 0a 09 09 09 09 09 20 20 20 57 48 nch B...... WH 61f0: 45 52 45 20 20 43 49 2e 69 69 64 20 3d 20 42 2e ERE CI.iid = B. 6200: 62 69 64 0a 09 09 09 09 09 20 20 20 41 4e 44 20 bid...... AND 6210: 20 20 20 43 2e 63 69 64 20 3d 20 43 49 2e 63 69 C.cid = CI.ci 6220: 64 0a 09 09 09 09 09 20 20 20 41 4e 44 20 20 20 d...... AND 6230: 20 43 2e 74 79 70 65 20 3d 20 32 29 20 41 53 20 C.type = 2) AS 6240: 55 0a 09 09 09 09 20 20 20 20 20 47 52 4f 55 50 U..... GROUP 6250: 20 42 59 20 55 2e 63 69 64 20 48 41 56 49 4e 47 BY U.cid HAVING 6260: 20 43 4f 55 4e 54 28 55 2e 6c 6f 64 29 20 3e 20 COUNT(U.lod) > 6270: 31 29 0a 09 09 20 20 20 20 41 4e 44 20 20 20 20 1)... AND 6280: 54 2e 74 69 64 20 3d 20 43 2e 74 79 70 65 0a 09 T.tid = C.type.. 6290: 09 7d 0a 09 7d 0a 09 23 20 41 6c 6c 20 62 72 61 .}..}..# All bra 62a0: 6e 63 68 65 73 20 68 61 76 65 20 74 6f 20 61 67 nches have to ag 62b0: 72 65 65 20 6f 6e 20 74 68 65 20 70 72 6f 6a 65 ree on the proje 62c0: 63 74 20 74 68 65 69 72 20 63 68 61 6e 67 65 73 ct their changes 62d0: 65 74 0a 09 23 20 62 65 6c 6f 6e 67 73 20 74 6f et..# belongs to 62e0: 2e 20 49 6e 20 6f 74 68 65 72 20 77 6f 72 64 73 . In other words 62f0: 2c 20 61 6c 6c 20 62 72 61 6e 63 68 65 73 20 69 , all branches i 6300: 6e 20 61 20 63 68 61 6e 67 65 73 65 74 20 68 61 n a changeset ha 6310: 76 65 0a 09 23 20 74 6f 20 72 65 66 65 72 20 74 ve..# to refer t 6320: 6f 20 74 68 65 20 73 61 6d 65 20 70 72 6f 6a 65 o the same proje 6330: 63 74 2e 0a 09 23 0a 09 23 20 49 6e 73 74 65 61 ct...#..# Instea 6340: 64 20 6f 66 20 6c 6f 6f 6b 69 6e 67 20 61 74 20 d of looking at 6350: 61 6c 6c 20 70 61 69 72 73 20 6f 66 20 62 72 61 all pairs of bra 6360: 6e 63 68 65 73 20 69 6e 20 61 6c 6c 0a 09 23 20 nches in all..# 6370: 63 68 61 6e 67 65 73 65 74 73 20 77 65 20 67 65 changesets we ge 6380: 6e 65 72 61 74 65 20 74 68 65 20 64 69 73 74 69 nerate the disti 6390: 6e 63 74 20 73 65 74 20 6f 66 20 61 6c 6c 20 70 nct set of all p 63a0: 72 6f 6a 65 63 74 73 0a 09 23 20 72 65 66 65 72 rojects..# refer 63b0: 65 6e 63 65 64 20 62 79 20 74 68 65 20 62 72 61 enced by the bra 63c0: 6e 63 68 65 73 20 6f 66 20 61 20 63 68 61 6e 67 nches of a chang 63d0: 65 73 65 74 2c 20 6c 6f 6f 6b 20 66 6f 72 20 74 eset, look for t 63e0: 68 6f 73 65 0a 09 23 20 77 69 74 68 20 63 61 72 hose..# with car 63f0: 64 69 6e 61 6c 69 74 79 20 3e 20 31 2c 20 61 6e dinality > 1, an 6400: 64 20 67 65 74 20 74 68 65 20 69 64 65 6e 74 69 d get the identi 6410: 66 79 69 6e 67 20 69 6e 66 6f 72 6d 61 74 69 6f fying informatio 6420: 6e 0a 09 23 20 66 6f 72 20 74 68 65 20 63 68 61 n..# for the cha 6430: 6e 67 65 73 65 74 73 20 66 6f 75 6e 64 20 74 68 ngesets found th 6440: 75 73 6c 79 2e 0a 09 43 68 65 63 6b 43 53 20 5c usly...CheckCS \ 6450: 0a 09 20 20 20 20 7b 41 6c 6c 20 62 72 61 6e 63 .. {All branc 6460: 68 65 73 20 69 6e 20 61 20 63 68 61 6e 67 65 73 hes in a changes 6470: 65 74 20 68 61 76 65 20 74 6f 20 62 65 6c 6f 6e et have to belon 6480: 67 20 74 6f 20 74 68 65 20 73 61 6d 65 20 70 72 g to the same pr 6490: 6f 6a 65 63 74 7d 20 5c 0a 09 20 20 20 20 7b 3a oject} \.. {: 64a0: 20 49 74 73 20 62 72 61 6e 63 68 65 73 20 64 69 Its branches di 64b0: 73 61 67 72 65 65 20 61 62 6f 75 74 20 74 68 65 sagree about the 64c0: 20 70 72 6f 6a 65 63 74 20 74 68 65 79 20 62 65 project they be 64d0: 6c 6f 6e 67 20 74 6f 7d 20 7b 0a 09 09 53 45 4c long to} {...SEL 64e0: 45 43 54 20 54 2e 6e 61 6d 65 2c 20 43 2e 63 69 ECT T.name, C.ci 64f0: 64 0a 09 09 46 52 4f 4d 20 20 20 63 68 61 6e 67 d...FROM chang 6500: 65 73 65 74 20 43 2c 20 63 73 74 79 70 65 20 54 eset C, cstype T 6510: 0a 09 09 57 48 45 52 45 20 20 43 2e 63 69 64 20 ...WHERE C.cid 6520: 49 4e 20 28 53 45 4c 45 43 54 20 55 2e 63 69 64 IN (SELECT U.cid 6530: 0a 09 09 09 09 20 46 52 4f 4d 20 28 53 45 4c 45 ..... FROM (SELE 6540: 43 54 20 44 49 53 54 49 4e 43 54 20 43 49 2e 63 CT DISTINCT CI.c 6550: 69 64 20 41 53 20 63 69 64 2c 20 46 2e 70 69 64 id AS cid, F.pid 6560: 20 41 53 20 70 69 64 0a 09 09 09 09 20 20 20 20 AS pid..... 6570: 20 20 20 46 52 4f 4d 20 20 20 63 73 69 74 65 6d FROM csitem 6580: 20 43 49 2c 20 63 68 61 6e 67 65 73 65 74 20 43 CI, changeset C 6590: 2c 20 62 72 61 6e 63 68 20 42 2c 20 66 69 6c 65 , branch B, file 65a0: 20 46 0a 09 09 09 09 20 20 20 20 20 20 20 57 48 F..... WH 65b0: 45 52 45 20 20 43 49 2e 69 69 64 20 3d 20 42 2e ERE CI.iid = B. 65c0: 62 69 64 0a 09 09 09 09 20 20 20 20 20 20 20 41 bid..... A 65d0: 4e 44 20 20 20 20 43 2e 63 69 64 20 3d 20 43 49 ND C.cid = CI 65e0: 2e 63 69 64 0a 09 09 09 09 20 20 20 20 20 20 20 .cid..... 65f0: 41 4e 44 20 20 20 20 43 2e 74 79 70 65 20 3d 20 AND C.type = 6600: 32 0a 09 09 09 09 20 20 20 20 20 20 20 41 4e 44 2..... AND 6610: 20 20 20 20 46 2e 66 69 64 20 20 3d 20 42 2e 66 F.fid = B.f 6620: 69 64 29 20 41 53 20 55 0a 09 09 09 09 20 47 52 id) AS U..... GR 6630: 4f 55 50 20 42 59 20 55 2e 63 69 64 20 48 41 56 OUP BY U.cid HAV 6640: 49 4e 47 20 43 4f 55 4e 54 28 55 2e 70 69 64 29 ING COUNT(U.pid) 6650: 20 3e 20 31 29 0a 09 09 41 4e 44 20 20 20 20 54 > 1)...AND T 6660: 2e 74 69 64 20 3d 20 43 2e 74 79 70 65 0a 09 20 .tid = C.type.. 6670: 20 20 20 7d 0a 09 23 20 41 6c 6c 20 62 72 61 6e }..# All bran 6680: 63 68 65 73 20 69 6e 20 61 20 73 69 6e 67 6c 65 ches in a single 6690: 20 63 68 61 6e 67 65 73 65 74 20 68 61 76 65 20 changeset have 66a0: 74 6f 20 62 65 6c 6f 6e 67 20 74 6f 0a 09 23 20 to belong to..# 66b0: 64 69 66 66 65 72 65 6e 74 20 66 69 6c 65 73 2e different files. 66c0: 20 43 6f 6e 76 65 72 73 65 6c 79 3a 20 4e 6f 20 Conversely: No 66d0: 74 77 6f 20 62 72 61 6e 63 68 65 73 20 6f 66 20 two branches of 66e0: 61 20 73 69 6e 67 6c 65 0a 09 23 20 66 69 6c 65 a single..# file 66f0: 20 61 72 65 20 61 6c 6c 6f 77 65 64 20 74 6f 20 are allowed to 6700: 62 65 20 69 6e 20 74 68 65 20 73 61 6d 65 20 63 be in the same c 6710: 68 61 6e 67 65 73 65 74 2e 0a 09 23 0a 09 23 20 hangeset...#..# 6720: 49 6e 73 74 65 61 64 20 6f 66 20 6c 6f 6f 6b 69 Instead of looki 6730: 6e 67 20 61 74 20 61 6c 6c 20 70 61 69 72 73 20 ng at all pairs 6740: 6f 66 20 62 72 61 6e 63 68 65 73 20 69 6e 20 61 of branches in a 6750: 6c 6c 0a 09 23 20 63 68 61 6e 67 65 73 65 74 73 ll..# changesets 6760: 20 77 65 20 67 65 6e 65 72 61 74 65 20 74 68 65 we generate the 6770: 20 64 69 73 74 69 6e 63 74 20 73 65 74 20 6f 66 distinct set of 6780: 20 61 6c 6c 20 66 69 6c 65 73 0a 09 23 20 72 65 all files..# re 6790: 66 65 72 65 6e 63 65 64 20 62 79 20 74 68 65 20 ferenced by the 67a0: 62 72 61 6e 63 68 65 73 20 6f 66 20 61 20 63 68 branches of a ch 67b0: 61 6e 67 65 73 65 74 2c 20 61 6e 64 20 6c 6f 6f angeset, and loo 67c0: 6b 20 66 6f 72 0a 09 23 20 74 68 6f 73 65 20 77 k for..# those w 67d0: 69 74 68 20 63 61 72 64 69 6e 61 6c 69 74 79 20 ith cardinality 67e0: 3c 20 74 68 65 20 63 61 72 64 69 6e 61 6c 69 74 < the cardinalit 67f0: 79 20 6f 66 20 74 68 65 20 73 65 74 20 6f 66 0a y of the set of. 6800: 09 23 20 62 72 61 6e 63 68 65 73 2c 20 61 6e 64 .# branches, and 6810: 20 67 65 74 20 74 68 65 20 69 64 65 6e 74 69 66 get the identif 6820: 79 69 6e 67 20 69 6e 66 6f 72 6d 61 74 69 6f 6e ying information 6830: 20 66 6f 72 20 74 68 65 0a 09 23 20 63 68 61 6e for the..# chan 6840: 67 65 73 65 74 73 20 66 6f 75 6e 64 20 74 68 75 gesets found thu 6850: 73 6c 79 2e 0a 09 43 68 65 63 6b 43 53 20 5c 0a sly...CheckCS \. 6860: 09 20 20 20 20 7b 41 6c 6c 20 62 72 61 6e 63 68 . {All branch 6870: 65 73 20 69 6e 20 61 20 63 68 61 6e 67 65 73 65 es in a changese 6880: 74 20 68 61 76 65 20 74 6f 20 62 65 6c 6f 6e 67 t have to belong 6890: 20 74 6f 20 64 69 66 66 65 72 65 6e 74 20 66 69 to different fi 68a0: 6c 65 73 7d 20 5c 0a 09 20 20 20 20 7b 3a 20 49 les} \.. {: I 68b0: 74 73 20 62 72 61 6e 63 68 65 73 20 73 68 61 72 ts branches shar 68c0: 65 20 66 69 6c 65 73 7d 20 7b 0a 09 09 53 45 4c e files} {...SEL 68d0: 45 43 54 20 54 2e 6e 61 6d 65 2c 20 43 2e 63 69 ECT T.name, C.ci 68e0: 64 0a 09 09 46 52 4f 4d 20 20 20 63 68 61 6e 67 d...FROM chang 68f0: 65 73 65 74 20 43 2c 20 63 73 74 79 70 65 20 54 eset C, cstype T 6900: 0a 09 09 57 48 45 52 45 20 20 43 2e 63 69 64 20 ...WHERE C.cid 6910: 49 4e 20 28 53 45 4c 45 43 54 20 56 56 2e 63 69 IN (SELECT VV.ci 6920: 64 0a 09 09 09 09 20 46 52 4f 4d 20 28 53 45 4c d..... FROM (SEL 6930: 45 43 54 20 55 2e 63 69 64 20 61 73 20 63 69 64 ECT U.cid as cid 6940: 2c 20 43 4f 55 4e 54 20 28 55 2e 66 69 64 29 20 , COUNT (U.fid) 6950: 41 53 20 66 63 6f 75 6e 74 0a 09 09 09 09 20 20 AS fcount..... 6960: 20 20 20 20 20 46 52 4f 4d 20 28 53 45 4c 45 43 FROM (SELEC 6970: 54 20 44 49 53 54 49 4e 43 54 20 43 49 2e 63 69 T DISTINCT CI.ci 6980: 64 20 41 53 20 63 69 64 2c 20 42 2e 66 69 64 20 d AS cid, B.fid 6990: 41 53 20 66 69 64 0a 09 09 09 09 09 20 20 20 20 AS fid...... 69a0: 20 46 52 4f 4d 20 20 20 63 73 69 74 65 6d 20 43 FROM csitem C 69b0: 49 2c 20 63 68 61 6e 67 65 73 65 74 20 43 2c 20 I, changeset C, 69c0: 62 72 61 6e 63 68 20 42 0a 09 09 09 09 09 20 20 branch B...... 69d0: 20 20 20 57 48 45 52 45 20 20 43 49 2e 69 69 64 WHERE CI.iid 69e0: 20 3d 20 42 2e 62 69 64 0a 09 09 09 09 09 20 20 = B.bid...... 69f0: 20 20 20 41 4e 44 20 20 20 20 43 2e 63 69 64 20 AND C.cid 6a00: 3d 20 43 49 2e 63 69 64 0a 09 09 09 09 09 20 20 = CI.cid...... 6a10: 20 20 20 41 4e 44 20 20 20 20 43 2e 74 79 70 65 AND C.type 6a20: 20 3d 20 32 0a 09 09 09 09 09 20 20 20 20 20 29 = 2...... ) 6a30: 20 41 53 20 55 0a 09 09 09 09 20 20 20 20 20 20 AS U..... 6a40: 20 47 52 4f 55 50 20 42 59 20 55 2e 63 69 64 29 GROUP BY U.cid) 6a50: 20 41 53 20 55 55 2c 0a 09 09 09 09 20 20 20 20 AS UU,..... 6a60: 20 20 28 53 45 4c 45 43 54 20 56 2e 63 69 64 20 (SELECT V.cid 6a70: 41 53 20 63 69 64 2c 20 43 4f 55 4e 54 20 28 56 AS cid, COUNT (V 6a80: 2e 69 69 64 29 20 41 53 20 72 63 6f 75 6e 74 0a .iid) AS rcount. 6a90: 09 09 09 09 20 20 20 20 20 20 20 46 52 4f 4d 20 .... FROM 6aa0: 20 20 63 73 69 74 65 6d 20 56 2c 20 63 68 61 6e csitem V, chan 6ab0: 67 65 73 65 74 20 58 0a 09 09 09 09 20 20 20 20 geset X..... 6ac0: 20 20 20 57 48 45 52 45 20 20 58 2e 63 69 64 20 WHERE X.cid 6ad0: 3d 20 56 2e 63 69 64 0a 09 09 09 09 20 20 20 20 = V.cid..... 6ae0: 20 20 20 41 4e 44 20 20 20 20 58 2e 74 79 70 65 AND X.type 6af0: 20 3d 20 32 0a 09 09 09 09 20 20 20 20 20 20 20 = 2..... 6b00: 47 52 4f 55 50 20 42 59 20 56 2e 63 69 64 29 20 GROUP BY V.cid) 6b10: 41 53 20 56 56 0a 09 09 09 09 20 57 48 45 52 45 AS VV..... WHERE 6b20: 20 56 56 2e 63 69 64 20 3d 20 55 55 2e 63 69 64 VV.cid = UU.cid 6b30: 0a 09 09 09 09 20 41 4e 44 20 20 20 55 55 2e 66 ..... AND UU.f 6b40: 63 6f 75 6e 74 20 3c 20 56 56 2e 72 63 6f 75 6e count < VV.rcoun 6b50: 74 29 0a 09 09 41 4e 44 20 20 20 20 54 2e 74 69 t)...AND T.ti 6b60: 64 20 3d 20 43 2e 74 79 70 65 0a 09 20 20 20 20 d = C.type.. 6b70: 7d 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a }..return. }. 6b80: 0a 20 20 20 20 70 72 6f 63 20 5f 5f 5f 55 6e 75 . proc ___Unu 6b90: 73 65 64 43 68 61 6e 67 65 73 65 74 43 68 65 63 sedChangesetChec 6ba0: 6b 73 5f 5f 5f 20 7b 7d 20 7b 0a 09 23 20 54 68 ks___ {} {..# Th 6bb0: 69 73 20 63 6f 64 65 20 70 65 72 66 6f 72 6d 73 is code performs 6bc0: 20 61 20 6e 75 6d 62 65 72 20 6f 66 20 70 61 72 a number of par 6bd0: 61 6e 6f 69 64 20 63 68 65 63 6b 73 20 6f 66 20 anoid checks of 6be0: 74 68 65 0a 09 23 20 64 61 74 61 62 61 73 65 2c the..# database, 6bf0: 20 73 65 61 72 63 68 69 6e 67 20 66 6f 72 20 69 searching for i 6c00: 6e 63 6f 6e 73 69 73 74 65 6e 74 20 63 68 61 6e nconsistent chan 6c10: 67 65 73 65 74 2f 72 65 76 69 73 69 6f 6e 0a 09 geset/revision.. 6c20: 23 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 2e 0a 0a # information... 6c30: 09 72 65 74 75 72 6e 20 3b 20 23 20 44 69 73 61 .return ; # Disa 6c40: 62 6c 65 64 20 66 6f 72 20 6e 6f 77 2c 20 62 6f bled for now, bo 6c50: 74 74 6c 65 6e 65 63 6b 73 20 2e 2e 2e 0a 0a 09 ttlenecks ...... 6c60: 75 70 76 61 72 20 31 20 6e 20 6e 20 3b 20 23 20 upvar 1 n n ; # 6c70: 43 6f 75 6e 74 65 72 20 66 6f 72 20 74 68 65 20 Counter for the 6c80: 63 68 65 63 6b 73 20 28 77 65 20 70 72 69 6e 74 checks (we print 6c90: 20 61 6e 20 69 64 20 62 65 66 6f 72 65 0a 09 09 an id before... 6ca0: 20 20 20 20 20 20 23 20 74 68 65 20 6d 61 69 6e # the main 6cb0: 20 6c 61 62 65 6c 29 2e 0a 0a 09 23 20 54 68 65 label)....# The 6cc0: 20 6e 65 78 74 20 74 77 6f 20 63 68 65 63 6b 73 next two checks 6cd0: 20 61 72 65 20 42 4f 54 54 4c 45 4e 45 43 4b 53 are BOTTLENECKS 6ce0: 2e 20 49 6e 20 65 73 73 65 6e 63 65 20 77 65 20 . In essence we 6cf0: 61 72 65 0a 09 23 20 63 68 65 63 6b 69 6e 67 20 are..# checking 6d00: 65 61 63 68 20 73 79 6d 62 6f 6c 20 63 68 61 6e each symbol chan 6d10: 67 65 73 65 74 20 6f 6e 65 20 62 79 20 6f 6e 65 geset one by one 6d20: 2e 0a 0a 09 23 20 54 4f 44 4f 3a 20 54 72 79 20 ....# TODO: Try 6d30: 74 6f 20 72 65 70 68 72 61 73 65 20 74 68 65 20 to rephrase the 6d40: 63 68 65 63 6b 73 20 74 6f 20 6d 61 6b 65 20 6d checks to make m 6d50: 6f 72 65 20 75 73 65 20 6f 66 0a 09 23 20 69 6e ore use of..# in 6d60: 64 69 63 65 73 2c 20 73 65 74 20 61 6e 64 20 73 dices, set and s 6d70: 74 72 65 61 6d 20 6f 70 65 72 61 74 69 6f 6e 73 tream operations 6d80: 2e 0a 0a 09 23 20 41 6c 6c 20 72 65 76 69 73 69 ....# All revisi 6d90: 6f 6e 73 20 75 73 65 64 20 62 79 20 74 61 67 20 ons used by tag 6da0: 73 79 6d 62 6f 6c 20 63 68 61 6e 67 65 73 65 74 symbol changeset 6db0: 73 20 68 61 76 65 20 74 6f 20 68 61 76 65 20 74 s have to have t 6dc0: 68 65 0a 09 23 20 63 68 61 6e 67 65 73 65 74 27 he..# changeset' 6dd0: 73 20 74 61 67 20 61 73 73 6f 63 69 61 74 65 64 s tag associated 6de0: 20 77 69 74 68 20 74 68 65 6d 2e 0a 09 43 68 65 with them...Che 6df0: 63 6b 52 65 76 43 53 20 5c 0a 09 20 20 20 20 7b ckRevCS \.. { 6e00: 41 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 75 73 All revisions us 6e10: 65 64 20 62 79 20 74 61 67 20 73 79 6d 62 6f 6c ed by tag symbol 6e20: 20 63 68 61 6e 67 65 73 65 74 73 20 68 61 76 65 changesets have 6e30: 20 74 6f 20 68 61 76 65 20 74 68 65 20 63 68 61 to have the cha 6e40: 6e 67 65 73 65 74 27 73 20 74 61 67 20 61 74 74 ngeset's tag att 6e50: 61 63 68 65 64 20 74 6f 20 74 68 65 6d 7d 20 5c ached to them} \ 6e60: 0a 09 20 20 20 20 7b 64 6f 65 73 20 6e 6f 74 20 .. {does not 6e70: 68 61 76 65 20 74 68 65 20 74 61 67 20 6f 66 20 have the tag of 6e80: 69 74 73 20 73 79 6d 62 6f 6c 20 63 68 61 6e 67 its symbol chang 6e90: 65 73 65 74 20 40 20 61 74 74 61 63 68 65 64 20 eset @ attached 6ea0: 74 6f 20 69 74 7d 20 7b 0a 09 09 53 45 4c 45 43 to it} {...SELEC 6eb0: 54 20 43 54 2e 6e 61 6d 65 2c 20 43 2e 63 69 64 T CT.name, C.cid 6ec0: 2c 20 46 2e 6e 61 6d 65 2c 20 52 2e 72 65 76 0a , F.name, R.rev. 6ed0: 09 09 46 52 4f 4d 20 20 20 63 68 61 6e 67 65 73 ..FROM changes 6ee0: 65 74 20 43 2c 20 63 73 74 79 70 65 20 43 54 2c et C, cstype CT, 6ef0: 20 72 65 76 69 73 69 6f 6e 20 52 2c 20 66 69 6c revision R, fil 6f00: 65 20 46 2c 20 63 73 69 74 65 6d 20 43 49 2c 20 e F, csitem CI, 6f10: 74 61 67 20 54 0a 09 09 57 48 45 52 45 20 20 43 tag T...WHERE C 6f20: 2e 74 79 70 65 20 3d 20 31 20 20 20 20 20 20 20 .type = 1 6f30: 2d 2d 20 73 79 6d 62 6f 6c 20 63 68 61 6e 67 65 -- symbol change 6f40: 73 65 74 73 20 6f 6e 6c 79 0a 09 09 41 4e 44 20 sets only...AND 6f50: 20 20 20 43 2e 73 72 63 20 20 3d 20 54 2e 73 69 C.src = T.si 6f60: 64 20 20 20 2d 2d 20 74 61 67 20 6f 6e 6c 79 2c d -- tag only, 6f70: 20 6c 69 6e 6b 65 64 20 62 79 20 73 79 6d 62 6f linked by symbo 6f80: 6c 20 69 64 20 0a 09 09 41 4e 44 20 20 20 20 43 l id ...AND C 6f90: 2e 63 69 64 20 20 3d 20 43 49 2e 63 69 64 20 20 .cid = CI.cid 6fa0: 2d 2d 20 63 68 61 6e 67 65 73 65 74 20 2d 2d 3e -- changeset --> 6fb0: 20 69 74 73 20 72 65 76 69 73 69 6f 6e 73 0a 09 its revisions.. 6fc0: 09 41 4e 44 20 20 20 20 52 2e 72 69 64 20 20 3d .AND R.rid = 6fd0: 20 43 49 2e 69 69 64 20 20 2d 2d 20 6c 6f 6f 6b CI.iid -- look 6fe0: 20 61 74 20 74 68 65 20 72 65 76 69 73 69 6f 6e at the revision 6ff0: 73 0a 09 09 2d 2d 20 61 6e 64 20 6c 6f 6f 6b 20 s...-- and look 7000: 66 6f 72 20 74 68 65 20 74 61 67 20 61 6d 6f 6e for the tag amon 7010: 67 20 74 68 65 20 61 74 74 61 63 68 65 64 20 6f g the attached o 7020: 6e 65 73 2e 0a 09 09 41 4e 44 20 20 20 20 54 2e nes....AND T. 7030: 73 69 64 20 4e 4f 54 20 49 4e 20 28 53 45 4c 45 sid NOT IN (SELE 7040: 43 54 20 54 42 2e 73 69 64 0a 09 09 09 09 20 20 CT TB.sid..... 7050: 20 20 20 46 52 4f 4d 20 20 20 74 61 67 20 54 42 FROM tag TB 7060: 0a 09 09 09 09 20 20 20 20 20 57 48 45 52 45 20 ..... WHERE 7070: 20 54 42 2e 72 65 76 20 3d 20 52 2e 72 69 64 29 TB.rev = R.rid) 7080: 0a 09 09 41 4e 44 20 20 20 20 52 2e 66 69 64 20 ...AND R.fid 7090: 3d 20 46 2e 66 69 64 20 20 20 20 2d 2d 20 67 65 = F.fid -- ge 70a0: 74 20 66 69 6c 65 20 6f 66 20 72 65 76 69 73 69 t file of revisi 70b0: 6f 6e 0a 09 20 20 20 20 7d 0a 0a 09 23 20 41 6c on.. }...# Al 70c0: 6c 20 72 65 76 69 73 69 6f 6e 73 20 75 73 65 64 l revisions used 70d0: 20 62 79 20 62 72 61 6e 63 68 20 73 79 6d 62 6f by branch symbo 70e0: 6c 20 63 68 61 6e 67 65 73 65 74 73 20 68 61 76 l changesets hav 70f0: 65 20 74 6f 20 68 61 76 65 0a 09 23 20 74 68 65 e to have..# the 7100: 20 63 68 61 6e 67 65 73 65 74 27 73 20 62 72 61 changeset's bra 7110: 6e 63 68 20 61 73 73 6f 63 69 61 74 65 64 20 77 nch associated w 7120: 69 74 68 20 74 68 65 6d 2e 0a 0a 09 43 68 65 63 ith them....Chec 7130: 6b 52 65 76 43 53 20 5c 0a 09 20 20 20 20 7b 41 kRevCS \.. {A 7140: 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 75 73 65 ll revisions use 7150: 64 20 62 79 20 62 72 61 6e 63 68 20 73 79 6d 62 d by branch symb 7160: 6f 6c 20 63 68 61 6e 67 65 73 65 74 73 20 68 61 ol changesets ha 7170: 76 65 20 74 6f 20 68 61 76 65 20 74 68 65 20 63 ve to have the c 7180: 68 61 6e 67 65 73 65 74 27 73 20 62 72 61 6e 63 hangeset's branc 7190: 68 20 61 74 74 61 63 68 65 64 20 74 6f 20 74 68 h attached to th 71a0: 65 6d 7d 20 5c 0a 09 20 20 20 20 7b 64 6f 65 73 em} \.. {does 71b0: 20 6e 6f 74 20 68 61 76 65 20 74 68 65 20 62 72 not have the br 71c0: 61 6e 63 68 20 6f 66 20 69 74 73 20 73 79 6d 62 anch of its symb 71d0: 6f 6c 20 63 68 61 6e 67 65 73 65 74 20 40 20 61 ol changeset @ a 71e0: 74 74 61 63 68 65 64 20 74 6f 20 69 74 7d 20 7b ttached to it} { 71f0: 0a 09 09 53 45 4c 45 43 54 20 43 54 2e 6e 61 6d ...SELECT CT.nam 7200: 65 2c 20 43 2e 63 69 64 2c 20 46 2e 6e 61 6d 65 e, C.cid, F.name 7210: 2c 20 52 2e 72 65 76 2c 20 43 2e 63 69 64 0a 09 , R.rev, C.cid.. 7220: 09 46 52 4f 4d 20 20 20 63 68 61 6e 67 65 73 65 .FROM changese 7230: 74 20 43 2c 20 63 73 74 79 70 65 20 43 54 2c 20 t C, cstype CT, 7240: 72 65 76 69 73 69 6f 6e 20 52 2c 20 66 69 6c 65 revision R, file 7250: 20 46 2c 20 63 73 69 74 65 6d 20 43 49 2c 20 62 F, csitem CI, b 7260: 72 61 6e 63 68 20 42 0a 09 09 57 48 45 52 45 20 ranch B...WHERE 7270: 20 43 2e 74 79 70 65 20 3d 20 31 20 20 20 20 20 C.type = 1 7280: 20 20 2d 2d 20 73 79 6d 62 6f 6c 20 63 68 61 6e -- symbol chan 7290: 67 65 73 65 74 73 20 6f 6e 6c 79 0a 09 09 41 4e gesets only...AN 72a0: 44 20 20 20 20 43 2e 73 72 63 20 20 3d 20 42 2e D C.src = B. 72b0: 73 69 64 20 20 20 2d 2d 20 62 72 61 6e 63 68 65 sid -- branche 72c0: 73 20 6f 6e 6c 79 0a 09 09 41 4e 44 20 20 20 20 s only...AND 72d0: 43 2e 63 69 64 20 20 3d 20 43 49 2e 63 69 64 20 C.cid = CI.cid 72e0: 20 2d 2d 20 63 68 61 6e 67 65 73 65 74 20 2d 2d -- changeset -- 72f0: 3e 20 69 74 73 20 72 65 76 69 73 69 6f 6e 73 0a > its revisions. 7300: 09 09 41 4e 44 20 20 20 20 52 2e 72 69 64 20 20 ..AND R.rid 7310: 3d 20 43 49 2e 69 69 64 20 20 2d 2d 20 6c 6f 6f = CI.iid -- loo 7320: 6b 20 61 74 20 74 68 65 20 72 65 76 69 73 69 6f k at the revisio 7330: 6e 73 0a 09 09 2d 2d 20 61 6e 64 20 6c 6f 6f 6b ns...-- and look 7340: 20 66 6f 72 20 74 68 65 20 62 72 61 6e 63 68 20 for the branch 7350: 61 6d 6f 6e 67 20 74 68 65 20 61 74 74 61 63 68 among the attach 7360: 65 64 20 6f 6e 65 73 2e 0a 09 09 41 4e 44 20 20 ed ones....AND 7370: 20 20 42 2e 73 69 64 20 4e 4f 54 20 49 4e 20 28 B.sid NOT IN ( 7380: 53 45 4c 45 43 54 20 42 42 2e 73 69 64 0a 09 09 SELECT BB.sid... 7390: 09 09 20 20 20 20 20 46 52 4f 4d 20 20 20 62 72 .. FROM br 73a0: 61 6e 63 68 20 42 42 0a 09 09 09 09 20 20 20 20 anch BB..... 73b0: 20 57 48 45 52 45 20 20 42 42 2e 72 6f 6f 74 20 WHERE BB.root 73c0: 3d 20 52 2e 72 69 64 29 0a 09 09 41 4e 44 20 20 = R.rid)...AND 73d0: 20 20 52 2e 66 69 64 20 3d 20 46 2e 66 69 64 20 R.fid = F.fid 73e0: 20 20 20 2d 2d 20 67 65 74 20 66 69 6c 65 20 6f -- get file o 73f0: 66 20 72 65 76 69 73 69 6f 6e 0a 09 20 20 20 20 f revision.. 7400: 7d 0a 0a 09 23 20 54 4f 44 4f 0a 09 23 20 54 68 }...# TODO..# Th 7410: 65 20 73 74 61 74 65 20 68 61 73 20 74 6f 20 63 e state has to c 7420: 6f 6e 74 61 69 6e 20 61 74 20 6c 65 61 73 74 20 ontain at least 7430: 6f 6e 65 20 74 61 67 20 73 79 6d 62 6f 6c 20 63 one tag symbol c 7440: 68 61 6e 67 65 73 65 74 0a 09 23 20 66 6f 72 20 hangeset..# for 7450: 61 6c 6c 20 6b 6e 6f 77 6e 20 74 61 67 73 2e 0a all known tags.. 7460: 0a 09 23 20 54 4f 44 4f 0a 09 23 20 54 68 65 20 ..# TODO..# The 7470: 73 74 61 74 65 20 68 61 73 20 74 6f 20 63 6f 6e state has to con 7480: 74 61 69 6e 20 61 74 20 6c 65 61 73 74 20 6f 6e tain at least on 7490: 65 20 62 72 61 6e 63 68 20 73 79 6d 62 6f 6c 20 e branch symbol 74a0: 63 68 61 6e 67 65 73 65 74 0a 09 23 20 66 6f 72 changeset..# for 74b0: 20 61 6c 6c 20 6b 6e 6f 77 6e 20 62 72 61 6e 63 all known branc 74c0: 68 65 73 2e 0a 09 72 65 74 75 72 6e 0a 20 20 20 hes...return. 74d0: 20 7d 0a 0a 0a 20 20 20 20 70 72 6f 63 20 43 68 }... proc Ch 74e0: 65 63 6b 52 65 76 20 7b 68 65 61 64 65 72 20 6c eckRev {header l 74f0: 61 62 65 6c 20 73 71 6c 7d 20 7b 0a 09 75 70 76 abel sql} {..upv 7500: 61 72 20 31 20 6e 20 6e 0a 09 73 65 74 20 6f 6b ar 1 n n..set ok 7510: 20 31 0a 09 66 6f 72 65 61 63 68 20 7b 66 6e 61 1..foreach {fna 7520: 6d 65 20 72 65 76 6e 72 7d 20 5b 73 74 61 74 65 me revnr} [state 7530: 20 72 75 6e 20 24 73 71 6c 5d 20 7b 0a 09 20 20 run $sql] {.. 7540: 20 20 73 65 74 20 6f 6b 20 30 0a 09 20 20 20 20 set ok 0.. 7550: 74 72 6f 75 62 6c 65 20 66 61 74 61 6c 20 22 24 trouble fatal "$ 7560: 7b 72 65 76 6e 72 7d 3a 3a 24 66 6e 61 6d 65 20 {revnr}::$fname 7570: 24 6c 61 62 65 6c 22 0a 09 7d 0a 09 6c 6f 67 20 $label"..}..log 7580: 77 72 69 74 65 20 35 20 69 6e 74 65 67 72 69 74 write 5 integrit 7590: 79 20 7b 5c 5b 5b 66 6f 72 6d 61 74 20 25 30 32 y {\[[format %02 75a0: 64 20 5b 69 6e 63 72 20 6e 5d 5d 5c 5d 20 5b 65 d [incr n]]\] [e 75b0: 78 70 72 20 7b 24 6f 6b 20 3f 20 22 4f 6b 20 20 xpr {$ok ? "Ok 75c0: 20 20 22 20 3a 20 22 46 61 69 6c 65 64 22 7d 5d " : "Failed"}] 75d0: 20 2e 2e 2e 20 24 68 65 61 64 65 72 7d 0a 09 72 ... $header}..r 75e0: 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 eturn. }.. 75f0: 20 70 72 6f 63 20 43 68 65 63 6b 54 61 67 20 7b proc CheckTag { 7600: 68 65 61 64 65 72 20 6c 61 62 65 6c 20 73 71 6c header label sql 7610: 7d 20 7b 0a 09 75 70 76 61 72 20 31 20 6e 20 6e } {..upvar 1 n n 7620: 0a 09 73 65 74 20 6f 6b 20 31 0a 09 66 6f 72 65 ..set ok 1..fore 7630: 61 63 68 20 7b 70 6e 61 6d 65 20 73 6e 61 6d 65 ach {pname sname 7640: 7d 20 5b 73 74 61 74 65 20 72 75 6e 20 24 73 71 } [state run $sq 7650: 6c 5d 20 7b 0a 09 20 20 20 20 73 65 74 20 6f 6b l] {.. set ok 7660: 20 30 0a 09 20 20 20 20 74 72 6f 75 62 6c 65 20 0.. trouble 7670: 66 61 74 61 6c 20 22 3c 24 70 6e 61 6d 65 20 74 fatal "<$pname t 7680: 61 67 20 27 24 73 6e 61 6d 65 27 3e 20 24 6c 61 ag '$sname'> $la 7690: 62 65 6c 22 0a 09 7d 0a 09 6c 6f 67 20 77 72 69 bel"..}..log wri 76a0: 74 65 20 35 20 69 6e 74 65 67 72 69 74 79 20 7b te 5 integrity { 76b0: 5c 5b 5b 66 6f 72 6d 61 74 20 25 30 32 64 20 5b \[[format %02d [ 76c0: 69 6e 63 72 20 6e 5d 5d 5c 5d 20 5b 65 78 70 72 incr n]]\] [expr 76d0: 20 7b 24 6f 6b 20 3f 20 22 4f 6b 20 20 20 20 22 {$ok ? "Ok " 76e0: 20 3a 20 22 46 61 69 6c 65 64 22 7d 5d 20 2e 2e : "Failed"}] .. 76f0: 2e 20 24 68 65 61 64 65 72 7d 0a 09 72 65 74 75 . $header}..retu 7700: 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 70 72 rn. }.. pr 7710: 6f 63 20 43 68 65 63 6b 42 72 61 6e 63 68 20 7b oc CheckBranch { 7720: 68 65 61 64 65 72 20 6c 61 62 65 6c 20 73 71 6c header label sql 7730: 7d 20 7b 0a 09 75 70 76 61 72 20 31 20 6e 20 6e } {..upvar 1 n n 7740: 0a 09 73 65 74 20 6f 6b 20 31 0a 09 66 6f 72 65 ..set ok 1..fore 7750: 61 63 68 20 7b 70 6e 61 6d 65 20 73 6e 61 6d 65 ach {pname sname 7760: 7d 20 5b 73 74 61 74 65 20 72 75 6e 20 24 73 71 } [state run $sq 7770: 6c 5d 20 7b 0a 09 20 20 20 20 73 65 74 20 6f 6b l] {.. set ok 7780: 20 30 0a 09 20 20 20 20 74 72 6f 75 62 6c 65 20 0.. trouble 7790: 66 61 74 61 6c 20 22 3c 24 70 6e 61 6d 65 20 62 fatal "<$pname b 77a0: 72 61 6e 63 68 20 27 24 73 6e 61 6d 65 27 3e 20 ranch '$sname'> 77b0: 24 6c 61 62 65 6c 22 0a 09 7d 0a 09 6c 6f 67 20 $label"..}..log 77c0: 77 72 69 74 65 20 35 20 69 6e 74 65 67 72 69 74 write 5 integrit 77d0: 79 20 7b 5c 5b 5b 66 6f 72 6d 61 74 20 25 30 32 y {\[[format %02 77e0: 64 20 5b 69 6e 63 72 20 6e 5d 5d 5c 5d 20 5b 65 d [incr n]]\] [e 77f0: 78 70 72 20 7b 24 6f 6b 20 3f 20 22 4f 6b 20 20 xpr {$ok ? "Ok 7800: 20 20 22 20 3a 20 22 46 61 69 6c 65 64 22 7d 5d " : "Failed"}] 7810: 20 2e 2e 2e 20 24 68 65 61 64 65 72 7d 0a 09 72 ... $header}..r 7820: 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 eturn. }.. 7830: 20 70 72 6f 63 20 43 68 65 63 6b 43 53 20 7b 68 proc CheckCS {h 7840: 65 61 64 65 72 20 6c 61 62 65 6c 20 73 71 6c 7d eader label sql} 7850: 20 7b 0a 09 75 70 76 61 72 20 31 20 6e 20 6e 0a {..upvar 1 n n. 7860: 09 73 65 74 20 6f 6b 20 31 0a 09 66 6f 72 65 61 .set ok 1..forea 7870: 63 68 20 7b 63 74 79 70 65 20 63 69 64 7d 20 5b ch {ctype cid} [ 7880: 73 74 61 74 65 20 72 75 6e 20 24 73 71 6c 5d 20 state run $sql] 7890: 7b 0a 09 20 20 20 20 73 65 74 20 6f 6b 20 30 0a {.. set ok 0. 78a0: 09 20 20 20 20 74 72 6f 75 62 6c 65 20 66 61 74 . trouble fat 78b0: 61 6c 20 22 3c 24 63 74 79 70 65 20 24 63 69 64 al "<$ctype $cid 78c0: 3e 20 24 6c 61 62 65 6c 22 0a 09 7d 0a 09 6c 6f > $label"..}..lo 78d0: 67 20 77 72 69 74 65 20 35 20 69 6e 74 65 67 72 g write 5 integr 78e0: 69 74 79 20 7b 5c 5b 5b 66 6f 72 6d 61 74 20 25 ity {\[[format % 78f0: 30 32 64 20 5b 69 6e 63 72 20 6e 5d 5d 5c 5d 20 02d [incr n]]\] 7900: 5b 65 78 70 72 20 7b 24 6f 6b 20 3f 20 22 4f 6b [expr {$ok ? "Ok 7910: 20 20 20 20 22 20 3a 20 22 46 61 69 6c 65 64 22 " : "Failed" 7920: 7d 5d 20 2e 2e 2e 20 24 68 65 61 64 65 72 7d 0a }] ... $header}. 7930: 09 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 .return. }.. 7940: 20 20 20 70 72 6f 63 20 43 68 65 63 6b 52 65 76 proc CheckRev 7950: 43 53 20 7b 68 65 61 64 65 72 20 6c 61 62 65 6c CS {header label 7960: 20 73 71 6c 7d 20 7b 0a 09 75 70 76 61 72 20 31 sql} {..upvar 1 7970: 20 6e 20 6e 0a 09 73 65 74 20 6f 6b 20 31 0a 09 n n..set ok 1.. 7980: 66 6f 72 65 61 63 68 20 7b 63 73 74 79 70 65 20 foreach {cstype 7990: 63 73 69 64 20 66 6e 61 6d 65 20 72 65 76 6e 72 csid fname revnr 79a0: 7d 20 5b 73 74 61 74 65 20 72 75 6e 20 24 73 71 } [state run $sq 79b0: 6c 5d 20 7b 0a 09 20 20 20 20 73 65 74 20 6f 6b l] {.. set ok 79c0: 20 30 0a 09 20 20 20 20 73 65 74 20 62 20 22 3c 0.. set b "< 79d0: 24 63 73 74 79 70 65 20 24 63 73 69 64 3e 22 0a $cstype $csid>". 79e0: 09 20 20 20 20 74 72 6f 75 62 6c 65 20 66 61 74 . trouble fat 79f0: 61 6c 20 22 24 66 6e 61 6d 65 20 3c 24 72 65 76 al "$fname <$rev 7a00: 6e 72 3e 20 5b 73 74 72 69 6e 67 20 6d 61 70 20 nr> [string map 7a10: 5b 6c 69 73 74 20 40 20 24 62 5d 20 24 6c 61 62 [list @ $b] $lab 7a20: 65 6c 5d 22 0a 09 7d 0a 09 6c 6f 67 20 77 72 69 el]"..}..log wri 7a30: 74 65 20 35 20 69 6e 74 65 67 72 69 74 79 20 7b te 5 integrity { 7a40: 5c 5b 5b 66 6f 72 6d 61 74 20 25 30 32 64 20 5b \[[format %02d [ 7a50: 69 6e 63 72 20 6e 5d 5d 5c 5d 20 5b 65 78 70 72 incr n]]\] [expr 7a60: 20 7b 24 6f 6b 20 3f 20 22 4f 6b 20 20 20 20 22 {$ok ? "Ok " 7a70: 20 3a 20 22 46 61 69 6c 65 64 22 7d 5d 20 2e 2e : "Failed"}] .. 7a80: 2e 20 24 68 65 61 64 65 72 7d 0a 09 72 65 74 75 . $header}..retu 7a90: 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 23 20 rn. }.. # 7aa0: 23 20 23 23 20 23 23 23 20 23 23 23 23 23 20 23 # ## ### ##### # 7ab0: 23 23 23 23 23 23 23 20 23 23 23 23 23 23 23 23 ####### ######## 7ac0: 23 23 23 23 23 0a 20 20 20 20 23 23 20 43 6f 6e #####. ## Con 7ad0: 66 69 67 75 72 61 74 69 6f 6e 0a 0a 20 20 20 20 figuration.. 7ae0: 70 72 61 67 6d 61 20 2d 68 61 73 69 6e 73 74 61 pragma -hasinsta 7af0: 6e 63 65 73 20 20 20 6e 6f 20 3b 20 23 20 73 69 nces no ; # si 7b00: 6e 67 6c 65 74 6f 6e 0a 20 20 20 20 70 72 61 67 ngleton. prag 7b10: 6d 61 20 2d 68 61 73 74 79 70 65 69 6e 66 6f 20 ma -hastypeinfo 7b20: 20 20 20 6e 6f 20 3b 20 23 20 6e 6f 20 69 6e 74 no ; # no int 7b30: 72 6f 73 70 65 63 74 69 6f 6e 0a 20 20 20 20 70 rospection. p 7b40: 72 61 67 6d 61 20 2d 68 61 73 74 79 70 65 64 65 ragma -hastypede 7b50: 73 74 72 6f 79 20 6e 6f 20 3b 20 23 20 69 6d 6d stroy no ; # imm 7b60: 6f 72 74 61 6c 0a 0a 20 20 20 20 23 20 23 20 23 ortal.. # # # 7b70: 23 20 23 23 23 20 23 23 23 23 23 20 23 23 23 23 # ### ##### #### 7b80: 23 23 23 23 20 23 23 23 23 23 23 23 23 23 23 23 #### ########### 7b90: 23 23 0a 7d 0a 0a 6e 61 6d 65 73 70 61 63 65 20 ##.}..namespace 7ba0: 65 76 61 6c 20 3a 3a 76 63 3a 3a 66 6f 73 73 69 eval ::vc::fossi 7bb0: 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 20 7b l::import::cvs { 7bc0: 0a 20 20 20 20 6e 61 6d 65 73 70 61 63 65 20 65 . namespace e 7bd0: 78 70 6f 72 74 20 69 6e 74 65 67 72 69 74 79 0a xport integrity. 7be0: 20 20 20 20 6e 61 6d 65 73 70 61 63 65 20 65 76 namespace ev 7bf0: 61 6c 20 69 6e 74 65 67 72 69 74 79 20 7b 0a 09 al integrity {.. 7c00: 6e 61 6d 65 73 70 61 63 65 20 69 6d 70 6f 72 74 namespace import 7c10: 20 3a 3a 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 ::vc::fossil::i 7c20: 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 73 74 61 74 mport::cvs::stat 7c30: 65 0a 09 6e 61 6d 65 73 70 61 63 65 20 69 6d 70 e..namespace imp 7c40: 6f 72 74 20 3a 3a 76 63 3a 3a 74 6f 6f 6c 73 3a ort ::vc::tools: 7c50: 3a 74 72 6f 75 62 6c 65 0a 09 6e 61 6d 65 73 70 :trouble..namesp 7c60: 61 63 65 20 69 6d 70 6f 72 74 20 3a 3a 76 63 3a ace import ::vc: 7c70: 3a 74 6f 6f 6c 73 3a 3a 6c 6f 67 0a 09 6c 6f 67 :tools::log..log 7c80: 20 72 65 67 69 73 74 65 72 20 69 6e 74 65 67 72 register integr 7c90: 69 74 79 0a 20 20 20 20 7d 0a 7d 0a 0a 23 20 23 ity. }.}..# # 7ca0: 20 23 23 20 23 23 23 20 23 23 23 23 23 20 23 23 ## ### ##### ## 7cb0: 23 23 23 23 23 23 20 23 23 23 23 23 23 23 23 23 ###### ######### 7cc0: 23 23 23 23 20 23 23 23 23 23 23 23 23 23 23 23 #### ########### 7cd0: 23 23 23 23 23 23 23 23 23 23 0a 23 23 20 52 65 ##########.## Re 7ce0: 61 64 79 0a 0a 70 61 63 6b 61 67 65 20 70 72 6f ady..package pro 7cf0: 76 69 64 65 20 76 63 3a 3a 66 6f 73 73 69 6c 3a vide vc::fossil: 7d00: 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 69 6e :import::cvs::in 7d10: 74 65 67 72 69 74 79 20 31 2e 30 0a 72 65 74 75 tegrity 1.0.retu 7d20: 72 6e 0a rn.