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 20 20 R.fid = F.fid
09a0: 20 2d 2d 20 67 65 74 20 66 69 6c 65 20 6f 66 20 -- get file of
09b0: 72 65 76 0a 09 09 41 4e 44 20 20 20 52 2e 6c 6f rev...AND R.lo
09c0: 64 20 3d 20 53 2e 73 69 64 20 20 20 2d 2d 20 67 d = S.sid -- g
09d0: 65 74 20 73 79 6d 62 6f 6c 20 6f 66 20 69 74 73 et symbol of its
09e0: 20 6c 6f 64 0a 09 09 41 4e 44 20 20 20 46 2e 70 lod...AND F.p
09f0: 69 64 20 21 3d 20 53 2e 70 69 64 20 20 2d 2d 20 id != S.pid --
0a00: 64 69 73 61 67 72 65 65 6d 65 6e 74 20 61 62 6f disagreement abo
0a10: 75 74 20 74 68 65 20 6f 77 6e 69 6e 67 20 70 72 ut the owning pr
0a20: 6f 6a 65 63 74 0a 09 09 3b 0a 09 20 20 20 20 7d oject...;.. }
0a30: 0a 09 23 20 46 69 6e 64 20 61 6c 6c 20 72 65 76 ..# Find all rev
0a40: 69 73 69 6f 6e 73 20 77 68 69 63 68 20 64 69 73 isions which dis
0a50: 67 72 65 65 20 77 69 74 68 20 74 68 65 69 72 20 gree with their
0a60: 6d 65 74 61 20 64 61 74 61 20 61 62 6f 75 74 0a meta data about.
0a70: 09 23 20 74 68 65 20 70 72 6f 6a 65 63 74 20 74 .# the project t
0a80: 68 65 79 20 61 72 65 20 6f 77 6e 65 64 20 62 79 hey are owned by
0a90: 2e 0a 09 43 68 65 63 6b 52 65 76 20 5c 0a 09 20 ...CheckRev \..
0aa0: 20 20 20 7b 52 65 76 69 73 69 6f 6e 73 20 61 6e {Revisions an
0ab0: 64 20 74 68 65 69 72 20 6d 65 74 61 20 64 61 74 d their meta dat
0ac0: 61 20 68 61 76 65 20 74 6f 20 62 65 20 69 6e 20 a have to be in
0ad0: 74 68 65 20 73 61 6d 65 20 70 72 6f 6a 65 63 74 the same project
0ae0: 7d 20 5c 0a 09 20 20 20 20 7b 64 69 73 61 67 72 } \.. {disagr
0af0: 65 65 73 20 77 69 74 68 20 69 74 73 20 6d 65 74 ees with its met
0b00: 61 20 64 61 74 61 20 61 62 6f 75 74 20 6f 77 6e a data about own
0b10: 69 6e 67 20 70 72 6f 6a 65 63 74 7d 20 7b 0a 09 ing project} {..
0b20: 09 53 45 4c 45 43 54 20 46 2e 6e 61 6d 65 2c 20 .SELECT F.name,
0b30: 52 2e 72 65 76 0a 09 09 46 52 4f 4d 20 72 65 76 R.rev...FROM rev
0b40: 69 73 69 6f 6e 20 52 2c 20 66 69 6c 65 20 46 2c ision R, file F,
0b50: 20 6d 65 74 61 20 4d 0a 09 09 57 48 45 52 45 20 meta M...WHERE
0b60: 52 2e 66 69 64 20 3d 20 46 2e 66 69 64 20 20 20 R.fid = F.fid
0b70: 2d 2d 20 67 65 74 20 66 69 6c 65 20 6f 66 20 72 -- get file of r
0b80: 65 76 0a 09 09 41 4e 44 20 20 20 52 2e 6d 69 64 ev...AND R.mid
0b90: 20 3d 20 4d 2e 6d 69 64 20 20 20 2d 2d 20 67 65 = M.mid -- ge
0ba0: 74 20 6d 65 74 61 20 6f 66 20 72 65 76 0a 09 09 t meta of rev...
0bb0: 41 4e 44 20 20 20 46 2e 70 69 64 20 21 3d 20 4d AND F.pid != M
0bc0: 2e 70 69 64 20 20 2d 2d 20 64 69 73 61 67 72 65 .pid -- disagre
0bd0: 65 6d 65 6e 74 20 61 62 6f 75 74 20 6f 77 6e 69 ement about owni
0be0: 6e 67 20 70 72 6f 6a 65 63 74 0a 09 09 3b 0a 09 ng project...;..
0bf0: 20 20 20 20 7d 0a 09 23 20 46 69 6e 64 20 61 6c }..# Find al
0c00: 6c 20 72 65 76 69 73 69 6f 6e 73 20 77 69 74 68 l revisions with
0c10: 20 61 20 70 72 69 6d 61 72 79 20 63 68 69 6c 64 a primary child
0c20: 20 77 68 69 63 68 20 64 69 73 61 67 72 65 65 73 which disagrees
0c30: 0a 09 23 20 61 62 6f 75 74 20 74 68 65 20 66 69 ..# about the fi
0c40: 6c 65 20 74 68 65 79 20 62 65 6c 6f 6e 67 20 74 le they belong t
0c50: 6f 2e 0a 09 43 68 65 63 6b 52 65 76 20 5c 0a 09 o...CheckRev \..
0c60: 20 20 20 20 7b 52 65 76 69 73 69 6f 6e 73 20 61 {Revisions a
0c70: 6e 64 20 74 68 65 69 72 20 70 72 69 6d 61 72 79 nd their primary
0c80: 20 63 68 69 6c 64 72 65 6e 20 68 61 76 65 20 74 children have t
0c90: 6f 20 62 65 20 69 6e 20 74 68 65 20 73 61 6d 65 o be in the same
0ca0: 20 66 69 6c 65 7d 20 5c 0a 09 20 20 20 20 7b 64 file} \.. {d
0cb0: 69 73 61 67 72 65 65 73 20 77 69 74 68 20 69 74 isagrees with it
0cc0: 73 20 70 72 69 6d 61 72 79 20 63 68 69 6c 64 20 s primary child
0cd0: 61 62 6f 75 74 20 74 68 65 20 6f 77 6e 69 6e 67 about the owning
0ce0: 20 66 69 6c 65 7d 20 7b 0a 09 09 53 45 4c 45 43 file} {...SELEC
0cf0: 54 20 46 2e 6e 61 6d 65 2c 20 52 2e 72 65 76 0a T F.name, R.rev.
0d00: 09 09 46 52 4f 4d 20 72 65 76 69 73 69 6f 6e 20 ..FROM revision
0d10: 52 2c 20 72 65 76 69 73 69 6f 6e 20 43 2c 20 66 R, revision C, f
0d20: 69 6c 65 20 46 0a 09 09 57 48 45 52 45 20 52 2e ile F...WHERE R.
0d30: 66 69 64 20 3d 20 46 2e 66 69 64 20 20 20 20 20 fid = F.fid
0d40: 20 20 2d 2d 20 67 65 74 20 66 69 6c 65 20 6f 66 -- get file of
0d50: 20 72 65 76 0a 09 09 41 4e 44 20 20 20 52 2e 63 rev...AND R.c
0d60: 68 69 6c 64 20 49 53 20 4e 4f 54 20 4e 55 4c 4c hild IS NOT NULL
0d70: 20 2d 2d 20 67 65 74 20 61 6c 6c 20 77 69 74 68 -- get all with
0d80: 20 70 72 69 6d 61 72 79 20 63 68 69 6c 64 72 65 primary childre
0d90: 6e 0a 09 09 41 4e 44 20 20 20 52 2e 63 68 69 6c n...AND R.chil
0da0: 64 20 3d 20 43 2e 72 69 64 20 20 20 20 20 2d 2d d = C.rid --
0db0: 20 67 65 74 20 70 72 69 6d 61 72 79 20 63 68 69 get primary chi
0dc0: 6c 64 0a 09 09 41 4e 44 20 20 20 43 2e 66 69 64 ld...AND C.fid
0dd0: 20 21 3d 20 52 2e 66 69 64 20 20 20 20 20 20 2d != R.fid -
0de0: 2d 20 77 72 6f 6e 67 6c 79 20 69 6e 20 64 69 66 - wrongly in dif
0df0: 66 65 72 65 6e 74 20 66 69 6c 65 0a 09 09 3b 0a ferent file...;.
0e00: 09 20 20 20 20 7d 0a 0a 09 23 20 46 69 6e 64 20 . }...# Find
0e10: 61 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 77 69 all revisions wi
0e20: 74 68 20 61 20 62 72 61 6e 63 68 20 70 61 72 65 th a branch pare
0e30: 6e 74 20 73 79 6d 62 6f 6c 20 77 68 6f 73 65 20 nt symbol whose
0e40: 70 61 72 65 6e 74 0a 09 23 20 64 69 73 61 67 72 parent..# disagr
0e50: 65 65 73 20 61 62 6f 75 74 20 74 68 65 20 66 69 ees about the fi
0e60: 6c 65 20 74 68 65 79 20 62 65 6c 6f 6e 67 20 74 le they belong t
0e70: 6f 2e 0a 09 43 68 65 63 6b 52 65 76 20 5c 0a 09 o...CheckRev \..
0e80: 20 20 20 20 7b 52 65 76 69 73 69 6f 6e 73 20 61 {Revisions a
0e90: 6e 64 20 74 68 65 69 72 20 62 72 61 6e 63 68 20 nd their branch
0ea0: 63 68 69 6c 64 72 65 6e 20 68 61 76 65 20 74 6f children have to
0eb0: 20 62 65 20 69 6e 20 74 68 65 20 73 61 6d 65 20 be in the same
0ec0: 66 69 6c 65 7d 20 5c 0a 09 20 20 20 20 7b 61 74 file} \.. {at
0ed0: 20 74 68 65 20 62 65 67 69 6e 6e 69 6e 67 20 6f the beginning o
0ee0: 66 20 69 74 73 20 62 72 61 6e 63 68 20 61 6e 64 f its branch and
0ef0: 20 69 74 73 20 70 61 72 65 6e 74 20 64 69 73 61 its parent disa
0f00: 67 72 65 65 20 61 62 6f 75 74 20 74 68 65 20 6f gree about the o
0f10: 77 6e 69 6e 67 20 66 69 6c 65 7d 20 7b 0a 09 09 wning file} {...
0f20: 53 45 4c 45 43 54 20 46 2e 6e 61 6d 65 2c 20 52 SELECT F.name, R
0f30: 2e 72 65 76 0a 09 09 46 52 4f 4d 20 72 65 76 69 .rev...FROM revi
0f40: 73 69 6f 6e 20 52 2c 20 72 65 76 69 73 69 6f 6e sion R, revision
0f50: 20 50 2c 20 66 69 6c 65 20 46 0a 09 09 57 48 45 P, file F...WHE
0f60: 52 45 20 52 2e 66 69 64 20 3d 20 46 2e 66 69 64 RE R.fid = F.fid
0f70: 20 20 20 20 20 20 20 20 20 2d 2d 20 67 65 74 20 -- get
0f80: 66 69 6c 65 20 6f 66 20 72 65 76 0a 09 09 41 4e file of rev...AN
0f90: 44 20 20 20 52 2e 62 70 61 72 65 6e 74 20 49 53 D R.bparent IS
0fa0: 20 4e 4f 54 20 4e 55 4c 4c 20 2d 2d 20 67 65 74 NOT NULL -- get
0fb0: 20 66 69 72 73 74 2d 6f 66 2d 62 72 61 6e 63 68 first-of-branch
0fc0: 20 72 65 76 69 73 69 6f 6e 73 0a 09 09 41 4e 44 revisions...AND
0fd0: 20 20 20 52 2e 70 61 72 65 6e 74 20 3d 20 50 2e R.parent = P.
0fe0: 72 69 64 20 20 20 20 20 20 2d 2d 20 67 65 74 20 rid -- get
0ff0: 6f 75 74 2d 6f 66 2d 62 72 61 6e 63 68 20 70 61 out-of-branch pa
1000: 72 65 6e 74 0a 09 09 41 4e 44 20 20 20 52 2e 66 rent...AND R.f
1010: 69 64 20 21 3d 20 50 2e 66 69 64 20 20 20 20 20 id != P.fid
1020: 20 20 20 2d 2d 20 77 72 6f 6e 67 6c 79 20 69 6e -- wrongly in
1030: 20 64 69 66 66 65 72 65 6e 74 20 66 69 6c 65 0a different file.
1040: 09 09 3b 0a 09 20 20 20 20 7d 0a 09 23 20 46 69 ..;.. }..# Fi
1050: 6e 64 20 61 6c 6c 20 72 65 76 69 73 69 6f 6e 73 nd all revisions
1060: 20 77 69 74 68 20 61 20 6e 6f 6e 2d 4e 54 44 42 with a non-NTDB
1070: 20 63 68 69 6c 64 20 77 68 69 63 68 20 64 69 73 child which dis
1080: 61 67 72 65 65 73 0a 09 23 20 61 62 6f 75 74 20 agrees..# about
1090: 74 68 65 20 66 69 6c 65 20 74 68 65 79 20 62 65 the file they be
10a0: 6c 6f 6e 67 20 74 6f 2e 0a 09 43 68 65 63 6b 52 long to...CheckR
10b0: 65 76 20 5c 0a 09 20 20 20 20 7b 52 65 76 69 73 ev \.. {Revis
10c0: 69 6f 6e 73 20 61 6e 64 20 74 68 65 69 72 20 6e ions and their n
10d0: 6f 6e 2d 4e 54 44 42 20 63 68 69 6c 64 72 65 6e on-NTDB children
10e0: 20 68 61 76 65 20 74 6f 20 62 65 20 69 6e 20 74 have to be in t
10f0: 68 65 20 73 61 6d 65 20 66 69 6c 65 7d 20 5c 0a he same file} \.
1100: 09 20 20 20 20 7b 64 69 73 61 67 72 65 65 73 20 . {disagrees
1110: 77 69 74 68 20 69 74 73 20 6e 6f 6e 2d 4e 54 44 with its non-NTD
1120: 42 20 63 68 69 6c 64 20 61 62 6f 75 74 20 74 68 B child about th
1130: 65 20 6f 77 6e 69 6e 67 20 66 69 6c 65 7d 20 7b e owning file} {
1140: 0a 09 09 53 45 4c 45 43 54 20 46 2e 6e 61 6d 65 ...SELECT F.name
1150: 2c 20 52 2e 72 65 76 0a 09 09 46 52 4f 4d 20 72 , R.rev...FROM r
1160: 65 76 69 73 69 6f 6e 20 52 2c 20 72 65 76 69 73 evision R, revis
1170: 69 6f 6e 20 43 2c 20 66 69 6c 65 20 46 0a 09 09 ion C, file F...
1180: 57 48 45 52 45 20 52 2e 66 69 64 20 3d 20 46 2e WHERE R.fid = F.
1190: 66 69 64 20 20 20 20 20 20 20 20 20 2d 2d 20 67 fid -- g
11a0: 65 74 20 66 69 6c 65 20 6f 66 20 72 65 76 0a 09 et file of rev..
11b0: 09 41 4e 44 20 20 20 52 2e 64 62 63 68 69 6c 64 .AND R.dbchild
11c0: 20 49 53 20 4e 4f 54 20 4e 55 4c 4c 20 2d 2d 20 IS NOT NULL --
11d0: 67 65 74 20 6c 61 73 74 20 4e 54 44 42 20 72 65 get last NTDB re
11e0: 76 69 73 69 6f 6e 73 0a 09 09 41 4e 44 20 20 20 visions...AND
11f0: 52 2e 64 62 63 68 69 6c 64 20 3d 20 43 2e 72 69 R.dbchild = C.ri
1200: 64 20 20 20 20 20 2d 2d 20 67 65 74 20 74 68 65 d -- get the
1210: 69 72 20 63 68 69 6c 64 0a 09 09 41 4e 44 20 20 ir child...AND
1220: 20 43 2e 66 69 64 20 21 3d 20 52 2e 66 69 64 20 C.fid != R.fid
1230: 20 20 20 20 20 20 20 2d 2d 20 77 72 6f 6e 67 6c -- wrongl
1240: 79 20 69 6e 20 64 69 66 66 65 72 65 6e 74 20 66 y in different f
1250: 69 6c 65 0a 09 09 3b 0a 09 20 20 20 20 7d 0a 09 ile...;.. }..
1260: 23 20 46 69 6e 64 20 61 6c 6c 20 72 65 76 69 73 # Find all revis
1270: 69 6f 6e 73 20 77 68 69 63 68 20 68 61 76 65 20 ions which have
1280: 61 20 70 72 69 6d 61 72 79 20 63 68 69 6c 64 2c a primary child,
1290: 20 62 75 74 20 74 68 65 20 63 68 69 6c 64 0a 09 but the child..
12a0: 23 20 64 6f 65 73 20 6e 6f 74 20 68 61 76 65 20 # does not have
12b0: 74 68 65 6d 20 61 73 20 70 61 72 65 6e 74 2e 0a them as parent..
12c0: 09 43 68 65 63 6b 52 65 76 20 5c 0a 09 20 20 20 .CheckRev \..
12d0: 20 7b 52 65 76 69 73 69 6f 6e 73 20 68 61 76 65 {Revisions have
12e0: 20 74 6f 20 62 65 20 70 61 72 65 6e 74 73 20 6f to be parents o
12f0: 66 20 74 68 65 69 72 20 70 72 69 6d 61 72 79 20 f their primary
1300: 63 68 69 6c 64 72 65 6e 7d 20 5c 0a 09 20 20 20 children} \..
1310: 20 7b 69 73 20 6e 6f 74 20 74 68 65 20 70 61 72 {is not the par
1320: 65 6e 74 20 6f 66 20 69 74 73 20 70 72 69 6d 61 ent of its prima
1330: 72 79 20 63 68 69 6c 64 7d 20 7b 0a 09 09 53 45 ry child} {...SE
1340: 4c 45 43 54 20 46 2e 6e 61 6d 65 2c 20 52 2e 72 LECT F.name, R.r
1350: 65 76 0a 09 09 46 52 4f 4d 20 72 65 76 69 73 69 ev...FROM revisi
1360: 6f 6e 20 52 2c 20 72 65 76 69 73 69 6f 6e 20 43 on R, revision C
1370: 2c 20 66 69 6c 65 20 46 0a 09 09 57 48 45 52 45 , file F...WHERE
1380: 20 52 2e 66 69 64 20 3d 20 46 2e 66 69 64 20 20 R.fid = F.fid
1390: 20 20 20 20 20 20 20 2d 2d 20 67 65 74 20 66 69 -- get fi
13a0: 6c 65 20 6f 66 20 72 65 76 0a 09 09 41 4e 44 20 le of rev...AND
13b0: 20 20 52 2e 63 68 69 6c 64 20 49 53 20 4e 4f 54 R.child IS NOT
13c0: 20 4e 55 4c 4c 20 20 20 2d 2d 20 67 65 74 20 61 NULL -- get a
13d0: 6c 6c 20 77 69 74 68 20 70 72 69 6d 61 72 79 20 ll with primary
13e0: 63 68 69 6c 64 72 65 6e 0a 09 09 41 4e 44 20 20 children...AND
13f0: 20 52 2e 63 68 69 6c 64 20 3d 20 43 2e 72 69 64 R.child = C.rid
1400: 20 20 20 20 20 20 20 2d 2d 20 67 65 74 20 70 72 -- get pr
1410: 69 6d 61 72 79 20 63 68 69 6c 64 0a 09 09 41 4e imary child...AN
1420: 44 20 20 20 43 2e 70 61 72 65 6e 74 20 21 3d 20 D C.parent !=
1430: 52 2e 72 69 64 20 20 20 20 20 2d 2d 20 63 68 69 R.rid -- chi
1440: 6c 64 27 73 20 70 61 72 65 6e 74 20 77 72 6f 6e ld's parent wron
1450: 67 6c 79 20 6e 6f 74 20 75 73 0a 09 09 3b 0a 09 gly not us...;..
1460: 20 20 20 20 7d 0a 09 23 20 46 69 6e 64 20 61 6c }..# Find al
1470: 6c 20 72 65 76 69 73 69 6f 6e 73 20 77 68 69 63 l revisions whic
1480: 68 20 68 61 76 65 20 61 20 70 72 69 6d 72 61 72 h have a primrar
1490: 79 20 63 68 69 6c 64 2c 20 62 75 74 20 74 68 65 y child, but the
14a0: 0a 09 23 20 63 68 69 6c 64 20 68 61 73 20 61 20 ..# child has a
14b0: 62 72 61 6e 63 68 20 70 61 72 65 6e 74 20 73 79 branch parent sy
14c0: 6d 62 6f 6c 20 6d 61 6b 69 6e 67 20 74 68 65 6d mbol making them
14d0: 20 62 72 61 63 68 20 73 74 61 72 74 65 72 73 2e brach starters.
14e0: 0a 09 43 68 65 63 6b 52 65 76 20 5c 0a 09 20 20 ..CheckRev \..
14f0: 20 20 7b 50 72 69 6d 61 72 79 20 63 68 69 6c 64 {Primary child
1500: 72 65 6e 20 6f 66 20 72 65 76 69 73 69 6f 6e 73 ren of revisions
1510: 20 6d 75 73 74 20 6e 6f 74 20 73 74 61 72 74 20 must not start
1520: 62 72 61 6e 63 68 65 73 7d 20 5c 0a 09 20 20 20 branches} \..
1530: 20 7b 69 73 20 70 61 72 65 6e 74 20 6f 66 20 61 {is parent of a
1540: 20 70 72 69 6d 61 72 79 20 63 68 69 6c 64 20 77 primary child w
1550: 68 69 63 68 20 69 73 20 74 68 65 20 62 65 67 69 hich is the begi
1560: 6e 6e 69 6e 67 20 6f 66 20 61 20 62 72 61 6e 63 nning of a branc
1570: 68 7d 20 7b 0a 09 09 53 45 4c 45 43 54 20 46 2e h} {...SELECT F.
1580: 6e 61 6d 65 2c 20 52 2e 72 65 76 0a 09 09 46 52 name, R.rev...FR
1590: 4f 4d 20 72 65 76 69 73 69 6f 6e 20 52 2c 20 72 OM revision R, r
15a0: 65 76 69 73 69 6f 6e 20 43 2c 20 66 69 6c 65 20 evision C, file
15b0: 46 0a 09 09 57 48 45 52 45 20 52 2e 66 69 64 20 F...WHERE R.fid
15c0: 3d 20 46 2e 66 69 64 20 20 20 20 20 20 20 20 20 = F.fid
15d0: 2d 2d 20 67 65 74 20 66 69 6c 65 20 6f 66 20 72 -- get file of r
15e0: 65 76 0a 09 09 41 4e 44 20 20 20 52 2e 63 68 69 ev...AND R.chi
15f0: 6c 64 20 49 53 20 4e 4f 54 20 4e 55 4c 4c 20 20 ld IS NOT NULL
1600: 20 2d 2d 20 67 65 74 20 61 6c 6c 20 77 69 74 68 -- get all with
1610: 20 70 72 69 6d 61 72 79 20 63 68 69 6c 64 72 65 primary childre
1620: 6e 0a 09 09 41 4e 44 20 20 20 52 2e 63 68 69 6c n...AND R.chil
1630: 64 20 3d 20 43 2e 72 69 64 20 20 20 20 20 20 20 d = C.rid
1640: 2d 2d 20 67 65 74 20 70 72 69 6d 61 72 79 20 63 -- get primary c
1650: 68 69 6c 64 0a 09 09 41 4e 44 20 20 20 43 2e 62 hild...AND C.b
1660: 70 61 72 65 6e 74 20 49 53 20 4e 4f 54 20 4e 55 parent IS NOT NU
1670: 4c 4c 20 2d 2d 20 62 75 74 20 69 6e 64 69 63 61 LL -- but indica
1680: 74 65 73 20 74 6f 20 62 65 20 6f 6e 20 62 72 61 tes to be on bra
1690: 6e 63 68 0a 09 09 3b 0a 09 20 20 20 20 7d 0a 09 nch...;.. }..
16a0: 23 20 46 69 6e 64 20 61 6c 6c 20 72 65 76 69 73 # Find all revis
16b0: 69 6f 6e 73 20 77 69 74 68 6f 75 74 20 62 72 61 ions without bra
16c0: 6e 63 68 20 70 61 72 65 6e 74 20 73 79 6d 62 6f nch parent symbo
16d0: 6c 20 77 68 69 63 68 20 68 61 76 65 20 61 0a 09 l which have a..
16e0: 23 20 70 61 72 65 6e 74 2c 20 62 75 74 20 74 68 # parent, but th
16f0: 65 20 70 61 72 65 6e 74 20 64 6f 65 73 20 6e 6f e parent does no
1700: 74 20 68 61 76 65 20 74 68 65 6d 20 61 73 20 70 t have them as p
1710: 72 69 6d 61 72 79 20 63 68 69 6c 64 2e 0a 09 43 rimary child...C
1720: 68 65 63 6b 52 65 76 20 5c 0a 09 20 20 20 20 7b heckRev \.. {
1730: 52 65 76 69 73 69 6f 6e 73 20 68 61 76 65 20 74 Revisions have t
1740: 6f 20 62 65 20 70 72 69 6d 61 72 79 20 63 68 69 o be primary chi
1750: 6c 64 72 65 6e 20 6f 66 20 74 68 65 69 72 20 70 ldren of their p
1760: 61 72 65 6e 74 73 2c 20 69 66 20 61 6e 79 7d 20 arents, if any}
1770: 5c 0a 09 20 20 20 20 7b 69 73 20 6e 6f 74 20 74 \.. {is not t
1780: 68 65 20 63 68 69 6c 64 20 6f 66 20 69 74 73 20 he child of its
1790: 70 61 72 65 6e 74 7d 20 7b 0a 09 09 53 45 4c 45 parent} {...SELE
17a0: 43 54 20 46 2e 6e 61 6d 65 2c 20 52 2e 72 65 76 CT F.name, R.rev
17b0: 0a 09 09 46 52 4f 4d 20 72 65 76 69 73 69 6f 6e ...FROM revision
17c0: 20 52 2c 20 72 65 76 69 73 69 6f 6e 20 50 2c 20 R, revision P,
17d0: 66 69 6c 65 20 46 0a 09 09 57 48 45 52 45 20 52 file F...WHERE R
17e0: 2e 66 69 64 20 3d 20 46 2e 66 69 64 20 20 20 20 .fid = F.fid
17f0: 20 20 20 20 2d 2d 20 67 65 74 20 66 69 6c 65 20 -- get file
1800: 6f 66 20 72 65 76 69 73 69 6f 6e 0a 09 09 41 4e of revision...AN
1810: 44 20 20 20 52 2e 62 70 61 72 65 6e 74 20 49 53 D R.bparent IS
1820: 20 4e 55 4c 4c 20 20 20 20 2d 2d 20 65 78 63 6c NULL -- excl
1830: 75 64 65 20 61 6c 6c 20 66 69 72 73 74 2d 6f 6e ude all first-on
1840: 2d 62 72 61 6e 63 68 20 72 65 76 69 73 69 6f 6e -branch revision
1850: 73 0a 09 09 41 4e 44 20 20 20 52 2e 70 61 72 65 s...AND R.pare
1860: 6e 74 20 49 53 20 4e 4f 54 20 4e 55 4c 4c 20 2d nt IS NOT NULL -
1870: 2d 20 77 68 69 63 68 20 61 72 65 20 6e 6f 74 20 - which are not
1880: 72 6f 6f 74 20 6f 66 20 74 68 65 69 72 20 6c 69 root of their li
1890: 6e 65 0a 09 09 41 4e 44 20 20 20 52 2e 70 61 72 ne...AND R.par
18a0: 65 6e 74 20 3d 20 50 2e 72 69 64 20 20 20 20 20 ent = P.rid
18b0: 2d 2d 20 67 65 74 20 69 6e 2d 6c 6f 64 20 70 61 -- get in-lod pa
18c0: 72 65 6e 74 0a 09 09 41 4e 44 20 20 20 50 2e 63 rent...AND P.c
18d0: 68 69 6c 64 20 21 3d 20 52 2e 72 69 64 20 20 20 hild != R.rid
18e0: 20 20 2d 2d 20 62 75 74 20 64 6f 65 73 20 6e 6f -- but does no
18f0: 74 20 68 61 76 65 20 72 65 76 20 61 73 20 70 72 t have rev as pr
1900: 69 6d 61 72 79 20 63 68 69 6c 64 0a 09 09 3b 0a imary child...;.
1910: 09 20 20 20 20 7d 0a 09 23 20 46 69 6e 64 20 61 . }..# Find a
1920: 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 77 69 74 ll revisions wit
1930: 68 20 61 20 62 72 61 6e 63 68 20 70 61 72 65 6e h a branch paren
1940: 74 20 73 79 6d 62 6f 6c 20 77 68 69 63 68 20 64 t symbol which d
1950: 6f 20 6e 6f 74 0a 09 23 20 68 61 76 65 20 61 20 o not..# have a
1960: 70 61 72 65 6e 74 2e 0a 09 43 68 65 63 6b 52 65 parent...CheckRe
1970: 76 20 5c 0a 09 20 20 20 20 7b 42 72 61 6e 63 68 v \.. {Branch
1980: 20 73 74 61 72 74 69 6e 67 20 72 65 76 69 73 69 starting revisi
1990: 6f 6e 73 20 68 61 76 65 20 74 6f 20 68 61 76 65 ons have to have
19a0: 20 61 20 70 61 72 65 6e 74 2c 20 69 66 20 6e 6f a parent, if no
19b0: 74 20 64 65 74 61 63 68 65 64 7d 20 5c 0a 09 20 t detached} \..
19c0: 20 20 20 7b 61 74 20 74 68 65 20 62 65 67 69 6e {at the begin
19d0: 6e 69 6e 67 20 6f 66 20 69 74 73 20 62 72 61 6e ning of its bran
19e0: 63 68 20 68 61 73 20 6e 6f 20 70 61 72 65 6e 74 ch has no parent
19f0: 2c 20 62 75 74 20 69 74 73 20 62 72 61 6e 63 68 , but its branch
1a00: 20 68 61 73 7d 20 7b 0a 09 09 53 45 4c 45 43 54 has} {...SELECT
1a10: 20 46 2e 6e 61 6d 65 2c 20 52 2e 72 65 76 0a 09 F.name, R.rev..
1a20: 09 46 52 4f 4d 20 72 65 76 69 73 69 6f 6e 20 52 .FROM revision R
1a30: 2c 20 66 69 6c 65 20 46 2c 20 62 72 61 6e 63 68 , file F, branch
1a40: 20 42 0a 09 09 57 48 45 52 45 20 52 2e 66 69 64 B...WHERE R.fid
1a50: 20 3d 20 46 2e 66 69 64 20 20 20 20 20 20 20 20 = F.fid
1a60: 20 2d 2d 20 67 65 74 20 66 69 6c 65 20 6f 66 20 -- get file of
1a70: 72 65 76 69 73 69 6f 6e 0a 09 09 41 4e 44 20 20 revision...AND
1a80: 20 52 2e 62 70 61 72 65 6e 74 20 49 53 20 4e 4f R.bparent IS NO
1a90: 54 20 4e 55 4c 4c 20 2d 2d 20 6c 69 6d 69 74 20 T NULL -- limit
1aa0: 74 6f 20 66 69 72 73 74 2d 6f 6e 2d 62 72 61 6e to first-on-bran
1ab0: 63 68 20 72 65 76 69 73 69 6f 6e 73 0a 09 09 41 ch revisions...A
1ac0: 4e 44 20 20 20 52 2e 70 61 72 65 6e 74 20 20 49 ND R.parent I
1ad0: 53 20 4e 55 4c 4c 20 20 20 20 20 2d 2d 20 77 68 S NULL -- wh
1ae0: 69 63 68 20 61 72 65 20 64 65 74 61 63 68 65 64 ich are detached
1af0: 0a 09 09 41 4e 44 20 20 20 42 2e 73 69 64 20 3d ...AND B.sid =
1b00: 20 52 2e 62 70 61 72 65 6e 74 20 20 20 20 20 2d R.bparent -
1b10: 2d 20 67 65 74 20 62 72 61 6e 63 68 20 67 6f 76 - get branch gov
1b20: 65 72 6e 69 6e 67 20 74 68 65 20 72 65 76 0a 09 erning the rev..
1b30: 09 41 4e 44 20 20 20 42 2e 66 69 64 20 3d 20 52 .AND B.fid = R
1b40: 2e 66 69 64 20 20 20 20 20 20 20 20 20 2d 2d 20 .fid --
1b50: 69 6e 20 74 68 65 20 72 65 76 69 73 69 6f 6e 27 in the revision'
1b60: 73 20 66 69 6c 65 0a 09 09 41 4e 44 20 20 20 42 s file...AND B
1b70: 2e 72 6f 6f 74 20 20 20 20 49 53 20 4e 4f 54 20 .root IS NOT
1b80: 4e 55 4c 4c 20 2d 2d 20 62 75 74 20 73 61 79 73 NULL -- but says
1b90: 20 74 68 61 74 20 62 72 61 6e 63 68 20 69 73 20 that branch is
1ba0: 61 74 74 61 63 68 65 64 0a 09 09 3b 0a 09 20 20 attached...;..
1bb0: 20 20 7d 0a 09 23 20 46 69 6e 64 20 61 6c 6c 20 }..# Find all
1bc0: 72 65 76 69 73 69 6f 6e 73 20 77 69 74 68 20 61 revisions with a
1bd0: 20 62 72 61 6e 63 68 20 70 61 72 65 6e 74 20 73 branch parent s
1be0: 79 6d 62 6f 6c 20 77 68 6f 73 65 20 70 61 72 65 ymbol whose pare
1bf0: 6e 74 0a 09 23 20 68 61 73 20 74 68 65 6d 20 61 nt..# has them a
1c00: 73 20 70 72 69 6d 61 72 79 20 63 68 69 6c 64 2e s primary child.
1c10: 0a 09 43 68 65 63 6b 52 65 76 20 5c 0a 09 20 20 ..CheckRev \..
1c20: 20 20 7b 42 72 61 6e 63 68 20 73 74 61 72 74 69 {Branch starti
1c30: 6e 67 20 72 65 76 69 73 69 6f 6e 73 20 6d 75 73 ng revisions mus
1c40: 74 20 6e 6f 74 20 62 65 20 70 72 69 6d 61 72 79 t not be primary
1c50: 20 63 68 69 6c 64 72 65 6e 20 6f 66 20 74 68 65 children of the
1c60: 69 72 20 70 61 72 65 6e 74 73 7d 20 5c 0a 09 20 ir parents} \..
1c70: 20 20 20 7b 61 74 20 74 68 65 20 62 65 67 69 6e {at the begin
1c80: 6e 69 6e 67 20 6f 66 20 69 74 73 20 62 72 61 6e ning of its bran
1c90: 63 68 20 69 73 20 74 68 65 20 70 72 69 6d 61 72 ch is the primar
1ca0: 79 20 63 68 69 6c 64 20 6f 66 20 69 74 73 20 70 y child of its p
1cb0: 61 72 65 6e 74 7d 20 7b 0a 09 09 53 45 4c 45 43 arent} {...SELEC
1cc0: 54 20 46 2e 6e 61 6d 65 2c 20 52 2e 72 65 76 0a T F.name, R.rev.
1cd0: 09 09 46 52 4f 4d 20 72 65 76 69 73 69 6f 6e 20 ..FROM revision
1ce0: 52 2c 20 72 65 76 69 73 69 6f 6e 20 50 2c 20 66 R, revision P, f
1cf0: 69 6c 65 20 46 0a 09 09 57 48 45 52 45 20 52 2e ile F...WHERE R.
1d00: 66 69 64 20 3d 20 46 2e 66 69 64 20 20 20 20 20 fid = F.fid
1d10: 20 20 20 20 2d 2d 20 67 65 74 20 66 69 6c 65 20 -- get file
1d20: 6f 66 20 72 65 76 69 73 69 6f 6e 0a 09 09 41 4e of revision...AN
1d30: 44 20 20 20 52 2e 62 70 61 72 65 6e 74 20 49 53 D R.bparent IS
1d40: 20 4e 4f 54 20 4e 55 4c 4c 20 2d 2d 20 6c 69 6d NOT NULL -- lim
1d50: 69 74 20 74 6f 20 66 69 72 73 74 2d 6f 6e 2d 62 it to first-on-b
1d60: 72 61 6e 63 68 20 72 65 76 69 73 69 6f 6e 73 0a ranch revisions.
1d70: 09 09 41 4e 44 20 20 20 52 2e 70 61 72 65 6e 74 ..AND R.parent
1d80: 20 49 53 20 4e 4f 54 20 4e 55 4c 4c 20 20 2d 2d IS NOT NULL --
1d90: 20 77 68 69 63 68 20 61 72 65 20 61 74 74 61 63 which are attac
1da0: 68 65 64 0a 09 09 41 4e 44 20 20 20 52 2e 70 61 hed...AND R.pa
1db0: 72 65 6e 74 20 3d 20 50 2e 72 69 64 20 20 20 20 rent = P.rid
1dc0: 20 20 2d 2d 20 67 65 74 20 6f 75 74 2d 6f 66 2d -- get out-of-
1dd0: 62 72 61 6e 63 68 20 70 61 72 65 6e 74 0a 09 09 branch parent...
1de0: 41 4e 44 20 20 20 50 2e 63 68 69 6c 64 20 3d 20 AND P.child =
1df0: 52 2e 72 69 64 20 20 20 20 20 20 20 2d 2d 20 77 R.rid -- w
1e00: 72 6f 6e 67 6c 79 20 68 61 73 20 72 65 76 20 61 rongly has rev a
1e10: 73 20 70 72 69 6d 61 72 79 20 63 68 69 6c 64 0a s primary child.
1e20: 09 09 3b 0a 09 20 20 20 20 7d 0a 09 23 20 46 69 ..;.. }..# Fi
1e30: 6e 64 20 61 6c 6c 20 72 65 76 69 73 69 6f 6e 73 nd all revisions
1e40: 20 77 69 74 68 20 61 20 6e 6f 6e 2d 4e 54 44 42 with a non-NTDB
1e50: 20 63 68 69 6c 64 20 77 68 69 63 68 20 61 72 65 child which are
1e60: 20 6e 6f 74 20 6f 6e 0a 09 23 20 74 68 65 20 4e not on..# the N
1e70: 54 44 42 2e 0a 09 43 68 65 63 6b 52 65 76 20 5c TDB...CheckRev \
1e80: 0a 09 20 20 20 20 7b 4e 54 44 42 20 74 6f 20 74 .. {NTDB to t
1e90: 72 75 6e 6b 20 74 72 61 6e 73 69 74 69 6f 6e 20 runk transition
1ea0: 68 61 73 20 74 6f 20 62 65 67 69 6e 20 6f 6e 20 has to begin on
1eb0: 4e 54 44 42 7d 20 5c 0a 09 20 20 20 20 7b 68 61 NTDB} \.. {ha
1ec0: 73 20 61 20 6e 6f 6e 2d 4e 54 44 42 20 63 68 69 s a non-NTDB chi
1ed0: 6c 64 2c 20 79 65 74 20 69 73 20 6e 6f 74 20 6f ld, yet is not o
1ee0: 6e 20 74 68 65 20 4e 54 44 42 7d 20 7b 0a 09 09 n the NTDB} {...
1ef0: 53 45 4c 45 43 54 20 46 2e 6e 61 6d 65 2c 20 52 SELECT F.name, R
1f00: 2e 72 65 76 0a 09 09 46 52 4f 4d 20 72 65 76 69 .rev...FROM revi
1f10: 73 69 6f 6e 20 52 2c 20 66 69 6c 65 20 46 0a 09 sion R, file F..
1f20: 09 57 48 45 52 45 20 52 2e 66 69 64 20 3d 20 46 .WHERE R.fid = F
1f30: 2e 66 69 64 20 20 20 20 20 20 20 20 20 2d 2d 20 .fid --
1f40: 67 65 74 20 66 69 6c 65 20 6f 66 20 72 65 76 69 get file of revi
1f50: 73 69 6f 6e 0a 09 09 41 4e 44 20 20 20 52 2e 64 sion...AND R.d
1f60: 62 63 68 69 6c 64 20 49 53 20 4e 4f 54 20 4e 55 bchild IS NOT NU
1f70: 4c 4c 20 2d 2d 20 6c 69 6d 69 74 20 74 6f 20 6c LL -- limit to l
1f80: 61 73 74 20 4e 54 44 42 20 72 65 76 69 73 69 6f ast NTDB revisio
1f90: 6e 0a 09 09 41 4e 44 20 20 20 4e 4f 54 20 52 2e n...AND NOT R.
1fa0: 69 73 64 65 66 61 75 6c 74 20 20 20 20 20 20 20 isdefault
1fb0: 2d 2d 20 62 75 74 20 73 69 67 6e 61 6c 73 20 6e -- but signals n
1fc0: 6f 74 2d 4e 54 44 42 0a 09 09 3b 0a 09 20 20 20 ot-NTDB...;..
1fd0: 20 7d 0a 09 23 20 46 69 6e 64 20 61 6c 6c 20 72 }..# Find all r
1fe0: 65 76 69 73 69 6f 6e 73 20 77 69 74 68 20 61 20 evisions with a
1ff0: 4e 54 44 42 20 70 61 72 65 6e 74 20 77 68 69 63 NTDB parent whic
2000: 68 20 61 72 65 20 6f 6e 20 74 68 65 20 4e 54 44 h are on the NTD
2010: 42 2e 0a 09 43 68 65 63 6b 52 65 76 20 5c 0a 09 B...CheckRev \..
2020: 20 20 20 20 7b 4e 54 44 42 20 74 6f 20 74 72 75 {NTDB to tru
2030: 6e 6b 20 74 72 61 6e 73 69 74 69 6f 6e 20 68 61 nk transition ha
2040: 73 20 74 6f 20 65 6e 64 20 6f 6e 20 6e 6f 6e 2d s to end on non-
2050: 4e 54 44 42 7d 20 5c 0a 09 20 20 20 20 7b 68 61 NTDB} \.. {ha
2060: 73 20 61 20 4e 54 44 42 20 70 61 72 65 6e 74 2c s a NTDB parent,
2070: 20 79 65 74 20 69 73 20 6f 6e 20 74 68 65 20 4e yet is on the N
2080: 54 44 42 7d 20 7b 0a 09 09 53 45 4c 45 43 54 20 TDB} {...SELECT
2090: 46 2e 6e 61 6d 65 2c 20 52 2e 72 65 76 0a 09 09 F.name, R.rev...
20a0: 46 52 4f 4d 20 72 65 76 69 73 69 6f 6e 20 52 2c FROM revision R,
20b0: 20 66 69 6c 65 20 46 0a 09 09 57 48 45 52 45 20 file F...WHERE
20c0: 52 2e 66 69 64 20 3d 20 46 2e 66 69 64 20 20 20 R.fid = F.fid
20d0: 20 20 20 20 20 20 20 2d 2d 20 67 65 74 20 66 69 -- get fi
20e0: 6c 65 20 6f 66 20 72 65 76 69 73 69 6f 6e 0a 09 le of revision..
20f0: 09 41 4e 44 20 20 20 52 2e 64 62 70 61 72 65 6e .AND R.dbparen
2100: 74 20 49 53 20 4e 4f 54 20 4e 55 4c 4c 20 2d 2d t IS NOT NULL --
2110: 20 6c 69 6d 69 74 20 74 6f 20 72 6f 6f 74 73 20 limit to roots
2120: 6f 66 20 6e 6f 6e 2d 4e 54 44 42 0a 09 09 41 4e of non-NTDB...AN
2130: 44 20 20 20 52 2e 69 73 64 65 66 61 75 6c 74 20 D R.isdefault
2140: 20 20 20 20 20 20 20 20 20 20 20 2d 2d 20 62 75 -- bu
2150: 74 20 73 69 67 6e 61 6c 73 20 74 6f 20 62 65 20 t signals to be
2160: 4e 54 44 42 0a 09 09 3b 0a 09 20 20 20 20 7d 0a NTDB...;.. }.
2170: 09 23 20 46 69 6e 64 20 61 6c 6c 20 72 65 76 69 .# Find all revi
2180: 73 69 6f 6e 73 20 77 69 74 68 20 61 20 63 68 69 sions with a chi
2190: 6c 64 20 77 68 69 63 68 20 64 69 73 61 67 72 65 ld which disagre
21a0: 65 73 20 61 62 6f 75 74 20 74 68 65 0a 09 23 20 es about the..#
21b0: 6c 69 6e 65 20 6f 66 20 64 65 76 65 6c 6f 70 6d line of developm
21c0: 65 6e 74 20 74 68 65 79 20 62 65 6c 6f 6e 67 20 ent they belong
21d0: 74 6f 2e 0a 09 43 68 65 63 6b 52 65 76 20 5c 0a to...CheckRev \.
21e0: 09 20 20 20 20 7b 52 65 76 69 73 69 6f 6e 73 20 . {Revisions
21f0: 61 6e 64 20 74 68 65 69 72 20 70 72 69 6d 61 72 and their primar
2200: 79 20 63 68 69 6c 64 72 65 6e 20 68 61 76 65 20 y children have
2210: 74 6f 20 62 65 20 69 6e 20 74 68 65 20 73 61 6d to be in the sam
2220: 65 20 4c 4f 44 7d 20 5c 0a 09 20 20 20 20 7b 61 e LOD} \.. {a
2230: 6e 64 20 69 74 73 20 70 72 69 6d 61 72 79 20 63 nd its primary c
2240: 68 69 6c 64 20 64 69 73 61 67 72 65 65 20 61 62 hild disagree ab
2250: 6f 75 74 20 74 68 65 69 72 20 4c 4f 44 7d 20 7b out their LOD} {
2260: 0a 09 09 53 45 4c 45 43 54 20 46 2e 6e 61 6d 65 ...SELECT F.name
2270: 2c 20 52 2e 72 65 76 0a 09 09 46 52 4f 4d 20 72 , R.rev...FROM r
2280: 65 76 69 73 69 6f 6e 20 52 2c 20 72 65 76 69 73 evision R, revis
2290: 69 6f 6e 20 43 2c 20 66 69 6c 65 20 46 0a 09 09 ion C, file F...
22a0: 57 48 45 52 45 20 52 2e 66 69 64 20 3d 20 46 2e WHERE R.fid = F.
22b0: 66 69 64 20 20 20 20 20 20 20 2d 2d 20 67 65 74 fid -- get
22c0: 20 66 69 6c 65 20 6f 66 20 72 65 76 69 73 69 6f file of revisio
22d0: 6e 0a 09 09 41 4e 44 20 20 20 52 2e 63 68 69 6c n...AND R.chil
22e0: 64 20 49 53 20 4e 4f 54 20 4e 55 4c 4c 20 2d 2d d IS NOT NULL --
22f0: 20 72 65 76 69 73 69 6f 6e 20 68 61 73 20 61 20 revision has a
2300: 70 72 69 6d 61 72 79 20 63 68 69 6c 64 0a 09 09 primary child...
2310: 41 4e 44 20 20 20 52 2e 63 68 69 6c 64 20 3d 20 AND R.child =
2320: 43 2e 72 69 64 20 20 20 20 20 2d 2d 20 67 65 74 C.rid -- get
2330: 20 74 68 61 74 20 63 68 69 6c 64 0a 09 09 41 4e that child...AN
2340: 44 20 20 20 43 2e 6c 6f 64 20 21 3d 20 52 2e 6c D C.lod != R.l
2350: 6f 64 20 20 20 20 20 20 2d 2d 20 63 68 69 6c 64 od -- child
2360: 20 77 72 6f 6e 67 6c 79 20 64 69 73 61 67 72 65 wrongly disagre
2370: 65 73 20 77 69 74 68 20 6c 6f 64 0a 09 09 3b 0a es with lod...;.
2380: 09 20 20 20 20 7d 0a 09 23 20 46 69 6e 64 20 61 . }..# Find a
2390: 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 77 69 74 ll revisions wit
23a0: 68 20 61 20 6e 6f 6e 2d 4e 54 44 42 20 63 68 69 h a non-NTDB chi
23b0: 6c 64 20 77 68 69 63 68 20 61 67 72 65 65 73 20 ld which agrees
23c0: 61 62 6f 75 74 0a 09 23 20 74 68 65 20 6c 69 6e about..# the lin
23d0: 65 20 6f 66 20 64 65 76 65 6c 6f 70 6d 65 6e 74 e of development
23e0: 20 74 68 65 79 20 62 65 6c 6f 6e 67 20 74 6f 2e they belong to.
23f0: 0a 09 43 68 65 63 6b 52 65 76 20 5c 0a 09 20 20 ..CheckRev \..
2400: 20 20 7b 4e 54 44 42 20 61 6e 64 20 74 72 75 6e {NTDB and trun
2410: 6b 20 72 65 76 69 73 69 6f 6e 73 20 68 61 76 65 k revisions have
2420: 20 74 6f 20 62 65 20 69 6e 20 64 69 66 66 65 72 to be in differ
2430: 65 6e 74 20 4c 4f 44 73 7d 20 5c 0a 09 20 20 20 ent LODs} \..
2440: 20 7b 6f 6e 20 4e 54 44 42 20 61 6e 64 20 69 74 {on NTDB and it
2450: 73 20 6e 6f 6e 2d 4e 54 44 42 20 63 68 69 6c 64 s non-NTDB child
2460: 20 77 72 6f 6e 67 6c 79 20 61 67 72 65 65 20 61 wrongly agree a
2470: 62 6f 75 74 20 74 68 65 69 72 20 4c 4f 44 7d 20 bout their LOD}
2480: 7b 0a 09 09 53 45 4c 45 43 54 20 46 2e 6e 61 6d {...SELECT F.nam
2490: 65 2c 20 52 2e 72 65 76 0a 09 09 46 52 4f 4d 20 e, R.rev...FROM
24a0: 72 65 76 69 73 69 6f 6e 20 52 2c 20 72 65 76 69 revision R, revi
24b0: 73 69 6f 6e 20 43 2c 20 66 69 6c 65 20 46 0a 09 sion C, file F..
24c0: 09 57 48 45 52 45 20 52 2e 66 69 64 20 3d 20 46 .WHERE R.fid = F
24d0: 2e 66 69 64 20 20 20 20 20 20 20 20 20 2d 2d 20 .fid --
24e0: 67 65 74 20 66 69 6c 65 20 6f 66 20 72 65 76 69 get file of revi
24f0: 73 69 6f 6e 0a 09 09 41 4e 44 20 20 20 52 2e 64 sion...AND R.d
2500: 62 63 68 69 6c 64 20 49 53 20 4e 4f 54 20 4e 55 bchild IS NOT NU
2510: 4c 4c 20 2d 2d 20 6c 69 6d 69 74 20 74 6f 20 6c LL -- limit to l
2520: 61 73 74 20 4e 54 44 42 20 72 65 76 69 73 69 6f ast NTDB revisio
2530: 6e 0a 09 09 41 4e 44 20 20 20 52 2e 64 62 63 68 n...AND R.dbch
2540: 69 6c 64 20 3d 20 43 2e 72 69 64 20 20 20 20 20 ild = C.rid
2550: 2d 2d 20 67 65 74 20 6e 6f 6e 2d 4e 54 44 42 20 -- get non-NTDB
2560: 63 68 69 6c 64 0a 09 09 41 4e 44 20 20 20 43 2e child...AND C.
2570: 6c 6f 64 20 3d 20 52 2e 6c 6f 64 20 20 20 20 20 lod = R.lod
2580: 20 20 20 20 2d 2d 20 63 68 69 6c 64 20 77 72 6f -- child wro
2590: 6e 67 6c 79 20 68 61 73 20 73 61 6d 65 20 6c 6f ngly has same lo
25a0: 64 0a 09 09 3b 0a 09 20 20 20 20 7d 0a 09 23 20 d...;.. }..#
25b0: 46 69 6e 64 20 61 6c 6c 20 72 65 76 69 73 69 6f Find all revisio
25c0: 6e 73 20 77 69 74 68 20 61 20 62 72 61 6e 63 68 ns with a branch
25d0: 20 70 61 72 65 6e 74 20 73 79 6d 62 6f 6c 20 77 parent symbol w
25e0: 68 69 63 68 20 69 73 20 6e 6f 74 0a 09 23 20 74 hich is not..# t
25f0: 68 65 69 72 20 4c 4f 44 2e 0a 09 43 68 65 63 6b heir LOD...Check
2600: 52 65 76 20 5c 0a 09 20 20 20 20 7b 42 72 61 6e Rev \.. {Bran
2610: 63 68 20 73 74 61 72 74 69 6e 67 20 72 65 76 69 ch starting revi
2620: 73 69 6f 6e 73 20 68 61 76 65 20 74 6f 20 68 61 sions have to ha
2630: 76 65 20 74 68 65 69 72 20 4c 4f 44 20 61 73 20 ve their LOD as
2640: 62 72 61 6e 63 68 20 70 61 72 65 6e 74 20 73 79 branch parent sy
2650: 6d 62 6f 6c 7d 20 5c 0a 09 20 20 20 20 7b 61 74 mbol} \.. {at
2660: 20 74 68 65 20 62 65 67 69 6e 6e 69 6e 67 20 6f the beginning o
2670: 66 20 69 74 73 20 62 72 61 6e 63 68 20 64 6f 65 f its branch doe
2680: 73 20 6e 6f 74 20 68 61 76 65 20 74 68 65 20 62 s not have the b
2690: 72 61 6e 63 68 20 73 79 6d 62 6f 6c 20 61 73 20 ranch symbol as
26a0: 69 74 73 20 4c 4f 44 7d 20 7b 0a 09 09 53 45 4c its LOD} {...SEL
26b0: 45 43 54 20 46 2e 6e 61 6d 65 2c 20 52 2e 72 65 ECT F.name, R.re
26c0: 76 0a 09 09 46 52 4f 4d 20 72 65 76 69 73 69 6f v...FROM revisio
26d0: 6e 20 52 2c 20 66 69 6c 65 20 46 0a 09 09 57 48 n R, file F...WH
26e0: 45 52 45 20 52 2e 66 69 64 20 3d 20 46 2e 66 69 ERE R.fid = F.fi
26f0: 64 20 20 20 20 20 20 20 20 20 2d 2d 20 67 65 74 d -- get
2700: 20 66 69 6c 65 20 6f 66 20 72 65 76 69 73 69 6f file of revisio
2710: 6e 0a 09 09 41 4e 44 20 20 20 52 2e 62 70 61 72 n...AND R.bpar
2720: 65 6e 74 20 49 53 20 4e 4f 54 20 4e 55 4c 4c 20 ent IS NOT NULL
2730: 2d 2d 20 6c 69 6d 69 74 20 74 6f 20 62 72 61 6e -- limit to bran
2740: 63 68 2d 66 69 72 73 74 20 72 65 76 69 73 69 6f ch-first revisio
2750: 6e 73 0a 09 09 41 4e 44 20 20 20 52 2e 6c 6f 64 ns...AND R.lod
2760: 20 21 3d 20 52 2e 62 70 61 72 65 6e 74 20 20 20 != R.bparent
2770: 20 2d 2d 20 6f 75 74 2d 6f 66 2d 62 72 61 6e 63 -- out-of-branc
2780: 68 20 70 61 72 65 6e 74 20 77 72 6f 6e 67 6c 79 h parent wrongly
2790: 20 69 73 20 6e 6f 74 20 74 68 65 20 6c 6f 64 0a is not the lod.
27a0: 09 09 3b 0a 09 20 20 20 20 7d 0a 09 23 20 46 69 ..;.. }..# Fi
27b0: 6e 64 20 61 6c 6c 20 72 65 76 69 73 69 6f 6e 73 nd all revisions
27c0: 20 77 69 74 68 20 61 20 62 72 61 6e 63 68 20 70 with a branch p
27d0: 61 72 65 6e 74 20 73 79 6d 62 6f 6c 20 77 68 6f arent symbol who
27e0: 73 65 20 70 61 72 65 6e 74 0a 09 23 20 69 73 20 se parent..# is
27f0: 69 6e 20 74 68 65 20 73 61 6d 65 20 6c 69 6e 65 in the same line
2800: 20 6f 66 20 64 65 76 65 6c 6f 70 6d 65 6e 74 2e of development.
2810: 0a 09 43 68 65 63 6b 52 65 76 20 5c 0a 09 20 20 ..CheckRev \..
2820: 20 20 7b 52 65 76 69 73 69 6f 6e 73 20 61 6e 64 {Revisions and
2830: 20 74 68 65 69 72 20 62 72 61 6e 63 68 20 63 68 their branch ch
2840: 69 6c 64 72 65 6e 20 68 61 76 65 20 74 6f 20 62 ildren have to b
2850: 65 20 69 6e 20 64 69 66 66 65 72 65 6e 74 20 4c e in different L
2860: 4f 44 73 7d 20 5c 0a 09 20 20 20 20 7b 61 74 20 ODs} \.. {at
2870: 74 68 65 20 62 65 67 69 6e 6e 69 6e 67 20 6f 66 the beginning of
2880: 20 69 74 73 20 62 72 61 6e 63 68 20 61 6e 64 20 its branch and
2890: 69 74 73 20 70 61 72 65 6e 74 20 77 72 6f 6e 67 its parent wrong
28a0: 6c 79 20 61 67 72 65 65 20 61 62 6f 75 74 20 74 ly agree about t
28b0: 68 65 69 72 20 4c 4f 44 7d 20 7b 0a 09 09 53 45 heir LOD} {...SE
28c0: 4c 45 43 54 20 46 2e 6e 61 6d 65 2c 20 52 2e 72 LECT F.name, R.r
28d0: 65 76 0a 09 09 46 52 4f 4d 20 72 65 76 69 73 69 ev...FROM revisi
28e0: 6f 6e 20 52 2c 20 72 65 76 69 73 69 6f 6e 20 50 on R, revision P
28f0: 2c 20 66 69 6c 65 20 46 0a 09 09 57 48 45 52 45 , file F...WHERE
2900: 20 52 2e 66 69 64 20 3d 20 46 2e 66 69 64 20 20 R.fid = F.fid
2910: 20 20 20 20 20 20 20 20 2d 2d 20 67 65 74 20 66 -- get f
2920: 69 6c 65 20 6f 66 20 72 65 76 69 73 69 6f 6e 0a ile of revision.
2930: 09 09 41 4e 44 20 20 20 52 2e 62 70 61 72 65 6e ..AND R.bparen
2940: 74 20 49 53 20 4e 4f 54 20 4e 55 4c 4c 20 20 2d t IS NOT NULL -
2950: 2d 20 6c 69 6d 69 74 20 74 6f 20 62 72 61 6e 63 - limit to branc
2960: 68 2d 66 69 72 73 74 20 72 65 76 69 73 69 6f 6e h-first revision
2970: 73 0a 09 09 41 4e 44 20 20 20 52 2e 70 61 72 65 s...AND R.pare
2980: 6e 74 20 3d 20 50 2e 72 69 64 20 20 20 20 20 20 nt = P.rid
2990: 20 2d 2d 20 67 65 74 20 6f 75 74 2d 6f 66 2d 62 -- get out-of-b
29a0: 72 61 6e 63 68 20 70 61 72 65 6e 74 20 6f 66 20 ranch parent of
29b0: 72 65 76 69 73 69 6f 6e 0a 09 09 41 4e 44 20 20 revision...AND
29c0: 20 52 2e 6c 6f 64 20 3d 20 50 2e 6c 6f 64 20 20 R.lod = P.lod
29d0: 20 20 20 20 20 20 20 20 2d 2d 20 72 65 76 20 61 -- rev a
29e0: 6e 64 20 70 61 72 65 6e 74 20 77 72 6f 6e 67 6c nd parent wrongl
29f0: 79 20 61 67 72 65 65 20 6f 6e 20 6c 6f 64 0a 09 y agree on lod..
2a00: 09 3b 0a 09 20 20 20 20 7d 0a 09 72 65 74 75 72 .;.. }..retur
2a10: 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 70 72 6f n. }.. pro
2a20: 63 20 4d 65 74 61 20 7b 7d 20 7b 0a 09 23 20 54 c Meta {} {..# T
2a30: 68 69 73 20 63 6f 64 65 20 70 65 72 66 6f 72 6d his code perform
2a40: 73 20 61 20 6e 75 6d 62 65 72 20 6f 66 20 70 61 s a number of pa
2a50: 72 61 6e 6f 69 64 20 63 68 65 63 6b 73 20 6f 66 ranoid checks of
2a60: 20 74 68 65 0a 09 23 20 64 61 74 61 62 61 73 65 the..# database
2a70: 2c 20 73 65 61 72 63 68 69 6e 67 20 66 6f 72 20 , searching for
2a80: 69 6e 63 6f 6e 73 69 73 74 65 6e 74 20 63 72 6f inconsistent cro
2a90: 73 73 2d 72 65 66 65 72 65 6e 63 65 73 2e 0a 0a ss-references...
2aa0: 09 75 70 76 61 72 20 31 20 6e 20 6e 20 3b 20 23 .upvar 1 n n ; #
2ab0: 20 43 6f 75 6e 74 65 72 20 66 6f 72 20 74 68 65 Counter for the
2ac0: 20 63 68 65 63 6b 73 20 28 77 65 20 70 72 69 6e checks (we prin
2ad0: 74 20 61 6e 20 69 64 20 62 65 66 6f 72 65 0a 09 t an id before..
2ae0: 09 20 20 20 20 20 20 23 20 74 68 65 20 6d 61 69 . # the mai
2af0: 6e 20 6c 61 62 65 6c 29 2e 0a 0a 09 23 20 46 69 n label)....# Fi
2b00: 6e 64 20 61 6c 6c 20 72 65 76 69 73 69 6f 6e 73 nd all revisions
2b10: 20 77 68 69 63 68 20 64 69 73 67 72 65 65 20 77 which disgree w
2b20: 69 74 68 20 74 68 65 69 72 20 6d 65 74 61 20 64 ith their meta d
2b30: 61 74 61 20 61 62 6f 75 74 0a 09 23 20 74 68 65 ata about..# the
2b40: 20 62 72 61 6e 63 68 2f 6c 69 6e 65 20 6f 66 20 branch/line of
2b50: 64 65 76 65 6c 6f 70 6d 65 6e 74 20 74 68 65 79 development they
2b60: 20 62 65 6c 6f 6e 67 20 74 6f 2e 0a 09 43 68 65 belong to...Che
2b70: 63 6b 52 65 76 20 5c 0a 09 20 20 20 20 7b 52 65 ckRev \.. {Re
2b80: 76 69 73 69 6f 6e 73 20 61 6e 64 20 74 68 65 69 visions and thei
2b90: 72 20 6d 65 74 61 20 64 61 74 61 20 68 61 76 65 r meta data have
2ba0: 20 74 6f 20 62 65 20 69 6e 20 74 68 65 20 73 61 to be in the sa
2bb0: 6d 65 20 4c 4f 44 7d 20 5c 0a 09 20 20 20 20 7b me LOD} \.. {
2bc0: 64 69 73 61 67 72 65 65 73 20 77 69 74 68 20 69 disagrees with i
2bd0: 74 73 20 6d 65 74 61 20 64 61 74 61 20 61 62 6f ts meta data abo
2be0: 75 74 20 6f 77 6e 69 6e 67 20 4c 4f 44 7d 20 7b ut owning LOD} {
2bf0: 0a 09 09 53 45 4c 45 43 54 20 46 2e 6e 61 6d 65 ...SELECT F.name
2c00: 2c 20 52 2e 72 65 76 0a 09 09 46 52 4f 4d 20 72 , R.rev...FROM r
2c10: 65 76 69 73 69 6f 6e 20 52 2c 20 6d 65 74 61 20 evision R, meta
2c20: 4d 2c 20 66 69 6c 65 20 46 0a 09 09 57 48 45 52 M, file F...WHER
2c30: 45 20 52 2e 6d 69 64 20 3d 20 4d 2e 6d 69 64 20 E R.mid = M.mid
2c40: 20 20 2d 2d 20 67 65 74 20 6d 65 74 61 20 64 61 -- get meta da
2c50: 74 61 20 6f 66 20 72 65 76 69 73 69 6f 6e 0a 09 ta of revision..
2c60: 09 41 4e 44 20 20 20 52 2e 6c 6f 64 20 21 3d 20 .AND R.lod !=
2c70: 4d 2e 62 69 64 20 20 2d 2d 20 72 65 76 20 77 72 M.bid -- rev wr
2c80: 6f 6e 67 6c 79 20 64 69 73 61 67 72 65 65 73 20 ongly disagrees
2c90: 77 69 74 68 20 6d 65 74 61 20 61 62 6f 75 74 20 with meta about
2ca0: 6c 6f 64 0a 09 09 41 4e 44 20 20 20 52 2e 66 69 lod...AND R.fi
2cb0: 64 20 3d 20 46 2e 66 69 64 20 20 20 2d 2d 20 67 d = F.fid -- g
2cc0: 65 74 20 66 69 6c 65 20 6f 66 20 72 65 76 69 73 et file of revis
2cd0: 69 6f 6e 0a 09 09 3b 0a 09 20 20 20 20 7d 0a 09 ion...;.. }..
2ce0: 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 return. }..
2cf0: 20 20 70 72 6f 63 20 52 65 76 69 73 69 6f 6e 43 proc RevisionC
2d00: 68 61 6e 67 65 73 65 74 73 20 7b 7d 20 7b 0a 09 hangesets {} {..
2d10: 23 20 54 68 69 73 20 63 6f 64 65 20 70 65 72 66 # This code perf
2d20: 6f 72 6d 73 20 61 20 6e 75 6d 62 65 72 20 6f 66 orms a number of
2d30: 20 70 61 72 61 6e 6f 69 64 20 63 68 65 63 6b 73 paranoid checks
2d40: 20 6f 66 20 74 68 65 0a 09 23 20 64 61 74 61 62 of the..# datab
2d50: 61 73 65 2c 20 73 65 61 72 63 68 69 6e 67 20 66 ase, searching f
2d60: 6f 72 20 69 6e 63 6f 6e 73 69 73 74 65 6e 74 20 or inconsistent
2d70: 63 68 61 6e 67 65 73 65 74 2f 72 65 76 69 73 69 changeset/revisi
2d80: 6f 6e 0a 09 23 20 69 6e 66 6f 72 6d 61 74 69 6f on..# informatio
2d90: 6e 2e 0a 0a 09 75 70 76 61 72 20 31 20 6e 20 6e n....upvar 1 n n
2da0: 20 3b 20 23 20 43 6f 75 6e 74 65 72 20 66 6f 72 ; # Counter for
2db0: 20 74 68 65 20 63 68 65 63 6b 73 20 28 77 65 20 the checks (we
2dc0: 70 72 69 6e 74 20 61 6e 20 69 64 20 62 65 66 6f print an id befo
2dd0: 72 65 0a 09 09 20 20 20 20 20 20 23 20 74 68 65 re... # the
2de0: 20 6d 61 69 6e 20 6c 61 62 65 6c 29 2e 0a 0a 09 main label)....
2df0: 23 20 46 69 6e 64 20 61 6c 6c 20 72 65 76 69 73 # Find all revis
2e00: 69 6f 6e 73 20 77 68 69 63 68 20 61 72 65 20 6e ions which are n
2e10: 6f 74 20 75 73 65 64 20 62 79 20 61 74 20 6c 65 ot used by at le
2e20: 61 73 74 20 6f 6e 65 0a 09 23 20 63 68 61 6e 67 ast one..# chang
2e30: 65 73 65 74 2e 0a 09 43 68 65 63 6b 52 65 76 20 eset...CheckRev
2e40: 5c 0a 09 20 20 20 20 7b 41 6c 6c 20 72 65 76 69 \.. {All revi
2e50: 73 69 6f 6e 73 20 68 61 76 65 20 74 6f 20 62 65 sions have to be
2e60: 20 75 73 65 64 20 62 79 20 6c 65 61 73 74 20 6f used by least o
2e70: 6e 65 20 63 68 61 6e 67 65 73 65 74 7d 20 5c 0a ne changeset} \.
2e80: 09 20 20 20 20 7b 69 73 20 6e 6f 74 20 75 73 65 . {is not use
2e90: 64 20 62 79 20 61 20 63 68 61 6e 67 65 73 65 74 d by a changeset
2ea0: 7d 20 7b 0a 09 09 2d 2d 20 55 6e 75 73 65 64 20 } {...-- Unused
2eb0: 72 65 76 69 73 69 6f 6e 73 20 3d 20 41 6c 6c 20 revisions = All
2ec0: 72 65 76 69 73 69 6f 6e 73 0a 09 09 2d 2d 20 20 revisions...--
2ed0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
2ee0: 2d 20 72 65 76 69 73 69 6f 6e 73 20 75 73 65 64 - revisions used
2ef0: 20 62 79 20 72 65 76 69 73 69 6f 6e 20 63 68 61 by revision cha
2f00: 6e 67 65 73 65 74 73 2e 0a 09 09 2d 2d 0a 09 09 ngesets....--...
2f10: 2d 2d 20 42 6f 74 68 20 73 65 74 73 20 63 61 6e -- Both sets can
2f20: 20 62 65 20 63 6f 6d 70 75 74 65 64 20 65 61 73 be computed eas
2f30: 69 6c 79 2c 20 61 6e 64 20 73 75 62 74 72 61 63 ily, and subtrac
2f40: 74 65 64 0a 20 20 20 20 20 20 20 20 20 20 20 20 ted.
2f50: 20 20 20 20 2d 2d 20 66 72 6f 6d 20 65 61 63 68 -- from each
2f60: 20 6f 74 68 65 72 2e 20 54 68 65 6e 20 77 65 20 other. Then we
2f70: 63 61 6e 20 67 65 74 20 74 68 65 20 61 73 73 6f can get the asso
2f80: 63 69 61 74 65 64 0a 20 20 20 20 20 20 20 20 20 ciated.
2f90: 20 20 20 20 20 20 20 2d 2d 20 66 69 6c 65 20 28 -- file (
2fa0: 6e 61 6d 65 29 20 66 6f 72 20 64 69 73 70 6c 61 name) for displa
2fb0: 79 2e 0a 0a 09 09 53 45 4c 45 43 54 20 46 2e 6e y.....SELECT F.n
2fc0: 61 6d 65 2c 20 52 2e 72 65 76 0a 09 09 46 52 4f ame, R.rev...FRO
2fd0: 4d 20 72 65 76 69 73 69 6f 6e 20 52 2c 20 66 69 M revision R, fi
2fe0: 6c 65 20 46 0a 09 09 57 48 45 52 45 20 52 2e 72 le F...WHERE R.r
2ff0: 69 64 20 49 4e 20 28 53 45 4c 45 43 54 20 72 69 id IN (SELECT ri
3000: 64 0a 09 09 09 09 46 52 4f 4d 20 72 65 76 69 73 d.....FROM revis
3010: 69 6f 6e 20 20 20 20 20 20 20 20 20 20 20 20 20 ion
3020: 20 20 20 2d 2d 20 41 6c 6c 20 72 65 76 69 73 69 -- All revisi
3030: 6f 6e 73 0a 09 09 09 09 45 58 43 45 50 54 20 20 ons.....EXCEPT
3040: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
3050: 20 20 20 20 20 2d 2d 20 73 75 62 74 72 61 63 74 -- subtract
3060: 0a 09 09 09 09 53 45 4c 45 43 54 20 43 49 2e 69 .....SELECT CI.i
3070: 69 64 0a 09 09 09 09 46 52 4f 4d 20 63 73 69 74 id.....FROM csit
3080: 65 6d 20 43 49 2c 20 63 68 61 6e 67 65 73 65 74 em CI, changeset
3090: 20 43 20 20 2d 2d 20 72 65 76 69 73 69 6f 6e 73 C -- revisions
30a0: 20 75 73 65 64 0a 09 09 09 09 57 48 45 52 45 20 used.....WHERE
30b0: 43 2e 63 69 64 20 3d 20 43 49 2e 63 69 64 20 20 C.cid = CI.cid
30c0: 20 20 20 20 20 20 20 2d 2d 20 62 79 20 61 6e 79 -- by any
30d0: 20 72 65 76 69 73 69 6f 6e 0a 09 09 09 09 41 4e revision.....AN
30e0: 44 20 43 2e 74 79 70 65 20 3d 20 30 29 20 20 20 D C.type = 0)
30f0: 20 20 20 20 20 20 20 20 20 20 20 2d 2d 20 63 68 -- ch
3100: 61 6e 67 65 73 65 74 0a 09 09 41 4e 44 20 20 20 angeset...AND
3110: 52 2e 66 69 64 20 3d 20 46 2e 66 69 64 20 20 20 R.fid = F.fid
3120: 20 20 20 20 20 20 20 20 20 20 20 2d 2d 20 67 65 -- ge
3130: 74 20 66 69 6c 65 20 6f 66 20 75 6e 75 73 65 64 t file of unused
3140: 20 72 65 76 69 73 69 6f 6e 0a 09 20 20 20 20 7d revision.. }
3150: 0a 09 23 20 46 69 6e 64 20 61 6c 6c 20 72 65 76 ..# Find all rev
3160: 69 73 69 6f 6e 73 20 77 68 69 63 68 20 61 72 65 isions which are
3170: 20 75 73 65 64 20 62 79 20 6d 6f 72 65 20 74 68 used by more th
3180: 61 6e 20 6f 6e 65 0a 09 23 20 63 68 61 6e 67 65 an one..# change
3190: 73 65 74 2e 0a 09 43 68 65 63 6b 52 65 76 20 5c set...CheckRev \
31a0: 0a 09 20 20 20 20 7b 41 6c 6c 20 72 65 76 69 73 .. {All revis
31b0: 69 6f 6e 73 20 68 61 76 65 20 74 6f 20 62 65 20 ions have to be
31c0: 75 73 65 64 20 62 79 20 61 74 20 6d 6f 73 74 20 used by at most
31d0: 6f 6e 65 20 63 68 61 6e 67 65 73 65 74 7d 20 5c one changeset} \
31e0: 0a 09 20 20 20 20 7b 69 73 20 75 73 65 64 20 62 .. {is used b
31f0: 79 20 6d 75 6c 74 69 70 6c 65 20 63 68 61 6e 67 y multiple chang
3200: 65 73 65 74 73 7d 20 7b 0a 09 09 2d 2d 20 50 72 esets} {...-- Pr
3210: 69 6e 63 69 70 6c 65 20 6f 66 20 6f 70 65 72 61 inciple of opera
3220: 74 69 6f 6e 3a 20 47 65 74 20 61 6c 6c 20 72 65 tion: Get all re
3230: 76 69 73 69 6f 6e 2f 63 68 61 6e 67 65 73 65 74 vision/changeset
3240: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
3250: 20 2d 2d 20 70 61 69 72 73 20 66 6f 72 20 61 6c -- pairs for al
3260: 6c 20 72 65 76 69 73 69 6f 6e 20 63 68 61 6e 67 l revision chang
3270: 65 73 65 74 73 2c 20 67 72 6f 75 70 20 62 79 0a esets, group by.
3280: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
3290: 2d 2d 20 72 65 76 69 73 69 6f 6e 20 74 6f 20 61 -- revision to a
32a0: 67 67 72 65 67 61 74 65 20 74 68 65 20 63 68 61 ggregate the cha
32b0: 6e 67 65 73 65 74 2c 20 63 6f 75 6e 74 69 6e 67 ngeset, counting
32c0: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
32d0: 20 2d 2d 20 74 68 65 6d 2e 20 46 72 6f 6d 20 74 -- them. From t
32e0: 68 65 20 72 65 73 75 6c 74 69 6e 67 20 72 65 76 he resulting rev
32f0: 69 73 69 6f 6e 2f 63 6f 75 6e 74 20 74 61 62 6c ision/count tabl
3300: 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 e.
3310: 20 20 2d 2d 20 73 65 6c 65 63 74 20 74 68 6f 73 -- select thos
3320: 65 20 77 69 74 68 20 6d 6f 72 65 20 74 68 61 6e e with more than
3330: 20 6f 6e 65 20 75 73 65 72 2c 20 61 6e 64 20 67 one user, and g
3340: 65 74 20 74 68 65 69 72 0a 20 20 20 20 20 20 20 et their.
3350: 20 20 20 20 20 20 20 20 20 2d 2d 20 61 73 73 6f -- asso
3360: 63 69 61 74 65 64 20 66 69 6c 65 20 28 6e 61 6d ciated file (nam
3370: 65 29 20 66 6f 72 20 64 69 73 70 6c 61 79 2e 0a e) for display..
3380: 0a 09 09 53 45 4c 45 43 54 20 46 2e 6e 61 6d 65 ...SELECT F.name
3390: 2c 20 52 2e 72 65 76 0a 09 09 46 52 4f 4d 20 72 , R.rev...FROM r
33a0: 65 76 69 73 69 6f 6e 20 52 2c 20 66 69 6c 65 20 evision R, file
33b0: 46 2c 0a 09 09 20 20 20 20 20 28 53 45 4c 45 43 F,... (SELEC
33c0: 54 20 43 49 2e 69 69 64 20 20 20 20 20 20 20 20 T CI.iid
33d0: 41 53 20 72 69 64 2c 20 20 2d 2d 20 72 65 76 69 AS rid, -- revi
33e0: 73 69 6f 6e 20 69 74 65 6d 0a 09 09 20 20 20 20 sion item...
33f0: 20 20 20 20 20 20 20 20 20 63 6f 75 6e 74 28 43 count(C
3400: 49 2e 63 69 64 29 20 41 53 20 63 6f 75 6e 74 20 I.cid) AS count
3410: 2d 2d 20 6e 75 6d 62 65 72 20 6f 66 20 63 73 65 -- number of cse
3420: 74 73 20 75 73 69 6e 67 20 69 74 65 6d 0a 09 09 ts using item...
3430: 20 20 20 20 20 20 46 52 4f 4d 20 63 73 69 74 65 FROM csite
3440: 6d 20 43 49 2c 20 63 68 61 6e 67 65 73 65 74 20 m CI, changeset
3450: 43 0a 09 09 20 20 20 20 20 20 57 48 45 52 45 20 C... WHERE
3460: 43 2e 74 79 70 65 20 3d 20 30 20 20 20 20 20 20 C.type = 0
3470: 20 20 20 20 20 20 2d 2d 20 6c 69 6d 69 74 20 74 -- limit t
3480: 6f 20 72 65 76 69 73 69 6f 6e 20 63 73 65 74 73 o revision csets
3490: 0a 09 09 20 20 20 20 20 20 41 4e 44 20 20 20 43 ... AND C
34a0: 2e 63 69 64 20 20 3d 20 43 49 2e 63 69 64 20 20 .cid = CI.cid
34b0: 20 20 20 20 20 2d 2d 20 67 65 74 20 69 74 65 6d -- get item
34c0: 20 69 6e 20 63 68 61 6e 67 65 73 65 74 0a 09 09 in changeset...
34d0: 20 20 20 20 20 20 47 52 4f 55 50 20 42 59 20 43 GROUP BY C
34e0: 49 2e 69 69 64 20 20 20 20 20 20 20 20 20 20 20 I.iid
34f0: 20 20 2d 2d 20 61 67 67 72 65 67 61 74 65 20 62 -- aggregate b
3500: 79 20 69 74 65 6d 2c 20 63 6f 75 6e 74 20 63 73 y item, count cs
3510: 65 74 73 2f 69 74 65 6d 0a 09 09 20 20 20 20 20 ets/item...
3520: 29 20 41 53 20 55 0a 09 09 57 48 45 52 45 20 55 ) AS U...WHERE U
3530: 2e 63 6f 75 6e 74 20 3e 20 31 20 20 20 20 2d 2d .count > 1 --
3540: 20 6c 69 6d 69 74 20 74 6f 20 69 74 65 6d 20 77 limit to item w
3550: 69 74 68 20 6d 75 6c 74 69 70 6c 65 20 75 73 65 ith multiple use
3560: 72 73 0a 09 09 41 4e 44 20 20 20 52 2e 72 69 64 rs...AND R.rid
3570: 20 3d 20 55 2e 72 69 64 20 20 2d 2d 20 67 65 74 = U.rid -- get
3580: 20 72 65 76 69 73 69 6f 6e 20 6f 66 20 69 74 65 revision of ite
3590: 6d 0a 09 09 41 4e 44 20 20 20 52 2e 66 69 64 20 m...AND R.fid
35a0: 3d 20 46 2e 66 69 64 20 20 2d 2d 20 67 65 74 20 = F.fid -- get
35b0: 66 69 6c 65 20 6f 66 20 72 65 76 69 73 69 6f 6e file of revision
35c0: 0a 09 20 20 20 20 7d 0a 09 23 20 41 6c 6c 20 72 .. }..# All r
35d0: 65 76 69 73 69 6f 6e 73 20 68 61 76 65 20 74 6f evisions have to
35e0: 20 72 65 66 65 72 20 74 6f 20 74 68 65 20 73 61 refer to the sa
35f0: 6d 65 20 6d 65 74 61 20 69 6e 66 6f 72 6d 61 74 me meta informat
3600: 69 6f 6e 20 61 73 0a 09 23 20 74 68 65 69 72 20 ion as..# their
3610: 63 68 61 6e 67 65 73 65 74 2e 0a 09 43 68 65 63 changeset...Chec
3620: 6b 52 65 76 43 53 20 5c 0a 09 20 20 20 20 7b 41 kRevCS \.. {A
3630: 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 68 61 76 ll revisions hav
3640: 65 20 74 6f 20 61 67 72 65 65 20 77 69 74 68 20 e to agree with
3650: 74 68 65 69 72 20 63 68 61 6e 67 65 73 65 74 20 their changeset
3660: 61 62 6f 75 74 20 74 68 65 20 75 73 65 64 20 6d about the used m
3670: 65 74 61 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 7d eta information}
3680: 20 5c 0a 09 20 20 20 20 7b 64 69 73 61 67 72 65 \.. {disagre
3690: 65 73 20 77 69 74 68 20 69 74 73 20 63 68 61 6e es with its chan
36a0: 67 65 73 65 74 20 40 20 61 62 6f 75 74 20 74 68 geset @ about th
36b0: 65 20 6d 65 74 61 20 69 6e 66 6f 72 6d 61 74 69 e meta informati
36c0: 6f 6e 7d 20 7b 0a 09 09 53 45 4c 45 43 54 20 43 on} {...SELECT C
36d0: 54 2e 6e 61 6d 65 2c 20 43 2e 63 69 64 2c 20 46 T.name, C.cid, F
36e0: 2e 6e 61 6d 65 2c 20 52 2e 72 65 76 0a 09 09 46 .name, R.rev...F
36f0: 52 4f 4d 20 63 68 61 6e 67 65 73 65 74 20 43 2c ROM changeset C,
3700: 20 63 73 74 79 70 65 20 43 54 2c 20 72 65 76 69 cstype CT, revi
3710: 73 69 6f 6e 20 52 2c 20 66 69 6c 65 20 46 2c 20 sion R, file F,
3720: 63 73 69 74 65 6d 20 43 49 0a 09 09 57 48 45 52 csitem CI...WHER
3730: 45 20 43 2e 74 79 70 65 20 3d 20 30 20 20 20 20 E C.type = 0
3740: 20 20 20 2d 2d 20 72 65 76 69 73 69 6f 6e 20 63 -- revision c
3750: 68 61 6e 67 65 73 65 74 73 20 6f 6e 6c 79 0a 09 hangesets only..
3760: 09 41 4e 44 20 20 20 43 2e 63 69 64 20 20 3d 20 .AND C.cid =
3770: 43 49 2e 63 69 64 20 20 2d 2d 20 63 68 61 6e 67 CI.cid -- chang
3780: 65 73 65 74 20 2d 2d 3e 20 69 74 73 20 72 65 76 eset --> its rev
3790: 69 73 69 6f 6e 73 0a 09 09 41 4e 44 20 20 20 52 isions...AND R
37a0: 2e 72 69 64 20 20 3d 20 43 49 2e 69 69 64 20 20 .rid = CI.iid
37b0: 2d 2d 20 6c 6f 6f 6b 20 61 74 20 74 68 65 6d 0a -- look at them.
37c0: 09 09 41 4e 44 20 20 20 52 2e 6d 69 64 20 21 3d ..AND R.mid !=
37d0: 20 43 2e 73 72 63 20 20 20 2d 2d 20 4f 6e 6c 79 C.src -- Only
37e0: 20 74 68 6f 73 65 20 77 68 69 63 68 20 64 69 73 those which dis
37f0: 61 67 72 65 65 20 77 69 74 68 20 63 68 61 6e 67 agree with chang
3800: 65 73 65 74 20 61 62 6f 75 74 20 74 68 65 20 6d eset about the m
3810: 65 74 61 0a 09 09 41 4e 44 20 20 20 52 2e 66 69 eta...AND R.fi
3820: 64 20 3d 20 46 2e 66 69 64 20 20 20 20 2d 2d 20 d = F.fid --
3830: 67 65 74 20 66 69 6c 65 20 6f 66 20 74 68 65 20 get file of the
3840: 72 65 76 69 73 69 6f 6e 0a 09 09 41 4e 44 20 20 revision...AND
3850: 20 43 54 2e 74 69 64 20 3d 20 43 2e 74 79 70 65 CT.tid = C.type
3860: 20 20 2d 2d 20 67 65 74 20 63 68 61 6e 67 65 73 -- get changes
3870: 65 74 20 74 79 70 65 2c 20 66 6f 72 20 6c 61 62 et type, for lab
3880: 65 6c 69 6e 67 0a 09 20 20 20 20 7d 0a 09 23 20 eling.. }..#
3890: 41 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 68 61 All revisions ha
38a0: 76 65 20 74 6f 20 61 67 72 65 65 20 6f 6e 20 74 ve to agree on t
38b0: 68 65 20 4c 4f 44 20 74 68 65 69 72 20 63 68 61 he LOD their cha
38c0: 6e 67 65 73 65 74 0a 09 23 20 62 65 6c 6f 6e 67 ngeset..# belong
38d0: 73 20 74 6f 2e 20 49 6e 20 6f 74 68 65 72 20 77 s to. In other w
38e0: 6f 72 64 73 2c 20 61 6c 6c 20 72 65 76 69 73 69 ords, all revisi
38f0: 6f 6e 73 20 69 6e 20 61 20 63 68 61 6e 67 65 73 ons in a changes
3900: 65 74 0a 09 23 20 68 61 76 65 20 74 6f 20 72 65 et..# have to re
3910: 66 65 72 20 74 6f 20 74 68 65 20 73 61 6d 65 20 fer to the same
3920: 6c 69 6e 65 20 6f 66 20 64 65 76 65 6c 6f 70 6d line of developm
3930: 65 6e 74 2e 0a 09 23 0a 09 23 20 49 6e 73 74 65 ent...#..# Inste
3940: 61 64 20 6f 66 20 6c 6f 6f 6b 69 6e 67 20 61 74 ad of looking at
3950: 20 61 6c 6c 20 70 61 69 72 73 20 6f 66 20 72 65 all pairs of re
3960: 76 69 73 69 6f 6e 73 20 69 6e 20 61 6c 6c 0a 09 visions in all..
3970: 23 20 63 68 61 6e 67 65 73 65 74 73 20 77 65 20 # changesets we
3980: 67 65 6e 65 72 61 74 65 20 74 68 65 20 64 69 73 generate the dis
3990: 74 69 6e 63 74 20 73 65 74 20 6f 66 20 61 6c 6c tinct set of all
39a0: 20 4c 4f 44 73 0a 09 23 20 72 65 66 65 72 65 6e LODs..# referen
39b0: 63 65 64 20 62 79 20 74 68 65 20 72 65 76 69 73 ced by the revis
39c0: 69 6f 6e 73 20 6f 66 20 61 20 63 68 61 6e 67 65 ions of a change
39d0: 73 65 74 2c 20 6c 6f 6f 6b 20 66 6f 72 20 74 68 set, look for th
39e0: 6f 73 65 0a 09 23 20 77 69 74 68 20 63 61 72 64 ose..# with card
39f0: 69 6e 61 6c 69 74 79 20 3e 20 31 2c 20 61 6e 64 inality > 1, and
3a00: 20 67 65 74 20 74 68 65 20 69 64 65 6e 74 69 66 get the identif
3a10: 79 69 6e 67 20 69 6e 66 6f 72 6d 61 74 69 6f 6e ying information
3a20: 0a 09 23 20 66 6f 72 20 74 68 65 20 63 68 61 6e ..# for the chan
3a30: 67 65 73 65 74 73 20 66 6f 75 6e 64 20 74 68 75 gesets found thu
3a40: 73 6c 79 2e 0a 09 43 68 65 63 6b 43 53 20 5c 0a sly...CheckCS \.
3a50: 09 20 20 20 20 7b 41 6c 6c 20 72 65 76 69 73 69 . {All revisi
3a60: 6f 6e 73 20 69 6e 20 61 20 63 68 61 6e 67 65 73 ons in a changes
3a70: 65 74 20 68 61 76 65 20 74 6f 20 62 65 6c 6f 6e et have to belon
3a80: 67 20 74 6f 20 74 68 65 20 73 61 6d 65 20 4c 4f g to the same LO
3a90: 44 7d 20 5c 0a 09 20 20 20 20 7b 3a 20 49 74 73 D} \.. {: Its
3aa0: 20 72 65 76 69 73 69 6f 6e 73 20 64 69 73 61 67 revisions disag
3ab0: 72 65 65 20 61 62 6f 75 74 20 74 68 65 20 4c 4f ree about the LO
3ac0: 44 20 74 68 65 79 20 62 65 6c 6f 6e 67 20 74 6f D they belong to
3ad0: 7d 20 7b 0a 09 09 53 45 4c 45 43 54 20 54 2e 6e } {...SELECT T.n
3ae0: 61 6d 65 2c 20 43 2e 63 69 64 0a 09 09 46 52 4f ame, C.cid...FRO
3af0: 4d 20 20 20 63 68 61 6e 67 65 73 65 74 20 43 2c M changeset C,
3b00: 20 63 73 74 79 70 65 20 54 0a 09 09 57 48 45 52 cstype T...WHER
3b10: 45 20 20 43 2e 63 69 64 20 49 4e 20 28 53 45 4c E C.cid IN (SEL
3b20: 45 43 54 20 55 2e 63 69 64 0a 09 09 09 09 20 46 ECT U.cid..... F
3b30: 52 4f 4d 20 28 53 45 4c 45 43 54 20 44 49 53 54 ROM (SELECT DIST
3b40: 49 4e 43 54 20 20 20 20 20 20 20 2d 2d 20 75 6e INCT -- un
3b50: 69 71 75 65 20 63 73 65 74 2f 6c 6f 64 20 70 61 ique cset/lod pa
3b60: 69 72 73 0a 09 09 09 09 20 20 20 20 20 20 20 20 irs.....
3b70: 20 20 20 20 20 20 43 49 2e 63 69 64 20 41 53 20 CI.cid AS
3b80: 63 69 64 2c 20 2d 2d 20 72 65 76 69 73 69 6f 6e cid, -- revision
3b90: 20 63 73 65 74 0a 09 09 09 09 20 20 20 20 20 20 cset.....
3ba0: 20 20 20 20 20 20 20 20 52 2e 6c 6f 64 20 20 41 R.lod A
3bb0: 53 20 6c 6f 64 20 20 2d 2d 20 6c 6f 64 20 6f 66 S lod -- lod of
3bc0: 20 69 74 65 6d 20 69 6e 20 63 73 65 74 0a 09 09 item in cset...
3bd0: 09 09 20 20 20 20 20 20 20 46 52 4f 4d 20 20 20 .. FROM
3be0: 63 73 69 74 65 6d 20 43 49 2c 20 63 68 61 6e 67 csitem CI, chang
3bf0: 65 73 65 74 20 43 2c 20 72 65 76 69 73 69 6f 6e eset C, revision
3c00: 20 52 0a 09 09 09 09 20 20 20 20 20 20 20 57 48 R..... WH
3c10: 45 52 45 20 20 43 49 2e 69 69 64 20 3d 20 52 2e ERE CI.iid = R.
3c20: 72 69 64 20 20 2d 2d 20 67 65 74 20 72 65 76 20 rid -- get rev
3c30: 6f 66 20 69 74 65 6d 20 69 6e 20 63 73 65 74 0a of item in cset.
3c40: 09 09 09 09 20 20 20 20 20 20 20 41 4e 44 20 20 .... AND
3c50: 20 20 43 2e 63 69 64 20 20 3d 20 43 49 2e 63 69 C.cid = CI.ci
3c60: 64 20 2d 2d 20 67 65 74 20 63 68 61 6e 67 65 73 d -- get changes
3c70: 65 74 20 6f 66 20 69 74 65 6d 0a 09 09 09 09 20 et of item.....
3c80: 20 20 20 20 20 20 41 4e 44 20 20 20 20 43 2e 74 AND C.t
3c90: 79 70 65 20 3d 20 30 20 20 20 20 20 20 2d 2d 20 ype = 0 --
3ca0: 6c 69 6d 69 74 20 74 6f 20 72 65 76 20 63 73 65 limit to rev cse
3cb0: 74 73 0a 09 09 09 09 20 20 20 20 20 20 29 20 41 ts..... ) A
3cc0: 53 20 55 0a 09 09 09 09 20 47 52 4f 55 50 20 42 S U..... GROUP B
3cd0: 59 20 55 2e 63 69 64 20 20 20 20 20 20 20 20 20 Y U.cid
3ce0: 20 2d 2d 20 61 67 67 72 65 67 61 74 65 20 62 79 -- aggregate by
3cf0: 20 63 73 65 74 2c 20 63 6f 75 6e 74 20 6c 6f 64 cset, count lod
3d00: 73 2f 63 73 65 74 0a 09 09 09 09 20 48 41 56 49 s/cset..... HAVI
3d10: 4e 47 20 43 4f 55 4e 54 28 55 2e 6c 6f 64 29 20 NG COUNT(U.lod)
3d20: 3e 20 31 20 2d 2d 20 66 69 6e 64 20 63 73 65 74 > 1 -- find cset
3d30: 73 20 77 69 74 68 20 6d 75 6c 74 69 70 6c 65 20 s with multiple
3d40: 6c 6f 64 73 0a 09 09 09 09 29 0a 09 09 41 4e 44 lods.....)...AND
3d50: 20 20 20 20 54 2e 74 69 64 20 3d 20 43 2e 74 79 T.tid = C.ty
3d60: 70 65 0a 09 20 20 20 20 7d 0a 09 23 20 41 6c 6c pe.. }..# All
3d70: 20 72 65 76 69 73 69 6f 6e 73 20 68 61 76 65 20 revisions have
3d80: 74 6f 20 61 67 72 65 65 20 6f 6e 20 74 68 65 20 to agree on the
3d90: 70 72 6f 6a 65 63 74 20 74 68 65 69 72 20 63 68 project their ch
3da0: 61 6e 67 65 73 65 74 0a 09 23 20 62 65 6c 6f 6e angeset..# belon
3db0: 67 73 20 74 6f 2e 20 49 6e 20 6f 74 68 65 72 20 gs to. In other
3dc0: 77 6f 72 64 73 2c 20 61 6c 6c 20 72 65 76 69 73 words, all revis
3dd0: 69 6f 6e 73 20 69 6e 20 61 20 63 68 61 6e 67 65 ions in a change
3de0: 73 65 74 0a 09 23 20 68 61 76 65 20 74 6f 20 72 set..# have to r
3df0: 65 66 65 72 20 74 6f 20 74 68 65 20 73 61 6d 65 efer to the same
3e00: 20 70 72 6f 6a 65 63 74 2e 0a 09 23 0a 09 23 20 project...#..#
3e10: 49 6e 73 74 65 61 64 20 6f 66 20 6c 6f 6f 6b 69 Instead of looki
3e20: 6e 67 20 61 74 20 61 6c 6c 20 70 61 69 72 73 20 ng at all pairs
3e30: 6f 66 20 72 65 76 69 73 69 6f 6e 73 20 69 6e 20 of revisions in
3e40: 61 6c 6c 0a 09 23 20 63 68 61 6e 67 65 73 65 74 all..# changeset
3e50: 73 20 77 65 20 67 65 6e 65 72 61 74 65 20 74 68 s we generate th
3e60: 65 20 64 69 73 74 69 6e 63 74 20 73 65 74 20 6f e distinct set o
3e70: 66 20 61 6c 6c 20 70 72 6f 6a 65 63 74 73 0a 09 f all projects..
3e80: 23 20 72 65 66 65 72 65 6e 63 65 64 20 62 79 20 # referenced by
3e90: 74 68 65 20 72 65 76 69 73 69 6f 6e 73 20 6f 66 the revisions of
3ea0: 20 61 20 63 68 61 6e 67 65 73 65 74 2c 20 6c 6f a changeset, lo
3eb0: 6f 6b 20 66 6f 72 20 74 68 6f 73 65 0a 09 23 20 ok for those..#
3ec0: 77 69 74 68 20 63 61 72 64 69 6e 61 6c 69 74 79 with cardinality
3ed0: 20 3e 20 31 2c 20 61 6e 64 20 67 65 74 20 74 68 > 1, and get th
3ee0: 65 20 69 64 65 6e 74 69 66 79 69 6e 67 20 69 6e e identifying in
3ef0: 66 6f 72 6d 61 74 69 6f 6e 0a 09 23 20 66 6f 72 formation..# for
3f00: 20 74 68 65 20 63 68 61 6e 67 65 73 65 74 73 20 the changesets
3f10: 66 6f 75 6e 64 20 74 68 75 73 6c 79 2e 0a 09 43 found thusly...C
3f20: 68 65 63 6b 43 53 20 5c 0a 09 20 20 20 20 7b 41 heckCS \.. {A
3f30: 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 69 6e 20 ll revisions in
3f40: 61 20 63 68 61 6e 67 65 73 65 74 20 68 61 76 65 a changeset have
3f50: 20 74 6f 20 62 65 6c 6f 6e 67 20 74 6f 20 74 68 to belong to th
3f60: 65 20 73 61 6d 65 20 70 72 6f 6a 65 63 74 7d 20 e same project}
3f70: 5c 0a 09 20 20 20 20 7b 3a 20 49 74 73 20 72 65 \.. {: Its re
3f80: 76 69 73 69 6f 6e 73 20 64 69 73 61 67 72 65 65 visions disagree
3f90: 20 61 62 6f 75 74 20 74 68 65 20 70 72 6f 6a 65 about the proje
3fa0: 63 74 20 74 68 65 79 20 62 65 6c 6f 6e 67 20 74 ct they belong t
3fb0: 6f 7d 20 7b 0a 09 09 53 45 4c 45 43 54 20 54 2e o} {...SELECT T.
3fc0: 6e 61 6d 65 2c 20 43 2e 63 69 64 0a 09 09 46 52 name, C.cid...FR
3fd0: 4f 4d 20 20 20 63 68 61 6e 67 65 73 65 74 20 43 OM changeset C
3fe0: 2c 20 63 73 74 79 70 65 20 54 0a 09 09 57 48 45 , cstype T...WHE
3ff0: 52 45 20 20 43 2e 63 69 64 20 49 4e 20 28 53 45 RE C.cid IN (SE
4000: 4c 45 43 54 20 55 2e 63 69 64 0a 09 09 09 09 20 LECT U.cid.....
4010: 46 52 4f 4d 20 28 53 45 4c 45 43 54 20 44 49 53 FROM (SELECT DIS
4020: 54 49 4e 43 54 20 20 20 20 20 20 20 2d 2d 20 75 TINCT -- u
4030: 6e 69 71 75 65 20 63 73 65 74 2f 70 72 6f 6a 20 nique cset/proj
4040: 70 61 69 72 73 0a 09 09 09 09 20 20 20 20 20 20 pairs.....
4050: 20 20 20 20 20 20 20 20 43 49 2e 63 69 64 20 41 CI.cid A
4060: 53 20 63 69 64 2c 20 2d 2d 20 72 65 76 20 63 73 S cid, -- rev cs
4070: 65 74 0a 09 09 09 09 20 20 20 20 20 20 20 20 20 et.....
4080: 20 20 20 20 20 46 2e 70 69 64 20 20 41 53 20 70 F.pid AS p
4090: 69 64 20 20 2d 2d 20 70 72 6f 6a 65 63 74 20 6f id -- project o
40a0: 66 20 69 74 65 6d 20 69 6e 20 63 73 65 74 0a 09 f item in cset..
40b0: 09 09 09 20 20 20 20 20 20 20 46 52 4f 4d 20 20 ... FROM
40c0: 20 63 73 69 74 65 6d 20 43 49 2c 20 63 68 61 6e csitem CI, chan
40d0: 67 65 73 65 74 20 43 2c 20 72 65 76 69 73 69 6f geset C, revisio
40e0: 6e 20 52 2c 20 66 69 6c 65 20 46 0a 09 09 09 09 n R, file F.....
40f0: 20 20 20 20 20 20 20 57 48 45 52 45 20 20 43 49 WHERE CI
4100: 2e 69 69 64 20 3d 20 52 2e 72 69 64 20 20 2d 2d .iid = R.rid --
4110: 20 67 65 74 20 72 65 76 20 6f 66 20 69 74 65 6d get rev of item
4120: 20 69 6e 20 63 73 65 74 0a 09 09 09 09 20 20 20 in cset.....
4130: 20 20 20 20 41 4e 44 20 20 20 20 43 2e 63 69 64 AND C.cid
4140: 20 20 3d 20 43 49 2e 63 69 64 20 2d 2d 20 67 65 = CI.cid -- ge
4150: 74 20 63 68 61 6e 67 65 73 65 74 20 6f 66 20 69 t changeset of i
4160: 74 65 6d 0a 09 09 09 09 20 20 20 20 20 20 20 41 tem..... A
4170: 4e 44 20 20 20 20 43 2e 74 79 70 65 20 3d 20 30 ND C.type = 0
4180: 20 20 20 20 20 20 2d 2d 20 6c 69 6d 69 74 20 74 -- limit t
4190: 6f 20 72 65 76 20 63 68 61 6e 67 65 73 65 74 73 o rev changesets
41a0: 0a 09 09 09 09 20 20 20 20 20 20 20 41 4e 44 20 ..... AND
41b0: 20 20 20 46 2e 66 69 64 20 20 3d 20 52 2e 66 69 F.fid = R.fi
41c0: 64 20 20 2d 2d 20 67 65 74 20 66 69 6c 65 20 6f d -- get file o
41d0: 66 20 72 65 76 69 73 69 6f 6e 0a 09 09 09 09 20 f revision.....
41e0: 20 20 20 20 20 29 20 41 53 20 55 0a 09 09 09 09 ) AS U.....
41f0: 20 47 52 4f 55 50 20 42 59 20 55 2e 63 69 64 20 GROUP BY U.cid
4200: 20 20 20 20 20 20 20 20 20 2d 2d 20 61 67 67 72 -- aggr
4210: 65 67 61 74 65 20 62 79 20 63 73 65 74 73 2c 20 egate by csets,
4220: 63 6f 75 6e 74 20 70 72 6f 6a 2f 63 73 65 74 0a count proj/cset.
4230: 09 09 09 09 20 48 41 56 49 4e 47 20 43 4f 55 4e .... HAVING COUN
4240: 54 28 55 2e 70 69 64 29 20 3e 20 31 20 2d 2d 20 T(U.pid) > 1 --
4250: 66 69 6e 64 20 63 73 65 74 73 20 77 69 74 68 20 find csets with
4260: 6d 75 6c 74 69 70 6c 65 20 70 72 6f 6a 65 63 74 multiple project
4270: 73 0a 09 09 09 09 29 0a 09 09 41 4e 44 20 20 20 s.....)...AND
4280: 20 54 2e 74 69 64 20 3d 20 43 2e 74 79 70 65 20 T.tid = C.type
4290: 2d 2d 20 67 65 74 20 72 65 61 64 61 62 6c 65 20 -- get readable
42a0: 63 68 61 6e 67 65 73 65 74 20 74 79 70 65 0a 09 changeset type..
42b0: 20 20 20 20 7d 0a 09 23 20 41 6c 6c 20 72 65 76 }..# All rev
42c0: 69 73 69 6f 6e 73 20 69 6e 20 61 20 73 69 6e 67 isions in a sing
42d0: 6c 65 20 63 68 61 6e 67 65 73 65 74 20 68 61 76 le changeset hav
42e0: 65 20 74 6f 20 62 65 6c 6f 6e 67 20 74 6f 0a 09 e to belong to..
42f0: 23 20 64 69 66 66 65 72 65 6e 74 20 66 69 6c 65 # different file
4300: 73 2e 20 43 6f 6e 76 65 72 73 65 6c 79 3a 20 4e s. Conversely: N
4310: 6f 20 74 77 6f 20 72 65 76 69 73 69 6f 6e 73 20 o two revisions
4320: 6f 66 20 61 20 73 69 6e 67 6c 65 0a 09 23 20 66 of a single..# f
4330: 69 6c 65 20 61 72 65 20 61 6c 6c 6f 77 65 64 20 ile are allowed
4340: 74 6f 20 62 65 20 69 6e 20 74 68 65 20 73 61 6d to be in the sam
4350: 65 20 63 68 61 6e 67 65 73 65 74 2e 0a 09 23 0a e changeset...#.
4360: 09 23 20 49 6e 73 74 65 61 64 20 6f 66 20 6c 6f .# Instead of lo
4370: 6f 6b 69 6e 67 20 61 74 20 61 6c 6c 20 70 61 69 oking at all pai
4380: 72 73 20 6f 66 20 72 65 76 69 73 69 6f 6e 73 20 rs of revisions
4390: 69 6e 20 61 6c 6c 0a 09 23 20 63 68 61 6e 67 65 in all..# change
43a0: 73 65 74 73 20 77 65 20 67 65 6e 65 72 61 74 65 sets we generate
43b0: 20 74 68 65 20 64 69 73 74 69 6e 63 74 20 73 65 the distinct se
43c0: 74 20 6f 66 20 61 6c 6c 20 66 69 6c 65 73 0a 09 t of all files..
43d0: 23 20 72 65 66 65 72 65 6e 63 65 64 20 62 79 20 # referenced by
43e0: 74 68 65 20 72 65 76 69 73 69 6f 6e 73 20 6f 66 the revisions of
43f0: 20 61 20 63 68 61 6e 67 65 73 65 74 2c 20 61 6e a changeset, an
4400: 64 20 6c 6f 6f 6b 20 66 6f 72 0a 09 23 20 74 68 d look for..# th
4410: 6f 73 65 20 77 69 74 68 20 63 61 72 64 69 6e 61 ose with cardina
4420: 6c 69 74 79 20 3c 20 74 68 65 20 63 61 72 64 69 lity < the cardi
4430: 6e 61 6c 69 74 79 20 6f 66 20 74 68 65 20 73 65 nality of the se
4440: 74 20 6f 66 0a 09 23 20 72 65 76 69 73 69 6f 6e t of..# revision
4450: 73 2c 20 61 6e 64 20 67 65 74 20 74 68 65 20 69 s, and get the i
4460: 64 65 6e 74 69 66 79 69 6e 67 20 69 6e 66 6f 72 dentifying infor
4470: 6d 61 74 69 6f 6e 20 66 6f 72 20 74 68 65 0a 09 mation for the..
4480: 23 20 63 68 61 6e 67 65 73 65 74 73 20 66 6f 75 # changesets fou
4490: 6e 64 20 74 68 75 73 6c 79 2e 0a 09 43 68 65 63 nd thusly...Chec
44a0: 6b 43 53 20 5c 0a 09 20 20 20 20 7b 41 6c 6c 20 kCS \.. {All
44b0: 72 65 76 69 73 69 6f 6e 73 20 69 6e 20 61 20 63 revisions in a c
44c0: 68 61 6e 67 65 73 65 74 20 68 61 76 65 20 74 6f hangeset have to
44d0: 20 62 65 6c 6f 6e 67 20 74 6f 20 64 69 66 66 65 belong to diffe
44e0: 72 65 6e 74 20 66 69 6c 65 73 7d 20 5c 0a 09 20 rent files} \..
44f0: 20 20 20 7b 3a 20 49 74 73 20 72 65 76 69 73 69 {: Its revisi
4500: 6f 6e 73 20 73 68 61 72 65 20 66 69 6c 65 73 7d ons share files}
4510: 20 7b 0a 09 09 53 45 4c 45 43 54 20 54 2e 6e 61 {...SELECT T.na
4520: 6d 65 2c 20 43 2e 63 69 64 0a 09 09 46 52 4f 4d me, C.cid...FROM
4530: 20 20 20 63 68 61 6e 67 65 73 65 74 20 43 2c 20 changeset C,
4540: 63 73 74 79 70 65 20 54 0a 09 09 57 48 45 52 45 cstype T...WHERE
4550: 20 20 43 2e 63 69 64 20 49 4e 20 28 53 45 4c 45 C.cid IN (SELE
4560: 43 54 20 56 56 2e 63 69 64 0a 09 09 09 09 20 46 CT VV.cid..... F
4570: 52 4f 4d 20 28 53 45 4c 45 43 54 20 55 2e 63 69 ROM (SELECT U.ci
4580: 64 20 20 20 20 20 20 20 20 20 41 53 20 63 69 64 d AS cid
4590: 2c 20 20 20 2d 2d 20 72 65 76 20 63 68 61 6e 67 , -- rev chang
45a0: 65 73 65 74 0a 09 09 09 09 20 20 20 20 20 20 20 eset.....
45b0: 20 20 20 20 20 20 20 43 4f 55 4e 54 20 28 55 2e COUNT (U.
45c0: 66 69 64 29 20 41 53 20 66 63 6f 75 6e 74 20 2d fid) AS fcount -
45d0: 2d 20 6e 75 6d 62 65 72 20 6f 66 20 66 69 6c 65 - number of file
45e0: 73 20 62 79 20 69 74 65 6d 73 0a 09 09 09 09 20 s by items.....
45f0: 20 20 20 20 20 20 46 52 4f 4d 20 28 53 45 4c 45 FROM (SELE
4600: 43 54 20 44 49 53 54 49 4e 43 54 20 20 20 20 20 CT DISTINCT
4610: 20 20 2d 2d 20 75 6e 69 71 75 65 20 63 73 65 74 -- unique cset
4620: 2f 66 69 6c 65 20 70 61 69 72 73 0a 09 09 09 09 /file pairs.....
4630: 09 20 20 20 20 20 20 20 20 20 20 20 20 43 49 2e . CI.
4640: 63 69 64 20 41 53 20 63 69 64 2c 20 2d 2d 20 72 cid AS cid, -- r
4650: 65 76 20 63 68 61 6e 67 65 73 65 74 0a 09 09 09 ev changeset....
4660: 09 09 20 20 20 20 20 20 20 20 20 20 20 20 52 2e .. R.
4670: 66 69 64 20 41 53 20 66 69 64 20 20 20 2d 2d 20 fid AS fid --
4680: 66 69 6c 65 20 6f 66 20 69 74 65 6d 20 69 6e 20 file of item in
4690: 63 68 61 6e 67 65 73 65 74 0a 09 09 09 09 09 20 changeset......
46a0: 20 20 20 20 46 52 4f 4d 20 20 20 63 73 69 74 65 FROM csite
46b0: 6d 20 43 49 2c 20 63 68 61 6e 67 65 73 65 74 20 m CI, changeset
46c0: 43 2c 20 72 65 76 69 73 69 6f 6e 20 52 0a 09 09 C, revision R...
46d0: 09 09 09 20 20 20 20 20 57 48 45 52 45 20 20 43 ... WHERE C
46e0: 49 2e 69 69 64 20 3d 20 52 2e 72 69 64 20 20 2d I.iid = R.rid -
46f0: 2d 20 67 65 74 20 72 65 76 20 6f 66 20 69 74 65 - get rev of ite
4700: 6d 20 69 6e 20 63 68 61 6e 67 65 73 65 74 0a 09 m in changeset..
4710: 09 09 09 09 20 20 20 20 20 41 4e 44 20 20 20 20 .... AND
4720: 43 2e 63 69 64 20 20 3d 20 43 49 2e 63 69 64 20 C.cid = CI.cid
4730: 2d 2d 20 67 65 74 20 63 68 61 6e 67 65 73 65 74 -- get changeset
4740: 20 6f 66 20 69 74 65 6d 0a 09 09 09 09 09 20 20 of item......
4750: 20 20 20 41 4e 44 20 20 20 20 43 2e 74 79 70 65 AND C.type
4760: 20 3d 20 30 20 20 20 20 20 20 2d 2d 20 6c 69 6d = 0 -- lim
4770: 69 74 20 74 6f 20 72 65 76 20 63 73 65 74 73 0a it to rev csets.
4780: 09 09 09 09 09 20 20 20 20 20 29 20 41 53 20 55 ..... ) AS U
4790: 0a 09 09 09 09 20 20 20 20 20 20 20 47 52 4f 55 ..... GROU
47a0: 50 20 42 59 20 55 2e 63 69 64 20 2d 2d 20 61 67 P BY U.cid -- ag
47b0: 67 72 65 67 61 74 65 20 62 79 20 63 73 65 74 73 gregate by csets
47c0: 2c 20 63 6f 75 6e 74 20 66 69 6c 65 73 2f 63 73 , count files/cs
47d0: 65 74 0a 09 09 09 09 20 20 20 20 20 20 29 20 41 et..... ) A
47e0: 53 20 55 55 2c 0a 09 09 09 09 20 20 20 20 20 20 S UU,.....
47f0: 28 53 45 4c 45 43 54 20 56 2e 63 69 64 20 20 20 (SELECT V.cid
4800: 20 20 20 20 20 20 41 53 20 63 69 64 2c 20 20 20 AS cid,
4810: 2d 2d 20 72 65 76 20 63 68 61 6e 67 65 73 65 74 -- rev changeset
4820: 0a 09 09 09 09 20 20 20 20 20 20 20 20 20 20 20 .....
4830: 20 20 20 43 4f 55 4e 54 20 28 56 2e 69 69 64 29 COUNT (V.iid)
4840: 20 41 53 20 72 63 6f 75 6e 74 20 2d 2d 20 6e 75 AS rcount -- nu
4850: 6d 62 65 72 20 6f 66 20 69 74 65 6d 73 0a 09 09 mber of items...
4860: 09 09 20 20 20 20 20 20 20 46 52 4f 4d 20 20 20 .. FROM
4870: 63 73 69 74 65 6d 20 56 2c 20 63 68 61 6e 67 65 csitem V, change
4880: 73 65 74 20 58 0a 09 09 09 09 20 20 20 20 20 20 set X.....
4890: 20 57 48 45 52 45 20 20 58 2e 63 69 64 20 20 3d WHERE X.cid =
48a0: 20 56 2e 63 69 64 20 20 2d 2d 20 67 65 74 20 63 V.cid -- get c
48b0: 68 61 6e 67 65 73 65 74 20 6f 66 20 69 74 65 6d hangeset of item
48c0: 0a 09 09 09 09 20 20 20 20 20 20 20 41 4e 44 20 ..... AND
48d0: 20 20 20 58 2e 74 79 70 65 20 3d 20 30 20 20 20 X.type = 0
48e0: 20 20 20 2d 2d 20 6c 69 6d 69 74 20 74 6f 20 72 -- limit to r
48f0: 65 76 20 63 73 65 74 73 0a 09 09 09 09 20 20 20 ev csets.....
4900: 20 20 20 20 47 52 4f 55 50 20 42 59 20 56 2e 63 GROUP BY V.c
4910: 69 64 20 20 20 20 20 20 20 20 20 2d 2d 20 61 67 id -- ag
4920: 67 72 65 67 61 74 65 20 62 79 20 63 73 65 74 73 gregate by csets
4930: 2c 20 63 6f 75 6e 74 20 69 74 65 6d 73 2f 63 73 , count items/cs
4940: 65 74 0a 09 09 09 09 20 20 20 20 20 20 29 20 41 et..... ) A
4950: 53 20 56 56 0a 09 09 09 09 20 57 48 45 52 45 20 S VV..... WHERE
4960: 56 56 2e 63 69 64 20 3d 20 55 55 2e 63 69 64 20 VV.cid = UU.cid
4970: 20 20 20 20 20 20 20 2d 2d 20 73 79 6e 63 20 23 -- sync #
4980: 69 74 65 6d 73 2f 63 73 65 74 20 77 69 74 68 20 items/cset with
4990: 23 66 69 6c 65 73 2f 63 73 65 74 0a 09 09 09 09 #files/cset.....
49a0: 20 41 4e 44 20 20 20 55 55 2e 66 63 6f 75 6e 74 AND UU.fcount
49b0: 20 3c 20 56 56 2e 72 63 6f 75 6e 74 20 20 2d 2d < VV.rcount --
49c0: 20 6c 65 73 73 20 66 69 6c 65 73 20 74 68 61 6e less files than
49d0: 20 69 74 65 6d 73 0a 09 09 09 09 20 20 20 20 20 items.....
49e0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
49f0: 20 20 20 20 20 20 20 20 20 2d 2d 20 3d 3e 20 69 -- => i
4a00: 74 65 6d 73 20 62 65 6c 6f 6e 67 20 74 6f 20 74 tems belong to t
4a10: 68 65 20 73 61 6d 65 20 66 69 6c 65 2e 0a 09 09 he same file....
4a20: 09 09 29 0a 09 09 41 4e 44 20 20 20 20 54 2e 74 ..)...AND T.t
4a30: 69 64 20 3d 20 43 2e 74 79 70 65 20 2d 2d 20 67 id = C.type -- g
4a40: 65 74 20 72 65 61 64 61 62 6c 65 20 63 68 61 6e et readable chan
4a50: 67 65 73 65 74 20 74 79 70 65 0a 09 20 20 20 20 geset type..
4a60: 7d 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a }..return. }.
4a70: 0a 20 20 20 20 70 72 6f 63 20 54 61 67 43 68 61 . proc TagCha
4a80: 6e 67 65 73 65 74 73 20 7b 7d 20 7b 0a 09 23 20 ngesets {} {..#
4a90: 54 68 69 73 20 63 6f 64 65 20 70 65 72 66 6f 72 This code perfor
4aa0: 6d 73 20 61 20 6e 75 6d 62 65 72 20 6f 66 20 70 ms a number of p
4ab0: 61 72 61 6e 6f 69 64 20 63 68 65 63 6b 73 20 6f aranoid checks o
4ac0: 66 20 74 68 65 0a 09 23 20 64 61 74 61 62 61 73 f the..# databas
4ad0: 65 2c 20 73 65 61 72 63 68 69 6e 67 20 66 6f 72 e, searching for
4ae0: 20 69 6e 63 6f 6e 73 69 73 74 65 6e 74 20 63 68 inconsistent ch
4af0: 61 6e 67 65 73 65 74 2f 72 65 76 69 73 69 6f 6e angeset/revision
4b00: 0a 09 23 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 2e ..# information.
4b10: 0a 0a 09 75 70 76 61 72 20 31 20 6e 20 6e 20 3b ...upvar 1 n n ;
4b20: 20 23 20 43 6f 75 6e 74 65 72 20 66 6f 72 20 74 # Counter for t
4b30: 68 65 20 63 68 65 63 6b 73 20 28 77 65 20 70 72 he checks (we pr
4b40: 69 6e 74 20 61 6e 20 69 64 20 62 65 66 6f 72 65 int an id before
4b50: 0a 09 09 20 20 20 20 20 20 23 20 74 68 65 20 6d ... # the m
4b60: 61 69 6e 20 6c 61 62 65 6c 29 2e 0a 0a 09 23 20 ain label)....#
4b70: 46 69 6e 64 20 61 6c 6c 20 74 61 67 73 20 77 68 Find all tags wh
4b80: 69 63 68 20 61 72 65 20 6e 6f 74 20 75 73 65 64 ich are not used
4b90: 20 62 79 20 61 74 20 6c 65 61 73 74 20 6f 6e 65 by at least one
4ba0: 20 63 68 61 6e 67 65 73 65 74 2e 0a 09 43 68 65 changeset...Che
4bb0: 63 6b 54 61 67 20 5c 0a 09 20 20 20 20 7b 41 6c ckTag \.. {Al
4bc0: 6c 20 74 61 67 73 20 68 61 76 65 20 74 6f 20 62 l tags have to b
4bd0: 65 20 75 73 65 64 20 62 79 20 6c 65 61 73 74 20 e used by least
4be0: 6f 6e 65 20 63 68 61 6e 67 65 73 65 74 7d 20 5c one changeset} \
4bf0: 0a 09 20 20 20 20 7b 69 73 20 6e 6f 74 20 75 73 .. {is not us
4c00: 65 64 20 62 79 20 61 20 63 68 61 6e 67 65 73 65 ed by a changese
4c10: 74 7d 20 7b 0a 09 09 2d 2d 20 55 6e 75 73 65 64 t} {...-- Unused
4c20: 20 74 61 67 73 20 3d 20 41 6c 6c 20 74 61 67 73 tags = All tags
4c30: 0a 09 09 2d 2d 20 20 20 20 20 20 20 20 20 20 20 ...--
4c40: 20 20 2d 20 72 65 76 69 73 69 6f 6e 73 20 75 73 - revisions us
4c50: 65 64 20 62 79 20 74 61 67 20 63 68 61 6e 67 65 ed by tag change
4c60: 73 65 74 73 2e 0a 09 09 2d 2d 0a 09 09 2d 2d 20 sets....--...--
4c70: 42 6f 74 68 20 73 65 74 73 20 63 61 6e 20 62 65 Both sets can be
4c80: 20 63 6f 6d 70 75 74 65 64 20 65 61 73 69 6c 79 computed easily
4c90: 2c 20 61 6e 64 20 73 75 62 74 72 61 63 74 65 64 , and subtracted
4ca0: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
4cb0: 20 2d 2d 20 66 72 6f 6d 20 65 61 63 68 20 6f 74 -- from each ot
4cc0: 68 65 72 2e 20 54 68 65 6e 20 77 65 20 63 61 6e her. Then we can
4cd0: 20 67 65 74 20 74 68 65 20 61 73 73 6f 63 69 61 get the associa
4ce0: 74 65 64 0a 20 20 20 20 20 20 20 20 20 20 20 20 ted.
4cf0: 20 20 20 20 2d 2d 20 66 69 6c 65 20 28 6e 61 6d -- file (nam
4d00: 65 29 20 66 6f 72 20 64 69 73 70 6c 61 79 2e 0a e) for display..
4d10: 0a 09 09 53 45 4c 45 43 54 20 50 2e 6e 61 6d 65 ...SELECT P.name
4d20: 2c 20 53 2e 6e 61 6d 65 0a 09 09 46 52 4f 4d 20 , S.name...FROM
4d30: 70 72 6f 6a 65 63 74 20 50 2c 20 74 61 67 20 54 project P, tag T
4d40: 2c 20 73 79 6d 62 6f 6c 20 53 0a 09 09 57 48 45 , symbol S...WHE
4d50: 52 45 20 54 2e 74 69 64 20 49 4e 20 28 53 45 4c RE T.tid IN (SEL
4d60: 45 43 54 20 74 69 64 20 20 20 20 20 20 20 20 20 ECT tid
4d70: 20 20 20 20 20 20 20 20 20 20 20 2d 2d 20 41 6c -- Al
4d80: 6c 20 74 61 67 73 0a 09 09 09 09 46 52 4f 4d 20 l tags.....FROM
4d90: 20 20 74 61 67 0a 09 09 09 09 45 58 43 45 50 54 tag.....EXCEPT
4da0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
4db0: 20 20 20 20 20 20 20 20 2d 2d 20 73 75 62 74 72 -- subtr
4dc0: 61 63 74 0a 09 09 09 09 53 45 4c 45 43 54 20 43 act.....SELECT C
4dd0: 49 2e 69 69 64 20 20 20 20 20 20 20 20 20 20 20 I.iid
4de0: 20 20 20 20 20 20 2d 2d 20 74 61 67 73 20 75 73 -- tags us
4df0: 65 64 0a 09 09 09 09 46 52 4f 4d 20 20 20 63 73 ed.....FROM cs
4e00: 69 74 65 6d 20 43 49 2c 20 63 68 61 6e 67 65 73 item CI, changes
4e10: 65 74 20 43 0a 09 09 09 09 57 48 45 52 45 20 20 et C.....WHERE
4e20: 43 2e 63 69 64 20 3d 20 43 49 2e 63 69 64 20 20 C.cid = CI.cid
4e30: 20 20 20 20 20 20 20 2d 2d 20 62 79 20 61 6e 79 -- by any
4e40: 20 74 61 67 0a 09 09 09 09 41 4e 44 20 20 20 20 tag.....AND
4e50: 43 2e 74 79 70 65 20 3d 20 31 29 20 20 20 20 20 C.type = 1)
4e60: 20 20 20 20 20 20 20 2d 2d 20 63 68 61 6e 67 65 -- change
4e70: 73 65 74 0a 09 09 41 4e 44 20 20 20 53 2e 73 69 set...AND S.si
4e80: 64 20 3d 20 54 2e 73 69 64 20 20 20 20 20 20 20 d = T.sid
4e90: 20 20 20 20 20 20 20 20 2d 2d 20 67 65 74 20 73 -- get s
4ea0: 79 6d 62 6f 6c 20 6f 66 20 74 61 67 0a 09 09 41 ymbol of tag...A
4eb0: 4e 44 20 20 20 50 2e 70 69 64 20 3d 20 53 2e 70 ND P.pid = S.p
4ec0: 69 64 20 20 20 20 20 20 20 20 20 20 20 20 20 20 id
4ed0: 20 2d 2d 20 67 65 74 20 70 72 6f 6a 65 63 74 20 -- get project
4ee0: 6f 66 20 73 79 6d 62 6f 6c 0a 09 20 20 20 20 7d of symbol.. }
4ef0: 0a 09 23 20 46 69 6e 64 20 61 6c 6c 20 74 61 67 ..# Find all tag
4f00: 73 20 77 68 69 63 68 20 61 72 65 20 75 73 65 64 s which are used
4f10: 20 62 79 20 6d 6f 72 65 20 74 68 61 6e 20 6f 6e by more than on
4f20: 65 20 63 68 61 6e 67 65 73 65 74 2e 0a 09 43 68 e changeset...Ch
4f30: 65 63 6b 52 65 76 20 5c 0a 09 20 20 20 20 7b 41 eckRev \.. {A
4f40: 6c 6c 20 74 61 67 73 20 68 61 76 65 20 74 6f 20 ll tags have to
4f50: 62 65 20 75 73 65 64 20 62 79 20 61 74 20 6d 6f be used by at mo
4f60: 73 74 20 6f 6e 65 20 63 68 61 6e 67 65 73 65 74 st one changeset
4f70: 7d 20 5c 0a 09 20 20 20 20 7b 69 73 20 75 73 65 } \.. {is use
4f80: 64 20 62 79 20 6d 75 6c 74 69 70 6c 65 20 63 68 d by multiple ch
4f90: 61 6e 67 65 73 65 74 73 7d 20 7b 0a 09 09 2d 2d angesets} {...--
4fa0: 20 50 72 69 6e 63 69 70 6c 65 20 6f 66 20 6f 70 Principle of op
4fb0: 65 72 61 74 69 6f 6e 3a 20 47 65 74 20 61 6c 6c eration: Get all
4fc0: 20 74 61 67 2f 63 68 61 6e 67 65 73 65 74 20 70 tag/changeset p
4fd0: 61 69 72 73 0a 20 20 20 20 20 20 20 20 20 20 20 airs.
4fe0: 20 20 20 20 20 2d 2d 20 66 6f 72 20 61 6c 6c 20 -- for all
4ff0: 74 61 67 20 63 68 61 6e 67 65 73 65 74 73 2c 20 tag changesets,
5000: 67 72 6f 75 70 20 62 79 20 74 61 67 20 74 6f 20 group by tag to
5010: 61 67 67 72 65 67 61 74 65 0a 20 20 20 20 20 20 aggregate.
5020: 20 20 20 20 20 20 20 20 20 20 2d 2d 20 74 68 65 -- the
5030: 20 63 68 61 6e 67 65 73 65 74 2c 20 63 6f 75 6e changeset, coun
5040: 74 69 6e 67 20 74 68 65 6d 2e 20 46 72 6f 6d 20 ting them. From
5050: 74 68 65 20 72 65 73 75 6c 74 69 6e 67 0a 20 20 the resulting.
5060: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2d 2d --
5070: 20 74 61 67 2f 63 6f 75 6e 74 20 74 61 62 6c 65 tag/count table
5080: 20 73 65 6c 65 63 74 20 74 68 6f 73 65 20 77 69 select those wi
5090: 74 68 20 6d 6f 72 65 20 74 68 61 6e 20 6f 6e 65 th more than one
50a0: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
50b0: 20 2d 2d 20 75 73 65 72 2c 20 61 6e 64 20 67 65 -- user, and ge
50c0: 74 20 74 68 65 69 72 20 61 73 73 6f 63 69 61 74 t their associat
50d0: 65 64 20 66 69 6c 65 20 28 6e 61 6d 65 29 20 66 ed file (name) f
50e0: 6f 72 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 or.
50f0: 20 20 20 2d 2d 20 64 69 73 70 6c 61 79 2e 0a 0a -- display...
5100: 09 09 53 45 4c 45 43 54 20 50 2e 6e 61 6d 65 2c ..SELECT P.name,
5110: 20 53 2e 6e 61 6d 65 0a 09 09 46 52 4f 4d 20 74 S.name...FROM t
5120: 61 67 20 54 2c 20 70 72 6f 6a 65 63 74 20 50 2c ag T, project P,
5130: 20 73 79 6d 62 6f 6c 20 53 2c 0a 09 09 20 20 20 symbol S,...
5140: 20 20 28 53 45 4c 45 43 54 20 43 49 2e 69 69 64 (SELECT CI.iid
5150: 20 20 20 20 20 20 20 20 41 53 20 69 69 64 2c 20 AS iid,
5160: 20 2d 2d 20 69 74 65 6d 0a 09 09 20 20 20 20 20 -- item...
5170: 20 20 20 20 20 20 20 20 63 6f 75 6e 74 28 43 49 count(CI
5180: 2e 63 69 64 29 20 41 53 20 63 6f 75 6e 74 20 2d .cid) AS count -
5190: 2d 20 6e 75 6d 62 65 72 20 6f 66 20 63 73 65 74 - number of cset
51a0: 73 20 75 73 69 6e 67 20 69 74 65 6d 0a 09 09 20 s using item...
51b0: 20 20 20 20 20 46 52 4f 4d 20 63 73 69 74 65 6d FROM csitem
51c0: 20 43 49 2c 20 63 68 61 6e 67 65 73 65 74 20 43 CI, changeset C
51d0: 0a 09 09 20 20 20 20 20 20 57 48 45 52 45 20 43 ... WHERE C
51e0: 2e 74 79 70 65 20 3d 20 31 20 20 20 20 20 20 20 .type = 1
51f0: 2d 2d 20 6c 69 6d 69 74 20 74 6f 20 74 61 67 20 -- limit to tag
5200: 63 73 65 74 73 0a 09 09 20 20 20 20 20 20 41 4e csets... AN
5210: 44 20 20 20 43 2e 63 69 64 20 20 3d 20 43 49 2e D C.cid = CI.
5220: 63 69 64 20 20 2d 2d 20 67 65 74 20 69 74 65 6d cid -- get item
5230: 73 20 6f 66 20 63 73 65 74 0a 09 09 20 20 20 20 s of cset...
5240: 20 20 47 52 4f 55 50 20 42 59 20 43 49 2e 69 69 GROUP BY CI.ii
5250: 64 20 20 20 20 20 20 20 20 2d 2d 20 61 67 67 72 d -- aggr
5260: 65 67 61 74 65 20 62 79 20 69 74 65 6d 2c 20 63 egate by item, c
5270: 6f 75 6e 74 20 63 73 65 74 73 2f 69 74 65 6d 0a ount csets/item.
5280: 09 09 20 20 20 20 20 29 20 41 53 20 55 0a 09 09 .. ) AS U...
5290: 57 48 45 52 45 20 55 2e 63 6f 75 6e 74 20 3e 20 WHERE U.count >
52a0: 31 20 20 20 20 20 20 20 20 20 20 20 20 2d 2d 20 1 --
52b0: 66 69 6e 64 20 74 61 67 20 69 74 65 6d 20 75 73 find tag item us
52c0: 65 64 20 6d 75 6c 74 69 70 6c 65 20 74 69 6d 65 ed multiple time
52d0: 73 0a 09 09 41 4e 44 20 20 20 54 2e 74 69 64 20 s...AND T.tid
52e0: 3d 20 55 2e 69 69 64 20 20 20 20 20 20 20 20 20 = U.iid
52f0: 20 2d 2d 20 67 65 74 20 74 61 67 20 6f 66 20 69 -- get tag of i
5300: 74 65 6d 0a 09 09 41 4e 44 20 20 20 53 2e 73 69 tem...AND S.si
5310: 64 20 3d 20 54 2e 73 69 64 20 20 20 20 20 20 20 d = T.sid
5320: 20 20 20 2d 2d 20 67 65 74 20 73 79 6d 62 6f 6c -- get symbol
5330: 20 6f 66 20 74 61 67 0a 09 09 41 4e 44 20 20 20 of tag...AND
5340: 50 2e 70 69 64 20 3d 20 53 2e 70 69 64 20 20 20 P.pid = S.pid
5350: 20 20 20 20 20 20 20 2d 2d 20 67 65 74 20 70 72 -- get pr
5360: 6f 6a 65 63 74 20 6f 66 20 73 79 6d 62 6f 6c 0a oject of symbol.
5370: 09 20 20 20 20 7d 0a 09 69 66 20 30 20 7b 0a 09 . }..if 0 {..
5380: 20 20 20 20 23 20 54 68 69 73 20 63 68 65 63 6b # This check
5390: 20 69 73 20 64 69 73 61 62 6c 65 64 20 66 6f 72 is disabled for
53a0: 20 74 68 65 20 6d 6f 6d 65 6e 74 2e 20 41 70 70 the moment. App
53b0: 61 72 65 6e 74 6c 79 20 74 61 67 73 0a 09 20 20 arently tags..
53c0: 20 20 23 20 63 61 6e 20 63 72 6f 73 73 20 6c 69 # can cross li
53d0: 6e 65 73 20 6f 66 20 64 65 76 65 6c 6f 70 6d 65 nes of developme
53e0: 6e 74 2c 20 61 74 20 6c 65 61 73 74 20 69 66 20 nt, at least if
53f0: 74 68 65 20 69 6e 76 6f 6c 76 65 64 0a 09 20 20 the involved..
5400: 20 20 23 20 4c 4f 44 73 20 61 72 65 20 74 68 65 # LODs are the
5410: 20 74 72 75 6e 6b 2c 20 61 6e 64 20 74 68 65 20 trunk, and the
5420: 4e 54 44 42 2e 20 54 68 61 74 20 6d 61 6b 65 73 NTDB. That makes
5430: 20 73 65 6e 73 65 2c 20 61 73 0a 09 20 20 20 20 sense, as..
5440: 23 20 74 68 65 20 4e 54 44 42 20 72 65 76 69 73 # the NTDB revis
5450: 69 6f 6e 73 20 61 72 65 20 69 6e 69 74 69 61 6c ions are initial
5460: 6c 79 20 6c 6f 67 69 63 61 6c 6c 79 20 61 20 70 ly logically a p
5470: 61 72 74 20 6f 66 20 74 68 65 0a 09 20 20 20 20 art of the..
5480: 23 20 74 72 75 6e 6b 2e 20 54 68 65 20 73 74 61 # trunk. The sta
5490: 6e 64 61 72 64 20 63 68 65 63 6b 20 62 65 6c 6f ndard check belo
54a0: 77 20 68 6f 77 65 76 65 72 20 64 6f 65 73 20 6e w however does n
54b0: 6f 74 20 63 61 70 74 75 72 65 0a 09 20 20 20 20 ot capture..
54c0: 23 20 74 68 69 73 2e 20 57 68 65 6e 20 49 20 6d # this. When I m
54d0: 61 6e 61 67 65 20 74 6f 20 72 65 70 68 72 61 73 anage to rephras
54e0: 65 20 69 74 20 74 6f 20 61 63 63 65 70 74 20 74 e it to accept t
54f0: 68 69 73 20 74 79 70 65 0a 09 20 20 20 20 23 20 his type.. #
5500: 6f 66 20 63 72 6f 73 73 2d 6f 76 65 72 20 69 74 of cross-over it
5510: 20 77 69 6c 6c 20 62 65 20 72 65 2d 61 63 74 69 will be re-acti
5520: 76 61 74 65 64 2e 0a 0a 09 20 20 20 20 23 20 41 vated.... # A
5530: 6c 6c 20 74 61 67 73 20 68 61 76 65 20 74 6f 20 ll tags have to
5540: 61 67 72 65 65 20 6f 6e 20 74 68 65 20 4c 4f 44 agree on the LOD
5550: 20 74 68 65 69 72 20 63 68 61 6e 67 65 73 65 74 their changeset
5560: 0a 09 20 20 20 20 23 20 62 65 6c 6f 6e 67 73 20 .. # belongs
5570: 74 6f 2e 20 49 6e 20 6f 74 68 65 72 20 77 6f 72 to. In other wor
5580: 64 73 2c 20 61 6c 6c 20 74 61 67 73 20 69 6e 20 ds, all tags in
5590: 61 20 63 68 61 6e 67 65 73 65 74 20 68 61 76 65 a changeset have
55a0: 0a 09 20 20 20 20 23 20 74 6f 20 72 65 66 65 72 .. # to refer
55b0: 20 74 6f 20 74 68 65 20 73 61 6d 65 20 6c 69 6e to the same lin
55c0: 65 20 6f 66 20 64 65 76 65 6c 6f 70 6d 65 6e 74 e of development
55d0: 2e 0a 09 20 20 20 20 23 0a 09 20 20 20 20 23 20 ... #.. #
55e0: 49 6e 73 74 65 61 64 20 6f 66 20 6c 6f 6f 6b 69 Instead of looki
55f0: 6e 67 20 61 74 20 61 6c 6c 20 70 61 69 72 73 20 ng at all pairs
5600: 6f 66 20 74 61 67 73 20 69 6e 20 61 6c 6c 0a 09 of tags in all..
5610: 20 20 20 20 23 20 63 68 61 6e 67 65 73 65 74 73 # changesets
5620: 20 77 65 20 67 65 6e 65 72 61 74 65 20 74 68 65 we generate the
5630: 20 64 69 73 74 69 6e 63 74 20 73 65 74 20 6f 66 distinct set of
5640: 20 61 6c 6c 20 4c 4f 44 73 0a 09 20 20 20 20 23 all LODs.. #
5650: 20 72 65 66 65 72 65 6e 63 65 64 20 62 79 20 74 referenced by t
5660: 68 65 20 74 61 67 73 20 6f 66 20 61 20 63 68 61 he tags of a cha
5670: 6e 67 65 73 65 74 2c 20 6c 6f 6f 6b 20 66 6f 72 ngeset, look for
5680: 20 74 68 6f 73 65 0a 09 20 20 20 20 23 20 77 69 those.. # wi
5690: 74 68 20 63 61 72 64 69 6e 61 6c 69 74 79 20 3e th cardinality >
56a0: 20 31 2c 20 61 6e 64 20 67 65 74 20 74 68 65 20 1, and get the
56b0: 69 64 65 6e 74 69 66 79 69 6e 67 0a 09 20 20 20 identifying..
56c0: 20 23 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 66 # information f
56d0: 6f 72 20 74 68 65 20 63 68 61 6e 67 65 73 65 74 or the changeset
56e0: 73 20 66 6f 75 6e 64 20 74 68 75 73 6c 79 2e 0a s found thusly..
56f0: 09 20 20 20 20 43 68 65 63 6b 43 53 20 5c 0a 09 . CheckCS \..
5700: 09 7b 41 6c 6c 20 74 61 67 73 20 69 6e 20 61 20 .{All tags in a
5710: 63 68 61 6e 67 65 73 65 74 20 68 61 76 65 20 74 changeset have t
5720: 6f 20 62 65 6c 6f 6e 67 20 74 6f 20 74 68 65 20 o belong to the
5730: 73 61 6d 65 20 4c 4f 44 7d 20 5c 0a 09 09 7b 3a same LOD} \...{:
5740: 20 49 74 73 20 74 61 67 73 20 64 69 73 61 67 72 Its tags disagr
5750: 65 65 20 61 62 6f 75 74 20 74 68 65 20 4c 4f 44 ee about the LOD
5760: 20 74 68 65 79 20 62 65 6c 6f 6e 67 20 74 6f 7d they belong to}
5770: 20 7b 0a 09 09 20 20 20 20 53 45 4c 45 43 54 20 {... SELECT
5780: 54 2e 6e 61 6d 65 2c 20 43 2e 63 69 64 0a 09 09 T.name, C.cid...
5790: 20 20 20 20 46 52 4f 4d 20 20 20 63 68 61 6e 67 FROM chang
57a0: 65 73 65 74 20 43 2c 20 63 73 74 79 70 65 20 54 eset C, cstype T
57b0: 0a 09 09 20 20 20 20 57 48 45 52 45 20 20 43 2e ... WHERE C.
57c0: 63 69 64 20 49 4e 20 28 53 45 4c 45 43 54 20 55 cid IN (SELECT U
57d0: 2e 63 69 64 0a 09 09 09 09 20 20 20 20 20 46 52 .cid..... FR
57e0: 4f 4d 20 28 53 45 4c 45 43 54 20 44 49 53 54 49 OM (SELECT DISTI
57f0: 4e 43 54 20 43 49 2e 63 69 64 20 41 53 20 63 69 NCT CI.cid AS ci
5800: 64 2c 20 54 2e 6c 6f 64 20 41 53 20 6c 6f 64 0a d, T.lod AS lod.
5810: 09 09 09 09 09 20 20 20 46 52 4f 4d 20 20 20 63 ..... FROM c
5820: 73 69 74 65 6d 20 43 49 2c 20 63 68 61 6e 67 65 sitem CI, change
5830: 73 65 74 20 43 2c 20 74 61 67 20 54 0a 09 09 09 set C, tag T....
5840: 09 09 20 20 20 57 48 45 52 45 20 20 43 49 2e 69 .. WHERE CI.i
5850: 69 64 20 3d 20 54 2e 74 69 64 0a 09 09 09 09 09 id = T.tid......
5860: 20 20 20 41 4e 44 20 20 20 20 43 2e 63 69 64 20 AND C.cid
5870: 3d 20 43 49 2e 63 69 64 0a 09 09 09 09 09 20 20 = CI.cid......
5880: 20 41 4e 44 20 20 20 20 43 2e 74 79 70 65 20 3d AND C.type =
5890: 20 31 29 20 41 53 20 55 0a 09 09 09 09 20 20 20 1) AS U.....
58a0: 20 20 47 52 4f 55 50 20 42 59 20 55 2e 63 69 64 GROUP BY U.cid
58b0: 20 48 41 56 49 4e 47 20 43 4f 55 4e 54 28 55 2e HAVING COUNT(U.
58c0: 6c 6f 64 29 20 3e 20 31 29 0a 09 09 20 20 20 20 lod) > 1)...
58d0: 41 4e 44 20 20 20 20 54 2e 74 69 64 20 3d 20 43 AND T.tid = C
58e0: 2e 74 79 70 65 0a 09 09 7d 0a 09 7d 0a 09 23 20 .type...}..}..#
58f0: 41 6c 6c 20 74 61 67 73 20 68 61 76 65 20 74 6f All tags have to
5900: 20 61 67 72 65 65 20 6f 6e 20 74 68 65 20 70 72 agree on the pr
5910: 6f 6a 65 63 74 20 74 68 65 69 72 20 63 68 61 6e oject their chan
5920: 67 65 73 65 74 0a 09 23 20 62 65 6c 6f 6e 67 73 geset..# belongs
5930: 20 74 6f 2e 20 49 6e 20 6f 74 68 65 72 20 77 6f to. In other wo
5940: 72 64 73 2c 20 61 6c 6c 20 74 61 67 73 20 69 6e rds, all tags in
5950: 20 61 20 63 68 61 6e 67 65 73 65 74 20 68 61 76 a changeset hav
5960: 65 20 74 6f 0a 09 23 20 72 65 66 65 72 20 74 6f e to..# refer to
5970: 20 74 68 65 20 73 61 6d 65 20 70 72 6f 6a 65 63 the same projec
5980: 74 2e 0a 09 23 0a 09 23 20 49 6e 73 74 65 61 64 t...#..# Instead
5990: 20 6f 66 20 6c 6f 6f 6b 69 6e 67 20 61 74 20 61 of looking at a
59a0: 6c 6c 20 70 61 69 72 73 20 6f 66 20 74 61 67 73 ll pairs of tags
59b0: 20 69 6e 20 61 6c 6c 20 63 68 61 6e 67 65 73 65 in all changese
59c0: 74 73 20 77 65 0a 09 23 20 67 65 6e 65 72 61 74 ts we..# generat
59d0: 65 20 74 68 65 20 64 69 73 74 69 6e 63 74 20 73 e the distinct s
59e0: 65 74 20 6f 66 20 61 6c 6c 20 70 72 6f 6a 65 63 et of all projec
59f0: 74 73 20 72 65 66 65 72 65 6e 63 65 64 20 62 79 ts referenced by
5a00: 20 74 68 65 0a 09 23 20 74 61 67 73 20 6f 66 20 the..# tags of
5a10: 61 20 63 68 61 6e 67 65 73 65 74 2c 20 6c 6f 6f a changeset, loo
5a20: 6b 20 66 6f 72 20 74 68 6f 73 65 20 77 69 74 68 k for those with
5a30: 20 63 61 72 64 69 6e 61 6c 69 74 79 20 3e 20 31 cardinality > 1
5a40: 2c 0a 09 23 20 61 6e 64 20 67 65 74 20 74 68 65 ,..# and get the
5a50: 20 69 64 65 6e 74 69 66 79 69 6e 67 20 69 6e 66 identifying inf
5a60: 6f 72 6d 61 74 69 6f 6e 20 66 6f 72 20 74 68 65 ormation for the
5a70: 20 63 68 61 6e 67 65 73 65 74 73 20 66 6f 75 6e changesets foun
5a80: 64 0a 09 23 20 74 68 75 73 6c 79 2e 0a 09 43 68 d..# thusly...Ch
5a90: 65 63 6b 43 53 20 5c 0a 09 20 20 20 20 7b 41 6c eckCS \.. {Al
5aa0: 6c 20 74 61 67 73 20 69 6e 20 61 20 63 68 61 6e l tags in a chan
5ab0: 67 65 73 65 74 20 68 61 76 65 20 74 6f 20 62 65 geset have to be
5ac0: 6c 6f 6e 67 20 74 6f 20 74 68 65 20 73 61 6d 65 long to the same
5ad0: 20 70 72 6f 6a 65 63 74 7d 20 5c 0a 09 20 20 20 project} \..
5ae0: 20 7b 3a 20 49 74 73 20 74 61 67 73 20 64 69 73 {: Its tags dis
5af0: 61 67 72 65 65 20 61 62 6f 75 74 20 74 68 65 20 agree about the
5b00: 70 72 6f 6a 65 63 74 20 74 68 65 79 20 62 65 6c project they bel
5b10: 6f 6e 67 20 74 6f 7d 20 7b 0a 09 09 53 45 4c 45 ong to} {...SELE
5b20: 43 54 20 54 2e 6e 61 6d 65 2c 20 43 2e 63 69 64 CT T.name, C.cid
5b30: 0a 09 09 46 52 4f 4d 20 20 20 63 68 61 6e 67 65 ...FROM change
5b40: 73 65 74 20 43 2c 20 63 73 74 79 70 65 20 54 0a set C, cstype T.
5b50: 09 09 57 48 45 52 45 20 20 43 2e 63 69 64 20 49 ..WHERE C.cid I
5b60: 4e 20 28 53 45 4c 45 43 54 20 55 2e 63 69 64 0a N (SELECT U.cid.
5b70: 09 09 09 09 20 46 52 4f 4d 20 28 53 45 4c 45 43 .... FROM (SELEC
5b80: 54 20 44 49 53 54 49 4e 43 54 20 20 20 20 20 20 T DISTINCT
5b90: 20 2d 2d 20 75 6e 69 71 75 65 20 63 73 65 74 2f -- unique cset/
5ba0: 70 72 6f 6a 20 70 61 69 72 73 0a 09 09 09 09 20 proj pairs.....
5bb0: 20 20 20 20 20 20 20 20 20 20 20 20 20 43 49 2e CI.
5bc0: 63 69 64 20 41 53 20 63 69 64 2c 20 2d 2d 20 74 cid AS cid, -- t
5bd0: 61 67 20 63 73 65 74 0a 09 09 09 09 20 20 20 20 ag cset.....
5be0: 20 20 20 20 20 20 20 20 20 20 46 2e 70 69 64 20 F.pid
5bf0: 20 41 53 20 70 69 64 20 20 2d 2d 20 70 72 6f 6a AS pid -- proj
5c00: 65 63 74 20 6f 66 20 69 74 65 6d 20 69 6e 20 63 ect of item in c
5c10: 73 65 74 0a 09 09 09 09 20 20 20 20 20 20 20 46 set..... F
5c20: 52 4f 4d 20 20 20 63 73 69 74 65 6d 20 43 49 2c ROM csitem CI,
5c30: 20 63 68 61 6e 67 65 73 65 74 20 43 2c 20 74 61 changeset C, ta
5c40: 67 20 54 2c 20 66 69 6c 65 20 46 0a 09 09 09 09 g T, file F.....
5c50: 20 20 20 20 20 20 20 57 48 45 52 45 20 20 43 49 WHERE CI
5c60: 2e 69 69 64 20 3d 20 54 2e 74 69 64 20 20 2d 2d .iid = T.tid --
5c70: 20 67 65 74 20 74 61 67 20 6f 66 20 69 74 65 6d get tag of item
5c80: 20 69 6e 20 63 73 65 74 0a 09 09 09 09 20 20 20 in cset.....
5c90: 20 20 20 20 41 4e 44 20 20 20 20 43 2e 63 69 64 AND C.cid
5ca0: 20 20 3d 20 43 49 2e 63 69 64 20 2d 2d 20 67 65 = CI.cid -- ge
5cb0: 74 20 63 68 61 6e 67 65 73 65 74 20 6f 66 20 69 t changeset of i
5cc0: 74 65 6d 0a 09 09 09 09 20 20 20 20 20 20 20 41 tem..... A
5cd0: 4e 44 20 20 20 20 43 2e 74 79 70 65 20 3d 20 31 ND C.type = 1
5ce0: 20 20 20 20 20 20 2d 2d 20 6c 69 6d 69 74 20 74 -- limit t
5cf0: 6f 20 74 61 67 20 63 68 61 6e 67 65 73 65 74 73 o tag changesets
5d00: 0a 09 09 09 09 20 20 20 20 20 20 20 41 4e 44 20 ..... AND
5d10: 20 20 20 46 2e 66 69 64 20 20 3d 20 54 2e 66 69 F.fid = T.fi
5d20: 64 20 20 2d 2d 20 67 65 74 20 66 69 6c 65 20 6f d -- get file o
5d30: 66 20 74 61 67 0a 20 20 20 20 20 20 20 20 20 20 f tag.
5d40: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
5d50: 20 20 20 20 20 20 20 20 20 20 20 20 29 20 41 53 ) AS
5d60: 20 55 0a 09 09 09 09 20 47 52 4f 55 50 20 42 59 U..... GROUP BY
5d70: 20 55 2e 63 69 64 20 20 20 20 20 20 20 20 20 20 U.cid
5d80: 20 2d 2d 20 61 67 67 72 65 67 61 74 65 20 62 79 -- aggregate by
5d90: 20 63 73 65 74 73 2c 20 63 6f 75 6e 74 20 70 72 csets, count pr
5da0: 6f 6a 2f 63 73 65 74 0a 09 09 09 09 20 48 41 56 oj/cset..... HAV
5db0: 49 4e 47 20 43 4f 55 4e 54 28 55 2e 70 69 64 29 ING COUNT(U.pid)
5dc0: 20 3e 20 31 20 20 2d 2d 20 66 69 6e 64 20 63 73 > 1 -- find cs
5dd0: 65 74 73 20 77 69 74 68 20 6d 75 6c 74 69 70 6c ets with multipl
5de0: 65 20 70 72 6f 6a 65 63 74 73 0a 09 09 20 20 20 e projects...
5df0: 20 20 20 20 20 20 20 20 20 20 20 20 20 29 0a 09 )..
5e00: 09 41 4e 44 20 20 20 20 54 2e 74 69 64 20 3d 20 .AND T.tid =
5e10: 43 2e 74 79 70 65 20 2d 2d 20 67 65 74 20 72 65 C.type -- get re
5e20: 61 64 61 62 6c 65 20 63 68 61 6e 67 65 73 65 74 adable changeset
5e30: 20 74 79 70 65 0a 09 20 20 20 20 7d 0a 09 23 20 type.. }..#
5e40: 41 6c 6c 20 74 61 67 73 20 69 6e 20 61 20 73 69 All tags in a si
5e50: 6e 67 6c 65 20 63 68 61 6e 67 65 73 65 74 20 68 ngle changeset h
5e60: 61 76 65 20 74 6f 20 62 65 6c 6f 6e 67 20 74 6f ave to belong to
5e70: 20 64 69 66 66 65 72 65 6e 74 0a 09 23 20 66 69 different..# fi
5e80: 6c 65 73 2e 20 43 6f 6e 76 65 72 73 65 6c 79 3a les. Conversely:
5e90: 20 4e 6f 20 74 77 6f 20 74 61 67 73 20 6f 66 20 No two tags of
5ea0: 61 20 73 69 6e 67 6c 65 20 66 69 6c 65 20 61 72 a single file ar
5eb0: 65 20 61 6c 6c 6f 77 65 64 0a 09 23 20 74 6f 20 e allowed..# to
5ec0: 62 65 20 69 6e 20 74 68 65 20 73 61 6d 65 20 63 be in the same c
5ed0: 68 61 6e 67 65 73 65 74 2e 0a 09 23 0a 09 23 20 hangeset...#..#
5ee0: 49 6e 73 74 65 61 64 20 6f 66 20 6c 6f 6f 6b 69 Instead of looki
5ef0: 6e 67 20 61 74 20 61 6c 6c 20 70 61 69 72 73 20 ng at all pairs
5f00: 6f 66 20 74 61 67 73 20 69 6e 20 61 6c 6c 20 63 of tags in all c
5f10: 68 61 6e 67 65 73 65 74 73 20 77 65 0a 09 23 20 hangesets we..#
5f20: 67 65 6e 65 72 61 74 65 20 74 68 65 20 64 69 73 generate the dis
5f30: 74 69 6e 63 74 20 73 65 74 20 6f 66 20 61 6c 6c tinct set of all
5f40: 20 66 69 6c 65 73 20 72 65 66 65 72 65 6e 63 65 files reference
5f50: 64 20 62 79 20 74 68 65 0a 09 23 20 74 61 67 73 d by the..# tags
5f60: 20 6f 66 20 61 20 63 68 61 6e 67 65 73 65 74 2c of a changeset,
5f70: 20 61 6e 64 20 6c 6f 6f 6b 20 66 6f 72 20 74 68 and look for th
5f80: 6f 73 65 20 77 69 74 68 20 63 61 72 64 69 6e 61 ose with cardina
5f90: 6c 69 74 79 20 3c 0a 09 23 20 74 68 65 20 63 61 lity <..# the ca
5fa0: 72 64 69 6e 61 6c 69 74 79 20 6f 66 20 74 68 65 rdinality of the
5fb0: 20 73 65 74 20 6f 66 20 74 61 67 73 2c 20 61 6e set of tags, an
5fc0: 64 20 67 65 74 20 74 68 65 20 69 64 65 6e 74 69 d get the identi
5fd0: 66 79 69 6e 67 0a 09 23 20 69 6e 66 6f 72 6d 61 fying..# informa
5fe0: 74 69 6f 6e 20 66 6f 72 20 74 68 65 20 63 68 61 tion for the cha
5ff0: 6e 67 65 73 65 74 73 20 66 6f 75 6e 64 20 74 68 ngesets found th
6000: 75 73 6c 79 2e 0a 09 43 68 65 63 6b 43 53 20 5c usly...CheckCS \
6010: 0a 09 20 20 20 20 7b 41 6c 6c 20 74 61 67 73 20 .. {All tags
6020: 69 6e 20 61 20 63 68 61 6e 67 65 73 65 74 20 68 in a changeset h
6030: 61 76 65 20 74 6f 20 62 65 6c 6f 6e 67 20 74 6f ave to belong to
6040: 20 64 69 66 66 65 72 65 6e 74 20 66 69 6c 65 73 different files
6050: 7d 20 5c 0a 09 20 20 20 20 7b 3a 20 49 74 73 20 } \.. {: Its
6060: 74 61 67 73 20 73 68 61 72 65 20 66 69 6c 65 73 tags share files
6070: 7d 20 7b 0a 09 09 53 45 4c 45 43 54 20 54 2e 6e } {...SELECT T.n
6080: 61 6d 65 2c 20 43 2e 63 69 64 0a 09 09 46 52 4f ame, C.cid...FRO
6090: 4d 20 20 20 63 68 61 6e 67 65 73 65 74 20 43 2c M changeset C,
60a0: 20 63 73 74 79 70 65 20 54 0a 09 09 57 48 45 52 cstype T...WHER
60b0: 45 20 20 43 2e 63 69 64 20 49 4e 20 28 53 45 4c E C.cid IN (SEL
60c0: 45 43 54 20 56 56 2e 63 69 64 0a 09 09 09 09 20 ECT VV.cid.....
60d0: 46 52 4f 4d 20 28 53 45 4c 45 43 54 20 55 2e 63 FROM (SELECT U.c
60e0: 69 64 20 20 20 20 20 20 20 20 20 41 53 20 63 69 id AS ci
60f0: 64 2c 20 20 20 2d 2d 20 63 68 61 6e 67 65 73 65 d, -- changese
6100: 74 0a 09 09 09 09 20 20 20 20 20 20 20 20 20 20 t.....
6110: 20 20 20 20 43 4f 55 4e 54 20 28 55 2e 66 69 64 COUNT (U.fid
6120: 29 20 41 53 20 66 63 6f 75 6e 74 20 2d 2d 20 6e ) AS fcount -- n
6130: 75 6d 62 65 72 20 6f 66 20 66 69 6c 65 73 20 62 umber of files b
6140: 79 20 69 74 65 6d 73 0a 09 09 09 09 20 20 20 20 y items.....
6150: 20 20 20 46 52 4f 4d 20 28 53 45 4c 45 43 54 20 FROM (SELECT
6160: 44 49 53 54 49 4e 43 54 20 20 20 20 20 20 20 2d DISTINCT -
6170: 2d 20 75 6e 69 71 75 65 20 63 73 65 74 2f 66 69 - unique cset/fi
6180: 6c 65 20 70 61 69 72 73 0a 09 09 09 09 09 20 20 le pairs......
6190: 20 20 20 20 20 20 20 20 20 20 43 49 2e 63 69 64 CI.cid
61a0: 20 41 53 20 63 69 64 2c 20 2d 2d 20 74 61 67 20 AS cid, -- tag
61b0: 63 68 61 6e 67 65 73 65 74 0a 09 09 09 09 09 20 changeset......
61c0: 20 20 20 20 20 20 20 20 20 20 20 54 2e 66 69 64 T.fid
61d0: 20 20 41 53 20 66 69 64 20 20 2d 2d 20 66 69 6c AS fid -- fil
61e0: 65 20 6f 66 20 69 74 65 6d 20 69 6e 20 63 68 61 e of item in cha
61f0: 6e 67 65 73 65 74 0a 09 09 09 09 09 20 20 20 20 ngeset......
6200: 20 46 52 4f 4d 20 20 20 63 73 69 74 65 6d 20 43 FROM csitem C
6210: 49 2c 20 63 68 61 6e 67 65 73 65 74 20 43 2c 20 I, changeset C,
6220: 74 61 67 20 54 0a 09 09 09 09 09 20 20 20 20 20 tag T......
6230: 57 48 45 52 45 20 20 43 49 2e 69 69 64 20 3d 20 WHERE CI.iid =
6240: 54 2e 74 69 64 20 2d 2d 20 67 65 74 20 74 61 67 T.tid -- get tag
6250: 20 6f 66 20 69 74 65 6d 20 69 6e 20 63 68 61 6e of item in chan
6260: 67 65 73 65 74 0a 09 09 09 09 09 20 20 20 20 20 geset......
6270: 41 4e 44 20 20 20 20 43 2e 63 69 64 20 3d 20 43 AND C.cid = C
6280: 49 2e 63 69 64 20 2d 2d 20 67 65 74 20 63 68 61 I.cid -- get cha
6290: 6e 67 65 73 65 74 20 6f 66 20 69 74 65 6d 0a 09 ngeset of item..
62a0: 09 09 09 09 20 20 20 20 20 41 4e 44 20 20 20 20 .... AND
62b0: 43 2e 74 79 70 65 20 3d 20 31 20 20 20 20 20 2d C.type = 1 -
62c0: 2d 20 6c 69 6d 69 74 20 74 6f 20 74 61 67 20 63 - limit to tag c
62d0: 68 61 6e 67 65 73 65 74 73 0a 09 09 09 09 09 20 hangesets......
62e0: 20 20 20 20 29 20 41 53 20 55 0a 09 09 09 09 20 ) AS U.....
62f0: 20 20 20 20 20 20 47 52 4f 55 50 20 42 59 20 55 GROUP BY U
6300: 2e 63 69 64 20 2d 2d 20 61 67 67 72 65 67 61 74 .cid -- aggregat
6310: 65 20 62 79 20 63 73 65 74 73 2c 20 63 6f 75 6e e by csets, coun
6320: 74 20 66 69 6c 65 73 2f 63 73 65 74 0a 20 20 20 t files/cset.
6330: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
6340: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
6350: 20 20 20 29 20 41 53 20 55 55 2c 0a 09 09 09 09 ) AS UU,.....
6360: 20 20 20 20 20 20 28 53 45 4c 45 43 54 20 56 2e (SELECT V.
6370: 63 69 64 20 20 20 20 20 20 20 20 20 41 53 20 63 cid AS c
6380: 69 64 2c 20 20 20 2d 2d 20 63 68 61 6e 67 65 73 id, -- changes
6390: 65 74 0a 09 09 09 09 20 20 20 20 20 20 20 20 20 et.....
63a0: 20 20 20 20 20 43 4f 55 4e 54 20 28 56 2e 69 69 COUNT (V.ii
63b0: 64 29 20 41 53 20 72 63 6f 75 6e 74 20 2d 2d 20 d) AS rcount --
63c0: 6e 75 6d 62 65 72 20 6f 66 20 69 74 65 6d 73 20 number of items
63d0: 69 6e 20 63 73 65 74 0a 09 09 09 09 20 20 20 20 in cset.....
63e0: 20 20 20 46 52 4f 4d 20 20 20 63 73 69 74 65 6d FROM csitem
63f0: 20 56 2c 20 63 68 61 6e 67 65 73 65 74 20 58 0a V, changeset X.
6400: 09 09 09 09 20 20 20 20 20 20 20 57 48 45 52 45 .... WHERE
6410: 20 20 58 2e 63 69 64 20 20 3d 20 56 2e 63 69 64 X.cid = V.cid
6420: 20 2d 2d 20 67 65 74 20 63 68 61 6e 67 65 73 65 -- get changese
6430: 74 20 6f 66 20 69 74 65 6d 0a 09 09 09 09 20 20 t of item.....
6440: 20 20 20 20 20 41 4e 44 20 20 20 20 58 2e 74 79 AND X.ty
6450: 70 65 20 3d 20 31 20 20 20 20 20 2d 2d 20 6c 69 pe = 1 -- li
6460: 6d 69 74 20 74 6f 20 74 61 67 20 63 68 61 6e 67 mit to tag chang
6470: 65 73 65 74 73 0a 09 09 09 09 20 20 20 20 20 20 esets.....
6480: 20 47 52 4f 55 50 20 42 59 20 56 2e 63 69 64 20 GROUP BY V.cid
6490: 20 20 20 20 20 20 20 2d 2d 20 61 67 67 72 65 67 -- aggreg
64a0: 61 74 65 20 62 79 20 63 73 65 74 73 2c 20 63 6f ate by csets, co
64b0: 75 6e 74 20 69 74 65 6d 73 2f 63 73 65 74 0a 20 unt items/cset.
64c0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
64d0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
64e0: 20 20 20 20 20 29 20 41 53 20 56 56 0a 09 09 09 ) AS VV....
64f0: 09 20 57 48 45 52 45 20 56 56 2e 63 69 64 20 3d . WHERE VV.cid =
6500: 20 55 55 2e 63 69 64 20 20 20 20 20 20 20 2d 2d UU.cid --
6510: 20 73 79 6e 63 20 23 69 74 65 6d 73 2f 63 73 65 sync #items/cse
6520: 74 20 77 69 74 68 20 23 66 69 6c 65 73 2f 63 73 t with #files/cs
6530: 65 74 0a 09 09 09 09 20 41 4e 44 20 20 20 55 55 et..... AND UU
6540: 2e 66 63 6f 75 6e 74 20 3c 20 56 56 2e 72 63 6f .fcount < VV.rco
6550: 75 6e 74 20 2d 2d 20 6c 65 73 73 20 66 69 6c 65 unt -- less file
6560: 73 20 74 68 61 6e 20 69 74 65 6d 73 0a 09 09 09 s than items....
6570: 09 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
6580: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2d 2d --
6590: 20 3d 3e 20 69 74 65 6d 73 20 62 65 6c 6f 6e 67 => items belong
65a0: 20 74 6f 20 74 68 65 20 73 61 6d 65 20 66 69 6c to the same fil
65b0: 65 2e 0a 09 09 09 09 29 0a 09 09 41 4e 44 20 20 e......)...AND
65c0: 20 20 54 2e 74 69 64 20 3d 20 43 2e 74 79 70 65 T.tid = C.type
65d0: 20 2d 2d 20 67 65 74 20 72 65 61 64 61 62 6c 65 -- get readable
65e0: 20 63 68 61 6e 67 65 73 65 74 20 74 79 70 65 0a changeset type.
65f0: 09 20 20 20 20 7d 0a 09 72 65 74 75 72 6e 0a 20 . }..return.
6600: 20 20 20 7d 0a 0a 20 20 20 20 70 72 6f 63 20 42 }.. proc B
6610: 72 61 6e 63 68 43 68 61 6e 67 65 73 65 74 73 20 ranchChangesets
6620: 7b 7d 20 7b 0a 09 23 20 54 68 69 73 20 63 6f 64 {} {..# This cod
6630: 65 20 70 65 72 66 6f 72 6d 73 20 61 20 6e 75 6d e performs a num
6640: 62 65 72 20 6f 66 20 70 61 72 61 6e 6f 69 64 20 ber of paranoid
6650: 63 68 65 63 6b 73 20 6f 66 20 74 68 65 0a 09 23 checks of the..#
6660: 20 64 61 74 61 62 61 73 65 2c 20 73 65 61 72 63 database, searc
6670: 68 69 6e 67 20 66 6f 72 20 69 6e 63 6f 6e 73 69 hing for inconsi
6680: 73 74 65 6e 74 20 63 68 61 6e 67 65 73 65 74 2f stent changeset/
6690: 72 65 76 69 73 69 6f 6e 0a 09 23 20 69 6e 66 6f revision..# info
66a0: 72 6d 61 74 69 6f 6e 2e 0a 0a 09 75 70 76 61 72 rmation....upvar
66b0: 20 31 20 6e 20 6e 20 3b 20 23 20 43 6f 75 6e 74 1 n n ; # Count
66c0: 65 72 20 66 6f 72 20 74 68 65 20 63 68 65 63 6b er for the check
66d0: 73 20 28 77 65 20 70 72 69 6e 74 20 61 6e 20 69 s (we print an i
66e0: 64 20 62 65 66 6f 72 65 0a 09 09 20 20 20 20 20 d before...
66f0: 20 23 20 74 68 65 20 6d 61 69 6e 20 6c 61 62 65 # the main labe
6700: 6c 29 2e 0a 0a 09 23 20 46 69 6e 64 20 61 6c 6c l)....# Find all
6710: 20 62 72 61 6e 63 68 65 73 20 77 68 69 63 68 20 branches which
6720: 61 72 65 20 6e 6f 74 20 75 73 65 64 20 62 79 20 are not used by
6730: 61 74 20 6c 65 61 73 74 20 6f 6e 65 0a 09 23 20 at least one..#
6740: 63 68 61 6e 67 65 73 65 74 2e 0a 09 43 68 65 63 changeset...Chec
6750: 6b 42 72 61 6e 63 68 20 5c 0a 09 20 20 20 20 7b kBranch \.. {
6760: 41 6c 6c 20 62 72 61 6e 63 68 65 73 20 68 61 76 All branches hav
6770: 65 20 74 6f 20 62 65 20 75 73 65 64 20 62 79 20 e to be used by
6780: 6c 65 61 73 74 20 6f 6e 65 20 63 68 61 6e 67 65 least one change
6790: 73 65 74 7d 20 5c 0a 09 20 20 20 20 7b 69 73 20 set} \.. {is
67a0: 6e 6f 74 20 75 73 65 64 20 62 79 20 61 20 63 68 not used by a ch
67b0: 61 6e 67 65 73 65 74 7d 20 7b 0a 09 09 2d 2d 20 angeset} {...--
67c0: 55 6e 75 73 65 64 20 62 72 61 6e 63 68 65 73 20 Unused branches
67d0: 3d 20 41 6c 6c 20 62 72 61 6e 63 68 65 73 0a 09 = All branches..
67e0: 09 2d 2d 20 20 20 20 20 20 20 20 20 20 20 20 20 .--
67f0: 20 20 20 20 2d 20 62 72 61 6e 63 68 65 73 20 75 - branches u
6800: 73 65 64 20 62 79 20 62 72 61 6e 63 68 20 63 68 sed by branch ch
6810: 61 6e 67 65 73 65 74 73 2e 0a 09 09 2d 2d 0a 09 angesets....--..
6820: 09 2d 2d 20 42 6f 74 68 20 73 65 74 73 20 63 61 .-- Both sets ca
6830: 6e 20 62 65 20 63 6f 6d 70 75 74 65 64 20 65 61 n be computed ea
6840: 73 69 6c 79 2c 20 61 6e 64 20 73 75 62 74 72 61 sily, and subtra
6850: 63 74 65 64 0a 20 20 20 20 20 20 20 20 20 20 20 cted.
6860: 20 20 20 20 20 2d 2d 20 66 72 6f 6d 20 65 61 63 -- from eac
6870: 68 20 6f 74 68 65 72 2e 20 54 68 65 6e 20 77 65 h other. Then we
6880: 20 63 61 6e 20 67 65 74 20 74 68 65 20 61 73 73 can get the ass
6890: 6f 63 69 61 74 65 64 0a 20 20 20 20 20 20 20 20 ociated.
68a0: 20 20 20 20 20 20 20 20 2d 2d 20 66 69 6c 65 20 -- file
68b0: 28 6e 61 6d 65 29 20 66 6f 72 20 64 69 73 70 6c (name) for displ
68c0: 61 79 2e 0a 0a 09 09 53 45 4c 45 43 54 20 50 2e ay.....SELECT P.
68d0: 6e 61 6d 65 2c 20 53 2e 6e 61 6d 65 0a 09 09 46 name, S.name...F
68e0: 52 4f 4d 20 70 72 6f 6a 65 63 74 20 50 2c 20 62 ROM project P, b
68f0: 72 61 6e 63 68 20 42 2c 20 73 79 6d 62 6f 6c 20 ranch B, symbol
6900: 53 0a 09 09 57 48 45 52 45 20 42 2e 62 69 64 20 S...WHERE B.bid
6910: 49 4e 20 28 53 45 4c 45 43 54 20 62 69 64 20 20 IN (SELECT bid
6920: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
6930: 20 20 2d 2d 20 41 6c 6c 20 62 72 61 6e 63 68 65 -- All branche
6940: 73 0a 09 09 09 09 46 52 4f 4d 20 20 20 62 72 61 s.....FROM bra
6950: 6e 63 68 0a 09 09 09 09 45 58 43 45 50 54 20 20 nch.....EXCEPT
6960: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
6970: 20 20 20 20 20 20 2d 2d 20 73 75 62 74 72 61 63 -- subtrac
6980: 74 0a 09 09 09 09 53 45 4c 45 43 54 20 43 49 2e t.....SELECT CI.
6990: 69 69 64 20 20 20 20 20 20 20 20 20 20 20 20 20 iid
69a0: 20 20 20 20 2d 2d 20 62 72 61 6e 63 68 65 73 20 -- branches
69b0: 75 73 65 64 0a 09 09 09 09 46 52 4f 4d 20 20 20 used.....FROM
69c0: 63 73 69 74 65 6d 20 43 49 2c 20 63 68 61 6e 67 csitem CI, chang
69d0: 65 73 65 74 20 43 0a 09 09 09 09 57 48 45 52 45 eset C.....WHERE
69e0: 20 20 43 2e 63 69 64 20 3d 20 43 49 2e 63 69 64 C.cid = CI.cid
69f0: 20 20 20 20 20 20 20 20 20 2d 2d 20 62 79 20 61 -- by a
6a00: 6e 79 20 62 72 61 6e 63 68 0a 09 09 09 09 41 4e ny branch.....AN
6a10: 44 20 20 20 20 43 2e 74 79 70 65 20 3d 20 32 20 D C.type = 2
6a20: 20 20 20 20 20 20 20 20 20 20 20 20 2d 2d 20 63 -- c
6a30: 68 61 6e 67 65 73 65 74 0a 09 09 09 20 20 20 20 hangeset....
6a40: 20 20 20 29 0a 09 09 41 4e 44 20 20 20 53 2e 73 )...AND S.s
6a50: 69 64 20 3d 20 42 2e 73 69 64 20 20 20 20 20 20 id = B.sid
6a60: 20 20 20 20 20 20 20 20 20 2d 2d 20 67 65 74 20 -- get
6a70: 73 79 6d 62 6f 6c 20 6f 66 20 62 72 61 6e 63 68 symbol of branch
6a80: 0a 09 09 41 4e 44 20 20 20 50 2e 70 69 64 20 3d ...AND P.pid =
6a90: 20 53 2e 70 69 64 20 20 20 20 20 20 20 20 20 20 S.pid
6aa0: 20 20 20 20 20 2d 2d 20 67 65 74 20 70 72 6f 6a -- get proj
6ab0: 65 63 74 20 6f 66 20 73 79 6d 62 6f 6c 0a 09 20 ect of symbol..
6ac0: 20 20 20 7d 0a 09 23 20 46 69 6e 64 20 61 6c 6c }..# Find all
6ad0: 20 62 72 61 6e 63 68 65 73 20 77 68 69 63 68 20 branches which
6ae0: 61 72 65 20 75 73 65 64 20 62 79 20 6d 6f 72 65 are used by more
6af0: 20 74 68 61 6e 20 6f 6e 65 20 63 68 61 6e 67 65 than one change
6b00: 73 65 74 2e 0a 09 43 68 65 63 6b 52 65 76 20 5c set...CheckRev \
6b10: 0a 09 20 20 20 20 7b 41 6c 6c 20 62 72 61 6e 63 .. {All branc
6b20: 68 65 73 20 68 61 76 65 20 74 6f 20 62 65 20 75 hes have to be u
6b30: 73 65 64 20 62 79 20 61 74 20 6d 6f 73 74 20 6f sed by at most o
6b40: 6e 65 20 63 68 61 6e 67 65 73 65 74 7d 20 5c 0a ne changeset} \.
6b50: 09 20 20 20 20 7b 69 73 20 75 73 65 64 20 62 79 . {is used by
6b60: 20 6d 75 6c 74 69 70 6c 65 20 63 68 61 6e 67 65 multiple change
6b70: 73 65 74 73 7d 20 7b 0a 09 09 2d 2d 20 50 72 69 sets} {...-- Pri
6b80: 6e 63 69 70 6c 65 20 6f 66 20 6f 70 65 72 61 74 nciple of operat
6b90: 69 6f 6e 3a 20 47 65 74 20 61 6c 6c 20 62 72 61 ion: Get all bra
6ba0: 6e 63 68 2f 63 68 61 6e 67 65 73 65 74 0a 20 20 nch/changeset.
6bb0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2d 2d --
6bc0: 20 70 61 69 72 73 20 66 6f 72 20 61 6c 6c 20 62 pairs for all b
6bd0: 72 61 6e 63 68 20 63 68 61 6e 67 65 73 65 74 73 ranch changesets
6be0: 2c 20 67 72 6f 75 70 20 62 79 20 74 61 67 20 74 , group by tag t
6bf0: 6f 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 o.
6c00: 20 20 2d 2d 20 61 67 67 72 65 67 61 74 65 20 74 -- aggregate t
6c10: 68 65 20 63 68 61 6e 67 65 73 65 74 2c 20 63 6f he changeset, co
6c20: 75 6e 74 69 6e 67 20 74 68 65 6d 2e 20 46 72 6f unting them. Fro
6c30: 6d 20 74 68 65 0a 20 20 20 20 20 20 20 20 20 20 m the.
6c40: 20 20 20 20 20 20 2d 2d 20 72 65 73 75 6c 74 69 -- resulti
6c50: 6e 67 20 62 72 61 6e 63 68 2f 63 6f 75 6e 74 20 ng branch/count
6c60: 74 61 62 6c 65 20 73 65 6c 65 63 74 20 74 68 6f table select tho
6c70: 73 65 20 77 69 74 68 20 6d 6f 72 65 0a 20 20 20 se with more.
6c80: 20 20 20 20 20 20 20 20 20 20 20 20 20 2d 2d 20 --
6c90: 74 68 61 6e 20 6f 6e 65 20 75 73 65 72 2c 20 61 than one user, a
6ca0: 6e 64 20 67 65 74 20 74 68 65 69 72 20 61 73 73 nd get their ass
6cb0: 6f 63 69 61 74 65 64 20 66 69 6c 65 20 28 6e 61 ociated file (na
6cc0: 6d 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 me).
6cd0: 20 20 20 20 2d 2d 20 66 6f 72 20 64 69 73 70 6c -- for displ
6ce0: 61 79 2e 0a 0a 09 09 53 45 4c 45 43 54 20 50 2e ay.....SELECT P.
6cf0: 6e 61 6d 65 2c 20 53 2e 6e 61 6d 65 0a 09 09 46 name, S.name...F
6d00: 52 4f 4d 20 62 72 61 6e 63 68 20 42 2c 20 70 72 ROM branch B, pr
6d10: 6f 6a 65 63 74 20 50 2c 20 73 79 6d 62 6f 6c 20 oject P, symbol
6d20: 53 2c 0a 09 09 20 20 20 20 20 28 53 45 4c 45 43 S,... (SELEC
6d30: 54 20 43 49 2e 69 69 64 20 20 20 20 20 20 20 20 T CI.iid
6d40: 41 53 20 69 69 64 2c 20 20 2d 2d 20 69 74 65 6d AS iid, -- item
6d50: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
6d60: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 63 6f co
6d70: 75 6e 74 28 43 49 2e 63 69 64 29 20 41 53 20 63 unt(CI.cid) AS c
6d80: 6f 75 6e 74 20 2d 2d 20 6e 75 6d 62 65 72 20 6f ount -- number o
6d90: 66 20 63 73 65 74 73 20 66 6f 72 20 69 74 65 6d f csets for item
6da0: 0a 09 09 20 20 20 20 20 20 46 52 4f 4d 20 63 73 ... FROM cs
6db0: 69 74 65 6d 20 43 49 2c 20 63 68 61 6e 67 65 73 item CI, changes
6dc0: 65 74 20 43 0a 09 09 20 20 20 20 20 20 57 48 45 et C... WHE
6dd0: 52 45 20 43 2e 74 79 70 65 20 3d 20 32 20 20 20 RE C.type = 2
6de0: 20 20 20 20 20 2d 2d 20 6c 69 6d 69 74 20 74 6f -- limit to
6df0: 20 62 72 61 6e 63 68 20 63 68 61 6e 67 65 73 65 branch changese
6e00: 74 73 2c 0a 09 09 20 20 20 20 20 20 41 4e 44 20 ts,... AND
6e10: 20 20 43 2e 63 69 64 20 3d 20 43 49 2e 63 69 64 C.cid = CI.cid
6e20: 20 20 20 20 2d 2d 20 67 65 74 20 74 68 65 20 69 -- get the i
6e30: 74 65 6d 73 20 74 68 65 79 20 63 6f 6e 74 61 69 tems they contai
6e40: 6e 2c 0a 09 09 20 20 20 20 20 20 47 52 4f 55 50 n,... GROUP
6e50: 20 42 59 20 43 49 2e 69 69 64 20 20 20 20 20 20 BY CI.iid
6e60: 20 20 20 2d 2d 20 61 67 67 72 65 67 61 74 65 20 -- aggregate
6e70: 62 79 20 69 74 65 6d 73 2c 20 63 6f 75 6e 74 20 by items, count
6e80: 63 73 65 74 73 2f 69 74 65 6d 20 28 78 29 0a 20 csets/item (x).
6e90: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
6ea0: 20 20 20 20 29 20 41 53 20 55 0a 09 09 57 48 45 ) AS U...WHE
6eb0: 52 45 20 55 2e 63 6f 75 6e 74 20 3e 20 31 20 20 RE U.count > 1
6ec0: 20 20 20 20 20 20 20 20 20 20 20 2d 2d 20 66 69 -- fi
6ed0: 6e 64 20 69 74 65 6d 73 20 75 73 65 64 20 6d 75 nd items used mu
6ee0: 6c 74 69 70 6c 65 20 74 69 6d 65 73 0a 09 09 41 ltiple times...A
6ef0: 4e 44 20 20 20 42 2e 62 69 64 20 3d 20 55 2e 69 ND B.bid = U.i
6f00: 69 64 20 20 20 20 20 20 20 20 20 20 20 2d 2d 20 id --
6f10: 67 65 74 20 74 68 65 20 75 73 65 72 73 20 28 62 get the users (b
6f20: 72 61 6e 63 68 20 63 68 61 6e 67 65 73 65 74 73 ranch changesets
6f30: 29 0a 09 09 41 4e 44 20 20 20 53 2e 73 69 64 20 )...AND S.sid
6f40: 3d 20 42 2e 73 69 64 20 20 20 20 20 20 20 20 20 = B.sid
6f50: 20 20 2d 2d 20 67 65 74 20 73 79 6d 62 6f 6c 20 -- get symbol
6f60: 6f 66 20 62 72 61 6e 63 68 0a 09 09 41 4e 44 20 of branch...AND
6f70: 20 20 50 2e 70 69 64 20 3d 20 53 2e 70 69 64 20 P.pid = S.pid
6f80: 20 20 20 20 20 20 20 20 20 20 2d 2d 20 67 65 74 -- get
6f90: 20 70 72 6f 6a 65 63 74 20 6f 66 20 73 79 6d 62 project of symb
6fa0: 6f 6c 0a 09 20 20 20 20 7d 0a 09 69 66 20 30 20 ol.. }..if 0
6fb0: 7b 0a 09 20 20 20 20 23 20 54 68 69 73 20 63 68 {.. # This ch
6fc0: 65 63 6b 20 68 61 73 20 62 65 65 6e 20 64 69 73 eck has been dis
6fd0: 61 62 6c 65 64 2e 20 57 68 65 6e 20 74 68 65 20 abled. When the
6fe0: 63 6f 6e 76 65 72 74 65 72 20 77 61 73 20 72 75 converter was ru
6ff0: 6e 0a 09 20 20 20 20 23 20 6f 6e 20 74 68 65 20 n.. # on the
7000: 54 63 6c 20 43 56 53 20 73 65 76 65 72 61 6c 20 Tcl CVS several
7010: 62 72 61 6e 63 68 65 73 20 74 72 69 70 70 65 64 branches tripped
7020: 20 74 68 69 73 0a 09 20 20 20 20 23 20 63 6f 6e this.. # con
7030: 73 74 72 61 69 6e 74 2e 20 4f 6e 65 20 6f 66 20 straint. One of
7040: 74 68 65 6d 20 77 61 73 20 61 20 66 72 65 65 2d them was a free-
7050: 66 6c 6f 61 74 69 6e 67 20 62 72 61 6e 63 68 2c floating branch,
7060: 20 61 6e 64 0a 09 20 20 20 20 23 20 69 74 73 20 and.. # its
7070: 68 61 6e 64 6c 69 6e 67 20 68 61 73 20 62 65 65 handling has bee
7080: 6e 20 66 69 78 65 64 20 62 79 20 6e 6f 77 2e 20 n fixed by now.
7090: 54 68 65 20 6f 74 68 65 72 73 20 68 6f 77 65 76 The others howev
70a0: 65 72 0a 09 20 20 20 20 23 20 73 65 65 6d 20 73 er.. # seem s
70b0: 65 6d 69 2d 6c 65 67 69 74 69 6d 61 74 65 2c 20 emi-legitimate,
70c0: 69 6e 20 74 68 65 20 73 65 6e 73 65 20 74 68 61 in the sense tha
70d0: 74 20 74 68 65 79 20 73 68 6f 77 0a 09 20 20 20 t they show..
70e0: 20 23 20 69 6e 63 6f 6e 73 69 73 74 65 6e 63 69 # inconsistenci
70f0: 65 73 20 69 6e 20 74 68 65 20 43 56 53 20 68 69 es in the CVS hi
7100: 73 74 6f 72 79 20 74 68 65 20 75 73 65 72 20 69 story the user i
7110: 73 20 6e 6f 74 0a 09 20 20 20 20 23 20 72 65 61 s not.. # rea
7120: 6c 6c 79 20 61 62 6c 65 20 74 6f 20 73 6f 6c 76 lly able to solv
7130: 65 2c 20 62 75 74 20 69 74 20 6d 69 67 68 74 20 e, but it might
7140: 62 65 20 70 6f 73 73 69 62 6c 65 20 74 6f 20 73 be possible to s
7150: 69 6d 70 6c 79 0a 09 20 20 20 20 23 20 69 67 6e imply.. # ign
7160: 6f 72 65 20 74 68 65 6d 2e 0a 0a 09 20 20 20 20 ore them....
7170: 23 20 46 6f 72 20 65 78 61 6d 70 6c 65 20 69 6e # For example in
7180: 20 54 63 6c 20 77 65 20 68 61 76 65 20 61 20 62 Tcl we have a b
7190: 72 61 6e 63 68 20 58 20 77 69 74 68 20 61 20 70 ranch X with a p
71a0: 72 65 66 65 72 65 64 0a 09 20 20 20 20 23 20 70 refered.. # p
71b0: 61 72 65 6e 74 20 59 2c 20 65 78 63 65 70 74 20 arent Y, except
71c0: 66 6f 72 20 61 20 73 69 6e 67 6c 65 20 66 69 6c for a single fil
71d0: 65 20 77 68 65 72 65 20 74 68 65 20 70 72 65 66 e where the pref
71e0: 65 72 65 64 0a 09 20 20 20 20 23 20 70 61 72 65 ered.. # pare
71f0: 6e 74 20 73 65 65 6d 73 20 74 6f 20 62 65 20 63 nt seems to be c
7200: 72 65 61 74 65 64 20 61 66 74 65 72 20 69 74 73 reated after its
7210: 20 63 75 72 72 65 6e 74 20 70 61 72 65 6e 74 2c current parent,
7220: 0a 09 20 20 20 20 23 20 6d 61 6b 69 6e 67 20 72 .. # making r
7230: 65 2d 70 61 72 65 6e 74 69 6e 67 20 69 6d 70 6f e-parenting impo
7240: 73 73 69 62 6c 65 2e 20 48 6f 77 65 76 65 72 20 ssible. However
7250: 77 65 20 6d 61 79 20 62 65 20 61 62 6c 65 0a 09 we may be able..
7260: 20 20 20 20 23 20 74 6f 20 69 67 6e 6f 72 65 20 # to ignore
7270: 74 68 69 73 2c 20 69 74 20 73 68 6f 75 6c 64 20 this, it should
7280: 6f 6e 6c 79 20 63 61 75 73 65 20 74 68 65 20 62 only cause the b
7290: 72 61 6e 63 68 20 74 6f 20 68 61 76 65 0a 09 20 ranch to have..
72a0: 20 20 20 23 20 6d 6f 72 65 20 74 68 61 6e 20 6f # more than o
72b0: 6e 65 20 70 72 65 64 65 63 65 73 73 6f 72 2c 20 ne predecessor,
72c0: 61 6e 64 20 73 68 69 66 74 69 6e 67 20 69 74 20 and shifting it
72d0: 61 72 6f 75 6e 64 20 69 6e 20 74 68 65 0a 09 20 around in the..
72e0: 20 20 20 23 20 63 6f 6d 6d 69 74 20 6f 72 64 65 # commit orde
72f0: 72 2e 20 54 68 65 20 62 61 63 6b 65 6e 64 20 77 r. The backend w
7300: 6f 75 6c 64 20 73 74 69 6c 6c 20 75 73 65 20 74 ould still use t
7310: 68 65 20 70 72 65 66 65 72 65 64 0a 09 20 20 20 he prefered..
7320: 20 23 20 70 61 72 65 6e 74 20 66 6f 72 20 74 68 # parent for th
7330: 65 20 61 74 74 61 63 68 6d 65 6e 74 20 70 6f 69 e attachment poi
7340: 6e 74 20 69 6e 20 66 6f 73 73 69 6c 2e 0a 0a 09 nt in fossil....
7350: 20 20 20 20 23 20 53 6f 2c 20 66 6f 72 20 6e 6f # So, for no
7360: 77 20 49 20 68 61 76 65 20 64 65 63 69 64 65 64 w I have decided
7370: 20 74 6f 20 64 69 73 61 62 6c 65 20 74 68 69 73 to disable this
7380: 20 61 6e 64 20 70 72 65 73 73 0a 09 20 20 20 20 and press..
7390: 23 20 66 6f 72 77 61 72 64 2e 20 4f 66 20 63 6f # forward. Of co
73a0: 75 72 73 65 2c 20 69 66 20 77 65 20 72 75 6e 20 urse, if we run
73b0: 69 6e 74 6f 20 61 63 74 75 61 6c 20 74 72 6f 75 into actual trou
73c0: 62 6c 65 20 77 65 0a 09 20 20 20 20 23 20 77 69 ble we.. # wi
73d0: 6c 6c 20 68 61 76 65 20 74 6f 20 67 6f 20 62 61 ll have to go ba
73e0: 63 6b 20 68 65 72 65 20 73 65 65 20 77 68 61 74 ck here see what
73f0: 20 63 61 6e 20 62 65 20 64 6f 6e 65 20 74 6f 20 can be done to
7400: 66 69 78 0a 09 20 20 20 20 23 20 74 68 69 73 2e fix.. # this.
7410: 20 45 76 65 6e 20 69 66 20 6f 6e 6c 79 20 67 69 Even if only gi
7420: 76 69 6e 67 20 74 68 65 20 75 73 65 72 20 74 68 ving the user th
7430: 65 20 69 6e 73 74 72 75 63 74 69 6f 6e 20 68 6f e instruction ho
7440: 77 0a 09 20 20 20 20 23 20 74 6f 20 65 64 69 74 w.. # to edit
7450: 20 74 68 65 20 43 56 53 20 72 65 70 6f 73 69 74 the CVS reposit
7460: 6f 72 79 20 74 6f 20 72 65 6d 6f 76 65 20 74 68 ory to remove th
7470: 65 20 69 6e 63 6f 6e 73 69 73 74 65 6e 63 79 2e e inconsistency.
7480: 0a 0a 09 20 20 20 20 23 20 41 6c 6c 20 62 72 61 ... # All bra
7490: 6e 63 68 65 73 20 68 61 76 65 20 74 6f 20 61 67 nches have to ag
74a0: 72 65 65 20 6f 6e 20 74 68 65 20 4c 4f 44 20 74 ree on the LOD t
74b0: 68 65 69 72 20 63 68 61 6e 67 65 73 65 74 0a 09 heir changeset..
74c0: 20 20 20 20 23 20 62 65 6c 6f 6e 67 73 20 74 6f # belongs to
74d0: 2e 20 49 6e 20 6f 74 68 65 72 20 77 6f 72 64 73 . In other words
74e0: 2c 20 61 6c 6c 20 62 72 61 6e 63 68 65 73 20 69 , all branches i
74f0: 6e 20 61 20 63 68 61 6e 67 65 73 65 74 0a 09 20 n a changeset..
7500: 20 20 20 23 20 68 61 76 65 20 74 6f 20 72 65 66 # have to ref
7510: 65 72 20 74 6f 20 74 68 65 20 73 61 6d 65 20 6c er to the same l
7520: 69 6e 65 20 6f 66 20 64 65 76 65 6c 6f 70 6d 65 ine of developme
7530: 6e 74 2e 0a 09 20 20 20 20 23 0a 09 20 20 20 20 nt... #..
7540: 23 20 49 6e 73 74 65 61 64 20 6f 66 20 6c 6f 6f # Instead of loo
7550: 6b 69 6e 67 20 61 74 20 61 6c 6c 20 70 61 69 72 king at all pair
7560: 73 20 6f 66 20 62 72 61 6e 63 68 65 73 20 69 6e s of branches in
7570: 20 61 6c 6c 0a 09 20 20 20 20 23 20 63 68 61 6e all.. # chan
7580: 67 65 73 65 74 73 20 77 65 20 67 65 6e 65 72 61 gesets we genera
7590: 74 65 20 74 68 65 20 64 69 73 74 69 6e 63 74 20 te the distinct
75a0: 73 65 74 20 6f 66 20 61 6c 6c 20 4c 4f 44 73 0a set of all LODs.
75b0: 09 20 20 20 20 23 20 72 65 66 65 72 65 6e 63 65 . # reference
75c0: 64 20 62 79 20 74 68 65 20 62 72 61 6e 63 68 65 d by the branche
75d0: 73 20 6f 66 20 61 20 63 68 61 6e 67 65 73 65 74 s of a changeset
75e0: 2c 20 6c 6f 6f 6b 20 66 6f 72 0a 09 20 20 20 20 , look for..
75f0: 23 20 74 68 6f 73 65 20 77 69 74 68 20 63 61 72 # those with car
7600: 64 69 6e 61 6c 69 74 79 20 3e 20 31 2c 20 61 6e dinality > 1, an
7610: 64 20 67 65 74 20 74 68 65 20 69 64 65 6e 74 69 d get the identi
7620: 66 79 69 6e 67 0a 09 20 20 20 20 23 20 69 6e 66 fying.. # inf
7630: 6f 72 6d 61 74 69 6f 6e 20 66 6f 72 20 74 68 65 ormation for the
7640: 20 63 68 61 6e 67 65 73 65 74 73 20 66 6f 75 6e changesets foun
7650: 64 20 74 68 75 73 6c 79 2e 0a 09 20 20 20 20 43 d thusly... C
7660: 68 65 63 6b 43 53 20 5c 0a 09 09 7b 41 6c 6c 20 heckCS \...{All
7670: 62 72 61 6e 63 68 65 73 20 69 6e 20 61 20 63 68 branches in a ch
7680: 61 6e 67 65 73 65 74 20 68 61 76 65 20 74 6f 20 angeset have to
7690: 62 65 6c 6f 6e 67 20 74 6f 20 74 68 65 20 73 61 belong to the sa
76a0: 6d 65 20 4c 4f 44 7d 20 5c 0a 09 09 7b 3a 20 49 me LOD} \...{: I
76b0: 74 73 20 62 72 61 6e 63 68 65 73 20 64 69 73 61 ts branches disa
76c0: 67 72 65 65 20 61 62 6f 75 74 20 74 68 65 20 4c gree about the L
76d0: 4f 44 20 74 68 65 79 20 62 65 6c 6f 6e 67 20 74 OD they belong t
76e0: 6f 7d 20 7b 0a 09 09 20 20 20 20 53 45 4c 45 43 o} {... SELEC
76f0: 54 20 54 2e 6e 61 6d 65 2c 20 43 2e 63 69 64 0a T T.name, C.cid.
7700: 09 09 20 20 20 20 46 52 4f 4d 20 20 20 63 68 61 .. FROM cha
7710: 6e 67 65 73 65 74 20 43 2c 20 63 73 74 79 70 65 ngeset C, cstype
7720: 20 54 0a 09 09 20 20 20 20 57 48 45 52 45 20 20 T... WHERE
7730: 43 2e 63 69 64 20 49 4e 20 28 53 45 4c 45 43 54 C.cid IN (SELECT
7740: 20 55 2e 63 69 64 0a 09 09 09 09 20 20 20 20 20 U.cid.....
7750: 46 52 4f 4d 20 28 53 45 4c 45 43 54 20 44 49 53 FROM (SELECT DIS
7760: 54 49 4e 43 54 20 43 49 2e 63 69 64 20 41 53 20 TINCT CI.cid AS
7770: 63 69 64 2c 20 42 2e 6c 6f 64 20 41 53 20 6c 6f cid, B.lod AS lo
7780: 64 0a 09 09 09 09 09 20 20 20 46 52 4f 4d 20 20 d...... FROM
7790: 20 63 73 69 74 65 6d 20 43 49 2c 20 63 68 61 6e csitem CI, chan
77a0: 67 65 73 65 74 20 43 2c 20 62 72 61 6e 63 68 20 geset C, branch
77b0: 42 0a 09 09 09 09 09 20 20 20 57 48 45 52 45 20 B...... WHERE
77c0: 20 43 49 2e 69 69 64 20 3d 20 42 2e 62 69 64 0a CI.iid = B.bid.
77d0: 09 09 09 09 09 20 20 20 41 4e 44 20 20 20 20 43 ..... AND C
77e0: 2e 63 69 64 20 3d 20 43 49 2e 63 69 64 0a 09 09 .cid = CI.cid...
77f0: 09 09 09 20 20 20 41 4e 44 20 20 20 20 43 2e 74 ... AND C.t
7800: 79 70 65 20 3d 20 32 29 20 41 53 20 55 0a 09 09 ype = 2) AS U...
7810: 09 09 20 20 20 20 20 47 52 4f 55 50 20 42 59 20 .. GROUP BY
7820: 55 2e 63 69 64 20 48 41 56 49 4e 47 20 43 4f 55 U.cid HAVING COU
7830: 4e 54 28 55 2e 6c 6f 64 29 20 3e 20 31 29 0a 09 NT(U.lod) > 1)..
7840: 09 20 20 20 20 41 4e 44 20 20 20 20 54 2e 74 69 . AND T.ti
7850: 64 20 3d 20 43 2e 74 79 70 65 0a 09 09 7d 0a 09 d = C.type...}..
7860: 7d 0a 09 23 20 41 6c 6c 20 62 72 61 6e 63 68 65 }..# All branche
7870: 73 20 68 61 76 65 20 74 6f 20 61 67 72 65 65 20 s have to agree
7880: 6f 6e 20 74 68 65 20 70 72 6f 6a 65 63 74 20 74 on the project t
7890: 68 65 69 72 20 63 68 61 6e 67 65 73 65 74 0a 09 heir changeset..
78a0: 23 20 62 65 6c 6f 6e 67 73 20 74 6f 2e 20 49 6e # belongs to. In
78b0: 20 6f 74 68 65 72 20 77 6f 72 64 73 2c 20 61 6c other words, al
78c0: 6c 20 62 72 61 6e 63 68 65 73 20 69 6e 20 61 20 l branches in a
78d0: 63 68 61 6e 67 65 73 65 74 20 68 61 76 65 0a 09 changeset have..
78e0: 23 20 74 6f 20 72 65 66 65 72 20 74 6f 20 74 68 # to refer to th
78f0: 65 20 73 61 6d 65 20 70 72 6f 6a 65 63 74 2e 0a e same project..
7900: 09 23 0a 09 23 20 49 6e 73 74 65 61 64 20 6f 66 .#..# Instead of
7910: 20 6c 6f 6f 6b 69 6e 67 20 61 74 20 61 6c 6c 20 looking at all
7920: 70 61 69 72 73 20 6f 66 20 62 72 61 6e 63 68 65 pairs of branche
7930: 73 20 69 6e 20 61 6c 6c 0a 09 23 20 63 68 61 6e s in all..# chan
7940: 67 65 73 65 74 73 20 77 65 20 67 65 6e 65 72 61 gesets we genera
7950: 74 65 20 74 68 65 20 64 69 73 74 69 6e 63 74 20 te the distinct
7960: 73 65 74 20 6f 66 20 61 6c 6c 20 70 72 6f 6a 65 set of all proje
7970: 63 74 73 0a 09 23 20 72 65 66 65 72 65 6e 63 65 cts..# reference
7980: 64 20 62 79 20 74 68 65 20 62 72 61 6e 63 68 65 d by the branche
7990: 73 20 6f 66 20 61 20 63 68 61 6e 67 65 73 65 74 s of a changeset
79a0: 2c 20 6c 6f 6f 6b 20 66 6f 72 20 74 68 6f 73 65 , look for those
79b0: 0a 09 23 20 77 69 74 68 20 63 61 72 64 69 6e 61 ..# with cardina
79c0: 6c 69 74 79 20 3e 20 31 2c 20 61 6e 64 20 67 65 lity > 1, and ge
79d0: 74 20 74 68 65 20 69 64 65 6e 74 69 66 79 69 6e t the identifyin
79e0: 67 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 0a 09 23 g information..#
79f0: 20 66 6f 72 20 74 68 65 20 63 68 61 6e 67 65 73 for the changes
7a00: 65 74 73 20 66 6f 75 6e 64 20 74 68 75 73 6c 79 ets found thusly
7a10: 2e 0a 09 43 68 65 63 6b 43 53 20 5c 0a 09 20 20 ...CheckCS \..
7a20: 20 20 7b 41 6c 6c 20 62 72 61 6e 63 68 65 73 20 {All branches
7a30: 69 6e 20 61 20 63 68 61 6e 67 65 73 65 74 20 68 in a changeset h
7a40: 61 76 65 20 74 6f 20 62 65 6c 6f 6e 67 20 74 6f ave to belong to
7a50: 20 74 68 65 20 73 61 6d 65 20 70 72 6f 6a 65 63 the same projec
7a60: 74 7d 20 5c 0a 09 20 20 20 20 7b 3a 20 49 74 73 t} \.. {: Its
7a70: 20 62 72 61 6e 63 68 65 73 20 64 69 73 61 67 72 branches disagr
7a80: 65 65 20 61 62 6f 75 74 20 74 68 65 20 70 72 6f ee about the pro
7a90: 6a 65 63 74 20 74 68 65 79 20 62 65 6c 6f 6e 67 ject they belong
7aa0: 20 74 6f 7d 20 7b 0a 09 09 53 45 4c 45 43 54 20 to} {...SELECT
7ab0: 54 2e 6e 61 6d 65 2c 20 43 2e 63 69 64 0a 09 09 T.name, C.cid...
7ac0: 46 52 4f 4d 20 20 20 63 68 61 6e 67 65 73 65 74 FROM changeset
7ad0: 20 43 2c 20 63 73 74 79 70 65 20 54 0a 09 09 57 C, cstype T...W
7ae0: 48 45 52 45 20 20 43 2e 63 69 64 20 49 4e 20 28 HERE C.cid IN (
7af0: 53 45 4c 45 43 54 20 55 2e 63 69 64 0a 09 09 09 SELECT U.cid....
7b00: 09 20 46 52 4f 4d 20 28 53 45 4c 45 43 54 20 44 . FROM (SELECT D
7b10: 49 53 54 49 4e 43 54 20 20 20 20 20 20 20 20 2d ISTINCT -
7b20: 2d 20 55 6e 69 71 75 65 20 63 73 65 74 2f 70 72 - Unique cset/pr
7b30: 6f 6a 20 70 61 69 72 73 0a 09 09 09 09 20 20 20 oj pairs.....
7b40: 20 20 20 20 20 20 20 20 20 20 20 43 49 2e 63 69 CI.ci
7b50: 64 20 41 53 20 63 69 64 2c 20 20 2d 2d 20 42 72 d AS cid, -- Br
7b60: 61 6e 63 68 20 63 73 65 74 0a 09 09 09 09 20 20 anch cset.....
7b70: 20 20 20 20 20 20 20 20 20 20 20 20 46 2e 70 69 F.pi
7b80: 64 20 20 41 53 20 70 69 64 20 20 20 2d 2d 20 50 d AS pid -- P
7b90: 72 6f 6a 65 63 74 20 6f 66 20 69 74 65 6d 20 69 roject of item i
7ba0: 6e 20 63 73 65 74 0a 09 09 09 09 20 20 20 20 20 n cset.....
7bb0: 20 20 46 52 4f 4d 20 20 20 63 73 69 74 65 6d 20 FROM csitem
7bc0: 43 49 2c 20 63 68 61 6e 67 65 73 65 74 20 43 2c CI, changeset C,
7bd0: 20 62 72 61 6e 63 68 20 42 2c 20 66 69 6c 65 20 branch B, file
7be0: 46 0a 09 09 09 09 20 20 20 20 20 20 20 57 48 45 F..... WHE
7bf0: 52 45 20 20 43 49 2e 69 69 64 20 3d 20 42 2e 62 RE CI.iid = B.b
7c00: 69 64 20 20 2d 2d 20 67 65 74 20 62 72 61 6e 63 id -- get branc
7c10: 68 20 6f 66 20 69 74 65 6d 20 69 6e 20 63 73 65 h of item in cse
7c20: 74 0a 09 09 09 09 20 20 20 20 20 20 20 41 4e 44 t..... AND
7c30: 20 20 20 20 43 2e 63 69 64 20 20 3d 20 43 49 2e C.cid = CI.
7c40: 63 69 64 20 2d 2d 20 67 65 74 20 63 68 61 6e 67 cid -- get chang
7c50: 65 73 65 74 20 6f 66 20 69 74 65 6d 0a 09 09 09 eset of item....
7c60: 09 20 20 20 20 20 20 20 41 4e 44 20 20 20 20 43 . AND C
7c70: 2e 74 79 70 65 20 3d 20 32 20 20 20 20 20 20 2d .type = 2 -
7c80: 2d 20 6c 69 6d 69 74 20 74 6f 20 62 72 61 6e 63 - limit to branc
7c90: 68 20 63 68 61 6e 67 65 73 65 74 73 0a 09 09 09 h changesets....
7ca0: 09 20 20 20 20 20 20 20 41 4e 44 20 20 20 20 46 . AND F
7cb0: 2e 66 69 64 20 20 3d 20 42 2e 66 69 64 20 20 2d .fid = B.fid -
7cc0: 2d 20 67 65 74 20 66 69 6c 65 20 6f 66 20 62 72 - get file of br
7cd0: 61 6e 63 68 0a 20 20 20 20 20 20 20 20 20 20 20 anch.
7ce0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
7cf0: 20 20 20 20 20 20 20 20 20 20 20 29 20 41 53 20 ) AS
7d00: 55 0a 09 09 09 09 20 47 52 4f 55 50 20 42 59 20 U..... GROUP BY
7d10: 55 2e 63 69 64 20 20 20 20 20 20 20 20 20 20 2d U.cid -
7d20: 2d 20 61 67 67 72 65 67 61 74 65 20 62 79 20 63 - aggregate by c
7d30: 73 65 74 73 2c 20 63 6f 75 6e 74 20 70 72 6f 6a sets, count proj
7d40: 2f 63 73 65 74 0a 09 09 09 09 20 48 41 56 49 4e /cset..... HAVIN
7d50: 47 20 43 4f 55 4e 54 28 55 2e 70 69 64 29 20 3e G COUNT(U.pid) >
7d60: 20 31 20 2d 2d 20 66 69 6e 64 20 63 73 65 74 20 1 -- find cset
7d70: 77 69 74 68 20 6d 75 6c 74 69 70 6c 65 20 70 72 with multiple pr
7d80: 6f 6a 65 63 74 73 0a 09 09 09 09 29 0a 09 09 41 ojects.....)...A
7d90: 4e 44 20 20 20 20 54 2e 74 69 64 20 3d 20 43 2e ND T.tid = C.
7da0: 74 79 70 65 20 2d 2d 20 67 65 74 20 72 65 61 64 type -- get read
7db0: 61 62 6c 65 20 63 68 61 6e 67 65 73 65 74 20 74 able changeset t
7dc0: 79 70 65 0a 09 20 20 20 20 7d 0a 09 23 20 41 6c ype.. }..# Al
7dd0: 6c 20 62 72 61 6e 63 68 65 73 20 69 6e 20 61 20 l branches in a
7de0: 73 69 6e 67 6c 65 20 63 68 61 6e 67 65 73 65 74 single changeset
7df0: 20 68 61 76 65 20 74 6f 20 62 65 6c 6f 6e 67 20 have to belong
7e00: 74 6f 0a 09 23 20 64 69 66 66 65 72 65 6e 74 20 to..# different
7e10: 66 69 6c 65 73 2e 20 43 6f 6e 76 65 72 73 65 6c files. Conversel
7e20: 79 3a 20 4e 6f 20 74 77 6f 20 62 72 61 6e 63 68 y: No two branch
7e30: 65 73 20 6f 66 20 61 20 73 69 6e 67 6c 65 0a 09 es of a single..
7e40: 23 20 66 69 6c 65 20 61 72 65 20 61 6c 6c 6f 77 # file are allow
7e50: 65 64 20 74 6f 20 62 65 20 69 6e 20 74 68 65 20 ed to be in the
7e60: 73 61 6d 65 20 63 68 61 6e 67 65 73 65 74 2e 0a same changeset..
7e70: 09 23 0a 09 23 20 49 6e 73 74 65 61 64 20 6f 66 .#..# Instead of
7e80: 20 6c 6f 6f 6b 69 6e 67 20 61 74 20 61 6c 6c 20 looking at all
7e90: 70 61 69 72 73 20 6f 66 20 62 72 61 6e 63 68 65 pairs of branche
7ea0: 73 20 69 6e 20 61 6c 6c 0a 09 23 20 63 68 61 6e s in all..# chan
7eb0: 67 65 73 65 74 73 20 77 65 20 67 65 6e 65 72 61 gesets we genera
7ec0: 74 65 20 74 68 65 20 64 69 73 74 69 6e 63 74 20 te the distinct
7ed0: 73 65 74 20 6f 66 20 61 6c 6c 20 66 69 6c 65 73 set of all files
7ee0: 0a 09 23 20 72 65 66 65 72 65 6e 63 65 64 20 62 ..# referenced b
7ef0: 79 20 74 68 65 20 62 72 61 6e 63 68 65 73 20 6f y the branches o
7f00: 66 20 61 20 63 68 61 6e 67 65 73 65 74 2c 20 61 f a changeset, a
7f10: 6e 64 20 6c 6f 6f 6b 20 66 6f 72 0a 09 23 20 74 nd look for..# t
7f20: 68 6f 73 65 20 77 69 74 68 20 63 61 72 64 69 6e hose with cardin
7f30: 61 6c 69 74 79 20 3c 20 74 68 65 20 63 61 72 64 ality < the card
7f40: 69 6e 61 6c 69 74 79 20 6f 66 20 74 68 65 20 73 inality of the s
7f50: 65 74 20 6f 66 0a 09 23 20 62 72 61 6e 63 68 65 et of..# branche
7f60: 73 2c 20 61 6e 64 20 67 65 74 20 74 68 65 20 69 s, and get the i
7f70: 64 65 6e 74 69 66 79 69 6e 67 20 69 6e 66 6f 72 dentifying infor
7f80: 6d 61 74 69 6f 6e 20 66 6f 72 20 74 68 65 0a 09 mation for the..
7f90: 23 20 63 68 61 6e 67 65 73 65 74 73 20 66 6f 75 # changesets fou
7fa0: 6e 64 20 74 68 75 73 6c 79 2e 0a 09 43 68 65 63 nd thusly...Chec
7fb0: 6b 43 53 20 5c 0a 09 20 20 20 20 7b 41 6c 6c 20 kCS \.. {All
7fc0: 62 72 61 6e 63 68 65 73 20 69 6e 20 61 20 63 68 branches in a ch
7fd0: 61 6e 67 65 73 65 74 20 68 61 76 65 20 74 6f 20 angeset have to
7fe0: 62 65 6c 6f 6e 67 20 74 6f 20 64 69 66 66 65 72 belong to differ
7ff0: 65 6e 74 20 66 69 6c 65 73 7d 20 5c 0a 09 20 20 ent files} \..
8000: 20 20 7b 3a 20 49 74 73 20 62 72 61 6e 63 68 65 {: Its branche
8010: 73 20 73 68 61 72 65 20 66 69 6c 65 73 7d 20 7b s share files} {
8020: 0a 09 09 53 45 4c 45 43 54 20 54 2e 6e 61 6d 65 ...SELECT T.name
8030: 2c 20 43 2e 63 69 64 0a 09 09 46 52 4f 4d 20 20 , C.cid...FROM
8040: 20 63 68 61 6e 67 65 73 65 74 20 43 2c 20 63 73 changeset C, cs
8050: 74 79 70 65 20 54 0a 09 09 57 48 45 52 45 20 20 type T...WHERE
8060: 43 2e 63 69 64 20 49 4e 20 28 53 45 4c 45 43 54 C.cid IN (SELECT
8070: 20 56 56 2e 63 69 64 0a 09 09 09 09 20 46 52 4f VV.cid..... FRO
8080: 4d 20 28 53 45 4c 45 43 54 20 55 2e 63 69 64 20 M (SELECT U.cid
8090: 20 20 20 20 20 20 20 20 41 53 20 63 69 64 2c 20 AS cid,
80a0: 20 20 2d 2d 20 63 68 61 6e 67 65 73 65 74 0a 09 -- changeset..
80b0: 09 09 09 20 20 20 20 20 20 20 20 20 20 20 20 20 ...
80c0: 20 43 4f 55 4e 54 20 28 55 2e 66 69 64 29 20 41 COUNT (U.fid) A
80d0: 53 20 66 63 6f 75 6e 74 20 2d 2d 20 6e 75 6d 62 S fcount -- numb
80e0: 65 72 20 6f 66 20 66 69 6c 65 73 20 62 79 20 69 er of files by i
80f0: 74 65 6d 73 0a 09 09 09 09 20 20 20 20 20 20 20 tems.....
8100: 46 52 4f 4d 20 28 53 45 4c 45 43 54 20 44 49 53 FROM (SELECT DIS
8110: 54 49 4e 43 54 20 20 20 20 20 20 20 2d 2d 20 75 TINCT -- u
8120: 6e 69 71 75 65 20 63 73 65 74 2f 66 69 6c 65 20 nique cset/file
8130: 70 61 69 72 73 0a 09 09 09 09 09 20 20 20 20 20 pairs......
8140: 20 20 20 20 20 20 20 43 49 2e 63 69 64 20 41 53 CI.cid AS
8150: 20 63 69 64 2c 20 2d 2d 20 42 72 61 6e 63 68 20 cid, -- Branch
8160: 63 68 61 6e 67 65 73 65 74 0a 09 09 09 09 09 20 changeset......
8170: 20 20 20 20 20 20 20 20 20 20 20 42 2e 66 69 64 B.fid
8180: 20 20 41 53 20 66 69 64 20 20 2d 2d 20 46 69 6c AS fid -- Fil
8190: 65 20 6f 66 20 69 74 65 6d 20 69 6e 20 63 68 61 e of item in cha
81a0: 6e 67 65 73 65 74 0a 09 09 09 09 09 20 20 20 20 ngeset......
81b0: 20 46 52 4f 4d 20 20 20 63 73 69 74 65 6d 20 43 FROM csitem C
81c0: 49 2c 20 63 68 61 6e 67 65 73 65 74 20 43 2c 20 I, changeset C,
81d0: 62 72 61 6e 63 68 20 42 0a 09 09 09 09 09 20 20 branch B......
81e0: 20 20 20 57 48 45 52 45 20 20 43 49 2e 69 69 64 WHERE CI.iid
81f0: 20 3d 20 42 2e 62 69 64 20 20 2d 2d 20 67 65 74 = B.bid -- get
8200: 20 74 61 67 20 6f 66 20 69 74 65 6d 20 69 6e 20 tag of item in
8210: 63 68 61 6e 67 65 73 65 74 0a 09 09 09 09 09 20 changeset......
8220: 20 20 20 20 41 4e 44 20 20 20 20 43 2e 63 69 64 AND C.cid
8230: 20 20 3d 20 43 49 2e 63 69 64 20 2d 2d 20 67 65 = CI.cid -- ge
8240: 74 20 63 68 61 6e 67 65 73 65 74 20 6f 66 20 69 t changeset of i
8250: 74 65 6d 0a 09 09 09 09 09 20 20 20 20 20 41 4e tem...... AN
8260: 44 20 20 20 20 43 2e 74 79 70 65 20 3d 20 32 20 D C.type = 2
8270: 20 20 20 20 20 2d 2d 20 6c 69 6d 69 74 20 74 6f -- limit to
8280: 20 62 72 61 6e 63 68 20 63 68 61 6e 67 65 73 65 branch changese
8290: 74 73 0a 09 09 09 09 09 20 20 20 20 20 29 20 41 ts...... ) A
82a0: 53 20 55 0a 09 09 09 09 20 20 20 20 20 20 20 47 S U..... G
82b0: 52 4f 55 50 20 42 59 20 55 2e 63 69 64 20 2d 2d ROUP BY U.cid --
82c0: 20 61 67 67 72 65 67 61 74 65 20 62 79 20 63 73 aggregate by cs
82d0: 65 74 73 2c 20 63 6f 75 6e 74 20 66 69 6c 65 73 ets, count files
82e0: 2f 63 73 65 74 0a 09 09 09 09 20 20 20 20 20 20 /cset.....
82f0: 29 20 41 53 20 55 55 2c 0a 09 09 09 09 20 20 20 ) AS UU,.....
8300: 20 20 20 28 53 45 4c 45 43 54 20 56 2e 63 69 64 (SELECT V.cid
8310: 20 20 20 20 20 20 20 20 20 41 53 20 63 69 64 2c AS cid,
8320: 20 20 20 2d 2d 20 63 68 61 6e 67 65 73 65 74 0a -- changeset.
8330: 09 09 09 09 20 20 20 20 20 20 20 20 20 20 20 20 ....
8340: 20 20 43 4f 55 4e 54 20 28 56 2e 69 69 64 29 20 COUNT (V.iid)
8350: 41 53 20 72 63 6f 75 6e 74 20 2d 2d 20 6e 75 6d AS rcount -- num
8360: 62 65 72 20 6f 66 20 69 74 65 6d 73 20 69 6e 20 ber of items in
8370: 63 73 65 74 0a 09 09 09 09 20 20 20 20 20 20 20 cset.....
8380: 46 52 4f 4d 20 20 20 63 73 69 74 65 6d 20 56 2c FROM csitem V,
8390: 20 63 68 61 6e 67 65 73 65 74 20 58 0a 09 09 09 changeset X....
83a0: 09 20 20 20 20 20 20 20 57 48 45 52 45 20 20 58 . WHERE X
83b0: 2e 63 69 64 20 20 3d 20 56 2e 63 69 64 20 2d 2d .cid = V.cid --
83c0: 20 67 65 74 20 63 68 61 6e 67 65 73 65 74 20 6f get changeset o
83d0: 66 20 69 74 65 6d 0a 09 09 09 09 20 20 20 20 20 f item.....
83e0: 20 20 41 4e 44 20 20 20 20 58 2e 74 79 70 65 20 AND X.type
83f0: 3d 20 32 20 20 20 20 20 2d 2d 20 6c 69 6d 69 74 = 2 -- limit
8400: 20 74 6f 20 62 72 61 6e 63 68 20 63 68 61 6e 67 to branch chang
8410: 65 73 65 74 73 0a 09 09 09 09 20 20 20 20 20 20 esets.....
8420: 20 47 52 4f 55 50 20 42 59 20 56 2e 63 69 64 09 GROUP BY V.cid.
8430: 20 20 20 20 20 2d 2d 20 61 67 67 72 65 67 61 74 -- aggregat
8440: 65 20 62 79 20 63 73 65 74 73 2c 20 63 6f 75 6e e by csets, coun
8450: 74 20 69 74 65 6d 73 2f 63 73 65 74 0a 09 09 09 t items/cset....
8460: 09 20 20 20 20 20 20 29 20 41 53 20 56 56 0a 09 . ) AS VV..
8470: 09 09 09 20 57 48 45 52 45 20 56 56 2e 63 69 64 ... WHERE VV.cid
8480: 20 3d 20 55 55 2e 63 69 64 20 20 20 20 20 20 20 = UU.cid
8490: 2d 2d 20 73 79 6e 63 20 23 69 74 65 6d 73 2f 63 -- sync #items/c
84a0: 73 65 74 20 77 69 74 68 20 23 66 69 6c 65 73 2f set with #files/
84b0: 63 73 65 74 0a 09 09 09 09 20 41 4e 44 20 20 20 cset..... AND
84c0: 55 55 2e 66 63 6f 75 6e 74 20 3c 20 56 56 2e 72 UU.fcount < VV.r
84d0: 63 6f 75 6e 74 20 2d 2d 20 6c 65 73 73 20 66 69 count -- less fi
84e0: 6c 65 73 20 74 68 61 6e 20 69 74 65 6d 73 0a 09 les than items..
84f0: 09 09 09 09 09 09 20 20 20 20 20 2d 2d 20 3d 3e ...... -- =>
8500: 20 69 74 65 6d 73 20 62 65 6c 6f 6e 67 20 74 6f items belong to
8510: 20 74 68 65 20 73 61 6d 65 20 66 69 6c 65 2e 0a the same file..
8520: 09 09 09 09 29 0a 09 09 41 4e 44 20 20 20 20 54 ....)...AND T
8530: 2e 74 69 64 20 3d 20 43 2e 74 79 70 65 20 2d 2d .tid = C.type --
8540: 20 67 65 74 20 72 65 61 64 61 62 6c 65 20 63 68 get readable ch
8550: 61 6e 67 65 73 65 74 20 74 79 70 65 0a 09 20 20 angeset type..
8560: 20 20 7d 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 }..return.
8570: 7d 0a 0a 20 20 20 20 70 72 6f 63 20 5f 5f 5f 55 }.. proc ___U
8580: 6e 75 73 65 64 43 68 61 6e 67 65 73 65 74 43 68 nusedChangesetCh
8590: 65 63 6b 73 5f 5f 5f 20 7b 7d 20 7b 0a 09 23 20 ecks___ {} {..#
85a0: 54 68 69 73 20 63 6f 64 65 20 70 65 72 66 6f 72 This code perfor
85b0: 6d 73 20 61 20 6e 75 6d 62 65 72 20 6f 66 20 70 ms a number of p
85c0: 61 72 61 6e 6f 69 64 20 63 68 65 63 6b 73 20 6f aranoid checks o
85d0: 66 20 74 68 65 0a 09 23 20 64 61 74 61 62 61 73 f the..# databas
85e0: 65 2c 20 73 65 61 72 63 68 69 6e 67 20 66 6f 72 e, searching for
85f0: 20 69 6e 63 6f 6e 73 69 73 74 65 6e 74 20 63 68 inconsistent ch
8600: 61 6e 67 65 73 65 74 2f 72 65 76 69 73 69 6f 6e angeset/revision
8610: 0a 09 23 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 2e ..# information.
8620: 0a 0a 09 72 65 74 75 72 6e 20 3b 20 23 20 44 69 ...return ; # Di
8630: 73 61 62 6c 65 64 20 66 6f 72 20 6e 6f 77 2c 20 sabled for now,
8640: 62 6f 74 74 6c 65 6e 65 63 6b 73 20 2e 2e 2e 0a bottlenecks ....
8650: 0a 09 75 70 76 61 72 20 31 20 6e 20 6e 20 3b 20 ..upvar 1 n n ;
8660: 23 20 43 6f 75 6e 74 65 72 20 66 6f 72 20 74 68 # Counter for th
8670: 65 20 63 68 65 63 6b 73 20 28 77 65 20 70 72 69 e checks (we pri
8680: 6e 74 20 61 6e 20 69 64 20 62 65 66 6f 72 65 0a nt an id before.
8690: 09 09 20 20 20 20 20 20 23 20 74 68 65 20 6d 61 .. # the ma
86a0: 69 6e 20 6c 61 62 65 6c 29 2e 0a 0a 09 23 20 54 in label)....# T
86b0: 68 65 20 6e 65 78 74 20 74 77 6f 20 63 68 65 63 he next two chec
86c0: 6b 73 20 61 72 65 20 42 4f 54 54 4c 45 4e 45 43 ks are BOTTLENEC
86d0: 4b 53 2e 20 49 6e 20 65 73 73 65 6e 63 65 20 77 KS. In essence w
86e0: 65 20 61 72 65 0a 09 23 20 63 68 65 63 6b 69 6e e are..# checkin
86f0: 67 20 65 61 63 68 20 73 79 6d 62 6f 6c 20 63 68 g each symbol ch
8700: 61 6e 67 65 73 65 74 20 6f 6e 65 20 62 79 20 6f angeset one by o
8710: 6e 65 2e 0a 0a 09 23 20 54 4f 44 4f 3a 20 54 72 ne....# TODO: Tr
8720: 79 20 74 6f 20 72 65 70 68 72 61 73 65 20 74 68 y to rephrase th
8730: 65 20 63 68 65 63 6b 73 20 74 6f 20 6d 61 6b 65 e checks to make
8740: 20 6d 6f 72 65 20 75 73 65 20 6f 66 0a 09 23 20 more use of..#
8750: 69 6e 64 69 63 65 73 2c 20 73 65 74 20 61 6e 64 indices, set and
8760: 20 73 74 72 65 61 6d 20 6f 70 65 72 61 74 69 6f stream operatio
8770: 6e 73 2e 0a 0a 09 23 20 41 6c 6c 20 72 65 76 69 ns....# All revi
8780: 73 69 6f 6e 73 20 75 73 65 64 20 62 79 20 74 61 sions used by ta
8790: 67 20 73 79 6d 62 6f 6c 20 63 68 61 6e 67 65 73 g symbol changes
87a0: 65 74 73 20 68 61 76 65 20 74 6f 20 68 61 76 65 ets have to have
87b0: 20 74 68 65 0a 09 23 20 63 68 61 6e 67 65 73 65 the..# changese
87c0: 74 27 73 20 74 61 67 20 61 73 73 6f 63 69 61 74 t's tag associat
87d0: 65 64 20 77 69 74 68 20 74 68 65 6d 2e 0a 09 43 ed with them...C
87e0: 68 65 63 6b 52 65 76 43 53 20 5c 0a 09 20 20 20 heckRevCS \..
87f0: 20 7b 41 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 {All revisions
8800: 75 73 65 64 20 62 79 20 74 61 67 20 73 79 6d 62 used by tag symb
8810: 6f 6c 20 63 68 61 6e 67 65 73 65 74 73 20 68 61 ol changesets ha
8820: 76 65 20 74 6f 20 68 61 76 65 20 74 68 65 20 63 ve to have the c
8830: 68 61 6e 67 65 73 65 74 27 73 20 74 61 67 20 61 hangeset's tag a
8840: 74 74 61 63 68 65 64 20 74 6f 20 74 68 65 6d 7d ttached to them}
8850: 20 5c 0a 09 20 20 20 20 7b 64 6f 65 73 20 6e 6f \.. {does no
8860: 74 20 68 61 76 65 20 74 68 65 20 74 61 67 20 6f t have the tag o
8870: 66 20 69 74 73 20 73 79 6d 62 6f 6c 20 63 68 61 f its symbol cha
8880: 6e 67 65 73 65 74 20 40 20 61 74 74 61 63 68 65 ngeset @ attache
8890: 64 20 74 6f 20 69 74 7d 20 7b 0a 09 09 53 45 4c d to it} {...SEL
88a0: 45 43 54 20 43 54 2e 6e 61 6d 65 2c 20 43 2e 63 ECT CT.name, C.c
88b0: 69 64 2c 20 46 2e 6e 61 6d 65 2c 20 52 2e 72 65 id, F.name, R.re
88c0: 76 0a 09 09 46 52 4f 4d 20 20 20 63 68 61 6e 67 v...FROM chang
88d0: 65 73 65 74 20 43 2c 20 63 73 74 79 70 65 20 43 eset C, cstype C
88e0: 54 2c 20 72 65 76 69 73 69 6f 6e 20 52 2c 20 66 T, revision R, f
88f0: 69 6c 65 20 46 2c 20 63 73 69 74 65 6d 20 43 49 ile F, csitem CI
8900: 2c 20 74 61 67 20 54 0a 09 09 57 48 45 52 45 20 , tag T...WHERE
8910: 20 43 2e 74 79 70 65 20 3d 20 31 20 20 20 20 20 C.type = 1
8920: 20 20 2d 2d 20 73 79 6d 62 6f 6c 20 63 68 61 6e -- symbol chan
8930: 67 65 73 65 74 73 20 6f 6e 6c 79 0a 09 09 41 4e gesets only...AN
8940: 44 20 20 20 20 43 2e 73 72 63 20 20 3d 20 54 2e D C.src = T.
8950: 73 69 64 20 20 20 2d 2d 20 74 61 67 20 6f 6e 6c sid -- tag onl
8960: 79 2c 20 6c 69 6e 6b 65 64 20 62 79 20 73 79 6d y, linked by sym
8970: 62 6f 6c 20 69 64 0a 09 09 41 4e 44 20 20 20 20 bol id...AND
8980: 43 2e 63 69 64 20 20 3d 20 43 49 2e 63 69 64 20 C.cid = CI.cid
8990: 20 2d 2d 20 63 68 61 6e 67 65 73 65 74 20 2d 2d -- changeset --
89a0: 3e 20 69 74 73 20 72 65 76 69 73 69 6f 6e 73 0a > its revisions.
89b0: 09 09 41 4e 44 20 20 20 20 52 2e 72 69 64 20 20 ..AND R.rid
89c0: 3d 20 43 49 2e 69 69 64 20 20 2d 2d 20 6c 6f 6f = CI.iid -- loo
89d0: 6b 20 61 74 20 74 68 65 20 72 65 76 69 73 69 6f k at the revisio
89e0: 6e 73 0a 09 09 2d 2d 20 61 6e 64 20 6c 6f 6f 6b ns...-- and look
89f0: 20 66 6f 72 20 74 68 65 20 74 61 67 20 61 6d 6f for the tag amo
8a00: 6e 67 20 74 68 65 20 61 74 74 61 63 68 65 64 20 ng the attached
8a10: 6f 6e 65 73 2e 0a 09 09 41 4e 44 20 20 20 20 54 ones....AND T
8a20: 2e 73 69 64 20 4e 4f 54 20 49 4e 20 28 53 45 4c .sid NOT IN (SEL
8a30: 45 43 54 20 54 42 2e 73 69 64 0a 09 09 09 09 20 ECT TB.sid.....
8a40: 20 20 20 20 46 52 4f 4d 20 20 20 74 61 67 20 54 FROM tag T
8a50: 42 0a 09 09 09 09 20 20 20 20 20 57 48 45 52 45 B..... WHERE
8a60: 20 20 54 42 2e 72 65 76 20 3d 20 52 2e 72 69 64 TB.rev = R.rid
8a70: 29 0a 09 09 41 4e 44 20 20 20 20 52 2e 66 69 64 )...AND R.fid
8a80: 20 3d 20 46 2e 66 69 64 20 20 20 20 2d 2d 20 67 = F.fid -- g
8a90: 65 74 20 66 69 6c 65 20 6f 66 20 72 65 76 69 73 et file of revis
8aa0: 69 6f 6e 0a 09 20 20 20 20 7d 0a 0a 09 23 20 41 ion.. }...# A
8ab0: 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 75 73 65 ll revisions use
8ac0: 64 20 62 79 20 62 72 61 6e 63 68 20 73 79 6d 62 d by branch symb
8ad0: 6f 6c 20 63 68 61 6e 67 65 73 65 74 73 20 68 61 ol changesets ha
8ae0: 76 65 20 74 6f 20 68 61 76 65 0a 09 23 20 74 68 ve to have..# th
8af0: 65 20 63 68 61 6e 67 65 73 65 74 27 73 20 62 72 e changeset's br
8b00: 61 6e 63 68 20 61 73 73 6f 63 69 61 74 65 64 20 anch associated
8b10: 77 69 74 68 20 74 68 65 6d 2e 0a 0a 09 43 68 65 with them....Che
8b20: 63 6b 52 65 76 43 53 20 5c 0a 09 20 20 20 20 7b ckRevCS \.. {
8b30: 41 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 75 73 All revisions us
8b40: 65 64 20 62 79 20 62 72 61 6e 63 68 20 73 79 6d ed by branch sym
8b50: 62 6f 6c 20 63 68 61 6e 67 65 73 65 74 73 20 68 bol changesets h
8b60: 61 76 65 20 74 6f 20 68 61 76 65 20 74 68 65 20 ave to have the
8b70: 63 68 61 6e 67 65 73 65 74 27 73 20 62 72 61 6e changeset's bran
8b80: 63 68 20 61 74 74 61 63 68 65 64 20 74 6f 20 74 ch attached to t
8b90: 68 65 6d 7d 20 5c 0a 09 20 20 20 20 7b 64 6f 65 hem} \.. {doe
8ba0: 73 20 6e 6f 74 20 68 61 76 65 20 74 68 65 20 62 s not have the b
8bb0: 72 61 6e 63 68 20 6f 66 20 69 74 73 20 73 79 6d ranch of its sym
8bc0: 62 6f 6c 20 63 68 61 6e 67 65 73 65 74 20 40 20 bol changeset @
8bd0: 61 74 74 61 63 68 65 64 20 74 6f 20 69 74 7d 20 attached to it}
8be0: 7b 0a 09 09 53 45 4c 45 43 54 20 43 54 2e 6e 61 {...SELECT CT.na
8bf0: 6d 65 2c 20 43 2e 63 69 64 2c 20 46 2e 6e 61 6d me, C.cid, F.nam
8c00: 65 2c 20 52 2e 72 65 76 2c 20 43 2e 63 69 64 0a e, R.rev, C.cid.
8c10: 09 09 46 52 4f 4d 20 20 20 63 68 61 6e 67 65 73 ..FROM changes
8c20: 65 74 20 43 2c 20 63 73 74 79 70 65 20 43 54 2c et C, cstype CT,
8c30: 20 72 65 76 69 73 69 6f 6e 20 52 2c 20 66 69 6c revision R, fil
8c40: 65 20 46 2c 20 63 73 69 74 65 6d 20 43 49 2c 20 e F, csitem CI,
8c50: 62 72 61 6e 63 68 20 42 0a 09 09 57 48 45 52 45 branch B...WHERE
8c60: 20 20 43 2e 74 79 70 65 20 3d 20 31 20 20 20 20 C.type = 1
8c70: 20 20 20 2d 2d 20 73 79 6d 62 6f 6c 20 63 68 61 -- symbol cha
8c80: 6e 67 65 73 65 74 73 20 6f 6e 6c 79 0a 09 09 41 ngesets only...A
8c90: 4e 44 20 20 20 20 43 2e 73 72 63 20 20 3d 20 42 ND C.src = B
8ca0: 2e 73 69 64 20 20 20 2d 2d 20 62 72 61 6e 63 68 .sid -- branch
8cb0: 65 73 20 6f 6e 6c 79 0a 09 09 41 4e 44 20 20 20 es only...AND
8cc0: 20 43 2e 63 69 64 20 20 3d 20 43 49 2e 63 69 64 C.cid = CI.cid
8cd0: 20 20 2d 2d 20 63 68 61 6e 67 65 73 65 74 20 2d -- changeset -
8ce0: 2d 3e 20 69 74 73 20 72 65 76 69 73 69 6f 6e 73 -> its revisions
8cf0: 0a 09 09 41 4e 44 20 20 20 20 52 2e 72 69 64 20 ...AND R.rid
8d00: 20 3d 20 43 49 2e 69 69 64 20 20 2d 2d 20 6c 6f = CI.iid -- lo
8d10: 6f 6b 20 61 74 20 74 68 65 20 72 65 76 69 73 69 ok at the revisi
8d20: 6f 6e 73 0a 09 09 2d 2d 20 61 6e 64 20 6c 6f 6f ons...-- and loo
8d30: 6b 20 66 6f 72 20 74 68 65 20 62 72 61 6e 63 68 k for the branch
8d40: 20 61 6d 6f 6e 67 20 74 68 65 20 61 74 74 61 63 among the attac
8d50: 68 65 64 20 6f 6e 65 73 2e 0a 09 09 41 4e 44 20 hed ones....AND
8d60: 20 20 20 42 2e 73 69 64 20 4e 4f 54 20 49 4e 20 B.sid NOT IN
8d70: 28 53 45 4c 45 43 54 20 42 42 2e 73 69 64 0a 09 (SELECT BB.sid..
8d80: 09 09 09 20 20 20 20 20 46 52 4f 4d 20 20 20 62 ... FROM b
8d90: 72 61 6e 63 68 20 42 42 0a 09 09 09 09 20 20 20 ranch BB.....
8da0: 20 20 57 48 45 52 45 20 20 42 42 2e 72 6f 6f 74 WHERE BB.root
8db0: 20 3d 20 52 2e 72 69 64 29 0a 09 09 41 4e 44 20 = R.rid)...AND
8dc0: 20 20 20 52 2e 66 69 64 20 3d 20 46 2e 66 69 64 R.fid = F.fid
8dd0: 20 20 20 20 2d 2d 20 67 65 74 20 66 69 6c 65 20 -- get file
8de0: 6f 66 20 72 65 76 69 73 69 6f 6e 0a 09 20 20 20 of revision..
8df0: 20 7d 0a 0a 09 23 20 54 4f 44 4f 0a 09 23 20 54 }...# TODO..# T
8e00: 68 65 20 73 74 61 74 65 20 68 61 73 20 74 6f 20 he state has to
8e10: 63 6f 6e 74 61 69 6e 20 61 74 20 6c 65 61 73 74 contain at least
8e20: 20 6f 6e 65 20 74 61 67 20 73 79 6d 62 6f 6c 20 one tag symbol
8e30: 63 68 61 6e 67 65 73 65 74 0a 09 23 20 66 6f 72 changeset..# for
8e40: 20 61 6c 6c 20 6b 6e 6f 77 6e 20 74 61 67 73 2e all known tags.
8e50: 0a 0a 09 23 20 54 4f 44 4f 0a 09 23 20 54 68 65 ...# TODO..# The
8e60: 20 73 74 61 74 65 20 68 61 73 20 74 6f 20 63 6f state has to co
8e70: 6e 74 61 69 6e 20 61 74 20 6c 65 61 73 74 20 6f ntain at least o
8e80: 6e 65 20 62 72 61 6e 63 68 20 73 79 6d 62 6f 6c ne branch symbol
8e90: 20 63 68 61 6e 67 65 73 65 74 0a 09 23 20 66 6f changeset..# fo
8ea0: 72 20 61 6c 6c 20 6b 6e 6f 77 6e 20 62 72 61 6e r all known bran
8eb0: 63 68 65 73 2e 0a 09 72 65 74 75 72 6e 0a 20 20 ches...return.
8ec0: 20 20 7d 0a 0a 0a 20 20 20 20 70 72 6f 63 20 43 }... proc C
8ed0: 68 65 63 6b 52 65 76 20 7b 68 65 61 64 65 72 20 heckRev {header
8ee0: 6c 61 62 65 6c 20 73 71 6c 7d 20 7b 0a 09 75 70 label sql} {..up
8ef0: 76 61 72 20 31 20 6e 20 6e 0a 09 73 65 74 20 6f var 1 n n..set o
8f00: 6b 20 31 0a 09 66 6f 72 65 61 63 68 20 7b 66 6e k 1..foreach {fn
8f10: 61 6d 65 20 72 65 76 6e 72 7d 20 5b 73 74 61 74 ame revnr} [stat
8f20: 65 20 72 75 6e 20 24 73 71 6c 5d 20 7b 0a 09 20 e run $sql] {..
8f30: 20 20 20 73 65 74 20 6f 6b 20 30 0a 09 20 20 20 set ok 0..
8f40: 20 74 72 6f 75 62 6c 65 20 66 61 74 61 6c 20 22 trouble fatal "
8f50: 24 7b 72 65 76 6e 72 7d 3a 3a 24 66 6e 61 6d 65 ${revnr}::$fname
8f60: 20 24 6c 61 62 65 6c 22 0a 09 7d 0a 09 6c 6f 67 $label"..}..log
8f70: 20 77 72 69 74 65 20 35 20 69 6e 74 65 67 72 69 write 5 integri
8f80: 74 79 20 7b 5c 5b 5b 66 6f 72 6d 61 74 20 25 30 ty {\[[format %0
8f90: 32 64 20 5b 69 6e 63 72 20 6e 5d 5d 5c 5d 20 5b 2d [incr n]]\] [
8fa0: 65 78 70 72 20 7b 24 6f 6b 20 3f 20 22 4f 6b 20 expr {$ok ? "Ok
8fb0: 20 20 20 22 20 3a 20 22 46 61 69 6c 65 64 22 7d " : "Failed"}
8fc0: 5d 20 2e 2e 2e 20 24 68 65 61 64 65 72 7d 0a 09 ] ... $header}..
8fd0: 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 return. }..
8fe0: 20 20 70 72 6f 63 20 43 68 65 63 6b 54 61 67 20 proc CheckTag
8ff0: 7b 68 65 61 64 65 72 20 6c 61 62 65 6c 20 73 71 {header label sq
9000: 6c 7d 20 7b 0a 09 75 70 76 61 72 20 31 20 6e 20 l} {..upvar 1 n
9010: 6e 0a 09 73 65 74 20 6f 6b 20 31 0a 09 66 6f 72 n..set ok 1..for
9020: 65 61 63 68 20 7b 70 6e 61 6d 65 20 73 6e 61 6d each {pname snam
9030: 65 7d 20 5b 73 74 61 74 65 20 72 75 6e 20 24 73 e} [state run $s
9040: 71 6c 5d 20 7b 0a 09 20 20 20 20 73 65 74 20 6f ql] {.. set o
9050: 6b 20 30 0a 09 20 20 20 20 74 72 6f 75 62 6c 65 k 0.. trouble
9060: 20 66 61 74 61 6c 20 22 3c 24 70 6e 61 6d 65 20 fatal "<$pname
9070: 74 61 67 20 27 24 73 6e 61 6d 65 27 3e 20 24 6c tag '$sname'> $l
9080: 61 62 65 6c 22 0a 09 7d 0a 09 6c 6f 67 20 77 72 abel"..}..log wr
9090: 69 74 65 20 35 20 69 6e 74 65 67 72 69 74 79 20 ite 5 integrity
90a0: 7b 5c 5b 5b 66 6f 72 6d 61 74 20 25 30 32 64 20 {\[[format %02d
90b0: 5b 69 6e 63 72 20 6e 5d 5d 5c 5d 20 5b 65 78 70 [incr n]]\] [exp
90c0: 72 20 7b 24 6f 6b 20 3f 20 22 4f 6b 20 20 20 20 r {$ok ? "Ok
90d0: 22 20 3a 20 22 46 61 69 6c 65 64 22 7d 5d 20 2e " : "Failed"}] .
90e0: 2e 2e 20 24 68 65 61 64 65 72 7d 0a 09 72 65 74 .. $header}..ret
90f0: 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 70 urn. }.. p
9100: 72 6f 63 20 43 68 65 63 6b 42 72 61 6e 63 68 20 roc CheckBranch
9110: 7b 68 65 61 64 65 72 20 6c 61 62 65 6c 20 73 71 {header label sq
9120: 6c 7d 20 7b 0a 09 75 70 76 61 72 20 31 20 6e 20 l} {..upvar 1 n
9130: 6e 0a 09 73 65 74 20 6f 6b 20 31 0a 09 66 6f 72 n..set ok 1..for
9140: 65 61 63 68 20 7b 70 6e 61 6d 65 20 73 6e 61 6d each {pname snam
9150: 65 7d 20 5b 73 74 61 74 65 20 72 75 6e 20 24 73 e} [state run $s
9160: 71 6c 5d 20 7b 0a 09 20 20 20 20 73 65 74 20 6f ql] {.. set o
9170: 6b 20 30 0a 09 20 20 20 20 74 72 6f 75 62 6c 65 k 0.. trouble
9180: 20 66 61 74 61 6c 20 22 3c 24 70 6e 61 6d 65 20 fatal "<$pname
9190: 62 72 61 6e 63 68 20 27 24 73 6e 61 6d 65 27 3e branch '$sname'>
91a0: 20 24 6c 61 62 65 6c 22 0a 09 7d 0a 09 6c 6f 67 $label"..}..log
91b0: 20 77 72 69 74 65 20 35 20 69 6e 74 65 67 72 69 write 5 integri
91c0: 74 79 20 7b 5c 5b 5b 66 6f 72 6d 61 74 20 25 30 ty {\[[format %0
91d0: 32 64 20 5b 69 6e 63 72 20 6e 5d 5d 5c 5d 20 5b 2d [incr n]]\] [
91e0: 65 78 70 72 20 7b 24 6f 6b 20 3f 20 22 4f 6b 20 expr {$ok ? "Ok
91f0: 20 20 20 22 20 3a 20 22 46 61 69 6c 65 64 22 7d " : "Failed"}
9200: 5d 20 2e 2e 2e 20 24 68 65 61 64 65 72 7d 0a 09 ] ... $header}..
9210: 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 return. }..
9220: 20 20 70 72 6f 63 20 43 68 65 63 6b 43 53 20 7b proc CheckCS {
9230: 68 65 61 64 65 72 20 6c 61 62 65 6c 20 73 71 6c header label sql
9240: 7d 20 7b 0a 09 75 70 76 61 72 20 31 20 6e 20 6e } {..upvar 1 n n
9250: 0a 09 73 65 74 20 6f 6b 20 31 0a 09 66 6f 72 65 ..set ok 1..fore
9260: 61 63 68 20 7b 63 74 79 70 65 20 63 69 64 7d 20 ach {ctype cid}
9270: 5b 73 74 61 74 65 20 72 75 6e 20 24 73 71 6c 5d [state run $sql]
9280: 20 7b 0a 09 20 20 20 20 73 65 74 20 6f 6b 20 30 {.. set ok 0
9290: 0a 09 20 20 20 20 74 72 6f 75 62 6c 65 20 66 61 .. trouble fa
92a0: 74 61 6c 20 22 3c 24 63 74 79 70 65 20 24 63 69 tal "<$ctype $ci
92b0: 64 3e 20 24 6c 61 62 65 6c 22 0a 09 7d 0a 09 6c d> $label"..}..l
92c0: 6f 67 20 77 72 69 74 65 20 35 20 69 6e 74 65 67 og write 5 integ
92d0: 72 69 74 79 20 7b 5c 5b 5b 66 6f 72 6d 61 74 20 rity {\[[format
92e0: 25 30 32 64 20 5b 69 6e 63 72 20 6e 5d 5d 5c 5d %02d [incr n]]\]
92f0: 20 5b 65 78 70 72 20 7b 24 6f 6b 20 3f 20 22 4f [expr {$ok ? "O
9300: 6b 20 20 20 20 22 20 3a 20 22 46 61 69 6c 65 64 k " : "Failed
9310: 22 7d 5d 20 2e 2e 2e 20 24 68 65 61 64 65 72 7d "}] ... $header}
9320: 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a ..return. }..
9330: 20 20 20 20 70 72 6f 63 20 43 68 65 63 6b 52 65 proc CheckRe
9340: 76 43 53 20 7b 68 65 61 64 65 72 20 6c 61 62 65 vCS {header labe
9350: 6c 20 73 71 6c 7d 20 7b 0a 09 75 70 76 61 72 20 l sql} {..upvar
9360: 31 20 6e 20 6e 0a 09 73 65 74 20 6f 6b 20 31 0a 1 n n..set ok 1.
9370: 09 66 6f 72 65 61 63 68 20 7b 63 73 74 79 70 65 .foreach {cstype
9380: 20 63 73 69 64 20 66 6e 61 6d 65 20 72 65 76 6e csid fname revn
9390: 72 7d 20 5b 73 74 61 74 65 20 72 75 6e 20 24 73 r} [state run $s
93a0: 71 6c 5d 20 7b 0a 09 20 20 20 20 73 65 74 20 6f ql] {.. set o
93b0: 6b 20 30 0a 09 20 20 20 20 73 65 74 20 62 20 22 k 0.. set b "
93c0: 3c 24 63 73 74 79 70 65 20 24 63 73 69 64 3e 22 <$cstype $csid>"
93d0: 0a 09 20 20 20 20 74 72 6f 75 62 6c 65 20 66 61 .. trouble fa
93e0: 74 61 6c 20 22 24 66 6e 61 6d 65 20 3c 24 72 65 tal "$fname <$re
93f0: 76 6e 72 3e 20 5b 73 74 72 69 6e 67 20 6d 61 70 vnr> [string map
9400: 20 5b 6c 69 73 74 20 40 20 24 62 5d 20 24 6c 61 [list @ $b] $la
9410: 62 65 6c 5d 22 0a 09 7d 0a 09 6c 6f 67 20 77 72 bel]"..}..log wr
9420: 69 74 65 20 35 20 69 6e 74 65 67 72 69 74 79 20 ite 5 integrity
9430: 7b 5c 5b 5b 66 6f 72 6d 61 74 20 25 30 32 64 20 {\[[format %02d
9440: 5b 69 6e 63 72 20 6e 5d 5d 5c 5d 20 5b 65 78 70 [incr n]]\] [exp
9450: 72 20 7b 24 6f 6b 20 3f 20 22 4f 6b 20 20 20 20 r {$ok ? "Ok
9460: 22 20 3a 20 22 46 61 69 6c 65 64 22 7d 5d 20 2e " : "Failed"}] .
9470: 2e 2e 20 24 68 65 61 64 65 72 7d 0a 09 72 65 74 .. $header}..ret
9480: 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 23 urn. }.. #
9490: 20 23 20 23 23 20 23 23 23 20 23 23 23 23 23 20 # ## ### #####
94a0: 23 23 23 23 23 23 23 23 20 23 23 23 23 23 23 23 ######## #######
94b0: 23 23 23 23 23 23 0a 20 20 20 20 23 23 20 43 6f ######. ## Co
94c0: 6e 66 69 67 75 72 61 74 69 6f 6e 0a 0a 20 20 20 nfiguration..
94d0: 20 70 72 61 67 6d 61 20 2d 68 61 73 69 6e 73 74 pragma -hasinst
94e0: 61 6e 63 65 73 20 20 20 6e 6f 20 3b 20 23 20 73 ances no ; # s
94f0: 69 6e 67 6c 65 74 6f 6e 0a 20 20 20 20 70 72 61 ingleton. pra
9500: 67 6d 61 20 2d 68 61 73 74 79 70 65 69 6e 66 6f gma -hastypeinfo
9510: 20 20 20 20 6e 6f 20 3b 20 23 20 6e 6f 20 69 6e no ; # no in
9520: 74 72 6f 73 70 65 63 74 69 6f 6e 0a 20 20 20 20 trospection.
9530: 70 72 61 67 6d 61 20 2d 68 61 73 74 79 70 65 64 pragma -hastyped
9540: 65 73 74 72 6f 79 20 6e 6f 20 3b 20 23 20 69 6d estroy no ; # im
9550: 6d 6f 72 74 61 6c 0a 0a 20 20 20 20 23 20 23 20 mortal.. # #
9560: 23 23 20 23 23 23 20 23 23 23 23 23 20 23 23 23 ## ### ##### ###
9570: 23 23 23 23 23 20 23 23 23 23 23 23 23 23 23 23 ##### ##########
9580: 23 23 23 0a 7d 0a 0a 6e 61 6d 65 73 70 61 63 65 ###.}..namespace
9590: 20 65 76 61 6c 20 3a 3a 76 63 3a 3a 66 6f 73 73 eval ::vc::foss
95a0: 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 20 il::import::cvs
95b0: 7b 0a 20 20 20 20 6e 61 6d 65 73 70 61 63 65 20 {. namespace
95c0: 65 78 70 6f 72 74 20 69 6e 74 65 67 72 69 74 79 export integrity
95d0: 0a 20 20 20 20 6e 61 6d 65 73 70 61 63 65 20 65 . namespace e
95e0: 76 61 6c 20 69 6e 74 65 67 72 69 74 79 20 7b 0a val integrity {.
95f0: 09 6e 61 6d 65 73 70 61 63 65 20 69 6d 70 6f 72 .namespace impor
9600: 74 20 3a 3a 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a t ::vc::fossil::
9610: 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 73 74 61 import::cvs::sta
9620: 74 65 0a 09 6e 61 6d 65 73 70 61 63 65 20 69 6d te..namespace im
9630: 70 6f 72 74 20 3a 3a 76 63 3a 3a 74 6f 6f 6c 73 port ::vc::tools
9640: 3a 3a 74 72 6f 75 62 6c 65 0a 09 6e 61 6d 65 73 ::trouble..names
9650: 70 61 63 65 20 69 6d 70 6f 72 74 20 3a 3a 76 63 pace import ::vc
9660: 3a 3a 74 6f 6f 6c 73 3a 3a 6c 6f 67 0a 09 6c 6f ::tools::log..lo
9670: 67 20 72 65 67 69 73 74 65 72 20 69 6e 74 65 67 g register integ
9680: 72 69 74 79 0a 20 20 20 20 7d 0a 7d 0a 0a 23 20 rity. }.}..#
9690: 23 20 23 23 20 23 23 23 20 23 23 23 23 23 20 23 # ## ### ##### #
96a0: 23 23 23 23 23 23 23 20 23 23 23 23 23 23 23 23 ####### ########
96b0: 23 23 23 23 23 20 23 23 23 23 23 23 23 23 23 23 ##### ##########
96c0: 23 23 23 23 23 23 23 23 23 23 23 0a 23 23 20 52 ###########.## R
96d0: 65 61 64 79 0a 0a 70 61 63 6b 61 67 65 20 70 72 eady..package pr
96e0: 6f 76 69 64 65 20 76 63 3a 3a 66 6f 73 73 69 6c ovide vc::fossil
96f0: 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 69 ::import::cvs::i
9700: 6e 74 65 67 72 69 74 79 20 31 2e 30 0a 72 65 74 ntegrity 1.0.ret
9710: 75 72 6e 0a urn.