0000: 23 23 20 2d 2a 2d 20 74 63 6c 20 2d 2a 2d 0a 23 ## -*- tcl -*-.#
0010: 20 23 20 23 23 20 23 23 23 20 23 23 23 23 23 20 # ## ### #####
0020: 23 23 23 23 23 23 23 23 20 23 23 23 23 23 23 23 ######## #######
0030: 23 23 23 23 23 23 20 23 23 23 23 23 23 23 23 23 ###### #########
0040: 23 23 23 23 23 23 23 23 23 23 23 23 0a 23 23 20 ############.##
0050: 43 6f 70 79 72 69 67 68 74 20 28 63 29 20 32 30 Copyright (c) 20
0060: 30 37 20 41 6e 64 72 65 61 73 20 4b 75 70 72 69 07 Andreas Kupri
0070: 65 73 2e 0a 23 0a 23 20 54 68 69 73 20 73 6f 66 es..#.# This sof
0080: 74 77 61 72 65 20 69 73 20 6c 69 63 65 6e 73 65 tware is license
0090: 64 20 61 73 20 64 65 73 63 72 69 62 65 64 20 69 d as described i
00a0: 6e 20 74 68 65 20 66 69 6c 65 20 4c 49 43 45 4e n the file LICEN
00b0: 53 45 2c 20 77 68 69 63 68 0a 23 20 79 6f 75 20 SE, which.# you
00c0: 73 68 6f 75 6c 64 20 68 61 76 65 20 72 65 63 65 should have rece
00d0: 69 76 65 64 20 61 73 20 70 61 72 74 20 6f 66 20 ived as part of
00e0: 74 68 69 73 20 64 69 73 74 72 69 62 75 74 69 6f this distributio
00f0: 6e 2e 0a 23 0a 23 20 54 68 69 73 20 73 6f 66 74 n..#.# This soft
0100: 77 61 72 65 20 63 6f 6e 73 69 73 74 73 20 6f 66 ware consists of
0110: 20 76 6f 6c 75 6e 74 61 72 79 20 63 6f 6e 74 72 voluntary contr
0120: 69 62 75 74 69 6f 6e 73 20 6d 61 64 65 20 62 79 ibutions made by
0130: 20 6d 61 6e 79 0a 23 20 69 6e 64 69 76 69 64 75 many.# individu
0140: 61 6c 73 2e 20 20 46 6f 72 20 65 78 61 63 74 20 als. For exact
0150: 63 6f 6e 74 72 69 62 75 74 69 6f 6e 20 68 69 73 contribution his
0160: 74 6f 72 79 2c 20 73 65 65 20 74 68 65 20 72 65 tory, see the re
0170: 76 69 73 69 6f 6e 0a 23 20 68 69 73 74 6f 72 79 vision.# history
0180: 20 61 6e 64 20 6c 6f 67 73 2c 20 61 76 61 69 6c and logs, avail
0190: 61 62 6c 65 20 61 74 20 68 74 74 70 3a 2f 2f 66 able at http://f
01a0: 6f 73 73 69 6c 2d 73 63 6d 2e 68 77 61 63 69 2e ossil-scm.hwaci.
01b0: 63 6f 6d 2f 66 6f 73 73 69 6c 0a 23 20 23 20 23 com/fossil.# # #
01c0: 23 20 23 23 23 20 23 23 23 23 23 20 23 23 23 23 # ### ##### ####
01d0: 23 23 23 23 20 23 23 23 23 23 23 23 23 23 23 23 #### ###########
01e0: 23 23 20 23 23 23 23 23 23 23 23 23 23 23 23 23 ## #############
01f0: 23 23 23 23 23 23 23 23 0a 0a 23 23 20 50 61 73 ########..## Pas
0200: 73 20 49 49 2e 20 54 68 69 73 20 70 61 73 73 20 s II. This pass
0210: 70 61 72 73 65 73 20 74 68 65 20 63 6f 6c 6c 65 parses the colle
0220: 63 74 65 64 20 72 63 73 20 61 72 63 68 69 76 65 cted rcs archive
0230: 73 20 61 6e 64 20 65 78 74 72 61 63 74 73 0a 23 s and extracts.#
0240: 23 20 61 6c 6c 20 74 68 65 20 69 6e 66 6f 72 6d # all the inform
0250: 61 74 69 6f 6e 20 74 68 65 79 20 63 6f 6e 74 61 ation they conta
0260: 69 6e 20 28 72 65 76 69 73 69 6f 6e 73 2c 20 61 in (revisions, a
0270: 6e 64 20 73 79 6d 62 6f 6c 73 29 2e 0a 0a 23 20 nd symbols)...#
0280: 23 20 23 23 20 23 23 23 20 23 23 23 23 23 20 23 # ## ### ##### #
0290: 23 23 23 23 23 23 23 20 23 23 23 23 23 23 23 23 ####### ########
02a0: 23 23 23 23 23 20 23 23 23 23 23 23 23 23 23 23 ##### ##########
02b0: 23 23 23 23 23 23 23 23 23 23 23 0a 23 23 20 52 ###########.## R
02c0: 65 71 75 69 72 65 6d 65 6e 74 73 0a 0a 70 61 63 equirements..pac
02d0: 6b 61 67 65 20 72 65 71 75 69 72 65 20 54 63 6c kage require Tcl
02e0: 20 38 2e 34 20 20 20 20 20 20 20 20 20 20 20 20 8.4
02f0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0300: 20 20 20 3b 20 23 20 52 65 71 75 69 72 65 64 20 ; # Required
0310: 72 75 6e 74 69 6d 65 2e 0a 70 61 63 6b 61 67 65 runtime..package
0320: 20 72 65 71 75 69 72 65 20 73 6e 69 74 20 20 20 require 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 20 20 20 20 3b ;
0350: 20 23 20 4f 4f 20 73 79 73 74 65 6d 2e 0a 70 61 # OO system..pa
0360: 63 6b 61 67 65 20 72 65 71 75 69 72 65 20 76 63 ckage require vc
0370: 3a 3a 74 6f 6f 6c 73 3a 3a 74 72 6f 75 62 6c 65 ::tools::trouble
0380: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0390: 20 20 20 20 3b 20 23 20 45 72 72 6f 72 20 72 65 ; # Error re
03a0: 70 6f 72 74 69 6e 67 2e 0a 70 61 63 6b 61 67 65 porting..package
03b0: 20 72 65 71 75 69 72 65 20 76 63 3a 3a 74 6f 6f require vc::too
03c0: 6c 73 3a 3a 6c 6f 67 20 20 20 20 20 20 20 20 20 ls::log
03d0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 3b ;
03e0: 20 23 20 55 73 65 72 20 66 65 65 64 62 61 63 6b # User feedback
03f0: 2e 0a 70 61 63 6b 61 67 65 20 72 65 71 75 69 72 ..package requir
0400: 65 20 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d e vc::fossil::im
0410: 70 6f 72 74 3a 3a 63 76 73 3a 3a 70 61 73 73 20 port::cvs::pass
0420: 20 20 20 20 20 20 20 20 3b 20 23 20 50 61 73 73 ; # Pass
0430: 20 6d 61 6e 61 67 65 6d 65 6e 74 2e 0a 70 61 63 management..pac
0440: 6b 61 67 65 20 72 65 71 75 69 72 65 20 76 63 3a kage require vc:
0450: 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a :fossil::import:
0460: 3a 63 76 73 3a 3a 72 65 70 6f 73 69 74 6f 72 79 :cvs::repository
0470: 20 20 20 3b 20 23 20 52 65 70 6f 73 69 74 6f 72 ; # Repositor
0480: 79 20 6d 61 6e 61 67 65 6d 65 6e 74 2e 0a 70 61 y management..pa
0490: 63 6b 61 67 65 20 72 65 71 75 69 72 65 20 76 63 ckage require vc
04a0: 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 ::fossil::import
04b0: 3a 3a 63 76 73 3a 3a 73 74 61 74 65 20 20 20 20 ::cvs::state
04c0: 20 20 20 20 3b 20 23 20 53 74 61 74 65 20 73 74 ; # State st
04d0: 6f 72 61 67 65 2e 0a 70 61 63 6b 61 67 65 20 72 orage..package r
04e0: 65 71 75 69 72 65 20 76 63 3a 3a 66 6f 73 73 69 equire vc::fossi
04f0: 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a l::import::cvs::
0500: 69 6e 74 65 67 72 69 74 79 20 20 20 20 3b 20 23 integrity ; #
0510: 20 53 74 61 74 65 20 69 6e 74 65 67 72 69 74 79 State integrity
0520: 20 63 68 65 63 6b 73 2e 0a 70 61 63 6b 61 67 65 checks..package
0530: 20 72 65 71 75 69 72 65 20 76 63 3a 3a 66 6f 73 require vc::fos
0540: 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 sil::import::cvs
0550: 3a 3a 70 72 6f 6a 65 63 74 3a 3a 73 79 6d 20 3b ::project::sym ;
0560: 20 23 20 50 72 6f 6a 65 63 74 20 6c 65 76 65 6c # Project level
0570: 20 73 79 6d 62 6f 6c 73 2e 0a 70 61 63 6b 61 67 symbols..packag
0580: 65 20 72 65 71 75 69 72 65 20 76 63 3a 3a 66 6f e require vc::fo
0590: 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 ssil::import::cv
05a0: 73 3a 3a 66 69 6c 65 3a 3a 72 65 76 20 20 20 20 s::file::rev
05b0: 3b 20 23 20 46 69 6c 65 20 6c 65 76 65 6c 20 72 ; # File level r
05c0: 65 76 69 73 69 6f 6e 73 2e 0a 70 61 63 6b 61 67 evisions..packag
05d0: 65 20 72 65 71 75 69 72 65 20 76 63 3a 3a 72 63 e require vc::rc
05e0: 73 3a 3a 70 61 72 73 65 72 20 20 20 20 20 20 20 s::parser
05f0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0600: 3b 20 23 20 52 63 73 20 61 72 63 68 69 76 65 20 ; # Rcs archive
0610: 64 61 74 61 20 65 78 74 72 61 63 74 69 6f 6e 2e data extraction.
0620: 0a 0a 23 20 23 20 23 23 20 23 23 23 20 23 23 23 ..# # ## ### ###
0630: 23 23 20 23 23 23 23 23 23 23 23 20 23 23 23 23 ## ######## ####
0640: 23 23 23 23 23 23 23 23 23 20 23 23 23 23 23 23 ######### ######
0650: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 0a ###############.
0660: 23 23 20 52 65 67 69 73 74 65 72 20 74 68 65 20 ## Register the
0670: 70 61 73 73 20 77 69 74 68 20 74 68 65 20 6d 61 pass with the ma
0680: 6e 61 67 65 6d 65 6e 74 0a 0a 76 63 3a 3a 66 6f nagement..vc::fo
0690: 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 ssil::import::cv
06a0: 73 3a 3a 70 61 73 73 20 64 65 66 69 6e 65 20 5c s::pass define \
06b0: 0a 20 20 20 20 43 6f 6c 6c 65 63 74 52 65 76 20 . CollectRev
06c0: 5c 0a 20 20 20 20 7b 43 6f 6c 6c 65 63 74 20 72 \. {Collect r
06d0: 65 76 69 73 69 6f 6e 73 20 61 6e 64 20 73 79 6d evisions and sym
06e0: 62 6f 6c 73 7d 20 5c 0a 20 20 20 20 3a 3a 76 63 bols} \. ::vc
06f0: 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 ::fossil::import
0700: 3a 3a 63 76 73 3a 3a 70 61 73 73 3a 3a 63 6f 6c ::cvs::pass::col
0710: 6c 72 65 76 0a 0a 23 20 23 20 23 23 20 23 23 23 lrev..# # ## ###
0720: 20 23 23 23 23 23 20 23 23 23 23 23 23 23 23 20 ##### ########
0730: 23 23 23 23 23 23 23 23 23 23 23 23 23 20 23 23 ############# ##
0740: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
0750: 23 23 23 0a 23 23 0a 0a 73 6e 69 74 3a 3a 74 79 ###.##..snit::ty
0760: 70 65 20 3a 3a 76 63 3a 3a 66 6f 73 73 69 6c 3a pe ::vc::fossil:
0770: 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 70 61 :import::cvs::pa
0780: 73 73 3a 3a 63 6f 6c 6c 72 65 76 20 7b 0a 20 20 ss::collrev {.
0790: 20 20 23 20 23 20 23 23 20 23 23 23 20 23 23 23 # # ## ### ###
07a0: 23 23 20 23 23 23 23 23 23 23 23 20 23 23 23 23 ## ######## ####
07b0: 23 23 23 23 23 23 23 23 23 0a 20 20 20 20 23 23 #########. ##
07c0: 20 50 75 62 6c 69 63 20 41 50 49 0a 0a 20 20 20 Public API..
07d0: 20 74 79 70 65 6d 65 74 68 6f 64 20 73 65 74 75 typemethod setu
07e0: 70 20 7b 7d 20 7b 0a 09 23 20 44 65 66 69 6e 65 p {} {..# Define
07f0: 20 6e 61 6d 65 73 20 61 6e 64 20 73 74 72 75 63 names and struc
0800: 74 75 72 65 20 6f 66 20 74 68 65 20 70 65 72 73 ture of the pers
0810: 69 73 74 65 6e 74 20 73 74 61 74 65 20 6f 66 20 istent state of
0820: 74 68 69 73 0a 09 23 20 70 61 73 73 2e 0a 0a 09 this..# pass....
0830: 73 74 61 74 65 20 75 73 65 20 70 72 6f 6a 65 63 state use projec
0840: 74 0a 09 73 74 61 74 65 20 75 73 65 20 66 69 6c t..state use fil
0850: 65 0a 0a 09 23 20 57 65 20 64 65 61 6c 20 77 69 e...# We deal wi
0860: 74 68 20 70 65 72 20 70 72 6f 6a 65 63 74 20 61 th per project a
0870: 6e 64 20 70 65 72 20 66 69 6c 65 20 64 61 74 61 nd per file data
0880: 2c 20 74 68 65 20 66 69 72 73 74 0a 09 23 20 63 , the first..# c
0890: 6f 6c 6c 61 74 65 64 20 66 72 6f 6d 20 74 68 65 ollated from the
08a0: 20 73 65 63 6f 6e 64 2e 0a 0a 09 23 20 50 65 72 second....# Per
08b0: 20 66 69 6c 65 20 77 65 20 68 61 76 65 20 67 65 file we have ge
08c0: 6e 65 72 61 6c 20 69 6e 66 6f 72 6d 61 74 69 6f neral informatio
08d0: 6e 2c 20 2e 2e 2e 2c 20 61 6e 64 20 74 68 65 6e n, ..., and then
08e0: 0a 09 23 20 72 65 76 69 73 69 6f 6e 73 20 61 6e ..# revisions an
08f0: 64 20 73 79 6d 62 6f 6c 73 2e 20 54 68 65 20 6c d symbols. The l
0900: 61 74 74 65 72 20 63 61 6e 20 62 65 20 66 75 72 atter can be fur
0910: 74 68 65 72 20 73 65 70 61 72 61 74 65 64 0a 09 ther separated..
0920: 23 20 69 6e 74 6f 20 74 61 67 73 20 61 6e 64 20 # into tags and
0930: 62 72 61 6e 63 68 65 73 2e 20 41 74 20 70 72 6f branches. At pro
0940: 6a 65 63 74 20 6c 65 76 65 6c 20 74 68 65 20 70 ject level the p
0950: 65 72 2d 66 69 6c 65 0a 09 23 20 73 79 6d 62 6f er-file..# symbo
0960: 6c 73 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 69 ls information i
0970: 73 20 6d 65 72 67 65 64 2e 0a 0a 09 23 20 46 69 s merged....# Fi
0980: 6c 65 20 6c 65 76 65 6c 20 2e 2e 2e 0a 09 23 09 le level .....#.
0990: 52 65 76 69 73 69 6f 6e 73 2c 20 42 72 61 6e 63 Revisions, Branc
09a0: 68 65 73 2c 20 54 61 67 73 0a 09 23 0a 09 23 20 hes, Tags..#..#
09b0: 50 73 65 75 64 6f 20 63 6c 61 73 73 20 68 69 65 Pseudo class hie
09c0: 72 61 72 63 68 79 0a 09 23 09 54 61 67 20 20 20 rarchy..#.Tag
09d0: 20 20 20 3c 2d 20 53 79 6d 62 6f 6c 20 3c 2d 20 <- Symbol <-
09e0: 45 76 65 6e 74 0a 09 23 09 42 72 61 6e 63 68 20 Event..#.Branch
09f0: 20 20 3c 2d 20 53 79 6d 62 6f 6c 20 3c 2d 20 45 <- Symbol <- E
0a00: 76 65 6e 74 0a 09 23 09 52 65 76 69 73 69 6f 6e vent..#.Revision
0a10: 20 20 20 20 20 20 20 20 20 20 20 3c 2d 20 45 76 <- Ev
0a20: 65 6e 74 0a 0a 09 73 74 61 74 65 20 65 78 74 65 ent...state exte
0a30: 6e 64 20 72 65 76 69 73 69 6f 6e 20 7b 0a 09 20 nd revision {..
0a40: 20 20 20 2d 2d 20 52 65 76 69 73 69 6f 6e 73 2e -- Revisions.
0a50: 20 49 64 65 6e 74 69 66 69 65 64 20 62 79 20 61 Identified by a
0a60: 20 67 6c 6f 62 61 6c 20 6e 75 6d 65 72 69 63 20 global numeric
0a70: 69 64 20 65 61 63 68 0a 09 20 20 20 20 2d 2d 20 id each.. --
0a80: 62 65 6c 6f 6e 67 73 20 74 6f 20 61 20 73 69 6e belongs to a sin
0a90: 67 6c 65 20 66 69 6c 65 2c 20 69 64 65 6e 74 69 gle file, identi
0aa0: 66 69 65 64 20 62 79 20 69 74 73 20 69 64 2e 20 fied by its id.
0ab0: 49 74 0a 09 20 20 20 20 2d 2d 20 66 75 72 74 68 It.. -- furth
0ac0: 65 72 20 68 61 73 20 61 20 64 6f 74 74 65 64 20 er has a dotted
0ad0: 72 65 76 69 73 69 6f 6e 20 6e 75 6d 62 65 72 20 revision number
0ae0: 28 44 54 4e 29 2e 0a 09 20 20 20 20 2d 2d 0a 09 (DTN)... --..
0af0: 20 20 20 20 2d 2d 20 43 6f 6e 73 74 72 61 69 6e -- Constrain
0b00: 74 3a 20 54 68 65 20 64 6f 74 74 65 64 20 72 65 t: The dotted re
0b10: 76 69 73 69 6f 6e 20 6e 75 6d 62 65 72 20 69 73 vision number is
0b20: 20 75 6e 69 71 75 65 20 77 69 74 68 69 6e 0a 20 unique within.
0b30: 20 20 20 20 20 20 20 20 20 20 20 2d 2d 20 20 20 --
0b40: 20 20 20 20 20 20 20 20 20 20 74 68 65 20 66 69 the fi
0b50: 6c 65 2e 20 53 65 65 20 65 6e 64 20 6f 66 20 64 le. See end of d
0b60: 65 66 69 6e 69 74 69 6f 6e 2e 0a 0a 09 20 20 20 efinition....
0b70: 20 72 69 64 20 20 49 4e 54 45 47 45 52 20 20 4e rid INTEGER N
0b80: 4f 54 20 4e 55 4c 4c 20 20 50 52 49 4d 41 52 59 OT NULL PRIMARY
0b90: 20 4b 45 59 20 41 55 54 4f 49 4e 43 52 45 4d 45 KEY AUTOINCREME
0ba0: 4e 54 2c 0a 09 20 20 20 20 66 69 64 20 20 49 4e NT,.. fid IN
0bb0: 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 TEGER NOT NULL
0bc0: 20 52 45 46 45 52 45 4e 43 45 53 20 66 69 6c 65 REFERENCES file
0bd0: 2c 20 20 20 2d 2d 20 46 69 6c 65 20 6f 77 6e 69 , -- File owni
0be0: 6e 67 20 72 65 76 69 73 69 6f 6e 2e 0a 09 20 20 ng revision...
0bf0: 20 20 72 65 76 20 20 54 45 58 54 20 20 20 20 20 rev TEXT
0c00: 4e 4f 54 20 4e 55 4c 4c 2c 20 20 20 20 20 20 20 NOT NULL,
0c10: 20 20 20 20 20 20 20 20 20 20 20 20 20 2d 2d 20 --
0c20: 44 6f 74 74 65 64 20 52 65 76 20 4e 75 6d 62 65 Dotted Rev Numbe
0c30: 72 2e 0a 0a 09 20 20 20 20 2d 2d 20 41 6c 6c 20 r.... -- All
0c40: 72 65 76 69 73 69 6f 6e 73 20 62 65 6c 6f 6e 67 revisions belong
0c50: 20 74 6f 20 61 20 6c 69 6e 65 2d 6f 66 2d 64 65 to a line-of-de
0c60: 76 65 6c 6f 70 6d 65 6e 74 2c 0a 09 20 20 20 20 velopment,..
0c70: 2d 2d 20 69 64 65 6e 74 69 66 69 65 64 20 62 79 -- identified by
0c80: 20 61 20 73 79 6d 62 6f 6c 20 28 70 72 6f 6a 65 a symbol (proje
0c90: 63 74 20 6c 65 76 65 6c 29 2e 20 44 75 72 69 6e ct level). Durin
0ca0: 67 20 64 61 74 61 0a 09 20 20 20 20 2d 2d 20 63 g data.. -- c
0cb0: 6f 6c 6c 65 63 74 69 6f 6e 20 69 74 20 77 61 73 ollection it was
0cc0: 20 61 20 66 69 6c 65 2d 6c 65 76 65 6c 20 62 72 a file-level br
0cd0: 61 6e 63 68 20 73 79 6d 62 6f 6c 2e 0a 09 20 20 anch symbol...
0ce0: 20 20 2d 2d 0a 09 20 20 20 20 2d 2d 20 43 6f 6e --.. -- Con
0cf0: 73 74 72 61 69 6e 74 3a 20 41 6c 6c 20 74 68 65 straint: All the
0d00: 20 4c 4f 44 20 73 79 6d 62 6f 6c 73 20 61 72 65 LOD symbols are
0d10: 20 69 6e 20 74 68 65 20 73 61 6d 65 20 70 72 6f in the same pro
0d20: 6a 65 63 74 0a 09 20 20 20 20 2d 2d 20 20 20 20 ject.. --
0d30: 20 20 20 20 20 20 20 20 20 61 73 20 74 68 65 20 as the
0d40: 66 69 6c 65 20 69 74 73 65 6c 66 2e 20 54 68 69 file itself. Thi
0d50: 73 20 63 61 6e 6e 6f 74 20 62 65 0a 09 20 20 20 s cannot be..
0d60: 20 2d 2d 20 20 20 20 20 20 20 20 20 20 20 20 20 --
0d70: 65 78 70 72 65 73 73 65 64 20 69 6e 20 43 52 45 expressed in CRE
0d80: 41 54 45 20 54 41 42 4c 45 20 73 79 6e 74 61 78 ATE TABLE syntax
0d90: 2e 0a 0a 09 20 20 20 20 6c 6f 64 20 20 49 4e 54 .... lod INT
0da0: 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 EGER NOT NULL
0db0: 52 45 46 45 52 45 4e 43 45 53 20 73 79 6d 62 6f REFERENCES symbo
0dc0: 6c 2c 20 2d 2d 20 4c 69 6e 65 20 6f 66 20 64 65 l, -- Line of de
0dd0: 76 65 6c 6f 70 6d 65 6e 74 0a 0a 09 20 20 20 20 velopment...
0de0: 2d 2d 20 54 68 65 20 72 65 76 69 73 69 6f 6e 73 -- The revisions
0df0: 20 69 6e 20 61 20 66 69 6c 65 20 61 72 65 20 6f in a file are o
0e00: 72 67 61 6e 69 7a 65 64 20 69 6e 20 61 20 66 6f rganized in a fo
0e10: 72 65 73 74 20 6f 66 0a 09 20 20 20 20 2d 2d 20 rest of.. --
0e20: 74 72 65 65 73 2c 20 77 69 74 68 20 74 68 65 20 trees, with the
0e30: 6d 61 69 6e 20 6c 69 6e 65 73 20 64 65 66 69 6e main lines defin
0e40: 65 64 20 74 68 72 6f 75 67 68 20 74 68 65 20 70 ed through the p
0e50: 61 72 65 6e 74 20 2f 0a 09 20 20 20 20 2d 2d 20 arent /.. --
0e60: 63 68 69 6c 64 20 72 65 66 65 72 65 6e 63 65 73 child references
0e70: 2e 20 41 20 72 65 76 69 73 69 6f 6e 20 77 69 74 . A revision wit
0e80: 68 6f 75 74 20 61 20 70 61 72 65 6e 74 20 69 73 hout a parent is
0e90: 20 74 68 65 0a 09 20 20 20 20 2d 2d 20 72 6f 6f the.. -- roo
0ea0: 74 20 6f 66 20 61 20 74 72 65 65 2c 20 61 6e 64 t of a tree, and
0eb0: 20 61 20 72 65 76 69 73 69 6f 6e 20 77 69 74 68 a revision with
0ec0: 6f 75 74 20 61 20 63 68 69 6c 64 20 69 73 20 61 out a child is a
0ed0: 0a 09 20 20 20 20 2d 2d 20 6c 65 61 66 2e 0a 0a .. -- leaf...
0ee0: 09 20 20 20 20 2d 2d 20 43 6f 6e 73 74 72 61 69 . -- Constrai
0ef0: 6e 74 73 3a 20 41 6c 6c 20 72 65 76 69 73 69 6f nts: All revisio
0f00: 6e 73 20 63 6f 75 70 6c 65 64 20 74 68 72 6f 75 ns coupled throu
0f10: 67 68 20 70 61 72 65 6e 74 2f 63 68 69 6c 64 0a gh parent/child.
0f20: 09 20 20 20 20 2d 2d 20 20 20 20 20 20 20 20 20 . --
0f30: 20 20 20 20 20 72 65 66 65 72 20 74 6f 20 74 68 refer to th
0f40: 65 20 73 61 6d 65 20 4c 4f 44 20 73 79 6d 62 6f e same LOD symbo
0f50: 6c 2e 20 54 68 65 20 70 61 72 65 6e 74 0a 09 20 l. The parent..
0f60: 20 20 20 2d 2d 20 20 20 20 20 20 20 20 20 20 20 --
0f70: 20 20 20 6f 66 20 61 20 63 68 69 6c 64 20 6f 66 of a child of
0f80: 20 58 20 69 73 20 58 2e 20 54 68 65 20 63 68 69 X is X. The chi
0f90: 6c 64 20 6f 66 20 61 0a 09 20 20 20 20 2d 2d 20 ld of a.. --
0fa0: 20 20 20 20 20 20 20 20 20 20 20 20 20 70 61 72 par
0fb0: 65 6e 74 20 6f 66 20 58 20 69 73 20 58 2e 0a 0a ent of X is X...
0fc0: 09 20 20 20 20 70 61 72 65 6e 74 20 20 49 4e 54 . parent INT
0fd0: 45 47 45 52 20 20 20 20 20 20 20 20 20 20 20 20 EGER
0fe0: 52 45 46 45 52 45 4e 43 45 53 20 72 65 76 69 73 REFERENCES revis
0ff0: 69 6f 6e 2c 0a 09 20 20 20 20 63 68 69 6c 64 20 ion,.. child
1000: 20 20 49 4e 54 45 47 45 52 20 20 20 20 20 20 20 INTEGER
1010: 20 20 20 20 20 52 45 46 45 52 45 4e 43 45 53 20 REFERENCES
1020: 72 65 76 69 73 69 6f 6e 2c 0a 0a 09 20 20 20 20 revision,...
1030: 2d 2d 20 54 68 65 20 72 65 70 72 65 73 65 6e 74 -- The represent
1040: 61 74 69 6f 6e 20 6f 66 20 61 20 62 72 61 6e 63 ation of a branc
1050: 68 20 69 6e 20 61 20 74 72 65 65 20 69 73 20 74 h in a tree is t
1060: 68 65 0a 09 20 20 20 20 2d 2d 20 65 78 63 65 70 he.. -- excep
1070: 74 69 6f 6e 20 74 6f 20 74 68 65 20 74 68 72 65 tion to the thre
1080: 65 20 63 6f 6e 73 74 72 61 69 6e 74 73 20 61 62 e constraints ab
1090: 6f 76 65 2e 0a 0a 09 20 20 20 20 2d 2d 20 54 68 ove.... -- Th
10a0: 65 20 62 65 67 69 6e 6e 69 6e 67 20 6f 66 20 61 e beginning of a
10b0: 20 62 72 61 6e 63 68 20 69 73 20 72 65 70 72 65 branch is repre
10c0: 73 65 6e 74 65 64 20 62 79 20 61 20 6e 6f 6e 2d sented by a non-
10d0: 4e 55 4c 4c 0a 09 20 20 20 20 2d 2d 20 62 70 61 NULL.. -- bpa
10e0: 72 65 6e 74 20 6f 66 20 61 20 72 65 76 69 73 69 rent of a revisi
10f0: 6f 6e 2e 20 54 68 69 73 20 72 65 76 69 73 69 6f on. This revisio
1100: 6e 20 42 20 69 73 20 74 68 65 20 66 69 72 73 74 n B is the first
1110: 20 6f 6e 0a 09 20 20 20 20 2d 2d 20 74 68 65 20 on.. -- the
1120: 62 72 61 6e 63 68 2e 20 49 74 73 20 70 61 72 65 branch. Its pare
1130: 6e 74 20 50 20 69 73 20 74 68 65 20 72 65 76 69 nt P is the revi
1140: 73 69 6f 6e 20 74 68 65 20 62 72 61 6e 63 68 20 sion the branch
1150: 69 73 0a 09 20 20 20 20 2d 2d 20 72 6f 6f 74 65 is.. -- roote
1160: 64 20 69 6e 2c 20 61 6e 64 20 69 74 20 69 73 20 d in, and it is
1170: 6e 6f 74 20 74 68 65 20 63 68 69 6c 64 20 6f 66 not the child of
1180: 20 50 2e 20 42 20 61 6e 64 20 50 20 72 65 66 65 P. B and P refe
1190: 72 0a 09 20 20 20 20 2d 2d 20 74 6f 20 64 69 66 r.. -- to dif
11a0: 66 65 72 65 6e 74 20 4c 4f 44 20 73 79 6d 62 6f ferent LOD symbo
11b0: 6c 73 2e 20 54 68 65 20 62 70 61 72 65 6e 74 20 ls. The bparent
11c0: 6f 66 20 42 20 69 73 20 61 6c 73 6f 20 69 74 73 of B is also its
11d0: 0a 09 20 20 20 20 2d 2d 20 4c 4f 44 2c 20 61 6e .. -- LOD, an
11e0: 64 20 74 68 65 20 4c 4f 44 20 6f 66 20 69 74 73 d the LOD of its
11f0: 20 63 68 69 6c 64 72 65 6e 2e 0a 0a 09 20 20 20 children....
1200: 20 62 70 61 72 65 6e 74 20 49 4e 54 45 47 45 52 bparent INTEGER
1210: 20 20 20 20 20 20 20 20 20 20 20 20 52 45 46 45 REFE
1220: 52 45 4e 43 45 53 20 73 79 6d 62 6f 6c 2c 0a 0a RENCES symbol,..
1230: 09 20 20 20 20 2d 2d 20 4c 61 73 74 6c 79 20 77 . -- Lastly w
1240: 65 20 6b 65 65 70 20 69 6e 66 6f 72 6d 61 74 69 e keep informati
1250: 6f 6e 20 69 73 20 61 62 6f 75 74 20 6e 6f 6e 2d on is about non-
1260: 74 72 75 6e 6b 20 64 65 66 61 75 6c 74 0a 09 20 trunk default..
1270: 20 20 20 2d 2d 20 62 72 61 6e 63 68 65 73 20 28 -- branches (
1280: 4e 54 44 42 29 20 69 6e 20 74 68 65 20 72 65 76 NTDB) in the rev
1290: 69 73 69 6f 6e 73 2e 0a 0a 09 20 20 20 20 2d 2d isions.... --
12a0: 20 41 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 6f All revisions o
12b0: 6e 20 74 68 65 20 4e 54 44 42 20 68 61 76 65 20 n the NTDB have
12c0: 27 69 73 64 65 66 61 75 6c 74 27 20 54 52 55 45 'isdefault' TRUE
12d0: 2c 0a 09 20 20 20 20 2d 2d 20 65 76 65 72 79 6f ,.. -- everyo
12e0: 6e 65 20 65 6c 73 65 20 46 41 4c 53 45 2e 20 54 ne else FALSE. T
12f0: 68 65 20 6c 61 73 74 20 72 65 76 69 73 69 6f 6e he last revision
1300: 20 58 20 6f 6e 20 74 68 65 20 4e 54 44 42 0a 09 X on the NTDB..
1310: 20 20 20 20 2d 2d 20 77 68 69 63 68 20 69 73 20 -- which is
1320: 73 74 69 6c 6c 20 63 6f 6e 73 69 64 65 72 65 64 still considered
1330: 20 74 6f 20 62 65 20 6f 6e 20 74 68 65 20 74 72 to be on the tr
1340: 75 6e 6b 20 61 73 20 77 65 6c 6c 0a 09 20 20 20 unk as well..
1350: 20 2d 2d 20 68 61 73 20 61 20 6e 6f 6e 2d 4e 55 -- has a non-NU
1360: 4c 4c 20 27 64 62 63 68 69 6c 64 27 20 77 68 69 LL 'dbchild' whi
1370: 63 68 20 72 65 66 65 72 73 20 74 6f 20 74 68 65 ch refers to the
1380: 20 72 6f 6f 74 20 6f 66 0a 09 20 20 20 20 2d 2d root of.. --
1390: 20 74 68 65 20 74 72 75 6e 6b 2e 20 54 68 65 20 the trunk. The
13a0: 72 6f 6f 74 20 61 6c 73 6f 20 68 61 73 20 61 20 root also has a
13b0: 6e 6f 6e 2d 4e 55 4c 4c 20 64 62 70 61 72 65 6e non-NULL dbparen
13c0: 74 0a 09 20 20 20 20 2d 2d 20 72 65 66 65 72 69 t.. -- referi
13d0: 6e 67 20 74 6f 20 58 2e 0a 0a 09 20 20 20 20 69 ng to X.... i
13e0: 73 64 65 66 61 75 6c 74 20 49 4e 54 45 47 45 52 sdefault INTEGER
13f0: 20 20 4e 4f 54 20 4e 55 4c 4c 2c 0a 09 20 20 20 NOT NULL,..
1400: 20 64 62 70 61 72 65 6e 74 20 20 49 4e 54 45 47 dbparent INTEG
1410: 45 52 20 20 20 20 20 20 20 20 20 20 20 20 52 45 ER RE
1420: 46 45 52 45 4e 43 45 53 20 72 65 76 69 73 69 6f FERENCES revisio
1430: 6e 2c 0a 09 20 20 20 20 64 62 63 68 69 6c 64 20 n,.. dbchild
1440: 20 20 49 4e 54 45 47 45 52 20 20 20 20 20 20 20 INTEGER
1450: 20 20 20 20 20 52 45 46 45 52 45 4e 43 45 53 20 REFERENCES
1460: 72 65 76 69 73 69 6f 6e 2c 0a 0a 09 20 20 20 20 revision,...
1470: 2d 2d 20 54 68 65 20 6d 61 69 6e 20 70 61 79 6c -- The main payl
1480: 6f 61 64 20 6f 66 20 74 68 65 20 72 65 76 69 73 oad of the revis
1490: 69 6f 6e 20 61 72 65 20 74 68 65 20 64 61 74 65 ion are the date
14a0: 2f 74 69 6d 65 20 69 74 0a 09 20 20 20 20 2d 2d /time it.. --
14b0: 20 77 61 73 20 65 6e 74 65 72 65 64 2c 20 69 74 was entered, it
14c0: 73 20 73 74 61 74 65 2c 20 6f 70 65 72 61 74 69 s state, operati
14d0: 6f 6e 20 28 3d 20 74 79 70 65 2f 63 6c 61 73 73 on (= type/class
14e0: 29 2c 20 74 65 78 74 0a 09 20 20 20 20 2d 2d 20 ), text.. --
14f0: 63 6f 6e 74 65 6e 74 2c 20 61 6e 64 20 6d 65 74 content, and met
1500: 61 20 64 61 74 61 20 28 61 75 74 68 6f 72 2c 20 a data (author,
1510: 6c 6f 67 20 6d 65 73 73 61 67 65 2c 20 62 72 61 log message, bra
1520: 6e 63 68 2c 0a 09 20 20 20 20 2d 2d 20 70 72 6f nch,.. -- pro
1530: 6a 65 63 74 29 2e 20 54 68 65 20 6c 61 73 74 20 ject). The last
1540: 69 73 20 65 6e 63 6f 64 65 64 20 61 73 20 73 69 is encoded as si
1550: 6e 67 6c 65 20 69 64 2c 20 73 65 65 20 74 61 62 ngle id, see tab
1560: 6c 65 0a 09 20 20 20 20 2d 2d 20 27 6d 65 74 61 le.. -- 'meta
1570: 27 2e 20 54 68 65 20 64 61 74 65 2f 74 69 6d 65 '. The date/time
1580: 20 69 73 20 67 69 76 65 6e 20 69 6e 20 73 65 63 is given in sec
1590: 6f 6e 64 73 20 73 69 6e 63 65 20 74 68 65 0a 09 onds since the..
15a0: 20 20 20 20 2d 2d 20 65 70 6f 63 68 2c 20 66 6f -- epoch, fo
15b0: 72 20 65 61 73 79 20 63 6f 6d 70 61 72 69 73 6f r easy compariso
15c0: 6e 2e 20 54 68 65 20 74 65 78 74 20 63 6f 6e 74 n. The text cont
15d0: 65 6e 74 20 69 73 20 61 6e 0a 09 20 20 20 20 2d ent is an.. -
15e0: 2d 20 28 6f 66 66 73 65 74 2c 6c 65 6e 67 74 68 - (offset,length
15f0: 29 20 70 61 69 72 20 69 6e 74 6f 20 74 68 65 20 ) pair into the
1600: 72 63 73 20 61 72 63 68 69 76 65 2e 0a 0a 09 20 rcs archive....
1610: 20 20 20 6f 70 20 20 20 20 49 4e 54 45 47 45 52 op INTEGER
1620: 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 52 45 46 45 NOT NULL REFE
1630: 52 45 4e 43 45 53 20 6f 70 74 79 70 65 2c 0a 09 RENCES optype,..
1640: 20 20 20 20 64 61 74 65 20 20 49 4e 54 45 47 45 date INTEGE
1650: 52 20 20 4e 4f 54 20 4e 55 4c 4c 2c 0a 09 20 20 R NOT NULL,..
1660: 20 20 73 74 61 74 65 20 54 45 58 54 20 20 20 20 state TEXT
1670: 20 4e 4f 54 20 4e 55 4c 4c 2c 0a 09 20 20 20 20 NOT NULL,..
1680: 6d 69 64 20 20 20 49 4e 54 45 47 45 52 20 20 4e mid INTEGER N
1690: 4f 54 20 4e 55 4c 4c 20 20 52 45 46 45 52 45 4e OT NULL REFEREN
16a0: 43 45 53 20 6d 65 74 61 2c 0a 09 20 20 20 20 63 CES meta,.. c
16b0: 6f 66 66 20 20 49 4e 54 45 47 45 52 20 20 4e 4f off INTEGER NO
16c0: 54 20 4e 55 4c 4c 2c 0a 09 20 20 20 20 63 6c 65 T NULL,.. cle
16d0: 6e 20 20 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 n INTEGER NOT
16e0: 4e 55 4c 4c 2c 0a 0a 09 20 20 20 20 55 4e 49 51 NULL,... UNIQ
16f0: 55 45 20 28 66 69 64 2c 20 72 65 76 29 20 2d 2d UE (fid, rev) --
1700: 20 54 68 65 20 44 54 4e 20 69 73 20 75 6e 69 71 The DTN is uniq
1710: 75 65 20 77 69 74 68 69 6e 20 74 68 65 20 72 65 ue within the re
1720: 76 69 73 69 6f 6e 27 73 20 66 69 6c 65 2e 0a 09 vision's file...
1730: 7d 0a 0a 09 23 20 42 6c 6f 62 73 20 63 6f 6e 74 }...# Blobs cont
1740: 61 69 6e 20 74 68 65 20 69 6e 66 6f 72 6d 61 74 ain the informat
1750: 69 6f 6e 20 6e 65 65 64 65 64 20 74 6f 20 65 78 ion needed to ex
1760: 74 72 61 63 74 20 72 65 76 69 73 69 6f 6e 73 0a tract revisions.
1770: 09 23 20 66 72 6f 6d 20 72 63 73 20 61 72 63 68 .# from rcs arch
1780: 69 76 65 20 66 69 6c 65 73 2e 20 41 73 20 73 75 ive files. As su
1790: 63 68 20 65 61 63 68 20 72 65 76 69 73 69 6f 6e ch each revision
17a0: 20 68 61 73 20 61 6e 0a 09 23 20 61 73 73 6f 63 has an..# assoc
17b0: 69 61 74 65 64 20 62 6c 6f 62 2e 20 48 6f 77 65 iated blob. Howe
17c0: 76 65 72 20 77 65 20 63 61 6e 20 68 61 76 65 20 ver we can have
17d0: 62 6c 6f 62 73 20 77 69 74 68 6f 75 74 0a 09 23 blobs without..#
17e0: 20 72 65 76 69 73 69 6f 6e 73 2e 20 54 68 69 73 revisions. This
17f0: 20 68 61 70 70 65 6e 73 20 69 66 20 61 20 6c 6f happens if a lo
1800: 67 69 63 61 6c 6c 79 20 69 72 72 65 6c 65 76 61 gically irreleva
1810: 6e 74 20 72 65 76 69 73 69 6f 6e 0a 09 23 20 69 nt revision..# i
1820: 73 20 72 65 6d 6f 76 65 64 2e 20 57 65 20 6d 61 s removed. We ma
1830: 79 20 68 6f 77 65 76 65 72 20 73 74 69 6c 6c 20 y however still
1840: 6e 65 65 64 20 69 74 73 20 62 6c 6f 62 20 74 6f need its blob to
1850: 20 63 6f 72 72 65 63 74 6c 79 0a 09 23 20 65 78 correctly..# ex
1860: 70 61 6e 64 20 6f 74 68 65 72 20 72 65 76 69 73 pand other revis
1870: 69 6f 6e 73 2c 20 62 6f 74 68 20 69 74 73 20 63 ions, both its c
1880: 6f 6e 74 65 6e 74 73 20 61 6e 64 20 66 6f 72 20 ontents and for
1890: 74 68 65 0a 09 23 20 6f 72 64 65 72 69 6e 67 2e the..# ordering.
18a0: 0a 0a 09 73 74 61 74 65 20 65 78 74 65 6e 64 20 ...state extend
18b0: 62 6c 6f 62 20 7b 0a 09 20 20 20 20 62 69 64 20 blob {.. bid
18c0: 20 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 INTEGER NOT NU
18d0: 4c 4c 20 20 50 52 49 4d 41 52 59 20 4b 45 59 20 LL PRIMARY KEY
18e0: 41 55 54 4f 49 4e 43 52 45 4d 45 4e 54 2c 0a 09 AUTOINCREMENT,..
18f0: 20 20 20 20 72 69 64 20 20 49 4e 54 45 47 45 52 rid INTEGER
1900: 20 20 20 20 20 20 20 20 20 20 20 20 52 45 46 45 REFE
1910: 52 45 4e 43 45 53 20 72 65 76 69 73 69 6f 6e 2c RENCES revision,
1920: 0a 09 20 20 20 20 66 69 64 20 20 49 4e 54 45 47 .. fid INTEG
1930: 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 52 45 ER NOT NULL RE
1940: 46 45 52 45 4e 43 45 53 20 66 69 6c 65 2c 20 20 FERENCES file,
1950: 20 2d 2d 20 46 69 6c 65 20 6f 77 6e 69 6e 67 20 -- File owning
1960: 62 6c 6f 62 2e 0a 0a 09 20 20 20 20 2d 2d 20 54 blob.... -- T
1970: 68 65 20 74 65 78 74 20 63 6f 6e 74 65 6e 74 20 he text content
1980: 69 73 20 61 6e 20 28 6f 66 66 73 65 74 2c 6c 65 is an (offset,le
1990: 6e 67 74 68 29 20 70 61 69 72 20 69 6e 74 6f 20 ngth) pair into
19a0: 74 68 65 0a 09 20 20 20 20 2d 2d 20 72 63 73 20 the.. -- rcs
19b0: 61 72 63 68 69 76 65 2e 20 46 6f 72 20 64 65 6c archive. For del
19c0: 74 61 73 20 77 65 20 61 64 64 69 74 69 6f 6e 61 tas we additiona
19d0: 6c 6c 79 20 72 65 66 65 72 20 74 6f 20 74 68 65 lly refer to the
19e0: 0a 09 20 20 20 20 2d 2d 20 70 61 72 65 6e 74 20 .. -- parent
19f0: 62 6c 6f 62 20 74 68 65 20 64 65 6c 74 61 20 69 blob the delta i
1a00: 73 20 6d 61 64 65 20 61 67 61 69 6e 73 74 2e 0a s made against..
1a10: 0a 09 20 20 20 20 63 6f 66 66 20 49 4e 54 45 47 .. coff INTEG
1a20: 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 2c 0a 09 20 ER NOT NULL,..
1a30: 20 20 20 63 6c 65 6e 20 49 4e 54 45 47 45 52 20 clen INTEGER
1a40: 20 4e 4f 54 20 4e 55 4c 4c 2c 0a 09 20 20 20 20 NOT NULL,..
1a50: 70 69 64 20 20 49 4e 54 45 47 45 52 20 20 20 20 pid INTEGER
1a60: 20 20 20 20 20 20 20 20 52 45 46 45 52 45 4e 43 REFERENC
1a70: 45 53 20 62 6c 6f 62 2c 0a 0a 09 20 20 20 20 55 ES blob,... U
1a80: 4e 49 51 55 45 20 28 72 69 64 29 0a 09 7d 20 7b NIQUE (rid)..} {
1a90: 20 66 69 64 20 7d 0a 09 23 20 49 6e 64 65 78 20 fid }..# Index
1aa0: 6f 6e 20 6f 77 6e 69 6e 67 20 66 69 6c 65 20 74 on owning file t
1ab0: 6f 20 63 6f 6c 6c 65 63 74 20 61 6c 6c 20 62 6c o collect all bl
1ac0: 6f 62 73 20 6f 66 20 61 20 66 69 6c 65 20 77 68 obs of a file wh
1ad0: 65 6e 20 74 68 65 0a 09 23 20 74 69 6d 65 20 66 en the..# time f
1ae0: 6f 72 20 69 74 73 20 65 78 70 61 6e 73 69 6f 6e or its expansion
1af0: 20 63 6f 6d 65 73 2e 0a 0a 09 73 74 61 74 65 20 comes....state
1b00: 65 78 74 65 6e 64 20 6f 70 74 79 70 65 20 7b 0a extend optype {.
1b10: 09 20 20 20 20 6f 69 64 20 20 20 49 4e 54 45 47 . oid INTEG
1b20: 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 50 52 ER NOT NULL PR
1b30: 49 4d 41 52 59 20 4b 45 59 2c 0a 09 20 20 20 20 IMARY KEY,..
1b40: 6e 61 6d 65 20 20 54 45 58 54 20 20 20 20 20 4e name TEXT N
1b50: 4f 54 20 4e 55 4c 4c 2c 0a 09 20 20 20 20 55 4e OT NULL,.. UN
1b60: 49 51 55 45 28 6e 61 6d 65 29 0a 09 7d 0a 09 73 IQUE(name)..}..s
1b70: 74 61 74 65 20 72 75 6e 20 7b 0a 09 20 20 20 20 tate run {..
1b80: 49 4e 53 45 52 54 20 49 4e 54 4f 20 6f 70 74 79 INSERT INTO opty
1b90: 70 65 20 56 41 4c 55 45 53 20 28 2d 31 2c 27 64 pe VALUES (-1,'d
1ba0: 65 6c 65 74 65 27 29 3b 20 20 2d 2d 20 54 68 65 elete'); -- The
1bb0: 20 6f 70 63 6f 64 65 20 6e 61 6d 65 73 20 61 72 opcode names ar
1bc0: 65 20 74 68 65 0a 09 20 20 20 20 49 4e 53 45 52 e the.. INSER
1bd0: 54 20 49 4e 54 4f 20 6f 70 74 79 70 65 20 56 41 T INTO optype VA
1be0: 4c 55 45 53 20 28 20 30 2c 27 6e 6f 74 68 69 6e LUES ( 0,'nothin
1bf0: 67 27 29 3b 20 2d 2d 20 66 69 78 65 64 20 70 69 g'); -- fixed pi
1c00: 65 63 65 73 2c 20 73 65 65 20 6d 79 6f 70 73 74 eces, see myopst
1c10: 61 74 65 0a 09 20 20 20 20 49 4e 53 45 52 54 20 ate.. INSERT
1c20: 49 4e 54 4f 20 6f 70 74 79 70 65 20 56 41 4c 55 INTO optype VALU
1c30: 45 53 20 28 20 31 2c 27 61 64 64 27 29 3b 20 20 ES ( 1,'add');
1c40: 20 20 20 2d 2d 20 69 6e 20 66 69 6c 65 3a 3a 72 -- in file::r
1c50: 65 76 2e 20 6d 79 6f 70 63 6f 64 65 20 69 73 0a ev. myopcode is.
1c60: 09 20 20 20 20 49 4e 53 45 52 54 20 49 4e 54 4f . INSERT INTO
1c70: 20 6f 70 74 79 70 65 20 56 41 4c 55 45 53 20 28 optype VALUES (
1c80: 20 32 2c 27 63 68 61 6e 67 65 27 29 3b 20 20 2d 2,'change'); -
1c90: 2d 20 6c 6f 61 64 65 64 20 66 72 6f 6d 20 74 68 - loaded from th
1ca0: 69 73 2e 0a 09 7d 0a 0a 09 73 74 61 74 65 20 65 is...}...state e
1cb0: 78 74 65 6e 64 20 72 65 76 69 73 69 6f 6e 62 72 xtend revisionbr
1cc0: 61 6e 63 68 63 68 69 6c 64 72 65 6e 20 7b 0a 09 anchchildren {..
1cd0: 20 20 20 20 2d 2d 20 54 68 65 20 6e 6f 6e 2d 70 -- The non-p
1ce0: 72 69 6d 61 72 79 20 63 68 69 6c 64 72 65 6e 20 rimary children
1cf0: 6f 66 20 61 20 72 65 76 69 73 69 6f 6e 2c 20 61 of a revision, a
1d00: 73 20 72 65 61 63 68 61 62 6c 65 0a 09 20 20 20 s reachable..
1d10: 20 2d 2d 20 74 68 72 6f 75 67 68 20 61 20 62 72 -- through a br
1d20: 61 6e 63 68 20 73 79 6d 62 6f 6c 2c 20 61 72 65 anch symbol, are
1d30: 20 6c 69 73 74 65 64 20 68 65 72 65 2e 20 54 68 listed here. Th
1d40: 69 73 20 69 73 0a 09 20 20 20 20 2d 2d 20 6e 65 is is.. -- ne
1d50: 65 64 65 64 20 62 79 20 70 61 73 73 20 35 20 74 eded by pass 5 t
1d60: 6f 20 62 72 65 61 6b 20 69 6e 74 65 72 6e 61 6c o break internal
1d70: 20 64 65 70 65 6e 64 65 6e 63 69 65 73 20 69 6e dependencies in
1d80: 20 61 0a 09 20 20 20 20 2d 2d 20 63 68 61 6e 67 a.. -- chang
1d90: 65 73 65 74 2e 0a 0a 09 20 20 20 20 72 69 64 20 eset.... rid
1da0: 20 20 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e INTEGER NOT N
1db0: 55 4c 4c 20 20 52 45 46 45 52 45 4e 43 45 53 20 ULL REFERENCES
1dc0: 72 65 76 69 73 69 6f 6e 2c 0a 09 20 20 20 20 62 revision,.. b
1dd0: 72 69 64 20 20 49 4e 54 45 47 45 52 20 20 4e 4f rid INTEGER NO
1de0: 54 20 4e 55 4c 4c 20 20 52 45 46 45 52 45 4e 43 T NULL REFERENC
1df0: 45 53 20 72 65 76 69 73 69 6f 6e 2c 0a 09 20 20 ES revision,..
1e00: 20 20 55 4e 49 51 55 45 28 72 69 64 2c 62 72 69 UNIQUE(rid,bri
1e10: 64 29 0a 09 7d 0a 0a 09 73 74 61 74 65 20 65 78 d)..}...state ex
1e20: 74 65 6e 64 20 74 61 67 20 7b 0a 09 20 20 20 20 tend tag {..
1e30: 74 69 64 20 20 49 4e 54 45 47 45 52 20 20 4e 4f tid INTEGER NO
1e40: 54 20 4e 55 4c 4c 20 20 50 52 49 4d 41 52 59 20 T NULL PRIMARY
1e50: 4b 45 59 20 41 55 54 4f 49 4e 43 52 45 4d 45 4e KEY AUTOINCREMEN
1e60: 54 2c 0a 09 20 20 20 20 66 69 64 20 20 49 4e 54 T,.. fid INT
1e70: 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 EGER NOT NULL
1e80: 52 45 46 45 52 45 4e 43 45 53 20 66 69 6c 65 2c REFERENCES file,
1e90: 20 20 20 20 20 2d 2d 20 46 69 6c 65 20 74 68 65 -- File the
1ea0: 20 69 74 65 6d 20 62 65 6c 6f 6e 67 73 20 74 6f item belongs to
1eb0: 0a 09 20 20 20 20 6c 6f 64 20 20 49 4e 54 45 47 .. lod INTEG
1ec0: 45 52 20 20 20 20 20 20 20 20 20 20 20 20 52 45 ER RE
1ed0: 46 45 52 45 4e 43 45 53 20 73 79 6d 62 6f 6c 2c FERENCES symbol,
1ee0: 20 20 20 2d 2d 20 4c 69 6e 65 20 6f 66 20 64 65 -- Line of de
1ef0: 76 65 6c 6f 70 6d 65 6e 74 20 28 4e 55 4c 4c 20 velopment (NULL
1f00: 3d 3e 20 54 72 75 6e 6b 29 0a 09 20 20 20 20 73 => Trunk).. s
1f10: 69 64 20 20 49 4e 54 45 47 45 52 20 20 4e 4f 54 id INTEGER NOT
1f20: 20 4e 55 4c 4c 20 20 52 45 46 45 52 45 4e 43 45 NULL REFERENCE
1f30: 53 20 73 79 6d 62 6f 6c 2c 20 20 20 2d 2d 20 53 S symbol, -- S
1f40: 79 6d 62 6f 6c 20 63 61 70 74 75 72 69 6e 67 20 ymbol capturing
1f50: 74 68 65 20 74 61 67 0a 0a 09 20 20 20 20 72 65 the tag... re
1f60: 76 20 20 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 v INTEGER NOT
1f70: 4e 55 4c 4c 20 20 52 45 46 45 52 45 4e 43 45 53 NULL REFERENCES
1f80: 20 72 65 76 69 73 69 6f 6e 20 20 2d 2d 20 54 68 revision -- Th
1f90: 65 20 72 65 76 69 73 69 6f 6e 20 62 65 69 6e 67 e revision being
1fa0: 20 74 61 67 67 65 64 2e 0a 09 7d 20 7b 20 72 65 tagged...} { re
1fb0: 76 20 73 69 64 20 7d 0a 09 23 20 49 6e 64 69 63 v sid }..# Indic
1fc0: 65 73 20 6f 6e 3a 20 72 65 76 20 28 72 65 76 69 es on: rev (revi
1fd0: 73 69 6f 6e 20 73 75 63 63 65 73 73 6f 72 73 29 sion successors)
1fe0: 0a 09 23 20 20 20 20 20 20 20 20 20 20 20 20 20 ..#
1ff0: 73 69 64 20 28 74 61 67 20 70 72 65 64 65 63 65 sid (tag predece
2000: 73 73 6f 72 73 2c 20 62 72 61 6e 63 68 20 73 75 ssors, branch su
2010: 63 63 65 73 73 6f 72 73 2f 70 72 65 64 65 63 65 ccessors/predece
2020: 73 73 6f 72 73 29 0a 0a 09 73 74 61 74 65 20 65 ssors)...state e
2030: 78 74 65 6e 64 20 62 72 61 6e 63 68 20 7b 0a 09 xtend branch {..
2040: 20 20 20 20 62 69 64 20 20 20 49 4e 54 45 47 45 bid INTEGE
2050: 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 50 52 49 R NOT NULL PRI
2060: 4d 41 52 59 20 4b 45 59 20 41 55 54 4f 49 4e 43 MARY KEY AUTOINC
2070: 52 45 4d 45 4e 54 2c 0a 09 20 20 20 20 66 69 64 REMENT,.. fid
2080: 20 20 20 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 INTEGER NOT
2090: 4e 55 4c 4c 20 20 52 45 46 45 52 45 4e 43 45 53 NULL REFERENCES
20a0: 20 66 69 6c 65 2c 20 20 20 20 20 2d 2d 20 46 69 file, -- Fi
20b0: 6c 65 20 74 68 65 20 69 74 65 6d 20 62 65 6c 6f le the item belo
20c0: 6e 67 73 20 74 6f 0a 09 20 20 20 20 6c 6f 64 20 ngs to.. lod
20d0: 20 20 49 4e 54 45 47 45 52 20 20 20 20 20 20 20 INTEGER
20e0: 20 20 20 20 20 52 45 46 45 52 45 4e 43 45 53 20 REFERENCES
20f0: 73 79 6d 62 6f 6c 2c 20 20 20 2d 2d 20 4c 69 6e symbol, -- Lin
2100: 65 20 6f 66 20 64 65 76 65 6c 6f 70 6d 65 6e 74 e of development
2110: 20 28 4e 55 4c 4c 20 3d 3e 20 54 72 75 6e 6b 29 (NULL => Trunk)
2120: 0a 09 20 20 20 20 73 69 64 20 20 20 49 4e 54 45 .. sid INTE
2130: 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 52 GER NOT NULL R
2140: 45 46 45 52 45 4e 43 45 53 20 73 79 6d 62 6f 6c EFERENCES symbol
2150: 2c 20 20 20 2d 2d 20 53 79 6d 62 6f 6c 20 63 61 , -- Symbol ca
2160: 70 74 75 72 69 6e 67 20 74 68 65 20 62 72 61 6e pturing the bran
2170: 63 68 0a 0a 09 20 20 20 20 72 6f 6f 74 20 20 49 ch... root I
2180: 4e 54 45 47 45 52 20 20 20 20 20 20 20 20 20 20 NTEGER
2190: 20 20 52 45 46 45 52 45 4e 43 45 53 20 72 65 76 REFERENCES rev
21a0: 69 73 69 6f 6e 2c 20 2d 2d 20 52 65 76 69 73 69 ision, -- Revisi
21b0: 6f 6e 20 74 68 65 20 62 72 61 6e 63 68 20 73 70 on the branch sp
21c0: 72 6f 75 74 73 20 66 72 6f 6d 0a 09 20 20 20 20 routs from..
21d0: 66 69 72 73 74 20 49 4e 54 45 47 45 52 20 20 20 first INTEGER
21e0: 20 20 20 20 20 20 20 20 20 52 45 46 45 52 45 4e REFEREN
21f0: 43 45 53 20 72 65 76 69 73 69 6f 6e 2c 20 2d 2d CES revision, --
2200: 20 46 69 72 73 74 20 72 65 76 69 73 69 6f 6e 20 First revision
2210: 63 6f 6d 6d 69 74 74 65 64 20 74 6f 20 74 68 65 committed to the
2220: 20 62 72 61 6e 63 68 0a 09 20 20 20 20 62 72 61 branch.. bra
2230: 20 20 20 54 45 58 54 20 20 20 20 20 4e 4f 54 20 TEXT NOT
2240: 4e 55 4c 4c 2c 20 20 20 20 20 20 20 20 20 20 20 NULL,
2250: 20 20 20 20 20 20 20 20 20 20 20 2d 2d 20 62 72 -- br
2260: 61 6e 63 68 20 6e 75 6d 62 65 72 0a 09 20 20 20 anch number..
2270: 20 70 6f 73 20 20 20 49 4e 54 45 47 45 52 20 20 pos INTEGER
2280: 4e 4f 54 20 4e 55 4c 4c 20 20 20 20 20 20 20 20 NOT NULL
2290: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2d -
22a0: 2d 20 63 72 65 61 74 69 6f 6e 20 6f 72 64 65 72 - creation order
22b0: 20 69 6e 20 72 6f 6f 74 2e 0a 0a 09 20 20 20 20 in root....
22c0: 2d 2d 20 41 20 62 72 61 6e 63 68 20 63 61 6e 20 -- A branch can
22d0: 65 78 69 73 74 20 77 69 74 68 6f 75 74 20 72 6f exist without ro
22e0: 6f 74 2e 20 49 74 20 68 61 70 70 65 6e 73 20 77 ot. It happens w
22f0: 68 65 6e 20 74 68 65 0a 20 20 20 20 20 20 20 20 hen the.
2300: 20 20 20 20 2d 2d 20 6f 6e 6c 79 20 72 65 76 69 -- only revi
2310: 73 69 6f 6e 20 6f 6e 20 74 72 75 6e 6b 20 69 73 sion on trunk is
2320: 20 74 68 65 20 75 6e 6e 65 63 65 73 73 61 72 79 the unnecessary
2330: 20 64 65 61 64 20 6f 6e 65 20 74 68 65 0a 20 20 dead one the.
2340: 20 20 20 20 20 20 20 20 20 20 2d 2d 20 62 72 61 -- bra
2350: 6e 63 68 20 77 61 73 20 73 70 72 6f 75 74 65 64 nch was sprouted
2360: 20 66 72 6f 6d 20 61 6e 64 20 69 74 20 68 61 73 from and it has
2370: 20 63 6f 6d 6d 69 74 73 2e 20 54 68 65 20 62 72 commits. The br
2380: 61 6e 63 68 0a 20 20 20 20 20 20 20 20 20 20 20 anch.
2390: 20 2d 2d 20 77 69 6c 6c 20 65 78 69 73 74 20 74 -- will exist t
23a0: 6f 20 62 65 20 74 68 65 20 4c 4f 44 20 6f 66 20 o be the LOD of
23b0: 69 74 73 20 72 65 76 69 73 69 6f 6e 73 2c 20 6e its revisions, n
23c0: 6f 74 68 69 6e 67 20 74 6f 0a 20 20 20 20 20 20 othing to.
23d0: 20 20 20 20 20 20 2d 2d 20 73 70 72 6f 75 74 20 -- sprout
23e0: 66 72 6f 6d 2c 20 74 68 65 20 64 65 61 64 20 72 from, the dead r
23f0: 65 76 69 73 69 6f 6e 20 77 61 73 20 72 65 6d 6f evision was remo
2400: 76 65 64 2c 20 68 65 6e 63 65 20 6e 6f 0a 20 20 ved, hence no.
2410: 20 20 20 20 20 20 20 20 20 20 2d 2d 20 72 6f 6f -- roo
2420: 74 2e 0a 09 7d 20 7b 20 72 6f 6f 74 20 66 69 72 t...} { root fir
2430: 73 74 20 73 69 64 20 7d 0a 09 23 20 49 6e 64 69 st sid }..# Indi
2440: 63 65 73 20 6f 6e 3a 20 72 6f 6f 74 20 20 28 72 ces on: root (r
2450: 65 76 69 73 69 6f 6e 20 73 75 63 63 65 73 73 6f evision successo
2460: 72 73 29 0a 09 23 20 20 20 20 20 20 20 20 20 20 rs)..#
2470: 20 20 20 66 69 72 73 74 20 28 72 65 76 69 73 69 first (revisi
2480: 6f 6e 20 70 72 65 64 65 63 65 73 73 6f 72 73 29 on predecessors)
2490: 0a 09 23 20 20 20 20 20 20 20 20 20 20 20 20 20 ..#
24a0: 73 69 64 20 20 20 28 74 61 67 20 70 72 65 64 65 sid (tag prede
24b0: 63 65 73 73 6f 72 73 2c 20 62 72 61 6e 63 68 20 cessors, branch
24c0: 73 75 63 63 65 73 73 6f 72 73 2f 70 72 65 64 65 successors/prede
24d0: 63 65 73 73 6f 72 73 29 0a 0a 09 23 20 50 72 6f cessors)...# Pro
24e0: 6a 65 63 74 20 6c 65 76 65 6c 20 2e 2e 2e 0a 09 ject level .....
24f0: 23 09 70 4c 69 6e 65 4f 66 44 65 76 65 6c 6f 70 #.pLineOfDevelop
2500: 6d 65 6e 74 2c 20 70 53 79 6d 62 6f 6c 2c 20 70 ment, pSymbol, p
2510: 42 72 61 6e 63 68 2c 20 70 54 61 67 2c 20 70 54 Branch, pTag, pT
2520: 72 75 6e 6b 0a 09 23 0a 09 23 09 70 54 72 75 6e runk..#..#.pTrun
2530: 6b 20 20 3c 2d 20 70 4c 69 6e 65 4f 66 44 65 76 k <- pLineOfDev
2540: 65 6c 6f 70 6d 65 6e 74 0a 09 23 09 70 42 72 61 elopment..#.pBra
2550: 6e 63 68 20 3c 2d 20 70 53 79 6d 62 6f 6c 2c 20 nch <- pSymbol,
2560: 70 4c 69 6e 65 4f 66 44 65 76 65 6c 6f 70 6d 65 pLineOfDevelopme
2570: 6e 74 0a 09 23 09 70 54 61 67 20 20 20 20 3c 2d nt..#.pTag <-
2580: 20 70 53 79 6d 62 6f 6c 2c 20 70 4c 69 6e 65 4f pSymbol, pLineO
2590: 66 44 65 76 65 6c 6f 70 6d 65 6e 74 0a 0a 09 73 fDevelopment...s
25a0: 74 61 74 65 20 65 78 74 65 6e 64 20 73 79 6d 62 tate extend symb
25b0: 6f 6c 20 7b 0a 09 20 20 20 20 73 69 64 20 20 49 ol {.. sid I
25c0: 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c NTEGER NOT NULL
25d0: 20 20 50 52 49 4d 41 52 59 20 4b 45 59 20 41 55 PRIMARY KEY AU
25e0: 54 4f 49 4e 43 52 45 4d 45 4e 54 2c 0a 09 20 20 TOINCREMENT,..
25f0: 20 20 70 69 64 20 20 49 4e 54 45 47 45 52 20 20 pid INTEGER
2600: 4e 4f 54 20 4e 55 4c 4c 20 20 52 45 46 45 52 45 NOT NULL REFERE
2610: 4e 43 45 53 20 70 72 6f 6a 65 63 74 2c 20 20 2d NCES project, -
2620: 2d 20 50 72 6f 6a 65 63 74 20 74 68 65 20 73 79 - Project the sy
2630: 6d 62 6f 6c 20 62 65 6c 6f 6e 67 73 20 74 6f 0a mbol belongs to.
2640: 09 20 20 20 20 6e 61 6d 65 20 54 45 58 54 20 20 . name TEXT
2650: 20 20 20 4e 4f 54 20 4e 55 4c 4c 2c 0a 09 20 20 NOT NULL,..
2660: 20 20 74 79 70 65 20 49 4e 54 45 47 45 52 20 20 type INTEGER
2670: 4e 4f 54 20 4e 55 4c 4c 20 20 52 45 46 45 52 45 NOT NULL REFERE
2680: 4e 43 45 53 20 73 79 6d 74 79 70 65 2c 20 20 2d NCES symtype, -
2690: 2d 20 65 6e 75 6d 20 7b 20 65 78 63 6c 75 64 65 - enum { exclude
26a0: 64 20 3d 20 30 2c 20 74 61 67 2c 20 62 72 61 6e d = 0, tag, bran
26b0: 63 68 2c 20 75 6e 64 65 66 69 6e 65 64 20 7d 0a ch, undefined }.
26c0: 0a 09 20 20 20 20 74 61 67 5f 63 6f 75 6e 74 20 .. tag_count
26d0: 20 20 20 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 INTEGER NOT
26e0: 4e 55 4c 4c 2c 20 2d 2d 20 48 6f 77 20 6f 66 74 NULL, -- How oft
26f0: 65 6e 20 74 68 65 20 73 79 6d 62 6f 6c 20 69 73 en the symbol is
2700: 20 75 73 65 64 20 61 73 20 74 61 67 2e 0a 09 20 used as tag...
2710: 20 20 20 62 72 61 6e 63 68 5f 63 6f 75 6e 74 20 branch_count
2720: 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c INTEGER NOT NUL
2730: 4c 2c 20 2d 2d 20 48 6f 77 20 6f 66 74 65 6e 20 L, -- How often
2740: 74 68 65 20 73 79 6d 62 6f 6c 20 69 73 20 75 73 the symbol is us
2750: 65 64 20 61 73 20 62 72 61 6e 63 68 0a 09 20 20 ed as branch..
2760: 20 20 63 6f 6d 6d 69 74 5f 63 6f 75 6e 74 20 49 commit_count I
2770: 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c NTEGER NOT NULL
2780: 2c 20 2d 2d 20 48 6f 77 20 6f 66 74 65 6e 20 61 , -- How often a
2790: 20 66 69 6c 65 20 77 61 73 20 63 6f 6d 6d 69 74 file was commit
27a0: 74 65 64 20 6f 6e 20 74 68 65 20 73 79 6d 62 6f ted on the symbo
27b0: 6c 0a 0a 09 20 20 20 20 55 4e 49 51 55 45 20 28 l... UNIQUE (
27c0: 70 69 64 2c 20 6e 61 6d 65 29 20 2d 2d 20 53 79 pid, name) -- Sy
27d0: 6d 62 6f 6c 73 20 61 72 65 20 75 6e 69 71 75 65 mbols are unique
27e0: 20 77 69 74 68 69 6e 20 74 68 65 20 70 72 6f 6a within the proj
27f0: 65 63 74 0a 09 7d 0a 0a 09 73 74 61 74 65 20 65 ect..}...state e
2800: 78 74 65 6e 64 20 62 6c 6f 63 6b 65 72 20 7b 0a xtend blocker {.
2810: 09 20 20 20 20 2d 2d 20 46 6f 72 20 65 61 63 68 . -- For each
2820: 20 73 79 6d 62 6f 6c 20 77 65 20 73 61 76 65 20 symbol we save
2830: 77 68 69 63 68 20 6f 74 68 65 72 20 73 79 6d 62 which other symb
2840: 6f 6c 73 20 61 72 65 0a 09 20 20 20 20 2d 2d 20 ols are.. --
2850: 62 6c 6f 63 6b 69 6e 67 20 69 74 73 20 72 65 6d blocking its rem
2860: 6f 76 61 6c 20 28 69 66 20 74 68 65 20 75 73 65 oval (if the use
2870: 72 20 61 73 6b 73 20 66 6f 72 20 69 74 29 2e 0a r asks for it)..
2880: 0a 09 20 20 20 20 73 69 64 20 49 4e 54 45 47 45 .. sid INTEGE
2890: 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 52 45 46 R NOT NULL REF
28a0: 45 52 45 4e 43 45 53 20 73 79 6d 62 6f 6c 2c 20 ERENCES symbol,
28b0: 2d 2d 0a 09 20 20 20 20 62 69 64 20 49 4e 54 45 --.. bid INTE
28c0: 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 52 GER NOT NULL R
28d0: 45 46 45 52 45 4e 43 45 53 20 73 79 6d 62 6f 6c EFERENCES symbol
28e0: 2c 20 2d 2d 20 53 70 72 6f 75 74 65 64 20 66 72 , -- Sprouted fr
28f0: 6f 6d 20 73 69 64 2c 20 62 6c 6f 63 6b 73 20 69 om sid, blocks i
2900: 74 2e 0a 09 20 20 20 20 55 4e 49 51 55 45 20 28 t... UNIQUE (
2910: 73 69 64 2c 20 62 69 64 29 0a 09 7d 0a 0a 09 73 sid, bid)..}...s
2920: 74 61 74 65 20 65 78 74 65 6e 64 20 70 61 72 65 tate extend pare
2930: 6e 74 20 7b 0a 09 20 20 20 20 2d 2d 20 46 6f 72 nt {.. -- For
2940: 20 65 61 63 68 20 73 79 6d 62 6f 6c 20 77 65 20 each symbol we
2950: 73 61 76 65 20 77 68 69 63 68 20 6f 74 68 65 72 save which other
2960: 20 73 79 6d 62 6f 6c 73 20 63 61 6e 20 61 63 74 symbols can act
2970: 20 61 73 0a 09 20 20 20 20 2d 2d 20 61 20 70 6f as.. -- a po
2980: 73 73 69 62 6c 65 20 70 61 72 65 6e 74 20 69 6e ssible parent in
2990: 20 73 6f 6d 65 20 66 69 6c 65 2c 20 61 6e 64 20 some file, and
29a0: 68 6f 77 20 6f 66 74 65 6e 2e 0a 0a 09 20 20 20 how often....
29b0: 20 73 69 64 20 49 4e 54 45 47 45 52 20 20 4e 4f sid INTEGER NO
29c0: 54 20 4e 55 4c 4c 20 20 52 45 46 45 52 45 4e 43 T NULL REFERENC
29d0: 45 53 20 73 79 6d 62 6f 6c 2c 20 2d 2d 0a 09 20 ES symbol, --..
29e0: 20 20 20 70 69 64 20 49 4e 54 45 47 45 52 20 20 pid INTEGER
29f0: 4e 4f 54 20 4e 55 4c 4c 20 20 52 45 46 45 52 45 NOT NULL REFERE
2a00: 4e 43 45 53 20 73 79 6d 62 6f 6c 2c 20 2d 2d 20 NCES symbol, --
2a10: 50 6f 73 73 69 62 6c 65 20 70 61 72 65 6e 74 20 Possible parent
2a20: 6f 66 20 73 69 64 0a 09 20 20 20 20 6e 20 20 20 of sid.. n
2a30: 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c INTEGER NOT NUL
2a40: 4c 2c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 L,
2a50: 20 20 20 20 20 20 2d 2d 20 48 6f 77 20 6f 66 74 -- How oft
2a60: 65 6e 20 70 69 64 20 63 61 6e 20 61 63 74 20 61 en pid can act a
2a70: 73 20 70 61 72 65 6e 74 2e 0a 09 20 20 20 20 55 s parent... U
2a80: 4e 49 51 55 45 20 28 73 69 64 2c 20 70 69 64 29 NIQUE (sid, pid)
2a90: 0a 09 7d 0a 0a 09 73 74 61 74 65 20 65 78 74 65 ..}...state exte
2aa0: 6e 64 20 73 79 6d 74 79 70 65 20 7b 0a 09 20 20 nd symtype {..
2ab0: 20 20 74 69 64 20 20 20 20 49 4e 54 45 47 45 52 tid INTEGER
2ac0: 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 50 52 49 4d NOT NULL PRIM
2ad0: 41 52 59 20 4b 45 59 2c 0a 09 20 20 20 20 6e 61 ARY KEY,.. na
2ae0: 6d 65 20 20 20 54 45 58 54 20 20 20 20 20 4e 4f me TEXT NO
2af0: 54 20 4e 55 4c 4c 2c 0a 09 20 20 20 20 70 6c 75 T NULL,.. plu
2b00: 72 61 6c 20 54 45 58 54 20 20 20 20 20 4e 4f 54 ral TEXT NOT
2b10: 20 4e 55 4c 4c 2c 0a 09 20 20 20 20 55 4e 49 51 NULL,.. UNIQ
2b20: 55 45 20 28 6e 61 6d 65 29 0a 09 20 20 20 20 55 UE (name).. U
2b30: 4e 49 51 55 45 20 28 70 6c 75 72 61 6c 29 0a 09 NIQUE (plural)..
2b40: 7d 0a 09 73 74 61 74 65 20 72 75 6e 20 7b 0a 09 }..state run {..
2b50: 20 20 20 20 49 4e 53 45 52 54 20 49 4e 54 4f 20 INSERT INTO
2b60: 73 79 6d 74 79 70 65 20 56 41 4c 55 45 53 20 28 symtype VALUES (
2b70: 30 2c 27 65 78 63 6c 75 64 65 64 27 2c 20 27 65 0,'excluded', 'e
2b80: 78 63 6c 75 64 65 64 27 29 3b 20 20 2d 2d 20 54 xcluded'); -- T
2b90: 68 65 20 69 64 73 20 61 72 65 20 74 68 65 20 66 he ids are the f
2ba0: 69 78 65 64 0a 09 20 20 20 20 49 4e 53 45 52 54 ixed.. INSERT
2bb0: 20 49 4e 54 4f 20 73 79 6d 74 79 70 65 20 56 41 INTO symtype VA
2bc0: 4c 55 45 53 20 28 31 2c 27 74 61 67 27 2c 20 20 LUES (1,'tag',
2bd0: 20 20 20 20 27 74 61 67 73 27 29 3b 20 20 20 20 'tags');
2be0: 20 20 2d 2d 20 70 69 65 63 65 73 2c 20 73 65 65 -- pieces, see
2bf0: 20 70 72 6f 6a 65 63 74 3a 3a 73 79 6d 2c 0a 09 project::sym,..
2c00: 20 20 20 20 49 4e 53 45 52 54 20 49 4e 54 4f 20 INSERT INTO
2c10: 73 79 6d 74 79 70 65 20 56 41 4c 55 45 53 20 28 symtype VALUES (
2c20: 32 2c 27 62 72 61 6e 63 68 27 2c 20 20 20 27 62 2,'branch', 'b
2c30: 72 61 6e 63 68 65 73 27 29 3b 20 20 2d 2d 20 67 ranches'); -- g
2c40: 65 74 73 79 6d 74 79 70 65 73 20 61 6e 64 20 61 etsymtypes and a
2c50: 73 73 6f 63 69 61 74 65 64 0a 09 20 20 20 20 49 ssociated.. I
2c60: 4e 53 45 52 54 20 49 4e 54 4f 20 73 79 6d 74 79 NSERT INTO symty
2c70: 70 65 20 56 41 4c 55 45 53 20 28 33 2c 27 75 6e pe VALUES (3,'un
2c80: 64 65 66 69 6e 65 64 27 2c 27 75 6e 64 65 66 69 defined','undefi
2c90: 6e 65 64 27 29 3b 20 2d 2d 20 74 79 70 65 76 61 ned'); -- typeva
2ca0: 72 69 61 62 6c 65 73 2e 0a 09 7d 0a 0a 09 73 74 riables...}...st
2cb0: 61 74 65 20 65 78 74 65 6e 64 20 6d 65 74 61 20 ate extend meta
2cc0: 7b 0a 09 20 20 20 20 2d 2d 20 4d 65 74 61 20 64 {.. -- Meta d
2cd0: 61 74 61 20 6f 66 20 72 65 76 69 73 69 6f 6e 73 ata of revisions
2ce0: 2e 20 53 65 65 20 72 65 76 69 73 69 6f 6e 2e 6d . See revision.m
2cf0: 69 64 20 66 6f 72 20 74 68 65 0a 09 20 20 20 20 id for the..
2d00: 2d 2d 20 72 65 66 65 72 65 6e 63 65 2e 20 4d 61 -- reference. Ma
2d10: 6e 79 20 72 65 76 69 73 69 6f 6e 73 20 63 61 6e ny revisions can
2d20: 20 73 68 61 72 65 20 6d 65 74 61 20 64 61 74 61 share meta data
2d30: 2e 20 54 68 69 73 20 69 73 0a 09 20 20 20 20 2d . This is.. -
2d40: 2d 20 61 63 74 75 61 6c 6c 79 20 6f 6e 65 20 6f - actually one o
2d50: 66 20 74 68 65 20 63 72 69 74 65 72 69 6f 6e 73 f the criterions
2d60: 20 75 73 65 64 20 74 6f 20 73 6f 72 74 20 72 65 used to sort re
2d70: 76 69 73 69 6f 6e 73 0a 09 20 20 20 20 2d 2d 20 visions.. --
2d80: 69 6e 74 6f 20 63 68 61 6e 67 65 73 65 74 73 2e into changesets.
2d90: 0a 0a 09 20 20 20 20 6d 69 64 20 49 4e 54 45 47 ... mid INTEG
2da0: 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 50 52 ER NOT NULL PR
2db0: 49 4d 41 52 59 20 4b 45 59 20 20 41 55 54 4f 49 IMARY KEY AUTOI
2dc0: 4e 43 52 45 4d 45 4e 54 2c 0a 0a 09 20 20 20 20 NCREMENT,...
2dd0: 2d 2d 20 4d 65 74 61 20 64 61 74 61 20 62 65 6c -- Meta data bel
2de0: 6f 6e 67 73 20 74 6f 20 61 20 73 70 65 63 69 66 ongs to a specif
2df0: 69 63 20 70 72 6f 6a 65 63 74 2c 20 73 74 72 6f ic project, stro
2e00: 6e 67 65 72 2c 20 74 6f 20 61 0a 09 20 20 20 20 nger, to a..
2e10: 2d 2d 20 62 72 61 6e 63 68 20 69 6e 20 74 68 61 -- branch in tha
2e20: 74 20 70 72 6f 6a 65 63 74 2e 20 49 74 20 66 75 t project. It fu
2e30: 72 74 68 65 72 20 68 61 73 20 61 20 6c 6f 67 20 rther has a log
2e40: 6d 65 73 73 61 67 65 2c 0a 09 20 20 20 20 2d 2d message,.. --
2e50: 20 61 6e 64 20 69 74 73 20 61 75 74 68 6f 72 2e and its author.
2e60: 20 54 68 69 73 20 69 73 20 75 6e 69 71 75 65 20 This is unique
2e70: 77 69 74 68 20 74 68 65 20 70 72 6f 6a 65 63 74 with the project
2e80: 20 61 6e 64 0a 09 20 20 20 20 2d 2d 20 62 72 61 and.. -- bra
2e90: 6e 63 68 2e 0a 0a 09 20 20 20 20 70 69 64 20 49 nch.... pid I
2ea0: 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c NTEGER NOT NULL
2eb0: 20 20 52 45 46 45 52 45 4e 43 45 53 20 70 72 6f REFERENCES pro
2ec0: 6a 65 63 74 2c 20 20 2d 2d 0a 09 20 20 20 20 62 ject, --.. b
2ed0: 69 64 20 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 id INTEGER NOT
2ee0: 4e 55 4c 4c 20 20 52 45 46 45 52 45 4e 43 45 53 NULL REFERENCES
2ef0: 20 73 79 6d 62 6f 6c 2c 20 20 20 2d 2d 0a 09 20 symbol, --..
2f00: 20 20 20 61 69 64 20 49 4e 54 45 47 45 52 20 20 aid INTEGER
2f10: 4e 4f 54 20 4e 55 4c 4c 20 20 52 45 46 45 52 45 NOT NULL REFERE
2f20: 4e 43 45 53 20 61 75 74 68 6f 72 2c 20 20 20 2d NCES author, -
2f30: 2d 0a 09 20 20 20 20 63 69 64 20 49 4e 54 45 47 -.. cid INTEG
2f40: 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 52 45 ER NOT NULL RE
2f50: 46 45 52 45 4e 43 45 53 20 63 6d 65 73 73 61 67 FERENCES cmessag
2f60: 65 2c 20 2d 2d 0a 0a 09 20 20 20 20 55 4e 49 51 e, --... UNIQ
2f70: 55 45 20 28 70 69 64 2c 20 62 69 64 2c 20 61 69 UE (pid, bid, ai
2f80: 64 2c 20 63 69 64 29 0a 0a 09 20 20 20 20 2d 2d d, cid)... --
2f90: 20 43 6f 6e 73 74 72 61 69 6e 74 73 3a 20 54 68 Constraints: Th
2fa0: 65 20 70 72 6f 6a 65 63 74 20 6f 66 20 74 68 65 e project of the
2fb0: 20 6d 65 74 61 20 64 61 74 61 20 6f 66 20 61 20 meta data of a
2fc0: 72 65 76 69 73 69 6f 6e 0a 09 20 20 20 20 2d 2d revision.. --
2fd0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 58 20 X
2fe0: 69 73 20 74 68 65 20 73 61 6d 65 20 61 73 20 74 is the same as t
2ff0: 68 65 20 70 72 6f 6a 65 63 74 20 6f 66 20 58 20 he project of X
3000: 69 74 73 65 6c 66 2e 0a 09 20 20 20 20 2d 2d 0a itself... --.
3010: 09 20 20 20 20 2d 2d 20 2e 2e 2e 2e 2e 2e 2e 2e . -- ........
3020: 2e 2e 2e 2e 20 54 68 65 20 62 72 61 6e 63 68 20 .... The branch
3030: 6f 66 20 74 68 65 20 6d 65 74 61 20 64 61 74 61 of the meta data
3040: 20 6f 66 20 61 20 72 65 76 69 73 69 6f 6e 0a 09 of a revision..
3050: 20 20 20 20 2d 2d 20 20 20 20 20 20 20 20 20 20 --
3060: 20 20 20 20 58 20 69 73 20 74 68 65 20 73 61 6d X is the sam
3070: 65 20 61 73 20 74 68 65 20 6c 69 6e 65 20 6f 66 e as the line of
3080: 20 64 65 76 65 6c 6f 70 6d 65 6e 74 0a 09 20 20 development..
3090: 20 20 2d 2d 20 20 20 20 20 20 20 20 20 20 20 20 --
30a0: 20 20 6f 66 20 58 20 69 74 73 65 6c 66 2e 0a 09 of X itself...
30b0: 7d 0a 0a 09 23 20 41 75 74 68 6f 72 73 20 61 6e }...# Authors an
30c0: 64 20 63 6f 6d 6d 69 74 20 6d 65 73 73 61 67 65 d commit message
30d0: 73 20 61 72 65 20 66 75 6c 6c 79 20 67 6c 6f 62 s are fully glob
30e0: 61 6c 2c 20 69 2e 65 2e 20 70 65 72 0a 09 23 20 al, i.e. per..#
30f0: 72 65 70 6f 73 69 74 6f 72 79 2e 0a 0a 09 73 74 repository....st
3100: 61 74 65 20 65 78 74 65 6e 64 20 61 75 74 68 6f ate extend autho
3110: 72 20 7b 0a 09 20 20 20 20 61 69 64 20 20 49 4e r {.. aid IN
3120: 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 TEGER NOT NULL
3130: 20 50 52 49 4d 41 52 59 20 4b 45 59 20 20 41 55 PRIMARY KEY AU
3140: 54 4f 49 4e 43 52 45 4d 45 4e 54 2c 20 2d 2d 20 TOINCREMENT, --
3150: 50 6f 6f 6c 20 6f 66 20 74 68 65 20 75 6e 69 71 Pool of the uniq
3160: 75 65 0a 09 20 20 20 20 6e 61 6d 65 20 54 45 58 ue.. name TEX
3170: 54 20 20 20 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 T NOT NULL
3180: 55 4e 49 51 55 45 20 20 20 20 20 20 20 20 20 20 UNIQUE
3190: 20 20 20 20 20 20 20 20 20 20 20 20 2d 2d 20 61 -- a
31a0: 75 74 68 6f 72 20 6e 61 6d 65 73 2e 0a 09 7d 0a uthor names...}.
31b0: 0a 09 73 74 61 74 65 20 65 78 74 65 6e 64 20 63 ..state extend c
31c0: 6d 65 73 73 61 67 65 20 7b 0a 09 20 20 20 20 63 message {.. c
31d0: 69 64 20 20 49 4e 54 45 47 45 52 20 20 4e 4f 54 id INTEGER NOT
31e0: 20 4e 55 4c 4c 20 20 50 52 49 4d 41 52 59 20 4b NULL PRIMARY K
31f0: 45 59 20 20 41 55 54 4f 49 4e 43 52 45 4d 45 4e EY AUTOINCREMEN
3200: 54 2c 20 2d 2d 20 50 6f 6f 6c 20 6f 66 20 74 68 T, -- Pool of th
3210: 65 20 75 6e 69 71 75 65 0a 09 20 20 20 20 74 65 e unique.. te
3220: 78 74 20 54 45 58 54 20 20 20 20 20 4e 4f 54 20 xt TEXT NOT
3230: 4e 55 4c 4c 20 20 55 4e 49 51 55 45 20 20 20 20 NULL UNIQUE
3240: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
3250: 20 20 2d 2d 20 6c 6f 67 20 6d 65 73 73 61 67 65 -- log message
3260: 73 0a 09 7d 0a 0a 09 70 72 6f 6a 65 63 74 3a 3a s..}...project::
3270: 73 79 6d 20 67 65 74 73 79 6d 74 79 70 65 73 0a sym getsymtypes.
3280: 09 66 69 6c 65 3a 3a 72 65 76 20 20 20 20 67 65 .file::rev ge
3290: 74 6f 70 63 6f 64 65 73 0a 09 72 65 74 75 72 6e topcodes..return
32a0: 0a 20 20 20 20 7d 0a 0a 20 20 20 20 74 79 70 65 . }.. type
32b0: 6d 65 74 68 6f 64 20 6c 6f 61 64 20 7b 7d 20 7b method load {} {
32c0: 0a 09 73 74 61 74 65 20 75 73 65 20 73 79 6d 62 ..state use symb
32d0: 6f 6c 0a 09 73 74 61 74 65 20 75 73 65 20 73 79 ol..state use sy
32e0: 6d 74 79 70 65 0a 09 73 74 61 74 65 20 75 73 65 mtype..state use
32f0: 20 6f 70 74 79 70 65 0a 0a 09 70 72 6f 6a 65 63 optype...projec
3300: 74 3a 3a 73 79 6d 20 67 65 74 73 79 6d 74 79 70 t::sym getsymtyp
3310: 65 73 0a 09 66 69 6c 65 3a 3a 72 65 76 20 20 20 es..file::rev
3320: 20 67 65 74 6f 70 63 6f 64 65 73 0a 09 72 65 70 getopcodes..rep
3330: 6f 73 69 74 6f 72 79 20 20 20 6c 6f 61 64 73 79 ository loadsy
3340: 6d 62 6f 6c 73 0a 09 72 65 74 75 72 6e 0a 20 20 mbols..return.
3350: 20 20 7d 0a 0a 20 20 20 20 74 79 70 65 6d 65 74 }.. typemet
3360: 68 6f 64 20 72 75 6e 20 7b 7d 20 7b 0a 09 23 20 hod run {} {..#
3370: 50 61 73 73 20 6d 61 6e 61 67 65 72 20 69 6e 74 Pass manager int
3380: 65 72 66 61 63 65 2e 20 45 78 65 63 75 74 65 64 erface. Executed
3390: 20 74 6f 20 70 65 72 66 6f 72 6d 20 74 68 65 0a to perform the.
33a0: 09 23 20 66 75 6e 63 74 69 6f 6e 61 6c 69 74 79 .# functionality
33b0: 20 6f 66 20 74 68 65 20 70 61 73 73 2e 0a 0a 09 of the pass....
33c0: 73 65 74 20 72 62 61 73 65 20 5b 72 65 70 6f 73 set rbase [repos
33d0: 69 74 6f 72 79 20 62 61 73 65 3f 5d 0a 09 66 6f itory base?]..fo
33e0: 72 65 61 63 68 20 70 72 6f 6a 65 63 74 20 5b 72 reach project [r
33f0: 65 70 6f 73 69 74 6f 72 79 20 70 72 6f 6a 65 63 epository projec
3400: 74 73 5d 20 7b 0a 09 20 20 20 20 73 65 74 20 62 ts] {.. set b
3410: 61 73 65 20 5b 3a 3a 66 69 6c 65 20 6a 6f 69 6e ase [::file join
3420: 20 24 72 62 61 73 65 20 5b 24 70 72 6f 6a 65 63 $rbase [$projec
3430: 74 20 62 61 73 65 5d 5d 0a 09 20 20 20 20 6c 6f t base]].. lo
3440: 67 20 77 72 69 74 65 20 31 20 63 6f 6c 6c 72 65 g write 1 collre
3450: 76 20 22 50 72 6f 63 65 73 73 69 6e 67 20 24 62 v "Processing $b
3460: 61 73 65 22 0a 0a 09 20 20 20 20 66 6f 72 65 61 ase"... forea
3470: 63 68 20 66 69 6c 65 20 5b 24 70 72 6f 6a 65 63 ch file [$projec
3480: 74 20 66 69 6c 65 73 5d 20 7b 0a 09 09 73 65 74 t files] {...set
3490: 20 70 61 74 68 20 5b 24 66 69 6c 65 20 70 61 74 path [$file pat
34a0: 68 5d 0a 09 09 6c 6f 67 20 77 72 69 74 65 20 32 h]...log write 2
34b0: 20 63 6f 6c 6c 72 65 76 20 22 50 61 72 73 69 6e collrev "Parsin
34c0: 67 20 24 70 61 74 68 22 0a 09 09 69 66 20 7b 5b g $path"...if {[
34d0: 63 61 74 63 68 20 7b 0a 09 09 20 20 20 20 70 61 catch {... pa
34e0: 72 73 65 72 20 70 72 6f 63 65 73 73 20 5b 3a 3a rser process [::
34f0: 66 69 6c 65 20 6a 6f 69 6e 20 24 62 61 73 65 20 file join $base
3500: 24 70 61 74 68 5d 20 24 66 69 6c 65 0a 09 09 7d $path] $file...}
3510: 20 6d 73 67 5d 7d 20 7b 0a 09 09 20 20 20 20 67 msg]} {... g
3520: 6c 6f 62 61 6c 20 65 72 72 6f 72 43 6f 64 65 0a lobal errorCode.
3530: 09 09 20 20 20 20 69 66 20 7b 24 65 72 72 6f 72 .. if {$error
3540: 43 6f 64 65 20 65 71 20 22 76 63 3a 3a 72 63 73 Code eq "vc::rcs
3550: 3a 3a 70 61 72 73 65 72 22 7d 20 7b 0a 09 09 09 ::parser"} {....
3560: 74 72 6f 75 62 6c 65 20 66 61 74 61 6c 20 22 24 trouble fatal "$
3570: 70 61 74 68 20 69 73 20 6e 6f 74 20 61 20 76 61 path is not a va
3580: 6c 69 64 20 52 43 53 20 61 72 63 68 69 76 65 20 lid RCS archive
3590: 28 24 6d 73 67 29 22 0a 09 09 20 20 20 20 7d 20 ($msg)"... }
35a0: 65 6c 73 65 20 7b 0a 09 09 09 67 6c 6f 62 61 6c else {....global
35b0: 20 65 72 72 6f 72 49 6e 66 6f 0a 09 09 09 74 72 errorInfo....tr
35c0: 6f 75 62 6c 65 20 69 6e 74 65 72 6e 61 6c 20 24 ouble internal $
35d0: 65 72 72 6f 72 49 6e 66 6f 0a 09 09 20 20 20 20 errorInfo...
35e0: 7d 0a 09 09 7d 20 65 6c 73 65 20 7b 0a 09 09 20 }...} else {...
35f0: 20 20 20 23 20 57 65 20 70 65 72 73 69 73 74 20 # We persist
3600: 74 68 65 20 63 6f 72 65 20 6f 66 20 74 68 65 20 the core of the
3610: 64 61 74 61 20 63 6f 6c 6c 65 63 74 65 64 20 61 data collected a
3620: 62 6f 75 74 0a 09 09 20 20 20 20 23 20 65 61 63 bout... # eac
3630: 68 20 66 69 6c 65 20 69 6d 6d 65 64 69 61 74 65 h file immediate
3640: 6c 79 20 61 66 74 65 72 20 69 74 20 68 61 73 20 ly after it has
3650: 62 65 65 6e 20 70 61 72 73 65 64 0a 09 09 20 20 been parsed...
3660: 20 20 23 20 61 6e 64 20 77 72 61 6e 67 6c 65 64 # and wrangled
3670: 20 69 6e 74 6f 20 73 68 61 70 65 2c 20 61 6e 64 into shape, and
3680: 20 74 68 65 6e 20 64 72 6f 70 20 69 74 20 66 72 then drop it fr
3690: 6f 6d 0a 09 09 20 20 20 20 23 20 6d 65 6d 6f 72 om... # memor
36a0: 79 2e 20 54 68 69 73 20 69 73 20 64 6f 6e 65 20 y. This is done
36b0: 74 6f 20 6b 65 65 70 20 74 68 65 20 61 6d 6f 75 to keep the amou
36c0: 6e 74 20 6f 66 0a 09 09 20 20 20 20 23 20 72 65 nt of... # re
36d0: 71 75 69 72 65 64 20 6d 65 6d 6f 72 79 20 77 69 quired memory wi
36e0: 74 68 69 6e 20 73 65 6e 73 69 62 6c 65 20 6c 69 thin sensible li
36f0: 6d 69 74 73 2e 20 57 69 74 68 6f 75 74 0a 09 09 mits. Without...
3700: 20 20 20 20 23 20 64 6f 69 6e 67 20 69 74 20 74 # doing it t
3710: 68 69 73 20 77 61 79 20 77 65 20 77 6f 75 6c 64 his way we would
3720: 20 65 61 73 69 6c 79 20 67 6f 62 62 6c 65 20 75 easily gobble u
3730: 70 20 31 47 0a 09 09 20 20 20 20 23 20 6f 66 20 p 1G... # of
3740: 52 41 4d 20 6f 72 20 6d 6f 72 65 20 77 69 74 68 RAM or more with
3750: 20 61 6c 6c 20 74 68 65 20 6f 62 6a 65 63 74 73 all the objects
3760: 20 28 72 65 76 69 73 69 6f 6e 73 0a 09 09 20 20 (revisions...
3770: 20 20 23 20 61 6e 64 20 66 69 6c 65 2d 6c 65 76 # and file-lev
3780: 65 6c 20 73 79 6d 62 6f 6c 73 29 2e 0a 0a 09 09 el symbols).....
3790: 20 20 20 20 24 66 69 6c 65 20 70 65 72 73 69 73 $file persis
37a0: 74 0a 09 09 7d 0a 0a 09 09 24 66 69 6c 65 20 64 t...}....$file d
37b0: 72 6f 70 0a 09 20 20 20 20 7d 0a 0a 09 20 20 20 rop.. }...
37c0: 20 24 70 72 6f 6a 65 63 74 20 70 75 72 67 65 67 $project purgeg
37d0: 68 6f 73 74 73 79 6d 62 6f 6c 73 0a 09 7d 0a 0a hostsymbols..}..
37e0: 09 72 65 70 6f 73 69 74 6f 72 79 20 70 65 72 73 .repository pers
37f0: 69 73 74 72 65 76 0a 09 72 65 70 6f 73 69 74 6f istrev..reposito
3800: 72 79 20 70 72 69 6e 74 72 65 76 73 74 61 74 69 ry printrevstati
3810: 73 74 69 63 73 0a 09 69 6e 74 65 67 72 69 74 79 stics..integrity
3820: 20 20 73 74 72 69 63 74 0a 0a 09 6c 6f 67 20 77 strict...log w
3830: 72 69 74 65 20 31 20 63 6f 6c 6c 72 65 76 20 22 rite 1 collrev "
3840: 53 63 61 6e 20 63 6f 6d 70 6c 65 74 65 64 22 0a Scan completed".
3850: 09 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 .return. }..
3860: 20 20 20 74 79 70 65 6d 65 74 68 6f 64 20 64 69 typemethod di
3870: 73 63 61 72 64 20 7b 7d 20 7b 0a 09 23 20 50 61 scard {} {..# Pa
3880: 73 73 20 6d 61 6e 61 67 65 72 20 69 6e 74 65 72 ss manager inter
3890: 66 61 63 65 2e 20 45 78 65 63 75 74 65 64 20 66 face. Executed f
38a0: 6f 72 20 61 6c 6c 20 70 61 73 73 65 73 20 61 66 or all passes af
38b0: 74 65 72 20 74 68 65 0a 09 23 20 72 75 6e 20 70 ter the..# run p
38c0: 61 73 73 65 73 2c 20 74 6f 20 72 65 6d 6f 76 65 asses, to remove
38d0: 20 61 6c 6c 20 64 61 74 61 20 6f 66 20 74 68 69 all data of thi
38e0: 73 20 70 61 73 73 20 66 72 6f 6d 20 74 68 65 20 s pass from the
38f0: 73 74 61 74 65 2c 0a 09 23 20 61 73 20 62 65 69 state,..# as bei
3900: 6e 67 20 6f 75 74 20 6f 66 20 64 61 74 65 2e 0a ng out of date..
3910: 0a 09 73 74 61 74 65 20 64 69 73 63 61 72 64 20 ..state discard
3920: 72 65 76 69 73 69 6f 6e 0a 09 73 74 61 74 65 20 revision..state
3930: 64 69 73 63 61 72 64 20 74 61 67 0a 09 73 74 61 discard tag..sta
3940: 74 65 20 64 69 73 63 61 72 64 20 62 72 61 6e 63 te discard branc
3950: 68 0a 09 73 74 61 74 65 20 64 69 73 63 61 72 64 h..state discard
3960: 20 73 79 6d 62 6f 6c 0a 09 73 74 61 74 65 20 64 symbol..state d
3970: 69 73 63 61 72 64 20 62 6c 6f 63 6b 65 72 0a 09 iscard blocker..
3980: 73 74 61 74 65 20 64 69 73 63 61 72 64 20 70 61 state discard pa
3990: 72 65 6e 74 0a 09 73 74 61 74 65 20 64 69 73 63 rent..state disc
39a0: 61 72 64 20 73 79 6d 74 79 70 65 0a 09 73 74 61 ard symtype..sta
39b0: 74 65 20 64 69 73 63 61 72 64 20 6d 65 74 61 0a te discard meta.
39c0: 09 73 74 61 74 65 20 64 69 73 63 61 72 64 20 61 .state discard a
39d0: 75 74 68 6f 72 0a 09 73 74 61 74 65 20 64 69 73 uthor..state dis
39e0: 63 61 72 64 20 63 6d 65 73 73 61 67 65 0a 09 72 card cmessage..r
39f0: 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 eturn. }..
3a00: 20 23 20 54 4f 44 4f 3a 20 4d 6f 76 65 20 74 68 # TODO: Move th
3a10: 69 73 20 63 6f 64 65 20 74 6f 20 74 68 65 20 69 is code to the i
3a20: 6e 74 65 67 72 69 74 79 20 6d 6f 64 75 6c 65 0a ntegrity module.
3a30: 20 20 20 20 70 72 6f 63 20 50 61 72 61 6e 6f 69 proc Paranoi
3a40: 61 20 7b 7d 20 7b 0a 09 23 20 54 68 69 73 20 63 a {} {..# This c
3a50: 6f 64 65 20 70 65 72 66 6f 72 6d 73 20 61 20 6e ode performs a n
3a60: 75 6d 62 65 72 20 6f 66 20 70 61 72 61 6e 6f 69 umber of paranoi
3a70: 64 20 63 68 65 63 6b 73 20 6f 66 20 74 68 65 0a d checks of the.
3a80: 09 23 20 64 61 74 61 62 61 73 65 2c 20 73 65 61 .# database, sea
3a90: 72 63 68 69 6e 67 20 66 6f 72 20 69 6e 63 6f 6e rching for incon
3aa0: 73 69 73 74 65 6e 74 20 63 72 6f 73 73 2d 72 65 sistent cross-re
3ab0: 66 65 72 65 6e 63 65 73 2e 0a 09 6c 6f 67 20 77 ferences...log w
3ac0: 72 69 74 65 20 34 20 63 6f 6c 6c 72 65 76 20 7b rite 4 collrev {
3ad0: 43 68 65 63 6b 20 64 61 74 61 62 61 73 65 20 63 Check database c
3ae0: 6f 6e 73 69 73 74 65 6e 63 79 7d 0a 0a 09 73 65 onsistency}...se
3af0: 74 20 6e 20 30 20 3b 20 23 20 43 6f 75 6e 74 65 t n 0 ; # Counte
3b00: 72 20 66 6f 72 20 74 68 65 20 63 68 65 63 6b 73 r for the checks
3b10: 20 28 77 65 20 70 72 69 6e 74 20 61 6e 20 69 64 (we print an id
3b20: 20 62 65 66 6f 72 65 20 74 68 65 0a 09 09 20 20 before the...
3b30: 23 20 6d 61 69 6e 20 6c 61 62 65 6c 29 2e 0a 0a # main label)...
3b40: 09 23 20 46 69 6e 64 20 61 6c 6c 20 72 65 76 69 .# Find all revi
3b50: 73 69 6f 6e 73 20 77 68 69 63 68 20 64 69 73 61 sions which disa
3b60: 67 72 65 65 20 77 69 74 68 20 74 68 65 69 72 20 gree with their
3b70: 6c 69 6e 65 20 6f 66 0a 09 23 20 64 65 76 65 6c line of..# devel
3b80: 6f 70 6d 65 6e 74 20 61 62 6f 75 74 20 74 68 65 opment about the
3b90: 20 70 72 6f 6a 65 63 74 20 74 68 65 79 20 61 72 project they ar
3ba0: 65 20 6f 77 6e 65 64 20 62 79 2e 0a 09 43 68 65 e owned by...Che
3bb0: 63 6b 20 5c 0a 09 20 20 20 20 7b 52 65 76 69 73 ck \.. {Revis
3bc0: 69 6f 6e 73 20 61 6e 64 20 74 68 65 69 72 20 4c ions and their L
3bd0: 4f 44 73 20 68 61 76 65 20 74 6f 20 62 65 20 69 ODs have to be i
3be0: 6e 20 74 68 65 20 73 61 6d 65 20 70 72 6f 6a 65 n the same proje
3bf0: 63 74 7d 20 5c 0a 09 20 20 20 20 7b 64 69 73 61 ct} \.. {disa
3c00: 67 72 65 65 73 20 77 69 74 68 20 69 74 73 20 4c grees with its L
3c10: 4f 44 20 61 62 6f 75 74 20 6f 77 6e 69 6e 67 20 OD about owning
3c20: 70 72 6f 6a 65 63 74 7d 20 7b 0a 09 09 53 45 4c project} {...SEL
3c30: 45 43 54 20 46 2e 6e 61 6d 65 2c 20 52 2e 72 65 ECT F.name, R.re
3c40: 76 0a 09 09 46 52 4f 4d 20 20 20 72 65 76 69 73 v...FROM revis
3c50: 69 6f 6e 20 52 2c 20 66 69 6c 65 20 46 2c 20 73 ion R, file F, s
3c60: 79 6d 62 6f 6c 20 53 0a 09 09 57 48 45 52 45 20 ymbol S...WHERE
3c70: 20 52 2e 66 69 64 20 3d 20 46 2e 66 69 64 20 20 R.fid = F.fid
3c80: 20 2d 2d 20 47 65 74 20 66 69 6c 65 20 6f 66 20 -- Get file of
3c90: 72 65 76 69 73 69 6f 6e 0a 09 09 41 4e 44 20 20 revision...AND
3ca0: 20 20 52 2e 6c 6f 64 20 3d 20 53 2e 73 69 64 20 R.lod = S.sid
3cb0: 20 20 2d 2d 20 47 65 74 20 73 79 6d 62 6f 6c 20 -- Get symbol
3cc0: 66 6f 72 20 72 65 76 69 73 69 6f 6e 27 73 20 4c for revision's L
3cd0: 4f 44 0a 09 09 41 4e 44 20 20 20 20 46 2e 70 69 OD...AND F.pi
3ce0: 64 20 21 3d 20 53 2e 70 69 64 20 20 2d 2d 20 62 d != S.pid -- b
3cf0: 75 74 20 73 79 6d 62 6f 6c 20 69 73 20 66 6f 72 ut symbol is for
3d00: 20 61 20 64 69 66 66 65 72 65 6e 74 20 70 72 6f a different pro
3d10: 6a 65 63 74 0a 09 09 3b 0a 09 20 20 20 20 7d 0a ject...;.. }.
3d20: 09 23 20 46 69 6e 64 20 61 6c 6c 20 72 65 76 69 .# Find all revi
3d30: 73 69 6f 6e 73 20 77 68 69 63 68 20 64 69 73 67 sions which disg
3d40: 72 65 65 20 77 69 74 68 20 74 68 65 69 72 20 6d ree with their m
3d50: 65 74 61 20 64 61 74 61 20 61 62 6f 75 74 0a 09 eta data about..
3d60: 23 20 74 68 65 20 70 72 6f 6a 65 63 74 20 74 68 # the project th
3d70: 65 79 20 61 72 65 20 6f 77 6e 65 64 20 62 79 2e ey are owned by.
3d80: 0a 09 43 68 65 63 6b 20 5c 0a 09 20 20 20 20 7b ..Check \.. {
3d90: 52 65 76 69 73 69 6f 6e 73 20 61 6e 64 20 74 68 Revisions and th
3da0: 65 69 72 20 6d 65 74 61 20 64 61 74 61 20 68 61 eir meta data ha
3db0: 76 65 20 74 6f 20 62 65 20 69 6e 20 74 68 65 20 ve to be in the
3dc0: 73 61 6d 65 20 70 72 6f 6a 65 63 74 7d 20 5c 0a same project} \.
3dd0: 09 20 20 20 20 7b 64 69 73 61 67 72 65 65 73 20 . {disagrees
3de0: 77 69 74 68 20 69 74 73 20 6d 65 74 61 20 64 61 with its meta da
3df0: 74 61 20 61 62 6f 75 74 20 6f 77 6e 69 6e 67 20 ta about owning
3e00: 70 72 6f 6a 65 63 74 7d 20 7b 0a 09 09 53 45 4c project} {...SEL
3e10: 45 43 54 20 46 2e 6e 61 6d 65 2c 20 52 2e 72 65 ECT F.name, R.re
3e20: 76 0a 09 09 46 52 4f 4d 20 20 20 72 65 76 69 73 v...FROM revis
3e30: 69 6f 6e 20 52 2c 20 66 69 6c 65 20 46 2c 20 6d ion R, file F, m
3e40: 65 74 61 20 4d 0a 09 09 57 48 45 52 45 20 20 52 eta M...WHERE R
3e50: 2e 66 69 64 20 3d 20 46 2e 66 69 64 20 20 20 2d .fid = F.fid -
3e60: 2d 20 47 65 74 20 66 69 6c 65 20 6f 66 20 72 65 - Get file of re
3e70: 76 69 73 69 6f 6e 0a 09 09 41 4e 44 20 20 20 20 vision...AND
3e80: 52 2e 6d 69 64 20 3d 20 4d 2e 6d 69 64 20 20 20 R.mid = M.mid
3e90: 2d 2d 20 47 65 74 20 6d 65 74 61 20 64 61 74 61 -- Get meta data
3ea0: 20 6f 66 20 72 65 76 69 73 69 6f 6e 0a 09 09 41 of revision...A
3eb0: 4e 44 20 20 20 20 46 2e 70 69 64 20 21 3d 20 4d ND F.pid != M
3ec0: 2e 70 69 64 20 20 2d 2d 20 62 75 74 20 69 73 20 .pid -- but is
3ed0: 66 6f 72 20 61 20 64 69 66 66 65 72 65 6e 74 20 for a different
3ee0: 70 72 6f 6a 65 63 74 0a 09 09 3b 0a 09 20 20 20 project...;..
3ef0: 20 7d 0a 09 23 20 46 69 6e 64 20 61 6c 6c 20 72 }..# Find all r
3f00: 65 76 69 73 69 6f 6e 73 20 77 68 69 63 68 20 64 evisions which d
3f10: 69 73 67 72 65 65 20 77 69 74 68 20 74 68 65 69 isgree with thei
3f20: 72 20 6d 65 74 61 20 64 61 74 61 20 61 62 6f 75 r meta data abou
3f30: 74 0a 09 23 20 74 68 65 20 62 72 61 6e 63 68 2f t..# the branch/
3f40: 6c 69 6e 65 20 6f 66 20 64 65 76 65 6c 6f 70 6d line of developm
3f50: 65 6e 74 20 74 68 65 79 20 62 65 6c 6f 6e 67 20 ent they belong
3f60: 74 6f 2e 0a 09 43 68 65 63 6b 20 5c 0a 09 20 20 to...Check \..
3f70: 20 20 7b 52 65 76 69 73 69 6f 6e 73 20 61 6e 64 {Revisions and
3f80: 20 74 68 65 69 72 20 6d 65 74 61 20 64 61 74 61 their meta data
3f90: 20 68 61 76 65 20 74 6f 20 62 65 20 69 6e 20 74 have to be in t
3fa0: 68 65 20 73 61 6d 65 20 4c 4f 44 7d 20 5c 0a 09 he same LOD} \..
3fb0: 20 20 20 20 7b 64 69 73 61 67 72 65 65 73 20 77 {disagrees w
3fc0: 69 74 68 20 69 74 73 20 6d 65 74 61 20 64 61 74 ith its meta dat
3fd0: 61 20 61 62 6f 75 74 20 6f 77 6e 69 6e 67 20 4c a about owning L
3fe0: 4f 44 7d 20 7b 0a 09 09 53 45 4c 45 43 54 20 46 OD} {...SELECT F
3ff0: 2e 6e 61 6d 65 2c 20 52 2e 72 65 76 0a 09 09 46 .name, R.rev...F
4000: 52 4f 4d 20 20 20 72 65 76 69 73 69 6f 6e 20 52 ROM revision R
4010: 2c 20 6d 65 74 61 20 4d 2c 20 66 69 6c 65 20 46 , meta M, file F
4020: 0a 09 09 57 48 45 52 45 20 20 52 2e 6d 69 64 20 ...WHERE R.mid
4030: 3d 20 4d 2e 6d 69 64 20 20 20 2d 2d 20 47 65 74 = M.mid -- Get
4040: 20 6d 65 74 61 20 64 61 74 61 20 6f 66 20 72 65 meta data of re
4050: 76 69 73 69 6f 6e 0a 09 09 41 4e 44 20 20 20 20 vision...AND
4060: 52 2e 6c 6f 64 20 21 3d 20 4d 2e 62 69 64 20 20 R.lod != M.bid
4070: 2d 2d 20 62 75 74 20 69 73 20 66 6f 72 20 61 20 -- but is for a
4080: 64 69 66 66 65 72 65 6e 74 20 4c 4f 44 0a 09 09 different LOD...
4090: 41 4e 44 20 20 20 20 52 2e 66 69 64 20 3d 20 46 AND R.fid = F
40a0: 2e 66 69 64 20 20 20 2d 2d 20 47 65 74 20 66 69 .fid -- Get fi
40b0: 6c 65 20 6f 66 20 72 65 76 69 73 69 6f 6e 0a 09 le of revision..
40c0: 09 3b 0a 09 20 20 20 20 7d 0a 09 23 20 46 69 6e .;.. }..# Fin
40d0: 64 20 61 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 d all revisions
40e0: 77 69 74 68 20 61 20 70 72 69 6d 61 72 79 20 63 with a primary c
40f0: 68 69 6c 64 20 77 68 69 63 68 20 64 69 73 61 67 hild which disag
4100: 72 65 65 73 0a 09 23 20 61 62 6f 75 74 20 74 68 rees..# about th
4110: 65 20 66 69 6c 65 20 74 68 65 79 20 62 65 6c 6f e file they belo
4120: 6e 67 20 74 6f 2e 0a 09 43 68 65 63 6b 20 5c 0a ng to...Check \.
4130: 09 20 20 20 20 7b 52 65 76 69 73 69 6f 6e 73 20 . {Revisions
4140: 61 6e 64 20 74 68 65 69 72 20 70 72 69 6d 61 72 and their primar
4150: 79 20 63 68 69 6c 64 72 65 6e 20 68 61 76 65 20 y children have
4160: 74 6f 20 62 65 20 69 6e 20 74 68 65 20 73 61 6d to be in the sam
4170: 65 20 66 69 6c 65 7d 20 5c 0a 09 20 20 20 20 7b e file} \.. {
4180: 64 69 73 61 67 72 65 65 73 20 77 69 74 68 20 69 disagrees with i
4190: 74 73 20 70 72 69 6d 61 72 79 20 63 68 69 6c 64 ts primary child
41a0: 20 61 62 6f 75 74 20 74 68 65 20 6f 77 6e 69 6e about the ownin
41b0: 67 20 66 69 6c 65 7d 20 7b 0a 09 09 53 45 4c 45 g file} {...SELE
41c0: 43 54 20 46 2e 6e 61 6d 65 2c 20 52 2e 72 65 76 CT F.name, R.rev
41d0: 0a 09 09 46 52 4f 4d 20 20 20 72 65 76 69 73 69 ...FROM revisi
41e0: 6f 6e 20 52 2c 20 72 65 76 69 73 69 6f 6e 20 43 on R, revision C
41f0: 2c 20 66 69 6c 65 20 46 0a 09 09 57 48 45 52 45 , file F...WHERE
4200: 20 20 52 2e 66 69 64 20 3d 20 46 2e 66 69 64 20 R.fid = F.fid
4210: 20 20 20 20 20 20 20 2d 2d 20 47 65 74 20 66 69 -- Get fi
4220: 6c 65 20 6f 66 20 72 65 76 69 73 69 6f 6e 0a 09 le of revision..
4230: 09 41 4e 44 20 20 20 20 52 2e 63 68 69 6c 64 20 .AND R.child
4240: 49 53 20 4e 4f 54 20 4e 55 4c 4c 20 20 2d 2d 20 IS NOT NULL --
4250: 52 65 73 74 72 69 63 74 20 74 6f 20 6e 6f 6e 2d Restrict to non-
4260: 6c 65 61 66 20 72 65 76 69 73 69 6f 6e 73 0a 09 leaf revisions..
4270: 09 41 4e 44 20 20 20 20 52 2e 63 68 69 6c 64 20 .AND R.child
4280: 3d 20 43 2e 72 69 64 20 20 20 20 20 20 2d 2d 20 = C.rid --
4290: 47 65 74 20 63 68 69 6c 64 20 28 68 61 73 20 74 Get child (has t
42a0: 6f 20 65 78 69 73 74 29 0a 09 09 41 4e 44 20 20 o exist)...AND
42b0: 20 20 43 2e 66 69 64 20 21 3d 20 52 2e 66 69 64 C.fid != R.fid
42c0: 20 20 20 20 20 20 20 2d 2d 20 57 68 69 63 20 77 -- Whic w
42d0: 72 6f 6e 67 6c 79 20 69 73 20 69 6e 20 61 20 64 rongly is in a d
42e0: 69 66 66 65 72 65 6e 74 20 66 69 6c 65 0a 09 09 ifferent file...
42f0: 3b 0a 09 20 20 20 20 7d 0a 0a 09 23 20 46 69 6e ;.. }...# Fin
4300: 64 20 61 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 d all revisions
4310: 77 69 74 68 20 61 20 62 72 61 6e 63 68 20 70 61 with a branch pa
4320: 72 65 6e 74 20 73 79 6d 62 6f 6c 20 77 68 6f 73 rent symbol whos
4330: 65 20 70 61 72 65 6e 74 0a 09 23 20 64 69 73 61 e parent..# disa
4340: 67 72 65 65 73 20 61 62 6f 75 74 20 74 68 65 20 grees about the
4350: 66 69 6c 65 20 74 68 65 79 20 62 65 6c 6f 6e 67 file they belong
4360: 20 74 6f 2e 0a 09 43 68 65 63 6b 20 5c 0a 09 20 to...Check \..
4370: 20 20 20 7b 52 65 76 69 73 69 6f 6e 73 20 61 6e {Revisions an
4380: 64 20 74 68 65 69 72 20 62 72 61 6e 63 68 20 63 d their branch c
4390: 68 69 6c 64 72 65 6e 20 68 61 76 65 20 74 6f 20 hildren have to
43a0: 62 65 20 69 6e 20 74 68 65 20 73 61 6d 65 20 66 be in the same f
43b0: 69 6c 65 7d 20 5c 0a 09 20 20 20 20 7b 61 74 20 ile} \.. {at
43c0: 74 68 65 20 62 65 67 69 6e 6e 69 6e 67 20 6f 66 the beginning of
43d0: 20 69 74 73 20 62 72 61 6e 63 68 20 61 6e 64 20 its branch and
43e0: 69 74 73 20 70 61 72 65 6e 74 20 64 69 73 61 67 its parent disag
43f0: 72 65 65 20 61 62 6f 75 74 20 74 68 65 20 6f 77 ree about the ow
4400: 6e 69 6e 67 20 66 69 6c 65 7d 20 7b 0a 09 09 53 ning file} {...S
4410: 45 4c 45 43 54 20 46 2e 6e 61 6d 65 2c 20 52 2e ELECT F.name, R.
4420: 72 65 76 0a 09 09 46 52 4f 4d 20 20 20 72 65 76 rev...FROM rev
4430: 69 73 69 6f 6e 20 52 2c 20 72 65 76 69 73 69 6f ision R, revisio
4440: 6e 20 50 2c 20 66 69 6c 65 20 46 0a 09 09 57 48 n P, file F...WH
4450: 45 52 45 20 20 52 2e 66 69 64 20 3d 20 46 2e 66 ERE R.fid = F.f
4460: 69 64 20 20 20 20 20 20 20 20 20 20 2d 2d 20 47 id -- G
4470: 65 74 20 66 69 6c 65 20 6f 66 20 72 65 76 69 73 et file of revis
4480: 69 6f 6e 0a 09 09 41 4e 44 20 20 20 20 52 2e 62 ion...AND R.b
4490: 70 61 72 65 6e 74 20 49 53 20 4e 4f 54 20 4e 55 parent IS NOT NU
44a0: 4c 4c 20 20 2d 2d 20 52 65 73 74 72 69 63 74 20 LL -- Restrict
44b0: 74 6f 20 66 69 72 73 74 20 6f 6e 20 62 72 61 6e to first on bran
44c0: 63 68 0a 09 09 41 4e 44 20 20 20 20 52 2e 70 61 ch...AND R.pa
44d0: 72 65 6e 74 20 3d 20 50 2e 72 69 64 20 20 20 20 rent = P.rid
44e0: 20 20 20 2d 2d 20 47 65 74 20 6f 75 74 2d 6f 66 -- Get out-of
44f0: 2d 62 72 61 6e 63 68 20 70 61 72 65 6e 74 0a 09 -branch parent..
4500: 09 41 4e 44 20 20 20 20 52 2e 66 69 64 20 21 3d .AND R.fid !=
4510: 20 50 2e 66 69 64 20 20 20 20 20 20 20 20 20 2d P.fid -
4520: 2d 20 57 68 69 63 68 20 77 72 6f 6e 67 6c 79 20 - Which wrongly
4530: 69 73 20 69 6e 20 61 20 64 69 66 66 65 72 65 6e is in a differen
4540: 74 20 66 69 6c 65 0a 09 09 3b 0a 09 20 20 20 20 t file...;..
4550: 7d 0a 09 23 20 46 69 6e 64 20 61 6c 6c 20 72 65 }..# Find all re
4560: 76 69 73 69 6f 6e 73 20 77 69 74 68 20 61 20 6e visions with a n
4570: 6f 6e 2d 4e 54 44 42 20 63 68 69 6c 64 20 77 68 on-NTDB child wh
4580: 69 63 68 20 64 69 73 61 67 72 65 65 73 0a 09 23 ich disagrees..#
4590: 20 61 62 6f 75 74 20 74 68 65 20 66 69 6c 65 20 about the file
45a0: 74 68 65 79 20 62 65 6c 6f 6e 67 20 74 6f 2e 0a they belong to..
45b0: 09 43 68 65 63 6b 20 5c 0a 09 20 20 20 20 7b 52 .Check \.. {R
45c0: 65 76 69 73 69 6f 6e 73 20 61 6e 64 20 74 68 65 evisions and the
45d0: 69 72 20 6e 6f 6e 2d 4e 54 44 42 20 63 68 69 6c ir non-NTDB chil
45e0: 64 72 65 6e 20 68 61 76 65 20 74 6f 20 62 65 20 dren have to be
45f0: 69 6e 20 74 68 65 20 73 61 6d 65 20 66 69 6c 65 in the same file
4600: 7d 20 5c 0a 09 20 20 20 20 7b 64 69 73 61 67 72 } \.. {disagr
4610: 65 65 73 20 77 69 74 68 20 69 74 73 20 6e 6f 6e ees with its non
4620: 2d 4e 54 44 42 20 63 68 69 6c 64 20 61 62 6f 75 -NTDB child abou
4630: 74 20 74 68 65 20 6f 77 6e 69 6e 67 20 66 69 6c t the owning fil
4640: 65 7d 20 7b 0a 09 09 53 45 4c 45 43 54 20 46 2e e} {...SELECT F.
4650: 6e 61 6d 65 2c 20 52 2e 72 65 76 0a 09 09 46 52 name, R.rev...FR
4660: 4f 4d 20 20 20 72 65 76 69 73 69 6f 6e 20 52 2c OM revision R,
4670: 20 72 65 76 69 73 69 6f 6e 20 43 2c 20 66 69 6c revision C, fil
4680: 65 20 46 0a 09 09 57 48 45 52 45 20 20 52 2e 66 e F...WHERE R.f
4690: 69 64 20 3d 20 46 2e 66 69 64 20 20 20 20 20 20 id = F.fid
46a0: 20 20 20 20 2d 2d 20 47 65 74 20 66 69 6c 65 20 -- Get file
46b0: 6f 66 20 72 65 76 69 73 69 6f 6e 0a 09 09 41 4e of revision...AN
46c0: 44 20 20 20 20 52 2e 64 62 63 68 69 6c 64 20 49 D R.dbchild I
46d0: 53 20 4e 4f 54 20 4e 55 4c 4c 20 20 2d 2d 20 52 S NOT NULL -- R
46e0: 65 73 74 72 69 63 74 20 74 6f 20 73 65 6d 69 2d estrict to semi-
46f0: 6c 61 73 74 20 4e 54 44 42 20 72 65 76 69 73 69 last NTDB revisi
4700: 6f 6e 0a 09 09 41 4e 44 20 20 20 20 52 2e 64 62 on...AND R.db
4710: 63 68 69 6c 64 20 3d 20 43 2e 72 69 64 20 20 20 child = C.rid
4720: 20 20 20 2d 2d 20 47 6f 74 20 74 6f 20 61 73 73 -- Got to ass
4730: 6f 63 69 61 74 65 64 20 74 72 75 6e 6b 20 72 65 ociated trunk re
4740: 76 69 73 69 6f 6e 0a 09 09 41 4e 44 20 20 20 20 vision...AND
4750: 43 2e 66 69 64 20 21 3d 20 52 2e 66 69 64 20 20 C.fid != R.fid
4760: 20 20 20 20 20 20 20 2d 2d 20 57 68 69 63 68 20 -- Which
4770: 77 72 6f 6e 67 6c 79 20 69 73 20 69 6e 20 61 20 wrongly is in a
4780: 64 69 66 66 65 72 65 6e 74 20 66 69 6c 65 0a 09 different file..
4790: 09 3b 0a 09 20 20 20 20 7d 0a 09 23 20 46 69 6e .;.. }..# Fin
47a0: 64 20 61 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 d all revisions
47b0: 77 68 69 63 68 20 68 61 76 65 20 61 20 70 72 69 which have a pri
47c0: 6d 61 72 79 20 63 68 69 6c 64 2c 20 62 75 74 20 mary child, but
47d0: 74 68 65 20 63 68 69 6c 64 0a 09 23 20 64 6f 65 the child..# doe
47e0: 73 20 6e 6f 74 20 68 61 76 65 20 74 68 65 6d 20 s not have them
47f0: 61 73 20 70 61 72 65 6e 74 2e 0a 09 43 68 65 63 as parent...Chec
4800: 6b 20 5c 0a 09 20 20 20 20 7b 52 65 76 69 73 69 k \.. {Revisi
4810: 6f 6e 73 20 68 61 76 65 20 74 6f 20 62 65 20 70 ons have to be p
4820: 61 72 65 6e 74 73 20 6f 66 20 74 68 65 69 72 20 arents of their
4830: 70 72 69 6d 61 72 79 20 63 68 69 6c 64 72 65 6e primary children
4840: 7d 20 5c 0a 09 20 20 20 20 7b 69 73 20 6e 6f 74 } \.. {is not
4850: 20 74 68 65 20 70 61 72 65 6e 74 20 6f 66 20 69 the parent of i
4860: 74 73 20 70 72 69 6d 61 72 79 20 63 68 69 6c 64 ts primary child
4870: 7d 20 7b 0a 09 09 53 45 4c 45 43 54 20 46 2e 6e } {...SELECT F.n
4880: 61 6d 65 2c 20 52 2e 72 65 76 0a 09 09 46 52 4f ame, R.rev...FRO
4890: 4d 20 20 20 72 65 76 69 73 69 6f 6e 20 52 2c 20 M revision R,
48a0: 72 65 76 69 73 69 6f 6e 20 43 2c 20 66 69 6c 65 revision C, file
48b0: 20 46 0a 09 09 57 48 45 52 45 20 20 52 2e 66 69 F...WHERE R.fi
48c0: 64 20 3d 20 46 2e 66 69 64 20 20 20 20 20 20 20 d = F.fid
48d0: 20 2d 2d 20 47 65 74 20 66 69 6c 65 20 6f 66 20 -- Get file of
48e0: 72 65 76 69 73 69 6f 6e 0a 09 09 41 4e 44 20 20 revision...AND
48f0: 20 20 52 2e 63 68 69 6c 64 20 49 53 20 4e 4f 54 R.child IS NOT
4900: 20 4e 55 4c 4c 20 20 2d 2d 20 52 65 73 74 72 69 NULL -- Restri
4910: 63 74 20 74 6f 20 6e 6f 6e 2d 6c 65 61 76 65 73 ct to non-leaves
4920: 0a 09 09 41 4e 44 20 20 20 20 52 2e 63 68 69 6c ...AND R.chil
4930: 64 20 3d 20 43 2e 72 69 64 20 20 20 20 20 20 2d d = C.rid -
4940: 2d 20 47 65 74 20 74 68 65 20 63 68 69 6c 64 20 - Get the child
4950: 28 68 61 73 20 74 6f 20 65 78 69 73 74 29 0a 09 (has to exist)..
4960: 09 41 4e 44 20 20 20 20 43 2e 70 61 72 65 6e 74 .AND C.parent
4970: 20 21 3d 20 52 2e 72 69 64 20 20 20 20 2d 2d 20 != R.rid --
4980: 57 68 69 63 68 20 64 6f 65 73 20 6e 6f 74 20 68 Which does not h
4990: 61 76 65 20 75 73 20 61 73 20 69 74 73 20 70 61 ave us as its pa
49a0: 72 65 6e 74 2e 0a 09 09 3b 0a 09 20 20 20 20 7d rent....;.. }
49b0: 0a 09 23 20 46 69 6e 64 20 61 6c 6c 20 72 65 76 ..# Find all rev
49c0: 69 73 69 6f 6e 73 20 77 68 69 63 68 20 68 61 76 isions which hav
49d0: 65 20 61 20 70 72 69 6d 72 61 72 79 20 63 68 69 e a primrary chi
49e0: 6c 64 2c 20 62 75 74 20 74 68 65 0a 09 23 20 63 ld, but the..# c
49f0: 68 69 6c 64 20 68 61 73 20 61 20 62 72 61 6e 63 hild has a branc
4a00: 68 20 70 61 72 65 6e 74 20 73 79 6d 62 6f 6c 20 h parent symbol
4a10: 6d 61 6b 69 6e 67 20 74 68 65 6d 20 62 72 61 63 making them brac
4a20: 68 20 73 74 61 72 74 65 72 73 2e 0a 09 43 68 65 h starters...Che
4a30: 63 6b 20 5c 0a 09 20 20 20 20 7b 50 72 69 6d 61 ck \.. {Prima
4a40: 72 79 20 63 68 69 6c 64 72 65 6e 20 6f 66 20 72 ry children of r
4a50: 65 76 69 73 69 6f 6e 73 20 6d 75 73 74 20 6e 6f evisions must no
4a60: 74 20 73 74 61 72 74 20 62 72 61 6e 63 68 65 73 t start branches
4a70: 7d 20 5c 0a 09 20 20 20 20 7b 69 73 20 70 61 72 } \.. {is par
4a80: 65 6e 74 20 6f 66 20 61 20 70 72 69 6d 61 72 79 ent of a primary
4a90: 20 63 68 69 6c 64 20 77 68 69 63 68 20 69 73 20 child which is
4aa0: 74 68 65 20 62 65 67 69 6e 6e 69 6e 67 20 6f 66 the beginning of
4ab0: 20 61 20 62 72 61 6e 63 68 7d 20 7b 0a 09 09 53 a branch} {...S
4ac0: 45 4c 45 43 54 20 46 2e 6e 61 6d 65 2c 20 52 2e ELECT F.name, R.
4ad0: 72 65 76 0a 09 09 46 52 4f 4d 20 20 20 72 65 76 rev...FROM rev
4ae0: 69 73 69 6f 6e 20 52 2c 20 72 65 76 69 73 69 6f ision R, revisio
4af0: 6e 20 43 2c 20 66 69 6c 65 20 46 0a 09 09 57 48 n C, file F...WH
4b00: 45 52 45 20 20 52 2e 66 69 64 20 3d 20 46 2e 66 ERE R.fid = F.f
4b10: 69 64 20 20 20 20 20 20 20 20 20 20 20 2d 2d 20 id --
4b20: 47 65 74 20 66 69 6c 65 20 6f 66 20 72 65 76 69 Get file of revi
4b30: 73 69 6f 6e 0a 09 09 41 4e 44 20 20 20 20 52 2e sion...AND R.
4b40: 63 68 69 6c 64 20 49 53 20 4e 4f 54 20 4e 55 4c child IS NOT NUL
4b50: 4c 20 20 20 20 20 2d 2d 20 52 65 73 74 72 69 63 L -- Restric
4b60: 74 20 74 6f 20 6e 6f 6e 2d 6c 65 61 76 65 73 0a t to non-leaves.
4b70: 09 09 41 4e 44 20 20 20 20 52 2e 63 68 69 6c 64 ..AND R.child
4b80: 20 3d 20 43 2e 72 69 64 20 20 20 20 20 20 20 20 = C.rid
4b90: 20 2d 2d 20 47 65 74 20 74 68 65 20 63 68 69 6c -- Get the chil
4ba0: 64 20 28 68 61 73 20 74 6f 20 65 78 69 73 74 29 d (has to exist)
4bb0: 0a 09 09 41 4e 44 20 20 20 20 43 2e 62 70 61 72 ...AND C.bpar
4bc0: 65 6e 74 20 49 53 20 4e 4f 54 20 4e 55 4c 4c 20 ent IS NOT NULL
4bd0: 20 20 2d 2d 20 77 72 6f 6e 67 6c 79 20 63 6c 61 -- wrongly cla
4be0: 69 6d 69 6e 67 20 74 6f 20 62 65 20 66 69 72 73 iming to be firs
4bf0: 74 20 6f 6e 20 62 72 61 6e 63 68 0a 09 09 3b 0a t on branch...;.
4c00: 09 20 20 20 20 7d 0a 09 23 20 46 69 6e 64 20 61 . }..# Find a
4c10: 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 77 69 74 ll revisions wit
4c20: 68 6f 75 74 20 62 72 61 6e 63 68 20 70 61 72 65 hout branch pare
4c30: 6e 74 20 73 79 6d 62 6f 6c 20 77 68 69 63 68 20 nt symbol which
4c40: 68 61 76 65 20 61 0a 09 23 20 70 61 72 65 6e 74 have a..# parent
4c50: 2c 20 62 75 74 20 74 68 65 20 70 61 72 65 6e 74 , but the parent
4c60: 20 64 6f 65 73 20 6e 6f 74 20 68 61 76 65 20 74 does not have t
4c70: 68 65 6d 20 61 73 20 70 72 69 6d 61 72 79 20 63 hem as primary c
4c80: 68 69 6c 64 2e 0a 09 43 68 65 63 6b 20 5c 0a 09 hild...Check \..
4c90: 20 20 20 20 7b 52 65 76 69 73 69 6f 6e 73 20 68 {Revisions h
4ca0: 61 76 65 20 74 6f 20 62 65 20 70 72 69 6d 61 72 ave to be primar
4cb0: 79 20 63 68 69 6c 64 72 65 6e 20 6f 66 20 74 68 y children of th
4cc0: 65 69 72 20 70 61 72 65 6e 74 73 2c 20 69 66 20 eir parents, if
4cd0: 61 6e 79 7d 20 5c 0a 09 20 20 20 20 7b 69 73 20 any} \.. {is
4ce0: 6e 6f 74 20 74 68 65 20 63 68 69 6c 64 20 6f 66 not the child of
4cf0: 20 69 74 73 20 70 61 72 65 6e 74 7d 20 7b 0a 09 its parent} {..
4d00: 09 53 45 4c 45 43 54 20 46 2e 6e 61 6d 65 2c 20 .SELECT F.name,
4d10: 52 2e 72 65 76 0a 09 09 46 52 4f 4d 20 20 20 72 R.rev...FROM r
4d20: 65 76 69 73 69 6f 6e 20 52 2c 20 72 65 76 69 73 evision R, revis
4d30: 69 6f 6e 20 50 2c 20 66 69 6c 65 20 46 0a 09 09 ion P, file F...
4d40: 57 48 45 52 45 20 20 52 2e 66 69 64 20 3d 20 46 WHERE R.fid = F
4d50: 2e 66 69 64 0a 09 09 41 4e 44 20 20 20 20 52 2e .fid...AND R.
4d60: 62 70 61 72 65 6e 74 20 49 53 20 4e 55 4c 4c 20 bparent IS NULL
4d70: 20 20 20 20 2d 2d 20 47 65 74 20 66 69 6c 65 20 -- Get file
4d80: 6f 66 20 72 65 76 69 73 69 6f 6e 0a 09 09 41 4e of revision...AN
4d90: 44 20 20 20 20 52 2e 70 61 72 65 6e 74 20 49 53 D R.parent IS
4da0: 20 4e 4f 54 20 4e 55 4c 4c 20 20 2d 2d 20 52 65 NOT NULL -- Re
4db0: 73 74 72 69 63 74 20 74 6f 20 65 76 65 72 79 74 strict to everyt
4dc0: 68 69 6e 67 20 6e 6f 74 20 66 69 72 73 74 20 6f hing not first o
4dd0: 6e 20 61 20 62 72 61 6e 63 68 0a 09 09 41 4e 44 n a branch...AND
4de0: 20 20 20 20 52 2e 70 61 72 65 6e 74 20 3d 20 50 R.parent = P
4df0: 2e 72 69 64 20 20 20 20 20 20 2d 2d 20 47 65 74 .rid -- Get
4e00: 20 74 68 65 20 70 61 72 65 6e 74 20 28 68 61 73 the parent (has
4e10: 20 74 6f 20 65 78 69 73 74 29 0a 09 09 41 4e 44 to exist)...AND
4e20: 20 20 20 20 50 2e 63 68 69 6c 64 20 21 3d 20 52 P.child != R
4e30: 2e 72 69 64 20 20 20 20 20 20 2d 2d 20 57 68 69 .rid -- Whi
4e40: 63 68 20 64 6f 20 6e 6f 74 20 68 61 76 65 20 75 ch do not have u
4e50: 73 20 61 73 20 74 68 65 69 72 20 63 68 69 6c 64 s as their child
4e60: 0a 09 09 3b 0a 09 20 20 20 20 7d 0a 09 23 20 46 ...;.. }..# F
4e70: 69 6e 64 20 61 6c 6c 20 72 65 76 69 73 69 6f 6e ind all revision
4e80: 73 20 77 69 74 68 20 61 20 62 72 61 6e 63 68 20 s with a branch
4e90: 70 61 72 65 6e 74 20 73 79 6d 62 6f 6c 20 77 68 parent symbol wh
4ea0: 69 63 68 20 64 6f 20 6e 6f 74 0a 09 23 20 68 61 ich do not..# ha
4eb0: 76 65 20 61 20 70 61 72 65 6e 74 2e 0a 09 43 68 ve a parent...Ch
4ec0: 65 63 6b 20 5c 0a 09 20 20 20 20 7b 42 72 61 6e eck \.. {Bran
4ed0: 63 68 20 73 74 61 72 74 69 6e 67 20 72 65 76 69 ch starting revi
4ee0: 73 69 6f 6e 73 20 68 61 76 65 20 74 6f 20 68 61 sions have to ha
4ef0: 76 65 20 61 20 70 61 72 65 6e 74 7d 20 5c 0a 09 ve a parent} \..
4f00: 20 20 20 20 7b 61 74 20 74 68 65 20 62 65 67 69 {at the begi
4f10: 6e 6e 69 6e 67 20 6f 66 20 69 74 73 20 62 72 61 nning of its bra
4f20: 6e 63 68 20 68 61 73 20 6e 6f 20 70 61 72 65 6e nch has no paren
4f30: 74 7d 20 7b 0a 09 09 53 45 4c 45 43 54 20 46 2e t} {...SELECT F.
4f40: 6e 61 6d 65 2c 20 52 2e 72 65 76 0a 09 09 46 52 name, R.rev...FR
4f50: 4f 4d 20 20 20 72 65 76 69 73 69 6f 6e 20 52 2c OM revision R,
4f60: 20 66 69 6c 65 20 46 0a 09 09 57 48 45 52 45 20 file F...WHERE
4f70: 20 52 2e 66 69 64 20 3d 20 46 2e 66 69 64 20 20 R.fid = F.fid
4f80: 20 20 20 20 20 20 20 20 2d 2d 20 47 65 74 20 66 -- Get f
4f90: 69 6c 65 20 6f 66 20 72 65 76 69 73 69 6f 6e 0a ile of revision.
4fa0: 09 09 41 4e 44 20 20 20 20 52 2e 62 70 61 72 65 ..AND R.bpare
4fb0: 6e 74 20 49 53 20 4e 4f 54 20 4e 55 4c 4c 20 20 nt IS NOT NULL
4fc0: 2d 2d 20 52 65 73 74 72 69 63 74 20 74 6f 20 66 -- Restrict to f
4fd0: 69 72 73 74 20 6f 6e 20 61 20 62 72 61 6e 63 68 irst on a branch
4fe0: 0a 09 09 41 4e 44 20 20 20 20 52 2e 70 61 72 65 ...AND R.pare
4ff0: 6e 74 20 49 53 20 4e 55 4c 4c 20 20 20 20 20 20 nt IS NULL
5000: 20 2d 2d 20 42 75 74 20 74 68 65 72 65 20 69 73 -- But there is
5010: 20 6e 6f 20 6f 75 74 2d 6f 66 2d 62 72 61 6e 63 no out-of-branc
5020: 68 20 70 61 72 65 6e 74 0a 09 09 3b 0a 09 20 20 h parent...;..
5030: 20 20 7d 0a 09 23 20 46 69 6e 64 20 61 6c 6c 20 }..# Find all
5040: 72 65 76 69 73 69 6f 6e 73 20 77 69 74 68 20 61 revisions with a
5050: 20 62 72 61 6e 63 68 20 70 61 72 65 6e 74 20 73 branch parent s
5060: 79 6d 62 6f 6c 20 77 68 6f 73 65 20 70 61 72 65 ymbol whose pare
5070: 6e 74 0a 09 23 20 68 61 73 20 74 68 65 6d 20 61 nt..# has them a
5080: 73 20 70 72 69 6d 61 72 79 20 63 68 69 6c 64 2e s primary child.
5090: 0a 09 43 68 65 63 6b 20 5c 0a 09 20 20 20 20 7b ..Check \.. {
50a0: 42 72 61 6e 63 68 20 73 74 61 72 74 69 6e 67 20 Branch starting
50b0: 72 65 76 69 73 69 6f 6e 73 20 6d 75 73 74 20 6e revisions must n
50c0: 6f 74 20 62 65 20 70 72 69 6d 61 72 79 20 63 68 ot be primary ch
50d0: 69 6c 64 72 65 6e 20 6f 66 20 74 68 65 69 72 20 ildren of their
50e0: 70 61 72 65 6e 74 73 7d 20 5c 0a 09 20 20 20 20 parents} \..
50f0: 7b 61 74 20 74 68 65 20 62 65 67 69 6e 6e 69 6e {at the beginnin
5100: 67 20 6f 66 20 69 74 73 20 62 72 61 6e 63 68 20 g of its branch
5110: 69 73 20 74 68 65 20 70 72 69 6d 61 72 79 20 63 is the primary c
5120: 68 69 6c 64 20 6f 66 20 69 74 73 20 70 61 72 65 hild of its pare
5130: 6e 74 7d 20 7b 0a 09 09 53 45 4c 45 43 54 20 46 nt} {...SELECT F
5140: 2e 6e 61 6d 65 2c 20 52 2e 72 65 76 0a 09 09 46 .name, R.rev...F
5150: 52 4f 4d 20 20 20 72 65 76 69 73 69 6f 6e 20 52 ROM revision R
5160: 2c 20 72 65 76 69 73 69 6f 6e 20 50 2c 20 66 69 , revision P, fi
5170: 6c 65 20 46 0a 09 09 57 48 45 52 45 20 20 52 2e le F...WHERE R.
5180: 66 69 64 20 3d 20 46 2e 66 69 64 20 20 20 20 20 fid = F.fid
5190: 20 20 20 20 20 2d 2d 20 47 65 74 20 66 69 6c 65 -- Get file
51a0: 20 6f 66 20 72 65 76 69 73 69 6f 6e 0a 09 09 41 of revision...A
51b0: 4e 44 20 20 20 20 52 2e 62 70 61 72 65 6e 74 20 ND R.bparent
51c0: 49 53 20 4e 4f 54 20 4e 55 4c 4c 20 20 2d 2d 20 IS NOT NULL --
51d0: 52 65 73 74 72 69 63 74 20 74 6f 20 66 69 72 73 Restrict to firs
51e0: 74 20 6f 6e 20 61 20 62 72 61 6e 63 68 0a 09 09 t on a branch...
51f0: 41 4e 44 20 20 20 20 52 2e 70 61 72 65 6e 74 20 AND R.parent
5200: 49 53 20 4e 4f 54 20 4e 55 4c 4c 20 20 20 2d 2d IS NOT NULL --
5210: 20 57 68 69 63 68 20 61 72 65 20 6e 6f 74 20 64 Which are not d
5220: 65 74 61 63 68 65 64 0a 09 09 41 4e 44 20 20 20 etached...AND
5230: 20 52 2e 70 61 72 65 6e 74 20 3d 20 50 2e 72 69 R.parent = P.ri
5240: 64 20 20 20 20 20 20 20 2d 2d 20 47 65 74 20 74 d -- Get t
5250: 68 65 69 72 20 6e 6f 6e 2d 62 72 61 6e 63 68 20 heir non-branch
5260: 70 61 72 65 6e 74 0a 09 09 41 4e 44 20 20 20 20 parent...AND
5270: 50 2e 63 68 69 6c 64 20 3d 20 52 2e 72 69 64 20 P.child = R.rid
5280: 20 20 20 20 20 20 20 2d 2d 20 77 68 69 63 68 20 -- which
5290: 69 6d 70 72 6f 70 65 72 6c 79 20 68 61 73 20 74 improperly has t
52a0: 68 65 6d 20 61 73 20 70 72 69 6d 61 72 79 20 63 hem as primary c
52b0: 68 69 6c 64 0a 09 09 3b 0a 09 20 20 20 20 7d 0a hild...;.. }.
52c0: 09 23 20 46 69 6e 64 20 61 6c 6c 20 72 65 76 69 .# Find all revi
52d0: 73 69 6f 6e 73 20 77 69 74 68 20 61 20 6e 6f 6e sions with a non
52e0: 2d 4e 54 44 42 20 63 68 69 6c 64 20 77 68 69 63 -NTDB child whic
52f0: 68 20 61 72 65 20 6e 6f 74 20 6f 6e 0a 09 23 20 h are not on..#
5300: 74 68 65 20 4e 54 44 42 2e 0a 09 43 68 65 63 6b the NTDB...Check
5310: 20 5c 0a 09 20 20 20 20 7b 4e 54 44 42 20 74 6f \.. {NTDB to
5320: 20 74 72 75 6e 6b 20 74 72 61 6e 73 69 74 69 6f trunk transitio
5330: 6e 20 68 61 73 20 74 6f 20 62 65 67 69 6e 20 6f n has to begin o
5340: 6e 20 4e 54 44 42 7d 20 5c 0a 09 20 20 20 20 7b n NTDB} \.. {
5350: 68 61 73 20 61 20 6e 6f 6e 2d 4e 54 44 42 20 63 has a non-NTDB c
5360: 68 69 6c 64 2c 20 79 65 74 20 69 73 20 6e 6f 74 hild, yet is not
5370: 20 6f 6e 20 74 68 65 20 4e 54 44 42 7d 20 7b 0a on the NTDB} {.
5380: 09 09 53 45 4c 45 43 54 20 46 2e 6e 61 6d 65 2c ..SELECT F.name,
5390: 20 52 2e 72 65 76 0a 09 09 46 52 4f 4d 20 20 20 R.rev...FROM
53a0: 72 65 76 69 73 69 6f 6e 20 52 2c 20 66 69 6c 65 revision R, file
53b0: 20 46 0a 09 09 57 48 45 52 45 20 20 52 2e 66 69 F...WHERE R.fi
53c0: 64 20 3d 20 46 2e 66 69 64 20 20 20 20 20 20 20 d = F.fid
53d0: 20 20 20 2d 2d 20 47 65 74 20 66 69 6c 65 20 6f -- Get file o
53e0: 66 20 72 65 76 69 73 69 6f 6e 0a 09 09 41 4e 44 f revision...AND
53f0: 20 20 20 20 52 2e 64 62 63 68 69 6c 64 20 49 53 R.dbchild IS
5400: 20 4e 4f 54 20 4e 55 4c 4c 20 20 2d 2d 20 52 65 NOT NULL -- Re
5410: 73 74 72 69 63 74 20 74 6f 20 73 65 6d 69 2d 6c strict to semi-l
5420: 61 73 74 20 4e 54 44 42 20 72 65 76 69 73 69 6f ast NTDB revisio
5430: 6e 0a 09 09 41 4e 44 20 20 20 20 4e 4f 54 20 52 n...AND NOT R
5440: 2e 69 73 64 65 66 61 75 6c 74 20 20 20 20 20 20 .isdefault
5450: 20 20 2d 2d 20 49 6d 70 72 6f 70 65 72 6c 79 20 -- Improperly
5460: 63 6c 61 69 6d 69 6e 67 20 74 6f 20 6e 6f 74 20 claiming to not
5470: 62 65 20 6f 6e 20 4e 54 44 42 0a 09 09 3b 0a 09 be on NTDB...;..
5480: 20 20 20 20 7d 0a 09 23 20 46 69 6e 64 20 61 6c }..# Find al
5490: 6c 20 72 65 76 69 73 69 6f 6e 73 20 77 69 74 68 l revisions with
54a0: 20 61 20 4e 54 44 42 20 70 61 72 65 6e 74 20 77 a NTDB parent w
54b0: 68 69 63 68 20 61 72 65 20 6f 6e 20 74 68 65 20 hich are on the
54c0: 4e 54 44 42 2e 0a 09 43 68 65 63 6b 20 5c 0a 09 NTDB...Check \..
54d0: 20 20 20 20 7b 4e 54 44 42 20 74 6f 20 74 72 75 {NTDB to tru
54e0: 6e 6b 20 74 72 61 6e 73 69 74 69 6f 6e 20 68 61 nk transition ha
54f0: 73 20 74 6f 20 65 6e 64 20 6f 6e 20 6e 6f 6e 2d s to end on non-
5500: 4e 54 44 42 7d 20 5c 0a 09 20 20 20 20 7b 68 61 NTDB} \.. {ha
5510: 73 20 61 20 4e 54 44 42 20 70 61 72 65 6e 74 2c s a NTDB parent,
5520: 20 79 65 74 20 69 73 20 6f 6e 20 74 68 65 20 4e yet is on the N
5530: 54 44 42 7d 20 7b 0a 09 09 53 45 4c 45 43 54 20 TDB} {...SELECT
5540: 46 2e 6e 61 6d 65 2c 20 52 2e 72 65 76 0a 09 09 F.name, R.rev...
5550: 46 52 4f 4d 20 20 20 72 65 76 69 73 69 6f 6e 20 FROM revision
5560: 52 2c 20 66 69 6c 65 20 46 0a 09 09 57 48 45 52 R, file F...WHER
5570: 45 20 20 52 2e 66 69 64 20 3d 20 46 2e 66 69 64 E R.fid = F.fid
5580: 20 20 20 20 20 20 20 20 20 20 20 2d 2d 20 47 65 -- Ge
5590: 74 20 66 69 6c 65 20 6f 66 20 72 65 76 69 73 69 t file of revisi
55a0: 6f 6e 0a 09 09 41 4e 44 20 20 20 20 52 2e 64 62 on...AND R.db
55b0: 70 61 72 65 6e 74 20 49 53 20 4e 4f 54 20 4e 55 parent IS NOT NU
55c0: 4c 4c 20 20 2d 2d 20 52 65 73 74 72 69 63 74 20 LL -- Restrict
55d0: 74 6f 20 74 72 75 6e 6b 20 72 6f 6f 74 73 20 77 to trunk roots w
55e0: 69 74 68 20 4e 54 44 42 20 61 72 6f 75 6e 64 0a ith NTDB around.
55f0: 09 09 41 4e 44 20 20 20 20 52 2e 69 73 64 65 66 ..AND R.isdef
5600: 61 75 6c 74 20 20 20 20 20 20 20 20 20 20 20 20 ault
5610: 20 2d 2d 20 42 75 74 20 72 6f 6f 74 20 69 6d 70 -- But root imp
5620: 72 6f 70 65 72 6c 79 20 63 6c 61 69 6d 73 20 74 roperly claims t
5630: 6f 20 62 65 20 6f 6e 20 4e 54 44 42 0a 09 09 3b o be on NTDB...;
5640: 0a 09 20 20 20 20 7d 0a 09 23 20 46 69 6e 64 20 .. }..# Find
5650: 61 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 77 69 all revisions wi
5660: 74 68 20 61 20 63 68 69 6c 64 20 77 68 69 63 68 th a child which
5670: 20 64 69 73 61 67 72 65 65 73 20 61 62 6f 75 74 disagrees about
5680: 20 74 68 65 0a 09 23 20 6c 69 6e 65 20 6f 66 20 the..# line of
5690: 64 65 76 65 6c 6f 70 6d 65 6e 74 20 74 68 65 79 development they
56a0: 20 62 65 6c 6f 6e 67 20 74 6f 2e 0a 09 43 68 65 belong to...Che
56b0: 63 6b 20 5c 0a 09 20 20 20 20 7b 52 65 76 69 73 ck \.. {Revis
56c0: 69 6f 6e 73 20 61 6e 64 20 74 68 65 69 72 20 70 ions and their p
56d0: 72 69 6d 61 72 79 20 63 68 69 6c 64 72 65 6e 20 rimary children
56e0: 68 61 76 65 20 74 6f 20 62 65 20 69 6e 20 74 68 have to be in th
56f0: 65 20 73 61 6d 65 20 4c 4f 44 7d 20 5c 0a 09 20 e same LOD} \..
5700: 20 20 20 7b 61 6e 64 20 69 74 73 20 70 72 69 6d {and its prim
5710: 61 72 79 20 63 68 69 6c 64 20 64 69 73 61 67 72 ary child disagr
5720: 65 65 20 61 62 6f 75 74 20 74 68 65 69 72 20 4c ee about their L
5730: 4f 44 7d 20 7b 0a 09 09 53 45 4c 45 43 54 20 46 OD} {...SELECT F
5740: 2e 6e 61 6d 65 2c 20 52 2e 72 65 76 0a 09 09 46 .name, R.rev...F
5750: 52 4f 4d 20 20 20 72 65 76 69 73 69 6f 6e 20 52 ROM revision R
5760: 2c 20 72 65 76 69 73 69 6f 6e 20 43 2c 20 66 69 , revision C, fi
5770: 6c 65 20 46 0a 09 09 57 48 45 52 45 20 20 52 2e le F...WHERE R.
5780: 66 69 64 20 3d 20 46 2e 66 69 64 20 20 20 20 20 fid = F.fid
5790: 20 20 20 2d 2d 20 47 65 74 20 66 69 6c 65 20 6f -- Get file o
57a0: 66 20 72 65 76 69 73 69 6f 6e 0a 09 09 41 4e 44 f revision...AND
57b0: 20 20 20 20 52 2e 63 68 69 6c 64 20 49 53 20 4e R.child IS N
57c0: 4f 54 20 4e 55 4c 4c 20 20 2d 2d 20 52 65 73 74 OT NULL -- Rest
57d0: 72 69 63 74 20 74 6f 20 6e 6f 6e 2d 6c 65 61 76 rict to non-leav
57e0: 65 73 0a 09 09 41 4e 44 20 20 20 20 52 2e 63 68 es...AND R.ch
57f0: 69 6c 64 20 3d 20 43 2e 72 69 64 20 20 20 20 20 ild = C.rid
5800: 20 2d 2d 20 47 65 74 20 63 68 69 6c 64 20 28 68 -- Get child (h
5810: 61 73 20 74 6f 20 65 78 69 73 74 29 0a 09 09 41 as to exist)...A
5820: 4e 44 20 20 20 20 43 2e 6c 6f 64 20 21 3d 20 52 ND C.lod != R
5830: 2e 6c 6f 64 20 20 20 20 20 20 20 2d 2d 20 77 68 .lod -- wh
5840: 69 63 68 20 69 6d 70 72 6f 70 65 72 6c 79 20 75 ich improperly u
5850: 73 65 73 20 61 20 64 69 66 66 65 72 65 6e 74 20 ses a different
5860: 4c 4f 44 0a 09 09 3b 0a 09 20 20 20 20 7d 0a 09 LOD...;.. }..
5870: 23 20 46 69 6e 64 20 61 6c 6c 20 72 65 76 69 73 # Find all revis
5880: 69 6f 6e 73 20 77 69 74 68 20 61 20 6e 6f 6e 2d ions with a non-
5890: 4e 54 44 42 20 63 68 69 6c 64 20 77 68 69 63 68 NTDB child which
58a0: 20 61 67 72 65 65 73 20 61 62 6f 75 74 0a 09 23 agrees about..#
58b0: 20 74 68 65 20 6c 69 6e 65 20 6f 66 20 64 65 76 the line of dev
58c0: 65 6c 6f 70 6d 65 6e 74 20 74 68 65 79 20 62 65 elopment they be
58d0: 6c 6f 6e 67 20 74 6f 2e 0a 09 43 68 65 63 6b 20 long to...Check
58e0: 5c 0a 09 20 20 20 20 7b 4e 54 44 42 20 61 6e 64 \.. {NTDB and
58f0: 20 74 72 75 6e 6b 20 72 65 76 69 73 69 6f 6e 73 trunk revisions
5900: 20 68 61 76 65 20 74 6f 20 62 65 20 69 6e 20 64 have to be in d
5910: 69 66 66 65 72 65 6e 74 20 4c 4f 44 73 7d 20 5c ifferent LODs} \
5920: 0a 09 20 20 20 20 7b 6f 6e 20 4e 54 44 42 20 61 .. {on NTDB a
5930: 6e 64 20 69 74 73 20 6e 6f 6e 2d 4e 54 44 42 20 nd its non-NTDB
5940: 63 68 69 6c 64 20 77 72 6f 6e 67 6c 79 20 61 67 child wrongly ag
5950: 72 65 65 20 61 62 6f 75 74 20 74 68 65 69 72 20 ree about their
5960: 4c 4f 44 7d 20 7b 0a 09 09 53 45 4c 45 43 54 20 LOD} {...SELECT
5970: 46 2e 6e 61 6d 65 2c 20 52 2e 72 65 76 0a 09 09 F.name, R.rev...
5980: 46 52 4f 4d 20 20 20 72 65 76 69 73 69 6f 6e 20 FROM revision
5990: 52 2c 20 72 65 76 69 73 69 6f 6e 20 43 2c 20 66 R, revision C, f
59a0: 69 6c 65 20 46 0a 09 09 57 48 45 52 45 20 20 52 ile F...WHERE R
59b0: 2e 66 69 64 20 3d 20 46 2e 66 69 64 20 20 20 20 .fid = F.fid
59c0: 20 20 20 20 20 20 2d 2d 20 47 65 74 20 66 69 6c -- Get fil
59d0: 65 20 6f 66 20 72 65 76 69 73 69 6f 6e 0a 09 09 e of revision...
59e0: 41 4e 44 20 20 20 20 52 2e 64 62 63 68 69 6c 64 AND R.dbchild
59f0: 20 49 53 20 4e 4f 54 20 4e 55 4c 4c 20 20 2d 2d IS NOT NULL --
5a00: 20 52 65 73 74 72 69 63 74 20 74 6f 20 73 65 6d Restrict to sem
5a10: 69 2d 6c 61 73 74 20 4e 54 44 42 20 72 65 76 69 i-last NTDB revi
5a20: 73 69 6f 6e 0a 09 09 41 4e 44 20 20 20 20 52 2e sion...AND R.
5a30: 64 62 63 68 69 6c 64 20 3d 20 43 2e 72 69 64 20 dbchild = C.rid
5a40: 20 20 20 20 20 2d 2d 20 47 65 74 20 61 73 73 6f -- Get asso
5a50: 63 69 61 74 65 64 20 74 72 75 6e 6b 20 72 6f 6f ciated trunk roo
5a60: 74 20 72 65 76 69 73 69 6f 6e 0a 09 09 41 4e 44 t revision...AND
5a70: 20 20 20 20 43 2e 6c 6f 64 20 3d 20 52 2e 6c 6f C.lod = R.lo
5a80: 64 20 20 20 20 20 20 20 20 20 20 2d 2d 20 49 6d d -- Im
5a90: 70 72 6f 70 65 72 6c 79 20 75 73 65 73 20 74 68 properly uses th
5aa0: 65 20 73 61 6d 65 20 4c 4f 44 0a 09 09 3b 0a 09 e same LOD...;..
5ab0: 20 20 20 20 7d 0a 09 23 20 46 69 6e 64 20 61 6c }..# Find al
5ac0: 6c 20 72 65 76 69 73 69 6f 6e 73 20 77 69 74 68 l revisions with
5ad0: 20 61 20 62 72 61 6e 63 68 20 70 61 72 65 6e 74 a branch parent
5ae0: 20 73 79 6d 62 6f 6c 20 77 68 69 63 68 20 69 73 symbol which is
5af0: 20 6e 6f 74 0a 09 23 20 74 68 65 69 72 20 4c 4f not..# their LO
5b00: 44 2e 0a 09 43 68 65 63 6b 20 5c 0a 09 20 20 20 D...Check \..
5b10: 20 7b 42 72 61 6e 63 68 20 73 74 61 72 74 69 6e {Branch startin
5b20: 67 20 72 65 76 69 73 69 6f 6e 73 20 68 61 76 65 g revisions have
5b30: 20 74 6f 20 68 61 76 65 20 74 68 65 69 72 20 4c to have their L
5b40: 4f 44 20 61 73 20 62 72 61 6e 63 68 20 70 61 72 OD as branch par
5b50: 65 6e 74 20 73 79 6d 62 6f 6c 7d 20 5c 0a 09 20 ent symbol} \..
5b60: 20 20 20 7b 61 74 20 74 68 65 20 62 65 67 69 6e {at the begin
5b70: 6e 69 6e 67 20 6f 66 20 69 74 73 20 62 72 61 6e ning of its bran
5b80: 63 68 20 64 6f 65 73 20 6e 6f 74 20 68 61 76 65 ch does not have
5b90: 20 74 68 65 20 62 72 61 6e 63 68 20 73 79 6d 62 the branch symb
5ba0: 6f 6c 20 61 73 20 69 74 73 20 4c 4f 44 7d 20 7b ol as its LOD} {
5bb0: 0a 09 09 53 45 4c 45 43 54 20 46 2e 6e 61 6d 65 ...SELECT F.name
5bc0: 2c 20 52 2e 72 65 76 0a 09 09 46 52 4f 4d 20 20 , R.rev...FROM
5bd0: 20 72 65 76 69 73 69 6f 6e 20 52 2c 20 66 69 6c revision R, fil
5be0: 65 20 46 0a 09 09 57 48 45 52 45 20 20 52 2e 66 e F...WHERE R.f
5bf0: 69 64 20 3d 20 46 2e 66 69 64 20 20 20 20 20 20 id = F.fid
5c00: 20 20 20 20 2d 2d 20 47 65 74 20 66 69 6c 65 20 -- Get file
5c10: 6f 66 20 72 65 76 69 73 69 6f 6e 0a 09 09 41 4e of revision...AN
5c20: 44 20 20 20 20 52 2e 62 70 61 72 65 6e 74 20 49 D R.bparent I
5c30: 53 20 4e 4f 54 20 4e 55 4c 4c 20 20 2d 2d 20 52 S NOT NULL -- R
5c40: 65 73 74 72 69 63 74 20 74 6f 20 72 65 76 69 73 estrict to revis
5c50: 69 6f 6e 73 20 66 69 72 73 74 20 6f 6e 20 61 20 ions first on a
5c60: 62 72 61 6e 63 68 0a 09 09 41 4e 44 20 20 20 20 branch...AND
5c70: 52 2e 6c 6f 64 20 21 3d 20 52 2e 62 70 61 72 65 R.lod != R.bpare
5c80: 6e 74 20 20 20 20 20 2d 2d 20 61 6e 64 20 74 68 nt -- and th
5c90: 65 69 72 20 62 72 61 6e 63 68 20 69 73 20 6e 6f eir branch is no
5ca0: 74 20 74 68 65 69 72 20 4c 4f 44 0a 09 09 3b 0a t their LOD...;.
5cb0: 09 20 20 20 20 7d 0a 09 23 20 46 69 6e 64 20 61 . }..# Find a
5cc0: 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 77 69 74 ll revisions wit
5cd0: 68 20 61 20 62 72 61 6e 63 68 20 70 61 72 65 6e h a branch paren
5ce0: 74 20 73 79 6d 62 6f 6c 20 77 68 6f 73 65 20 70 t symbol whose p
5cf0: 61 72 65 6e 74 0a 09 23 20 69 73 20 69 6e 20 74 arent..# is in t
5d00: 68 65 20 73 61 6d 65 20 6c 69 6e 65 20 6f 66 20 he same line of
5d10: 64 65 76 65 6c 6f 70 6d 65 6e 74 2e 0a 09 43 68 development...Ch
5d20: 65 63 6b 20 5c 0a 09 20 20 20 20 7b 52 65 76 69 eck \.. {Revi
5d30: 73 69 6f 6e 73 20 61 6e 64 20 74 68 65 69 72 20 sions and their
5d40: 62 72 61 6e 63 68 20 63 68 69 6c 64 72 65 6e 20 branch children
5d50: 68 61 76 65 20 74 6f 20 62 65 20 69 6e 20 64 69 have to be in di
5d60: 66 66 65 72 65 6e 74 20 4c 4f 44 73 7d 20 5c 0a fferent LODs} \.
5d70: 09 20 20 20 20 7b 61 74 20 74 68 65 20 62 65 67 . {at the beg
5d80: 69 6e 6e 69 6e 67 20 6f 66 20 69 74 73 20 62 72 inning of its br
5d90: 61 6e 63 68 20 61 6e 64 20 69 74 73 20 70 61 72 anch and its par
5da0: 65 6e 74 20 77 72 6f 6e 67 6c 79 20 61 67 72 65 ent wrongly agre
5db0: 65 20 61 62 6f 75 74 20 74 68 65 69 72 20 4c 4f e about their LO
5dc0: 44 7d 20 7b 0a 09 09 53 45 4c 45 43 54 20 46 2e D} {...SELECT F.
5dd0: 6e 61 6d 65 2c 20 52 2e 72 65 76 0a 09 09 46 52 name, R.rev...FR
5de0: 4f 4d 20 20 20 72 65 76 69 73 69 6f 6e 20 52 2c OM revision R,
5df0: 20 72 65 76 69 73 69 6f 6e 20 50 2c 20 66 69 6c revision P, fil
5e00: 65 20 46 0a 09 09 57 48 45 52 45 20 20 52 2e 66 e F...WHERE R.f
5e10: 69 64 20 3d 20 46 2e 66 69 64 20 20 20 20 20 20 id = F.fid
5e20: 20 20 20 20 2d 2d 20 47 65 74 20 66 69 6c 65 20 -- Get file
5e30: 6f 66 20 72 65 76 69 73 69 6f 6e 0a 09 09 41 4e of revision...AN
5e40: 44 20 20 20 20 52 2e 62 70 61 72 65 6e 74 20 49 D R.bparent I
5e50: 53 20 4e 4f 54 20 4e 55 4c 4c 20 20 2d 2d 20 52 S NOT NULL -- R
5e60: 65 73 74 72 69 63 74 20 74 6f 20 72 65 76 69 73 estrict to revis
5e70: 69 6f 6e 73 20 66 69 72 73 74 20 6f 6e 20 61 20 ions first on a
5e80: 62 72 61 6e 63 68 0a 09 09 41 4e 44 20 20 20 20 branch...AND
5e90: 52 2e 70 61 72 65 6e 74 20 3d 20 50 2e 72 69 64 R.parent = P.rid
5ea0: 20 20 20 20 20 20 20 2d 2d 20 47 65 74 20 74 68 -- Get th
5eb0: 65 69 72 20 6e 6f 6e 2d 62 72 61 6e 63 68 20 70 eir non-branch p
5ec0: 61 72 65 6e 74 0a 09 09 41 4e 44 20 20 20 20 52 arent...AND R
5ed0: 2e 6c 6f 64 20 3d 20 50 2e 6c 6f 64 20 20 20 20 .lod = P.lod
5ee0: 20 20 20 20 20 20 2d 2d 20 57 68 69 63 68 20 69 -- Which i
5ef0: 6d 70 72 6f 70 65 72 6c 79 20 75 73 65 73 20 74 mproperly uses t
5f00: 68 65 20 73 61 6d 65 20 4c 4f 44 0a 09 09 3b 0a he same LOD...;.
5f10: 09 20 20 20 20 7d 0a 09 72 65 74 75 72 6e 0a 20 . }..return.
5f20: 20 20 20 7d 0a 0a 20 20 20 20 70 72 6f 63 20 43 }.. proc C
5f30: 68 65 63 6b 20 7b 68 65 61 64 65 72 20 6c 61 62 heck {header lab
5f40: 65 6c 20 73 71 6c 7d 20 7b 0a 09 75 70 76 61 72 el sql} {..upvar
5f50: 20 31 20 6e 20 6e 0a 09 73 65 74 20 6f 6b 20 31 1 n n..set ok 1
5f60: 0a 09 66 6f 72 65 61 63 68 20 7b 66 6e 61 6d 65 ..foreach {fname
5f70: 20 72 65 76 6e 72 7d 20 5b 73 74 61 74 65 20 72 revnr} [state r
5f80: 75 6e 20 24 73 71 6c 5d 20 7b 0a 09 20 20 20 20 un $sql] {..
5f90: 73 65 74 20 6f 6b 20 30 0a 09 20 20 20 20 74 72 set ok 0.. tr
5fa0: 6f 75 62 6c 65 20 66 61 74 61 6c 20 22 24 66 6e ouble fatal "$fn
5fb0: 61 6d 65 20 3c 24 72 65 76 6e 72 3e 20 24 6c 61 ame <$revnr> $la
5fc0: 62 65 6c 22 0a 09 7d 0a 09 6c 6f 67 20 77 72 69 bel"..}..log wri
5fd0: 74 65 20 35 20 63 6f 6c 6c 72 65 76 20 22 5c 5b te 5 collrev "\[
5fe0: 5b 66 6f 72 6d 61 74 20 25 30 32 64 20 5b 69 6e [format %02d [in
5ff0: 63 72 20 6e 5d 5d 5c 5d 20 5b 65 78 70 72 20 7b cr n]]\] [expr {
6000: 24 6f 6b 20 3f 20 22 4f 6b 20 20 20 20 22 20 3a $ok ? "Ok " :
6010: 20 22 46 61 69 6c 65 64 22 7d 5d 20 2e 2e 2e 20 "Failed"}] ...
6020: 24 68 65 61 64 65 72 22 0a 09 72 65 74 75 72 6e $header"..return
6030: 0a 20 20 20 20 7d 0a 0a 20 20 20 20 23 20 23 20 . }.. # #
6040: 23 23 20 23 23 23 20 23 23 23 23 23 20 23 23 23 ## ### ##### ###
6050: 23 23 23 23 23 20 23 23 23 23 23 23 23 23 23 23 ##### ##########
6060: 23 23 23 0a 20 20 20 20 23 23 20 49 6e 74 65 72 ###. ## Inter
6070: 6e 61 6c 20 6d 65 74 68 6f 64 73 0a 0a 20 20 20 nal methods..
6080: 20 23 20 23 20 23 23 20 23 23 23 20 23 23 23 23 # # ## ### ####
6090: 23 20 23 23 23 23 23 23 23 23 20 23 23 23 23 23 # ######## #####
60a0: 23 23 23 23 23 23 23 23 0a 20 20 20 20 23 23 20 ########. ##
60b0: 43 6f 6e 66 69 67 75 72 61 74 69 6f 6e 0a 0a 20 Configuration..
60c0: 20 20 20 70 72 61 67 6d 61 20 2d 68 61 73 69 6e pragma -hasin
60d0: 73 74 61 6e 63 65 73 20 20 20 6e 6f 20 3b 20 23 stances no ; #
60e0: 20 73 69 6e 67 6c 65 74 6f 6e 0a 20 20 20 20 70 singleton. p
60f0: 72 61 67 6d 61 20 2d 68 61 73 74 79 70 65 69 6e ragma -hastypein
6100: 66 6f 20 20 20 20 6e 6f 20 3b 20 23 20 6e 6f 20 fo no ; # no
6110: 69 6e 74 72 6f 73 70 65 63 74 69 6f 6e 0a 20 20 introspection.
6120: 20 20 70 72 61 67 6d 61 20 2d 68 61 73 74 79 70 pragma -hastyp
6130: 65 64 65 73 74 72 6f 79 20 6e 6f 20 3b 20 23 20 edestroy no ; #
6140: 69 6d 6d 6f 72 74 61 6c 0a 0a 20 20 20 20 23 20 immortal.. #
6150: 23 20 23 23 20 23 23 23 20 23 23 23 23 23 20 23 # ## ### ##### #
6160: 23 23 23 23 23 23 23 20 23 23 23 23 23 23 23 23 ####### ########
6170: 23 23 23 23 23 0a 7d 0a 0a 6e 61 6d 65 73 70 61 #####.}..namespa
6180: 63 65 20 65 76 61 6c 20 3a 3a 76 63 3a 3a 66 6f ce eval ::vc::fo
6190: 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 ssil::import::cv
61a0: 73 3a 3a 70 61 73 73 20 7b 0a 20 20 20 20 6e 61 s::pass {. na
61b0: 6d 65 73 70 61 63 65 20 65 78 70 6f 72 74 20 63 mespace export c
61c0: 6f 6c 6c 72 65 76 0a 20 20 20 20 6e 61 6d 65 73 ollrev. names
61d0: 70 61 63 65 20 65 76 61 6c 20 63 6f 6c 6c 72 65 pace eval collre
61e0: 76 20 7b 0a 09 6e 61 6d 65 73 70 61 63 65 20 69 v {..namespace i
61f0: 6d 70 6f 72 74 20 3a 3a 76 63 3a 3a 72 63 73 3a mport ::vc::rcs:
6200: 3a 70 61 72 73 65 72 0a 09 6e 61 6d 65 73 70 61 :parser..namespa
6210: 63 65 20 69 6d 70 6f 72 74 20 3a 3a 76 63 3a 3a ce import ::vc::
6220: 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a fossil::import::
6230: 63 76 73 3a 3a 72 65 70 6f 73 69 74 6f 72 79 0a cvs::repository.
6240: 09 6e 61 6d 65 73 70 61 63 65 20 69 6d 70 6f 72 .namespace impor
6250: 74 20 3a 3a 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a t ::vc::fossil::
6260: 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 73 74 61 import::cvs::sta
6270: 74 65 0a 09 6e 61 6d 65 73 70 61 63 65 20 69 6d te..namespace im
6280: 70 6f 72 74 20 3a 3a 76 63 3a 3a 66 6f 73 73 69 port ::vc::fossi
6290: 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a l::import::cvs::
62a0: 69 6e 74 65 67 72 69 74 79 0a 09 6e 61 6d 65 73 integrity..names
62b0: 70 61 63 65 20 65 76 61 6c 20 70 72 6f 6a 65 63 pace eval projec
62c0: 74 20 7b 0a 09 20 20 20 20 6e 61 6d 65 73 70 61 t {.. namespa
62d0: 63 65 20 69 6d 70 6f 72 74 20 3a 3a 76 63 3a 3a ce import ::vc::
62e0: 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a fossil::import::
62f0: 63 76 73 3a 3a 70 72 6f 6a 65 63 74 3a 3a 73 79 cvs::project::sy
6300: 6d 0a 09 7d 0a 09 6e 61 6d 65 73 70 61 63 65 20 m..}..namespace
6310: 65 76 61 6c 20 66 69 6c 65 20 7b 0a 09 20 20 20 eval file {..
6320: 20 6e 61 6d 65 73 70 61 63 65 20 69 6d 70 6f 72 namespace impor
6330: 74 20 3a 3a 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a t ::vc::fossil::
6340: 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 66 69 6c import::cvs::fil
6350: 65 3a 3a 72 65 76 0a 09 7d 0a 09 6e 61 6d 65 73 e::rev..}..names
6360: 70 61 63 65 20 69 6d 70 6f 72 74 20 3a 3a 76 63 pace import ::vc
6370: 3a 3a 74 6f 6f 6c 73 3a 3a 74 72 6f 75 62 6c 65 ::tools::trouble
6380: 0a 09 6e 61 6d 65 73 70 61 63 65 20 69 6d 70 6f ..namespace impo
6390: 72 74 20 3a 3a 76 63 3a 3a 74 6f 6f 6c 73 3a 3a rt ::vc::tools::
63a0: 6c 6f 67 0a 09 6c 6f 67 20 72 65 67 69 73 74 65 log..log registe
63b0: 72 20 63 6f 6c 6c 72 65 76 0a 20 20 20 20 7d 0a r collrev. }.
63c0: 7d 0a 0a 23 20 23 20 23 23 20 23 23 23 20 23 23 }..# # ## ### ##
63d0: 23 23 23 20 23 23 23 23 23 23 23 23 20 23 23 23 ### ######## ###
63e0: 23 23 23 23 23 23 23 23 23 23 20 23 23 23 23 23 ########## #####
63f0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
6400: 0a 23 23 20 52 65 61 64 79 0a 0a 70 61 63 6b 61 .## Ready..packa
6410: 67 65 20 70 72 6f 76 69 64 65 20 76 63 3a 3a 66 ge provide vc::f
6420: 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 ossil::import::c
6430: 76 73 3a 3a 70 61 73 73 3a 3a 63 6f 6c 6c 72 65 vs::pass::collre
6440: 76 20 31 2e 30 0a 72 65 74 75 72 6e 0a v 1.0.return.