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