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 0a 0a 09 20 20 20 20 6f 70 20 20 20 20 49 n.... op I
15d0: 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c NTEGER NOT NULL
15e0: 20 20 52 45 46 45 52 45 4e 43 45 53 20 6f 70 74 REFERENCES opt
15f0: 79 70 65 2c 0a 09 20 20 20 20 64 61 74 65 20 20 ype,.. date
1600: 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c INTEGER NOT NUL
1610: 4c 2c 0a 09 20 20 20 20 73 74 61 74 65 20 54 45 L,.. state TE
1620: 58 54 20 20 20 20 20 4e 4f 54 20 4e 55 4c 4c 2c XT NOT NULL,
1630: 0a 09 20 20 20 20 6d 69 64 20 20 20 49 4e 54 45 .. mid INTE
1640: 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 52 GER NOT NULL R
1650: 45 46 45 52 45 4e 43 45 53 20 6d 65 74 61 2c 0a EFERENCES meta,.
1660: 0a 09 20 20 20 20 55 4e 49 51 55 45 20 28 66 69 .. UNIQUE (fi
1670: 64 2c 20 72 65 76 29 20 2d 2d 20 54 68 65 20 44 d, rev) -- The D
1680: 54 4e 20 69 73 20 75 6e 69 71 75 65 20 77 69 74 TN is unique wit
1690: 68 69 6e 20 74 68 65 20 72 65 76 69 73 69 6f 6e hin the revision
16a0: 27 73 20 66 69 6c 65 2e 0a 09 7d 0a 0a 09 23 20 's file...}...#
16b0: 42 6c 6f 62 73 20 63 6f 6e 74 61 69 6e 20 74 68 Blobs contain th
16c0: 65 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 6e 65 e information ne
16d0: 65 64 65 64 20 74 6f 20 65 78 74 72 61 63 74 20 eded to extract
16e0: 72 65 76 69 73 69 6f 6e 73 0a 09 23 20 66 72 6f revisions..# fro
16f0: 6d 20 72 63 73 20 61 72 63 68 69 76 65 20 66 69 m rcs archive fi
1700: 6c 65 73 2e 20 41 73 20 73 75 63 68 20 65 61 63 les. As such eac
1710: 68 20 72 65 76 69 73 69 6f 6e 20 68 61 73 20 61 h revision has a
1720: 6e 0a 09 23 20 61 73 73 6f 63 69 61 74 65 64 20 n..# associated
1730: 62 6c 6f 62 2e 20 48 6f 77 65 76 65 72 20 77 65 blob. However we
1740: 20 63 61 6e 20 68 61 76 65 20 62 6c 6f 62 73 20 can have blobs
1750: 77 69 74 68 6f 75 74 0a 09 23 20 72 65 76 69 73 without..# revis
1760: 69 6f 6e 73 2e 20 54 68 69 73 20 68 61 70 70 65 ions. This happe
1770: 6e 73 20 69 66 20 61 20 6c 6f 67 69 63 61 6c 6c ns if a logicall
1780: 79 20 69 72 72 65 6c 65 76 61 6e 74 20 72 65 76 y irrelevant rev
1790: 69 73 69 6f 6e 0a 09 23 20 69 73 20 72 65 6d 6f ision..# is remo
17a0: 76 65 64 2e 20 57 65 20 6d 61 79 20 68 6f 77 65 ved. We may howe
17b0: 76 65 72 20 73 74 69 6c 6c 20 6e 65 65 64 20 69 ver still need i
17c0: 74 73 20 62 6c 6f 62 20 74 6f 20 63 6f 72 72 65 ts blob to corre
17d0: 63 74 6c 79 0a 09 23 20 65 78 70 61 6e 64 20 6f ctly..# expand o
17e0: 74 68 65 72 20 72 65 76 69 73 69 6f 6e 73 2c 20 ther revisions,
17f0: 62 6f 74 68 20 69 74 73 20 63 6f 6e 74 65 6e 74 both its content
1800: 73 20 61 6e 64 20 66 6f 72 20 74 68 65 0a 09 23 s and for the..#
1810: 20 6f 72 64 65 72 69 6e 67 2e 0a 0a 09 73 74 61 ordering....sta
1820: 74 65 20 65 78 74 65 6e 64 20 62 6c 6f 62 20 7b te extend blob {
1830: 0a 09 20 20 20 20 62 69 64 20 20 49 4e 54 45 47 .. bid INTEG
1840: 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 50 52 ER NOT NULL PR
1850: 49 4d 41 52 59 20 4b 45 59 20 41 55 54 4f 49 4e IMARY KEY AUTOIN
1860: 43 52 45 4d 45 4e 54 2c 0a 09 20 20 20 20 72 69 CREMENT,.. ri
1870: 64 20 20 49 4e 54 45 47 45 52 20 20 20 20 20 20 d INTEGER
1880: 20 20 20 20 20 20 52 45 46 45 52 45 4e 43 45 53 REFERENCES
1890: 20 72 65 76 69 73 69 6f 6e 2c 0a 09 20 20 20 20 revision,..
18a0: 66 69 64 20 20 49 4e 54 45 47 45 52 20 20 4e 4f fid INTEGER NO
18b0: 54 20 4e 55 4c 4c 20 20 52 45 46 45 52 45 4e 43 T NULL REFERENC
18c0: 45 53 20 66 69 6c 65 2c 20 20 20 2d 2d 20 46 69 ES file, -- Fi
18d0: 6c 65 20 6f 77 6e 69 6e 67 20 62 6c 6f 62 2e 0a le owning blob..
18e0: 0a 09 20 20 20 20 2d 2d 20 54 68 65 20 74 65 78 .. -- The tex
18f0: 74 20 63 6f 6e 74 65 6e 74 20 69 73 20 61 6e 20 t content is an
1900: 28 6f 66 66 73 65 74 2c 6c 65 6e 67 74 68 29 20 (offset,length)
1910: 70 61 69 72 20 69 6e 74 6f 20 74 68 65 0a 09 20 pair into the..
1920: 20 20 20 2d 2d 20 72 63 73 20 61 72 63 68 69 76 -- rcs archiv
1930: 65 2e 20 46 6f 72 20 64 65 6c 74 61 73 20 77 65 e. For deltas we
1940: 20 61 64 64 69 74 69 6f 6e 61 6c 6c 79 20 72 65 additionally re
1950: 66 65 72 20 74 6f 20 74 68 65 0a 09 20 20 20 20 fer to the..
1960: 2d 2d 20 70 61 72 65 6e 74 20 62 6c 6f 62 20 74 -- parent blob t
1970: 68 65 20 64 65 6c 74 61 20 69 73 20 6d 61 64 65 he delta is made
1980: 20 61 67 61 69 6e 73 74 2e 0a 0a 09 20 20 20 20 against....
1990: 63 6f 66 66 20 49 4e 54 45 47 45 52 20 20 4e 4f coff INTEGER NO
19a0: 54 20 4e 55 4c 4c 2c 0a 09 20 20 20 20 63 6c 65 T NULL,.. cle
19b0: 6e 20 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e n INTEGER NOT N
19c0: 55 4c 4c 2c 0a 09 20 20 20 20 70 69 64 20 20 49 ULL,.. pid I
19d0: 4e 54 45 47 45 52 20 20 20 20 20 20 20 20 20 20 NTEGER
19e0: 20 20 52 45 46 45 52 45 4e 43 45 53 20 62 6c 6f REFERENCES blo
19f0: 62 2c 0a 0a 09 20 20 20 20 55 4e 49 51 55 45 20 b,... UNIQUE
1a00: 28 72 69 64 29 0a 09 7d 20 7b 20 66 69 64 20 7d (rid)..} { fid }
1a10: 0a 09 23 20 49 6e 64 65 78 20 6f 6e 20 6f 77 6e ..# Index on own
1a20: 69 6e 67 20 66 69 6c 65 20 74 6f 20 63 6f 6c 6c ing file to coll
1a30: 65 63 74 20 61 6c 6c 20 62 6c 6f 62 73 20 6f 66 ect all blobs of
1a40: 20 61 20 66 69 6c 65 20 77 68 65 6e 20 74 68 65 a file when the
1a50: 0a 09 23 20 74 69 6d 65 20 66 6f 72 20 69 74 73 ..# time for its
1a60: 20 65 78 70 61 6e 73 69 6f 6e 20 63 6f 6d 65 73 expansion comes
1a70: 2e 0a 0a 09 73 74 61 74 65 20 65 78 74 65 6e 64 ....state extend
1a80: 20 6f 70 74 79 70 65 20 7b 0a 09 20 20 20 20 6f optype {.. o
1a90: 69 64 20 20 20 49 4e 54 45 47 45 52 20 20 4e 4f id INTEGER NO
1aa0: 54 20 4e 55 4c 4c 20 20 50 52 49 4d 41 52 59 20 T NULL PRIMARY
1ab0: 4b 45 59 2c 0a 09 20 20 20 20 6e 61 6d 65 20 20 KEY,.. name
1ac0: 54 45 58 54 20 20 20 20 20 4e 4f 54 20 4e 55 4c TEXT NOT NUL
1ad0: 4c 2c 0a 09 20 20 20 20 55 4e 49 51 55 45 28 6e L,.. UNIQUE(n
1ae0: 61 6d 65 29 0a 09 7d 0a 09 73 74 61 74 65 20 72 ame)..}..state r
1af0: 75 6e 20 7b 0a 09 20 20 20 20 49 4e 53 45 52 54 un {.. INSERT
1b00: 20 49 4e 54 4f 20 6f 70 74 79 70 65 20 56 41 4c INTO optype VAL
1b10: 55 45 53 20 28 2d 31 2c 27 64 65 6c 65 74 65 27 UES (-1,'delete'
1b20: 29 3b 20 20 2d 2d 20 54 68 65 20 6f 70 63 6f 64 ); -- The opcod
1b30: 65 20 6e 61 6d 65 73 20 61 72 65 20 74 68 65 0a e names are the.
1b40: 09 20 20 20 20 49 4e 53 45 52 54 20 49 4e 54 4f . INSERT INTO
1b50: 20 6f 70 74 79 70 65 20 56 41 4c 55 45 53 20 28 optype VALUES (
1b60: 20 30 2c 27 6e 6f 74 68 69 6e 67 27 29 3b 20 2d 0,'nothing'); -
1b70: 2d 20 66 69 78 65 64 20 70 69 65 63 65 73 2c 20 - fixed pieces,
1b80: 73 65 65 20 6d 79 6f 70 73 74 61 74 65 0a 09 20 see myopstate..
1b90: 20 20 20 49 4e 53 45 52 54 20 49 4e 54 4f 20 6f INSERT INTO o
1ba0: 70 74 79 70 65 20 56 41 4c 55 45 53 20 28 20 31 ptype VALUES ( 1
1bb0: 2c 27 61 64 64 27 29 3b 20 20 20 20 20 2d 2d 20 ,'add'); --
1bc0: 69 6e 20 66 69 6c 65 3a 3a 72 65 76 2e 20 6d 79 in file::rev. my
1bd0: 6f 70 63 6f 64 65 20 69 73 0a 09 20 20 20 20 49 opcode is.. I
1be0: 4e 53 45 52 54 20 49 4e 54 4f 20 6f 70 74 79 70 NSERT INTO optyp
1bf0: 65 20 56 41 4c 55 45 53 20 28 20 32 2c 27 63 68 e VALUES ( 2,'ch
1c00: 61 6e 67 65 27 29 3b 20 20 2d 2d 20 6c 6f 61 64 ange'); -- load
1c10: 65 64 20 66 72 6f 6d 20 74 68 69 73 2e 0a 09 7d ed from this...}
1c20: 0a 0a 09 73 74 61 74 65 20 65 78 74 65 6e 64 20 ...state extend
1c30: 72 65 76 69 73 69 6f 6e 62 72 61 6e 63 68 63 68 revisionbranchch
1c40: 69 6c 64 72 65 6e 20 7b 0a 09 20 20 20 20 2d 2d ildren {.. --
1c50: 20 54 68 65 20 6e 6f 6e 2d 70 72 69 6d 61 72 79 The non-primary
1c60: 20 63 68 69 6c 64 72 65 6e 20 6f 66 20 61 20 72 children of a r
1c70: 65 76 69 73 69 6f 6e 2c 20 61 73 20 72 65 61 63 evision, as reac
1c80: 68 61 62 6c 65 0a 09 20 20 20 20 2d 2d 20 74 68 hable.. -- th
1c90: 72 6f 75 67 68 20 61 20 62 72 61 6e 63 68 20 73 rough a branch s
1ca0: 79 6d 62 6f 6c 2c 20 61 72 65 20 6c 69 73 74 65 ymbol, are liste
1cb0: 64 20 68 65 72 65 2e 20 54 68 69 73 20 69 73 0a d here. This is.
1cc0: 09 20 20 20 20 2d 2d 20 6e 65 65 64 65 64 20 62 . -- needed b
1cd0: 79 20 70 61 73 73 20 35 20 74 6f 20 62 72 65 61 y pass 5 to brea
1ce0: 6b 20 69 6e 74 65 72 6e 61 6c 20 64 65 70 65 6e k internal depen
1cf0: 64 65 6e 63 69 65 73 20 69 6e 20 61 0a 09 20 20 dencies in a..
1d00: 20 20 2d 2d 20 63 68 61 6e 67 65 73 65 74 2e 0a -- changeset..
1d10: 0a 09 20 20 20 20 72 69 64 20 20 20 49 4e 54 45 .. rid INTE
1d20: 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 52 GER NOT NULL R
1d30: 45 46 45 52 45 4e 43 45 53 20 72 65 76 69 73 69 EFERENCES revisi
1d40: 6f 6e 2c 0a 09 20 20 20 20 62 72 69 64 20 20 49 on,.. brid I
1d50: 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c NTEGER NOT NULL
1d60: 20 20 52 45 46 45 52 45 4e 43 45 53 20 72 65 76 REFERENCES rev
1d70: 69 73 69 6f 6e 2c 0a 09 20 20 20 20 55 4e 49 51 ision,.. UNIQ
1d80: 55 45 28 72 69 64 2c 62 72 69 64 29 0a 09 7d 0a UE(rid,brid)..}.
1d90: 0a 09 73 74 61 74 65 20 65 78 74 65 6e 64 20 74 ..state extend t
1da0: 61 67 20 7b 0a 09 20 20 20 20 74 69 64 20 20 49 ag {.. tid I
1db0: 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c NTEGER NOT NULL
1dc0: 20 20 50 52 49 4d 41 52 59 20 4b 45 59 20 41 55 PRIMARY KEY AU
1dd0: 54 4f 49 4e 43 52 45 4d 45 4e 54 2c 0a 09 20 20 TOINCREMENT,..
1de0: 20 20 66 69 64 20 20 49 4e 54 45 47 45 52 20 20 fid INTEGER
1df0: 4e 4f 54 20 4e 55 4c 4c 20 20 52 45 46 45 52 45 NOT NULL REFERE
1e00: 4e 43 45 53 20 66 69 6c 65 2c 20 20 20 20 20 2d NCES file, -
1e10: 2d 20 46 69 6c 65 20 74 68 65 20 69 74 65 6d 20 - File the item
1e20: 62 65 6c 6f 6e 67 73 20 74 6f 0a 09 20 20 20 20 belongs to..
1e30: 6c 6f 64 20 20 49 4e 54 45 47 45 52 20 20 20 20 lod INTEGER
1e40: 20 20 20 20 20 20 20 20 52 45 46 45 52 45 4e 43 REFERENC
1e50: 45 53 20 73 79 6d 62 6f 6c 2c 20 20 20 2d 2d 20 ES symbol, --
1e60: 4c 69 6e 65 20 6f 66 20 64 65 76 65 6c 6f 70 6d Line of developm
1e70: 65 6e 74 20 28 4e 55 4c 4c 20 3d 3e 20 54 72 75 ent (NULL => Tru
1e80: 6e 6b 29 0a 09 20 20 20 20 73 69 64 20 20 49 4e nk).. sid IN
1e90: 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 TEGER NOT NULL
1ea0: 20 52 45 46 45 52 45 4e 43 45 53 20 73 79 6d 62 REFERENCES symb
1eb0: 6f 6c 2c 20 20 20 2d 2d 20 53 79 6d 62 6f 6c 20 ol, -- Symbol
1ec0: 63 61 70 74 75 72 69 6e 67 20 74 68 65 20 74 61 capturing the ta
1ed0: 67 0a 0a 09 20 20 20 20 72 65 76 20 20 49 4e 54 g... rev INT
1ee0: 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 EGER NOT NULL
1ef0: 52 45 46 45 52 45 4e 43 45 53 20 72 65 76 69 73 REFERENCES revis
1f00: 69 6f 6e 20 20 2d 2d 20 54 68 65 20 72 65 76 69 ion -- The revi
1f10: 73 69 6f 6e 20 62 65 69 6e 67 20 74 61 67 67 65 sion being tagge
1f20: 64 2e 0a 09 7d 20 7b 20 72 65 76 20 73 69 64 20 d...} { rev sid
1f30: 7d 0a 09 23 20 49 6e 64 69 63 65 73 20 6f 6e 3a }..# Indices on:
1f40: 20 72 65 76 20 28 72 65 76 69 73 69 6f 6e 20 73 rev (revision s
1f50: 75 63 63 65 73 73 6f 72 73 29 0a 09 23 20 20 20 uccessors)..#
1f60: 20 20 20 20 20 20 20 20 20 20 73 69 64 20 28 74 sid (t
1f70: 61 67 20 70 72 65 64 65 63 65 73 73 6f 72 73 2c ag predecessors,
1f80: 20 62 72 61 6e 63 68 20 73 75 63 63 65 73 73 6f branch successo
1f90: 72 73 2f 70 72 65 64 65 63 65 73 73 6f 72 73 29 rs/predecessors)
1fa0: 0a 0a 09 73 74 61 74 65 20 65 78 74 65 6e 64 20 ...state extend
1fb0: 62 72 61 6e 63 68 20 7b 0a 09 20 20 20 20 62 69 branch {.. bi
1fc0: 64 20 20 20 49 4e 54 45 47 45 52 20 20 4e 4f 54 d INTEGER NOT
1fd0: 20 4e 55 4c 4c 20 20 50 52 49 4d 41 52 59 20 4b NULL PRIMARY K
1fe0: 45 59 20 41 55 54 4f 49 4e 43 52 45 4d 45 4e 54 EY AUTOINCREMENT
1ff0: 2c 0a 09 20 20 20 20 66 69 64 20 20 20 49 4e 54 ,.. fid INT
2000: 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 EGER NOT NULL
2010: 52 45 46 45 52 45 4e 43 45 53 20 66 69 6c 65 2c REFERENCES file,
2020: 20 20 20 20 20 2d 2d 20 46 69 6c 65 20 74 68 65 -- File the
2030: 20 69 74 65 6d 20 62 65 6c 6f 6e 67 73 20 74 6f item belongs to
2040: 0a 09 20 20 20 20 6c 6f 64 20 20 20 49 4e 54 45 .. lod INTE
2050: 47 45 52 20 20 20 20 20 20 20 20 20 20 20 20 52 GER R
2060: 45 46 45 52 45 4e 43 45 53 20 73 79 6d 62 6f 6c EFERENCES symbol
2070: 2c 20 20 20 2d 2d 20 4c 69 6e 65 20 6f 66 20 64 , -- Line of d
2080: 65 76 65 6c 6f 70 6d 65 6e 74 20 28 4e 55 4c 4c evelopment (NULL
2090: 20 3d 3e 20 54 72 75 6e 6b 29 0a 09 20 20 20 20 => Trunk)..
20a0: 73 69 64 20 20 20 49 4e 54 45 47 45 52 20 20 4e sid INTEGER N
20b0: 4f 54 20 4e 55 4c 4c 20 20 52 45 46 45 52 45 4e OT NULL REFEREN
20c0: 43 45 53 20 73 79 6d 62 6f 6c 2c 20 20 20 2d 2d CES symbol, --
20d0: 20 53 79 6d 62 6f 6c 20 63 61 70 74 75 72 69 6e Symbol capturin
20e0: 67 20 74 68 65 20 62 72 61 6e 63 68 0a 0a 09 20 g the branch...
20f0: 20 20 20 72 6f 6f 74 20 20 49 4e 54 45 47 45 52 root INTEGER
2100: 20 20 20 20 20 20 20 20 20 20 20 20 52 45 46 45 REFE
2110: 52 45 4e 43 45 53 20 72 65 76 69 73 69 6f 6e 2c RENCES revision,
2120: 20 2d 2d 20 52 65 76 69 73 69 6f 6e 20 74 68 65 -- Revision the
2130: 20 62 72 61 6e 63 68 20 73 70 72 6f 75 74 73 20 branch sprouts
2140: 66 72 6f 6d 0a 09 20 20 20 20 66 69 72 73 74 20 from.. first
2150: 49 4e 54 45 47 45 52 20 20 20 20 20 20 20 20 20 INTEGER
2160: 20 20 20 52 45 46 45 52 45 4e 43 45 53 20 72 65 REFERENCES re
2170: 76 69 73 69 6f 6e 2c 20 2d 2d 20 46 69 72 73 74 vision, -- First
2180: 20 72 65 76 69 73 69 6f 6e 20 63 6f 6d 6d 69 74 revision commit
2190: 74 65 64 20 74 6f 20 74 68 65 20 62 72 61 6e 63 ted to the branc
21a0: 68 0a 09 20 20 20 20 62 72 61 20 20 20 54 45 58 h.. bra TEX
21b0: 54 20 20 20 20 20 4e 4f 54 20 4e 55 4c 4c 2c 20 T NOT NULL,
21c0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
21d0: 20 20 20 20 20 2d 2d 20 62 72 61 6e 63 68 20 6e -- branch n
21e0: 75 6d 62 65 72 0a 09 20 20 20 20 70 6f 73 20 20 umber.. pos
21f0: 20 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 INTEGER NOT NU
2200: 4c 4c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 LL
2210: 20 20 20 20 20 20 20 20 20 2d 2d 20 63 72 65 61 -- crea
2220: 74 69 6f 6e 20 6f 72 64 65 72 20 69 6e 20 72 6f tion order in ro
2230: 6f 74 2e 0a 0a 09 20 20 20 20 2d 2d 20 41 20 62 ot.... -- A b
2240: 72 61 6e 63 68 20 63 61 6e 20 65 78 69 73 74 20 ranch can exist
2250: 77 69 74 68 6f 75 74 20 72 6f 6f 74 2e 20 49 74 without root. It
2260: 20 68 61 70 70 65 6e 73 20 77 68 65 6e 20 74 68 happens when th
2270: 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 2d 2d e. --
2280: 20 6f 6e 6c 79 20 72 65 76 69 73 69 6f 6e 20 6f only revision o
2290: 6e 20 74 72 75 6e 6b 20 69 73 20 74 68 65 20 75 n trunk is the u
22a0: 6e 6e 65 63 65 73 73 61 72 79 20 64 65 61 64 20 nnecessary dead
22b0: 6f 6e 65 20 74 68 65 0a 20 20 20 20 20 20 20 20 one the.
22c0: 20 20 20 20 2d 2d 20 62 72 61 6e 63 68 20 77 61 -- branch wa
22d0: 73 20 73 70 72 6f 75 74 65 64 20 66 72 6f 6d 20 s sprouted from
22e0: 61 6e 64 20 69 74 20 68 61 73 20 63 6f 6d 6d 69 and it has commi
22f0: 74 73 2e 20 54 68 65 20 62 72 61 6e 63 68 0a 20 ts. The branch.
2300: 20 20 20 20 20 20 20 20 20 20 20 2d 2d 20 77 69 -- wi
2310: 6c 6c 20 65 78 69 73 74 20 74 6f 20 62 65 20 74 ll exist to be t
2320: 68 65 20 4c 4f 44 20 6f 66 20 69 74 73 20 72 65 he LOD of its re
2330: 76 69 73 69 6f 6e 73 2c 20 6e 6f 74 68 69 6e 67 visions, nothing
2340: 20 74 6f 0a 20 20 20 20 20 20 20 20 20 20 20 20 to.
2350: 2d 2d 20 73 70 72 6f 75 74 20 66 72 6f 6d 2c 20 -- sprout from,
2360: 74 68 65 20 64 65 61 64 20 72 65 76 69 73 69 6f the dead revisio
2370: 6e 20 77 61 73 20 72 65 6d 6f 76 65 64 2c 20 68 n was removed, h
2380: 65 6e 63 65 20 6e 6f 0a 20 20 20 20 20 20 20 20 ence no.
2390: 20 20 20 20 2d 2d 20 72 6f 6f 74 2e 0a 09 7d 20 -- root...}
23a0: 7b 20 72 6f 6f 74 20 66 69 72 73 74 20 73 69 64 { root first sid
23b0: 20 7d 0a 09 23 20 49 6e 64 69 63 65 73 20 6f 6e }..# Indices on
23c0: 3a 20 72 6f 6f 74 20 20 28 72 65 76 69 73 69 6f : root (revisio
23d0: 6e 20 73 75 63 63 65 73 73 6f 72 73 29 0a 09 23 n successors)..#
23e0: 20 20 20 20 20 20 20 20 20 20 20 20 20 66 69 72 fir
23f0: 73 74 20 28 72 65 76 69 73 69 6f 6e 20 70 72 65 st (revision pre
2400: 64 65 63 65 73 73 6f 72 73 29 0a 09 23 20 20 20 decessors)..#
2410: 20 20 20 20 20 20 20 20 20 20 73 69 64 20 20 20 sid
2420: 28 74 61 67 20 70 72 65 64 65 63 65 73 73 6f 72 (tag predecessor
2430: 73 2c 20 62 72 61 6e 63 68 20 73 75 63 63 65 73 s, branch succes
2440: 73 6f 72 73 2f 70 72 65 64 65 63 65 73 73 6f 72 sors/predecessor
2450: 73 29 0a 0a 09 23 20 50 72 6f 6a 65 63 74 20 6c s)...# Project l
2460: 65 76 65 6c 20 2e 2e 2e 0a 09 23 09 70 4c 69 6e evel .....#.pLin
2470: 65 4f 66 44 65 76 65 6c 6f 70 6d 65 6e 74 2c 20 eOfDevelopment,
2480: 70 53 79 6d 62 6f 6c 2c 20 70 42 72 61 6e 63 68 pSymbol, pBranch
2490: 2c 20 70 54 61 67 2c 20 70 54 72 75 6e 6b 0a 09 , pTag, pTrunk..
24a0: 23 0a 09 23 09 70 54 72 75 6e 6b 20 20 3c 2d 20 #..#.pTrunk <-
24b0: 70 4c 69 6e 65 4f 66 44 65 76 65 6c 6f 70 6d 65 pLineOfDevelopme
24c0: 6e 74 0a 09 23 09 70 42 72 61 6e 63 68 20 3c 2d nt..#.pBranch <-
24d0: 20 70 53 79 6d 62 6f 6c 2c 20 70 4c 69 6e 65 4f pSymbol, pLineO
24e0: 66 44 65 76 65 6c 6f 70 6d 65 6e 74 0a 09 23 09 fDevelopment..#.
24f0: 70 54 61 67 20 20 20 20 3c 2d 20 70 53 79 6d 62 pTag <- pSymb
2500: 6f 6c 2c 20 70 4c 69 6e 65 4f 66 44 65 76 65 6c ol, pLineOfDevel
2510: 6f 70 6d 65 6e 74 0a 0a 09 73 74 61 74 65 20 65 opment...state e
2520: 78 74 65 6e 64 20 73 79 6d 62 6f 6c 20 7b 0a 09 xtend symbol {..
2530: 20 20 20 20 73 69 64 20 20 49 4e 54 45 47 45 52 sid INTEGER
2540: 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 50 52 49 4d NOT NULL PRIM
2550: 41 52 59 20 4b 45 59 20 41 55 54 4f 49 4e 43 52 ARY KEY AUTOINCR
2560: 45 4d 45 4e 54 2c 0a 09 20 20 20 20 70 69 64 20 EMENT,.. pid
2570: 20 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 INTEGER NOT NU
2580: 4c 4c 20 20 52 45 46 45 52 45 4e 43 45 53 20 70 LL REFERENCES p
2590: 72 6f 6a 65 63 74 2c 20 20 2d 2d 20 50 72 6f 6a roject, -- Proj
25a0: 65 63 74 20 74 68 65 20 73 79 6d 62 6f 6c 20 62 ect the symbol b
25b0: 65 6c 6f 6e 67 73 20 74 6f 0a 09 20 20 20 20 6e elongs to.. n
25c0: 61 6d 65 20 54 45 58 54 20 20 20 20 20 4e 4f 54 ame TEXT NOT
25d0: 20 4e 55 4c 4c 2c 0a 09 20 20 20 20 74 79 70 65 NULL,.. type
25e0: 20 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 INTEGER NOT NU
25f0: 4c 4c 20 20 52 45 46 45 52 45 4e 43 45 53 20 73 LL REFERENCES s
2600: 79 6d 74 79 70 65 2c 20 20 2d 2d 20 65 6e 75 6d ymtype, -- enum
2610: 20 7b 20 65 78 63 6c 75 64 65 64 20 3d 20 30 2c { excluded = 0,
2620: 20 74 61 67 2c 20 62 72 61 6e 63 68 2c 20 75 6e tag, branch, un
2630: 64 65 66 69 6e 65 64 20 7d 0a 0a 09 20 20 20 20 defined }...
2640: 74 61 67 5f 63 6f 75 6e 74 20 20 20 20 49 4e 54 tag_count INT
2650: 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 2c 20 EGER NOT NULL,
2660: 2d 2d 20 48 6f 77 20 6f 66 74 65 6e 20 74 68 65 -- How often the
2670: 20 73 79 6d 62 6f 6c 20 69 73 20 75 73 65 64 20 symbol is used
2680: 61 73 20 74 61 67 2e 0a 09 20 20 20 20 62 72 61 as tag... bra
2690: 6e 63 68 5f 63 6f 75 6e 74 20 49 4e 54 45 47 45 nch_count INTEGE
26a0: 52 20 20 4e 4f 54 20 4e 55 4c 4c 2c 20 2d 2d 20 R NOT NULL, --
26b0: 48 6f 77 20 6f 66 74 65 6e 20 74 68 65 20 73 79 How often the sy
26c0: 6d 62 6f 6c 20 69 73 20 75 73 65 64 20 61 73 20 mbol is used as
26d0: 62 72 61 6e 63 68 0a 09 20 20 20 20 63 6f 6d 6d branch.. comm
26e0: 69 74 5f 63 6f 75 6e 74 20 49 4e 54 45 47 45 52 it_count INTEGER
26f0: 20 20 4e 4f 54 20 4e 55 4c 4c 2c 20 2d 2d 20 48 NOT NULL, -- H
2700: 6f 77 20 6f 66 74 65 6e 20 61 20 66 69 6c 65 20 ow often a file
2710: 77 61 73 20 63 6f 6d 6d 69 74 74 65 64 20 6f 6e was committed on
2720: 20 74 68 65 20 73 79 6d 62 6f 6c 0a 0a 09 20 20 the symbol...
2730: 20 20 55 4e 49 51 55 45 20 28 70 69 64 2c 20 6e UNIQUE (pid, n
2740: 61 6d 65 29 20 2d 2d 20 53 79 6d 62 6f 6c 73 20 ame) -- Symbols
2750: 61 72 65 20 75 6e 69 71 75 65 20 77 69 74 68 69 are unique withi
2760: 6e 20 74 68 65 20 70 72 6f 6a 65 63 74 0a 09 7d n the project..}
2770: 0a 0a 09 73 74 61 74 65 20 65 78 74 65 6e 64 20 ...state extend
2780: 62 6c 6f 63 6b 65 72 20 7b 0a 09 20 20 20 20 2d blocker {.. -
2790: 2d 20 46 6f 72 20 65 61 63 68 20 73 79 6d 62 6f - For each symbo
27a0: 6c 20 77 65 20 73 61 76 65 20 77 68 69 63 68 20 l we save which
27b0: 6f 74 68 65 72 20 73 79 6d 62 6f 6c 73 20 61 72 other symbols ar
27c0: 65 0a 09 20 20 20 20 2d 2d 20 62 6c 6f 63 6b 69 e.. -- blocki
27d0: 6e 67 20 69 74 73 20 72 65 6d 6f 76 61 6c 20 28 ng its removal (
27e0: 69 66 20 74 68 65 20 75 73 65 72 20 61 73 6b 73 if the user asks
27f0: 20 66 6f 72 20 69 74 29 2e 0a 0a 09 20 20 20 20 for it)....
2800: 73 69 64 20 49 4e 54 45 47 45 52 20 20 4e 4f 54 sid INTEGER NOT
2810: 20 4e 55 4c 4c 20 20 52 45 46 45 52 45 4e 43 45 NULL REFERENCE
2820: 53 20 73 79 6d 62 6f 6c 2c 20 2d 2d 0a 09 20 20 S symbol, --..
2830: 20 20 62 69 64 20 49 4e 54 45 47 45 52 20 20 4e bid INTEGER N
2840: 4f 54 20 4e 55 4c 4c 20 20 52 45 46 45 52 45 4e OT NULL REFEREN
2850: 43 45 53 20 73 79 6d 62 6f 6c 2c 20 2d 2d 20 53 CES symbol, -- S
2860: 70 72 6f 75 74 65 64 20 66 72 6f 6d 20 73 69 64 prouted from sid
2870: 2c 20 62 6c 6f 63 6b 73 20 69 74 2e 0a 09 20 20 , blocks it...
2880: 20 20 55 4e 49 51 55 45 20 28 73 69 64 2c 20 62 UNIQUE (sid, b
2890: 69 64 29 0a 09 7d 0a 0a 09 73 74 61 74 65 20 65 id)..}...state e
28a0: 78 74 65 6e 64 20 70 61 72 65 6e 74 20 7b 0a 09 xtend parent {..
28b0: 20 20 20 20 2d 2d 20 46 6f 72 20 65 61 63 68 20 -- For each
28c0: 73 79 6d 62 6f 6c 20 77 65 20 73 61 76 65 20 77 symbol we save w
28d0: 68 69 63 68 20 6f 74 68 65 72 20 73 79 6d 62 6f hich other symbo
28e0: 6c 73 20 63 61 6e 20 61 63 74 20 61 73 0a 09 20 ls can act as..
28f0: 20 20 20 2d 2d 20 61 20 70 6f 73 73 69 62 6c 65 -- a possible
2900: 20 70 61 72 65 6e 74 20 69 6e 20 73 6f 6d 65 20 parent in some
2910: 66 69 6c 65 2c 20 61 6e 64 20 68 6f 77 20 6f 66 file, and how of
2920: 74 65 6e 2e 0a 0a 09 20 20 20 20 73 69 64 20 49 ten.... sid I
2930: 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c NTEGER NOT NULL
2940: 20 20 52 45 46 45 52 45 4e 43 45 53 20 73 79 6d REFERENCES sym
2950: 62 6f 6c 2c 20 2d 2d 0a 09 20 20 20 20 70 69 64 bol, --.. pid
2960: 20 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 INTEGER NOT NU
2970: 4c 4c 20 20 52 45 46 45 52 45 4e 43 45 53 20 73 LL REFERENCES s
2980: 79 6d 62 6f 6c 2c 20 2d 2d 20 50 6f 73 73 69 62 ymbol, -- Possib
2990: 6c 65 20 70 61 72 65 6e 74 20 6f 66 20 73 69 64 le parent of sid
29a0: 0a 09 20 20 20 20 6e 20 20 20 49 4e 54 45 47 45 .. n INTEGE
29b0: 52 20 20 4e 4f 54 20 4e 55 4c 4c 2c 20 20 20 20 R NOT NULL,
29c0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
29d0: 2d 2d 20 48 6f 77 20 6f 66 74 65 6e 20 70 69 64 -- How often pid
29e0: 20 63 61 6e 20 61 63 74 20 61 73 20 70 61 72 65 can act as pare
29f0: 6e 74 2e 0a 09 20 20 20 20 55 4e 49 51 55 45 20 nt... UNIQUE
2a00: 28 73 69 64 2c 20 70 69 64 29 0a 09 7d 0a 0a 09 (sid, pid)..}...
2a10: 73 74 61 74 65 20 65 78 74 65 6e 64 20 73 79 6d state extend sym
2a20: 74 79 70 65 20 7b 0a 09 20 20 20 20 74 69 64 20 type {.. tid
2a30: 20 20 20 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 INTEGER NOT
2a40: 4e 55 4c 4c 20 20 50 52 49 4d 41 52 59 20 4b 45 NULL PRIMARY KE
2a50: 59 2c 0a 09 20 20 20 20 6e 61 6d 65 20 20 20 54 Y,.. name T
2a60: 45 58 54 20 20 20 20 20 4e 4f 54 20 4e 55 4c 4c EXT NOT NULL
2a70: 2c 0a 09 20 20 20 20 70 6c 75 72 61 6c 20 54 45 ,.. plural TE
2a80: 58 54 20 20 20 20 20 4e 4f 54 20 4e 55 4c 4c 2c XT NOT NULL,
2a90: 0a 09 20 20 20 20 55 4e 49 51 55 45 20 28 6e 61 .. UNIQUE (na
2aa0: 6d 65 29 0a 09 20 20 20 20 55 4e 49 51 55 45 20 me).. UNIQUE
2ab0: 28 70 6c 75 72 61 6c 29 0a 09 7d 0a 09 73 74 61 (plural)..}..sta
2ac0: 74 65 20 72 75 6e 20 7b 0a 09 20 20 20 20 49 4e te run {.. IN
2ad0: 53 45 52 54 20 49 4e 54 4f 20 73 79 6d 74 79 70 SERT INTO symtyp
2ae0: 65 20 56 41 4c 55 45 53 20 28 30 2c 27 65 78 63 e VALUES (0,'exc
2af0: 6c 75 64 65 64 27 2c 20 27 65 78 63 6c 75 64 65 luded', 'exclude
2b00: 64 27 29 3b 20 20 2d 2d 20 54 68 65 20 69 64 73 d'); -- The ids
2b10: 20 61 72 65 20 74 68 65 20 66 69 78 65 64 0a 09 are the fixed..
2b20: 20 20 20 20 49 4e 53 45 52 54 20 49 4e 54 4f 20 INSERT INTO
2b30: 73 79 6d 74 79 70 65 20 56 41 4c 55 45 53 20 28 symtype VALUES (
2b40: 31 2c 27 74 61 67 27 2c 20 20 20 20 20 20 27 74 1,'tag', 't
2b50: 61 67 73 27 29 3b 20 20 20 20 20 20 2d 2d 20 70 ags'); -- p
2b60: 69 65 63 65 73 2c 20 73 65 65 20 70 72 6f 6a 65 ieces, see proje
2b70: 63 74 3a 3a 73 79 6d 2c 0a 09 20 20 20 20 49 4e ct::sym,.. IN
2b80: 53 45 52 54 20 49 4e 54 4f 20 73 79 6d 74 79 70 SERT INTO symtyp
2b90: 65 20 56 41 4c 55 45 53 20 28 32 2c 27 62 72 61 e VALUES (2,'bra
2ba0: 6e 63 68 27 2c 20 20 20 27 62 72 61 6e 63 68 65 nch', 'branche
2bb0: 73 27 29 3b 20 20 2d 2d 20 67 65 74 73 79 6d 74 s'); -- getsymt
2bc0: 79 70 65 73 20 61 6e 64 20 61 73 73 6f 63 69 61 ypes and associa
2bd0: 74 65 64 0a 09 20 20 20 20 49 4e 53 45 52 54 20 ted.. INSERT
2be0: 49 4e 54 4f 20 73 79 6d 74 79 70 65 20 56 41 4c INTO symtype VAL
2bf0: 55 45 53 20 28 33 2c 27 75 6e 64 65 66 69 6e 65 UES (3,'undefine
2c00: 64 27 2c 27 75 6e 64 65 66 69 6e 65 64 27 29 3b d','undefined');
2c10: 20 2d 2d 20 74 79 70 65 76 61 72 69 61 62 6c 65 -- typevariable
2c20: 73 2e 0a 09 7d 0a 0a 09 73 74 61 74 65 20 65 78 s...}...state ex
2c30: 74 65 6e 64 20 6d 65 74 61 20 7b 0a 09 20 20 20 tend meta {..
2c40: 20 2d 2d 20 4d 65 74 61 20 64 61 74 61 20 6f 66 -- Meta data of
2c50: 20 72 65 76 69 73 69 6f 6e 73 2e 20 53 65 65 20 revisions. See
2c60: 72 65 76 69 73 69 6f 6e 2e 6d 69 64 20 66 6f 72 revision.mid for
2c70: 20 74 68 65 0a 09 20 20 20 20 2d 2d 20 72 65 66 the.. -- ref
2c80: 65 72 65 6e 63 65 2e 20 4d 61 6e 79 20 72 65 76 erence. Many rev
2c90: 69 73 69 6f 6e 73 20 63 61 6e 20 73 68 61 72 65 isions can share
2ca0: 20 6d 65 74 61 20 64 61 74 61 2e 20 54 68 69 73 meta data. This
2cb0: 20 69 73 0a 09 20 20 20 20 2d 2d 20 61 63 74 75 is.. -- actu
2cc0: 61 6c 6c 79 20 6f 6e 65 20 6f 66 20 74 68 65 20 ally one of the
2cd0: 63 72 69 74 65 72 69 6f 6e 73 20 75 73 65 64 20 criterions used
2ce0: 74 6f 20 73 6f 72 74 20 72 65 76 69 73 69 6f 6e to sort revision
2cf0: 73 0a 09 20 20 20 20 2d 2d 20 69 6e 74 6f 20 63 s.. -- into c
2d00: 68 61 6e 67 65 73 65 74 73 2e 0a 0a 09 20 20 20 hangesets....
2d10: 20 6d 69 64 20 49 4e 54 45 47 45 52 20 20 4e 4f mid INTEGER NO
2d20: 54 20 4e 55 4c 4c 20 20 50 52 49 4d 41 52 59 20 T NULL PRIMARY
2d30: 4b 45 59 20 20 41 55 54 4f 49 4e 43 52 45 4d 45 KEY AUTOINCREME
2d40: 4e 54 2c 0a 0a 09 20 20 20 20 2d 2d 20 4d 65 74 NT,... -- Met
2d50: 61 20 64 61 74 61 20 62 65 6c 6f 6e 67 73 20 74 a data belongs t
2d60: 6f 20 61 20 73 70 65 63 69 66 69 63 20 70 72 6f o a specific pro
2d70: 6a 65 63 74 2c 20 73 74 72 6f 6e 67 65 72 2c 20 ject, stronger,
2d80: 74 6f 20 61 0a 09 20 20 20 20 2d 2d 20 62 72 61 to a.. -- bra
2d90: 6e 63 68 20 69 6e 20 74 68 61 74 20 70 72 6f 6a nch in that proj
2da0: 65 63 74 2e 20 49 74 20 66 75 72 74 68 65 72 20 ect. It further
2db0: 68 61 73 20 61 20 6c 6f 67 20 6d 65 73 73 61 67 has a log messag
2dc0: 65 2c 0a 09 20 20 20 20 2d 2d 20 61 6e 64 20 69 e,.. -- and i
2dd0: 74 73 20 61 75 74 68 6f 72 2e 20 54 68 69 73 20 ts author. This
2de0: 69 73 20 75 6e 69 71 75 65 20 77 69 74 68 20 74 is unique with t
2df0: 68 65 20 70 72 6f 6a 65 63 74 20 61 6e 64 0a 09 he project and..
2e00: 20 20 20 20 2d 2d 20 62 72 61 6e 63 68 2e 0a 0a -- branch...
2e10: 09 20 20 20 20 70 69 64 20 49 4e 54 45 47 45 52 . pid INTEGER
2e20: 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 52 45 46 45 NOT NULL REFE
2e30: 52 45 4e 43 45 53 20 70 72 6f 6a 65 63 74 2c 20 RENCES project,
2e40: 20 2d 2d 0a 09 20 20 20 20 62 69 64 20 49 4e 54 --.. bid INT
2e50: 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 EGER NOT NULL
2e60: 52 45 46 45 52 45 4e 43 45 53 20 73 79 6d 62 6f REFERENCES symbo
2e70: 6c 2c 20 20 20 2d 2d 0a 09 20 20 20 20 61 69 64 l, --.. aid
2e80: 20 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 INTEGER NOT NU
2e90: 4c 4c 20 20 52 45 46 45 52 45 4e 43 45 53 20 61 LL REFERENCES a
2ea0: 75 74 68 6f 72 2c 20 20 20 2d 2d 0a 09 20 20 20 uthor, --..
2eb0: 20 63 69 64 20 49 4e 54 45 47 45 52 20 20 4e 4f cid INTEGER NO
2ec0: 54 20 4e 55 4c 4c 20 20 52 45 46 45 52 45 4e 43 T NULL REFERENC
2ed0: 45 53 20 63 6d 65 73 73 61 67 65 2c 20 2d 2d 0a ES cmessage, --.
2ee0: 0a 09 20 20 20 20 55 4e 49 51 55 45 20 28 70 69 .. UNIQUE (pi
2ef0: 64 2c 20 62 69 64 2c 20 61 69 64 2c 20 63 69 64 d, bid, aid, cid
2f00: 29 0a 0a 09 20 20 20 20 2d 2d 20 43 6f 6e 73 74 )... -- Const
2f10: 72 61 69 6e 74 73 3a 20 54 68 65 20 70 72 6f 6a raints: The proj
2f20: 65 63 74 20 6f 66 20 74 68 65 20 6d 65 74 61 20 ect of the meta
2f30: 64 61 74 61 20 6f 66 20 61 20 72 65 76 69 73 69 data of a revisi
2f40: 6f 6e 0a 09 20 20 20 20 2d 2d 20 20 20 20 20 20 on.. --
2f50: 20 20 20 20 20 20 20 20 58 20 69 73 20 74 68 65 X is the
2f60: 20 73 61 6d 65 20 61 73 20 74 68 65 20 70 72 6f same as the pro
2f70: 6a 65 63 74 20 6f 66 20 58 20 69 74 73 65 6c 66 ject of X itself
2f80: 2e 0a 09 20 20 20 20 2d 2d 0a 09 20 20 20 20 2d ... --.. -
2f90: 2d 20 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 20 54 - ............ T
2fa0: 68 65 20 62 72 61 6e 63 68 20 6f 66 20 74 68 65 he branch 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 6c 69 6e 65 20 6f 66 20 64 65 76 65 6c he line of devel
3000: 6f 70 6d 65 6e 74 0a 09 20 20 20 20 2d 2d 20 20 opment.. --
3010: 20 20 20 20 20 20 20 20 20 20 20 20 6f 66 20 58 of X
3020: 20 69 74 73 65 6c 66 2e 0a 09 7d 0a 0a 09 23 20 itself...}...#
3030: 41 75 74 68 6f 72 73 20 61 6e 64 20 63 6f 6d 6d Authors and comm
3040: 69 74 20 6d 65 73 73 61 67 65 73 20 61 72 65 20 it messages are
3050: 66 75 6c 6c 79 20 67 6c 6f 62 61 6c 2c 20 69 2e fully global, i.
3060: 65 2e 20 70 65 72 0a 09 23 20 72 65 70 6f 73 69 e. per..# reposi
3070: 74 6f 72 79 2e 0a 0a 09 73 74 61 74 65 20 65 78 tory....state ex
3080: 74 65 6e 64 20 61 75 74 68 6f 72 20 7b 0a 09 20 tend author {..
3090: 20 20 20 61 69 64 20 20 49 4e 54 45 47 45 52 20 aid INTEGER
30a0: 20 4e 4f 54 20 4e 55 4c 4c 20 20 50 52 49 4d 41 NOT NULL PRIMA
30b0: 52 59 20 4b 45 59 20 20 41 55 54 4f 49 4e 43 52 RY KEY AUTOINCR
30c0: 45 4d 45 4e 54 2c 20 2d 2d 20 50 6f 6f 6c 20 6f EMENT, -- Pool o
30d0: 66 20 74 68 65 20 75 6e 69 71 75 65 0a 09 20 20 f the unique..
30e0: 20 20 6e 61 6d 65 20 54 45 58 54 20 20 20 20 20 name TEXT
30f0: 4e 4f 54 20 4e 55 4c 4c 20 20 55 4e 49 51 55 45 NOT NULL UNIQUE
3100: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
3110: 20 20 20 20 20 20 2d 2d 20 61 75 74 68 6f 72 20 -- author
3120: 6e 61 6d 65 73 2e 0a 09 7d 0a 0a 09 73 74 61 74 names...}...stat
3130: 65 20 65 78 74 65 6e 64 20 63 6d 65 73 73 61 67 e extend cmessag
3140: 65 20 7b 0a 09 20 20 20 20 63 69 64 20 20 49 4e e {.. cid IN
3150: 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 TEGER NOT NULL
3160: 20 50 52 49 4d 41 52 59 20 4b 45 59 20 20 41 55 PRIMARY KEY AU
3170: 54 4f 49 4e 43 52 45 4d 45 4e 54 2c 20 2d 2d 20 TOINCREMENT, --
3180: 50 6f 6f 6c 20 6f 66 20 74 68 65 20 75 6e 69 71 Pool of the uniq
3190: 75 65 0a 09 20 20 20 20 74 65 78 74 20 54 45 58 ue.. text TEX
31a0: 54 20 20 20 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 T NOT NULL
31b0: 55 4e 49 51 55 45 20 20 20 20 20 20 20 20 20 20 UNIQUE
31c0: 20 20 20 20 20 20 20 20 20 20 20 20 2d 2d 20 6c -- l
31d0: 6f 67 20 6d 65 73 73 61 67 65 73 0a 09 7d 0a 0a og messages..}..
31e0: 09 70 72 6f 6a 65 63 74 3a 3a 73 79 6d 20 67 65 .project::sym ge
31f0: 74 73 79 6d 74 79 70 65 73 0a 09 66 69 6c 65 3a tsymtypes..file:
3200: 3a 72 65 76 20 20 20 20 67 65 74 6f 70 63 6f 64 :rev getopcod
3210: 65 73 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 7d es..return. }
3220: 0a 0a 20 20 20 20 74 79 70 65 6d 65 74 68 6f 64 .. typemethod
3230: 20 6c 6f 61 64 20 7b 7d 20 7b 0a 09 73 74 61 74 load {} {..stat
3240: 65 20 75 73 65 20 73 79 6d 62 6f 6c 0a 09 73 74 e use symbol..st
3250: 61 74 65 20 75 73 65 20 73 79 6d 74 79 70 65 0a ate use symtype.
3260: 09 73 74 61 74 65 20 75 73 65 20 6f 70 74 79 70 .state use optyp
3270: 65 0a 0a 09 70 72 6f 6a 65 63 74 3a 3a 73 79 6d e...project::sym
3280: 20 67 65 74 73 79 6d 74 79 70 65 73 0a 09 66 69 getsymtypes..fi
3290: 6c 65 3a 3a 72 65 76 20 20 20 20 67 65 74 6f 70 le::rev getop
32a0: 63 6f 64 65 73 0a 09 72 65 70 6f 73 69 74 6f 72 codes..repositor
32b0: 79 20 20 20 6c 6f 61 64 73 79 6d 62 6f 6c 73 0a y loadsymbols.
32c0: 09 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 .return. }..
32d0: 20 20 20 74 79 70 65 6d 65 74 68 6f 64 20 72 75 typemethod ru
32e0: 6e 20 7b 7d 20 7b 0a 09 23 20 50 61 73 73 20 6d n {} {..# Pass m
32f0: 61 6e 61 67 65 72 20 69 6e 74 65 72 66 61 63 65 anager interface
3300: 2e 20 45 78 65 63 75 74 65 64 20 74 6f 20 70 65 . Executed to pe
3310: 72 66 6f 72 6d 20 74 68 65 0a 09 23 20 66 75 6e rform the..# fun
3320: 63 74 69 6f 6e 61 6c 69 74 79 20 6f 66 20 74 68 ctionality of th
3330: 65 20 70 61 73 73 2e 0a 0a 09 73 65 74 20 72 62 e pass....set rb
3340: 61 73 65 20 5b 72 65 70 6f 73 69 74 6f 72 79 20 ase [repository
3350: 62 61 73 65 3f 5d 0a 09 66 6f 72 65 61 63 68 20 base?]..foreach
3360: 70 72 6f 6a 65 63 74 20 5b 72 65 70 6f 73 69 74 project [reposit
3370: 6f 72 79 20 70 72 6f 6a 65 63 74 73 5d 20 7b 0a ory projects] {.
3380: 09 20 20 20 20 73 65 74 20 62 61 73 65 20 5b 3a . set base [:
3390: 3a 66 69 6c 65 20 6a 6f 69 6e 20 24 72 62 61 73 :file join $rbas
33a0: 65 20 5b 24 70 72 6f 6a 65 63 74 20 62 61 73 65 e [$project base
33b0: 5d 5d 0a 09 20 20 20 20 6c 6f 67 20 77 72 69 74 ]].. log writ
33c0: 65 20 31 20 63 6f 6c 6c 72 65 76 20 22 50 72 6f e 1 collrev "Pro
33d0: 63 65 73 73 69 6e 67 20 24 62 61 73 65 22 0a 0a cessing $base"..
33e0: 09 20 20 20 20 66 6f 72 65 61 63 68 20 66 69 6c . foreach fil
33f0: 65 20 5b 24 70 72 6f 6a 65 63 74 20 66 69 6c 65 e [$project file
3400: 73 5d 20 7b 0a 09 09 73 65 74 20 70 61 74 68 20 s] {...set path
3410: 5b 24 66 69 6c 65 20 70 61 74 68 5d 0a 09 09 6c [$file path]...l
3420: 6f 67 20 77 72 69 74 65 20 32 20 63 6f 6c 6c 72 og write 2 collr
3430: 65 76 20 22 50 61 72 73 69 6e 67 20 24 70 61 74 ev "Parsing $pat
3440: 68 22 0a 09 09 69 66 20 7b 5b 63 61 74 63 68 20 h"...if {[catch
3450: 7b 0a 09 09 20 20 20 20 70 61 72 73 65 72 20 70 {... parser p
3460: 72 6f 63 65 73 73 20 5b 3a 3a 66 69 6c 65 20 6a rocess [::file j
3470: 6f 69 6e 20 24 62 61 73 65 20 24 70 61 74 68 5d oin $base $path]
3480: 20 24 66 69 6c 65 0a 09 09 7d 20 6d 73 67 5d 7d $file...} msg]}
3490: 20 7b 0a 09 09 20 20 20 20 67 6c 6f 62 61 6c 20 {... global
34a0: 65 72 72 6f 72 43 6f 64 65 0a 09 09 20 20 20 20 errorCode...
34b0: 69 66 20 7b 24 65 72 72 6f 72 43 6f 64 65 20 65 if {$errorCode e
34c0: 71 20 22 76 63 3a 3a 72 63 73 3a 3a 70 61 72 73 q "vc::rcs::pars
34d0: 65 72 22 7d 20 7b 0a 09 09 09 74 72 6f 75 62 6c er"} {....troubl
34e0: 65 20 66 61 74 61 6c 20 22 24 70 61 74 68 20 69 e fatal "$path i
34f0: 73 20 6e 6f 74 20 61 20 76 61 6c 69 64 20 52 43 s not a valid RC
3500: 53 20 61 72 63 68 69 76 65 20 28 24 6d 73 67 29 S archive ($msg)
3510: 22 0a 09 09 20 20 20 20 7d 20 65 6c 73 65 20 7b "... } else {
3520: 0a 09 09 09 67 6c 6f 62 61 6c 20 65 72 72 6f 72 ....global error
3530: 49 6e 66 6f 0a 09 09 09 74 72 6f 75 62 6c 65 20 Info....trouble
3540: 69 6e 74 65 72 6e 61 6c 20 24 65 72 72 6f 72 49 internal $errorI
3550: 6e 66 6f 0a 09 09 20 20 20 20 7d 0a 09 09 7d 20 nfo... }...}
3560: 65 6c 73 65 20 7b 0a 09 09 20 20 20 20 23 20 57 else {... # W
3570: 65 20 70 65 72 73 69 73 74 20 74 68 65 20 63 6f e persist the co
3580: 72 65 20 6f 66 20 74 68 65 20 64 61 74 61 20 63 re of the data c
3590: 6f 6c 6c 65 63 74 65 64 20 61 62 6f 75 74 0a 09 ollected about..
35a0: 09 20 20 20 20 23 20 65 61 63 68 20 66 69 6c 65 . # each file
35b0: 20 69 6d 6d 65 64 69 61 74 65 6c 79 20 61 66 74 immediately aft
35c0: 65 72 20 69 74 20 68 61 73 20 62 65 65 6e 20 70 er it has been p
35d0: 61 72 73 65 64 0a 09 09 20 20 20 20 23 20 61 6e arsed... # an
35e0: 64 20 77 72 61 6e 67 6c 65 64 20 69 6e 74 6f 20 d wrangled into
35f0: 73 68 61 70 65 2c 20 61 6e 64 20 74 68 65 6e 20 shape, and then
3600: 64 72 6f 70 20 69 74 20 66 72 6f 6d 0a 09 09 20 drop it from...
3610: 20 20 20 23 20 6d 65 6d 6f 72 79 2e 20 54 68 69 # memory. Thi
3620: 73 20 69 73 20 64 6f 6e 65 20 74 6f 20 6b 65 65 s is done to kee
3630: 70 20 74 68 65 20 61 6d 6f 75 6e 74 20 6f 66 0a p the amount of.
3640: 09 09 20 20 20 20 23 20 72 65 71 75 69 72 65 64 .. # required
3650: 20 6d 65 6d 6f 72 79 20 77 69 74 68 69 6e 20 73 memory within s
3660: 65 6e 73 69 62 6c 65 20 6c 69 6d 69 74 73 2e 20 ensible limits.
3670: 57 69 74 68 6f 75 74 0a 09 09 20 20 20 20 23 20 Without... #
3680: 64 6f 69 6e 67 20 69 74 20 74 68 69 73 20 77 61 doing it this wa
3690: 79 20 77 65 20 77 6f 75 6c 64 20 65 61 73 69 6c y we would easil
36a0: 79 20 67 6f 62 62 6c 65 20 75 70 20 31 47 0a 09 y gobble up 1G..
36b0: 09 20 20 20 20 23 20 6f 66 20 52 41 4d 20 6f 72 . # of RAM or
36c0: 20 6d 6f 72 65 20 77 69 74 68 20 61 6c 6c 20 74 more with all t
36d0: 68 65 20 6f 62 6a 65 63 74 73 20 28 72 65 76 69 he objects (revi
36e0: 73 69 6f 6e 73 0a 09 09 20 20 20 20 23 20 61 6e sions... # an
36f0: 64 20 66 69 6c 65 2d 6c 65 76 65 6c 20 73 79 6d d file-level sym
3700: 62 6f 6c 73 29 2e 0a 0a 09 09 20 20 20 20 24 66 bols)..... $f
3710: 69 6c 65 20 70 65 72 73 69 73 74 0a 09 09 7d 0a ile persist...}.
3720: 0a 09 09 24 66 69 6c 65 20 64 72 6f 70 0a 09 20 ...$file drop..
3730: 20 20 20 7d 0a 0a 09 20 20 20 20 24 70 72 6f 6a }... $proj
3740: 65 63 74 20 70 75 72 67 65 67 68 6f 73 74 73 79 ect purgeghostsy
3750: 6d 62 6f 6c 73 0a 09 7d 0a 0a 09 72 65 70 6f 73 mbols..}...repos
3760: 69 74 6f 72 79 20 70 65 72 73 69 73 74 72 65 76 itory persistrev
3770: 0a 09 72 65 70 6f 73 69 74 6f 72 79 20 70 72 69 ..repository pri
3780: 6e 74 72 65 76 73 74 61 74 69 73 74 69 63 73 0a ntrevstatistics.
3790: 09 69 6e 74 65 67 72 69 74 79 20 20 73 74 72 69 .integrity stri
37a0: 63 74 0a 0a 09 6c 6f 67 20 77 72 69 74 65 20 31 ct...log write 1
37b0: 20 63 6f 6c 6c 72 65 76 20 22 53 63 61 6e 20 63 collrev "Scan c
37c0: 6f 6d 70 6c 65 74 65 64 22 0a 09 72 65 74 75 72 ompleted"..retur
37d0: 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 74 79 70 n. }.. typ
37e0: 65 6d 65 74 68 6f 64 20 64 69 73 63 61 72 64 20 emethod discard
37f0: 7b 7d 20 7b 0a 09 23 20 50 61 73 73 20 6d 61 6e {} {..# Pass man
3800: 61 67 65 72 20 69 6e 74 65 72 66 61 63 65 2e 20 ager interface.
3810: 45 78 65 63 75 74 65 64 20 66 6f 72 20 61 6c 6c Executed for all
3820: 20 70 61 73 73 65 73 20 61 66 74 65 72 20 74 68 passes after th
3830: 65 0a 09 23 20 72 75 6e 20 70 61 73 73 65 73 2c e..# run passes,
3840: 20 74 6f 20 72 65 6d 6f 76 65 20 61 6c 6c 20 64 to remove all d
3850: 61 74 61 20 6f 66 20 74 68 69 73 20 70 61 73 73 ata of this pass
3860: 20 66 72 6f 6d 20 74 68 65 20 73 74 61 74 65 2c from the state,
3870: 0a 09 23 20 61 73 20 62 65 69 6e 67 20 6f 75 74 ..# as being out
3880: 20 6f 66 20 64 61 74 65 2e 0a 0a 09 73 74 61 74 of date....stat
3890: 65 20 64 69 73 63 61 72 64 20 72 65 76 69 73 69 e discard revisi
38a0: 6f 6e 0a 09 73 74 61 74 65 20 64 69 73 63 61 72 on..state discar
38b0: 64 20 74 61 67 0a 09 73 74 61 74 65 20 64 69 73 d tag..state dis
38c0: 63 61 72 64 20 62 72 61 6e 63 68 0a 09 73 74 61 card branch..sta
38d0: 74 65 20 64 69 73 63 61 72 64 20 73 79 6d 62 6f te discard symbo
38e0: 6c 0a 09 73 74 61 74 65 20 64 69 73 63 61 72 64 l..state discard
38f0: 20 62 6c 6f 63 6b 65 72 0a 09 73 74 61 74 65 20 blocker..state
3900: 64 69 73 63 61 72 64 20 70 61 72 65 6e 74 0a 09 discard parent..
3910: 73 74 61 74 65 20 64 69 73 63 61 72 64 20 73 79 state discard sy
3920: 6d 74 79 70 65 0a 09 73 74 61 74 65 20 64 69 73 mtype..state dis
3930: 63 61 72 64 20 6d 65 74 61 0a 09 73 74 61 74 65 card meta..state
3940: 20 64 69 73 63 61 72 64 20 61 75 74 68 6f 72 0a discard author.
3950: 09 73 74 61 74 65 20 64 69 73 63 61 72 64 20 63 .state discard c
3960: 6d 65 73 73 61 67 65 0a 09 72 65 74 75 72 6e 0a message..return.
3970: 20 20 20 20 7d 0a 0a 20 20 20 20 23 20 54 4f 44 }.. # TOD
3980: 4f 3a 20 4d 6f 76 65 20 74 68 69 73 20 63 6f 64 O: Move this cod
3990: 65 20 74 6f 20 74 68 65 20 69 6e 74 65 67 72 69 e to the integri
39a0: 74 79 20 6d 6f 64 75 6c 65 0a 20 20 20 20 70 72 ty module. pr
39b0: 6f 63 20 50 61 72 61 6e 6f 69 61 20 7b 7d 20 7b oc Paranoia {} {
39c0: 0a 09 23 20 54 68 69 73 20 63 6f 64 65 20 70 65 ..# This code pe
39d0: 72 66 6f 72 6d 73 20 61 20 6e 75 6d 62 65 72 20 rforms a number
39e0: 6f 66 20 70 61 72 61 6e 6f 69 64 20 63 68 65 63 of paranoid chec
39f0: 6b 73 20 6f 66 20 74 68 65 0a 09 23 20 64 61 74 ks of the..# dat
3a00: 61 62 61 73 65 2c 20 73 65 61 72 63 68 69 6e 67 abase, searching
3a10: 20 66 6f 72 20 69 6e 63 6f 6e 73 69 73 74 65 6e for inconsisten
3a20: 74 20 63 72 6f 73 73 2d 72 65 66 65 72 65 6e 63 t cross-referenc
3a30: 65 73 2e 0a 09 6c 6f 67 20 77 72 69 74 65 20 34 es...log write 4
3a40: 20 63 6f 6c 6c 72 65 76 20 7b 43 68 65 63 6b 20 collrev {Check
3a50: 64 61 74 61 62 61 73 65 20 63 6f 6e 73 69 73 74 database consist
3a60: 65 6e 63 79 7d 0a 0a 09 73 65 74 20 6e 20 30 20 ency}...set n 0
3a70: 3b 20 23 20 43 6f 75 6e 74 65 72 20 66 6f 72 20 ; # Counter for
3a80: 74 68 65 20 63 68 65 63 6b 73 20 28 77 65 20 70 the checks (we p
3a90: 72 69 6e 74 20 61 6e 20 69 64 20 62 65 66 6f 72 rint an id befor
3aa0: 65 20 74 68 65 0a 09 09 20 20 23 20 6d 61 69 6e e the... # main
3ab0: 20 6c 61 62 65 6c 29 2e 0a 0a 09 23 20 46 69 6e label)....# Fin
3ac0: 64 20 61 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 d all revisions
3ad0: 77 68 69 63 68 20 64 69 73 61 67 72 65 65 20 77 which disagree w
3ae0: 69 74 68 20 74 68 65 69 72 20 6c 69 6e 65 20 6f ith their line o
3af0: 66 0a 09 23 20 64 65 76 65 6c 6f 70 6d 65 6e 74 f..# development
3b00: 20 61 62 6f 75 74 20 74 68 65 20 70 72 6f 6a 65 about the proje
3b10: 63 74 20 74 68 65 79 20 61 72 65 20 6f 77 6e 65 ct they are owne
3b20: 64 20 62 79 2e 0a 09 43 68 65 63 6b 20 5c 0a 09 d by...Check \..
3b30: 20 20 20 20 7b 52 65 76 69 73 69 6f 6e 73 20 61 {Revisions a
3b40: 6e 64 20 74 68 65 69 72 20 4c 4f 44 73 20 68 61 nd their LODs ha
3b50: 76 65 20 74 6f 20 62 65 20 69 6e 20 74 68 65 20 ve to be in the
3b60: 73 61 6d 65 20 70 72 6f 6a 65 63 74 7d 20 5c 0a same project} \.
3b70: 09 20 20 20 20 7b 64 69 73 61 67 72 65 65 73 20 . {disagrees
3b80: 77 69 74 68 20 69 74 73 20 4c 4f 44 20 61 62 6f with its LOD abo
3b90: 75 74 20 6f 77 6e 69 6e 67 20 70 72 6f 6a 65 63 ut owning projec
3ba0: 74 7d 20 7b 0a 09 09 53 45 4c 45 43 54 20 46 2e t} {...SELECT F.
3bb0: 6e 61 6d 65 2c 20 52 2e 72 65 76 0a 09 09 46 52 name, R.rev...FR
3bc0: 4f 4d 20 20 20 72 65 76 69 73 69 6f 6e 20 52 2c OM revision R,
3bd0: 20 66 69 6c 65 20 46 2c 20 73 79 6d 62 6f 6c 20 file F, symbol
3be0: 53 0a 09 09 57 48 45 52 45 20 20 52 2e 66 69 64 S...WHERE R.fid
3bf0: 20 3d 20 46 2e 66 69 64 20 20 20 2d 2d 20 47 65 = F.fid -- Ge
3c00: 74 20 66 69 6c 65 20 6f 66 20 72 65 76 69 73 69 t file of revisi
3c10: 6f 6e 0a 09 09 41 4e 44 20 20 20 20 52 2e 6c 6f on...AND R.lo
3c20: 64 20 3d 20 53 2e 73 69 64 20 20 20 2d 2d 20 47 d = S.sid -- G
3c30: 65 74 20 73 79 6d 62 6f 6c 20 66 6f 72 20 72 65 et symbol for re
3c40: 76 69 73 69 6f 6e 27 73 20 4c 4f 44 0a 09 09 41 vision's LOD...A
3c50: 4e 44 20 20 20 20 46 2e 70 69 64 20 21 3d 20 53 ND F.pid != S
3c60: 2e 70 69 64 20 20 2d 2d 20 62 75 74 20 73 79 6d .pid -- but sym
3c70: 62 6f 6c 20 69 73 20 66 6f 72 20 61 20 64 69 66 bol is for a dif
3c80: 66 65 72 65 6e 74 20 70 72 6f 6a 65 63 74 0a 09 ferent project..
3c90: 09 3b 0a 09 20 20 20 20 7d 0a 09 23 20 46 69 6e .;.. }..# Fin
3ca0: 64 20 61 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 d all revisions
3cb0: 77 68 69 63 68 20 64 69 73 67 72 65 65 20 77 69 which disgree wi
3cc0: 74 68 20 74 68 65 69 72 20 6d 65 74 61 20 64 61 th their meta da
3cd0: 74 61 20 61 62 6f 75 74 0a 09 23 20 74 68 65 20 ta about..# the
3ce0: 70 72 6f 6a 65 63 74 20 74 68 65 79 20 61 72 65 project they are
3cf0: 20 6f 77 6e 65 64 20 62 79 2e 0a 09 43 68 65 63 owned by...Chec
3d00: 6b 20 5c 0a 09 20 20 20 20 7b 52 65 76 69 73 69 k \.. {Revisi
3d10: 6f 6e 73 20 61 6e 64 20 74 68 65 69 72 20 6d 65 ons and their me
3d20: 74 61 20 64 61 74 61 20 68 61 76 65 20 74 6f 20 ta data have to
3d30: 62 65 20 69 6e 20 74 68 65 20 73 61 6d 65 20 70 be in the same p
3d40: 72 6f 6a 65 63 74 7d 20 5c 0a 09 20 20 20 20 7b roject} \.. {
3d50: 64 69 73 61 67 72 65 65 73 20 77 69 74 68 20 69 disagrees with i
3d60: 74 73 20 6d 65 74 61 20 64 61 74 61 20 61 62 6f ts meta data abo
3d70: 75 74 20 6f 77 6e 69 6e 67 20 70 72 6f 6a 65 63 ut owning projec
3d80: 74 7d 20 7b 0a 09 09 53 45 4c 45 43 54 20 46 2e t} {...SELECT F.
3d90: 6e 61 6d 65 2c 20 52 2e 72 65 76 0a 09 09 46 52 name, R.rev...FR
3da0: 4f 4d 20 20 20 72 65 76 69 73 69 6f 6e 20 52 2c OM revision R,
3db0: 20 66 69 6c 65 20 46 2c 20 6d 65 74 61 20 4d 0a file F, meta M.
3dc0: 09 09 57 48 45 52 45 20 20 52 2e 66 69 64 20 3d ..WHERE R.fid =
3dd0: 20 46 2e 66 69 64 20 20 20 2d 2d 20 47 65 74 20 F.fid -- Get
3de0: 66 69 6c 65 20 6f 66 20 72 65 76 69 73 69 6f 6e file of revision
3df0: 0a 09 09 41 4e 44 20 20 20 20 52 2e 6d 69 64 20 ...AND R.mid
3e00: 3d 20 4d 2e 6d 69 64 20 20 20 2d 2d 20 47 65 74 = M.mid -- Get
3e10: 20 6d 65 74 61 20 64 61 74 61 20 6f 66 20 72 65 meta data of re
3e20: 76 69 73 69 6f 6e 0a 09 09 41 4e 44 20 20 20 20 vision...AND
3e30: 46 2e 70 69 64 20 21 3d 20 4d 2e 70 69 64 20 20 F.pid != M.pid
3e40: 2d 2d 20 62 75 74 20 69 73 20 66 6f 72 20 61 20 -- but is for a
3e50: 64 69 66 66 65 72 65 6e 74 20 70 72 6f 6a 65 63 different projec
3e60: 74 0a 09 09 3b 0a 09 20 20 20 20 7d 0a 09 23 20 t...;.. }..#
3e70: 46 69 6e 64 20 61 6c 6c 20 72 65 76 69 73 69 6f Find all revisio
3e80: 6e 73 20 77 68 69 63 68 20 64 69 73 67 72 65 65 ns which disgree
3e90: 20 77 69 74 68 20 74 68 65 69 72 20 6d 65 74 61 with their meta
3ea0: 20 64 61 74 61 20 61 62 6f 75 74 0a 09 23 20 74 data about..# t
3eb0: 68 65 20 62 72 61 6e 63 68 2f 6c 69 6e 65 20 6f he branch/line o
3ec0: 66 20 64 65 76 65 6c 6f 70 6d 65 6e 74 20 74 68 f development th
3ed0: 65 79 20 62 65 6c 6f 6e 67 20 74 6f 2e 0a 09 43 ey belong to...C
3ee0: 68 65 63 6b 20 5c 0a 09 20 20 20 20 7b 52 65 76 heck \.. {Rev
3ef0: 69 73 69 6f 6e 73 20 61 6e 64 20 74 68 65 69 72 isions and their
3f00: 20 6d 65 74 61 20 64 61 74 61 20 68 61 76 65 20 meta data have
3f10: 74 6f 20 62 65 20 69 6e 20 74 68 65 20 73 61 6d to be in the sam
3f20: 65 20 4c 4f 44 7d 20 5c 0a 09 20 20 20 20 7b 64 e LOD} \.. {d
3f30: 69 73 61 67 72 65 65 73 20 77 69 74 68 20 69 74 isagrees with it
3f40: 73 20 6d 65 74 61 20 64 61 74 61 20 61 62 6f 75 s meta data abou
3f50: 74 20 6f 77 6e 69 6e 67 20 4c 4f 44 7d 20 7b 0a t owning LOD} {.
3f60: 09 09 53 45 4c 45 43 54 20 46 2e 6e 61 6d 65 2c ..SELECT F.name,
3f70: 20 52 2e 72 65 76 0a 09 09 46 52 4f 4d 20 20 20 R.rev...FROM
3f80: 72 65 76 69 73 69 6f 6e 20 52 2c 20 6d 65 74 61 revision R, meta
3f90: 20 4d 2c 20 66 69 6c 65 20 46 0a 09 09 57 48 45 M, file F...WHE
3fa0: 52 45 20 20 52 2e 6d 69 64 20 3d 20 4d 2e 6d 69 RE R.mid = M.mi
3fb0: 64 20 20 20 2d 2d 20 47 65 74 20 6d 65 74 61 20 d -- Get meta
3fc0: 64 61 74 61 20 6f 66 20 72 65 76 69 73 69 6f 6e data of revision
3fd0: 0a 09 09 41 4e 44 20 20 20 20 52 2e 6c 6f 64 20 ...AND R.lod
3fe0: 21 3d 20 4d 2e 62 69 64 20 20 2d 2d 20 62 75 74 != M.bid -- but
3ff0: 20 69 73 20 66 6f 72 20 61 20 64 69 66 66 65 72 is for a differ
4000: 65 6e 74 20 4c 4f 44 0a 09 09 41 4e 44 20 20 20 ent LOD...AND
4010: 20 52 2e 66 69 64 20 3d 20 46 2e 66 69 64 20 20 R.fid = F.fid
4020: 20 2d 2d 20 47 65 74 20 66 69 6c 65 20 6f 66 20 -- Get file of
4030: 72 65 76 69 73 69 6f 6e 0a 09 09 3b 0a 09 20 20 revision...;..
4040: 20 20 7d 0a 09 23 20 46 69 6e 64 20 61 6c 6c 20 }..# Find all
4050: 72 65 76 69 73 69 6f 6e 73 20 77 69 74 68 20 61 revisions with a
4060: 20 70 72 69 6d 61 72 79 20 63 68 69 6c 64 20 77 primary child w
4070: 68 69 63 68 20 64 69 73 61 67 72 65 65 73 0a 09 hich disagrees..
4080: 23 20 61 62 6f 75 74 20 74 68 65 20 66 69 6c 65 # about the file
4090: 20 74 68 65 79 20 62 65 6c 6f 6e 67 20 74 6f 2e they belong to.
40a0: 0a 09 43 68 65 63 6b 20 5c 0a 09 20 20 20 20 7b ..Check \.. {
40b0: 52 65 76 69 73 69 6f 6e 73 20 61 6e 64 20 74 68 Revisions and th
40c0: 65 69 72 20 70 72 69 6d 61 72 79 20 63 68 69 6c eir primary chil
40d0: 64 72 65 6e 20 68 61 76 65 20 74 6f 20 62 65 20 dren have to be
40e0: 69 6e 20 74 68 65 20 73 61 6d 65 20 66 69 6c 65 in the same file
40f0: 7d 20 5c 0a 09 20 20 20 20 7b 64 69 73 61 67 72 } \.. {disagr
4100: 65 65 73 20 77 69 74 68 20 69 74 73 20 70 72 69 ees with its pri
4110: 6d 61 72 79 20 63 68 69 6c 64 20 61 62 6f 75 74 mary child about
4120: 20 74 68 65 20 6f 77 6e 69 6e 67 20 66 69 6c 65 the owning file
4130: 7d 20 7b 0a 09 09 53 45 4c 45 43 54 20 46 2e 6e } {...SELECT F.n
4140: 61 6d 65 2c 20 52 2e 72 65 76 0a 09 09 46 52 4f ame, R.rev...FRO
4150: 4d 20 20 20 72 65 76 69 73 69 6f 6e 20 52 2c 20 M revision R,
4160: 72 65 76 69 73 69 6f 6e 20 43 2c 20 66 69 6c 65 revision C, file
4170: 20 46 0a 09 09 57 48 45 52 45 20 20 52 2e 66 69 F...WHERE R.fi
4180: 64 20 3d 20 46 2e 66 69 64 20 20 20 20 20 20 20 d = F.fid
4190: 20 2d 2d 20 47 65 74 20 66 69 6c 65 20 6f 66 20 -- Get file of
41a0: 72 65 76 69 73 69 6f 6e 0a 09 09 41 4e 44 20 20 revision...AND
41b0: 20 20 52 2e 63 68 69 6c 64 20 49 53 20 4e 4f 54 R.child IS NOT
41c0: 20 4e 55 4c 4c 20 20 2d 2d 20 52 65 73 74 72 69 NULL -- Restri
41d0: 63 74 20 74 6f 20 6e 6f 6e 2d 6c 65 61 66 20 72 ct to non-leaf r
41e0: 65 76 69 73 69 6f 6e 73 0a 09 09 41 4e 44 20 20 evisions...AND
41f0: 20 20 52 2e 63 68 69 6c 64 20 3d 20 43 2e 72 69 R.child = C.ri
4200: 64 20 20 20 20 20 20 2d 2d 20 47 65 74 20 63 68 d -- Get ch
4210: 69 6c 64 20 28 68 61 73 20 74 6f 20 65 78 69 73 ild (has to exis
4220: 74 29 0a 09 09 41 4e 44 20 20 20 20 43 2e 66 69 t)...AND C.fi
4230: 64 20 21 3d 20 52 2e 66 69 64 20 20 20 20 20 20 d != R.fid
4240: 20 2d 2d 20 57 68 69 63 20 77 72 6f 6e 67 6c 79 -- Whic wrongly
4250: 20 69 73 20 69 6e 20 61 20 64 69 66 66 65 72 65 is in a differe
4260: 6e 74 20 66 69 6c 65 0a 09 09 3b 0a 09 20 20 20 nt file...;..
4270: 20 7d 0a 0a 09 23 20 46 69 6e 64 20 61 6c 6c 20 }...# Find all
4280: 72 65 76 69 73 69 6f 6e 73 20 77 69 74 68 20 61 revisions with a
4290: 20 62 72 61 6e 63 68 20 70 61 72 65 6e 74 20 73 branch parent s
42a0: 79 6d 62 6f 6c 20 77 68 6f 73 65 20 70 61 72 65 ymbol whose pare
42b0: 6e 74 0a 09 23 20 64 69 73 61 67 72 65 65 73 20 nt..# disagrees
42c0: 61 62 6f 75 74 20 74 68 65 20 66 69 6c 65 20 74 about the file t
42d0: 68 65 79 20 62 65 6c 6f 6e 67 20 74 6f 2e 0a 09 hey belong to...
42e0: 43 68 65 63 6b 20 5c 0a 09 20 20 20 20 7b 52 65 Check \.. {Re
42f0: 76 69 73 69 6f 6e 73 20 61 6e 64 20 74 68 65 69 visions and thei
4300: 72 20 62 72 61 6e 63 68 20 63 68 69 6c 64 72 65 r branch childre
4310: 6e 20 68 61 76 65 20 74 6f 20 62 65 20 69 6e 20 n have to be in
4320: 74 68 65 20 73 61 6d 65 20 66 69 6c 65 7d 20 5c the same file} \
4330: 0a 09 20 20 20 20 7b 61 74 20 74 68 65 20 62 65 .. {at the be
4340: 67 69 6e 6e 69 6e 67 20 6f 66 20 69 74 73 20 62 ginning of its b
4350: 72 61 6e 63 68 20 61 6e 64 20 69 74 73 20 70 61 ranch and its pa
4360: 72 65 6e 74 20 64 69 73 61 67 72 65 65 20 61 62 rent disagree ab
4370: 6f 75 74 20 74 68 65 20 6f 77 6e 69 6e 67 20 66 out the owning f
4380: 69 6c 65 7d 20 7b 0a 09 09 53 45 4c 45 43 54 20 ile} {...SELECT
4390: 46 2e 6e 61 6d 65 2c 20 52 2e 72 65 76 0a 09 09 F.name, R.rev...
43a0: 46 52 4f 4d 20 20 20 72 65 76 69 73 69 6f 6e 20 FROM revision
43b0: 52 2c 20 72 65 76 69 73 69 6f 6e 20 50 2c 20 66 R, revision P, f
43c0: 69 6c 65 20 46 0a 09 09 57 48 45 52 45 20 20 52 ile F...WHERE R
43d0: 2e 66 69 64 20 3d 20 46 2e 66 69 64 20 20 20 20 .fid = F.fid
43e0: 20 20 20 20 20 20 2d 2d 20 47 65 74 20 66 69 6c -- Get fil
43f0: 65 20 6f 66 20 72 65 76 69 73 69 6f 6e 0a 09 09 e of revision...
4400: 41 4e 44 20 20 20 20 52 2e 62 70 61 72 65 6e 74 AND R.bparent
4410: 20 49 53 20 4e 4f 54 20 4e 55 4c 4c 20 20 2d 2d IS NOT NULL --
4420: 20 52 65 73 74 72 69 63 74 20 74 6f 20 66 69 72 Restrict to fir
4430: 73 74 20 6f 6e 20 62 72 61 6e 63 68 0a 09 09 41 st on branch...A
4440: 4e 44 20 20 20 20 52 2e 70 61 72 65 6e 74 20 3d ND R.parent =
4450: 20 50 2e 72 69 64 20 20 20 20 20 20 20 2d 2d 20 P.rid --
4460: 47 65 74 20 6f 75 74 2d 6f 66 2d 62 72 61 6e 63 Get out-of-branc
4470: 68 20 70 61 72 65 6e 74 0a 09 09 41 4e 44 20 20 h parent...AND
4480: 20 20 52 2e 66 69 64 20 21 3d 20 50 2e 66 69 64 R.fid != P.fid
4490: 20 20 20 20 20 20 20 20 20 2d 2d 20 57 68 69 63 -- Whic
44a0: 68 20 77 72 6f 6e 67 6c 79 20 69 73 20 69 6e 20 h wrongly is in
44b0: 61 20 64 69 66 66 65 72 65 6e 74 20 66 69 6c 65 a different file
44c0: 0a 09 09 3b 0a 09 20 20 20 20 7d 0a 09 23 20 46 ...;.. }..# F
44d0: 69 6e 64 20 61 6c 6c 20 72 65 76 69 73 69 6f 6e ind all revision
44e0: 73 20 77 69 74 68 20 61 20 6e 6f 6e 2d 4e 54 44 s with a non-NTD
44f0: 42 20 63 68 69 6c 64 20 77 68 69 63 68 20 64 69 B child which di
4500: 73 61 67 72 65 65 73 0a 09 23 20 61 62 6f 75 74 sagrees..# about
4510: 20 74 68 65 20 66 69 6c 65 20 74 68 65 79 20 62 the file they b
4520: 65 6c 6f 6e 67 20 74 6f 2e 0a 09 43 68 65 63 6b elong to...Check
4530: 20 5c 0a 09 20 20 20 20 7b 52 65 76 69 73 69 6f \.. {Revisio
4540: 6e 73 20 61 6e 64 20 74 68 65 69 72 20 6e 6f 6e ns and their non
4550: 2d 4e 54 44 42 20 63 68 69 6c 64 72 65 6e 20 68 -NTDB children h
4560: 61 76 65 20 74 6f 20 62 65 20 69 6e 20 74 68 65 ave to be in the
4570: 20 73 61 6d 65 20 66 69 6c 65 7d 20 5c 0a 09 20 same file} \..
4580: 20 20 20 7b 64 69 73 61 67 72 65 65 73 20 77 69 {disagrees wi
4590: 74 68 20 69 74 73 20 6e 6f 6e 2d 4e 54 44 42 20 th its non-NTDB
45a0: 63 68 69 6c 64 20 61 62 6f 75 74 20 74 68 65 20 child about the
45b0: 6f 77 6e 69 6e 67 20 66 69 6c 65 7d 20 7b 0a 09 owning file} {..
45c0: 09 53 45 4c 45 43 54 20 46 2e 6e 61 6d 65 2c 20 .SELECT F.name,
45d0: 52 2e 72 65 76 0a 09 09 46 52 4f 4d 20 20 20 72 R.rev...FROM r
45e0: 65 76 69 73 69 6f 6e 20 52 2c 20 72 65 76 69 73 evision R, revis
45f0: 69 6f 6e 20 43 2c 20 66 69 6c 65 20 46 0a 09 09 ion C, file F...
4600: 57 48 45 52 45 20 20 52 2e 66 69 64 20 3d 20 46 WHERE R.fid = F
4610: 2e 66 69 64 20 20 20 20 20 20 20 20 20 20 2d 2d .fid --
4620: 20 47 65 74 20 66 69 6c 65 20 6f 66 20 72 65 76 Get file of rev
4630: 69 73 69 6f 6e 0a 09 09 41 4e 44 20 20 20 20 52 ision...AND R
4640: 2e 64 62 63 68 69 6c 64 20 49 53 20 4e 4f 54 20 .dbchild IS NOT
4650: 4e 55 4c 4c 20 20 2d 2d 20 52 65 73 74 72 69 63 NULL -- Restric
4660: 74 20 74 6f 20 73 65 6d 69 2d 6c 61 73 74 20 4e t to semi-last N
4670: 54 44 42 20 72 65 76 69 73 69 6f 6e 0a 09 09 41 TDB revision...A
4680: 4e 44 20 20 20 20 52 2e 64 62 63 68 69 6c 64 20 ND R.dbchild
4690: 3d 20 43 2e 72 69 64 20 20 20 20 20 20 2d 2d 20 = C.rid --
46a0: 47 6f 74 20 74 6f 20 61 73 73 6f 63 69 61 74 65 Got to associate
46b0: 64 20 74 72 75 6e 6b 20 72 65 76 69 73 69 6f 6e d trunk revision
46c0: 0a 09 09 41 4e 44 20 20 20 20 43 2e 66 69 64 20 ...AND C.fid
46d0: 21 3d 20 52 2e 66 69 64 20 20 20 20 20 20 20 20 != R.fid
46e0: 20 2d 2d 20 57 68 69 63 68 20 77 72 6f 6e 67 6c -- Which wrongl
46f0: 79 20 69 73 20 69 6e 20 61 20 64 69 66 66 65 72 y is in a differ
4700: 65 6e 74 20 66 69 6c 65 0a 09 09 3b 0a 09 20 20 ent file...;..
4710: 20 20 7d 0a 09 23 20 46 69 6e 64 20 61 6c 6c 20 }..# Find all
4720: 72 65 76 69 73 69 6f 6e 73 20 77 68 69 63 68 20 revisions which
4730: 68 61 76 65 20 61 20 70 72 69 6d 61 72 79 20 63 have a primary c
4740: 68 69 6c 64 2c 20 62 75 74 20 74 68 65 20 63 68 hild, but the ch
4750: 69 6c 64 0a 09 23 20 64 6f 65 73 20 6e 6f 74 20 ild..# does not
4760: 68 61 76 65 20 74 68 65 6d 20 61 73 20 70 61 72 have them as par
4770: 65 6e 74 2e 0a 09 43 68 65 63 6b 20 5c 0a 09 20 ent...Check \..
4780: 20 20 20 7b 52 65 76 69 73 69 6f 6e 73 20 68 61 {Revisions ha
4790: 76 65 20 74 6f 20 62 65 20 70 61 72 65 6e 74 73 ve to be parents
47a0: 20 6f 66 20 74 68 65 69 72 20 70 72 69 6d 61 72 of their primar
47b0: 79 20 63 68 69 6c 64 72 65 6e 7d 20 5c 0a 09 20 y children} \..
47c0: 20 20 20 7b 69 73 20 6e 6f 74 20 74 68 65 20 70 {is not the p
47d0: 61 72 65 6e 74 20 6f 66 20 69 74 73 20 70 72 69 arent of its pri
47e0: 6d 61 72 79 20 63 68 69 6c 64 7d 20 7b 0a 09 09 mary child} {...
47f0: 53 45 4c 45 43 54 20 46 2e 6e 61 6d 65 2c 20 52 SELECT F.name, R
4800: 2e 72 65 76 0a 09 09 46 52 4f 4d 20 20 20 72 65 .rev...FROM re
4810: 76 69 73 69 6f 6e 20 52 2c 20 72 65 76 69 73 69 vision R, revisi
4820: 6f 6e 20 43 2c 20 66 69 6c 65 20 46 0a 09 09 57 on C, file F...W
4830: 48 45 52 45 20 20 52 2e 66 69 64 20 3d 20 46 2e HERE R.fid = F.
4840: 66 69 64 20 20 20 20 20 20 20 20 2d 2d 20 47 65 fid -- Ge
4850: 74 20 66 69 6c 65 20 6f 66 20 72 65 76 69 73 69 t file of revisi
4860: 6f 6e 0a 09 09 41 4e 44 20 20 20 20 52 2e 63 68 on...AND R.ch
4870: 69 6c 64 20 49 53 20 4e 4f 54 20 4e 55 4c 4c 20 ild IS NOT NULL
4880: 20 2d 2d 20 52 65 73 74 72 69 63 74 20 74 6f 20 -- Restrict to
4890: 6e 6f 6e 2d 6c 65 61 76 65 73 0a 09 09 41 4e 44 non-leaves...AND
48a0: 20 20 20 20 52 2e 63 68 69 6c 64 20 3d 20 43 2e R.child = C.
48b0: 72 69 64 20 20 20 20 20 20 2d 2d 20 47 65 74 20 rid -- Get
48c0: 74 68 65 20 63 68 69 6c 64 20 28 68 61 73 20 74 the child (has t
48d0: 6f 20 65 78 69 73 74 29 0a 09 09 41 4e 44 20 20 o exist)...AND
48e0: 20 20 43 2e 70 61 72 65 6e 74 20 21 3d 20 52 2e C.parent != R.
48f0: 72 69 64 20 20 20 20 2d 2d 20 57 68 69 63 68 20 rid -- Which
4900: 64 6f 65 73 20 6e 6f 74 20 68 61 76 65 20 75 73 does not have us
4910: 20 61 73 20 69 74 73 20 70 61 72 65 6e 74 2e 0a as its parent..
4920: 09 09 3b 0a 09 20 20 20 20 7d 0a 09 23 20 46 69 ..;.. }..# Fi
4930: 6e 64 20 61 6c 6c 20 72 65 76 69 73 69 6f 6e 73 nd all revisions
4940: 20 77 68 69 63 68 20 68 61 76 65 20 61 20 70 72 which have a pr
4950: 69 6d 72 61 72 79 20 63 68 69 6c 64 2c 20 62 75 imrary child, bu
4960: 74 20 74 68 65 0a 09 23 20 63 68 69 6c 64 20 68 t the..# child h
4970: 61 73 20 61 20 62 72 61 6e 63 68 20 70 61 72 65 as a branch pare
4980: 6e 74 20 73 79 6d 62 6f 6c 20 6d 61 6b 69 6e 67 nt symbol making
4990: 20 74 68 65 6d 20 62 72 61 63 68 20 73 74 61 72 them brach star
49a0: 74 65 72 73 2e 0a 09 43 68 65 63 6b 20 5c 0a 09 ters...Check \..
49b0: 20 20 20 20 7b 50 72 69 6d 61 72 79 20 63 68 69 {Primary chi
49c0: 6c 64 72 65 6e 20 6f 66 20 72 65 76 69 73 69 6f ldren of revisio
49d0: 6e 73 20 6d 75 73 74 20 6e 6f 74 20 73 74 61 72 ns must not star
49e0: 74 20 62 72 61 6e 63 68 65 73 7d 20 5c 0a 09 20 t branches} \..
49f0: 20 20 20 7b 69 73 20 70 61 72 65 6e 74 20 6f 66 {is parent of
4a00: 20 61 20 70 72 69 6d 61 72 79 20 63 68 69 6c 64 a primary child
4a10: 20 77 68 69 63 68 20 69 73 20 74 68 65 20 62 65 which is the be
4a20: 67 69 6e 6e 69 6e 67 20 6f 66 20 61 20 62 72 61 ginning of a bra
4a30: 6e 63 68 7d 20 7b 0a 09 09 53 45 4c 45 43 54 20 nch} {...SELECT
4a40: 46 2e 6e 61 6d 65 2c 20 52 2e 72 65 76 0a 09 09 F.name, R.rev...
4a50: 46 52 4f 4d 20 20 20 72 65 76 69 73 69 6f 6e 20 FROM revision
4a60: 52 2c 20 72 65 76 69 73 69 6f 6e 20 43 2c 20 66 R, revision C, f
4a70: 69 6c 65 20 46 0a 09 09 57 48 45 52 45 20 20 52 ile F...WHERE R
4a80: 2e 66 69 64 20 3d 20 46 2e 66 69 64 20 20 20 20 .fid = F.fid
4a90: 20 20 20 20 20 20 20 2d 2d 20 47 65 74 20 66 69 -- Get fi
4aa0: 6c 65 20 6f 66 20 72 65 76 69 73 69 6f 6e 0a 09 le of revision..
4ab0: 09 41 4e 44 20 20 20 20 52 2e 63 68 69 6c 64 20 .AND R.child
4ac0: 49 53 20 4e 4f 54 20 4e 55 4c 4c 20 20 20 20 20 IS NOT NULL
4ad0: 2d 2d 20 52 65 73 74 72 69 63 74 20 74 6f 20 6e -- Restrict to n
4ae0: 6f 6e 2d 6c 65 61 76 65 73 0a 09 09 41 4e 44 20 on-leaves...AND
4af0: 20 20 20 52 2e 63 68 69 6c 64 20 3d 20 43 2e 72 R.child = C.r
4b00: 69 64 20 20 20 20 20 20 20 20 20 2d 2d 20 47 65 id -- Ge
4b10: 74 20 74 68 65 20 63 68 69 6c 64 20 28 68 61 73 t the child (has
4b20: 20 74 6f 20 65 78 69 73 74 29 0a 09 09 41 4e 44 to exist)...AND
4b30: 20 20 20 20 43 2e 62 70 61 72 65 6e 74 20 49 53 C.bparent IS
4b40: 20 4e 4f 54 20 4e 55 4c 4c 20 20 20 2d 2d 20 77 NOT NULL -- w
4b50: 72 6f 6e 67 6c 79 20 63 6c 61 69 6d 69 6e 67 20 rongly claiming
4b60: 74 6f 20 62 65 20 66 69 72 73 74 20 6f 6e 20 62 to be first on b
4b70: 72 61 6e 63 68 0a 09 09 3b 0a 09 20 20 20 20 7d ranch...;.. }
4b80: 0a 09 23 20 46 69 6e 64 20 61 6c 6c 20 72 65 76 ..# Find all rev
4b90: 69 73 69 6f 6e 73 20 77 69 74 68 6f 75 74 20 62 isions without b
4ba0: 72 61 6e 63 68 20 70 61 72 65 6e 74 20 73 79 6d ranch parent sym
4bb0: 62 6f 6c 20 77 68 69 63 68 20 68 61 76 65 20 61 bol which have a
4bc0: 0a 09 23 20 70 61 72 65 6e 74 2c 20 62 75 74 20 ..# parent, but
4bd0: 74 68 65 20 70 61 72 65 6e 74 20 64 6f 65 73 20 the parent does
4be0: 6e 6f 74 20 68 61 76 65 20 74 68 65 6d 20 61 73 not have them as
4bf0: 20 70 72 69 6d 61 72 79 20 63 68 69 6c 64 2e 0a primary child..
4c00: 09 43 68 65 63 6b 20 5c 0a 09 20 20 20 20 7b 52 .Check \.. {R
4c10: 65 76 69 73 69 6f 6e 73 20 68 61 76 65 20 74 6f evisions have to
4c20: 20 62 65 20 70 72 69 6d 61 72 79 20 63 68 69 6c be primary chil
4c30: 64 72 65 6e 20 6f 66 20 74 68 65 69 72 20 70 61 dren of their pa
4c40: 72 65 6e 74 73 2c 20 69 66 20 61 6e 79 7d 20 5c rents, if any} \
4c50: 0a 09 20 20 20 20 7b 69 73 20 6e 6f 74 20 74 68 .. {is not th
4c60: 65 20 63 68 69 6c 64 20 6f 66 20 69 74 73 20 70 e child of its p
4c70: 61 72 65 6e 74 7d 20 7b 0a 09 09 53 45 4c 45 43 arent} {...SELEC
4c80: 54 20 46 2e 6e 61 6d 65 2c 20 52 2e 72 65 76 0a T F.name, R.rev.
4c90: 09 09 46 52 4f 4d 20 20 20 72 65 76 69 73 69 6f ..FROM revisio
4ca0: 6e 20 52 2c 20 72 65 76 69 73 69 6f 6e 20 50 2c n R, revision P,
4cb0: 20 66 69 6c 65 20 46 0a 09 09 57 48 45 52 45 20 file F...WHERE
4cc0: 20 52 2e 66 69 64 20 3d 20 46 2e 66 69 64 0a 09 R.fid = F.fid..
4cd0: 09 41 4e 44 20 20 20 20 52 2e 62 70 61 72 65 6e .AND R.bparen
4ce0: 74 20 49 53 20 4e 55 4c 4c 20 20 20 20 20 2d 2d t IS NULL --
4cf0: 20 47 65 74 20 66 69 6c 65 20 6f 66 20 72 65 76 Get file of rev
4d00: 69 73 69 6f 6e 0a 09 09 41 4e 44 20 20 20 20 52 ision...AND R
4d10: 2e 70 61 72 65 6e 74 20 49 53 20 4e 4f 54 20 4e .parent IS NOT N
4d20: 55 4c 4c 20 20 2d 2d 20 52 65 73 74 72 69 63 74 ULL -- Restrict
4d30: 20 74 6f 20 65 76 65 72 79 74 68 69 6e 67 20 6e to everything n
4d40: 6f 74 20 66 69 72 73 74 20 6f 6e 20 61 20 62 72 ot first on a br
4d50: 61 6e 63 68 0a 09 09 41 4e 44 20 20 20 20 52 2e anch...AND R.
4d60: 70 61 72 65 6e 74 20 3d 20 50 2e 72 69 64 20 20 parent = P.rid
4d70: 20 20 20 20 2d 2d 20 47 65 74 20 74 68 65 20 70 -- Get the p
4d80: 61 72 65 6e 74 20 28 68 61 73 20 74 6f 20 65 78 arent (has to ex
4d90: 69 73 74 29 0a 09 09 41 4e 44 20 20 20 20 50 2e ist)...AND P.
4da0: 63 68 69 6c 64 20 21 3d 20 52 2e 72 69 64 20 20 child != R.rid
4db0: 20 20 20 20 2d 2d 20 57 68 69 63 68 20 64 6f 20 -- Which do
4dc0: 6e 6f 74 20 68 61 76 65 20 75 73 20 61 73 20 74 not have us as t
4dd0: 68 65 69 72 20 63 68 69 6c 64 0a 09 09 3b 0a 09 heir child...;..
4de0: 20 20 20 20 7d 0a 09 23 20 46 69 6e 64 20 61 6c }..# Find al
4df0: 6c 20 72 65 76 69 73 69 6f 6e 73 20 77 69 74 68 l revisions with
4e00: 20 61 20 62 72 61 6e 63 68 20 70 61 72 65 6e 74 a branch parent
4e10: 20 73 79 6d 62 6f 6c 20 77 68 69 63 68 20 64 6f symbol which do
4e20: 20 6e 6f 74 0a 09 23 20 68 61 76 65 20 61 20 70 not..# have a p
4e30: 61 72 65 6e 74 2e 0a 09 43 68 65 63 6b 20 5c 0a arent...Check \.
4e40: 09 20 20 20 20 7b 42 72 61 6e 63 68 20 73 74 61 . {Branch sta
4e50: 72 74 69 6e 67 20 72 65 76 69 73 69 6f 6e 73 20 rting revisions
4e60: 68 61 76 65 20 74 6f 20 68 61 76 65 20 61 20 70 have to have a p
4e70: 61 72 65 6e 74 7d 20 5c 0a 09 20 20 20 20 7b 61 arent} \.. {a
4e80: 74 20 74 68 65 20 62 65 67 69 6e 6e 69 6e 67 20 t the beginning
4e90: 6f 66 20 69 74 73 20 62 72 61 6e 63 68 20 68 61 of its branch ha
4ea0: 73 20 6e 6f 20 70 61 72 65 6e 74 7d 20 7b 0a 09 s no parent} {..
4eb0: 09 53 45 4c 45 43 54 20 46 2e 6e 61 6d 65 2c 20 .SELECT F.name,
4ec0: 52 2e 72 65 76 0a 09 09 46 52 4f 4d 20 20 20 72 R.rev...FROM r
4ed0: 65 76 69 73 69 6f 6e 20 52 2c 20 66 69 6c 65 20 evision R, file
4ee0: 46 0a 09 09 57 48 45 52 45 20 20 52 2e 66 69 64 F...WHERE R.fid
4ef0: 20 3d 20 46 2e 66 69 64 20 20 20 20 20 20 20 20 = F.fid
4f00: 20 20 2d 2d 20 47 65 74 20 66 69 6c 65 20 6f 66 -- Get file of
4f10: 20 72 65 76 69 73 69 6f 6e 0a 09 09 41 4e 44 20 revision...AND
4f20: 20 20 20 52 2e 62 70 61 72 65 6e 74 20 49 53 20 R.bparent IS
4f30: 4e 4f 54 20 4e 55 4c 4c 20 20 2d 2d 20 52 65 73 NOT NULL -- Res
4f40: 74 72 69 63 74 20 74 6f 20 66 69 72 73 74 20 6f trict to first o
4f50: 6e 20 61 20 62 72 61 6e 63 68 0a 09 09 41 4e 44 n a branch...AND
4f60: 20 20 20 20 52 2e 70 61 72 65 6e 74 20 49 53 20 R.parent IS
4f70: 4e 55 4c 4c 20 20 20 20 20 20 20 2d 2d 20 42 75 NULL -- Bu
4f80: 74 20 74 68 65 72 65 20 69 73 20 6e 6f 20 6f 75 t there is no ou
4f90: 74 2d 6f 66 2d 62 72 61 6e 63 68 20 70 61 72 65 t-of-branch pare
4fa0: 6e 74 0a 09 09 3b 0a 09 20 20 20 20 7d 0a 09 23 nt...;.. }..#
4fb0: 20 46 69 6e 64 20 61 6c 6c 20 72 65 76 69 73 69 Find all revisi
4fc0: 6f 6e 73 20 77 69 74 68 20 61 20 62 72 61 6e 63 ons with a branc
4fd0: 68 20 70 61 72 65 6e 74 20 73 79 6d 62 6f 6c 20 h parent symbol
4fe0: 77 68 6f 73 65 20 70 61 72 65 6e 74 0a 09 23 20 whose parent..#
4ff0: 68 61 73 20 74 68 65 6d 20 61 73 20 70 72 69 6d has them as prim
5000: 61 72 79 20 63 68 69 6c 64 2e 0a 09 43 68 65 63 ary child...Chec
5010: 6b 20 5c 0a 09 20 20 20 20 7b 42 72 61 6e 63 68 k \.. {Branch
5020: 20 73 74 61 72 74 69 6e 67 20 72 65 76 69 73 69 starting revisi
5030: 6f 6e 73 20 6d 75 73 74 20 6e 6f 74 20 62 65 20 ons must not be
5040: 70 72 69 6d 61 72 79 20 63 68 69 6c 64 72 65 6e primary children
5050: 20 6f 66 20 74 68 65 69 72 20 70 61 72 65 6e 74 of their parent
5060: 73 7d 20 5c 0a 09 20 20 20 20 7b 61 74 20 74 68 s} \.. {at th
5070: 65 20 62 65 67 69 6e 6e 69 6e 67 20 6f 66 20 69 e beginning of i
5080: 74 73 20 62 72 61 6e 63 68 20 69 73 20 74 68 65 ts branch is the
5090: 20 70 72 69 6d 61 72 79 20 63 68 69 6c 64 20 6f primary child o
50a0: 66 20 69 74 73 20 70 61 72 65 6e 74 7d 20 7b 0a f its parent} {.
50b0: 09 09 53 45 4c 45 43 54 20 46 2e 6e 61 6d 65 2c ..SELECT F.name,
50c0: 20 52 2e 72 65 76 0a 09 09 46 52 4f 4d 20 20 20 R.rev...FROM
50d0: 72 65 76 69 73 69 6f 6e 20 52 2c 20 72 65 76 69 revision R, revi
50e0: 73 69 6f 6e 20 50 2c 20 66 69 6c 65 20 46 0a 09 sion P, file F..
50f0: 09 57 48 45 52 45 20 20 52 2e 66 69 64 20 3d 20 .WHERE R.fid =
5100: 46 2e 66 69 64 20 20 20 20 20 20 20 20 20 20 2d F.fid -
5110: 2d 20 47 65 74 20 66 69 6c 65 20 6f 66 20 72 65 - Get file of re
5120: 76 69 73 69 6f 6e 0a 09 09 41 4e 44 20 20 20 20 vision...AND
5130: 52 2e 62 70 61 72 65 6e 74 20 49 53 20 4e 4f 54 R.bparent IS NOT
5140: 20 4e 55 4c 4c 20 20 2d 2d 20 52 65 73 74 72 69 NULL -- Restri
5150: 63 74 20 74 6f 20 66 69 72 73 74 20 6f 6e 20 61 ct to first on a
5160: 20 62 72 61 6e 63 68 0a 09 09 41 4e 44 20 20 20 branch...AND
5170: 20 52 2e 70 61 72 65 6e 74 20 49 53 20 4e 4f 54 R.parent IS NOT
5180: 20 4e 55 4c 4c 20 20 20 2d 2d 20 57 68 69 63 68 NULL -- Which
5190: 20 61 72 65 20 6e 6f 74 20 64 65 74 61 63 68 65 are not detache
51a0: 64 0a 09 09 41 4e 44 20 20 20 20 52 2e 70 61 72 d...AND R.par
51b0: 65 6e 74 20 3d 20 50 2e 72 69 64 20 20 20 20 20 ent = P.rid
51c0: 20 20 2d 2d 20 47 65 74 20 74 68 65 69 72 20 6e -- Get their n
51d0: 6f 6e 2d 62 72 61 6e 63 68 20 70 61 72 65 6e 74 on-branch parent
51e0: 0a 09 09 41 4e 44 20 20 20 20 50 2e 63 68 69 6c ...AND P.chil
51f0: 64 20 3d 20 52 2e 72 69 64 20 20 20 20 20 20 20 d = R.rid
5200: 20 2d 2d 20 77 68 69 63 68 20 69 6d 70 72 6f 70 -- which improp
5210: 65 72 6c 79 20 68 61 73 20 74 68 65 6d 20 61 73 erly has them as
5220: 20 70 72 69 6d 61 72 79 20 63 68 69 6c 64 0a 09 primary child..
5230: 09 3b 0a 09 20 20 20 20 7d 0a 09 23 20 46 69 6e .;.. }..# Fin
5240: 64 20 61 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 d all revisions
5250: 77 69 74 68 20 61 20 6e 6f 6e 2d 4e 54 44 42 20 with a non-NTDB
5260: 63 68 69 6c 64 20 77 68 69 63 68 20 61 72 65 20 child which are
5270: 6e 6f 74 20 6f 6e 0a 09 23 20 74 68 65 20 4e 54 not on..# the NT
5280: 44 42 2e 0a 09 43 68 65 63 6b 20 5c 0a 09 20 20 DB...Check \..
5290: 20 20 7b 4e 54 44 42 20 74 6f 20 74 72 75 6e 6b {NTDB to trunk
52a0: 20 74 72 61 6e 73 69 74 69 6f 6e 20 68 61 73 20 transition has
52b0: 74 6f 20 62 65 67 69 6e 20 6f 6e 20 4e 54 44 42 to begin on NTDB
52c0: 7d 20 5c 0a 09 20 20 20 20 7b 68 61 73 20 61 20 } \.. {has a
52d0: 6e 6f 6e 2d 4e 54 44 42 20 63 68 69 6c 64 2c 20 non-NTDB child,
52e0: 79 65 74 20 69 73 20 6e 6f 74 20 6f 6e 20 74 68 yet is not on th
52f0: 65 20 4e 54 44 42 7d 20 7b 0a 09 09 53 45 4c 45 e NTDB} {...SELE
5300: 43 54 20 46 2e 6e 61 6d 65 2c 20 52 2e 72 65 76 CT F.name, R.rev
5310: 0a 09 09 46 52 4f 4d 20 20 20 72 65 76 69 73 69 ...FROM revisi
5320: 6f 6e 20 52 2c 20 66 69 6c 65 20 46 0a 09 09 57 on R, file F...W
5330: 48 45 52 45 20 20 52 2e 66 69 64 20 3d 20 46 2e HERE R.fid = F.
5340: 66 69 64 20 20 20 20 20 20 20 20 20 20 2d 2d 20 fid --
5350: 47 65 74 20 66 69 6c 65 20 6f 66 20 72 65 76 69 Get file of revi
5360: 73 69 6f 6e 0a 09 09 41 4e 44 20 20 20 20 52 2e sion...AND R.
5370: 64 62 63 68 69 6c 64 20 49 53 20 4e 4f 54 20 4e dbchild IS NOT N
5380: 55 4c 4c 20 20 2d 2d 20 52 65 73 74 72 69 63 74 ULL -- Restrict
5390: 20 74 6f 20 73 65 6d 69 2d 6c 61 73 74 20 4e 54 to semi-last NT
53a0: 44 42 20 72 65 76 69 73 69 6f 6e 0a 09 09 41 4e DB revision...AN
53b0: 44 20 20 20 20 4e 4f 54 20 52 2e 69 73 64 65 66 D NOT R.isdef
53c0: 61 75 6c 74 20 20 20 20 20 20 20 20 2d 2d 20 49 ault -- I
53d0: 6d 70 72 6f 70 65 72 6c 79 20 63 6c 61 69 6d 69 mproperly claimi
53e0: 6e 67 20 74 6f 20 6e 6f 74 20 62 65 20 6f 6e 20 ng to not be on
53f0: 4e 54 44 42 0a 09 09 3b 0a 09 20 20 20 20 7d 0a NTDB...;.. }.
5400: 09 23 20 46 69 6e 64 20 61 6c 6c 20 72 65 76 69 .# Find all revi
5410: 73 69 6f 6e 73 20 77 69 74 68 20 61 20 4e 54 44 sions with a NTD
5420: 42 20 70 61 72 65 6e 74 20 77 68 69 63 68 20 61 B parent which a
5430: 72 65 20 6f 6e 20 74 68 65 20 4e 54 44 42 2e 0a re on the NTDB..
5440: 09 43 68 65 63 6b 20 5c 0a 09 20 20 20 20 7b 4e .Check \.. {N
5450: 54 44 42 20 74 6f 20 74 72 75 6e 6b 20 74 72 61 TDB to trunk tra
5460: 6e 73 69 74 69 6f 6e 20 68 61 73 20 74 6f 20 65 nsition has to e
5470: 6e 64 20 6f 6e 20 6e 6f 6e 2d 4e 54 44 42 7d 20 nd on non-NTDB}
5480: 5c 0a 09 20 20 20 20 7b 68 61 73 20 61 20 4e 54 \.. {has a NT
5490: 44 42 20 70 61 72 65 6e 74 2c 20 79 65 74 20 69 DB parent, yet i
54a0: 73 20 6f 6e 20 74 68 65 20 4e 54 44 42 7d 20 7b s on the NTDB} {
54b0: 0a 09 09 53 45 4c 45 43 54 20 46 2e 6e 61 6d 65 ...SELECT F.name
54c0: 2c 20 52 2e 72 65 76 0a 09 09 46 52 4f 4d 20 20 , R.rev...FROM
54d0: 20 72 65 76 69 73 69 6f 6e 20 52 2c 20 66 69 6c revision R, fil
54e0: 65 20 46 0a 09 09 57 48 45 52 45 20 20 52 2e 66 e F...WHERE R.f
54f0: 69 64 20 3d 20 46 2e 66 69 64 20 20 20 20 20 20 id = F.fid
5500: 20 20 20 20 20 2d 2d 20 47 65 74 20 66 69 6c 65 -- Get file
5510: 20 6f 66 20 72 65 76 69 73 69 6f 6e 0a 09 09 41 of revision...A
5520: 4e 44 20 20 20 20 52 2e 64 62 70 61 72 65 6e 74 ND R.dbparent
5530: 20 49 53 20 4e 4f 54 20 4e 55 4c 4c 20 20 2d 2d IS NOT NULL --
5540: 20 52 65 73 74 72 69 63 74 20 74 6f 20 74 72 75 Restrict to tru
5550: 6e 6b 20 72 6f 6f 74 73 20 77 69 74 68 20 4e 54 nk roots with NT
5560: 44 42 20 61 72 6f 75 6e 64 0a 09 09 41 4e 44 20 DB around...AND
5570: 20 20 20 52 2e 69 73 64 65 66 61 75 6c 74 20 20 R.isdefault
5580: 20 20 20 20 20 20 20 20 20 20 20 2d 2d 20 42 75 -- Bu
5590: 74 20 72 6f 6f 74 20 69 6d 70 72 6f 70 65 72 6c t root improperl
55a0: 79 20 63 6c 61 69 6d 73 20 74 6f 20 62 65 20 6f y claims to be o
55b0: 6e 20 4e 54 44 42 0a 09 09 3b 0a 09 20 20 20 20 n NTDB...;..
55c0: 7d 0a 09 23 20 46 69 6e 64 20 61 6c 6c 20 72 65 }..# Find all re
55d0: 76 69 73 69 6f 6e 73 20 77 69 74 68 20 61 20 63 visions with a c
55e0: 68 69 6c 64 20 77 68 69 63 68 20 64 69 73 61 67 hild which disag
55f0: 72 65 65 73 20 61 62 6f 75 74 20 74 68 65 0a 09 rees about the..
5600: 23 20 6c 69 6e 65 20 6f 66 20 64 65 76 65 6c 6f # line of develo
5610: 70 6d 65 6e 74 20 74 68 65 79 20 62 65 6c 6f 6e pment they belon
5620: 67 20 74 6f 2e 0a 09 43 68 65 63 6b 20 5c 0a 09 g to...Check \..
5630: 20 20 20 20 7b 52 65 76 69 73 69 6f 6e 73 20 61 {Revisions a
5640: 6e 64 20 74 68 65 69 72 20 70 72 69 6d 61 72 79 nd their primary
5650: 20 63 68 69 6c 64 72 65 6e 20 68 61 76 65 20 74 children have t
5660: 6f 20 62 65 20 69 6e 20 74 68 65 20 73 61 6d 65 o be in the same
5670: 20 4c 4f 44 7d 20 5c 0a 09 20 20 20 20 7b 61 6e LOD} \.. {an
5680: 64 20 69 74 73 20 70 72 69 6d 61 72 79 20 63 68 d its primary ch
5690: 69 6c 64 20 64 69 73 61 67 72 65 65 20 61 62 6f ild disagree abo
56a0: 75 74 20 74 68 65 69 72 20 4c 4f 44 7d 20 7b 0a ut their LOD} {.
56b0: 09 09 53 45 4c 45 43 54 20 46 2e 6e 61 6d 65 2c ..SELECT F.name,
56c0: 20 52 2e 72 65 76 0a 09 09 46 52 4f 4d 20 20 20 R.rev...FROM
56d0: 72 65 76 69 73 69 6f 6e 20 52 2c 20 72 65 76 69 revision R, revi
56e0: 73 69 6f 6e 20 43 2c 20 66 69 6c 65 20 46 0a 09 sion C, file F..
56f0: 09 57 48 45 52 45 20 20 52 2e 66 69 64 20 3d 20 .WHERE R.fid =
5700: 46 2e 66 69 64 20 20 20 20 20 20 20 20 2d 2d 20 F.fid --
5710: 47 65 74 20 66 69 6c 65 20 6f 66 20 72 65 76 69 Get file of revi
5720: 73 69 6f 6e 0a 09 09 41 4e 44 20 20 20 20 52 2e sion...AND R.
5730: 63 68 69 6c 64 20 49 53 20 4e 4f 54 20 4e 55 4c child IS NOT NUL
5740: 4c 20 20 2d 2d 20 52 65 73 74 72 69 63 74 20 74 L -- Restrict t
5750: 6f 20 6e 6f 6e 2d 6c 65 61 76 65 73 0a 09 09 41 o non-leaves...A
5760: 4e 44 20 20 20 20 52 2e 63 68 69 6c 64 20 3d 20 ND R.child =
5770: 43 2e 72 69 64 20 20 20 20 20 20 2d 2d 20 47 65 C.rid -- Ge
5780: 74 20 63 68 69 6c 64 20 28 68 61 73 20 74 6f 20 t child (has to
5790: 65 78 69 73 74 29 0a 09 09 41 4e 44 20 20 20 20 exist)...AND
57a0: 43 2e 6c 6f 64 20 21 3d 20 52 2e 6c 6f 64 20 20 C.lod != R.lod
57b0: 20 20 20 20 20 2d 2d 20 77 68 69 63 68 20 69 6d -- which im
57c0: 70 72 6f 70 65 72 6c 79 20 75 73 65 73 20 61 20 properly uses a
57d0: 64 69 66 66 65 72 65 6e 74 20 4c 4f 44 0a 09 09 different LOD...
57e0: 3b 0a 09 20 20 20 20 7d 0a 09 23 20 46 69 6e 64 ;.. }..# Find
57f0: 20 61 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 77 all revisions w
5800: 69 74 68 20 61 20 6e 6f 6e 2d 4e 54 44 42 20 63 ith a non-NTDB c
5810: 68 69 6c 64 20 77 68 69 63 68 20 61 67 72 65 65 hild which agree
5820: 73 20 61 62 6f 75 74 0a 09 23 20 74 68 65 20 6c s about..# the l
5830: 69 6e 65 20 6f 66 20 64 65 76 65 6c 6f 70 6d 65 ine of developme
5840: 6e 74 20 74 68 65 79 20 62 65 6c 6f 6e 67 20 74 nt they belong t
5850: 6f 2e 0a 09 43 68 65 63 6b 20 5c 0a 09 20 20 20 o...Check \..
5860: 20 7b 4e 54 44 42 20 61 6e 64 20 74 72 75 6e 6b {NTDB and trunk
5870: 20 72 65 76 69 73 69 6f 6e 73 20 68 61 76 65 20 revisions have
5880: 74 6f 20 62 65 20 69 6e 20 64 69 66 66 65 72 65 to be in differe
5890: 6e 74 20 4c 4f 44 73 7d 20 5c 0a 09 20 20 20 20 nt LODs} \..
58a0: 7b 6f 6e 20 4e 54 44 42 20 61 6e 64 20 69 74 73 {on NTDB and its
58b0: 20 6e 6f 6e 2d 4e 54 44 42 20 63 68 69 6c 64 20 non-NTDB child
58c0: 77 72 6f 6e 67 6c 79 20 61 67 72 65 65 20 61 62 wrongly agree ab
58d0: 6f 75 74 20 74 68 65 69 72 20 4c 4f 44 7d 20 7b out their LOD} {
58e0: 0a 09 09 53 45 4c 45 43 54 20 46 2e 6e 61 6d 65 ...SELECT F.name
58f0: 2c 20 52 2e 72 65 76 0a 09 09 46 52 4f 4d 20 20 , R.rev...FROM
5900: 20 72 65 76 69 73 69 6f 6e 20 52 2c 20 72 65 76 revision R, rev
5910: 69 73 69 6f 6e 20 43 2c 20 66 69 6c 65 20 46 0a ision C, file F.
5920: 09 09 57 48 45 52 45 20 20 52 2e 66 69 64 20 3d ..WHERE R.fid =
5930: 20 46 2e 66 69 64 20 20 20 20 20 20 20 20 20 20 F.fid
5940: 2d 2d 20 47 65 74 20 66 69 6c 65 20 6f 66 20 72 -- Get file of r
5950: 65 76 69 73 69 6f 6e 0a 09 09 41 4e 44 20 20 20 evision...AND
5960: 20 52 2e 64 62 63 68 69 6c 64 20 49 53 20 4e 4f R.dbchild IS NO
5970: 54 20 4e 55 4c 4c 20 20 2d 2d 20 52 65 73 74 72 T NULL -- Restr
5980: 69 63 74 20 74 6f 20 73 65 6d 69 2d 6c 61 73 74 ict to semi-last
5990: 20 4e 54 44 42 20 72 65 76 69 73 69 6f 6e 0a 09 NTDB revision..
59a0: 09 41 4e 44 20 20 20 20 52 2e 64 62 63 68 69 6c .AND R.dbchil
59b0: 64 20 3d 20 43 2e 72 69 64 20 20 20 20 20 20 2d d = C.rid -
59c0: 2d 20 47 65 74 20 61 73 73 6f 63 69 61 74 65 64 - Get associated
59d0: 20 74 72 75 6e 6b 20 72 6f 6f 74 20 72 65 76 69 trunk root revi
59e0: 73 69 6f 6e 0a 09 09 41 4e 44 20 20 20 20 43 2e sion...AND C.
59f0: 6c 6f 64 20 3d 20 52 2e 6c 6f 64 20 20 20 20 20 lod = R.lod
5a00: 20 20 20 20 20 2d 2d 20 49 6d 70 72 6f 70 65 72 -- Improper
5a10: 6c 79 20 75 73 65 73 20 74 68 65 20 73 61 6d 65 ly uses the same
5a20: 20 4c 4f 44 0a 09 09 3b 0a 09 20 20 20 20 7d 0a LOD...;.. }.
5a30: 09 23 20 46 69 6e 64 20 61 6c 6c 20 72 65 76 69 .# Find all revi
5a40: 73 69 6f 6e 73 20 77 69 74 68 20 61 20 62 72 61 sions with a bra
5a50: 6e 63 68 20 70 61 72 65 6e 74 20 73 79 6d 62 6f nch parent symbo
5a60: 6c 20 77 68 69 63 68 20 69 73 20 6e 6f 74 0a 09 l which is not..
5a70: 23 20 74 68 65 69 72 20 4c 4f 44 2e 0a 09 43 68 # their LOD...Ch
5a80: 65 63 6b 20 5c 0a 09 20 20 20 20 7b 42 72 61 6e eck \.. {Bran
5a90: 63 68 20 73 74 61 72 74 69 6e 67 20 72 65 76 69 ch starting revi
5aa0: 73 69 6f 6e 73 20 68 61 76 65 20 74 6f 20 68 61 sions have to ha
5ab0: 76 65 20 74 68 65 69 72 20 4c 4f 44 20 61 73 20 ve their LOD as
5ac0: 62 72 61 6e 63 68 20 70 61 72 65 6e 74 20 73 79 branch parent sy
5ad0: 6d 62 6f 6c 7d 20 5c 0a 09 20 20 20 20 7b 61 74 mbol} \.. {at
5ae0: 20 74 68 65 20 62 65 67 69 6e 6e 69 6e 67 20 6f the beginning o
5af0: 66 20 69 74 73 20 62 72 61 6e 63 68 20 64 6f 65 f its branch doe
5b00: 73 20 6e 6f 74 20 68 61 76 65 20 74 68 65 20 62 s not have the b
5b10: 72 61 6e 63 68 20 73 79 6d 62 6f 6c 20 61 73 20 ranch symbol as
5b20: 69 74 73 20 4c 4f 44 7d 20 7b 0a 09 09 53 45 4c its LOD} {...SEL
5b30: 45 43 54 20 46 2e 6e 61 6d 65 2c 20 52 2e 72 65 ECT F.name, R.re
5b40: 76 0a 09 09 46 52 4f 4d 20 20 20 72 65 76 69 73 v...FROM revis
5b50: 69 6f 6e 20 52 2c 20 66 69 6c 65 20 46 0a 09 09 ion R, file F...
5b60: 57 48 45 52 45 20 20 52 2e 66 69 64 20 3d 20 46 WHERE R.fid = F
5b70: 2e 66 69 64 20 20 20 20 20 20 20 20 20 20 2d 2d .fid --
5b80: 20 47 65 74 20 66 69 6c 65 20 6f 66 20 72 65 76 Get file of rev
5b90: 69 73 69 6f 6e 0a 09 09 41 4e 44 20 20 20 20 52 ision...AND R
5ba0: 2e 62 70 61 72 65 6e 74 20 49 53 20 4e 4f 54 20 .bparent IS NOT
5bb0: 4e 55 4c 4c 20 20 2d 2d 20 52 65 73 74 72 69 63 NULL -- Restric
5bc0: 74 20 74 6f 20 72 65 76 69 73 69 6f 6e 73 20 66 t to revisions f
5bd0: 69 72 73 74 20 6f 6e 20 61 20 62 72 61 6e 63 68 irst on a branch
5be0: 0a 09 09 41 4e 44 20 20 20 20 52 2e 6c 6f 64 20 ...AND R.lod
5bf0: 21 3d 20 52 2e 62 70 61 72 65 6e 74 20 20 20 20 != R.bparent
5c00: 20 2d 2d 20 61 6e 64 20 74 68 65 69 72 20 62 72 -- and their br
5c10: 61 6e 63 68 20 69 73 20 6e 6f 74 20 74 68 65 69 anch is not thei
5c20: 72 20 4c 4f 44 0a 09 09 3b 0a 09 20 20 20 20 7d r LOD...;.. }
5c30: 0a 09 23 20 46 69 6e 64 20 61 6c 6c 20 72 65 76 ..# Find all rev
5c40: 69 73 69 6f 6e 73 20 77 69 74 68 20 61 20 62 72 isions with a br
5c50: 61 6e 63 68 20 70 61 72 65 6e 74 20 73 79 6d 62 anch parent symb
5c60: 6f 6c 20 77 68 6f 73 65 20 70 61 72 65 6e 74 0a ol whose parent.
5c70: 09 23 20 69 73 20 69 6e 20 74 68 65 20 73 61 6d .# is in the sam
5c80: 65 20 6c 69 6e 65 20 6f 66 20 64 65 76 65 6c 6f e line of develo
5c90: 70 6d 65 6e 74 2e 0a 09 43 68 65 63 6b 20 5c 0a pment...Check \.
5ca0: 09 20 20 20 20 7b 52 65 76 69 73 69 6f 6e 73 20 . {Revisions
5cb0: 61 6e 64 20 74 68 65 69 72 20 62 72 61 6e 63 68 and their branch
5cc0: 20 63 68 69 6c 64 72 65 6e 20 68 61 76 65 20 74 children have t
5cd0: 6f 20 62 65 20 69 6e 20 64 69 66 66 65 72 65 6e o be in differen
5ce0: 74 20 4c 4f 44 73 7d 20 5c 0a 09 20 20 20 20 7b t LODs} \.. {
5cf0: 61 74 20 74 68 65 20 62 65 67 69 6e 6e 69 6e 67 at the beginning
5d00: 20 6f 66 20 69 74 73 20 62 72 61 6e 63 68 20 61 of its branch a
5d10: 6e 64 20 69 74 73 20 70 61 72 65 6e 74 20 77 72 nd its parent wr
5d20: 6f 6e 67 6c 79 20 61 67 72 65 65 20 61 62 6f 75 ongly agree abou
5d30: 74 20 74 68 65 69 72 20 4c 4f 44 7d 20 7b 0a 09 t their LOD} {..
5d40: 09 53 45 4c 45 43 54 20 46 2e 6e 61 6d 65 2c 20 .SELECT F.name,
5d50: 52 2e 72 65 76 0a 09 09 46 52 4f 4d 20 20 20 72 R.rev...FROM r
5d60: 65 76 69 73 69 6f 6e 20 52 2c 20 72 65 76 69 73 evision R, revis
5d70: 69 6f 6e 20 50 2c 20 66 69 6c 65 20 46 0a 09 09 ion P, file F...
5d80: 57 48 45 52 45 20 20 52 2e 66 69 64 20 3d 20 46 WHERE R.fid = F
5d90: 2e 66 69 64 20 20 20 20 20 20 20 20 20 20 2d 2d .fid --
5da0: 20 47 65 74 20 66 69 6c 65 20 6f 66 20 72 65 76 Get file of rev
5db0: 69 73 69 6f 6e 0a 09 09 41 4e 44 20 20 20 20 52 ision...AND R
5dc0: 2e 62 70 61 72 65 6e 74 20 49 53 20 4e 4f 54 20 .bparent IS NOT
5dd0: 4e 55 4c 4c 20 20 2d 2d 20 52 65 73 74 72 69 63 NULL -- Restric
5de0: 74 20 74 6f 20 72 65 76 69 73 69 6f 6e 73 20 66 t to revisions f
5df0: 69 72 73 74 20 6f 6e 20 61 20 62 72 61 6e 63 68 irst on a branch
5e00: 0a 09 09 41 4e 44 20 20 20 20 52 2e 70 61 72 65 ...AND R.pare
5e10: 6e 74 20 3d 20 50 2e 72 69 64 20 20 20 20 20 20 nt = P.rid
5e20: 20 2d 2d 20 47 65 74 20 74 68 65 69 72 20 6e 6f -- Get their no
5e30: 6e 2d 62 72 61 6e 63 68 20 70 61 72 65 6e 74 0a n-branch parent.
5e40: 09 09 41 4e 44 20 20 20 20 52 2e 6c 6f 64 20 3d ..AND R.lod =
5e50: 20 50 2e 6c 6f 64 20 20 20 20 20 20 20 20 20 20 P.lod
5e60: 2d 2d 20 57 68 69 63 68 20 69 6d 70 72 6f 70 65 -- Which imprope
5e70: 72 6c 79 20 75 73 65 73 20 74 68 65 20 73 61 6d rly uses the sam
5e80: 65 20 4c 4f 44 0a 09 09 3b 0a 09 20 20 20 20 7d e LOD...;.. }
5e90: 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a ..return. }..
5ea0: 20 20 20 20 70 72 6f 63 20 43 68 65 63 6b 20 7b proc Check {
5eb0: 68 65 61 64 65 72 20 6c 61 62 65 6c 20 73 71 6c header label sql
5ec0: 7d 20 7b 0a 09 75 70 76 61 72 20 31 20 6e 20 6e } {..upvar 1 n n
5ed0: 0a 09 73 65 74 20 6f 6b 20 31 0a 09 66 6f 72 65 ..set ok 1..fore
5ee0: 61 63 68 20 7b 66 6e 61 6d 65 20 72 65 76 6e 72 ach {fname revnr
5ef0: 7d 20 5b 73 74 61 74 65 20 72 75 6e 20 24 73 71 } [state run $sq
5f00: 6c 5d 20 7b 0a 09 20 20 20 20 73 65 74 20 6f 6b l] {.. set ok
5f10: 20 30 0a 09 20 20 20 20 74 72 6f 75 62 6c 65 20 0.. trouble
5f20: 66 61 74 61 6c 20 22 24 66 6e 61 6d 65 20 3c 24 fatal "$fname <$
5f30: 72 65 76 6e 72 3e 20 24 6c 61 62 65 6c 22 0a 09 revnr> $label"..
5f40: 7d 0a 09 6c 6f 67 20 77 72 69 74 65 20 35 20 63 }..log write 5 c
5f50: 6f 6c 6c 72 65 76 20 22 5c 5b 5b 66 6f 72 6d 61 ollrev "\[[forma
5f60: 74 20 25 30 32 64 20 5b 69 6e 63 72 20 6e 5d 5d t %02d [incr n]]
5f70: 5c 5d 20 5b 65 78 70 72 20 7b 24 6f 6b 20 3f 20 \] [expr {$ok ?
5f80: 22 4f 6b 20 20 20 20 22 20 3a 20 22 46 61 69 6c "Ok " : "Fail
5f90: 65 64 22 7d 5d 20 2e 2e 2e 20 24 68 65 61 64 65 ed"}] ... $heade
5fa0: 72 22 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 7d r"..return. }
5fb0: 0a 0a 20 20 20 20 23 20 23 20 23 23 20 23 23 23 .. # # ## ###
5fc0: 20 23 23 23 23 23 20 23 23 23 23 23 23 23 23 20 ##### ########
5fd0: 23 23 23 23 23 23 23 23 23 23 23 23 23 0a 20 20 #############.
5fe0: 20 20 23 23 20 49 6e 74 65 72 6e 61 6c 20 6d 65 ## Internal me
5ff0: 74 68 6f 64 73 0a 0a 20 20 20 20 23 20 23 20 23 thods.. # # #
6000: 23 20 23 23 23 20 23 23 23 23 23 20 23 23 23 23 # ### ##### ####
6010: 23 23 23 23 20 23 23 23 23 23 23 23 23 23 23 23 #### ###########
6020: 23 23 0a 20 20 20 20 23 23 20 43 6f 6e 66 69 67 ##. ## Config
6030: 75 72 61 74 69 6f 6e 0a 0a 20 20 20 20 70 72 61 uration.. pra
6040: 67 6d 61 20 2d 68 61 73 69 6e 73 74 61 6e 63 65 gma -hasinstance
6050: 73 20 20 20 6e 6f 20 3b 20 23 20 73 69 6e 67 6c s no ; # singl
6060: 65 74 6f 6e 0a 20 20 20 20 70 72 61 67 6d 61 20 eton. pragma
6070: 2d 68 61 73 74 79 70 65 69 6e 66 6f 20 20 20 20 -hastypeinfo
6080: 6e 6f 20 3b 20 23 20 6e 6f 20 69 6e 74 72 6f 73 no ; # no intros
6090: 70 65 63 74 69 6f 6e 0a 20 20 20 20 70 72 61 67 pection. prag
60a0: 6d 61 20 2d 68 61 73 74 79 70 65 64 65 73 74 72 ma -hastypedestr
60b0: 6f 79 20 6e 6f 20 3b 20 23 20 69 6d 6d 6f 72 74 oy no ; # immort
60c0: 61 6c 0a 0a 20 20 20 20 23 20 23 20 23 23 20 23 al.. # # ## #
60d0: 23 23 20 23 23 23 23 23 20 23 23 23 23 23 23 23 ## ##### #######
60e0: 23 20 23 23 23 23 23 23 23 23 23 23 23 23 23 0a # #############.
60f0: 7d 0a 0a 6e 61 6d 65 73 70 61 63 65 20 65 76 61 }..namespace eva
6100: 6c 20 3a 3a 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a l ::vc::fossil::
6110: 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 70 61 73 import::cvs::pas
6120: 73 20 7b 0a 20 20 20 20 6e 61 6d 65 73 70 61 63 s {. namespac
6130: 65 20 65 78 70 6f 72 74 20 63 6f 6c 6c 72 65 76 e export collrev
6140: 0a 20 20 20 20 6e 61 6d 65 73 70 61 63 65 20 65 . namespace e
6150: 76 61 6c 20 63 6f 6c 6c 72 65 76 20 7b 0a 09 6e val collrev {..n
6160: 61 6d 65 73 70 61 63 65 20 69 6d 70 6f 72 74 20 amespace import
6170: 3a 3a 76 63 3a 3a 72 63 73 3a 3a 70 61 72 73 65 ::vc::rcs::parse
6180: 72 0a 09 6e 61 6d 65 73 70 61 63 65 20 69 6d 70 r..namespace imp
6190: 6f 72 74 20 3a 3a 76 63 3a 3a 66 6f 73 73 69 6c ort ::vc::fossil
61a0: 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 72 ::import::cvs::r
61b0: 65 70 6f 73 69 74 6f 72 79 0a 09 6e 61 6d 65 73 epository..names
61c0: 70 61 63 65 20 69 6d 70 6f 72 74 20 3a 3a 76 63 pace import ::vc
61d0: 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 ::fossil::import
61e0: 3a 3a 63 76 73 3a 3a 73 74 61 74 65 0a 09 6e 61 ::cvs::state..na
61f0: 6d 65 73 70 61 63 65 20 69 6d 70 6f 72 74 20 3a mespace import :
6200: 3a 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 :vc::fossil::imp
6210: 6f 72 74 3a 3a 63 76 73 3a 3a 69 6e 74 65 67 72 ort::cvs::integr
6220: 69 74 79 0a 09 6e 61 6d 65 73 70 61 63 65 20 65 ity..namespace e
6230: 76 61 6c 20 70 72 6f 6a 65 63 74 20 7b 0a 09 20 val project {..
6240: 20 20 20 6e 61 6d 65 73 70 61 63 65 20 69 6d 70 namespace imp
6250: 6f 72 74 20 3a 3a 76 63 3a 3a 66 6f 73 73 69 6c ort ::vc::fossil
6260: 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 70 ::import::cvs::p
6270: 72 6f 6a 65 63 74 3a 3a 73 79 6d 0a 09 7d 0a 09 roject::sym..}..
6280: 6e 61 6d 65 73 70 61 63 65 20 65 76 61 6c 20 66 namespace eval f
6290: 69 6c 65 20 7b 0a 09 20 20 20 20 6e 61 6d 65 73 ile {.. names
62a0: 70 61 63 65 20 69 6d 70 6f 72 74 20 3a 3a 76 63 pace import ::vc
62b0: 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 ::fossil::import
62c0: 3a 3a 63 76 73 3a 3a 66 69 6c 65 3a 3a 72 65 76 ::cvs::file::rev
62d0: 0a 09 7d 0a 09 6e 61 6d 65 73 70 61 63 65 20 69 ..}..namespace i
62e0: 6d 70 6f 72 74 20 3a 3a 76 63 3a 3a 74 6f 6f 6c mport ::vc::tool
62f0: 73 3a 3a 74 72 6f 75 62 6c 65 0a 09 6e 61 6d 65 s::trouble..name
6300: 73 70 61 63 65 20 69 6d 70 6f 72 74 20 3a 3a 76 space import ::v
6310: 63 3a 3a 74 6f 6f 6c 73 3a 3a 6c 6f 67 0a 09 6c c::tools::log..l
6320: 6f 67 20 72 65 67 69 73 74 65 72 20 63 6f 6c 6c og register coll
6330: 72 65 76 0a 20 20 20 20 7d 0a 7d 0a 0a 23 20 23 rev. }.}..# #
6340: 20 23 23 20 23 23 23 20 23 23 23 23 23 20 23 23 ## ### ##### ##
6350: 23 23 23 23 23 23 20 23 23 23 23 23 23 23 23 23 ###### #########
6360: 23 23 23 23 20 23 23 23 23 23 23 23 23 23 23 23 #### ###########
6370: 23 23 23 23 23 23 23 23 23 23 0a 23 23 20 52 65 ##########.## Re
6380: 61 64 79 0a 0a 70 61 63 6b 61 67 65 20 70 72 6f ady..package pro
6390: 76 69 64 65 20 76 63 3a 3a 66 6f 73 73 69 6c 3a vide vc::fossil:
63a0: 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 70 61 :import::cvs::pa
63b0: 73 73 3a 3a 63 6f 6c 6c 72 65 76 20 31 2e 30 0a ss::collrev 1.0.
63c0: 72 65 74 75 72 6e 0a return.