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 63 68 61 6e t used by a chan
2ea0: 67 65 73 65 74 7d 20 7b 0a 09 09 2d 2d 20 55 6e geset} {...-- Un
2eb0: 75 73 65 64 20 72 65 76 69 73 69 6f 6e 73 20 3d used revisions =
2ec0: 20 41 6c 6c 20 72 65 76 69 73 69 6f 6e 73 0a 09 All revisions..
2ed0: 09 2d 2d 20 20 20 20 20 20 20 20 20 20 20 20 20 .--
2ee0: 20 20 20 20 20 2d 20 72 65 76 69 73 69 6f 6e 73 - revisions
2ef0: 20 75 73 65 64 20 62 79 20 72 65 76 69 73 69 6f used by revisio
2f00: 6e 20 63 68 61 6e 67 65 73 65 74 73 2e 0a 09 09 n changesets....
2f10: 2d 2d 0a 09 09 2d 2d 20 42 6f 74 68 20 73 65 74 --...-- Both set
2f20: 73 20 63 61 6e 20 62 65 20 63 6f 6d 70 75 74 65 s can be compute
2f30: 64 20 65 61 73 69 6c 79 2c 20 61 6e 64 20 73 75 d easily, and su
2f40: 62 74 72 61 63 74 65 64 0a 20 20 20 20 20 20 20 btracted.
2f50: 20 20 20 20 20 20 20 20 20 2d 2d 20 66 72 6f 6d -- from
2f60: 20 65 61 63 68 20 6f 74 68 65 72 2e 20 54 68 65 each other. The
2f70: 6e 20 77 65 20 63 61 6e 20 67 65 74 20 74 68 65 n we can get the
2f80: 20 61 73 73 6f 63 69 61 74 65 64 0a 20 20 20 20 associated.
2f90: 20 20 20 20 20 20 20 20 20 20 20 20 2d 2d 20 66 -- f
2fa0: 69 6c 65 20 28 6e 61 6d 65 29 20 66 6f 72 20 64 ile (name) for d
2fb0: 69 73 70 6c 61 79 2e 0a 0a 09 09 53 45 4c 45 43 isplay.....SELEC
2fc0: 54 20 46 2e 6e 61 6d 65 2c 20 52 2e 72 65 76 0a T F.name, R.rev.
2fd0: 09 09 46 52 4f 4d 20 72 65 76 69 73 69 6f 6e 20 ..FROM revision
2fe0: 52 2c 20 66 69 6c 65 20 46 0a 09 09 57 48 45 52 R, file F...WHER
2ff0: 45 20 52 2e 72 69 64 20 49 4e 20 28 53 45 4c 45 E R.rid IN (SELE
3000: 43 54 20 72 69 64 0a 09 09 09 09 46 52 4f 4d 20 CT rid.....FROM
3010: 72 65 76 69 73 69 6f 6e 20 20 20 20 20 20 20 20 revision
3020: 20 20 20 20 20 20 20 20 2d 2d 20 41 6c 6c 20 72 -- All r
3030: 65 76 69 73 69 6f 6e 73 0a 09 09 09 09 45 58 43 evisions.....EXC
3040: 45 50 54 20 20 20 20 20 20 20 20 20 20 20 20 20 EPT
3050: 20 20 20 20 20 20 20 20 20 20 2d 2d 20 73 75 62 -- sub
3060: 74 72 61 63 74 0a 09 09 09 09 53 45 4c 45 43 54 tract.....SELECT
3070: 20 43 49 2e 69 69 64 0a 09 09 09 09 46 52 4f 4d CI.iid.....FROM
3080: 20 63 73 69 74 65 6d 20 43 49 2c 20 63 68 61 6e csitem CI, chan
3090: 67 65 73 65 74 20 43 20 20 2d 2d 20 72 65 76 69 geset C -- revi
30a0: 73 69 6f 6e 73 20 75 73 65 64 0a 09 09 09 09 57 sions used.....W
30b0: 48 45 52 45 20 43 2e 63 69 64 20 3d 20 43 49 2e HERE C.cid = CI.
30c0: 63 69 64 20 20 20 20 20 20 20 20 20 2d 2d 20 62 cid -- b
30d0: 79 20 61 6e 79 20 72 65 76 69 73 69 6f 6e 0a 09 y any revision..
30e0: 09 09 09 41 4e 44 20 43 2e 74 79 70 65 20 3d 20 ...AND C.type =
30f0: 30 29 20 20 20 20 20 20 20 20 20 20 20 20 20 20 0)
3100: 2d 2d 20 63 68 61 6e 67 65 73 65 74 0a 09 09 41 -- changeset...A
3110: 4e 44 20 20 20 52 2e 66 69 64 20 3d 20 46 2e 66 ND R.fid = F.f
3120: 69 64 20 20 20 20 20 20 20 20 20 20 20 20 20 20 id
3130: 2d 2d 20 67 65 74 20 66 69 6c 65 20 6f 66 20 75 -- get file of u
3140: 6e 75 73 65 64 20 72 65 76 69 73 69 6f 6e 0a 09 nused revision..
3150: 20 20 20 20 7d 0a 09 23 20 46 69 6e 64 20 61 6c }..# Find al
3160: 6c 20 72 65 76 69 73 69 6f 6e 73 20 77 68 69 63 l revisions whic
3170: 68 20 61 72 65 20 75 73 65 64 20 62 79 20 6d 6f h are used by mo
3180: 72 65 20 74 68 61 6e 20 6f 6e 65 0a 09 23 20 63 re than one..# c
3190: 68 61 6e 67 65 73 65 74 2e 0a 09 43 68 65 63 6b hangeset...Check
31a0: 52 65 76 20 5c 0a 09 20 20 20 20 7b 41 6c 6c 20 Rev \.. {All
31b0: 72 65 76 69 73 69 6f 6e 73 20 68 61 76 65 20 74 revisions have t
31c0: 6f 20 62 65 20 75 73 65 64 20 62 79 20 61 74 20 o be used by at
31d0: 6d 6f 73 74 20 6f 6e 65 20 63 68 61 6e 67 65 73 most one changes
31e0: 65 74 7d 20 5c 0a 09 20 20 20 20 7b 69 73 20 75 et} \.. {is u
31f0: 73 65 64 20 62 79 20 6d 75 6c 74 69 70 6c 65 20 sed by multiple
3200: 63 68 61 6e 67 65 73 65 74 73 7d 20 7b 0a 09 09 changesets} {...
3210: 2d 2d 20 50 72 69 6e 63 69 70 6c 65 20 6f 66 20 -- Principle of
3220: 6f 70 65 72 61 74 69 6f 6e 3a 20 47 65 74 20 61 operation: Get a
3230: 6c 6c 20 72 65 76 69 73 69 6f 6e 2f 63 68 61 6e ll revision/chan
3240: 67 65 73 65 74 0a 20 20 20 20 20 20 20 20 20 20 geset.
3250: 20 20 20 20 20 20 2d 2d 20 70 61 69 72 73 20 66 -- pairs f
3260: 6f 72 20 61 6c 6c 20 72 65 76 69 73 69 6f 6e 20 or all revision
3270: 63 68 61 6e 67 65 73 65 74 73 2c 20 67 72 6f 75 changesets, grou
3280: 70 20 62 79 0a 20 20 20 20 20 20 20 20 20 20 20 p by.
3290: 20 20 20 20 20 2d 2d 20 72 65 76 69 73 69 6f 6e -- revision
32a0: 20 74 6f 20 61 67 67 72 65 67 61 74 65 20 74 68 to aggregate th
32b0: 65 20 63 68 61 6e 67 65 73 65 74 2c 20 63 6f 75 e changeset, cou
32c0: 6e 74 69 6e 67 0a 20 20 20 20 20 20 20 20 20 20 nting.
32d0: 20 20 20 20 20 20 2d 2d 20 74 68 65 6d 2e 20 46 -- them. F
32e0: 72 6f 6d 20 74 68 65 20 72 65 73 75 6c 74 69 6e rom the resultin
32f0: 67 20 72 65 76 69 73 69 6f 6e 2f 63 6f 75 6e 74 g revision/count
3300: 20 74 61 62 6c 65 0a 20 20 20 20 20 20 20 20 20 table.
3310: 20 20 20 20 20 20 20 2d 2d 20 73 65 6c 65 63 74 -- select
3320: 20 74 68 6f 73 65 20 77 69 74 68 20 6d 6f 72 65 those with more
3330: 20 74 68 61 6e 20 6f 6e 65 20 75 73 65 72 2c 20 than one user,
3340: 61 6e 64 20 67 65 74 20 74 68 65 69 72 0a 20 20 and get their.
3350: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2d 2d --
3360: 20 61 73 73 6f 63 69 61 74 65 64 20 66 69 6c 65 associated file
3370: 20 28 6e 61 6d 65 29 20 66 6f 72 20 64 69 73 70 (name) for disp
3380: 6c 61 79 2e 0a 0a 09 09 53 45 4c 45 43 54 20 46 lay.....SELECT F
3390: 2e 6e 61 6d 65 2c 20 52 2e 72 65 76 0a 09 09 46 .name, R.rev...F
33a0: 52 4f 4d 20 72 65 76 69 73 69 6f 6e 20 52 2c 20 ROM revision R,
33b0: 66 69 6c 65 20 46 2c 0a 09 09 20 20 20 20 20 28 file F,... (
33c0: 53 45 4c 45 43 54 20 43 49 2e 69 69 64 20 20 20 SELECT CI.iid
33d0: 20 20 20 20 20 41 53 20 72 69 64 2c 20 20 2d 2d AS rid, --
33e0: 20 72 65 76 69 73 69 6f 6e 20 69 74 65 6d 0a 09 revision item..
33f0: 09 20 20 20 20 20 20 20 20 20 20 20 20 20 63 6f . co
3400: 75 6e 74 28 43 49 2e 63 69 64 29 20 41 53 20 63 unt(CI.cid) AS c
3410: 6f 75 6e 74 20 2d 2d 20 6e 75 6d 62 65 72 20 6f ount -- number o
3420: 66 20 63 73 65 74 73 20 75 73 69 6e 67 20 69 74 f csets using it
3430: 65 6d 0a 09 09 20 20 20 20 20 20 46 52 4f 4d 20 em... FROM
3440: 63 73 69 74 65 6d 20 43 49 2c 20 63 68 61 6e 67 csitem CI, chang
3450: 65 73 65 74 20 43 0a 09 09 20 20 20 20 20 20 57 eset C... W
3460: 48 45 52 45 20 43 2e 74 79 70 65 20 3d 20 30 20 HERE C.type = 0
3470: 20 20 20 20 20 20 20 20 20 20 20 2d 2d 20 6c 69 -- li
3480: 6d 69 74 20 74 6f 20 72 65 76 69 73 69 6f 6e 20 mit to revision
3490: 63 73 65 74 73 0a 09 09 20 20 20 20 20 20 41 4e csets... AN
34a0: 44 20 20 20 43 2e 63 69 64 20 20 3d 20 43 49 2e D C.cid = CI.
34b0: 63 69 64 20 20 20 20 20 20 20 2d 2d 20 67 65 74 cid -- get
34c0: 20 69 74 65 6d 20 69 6e 20 63 68 61 6e 67 65 73 item in changes
34d0: 65 74 0a 09 09 20 20 20 20 20 20 47 52 4f 55 50 et... GROUP
34e0: 20 42 59 20 43 49 2e 69 69 64 20 20 20 20 20 20 BY CI.iid
34f0: 20 20 20 20 20 20 20 2d 2d 20 61 67 67 72 65 67 -- aggreg
3500: 61 74 65 20 62 79 20 69 74 65 6d 2c 20 63 6f 75 ate by item, cou
3510: 6e 74 20 63 73 65 74 73 2f 69 74 65 6d 0a 09 09 nt csets/item...
3520: 20 20 20 20 20 29 20 41 53 20 55 0a 09 09 57 48 ) AS U...WH
3530: 45 52 45 20 55 2e 63 6f 75 6e 74 20 3e 20 31 20 ERE U.count > 1
3540: 20 20 20 2d 2d 20 6c 69 6d 69 74 20 74 6f 20 69 -- limit to i
3550: 74 65 6d 20 77 69 74 68 20 6d 75 6c 74 69 70 6c tem with multipl
3560: 65 20 75 73 65 72 73 0a 09 09 41 4e 44 20 20 20 e users...AND
3570: 52 2e 72 69 64 20 3d 20 55 2e 72 69 64 20 20 2d R.rid = U.rid -
3580: 2d 20 67 65 74 20 72 65 76 69 73 69 6f 6e 20 6f - get revision o
3590: 66 20 69 74 65 6d 0a 09 09 41 4e 44 20 20 20 52 f item...AND R
35a0: 2e 66 69 64 20 3d 20 46 2e 66 69 64 20 20 2d 2d .fid = F.fid --
35b0: 20 67 65 74 20 66 69 6c 65 20 6f 66 20 72 65 76 get file of rev
35c0: 69 73 69 6f 6e 0a 09 20 20 20 20 7d 0a 09 23 20 ision.. }..#
35d0: 41 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 68 61 All revisions ha
35e0: 76 65 20 74 6f 20 72 65 66 65 72 20 74 6f 20 74 ve to refer to t
35f0: 68 65 20 73 61 6d 65 20 6d 65 74 61 20 69 6e 66 he same meta inf
3600: 6f 72 6d 61 74 69 6f 6e 20 61 73 0a 09 23 20 74 ormation as..# t
3610: 68 65 69 72 20 63 68 61 6e 67 65 73 65 74 2e 0a heir changeset..
3620: 09 43 68 65 63 6b 52 65 76 43 53 20 5c 0a 09 20 .CheckRevCS \..
3630: 20 20 20 7b 41 6c 6c 20 72 65 76 69 73 69 6f 6e {All revision
3640: 73 20 68 61 76 65 20 74 6f 20 61 67 72 65 65 20 s have to agree
3650: 77 69 74 68 20 74 68 65 69 72 20 63 68 61 6e 67 with their chang
3660: 65 73 65 74 20 61 62 6f 75 74 20 74 68 65 20 75 eset about the u
3670: 73 65 64 20 6d 65 74 61 20 69 6e 66 6f 72 6d 61 sed meta informa
3680: 74 69 6f 6e 7d 20 5c 0a 09 20 20 20 20 7b 64 69 tion} \.. {di
3690: 73 61 67 72 65 65 73 20 77 69 74 68 20 69 74 73 sagrees with its
36a0: 20 63 68 61 6e 67 65 73 65 74 20 40 20 61 62 6f changeset @ abo
36b0: 75 74 20 74 68 65 20 6d 65 74 61 20 69 6e 66 6f ut the meta info
36c0: 72 6d 61 74 69 6f 6e 7d 20 7b 0a 09 09 53 45 4c rmation} {...SEL
36d0: 45 43 54 20 43 54 2e 6e 61 6d 65 2c 20 43 2e 63 ECT CT.name, C.c
36e0: 69 64 2c 20 46 2e 6e 61 6d 65 2c 20 52 2e 72 65 id, F.name, R.re
36f0: 76 0a 09 09 46 52 4f 4d 20 63 68 61 6e 67 65 73 v...FROM changes
3700: 65 74 20 43 2c 20 63 73 74 79 70 65 20 43 54 2c et C, cstype CT,
3710: 20 72 65 76 69 73 69 6f 6e 20 52 2c 20 66 69 6c revision R, fil
3720: 65 20 46 2c 20 63 73 69 74 65 6d 20 43 49 0a 09 e F, csitem CI..
3730: 09 57 48 45 52 45 20 43 2e 74 79 70 65 20 3d 20 .WHERE C.type =
3740: 30 20 20 20 20 20 20 20 2d 2d 20 72 65 76 69 73 0 -- revis
3750: 69 6f 6e 20 63 68 61 6e 67 65 73 65 74 73 20 6f ion changesets o
3760: 6e 6c 79 0a 09 09 41 4e 44 20 20 20 43 2e 63 69 nly...AND C.ci
3770: 64 20 20 3d 20 43 49 2e 63 69 64 20 20 2d 2d 20 d = CI.cid --
3780: 63 68 61 6e 67 65 73 65 74 20 2d 2d 3e 20 69 74 changeset --> it
3790: 73 20 72 65 76 69 73 69 6f 6e 73 0a 09 09 41 4e s revisions...AN
37a0: 44 20 20 20 52 2e 72 69 64 20 20 3d 20 43 49 2e D R.rid = CI.
37b0: 69 69 64 20 20 2d 2d 20 6c 6f 6f 6b 20 61 74 20 iid -- look at
37c0: 74 68 65 6d 0a 09 09 41 4e 44 20 20 20 52 2e 6d them...AND R.m
37d0: 69 64 20 21 3d 20 43 2e 73 72 63 20 20 20 2d 2d id != C.src --
37e0: 20 4f 6e 6c 79 20 74 68 6f 73 65 20 77 68 69 63 Only those whic
37f0: 68 20 64 69 73 61 67 72 65 65 20 77 69 74 68 20 h disagree with
3800: 63 68 61 6e 67 65 73 65 74 20 61 62 6f 75 74 20 changeset about
3810: 74 68 65 20 6d 65 74 61 0a 09 09 41 4e 44 20 20 the meta...AND
3820: 20 52 2e 66 69 64 20 3d 20 46 2e 66 69 64 20 20 R.fid = F.fid
3830: 20 20 2d 2d 20 67 65 74 20 66 69 6c 65 20 6f 66 -- get file of
3840: 20 74 68 65 20 72 65 76 69 73 69 6f 6e 0a 09 09 the revision...
3850: 41 4e 44 20 20 20 43 54 2e 74 69 64 20 3d 20 43 AND CT.tid = C
3860: 2e 74 79 70 65 20 20 2d 2d 20 67 65 74 20 63 68 .type -- get ch
3870: 61 6e 67 65 73 65 74 20 74 79 70 65 2c 20 66 6f angeset type, fo
3880: 72 20 6c 61 62 65 6c 69 6e 67 0a 09 20 20 20 20 r labeling..
3890: 7d 0a 09 23 20 41 6c 6c 20 72 65 76 69 73 69 6f }..# All revisio
38a0: 6e 73 20 68 61 76 65 20 74 6f 20 61 67 72 65 65 ns have to agree
38b0: 20 6f 6e 20 74 68 65 20 4c 4f 44 20 74 68 65 69 on the LOD thei
38c0: 72 20 63 68 61 6e 67 65 73 65 74 0a 09 23 20 62 r changeset..# b
38d0: 65 6c 6f 6e 67 73 20 74 6f 2e 20 49 6e 20 6f 74 elongs to. In ot
38e0: 68 65 72 20 77 6f 72 64 73 2c 20 61 6c 6c 20 72 her words, all r
38f0: 65 76 69 73 69 6f 6e 73 20 69 6e 20 61 20 63 68 evisions in a ch
3900: 61 6e 67 65 73 65 74 0a 09 23 20 68 61 76 65 20 angeset..# have
3910: 74 6f 20 72 65 66 65 72 20 74 6f 20 74 68 65 20 to refer to the
3920: 73 61 6d 65 20 6c 69 6e 65 20 6f 66 20 64 65 76 same line of dev
3930: 65 6c 6f 70 6d 65 6e 74 2e 0a 09 23 0a 09 23 20 elopment...#..#
3940: 49 6e 73 74 65 61 64 20 6f 66 20 6c 6f 6f 6b 69 Instead of looki
3950: 6e 67 20 61 74 20 61 6c 6c 20 70 61 69 72 73 20 ng at all pairs
3960: 6f 66 20 72 65 76 69 73 69 6f 6e 73 20 69 6e 20 of revisions in
3970: 61 6c 6c 0a 09 23 20 63 68 61 6e 67 65 73 65 74 all..# changeset
3980: 73 20 77 65 20 67 65 6e 65 72 61 74 65 20 74 68 s we generate th
3990: 65 20 64 69 73 74 69 6e 63 74 20 73 65 74 20 6f e distinct set o
39a0: 66 20 61 6c 6c 20 4c 4f 44 73 0a 09 23 20 72 65 f all LODs..# re
39b0: 66 65 72 65 6e 63 65 64 20 62 79 20 74 68 65 20 ferenced by the
39c0: 72 65 76 69 73 69 6f 6e 73 20 6f 66 20 61 20 63 revisions of a c
39d0: 68 61 6e 67 65 73 65 74 2c 20 6c 6f 6f 6b 20 66 hangeset, look f
39e0: 6f 72 20 74 68 6f 73 65 0a 09 23 20 77 69 74 68 or those..# with
39f0: 20 63 61 72 64 69 6e 61 6c 69 74 79 20 3e 20 31 cardinality > 1
3a00: 2c 20 61 6e 64 20 67 65 74 20 74 68 65 20 69 64 , and get the id
3a10: 65 6e 74 69 66 79 69 6e 67 20 69 6e 66 6f 72 6d entifying inform
3a20: 61 74 69 6f 6e 0a 09 23 20 66 6f 72 20 74 68 65 ation..# for the
3a30: 20 63 68 61 6e 67 65 73 65 74 73 20 66 6f 75 6e changesets foun
3a40: 64 20 74 68 75 73 6c 79 2e 0a 09 43 68 65 63 6b d thusly...Check
3a50: 43 53 20 5c 0a 09 20 20 20 20 7b 41 6c 6c 20 72 CS \.. {All r
3a60: 65 76 69 73 69 6f 6e 73 20 69 6e 20 61 20 63 68 evisions in a ch
3a70: 61 6e 67 65 73 65 74 20 68 61 76 65 20 74 6f 20 angeset have to
3a80: 62 65 6c 6f 6e 67 20 74 6f 20 74 68 65 20 73 61 belong to the sa
3a90: 6d 65 20 4c 4f 44 7d 20 5c 0a 09 20 20 20 20 7b me LOD} \.. {
3aa0: 3a 20 49 74 73 20 72 65 76 69 73 69 6f 6e 73 20 : Its revisions
3ab0: 64 69 73 61 67 72 65 65 20 61 62 6f 75 74 20 74 disagree about t
3ac0: 68 65 20 4c 4f 44 20 74 68 65 79 20 62 65 6c 6f he LOD they belo
3ad0: 6e 67 20 74 6f 7d 20 7b 0a 09 09 53 45 4c 45 43 ng to} {...SELEC
3ae0: 54 20 54 2e 6e 61 6d 65 2c 20 43 2e 63 69 64 0a T T.name, C.cid.
3af0: 09 09 46 52 4f 4d 20 20 20 63 68 61 6e 67 65 73 ..FROM changes
3b00: 65 74 20 43 2c 20 63 73 74 79 70 65 20 54 0a 09 et C, cstype T..
3b10: 09 57 48 45 52 45 20 20 43 2e 63 69 64 20 49 4e .WHERE C.cid IN
3b20: 20 28 53 45 4c 45 43 54 20 55 2e 63 69 64 0a 09 (SELECT U.cid..
3b30: 09 09 09 20 46 52 4f 4d 20 28 53 45 4c 45 43 54 ... FROM (SELECT
3b40: 20 44 49 53 54 49 4e 43 54 20 20 20 20 20 20 20 DISTINCT
3b50: 2d 2d 20 75 6e 69 71 75 65 20 63 73 65 74 2f 6c -- unique cset/l
3b60: 6f 64 20 70 61 69 72 73 0a 09 09 09 09 20 20 20 od pairs.....
3b70: 20 20 20 20 20 20 20 20 20 20 20 43 49 2e 63 69 CI.ci
3b80: 64 20 41 53 20 63 69 64 2c 20 2d 2d 20 72 65 76 d AS cid, -- rev
3b90: 69 73 69 6f 6e 20 63 73 65 74 0a 09 09 09 09 20 ision cset.....
3ba0: 20 20 20 20 20 20 20 20 20 20 20 20 20 52 2e 6c R.l
3bb0: 6f 64 20 20 41 53 20 6c 6f 64 20 20 2d 2d 20 6c od AS lod -- l
3bc0: 6f 64 20 6f 66 20 69 74 65 6d 20 69 6e 20 63 73 od of item in cs
3bd0: 65 74 0a 09 09 09 09 20 20 20 20 20 20 20 46 52 et..... FR
3be0: 4f 4d 20 20 20 63 73 69 74 65 6d 20 43 49 2c 20 OM csitem CI,
3bf0: 63 68 61 6e 67 65 73 65 74 20 43 2c 20 72 65 76 changeset C, rev
3c00: 69 73 69 6f 6e 20 52 0a 09 09 09 09 20 20 20 20 ision R.....
3c10: 20 20 20 57 48 45 52 45 20 20 43 49 2e 69 69 64 WHERE CI.iid
3c20: 20 3d 20 52 2e 72 69 64 20 20 2d 2d 20 67 65 74 = R.rid -- get
3c30: 20 72 65 76 20 6f 66 20 69 74 65 6d 20 69 6e 20 rev of item in
3c40: 63 73 65 74 0a 09 09 09 09 20 20 20 20 20 20 20 cset.....
3c50: 41 4e 44 20 20 20 20 43 2e 63 69 64 20 20 3d 20 AND C.cid =
3c60: 43 49 2e 63 69 64 20 2d 2d 20 67 65 74 20 63 68 CI.cid -- get ch
3c70: 61 6e 67 65 73 65 74 20 6f 66 20 69 74 65 6d 0a angeset of item.
3c80: 09 09 09 09 20 20 20 20 20 20 20 41 4e 44 20 20 .... AND
3c90: 20 20 43 2e 74 79 70 65 20 3d 20 30 20 20 20 20 C.type = 0
3ca0: 20 20 2d 2d 20 6c 69 6d 69 74 20 74 6f 20 72 65 -- limit to re
3cb0: 76 20 63 73 65 74 73 0a 09 09 09 09 20 20 20 20 v csets.....
3cc0: 20 20 29 20 41 53 20 55 0a 09 09 09 09 20 47 52 ) AS U..... GR
3cd0: 4f 55 50 20 42 59 20 55 2e 63 69 64 20 20 20 20 OUP BY U.cid
3ce0: 20 20 20 20 20 20 2d 2d 20 61 67 67 72 65 67 61 -- aggrega
3cf0: 74 65 20 62 79 20 63 73 65 74 2c 20 63 6f 75 6e te by cset, coun
3d00: 74 20 6c 6f 64 73 2f 63 73 65 74 0a 09 09 09 09 t lods/cset.....
3d10: 20 48 41 56 49 4e 47 20 43 4f 55 4e 54 28 55 2e HAVING COUNT(U.
3d20: 6c 6f 64 29 20 3e 20 31 20 2d 2d 20 66 69 6e 64 lod) > 1 -- find
3d30: 20 63 73 65 74 73 20 77 69 74 68 20 6d 75 6c 74 csets with mult
3d40: 69 70 6c 65 20 6c 6f 64 73 0a 09 09 09 09 29 0a iple lods.....).
3d50: 09 09 41 4e 44 20 20 20 20 54 2e 74 69 64 20 3d ..AND T.tid =
3d60: 20 43 2e 74 79 70 65 0a 09 20 20 20 20 7d 0a 09 C.type.. }..
3d70: 23 20 41 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 # All revisions
3d80: 68 61 76 65 20 74 6f 20 61 67 72 65 65 20 6f 6e have to agree on
3d90: 20 74 68 65 20 70 72 6f 6a 65 63 74 20 74 68 65 the project the
3da0: 69 72 20 63 68 61 6e 67 65 73 65 74 0a 09 23 20 ir changeset..#
3db0: 62 65 6c 6f 6e 67 73 20 74 6f 2e 20 49 6e 20 6f belongs to. In o
3dc0: 74 68 65 72 20 77 6f 72 64 73 2c 20 61 6c 6c 20 ther words, all
3dd0: 72 65 76 69 73 69 6f 6e 73 20 69 6e 20 61 20 63 revisions in a c
3de0: 68 61 6e 67 65 73 65 74 0a 09 23 20 68 61 76 65 hangeset..# have
3df0: 20 74 6f 20 72 65 66 65 72 20 74 6f 20 74 68 65 to refer to the
3e00: 20 73 61 6d 65 20 70 72 6f 6a 65 63 74 2e 0a 09 same project...
3e10: 23 0a 09 23 20 49 6e 73 74 65 61 64 20 6f 66 20 #..# Instead of
3e20: 6c 6f 6f 6b 69 6e 67 20 61 74 20 61 6c 6c 20 70 looking at all p
3e30: 61 69 72 73 20 6f 66 20 72 65 76 69 73 69 6f 6e airs of revision
3e40: 73 20 69 6e 20 61 6c 6c 0a 09 23 20 63 68 61 6e s in all..# chan
3e50: 67 65 73 65 74 73 20 77 65 20 67 65 6e 65 72 61 gesets we genera
3e60: 74 65 20 74 68 65 20 64 69 73 74 69 6e 63 74 20 te the distinct
3e70: 73 65 74 20 6f 66 20 61 6c 6c 20 70 72 6f 6a 65 set of all proje
3e80: 63 74 73 0a 09 23 20 72 65 66 65 72 65 6e 63 65 cts..# reference
3e90: 64 20 62 79 20 74 68 65 20 72 65 76 69 73 69 6f d by the revisio
3ea0: 6e 73 20 6f 66 20 61 20 63 68 61 6e 67 65 73 65 ns of a changese
3eb0: 74 2c 20 6c 6f 6f 6b 20 66 6f 72 20 74 68 6f 73 t, look for thos
3ec0: 65 0a 09 23 20 77 69 74 68 20 63 61 72 64 69 6e e..# with cardin
3ed0: 61 6c 69 74 79 20 3e 20 31 2c 20 61 6e 64 20 67 ality > 1, and g
3ee0: 65 74 20 74 68 65 20 69 64 65 6e 74 69 66 79 69 et the identifyi
3ef0: 6e 67 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 0a 09 ng information..
3f00: 23 20 66 6f 72 20 74 68 65 20 63 68 61 6e 67 65 # for the change
3f10: 73 65 74 73 20 66 6f 75 6e 64 20 74 68 75 73 6c sets found thusl
3f20: 79 2e 0a 09 43 68 65 63 6b 43 53 20 5c 0a 09 20 y...CheckCS \..
3f30: 20 20 20 7b 41 6c 6c 20 72 65 76 69 73 69 6f 6e {All revision
3f40: 73 20 69 6e 20 61 20 63 68 61 6e 67 65 73 65 74 s in a changeset
3f50: 20 68 61 76 65 20 74 6f 20 62 65 6c 6f 6e 67 20 have to belong
3f60: 74 6f 20 74 68 65 20 73 61 6d 65 20 70 72 6f 6a to the same proj
3f70: 65 63 74 7d 20 5c 0a 09 20 20 20 20 7b 3a 20 49 ect} \.. {: I
3f80: 74 73 20 72 65 76 69 73 69 6f 6e 73 20 64 69 73 ts revisions dis
3f90: 61 67 72 65 65 20 61 62 6f 75 74 20 74 68 65 20 agree about the
3fa0: 70 72 6f 6a 65 63 74 20 74 68 65 79 20 62 65 6c project they bel
3fb0: 6f 6e 67 20 74 6f 7d 20 7b 0a 09 09 53 45 4c 45 ong to} {...SELE
3fc0: 43 54 20 54 2e 6e 61 6d 65 2c 20 43 2e 63 69 64 CT T.name, C.cid
3fd0: 0a 09 09 46 52 4f 4d 20 20 20 63 68 61 6e 67 65 ...FROM change
3fe0: 73 65 74 20 43 2c 20 63 73 74 79 70 65 20 54 0a set C, cstype T.
3ff0: 09 09 57 48 45 52 45 20 20 43 2e 63 69 64 20 49 ..WHERE C.cid I
4000: 4e 20 28 53 45 4c 45 43 54 20 55 2e 63 69 64 0a N (SELECT U.cid.
4010: 09 09 09 09 20 46 52 4f 4d 20 28 53 45 4c 45 43 .... FROM (SELEC
4020: 54 20 44 49 53 54 49 4e 43 54 20 20 20 20 20 20 T DISTINCT
4030: 20 2d 2d 20 75 6e 69 71 75 65 20 63 73 65 74 2f -- unique cset/
4040: 70 72 6f 6a 20 70 61 69 72 73 0a 09 09 09 09 20 proj pairs.....
4050: 20 20 20 20 20 20 20 20 20 20 20 20 20 43 49 2e CI.
4060: 63 69 64 20 41 53 20 63 69 64 2c 20 2d 2d 20 72 cid AS cid, -- r
4070: 65 76 20 63 73 65 74 0a 09 09 09 09 20 20 20 20 ev cset.....
4080: 20 20 20 20 20 20 20 20 20 20 46 2e 70 69 64 20 F.pid
4090: 20 41 53 20 70 69 64 20 20 2d 2d 20 70 72 6f 6a AS pid -- proj
40a0: 65 63 74 20 6f 66 20 69 74 65 6d 20 69 6e 20 63 ect of item in c
40b0: 73 65 74 0a 09 09 09 09 20 20 20 20 20 20 20 46 set..... F
40c0: 52 4f 4d 20 20 20 63 73 69 74 65 6d 20 43 49 2c ROM csitem CI,
40d0: 20 63 68 61 6e 67 65 73 65 74 20 43 2c 20 72 65 changeset C, re
40e0: 76 69 73 69 6f 6e 20 52 2c 20 66 69 6c 65 20 46 vision R, file F
40f0: 0a 09 09 09 09 20 20 20 20 20 20 20 57 48 45 52 ..... WHER
4100: 45 20 20 43 49 2e 69 69 64 20 3d 20 52 2e 72 69 E CI.iid = R.ri
4110: 64 20 20 2d 2d 20 67 65 74 20 72 65 76 20 6f 66 d -- get rev of
4120: 20 69 74 65 6d 20 69 6e 20 63 73 65 74 0a 09 09 item in cset...
4130: 09 09 20 20 20 20 20 20 20 41 4e 44 20 20 20 20 .. AND
4140: 43 2e 63 69 64 20 20 3d 20 43 49 2e 63 69 64 20 C.cid = CI.cid
4150: 2d 2d 20 67 65 74 20 63 68 61 6e 67 65 73 65 74 -- get changeset
4160: 20 6f 66 20 69 74 65 6d 0a 09 09 09 09 20 20 20 of item.....
4170: 20 20 20 20 41 4e 44 20 20 20 20 43 2e 74 79 70 AND C.typ
4180: 65 20 3d 20 30 20 20 20 20 20 20 2d 2d 20 6c 69 e = 0 -- li
4190: 6d 69 74 20 74 6f 20 72 65 76 20 63 68 61 6e 67 mit to rev chang
41a0: 65 73 65 74 73 0a 09 09 09 09 20 20 20 20 20 20 esets.....
41b0: 20 41 4e 44 20 20 20 20 46 2e 66 69 64 20 20 3d AND F.fid =
41c0: 20 52 2e 66 69 64 20 20 2d 2d 20 67 65 74 20 66 R.fid -- get f
41d0: 69 6c 65 20 6f 66 20 72 65 76 69 73 69 6f 6e 0a ile of revision.
41e0: 09 09 09 09 20 20 20 20 20 20 29 20 41 53 20 55 .... ) AS U
41f0: 0a 09 09 09 09 20 47 52 4f 55 50 20 42 59 20 55 ..... GROUP BY U
4200: 2e 63 69 64 20 20 20 20 20 20 20 20 20 20 2d 2d .cid --
4210: 20 61 67 67 72 65 67 61 74 65 20 62 79 20 63 73 aggregate by cs
4220: 65 74 73 2c 20 63 6f 75 6e 74 20 70 72 6f 6a 2f ets, count proj/
4230: 63 73 65 74 0a 09 09 09 09 20 48 41 56 49 4e 47 cset..... HAVING
4240: 20 43 4f 55 4e 54 28 55 2e 70 69 64 29 20 3e 20 COUNT(U.pid) >
4250: 31 20 2d 2d 20 66 69 6e 64 20 63 73 65 74 73 20 1 -- find csets
4260: 77 69 74 68 20 6d 75 6c 74 69 70 6c 65 20 70 72 with multiple pr
4270: 6f 6a 65 63 74 73 0a 09 09 09 09 29 0a 09 09 41 ojects.....)...A
4280: 4e 44 20 20 20 20 54 2e 74 69 64 20 3d 20 43 2e ND T.tid = C.
4290: 74 79 70 65 20 2d 2d 20 67 65 74 20 72 65 61 64 type -- get read
42a0: 61 62 6c 65 20 63 68 61 6e 67 65 73 65 74 20 74 able changeset t
42b0: 79 70 65 0a 09 20 20 20 20 7d 0a 09 23 20 41 6c ype.. }..# Al
42c0: 6c 20 72 65 76 69 73 69 6f 6e 73 20 69 6e 20 61 l revisions in a
42d0: 20 73 69 6e 67 6c 65 20 63 68 61 6e 67 65 73 65 single changese
42e0: 74 20 68 61 76 65 20 74 6f 20 62 65 6c 6f 6e 67 t have to belong
42f0: 20 74 6f 0a 09 23 20 64 69 66 66 65 72 65 6e 74 to..# different
4300: 20 66 69 6c 65 73 2e 20 43 6f 6e 76 65 72 73 65 files. Converse
4310: 6c 79 3a 20 4e 6f 20 74 77 6f 20 72 65 76 69 73 ly: No two revis
4320: 69 6f 6e 73 20 6f 66 20 61 20 73 69 6e 67 6c 65 ions of a single
4330: 0a 09 23 20 66 69 6c 65 20 61 72 65 20 61 6c 6c ..# file are all
4340: 6f 77 65 64 20 74 6f 20 62 65 20 69 6e 20 74 68 owed to be in th
4350: 65 20 73 61 6d 65 20 63 68 61 6e 67 65 73 65 74 e same changeset
4360: 2e 0a 09 23 0a 09 23 20 49 6e 73 74 65 61 64 20 ...#..# Instead
4370: 6f 66 20 6c 6f 6f 6b 69 6e 67 20 61 74 20 61 6c of looking at al
4380: 6c 20 70 61 69 72 73 20 6f 66 20 72 65 76 69 73 l pairs of revis
4390: 69 6f 6e 73 20 69 6e 20 61 6c 6c 0a 09 23 20 63 ions in all..# c
43a0: 68 61 6e 67 65 73 65 74 73 20 77 65 20 67 65 6e hangesets we gen
43b0: 65 72 61 74 65 20 74 68 65 20 64 69 73 74 69 6e erate the distin
43c0: 63 74 20 73 65 74 20 6f 66 20 61 6c 6c 20 66 69 ct set of all fi
43d0: 6c 65 73 0a 09 23 20 72 65 66 65 72 65 6e 63 65 les..# reference
43e0: 64 20 62 79 20 74 68 65 20 72 65 76 69 73 69 6f d by the revisio
43f0: 6e 73 20 6f 66 20 61 20 63 68 61 6e 67 65 73 65 ns of a changese
4400: 74 2c 20 61 6e 64 20 6c 6f 6f 6b 20 66 6f 72 0a t, and look for.
4410: 09 23 20 74 68 6f 73 65 20 77 69 74 68 20 63 61 .# those with ca
4420: 72 64 69 6e 61 6c 69 74 79 20 3c 20 74 68 65 20 rdinality < the
4430: 63 61 72 64 69 6e 61 6c 69 74 79 20 6f 66 20 74 cardinality of t
4440: 68 65 20 73 65 74 20 6f 66 0a 09 23 20 72 65 76 he set of..# rev
4450: 69 73 69 6f 6e 73 2c 20 61 6e 64 20 67 65 74 20 isions, and get
4460: 74 68 65 20 69 64 65 6e 74 69 66 79 69 6e 67 20 the identifying
4470: 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 66 6f 72 20 information for
4480: 74 68 65 0a 09 23 20 63 68 61 6e 67 65 73 65 74 the..# changeset
4490: 73 20 66 6f 75 6e 64 20 74 68 75 73 6c 79 2e 0a s found thusly..
44a0: 09 43 68 65 63 6b 43 53 20 5c 0a 09 20 20 20 20 .CheckCS \..
44b0: 7b 41 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 69 {All revisions i
44c0: 6e 20 61 20 63 68 61 6e 67 65 73 65 74 20 68 61 n a changeset ha
44d0: 76 65 20 74 6f 20 62 65 6c 6f 6e 67 20 74 6f 20 ve to belong to
44e0: 64 69 66 66 65 72 65 6e 74 20 66 69 6c 65 73 7d different files}
44f0: 20 5c 0a 09 20 20 20 20 7b 3a 20 49 74 73 20 72 \.. {: Its r
4500: 65 76 69 73 69 6f 6e 73 20 73 68 61 72 65 20 66 evisions share f
4510: 69 6c 65 73 7d 20 7b 0a 09 09 53 45 4c 45 43 54 iles} {...SELECT
4520: 20 54 2e 6e 61 6d 65 2c 20 43 2e 63 69 64 0a 09 T.name, C.cid..
4530: 09 46 52 4f 4d 20 20 20 63 68 61 6e 67 65 73 65 .FROM changese
4540: 74 20 43 2c 20 63 73 74 79 70 65 20 54 0a 09 09 t C, cstype T...
4550: 57 48 45 52 45 20 20 43 2e 63 69 64 20 49 4e 20 WHERE C.cid IN
4560: 28 53 45 4c 45 43 54 20 56 56 2e 63 69 64 0a 09 (SELECT VV.cid..
4570: 09 09 09 20 46 52 4f 4d 20 28 53 45 4c 45 43 54 ... FROM (SELECT
4580: 20 55 2e 63 69 64 20 20 20 20 20 20 20 20 20 41 U.cid A
4590: 53 20 63 69 64 2c 20 20 20 2d 2d 20 72 65 76 20 S cid, -- rev
45a0: 63 68 61 6e 67 65 73 65 74 0a 09 09 09 09 20 20 changeset.....
45b0: 20 20 20 20 20 20 20 20 20 20 20 20 43 4f 55 4e COUN
45c0: 54 20 28 55 2e 66 69 64 29 20 41 53 20 66 63 6f T (U.fid) AS fco
45d0: 75 6e 74 20 2d 2d 20 6e 75 6d 62 65 72 20 6f 66 unt -- number of
45e0: 20 66 69 6c 65 73 20 62 79 20 69 74 65 6d 73 0a files by items.
45f0: 09 09 09 09 20 20 20 20 20 20 20 46 52 4f 4d 20 .... FROM
4600: 28 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 (SELECT DISTINCT
4610: 20 20 20 20 20 20 20 2d 2d 20 75 6e 69 71 75 65 -- unique
4620: 20 63 73 65 74 2f 66 69 6c 65 20 70 61 69 72 73 cset/file pairs
4630: 0a 09 09 09 09 09 20 20 20 20 20 20 20 20 20 20 ......
4640: 20 20 43 49 2e 63 69 64 20 41 53 20 63 69 64 2c CI.cid AS cid,
4650: 20 2d 2d 20 72 65 76 20 63 68 61 6e 67 65 73 65 -- rev changese
4660: 74 0a 09 09 09 09 09 20 20 20 20 20 20 20 20 20 t......
4670: 20 20 20 52 2e 66 69 64 20 41 53 20 66 69 64 20 R.fid AS fid
4680: 20 20 2d 2d 20 66 69 6c 65 20 6f 66 20 69 74 65 -- file of ite
4690: 6d 20 69 6e 20 63 68 61 6e 67 65 73 65 74 0a 09 m in changeset..
46a0: 09 09 09 09 20 20 20 20 20 46 52 4f 4d 20 20 20 .... FROM
46b0: 63 73 69 74 65 6d 20 43 49 2c 20 63 68 61 6e 67 csitem CI, chang
46c0: 65 73 65 74 20 43 2c 20 72 65 76 69 73 69 6f 6e eset C, revision
46d0: 20 52 0a 09 09 09 09 09 20 20 20 20 20 57 48 45 R...... WHE
46e0: 52 45 20 20 43 49 2e 69 69 64 20 3d 20 52 2e 72 RE CI.iid = R.r
46f0: 69 64 20 20 2d 2d 20 67 65 74 20 72 65 76 20 6f id -- get rev o
4700: 66 20 69 74 65 6d 20 69 6e 20 63 68 61 6e 67 65 f item in change
4710: 73 65 74 0a 09 09 09 09 09 20 20 20 20 20 41 4e set...... AN
4720: 44 20 20 20 20 43 2e 63 69 64 20 20 3d 20 43 49 D C.cid = CI
4730: 2e 63 69 64 20 2d 2d 20 67 65 74 20 63 68 61 6e .cid -- get chan
4740: 67 65 73 65 74 20 6f 66 20 69 74 65 6d 0a 09 09 geset of item...
4750: 09 09 09 20 20 20 20 20 41 4e 44 20 20 20 20 43 ... AND C
4760: 2e 74 79 70 65 20 3d 20 30 20 20 20 20 20 20 2d .type = 0 -
4770: 2d 20 6c 69 6d 69 74 20 74 6f 20 72 65 76 20 63 - limit to rev c
4780: 73 65 74 73 0a 09 09 09 09 09 20 20 20 20 20 29 sets...... )
4790: 20 41 53 20 55 0a 09 09 09 09 20 20 20 20 20 20 AS U.....
47a0: 20 47 52 4f 55 50 20 42 59 20 55 2e 63 69 64 20 GROUP BY U.cid
47b0: 2d 2d 20 61 67 67 72 65 67 61 74 65 20 62 79 20 -- aggregate by
47c0: 63 73 65 74 73 2c 20 63 6f 75 6e 74 20 66 69 6c csets, count fil
47d0: 65 73 2f 63 73 65 74 0a 09 09 09 09 20 20 20 20 es/cset.....
47e0: 20 20 29 20 41 53 20 55 55 2c 0a 09 09 09 09 20 ) AS UU,.....
47f0: 20 20 20 20 20 28 53 45 4c 45 43 54 20 56 2e 63 (SELECT V.c
4800: 69 64 20 20 20 20 20 20 20 20 20 41 53 20 63 69 id AS ci
4810: 64 2c 20 20 20 2d 2d 20 72 65 76 20 63 68 61 6e d, -- rev chan
4820: 67 65 73 65 74 0a 09 09 09 09 20 20 20 20 20 20 geset.....
4830: 20 20 20 20 20 20 20 20 43 4f 55 4e 54 20 28 56 COUNT (V
4840: 2e 69 69 64 29 20 41 53 20 72 63 6f 75 6e 74 20 .iid) AS rcount
4850: 2d 2d 20 6e 75 6d 62 65 72 20 6f 66 20 69 74 65 -- number of ite
4860: 6d 73 0a 09 09 09 09 20 20 20 20 20 20 20 46 52 ms..... FR
4870: 4f 4d 20 20 20 63 73 69 74 65 6d 20 56 2c 20 63 OM csitem V, c
4880: 68 61 6e 67 65 73 65 74 20 58 0a 09 09 09 09 20 hangeset X.....
4890: 20 20 20 20 20 20 57 48 45 52 45 20 20 58 2e 63 WHERE X.c
48a0: 69 64 20 20 3d 20 56 2e 63 69 64 20 20 2d 2d 20 id = V.cid --
48b0: 67 65 74 20 63 68 61 6e 67 65 73 65 74 20 6f 66 get changeset of
48c0: 20 69 74 65 6d 0a 09 09 09 09 20 20 20 20 20 20 item.....
48d0: 20 41 4e 44 20 20 20 20 58 2e 74 79 70 65 20 3d AND X.type =
48e0: 20 30 20 20 20 20 20 20 2d 2d 20 6c 69 6d 69 74 0 -- limit
48f0: 20 74 6f 20 72 65 76 20 63 73 65 74 73 0a 09 09 to rev csets...
4900: 09 09 20 20 20 20 20 20 20 47 52 4f 55 50 20 42 .. GROUP B
4910: 59 20 56 2e 63 69 64 20 20 20 20 20 20 20 20 20 Y V.cid
4920: 2d 2d 20 61 67 67 72 65 67 61 74 65 20 62 79 20 -- aggregate by
4930: 63 73 65 74 73 2c 20 63 6f 75 6e 74 20 69 74 65 csets, count ite
4940: 6d 73 2f 63 73 65 74 0a 09 09 09 09 20 20 20 20 ms/cset.....
4950: 20 20 29 20 41 53 20 56 56 0a 09 09 09 09 20 57 ) AS VV..... W
4960: 48 45 52 45 20 56 56 2e 63 69 64 20 3d 20 55 55 HERE VV.cid = UU
4970: 2e 63 69 64 20 20 20 20 20 20 20 20 2d 2d 20 73 .cid -- s
4980: 79 6e 63 20 23 69 74 65 6d 73 2f 63 73 65 74 20 ync #items/cset
4990: 77 69 74 68 20 23 66 69 6c 65 73 2f 63 73 65 74 with #files/cset
49a0: 0a 09 09 09 09 20 41 4e 44 20 20 20 55 55 2e 66 ..... AND UU.f
49b0: 63 6f 75 6e 74 20 3c 20 56 56 2e 72 63 6f 75 6e count < VV.rcoun
49c0: 74 20 20 2d 2d 20 6c 65 73 73 20 66 69 6c 65 73 t -- less files
49d0: 20 74 68 61 6e 20 69 74 65 6d 73 0a 09 09 09 09 than items.....
49e0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
49f0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2d 2d --
4a00: 20 3d 3e 20 69 74 65 6d 73 20 62 65 6c 6f 6e 67 => items belong
4a10: 20 74 6f 20 74 68 65 20 73 61 6d 65 20 66 69 6c to the same fil
4a20: 65 2e 0a 09 09 09 09 29 0a 09 09 41 4e 44 20 20 e......)...AND
4a30: 20 20 54 2e 74 69 64 20 3d 20 43 2e 74 79 70 65 T.tid = C.type
4a40: 20 2d 2d 20 67 65 74 20 72 65 61 64 61 62 6c 65 -- get readable
4a50: 20 63 68 61 6e 67 65 73 65 74 20 74 79 70 65 0a changeset type.
4a60: 09 20 20 20 20 7d 0a 09 72 65 74 75 72 6e 0a 20 . }..return.
4a70: 20 20 20 7d 0a 0a 20 20 20 20 70 72 6f 63 20 54 }.. proc T
4a80: 61 67 43 68 61 6e 67 65 73 65 74 73 20 7b 7d 20 agChangesets {}
4a90: 7b 0a 09 23 20 54 68 69 73 20 63 6f 64 65 20 70 {..# This code p
4aa0: 65 72 66 6f 72 6d 73 20 61 20 6e 75 6d 62 65 72 erforms a number
4ab0: 20 6f 66 20 70 61 72 61 6e 6f 69 64 20 63 68 65 of paranoid che
4ac0: 63 6b 73 20 6f 66 20 74 68 65 0a 09 23 20 64 61 cks of the..# da
4ad0: 74 61 62 61 73 65 2c 20 73 65 61 72 63 68 69 6e tabase, searchin
4ae0: 67 20 66 6f 72 20 69 6e 63 6f 6e 73 69 73 74 65 g for inconsiste
4af0: 6e 74 20 63 68 61 6e 67 65 73 65 74 2f 72 65 76 nt changeset/rev
4b00: 69 73 69 6f 6e 0a 09 23 20 69 6e 66 6f 72 6d 61 ision..# informa
4b10: 74 69 6f 6e 2e 0a 0a 09 75 70 76 61 72 20 31 20 tion....upvar 1
4b20: 6e 20 6e 20 3b 20 23 20 43 6f 75 6e 74 65 72 20 n n ; # Counter
4b30: 66 6f 72 20 74 68 65 20 63 68 65 63 6b 73 20 28 for the checks (
4b40: 77 65 20 70 72 69 6e 74 20 61 6e 20 69 64 20 62 we print an id b
4b50: 65 66 6f 72 65 0a 09 09 20 20 20 20 20 20 23 20 efore... #
4b60: 74 68 65 20 6d 61 69 6e 20 6c 61 62 65 6c 29 2e the main label).
4b70: 0a 0a 09 23 20 46 69 6e 64 20 61 6c 6c 20 74 61 ...# Find all ta
4b80: 67 73 20 77 68 69 63 68 20 61 72 65 20 6e 6f 74 gs which are not
4b90: 20 75 73 65 64 20 62 79 20 61 74 20 6c 65 61 73 used by at leas
4ba0: 74 20 6f 6e 65 20 63 68 61 6e 67 65 73 65 74 2e t one changeset.
4bb0: 0a 09 43 68 65 63 6b 54 61 67 20 5c 0a 09 20 20 ..CheckTag \..
4bc0: 20 20 7b 41 6c 6c 20 74 61 67 73 20 68 61 76 65 {All tags have
4bd0: 20 74 6f 20 62 65 20 75 73 65 64 20 62 79 20 6c to be used by l
4be0: 65 61 73 74 20 6f 6e 65 20 63 68 61 6e 67 65 73 east one changes
4bf0: 65 74 7d 20 5c 0a 09 20 20 20 20 7b 69 73 20 6e et} \.. {is n
4c00: 6f 74 20 75 73 65 64 20 62 79 20 61 20 63 68 61 ot used by a cha
4c10: 6e 67 65 73 65 74 7d 20 7b 0a 09 09 2d 2d 20 55 ngeset} {...-- U
4c20: 6e 75 73 65 64 20 74 61 67 73 20 3d 20 41 6c 6c nused tags = All
4c30: 20 74 61 67 73 0a 09 09 2d 2d 20 20 20 20 20 20 tags...--
4c40: 20 20 20 20 20 20 20 2d 20 72 65 76 69 73 69 6f - revisio
4c50: 6e 73 20 75 73 65 64 20 62 79 20 74 61 67 20 63 ns used by tag c
4c60: 68 61 6e 67 65 73 65 74 73 2e 0a 09 09 2d 2d 0a hangesets....--.
4c70: 09 09 2d 2d 20 42 6f 74 68 20 73 65 74 73 20 63 ..-- Both sets c
4c80: 61 6e 20 62 65 20 63 6f 6d 70 75 74 65 64 20 65 an be computed e
4c90: 61 73 69 6c 79 2c 20 61 6e 64 20 73 75 62 74 72 asily, and subtr
4ca0: 61 63 74 65 64 0a 20 20 20 20 20 20 20 20 20 20 acted.
4cb0: 20 20 20 20 20 20 2d 2d 20 66 72 6f 6d 20 65 61 -- from ea
4cc0: 63 68 20 6f 74 68 65 72 2e 20 54 68 65 6e 20 77 ch other. Then w
4cd0: 65 20 63 61 6e 20 67 65 74 20 74 68 65 20 61 73 e can get the as
4ce0: 73 6f 63 69 61 74 65 64 0a 20 20 20 20 20 20 20 sociated.
4cf0: 20 20 20 20 20 20 20 20 20 2d 2d 20 66 69 6c 65 -- file
4d00: 20 28 6e 61 6d 65 29 20 66 6f 72 20 64 69 73 70 (name) for disp
4d10: 6c 61 79 2e 0a 0a 09 09 53 45 4c 45 43 54 20 50 lay.....SELECT P
4d20: 2e 6e 61 6d 65 2c 20 53 2e 6e 61 6d 65 0a 09 09 .name, S.name...
4d30: 46 52 4f 4d 20 70 72 6f 6a 65 63 74 20 50 2c 20 FROM project P,
4d40: 74 61 67 20 54 2c 20 73 79 6d 62 6f 6c 20 53 0a tag T, symbol S.
4d50: 09 09 57 48 45 52 45 20 54 2e 74 69 64 20 49 4e ..WHERE T.tid IN
4d60: 20 28 53 45 4c 45 43 54 20 74 69 64 20 20 20 20 (SELECT tid
4d70: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
4d80: 2d 2d 20 41 6c 6c 20 74 61 67 73 0a 09 09 09 09 -- All tags.....
4d90: 46 52 4f 4d 20 20 20 74 61 67 0a 09 09 09 09 45 FROM tag.....E
4da0: 58 43 45 50 54 20 20 20 20 20 20 20 20 20 20 20 XCEPT
4db0: 20 20 20 20 20 20 20 20 20 20 20 20 20 2d 2d 20 --
4dc0: 73 75 62 74 72 61 63 74 0a 09 09 09 09 53 45 4c subtract.....SEL
4dd0: 45 43 54 20 43 49 2e 69 69 64 20 20 20 20 20 20 ECT CI.iid
4de0: 20 20 20 20 20 20 20 20 20 20 20 2d 2d 20 74 61 -- ta
4df0: 67 73 20 75 73 65 64 0a 09 09 09 09 46 52 4f 4d gs used.....FROM
4e00: 20 20 20 63 73 69 74 65 6d 20 43 49 2c 20 63 68 csitem CI, ch
4e10: 61 6e 67 65 73 65 74 20 43 0a 09 09 09 09 57 48 angeset C.....WH
4e20: 45 52 45 20 20 43 2e 63 69 64 20 3d 20 43 49 2e ERE C.cid = CI.
4e30: 63 69 64 20 20 20 20 20 20 20 20 20 2d 2d 20 62 cid -- b
4e40: 79 20 61 6e 79 20 74 61 67 0a 09 09 09 09 41 4e y any tag.....AN
4e50: 44 20 20 20 20 43 2e 74 79 70 65 20 3d 20 31 29 D C.type = 1)
4e60: 20 20 20 20 20 20 20 20 20 20 20 20 2d 2d 20 63 -- c
4e70: 68 61 6e 67 65 73 65 74 0a 09 09 41 4e 44 20 20 hangeset...AND
4e80: 20 53 2e 73 69 64 20 3d 20 54 2e 73 69 64 20 20 S.sid = T.sid
4e90: 20 20 20 20 20 20 20 20 20 20 20 20 20 2d 2d 20 --
4ea0: 67 65 74 20 73 79 6d 62 6f 6c 20 6f 66 20 74 61 get symbol of ta
4eb0: 67 0a 09 09 41 4e 44 20 20 20 50 2e 70 69 64 20 g...AND P.pid
4ec0: 3d 20 53 2e 70 69 64 20 20 20 20 20 20 20 20 20 = S.pid
4ed0: 20 20 20 20 20 20 2d 2d 20 67 65 74 20 70 72 6f -- get pro
4ee0: 6a 65 63 74 20 6f 66 20 73 79 6d 62 6f 6c 0a 09 ject of symbol..
4ef0: 20 20 20 20 7d 0a 09 23 20 46 69 6e 64 20 61 6c }..# Find al
4f00: 6c 20 74 61 67 73 20 77 68 69 63 68 20 61 72 65 l tags which are
4f10: 20 75 73 65 64 20 62 79 20 6d 6f 72 65 20 74 68 used by more th
4f20: 61 6e 20 6f 6e 65 20 63 68 61 6e 67 65 73 65 74 an one changeset
4f30: 2e 0a 09 43 68 65 63 6b 52 65 76 20 5c 0a 09 20 ...CheckRev \..
4f40: 20 20 20 7b 41 6c 6c 20 74 61 67 73 20 68 61 76 {All tags hav
4f50: 65 20 74 6f 20 62 65 20 75 73 65 64 20 62 79 20 e to be used by
4f60: 61 74 20 6d 6f 73 74 20 6f 6e 65 20 63 68 61 6e at most one chan
4f70: 67 65 73 65 74 7d 20 5c 0a 09 20 20 20 20 7b 69 geset} \.. {i
4f80: 73 20 75 73 65 64 20 62 79 20 6d 75 6c 74 69 70 s used by multip
4f90: 6c 65 20 63 68 61 6e 67 65 73 65 74 73 7d 20 7b le changesets} {
4fa0: 0a 09 09 2d 2d 20 50 72 69 6e 63 69 70 6c 65 20 ...-- Principle
4fb0: 6f 66 20 6f 70 65 72 61 74 69 6f 6e 3a 20 47 65 of operation: Ge
4fc0: 74 20 61 6c 6c 20 74 61 67 2f 63 68 61 6e 67 65 t all tag/change
4fd0: 73 65 74 20 70 61 69 72 73 0a 20 20 20 20 20 20 set pairs.
4fe0: 20 20 20 20 20 20 20 20 20 20 2d 2d 20 66 6f 72 -- for
4ff0: 20 61 6c 6c 20 74 61 67 20 63 68 61 6e 67 65 73 all tag changes
5000: 65 74 73 2c 20 67 72 6f 75 70 20 62 79 20 74 61 ets, group by ta
5010: 67 20 74 6f 20 61 67 67 72 65 67 61 74 65 0a 20 g to aggregate.
5020: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2d -
5030: 2d 20 74 68 65 20 63 68 61 6e 67 65 73 65 74 2c - the changeset,
5040: 20 63 6f 75 6e 74 69 6e 67 20 74 68 65 6d 2e 20 counting them.
5050: 46 72 6f 6d 20 74 68 65 20 72 65 73 75 6c 74 69 From the resulti
5060: 6e 67 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 ng.
5070: 20 20 20 2d 2d 20 74 61 67 2f 63 6f 75 6e 74 20 -- tag/count
5080: 74 61 62 6c 65 20 73 65 6c 65 63 74 20 74 68 6f table select tho
5090: 73 65 20 77 69 74 68 20 6d 6f 72 65 20 74 68 61 se with more tha
50a0: 6e 20 6f 6e 65 0a 20 20 20 20 20 20 20 20 20 20 n one.
50b0: 20 20 20 20 20 20 2d 2d 20 75 73 65 72 2c 20 61 -- user, a
50c0: 6e 64 20 67 65 74 20 74 68 65 69 72 20 61 73 73 nd get their ass
50d0: 6f 63 69 61 74 65 64 20 66 69 6c 65 20 28 6e 61 ociated file (na
50e0: 6d 65 29 20 66 6f 72 0a 20 20 20 20 20 20 20 20 me) for.
50f0: 20 20 20 20 20 20 20 20 2d 2d 20 64 69 73 70 6c -- displ
5100: 61 79 2e 0a 0a 09 09 53 45 4c 45 43 54 20 50 2e ay.....SELECT P.
5110: 6e 61 6d 65 2c 20 53 2e 6e 61 6d 65 0a 09 09 46 name, S.name...F
5120: 52 4f 4d 20 74 61 67 20 54 2c 20 70 72 6f 6a 65 ROM tag T, proje
5130: 63 74 20 50 2c 20 73 79 6d 62 6f 6c 20 53 2c 0a ct P, symbol S,.
5140: 09 09 20 20 20 20 20 28 53 45 4c 45 43 54 20 43 .. (SELECT C
5150: 49 2e 69 69 64 20 20 20 20 20 20 20 20 41 53 20 I.iid AS
5160: 69 69 64 2c 20 20 2d 2d 20 69 74 65 6d 0a 09 09 iid, -- item...
5170: 20 20 20 20 20 20 20 20 20 20 20 20 20 63 6f 75 cou
5180: 6e 74 28 43 49 2e 63 69 64 29 20 41 53 20 63 6f nt(CI.cid) AS co
5190: 75 6e 74 20 2d 2d 20 6e 75 6d 62 65 72 20 6f 66 unt -- number of
51a0: 20 63 73 65 74 73 20 75 73 69 6e 67 20 69 74 65 csets using ite
51b0: 6d 0a 09 09 20 20 20 20 20 20 46 52 4f 4d 20 63 m... FROM c
51c0: 73 69 74 65 6d 20 43 49 2c 20 63 68 61 6e 67 65 sitem CI, change
51d0: 73 65 74 20 43 0a 09 09 20 20 20 20 20 20 57 48 set C... WH
51e0: 45 52 45 20 43 2e 74 79 70 65 20 3d 20 31 20 20 ERE C.type = 1
51f0: 20 20 20 20 20 2d 2d 20 6c 69 6d 69 74 20 74 6f -- limit to
5200: 20 74 61 67 20 63 73 65 74 73 0a 09 09 20 20 20 tag csets...
5210: 20 20 20 41 4e 44 20 20 20 43 2e 63 69 64 20 20 AND C.cid
5220: 3d 20 43 49 2e 63 69 64 20 20 2d 2d 20 67 65 74 = CI.cid -- get
5230: 20 69 74 65 6d 73 20 6f 66 20 63 73 65 74 0a 09 items of cset..
5240: 09 20 20 20 20 20 20 47 52 4f 55 50 20 42 59 20 . GROUP BY
5250: 43 49 2e 69 69 64 20 20 20 20 20 20 20 20 2d 2d CI.iid --
5260: 20 61 67 67 72 65 67 61 74 65 20 62 79 20 69 74 aggregate by it
5270: 65 6d 2c 20 63 6f 75 6e 74 20 63 73 65 74 73 2f em, count csets/
5280: 69 74 65 6d 0a 09 09 20 20 20 20 20 29 20 41 53 item... ) AS
5290: 20 55 0a 09 09 57 48 45 52 45 20 55 2e 63 6f 75 U...WHERE U.cou
52a0: 6e 74 20 3e 20 31 20 20 20 20 20 20 20 20 20 20 nt > 1
52b0: 20 20 2d 2d 20 66 69 6e 64 20 74 61 67 20 69 74 -- find tag it
52c0: 65 6d 20 75 73 65 64 20 6d 75 6c 74 69 70 6c 65 em used multiple
52d0: 20 74 69 6d 65 73 0a 09 09 41 4e 44 20 20 20 54 times...AND T
52e0: 2e 74 69 64 20 3d 20 55 2e 69 69 64 20 20 20 20 .tid = U.iid
52f0: 20 20 20 20 20 20 2d 2d 20 67 65 74 20 74 61 67 -- get tag
5300: 20 6f 66 20 69 74 65 6d 0a 09 09 41 4e 44 20 20 of item...AND
5310: 20 53 2e 73 69 64 20 3d 20 54 2e 73 69 64 20 20 S.sid = T.sid
5320: 20 20 20 20 20 20 20 20 2d 2d 20 67 65 74 20 73 -- get s
5330: 79 6d 62 6f 6c 20 6f 66 20 74 61 67 0a 09 09 41 ymbol of tag...A
5340: 4e 44 20 20 20 50 2e 70 69 64 20 3d 20 53 2e 70 ND P.pid = S.p
5350: 69 64 20 20 20 20 20 20 20 20 20 20 2d 2d 20 67 id -- g
5360: 65 74 20 70 72 6f 6a 65 63 74 20 6f 66 20 73 79 et project of sy
5370: 6d 62 6f 6c 0a 09 20 20 20 20 7d 0a 09 69 66 20 mbol.. }..if
5380: 30 20 7b 0a 09 20 20 20 20 23 20 54 68 69 73 20 0 {.. # This
5390: 63 68 65 63 6b 20 69 73 20 64 69 73 61 62 6c 65 check is disable
53a0: 64 20 66 6f 72 20 74 68 65 20 6d 6f 6d 65 6e 74 d for the moment
53b0: 2e 20 41 70 70 61 72 65 6e 74 6c 79 20 74 61 67 . Apparently tag
53c0: 73 0a 09 20 20 20 20 23 20 63 61 6e 20 63 72 6f s.. # can cro
53d0: 73 73 20 6c 69 6e 65 73 20 6f 66 20 64 65 76 65 ss lines of deve
53e0: 6c 6f 70 6d 65 6e 74 2c 20 61 74 20 6c 65 61 73 lopment, at leas
53f0: 74 20 69 66 20 74 68 65 20 69 6e 76 6f 6c 76 65 t if the involve
5400: 64 0a 09 20 20 20 20 23 20 4c 4f 44 73 20 61 72 d.. # LODs ar
5410: 65 20 74 68 65 20 74 72 75 6e 6b 2c 20 61 6e 64 e the trunk, and
5420: 20 74 68 65 20 4e 54 44 42 2e 20 54 68 61 74 20 the NTDB. That
5430: 6d 61 6b 65 73 20 73 65 6e 73 65 2c 20 61 73 0a makes sense, as.
5440: 09 20 20 20 20 23 20 74 68 65 20 4e 54 44 42 20 . # the NTDB
5450: 72 65 76 69 73 69 6f 6e 73 20 61 72 65 20 69 6e revisions are in
5460: 69 74 69 61 6c 6c 79 20 6c 6f 67 69 63 61 6c 6c itially logicall
5470: 79 20 61 20 70 61 72 74 20 6f 66 20 74 68 65 0a y a part of the.
5480: 09 20 20 20 20 23 20 74 72 75 6e 6b 2e 20 54 68 . # trunk. Th
5490: 65 20 73 74 61 6e 64 61 72 64 20 63 68 65 63 6b e standard check
54a0: 20 62 65 6c 6f 77 20 68 6f 77 65 76 65 72 20 64 below however d
54b0: 6f 65 73 20 6e 6f 74 20 63 61 70 74 75 72 65 0a oes not capture.
54c0: 09 20 20 20 20 23 20 74 68 69 73 2e 20 57 68 65 . # this. Whe
54d0: 6e 20 49 20 6d 61 6e 61 67 65 20 74 6f 20 72 65 n I manage to re
54e0: 70 68 72 61 73 65 20 69 74 20 74 6f 20 61 63 63 phrase it to acc
54f0: 65 70 74 20 74 68 69 73 20 74 79 70 65 0a 09 20 ept this type..
5500: 20 20 20 23 20 6f 66 20 63 72 6f 73 73 2d 6f 76 # of cross-ov
5510: 65 72 20 69 74 20 77 69 6c 6c 20 62 65 20 72 65 er it will be re
5520: 2d 61 63 74 69 76 61 74 65 64 2e 0a 0a 09 20 20 -activated....
5530: 20 20 23 20 41 6c 6c 20 74 61 67 73 20 68 61 76 # All tags hav
5540: 65 20 74 6f 20 61 67 72 65 65 20 6f 6e 20 74 68 e to agree on th
5550: 65 20 4c 4f 44 20 74 68 65 69 72 20 63 68 61 6e e LOD their chan
5560: 67 65 73 65 74 0a 09 20 20 20 20 23 20 62 65 6c geset.. # bel
5570: 6f 6e 67 73 20 74 6f 2e 20 49 6e 20 6f 74 68 65 ongs to. In othe
5580: 72 20 77 6f 72 64 73 2c 20 61 6c 6c 20 74 61 67 r words, all tag
5590: 73 20 69 6e 20 61 20 63 68 61 6e 67 65 73 65 74 s in a changeset
55a0: 20 68 61 76 65 0a 09 20 20 20 20 23 20 74 6f 20 have.. # to
55b0: 72 65 66 65 72 20 74 6f 20 74 68 65 20 73 61 6d refer to the sam
55c0: 65 20 6c 69 6e 65 20 6f 66 20 64 65 76 65 6c 6f e line of develo
55d0: 70 6d 65 6e 74 2e 0a 09 20 20 20 20 23 0a 09 20 pment... #..
55e0: 20 20 20 23 20 49 6e 73 74 65 61 64 20 6f 66 20 # Instead of
55f0: 6c 6f 6f 6b 69 6e 67 20 61 74 20 61 6c 6c 20 70 looking at all p
5600: 61 69 72 73 20 6f 66 20 74 61 67 73 20 69 6e 20 airs of tags in
5610: 61 6c 6c 0a 09 20 20 20 20 23 20 63 68 61 6e 67 all.. # chang
5620: 65 73 65 74 73 20 77 65 20 67 65 6e 65 72 61 74 esets we generat
5630: 65 20 74 68 65 20 64 69 73 74 69 6e 63 74 20 73 e the distinct s
5640: 65 74 20 6f 66 20 61 6c 6c 20 4c 4f 44 73 0a 09 et of all LODs..
5650: 20 20 20 20 23 20 72 65 66 65 72 65 6e 63 65 64 # referenced
5660: 20 62 79 20 74 68 65 20 74 61 67 73 20 6f 66 20 by the tags of
5670: 61 20 63 68 61 6e 67 65 73 65 74 2c 20 6c 6f 6f a changeset, loo
5680: 6b 20 66 6f 72 20 74 68 6f 73 65 0a 09 20 20 20 k for those..
5690: 20 23 20 77 69 74 68 20 63 61 72 64 69 6e 61 6c # with cardinal
56a0: 69 74 79 20 3e 20 31 2c 20 61 6e 64 20 67 65 74 ity > 1, and get
56b0: 20 74 68 65 20 69 64 65 6e 74 69 66 79 69 6e 67 the identifying
56c0: 0a 09 20 20 20 20 23 20 69 6e 66 6f 72 6d 61 74 .. # informat
56d0: 69 6f 6e 20 66 6f 72 20 74 68 65 20 63 68 61 6e ion for the chan
56e0: 67 65 73 65 74 73 20 66 6f 75 6e 64 20 74 68 75 gesets found thu
56f0: 73 6c 79 2e 0a 09 20 20 20 20 43 68 65 63 6b 43 sly... CheckC
5700: 53 20 5c 0a 09 09 7b 41 6c 6c 20 74 61 67 73 20 S \...{All tags
5710: 69 6e 20 61 20 63 68 61 6e 67 65 73 65 74 20 68 in a changeset h
5720: 61 76 65 20 74 6f 20 62 65 6c 6f 6e 67 20 74 6f ave to belong to
5730: 20 74 68 65 20 73 61 6d 65 20 4c 4f 44 7d 20 5c the same LOD} \
5740: 0a 09 09 7b 3a 20 49 74 73 20 74 61 67 73 20 64 ...{: Its tags d
5750: 69 73 61 67 72 65 65 20 61 62 6f 75 74 20 74 68 isagree about th
5760: 65 20 4c 4f 44 20 74 68 65 79 20 62 65 6c 6f 6e e LOD they belon
5770: 67 20 74 6f 7d 20 7b 0a 09 09 20 20 20 20 53 45 g to} {... SE
5780: 4c 45 43 54 20 54 2e 6e 61 6d 65 2c 20 43 2e 63 LECT T.name, C.c
5790: 69 64 0a 09 09 20 20 20 20 46 52 4f 4d 20 20 20 id... FROM
57a0: 63 68 61 6e 67 65 73 65 74 20 43 2c 20 63 73 74 changeset C, cst
57b0: 79 70 65 20 54 0a 09 09 20 20 20 20 57 48 45 52 ype T... WHER
57c0: 45 20 20 43 2e 63 69 64 20 49 4e 20 28 53 45 4c E C.cid IN (SEL
57d0: 45 43 54 20 55 2e 63 69 64 0a 09 09 09 09 20 20 ECT U.cid.....
57e0: 20 20 20 46 52 4f 4d 20 28 53 45 4c 45 43 54 20 FROM (SELECT
57f0: 44 49 53 54 49 4e 43 54 20 43 49 2e 63 69 64 20 DISTINCT CI.cid
5800: 41 53 20 63 69 64 2c 20 54 2e 6c 6f 64 20 41 53 AS cid, T.lod AS
5810: 20 6c 6f 64 0a 09 09 09 09 09 20 20 20 46 52 4f lod...... FRO
5820: 4d 20 20 20 63 73 69 74 65 6d 20 43 49 2c 20 63 M csitem CI, c
5830: 68 61 6e 67 65 73 65 74 20 43 2c 20 74 61 67 20 hangeset C, tag
5840: 54 0a 09 09 09 09 09 20 20 20 57 48 45 52 45 20 T...... WHERE
5850: 20 43 49 2e 69 69 64 20 3d 20 54 2e 74 69 64 0a CI.iid = T.tid.
5860: 09 09 09 09 09 20 20 20 41 4e 44 20 20 20 20 43 ..... AND C
5870: 2e 63 69 64 20 3d 20 43 49 2e 63 69 64 0a 09 09 .cid = CI.cid...
5880: 09 09 09 20 20 20 41 4e 44 20 20 20 20 43 2e 74 ... AND C.t
5890: 79 70 65 20 3d 20 31 29 20 41 53 20 55 0a 09 09 ype = 1) AS U...
58a0: 09 09 20 20 20 20 20 47 52 4f 55 50 20 42 59 20 .. GROUP BY
58b0: 55 2e 63 69 64 20 48 41 56 49 4e 47 20 43 4f 55 U.cid HAVING COU
58c0: 4e 54 28 55 2e 6c 6f 64 29 20 3e 20 31 29 0a 09 NT(U.lod) > 1)..
58d0: 09 20 20 20 20 41 4e 44 20 20 20 20 54 2e 74 69 . AND T.ti
58e0: 64 20 3d 20 43 2e 74 79 70 65 0a 09 09 7d 0a 09 d = C.type...}..
58f0: 7d 0a 09 23 20 41 6c 6c 20 74 61 67 73 20 68 61 }..# All tags ha
5900: 76 65 20 74 6f 20 61 67 72 65 65 20 6f 6e 20 74 ve to agree on t
5910: 68 65 20 70 72 6f 6a 65 63 74 20 74 68 65 69 72 he project their
5920: 20 63 68 61 6e 67 65 73 65 74 0a 09 23 20 62 65 changeset..# be
5930: 6c 6f 6e 67 73 20 74 6f 2e 20 49 6e 20 6f 74 68 longs to. In oth
5940: 65 72 20 77 6f 72 64 73 2c 20 61 6c 6c 20 74 61 er words, all ta
5950: 67 73 20 69 6e 20 61 20 63 68 61 6e 67 65 73 65 gs in a changese
5960: 74 20 68 61 76 65 20 74 6f 0a 09 23 20 72 65 66 t have to..# ref
5970: 65 72 20 74 6f 20 74 68 65 20 73 61 6d 65 20 70 er to the same p
5980: 72 6f 6a 65 63 74 2e 0a 09 23 0a 09 23 20 49 6e roject...#..# In
5990: 73 74 65 61 64 20 6f 66 20 6c 6f 6f 6b 69 6e 67 stead of looking
59a0: 20 61 74 20 61 6c 6c 20 70 61 69 72 73 20 6f 66 at all pairs of
59b0: 20 74 61 67 73 20 69 6e 20 61 6c 6c 20 63 68 61 tags in all cha
59c0: 6e 67 65 73 65 74 73 20 77 65 0a 09 23 20 67 65 ngesets we..# ge
59d0: 6e 65 72 61 74 65 20 74 68 65 20 64 69 73 74 69 nerate the disti
59e0: 6e 63 74 20 73 65 74 20 6f 66 20 61 6c 6c 20 70 nct set of all p
59f0: 72 6f 6a 65 63 74 73 20 72 65 66 65 72 65 6e 63 rojects referenc
5a00: 65 64 20 62 79 20 74 68 65 0a 09 23 20 74 61 67 ed by the..# tag
5a10: 73 20 6f 66 20 61 20 63 68 61 6e 67 65 73 65 74 s of a changeset
5a20: 2c 20 6c 6f 6f 6b 20 66 6f 72 20 74 68 6f 73 65 , look for those
5a30: 20 77 69 74 68 20 63 61 72 64 69 6e 61 6c 69 74 with cardinalit
5a40: 79 20 3e 20 31 2c 0a 09 23 20 61 6e 64 20 67 65 y > 1,..# and ge
5a50: 74 20 74 68 65 20 69 64 65 6e 74 69 66 79 69 6e t the identifyin
5a60: 67 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 66 6f g information fo
5a70: 72 20 74 68 65 20 63 68 61 6e 67 65 73 65 74 73 r the changesets
5a80: 20 66 6f 75 6e 64 0a 09 23 20 74 68 75 73 6c 79 found..# thusly
5a90: 2e 0a 09 43 68 65 63 6b 43 53 20 5c 0a 09 20 20 ...CheckCS \..
5aa0: 20 20 7b 41 6c 6c 20 74 61 67 73 20 69 6e 20 61 {All tags in a
5ab0: 20 63 68 61 6e 67 65 73 65 74 20 68 61 76 65 20 changeset have
5ac0: 74 6f 20 62 65 6c 6f 6e 67 20 74 6f 20 74 68 65 to belong to the
5ad0: 20 73 61 6d 65 20 70 72 6f 6a 65 63 74 7d 20 5c same project} \
5ae0: 0a 09 20 20 20 20 7b 3a 20 49 74 73 20 74 61 67 .. {: Its tag
5af0: 73 20 64 69 73 61 67 72 65 65 20 61 62 6f 75 74 s disagree about
5b00: 20 74 68 65 20 70 72 6f 6a 65 63 74 20 74 68 65 the project the
5b10: 79 20 62 65 6c 6f 6e 67 20 74 6f 7d 20 7b 0a 09 y belong to} {..
5b20: 09 53 45 4c 45 43 54 20 54 2e 6e 61 6d 65 2c 20 .SELECT T.name,
5b30: 43 2e 63 69 64 0a 09 09 46 52 4f 4d 20 20 20 63 C.cid...FROM c
5b40: 68 61 6e 67 65 73 65 74 20 43 2c 20 63 73 74 79 hangeset C, csty
5b50: 70 65 20 54 0a 09 09 57 48 45 52 45 20 20 43 2e pe T...WHERE C.
5b60: 63 69 64 20 49 4e 20 28 53 45 4c 45 43 54 20 55 cid IN (SELECT U
5b70: 2e 63 69 64 0a 09 09 09 09 20 46 52 4f 4d 20 28 .cid..... FROM (
5b80: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 SELECT DISTINCT
5b90: 20 20 20 20 20 20 2d 2d 20 75 6e 69 71 75 65 20 -- unique
5ba0: 63 73 65 74 2f 70 72 6f 6a 20 70 61 69 72 73 0a cset/proj pairs.
5bb0: 09 09 09 09 20 20 20 20 20 20 20 20 20 20 20 20 ....
5bc0: 20 20 43 49 2e 63 69 64 20 41 53 20 63 69 64 2c CI.cid AS cid,
5bd0: 20 2d 2d 20 74 61 67 20 63 73 65 74 0a 09 09 09 -- tag cset....
5be0: 09 20 20 20 20 20 20 20 20 20 20 20 20 20 20 46 . F
5bf0: 2e 70 69 64 20 20 41 53 20 70 69 64 20 20 2d 2d .pid AS pid --
5c00: 20 70 72 6f 6a 65 63 74 20 6f 66 20 69 74 65 6d project of item
5c10: 20 69 6e 20 63 73 65 74 0a 09 09 09 09 20 20 20 in cset.....
5c20: 20 20 20 20 46 52 4f 4d 20 20 20 63 73 69 74 65 FROM csite
5c30: 6d 20 43 49 2c 20 63 68 61 6e 67 65 73 65 74 20 m CI, changeset
5c40: 43 2c 20 74 61 67 20 54 2c 20 66 69 6c 65 20 46 C, tag T, file F
5c50: 0a 09 09 09 09 20 20 20 20 20 20 20 57 48 45 52 ..... WHER
5c60: 45 20 20 43 49 2e 69 69 64 20 3d 20 54 2e 74 69 E CI.iid = T.ti
5c70: 64 20 20 2d 2d 20 67 65 74 20 74 61 67 20 6f 66 d -- get tag of
5c80: 20 69 74 65 6d 20 69 6e 20 63 73 65 74 0a 09 09 item in cset...
5c90: 09 09 20 20 20 20 20 20 20 41 4e 44 20 20 20 20 .. AND
5ca0: 43 2e 63 69 64 20 20 3d 20 43 49 2e 63 69 64 20 C.cid = CI.cid
5cb0: 2d 2d 20 67 65 74 20 63 68 61 6e 67 65 73 65 74 -- get changeset
5cc0: 20 6f 66 20 69 74 65 6d 0a 09 09 09 09 20 20 20 of item.....
5cd0: 20 20 20 20 41 4e 44 20 20 20 20 43 2e 74 79 70 AND C.typ
5ce0: 65 20 3d 20 31 20 20 20 20 20 20 2d 2d 20 6c 69 e = 1 -- li
5cf0: 6d 69 74 20 74 6f 20 74 61 67 20 63 68 61 6e 67 mit to tag chang
5d00: 65 73 65 74 73 0a 09 09 09 09 20 20 20 20 20 20 esets.....
5d10: 20 41 4e 44 20 20 20 20 46 2e 66 69 64 20 20 3d AND F.fid =
5d20: 20 54 2e 66 69 64 20 20 2d 2d 20 67 65 74 20 66 T.fid -- get f
5d30: 69 6c 65 20 6f 66 20 74 61 67 0a 20 20 20 20 20 ile of tag.
5d40: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
5d50: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
5d60: 20 29 20 41 53 20 55 0a 09 09 09 09 20 47 52 4f ) AS U..... GRO
5d70: 55 50 20 42 59 20 55 2e 63 69 64 20 20 20 20 20 UP BY U.cid
5d80: 20 20 20 20 20 20 2d 2d 20 61 67 67 72 65 67 61 -- aggrega
5d90: 74 65 20 62 79 20 63 73 65 74 73 2c 20 63 6f 75 te by csets, cou
5da0: 6e 74 20 70 72 6f 6a 2f 63 73 65 74 0a 09 09 09 nt proj/cset....
5db0: 09 20 48 41 56 49 4e 47 20 43 4f 55 4e 54 28 55 . HAVING COUNT(U
5dc0: 2e 70 69 64 29 20 3e 20 31 20 20 2d 2d 20 66 69 .pid) > 1 -- fi
5dd0: 6e 64 20 63 73 65 74 73 20 77 69 74 68 20 6d 75 nd csets with mu
5de0: 6c 74 69 70 6c 65 20 70 72 6f 6a 65 63 74 73 0a ltiple projects.
5df0: 09 09 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
5e00: 20 20 29 0a 09 09 41 4e 44 20 20 20 20 54 2e 74 )...AND T.t
5e10: 69 64 20 3d 20 43 2e 74 79 70 65 20 2d 2d 20 67 id = C.type -- g
5e20: 65 74 20 72 65 61 64 61 62 6c 65 20 63 68 61 6e et readable chan
5e30: 67 65 73 65 74 20 74 79 70 65 0a 09 20 20 20 20 geset type..
5e40: 7d 0a 09 23 20 41 6c 6c 20 74 61 67 73 20 69 6e }..# All tags in
5e50: 20 61 20 73 69 6e 67 6c 65 20 63 68 61 6e 67 65 a single change
5e60: 73 65 74 20 68 61 76 65 20 74 6f 20 62 65 6c 6f set have to belo
5e70: 6e 67 20 74 6f 20 64 69 66 66 65 72 65 6e 74 0a ng to different.
5e80: 09 23 20 66 69 6c 65 73 2e 20 43 6f 6e 76 65 72 .# files. Conver
5e90: 73 65 6c 79 3a 20 4e 6f 20 74 77 6f 20 74 61 67 sely: No two tag
5ea0: 73 20 6f 66 20 61 20 73 69 6e 67 6c 65 20 66 69 s of a single fi
5eb0: 6c 65 20 61 72 65 20 61 6c 6c 6f 77 65 64 0a 09 le are allowed..
5ec0: 23 20 74 6f 20 62 65 20 69 6e 20 74 68 65 20 73 # to be in the s
5ed0: 61 6d 65 20 63 68 61 6e 67 65 73 65 74 2e 0a 09 ame changeset...
5ee0: 23 0a 09 23 20 49 6e 73 74 65 61 64 20 6f 66 20 #..# Instead of
5ef0: 6c 6f 6f 6b 69 6e 67 20 61 74 20 61 6c 6c 20 70 looking at all p
5f00: 61 69 72 73 20 6f 66 20 74 61 67 73 20 69 6e 20 airs of tags in
5f10: 61 6c 6c 20 63 68 61 6e 67 65 73 65 74 73 20 77 all changesets w
5f20: 65 0a 09 23 20 67 65 6e 65 72 61 74 65 20 74 68 e..# generate th
5f30: 65 20 64 69 73 74 69 6e 63 74 20 73 65 74 20 6f e distinct set o
5f40: 66 20 61 6c 6c 20 66 69 6c 65 73 20 72 65 66 65 f all files refe
5f50: 72 65 6e 63 65 64 20 62 79 20 74 68 65 0a 09 23 renced by the..#
5f60: 20 74 61 67 73 20 6f 66 20 61 20 63 68 61 6e 67 tags of a chang
5f70: 65 73 65 74 2c 20 61 6e 64 20 6c 6f 6f 6b 20 66 eset, and look f
5f80: 6f 72 20 74 68 6f 73 65 20 77 69 74 68 20 63 61 or those with ca
5f90: 72 64 69 6e 61 6c 69 74 79 20 3c 0a 09 23 20 74 rdinality <..# t
5fa0: 68 65 20 63 61 72 64 69 6e 61 6c 69 74 79 20 6f he cardinality o
5fb0: 66 20 74 68 65 20 73 65 74 20 6f 66 20 74 61 67 f the set of tag
5fc0: 73 2c 20 61 6e 64 20 67 65 74 20 74 68 65 20 69 s, and get the i
5fd0: 64 65 6e 74 69 66 79 69 6e 67 0a 09 23 20 69 6e dentifying..# in
5fe0: 66 6f 72 6d 61 74 69 6f 6e 20 66 6f 72 20 74 68 formation for th
5ff0: 65 20 63 68 61 6e 67 65 73 65 74 73 20 66 6f 75 e changesets fou
6000: 6e 64 20 74 68 75 73 6c 79 2e 0a 09 43 68 65 63 nd thusly...Chec
6010: 6b 43 53 20 5c 0a 09 20 20 20 20 7b 41 6c 6c 20 kCS \.. {All
6020: 74 61 67 73 20 69 6e 20 61 20 63 68 61 6e 67 65 tags in a change
6030: 73 65 74 20 68 61 76 65 20 74 6f 20 62 65 6c 6f set have to belo
6040: 6e 67 20 74 6f 20 64 69 66 66 65 72 65 6e 74 20 ng to different
6050: 66 69 6c 65 73 7d 20 5c 0a 09 20 20 20 20 7b 3a files} \.. {:
6060: 20 49 74 73 20 74 61 67 73 20 73 68 61 72 65 20 Its tags share
6070: 66 69 6c 65 73 7d 20 7b 0a 09 09 53 45 4c 45 43 files} {...SELEC
6080: 54 20 54 2e 6e 61 6d 65 2c 20 43 2e 63 69 64 0a T T.name, C.cid.
6090: 09 09 46 52 4f 4d 20 20 20 63 68 61 6e 67 65 73 ..FROM changes
60a0: 65 74 20 43 2c 20 63 73 74 79 70 65 20 54 0a 09 et C, cstype T..
60b0: 09 57 48 45 52 45 20 20 43 2e 63 69 64 20 49 4e .WHERE C.cid IN
60c0: 20 28 53 45 4c 45 43 54 20 56 56 2e 63 69 64 0a (SELECT VV.cid.
60d0: 09 09 09 09 20 46 52 4f 4d 20 28 53 45 4c 45 43 .... FROM (SELEC
60e0: 54 20 55 2e 63 69 64 20 20 20 20 20 20 20 20 20 T U.cid
60f0: 41 53 20 63 69 64 2c 20 20 20 2d 2d 20 63 68 61 AS cid, -- cha
6100: 6e 67 65 73 65 74 0a 09 09 09 09 20 20 20 20 20 ngeset.....
6110: 20 20 20 20 20 20 20 20 20 43 4f 55 4e 54 20 28 COUNT (
6120: 55 2e 66 69 64 29 20 41 53 20 66 63 6f 75 6e 74 U.fid) AS fcount
6130: 20 2d 2d 20 6e 75 6d 62 65 72 20 6f 66 20 66 69 -- number of fi
6140: 6c 65 73 20 62 79 20 69 74 65 6d 73 0a 09 09 09 les by items....
6150: 09 20 20 20 20 20 20 20 46 52 4f 4d 20 28 53 45 . FROM (SE
6160: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 20 20 LECT DISTINCT
6170: 20 20 20 20 2d 2d 20 75 6e 69 71 75 65 20 63 73 -- unique cs
6180: 65 74 2f 66 69 6c 65 20 70 61 69 72 73 0a 09 09 et/file pairs...
6190: 09 09 09 20 20 20 20 20 20 20 20 20 20 20 20 43 ... C
61a0: 49 2e 63 69 64 20 41 53 20 63 69 64 2c 20 2d 2d I.cid AS cid, --
61b0: 20 74 61 67 20 63 68 61 6e 67 65 73 65 74 0a 09 tag changeset..
61c0: 09 09 09 09 20 20 20 20 20 20 20 20 20 20 20 20 ....
61d0: 54 2e 66 69 64 20 20 41 53 20 66 69 64 20 20 2d T.fid AS fid -
61e0: 2d 20 66 69 6c 65 20 6f 66 20 69 74 65 6d 20 69 - file of item i
61f0: 6e 20 63 68 61 6e 67 65 73 65 74 0a 09 09 09 09 n changeset.....
6200: 09 20 20 20 20 20 46 52 4f 4d 20 20 20 63 73 69 . FROM csi
6210: 74 65 6d 20 43 49 2c 20 63 68 61 6e 67 65 73 65 tem CI, changese
6220: 74 20 43 2c 20 74 61 67 20 54 0a 09 09 09 09 09 t C, tag T......
6230: 20 20 20 20 20 57 48 45 52 45 20 20 43 49 2e 69 WHERE CI.i
6240: 69 64 20 3d 20 54 2e 74 69 64 20 2d 2d 20 67 65 id = T.tid -- ge
6250: 74 20 74 61 67 20 6f 66 20 69 74 65 6d 20 69 6e t tag of item in
6260: 20 63 68 61 6e 67 65 73 65 74 0a 09 09 09 09 09 changeset......
6270: 20 20 20 20 20 41 4e 44 20 20 20 20 43 2e 63 69 AND C.ci
6280: 64 20 3d 20 43 49 2e 63 69 64 20 2d 2d 20 67 65 d = CI.cid -- ge
6290: 74 20 63 68 61 6e 67 65 73 65 74 20 6f 66 20 69 t changeset of i
62a0: 74 65 6d 0a 09 09 09 09 09 20 20 20 20 20 41 4e tem...... AN
62b0: 44 20 20 20 20 43 2e 74 79 70 65 20 3d 20 31 20 D C.type = 1
62c0: 20 20 20 20 2d 2d 20 6c 69 6d 69 74 20 74 6f 20 -- limit to
62d0: 74 61 67 20 63 68 61 6e 67 65 73 65 74 73 0a 09 tag changesets..
62e0: 09 09 09 09 20 20 20 20 20 29 20 41 53 20 55 0a .... ) AS U.
62f0: 09 09 09 09 20 20 20 20 20 20 20 47 52 4f 55 50 .... GROUP
6300: 20 42 59 20 55 2e 63 69 64 20 2d 2d 20 61 67 67 BY U.cid -- agg
6310: 72 65 67 61 74 65 20 62 79 20 63 73 65 74 73 2c regate by csets,
6320: 20 63 6f 75 6e 74 20 66 69 6c 65 73 2f 63 73 65 count files/cse
6330: 74 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 t.
6340: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
6350: 20 20 20 20 20 20 20 20 29 20 41 53 20 55 55 2c ) AS UU,
6360: 0a 09 09 09 09 20 20 20 20 20 20 28 53 45 4c 45 ..... (SELE
6370: 43 54 20 56 2e 63 69 64 20 20 20 20 20 20 20 20 CT V.cid
6380: 20 41 53 20 63 69 64 2c 20 20 20 2d 2d 20 63 68 AS cid, -- ch
6390: 61 6e 67 65 73 65 74 0a 09 09 09 09 20 20 20 20 angeset.....
63a0: 20 20 20 20 20 20 20 20 20 20 43 4f 55 4e 54 20 COUNT
63b0: 28 56 2e 69 69 64 29 20 41 53 20 72 63 6f 75 6e (V.iid) AS rcoun
63c0: 74 20 2d 2d 20 6e 75 6d 62 65 72 20 6f 66 20 69 t -- number of i
63d0: 74 65 6d 73 20 69 6e 20 63 73 65 74 0a 09 09 09 tems in cset....
63e0: 09 20 20 20 20 20 20 20 46 52 4f 4d 20 20 20 63 . FROM c
63f0: 73 69 74 65 6d 20 56 2c 20 63 68 61 6e 67 65 73 sitem V, changes
6400: 65 74 20 58 0a 09 09 09 09 20 20 20 20 20 20 20 et X.....
6410: 57 48 45 52 45 20 20 58 2e 63 69 64 20 20 3d 20 WHERE X.cid =
6420: 56 2e 63 69 64 20 2d 2d 20 67 65 74 20 63 68 61 V.cid -- get cha
6430: 6e 67 65 73 65 74 20 6f 66 20 69 74 65 6d 0a 09 ngeset of item..
6440: 09 09 09 20 20 20 20 20 20 20 41 4e 44 20 20 20 ... AND
6450: 20 58 2e 74 79 70 65 20 3d 20 31 20 20 20 20 20 X.type = 1
6460: 2d 2d 20 6c 69 6d 69 74 20 74 6f 20 74 61 67 20 -- limit to tag
6470: 63 68 61 6e 67 65 73 65 74 73 0a 09 09 09 09 20 changesets.....
6480: 20 20 20 20 20 20 47 52 4f 55 50 20 42 59 20 56 GROUP BY V
6490: 2e 63 69 64 20 20 20 20 20 20 20 20 2d 2d 20 61 .cid -- a
64a0: 67 67 72 65 67 61 74 65 20 62 79 20 63 73 65 74 ggregate by cset
64b0: 73 2c 20 63 6f 75 6e 74 20 69 74 65 6d 73 2f 63 s, count items/c
64c0: 73 65 74 0a 20 20 20 20 20 20 20 20 20 20 20 20 set.
64d0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
64e0: 20 20 20 20 20 20 20 20 20 20 29 20 41 53 20 56 ) AS V
64f0: 56 0a 09 09 09 09 20 57 48 45 52 45 20 56 56 2e V..... WHERE VV.
6500: 63 69 64 20 3d 20 55 55 2e 63 69 64 20 20 20 20 cid = UU.cid
6510: 20 20 20 2d 2d 20 73 79 6e 63 20 23 69 74 65 6d -- sync #item
6520: 73 2f 63 73 65 74 20 77 69 74 68 20 23 66 69 6c s/cset with #fil
6530: 65 73 2f 63 73 65 74 0a 09 09 09 09 20 41 4e 44 es/cset..... AND
6540: 20 20 20 55 55 2e 66 63 6f 75 6e 74 20 3c 20 56 UU.fcount < V
6550: 56 2e 72 63 6f 75 6e 74 20 2d 2d 20 6c 65 73 73 V.rcount -- less
6560: 20 66 69 6c 65 73 20 74 68 61 6e 20 69 74 65 6d files than item
6570: 73 0a 09 09 09 09 20 20 20 20 20 20 20 20 20 20 s.....
6580: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
6590: 20 20 20 2d 2d 20 3d 3e 20 69 74 65 6d 73 20 62 -- => items b
65a0: 65 6c 6f 6e 67 20 74 6f 20 74 68 65 20 73 61 6d elong to the sam
65b0: 65 20 66 69 6c 65 2e 0a 09 09 09 09 29 0a 09 09 e file......)...
65c0: 41 4e 44 20 20 20 20 54 2e 74 69 64 20 3d 20 43 AND T.tid = C
65d0: 2e 74 79 70 65 20 2d 2d 20 67 65 74 20 72 65 61 .type -- get rea
65e0: 64 61 62 6c 65 20 63 68 61 6e 67 65 73 65 74 20 dable changeset
65f0: 74 79 70 65 0a 09 20 20 20 20 7d 0a 09 72 65 74 type.. }..ret
6600: 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 70 urn. }.. p
6610: 72 6f 63 20 42 72 61 6e 63 68 43 68 61 6e 67 65 roc BranchChange
6620: 73 65 74 73 20 7b 7d 20 7b 0a 09 23 20 54 68 69 sets {} {..# Thi
6630: 73 20 63 6f 64 65 20 70 65 72 66 6f 72 6d 73 20 s code performs
6640: 61 20 6e 75 6d 62 65 72 20 6f 66 20 70 61 72 61 a number of para
6650: 6e 6f 69 64 20 63 68 65 63 6b 73 20 6f 66 20 74 noid checks of t
6660: 68 65 0a 09 23 20 64 61 74 61 62 61 73 65 2c 20 he..# database,
6670: 73 65 61 72 63 68 69 6e 67 20 66 6f 72 20 69 6e searching for in
6680: 63 6f 6e 73 69 73 74 65 6e 74 20 63 68 61 6e 67 consistent chang
6690: 65 73 65 74 2f 72 65 76 69 73 69 6f 6e 0a 09 23 eset/revision..#
66a0: 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 2e 0a 0a 09 information....
66b0: 75 70 76 61 72 20 31 20 6e 20 6e 20 3b 20 23 20 upvar 1 n n ; #
66c0: 43 6f 75 6e 74 65 72 20 66 6f 72 20 74 68 65 20 Counter for the
66d0: 63 68 65 63 6b 73 20 28 77 65 20 70 72 69 6e 74 checks (we print
66e0: 20 61 6e 20 69 64 20 62 65 66 6f 72 65 0a 09 09 an id before...
66f0: 20 20 20 20 20 20 23 20 74 68 65 20 6d 61 69 6e # the main
6700: 20 6c 61 62 65 6c 29 2e 0a 0a 09 23 20 46 69 6e label)....# Fin
6710: 64 20 61 6c 6c 20 62 72 61 6e 63 68 65 73 20 77 d all branches w
6720: 68 69 63 68 20 61 72 65 20 6e 6f 74 20 75 73 65 hich are not use
6730: 64 20 62 79 20 61 74 20 6c 65 61 73 74 20 6f 6e d by at least on
6740: 65 0a 09 23 20 63 68 61 6e 67 65 73 65 74 2e 0a e..# changeset..
6750: 09 43 68 65 63 6b 42 72 61 6e 63 68 20 5c 0a 09 .CheckBranch \..
6760: 20 20 20 20 7b 41 6c 6c 20 62 72 61 6e 63 68 65 {All branche
6770: 73 20 68 61 76 65 20 74 6f 20 62 65 20 75 73 65 s have to be use
6780: 64 20 62 79 20 6c 65 61 73 74 20 6f 6e 65 20 63 d by least one c
6790: 68 61 6e 67 65 73 65 74 7d 20 5c 0a 09 20 20 20 hangeset} \..
67a0: 20 7b 69 73 20 6e 6f 74 20 75 73 65 64 20 62 79 {is not used by
67b0: 20 61 20 63 68 61 6e 67 65 73 65 74 7d 20 7b 0a a changeset} {.
67c0: 09 09 2d 2d 20 55 6e 75 73 65 64 20 62 72 61 6e ..-- Unused bran
67d0: 63 68 65 73 20 3d 20 41 6c 6c 20 62 72 61 6e 63 ches = All branc
67e0: 68 65 73 0a 09 09 2d 2d 20 20 20 20 20 20 20 20 hes...--
67f0: 20 20 20 20 20 20 20 20 20 2d 20 62 72 61 6e 63 - branc
6800: 68 65 73 20 75 73 65 64 20 62 79 20 62 72 61 6e hes used by bran
6810: 63 68 20 63 68 61 6e 67 65 73 65 74 73 2e 0a 09 ch changesets...
6820: 09 2d 2d 0a 09 09 2d 2d 20 42 6f 74 68 20 73 65 .--...-- Both se
6830: 74 73 20 63 61 6e 20 62 65 20 63 6f 6d 70 75 74 ts can be comput
6840: 65 64 20 65 61 73 69 6c 79 2c 20 61 6e 64 20 73 ed easily, and s
6850: 75 62 74 72 61 63 74 65 64 0a 20 20 20 20 20 20 ubtracted.
6860: 20 20 20 20 20 20 20 20 20 20 2d 2d 20 66 72 6f -- fro
6870: 6d 20 65 61 63 68 20 6f 74 68 65 72 2e 20 54 68 m each other. Th
6880: 65 6e 20 77 65 20 63 61 6e 20 67 65 74 20 74 68 en we can get th
6890: 65 20 61 73 73 6f 63 69 61 74 65 64 0a 20 20 20 e associated.
68a0: 20 20 20 20 20 20 20 20 20 20 20 20 20 2d 2d 20 --
68b0: 66 69 6c 65 20 28 6e 61 6d 65 29 20 66 6f 72 20 file (name) for
68c0: 64 69 73 70 6c 61 79 2e 0a 0a 09 09 53 45 4c 45 display.....SELE
68d0: 43 54 20 50 2e 6e 61 6d 65 2c 20 53 2e 6e 61 6d CT P.name, S.nam
68e0: 65 0a 09 09 46 52 4f 4d 20 70 72 6f 6a 65 63 74 e...FROM project
68f0: 20 50 2c 20 62 72 61 6e 63 68 20 42 2c 20 73 79 P, branch B, sy
6900: 6d 62 6f 6c 20 53 0a 09 09 57 48 45 52 45 20 42 mbol S...WHERE B
6910: 2e 62 69 64 20 49 4e 20 28 53 45 4c 45 43 54 20 .bid IN (SELECT
6920: 62 69 64 20 20 20 20 20 20 20 20 20 20 20 20 20 bid
6930: 20 20 20 20 20 20 20 2d 2d 20 41 6c 6c 20 62 72 -- All br
6940: 61 6e 63 68 65 73 0a 09 09 09 09 46 52 4f 4d 20 anches.....FROM
6950: 20 20 62 72 61 6e 63 68 0a 09 09 09 09 45 58 43 branch.....EXC
6960: 45 50 54 20 20 20 20 20 20 20 20 20 20 20 20 20 EPT
6970: 20 20 20 20 20 20 20 20 20 20 20 2d 2d 20 73 75 -- su
6980: 62 74 72 61 63 74 0a 09 09 09 09 53 45 4c 45 43 btract.....SELEC
6990: 54 20 43 49 2e 69 69 64 20 20 20 20 20 20 20 20 T CI.iid
69a0: 20 20 20 20 20 20 20 20 20 2d 2d 20 62 72 61 6e -- bran
69b0: 63 68 65 73 20 75 73 65 64 0a 09 09 09 09 46 52 ches used.....FR
69c0: 4f 4d 20 20 20 63 73 69 74 65 6d 20 43 49 2c 20 OM csitem CI,
69d0: 63 68 61 6e 67 65 73 65 74 20 43 0a 09 09 09 09 changeset C.....
69e0: 57 48 45 52 45 20 20 43 2e 63 69 64 20 3d 20 43 WHERE C.cid = C
69f0: 49 2e 63 69 64 20 20 20 20 20 20 20 20 20 2d 2d I.cid --
6a00: 20 62 79 20 61 6e 79 20 62 72 61 6e 63 68 0a 09 by any branch..
6a10: 09 09 09 41 4e 44 20 20 20 20 43 2e 74 79 70 65 ...AND C.type
6a20: 20 3d 20 32 20 20 20 20 20 20 20 20 20 20 20 20 = 2
6a30: 20 2d 2d 20 63 68 61 6e 67 65 73 65 74 0a 09 09 -- changeset...
6a40: 09 20 20 20 20 20 20 20 29 0a 09 09 41 4e 44 20 . )...AND
6a50: 20 20 53 2e 73 69 64 20 3d 20 42 2e 73 69 64 20 S.sid = B.sid
6a60: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2d 2d --
6a70: 20 67 65 74 20 73 79 6d 62 6f 6c 20 6f 66 20 62 get symbol of b
6a80: 72 61 6e 63 68 0a 09 09 41 4e 44 20 20 20 50 2e ranch...AND P.
6a90: 70 69 64 20 3d 20 53 2e 70 69 64 20 20 20 20 20 pid = S.pid
6aa0: 20 20 20 20 20 20 20 20 20 20 2d 2d 20 67 65 74 -- get
6ab0: 20 70 72 6f 6a 65 63 74 20 6f 66 20 73 79 6d 62 project of symb
6ac0: 6f 6c 0a 09 20 20 20 20 7d 0a 09 23 20 46 69 6e ol.. }..# Fin
6ad0: 64 20 61 6c 6c 20 62 72 61 6e 63 68 65 73 20 77 d all branches w
6ae0: 68 69 63 68 20 61 72 65 20 75 73 65 64 20 62 79 hich are used by
6af0: 20 6d 6f 72 65 20 74 68 61 6e 20 6f 6e 65 20 63 more than one c
6b00: 68 61 6e 67 65 73 65 74 2e 0a 09 43 68 65 63 6b hangeset...Check
6b10: 52 65 76 20 5c 0a 09 20 20 20 20 7b 41 6c 6c 20 Rev \.. {All
6b20: 62 72 61 6e 63 68 65 73 20 68 61 76 65 20 74 6f branches have to
6b30: 20 62 65 20 75 73 65 64 20 62 79 20 61 74 20 6d be used by at m
6b40: 6f 73 74 20 6f 6e 65 20 63 68 61 6e 67 65 73 65 ost one changese
6b50: 74 7d 20 5c 0a 09 20 20 20 20 7b 69 73 20 75 73 t} \.. {is us
6b60: 65 64 20 62 79 20 6d 75 6c 74 69 70 6c 65 20 63 ed by multiple c
6b70: 68 61 6e 67 65 73 65 74 73 7d 20 7b 0a 09 09 2d hangesets} {...-
6b80: 2d 20 50 72 69 6e 63 69 70 6c 65 20 6f 66 20 6f - Principle of o
6b90: 70 65 72 61 74 69 6f 6e 3a 20 47 65 74 20 61 6c peration: Get al
6ba0: 6c 20 62 72 61 6e 63 68 2f 63 68 61 6e 67 65 73 l branch/changes
6bb0: 65 74 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 et.
6bc0: 20 20 20 2d 2d 20 70 61 69 72 73 20 66 6f 72 20 -- pairs for
6bd0: 61 6c 6c 20 62 72 61 6e 63 68 20 63 68 61 6e 67 all branch chang
6be0: 65 73 65 74 73 2c 20 67 72 6f 75 70 20 62 79 20 esets, group by
6bf0: 74 61 67 20 74 6f 0a 20 20 20 20 20 20 20 20 20 tag to.
6c00: 20 20 20 20 20 20 20 2d 2d 20 61 67 67 72 65 67 -- aggreg
6c10: 61 74 65 20 74 68 65 20 63 68 61 6e 67 65 73 65 ate the changese
6c20: 74 2c 20 63 6f 75 6e 74 69 6e 67 20 74 68 65 6d t, counting them
6c30: 2e 20 46 72 6f 6d 20 74 68 65 0a 20 20 20 20 20 . From the.
6c40: 20 20 20 20 20 20 20 20 20 20 20 2d 2d 20 72 65 -- re
6c50: 73 75 6c 74 69 6e 67 20 62 72 61 6e 63 68 2f 63 sulting branch/c
6c60: 6f 75 6e 74 20 74 61 62 6c 65 20 73 65 6c 65 63 ount table selec
6c70: 74 20 74 68 6f 73 65 20 77 69 74 68 20 6d 6f 72 t those with mor
6c80: 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 e.
6c90: 20 20 2d 2d 20 74 68 61 6e 20 6f 6e 65 20 75 73 -- than one us
6ca0: 65 72 2c 20 61 6e 64 20 67 65 74 20 74 68 65 69 er, and get thei
6cb0: 72 20 61 73 73 6f 63 69 61 74 65 64 20 66 69 6c r associated fil
6cc0: 65 20 28 6e 61 6d 65 29 0a 20 20 20 20 20 20 20 e (name).
6cd0: 20 20 20 20 20 20 20 20 20 2d 2d 20 66 6f 72 20 -- for
6ce0: 64 69 73 70 6c 61 79 2e 0a 0a 09 09 53 45 4c 45 display.....SELE
6cf0: 43 54 20 50 2e 6e 61 6d 65 2c 20 53 2e 6e 61 6d CT P.name, S.nam
6d00: 65 0a 09 09 46 52 4f 4d 20 62 72 61 6e 63 68 20 e...FROM branch
6d10: 42 2c 20 70 72 6f 6a 65 63 74 20 50 2c 20 73 79 B, project P, sy
6d20: 6d 62 6f 6c 20 53 2c 0a 09 09 20 20 20 20 20 28 mbol S,... (
6d30: 53 45 4c 45 43 54 20 43 49 2e 69 69 64 20 20 20 SELECT CI.iid
6d40: 20 20 20 20 20 41 53 20 69 69 64 2c 20 20 2d 2d AS iid, --
6d50: 20 69 74 65 6d 0a 20 20 20 20 20 20 20 20 20 20 item.
6d60: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
6d70: 20 20 20 63 6f 75 6e 74 28 43 49 2e 63 69 64 29 count(CI.cid)
6d80: 20 41 53 20 63 6f 75 6e 74 20 2d 2d 20 6e 75 6d AS count -- num
6d90: 62 65 72 20 6f 66 20 63 73 65 74 73 20 66 6f 72 ber of csets for
6da0: 20 69 74 65 6d 0a 09 09 20 20 20 20 20 20 46 52 item... FR
6db0: 4f 4d 20 63 73 69 74 65 6d 20 43 49 2c 20 63 68 OM csitem CI, ch
6dc0: 61 6e 67 65 73 65 74 20 43 0a 09 09 20 20 20 20 angeset C...
6dd0: 20 20 57 48 45 52 45 20 43 2e 74 79 70 65 20 3d WHERE C.type =
6de0: 20 32 20 20 20 20 20 20 20 20 2d 2d 20 6c 69 6d 2 -- lim
6df0: 69 74 20 74 6f 20 62 72 61 6e 63 68 20 63 68 61 it to branch cha
6e00: 6e 67 65 73 65 74 73 2c 0a 09 09 20 20 20 20 20 ngesets,...
6e10: 20 41 4e 44 20 20 20 43 2e 63 69 64 20 3d 20 43 AND C.cid = C
6e20: 49 2e 63 69 64 20 20 20 20 2d 2d 20 67 65 74 20 I.cid -- get
6e30: 74 68 65 20 69 74 65 6d 73 20 74 68 65 79 20 63 the items they c
6e40: 6f 6e 74 61 69 6e 2c 0a 09 09 20 20 20 20 20 20 ontain,...
6e50: 47 52 4f 55 50 20 42 59 20 43 49 2e 69 69 64 20 GROUP BY CI.iid
6e60: 20 20 20 20 20 20 20 20 2d 2d 20 61 67 67 72 65 -- aggre
6e70: 67 61 74 65 20 62 79 20 69 74 65 6d 73 2c 20 63 gate by items, c
6e80: 6f 75 6e 74 20 63 73 65 74 73 2f 69 74 65 6d 20 ount csets/item
6e90: 28 78 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 (x).
6ea0: 20 20 20 20 20 20 20 20 20 29 20 41 53 20 55 0a ) AS U.
6eb0: 09 09 57 48 45 52 45 20 55 2e 63 6f 75 6e 74 20 ..WHERE U.count
6ec0: 3e 20 31 20 20 20 20 20 20 20 20 20 20 20 20 20 > 1
6ed0: 2d 2d 20 66 69 6e 64 20 69 74 65 6d 73 20 75 73 -- find items us
6ee0: 65 64 20 6d 75 6c 74 69 70 6c 65 20 74 69 6d 65 ed multiple time
6ef0: 73 0a 09 09 41 4e 44 20 20 20 42 2e 62 69 64 20 s...AND B.bid
6f00: 3d 20 55 2e 69 69 64 20 20 20 20 20 20 20 20 20 = U.iid
6f10: 20 20 2d 2d 20 67 65 74 20 74 68 65 20 75 73 65 -- get the use
6f20: 72 73 20 28 62 72 61 6e 63 68 20 63 68 61 6e 67 rs (branch chang
6f30: 65 73 65 74 73 29 0a 09 09 41 4e 44 20 20 20 53 esets)...AND S
6f40: 2e 73 69 64 20 3d 20 42 2e 73 69 64 20 20 20 20 .sid = B.sid
6f50: 20 20 20 20 20 20 20 2d 2d 20 67 65 74 20 73 79 -- get sy
6f60: 6d 62 6f 6c 20 6f 66 20 62 72 61 6e 63 68 0a 09 mbol of branch..
6f70: 09 41 4e 44 20 20 20 50 2e 70 69 64 20 3d 20 53 .AND P.pid = S
6f80: 2e 70 69 64 20 20 20 20 20 20 20 20 20 20 20 2d .pid -
6f90: 2d 20 67 65 74 20 70 72 6f 6a 65 63 74 20 6f 66 - get project of
6fa0: 20 73 79 6d 62 6f 6c 0a 09 20 20 20 20 7d 0a 09 symbol.. }..
6fb0: 69 66 20 30 20 7b 0a 09 20 20 20 20 23 20 54 68 if 0 {.. # Th
6fc0: 69 73 20 63 68 65 63 6b 20 68 61 73 20 62 65 65 is check has bee
6fd0: 6e 20 64 69 73 61 62 6c 65 64 2e 20 57 68 65 6e n disabled. When
6fe0: 20 74 68 65 20 63 6f 6e 76 65 72 74 65 72 20 77 the converter w
6ff0: 61 73 20 72 75 6e 0a 09 20 20 20 20 23 20 6f 6e as run.. # on
7000: 20 74 68 65 20 54 63 6c 20 43 56 53 20 73 65 76 the Tcl CVS sev
7010: 65 72 61 6c 20 62 72 61 6e 63 68 65 73 20 74 72 eral branches tr
7020: 69 70 70 65 64 20 74 68 69 73 0a 09 20 20 20 20 ipped this..
7030: 23 20 63 6f 6e 73 74 72 61 69 6e 74 2e 20 4f 6e # constraint. On
7040: 65 20 6f 66 20 74 68 65 6d 20 77 61 73 20 61 20 e of them was a
7050: 66 72 65 65 2d 66 6c 6f 61 74 69 6e 67 20 62 72 free-floating br
7060: 61 6e 63 68 2c 20 61 6e 64 0a 09 20 20 20 20 23 anch, and.. #
7070: 20 69 74 73 20 68 61 6e 64 6c 69 6e 67 20 68 61 its handling ha
7080: 73 20 62 65 65 6e 20 66 69 78 65 64 20 62 79 20 s been fixed by
7090: 6e 6f 77 2e 20 54 68 65 20 6f 74 68 65 72 73 20 now. The others
70a0: 68 6f 77 65 76 65 72 0a 09 20 20 20 20 23 20 73 however.. # s
70b0: 65 65 6d 20 73 65 6d 69 2d 6c 65 67 69 74 69 6d eem semi-legitim
70c0: 61 74 65 2c 20 69 6e 20 74 68 65 20 73 65 6e 73 ate, in the sens
70d0: 65 20 74 68 61 74 20 74 68 65 79 20 73 68 6f 77 e that they show
70e0: 0a 09 20 20 20 20 23 20 69 6e 63 6f 6e 73 69 73 .. # inconsis
70f0: 74 65 6e 63 69 65 73 20 69 6e 20 74 68 65 20 43 tencies in the C
7100: 56 53 20 68 69 73 74 6f 72 79 20 74 68 65 20 75 VS history the u
7110: 73 65 72 20 69 73 20 6e 6f 74 0a 09 20 20 20 20 ser is not..
7120: 23 20 72 65 61 6c 6c 79 20 61 62 6c 65 20 74 6f # really able to
7130: 20 73 6f 6c 76 65 2c 20 62 75 74 20 69 74 20 6d solve, but it m
7140: 69 67 68 74 20 62 65 20 70 6f 73 73 69 62 6c 65 ight be possible
7150: 20 74 6f 20 73 69 6d 70 6c 79 0a 09 20 20 20 20 to simply..
7160: 23 20 69 67 6e 6f 72 65 20 74 68 65 6d 2e 0a 0a # ignore them...
7170: 09 20 20 20 20 23 20 46 6f 72 20 65 78 61 6d 70 . # For examp
7180: 6c 65 20 69 6e 20 54 63 6c 20 77 65 20 68 61 76 le in Tcl we hav
7190: 65 20 61 20 62 72 61 6e 63 68 20 58 20 77 69 74 e a branch X wit
71a0: 68 20 61 20 70 72 65 66 65 72 65 64 0a 09 20 20 h a prefered..
71b0: 20 20 23 20 70 61 72 65 6e 74 20 59 2c 20 65 78 # parent Y, ex
71c0: 63 65 70 74 20 66 6f 72 20 61 20 73 69 6e 67 6c cept for a singl
71d0: 65 20 66 69 6c 65 20 77 68 65 72 65 20 74 68 65 e file where the
71e0: 20 70 72 65 66 65 72 65 64 0a 09 20 20 20 20 23 prefered.. #
71f0: 20 70 61 72 65 6e 74 20 73 65 65 6d 73 20 74 6f parent seems to
7200: 20 62 65 20 63 72 65 61 74 65 64 20 61 66 74 65 be created afte
7210: 72 20 69 74 73 20 63 75 72 72 65 6e 74 20 70 61 r its current pa
7220: 72 65 6e 74 2c 0a 09 20 20 20 20 23 20 6d 61 6b rent,.. # mak
7230: 69 6e 67 20 72 65 2d 70 61 72 65 6e 74 69 6e 67 ing re-parenting
7240: 20 69 6d 70 6f 73 73 69 62 6c 65 2e 20 48 6f 77 impossible. How
7250: 65 76 65 72 20 77 65 20 6d 61 79 20 62 65 20 61 ever we may be a
7260: 62 6c 65 0a 09 20 20 20 20 23 20 74 6f 20 69 67 ble.. # to ig
7270: 6e 6f 72 65 20 74 68 69 73 2c 20 69 74 20 73 68 nore this, it sh
7280: 6f 75 6c 64 20 6f 6e 6c 79 20 63 61 75 73 65 20 ould only cause
7290: 74 68 65 20 62 72 61 6e 63 68 20 74 6f 20 68 61 the branch to ha
72a0: 76 65 0a 09 20 20 20 20 23 20 6d 6f 72 65 20 74 ve.. # more t
72b0: 68 61 6e 20 6f 6e 65 20 70 72 65 64 65 63 65 73 han one predeces
72c0: 73 6f 72 2c 20 61 6e 64 20 73 68 69 66 74 69 6e sor, and shiftin
72d0: 67 20 69 74 20 61 72 6f 75 6e 64 20 69 6e 20 74 g it around in t
72e0: 68 65 0a 09 20 20 20 20 23 20 63 6f 6d 6d 69 74 he.. # commit
72f0: 20 6f 72 64 65 72 2e 20 54 68 65 20 62 61 63 6b order. The back
7300: 65 6e 64 20 77 6f 75 6c 64 20 73 74 69 6c 6c 20 end would still
7310: 75 73 65 20 74 68 65 20 70 72 65 66 65 72 65 64 use the prefered
7320: 0a 09 20 20 20 20 23 20 70 61 72 65 6e 74 20 66 .. # parent f
7330: 6f 72 20 74 68 65 20 61 74 74 61 63 68 6d 65 6e or the attachmen
7340: 74 20 70 6f 69 6e 74 20 69 6e 20 66 6f 73 73 69 t point in fossi
7350: 6c 2e 0a 0a 09 20 20 20 20 23 20 53 6f 2c 20 66 l.... # So, f
7360: 6f 72 20 6e 6f 77 20 49 20 68 61 76 65 20 64 65 or now I have de
7370: 63 69 64 65 64 20 74 6f 20 64 69 73 61 62 6c 65 cided to disable
7380: 20 74 68 69 73 20 61 6e 64 20 70 72 65 73 73 0a this and press.
7390: 09 20 20 20 20 23 20 66 6f 72 77 61 72 64 2e 20 . # forward.
73a0: 4f 66 20 63 6f 75 72 73 65 2c 20 69 66 20 77 65 Of course, if we
73b0: 20 72 75 6e 20 69 6e 74 6f 20 61 63 74 75 61 6c run into actual
73c0: 20 74 72 6f 75 62 6c 65 20 77 65 0a 09 20 20 20 trouble we..
73d0: 20 23 20 77 69 6c 6c 20 68 61 76 65 20 74 6f 20 # will have to
73e0: 67 6f 20 62 61 63 6b 20 68 65 72 65 20 73 65 65 go back here see
73f0: 20 77 68 61 74 20 63 61 6e 20 62 65 20 64 6f 6e what can be don
7400: 65 20 74 6f 20 66 69 78 0a 09 20 20 20 20 23 20 e to fix.. #
7410: 74 68 69 73 2e 20 45 76 65 6e 20 69 66 20 6f 6e this. Even if on
7420: 6c 79 20 67 69 76 69 6e 67 20 74 68 65 20 75 73 ly giving the us
7430: 65 72 20 74 68 65 20 69 6e 73 74 72 75 63 74 69 er the instructi
7440: 6f 6e 20 68 6f 77 0a 09 20 20 20 20 23 20 74 6f on how.. # to
7450: 20 65 64 69 74 20 74 68 65 20 43 56 53 20 72 65 edit the CVS re
7460: 70 6f 73 69 74 6f 72 79 20 74 6f 20 72 65 6d 6f pository to remo
7470: 76 65 20 74 68 65 20 69 6e 63 6f 6e 73 69 73 74 ve the inconsist
7480: 65 6e 63 79 2e 0a 0a 09 20 20 20 20 23 20 41 6c ency.... # Al
7490: 6c 20 62 72 61 6e 63 68 65 73 20 68 61 76 65 20 l branches have
74a0: 74 6f 20 61 67 72 65 65 20 6f 6e 20 74 68 65 20 to agree on the
74b0: 4c 4f 44 20 74 68 65 69 72 20 63 68 61 6e 67 65 LOD their change
74c0: 73 65 74 0a 09 20 20 20 20 23 20 62 65 6c 6f 6e set.. # belon
74d0: 67 73 20 74 6f 2e 20 49 6e 20 6f 74 68 65 72 20 gs to. In other
74e0: 77 6f 72 64 73 2c 20 61 6c 6c 20 62 72 61 6e 63 words, all branc
74f0: 68 65 73 20 69 6e 20 61 20 63 68 61 6e 67 65 73 hes in a changes
7500: 65 74 0a 09 20 20 20 20 23 20 68 61 76 65 20 74 et.. # have t
7510: 6f 20 72 65 66 65 72 20 74 6f 20 74 68 65 20 73 o refer to the s
7520: 61 6d 65 20 6c 69 6e 65 20 6f 66 20 64 65 76 65 ame line of deve
7530: 6c 6f 70 6d 65 6e 74 2e 0a 09 20 20 20 20 23 0a lopment... #.
7540: 09 20 20 20 20 23 20 49 6e 73 74 65 61 64 20 6f . # Instead o
7550: 66 20 6c 6f 6f 6b 69 6e 67 20 61 74 20 61 6c 6c f looking at all
7560: 20 70 61 69 72 73 20 6f 66 20 62 72 61 6e 63 68 pairs of branch
7570: 65 73 20 69 6e 20 61 6c 6c 0a 09 20 20 20 20 23 es in all.. #
7580: 20 63 68 61 6e 67 65 73 65 74 73 20 77 65 20 67 changesets we g
7590: 65 6e 65 72 61 74 65 20 74 68 65 20 64 69 73 74 enerate the dist
75a0: 69 6e 63 74 20 73 65 74 20 6f 66 20 61 6c 6c 20 inct set of all
75b0: 4c 4f 44 73 0a 09 20 20 20 20 23 20 72 65 66 65 LODs.. # refe
75c0: 72 65 6e 63 65 64 20 62 79 20 74 68 65 20 62 72 renced by the br
75d0: 61 6e 63 68 65 73 20 6f 66 20 61 20 63 68 61 6e anches of a chan
75e0: 67 65 73 65 74 2c 20 6c 6f 6f 6b 20 66 6f 72 0a geset, look for.
75f0: 09 20 20 20 20 23 20 74 68 6f 73 65 20 77 69 74 . # those wit
7600: 68 20 63 61 72 64 69 6e 61 6c 69 74 79 20 3e 20 h cardinality >
7610: 31 2c 20 61 6e 64 20 67 65 74 20 74 68 65 20 69 1, and get the i
7620: 64 65 6e 74 69 66 79 69 6e 67 0a 09 20 20 20 20 dentifying..
7630: 23 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 66 6f # information fo
7640: 72 20 74 68 65 20 63 68 61 6e 67 65 73 65 74 73 r the changesets
7650: 20 66 6f 75 6e 64 20 74 68 75 73 6c 79 2e 0a 09 found thusly...
7660: 20 20 20 20 43 68 65 63 6b 43 53 20 5c 0a 09 09 CheckCS \...
7670: 7b 41 6c 6c 20 62 72 61 6e 63 68 65 73 20 69 6e {All branches in
7680: 20 61 20 63 68 61 6e 67 65 73 65 74 20 68 61 76 a changeset hav
7690: 65 20 74 6f 20 62 65 6c 6f 6e 67 20 74 6f 20 74 e to belong to t
76a0: 68 65 20 73 61 6d 65 20 4c 4f 44 7d 20 5c 0a 09 he same LOD} \..
76b0: 09 7b 3a 20 49 74 73 20 62 72 61 6e 63 68 65 73 .{: Its branches
76c0: 20 64 69 73 61 67 72 65 65 20 61 62 6f 75 74 20 disagree about
76d0: 74 68 65 20 4c 4f 44 20 74 68 65 79 20 62 65 6c the LOD they bel
76e0: 6f 6e 67 20 74 6f 7d 20 7b 0a 09 09 20 20 20 20 ong to} {...
76f0: 53 45 4c 45 43 54 20 54 2e 6e 61 6d 65 2c 20 43 SELECT T.name, C
7700: 2e 63 69 64 0a 09 09 20 20 20 20 46 52 4f 4d 20 .cid... FROM
7710: 20 20 63 68 61 6e 67 65 73 65 74 20 43 2c 20 63 changeset C, c
7720: 73 74 79 70 65 20 54 0a 09 09 20 20 20 20 57 48 stype T... WH
7730: 45 52 45 20 20 43 2e 63 69 64 20 49 4e 20 28 53 ERE C.cid IN (S
7740: 45 4c 45 43 54 20 55 2e 63 69 64 0a 09 09 09 09 ELECT U.cid.....
7750: 20 20 20 20 20 46 52 4f 4d 20 28 53 45 4c 45 43 FROM (SELEC
7760: 54 20 44 49 53 54 49 4e 43 54 20 43 49 2e 63 69 T DISTINCT CI.ci
7770: 64 20 41 53 20 63 69 64 2c 20 42 2e 6c 6f 64 20 d AS cid, B.lod
7780: 41 53 20 6c 6f 64 0a 09 09 09 09 09 20 20 20 46 AS lod...... F
7790: 52 4f 4d 20 20 20 63 73 69 74 65 6d 20 43 49 2c ROM csitem CI,
77a0: 20 63 68 61 6e 67 65 73 65 74 20 43 2c 20 62 72 changeset C, br
77b0: 61 6e 63 68 20 42 0a 09 09 09 09 09 20 20 20 57 anch B...... W
77c0: 48 45 52 45 20 20 43 49 2e 69 69 64 20 3d 20 42 HERE CI.iid = B
77d0: 2e 62 69 64 0a 09 09 09 09 09 20 20 20 41 4e 44 .bid...... AND
77e0: 20 20 20 20 43 2e 63 69 64 20 3d 20 43 49 2e 63 C.cid = CI.c
77f0: 69 64 0a 09 09 09 09 09 20 20 20 41 4e 44 20 20 id...... AND
7800: 20 20 43 2e 74 79 70 65 20 3d 20 32 29 20 41 53 C.type = 2) AS
7810: 20 55 0a 09 09 09 09 20 20 20 20 20 47 52 4f 55 U..... GROU
7820: 50 20 42 59 20 55 2e 63 69 64 20 48 41 56 49 4e P BY U.cid HAVIN
7830: 47 20 43 4f 55 4e 54 28 55 2e 6c 6f 64 29 20 3e G COUNT(U.lod) >
7840: 20 31 29 0a 09 09 20 20 20 20 41 4e 44 20 20 20 1)... AND
7850: 20 54 2e 74 69 64 20 3d 20 43 2e 74 79 70 65 0a T.tid = C.type.
7860: 09 09 7d 0a 09 7d 0a 09 23 20 41 6c 6c 20 62 72 ..}..}..# All br
7870: 61 6e 63 68 65 73 20 68 61 76 65 20 74 6f 20 61 anches have to a
7880: 67 72 65 65 20 6f 6e 20 74 68 65 20 70 72 6f 6a gree on the proj
7890: 65 63 74 20 74 68 65 69 72 20 63 68 61 6e 67 65 ect their change
78a0: 73 65 74 0a 09 23 20 62 65 6c 6f 6e 67 73 20 74 set..# belongs t
78b0: 6f 2e 20 49 6e 20 6f 74 68 65 72 20 77 6f 72 64 o. In other word
78c0: 73 2c 20 61 6c 6c 20 62 72 61 6e 63 68 65 73 20 s, all branches
78d0: 69 6e 20 61 20 63 68 61 6e 67 65 73 65 74 20 68 in a changeset h
78e0: 61 76 65 0a 09 23 20 74 6f 20 72 65 66 65 72 20 ave..# to refer
78f0: 74 6f 20 74 68 65 20 73 61 6d 65 20 70 72 6f 6a to the same proj
7900: 65 63 74 2e 0a 09 23 0a 09 23 20 49 6e 73 74 65 ect...#..# Inste
7910: 61 64 20 6f 66 20 6c 6f 6f 6b 69 6e 67 20 61 74 ad of looking at
7920: 20 61 6c 6c 20 70 61 69 72 73 20 6f 66 20 62 72 all pairs of br
7930: 61 6e 63 68 65 73 20 69 6e 20 61 6c 6c 0a 09 23 anches in all..#
7940: 20 63 68 61 6e 67 65 73 65 74 73 20 77 65 20 67 changesets we g
7950: 65 6e 65 72 61 74 65 20 74 68 65 20 64 69 73 74 enerate the dist
7960: 69 6e 63 74 20 73 65 74 20 6f 66 20 61 6c 6c 20 inct set of all
7970: 70 72 6f 6a 65 63 74 73 0a 09 23 20 72 65 66 65 projects..# refe
7980: 72 65 6e 63 65 64 20 62 79 20 74 68 65 20 62 72 renced by the br
7990: 61 6e 63 68 65 73 20 6f 66 20 61 20 63 68 61 6e anches of a chan
79a0: 67 65 73 65 74 2c 20 6c 6f 6f 6b 20 66 6f 72 20 geset, look for
79b0: 74 68 6f 73 65 0a 09 23 20 77 69 74 68 20 63 61 those..# with ca
79c0: 72 64 69 6e 61 6c 69 74 79 20 3e 20 31 2c 20 61 rdinality > 1, a
79d0: 6e 64 20 67 65 74 20 74 68 65 20 69 64 65 6e 74 nd get the ident
79e0: 69 66 79 69 6e 67 20 69 6e 66 6f 72 6d 61 74 69 ifying informati
79f0: 6f 6e 0a 09 23 20 66 6f 72 20 74 68 65 20 63 68 on..# for the ch
7a00: 61 6e 67 65 73 65 74 73 20 66 6f 75 6e 64 20 74 angesets found t
7a10: 68 75 73 6c 79 2e 0a 09 43 68 65 63 6b 43 53 20 husly...CheckCS
7a20: 5c 0a 09 20 20 20 20 7b 41 6c 6c 20 62 72 61 6e \.. {All bran
7a30: 63 68 65 73 20 69 6e 20 61 20 63 68 61 6e 67 65 ches in a change
7a40: 73 65 74 20 68 61 76 65 20 74 6f 20 62 65 6c 6f set have to belo
7a50: 6e 67 20 74 6f 20 74 68 65 20 73 61 6d 65 20 70 ng to the same p
7a60: 72 6f 6a 65 63 74 7d 20 5c 0a 09 20 20 20 20 7b roject} \.. {
7a70: 3a 20 49 74 73 20 62 72 61 6e 63 68 65 73 20 64 : Its branches d
7a80: 69 73 61 67 72 65 65 20 61 62 6f 75 74 20 74 68 isagree about th
7a90: 65 20 70 72 6f 6a 65 63 74 20 74 68 65 79 20 62 e project they b
7aa0: 65 6c 6f 6e 67 20 74 6f 7d 20 7b 0a 09 09 53 45 elong to} {...SE
7ab0: 4c 45 43 54 20 54 2e 6e 61 6d 65 2c 20 43 2e 63 LECT T.name, C.c
7ac0: 69 64 0a 09 09 46 52 4f 4d 20 20 20 63 68 61 6e id...FROM chan
7ad0: 67 65 73 65 74 20 43 2c 20 63 73 74 79 70 65 20 geset C, cstype
7ae0: 54 0a 09 09 57 48 45 52 45 20 20 43 2e 63 69 64 T...WHERE C.cid
7af0: 20 49 4e 20 28 53 45 4c 45 43 54 20 55 2e 63 69 IN (SELECT U.ci
7b00: 64 0a 09 09 09 09 20 46 52 4f 4d 20 28 53 45 4c d..... FROM (SEL
7b10: 45 43 54 20 44 49 53 54 49 4e 43 54 20 20 20 20 ECT DISTINCT
7b20: 20 20 20 20 2d 2d 20 55 6e 69 71 75 65 20 63 73 -- Unique cs
7b30: 65 74 2f 70 72 6f 6a 20 70 61 69 72 73 0a 09 09 et/proj pairs...
7b40: 09 09 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
7b50: 43 49 2e 63 69 64 20 41 53 20 63 69 64 2c 20 20 CI.cid AS cid,
7b60: 2d 2d 20 42 72 61 6e 63 68 20 63 73 65 74 0a 09 -- Branch cset..
7b70: 09 09 09 20 20 20 20 20 20 20 20 20 20 20 20 20 ...
7b80: 20 46 2e 70 69 64 20 20 41 53 20 70 69 64 20 20 F.pid AS pid
7b90: 20 2d 2d 20 50 72 6f 6a 65 63 74 20 6f 66 20 69 -- Project of i
7ba0: 74 65 6d 20 69 6e 20 63 73 65 74 0a 09 09 09 09 tem in cset.....
7bb0: 20 20 20 20 20 20 20 46 52 4f 4d 20 20 20 63 73 FROM cs
7bc0: 69 74 65 6d 20 43 49 2c 20 63 68 61 6e 67 65 73 item CI, changes
7bd0: 65 74 20 43 2c 20 62 72 61 6e 63 68 20 42 2c 20 et C, branch B,
7be0: 66 69 6c 65 20 46 0a 09 09 09 09 20 20 20 20 20 file F.....
7bf0: 20 20 57 48 45 52 45 20 20 43 49 2e 69 69 64 20 WHERE CI.iid
7c00: 3d 20 42 2e 62 69 64 20 20 2d 2d 20 67 65 74 20 = B.bid -- get
7c10: 62 72 61 6e 63 68 20 6f 66 20 69 74 65 6d 20 69 branch of item i
7c20: 6e 20 63 73 65 74 0a 09 09 09 09 20 20 20 20 20 n cset.....
7c30: 20 20 41 4e 44 20 20 20 20 43 2e 63 69 64 20 20 AND C.cid
7c40: 3d 20 43 49 2e 63 69 64 20 2d 2d 20 67 65 74 20 = CI.cid -- get
7c50: 63 68 61 6e 67 65 73 65 74 20 6f 66 20 69 74 65 changeset of ite
7c60: 6d 0a 09 09 09 09 20 20 20 20 20 20 20 41 4e 44 m..... AND
7c70: 20 20 20 20 43 2e 74 79 70 65 20 3d 20 32 20 20 C.type = 2
7c80: 20 20 20 20 2d 2d 20 6c 69 6d 69 74 20 74 6f 20 -- limit to
7c90: 62 72 61 6e 63 68 20 63 68 61 6e 67 65 73 65 74 branch changeset
7ca0: 73 0a 09 09 09 09 20 20 20 20 20 20 20 41 4e 44 s..... AND
7cb0: 20 20 20 20 46 2e 66 69 64 20 20 3d 20 42 2e 66 F.fid = B.f
7cc0: 69 64 20 20 2d 2d 20 67 65 74 20 66 69 6c 65 20 id -- get file
7cd0: 6f 66 20 62 72 61 6e 63 68 0a 20 20 20 20 20 20 of branch.
7ce0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
7cf0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
7d00: 29 20 41 53 20 55 0a 09 09 09 09 20 47 52 4f 55 ) AS U..... GROU
7d10: 50 20 42 59 20 55 2e 63 69 64 20 20 20 20 20 20 P BY U.cid
7d20: 20 20 20 20 2d 2d 20 61 67 67 72 65 67 61 74 65 -- aggregate
7d30: 20 62 79 20 63 73 65 74 73 2c 20 63 6f 75 6e 74 by csets, count
7d40: 20 70 72 6f 6a 2f 63 73 65 74 0a 09 09 09 09 20 proj/cset.....
7d50: 48 41 56 49 4e 47 20 43 4f 55 4e 54 28 55 2e 70 HAVING COUNT(U.p
7d60: 69 64 29 20 3e 20 31 20 2d 2d 20 66 69 6e 64 20 id) > 1 -- find
7d70: 63 73 65 74 20 77 69 74 68 20 6d 75 6c 74 69 70 cset with multip
7d80: 6c 65 20 70 72 6f 6a 65 63 74 73 0a 09 09 09 09 le projects.....
7d90: 29 0a 09 09 41 4e 44 20 20 20 20 54 2e 74 69 64 )...AND T.tid
7da0: 20 3d 20 43 2e 74 79 70 65 20 2d 2d 20 67 65 74 = C.type -- get
7db0: 20 72 65 61 64 61 62 6c 65 20 63 68 61 6e 67 65 readable change
7dc0: 73 65 74 20 74 79 70 65 0a 09 20 20 20 20 7d 0a set type.. }.
7dd0: 09 23 20 41 6c 6c 20 62 72 61 6e 63 68 65 73 20 .# All branches
7de0: 69 6e 20 61 20 73 69 6e 67 6c 65 20 63 68 61 6e in a single chan
7df0: 67 65 73 65 74 20 68 61 76 65 20 74 6f 20 62 65 geset have to be
7e00: 6c 6f 6e 67 20 74 6f 0a 09 23 20 64 69 66 66 65 long to..# diffe
7e10: 72 65 6e 74 20 66 69 6c 65 73 2e 20 43 6f 6e 76 rent files. Conv
7e20: 65 72 73 65 6c 79 3a 20 4e 6f 20 74 77 6f 20 62 ersely: No two b
7e30: 72 61 6e 63 68 65 73 20 6f 66 20 61 20 73 69 6e ranches of a sin
7e40: 67 6c 65 0a 09 23 20 66 69 6c 65 20 61 72 65 20 gle..# file are
7e50: 61 6c 6c 6f 77 65 64 20 74 6f 20 62 65 20 69 6e allowed to be in
7e60: 20 74 68 65 20 73 61 6d 65 20 63 68 61 6e 67 65 the same change
7e70: 73 65 74 2e 0a 09 23 0a 09 23 20 49 6e 73 74 65 set...#..# Inste
7e80: 61 64 20 6f 66 20 6c 6f 6f 6b 69 6e 67 20 61 74 ad of looking at
7e90: 20 61 6c 6c 20 70 61 69 72 73 20 6f 66 20 62 72 all pairs of br
7ea0: 61 6e 63 68 65 73 20 69 6e 20 61 6c 6c 0a 09 23 anches in all..#
7eb0: 20 63 68 61 6e 67 65 73 65 74 73 20 77 65 20 67 changesets we g
7ec0: 65 6e 65 72 61 74 65 20 74 68 65 20 64 69 73 74 enerate the dist
7ed0: 69 6e 63 74 20 73 65 74 20 6f 66 20 61 6c 6c 20 inct set of all
7ee0: 66 69 6c 65 73 0a 09 23 20 72 65 66 65 72 65 6e files..# referen
7ef0: 63 65 64 20 62 79 20 74 68 65 20 62 72 61 6e 63 ced by the branc
7f00: 68 65 73 20 6f 66 20 61 20 63 68 61 6e 67 65 73 hes of a changes
7f10: 65 74 2c 20 61 6e 64 20 6c 6f 6f 6b 20 66 6f 72 et, and look for
7f20: 0a 09 23 20 74 68 6f 73 65 20 77 69 74 68 20 63 ..# those with c
7f30: 61 72 64 69 6e 61 6c 69 74 79 20 3c 20 74 68 65 ardinality < the
7f40: 20 63 61 72 64 69 6e 61 6c 69 74 79 20 6f 66 20 cardinality of
7f50: 74 68 65 20 73 65 74 20 6f 66 0a 09 23 20 62 72 the set of..# br
7f60: 61 6e 63 68 65 73 2c 20 61 6e 64 20 67 65 74 20 anches, and get
7f70: 74 68 65 20 69 64 65 6e 74 69 66 79 69 6e 67 20 the identifying
7f80: 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 66 6f 72 20 information for
7f90: 74 68 65 0a 09 23 20 63 68 61 6e 67 65 73 65 74 the..# changeset
7fa0: 73 20 66 6f 75 6e 64 20 74 68 75 73 6c 79 2e 0a s found thusly..
7fb0: 09 43 68 65 63 6b 43 53 20 5c 0a 09 20 20 20 20 .CheckCS \..
7fc0: 7b 41 6c 6c 20 62 72 61 6e 63 68 65 73 20 69 6e {All branches in
7fd0: 20 61 20 63 68 61 6e 67 65 73 65 74 20 68 61 76 a changeset hav
7fe0: 65 20 74 6f 20 62 65 6c 6f 6e 67 20 74 6f 20 64 e to belong to d
7ff0: 69 66 66 65 72 65 6e 74 20 66 69 6c 65 73 7d 20 ifferent files}
8000: 5c 0a 09 20 20 20 20 7b 3a 20 49 74 73 20 62 72 \.. {: Its br
8010: 61 6e 63 68 65 73 20 73 68 61 72 65 20 66 69 6c anches share fil
8020: 65 73 7d 20 7b 0a 09 09 53 45 4c 45 43 54 20 54 es} {...SELECT T
8030: 2e 6e 61 6d 65 2c 20 43 2e 63 69 64 0a 09 09 46 .name, C.cid...F
8040: 52 4f 4d 20 20 20 63 68 61 6e 67 65 73 65 74 20 ROM changeset
8050: 43 2c 20 63 73 74 79 70 65 20 54 0a 09 09 57 48 C, cstype T...WH
8060: 45 52 45 20 20 43 2e 63 69 64 20 49 4e 20 28 53 ERE C.cid IN (S
8070: 45 4c 45 43 54 20 56 56 2e 63 69 64 0a 09 09 09 ELECT VV.cid....
8080: 09 20 46 52 4f 4d 20 28 53 45 4c 45 43 54 20 55 . FROM (SELECT U
8090: 2e 63 69 64 20 20 20 20 20 20 20 20 20 41 53 20 .cid AS
80a0: 63 69 64 2c 20 20 20 2d 2d 20 63 68 61 6e 67 65 cid, -- change
80b0: 73 65 74 0a 09 09 09 09 20 20 20 20 20 20 20 20 set.....
80c0: 20 20 20 20 20 20 43 4f 55 4e 54 20 28 55 2e 66 COUNT (U.f
80d0: 69 64 29 20 41 53 20 66 63 6f 75 6e 74 20 2d 2d id) AS fcount --
80e0: 20 6e 75 6d 62 65 72 20 6f 66 20 66 69 6c 65 73 number of files
80f0: 20 62 79 20 69 74 65 6d 73 0a 09 09 09 09 20 20 by items.....
8100: 20 20 20 20 20 46 52 4f 4d 20 28 53 45 4c 45 43 FROM (SELEC
8110: 54 20 44 49 53 54 49 4e 43 54 20 20 20 20 20 20 T DISTINCT
8120: 20 2d 2d 20 75 6e 69 71 75 65 20 63 73 65 74 2f -- unique cset/
8130: 66 69 6c 65 20 70 61 69 72 73 0a 09 09 09 09 09 file pairs......
8140: 20 20 20 20 20 20 20 20 20 20 20 20 43 49 2e 63 CI.c
8150: 69 64 20 41 53 20 63 69 64 2c 20 2d 2d 20 42 72 id AS cid, -- Br
8160: 61 6e 63 68 20 63 68 61 6e 67 65 73 65 74 0a 09 anch changeset..
8170: 09 09 09 09 20 20 20 20 20 20 20 20 20 20 20 20 ....
8180: 42 2e 66 69 64 20 20 41 53 20 66 69 64 20 20 2d B.fid AS fid -
8190: 2d 20 46 69 6c 65 20 6f 66 20 69 74 65 6d 20 69 - File of item i
81a0: 6e 20 63 68 61 6e 67 65 73 65 74 0a 09 09 09 09 n changeset.....
81b0: 09 20 20 20 20 20 46 52 4f 4d 20 20 20 63 73 69 . FROM csi
81c0: 74 65 6d 20 43 49 2c 20 63 68 61 6e 67 65 73 65 tem CI, changese
81d0: 74 20 43 2c 20 62 72 61 6e 63 68 20 42 0a 09 09 t C, branch B...
81e0: 09 09 09 20 20 20 20 20 57 48 45 52 45 20 20 43 ... WHERE C
81f0: 49 2e 69 69 64 20 3d 20 42 2e 62 69 64 20 20 2d I.iid = B.bid -
8200: 2d 20 67 65 74 20 74 61 67 20 6f 66 20 69 74 65 - get tag of ite
8210: 6d 20 69 6e 20 63 68 61 6e 67 65 73 65 74 0a 09 m in changeset..
8220: 09 09 09 09 20 20 20 20 20 41 4e 44 20 20 20 20 .... AND
8230: 43 2e 63 69 64 20 20 3d 20 43 49 2e 63 69 64 20 C.cid = CI.cid
8240: 2d 2d 20 67 65 74 20 63 68 61 6e 67 65 73 65 74 -- get changeset
8250: 20 6f 66 20 69 74 65 6d 0a 09 09 09 09 09 20 20 of item......
8260: 20 20 20 41 4e 44 20 20 20 20 43 2e 74 79 70 65 AND C.type
8270: 20 3d 20 32 20 20 20 20 20 20 2d 2d 20 6c 69 6d = 2 -- lim
8280: 69 74 20 74 6f 20 62 72 61 6e 63 68 20 63 68 61 it to branch cha
8290: 6e 67 65 73 65 74 73 0a 09 09 09 09 09 20 20 20 ngesets......
82a0: 20 20 29 20 41 53 20 55 0a 09 09 09 09 20 20 20 ) AS U.....
82b0: 20 20 20 20 47 52 4f 55 50 20 42 59 20 55 2e 63 GROUP BY U.c
82c0: 69 64 20 2d 2d 20 61 67 67 72 65 67 61 74 65 20 id -- aggregate
82d0: 62 79 20 63 73 65 74 73 2c 20 63 6f 75 6e 74 20 by csets, count
82e0: 66 69 6c 65 73 2f 63 73 65 74 0a 09 09 09 09 20 files/cset.....
82f0: 20 20 20 20 20 29 20 41 53 20 55 55 2c 0a 09 09 ) AS UU,...
8300: 09 09 20 20 20 20 20 20 28 53 45 4c 45 43 54 20 .. (SELECT
8310: 56 2e 63 69 64 20 20 20 20 20 20 20 20 20 41 53 V.cid AS
8320: 20 63 69 64 2c 20 20 20 2d 2d 20 63 68 61 6e 67 cid, -- chang
8330: 65 73 65 74 0a 09 09 09 09 20 20 20 20 20 20 20 eset.....
8340: 20 20 20 20 20 20 20 43 4f 55 4e 54 20 28 56 2e COUNT (V.
8350: 69 69 64 29 20 41 53 20 72 63 6f 75 6e 74 20 2d iid) AS rcount -
8360: 2d 20 6e 75 6d 62 65 72 20 6f 66 20 69 74 65 6d - number of item
8370: 73 20 69 6e 20 63 73 65 74 0a 09 09 09 09 20 20 s in cset.....
8380: 20 20 20 20 20 46 52 4f 4d 20 20 20 63 73 69 74 FROM csit
8390: 65 6d 20 56 2c 20 63 68 61 6e 67 65 73 65 74 20 em V, changeset
83a0: 58 0a 09 09 09 09 20 20 20 20 20 20 20 57 48 45 X..... WHE
83b0: 52 45 20 20 58 2e 63 69 64 20 20 3d 20 56 2e 63 RE X.cid = V.c
83c0: 69 64 20 2d 2d 20 67 65 74 20 63 68 61 6e 67 65 id -- get change
83d0: 73 65 74 20 6f 66 20 69 74 65 6d 0a 09 09 09 09 set of item.....
83e0: 20 20 20 20 20 20 20 41 4e 44 20 20 20 20 58 2e AND X.
83f0: 74 79 70 65 20 3d 20 32 20 20 20 20 20 2d 2d 20 type = 2 --
8400: 6c 69 6d 69 74 20 74 6f 20 62 72 61 6e 63 68 20 limit to branch
8410: 63 68 61 6e 67 65 73 65 74 73 0a 09 09 09 09 20 changesets.....
8420: 20 20 20 20 20 20 47 52 4f 55 50 20 42 59 20 56 GROUP BY V
8430: 2e 63 69 64 09 20 20 20 20 20 2d 2d 20 61 67 67 .cid. -- agg
8440: 72 65 67 61 74 65 20 62 79 20 63 73 65 74 73 2c regate by csets,
8450: 20 63 6f 75 6e 74 20 69 74 65 6d 73 2f 63 73 65 count items/cse
8460: 74 0a 09 09 09 09 20 20 20 20 20 20 29 20 41 53 t..... ) AS
8470: 20 56 56 0a 09 09 09 09 20 57 48 45 52 45 20 56 VV..... WHERE V
8480: 56 2e 63 69 64 20 3d 20 55 55 2e 63 69 64 20 20 V.cid = UU.cid
8490: 20 20 20 20 20 2d 2d 20 73 79 6e 63 20 23 69 74 -- sync #it
84a0: 65 6d 73 2f 63 73 65 74 20 77 69 74 68 20 23 66 ems/cset with #f
84b0: 69 6c 65 73 2f 63 73 65 74 0a 09 09 09 09 20 41 iles/cset..... A
84c0: 4e 44 20 20 20 55 55 2e 66 63 6f 75 6e 74 20 3c ND UU.fcount <
84d0: 20 56 56 2e 72 63 6f 75 6e 74 20 2d 2d 20 6c 65 VV.rcount -- le
84e0: 73 73 20 66 69 6c 65 73 20 74 68 61 6e 20 69 74 ss files than it
84f0: 65 6d 73 0a 09 09 09 09 09 09 09 20 20 20 20 20 ems........
8500: 2d 2d 20 3d 3e 20 69 74 65 6d 73 20 62 65 6c 6f -- => items belo
8510: 6e 67 20 74 6f 20 74 68 65 20 73 61 6d 65 20 66 ng to the same f
8520: 69 6c 65 2e 0a 09 09 09 09 29 0a 09 09 41 4e 44 ile......)...AND
8530: 20 20 20 20 54 2e 74 69 64 20 3d 20 43 2e 74 79 T.tid = C.ty
8540: 70 65 20 2d 2d 20 67 65 74 20 72 65 61 64 61 62 pe -- get readab
8550: 6c 65 20 63 68 61 6e 67 65 73 65 74 20 74 79 70 le changeset typ
8560: 65 0a 09 20 20 20 20 7d 0a 09 72 65 74 75 72 6e e.. }..return
8570: 0a 20 20 20 20 7d 0a 0a 20 20 20 20 70 72 6f 63 . }.. proc
8580: 20 5f 5f 5f 55 6e 75 73 65 64 43 68 61 6e 67 65 ___UnusedChange
8590: 73 65 74 43 68 65 63 6b 73 5f 5f 5f 20 7b 7d 20 setChecks___ {}
85a0: 7b 0a 09 23 20 54 68 69 73 20 63 6f 64 65 20 70 {..# This code p
85b0: 65 72 66 6f 72 6d 73 20 61 20 6e 75 6d 62 65 72 erforms a number
85c0: 20 6f 66 20 70 61 72 61 6e 6f 69 64 20 63 68 65 of paranoid che
85d0: 63 6b 73 20 6f 66 20 74 68 65 0a 09 23 20 64 61 cks of the..# da
85e0: 74 61 62 61 73 65 2c 20 73 65 61 72 63 68 69 6e tabase, searchin
85f0: 67 20 66 6f 72 20 69 6e 63 6f 6e 73 69 73 74 65 g for inconsiste
8600: 6e 74 20 63 68 61 6e 67 65 73 65 74 2f 72 65 76 nt changeset/rev
8610: 69 73 69 6f 6e 0a 09 23 20 69 6e 66 6f 72 6d 61 ision..# informa
8620: 74 69 6f 6e 2e 0a 0a 09 72 65 74 75 72 6e 20 3b tion....return ;
8630: 20 23 20 44 69 73 61 62 6c 65 64 20 66 6f 72 20 # Disabled for
8640: 6e 6f 77 2c 20 62 6f 74 74 6c 65 6e 65 63 6b 73 now, bottlenecks
8650: 20 2e 2e 2e 0a 0a 09 75 70 76 61 72 20 31 20 6e ......upvar 1 n
8660: 20 6e 20 3b 20 23 20 43 6f 75 6e 74 65 72 20 66 n ; # Counter f
8670: 6f 72 20 74 68 65 20 63 68 65 63 6b 73 20 28 77 or the checks (w
8680: 65 20 70 72 69 6e 74 20 61 6e 20 69 64 20 62 65 e print an id be
8690: 66 6f 72 65 0a 09 09 20 20 20 20 20 20 23 20 74 fore... # t
86a0: 68 65 20 6d 61 69 6e 20 6c 61 62 65 6c 29 2e 0a he main label)..
86b0: 0a 09 23 20 54 68 65 20 6e 65 78 74 20 74 77 6f ..# The next two
86c0: 20 63 68 65 63 6b 73 20 61 72 65 20 42 4f 54 54 checks are BOTT
86d0: 4c 45 4e 45 43 4b 53 2e 20 49 6e 20 65 73 73 65 LENECKS. In esse
86e0: 6e 63 65 20 77 65 20 61 72 65 0a 09 23 20 63 68 nce we are..# ch
86f0: 65 63 6b 69 6e 67 20 65 61 63 68 20 73 79 6d 62 ecking each symb
8700: 6f 6c 20 63 68 61 6e 67 65 73 65 74 20 6f 6e 65 ol changeset one
8710: 20 62 79 20 6f 6e 65 2e 0a 0a 09 23 20 54 4f 44 by one....# TOD
8720: 4f 3a 20 54 72 79 20 74 6f 20 72 65 70 68 72 61 O: Try to rephra
8730: 73 65 20 74 68 65 20 63 68 65 63 6b 73 20 74 6f se the checks to
8740: 20 6d 61 6b 65 20 6d 6f 72 65 20 75 73 65 20 6f make more use o
8750: 66 0a 09 23 20 69 6e 64 69 63 65 73 2c 20 73 65 f..# indices, se
8760: 74 20 61 6e 64 20 73 74 72 65 61 6d 20 6f 70 65 t and stream ope
8770: 72 61 74 69 6f 6e 73 2e 0a 0a 09 23 20 41 6c 6c rations....# All
8780: 20 72 65 76 69 73 69 6f 6e 73 20 75 73 65 64 20 revisions used
8790: 62 79 20 74 61 67 20 73 79 6d 62 6f 6c 20 63 68 by tag symbol ch
87a0: 61 6e 67 65 73 65 74 73 20 68 61 76 65 20 74 6f angesets have to
87b0: 20 68 61 76 65 20 74 68 65 0a 09 23 20 63 68 61 have the..# cha
87c0: 6e 67 65 73 65 74 27 73 20 74 61 67 20 61 73 73 ngeset's tag ass
87d0: 6f 63 69 61 74 65 64 20 77 69 74 68 20 74 68 65 ociated with the
87e0: 6d 2e 0a 09 43 68 65 63 6b 52 65 76 43 53 20 5c m...CheckRevCS \
87f0: 0a 09 20 20 20 20 7b 41 6c 6c 20 72 65 76 69 73 .. {All revis
8800: 69 6f 6e 73 20 75 73 65 64 20 62 79 20 74 61 67 ions used by tag
8810: 20 73 79 6d 62 6f 6c 20 63 68 61 6e 67 65 73 65 symbol changese
8820: 74 73 20 68 61 76 65 20 74 6f 20 68 61 76 65 20 ts have to have
8830: 74 68 65 20 63 68 61 6e 67 65 73 65 74 27 73 20 the changeset's
8840: 74 61 67 20 61 74 74 61 63 68 65 64 20 74 6f 20 tag attached to
8850: 74 68 65 6d 7d 20 5c 0a 09 20 20 20 20 7b 64 6f them} \.. {do
8860: 65 73 20 6e 6f 74 20 68 61 76 65 20 74 68 65 20 es not have the
8870: 74 61 67 20 6f 66 20 69 74 73 20 73 79 6d 62 6f tag of its symbo
8880: 6c 20 63 68 61 6e 67 65 73 65 74 20 40 20 61 74 l changeset @ at
8890: 74 61 63 68 65 64 20 74 6f 20 69 74 7d 20 7b 0a tached to it} {.
88a0: 09 09 53 45 4c 45 43 54 20 43 54 2e 6e 61 6d 65 ..SELECT CT.name
88b0: 2c 20 43 2e 63 69 64 2c 20 46 2e 6e 61 6d 65 2c , C.cid, F.name,
88c0: 20 52 2e 72 65 76 0a 09 09 46 52 4f 4d 20 20 20 R.rev...FROM
88d0: 63 68 61 6e 67 65 73 65 74 20 43 2c 20 63 73 74 changeset C, cst
88e0: 79 70 65 20 43 54 2c 20 72 65 76 69 73 69 6f 6e ype CT, revision
88f0: 20 52 2c 20 66 69 6c 65 20 46 2c 20 63 73 69 74 R, file F, csit
8900: 65 6d 20 43 49 2c 20 74 61 67 20 54 0a 09 09 57 em CI, tag T...W
8910: 48 45 52 45 20 20 43 2e 74 79 70 65 20 3d 20 31 HERE C.type = 1
8920: 20 20 20 20 20 20 20 2d 2d 20 73 79 6d 62 6f 6c -- symbol
8930: 20 63 68 61 6e 67 65 73 65 74 73 20 6f 6e 6c 79 changesets only
8940: 0a 09 09 41 4e 44 20 20 20 20 43 2e 73 72 63 20 ...AND C.src
8950: 20 3d 20 54 2e 73 69 64 20 20 20 2d 2d 20 74 61 = T.sid -- ta
8960: 67 20 6f 6e 6c 79 2c 20 6c 69 6e 6b 65 64 20 62 g only, linked b
8970: 79 20 73 79 6d 62 6f 6c 20 69 64 0a 09 09 41 4e y symbol id...AN
8980: 44 20 20 20 20 43 2e 63 69 64 20 20 3d 20 43 49 D C.cid = CI
8990: 2e 63 69 64 20 20 2d 2d 20 63 68 61 6e 67 65 73 .cid -- changes
89a0: 65 74 20 2d 2d 3e 20 69 74 73 20 72 65 76 69 73 et --> its revis
89b0: 69 6f 6e 73 0a 09 09 41 4e 44 20 20 20 20 52 2e ions...AND R.
89c0: 72 69 64 20 20 3d 20 43 49 2e 69 69 64 20 20 2d rid = CI.iid -
89d0: 2d 20 6c 6f 6f 6b 20 61 74 20 74 68 65 20 72 65 - look at the re
89e0: 76 69 73 69 6f 6e 73 0a 09 09 2d 2d 20 61 6e 64 visions...-- and
89f0: 20 6c 6f 6f 6b 20 66 6f 72 20 74 68 65 20 74 61 look for the ta
8a00: 67 20 61 6d 6f 6e 67 20 74 68 65 20 61 74 74 61 g among the atta
8a10: 63 68 65 64 20 6f 6e 65 73 2e 0a 09 09 41 4e 44 ched ones....AND
8a20: 20 20 20 20 54 2e 73 69 64 20 4e 4f 54 20 49 4e T.sid NOT IN
8a30: 20 28 53 45 4c 45 43 54 20 54 42 2e 73 69 64 0a (SELECT TB.sid.
8a40: 09 09 09 09 20 20 20 20 20 46 52 4f 4d 20 20 20 .... FROM
8a50: 74 61 67 20 54 42 0a 09 09 09 09 20 20 20 20 20 tag TB.....
8a60: 57 48 45 52 45 20 20 54 42 2e 72 65 76 20 3d 20 WHERE TB.rev =
8a70: 52 2e 72 69 64 29 0a 09 09 41 4e 44 20 20 20 20 R.rid)...AND
8a80: 52 2e 66 69 64 20 3d 20 46 2e 66 69 64 20 20 20 R.fid = F.fid
8a90: 20 2d 2d 20 67 65 74 20 66 69 6c 65 20 6f 66 20 -- get file of
8aa0: 72 65 76 69 73 69 6f 6e 0a 09 20 20 20 20 7d 0a revision.. }.
8ab0: 0a 09 23 20 41 6c 6c 20 72 65 76 69 73 69 6f 6e ..# All revision
8ac0: 73 20 75 73 65 64 20 62 79 20 62 72 61 6e 63 68 s used by branch
8ad0: 20 73 79 6d 62 6f 6c 20 63 68 61 6e 67 65 73 65 symbol changese
8ae0: 74 73 20 68 61 76 65 20 74 6f 20 68 61 76 65 0a ts have to have.
8af0: 09 23 20 74 68 65 20 63 68 61 6e 67 65 73 65 74 .# the changeset
8b00: 27 73 20 62 72 61 6e 63 68 20 61 73 73 6f 63 69 's branch associ
8b10: 61 74 65 64 20 77 69 74 68 20 74 68 65 6d 2e 0a ated with them..
8b20: 0a 09 43 68 65 63 6b 52 65 76 43 53 20 5c 0a 09 ..CheckRevCS \..
8b30: 20 20 20 20 7b 41 6c 6c 20 72 65 76 69 73 69 6f {All revisio
8b40: 6e 73 20 75 73 65 64 20 62 79 20 62 72 61 6e 63 ns used by branc
8b50: 68 20 73 79 6d 62 6f 6c 20 63 68 61 6e 67 65 73 h symbol changes
8b60: 65 74 73 20 68 61 76 65 20 74 6f 20 68 61 76 65 ets have to have
8b70: 20 74 68 65 20 63 68 61 6e 67 65 73 65 74 27 73 the changeset's
8b80: 20 62 72 61 6e 63 68 20 61 74 74 61 63 68 65 64 branch attached
8b90: 20 74 6f 20 74 68 65 6d 7d 20 5c 0a 09 20 20 20 to them} \..
8ba0: 20 7b 64 6f 65 73 20 6e 6f 74 20 68 61 76 65 20 {does not have
8bb0: 74 68 65 20 62 72 61 6e 63 68 20 6f 66 20 69 74 the branch of it
8bc0: 73 20 73 79 6d 62 6f 6c 20 63 68 61 6e 67 65 73 s symbol changes
8bd0: 65 74 20 40 20 61 74 74 61 63 68 65 64 20 74 6f et @ attached to
8be0: 20 69 74 7d 20 7b 0a 09 09 53 45 4c 45 43 54 20 it} {...SELECT
8bf0: 43 54 2e 6e 61 6d 65 2c 20 43 2e 63 69 64 2c 20 CT.name, C.cid,
8c00: 46 2e 6e 61 6d 65 2c 20 52 2e 72 65 76 2c 20 43 F.name, R.rev, C
8c10: 2e 63 69 64 0a 09 09 46 52 4f 4d 20 20 20 63 68 .cid...FROM ch
8c20: 61 6e 67 65 73 65 74 20 43 2c 20 63 73 74 79 70 angeset C, cstyp
8c30: 65 20 43 54 2c 20 72 65 76 69 73 69 6f 6e 20 52 e CT, revision R
8c40: 2c 20 66 69 6c 65 20 46 2c 20 63 73 69 74 65 6d , file F, csitem
8c50: 20 43 49 2c 20 62 72 61 6e 63 68 20 42 0a 09 09 CI, branch B...
8c60: 57 48 45 52 45 20 20 43 2e 74 79 70 65 20 3d 20 WHERE C.type =
8c70: 31 20 20 20 20 20 20 20 2d 2d 20 73 79 6d 62 6f 1 -- symbo
8c80: 6c 20 63 68 61 6e 67 65 73 65 74 73 20 6f 6e 6c l changesets onl
8c90: 79 0a 09 09 41 4e 44 20 20 20 20 43 2e 73 72 63 y...AND C.src
8ca0: 20 20 3d 20 42 2e 73 69 64 20 20 20 2d 2d 20 62 = B.sid -- b
8cb0: 72 61 6e 63 68 65 73 20 6f 6e 6c 79 0a 09 09 41 ranches only...A
8cc0: 4e 44 20 20 20 20 43 2e 63 69 64 20 20 3d 20 43 ND C.cid = C
8cd0: 49 2e 63 69 64 20 20 2d 2d 20 63 68 61 6e 67 65 I.cid -- change
8ce0: 73 65 74 20 2d 2d 3e 20 69 74 73 20 72 65 76 69 set --> its revi
8cf0: 73 69 6f 6e 73 0a 09 09 41 4e 44 20 20 20 20 52 sions...AND R
8d00: 2e 72 69 64 20 20 3d 20 43 49 2e 69 69 64 20 20 .rid = CI.iid
8d10: 2d 2d 20 6c 6f 6f 6b 20 61 74 20 74 68 65 20 72 -- look at the r
8d20: 65 76 69 73 69 6f 6e 73 0a 09 09 2d 2d 20 61 6e evisions...-- an
8d30: 64 20 6c 6f 6f 6b 20 66 6f 72 20 74 68 65 20 62 d look for the b
8d40: 72 61 6e 63 68 20 61 6d 6f 6e 67 20 74 68 65 20 ranch among the
8d50: 61 74 74 61 63 68 65 64 20 6f 6e 65 73 2e 0a 09 attached ones...
8d60: 09 41 4e 44 20 20 20 20 42 2e 73 69 64 20 4e 4f .AND B.sid NO
8d70: 54 20 49 4e 20 28 53 45 4c 45 43 54 20 42 42 2e T IN (SELECT BB.
8d80: 73 69 64 0a 09 09 09 09 20 20 20 20 20 46 52 4f sid..... FRO
8d90: 4d 20 20 20 62 72 61 6e 63 68 20 42 42 0a 09 09 M branch BB...
8da0: 09 09 20 20 20 20 20 57 48 45 52 45 20 20 42 42 .. WHERE BB
8db0: 2e 72 6f 6f 74 20 3d 20 52 2e 72 69 64 29 0a 09 .root = R.rid)..
8dc0: 09 41 4e 44 20 20 20 20 52 2e 66 69 64 20 3d 20 .AND R.fid =
8dd0: 46 2e 66 69 64 20 20 20 20 2d 2d 20 67 65 74 20 F.fid -- get
8de0: 66 69 6c 65 20 6f 66 20 72 65 76 69 73 69 6f 6e file of revision
8df0: 0a 09 20 20 20 20 7d 0a 0a 09 23 20 54 4f 44 4f .. }...# TODO
8e00: 0a 09 23 20 54 68 65 20 73 74 61 74 65 20 68 61 ..# The state ha
8e10: 73 20 74 6f 20 63 6f 6e 74 61 69 6e 20 61 74 20 s to contain at
8e20: 6c 65 61 73 74 20 6f 6e 65 20 74 61 67 20 73 79 least one tag sy
8e30: 6d 62 6f 6c 20 63 68 61 6e 67 65 73 65 74 0a 09 mbol changeset..
8e40: 23 20 66 6f 72 20 61 6c 6c 20 6b 6e 6f 77 6e 20 # for all known
8e50: 74 61 67 73 2e 0a 0a 09 23 20 54 4f 44 4f 0a 09 tags....# TODO..
8e60: 23 20 54 68 65 20 73 74 61 74 65 20 68 61 73 20 # The state has
8e70: 74 6f 20 63 6f 6e 74 61 69 6e 20 61 74 20 6c 65 to contain at le
8e80: 61 73 74 20 6f 6e 65 20 62 72 61 6e 63 68 20 73 ast one branch s
8e90: 79 6d 62 6f 6c 20 63 68 61 6e 67 65 73 65 74 0a ymbol changeset.
8ea0: 09 23 20 66 6f 72 20 61 6c 6c 20 6b 6e 6f 77 6e .# for all known
8eb0: 20 62 72 61 6e 63 68 65 73 2e 0a 09 72 65 74 75 branches...retu
8ec0: 72 6e 0a 20 20 20 20 7d 0a 0a 0a 20 20 20 20 70 rn. }... p
8ed0: 72 6f 63 20 43 68 65 63 6b 52 65 76 20 7b 68 65 roc CheckRev {he
8ee0: 61 64 65 72 20 6c 61 62 65 6c 20 73 71 6c 7d 20 ader label sql}
8ef0: 7b 0a 09 75 70 76 61 72 20 31 20 6e 20 6e 0a 09 {..upvar 1 n n..
8f00: 73 65 74 20 6f 6b 20 31 0a 09 66 6f 72 65 61 63 set ok 1..foreac
8f10: 68 20 7b 66 6e 61 6d 65 20 72 65 76 6e 72 7d 20 h {fname revnr}
8f20: 5b 73 74 61 74 65 20 72 75 6e 20 24 73 71 6c 5d [state run $sql]
8f30: 20 7b 0a 09 20 20 20 20 73 65 74 20 6f 6b 20 30 {.. set ok 0
8f40: 0a 09 20 20 20 20 74 72 6f 75 62 6c 65 20 66 61 .. trouble fa
8f50: 74 61 6c 20 22 24 7b 72 65 76 6e 72 7d 3a 3a 24 tal "${revnr}::$
8f60: 66 6e 61 6d 65 20 24 6c 61 62 65 6c 22 0a 09 7d fname $label"..}
8f70: 0a 09 6c 6f 67 20 77 72 69 74 65 20 35 20 69 6e ..log write 5 in
8f80: 74 65 67 72 69 74 79 20 7b 5c 5b 5b 66 6f 72 6d tegrity {\[[form
8f90: 61 74 20 25 30 32 64 20 5b 69 6e 63 72 20 6e 5d at %02d [incr n]
8fa0: 5d 5c 5d 20 5b 65 78 70 72 20 7b 24 6f 6b 20 3f ]\] [expr {$ok ?
8fb0: 20 22 4f 6b 20 20 20 20 22 20 3a 20 22 46 61 69 "Ok " : "Fai
8fc0: 6c 65 64 22 7d 5d 20 2e 2e 2e 20 24 68 65 61 64 led"}] ... $head
8fd0: 65 72 7d 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 er}..return.
8fe0: 7d 0a 0a 20 20 20 20 70 72 6f 63 20 43 68 65 63 }.. proc Chec
8ff0: 6b 54 61 67 20 7b 68 65 61 64 65 72 20 6c 61 62 kTag {header lab
9000: 65 6c 20 73 71 6c 7d 20 7b 0a 09 75 70 76 61 72 el sql} {..upvar
9010: 20 31 20 6e 20 6e 0a 09 73 65 74 20 6f 6b 20 31 1 n n..set ok 1
9020: 0a 09 66 6f 72 65 61 63 68 20 7b 70 6e 61 6d 65 ..foreach {pname
9030: 20 73 6e 61 6d 65 7d 20 5b 73 74 61 74 65 20 72 sname} [state r
9040: 75 6e 20 24 73 71 6c 5d 20 7b 0a 09 20 20 20 20 un $sql] {..
9050: 73 65 74 20 6f 6b 20 30 0a 09 20 20 20 20 74 72 set ok 0.. tr
9060: 6f 75 62 6c 65 20 66 61 74 61 6c 20 22 3c 24 70 ouble fatal "<$p
9070: 6e 61 6d 65 20 74 61 67 20 27 24 73 6e 61 6d 65 name tag '$sname
9080: 27 3e 20 24 6c 61 62 65 6c 22 0a 09 7d 0a 09 6c '> $label"..}..l
9090: 6f 67 20 77 72 69 74 65 20 35 20 69 6e 74 65 67 og write 5 integ
90a0: 72 69 74 79 20 7b 5c 5b 5b 66 6f 72 6d 61 74 20 rity {\[[format
90b0: 25 30 32 64 20 5b 69 6e 63 72 20 6e 5d 5d 5c 5d %02d [incr n]]\]
90c0: 20 5b 65 78 70 72 20 7b 24 6f 6b 20 3f 20 22 4f [expr {$ok ? "O
90d0: 6b 20 20 20 20 22 20 3a 20 22 46 61 69 6c 65 64 k " : "Failed
90e0: 22 7d 5d 20 2e 2e 2e 20 24 68 65 61 64 65 72 7d "}] ... $header}
90f0: 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a ..return. }..
9100: 20 20 20 20 70 72 6f 63 20 43 68 65 63 6b 42 72 proc CheckBr
9110: 61 6e 63 68 20 7b 68 65 61 64 65 72 20 6c 61 62 anch {header lab
9120: 65 6c 20 73 71 6c 7d 20 7b 0a 09 75 70 76 61 72 el sql} {..upvar
9130: 20 31 20 6e 20 6e 0a 09 73 65 74 20 6f 6b 20 31 1 n n..set ok 1
9140: 0a 09 66 6f 72 65 61 63 68 20 7b 70 6e 61 6d 65 ..foreach {pname
9150: 20 73 6e 61 6d 65 7d 20 5b 73 74 61 74 65 20 72 sname} [state r
9160: 75 6e 20 24 73 71 6c 5d 20 7b 0a 09 20 20 20 20 un $sql] {..
9170: 73 65 74 20 6f 6b 20 30 0a 09 20 20 20 20 74 72 set ok 0.. tr
9180: 6f 75 62 6c 65 20 66 61 74 61 6c 20 22 3c 24 70 ouble fatal "<$p
9190: 6e 61 6d 65 20 62 72 61 6e 63 68 20 27 24 73 6e name branch '$sn
91a0: 61 6d 65 27 3e 20 24 6c 61 62 65 6c 22 0a 09 7d ame'> $label"..}
91b0: 0a 09 6c 6f 67 20 77 72 69 74 65 20 35 20 69 6e ..log write 5 in
91c0: 74 65 67 72 69 74 79 20 7b 5c 5b 5b 66 6f 72 6d tegrity {\[[form
91d0: 61 74 20 25 30 32 64 20 5b 69 6e 63 72 20 6e 5d at %02d [incr n]
91e0: 5d 5c 5d 20 5b 65 78 70 72 20 7b 24 6f 6b 20 3f ]\] [expr {$ok ?
91f0: 20 22 4f 6b 20 20 20 20 22 20 3a 20 22 46 61 69 "Ok " : "Fai
9200: 6c 65 64 22 7d 5d 20 2e 2e 2e 20 24 68 65 61 64 led"}] ... $head
9210: 65 72 7d 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 er}..return.
9220: 7d 0a 0a 20 20 20 20 70 72 6f 63 20 43 68 65 63 }.. proc Chec
9230: 6b 43 53 20 7b 68 65 61 64 65 72 20 6c 61 62 65 kCS {header labe
9240: 6c 20 73 71 6c 7d 20 7b 0a 09 75 70 76 61 72 20 l sql} {..upvar
9250: 31 20 6e 20 6e 0a 09 73 65 74 20 6f 6b 20 31 0a 1 n n..set ok 1.
9260: 09 66 6f 72 65 61 63 68 20 7b 63 74 79 70 65 20 .foreach {ctype
9270: 63 69 64 7d 20 5b 73 74 61 74 65 20 72 75 6e 20 cid} [state run
9280: 24 73 71 6c 5d 20 7b 0a 09 20 20 20 20 73 65 74 $sql] {.. set
9290: 20 6f 6b 20 30 0a 09 20 20 20 20 74 72 6f 75 62 ok 0.. troub
92a0: 6c 65 20 66 61 74 61 6c 20 22 3c 24 63 74 79 70 le fatal "<$ctyp
92b0: 65 20 24 63 69 64 3e 20 24 6c 61 62 65 6c 22 0a e $cid> $label".
92c0: 09 7d 0a 09 6c 6f 67 20 77 72 69 74 65 20 35 20 .}..log write 5
92d0: 69 6e 74 65 67 72 69 74 79 20 7b 5c 5b 5b 66 6f integrity {\[[fo
92e0: 72 6d 61 74 20 25 30 32 64 20 5b 69 6e 63 72 20 rmat %02d [incr
92f0: 6e 5d 5d 5c 5d 20 5b 65 78 70 72 20 7b 24 6f 6b n]]\] [expr {$ok
9300: 20 3f 20 22 4f 6b 20 20 20 20 22 20 3a 20 22 46 ? "Ok " : "F
9310: 61 69 6c 65 64 22 7d 5d 20 2e 2e 2e 20 24 68 65 ailed"}] ... $he
9320: 61 64 65 72 7d 0a 09 72 65 74 75 72 6e 0a 20 20 ader}..return.
9330: 20 20 7d 0a 0a 20 20 20 20 70 72 6f 63 20 43 68 }.. proc Ch
9340: 65 63 6b 52 65 76 43 53 20 7b 68 65 61 64 65 72 eckRevCS {header
9350: 20 6c 61 62 65 6c 20 73 71 6c 7d 20 7b 0a 09 75 label sql} {..u
9360: 70 76 61 72 20 31 20 6e 20 6e 0a 09 73 65 74 20 pvar 1 n n..set
9370: 6f 6b 20 31 0a 09 66 6f 72 65 61 63 68 20 7b 63 ok 1..foreach {c
9380: 73 74 79 70 65 20 63 73 69 64 20 66 6e 61 6d 65 stype csid fname
9390: 20 72 65 76 6e 72 7d 20 5b 73 74 61 74 65 20 72 revnr} [state r
93a0: 75 6e 20 24 73 71 6c 5d 20 7b 0a 09 20 20 20 20 un $sql] {..
93b0: 73 65 74 20 6f 6b 20 30 0a 09 20 20 20 20 73 65 set ok 0.. se
93c0: 74 20 62 20 22 3c 24 63 73 74 79 70 65 20 24 63 t b "<$cstype $c
93d0: 73 69 64 3e 22 0a 09 20 20 20 20 74 72 6f 75 62 sid>".. troub
93e0: 6c 65 20 66 61 74 61 6c 20 22 24 66 6e 61 6d 65 le fatal "$fname
93f0: 20 3c 24 72 65 76 6e 72 3e 20 5b 73 74 72 69 6e <$revnr> [strin
9400: 67 20 6d 61 70 20 5b 6c 69 73 74 20 40 20 24 62 g map [list @ $b
9410: 5d 20 24 6c 61 62 65 6c 5d 22 0a 09 7d 0a 09 6c ] $label]"..}..l
9420: 6f 67 20 77 72 69 74 65 20 35 20 69 6e 74 65 67 og write 5 integ
9430: 72 69 74 79 20 7b 5c 5b 5b 66 6f 72 6d 61 74 20 rity {\[[format
9440: 25 30 32 64 20 5b 69 6e 63 72 20 6e 5d 5d 5c 5d %02d [incr n]]\]
9450: 20 5b 65 78 70 72 20 7b 24 6f 6b 20 3f 20 22 4f [expr {$ok ? "O
9460: 6b 20 20 20 20 22 20 3a 20 22 46 61 69 6c 65 64 k " : "Failed
9470: 22 7d 5d 20 2e 2e 2e 20 24 68 65 61 64 65 72 7d "}] ... $header}
9480: 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a ..return. }..
9490: 20 20 20 20 23 20 23 20 23 23 20 23 23 23 20 23 # # ## ### #
94a0: 23 23 23 23 20 23 23 23 23 23 23 23 23 20 23 23 #### ######## ##
94b0: 23 23 23 23 23 23 23 23 23 23 23 0a 20 20 20 20 ###########.
94c0: 23 23 20 43 6f 6e 66 69 67 75 72 61 74 69 6f 6e ## Configuration
94d0: 0a 0a 20 20 20 20 70 72 61 67 6d 61 20 2d 68 61 .. pragma -ha
94e0: 73 69 6e 73 74 61 6e 63 65 73 20 20 20 6e 6f 20 sinstances no
94f0: 3b 20 23 20 73 69 6e 67 6c 65 74 6f 6e 0a 20 20 ; # singleton.
9500: 20 20 70 72 61 67 6d 61 20 2d 68 61 73 74 79 70 pragma -hastyp
9510: 65 69 6e 66 6f 20 20 20 20 6e 6f 20 3b 20 23 20 einfo no ; #
9520: 6e 6f 20 69 6e 74 72 6f 73 70 65 63 74 69 6f 6e no introspection
9530: 0a 20 20 20 20 70 72 61 67 6d 61 20 2d 68 61 73 . pragma -has
9540: 74 79 70 65 64 65 73 74 72 6f 79 20 6e 6f 20 3b typedestroy no ;
9550: 20 23 20 69 6d 6d 6f 72 74 61 6c 0a 0a 20 20 20 # immortal..
9560: 20 23 20 23 20 23 23 20 23 23 23 20 23 23 23 23 # # ## ### ####
9570: 23 20 23 23 23 23 23 23 23 23 20 23 23 23 23 23 # ######## #####
9580: 23 23 23 23 23 23 23 23 0a 7d 0a 0a 6e 61 6d 65 ########.}..name
9590: 73 70 61 63 65 20 65 76 61 6c 20 3a 3a 76 63 3a space eval ::vc:
95a0: 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a :fossil::import:
95b0: 3a 63 76 73 20 7b 0a 20 20 20 20 6e 61 6d 65 73 :cvs {. names
95c0: 70 61 63 65 20 65 78 70 6f 72 74 20 69 6e 74 65 pace export inte
95d0: 67 72 69 74 79 0a 20 20 20 20 6e 61 6d 65 73 70 grity. namesp
95e0: 61 63 65 20 65 76 61 6c 20 69 6e 74 65 67 72 69 ace eval integri
95f0: 74 79 20 7b 0a 09 6e 61 6d 65 73 70 61 63 65 20 ty {..namespace
9600: 69 6d 70 6f 72 74 20 3a 3a 76 63 3a 3a 66 6f 73 import ::vc::fos
9610: 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 sil::import::cvs
9620: 3a 3a 73 74 61 74 65 0a 09 6e 61 6d 65 73 70 61 ::state..namespa
9630: 63 65 20 69 6d 70 6f 72 74 20 3a 3a 76 63 3a 3a ce import ::vc::
9640: 74 6f 6f 6c 73 3a 3a 74 72 6f 75 62 6c 65 0a 09 tools::trouble..
9650: 6e 61 6d 65 73 70 61 63 65 20 69 6d 70 6f 72 74 namespace import
9660: 20 3a 3a 76 63 3a 3a 74 6f 6f 6c 73 3a 3a 6c 6f ::vc::tools::lo
9670: 67 0a 09 6c 6f 67 20 72 65 67 69 73 74 65 72 20 g..log register
9680: 69 6e 74 65 67 72 69 74 79 0a 20 20 20 20 7d 0a integrity. }.
9690: 7d 0a 0a 23 20 23 20 23 23 20 23 23 23 20 23 23 }..# # ## ### ##
96a0: 23 23 23 20 23 23 23 23 23 23 23 23 20 23 23 23 ### ######## ###
96b0: 23 23 23 23 23 23 23 23 23 23 20 23 23 23 23 23 ########## #####
96c0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
96d0: 0a 23 23 20 52 65 61 64 79 0a 0a 70 61 63 6b 61 .## Ready..packa
96e0: 67 65 20 70 72 6f 76 69 64 65 20 76 63 3a 3a 66 ge provide vc::f
96f0: 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 ossil::import::c
9700: 76 73 3a 3a 69 6e 74 65 67 72 69 74 79 20 31 2e vs::integrity 1.
9710: 30 0a 72 65 74 75 72 6e 0a 0.return.