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 3b 20 23 20 52 65 71 75 69 72 65 64 20 72 75 ; # Required ru
0310: 6e 74 69 6d 65 2e 0a 70 61 63 6b 61 67 65 20 72 ntime..package r
0320: 65 71 75 69 72 65 20 73 6e 69 74 20 20 20 20 20 equire snit
0330: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0340: 20 20 20 20 20 20 20 20 20 20 20 3b 20 23 20 4f ; # O
0350: 4f 20 73 79 73 74 65 6d 2e 0a 70 61 63 6b 61 67 O system..packag
0360: 65 20 72 65 71 75 69 72 65 20 76 63 3a 3a 74 6f e require vc::to
0370: 6f 6c 73 3a 3a 74 72 6f 75 62 6c 65 20 20 20 20 ols::trouble
0380: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 3b 20 ;
0390: 23 20 45 72 72 6f 72 20 72 65 70 6f 72 74 69 6e # Error reportin
03a0: 67 2e 0a 70 61 63 6b 61 67 65 20 72 65 71 75 69 g..package requi
03b0: 72 65 20 76 63 3a 3a 74 6f 6f 6c 73 3a 3a 6c 6f re vc::tools::lo
03c0: 67 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 g
03d0: 20 20 20 20 20 20 20 3b 20 23 20 55 73 65 72 20 ; # User
03e0: 66 65 65 64 62 61 63 6b 2e 0a 70 61 63 6b 61 67 feedback..packag
03f0: 65 20 72 65 71 75 69 72 65 20 76 63 3a 3a 66 6f e require vc::fo
0400: 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 ssil::import::cv
0410: 73 3a 3a 70 61 73 73 20 20 20 20 20 20 20 3b 20 s::pass ;
0420: 23 20 50 61 73 73 20 6d 61 6e 61 67 65 6d 65 6e # Pass managemen
0430: 74 2e 0a 70 61 63 6b 61 67 65 20 72 65 71 75 69 t..package requi
0440: 72 65 20 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 re vc::fossil::i
0450: 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 72 65 70 6f mport::cvs::repo
0460: 73 69 74 6f 72 79 20 3b 20 23 20 52 65 70 6f 73 sitory ; # Repos
0470: 69 74 6f 72 79 20 6d 61 6e 61 67 65 6d 65 6e 74 itory management
0480: 2e 0a 70 61 63 6b 61 67 65 20 72 65 71 75 69 72 ..package requir
0490: 65 20 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d e vc::fossil::im
04a0: 70 6f 72 74 3a 3a 63 76 73 3a 3a 73 74 61 74 65 port::cvs::state
04b0: 20 20 20 20 20 20 3b 20 23 20 53 74 61 74 65 20 ; # State
04c0: 73 74 6f 72 61 67 65 2e 0a 70 61 63 6b 61 67 65 storage..package
04d0: 20 72 65 71 75 69 72 65 20 76 63 3a 3a 72 63 73 require vc::rcs
04e0: 3a 3a 70 61 72 73 65 72 20 20 20 20 20 20 20 20 ::parser
04f0: 20 20 20 20 20 20 20 20 20 20 20 20 20 3b 20 23 ; #
0500: 20 52 63 73 20 61 72 63 68 69 76 65 20 64 61 74 Rcs archive dat
0510: 61 20 65 78 74 72 61 63 74 69 6f 6e 2e 0a 0a 23 a extraction...#
0520: 20 23 20 23 23 20 23 23 23 20 23 23 23 23 23 20 # ## ### #####
0530: 23 23 23 23 23 23 23 23 20 23 23 23 23 23 23 23 ######## #######
0540: 23 23 23 23 23 23 20 23 23 23 23 23 23 23 23 23 ###### #########
0550: 23 23 23 23 23 23 23 23 23 23 23 23 0a 23 23 20 ############.##
0560: 52 65 67 69 73 74 65 72 20 74 68 65 20 70 61 73 Register the pas
0570: 73 20 77 69 74 68 20 74 68 65 20 6d 61 6e 61 67 s with the manag
0580: 65 6d 65 6e 74 0a 0a 76 63 3a 3a 66 6f 73 73 69 ement..vc::fossi
0590: 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a l::import::cvs::
05a0: 70 61 73 73 20 64 65 66 69 6e 65 20 5c 0a 20 20 pass define \.
05b0: 20 20 43 6f 6c 6c 65 63 74 52 65 76 20 5c 0a 20 CollectRev \.
05c0: 20 20 20 7b 43 6f 6c 6c 65 63 74 20 72 65 76 69 {Collect revi
05d0: 73 69 6f 6e 73 20 61 6e 64 20 73 79 6d 62 6f 6c sions and symbol
05e0: 73 7d 20 5c 0a 20 20 20 20 3a 3a 76 63 3a 3a 66 s} \. ::vc::f
05f0: 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 ossil::import::c
0600: 76 73 3a 3a 70 61 73 73 3a 3a 63 6f 6c 6c 72 65 vs::pass::collre
0610: 76 0a 0a 23 20 23 20 23 23 20 23 23 23 20 23 23 v..# # ## ### ##
0620: 23 23 23 20 23 23 23 23 23 23 23 23 20 23 23 23 ### ######## ###
0630: 23 23 23 23 23 23 23 23 23 23 20 23 23 23 23 23 ########## #####
0640: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
0650: 0a 23 23 20 0a 0a 73 6e 69 74 3a 3a 74 79 70 65 .## ..snit::type
0660: 20 3a 3a 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 ::vc::fossil::i
0670: 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 70 61 73 73 mport::cvs::pass
0680: 3a 3a 63 6f 6c 6c 72 65 76 20 7b 0a 20 20 20 20 ::collrev {.
0690: 23 20 23 20 23 23 20 23 23 23 20 23 23 23 23 23 # # ## ### #####
06a0: 20 23 23 23 23 23 23 23 23 20 23 23 23 23 23 23 ######## ######
06b0: 23 23 23 23 23 23 23 0a 20 20 20 20 23 23 20 50 #######. ## P
06c0: 75 62 6c 69 63 20 41 50 49 0a 0a 20 20 20 20 74 ublic API.. t
06d0: 79 70 65 6d 65 74 68 6f 64 20 73 65 74 75 70 20 ypemethod setup
06e0: 7b 7d 20 7b 0a 09 23 20 44 65 66 69 6e 65 20 6e {} {..# Define n
06f0: 61 6d 65 73 20 61 6e 64 20 73 74 72 75 63 74 75 ames and structu
0700: 72 65 20 6f 66 20 74 68 65 20 70 65 72 73 69 73 re of the persis
0710: 74 65 6e 74 20 73 74 61 74 65 20 6f 66 20 74 68 tent state of th
0720: 69 73 0a 09 23 20 70 61 73 73 2e 0a 0a 09 73 74 is..# pass....st
0730: 61 74 65 20 72 65 61 64 69 6e 67 20 70 72 6f 6a ate reading proj
0740: 65 63 74 0a 09 73 74 61 74 65 20 72 65 61 64 69 ect..state readi
0750: 6e 67 20 66 69 6c 65 0a 0a 09 23 20 57 65 20 64 ng file...# We d
0760: 65 61 6c 20 77 69 74 68 20 70 65 72 20 70 72 6f eal with per pro
0770: 6a 65 63 74 20 61 6e 64 20 70 65 72 20 66 69 6c ject and per fil
0780: 65 20 64 61 74 61 2c 20 74 68 65 20 66 69 72 73 e data, the firs
0790: 74 0a 09 23 20 63 6f 6c 6c 61 74 65 64 20 66 72 t..# collated fr
07a0: 6f 6d 20 74 68 65 20 73 65 63 6f 6e 64 2e 0a 0a om the second...
07b0: 09 23 20 50 65 72 20 66 69 6c 65 20 77 65 20 68 .# Per file we h
07c0: 61 76 65 20 67 65 6e 65 72 61 6c 20 69 6e 66 6f ave general info
07d0: 72 6d 61 74 69 6f 6e 2c 20 2e 2e 2e 2c 20 61 6e rmation, ..., an
07e0: 64 20 74 68 65 6e 0a 09 23 20 72 65 76 69 73 69 d then..# revisi
07f0: 6f 6e 73 20 61 6e 64 20 73 79 6d 62 6f 6c 73 2e ons and symbols.
0800: 20 54 68 65 20 6c 61 74 74 65 72 20 63 61 6e 20 The latter can
0810: 62 65 20 66 75 72 74 68 65 72 20 73 65 70 61 72 be further separ
0820: 61 74 65 64 0a 09 23 20 69 6e 74 6f 20 74 61 67 ated..# into tag
0830: 73 20 61 6e 64 20 62 72 61 6e 63 68 65 73 2e 20 s and branches.
0840: 41 74 20 70 72 6f 6a 65 63 74 20 6c 65 76 65 6c At project level
0850: 20 74 68 65 20 70 65 72 2d 66 69 6c 65 0a 09 23 the per-file..#
0860: 20 73 79 6d 62 6f 6c 73 20 69 6e 66 6f 72 6d 61 symbols informa
0870: 74 69 6f 6e 20 69 73 20 6d 65 72 67 65 64 2e 0a tion is merged..
0880: 0a 09 23 20 46 69 6c 65 20 6c 65 76 65 6c 20 2e ..# File level .
0890: 2e 2e 0a 09 23 09 52 65 76 69 73 69 6f 6e 73 2c ....#.Revisions,
08a0: 20 42 72 61 6e 63 68 65 73 2c 20 54 61 67 73 0a Branches, Tags.
08b0: 09 23 0a 09 23 20 50 73 65 75 64 6f 20 63 6c 61 .#..# Pseudo cla
08c0: 73 73 20 68 69 65 72 61 72 63 68 79 0a 09 23 09 ss hierarchy..#.
08d0: 54 61 67 20 20 20 20 20 20 3c 2d 20 53 79 6d 62 Tag <- Symb
08e0: 6f 6c 20 3c 2d 20 45 76 65 6e 74 0a 09 23 09 42 ol <- Event..#.B
08f0: 72 61 6e 63 68 20 20 20 3c 2d 20 53 79 6d 62 6f ranch <- Symbo
0900: 6c 20 3c 2d 20 45 76 65 6e 74 0a 09 23 09 52 65 l <- Event..#.Re
0910: 76 69 73 69 6f 6e 20 20 20 20 20 20 20 20 20 20 vision
0920: 20 3c 2d 20 45 76 65 6e 74 0a 0a 09 73 74 61 74 <- Event...stat
0930: 65 20 77 72 69 74 69 6e 67 20 72 65 76 69 73 69 e writing revisi
0940: 6f 6e 20 7b 0a 09 20 20 20 20 2d 2d 20 52 65 76 on {.. -- Rev
0950: 69 73 69 6f 6e 73 2e 20 49 64 65 6e 74 69 66 69 isions. Identifi
0960: 65 64 20 62 79 20 61 20 67 6c 6f 62 61 6c 20 6e ed by a global n
0970: 75 6d 65 72 69 63 20 69 64 20 65 61 63 68 0a 09 umeric id each..
0980: 20 20 20 20 2d 2d 20 62 65 6c 6f 6e 67 73 20 74 -- belongs t
0990: 6f 20 61 20 73 69 6e 67 6c 65 20 66 69 6c 65 2c o a single file,
09a0: 20 69 64 65 6e 74 69 66 69 65 64 20 62 79 20 69 identified by i
09b0: 74 73 20 69 64 2e 20 49 74 0a 09 20 20 20 20 2d ts id. It.. -
09c0: 2d 20 66 75 72 74 68 65 72 20 68 61 73 20 61 20 - further has a
09d0: 64 6f 74 74 65 64 20 72 65 76 69 73 69 6f 6e 20 dotted revision
09e0: 6e 75 6d 62 65 72 20 28 44 54 4e 29 2e 0a 09 20 number (DTN)...
09f0: 20 20 20 2d 2d 0a 09 20 20 20 20 2d 2d 20 43 6f --.. -- Co
0a00: 6e 73 74 72 61 69 6e 74 3a 20 54 68 65 20 64 6f nstraint: The do
0a10: 74 74 65 64 20 72 65 76 69 73 69 6f 6e 20 6e 75 tted revision nu
0a20: 6d 62 65 72 20 69 73 20 75 6e 69 71 75 65 20 77 mber is unique w
0a30: 69 74 68 69 6e 0a 20 20 20 20 20 20 20 20 20 20 ithin.
0a40: 20 20 2d 2d 20 20 20 20 20 20 20 20 20 20 20 20 --
0a50: 20 74 68 65 20 66 69 6c 65 2e 20 53 65 65 20 65 the file. See e
0a60: 6e 64 20 6f 66 20 64 65 66 69 6e 69 74 69 6f 6e nd of definition
0a70: 2e 0a 0a 09 20 20 20 20 72 69 64 20 20 49 4e 54 .... rid INT
0a80: 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 EGER NOT NULL
0a90: 50 52 49 4d 41 52 59 20 4b 45 59 20 41 55 54 4f PRIMARY KEY AUTO
0aa0: 49 4e 43 52 45 4d 45 4e 54 2c 0a 09 20 20 20 20 INCREMENT,..
0ab0: 66 69 64 20 20 49 4e 54 45 47 45 52 20 20 4e 4f fid INTEGER NO
0ac0: 54 20 4e 55 4c 4c 20 20 52 45 46 45 52 45 4e 43 T NULL REFERENC
0ad0: 45 53 20 66 69 6c 65 2c 20 20 20 2d 2d 20 46 69 ES file, -- Fi
0ae0: 6c 65 20 6f 77 6e 69 6e 67 20 72 65 76 69 73 69 le owning revisi
0af0: 6f 6e 2e 0a 09 20 20 20 20 72 65 76 20 20 54 45 on... rev TE
0b00: 58 54 20 20 20 20 20 4e 4f 54 20 4e 55 4c 4c 2c XT NOT NULL,
0b10: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0b20: 20 20 20 20 2d 2d 20 44 6f 74 74 65 64 20 52 65 -- Dotted Re
0b30: 76 20 4e 75 6d 62 65 72 2e 0a 0a 09 20 20 20 20 v Number....
0b40: 2d 2d 20 41 6c 6c 20 72 65 76 69 73 69 6f 6e 73 -- All revisions
0b50: 20 62 65 6c 6f 6e 67 20 74 6f 20 61 20 6c 69 6e belong to a lin
0b60: 65 2d 6f 66 2d 64 65 76 65 6c 6f 70 6d 65 6e 74 e-of-development
0b70: 2c 0a 09 20 20 20 20 2d 2d 20 69 64 65 6e 74 69 ,.. -- identi
0b80: 66 69 65 64 20 62 79 20 61 20 73 79 6d 62 6f 6c fied by a symbol
0b90: 20 28 70 72 6f 6a 65 63 74 20 6c 65 76 65 6c 29 (project level)
0ba0: 2e 20 44 75 72 69 6e 67 20 64 61 74 61 0a 09 20 . During data..
0bb0: 20 20 20 2d 2d 20 63 6f 6c 6c 65 63 74 69 6f 6e -- collection
0bc0: 20 69 74 20 77 61 73 20 61 20 66 69 6c 65 2d 6c it was a file-l
0bd0: 65 76 65 6c 20 62 72 61 6e 63 68 20 73 79 6d 62 evel branch symb
0be0: 6f 6c 2e 0a 09 20 20 20 20 2d 2d 0a 09 20 20 20 ol... --..
0bf0: 20 2d 2d 20 43 6f 6e 73 74 72 61 69 6e 74 3a 20 -- Constraint:
0c00: 41 6c 6c 20 74 68 65 20 4c 4f 44 20 73 79 6d 62 All the LOD symb
0c10: 6f 6c 73 20 61 72 65 20 69 6e 20 74 68 65 20 73 ols are in the s
0c20: 61 6d 65 20 70 72 6f 6a 65 63 74 0a 09 20 20 20 ame project..
0c30: 20 2d 2d 20 20 20 20 20 20 20 20 20 20 20 20 20 --
0c40: 61 73 20 74 68 65 20 66 69 6c 65 20 69 74 73 65 as the file itse
0c50: 6c 66 2e 20 54 68 69 73 20 63 61 6e 6e 6f 74 20 lf. This cannot
0c60: 62 65 0a 09 20 20 20 20 2d 2d 20 20 20 20 20 20 be.. --
0c70: 20 20 20 20 20 20 20 65 78 70 72 65 73 73 65 64 expressed
0c80: 20 69 6e 20 43 52 45 41 54 45 20 54 41 42 4c 45 in CREATE TABLE
0c90: 20 73 79 6e 74 61 78 2e 0a 0a 09 20 20 20 20 6c syntax.... l
0ca0: 6f 64 20 20 49 4e 54 45 47 45 52 20 20 4e 4f 54 od INTEGER NOT
0cb0: 20 4e 55 4c 4c 20 20 52 45 46 45 52 45 4e 43 45 NULL REFERENCE
0cc0: 53 20 73 79 6d 62 6f 6c 2c 20 2d 2d 20 4c 69 6e S symbol, -- Lin
0cd0: 65 20 6f 66 20 64 65 76 65 6c 6f 70 6d 65 6e 74 e of development
0ce0: 0a 0a 09 20 20 20 20 2d 2d 20 54 68 65 20 72 65 ... -- The re
0cf0: 76 69 73 69 6f 6e 73 20 69 6e 20 61 20 66 69 6c visions in a fil
0d00: 65 20 61 72 65 20 6f 72 67 61 6e 69 7a 65 64 20 e are organized
0d10: 69 6e 20 61 20 66 6f 72 65 73 74 20 6f 66 0a 09 in a forest of..
0d20: 20 20 20 20 2d 2d 20 74 72 65 65 73 2c 20 77 69 -- trees, wi
0d30: 74 68 20 74 68 65 20 6d 61 69 6e 20 6c 69 6e 65 th the main line
0d40: 73 20 64 65 66 69 6e 65 64 20 74 68 72 6f 75 67 s defined throug
0d50: 68 20 74 68 65 20 70 61 72 65 6e 74 20 2f 0a 09 h the parent /..
0d60: 20 20 20 20 2d 2d 20 63 68 69 6c 64 20 72 65 66 -- child ref
0d70: 65 72 65 6e 63 65 73 2e 20 41 20 72 65 76 69 73 erences. A revis
0d80: 69 6f 6e 20 77 69 74 68 6f 75 74 20 61 20 70 61 ion without a pa
0d90: 72 65 6e 74 20 69 73 20 74 68 65 0a 09 20 20 20 rent is the..
0da0: 20 2d 2d 20 72 6f 6f 74 20 6f 66 20 61 20 74 72 -- root of a tr
0db0: 65 65 2c 20 61 6e 64 20 61 20 72 65 76 69 73 69 ee, and a revisi
0dc0: 6f 6e 20 77 69 74 68 6f 75 74 20 61 20 63 68 69 on without a chi
0dd0: 6c 64 20 69 73 20 61 0a 09 20 20 20 20 2d 2d 20 ld is a.. --
0de0: 6c 65 61 66 2e 0a 0a 09 20 20 20 20 2d 2d 20 43 leaf.... -- C
0df0: 6f 6e 73 74 72 61 69 6e 74 73 3a 20 41 6c 6c 20 onstraints: All
0e00: 72 65 76 69 73 69 6f 6e 73 20 63 6f 75 70 6c 65 revisions couple
0e10: 64 20 74 68 72 6f 75 67 68 20 70 61 72 65 6e 74 d through parent
0e20: 2f 63 68 69 6c 64 0a 09 20 20 20 20 2d 2d 20 20 /child.. --
0e30: 20 20 20 20 20 20 20 20 20 20 20 20 72 65 66 65 refe
0e40: 72 20 74 6f 20 74 68 65 20 73 61 6d 65 20 4c 4f r to the same LO
0e50: 44 20 73 79 6d 62 6f 6c 2e 20 54 68 65 20 70 61 D symbol. The pa
0e60: 72 65 6e 74 0a 09 20 20 20 20 2d 2d 20 20 20 20 rent.. --
0e70: 20 20 20 20 20 20 20 20 20 20 6f 66 20 61 20 63 of a c
0e80: 68 69 6c 64 20 6f 66 20 58 20 69 73 20 58 2e 20 hild of X is X.
0e90: 54 68 65 20 63 68 69 6c 64 20 6f 66 20 61 0a 09 The child of a..
0ea0: 20 20 20 20 2d 2d 20 20 20 20 20 20 20 20 20 20 --
0eb0: 20 20 20 20 70 61 72 65 6e 74 20 6f 66 20 58 20 parent of X
0ec0: 69 73 20 58 2e 0a 0a 09 20 20 20 20 70 61 72 65 is X.... pare
0ed0: 6e 74 20 20 49 4e 54 45 47 45 52 20 20 20 20 20 nt INTEGER
0ee0: 20 20 20 20 20 20 20 52 45 46 45 52 45 4e 43 45 REFERENCE
0ef0: 53 20 72 65 76 69 73 69 6f 6e 2c 0a 09 20 20 20 S revision,..
0f00: 20 63 68 69 6c 64 20 20 20 49 4e 54 45 47 45 52 child INTEGER
0f10: 20 20 20 20 20 20 20 20 20 20 20 20 52 45 46 45 REFE
0f20: 52 45 4e 43 45 53 20 72 65 76 69 73 69 6f 6e 2c RENCES revision,
0f30: 0a 0a 09 20 20 20 20 2d 2d 20 54 68 65 20 72 65 ... -- The re
0f40: 70 72 65 73 65 6e 74 61 74 69 6f 6e 20 6f 66 20 presentation of
0f50: 61 20 62 72 61 6e 63 68 20 69 6e 20 61 20 74 72 a branch in a tr
0f60: 65 65 20 69 73 20 74 68 65 0a 09 20 20 20 20 2d ee is the.. -
0f70: 2d 20 65 78 63 65 70 74 69 6f 6e 20 74 6f 20 74 - exception to t
0f80: 68 65 20 74 68 72 65 65 20 63 6f 6e 73 74 72 61 he three constra
0f90: 69 6e 74 73 20 61 62 6f 76 65 2e 0a 0a 09 20 20 ints above....
0fa0: 20 20 2d 2d 20 54 68 65 20 62 65 67 69 6e 6e 69 -- The beginni
0fb0: 6e 67 20 6f 66 20 61 20 62 72 61 6e 63 68 20 69 ng of a branch i
0fc0: 73 20 72 65 70 72 65 73 65 6e 74 65 64 20 62 79 s represented by
0fd0: 20 61 20 6e 6f 6e 2d 4e 55 4c 4c 0a 09 20 20 20 a non-NULL..
0fe0: 20 2d 2d 20 62 70 61 72 65 6e 74 20 6f 66 20 61 -- bparent of a
0ff0: 20 72 65 76 69 73 69 6f 6e 2e 20 54 68 69 73 20 revision. This
1000: 72 65 76 69 73 69 6f 6e 20 42 20 69 73 20 74 68 revision B is th
1010: 65 20 66 69 72 73 74 20 6f 6e 0a 09 20 20 20 20 e first on..
1020: 2d 2d 20 74 68 65 20 62 72 61 6e 63 68 2e 20 49 -- the branch. I
1030: 74 73 20 70 61 72 65 6e 74 20 50 20 69 73 20 74 ts parent P is t
1040: 68 65 20 72 65 76 69 73 69 6f 6e 20 74 68 65 20 he revision the
1050: 62 72 61 6e 63 68 20 69 73 0a 09 20 20 20 20 2d branch is.. -
1060: 2d 20 72 6f 6f 74 65 64 20 69 6e 2c 20 61 6e 64 - rooted in, and
1070: 20 69 74 20 69 73 20 6e 6f 74 20 74 68 65 20 63 it is not the c
1080: 68 69 6c 64 20 6f 66 20 50 2e 20 42 20 61 6e 64 hild of P. B and
1090: 20 50 20 72 65 66 65 72 0a 09 20 20 20 20 2d 2d P refer.. --
10a0: 20 74 6f 20 64 69 66 66 65 72 65 6e 74 20 4c 4f to different LO
10b0: 44 20 73 79 6d 62 6f 6c 73 2e 20 54 68 65 20 62 D symbols. The b
10c0: 70 61 72 65 6e 74 20 6f 66 20 42 20 69 73 20 61 parent of B is a
10d0: 6c 73 6f 20 69 74 73 0a 09 20 20 20 20 2d 2d 20 lso its.. --
10e0: 4c 4f 44 2c 20 61 6e 64 20 74 68 65 20 4c 4f 44 LOD, and the LOD
10f0: 20 6f 66 20 69 74 73 20 63 68 69 6c 64 72 65 6e of its children
1100: 2e 0a 0a 09 20 20 20 20 62 70 61 72 65 6e 74 20 .... bparent
1110: 49 4e 54 45 47 45 52 20 20 20 20 20 20 20 20 20 INTEGER
1120: 20 20 20 52 45 46 45 52 45 4e 43 45 53 20 73 79 REFERENCES sy
1130: 6d 62 6f 6c 2c 0a 0a 09 20 20 20 20 2d 2d 20 4c mbol,... -- L
1140: 61 73 74 6c 79 20 77 65 20 6b 65 65 70 20 69 6e astly we keep in
1150: 66 6f 72 6d 61 74 69 6f 6e 20 69 73 20 61 62 6f formation is abo
1160: 75 74 20 6e 6f 6e 2d 74 72 75 6e 6b 20 64 65 66 ut non-trunk def
1170: 61 75 6c 74 0a 09 20 20 20 20 2d 2d 20 62 72 61 ault.. -- bra
1180: 6e 63 68 65 73 20 28 4e 54 44 42 29 20 69 6e 20 nches (NTDB) in
1190: 74 68 65 20 72 65 76 69 73 69 6f 6e 73 2e 0a 0a the revisions...
11a0: 09 20 20 20 20 2d 2d 20 41 6c 6c 20 72 65 76 69 . -- All revi
11b0: 73 69 6f 6e 73 20 6f 6e 20 74 68 65 20 4e 54 44 sions on the NTD
11c0: 42 20 68 61 76 65 20 27 69 73 64 65 66 61 75 6c B have 'isdefaul
11d0: 74 27 20 54 52 55 45 2c 0a 09 20 20 20 20 2d 2d t' TRUE,.. --
11e0: 20 65 76 65 72 79 6f 6e 65 20 65 6c 73 65 20 46 everyone else F
11f0: 41 4c 53 45 2e 20 54 68 65 20 6c 61 73 74 20 72 ALSE. The last r
1200: 65 76 69 73 69 6f 6e 20 58 20 6f 6e 20 74 68 65 evision X on the
1210: 20 4e 54 44 42 0a 09 20 20 20 20 2d 2d 20 77 68 NTDB.. -- wh
1220: 69 63 68 20 69 73 20 73 74 69 6c 6c 20 63 6f 6e ich is still con
1230: 73 69 64 65 72 65 64 20 74 6f 20 62 65 20 6f 6e sidered to be on
1240: 20 74 68 65 20 74 72 75 6e 6b 20 61 73 20 77 65 the trunk as we
1250: 6c 6c 0a 09 20 20 20 20 2d 2d 20 68 61 73 20 61 ll.. -- has a
1260: 20 6e 6f 6e 2d 4e 55 4c 4c 20 27 64 62 63 68 69 non-NULL 'dbchi
1270: 6c 64 27 20 77 68 69 63 68 20 72 65 66 65 72 73 ld' which refers
1280: 20 74 6f 20 74 68 65 20 72 6f 6f 74 20 6f 66 0a to the root of.
1290: 09 20 20 20 20 2d 2d 20 74 68 65 20 74 72 75 6e . -- the trun
12a0: 6b 2e 20 54 68 65 20 72 6f 6f 74 20 61 6c 73 6f k. The root also
12b0: 20 68 61 73 20 61 20 6e 6f 6e 2d 4e 55 4c 4c 20 has a non-NULL
12c0: 64 62 70 61 72 65 6e 74 0a 09 20 20 20 20 2d 2d dbparent.. --
12d0: 20 72 65 66 65 72 69 6e 67 20 74 6f 20 58 2e 0a refering to X..
12e0: 0a 09 20 20 20 20 69 73 64 65 66 61 75 6c 74 20 .. isdefault
12f0: 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c INTEGER NOT NUL
1300: 4c 2c 0a 09 20 20 20 20 64 62 70 61 72 65 6e 74 L,.. dbparent
1310: 20 20 49 4e 54 45 47 45 52 20 20 20 20 20 20 20 INTEGER
1320: 20 20 20 20 20 52 45 46 45 52 45 4e 43 45 53 20 REFERENCES
1330: 72 65 76 69 73 69 6f 6e 2c 0a 09 20 20 20 20 64 revision,.. d
1340: 62 63 68 69 6c 64 20 20 20 49 4e 54 45 47 45 52 bchild INTEGER
1350: 20 20 20 20 20 20 20 20 20 20 20 20 52 45 46 45 REFE
1360: 52 45 4e 43 45 53 20 72 65 76 69 73 69 6f 6e 2c RENCES revision,
1370: 0a 0a 09 20 20 20 20 2d 2d 20 54 68 65 20 6d 61 ... -- The ma
1380: 69 6e 20 70 61 79 6c 6f 61 64 20 6f 66 20 74 68 in payload of th
1390: 65 20 72 65 76 69 73 69 6f 6e 20 61 72 65 20 74 e revision are t
13a0: 68 65 20 64 61 74 65 2f 74 69 6d 65 20 69 74 0a he date/time it.
13b0: 09 20 20 20 20 2d 2d 20 77 61 73 20 65 6e 74 65 . -- was ente
13c0: 72 65 64 2c 20 69 74 73 20 73 74 61 74 65 2c 20 red, its state,
13d0: 6f 70 65 72 61 74 69 6f 6e 20 28 3d 20 74 79 70 operation (= typ
13e0: 65 2f 63 6c 61 73 73 29 2c 20 74 65 78 74 0a 09 e/class), text..
13f0: 20 20 20 20 2d 2d 20 63 6f 6e 74 65 6e 74 2c 20 -- content,
1400: 61 6e 64 20 6d 65 74 61 20 64 61 74 61 20 28 61 and meta data (a
1410: 75 74 68 6f 72 2c 20 6c 6f 67 20 6d 65 73 73 61 uthor, log messa
1420: 67 65 2c 20 62 72 61 6e 63 68 2c 0a 09 20 20 20 ge, branch,..
1430: 20 2d 2d 20 70 72 6f 6a 65 63 74 29 2e 20 54 68 -- project). Th
1440: 65 20 6c 61 73 74 20 69 73 20 65 6e 63 6f 64 65 e last is encode
1450: 64 20 61 73 20 73 69 6e 67 6c 65 20 69 64 2c 20 d as single id,
1460: 73 65 65 20 74 61 62 6c 65 0a 09 20 20 20 20 2d see table.. -
1470: 2d 20 27 6d 65 74 61 27 2e 20 54 68 65 20 64 61 - 'meta'. The da
1480: 74 65 2f 74 69 6d 65 20 69 73 20 67 69 76 65 6e te/time is given
1490: 20 69 6e 20 73 65 63 6f 6e 64 73 20 73 69 6e 63 in seconds sinc
14a0: 65 20 74 68 65 0a 09 20 20 20 20 2d 2d 20 65 70 e the.. -- ep
14b0: 6f 63 68 2c 20 66 6f 72 20 65 61 73 79 20 63 6f och, for easy co
14c0: 6d 70 61 72 69 73 6f 6e 2e 20 54 68 65 20 74 65 mparison. The te
14d0: 78 74 20 63 6f 6e 74 65 6e 74 20 69 73 20 61 6e xt content is an
14e0: 0a 09 20 20 20 20 2d 2d 20 28 6f 66 66 73 65 74 .. -- (offset
14f0: 2c 6c 65 6e 67 74 68 29 20 70 61 69 72 20 69 6e ,length) pair in
1500: 74 6f 20 74 68 65 20 72 63 73 20 61 72 63 68 69 to the rcs archi
1510: 76 65 2e 0a 0a 09 20 20 20 20 6f 70 20 20 20 20 ve.... op
1520: 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c INTEGER NOT NUL
1530: 4c 2c 0a 09 20 20 20 20 64 61 74 65 20 20 49 4e L,.. date IN
1540: 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 2c TEGER NOT NULL,
1550: 0a 09 20 20 20 20 73 74 61 74 65 20 54 45 58 54 .. state TEXT
1560: 20 20 20 20 20 4e 4f 54 20 4e 55 4c 4c 2c 0a 09 NOT NULL,..
1570: 20 20 20 20 6d 69 64 20 20 20 49 4e 54 45 47 45 mid INTEGE
1580: 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 52 45 46 45 R NOT NULL REFE
1590: 52 45 4e 43 45 53 20 6d 65 74 61 2c 0a 09 20 20 RENCES meta,..
15a0: 20 20 63 6f 66 66 20 20 49 4e 54 45 47 45 52 20 coff INTEGER
15b0: 20 4e 4f 54 20 4e 55 4c 4c 2c 0a 09 20 20 20 20 NOT NULL,..
15c0: 63 6c 65 6e 20 20 49 4e 54 45 47 45 52 20 20 4e clen INTEGER N
15d0: 4f 54 20 4e 55 4c 4c 2c 0a 0a 09 20 20 20 20 55 OT NULL,... U
15e0: 4e 49 51 55 45 20 28 66 69 64 2c 20 72 65 76 29 NIQUE (fid, rev)
15f0: 20 2d 2d 20 54 68 65 20 44 54 4e 20 69 73 20 75 -- The DTN is u
1600: 6e 69 71 75 65 20 77 69 74 68 69 6e 20 74 68 65 nique within the
1610: 20 72 65 76 69 73 69 6f 6e 27 73 20 66 69 6c 65 revision's file
1620: 2e 0a 09 7d 0a 0a 09 73 74 61 74 65 20 77 72 69 ...}...state wri
1630: 74 69 6e 67 20 74 61 67 20 7b 0a 09 20 20 20 20 ting tag {..
1640: 74 69 64 20 20 49 4e 54 45 47 45 52 20 20 4e 4f tid INTEGER NO
1650: 54 20 4e 55 4c 4c 20 20 50 52 49 4d 41 52 59 20 T NULL PRIMARY
1660: 4b 45 59 20 41 55 54 4f 49 4e 43 52 45 4d 45 4e KEY AUTOINCREMEN
1670: 54 2c 0a 09 20 20 20 20 66 69 64 20 20 49 4e 54 T,.. fid INT
1680: 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 EGER NOT NULL
1690: 52 45 46 45 52 45 4e 43 45 53 20 66 69 6c 65 2c REFERENCES file,
16a0: 20 20 20 20 20 2d 2d 20 46 69 6c 65 20 74 68 65 -- File the
16b0: 20 69 74 65 6d 20 62 65 6c 6f 6e 67 73 20 74 6f item belongs to
16c0: 0a 09 20 20 20 20 6c 6f 64 20 20 49 4e 54 45 47 .. lod INTEG
16d0: 45 52 20 20 20 20 20 20 20 20 20 20 20 20 52 45 ER RE
16e0: 46 45 52 45 4e 43 45 53 20 73 79 6d 62 6f 6c 2c FERENCES symbol,
16f0: 20 20 20 2d 2d 20 4c 69 6e 65 20 6f 66 20 64 65 -- Line of de
1700: 76 65 6c 6f 70 6d 65 6e 74 20 28 4e 55 4c 4c 20 velopment (NULL
1710: 3d 3e 20 54 72 75 6e 6b 29 0a 0a 09 20 20 20 20 => Trunk)...
1720: 73 69 64 20 20 49 4e 54 45 47 45 52 20 20 4e 4f sid INTEGER NO
1730: 54 20 4e 55 4c 4c 20 20 52 45 46 45 52 45 4e 43 T NULL REFERENC
1740: 45 53 20 73 79 6d 62 6f 6c 2c 20 20 20 2d 2d 20 ES symbol, --
1750: 53 79 6d 62 6f 6c 20 63 61 70 74 75 72 69 6e 67 Symbol capturing
1760: 20 74 68 65 20 74 61 67 0a 0a 09 20 20 20 20 72 the tag... r
1770: 65 76 20 20 49 4e 54 45 47 45 52 20 20 4e 4f 54 ev INTEGER NOT
1780: 20 4e 55 4c 4c 20 20 52 45 46 45 52 45 4e 43 45 NULL REFERENCE
1790: 53 20 72 65 76 69 73 69 6f 6e 20 20 2d 2d 20 54 S revision -- T
17a0: 68 65 20 72 65 76 69 73 69 6f 6e 20 62 65 69 6e he revision bein
17b0: 67 20 74 61 67 67 65 64 2e 0a 09 7d 0a 0a 09 73 g tagged...}...s
17c0: 74 61 74 65 20 77 72 69 74 69 6e 67 20 62 72 61 tate writing bra
17d0: 6e 63 68 20 7b 0a 09 20 20 20 20 62 69 64 20 20 nch {.. bid
17e0: 20 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 INTEGER NOT NU
17f0: 4c 4c 20 20 50 52 49 4d 41 52 59 20 4b 45 59 20 LL PRIMARY KEY
1800: 41 55 54 4f 49 4e 43 52 45 4d 45 4e 54 2c 0a 09 AUTOINCREMENT,..
1810: 20 20 20 20 66 69 64 20 20 20 49 4e 54 45 47 45 fid INTEGE
1820: 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 52 45 46 R NOT NULL REF
1830: 45 52 45 4e 43 45 53 20 66 69 6c 65 2c 20 20 20 ERENCES file,
1840: 20 20 2d 2d 20 46 69 6c 65 20 74 68 65 20 69 74 -- File the it
1850: 65 6d 20 62 65 6c 6f 6e 67 73 20 74 6f 0a 09 20 em belongs to..
1860: 20 20 20 6c 6f 64 20 20 20 49 4e 54 45 47 45 52 lod INTEGER
1870: 20 20 20 20 20 20 20 20 20 20 20 20 52 45 46 45 REFE
1880: 52 45 4e 43 45 53 20 73 79 6d 62 6f 6c 2c 20 20 RENCES symbol,
1890: 20 2d 2d 20 4c 69 6e 65 20 6f 66 20 64 65 76 65 -- Line of deve
18a0: 6c 6f 70 6d 65 6e 74 20 28 4e 55 4c 4c 20 3d 3e lopment (NULL =>
18b0: 20 54 72 75 6e 6b 29 0a 0a 09 20 20 20 20 73 69 Trunk)... si
18c0: 64 20 20 20 49 4e 54 45 47 45 52 20 20 4e 4f 54 d INTEGER NOT
18d0: 20 4e 55 4c 4c 20 20 52 45 46 45 52 45 4e 43 45 NULL REFERENCE
18e0: 53 20 73 79 6d 62 6f 6c 2c 20 20 20 2d 2d 20 53 S symbol, -- S
18f0: 79 6d 62 6f 6c 20 63 61 70 74 75 72 69 6e 67 20 ymbol capturing
1900: 74 68 65 20 62 72 61 6e 63 68 0a 0a 09 20 20 20 the branch...
1910: 20 72 6f 6f 74 20 20 49 4e 54 45 47 45 52 20 20 root INTEGER
1920: 4e 4f 54 20 4e 55 4c 4c 20 20 52 45 46 45 52 45 NOT NULL REFERE
1930: 4e 43 45 53 20 72 65 76 69 73 69 6f 6e 2c 20 2d NCES revision, -
1940: 2d 20 52 65 76 69 73 69 6f 6e 20 74 68 65 20 62 - Revision the b
1950: 72 61 6e 63 68 20 73 70 72 6f 75 74 73 20 66 72 ranch sprouts fr
1960: 6f 6d 0a 09 20 20 20 20 66 69 72 73 74 20 49 4e om.. first IN
1970: 54 45 47 45 52 20 20 20 20 20 20 20 20 20 20 20 TEGER
1980: 20 52 45 46 45 52 45 4e 43 45 53 20 72 65 76 69 REFERENCES revi
1990: 73 69 6f 6e 2c 20 2d 2d 20 46 69 72 73 74 20 72 sion, -- First r
19a0: 65 76 69 73 69 6f 6e 20 63 6f 6d 6d 69 74 74 65 evision committe
19b0: 64 20 74 6f 20 74 68 65 20 62 72 61 6e 63 68 0a d to the branch.
19c0: 09 20 20 20 20 62 72 61 20 20 20 54 45 58 54 20 . bra TEXT
19d0: 20 20 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 20 20 NOT NULL
19e0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
19f0: 20 20 20 2d 2d 20 62 72 61 6e 63 68 20 6e 75 6d -- branch num
1a00: 62 65 72 0a 09 7d 0a 0a 09 23 20 50 72 6f 6a 65 ber..}...# Proje
1a10: 63 74 20 6c 65 76 65 6c 20 2e 2e 2e 0a 09 23 09 ct level .....#.
1a20: 70 4c 69 6e 65 4f 66 44 65 76 65 6c 6f 70 6d 65 pLineOfDevelopme
1a30: 6e 74 2c 20 70 53 79 6d 62 6f 6c 2c 20 70 42 72 nt, pSymbol, pBr
1a40: 61 6e 63 68 2c 20 70 54 61 67 2c 20 70 54 72 75 anch, pTag, pTru
1a50: 6e 6b 0a 09 23 0a 09 23 09 70 54 72 75 6e 6b 20 nk..#..#.pTrunk
1a60: 20 3c 2d 20 70 4c 69 6e 65 4f 66 44 65 76 65 6c <- pLineOfDevel
1a70: 6f 70 6d 65 6e 74 0a 09 23 09 70 42 72 61 6e 63 opment..#.pBranc
1a80: 68 20 3c 2d 20 70 53 79 6d 62 6f 6c 2c 20 70 4c h <- pSymbol, pL
1a90: 69 6e 65 4f 66 44 65 76 65 6c 6f 70 6d 65 6e 74 ineOfDevelopment
1aa0: 0a 09 23 09 70 54 61 67 20 20 20 20 3c 2d 20 70 ..#.pTag <- p
1ab0: 53 79 6d 62 6f 6c 2c 20 70 4c 69 6e 65 4f 66 44 Symbol, pLineOfD
1ac0: 65 76 65 6c 6f 70 6d 65 6e 74 0a 0a 09 73 74 61 evelopment...sta
1ad0: 74 65 20 77 72 69 74 69 6e 67 20 73 79 6d 62 6f te writing symbo
1ae0: 6c 20 7b 0a 09 20 20 20 20 73 69 64 20 20 49 4e l {.. sid IN
1af0: 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 TEGER NOT NULL
1b00: 20 50 52 49 4d 41 52 59 20 4b 45 59 20 41 55 54 PRIMARY KEY AUT
1b10: 4f 49 4e 43 52 45 4d 45 4e 54 2c 0a 09 20 20 20 OINCREMENT,..
1b20: 20 70 69 64 20 20 49 4e 54 45 47 45 52 20 20 4e pid INTEGER N
1b30: 4f 54 20 4e 55 4c 4c 20 20 52 45 46 45 52 45 4e OT NULL REFEREN
1b40: 43 45 53 20 70 72 6f 6a 65 63 74 2c 20 20 2d 2d CES project, --
1b50: 20 50 72 6f 6a 65 63 74 20 74 68 65 20 73 79 6d Project the sym
1b60: 62 6f 6c 20 62 65 6c 6f 6e 67 73 20 74 6f 0a 09 bol belongs to..
1b70: 20 20 20 20 6e 61 6d 65 20 54 45 58 54 20 20 20 name TEXT
1b80: 20 20 4e 4f 54 20 4e 55 4c 4c 2c 0a 09 20 20 20 NOT NULL,..
1b90: 20 74 79 70 65 20 49 4e 54 45 47 45 52 20 20 4e type INTEGER N
1ba0: 4f 54 20 4e 55 4c 4c 20 20 52 45 46 45 52 45 4e OT NULL REFEREN
1bb0: 43 45 53 20 73 79 6d 74 79 70 65 2c 20 20 2d 2d CES symtype, --
1bc0: 20 65 6e 75 6d 20 7b 20 65 78 63 6c 75 64 65 64 enum { excluded
1bd0: 20 3d 20 30 2c 20 74 61 67 2c 20 62 72 61 6e 63 = 0, tag, branc
1be0: 68 2c 20 75 6e 64 65 66 69 6e 65 64 20 7d 0a 0a h, undefined }..
1bf0: 09 20 20 20 20 74 61 67 5f 63 6f 75 6e 74 20 20 . tag_count
1c00: 20 20 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e INTEGER NOT N
1c10: 55 4c 4c 2c 20 2d 2d 20 48 6f 77 20 6f 66 74 65 ULL, -- How ofte
1c20: 6e 20 74 68 65 20 73 79 6d 62 6f 6c 20 69 73 20 n the symbol is
1c30: 75 73 65 64 20 61 73 20 74 61 67 2e 0a 09 20 20 used as tag...
1c40: 20 20 62 72 61 6e 63 68 5f 63 6f 75 6e 74 20 49 branch_count I
1c50: 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c NTEGER NOT NULL
1c60: 2c 20 2d 2d 20 48 6f 77 20 6f 66 74 65 6e 20 74 , -- How often t
1c70: 68 65 20 73 79 6d 62 6f 6c 20 69 73 20 75 73 65 he symbol is use
1c80: 64 20 61 73 20 62 72 61 6e 63 68 0a 09 20 20 20 d as branch..
1c90: 20 63 6f 6d 6d 69 74 5f 63 6f 75 6e 74 20 49 4e commit_count IN
1ca0: 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 2c TEGER NOT NULL,
1cb0: 20 2d 2d 20 48 6f 77 20 6f 66 74 65 6e 20 61 20 -- How often a
1cc0: 66 69 6c 65 20 77 61 73 20 63 6f 6d 6d 69 74 74 file was committ
1cd0: 65 64 20 6f 6e 20 74 68 65 20 73 79 6d 62 6f 6c ed on the symbol
1ce0: 0a 0a 09 20 20 20 20 55 4e 49 51 55 45 20 28 70 ... UNIQUE (p
1cf0: 69 64 2c 20 6e 61 6d 65 29 20 2d 2d 20 53 79 6d id, name) -- Sym
1d00: 62 6f 6c 73 20 61 72 65 20 75 6e 69 71 75 65 20 bols are unique
1d10: 77 69 74 68 69 6e 20 74 68 65 20 70 72 6f 6a 65 within the proje
1d20: 63 74 0a 09 7d 0a 0a 09 73 74 61 74 65 20 77 72 ct..}...state wr
1d30: 69 74 69 6e 67 20 62 6c 6f 63 6b 65 72 20 7b 0a iting blocker {.
1d40: 09 20 20 20 20 2d 2d 20 46 6f 72 20 65 61 63 68 . -- For each
1d50: 20 73 79 6d 62 6f 6c 20 77 65 20 73 61 76 65 20 symbol we save
1d60: 77 68 69 63 68 20 6f 74 68 65 72 20 73 79 6d 62 which other symb
1d70: 6f 6c 73 20 61 72 65 0a 09 20 20 20 20 2d 2d 20 ols are.. --
1d80: 62 6c 6f 63 6b 69 6e 67 20 69 74 73 20 72 65 6d blocking its rem
1d90: 6f 76 61 6c 20 28 69 66 20 74 68 65 20 75 73 65 oval (if the use
1da0: 72 20 61 73 6b 73 20 66 6f 72 20 69 74 29 2e 0a r asks for it)..
1db0: 0a 09 20 20 20 20 73 69 64 20 49 4e 54 45 47 45 .. sid INTEGE
1dc0: 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 52 45 46 R NOT NULL REF
1dd0: 45 52 45 4e 43 45 53 20 73 79 6d 62 6f 6c 2c 20 ERENCES symbol,
1de0: 2d 2d 20 0a 09 20 20 20 20 62 69 64 20 49 4e 54 -- .. bid INT
1df0: 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 EGER NOT NULL
1e00: 52 45 46 45 52 45 4e 43 45 53 20 73 79 6d 62 6f REFERENCES symbo
1e10: 6c 2c 20 2d 2d 20 53 70 72 6f 75 74 65 64 20 66 l, -- Sprouted f
1e20: 72 6f 6d 20 73 69 64 2c 20 62 6c 6f 63 6b 73 20 rom sid, blocks
1e30: 69 74 2e 0a 09 20 20 20 20 55 4e 49 51 55 45 20 it... UNIQUE
1e40: 28 73 69 64 2c 20 62 69 64 29 0a 09 7d 0a 0a 09 (sid, bid)..}...
1e50: 73 74 61 74 65 20 77 72 69 74 69 6e 67 20 70 61 state writing pa
1e60: 72 65 6e 74 20 7b 0a 09 20 20 20 20 2d 2d 20 46 rent {.. -- F
1e70: 6f 72 20 65 61 63 68 20 73 79 6d 62 6f 6c 20 77 or each symbol w
1e80: 65 20 73 61 76 65 20 77 68 69 63 68 20 6f 74 68 e save which oth
1e90: 65 72 20 73 79 6d 62 6f 6c 73 20 63 61 6e 20 61 er symbols can a
1ea0: 63 74 20 61 73 0a 09 20 20 20 20 2d 2d 20 61 20 ct as.. -- a
1eb0: 70 6f 73 73 69 62 6c 65 20 70 61 72 65 6e 74 20 possible parent
1ec0: 69 6e 20 73 6f 6d 65 20 66 69 6c 65 2c 20 61 6e in some file, an
1ed0: 64 20 68 6f 77 20 6f 66 74 65 6e 2e 0a 0a 09 20 d how often....
1ee0: 20 20 20 73 69 64 20 49 4e 54 45 47 45 52 20 20 sid INTEGER
1ef0: 4e 4f 54 20 4e 55 4c 4c 20 20 52 45 46 45 52 45 NOT NULL REFERE
1f00: 4e 43 45 53 20 73 79 6d 62 6f 6c 2c 20 2d 2d 20 NCES symbol, --
1f10: 0a 09 20 20 20 20 70 69 64 20 49 4e 54 45 47 45 .. pid INTEGE
1f20: 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 52 45 46 R NOT NULL REF
1f30: 45 52 45 4e 43 45 53 20 73 79 6d 62 6f 6c 2c 20 ERENCES symbol,
1f40: 2d 2d 20 50 6f 73 73 69 62 6c 65 20 70 61 72 65 -- Possible pare
1f50: 6e 74 20 6f 66 20 73 69 64 0a 09 20 20 20 20 6e nt of sid.. n
1f60: 20 20 20 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 INTEGER NOT
1f70: 4e 55 4c 4c 2c 20 20 20 20 20 20 20 20 20 20 20 NULL,
1f80: 20 20 20 20 20 20 20 20 20 2d 2d 20 48 6f 77 20 -- How
1f90: 6f 66 74 65 6e 20 70 69 64 20 63 61 6e 20 61 63 often pid can ac
1fa0: 74 20 61 73 20 70 61 72 65 6e 74 2e 0a 09 20 20 t as parent...
1fb0: 20 20 55 4e 49 51 55 45 20 28 73 69 64 2c 20 70 UNIQUE (sid, p
1fc0: 69 64 29 0a 09 7d 0a 0a 09 73 74 61 74 65 20 77 id)..}...state w
1fd0: 72 69 74 69 6e 67 20 73 79 6d 74 79 70 65 20 7b riting symtype {
1fe0: 0a 09 20 20 20 20 74 69 64 20 20 20 49 4e 54 45 .. tid INTE
1ff0: 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 50 GER NOT NULL P
2000: 52 49 4d 41 52 59 20 4b 45 59 2c 0a 09 20 20 20 RIMARY KEY,..
2010: 20 6e 61 6d 65 20 20 54 45 58 54 20 20 20 20 20 name TEXT
2020: 4e 4f 54 20 4e 55 4c 4c 2c 0a 09 20 20 20 20 55 NOT NULL,.. U
2030: 4e 49 51 55 45 20 28 6e 61 6d 65 29 0a 09 7d 0a NIQUE (name)..}.
2040: 09 73 74 61 74 65 20 72 75 6e 20 7b 0a 09 20 20 .state run {..
2050: 20 20 49 4e 53 45 52 54 20 49 4e 54 4f 20 73 79 INSERT INTO sy
2060: 6d 74 79 70 65 20 56 41 4c 55 45 53 20 28 30 2c mtype VALUES (0,
2070: 27 65 78 63 6c 75 64 65 64 27 29 3b 0a 09 20 20 'excluded');..
2080: 20 20 49 4e 53 45 52 54 20 49 4e 54 4f 20 73 79 INSERT INTO sy
2090: 6d 74 79 70 65 20 56 41 4c 55 45 53 20 28 31 2c mtype VALUES (1,
20a0: 27 74 61 67 27 29 3b 0a 09 20 20 20 20 49 4e 53 'tag');.. INS
20b0: 45 52 54 20 49 4e 54 4f 20 73 79 6d 74 79 70 65 ERT INTO symtype
20c0: 20 56 41 4c 55 45 53 20 28 32 2c 27 62 72 61 6e VALUES (2,'bran
20d0: 63 68 27 29 3b 0a 09 20 20 20 20 49 4e 53 45 52 ch');.. INSER
20e0: 54 20 49 4e 54 4f 20 73 79 6d 74 79 70 65 20 56 T INTO symtype V
20f0: 41 4c 55 45 53 20 28 33 2c 27 75 6e 64 65 66 69 ALUES (3,'undefi
2100: 6e 65 64 27 29 3b 0a 09 7d 0a 0a 09 73 74 61 74 ned');..}...stat
2110: 65 20 77 72 69 74 69 6e 67 20 6d 65 74 61 20 7b e writing meta {
2120: 0a 09 20 20 20 20 2d 2d 20 4d 65 74 61 20 64 61 .. -- Meta da
2130: 74 61 20 6f 66 20 72 65 76 69 73 69 6f 6e 73 2e ta of revisions.
2140: 20 53 65 65 20 72 65 76 69 73 69 6f 6e 2e 6d 69 See revision.mi
2150: 64 20 66 6f 72 20 74 68 65 0a 09 20 20 20 20 2d d for the.. -
2160: 2d 20 72 65 66 65 72 65 6e 63 65 2e 20 4d 61 6e - reference. Man
2170: 79 20 72 65 76 69 73 69 6f 6e 73 20 63 61 6e 20 y revisions can
2180: 73 68 61 72 65 20 6d 65 74 61 20 64 61 74 61 2e share meta data.
2190: 20 54 68 69 73 20 69 73 0a 09 20 20 20 20 2d 2d This is.. --
21a0: 20 61 63 74 75 61 6c 6c 79 20 6f 6e 65 20 6f 66 actually one of
21b0: 20 74 68 65 20 63 72 69 74 65 72 69 6f 6e 73 20 the criterions
21c0: 75 73 65 64 20 74 6f 20 73 6f 72 74 20 72 65 76 used to sort rev
21d0: 69 73 69 6f 6e 73 0a 09 20 20 20 20 2d 2d 20 69 isions.. -- i
21e0: 6e 74 6f 20 63 68 61 6e 67 65 73 65 74 73 2e 0a nto changesets..
21f0: 0a 09 20 20 20 20 6d 69 64 20 49 4e 54 45 47 45 .. mid INTEGE
2200: 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 50 52 49 R NOT NULL PRI
2210: 4d 41 52 59 20 4b 45 59 20 20 41 55 54 4f 49 4e MARY KEY AUTOIN
2220: 43 52 45 4d 45 4e 54 2c 0a 0a 09 20 20 20 20 2d CREMENT,... -
2230: 2d 20 4d 65 74 61 20 64 61 74 61 20 62 65 6c 6f - Meta data belo
2240: 6e 67 73 20 74 6f 20 61 20 73 70 65 63 69 66 69 ngs to a specifi
2250: 63 20 70 72 6f 6a 65 63 74 2c 20 73 74 72 6f 6e c project, stron
2260: 67 65 72 2c 20 74 6f 20 61 0a 09 20 20 20 20 2d ger, to a.. -
2270: 2d 20 62 72 61 6e 63 68 20 69 6e 20 74 68 61 74 - branch in that
2280: 20 70 72 6f 6a 65 63 74 2e 20 49 74 20 66 75 72 project. It fur
2290: 74 68 65 72 20 68 61 73 20 61 20 6c 6f 67 20 6d ther has a log m
22a0: 65 73 73 61 67 65 2c 0a 09 20 20 20 20 2d 2d 20 essage,.. --
22b0: 61 6e 64 20 69 74 73 20 61 75 74 68 6f 72 2e 20 and its author.
22c0: 54 68 69 73 20 69 73 20 75 6e 69 71 75 65 20 77 This is unique w
22d0: 69 74 68 20 74 68 65 20 70 72 6f 6a 65 63 74 20 ith the project
22e0: 61 6e 64 0a 09 20 20 20 20 2d 2d 20 62 72 61 6e and.. -- bran
22f0: 63 68 2e 0a 0a 09 20 20 20 20 70 69 64 20 49 4e ch.... pid IN
2300: 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 TEGER NOT NULL
2310: 20 52 45 46 45 52 45 4e 43 45 53 20 70 72 6f 6a REFERENCES proj
2320: 65 63 74 2c 20 20 2d 2d 0a 09 20 20 20 20 62 69 ect, --.. bi
2330: 64 20 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e d INTEGER NOT N
2340: 55 4c 4c 20 20 52 45 46 45 52 45 4e 43 45 53 20 ULL REFERENCES
2350: 73 79 6d 62 6f 6c 2c 20 20 20 2d 2d 0a 09 20 20 symbol, --..
2360: 20 20 61 69 64 20 49 4e 54 45 47 45 52 20 20 4e aid INTEGER N
2370: 4f 54 20 4e 55 4c 4c 20 20 52 45 46 45 52 45 4e OT NULL REFEREN
2380: 43 45 53 20 61 75 74 68 6f 72 2c 20 20 20 2d 2d CES author, --
2390: 0a 09 20 20 20 20 63 69 64 20 49 4e 54 45 47 45 .. cid INTEGE
23a0: 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 52 45 46 R NOT NULL REF
23b0: 45 52 45 4e 43 45 53 20 63 6d 65 73 73 61 67 65 ERENCES cmessage
23c0: 2c 20 2d 2d 0a 0a 09 20 20 20 20 55 4e 49 51 55 , --... UNIQU
23d0: 45 20 28 70 69 64 2c 20 62 69 64 2c 20 61 69 64 E (pid, bid, aid
23e0: 2c 20 63 69 64 29 0a 0a 09 20 20 20 20 2d 2d 20 , cid)... --
23f0: 43 6f 6e 73 74 72 61 69 6e 74 73 3a 20 54 68 65 Constraints: The
2400: 20 70 72 6f 6a 65 63 74 20 6f 66 20 74 68 65 20 project of the
2410: 6d 65 74 61 20 64 61 74 61 20 6f 66 20 61 20 72 meta data of a r
2420: 65 76 69 73 69 6f 6e 0a 09 20 20 20 20 2d 2d 20 evision.. --
2430: 20 20 20 20 20 20 20 20 20 20 20 20 20 58 20 69 X i
2440: 73 20 74 68 65 20 73 61 6d 65 20 61 73 20 74 68 s the same as th
2450: 65 20 70 72 6f 6a 65 63 74 20 6f 66 20 58 20 69 e project of X i
2460: 74 73 65 6c 66 2e 0a 09 20 20 20 20 2d 2d 0a 09 tself... --..
2470: 20 20 20 20 2d 2d 20 2e 2e 2e 2e 2e 2e 2e 2e 2e -- .........
2480: 2e 2e 2e 20 54 68 65 20 62 72 61 6e 63 68 20 6f ... The branch o
2490: 66 20 74 68 65 20 6d 65 74 61 20 64 61 74 61 20 f the meta data
24a0: 6f 66 20 61 20 72 65 76 69 73 69 6f 6e 0a 09 20 of a revision..
24b0: 20 20 20 2d 2d 20 20 20 20 20 20 20 20 20 20 20 --
24c0: 20 20 20 58 20 69 73 20 74 68 65 20 73 61 6d 65 X is the same
24d0: 20 61 73 20 74 68 65 20 6c 69 6e 65 20 6f 66 20 as the line of
24e0: 64 65 76 65 6c 6f 70 6d 65 6e 74 0a 09 20 20 20 development..
24f0: 20 2d 2d 20 20 20 20 20 20 20 20 20 20 20 20 20 --
2500: 20 6f 66 20 58 20 69 74 73 65 6c 66 2e 0a 09 7d of X itself...}
2510: 0a 0a 09 23 20 41 75 74 68 6f 72 73 20 61 6e 64 ...# Authors and
2520: 20 63 6f 6d 6d 69 74 20 6d 65 73 73 61 67 65 73 commit messages
2530: 20 61 72 65 20 66 75 6c 6c 79 20 67 6c 6f 62 61 are fully globa
2540: 6c 2c 20 69 2e 65 2e 20 70 65 72 0a 09 23 20 72 l, i.e. per..# r
2550: 65 70 6f 73 69 74 6f 72 79 2e 0a 0a 09 73 74 61 epository....sta
2560: 74 65 20 77 72 69 74 69 6e 67 20 61 75 74 68 6f te writing autho
2570: 72 20 7b 0a 09 20 20 20 20 61 69 64 20 20 49 4e r {.. aid IN
2580: 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 TEGER NOT NULL
2590: 20 50 52 49 4d 41 52 59 20 4b 45 59 20 20 41 55 PRIMARY KEY AU
25a0: 54 4f 49 4e 43 52 45 4d 45 4e 54 2c 0a 09 20 20 TOINCREMENT,..
25b0: 20 20 6e 61 6d 65 20 54 45 58 54 20 20 20 20 20 name TEXT
25c0: 4e 4f 54 20 4e 55 4c 4c 20 20 55 4e 49 51 55 45 NOT NULL UNIQUE
25d0: 0a 09 7d 0a 0a 09 73 74 61 74 65 20 77 72 69 74 ..}...state writ
25e0: 69 6e 67 20 63 6d 65 73 73 61 67 65 20 7b 0a 09 ing cmessage {..
25f0: 20 20 20 20 63 69 64 20 20 49 4e 54 45 47 45 52 cid INTEGER
2600: 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 50 52 49 4d NOT NULL PRIM
2610: 41 52 59 20 4b 45 59 20 20 41 55 54 4f 49 4e 43 ARY KEY AUTOINC
2620: 52 45 4d 45 4e 54 2c 0a 09 20 20 20 20 74 65 78 REMENT,.. tex
2630: 74 20 54 45 58 54 20 20 20 20 20 4e 4f 54 20 4e t TEXT NOT N
2640: 55 4c 4c 20 20 55 4e 49 51 55 45 0a 09 7d 0a 0a ULL UNIQUE..}..
2650: 09 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 .return. }..
2660: 20 20 20 74 79 70 65 6d 65 74 68 6f 64 20 6c 6f typemethod lo
2670: 61 64 20 7b 7d 20 7b 0a 09 73 74 61 74 65 20 72 ad {} {..state r
2680: 65 61 64 69 6e 67 20 73 79 6d 62 6f 6c 0a 0a 09 eading symbol...
2690: 72 65 70 6f 73 69 74 6f 72 79 20 6c 6f 61 64 73 repository loads
26a0: 79 6d 62 6f 6c 73 0a 09 72 65 74 75 72 6e 0a 20 ymbols..return.
26b0: 20 20 20 7d 0a 0a 20 20 20 20 74 79 70 65 6d 65 }.. typeme
26c0: 74 68 6f 64 20 72 75 6e 20 7b 7d 20 7b 0a 09 23 thod run {} {..#
26d0: 20 50 61 73 73 20 6d 61 6e 61 67 65 72 20 69 6e Pass manager in
26e0: 74 65 72 66 61 63 65 2e 20 45 78 65 63 75 74 65 terface. Execute
26f0: 64 20 74 6f 20 70 65 72 66 6f 72 6d 20 74 68 65 d to perform the
2700: 0a 09 23 20 66 75 6e 63 74 69 6f 6e 61 6c 69 74 ..# functionalit
2710: 79 20 6f 66 20 74 68 65 20 70 61 73 73 2e 0a 0a y of the pass...
2720: 09 73 65 74 20 72 62 61 73 65 20 5b 72 65 70 6f .set rbase [repo
2730: 73 69 74 6f 72 79 20 62 61 73 65 3f 5d 0a 09 66 sitory base?]..f
2740: 6f 72 65 61 63 68 20 70 72 6f 6a 65 63 74 20 5b oreach project [
2750: 72 65 70 6f 73 69 74 6f 72 79 20 70 72 6f 6a 65 repository proje
2760: 63 74 73 5d 20 7b 0a 09 20 20 20 20 73 65 74 20 cts] {.. set
2770: 62 61 73 65 20 5b 66 69 6c 65 20 6a 6f 69 6e 20 base [file join
2780: 24 72 62 61 73 65 20 5b 24 70 72 6f 6a 65 63 74 $rbase [$project
2790: 20 62 61 73 65 5d 5d 0a 09 20 20 20 20 6c 6f 67 base]].. log
27a0: 20 77 72 69 74 65 20 31 20 63 6f 6c 6c 72 65 76 write 1 collrev
27b0: 20 22 50 72 6f 63 65 73 73 69 6e 67 20 24 62 61 "Processing $ba
27c0: 73 65 22 0a 0a 09 20 20 20 20 66 6f 72 65 61 63 se"... foreac
27d0: 68 20 66 69 6c 65 20 5b 24 70 72 6f 6a 65 63 74 h file [$project
27e0: 20 66 69 6c 65 73 5d 20 7b 0a 09 09 73 65 74 20 files] {...set
27f0: 70 61 74 68 20 5b 24 66 69 6c 65 20 70 61 74 68 path [$file path
2800: 5d 0a 09 09 6c 6f 67 20 77 72 69 74 65 20 32 20 ]...log write 2
2810: 63 6f 6c 6c 72 65 76 20 22 50 61 72 73 69 6e 67 collrev "Parsing
2820: 20 24 70 61 74 68 22 0a 09 09 69 66 20 7b 5b 63 $path"...if {[c
2830: 61 74 63 68 20 7b 0a 09 09 20 20 20 20 70 61 72 atch {... par
2840: 73 65 72 20 70 72 6f 63 65 73 73 20 5b 66 69 6c ser process [fil
2850: 65 20 6a 6f 69 6e 20 24 62 61 73 65 20 24 70 61 e join $base $pa
2860: 74 68 5d 20 24 66 69 6c 65 0a 09 09 7d 20 6d 73 th] $file...} ms
2870: 67 5d 7d 20 7b 0a 09 09 20 20 20 20 67 6c 6f 62 g]} {... glob
2880: 61 6c 20 65 72 72 6f 72 43 6f 64 65 0a 09 09 20 al errorCode...
2890: 20 20 20 69 66 20 7b 24 65 72 72 6f 72 43 6f 64 if {$errorCod
28a0: 65 20 65 71 20 22 76 63 3a 3a 72 63 73 3a 3a 70 e eq "vc::rcs::p
28b0: 61 72 73 65 72 22 7d 20 7b 0a 09 09 09 74 72 6f arser"} {....tro
28c0: 75 62 6c 65 20 66 61 74 61 6c 20 22 24 70 61 74 uble fatal "$pat
28d0: 68 20 69 73 20 6e 6f 74 20 61 20 76 61 6c 69 64 h is not a valid
28e0: 20 52 43 53 20 61 72 63 68 69 76 65 20 28 24 6d RCS archive ($m
28f0: 73 67 29 22 0a 09 09 20 20 20 20 7d 20 65 6c 73 sg)"... } els
2900: 65 20 7b 0a 09 09 09 67 6c 6f 62 61 6c 20 65 72 e {....global er
2910: 72 6f 72 49 6e 66 6f 0a 09 09 09 74 72 6f 75 62 rorInfo....troub
2920: 6c 65 20 69 6e 74 65 72 6e 61 6c 20 24 65 72 72 le internal $err
2930: 6f 72 49 6e 66 6f 0a 09 09 20 20 20 20 7d 0a 09 orInfo... }..
2940: 09 7d 20 65 6c 73 65 20 7b 0a 09 09 20 20 20 20 .} else {...
2950: 23 20 57 65 20 70 65 72 73 69 73 74 20 74 68 65 # We persist the
2960: 20 63 6f 72 65 20 6f 66 20 74 68 65 20 64 61 74 core of the dat
2970: 61 20 63 6f 6c 6c 65 63 74 65 64 20 61 62 6f 75 a collected abou
2980: 74 0a 09 09 20 20 20 20 23 20 65 61 63 68 20 66 t... # each f
2990: 69 6c 65 20 69 6d 6d 65 64 69 61 74 65 6c 79 20 ile immediately
29a0: 61 66 74 65 72 20 69 74 20 68 61 73 20 62 65 65 after it has bee
29b0: 6e 20 70 61 72 73 65 64 0a 09 09 20 20 20 20 23 n parsed... #
29c0: 20 61 6e 64 20 77 72 61 6e 67 6c 65 64 20 69 6e and wrangled in
29d0: 74 6f 20 73 68 61 70 65 2c 20 61 6e 64 20 74 68 to shape, and th
29e0: 65 6e 20 64 72 6f 70 20 69 74 20 66 72 6f 6d 0a en drop it from.
29f0: 09 09 20 20 20 20 23 20 6d 65 6d 6f 72 79 2e 20 .. # memory.
2a00: 54 68 69 73 20 69 73 20 64 6f 6e 65 20 74 6f 20 This is done to
2a10: 6b 65 65 70 20 74 68 65 20 61 6d 6f 75 6e 74 20 keep the amount
2a20: 6f 66 0a 09 09 20 20 20 20 23 20 72 65 71 75 69 of... # requi
2a30: 72 65 64 20 6d 65 6d 6f 72 79 20 77 69 74 68 69 red memory withi
2a40: 6e 20 73 65 6e 73 69 62 6c 65 20 6c 69 6d 69 74 n sensible limit
2a50: 73 2e 20 57 69 74 68 6f 75 74 0a 09 09 20 20 20 s. Without...
2a60: 20 23 20 64 6f 69 6e 67 20 69 74 20 74 68 69 73 # doing it this
2a70: 20 77 61 79 20 77 65 20 77 6f 75 6c 64 20 65 61 way we would ea
2a80: 73 69 6c 79 20 67 6f 62 62 6c 65 20 75 70 20 31 sily gobble up 1
2a90: 47 0a 09 09 20 20 20 20 23 20 6f 66 20 52 41 4d G... # of RAM
2aa0: 20 6f 72 20 6d 6f 72 65 20 77 69 74 68 20 61 6c or more with al
2ab0: 6c 20 74 68 65 20 6f 62 6a 65 63 74 73 20 28 72 l the objects (r
2ac0: 65 76 69 73 69 6f 6e 73 0a 09 09 20 20 20 20 23 evisions... #
2ad0: 20 61 6e 64 20 66 69 6c 65 2d 6c 65 76 65 6c 20 and file-level
2ae0: 73 79 6d 62 6f 6c 73 29 2e 0a 0a 09 09 20 20 20 symbols).....
2af0: 20 24 66 69 6c 65 20 70 65 72 73 69 73 74 0a 09 $file persist..
2b00: 09 7d 0a 0a 09 09 24 66 69 6c 65 20 64 72 6f 70 .}....$file drop
2b10: 0a 09 20 20 20 20 7d 0a 0a 09 20 20 20 20 24 70 .. }... $p
2b20: 72 6f 6a 65 63 74 20 70 75 72 67 65 67 68 6f 73 roject purgeghos
2b30: 74 73 79 6d 62 6f 6c 73 0a 09 7d 0a 0a 09 72 65 tsymbols..}...re
2b40: 70 6f 73 69 74 6f 72 79 20 70 72 69 6e 74 72 65 pository printre
2b50: 76 73 74 61 74 69 73 74 69 63 73 0a 09 72 65 70 vstatistics..rep
2b60: 6f 73 69 74 6f 72 79 20 70 65 72 73 69 73 74 72 ository persistr
2b70: 65 76 0a 0a 09 6c 6f 67 20 77 72 69 74 65 20 31 ev...log write 1
2b80: 20 63 6f 6c 6c 72 65 76 20 22 53 63 61 6e 20 63 collrev "Scan c
2b90: 6f 6d 70 6c 65 74 65 64 22 0a 09 50 61 72 61 6e ompleted"..Paran
2ba0: 6f 69 61 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 oia..return.
2bb0: 7d 0a 0a 20 20 20 20 74 79 70 65 6d 65 74 68 6f }.. typemetho
2bc0: 64 20 64 69 73 63 61 72 64 20 7b 7d 20 7b 0a 09 d discard {} {..
2bd0: 23 20 50 61 73 73 20 6d 61 6e 61 67 65 72 20 69 # Pass manager i
2be0: 6e 74 65 72 66 61 63 65 2e 20 45 78 65 63 75 74 nterface. Execut
2bf0: 65 64 20 66 6f 72 20 61 6c 6c 20 70 61 73 73 65 ed for all passe
2c00: 73 20 61 66 74 65 72 20 74 68 65 0a 09 23 20 72 s after the..# r
2c10: 75 6e 20 70 61 73 73 65 73 2c 20 74 6f 20 72 65 un passes, to re
2c20: 6d 6f 76 65 20 61 6c 6c 20 64 61 74 61 20 6f 66 move all data of
2c30: 20 74 68 69 73 20 70 61 73 73 20 66 72 6f 6d 20 this pass from
2c40: 74 68 65 20 73 74 61 74 65 2c 0a 09 23 20 61 73 the state,..# as
2c50: 20 62 65 69 6e 67 20 6f 75 74 20 6f 66 20 64 61 being out of da
2c60: 74 65 2e 0a 0a 09 73 74 61 74 65 20 64 69 73 63 te....state disc
2c70: 61 72 64 20 72 65 76 69 73 69 6f 6e 0a 09 73 74 ard revision..st
2c80: 61 74 65 20 64 69 73 63 61 72 64 20 74 61 67 0a ate discard tag.
2c90: 09 73 74 61 74 65 20 64 69 73 63 61 72 64 20 62 .state discard b
2ca0: 72 61 6e 63 68 0a 09 73 74 61 74 65 20 64 69 73 ranch..state dis
2cb0: 63 61 72 64 20 73 79 6d 62 6f 6c 0a 09 73 74 61 card symbol..sta
2cc0: 74 65 20 64 69 73 63 61 72 64 20 62 6c 6f 63 6b te discard block
2cd0: 65 72 0a 09 73 74 61 74 65 20 64 69 73 63 61 72 er..state discar
2ce0: 64 20 70 61 72 65 6e 74 0a 09 73 74 61 74 65 20 d parent..state
2cf0: 64 69 73 63 61 72 64 20 73 79 6d 74 79 70 65 0a discard symtype.
2d00: 09 73 74 61 74 65 20 64 69 73 63 61 72 64 20 6d .state discard m
2d10: 65 74 61 0a 09 73 74 61 74 65 20 64 69 73 63 61 eta..state disca
2d20: 72 64 20 61 75 74 68 6f 72 0a 09 73 74 61 74 65 rd author..state
2d30: 20 64 69 73 63 61 72 64 20 63 6d 65 73 73 61 67 discard cmessag
2d40: 65 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a e..return. }.
2d50: 0a 20 20 20 20 70 72 6f 63 20 50 61 72 61 6e 6f . proc Parano
2d60: 69 61 20 7b 7d 20 7b 0a 09 23 20 54 68 69 73 20 ia {} {..# This
2d70: 63 6f 64 65 20 70 65 72 66 6f 72 6d 73 20 61 20 code performs a
2d80: 6e 75 6d 62 65 72 20 6f 66 20 70 61 72 61 6e 6f number of parano
2d90: 69 64 20 63 68 65 63 6b 73 20 6f 66 20 74 68 65 id checks of the
2da0: 0a 09 23 20 64 61 74 61 62 61 73 65 2c 20 73 65 ..# database, se
2db0: 61 72 63 68 69 6e 67 20 66 6f 72 20 69 6e 63 6f arching for inco
2dc0: 6e 73 69 73 74 65 6e 74 20 63 72 6f 73 73 2d 72 nsistent cross-r
2dd0: 65 66 65 72 65 6e 63 65 73 2e 0a 09 6c 6f 67 20 eferences...log
2de0: 77 72 69 74 65 20 34 20 63 6f 6c 6c 72 65 76 20 write 4 collrev
2df0: 7b 43 68 65 63 6b 20 64 61 74 61 62 61 73 65 20 {Check database
2e00: 63 6f 6e 73 69 73 74 65 6e 63 79 7d 0a 0a 09 73 consistency}...s
2e10: 65 74 20 6e 20 30 20 3b 20 23 20 43 6f 75 6e 74 et n 0 ; # Count
2e20: 65 72 20 66 6f 72 20 74 68 65 20 63 68 65 63 6b er for the check
2e30: 73 20 28 77 65 20 70 72 69 6e 74 20 61 6e 20 69 s (we print an i
2e40: 64 20 62 65 66 6f 72 65 20 74 68 65 0a 09 09 20 d before the...
2e50: 20 23 20 6d 61 69 6e 20 6c 61 62 65 6c 29 2e 0a # main label)..
2e60: 0a 09 23 20 46 69 6e 64 20 61 6c 6c 20 72 65 76 ..# Find all rev
2e70: 69 73 69 6f 6e 73 20 77 68 69 63 68 20 64 69 73 isions which dis
2e80: 61 67 72 65 65 20 77 69 74 68 20 74 68 65 69 72 agree with their
2e90: 20 6c 69 6e 65 20 6f 66 0a 09 23 20 64 65 76 65 line of..# deve
2ea0: 6c 6f 70 6d 65 6e 74 20 61 62 6f 75 74 20 74 68 lopment about th
2eb0: 65 20 70 72 6f 6a 65 63 74 20 74 68 65 79 20 61 e project they a
2ec0: 72 65 20 6f 77 6e 65 64 20 62 79 2e 0a 09 43 68 re owned by...Ch
2ed0: 65 63 6b 20 5c 0a 09 20 20 20 20 7b 52 65 76 69 eck \.. {Revi
2ee0: 73 69 6f 6e 73 20 61 6e 64 20 74 68 65 69 72 20 sions and their
2ef0: 4c 4f 44 73 20 68 61 76 65 20 74 6f 20 62 65 20 LODs have to be
2f00: 69 6e 20 74 68 65 20 73 61 6d 65 20 70 72 6f 6a in the same proj
2f10: 65 63 74 7d 20 5c 0a 09 20 20 20 20 7b 64 69 73 ect} \.. {dis
2f20: 61 67 72 65 65 73 20 77 69 74 68 20 69 74 73 20 agrees with its
2f30: 4c 4f 44 20 61 62 6f 75 74 20 6f 77 6e 69 6e 67 LOD about owning
2f40: 20 70 72 6f 6a 65 63 74 7d 20 7b 0a 09 09 53 45 project} {...SE
2f50: 4c 45 43 54 20 46 2e 6e 61 6d 65 2c 20 52 2e 72 LECT F.name, R.r
2f60: 65 76 0a 09 09 46 52 4f 4d 20 72 65 76 69 73 69 ev...FROM revisi
2f70: 6f 6e 20 52 2c 20 66 69 6c 65 20 46 2c 20 73 79 on R, file F, sy
2f80: 6d 62 6f 6c 20 53 0a 09 09 57 48 45 52 45 20 52 mbol S...WHERE R
2f90: 2e 66 69 64 20 3d 20 46 2e 66 69 64 0a 09 09 41 .fid = F.fid...A
2fa0: 4e 44 20 20 20 52 2e 6c 6f 64 20 3d 20 53 2e 73 ND R.lod = S.s
2fb0: 69 64 0a 09 09 41 4e 44 20 20 20 46 2e 70 69 64 id...AND F.pid
2fc0: 20 21 3d 20 53 2e 70 69 64 0a 09 09 3b 0a 09 20 != S.pid...;..
2fd0: 20 20 20 7d 0a 09 23 20 46 69 6e 64 20 61 6c 6c }..# Find all
2fe0: 20 72 65 76 69 73 69 6f 6e 73 20 77 68 69 63 68 revisions which
2ff0: 20 64 69 73 67 72 65 65 20 77 69 74 68 20 74 68 disgree with th
3000: 65 69 72 20 6d 65 74 61 20 64 61 74 61 20 61 62 eir meta data ab
3010: 6f 75 74 0a 09 23 20 74 68 65 20 70 72 6f 6a 65 out..# the proje
3020: 63 74 20 74 68 65 79 20 61 72 65 20 6f 77 6e 65 ct they are owne
3030: 64 20 62 79 2e 0a 09 43 68 65 63 6b 20 5c 0a 09 d by...Check \..
3040: 20 20 20 20 7b 52 65 76 69 73 69 6f 6e 73 20 61 {Revisions a
3050: 6e 64 20 74 68 65 69 72 20 6d 65 74 61 20 64 61 nd their meta da
3060: 74 61 20 68 61 76 65 20 74 6f 20 62 65 20 69 6e ta have to be in
3070: 20 74 68 65 20 73 61 6d 65 20 70 72 6f 6a 65 63 the same projec
3080: 74 7d 20 5c 0a 09 20 20 20 20 7b 64 69 73 61 67 t} \.. {disag
3090: 72 65 65 73 20 77 69 74 68 20 69 74 73 20 6d 65 rees with its me
30a0: 74 61 20 64 61 74 61 20 61 62 6f 75 74 20 6f 77 ta data about ow
30b0: 6e 69 6e 67 20 70 72 6f 6a 65 63 74 7d 20 7b 0a ning project} {.
30c0: 09 09 53 45 4c 45 43 54 20 46 2e 6e 61 6d 65 2c ..SELECT F.name,
30d0: 20 52 2e 72 65 76 0a 09 09 46 52 4f 4d 20 72 65 R.rev...FROM re
30e0: 76 69 73 69 6f 6e 20 52 2c 20 66 69 6c 65 20 46 vision R, file F
30f0: 2c 20 6d 65 74 61 20 4d 0a 09 09 57 48 45 52 45 , meta M...WHERE
3100: 20 52 2e 66 69 64 20 3d 20 46 2e 66 69 64 0a 09 R.fid = F.fid..
3110: 09 41 4e 44 20 20 20 52 2e 6d 69 64 20 3d 20 4d .AND R.mid = M
3120: 2e 6d 69 64 0a 09 09 41 4e 44 20 20 20 46 2e 70 .mid...AND F.p
3130: 69 64 20 21 3d 20 4d 2e 70 69 64 0a 09 09 3b 0a id != M.pid...;.
3140: 09 20 20 20 20 7d 0a 09 23 20 46 69 6e 64 20 61 . }..# Find a
3150: 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 77 68 69 ll revisions whi
3160: 63 68 20 64 69 73 67 72 65 65 20 77 69 74 68 20 ch disgree with
3170: 74 68 65 69 72 20 6d 65 74 61 20 64 61 74 61 20 their meta data
3180: 61 62 6f 75 74 0a 09 23 20 74 68 65 20 62 72 61 about..# the bra
3190: 6e 63 68 2f 6c 69 6e 65 20 6f 66 20 64 65 76 65 nch/line of deve
31a0: 6c 6f 70 6d 65 6e 74 20 74 68 65 79 20 62 65 6c lopment they bel
31b0: 6f 6e 67 20 74 6f 2e 0a 09 43 68 65 63 6b 20 5c ong to...Check \
31c0: 0a 09 20 20 20 20 7b 52 65 76 69 73 69 6f 6e 73 .. {Revisions
31d0: 20 61 6e 64 20 74 68 65 69 72 20 6d 65 74 61 20 and their meta
31e0: 64 61 74 61 20 68 61 76 65 20 74 6f 20 62 65 20 data have to be
31f0: 69 6e 20 74 68 65 20 73 61 6d 65 20 4c 4f 44 7d in the same LOD}
3200: 20 5c 0a 09 20 20 20 20 7b 64 69 73 61 67 72 65 \.. {disagre
3210: 65 73 20 77 69 74 68 20 69 74 73 20 6d 65 74 61 es with its meta
3220: 20 64 61 74 61 20 61 62 6f 75 74 20 6f 77 6e 69 data about owni
3230: 6e 67 20 4c 4f 44 7d 20 7b 0a 09 09 53 45 4c 45 ng LOD} {...SELE
3240: 43 54 20 46 2e 6e 61 6d 65 2c 20 52 2e 72 65 76 CT F.name, R.rev
3250: 0a 09 09 46 52 4f 4d 20 72 65 76 69 73 69 6f 6e ...FROM revision
3260: 20 52 2c 20 6d 65 74 61 20 4d 2c 20 66 69 6c 65 R, meta M, file
3270: 20 46 0a 09 09 57 48 45 52 45 20 52 2e 6d 69 64 F...WHERE R.mid
3280: 20 3d 20 4d 2e 6d 69 64 0a 09 09 41 4e 44 20 20 = M.mid...AND
3290: 20 52 2e 6c 6f 64 20 21 3d 20 4d 2e 62 69 64 0a R.lod != M.bid.
32a0: 09 09 41 4e 44 20 20 20 52 2e 66 69 64 20 3d 20 ..AND R.fid =
32b0: 46 2e 66 69 64 0a 09 09 3b 0a 09 20 20 20 20 7d F.fid...;.. }
32c0: 0a 09 23 20 46 69 6e 64 20 61 6c 6c 20 72 65 76 ..# Find all rev
32d0: 69 73 69 6f 6e 73 20 77 69 74 68 20 61 20 70 72 isions with a pr
32e0: 69 6d 61 72 79 20 63 68 69 6c 64 20 77 68 69 63 imary child whic
32f0: 68 20 64 69 73 61 67 72 65 65 73 0a 09 23 20 61 h disagrees..# a
3300: 62 6f 75 74 20 74 68 65 20 66 69 6c 65 20 74 68 bout the file th
3310: 65 79 20 62 65 6c 6f 6e 67 20 74 6f 2e 0a 09 43 ey belong to...C
3320: 68 65 63 6b 20 5c 0a 09 20 20 20 20 7b 52 65 76 heck \.. {Rev
3330: 69 73 69 6f 6e 73 20 61 6e 64 20 74 68 65 69 72 isions and their
3340: 20 70 72 69 6d 61 72 79 20 63 68 69 6c 64 72 65 primary childre
3350: 6e 20 68 61 76 65 20 74 6f 20 62 65 20 69 6e 20 n have to be in
3360: 74 68 65 20 73 61 6d 65 20 66 69 6c 65 7d 20 5c the same file} \
3370: 0a 09 20 20 20 20 7b 64 69 73 61 67 72 65 65 73 .. {disagrees
3380: 20 77 69 74 68 20 69 74 73 20 70 72 69 6d 61 72 with its primar
3390: 79 20 63 68 69 6c 64 20 61 62 6f 75 74 20 74 68 y child about th
33a0: 65 20 6f 77 6e 69 6e 67 20 66 69 6c 65 7d 20 7b e owning file} {
33b0: 0a 09 09 53 45 4c 45 43 54 20 46 2e 6e 61 6d 65 ...SELECT F.name
33c0: 2c 20 52 2e 72 65 76 0a 09 09 46 52 4f 4d 20 72 , R.rev...FROM r
33d0: 65 76 69 73 69 6f 6e 20 52 2c 20 72 65 76 69 73 evision R, revis
33e0: 69 6f 6e 20 43 2c 20 66 69 6c 65 20 46 0a 09 09 ion C, file F...
33f0: 57 48 45 52 45 20 52 2e 66 69 64 20 3d 20 46 2e WHERE R.fid = F.
3400: 66 69 64 0a 09 09 41 4e 44 20 20 20 52 2e 63 68 fid...AND R.ch
3410: 69 6c 64 20 49 53 20 4e 4f 54 20 4e 55 4c 4c 0a ild IS NOT NULL.
3420: 09 09 41 4e 44 20 20 20 52 2e 63 68 69 6c 64 20 ..AND R.child
3430: 3d 20 43 2e 72 69 64 0a 09 09 41 4e 44 20 20 20 = C.rid...AND
3440: 43 2e 66 69 64 20 21 3d 20 52 2e 66 69 64 0a 09 C.fid != R.fid..
3450: 09 3b 0a 09 20 20 20 20 7d 0a 0a 09 23 20 46 69 .;.. }...# Fi
3460: 6e 64 20 61 6c 6c 20 72 65 76 69 73 69 6f 6e 73 nd all revisions
3470: 20 77 69 74 68 20 61 20 62 72 61 6e 63 68 20 70 with a branch p
3480: 61 72 65 6e 74 20 73 79 6d 62 6f 6c 20 77 68 6f arent symbol who
3490: 73 65 20 70 61 72 65 6e 74 0a 09 23 20 64 69 73 se parent..# dis
34a0: 61 67 72 65 65 73 20 61 62 6f 75 74 20 74 68 65 agrees about the
34b0: 20 66 69 6c 65 20 74 68 65 79 20 62 65 6c 6f 6e file they belon
34c0: 67 20 74 6f 2e 0a 09 43 68 65 63 6b 20 5c 0a 09 g to...Check \..
34d0: 20 20 20 20 7b 52 65 76 69 73 69 6f 6e 73 20 61 {Revisions a
34e0: 6e 64 20 74 68 65 69 72 20 62 72 61 6e 63 68 20 nd their branch
34f0: 63 68 69 6c 64 72 65 6e 20 68 61 76 65 20 74 6f children have to
3500: 20 62 65 20 69 6e 20 74 68 65 20 73 61 6d 65 20 be in the same
3510: 66 69 6c 65 7d 20 5c 0a 09 20 20 20 20 7b 61 74 file} \.. {at
3520: 20 74 68 65 20 62 65 67 69 6e 6e 69 6e 67 20 6f the beginning o
3530: 66 20 69 74 73 20 62 72 61 6e 63 68 20 61 6e 64 f its branch and
3540: 20 69 74 73 20 70 61 72 65 6e 74 20 64 69 73 61 its parent disa
3550: 67 72 65 65 20 61 62 6f 75 74 20 74 68 65 20 6f gree about the o
3560: 77 6e 69 6e 67 20 66 69 6c 65 7d 20 7b 0a 09 09 wning file} {...
3570: 53 45 4c 45 43 54 20 46 2e 6e 61 6d 65 2c 20 52 SELECT F.name, R
3580: 2e 72 65 76 0a 09 09 46 52 4f 4d 20 72 65 76 69 .rev...FROM revi
3590: 73 69 6f 6e 20 52 2c 20 72 65 76 69 73 69 6f 6e sion R, revision
35a0: 20 50 2c 20 66 69 6c 65 20 46 0a 09 09 57 48 45 P, file F...WHE
35b0: 52 45 20 52 2e 66 69 64 20 3d 20 46 2e 66 69 64 RE R.fid = F.fid
35c0: 0a 09 09 41 4e 44 20 20 20 52 2e 62 70 61 72 65 ...AND R.bpare
35d0: 6e 74 20 49 53 20 4e 4f 54 20 4e 55 4c 4c 0a 09 nt IS NOT NULL..
35e0: 09 41 4e 44 20 20 20 52 2e 70 61 72 65 6e 74 20 .AND R.parent
35f0: 3d 20 50 2e 72 69 64 0a 09 09 41 4e 44 20 20 20 = P.rid...AND
3600: 52 2e 66 69 64 20 21 3d 20 50 2e 66 69 64 0a 09 R.fid != P.fid..
3610: 09 3b 0a 09 20 20 20 20 7d 0a 09 23 20 46 69 6e .;.. }..# Fin
3620: 64 20 61 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 d all revisions
3630: 77 69 74 68 20 61 20 6e 6f 6e 2d 4e 54 44 42 20 with a non-NTDB
3640: 63 68 69 6c 64 20 77 68 69 63 68 20 64 69 73 61 child which disa
3650: 67 72 65 65 73 0a 09 23 20 61 62 6f 75 74 20 74 grees..# about t
3660: 68 65 20 66 69 6c 65 20 74 68 65 79 20 62 65 6c he file they bel
3670: 6f 6e 67 20 74 6f 2e 0a 09 43 68 65 63 6b 20 5c ong to...Check \
3680: 0a 09 20 20 20 20 7b 52 65 76 69 73 69 6f 6e 73 .. {Revisions
3690: 20 61 6e 64 20 74 68 65 69 72 20 6e 6f 6e 2d 4e and their non-N
36a0: 54 44 42 20 63 68 69 6c 64 72 65 6e 20 68 61 76 TDB children hav
36b0: 65 20 74 6f 20 62 65 20 69 6e 20 74 68 65 20 73 e to be in the s
36c0: 61 6d 65 20 66 69 6c 65 7d 20 5c 0a 09 20 20 20 ame file} \..
36d0: 20 7b 64 69 73 61 67 72 65 65 73 20 77 69 74 68 {disagrees with
36e0: 20 69 74 73 20 6e 6f 6e 2d 4e 54 44 42 20 63 68 its non-NTDB ch
36f0: 69 6c 64 20 61 62 6f 75 74 20 74 68 65 20 6f 77 ild about the ow
3700: 6e 69 6e 67 20 66 69 6c 65 7d 20 7b 0a 09 09 53 ning file} {...S
3710: 45 4c 45 43 54 20 46 2e 6e 61 6d 65 2c 20 52 2e ELECT F.name, R.
3720: 72 65 76 0a 09 09 46 52 4f 4d 20 72 65 76 69 73 rev...FROM revis
3730: 69 6f 6e 20 52 2c 20 72 65 76 69 73 69 6f 6e 20 ion R, revision
3740: 43 2c 20 66 69 6c 65 20 46 0a 09 09 57 48 45 52 C, file F...WHER
3750: 45 20 52 2e 66 69 64 20 3d 20 46 2e 66 69 64 0a E R.fid = F.fid.
3760: 09 09 41 4e 44 20 20 20 52 2e 64 62 63 68 69 6c ..AND R.dbchil
3770: 64 20 49 53 20 4e 4f 54 20 4e 55 4c 4c 0a 09 09 d IS NOT NULL...
3780: 41 4e 44 20 20 20 52 2e 64 62 63 68 69 6c 64 20 AND R.dbchild
3790: 3d 20 43 2e 72 69 64 0a 09 09 41 4e 44 20 20 20 = C.rid...AND
37a0: 43 2e 66 69 64 20 21 3d 20 52 2e 66 69 64 0a 09 C.fid != R.fid..
37b0: 09 3b 0a 09 20 20 20 20 7d 0a 09 23 20 46 69 6e .;.. }..# Fin
37c0: 64 20 61 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 d all revisions
37d0: 77 68 69 63 68 20 68 61 76 65 20 61 20 70 72 69 which have a pri
37e0: 6d 61 72 79 20 63 68 69 6c 64 2c 20 62 75 74 20 mary child, but
37f0: 74 68 65 20 63 68 69 6c 64 0a 09 23 20 64 6f 65 the child..# doe
3800: 73 20 6e 6f 74 20 68 61 76 65 20 74 68 65 6d 20 s not have them
3810: 61 73 20 70 61 72 65 6e 74 2e 0a 09 43 68 65 63 as parent...Chec
3820: 6b 20 5c 0a 09 20 20 20 20 7b 52 65 76 69 73 69 k \.. {Revisi
3830: 6f 6e 73 20 68 61 76 65 20 74 6f 20 62 65 20 70 ons have to be p
3840: 61 72 65 6e 74 73 20 6f 66 20 74 68 65 69 72 20 arents of their
3850: 70 72 69 6d 61 72 79 20 63 68 69 6c 64 72 65 6e primary children
3860: 7d 20 5c 0a 09 20 20 20 20 7b 69 73 20 6e 6f 74 } \.. {is not
3870: 20 74 68 65 20 70 61 72 65 6e 74 20 6f 66 20 69 the parent of i
3880: 74 73 20 70 72 69 6d 61 72 79 20 63 68 69 6c 64 ts primary child
3890: 7d 20 7b 0a 09 09 53 45 4c 45 43 54 20 46 2e 6e } {...SELECT F.n
38a0: 61 6d 65 2c 20 52 2e 72 65 76 0a 09 09 46 52 4f ame, R.rev...FRO
38b0: 4d 20 72 65 76 69 73 69 6f 6e 20 52 2c 20 72 65 M revision R, re
38c0: 76 69 73 69 6f 6e 20 43 2c 20 66 69 6c 65 20 46 vision C, file F
38d0: 0a 09 09 57 48 45 52 45 20 52 2e 66 69 64 20 3d ...WHERE R.fid =
38e0: 20 46 2e 66 69 64 0a 09 09 41 4e 44 20 20 20 52 F.fid...AND R
38f0: 2e 63 68 69 6c 64 20 49 53 20 4e 4f 54 20 4e 55 .child IS NOT NU
3900: 4c 4c 0a 09 09 41 4e 44 20 20 20 52 2e 63 68 69 LL...AND R.chi
3910: 6c 64 20 3d 20 43 2e 72 69 64 0a 09 09 41 4e 44 ld = C.rid...AND
3920: 20 20 20 43 2e 70 61 72 65 6e 74 20 21 3d 20 52 C.parent != R
3930: 2e 72 69 64 0a 09 09 3b 0a 09 20 20 20 20 7d 0a .rid...;.. }.
3940: 09 23 20 46 69 6e 64 20 61 6c 6c 20 72 65 76 69 .# Find all revi
3950: 73 69 6f 6e 73 20 77 68 69 63 68 20 68 61 76 65 sions which have
3960: 20 61 20 70 72 69 6d 72 61 72 79 20 63 68 69 6c a primrary chil
3970: 64 2c 20 62 75 74 20 74 68 65 0a 09 23 20 63 68 d, but the..# ch
3980: 69 6c 64 20 68 61 73 20 61 20 62 72 61 6e 63 68 ild has a branch
3990: 20 70 61 72 65 6e 74 20 73 79 6d 62 6f 6c 20 6d parent symbol m
39a0: 61 6b 69 6e 67 20 74 68 65 6d 20 62 72 61 63 68 aking them brach
39b0: 20 73 74 61 72 74 65 72 73 2e 0a 09 43 68 65 63 starters...Chec
39c0: 6b 20 5c 0a 09 20 20 20 20 7b 50 72 69 6d 61 72 k \.. {Primar
39d0: 79 20 63 68 69 6c 64 72 65 6e 20 6f 66 20 72 65 y children of re
39e0: 76 69 73 69 6f 6e 73 20 6d 75 73 74 20 6e 6f 74 visions must not
39f0: 20 73 74 61 72 74 20 62 72 61 6e 63 68 65 73 7d start branches}
3a00: 20 5c 0a 09 20 20 20 20 7b 69 73 20 70 61 72 65 \.. {is pare
3a10: 6e 74 20 6f 66 20 61 20 70 72 69 6d 61 72 79 20 nt of a primary
3a20: 63 68 69 6c 64 20 77 68 69 63 68 20 69 73 20 74 child which is t
3a30: 68 65 20 62 65 67 69 6e 6e 69 6e 67 20 6f 66 20 he beginning of
3a40: 61 20 62 72 61 6e 63 68 7d 20 7b 0a 09 09 53 45 a branch} {...SE
3a50: 4c 45 43 54 20 46 2e 6e 61 6d 65 2c 20 52 2e 72 LECT F.name, R.r
3a60: 65 76 0a 09 09 46 52 4f 4d 20 72 65 76 69 73 69 ev...FROM revisi
3a70: 6f 6e 20 52 2c 20 72 65 76 69 73 69 6f 6e 20 43 on R, revision C
3a80: 2c 20 66 69 6c 65 20 46 0a 09 09 57 48 45 52 45 , file F...WHERE
3a90: 20 52 2e 66 69 64 20 3d 20 46 2e 66 69 64 0a 09 R.fid = F.fid..
3aa0: 09 41 4e 44 20 20 20 52 2e 63 68 69 6c 64 20 49 .AND R.child I
3ab0: 53 20 4e 4f 54 20 4e 55 4c 4c 0a 09 09 41 4e 44 S NOT NULL...AND
3ac0: 20 20 20 52 2e 63 68 69 6c 64 20 3d 20 43 2e 72 R.child = C.r
3ad0: 69 64 0a 09 09 41 4e 44 20 20 20 43 2e 62 70 61 id...AND C.bpa
3ae0: 72 65 6e 74 20 49 53 20 4e 4f 54 20 4e 55 4c 4c rent IS NOT NULL
3af0: 0a 09 09 3b 0a 09 20 20 20 20 7d 0a 09 23 20 46 ...;.. }..# F
3b00: 69 6e 64 20 61 6c 6c 20 72 65 76 69 73 69 6f 6e ind all revision
3b10: 73 20 77 69 74 68 6f 75 74 20 62 72 61 6e 63 68 s without branch
3b20: 20 70 61 72 65 6e 74 20 73 79 6d 62 6f 6c 20 77 parent symbol w
3b30: 68 69 63 68 20 68 61 76 65 20 61 0a 09 23 20 70 hich have a..# p
3b40: 61 72 65 6e 74 2c 20 62 75 74 20 74 68 65 20 70 arent, but the p
3b50: 61 72 65 6e 74 20 64 6f 65 73 20 6e 6f 74 20 68 arent does not h
3b60: 61 76 65 20 74 68 65 6d 20 61 73 20 70 72 69 6d ave them as prim
3b70: 61 72 79 20 63 68 69 6c 64 2e 0a 09 43 68 65 63 ary child...Chec
3b80: 6b 20 5c 0a 09 20 20 20 20 7b 52 65 76 69 73 69 k \.. {Revisi
3b90: 6f 6e 73 20 68 61 76 65 20 74 6f 20 62 65 20 70 ons have to be p
3ba0: 72 69 6d 61 72 79 20 63 68 69 6c 64 72 65 6e 20 rimary children
3bb0: 6f 66 20 74 68 65 69 72 20 70 61 72 65 6e 74 73 of their parents
3bc0: 2c 20 69 66 20 61 6e 79 7d 20 5c 0a 09 20 20 20 , if any} \..
3bd0: 20 7b 69 73 20 6e 6f 74 20 74 68 65 20 63 68 69 {is not the chi
3be0: 6c 64 20 6f 66 20 69 74 73 20 70 61 72 65 6e 74 ld of its parent
3bf0: 7d 20 7b 0a 09 09 53 45 4c 45 43 54 20 46 2e 6e } {...SELECT F.n
3c00: 61 6d 65 2c 20 52 2e 72 65 76 0a 09 09 46 52 4f ame, R.rev...FRO
3c10: 4d 20 72 65 76 69 73 69 6f 6e 20 52 2c 20 72 65 M revision R, re
3c20: 76 69 73 69 6f 6e 20 50 2c 20 66 69 6c 65 20 46 vision P, file F
3c30: 0a 09 09 57 48 45 52 45 20 52 2e 66 69 64 20 3d ...WHERE R.fid =
3c40: 20 46 2e 66 69 64 0a 09 09 41 4e 44 20 20 20 52 F.fid...AND R
3c50: 2e 62 70 61 72 65 6e 74 20 49 53 20 4e 55 4c 4c .bparent IS NULL
3c60: 0a 09 09 41 4e 44 20 20 20 52 2e 70 61 72 65 6e ...AND R.paren
3c70: 74 20 49 53 20 4e 4f 54 20 4e 55 4c 4c 0a 09 09 t IS NOT NULL...
3c80: 41 4e 44 20 20 20 52 2e 70 61 72 65 6e 74 20 3d AND R.parent =
3c90: 20 50 2e 72 69 64 0a 09 09 41 4e 44 20 20 20 50 P.rid...AND P
3ca0: 2e 63 68 69 6c 64 20 21 3d 20 52 2e 72 69 64 0a .child != R.rid.
3cb0: 09 09 3b 0a 09 20 20 20 20 7d 0a 09 23 20 46 69 ..;.. }..# Fi
3cc0: 6e 64 20 61 6c 6c 20 72 65 76 69 73 69 6f 6e 73 nd all revisions
3cd0: 20 77 69 74 68 20 61 20 62 72 61 6e 63 68 20 70 with a branch p
3ce0: 61 72 65 6e 74 20 73 79 6d 62 6f 6c 20 77 68 69 arent symbol whi
3cf0: 63 68 20 64 6f 20 6e 6f 74 0a 09 23 20 68 61 76 ch do not..# hav
3d00: 65 20 61 20 70 61 72 65 6e 74 2e 0a 09 43 68 65 e a parent...Che
3d10: 63 6b 20 5c 0a 09 20 20 20 20 7b 42 72 61 6e 63 ck \.. {Branc
3d20: 68 20 73 74 61 72 74 69 6e 67 20 72 65 76 69 73 h starting revis
3d30: 69 6f 6e 73 20 68 61 76 65 20 74 6f 20 68 61 76 ions have to hav
3d40: 65 20 61 20 70 61 72 65 6e 74 7d 20 5c 0a 09 20 e a parent} \..
3d50: 20 20 20 7b 61 74 20 74 68 65 20 62 65 67 69 6e {at the begin
3d60: 6e 69 6e 67 20 6f 66 20 69 74 73 20 62 72 61 6e ning of its bran
3d70: 63 68 20 68 61 73 20 6e 6f 20 70 61 72 65 6e 74 ch has no parent
3d80: 7d 20 7b 0a 09 09 53 45 4c 45 43 54 20 46 2e 6e } {...SELECT F.n
3d90: 61 6d 65 2c 20 52 2e 72 65 76 0a 09 09 46 52 4f ame, R.rev...FRO
3da0: 4d 20 72 65 76 69 73 69 6f 6e 20 52 2c 20 66 69 M revision R, fi
3db0: 6c 65 20 46 0a 09 09 57 48 45 52 45 20 52 2e 66 le F...WHERE R.f
3dc0: 69 64 20 3d 20 46 2e 66 69 64 0a 09 09 41 4e 44 id = F.fid...AND
3dd0: 20 20 20 52 2e 62 70 61 72 65 6e 74 20 49 53 20 R.bparent IS
3de0: 4e 4f 54 20 4e 55 4c 4c 0a 09 09 41 4e 44 20 20 NOT NULL...AND
3df0: 20 52 2e 70 61 72 65 6e 74 20 49 53 20 4e 55 4c R.parent IS NUL
3e00: 4c 0a 09 09 3b 0a 09 20 20 20 20 7d 0a 09 23 20 L...;.. }..#
3e10: 46 69 6e 64 20 61 6c 6c 20 72 65 76 69 73 69 6f Find all revisio
3e20: 6e 73 20 77 69 74 68 20 61 20 62 72 61 6e 63 68 ns with a branch
3e30: 20 70 61 72 65 6e 74 20 73 79 6d 62 6f 6c 20 77 parent symbol w
3e40: 68 6f 73 65 20 70 61 72 65 6e 74 0a 09 23 20 68 hose parent..# h
3e50: 61 73 20 74 68 65 6d 20 61 73 20 70 72 69 6d 61 as them as prima
3e60: 72 79 20 63 68 69 6c 64 2e 0a 09 43 68 65 63 6b ry child...Check
3e70: 20 5c 0a 09 20 20 20 20 7b 42 72 61 6e 63 68 20 \.. {Branch
3e80: 73 74 61 72 74 69 6e 67 20 72 65 76 69 73 69 6f starting revisio
3e90: 6e 73 20 6d 75 73 74 20 6e 6f 74 20 62 65 20 70 ns must not be p
3ea0: 72 69 6d 61 72 79 20 63 68 69 6c 64 72 65 6e 20 rimary children
3eb0: 6f 66 20 74 68 65 69 72 20 70 61 72 65 6e 74 73 of their parents
3ec0: 7d 20 5c 0a 09 20 20 20 20 7b 61 74 20 74 68 65 } \.. {at the
3ed0: 20 62 65 67 69 6e 6e 69 6e 67 20 6f 66 20 69 74 beginning of it
3ee0: 73 20 62 72 61 6e 63 68 20 69 73 20 74 68 65 20 s branch is the
3ef0: 70 72 69 6d 61 72 79 20 63 68 69 6c 64 20 6f 66 primary child of
3f00: 20 69 74 73 20 70 61 72 65 6e 74 7d 20 7b 0a 09 its parent} {..
3f10: 09 53 45 4c 45 43 54 20 46 2e 6e 61 6d 65 2c 20 .SELECT F.name,
3f20: 52 2e 72 65 76 0a 09 09 46 52 4f 4d 20 72 65 76 R.rev...FROM rev
3f30: 69 73 69 6f 6e 20 52 2c 20 72 65 76 69 73 69 6f ision R, revisio
3f40: 6e 20 50 2c 20 66 69 6c 65 20 46 0a 09 09 57 48 n P, file F...WH
3f50: 45 52 45 20 52 2e 66 69 64 20 3d 20 46 2e 66 69 ERE R.fid = F.fi
3f60: 64 0a 09 09 41 4e 44 20 20 20 52 2e 62 70 61 72 d...AND R.bpar
3f70: 65 6e 74 20 49 53 20 4e 4f 54 20 4e 55 4c 4c 0a ent IS NOT NULL.
3f80: 09 09 41 4e 44 20 20 20 52 2e 70 61 72 65 6e 74 ..AND R.parent
3f90: 20 49 53 20 4e 4f 54 20 4e 55 4c 4c 0a 09 09 41 IS NOT NULL...A
3fa0: 4e 44 20 20 20 52 2e 70 61 72 65 6e 74 20 3d 20 ND R.parent =
3fb0: 50 2e 72 69 64 0a 09 09 41 4e 44 20 20 20 50 2e P.rid...AND P.
3fc0: 63 68 69 6c 64 20 3d 20 52 2e 72 69 64 0a 09 09 child = R.rid...
3fd0: 3b 0a 09 20 20 20 20 7d 0a 09 23 20 46 69 6e 64 ;.. }..# Find
3fe0: 20 61 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 77 all revisions w
3ff0: 69 74 68 20 61 20 6e 6f 6e 2d 4e 54 44 42 20 63 ith a non-NTDB c
4000: 68 69 6c 64 20 77 68 69 63 68 20 61 72 65 20 6e hild which are n
4010: 6f 74 20 6f 6e 0a 09 23 20 74 68 65 20 4e 54 44 ot on..# the NTD
4020: 42 2e 0a 09 43 68 65 63 6b 20 5c 0a 09 20 20 20 B...Check \..
4030: 20 7b 4e 54 44 42 20 74 6f 20 74 72 75 6e 6b 20 {NTDB to trunk
4040: 74 72 61 6e 73 69 74 69 6f 6e 20 68 61 73 20 74 transition has t
4050: 6f 20 62 65 67 69 6e 20 6f 6e 20 4e 54 44 42 7d o begin on NTDB}
4060: 20 5c 0a 09 20 20 20 20 7b 68 61 73 20 61 20 6e \.. {has a n
4070: 6f 6e 2d 4e 54 44 42 20 63 68 69 6c 64 2c 20 79 on-NTDB child, y
4080: 65 74 20 69 73 20 6e 6f 74 20 6f 6e 20 74 68 65 et is not on the
4090: 20 4e 54 44 42 7d 20 7b 0a 09 09 53 45 4c 45 43 NTDB} {...SELEC
40a0: 54 20 46 2e 6e 61 6d 65 2c 20 52 2e 72 65 76 0a T F.name, R.rev.
40b0: 09 09 46 52 4f 4d 20 72 65 76 69 73 69 6f 6e 20 ..FROM revision
40c0: 52 2c 20 66 69 6c 65 20 46 0a 09 09 57 48 45 52 R, file F...WHER
40d0: 45 20 52 2e 66 69 64 20 3d 20 46 2e 66 69 64 0a E R.fid = F.fid.
40e0: 09 09 41 4e 44 20 20 20 52 2e 64 62 63 68 69 6c ..AND R.dbchil
40f0: 64 20 49 53 20 4e 4f 54 20 4e 55 4c 4c 0a 09 09 d IS NOT NULL...
4100: 41 4e 44 20 20 20 4e 4f 54 20 52 2e 69 73 64 65 AND NOT R.isde
4110: 66 61 75 6c 74 0a 09 09 3b 0a 09 20 20 20 20 7d fault...;.. }
4120: 0a 09 23 20 46 69 6e 64 20 61 6c 6c 20 72 65 76 ..# Find all rev
4130: 69 73 69 6f 6e 73 20 77 69 74 68 20 61 20 4e 54 isions with a NT
4140: 44 42 20 70 61 72 65 6e 74 20 77 68 69 63 68 20 DB parent which
4150: 61 72 65 20 6f 6e 20 74 68 65 20 4e 54 44 42 2e are on the NTDB.
4160: 0a 09 43 68 65 63 6b 20 5c 0a 09 20 20 20 20 7b ..Check \.. {
4170: 4e 54 44 42 20 74 6f 20 74 72 75 6e 6b 20 74 72 NTDB to trunk tr
4180: 61 6e 73 69 74 69 6f 6e 20 68 61 73 20 74 6f 20 ansition has to
4190: 65 6e 64 20 6f 6e 20 6e 6f 6e 2d 4e 54 44 42 7d end on non-NTDB}
41a0: 20 5c 0a 09 20 20 20 20 7b 68 61 73 20 61 20 4e \.. {has a N
41b0: 54 44 42 20 70 61 72 65 6e 74 2c 20 79 65 74 20 TDB parent, yet
41c0: 69 73 20 6f 6e 20 74 68 65 20 4e 54 44 42 7d 20 is on the NTDB}
41d0: 7b 0a 09 09 53 45 4c 45 43 54 20 46 2e 6e 61 6d {...SELECT F.nam
41e0: 65 2c 20 52 2e 72 65 76 0a 09 09 46 52 4f 4d 20 e, R.rev...FROM
41f0: 72 65 76 69 73 69 6f 6e 20 52 2c 20 66 69 6c 65 revision R, file
4200: 20 46 0a 09 09 57 48 45 52 45 20 52 2e 66 69 64 F...WHERE R.fid
4210: 20 3d 20 46 2e 66 69 64 0a 09 09 41 4e 44 20 20 = F.fid...AND
4220: 20 52 2e 64 62 70 61 72 65 6e 74 20 49 53 20 4e R.dbparent IS N
4230: 4f 54 20 4e 55 4c 4c 0a 09 09 41 4e 44 20 20 20 OT NULL...AND
4240: 52 2e 69 73 64 65 66 61 75 6c 74 0a 09 09 3b 0a R.isdefault...;.
4250: 09 20 20 20 20 7d 0a 09 23 20 46 69 6e 64 20 61 . }..# Find a
4260: 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 77 69 74 ll revisions wit
4270: 68 20 61 20 63 68 69 6c 64 20 77 68 69 63 68 20 h a child which
4280: 64 69 73 61 67 72 65 65 73 20 61 62 6f 75 74 20 disagrees about
4290: 74 68 65 0a 09 23 20 6c 69 6e 65 20 6f 66 20 64 the..# line of d
42a0: 65 76 65 6c 6f 70 6d 65 6e 74 20 74 68 65 79 20 evelopment they
42b0: 62 65 6c 6f 6e 67 20 74 6f 2e 0a 09 43 68 65 63 belong to...Chec
42c0: 6b 20 5c 0a 09 20 20 20 20 7b 52 65 76 69 73 69 k \.. {Revisi
42d0: 6f 6e 73 20 61 6e 64 20 74 68 65 69 72 20 70 72 ons and their pr
42e0: 69 6d 61 72 79 20 63 68 69 6c 64 72 65 6e 20 68 imary children h
42f0: 61 76 65 20 74 6f 20 62 65 20 69 6e 20 74 68 65 ave to be in the
4300: 20 73 61 6d 65 20 4c 4f 44 7d 20 5c 0a 09 20 20 same LOD} \..
4310: 20 20 7b 61 6e 64 20 69 74 73 20 70 72 69 6d 61 {and its prima
4320: 72 79 20 63 68 69 6c 64 20 64 69 73 61 67 72 65 ry child disagre
4330: 65 20 61 62 6f 75 74 20 74 68 65 69 72 20 4c 4f e about their LO
4340: 44 7d 20 7b 0a 09 09 53 45 4c 45 43 54 20 46 2e D} {...SELECT F.
4350: 6e 61 6d 65 2c 20 52 2e 72 65 76 0a 09 09 46 52 name, R.rev...FR
4360: 4f 4d 20 72 65 76 69 73 69 6f 6e 20 52 2c 20 72 OM revision R, r
4370: 65 76 69 73 69 6f 6e 20 43 2c 20 66 69 6c 65 20 evision C, file
4380: 46 0a 09 09 57 48 45 52 45 20 52 2e 66 69 64 20 F...WHERE R.fid
4390: 3d 20 46 2e 66 69 64 0a 09 09 41 4e 44 20 20 20 = F.fid...AND
43a0: 52 2e 63 68 69 6c 64 20 49 53 20 4e 4f 54 20 4e R.child IS NOT N
43b0: 55 4c 4c 0a 09 09 41 4e 44 20 20 20 52 2e 63 68 ULL...AND R.ch
43c0: 69 6c 64 20 3d 20 43 2e 72 69 64 0a 09 09 41 4e ild = C.rid...AN
43d0: 44 20 20 20 43 2e 6c 6f 64 20 21 3d 20 52 2e 6c D C.lod != R.l
43e0: 6f 64 0a 09 09 3b 0a 09 20 20 20 20 7d 0a 09 23 od...;.. }..#
43f0: 20 46 69 6e 64 20 61 6c 6c 20 72 65 76 69 73 69 Find all revisi
4400: 6f 6e 73 20 77 69 74 68 20 61 20 6e 6f 6e 2d 4e ons with a non-N
4410: 54 44 42 20 63 68 69 6c 64 20 77 68 69 63 68 20 TDB child which
4420: 61 67 72 65 65 73 20 61 62 6f 75 74 0a 09 23 20 agrees about..#
4430: 74 68 65 20 6c 69 6e 65 20 6f 66 20 64 65 76 65 the line of deve
4440: 6c 6f 70 6d 65 6e 74 20 74 68 65 79 20 62 65 6c lopment they bel
4450: 6f 6e 67 20 74 6f 2e 0a 09 43 68 65 63 6b 20 5c ong to...Check \
4460: 0a 09 20 20 20 20 7b 4e 54 44 42 20 61 6e 64 20 .. {NTDB and
4470: 74 72 75 6e 6b 20 72 65 76 69 73 69 6f 6e 73 20 trunk revisions
4480: 68 61 76 65 20 74 6f 20 62 65 20 69 6e 20 64 69 have to be in di
4490: 66 66 65 72 65 6e 74 20 4c 4f 44 73 7d 20 5c 0a fferent LODs} \.
44a0: 09 20 20 20 20 7b 6f 6e 20 4e 54 44 42 20 61 6e . {on NTDB an
44b0: 64 20 69 74 73 20 6e 6f 6e 2d 4e 54 44 42 20 63 d its non-NTDB c
44c0: 68 69 6c 64 20 77 72 6f 6e 67 6c 79 20 61 67 72 hild wrongly agr
44d0: 65 65 20 61 62 6f 75 74 20 74 68 65 69 72 20 4c ee about their L
44e0: 4f 44 7d 20 7b 0a 09 09 53 45 4c 45 43 54 20 46 OD} {...SELECT F
44f0: 2e 6e 61 6d 65 2c 20 52 2e 72 65 76 0a 09 09 46 .name, R.rev...F
4500: 52 4f 4d 20 72 65 76 69 73 69 6f 6e 20 52 2c 20 ROM revision R,
4510: 72 65 76 69 73 69 6f 6e 20 43 2c 20 66 69 6c 65 revision C, file
4520: 20 46 0a 09 09 57 48 45 52 45 20 52 2e 66 69 64 F...WHERE R.fid
4530: 20 3d 20 46 2e 66 69 64 0a 09 09 41 4e 44 20 20 = F.fid...AND
4540: 20 52 2e 64 62 63 68 69 6c 64 20 49 53 20 4e 4f R.dbchild IS NO
4550: 54 20 4e 55 4c 4c 0a 09 09 41 4e 44 20 20 20 52 T NULL...AND R
4560: 2e 64 62 63 68 69 6c 64 20 3d 20 43 2e 72 69 64 .dbchild = C.rid
4570: 0a 09 09 41 4e 44 20 20 20 43 2e 6c 6f 64 20 3d ...AND C.lod =
4580: 20 52 2e 6c 6f 64 0a 09 09 3b 0a 09 20 20 20 20 R.lod...;..
4590: 7d 0a 09 23 20 46 69 6e 64 20 61 6c 6c 20 72 65 }..# Find all re
45a0: 76 69 73 69 6f 6e 73 20 77 69 74 68 20 61 20 62 visions with a b
45b0: 72 61 6e 63 68 20 70 61 72 65 6e 74 20 73 79 6d ranch parent sym
45c0: 62 6f 6c 20 77 68 69 63 68 20 69 73 20 6e 6f 74 bol which is not
45d0: 0a 09 23 20 74 68 65 69 72 20 4c 4f 44 2e 0a 09 ..# their LOD...
45e0: 43 68 65 63 6b 20 5c 0a 09 20 20 20 20 7b 42 72 Check \.. {Br
45f0: 61 6e 63 68 20 73 74 61 72 74 69 6e 67 20 72 65 anch starting re
4600: 76 69 73 69 6f 6e 73 20 68 61 76 65 20 74 6f 20 visions have to
4610: 68 61 76 65 20 74 68 65 69 72 20 4c 4f 44 20 61 have their LOD a
4620: 73 20 62 72 61 6e 63 68 20 70 61 72 65 6e 74 20 s branch parent
4630: 73 79 6d 62 6f 6c 7d 20 5c 0a 09 20 20 20 20 7b symbol} \.. {
4640: 61 74 20 74 68 65 20 62 65 67 69 6e 6e 69 6e 67 at the beginning
4650: 20 6f 66 20 69 74 73 20 62 72 61 6e 63 68 20 64 of its branch d
4660: 6f 65 73 20 6e 6f 74 20 68 61 76 65 20 74 68 65 oes not have the
4670: 20 62 72 61 6e 63 68 20 73 79 6d 62 6f 6c 20 61 branch symbol a
4680: 73 20 69 74 73 20 4c 4f 44 7d 20 7b 0a 09 09 53 s its LOD} {...S
4690: 45 4c 45 43 54 20 46 2e 6e 61 6d 65 2c 20 52 2e ELECT F.name, R.
46a0: 72 65 76 0a 09 09 46 52 4f 4d 20 72 65 76 69 73 rev...FROM revis
46b0: 69 6f 6e 20 52 2c 20 66 69 6c 65 20 46 0a 09 09 ion R, file F...
46c0: 57 48 45 52 45 20 52 2e 66 69 64 20 3d 20 46 2e WHERE R.fid = F.
46d0: 66 69 64 0a 09 09 41 4e 44 20 20 20 52 2e 62 70 fid...AND R.bp
46e0: 61 72 65 6e 74 20 49 53 20 4e 4f 54 20 4e 55 4c arent IS NOT NUL
46f0: 4c 0a 09 09 41 4e 44 20 20 20 52 2e 6c 6f 64 20 L...AND R.lod
4700: 21 3d 20 52 2e 62 70 61 72 65 6e 74 0a 09 09 3b != R.bparent...;
4710: 0a 09 20 20 20 20 7d 0a 09 23 20 46 69 6e 64 20 .. }..# Find
4720: 61 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 77 69 all revisions wi
4730: 74 68 20 61 20 62 72 61 6e 63 68 20 70 61 72 65 th a branch pare
4740: 6e 74 20 73 79 6d 62 6f 6c 20 77 68 6f 73 65 20 nt symbol whose
4750: 70 61 72 65 6e 74 0a 09 23 20 69 73 20 69 6e 20 parent..# is in
4760: 74 68 65 20 73 61 6d 65 20 6c 69 6e 65 20 6f 66 the same line of
4770: 20 64 65 76 65 6c 6f 70 6d 65 6e 74 2e 0a 09 43 development...C
4780: 68 65 63 6b 20 5c 0a 09 20 20 20 20 7b 52 65 76 heck \.. {Rev
4790: 69 73 69 6f 6e 73 20 61 6e 64 20 74 68 65 69 72 isions and their
47a0: 20 62 72 61 6e 63 68 20 63 68 69 6c 64 72 65 6e branch children
47b0: 20 68 61 76 65 20 74 6f 20 62 65 20 69 6e 20 64 have to be in d
47c0: 69 66 66 65 72 65 6e 74 20 4c 4f 44 73 7d 20 5c ifferent LODs} \
47d0: 0a 09 20 20 20 20 7b 61 74 20 74 68 65 20 62 65 .. {at the be
47e0: 67 69 6e 6e 69 6e 67 20 6f 66 20 69 74 73 20 62 ginning of its b
47f0: 72 61 6e 63 68 20 61 6e 64 20 69 74 73 20 70 61 ranch and its pa
4800: 72 65 6e 74 20 77 72 6f 6e 67 6c 79 20 61 67 72 rent wrongly agr
4810: 65 65 20 61 62 6f 75 74 20 74 68 65 69 72 20 4c ee about their L
4820: 4f 44 7d 20 7b 0a 09 09 53 45 4c 45 43 54 20 46 OD} {...SELECT F
4830: 2e 6e 61 6d 65 2c 20 52 2e 72 65 76 0a 09 09 46 .name, R.rev...F
4840: 52 4f 4d 20 72 65 76 69 73 69 6f 6e 20 52 2c 20 ROM revision R,
4850: 72 65 76 69 73 69 6f 6e 20 50 2c 20 66 69 6c 65 revision P, file
4860: 20 46 0a 09 09 57 48 45 52 45 20 52 2e 66 69 64 F...WHERE R.fid
4870: 20 3d 20 46 2e 66 69 64 0a 09 09 41 4e 44 20 20 = F.fid...AND
4880: 20 52 2e 62 70 61 72 65 6e 74 20 49 53 20 4e 4f R.bparent IS NO
4890: 54 20 4e 55 4c 4c 0a 09 09 41 4e 44 20 20 20 52 T NULL...AND R
48a0: 2e 70 61 72 65 6e 74 20 3d 20 50 2e 72 69 64 0a .parent = P.rid.
48b0: 09 09 41 4e 44 20 20 20 52 2e 6c 6f 64 20 3d 20 ..AND R.lod =
48c0: 50 2e 6c 6f 64 0a 09 09 3b 0a 09 20 20 20 20 7d P.lod...;.. }
48d0: 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a ..return. }..
48e0: 20 20 20 20 70 72 6f 63 20 43 68 65 63 6b 20 7b proc Check {
48f0: 68 65 61 64 65 72 20 6c 61 62 65 6c 20 73 71 6c header label sql
4900: 7d 20 7b 0a 09 75 70 76 61 72 20 31 20 6e 20 6e } {..upvar 1 n n
4910: 0a 09 73 65 74 20 6f 6b 20 31 0a 09 66 6f 72 65 ..set ok 1..fore
4920: 61 63 68 20 7b 66 6e 61 6d 65 20 72 65 76 6e 72 ach {fname revnr
4930: 7d 20 5b 73 74 61 74 65 20 72 75 6e 20 24 73 71 } [state run $sq
4940: 6c 5d 20 7b 0a 09 20 20 20 20 73 65 74 20 6f 6b l] {.. set ok
4950: 20 30 0a 09 20 20 20 20 74 72 6f 75 62 6c 65 20 0.. trouble
4960: 66 61 74 61 6c 20 22 24 66 6e 61 6d 65 20 3c 24 fatal "$fname <$
4970: 72 65 76 6e 72 3e 20 24 6c 61 62 65 6c 22 0a 09 revnr> $label"..
4980: 7d 0a 09 6c 6f 67 20 77 72 69 74 65 20 35 20 63 }..log write 5 c
4990: 6f 6c 6c 72 65 76 20 22 5c 5b 5b 66 6f 72 6d 61 ollrev "\[[forma
49a0: 74 20 25 30 32 64 20 5b 69 6e 63 72 20 6e 5d 5d t %02d [incr n]]
49b0: 5c 5d 20 5b 65 78 70 72 20 7b 24 6f 6b 20 3f 20 \] [expr {$ok ?
49c0: 22 4f 6b 20 20 20 20 22 20 3a 20 22 46 61 69 6c "Ok " : "Fail
49d0: 65 64 22 7d 5d 20 2e 2e 2e 20 24 68 65 61 64 65 ed"}] ... $heade
49e0: 72 22 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 7d r"..return. }
49f0: 0a 0a 20 20 20 20 23 20 23 20 23 23 20 23 23 23 .. # # ## ###
4a00: 20 23 23 23 23 23 20 23 23 23 23 23 23 23 23 20 ##### ########
4a10: 23 23 23 23 23 23 23 23 23 23 23 23 23 0a 20 20 #############.
4a20: 20 20 23 23 20 49 6e 74 65 72 6e 61 6c 20 6d 65 ## Internal me
4a30: 74 68 6f 64 73 0a 0a 20 20 20 20 23 20 23 20 23 thods.. # # #
4a40: 23 20 23 23 23 20 23 23 23 23 23 20 23 23 23 23 # ### ##### ####
4a50: 23 23 23 23 20 23 23 23 23 23 23 23 23 23 23 23 #### ###########
4a60: 23 23 0a 20 20 20 20 23 23 20 43 6f 6e 66 69 67 ##. ## Config
4a70: 75 72 61 74 69 6f 6e 0a 0a 20 20 20 20 70 72 61 uration.. pra
4a80: 67 6d 61 20 2d 68 61 73 69 6e 73 74 61 6e 63 65 gma -hasinstance
4a90: 73 20 20 20 6e 6f 20 3b 20 23 20 73 69 6e 67 6c s no ; # singl
4aa0: 65 74 6f 6e 0a 20 20 20 20 70 72 61 67 6d 61 20 eton. pragma
4ab0: 2d 68 61 73 74 79 70 65 69 6e 66 6f 20 20 20 20 -hastypeinfo
4ac0: 6e 6f 20 3b 20 23 20 6e 6f 20 69 6e 74 72 6f 73 no ; # no intros
4ad0: 70 65 63 74 69 6f 6e 0a 20 20 20 20 70 72 61 67 pection. prag
4ae0: 6d 61 20 2d 68 61 73 74 79 70 65 64 65 73 74 72 ma -hastypedestr
4af0: 6f 79 20 6e 6f 20 3b 20 23 20 69 6d 6d 6f 72 74 oy no ; # immort
4b00: 61 6c 0a 0a 20 20 20 20 23 20 23 20 23 23 20 23 al.. # # ## #
4b10: 23 23 20 23 23 23 23 23 20 23 23 23 23 23 23 23 ## ##### #######
4b20: 23 20 23 23 23 23 23 23 23 23 23 23 23 23 23 0a # #############.
4b30: 7d 0a 0a 6e 61 6d 65 73 70 61 63 65 20 65 76 61 }..namespace eva
4b40: 6c 20 3a 3a 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a l ::vc::fossil::
4b50: 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 70 61 73 import::cvs::pas
4b60: 73 20 7b 0a 20 20 20 20 6e 61 6d 65 73 70 61 63 s {. namespac
4b70: 65 20 65 78 70 6f 72 74 20 63 6f 6c 6c 72 65 76 e export collrev
4b80: 0a 20 20 20 20 6e 61 6d 65 73 70 61 63 65 20 65 . namespace e
4b90: 76 61 6c 20 63 6f 6c 6c 72 65 76 20 7b 0a 09 6e val collrev {..n
4ba0: 61 6d 65 73 70 61 63 65 20 69 6d 70 6f 72 74 20 amespace import
4bb0: 3a 3a 76 63 3a 3a 72 63 73 3a 3a 70 61 72 73 65 ::vc::rcs::parse
4bc0: 72 0a 09 6e 61 6d 65 73 70 61 63 65 20 69 6d 70 r..namespace imp
4bd0: 6f 72 74 20 3a 3a 76 63 3a 3a 66 6f 73 73 69 6c ort ::vc::fossil
4be0: 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 72 ::import::cvs::r
4bf0: 65 70 6f 73 69 74 6f 72 79 0a 09 6e 61 6d 65 73 epository..names
4c00: 70 61 63 65 20 69 6d 70 6f 72 74 20 3a 3a 76 63 pace import ::vc
4c10: 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 ::fossil::import
4c20: 3a 3a 63 76 73 3a 3a 73 74 61 74 65 0a 09 6e 61 ::cvs::state..na
4c30: 6d 65 73 70 61 63 65 20 69 6d 70 6f 72 74 20 3a mespace import :
4c40: 3a 76 63 3a 3a 74 6f 6f 6c 73 3a 3a 74 72 6f 75 :vc::tools::trou
4c50: 62 6c 65 0a 09 6e 61 6d 65 73 70 61 63 65 20 69 ble..namespace i
4c60: 6d 70 6f 72 74 20 3a 3a 76 63 3a 3a 74 6f 6f 6c mport ::vc::tool
4c70: 73 3a 3a 6c 6f 67 0a 09 6c 6f 67 20 72 65 67 69 s::log..log regi
4c80: 73 74 65 72 20 63 6f 6c 6c 72 65 76 0a 20 20 20 ster collrev.
4c90: 20 7d 0a 7d 0a 0a 23 20 23 20 23 23 20 23 23 23 }.}..# # ## ###
4ca0: 20 23 23 23 23 23 20 23 23 23 23 23 23 23 23 20 ##### ########
4cb0: 23 23 23 23 23 23 23 23 23 23 23 23 23 20 23 23 ############# ##
4cc0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
4cd0: 23 23 23 0a 23 23 20 52 65 61 64 79 0a 0a 70 61 ###.## Ready..pa
4ce0: 63 6b 61 67 65 20 70 72 6f 76 69 64 65 20 76 63 ckage provide vc
4cf0: 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 ::fossil::import
4d00: 3a 3a 63 76 73 3a 3a 70 61 73 73 3a 3a 63 6f 6c ::cvs::pass::col
4d10: 6c 72 65 76 20 31 2e 30 0a 72 65 74 75 72 6e 0a lrev 1.0.return.