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 2d 32 30 30 38 20 41 6e 64 72 65 61 73 20 07-2008 Andreas
0070: 4b 75 70 72 69 65 73 2e 0a 23 0a 23 20 54 68 69 Kupries..#.# Thi
0080: 73 20 73 6f 66 74 77 61 72 65 20 69 73 20 6c 69 s software is li
0090: 63 65 6e 73 65 64 20 61 73 20 64 65 73 63 72 69 censed as descri
00a0: 62 65 64 20 69 6e 20 74 68 65 20 66 69 6c 65 20 bed in the file
00b0: 4c 49 43 45 4e 53 45 2c 20 77 68 69 63 68 0a 23 LICENSE, which.#
00c0: 20 79 6f 75 20 73 68 6f 75 6c 64 20 68 61 76 65 you should have
00d0: 20 72 65 63 65 69 76 65 64 20 61 73 20 70 61 72 received as par
00e0: 74 20 6f 66 20 74 68 69 73 20 64 69 73 74 72 69 t of this distri
00f0: 62 75 74 69 6f 6e 2e 0a 23 0a 23 20 54 68 69 73 bution..#.# This
0100: 20 73 6f 66 74 77 61 72 65 20 63 6f 6e 73 69 73 software consis
0110: 74 73 20 6f 66 20 76 6f 6c 75 6e 74 61 72 79 20 ts of voluntary
0120: 63 6f 6e 74 72 69 62 75 74 69 6f 6e 73 20 6d 61 contributions ma
0130: 64 65 20 62 79 20 6d 61 6e 79 0a 23 20 69 6e 64 de by many.# ind
0140: 69 76 69 64 75 61 6c 73 2e 20 20 46 6f 72 20 65 ividuals. For e
0150: 78 61 63 74 20 63 6f 6e 74 72 69 62 75 74 69 6f xact contributio
0160: 6e 20 68 69 73 74 6f 72 79 2c 20 73 65 65 20 74 n history, see t
0170: 68 65 20 72 65 76 69 73 69 6f 6e 0a 23 20 68 69 he revision.# hi
0180: 73 74 6f 72 79 20 61 6e 64 20 6c 6f 67 73 2c 20 story and logs,
0190: 61 76 61 69 6c 61 62 6c 65 20 61 74 20 68 74 74 available at htt
01a0: 70 3a 2f 2f 66 6f 73 73 69 6c 2d 73 63 6d 2e 68 p://fossil-scm.h
01b0: 77 61 63 69 2e 63 6f 6d 2f 66 6f 73 73 69 6c 0a waci.com/fossil.
01c0: 23 20 23 20 23 23 20 23 23 23 20 23 23 23 23 23 # # ## ### #####
01d0: 20 23 23 23 23 23 23 23 23 20 23 23 23 23 23 23 ######## ######
01e0: 23 23 23 23 23 23 23 20 23 23 23 23 23 23 23 23 ####### ########
01f0: 23 23 23 23 23 23 23 23 23 23 23 23 23 0a 0a 23 #############..#
0200: 23 20 54 68 69 73 20 70 61 63 6b 61 67 65 20 68 # This package h
0210: 6f 6c 64 73 20 61 20 6e 75 6d 62 65 72 20 6f 66 olds a number of
0220: 20 69 6e 74 65 67 72 69 74 79 20 63 68 65 63 6b integrity check
0230: 73 20 64 6f 6e 65 20 6f 6e 20 74 68 65 0a 23 23 s done on the.##
0240: 20 70 65 72 73 69 73 74 65 6e 74 20 73 74 61 74 persistent stat
0250: 65 2e 20 54 68 69 73 20 69 73 20 75 73 65 64 20 e. This is used
0260: 62 79 20 74 68 65 20 70 61 73 73 65 73 20 49 49 by the passes II
0270: 20 61 6e 64 20 49 56 2e 0a 0a 23 20 23 20 23 23 and IV...# # ##
0280: 20 23 23 23 20 23 23 23 23 23 20 23 23 23 23 23 ### ##### #####
0290: 23 23 23 20 23 23 23 23 23 23 23 23 23 23 23 23 ### ############
02a0: 23 20 23 23 23 23 23 23 23 23 23 23 23 23 23 23 # ##############
02b0: 23 23 23 23 23 23 23 0a 23 23 20 52 65 71 75 69 #######.## Requi
02c0: 72 65 6d 65 6e 74 73 0a 0a 70 61 63 6b 61 67 65 rements..package
02d0: 20 72 65 71 75 69 72 65 20 54 63 6c 20 38 2e 34 require 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 20 20 20 20 20 3b ;
0300: 20 23 20 52 65 71 75 69 72 65 64 20 72 75 6e 74 # Required runt
0310: 69 6d 65 2e 0a 70 61 63 6b 61 67 65 20 72 65 71 ime..package req
0320: 75 69 72 65 20 73 6e 69 74 20 20 20 20 20 20 20 uire 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 20 20 20 20 20 3b 20 23 20 4f ; # O
0350: 4f 20 73 79 73 74 65 6d 2e 0a 70 61 63 6b 61 67 O system..packag
0360: 65 20 72 65 71 75 69 72 65 20 76 63 3a 3a 74 6f e require vc::to
0370: 6f 6c 73 3a 3a 74 72 6f 75 62 6c 65 20 20 20 20 ols::trouble
0380: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0390: 3b 20 23 20 45 72 72 6f 72 20 72 65 70 6f 72 74 ; # Error report
03a0: 69 6e 67 2e 0a 70 61 63 6b 61 67 65 20 72 65 71 ing..package req
03b0: 75 69 72 65 20 76 63 3a 3a 74 6f 6f 6c 73 3a 3a uire vc::tools::
03c0: 6c 6f 67 20 20 20 20 20 20 20 20 20 20 20 20 20 log
03d0: 20 20 20 20 20 20 20 20 20 20 20 3b 20 23 20 55 ; # U
03e0: 73 65 72 20 66 65 65 64 62 61 63 6b 2e 0a 70 61 ser feedback..pa
03f0: 63 6b 61 67 65 20 72 65 71 75 69 72 65 20 76 63 ckage require vc
0400: 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 ::fossil::import
0410: 3a 3a 63 76 73 3a 3a 73 74 61 74 65 20 20 20 20 ::cvs::state
0420: 20 20 20 20 3b 20 23 20 53 74 61 74 65 20 73 74 ; # State st
0430: 6f 72 61 67 65 2e 0a 0a 23 20 23 20 23 23 20 23 orage...# # ## #
0440: 23 23 20 23 23 23 23 23 20 23 23 23 23 23 23 23 ## ##### #######
0450: 23 20 23 23 23 23 23 23 23 23 23 23 23 23 23 20 # #############
0460: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
0470: 23 23 23 23 23 0a 23 23 0a 0a 73 6e 69 74 3a 3a #####.##..snit::
0480: 74 79 70 65 20 3a 3a 76 63 3a 3a 66 6f 73 73 69 type ::vc::fossi
0490: 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a l::import::cvs::
04a0: 69 6e 74 65 67 72 69 74 79 20 7b 0a 20 20 20 20 integrity {.
04b0: 23 20 23 20 23 23 20 23 23 23 20 23 23 23 23 23 # # ## ### #####
04c0: 20 23 23 23 23 23 23 23 23 20 23 23 23 23 23 23 ######## ######
04d0: 23 23 23 23 23 23 23 0a 20 20 20 20 23 23 20 50 #######. ## P
04e0: 75 62 6c 69 63 20 41 50 49 0a 0a 20 20 20 20 74 ublic API.. t
04f0: 79 70 65 6d 65 74 68 6f 64 20 61 73 73 65 72 74 ypemethod assert
0500: 20 7b 65 78 70 72 65 73 73 69 6f 6e 20 66 61 69 {expression fai
0510: 6c 6d 65 73 73 61 67 65 7d 20 7b 0a 09 73 65 74 lmessage} {..set
0520: 20 6f 6b 20 5b 75 70 6c 65 76 65 6c 20 31 20 5b ok [uplevel 1 [
0530: 6c 69 73 74 20 3a 3a 65 78 70 72 20 24 65 78 70 list ::expr $exp
0540: 72 65 73 73 69 6f 6e 5d 5d 0a 09 69 66 20 7b 24 ression]]..if {$
0550: 6f 6b 7d 20 72 65 74 75 72 6e 0a 09 74 72 6f 75 ok} return..trou
0560: 62 6c 65 20 69 6e 74 65 72 6e 61 6c 20 5b 75 70 ble internal [up
0570: 6c 65 76 65 6c 20 31 20 5b 6c 69 73 74 20 3a 3a level 1 [list ::
0580: 73 75 62 73 74 20 24 66 61 69 6c 6d 65 73 73 61 subst $failmessa
0590: 67 65 5d 5d 0a 09 72 65 74 75 72 6e 0a 20 20 20 ge]]..return.
05a0: 20 7d 0a 0a 20 20 20 20 74 79 70 65 6d 65 74 68 }.. typemeth
05b0: 6f 64 20 73 74 72 69 63 74 20 7b 7d 20 7b 0a 09 od strict {} {..
05c0: 6c 6f 67 20 77 72 69 74 65 20 34 20 69 6e 74 65 log write 4 inte
05d0: 67 72 69 74 79 20 7b 43 68 65 63 6b 20 64 61 74 grity {Check dat
05e0: 61 62 61 73 65 20 63 6f 6e 73 69 73 74 65 6e 63 abase consistenc
05f0: 79 7d 0a 0a 09 73 65 74 20 6e 20 30 0a 09 41 6c y}...set n 0..Al
0600: 6c 42 75 74 4d 65 74 61 0a 09 4d 65 74 61 0a 09 lButMeta..Meta..
0610: 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 return. }..
0620: 20 20 74 79 70 65 6d 65 74 68 6f 64 20 6d 65 74 typemethod met
0630: 61 72 65 6c 61 78 65 64 20 7b 7d 20 7b 0a 09 6c arelaxed {} {..l
0640: 6f 67 20 77 72 69 74 65 20 34 20 69 6e 74 65 67 og write 4 integ
0650: 72 69 74 79 20 7b 43 68 65 63 6b 20 64 61 74 61 rity {Check data
0660: 62 61 73 65 20 63 6f 6e 73 69 73 74 65 6e 63 79 base consistency
0670: 7d 0a 0a 09 73 65 74 20 6e 20 30 0a 09 41 6c 6c }...set n 0..All
0680: 42 75 74 4d 65 74 61 0a 09 72 65 74 75 72 6e 0a ButMeta..return.
0690: 20 20 20 20 7d 0a 0a 20 20 20 20 74 79 70 65 6d }.. typem
06a0: 65 74 68 6f 64 20 63 68 61 6e 67 65 73 65 74 73 ethod changesets
06b0: 20 7b 7d 20 7b 0a 09 6c 6f 67 20 77 72 69 74 65 {} {..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 72 65 74 75 72 6e angesets..return
0730: 0a 20 20 20 20 7d 0a 0a 20 20 20 20 23 20 23 20 . }.. # #
0740: 23 23 20 23 23 23 20 23 23 23 23 23 20 23 23 23 ## ### ##### ###
0750: 23 23 23 23 23 20 23 23 23 23 23 23 23 23 23 23 ##### ##########
0760: 23 23 23 0a 20 20 20 20 23 23 20 49 6e 74 65 72 ###. ## Inter
0770: 6e 61 6c 20 6d 65 74 68 6f 64 73 0a 0a 20 20 20 nal methods..
0780: 20 70 72 6f 63 20 41 6c 6c 42 75 74 4d 65 74 61 proc AllButMeta
0790: 20 7b 7d 20 7b 0a 09 23 20 54 68 69 73 20 63 6f {} {..# This co
07a0: 64 65 20 70 65 72 66 6f 72 6d 73 20 61 20 6e 75 de performs a nu
07b0: 6d 62 65 72 20 6f 66 20 70 61 72 61 6e 6f 69 64 mber of paranoid
07c0: 20 63 68 65 63 6b 73 20 6f 66 20 74 68 65 0a 09 checks of the..
07d0: 23 20 64 61 74 61 62 61 73 65 2c 20 73 65 61 72 # database, sear
07e0: 63 68 69 6e 67 20 66 6f 72 20 69 6e 63 6f 6e 73 ching for incons
07f0: 69 73 74 65 6e 74 20 63 72 6f 73 73 2d 72 65 66 istent cross-ref
0800: 65 72 65 6e 63 65 73 2e 0a 0a 09 75 70 76 61 72 erences....upvar
0810: 20 31 20 6e 20 6e 20 3b 20 23 20 43 6f 75 6e 74 1 n n ; # Count
0820: 65 72 20 66 6f 72 20 74 68 65 20 63 68 65 63 6b er for the check
0830: 73 20 28 77 65 20 70 72 69 6e 74 20 61 6e 20 69 s (we print an i
0840: 64 20 62 65 66 6f 72 65 0a 09 09 20 20 20 20 20 d before...
0850: 20 23 20 74 68 65 20 6d 61 69 6e 20 6c 61 62 65 # the main labe
0860: 6c 29 2e 0a 0a 09 23 20 46 69 6e 64 20 61 6c 6c l)....# Find all
0870: 20 72 65 76 69 73 69 6f 6e 73 20 77 68 69 63 68 revisions which
0880: 20 64 69 73 61 67 72 65 65 20 77 69 74 68 20 74 disagree with t
0890: 68 65 69 72 20 6c 69 6e 65 20 6f 66 0a 09 23 20 heir line of..#
08a0: 64 65 76 65 6c 6f 70 6d 65 6e 74 20 61 62 6f 75 development abou
08b0: 74 20 74 68 65 20 70 72 6f 6a 65 63 74 20 74 68 t the project th
08c0: 65 79 20 61 72 65 20 6f 77 6e 65 64 20 62 79 2e ey are owned by.
08d0: 0a 09 43 68 65 63 6b 52 65 76 20 5c 0a 09 20 20 ..CheckRev \..
08e0: 20 20 7b 52 65 76 69 73 69 6f 6e 73 20 61 6e 64 {Revisions and
08f0: 20 74 68 65 69 72 20 4c 4f 44 73 20 68 61 76 65 their LODs have
0900: 20 74 6f 20 62 65 20 69 6e 20 74 68 65 20 73 61 to be in the sa
0910: 6d 65 20 70 72 6f 6a 65 63 74 7d 20 5c 0a 09 20 me project} \..
0920: 20 20 20 7b 64 69 73 61 67 72 65 65 73 20 77 69 {disagrees wi
0930: 74 68 20 69 74 73 20 4c 4f 44 20 61 62 6f 75 74 th its LOD about
0940: 20 6f 77 6e 69 6e 67 20 70 72 6f 6a 65 63 74 7d owning project}
0950: 20 7b 0a 09 09 53 45 4c 45 43 54 20 46 2e 6e 61 {...SELECT F.na
0960: 6d 65 2c 20 52 2e 72 65 76 0a 09 09 46 52 4f 4d me, R.rev...FROM
0970: 20 72 65 76 69 73 69 6f 6e 20 52 2c 20 66 69 6c revision R, fil
0980: 65 20 46 2c 20 73 79 6d 62 6f 6c 20 53 0a 09 09 e F, symbol S...
0990: 57 48 45 52 45 20 52 2e 66 69 64 20 3d 20 46 2e WHERE R.fid = F.
09a0: 66 69 64 20 20 20 2d 2d 20 67 65 74 20 66 69 6c fid -- get fil
09b0: 65 20 6f 66 20 72 65 76 0a 09 09 41 4e 44 20 20 e of rev...AND
09c0: 20 52 2e 6c 6f 64 20 3d 20 53 2e 73 69 64 20 20 R.lod = S.sid
09d0: 20 2d 2d 20 67 65 74 20 73 79 6d 62 6f 6c 20 6f -- get symbol o
09e0: 66 20 69 74 73 20 6c 6f 64 0a 09 09 41 4e 44 20 f its lod...AND
09f0: 20 20 46 2e 70 69 64 20 21 3d 20 53 2e 70 69 64 F.pid != S.pid
0a00: 20 20 2d 2d 20 64 69 73 61 67 72 65 65 6d 65 6e -- disagreemen
0a10: 74 20 61 62 6f 75 74 20 74 68 65 20 6f 77 6e 69 t about the owni
0a20: 6e 67 20 70 72 6f 6a 65 63 74 0a 09 09 3b 0a 09 ng project...;..
0a30: 20 20 20 20 7d 0a 09 23 20 46 69 6e 64 20 61 6c }..# Find al
0a40: 6c 20 72 65 76 69 73 69 6f 6e 73 20 77 68 69 63 l revisions whic
0a50: 68 20 64 69 73 67 72 65 65 20 77 69 74 68 20 74 h disgree with t
0a60: 68 65 69 72 20 6d 65 74 61 20 64 61 74 61 20 61 heir meta data a
0a70: 62 6f 75 74 0a 09 23 20 74 68 65 20 70 72 6f 6a bout..# the proj
0a80: 65 63 74 20 74 68 65 79 20 61 72 65 20 6f 77 6e ect they are own
0a90: 65 64 20 62 79 2e 0a 09 43 68 65 63 6b 52 65 76 ed by...CheckRev
0aa0: 20 5c 0a 09 20 20 20 20 7b 52 65 76 69 73 69 6f \.. {Revisio
0ab0: 6e 73 20 61 6e 64 20 74 68 65 69 72 20 6d 65 74 ns and their met
0ac0: 61 20 64 61 74 61 20 68 61 76 65 20 74 6f 20 62 a data have to b
0ad0: 65 20 69 6e 20 74 68 65 20 73 61 6d 65 20 70 72 e in the same pr
0ae0: 6f 6a 65 63 74 7d 20 5c 0a 09 20 20 20 20 7b 64 oject} \.. {d
0af0: 69 73 61 67 72 65 65 73 20 77 69 74 68 20 69 74 isagrees with it
0b00: 73 20 6d 65 74 61 20 64 61 74 61 20 61 62 6f 75 s meta data abou
0b10: 74 20 6f 77 6e 69 6e 67 20 70 72 6f 6a 65 63 74 t owning project
0b20: 7d 20 7b 0a 09 09 53 45 4c 45 43 54 20 46 2e 6e } {...SELECT F.n
0b30: 61 6d 65 2c 20 52 2e 72 65 76 0a 09 09 46 52 4f ame, R.rev...FRO
0b40: 4d 20 72 65 76 69 73 69 6f 6e 20 52 2c 20 66 69 M revision R, fi
0b50: 6c 65 20 46 2c 20 6d 65 74 61 20 4d 0a 09 09 57 le F, meta M...W
0b60: 48 45 52 45 20 52 2e 66 69 64 20 3d 20 46 2e 66 HERE R.fid = F.f
0b70: 69 64 20 20 20 2d 2d 20 67 65 74 20 66 69 6c 65 id -- get file
0b80: 20 6f 66 20 72 65 76 0a 09 09 41 4e 44 20 20 20 of rev...AND
0b90: 52 2e 6d 69 64 20 3d 20 4d 2e 6d 69 64 20 20 20 R.mid = M.mid
0ba0: 2d 2d 20 67 65 74 20 6d 65 74 61 20 6f 66 20 72 -- get meta of r
0bb0: 65 76 0a 09 09 41 4e 44 20 20 20 46 2e 70 69 64 ev...AND F.pid
0bc0: 20 21 3d 20 4d 2e 70 69 64 20 20 2d 2d 20 64 69 != M.pid -- di
0bd0: 73 61 67 72 65 65 6d 65 6e 74 20 61 62 6f 75 74 sagreement about
0be0: 20 6f 77 6e 69 6e 67 20 70 72 6f 6a 65 63 74 0a owning project.
0bf0: 09 09 3b 0a 09 20 20 20 20 7d 0a 09 23 20 46 69 ..;.. }..# Fi
0c00: 6e 64 20 61 6c 6c 20 72 65 76 69 73 69 6f 6e 73 nd all revisions
0c10: 20 77 69 74 68 20 61 20 70 72 69 6d 61 72 79 20 with a primary
0c20: 63 68 69 6c 64 20 77 68 69 63 68 20 64 69 73 61 child which disa
0c30: 67 72 65 65 73 0a 09 23 20 61 62 6f 75 74 20 74 grees..# about t
0c40: 68 65 20 66 69 6c 65 20 74 68 65 79 20 62 65 6c he file they bel
0c50: 6f 6e 67 20 74 6f 2e 0a 09 43 68 65 63 6b 52 65 ong to...CheckRe
0c60: 76 20 5c 0a 09 20 20 20 20 7b 52 65 76 69 73 69 v \.. {Revisi
0c70: 6f 6e 73 20 61 6e 64 20 74 68 65 69 72 20 70 72 ons and their pr
0c80: 69 6d 61 72 79 20 63 68 69 6c 64 72 65 6e 20 68 imary children h
0c90: 61 76 65 20 74 6f 20 62 65 20 69 6e 20 74 68 65 ave to be in the
0ca0: 20 73 61 6d 65 20 66 69 6c 65 7d 20 5c 0a 09 20 same file} \..
0cb0: 20 20 20 7b 64 69 73 61 67 72 65 65 73 20 77 69 {disagrees wi
0cc0: 74 68 20 69 74 73 20 70 72 69 6d 61 72 79 20 63 th its primary c
0cd0: 68 69 6c 64 20 61 62 6f 75 74 20 74 68 65 20 6f hild about the o
0ce0: 77 6e 69 6e 67 20 66 69 6c 65 7d 20 7b 0a 09 09 wning file} {...
0cf0: 53 45 4c 45 43 54 20 46 2e 6e 61 6d 65 2c 20 52 SELECT F.name, R
0d00: 2e 72 65 76 0a 09 09 46 52 4f 4d 20 72 65 76 69 .rev...FROM revi
0d10: 73 69 6f 6e 20 52 2c 20 72 65 76 69 73 69 6f 6e sion R, revision
0d20: 20 43 2c 20 66 69 6c 65 20 46 0a 09 09 57 48 45 C, file F...WHE
0d30: 52 45 20 52 2e 66 69 64 20 3d 20 46 2e 66 69 64 RE R.fid = F.fid
0d40: 20 20 20 20 20 20 20 2d 2d 20 67 65 74 20 66 69 -- get fi
0d50: 6c 65 20 6f 66 20 72 65 76 0a 09 09 41 4e 44 20 le of rev...AND
0d60: 20 20 52 2e 63 68 69 6c 64 20 49 53 20 4e 4f 54 R.child IS NOT
0d70: 20 4e 55 4c 4c 20 2d 2d 20 67 65 74 20 61 6c 6c NULL -- get all
0d80: 20 77 69 74 68 20 70 72 69 6d 61 72 79 20 63 68 with primary ch
0d90: 69 6c 64 72 65 6e 0a 09 09 41 4e 44 20 20 20 52 ildren...AND R
0da0: 2e 63 68 69 6c 64 20 3d 20 43 2e 72 69 64 20 20 .child = C.rid
0db0: 20 20 20 2d 2d 20 67 65 74 20 70 72 69 6d 61 72 -- get primar
0dc0: 79 20 63 68 69 6c 64 0a 09 09 41 4e 44 20 20 20 y child...AND
0dd0: 43 2e 66 69 64 20 21 3d 20 52 2e 66 69 64 20 20 C.fid != R.fid
0de0: 20 20 20 20 2d 2d 20 77 72 6f 6e 67 6c 79 20 69 -- wrongly i
0df0: 6e 20 64 69 66 66 65 72 65 6e 74 20 66 69 6c 65 n different file
0e00: 0a 09 09 3b 0a 09 20 20 20 20 7d 0a 0a 09 23 20 ...;.. }...#
0e10: 46 69 6e 64 20 61 6c 6c 20 72 65 76 69 73 69 6f Find all revisio
0e20: 6e 73 20 77 69 74 68 20 61 20 62 72 61 6e 63 68 ns with a branch
0e30: 20 70 61 72 65 6e 74 20 73 79 6d 62 6f 6c 20 77 parent symbol w
0e40: 68 6f 73 65 20 70 61 72 65 6e 74 0a 09 23 20 64 hose parent..# d
0e50: 69 73 61 67 72 65 65 73 20 61 62 6f 75 74 20 74 isagrees about t
0e60: 68 65 20 66 69 6c 65 20 74 68 65 79 20 62 65 6c he file they bel
0e70: 6f 6e 67 20 74 6f 2e 0a 09 43 68 65 63 6b 52 65 ong to...CheckRe
0e80: 76 20 5c 0a 09 20 20 20 20 7b 52 65 76 69 73 69 v \.. {Revisi
0e90: 6f 6e 73 20 61 6e 64 20 74 68 65 69 72 20 62 72 ons and their br
0ea0: 61 6e 63 68 20 63 68 69 6c 64 72 65 6e 20 68 61 anch children ha
0eb0: 76 65 20 74 6f 20 62 65 20 69 6e 20 74 68 65 20 ve to be in the
0ec0: 73 61 6d 65 20 66 69 6c 65 7d 20 5c 0a 09 20 20 same file} \..
0ed0: 20 20 7b 61 74 20 74 68 65 20 62 65 67 69 6e 6e {at the beginn
0ee0: 69 6e 67 20 6f 66 20 69 74 73 20 62 72 61 6e 63 ing of its branc
0ef0: 68 20 61 6e 64 20 69 74 73 20 70 61 72 65 6e 74 h and its parent
0f00: 20 64 69 73 61 67 72 65 65 20 61 62 6f 75 74 20 disagree about
0f10: 74 68 65 20 6f 77 6e 69 6e 67 20 66 69 6c 65 7d the owning file}
0f20: 20 7b 0a 09 09 53 45 4c 45 43 54 20 46 2e 6e 61 {...SELECT F.na
0f30: 6d 65 2c 20 52 2e 72 65 76 0a 09 09 46 52 4f 4d me, R.rev...FROM
0f40: 20 72 65 76 69 73 69 6f 6e 20 52 2c 20 72 65 76 revision R, rev
0f50: 69 73 69 6f 6e 20 50 2c 20 66 69 6c 65 20 46 0a ision P, file F.
0f60: 09 09 57 48 45 52 45 20 52 2e 66 69 64 20 3d 20 ..WHERE R.fid =
0f70: 46 2e 66 69 64 20 20 20 20 20 20 20 20 20 2d 2d F.fid --
0f80: 20 67 65 74 20 66 69 6c 65 20 6f 66 20 72 65 76 get file of rev
0f90: 0a 09 09 41 4e 44 20 20 20 52 2e 62 70 61 72 65 ...AND R.bpare
0fa0: 6e 74 20 49 53 20 4e 4f 54 20 4e 55 4c 4c 20 2d nt IS NOT NULL -
0fb0: 2d 20 67 65 74 20 66 69 72 73 74 2d 6f 66 2d 62 - get first-of-b
0fc0: 72 61 6e 63 68 20 72 65 76 69 73 69 6f 6e 73 0a ranch revisions.
0fd0: 09 09 41 4e 44 20 20 20 52 2e 70 61 72 65 6e 74 ..AND R.parent
0fe0: 20 3d 20 50 2e 72 69 64 20 20 20 20 20 20 2d 2d = P.rid --
0ff0: 20 67 65 74 20 6f 75 74 2d 6f 66 2d 62 72 61 6e get out-of-bran
1000: 63 68 20 70 61 72 65 6e 74 0a 09 09 41 4e 44 20 ch parent...AND
1010: 20 20 52 2e 66 69 64 20 21 3d 20 50 2e 66 69 64 R.fid != P.fid
1020: 20 20 20 20 20 20 20 20 2d 2d 20 77 72 6f 6e 67 -- wrong
1030: 6c 79 20 69 6e 20 64 69 66 66 65 72 65 6e 74 20 ly in different
1040: 66 69 6c 65 0a 09 09 3b 0a 09 20 20 20 20 7d 0a file...;.. }.
1050: 09 23 20 46 69 6e 64 20 61 6c 6c 20 72 65 76 69 .# Find all revi
1060: 73 69 6f 6e 73 20 77 69 74 68 20 61 20 6e 6f 6e sions with a non
1070: 2d 4e 54 44 42 20 63 68 69 6c 64 20 77 68 69 63 -NTDB child whic
1080: 68 20 64 69 73 61 67 72 65 65 73 0a 09 23 20 61 h disagrees..# a
1090: 62 6f 75 74 20 74 68 65 20 66 69 6c 65 20 74 68 bout the file th
10a0: 65 79 20 62 65 6c 6f 6e 67 20 74 6f 2e 0a 09 43 ey belong to...C
10b0: 68 65 63 6b 52 65 76 20 5c 0a 09 20 20 20 20 7b heckRev \.. {
10c0: 52 65 76 69 73 69 6f 6e 73 20 61 6e 64 20 74 68 Revisions and th
10d0: 65 69 72 20 6e 6f 6e 2d 4e 54 44 42 20 63 68 69 eir non-NTDB chi
10e0: 6c 64 72 65 6e 20 68 61 76 65 20 74 6f 20 62 65 ldren have to be
10f0: 20 69 6e 20 74 68 65 20 73 61 6d 65 20 66 69 6c in the same fil
1100: 65 7d 20 5c 0a 09 20 20 20 20 7b 64 69 73 61 67 e} \.. {disag
1110: 72 65 65 73 20 77 69 74 68 20 69 74 73 20 6e 6f rees with its no
1120: 6e 2d 4e 54 44 42 20 63 68 69 6c 64 20 61 62 6f n-NTDB child abo
1130: 75 74 20 74 68 65 20 6f 77 6e 69 6e 67 20 66 69 ut the owning fi
1140: 6c 65 7d 20 7b 0a 09 09 53 45 4c 45 43 54 20 46 le} {...SELECT F
1150: 2e 6e 61 6d 65 2c 20 52 2e 72 65 76 0a 09 09 46 .name, R.rev...F
1160: 52 4f 4d 20 72 65 76 69 73 69 6f 6e 20 52 2c 20 ROM revision R,
1170: 72 65 76 69 73 69 6f 6e 20 43 2c 20 66 69 6c 65 revision C, file
1180: 20 46 0a 09 09 57 48 45 52 45 20 52 2e 66 69 64 F...WHERE R.fid
1190: 20 3d 20 46 2e 66 69 64 20 20 20 20 20 20 20 20 = F.fid
11a0: 20 2d 2d 20 67 65 74 20 66 69 6c 65 20 6f 66 20 -- get file of
11b0: 72 65 76 0a 09 09 41 4e 44 20 20 20 52 2e 64 62 rev...AND R.db
11c0: 63 68 69 6c 64 20 49 53 20 4e 4f 54 20 4e 55 4c child IS NOT NUL
11d0: 4c 20 2d 2d 20 67 65 74 20 6c 61 73 74 20 4e 54 L -- get last NT
11e0: 44 42 20 72 65 76 69 73 69 6f 6e 73 0a 09 09 41 DB revisions...A
11f0: 4e 44 20 20 20 52 2e 64 62 63 68 69 6c 64 20 3d ND R.dbchild =
1200: 20 43 2e 72 69 64 20 20 20 20 20 2d 2d 20 67 65 C.rid -- ge
1210: 74 20 74 68 65 69 72 20 63 68 69 6c 64 0a 09 09 t their child...
1220: 41 4e 44 20 20 20 43 2e 66 69 64 20 21 3d 20 52 AND C.fid != R
1230: 2e 66 69 64 20 20 20 20 20 20 20 20 2d 2d 20 77 .fid -- w
1240: 72 6f 6e 67 6c 79 20 69 6e 20 64 69 66 66 65 72 rongly in differ
1250: 65 6e 74 20 66 69 6c 65 0a 09 09 3b 0a 09 20 20 ent file...;..
1260: 20 20 7d 0a 09 23 20 46 69 6e 64 20 61 6c 6c 20 }..# Find all
1270: 72 65 76 69 73 69 6f 6e 73 20 77 68 69 63 68 20 revisions which
1280: 68 61 76 65 20 61 20 70 72 69 6d 61 72 79 20 63 have a primary c
1290: 68 69 6c 64 2c 20 62 75 74 20 74 68 65 20 63 68 hild, but the ch
12a0: 69 6c 64 0a 09 23 20 64 6f 65 73 20 6e 6f 74 20 ild..# does not
12b0: 68 61 76 65 20 74 68 65 6d 20 61 73 20 70 61 72 have them as par
12c0: 65 6e 74 2e 0a 09 43 68 65 63 6b 52 65 76 20 5c ent...CheckRev \
12d0: 0a 09 20 20 20 20 7b 52 65 76 69 73 69 6f 6e 73 .. {Revisions
12e0: 20 68 61 76 65 20 74 6f 20 62 65 20 70 61 72 65 have to be pare
12f0: 6e 74 73 20 6f 66 20 74 68 65 69 72 20 70 72 69 nts of their pri
1300: 6d 61 72 79 20 63 68 69 6c 64 72 65 6e 7d 20 5c mary children} \
1310: 0a 09 20 20 20 20 7b 69 73 20 6e 6f 74 20 74 68 .. {is not th
1320: 65 20 70 61 72 65 6e 74 20 6f 66 20 69 74 73 20 e parent of its
1330: 70 72 69 6d 61 72 79 20 63 68 69 6c 64 7d 20 7b primary child} {
1340: 0a 09 09 53 45 4c 45 43 54 20 46 2e 6e 61 6d 65 ...SELECT F.name
1350: 2c 20 52 2e 72 65 76 0a 09 09 46 52 4f 4d 20 72 , R.rev...FROM r
1360: 65 76 69 73 69 6f 6e 20 52 2c 20 72 65 76 69 73 evision R, revis
1370: 69 6f 6e 20 43 2c 20 66 69 6c 65 20 46 0a 09 09 ion C, file F...
1380: 57 48 45 52 45 20 52 2e 66 69 64 20 3d 20 46 2e WHERE R.fid = F.
1390: 66 69 64 20 20 20 20 20 20 20 20 20 2d 2d 20 67 fid -- g
13a0: 65 74 20 66 69 6c 65 20 6f 66 20 72 65 76 0a 09 et file of rev..
13b0: 09 41 4e 44 20 20 20 52 2e 63 68 69 6c 64 20 49 .AND R.child I
13c0: 53 20 4e 4f 54 20 4e 55 4c 4c 20 20 20 2d 2d 20 S NOT NULL --
13d0: 67 65 74 20 61 6c 6c 20 77 69 74 68 20 70 72 69 get all with pri
13e0: 6d 61 72 79 20 63 68 69 6c 64 72 65 6e 0a 09 09 mary children...
13f0: 41 4e 44 20 20 20 52 2e 63 68 69 6c 64 20 3d 20 AND R.child =
1400: 43 2e 72 69 64 20 20 20 20 20 20 20 2d 2d 20 67 C.rid -- g
1410: 65 74 20 70 72 69 6d 61 72 79 20 63 68 69 6c 64 et primary child
1420: 0a 09 09 41 4e 44 20 20 20 43 2e 70 61 72 65 6e ...AND C.paren
1430: 74 20 21 3d 20 52 2e 72 69 64 20 20 20 20 20 2d t != R.rid -
1440: 2d 20 63 68 69 6c 64 27 73 20 70 61 72 65 6e 74 - child's parent
1450: 20 77 72 6f 6e 67 6c 79 20 6e 6f 74 20 75 73 0a wrongly not us.
1460: 09 09 3b 0a 09 20 20 20 20 7d 0a 09 23 20 46 69 ..;.. }..# Fi
1470: 6e 64 20 61 6c 6c 20 72 65 76 69 73 69 6f 6e 73 nd all revisions
1480: 20 77 68 69 63 68 20 68 61 76 65 20 61 20 70 72 which have a pr
1490: 69 6d 72 61 72 79 20 63 68 69 6c 64 2c 20 62 75 imrary child, bu
14a0: 74 20 74 68 65 0a 09 23 20 63 68 69 6c 64 20 68 t the..# child h
14b0: 61 73 20 61 20 62 72 61 6e 63 68 20 70 61 72 65 as a branch pare
14c0: 6e 74 20 73 79 6d 62 6f 6c 20 6d 61 6b 69 6e 67 nt symbol making
14d0: 20 74 68 65 6d 20 62 72 61 63 68 20 73 74 61 72 them brach star
14e0: 74 65 72 73 2e 0a 09 43 68 65 63 6b 52 65 76 20 ters...CheckRev
14f0: 5c 0a 09 20 20 20 20 7b 50 72 69 6d 61 72 79 20 \.. {Primary
1500: 63 68 69 6c 64 72 65 6e 20 6f 66 20 72 65 76 69 children of revi
1510: 73 69 6f 6e 73 20 6d 75 73 74 20 6e 6f 74 20 73 sions must not s
1520: 74 61 72 74 20 62 72 61 6e 63 68 65 73 7d 20 5c tart branches} \
1530: 0a 09 20 20 20 20 7b 69 73 20 70 61 72 65 6e 74 .. {is parent
1540: 20 6f 66 20 61 20 70 72 69 6d 61 72 79 20 63 68 of a primary ch
1550: 69 6c 64 20 77 68 69 63 68 20 69 73 20 74 68 65 ild which is the
1560: 20 62 65 67 69 6e 6e 69 6e 67 20 6f 66 20 61 20 beginning of a
1570: 62 72 61 6e 63 68 7d 20 7b 0a 09 09 53 45 4c 45 branch} {...SELE
1580: 43 54 20 46 2e 6e 61 6d 65 2c 20 52 2e 72 65 76 CT F.name, R.rev
1590: 0a 09 09 46 52 4f 4d 20 72 65 76 69 73 69 6f 6e ...FROM revision
15a0: 20 52 2c 20 72 65 76 69 73 69 6f 6e 20 43 2c 20 R, revision C,
15b0: 66 69 6c 65 20 46 0a 09 09 57 48 45 52 45 20 52 file F...WHERE R
15c0: 2e 66 69 64 20 3d 20 46 2e 66 69 64 20 20 20 20 .fid = F.fid
15d0: 20 20 20 20 20 2d 2d 20 67 65 74 20 66 69 6c 65 -- get file
15e0: 20 6f 66 20 72 65 76 0a 09 09 41 4e 44 20 20 20 of rev...AND
15f0: 52 2e 63 68 69 6c 64 20 49 53 20 4e 4f 54 20 4e R.child IS NOT N
1600: 55 4c 4c 20 20 20 2d 2d 20 67 65 74 20 61 6c 6c ULL -- get all
1610: 20 77 69 74 68 20 70 72 69 6d 61 72 79 20 63 68 with primary ch
1620: 69 6c 64 72 65 6e 0a 09 09 41 4e 44 20 20 20 52 ildren...AND R
1630: 2e 63 68 69 6c 64 20 3d 20 43 2e 72 69 64 20 20 .child = C.rid
1640: 20 20 20 20 20 2d 2d 20 67 65 74 20 70 72 69 6d -- get prim
1650: 61 72 79 20 63 68 69 6c 64 0a 09 09 41 4e 44 20 ary child...AND
1660: 20 20 43 2e 62 70 61 72 65 6e 74 20 49 53 20 4e C.bparent IS N
1670: 4f 54 20 4e 55 4c 4c 20 2d 2d 20 62 75 74 20 69 OT NULL -- but i
1680: 6e 64 69 63 61 74 65 73 20 74 6f 20 62 65 20 6f ndicates to be o
1690: 6e 20 62 72 61 6e 63 68 0a 09 09 3b 0a 09 20 20 n branch...;..
16a0: 20 20 7d 0a 09 23 20 46 69 6e 64 20 61 6c 6c 20 }..# Find all
16b0: 72 65 76 69 73 69 6f 6e 73 20 77 69 74 68 6f 75 revisions withou
16c0: 74 20 62 72 61 6e 63 68 20 70 61 72 65 6e 74 20 t branch parent
16d0: 73 79 6d 62 6f 6c 20 77 68 69 63 68 20 68 61 76 symbol which hav
16e0: 65 20 61 0a 09 23 20 70 61 72 65 6e 74 2c 20 62 e a..# parent, b
16f0: 75 74 20 74 68 65 20 70 61 72 65 6e 74 20 64 6f ut the parent do
1700: 65 73 20 6e 6f 74 20 68 61 76 65 20 74 68 65 6d es not have them
1710: 20 61 73 20 70 72 69 6d 61 72 79 20 63 68 69 6c as primary chil
1720: 64 2e 0a 09 43 68 65 63 6b 52 65 76 20 5c 0a 09 d...CheckRev \..
1730: 20 20 20 20 7b 52 65 76 69 73 69 6f 6e 73 20 68 {Revisions h
1740: 61 76 65 20 74 6f 20 62 65 20 70 72 69 6d 61 72 ave to be primar
1750: 79 20 63 68 69 6c 64 72 65 6e 20 6f 66 20 74 68 y children of th
1760: 65 69 72 20 70 61 72 65 6e 74 73 2c 20 69 66 20 eir parents, if
1770: 61 6e 79 7d 20 5c 0a 09 20 20 20 20 7b 69 73 20 any} \.. {is
1780: 6e 6f 74 20 74 68 65 20 63 68 69 6c 64 20 6f 66 not the child of
1790: 20 69 74 73 20 70 61 72 65 6e 74 7d 20 7b 0a 09 its parent} {..
17a0: 09 53 45 4c 45 43 54 20 46 2e 6e 61 6d 65 2c 20 .SELECT F.name,
17b0: 52 2e 72 65 76 0a 09 09 46 52 4f 4d 20 72 65 76 R.rev...FROM rev
17c0: 69 73 69 6f 6e 20 52 2c 20 72 65 76 69 73 69 6f ision R, revisio
17d0: 6e 20 50 2c 20 66 69 6c 65 20 46 0a 09 09 57 48 n P, file F...WH
17e0: 45 52 45 20 52 2e 66 69 64 20 3d 20 46 2e 66 69 ERE R.fid = F.fi
17f0: 64 20 20 20 20 20 20 20 20 2d 2d 20 67 65 74 20 d -- get
1800: 66 69 6c 65 20 6f 66 20 72 65 76 69 73 69 6f 6e file of revision
1810: 0a 09 09 41 4e 44 20 20 20 52 2e 62 70 61 72 65 ...AND R.bpare
1820: 6e 74 20 49 53 20 4e 55 4c 4c 20 20 20 20 2d 2d nt IS NULL --
1830: 20 65 78 63 6c 75 64 65 20 61 6c 6c 20 66 69 72 exclude all fir
1840: 73 74 2d 6f 6e 2d 62 72 61 6e 63 68 20 72 65 76 st-on-branch rev
1850: 69 73 69 6f 6e 73 0a 09 09 41 4e 44 20 20 20 52 isions...AND R
1860: 2e 70 61 72 65 6e 74 20 49 53 20 4e 4f 54 20 4e .parent IS NOT N
1870: 55 4c 4c 20 2d 2d 20 77 68 69 63 68 20 61 72 65 ULL -- which are
1880: 20 6e 6f 74 20 72 6f 6f 74 20 6f 66 20 74 68 65 not root of the
1890: 69 72 20 6c 69 6e 65 0a 09 09 41 4e 44 20 20 20 ir line...AND
18a0: 52 2e 70 61 72 65 6e 74 20 3d 20 50 2e 72 69 64 R.parent = P.rid
18b0: 20 20 20 20 20 2d 2d 20 67 65 74 20 69 6e 2d 6c -- get in-l
18c0: 6f 64 20 70 61 72 65 6e 74 0a 09 09 41 4e 44 20 od parent...AND
18d0: 20 20 50 2e 63 68 69 6c 64 20 21 3d 20 52 2e 72 P.child != R.r
18e0: 69 64 20 20 20 20 20 2d 2d 20 62 75 74 20 64 6f id -- but do
18f0: 65 73 20 6e 6f 74 20 68 61 76 65 20 72 65 76 20 es not have rev
1900: 61 73 20 70 72 69 6d 61 72 79 20 63 68 69 6c 64 as primary child
1910: 0a 09 09 3b 0a 09 20 20 20 20 7d 0a 09 23 20 46 ...;.. }..# F
1920: 69 6e 64 20 61 6c 6c 20 72 65 76 69 73 69 6f 6e ind all revision
1930: 73 20 77 69 74 68 20 61 20 62 72 61 6e 63 68 20 s with a branch
1940: 70 61 72 65 6e 74 20 73 79 6d 62 6f 6c 20 77 68 parent symbol wh
1950: 69 63 68 20 64 6f 20 6e 6f 74 0a 09 23 20 68 61 ich do not..# ha
1960: 76 65 20 61 20 70 61 72 65 6e 74 2e 0a 09 43 68 ve a parent...Ch
1970: 65 63 6b 52 65 76 20 5c 0a 09 20 20 20 20 7b 42 eckRev \.. {B
1980: 72 61 6e 63 68 20 73 74 61 72 74 69 6e 67 20 72 ranch starting r
1990: 65 76 69 73 69 6f 6e 73 20 68 61 76 65 20 74 6f evisions have to
19a0: 20 68 61 76 65 20 61 20 70 61 72 65 6e 74 2c 20 have a parent,
19b0: 69 66 20 6e 6f 74 20 64 65 74 61 63 68 65 64 7d if not detached}
19c0: 20 5c 0a 09 20 20 20 20 7b 61 74 20 74 68 65 20 \.. {at the
19d0: 62 65 67 69 6e 6e 69 6e 67 20 6f 66 20 69 74 73 beginning of its
19e0: 20 62 72 61 6e 63 68 20 68 61 73 20 6e 6f 20 70 branch has no p
19f0: 61 72 65 6e 74 2c 20 62 75 74 20 69 74 73 20 62 arent, but its b
1a00: 72 61 6e 63 68 20 68 61 73 7d 20 7b 0a 09 09 53 ranch has} {...S
1a10: 45 4c 45 43 54 20 46 2e 6e 61 6d 65 2c 20 52 2e ELECT F.name, R.
1a20: 72 65 76 0a 09 09 46 52 4f 4d 20 72 65 76 69 73 rev...FROM revis
1a30: 69 6f 6e 20 52 2c 20 66 69 6c 65 20 46 2c 20 62 ion R, file F, b
1a40: 72 61 6e 63 68 20 42 0a 09 09 57 48 45 52 45 20 ranch B...WHERE
1a50: 52 2e 66 69 64 20 3d 20 46 2e 66 69 64 20 20 20 R.fid = F.fid
1a60: 20 20 20 20 20 20 2d 2d 20 67 65 74 20 66 69 6c -- get fil
1a70: 65 20 6f 66 20 72 65 76 69 73 69 6f 6e 0a 09 09 e of revision...
1a80: 41 4e 44 20 20 20 52 2e 62 70 61 72 65 6e 74 20 AND R.bparent
1a90: 49 53 20 4e 4f 54 20 4e 55 4c 4c 20 2d 2d 20 6c IS NOT NULL -- l
1aa0: 69 6d 69 74 20 74 6f 20 66 69 72 73 74 2d 6f 6e imit to first-on
1ab0: 2d 62 72 61 6e 63 68 20 72 65 76 69 73 69 6f 6e -branch revision
1ac0: 73 0a 09 09 41 4e 44 20 20 20 52 2e 70 61 72 65 s...AND R.pare
1ad0: 6e 74 20 20 49 53 20 4e 55 4c 4c 20 20 20 20 20 nt IS NULL
1ae0: 2d 2d 20 77 68 69 63 68 20 61 72 65 20 64 65 74 -- which are det
1af0: 61 63 68 65 64 0a 09 09 41 4e 44 20 20 20 42 2e ached...AND B.
1b00: 73 69 64 20 3d 20 52 2e 62 70 61 72 65 6e 74 20 sid = R.bparent
1b10: 20 20 20 20 2d 2d 20 67 65 74 20 62 72 61 6e 63 -- get branc
1b20: 68 20 67 6f 76 65 72 6e 69 6e 67 20 74 68 65 20 h governing the
1b30: 72 65 76 0a 09 09 41 4e 44 20 20 20 42 2e 66 69 rev...AND B.fi
1b40: 64 20 3d 20 52 2e 66 69 64 20 20 20 20 20 20 20 d = R.fid
1b50: 20 20 2d 2d 20 69 6e 20 74 68 65 20 72 65 76 69 -- in the revi
1b60: 73 69 6f 6e 27 73 20 66 69 6c 65 0a 09 09 41 4e sion's file...AN
1b70: 44 20 20 20 42 2e 72 6f 6f 74 20 20 20 20 49 53 D B.root IS
1b80: 20 4e 4f 54 20 4e 55 4c 4c 20 2d 2d 20 62 75 74 NOT NULL -- but
1b90: 20 73 61 79 73 20 74 68 61 74 20 62 72 61 6e 63 says that branc
1ba0: 68 20 69 73 20 61 74 74 61 63 68 65 64 0a 09 09 h is attached...
1bb0: 3b 0a 09 20 20 20 20 7d 0a 09 23 20 46 69 6e 64 ;.. }..# Find
1bc0: 20 61 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 77 all revisions w
1bd0: 69 74 68 20 61 20 62 72 61 6e 63 68 20 70 61 72 ith a branch par
1be0: 65 6e 74 20 73 79 6d 62 6f 6c 20 77 68 6f 73 65 ent symbol whose
1bf0: 20 70 61 72 65 6e 74 0a 09 23 20 68 61 73 20 74 parent..# has t
1c00: 68 65 6d 20 61 73 20 70 72 69 6d 61 72 79 20 63 hem as primary c
1c10: 68 69 6c 64 2e 0a 09 43 68 65 63 6b 52 65 76 20 hild...CheckRev
1c20: 5c 0a 09 20 20 20 20 7b 42 72 61 6e 63 68 20 73 \.. {Branch s
1c30: 74 61 72 74 69 6e 67 20 72 65 76 69 73 69 6f 6e tarting revision
1c40: 73 20 6d 75 73 74 20 6e 6f 74 20 62 65 20 70 72 s must not be pr
1c50: 69 6d 61 72 79 20 63 68 69 6c 64 72 65 6e 20 6f imary children o
1c60: 66 20 74 68 65 69 72 20 70 61 72 65 6e 74 73 7d f their parents}
1c70: 20 5c 0a 09 20 20 20 20 7b 61 74 20 74 68 65 20 \.. {at the
1c80: 62 65 67 69 6e 6e 69 6e 67 20 6f 66 20 69 74 73 beginning of its
1c90: 20 62 72 61 6e 63 68 20 69 73 20 74 68 65 20 70 branch is the p
1ca0: 72 69 6d 61 72 79 20 63 68 69 6c 64 20 6f 66 20 rimary child of
1cb0: 69 74 73 20 70 61 72 65 6e 74 7d 20 7b 0a 09 09 its parent} {...
1cc0: 53 45 4c 45 43 54 20 46 2e 6e 61 6d 65 2c 20 52 SELECT F.name, R
1cd0: 2e 72 65 76 0a 09 09 46 52 4f 4d 20 72 65 76 69 .rev...FROM revi
1ce0: 73 69 6f 6e 20 52 2c 20 72 65 76 69 73 69 6f 6e sion R, revision
1cf0: 20 50 2c 20 66 69 6c 65 20 46 0a 09 09 57 48 45 P, file F...WHE
1d00: 52 45 20 52 2e 66 69 64 20 3d 20 46 2e 66 69 64 RE R.fid = F.fid
1d10: 20 20 20 20 20 20 20 20 20 2d 2d 20 67 65 74 20 -- get
1d20: 66 69 6c 65 20 6f 66 20 72 65 76 69 73 69 6f 6e file of revision
1d30: 0a 09 09 41 4e 44 20 20 20 52 2e 62 70 61 72 65 ...AND R.bpare
1d40: 6e 74 20 49 53 20 4e 4f 54 20 4e 55 4c 4c 20 2d nt IS NOT NULL -
1d50: 2d 20 6c 69 6d 69 74 20 74 6f 20 66 69 72 73 74 - limit to first
1d60: 2d 6f 6e 2d 62 72 61 6e 63 68 20 72 65 76 69 73 -on-branch revis
1d70: 69 6f 6e 73 0a 09 09 41 4e 44 20 20 20 52 2e 70 ions...AND R.p
1d80: 61 72 65 6e 74 20 49 53 20 4e 4f 54 20 4e 55 4c arent IS NOT NUL
1d90: 4c 20 20 2d 2d 20 77 68 69 63 68 20 61 72 65 20 L -- which are
1da0: 61 74 74 61 63 68 65 64 0a 09 09 41 4e 44 20 20 attached...AND
1db0: 20 52 2e 70 61 72 65 6e 74 20 3d 20 50 2e 72 69 R.parent = P.ri
1dc0: 64 20 20 20 20 20 20 2d 2d 20 67 65 74 20 6f 75 d -- get ou
1dd0: 74 2d 6f 66 2d 62 72 61 6e 63 68 20 70 61 72 65 t-of-branch pare
1de0: 6e 74 0a 09 09 41 4e 44 20 20 20 50 2e 63 68 69 nt...AND P.chi
1df0: 6c 64 20 3d 20 52 2e 72 69 64 20 20 20 20 20 20 ld = R.rid
1e00: 20 2d 2d 20 77 72 6f 6e 67 6c 79 20 68 61 73 20 -- wrongly has
1e10: 72 65 76 20 61 73 20 70 72 69 6d 61 72 79 20 63 rev as primary c
1e20: 68 69 6c 64 0a 09 09 3b 0a 09 20 20 20 20 7d 0a hild...;.. }.
1e30: 09 23 20 46 69 6e 64 20 61 6c 6c 20 72 65 76 69 .# Find all revi
1e40: 73 69 6f 6e 73 20 77 69 74 68 20 61 20 6e 6f 6e sions with a non
1e50: 2d 4e 54 44 42 20 63 68 69 6c 64 20 77 68 69 63 -NTDB child whic
1e60: 68 20 61 72 65 20 6e 6f 74 20 6f 6e 0a 09 23 20 h are not on..#
1e70: 74 68 65 20 4e 54 44 42 2e 0a 09 43 68 65 63 6b the NTDB...Check
1e80: 52 65 76 20 5c 0a 09 20 20 20 20 7b 4e 54 44 42 Rev \.. {NTDB
1e90: 20 74 6f 20 74 72 75 6e 6b 20 74 72 61 6e 73 69 to trunk transi
1ea0: 74 69 6f 6e 20 68 61 73 20 74 6f 20 62 65 67 69 tion has to begi
1eb0: 6e 20 6f 6e 20 4e 54 44 42 7d 20 5c 0a 09 20 20 n on NTDB} \..
1ec0: 20 20 7b 68 61 73 20 61 20 6e 6f 6e 2d 4e 54 44 {has a non-NTD
1ed0: 42 20 63 68 69 6c 64 2c 20 79 65 74 20 69 73 20 B child, yet is
1ee0: 6e 6f 74 20 6f 6e 20 74 68 65 20 4e 54 44 42 7d not on the NTDB}
1ef0: 20 7b 0a 09 09 53 45 4c 45 43 54 20 46 2e 6e 61 {...SELECT F.na
1f00: 6d 65 2c 20 52 2e 72 65 76 0a 09 09 46 52 4f 4d me, R.rev...FROM
1f10: 20 72 65 76 69 73 69 6f 6e 20 52 2c 20 66 69 6c revision R, fil
1f20: 65 20 46 0a 09 09 57 48 45 52 45 20 52 2e 66 69 e F...WHERE R.fi
1f30: 64 20 3d 20 46 2e 66 69 64 20 20 20 20 20 20 20 d = F.fid
1f40: 20 20 2d 2d 20 67 65 74 20 66 69 6c 65 20 6f 66 -- get file of
1f50: 20 72 65 76 69 73 69 6f 6e 0a 09 09 41 4e 44 20 revision...AND
1f60: 20 20 52 2e 64 62 63 68 69 6c 64 20 49 53 20 4e R.dbchild IS N
1f70: 4f 54 20 4e 55 4c 4c 20 2d 2d 20 6c 69 6d 69 74 OT NULL -- limit
1f80: 20 74 6f 20 6c 61 73 74 20 4e 54 44 42 20 72 65 to last NTDB re
1f90: 76 69 73 69 6f 6e 0a 09 09 41 4e 44 20 20 20 4e vision...AND N
1fa0: 4f 54 20 52 2e 69 73 64 65 66 61 75 6c 74 20 20 OT R.isdefault
1fb0: 20 20 20 20 20 2d 2d 20 62 75 74 20 73 69 67 6e -- but sign
1fc0: 61 6c 73 20 6e 6f 74 2d 4e 54 44 42 0a 09 09 3b als not-NTDB...;
1fd0: 0a 09 20 20 20 20 7d 0a 09 23 20 46 69 6e 64 20 .. }..# Find
1fe0: 61 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 77 69 all revisions wi
1ff0: 74 68 20 61 20 4e 54 44 42 20 70 61 72 65 6e 74 th a NTDB parent
2000: 20 77 68 69 63 68 20 61 72 65 20 6f 6e 20 74 68 which are on th
2010: 65 20 4e 54 44 42 2e 0a 09 43 68 65 63 6b 52 65 e NTDB...CheckRe
2020: 76 20 5c 0a 09 20 20 20 20 7b 4e 54 44 42 20 74 v \.. {NTDB t
2030: 6f 20 74 72 75 6e 6b 20 74 72 61 6e 73 69 74 69 o trunk transiti
2040: 6f 6e 20 68 61 73 20 74 6f 20 65 6e 64 20 6f 6e on has to end on
2050: 20 6e 6f 6e 2d 4e 54 44 42 7d 20 5c 0a 09 20 20 non-NTDB} \..
2060: 20 20 7b 68 61 73 20 61 20 4e 54 44 42 20 70 61 {has a NTDB pa
2070: 72 65 6e 74 2c 20 79 65 74 20 69 73 20 6f 6e 20 rent, yet is on
2080: 74 68 65 20 4e 54 44 42 7d 20 7b 0a 09 09 53 45 the NTDB} {...SE
2090: 4c 45 43 54 20 46 2e 6e 61 6d 65 2c 20 52 2e 72 LECT F.name, R.r
20a0: 65 76 0a 09 09 46 52 4f 4d 20 72 65 76 69 73 69 ev...FROM revisi
20b0: 6f 6e 20 52 2c 20 66 69 6c 65 20 46 0a 09 09 57 on R, file F...W
20c0: 48 45 52 45 20 52 2e 66 69 64 20 3d 20 46 2e 66 HERE R.fid = F.f
20d0: 69 64 20 20 20 20 20 20 20 20 20 20 2d 2d 20 67 id -- g
20e0: 65 74 20 66 69 6c 65 20 6f 66 20 72 65 76 69 73 et file of revis
20f0: 69 6f 6e 0a 09 09 41 4e 44 20 20 20 52 2e 64 62 ion...AND R.db
2100: 70 61 72 65 6e 74 20 49 53 20 4e 4f 54 20 4e 55 parent IS NOT NU
2110: 4c 4c 20 2d 2d 20 6c 69 6d 69 74 20 74 6f 20 72 LL -- limit to r
2120: 6f 6f 74 73 20 6f 66 20 6e 6f 6e 2d 4e 54 44 42 oots of non-NTDB
2130: 0a 09 09 41 4e 44 20 20 20 52 2e 69 73 64 65 66 ...AND R.isdef
2140: 61 75 6c 74 20 20 20 20 20 20 20 20 20 20 20 20 ault
2150: 2d 2d 20 62 75 74 20 73 69 67 6e 61 6c 73 20 74 -- but signals t
2160: 6f 20 62 65 20 4e 54 44 42 0a 09 09 3b 0a 09 20 o be NTDB...;..
2170: 20 20 20 7d 0a 09 23 20 46 69 6e 64 20 61 6c 6c }..# Find all
2180: 20 72 65 76 69 73 69 6f 6e 73 20 77 69 74 68 20 revisions with
2190: 61 20 63 68 69 6c 64 20 77 68 69 63 68 20 64 69 a child which di
21a0: 73 61 67 72 65 65 73 20 61 62 6f 75 74 20 74 68 sagrees about th
21b0: 65 0a 09 23 20 6c 69 6e 65 20 6f 66 20 64 65 76 e..# line of dev
21c0: 65 6c 6f 70 6d 65 6e 74 20 74 68 65 79 20 62 65 elopment they be
21d0: 6c 6f 6e 67 20 74 6f 2e 0a 09 43 68 65 63 6b 52 long to...CheckR
21e0: 65 76 20 5c 0a 09 20 20 20 20 7b 52 65 76 69 73 ev \.. {Revis
21f0: 69 6f 6e 73 20 61 6e 64 20 74 68 65 69 72 20 70 ions and their p
2200: 72 69 6d 61 72 79 20 63 68 69 6c 64 72 65 6e 20 rimary children
2210: 68 61 76 65 20 74 6f 20 62 65 20 69 6e 20 74 68 have to be in th
2220: 65 20 73 61 6d 65 20 4c 4f 44 7d 20 5c 0a 09 20 e same LOD} \..
2230: 20 20 20 7b 61 6e 64 20 69 74 73 20 70 72 69 6d {and its prim
2240: 61 72 79 20 63 68 69 6c 64 20 64 69 73 61 67 72 ary child disagr
2250: 65 65 20 61 62 6f 75 74 20 74 68 65 69 72 20 4c ee about their L
2260: 4f 44 7d 20 7b 0a 09 09 53 45 4c 45 43 54 20 46 OD} {...SELECT F
2270: 2e 6e 61 6d 65 2c 20 52 2e 72 65 76 0a 09 09 46 .name, R.rev...F
2280: 52 4f 4d 20 72 65 76 69 73 69 6f 6e 20 52 2c 20 ROM revision R,
2290: 72 65 76 69 73 69 6f 6e 20 43 2c 20 66 69 6c 65 revision C, file
22a0: 20 46 0a 09 09 57 48 45 52 45 20 52 2e 66 69 64 F...WHERE R.fid
22b0: 20 3d 20 46 2e 66 69 64 20 20 20 20 20 20 20 2d = F.fid -
22c0: 2d 20 67 65 74 20 66 69 6c 65 20 6f 66 20 72 65 - get file of re
22d0: 76 69 73 69 6f 6e 0a 09 09 41 4e 44 20 20 20 52 vision...AND R
22e0: 2e 63 68 69 6c 64 20 49 53 20 4e 4f 54 20 4e 55 .child IS NOT NU
22f0: 4c 4c 20 2d 2d 20 72 65 76 69 73 69 6f 6e 20 68 LL -- revision h
2300: 61 73 20 61 20 70 72 69 6d 61 72 79 20 63 68 69 as a primary chi
2310: 6c 64 0a 09 09 41 4e 44 20 20 20 52 2e 63 68 69 ld...AND R.chi
2320: 6c 64 20 3d 20 43 2e 72 69 64 20 20 20 20 20 2d ld = C.rid -
2330: 2d 20 67 65 74 20 74 68 61 74 20 63 68 69 6c 64 - get that child
2340: 0a 09 09 41 4e 44 20 20 20 43 2e 6c 6f 64 20 21 ...AND C.lod !
2350: 3d 20 52 2e 6c 6f 64 20 20 20 20 20 20 2d 2d 20 = R.lod --
2360: 63 68 69 6c 64 20 77 72 6f 6e 67 6c 79 20 64 69 child wrongly di
2370: 73 61 67 72 65 65 73 20 77 69 74 68 20 6c 6f 64 sagrees with lod
2380: 0a 09 09 3b 0a 09 20 20 20 20 7d 0a 09 23 20 46 ...;.. }..# F
2390: 69 6e 64 20 61 6c 6c 20 72 65 76 69 73 69 6f 6e ind all revision
23a0: 73 20 77 69 74 68 20 61 20 6e 6f 6e 2d 4e 54 44 s with a non-NTD
23b0: 42 20 63 68 69 6c 64 20 77 68 69 63 68 20 61 67 B child which ag
23c0: 72 65 65 73 20 61 62 6f 75 74 0a 09 23 20 74 68 rees about..# th
23d0: 65 20 6c 69 6e 65 20 6f 66 20 64 65 76 65 6c 6f e line of develo
23e0: 70 6d 65 6e 74 20 74 68 65 79 20 62 65 6c 6f 6e pment they belon
23f0: 67 20 74 6f 2e 0a 09 43 68 65 63 6b 52 65 76 20 g to...CheckRev
2400: 5c 0a 09 20 20 20 20 7b 4e 54 44 42 20 61 6e 64 \.. {NTDB and
2410: 20 74 72 75 6e 6b 20 72 65 76 69 73 69 6f 6e 73 trunk revisions
2420: 20 68 61 76 65 20 74 6f 20 62 65 20 69 6e 20 64 have to be in d
2430: 69 66 66 65 72 65 6e 74 20 4c 4f 44 73 7d 20 5c ifferent LODs} \
2440: 0a 09 20 20 20 20 7b 6f 6e 20 4e 54 44 42 20 61 .. {on NTDB a
2450: 6e 64 20 69 74 73 20 6e 6f 6e 2d 4e 54 44 42 20 nd its non-NTDB
2460: 63 68 69 6c 64 20 77 72 6f 6e 67 6c 79 20 61 67 child wrongly ag
2470: 72 65 65 20 61 62 6f 75 74 20 74 68 65 69 72 20 ree about their
2480: 4c 4f 44 7d 20 7b 0a 09 09 53 45 4c 45 43 54 20 LOD} {...SELECT
2490: 46 2e 6e 61 6d 65 2c 20 52 2e 72 65 76 0a 09 09 F.name, R.rev...
24a0: 46 52 4f 4d 20 72 65 76 69 73 69 6f 6e 20 52 2c FROM revision R,
24b0: 20 72 65 76 69 73 69 6f 6e 20 43 2c 20 66 69 6c revision C, fil
24c0: 65 20 46 0a 09 09 57 48 45 52 45 20 52 2e 66 69 e F...WHERE R.fi
24d0: 64 20 3d 20 46 2e 66 69 64 20 20 20 20 20 20 20 d = F.fid
24e0: 20 20 2d 2d 20 67 65 74 20 66 69 6c 65 20 6f 66 -- get file of
24f0: 20 72 65 76 69 73 69 6f 6e 0a 09 09 41 4e 44 20 revision...AND
2500: 20 20 52 2e 64 62 63 68 69 6c 64 20 49 53 20 4e R.dbchild IS N
2510: 4f 54 20 4e 55 4c 4c 20 2d 2d 20 6c 69 6d 69 74 OT NULL -- limit
2520: 20 74 6f 20 6c 61 73 74 20 4e 54 44 42 20 72 65 to last NTDB re
2530: 76 69 73 69 6f 6e 0a 09 09 41 4e 44 20 20 20 52 vision...AND R
2540: 2e 64 62 63 68 69 6c 64 20 3d 20 43 2e 72 69 64 .dbchild = C.rid
2550: 20 20 20 20 20 2d 2d 20 67 65 74 20 6e 6f 6e 2d -- get non-
2560: 4e 54 44 42 20 63 68 69 6c 64 0a 09 09 41 4e 44 NTDB child...AND
2570: 20 20 20 43 2e 6c 6f 64 20 3d 20 52 2e 6c 6f 64 C.lod = R.lod
2580: 20 20 20 20 20 20 20 20 20 2d 2d 20 63 68 69 6c -- chil
2590: 64 20 77 72 6f 6e 67 6c 79 20 68 61 73 20 73 61 d wrongly has sa
25a0: 6d 65 20 6c 6f 64 0a 09 09 3b 0a 09 20 20 20 20 me lod...;..
25b0: 7d 0a 09 23 20 46 69 6e 64 20 61 6c 6c 20 72 65 }..# Find all re
25c0: 76 69 73 69 6f 6e 73 20 77 69 74 68 20 61 20 62 visions with a b
25d0: 72 61 6e 63 68 20 70 61 72 65 6e 74 20 73 79 6d ranch parent sym
25e0: 62 6f 6c 20 77 68 69 63 68 20 69 73 20 6e 6f 74 bol which is not
25f0: 0a 09 23 20 74 68 65 69 72 20 4c 4f 44 2e 0a 09 ..# their LOD...
2600: 43 68 65 63 6b 52 65 76 20 5c 0a 09 20 20 20 20 CheckRev \..
2610: 7b 42 72 61 6e 63 68 20 73 74 61 72 74 69 6e 67 {Branch starting
2620: 20 72 65 76 69 73 69 6f 6e 73 20 68 61 76 65 20 revisions have
2630: 74 6f 20 68 61 76 65 20 74 68 65 69 72 20 4c 4f to have their LO
2640: 44 20 61 73 20 62 72 61 6e 63 68 20 70 61 72 65 D as branch pare
2650: 6e 74 20 73 79 6d 62 6f 6c 7d 20 5c 0a 09 20 20 nt symbol} \..
2660: 20 20 7b 61 74 20 74 68 65 20 62 65 67 69 6e 6e {at the beginn
2670: 69 6e 67 20 6f 66 20 69 74 73 20 62 72 61 6e 63 ing of its branc
2680: 68 20 64 6f 65 73 20 6e 6f 74 20 68 61 76 65 20 h does not have
2690: 74 68 65 20 62 72 61 6e 63 68 20 73 79 6d 62 6f the branch symbo
26a0: 6c 20 61 73 20 69 74 73 20 4c 4f 44 7d 20 7b 0a l as its LOD} {.
26b0: 09 09 53 45 4c 45 43 54 20 46 2e 6e 61 6d 65 2c ..SELECT F.name,
26c0: 20 52 2e 72 65 76 0a 09 09 46 52 4f 4d 20 72 65 R.rev...FROM re
26d0: 76 69 73 69 6f 6e 20 52 2c 20 66 69 6c 65 20 46 vision R, file F
26e0: 0a 09 09 57 48 45 52 45 20 52 2e 66 69 64 20 3d ...WHERE R.fid =
26f0: 20 46 2e 66 69 64 20 20 20 20 20 20 20 20 20 2d F.fid -
2700: 2d 20 67 65 74 20 66 69 6c 65 20 6f 66 20 72 65 - get file of re
2710: 76 69 73 69 6f 6e 0a 09 09 41 4e 44 20 20 20 52 vision...AND R
2720: 2e 62 70 61 72 65 6e 74 20 49 53 20 4e 4f 54 20 .bparent IS NOT
2730: 4e 55 4c 4c 20 2d 2d 20 6c 69 6d 69 74 20 74 6f NULL -- limit to
2740: 20 62 72 61 6e 63 68 2d 66 69 72 73 74 20 72 65 branch-first re
2750: 76 69 73 69 6f 6e 73 0a 09 09 41 4e 44 20 20 20 visions...AND
2760: 52 2e 6c 6f 64 20 21 3d 20 52 2e 62 70 61 72 65 R.lod != R.bpare
2770: 6e 74 20 20 20 20 2d 2d 20 6f 75 74 2d 6f 66 2d nt -- out-of-
2780: 62 72 61 6e 63 68 20 70 61 72 65 6e 74 20 77 72 branch parent wr
2790: 6f 6e 67 6c 79 20 69 73 20 6e 6f 74 20 74 68 65 ongly is not the
27a0: 20 6c 6f 64 0a 09 09 3b 0a 09 20 20 20 20 7d 0a lod...;.. }.
27b0: 09 23 20 46 69 6e 64 20 61 6c 6c 20 72 65 76 69 .# Find all revi
27c0: 73 69 6f 6e 73 20 77 69 74 68 20 61 20 62 72 61 sions with a bra
27d0: 6e 63 68 20 70 61 72 65 6e 74 20 73 79 6d 62 6f nch parent symbo
27e0: 6c 20 77 68 6f 73 65 20 70 61 72 65 6e 74 0a 09 l whose parent..
27f0: 23 20 69 73 20 69 6e 20 74 68 65 20 73 61 6d 65 # is in the same
2800: 20 6c 69 6e 65 20 6f 66 20 64 65 76 65 6c 6f 70 line of develop
2810: 6d 65 6e 74 2e 0a 09 43 68 65 63 6b 52 65 76 20 ment...CheckRev
2820: 5c 0a 09 20 20 20 20 7b 52 65 76 69 73 69 6f 6e \.. {Revision
2830: 73 20 61 6e 64 20 74 68 65 69 72 20 62 72 61 6e s and their bran
2840: 63 68 20 63 68 69 6c 64 72 65 6e 20 68 61 76 65 ch children have
2850: 20 74 6f 20 62 65 20 69 6e 20 64 69 66 66 65 72 to be in differ
2860: 65 6e 74 20 4c 4f 44 73 7d 20 5c 0a 09 20 20 20 ent LODs} \..
2870: 20 7b 61 74 20 74 68 65 20 62 65 67 69 6e 6e 69 {at the beginni
2880: 6e 67 20 6f 66 20 69 74 73 20 62 72 61 6e 63 68 ng of its branch
2890: 20 61 6e 64 20 69 74 73 20 70 61 72 65 6e 74 20 and its parent
28a0: 77 72 6f 6e 67 6c 79 20 61 67 72 65 65 20 61 62 wrongly agree ab
28b0: 6f 75 74 20 74 68 65 69 72 20 4c 4f 44 7d 20 7b out their LOD} {
28c0: 0a 09 09 53 45 4c 45 43 54 20 46 2e 6e 61 6d 65 ...SELECT F.name
28d0: 2c 20 52 2e 72 65 76 0a 09 09 46 52 4f 4d 20 72 , R.rev...FROM r
28e0: 65 76 69 73 69 6f 6e 20 52 2c 20 72 65 76 69 73 evision R, revis
28f0: 69 6f 6e 20 50 2c 20 66 69 6c 65 20 46 0a 09 09 ion P, file F...
2900: 57 48 45 52 45 20 52 2e 66 69 64 20 3d 20 46 2e WHERE R.fid = F.
2910: 66 69 64 20 20 20 20 20 20 20 20 20 20 2d 2d 20 fid --
2920: 67 65 74 20 66 69 6c 65 20 6f 66 20 72 65 76 69 get file of revi
2930: 73 69 6f 6e 0a 09 09 41 4e 44 20 20 20 52 2e 62 sion...AND R.b
2940: 70 61 72 65 6e 74 20 49 53 20 4e 4f 54 20 4e 55 parent IS NOT NU
2950: 4c 4c 20 20 2d 2d 20 6c 69 6d 69 74 20 74 6f 20 LL -- limit to
2960: 62 72 61 6e 63 68 2d 66 69 72 73 74 20 72 65 76 branch-first rev
2970: 69 73 69 6f 6e 73 0a 09 09 41 4e 44 20 20 20 52 isions...AND R
2980: 2e 70 61 72 65 6e 74 20 3d 20 50 2e 72 69 64 20 .parent = P.rid
2990: 20 20 20 20 20 20 2d 2d 20 67 65 74 20 6f 75 74 -- get out
29a0: 2d 6f 66 2d 62 72 61 6e 63 68 20 70 61 72 65 6e -of-branch paren
29b0: 74 20 6f 66 20 72 65 76 69 73 69 6f 6e 0a 09 09 t of revision...
29c0: 41 4e 44 20 20 20 52 2e 6c 6f 64 20 3d 20 50 2e AND R.lod = P.
29d0: 6c 6f 64 20 20 20 20 20 20 20 20 20 20 2d 2d 20 lod --
29e0: 72 65 76 20 61 6e 64 20 70 61 72 65 6e 74 20 77 rev and parent w
29f0: 72 6f 6e 67 6c 79 20 61 67 72 65 65 20 6f 6e 20 rongly agree on
2a00: 6c 6f 64 0a 09 09 3b 0a 09 20 20 20 20 7d 0a 09 lod...;.. }..
2a10: 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 return. }..
2a20: 20 20 70 72 6f 63 20 4d 65 74 61 20 7b 7d 20 7b proc Meta {} {
2a30: 0a 09 23 20 54 68 69 73 20 63 6f 64 65 20 70 65 ..# This code pe
2a40: 72 66 6f 72 6d 73 20 61 20 6e 75 6d 62 65 72 20 rforms a number
2a50: 6f 66 20 70 61 72 61 6e 6f 69 64 20 63 68 65 63 of paranoid chec
2a60: 6b 73 20 6f 66 20 74 68 65 0a 09 23 20 64 61 74 ks of the..# dat
2a70: 61 62 61 73 65 2c 20 73 65 61 72 63 68 69 6e 67 abase, searching
2a80: 20 66 6f 72 20 69 6e 63 6f 6e 73 69 73 74 65 6e for inconsisten
2a90: 74 20 63 72 6f 73 73 2d 72 65 66 65 72 65 6e 63 t cross-referenc
2aa0: 65 73 2e 0a 0a 09 75 70 76 61 72 20 31 20 6e 20 es....upvar 1 n
2ab0: 6e 20 3b 20 23 20 43 6f 75 6e 74 65 72 20 66 6f n ; # Counter fo
2ac0: 72 20 74 68 65 20 63 68 65 63 6b 73 20 28 77 65 r the checks (we
2ad0: 20 70 72 69 6e 74 20 61 6e 20 69 64 20 62 65 66 print an id bef
2ae0: 6f 72 65 0a 09 09 20 20 20 20 20 20 23 20 74 68 ore... # th
2af0: 65 20 6d 61 69 6e 20 6c 61 62 65 6c 29 2e 0a 0a e main label)...
2b00: 09 23 20 46 69 6e 64 20 61 6c 6c 20 72 65 76 69 .# Find all revi
2b10: 73 69 6f 6e 73 20 77 68 69 63 68 20 64 69 73 67 sions which disg
2b20: 72 65 65 20 77 69 74 68 20 74 68 65 69 72 20 6d ree with their m
2b30: 65 74 61 20 64 61 74 61 20 61 62 6f 75 74 0a 09 eta data about..
2b40: 23 20 74 68 65 20 62 72 61 6e 63 68 2f 6c 69 6e # the branch/lin
2b50: 65 20 6f 66 20 64 65 76 65 6c 6f 70 6d 65 6e 74 e of development
2b60: 20 74 68 65 79 20 62 65 6c 6f 6e 67 20 74 6f 2e they belong to.
2b70: 0a 09 43 68 65 63 6b 52 65 76 20 5c 0a 09 20 20 ..CheckRev \..
2b80: 20 20 7b 52 65 76 69 73 69 6f 6e 73 20 61 6e 64 {Revisions and
2b90: 20 74 68 65 69 72 20 6d 65 74 61 20 64 61 74 61 their meta data
2ba0: 20 68 61 76 65 20 74 6f 20 62 65 20 69 6e 20 74 have to be in t
2bb0: 68 65 20 73 61 6d 65 20 4c 4f 44 7d 20 5c 0a 09 he same LOD} \..
2bc0: 20 20 20 20 7b 64 69 73 61 67 72 65 65 73 20 77 {disagrees w
2bd0: 69 74 68 20 69 74 73 20 6d 65 74 61 20 64 61 74 ith its meta dat
2be0: 61 20 61 62 6f 75 74 20 6f 77 6e 69 6e 67 20 4c a about owning L
2bf0: 4f 44 7d 20 7b 0a 09 09 53 45 4c 45 43 54 20 46 OD} {...SELECT F
2c00: 2e 6e 61 6d 65 2c 20 52 2e 72 65 76 0a 09 09 46 .name, R.rev...F
2c10: 52 4f 4d 20 72 65 76 69 73 69 6f 6e 20 52 2c 20 ROM revision R,
2c20: 6d 65 74 61 20 4d 2c 20 66 69 6c 65 20 46 0a 09 meta M, file F..
2c30: 09 57 48 45 52 45 20 52 2e 6d 69 64 20 3d 20 4d .WHERE R.mid = M
2c40: 2e 6d 69 64 20 20 20 2d 2d 20 67 65 74 20 6d 65 .mid -- get me
2c50: 74 61 20 64 61 74 61 20 6f 66 20 72 65 76 69 73 ta data of revis
2c60: 69 6f 6e 0a 09 09 41 4e 44 20 20 20 52 2e 6c 6f ion...AND R.lo
2c70: 64 20 21 3d 20 4d 2e 62 69 64 20 20 2d 2d 20 72 d != M.bid -- r
2c80: 65 76 20 77 72 6f 6e 67 6c 79 20 64 69 73 61 67 ev wrongly disag
2c90: 72 65 65 73 20 77 69 74 68 20 6d 65 74 61 20 61 rees with meta a
2ca0: 62 6f 75 74 20 6c 6f 64 0a 09 09 41 4e 44 20 20 bout lod...AND
2cb0: 20 52 2e 66 69 64 20 3d 20 46 2e 66 69 64 20 20 R.fid = F.fid
2cc0: 20 2d 2d 20 67 65 74 20 66 69 6c 65 20 6f 66 20 -- get file of
2cd0: 72 65 76 69 73 69 6f 6e 0a 09 09 3b 0a 09 20 20 revision...;..
2ce0: 20 20 7d 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 }..return.
2cf0: 7d 0a 0a 20 20 20 20 70 72 6f 63 20 52 65 76 69 }.. proc Revi
2d00: 73 69 6f 6e 43 68 61 6e 67 65 73 65 74 73 20 7b sionChangesets {
2d10: 7d 20 7b 0a 09 23 20 54 68 69 73 20 63 6f 64 65 } {..# This code
2d20: 20 70 65 72 66 6f 72 6d 73 20 61 20 6e 75 6d 62 performs a numb
2d30: 65 72 20 6f 66 20 70 61 72 61 6e 6f 69 64 20 63 er of paranoid c
2d40: 68 65 63 6b 73 20 6f 66 20 74 68 65 0a 09 23 20 hecks of the..#
2d50: 64 61 74 61 62 61 73 65 2c 20 73 65 61 72 63 68 database, search
2d60: 69 6e 67 20 66 6f 72 20 69 6e 63 6f 6e 73 69 73 ing for inconsis
2d70: 74 65 6e 74 20 63 68 61 6e 67 65 73 65 74 2f 72 tent changeset/r
2d80: 65 76 69 73 69 6f 6e 0a 09 23 20 69 6e 66 6f 72 evision..# infor
2d90: 6d 61 74 69 6f 6e 2e 0a 0a 09 75 70 76 61 72 20 mation....upvar
2da0: 31 20 6e 20 6e 20 3b 20 23 20 43 6f 75 6e 74 65 1 n n ; # Counte
2db0: 72 20 66 6f 72 20 74 68 65 20 63 68 65 63 6b 73 r for the checks
2dc0: 20 28 77 65 20 70 72 69 6e 74 20 61 6e 20 69 64 (we print an id
2dd0: 20 62 65 66 6f 72 65 0a 09 09 20 20 20 20 20 20 before...
2de0: 23 20 74 68 65 20 6d 61 69 6e 20 6c 61 62 65 6c # the main label
2df0: 29 2e 0a 0a 09 23 20 46 69 6e 64 20 61 6c 6c 20 )....# Find all
2e00: 72 65 76 69 73 69 6f 6e 73 20 77 68 69 63 68 20 revisions which
2e10: 61 72 65 20 6e 6f 74 20 75 73 65 64 20 62 79 20 are not used by
2e20: 61 74 20 6c 65 61 73 74 20 6f 6e 65 0a 09 23 20 at least one..#
2e30: 63 68 61 6e 67 65 73 65 74 2e 0a 09 43 68 65 63 changeset...Chec
2e40: 6b 52 65 76 20 5c 0a 09 20 20 20 20 7b 41 6c 6c kRev \.. {All
2e50: 20 72 65 76 69 73 69 6f 6e 73 20 68 61 76 65 20 revisions have
2e60: 74 6f 20 62 65 20 75 73 65 64 20 62 79 20 6c 65 to be used by le
2e70: 61 73 74 20 6f 6e 65 20 63 68 61 6e 67 65 73 65 ast one changese
2e80: 74 7d 20 5c 0a 09 20 20 20 20 7b 69 73 20 6e 6f t} \.. {is no
2e90: 74 20 75 73 65 64 20 62 79 20 61 20 72 65 76 69 t used by a revi
2ea0: 73 69 6f 6e 20 63 68 61 6e 67 65 73 65 74 7d 20 sion changeset}
2eb0: 7b 0a 09 09 2d 2d 20 55 6e 75 73 65 64 20 72 65 {...-- Unused re
2ec0: 76 69 73 69 6f 6e 73 20 3d 20 41 6c 6c 20 72 65 visions = All re
2ed0: 76 69 73 69 6f 6e 73 0a 09 09 2d 2d 20 20 20 20 visions...--
2ee0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2d 20 -
2ef0: 72 65 76 69 73 69 6f 6e 73 20 75 73 65 64 20 62 revisions used b
2f00: 79 20 72 65 76 69 73 69 6f 6e 20 63 68 61 6e 67 y revision chang
2f10: 65 73 65 74 73 2e 0a 09 09 2d 2d 0a 09 09 2d 2d esets....--...--
2f20: 20 42 6f 74 68 20 73 65 74 73 20 63 61 6e 20 62 Both sets can b
2f30: 65 20 63 6f 6d 70 75 74 65 64 20 65 61 73 69 6c e computed easil
2f40: 79 2c 20 61 6e 64 20 73 75 62 74 72 61 63 74 65 y, and subtracte
2f50: 64 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 d.
2f60: 20 20 2d 2d 20 66 72 6f 6d 20 65 61 63 68 20 6f -- from each o
2f70: 74 68 65 72 2e 20 54 68 65 6e 20 77 65 20 63 61 ther. Then we ca
2f80: 6e 20 67 65 74 20 74 68 65 20 61 73 73 6f 63 69 n get the associ
2f90: 61 74 65 64 0a 20 20 20 20 20 20 20 20 20 20 20 ated.
2fa0: 20 20 20 20 20 2d 2d 20 66 69 6c 65 20 28 6e 61 -- file (na
2fb0: 6d 65 29 20 66 6f 72 20 64 69 73 70 6c 61 79 2e me) for display.
2fc0: 0a 0a 09 09 53 45 4c 45 43 54 20 46 2e 6e 61 6d ....SELECT F.nam
2fd0: 65 2c 20 52 2e 72 65 76 0a 09 09 46 52 4f 4d 20 e, R.rev...FROM
2fe0: 72 65 76 69 73 69 6f 6e 20 52 2c 20 66 69 6c 65 revision R, file
2ff0: 20 46 0a 09 09 57 48 45 52 45 20 52 2e 72 69 64 F...WHERE R.rid
3000: 20 49 4e 20 28 53 45 4c 45 43 54 20 72 69 64 0a IN (SELECT rid.
3010: 09 09 09 09 46 52 4f 4d 20 72 65 76 69 73 69 6f ....FROM revisio
3020: 6e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 n
3030: 20 2d 2d 20 41 6c 6c 20 72 65 76 69 73 69 6f 6e -- All revision
3040: 73 0a 09 09 09 09 45 58 43 45 50 54 20 20 20 20 s.....EXCEPT
3050: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
3060: 20 20 20 2d 2d 20 73 75 62 74 72 61 63 74 0a 09 -- subtract..
3070: 09 09 09 53 45 4c 45 43 54 20 43 49 2e 69 69 64 ...SELECT CI.iid
3080: 0a 09 09 09 09 46 52 4f 4d 20 63 73 69 74 65 6d .....FROM csitem
3090: 20 43 49 2c 20 63 68 61 6e 67 65 73 65 74 20 43 CI, changeset C
30a0: 20 20 2d 2d 20 72 65 76 69 73 69 6f 6e 73 20 75 -- revisions u
30b0: 73 65 64 0a 09 09 09 09 57 48 45 52 45 20 43 2e sed.....WHERE C.
30c0: 63 69 64 20 3d 20 43 49 2e 63 69 64 20 20 20 20 cid = CI.cid
30d0: 20 20 20 20 20 2d 2d 20 62 79 20 61 6e 79 20 72 -- by any r
30e0: 65 76 69 73 69 6f 6e 0a 09 09 09 09 41 4e 44 20 evision.....AND
30f0: 43 2e 74 79 70 65 20 3d 20 30 29 20 20 20 20 20 C.type = 0)
3100: 20 20 20 20 20 20 20 20 20 2d 2d 20 63 68 61 6e -- chan
3110: 67 65 73 65 74 0a 09 09 41 4e 44 20 20 20 52 2e geset...AND R.
3120: 66 69 64 20 3d 20 46 2e 66 69 64 20 20 20 20 20 fid = F.fid
3130: 20 20 20 20 20 20 20 20 20 2d 2d 20 67 65 74 20 -- get
3140: 66 69 6c 65 20 6f 66 20 75 6e 75 73 65 64 20 72 file of unused r
3150: 65 76 69 73 69 6f 6e 0a 09 20 20 20 20 7d 0a 09 evision.. }..
3160: 23 20 46 69 6e 64 20 61 6c 6c 20 72 65 76 69 73 # Find all revis
3170: 69 6f 6e 73 20 77 68 69 63 68 20 61 72 65 20 75 ions which are u
3180: 73 65 64 20 62 79 20 6d 6f 72 65 20 74 68 61 6e sed by more than
3190: 20 6f 6e 65 0a 09 23 20 63 68 61 6e 67 65 73 65 one..# changese
31a0: 74 2e 0a 09 43 68 65 63 6b 52 65 76 20 5c 0a 09 t...CheckRev \..
31b0: 20 20 20 20 7b 41 6c 6c 20 72 65 76 69 73 69 6f {All revisio
31c0: 6e 73 20 68 61 76 65 20 74 6f 20 62 65 20 75 73 ns have to be us
31d0: 65 64 20 62 79 20 61 74 20 6d 6f 73 74 20 6f 6e ed by at most on
31e0: 65 20 63 68 61 6e 67 65 73 65 74 7d 20 5c 0a 09 e changeset} \..
31f0: 20 20 20 20 7b 69 73 20 75 73 65 64 20 62 79 20 {is used by
3200: 6d 75 6c 74 69 70 6c 65 20 63 68 61 6e 67 65 73 multiple changes
3210: 65 74 73 7d 20 7b 0a 09 09 2d 2d 20 50 72 69 6e ets} {...-- Prin
3220: 63 69 70 6c 65 20 6f 66 20 6f 70 65 72 61 74 69 ciple of operati
3230: 6f 6e 3a 20 47 65 74 20 61 6c 6c 20 72 65 76 69 on: Get all revi
3240: 73 69 6f 6e 2f 63 68 61 6e 67 65 73 65 74 0a 20 sion/changeset.
3250: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2d -
3260: 2d 20 70 61 69 72 73 20 66 6f 72 20 61 6c 6c 20 - pairs for all
3270: 72 65 76 69 73 69 6f 6e 20 63 68 61 6e 67 65 73 revision changes
3280: 65 74 73 2c 20 67 72 6f 75 70 20 62 79 0a 20 20 ets, group by.
3290: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2d 2d --
32a0: 20 72 65 76 69 73 69 6f 6e 20 74 6f 20 61 67 67 revision to agg
32b0: 72 65 67 61 74 65 20 74 68 65 20 63 68 61 6e 67 regate the chang
32c0: 65 73 65 74 2c 20 63 6f 75 6e 74 69 6e 67 0a 20 eset, counting.
32d0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2d -
32e0: 2d 20 74 68 65 6d 2e 20 46 72 6f 6d 20 74 68 65 - them. From the
32f0: 20 72 65 73 75 6c 74 69 6e 67 20 72 65 76 69 73 resulting revis
3300: 69 6f 6e 2f 63 6f 75 6e 74 20 74 61 62 6c 65 0a ion/count table.
3310: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
3320: 2d 2d 20 73 65 6c 65 63 74 20 74 68 6f 73 65 20 -- select those
3330: 77 69 74 68 20 6d 6f 72 65 20 74 68 61 6e 20 6f with more than o
3340: 6e 65 20 75 73 65 72 2c 20 61 6e 64 20 67 65 74 ne user, and get
3350: 20 74 68 65 69 72 0a 20 20 20 20 20 20 20 20 20 their.
3360: 20 20 20 20 20 20 20 2d 2d 20 61 73 73 6f 63 69 -- associ
3370: 61 74 65 64 20 66 69 6c 65 20 28 6e 61 6d 65 29 ated file (name)
3380: 20 66 6f 72 20 64 69 73 70 6c 61 79 2e 0a 0a 09 for display....
3390: 09 53 45 4c 45 43 54 20 46 2e 6e 61 6d 65 2c 20 .SELECT F.name,
33a0: 52 2e 72 65 76 0a 09 09 46 52 4f 4d 20 72 65 76 R.rev...FROM rev
33b0: 69 73 69 6f 6e 20 52 2c 20 66 69 6c 65 20 46 2c ision R, file F,
33c0: 0a 09 09 20 20 20 20 20 28 53 45 4c 45 43 54 20 ... (SELECT
33d0: 43 49 2e 69 69 64 20 20 20 20 20 20 20 20 41 53 CI.iid AS
33e0: 20 72 69 64 2c 20 20 2d 2d 20 72 65 76 69 73 69 rid, -- revisi
33f0: 6f 6e 20 69 74 65 6d 0a 09 09 20 20 20 20 20 20 on item...
3400: 20 20 20 20 20 20 20 63 6f 75 6e 74 28 43 49 2e count(CI.
3410: 63 69 64 29 20 41 53 20 63 6f 75 6e 74 20 2d 2d cid) AS count --
3420: 20 6e 75 6d 62 65 72 20 6f 66 20 63 73 65 74 73 number of csets
3430: 20 75 73 69 6e 67 20 69 74 65 6d 0a 09 09 20 20 using item...
3440: 20 20 20 20 46 52 4f 4d 20 63 73 69 74 65 6d 20 FROM csitem
3450: 43 49 2c 20 63 68 61 6e 67 65 73 65 74 20 43 0a CI, changeset C.
3460: 09 09 20 20 20 20 20 20 57 48 45 52 45 20 43 2e .. WHERE C.
3470: 74 79 70 65 20 3d 20 30 20 20 20 20 20 20 20 20 type = 0
3480: 20 20 20 20 2d 2d 20 6c 69 6d 69 74 20 74 6f 20 -- limit to
3490: 72 65 76 69 73 69 6f 6e 20 63 73 65 74 73 0a 09 revision csets..
34a0: 09 20 20 20 20 20 20 41 4e 44 20 20 20 43 2e 63 . AND C.c
34b0: 69 64 20 20 3d 20 43 49 2e 63 69 64 20 20 20 20 id = CI.cid
34c0: 20 20 20 2d 2d 20 67 65 74 20 69 74 65 6d 20 69 -- get item i
34d0: 6e 20 63 68 61 6e 67 65 73 65 74 0a 09 09 20 20 n changeset...
34e0: 20 20 20 20 47 52 4f 55 50 20 42 59 20 43 49 2e GROUP BY CI.
34f0: 69 69 64 20 20 20 20 20 20 20 20 20 20 20 20 20 iid
3500: 2d 2d 20 61 67 67 72 65 67 61 74 65 20 62 79 20 -- aggregate by
3510: 69 74 65 6d 2c 20 63 6f 75 6e 74 20 63 73 65 74 item, count cset
3520: 73 2f 69 74 65 6d 0a 09 09 20 20 20 20 20 29 20 s/item... )
3530: 41 53 20 55 0a 09 09 57 48 45 52 45 20 55 2e 63 AS U...WHERE U.c
3540: 6f 75 6e 74 20 3e 20 31 20 20 20 20 2d 2d 20 6c ount > 1 -- l
3550: 69 6d 69 74 20 74 6f 20 69 74 65 6d 20 77 69 74 imit to item wit
3560: 68 20 6d 75 6c 74 69 70 6c 65 20 75 73 65 72 73 h multiple users
3570: 0a 09 09 41 4e 44 20 20 20 52 2e 72 69 64 20 3d ...AND R.rid =
3580: 20 55 2e 72 69 64 20 20 2d 2d 20 67 65 74 20 72 U.rid -- get r
3590: 65 76 69 73 69 6f 6e 20 6f 66 20 69 74 65 6d 0a evision of item.
35a0: 09 09 41 4e 44 20 20 20 52 2e 66 69 64 20 3d 20 ..AND R.fid =
35b0: 46 2e 66 69 64 20 20 2d 2d 20 67 65 74 20 66 69 F.fid -- get fi
35c0: 6c 65 20 6f 66 20 72 65 76 69 73 69 6f 6e 0a 09 le of revision..
35d0: 20 20 20 20 7d 0a 09 23 20 41 6c 6c 20 72 65 76 }..# All rev
35e0: 69 73 69 6f 6e 73 20 68 61 76 65 20 74 6f 20 72 isions have to r
35f0: 65 66 65 72 20 74 6f 20 74 68 65 20 73 61 6d 65 efer to the same
3600: 20 6d 65 74 61 20 69 6e 66 6f 72 6d 61 74 69 6f meta informatio
3610: 6e 20 61 73 0a 09 23 20 74 68 65 69 72 20 63 68 n as..# their ch
3620: 61 6e 67 65 73 65 74 2e 0a 09 43 68 65 63 6b 52 angeset...CheckR
3630: 65 76 43 53 20 5c 0a 09 20 20 20 20 7b 41 6c 6c evCS \.. {All
3640: 20 72 65 76 69 73 69 6f 6e 73 20 68 61 76 65 20 revisions have
3650: 74 6f 20 61 67 72 65 65 20 77 69 74 68 20 74 68 to agree with th
3660: 65 69 72 20 63 68 61 6e 67 65 73 65 74 20 61 62 eir changeset ab
3670: 6f 75 74 20 74 68 65 20 75 73 65 64 20 6d 65 74 out the used met
3680: 61 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 7d 20 5c a information} \
3690: 0a 09 20 20 20 20 7b 64 69 73 61 67 72 65 65 73 .. {disagrees
36a0: 20 77 69 74 68 20 69 74 73 20 63 68 61 6e 67 65 with its change
36b0: 73 65 74 20 40 20 61 62 6f 75 74 20 74 68 65 20 set @ about the
36c0: 6d 65 74 61 20 69 6e 66 6f 72 6d 61 74 69 6f 6e meta information
36d0: 7d 20 7b 0a 09 09 53 45 4c 45 43 54 20 43 54 2e } {...SELECT CT.
36e0: 6e 61 6d 65 2c 20 43 2e 63 69 64 2c 20 46 2e 6e name, C.cid, F.n
36f0: 61 6d 65 2c 20 52 2e 72 65 76 0a 09 09 46 52 4f ame, R.rev...FRO
3700: 4d 20 63 68 61 6e 67 65 73 65 74 20 43 2c 20 63 M changeset C, c
3710: 73 74 79 70 65 20 43 54 2c 20 72 65 76 69 73 69 stype CT, revisi
3720: 6f 6e 20 52 2c 20 66 69 6c 65 20 46 2c 20 63 73 on R, file F, cs
3730: 69 74 65 6d 20 43 49 0a 09 09 57 48 45 52 45 20 item CI...WHERE
3740: 43 2e 74 79 70 65 20 3d 20 30 20 20 20 20 20 20 C.type = 0
3750: 20 2d 2d 20 72 65 76 69 73 69 6f 6e 20 63 68 61 -- revision cha
3760: 6e 67 65 73 65 74 73 20 6f 6e 6c 79 0a 09 09 41 ngesets only...A
3770: 4e 44 20 20 20 43 2e 63 69 64 20 20 3d 20 43 49 ND C.cid = CI
3780: 2e 63 69 64 20 20 2d 2d 20 63 68 61 6e 67 65 73 .cid -- changes
3790: 65 74 20 2d 2d 3e 20 69 74 73 20 72 65 76 69 73 et --> its revis
37a0: 69 6f 6e 73 0a 09 09 41 4e 44 20 20 20 52 2e 72 ions...AND R.r
37b0: 69 64 20 20 3d 20 43 49 2e 69 69 64 20 20 2d 2d id = CI.iid --
37c0: 20 6c 6f 6f 6b 20 61 74 20 74 68 65 6d 0a 09 09 look at them...
37d0: 41 4e 44 20 20 20 52 2e 6d 69 64 20 21 3d 20 43 AND R.mid != C
37e0: 2e 73 72 63 20 20 20 2d 2d 20 4f 6e 6c 79 20 74 .src -- Only t
37f0: 68 6f 73 65 20 77 68 69 63 68 20 64 69 73 61 67 hose which disag
3800: 72 65 65 20 77 69 74 68 20 63 68 61 6e 67 65 73 ree with changes
3810: 65 74 20 61 62 6f 75 74 20 74 68 65 20 6d 65 74 et about the met
3820: 61 0a 09 09 41 4e 44 20 20 20 52 2e 66 69 64 20 a...AND R.fid
3830: 3d 20 46 2e 66 69 64 20 20 20 20 2d 2d 20 67 65 = F.fid -- ge
3840: 74 20 66 69 6c 65 20 6f 66 20 74 68 65 20 72 65 t file of the re
3850: 76 69 73 69 6f 6e 0a 09 09 41 4e 44 20 20 20 43 vision...AND C
3860: 54 2e 74 69 64 20 3d 20 43 2e 74 79 70 65 20 20 T.tid = C.type
3870: 2d 2d 20 67 65 74 20 63 68 61 6e 67 65 73 65 74 -- get changeset
3880: 20 74 79 70 65 2c 20 66 6f 72 20 6c 61 62 65 6c type, for label
3890: 69 6e 67 0a 09 20 20 20 20 7d 0a 09 23 20 41 6c ing.. }..# Al
38a0: 6c 20 72 65 76 69 73 69 6f 6e 73 20 68 61 76 65 l revisions have
38b0: 20 74 6f 20 61 67 72 65 65 20 6f 6e 20 74 68 65 to agree on the
38c0: 20 4c 4f 44 20 74 68 65 69 72 20 63 68 61 6e 67 LOD their chang
38d0: 65 73 65 74 0a 09 23 20 62 65 6c 6f 6e 67 73 20 eset..# belongs
38e0: 74 6f 2e 20 49 6e 20 6f 74 68 65 72 20 77 6f 72 to. In other wor
38f0: 64 73 2c 20 61 6c 6c 20 72 65 76 69 73 69 6f 6e ds, all revision
3900: 73 20 69 6e 20 61 20 63 68 61 6e 67 65 73 65 74 s in a changeset
3910: 0a 09 23 20 68 61 76 65 20 74 6f 20 72 65 66 65 ..# have to refe
3920: 72 20 74 6f 20 74 68 65 20 73 61 6d 65 20 6c 69 r to the same li
3930: 6e 65 20 6f 66 20 64 65 76 65 6c 6f 70 6d 65 6e ne of developmen
3940: 74 2e 0a 09 23 0a 09 23 20 49 6e 73 74 65 61 64 t...#..# Instead
3950: 20 6f 66 20 6c 6f 6f 6b 69 6e 67 20 61 74 20 61 of looking at a
3960: 6c 6c 20 70 61 69 72 73 20 6f 66 20 72 65 76 69 ll pairs of revi
3970: 73 69 6f 6e 73 20 69 6e 20 61 6c 6c 0a 09 23 20 sions in all..#
3980: 63 68 61 6e 67 65 73 65 74 73 20 77 65 20 67 65 changesets we ge
3990: 6e 65 72 61 74 65 20 74 68 65 20 64 69 73 74 69 nerate the disti
39a0: 6e 63 74 20 73 65 74 20 6f 66 20 61 6c 6c 20 4c nct set of all L
39b0: 4f 44 73 0a 09 23 20 72 65 66 65 72 65 6e 63 65 ODs..# reference
39c0: 64 20 62 79 20 74 68 65 20 72 65 76 69 73 69 6f d by the revisio
39d0: 6e 73 20 6f 66 20 61 20 63 68 61 6e 67 65 73 65 ns of a changese
39e0: 74 2c 20 6c 6f 6f 6b 20 66 6f 72 20 74 68 6f 73 t, look for thos
39f0: 65 0a 09 23 20 77 69 74 68 20 63 61 72 64 69 6e e..# with cardin
3a00: 61 6c 69 74 79 20 3e 20 31 2c 20 61 6e 64 20 67 ality > 1, and g
3a10: 65 74 20 74 68 65 20 69 64 65 6e 74 69 66 79 69 et the identifyi
3a20: 6e 67 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 0a 09 ng information..
3a30: 23 20 66 6f 72 20 74 68 65 20 63 68 61 6e 67 65 # for the change
3a40: 73 65 74 73 20 66 6f 75 6e 64 20 74 68 75 73 6c sets found thusl
3a50: 79 2e 0a 09 43 68 65 63 6b 43 53 20 5c 0a 09 20 y...CheckCS \..
3a60: 20 20 20 7b 41 6c 6c 20 72 65 76 69 73 69 6f 6e {All revision
3a70: 73 20 69 6e 20 61 20 63 68 61 6e 67 65 73 65 74 s in a changeset
3a80: 20 68 61 76 65 20 74 6f 20 62 65 6c 6f 6e 67 20 have to belong
3a90: 74 6f 20 74 68 65 20 73 61 6d 65 20 4c 4f 44 7d to the same LOD}
3aa0: 20 5c 0a 09 20 20 20 20 7b 3a 20 49 74 73 20 72 \.. {: Its r
3ab0: 65 76 69 73 69 6f 6e 73 20 64 69 73 61 67 72 65 evisions disagre
3ac0: 65 20 61 62 6f 75 74 20 74 68 65 20 4c 4f 44 20 e about the LOD
3ad0: 74 68 65 79 20 62 65 6c 6f 6e 67 20 74 6f 7d 20 they belong to}
3ae0: 7b 0a 09 09 53 45 4c 45 43 54 20 54 2e 6e 61 6d {...SELECT T.nam
3af0: 65 2c 20 43 2e 63 69 64 0a 09 09 46 52 4f 4d 20 e, C.cid...FROM
3b00: 20 20 63 68 61 6e 67 65 73 65 74 20 43 2c 20 63 changeset C, c
3b10: 73 74 79 70 65 20 54 0a 09 09 57 48 45 52 45 20 stype T...WHERE
3b20: 20 43 2e 63 69 64 20 49 4e 20 28 53 45 4c 45 43 C.cid IN (SELEC
3b30: 54 20 55 2e 63 69 64 0a 09 09 09 09 20 46 52 4f T U.cid..... FRO
3b40: 4d 20 28 53 45 4c 45 43 54 20 44 49 53 54 49 4e M (SELECT DISTIN
3b50: 43 54 20 20 20 20 20 20 20 2d 2d 20 75 6e 69 71 CT -- uniq
3b60: 75 65 20 63 73 65 74 2f 6c 6f 64 20 70 61 69 72 ue cset/lod pair
3b70: 73 0a 09 09 09 09 20 20 20 20 20 20 20 20 20 20 s.....
3b80: 20 20 20 20 43 49 2e 63 69 64 20 41 53 20 63 69 CI.cid AS ci
3b90: 64 2c 20 2d 2d 20 72 65 76 69 73 69 6f 6e 20 63 d, -- revision c
3ba0: 73 65 74 0a 09 09 09 09 20 20 20 20 20 20 20 20 set.....
3bb0: 20 20 20 20 20 20 52 2e 6c 6f 64 20 20 41 53 20 R.lod AS
3bc0: 6c 6f 64 20 20 2d 2d 20 6c 6f 64 20 6f 66 20 69 lod -- lod of i
3bd0: 74 65 6d 20 69 6e 20 63 73 65 74 0a 09 09 09 09 tem in cset.....
3be0: 20 20 20 20 20 20 20 46 52 4f 4d 20 20 20 63 73 FROM cs
3bf0: 69 74 65 6d 20 43 49 2c 20 63 68 61 6e 67 65 73 item CI, changes
3c00: 65 74 20 43 2c 20 72 65 76 69 73 69 6f 6e 20 52 et C, revision R
3c10: 0a 09 09 09 09 20 20 20 20 20 20 20 57 48 45 52 ..... WHER
3c20: 45 20 20 43 49 2e 69 69 64 20 3d 20 52 2e 72 69 E CI.iid = R.ri
3c30: 64 20 20 2d 2d 20 67 65 74 20 72 65 76 20 6f 66 d -- get rev of
3c40: 20 69 74 65 6d 20 69 6e 20 63 73 65 74 0a 09 09 item in cset...
3c50: 09 09 20 20 20 20 20 20 20 41 4e 44 20 20 20 20 .. AND
3c60: 43 2e 63 69 64 20 20 3d 20 43 49 2e 63 69 64 20 C.cid = CI.cid
3c70: 2d 2d 20 67 65 74 20 63 68 61 6e 67 65 73 65 74 -- get changeset
3c80: 20 6f 66 20 69 74 65 6d 0a 09 09 09 09 20 20 20 of item.....
3c90: 20 20 20 20 41 4e 44 20 20 20 20 43 2e 74 79 70 AND C.typ
3ca0: 65 20 3d 20 30 20 20 20 20 20 20 2d 2d 20 6c 69 e = 0 -- li
3cb0: 6d 69 74 20 74 6f 20 72 65 76 20 63 73 65 74 73 mit to rev csets
3cc0: 0a 09 09 09 09 20 20 20 20 20 20 29 20 41 53 20 ..... ) AS
3cd0: 55 0a 09 09 09 09 20 47 52 4f 55 50 20 42 59 20 U..... GROUP BY
3ce0: 55 2e 63 69 64 20 20 20 20 20 20 20 20 20 20 2d U.cid -
3cf0: 2d 20 61 67 67 72 65 67 61 74 65 20 62 79 20 63 - aggregate by c
3d00: 73 65 74 2c 20 63 6f 75 6e 74 20 6c 6f 64 73 2f set, count lods/
3d10: 63 73 65 74 0a 09 09 09 09 20 48 41 56 49 4e 47 cset..... HAVING
3d20: 20 43 4f 55 4e 54 28 55 2e 6c 6f 64 29 20 3e 20 COUNT(U.lod) >
3d30: 31 20 2d 2d 20 66 69 6e 64 20 63 73 65 74 73 20 1 -- find csets
3d40: 77 69 74 68 20 6d 75 6c 74 69 70 6c 65 20 6c 6f with multiple lo
3d50: 64 73 0a 09 09 09 09 29 0a 09 09 41 4e 44 20 20 ds.....)...AND
3d60: 20 20 54 2e 74 69 64 20 3d 20 43 2e 74 79 70 65 T.tid = C.type
3d70: 0a 09 20 20 20 20 7d 0a 09 23 20 41 6c 6c 20 72 .. }..# All r
3d80: 65 76 69 73 69 6f 6e 73 20 68 61 76 65 20 74 6f evisions have to
3d90: 20 61 67 72 65 65 20 6f 6e 20 74 68 65 20 70 72 agree on the pr
3da0: 6f 6a 65 63 74 20 74 68 65 69 72 20 63 68 61 6e oject their chan
3db0: 67 65 73 65 74 0a 09 23 20 62 65 6c 6f 6e 67 73 geset..# belongs
3dc0: 20 74 6f 2e 20 49 6e 20 6f 74 68 65 72 20 77 6f to. In other wo
3dd0: 72 64 73 2c 20 61 6c 6c 20 72 65 76 69 73 69 6f rds, all revisio
3de0: 6e 73 20 69 6e 20 61 20 63 68 61 6e 67 65 73 65 ns in a changese
3df0: 74 0a 09 23 20 68 61 76 65 20 74 6f 20 72 65 66 t..# have to ref
3e00: 65 72 20 74 6f 20 74 68 65 20 73 61 6d 65 20 70 er to the same p
3e10: 72 6f 6a 65 63 74 2e 0a 09 23 0a 09 23 20 49 6e roject...#..# In
3e20: 73 74 65 61 64 20 6f 66 20 6c 6f 6f 6b 69 6e 67 stead of looking
3e30: 20 61 74 20 61 6c 6c 20 70 61 69 72 73 20 6f 66 at all pairs of
3e40: 20 72 65 76 69 73 69 6f 6e 73 20 69 6e 20 61 6c revisions in al
3e50: 6c 0a 09 23 20 63 68 61 6e 67 65 73 65 74 73 20 l..# changesets
3e60: 77 65 20 67 65 6e 65 72 61 74 65 20 74 68 65 20 we generate the
3e70: 64 69 73 74 69 6e 63 74 20 73 65 74 20 6f 66 20 distinct set of
3e80: 61 6c 6c 20 70 72 6f 6a 65 63 74 73 0a 09 23 20 all projects..#
3e90: 72 65 66 65 72 65 6e 63 65 64 20 62 79 20 74 68 referenced by th
3ea0: 65 20 72 65 76 69 73 69 6f 6e 73 20 6f 66 20 61 e revisions of a
3eb0: 20 63 68 61 6e 67 65 73 65 74 2c 20 6c 6f 6f 6b changeset, look
3ec0: 20 66 6f 72 20 74 68 6f 73 65 0a 09 23 20 77 69 for those..# wi
3ed0: 74 68 20 63 61 72 64 69 6e 61 6c 69 74 79 20 3e th cardinality >
3ee0: 20 31 2c 20 61 6e 64 20 67 65 74 20 74 68 65 20 1, and get the
3ef0: 69 64 65 6e 74 69 66 79 69 6e 67 20 69 6e 66 6f identifying info
3f00: 72 6d 61 74 69 6f 6e 0a 09 23 20 66 6f 72 20 74 rmation..# for t
3f10: 68 65 20 63 68 61 6e 67 65 73 65 74 73 20 66 6f he changesets fo
3f20: 75 6e 64 20 74 68 75 73 6c 79 2e 0a 09 43 68 65 und thusly...Che
3f30: 63 6b 43 53 20 5c 0a 09 20 20 20 20 7b 41 6c 6c ckCS \.. {All
3f40: 20 72 65 76 69 73 69 6f 6e 73 20 69 6e 20 61 20 revisions in a
3f50: 63 68 61 6e 67 65 73 65 74 20 68 61 76 65 20 74 changeset have t
3f60: 6f 20 62 65 6c 6f 6e 67 20 74 6f 20 74 68 65 20 o belong to the
3f70: 73 61 6d 65 20 70 72 6f 6a 65 63 74 7d 20 5c 0a same project} \.
3f80: 09 20 20 20 20 7b 3a 20 49 74 73 20 72 65 76 69 . {: Its revi
3f90: 73 69 6f 6e 73 20 64 69 73 61 67 72 65 65 20 61 sions disagree a
3fa0: 62 6f 75 74 20 74 68 65 20 70 72 6f 6a 65 63 74 bout the project
3fb0: 20 74 68 65 79 20 62 65 6c 6f 6e 67 20 74 6f 7d they belong to}
3fc0: 20 7b 0a 09 09 53 45 4c 45 43 54 20 54 2e 6e 61 {...SELECT T.na
3fd0: 6d 65 2c 20 43 2e 63 69 64 0a 09 09 46 52 4f 4d me, C.cid...FROM
3fe0: 20 20 20 63 68 61 6e 67 65 73 65 74 20 43 2c 20 changeset C,
3ff0: 63 73 74 79 70 65 20 54 0a 09 09 57 48 45 52 45 cstype T...WHERE
4000: 20 20 43 2e 63 69 64 20 49 4e 20 28 53 45 4c 45 C.cid IN (SELE
4010: 43 54 20 55 2e 63 69 64 0a 09 09 09 09 20 46 52 CT U.cid..... FR
4020: 4f 4d 20 28 53 45 4c 45 43 54 20 44 49 53 54 49 OM (SELECT DISTI
4030: 4e 43 54 20 20 20 20 20 20 20 2d 2d 20 75 6e 69 NCT -- uni
4040: 71 75 65 20 63 73 65 74 2f 70 72 6f 6a 20 70 61 que cset/proj pa
4050: 69 72 73 0a 09 09 09 09 20 20 20 20 20 20 20 20 irs.....
4060: 20 20 20 20 20 20 43 49 2e 63 69 64 20 41 53 20 CI.cid AS
4070: 63 69 64 2c 20 2d 2d 20 72 65 76 20 63 73 65 74 cid, -- rev cset
4080: 0a 09 09 09 09 20 20 20 20 20 20 20 20 20 20 20 .....
4090: 20 20 20 46 2e 70 69 64 20 20 41 53 20 70 69 64 F.pid AS pid
40a0: 20 20 2d 2d 20 70 72 6f 6a 65 63 74 20 6f 66 20 -- project of
40b0: 69 74 65 6d 20 69 6e 20 63 73 65 74 0a 09 09 09 item in cset....
40c0: 09 20 20 20 20 20 20 20 46 52 4f 4d 20 20 20 63 . FROM c
40d0: 73 69 74 65 6d 20 43 49 2c 20 63 68 61 6e 67 65 sitem CI, change
40e0: 73 65 74 20 43 2c 20 72 65 76 69 73 69 6f 6e 20 set C, revision
40f0: 52 2c 20 66 69 6c 65 20 46 0a 09 09 09 09 20 20 R, file F.....
4100: 20 20 20 20 20 57 48 45 52 45 20 20 43 49 2e 69 WHERE CI.i
4110: 69 64 20 3d 20 52 2e 72 69 64 20 20 2d 2d 20 67 id = R.rid -- g
4120: 65 74 20 72 65 76 20 6f 66 20 69 74 65 6d 20 69 et rev of item i
4130: 6e 20 63 73 65 74 0a 09 09 09 09 20 20 20 20 20 n cset.....
4140: 20 20 41 4e 44 20 20 20 20 43 2e 63 69 64 20 20 AND C.cid
4150: 3d 20 43 49 2e 63 69 64 20 2d 2d 20 67 65 74 20 = CI.cid -- get
4160: 63 68 61 6e 67 65 73 65 74 20 6f 66 20 69 74 65 changeset of ite
4170: 6d 0a 09 09 09 09 20 20 20 20 20 20 20 41 4e 44 m..... AND
4180: 20 20 20 20 43 2e 74 79 70 65 20 3d 20 30 20 20 C.type = 0
4190: 20 20 20 20 2d 2d 20 6c 69 6d 69 74 20 74 6f 20 -- limit to
41a0: 72 65 76 20 63 68 61 6e 67 65 73 65 74 73 0a 09 rev changesets..
41b0: 09 09 09 20 20 20 20 20 20 20 41 4e 44 20 20 20 ... AND
41c0: 20 46 2e 66 69 64 20 20 3d 20 52 2e 66 69 64 20 F.fid = R.fid
41d0: 20 2d 2d 20 67 65 74 20 66 69 6c 65 20 6f 66 20 -- get file of
41e0: 72 65 76 69 73 69 6f 6e 0a 09 09 09 09 20 20 20 revision.....
41f0: 20 20 20 29 20 41 53 20 55 0a 09 09 09 09 20 47 ) AS U..... G
4200: 52 4f 55 50 20 42 59 20 55 2e 63 69 64 20 20 20 ROUP BY U.cid
4210: 20 20 20 20 20 20 20 2d 2d 20 61 67 67 72 65 67 -- aggreg
4220: 61 74 65 20 62 79 20 63 73 65 74 73 2c 20 63 6f ate by csets, co
4230: 75 6e 74 20 70 72 6f 6a 2f 63 73 65 74 0a 09 09 unt proj/cset...
4240: 09 09 20 48 41 56 49 4e 47 20 43 4f 55 4e 54 28 .. HAVING COUNT(
4250: 55 2e 70 69 64 29 20 3e 20 31 20 2d 2d 20 66 69 U.pid) > 1 -- fi
4260: 6e 64 20 63 73 65 74 73 20 77 69 74 68 20 6d 75 nd csets with mu
4270: 6c 74 69 70 6c 65 20 70 72 6f 6a 65 63 74 73 0a ltiple projects.
4280: 09 09 09 09 29 0a 09 09 41 4e 44 20 20 20 20 54 ....)...AND T
4290: 2e 74 69 64 20 3d 20 43 2e 74 79 70 65 20 2d 2d .tid = C.type --
42a0: 20 67 65 74 20 72 65 61 64 61 62 6c 65 20 63 68 get readable ch
42b0: 61 6e 67 65 73 65 74 20 74 79 70 65 0a 09 20 20 angeset type..
42c0: 20 20 7d 0a 09 23 20 41 6c 6c 20 72 65 76 69 73 }..# All revis
42d0: 69 6f 6e 73 20 69 6e 20 61 20 73 69 6e 67 6c 65 ions in a single
42e0: 20 63 68 61 6e 67 65 73 65 74 20 68 61 76 65 20 changeset have
42f0: 74 6f 20 62 65 6c 6f 6e 67 20 74 6f 0a 09 23 20 to belong to..#
4300: 64 69 66 66 65 72 65 6e 74 20 66 69 6c 65 73 2e different files.
4310: 20 43 6f 6e 76 65 72 73 65 6c 79 3a 20 4e 6f 20 Conversely: No
4320: 74 77 6f 20 72 65 76 69 73 69 6f 6e 73 20 6f 66 two revisions of
4330: 20 61 20 73 69 6e 67 6c 65 0a 09 23 20 66 69 6c a single..# fil
4340: 65 20 61 72 65 20 61 6c 6c 6f 77 65 64 20 74 6f e are allowed to
4350: 20 62 65 20 69 6e 20 74 68 65 20 73 61 6d 65 20 be in the same
4360: 63 68 61 6e 67 65 73 65 74 2e 0a 09 23 0a 09 23 changeset...#..#
4370: 20 49 6e 73 74 65 61 64 20 6f 66 20 6c 6f 6f 6b Instead of look
4380: 69 6e 67 20 61 74 20 61 6c 6c 20 70 61 69 72 73 ing at all pairs
4390: 20 6f 66 20 72 65 76 69 73 69 6f 6e 73 20 69 6e of revisions in
43a0: 20 61 6c 6c 0a 09 23 20 63 68 61 6e 67 65 73 65 all..# changese
43b0: 74 73 20 77 65 20 67 65 6e 65 72 61 74 65 20 74 ts we generate t
43c0: 68 65 20 64 69 73 74 69 6e 63 74 20 73 65 74 20 he distinct set
43d0: 6f 66 20 61 6c 6c 20 66 69 6c 65 73 0a 09 23 20 of all files..#
43e0: 72 65 66 65 72 65 6e 63 65 64 20 62 79 20 74 68 referenced by th
43f0: 65 20 72 65 76 69 73 69 6f 6e 73 20 6f 66 20 61 e revisions of a
4400: 20 63 68 61 6e 67 65 73 65 74 2c 20 61 6e 64 20 changeset, and
4410: 6c 6f 6f 6b 20 66 6f 72 0a 09 23 20 74 68 6f 73 look for..# thos
4420: 65 20 77 69 74 68 20 63 61 72 64 69 6e 61 6c 69 e with cardinali
4430: 74 79 20 3c 20 74 68 65 20 63 61 72 64 69 6e 61 ty < the cardina
4440: 6c 69 74 79 20 6f 66 20 74 68 65 20 73 65 74 20 lity of the set
4450: 6f 66 0a 09 23 20 72 65 76 69 73 69 6f 6e 73 2c of..# revisions,
4460: 20 61 6e 64 20 67 65 74 20 74 68 65 20 69 64 65 and get the ide
4470: 6e 74 69 66 79 69 6e 67 20 69 6e 66 6f 72 6d 61 ntifying informa
4480: 74 69 6f 6e 20 66 6f 72 20 74 68 65 0a 09 23 20 tion for the..#
4490: 63 68 61 6e 67 65 73 65 74 73 20 66 6f 75 6e 64 changesets found
44a0: 20 74 68 75 73 6c 79 2e 0a 09 43 68 65 63 6b 43 thusly...CheckC
44b0: 53 20 5c 0a 09 20 20 20 20 7b 41 6c 6c 20 72 65 S \.. {All re
44c0: 76 69 73 69 6f 6e 73 20 69 6e 20 61 20 63 68 61 visions in a cha
44d0: 6e 67 65 73 65 74 20 68 61 76 65 20 74 6f 20 62 ngeset have to b
44e0: 65 6c 6f 6e 67 20 74 6f 20 64 69 66 66 65 72 65 elong to differe
44f0: 6e 74 20 66 69 6c 65 73 7d 20 5c 0a 09 20 20 20 nt files} \..
4500: 20 7b 3a 20 49 74 73 20 72 65 76 69 73 69 6f 6e {: Its revision
4510: 73 20 73 68 61 72 65 20 66 69 6c 65 73 7d 20 7b s share files} {
4520: 0a 09 09 53 45 4c 45 43 54 20 54 2e 6e 61 6d 65 ...SELECT T.name
4530: 2c 20 43 2e 63 69 64 0a 09 09 46 52 4f 4d 20 20 , C.cid...FROM
4540: 20 63 68 61 6e 67 65 73 65 74 20 43 2c 20 63 73 changeset C, cs
4550: 74 79 70 65 20 54 0a 09 09 57 48 45 52 45 20 20 type T...WHERE
4560: 43 2e 63 69 64 20 49 4e 20 28 53 45 4c 45 43 54 C.cid IN (SELECT
4570: 20 56 56 2e 63 69 64 0a 09 09 09 09 20 46 52 4f VV.cid..... FRO
4580: 4d 20 28 53 45 4c 45 43 54 20 55 2e 63 69 64 20 M (SELECT U.cid
4590: 20 20 20 20 20 20 20 20 41 53 20 63 69 64 2c 20 AS cid,
45a0: 20 20 2d 2d 20 72 65 76 20 63 68 61 6e 67 65 73 -- rev changes
45b0: 65 74 0a 09 09 09 09 20 20 20 20 20 20 20 20 20 et.....
45c0: 20 20 20 20 20 43 4f 55 4e 54 20 28 55 2e 66 69 COUNT (U.fi
45d0: 64 29 20 41 53 20 66 63 6f 75 6e 74 20 2d 2d 20 d) AS fcount --
45e0: 6e 75 6d 62 65 72 20 6f 66 20 66 69 6c 65 73 20 number of files
45f0: 62 79 20 69 74 65 6d 73 0a 09 09 09 09 20 20 20 by items.....
4600: 20 20 20 20 46 52 4f 4d 20 28 53 45 4c 45 43 54 FROM (SELECT
4610: 20 44 49 53 54 49 4e 43 54 20 20 20 20 20 20 20 DISTINCT
4620: 2d 2d 20 75 6e 69 71 75 65 20 63 73 65 74 2f 66 -- unique cset/f
4630: 69 6c 65 20 70 61 69 72 73 0a 09 09 09 09 09 20 ile pairs......
4640: 20 20 20 20 20 20 20 20 20 20 20 43 49 2e 63 69 CI.ci
4650: 64 20 41 53 20 63 69 64 2c 20 2d 2d 20 72 65 76 d AS cid, -- rev
4660: 20 63 68 61 6e 67 65 73 65 74 0a 09 09 09 09 09 changeset......
4670: 20 20 20 20 20 20 20 20 20 20 20 20 52 2e 66 69 R.fi
4680: 64 20 41 53 20 66 69 64 20 20 20 2d 2d 20 66 69 d AS fid -- fi
4690: 6c 65 20 6f 66 20 69 74 65 6d 20 69 6e 20 63 68 le of item in ch
46a0: 61 6e 67 65 73 65 74 0a 09 09 09 09 09 20 20 20 angeset......
46b0: 20 20 46 52 4f 4d 20 20 20 63 73 69 74 65 6d 20 FROM csitem
46c0: 43 49 2c 20 63 68 61 6e 67 65 73 65 74 20 43 2c CI, changeset C,
46d0: 20 72 65 76 69 73 69 6f 6e 20 52 0a 09 09 09 09 revision R.....
46e0: 09 20 20 20 20 20 57 48 45 52 45 20 20 43 49 2e . WHERE CI.
46f0: 69 69 64 20 3d 20 52 2e 72 69 64 20 20 2d 2d 20 iid = R.rid --
4700: 67 65 74 20 72 65 76 20 6f 66 20 69 74 65 6d 20 get rev of item
4710: 69 6e 20 63 68 61 6e 67 65 73 65 74 0a 09 09 09 in changeset....
4720: 09 09 20 20 20 20 20 41 4e 44 20 20 20 20 43 2e .. AND C.
4730: 63 69 64 20 20 3d 20 43 49 2e 63 69 64 20 2d 2d cid = CI.cid --
4740: 20 67 65 74 20 63 68 61 6e 67 65 73 65 74 20 6f get changeset o
4750: 66 20 69 74 65 6d 0a 09 09 09 09 09 20 20 20 20 f item......
4760: 20 41 4e 44 20 20 20 20 43 2e 74 79 70 65 20 3d AND C.type =
4770: 20 30 20 20 20 20 20 20 2d 2d 20 6c 69 6d 69 74 0 -- limit
4780: 20 74 6f 20 72 65 76 20 63 73 65 74 73 0a 09 09 to rev csets...
4790: 09 09 09 20 20 20 20 20 29 20 41 53 20 55 0a 09 ... ) AS U..
47a0: 09 09 09 20 20 20 20 20 20 20 47 52 4f 55 50 20 ... GROUP
47b0: 42 59 20 55 2e 63 69 64 20 2d 2d 20 61 67 67 72 BY U.cid -- aggr
47c0: 65 67 61 74 65 20 62 79 20 63 73 65 74 73 2c 20 egate by csets,
47d0: 63 6f 75 6e 74 20 66 69 6c 65 73 2f 63 73 65 74 count files/cset
47e0: 0a 09 09 09 09 20 20 20 20 20 20 29 20 41 53 20 ..... ) AS
47f0: 55 55 2c 0a 09 09 09 09 20 20 20 20 20 20 28 53 UU,..... (S
4800: 45 4c 45 43 54 20 56 2e 63 69 64 20 20 20 20 20 ELECT V.cid
4810: 20 20 20 20 41 53 20 63 69 64 2c 20 20 20 2d 2d AS cid, --
4820: 20 72 65 76 20 63 68 61 6e 67 65 73 65 74 0a 09 rev changeset..
4830: 09 09 09 20 20 20 20 20 20 20 20 20 20 20 20 20 ...
4840: 20 43 4f 55 4e 54 20 28 56 2e 69 69 64 29 20 41 COUNT (V.iid) A
4850: 53 20 72 63 6f 75 6e 74 20 2d 2d 20 6e 75 6d 62 S rcount -- numb
4860: 65 72 20 6f 66 20 69 74 65 6d 73 0a 09 09 09 09 er of items.....
4870: 20 20 20 20 20 20 20 46 52 4f 4d 20 20 20 63 73 FROM cs
4880: 69 74 65 6d 20 56 2c 20 63 68 61 6e 67 65 73 65 item V, changese
4890: 74 20 58 0a 09 09 09 09 20 20 20 20 20 20 20 57 t X..... W
48a0: 48 45 52 45 20 20 58 2e 63 69 64 20 20 3d 20 56 HERE X.cid = V
48b0: 2e 63 69 64 20 20 2d 2d 20 67 65 74 20 63 68 61 .cid -- get cha
48c0: 6e 67 65 73 65 74 20 6f 66 20 69 74 65 6d 0a 09 ngeset of item..
48d0: 09 09 09 20 20 20 20 20 20 20 41 4e 44 20 20 20 ... AND
48e0: 20 58 2e 74 79 70 65 20 3d 20 30 20 20 20 20 20 X.type = 0
48f0: 20 2d 2d 20 6c 69 6d 69 74 20 74 6f 20 72 65 76 -- limit to rev
4900: 20 63 73 65 74 73 0a 09 09 09 09 20 20 20 20 20 csets.....
4910: 20 20 47 52 4f 55 50 20 42 59 20 56 2e 63 69 64 GROUP BY V.cid
4920: 20 20 20 20 20 20 20 20 20 2d 2d 20 61 67 67 72 -- aggr
4930: 65 67 61 74 65 20 62 79 20 63 73 65 74 73 2c 20 egate by csets,
4940: 63 6f 75 6e 74 20 69 74 65 6d 73 2f 63 73 65 74 count items/cset
4950: 0a 09 09 09 09 20 20 20 20 20 20 29 20 41 53 20 ..... ) AS
4960: 56 56 0a 09 09 09 09 20 57 48 45 52 45 20 56 56 VV..... WHERE VV
4970: 2e 63 69 64 20 3d 20 55 55 2e 63 69 64 20 20 20 .cid = UU.cid
4980: 20 20 20 20 20 2d 2d 20 73 79 6e 63 20 23 69 74 -- sync #it
4990: 65 6d 73 2f 63 73 65 74 20 77 69 74 68 20 23 66 ems/cset with #f
49a0: 69 6c 65 73 2f 63 73 65 74 0a 09 09 09 09 20 41 iles/cset..... A
49b0: 4e 44 20 20 20 55 55 2e 66 63 6f 75 6e 74 20 3c ND UU.fcount <
49c0: 20 56 56 2e 72 63 6f 75 6e 74 20 20 2d 2d 20 6c VV.rcount -- l
49d0: 65 73 73 20 66 69 6c 65 73 20 74 68 61 6e 20 69 ess files than i
49e0: 74 65 6d 73 0a 09 09 09 09 20 20 20 20 20 20 20 tems.....
49f0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
4a00: 20 20 20 20 20 20 20 2d 2d 20 3d 3e 20 69 74 65 -- => ite
4a10: 6d 73 20 62 65 6c 6f 6e 67 20 74 6f 20 74 68 65 ms belong to the
4a20: 20 73 61 6d 65 20 66 69 6c 65 2e 0a 09 09 09 09 same file......
4a30: 29 0a 09 09 41 4e 44 20 20 20 20 54 2e 74 69 64 )...AND T.tid
4a40: 20 3d 20 43 2e 74 79 70 65 20 2d 2d 20 67 65 74 = C.type -- get
4a50: 20 72 65 61 64 61 62 6c 65 20 63 68 61 6e 67 65 readable change
4a60: 73 65 74 20 74 79 70 65 0a 09 20 20 20 20 7d 0a set type.. }.
4a70: 09 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 .return. }..
4a80: 20 20 20 70 72 6f 63 20 54 61 67 43 68 61 6e 67 proc TagChang
4a90: 65 73 65 74 73 20 7b 7d 20 7b 0a 09 23 20 54 68 esets {} {..# Th
4aa0: 69 73 20 63 6f 64 65 20 70 65 72 66 6f 72 6d 73 is code performs
4ab0: 20 61 20 6e 75 6d 62 65 72 20 6f 66 20 70 61 72 a number of par
4ac0: 61 6e 6f 69 64 20 63 68 65 63 6b 73 20 6f 66 20 anoid checks of
4ad0: 74 68 65 0a 09 23 20 64 61 74 61 62 61 73 65 2c the..# database,
4ae0: 20 73 65 61 72 63 68 69 6e 67 20 66 6f 72 20 69 searching for i
4af0: 6e 63 6f 6e 73 69 73 74 65 6e 74 20 63 68 61 6e nconsistent chan
4b00: 67 65 73 65 74 2f 72 65 76 69 73 69 6f 6e 0a 09 geset/revision..
4b10: 23 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 2e 0a 0a # information...
4b20: 09 75 70 76 61 72 20 31 20 6e 20 6e 20 3b 20 23 .upvar 1 n n ; #
4b30: 20 43 6f 75 6e 74 65 72 20 66 6f 72 20 74 68 65 Counter for the
4b40: 20 63 68 65 63 6b 73 20 28 77 65 20 70 72 69 6e checks (we prin
4b50: 74 20 61 6e 20 69 64 20 62 65 66 6f 72 65 0a 09 t an id before..
4b60: 09 20 20 20 20 20 20 23 20 74 68 65 20 6d 61 69 . # the mai
4b70: 6e 20 6c 61 62 65 6c 29 2e 0a 0a 09 23 20 46 69 n label)....# Fi
4b80: 6e 64 20 61 6c 6c 20 74 61 67 73 20 77 68 69 63 nd all tags whic
4b90: 68 20 61 72 65 20 6e 6f 74 20 75 73 65 64 20 62 h are not used b
4ba0: 79 20 61 74 20 6c 65 61 73 74 20 6f 6e 65 20 63 y at least one c
4bb0: 68 61 6e 67 65 73 65 74 2e 0a 09 43 68 65 63 6b hangeset...Check
4bc0: 54 61 67 20 5c 0a 09 20 20 20 20 7b 41 6c 6c 20 Tag \.. {All
4bd0: 74 61 67 73 20 68 61 76 65 20 74 6f 20 62 65 20 tags have to be
4be0: 75 73 65 64 20 62 79 20 6c 65 61 73 74 20 6f 6e used by least on
4bf0: 65 20 63 68 61 6e 67 65 73 65 74 7d 20 5c 0a 09 e changeset} \..
4c00: 20 20 20 20 7b 69 73 20 6e 6f 74 20 75 73 65 64 {is not used
4c10: 20 62 79 20 61 20 74 61 67 20 73 79 6d 62 6f 6c by a tag symbol
4c20: 20 63 68 61 6e 67 65 73 65 74 7d 20 7b 0a 09 09 changeset} {...
4c30: 2d 2d 20 55 6e 75 73 65 64 20 74 61 67 73 20 3d -- Unused tags =
4c40: 20 41 6c 6c 20 74 61 67 73 0a 09 09 2d 2d 20 20 All tags...--
4c50: 20 20 20 20 20 20 20 20 20 20 20 2d 20 72 65 76 - rev
4c60: 69 73 69 6f 6e 73 20 75 73 65 64 20 62 79 20 74 isions used by t
4c70: 61 67 20 63 68 61 6e 67 65 73 65 74 73 2e 0a 09 ag changesets...
4c80: 09 2d 2d 0a 09 09 2d 2d 20 42 6f 74 68 20 73 65 .--...-- Both se
4c90: 74 73 20 63 61 6e 20 62 65 20 63 6f 6d 70 75 74 ts can be comput
4ca0: 65 64 20 65 61 73 69 6c 79 2c 20 61 6e 64 20 73 ed easily, and s
4cb0: 75 62 74 72 61 63 74 65 64 0a 20 20 20 20 20 20 ubtracted.
4cc0: 20 20 20 20 20 20 20 20 20 20 2d 2d 20 66 72 6f -- fro
4cd0: 6d 20 65 61 63 68 20 6f 74 68 65 72 2e 20 54 68 m each other. Th
4ce0: 65 6e 20 77 65 20 63 61 6e 20 67 65 74 20 74 68 en we can get th
4cf0: 65 20 61 73 73 6f 63 69 61 74 65 64 0a 20 20 20 e associated.
4d00: 20 20 20 20 20 20 20 20 20 20 20 20 20 2d 2d 20 --
4d10: 66 69 6c 65 20 28 6e 61 6d 65 29 20 66 6f 72 20 file (name) for
4d20: 64 69 73 70 6c 61 79 2e 0a 0a 09 09 53 45 4c 45 display.....SELE
4d30: 43 54 20 50 2e 6e 61 6d 65 2c 20 53 2e 6e 61 6d CT P.name, S.nam
4d40: 65 0a 09 09 46 52 4f 4d 20 70 72 6f 6a 65 63 74 e...FROM project
4d50: 20 50 2c 20 74 61 67 20 54 2c 20 73 79 6d 62 6f P, tag T, symbo
4d60: 6c 20 53 0a 09 09 57 48 45 52 45 20 54 2e 74 69 l S...WHERE T.ti
4d70: 64 20 49 4e 20 28 53 45 4c 45 43 54 20 74 69 64 d IN (SELECT tid
4d80: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
4d90: 20 20 20 20 2d 2d 20 41 6c 6c 20 74 61 67 73 0a -- All tags.
4da0: 09 09 09 09 46 52 4f 4d 20 20 20 74 61 67 0a 09 ....FROM tag..
4db0: 09 09 09 45 58 43 45 50 54 20 20 20 20 20 20 20 ...EXCEPT
4dc0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
4dd0: 20 2d 2d 20 73 75 62 74 72 61 63 74 0a 09 09 09 -- subtract....
4de0: 09 53 45 4c 45 43 54 20 43 49 2e 69 69 64 20 20 .SELECT CI.iid
4df0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2d -
4e00: 2d 20 74 61 67 73 20 75 73 65 64 0a 09 09 09 09 - tags used.....
4e10: 46 52 4f 4d 20 20 20 63 73 69 74 65 6d 20 43 49 FROM csitem CI
4e20: 2c 20 63 68 61 6e 67 65 73 65 74 20 43 0a 09 09 , changeset C...
4e30: 09 09 57 48 45 52 45 20 20 43 2e 63 69 64 20 3d ..WHERE C.cid =
4e40: 20 43 49 2e 63 69 64 20 20 20 20 20 20 20 20 20 CI.cid
4e50: 2d 2d 20 62 79 20 61 6e 79 20 74 61 67 0a 09 09 -- by any tag...
4e60: 09 09 41 4e 44 20 20 20 20 43 2e 74 79 70 65 20 ..AND C.type
4e70: 3d 20 31 29 20 20 20 20 20 20 20 20 20 20 20 20 = 1)
4e80: 2d 2d 20 63 68 61 6e 67 65 73 65 74 0a 09 09 41 -- changeset...A
4e90: 4e 44 20 20 20 53 2e 73 69 64 20 3d 20 54 2e 73 ND S.sid = T.s
4ea0: 69 64 20 20 20 20 20 20 20 20 20 20 20 20 20 20 id
4eb0: 20 2d 2d 20 67 65 74 20 73 79 6d 62 6f 6c 20 6f -- get symbol o
4ec0: 66 20 74 61 67 0a 09 09 41 4e 44 20 20 20 50 2e f tag...AND P.
4ed0: 70 69 64 20 3d 20 53 2e 70 69 64 20 20 20 20 20 pid = S.pid
4ee0: 20 20 20 20 20 20 20 20 20 20 2d 2d 20 67 65 74 -- get
4ef0: 20 70 72 6f 6a 65 63 74 20 6f 66 20 73 79 6d 62 project of symb
4f00: 6f 6c 0a 09 20 20 20 20 7d 0a 09 23 20 46 69 6e ol.. }..# Fin
4f10: 64 20 61 6c 6c 20 74 61 67 73 20 77 68 69 63 68 d all tags which
4f20: 20 61 72 65 20 75 73 65 64 20 62 79 20 6d 6f 72 are used by mor
4f30: 65 20 74 68 61 6e 20 6f 6e 65 20 63 68 61 6e 67 e than one chang
4f40: 65 73 65 74 2e 0a 09 43 68 65 63 6b 52 65 76 20 eset...CheckRev
4f50: 5c 0a 09 20 20 20 20 7b 41 6c 6c 20 74 61 67 73 \.. {All tags
4f60: 20 68 61 76 65 20 74 6f 20 62 65 20 75 73 65 64 have to be used
4f70: 20 62 79 20 61 74 20 6d 6f 73 74 20 6f 6e 65 20 by at most one
4f80: 63 68 61 6e 67 65 73 65 74 7d 20 5c 0a 09 20 20 changeset} \..
4f90: 20 20 7b 69 73 20 75 73 65 64 20 62 79 20 6d 75 {is used by mu
4fa0: 6c 74 69 70 6c 65 20 63 68 61 6e 67 65 73 65 74 ltiple changeset
4fb0: 73 7d 20 7b 0a 09 09 2d 2d 20 50 72 69 6e 63 69 s} {...-- Princi
4fc0: 70 6c 65 20 6f 66 20 6f 70 65 72 61 74 69 6f 6e ple of operation
4fd0: 3a 20 47 65 74 20 61 6c 6c 20 74 61 67 2f 63 68 : Get all tag/ch
4fe0: 61 6e 67 65 73 65 74 20 70 61 69 72 73 0a 20 20 angeset pairs.
4ff0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2d 2d --
5000: 20 66 6f 72 20 61 6c 6c 20 74 61 67 20 63 68 61 for all tag cha
5010: 6e 67 65 73 65 74 73 2c 20 67 72 6f 75 70 20 62 ngesets, group b
5020: 79 20 74 61 67 20 74 6f 20 61 67 67 72 65 67 61 y tag to aggrega
5030: 74 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 te.
5040: 20 20 20 2d 2d 20 74 68 65 20 63 68 61 6e 67 65 -- the change
5050: 73 65 74 2c 20 63 6f 75 6e 74 69 6e 67 20 74 68 set, counting th
5060: 65 6d 2e 20 46 72 6f 6d 20 74 68 65 20 72 65 73 em. From the res
5070: 75 6c 74 69 6e 67 0a 20 20 20 20 20 20 20 20 20 ulting.
5080: 20 20 20 20 20 20 20 2d 2d 20 74 61 67 2f 63 6f -- tag/co
5090: 75 6e 74 20 74 61 62 6c 65 20 73 65 6c 65 63 74 unt table select
50a0: 20 74 68 6f 73 65 20 77 69 74 68 20 6d 6f 72 65 those with more
50b0: 20 74 68 61 6e 20 6f 6e 65 0a 20 20 20 20 20 20 than one.
50c0: 20 20 20 20 20 20 20 20 20 20 2d 2d 20 75 73 65 -- use
50d0: 72 2c 20 61 6e 64 20 67 65 74 20 74 68 65 69 72 r, and get their
50e0: 20 61 73 73 6f 63 69 61 74 65 64 20 66 69 6c 65 associated file
50f0: 20 28 6e 61 6d 65 29 20 66 6f 72 0a 20 20 20 20 (name) for.
5100: 20 20 20 20 20 20 20 20 20 20 20 20 2d 2d 20 64 -- d
5110: 69 73 70 6c 61 79 2e 0a 0a 09 09 53 45 4c 45 43 isplay.....SELEC
5120: 54 20 50 2e 6e 61 6d 65 2c 20 53 2e 6e 61 6d 65 T P.name, S.name
5130: 0a 09 09 46 52 4f 4d 20 74 61 67 20 54 2c 20 70 ...FROM tag T, p
5140: 72 6f 6a 65 63 74 20 50 2c 20 73 79 6d 62 6f 6c roject P, symbol
5150: 20 53 2c 0a 09 09 20 20 20 20 20 28 53 45 4c 45 S,... (SELE
5160: 43 54 20 43 49 2e 69 69 64 20 20 20 20 20 20 20 CT CI.iid
5170: 20 41 53 20 69 69 64 2c 20 20 2d 2d 20 69 74 65 AS iid, -- ite
5180: 6d 0a 09 09 20 20 20 20 20 20 20 20 20 20 20 20 m...
5190: 20 63 6f 75 6e 74 28 43 49 2e 63 69 64 29 20 41 count(CI.cid) A
51a0: 53 20 63 6f 75 6e 74 20 2d 2d 20 6e 75 6d 62 65 S count -- numbe
51b0: 72 20 6f 66 20 63 73 65 74 73 20 75 73 69 6e 67 r of csets using
51c0: 20 69 74 65 6d 0a 09 09 20 20 20 20 20 20 46 52 item... FR
51d0: 4f 4d 20 63 73 69 74 65 6d 20 43 49 2c 20 63 68 OM csitem CI, ch
51e0: 61 6e 67 65 73 65 74 20 43 0a 09 09 20 20 20 20 angeset C...
51f0: 20 20 57 48 45 52 45 20 43 2e 74 79 70 65 20 3d WHERE C.type =
5200: 20 31 20 20 20 20 20 20 20 2d 2d 20 6c 69 6d 69 1 -- limi
5210: 74 20 74 6f 20 74 61 67 20 63 73 65 74 73 0a 09 t to tag csets..
5220: 09 20 20 20 20 20 20 41 4e 44 20 20 20 43 2e 63 . AND C.c
5230: 69 64 20 20 3d 20 43 49 2e 63 69 64 20 20 2d 2d id = CI.cid --
5240: 20 67 65 74 20 69 74 65 6d 73 20 6f 66 20 63 73 get items of cs
5250: 65 74 0a 09 09 20 20 20 20 20 20 47 52 4f 55 50 et... GROUP
5260: 20 42 59 20 43 49 2e 69 69 64 20 20 20 20 20 20 BY CI.iid
5270: 20 20 2d 2d 20 61 67 67 72 65 67 61 74 65 20 62 -- aggregate b
5280: 79 20 69 74 65 6d 2c 20 63 6f 75 6e 74 20 63 73 y item, count cs
5290: 65 74 73 2f 69 74 65 6d 0a 09 09 20 20 20 20 20 ets/item...
52a0: 29 20 41 53 20 55 0a 09 09 57 48 45 52 45 20 55 ) AS U...WHERE U
52b0: 2e 63 6f 75 6e 74 20 3e 20 31 20 20 20 20 20 20 .count > 1
52c0: 20 20 20 20 20 20 2d 2d 20 66 69 6e 64 20 74 61 -- find ta
52d0: 67 20 69 74 65 6d 20 75 73 65 64 20 6d 75 6c 74 g item used mult
52e0: 69 70 6c 65 20 74 69 6d 65 73 0a 09 09 41 4e 44 iple times...AND
52f0: 20 20 20 54 2e 74 69 64 20 3d 20 55 2e 69 69 64 T.tid = U.iid
5300: 20 20 20 20 20 20 20 20 20 20 2d 2d 20 67 65 74 -- get
5310: 20 74 61 67 20 6f 66 20 69 74 65 6d 0a 09 09 41 tag of item...A
5320: 4e 44 20 20 20 53 2e 73 69 64 20 3d 20 54 2e 73 ND S.sid = T.s
5330: 69 64 20 20 20 20 20 20 20 20 20 20 2d 2d 20 67 id -- g
5340: 65 74 20 73 79 6d 62 6f 6c 20 6f 66 20 74 61 67 et symbol of tag
5350: 0a 09 09 41 4e 44 20 20 20 50 2e 70 69 64 20 3d ...AND P.pid =
5360: 20 53 2e 70 69 64 20 20 20 20 20 20 20 20 20 20 S.pid
5370: 2d 2d 20 67 65 74 20 70 72 6f 6a 65 63 74 20 6f -- get project o
5380: 66 20 73 79 6d 62 6f 6c 0a 09 20 20 20 20 7d 0a f symbol.. }.
5390: 09 69 66 20 30 20 7b 0a 09 20 20 20 20 23 20 54 .if 0 {.. # T
53a0: 68 69 73 20 63 68 65 63 6b 20 69 73 20 64 69 73 his check is dis
53b0: 61 62 6c 65 64 20 66 6f 72 20 74 68 65 20 6d 6f abled for the mo
53c0: 6d 65 6e 74 2e 20 41 70 70 61 72 65 6e 74 6c 79 ment. Apparently
53d0: 20 74 61 67 73 0a 09 20 20 20 20 23 20 63 61 6e tags.. # can
53e0: 20 63 72 6f 73 73 20 6c 69 6e 65 73 20 6f 66 20 cross lines of
53f0: 64 65 76 65 6c 6f 70 6d 65 6e 74 2c 20 61 74 20 development, at
5400: 6c 65 61 73 74 20 69 66 20 74 68 65 20 69 6e 76 least if the inv
5410: 6f 6c 76 65 64 0a 09 20 20 20 20 23 20 4c 4f 44 olved.. # LOD
5420: 73 20 61 72 65 20 74 68 65 20 74 72 75 6e 6b 2c s are the trunk,
5430: 20 61 6e 64 20 74 68 65 20 4e 54 44 42 2e 20 54 and the NTDB. T
5440: 68 61 74 20 6d 61 6b 65 73 20 73 65 6e 73 65 2c hat makes sense,
5450: 20 61 73 0a 09 20 20 20 20 23 20 74 68 65 20 4e as.. # the N
5460: 54 44 42 20 72 65 76 69 73 69 6f 6e 73 20 61 72 TDB revisions ar
5470: 65 20 69 6e 69 74 69 61 6c 6c 79 20 6c 6f 67 69 e initially logi
5480: 63 61 6c 6c 79 20 61 20 70 61 72 74 20 6f 66 20 cally a part of
5490: 74 68 65 0a 09 20 20 20 20 23 20 74 72 75 6e 6b the.. # trunk
54a0: 2e 20 54 68 65 20 73 74 61 6e 64 61 72 64 20 63 . The standard c
54b0: 68 65 63 6b 20 62 65 6c 6f 77 20 68 6f 77 65 76 heck below howev
54c0: 65 72 20 64 6f 65 73 20 6e 6f 74 20 63 61 70 74 er does not capt
54d0: 75 72 65 0a 09 20 20 20 20 23 20 74 68 69 73 2e ure.. # this.
54e0: 20 57 68 65 6e 20 49 20 6d 61 6e 61 67 65 20 74 When I manage t
54f0: 6f 20 72 65 70 68 72 61 73 65 20 69 74 20 74 6f o rephrase it to
5500: 20 61 63 63 65 70 74 20 74 68 69 73 20 74 79 70 accept this typ
5510: 65 0a 09 20 20 20 20 23 20 6f 66 20 63 72 6f 73 e.. # of cros
5520: 73 2d 6f 76 65 72 20 69 74 20 77 69 6c 6c 20 62 s-over it will b
5530: 65 20 72 65 2d 61 63 74 69 76 61 74 65 64 2e 0a e re-activated..
5540: 0a 09 20 20 20 20 23 20 41 6c 6c 20 74 61 67 73 .. # All tags
5550: 20 68 61 76 65 20 74 6f 20 61 67 72 65 65 20 6f have to agree o
5560: 6e 20 74 68 65 20 4c 4f 44 20 74 68 65 69 72 20 n the LOD their
5570: 63 68 61 6e 67 65 73 65 74 0a 09 20 20 20 20 23 changeset.. #
5580: 20 62 65 6c 6f 6e 67 73 20 74 6f 2e 20 49 6e 20 belongs to. In
5590: 6f 74 68 65 72 20 77 6f 72 64 73 2c 20 61 6c 6c other words, all
55a0: 20 74 61 67 73 20 69 6e 20 61 20 63 68 61 6e 67 tags in a chang
55b0: 65 73 65 74 20 68 61 76 65 0a 09 20 20 20 20 23 eset have.. #
55c0: 20 74 6f 20 72 65 66 65 72 20 74 6f 20 74 68 65 to refer to the
55d0: 20 73 61 6d 65 20 6c 69 6e 65 20 6f 66 20 64 65 same line of de
55e0: 76 65 6c 6f 70 6d 65 6e 74 2e 0a 09 20 20 20 20 velopment...
55f0: 23 0a 09 20 20 20 20 23 20 49 6e 73 74 65 61 64 #.. # Instead
5600: 20 6f 66 20 6c 6f 6f 6b 69 6e 67 20 61 74 20 61 of looking at a
5610: 6c 6c 20 70 61 69 72 73 20 6f 66 20 74 61 67 73 ll pairs of tags
5620: 20 69 6e 20 61 6c 6c 0a 09 20 20 20 20 23 20 63 in all.. # c
5630: 68 61 6e 67 65 73 65 74 73 20 77 65 20 67 65 6e hangesets we gen
5640: 65 72 61 74 65 20 74 68 65 20 64 69 73 74 69 6e erate the distin
5650: 63 74 20 73 65 74 20 6f 66 20 61 6c 6c 20 4c 4f ct set of all LO
5660: 44 73 0a 09 20 20 20 20 23 20 72 65 66 65 72 65 Ds.. # refere
5670: 6e 63 65 64 20 62 79 20 74 68 65 20 74 61 67 73 nced by the tags
5680: 20 6f 66 20 61 20 63 68 61 6e 67 65 73 65 74 2c of a changeset,
5690: 20 6c 6f 6f 6b 20 66 6f 72 20 74 68 6f 73 65 0a look for those.
56a0: 09 20 20 20 20 23 20 77 69 74 68 20 63 61 72 64 . # with card
56b0: 69 6e 61 6c 69 74 79 20 3e 20 31 2c 20 61 6e 64 inality > 1, and
56c0: 20 67 65 74 20 74 68 65 20 69 64 65 6e 74 69 66 get the identif
56d0: 79 69 6e 67 0a 09 20 20 20 20 23 20 69 6e 66 6f ying.. # info
56e0: 72 6d 61 74 69 6f 6e 20 66 6f 72 20 74 68 65 20 rmation for the
56f0: 63 68 61 6e 67 65 73 65 74 73 20 66 6f 75 6e 64 changesets found
5700: 20 74 68 75 73 6c 79 2e 0a 09 20 20 20 20 43 68 thusly... Ch
5710: 65 63 6b 43 53 20 5c 0a 09 09 7b 41 6c 6c 20 74 eckCS \...{All t
5720: 61 67 73 20 69 6e 20 61 20 63 68 61 6e 67 65 73 ags in a changes
5730: 65 74 20 68 61 76 65 20 74 6f 20 62 65 6c 6f 6e et have to belon
5740: 67 20 74 6f 20 74 68 65 20 73 61 6d 65 20 4c 4f g to the same LO
5750: 44 7d 20 5c 0a 09 09 7b 3a 20 49 74 73 20 74 61 D} \...{: Its ta
5760: 67 73 20 64 69 73 61 67 72 65 65 20 61 62 6f 75 gs disagree abou
5770: 74 20 74 68 65 20 4c 4f 44 20 74 68 65 79 20 62 t the LOD they b
5780: 65 6c 6f 6e 67 20 74 6f 7d 20 7b 0a 09 09 20 20 elong to} {...
5790: 20 20 53 45 4c 45 43 54 20 54 2e 6e 61 6d 65 2c SELECT T.name,
57a0: 20 43 2e 63 69 64 0a 09 09 20 20 20 20 46 52 4f C.cid... FRO
57b0: 4d 20 20 20 63 68 61 6e 67 65 73 65 74 20 43 2c M changeset C,
57c0: 20 63 73 74 79 70 65 20 54 0a 09 09 20 20 20 20 cstype T...
57d0: 57 48 45 52 45 20 20 43 2e 63 69 64 20 49 4e 20 WHERE C.cid IN
57e0: 28 53 45 4c 45 43 54 20 55 2e 63 69 64 0a 09 09 (SELECT U.cid...
57f0: 09 09 20 20 20 20 20 46 52 4f 4d 20 28 53 45 4c .. FROM (SEL
5800: 45 43 54 20 44 49 53 54 49 4e 43 54 20 43 49 2e ECT DISTINCT CI.
5810: 63 69 64 20 41 53 20 63 69 64 2c 20 54 2e 6c 6f cid AS cid, T.lo
5820: 64 20 41 53 20 6c 6f 64 0a 09 09 09 09 09 20 20 d AS lod......
5830: 20 46 52 4f 4d 20 20 20 63 73 69 74 65 6d 20 43 FROM csitem C
5840: 49 2c 20 63 68 61 6e 67 65 73 65 74 20 43 2c 20 I, changeset C,
5850: 74 61 67 20 54 0a 09 09 09 09 09 20 20 20 57 48 tag T...... WH
5860: 45 52 45 20 20 43 49 2e 69 69 64 20 3d 20 54 2e ERE CI.iid = T.
5870: 74 69 64 0a 09 09 09 09 09 20 20 20 41 4e 44 20 tid...... AND
5880: 20 20 20 43 2e 63 69 64 20 3d 20 43 49 2e 63 69 C.cid = CI.ci
5890: 64 0a 09 09 09 09 09 20 20 20 41 4e 44 20 20 20 d...... AND
58a0: 20 43 2e 74 79 70 65 20 3d 20 31 29 20 41 53 20 C.type = 1) AS
58b0: 55 0a 09 09 09 09 20 20 20 20 20 47 52 4f 55 50 U..... GROUP
58c0: 20 42 59 20 55 2e 63 69 64 20 48 41 56 49 4e 47 BY U.cid HAVING
58d0: 20 43 4f 55 4e 54 28 55 2e 6c 6f 64 29 20 3e 20 COUNT(U.lod) >
58e0: 31 29 0a 09 09 20 20 20 20 41 4e 44 20 20 20 20 1)... AND
58f0: 54 2e 74 69 64 20 3d 20 43 2e 74 79 70 65 0a 09 T.tid = C.type..
5900: 09 7d 0a 09 7d 0a 09 23 20 41 6c 6c 20 74 61 67 .}..}..# All tag
5910: 73 20 68 61 76 65 20 74 6f 20 61 67 72 65 65 20 s have to agree
5920: 6f 6e 20 74 68 65 20 70 72 6f 6a 65 63 74 20 74 on the project t
5930: 68 65 69 72 20 63 68 61 6e 67 65 73 65 74 0a 09 heir changeset..
5940: 23 20 62 65 6c 6f 6e 67 73 20 74 6f 2e 20 49 6e # belongs to. In
5950: 20 6f 74 68 65 72 20 77 6f 72 64 73 2c 20 61 6c other words, al
5960: 6c 20 74 61 67 73 20 69 6e 20 61 20 63 68 61 6e l tags in a chan
5970: 67 65 73 65 74 20 68 61 76 65 20 74 6f 0a 09 23 geset have to..#
5980: 20 72 65 66 65 72 20 74 6f 20 74 68 65 20 73 61 refer to the sa
5990: 6d 65 20 70 72 6f 6a 65 63 74 2e 0a 09 23 0a 09 me project...#..
59a0: 23 20 49 6e 73 74 65 61 64 20 6f 66 20 6c 6f 6f # Instead of loo
59b0: 6b 69 6e 67 20 61 74 20 61 6c 6c 20 70 61 69 72 king at all pair
59c0: 73 20 6f 66 20 74 61 67 73 20 69 6e 20 61 6c 6c s of tags in all
59d0: 20 63 68 61 6e 67 65 73 65 74 73 20 77 65 0a 09 changesets we..
59e0: 23 20 67 65 6e 65 72 61 74 65 20 74 68 65 20 64 # generate the d
59f0: 69 73 74 69 6e 63 74 20 73 65 74 20 6f 66 20 61 istinct set of a
5a00: 6c 6c 20 70 72 6f 6a 65 63 74 73 20 72 65 66 65 ll projects refe
5a10: 72 65 6e 63 65 64 20 62 79 20 74 68 65 0a 09 23 renced by the..#
5a20: 20 74 61 67 73 20 6f 66 20 61 20 63 68 61 6e 67 tags of a chang
5a30: 65 73 65 74 2c 20 6c 6f 6f 6b 20 66 6f 72 20 74 eset, look for t
5a40: 68 6f 73 65 20 77 69 74 68 20 63 61 72 64 69 6e hose with cardin
5a50: 61 6c 69 74 79 20 3e 20 31 2c 0a 09 23 20 61 6e ality > 1,..# an
5a60: 64 20 67 65 74 20 74 68 65 20 69 64 65 6e 74 69 d get the identi
5a70: 66 79 69 6e 67 20 69 6e 66 6f 72 6d 61 74 69 6f fying informatio
5a80: 6e 20 66 6f 72 20 74 68 65 20 63 68 61 6e 67 65 n for the change
5a90: 73 65 74 73 20 66 6f 75 6e 64 0a 09 23 20 74 68 sets found..# th
5aa0: 75 73 6c 79 2e 0a 09 43 68 65 63 6b 43 53 20 5c usly...CheckCS \
5ab0: 0a 09 20 20 20 20 7b 41 6c 6c 20 74 61 67 73 20 .. {All tags
5ac0: 69 6e 20 61 20 63 68 61 6e 67 65 73 65 74 20 68 in a changeset h
5ad0: 61 76 65 20 74 6f 20 62 65 6c 6f 6e 67 20 74 6f ave to belong to
5ae0: 20 74 68 65 20 73 61 6d 65 20 70 72 6f 6a 65 63 the same projec
5af0: 74 7d 20 5c 0a 09 20 20 20 20 7b 3a 20 49 74 73 t} \.. {: Its
5b00: 20 74 61 67 73 20 64 69 73 61 67 72 65 65 20 61 tags disagree a
5b10: 62 6f 75 74 20 74 68 65 20 70 72 6f 6a 65 63 74 bout the project
5b20: 20 74 68 65 79 20 62 65 6c 6f 6e 67 20 74 6f 7d they belong to}
5b30: 20 7b 0a 09 09 53 45 4c 45 43 54 20 54 2e 6e 61 {...SELECT T.na
5b40: 6d 65 2c 20 43 2e 63 69 64 0a 09 09 46 52 4f 4d me, C.cid...FROM
5b50: 20 20 20 63 68 61 6e 67 65 73 65 74 20 43 2c 20 changeset C,
5b60: 63 73 74 79 70 65 20 54 0a 09 09 57 48 45 52 45 cstype T...WHERE
5b70: 20 20 43 2e 63 69 64 20 49 4e 20 28 53 45 4c 45 C.cid IN (SELE
5b80: 43 54 20 55 2e 63 69 64 0a 09 09 09 09 20 46 52 CT U.cid..... FR
5b90: 4f 4d 20 28 53 45 4c 45 43 54 20 44 49 53 54 49 OM (SELECT DISTI
5ba0: 4e 43 54 20 20 20 20 20 20 20 2d 2d 20 75 6e 69 NCT -- uni
5bb0: 71 75 65 20 63 73 65 74 2f 70 72 6f 6a 20 70 61 que cset/proj pa
5bc0: 69 72 73 0a 09 09 09 09 20 20 20 20 20 20 20 20 irs.....
5bd0: 20 20 20 20 20 20 43 49 2e 63 69 64 20 41 53 20 CI.cid AS
5be0: 63 69 64 2c 20 2d 2d 20 74 61 67 20 63 73 65 74 cid, -- tag cset
5bf0: 0a 09 09 09 09 20 20 20 20 20 20 20 20 20 20 20 .....
5c00: 20 20 20 46 2e 70 69 64 20 20 41 53 20 70 69 64 F.pid AS pid
5c10: 20 20 2d 2d 20 70 72 6f 6a 65 63 74 20 6f 66 20 -- project of
5c20: 69 74 65 6d 20 69 6e 20 63 73 65 74 0a 09 09 09 item in cset....
5c30: 09 20 20 20 20 20 20 20 46 52 4f 4d 20 20 20 63 . FROM c
5c40: 73 69 74 65 6d 20 43 49 2c 20 63 68 61 6e 67 65 sitem CI, change
5c50: 73 65 74 20 43 2c 20 74 61 67 20 54 2c 20 66 69 set C, tag T, fi
5c60: 6c 65 20 46 0a 09 09 09 09 20 20 20 20 20 20 20 le F.....
5c70: 57 48 45 52 45 20 20 43 49 2e 69 69 64 20 3d 20 WHERE CI.iid =
5c80: 54 2e 74 69 64 20 20 2d 2d 20 67 65 74 20 74 61 T.tid -- get ta
5c90: 67 20 6f 66 20 69 74 65 6d 20 69 6e 20 63 73 65 g of item in cse
5ca0: 74 0a 09 09 09 09 20 20 20 20 20 20 20 41 4e 44 t..... AND
5cb0: 20 20 20 20 43 2e 63 69 64 20 20 3d 20 43 49 2e C.cid = CI.
5cc0: 63 69 64 20 2d 2d 20 67 65 74 20 63 68 61 6e 67 cid -- get chang
5cd0: 65 73 65 74 20 6f 66 20 69 74 65 6d 0a 09 09 09 eset of item....
5ce0: 09 20 20 20 20 20 20 20 41 4e 44 20 20 20 20 43 . AND C
5cf0: 2e 74 79 70 65 20 3d 20 31 20 20 20 20 20 20 2d .type = 1 -
5d00: 2d 20 6c 69 6d 69 74 20 74 6f 20 74 61 67 20 63 - limit to tag c
5d10: 68 61 6e 67 65 73 65 74 73 0a 09 09 09 09 20 20 hangesets.....
5d20: 20 20 20 20 20 41 4e 44 20 20 20 20 46 2e 66 69 AND F.fi
5d30: 64 20 20 3d 20 54 2e 66 69 64 20 20 2d 2d 20 67 d = T.fid -- g
5d40: 65 74 20 66 69 6c 65 20 6f 66 20 74 61 67 0a 20 et file of tag.
5d50: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
5d60: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
5d70: 20 20 20 20 20 29 20 41 53 20 55 0a 09 09 09 09 ) AS U.....
5d80: 20 47 52 4f 55 50 20 42 59 20 55 2e 63 69 64 20 GROUP BY U.cid
5d90: 20 20 20 20 20 20 20 20 20 20 2d 2d 20 61 67 67 -- agg
5da0: 72 65 67 61 74 65 20 62 79 20 63 73 65 74 73 2c regate by csets,
5db0: 20 63 6f 75 6e 74 20 70 72 6f 6a 2f 63 73 65 74 count proj/cset
5dc0: 0a 09 09 09 09 20 48 41 56 49 4e 47 20 43 4f 55 ..... HAVING COU
5dd0: 4e 54 28 55 2e 70 69 64 29 20 3e 20 31 20 20 2d NT(U.pid) > 1 -
5de0: 2d 20 66 69 6e 64 20 63 73 65 74 73 20 77 69 74 - find csets wit
5df0: 68 20 6d 75 6c 74 69 70 6c 65 20 70 72 6f 6a 65 h multiple proje
5e00: 63 74 73 0a 09 09 20 20 20 20 20 20 20 20 20 20 cts...
5e10: 20 20 20 20 20 20 29 0a 09 09 41 4e 44 20 20 20 )...AND
5e20: 20 54 2e 74 69 64 20 3d 20 43 2e 74 79 70 65 20 T.tid = C.type
5e30: 2d 2d 20 67 65 74 20 72 65 61 64 61 62 6c 65 20 -- get readable
5e40: 63 68 61 6e 67 65 73 65 74 20 74 79 70 65 0a 09 changeset type..
5e50: 20 20 20 20 7d 0a 09 23 20 41 6c 6c 20 74 61 67 }..# All tag
5e60: 73 20 69 6e 20 61 20 73 69 6e 67 6c 65 20 63 68 s in a single ch
5e70: 61 6e 67 65 73 65 74 20 68 61 76 65 20 74 6f 20 angeset have to
5e80: 62 65 6c 6f 6e 67 20 74 6f 20 64 69 66 66 65 72 belong to differ
5e90: 65 6e 74 0a 09 23 20 66 69 6c 65 73 2e 20 43 6f ent..# files. Co
5ea0: 6e 76 65 72 73 65 6c 79 3a 20 4e 6f 20 74 77 6f nversely: No two
5eb0: 20 74 61 67 73 20 6f 66 20 61 20 73 69 6e 67 6c tags of a singl
5ec0: 65 20 66 69 6c 65 20 61 72 65 20 61 6c 6c 6f 77 e file are allow
5ed0: 65 64 0a 09 23 20 74 6f 20 62 65 20 69 6e 20 74 ed..# to be in t
5ee0: 68 65 20 73 61 6d 65 20 63 68 61 6e 67 65 73 65 he same changese
5ef0: 74 2e 0a 09 23 0a 09 23 20 49 6e 73 74 65 61 64 t...#..# Instead
5f00: 20 6f 66 20 6c 6f 6f 6b 69 6e 67 20 61 74 20 61 of looking at a
5f10: 6c 6c 20 70 61 69 72 73 20 6f 66 20 74 61 67 73 ll pairs of tags
5f20: 20 69 6e 20 61 6c 6c 20 63 68 61 6e 67 65 73 65 in all changese
5f30: 74 73 20 77 65 0a 09 23 20 67 65 6e 65 72 61 74 ts we..# generat
5f40: 65 20 74 68 65 20 64 69 73 74 69 6e 63 74 20 73 e the distinct s
5f50: 65 74 20 6f 66 20 61 6c 6c 20 66 69 6c 65 73 20 et of all files
5f60: 72 65 66 65 72 65 6e 63 65 64 20 62 79 20 74 68 referenced by th
5f70: 65 0a 09 23 20 74 61 67 73 20 6f 66 20 61 20 63 e..# tags of a c
5f80: 68 61 6e 67 65 73 65 74 2c 20 61 6e 64 20 6c 6f hangeset, and lo
5f90: 6f 6b 20 66 6f 72 20 74 68 6f 73 65 20 77 69 74 ok for those wit
5fa0: 68 20 63 61 72 64 69 6e 61 6c 69 74 79 20 3c 0a h cardinality <.
5fb0: 09 23 20 74 68 65 20 63 61 72 64 69 6e 61 6c 69 .# the cardinali
5fc0: 74 79 20 6f 66 20 74 68 65 20 73 65 74 20 6f 66 ty of the set of
5fd0: 20 74 61 67 73 2c 20 61 6e 64 20 67 65 74 20 74 tags, and get t
5fe0: 68 65 20 69 64 65 6e 74 69 66 79 69 6e 67 0a 09 he identifying..
5ff0: 23 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 66 6f # information fo
6000: 72 20 74 68 65 20 63 68 61 6e 67 65 73 65 74 73 r the changesets
6010: 20 66 6f 75 6e 64 20 74 68 75 73 6c 79 2e 0a 09 found thusly...
6020: 43 68 65 63 6b 43 53 20 5c 0a 09 20 20 20 20 7b CheckCS \.. {
6030: 41 6c 6c 20 74 61 67 73 20 69 6e 20 61 20 63 68 All tags in a ch
6040: 61 6e 67 65 73 65 74 20 68 61 76 65 20 74 6f 20 angeset have to
6050: 62 65 6c 6f 6e 67 20 74 6f 20 64 69 66 66 65 72 belong to differ
6060: 65 6e 74 20 66 69 6c 65 73 7d 20 5c 0a 09 20 20 ent files} \..
6070: 20 20 7b 3a 20 49 74 73 20 74 61 67 73 20 73 68 {: Its tags sh
6080: 61 72 65 20 66 69 6c 65 73 7d 20 7b 0a 09 09 53 are files} {...S
6090: 45 4c 45 43 54 20 54 2e 6e 61 6d 65 2c 20 43 2e ELECT T.name, C.
60a0: 63 69 64 0a 09 09 46 52 4f 4d 20 20 20 63 68 61 cid...FROM cha
60b0: 6e 67 65 73 65 74 20 43 2c 20 63 73 74 79 70 65 ngeset C, cstype
60c0: 20 54 0a 09 09 57 48 45 52 45 20 20 43 2e 63 69 T...WHERE C.ci
60d0: 64 20 49 4e 20 28 53 45 4c 45 43 54 20 56 56 2e d IN (SELECT VV.
60e0: 63 69 64 0a 09 09 09 09 20 46 52 4f 4d 20 28 53 cid..... FROM (S
60f0: 45 4c 45 43 54 20 55 2e 63 69 64 20 20 20 20 20 ELECT U.cid
6100: 20 20 20 20 41 53 20 63 69 64 2c 20 20 20 2d 2d AS cid, --
6110: 20 63 68 61 6e 67 65 73 65 74 0a 09 09 09 09 20 changeset.....
6120: 20 20 20 20 20 20 20 20 20 20 20 20 20 43 4f 55 COU
6130: 4e 54 20 28 55 2e 66 69 64 29 20 41 53 20 66 63 NT (U.fid) AS fc
6140: 6f 75 6e 74 20 2d 2d 20 6e 75 6d 62 65 72 20 6f ount -- number o
6150: 66 20 66 69 6c 65 73 20 62 79 20 69 74 65 6d 73 f files by items
6160: 0a 09 09 09 09 20 20 20 20 20 20 20 46 52 4f 4d ..... FROM
6170: 20 28 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 (SELECT DISTINC
6180: 54 20 20 20 20 20 20 20 2d 2d 20 75 6e 69 71 75 T -- uniqu
6190: 65 20 63 73 65 74 2f 66 69 6c 65 20 70 61 69 72 e cset/file pair
61a0: 73 0a 09 09 09 09 09 20 20 20 20 20 20 20 20 20 s......
61b0: 20 20 20 43 49 2e 63 69 64 20 41 53 20 63 69 64 CI.cid AS cid
61c0: 2c 20 2d 2d 20 74 61 67 20 63 68 61 6e 67 65 73 , -- tag changes
61d0: 65 74 0a 09 09 09 09 09 20 20 20 20 20 20 20 20 et......
61e0: 20 20 20 20 54 2e 66 69 64 20 20 41 53 20 66 69 T.fid AS fi
61f0: 64 20 20 2d 2d 20 66 69 6c 65 20 6f 66 20 69 74 d -- file of it
6200: 65 6d 20 69 6e 20 63 68 61 6e 67 65 73 65 74 0a em in changeset.
6210: 09 09 09 09 09 20 20 20 20 20 46 52 4f 4d 20 20 ..... FROM
6220: 20 63 73 69 74 65 6d 20 43 49 2c 20 63 68 61 6e csitem CI, chan
6230: 67 65 73 65 74 20 43 2c 20 74 61 67 20 54 0a 09 geset C, tag T..
6240: 09 09 09 09 20 20 20 20 20 57 48 45 52 45 20 20 .... WHERE
6250: 43 49 2e 69 69 64 20 3d 20 54 2e 74 69 64 20 2d CI.iid = T.tid -
6260: 2d 20 67 65 74 20 74 61 67 20 6f 66 20 69 74 65 - get tag of ite
6270: 6d 20 69 6e 20 63 68 61 6e 67 65 73 65 74 0a 09 m in changeset..
6280: 09 09 09 09 20 20 20 20 20 41 4e 44 20 20 20 20 .... AND
6290: 43 2e 63 69 64 20 3d 20 43 49 2e 63 69 64 20 2d C.cid = CI.cid -
62a0: 2d 20 67 65 74 20 63 68 61 6e 67 65 73 65 74 20 - get changeset
62b0: 6f 66 20 69 74 65 6d 0a 09 09 09 09 09 20 20 20 of item......
62c0: 20 20 41 4e 44 20 20 20 20 43 2e 74 79 70 65 20 AND C.type
62d0: 3d 20 31 20 20 20 20 20 2d 2d 20 6c 69 6d 69 74 = 1 -- limit
62e0: 20 74 6f 20 74 61 67 20 63 68 61 6e 67 65 73 65 to tag changese
62f0: 74 73 0a 09 09 09 09 09 20 20 20 20 20 29 20 41 ts...... ) A
6300: 53 20 55 0a 09 09 09 09 20 20 20 20 20 20 20 47 S U..... G
6310: 52 4f 55 50 20 42 59 20 55 2e 63 69 64 20 2d 2d ROUP BY U.cid --
6320: 20 61 67 67 72 65 67 61 74 65 20 62 79 20 63 73 aggregate by cs
6330: 65 74 73 2c 20 63 6f 75 6e 74 20 66 69 6c 65 73 ets, count files
6340: 2f 63 73 65 74 0a 20 20 20 20 20 20 20 20 20 20 /cset.
6350: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
6360: 20 20 20 20 20 20 20 20 20 20 20 20 29 20 41 53 ) AS
6370: 20 55 55 2c 0a 09 09 09 09 20 20 20 20 20 20 28 UU,..... (
6380: 53 45 4c 45 43 54 20 56 2e 63 69 64 20 20 20 20 SELECT V.cid
6390: 20 20 20 20 20 41 53 20 63 69 64 2c 20 20 20 2d AS cid, -
63a0: 2d 20 63 68 61 6e 67 65 73 65 74 0a 09 09 09 09 - changeset.....
63b0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 43 4f CO
63c0: 55 4e 54 20 28 56 2e 69 69 64 29 20 41 53 20 72 UNT (V.iid) AS r
63d0: 63 6f 75 6e 74 20 2d 2d 20 6e 75 6d 62 65 72 20 count -- number
63e0: 6f 66 20 69 74 65 6d 73 20 69 6e 20 63 73 65 74 of items in cset
63f0: 0a 09 09 09 09 20 20 20 20 20 20 20 46 52 4f 4d ..... FROM
6400: 20 20 20 63 73 69 74 65 6d 20 56 2c 20 63 68 61 csitem V, cha
6410: 6e 67 65 73 65 74 20 58 0a 09 09 09 09 20 20 20 ngeset X.....
6420: 20 20 20 20 57 48 45 52 45 20 20 58 2e 63 69 64 WHERE X.cid
6430: 20 20 3d 20 56 2e 63 69 64 20 2d 2d 20 67 65 74 = V.cid -- get
6440: 20 63 68 61 6e 67 65 73 65 74 20 6f 66 20 69 74 changeset of it
6450: 65 6d 0a 09 09 09 09 20 20 20 20 20 20 20 41 4e em..... AN
6460: 44 20 20 20 20 58 2e 74 79 70 65 20 3d 20 31 20 D X.type = 1
6470: 20 20 20 20 2d 2d 20 6c 69 6d 69 74 20 74 6f 20 -- limit to
6480: 74 61 67 20 63 68 61 6e 67 65 73 65 74 73 0a 09 tag changesets..
6490: 09 09 09 20 20 20 20 20 20 20 47 52 4f 55 50 20 ... GROUP
64a0: 42 59 20 56 2e 63 69 64 20 20 20 20 20 20 20 20 BY V.cid
64b0: 2d 2d 20 61 67 67 72 65 67 61 74 65 20 62 79 20 -- aggregate by
64c0: 63 73 65 74 73 2c 20 63 6f 75 6e 74 20 69 74 65 csets, count ite
64d0: 6d 73 2f 63 73 65 74 0a 20 20 20 20 20 20 20 20 ms/cset.
64e0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
64f0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 29 20 )
6500: 41 53 20 56 56 0a 09 09 09 09 20 57 48 45 52 45 AS VV..... WHERE
6510: 20 56 56 2e 63 69 64 20 3d 20 55 55 2e 63 69 64 VV.cid = UU.cid
6520: 20 20 20 20 20 20 20 2d 2d 20 73 79 6e 63 20 23 -- sync #
6530: 69 74 65 6d 73 2f 63 73 65 74 20 77 69 74 68 20 items/cset with
6540: 23 66 69 6c 65 73 2f 63 73 65 74 0a 09 09 09 09 #files/cset.....
6550: 20 41 4e 44 20 20 20 55 55 2e 66 63 6f 75 6e 74 AND UU.fcount
6560: 20 3c 20 56 56 2e 72 63 6f 75 6e 74 20 2d 2d 20 < VV.rcount --
6570: 6c 65 73 73 20 66 69 6c 65 73 20 74 68 61 6e 20 less files than
6580: 69 74 65 6d 73 0a 09 09 09 09 20 20 20 20 20 20 items.....
6590: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
65a0: 20 20 20 20 20 20 20 2d 2d 20 3d 3e 20 69 74 65 -- => ite
65b0: 6d 73 20 62 65 6c 6f 6e 67 20 74 6f 20 74 68 65 ms belong to the
65c0: 20 73 61 6d 65 20 66 69 6c 65 2e 0a 09 09 09 09 same file......
65d0: 29 0a 09 09 41 4e 44 20 20 20 20 54 2e 74 69 64 )...AND T.tid
65e0: 20 3d 20 43 2e 74 79 70 65 20 2d 2d 20 67 65 74 = C.type -- get
65f0: 20 72 65 61 64 61 62 6c 65 20 63 68 61 6e 67 65 readable change
6600: 73 65 74 20 74 79 70 65 0a 09 20 20 20 20 7d 0a set type.. }.
6610: 09 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 .return. }..
6620: 20 20 20 70 72 6f 63 20 42 72 61 6e 63 68 43 68 proc BranchCh
6630: 61 6e 67 65 73 65 74 73 20 7b 7d 20 7b 0a 09 23 angesets {} {..#
6640: 20 54 68 69 73 20 63 6f 64 65 20 70 65 72 66 6f This code perfo
6650: 72 6d 73 20 61 20 6e 75 6d 62 65 72 20 6f 66 20 rms a number of
6660: 70 61 72 61 6e 6f 69 64 20 63 68 65 63 6b 73 20 paranoid checks
6670: 6f 66 20 74 68 65 0a 09 23 20 64 61 74 61 62 61 of the..# databa
6680: 73 65 2c 20 73 65 61 72 63 68 69 6e 67 20 66 6f se, searching fo
6690: 72 20 69 6e 63 6f 6e 73 69 73 74 65 6e 74 20 63 r inconsistent c
66a0: 68 61 6e 67 65 73 65 74 2f 72 65 76 69 73 69 6f hangeset/revisio
66b0: 6e 0a 09 23 20 69 6e 66 6f 72 6d 61 74 69 6f 6e n..# information
66c0: 2e 0a 0a 09 75 70 76 61 72 20 31 20 6e 20 6e 20 ....upvar 1 n n
66d0: 3b 20 23 20 43 6f 75 6e 74 65 72 20 66 6f 72 20 ; # Counter for
66e0: 74 68 65 20 63 68 65 63 6b 73 20 28 77 65 20 70 the checks (we p
66f0: 72 69 6e 74 20 61 6e 20 69 64 20 62 65 66 6f 72 rint an id befor
6700: 65 0a 09 09 20 20 20 20 20 20 23 20 74 68 65 20 e... # the
6710: 6d 61 69 6e 20 6c 61 62 65 6c 29 2e 0a 0a 09 23 main label)....#
6720: 20 46 69 6e 64 20 61 6c 6c 20 62 72 61 6e 63 68 Find all branch
6730: 65 73 20 77 68 69 63 68 20 61 72 65 20 6e 6f 74 es which are not
6740: 20 75 73 65 64 20 62 79 20 61 74 20 6c 65 61 73 used by at leas
6750: 74 20 6f 6e 65 0a 09 23 20 63 68 61 6e 67 65 73 t one..# changes
6760: 65 74 2e 0a 09 43 68 65 63 6b 42 72 61 6e 63 68 et...CheckBranch
6770: 20 5c 0a 09 20 20 20 20 7b 41 6c 6c 20 62 72 61 \.. {All bra
6780: 6e 63 68 65 73 20 68 61 76 65 20 74 6f 20 62 65 nches have to be
6790: 20 75 73 65 64 20 62 79 20 6c 65 61 73 74 20 6f used by least o
67a0: 6e 65 20 63 68 61 6e 67 65 73 65 74 7d 20 5c 0a ne changeset} \.
67b0: 09 20 20 20 20 7b 69 73 20 6e 6f 74 20 75 73 65 . {is not use
67c0: 64 20 62 79 20 61 20 62 72 61 6e 63 68 20 73 79 d by a branch sy
67d0: 6d 62 6f 6c 20 63 68 61 6e 67 65 73 65 74 7d 20 mbol changeset}
67e0: 7b 0a 09 09 2d 2d 20 55 6e 75 73 65 64 20 62 72 {...-- Unused br
67f0: 61 6e 63 68 65 73 20 3d 20 41 6c 6c 20 62 72 61 anches = All bra
6800: 6e 63 68 65 73 0a 09 09 2d 2d 20 20 20 20 20 20 nches...--
6810: 20 20 20 20 20 20 20 20 20 20 20 2d 20 62 72 61 - bra
6820: 6e 63 68 65 73 20 75 73 65 64 20 62 79 20 62 72 nches used by br
6830: 61 6e 63 68 20 63 68 61 6e 67 65 73 65 74 73 2e anch changesets.
6840: 0a 09 09 2d 2d 0a 09 09 2d 2d 20 42 6f 74 68 20 ...--...-- Both
6850: 73 65 74 73 20 63 61 6e 20 62 65 20 63 6f 6d 70 sets can be comp
6860: 75 74 65 64 20 65 61 73 69 6c 79 2c 20 61 6e 64 uted easily, and
6870: 20 73 75 62 74 72 61 63 74 65 64 0a 20 20 20 20 subtracted.
6880: 20 20 20 20 20 20 20 20 20 20 20 20 2d 2d 20 66 -- f
6890: 72 6f 6d 20 65 61 63 68 20 6f 74 68 65 72 2e 20 rom each other.
68a0: 54 68 65 6e 20 77 65 20 63 61 6e 20 67 65 74 20 Then we can get
68b0: 74 68 65 20 61 73 73 6f 63 69 61 74 65 64 0a 20 the associated.
68c0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2d -
68d0: 2d 20 66 69 6c 65 20 28 6e 61 6d 65 29 20 66 6f - file (name) fo
68e0: 72 20 64 69 73 70 6c 61 79 2e 0a 0a 09 09 53 45 r display.....SE
68f0: 4c 45 43 54 20 50 2e 6e 61 6d 65 2c 20 53 2e 6e LECT P.name, S.n
6900: 61 6d 65 0a 09 09 46 52 4f 4d 20 70 72 6f 6a 65 ame...FROM proje
6910: 63 74 20 50 2c 20 62 72 61 6e 63 68 20 42 2c 20 ct P, branch B,
6920: 73 79 6d 62 6f 6c 20 53 0a 09 09 57 48 45 52 45 symbol S...WHERE
6930: 20 42 2e 62 69 64 20 49 4e 20 28 53 45 4c 45 43 B.bid IN (SELEC
6940: 54 20 62 69 64 20 20 20 20 20 20 20 20 20 20 20 T bid
6950: 20 20 20 20 20 20 20 20 20 2d 2d 20 41 6c 6c 20 -- All
6960: 62 72 61 6e 63 68 65 73 0a 09 09 09 09 46 52 4f branches.....FRO
6970: 4d 20 20 20 62 72 61 6e 63 68 0a 09 09 09 09 45 M branch.....E
6980: 58 43 45 50 54 20 20 20 20 20 20 20 20 20 20 20 XCEPT
6990: 20 20 20 20 20 20 20 20 20 20 20 20 20 2d 2d 20 --
69a0: 73 75 62 74 72 61 63 74 0a 09 09 09 09 53 45 4c subtract.....SEL
69b0: 45 43 54 20 43 49 2e 69 69 64 20 20 20 20 20 20 ECT CI.iid
69c0: 20 20 20 20 20 20 20 20 20 20 20 2d 2d 20 62 72 -- br
69d0: 61 6e 63 68 65 73 20 75 73 65 64 0a 09 09 09 09 anches used.....
69e0: 46 52 4f 4d 20 20 20 63 73 69 74 65 6d 20 43 49 FROM csitem CI
69f0: 2c 20 63 68 61 6e 67 65 73 65 74 20 43 0a 09 09 , changeset C...
6a00: 09 09 57 48 45 52 45 20 20 43 2e 63 69 64 20 3d ..WHERE C.cid =
6a10: 20 43 49 2e 63 69 64 20 20 20 20 20 20 20 20 20 CI.cid
6a20: 2d 2d 20 62 79 20 61 6e 79 20 62 72 61 6e 63 68 -- by any branch
6a30: 0a 09 09 09 09 41 4e 44 20 20 20 20 43 2e 74 79 .....AND C.ty
6a40: 70 65 20 3d 20 32 20 20 20 20 20 20 20 20 20 20 pe = 2
6a50: 20 20 20 2d 2d 20 63 68 61 6e 67 65 73 65 74 0a -- changeset.
6a60: 09 09 09 20 20 20 20 20 20 20 29 0a 09 09 41 4e ... )...AN
6a70: 44 20 20 20 53 2e 73 69 64 20 3d 20 42 2e 73 69 D S.sid = B.si
6a80: 64 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 d
6a90: 2d 2d 20 67 65 74 20 73 79 6d 62 6f 6c 20 6f 66 -- get symbol of
6aa0: 20 62 72 61 6e 63 68 0a 09 09 41 4e 44 20 20 20 branch...AND
6ab0: 50 2e 70 69 64 20 3d 20 53 2e 70 69 64 20 20 20 P.pid = S.pid
6ac0: 20 20 20 20 20 20 20 20 20 20 20 20 2d 2d 20 67 -- g
6ad0: 65 74 20 70 72 6f 6a 65 63 74 20 6f 66 20 73 79 et project of sy
6ae0: 6d 62 6f 6c 0a 09 20 20 20 20 7d 0a 09 23 20 46 mbol.. }..# F
6af0: 69 6e 64 20 61 6c 6c 20 62 72 61 6e 63 68 65 73 ind all branches
6b00: 20 77 68 69 63 68 20 61 72 65 20 75 73 65 64 20 which are used
6b10: 62 79 20 6d 6f 72 65 20 74 68 61 6e 20 6f 6e 65 by more than one
6b20: 20 63 68 61 6e 67 65 73 65 74 2e 0a 09 43 68 65 changeset...Che
6b30: 63 6b 52 65 76 20 5c 0a 09 20 20 20 20 7b 41 6c ckRev \.. {Al
6b40: 6c 20 62 72 61 6e 63 68 65 73 20 68 61 76 65 20 l branches have
6b50: 74 6f 20 62 65 20 75 73 65 64 20 62 79 20 61 74 to be used by at
6b60: 20 6d 6f 73 74 20 6f 6e 65 20 63 68 61 6e 67 65 most one change
6b70: 73 65 74 7d 20 5c 0a 09 20 20 20 20 7b 69 73 20 set} \.. {is
6b80: 75 73 65 64 20 62 79 20 6d 75 6c 74 69 70 6c 65 used by multiple
6b90: 20 63 68 61 6e 67 65 73 65 74 73 7d 20 7b 0a 09 changesets} {..
6ba0: 09 2d 2d 20 50 72 69 6e 63 69 70 6c 65 20 6f 66 .-- Principle of
6bb0: 20 6f 70 65 72 61 74 69 6f 6e 3a 20 47 65 74 20 operation: Get
6bc0: 61 6c 6c 20 62 72 61 6e 63 68 2f 63 68 61 6e 67 all branch/chang
6bd0: 65 73 65 74 0a 20 20 20 20 20 20 20 20 20 20 20 eset.
6be0: 20 20 20 20 20 2d 2d 20 70 61 69 72 73 20 66 6f -- pairs fo
6bf0: 72 20 61 6c 6c 20 62 72 61 6e 63 68 20 63 68 61 r all branch cha
6c00: 6e 67 65 73 65 74 73 2c 20 67 72 6f 75 70 20 62 ngesets, group b
6c10: 79 20 74 61 67 20 74 6f 0a 20 20 20 20 20 20 20 y tag to.
6c20: 20 20 20 20 20 20 20 20 20 2d 2d 20 61 67 67 72 -- aggr
6c30: 65 67 61 74 65 20 74 68 65 20 63 68 61 6e 67 65 egate the change
6c40: 73 65 74 2c 20 63 6f 75 6e 74 69 6e 67 20 74 68 set, counting th
6c50: 65 6d 2e 20 46 72 6f 6d 20 74 68 65 0a 20 20 20 em. From the.
6c60: 20 20 20 20 20 20 20 20 20 20 20 20 20 2d 2d 20 --
6c70: 72 65 73 75 6c 74 69 6e 67 20 62 72 61 6e 63 68 resulting branch
6c80: 2f 63 6f 75 6e 74 20 74 61 62 6c 65 20 73 65 6c /count table sel
6c90: 65 63 74 20 74 68 6f 73 65 20 77 69 74 68 20 6d ect those with m
6ca0: 6f 72 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 ore.
6cb0: 20 20 20 20 2d 2d 20 74 68 61 6e 20 6f 6e 65 20 -- than one
6cc0: 75 73 65 72 2c 20 61 6e 64 20 67 65 74 20 74 68 user, and get th
6cd0: 65 69 72 20 61 73 73 6f 63 69 61 74 65 64 20 66 eir associated f
6ce0: 69 6c 65 20 28 6e 61 6d 65 29 0a 20 20 20 20 20 ile (name).
6cf0: 20 20 20 20 20 20 20 20 20 20 20 2d 2d 20 66 6f -- fo
6d00: 72 20 64 69 73 70 6c 61 79 2e 0a 0a 09 09 53 45 r display.....SE
6d10: 4c 45 43 54 20 50 2e 6e 61 6d 65 2c 20 53 2e 6e LECT P.name, S.n
6d20: 61 6d 65 0a 09 09 46 52 4f 4d 20 62 72 61 6e 63 ame...FROM branc
6d30: 68 20 42 2c 20 70 72 6f 6a 65 63 74 20 50 2c 20 h B, project P,
6d40: 73 79 6d 62 6f 6c 20 53 2c 0a 09 09 20 20 20 20 symbol S,...
6d50: 20 28 53 45 4c 45 43 54 20 43 49 2e 69 69 64 20 (SELECT CI.iid
6d60: 20 20 20 20 20 20 20 41 53 20 69 69 64 2c 20 20 AS iid,
6d70: 2d 2d 20 69 74 65 6d 0a 20 20 20 20 20 20 20 20 -- item.
6d80: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
6d90: 20 20 20 20 20 63 6f 75 6e 74 28 43 49 2e 63 69 count(CI.ci
6da0: 64 29 20 41 53 20 63 6f 75 6e 74 20 2d 2d 20 6e d) AS count -- n
6db0: 75 6d 62 65 72 20 6f 66 20 63 73 65 74 73 20 66 umber of csets f
6dc0: 6f 72 20 69 74 65 6d 0a 09 09 20 20 20 20 20 20 or item...
6dd0: 46 52 4f 4d 20 63 73 69 74 65 6d 20 43 49 2c 20 FROM csitem CI,
6de0: 63 68 61 6e 67 65 73 65 74 20 43 0a 09 09 20 20 changeset C...
6df0: 20 20 20 20 57 48 45 52 45 20 43 2e 74 79 70 65 WHERE C.type
6e00: 20 3d 20 32 20 20 20 20 20 20 20 20 2d 2d 20 6c = 2 -- l
6e10: 69 6d 69 74 20 74 6f 20 62 72 61 6e 63 68 20 63 imit to branch c
6e20: 68 61 6e 67 65 73 65 74 73 2c 0a 09 09 20 20 20 hangesets,...
6e30: 20 20 20 41 4e 44 20 20 20 43 2e 63 69 64 20 3d AND C.cid =
6e40: 20 43 49 2e 63 69 64 20 20 20 20 2d 2d 20 67 65 CI.cid -- ge
6e50: 74 20 74 68 65 20 69 74 65 6d 73 20 74 68 65 79 t the items they
6e60: 20 63 6f 6e 74 61 69 6e 2c 0a 09 09 20 20 20 20 contain,...
6e70: 20 20 47 52 4f 55 50 20 42 59 20 43 49 2e 69 69 GROUP BY CI.ii
6e80: 64 20 20 20 20 20 20 20 20 20 2d 2d 20 61 67 67 d -- agg
6e90: 72 65 67 61 74 65 20 62 79 20 69 74 65 6d 73 2c regate by items,
6ea0: 20 63 6f 75 6e 74 20 63 73 65 74 73 2f 69 74 65 count csets/ite
6eb0: 6d 20 28 78 29 0a 20 20 20 20 20 20 20 20 20 20 m (x).
6ec0: 20 20 20 20 20 20 20 20 20 20 20 29 20 41 53 20 ) AS
6ed0: 55 0a 09 09 57 48 45 52 45 20 55 2e 63 6f 75 6e U...WHERE U.coun
6ee0: 74 20 3e 20 31 20 20 20 20 20 20 20 20 20 20 20 t > 1
6ef0: 20 20 2d 2d 20 66 69 6e 64 20 69 74 65 6d 73 20 -- find items
6f00: 75 73 65 64 20 6d 75 6c 74 69 70 6c 65 20 74 69 used multiple ti
6f10: 6d 65 73 0a 09 09 41 4e 44 20 20 20 42 2e 62 69 mes...AND B.bi
6f20: 64 20 3d 20 55 2e 69 69 64 20 20 20 20 20 20 20 d = U.iid
6f30: 20 20 20 20 2d 2d 20 67 65 74 20 74 68 65 20 75 -- get the u
6f40: 73 65 72 73 20 28 62 72 61 6e 63 68 20 63 68 61 sers (branch cha
6f50: 6e 67 65 73 65 74 73 29 0a 09 09 41 4e 44 20 20 ngesets)...AND
6f60: 20 53 2e 73 69 64 20 3d 20 42 2e 73 69 64 20 20 S.sid = B.sid
6f70: 20 20 20 20 20 20 20 20 20 2d 2d 20 67 65 74 20 -- get
6f80: 73 79 6d 62 6f 6c 20 6f 66 20 62 72 61 6e 63 68 symbol of branch
6f90: 0a 09 09 41 4e 44 20 20 20 50 2e 70 69 64 20 3d ...AND P.pid =
6fa0: 20 53 2e 70 69 64 20 20 20 20 20 20 20 20 20 20 S.pid
6fb0: 20 2d 2d 20 67 65 74 20 70 72 6f 6a 65 63 74 20 -- get project
6fc0: 6f 66 20 73 79 6d 62 6f 6c 0a 09 20 20 20 20 7d of symbol.. }
6fd0: 0a 09 69 66 20 30 20 7b 0a 09 20 20 20 20 23 20 ..if 0 {.. #
6fe0: 54 68 69 73 20 63 68 65 63 6b 20 68 61 73 20 62 This check has b
6ff0: 65 65 6e 20 64 69 73 61 62 6c 65 64 2e 20 57 68 een disabled. Wh
7000: 65 6e 20 74 68 65 20 63 6f 6e 76 65 72 74 65 72 en the converter
7010: 20 77 61 73 20 72 75 6e 0a 09 20 20 20 20 23 20 was run.. #
7020: 6f 6e 20 74 68 65 20 54 63 6c 20 43 56 53 20 73 on the Tcl CVS s
7030: 65 76 65 72 61 6c 20 62 72 61 6e 63 68 65 73 20 everal branches
7040: 74 72 69 70 70 65 64 20 74 68 69 73 0a 09 20 20 tripped this..
7050: 20 20 23 20 63 6f 6e 73 74 72 61 69 6e 74 2e 20 # constraint.
7060: 4f 6e 65 20 6f 66 20 74 68 65 6d 20 77 61 73 20 One of them was
7070: 61 20 66 72 65 65 2d 66 6c 6f 61 74 69 6e 67 20 a free-floating
7080: 62 72 61 6e 63 68 2c 20 61 6e 64 0a 09 20 20 20 branch, and..
7090: 20 23 20 69 74 73 20 68 61 6e 64 6c 69 6e 67 20 # its handling
70a0: 68 61 73 20 62 65 65 6e 20 66 69 78 65 64 20 62 has been fixed b
70b0: 79 20 6e 6f 77 2e 20 54 68 65 20 6f 74 68 65 72 y now. The other
70c0: 73 20 68 6f 77 65 76 65 72 0a 09 20 20 20 20 23 s however.. #
70d0: 20 73 65 65 6d 20 73 65 6d 69 2d 6c 65 67 69 74 seem semi-legit
70e0: 69 6d 61 74 65 2c 20 69 6e 20 74 68 65 20 73 65 imate, in the se
70f0: 6e 73 65 20 74 68 61 74 20 74 68 65 79 20 73 68 nse that they sh
7100: 6f 77 0a 09 20 20 20 20 23 20 69 6e 63 6f 6e 73 ow.. # incons
7110: 69 73 74 65 6e 63 69 65 73 20 69 6e 20 74 68 65 istencies in the
7120: 20 43 56 53 20 68 69 73 74 6f 72 79 20 74 68 65 CVS history the
7130: 20 75 73 65 72 20 69 73 20 6e 6f 74 0a 09 20 20 user is not..
7140: 20 20 23 20 72 65 61 6c 6c 79 20 61 62 6c 65 20 # really able
7150: 74 6f 20 73 6f 6c 76 65 2c 20 62 75 74 20 69 74 to solve, but it
7160: 20 6d 69 67 68 74 20 62 65 20 70 6f 73 73 69 62 might be possib
7170: 6c 65 20 74 6f 20 73 69 6d 70 6c 79 0a 09 20 20 le to simply..
7180: 20 20 23 20 69 67 6e 6f 72 65 20 74 68 65 6d 2e # ignore them.
7190: 0a 0a 09 20 20 20 20 23 20 46 6f 72 20 65 78 61 ... # For exa
71a0: 6d 70 6c 65 20 69 6e 20 54 63 6c 20 77 65 20 68 mple in Tcl we h
71b0: 61 76 65 20 61 20 62 72 61 6e 63 68 20 58 20 77 ave a branch X w
71c0: 69 74 68 20 61 20 70 72 65 66 65 72 65 64 0a 09 ith a prefered..
71d0: 20 20 20 20 23 20 70 61 72 65 6e 74 20 59 2c 20 # parent Y,
71e0: 65 78 63 65 70 74 20 66 6f 72 20 61 20 73 69 6e except for a sin
71f0: 67 6c 65 20 66 69 6c 65 20 77 68 65 72 65 20 74 gle file where t
7200: 68 65 20 70 72 65 66 65 72 65 64 0a 09 20 20 20 he prefered..
7210: 20 23 20 70 61 72 65 6e 74 20 73 65 65 6d 73 20 # parent seems
7220: 74 6f 20 62 65 20 63 72 65 61 74 65 64 20 61 66 to be created af
7230: 74 65 72 20 69 74 73 20 63 75 72 72 65 6e 74 20 ter its current
7240: 70 61 72 65 6e 74 2c 0a 09 20 20 20 20 23 20 6d parent,.. # m
7250: 61 6b 69 6e 67 20 72 65 2d 70 61 72 65 6e 74 69 aking re-parenti
7260: 6e 67 20 69 6d 70 6f 73 73 69 62 6c 65 2e 20 48 ng impossible. H
7270: 6f 77 65 76 65 72 20 77 65 20 6d 61 79 20 62 65 owever we may be
7280: 20 61 62 6c 65 0a 09 20 20 20 20 23 20 74 6f 20 able.. # to
7290: 69 67 6e 6f 72 65 20 74 68 69 73 2c 20 69 74 20 ignore this, it
72a0: 73 68 6f 75 6c 64 20 6f 6e 6c 79 20 63 61 75 73 should only caus
72b0: 65 20 74 68 65 20 62 72 61 6e 63 68 20 74 6f 20 e the branch to
72c0: 68 61 76 65 0a 09 20 20 20 20 23 20 6d 6f 72 65 have.. # more
72d0: 20 74 68 61 6e 20 6f 6e 65 20 70 72 65 64 65 63 than one predec
72e0: 65 73 73 6f 72 2c 20 61 6e 64 20 73 68 69 66 74 essor, and shift
72f0: 69 6e 67 20 69 74 20 61 72 6f 75 6e 64 20 69 6e ing it around in
7300: 20 74 68 65 0a 09 20 20 20 20 23 20 63 6f 6d 6d the.. # comm
7310: 69 74 20 6f 72 64 65 72 2e 20 54 68 65 20 62 61 it order. The ba
7320: 63 6b 65 6e 64 20 77 6f 75 6c 64 20 73 74 69 6c ckend would stil
7330: 6c 20 75 73 65 20 74 68 65 20 70 72 65 66 65 72 l use the prefer
7340: 65 64 0a 09 20 20 20 20 23 20 70 61 72 65 6e 74 ed.. # parent
7350: 20 66 6f 72 20 74 68 65 20 61 74 74 61 63 68 6d for the attachm
7360: 65 6e 74 20 70 6f 69 6e 74 20 69 6e 20 66 6f 73 ent point in fos
7370: 73 69 6c 2e 0a 0a 09 20 20 20 20 23 20 53 6f 2c sil.... # So,
7380: 20 66 6f 72 20 6e 6f 77 20 49 20 68 61 76 65 20 for now I have
7390: 64 65 63 69 64 65 64 20 74 6f 20 64 69 73 61 62 decided to disab
73a0: 6c 65 20 74 68 69 73 20 61 6e 64 20 70 72 65 73 le this and pres
73b0: 73 0a 09 20 20 20 20 23 20 66 6f 72 77 61 72 64 s.. # forward
73c0: 2e 20 4f 66 20 63 6f 75 72 73 65 2c 20 69 66 20 . Of course, if
73d0: 77 65 20 72 75 6e 20 69 6e 74 6f 20 61 63 74 75 we run into actu
73e0: 61 6c 20 74 72 6f 75 62 6c 65 20 77 65 0a 09 20 al trouble we..
73f0: 20 20 20 23 20 77 69 6c 6c 20 68 61 76 65 20 74 # will have t
7400: 6f 20 67 6f 20 62 61 63 6b 20 68 65 72 65 20 73 o go back here s
7410: 65 65 20 77 68 61 74 20 63 61 6e 20 62 65 20 64 ee what can be d
7420: 6f 6e 65 20 74 6f 20 66 69 78 0a 09 20 20 20 20 one to fix..
7430: 23 20 74 68 69 73 2e 20 45 76 65 6e 20 69 66 20 # this. Even if
7440: 6f 6e 6c 79 20 67 69 76 69 6e 67 20 74 68 65 20 only giving the
7450: 75 73 65 72 20 74 68 65 20 69 6e 73 74 72 75 63 user the instruc
7460: 74 69 6f 6e 20 68 6f 77 0a 09 20 20 20 20 23 20 tion how.. #
7470: 74 6f 20 65 64 69 74 20 74 68 65 20 43 56 53 20 to edit the CVS
7480: 72 65 70 6f 73 69 74 6f 72 79 20 74 6f 20 72 65 repository to re
7490: 6d 6f 76 65 20 74 68 65 20 69 6e 63 6f 6e 73 69 move the inconsi
74a0: 73 74 65 6e 63 79 2e 0a 0a 09 20 20 20 20 23 20 stency.... #
74b0: 41 6c 6c 20 62 72 61 6e 63 68 65 73 20 68 61 76 All branches hav
74c0: 65 20 74 6f 20 61 67 72 65 65 20 6f 6e 20 74 68 e to agree on th
74d0: 65 20 4c 4f 44 20 74 68 65 69 72 20 63 68 61 6e e LOD their chan
74e0: 67 65 73 65 74 0a 09 20 20 20 20 23 20 62 65 6c geset.. # bel
74f0: 6f 6e 67 73 20 74 6f 2e 20 49 6e 20 6f 74 68 65 ongs to. In othe
7500: 72 20 77 6f 72 64 73 2c 20 61 6c 6c 20 62 72 61 r words, all bra
7510: 6e 63 68 65 73 20 69 6e 20 61 20 63 68 61 6e 67 nches in a chang
7520: 65 73 65 74 0a 09 20 20 20 20 23 20 68 61 76 65 eset.. # have
7530: 20 74 6f 20 72 65 66 65 72 20 74 6f 20 74 68 65 to refer to the
7540: 20 73 61 6d 65 20 6c 69 6e 65 20 6f 66 20 64 65 same line of de
7550: 76 65 6c 6f 70 6d 65 6e 74 2e 0a 09 20 20 20 20 velopment...
7560: 23 0a 09 20 20 20 20 23 20 49 6e 73 74 65 61 64 #.. # Instead
7570: 20 6f 66 20 6c 6f 6f 6b 69 6e 67 20 61 74 20 61 of looking at a
7580: 6c 6c 20 70 61 69 72 73 20 6f 66 20 62 72 61 6e ll pairs of bran
7590: 63 68 65 73 20 69 6e 20 61 6c 6c 0a 09 20 20 20 ches in all..
75a0: 20 23 20 63 68 61 6e 67 65 73 65 74 73 20 77 65 # changesets we
75b0: 20 67 65 6e 65 72 61 74 65 20 74 68 65 20 64 69 generate the di
75c0: 73 74 69 6e 63 74 20 73 65 74 20 6f 66 20 61 6c stinct set of al
75d0: 6c 20 4c 4f 44 73 0a 09 20 20 20 20 23 20 72 65 l LODs.. # re
75e0: 66 65 72 65 6e 63 65 64 20 62 79 20 74 68 65 20 ferenced by the
75f0: 62 72 61 6e 63 68 65 73 20 6f 66 20 61 20 63 68 branches of a ch
7600: 61 6e 67 65 73 65 74 2c 20 6c 6f 6f 6b 20 66 6f angeset, look fo
7610: 72 0a 09 20 20 20 20 23 20 74 68 6f 73 65 20 77 r.. # those w
7620: 69 74 68 20 63 61 72 64 69 6e 61 6c 69 74 79 20 ith cardinality
7630: 3e 20 31 2c 20 61 6e 64 20 67 65 74 20 74 68 65 > 1, and get the
7640: 20 69 64 65 6e 74 69 66 79 69 6e 67 0a 09 20 20 identifying..
7650: 20 20 23 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 # information
7660: 66 6f 72 20 74 68 65 20 63 68 61 6e 67 65 73 65 for the changese
7670: 74 73 20 66 6f 75 6e 64 20 74 68 75 73 6c 79 2e ts found thusly.
7680: 0a 09 20 20 20 20 43 68 65 63 6b 43 53 20 5c 0a .. CheckCS \.
7690: 09 09 7b 41 6c 6c 20 62 72 61 6e 63 68 65 73 20 ..{All branches
76a0: 69 6e 20 61 20 63 68 61 6e 67 65 73 65 74 20 68 in a changeset h
76b0: 61 76 65 20 74 6f 20 62 65 6c 6f 6e 67 20 74 6f ave to belong to
76c0: 20 74 68 65 20 73 61 6d 65 20 4c 4f 44 7d 20 5c the same LOD} \
76d0: 0a 09 09 7b 3a 20 49 74 73 20 62 72 61 6e 63 68 ...{: Its branch
76e0: 65 73 20 64 69 73 61 67 72 65 65 20 61 62 6f 75 es disagree abou
76f0: 74 20 74 68 65 20 4c 4f 44 20 74 68 65 79 20 62 t the LOD they b
7700: 65 6c 6f 6e 67 20 74 6f 7d 20 7b 0a 09 09 20 20 elong to} {...
7710: 20 20 53 45 4c 45 43 54 20 54 2e 6e 61 6d 65 2c SELECT T.name,
7720: 20 43 2e 63 69 64 0a 09 09 20 20 20 20 46 52 4f C.cid... FRO
7730: 4d 20 20 20 63 68 61 6e 67 65 73 65 74 20 43 2c M changeset C,
7740: 20 63 73 74 79 70 65 20 54 0a 09 09 20 20 20 20 cstype T...
7750: 57 48 45 52 45 20 20 43 2e 63 69 64 20 49 4e 20 WHERE C.cid IN
7760: 28 53 45 4c 45 43 54 20 55 2e 63 69 64 0a 09 09 (SELECT U.cid...
7770: 09 09 20 20 20 20 20 46 52 4f 4d 20 28 53 45 4c .. FROM (SEL
7780: 45 43 54 20 44 49 53 54 49 4e 43 54 20 43 49 2e ECT DISTINCT CI.
7790: 63 69 64 20 41 53 20 63 69 64 2c 20 42 2e 6c 6f cid AS cid, B.lo
77a0: 64 20 41 53 20 6c 6f 64 0a 09 09 09 09 09 20 20 d AS lod......
77b0: 20 46 52 4f 4d 20 20 20 63 73 69 74 65 6d 20 43 FROM csitem C
77c0: 49 2c 20 63 68 61 6e 67 65 73 65 74 20 43 2c 20 I, changeset C,
77d0: 62 72 61 6e 63 68 20 42 0a 09 09 09 09 09 20 20 branch B......
77e0: 20 57 48 45 52 45 20 20 43 49 2e 69 69 64 20 3d WHERE CI.iid =
77f0: 20 42 2e 62 69 64 0a 09 09 09 09 09 20 20 20 41 B.bid...... A
7800: 4e 44 20 20 20 20 43 2e 63 69 64 20 3d 20 43 49 ND C.cid = CI
7810: 2e 63 69 64 0a 09 09 09 09 09 20 20 20 41 4e 44 .cid...... AND
7820: 20 20 20 20 43 2e 74 79 70 65 20 3d 20 32 29 20 C.type = 2)
7830: 41 53 20 55 0a 09 09 09 09 20 20 20 20 20 47 52 AS U..... GR
7840: 4f 55 50 20 42 59 20 55 2e 63 69 64 20 48 41 56 OUP BY U.cid HAV
7850: 49 4e 47 20 43 4f 55 4e 54 28 55 2e 6c 6f 64 29 ING COUNT(U.lod)
7860: 20 3e 20 31 29 0a 09 09 20 20 20 20 41 4e 44 20 > 1)... AND
7870: 20 20 20 54 2e 74 69 64 20 3d 20 43 2e 74 79 70 T.tid = C.typ
7880: 65 0a 09 09 7d 0a 09 7d 0a 09 23 20 41 6c 6c 20 e...}..}..# All
7890: 62 72 61 6e 63 68 65 73 20 68 61 76 65 20 74 6f branches have to
78a0: 20 61 67 72 65 65 20 6f 6e 20 74 68 65 20 70 72 agree on the pr
78b0: 6f 6a 65 63 74 20 74 68 65 69 72 20 63 68 61 6e oject their chan
78c0: 67 65 73 65 74 0a 09 23 20 62 65 6c 6f 6e 67 73 geset..# belongs
78d0: 20 74 6f 2e 20 49 6e 20 6f 74 68 65 72 20 77 6f to. In other wo
78e0: 72 64 73 2c 20 61 6c 6c 20 62 72 61 6e 63 68 65 rds, all branche
78f0: 73 20 69 6e 20 61 20 63 68 61 6e 67 65 73 65 74 s in a changeset
7900: 20 68 61 76 65 0a 09 23 20 74 6f 20 72 65 66 65 have..# to refe
7910: 72 20 74 6f 20 74 68 65 20 73 61 6d 65 20 70 72 r to the same pr
7920: 6f 6a 65 63 74 2e 0a 09 23 0a 09 23 20 49 6e 73 oject...#..# Ins
7930: 74 65 61 64 20 6f 66 20 6c 6f 6f 6b 69 6e 67 20 tead of looking
7940: 61 74 20 61 6c 6c 20 70 61 69 72 73 20 6f 66 20 at all pairs of
7950: 62 72 61 6e 63 68 65 73 20 69 6e 20 61 6c 6c 0a branches in all.
7960: 09 23 20 63 68 61 6e 67 65 73 65 74 73 20 77 65 .# changesets we
7970: 20 67 65 6e 65 72 61 74 65 20 74 68 65 20 64 69 generate the di
7980: 73 74 69 6e 63 74 20 73 65 74 20 6f 66 20 61 6c stinct set of al
7990: 6c 20 70 72 6f 6a 65 63 74 73 0a 09 23 20 72 65 l projects..# re
79a0: 66 65 72 65 6e 63 65 64 20 62 79 20 74 68 65 20 ferenced by the
79b0: 62 72 61 6e 63 68 65 73 20 6f 66 20 61 20 63 68 branches of a ch
79c0: 61 6e 67 65 73 65 74 2c 20 6c 6f 6f 6b 20 66 6f angeset, look fo
79d0: 72 20 74 68 6f 73 65 0a 09 23 20 77 69 74 68 20 r those..# with
79e0: 63 61 72 64 69 6e 61 6c 69 74 79 20 3e 20 31 2c cardinality > 1,
79f0: 20 61 6e 64 20 67 65 74 20 74 68 65 20 69 64 65 and get the ide
7a00: 6e 74 69 66 79 69 6e 67 20 69 6e 66 6f 72 6d 61 ntifying informa
7a10: 74 69 6f 6e 0a 09 23 20 66 6f 72 20 74 68 65 20 tion..# for the
7a20: 63 68 61 6e 67 65 73 65 74 73 20 66 6f 75 6e 64 changesets found
7a30: 20 74 68 75 73 6c 79 2e 0a 09 43 68 65 63 6b 43 thusly...CheckC
7a40: 53 20 5c 0a 09 20 20 20 20 7b 41 6c 6c 20 62 72 S \.. {All br
7a50: 61 6e 63 68 65 73 20 69 6e 20 61 20 63 68 61 6e anches in a chan
7a60: 67 65 73 65 74 20 68 61 76 65 20 74 6f 20 62 65 geset have to be
7a70: 6c 6f 6e 67 20 74 6f 20 74 68 65 20 73 61 6d 65 long to the same
7a80: 20 70 72 6f 6a 65 63 74 7d 20 5c 0a 09 20 20 20 project} \..
7a90: 20 7b 3a 20 49 74 73 20 62 72 61 6e 63 68 65 73 {: Its branches
7aa0: 20 64 69 73 61 67 72 65 65 20 61 62 6f 75 74 20 disagree about
7ab0: 74 68 65 20 70 72 6f 6a 65 63 74 20 74 68 65 79 the project they
7ac0: 20 62 65 6c 6f 6e 67 20 74 6f 7d 20 7b 0a 09 09 belong to} {...
7ad0: 53 45 4c 45 43 54 20 54 2e 6e 61 6d 65 2c 20 43 SELECT T.name, C
7ae0: 2e 63 69 64 0a 09 09 46 52 4f 4d 20 20 20 63 68 .cid...FROM ch
7af0: 61 6e 67 65 73 65 74 20 43 2c 20 63 73 74 79 70 angeset C, cstyp
7b00: 65 20 54 0a 09 09 57 48 45 52 45 20 20 43 2e 63 e T...WHERE C.c
7b10: 69 64 20 49 4e 20 28 53 45 4c 45 43 54 20 55 2e id IN (SELECT U.
7b20: 63 69 64 0a 09 09 09 09 20 46 52 4f 4d 20 28 53 cid..... FROM (S
7b30: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 20 ELECT DISTINCT
7b40: 20 20 20 20 20 20 2d 2d 20 55 6e 69 71 75 65 20 -- Unique
7b50: 63 73 65 74 2f 70 72 6f 6a 20 70 61 69 72 73 0a cset/proj pairs.
7b60: 09 09 09 09 20 20 20 20 20 20 20 20 20 20 20 20 ....
7b70: 20 20 43 49 2e 63 69 64 20 41 53 20 63 69 64 2c CI.cid AS cid,
7b80: 20 20 2d 2d 20 42 72 61 6e 63 68 20 63 73 65 74 -- Branch cset
7b90: 0a 09 09 09 09 20 20 20 20 20 20 20 20 20 20 20 .....
7ba0: 20 20 20 46 2e 70 69 64 20 20 41 53 20 70 69 64 F.pid AS pid
7bb0: 20 20 20 2d 2d 20 50 72 6f 6a 65 63 74 20 6f 66 -- Project of
7bc0: 20 69 74 65 6d 20 69 6e 20 63 73 65 74 0a 09 09 item in cset...
7bd0: 09 09 20 20 20 20 20 20 20 46 52 4f 4d 20 20 20 .. FROM
7be0: 63 73 69 74 65 6d 20 43 49 2c 20 63 68 61 6e 67 csitem CI, chang
7bf0: 65 73 65 74 20 43 2c 20 62 72 61 6e 63 68 20 42 eset C, branch B
7c00: 2c 20 66 69 6c 65 20 46 0a 09 09 09 09 20 20 20 , file F.....
7c10: 20 20 20 20 57 48 45 52 45 20 20 43 49 2e 69 69 WHERE CI.ii
7c20: 64 20 3d 20 42 2e 62 69 64 20 20 2d 2d 20 67 65 d = B.bid -- ge
7c30: 74 20 62 72 61 6e 63 68 20 6f 66 20 69 74 65 6d t branch of item
7c40: 20 69 6e 20 63 73 65 74 0a 09 09 09 09 20 20 20 in cset.....
7c50: 20 20 20 20 41 4e 44 20 20 20 20 43 2e 63 69 64 AND C.cid
7c60: 20 20 3d 20 43 49 2e 63 69 64 20 2d 2d 20 67 65 = CI.cid -- ge
7c70: 74 20 63 68 61 6e 67 65 73 65 74 20 6f 66 20 69 t changeset of i
7c80: 74 65 6d 0a 09 09 09 09 20 20 20 20 20 20 20 41 tem..... A
7c90: 4e 44 20 20 20 20 43 2e 74 79 70 65 20 3d 20 32 ND C.type = 2
7ca0: 20 20 20 20 20 20 2d 2d 20 6c 69 6d 69 74 20 74 -- limit t
7cb0: 6f 20 62 72 61 6e 63 68 20 63 68 61 6e 67 65 73 o branch changes
7cc0: 65 74 73 0a 09 09 09 09 20 20 20 20 20 20 20 41 ets..... A
7cd0: 4e 44 20 20 20 20 46 2e 66 69 64 20 20 3d 20 42 ND F.fid = B
7ce0: 2e 66 69 64 20 20 2d 2d 20 67 65 74 20 66 69 6c .fid -- get fil
7cf0: 65 20 6f 66 20 62 72 61 6e 63 68 0a 20 20 20 20 e of branch.
7d00: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
7d10: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
7d20: 20 20 29 20 41 53 20 55 0a 09 09 09 09 20 47 52 ) AS U..... GR
7d30: 4f 55 50 20 42 59 20 55 2e 63 69 64 20 20 20 20 OUP BY U.cid
7d40: 20 20 20 20 20 20 2d 2d 20 61 67 67 72 65 67 61 -- aggrega
7d50: 74 65 20 62 79 20 63 73 65 74 73 2c 20 63 6f 75 te by csets, cou
7d60: 6e 74 20 70 72 6f 6a 2f 63 73 65 74 0a 09 09 09 nt proj/cset....
7d70: 09 20 48 41 56 49 4e 47 20 43 4f 55 4e 54 28 55 . HAVING COUNT(U
7d80: 2e 70 69 64 29 20 3e 20 31 20 2d 2d 20 66 69 6e .pid) > 1 -- fin
7d90: 64 20 63 73 65 74 20 77 69 74 68 20 6d 75 6c 74 d cset with mult
7da0: 69 70 6c 65 20 70 72 6f 6a 65 63 74 73 0a 09 09 iple projects...
7db0: 09 09 29 0a 09 09 41 4e 44 20 20 20 20 54 2e 74 ..)...AND T.t
7dc0: 69 64 20 3d 20 43 2e 74 79 70 65 20 2d 2d 20 67 id = C.type -- g
7dd0: 65 74 20 72 65 61 64 61 62 6c 65 20 63 68 61 6e et readable chan
7de0: 67 65 73 65 74 20 74 79 70 65 0a 09 20 20 20 20 geset type..
7df0: 7d 0a 09 23 20 41 6c 6c 20 62 72 61 6e 63 68 65 }..# All branche
7e00: 73 20 69 6e 20 61 20 73 69 6e 67 6c 65 20 63 68 s in a single ch
7e10: 61 6e 67 65 73 65 74 20 68 61 76 65 20 74 6f 20 angeset have to
7e20: 62 65 6c 6f 6e 67 20 74 6f 0a 09 23 20 64 69 66 belong to..# dif
7e30: 66 65 72 65 6e 74 20 66 69 6c 65 73 2e 20 43 6f ferent files. Co
7e40: 6e 76 65 72 73 65 6c 79 3a 20 4e 6f 20 74 77 6f nversely: No two
7e50: 20 62 72 61 6e 63 68 65 73 20 6f 66 20 61 20 73 branches of a s
7e60: 69 6e 67 6c 65 0a 09 23 20 66 69 6c 65 20 61 72 ingle..# file ar
7e70: 65 20 61 6c 6c 6f 77 65 64 20 74 6f 20 62 65 20 e allowed to be
7e80: 69 6e 20 74 68 65 20 73 61 6d 65 20 63 68 61 6e in the same chan
7e90: 67 65 73 65 74 2e 0a 09 23 0a 09 23 20 49 6e 73 geset...#..# Ins
7ea0: 74 65 61 64 20 6f 66 20 6c 6f 6f 6b 69 6e 67 20 tead of looking
7eb0: 61 74 20 61 6c 6c 20 70 61 69 72 73 20 6f 66 20 at all pairs of
7ec0: 62 72 61 6e 63 68 65 73 20 69 6e 20 61 6c 6c 0a branches in all.
7ed0: 09 23 20 63 68 61 6e 67 65 73 65 74 73 20 77 65 .# changesets we
7ee0: 20 67 65 6e 65 72 61 74 65 20 74 68 65 20 64 69 generate the di
7ef0: 73 74 69 6e 63 74 20 73 65 74 20 6f 66 20 61 6c stinct set of al
7f00: 6c 20 66 69 6c 65 73 0a 09 23 20 72 65 66 65 72 l files..# refer
7f10: 65 6e 63 65 64 20 62 79 20 74 68 65 20 62 72 61 enced by the bra
7f20: 6e 63 68 65 73 20 6f 66 20 61 20 63 68 61 6e 67 nches of a chang
7f30: 65 73 65 74 2c 20 61 6e 64 20 6c 6f 6f 6b 20 66 eset, and look f
7f40: 6f 72 0a 09 23 20 74 68 6f 73 65 20 77 69 74 68 or..# those with
7f50: 20 63 61 72 64 69 6e 61 6c 69 74 79 20 3c 20 74 cardinality < t
7f60: 68 65 20 63 61 72 64 69 6e 61 6c 69 74 79 20 6f he cardinality o
7f70: 66 20 74 68 65 20 73 65 74 20 6f 66 0a 09 23 20 f the set of..#
7f80: 62 72 61 6e 63 68 65 73 2c 20 61 6e 64 20 67 65 branches, and ge
7f90: 74 20 74 68 65 20 69 64 65 6e 74 69 66 79 69 6e t the identifyin
7fa0: 67 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 66 6f g information fo
7fb0: 72 20 74 68 65 0a 09 23 20 63 68 61 6e 67 65 73 r the..# changes
7fc0: 65 74 73 20 66 6f 75 6e 64 20 74 68 75 73 6c 79 ets found thusly
7fd0: 2e 0a 09 43 68 65 63 6b 43 53 20 5c 0a 09 20 20 ...CheckCS \..
7fe0: 20 20 7b 41 6c 6c 20 62 72 61 6e 63 68 65 73 20 {All branches
7ff0: 69 6e 20 61 20 63 68 61 6e 67 65 73 65 74 20 68 in a changeset h
8000: 61 76 65 20 74 6f 20 62 65 6c 6f 6e 67 20 74 6f ave to belong to
8010: 20 64 69 66 66 65 72 65 6e 74 20 66 69 6c 65 73 different files
8020: 7d 20 5c 0a 09 20 20 20 20 7b 3a 20 49 74 73 20 } \.. {: Its
8030: 62 72 61 6e 63 68 65 73 20 73 68 61 72 65 20 66 branches share f
8040: 69 6c 65 73 7d 20 7b 0a 09 09 53 45 4c 45 43 54 iles} {...SELECT
8050: 20 54 2e 6e 61 6d 65 2c 20 43 2e 63 69 64 0a 09 T.name, C.cid..
8060: 09 46 52 4f 4d 20 20 20 63 68 61 6e 67 65 73 65 .FROM changese
8070: 74 20 43 2c 20 63 73 74 79 70 65 20 54 0a 09 09 t C, cstype T...
8080: 57 48 45 52 45 20 20 43 2e 63 69 64 20 49 4e 20 WHERE C.cid IN
8090: 28 53 45 4c 45 43 54 20 56 56 2e 63 69 64 0a 09 (SELECT VV.cid..
80a0: 09 09 09 20 46 52 4f 4d 20 28 53 45 4c 45 43 54 ... FROM (SELECT
80b0: 20 55 2e 63 69 64 20 20 20 20 20 20 20 20 20 41 U.cid A
80c0: 53 20 63 69 64 2c 20 20 20 2d 2d 20 63 68 61 6e S cid, -- chan
80d0: 67 65 73 65 74 0a 09 09 09 09 20 20 20 20 20 20 geset.....
80e0: 20 20 20 20 20 20 20 20 43 4f 55 4e 54 20 28 55 COUNT (U
80f0: 2e 66 69 64 29 20 41 53 20 66 63 6f 75 6e 74 20 .fid) AS fcount
8100: 2d 2d 20 6e 75 6d 62 65 72 20 6f 66 20 66 69 6c -- number of fil
8110: 65 73 20 62 79 20 69 74 65 6d 73 0a 09 09 09 09 es by items.....
8120: 20 20 20 20 20 20 20 46 52 4f 4d 20 28 53 45 4c FROM (SEL
8130: 45 43 54 20 44 49 53 54 49 4e 43 54 20 20 20 20 ECT DISTINCT
8140: 20 20 20 2d 2d 20 75 6e 69 71 75 65 20 63 73 65 -- unique cse
8150: 74 2f 66 69 6c 65 20 70 61 69 72 73 0a 09 09 09 t/file pairs....
8160: 09 09 20 20 20 20 20 20 20 20 20 20 20 20 43 49 .. CI
8170: 2e 63 69 64 20 41 53 20 63 69 64 2c 20 2d 2d 20 .cid AS cid, --
8180: 42 72 61 6e 63 68 20 63 68 61 6e 67 65 73 65 74 Branch changeset
8190: 0a 09 09 09 09 09 20 20 20 20 20 20 20 20 20 20 ......
81a0: 20 20 42 2e 66 69 64 20 20 41 53 20 66 69 64 20 B.fid AS fid
81b0: 20 2d 2d 20 46 69 6c 65 20 6f 66 20 69 74 65 6d -- File of item
81c0: 20 69 6e 20 63 68 61 6e 67 65 73 65 74 0a 09 09 in changeset...
81d0: 09 09 09 20 20 20 20 20 46 52 4f 4d 20 20 20 63 ... FROM c
81e0: 73 69 74 65 6d 20 43 49 2c 20 63 68 61 6e 67 65 sitem CI, change
81f0: 73 65 74 20 43 2c 20 62 72 61 6e 63 68 20 42 0a set C, branch B.
8200: 09 09 09 09 09 20 20 20 20 20 57 48 45 52 45 20 ..... WHERE
8210: 20 43 49 2e 69 69 64 20 3d 20 42 2e 62 69 64 20 CI.iid = B.bid
8220: 20 2d 2d 20 67 65 74 20 74 61 67 20 6f 66 20 69 -- get tag of i
8230: 74 65 6d 20 69 6e 20 63 68 61 6e 67 65 73 65 74 tem in changeset
8240: 0a 09 09 09 09 09 20 20 20 20 20 41 4e 44 20 20 ...... AND
8250: 20 20 43 2e 63 69 64 20 20 3d 20 43 49 2e 63 69 C.cid = CI.ci
8260: 64 20 2d 2d 20 67 65 74 20 63 68 61 6e 67 65 73 d -- get changes
8270: 65 74 20 6f 66 20 69 74 65 6d 0a 09 09 09 09 09 et of item......
8280: 20 20 20 20 20 41 4e 44 20 20 20 20 43 2e 74 79 AND C.ty
8290: 70 65 20 3d 20 32 20 20 20 20 20 20 2d 2d 20 6c pe = 2 -- l
82a0: 69 6d 69 74 20 74 6f 20 62 72 61 6e 63 68 20 63 imit to branch c
82b0: 68 61 6e 67 65 73 65 74 73 0a 09 09 09 09 09 20 hangesets......
82c0: 20 20 20 20 29 20 41 53 20 55 0a 09 09 09 09 20 ) AS U.....
82d0: 20 20 20 20 20 20 47 52 4f 55 50 20 42 59 20 55 GROUP BY U
82e0: 2e 63 69 64 20 2d 2d 20 61 67 67 72 65 67 61 74 .cid -- aggregat
82f0: 65 20 62 79 20 63 73 65 74 73 2c 20 63 6f 75 6e e by csets, coun
8300: 74 20 66 69 6c 65 73 2f 63 73 65 74 0a 09 09 09 t files/cset....
8310: 09 20 20 20 20 20 20 29 20 41 53 20 55 55 2c 0a . ) AS UU,.
8320: 09 09 09 09 20 20 20 20 20 20 28 53 45 4c 45 43 .... (SELEC
8330: 54 20 56 2e 63 69 64 20 20 20 20 20 20 20 20 20 T V.cid
8340: 41 53 20 63 69 64 2c 20 20 20 2d 2d 20 63 68 61 AS cid, -- cha
8350: 6e 67 65 73 65 74 0a 09 09 09 09 20 20 20 20 20 ngeset.....
8360: 20 20 20 20 20 20 20 20 20 43 4f 55 4e 54 20 28 COUNT (
8370: 56 2e 69 69 64 29 20 41 53 20 72 63 6f 75 6e 74 V.iid) AS rcount
8380: 20 2d 2d 20 6e 75 6d 62 65 72 20 6f 66 20 69 74 -- number of it
8390: 65 6d 73 20 69 6e 20 63 73 65 74 0a 09 09 09 09 ems in cset.....
83a0: 20 20 20 20 20 20 20 46 52 4f 4d 20 20 20 63 73 FROM cs
83b0: 69 74 65 6d 20 56 2c 20 63 68 61 6e 67 65 73 65 item V, changese
83c0: 74 20 58 0a 09 09 09 09 20 20 20 20 20 20 20 57 t X..... W
83d0: 48 45 52 45 20 20 58 2e 63 69 64 20 20 3d 20 56 HERE X.cid = V
83e0: 2e 63 69 64 20 2d 2d 20 67 65 74 20 63 68 61 6e .cid -- get chan
83f0: 67 65 73 65 74 20 6f 66 20 69 74 65 6d 0a 09 09 geset of item...
8400: 09 09 20 20 20 20 20 20 20 41 4e 44 20 20 20 20 .. AND
8410: 58 2e 74 79 70 65 20 3d 20 32 20 20 20 20 20 2d X.type = 2 -
8420: 2d 20 6c 69 6d 69 74 20 74 6f 20 62 72 61 6e 63 - limit to branc
8430: 68 20 63 68 61 6e 67 65 73 65 74 73 0a 09 09 09 h changesets....
8440: 09 20 20 20 20 20 20 20 47 52 4f 55 50 20 42 59 . GROUP BY
8450: 20 56 2e 63 69 64 09 20 20 20 20 20 2d 2d 20 61 V.cid. -- a
8460: 67 67 72 65 67 61 74 65 20 62 79 20 63 73 65 74 ggregate by cset
8470: 73 2c 20 63 6f 75 6e 74 20 69 74 65 6d 73 2f 63 s, count items/c
8480: 73 65 74 0a 09 09 09 09 20 20 20 20 20 20 29 20 set..... )
8490: 41 53 20 56 56 0a 09 09 09 09 20 57 48 45 52 45 AS VV..... WHERE
84a0: 20 56 56 2e 63 69 64 20 3d 20 55 55 2e 63 69 64 VV.cid = UU.cid
84b0: 20 20 20 20 20 20 20 2d 2d 20 73 79 6e 63 20 23 -- sync #
84c0: 69 74 65 6d 73 2f 63 73 65 74 20 77 69 74 68 20 items/cset with
84d0: 23 66 69 6c 65 73 2f 63 73 65 74 0a 09 09 09 09 #files/cset.....
84e0: 20 41 4e 44 20 20 20 55 55 2e 66 63 6f 75 6e 74 AND UU.fcount
84f0: 20 3c 20 56 56 2e 72 63 6f 75 6e 74 20 2d 2d 20 < VV.rcount --
8500: 6c 65 73 73 20 66 69 6c 65 73 20 74 68 61 6e 20 less files than
8510: 69 74 65 6d 73 0a 09 09 09 09 09 09 09 20 20 20 items........
8520: 20 20 2d 2d 20 3d 3e 20 69 74 65 6d 73 20 62 65 -- => items be
8530: 6c 6f 6e 67 20 74 6f 20 74 68 65 20 73 61 6d 65 long to the same
8540: 20 66 69 6c 65 2e 0a 09 09 09 09 29 0a 09 09 41 file......)...A
8550: 4e 44 20 20 20 20 54 2e 74 69 64 20 3d 20 43 2e ND T.tid = C.
8560: 74 79 70 65 20 2d 2d 20 67 65 74 20 72 65 61 64 type -- get read
8570: 61 62 6c 65 20 63 68 61 6e 67 65 73 65 74 20 74 able changeset t
8580: 79 70 65 0a 09 20 20 20 20 7d 0a 09 72 65 74 75 ype.. }..retu
8590: 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 70 72 rn. }.. pr
85a0: 6f 63 20 5f 5f 5f 55 6e 75 73 65 64 43 68 61 6e oc ___UnusedChan
85b0: 67 65 73 65 74 43 68 65 63 6b 73 5f 5f 5f 20 7b gesetChecks___ {
85c0: 7d 20 7b 0a 09 23 20 54 68 69 73 20 63 6f 64 65 } {..# This code
85d0: 20 70 65 72 66 6f 72 6d 73 20 61 20 6e 75 6d 62 performs a numb
85e0: 65 72 20 6f 66 20 70 61 72 61 6e 6f 69 64 20 63 er of paranoid c
85f0: 68 65 63 6b 73 20 6f 66 20 74 68 65 0a 09 23 20 hecks of the..#
8600: 64 61 74 61 62 61 73 65 2c 20 73 65 61 72 63 68 database, search
8610: 69 6e 67 20 66 6f 72 20 69 6e 63 6f 6e 73 69 73 ing for inconsis
8620: 74 65 6e 74 20 63 68 61 6e 67 65 73 65 74 2f 72 tent changeset/r
8630: 65 76 69 73 69 6f 6e 0a 09 23 20 69 6e 66 6f 72 evision..# infor
8640: 6d 61 74 69 6f 6e 2e 0a 0a 09 72 65 74 75 72 6e mation....return
8650: 20 3b 20 23 20 44 69 73 61 62 6c 65 64 20 66 6f ; # Disabled fo
8660: 72 20 6e 6f 77 2c 20 62 6f 74 74 6c 65 6e 65 63 r now, bottlenec
8670: 6b 73 20 2e 2e 2e 0a 0a 09 75 70 76 61 72 20 31 ks ......upvar 1
8680: 20 6e 20 6e 20 3b 20 23 20 43 6f 75 6e 74 65 72 n n ; # Counter
8690: 20 66 6f 72 20 74 68 65 20 63 68 65 63 6b 73 20 for the checks
86a0: 28 77 65 20 70 72 69 6e 74 20 61 6e 20 69 64 20 (we print an id
86b0: 62 65 66 6f 72 65 0a 09 09 20 20 20 20 20 20 23 before... #
86c0: 20 74 68 65 20 6d 61 69 6e 20 6c 61 62 65 6c 29 the main label)
86d0: 2e 0a 0a 09 23 20 54 68 65 20 6e 65 78 74 20 74 ....# The next t
86e0: 77 6f 20 63 68 65 63 6b 73 20 61 72 65 20 42 4f wo checks are BO
86f0: 54 54 4c 45 4e 45 43 4b 53 2e 20 49 6e 20 65 73 TTLENECKS. In es
8700: 73 65 6e 63 65 20 77 65 20 61 72 65 0a 09 23 20 sence we are..#
8710: 63 68 65 63 6b 69 6e 67 20 65 61 63 68 20 73 79 checking each sy
8720: 6d 62 6f 6c 20 63 68 61 6e 67 65 73 65 74 20 6f mbol changeset o
8730: 6e 65 20 62 79 20 6f 6e 65 2e 0a 0a 09 23 20 54 ne by one....# T
8740: 4f 44 4f 3a 20 54 72 79 20 74 6f 20 72 65 70 68 ODO: Try to reph
8750: 72 61 73 65 20 74 68 65 20 63 68 65 63 6b 73 20 rase the checks
8760: 74 6f 20 6d 61 6b 65 20 6d 6f 72 65 20 75 73 65 to make more use
8770: 20 6f 66 0a 09 23 20 69 6e 64 69 63 65 73 2c 20 of..# indices,
8780: 73 65 74 20 61 6e 64 20 73 74 72 65 61 6d 20 6f set and stream o
8790: 70 65 72 61 74 69 6f 6e 73 2e 0a 0a 09 23 20 41 perations....# A
87a0: 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 75 73 65 ll revisions use
87b0: 64 20 62 79 20 74 61 67 20 73 79 6d 62 6f 6c 20 d by tag symbol
87c0: 63 68 61 6e 67 65 73 65 74 73 20 68 61 76 65 20 changesets have
87d0: 74 6f 20 68 61 76 65 20 74 68 65 0a 09 23 20 63 to have the..# c
87e0: 68 61 6e 67 65 73 65 74 27 73 20 74 61 67 20 61 hangeset's tag a
87f0: 73 73 6f 63 69 61 74 65 64 20 77 69 74 68 20 74 ssociated with t
8800: 68 65 6d 2e 0a 09 43 68 65 63 6b 52 65 76 43 53 hem...CheckRevCS
8810: 20 5c 0a 09 20 20 20 20 7b 41 6c 6c 20 72 65 76 \.. {All rev
8820: 69 73 69 6f 6e 73 20 75 73 65 64 20 62 79 20 74 isions used by t
8830: 61 67 20 73 79 6d 62 6f 6c 20 63 68 61 6e 67 65 ag symbol change
8840: 73 65 74 73 20 68 61 76 65 20 74 6f 20 68 61 76 sets have to hav
8850: 65 20 74 68 65 20 63 68 61 6e 67 65 73 65 74 27 e the changeset'
8860: 73 20 74 61 67 20 61 74 74 61 63 68 65 64 20 74 s tag attached t
8870: 6f 20 74 68 65 6d 7d 20 5c 0a 09 20 20 20 20 7b o them} \.. {
8880: 64 6f 65 73 20 6e 6f 74 20 68 61 76 65 20 74 68 does not have th
8890: 65 20 74 61 67 20 6f 66 20 69 74 73 20 73 79 6d e tag of its sym
88a0: 62 6f 6c 20 63 68 61 6e 67 65 73 65 74 20 40 20 bol changeset @
88b0: 61 74 74 61 63 68 65 64 20 74 6f 20 69 74 7d 20 attached to it}
88c0: 7b 0a 09 09 53 45 4c 45 43 54 20 43 54 2e 6e 61 {...SELECT CT.na
88d0: 6d 65 2c 20 43 2e 63 69 64 2c 20 46 2e 6e 61 6d me, C.cid, F.nam
88e0: 65 2c 20 52 2e 72 65 76 0a 09 09 46 52 4f 4d 20 e, R.rev...FROM
88f0: 20 20 63 68 61 6e 67 65 73 65 74 20 43 2c 20 63 changeset C, c
8900: 73 74 79 70 65 20 43 54 2c 20 72 65 76 69 73 69 stype CT, revisi
8910: 6f 6e 20 52 2c 20 66 69 6c 65 20 46 2c 20 63 73 on R, file F, cs
8920: 69 74 65 6d 20 43 49 2c 20 74 61 67 20 54 0a 09 item CI, tag T..
8930: 09 57 48 45 52 45 20 20 43 2e 74 79 70 65 20 3d .WHERE C.type =
8940: 20 31 20 20 20 20 20 20 20 2d 2d 20 73 79 6d 62 1 -- symb
8950: 6f 6c 20 63 68 61 6e 67 65 73 65 74 73 20 6f 6e ol changesets on
8960: 6c 79 0a 09 09 41 4e 44 20 20 20 20 43 2e 73 72 ly...AND C.sr
8970: 63 20 20 3d 20 54 2e 73 69 64 20 20 20 2d 2d 20 c = T.sid --
8980: 74 61 67 20 6f 6e 6c 79 2c 20 6c 69 6e 6b 65 64 tag only, linked
8990: 20 62 79 20 73 79 6d 62 6f 6c 20 69 64 0a 09 09 by symbol id...
89a0: 41 4e 44 20 20 20 20 43 2e 63 69 64 20 20 3d 20 AND C.cid =
89b0: 43 49 2e 63 69 64 20 20 2d 2d 20 63 68 61 6e 67 CI.cid -- chang
89c0: 65 73 65 74 20 2d 2d 3e 20 69 74 73 20 72 65 76 eset --> its rev
89d0: 69 73 69 6f 6e 73 0a 09 09 41 4e 44 20 20 20 20 isions...AND
89e0: 52 2e 72 69 64 20 20 3d 20 43 49 2e 69 69 64 20 R.rid = CI.iid
89f0: 20 2d 2d 20 6c 6f 6f 6b 20 61 74 20 74 68 65 20 -- look at the
8a00: 72 65 76 69 73 69 6f 6e 73 0a 09 09 2d 2d 20 61 revisions...-- a
8a10: 6e 64 20 6c 6f 6f 6b 20 66 6f 72 20 74 68 65 20 nd look for the
8a20: 74 61 67 20 61 6d 6f 6e 67 20 74 68 65 20 61 74 tag among the at
8a30: 74 61 63 68 65 64 20 6f 6e 65 73 2e 0a 09 09 41 tached ones....A
8a40: 4e 44 20 20 20 20 54 2e 73 69 64 20 4e 4f 54 20 ND T.sid NOT
8a50: 49 4e 20 28 53 45 4c 45 43 54 20 54 42 2e 73 69 IN (SELECT TB.si
8a60: 64 0a 09 09 09 09 20 20 20 20 20 46 52 4f 4d 20 d..... FROM
8a70: 20 20 74 61 67 20 54 42 0a 09 09 09 09 20 20 20 tag TB.....
8a80: 20 20 57 48 45 52 45 20 20 54 42 2e 72 65 76 20 WHERE TB.rev
8a90: 3d 20 52 2e 72 69 64 29 0a 09 09 41 4e 44 20 20 = R.rid)...AND
8aa0: 20 20 52 2e 66 69 64 20 3d 20 46 2e 66 69 64 20 R.fid = F.fid
8ab0: 20 20 20 2d 2d 20 67 65 74 20 66 69 6c 65 20 6f -- get file o
8ac0: 66 20 72 65 76 69 73 69 6f 6e 0a 09 20 20 20 20 f revision..
8ad0: 7d 0a 0a 09 23 20 41 6c 6c 20 72 65 76 69 73 69 }...# All revisi
8ae0: 6f 6e 73 20 75 73 65 64 20 62 79 20 62 72 61 6e ons used by bran
8af0: 63 68 20 73 79 6d 62 6f 6c 20 63 68 61 6e 67 65 ch symbol change
8b00: 73 65 74 73 20 68 61 76 65 20 74 6f 20 68 61 76 sets have to hav
8b10: 65 0a 09 23 20 74 68 65 20 63 68 61 6e 67 65 73 e..# the changes
8b20: 65 74 27 73 20 62 72 61 6e 63 68 20 61 73 73 6f et's branch asso
8b30: 63 69 61 74 65 64 20 77 69 74 68 20 74 68 65 6d ciated with them
8b40: 2e 0a 0a 09 43 68 65 63 6b 52 65 76 43 53 20 5c ....CheckRevCS \
8b50: 0a 09 20 20 20 20 7b 41 6c 6c 20 72 65 76 69 73 .. {All revis
8b60: 69 6f 6e 73 20 75 73 65 64 20 62 79 20 62 72 61 ions used by bra
8b70: 6e 63 68 20 73 79 6d 62 6f 6c 20 63 68 61 6e 67 nch symbol chang
8b80: 65 73 65 74 73 20 68 61 76 65 20 74 6f 20 68 61 esets have to ha
8b90: 76 65 20 74 68 65 20 63 68 61 6e 67 65 73 65 74 ve the changeset
8ba0: 27 73 20 62 72 61 6e 63 68 20 61 74 74 61 63 68 's branch attach
8bb0: 65 64 20 74 6f 20 74 68 65 6d 7d 20 5c 0a 09 20 ed to them} \..
8bc0: 20 20 20 7b 64 6f 65 73 20 6e 6f 74 20 68 61 76 {does not hav
8bd0: 65 20 74 68 65 20 62 72 61 6e 63 68 20 6f 66 20 e the branch of
8be0: 69 74 73 20 73 79 6d 62 6f 6c 20 63 68 61 6e 67 its symbol chang
8bf0: 65 73 65 74 20 40 20 61 74 74 61 63 68 65 64 20 eset @ attached
8c00: 74 6f 20 69 74 7d 20 7b 0a 09 09 53 45 4c 45 43 to it} {...SELEC
8c10: 54 20 43 54 2e 6e 61 6d 65 2c 20 43 2e 63 69 64 T CT.name, C.cid
8c20: 2c 20 46 2e 6e 61 6d 65 2c 20 52 2e 72 65 76 2c , F.name, R.rev,
8c30: 20 43 2e 63 69 64 0a 09 09 46 52 4f 4d 20 20 20 C.cid...FROM
8c40: 63 68 61 6e 67 65 73 65 74 20 43 2c 20 63 73 74 changeset C, cst
8c50: 79 70 65 20 43 54 2c 20 72 65 76 69 73 69 6f 6e ype CT, revision
8c60: 20 52 2c 20 66 69 6c 65 20 46 2c 20 63 73 69 74 R, file F, csit
8c70: 65 6d 20 43 49 2c 20 62 72 61 6e 63 68 20 42 0a em CI, branch B.
8c80: 09 09 57 48 45 52 45 20 20 43 2e 74 79 70 65 20 ..WHERE C.type
8c90: 3d 20 31 20 20 20 20 20 20 20 2d 2d 20 73 79 6d = 1 -- sym
8ca0: 62 6f 6c 20 63 68 61 6e 67 65 73 65 74 73 20 6f bol changesets o
8cb0: 6e 6c 79 0a 09 09 41 4e 44 20 20 20 20 43 2e 73 nly...AND C.s
8cc0: 72 63 20 20 3d 20 42 2e 73 69 64 20 20 20 2d 2d rc = B.sid --
8cd0: 20 62 72 61 6e 63 68 65 73 20 6f 6e 6c 79 0a 09 branches only..
8ce0: 09 41 4e 44 20 20 20 20 43 2e 63 69 64 20 20 3d .AND C.cid =
8cf0: 20 43 49 2e 63 69 64 20 20 2d 2d 20 63 68 61 6e CI.cid -- chan
8d00: 67 65 73 65 74 20 2d 2d 3e 20 69 74 73 20 72 65 geset --> its re
8d10: 76 69 73 69 6f 6e 73 0a 09 09 41 4e 44 20 20 20 visions...AND
8d20: 20 52 2e 72 69 64 20 20 3d 20 43 49 2e 69 69 64 R.rid = CI.iid
8d30: 20 20 2d 2d 20 6c 6f 6f 6b 20 61 74 20 74 68 65 -- look at the
8d40: 20 72 65 76 69 73 69 6f 6e 73 0a 09 09 2d 2d 20 revisions...--
8d50: 61 6e 64 20 6c 6f 6f 6b 20 66 6f 72 20 74 68 65 and look for the
8d60: 20 62 72 61 6e 63 68 20 61 6d 6f 6e 67 20 74 68 branch among th
8d70: 65 20 61 74 74 61 63 68 65 64 20 6f 6e 65 73 2e e attached ones.
8d80: 0a 09 09 41 4e 44 20 20 20 20 42 2e 73 69 64 20 ...AND B.sid
8d90: 4e 4f 54 20 49 4e 20 28 53 45 4c 45 43 54 20 42 NOT IN (SELECT B
8da0: 42 2e 73 69 64 0a 09 09 09 09 20 20 20 20 20 46 B.sid..... F
8db0: 52 4f 4d 20 20 20 62 72 61 6e 63 68 20 42 42 0a ROM branch BB.
8dc0: 09 09 09 09 20 20 20 20 20 57 48 45 52 45 20 20 .... WHERE
8dd0: 42 42 2e 72 6f 6f 74 20 3d 20 52 2e 72 69 64 29 BB.root = R.rid)
8de0: 0a 09 09 41 4e 44 20 20 20 20 52 2e 66 69 64 20 ...AND R.fid
8df0: 3d 20 46 2e 66 69 64 20 20 20 20 2d 2d 20 67 65 = F.fid -- ge
8e00: 74 20 66 69 6c 65 20 6f 66 20 72 65 76 69 73 69 t file of revisi
8e10: 6f 6e 0a 09 20 20 20 20 7d 0a 0a 09 23 20 54 4f on.. }...# TO
8e20: 44 4f 0a 09 23 20 54 68 65 20 73 74 61 74 65 20 DO..# The state
8e30: 68 61 73 20 74 6f 20 63 6f 6e 74 61 69 6e 20 61 has to contain a
8e40: 74 20 6c 65 61 73 74 20 6f 6e 65 20 74 61 67 20 t least one tag
8e50: 73 79 6d 62 6f 6c 20 63 68 61 6e 67 65 73 65 74 symbol changeset
8e60: 0a 09 23 20 66 6f 72 20 61 6c 6c 20 6b 6e 6f 77 ..# for all know
8e70: 6e 20 74 61 67 73 2e 0a 0a 09 23 20 54 4f 44 4f n tags....# TODO
8e80: 0a 09 23 20 54 68 65 20 73 74 61 74 65 20 68 61 ..# The state ha
8e90: 73 20 74 6f 20 63 6f 6e 74 61 69 6e 20 61 74 20 s to contain at
8ea0: 6c 65 61 73 74 20 6f 6e 65 20 62 72 61 6e 63 68 least one branch
8eb0: 20 73 79 6d 62 6f 6c 20 63 68 61 6e 67 65 73 65 symbol changese
8ec0: 74 0a 09 23 20 66 6f 72 20 61 6c 6c 20 6b 6e 6f t..# for all kno
8ed0: 77 6e 20 62 72 61 6e 63 68 65 73 2e 0a 09 72 65 wn branches...re
8ee0: 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 0a 20 20 20 turn. }...
8ef0: 20 70 72 6f 63 20 43 68 65 63 6b 52 65 76 20 7b proc CheckRev {
8f00: 68 65 61 64 65 72 20 6c 61 62 65 6c 20 73 71 6c header label sql
8f10: 7d 20 7b 0a 09 75 70 76 61 72 20 31 20 6e 20 6e } {..upvar 1 n n
8f20: 0a 09 73 65 74 20 6f 6b 20 31 0a 09 66 6f 72 65 ..set ok 1..fore
8f30: 61 63 68 20 7b 66 6e 61 6d 65 20 72 65 76 6e 72 ach {fname revnr
8f40: 7d 20 5b 73 74 61 74 65 20 72 75 6e 20 24 73 71 } [state run $sq
8f50: 6c 5d 20 7b 0a 09 20 20 20 20 73 65 74 20 6f 6b l] {.. set ok
8f60: 20 30 0a 09 20 20 20 20 74 72 6f 75 62 6c 65 20 0.. trouble
8f70: 66 61 74 61 6c 20 22 24 7b 72 65 76 6e 72 7d 3a fatal "${revnr}:
8f80: 3a 24 66 6e 61 6d 65 20 24 6c 61 62 65 6c 22 0a :$fname $label".
8f90: 09 7d 0a 09 6c 6f 67 20 77 72 69 74 65 20 35 20 .}..log write 5
8fa0: 69 6e 74 65 67 72 69 74 79 20 7b 5c 5b 5b 66 6f integrity {\[[fo
8fb0: 72 6d 61 74 20 25 30 32 64 20 5b 69 6e 63 72 20 rmat %02d [incr
8fc0: 6e 5d 5d 5c 5d 20 5b 65 78 70 72 20 7b 24 6f 6b n]]\] [expr {$ok
8fd0: 20 3f 20 22 4f 6b 20 20 20 20 22 20 3a 20 22 46 ? "Ok " : "F
8fe0: 61 69 6c 65 64 22 7d 5d 20 2e 2e 2e 20 24 68 65 ailed"}] ... $he
8ff0: 61 64 65 72 7d 0a 09 72 65 74 75 72 6e 0a 20 20 ader}..return.
9000: 20 20 7d 0a 0a 20 20 20 20 70 72 6f 63 20 43 68 }.. proc Ch
9010: 65 63 6b 54 61 67 20 7b 68 65 61 64 65 72 20 6c eckTag {header l
9020: 61 62 65 6c 20 73 71 6c 7d 20 7b 0a 09 75 70 76 abel sql} {..upv
9030: 61 72 20 31 20 6e 20 6e 0a 09 73 65 74 20 6f 6b ar 1 n n..set ok
9040: 20 31 0a 09 66 6f 72 65 61 63 68 20 7b 70 6e 61 1..foreach {pna
9050: 6d 65 20 73 6e 61 6d 65 7d 20 5b 73 74 61 74 65 me sname} [state
9060: 20 72 75 6e 20 24 73 71 6c 5d 20 7b 0a 09 20 20 run $sql] {..
9070: 20 20 73 65 74 20 6f 6b 20 30 0a 09 20 20 20 20 set ok 0..
9080: 74 72 6f 75 62 6c 65 20 66 61 74 61 6c 20 22 3c trouble fatal "<
9090: 24 70 6e 61 6d 65 20 74 61 67 20 27 24 73 6e 61 $pname tag '$sna
90a0: 6d 65 27 3e 20 24 6c 61 62 65 6c 22 0a 09 7d 0a me'> $label"..}.
90b0: 09 6c 6f 67 20 77 72 69 74 65 20 35 20 69 6e 74 .log write 5 int
90c0: 65 67 72 69 74 79 20 7b 5c 5b 5b 66 6f 72 6d 61 egrity {\[[forma
90d0: 74 20 25 30 32 64 20 5b 69 6e 63 72 20 6e 5d 5d t %02d [incr n]]
90e0: 5c 5d 20 5b 65 78 70 72 20 7b 24 6f 6b 20 3f 20 \] [expr {$ok ?
90f0: 22 4f 6b 20 20 20 20 22 20 3a 20 22 46 61 69 6c "Ok " : "Fail
9100: 65 64 22 7d 5d 20 2e 2e 2e 20 24 68 65 61 64 65 ed"}] ... $heade
9110: 72 7d 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 7d r}..return. }
9120: 0a 0a 20 20 20 20 70 72 6f 63 20 43 68 65 63 6b .. proc Check
9130: 42 72 61 6e 63 68 20 7b 68 65 61 64 65 72 20 6c Branch {header l
9140: 61 62 65 6c 20 73 71 6c 7d 20 7b 0a 09 75 70 76 abel sql} {..upv
9150: 61 72 20 31 20 6e 20 6e 0a 09 73 65 74 20 6f 6b ar 1 n n..set ok
9160: 20 31 0a 09 66 6f 72 65 61 63 68 20 7b 70 6e 61 1..foreach {pna
9170: 6d 65 20 73 6e 61 6d 65 7d 20 5b 73 74 61 74 65 me sname} [state
9180: 20 72 75 6e 20 24 73 71 6c 5d 20 7b 0a 09 20 20 run $sql] {..
9190: 20 20 73 65 74 20 6f 6b 20 30 0a 09 20 20 20 20 set ok 0..
91a0: 74 72 6f 75 62 6c 65 20 66 61 74 61 6c 20 22 3c trouble fatal "<
91b0: 24 70 6e 61 6d 65 20 62 72 61 6e 63 68 20 27 24 $pname branch '$
91c0: 73 6e 61 6d 65 27 3e 20 24 6c 61 62 65 6c 22 0a sname'> $label".
91d0: 09 7d 0a 09 6c 6f 67 20 77 72 69 74 65 20 35 20 .}..log write 5
91e0: 69 6e 74 65 67 72 69 74 79 20 7b 5c 5b 5b 66 6f integrity {\[[fo
91f0: 72 6d 61 74 20 25 30 32 64 20 5b 69 6e 63 72 20 rmat %02d [incr
9200: 6e 5d 5d 5c 5d 20 5b 65 78 70 72 20 7b 24 6f 6b n]]\] [expr {$ok
9210: 20 3f 20 22 4f 6b 20 20 20 20 22 20 3a 20 22 46 ? "Ok " : "F
9220: 61 69 6c 65 64 22 7d 5d 20 2e 2e 2e 20 24 68 65 ailed"}] ... $he
9230: 61 64 65 72 7d 0a 09 72 65 74 75 72 6e 0a 20 20 ader}..return.
9240: 20 20 7d 0a 0a 20 20 20 20 70 72 6f 63 20 43 68 }.. proc Ch
9250: 65 63 6b 43 53 20 7b 68 65 61 64 65 72 20 6c 61 eckCS {header la
9260: 62 65 6c 20 73 71 6c 7d 20 7b 0a 09 75 70 76 61 bel sql} {..upva
9270: 72 20 31 20 6e 20 6e 0a 09 73 65 74 20 6f 6b 20 r 1 n n..set ok
9280: 31 0a 09 66 6f 72 65 61 63 68 20 7b 63 74 79 70 1..foreach {ctyp
9290: 65 20 63 69 64 7d 20 5b 73 74 61 74 65 20 72 75 e cid} [state ru
92a0: 6e 20 24 73 71 6c 5d 20 7b 0a 09 20 20 20 20 73 n $sql] {.. s
92b0: 65 74 20 6f 6b 20 30 0a 09 20 20 20 20 74 72 6f et ok 0.. tro
92c0: 75 62 6c 65 20 66 61 74 61 6c 20 22 3c 24 63 74 uble fatal "<$ct
92d0: 79 70 65 20 24 63 69 64 3e 20 24 6c 61 62 65 6c ype $cid> $label
92e0: 22 0a 09 7d 0a 09 6c 6f 67 20 77 72 69 74 65 20 "..}..log write
92f0: 35 20 69 6e 74 65 67 72 69 74 79 20 7b 5c 5b 5b 5 integrity {\[[
9300: 66 6f 72 6d 61 74 20 25 30 32 64 20 5b 69 6e 63 format %02d [inc
9310: 72 20 6e 5d 5d 5c 5d 20 5b 65 78 70 72 20 7b 24 r n]]\] [expr {$
9320: 6f 6b 20 3f 20 22 4f 6b 20 20 20 20 22 20 3a 20 ok ? "Ok " :
9330: 22 46 61 69 6c 65 64 22 7d 5d 20 2e 2e 2e 20 24 "Failed"}] ... $
9340: 68 65 61 64 65 72 7d 0a 09 72 65 74 75 72 6e 0a header}..return.
9350: 20 20 20 20 7d 0a 0a 20 20 20 20 70 72 6f 63 20 }.. proc
9360: 43 68 65 63 6b 52 65 76 43 53 20 7b 68 65 61 64 CheckRevCS {head
9370: 65 72 20 6c 61 62 65 6c 20 73 71 6c 7d 20 7b 0a er label sql} {.
9380: 09 75 70 76 61 72 20 31 20 6e 20 6e 0a 09 73 65 .upvar 1 n n..se
9390: 74 20 6f 6b 20 31 0a 09 66 6f 72 65 61 63 68 20 t ok 1..foreach
93a0: 7b 63 73 74 79 70 65 20 63 73 69 64 20 66 6e 61 {cstype csid fna
93b0: 6d 65 20 72 65 76 6e 72 7d 20 5b 73 74 61 74 65 me revnr} [state
93c0: 20 72 75 6e 20 24 73 71 6c 5d 20 7b 0a 09 20 20 run $sql] {..
93d0: 20 20 73 65 74 20 6f 6b 20 30 0a 09 20 20 20 20 set ok 0..
93e0: 73 65 74 20 62 20 22 3c 24 63 73 74 79 70 65 20 set b "<$cstype
93f0: 24 63 73 69 64 3e 22 0a 09 20 20 20 20 74 72 6f $csid>".. tro
9400: 75 62 6c 65 20 66 61 74 61 6c 20 22 24 66 6e 61 uble fatal "$fna
9410: 6d 65 20 3c 24 72 65 76 6e 72 3e 20 5b 73 74 72 me <$revnr> [str
9420: 69 6e 67 20 6d 61 70 20 5b 6c 69 73 74 20 40 20 ing map [list @
9430: 24 62 5d 20 24 6c 61 62 65 6c 5d 22 0a 09 7d 0a $b] $label]"..}.
9440: 09 6c 6f 67 20 77 72 69 74 65 20 35 20 69 6e 74 .log write 5 int
9450: 65 67 72 69 74 79 20 7b 5c 5b 5b 66 6f 72 6d 61 egrity {\[[forma
9460: 74 20 25 30 32 64 20 5b 69 6e 63 72 20 6e 5d 5d t %02d [incr n]]
9470: 5c 5d 20 5b 65 78 70 72 20 7b 24 6f 6b 20 3f 20 \] [expr {$ok ?
9480: 22 4f 6b 20 20 20 20 22 20 3a 20 22 46 61 69 6c "Ok " : "Fail
9490: 65 64 22 7d 5d 20 2e 2e 2e 20 24 68 65 61 64 65 ed"}] ... $heade
94a0: 72 7d 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 7d r}..return. }
94b0: 0a 0a 20 20 20 20 23 20 23 20 23 23 20 23 23 23 .. # # ## ###
94c0: 20 23 23 23 23 23 20 23 23 23 23 23 23 23 23 20 ##### ########
94d0: 23 23 23 23 23 23 23 23 23 23 23 23 23 0a 20 20 #############.
94e0: 20 20 23 23 20 43 6f 6e 66 69 67 75 72 61 74 69 ## Configurati
94f0: 6f 6e 0a 0a 20 20 20 20 70 72 61 67 6d 61 20 2d on.. pragma -
9500: 68 61 73 69 6e 73 74 61 6e 63 65 73 20 20 20 6e hasinstances n
9510: 6f 20 3b 20 23 20 73 69 6e 67 6c 65 74 6f 6e 0a o ; # singleton.
9520: 20 20 20 20 70 72 61 67 6d 61 20 2d 68 61 73 74 pragma -hast
9530: 79 70 65 69 6e 66 6f 20 20 20 20 6e 6f 20 3b 20 ypeinfo no ;
9540: 23 20 6e 6f 20 69 6e 74 72 6f 73 70 65 63 74 69 # no introspecti
9550: 6f 6e 0a 20 20 20 20 70 72 61 67 6d 61 20 2d 68 on. pragma -h
9560: 61 73 74 79 70 65 64 65 73 74 72 6f 79 20 6e 6f astypedestroy no
9570: 20 3b 20 23 20 69 6d 6d 6f 72 74 61 6c 0a 0a 20 ; # immortal..
9580: 20 20 20 23 20 23 20 23 23 20 23 23 23 20 23 23 # # ## ### ##
9590: 23 23 23 20 23 23 23 23 23 23 23 23 20 23 23 23 ### ######## ###
95a0: 23 23 23 23 23 23 23 23 23 23 0a 7d 0a 0a 6e 61 ##########.}..na
95b0: 6d 65 73 70 61 63 65 20 65 76 61 6c 20 3a 3a 76 mespace eval ::v
95c0: 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 c::fossil::impor
95d0: 74 3a 3a 63 76 73 20 7b 0a 20 20 20 20 6e 61 6d t::cvs {. nam
95e0: 65 73 70 61 63 65 20 65 78 70 6f 72 74 20 69 6e espace export in
95f0: 74 65 67 72 69 74 79 0a 20 20 20 20 6e 61 6d 65 tegrity. name
9600: 73 70 61 63 65 20 65 76 61 6c 20 69 6e 74 65 67 space eval integ
9610: 72 69 74 79 20 7b 0a 09 6e 61 6d 65 73 70 61 63 rity {..namespac
9620: 65 20 69 6d 70 6f 72 74 20 3a 3a 76 63 3a 3a 66 e import ::vc::f
9630: 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 ossil::import::c
9640: 76 73 3a 3a 73 74 61 74 65 0a 09 6e 61 6d 65 73 vs::state..names
9650: 70 61 63 65 20 69 6d 70 6f 72 74 20 3a 3a 76 63 pace import ::vc
9660: 3a 3a 74 6f 6f 6c 73 3a 3a 74 72 6f 75 62 6c 65 ::tools::trouble
9670: 0a 09 6e 61 6d 65 73 70 61 63 65 20 69 6d 70 6f ..namespace impo
9680: 72 74 20 3a 3a 76 63 3a 3a 74 6f 6f 6c 73 3a 3a rt ::vc::tools::
9690: 6c 6f 67 0a 09 6c 6f 67 20 72 65 67 69 73 74 65 log..log registe
96a0: 72 20 69 6e 74 65 67 72 69 74 79 0a 20 20 20 20 r integrity.
96b0: 7d 0a 7d 0a 0a 23 20 23 20 23 23 20 23 23 23 20 }.}..# # ## ###
96c0: 23 23 23 23 23 20 23 23 23 23 23 23 23 23 20 23 ##### ######## #
96d0: 23 23 23 23 23 23 23 23 23 23 23 23 20 23 23 23 ############ ###
96e0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
96f0: 23 23 0a 23 23 20 52 65 61 64 79 0a 0a 70 61 63 ##.## Ready..pac
9700: 6b 61 67 65 20 70 72 6f 76 69 64 65 20 76 63 3a kage provide vc:
9710: 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a :fossil::import:
9720: 3a 63 76 73 3a 3a 69 6e 74 65 67 72 69 74 79 20 :cvs::integrity
9730: 31 2e 30 0a 72 65 74 75 72 6e 0a 1.0.return.