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 2c 20 69 66 20 6e e a parent, if n
15f0: 6f 74 20 64 65 74 61 63 68 65 64 7d 20 5c 0a 09 ot detached} \..
1600: 20 20 20 20 7b 61 74 20 74 68 65 20 62 65 67 69 {at the begi
1610: 6e 6e 69 6e 67 20 6f 66 20 69 74 73 20 62 72 61 nning of its bra
1620: 6e 63 68 20 68 61 73 20 6e 6f 20 70 61 72 65 6e nch has no paren
1630: 74 2c 20 62 75 74 20 69 74 73 20 62 72 61 6e 63 t, but its branc
1640: 68 20 68 61 73 7d 20 7b 0a 09 09 53 45 4c 45 43 h has} {...SELEC
1650: 54 20 46 2e 6e 61 6d 65 2c 20 52 2e 72 65 76 0a T F.name, R.rev.
1660: 09 09 46 52 4f 4d 20 72 65 76 69 73 69 6f 6e 20 ..FROM revision
1670: 52 2c 20 66 69 6c 65 20 46 2c 20 62 72 61 6e 63 R, file F, branc
1680: 68 20 42 0a 09 09 57 48 45 52 45 20 52 2e 66 69 h B...WHERE R.fi
1690: 64 20 3d 20 46 2e 66 69 64 0a 09 09 41 4e 44 20 d = F.fid...AND
16a0: 20 20 52 2e 62 70 61 72 65 6e 74 20 49 53 20 4e R.bparent IS N
16b0: 4f 54 20 4e 55 4c 4c 0a 09 09 41 4e 44 20 20 20 OT NULL...AND
16c0: 52 2e 70 61 72 65 6e 74 20 20 49 53 20 4e 55 4c R.parent IS NUL
16d0: 4c 0a 09 09 41 4e 44 20 20 20 42 2e 73 69 64 20 L...AND B.sid
16e0: 3d 20 52 2e 62 70 61 72 65 6e 74 0a 09 09 41 4e = R.bparent...AN
16f0: 44 20 20 20 42 2e 66 69 64 20 3d 20 52 2e 66 69 D B.fid = R.fi
1700: 64 0a 09 09 41 4e 44 20 20 20 42 2e 72 6f 6f 74 d...AND B.root
1710: 20 20 20 20 49 53 20 4e 4f 54 20 4e 55 4c 4c 0a IS NOT NULL.
1720: 09 09 3b 0a 09 20 20 20 20 7d 0a 09 23 20 46 69 ..;.. }..# Fi
1730: 6e 64 20 61 6c 6c 20 72 65 76 69 73 69 6f 6e 73 nd all revisions
1740: 20 77 69 74 68 20 61 20 62 72 61 6e 63 68 20 70 with a branch p
1750: 61 72 65 6e 74 20 73 79 6d 62 6f 6c 20 77 68 6f arent symbol who
1760: 73 65 20 70 61 72 65 6e 74 0a 09 23 20 68 61 73 se parent..# has
1770: 20 74 68 65 6d 20 61 73 20 70 72 69 6d 61 72 79 them as primary
1780: 20 63 68 69 6c 64 2e 0a 09 43 68 65 63 6b 52 65 child...CheckRe
1790: 76 20 5c 0a 09 20 20 20 20 7b 42 72 61 6e 63 68 v \.. {Branch
17a0: 20 73 74 61 72 74 69 6e 67 20 72 65 76 69 73 69 starting revisi
17b0: 6f 6e 73 20 6d 75 73 74 20 6e 6f 74 20 62 65 20 ons must not be
17c0: 70 72 69 6d 61 72 79 20 63 68 69 6c 64 72 65 6e primary children
17d0: 20 6f 66 20 74 68 65 69 72 20 70 61 72 65 6e 74 of their parent
17e0: 73 7d 20 5c 0a 09 20 20 20 20 7b 61 74 20 74 68 s} \.. {at th
17f0: 65 20 62 65 67 69 6e 6e 69 6e 67 20 6f 66 20 69 e beginning of i
1800: 74 73 20 62 72 61 6e 63 68 20 69 73 20 74 68 65 ts branch is the
1810: 20 70 72 69 6d 61 72 79 20 63 68 69 6c 64 20 6f primary child o
1820: 66 20 69 74 73 20 70 61 72 65 6e 74 7d 20 7b 0a f its parent} {.
1830: 09 09 53 45 4c 45 43 54 20 46 2e 6e 61 6d 65 2c ..SELECT F.name,
1840: 20 52 2e 72 65 76 0a 09 09 46 52 4f 4d 20 72 65 R.rev...FROM re
1850: 76 69 73 69 6f 6e 20 52 2c 20 72 65 76 69 73 69 vision R, revisi
1860: 6f 6e 20 50 2c 20 66 69 6c 65 20 46 0a 09 09 57 on P, file F...W
1870: 48 45 52 45 20 52 2e 66 69 64 20 3d 20 46 2e 66 HERE R.fid = F.f
1880: 69 64 0a 09 09 41 4e 44 20 20 20 52 2e 62 70 61 id...AND R.bpa
1890: 72 65 6e 74 20 49 53 20 4e 4f 54 20 4e 55 4c 4c rent IS NOT NULL
18a0: 0a 09 09 41 4e 44 20 20 20 52 2e 70 61 72 65 6e ...AND R.paren
18b0: 74 20 49 53 20 4e 4f 54 20 4e 55 4c 4c 0a 09 09 t IS NOT NULL...
18c0: 41 4e 44 20 20 20 52 2e 70 61 72 65 6e 74 20 3d AND R.parent =
18d0: 20 50 2e 72 69 64 0a 09 09 41 4e 44 20 20 20 50 P.rid...AND P
18e0: 2e 63 68 69 6c 64 20 3d 20 52 2e 72 69 64 0a 09 .child = R.rid..
18f0: 09 3b 0a 09 20 20 20 20 7d 0a 09 23 20 46 69 6e .;.. }..# Fin
1900: 64 20 61 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 d all revisions
1910: 77 69 74 68 20 61 20 6e 6f 6e 2d 4e 54 44 42 20 with a non-NTDB
1920: 63 68 69 6c 64 20 77 68 69 63 68 20 61 72 65 20 child which are
1930: 6e 6f 74 20 6f 6e 0a 09 23 20 74 68 65 20 4e 54 not on..# the NT
1940: 44 42 2e 0a 09 43 68 65 63 6b 52 65 76 20 5c 0a DB...CheckRev \.
1950: 09 20 20 20 20 7b 4e 54 44 42 20 74 6f 20 74 72 . {NTDB to tr
1960: 75 6e 6b 20 74 72 61 6e 73 69 74 69 6f 6e 20 68 unk transition h
1970: 61 73 20 74 6f 20 62 65 67 69 6e 20 6f 6e 20 4e as to begin on N
1980: 54 44 42 7d 20 5c 0a 09 20 20 20 20 7b 68 61 73 TDB} \.. {has
1990: 20 61 20 6e 6f 6e 2d 4e 54 44 42 20 63 68 69 6c a non-NTDB chil
19a0: 64 2c 20 79 65 74 20 69 73 20 6e 6f 74 20 6f 6e d, yet is not on
19b0: 20 74 68 65 20 4e 54 44 42 7d 20 7b 0a 09 09 53 the NTDB} {...S
19c0: 45 4c 45 43 54 20 46 2e 6e 61 6d 65 2c 20 52 2e ELECT F.name, R.
19d0: 72 65 76 0a 09 09 46 52 4f 4d 20 72 65 76 69 73 rev...FROM revis
19e0: 69 6f 6e 20 52 2c 20 66 69 6c 65 20 46 0a 09 09 ion R, file F...
19f0: 57 48 45 52 45 20 52 2e 66 69 64 20 3d 20 46 2e WHERE R.fid = F.
1a00: 66 69 64 0a 09 09 41 4e 44 20 20 20 52 2e 64 62 fid...AND R.db
1a10: 63 68 69 6c 64 20 49 53 20 4e 4f 54 20 4e 55 4c child IS NOT NUL
1a20: 4c 0a 09 09 41 4e 44 20 20 20 4e 4f 54 20 52 2e L...AND NOT R.
1a30: 69 73 64 65 66 61 75 6c 74 0a 09 09 3b 0a 09 20 isdefault...;..
1a40: 20 20 20 7d 0a 09 23 20 46 69 6e 64 20 61 6c 6c }..# Find all
1a50: 20 72 65 76 69 73 69 6f 6e 73 20 77 69 74 68 20 revisions with
1a60: 61 20 4e 54 44 42 20 70 61 72 65 6e 74 20 77 68 a NTDB parent wh
1a70: 69 63 68 20 61 72 65 20 6f 6e 20 74 68 65 20 4e ich are on the N
1a80: 54 44 42 2e 0a 09 43 68 65 63 6b 52 65 76 20 5c TDB...CheckRev \
1a90: 0a 09 20 20 20 20 7b 4e 54 44 42 20 74 6f 20 74 .. {NTDB to t
1aa0: 72 75 6e 6b 20 74 72 61 6e 73 69 74 69 6f 6e 20 runk transition
1ab0: 68 61 73 20 74 6f 20 65 6e 64 20 6f 6e 20 6e 6f has to end on no
1ac0: 6e 2d 4e 54 44 42 7d 20 5c 0a 09 20 20 20 20 7b n-NTDB} \.. {
1ad0: 68 61 73 20 61 20 4e 54 44 42 20 70 61 72 65 6e has a NTDB paren
1ae0: 74 2c 20 79 65 74 20 69 73 20 6f 6e 20 74 68 65 t, yet is on the
1af0: 20 4e 54 44 42 7d 20 7b 0a 09 09 53 45 4c 45 43 NTDB} {...SELEC
1b00: 54 20 46 2e 6e 61 6d 65 2c 20 52 2e 72 65 76 0a T F.name, R.rev.
1b10: 09 09 46 52 4f 4d 20 72 65 76 69 73 69 6f 6e 20 ..FROM revision
1b20: 52 2c 20 66 69 6c 65 20 46 0a 09 09 57 48 45 52 R, file F...WHER
1b30: 45 20 52 2e 66 69 64 20 3d 20 46 2e 66 69 64 0a E R.fid = F.fid.
1b40: 09 09 41 4e 44 20 20 20 52 2e 64 62 70 61 72 65 ..AND R.dbpare
1b50: 6e 74 20 49 53 20 4e 4f 54 20 4e 55 4c 4c 0a 09 nt IS NOT NULL..
1b60: 09 41 4e 44 20 20 20 52 2e 69 73 64 65 66 61 75 .AND R.isdefau
1b70: 6c 74 0a 09 09 3b 0a 09 20 20 20 20 7d 0a 09 23 lt...;.. }..#
1b80: 20 46 69 6e 64 20 61 6c 6c 20 72 65 76 69 73 69 Find all revisi
1b90: 6f 6e 73 20 77 69 74 68 20 61 20 63 68 69 6c 64 ons with a child
1ba0: 20 77 68 69 63 68 20 64 69 73 61 67 72 65 65 73 which disagrees
1bb0: 20 61 62 6f 75 74 20 74 68 65 0a 09 23 20 6c 69 about the..# li
1bc0: 6e 65 20 6f 66 20 64 65 76 65 6c 6f 70 6d 65 6e ne of developmen
1bd0: 74 20 74 68 65 79 20 62 65 6c 6f 6e 67 20 74 6f t they belong to
1be0: 2e 0a 09 43 68 65 63 6b 52 65 76 20 5c 0a 09 20 ...CheckRev \..
1bf0: 20 20 20 7b 52 65 76 69 73 69 6f 6e 73 20 61 6e {Revisions an
1c00: 64 20 74 68 65 69 72 20 70 72 69 6d 61 72 79 20 d their primary
1c10: 63 68 69 6c 64 72 65 6e 20 68 61 76 65 20 74 6f children have to
1c20: 20 62 65 20 69 6e 20 74 68 65 20 73 61 6d 65 20 be in the same
1c30: 4c 4f 44 7d 20 5c 0a 09 20 20 20 20 7b 61 6e 64 LOD} \.. {and
1c40: 20 69 74 73 20 70 72 69 6d 61 72 79 20 63 68 69 its primary chi
1c50: 6c 64 20 64 69 73 61 67 72 65 65 20 61 62 6f 75 ld disagree abou
1c60: 74 20 74 68 65 69 72 20 4c 4f 44 7d 20 7b 0a 09 t their LOD} {..
1c70: 09 53 45 4c 45 43 54 20 46 2e 6e 61 6d 65 2c 20 .SELECT F.name,
1c80: 52 2e 72 65 76 0a 09 09 46 52 4f 4d 20 72 65 76 R.rev...FROM rev
1c90: 69 73 69 6f 6e 20 52 2c 20 72 65 76 69 73 69 6f ision R, revisio
1ca0: 6e 20 43 2c 20 66 69 6c 65 20 46 0a 09 09 57 48 n C, file F...WH
1cb0: 45 52 45 20 52 2e 66 69 64 20 3d 20 46 2e 66 69 ERE R.fid = F.fi
1cc0: 64 0a 09 09 41 4e 44 20 20 20 52 2e 63 68 69 6c d...AND R.chil
1cd0: 64 20 49 53 20 4e 4f 54 20 4e 55 4c 4c 0a 09 09 d IS NOT NULL...
1ce0: 41 4e 44 20 20 20 52 2e 63 68 69 6c 64 20 3d 20 AND R.child =
1cf0: 43 2e 72 69 64 0a 09 09 41 4e 44 20 20 20 43 2e C.rid...AND C.
1d00: 6c 6f 64 20 21 3d 20 52 2e 6c 6f 64 0a 09 09 3b lod != R.lod...;
1d10: 0a 09 20 20 20 20 7d 0a 09 23 20 46 69 6e 64 20 .. }..# Find
1d20: 61 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 77 69 all revisions wi
1d30: 74 68 20 61 20 6e 6f 6e 2d 4e 54 44 42 20 63 68 th a non-NTDB ch
1d40: 69 6c 64 20 77 68 69 63 68 20 61 67 72 65 65 73 ild which agrees
1d50: 20 61 62 6f 75 74 0a 09 23 20 74 68 65 20 6c 69 about..# the li
1d60: 6e 65 20 6f 66 20 64 65 76 65 6c 6f 70 6d 65 6e ne of developmen
1d70: 74 20 74 68 65 79 20 62 65 6c 6f 6e 67 20 74 6f t they belong to
1d80: 2e 0a 09 43 68 65 63 6b 52 65 76 20 5c 0a 09 20 ...CheckRev \..
1d90: 20 20 20 7b 4e 54 44 42 20 61 6e 64 20 74 72 75 {NTDB and tru
1da0: 6e 6b 20 72 65 76 69 73 69 6f 6e 73 20 68 61 76 nk revisions hav
1db0: 65 20 74 6f 20 62 65 20 69 6e 20 64 69 66 66 65 e to be in diffe
1dc0: 72 65 6e 74 20 4c 4f 44 73 7d 20 5c 0a 09 20 20 rent LODs} \..
1dd0: 20 20 7b 6f 6e 20 4e 54 44 42 20 61 6e 64 20 69 {on NTDB and i
1de0: 74 73 20 6e 6f 6e 2d 4e 54 44 42 20 63 68 69 6c ts non-NTDB chil
1df0: 64 20 77 72 6f 6e 67 6c 79 20 61 67 72 65 65 20 d wrongly agree
1e00: 61 62 6f 75 74 20 74 68 65 69 72 20 4c 4f 44 7d about their LOD}
1e10: 20 7b 0a 09 09 53 45 4c 45 43 54 20 46 2e 6e 61 {...SELECT F.na
1e20: 6d 65 2c 20 52 2e 72 65 76 0a 09 09 46 52 4f 4d me, R.rev...FROM
1e30: 20 72 65 76 69 73 69 6f 6e 20 52 2c 20 72 65 76 revision R, rev
1e40: 69 73 69 6f 6e 20 43 2c 20 66 69 6c 65 20 46 0a ision C, file F.
1e50: 09 09 57 48 45 52 45 20 52 2e 66 69 64 20 3d 20 ..WHERE R.fid =
1e60: 46 2e 66 69 64 0a 09 09 41 4e 44 20 20 20 52 2e F.fid...AND R.
1e70: 64 62 63 68 69 6c 64 20 49 53 20 4e 4f 54 20 4e dbchild IS NOT N
1e80: 55 4c 4c 0a 09 09 41 4e 44 20 20 20 52 2e 64 62 ULL...AND R.db
1e90: 63 68 69 6c 64 20 3d 20 43 2e 72 69 64 0a 09 09 child = C.rid...
1ea0: 41 4e 44 20 20 20 43 2e 6c 6f 64 20 3d 20 52 2e AND C.lod = R.
1eb0: 6c 6f 64 0a 09 09 3b 0a 09 20 20 20 20 7d 0a 09 lod...;.. }..
1ec0: 23 20 46 69 6e 64 20 61 6c 6c 20 72 65 76 69 73 # Find all revis
1ed0: 69 6f 6e 73 20 77 69 74 68 20 61 20 62 72 61 6e ions with a bran
1ee0: 63 68 20 70 61 72 65 6e 74 20 73 79 6d 62 6f 6c ch parent symbol
1ef0: 20 77 68 69 63 68 20 69 73 20 6e 6f 74 0a 09 23 which is not..#
1f00: 20 74 68 65 69 72 20 4c 4f 44 2e 0a 09 43 68 65 their LOD...Che
1f10: 63 6b 52 65 76 20 5c 0a 09 20 20 20 20 7b 42 72 ckRev \.. {Br
1f20: 61 6e 63 68 20 73 74 61 72 74 69 6e 67 20 72 65 anch starting re
1f30: 76 69 73 69 6f 6e 73 20 68 61 76 65 20 74 6f 20 visions have to
1f40: 68 61 76 65 20 74 68 65 69 72 20 4c 4f 44 20 61 have their LOD a
1f50: 73 20 62 72 61 6e 63 68 20 70 61 72 65 6e 74 20 s branch parent
1f60: 73 79 6d 62 6f 6c 7d 20 5c 0a 09 20 20 20 20 7b symbol} \.. {
1f70: 61 74 20 74 68 65 20 62 65 67 69 6e 6e 69 6e 67 at the beginning
1f80: 20 6f 66 20 69 74 73 20 62 72 61 6e 63 68 20 64 of its branch d
1f90: 6f 65 73 20 6e 6f 74 20 68 61 76 65 20 74 68 65 oes not have the
1fa0: 20 62 72 61 6e 63 68 20 73 79 6d 62 6f 6c 20 61 branch symbol a
1fb0: 73 20 69 74 73 20 4c 4f 44 7d 20 7b 0a 09 09 53 s its LOD} {...S
1fc0: 45 4c 45 43 54 20 46 2e 6e 61 6d 65 2c 20 52 2e ELECT F.name, R.
1fd0: 72 65 76 0a 09 09 46 52 4f 4d 20 72 65 76 69 73 rev...FROM revis
1fe0: 69 6f 6e 20 52 2c 20 66 69 6c 65 20 46 0a 09 09 ion R, file F...
1ff0: 57 48 45 52 45 20 52 2e 66 69 64 20 3d 20 46 2e WHERE R.fid = F.
2000: 66 69 64 0a 09 09 41 4e 44 20 20 20 52 2e 62 70 fid...AND R.bp
2010: 61 72 65 6e 74 20 49 53 20 4e 4f 54 20 4e 55 4c arent IS NOT NUL
2020: 4c 0a 09 09 41 4e 44 20 20 20 52 2e 6c 6f 64 20 L...AND R.lod
2030: 21 3d 20 52 2e 62 70 61 72 65 6e 74 0a 09 09 3b != R.bparent...;
2040: 0a 09 20 20 20 20 7d 0a 09 23 20 46 69 6e 64 20 .. }..# Find
2050: 61 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 77 69 all revisions wi
2060: 74 68 20 61 20 62 72 61 6e 63 68 20 70 61 72 65 th a branch pare
2070: 6e 74 20 73 79 6d 62 6f 6c 20 77 68 6f 73 65 20 nt symbol whose
2080: 70 61 72 65 6e 74 0a 09 23 20 69 73 20 69 6e 20 parent..# is in
2090: 74 68 65 20 73 61 6d 65 20 6c 69 6e 65 20 6f 66 the same line of
20a0: 20 64 65 76 65 6c 6f 70 6d 65 6e 74 2e 0a 09 43 development...C
20b0: 68 65 63 6b 52 65 76 20 5c 0a 09 20 20 20 20 7b heckRev \.. {
20c0: 52 65 76 69 73 69 6f 6e 73 20 61 6e 64 20 74 68 Revisions and th
20d0: 65 69 72 20 62 72 61 6e 63 68 20 63 68 69 6c 64 eir branch child
20e0: 72 65 6e 20 68 61 76 65 20 74 6f 20 62 65 20 69 ren have to be i
20f0: 6e 20 64 69 66 66 65 72 65 6e 74 20 4c 4f 44 73 n different LODs
2100: 7d 20 5c 0a 09 20 20 20 20 7b 61 74 20 74 68 65 } \.. {at the
2110: 20 62 65 67 69 6e 6e 69 6e 67 20 6f 66 20 69 74 beginning of it
2120: 73 20 62 72 61 6e 63 68 20 61 6e 64 20 69 74 73 s branch and its
2130: 20 70 61 72 65 6e 74 20 77 72 6f 6e 67 6c 79 20 parent wrongly
2140: 61 67 72 65 65 20 61 62 6f 75 74 20 74 68 65 69 agree about thei
2150: 72 20 4c 4f 44 7d 20 7b 0a 09 09 53 45 4c 45 43 r LOD} {...SELEC
2160: 54 20 46 2e 6e 61 6d 65 2c 20 52 2e 72 65 76 0a T F.name, R.rev.
2170: 09 09 46 52 4f 4d 20 72 65 76 69 73 69 6f 6e 20 ..FROM revision
2180: 52 2c 20 72 65 76 69 73 69 6f 6e 20 50 2c 20 66 R, revision P, f
2190: 69 6c 65 20 46 0a 09 09 57 48 45 52 45 20 52 2e ile F...WHERE R.
21a0: 66 69 64 20 3d 20 46 2e 66 69 64 0a 09 09 41 4e fid = F.fid...AN
21b0: 44 20 20 20 52 2e 62 70 61 72 65 6e 74 20 49 53 D R.bparent IS
21c0: 20 4e 4f 54 20 4e 55 4c 4c 0a 09 09 41 4e 44 20 NOT NULL...AND
21d0: 20 20 52 2e 70 61 72 65 6e 74 20 3d 20 50 2e 72 R.parent = P.r
21e0: 69 64 0a 09 09 41 4e 44 20 20 20 52 2e 6c 6f 64 id...AND R.lod
21f0: 20 3d 20 50 2e 6c 6f 64 0a 09 09 3b 0a 09 20 20 = P.lod...;..
2200: 20 20 7d 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 }..return.
2210: 7d 0a 0a 20 20 20 20 70 72 6f 63 20 4d 65 74 61 }.. proc Meta
2220: 20 7b 7d 20 7b 0a 09 23 20 54 68 69 73 20 63 6f {} {..# This co
2230: 64 65 20 70 65 72 66 6f 72 6d 73 20 61 20 6e 75 de performs a nu
2240: 6d 62 65 72 20 6f 66 20 70 61 72 61 6e 6f 69 64 mber of paranoid
2250: 20 63 68 65 63 6b 73 20 6f 66 20 74 68 65 0a 09 checks of the..
2260: 23 20 64 61 74 61 62 61 73 65 2c 20 73 65 61 72 # database, sear
2270: 63 68 69 6e 67 20 66 6f 72 20 69 6e 63 6f 6e 73 ching for incons
2280: 69 73 74 65 6e 74 20 63 72 6f 73 73 2d 72 65 66 istent cross-ref
2290: 65 72 65 6e 63 65 73 2e 0a 0a 09 75 70 76 61 72 erences....upvar
22a0: 20 31 20 6e 20 6e 20 3b 20 23 20 43 6f 75 6e 74 1 n n ; # Count
22b0: 65 72 20 66 6f 72 20 74 68 65 20 63 68 65 63 6b er for the check
22c0: 73 20 28 77 65 20 70 72 69 6e 74 20 61 6e 20 69 s (we print an i
22d0: 64 20 62 65 66 6f 72 65 0a 09 09 20 20 20 20 20 d before...
22e0: 20 23 20 74 68 65 20 6d 61 69 6e 20 6c 61 62 65 # the main labe
22f0: 6c 29 2e 0a 0a 09 23 20 46 69 6e 64 20 61 6c 6c l)....# Find all
2300: 20 72 65 76 69 73 69 6f 6e 73 20 77 68 69 63 68 revisions which
2310: 20 64 69 73 67 72 65 65 20 77 69 74 68 20 74 68 disgree with th
2320: 65 69 72 20 6d 65 74 61 20 64 61 74 61 20 61 62 eir meta data ab
2330: 6f 75 74 0a 09 23 20 74 68 65 20 62 72 61 6e 63 out..# the branc
2340: 68 2f 6c 69 6e 65 20 6f 66 20 64 65 76 65 6c 6f h/line of develo
2350: 70 6d 65 6e 74 20 74 68 65 79 20 62 65 6c 6f 6e pment they belon
2360: 67 20 74 6f 2e 0a 09 43 68 65 63 6b 52 65 76 20 g to...CheckRev
2370: 5c 0a 09 20 20 20 20 7b 52 65 76 69 73 69 6f 6e \.. {Revision
2380: 73 20 61 6e 64 20 74 68 65 69 72 20 6d 65 74 61 s and their meta
2390: 20 64 61 74 61 20 68 61 76 65 20 74 6f 20 62 65 data have to be
23a0: 20 69 6e 20 74 68 65 20 73 61 6d 65 20 4c 4f 44 in the same LOD
23b0: 7d 20 5c 0a 09 20 20 20 20 7b 64 69 73 61 67 72 } \.. {disagr
23c0: 65 65 73 20 77 69 74 68 20 69 74 73 20 6d 65 74 ees with its met
23d0: 61 20 64 61 74 61 20 61 62 6f 75 74 20 6f 77 6e a data about own
23e0: 69 6e 67 20 4c 4f 44 7d 20 7b 0a 09 09 53 45 4c ing LOD} {...SEL
23f0: 45 43 54 20 46 2e 6e 61 6d 65 2c 20 52 2e 72 65 ECT F.name, R.re
2400: 76 0a 09 09 46 52 4f 4d 20 72 65 76 69 73 69 6f v...FROM revisio
2410: 6e 20 52 2c 20 6d 65 74 61 20 4d 2c 20 66 69 6c n R, meta M, fil
2420: 65 20 46 0a 09 09 57 48 45 52 45 20 52 2e 6d 69 e F...WHERE R.mi
2430: 64 20 3d 20 4d 2e 6d 69 64 0a 09 09 41 4e 44 20 d = M.mid...AND
2440: 20 20 52 2e 6c 6f 64 20 21 3d 20 4d 2e 62 69 64 R.lod != M.bid
2450: 0a 09 09 41 4e 44 20 20 20 52 2e 66 69 64 20 3d ...AND R.fid =
2460: 20 46 2e 66 69 64 0a 09 09 3b 0a 09 20 20 20 20 F.fid...;..
2470: 7d 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a }..return. }.
2480: 0a 20 20 20 20 70 72 6f 63 20 52 65 76 69 73 69 . proc Revisi
2490: 6f 6e 43 68 61 6e 67 65 73 65 74 73 20 7b 7d 20 onChangesets {}
24a0: 7b 0a 09 23 20 54 68 69 73 20 63 6f 64 65 20 70 {..# This code p
24b0: 65 72 66 6f 72 6d 73 20 61 20 6e 75 6d 62 65 72 erforms a number
24c0: 20 6f 66 20 70 61 72 61 6e 6f 69 64 20 63 68 65 of paranoid che
24d0: 63 6b 73 20 6f 66 20 74 68 65 0a 09 23 20 64 61 cks of the..# da
24e0: 74 61 62 61 73 65 2c 20 73 65 61 72 63 68 69 6e tabase, searchin
24f0: 67 20 66 6f 72 20 69 6e 63 6f 6e 73 69 73 74 65 g for inconsiste
2500: 6e 74 20 63 68 61 6e 67 65 73 65 74 2f 72 65 76 nt changeset/rev
2510: 69 73 69 6f 6e 0a 09 23 20 69 6e 66 6f 72 6d 61 ision..# informa
2520: 74 69 6f 6e 2e 0a 0a 09 75 70 76 61 72 20 31 20 tion....upvar 1
2530: 6e 20 6e 20 3b 20 23 20 43 6f 75 6e 74 65 72 20 n n ; # Counter
2540: 66 6f 72 20 74 68 65 20 63 68 65 63 6b 73 20 28 for the checks (
2550: 77 65 20 70 72 69 6e 74 20 61 6e 20 69 64 20 62 we print an id b
2560: 65 66 6f 72 65 0a 09 09 20 20 20 20 20 20 23 20 efore... #
2570: 74 68 65 20 6d 61 69 6e 20 6c 61 62 65 6c 29 2e the main label).
2580: 0a 0a 09 23 20 46 69 6e 64 20 61 6c 6c 20 72 65 ...# Find all re
2590: 76 69 73 69 6f 6e 73 20 77 68 69 63 68 20 61 72 visions which ar
25a0: 65 20 6e 6f 74 20 75 73 65 64 20 62 79 20 61 74 e not used by at
25b0: 20 6c 65 61 73 74 20 6f 6e 65 0a 09 23 20 63 68 least one..# ch
25c0: 61 6e 67 65 73 65 74 2e 0a 09 43 68 65 63 6b 52 angeset...CheckR
25d0: 65 76 20 5c 0a 09 20 20 20 20 7b 41 6c 6c 20 72 ev \.. {All r
25e0: 65 76 69 73 69 6f 6e 73 20 68 61 76 65 20 74 6f evisions have to
25f0: 20 62 65 20 75 73 65 64 20 62 79 20 6c 65 61 73 be used by leas
2600: 74 20 6f 6e 65 20 63 68 61 6e 67 65 73 65 74 7d t one changeset}
2610: 20 5c 0a 09 20 20 20 20 7b 69 73 20 6e 6f 74 20 \.. {is not
2620: 75 73 65 64 20 62 79 20 61 20 63 68 61 6e 67 65 used by a change
2630: 73 65 74 7d 20 7b 0a 09 09 2d 2d 20 55 6e 75 73 set} {...-- Unus
2640: 65 64 20 72 65 76 69 73 69 6f 6e 73 20 3d 20 41 ed revisions = A
2650: 6c 6c 20 72 65 76 69 73 69 6f 6e 73 0a 09 09 2d ll revisions...-
2660: 2d 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 -
2670: 20 20 20 2d 20 72 65 76 69 73 69 6f 6e 73 20 75 - revisions u
2680: 73 65 64 20 62 79 20 72 65 76 69 73 69 6f 6e 20 sed by revision
2690: 63 68 61 6e 67 65 73 65 74 73 2e 0a 09 09 2d 2d changesets....--
26a0: 0a 09 09 2d 2d 20 42 6f 74 68 20 73 65 74 73 20 ...-- Both sets
26b0: 63 61 6e 20 62 65 20 63 6f 6d 70 75 74 65 64 20 can be computed
26c0: 65 61 73 69 6c 79 2c 20 61 6e 64 20 73 75 62 74 easily, and subt
26d0: 72 61 63 74 65 64 0a 20 20 20 20 20 20 20 20 20 racted.
26e0: 20 20 20 20 20 20 20 2d 2d 20 66 72 6f 6d 20 65 -- from e
26f0: 61 63 68 20 6f 74 68 65 72 2e 20 54 68 65 6e 20 ach other. Then
2700: 77 65 20 63 61 6e 20 67 65 74 20 74 68 65 20 61 we can get the a
2710: 73 73 6f 63 69 61 74 65 64 0a 20 20 20 20 20 20 ssociated.
2720: 20 20 20 20 20 20 20 20 20 20 2d 2d 20 66 69 6c -- fil
2730: 65 20 28 6e 61 6d 65 29 20 66 6f 72 20 64 69 73 e (name) for dis
2740: 70 6c 61 79 2e 0a 0a 09 09 53 45 4c 45 43 54 20 play.....SELECT
2750: 46 2e 6e 61 6d 65 2c 20 52 2e 72 65 76 0a 09 09 F.name, R.rev...
2760: 46 52 4f 4d 20 72 65 76 69 73 69 6f 6e 20 52 2c FROM revision R,
2770: 20 66 69 6c 65 20 46 0a 09 09 57 48 45 52 45 20 file F...WHERE
2780: 52 2e 72 69 64 20 49 4e 20 28 53 45 4c 45 43 54 R.rid IN (SELECT
2790: 20 72 69 64 0a 09 09 09 09 46 52 4f 4d 20 72 65 rid.....FROM re
27a0: 76 69 73 69 6f 6e 20 20 20 20 20 20 20 20 20 20 vision
27b0: 20 20 20 20 20 20 2d 2d 20 41 6c 6c 20 72 65 76 -- All rev
27c0: 69 73 69 6f 6e 73 0a 09 09 09 09 45 58 43 45 50 isions.....EXCEP
27d0: 54 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 T
27e0: 20 20 20 20 20 20 20 20 2d 2d 20 73 75 62 74 72 -- subtr
27f0: 61 63 74 0a 09 09 09 09 53 45 4c 45 43 54 20 43 act.....SELECT C
2800: 49 2e 69 69 64 0a 09 09 09 09 46 52 4f 4d 20 63 I.iid.....FROM c
2810: 73 69 74 65 6d 20 43 49 2c 20 63 68 61 6e 67 65 sitem CI, change
2820: 73 65 74 20 43 20 20 2d 2d 20 72 65 76 69 73 69 set C -- revisi
2830: 6f 6e 73 20 75 73 65 64 0a 09 09 09 09 57 48 45 ons used.....WHE
2840: 52 45 20 43 2e 63 69 64 20 3d 20 43 49 2e 63 69 RE C.cid = CI.ci
2850: 64 20 20 20 20 20 20 20 20 20 2d 2d 20 62 79 20 d -- by
2860: 61 6e 79 20 72 65 76 69 73 69 6f 6e 0a 09 09 09 any revision....
2870: 09 41 4e 44 20 43 2e 74 79 70 65 20 3d 20 30 29 .AND C.type = 0)
2880: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2d 2d --
2890: 20 63 68 61 6e 67 65 73 65 74 0a 09 09 41 4e 44 changeset...AND
28a0: 20 20 20 52 2e 66 69 64 20 3d 20 46 2e 66 69 64 R.fid = F.fid
28b0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2d 2d --
28c0: 20 67 65 74 20 66 69 6c 65 20 6f 66 20 75 6e 75 get file of unu
28d0: 73 65 64 20 72 65 76 69 73 69 6f 6e 0a 09 20 20 sed revision..
28e0: 20 20 7d 0a 09 23 20 46 69 6e 64 20 61 6c 6c 20 }..# Find all
28f0: 72 65 76 69 73 69 6f 6e 73 20 77 68 69 63 68 20 revisions which
2900: 61 72 65 20 75 73 65 64 20 62 79 20 6d 6f 72 65 are used by more
2910: 20 74 68 61 6e 20 6f 6e 65 0a 09 23 20 63 68 61 than one..# cha
2920: 6e 67 65 73 65 74 2e 0a 09 43 68 65 63 6b 52 65 ngeset...CheckRe
2930: 76 20 5c 0a 09 20 20 20 20 7b 41 6c 6c 20 72 65 v \.. {All re
2940: 76 69 73 69 6f 6e 73 20 68 61 76 65 20 74 6f 20 visions have to
2950: 62 65 20 75 73 65 64 20 62 79 20 61 74 20 6d 6f be used by at mo
2960: 73 74 20 6f 6e 65 20 63 68 61 6e 67 65 73 65 74 st one changeset
2970: 7d 20 5c 0a 09 20 20 20 20 7b 69 73 20 75 73 65 } \.. {is use
2980: 64 20 62 79 20 6d 75 6c 74 69 70 6c 65 20 63 68 d by multiple ch
2990: 61 6e 67 65 73 65 74 73 7d 20 7b 0a 09 09 2d 2d angesets} {...--
29a0: 20 50 72 69 6e 63 69 70 6c 65 20 6f 66 20 6f 70 Principle of op
29b0: 65 72 61 74 69 6f 6e 3a 20 47 65 74 20 61 6c 6c eration: Get all
29c0: 20 72 65 76 69 73 69 6f 6e 2f 63 68 61 6e 67 65 revision/change
29d0: 73 65 74 0a 20 20 20 20 20 20 20 20 20 20 20 20 set.
29e0: 20 20 20 20 2d 2d 20 70 61 69 72 73 20 66 6f 72 -- pairs for
29f0: 20 61 6c 6c 20 72 65 76 69 73 69 6f 6e 20 63 68 all revision ch
2a00: 61 6e 67 65 73 65 74 73 2c 20 67 72 6f 75 70 20 angesets, group
2a10: 62 79 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 by.
2a20: 20 20 20 2d 2d 20 72 65 76 69 73 69 6f 6e 20 74 -- revision t
2a30: 6f 20 61 67 67 72 65 67 61 74 65 20 74 68 65 20 o aggregate the
2a40: 63 68 61 6e 67 65 73 65 74 2c 20 63 6f 75 6e 74 changeset, count
2a50: 69 6e 67 0a 20 20 20 20 20 20 20 20 20 20 20 20 ing.
2a60: 20 20 20 20 2d 2d 20 74 68 65 6d 2e 20 46 72 6f -- them. Fro
2a70: 6d 20 74 68 65 20 72 65 73 75 6c 74 69 6e 67 20 m the resulting
2a80: 72 65 76 69 73 69 6f 6e 2f 63 6f 75 6e 74 20 74 revision/count t
2a90: 61 62 6c 65 0a 20 20 20 20 20 20 20 20 20 20 20 able.
2aa0: 20 20 20 20 20 2d 2d 20 73 65 6c 65 63 74 20 74 -- select t
2ab0: 68 6f 73 65 20 77 69 74 68 20 6d 6f 72 65 20 74 hose with more t
2ac0: 68 61 6e 20 6f 6e 65 20 75 73 65 72 2c 20 61 6e han one user, an
2ad0: 64 20 67 65 74 20 74 68 65 69 72 0a 20 20 20 20 d get their.
2ae0: 20 20 20 20 20 20 20 20 20 20 20 20 2d 2d 20 61 -- a
2af0: 73 73 6f 63 69 61 74 65 64 20 66 69 6c 65 20 28 ssociated file (
2b00: 6e 61 6d 65 29 20 66 6f 72 20 64 69 73 70 6c 61 name) for displa
2b10: 79 2e 0a 0a 09 09 53 45 4c 45 43 54 20 46 2e 6e y.....SELECT F.n
2b20: 61 6d 65 2c 20 52 2e 72 65 76 0a 09 09 46 52 4f ame, R.rev...FRO
2b30: 4d 20 72 65 76 69 73 69 6f 6e 20 52 2c 20 66 69 M revision R, fi
2b40: 6c 65 20 46 2c 0a 09 09 20 20 20 20 20 28 53 45 le F,... (SE
2b50: 4c 45 43 54 20 43 49 2e 69 69 64 20 41 53 20 72 LECT CI.iid AS r
2b60: 69 64 2c 20 63 6f 75 6e 74 28 43 49 2e 63 69 64 id, count(CI.cid
2b70: 29 20 41 53 20 63 6f 75 6e 74 0a 09 09 20 20 20 ) AS count...
2b80: 20 20 20 46 52 4f 4d 20 63 73 69 74 65 6d 20 43 FROM csitem C
2b90: 49 2c 20 63 68 61 6e 67 65 73 65 74 20 43 0a 09 I, changeset C..
2ba0: 09 20 20 20 20 20 20 57 48 45 52 45 20 43 2e 74 . WHERE C.t
2bb0: 79 70 65 20 3d 20 30 0a 09 09 20 20 20 20 20 20 ype = 0...
2bc0: 41 4e 44 20 20 20 43 2e 63 69 64 20 3d 20 43 49 AND C.cid = CI
2bd0: 2e 63 69 64 0a 09 09 20 20 20 20 20 20 47 52 4f .cid... GRO
2be0: 55 50 20 42 59 20 43 49 2e 69 69 64 29 20 41 53 UP BY CI.iid) AS
2bf0: 20 55 0a 09 09 57 48 45 52 45 20 55 2e 63 6f 75 U...WHERE U.cou
2c00: 6e 74 20 3e 20 31 0a 09 09 41 4e 44 20 52 2e 72 nt > 1...AND R.r
2c10: 69 64 20 3d 20 55 2e 72 69 64 0a 09 09 41 4e 44 id = U.rid...AND
2c20: 20 52 2e 66 69 64 20 3d 20 46 2e 66 69 64 0a 09 R.fid = F.fid..
2c30: 20 20 20 20 7d 0a 09 23 20 41 6c 6c 20 72 65 76 }..# All rev
2c40: 69 73 69 6f 6e 73 20 68 61 76 65 20 74 6f 20 72 isions have to r
2c50: 65 66 65 72 20 74 6f 20 74 68 65 20 73 61 6d 65 efer to the same
2c60: 20 6d 65 74 61 20 69 6e 66 6f 72 6d 61 74 69 6f meta informatio
2c70: 6e 20 61 73 0a 09 23 20 74 68 65 69 72 20 63 68 n as..# their ch
2c80: 61 6e 67 65 73 65 74 2e 0a 09 43 68 65 63 6b 52 angeset...CheckR
2c90: 65 76 43 53 20 5c 0a 09 20 20 20 20 7b 41 6c 6c evCS \.. {All
2ca0: 20 72 65 76 69 73 69 6f 6e 73 20 68 61 76 65 20 revisions have
2cb0: 74 6f 20 61 67 72 65 65 20 77 69 74 68 20 74 68 to agree with th
2cc0: 65 69 72 20 63 68 61 6e 67 65 73 65 74 20 61 62 eir changeset ab
2cd0: 6f 75 74 20 74 68 65 20 75 73 65 64 20 6d 65 74 out the used met
2ce0: 61 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 7d 20 5c a information} \
2cf0: 0a 09 20 20 20 20 7b 64 69 73 61 67 72 65 65 73 .. {disagrees
2d00: 20 77 69 74 68 20 69 74 73 20 63 68 61 6e 67 65 with its change
2d10: 73 65 74 20 40 20 61 62 6f 75 74 20 74 68 65 20 set @ about the
2d20: 6d 65 74 61 20 69 6e 66 6f 72 6d 61 74 69 6f 6e meta information
2d30: 7d 20 7b 0a 09 09 53 45 4c 45 43 54 20 43 54 2e } {...SELECT CT.
2d40: 6e 61 6d 65 2c 20 43 2e 63 69 64 2c 20 46 2e 6e name, C.cid, F.n
2d50: 61 6d 65 2c 20 52 2e 72 65 76 0a 09 09 46 52 4f ame, R.rev...FRO
2d60: 4d 20 63 68 61 6e 67 65 73 65 74 20 43 2c 20 63 M changeset C, c
2d70: 73 74 79 70 65 20 43 54 2c 20 72 65 76 69 73 69 stype CT, revisi
2d80: 6f 6e 20 52 2c 20 66 69 6c 65 20 46 2c 20 63 73 on R, file F, cs
2d90: 69 74 65 6d 20 43 49 0a 09 09 57 48 45 52 45 20 item CI...WHERE
2da0: 43 2e 74 79 70 65 20 3d 20 30 20 20 20 20 20 20 C.type = 0
2db0: 20 2d 2d 20 72 65 76 69 73 69 6f 6e 20 63 68 61 -- revision cha
2dc0: 6e 67 65 73 65 74 73 20 6f 6e 6c 79 0a 09 09 41 ngesets only...A
2dd0: 4e 44 20 20 20 43 2e 63 69 64 20 20 3d 20 43 49 ND C.cid = CI
2de0: 2e 63 69 64 20 20 2d 2d 20 63 68 61 6e 67 65 73 .cid -- changes
2df0: 65 74 20 2d 2d 3e 20 69 74 73 20 72 65 76 69 73 et --> its revis
2e00: 69 6f 6e 73 0a 09 09 41 4e 44 20 20 20 52 2e 72 ions...AND R.r
2e10: 69 64 20 20 3d 20 43 49 2e 69 69 64 20 20 2d 2d id = CI.iid --
2e20: 20 6c 6f 6f 6b 20 61 74 20 74 68 65 6d 0a 09 09 look at them...
2e30: 41 4e 44 20 20 20 52 2e 6d 69 64 20 21 3d 20 43 AND R.mid != C
2e40: 2e 73 72 63 20 20 20 2d 2d 20 4f 6e 6c 79 20 74 .src -- Only t
2e50: 68 6f 73 65 20 77 68 69 63 68 20 64 69 73 61 67 hose which disag
2e60: 72 65 65 20 77 69 74 68 20 63 68 61 6e 67 65 73 ree with changes
2e70: 65 74 20 61 62 6f 75 74 20 74 68 65 20 6d 65 74 et about the met
2e80: 61 0a 09 09 41 4e 44 20 20 20 52 2e 66 69 64 20 a...AND R.fid
2e90: 3d 20 46 2e 66 69 64 20 20 20 20 2d 2d 20 67 65 = F.fid -- ge
2ea0: 74 20 66 69 6c 65 20 6f 66 20 74 68 65 20 72 65 t file of the re
2eb0: 76 69 73 69 6f 6e 0a 09 09 41 4e 44 20 20 20 43 vision...AND C
2ec0: 54 2e 74 69 64 20 3d 20 43 2e 74 79 70 65 20 20 T.tid = C.type
2ed0: 2d 2d 20 67 65 74 20 63 68 61 6e 67 65 73 65 74 -- get changeset
2ee0: 20 74 79 70 65 2c 20 66 6f 72 20 6c 61 62 65 6c type, for label
2ef0: 69 6e 67 0a 09 20 20 20 20 7d 0a 09 23 20 41 6c ing.. }..# Al
2f00: 6c 20 72 65 76 69 73 69 6f 6e 73 20 68 61 76 65 l revisions have
2f10: 20 74 6f 20 61 67 72 65 65 20 6f 6e 20 74 68 65 to agree on the
2f20: 20 4c 4f 44 20 74 68 65 69 72 20 63 68 61 6e 67 LOD their chang
2f30: 65 73 65 74 0a 09 23 20 62 65 6c 6f 6e 67 73 20 eset..# belongs
2f40: 74 6f 2e 20 49 6e 20 6f 74 68 65 72 20 77 6f 72 to. In other wor
2f50: 64 73 2c 20 61 6c 6c 20 72 65 76 69 73 69 6f 6e ds, all revision
2f60: 73 20 69 6e 20 61 20 63 68 61 6e 67 65 73 65 74 s in a changeset
2f70: 0a 09 23 20 68 61 76 65 20 74 6f 20 72 65 66 65 ..# have to refe
2f80: 72 20 74 6f 20 74 68 65 20 73 61 6d 65 20 6c 69 r to the same li
2f90: 6e 65 20 6f 66 20 64 65 76 65 6c 6f 70 6d 65 6e ne of developmen
2fa0: 74 2e 0a 09 23 0a 09 23 20 49 6e 73 74 65 61 64 t...#..# Instead
2fb0: 20 6f 66 20 6c 6f 6f 6b 69 6e 67 20 61 74 20 61 of looking at a
2fc0: 6c 6c 20 70 61 69 72 73 20 6f 66 20 72 65 76 69 ll pairs of revi
2fd0: 73 69 6f 6e 73 20 69 6e 20 61 6c 6c 0a 09 23 20 sions in all..#
2fe0: 63 68 61 6e 67 65 73 65 74 73 20 77 65 20 67 65 changesets we ge
2ff0: 6e 65 72 61 74 65 20 74 68 65 20 64 69 73 74 69 nerate the disti
3000: 6e 63 74 20 73 65 74 20 6f 66 20 61 6c 6c 20 4c nct set of all L
3010: 4f 44 73 0a 09 23 20 72 65 66 65 72 65 6e 63 65 ODs..# reference
3020: 64 20 62 79 20 74 68 65 20 72 65 76 69 73 69 6f d by the revisio
3030: 6e 73 20 6f 66 20 61 20 63 68 61 6e 67 65 73 65 ns of a changese
3040: 74 2c 20 6c 6f 6f 6b 20 66 6f 72 20 74 68 6f 73 t, look for thos
3050: 65 0a 09 23 20 77 69 74 68 20 63 61 72 64 69 6e e..# with cardin
3060: 61 6c 69 74 79 20 3e 20 31 2c 20 61 6e 64 20 67 ality > 1, and g
3070: 65 74 20 74 68 65 20 69 64 65 6e 74 69 66 79 69 et the identifyi
3080: 6e 67 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 0a 09 ng information..
3090: 23 20 66 6f 72 20 74 68 65 20 63 68 61 6e 67 65 # for the change
30a0: 73 65 74 73 20 66 6f 75 6e 64 20 74 68 75 73 6c sets found thusl
30b0: 79 2e 0a 09 43 68 65 63 6b 43 53 20 5c 0a 09 20 y...CheckCS \..
30c0: 20 20 20 7b 41 6c 6c 20 72 65 76 69 73 69 6f 6e {All revision
30d0: 73 20 69 6e 20 61 20 63 68 61 6e 67 65 73 65 74 s in a changeset
30e0: 20 68 61 76 65 20 74 6f 20 62 65 6c 6f 6e 67 20 have to belong
30f0: 74 6f 20 74 68 65 20 73 61 6d 65 20 4c 4f 44 7d to the same LOD}
3100: 20 5c 0a 09 20 20 20 20 7b 3a 20 49 74 73 20 72 \.. {: Its r
3110: 65 76 69 73 69 6f 6e 73 20 64 69 73 61 67 72 65 evisions disagre
3120: 65 20 61 62 6f 75 74 20 74 68 65 20 4c 4f 44 20 e about the LOD
3130: 74 68 65 79 20 62 65 6c 6f 6e 67 20 74 6f 7d 20 they belong to}
3140: 7b 0a 09 09 53 45 4c 45 43 54 20 54 2e 6e 61 6d {...SELECT T.nam
3150: 65 2c 20 43 2e 63 69 64 0a 09 09 46 52 4f 4d 20 e, C.cid...FROM
3160: 20 20 63 68 61 6e 67 65 73 65 74 20 43 2c 20 63 changeset C, c
3170: 73 74 79 70 65 20 54 0a 09 09 57 48 45 52 45 20 stype T...WHERE
3180: 20 43 2e 63 69 64 20 49 4e 20 28 53 45 4c 45 43 C.cid IN (SELEC
3190: 54 20 55 2e 63 69 64 0a 09 09 09 09 20 46 52 4f T U.cid..... FRO
31a0: 4d 20 28 53 45 4c 45 43 54 20 44 49 53 54 49 4e M (SELECT DISTIN
31b0: 43 54 20 43 49 2e 63 69 64 20 41 53 20 63 69 64 CT CI.cid AS cid
31c0: 2c 20 52 2e 6c 6f 64 20 41 53 20 6c 6f 64 0a 09 , R.lod AS lod..
31d0: 09 09 09 20 20 20 20 20 20 20 46 52 4f 4d 20 20 ... FROM
31e0: 20 63 73 69 74 65 6d 20 43 49 2c 20 63 68 61 6e csitem CI, chan
31f0: 67 65 73 65 74 20 43 2c 20 72 65 76 69 73 69 6f geset C, revisio
3200: 6e 20 52 0a 09 09 09 09 20 20 20 20 20 20 20 57 n R..... W
3210: 48 45 52 45 20 20 43 49 2e 69 69 64 20 3d 20 52 HERE CI.iid = R
3220: 2e 72 69 64 0a 09 09 09 09 20 20 20 20 20 20 20 .rid.....
3230: 41 4e 44 20 20 20 20 43 2e 63 69 64 20 3d 20 43 AND C.cid = C
3240: 49 2e 63 69 64 0a 09 09 09 09 20 20 20 20 20 20 I.cid.....
3250: 20 41 4e 44 20 20 20 20 43 2e 74 79 70 65 20 3d AND C.type =
3260: 20 30 29 20 41 53 20 55 0a 09 09 09 09 20 47 52 0) AS U..... GR
3270: 4f 55 50 20 42 59 20 55 2e 63 69 64 20 48 41 56 OUP BY U.cid HAV
3280: 49 4e 47 20 43 4f 55 4e 54 28 55 2e 6c 6f 64 29 ING COUNT(U.lod)
3290: 20 3e 20 31 29 0a 09 09 41 4e 44 20 20 20 20 54 > 1)...AND T
32a0: 2e 74 69 64 20 3d 20 43 2e 74 79 70 65 0a 09 20 .tid = C.type..
32b0: 20 20 20 7d 0a 09 23 20 41 6c 6c 20 72 65 76 69 }..# All revi
32c0: 73 69 6f 6e 73 20 68 61 76 65 20 74 6f 20 61 67 sions have to ag
32d0: 72 65 65 20 6f 6e 20 74 68 65 20 70 72 6f 6a 65 ree on the proje
32e0: 63 74 20 74 68 65 69 72 20 63 68 61 6e 67 65 73 ct their changes
32f0: 65 74 0a 09 23 20 62 65 6c 6f 6e 67 73 20 74 6f et..# belongs to
3300: 2e 20 49 6e 20 6f 74 68 65 72 20 77 6f 72 64 73 . In other words
3310: 2c 20 61 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 , all revisions
3320: 69 6e 20 61 20 63 68 61 6e 67 65 73 65 74 0a 09 in a changeset..
3330: 23 20 68 61 76 65 20 74 6f 20 72 65 66 65 72 20 # have to refer
3340: 74 6f 20 74 68 65 20 73 61 6d 65 20 70 72 6f 6a to the same proj
3350: 65 63 74 2e 0a 09 23 0a 09 23 20 49 6e 73 74 65 ect...#..# Inste
3360: 61 64 20 6f 66 20 6c 6f 6f 6b 69 6e 67 20 61 74 ad of looking at
3370: 20 61 6c 6c 20 70 61 69 72 73 20 6f 66 20 72 65 all pairs of re
3380: 76 69 73 69 6f 6e 73 20 69 6e 20 61 6c 6c 0a 09 visions in all..
3390: 23 20 63 68 61 6e 67 65 73 65 74 73 20 77 65 20 # changesets we
33a0: 67 65 6e 65 72 61 74 65 20 74 68 65 20 64 69 73 generate the dis
33b0: 74 69 6e 63 74 20 73 65 74 20 6f 66 20 61 6c 6c tinct set of all
33c0: 20 70 72 6f 6a 65 63 74 73 0a 09 23 20 72 65 66 projects..# ref
33d0: 65 72 65 6e 63 65 64 20 62 79 20 74 68 65 20 72 erenced by the r
33e0: 65 76 69 73 69 6f 6e 73 20 6f 66 20 61 20 63 68 evisions of a ch
33f0: 61 6e 67 65 73 65 74 2c 20 6c 6f 6f 6b 20 66 6f angeset, look fo
3400: 72 20 74 68 6f 73 65 0a 09 23 20 77 69 74 68 20 r those..# with
3410: 63 61 72 64 69 6e 61 6c 69 74 79 20 3e 20 31 2c cardinality > 1,
3420: 20 61 6e 64 20 67 65 74 20 74 68 65 20 69 64 65 and get the ide
3430: 6e 74 69 66 79 69 6e 67 20 69 6e 66 6f 72 6d 61 ntifying informa
3440: 74 69 6f 6e 0a 09 23 20 66 6f 72 20 74 68 65 20 tion..# for the
3450: 63 68 61 6e 67 65 73 65 74 73 20 66 6f 75 6e 64 changesets found
3460: 20 74 68 75 73 6c 79 2e 0a 09 43 68 65 63 6b 43 thusly...CheckC
3470: 53 20 5c 0a 09 20 20 20 20 7b 41 6c 6c 20 72 65 S \.. {All re
3480: 76 69 73 69 6f 6e 73 20 69 6e 20 61 20 63 68 61 visions in a cha
3490: 6e 67 65 73 65 74 20 68 61 76 65 20 74 6f 20 62 ngeset have to b
34a0: 65 6c 6f 6e 67 20 74 6f 20 74 68 65 20 73 61 6d elong to the sam
34b0: 65 20 70 72 6f 6a 65 63 74 7d 20 5c 0a 09 20 20 e project} \..
34c0: 20 20 7b 3a 20 49 74 73 20 72 65 76 69 73 69 6f {: Its revisio
34d0: 6e 73 20 64 69 73 61 67 72 65 65 20 61 62 6f 75 ns disagree abou
34e0: 74 20 74 68 65 20 70 72 6f 6a 65 63 74 20 74 68 t the project th
34f0: 65 79 20 62 65 6c 6f 6e 67 20 74 6f 7d 20 7b 0a ey belong to} {.
3500: 09 09 53 45 4c 45 43 54 20 54 2e 6e 61 6d 65 2c ..SELECT T.name,
3510: 20 43 2e 63 69 64 0a 09 09 46 52 4f 4d 20 20 20 C.cid...FROM
3520: 63 68 61 6e 67 65 73 65 74 20 43 2c 20 63 73 74 changeset C, cst
3530: 79 70 65 20 54 0a 09 09 57 48 45 52 45 20 20 43 ype T...WHERE C
3540: 2e 63 69 64 20 49 4e 20 28 53 45 4c 45 43 54 20 .cid IN (SELECT
3550: 55 2e 63 69 64 0a 09 09 09 09 20 46 52 4f 4d 20 U.cid..... FROM
3560: 28 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 (SELECT DISTINCT
3570: 20 43 49 2e 63 69 64 20 41 53 20 63 69 64 2c 20 CI.cid AS cid,
3580: 46 2e 70 69 64 20 41 53 20 70 69 64 0a 09 09 09 F.pid AS pid....
3590: 09 20 20 20 20 20 20 20 46 52 4f 4d 20 20 20 63 . FROM c
35a0: 73 69 74 65 6d 20 43 49 2c 20 63 68 61 6e 67 65 sitem CI, change
35b0: 73 65 74 20 43 2c 20 72 65 76 69 73 69 6f 6e 20 set C, revision
35c0: 52 2c 20 66 69 6c 65 20 46 0a 09 09 09 09 20 20 R, file F.....
35d0: 20 20 20 20 20 57 48 45 52 45 20 20 43 49 2e 69 WHERE CI.i
35e0: 69 64 20 3d 20 52 2e 72 69 64 0a 09 09 09 09 20 id = R.rid.....
35f0: 20 20 20 20 20 20 41 4e 44 20 20 20 20 43 2e 63 AND C.c
3600: 69 64 20 3d 20 43 49 2e 63 69 64 0a 09 09 09 09 id = CI.cid.....
3610: 20 20 20 20 20 20 20 41 4e 44 20 20 20 20 43 2e AND C.
3620: 74 79 70 65 20 3d 20 30 0a 09 09 09 09 20 20 20 type = 0.....
3630: 20 20 20 20 41 4e 44 20 20 20 20 46 2e 66 69 64 AND F.fid
3640: 20 20 3d 20 52 2e 66 69 64 29 20 41 53 20 55 0a = R.fid) AS U.
3650: 09 09 09 09 20 47 52 4f 55 50 20 42 59 20 55 2e .... GROUP BY U.
3660: 63 69 64 20 48 41 56 49 4e 47 20 43 4f 55 4e 54 cid HAVING COUNT
3670: 28 55 2e 70 69 64 29 20 3e 20 31 29 0a 09 09 41 (U.pid) > 1)...A
3680: 4e 44 20 20 20 20 54 2e 74 69 64 20 3d 20 43 2e ND T.tid = C.
3690: 74 79 70 65 0a 09 20 20 20 20 7d 0a 09 23 20 41 type.. }..# A
36a0: 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 69 6e 20 ll revisions in
36b0: 61 20 73 69 6e 67 6c 65 20 63 68 61 6e 67 65 73 a single changes
36c0: 65 74 20 68 61 76 65 20 74 6f 20 62 65 6c 6f 6e et have to belon
36d0: 67 20 74 6f 0a 09 23 20 64 69 66 66 65 72 65 6e g to..# differen
36e0: 74 20 66 69 6c 65 73 2e 20 43 6f 6e 76 65 72 73 t files. Convers
36f0: 65 6c 79 3a 20 4e 6f 20 74 77 6f 20 72 65 76 69 ely: No two revi
3700: 73 69 6f 6e 73 20 6f 66 20 61 20 73 69 6e 67 6c sions of a singl
3710: 65 0a 09 23 20 66 69 6c 65 20 61 72 65 20 61 6c e..# file are al
3720: 6c 6f 77 65 64 20 74 6f 20 62 65 20 69 6e 20 74 lowed to be in t
3730: 68 65 20 73 61 6d 65 20 63 68 61 6e 67 65 73 65 he same changese
3740: 74 2e 0a 09 23 0a 09 23 20 49 6e 73 74 65 61 64 t...#..# Instead
3750: 20 6f 66 20 6c 6f 6f 6b 69 6e 67 20 61 74 20 61 of looking at a
3760: 6c 6c 20 70 61 69 72 73 20 6f 66 20 72 65 76 69 ll pairs of revi
3770: 73 69 6f 6e 73 20 69 6e 20 61 6c 6c 0a 09 23 20 sions in all..#
3780: 63 68 61 6e 67 65 73 65 74 73 20 77 65 20 67 65 changesets we ge
3790: 6e 65 72 61 74 65 20 74 68 65 20 64 69 73 74 69 nerate the disti
37a0: 6e 63 74 20 73 65 74 20 6f 66 20 61 6c 6c 20 66 nct set of all f
37b0: 69 6c 65 73 0a 09 23 20 72 65 66 65 72 65 6e 63 iles..# referenc
37c0: 65 64 20 62 79 20 74 68 65 20 72 65 76 69 73 69 ed by the revisi
37d0: 6f 6e 73 20 6f 66 20 61 20 63 68 61 6e 67 65 73 ons of a changes
37e0: 65 74 2c 20 61 6e 64 20 6c 6f 6f 6b 20 66 6f 72 et, and look for
37f0: 0a 09 23 20 74 68 6f 73 65 20 77 69 74 68 20 63 ..# those with c
3800: 61 72 64 69 6e 61 6c 69 74 79 20 3c 20 74 68 65 ardinality < the
3810: 20 63 61 72 64 69 6e 61 6c 69 74 79 20 6f 66 20 cardinality of
3820: 74 68 65 20 73 65 74 20 6f 66 0a 09 23 20 72 65 the set of..# re
3830: 76 69 73 69 6f 6e 73 2c 20 61 6e 64 20 67 65 74 visions, and get
3840: 20 74 68 65 20 69 64 65 6e 74 69 66 79 69 6e 67 the identifying
3850: 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 66 6f 72 information for
3860: 20 74 68 65 0a 09 23 20 63 68 61 6e 67 65 73 65 the..# changese
3870: 74 73 20 66 6f 75 6e 64 20 74 68 75 73 6c 79 2e ts found thusly.
3880: 0a 09 43 68 65 63 6b 43 53 20 5c 0a 09 20 20 20 ..CheckCS \..
3890: 20 7b 41 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 {All revisions
38a0: 69 6e 20 61 20 63 68 61 6e 67 65 73 65 74 20 68 in a changeset h
38b0: 61 76 65 20 74 6f 20 62 65 6c 6f 6e 67 20 74 6f ave to belong to
38c0: 20 64 69 66 66 65 72 65 6e 74 20 66 69 6c 65 73 different files
38d0: 7d 20 5c 0a 09 20 20 20 20 7b 3a 20 49 74 73 20 } \.. {: Its
38e0: 72 65 76 69 73 69 6f 6e 73 20 73 68 61 72 65 20 revisions share
38f0: 66 69 6c 65 73 7d 20 7b 0a 09 09 53 45 4c 45 43 files} {...SELEC
3900: 54 20 54 2e 6e 61 6d 65 2c 20 43 2e 63 69 64 0a T T.name, C.cid.
3910: 09 09 46 52 4f 4d 20 20 20 63 68 61 6e 67 65 73 ..FROM changes
3920: 65 74 20 43 2c 20 63 73 74 79 70 65 20 54 0a 09 et C, cstype T..
3930: 09 57 48 45 52 45 20 20 43 2e 63 69 64 20 49 4e .WHERE C.cid IN
3940: 20 28 53 45 4c 45 43 54 20 56 56 2e 63 69 64 0a (SELECT VV.cid.
3950: 09 09 09 09 20 46 52 4f 4d 20 28 53 45 4c 45 43 .... FROM (SELEC
3960: 54 20 55 2e 63 69 64 20 61 73 20 63 69 64 2c 20 T U.cid as cid,
3970: 43 4f 55 4e 54 20 28 55 2e 66 69 64 29 20 41 53 COUNT (U.fid) AS
3980: 20 66 63 6f 75 6e 74 0a 09 09 09 09 20 20 20 20 fcount.....
3990: 20 20 20 46 52 4f 4d 20 28 53 45 4c 45 43 54 20 FROM (SELECT
39a0: 44 49 53 54 49 4e 43 54 20 43 49 2e 63 69 64 20 DISTINCT CI.cid
39b0: 41 53 20 63 69 64 2c 20 52 2e 66 69 64 20 41 53 AS cid, R.fid AS
39c0: 20 66 69 64 0a 09 09 09 09 09 20 20 20 20 20 46 fid...... F
39d0: 52 4f 4d 20 20 20 63 73 69 74 65 6d 20 43 49 2c ROM csitem CI,
39e0: 20 63 68 61 6e 67 65 73 65 74 20 43 2c 20 72 65 changeset C, re
39f0: 76 69 73 69 6f 6e 20 52 0a 09 09 09 09 09 20 20 vision R......
3a00: 20 20 20 57 48 45 52 45 20 20 43 49 2e 69 69 64 WHERE CI.iid
3a10: 20 3d 20 52 2e 72 69 64 0a 09 09 09 09 09 20 20 = R.rid......
3a20: 20 20 20 41 4e 44 20 20 20 20 43 2e 63 69 64 20 AND C.cid
3a30: 3d 20 43 49 2e 63 69 64 0a 09 09 09 09 09 20 20 = CI.cid......
3a40: 20 20 20 41 4e 44 20 20 20 20 43 2e 74 79 70 65 AND C.type
3a50: 20 3d 20 30 0a 09 09 09 09 09 20 20 20 20 20 29 = 0...... )
3a60: 20 41 53 20 55 0a 09 09 09 09 20 20 20 20 20 20 AS U.....
3a70: 20 47 52 4f 55 50 20 42 59 20 55 2e 63 69 64 29 GROUP BY U.cid)
3a80: 20 41 53 20 55 55 2c 0a 09 09 09 09 20 20 20 20 AS UU,.....
3a90: 20 20 28 53 45 4c 45 43 54 20 56 2e 63 69 64 20 (SELECT V.cid
3aa0: 41 53 20 63 69 64 2c 20 43 4f 55 4e 54 20 28 56 AS cid, COUNT (V
3ab0: 2e 69 69 64 29 20 41 53 20 72 63 6f 75 6e 74 0a .iid) AS rcount.
3ac0: 09 09 09 09 20 20 20 20 20 20 20 46 52 4f 4d 20 .... FROM
3ad0: 20 20 63 73 69 74 65 6d 20 56 2c 20 63 68 61 6e csitem V, chan
3ae0: 67 65 73 65 74 20 58 0a 09 09 09 09 20 20 20 20 geset X.....
3af0: 20 20 20 57 48 45 52 45 20 20 58 2e 63 69 64 20 WHERE X.cid
3b00: 3d 20 56 2e 63 69 64 0a 09 09 09 09 20 20 20 20 = V.cid.....
3b10: 20 20 20 41 4e 44 20 20 20 20 58 2e 74 79 70 65 AND X.type
3b20: 20 3d 20 30 0a 09 09 09 09 20 20 20 20 20 20 20 = 0.....
3b30: 47 52 4f 55 50 20 42 59 20 56 2e 63 69 64 29 20 GROUP BY V.cid)
3b40: 41 53 20 56 56 0a 09 09 09 09 20 57 48 45 52 45 AS VV..... WHERE
3b50: 20 56 56 2e 63 69 64 20 3d 20 55 55 2e 63 69 64 VV.cid = UU.cid
3b60: 0a 09 09 09 09 20 41 4e 44 20 20 20 55 55 2e 66 ..... AND UU.f
3b70: 63 6f 75 6e 74 20 3c 20 56 56 2e 72 63 6f 75 6e count < VV.rcoun
3b80: 74 29 0a 09 09 41 4e 44 20 20 20 20 54 2e 74 69 t)...AND T.ti
3b90: 64 20 3d 20 43 2e 74 79 70 65 0a 09 20 20 20 20 d = C.type..
3ba0: 7d 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a }..return. }.
3bb0: 0a 20 20 20 20 70 72 6f 63 20 54 61 67 43 68 61 . proc TagCha
3bc0: 6e 67 65 73 65 74 73 20 7b 7d 20 7b 0a 09 23 20 ngesets {} {..#
3bd0: 54 68 69 73 20 63 6f 64 65 20 70 65 72 66 6f 72 This code perfor
3be0: 6d 73 20 61 20 6e 75 6d 62 65 72 20 6f 66 20 70 ms a number of p
3bf0: 61 72 61 6e 6f 69 64 20 63 68 65 63 6b 73 20 6f aranoid checks o
3c00: 66 20 74 68 65 0a 09 23 20 64 61 74 61 62 61 73 f the..# databas
3c10: 65 2c 20 73 65 61 72 63 68 69 6e 67 20 66 6f 72 e, searching for
3c20: 20 69 6e 63 6f 6e 73 69 73 74 65 6e 74 20 63 68 inconsistent ch
3c30: 61 6e 67 65 73 65 74 2f 72 65 76 69 73 69 6f 6e angeset/revision
3c40: 0a 09 23 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 2e ..# information.
3c50: 0a 0a 09 75 70 76 61 72 20 31 20 6e 20 6e 20 3b ...upvar 1 n n ;
3c60: 20 23 20 43 6f 75 6e 74 65 72 20 66 6f 72 20 74 # Counter for t
3c70: 68 65 20 63 68 65 63 6b 73 20 28 77 65 20 70 72 he checks (we pr
3c80: 69 6e 74 20 61 6e 20 69 64 20 62 65 66 6f 72 65 int an id before
3c90: 0a 09 09 20 20 20 20 20 20 23 20 74 68 65 20 6d ... # the m
3ca0: 61 69 6e 20 6c 61 62 65 6c 29 2e 0a 0a 09 23 20 ain label)....#
3cb0: 46 69 6e 64 20 61 6c 6c 20 74 61 67 73 20 77 68 Find all tags wh
3cc0: 69 63 68 20 61 72 65 20 6e 6f 74 20 75 73 65 64 ich are not used
3cd0: 20 62 79 20 61 74 20 6c 65 61 73 74 20 6f 6e 65 by at least one
3ce0: 20 63 68 61 6e 67 65 73 65 74 2e 0a 09 43 68 65 changeset...Che
3cf0: 63 6b 54 61 67 20 5c 0a 09 20 20 20 20 7b 41 6c ckTag \.. {Al
3d00: 6c 20 74 61 67 73 20 68 61 76 65 20 74 6f 20 62 l tags have to b
3d10: 65 20 75 73 65 64 20 62 79 20 6c 65 61 73 74 20 e used by least
3d20: 6f 6e 65 20 63 68 61 6e 67 65 73 65 74 7d 20 5c one changeset} \
3d30: 0a 09 20 20 20 20 7b 69 73 20 6e 6f 74 20 75 73 .. {is not us
3d40: 65 64 20 62 79 20 61 20 63 68 61 6e 67 65 73 65 ed by a changese
3d50: 74 7d 20 7b 0a 09 09 2d 2d 20 55 6e 75 73 65 64 t} {...-- Unused
3d60: 20 74 61 67 73 20 3d 20 41 6c 6c 20 74 61 67 73 tags = All tags
3d70: 0a 09 09 2d 2d 20 20 20 20 20 20 20 20 20 20 20 ...--
3d80: 20 20 2d 20 72 65 76 69 73 69 6f 6e 73 20 75 73 - revisions us
3d90: 65 64 20 62 79 20 74 61 67 20 63 68 61 6e 67 65 ed by tag change
3da0: 73 65 74 73 2e 0a 09 09 2d 2d 0a 09 09 2d 2d 20 sets....--...--
3db0: 42 6f 74 68 20 73 65 74 73 20 63 61 6e 20 62 65 Both sets can be
3dc0: 20 63 6f 6d 70 75 74 65 64 20 65 61 73 69 6c 79 computed easily
3dd0: 2c 20 61 6e 64 20 73 75 62 74 72 61 63 74 65 64 , and subtracted
3de0: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
3df0: 20 2d 2d 20 66 72 6f 6d 20 65 61 63 68 20 6f 74 -- from each ot
3e00: 68 65 72 2e 20 54 68 65 6e 20 77 65 20 63 61 6e her. Then we can
3e10: 20 67 65 74 20 74 68 65 20 61 73 73 6f 63 69 61 get the associa
3e20: 74 65 64 0a 20 20 20 20 20 20 20 20 20 20 20 20 ted.
3e30: 20 20 20 20 2d 2d 20 66 69 6c 65 20 28 6e 61 6d -- file (nam
3e40: 65 29 20 66 6f 72 20 64 69 73 70 6c 61 79 2e 0a e) for display..
3e50: 0a 09 09 53 45 4c 45 43 54 20 50 2e 6e 61 6d 65 ...SELECT P.name
3e60: 2c 20 53 2e 6e 61 6d 65 0a 09 09 46 52 4f 4d 20 , S.name...FROM
3e70: 70 72 6f 6a 65 63 74 20 50 2c 20 74 61 67 20 54 project P, tag T
3e80: 2c 20 73 79 6d 62 6f 6c 20 53 0a 09 09 57 48 45 , symbol S...WHE
3e90: 52 45 20 54 2e 74 69 64 20 49 4e 20 28 53 45 4c RE T.tid IN (SEL
3ea0: 45 43 54 20 74 69 64 20 20 20 20 20 20 20 20 20 ECT tid
3eb0: 20 20 20 20 20 20 20 20 20 20 20 2d 2d 20 41 6c -- Al
3ec0: 6c 20 74 61 67 73 0a 09 09 09 09 46 52 4f 4d 20 l tags.....FROM
3ed0: 20 20 74 61 67 0a 09 09 09 09 45 58 43 45 50 54 tag.....EXCEPT
3ee0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
3ef0: 20 20 20 20 20 20 20 20 2d 2d 20 73 75 62 74 72 -- subtr
3f00: 61 63 74 0a 09 09 09 09 53 45 4c 45 43 54 20 43 act.....SELECT C
3f10: 49 2e 69 69 64 20 20 20 20 20 20 20 20 20 20 20 I.iid
3f20: 20 20 20 20 20 20 2d 2d 20 74 61 67 73 20 75 73 -- tags us
3f30: 65 64 0a 09 09 09 09 46 52 4f 4d 20 20 20 63 73 ed.....FROM cs
3f40: 69 74 65 6d 20 43 49 2c 20 63 68 61 6e 67 65 73 item CI, changes
3f50: 65 74 20 43 0a 09 09 09 09 57 48 45 52 45 20 20 et C.....WHERE
3f60: 43 2e 63 69 64 20 3d 20 43 49 2e 63 69 64 20 20 C.cid = CI.cid
3f70: 20 20 20 20 20 20 20 2d 2d 20 62 79 20 61 6e 79 -- by any
3f80: 20 74 61 67 0a 09 09 09 09 41 4e 44 20 20 20 20 tag.....AND
3f90: 43 2e 74 79 70 65 20 3d 20 31 29 20 20 20 20 20 C.type = 1)
3fa0: 20 20 20 20 20 20 20 2d 2d 20 63 68 61 6e 67 65 -- change
3fb0: 73 65 74 0a 09 09 41 4e 44 20 20 20 53 2e 73 69 set...AND S.si
3fc0: 64 20 3d 20 54 2e 73 69 64 20 20 20 20 20 20 20 d = T.sid
3fd0: 20 20 20 20 20 20 20 20 2d 2d 20 67 65 74 20 73 -- get s
3fe0: 79 6d 62 6f 6c 20 6f 66 20 74 61 67 0a 09 09 41 ymbol of tag...A
3ff0: 4e 44 20 20 20 50 2e 70 69 64 20 3d 20 53 2e 70 ND P.pid = S.p
4000: 69 64 20 20 20 20 20 20 20 20 20 20 20 20 20 20 id
4010: 20 2d 2d 20 67 65 74 20 70 72 6f 6a 65 63 74 20 -- get project
4020: 6f 66 20 73 79 6d 62 6f 6c 0a 09 20 20 20 20 7d of symbol.. }
4030: 0a 09 23 20 46 69 6e 64 20 61 6c 6c 20 74 61 67 ..# Find all tag
4040: 73 20 77 68 69 63 68 20 61 72 65 20 75 73 65 64 s which are used
4050: 20 62 79 20 6d 6f 72 65 20 74 68 61 6e 20 6f 6e by more than on
4060: 65 20 63 68 61 6e 67 65 73 65 74 2e 0a 09 43 68 e changeset...Ch
4070: 65 63 6b 52 65 76 20 5c 0a 09 20 20 20 20 7b 41 eckRev \.. {A
4080: 6c 6c 20 74 61 67 73 20 68 61 76 65 20 74 6f 20 ll tags have to
4090: 62 65 20 75 73 65 64 20 62 79 20 61 74 20 6d 6f be used by at mo
40a0: 73 74 20 6f 6e 65 20 63 68 61 6e 67 65 73 65 74 st one changeset
40b0: 7d 20 5c 0a 09 20 20 20 20 7b 69 73 20 75 73 65 } \.. {is use
40c0: 64 20 62 79 20 6d 75 6c 74 69 70 6c 65 20 63 68 d by multiple ch
40d0: 61 6e 67 65 73 65 74 73 7d 20 7b 0a 09 09 2d 2d angesets} {...--
40e0: 20 50 72 69 6e 63 69 70 6c 65 20 6f 66 20 6f 70 Principle of op
40f0: 65 72 61 74 69 6f 6e 3a 20 47 65 74 20 61 6c 6c eration: Get all
4100: 20 74 61 67 2f 63 68 61 6e 67 65 73 65 74 20 70 tag/changeset p
4110: 61 69 72 73 0a 20 20 20 20 20 20 20 20 20 20 20 airs.
4120: 20 20 20 20 20 2d 2d 20 66 6f 72 20 61 6c 6c 20 -- for all
4130: 74 61 67 20 63 68 61 6e 67 65 73 65 74 73 2c 20 tag changesets,
4140: 67 72 6f 75 70 20 62 79 20 74 61 67 20 74 6f 20 group by tag to
4150: 61 67 67 72 65 67 61 74 65 0a 20 20 20 20 20 20 aggregate.
4160: 20 20 20 20 20 20 20 20 20 20 2d 2d 20 74 68 65 -- the
4170: 20 63 68 61 6e 67 65 73 65 74 2c 20 63 6f 75 6e changeset, coun
4180: 74 69 6e 67 20 74 68 65 6d 2e 20 46 72 6f 6d 20 ting them. From
4190: 74 68 65 20 72 65 73 75 6c 74 69 6e 67 0a 20 20 the resulting.
41a0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2d 2d --
41b0: 20 74 61 67 2f 63 6f 75 6e 74 20 74 61 62 6c 65 tag/count table
41c0: 20 73 65 6c 65 63 74 20 74 68 6f 73 65 20 77 69 select those wi
41d0: 74 68 20 6d 6f 72 65 20 74 68 61 6e 20 6f 6e 65 th more than one
41e0: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
41f0: 20 2d 2d 20 75 73 65 72 2c 20 61 6e 64 20 67 65 -- user, and ge
4200: 74 20 74 68 65 69 72 20 61 73 73 6f 63 69 61 74 t their associat
4210: 65 64 20 66 69 6c 65 20 28 6e 61 6d 65 29 20 66 ed file (name) f
4220: 6f 72 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 or.
4230: 20 20 20 2d 2d 20 64 69 73 70 6c 61 79 2e 0a 0a -- display...
4240: 09 09 53 45 4c 45 43 54 20 50 2e 6e 61 6d 65 2c ..SELECT P.name,
4250: 20 53 2e 6e 61 6d 65 0a 09 09 46 52 4f 4d 20 74 S.name...FROM t
4260: 61 67 20 54 2c 20 70 72 6f 6a 65 63 74 20 50 2c ag T, project P,
4270: 20 73 79 6d 62 6f 6c 20 53 2c 0a 09 09 20 20 20 symbol S,...
4280: 20 20 28 53 45 4c 45 43 54 20 43 49 2e 69 69 64 (SELECT CI.iid
4290: 20 41 53 20 69 69 64 2c 20 63 6f 75 6e 74 28 43 AS iid, count(C
42a0: 49 2e 63 69 64 29 20 41 53 20 63 6f 75 6e 74 0a I.cid) AS count.
42b0: 09 09 20 20 20 20 20 20 46 52 4f 4d 20 63 73 69 .. FROM csi
42c0: 74 65 6d 20 43 49 2c 20 63 68 61 6e 67 65 73 65 tem CI, changese
42d0: 74 20 43 0a 09 09 20 20 20 20 20 20 57 48 45 52 t C... WHER
42e0: 45 20 43 2e 74 79 70 65 20 3d 20 31 0a 09 09 20 E C.type = 1...
42f0: 20 20 20 20 20 41 4e 44 20 20 20 43 2e 63 69 64 AND C.cid
4300: 20 3d 20 43 49 2e 63 69 64 0a 09 09 20 20 20 20 = CI.cid...
4310: 20 20 47 52 4f 55 50 20 42 59 20 43 49 2e 69 69 GROUP BY CI.ii
4320: 64 29 20 41 53 20 55 0a 09 09 57 48 45 52 45 20 d) AS U...WHERE
4330: 55 2e 63 6f 75 6e 74 20 3e 20 31 0a 09 09 41 4e U.count > 1...AN
4340: 44 20 20 20 54 2e 74 69 64 20 3d 20 55 2e 69 69 D T.tid = U.ii
4350: 64 0a 09 09 41 4e 44 20 20 20 53 2e 73 69 64 20 d...AND S.sid
4360: 3d 20 54 2e 73 69 64 20 20 20 20 20 20 20 20 20 = T.sid
4370: 20 20 20 20 20 20 2d 2d 20 67 65 74 20 73 79 6d -- get sym
4380: 62 6f 6c 20 6f 66 20 74 61 67 0a 09 09 41 4e 44 bol of tag...AND
4390: 20 20 20 50 2e 70 69 64 20 3d 20 53 2e 70 69 64 P.pid = S.pid
43a0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2d -
43b0: 2d 20 67 65 74 20 70 72 6f 6a 65 63 74 20 6f 66 - get project of
43c0: 20 73 79 6d 62 6f 6c 0a 09 20 20 20 20 7d 0a 09 symbol.. }..
43d0: 69 66 20 30 20 7b 0a 09 20 20 20 20 23 20 54 68 if 0 {.. # Th
43e0: 69 73 20 63 68 65 63 6b 20 69 73 20 64 69 73 61 is check is disa
43f0: 62 6c 65 64 20 66 6f 72 20 74 68 65 20 6d 6f 6d bled for the mom
4400: 65 6e 74 2e 20 41 70 70 61 72 65 6e 74 6c 79 20 ent. Apparently
4410: 74 61 67 73 0a 09 20 20 20 20 23 20 63 61 6e 20 tags.. # can
4420: 63 72 6f 73 73 20 6c 69 6e 65 73 20 6f 66 20 64 cross lines of d
4430: 65 76 65 6c 6f 70 6d 65 6e 74 2c 20 61 74 20 6c evelopment, at l
4440: 65 61 73 74 20 69 66 20 74 68 65 20 69 6e 76 6f east if the invo
4450: 6c 76 65 64 0a 09 20 20 20 20 23 20 4c 4f 44 73 lved.. # LODs
4460: 20 61 72 65 20 74 68 65 20 74 72 75 6e 6b 2c 20 are the trunk,
4470: 61 6e 64 20 74 68 65 20 4e 54 44 42 2e 20 54 68 and the NTDB. Th
4480: 61 74 20 6d 61 6b 65 73 20 73 65 6e 73 65 2c 20 at makes sense,
4490: 61 73 0a 09 20 20 20 20 23 20 74 68 65 20 4e 54 as.. # the NT
44a0: 44 42 20 72 65 76 69 73 69 6f 6e 73 20 61 72 65 DB revisions are
44b0: 20 69 6e 69 74 69 61 6c 6c 79 20 6c 6f 67 69 63 initially logic
44c0: 61 6c 6c 79 20 61 20 70 61 72 74 20 6f 66 20 74 ally a part of t
44d0: 68 65 0a 09 20 20 20 20 23 20 74 72 75 6e 6b 2e he.. # trunk.
44e0: 20 54 68 65 20 73 74 61 6e 64 61 72 64 20 63 68 The standard ch
44f0: 65 63 6b 20 62 65 6c 6f 77 20 68 6f 77 65 76 65 eck below howeve
4500: 72 20 64 6f 65 73 20 6e 6f 74 20 63 61 70 74 75 r does not captu
4510: 72 65 0a 09 20 20 20 20 23 20 74 68 69 73 2e 20 re.. # this.
4520: 57 68 65 6e 20 49 20 6d 61 6e 61 67 65 20 74 6f When I manage to
4530: 20 72 65 70 68 72 61 73 65 20 69 74 20 74 6f 20 rephrase it to
4540: 61 63 63 65 70 74 20 74 68 69 73 20 74 79 70 65 accept this type
4550: 0a 09 20 20 20 20 23 20 6f 66 20 63 72 6f 73 73 .. # of cross
4560: 2d 6f 76 65 72 20 69 74 20 77 69 6c 6c 20 62 65 -over it will be
4570: 20 72 65 2d 61 63 74 69 76 61 74 65 64 2e 0a 0a re-activated...
4580: 09 20 20 20 20 23 20 41 6c 6c 20 74 61 67 73 20 . # All tags
4590: 68 61 76 65 20 74 6f 20 61 67 72 65 65 20 6f 6e have to agree on
45a0: 20 74 68 65 20 4c 4f 44 20 74 68 65 69 72 20 63 the LOD their c
45b0: 68 61 6e 67 65 73 65 74 0a 09 20 20 20 20 23 20 hangeset.. #
45c0: 62 65 6c 6f 6e 67 73 20 74 6f 2e 20 49 6e 20 6f belongs to. In o
45d0: 74 68 65 72 20 77 6f 72 64 73 2c 20 61 6c 6c 20 ther words, all
45e0: 74 61 67 73 20 69 6e 20 61 20 63 68 61 6e 67 65 tags in a change
45f0: 73 65 74 20 68 61 76 65 0a 09 20 20 20 20 23 20 set have.. #
4600: 74 6f 20 72 65 66 65 72 20 74 6f 20 74 68 65 20 to refer to the
4610: 73 61 6d 65 20 6c 69 6e 65 20 6f 66 20 64 65 76 same line of dev
4620: 65 6c 6f 70 6d 65 6e 74 2e 0a 09 20 20 20 20 23 elopment... #
4630: 0a 09 20 20 20 20 23 20 49 6e 73 74 65 61 64 20 .. # Instead
4640: 6f 66 20 6c 6f 6f 6b 69 6e 67 20 61 74 20 61 6c of looking at al
4650: 6c 20 70 61 69 72 73 20 6f 66 20 74 61 67 73 20 l pairs of tags
4660: 69 6e 20 61 6c 6c 0a 09 20 20 20 20 23 20 63 68 in all.. # ch
4670: 61 6e 67 65 73 65 74 73 20 77 65 20 67 65 6e 65 angesets we gene
4680: 72 61 74 65 20 74 68 65 20 64 69 73 74 69 6e 63 rate the distinc
4690: 74 20 73 65 74 20 6f 66 20 61 6c 6c 20 4c 4f 44 t set of all LOD
46a0: 73 0a 09 20 20 20 20 23 20 72 65 66 65 72 65 6e s.. # referen
46b0: 63 65 64 20 62 79 20 74 68 65 20 74 61 67 73 20 ced by the tags
46c0: 6f 66 20 61 20 63 68 61 6e 67 65 73 65 74 2c 20 of a changeset,
46d0: 6c 6f 6f 6b 20 66 6f 72 20 74 68 6f 73 65 0a 09 look for those..
46e0: 20 20 20 20 23 20 77 69 74 68 20 63 61 72 64 69 # with cardi
46f0: 6e 61 6c 69 74 79 20 3e 20 31 2c 20 61 6e 64 20 nality > 1, and
4700: 67 65 74 20 74 68 65 20 69 64 65 6e 74 69 66 79 get the identify
4710: 69 6e 67 0a 09 20 20 20 20 23 20 69 6e 66 6f 72 ing.. # infor
4720: 6d 61 74 69 6f 6e 20 66 6f 72 20 74 68 65 20 63 mation for the c
4730: 68 61 6e 67 65 73 65 74 73 20 66 6f 75 6e 64 20 hangesets found
4740: 74 68 75 73 6c 79 2e 0a 09 20 20 20 20 43 68 65 thusly... Che
4750: 63 6b 43 53 20 5c 0a 09 09 7b 41 6c 6c 20 74 61 ckCS \...{All ta
4760: 67 73 20 69 6e 20 61 20 63 68 61 6e 67 65 73 65 gs in a changese
4770: 74 20 68 61 76 65 20 74 6f 20 62 65 6c 6f 6e 67 t have to belong
4780: 20 74 6f 20 74 68 65 20 73 61 6d 65 20 4c 4f 44 to the same LOD
4790: 7d 20 5c 0a 09 09 7b 3a 20 49 74 73 20 74 61 67 } \...{: Its tag
47a0: 73 20 64 69 73 61 67 72 65 65 20 61 62 6f 75 74 s disagree about
47b0: 20 74 68 65 20 4c 4f 44 20 74 68 65 79 20 62 65 the LOD they be
47c0: 6c 6f 6e 67 20 74 6f 7d 20 7b 0a 09 09 20 20 20 long to} {...
47d0: 20 53 45 4c 45 43 54 20 54 2e 6e 61 6d 65 2c 20 SELECT T.name,
47e0: 43 2e 63 69 64 0a 09 09 20 20 20 20 46 52 4f 4d C.cid... FROM
47f0: 20 20 20 63 68 61 6e 67 65 73 65 74 20 43 2c 20 changeset C,
4800: 63 73 74 79 70 65 20 54 0a 09 09 20 20 20 20 57 cstype T... W
4810: 48 45 52 45 20 20 43 2e 63 69 64 20 49 4e 20 28 HERE C.cid IN (
4820: 53 45 4c 45 43 54 20 55 2e 63 69 64 0a 09 09 09 SELECT U.cid....
4830: 09 20 20 20 20 20 46 52 4f 4d 20 28 53 45 4c 45 . FROM (SELE
4840: 43 54 20 44 49 53 54 49 4e 43 54 20 43 49 2e 63 CT DISTINCT CI.c
4850: 69 64 20 41 53 20 63 69 64 2c 20 54 2e 6c 6f 64 id AS cid, T.lod
4860: 20 41 53 20 6c 6f 64 0a 09 09 09 09 09 20 20 20 AS lod......
4870: 46 52 4f 4d 20 20 20 63 73 69 74 65 6d 20 43 49 FROM csitem CI
4880: 2c 20 63 68 61 6e 67 65 73 65 74 20 43 2c 20 74 , changeset C, t
4890: 61 67 20 54 0a 09 09 09 09 09 20 20 20 57 48 45 ag T...... WHE
48a0: 52 45 20 20 43 49 2e 69 69 64 20 3d 20 54 2e 74 RE CI.iid = T.t
48b0: 69 64 0a 09 09 09 09 09 20 20 20 41 4e 44 20 20 id...... AND
48c0: 20 20 43 2e 63 69 64 20 3d 20 43 49 2e 63 69 64 C.cid = CI.cid
48d0: 0a 09 09 09 09 09 20 20 20 41 4e 44 20 20 20 20 ...... AND
48e0: 43 2e 74 79 70 65 20 3d 20 31 29 20 41 53 20 55 C.type = 1) AS U
48f0: 0a 09 09 09 09 20 20 20 20 20 47 52 4f 55 50 20 ..... GROUP
4900: 42 59 20 55 2e 63 69 64 20 48 41 56 49 4e 47 20 BY U.cid HAVING
4910: 43 4f 55 4e 54 28 55 2e 6c 6f 64 29 20 3e 20 31 COUNT(U.lod) > 1
4920: 29 0a 09 09 20 20 20 20 41 4e 44 20 20 20 20 54 )... AND T
4930: 2e 74 69 64 20 3d 20 43 2e 74 79 70 65 0a 09 09 .tid = C.type...
4940: 7d 0a 09 7d 0a 09 23 20 41 6c 6c 20 74 61 67 73 }..}..# All tags
4950: 20 68 61 76 65 20 74 6f 20 61 67 72 65 65 20 6f have to agree o
4960: 6e 20 74 68 65 20 70 72 6f 6a 65 63 74 20 74 68 n the project th
4970: 65 69 72 20 63 68 61 6e 67 65 73 65 74 0a 09 23 eir changeset..#
4980: 20 62 65 6c 6f 6e 67 73 20 74 6f 2e 20 49 6e 20 belongs to. In
4990: 6f 74 68 65 72 20 77 6f 72 64 73 2c 20 61 6c 6c other words, all
49a0: 20 74 61 67 73 20 69 6e 20 61 20 63 68 61 6e 67 tags in a chang
49b0: 65 73 65 74 20 68 61 76 65 20 74 6f 0a 09 23 20 eset have to..#
49c0: 72 65 66 65 72 20 74 6f 20 74 68 65 20 73 61 6d refer to the sam
49d0: 65 20 70 72 6f 6a 65 63 74 2e 0a 09 23 0a 09 23 e project...#..#
49e0: 20 49 6e 73 74 65 61 64 20 6f 66 20 6c 6f 6f 6b Instead of look
49f0: 69 6e 67 20 61 74 20 61 6c 6c 20 70 61 69 72 73 ing at all pairs
4a00: 20 6f 66 20 74 61 67 73 20 69 6e 20 61 6c 6c 20 of tags in all
4a10: 63 68 61 6e 67 65 73 65 74 73 20 77 65 0a 09 23 changesets we..#
4a20: 20 67 65 6e 65 72 61 74 65 20 74 68 65 20 64 69 generate the di
4a30: 73 74 69 6e 63 74 20 73 65 74 20 6f 66 20 61 6c stinct set of al
4a40: 6c 20 70 72 6f 6a 65 63 74 73 20 72 65 66 65 72 l projects refer
4a50: 65 6e 63 65 64 20 62 79 20 74 68 65 0a 09 23 20 enced by the..#
4a60: 74 61 67 73 20 6f 66 20 61 20 63 68 61 6e 67 65 tags of a change
4a70: 73 65 74 2c 20 6c 6f 6f 6b 20 66 6f 72 20 74 68 set, look for th
4a80: 6f 73 65 20 77 69 74 68 20 63 61 72 64 69 6e 61 ose with cardina
4a90: 6c 69 74 79 20 3e 20 31 2c 0a 09 23 20 61 6e 64 lity > 1,..# and
4aa0: 20 67 65 74 20 74 68 65 20 69 64 65 6e 74 69 66 get the identif
4ab0: 79 69 6e 67 20 69 6e 66 6f 72 6d 61 74 69 6f 6e ying information
4ac0: 20 66 6f 72 20 74 68 65 20 63 68 61 6e 67 65 73 for the changes
4ad0: 65 74 73 20 66 6f 75 6e 64 0a 09 23 20 74 68 75 ets found..# thu
4ae0: 73 6c 79 2e 0a 09 43 68 65 63 6b 43 53 20 5c 0a sly...CheckCS \.
4af0: 09 20 20 20 20 7b 41 6c 6c 20 74 61 67 73 20 69 . {All tags i
4b00: 6e 20 61 20 63 68 61 6e 67 65 73 65 74 20 68 61 n a changeset ha
4b10: 76 65 20 74 6f 20 62 65 6c 6f 6e 67 20 74 6f 20 ve to belong to
4b20: 74 68 65 20 73 61 6d 65 20 70 72 6f 6a 65 63 74 the same project
4b30: 7d 20 5c 0a 09 20 20 20 20 7b 3a 20 49 74 73 20 } \.. {: Its
4b40: 74 61 67 73 20 64 69 73 61 67 72 65 65 20 61 62 tags disagree ab
4b50: 6f 75 74 20 74 68 65 20 70 72 6f 6a 65 63 74 20 out the project
4b60: 74 68 65 79 20 62 65 6c 6f 6e 67 20 74 6f 7d 20 they belong to}
4b70: 7b 0a 09 09 53 45 4c 45 43 54 20 54 2e 6e 61 6d {...SELECT T.nam
4b80: 65 2c 20 43 2e 63 69 64 0a 09 09 46 52 4f 4d 20 e, C.cid...FROM
4b90: 20 20 63 68 61 6e 67 65 73 65 74 20 43 2c 20 63 changeset C, c
4ba0: 73 74 79 70 65 20 54 0a 09 09 57 48 45 52 45 20 stype T...WHERE
4bb0: 20 43 2e 63 69 64 20 49 4e 20 28 53 45 4c 45 43 C.cid IN (SELEC
4bc0: 54 20 55 2e 63 69 64 0a 09 09 09 09 20 46 52 4f T U.cid..... FRO
4bd0: 4d 20 28 53 45 4c 45 43 54 20 44 49 53 54 49 4e M (SELECT DISTIN
4be0: 43 54 20 43 49 2e 63 69 64 20 41 53 20 63 69 64 CT CI.cid AS cid
4bf0: 2c 20 46 2e 70 69 64 20 41 53 20 70 69 64 0a 09 , F.pid AS pid..
4c00: 09 09 09 20 20 20 20 20 20 20 46 52 4f 4d 20 20 ... FROM
4c10: 20 63 73 69 74 65 6d 20 43 49 2c 20 63 68 61 6e csitem CI, chan
4c20: 67 65 73 65 74 20 43 2c 20 74 61 67 20 54 2c 20 geset C, tag T,
4c30: 66 69 6c 65 20 46 0a 09 09 09 09 20 20 20 20 20 file F.....
4c40: 20 20 57 48 45 52 45 20 20 43 49 2e 69 69 64 20 WHERE CI.iid
4c50: 3d 20 54 2e 74 69 64 0a 09 09 09 09 20 20 20 20 = T.tid.....
4c60: 20 20 20 41 4e 44 20 20 20 20 43 2e 63 69 64 20 AND C.cid
4c70: 3d 20 43 49 2e 63 69 64 0a 09 09 09 09 20 20 20 = CI.cid.....
4c80: 20 20 20 20 41 4e 44 20 20 20 20 43 2e 74 79 70 AND C.typ
4c90: 65 20 3d 20 31 0a 09 09 09 09 20 20 20 20 20 20 e = 1.....
4ca0: 20 41 4e 44 20 20 20 20 46 2e 66 69 64 20 20 3d AND F.fid =
4cb0: 20 54 2e 66 69 64 29 20 41 53 20 55 0a 09 09 09 T.fid) AS U....
4cc0: 09 20 47 52 4f 55 50 20 42 59 20 55 2e 63 69 64 . GROUP BY U.cid
4cd0: 20 48 41 56 49 4e 47 20 43 4f 55 4e 54 28 55 2e HAVING COUNT(U.
4ce0: 70 69 64 29 20 3e 20 31 29 0a 09 09 41 4e 44 20 pid) > 1)...AND
4cf0: 20 20 20 54 2e 74 69 64 20 3d 20 43 2e 74 79 70 T.tid = C.typ
4d00: 65 0a 09 20 20 20 20 7d 0a 09 23 20 41 6c 6c 20 e.. }..# All
4d10: 74 61 67 73 20 69 6e 20 61 20 73 69 6e 67 6c 65 tags in a single
4d20: 20 63 68 61 6e 67 65 73 65 74 20 68 61 76 65 20 changeset have
4d30: 74 6f 20 62 65 6c 6f 6e 67 20 74 6f 20 64 69 66 to belong to dif
4d40: 66 65 72 65 6e 74 0a 09 23 20 66 69 6c 65 73 2e ferent..# files.
4d50: 20 43 6f 6e 76 65 72 73 65 6c 79 3a 20 4e 6f 20 Conversely: No
4d60: 74 77 6f 20 74 61 67 73 20 6f 66 20 61 20 73 69 two tags of a si
4d70: 6e 67 6c 65 20 66 69 6c 65 20 61 72 65 20 61 6c ngle file are al
4d80: 6c 6f 77 65 64 0a 09 23 20 74 6f 20 62 65 20 69 lowed..# to be i
4d90: 6e 20 74 68 65 20 73 61 6d 65 20 63 68 61 6e 67 n the same chang
4da0: 65 73 65 74 2e 0a 09 23 0a 09 23 20 49 6e 73 74 eset...#..# Inst
4db0: 65 61 64 20 6f 66 20 6c 6f 6f 6b 69 6e 67 20 61 ead of looking a
4dc0: 74 20 61 6c 6c 20 70 61 69 72 73 20 6f 66 20 74 t all pairs of t
4dd0: 61 67 73 20 69 6e 20 61 6c 6c 20 63 68 61 6e 67 ags in all chang
4de0: 65 73 65 74 73 20 77 65 0a 09 23 20 67 65 6e 65 esets we..# gene
4df0: 72 61 74 65 20 74 68 65 20 64 69 73 74 69 6e 63 rate the distinc
4e00: 74 20 73 65 74 20 6f 66 20 61 6c 6c 20 66 69 6c t set of all fil
4e10: 65 73 20 72 65 66 65 72 65 6e 63 65 64 20 62 79 es referenced by
4e20: 20 74 68 65 0a 09 23 20 74 61 67 73 20 6f 66 20 the..# tags of
4e30: 61 20 63 68 61 6e 67 65 73 65 74 2c 20 61 6e 64 a changeset, and
4e40: 20 6c 6f 6f 6b 20 66 6f 72 20 74 68 6f 73 65 20 look for those
4e50: 77 69 74 68 20 63 61 72 64 69 6e 61 6c 69 74 79 with cardinality
4e60: 20 3c 0a 09 23 20 74 68 65 20 63 61 72 64 69 6e <..# the cardin
4e70: 61 6c 69 74 79 20 6f 66 20 74 68 65 20 73 65 74 ality of the set
4e80: 20 6f 66 20 74 61 67 73 2c 20 61 6e 64 20 67 65 of tags, and ge
4e90: 74 20 74 68 65 20 69 64 65 6e 74 69 66 79 69 6e t the identifyin
4ea0: 67 0a 09 23 20 69 6e 66 6f 72 6d 61 74 69 6f 6e g..# information
4eb0: 20 66 6f 72 20 74 68 65 20 63 68 61 6e 67 65 73 for the changes
4ec0: 65 74 73 20 66 6f 75 6e 64 20 74 68 75 73 6c 79 ets found thusly
4ed0: 2e 0a 09 43 68 65 63 6b 43 53 20 5c 0a 09 20 20 ...CheckCS \..
4ee0: 20 20 7b 41 6c 6c 20 74 61 67 73 20 69 6e 20 61 {All tags in a
4ef0: 20 63 68 61 6e 67 65 73 65 74 20 68 61 76 65 20 changeset have
4f00: 74 6f 20 62 65 6c 6f 6e 67 20 74 6f 20 64 69 66 to belong to dif
4f10: 66 65 72 65 6e 74 20 66 69 6c 65 73 7d 20 5c 0a ferent files} \.
4f20: 09 20 20 20 20 7b 3a 20 49 74 73 20 74 61 67 73 . {: Its tags
4f30: 20 73 68 61 72 65 20 66 69 6c 65 73 7d 20 7b 0a share files} {.
4f40: 09 09 53 45 4c 45 43 54 20 54 2e 6e 61 6d 65 2c ..SELECT T.name,
4f50: 20 43 2e 63 69 64 0a 09 09 46 52 4f 4d 20 20 20 C.cid...FROM
4f60: 63 68 61 6e 67 65 73 65 74 20 43 2c 20 63 73 74 changeset C, cst
4f70: 79 70 65 20 54 0a 09 09 57 48 45 52 45 20 20 43 ype T...WHERE C
4f80: 2e 63 69 64 20 49 4e 20 28 53 45 4c 45 43 54 20 .cid IN (SELECT
4f90: 56 56 2e 63 69 64 0a 09 09 09 09 20 46 52 4f 4d VV.cid..... FROM
4fa0: 20 28 53 45 4c 45 43 54 20 55 2e 63 69 64 20 61 (SELECT U.cid a
4fb0: 73 20 63 69 64 2c 20 43 4f 55 4e 54 20 28 55 2e s cid, COUNT (U.
4fc0: 66 69 64 29 20 41 53 20 66 63 6f 75 6e 74 0a 09 fid) AS fcount..
4fd0: 09 09 09 20 20 20 20 20 20 20 46 52 4f 4d 20 28 ... FROM (
4fe0: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 SELECT DISTINCT
4ff0: 43 49 2e 63 69 64 20 41 53 20 63 69 64 2c 20 54 CI.cid AS cid, T
5000: 2e 66 69 64 20 41 53 20 66 69 64 0a 09 09 09 09 .fid AS fid.....
5010: 09 20 20 20 20 20 46 52 4f 4d 20 20 20 63 73 69 . FROM csi
5020: 74 65 6d 20 43 49 2c 20 63 68 61 6e 67 65 73 65 tem CI, changese
5030: 74 20 43 2c 20 74 61 67 20 54 0a 09 09 09 09 09 t C, tag T......
5040: 20 20 20 20 20 57 48 45 52 45 20 20 43 49 2e 69 WHERE CI.i
5050: 69 64 20 3d 20 54 2e 74 69 64 0a 09 09 09 09 09 id = T.tid......
5060: 20 20 20 20 20 41 4e 44 20 20 20 20 43 2e 63 69 AND C.ci
5070: 64 20 3d 20 43 49 2e 63 69 64 0a 09 09 09 09 09 d = CI.cid......
5080: 20 20 20 20 20 41 4e 44 20 20 20 20 43 2e 74 79 AND C.ty
5090: 70 65 20 3d 20 31 0a 09 09 09 09 09 20 20 20 20 pe = 1......
50a0: 20 29 20 41 53 20 55 0a 09 09 09 09 20 20 20 20 ) AS U.....
50b0: 20 20 20 47 52 4f 55 50 20 42 59 20 55 2e 63 69 GROUP BY U.ci
50c0: 64 29 20 41 53 20 55 55 2c 0a 09 09 09 09 20 20 d) AS UU,.....
50d0: 20 20 20 20 28 53 45 4c 45 43 54 20 56 2e 63 69 (SELECT V.ci
50e0: 64 20 41 53 20 63 69 64 2c 20 43 4f 55 4e 54 20 d AS cid, COUNT
50f0: 28 56 2e 69 69 64 29 20 41 53 20 72 63 6f 75 6e (V.iid) AS rcoun
5100: 74 0a 09 09 09 09 20 20 20 20 20 20 20 46 52 4f t..... FRO
5110: 4d 20 20 20 63 73 69 74 65 6d 20 56 2c 20 63 68 M csitem V, ch
5120: 61 6e 67 65 73 65 74 20 58 0a 09 09 09 09 20 20 angeset X.....
5130: 20 20 20 20 20 57 48 45 52 45 20 20 58 2e 63 69 WHERE X.ci
5140: 64 20 3d 20 56 2e 63 69 64 0a 09 09 09 09 20 20 d = V.cid.....
5150: 20 20 20 20 20 41 4e 44 20 20 20 20 58 2e 74 79 AND X.ty
5160: 70 65 20 3d 20 31 0a 09 09 09 09 20 20 20 20 20 pe = 1.....
5170: 20 20 47 52 4f 55 50 20 42 59 20 56 2e 63 69 64 GROUP BY V.cid
5180: 29 20 41 53 20 56 56 0a 09 09 09 09 20 57 48 45 ) AS VV..... WHE
5190: 52 45 20 56 56 2e 63 69 64 20 3d 20 55 55 2e 63 RE VV.cid = UU.c
51a0: 69 64 0a 09 09 09 09 20 41 4e 44 20 20 20 55 55 id..... AND UU
51b0: 2e 66 63 6f 75 6e 74 20 3c 20 56 56 2e 72 63 6f .fcount < VV.rco
51c0: 75 6e 74 29 0a 09 09 41 4e 44 20 20 20 20 54 2e unt)...AND T.
51d0: 74 69 64 20 3d 20 43 2e 74 79 70 65 0a 09 20 20 tid = C.type..
51e0: 20 20 7d 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 }..return.
51f0: 7d 0a 0a 20 20 20 20 70 72 6f 63 20 42 72 61 6e }.. proc Bran
5200: 63 68 43 68 61 6e 67 65 73 65 74 73 20 7b 7d 20 chChangesets {}
5210: 7b 0a 09 23 20 54 68 69 73 20 63 6f 64 65 20 70 {..# This code p
5220: 65 72 66 6f 72 6d 73 20 61 20 6e 75 6d 62 65 72 erforms a number
5230: 20 6f 66 20 70 61 72 61 6e 6f 69 64 20 63 68 65 of paranoid che
5240: 63 6b 73 20 6f 66 20 74 68 65 0a 09 23 20 64 61 cks of the..# da
5250: 74 61 62 61 73 65 2c 20 73 65 61 72 63 68 69 6e tabase, searchin
5260: 67 20 66 6f 72 20 69 6e 63 6f 6e 73 69 73 74 65 g for inconsiste
5270: 6e 74 20 63 68 61 6e 67 65 73 65 74 2f 72 65 76 nt changeset/rev
5280: 69 73 69 6f 6e 0a 09 23 20 69 6e 66 6f 72 6d 61 ision..# informa
5290: 74 69 6f 6e 2e 0a 0a 09 75 70 76 61 72 20 31 20 tion....upvar 1
52a0: 6e 20 6e 20 3b 20 23 20 43 6f 75 6e 74 65 72 20 n n ; # Counter
52b0: 66 6f 72 20 74 68 65 20 63 68 65 63 6b 73 20 28 for the checks (
52c0: 77 65 20 70 72 69 6e 74 20 61 6e 20 69 64 20 62 we print an id b
52d0: 65 66 6f 72 65 0a 09 09 20 20 20 20 20 20 23 20 efore... #
52e0: 74 68 65 20 6d 61 69 6e 20 6c 61 62 65 6c 29 2e the main label).
52f0: 0a 0a 09 23 20 46 69 6e 64 20 61 6c 6c 20 62 72 ...# Find all br
5300: 61 6e 63 68 65 73 20 77 68 69 63 68 20 61 72 65 anches which are
5310: 20 6e 6f 74 20 75 73 65 64 20 62 79 20 61 74 20 not used by at
5320: 6c 65 61 73 74 20 6f 6e 65 0a 09 23 20 63 68 61 least one..# cha
5330: 6e 67 65 73 65 74 2e 0a 09 43 68 65 63 6b 42 72 ngeset...CheckBr
5340: 61 6e 63 68 20 5c 0a 09 20 20 20 20 7b 41 6c 6c anch \.. {All
5350: 20 62 72 61 6e 63 68 65 73 20 68 61 76 65 20 74 branches have t
5360: 6f 20 62 65 20 75 73 65 64 20 62 79 20 6c 65 61 o be used by lea
5370: 73 74 20 6f 6e 65 20 63 68 61 6e 67 65 73 65 74 st one changeset
5380: 7d 20 5c 0a 09 20 20 20 20 7b 69 73 20 6e 6f 74 } \.. {is not
5390: 20 75 73 65 64 20 62 79 20 61 20 63 68 61 6e 67 used by a chang
53a0: 65 73 65 74 7d 20 7b 0a 09 09 2d 2d 20 55 6e 75 eset} {...-- Unu
53b0: 73 65 64 20 62 72 61 6e 63 68 65 73 20 3d 20 41 sed branches = A
53c0: 6c 6c 20 62 72 61 6e 63 68 65 73 0a 09 09 2d 2d ll branches...--
53d0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
53e0: 20 2d 20 62 72 61 6e 63 68 65 73 20 75 73 65 64 - branches used
53f0: 20 62 79 20 62 72 61 6e 63 68 20 63 68 61 6e 67 by branch chang
5400: 65 73 65 74 73 2e 0a 09 09 2d 2d 0a 09 09 2d 2d esets....--...--
5410: 20 42 6f 74 68 20 73 65 74 73 20 63 61 6e 20 62 Both sets can b
5420: 65 20 63 6f 6d 70 75 74 65 64 20 65 61 73 69 6c e computed easil
5430: 79 2c 20 61 6e 64 20 73 75 62 74 72 61 63 74 65 y, and subtracte
5440: 64 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 d.
5450: 20 20 2d 2d 20 66 72 6f 6d 20 65 61 63 68 20 6f -- from each o
5460: 74 68 65 72 2e 20 54 68 65 6e 20 77 65 20 63 61 ther. Then we ca
5470: 6e 20 67 65 74 20 74 68 65 20 61 73 73 6f 63 69 n get the associ
5480: 61 74 65 64 0a 20 20 20 20 20 20 20 20 20 20 20 ated.
5490: 20 20 20 20 20 2d 2d 20 66 69 6c 65 20 28 6e 61 -- file (na
54a0: 6d 65 29 20 66 6f 72 20 64 69 73 70 6c 61 79 2e me) for display.
54b0: 0a 0a 09 09 53 45 4c 45 43 54 20 50 2e 6e 61 6d ....SELECT P.nam
54c0: 65 2c 20 53 2e 6e 61 6d 65 0a 09 09 46 52 4f 4d e, S.name...FROM
54d0: 20 70 72 6f 6a 65 63 74 20 50 2c 20 62 72 61 6e project P, bran
54e0: 63 68 20 42 2c 20 73 79 6d 62 6f 6c 20 53 0a 09 ch B, symbol S..
54f0: 09 57 48 45 52 45 20 42 2e 62 69 64 20 49 4e 20 .WHERE B.bid IN
5500: 28 53 45 4c 45 43 54 20 62 69 64 20 20 20 20 20 (SELECT bid
5510: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2d -
5520: 2d 20 41 6c 6c 20 62 72 61 6e 63 68 65 73 0a 09 - All branches..
5530: 09 09 09 46 52 4f 4d 20 20 20 62 72 61 6e 63 68 ...FROM branch
5540: 0a 09 09 09 09 45 58 43 45 50 54 20 20 20 20 20 .....EXCEPT
5550: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
5560: 20 20 20 2d 2d 20 73 75 62 74 72 61 63 74 0a 09 -- subtract..
5570: 09 09 09 53 45 4c 45 43 54 20 43 49 2e 69 69 64 ...SELECT CI.iid
5580: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
5590: 20 2d 2d 20 62 72 61 6e 63 68 65 73 20 75 73 65 -- branches use
55a0: 64 0a 09 09 09 09 46 52 4f 4d 20 20 20 63 73 69 d.....FROM csi
55b0: 74 65 6d 20 43 49 2c 20 63 68 61 6e 67 65 73 65 tem CI, changese
55c0: 74 20 43 0a 09 09 09 09 57 48 45 52 45 20 20 43 t C.....WHERE C
55d0: 2e 63 69 64 20 3d 20 43 49 2e 63 69 64 20 20 20 .cid = CI.cid
55e0: 20 20 20 20 20 20 2d 2d 20 62 79 20 61 6e 79 20 -- by any
55f0: 62 72 61 6e 63 68 0a 09 09 09 09 41 4e 44 20 20 branch.....AND
5600: 20 20 43 2e 74 79 70 65 20 3d 20 32 29 20 20 20 C.type = 2)
5610: 20 20 20 20 20 20 20 20 20 2d 2d 20 63 68 61 6e -- chan
5620: 67 65 73 65 74 0a 09 09 41 4e 44 20 20 20 53 2e geset...AND S.
5630: 73 69 64 20 3d 20 42 2e 73 69 64 20 20 20 20 20 sid = B.sid
5640: 20 20 20 20 20 20 20 20 20 20 2d 2d 20 67 65 74 -- get
5650: 20 73 79 6d 62 6f 6c 20 6f 66 20 62 72 61 6e 63 symbol of branc
5660: 68 0a 09 09 41 4e 44 20 20 20 50 2e 70 69 64 20 h...AND P.pid
5670: 3d 20 53 2e 70 69 64 20 20 20 20 20 20 20 20 20 = S.pid
5680: 20 20 20 20 20 20 2d 2d 20 67 65 74 20 70 72 6f -- get pro
5690: 6a 65 63 74 20 6f 66 20 73 79 6d 62 6f 6c 0a 09 ject of symbol..
56a0: 20 20 20 20 7d 0a 09 23 20 46 69 6e 64 20 61 6c }..# Find al
56b0: 6c 20 62 72 61 6e 63 68 65 73 20 77 68 69 63 68 l branches which
56c0: 20 61 72 65 20 75 73 65 64 20 62 79 20 6d 6f 72 are used by mor
56d0: 65 20 74 68 61 6e 20 6f 6e 65 20 63 68 61 6e 67 e than one chang
56e0: 65 73 65 74 2e 0a 09 43 68 65 63 6b 52 65 76 20 eset...CheckRev
56f0: 5c 0a 09 20 20 20 20 7b 41 6c 6c 20 62 72 61 6e \.. {All bran
5700: 63 68 65 73 20 68 61 76 65 20 74 6f 20 62 65 20 ches have to be
5710: 75 73 65 64 20 62 79 20 61 74 20 6d 6f 73 74 20 used by at most
5720: 6f 6e 65 20 63 68 61 6e 67 65 73 65 74 7d 20 5c one changeset} \
5730: 0a 09 20 20 20 20 7b 69 73 20 75 73 65 64 20 62 .. {is used b
5740: 79 20 6d 75 6c 74 69 70 6c 65 20 63 68 61 6e 67 y multiple chang
5750: 65 73 65 74 73 7d 20 7b 0a 09 09 2d 2d 20 50 72 esets} {...-- Pr
5760: 69 6e 63 69 70 6c 65 20 6f 66 20 6f 70 65 72 61 inciple of opera
5770: 74 69 6f 6e 3a 20 47 65 74 20 61 6c 6c 20 62 72 tion: Get all br
5780: 61 6e 63 68 2f 63 68 61 6e 67 65 73 65 74 0a 20 anch/changeset.
5790: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2d -
57a0: 2d 20 70 61 69 72 73 20 66 6f 72 20 61 6c 6c 20 - pairs for all
57b0: 62 72 61 6e 63 68 20 63 68 61 6e 67 65 73 65 74 branch changeset
57c0: 73 2c 20 67 72 6f 75 70 20 62 79 20 74 61 67 20 s, group by tag
57d0: 74 6f 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 to.
57e0: 20 20 20 2d 2d 20 61 67 67 72 65 67 61 74 65 20 -- aggregate
57f0: 74 68 65 20 63 68 61 6e 67 65 73 65 74 2c 20 63 the changeset, c
5800: 6f 75 6e 74 69 6e 67 20 74 68 65 6d 2e 20 46 72 ounting them. Fr
5810: 6f 6d 20 74 68 65 0a 20 20 20 20 20 20 20 20 20 om the.
5820: 20 20 20 20 20 20 20 2d 2d 20 72 65 73 75 6c 74 -- result
5830: 69 6e 67 20 62 72 61 6e 63 68 2f 63 6f 75 6e 74 ing branch/count
5840: 20 74 61 62 6c 65 20 73 65 6c 65 63 74 20 74 68 table select th
5850: 6f 73 65 20 77 69 74 68 20 6d 6f 72 65 0a 20 20 ose with more.
5860: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2d 2d --
5870: 20 74 68 61 6e 20 6f 6e 65 20 75 73 65 72 2c 20 than one user,
5880: 61 6e 64 20 67 65 74 20 74 68 65 69 72 20 61 73 and get their as
5890: 73 6f 63 69 61 74 65 64 20 66 69 6c 65 20 28 6e sociated file (n
58a0: 61 6d 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 ame).
58b0: 20 20 20 20 20 2d 2d 20 66 6f 72 20 64 69 73 70 -- for disp
58c0: 6c 61 79 2e 0a 0a 09 09 53 45 4c 45 43 54 20 50 lay.....SELECT P
58d0: 2e 6e 61 6d 65 2c 20 53 2e 6e 61 6d 65 0a 09 09 .name, S.name...
58e0: 46 52 4f 4d 20 62 72 61 6e 63 68 20 42 2c 20 70 FROM branch B, p
58f0: 72 6f 6a 65 63 74 20 50 2c 20 73 79 6d 62 6f 6c roject P, symbol
5900: 20 53 2c 0a 09 09 20 20 20 20 20 28 53 45 4c 45 S,... (SELE
5910: 43 54 20 43 49 2e 69 69 64 20 41 53 20 69 69 64 CT CI.iid AS iid
5920: 2c 20 63 6f 75 6e 74 28 43 49 2e 63 69 64 29 20 , count(CI.cid)
5930: 41 53 20 63 6f 75 6e 74 0a 09 09 20 20 20 20 20 AS count...
5940: 20 46 52 4f 4d 20 63 73 69 74 65 6d 20 43 49 2c FROM csitem CI,
5950: 20 63 68 61 6e 67 65 73 65 74 20 43 0a 09 09 20 changeset C...
5960: 20 20 20 20 20 57 48 45 52 45 20 43 2e 74 79 70 WHERE C.typ
5970: 65 20 3d 20 32 0a 09 09 20 20 20 20 20 20 41 4e e = 2... AN
5980: 44 20 20 20 43 2e 63 69 64 20 3d 20 43 49 2e 63 D C.cid = CI.c
5990: 69 64 0a 09 09 20 20 20 20 20 20 47 52 4f 55 50 id... GROUP
59a0: 20 42 59 20 43 49 2e 69 69 64 20 29 20 41 53 20 BY CI.iid ) AS
59b0: 55 0a 09 09 57 48 45 52 45 20 55 2e 63 6f 75 6e U...WHERE U.coun
59c0: 74 20 3e 20 31 0a 09 09 41 4e 44 20 20 20 42 2e t > 1...AND B.
59d0: 62 69 64 20 3d 20 55 2e 69 69 64 0a 09 09 41 4e bid = U.iid...AN
59e0: 44 20 20 20 53 2e 73 69 64 20 3d 20 42 2e 73 69 D S.sid = B.si
59f0: 64 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 d
5a00: 2d 2d 20 67 65 74 20 73 79 6d 62 6f 6c 20 6f 66 -- get symbol of
5a10: 20 62 72 61 6e 63 68 0a 09 09 41 4e 44 20 20 20 branch...AND
5a20: 50 2e 70 69 64 20 3d 20 53 2e 70 69 64 20 20 20 P.pid = S.pid
5a30: 20 20 20 20 20 20 20 20 20 20 20 20 2d 2d 20 67 -- g
5a40: 65 74 20 70 72 6f 6a 65 63 74 20 6f 66 20 73 79 et project of sy
5a50: 6d 62 6f 6c 0a 09 20 20 20 20 7d 0a 09 69 66 20 mbol.. }..if
5a60: 30 20 7b 0a 09 20 20 20 20 23 20 54 68 69 73 20 0 {.. # This
5a70: 63 68 65 63 6b 20 68 61 73 20 62 65 65 6e 20 64 check has been d
5a80: 69 73 61 62 6c 65 64 2e 20 57 68 65 6e 20 74 68 isabled. When th
5a90: 65 20 63 6f 6e 76 65 72 74 65 72 20 77 61 73 20 e converter was
5aa0: 72 75 6e 0a 09 20 20 20 20 23 20 6f 6e 20 74 68 run.. # on th
5ab0: 65 20 54 63 6c 20 43 56 53 20 73 65 76 65 72 61 e Tcl CVS severa
5ac0: 6c 20 62 72 61 6e 63 68 65 73 20 74 72 69 70 70 l branches tripp
5ad0: 65 64 20 74 68 69 73 0a 09 20 20 20 20 23 20 63 ed this.. # c
5ae0: 6f 6e 73 74 72 61 69 6e 74 2e 20 4f 6e 65 20 6f onstraint. One o
5af0: 66 20 74 68 65 6d 20 77 61 73 20 61 20 66 72 65 f them was a fre
5b00: 65 2d 66 6c 6f 61 74 69 6e 67 20 62 72 61 6e 63 e-floating branc
5b10: 68 2c 20 61 6e 64 0a 09 20 20 20 20 23 20 69 74 h, and.. # it
5b20: 73 20 68 61 6e 64 6c 69 6e 67 20 68 61 73 20 62 s handling has b
5b30: 65 65 6e 20 66 69 78 65 64 20 62 79 20 6e 6f 77 een fixed by now
5b40: 2e 20 54 68 65 20 6f 74 68 65 72 73 20 68 6f 77 . The others how
5b50: 65 76 65 72 0a 09 20 20 20 20 23 20 73 65 65 6d ever.. # seem
5b60: 20 73 65 6d 69 2d 6c 65 67 69 74 69 6d 61 74 65 semi-legitimate
5b70: 2c 20 69 6e 20 74 68 65 20 73 65 6e 73 65 20 74 , in the sense t
5b80: 68 61 74 20 74 68 65 79 20 73 68 6f 77 0a 09 20 hat they show..
5b90: 20 20 20 23 20 69 6e 63 6f 6e 73 69 73 74 65 6e # inconsisten
5ba0: 63 69 65 73 20 69 6e 20 74 68 65 20 43 56 53 20 cies in the CVS
5bb0: 68 69 73 74 6f 72 79 20 74 68 65 20 75 73 65 72 history the user
5bc0: 20 69 73 20 6e 6f 74 0a 09 20 20 20 20 23 20 72 is not.. # r
5bd0: 65 61 6c 6c 79 20 61 62 6c 65 20 74 6f 20 73 6f eally able to so
5be0: 6c 76 65 2c 20 62 75 74 20 69 74 20 6d 69 67 68 lve, but it migh
5bf0: 74 20 62 65 20 70 6f 73 73 69 62 6c 65 20 74 6f t be possible to
5c00: 20 73 69 6d 70 6c 79 0a 09 20 20 20 20 23 20 69 simply.. # i
5c10: 67 6e 6f 72 65 20 74 68 65 6d 2e 0a 0a 09 20 20 gnore them....
5c20: 20 20 23 20 46 6f 72 20 65 78 61 6d 70 6c 65 20 # For example
5c30: 69 6e 20 54 63 6c 20 77 65 20 68 61 76 65 20 61 in Tcl we have a
5c40: 20 62 72 61 6e 63 68 20 58 20 77 69 74 68 20 61 branch X with a
5c50: 20 70 72 65 66 65 72 65 64 0a 09 20 20 20 20 23 prefered.. #
5c60: 20 70 61 72 65 6e 74 20 59 2c 20 65 78 63 65 70 parent Y, excep
5c70: 74 20 66 6f 72 20 61 20 73 69 6e 67 6c 65 20 66 t for a single f
5c80: 69 6c 65 20 77 68 65 72 65 20 74 68 65 20 70 72 ile where the pr
5c90: 65 66 65 72 65 64 0a 09 20 20 20 20 23 20 70 61 efered.. # pa
5ca0: 72 65 6e 74 20 73 65 65 6d 73 20 74 6f 20 62 65 rent seems to be
5cb0: 20 63 72 65 61 74 65 64 20 61 66 74 65 72 20 69 created after i
5cc0: 74 73 20 63 75 72 72 65 6e 74 20 70 61 72 65 6e ts current paren
5cd0: 74 2c 0a 09 20 20 20 20 23 20 6d 61 6b 69 6e 67 t,.. # making
5ce0: 20 72 65 2d 70 61 72 65 6e 74 69 6e 67 20 69 6d re-parenting im
5cf0: 70 6f 73 73 69 62 6c 65 2e 20 48 6f 77 65 76 65 possible. Howeve
5d00: 72 20 77 65 20 6d 61 79 20 62 65 20 61 62 6c 65 r we may be able
5d10: 0a 09 20 20 20 20 23 20 74 6f 20 69 67 6e 6f 72 .. # to ignor
5d20: 65 20 74 68 69 73 2c 20 69 74 20 73 68 6f 75 6c e this, it shoul
5d30: 64 20 6f 6e 6c 79 20 63 61 75 73 65 20 74 68 65 d only cause the
5d40: 20 62 72 61 6e 63 68 20 74 6f 20 68 61 76 65 0a branch to have.
5d50: 09 20 20 20 20 23 20 6d 6f 72 65 20 74 68 61 6e . # more than
5d60: 20 6f 6e 65 20 70 72 65 64 65 63 65 73 73 6f 72 one predecessor
5d70: 2c 20 61 6e 64 20 73 68 69 66 74 69 6e 67 20 69 , and shifting i
5d80: 74 20 61 72 6f 75 6e 64 20 69 6e 20 74 68 65 0a t around in the.
5d90: 09 20 20 20 20 23 20 63 6f 6d 6d 69 74 20 6f 72 . # commit or
5da0: 64 65 72 2e 20 54 68 65 20 62 61 63 6b 65 6e 64 der. The backend
5db0: 20 77 6f 75 6c 64 20 73 74 69 6c 6c 20 75 73 65 would still use
5dc0: 20 74 68 65 20 70 72 65 66 65 72 65 64 0a 09 20 the prefered..
5dd0: 20 20 20 23 20 70 61 72 65 6e 74 20 66 6f 72 20 # parent for
5de0: 74 68 65 20 61 74 74 61 63 68 6d 65 6e 74 20 70 the attachment p
5df0: 6f 69 6e 74 20 69 6e 20 66 6f 73 73 69 6c 2e 0a oint in fossil..
5e00: 0a 09 20 20 20 20 23 20 53 6f 2c 20 66 6f 72 20 .. # So, for
5e10: 6e 6f 77 20 49 20 68 61 76 65 20 64 65 63 69 64 now I have decid
5e20: 65 64 20 74 6f 20 64 69 73 61 62 6c 65 20 74 68 ed to disable th
5e30: 69 73 20 61 6e 64 20 70 72 65 73 73 0a 09 20 20 is and press..
5e40: 20 20 23 20 66 6f 72 77 61 72 64 2e 20 4f 66 20 # forward. Of
5e50: 63 6f 75 72 73 65 2c 20 69 66 20 77 65 20 72 75 course, if we ru
5e60: 6e 20 69 6e 74 6f 20 61 63 74 75 61 6c 20 74 72 n into actual tr
5e70: 6f 75 62 6c 65 20 77 65 0a 09 20 20 20 20 23 20 ouble we.. #
5e80: 77 69 6c 6c 20 68 61 76 65 20 74 6f 20 67 6f 20 will have to go
5e90: 62 61 63 6b 20 68 65 72 65 20 73 65 65 20 77 68 back here see wh
5ea0: 61 74 20 63 61 6e 20 62 65 20 64 6f 6e 65 20 74 at can be done t
5eb0: 6f 20 66 69 78 0a 09 20 20 20 20 23 20 74 68 69 o fix.. # thi
5ec0: 73 2e 20 45 76 65 6e 20 69 66 20 6f 6e 6c 79 20 s. Even if only
5ed0: 67 69 76 69 6e 67 20 74 68 65 20 75 73 65 72 20 giving the user
5ee0: 74 68 65 20 69 6e 73 74 72 75 63 74 69 6f 6e 20 the instruction
5ef0: 68 6f 77 0a 09 20 20 20 20 23 20 74 6f 20 65 64 how.. # to ed
5f00: 69 74 20 74 68 65 20 43 56 53 20 72 65 70 6f 73 it the CVS repos
5f10: 69 74 6f 72 79 20 74 6f 20 72 65 6d 6f 76 65 20 itory to remove
5f20: 74 68 65 20 69 6e 63 6f 6e 73 69 73 74 65 6e 63 the inconsistenc
5f30: 79 2e 0a 0a 09 20 20 20 20 23 20 41 6c 6c 20 62 y.... # All b
5f40: 72 61 6e 63 68 65 73 20 68 61 76 65 20 74 6f 20 ranches have to
5f50: 61 67 72 65 65 20 6f 6e 20 74 68 65 20 4c 4f 44 agree on the LOD
5f60: 20 74 68 65 69 72 20 63 68 61 6e 67 65 73 65 74 their changeset
5f70: 0a 09 20 20 20 20 23 20 62 65 6c 6f 6e 67 73 20 .. # belongs
5f80: 74 6f 2e 20 49 6e 20 6f 74 68 65 72 20 77 6f 72 to. In other wor
5f90: 64 73 2c 20 61 6c 6c 20 62 72 61 6e 63 68 65 73 ds, all branches
5fa0: 20 69 6e 20 61 20 63 68 61 6e 67 65 73 65 74 0a in a changeset.
5fb0: 09 20 20 20 20 23 20 68 61 76 65 20 74 6f 20 72 . # have to r
5fc0: 65 66 65 72 20 74 6f 20 74 68 65 20 73 61 6d 65 efer to the same
5fd0: 20 6c 69 6e 65 20 6f 66 20 64 65 76 65 6c 6f 70 line of develop
5fe0: 6d 65 6e 74 2e 0a 09 20 20 20 20 23 0a 09 20 20 ment... #..
5ff0: 20 20 23 20 49 6e 73 74 65 61 64 20 6f 66 20 6c # Instead of l
6000: 6f 6f 6b 69 6e 67 20 61 74 20 61 6c 6c 20 70 61 ooking at all pa
6010: 69 72 73 20 6f 66 20 62 72 61 6e 63 68 65 73 20 irs of branches
6020: 69 6e 20 61 6c 6c 0a 09 20 20 20 20 23 20 63 68 in all.. # ch
6030: 61 6e 67 65 73 65 74 73 20 77 65 20 67 65 6e 65 angesets we gene
6040: 72 61 74 65 20 74 68 65 20 64 69 73 74 69 6e 63 rate the distinc
6050: 74 20 73 65 74 20 6f 66 20 61 6c 6c 20 4c 4f 44 t set of all LOD
6060: 73 0a 09 20 20 20 20 23 20 72 65 66 65 72 65 6e s.. # referen
6070: 63 65 64 20 62 79 20 74 68 65 20 62 72 61 6e 63 ced by the branc
6080: 68 65 73 20 6f 66 20 61 20 63 68 61 6e 67 65 73 hes of a changes
6090: 65 74 2c 20 6c 6f 6f 6b 20 66 6f 72 0a 09 20 20 et, look for..
60a0: 20 20 23 20 74 68 6f 73 65 20 77 69 74 68 20 63 # those with c
60b0: 61 72 64 69 6e 61 6c 69 74 79 20 3e 20 31 2c 20 ardinality > 1,
60c0: 61 6e 64 20 67 65 74 20 74 68 65 20 69 64 65 6e and get the iden
60d0: 74 69 66 79 69 6e 67 0a 09 20 20 20 20 23 20 69 tifying.. # i
60e0: 6e 66 6f 72 6d 61 74 69 6f 6e 20 66 6f 72 20 74 nformation for t
60f0: 68 65 20 63 68 61 6e 67 65 73 65 74 73 20 66 6f he changesets fo
6100: 75 6e 64 20 74 68 75 73 6c 79 2e 0a 09 20 20 20 und thusly...
6110: 20 43 68 65 63 6b 43 53 20 5c 0a 09 09 7b 41 6c CheckCS \...{Al
6120: 6c 20 62 72 61 6e 63 68 65 73 20 69 6e 20 61 20 l branches in a
6130: 63 68 61 6e 67 65 73 65 74 20 68 61 76 65 20 74 changeset have t
6140: 6f 20 62 65 6c 6f 6e 67 20 74 6f 20 74 68 65 20 o belong to the
6150: 73 61 6d 65 20 4c 4f 44 7d 20 5c 0a 09 09 7b 3a same LOD} \...{:
6160: 20 49 74 73 20 62 72 61 6e 63 68 65 73 20 64 69 Its branches di
6170: 73 61 67 72 65 65 20 61 62 6f 75 74 20 74 68 65 sagree about the
6180: 20 4c 4f 44 20 74 68 65 79 20 62 65 6c 6f 6e 67 LOD they belong
6190: 20 74 6f 7d 20 7b 0a 09 09 20 20 20 20 53 45 4c to} {... SEL
61a0: 45 43 54 20 54 2e 6e 61 6d 65 2c 20 43 2e 63 69 ECT T.name, C.ci
61b0: 64 0a 09 09 20 20 20 20 46 52 4f 4d 20 20 20 63 d... FROM c
61c0: 68 61 6e 67 65 73 65 74 20 43 2c 20 63 73 74 79 hangeset C, csty
61d0: 70 65 20 54 0a 09 09 20 20 20 20 57 48 45 52 45 pe T... WHERE
61e0: 20 20 43 2e 63 69 64 20 49 4e 20 28 53 45 4c 45 C.cid IN (SELE
61f0: 43 54 20 55 2e 63 69 64 0a 09 09 09 09 20 20 20 CT U.cid.....
6200: 20 20 46 52 4f 4d 20 28 53 45 4c 45 43 54 20 44 FROM (SELECT D
6210: 49 53 54 49 4e 43 54 20 43 49 2e 63 69 64 20 41 ISTINCT CI.cid A
6220: 53 20 63 69 64 2c 20 42 2e 6c 6f 64 20 41 53 20 S cid, B.lod AS
6230: 6c 6f 64 0a 09 09 09 09 09 20 20 20 46 52 4f 4d lod...... FROM
6240: 20 20 20 63 73 69 74 65 6d 20 43 49 2c 20 63 68 csitem CI, ch
6250: 61 6e 67 65 73 65 74 20 43 2c 20 62 72 61 6e 63 angeset C, branc
6260: 68 20 42 0a 09 09 09 09 09 20 20 20 57 48 45 52 h B...... WHER
6270: 45 20 20 43 49 2e 69 69 64 20 3d 20 42 2e 62 69 E CI.iid = B.bi
6280: 64 0a 09 09 09 09 09 20 20 20 41 4e 44 20 20 20 d...... AND
6290: 20 43 2e 63 69 64 20 3d 20 43 49 2e 63 69 64 0a C.cid = CI.cid.
62a0: 09 09 09 09 09 20 20 20 41 4e 44 20 20 20 20 43 ..... AND C
62b0: 2e 74 79 70 65 20 3d 20 32 29 20 41 53 20 55 0a .type = 2) AS U.
62c0: 09 09 09 09 20 20 20 20 20 47 52 4f 55 50 20 42 .... GROUP B
62d0: 59 20 55 2e 63 69 64 20 48 41 56 49 4e 47 20 43 Y U.cid HAVING C
62e0: 4f 55 4e 54 28 55 2e 6c 6f 64 29 20 3e 20 31 29 OUNT(U.lod) > 1)
62f0: 0a 09 09 20 20 20 20 41 4e 44 20 20 20 20 54 2e ... AND T.
6300: 74 69 64 20 3d 20 43 2e 74 79 70 65 0a 09 09 7d tid = C.type...}
6310: 0a 09 7d 0a 09 23 20 41 6c 6c 20 62 72 61 6e 63 ..}..# All branc
6320: 68 65 73 20 68 61 76 65 20 74 6f 20 61 67 72 65 hes have to agre
6330: 65 20 6f 6e 20 74 68 65 20 70 72 6f 6a 65 63 74 e on the project
6340: 20 74 68 65 69 72 20 63 68 61 6e 67 65 73 65 74 their changeset
6350: 0a 09 23 20 62 65 6c 6f 6e 67 73 20 74 6f 2e 20 ..# belongs to.
6360: 49 6e 20 6f 74 68 65 72 20 77 6f 72 64 73 2c 20 In other words,
6370: 61 6c 6c 20 62 72 61 6e 63 68 65 73 20 69 6e 20 all branches in
6380: 61 20 63 68 61 6e 67 65 73 65 74 20 68 61 76 65 a changeset have
6390: 0a 09 23 20 74 6f 20 72 65 66 65 72 20 74 6f 20 ..# to refer to
63a0: 74 68 65 20 73 61 6d 65 20 70 72 6f 6a 65 63 74 the same project
63b0: 2e 0a 09 23 0a 09 23 20 49 6e 73 74 65 61 64 20 ...#..# Instead
63c0: 6f 66 20 6c 6f 6f 6b 69 6e 67 20 61 74 20 61 6c of looking at al
63d0: 6c 20 70 61 69 72 73 20 6f 66 20 62 72 61 6e 63 l pairs of branc
63e0: 68 65 73 20 69 6e 20 61 6c 6c 0a 09 23 20 63 68 hes in all..# ch
63f0: 61 6e 67 65 73 65 74 73 20 77 65 20 67 65 6e 65 angesets we gene
6400: 72 61 74 65 20 74 68 65 20 64 69 73 74 69 6e 63 rate the distinc
6410: 74 20 73 65 74 20 6f 66 20 61 6c 6c 20 70 72 6f t set of all pro
6420: 6a 65 63 74 73 0a 09 23 20 72 65 66 65 72 65 6e jects..# referen
6430: 63 65 64 20 62 79 20 74 68 65 20 62 72 61 6e 63 ced by the branc
6440: 68 65 73 20 6f 66 20 61 20 63 68 61 6e 67 65 73 hes of a changes
6450: 65 74 2c 20 6c 6f 6f 6b 20 66 6f 72 20 74 68 6f et, look for tho
6460: 73 65 0a 09 23 20 77 69 74 68 20 63 61 72 64 69 se..# with cardi
6470: 6e 61 6c 69 74 79 20 3e 20 31 2c 20 61 6e 64 20 nality > 1, and
6480: 67 65 74 20 74 68 65 20 69 64 65 6e 74 69 66 79 get the identify
6490: 69 6e 67 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 0a ing information.
64a0: 09 23 20 66 6f 72 20 74 68 65 20 63 68 61 6e 67 .# for the chang
64b0: 65 73 65 74 73 20 66 6f 75 6e 64 20 74 68 75 73 esets found thus
64c0: 6c 79 2e 0a 09 43 68 65 63 6b 43 53 20 5c 0a 09 ly...CheckCS \..
64d0: 20 20 20 20 7b 41 6c 6c 20 62 72 61 6e 63 68 65 {All branche
64e0: 73 20 69 6e 20 61 20 63 68 61 6e 67 65 73 65 74 s in a changeset
64f0: 20 68 61 76 65 20 74 6f 20 62 65 6c 6f 6e 67 20 have to belong
6500: 74 6f 20 74 68 65 20 73 61 6d 65 20 70 72 6f 6a to the same proj
6510: 65 63 74 7d 20 5c 0a 09 20 20 20 20 7b 3a 20 49 ect} \.. {: I
6520: 74 73 20 62 72 61 6e 63 68 65 73 20 64 69 73 61 ts branches disa
6530: 67 72 65 65 20 61 62 6f 75 74 20 74 68 65 20 70 gree about the p
6540: 72 6f 6a 65 63 74 20 74 68 65 79 20 62 65 6c 6f roject they belo
6550: 6e 67 20 74 6f 7d 20 7b 0a 09 09 53 45 4c 45 43 ng to} {...SELEC
6560: 54 20 54 2e 6e 61 6d 65 2c 20 43 2e 63 69 64 0a T T.name, C.cid.
6570: 09 09 46 52 4f 4d 20 20 20 63 68 61 6e 67 65 73 ..FROM changes
6580: 65 74 20 43 2c 20 63 73 74 79 70 65 20 54 0a 09 et C, cstype T..
6590: 09 57 48 45 52 45 20 20 43 2e 63 69 64 20 49 4e .WHERE C.cid IN
65a0: 20 28 53 45 4c 45 43 54 20 55 2e 63 69 64 0a 09 (SELECT U.cid..
65b0: 09 09 09 20 46 52 4f 4d 20 28 53 45 4c 45 43 54 ... FROM (SELECT
65c0: 20 44 49 53 54 49 4e 43 54 20 43 49 2e 63 69 64 DISTINCT CI.cid
65d0: 20 41 53 20 63 69 64 2c 20 46 2e 70 69 64 20 41 AS cid, F.pid A
65e0: 53 20 70 69 64 0a 09 09 09 09 20 20 20 20 20 20 S pid.....
65f0: 20 46 52 4f 4d 20 20 20 63 73 69 74 65 6d 20 43 FROM csitem C
6600: 49 2c 20 63 68 61 6e 67 65 73 65 74 20 43 2c 20 I, changeset C,
6610: 62 72 61 6e 63 68 20 42 2c 20 66 69 6c 65 20 46 branch B, file F
6620: 0a 09 09 09 09 20 20 20 20 20 20 20 57 48 45 52 ..... WHER
6630: 45 20 20 43 49 2e 69 69 64 20 3d 20 42 2e 62 69 E CI.iid = B.bi
6640: 64 0a 09 09 09 09 20 20 20 20 20 20 20 41 4e 44 d..... AND
6650: 20 20 20 20 43 2e 63 69 64 20 3d 20 43 49 2e 63 C.cid = CI.c
6660: 69 64 0a 09 09 09 09 20 20 20 20 20 20 20 41 4e id..... AN
6670: 44 20 20 20 20 43 2e 74 79 70 65 20 3d 20 32 0a D C.type = 2.
6680: 09 09 09 09 20 20 20 20 20 20 20 41 4e 44 20 20 .... AND
6690: 20 20 46 2e 66 69 64 20 20 3d 20 42 2e 66 69 64 F.fid = B.fid
66a0: 29 20 41 53 20 55 0a 09 09 09 09 20 47 52 4f 55 ) AS U..... GROU
66b0: 50 20 42 59 20 55 2e 63 69 64 20 48 41 56 49 4e P BY U.cid HAVIN
66c0: 47 20 43 4f 55 4e 54 28 55 2e 70 69 64 29 20 3e G COUNT(U.pid) >
66d0: 20 31 29 0a 09 09 41 4e 44 20 20 20 20 54 2e 74 1)...AND T.t
66e0: 69 64 20 3d 20 43 2e 74 79 70 65 0a 09 20 20 20 id = C.type..
66f0: 20 7d 0a 09 23 20 41 6c 6c 20 62 72 61 6e 63 68 }..# All branch
6700: 65 73 20 69 6e 20 61 20 73 69 6e 67 6c 65 20 63 es in a single c
6710: 68 61 6e 67 65 73 65 74 20 68 61 76 65 20 74 6f hangeset have to
6720: 20 62 65 6c 6f 6e 67 20 74 6f 0a 09 23 20 64 69 belong to..# di
6730: 66 66 65 72 65 6e 74 20 66 69 6c 65 73 2e 20 43 fferent files. C
6740: 6f 6e 76 65 72 73 65 6c 79 3a 20 4e 6f 20 74 77 onversely: No tw
6750: 6f 20 62 72 61 6e 63 68 65 73 20 6f 66 20 61 20 o branches of a
6760: 73 69 6e 67 6c 65 0a 09 23 20 66 69 6c 65 20 61 single..# file a
6770: 72 65 20 61 6c 6c 6f 77 65 64 20 74 6f 20 62 65 re allowed to be
6780: 20 69 6e 20 74 68 65 20 73 61 6d 65 20 63 68 61 in the same cha
6790: 6e 67 65 73 65 74 2e 0a 09 23 0a 09 23 20 49 6e ngeset...#..# In
67a0: 73 74 65 61 64 20 6f 66 20 6c 6f 6f 6b 69 6e 67 stead of looking
67b0: 20 61 74 20 61 6c 6c 20 70 61 69 72 73 20 6f 66 at all pairs of
67c0: 20 62 72 61 6e 63 68 65 73 20 69 6e 20 61 6c 6c branches in all
67d0: 0a 09 23 20 63 68 61 6e 67 65 73 65 74 73 20 77 ..# changesets w
67e0: 65 20 67 65 6e 65 72 61 74 65 20 74 68 65 20 64 e generate the d
67f0: 69 73 74 69 6e 63 74 20 73 65 74 20 6f 66 20 61 istinct set of a
6800: 6c 6c 20 66 69 6c 65 73 0a 09 23 20 72 65 66 65 ll files..# refe
6810: 72 65 6e 63 65 64 20 62 79 20 74 68 65 20 62 72 renced by the br
6820: 61 6e 63 68 65 73 20 6f 66 20 61 20 63 68 61 6e anches of a chan
6830: 67 65 73 65 74 2c 20 61 6e 64 20 6c 6f 6f 6b 20 geset, and look
6840: 66 6f 72 0a 09 23 20 74 68 6f 73 65 20 77 69 74 for..# those wit
6850: 68 20 63 61 72 64 69 6e 61 6c 69 74 79 20 3c 20 h cardinality <
6860: 74 68 65 20 63 61 72 64 69 6e 61 6c 69 74 79 20 the cardinality
6870: 6f 66 20 74 68 65 20 73 65 74 20 6f 66 0a 09 23 of the set of..#
6880: 20 62 72 61 6e 63 68 65 73 2c 20 61 6e 64 20 67 branches, and g
6890: 65 74 20 74 68 65 20 69 64 65 6e 74 69 66 79 69 et the identifyi
68a0: 6e 67 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 66 ng information f
68b0: 6f 72 20 74 68 65 0a 09 23 20 63 68 61 6e 67 65 or the..# change
68c0: 73 65 74 73 20 66 6f 75 6e 64 20 74 68 75 73 6c sets found thusl
68d0: 79 2e 0a 09 43 68 65 63 6b 43 53 20 5c 0a 09 20 y...CheckCS \..
68e0: 20 20 20 7b 41 6c 6c 20 62 72 61 6e 63 68 65 73 {All branches
68f0: 20 69 6e 20 61 20 63 68 61 6e 67 65 73 65 74 20 in a changeset
6900: 68 61 76 65 20 74 6f 20 62 65 6c 6f 6e 67 20 74 have to belong t
6910: 6f 20 64 69 66 66 65 72 65 6e 74 20 66 69 6c 65 o different file
6920: 73 7d 20 5c 0a 09 20 20 20 20 7b 3a 20 49 74 73 s} \.. {: Its
6930: 20 62 72 61 6e 63 68 65 73 20 73 68 61 72 65 20 branches share
6940: 66 69 6c 65 73 7d 20 7b 0a 09 09 53 45 4c 45 43 files} {...SELEC
6950: 54 20 54 2e 6e 61 6d 65 2c 20 43 2e 63 69 64 0a T T.name, C.cid.
6960: 09 09 46 52 4f 4d 20 20 20 63 68 61 6e 67 65 73 ..FROM changes
6970: 65 74 20 43 2c 20 63 73 74 79 70 65 20 54 0a 09 et C, cstype T..
6980: 09 57 48 45 52 45 20 20 43 2e 63 69 64 20 49 4e .WHERE C.cid IN
6990: 20 28 53 45 4c 45 43 54 20 56 56 2e 63 69 64 0a (SELECT VV.cid.
69a0: 09 09 09 09 20 46 52 4f 4d 20 28 53 45 4c 45 43 .... FROM (SELEC
69b0: 54 20 55 2e 63 69 64 20 61 73 20 63 69 64 2c 20 T U.cid as cid,
69c0: 43 4f 55 4e 54 20 28 55 2e 66 69 64 29 20 41 53 COUNT (U.fid) AS
69d0: 20 66 63 6f 75 6e 74 0a 09 09 09 09 20 20 20 20 fcount.....
69e0: 20 20 20 46 52 4f 4d 20 28 53 45 4c 45 43 54 20 FROM (SELECT
69f0: 44 49 53 54 49 4e 43 54 20 43 49 2e 63 69 64 20 DISTINCT CI.cid
6a00: 41 53 20 63 69 64 2c 20 42 2e 66 69 64 20 41 53 AS cid, B.fid AS
6a10: 20 66 69 64 0a 09 09 09 09 09 20 20 20 20 20 46 fid...... F
6a20: 52 4f 4d 20 20 20 63 73 69 74 65 6d 20 43 49 2c ROM csitem CI,
6a30: 20 63 68 61 6e 67 65 73 65 74 20 43 2c 20 62 72 changeset C, br
6a40: 61 6e 63 68 20 42 0a 09 09 09 09 09 20 20 20 20 anch B......
6a50: 20 57 48 45 52 45 20 20 43 49 2e 69 69 64 20 3d WHERE CI.iid =
6a60: 20 42 2e 62 69 64 0a 09 09 09 09 09 20 20 20 20 B.bid......
6a70: 20 41 4e 44 20 20 20 20 43 2e 63 69 64 20 3d 20 AND C.cid =
6a80: 43 49 2e 63 69 64 0a 09 09 09 09 09 20 20 20 20 CI.cid......
6a90: 20 41 4e 44 20 20 20 20 43 2e 74 79 70 65 20 3d AND C.type =
6aa0: 20 32 0a 09 09 09 09 09 20 20 20 20 20 29 20 41 2...... ) A
6ab0: 53 20 55 0a 09 09 09 09 20 20 20 20 20 20 20 47 S U..... G
6ac0: 52 4f 55 50 20 42 59 20 55 2e 63 69 64 29 20 41 ROUP BY U.cid) A
6ad0: 53 20 55 55 2c 0a 09 09 09 09 20 20 20 20 20 20 S UU,.....
6ae0: 28 53 45 4c 45 43 54 20 56 2e 63 69 64 20 41 53 (SELECT V.cid AS
6af0: 20 63 69 64 2c 20 43 4f 55 4e 54 20 28 56 2e 69 cid, COUNT (V.i
6b00: 69 64 29 20 41 53 20 72 63 6f 75 6e 74 0a 09 09 id) AS rcount...
6b10: 09 09 20 20 20 20 20 20 20 46 52 4f 4d 20 20 20 .. FROM
6b20: 63 73 69 74 65 6d 20 56 2c 20 63 68 61 6e 67 65 csitem V, change
6b30: 73 65 74 20 58 0a 09 09 09 09 20 20 20 20 20 20 set X.....
6b40: 20 57 48 45 52 45 20 20 58 2e 63 69 64 20 3d 20 WHERE X.cid =
6b50: 56 2e 63 69 64 0a 09 09 09 09 20 20 20 20 20 20 V.cid.....
6b60: 20 41 4e 44 20 20 20 20 58 2e 74 79 70 65 20 3d AND X.type =
6b70: 20 32 0a 09 09 09 09 20 20 20 20 20 20 20 47 52 2..... GR
6b80: 4f 55 50 20 42 59 20 56 2e 63 69 64 29 20 41 53 OUP BY V.cid) AS
6b90: 20 56 56 0a 09 09 09 09 20 57 48 45 52 45 20 56 VV..... WHERE V
6ba0: 56 2e 63 69 64 20 3d 20 55 55 2e 63 69 64 0a 09 V.cid = UU.cid..
6bb0: 09 09 09 20 41 4e 44 20 20 20 55 55 2e 66 63 6f ... AND UU.fco
6bc0: 75 6e 74 20 3c 20 56 56 2e 72 63 6f 75 6e 74 29 unt < VV.rcount)
6bd0: 0a 09 09 41 4e 44 20 20 20 20 54 2e 74 69 64 20 ...AND T.tid
6be0: 3d 20 43 2e 74 79 70 65 0a 09 20 20 20 20 7d 0a = C.type.. }.
6bf0: 09 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 .return. }..
6c00: 20 20 20 70 72 6f 63 20 5f 5f 5f 55 6e 75 73 65 proc ___Unuse
6c10: 64 43 68 61 6e 67 65 73 65 74 43 68 65 63 6b 73 dChangesetChecks
6c20: 5f 5f 5f 20 7b 7d 20 7b 0a 09 23 20 54 68 69 73 ___ {} {..# This
6c30: 20 63 6f 64 65 20 70 65 72 66 6f 72 6d 73 20 61 code performs a
6c40: 20 6e 75 6d 62 65 72 20 6f 66 20 70 61 72 61 6e number of paran
6c50: 6f 69 64 20 63 68 65 63 6b 73 20 6f 66 20 74 68 oid checks of th
6c60: 65 0a 09 23 20 64 61 74 61 62 61 73 65 2c 20 73 e..# database, s
6c70: 65 61 72 63 68 69 6e 67 20 66 6f 72 20 69 6e 63 earching for inc
6c80: 6f 6e 73 69 73 74 65 6e 74 20 63 68 61 6e 67 65 onsistent change
6c90: 73 65 74 2f 72 65 76 69 73 69 6f 6e 0a 09 23 20 set/revision..#
6ca0: 69 6e 66 6f 72 6d 61 74 69 6f 6e 2e 0a 0a 09 72 information....r
6cb0: 65 74 75 72 6e 20 3b 20 23 20 44 69 73 61 62 6c eturn ; # Disabl
6cc0: 65 64 20 66 6f 72 20 6e 6f 77 2c 20 62 6f 74 74 ed for now, bott
6cd0: 6c 65 6e 65 63 6b 73 20 2e 2e 2e 0a 0a 09 75 70 lenecks ......up
6ce0: 76 61 72 20 31 20 6e 20 6e 20 3b 20 23 20 43 6f var 1 n n ; # Co
6cf0: 75 6e 74 65 72 20 66 6f 72 20 74 68 65 20 63 68 unter for the ch
6d00: 65 63 6b 73 20 28 77 65 20 70 72 69 6e 74 20 61 ecks (we print a
6d10: 6e 20 69 64 20 62 65 66 6f 72 65 0a 09 09 20 20 n id before...
6d20: 20 20 20 20 23 20 74 68 65 20 6d 61 69 6e 20 6c # the main l
6d30: 61 62 65 6c 29 2e 0a 0a 09 23 20 54 68 65 20 6e abel)....# The n
6d40: 65 78 74 20 74 77 6f 20 63 68 65 63 6b 73 20 61 ext two checks a
6d50: 72 65 20 42 4f 54 54 4c 45 4e 45 43 4b 53 2e 20 re BOTTLENECKS.
6d60: 49 6e 20 65 73 73 65 6e 63 65 20 77 65 20 61 72 In essence we ar
6d70: 65 0a 09 23 20 63 68 65 63 6b 69 6e 67 20 65 61 e..# checking ea
6d80: 63 68 20 73 79 6d 62 6f 6c 20 63 68 61 6e 67 65 ch symbol change
6d90: 73 65 74 20 6f 6e 65 20 62 79 20 6f 6e 65 2e 0a set one by one..
6da0: 0a 09 23 20 54 4f 44 4f 3a 20 54 72 79 20 74 6f ..# TODO: Try to
6db0: 20 72 65 70 68 72 61 73 65 20 74 68 65 20 63 68 rephrase the ch
6dc0: 65 63 6b 73 20 74 6f 20 6d 61 6b 65 20 6d 6f 72 ecks to make mor
6dd0: 65 20 75 73 65 20 6f 66 0a 09 23 20 69 6e 64 69 e use of..# indi
6de0: 63 65 73 2c 20 73 65 74 20 61 6e 64 20 73 74 72 ces, set and str
6df0: 65 61 6d 20 6f 70 65 72 61 74 69 6f 6e 73 2e 0a eam operations..
6e00: 0a 09 23 20 41 6c 6c 20 72 65 76 69 73 69 6f 6e ..# All revision
6e10: 73 20 75 73 65 64 20 62 79 20 74 61 67 20 73 79 s used by tag sy
6e20: 6d 62 6f 6c 20 63 68 61 6e 67 65 73 65 74 73 20 mbol changesets
6e30: 68 61 76 65 20 74 6f 20 68 61 76 65 20 74 68 65 have to have the
6e40: 0a 09 23 20 63 68 61 6e 67 65 73 65 74 27 73 20 ..# changeset's
6e50: 74 61 67 20 61 73 73 6f 63 69 61 74 65 64 20 77 tag associated w
6e60: 69 74 68 20 74 68 65 6d 2e 0a 09 43 68 65 63 6b ith them...Check
6e70: 52 65 76 43 53 20 5c 0a 09 20 20 20 20 7b 41 6c RevCS \.. {Al
6e80: 6c 20 72 65 76 69 73 69 6f 6e 73 20 75 73 65 64 l revisions used
6e90: 20 62 79 20 74 61 67 20 73 79 6d 62 6f 6c 20 63 by tag symbol c
6ea0: 68 61 6e 67 65 73 65 74 73 20 68 61 76 65 20 74 hangesets have t
6eb0: 6f 20 68 61 76 65 20 74 68 65 20 63 68 61 6e 67 o have the chang
6ec0: 65 73 65 74 27 73 20 74 61 67 20 61 74 74 61 63 eset's tag attac
6ed0: 68 65 64 20 74 6f 20 74 68 65 6d 7d 20 5c 0a 09 hed to them} \..
6ee0: 20 20 20 20 7b 64 6f 65 73 20 6e 6f 74 20 68 61 {does not ha
6ef0: 76 65 20 74 68 65 20 74 61 67 20 6f 66 20 69 74 ve the tag of it
6f00: 73 20 73 79 6d 62 6f 6c 20 63 68 61 6e 67 65 73 s symbol changes
6f10: 65 74 20 40 20 61 74 74 61 63 68 65 64 20 74 6f et @ attached to
6f20: 20 69 74 7d 20 7b 0a 09 09 53 45 4c 45 43 54 20 it} {...SELECT
6f30: 43 54 2e 6e 61 6d 65 2c 20 43 2e 63 69 64 2c 20 CT.name, C.cid,
6f40: 46 2e 6e 61 6d 65 2c 20 52 2e 72 65 76 0a 09 09 F.name, R.rev...
6f50: 46 52 4f 4d 20 20 20 63 68 61 6e 67 65 73 65 74 FROM changeset
6f60: 20 43 2c 20 63 73 74 79 70 65 20 43 54 2c 20 72 C, cstype CT, r
6f70: 65 76 69 73 69 6f 6e 20 52 2c 20 66 69 6c 65 20 evision R, file
6f80: 46 2c 20 63 73 69 74 65 6d 20 43 49 2c 20 74 61 F, csitem CI, ta
6f90: 67 20 54 0a 09 09 57 48 45 52 45 20 20 43 2e 74 g T...WHERE C.t
6fa0: 79 70 65 20 3d 20 31 20 20 20 20 20 20 20 2d 2d ype = 1 --
6fb0: 20 73 79 6d 62 6f 6c 20 63 68 61 6e 67 65 73 65 symbol changese
6fc0: 74 73 20 6f 6e 6c 79 0a 09 09 41 4e 44 20 20 20 ts only...AND
6fd0: 20 43 2e 73 72 63 20 20 3d 20 54 2e 73 69 64 20 C.src = T.sid
6fe0: 20 20 2d 2d 20 74 61 67 20 6f 6e 6c 79 2c 20 6c -- tag only, l
6ff0: 69 6e 6b 65 64 20 62 79 20 73 79 6d 62 6f 6c 20 inked by symbol
7000: 69 64 20 0a 09 09 41 4e 44 20 20 20 20 43 2e 63 id ...AND C.c
7010: 69 64 20 20 3d 20 43 49 2e 63 69 64 20 20 2d 2d id = CI.cid --
7020: 20 63 68 61 6e 67 65 73 65 74 20 2d 2d 3e 20 69 changeset --> i
7030: 74 73 20 72 65 76 69 73 69 6f 6e 73 0a 09 09 41 ts revisions...A
7040: 4e 44 20 20 20 20 52 2e 72 69 64 20 20 3d 20 43 ND R.rid = C
7050: 49 2e 69 69 64 20 20 2d 2d 20 6c 6f 6f 6b 20 61 I.iid -- look a
7060: 74 20 74 68 65 20 72 65 76 69 73 69 6f 6e 73 0a t the revisions.
7070: 09 09 2d 2d 20 61 6e 64 20 6c 6f 6f 6b 20 66 6f ..-- and look fo
7080: 72 20 74 68 65 20 74 61 67 20 61 6d 6f 6e 67 20 r the tag among
7090: 74 68 65 20 61 74 74 61 63 68 65 64 20 6f 6e 65 the attached one
70a0: 73 2e 0a 09 09 41 4e 44 20 20 20 20 54 2e 73 69 s....AND T.si
70b0: 64 20 4e 4f 54 20 49 4e 20 28 53 45 4c 45 43 54 d NOT IN (SELECT
70c0: 20 54 42 2e 73 69 64 0a 09 09 09 09 20 20 20 20 TB.sid.....
70d0: 20 46 52 4f 4d 20 20 20 74 61 67 20 54 42 0a 09 FROM tag TB..
70e0: 09 09 09 20 20 20 20 20 57 48 45 52 45 20 20 54 ... WHERE T
70f0: 42 2e 72 65 76 20 3d 20 52 2e 72 69 64 29 0a 09 B.rev = R.rid)..
7100: 09 41 4e 44 20 20 20 20 52 2e 66 69 64 20 3d 20 .AND R.fid =
7110: 46 2e 66 69 64 20 20 20 20 2d 2d 20 67 65 74 20 F.fid -- get
7120: 66 69 6c 65 20 6f 66 20 72 65 76 69 73 69 6f 6e file of revision
7130: 0a 09 20 20 20 20 7d 0a 0a 09 23 20 41 6c 6c 20 .. }...# All
7140: 72 65 76 69 73 69 6f 6e 73 20 75 73 65 64 20 62 revisions used b
7150: 79 20 62 72 61 6e 63 68 20 73 79 6d 62 6f 6c 20 y branch symbol
7160: 63 68 61 6e 67 65 73 65 74 73 20 68 61 76 65 20 changesets have
7170: 74 6f 20 68 61 76 65 0a 09 23 20 74 68 65 20 63 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 73 73 6f 63 69 61 74 65 64 20 77 69 74 h associated wit
71a0: 68 20 74 68 65 6d 2e 0a 0a 09 43 68 65 63 6b 52 h them....CheckR
71b0: 65 76 43 53 20 5c 0a 09 20 20 20 20 7b 41 6c 6c evCS \.. {All
71c0: 20 72 65 76 69 73 69 6f 6e 73 20 75 73 65 64 20 revisions used
71d0: 62 79 20 62 72 61 6e 63 68 20 73 79 6d 62 6f 6c by branch symbol
71e0: 20 63 68 61 6e 67 65 73 65 74 73 20 68 61 76 65 changesets have
71f0: 20 74 6f 20 68 61 76 65 20 74 68 65 20 63 68 61 to have the cha
7200: 6e 67 65 73 65 74 27 73 20 62 72 61 6e 63 68 20 ngeset's branch
7210: 61 74 74 61 63 68 65 64 20 74 6f 20 74 68 65 6d attached to them
7220: 7d 20 5c 0a 09 20 20 20 20 7b 64 6f 65 73 20 6e } \.. {does n
7230: 6f 74 20 68 61 76 65 20 74 68 65 20 62 72 61 6e ot have the bran
7240: 63 68 20 6f 66 20 69 74 73 20 73 79 6d 62 6f 6c ch of its symbol
7250: 20 63 68 61 6e 67 65 73 65 74 20 40 20 61 74 74 changeset @ att
7260: 61 63 68 65 64 20 74 6f 20 69 74 7d 20 7b 0a 09 ached to it} {..
7270: 09 53 45 4c 45 43 54 20 43 54 2e 6e 61 6d 65 2c .SELECT CT.name,
7280: 20 43 2e 63 69 64 2c 20 46 2e 6e 61 6d 65 2c 20 C.cid, F.name,
7290: 52 2e 72 65 76 2c 20 43 2e 63 69 64 0a 09 09 46 R.rev, C.cid...F
72a0: 52 4f 4d 20 20 20 63 68 61 6e 67 65 73 65 74 20 ROM changeset
72b0: 43 2c 20 63 73 74 79 70 65 20 43 54 2c 20 72 65 C, cstype CT, re
72c0: 76 69 73 69 6f 6e 20 52 2c 20 66 69 6c 65 20 46 vision R, file F
72d0: 2c 20 63 73 69 74 65 6d 20 43 49 2c 20 62 72 61 , csitem CI, bra
72e0: 6e 63 68 20 42 0a 09 09 57 48 45 52 45 20 20 43 nch B...WHERE C
72f0: 2e 74 79 70 65 20 3d 20 31 20 20 20 20 20 20 20 .type = 1
7300: 2d 2d 20 73 79 6d 62 6f 6c 20 63 68 61 6e 67 65 -- symbol change
7310: 73 65 74 73 20 6f 6e 6c 79 0a 09 09 41 4e 44 20 sets only...AND
7320: 20 20 20 43 2e 73 72 63 20 20 3d 20 42 2e 73 69 C.src = B.si
7330: 64 20 20 20 2d 2d 20 62 72 61 6e 63 68 65 73 20 d -- branches
7340: 6f 6e 6c 79 0a 09 09 41 4e 44 20 20 20 20 43 2e only...AND C.
7350: 63 69 64 20 20 3d 20 43 49 2e 63 69 64 20 20 2d cid = CI.cid -
7360: 2d 20 63 68 61 6e 67 65 73 65 74 20 2d 2d 3e 20 - changeset -->
7370: 69 74 73 20 72 65 76 69 73 69 6f 6e 73 0a 09 09 its revisions...
7380: 41 4e 44 20 20 20 20 52 2e 72 69 64 20 20 3d 20 AND R.rid =
7390: 43 49 2e 69 69 64 20 20 2d 2d 20 6c 6f 6f 6b 20 CI.iid -- look
73a0: 61 74 20 74 68 65 20 72 65 76 69 73 69 6f 6e 73 at the revisions
73b0: 0a 09 09 2d 2d 20 61 6e 64 20 6c 6f 6f 6b 20 66 ...-- and look f
73c0: 6f 72 20 74 68 65 20 62 72 61 6e 63 68 20 61 6d or the branch am
73d0: 6f 6e 67 20 74 68 65 20 61 74 74 61 63 68 65 64 ong the attached
73e0: 20 6f 6e 65 73 2e 0a 09 09 41 4e 44 20 20 20 20 ones....AND
73f0: 42 2e 73 69 64 20 4e 4f 54 20 49 4e 20 28 53 45 B.sid NOT IN (SE
7400: 4c 45 43 54 20 42 42 2e 73 69 64 0a 09 09 09 09 LECT BB.sid.....
7410: 20 20 20 20 20 46 52 4f 4d 20 20 20 62 72 61 6e FROM bran
7420: 63 68 20 42 42 0a 09 09 09 09 20 20 20 20 20 57 ch BB..... W
7430: 48 45 52 45 20 20 42 42 2e 72 6f 6f 74 20 3d 20 HERE BB.root =
7440: 52 2e 72 69 64 29 0a 09 09 41 4e 44 20 20 20 20 R.rid)...AND
7450: 52 2e 66 69 64 20 3d 20 46 2e 66 69 64 20 20 20 R.fid = F.fid
7460: 20 2d 2d 20 67 65 74 20 66 69 6c 65 20 6f 66 20 -- get file of
7470: 72 65 76 69 73 69 6f 6e 0a 09 20 20 20 20 7d 0a revision.. }.
7480: 0a 09 23 20 54 4f 44 4f 0a 09 23 20 54 68 65 20 ..# TODO..# The
7490: 73 74 61 74 65 20 68 61 73 20 74 6f 20 63 6f 6e state has to con
74a0: 74 61 69 6e 20 61 74 20 6c 65 61 73 74 20 6f 6e tain at least on
74b0: 65 20 74 61 67 20 73 79 6d 62 6f 6c 20 63 68 61 e tag symbol cha
74c0: 6e 67 65 73 65 74 0a 09 23 20 66 6f 72 20 61 6c ngeset..# for al
74d0: 6c 20 6b 6e 6f 77 6e 20 74 61 67 73 2e 0a 0a 09 l known tags....
74e0: 23 20 54 4f 44 4f 0a 09 23 20 54 68 65 20 73 74 # TODO..# The st
74f0: 61 74 65 20 68 61 73 20 74 6f 20 63 6f 6e 74 61 ate has to conta
7500: 69 6e 20 61 74 20 6c 65 61 73 74 20 6f 6e 65 20 in at least one
7510: 62 72 61 6e 63 68 20 73 79 6d 62 6f 6c 20 63 68 branch symbol ch
7520: 61 6e 67 65 73 65 74 0a 09 23 20 66 6f 72 20 61 angeset..# for a
7530: 6c 6c 20 6b 6e 6f 77 6e 20 62 72 61 6e 63 68 65 ll known branche
7540: 73 2e 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 7d s...return. }
7550: 0a 0a 0a 20 20 20 20 70 72 6f 63 20 43 68 65 63 ... proc Chec
7560: 6b 52 65 76 20 7b 68 65 61 64 65 72 20 6c 61 62 kRev {header lab
7570: 65 6c 20 73 71 6c 7d 20 7b 0a 09 75 70 76 61 72 el sql} {..upvar
7580: 20 31 20 6e 20 6e 0a 09 73 65 74 20 6f 6b 20 31 1 n n..set ok 1
7590: 0a 09 66 6f 72 65 61 63 68 20 7b 66 6e 61 6d 65 ..foreach {fname
75a0: 20 72 65 76 6e 72 7d 20 5b 73 74 61 74 65 20 72 revnr} [state r
75b0: 75 6e 20 24 73 71 6c 5d 20 7b 0a 09 20 20 20 20 un $sql] {..
75c0: 73 65 74 20 6f 6b 20 30 0a 09 20 20 20 20 74 72 set ok 0.. tr
75d0: 6f 75 62 6c 65 20 66 61 74 61 6c 20 22 24 7b 72 ouble fatal "${r
75e0: 65 76 6e 72 7d 3a 3a 24 66 6e 61 6d 65 20 24 6c evnr}::$fname $l
75f0: 61 62 65 6c 22 0a 09 7d 0a 09 6c 6f 67 20 77 72 abel"..}..log wr
7600: 69 74 65 20 35 20 69 6e 74 65 67 72 69 74 79 20 ite 5 integrity
7610: 7b 5c 5b 5b 66 6f 72 6d 61 74 20 25 30 32 64 20 {\[[format %02d
7620: 5b 69 6e 63 72 20 6e 5d 5d 5c 5d 20 5b 65 78 70 [incr n]]\] [exp
7630: 72 20 7b 24 6f 6b 20 3f 20 22 4f 6b 20 20 20 20 r {$ok ? "Ok
7640: 22 20 3a 20 22 46 61 69 6c 65 64 22 7d 5d 20 2e " : "Failed"}] .
7650: 2e 2e 20 24 68 65 61 64 65 72 7d 0a 09 72 65 74 .. $header}..ret
7660: 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 70 urn. }.. p
7670: 72 6f 63 20 43 68 65 63 6b 54 61 67 20 7b 68 65 roc CheckTag {he
7680: 61 64 65 72 20 6c 61 62 65 6c 20 73 71 6c 7d 20 ader label sql}
7690: 7b 0a 09 75 70 76 61 72 20 31 20 6e 20 6e 0a 09 {..upvar 1 n n..
76a0: 73 65 74 20 6f 6b 20 31 0a 09 66 6f 72 65 61 63 set ok 1..foreac
76b0: 68 20 7b 70 6e 61 6d 65 20 73 6e 61 6d 65 7d 20 h {pname sname}
76c0: 5b 73 74 61 74 65 20 72 75 6e 20 24 73 71 6c 5d [state run $sql]
76d0: 20 7b 0a 09 20 20 20 20 73 65 74 20 6f 6b 20 30 {.. set ok 0
76e0: 0a 09 20 20 20 20 74 72 6f 75 62 6c 65 20 66 61 .. trouble fa
76f0: 74 61 6c 20 22 3c 24 70 6e 61 6d 65 20 74 61 67 tal "<$pname tag
7700: 20 27 24 73 6e 61 6d 65 27 3e 20 24 6c 61 62 65 '$sname'> $labe
7710: 6c 22 0a 09 7d 0a 09 6c 6f 67 20 77 72 69 74 65 l"..}..log write
7720: 20 35 20 69 6e 74 65 67 72 69 74 79 20 7b 5c 5b 5 integrity {\[
7730: 5b 66 6f 72 6d 61 74 20 25 30 32 64 20 5b 69 6e [format %02d [in
7740: 63 72 20 6e 5d 5d 5c 5d 20 5b 65 78 70 72 20 7b cr n]]\] [expr {
7750: 24 6f 6b 20 3f 20 22 4f 6b 20 20 20 20 22 20 3a $ok ? "Ok " :
7760: 20 22 46 61 69 6c 65 64 22 7d 5d 20 2e 2e 2e 20 "Failed"}] ...
7770: 24 68 65 61 64 65 72 7d 0a 09 72 65 74 75 72 6e $header}..return
7780: 0a 20 20 20 20 7d 0a 0a 20 20 20 20 70 72 6f 63 . }.. proc
7790: 20 43 68 65 63 6b 42 72 61 6e 63 68 20 7b 68 65 CheckBranch {he
77a0: 61 64 65 72 20 6c 61 62 65 6c 20 73 71 6c 7d 20 ader label sql}
77b0: 7b 0a 09 75 70 76 61 72 20 31 20 6e 20 6e 0a 09 {..upvar 1 n n..
77c0: 73 65 74 20 6f 6b 20 31 0a 09 66 6f 72 65 61 63 set ok 1..foreac
77d0: 68 20 7b 70 6e 61 6d 65 20 73 6e 61 6d 65 7d 20 h {pname sname}
77e0: 5b 73 74 61 74 65 20 72 75 6e 20 24 73 71 6c 5d [state run $sql]
77f0: 20 7b 0a 09 20 20 20 20 73 65 74 20 6f 6b 20 30 {.. set ok 0
7800: 0a 09 20 20 20 20 74 72 6f 75 62 6c 65 20 66 61 .. trouble fa
7810: 74 61 6c 20 22 3c 24 70 6e 61 6d 65 20 62 72 61 tal "<$pname bra
7820: 6e 63 68 20 27 24 73 6e 61 6d 65 27 3e 20 24 6c nch '$sname'> $l
7830: 61 62 65 6c 22 0a 09 7d 0a 09 6c 6f 67 20 77 72 abel"..}..log wr
7840: 69 74 65 20 35 20 69 6e 74 65 67 72 69 74 79 20 ite 5 integrity
7850: 7b 5c 5b 5b 66 6f 72 6d 61 74 20 25 30 32 64 20 {\[[format %02d
7860: 5b 69 6e 63 72 20 6e 5d 5d 5c 5d 20 5b 65 78 70 [incr n]]\] [exp
7870: 72 20 7b 24 6f 6b 20 3f 20 22 4f 6b 20 20 20 20 r {$ok ? "Ok
7880: 22 20 3a 20 22 46 61 69 6c 65 64 22 7d 5d 20 2e " : "Failed"}] .
7890: 2e 2e 20 24 68 65 61 64 65 72 7d 0a 09 72 65 74 .. $header}..ret
78a0: 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 70 urn. }.. p
78b0: 72 6f 63 20 43 68 65 63 6b 43 53 20 7b 68 65 61 roc CheckCS {hea
78c0: 64 65 72 20 6c 61 62 65 6c 20 73 71 6c 7d 20 7b der label sql} {
78d0: 0a 09 75 70 76 61 72 20 31 20 6e 20 6e 0a 09 73 ..upvar 1 n n..s
78e0: 65 74 20 6f 6b 20 31 0a 09 66 6f 72 65 61 63 68 et ok 1..foreach
78f0: 20 7b 63 74 79 70 65 20 63 69 64 7d 20 5b 73 74 {ctype cid} [st
7900: 61 74 65 20 72 75 6e 20 24 73 71 6c 5d 20 7b 0a ate run $sql] {.
7910: 09 20 20 20 20 73 65 74 20 6f 6b 20 30 0a 09 20 . set ok 0..
7920: 20 20 20 74 72 6f 75 62 6c 65 20 66 61 74 61 6c trouble fatal
7930: 20 22 3c 24 63 74 79 70 65 20 24 63 69 64 3e 20 "<$ctype $cid>
7940: 24 6c 61 62 65 6c 22 0a 09 7d 0a 09 6c 6f 67 20 $label"..}..log
7950: 77 72 69 74 65 20 35 20 69 6e 74 65 67 72 69 74 write 5 integrit
7960: 79 20 7b 5c 5b 5b 66 6f 72 6d 61 74 20 25 30 32 y {\[[format %02
7970: 64 20 5b 69 6e 63 72 20 6e 5d 5d 5c 5d 20 5b 65 d [incr n]]\] [e
7980: 78 70 72 20 7b 24 6f 6b 20 3f 20 22 4f 6b 20 20 xpr {$ok ? "Ok
7990: 20 20 22 20 3a 20 22 46 61 69 6c 65 64 22 7d 5d " : "Failed"}]
79a0: 20 2e 2e 2e 20 24 68 65 61 64 65 72 7d 0a 09 72 ... $header}..r
79b0: 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 eturn. }..
79c0: 20 70 72 6f 63 20 43 68 65 63 6b 52 65 76 43 53 proc CheckRevCS
79d0: 20 7b 68 65 61 64 65 72 20 6c 61 62 65 6c 20 73 {header label s
79e0: 71 6c 7d 20 7b 0a 09 75 70 76 61 72 20 31 20 6e ql} {..upvar 1 n
79f0: 20 6e 0a 09 73 65 74 20 6f 6b 20 31 0a 09 66 6f n..set ok 1..fo
7a00: 72 65 61 63 68 20 7b 63 73 74 79 70 65 20 63 73 reach {cstype cs
7a10: 69 64 20 66 6e 61 6d 65 20 72 65 76 6e 72 7d 20 id fname revnr}
7a20: 5b 73 74 61 74 65 20 72 75 6e 20 24 73 71 6c 5d [state run $sql]
7a30: 20 7b 0a 09 20 20 20 20 73 65 74 20 6f 6b 20 30 {.. set ok 0
7a40: 0a 09 20 20 20 20 73 65 74 20 62 20 22 3c 24 63 .. set b "<$c
7a50: 73 74 79 70 65 20 24 63 73 69 64 3e 22 0a 09 20 stype $csid>"..
7a60: 20 20 20 74 72 6f 75 62 6c 65 20 66 61 74 61 6c trouble fatal
7a70: 20 22 24 66 6e 61 6d 65 20 3c 24 72 65 76 6e 72 "$fname <$revnr
7a80: 3e 20 5b 73 74 72 69 6e 67 20 6d 61 70 20 5b 6c > [string map [l
7a90: 69 73 74 20 40 20 24 62 5d 20 24 6c 61 62 65 6c ist @ $b] $label
7aa0: 5d 22 0a 09 7d 0a 09 6c 6f 67 20 77 72 69 74 65 ]"..}..log write
7ab0: 20 35 20 69 6e 74 65 67 72 69 74 79 20 7b 5c 5b 5 integrity {\[
7ac0: 5b 66 6f 72 6d 61 74 20 25 30 32 64 20 5b 69 6e [format %02d [in
7ad0: 63 72 20 6e 5d 5d 5c 5d 20 5b 65 78 70 72 20 7b cr n]]\] [expr {
7ae0: 24 6f 6b 20 3f 20 22 4f 6b 20 20 20 20 22 20 3a $ok ? "Ok " :
7af0: 20 22 46 61 69 6c 65 64 22 7d 5d 20 2e 2e 2e 20 "Failed"}] ...
7b00: 24 68 65 61 64 65 72 7d 0a 09 72 65 74 75 72 6e $header}..return
7b10: 0a 20 20 20 20 7d 0a 0a 20 20 20 20 23 20 23 20 . }.. # #
7b20: 23 23 20 23 23 23 20 23 23 23 23 23 20 23 23 23 ## ### ##### ###
7b30: 23 23 23 23 23 20 23 23 23 23 23 23 23 23 23 23 ##### ##########
7b40: 23 23 23 0a 20 20 20 20 23 23 20 43 6f 6e 66 69 ###. ## Confi
7b50: 67 75 72 61 74 69 6f 6e 0a 0a 20 20 20 20 70 72 guration.. pr
7b60: 61 67 6d 61 20 2d 68 61 73 69 6e 73 74 61 6e 63 agma -hasinstanc
7b70: 65 73 20 20 20 6e 6f 20 3b 20 23 20 73 69 6e 67 es no ; # sing
7b80: 6c 65 74 6f 6e 0a 20 20 20 20 70 72 61 67 6d 61 leton. pragma
7b90: 20 2d 68 61 73 74 79 70 65 69 6e 66 6f 20 20 20 -hastypeinfo
7ba0: 20 6e 6f 20 3b 20 23 20 6e 6f 20 69 6e 74 72 6f no ; # no intro
7bb0: 73 70 65 63 74 69 6f 6e 0a 20 20 20 20 70 72 61 spection. pra
7bc0: 67 6d 61 20 2d 68 61 73 74 79 70 65 64 65 73 74 gma -hastypedest
7bd0: 72 6f 79 20 6e 6f 20 3b 20 23 20 69 6d 6d 6f 72 roy no ; # immor
7be0: 74 61 6c 0a 0a 20 20 20 20 23 20 23 20 23 23 20 tal.. # # ##
7bf0: 23 23 23 20 23 23 23 23 23 20 23 23 23 23 23 23 ### ##### ######
7c00: 23 23 20 23 23 23 23 23 23 23 23 23 23 23 23 23 ## #############
7c10: 0a 7d 0a 0a 6e 61 6d 65 73 70 61 63 65 20 65 76 .}..namespace ev
7c20: 61 6c 20 3a 3a 76 63 3a 3a 66 6f 73 73 69 6c 3a al ::vc::fossil:
7c30: 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 20 7b 0a 20 :import::cvs {.
7c40: 20 20 20 6e 61 6d 65 73 70 61 63 65 20 65 78 70 namespace exp
7c50: 6f 72 74 20 69 6e 74 65 67 72 69 74 79 0a 20 20 ort integrity.
7c60: 20 20 6e 61 6d 65 73 70 61 63 65 20 65 76 61 6c namespace eval
7c70: 20 69 6e 74 65 67 72 69 74 79 20 7b 0a 09 6e 61 integrity {..na
7c80: 6d 65 73 70 61 63 65 20 69 6d 70 6f 72 74 20 3a mespace import :
7c90: 3a 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 :vc::fossil::imp
7ca0: 6f 72 74 3a 3a 63 76 73 3a 3a 73 74 61 74 65 0a ort::cvs::state.
7cb0: 09 6e 61 6d 65 73 70 61 63 65 20 69 6d 70 6f 72 .namespace impor
7cc0: 74 20 3a 3a 76 63 3a 3a 74 6f 6f 6c 73 3a 3a 74 t ::vc::tools::t
7cd0: 72 6f 75 62 6c 65 0a 09 6e 61 6d 65 73 70 61 63 rouble..namespac
7ce0: 65 20 69 6d 70 6f 72 74 20 3a 3a 76 63 3a 3a 74 e import ::vc::t
7cf0: 6f 6f 6c 73 3a 3a 6c 6f 67 0a 09 6c 6f 67 20 72 ools::log..log r
7d00: 65 67 69 73 74 65 72 20 69 6e 74 65 67 72 69 74 egister integrit
7d10: 79 0a 20 20 20 20 7d 0a 7d 0a 0a 23 20 23 20 23 y. }.}..# # #
7d20: 23 20 23 23 23 20 23 23 23 23 23 20 23 23 23 23 # ### ##### ####
7d30: 23 23 23 23 20 23 23 23 23 23 23 23 23 23 23 23 #### ###########
7d40: 23 23 20 23 23 23 23 23 23 23 23 23 23 23 23 23 ## #############
7d50: 23 23 23 23 23 23 23 23 0a 23 23 20 52 65 61 64 ########.## Read
7d60: 79 0a 0a 70 61 63 6b 61 67 65 20 70 72 6f 76 69 y..package provi
7d70: 64 65 20 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 de vc::fossil::i
7d80: 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 69 6e 74 65 mport::cvs::inte
7d90: 67 72 69 74 79 20 31 2e 30 0a 72 65 74 75 72 6e grity 1.0.return
7da0: 0a .