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