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 63 73 65 changesets {cse
06b0: 74 73 7d 20 7b 0a 09 6c 6f 67 20 77 72 69 74 65 ts} {..log write
06c0: 20 34 20 69 6e 74 65 67 72 69 74 79 20 7b 43 68 4 integrity {Ch
06d0: 65 63 6b 20 64 61 74 61 62 61 73 65 20 63 6f 6e eck database con
06e0: 73 69 73 74 65 6e 63 79 7d 0a 0a 09 73 65 74 20 sistency}...set
06f0: 6e 20 30 0a 09 52 65 76 69 73 69 6f 6e 43 68 61 n 0..RevisionCha
0700: 6e 67 65 73 65 74 73 0a 09 54 61 67 43 68 61 6e ngesets..TagChan
0710: 67 65 73 65 74 73 0a 09 42 72 61 6e 63 68 43 68 gesets..BranchCh
0720: 61 6e 67 65 73 65 74 73 0a 09 74 72 6f 75 62 6c angesets..troubl
0730: 65 20 61 62 6f 72 74 3f 20 3b 20 23 20 41 76 6f e abort? ; # Avo
0740: 69 64 20 65 78 70 65 6e 73 69 76 65 20 63 68 65 id expensive che
0750: 63 6b 20 69 66 20 61 6e 79 74 68 69 6e 67 20 66 ck if anything f
0760: 6f 75 6e 64 20 62 65 66 6f 72 65 0a 0a 09 4c 6f ound before...Lo
0770: 6f 70 43 68 65 63 6b 20 24 63 73 65 74 73 0a 09 opCheck $csets..
0780: 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 return. }..
0790: 20 20 74 79 70 65 6d 65 74 68 6f 64 20 6c 6f 6f typemethod loo
07a0: 70 63 68 65 63 6b 6f 6e 20 7b 7d 20 7b 0a 09 73 pcheckon {} {..s
07b0: 65 74 20 6d 79 6c 6f 6f 70 63 68 65 63 6b 20 31 et myloopcheck 1
07c0: 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a ..return. }..
07d0: 20 20 20 20 23 20 23 20 23 23 20 23 23 23 20 23 # # ## ### #
07e0: 23 23 23 23 20 23 23 23 23 23 23 23 23 20 23 23 #### ######## ##
07f0: 23 23 23 23 23 23 23 23 23 23 23 0a 20 20 20 20 ###########.
0800: 23 23 20 49 6e 74 65 72 6e 61 6c 20 6d 65 74 68 ## Internal meth
0810: 6f 64 73 0a 0a 20 20 20 20 70 72 6f 63 20 41 6c ods.. proc Al
0820: 6c 42 75 74 4d 65 74 61 20 7b 7d 20 7b 0a 09 23 lButMeta {} {..#
0830: 20 54 68 69 73 20 63 6f 64 65 20 70 65 72 66 6f This code perfo
0840: 72 6d 73 20 61 20 6e 75 6d 62 65 72 20 6f 66 20 rms a number of
0850: 70 61 72 61 6e 6f 69 64 20 63 68 65 63 6b 73 20 paranoid checks
0860: 6f 66 20 74 68 65 0a 09 23 20 64 61 74 61 62 61 of the..# databa
0870: 73 65 2c 20 73 65 61 72 63 68 69 6e 67 20 66 6f se, searching fo
0880: 72 20 69 6e 63 6f 6e 73 69 73 74 65 6e 74 20 63 r inconsistent c
0890: 72 6f 73 73 2d 72 65 66 65 72 65 6e 63 65 73 2e ross-references.
08a0: 0a 0a 09 75 70 76 61 72 20 31 20 6e 20 6e 20 3b ...upvar 1 n n ;
08b0: 20 23 20 43 6f 75 6e 74 65 72 20 66 6f 72 20 74 # Counter for t
08c0: 68 65 20 63 68 65 63 6b 73 20 28 77 65 20 70 72 he checks (we pr
08d0: 69 6e 74 20 61 6e 20 69 64 20 62 65 66 6f 72 65 int an id before
08e0: 0a 09 09 20 20 20 20 20 20 23 20 74 68 65 20 6d ... # the m
08f0: 61 69 6e 20 6c 61 62 65 6c 29 2e 0a 0a 09 23 20 ain label)....#
0900: 46 69 6e 64 20 61 6c 6c 20 72 65 76 69 73 69 6f Find all revisio
0910: 6e 73 20 77 68 69 63 68 20 64 69 73 61 67 72 65 ns which disagre
0920: 65 20 77 69 74 68 20 74 68 65 69 72 20 6c 69 6e e with their lin
0930: 65 20 6f 66 0a 09 23 20 64 65 76 65 6c 6f 70 6d e of..# developm
0940: 65 6e 74 20 61 62 6f 75 74 20 74 68 65 20 70 72 ent about the pr
0950: 6f 6a 65 63 74 20 74 68 65 79 20 61 72 65 20 6f oject they are o
0960: 77 6e 65 64 20 62 79 2e 0a 09 43 68 65 63 6b 52 wned by...CheckR
0970: 65 76 20 5c 0a 09 20 20 20 20 7b 52 65 76 69 73 ev \.. {Revis
0980: 69 6f 6e 73 20 61 6e 64 20 74 68 65 69 72 20 4c ions and their L
0990: 4f 44 73 20 68 61 76 65 20 74 6f 20 62 65 20 69 ODs have to be i
09a0: 6e 20 74 68 65 20 73 61 6d 65 20 70 72 6f 6a 65 n the same proje
09b0: 63 74 7d 20 5c 0a 09 20 20 20 20 7b 64 69 73 61 ct} \.. {disa
09c0: 67 72 65 65 73 20 77 69 74 68 20 69 74 73 20 4c grees with its L
09d0: 4f 44 20 61 62 6f 75 74 20 6f 77 6e 69 6e 67 20 OD about owning
09e0: 70 72 6f 6a 65 63 74 7d 20 7b 0a 09 09 53 45 4c project} {...SEL
09f0: 45 43 54 20 46 2e 6e 61 6d 65 2c 20 52 2e 72 65 ECT F.name, R.re
0a00: 76 0a 09 09 46 52 4f 4d 20 72 65 76 69 73 69 6f v...FROM revisio
0a10: 6e 20 52 2c 20 66 69 6c 65 20 46 2c 20 73 79 6d n R, file F, sym
0a20: 62 6f 6c 20 53 0a 09 09 57 48 45 52 45 20 52 2e bol S...WHERE R.
0a30: 66 69 64 20 3d 20 46 2e 66 69 64 0a 09 09 41 4e fid = F.fid...AN
0a40: 44 20 20 20 52 2e 6c 6f 64 20 3d 20 53 2e 73 69 D R.lod = S.si
0a50: 64 0a 09 09 41 4e 44 20 20 20 46 2e 70 69 64 20 d...AND F.pid
0a60: 21 3d 20 53 2e 70 69 64 0a 09 09 3b 0a 09 20 20 != S.pid...;..
0a70: 20 20 7d 0a 09 23 20 46 69 6e 64 20 61 6c 6c 20 }..# Find all
0a80: 72 65 76 69 73 69 6f 6e 73 20 77 68 69 63 68 20 revisions which
0a90: 64 69 73 67 72 65 65 20 77 69 74 68 20 74 68 65 disgree with the
0aa0: 69 72 20 6d 65 74 61 20 64 61 74 61 20 61 62 6f ir meta data abo
0ab0: 75 74 0a 09 23 20 74 68 65 20 70 72 6f 6a 65 63 ut..# the projec
0ac0: 74 20 74 68 65 79 20 61 72 65 20 6f 77 6e 65 64 t they are owned
0ad0: 20 62 79 2e 0a 09 43 68 65 63 6b 52 65 76 20 5c by...CheckRev \
0ae0: 0a 09 20 20 20 20 7b 52 65 76 69 73 69 6f 6e 73 .. {Revisions
0af0: 20 61 6e 64 20 74 68 65 69 72 20 6d 65 74 61 20 and their meta
0b00: 64 61 74 61 20 68 61 76 65 20 74 6f 20 62 65 20 data have to be
0b10: 69 6e 20 74 68 65 20 73 61 6d 65 20 70 72 6f 6a in the same proj
0b20: 65 63 74 7d 20 5c 0a 09 20 20 20 20 7b 64 69 73 ect} \.. {dis
0b30: 61 67 72 65 65 73 20 77 69 74 68 20 69 74 73 20 agrees with its
0b40: 6d 65 74 61 20 64 61 74 61 20 61 62 6f 75 74 20 meta data about
0b50: 6f 77 6e 69 6e 67 20 70 72 6f 6a 65 63 74 7d 20 owning project}
0b60: 7b 0a 09 09 53 45 4c 45 43 54 20 46 2e 6e 61 6d {...SELECT F.nam
0b70: 65 2c 20 52 2e 72 65 76 0a 09 09 46 52 4f 4d 20 e, R.rev...FROM
0b80: 72 65 76 69 73 69 6f 6e 20 52 2c 20 66 69 6c 65 revision R, file
0b90: 20 46 2c 20 6d 65 74 61 20 4d 0a 09 09 57 48 45 F, meta M...WHE
0ba0: 52 45 20 52 2e 66 69 64 20 3d 20 46 2e 66 69 64 RE R.fid = F.fid
0bb0: 0a 09 09 41 4e 44 20 20 20 52 2e 6d 69 64 20 3d ...AND R.mid =
0bc0: 20 4d 2e 6d 69 64 0a 09 09 41 4e 44 20 20 20 46 M.mid...AND F
0bd0: 2e 70 69 64 20 21 3d 20 4d 2e 70 69 64 0a 09 09 .pid != M.pid...
0be0: 3b 0a 09 20 20 20 20 7d 0a 09 23 20 46 69 6e 64 ;.. }..# Find
0bf0: 20 61 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 77 all revisions w
0c00: 69 74 68 20 61 20 70 72 69 6d 61 72 79 20 63 68 ith a primary ch
0c10: 69 6c 64 20 77 68 69 63 68 20 64 69 73 61 67 72 ild which disagr
0c20: 65 65 73 0a 09 23 20 61 62 6f 75 74 20 74 68 65 ees..# about the
0c30: 20 66 69 6c 65 20 74 68 65 79 20 62 65 6c 6f 6e file they belon
0c40: 67 20 74 6f 2e 0a 09 43 68 65 63 6b 52 65 76 20 g to...CheckRev
0c50: 5c 0a 09 20 20 20 20 7b 52 65 76 69 73 69 6f 6e \.. {Revision
0c60: 73 20 61 6e 64 20 74 68 65 69 72 20 70 72 69 6d s and their prim
0c70: 61 72 79 20 63 68 69 6c 64 72 65 6e 20 68 61 76 ary children hav
0c80: 65 20 74 6f 20 62 65 20 69 6e 20 74 68 65 20 73 e to be in the s
0c90: 61 6d 65 20 66 69 6c 65 7d 20 5c 0a 09 20 20 20 ame file} \..
0ca0: 20 7b 64 69 73 61 67 72 65 65 73 20 77 69 74 68 {disagrees with
0cb0: 20 69 74 73 20 70 72 69 6d 61 72 79 20 63 68 69 its primary chi
0cc0: 6c 64 20 61 62 6f 75 74 20 74 68 65 20 6f 77 6e ld about the own
0cd0: 69 6e 67 20 66 69 6c 65 7d 20 7b 0a 09 09 53 45 ing file} {...SE
0ce0: 4c 45 43 54 20 46 2e 6e 61 6d 65 2c 20 52 2e 72 LECT F.name, R.r
0cf0: 65 76 0a 09 09 46 52 4f 4d 20 72 65 76 69 73 69 ev...FROM revisi
0d00: 6f 6e 20 52 2c 20 72 65 76 69 73 69 6f 6e 20 43 on R, revision C
0d10: 2c 20 66 69 6c 65 20 46 0a 09 09 57 48 45 52 45 , file F...WHERE
0d20: 20 52 2e 66 69 64 20 3d 20 46 2e 66 69 64 0a 09 R.fid = F.fid..
0d30: 09 41 4e 44 20 20 20 52 2e 63 68 69 6c 64 20 49 .AND R.child I
0d40: 53 20 4e 4f 54 20 4e 55 4c 4c 0a 09 09 41 4e 44 S NOT NULL...AND
0d50: 20 20 20 52 2e 63 68 69 6c 64 20 3d 20 43 2e 72 R.child = C.r
0d60: 69 64 0a 09 09 41 4e 44 20 20 20 43 2e 66 69 64 id...AND C.fid
0d70: 20 21 3d 20 52 2e 66 69 64 0a 09 09 3b 0a 09 20 != R.fid...;..
0d80: 20 20 20 7d 0a 0a 09 23 20 46 69 6e 64 20 61 6c }...# Find al
0d90: 6c 20 72 65 76 69 73 69 6f 6e 73 20 77 69 74 68 l revisions with
0da0: 20 61 20 62 72 61 6e 63 68 20 70 61 72 65 6e 74 a branch parent
0db0: 20 73 79 6d 62 6f 6c 20 77 68 6f 73 65 20 70 61 symbol whose pa
0dc0: 72 65 6e 74 0a 09 23 20 64 69 73 61 67 72 65 65 rent..# disagree
0dd0: 73 20 61 62 6f 75 74 20 74 68 65 20 66 69 6c 65 s about the file
0de0: 20 74 68 65 79 20 62 65 6c 6f 6e 67 20 74 6f 2e they belong to.
0df0: 0a 09 43 68 65 63 6b 52 65 76 20 5c 0a 09 20 20 ..CheckRev \..
0e00: 20 20 7b 52 65 76 69 73 69 6f 6e 73 20 61 6e 64 {Revisions and
0e10: 20 74 68 65 69 72 20 62 72 61 6e 63 68 20 63 68 their branch ch
0e20: 69 6c 64 72 65 6e 20 68 61 76 65 20 74 6f 20 62 ildren have to b
0e30: 65 20 69 6e 20 74 68 65 20 73 61 6d 65 20 66 69 e in the same fi
0e40: 6c 65 7d 20 5c 0a 09 20 20 20 20 7b 61 74 20 74 le} \.. {at t
0e50: 68 65 20 62 65 67 69 6e 6e 69 6e 67 20 6f 66 20 he beginning of
0e60: 69 74 73 20 62 72 61 6e 63 68 20 61 6e 64 20 69 its branch and i
0e70: 74 73 20 70 61 72 65 6e 74 20 64 69 73 61 67 72 ts parent disagr
0e80: 65 65 20 61 62 6f 75 74 20 74 68 65 20 6f 77 6e ee about the own
0e90: 69 6e 67 20 66 69 6c 65 7d 20 7b 0a 09 09 53 45 ing file} {...SE
0ea0: 4c 45 43 54 20 46 2e 6e 61 6d 65 2c 20 52 2e 72 LECT F.name, R.r
0eb0: 65 76 0a 09 09 46 52 4f 4d 20 72 65 76 69 73 69 ev...FROM revisi
0ec0: 6f 6e 20 52 2c 20 72 65 76 69 73 69 6f 6e 20 50 on R, revision P
0ed0: 2c 20 66 69 6c 65 20 46 0a 09 09 57 48 45 52 45 , file F...WHERE
0ee0: 20 52 2e 66 69 64 20 3d 20 46 2e 66 69 64 0a 09 R.fid = F.fid..
0ef0: 09 41 4e 44 20 20 20 52 2e 62 70 61 72 65 6e 74 .AND R.bparent
0f00: 20 49 53 20 4e 4f 54 20 4e 55 4c 4c 0a 09 09 41 IS NOT NULL...A
0f10: 4e 44 20 20 20 52 2e 70 61 72 65 6e 74 20 3d 20 ND R.parent =
0f20: 50 2e 72 69 64 0a 09 09 41 4e 44 20 20 20 52 2e P.rid...AND R.
0f30: 66 69 64 20 21 3d 20 50 2e 66 69 64 0a 09 09 3b fid != P.fid...;
0f40: 0a 09 20 20 20 20 7d 0a 09 23 20 46 69 6e 64 20 .. }..# Find
0f50: 61 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 77 69 all revisions wi
0f60: 74 68 20 61 20 6e 6f 6e 2d 4e 54 44 42 20 63 68 th a non-NTDB ch
0f70: 69 6c 64 20 77 68 69 63 68 20 64 69 73 61 67 72 ild which disagr
0f80: 65 65 73 0a 09 23 20 61 62 6f 75 74 20 74 68 65 ees..# about the
0f90: 20 66 69 6c 65 20 74 68 65 79 20 62 65 6c 6f 6e file they belon
0fa0: 67 20 74 6f 2e 0a 09 43 68 65 63 6b 52 65 76 20 g to...CheckRev
0fb0: 5c 0a 09 20 20 20 20 7b 52 65 76 69 73 69 6f 6e \.. {Revision
0fc0: 73 20 61 6e 64 20 74 68 65 69 72 20 6e 6f 6e 2d s and their non-
0fd0: 4e 54 44 42 20 63 68 69 6c 64 72 65 6e 20 68 61 NTDB children ha
0fe0: 76 65 20 74 6f 20 62 65 20 69 6e 20 74 68 65 20 ve to be in the
0ff0: 73 61 6d 65 20 66 69 6c 65 7d 20 5c 0a 09 20 20 same file} \..
1000: 20 20 7b 64 69 73 61 67 72 65 65 73 20 77 69 74 {disagrees wit
1010: 68 20 69 74 73 20 6e 6f 6e 2d 4e 54 44 42 20 63 h its non-NTDB c
1020: 68 69 6c 64 20 61 62 6f 75 74 20 74 68 65 20 6f hild about the o
1030: 77 6e 69 6e 67 20 66 69 6c 65 7d 20 7b 0a 09 09 wning file} {...
1040: 53 45 4c 45 43 54 20 46 2e 6e 61 6d 65 2c 20 52 SELECT F.name, R
1050: 2e 72 65 76 0a 09 09 46 52 4f 4d 20 72 65 76 69 .rev...FROM revi
1060: 73 69 6f 6e 20 52 2c 20 72 65 76 69 73 69 6f 6e sion R, revision
1070: 20 43 2c 20 66 69 6c 65 20 46 0a 09 09 57 48 45 C, file F...WHE
1080: 52 45 20 52 2e 66 69 64 20 3d 20 46 2e 66 69 64 RE R.fid = F.fid
1090: 0a 09 09 41 4e 44 20 20 20 52 2e 64 62 63 68 69 ...AND R.dbchi
10a0: 6c 64 20 49 53 20 4e 4f 54 20 4e 55 4c 4c 0a 09 ld IS NOT NULL..
10b0: 09 41 4e 44 20 20 20 52 2e 64 62 63 68 69 6c 64 .AND R.dbchild
10c0: 20 3d 20 43 2e 72 69 64 0a 09 09 41 4e 44 20 20 = C.rid...AND
10d0: 20 43 2e 66 69 64 20 21 3d 20 52 2e 66 69 64 0a C.fid != R.fid.
10e0: 09 09 3b 0a 09 20 20 20 20 7d 0a 09 23 20 46 69 ..;.. }..# Fi
10f0: 6e 64 20 61 6c 6c 20 72 65 76 69 73 69 6f 6e 73 nd all revisions
1100: 20 77 68 69 63 68 20 68 61 76 65 20 61 20 70 72 which have a pr
1110: 69 6d 61 72 79 20 63 68 69 6c 64 2c 20 62 75 74 imary child, but
1120: 20 74 68 65 20 63 68 69 6c 64 0a 09 23 20 64 6f the child..# do
1130: 65 73 20 6e 6f 74 20 68 61 76 65 20 74 68 65 6d es not have them
1140: 20 61 73 20 70 61 72 65 6e 74 2e 0a 09 43 68 65 as parent...Che
1150: 63 6b 52 65 76 20 5c 0a 09 20 20 20 20 7b 52 65 ckRev \.. {Re
1160: 76 69 73 69 6f 6e 73 20 68 61 76 65 20 74 6f 20 visions have to
1170: 62 65 20 70 61 72 65 6e 74 73 20 6f 66 20 74 68 be parents of th
1180: 65 69 72 20 70 72 69 6d 61 72 79 20 63 68 69 6c eir primary chil
1190: 64 72 65 6e 7d 20 5c 0a 09 20 20 20 20 7b 69 73 dren} \.. {is
11a0: 20 6e 6f 74 20 74 68 65 20 70 61 72 65 6e 74 20 not the parent
11b0: 6f 66 20 69 74 73 20 70 72 69 6d 61 72 79 20 63 of its primary c
11c0: 68 69 6c 64 7d 20 7b 0a 09 09 53 45 4c 45 43 54 hild} {...SELECT
11d0: 20 46 2e 6e 61 6d 65 2c 20 52 2e 72 65 76 0a 09 F.name, R.rev..
11e0: 09 46 52 4f 4d 20 72 65 76 69 73 69 6f 6e 20 52 .FROM revision R
11f0: 2c 20 72 65 76 69 73 69 6f 6e 20 43 2c 20 66 69 , revision C, fi
1200: 6c 65 20 46 0a 09 09 57 48 45 52 45 20 52 2e 66 le F...WHERE R.f
1210: 69 64 20 3d 20 46 2e 66 69 64 0a 09 09 41 4e 44 id = F.fid...AND
1220: 20 20 20 52 2e 63 68 69 6c 64 20 49 53 20 4e 4f R.child IS NO
1230: 54 20 4e 55 4c 4c 0a 09 09 41 4e 44 20 20 20 52 T NULL...AND R
1240: 2e 63 68 69 6c 64 20 3d 20 43 2e 72 69 64 0a 09 .child = C.rid..
1250: 09 41 4e 44 20 20 20 43 2e 70 61 72 65 6e 74 20 .AND C.parent
1260: 21 3d 20 52 2e 72 69 64 0a 09 09 3b 0a 09 20 20 != R.rid...;..
1270: 20 20 7d 0a 09 23 20 46 69 6e 64 20 61 6c 6c 20 }..# Find all
1280: 72 65 76 69 73 69 6f 6e 73 20 77 68 69 63 68 20 revisions which
1290: 68 61 76 65 20 61 20 70 72 69 6d 72 61 72 79 20 have a primrary
12a0: 63 68 69 6c 64 2c 20 62 75 74 20 74 68 65 0a 09 child, but the..
12b0: 23 20 63 68 69 6c 64 20 68 61 73 20 61 20 62 72 # child has a br
12c0: 61 6e 63 68 20 70 61 72 65 6e 74 20 73 79 6d 62 anch parent symb
12d0: 6f 6c 20 6d 61 6b 69 6e 67 20 74 68 65 6d 20 62 ol making them b
12e0: 72 61 63 68 20 73 74 61 72 74 65 72 73 2e 0a 09 rach starters...
12f0: 43 68 65 63 6b 52 65 76 20 5c 0a 09 20 20 20 20 CheckRev \..
1300: 7b 50 72 69 6d 61 72 79 20 63 68 69 6c 64 72 65 {Primary childre
1310: 6e 20 6f 66 20 72 65 76 69 73 69 6f 6e 73 20 6d n of revisions m
1320: 75 73 74 20 6e 6f 74 20 73 74 61 72 74 20 62 72 ust not start br
1330: 61 6e 63 68 65 73 7d 20 5c 0a 09 20 20 20 20 7b anches} \.. {
1340: 69 73 20 70 61 72 65 6e 74 20 6f 66 20 61 20 70 is parent of a p
1350: 72 69 6d 61 72 79 20 63 68 69 6c 64 20 77 68 69 rimary child whi
1360: 63 68 20 69 73 20 74 68 65 20 62 65 67 69 6e 6e ch is the beginn
1370: 69 6e 67 20 6f 66 20 61 20 62 72 61 6e 63 68 7d ing of a branch}
1380: 20 7b 0a 09 09 53 45 4c 45 43 54 20 46 2e 6e 61 {...SELECT F.na
1390: 6d 65 2c 20 52 2e 72 65 76 0a 09 09 46 52 4f 4d me, R.rev...FROM
13a0: 20 72 65 76 69 73 69 6f 6e 20 52 2c 20 72 65 76 revision R, rev
13b0: 69 73 69 6f 6e 20 43 2c 20 66 69 6c 65 20 46 0a ision C, file F.
13c0: 09 09 57 48 45 52 45 20 52 2e 66 69 64 20 3d 20 ..WHERE R.fid =
13d0: 46 2e 66 69 64 0a 09 09 41 4e 44 20 20 20 52 2e F.fid...AND R.
13e0: 63 68 69 6c 64 20 49 53 20 4e 4f 54 20 4e 55 4c child IS NOT NUL
13f0: 4c 0a 09 09 41 4e 44 20 20 20 52 2e 63 68 69 6c L...AND R.chil
1400: 64 20 3d 20 43 2e 72 69 64 0a 09 09 41 4e 44 20 d = C.rid...AND
1410: 20 20 43 2e 62 70 61 72 65 6e 74 20 49 53 20 4e C.bparent IS N
1420: 4f 54 20 4e 55 4c 4c 0a 09 09 3b 0a 09 20 20 20 OT NULL...;..
1430: 20 7d 0a 09 23 20 46 69 6e 64 20 61 6c 6c 20 72 }..# Find all r
1440: 65 76 69 73 69 6f 6e 73 20 77 69 74 68 6f 75 74 evisions without
1450: 20 62 72 61 6e 63 68 20 70 61 72 65 6e 74 20 73 branch parent s
1460: 79 6d 62 6f 6c 20 77 68 69 63 68 20 68 61 76 65 ymbol which have
1470: 20 61 0a 09 23 20 70 61 72 65 6e 74 2c 20 62 75 a..# parent, bu
1480: 74 20 74 68 65 20 70 61 72 65 6e 74 20 64 6f 65 t the parent doe
1490: 73 20 6e 6f 74 20 68 61 76 65 20 74 68 65 6d 20 s not have them
14a0: 61 73 20 70 72 69 6d 61 72 79 20 63 68 69 6c 64 as primary child
14b0: 2e 0a 09 43 68 65 63 6b 52 65 76 20 5c 0a 09 20 ...CheckRev \..
14c0: 20 20 20 7b 52 65 76 69 73 69 6f 6e 73 20 68 61 {Revisions ha
14d0: 76 65 20 74 6f 20 62 65 20 70 72 69 6d 61 72 79 ve to be primary
14e0: 20 63 68 69 6c 64 72 65 6e 20 6f 66 20 74 68 65 children of the
14f0: 69 72 20 70 61 72 65 6e 74 73 2c 20 69 66 20 61 ir parents, if a
1500: 6e 79 7d 20 5c 0a 09 20 20 20 20 7b 69 73 20 6e ny} \.. {is n
1510: 6f 74 20 74 68 65 20 63 68 69 6c 64 20 6f 66 20 ot the child of
1520: 69 74 73 20 70 61 72 65 6e 74 7d 20 7b 0a 09 09 its parent} {...
1530: 53 45 4c 45 43 54 20 46 2e 6e 61 6d 65 2c 20 52 SELECT F.name, R
1540: 2e 72 65 76 0a 09 09 46 52 4f 4d 20 72 65 76 69 .rev...FROM revi
1550: 73 69 6f 6e 20 52 2c 20 72 65 76 69 73 69 6f 6e sion R, revision
1560: 20 50 2c 20 66 69 6c 65 20 46 0a 09 09 57 48 45 P, file F...WHE
1570: 52 45 20 52 2e 66 69 64 20 3d 20 46 2e 66 69 64 RE R.fid = F.fid
1580: 0a 09 09 41 4e 44 20 20 20 52 2e 62 70 61 72 65 ...AND R.bpare
1590: 6e 74 20 49 53 20 4e 55 4c 4c 0a 09 09 41 4e 44 nt IS NULL...AND
15a0: 20 20 20 52 2e 70 61 72 65 6e 74 20 49 53 20 4e R.parent IS N
15b0: 4f 54 20 4e 55 4c 4c 0a 09 09 41 4e 44 20 20 20 OT NULL...AND
15c0: 52 2e 70 61 72 65 6e 74 20 3d 20 50 2e 72 69 64 R.parent = P.rid
15d0: 0a 09 09 41 4e 44 20 20 20 50 2e 63 68 69 6c 64 ...AND P.child
15e0: 20 21 3d 20 52 2e 72 69 64 0a 09 09 3b 0a 09 20 != R.rid...;..
15f0: 20 20 20 7d 0a 09 23 20 46 69 6e 64 20 61 6c 6c }..# Find all
1600: 20 72 65 76 69 73 69 6f 6e 73 20 77 69 74 68 20 revisions with
1610: 61 20 62 72 61 6e 63 68 20 70 61 72 65 6e 74 20 a branch parent
1620: 73 79 6d 62 6f 6c 20 77 68 69 63 68 20 64 6f 20 symbol which do
1630: 6e 6f 74 0a 09 23 20 68 61 76 65 20 61 20 70 61 not..# have a pa
1640: 72 65 6e 74 2e 0a 09 43 68 65 63 6b 52 65 76 20 rent...CheckRev
1650: 5c 0a 09 20 20 20 20 7b 42 72 61 6e 63 68 20 73 \.. {Branch s
1660: 74 61 72 74 69 6e 67 20 72 65 76 69 73 69 6f 6e tarting revision
1670: 73 20 68 61 76 65 20 74 6f 20 68 61 76 65 20 61 s have to have a
1680: 20 70 61 72 65 6e 74 7d 20 5c 0a 09 20 20 20 20 parent} \..
1690: 7b 61 74 20 74 68 65 20 62 65 67 69 6e 6e 69 6e {at the beginnin
16a0: 67 20 6f 66 20 69 74 73 20 62 72 61 6e 63 68 20 g of its branch
16b0: 68 61 73 20 6e 6f 20 70 61 72 65 6e 74 7d 20 7b has no parent} {
16c0: 0a 09 09 53 45 4c 45 43 54 20 46 2e 6e 61 6d 65 ...SELECT F.name
16d0: 2c 20 52 2e 72 65 76 0a 09 09 46 52 4f 4d 20 72 , R.rev...FROM r
16e0: 65 76 69 73 69 6f 6e 20 52 2c 20 66 69 6c 65 20 evision R, file
16f0: 46 0a 09 09 57 48 45 52 45 20 52 2e 66 69 64 20 F...WHERE R.fid
1700: 3d 20 46 2e 66 69 64 0a 09 09 41 4e 44 20 20 20 = F.fid...AND
1710: 52 2e 62 70 61 72 65 6e 74 20 49 53 20 4e 4f 54 R.bparent IS NOT
1720: 20 4e 55 4c 4c 0a 09 09 41 4e 44 20 20 20 52 2e NULL...AND R.
1730: 70 61 72 65 6e 74 20 49 53 20 4e 55 4c 4c 0a 09 parent IS NULL..
1740: 09 3b 0a 09 20 20 20 20 7d 0a 09 23 20 46 69 6e .;.. }..# Fin
1750: 64 20 61 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 d all revisions
1760: 77 69 74 68 20 61 20 62 72 61 6e 63 68 20 70 61 with a branch pa
1770: 72 65 6e 74 20 73 79 6d 62 6f 6c 20 77 68 6f 73 rent symbol whos
1780: 65 20 70 61 72 65 6e 74 0a 09 23 20 68 61 73 20 e parent..# has
1790: 74 68 65 6d 20 61 73 20 70 72 69 6d 61 72 79 20 them as primary
17a0: 63 68 69 6c 64 2e 0a 09 43 68 65 63 6b 52 65 76 child...CheckRev
17b0: 20 5c 0a 09 20 20 20 20 7b 42 72 61 6e 63 68 20 \.. {Branch
17c0: 73 74 61 72 74 69 6e 67 20 72 65 76 69 73 69 6f starting revisio
17d0: 6e 73 20 6d 75 73 74 20 6e 6f 74 20 62 65 20 70 ns must not be p
17e0: 72 69 6d 61 72 79 20 63 68 69 6c 64 72 65 6e 20 rimary children
17f0: 6f 66 20 74 68 65 69 72 20 70 61 72 65 6e 74 73 of their parents
1800: 7d 20 5c 0a 09 20 20 20 20 7b 61 74 20 74 68 65 } \.. {at the
1810: 20 62 65 67 69 6e 6e 69 6e 67 20 6f 66 20 69 74 beginning of it
1820: 73 20 62 72 61 6e 63 68 20 69 73 20 74 68 65 20 s branch is the
1830: 70 72 69 6d 61 72 79 20 63 68 69 6c 64 20 6f 66 primary child of
1840: 20 69 74 73 20 70 61 72 65 6e 74 7d 20 7b 0a 09 its parent} {..
1850: 09 53 45 4c 45 43 54 20 46 2e 6e 61 6d 65 2c 20 .SELECT F.name,
1860: 52 2e 72 65 76 0a 09 09 46 52 4f 4d 20 72 65 76 R.rev...FROM rev
1870: 69 73 69 6f 6e 20 52 2c 20 72 65 76 69 73 69 6f ision R, revisio
1880: 6e 20 50 2c 20 66 69 6c 65 20 46 0a 09 09 57 48 n P, file F...WH
1890: 45 52 45 20 52 2e 66 69 64 20 3d 20 46 2e 66 69 ERE R.fid = F.fi
18a0: 64 0a 09 09 41 4e 44 20 20 20 52 2e 62 70 61 72 d...AND R.bpar
18b0: 65 6e 74 20 49 53 20 4e 4f 54 20 4e 55 4c 4c 0a ent IS NOT NULL.
18c0: 09 09 41 4e 44 20 20 20 52 2e 70 61 72 65 6e 74 ..AND R.parent
18d0: 20 49 53 20 4e 4f 54 20 4e 55 4c 4c 0a 09 09 41 IS NOT NULL...A
18e0: 4e 44 20 20 20 52 2e 70 61 72 65 6e 74 20 3d 20 ND R.parent =
18f0: 50 2e 72 69 64 0a 09 09 41 4e 44 20 20 20 50 2e P.rid...AND P.
1900: 63 68 69 6c 64 20 3d 20 52 2e 72 69 64 0a 09 09 child = R.rid...
1910: 3b 0a 09 20 20 20 20 7d 0a 09 23 20 46 69 6e 64 ;.. }..# Find
1920: 20 61 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 77 all revisions w
1930: 69 74 68 20 61 20 6e 6f 6e 2d 4e 54 44 42 20 63 ith a non-NTDB c
1940: 68 69 6c 64 20 77 68 69 63 68 20 61 72 65 20 6e hild which are n
1950: 6f 74 20 6f 6e 0a 09 23 20 74 68 65 20 4e 54 44 ot on..# the NTD
1960: 42 2e 0a 09 43 68 65 63 6b 52 65 76 20 5c 0a 09 B...CheckRev \..
1970: 20 20 20 20 7b 4e 54 44 42 20 74 6f 20 74 72 75 {NTDB to tru
1980: 6e 6b 20 74 72 61 6e 73 69 74 69 6f 6e 20 68 61 nk transition ha
1990: 73 20 74 6f 20 62 65 67 69 6e 20 6f 6e 20 4e 54 s to begin on NT
19a0: 44 42 7d 20 5c 0a 09 20 20 20 20 7b 68 61 73 20 DB} \.. {has
19b0: 61 20 6e 6f 6e 2d 4e 54 44 42 20 63 68 69 6c 64 a non-NTDB child
19c0: 2c 20 79 65 74 20 69 73 20 6e 6f 74 20 6f 6e 20 , yet is not on
19d0: 74 68 65 20 4e 54 44 42 7d 20 7b 0a 09 09 53 45 the NTDB} {...SE
19e0: 4c 45 43 54 20 46 2e 6e 61 6d 65 2c 20 52 2e 72 LECT F.name, R.r
19f0: 65 76 0a 09 09 46 52 4f 4d 20 72 65 76 69 73 69 ev...FROM revisi
1a00: 6f 6e 20 52 2c 20 66 69 6c 65 20 46 0a 09 09 57 on R, file F...W
1a10: 48 45 52 45 20 52 2e 66 69 64 20 3d 20 46 2e 66 HERE R.fid = F.f
1a20: 69 64 0a 09 09 41 4e 44 20 20 20 52 2e 64 62 63 id...AND R.dbc
1a30: 68 69 6c 64 20 49 53 20 4e 4f 54 20 4e 55 4c 4c hild IS NOT NULL
1a40: 0a 09 09 41 4e 44 20 20 20 4e 4f 54 20 52 2e 69 ...AND NOT R.i
1a50: 73 64 65 66 61 75 6c 74 0a 09 09 3b 0a 09 20 20 sdefault...;..
1a60: 20 20 7d 0a 09 23 20 46 69 6e 64 20 61 6c 6c 20 }..# Find all
1a70: 72 65 76 69 73 69 6f 6e 73 20 77 69 74 68 20 61 revisions with a
1a80: 20 4e 54 44 42 20 70 61 72 65 6e 74 20 77 68 69 NTDB parent whi
1a90: 63 68 20 61 72 65 20 6f 6e 20 74 68 65 20 4e 54 ch are on the NT
1aa0: 44 42 2e 0a 09 43 68 65 63 6b 52 65 76 20 5c 0a DB...CheckRev \.
1ab0: 09 20 20 20 20 7b 4e 54 44 42 20 74 6f 20 74 72 . {NTDB to tr
1ac0: 75 6e 6b 20 74 72 61 6e 73 69 74 69 6f 6e 20 68 unk transition h
1ad0: 61 73 20 74 6f 20 65 6e 64 20 6f 6e 20 6e 6f 6e as to end on non
1ae0: 2d 4e 54 44 42 7d 20 5c 0a 09 20 20 20 20 7b 68 -NTDB} \.. {h
1af0: 61 73 20 61 20 4e 54 44 42 20 70 61 72 65 6e 74 as a NTDB parent
1b00: 2c 20 79 65 74 20 69 73 20 6f 6e 20 74 68 65 20 , yet is on the
1b10: 4e 54 44 42 7d 20 7b 0a 09 09 53 45 4c 45 43 54 NTDB} {...SELECT
1b20: 20 46 2e 6e 61 6d 65 2c 20 52 2e 72 65 76 0a 09 F.name, R.rev..
1b30: 09 46 52 4f 4d 20 72 65 76 69 73 69 6f 6e 20 52 .FROM revision R
1b40: 2c 20 66 69 6c 65 20 46 0a 09 09 57 48 45 52 45 , file F...WHERE
1b50: 20 52 2e 66 69 64 20 3d 20 46 2e 66 69 64 0a 09 R.fid = F.fid..
1b60: 09 41 4e 44 20 20 20 52 2e 64 62 70 61 72 65 6e .AND R.dbparen
1b70: 74 20 49 53 20 4e 4f 54 20 4e 55 4c 4c 0a 09 09 t IS NOT NULL...
1b80: 41 4e 44 20 20 20 52 2e 69 73 64 65 66 61 75 6c AND R.isdefaul
1b90: 74 0a 09 09 3b 0a 09 20 20 20 20 7d 0a 09 23 20 t...;.. }..#
1ba0: 46 69 6e 64 20 61 6c 6c 20 72 65 76 69 73 69 6f Find all revisio
1bb0: 6e 73 20 77 69 74 68 20 61 20 63 68 69 6c 64 20 ns with a child
1bc0: 77 68 69 63 68 20 64 69 73 61 67 72 65 65 73 20 which disagrees
1bd0: 61 62 6f 75 74 20 74 68 65 0a 09 23 20 6c 69 6e about the..# lin
1be0: 65 20 6f 66 20 64 65 76 65 6c 6f 70 6d 65 6e 74 e of development
1bf0: 20 74 68 65 79 20 62 65 6c 6f 6e 67 20 74 6f 2e they belong to.
1c00: 0a 09 43 68 65 63 6b 52 65 76 20 5c 0a 09 20 20 ..CheckRev \..
1c10: 20 20 7b 52 65 76 69 73 69 6f 6e 73 20 61 6e 64 {Revisions and
1c20: 20 74 68 65 69 72 20 70 72 69 6d 61 72 79 20 63 their primary c
1c30: 68 69 6c 64 72 65 6e 20 68 61 76 65 20 74 6f 20 hildren have to
1c40: 62 65 20 69 6e 20 74 68 65 20 73 61 6d 65 20 4c be in the same L
1c50: 4f 44 7d 20 5c 0a 09 20 20 20 20 7b 61 6e 64 20 OD} \.. {and
1c60: 69 74 73 20 70 72 69 6d 61 72 79 20 63 68 69 6c its primary chil
1c70: 64 20 64 69 73 61 67 72 65 65 20 61 62 6f 75 74 d disagree about
1c80: 20 74 68 65 69 72 20 4c 4f 44 7d 20 7b 0a 09 09 their LOD} {...
1c90: 53 45 4c 45 43 54 20 46 2e 6e 61 6d 65 2c 20 52 SELECT F.name, R
1ca0: 2e 72 65 76 0a 09 09 46 52 4f 4d 20 72 65 76 69 .rev...FROM revi
1cb0: 73 69 6f 6e 20 52 2c 20 72 65 76 69 73 69 6f 6e sion R, revision
1cc0: 20 43 2c 20 66 69 6c 65 20 46 0a 09 09 57 48 45 C, file F...WHE
1cd0: 52 45 20 52 2e 66 69 64 20 3d 20 46 2e 66 69 64 RE R.fid = F.fid
1ce0: 0a 09 09 41 4e 44 20 20 20 52 2e 63 68 69 6c 64 ...AND R.child
1cf0: 20 49 53 20 4e 4f 54 20 4e 55 4c 4c 0a 09 09 41 IS NOT NULL...A
1d00: 4e 44 20 20 20 52 2e 63 68 69 6c 64 20 3d 20 43 ND R.child = C
1d10: 2e 72 69 64 0a 09 09 41 4e 44 20 20 20 43 2e 6c .rid...AND C.l
1d20: 6f 64 20 21 3d 20 52 2e 6c 6f 64 0a 09 09 3b 0a od != R.lod...;.
1d30: 09 20 20 20 20 7d 0a 09 23 20 46 69 6e 64 20 61 . }..# Find a
1d40: 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 77 69 74 ll revisions wit
1d50: 68 20 61 20 6e 6f 6e 2d 4e 54 44 42 20 63 68 69 h a non-NTDB chi
1d60: 6c 64 20 77 68 69 63 68 20 61 67 72 65 65 73 20 ld which agrees
1d70: 61 62 6f 75 74 0a 09 23 20 74 68 65 20 6c 69 6e about..# the lin
1d80: 65 20 6f 66 20 64 65 76 65 6c 6f 70 6d 65 6e 74 e of development
1d90: 20 74 68 65 79 20 62 65 6c 6f 6e 67 20 74 6f 2e they belong to.
1da0: 0a 09 43 68 65 63 6b 52 65 76 20 5c 0a 09 20 20 ..CheckRev \..
1db0: 20 20 7b 4e 54 44 42 20 61 6e 64 20 74 72 75 6e {NTDB and trun
1dc0: 6b 20 72 65 76 69 73 69 6f 6e 73 20 68 61 76 65 k revisions have
1dd0: 20 74 6f 20 62 65 20 69 6e 20 64 69 66 66 65 72 to be in differ
1de0: 65 6e 74 20 4c 4f 44 73 7d 20 5c 0a 09 20 20 20 ent LODs} \..
1df0: 20 7b 6f 6e 20 4e 54 44 42 20 61 6e 64 20 69 74 {on NTDB and it
1e00: 73 20 6e 6f 6e 2d 4e 54 44 42 20 63 68 69 6c 64 s non-NTDB child
1e10: 20 77 72 6f 6e 67 6c 79 20 61 67 72 65 65 20 61 wrongly agree a
1e20: 62 6f 75 74 20 74 68 65 69 72 20 4c 4f 44 7d 20 bout their LOD}
1e30: 7b 0a 09 09 53 45 4c 45 43 54 20 46 2e 6e 61 6d {...SELECT F.nam
1e40: 65 2c 20 52 2e 72 65 76 0a 09 09 46 52 4f 4d 20 e, R.rev...FROM
1e50: 72 65 76 69 73 69 6f 6e 20 52 2c 20 72 65 76 69 revision R, revi
1e60: 73 69 6f 6e 20 43 2c 20 66 69 6c 65 20 46 0a 09 sion C, file F..
1e70: 09 57 48 45 52 45 20 52 2e 66 69 64 20 3d 20 46 .WHERE R.fid = F
1e80: 2e 66 69 64 0a 09 09 41 4e 44 20 20 20 52 2e 64 .fid...AND R.d
1e90: 62 63 68 69 6c 64 20 49 53 20 4e 4f 54 20 4e 55 bchild IS NOT NU
1ea0: 4c 4c 0a 09 09 41 4e 44 20 20 20 52 2e 64 62 63 LL...AND R.dbc
1eb0: 68 69 6c 64 20 3d 20 43 2e 72 69 64 0a 09 09 41 hild = C.rid...A
1ec0: 4e 44 20 20 20 43 2e 6c 6f 64 20 3d 20 52 2e 6c ND C.lod = R.l
1ed0: 6f 64 0a 09 09 3b 0a 09 20 20 20 20 7d 0a 09 23 od...;.. }..#
1ee0: 20 46 69 6e 64 20 61 6c 6c 20 72 65 76 69 73 69 Find all revisi
1ef0: 6f 6e 73 20 77 69 74 68 20 61 20 62 72 61 6e 63 ons with a branc
1f00: 68 20 70 61 72 65 6e 74 20 73 79 6d 62 6f 6c 20 h parent symbol
1f10: 77 68 69 63 68 20 69 73 20 6e 6f 74 0a 09 23 20 which is not..#
1f20: 74 68 65 69 72 20 4c 4f 44 2e 0a 09 43 68 65 63 their LOD...Chec
1f30: 6b 52 65 76 20 5c 0a 09 20 20 20 20 7b 42 72 61 kRev \.. {Bra
1f40: 6e 63 68 20 73 74 61 72 74 69 6e 67 20 72 65 76 nch starting rev
1f50: 69 73 69 6f 6e 73 20 68 61 76 65 20 74 6f 20 68 isions have to h
1f60: 61 76 65 20 74 68 65 69 72 20 4c 4f 44 20 61 73 ave their LOD as
1f70: 20 62 72 61 6e 63 68 20 70 61 72 65 6e 74 20 73 branch parent s
1f80: 79 6d 62 6f 6c 7d 20 5c 0a 09 20 20 20 20 7b 61 ymbol} \.. {a
1f90: 74 20 74 68 65 20 62 65 67 69 6e 6e 69 6e 67 20 t the beginning
1fa0: 6f 66 20 69 74 73 20 62 72 61 6e 63 68 20 64 6f of its branch do
1fb0: 65 73 20 6e 6f 74 20 68 61 76 65 20 74 68 65 20 es not have the
1fc0: 62 72 61 6e 63 68 20 73 79 6d 62 6f 6c 20 61 73 branch symbol as
1fd0: 20 69 74 73 20 4c 4f 44 7d 20 7b 0a 09 09 53 45 its LOD} {...SE
1fe0: 4c 45 43 54 20 46 2e 6e 61 6d 65 2c 20 52 2e 72 LECT F.name, R.r
1ff0: 65 76 0a 09 09 46 52 4f 4d 20 72 65 76 69 73 69 ev...FROM revisi
2000: 6f 6e 20 52 2c 20 66 69 6c 65 20 46 0a 09 09 57 on R, file F...W
2010: 48 45 52 45 20 52 2e 66 69 64 20 3d 20 46 2e 66 HERE R.fid = F.f
2020: 69 64 0a 09 09 41 4e 44 20 20 20 52 2e 62 70 61 id...AND R.bpa
2030: 72 65 6e 74 20 49 53 20 4e 4f 54 20 4e 55 4c 4c rent IS NOT NULL
2040: 0a 09 09 41 4e 44 20 20 20 52 2e 6c 6f 64 20 21 ...AND R.lod !
2050: 3d 20 52 2e 62 70 61 72 65 6e 74 0a 09 09 3b 0a = R.bparent...;.
2060: 09 20 20 20 20 7d 0a 09 23 20 46 69 6e 64 20 61 . }..# Find a
2070: 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 77 69 74 ll revisions wit
2080: 68 20 61 20 62 72 61 6e 63 68 20 70 61 72 65 6e h a branch paren
2090: 74 20 73 79 6d 62 6f 6c 20 77 68 6f 73 65 20 70 t symbol whose p
20a0: 61 72 65 6e 74 0a 09 23 20 69 73 20 69 6e 20 74 arent..# is in t
20b0: 68 65 20 73 61 6d 65 20 6c 69 6e 65 20 6f 66 20 he same line of
20c0: 64 65 76 65 6c 6f 70 6d 65 6e 74 2e 0a 09 43 68 development...Ch
20d0: 65 63 6b 52 65 76 20 5c 0a 09 20 20 20 20 7b 52 eckRev \.. {R
20e0: 65 76 69 73 69 6f 6e 73 20 61 6e 64 20 74 68 65 evisions and the
20f0: 69 72 20 62 72 61 6e 63 68 20 63 68 69 6c 64 72 ir branch childr
2100: 65 6e 20 68 61 76 65 20 74 6f 20 62 65 20 69 6e en have to be in
2110: 20 64 69 66 66 65 72 65 6e 74 20 4c 4f 44 73 7d different LODs}
2120: 20 5c 0a 09 20 20 20 20 7b 61 74 20 74 68 65 20 \.. {at the
2130: 62 65 67 69 6e 6e 69 6e 67 20 6f 66 20 69 74 73 beginning of its
2140: 20 62 72 61 6e 63 68 20 61 6e 64 20 69 74 73 20 branch and its
2150: 70 61 72 65 6e 74 20 77 72 6f 6e 67 6c 79 20 61 parent wrongly a
2160: 67 72 65 65 20 61 62 6f 75 74 20 74 68 65 69 72 gree about their
2170: 20 4c 4f 44 7d 20 7b 0a 09 09 53 45 4c 45 43 54 LOD} {...SELECT
2180: 20 46 2e 6e 61 6d 65 2c 20 52 2e 72 65 76 0a 09 F.name, R.rev..
2190: 09 46 52 4f 4d 20 72 65 76 69 73 69 6f 6e 20 52 .FROM revision R
21a0: 2c 20 72 65 76 69 73 69 6f 6e 20 50 2c 20 66 69 , revision P, fi
21b0: 6c 65 20 46 0a 09 09 57 48 45 52 45 20 52 2e 66 le F...WHERE R.f
21c0: 69 64 20 3d 20 46 2e 66 69 64 0a 09 09 41 4e 44 id = F.fid...AND
21d0: 20 20 20 52 2e 62 70 61 72 65 6e 74 20 49 53 20 R.bparent IS
21e0: 4e 4f 54 20 4e 55 4c 4c 0a 09 09 41 4e 44 20 20 NOT NULL...AND
21f0: 20 52 2e 70 61 72 65 6e 74 20 3d 20 50 2e 72 69 R.parent = P.ri
2200: 64 0a 09 09 41 4e 44 20 20 20 52 2e 6c 6f 64 20 d...AND R.lod
2210: 3d 20 50 2e 6c 6f 64 0a 09 09 3b 0a 09 20 20 20 = P.lod...;..
2220: 20 7d 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 7d }..return. }
2230: 0a 0a 20 20 20 20 70 72 6f 63 20 4d 65 74 61 20 .. proc Meta
2240: 7b 7d 20 7b 0a 09 23 20 54 68 69 73 20 63 6f 64 {} {..# This cod
2250: 65 20 70 65 72 66 6f 72 6d 73 20 61 20 6e 75 6d e performs a num
2260: 62 65 72 20 6f 66 20 70 61 72 61 6e 6f 69 64 20 ber of paranoid
2270: 63 68 65 63 6b 73 20 6f 66 20 74 68 65 0a 09 23 checks of the..#
2280: 20 64 61 74 61 62 61 73 65 2c 20 73 65 61 72 63 database, searc
2290: 68 69 6e 67 20 66 6f 72 20 69 6e 63 6f 6e 73 69 hing for inconsi
22a0: 73 74 65 6e 74 20 63 72 6f 73 73 2d 72 65 66 65 stent cross-refe
22b0: 72 65 6e 63 65 73 2e 0a 0a 09 75 70 76 61 72 20 rences....upvar
22c0: 31 20 6e 20 6e 20 3b 20 23 20 43 6f 75 6e 74 65 1 n n ; # Counte
22d0: 72 20 66 6f 72 20 74 68 65 20 63 68 65 63 6b 73 r for the checks
22e0: 20 28 77 65 20 70 72 69 6e 74 20 61 6e 20 69 64 (we print an id
22f0: 20 62 65 66 6f 72 65 0a 09 09 20 20 20 20 20 20 before...
2300: 23 20 74 68 65 20 6d 61 69 6e 20 6c 61 62 65 6c # the main label
2310: 29 2e 0a 0a 09 23 20 46 69 6e 64 20 61 6c 6c 20 )....# Find all
2320: 72 65 76 69 73 69 6f 6e 73 20 77 68 69 63 68 20 revisions which
2330: 64 69 73 67 72 65 65 20 77 69 74 68 20 74 68 65 disgree with the
2340: 69 72 20 6d 65 74 61 20 64 61 74 61 20 61 62 6f ir meta data abo
2350: 75 74 0a 09 23 20 74 68 65 20 62 72 61 6e 63 68 ut..# the branch
2360: 2f 6c 69 6e 65 20 6f 66 20 64 65 76 65 6c 6f 70 /line of develop
2370: 6d 65 6e 74 20 74 68 65 79 20 62 65 6c 6f 6e 67 ment they belong
2380: 20 74 6f 2e 0a 09 43 68 65 63 6b 52 65 76 20 5c to...CheckRev \
2390: 0a 09 20 20 20 20 7b 52 65 76 69 73 69 6f 6e 73 .. {Revisions
23a0: 20 61 6e 64 20 74 68 65 69 72 20 6d 65 74 61 20 and their meta
23b0: 64 61 74 61 20 68 61 76 65 20 74 6f 20 62 65 20 data have to be
23c0: 69 6e 20 74 68 65 20 73 61 6d 65 20 4c 4f 44 7d in the same LOD}
23d0: 20 5c 0a 09 20 20 20 20 7b 64 69 73 61 67 72 65 \.. {disagre
23e0: 65 73 20 77 69 74 68 20 69 74 73 20 6d 65 74 61 es with its meta
23f0: 20 64 61 74 61 20 61 62 6f 75 74 20 6f 77 6e 69 data about owni
2400: 6e 67 20 4c 4f 44 7d 20 7b 0a 09 09 53 45 4c 45 ng LOD} {...SELE
2410: 43 54 20 46 2e 6e 61 6d 65 2c 20 52 2e 72 65 76 CT F.name, R.rev
2420: 0a 09 09 46 52 4f 4d 20 72 65 76 69 73 69 6f 6e ...FROM revision
2430: 20 52 2c 20 6d 65 74 61 20 4d 2c 20 66 69 6c 65 R, meta M, file
2440: 20 46 0a 09 09 57 48 45 52 45 20 52 2e 6d 69 64 F...WHERE R.mid
2450: 20 3d 20 4d 2e 6d 69 64 0a 09 09 41 4e 44 20 20 = M.mid...AND
2460: 20 52 2e 6c 6f 64 20 21 3d 20 4d 2e 62 69 64 0a R.lod != M.bid.
2470: 09 09 41 4e 44 20 20 20 52 2e 66 69 64 20 3d 20 ..AND R.fid =
2480: 46 2e 66 69 64 0a 09 09 3b 0a 09 20 20 20 20 7d F.fid...;.. }
2490: 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a ..return. }..
24a0: 20 20 20 20 70 72 6f 63 20 52 65 76 69 73 69 6f proc Revisio
24b0: 6e 43 68 61 6e 67 65 73 65 74 73 20 7b 7d 20 7b nChangesets {} {
24c0: 0a 09 23 20 54 68 69 73 20 63 6f 64 65 20 70 65 ..# This code pe
24d0: 72 66 6f 72 6d 73 20 61 20 6e 75 6d 62 65 72 20 rforms a number
24e0: 6f 66 20 70 61 72 61 6e 6f 69 64 20 63 68 65 63 of paranoid chec
24f0: 6b 73 20 6f 66 20 74 68 65 0a 09 23 20 64 61 74 ks of the..# dat
2500: 61 62 61 73 65 2c 20 73 65 61 72 63 68 69 6e 67 abase, searching
2510: 20 66 6f 72 20 69 6e 63 6f 6e 73 69 73 74 65 6e for inconsisten
2520: 74 20 63 68 61 6e 67 65 73 65 74 2f 72 65 76 69 t changeset/revi
2530: 73 69 6f 6e 0a 09 23 20 69 6e 66 6f 72 6d 61 74 sion..# informat
2540: 69 6f 6e 2e 0a 0a 09 75 70 76 61 72 20 31 20 6e ion....upvar 1 n
2550: 20 6e 20 3b 20 23 20 43 6f 75 6e 74 65 72 20 66 n ; # Counter f
2560: 6f 72 20 74 68 65 20 63 68 65 63 6b 73 20 28 77 or the checks (w
2570: 65 20 70 72 69 6e 74 20 61 6e 20 69 64 20 62 65 e print an id be
2580: 66 6f 72 65 0a 09 09 20 20 20 20 20 20 23 20 74 fore... # t
2590: 68 65 20 6d 61 69 6e 20 6c 61 62 65 6c 29 2e 0a he main label)..
25a0: 0a 09 23 20 46 69 6e 64 20 61 6c 6c 20 72 65 76 ..# Find all rev
25b0: 69 73 69 6f 6e 73 20 77 68 69 63 68 20 61 72 65 isions which are
25c0: 20 6e 6f 74 20 75 73 65 64 20 62 79 20 61 74 20 not used by at
25d0: 6c 65 61 73 74 20 6f 6e 65 0a 09 23 20 63 68 61 least one..# cha
25e0: 6e 67 65 73 65 74 2e 0a 09 43 68 65 63 6b 52 65 ngeset...CheckRe
25f0: 76 20 5c 0a 09 20 20 20 20 7b 41 6c 6c 20 72 65 v \.. {All re
2600: 76 69 73 69 6f 6e 73 20 68 61 76 65 20 74 6f 20 visions have to
2610: 62 65 20 75 73 65 64 20 62 79 20 6c 65 61 73 74 be used by least
2620: 20 6f 6e 65 20 63 68 61 6e 67 65 73 65 74 7d 20 one changeset}
2630: 5c 0a 09 20 20 20 20 7b 69 73 20 6e 6f 74 20 75 \.. {is not u
2640: 73 65 64 20 62 79 20 61 20 63 68 61 6e 67 65 73 sed by a changes
2650: 65 74 7d 20 7b 0a 09 09 2d 2d 20 55 6e 75 73 65 et} {...-- Unuse
2660: 64 20 72 65 76 69 73 69 6f 6e 73 20 3d 20 41 6c d revisions = Al
2670: 6c 20 72 65 76 69 73 69 6f 6e 73 0a 09 09 2d 2d l revisions...--
2680: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
2690: 20 20 2d 20 72 65 76 69 73 69 6f 6e 73 20 75 73 - revisions us
26a0: 65 64 20 62 79 20 72 65 76 69 73 69 6f 6e 20 63 ed by revision c
26b0: 68 61 6e 67 65 73 65 74 73 2e 0a 09 09 2d 2d 0a hangesets....--.
26c0: 09 09 2d 2d 20 42 6f 74 68 20 73 65 74 73 20 63 ..-- Both sets c
26d0: 61 6e 20 62 65 20 63 6f 6d 70 75 74 65 64 20 65 an be computed e
26e0: 61 73 69 6c 79 2c 20 61 6e 64 20 73 75 62 74 72 asily, and subtr
26f0: 61 63 74 65 64 0a 20 20 20 20 20 20 20 20 20 20 acted.
2700: 20 20 20 20 20 20 2d 2d 20 66 72 6f 6d 20 65 61 -- from ea
2710: 63 68 20 6f 74 68 65 72 2e 20 54 68 65 6e 20 77 ch other. Then w
2720: 65 20 63 61 6e 20 67 65 74 20 74 68 65 20 61 73 e can get the as
2730: 73 6f 63 69 61 74 65 64 0a 20 20 20 20 20 20 20 sociated.
2740: 20 20 20 20 20 20 20 20 20 2d 2d 20 66 69 6c 65 -- file
2750: 20 28 6e 61 6d 65 29 20 66 6f 72 20 64 69 73 70 (name) for disp
2760: 6c 61 79 2e 0a 0a 09 09 53 45 4c 45 43 54 20 46 lay.....SELECT F
2770: 2e 6e 61 6d 65 2c 20 52 2e 72 65 76 0a 09 09 46 .name, R.rev...F
2780: 52 4f 4d 20 72 65 76 69 73 69 6f 6e 20 52 2c 20 ROM revision R,
2790: 66 69 6c 65 20 46 0a 09 09 57 48 45 52 45 20 52 file F...WHERE R
27a0: 2e 72 69 64 20 49 4e 20 28 53 45 4c 45 43 54 20 .rid IN (SELECT
27b0: 72 69 64 0a 09 09 09 09 46 52 4f 4d 20 72 65 76 rid.....FROM rev
27c0: 69 73 69 6f 6e 20 20 20 20 20 20 20 20 20 20 20 ision
27d0: 20 20 20 20 20 2d 2d 20 41 6c 6c 20 72 65 76 69 -- All revi
27e0: 73 69 6f 6e 73 0a 09 09 09 09 45 58 43 45 50 54 sions.....EXCEPT
27f0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
2800: 20 20 20 20 20 20 20 2d 2d 20 73 75 62 74 72 61 -- subtra
2810: 63 74 0a 09 09 09 09 53 45 4c 45 43 54 20 43 49 ct.....SELECT CI
2820: 2e 69 69 64 0a 09 09 09 09 46 52 4f 4d 20 63 73 .iid.....FROM cs
2830: 69 74 65 6d 20 43 49 2c 20 63 68 61 6e 67 65 73 item CI, changes
2840: 65 74 20 43 20 20 2d 2d 20 72 65 76 69 73 69 6f et C -- revisio
2850: 6e 73 20 75 73 65 64 0a 09 09 09 09 57 48 45 52 ns used.....WHER
2860: 45 20 43 2e 63 69 64 20 3d 20 43 49 2e 63 69 64 E C.cid = CI.cid
2870: 20 20 20 20 20 20 20 20 20 2d 2d 20 62 79 20 61 -- by a
2880: 6e 79 20 72 65 76 69 73 69 6f 6e 0a 09 09 09 09 ny revision.....
2890: 41 4e 44 20 43 2e 74 79 70 65 20 3d 20 30 29 20 AND C.type = 0)
28a0: 20 20 20 20 20 20 20 20 20 20 20 20 20 2d 2d 20 --
28b0: 63 68 61 6e 67 65 73 65 74 0a 09 09 41 4e 44 20 changeset...AND
28c0: 20 20 52 2e 66 69 64 20 3d 20 46 2e 66 69 64 20 R.fid = F.fid
28d0: 20 20 20 20 20 20 20 20 20 20 20 20 20 2d 2d 20 --
28e0: 67 65 74 20 66 69 6c 65 20 6f 66 20 75 6e 75 73 get file of unus
28f0: 65 64 20 72 65 76 69 73 69 6f 6e 0a 09 20 20 20 ed revision..
2900: 20 7d 0a 09 23 20 46 69 6e 64 20 61 6c 6c 20 72 }..# Find all r
2910: 65 76 69 73 69 6f 6e 73 20 77 68 69 63 68 20 61 evisions which a
2920: 72 65 20 75 73 65 64 20 62 79 20 6d 6f 72 65 20 re used by more
2930: 74 68 61 6e 20 6f 6e 65 0a 09 23 20 63 68 61 6e than one..# chan
2940: 67 65 73 65 74 2e 0a 09 43 68 65 63 6b 52 65 76 geset...CheckRev
2950: 20 5c 0a 09 20 20 20 20 7b 41 6c 6c 20 72 65 76 \.. {All rev
2960: 69 73 69 6f 6e 73 20 68 61 76 65 20 74 6f 20 62 isions have to b
2970: 65 20 75 73 65 64 20 62 79 20 61 74 20 6d 6f 73 e used by at mos
2980: 74 20 6f 6e 65 20 63 68 61 6e 67 65 73 65 74 7d t one changeset}
2990: 20 5c 0a 09 20 20 20 20 7b 69 73 20 75 73 65 64 \.. {is used
29a0: 20 62 79 20 6d 75 6c 74 69 70 6c 65 20 63 68 61 by multiple cha
29b0: 6e 67 65 73 65 74 73 7d 20 7b 0a 09 09 2d 2d 20 ngesets} {...--
29c0: 50 72 69 6e 63 69 70 6c 65 20 6f 66 20 6f 70 65 Principle of ope
29d0: 72 61 74 69 6f 6e 3a 20 47 65 74 20 61 6c 6c 20 ration: Get all
29e0: 72 65 76 69 73 69 6f 6e 2f 63 68 61 6e 67 65 73 revision/changes
29f0: 65 74 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 et.
2a00: 20 20 20 2d 2d 20 70 61 69 72 73 20 66 6f 72 20 -- pairs for
2a10: 61 6c 6c 20 72 65 76 69 73 69 6f 6e 20 63 68 61 all revision cha
2a20: 6e 67 65 73 65 74 73 2c 20 67 72 6f 75 70 20 62 ngesets, group b
2a30: 79 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 y.
2a40: 20 20 2d 2d 20 72 65 76 69 73 69 6f 6e 20 74 6f -- revision to
2a50: 20 61 67 67 72 65 67 61 74 65 20 74 68 65 20 63 aggregate the c
2a60: 68 61 6e 67 65 73 65 74 2c 20 63 6f 75 6e 74 69 hangeset, counti
2a70: 6e 67 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 ng.
2a80: 20 20 20 2d 2d 20 74 68 65 6d 2e 20 46 72 6f 6d -- them. From
2a90: 20 74 68 65 20 72 65 73 75 6c 74 69 6e 67 20 72 the resulting r
2aa0: 65 76 69 73 69 6f 6e 2f 63 6f 75 6e 74 20 74 61 evision/count ta
2ab0: 62 6c 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 ble.
2ac0: 20 20 20 20 2d 2d 20 73 65 6c 65 63 74 20 74 68 -- select th
2ad0: 6f 73 65 20 77 69 74 68 20 6d 6f 72 65 20 74 68 ose with more th
2ae0: 61 6e 20 6f 6e 65 20 75 73 65 72 2c 20 61 6e 64 an one user, and
2af0: 20 67 65 74 20 74 68 65 69 72 0a 20 20 20 20 20 get their.
2b00: 20 20 20 20 20 20 20 20 20 20 20 2d 2d 20 61 73 -- as
2b10: 73 6f 63 69 61 74 65 64 20 66 69 6c 65 20 28 6e sociated file (n
2b20: 61 6d 65 29 20 66 6f 72 20 64 69 73 70 6c 61 79 ame) for display
2b30: 2e 0a 0a 09 09 53 45 4c 45 43 54 20 46 2e 6e 61 .....SELECT F.na
2b40: 6d 65 2c 20 52 2e 72 65 76 0a 09 09 46 52 4f 4d me, R.rev...FROM
2b50: 20 72 65 76 69 73 69 6f 6e 20 52 2c 20 66 69 6c revision R, fil
2b60: 65 20 46 2c 0a 09 09 20 20 20 20 20 28 53 45 4c e F,... (SEL
2b70: 45 43 54 20 43 49 2e 69 69 64 20 41 53 20 72 69 ECT CI.iid AS ri
2b80: 64 2c 20 63 6f 75 6e 74 28 43 49 2e 63 69 64 29 d, count(CI.cid)
2b90: 20 41 53 20 63 6f 75 6e 74 0a 09 09 20 20 20 20 AS count...
2ba0: 20 20 46 52 4f 4d 20 63 73 69 74 65 6d 20 43 49 FROM csitem CI
2bb0: 2c 20 63 68 61 6e 67 65 73 65 74 20 43 0a 09 09 , changeset C...
2bc0: 20 20 20 20 20 20 57 48 45 52 45 20 43 2e 74 79 WHERE C.ty
2bd0: 70 65 20 3d 20 30 0a 09 09 20 20 20 20 20 20 41 pe = 0... A
2be0: 4e 44 20 20 20 43 2e 63 69 64 20 3d 20 43 49 2e ND C.cid = CI.
2bf0: 63 69 64 0a 09 09 20 20 20 20 20 20 47 52 4f 55 cid... GROU
2c00: 50 20 42 59 20 43 49 2e 69 69 64 29 20 41 53 20 P BY CI.iid) AS
2c10: 55 0a 09 09 57 48 45 52 45 20 55 2e 63 6f 75 6e U...WHERE U.coun
2c20: 74 20 3e 20 31 0a 09 09 41 4e 44 20 52 2e 72 69 t > 1...AND R.ri
2c30: 64 20 3d 20 55 2e 72 69 64 0a 09 09 41 4e 44 20 d = U.rid...AND
2c40: 52 2e 66 69 64 20 3d 20 46 2e 66 69 64 0a 09 20 R.fid = F.fid..
2c50: 20 20 20 7d 0a 09 23 20 41 6c 6c 20 72 65 76 69 }..# All revi
2c60: 73 69 6f 6e 73 20 68 61 76 65 20 74 6f 20 72 65 sions have to re
2c70: 66 65 72 20 74 6f 20 74 68 65 20 73 61 6d 65 20 fer to the same
2c80: 6d 65 74 61 20 69 6e 66 6f 72 6d 61 74 69 6f 6e meta information
2c90: 20 61 73 0a 09 23 20 74 68 65 69 72 20 63 68 61 as..# their cha
2ca0: 6e 67 65 73 65 74 2e 0a 09 43 68 65 63 6b 52 65 ngeset...CheckRe
2cb0: 76 43 53 20 5c 0a 09 20 20 20 20 7b 41 6c 6c 20 vCS \.. {All
2cc0: 72 65 76 69 73 69 6f 6e 73 20 68 61 76 65 20 74 revisions have t
2cd0: 6f 20 61 67 72 65 65 20 77 69 74 68 20 74 68 65 o agree with the
2ce0: 69 72 20 63 68 61 6e 67 65 73 65 74 20 61 62 6f ir changeset abo
2cf0: 75 74 20 74 68 65 20 75 73 65 64 20 6d 65 74 61 ut the used meta
2d00: 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 7d 20 5c 0a information} \.
2d10: 09 20 20 20 20 7b 64 69 73 61 67 72 65 65 73 20 . {disagrees
2d20: 77 69 74 68 20 69 74 73 20 63 68 61 6e 67 65 73 with its changes
2d30: 65 74 20 40 20 61 62 6f 75 74 20 74 68 65 20 6d et @ about the m
2d40: 65 74 61 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 7d eta information}
2d50: 20 7b 0a 09 09 53 45 4c 45 43 54 20 43 54 2e 6e {...SELECT CT.n
2d60: 61 6d 65 2c 20 43 2e 63 69 64 2c 20 46 2e 6e 61 ame, C.cid, F.na
2d70: 6d 65 2c 20 52 2e 72 65 76 0a 09 09 46 52 4f 4d me, R.rev...FROM
2d80: 20 63 68 61 6e 67 65 73 65 74 20 43 2c 20 63 73 changeset C, cs
2d90: 74 79 70 65 20 43 54 2c 20 72 65 76 69 73 69 6f type CT, revisio
2da0: 6e 20 52 2c 20 66 69 6c 65 20 46 2c 20 63 73 69 n R, file F, csi
2db0: 74 65 6d 20 43 49 0a 09 09 57 48 45 52 45 20 43 tem CI...WHERE C
2dc0: 2e 74 79 70 65 20 3d 20 30 20 20 20 20 20 20 20 .type = 0
2dd0: 2d 2d 20 72 65 76 69 73 69 6f 6e 20 63 68 61 6e -- revision chan
2de0: 67 65 73 65 74 73 20 6f 6e 6c 79 0a 09 09 41 4e gesets only...AN
2df0: 44 20 20 20 43 2e 63 69 64 20 20 3d 20 43 49 2e D C.cid = CI.
2e00: 63 69 64 20 20 2d 2d 20 63 68 61 6e 67 65 73 65 cid -- changese
2e10: 74 20 2d 2d 3e 20 69 74 73 20 72 65 76 69 73 69 t --> its revisi
2e20: 6f 6e 73 0a 09 09 41 4e 44 20 20 20 52 2e 72 69 ons...AND R.ri
2e30: 64 20 20 3d 20 43 49 2e 69 69 64 20 20 2d 2d 20 d = CI.iid --
2e40: 6c 6f 6f 6b 20 61 74 20 74 68 65 6d 0a 09 09 41 look at them...A
2e50: 4e 44 20 20 20 52 2e 6d 69 64 20 21 3d 20 43 2e ND R.mid != C.
2e60: 73 72 63 20 20 20 2d 2d 20 4f 6e 6c 79 20 74 68 src -- Only th
2e70: 6f 73 65 20 77 68 69 63 68 20 64 69 73 61 67 72 ose which disagr
2e80: 65 65 20 77 69 74 68 20 63 68 61 6e 67 65 73 65 ee with changese
2e90: 74 20 61 62 6f 75 74 20 74 68 65 20 6d 65 74 61 t about the meta
2ea0: 0a 09 09 41 4e 44 20 20 20 52 2e 66 69 64 20 3d ...AND R.fid =
2eb0: 20 46 2e 66 69 64 20 20 20 20 2d 2d 20 67 65 74 F.fid -- get
2ec0: 20 66 69 6c 65 20 6f 66 20 74 68 65 20 72 65 76 file of the rev
2ed0: 69 73 69 6f 6e 0a 09 09 41 4e 44 20 20 20 43 54 ision...AND CT
2ee0: 2e 74 69 64 20 3d 20 43 2e 74 79 70 65 20 20 2d .tid = C.type -
2ef0: 2d 20 67 65 74 20 63 68 61 6e 67 65 73 65 74 20 - get changeset
2f00: 74 79 70 65 2c 20 66 6f 72 20 6c 61 62 65 6c 69 type, for labeli
2f10: 6e 67 0a 09 20 20 20 20 7d 0a 09 23 20 41 6c 6c ng.. }..# All
2f20: 20 72 65 76 69 73 69 6f 6e 73 20 68 61 76 65 20 revisions have
2f30: 74 6f 20 61 67 72 65 65 20 6f 6e 20 74 68 65 20 to agree on the
2f40: 4c 4f 44 20 74 68 65 69 72 20 63 68 61 6e 67 65 LOD their change
2f50: 73 65 74 0a 09 23 20 62 65 6c 6f 6e 67 73 20 74 set..# belongs t
2f60: 6f 2e 20 49 6e 20 6f 74 68 65 72 20 77 6f 72 64 o. In other word
2f70: 73 2c 20 61 6c 6c 20 72 65 76 69 73 69 6f 6e 73 s, all revisions
2f80: 20 69 6e 20 61 20 63 68 61 6e 67 65 73 65 74 0a in a changeset.
2f90: 09 23 20 68 61 76 65 20 74 6f 20 72 65 66 65 72 .# have to refer
2fa0: 20 74 6f 20 74 68 65 20 73 61 6d 65 20 6c 69 6e to the same lin
2fb0: 65 20 6f 66 20 64 65 76 65 6c 6f 70 6d 65 6e 74 e of development
2fc0: 2e 0a 09 23 0a 09 23 20 49 6e 73 74 65 61 64 20 ...#..# Instead
2fd0: 6f 66 20 6c 6f 6f 6b 69 6e 67 20 61 74 20 61 6c of looking at al
2fe0: 6c 20 70 61 69 72 73 20 6f 66 20 72 65 76 69 73 l pairs of revis
2ff0: 69 6f 6e 73 20 69 6e 20 61 6c 6c 0a 09 23 20 63 ions in all..# c
3000: 68 61 6e 67 65 73 65 74 73 20 77 65 20 67 65 6e hangesets we gen
3010: 65 72 61 74 65 20 74 68 65 20 64 69 73 74 69 6e erate the distin
3020: 63 74 20 73 65 74 20 6f 66 20 61 6c 6c 20 4c 4f ct set of all LO
3030: 44 73 0a 09 23 20 72 65 66 65 72 65 6e 63 65 64 Ds..# referenced
3040: 20 62 79 20 74 68 65 20 72 65 76 69 73 69 6f 6e by the revision
3050: 73 20 6f 66 20 61 20 63 68 61 6e 67 65 73 65 74 s of a changeset
3060: 2c 20 6c 6f 6f 6b 20 66 6f 72 20 74 68 6f 73 65 , look for those
3070: 0a 09 23 20 77 69 74 68 20 63 61 72 64 69 6e 61 ..# with cardina
3080: 6c 69 74 79 20 3e 20 31 2c 20 61 6e 64 20 67 65 lity > 1, and ge
3090: 74 20 74 68 65 20 69 64 65 6e 74 69 66 79 69 6e t the identifyin
30a0: 67 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 0a 09 23 g information..#
30b0: 20 66 6f 72 20 74 68 65 20 63 68 61 6e 67 65 73 for the changes
30c0: 65 74 73 20 66 6f 75 6e 64 20 74 68 75 73 6c 79 ets found thusly
30d0: 2e 0a 09 43 68 65 63 6b 43 53 20 5c 0a 09 20 20 ...CheckCS \..
30e0: 20 20 7b 41 6c 6c 20 72 65 76 69 73 69 6f 6e 73 {All revisions
30f0: 20 69 6e 20 61 20 63 68 61 6e 67 65 73 65 74 20 in a changeset
3100: 68 61 76 65 20 74 6f 20 62 65 6c 6f 6e 67 20 74 have to belong t
3110: 6f 20 74 68 65 20 73 61 6d 65 20 4c 4f 44 7d 20 o the same LOD}
3120: 5c 0a 09 20 20 20 20 7b 3a 20 49 74 73 20 72 65 \.. {: Its re
3130: 76 69 73 69 6f 6e 73 20 64 69 73 61 67 72 65 65 visions disagree
3140: 20 61 62 6f 75 74 20 74 68 65 20 4c 4f 44 20 74 about the LOD t
3150: 68 65 79 20 62 65 6c 6f 6e 67 20 74 6f 7d 20 7b hey belong to} {
3160: 0a 09 09 53 45 4c 45 43 54 20 54 2e 6e 61 6d 65 ...SELECT T.name
3170: 2c 20 43 2e 63 69 64 0a 09 09 46 52 4f 4d 20 20 , C.cid...FROM
3180: 20 63 68 61 6e 67 65 73 65 74 20 43 2c 20 63 73 changeset C, cs
3190: 74 79 70 65 20 54 0a 09 09 57 48 45 52 45 20 20 type T...WHERE
31a0: 43 2e 63 69 64 20 49 4e 20 28 53 45 4c 45 43 54 C.cid IN (SELECT
31b0: 20 55 2e 63 69 64 0a 09 09 09 09 20 46 52 4f 4d U.cid..... FROM
31c0: 20 28 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 (SELECT DISTINC
31d0: 54 20 43 49 2e 63 69 64 20 41 53 20 63 69 64 2c T CI.cid AS cid,
31e0: 20 52 2e 6c 6f 64 20 41 53 20 6c 6f 64 0a 09 09 R.lod AS lod...
31f0: 09 09 20 20 20 20 20 20 20 46 52 4f 4d 20 20 20 .. FROM
3200: 63 73 69 74 65 6d 20 43 49 2c 20 63 68 61 6e 67 csitem CI, chang
3210: 65 73 65 74 20 43 2c 20 72 65 76 69 73 69 6f 6e eset C, revision
3220: 20 52 0a 09 09 09 09 20 20 20 20 20 20 20 57 48 R..... WH
3230: 45 52 45 20 20 43 49 2e 69 69 64 20 3d 20 52 2e ERE CI.iid = R.
3240: 72 69 64 0a 09 09 09 09 20 20 20 20 20 20 20 41 rid..... A
3250: 4e 44 20 20 20 20 43 2e 63 69 64 20 3d 20 43 49 ND C.cid = CI
3260: 2e 63 69 64 0a 09 09 09 09 20 20 20 20 20 20 20 .cid.....
3270: 41 4e 44 20 20 20 20 43 2e 74 79 70 65 20 3d 20 AND C.type =
3280: 30 29 20 41 53 20 55 0a 09 09 09 09 20 47 52 4f 0) AS U..... GRO
3290: 55 50 20 42 59 20 55 2e 63 69 64 20 48 41 56 49 UP BY U.cid HAVI
32a0: 4e 47 20 43 4f 55 4e 54 28 55 2e 6c 6f 64 29 20 NG COUNT(U.lod)
32b0: 3e 20 31 29 0a 09 09 41 4e 44 20 20 20 20 54 2e > 1)...AND T.
32c0: 74 69 64 20 3d 20 43 2e 74 79 70 65 0a 09 20 20 tid = C.type..
32d0: 20 20 7d 0a 09 23 20 41 6c 6c 20 72 65 76 69 73 }..# All revis
32e0: 69 6f 6e 73 20 68 61 76 65 20 74 6f 20 61 67 72 ions have to agr
32f0: 65 65 20 6f 6e 20 74 68 65 20 70 72 6f 6a 65 63 ee on the projec
3300: 74 20 74 68 65 69 72 20 63 68 61 6e 67 65 73 65 t their changese
3310: 74 0a 09 23 20 62 65 6c 6f 6e 67 73 20 74 6f 2e t..# belongs to.
3320: 20 49 6e 20 6f 74 68 65 72 20 77 6f 72 64 73 2c In other words,
3330: 20 61 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 69 all revisions i
3340: 6e 20 61 20 63 68 61 6e 67 65 73 65 74 0a 09 23 n a changeset..#
3350: 20 68 61 76 65 20 74 6f 20 72 65 66 65 72 20 74 have to refer t
3360: 6f 20 74 68 65 20 73 61 6d 65 20 70 72 6f 6a 65 o the same proje
3370: 63 74 2e 0a 09 23 0a 09 23 20 49 6e 73 74 65 61 ct...#..# Instea
3380: 64 20 6f 66 20 6c 6f 6f 6b 69 6e 67 20 61 74 20 d of looking at
3390: 61 6c 6c 20 70 61 69 72 73 20 6f 66 20 72 65 76 all pairs of rev
33a0: 69 73 69 6f 6e 73 20 69 6e 20 61 6c 6c 0a 09 23 isions in all..#
33b0: 20 63 68 61 6e 67 65 73 65 74 73 20 77 65 20 67 changesets we g
33c0: 65 6e 65 72 61 74 65 20 74 68 65 20 64 69 73 74 enerate the dist
33d0: 69 6e 63 74 20 73 65 74 20 6f 66 20 61 6c 6c 20 inct set of all
33e0: 70 72 6f 6a 65 63 74 73 0a 09 23 20 72 65 66 65 projects..# refe
33f0: 72 65 6e 63 65 64 20 62 79 20 74 68 65 20 72 65 renced by the re
3400: 76 69 73 69 6f 6e 73 20 6f 66 20 61 20 63 68 61 visions of a cha
3410: 6e 67 65 73 65 74 2c 20 6c 6f 6f 6b 20 66 6f 72 ngeset, look for
3420: 20 74 68 6f 73 65 0a 09 23 20 77 69 74 68 20 63 those..# with c
3430: 61 72 64 69 6e 61 6c 69 74 79 20 3e 20 31 2c 20 ardinality > 1,
3440: 61 6e 64 20 67 65 74 20 74 68 65 20 69 64 65 6e and get the iden
3450: 74 69 66 79 69 6e 67 20 69 6e 66 6f 72 6d 61 74 tifying informat
3460: 69 6f 6e 0a 09 23 20 66 6f 72 20 74 68 65 20 63 ion..# for the c
3470: 68 61 6e 67 65 73 65 74 73 20 66 6f 75 6e 64 20 hangesets found
3480: 74 68 75 73 6c 79 2e 0a 09 43 68 65 63 6b 43 53 thusly...CheckCS
3490: 20 5c 0a 09 20 20 20 20 7b 41 6c 6c 20 72 65 76 \.. {All rev
34a0: 69 73 69 6f 6e 73 20 69 6e 20 61 20 63 68 61 6e isions in a chan
34b0: 67 65 73 65 74 20 68 61 76 65 20 74 6f 20 62 65 geset have to be
34c0: 6c 6f 6e 67 20 74 6f 20 74 68 65 20 73 61 6d 65 long to the same
34d0: 20 70 72 6f 6a 65 63 74 7d 20 5c 0a 09 20 20 20 project} \..
34e0: 20 7b 3a 20 49 74 73 20 72 65 76 69 73 69 6f 6e {: Its revision
34f0: 73 20 64 69 73 61 67 72 65 65 20 61 62 6f 75 74 s disagree about
3500: 20 74 68 65 20 70 72 6f 6a 65 63 74 20 74 68 65 the project the
3510: 79 20 62 65 6c 6f 6e 67 20 74 6f 7d 20 7b 0a 09 y belong to} {..
3520: 09 53 45 4c 45 43 54 20 54 2e 6e 61 6d 65 2c 20 .SELECT T.name,
3530: 43 2e 63 69 64 0a 09 09 46 52 4f 4d 20 20 20 63 C.cid...FROM c
3540: 68 61 6e 67 65 73 65 74 20 43 2c 20 63 73 74 79 hangeset C, csty
3550: 70 65 20 54 0a 09 09 57 48 45 52 45 20 20 43 2e pe T...WHERE C.
3560: 63 69 64 20 49 4e 20 28 53 45 4c 45 43 54 20 55 cid IN (SELECT U
3570: 2e 63 69 64 0a 09 09 09 09 20 46 52 4f 4d 20 28 .cid..... FROM (
3580: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 SELECT DISTINCT
3590: 43 49 2e 63 69 64 20 41 53 20 63 69 64 2c 20 46 CI.cid AS cid, F
35a0: 2e 70 69 64 20 41 53 20 70 69 64 0a 09 09 09 09 .pid AS pid.....
35b0: 20 20 20 20 20 20 20 46 52 4f 4d 20 20 20 63 73 FROM cs
35c0: 69 74 65 6d 20 43 49 2c 20 63 68 61 6e 67 65 73 item CI, changes
35d0: 65 74 20 43 2c 20 72 65 76 69 73 69 6f 6e 20 52 et C, revision R
35e0: 2c 20 66 69 6c 65 20 46 0a 09 09 09 09 20 20 20 , file F.....
35f0: 20 20 20 20 57 48 45 52 45 20 20 43 49 2e 69 69 WHERE CI.ii
3600: 64 20 3d 20 52 2e 72 69 64 0a 09 09 09 09 20 20 d = R.rid.....
3610: 20 20 20 20 20 41 4e 44 20 20 20 20 43 2e 63 69 AND C.ci
3620: 64 20 3d 20 43 49 2e 63 69 64 0a 09 09 09 09 20 d = CI.cid.....
3630: 20 20 20 20 20 20 41 4e 44 20 20 20 20 43 2e 74 AND C.t
3640: 79 70 65 20 3d 20 30 0a 09 09 09 09 20 20 20 20 ype = 0.....
3650: 20 20 20 41 4e 44 20 20 20 20 46 2e 66 69 64 20 AND F.fid
3660: 20 3d 20 52 2e 66 69 64 29 20 41 53 20 55 0a 09 = R.fid) AS U..
3670: 09 09 09 20 47 52 4f 55 50 20 42 59 20 55 2e 63 ... GROUP BY U.c
3680: 69 64 20 48 41 56 49 4e 47 20 43 4f 55 4e 54 28 id HAVING COUNT(
3690: 55 2e 70 69 64 29 20 3e 20 31 29 0a 09 09 41 4e U.pid) > 1)...AN
36a0: 44 20 20 20 20 54 2e 74 69 64 20 3d 20 43 2e 74 D T.tid = C.t
36b0: 79 70 65 0a 09 20 20 20 20 7d 0a 09 23 20 41 6c ype.. }..# Al
36c0: 6c 20 72 65 76 69 73 69 6f 6e 73 20 69 6e 20 61 l revisions in a
36d0: 20 73 69 6e 67 6c 65 20 63 68 61 6e 67 65 73 65 single changese
36e0: 74 20 68 61 76 65 20 74 6f 20 62 65 6c 6f 6e 67 t have to belong
36f0: 20 74 6f 0a 09 23 20 64 69 66 66 65 72 65 6e 74 to..# different
3700: 20 66 69 6c 65 73 2e 20 43 6f 6e 76 65 72 73 65 files. Converse
3710: 6c 79 3a 20 4e 6f 20 74 77 6f 20 72 65 76 69 73 ly: No two revis
3720: 69 6f 6e 73 20 6f 66 20 61 20 73 69 6e 67 6c 65 ions of a single
3730: 0a 09 23 20 66 69 6c 65 20 61 72 65 20 61 6c 6c ..# file are all
3740: 6f 77 65 64 20 74 6f 20 62 65 20 69 6e 20 74 68 owed to be in th
3750: 65 20 73 61 6d 65 20 63 68 61 6e 67 65 73 65 74 e same changeset
3760: 2e 0a 09 23 0a 09 23 20 49 6e 73 74 65 61 64 20 ...#..# Instead
3770: 6f 66 20 6c 6f 6f 6b 69 6e 67 20 61 74 20 61 6c of looking at al
3780: 6c 20 70 61 69 72 73 20 6f 66 20 72 65 76 69 73 l pairs of revis
3790: 69 6f 6e 73 20 69 6e 20 61 6c 6c 0a 09 23 20 63 ions in all..# c
37a0: 68 61 6e 67 65 73 65 74 73 20 77 65 20 67 65 6e hangesets we gen
37b0: 65 72 61 74 65 20 74 68 65 20 64 69 73 74 69 6e erate the distin
37c0: 63 74 20 73 65 74 20 6f 66 20 61 6c 6c 20 66 69 ct set of all fi
37d0: 6c 65 73 0a 09 23 20 72 65 66 65 72 65 6e 63 65 les..# reference
37e0: 64 20 62 79 20 74 68 65 20 72 65 76 69 73 69 6f d by the revisio
37f0: 6e 73 20 6f 66 20 61 20 63 68 61 6e 67 65 73 65 ns of a changese
3800: 74 2c 20 61 6e 64 20 6c 6f 6f 6b 20 66 6f 72 0a t, and look for.
3810: 09 23 20 74 68 6f 73 65 20 77 69 74 68 20 63 61 .# those with ca
3820: 72 64 69 6e 61 6c 69 74 79 20 3c 20 74 68 65 20 rdinality < the
3830: 63 61 72 64 69 6e 61 6c 69 74 79 20 6f 66 20 74 cardinality of t
3840: 68 65 20 73 65 74 20 6f 66 0a 09 23 20 72 65 76 he set of..# rev
3850: 69 73 69 6f 6e 73 2c 20 61 6e 64 20 67 65 74 20 isions, and get
3860: 74 68 65 20 69 64 65 6e 74 69 66 79 69 6e 67 20 the identifying
3870: 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 66 6f 72 20 information for
3880: 74 68 65 0a 09 23 20 63 68 61 6e 67 65 73 65 74 the..# changeset
3890: 73 20 66 6f 75 6e 64 20 74 68 75 73 6c 79 2e 0a s found thusly..
38a0: 09 43 68 65 63 6b 43 53 20 5c 0a 09 20 20 20 20 .CheckCS \..
38b0: 7b 41 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 69 {All revisions i
38c0: 6e 20 61 20 63 68 61 6e 67 65 73 65 74 20 68 61 n a changeset ha
38d0: 76 65 20 74 6f 20 62 65 6c 6f 6e 67 20 74 6f 20 ve to belong to
38e0: 64 69 66 66 65 72 65 6e 74 20 66 69 6c 65 73 7d different files}
38f0: 20 5c 0a 09 20 20 20 20 7b 3a 20 49 74 73 20 72 \.. {: Its r
3900: 65 76 69 73 69 6f 6e 73 20 73 68 61 72 65 20 66 evisions share f
3910: 69 6c 65 73 7d 20 7b 0a 09 09 53 45 4c 45 43 54 iles} {...SELECT
3920: 20 54 2e 6e 61 6d 65 2c 20 43 2e 63 69 64 0a 09 T.name, C.cid..
3930: 09 46 52 4f 4d 20 20 20 63 68 61 6e 67 65 73 65 .FROM changese
3940: 74 20 43 2c 20 63 73 74 79 70 65 20 54 0a 09 09 t C, cstype T...
3950: 57 48 45 52 45 20 20 43 2e 63 69 64 20 49 4e 20 WHERE C.cid IN
3960: 28 53 45 4c 45 43 54 20 56 56 2e 63 69 64 0a 09 (SELECT VV.cid..
3970: 09 09 09 20 46 52 4f 4d 20 28 53 45 4c 45 43 54 ... FROM (SELECT
3980: 20 55 2e 63 69 64 20 61 73 20 63 69 64 2c 20 43 U.cid as cid, C
3990: 4f 55 4e 54 20 28 55 2e 66 69 64 29 20 41 53 20 OUNT (U.fid) AS
39a0: 66 63 6f 75 6e 74 0a 09 09 09 09 20 20 20 20 20 fcount.....
39b0: 20 20 46 52 4f 4d 20 28 53 45 4c 45 43 54 20 44 FROM (SELECT D
39c0: 49 53 54 49 4e 43 54 20 43 49 2e 63 69 64 20 41 ISTINCT CI.cid A
39d0: 53 20 63 69 64 2c 20 52 2e 66 69 64 20 41 53 20 S cid, R.fid AS
39e0: 66 69 64 0a 09 09 09 09 09 20 20 20 20 20 46 52 fid...... FR
39f0: 4f 4d 20 20 20 63 73 69 74 65 6d 20 43 49 2c 20 OM csitem CI,
3a00: 63 68 61 6e 67 65 73 65 74 20 43 2c 20 72 65 76 changeset C, rev
3a10: 69 73 69 6f 6e 20 52 0a 09 09 09 09 09 20 20 20 ision R......
3a20: 20 20 57 48 45 52 45 20 20 43 49 2e 69 69 64 20 WHERE CI.iid
3a30: 3d 20 52 2e 72 69 64 0a 09 09 09 09 09 20 20 20 = R.rid......
3a40: 20 20 41 4e 44 20 20 20 20 43 2e 63 69 64 20 3d AND C.cid =
3a50: 20 43 49 2e 63 69 64 0a 09 09 09 09 09 20 20 20 CI.cid......
3a60: 20 20 41 4e 44 20 20 20 20 43 2e 74 79 70 65 20 AND C.type
3a70: 3d 20 30 0a 09 09 09 09 09 20 20 20 20 20 29 20 = 0...... )
3a80: 41 53 20 55 0a 09 09 09 09 20 20 20 20 20 20 20 AS U.....
3a90: 47 52 4f 55 50 20 42 59 20 55 2e 63 69 64 29 20 GROUP BY U.cid)
3aa0: 41 53 20 55 55 2c 0a 09 09 09 09 20 20 20 20 20 AS UU,.....
3ab0: 20 28 53 45 4c 45 43 54 20 56 2e 63 69 64 20 41 (SELECT V.cid A
3ac0: 53 20 63 69 64 2c 20 43 4f 55 4e 54 20 28 56 2e S cid, COUNT (V.
3ad0: 69 69 64 29 20 41 53 20 72 63 6f 75 6e 74 0a 09 iid) AS rcount..
3ae0: 09 09 09 20 20 20 20 20 20 20 46 52 4f 4d 20 20 ... FROM
3af0: 20 63 73 69 74 65 6d 20 56 2c 20 63 68 61 6e 67 csitem V, chang
3b00: 65 73 65 74 20 58 0a 09 09 09 09 20 20 20 20 20 eset X.....
3b10: 20 20 57 48 45 52 45 20 20 58 2e 63 69 64 20 3d WHERE X.cid =
3b20: 20 56 2e 63 69 64 0a 09 09 09 09 20 20 20 20 20 V.cid.....
3b30: 20 20 41 4e 44 20 20 20 20 58 2e 74 79 70 65 20 AND X.type
3b40: 3d 20 30 0a 09 09 09 09 20 20 20 20 20 20 20 47 = 0..... G
3b50: 52 4f 55 50 20 42 59 20 56 2e 63 69 64 29 20 41 ROUP BY V.cid) A
3b60: 53 20 56 56 0a 09 09 09 09 20 57 48 45 52 45 20 S VV..... WHERE
3b70: 56 56 2e 63 69 64 20 3d 20 55 55 2e 63 69 64 0a VV.cid = UU.cid.
3b80: 09 09 09 09 20 41 4e 44 20 20 20 55 55 2e 66 63 .... AND UU.fc
3b90: 6f 75 6e 74 20 3c 20 56 56 2e 72 63 6f 75 6e 74 ount < VV.rcount
3ba0: 29 0a 09 09 41 4e 44 20 20 20 20 54 2e 74 69 64 )...AND T.tid
3bb0: 20 3d 20 43 2e 74 79 70 65 0a 09 20 20 20 20 7d = C.type.. }
3bc0: 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a ..return. }..
3bd0: 20 20 20 20 70 72 6f 63 20 54 61 67 43 68 61 6e proc TagChan
3be0: 67 65 73 65 74 73 20 7b 7d 20 7b 0a 09 23 20 54 gesets {} {..# T
3bf0: 68 69 73 20 63 6f 64 65 20 70 65 72 66 6f 72 6d his code perform
3c00: 73 20 61 20 6e 75 6d 62 65 72 20 6f 66 20 70 61 s a number of pa
3c10: 72 61 6e 6f 69 64 20 63 68 65 63 6b 73 20 6f 66 ranoid checks of
3c20: 20 74 68 65 0a 09 23 20 64 61 74 61 62 61 73 65 the..# database
3c30: 2c 20 73 65 61 72 63 68 69 6e 67 20 66 6f 72 20 , searching for
3c40: 69 6e 63 6f 6e 73 69 73 74 65 6e 74 20 63 68 61 inconsistent cha
3c50: 6e 67 65 73 65 74 2f 72 65 76 69 73 69 6f 6e 0a ngeset/revision.
3c60: 09 23 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 2e 0a .# information..
3c70: 0a 09 75 70 76 61 72 20 31 20 6e 20 6e 20 3b 20 ..upvar 1 n n ;
3c80: 23 20 43 6f 75 6e 74 65 72 20 66 6f 72 20 74 68 # Counter for th
3c90: 65 20 63 68 65 63 6b 73 20 28 77 65 20 70 72 69 e checks (we pri
3ca0: 6e 74 20 61 6e 20 69 64 20 62 65 66 6f 72 65 0a nt an id before.
3cb0: 09 09 20 20 20 20 20 20 23 20 74 68 65 20 6d 61 .. # the ma
3cc0: 69 6e 20 6c 61 62 65 6c 29 2e 0a 0a 09 23 20 46 in label)....# F
3cd0: 69 6e 64 20 61 6c 6c 20 74 61 67 73 20 77 68 69 ind all tags whi
3ce0: 63 68 20 61 72 65 20 6e 6f 74 20 75 73 65 64 20 ch are not used
3cf0: 62 79 20 61 74 20 6c 65 61 73 74 20 6f 6e 65 20 by at least one
3d00: 63 68 61 6e 67 65 73 65 74 2e 0a 09 43 68 65 63 changeset...Chec
3d10: 6b 54 61 67 20 5c 0a 09 20 20 20 20 7b 41 6c 6c kTag \.. {All
3d20: 20 74 61 67 73 20 68 61 76 65 20 74 6f 20 62 65 tags have to be
3d30: 20 75 73 65 64 20 62 79 20 6c 65 61 73 74 20 6f used by least o
3d40: 6e 65 20 63 68 61 6e 67 65 73 65 74 7d 20 5c 0a ne changeset} \.
3d50: 09 20 20 20 20 7b 69 73 20 6e 6f 74 20 75 73 65 . {is not use
3d60: 64 20 62 79 20 61 20 63 68 61 6e 67 65 73 65 74 d by a changeset
3d70: 7d 20 7b 0a 09 09 2d 2d 20 55 6e 75 73 65 64 20 } {...-- Unused
3d80: 74 61 67 73 20 3d 20 41 6c 6c 20 74 61 67 73 0a tags = All tags.
3d90: 09 09 2d 2d 20 20 20 20 20 20 20 20 20 20 20 20 ..--
3da0: 20 2d 20 72 65 76 69 73 69 6f 6e 73 20 75 73 65 - revisions use
3db0: 64 20 62 79 20 74 61 67 20 63 68 61 6e 67 65 73 d by tag changes
3dc0: 65 74 73 2e 0a 09 09 2d 2d 0a 09 09 2d 2d 20 42 ets....--...-- B
3dd0: 6f 74 68 20 73 65 74 73 20 63 61 6e 20 62 65 20 oth sets can be
3de0: 63 6f 6d 70 75 74 65 64 20 65 61 73 69 6c 79 2c computed easily,
3df0: 20 61 6e 64 20 73 75 62 74 72 61 63 74 65 64 0a and subtracted.
3e00: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
3e10: 2d 2d 20 66 72 6f 6d 20 65 61 63 68 20 6f 74 68 -- from each oth
3e20: 65 72 2e 20 54 68 65 6e 20 77 65 20 63 61 6e 20 er. Then we can
3e30: 67 65 74 20 74 68 65 20 61 73 73 6f 63 69 61 74 get the associat
3e40: 65 64 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 ed.
3e50: 20 20 20 2d 2d 20 66 69 6c 65 20 28 6e 61 6d 65 -- file (name
3e60: 29 20 66 6f 72 20 64 69 73 70 6c 61 79 2e 0a 0a ) for display...
3e70: 09 09 53 45 4c 45 43 54 20 50 2e 6e 61 6d 65 2c ..SELECT P.name,
3e80: 20 53 2e 6e 61 6d 65 0a 09 09 46 52 4f 4d 20 70 S.name...FROM p
3e90: 72 6f 6a 65 63 74 20 50 2c 20 74 61 67 20 54 2c roject P, tag T,
3ea0: 20 73 79 6d 62 6f 6c 20 53 0a 09 09 57 48 45 52 symbol S...WHER
3eb0: 45 20 54 2e 74 69 64 20 49 4e 20 28 53 45 4c 45 E T.tid IN (SELE
3ec0: 43 54 20 74 69 64 20 20 20 20 20 20 20 20 20 20 CT tid
3ed0: 20 20 20 20 20 20 20 20 20 20 2d 2d 20 41 6c 6c -- All
3ee0: 20 74 61 67 73 0a 09 09 09 09 46 52 4f 4d 20 20 tags.....FROM
3ef0: 20 74 61 67 0a 09 09 09 09 45 58 43 45 50 54 20 tag.....EXCEPT
3f00: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
3f10: 20 20 20 20 20 20 20 2d 2d 20 73 75 62 74 72 61 -- subtra
3f20: 63 74 0a 09 09 09 09 53 45 4c 45 43 54 20 43 49 ct.....SELECT CI
3f30: 2e 69 69 64 20 20 20 20 20 20 20 20 20 20 20 20 .iid
3f40: 20 20 20 20 20 2d 2d 20 74 61 67 73 20 75 73 65 -- tags use
3f50: 64 0a 09 09 09 09 46 52 4f 4d 20 20 20 63 73 69 d.....FROM csi
3f60: 74 65 6d 20 43 49 2c 20 63 68 61 6e 67 65 73 65 tem CI, changese
3f70: 74 20 43 0a 09 09 09 09 57 48 45 52 45 20 20 43 t C.....WHERE C
3f80: 2e 63 69 64 20 3d 20 43 49 2e 63 69 64 20 20 20 .cid = CI.cid
3f90: 20 20 20 20 20 20 2d 2d 20 62 79 20 61 6e 79 20 -- by any
3fa0: 74 61 67 0a 09 09 09 09 41 4e 44 20 20 20 20 43 tag.....AND C
3fb0: 2e 74 79 70 65 20 3d 20 31 29 20 20 20 20 20 20 .type = 1)
3fc0: 20 20 20 20 20 20 2d 2d 20 63 68 61 6e 67 65 73 -- changes
3fd0: 65 74 0a 09 09 41 4e 44 20 20 20 53 2e 73 69 64 et...AND S.sid
3fe0: 20 3d 20 54 2e 73 69 64 20 20 20 20 20 20 20 20 = T.sid
3ff0: 20 20 20 20 20 20 20 2d 2d 20 67 65 74 20 73 79 -- get sy
4000: 6d 62 6f 6c 20 6f 66 20 74 61 67 0a 09 09 41 4e mbol of tag...AN
4010: 44 20 20 20 50 2e 70 69 64 20 3d 20 53 2e 70 69 D P.pid = S.pi
4020: 64 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 d
4030: 2d 2d 20 67 65 74 20 70 72 6f 6a 65 63 74 20 6f -- get project o
4040: 66 20 73 79 6d 62 6f 6c 0a 09 20 20 20 20 7d 0a f symbol.. }.
4050: 09 23 20 46 69 6e 64 20 61 6c 6c 20 74 61 67 73 .# Find all tags
4060: 20 77 68 69 63 68 20 61 72 65 20 75 73 65 64 20 which are used
4070: 62 79 20 6d 6f 72 65 20 74 68 61 6e 20 6f 6e 65 by more than one
4080: 20 63 68 61 6e 67 65 73 65 74 2e 0a 09 43 68 65 changeset...Che
4090: 63 6b 52 65 76 20 5c 0a 09 20 20 20 20 7b 41 6c ckRev \.. {Al
40a0: 6c 20 74 61 67 73 20 68 61 76 65 20 74 6f 20 62 l tags have to b
40b0: 65 20 75 73 65 64 20 62 79 20 61 74 20 6d 6f 73 e used by at mos
40c0: 74 20 6f 6e 65 20 63 68 61 6e 67 65 73 65 74 7d t one changeset}
40d0: 20 5c 0a 09 20 20 20 20 7b 69 73 20 75 73 65 64 \.. {is used
40e0: 20 62 79 20 6d 75 6c 74 69 70 6c 65 20 63 68 61 by multiple cha
40f0: 6e 67 65 73 65 74 73 7d 20 7b 0a 09 09 2d 2d 20 ngesets} {...--
4100: 50 72 69 6e 63 69 70 6c 65 20 6f 66 20 6f 70 65 Principle of ope
4110: 72 61 74 69 6f 6e 3a 20 47 65 74 20 61 6c 6c 20 ration: Get all
4120: 74 61 67 2f 63 68 61 6e 67 65 73 65 74 20 70 61 tag/changeset pa
4130: 69 72 73 0a 20 20 20 20 20 20 20 20 20 20 20 20 irs.
4140: 20 20 20 20 2d 2d 20 66 6f 72 20 61 6c 6c 20 74 -- for all t
4150: 61 67 20 63 68 61 6e 67 65 73 65 74 73 2c 20 67 ag changesets, g
4160: 72 6f 75 70 20 62 79 20 74 61 67 20 74 6f 20 61 roup by tag to a
4170: 67 67 72 65 67 61 74 65 0a 20 20 20 20 20 20 20 ggregate.
4180: 20 20 20 20 20 20 20 20 20 2d 2d 20 74 68 65 20 -- the
4190: 63 68 61 6e 67 65 73 65 74 2c 20 63 6f 75 6e 74 changeset, count
41a0: 69 6e 67 20 74 68 65 6d 2e 20 46 72 6f 6d 20 74 ing them. From t
41b0: 68 65 20 72 65 73 75 6c 74 69 6e 67 0a 20 20 20 he resulting.
41c0: 20 20 20 20 20 20 20 20 20 20 20 20 20 2d 2d 20 --
41d0: 74 61 67 2f 63 6f 75 6e 74 20 74 61 62 6c 65 20 tag/count table
41e0: 73 65 6c 65 63 74 20 74 68 6f 73 65 20 77 69 74 select those wit
41f0: 68 20 6d 6f 72 65 20 74 68 61 6e 20 6f 6e 65 0a h more than one.
4200: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
4210: 2d 2d 20 75 73 65 72 2c 20 61 6e 64 20 67 65 74 -- user, and get
4220: 20 74 68 65 69 72 20 61 73 73 6f 63 69 61 74 65 their associate
4230: 64 20 66 69 6c 65 20 28 6e 61 6d 65 29 20 66 6f d file (name) fo
4240: 72 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 r.
4250: 20 20 2d 2d 20 64 69 73 70 6c 61 79 2e 0a 0a 09 -- display....
4260: 09 53 45 4c 45 43 54 20 50 2e 6e 61 6d 65 2c 20 .SELECT P.name,
4270: 53 2e 6e 61 6d 65 0a 09 09 46 52 4f 4d 20 74 61 S.name...FROM ta
4280: 67 20 54 2c 20 70 72 6f 6a 65 63 74 20 50 2c 20 g T, project P,
4290: 73 79 6d 62 6f 6c 20 53 2c 0a 09 09 20 20 20 20 symbol S,...
42a0: 20 28 53 45 4c 45 43 54 20 43 49 2e 69 69 64 20 (SELECT CI.iid
42b0: 41 53 20 69 69 64 2c 20 63 6f 75 6e 74 28 43 49 AS iid, count(CI
42c0: 2e 63 69 64 29 20 41 53 20 63 6f 75 6e 74 0a 09 .cid) AS count..
42d0: 09 20 20 20 20 20 20 46 52 4f 4d 20 63 73 69 74 . FROM csit
42e0: 65 6d 20 43 49 2c 20 63 68 61 6e 67 65 73 65 74 em CI, changeset
42f0: 20 43 0a 09 09 20 20 20 20 20 20 57 48 45 52 45 C... WHERE
4300: 20 43 2e 74 79 70 65 20 3d 20 31 0a 09 09 20 20 C.type = 1...
4310: 20 20 20 20 41 4e 44 20 20 20 43 2e 63 69 64 20 AND C.cid
4320: 3d 20 43 49 2e 63 69 64 0a 09 09 20 20 20 20 20 = CI.cid...
4330: 20 47 52 4f 55 50 20 42 59 20 43 49 2e 69 69 64 GROUP BY CI.iid
4340: 29 20 41 53 20 55 0a 09 09 57 48 45 52 45 20 55 ) AS U...WHERE U
4350: 2e 63 6f 75 6e 74 20 3e 20 31 0a 09 09 41 4e 44 .count > 1...AND
4360: 20 20 20 54 2e 74 69 64 20 3d 20 55 2e 69 69 64 T.tid = U.iid
4370: 0a 09 09 41 4e 44 20 20 20 53 2e 73 69 64 20 3d ...AND S.sid =
4380: 20 54 2e 73 69 64 20 20 20 20 20 20 20 20 20 20 T.sid
4390: 20 20 20 20 20 2d 2d 20 67 65 74 20 73 79 6d 62 -- get symb
43a0: 6f 6c 20 6f 66 20 74 61 67 0a 09 09 41 4e 44 20 ol of tag...AND
43b0: 20 20 50 2e 70 69 64 20 3d 20 53 2e 70 69 64 20 P.pid = S.pid
43c0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2d 2d --
43d0: 20 67 65 74 20 70 72 6f 6a 65 63 74 20 6f 66 20 get project of
43e0: 73 79 6d 62 6f 6c 0a 09 20 20 20 20 7d 0a 09 69 symbol.. }..i
43f0: 66 20 30 20 7b 0a 09 20 20 20 20 23 20 54 68 69 f 0 {.. # Thi
4400: 73 20 63 68 65 63 6b 20 69 73 20 64 69 73 61 62 s check is disab
4410: 6c 65 64 20 66 6f 72 20 74 68 65 20 6d 6f 6d 65 led for the mome
4420: 6e 74 2e 20 41 70 70 61 72 65 6e 74 6c 79 20 74 nt. Apparently t
4430: 61 67 73 0a 09 20 20 20 20 23 20 63 61 6e 20 63 ags.. # can c
4440: 72 6f 73 73 20 6c 69 6e 65 73 20 6f 66 20 64 65 ross lines of de
4450: 76 65 6c 6f 70 6d 65 6e 74 2c 20 61 74 20 6c 65 velopment, at le
4460: 61 73 74 20 69 66 20 74 68 65 20 69 6e 76 6f 6c ast if the invol
4470: 76 65 64 0a 09 20 20 20 20 23 20 4c 4f 44 73 20 ved.. # LODs
4480: 61 72 65 20 74 68 65 20 74 72 75 6e 6b 2c 20 61 are the trunk, a
4490: 6e 64 20 74 68 65 20 4e 54 44 42 2e 20 54 68 61 nd the NTDB. Tha
44a0: 74 20 6d 61 6b 65 73 20 73 65 6e 73 65 2c 20 61 t makes sense, a
44b0: 73 0a 09 20 20 20 20 23 20 74 68 65 20 4e 54 44 s.. # the NTD
44c0: 42 20 72 65 76 69 73 69 6f 6e 73 20 61 72 65 20 B revisions are
44d0: 69 6e 69 74 69 61 6c 6c 79 20 6c 6f 67 69 63 61 initially logica
44e0: 6c 6c 79 20 61 20 70 61 72 74 20 6f 66 20 74 68 lly a part of th
44f0: 65 0a 09 20 20 20 20 23 20 74 72 75 6e 6b 2e 20 e.. # trunk.
4500: 54 68 65 20 73 74 61 6e 64 61 72 64 20 63 68 65 The standard che
4510: 63 6b 20 62 65 6c 6f 77 20 68 6f 77 65 76 65 72 ck below however
4520: 20 64 6f 65 73 20 6e 6f 74 20 63 61 70 74 75 72 does not captur
4530: 65 0a 09 20 20 20 20 23 20 74 68 69 73 2e 20 57 e.. # this. W
4540: 68 65 6e 20 49 20 6d 61 6e 61 67 65 20 74 6f 20 hen I manage to
4550: 72 65 70 68 72 61 73 65 20 69 74 20 74 6f 20 61 rephrase it to a
4560: 63 63 65 70 74 20 74 68 69 73 20 74 79 70 65 0a ccept this type.
4570: 09 20 20 20 20 23 20 6f 66 20 63 72 6f 73 73 2d . # of cross-
4580: 6f 76 65 72 20 69 74 20 77 69 6c 6c 20 62 65 20 over it will be
4590: 72 65 2d 61 63 74 69 76 61 74 65 64 2e 0a 0a 09 re-activated....
45a0: 20 20 20 20 23 20 41 6c 6c 20 74 61 67 73 20 68 # All tags h
45b0: 61 76 65 20 74 6f 20 61 67 72 65 65 20 6f 6e 20 ave to agree on
45c0: 74 68 65 20 4c 4f 44 20 74 68 65 69 72 20 63 68 the LOD their ch
45d0: 61 6e 67 65 73 65 74 0a 09 20 20 20 20 23 20 62 angeset.. # b
45e0: 65 6c 6f 6e 67 73 20 74 6f 2e 20 49 6e 20 6f 74 elongs to. In ot
45f0: 68 65 72 20 77 6f 72 64 73 2c 20 61 6c 6c 20 74 her words, all t
4600: 61 67 73 20 69 6e 20 61 20 63 68 61 6e 67 65 73 ags in a changes
4610: 65 74 20 68 61 76 65 0a 09 20 20 20 20 23 20 74 et have.. # t
4620: 6f 20 72 65 66 65 72 20 74 6f 20 74 68 65 20 73 o refer to the s
4630: 61 6d 65 20 6c 69 6e 65 20 6f 66 20 64 65 76 65 ame line of deve
4640: 6c 6f 70 6d 65 6e 74 2e 0a 09 20 20 20 20 23 0a lopment... #.
4650: 09 20 20 20 20 23 20 49 6e 73 74 65 61 64 20 6f . # Instead o
4660: 66 20 6c 6f 6f 6b 69 6e 67 20 61 74 20 61 6c 6c f looking at all
4670: 20 70 61 69 72 73 20 6f 66 20 74 61 67 73 20 69 pairs of tags i
4680: 6e 20 61 6c 6c 0a 09 20 20 20 20 23 20 63 68 61 n all.. # cha
4690: 6e 67 65 73 65 74 73 20 77 65 20 67 65 6e 65 72 ngesets we gener
46a0: 61 74 65 20 74 68 65 20 64 69 73 74 69 6e 63 74 ate the distinct
46b0: 20 73 65 74 20 6f 66 20 61 6c 6c 20 4c 4f 44 73 set of all LODs
46c0: 0a 09 20 20 20 20 23 20 72 65 66 65 72 65 6e 63 .. # referenc
46d0: 65 64 20 62 79 20 74 68 65 20 74 61 67 73 20 6f ed by the tags o
46e0: 66 20 61 20 63 68 61 6e 67 65 73 65 74 2c 20 6c f a changeset, l
46f0: 6f 6f 6b 20 66 6f 72 20 74 68 6f 73 65 0a 09 20 ook for those..
4700: 20 20 20 23 20 77 69 74 68 20 63 61 72 64 69 6e # with cardin
4710: 61 6c 69 74 79 20 3e 20 31 2c 20 61 6e 64 20 67 ality > 1, and g
4720: 65 74 20 74 68 65 20 69 64 65 6e 74 69 66 79 69 et the identifyi
4730: 6e 67 0a 09 20 20 20 20 23 20 69 6e 66 6f 72 6d ng.. # inform
4740: 61 74 69 6f 6e 20 66 6f 72 20 74 68 65 20 63 68 ation for the ch
4750: 61 6e 67 65 73 65 74 73 20 66 6f 75 6e 64 20 74 angesets found t
4760: 68 75 73 6c 79 2e 0a 09 20 20 20 20 43 68 65 63 husly... Chec
4770: 6b 43 53 20 5c 0a 09 09 7b 41 6c 6c 20 74 61 67 kCS \...{All tag
4780: 73 20 69 6e 20 61 20 63 68 61 6e 67 65 73 65 74 s in a changeset
4790: 20 68 61 76 65 20 74 6f 20 62 65 6c 6f 6e 67 20 have to belong
47a0: 74 6f 20 74 68 65 20 73 61 6d 65 20 4c 4f 44 7d to the same LOD}
47b0: 20 5c 0a 09 09 7b 3a 20 49 74 73 20 74 61 67 73 \...{: Its tags
47c0: 20 64 69 73 61 67 72 65 65 20 61 62 6f 75 74 20 disagree about
47d0: 74 68 65 20 4c 4f 44 20 74 68 65 79 20 62 65 6c the LOD they bel
47e0: 6f 6e 67 20 74 6f 7d 20 7b 0a 09 09 20 20 20 20 ong to} {...
47f0: 53 45 4c 45 43 54 20 54 2e 6e 61 6d 65 2c 20 43 SELECT T.name, C
4800: 2e 63 69 64 0a 09 09 20 20 20 20 46 52 4f 4d 20 .cid... FROM
4810: 20 20 63 68 61 6e 67 65 73 65 74 20 43 2c 20 63 changeset C, c
4820: 73 74 79 70 65 20 54 0a 09 09 20 20 20 20 57 48 stype T... WH
4830: 45 52 45 20 20 43 2e 63 69 64 20 49 4e 20 28 53 ERE C.cid IN (S
4840: 45 4c 45 43 54 20 55 2e 63 69 64 0a 09 09 09 09 ELECT U.cid.....
4850: 20 20 20 20 20 46 52 4f 4d 20 28 53 45 4c 45 43 FROM (SELEC
4860: 54 20 44 49 53 54 49 4e 43 54 20 43 49 2e 63 69 T DISTINCT CI.ci
4870: 64 20 41 53 20 63 69 64 2c 20 54 2e 6c 6f 64 20 d AS cid, T.lod
4880: 41 53 20 6c 6f 64 0a 09 09 09 09 09 20 20 20 46 AS lod...... F
4890: 52 4f 4d 20 20 20 63 73 69 74 65 6d 20 43 49 2c ROM csitem CI,
48a0: 20 63 68 61 6e 67 65 73 65 74 20 43 2c 20 74 61 changeset C, ta
48b0: 67 20 54 0a 09 09 09 09 09 20 20 20 57 48 45 52 g T...... WHER
48c0: 45 20 20 43 49 2e 69 69 64 20 3d 20 54 2e 74 69 E CI.iid = T.ti
48d0: 64 0a 09 09 09 09 09 20 20 20 41 4e 44 20 20 20 d...... AND
48e0: 20 43 2e 63 69 64 20 3d 20 43 49 2e 63 69 64 0a C.cid = CI.cid.
48f0: 09 09 09 09 09 20 20 20 41 4e 44 20 20 20 20 43 ..... AND C
4900: 2e 74 79 70 65 20 3d 20 31 29 20 41 53 20 55 0a .type = 1) AS U.
4910: 09 09 09 09 20 20 20 20 20 47 52 4f 55 50 20 42 .... GROUP B
4920: 59 20 55 2e 63 69 64 20 48 41 56 49 4e 47 20 43 Y U.cid HAVING C
4930: 4f 55 4e 54 28 55 2e 6c 6f 64 29 20 3e 20 31 29 OUNT(U.lod) > 1)
4940: 0a 09 09 20 20 20 20 41 4e 44 20 20 20 20 54 2e ... AND T.
4950: 74 69 64 20 3d 20 43 2e 74 79 70 65 0a 09 09 7d tid = C.type...}
4960: 0a 09 7d 0a 09 23 20 41 6c 6c 20 74 61 67 73 20 ..}..# All tags
4970: 68 61 76 65 20 74 6f 20 61 67 72 65 65 20 6f 6e have to agree on
4980: 20 74 68 65 20 70 72 6f 6a 65 63 74 20 74 68 65 the project the
4990: 69 72 20 63 68 61 6e 67 65 73 65 74 0a 09 23 20 ir changeset..#
49a0: 62 65 6c 6f 6e 67 73 20 74 6f 2e 20 49 6e 20 6f belongs to. In o
49b0: 74 68 65 72 20 77 6f 72 64 73 2c 20 61 6c 6c 20 ther words, all
49c0: 74 61 67 73 20 69 6e 20 61 20 63 68 61 6e 67 65 tags in a change
49d0: 73 65 74 20 68 61 76 65 20 74 6f 0a 09 23 20 72 set have to..# r
49e0: 65 66 65 72 20 74 6f 20 74 68 65 20 73 61 6d 65 efer to the same
49f0: 20 70 72 6f 6a 65 63 74 2e 0a 09 23 0a 09 23 20 project...#..#
4a00: 49 6e 73 74 65 61 64 20 6f 66 20 6c 6f 6f 6b 69 Instead of looki
4a10: 6e 67 20 61 74 20 61 6c 6c 20 70 61 69 72 73 20 ng at all pairs
4a20: 6f 66 20 74 61 67 73 20 69 6e 20 61 6c 6c 20 63 of tags in all c
4a30: 68 61 6e 67 65 73 65 74 73 20 77 65 0a 09 23 20 hangesets we..#
4a40: 67 65 6e 65 72 61 74 65 20 74 68 65 20 64 69 73 generate the dis
4a50: 74 69 6e 63 74 20 73 65 74 20 6f 66 20 61 6c 6c tinct set of all
4a60: 20 70 72 6f 6a 65 63 74 73 20 72 65 66 65 72 65 projects refere
4a70: 6e 63 65 64 20 62 79 20 74 68 65 0a 09 23 20 74 nced by the..# t
4a80: 61 67 73 20 6f 66 20 61 20 63 68 61 6e 67 65 73 ags of a changes
4a90: 65 74 2c 20 6c 6f 6f 6b 20 66 6f 72 20 74 68 6f et, look for tho
4aa0: 73 65 20 77 69 74 68 20 63 61 72 64 69 6e 61 6c se with cardinal
4ab0: 69 74 79 20 3e 20 31 2c 0a 09 23 20 61 6e 64 20 ity > 1,..# and
4ac0: 67 65 74 20 74 68 65 20 69 64 65 6e 74 69 66 79 get the identify
4ad0: 69 6e 67 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 ing information
4ae0: 66 6f 72 20 74 68 65 20 63 68 61 6e 67 65 73 65 for the changese
4af0: 74 73 20 66 6f 75 6e 64 0a 09 23 20 74 68 75 73 ts found..# thus
4b00: 6c 79 2e 0a 09 43 68 65 63 6b 43 53 20 5c 0a 09 ly...CheckCS \..
4b10: 20 20 20 20 7b 41 6c 6c 20 74 61 67 73 20 69 6e {All tags in
4b20: 20 61 20 63 68 61 6e 67 65 73 65 74 20 68 61 76 a changeset hav
4b30: 65 20 74 6f 20 62 65 6c 6f 6e 67 20 74 6f 20 74 e to belong to t
4b40: 68 65 20 73 61 6d 65 20 70 72 6f 6a 65 63 74 7d he same project}
4b50: 20 5c 0a 09 20 20 20 20 7b 3a 20 49 74 73 20 74 \.. {: Its t
4b60: 61 67 73 20 64 69 73 61 67 72 65 65 20 61 62 6f ags disagree abo
4b70: 75 74 20 74 68 65 20 70 72 6f 6a 65 63 74 20 74 ut the project t
4b80: 68 65 79 20 62 65 6c 6f 6e 67 20 74 6f 7d 20 7b hey belong to} {
4b90: 0a 09 09 53 45 4c 45 43 54 20 54 2e 6e 61 6d 65 ...SELECT T.name
4ba0: 2c 20 43 2e 63 69 64 0a 09 09 46 52 4f 4d 20 20 , C.cid...FROM
4bb0: 20 63 68 61 6e 67 65 73 65 74 20 43 2c 20 63 73 changeset C, cs
4bc0: 74 79 70 65 20 54 0a 09 09 57 48 45 52 45 20 20 type T...WHERE
4bd0: 43 2e 63 69 64 20 49 4e 20 28 53 45 4c 45 43 54 C.cid IN (SELECT
4be0: 20 55 2e 63 69 64 0a 09 09 09 09 20 46 52 4f 4d U.cid..... FROM
4bf0: 20 28 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 (SELECT DISTINC
4c00: 54 20 43 49 2e 63 69 64 20 41 53 20 63 69 64 2c T CI.cid AS cid,
4c10: 20 46 2e 70 69 64 20 41 53 20 70 69 64 0a 09 09 F.pid AS pid...
4c20: 09 09 20 20 20 20 20 20 20 46 52 4f 4d 20 20 20 .. FROM
4c30: 63 73 69 74 65 6d 20 43 49 2c 20 63 68 61 6e 67 csitem CI, chang
4c40: 65 73 65 74 20 43 2c 20 74 61 67 20 54 2c 20 66 eset C, tag T, f
4c50: 69 6c 65 20 46 0a 09 09 09 09 20 20 20 20 20 20 ile F.....
4c60: 20 57 48 45 52 45 20 20 43 49 2e 69 69 64 20 3d WHERE CI.iid =
4c70: 20 54 2e 74 69 64 0a 09 09 09 09 20 20 20 20 20 T.tid.....
4c80: 20 20 41 4e 44 20 20 20 20 43 2e 63 69 64 20 3d AND C.cid =
4c90: 20 43 49 2e 63 69 64 0a 09 09 09 09 20 20 20 20 CI.cid.....
4ca0: 20 20 20 41 4e 44 20 20 20 20 43 2e 74 79 70 65 AND C.type
4cb0: 20 3d 20 31 0a 09 09 09 09 20 20 20 20 20 20 20 = 1.....
4cc0: 41 4e 44 20 20 20 20 46 2e 66 69 64 20 20 3d 20 AND F.fid =
4cd0: 54 2e 66 69 64 29 20 41 53 20 55 0a 09 09 09 09 T.fid) AS U.....
4ce0: 20 47 52 4f 55 50 20 42 59 20 55 2e 63 69 64 20 GROUP BY U.cid
4cf0: 48 41 56 49 4e 47 20 43 4f 55 4e 54 28 55 2e 70 HAVING COUNT(U.p
4d00: 69 64 29 20 3e 20 31 29 0a 09 09 41 4e 44 20 20 id) > 1)...AND
4d10: 20 20 54 2e 74 69 64 20 3d 20 43 2e 74 79 70 65 T.tid = C.type
4d20: 0a 09 20 20 20 20 7d 0a 09 23 20 41 6c 6c 20 74 .. }..# All t
4d30: 61 67 73 20 69 6e 20 61 20 73 69 6e 67 6c 65 20 ags in a single
4d40: 63 68 61 6e 67 65 73 65 74 20 68 61 76 65 20 74 changeset have t
4d50: 6f 20 62 65 6c 6f 6e 67 20 74 6f 20 64 69 66 66 o belong to diff
4d60: 65 72 65 6e 74 0a 09 23 20 66 69 6c 65 73 2e 20 erent..# files.
4d70: 43 6f 6e 76 65 72 73 65 6c 79 3a 20 4e 6f 20 74 Conversely: No t
4d80: 77 6f 20 74 61 67 73 20 6f 66 20 61 20 73 69 6e wo tags of a sin
4d90: 67 6c 65 20 66 69 6c 65 20 61 72 65 20 61 6c 6c gle file are all
4da0: 6f 77 65 64 0a 09 23 20 74 6f 20 62 65 20 69 6e owed..# to be in
4db0: 20 74 68 65 20 73 61 6d 65 20 63 68 61 6e 67 65 the same change
4dc0: 73 65 74 2e 0a 09 23 0a 09 23 20 49 6e 73 74 65 set...#..# Inste
4dd0: 61 64 20 6f 66 20 6c 6f 6f 6b 69 6e 67 20 61 74 ad of looking at
4de0: 20 61 6c 6c 20 70 61 69 72 73 20 6f 66 20 74 61 all pairs of ta
4df0: 67 73 20 69 6e 20 61 6c 6c 20 63 68 61 6e 67 65 gs in all change
4e00: 73 65 74 73 20 77 65 0a 09 23 20 67 65 6e 65 72 sets we..# gener
4e10: 61 74 65 20 74 68 65 20 64 69 73 74 69 6e 63 74 ate the distinct
4e20: 20 73 65 74 20 6f 66 20 61 6c 6c 20 66 69 6c 65 set of all file
4e30: 73 20 72 65 66 65 72 65 6e 63 65 64 20 62 79 20 s referenced by
4e40: 74 68 65 0a 09 23 20 74 61 67 73 20 6f 66 20 61 the..# tags of a
4e50: 20 63 68 61 6e 67 65 73 65 74 2c 20 61 6e 64 20 changeset, and
4e60: 6c 6f 6f 6b 20 66 6f 72 20 74 68 6f 73 65 20 77 look for those w
4e70: 69 74 68 20 63 61 72 64 69 6e 61 6c 69 74 79 20 ith cardinality
4e80: 3c 0a 09 23 20 74 68 65 20 63 61 72 64 69 6e 61 <..# the cardina
4e90: 6c 69 74 79 20 6f 66 20 74 68 65 20 73 65 74 20 lity of the set
4ea0: 6f 66 20 74 61 67 73 2c 20 61 6e 64 20 67 65 74 of tags, and get
4eb0: 20 74 68 65 20 69 64 65 6e 74 69 66 79 69 6e 67 the identifying
4ec0: 0a 09 23 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 ..# information
4ed0: 66 6f 72 20 74 68 65 20 63 68 61 6e 67 65 73 65 for the changese
4ee0: 74 73 20 66 6f 75 6e 64 20 74 68 75 73 6c 79 2e ts found thusly.
4ef0: 0a 09 43 68 65 63 6b 43 53 20 5c 0a 09 20 20 20 ..CheckCS \..
4f00: 20 7b 41 6c 6c 20 74 61 67 73 20 69 6e 20 61 20 {All tags in a
4f10: 63 68 61 6e 67 65 73 65 74 20 68 61 76 65 20 74 changeset have t
4f20: 6f 20 62 65 6c 6f 6e 67 20 74 6f 20 64 69 66 66 o belong to diff
4f30: 65 72 65 6e 74 20 66 69 6c 65 73 7d 20 5c 0a 09 erent files} \..
4f40: 20 20 20 20 7b 3a 20 49 74 73 20 74 61 67 73 20 {: Its tags
4f50: 73 68 61 72 65 20 66 69 6c 65 73 7d 20 7b 0a 09 share files} {..
4f60: 09 53 45 4c 45 43 54 20 54 2e 6e 61 6d 65 2c 20 .SELECT T.name,
4f70: 43 2e 63 69 64 0a 09 09 46 52 4f 4d 20 20 20 63 C.cid...FROM c
4f80: 68 61 6e 67 65 73 65 74 20 43 2c 20 63 73 74 79 hangeset C, csty
4f90: 70 65 20 54 0a 09 09 57 48 45 52 45 20 20 43 2e pe T...WHERE C.
4fa0: 63 69 64 20 49 4e 20 28 53 45 4c 45 43 54 20 56 cid IN (SELECT V
4fb0: 56 2e 63 69 64 0a 09 09 09 09 20 46 52 4f 4d 20 V.cid..... FROM
4fc0: 28 53 45 4c 45 43 54 20 55 2e 63 69 64 20 61 73 (SELECT U.cid as
4fd0: 20 63 69 64 2c 20 43 4f 55 4e 54 20 28 55 2e 66 cid, COUNT (U.f
4fe0: 69 64 29 20 41 53 20 66 63 6f 75 6e 74 0a 09 09 id) AS fcount...
4ff0: 09 09 20 20 20 20 20 20 20 46 52 4f 4d 20 28 53 .. FROM (S
5000: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 43 ELECT DISTINCT C
5010: 49 2e 63 69 64 20 41 53 20 63 69 64 2c 20 54 2e I.cid AS cid, T.
5020: 66 69 64 20 41 53 20 66 69 64 0a 09 09 09 09 09 fid AS fid......
5030: 20 20 20 20 20 46 52 4f 4d 20 20 20 63 73 69 74 FROM csit
5040: 65 6d 20 43 49 2c 20 63 68 61 6e 67 65 73 65 74 em CI, changeset
5050: 20 43 2c 20 74 61 67 20 54 0a 09 09 09 09 09 20 C, tag T......
5060: 20 20 20 20 57 48 45 52 45 20 20 43 49 2e 69 69 WHERE CI.ii
5070: 64 20 3d 20 54 2e 74 69 64 0a 09 09 09 09 09 20 d = T.tid......
5080: 20 20 20 20 41 4e 44 20 20 20 20 43 2e 63 69 64 AND C.cid
5090: 20 3d 20 43 49 2e 63 69 64 0a 09 09 09 09 09 20 = CI.cid......
50a0: 20 20 20 20 41 4e 44 20 20 20 20 43 2e 74 79 70 AND C.typ
50b0: 65 20 3d 20 31 0a 09 09 09 09 09 20 20 20 20 20 e = 1......
50c0: 29 20 41 53 20 55 0a 09 09 09 09 20 20 20 20 20 ) AS U.....
50d0: 20 20 47 52 4f 55 50 20 42 59 20 55 2e 63 69 64 GROUP BY U.cid
50e0: 29 20 41 53 20 55 55 2c 0a 09 09 09 09 20 20 20 ) AS UU,.....
50f0: 20 20 20 28 53 45 4c 45 43 54 20 56 2e 63 69 64 (SELECT V.cid
5100: 20 41 53 20 63 69 64 2c 20 43 4f 55 4e 54 20 28 AS cid, COUNT (
5110: 56 2e 69 69 64 29 20 41 53 20 72 63 6f 75 6e 74 V.iid) AS rcount
5120: 0a 09 09 09 09 20 20 20 20 20 20 20 46 52 4f 4d ..... FROM
5130: 20 20 20 63 73 69 74 65 6d 20 56 2c 20 63 68 61 csitem V, cha
5140: 6e 67 65 73 65 74 20 58 0a 09 09 09 09 20 20 20 ngeset X.....
5150: 20 20 20 20 57 48 45 52 45 20 20 58 2e 63 69 64 WHERE X.cid
5160: 20 3d 20 56 2e 63 69 64 0a 09 09 09 09 20 20 20 = V.cid.....
5170: 20 20 20 20 41 4e 44 20 20 20 20 58 2e 74 79 70 AND X.typ
5180: 65 20 3d 20 31 0a 09 09 09 09 20 20 20 20 20 20 e = 1.....
5190: 20 47 52 4f 55 50 20 42 59 20 56 2e 63 69 64 29 GROUP BY V.cid)
51a0: 20 41 53 20 56 56 0a 09 09 09 09 20 57 48 45 52 AS VV..... WHER
51b0: 45 20 56 56 2e 63 69 64 20 3d 20 55 55 2e 63 69 E VV.cid = UU.ci
51c0: 64 0a 09 09 09 09 20 41 4e 44 20 20 20 55 55 2e d..... AND UU.
51d0: 66 63 6f 75 6e 74 20 3c 20 56 56 2e 72 63 6f 75 fcount < VV.rcou
51e0: 6e 74 29 0a 09 09 41 4e 44 20 20 20 20 54 2e 74 nt)...AND T.t
51f0: 69 64 20 3d 20 43 2e 74 79 70 65 0a 09 20 20 20 id = C.type..
5200: 20 7d 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 7d }..return. }
5210: 0a 0a 20 20 20 20 70 72 6f 63 20 42 72 61 6e 63 .. proc Branc
5220: 68 43 68 61 6e 67 65 73 65 74 73 20 7b 7d 20 7b hChangesets {} {
5230: 0a 09 23 20 54 68 69 73 20 63 6f 64 65 20 70 65 ..# This code pe
5240: 72 66 6f 72 6d 73 20 61 20 6e 75 6d 62 65 72 20 rforms a number
5250: 6f 66 20 70 61 72 61 6e 6f 69 64 20 63 68 65 63 of paranoid chec
5260: 6b 73 20 6f 66 20 74 68 65 0a 09 23 20 64 61 74 ks of the..# dat
5270: 61 62 61 73 65 2c 20 73 65 61 72 63 68 69 6e 67 abase, searching
5280: 20 66 6f 72 20 69 6e 63 6f 6e 73 69 73 74 65 6e for inconsisten
5290: 74 20 63 68 61 6e 67 65 73 65 74 2f 72 65 76 69 t changeset/revi
52a0: 73 69 6f 6e 0a 09 23 20 69 6e 66 6f 72 6d 61 74 sion..# informat
52b0: 69 6f 6e 2e 0a 0a 09 75 70 76 61 72 20 31 20 6e ion....upvar 1 n
52c0: 20 6e 20 3b 20 23 20 43 6f 75 6e 74 65 72 20 66 n ; # Counter f
52d0: 6f 72 20 74 68 65 20 63 68 65 63 6b 73 20 28 77 or the checks (w
52e0: 65 20 70 72 69 6e 74 20 61 6e 20 69 64 20 62 65 e print an id be
52f0: 66 6f 72 65 0a 09 09 20 20 20 20 20 20 23 20 74 fore... # t
5300: 68 65 20 6d 61 69 6e 20 6c 61 62 65 6c 29 2e 0a he main label)..
5310: 0a 09 23 20 46 69 6e 64 20 61 6c 6c 20 62 72 61 ..# Find all bra
5320: 6e 63 68 65 73 20 77 68 69 63 68 20 61 72 65 20 nches which are
5330: 6e 6f 74 20 75 73 65 64 20 62 79 20 61 74 20 6c not used by at l
5340: 65 61 73 74 20 6f 6e 65 0a 09 23 20 63 68 61 6e east one..# chan
5350: 67 65 73 65 74 2e 0a 09 43 68 65 63 6b 42 72 61 geset...CheckBra
5360: 6e 63 68 20 5c 0a 09 20 20 20 20 7b 41 6c 6c 20 nch \.. {All
5370: 62 72 61 6e 63 68 65 73 20 68 61 76 65 20 74 6f branches have to
5380: 20 62 65 20 75 73 65 64 20 62 79 20 6c 65 61 73 be used by leas
5390: 74 20 6f 6e 65 20 63 68 61 6e 67 65 73 65 74 7d t one changeset}
53a0: 20 5c 0a 09 20 20 20 20 7b 69 73 20 6e 6f 74 20 \.. {is not
53b0: 75 73 65 64 20 62 79 20 61 20 63 68 61 6e 67 65 used by a change
53c0: 73 65 74 7d 20 7b 0a 09 09 2d 2d 20 55 6e 75 73 set} {...-- Unus
53d0: 65 64 20 62 72 61 6e 63 68 65 73 20 3d 20 41 6c ed branches = Al
53e0: 6c 20 62 72 61 6e 63 68 65 73 0a 09 09 2d 2d 20 l branches...--
53f0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
5400: 2d 20 62 72 61 6e 63 68 65 73 20 75 73 65 64 20 - branches used
5410: 62 79 20 62 72 61 6e 63 68 20 63 68 61 6e 67 65 by branch change
5420: 73 65 74 73 2e 0a 09 09 2d 2d 0a 09 09 2d 2d 20 sets....--...--
5430: 42 6f 74 68 20 73 65 74 73 20 63 61 6e 20 62 65 Both sets can be
5440: 20 63 6f 6d 70 75 74 65 64 20 65 61 73 69 6c 79 computed easily
5450: 2c 20 61 6e 64 20 73 75 62 74 72 61 63 74 65 64 , and subtracted
5460: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
5470: 20 2d 2d 20 66 72 6f 6d 20 65 61 63 68 20 6f 74 -- from each ot
5480: 68 65 72 2e 20 54 68 65 6e 20 77 65 20 63 61 6e her. Then we can
5490: 20 67 65 74 20 74 68 65 20 61 73 73 6f 63 69 61 get the associa
54a0: 74 65 64 0a 20 20 20 20 20 20 20 20 20 20 20 20 ted.
54b0: 20 20 20 20 2d 2d 20 66 69 6c 65 20 28 6e 61 6d -- file (nam
54c0: 65 29 20 66 6f 72 20 64 69 73 70 6c 61 79 2e 0a e) for display..
54d0: 0a 09 09 53 45 4c 45 43 54 20 50 2e 6e 61 6d 65 ...SELECT P.name
54e0: 2c 20 53 2e 6e 61 6d 65 0a 09 09 46 52 4f 4d 20 , S.name...FROM
54f0: 70 72 6f 6a 65 63 74 20 50 2c 20 62 72 61 6e 63 project P, branc
5500: 68 20 42 2c 20 73 79 6d 62 6f 6c 20 53 0a 09 09 h B, symbol S...
5510: 57 48 45 52 45 20 42 2e 62 69 64 20 49 4e 20 28 WHERE B.bid IN (
5520: 53 45 4c 45 43 54 20 62 69 64 20 20 20 20 20 20 SELECT bid
5530: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2d 2d --
5540: 20 41 6c 6c 20 62 72 61 6e 63 68 65 73 0a 09 09 All branches...
5550: 09 09 46 52 4f 4d 20 20 20 62 72 61 6e 63 68 0a ..FROM branch.
5560: 09 09 09 09 45 58 43 45 50 54 20 20 20 20 20 20 ....EXCEPT
5570: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
5580: 20 20 2d 2d 20 73 75 62 74 72 61 63 74 0a 09 09 -- subtract...
5590: 09 09 53 45 4c 45 43 54 20 43 49 2e 69 69 64 20 ..SELECT CI.iid
55a0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
55b0: 2d 2d 20 62 72 61 6e 63 68 65 73 20 75 73 65 64 -- branches used
55c0: 0a 09 09 09 09 46 52 4f 4d 20 20 20 63 73 69 74 .....FROM csit
55d0: 65 6d 20 43 49 2c 20 63 68 61 6e 67 65 73 65 74 em CI, changeset
55e0: 20 43 0a 09 09 09 09 57 48 45 52 45 20 20 43 2e C.....WHERE C.
55f0: 63 69 64 20 3d 20 43 49 2e 63 69 64 20 20 20 20 cid = CI.cid
5600: 20 20 20 20 20 2d 2d 20 62 79 20 61 6e 79 20 62 -- by any b
5610: 72 61 6e 63 68 0a 09 09 09 09 41 4e 44 20 20 20 ranch.....AND
5620: 20 43 2e 74 79 70 65 20 3d 20 32 29 20 20 20 20 C.type = 2)
5630: 20 20 20 20 20 20 20 20 2d 2d 20 63 68 61 6e 67 -- chang
5640: 65 73 65 74 0a 09 09 41 4e 44 20 20 20 53 2e 73 eset...AND S.s
5650: 69 64 20 3d 20 42 2e 73 69 64 20 20 20 20 20 20 id = B.sid
5660: 20 20 20 20 20 20 20 20 20 2d 2d 20 67 65 74 20 -- get
5670: 73 79 6d 62 6f 6c 20 6f 66 20 62 72 61 6e 63 68 symbol of branch
5680: 0a 09 09 41 4e 44 20 20 20 50 2e 70 69 64 20 3d ...AND P.pid =
5690: 20 53 2e 70 69 64 20 20 20 20 20 20 20 20 20 20 S.pid
56a0: 20 20 20 20 20 2d 2d 20 67 65 74 20 70 72 6f 6a -- get proj
56b0: 65 63 74 20 6f 66 20 73 79 6d 62 6f 6c 0a 09 20 ect of symbol..
56c0: 20 20 20 7d 0a 09 23 20 46 69 6e 64 20 61 6c 6c }..# Find all
56d0: 20 62 72 61 6e 63 68 65 73 20 77 68 69 63 68 20 branches which
56e0: 61 72 65 20 75 73 65 64 20 62 79 20 6d 6f 72 65 are used by more
56f0: 20 74 68 61 6e 20 6f 6e 65 20 63 68 61 6e 67 65 than one change
5700: 73 65 74 2e 0a 09 43 68 65 63 6b 52 65 76 20 5c set...CheckRev \
5710: 0a 09 20 20 20 20 7b 41 6c 6c 20 62 72 61 6e 63 .. {All branc
5720: 68 65 73 20 68 61 76 65 20 74 6f 20 62 65 20 75 hes have to be u
5730: 73 65 64 20 62 79 20 61 74 20 6d 6f 73 74 20 6f sed by at most o
5740: 6e 65 20 63 68 61 6e 67 65 73 65 74 7d 20 5c 0a ne changeset} \.
5750: 09 20 20 20 20 7b 69 73 20 75 73 65 64 20 62 79 . {is used by
5760: 20 6d 75 6c 74 69 70 6c 65 20 63 68 61 6e 67 65 multiple change
5770: 73 65 74 73 7d 20 7b 0a 09 09 2d 2d 20 50 72 69 sets} {...-- Pri
5780: 6e 63 69 70 6c 65 20 6f 66 20 6f 70 65 72 61 74 nciple of operat
5790: 69 6f 6e 3a 20 47 65 74 20 61 6c 6c 20 62 72 61 ion: Get all bra
57a0: 6e 63 68 2f 63 68 61 6e 67 65 73 65 74 0a 20 20 nch/changeset.
57b0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2d 2d --
57c0: 20 70 61 69 72 73 20 66 6f 72 20 61 6c 6c 20 62 pairs for all b
57d0: 72 61 6e 63 68 20 63 68 61 6e 67 65 73 65 74 73 ranch changesets
57e0: 2c 20 67 72 6f 75 70 20 62 79 20 74 61 67 20 74 , group by tag t
57f0: 6f 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 o.
5800: 20 20 2d 2d 20 61 67 67 72 65 67 61 74 65 20 74 -- aggregate t
5810: 68 65 20 63 68 61 6e 67 65 73 65 74 2c 20 63 6f he changeset, co
5820: 75 6e 74 69 6e 67 20 74 68 65 6d 2e 20 46 72 6f unting them. Fro
5830: 6d 20 74 68 65 0a 20 20 20 20 20 20 20 20 20 20 m the.
5840: 20 20 20 20 20 20 2d 2d 20 72 65 73 75 6c 74 69 -- resulti
5850: 6e 67 20 62 72 61 6e 63 68 2f 63 6f 75 6e 74 20 ng branch/count
5860: 74 61 62 6c 65 20 73 65 6c 65 63 74 20 74 68 6f table select tho
5870: 73 65 20 77 69 74 68 20 6d 6f 72 65 0a 20 20 20 se with more.
5880: 20 20 20 20 20 20 20 20 20 20 20 20 20 2d 2d 20 --
5890: 74 68 61 6e 20 6f 6e 65 20 75 73 65 72 2c 20 61 than one user, a
58a0: 6e 64 20 67 65 74 20 74 68 65 69 72 20 61 73 73 nd get their ass
58b0: 6f 63 69 61 74 65 64 20 66 69 6c 65 20 28 6e 61 ociated file (na
58c0: 6d 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 me).
58d0: 20 20 20 20 2d 2d 20 66 6f 72 20 64 69 73 70 6c -- for displ
58e0: 61 79 2e 0a 0a 09 09 53 45 4c 45 43 54 20 50 2e ay.....SELECT P.
58f0: 6e 61 6d 65 2c 20 53 2e 6e 61 6d 65 0a 09 09 46 name, S.name...F
5900: 52 4f 4d 20 62 72 61 6e 63 68 20 42 2c 20 70 72 ROM branch B, pr
5910: 6f 6a 65 63 74 20 50 2c 20 73 79 6d 62 6f 6c 20 oject P, symbol
5920: 53 2c 0a 09 09 20 20 20 20 20 28 53 45 4c 45 43 S,... (SELEC
5930: 54 20 43 49 2e 69 69 64 20 41 53 20 69 69 64 2c T CI.iid AS iid,
5940: 20 63 6f 75 6e 74 28 43 49 2e 63 69 64 29 20 41 count(CI.cid) A
5950: 53 20 63 6f 75 6e 74 0a 09 09 20 20 20 20 20 20 S count...
5960: 46 52 4f 4d 20 63 73 69 74 65 6d 20 43 49 2c 20 FROM csitem CI,
5970: 63 68 61 6e 67 65 73 65 74 20 43 0a 09 09 20 20 changeset C...
5980: 20 20 20 20 57 48 45 52 45 20 43 2e 74 79 70 65 WHERE C.type
5990: 20 3d 20 32 0a 09 09 20 20 20 20 20 20 41 4e 44 = 2... AND
59a0: 20 20 20 43 2e 63 69 64 20 3d 20 43 49 2e 63 69 C.cid = CI.ci
59b0: 64 0a 09 09 20 20 20 20 20 20 47 52 4f 55 50 20 d... GROUP
59c0: 42 59 20 43 49 2e 69 69 64 20 29 20 41 53 20 55 BY CI.iid ) AS U
59d0: 0a 09 09 57 48 45 52 45 20 55 2e 63 6f 75 6e 74 ...WHERE U.count
59e0: 20 3e 20 31 0a 09 09 41 4e 44 20 20 20 42 2e 62 > 1...AND B.b
59f0: 69 64 20 3d 20 55 2e 69 69 64 0a 09 09 41 4e 44 id = U.iid...AND
5a00: 20 20 20 53 2e 73 69 64 20 3d 20 42 2e 73 69 64 S.sid = B.sid
5a10: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2d -
5a20: 2d 20 67 65 74 20 73 79 6d 62 6f 6c 20 6f 66 20 - get symbol of
5a30: 62 72 61 6e 63 68 0a 09 09 41 4e 44 20 20 20 50 branch...AND P
5a40: 2e 70 69 64 20 3d 20 53 2e 70 69 64 20 20 20 20 .pid = S.pid
5a50: 20 20 20 20 20 20 20 20 20 20 20 2d 2d 20 67 65 -- ge
5a60: 74 20 70 72 6f 6a 65 63 74 20 6f 66 20 73 79 6d t project of sym
5a70: 62 6f 6c 0a 09 20 20 20 20 7d 0a 09 23 20 41 6c bol.. }..# Al
5a80: 6c 20 62 72 61 6e 63 68 65 73 20 68 61 76 65 20 l branches have
5a90: 74 6f 20 61 67 72 65 65 20 6f 6e 20 74 68 65 20 to agree on the
5aa0: 4c 4f 44 20 74 68 65 69 72 20 63 68 61 6e 67 65 LOD their change
5ab0: 73 65 74 0a 09 23 20 62 65 6c 6f 6e 67 73 20 74 set..# belongs t
5ac0: 6f 2e 20 49 6e 20 6f 74 68 65 72 20 77 6f 72 64 o. In other word
5ad0: 73 2c 20 61 6c 6c 20 62 72 61 6e 63 68 65 73 20 s, all branches
5ae0: 69 6e 20 61 20 63 68 61 6e 67 65 73 65 74 20 68 in a changeset h
5af0: 61 76 65 0a 09 23 20 74 6f 20 72 65 66 65 72 20 ave..# to refer
5b00: 74 6f 20 74 68 65 20 73 61 6d 65 20 6c 69 6e 65 to the same line
5b10: 20 6f 66 20 64 65 76 65 6c 6f 70 6d 65 6e 74 2e of development.
5b20: 0a 09 23 0a 09 23 20 49 6e 73 74 65 61 64 20 6f ..#..# Instead o
5b30: 66 20 6c 6f 6f 6b 69 6e 67 20 61 74 20 61 6c 6c f looking at all
5b40: 20 70 61 69 72 73 20 6f 66 20 62 72 61 6e 63 68 pairs of branch
5b50: 65 73 20 69 6e 20 61 6c 6c 0a 09 23 20 63 68 61 es in all..# cha
5b60: 6e 67 65 73 65 74 73 20 77 65 20 67 65 6e 65 72 ngesets we gener
5b70: 61 74 65 20 74 68 65 20 64 69 73 74 69 6e 63 74 ate the distinct
5b80: 20 73 65 74 20 6f 66 20 61 6c 6c 20 4c 4f 44 73 set of all LODs
5b90: 0a 09 23 20 72 65 66 65 72 65 6e 63 65 64 20 62 ..# referenced b
5ba0: 79 20 74 68 65 20 62 72 61 6e 63 68 65 73 20 6f y the branches o
5bb0: 66 20 61 20 63 68 61 6e 67 65 73 65 74 2c 20 6c f a changeset, l
5bc0: 6f 6f 6b 20 66 6f 72 20 74 68 6f 73 65 0a 09 23 ook for those..#
5bd0: 20 77 69 74 68 20 63 61 72 64 69 6e 61 6c 69 74 with cardinalit
5be0: 79 20 3e 20 31 2c 20 61 6e 64 20 67 65 74 20 74 y > 1, and get t
5bf0: 68 65 20 69 64 65 6e 74 69 66 79 69 6e 67 20 69 he identifying i
5c00: 6e 66 6f 72 6d 61 74 69 6f 6e 0a 09 23 20 66 6f nformation..# fo
5c10: 72 20 74 68 65 20 63 68 61 6e 67 65 73 65 74 73 r the changesets
5c20: 20 66 6f 75 6e 64 20 74 68 75 73 6c 79 2e 0a 09 found thusly...
5c30: 43 68 65 63 6b 43 53 20 5c 0a 09 20 20 20 20 7b CheckCS \.. {
5c40: 41 6c 6c 20 62 72 61 6e 63 68 65 73 20 69 6e 20 All branches in
5c50: 61 20 63 68 61 6e 67 65 73 65 74 20 68 61 76 65 a changeset have
5c60: 20 74 6f 20 62 65 6c 6f 6e 67 20 74 6f 20 74 68 to belong to th
5c70: 65 20 73 61 6d 65 20 4c 4f 44 7d 20 5c 0a 09 20 e same LOD} \..
5c80: 20 20 20 7b 3a 20 49 74 73 20 62 72 61 6e 63 68 {: Its branch
5c90: 65 73 20 64 69 73 61 67 72 65 65 20 61 62 6f 75 es disagree abou
5ca0: 74 20 74 68 65 20 4c 4f 44 20 74 68 65 79 20 62 t the LOD they b
5cb0: 65 6c 6f 6e 67 20 74 6f 7d 20 7b 0a 09 09 53 45 elong to} {...SE
5cc0: 4c 45 43 54 20 54 2e 6e 61 6d 65 2c 20 43 2e 63 LECT T.name, C.c
5cd0: 69 64 0a 09 09 46 52 4f 4d 20 20 20 63 68 61 6e id...FROM chan
5ce0: 67 65 73 65 74 20 43 2c 20 63 73 74 79 70 65 20 geset C, cstype
5cf0: 54 0a 09 09 57 48 45 52 45 20 20 43 2e 63 69 64 T...WHERE C.cid
5d00: 20 49 4e 20 28 53 45 4c 45 43 54 20 55 2e 63 69 IN (SELECT U.ci
5d10: 64 0a 09 09 09 09 20 46 52 4f 4d 20 28 53 45 4c d..... FROM (SEL
5d20: 45 43 54 20 44 49 53 54 49 4e 43 54 20 43 49 2e ECT DISTINCT CI.
5d30: 63 69 64 20 41 53 20 63 69 64 2c 20 42 2e 6c 6f cid AS cid, B.lo
5d40: 64 20 41 53 20 6c 6f 64 0a 09 09 09 09 20 20 20 d AS lod.....
5d50: 20 20 20 20 46 52 4f 4d 20 20 20 63 73 69 74 65 FROM csite
5d60: 6d 20 43 49 2c 20 63 68 61 6e 67 65 73 65 74 20 m CI, changeset
5d70: 43 2c 20 62 72 61 6e 63 68 20 42 0a 09 09 09 09 C, branch B.....
5d80: 20 20 20 20 20 20 20 57 48 45 52 45 20 20 43 49 WHERE CI
5d90: 2e 69 69 64 20 3d 20 42 2e 62 69 64 0a 09 09 09 .iid = B.bid....
5da0: 09 20 20 20 20 20 20 20 41 4e 44 20 20 20 20 43 . AND C
5db0: 2e 63 69 64 20 3d 20 43 49 2e 63 69 64 0a 09 09 .cid = CI.cid...
5dc0: 09 09 20 20 20 20 20 20 20 41 4e 44 20 20 20 20 .. AND
5dd0: 43 2e 74 79 70 65 20 3d 20 32 29 20 41 53 20 55 C.type = 2) AS U
5de0: 0a 09 09 09 09 20 47 52 4f 55 50 20 42 59 20 55 ..... GROUP BY U
5df0: 2e 63 69 64 20 48 41 56 49 4e 47 20 43 4f 55 4e .cid HAVING COUN
5e00: 54 28 55 2e 6c 6f 64 29 20 3e 20 31 29 0a 09 09 T(U.lod) > 1)...
5e10: 41 4e 44 20 20 20 20 54 2e 74 69 64 20 3d 20 43 AND T.tid = C
5e20: 2e 74 79 70 65 0a 09 20 20 20 20 7d 0a 09 23 20 .type.. }..#
5e30: 41 6c 6c 20 62 72 61 6e 63 68 65 73 20 68 61 76 All branches hav
5e40: 65 20 74 6f 20 61 67 72 65 65 20 6f 6e 20 74 68 e to agree on th
5e50: 65 20 70 72 6f 6a 65 63 74 20 74 68 65 69 72 20 e project their
5e60: 63 68 61 6e 67 65 73 65 74 0a 09 23 20 62 65 6c changeset..# bel
5e70: 6f 6e 67 73 20 74 6f 2e 20 49 6e 20 6f 74 68 65 ongs to. In othe
5e80: 72 20 77 6f 72 64 73 2c 20 61 6c 6c 20 62 72 61 r words, all bra
5e90: 6e 63 68 65 73 20 69 6e 20 61 20 63 68 61 6e 67 nches in a chang
5ea0: 65 73 65 74 20 68 61 76 65 0a 09 23 20 74 6f 20 eset have..# to
5eb0: 72 65 66 65 72 20 74 6f 20 74 68 65 20 73 61 6d refer to the sam
5ec0: 65 20 70 72 6f 6a 65 63 74 2e 0a 09 23 0a 09 23 e project...#..#
5ed0: 20 49 6e 73 74 65 61 64 20 6f 66 20 6c 6f 6f 6b Instead of look
5ee0: 69 6e 67 20 61 74 20 61 6c 6c 20 70 61 69 72 73 ing at all pairs
5ef0: 20 6f 66 20 62 72 61 6e 63 68 65 73 20 69 6e 20 of branches in
5f00: 61 6c 6c 0a 09 23 20 63 68 61 6e 67 65 73 65 74 all..# changeset
5f10: 73 20 77 65 20 67 65 6e 65 72 61 74 65 20 74 68 s we generate th
5f20: 65 20 64 69 73 74 69 6e 63 74 20 73 65 74 20 6f e distinct set o
5f30: 66 20 61 6c 6c 20 70 72 6f 6a 65 63 74 73 0a 09 f all projects..
5f40: 23 20 72 65 66 65 72 65 6e 63 65 64 20 62 79 20 # referenced by
5f50: 74 68 65 20 62 72 61 6e 63 68 65 73 20 6f 66 20 the branches of
5f60: 61 20 63 68 61 6e 67 65 73 65 74 2c 20 6c 6f 6f a changeset, loo
5f70: 6b 20 66 6f 72 20 74 68 6f 73 65 0a 09 23 20 77 k for those..# w
5f80: 69 74 68 20 63 61 72 64 69 6e 61 6c 69 74 79 20 ith cardinality
5f90: 3e 20 31 2c 20 61 6e 64 20 67 65 74 20 74 68 65 > 1, and get the
5fa0: 20 69 64 65 6e 74 69 66 79 69 6e 67 20 69 6e 66 identifying inf
5fb0: 6f 72 6d 61 74 69 6f 6e 0a 09 23 20 66 6f 72 20 ormation..# for
5fc0: 74 68 65 20 63 68 61 6e 67 65 73 65 74 73 20 66 the changesets f
5fd0: 6f 75 6e 64 20 74 68 75 73 6c 79 2e 0a 09 43 68 ound thusly...Ch
5fe0: 65 63 6b 43 53 20 5c 0a 09 20 20 20 20 7b 41 6c eckCS \.. {Al
5ff0: 6c 20 62 72 61 6e 63 68 65 73 20 69 6e 20 61 20 l branches in a
6000: 63 68 61 6e 67 65 73 65 74 20 68 61 76 65 20 74 changeset have t
6010: 6f 20 62 65 6c 6f 6e 67 20 74 6f 20 74 68 65 20 o belong to the
6020: 73 61 6d 65 20 70 72 6f 6a 65 63 74 7d 20 5c 0a same project} \.
6030: 09 20 20 20 20 7b 3a 20 49 74 73 20 62 72 61 6e . {: Its bran
6040: 63 68 65 73 20 64 69 73 61 67 72 65 65 20 61 62 ches disagree ab
6050: 6f 75 74 20 74 68 65 20 70 72 6f 6a 65 63 74 20 out the project
6060: 74 68 65 79 20 62 65 6c 6f 6e 67 20 74 6f 7d 20 they belong to}
6070: 7b 0a 09 09 53 45 4c 45 43 54 20 54 2e 6e 61 6d {...SELECT T.nam
6080: 65 2c 20 43 2e 63 69 64 0a 09 09 46 52 4f 4d 20 e, C.cid...FROM
6090: 20 20 63 68 61 6e 67 65 73 65 74 20 43 2c 20 63 changeset C, c
60a0: 73 74 79 70 65 20 54 0a 09 09 57 48 45 52 45 20 stype T...WHERE
60b0: 20 43 2e 63 69 64 20 49 4e 20 28 53 45 4c 45 43 C.cid IN (SELEC
60c0: 54 20 55 2e 63 69 64 0a 09 09 09 09 20 46 52 4f T U.cid..... FRO
60d0: 4d 20 28 53 45 4c 45 43 54 20 44 49 53 54 49 4e M (SELECT DISTIN
60e0: 43 54 20 43 49 2e 63 69 64 20 41 53 20 63 69 64 CT CI.cid AS cid
60f0: 2c 20 46 2e 70 69 64 20 41 53 20 70 69 64 0a 09 , F.pid AS pid..
6100: 09 09 09 20 20 20 20 20 20 20 46 52 4f 4d 20 20 ... FROM
6110: 20 63 73 69 74 65 6d 20 43 49 2c 20 63 68 61 6e csitem CI, chan
6120: 67 65 73 65 74 20 43 2c 20 62 72 61 6e 63 68 20 geset C, branch
6130: 42 2c 20 66 69 6c 65 20 46 0a 09 09 09 09 20 20 B, file F.....
6140: 20 20 20 20 20 57 48 45 52 45 20 20 43 49 2e 69 WHERE CI.i
6150: 69 64 20 3d 20 42 2e 62 69 64 0a 09 09 09 09 20 id = B.bid.....
6160: 20 20 20 20 20 20 41 4e 44 20 20 20 20 43 2e 63 AND C.c
6170: 69 64 20 3d 20 43 49 2e 63 69 64 0a 09 09 09 09 id = CI.cid.....
6180: 20 20 20 20 20 20 20 41 4e 44 20 20 20 20 43 2e AND C.
6190: 74 79 70 65 20 3d 20 32 0a 09 09 09 09 20 20 20 type = 2.....
61a0: 20 20 20 20 41 4e 44 20 20 20 20 46 2e 66 69 64 AND F.fid
61b0: 20 20 3d 20 42 2e 66 69 64 29 20 41 53 20 55 0a = B.fid) AS U.
61c0: 09 09 09 09 20 47 52 4f 55 50 20 42 59 20 55 2e .... GROUP BY U.
61d0: 63 69 64 20 48 41 56 49 4e 47 20 43 4f 55 4e 54 cid HAVING COUNT
61e0: 28 55 2e 70 69 64 29 20 3e 20 31 29 0a 09 09 41 (U.pid) > 1)...A
61f0: 4e 44 20 20 20 20 54 2e 74 69 64 20 3d 20 43 2e ND T.tid = C.
6200: 74 79 70 65 0a 09 20 20 20 20 7d 0a 09 23 20 41 type.. }..# A
6210: 6c 6c 20 62 72 61 6e 63 68 65 73 20 69 6e 20 61 ll branches in a
6220: 20 73 69 6e 67 6c 65 20 63 68 61 6e 67 65 73 65 single changese
6230: 74 20 68 61 76 65 20 74 6f 20 62 65 6c 6f 6e 67 t have to belong
6240: 20 74 6f 0a 09 23 20 64 69 66 66 65 72 65 6e 74 to..# different
6250: 20 66 69 6c 65 73 2e 20 43 6f 6e 76 65 72 73 65 files. Converse
6260: 6c 79 3a 20 4e 6f 20 74 77 6f 20 62 72 61 6e 63 ly: No two branc
6270: 68 65 73 20 6f 66 20 61 20 73 69 6e 67 6c 65 0a hes of a single.
6280: 09 23 20 66 69 6c 65 20 61 72 65 20 61 6c 6c 6f .# file are allo
6290: 77 65 64 20 74 6f 20 62 65 20 69 6e 20 74 68 65 wed to be in the
62a0: 20 73 61 6d 65 20 63 68 61 6e 67 65 73 65 74 2e same changeset.
62b0: 0a 09 23 0a 09 23 20 49 6e 73 74 65 61 64 20 6f ..#..# Instead o
62c0: 66 20 6c 6f 6f 6b 69 6e 67 20 61 74 20 61 6c 6c f looking at all
62d0: 20 70 61 69 72 73 20 6f 66 20 62 72 61 6e 63 68 pairs of branch
62e0: 65 73 20 69 6e 20 61 6c 6c 0a 09 23 20 63 68 61 es in all..# cha
62f0: 6e 67 65 73 65 74 73 20 77 65 20 67 65 6e 65 72 ngesets we gener
6300: 61 74 65 20 74 68 65 20 64 69 73 74 69 6e 63 74 ate the distinct
6310: 20 73 65 74 20 6f 66 20 61 6c 6c 20 66 69 6c 65 set of all file
6320: 73 0a 09 23 20 72 65 66 65 72 65 6e 63 65 64 20 s..# referenced
6330: 62 79 20 74 68 65 20 62 72 61 6e 63 68 65 73 20 by the branches
6340: 6f 66 20 61 20 63 68 61 6e 67 65 73 65 74 2c 20 of a changeset,
6350: 61 6e 64 20 6c 6f 6f 6b 20 66 6f 72 0a 09 23 20 and look for..#
6360: 74 68 6f 73 65 20 77 69 74 68 20 63 61 72 64 69 those with cardi
6370: 6e 61 6c 69 74 79 20 3c 20 74 68 65 20 63 61 72 nality < the car
6380: 64 69 6e 61 6c 69 74 79 20 6f 66 20 74 68 65 20 dinality of the
6390: 73 65 74 20 6f 66 0a 09 23 20 62 72 61 6e 63 68 set of..# branch
63a0: 65 73 2c 20 61 6e 64 20 67 65 74 20 74 68 65 20 es, and get the
63b0: 69 64 65 6e 74 69 66 79 69 6e 67 20 69 6e 66 6f identifying info
63c0: 72 6d 61 74 69 6f 6e 20 66 6f 72 20 74 68 65 0a rmation for the.
63d0: 09 23 20 63 68 61 6e 67 65 73 65 74 73 20 66 6f .# changesets fo
63e0: 75 6e 64 20 74 68 75 73 6c 79 2e 0a 09 43 68 65 und thusly...Che
63f0: 63 6b 43 53 20 5c 0a 09 20 20 20 20 7b 41 6c 6c ckCS \.. {All
6400: 20 62 72 61 6e 63 68 65 73 20 69 6e 20 61 20 63 branches in a c
6410: 68 61 6e 67 65 73 65 74 20 68 61 76 65 20 74 6f hangeset have to
6420: 20 62 65 6c 6f 6e 67 20 74 6f 20 64 69 66 66 65 belong to diffe
6430: 72 65 6e 74 20 66 69 6c 65 73 7d 20 5c 0a 09 20 rent files} \..
6440: 20 20 20 7b 3a 20 49 74 73 20 62 72 61 6e 63 68 {: Its branch
6450: 65 73 20 73 68 61 72 65 20 66 69 6c 65 73 7d 20 es share files}
6460: 7b 0a 09 09 53 45 4c 45 43 54 20 54 2e 6e 61 6d {...SELECT T.nam
6470: 65 2c 20 43 2e 63 69 64 0a 09 09 46 52 4f 4d 20 e, C.cid...FROM
6480: 20 20 63 68 61 6e 67 65 73 65 74 20 43 2c 20 63 changeset C, c
6490: 73 74 79 70 65 20 54 0a 09 09 57 48 45 52 45 20 stype T...WHERE
64a0: 20 43 2e 63 69 64 20 49 4e 20 28 53 45 4c 45 43 C.cid IN (SELEC
64b0: 54 20 56 56 2e 63 69 64 0a 09 09 09 09 20 46 52 T VV.cid..... FR
64c0: 4f 4d 20 28 53 45 4c 45 43 54 20 55 2e 63 69 64 OM (SELECT U.cid
64d0: 20 61 73 20 63 69 64 2c 20 43 4f 55 4e 54 20 28 as cid, COUNT (
64e0: 55 2e 66 69 64 29 20 41 53 20 66 63 6f 75 6e 74 U.fid) AS fcount
64f0: 0a 09 09 09 09 20 20 20 20 20 20 20 46 52 4f 4d ..... FROM
6500: 20 28 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 (SELECT DISTINC
6510: 54 20 43 49 2e 63 69 64 20 41 53 20 63 69 64 2c T CI.cid AS cid,
6520: 20 42 2e 66 69 64 20 41 53 20 66 69 64 0a 09 09 B.fid AS fid...
6530: 09 09 09 20 20 20 20 20 46 52 4f 4d 20 20 20 63 ... FROM c
6540: 73 69 74 65 6d 20 43 49 2c 20 63 68 61 6e 67 65 sitem CI, change
6550: 73 65 74 20 43 2c 20 62 72 61 6e 63 68 20 42 0a set C, branch B.
6560: 09 09 09 09 09 20 20 20 20 20 57 48 45 52 45 20 ..... WHERE
6570: 20 43 49 2e 69 69 64 20 3d 20 42 2e 62 69 64 0a CI.iid = B.bid.
6580: 09 09 09 09 09 20 20 20 20 20 41 4e 44 20 20 20 ..... AND
6590: 20 43 2e 63 69 64 20 3d 20 43 49 2e 63 69 64 0a C.cid = CI.cid.
65a0: 09 09 09 09 09 20 20 20 20 20 41 4e 44 20 20 20 ..... AND
65b0: 20 43 2e 74 79 70 65 20 3d 20 32 0a 09 09 09 09 C.type = 2.....
65c0: 09 20 20 20 20 20 29 20 41 53 20 55 0a 09 09 09 . ) AS U....
65d0: 09 20 20 20 20 20 20 20 47 52 4f 55 50 20 42 59 . GROUP BY
65e0: 20 55 2e 63 69 64 29 20 41 53 20 55 55 2c 0a 09 U.cid) AS UU,..
65f0: 09 09 09 20 20 20 20 20 20 28 53 45 4c 45 43 54 ... (SELECT
6600: 20 56 2e 63 69 64 20 41 53 20 63 69 64 2c 20 43 V.cid AS cid, C
6610: 4f 55 4e 54 20 28 56 2e 69 69 64 29 20 41 53 20 OUNT (V.iid) AS
6620: 72 63 6f 75 6e 74 0a 09 09 09 09 20 20 20 20 20 rcount.....
6630: 20 20 46 52 4f 4d 20 20 20 63 73 69 74 65 6d 20 FROM csitem
6640: 56 2c 20 63 68 61 6e 67 65 73 65 74 20 58 0a 09 V, changeset X..
6650: 09 09 09 20 20 20 20 20 20 20 57 48 45 52 45 20 ... WHERE
6660: 20 58 2e 63 69 64 20 3d 20 56 2e 63 69 64 0a 09 X.cid = V.cid..
6670: 09 09 09 20 20 20 20 20 20 20 41 4e 44 20 20 20 ... AND
6680: 20 58 2e 74 79 70 65 20 3d 20 32 0a 09 09 09 09 X.type = 2.....
6690: 20 20 20 20 20 20 20 47 52 4f 55 50 20 42 59 20 GROUP BY
66a0: 56 2e 63 69 64 29 20 41 53 20 56 56 0a 09 09 09 V.cid) AS VV....
66b0: 09 20 57 48 45 52 45 20 56 56 2e 63 69 64 20 3d . WHERE VV.cid =
66c0: 20 55 55 2e 63 69 64 0a 09 09 09 09 20 41 4e 44 UU.cid..... AND
66d0: 20 20 20 55 55 2e 66 63 6f 75 6e 74 20 3c 20 56 UU.fcount < V
66e0: 56 2e 72 63 6f 75 6e 74 29 0a 09 09 41 4e 44 20 V.rcount)...AND
66f0: 20 20 20 54 2e 74 69 64 20 3d 20 43 2e 74 79 70 T.tid = C.typ
6700: 65 0a 09 20 20 20 20 7d 0a 09 72 65 74 75 72 6e e.. }..return
6710: 0a 20 20 20 20 7d 0a 0a 20 20 20 20 70 72 6f 63 . }.. proc
6720: 20 4c 6f 6f 70 43 68 65 63 6b 20 7b 63 73 65 74 LoopCheck {cset
6730: 73 7d 20 7b 0a 09 3a 3a 76 61 72 69 61 62 6c 65 s} {..::variable
6740: 20 6d 79 6c 6f 6f 70 63 68 65 63 6b 0a 09 69 66 myloopcheck..if
6750: 20 7b 21 24 6d 79 6c 6f 6f 70 63 68 65 63 6b 7d {!$myloopcheck}
6760: 20 72 65 74 75 72 6e 0a 0a 09 6c 6f 67 20 77 72 return...log wr
6770: 69 74 65 20 34 20 69 6e 74 65 67 72 69 74 79 20 ite 4 integrity
6780: 7b 43 68 65 63 6b 69 6e 67 20 63 68 61 6e 67 65 {Checking change
6790: 73 65 74 73 20 66 6f 72 20 73 65 6c 66 2d 72 65 sets for self-re
67a0: 66 65 72 65 6e 63 65 73 7d 0a 0a 09 66 6f 72 65 ferences}...fore
67b0: 61 63 68 20 63 73 65 74 20 24 63 73 65 74 73 20 ach cset $csets
67c0: 7b 0a 09 20 20 20 20 69 66 20 7b 5b 24 63 73 65 {.. if {[$cse
67d0: 74 20 6c 6f 6f 70 63 68 65 63 6b 5d 7d 20 7b 0a t loopcheck]} {.
67e0: 09 09 74 72 6f 75 62 6c 65 20 66 61 74 61 6c 20 ..trouble fatal
67f0: 22 5b 24 63 73 65 74 20 73 74 72 5d 20 64 65 70 "[$cset str] dep
6800: 65 6e 64 73 20 6f 6e 20 69 74 73 65 6c 66 22 0a ends on itself".
6810: 09 20 20 20 20 7d 0a 09 7d 0a 09 72 65 74 75 72 . }..}..retur
6820: 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 70 72 6f n. }.. pro
6830: 63 20 5f 5f 5f 55 6e 75 73 65 64 43 68 61 6e 67 c ___UnusedChang
6840: 65 73 65 74 43 68 65 63 6b 73 5f 5f 5f 20 7b 7d esetChecks___ {}
6850: 20 7b 0a 09 23 20 54 68 69 73 20 63 6f 64 65 20 {..# This code
6860: 70 65 72 66 6f 72 6d 73 20 61 20 6e 75 6d 62 65 performs a numbe
6870: 72 20 6f 66 20 70 61 72 61 6e 6f 69 64 20 63 68 r of paranoid ch
6880: 65 63 6b 73 20 6f 66 20 74 68 65 0a 09 23 20 64 ecks of the..# d
6890: 61 74 61 62 61 73 65 2c 20 73 65 61 72 63 68 69 atabase, searchi
68a0: 6e 67 20 66 6f 72 20 69 6e 63 6f 6e 73 69 73 74 ng for inconsist
68b0: 65 6e 74 20 63 68 61 6e 67 65 73 65 74 2f 72 65 ent changeset/re
68c0: 76 69 73 69 6f 6e 0a 09 23 20 69 6e 66 6f 72 6d vision..# inform
68d0: 61 74 69 6f 6e 2e 0a 0a 09 72 65 74 75 72 6e 20 ation....return
68e0: 3b 20 23 20 44 69 73 61 62 6c 65 64 20 66 6f 72 ; # Disabled for
68f0: 20 6e 6f 77 2c 20 62 6f 74 74 6c 65 6e 65 63 6b now, bottleneck
6900: 73 20 2e 2e 2e 0a 0a 09 75 70 76 61 72 20 31 20 s ......upvar 1
6910: 6e 20 6e 20 3b 20 23 20 43 6f 75 6e 74 65 72 20 n n ; # Counter
6920: 66 6f 72 20 74 68 65 20 63 68 65 63 6b 73 20 28 for the checks (
6930: 77 65 20 70 72 69 6e 74 20 61 6e 20 69 64 20 62 we print an id b
6940: 65 66 6f 72 65 0a 09 09 20 20 20 20 20 20 23 20 efore... #
6950: 74 68 65 20 6d 61 69 6e 20 6c 61 62 65 6c 29 2e the main label).
6960: 0a 0a 09 23 20 54 68 65 20 6e 65 78 74 20 74 77 ...# The next tw
6970: 6f 20 63 68 65 63 6b 73 20 61 72 65 20 42 4f 54 o checks are BOT
6980: 54 4c 45 4e 45 43 4b 53 2e 20 49 6e 20 65 73 73 TLENECKS. In ess
6990: 65 6e 63 65 20 77 65 20 61 72 65 0a 09 23 20 63 ence we are..# c
69a0: 68 65 63 6b 69 6e 67 20 65 61 63 68 20 73 79 6d hecking each sym
69b0: 62 6f 6c 20 63 68 61 6e 67 65 73 65 74 20 6f 6e bol changeset on
69c0: 65 20 62 79 20 6f 6e 65 2e 0a 0a 09 23 20 54 4f e by one....# TO
69d0: 44 4f 3a 20 54 72 79 20 74 6f 20 72 65 70 68 72 DO: Try to rephr
69e0: 61 73 65 20 74 68 65 20 63 68 65 63 6b 73 20 74 ase the checks t
69f0: 6f 20 6d 61 6b 65 20 6d 6f 72 65 20 75 73 65 20 o make more use
6a00: 6f 66 0a 09 23 20 69 6e 64 69 63 65 73 2c 20 73 of..# indices, s
6a10: 65 74 20 61 6e 64 20 73 74 72 65 61 6d 20 6f 70 et and stream op
6a20: 65 72 61 74 69 6f 6e 73 2e 0a 0a 09 23 20 41 6c erations....# Al
6a30: 6c 20 72 65 76 69 73 69 6f 6e 73 20 75 73 65 64 l revisions used
6a40: 20 62 79 20 74 61 67 20 73 79 6d 62 6f 6c 20 63 by tag symbol c
6a50: 68 61 6e 67 65 73 65 74 73 20 68 61 76 65 20 74 hangesets have t
6a60: 6f 20 68 61 76 65 20 74 68 65 0a 09 23 20 63 68 o have the..# ch
6a70: 61 6e 67 65 73 65 74 27 73 20 74 61 67 20 61 73 angeset's tag as
6a80: 73 6f 63 69 61 74 65 64 20 77 69 74 68 20 74 68 sociated with th
6a90: 65 6d 2e 0a 09 43 68 65 63 6b 52 65 76 43 53 20 em...CheckRevCS
6aa0: 5c 0a 09 20 20 20 20 7b 41 6c 6c 20 72 65 76 69 \.. {All revi
6ab0: 73 69 6f 6e 73 20 75 73 65 64 20 62 79 20 74 61 sions used by ta
6ac0: 67 20 73 79 6d 62 6f 6c 20 63 68 61 6e 67 65 73 g symbol changes
6ad0: 65 74 73 20 68 61 76 65 20 74 6f 20 68 61 76 65 ets have to have
6ae0: 20 74 68 65 20 63 68 61 6e 67 65 73 65 74 27 73 the changeset's
6af0: 20 74 61 67 20 61 74 74 61 63 68 65 64 20 74 6f tag attached to
6b00: 20 74 68 65 6d 7d 20 5c 0a 09 20 20 20 20 7b 64 them} \.. {d
6b10: 6f 65 73 20 6e 6f 74 20 68 61 76 65 20 74 68 65 oes not have the
6b20: 20 74 61 67 20 6f 66 20 69 74 73 20 73 79 6d 62 tag of its symb
6b30: 6f 6c 20 63 68 61 6e 67 65 73 65 74 20 40 20 61 ol changeset @ a
6b40: 74 74 61 63 68 65 64 20 74 6f 20 69 74 7d 20 7b ttached to it} {
6b50: 0a 09 09 53 45 4c 45 43 54 20 43 54 2e 6e 61 6d ...SELECT CT.nam
6b60: 65 2c 20 43 2e 63 69 64 2c 20 46 2e 6e 61 6d 65 e, C.cid, F.name
6b70: 2c 20 52 2e 72 65 76 0a 09 09 46 52 4f 4d 20 20 , R.rev...FROM
6b80: 20 63 68 61 6e 67 65 73 65 74 20 43 2c 20 63 73 changeset C, cs
6b90: 74 79 70 65 20 43 54 2c 20 72 65 76 69 73 69 6f type CT, revisio
6ba0: 6e 20 52 2c 20 66 69 6c 65 20 46 2c 20 63 73 69 n R, file F, csi
6bb0: 74 65 6d 20 43 49 2c 20 74 61 67 20 54 0a 09 09 tem CI, tag T...
6bc0: 57 48 45 52 45 20 20 43 2e 74 79 70 65 20 3d 20 WHERE C.type =
6bd0: 31 20 20 20 20 20 20 20 2d 2d 20 73 79 6d 62 6f 1 -- symbo
6be0: 6c 20 63 68 61 6e 67 65 73 65 74 73 20 6f 6e 6c l changesets onl
6bf0: 79 0a 09 09 41 4e 44 20 20 20 20 43 2e 73 72 63 y...AND C.src
6c00: 20 20 3d 20 54 2e 73 69 64 20 20 20 2d 2d 20 74 = T.sid -- t
6c10: 61 67 20 6f 6e 6c 79 2c 20 6c 69 6e 6b 65 64 20 ag only, linked
6c20: 62 79 20 73 79 6d 62 6f 6c 20 69 64 20 0a 09 09 by symbol id ...
6c30: 41 4e 44 20 20 20 20 43 2e 63 69 64 20 20 3d 20 AND C.cid =
6c40: 43 49 2e 63 69 64 20 20 2d 2d 20 63 68 61 6e 67 CI.cid -- chang
6c50: 65 73 65 74 20 2d 2d 3e 20 69 74 73 20 72 65 76 eset --> its rev
6c60: 69 73 69 6f 6e 73 0a 09 09 41 4e 44 20 20 20 20 isions...AND
6c70: 52 2e 72 69 64 20 20 3d 20 43 49 2e 69 69 64 20 R.rid = CI.iid
6c80: 20 2d 2d 20 6c 6f 6f 6b 20 61 74 20 74 68 65 20 -- look at the
6c90: 72 65 76 69 73 69 6f 6e 73 0a 09 09 2d 2d 20 61 revisions...-- a
6ca0: 6e 64 20 6c 6f 6f 6b 20 66 6f 72 20 74 68 65 20 nd look for the
6cb0: 74 61 67 20 61 6d 6f 6e 67 20 74 68 65 20 61 74 tag among the at
6cc0: 74 61 63 68 65 64 20 6f 6e 65 73 2e 0a 09 09 41 tached ones....A
6cd0: 4e 44 20 20 20 20 54 2e 73 69 64 20 4e 4f 54 20 ND T.sid NOT
6ce0: 49 4e 20 28 53 45 4c 45 43 54 20 54 42 2e 73 69 IN (SELECT TB.si
6cf0: 64 0a 09 09 09 09 20 20 20 20 20 46 52 4f 4d 20 d..... FROM
6d00: 20 20 74 61 67 20 54 42 0a 09 09 09 09 20 20 20 tag TB.....
6d10: 20 20 57 48 45 52 45 20 20 54 42 2e 72 65 76 20 WHERE TB.rev
6d20: 3d 20 52 2e 72 69 64 29 0a 09 09 41 4e 44 20 20 = R.rid)...AND
6d30: 20 20 52 2e 66 69 64 20 3d 20 46 2e 66 69 64 20 R.fid = F.fid
6d40: 20 20 20 2d 2d 20 67 65 74 20 66 69 6c 65 20 6f -- get file o
6d50: 66 20 72 65 76 69 73 69 6f 6e 0a 09 20 20 20 20 f revision..
6d60: 7d 0a 0a 09 23 20 41 6c 6c 20 72 65 76 69 73 69 }...# All revisi
6d70: 6f 6e 73 20 75 73 65 64 20 62 79 20 62 72 61 6e ons used by bran
6d80: 63 68 20 73 79 6d 62 6f 6c 20 63 68 61 6e 67 65 ch symbol change
6d90: 73 65 74 73 20 68 61 76 65 20 74 6f 20 68 61 76 sets have to hav
6da0: 65 0a 09 23 20 74 68 65 20 63 68 61 6e 67 65 73 e..# the changes
6db0: 65 74 27 73 20 62 72 61 6e 63 68 20 61 73 73 6f et's branch asso
6dc0: 63 69 61 74 65 64 20 77 69 74 68 20 74 68 65 6d ciated with them
6dd0: 2e 0a 0a 09 43 68 65 63 6b 52 65 76 43 53 20 5c ....CheckRevCS \
6de0: 0a 09 20 20 20 20 7b 41 6c 6c 20 72 65 76 69 73 .. {All revis
6df0: 69 6f 6e 73 20 75 73 65 64 20 62 79 20 62 72 61 ions used by bra
6e00: 6e 63 68 20 73 79 6d 62 6f 6c 20 63 68 61 6e 67 nch symbol chang
6e10: 65 73 65 74 73 20 68 61 76 65 20 74 6f 20 68 61 esets have to ha
6e20: 76 65 20 74 68 65 20 63 68 61 6e 67 65 73 65 74 ve the changeset
6e30: 27 73 20 62 72 61 6e 63 68 20 61 74 74 61 63 68 's branch attach
6e40: 65 64 20 74 6f 20 74 68 65 6d 7d 20 5c 0a 09 20 ed to them} \..
6e50: 20 20 20 7b 64 6f 65 73 20 6e 6f 74 20 68 61 76 {does not hav
6e60: 65 20 74 68 65 20 62 72 61 6e 63 68 20 6f 66 20 e the branch of
6e70: 69 74 73 20 73 79 6d 62 6f 6c 20 63 68 61 6e 67 its symbol chang
6e80: 65 73 65 74 20 40 20 61 74 74 61 63 68 65 64 20 eset @ attached
6e90: 74 6f 20 69 74 7d 20 7b 0a 09 09 53 45 4c 45 43 to it} {...SELEC
6ea0: 54 20 43 54 2e 6e 61 6d 65 2c 20 43 2e 63 69 64 T CT.name, C.cid
6eb0: 2c 20 46 2e 6e 61 6d 65 2c 20 52 2e 72 65 76 2c , F.name, R.rev,
6ec0: 20 43 2e 63 69 64 0a 09 09 46 52 4f 4d 20 20 20 C.cid...FROM
6ed0: 63 68 61 6e 67 65 73 65 74 20 43 2c 20 63 73 74 changeset C, cst
6ee0: 79 70 65 20 43 54 2c 20 72 65 76 69 73 69 6f 6e ype CT, revision
6ef0: 20 52 2c 20 66 69 6c 65 20 46 2c 20 63 73 69 74 R, file F, csit
6f00: 65 6d 20 43 49 2c 20 62 72 61 6e 63 68 20 42 0a em CI, branch B.
6f10: 09 09 57 48 45 52 45 20 20 43 2e 74 79 70 65 20 ..WHERE C.type
6f20: 3d 20 31 20 20 20 20 20 20 20 2d 2d 20 73 79 6d = 1 -- sym
6f30: 62 6f 6c 20 63 68 61 6e 67 65 73 65 74 73 20 6f bol changesets o
6f40: 6e 6c 79 0a 09 09 41 4e 44 20 20 20 20 43 2e 73 nly...AND C.s
6f50: 72 63 20 20 3d 20 42 2e 73 69 64 20 20 20 2d 2d rc = B.sid --
6f60: 20 62 72 61 6e 63 68 65 73 20 6f 6e 6c 79 0a 09 branches only..
6f70: 09 41 4e 44 20 20 20 20 43 2e 63 69 64 20 20 3d .AND C.cid =
6f80: 20 43 49 2e 63 69 64 20 20 2d 2d 20 63 68 61 6e CI.cid -- chan
6f90: 67 65 73 65 74 20 2d 2d 3e 20 69 74 73 20 72 65 geset --> its re
6fa0: 76 69 73 69 6f 6e 73 0a 09 09 41 4e 44 20 20 20 visions...AND
6fb0: 20 52 2e 72 69 64 20 20 3d 20 43 49 2e 69 69 64 R.rid = CI.iid
6fc0: 20 20 2d 2d 20 6c 6f 6f 6b 20 61 74 20 74 68 65 -- look at the
6fd0: 20 72 65 76 69 73 69 6f 6e 73 0a 09 09 2d 2d 20 revisions...--
6fe0: 61 6e 64 20 6c 6f 6f 6b 20 66 6f 72 20 74 68 65 and look for the
6ff0: 20 62 72 61 6e 63 68 20 61 6d 6f 6e 67 20 74 68 branch among th
7000: 65 20 61 74 74 61 63 68 65 64 20 6f 6e 65 73 2e e attached ones.
7010: 0a 09 09 41 4e 44 20 20 20 20 42 2e 73 69 64 20 ...AND B.sid
7020: 4e 4f 54 20 49 4e 20 28 53 45 4c 45 43 54 20 42 NOT IN (SELECT B
7030: 42 2e 73 69 64 0a 09 09 09 09 20 20 20 20 20 46 B.sid..... F
7040: 52 4f 4d 20 20 20 62 72 61 6e 63 68 20 42 42 0a ROM branch BB.
7050: 09 09 09 09 20 20 20 20 20 57 48 45 52 45 20 20 .... WHERE
7060: 42 42 2e 72 6f 6f 74 20 3d 20 52 2e 72 69 64 29 BB.root = R.rid)
7070: 0a 09 09 41 4e 44 20 20 20 20 52 2e 66 69 64 20 ...AND R.fid
7080: 3d 20 46 2e 66 69 64 20 20 20 20 2d 2d 20 67 65 = F.fid -- ge
7090: 74 20 66 69 6c 65 20 6f 66 20 72 65 76 69 73 69 t file of revisi
70a0: 6f 6e 0a 09 20 20 20 20 7d 0a 0a 09 23 20 54 4f on.. }...# TO
70b0: 44 4f 0a 09 23 20 54 68 65 20 73 74 61 74 65 20 DO..# The state
70c0: 68 61 73 20 74 6f 20 63 6f 6e 74 61 69 6e 20 61 has to contain a
70d0: 74 20 6c 65 61 73 74 20 6f 6e 65 20 74 61 67 20 t least one tag
70e0: 73 79 6d 62 6f 6c 20 63 68 61 6e 67 65 73 65 74 symbol changeset
70f0: 0a 09 23 20 66 6f 72 20 61 6c 6c 20 6b 6e 6f 77 ..# for all know
7100: 6e 20 74 61 67 73 2e 0a 0a 09 23 20 54 4f 44 4f n tags....# TODO
7110: 0a 09 23 20 54 68 65 20 73 74 61 74 65 20 68 61 ..# The state ha
7120: 73 20 74 6f 20 63 6f 6e 74 61 69 6e 20 61 74 20 s to contain at
7130: 6c 65 61 73 74 20 6f 6e 65 20 62 72 61 6e 63 68 least one branch
7140: 20 73 79 6d 62 6f 6c 20 63 68 61 6e 67 65 73 65 symbol changese
7150: 74 0a 09 23 20 66 6f 72 20 61 6c 6c 20 6b 6e 6f t..# for all kno
7160: 77 6e 20 62 72 61 6e 63 68 65 73 2e 0a 09 72 65 wn branches...re
7170: 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 0a 20 20 20 turn. }...
7180: 20 70 72 6f 63 20 43 68 65 63 6b 52 65 76 20 7b proc CheckRev {
7190: 68 65 61 64 65 72 20 6c 61 62 65 6c 20 73 71 6c header label sql
71a0: 7d 20 7b 0a 09 75 70 76 61 72 20 31 20 6e 20 6e } {..upvar 1 n n
71b0: 0a 09 73 65 74 20 6f 6b 20 31 0a 09 66 6f 72 65 ..set ok 1..fore
71c0: 61 63 68 20 7b 66 6e 61 6d 65 20 72 65 76 6e 72 ach {fname revnr
71d0: 7d 20 5b 73 74 61 74 65 20 72 75 6e 20 24 73 71 } [state run $sq
71e0: 6c 5d 20 7b 0a 09 20 20 20 20 73 65 74 20 6f 6b l] {.. set ok
71f0: 20 30 0a 09 20 20 20 20 74 72 6f 75 62 6c 65 20 0.. trouble
7200: 66 61 74 61 6c 20 22 24 7b 72 65 76 6e 72 7d 3a fatal "${revnr}:
7210: 3a 24 66 6e 61 6d 65 20 24 6c 61 62 65 6c 22 0a :$fname $label".
7220: 09 7d 0a 09 6c 6f 67 20 77 72 69 74 65 20 35 20 .}..log write 5
7230: 69 6e 74 65 67 72 69 74 79 20 7b 5c 5b 5b 66 6f integrity {\[[fo
7240: 72 6d 61 74 20 25 30 32 64 20 5b 69 6e 63 72 20 rmat %02d [incr
7250: 6e 5d 5d 5c 5d 20 5b 65 78 70 72 20 7b 24 6f 6b n]]\] [expr {$ok
7260: 20 3f 20 22 4f 6b 20 20 20 20 22 20 3a 20 22 46 ? "Ok " : "F
7270: 61 69 6c 65 64 22 7d 5d 20 2e 2e 2e 20 24 68 65 ailed"}] ... $he
7280: 61 64 65 72 7d 0a 09 72 65 74 75 72 6e 0a 20 20 ader}..return.
7290: 20 20 7d 0a 0a 20 20 20 20 70 72 6f 63 20 43 68 }.. proc Ch
72a0: 65 63 6b 54 61 67 20 7b 68 65 61 64 65 72 20 6c eckTag {header l
72b0: 61 62 65 6c 20 73 71 6c 7d 20 7b 0a 09 75 70 76 abel sql} {..upv
72c0: 61 72 20 31 20 6e 20 6e 0a 09 73 65 74 20 6f 6b ar 1 n n..set ok
72d0: 20 31 0a 09 66 6f 72 65 61 63 68 20 7b 70 6e 61 1..foreach {pna
72e0: 6d 65 20 73 6e 61 6d 65 7d 20 5b 73 74 61 74 65 me sname} [state
72f0: 20 72 75 6e 20 24 73 71 6c 5d 20 7b 0a 09 20 20 run $sql] {..
7300: 20 20 73 65 74 20 6f 6b 20 30 0a 09 20 20 20 20 set ok 0..
7310: 74 72 6f 75 62 6c 65 20 66 61 74 61 6c 20 22 3c trouble fatal "<
7320: 24 70 6e 61 6d 65 20 74 61 67 20 27 24 73 6e 61 $pname tag '$sna
7330: 6d 65 27 3e 20 24 6c 61 62 65 6c 22 0a 09 7d 0a me'> $label"..}.
7340: 09 6c 6f 67 20 77 72 69 74 65 20 35 20 69 6e 74 .log write 5 int
7350: 65 67 72 69 74 79 20 7b 5c 5b 5b 66 6f 72 6d 61 egrity {\[[forma
7360: 74 20 25 30 32 64 20 5b 69 6e 63 72 20 6e 5d 5d t %02d [incr n]]
7370: 5c 5d 20 5b 65 78 70 72 20 7b 24 6f 6b 20 3f 20 \] [expr {$ok ?
7380: 22 4f 6b 20 20 20 20 22 20 3a 20 22 46 61 69 6c "Ok " : "Fail
7390: 65 64 22 7d 5d 20 2e 2e 2e 20 24 68 65 61 64 65 ed"}] ... $heade
73a0: 72 7d 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 7d r}..return. }
73b0: 0a 0a 20 20 20 20 70 72 6f 63 20 43 68 65 63 6b .. proc Check
73c0: 42 72 61 6e 63 68 20 7b 68 65 61 64 65 72 20 6c Branch {header l
73d0: 61 62 65 6c 20 73 71 6c 7d 20 7b 0a 09 75 70 76 abel sql} {..upv
73e0: 61 72 20 31 20 6e 20 6e 0a 09 73 65 74 20 6f 6b ar 1 n n..set ok
73f0: 20 31 0a 09 66 6f 72 65 61 63 68 20 7b 70 6e 61 1..foreach {pna
7400: 6d 65 20 73 6e 61 6d 65 7d 20 5b 73 74 61 74 65 me sname} [state
7410: 20 72 75 6e 20 24 73 71 6c 5d 20 7b 0a 09 20 20 run $sql] {..
7420: 20 20 73 65 74 20 6f 6b 20 30 0a 09 20 20 20 20 set ok 0..
7430: 74 72 6f 75 62 6c 65 20 66 61 74 61 6c 20 22 3c trouble fatal "<
7440: 24 70 6e 61 6d 65 20 62 72 61 6e 63 68 20 27 24 $pname branch '$
7450: 73 6e 61 6d 65 27 3e 20 24 6c 61 62 65 6c 22 0a sname'> $label".
7460: 09 7d 0a 09 6c 6f 67 20 77 72 69 74 65 20 35 20 .}..log write 5
7470: 69 6e 74 65 67 72 69 74 79 20 7b 5c 5b 5b 66 6f integrity {\[[fo
7480: 72 6d 61 74 20 25 30 32 64 20 5b 69 6e 63 72 20 rmat %02d [incr
7490: 6e 5d 5d 5c 5d 20 5b 65 78 70 72 20 7b 24 6f 6b n]]\] [expr {$ok
74a0: 20 3f 20 22 4f 6b 20 20 20 20 22 20 3a 20 22 46 ? "Ok " : "F
74b0: 61 69 6c 65 64 22 7d 5d 20 2e 2e 2e 20 24 68 65 ailed"}] ... $he
74c0: 61 64 65 72 7d 0a 09 72 65 74 75 72 6e 0a 20 20 ader}..return.
74d0: 20 20 7d 0a 0a 20 20 20 20 70 72 6f 63 20 43 68 }.. proc Ch
74e0: 65 63 6b 43 53 20 7b 68 65 61 64 65 72 20 6c 61 eckCS {header la
74f0: 62 65 6c 20 73 71 6c 7d 20 7b 0a 09 75 70 76 61 bel sql} {..upva
7500: 72 20 31 20 6e 20 6e 0a 09 73 65 74 20 6f 6b 20 r 1 n n..set ok
7510: 31 0a 09 66 6f 72 65 61 63 68 20 7b 63 74 79 70 1..foreach {ctyp
7520: 65 20 63 69 64 7d 20 5b 73 74 61 74 65 20 72 75 e cid} [state ru
7530: 6e 20 24 73 71 6c 5d 20 7b 0a 09 20 20 20 20 73 n $sql] {.. s
7540: 65 74 20 6f 6b 20 30 0a 09 20 20 20 20 74 72 6f et ok 0.. tro
7550: 75 62 6c 65 20 66 61 74 61 6c 20 22 3c 24 63 74 uble fatal "<$ct
7560: 79 70 65 20 24 63 69 64 3e 20 24 6c 61 62 65 6c ype $cid> $label
7570: 22 0a 09 7d 0a 09 6c 6f 67 20 77 72 69 74 65 20 "..}..log write
7580: 35 20 69 6e 74 65 67 72 69 74 79 20 7b 5c 5b 5b 5 integrity {\[[
7590: 66 6f 72 6d 61 74 20 25 30 32 64 20 5b 69 6e 63 format %02d [inc
75a0: 72 20 6e 5d 5d 5c 5d 20 5b 65 78 70 72 20 7b 24 r n]]\] [expr {$
75b0: 6f 6b 20 3f 20 22 4f 6b 20 20 20 20 22 20 3a 20 ok ? "Ok " :
75c0: 22 46 61 69 6c 65 64 22 7d 5d 20 2e 2e 2e 20 24 "Failed"}] ... $
75d0: 68 65 61 64 65 72 7d 0a 09 72 65 74 75 72 6e 0a header}..return.
75e0: 20 20 20 20 7d 0a 0a 20 20 20 20 70 72 6f 63 20 }.. proc
75f0: 43 68 65 63 6b 52 65 76 43 53 20 7b 68 65 61 64 CheckRevCS {head
7600: 65 72 20 6c 61 62 65 6c 20 73 71 6c 7d 20 7b 0a er label sql} {.
7610: 09 75 70 76 61 72 20 31 20 6e 20 6e 0a 09 73 65 .upvar 1 n n..se
7620: 74 20 6f 6b 20 31 0a 09 66 6f 72 65 61 63 68 20 t ok 1..foreach
7630: 7b 63 73 74 79 70 65 20 63 73 69 64 20 66 6e 61 {cstype csid fna
7640: 6d 65 20 72 65 76 6e 72 7d 20 5b 73 74 61 74 65 me revnr} [state
7650: 20 72 75 6e 20 24 73 71 6c 5d 20 7b 0a 09 20 20 run $sql] {..
7660: 20 20 73 65 74 20 6f 6b 20 30 0a 09 20 20 20 20 set ok 0..
7670: 73 65 74 20 62 20 22 3c 24 63 73 74 79 70 65 20 set b "<$cstype
7680: 24 63 73 69 64 3e 22 0a 09 20 20 20 20 74 72 6f $csid>".. tro
7690: 75 62 6c 65 20 66 61 74 61 6c 20 22 24 66 6e 61 uble fatal "$fna
76a0: 6d 65 20 3c 24 72 65 76 6e 72 3e 20 5b 73 74 72 me <$revnr> [str
76b0: 69 6e 67 20 6d 61 70 20 5b 6c 69 73 74 20 40 20 ing map [list @
76c0: 24 62 5d 20 24 6c 61 62 65 6c 5d 22 0a 09 7d 0a $b] $label]"..}.
76d0: 09 6c 6f 67 20 77 72 69 74 65 20 35 20 69 6e 74 .log write 5 int
76e0: 65 67 72 69 74 79 20 7b 5c 5b 5b 66 6f 72 6d 61 egrity {\[[forma
76f0: 74 20 25 30 32 64 20 5b 69 6e 63 72 20 6e 5d 5d t %02d [incr n]]
7700: 5c 5d 20 5b 65 78 70 72 20 7b 24 6f 6b 20 3f 20 \] [expr {$ok ?
7710: 22 4f 6b 20 20 20 20 22 20 3a 20 22 46 61 69 6c "Ok " : "Fail
7720: 65 64 22 7d 5d 20 2e 2e 2e 20 24 68 65 61 64 65 ed"}] ... $heade
7730: 72 7d 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 7d r}..return. }
7740: 0a 0a 20 20 20 20 23 20 23 20 23 23 20 23 23 23 .. # # ## ###
7750: 20 23 23 23 23 23 20 23 23 23 23 23 23 23 23 20 ##### ########
7760: 23 23 23 23 23 23 23 23 23 23 23 23 23 0a 0a 20 #############..
7770: 20 20 20 74 79 70 65 76 61 72 69 61 62 6c 65 20 typevariable
7780: 6d 79 6c 6f 6f 70 63 68 65 63 6b 20 30 20 3b 20 myloopcheck 0 ;
7790: 23 20 42 6f 6f 6c 65 61 6e 20 66 6c 61 67 2e 20 # Boolean flag.
77a0: 43 6f 6e 74 72 6f 6c 73 20 77 68 65 74 68 65 72 Controls whether
77b0: 0a 09 09 09 09 20 23 20 27 69 6e 74 65 67 72 69 ..... # 'integri
77c0: 74 79 20 63 68 61 6e 67 65 73 65 74 73 27 20 6c ty changesets' l
77d0: 6f 6f 6b 73 20 66 6f 72 0a 09 09 09 09 20 23 20 ooks for..... #
77e0: 63 68 61 6e 67 65 73 65 74 73 20 77 69 74 68 20 changesets with
77f0: 6c 6f 6f 70 73 20 6f 72 20 6e 6f 74 2e 0a 09 09 loops or not....
7800: 09 09 20 23 20 44 65 66 61 75 6c 74 20 69 73 20 .. # Default is
7810: 74 6f 20 6e 6f 74 20 6c 6f 6f 6b 20 66 6f 72 20 to not look for
7820: 74 68 65 6d 2e 0a 0a 20 20 20 20 23 20 23 20 23 them... # # #
7830: 23 20 23 23 23 20 23 23 23 23 23 20 23 23 23 23 # ### ##### ####
7840: 23 23 23 23 20 23 23 23 23 23 23 23 23 23 23 23 #### ###########
7850: 23 23 0a 20 20 20 20 23 23 20 43 6f 6e 66 69 67 ##. ## Config
7860: 75 72 61 74 69 6f 6e 0a 0a 20 20 20 20 70 72 61 uration.. pra
7870: 67 6d 61 20 2d 68 61 73 69 6e 73 74 61 6e 63 65 gma -hasinstance
7880: 73 20 20 20 6e 6f 20 3b 20 23 20 73 69 6e 67 6c s no ; # singl
7890: 65 74 6f 6e 0a 20 20 20 20 70 72 61 67 6d 61 20 eton. pragma
78a0: 2d 68 61 73 74 79 70 65 69 6e 66 6f 20 20 20 20 -hastypeinfo
78b0: 6e 6f 20 3b 20 23 20 6e 6f 20 69 6e 74 72 6f 73 no ; # no intros
78c0: 70 65 63 74 69 6f 6e 0a 20 20 20 20 70 72 61 67 pection. prag
78d0: 6d 61 20 2d 68 61 73 74 79 70 65 64 65 73 74 72 ma -hastypedestr
78e0: 6f 79 20 6e 6f 20 3b 20 23 20 69 6d 6d 6f 72 74 oy no ; # immort
78f0: 61 6c 0a 0a 20 20 20 20 23 20 23 20 23 23 20 23 al.. # # ## #
7900: 23 23 20 23 23 23 23 23 20 23 23 23 23 23 23 23 ## ##### #######
7910: 23 20 23 23 23 23 23 23 23 23 23 23 23 23 23 0a # #############.
7920: 7d 0a 0a 6e 61 6d 65 73 70 61 63 65 20 65 76 61 }..namespace eva
7930: 6c 20 3a 3a 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a l ::vc::fossil::
7940: 69 6d 70 6f 72 74 3a 3a 63 76 73 20 7b 0a 20 20 import::cvs {.
7950: 20 20 6e 61 6d 65 73 70 61 63 65 20 65 78 70 6f namespace expo
7960: 72 74 20 69 6e 74 65 67 72 69 74 79 0a 20 20 20 rt integrity.
7970: 20 6e 61 6d 65 73 70 61 63 65 20 65 76 61 6c 20 namespace eval
7980: 69 6e 74 65 67 72 69 74 79 20 7b 0a 09 6e 61 6d integrity {..nam
7990: 65 73 70 61 63 65 20 69 6d 70 6f 72 74 20 3a 3a espace import ::
79a0: 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f vc::fossil::impo
79b0: 72 74 3a 3a 63 76 73 3a 3a 73 74 61 74 65 0a 09 rt::cvs::state..
79c0: 6e 61 6d 65 73 70 61 63 65 20 69 6d 70 6f 72 74 namespace import
79d0: 20 3a 3a 76 63 3a 3a 74 6f 6f 6c 73 3a 3a 74 72 ::vc::tools::tr
79e0: 6f 75 62 6c 65 0a 09 6e 61 6d 65 73 70 61 63 65 ouble..namespace
79f0: 20 69 6d 70 6f 72 74 20 3a 3a 76 63 3a 3a 74 6f import ::vc::to
7a00: 6f 6c 73 3a 3a 6c 6f 67 0a 09 6c 6f 67 20 72 65 ols::log..log re
7a10: 67 69 73 74 65 72 20 69 6e 74 65 67 72 69 74 79 gister integrity
7a20: 0a 20 20 20 20 7d 0a 7d 0a 0a 23 20 23 20 23 23 . }.}..# # ##
7a30: 20 23 23 23 20 23 23 23 23 23 20 23 23 23 23 23 ### ##### #####
7a40: 23 23 23 20 23 23 23 23 23 23 23 23 23 23 23 23 ### ############
7a50: 23 20 23 23 23 23 23 23 23 23 23 23 23 23 23 23 # ##############
7a60: 23 23 23 23 23 23 23 0a 23 23 20 52 65 61 64 79 #######.## Ready
7a70: 0a 0a 70 61 63 6b 61 67 65 20 70 72 6f 76 69 64 ..package provid
7a80: 65 20 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d e vc::fossil::im
7a90: 70 6f 72 74 3a 3a 63 76 73 3a 3a 69 6e 74 65 67 port::cvs::integ
7aa0: 72 69 74 79 20 31 2e 30 0a 72 65 74 75 72 6e 0a rity 1.0.return.