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 65 63 parses the colec
0220: 74 65 64 20 72 63 73 20 61 72 63 68 69 76 65 73 ted rcs archives
0230: 20 61 6e 64 20 65 78 74 72 61 63 74 73 0a 23 23 and extracts.##
0240: 20 61 6c 6c 20 74 68 65 20 69 6e 66 6f 72 6d 61 all the informa
0250: 74 69 6f 6e 20 74 68 65 79 20 63 6f 6e 74 61 69 tion they contai
0260: 6e 20 28 72 65 76 69 73 69 6f 6e 73 2c 20 61 6e n (revisions, an
0270: 64 20 73 79 6d 62 6f 6c 73 29 2e 0a 0a 23 20 23 d symbols)...# #
0280: 20 23 23 20 23 23 23 20 23 23 23 23 23 20 23 23 ## ### ##### ##
0290: 23 23 23 23 23 23 20 23 23 23 23 23 23 23 23 23 ###### #########
02a0: 23 23 23 23 20 23 23 23 23 23 23 23 23 23 23 23 #### ###########
02b0: 23 23 23 23 23 23 23 23 23 23 0a 23 23 20 52 65 ##########.## Re
02c0: 71 75 69 72 65 6d 65 6e 74 73 0a 0a 70 61 63 6b quirements..pack
02d0: 61 67 65 20 72 65 71 75 69 72 65 20 54 63 6c 20 age require Tcl
02e0: 38 2e 34 20 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: 3b 20 23 20 52 65 71 75 69 72 65 64 20 72 75 6e ; # Required run
0310: 74 69 6d 65 2e 0a 70 61 63 6b 61 67 65 20 72 65 time..package re
0320: 71 75 69 72 65 20 73 6e 69 74 20 20 20 20 20 20 quire 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 3b 20 23 20 4f 4f ; # OO
0350: 20 73 79 73 74 65 6d 2e 0a 70 61 63 6b 61 67 65 system..package
0360: 20 72 65 71 75 69 72 65 20 66 69 6c 65 75 74 69 require fileuti
0370: 6c 3a 3a 74 72 61 76 65 72 73 65 20 20 20 20 20 l::traverse
0380: 20 20 20 20 20 20 20 20 20 20 20 20 20 3b 20 23 ; #
0390: 20 44 69 72 65 63 74 6f 72 79 20 74 72 61 76 65 Directory trave
03a0: 72 73 61 6c 2e 0a 70 61 63 6b 61 67 65 20 72 65 rsal..package re
03b0: 71 75 69 72 65 20 66 69 6c 65 75 74 69 6c 20 20 quire fileutil
03c0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
03d0: 20 20 20 20 20 20 20 20 20 20 3b 20 23 20 46 69 ; # Fi
03e0: 6c 65 20 26 20 70 61 74 68 20 75 74 69 6c 69 74 le & path utilit
03f0: 69 65 73 2e 0a 70 61 63 6b 61 67 65 20 72 65 71 ies..package req
0400: 75 69 72 65 20 76 63 3a 3a 74 6f 6f 6c 73 3a 3a uire vc::tools::
0410: 74 72 6f 75 62 6c 65 20 20 20 20 20 20 20 20 20 trouble
0420: 20 20 20 20 20 20 20 20 20 3b 20 23 20 45 72 72 ; # Err
0430: 6f 72 20 72 65 70 6f 72 74 69 6e 67 2e 0a 70 61 or reporting..pa
0440: 63 6b 61 67 65 20 72 65 71 75 69 72 65 20 76 63 ckage require vc
0450: 3a 3a 74 6f 6f 6c 73 3a 3a 6c 6f 67 20 20 20 20 ::tools::log
0460: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0470: 20 20 3b 20 23 20 55 73 65 72 20 66 65 65 64 62 ; # User feedb
0480: 61 63 6b 2e 0a 70 61 63 6b 61 67 65 20 72 65 71 ack..package req
0490: 75 69 72 65 20 76 63 3a 3a 66 6f 73 73 69 6c 3a uire vc::fossil:
04a0: 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 70 61 :import::cvs::pa
04b0: 73 73 20 20 20 20 20 20 20 3b 20 23 20 50 61 73 ss ; # Pas
04c0: 73 20 6d 61 6e 61 67 65 6d 65 6e 74 2e 0a 70 61 s management..pa
04d0: 63 6b 61 67 65 20 72 65 71 75 69 72 65 20 76 63 ckage require vc
04e0: 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 ::fossil::import
04f0: 3a 3a 63 76 73 3a 3a 72 65 70 6f 73 69 74 6f 72 ::cvs::repositor
0500: 79 20 3b 20 23 20 52 65 70 6f 73 69 74 6f 72 79 y ; # Repository
0510: 20 6d 61 6e 61 67 65 6d 65 6e 74 2e 0a 70 61 63 management..pac
0520: 6b 61 67 65 20 72 65 71 75 69 72 65 20 76 63 3a kage require vc:
0530: 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a :fossil::import:
0540: 3a 63 76 73 3a 3a 73 74 61 74 65 20 20 20 20 20 :cvs::state
0550: 20 3b 20 23 20 53 74 61 74 65 20 73 74 6f 72 61 ; # State stora
0560: 67 65 2e 0a 70 61 63 6b 61 67 65 20 72 65 71 75 ge..package requ
0570: 69 72 65 20 76 63 3a 3a 72 63 73 3a 3a 70 61 72 ire vc::rcs::par
0580: 73 65 72 20 20 20 20 20 20 20 20 20 20 20 20 20 ser
0590: 20 20 20 20 20 20 20 20 3b 20 23 20 52 63 73 20 ; # Rcs
05a0: 61 72 63 68 69 76 65 20 64 61 74 61 20 65 78 74 archive data ext
05b0: 72 61 63 74 69 6f 6e 2e 0a 0a 23 20 23 20 23 23 raction...# # ##
05c0: 20 23 23 23 20 23 23 23 23 23 20 23 23 23 23 23 ### ##### #####
05d0: 23 23 23 20 23 23 23 23 23 23 23 23 23 23 23 23 ### ############
05e0: 23 20 23 23 23 23 23 23 23 23 23 23 23 23 23 23 # ##############
05f0: 23 23 23 23 23 23 23 0a 23 23 20 52 65 67 69 73 #######.## Regis
0600: 74 65 72 20 74 68 65 20 70 61 73 73 20 77 69 74 ter the pass wit
0610: 68 20 74 68 65 20 6d 61 6e 61 67 65 6d 65 6e 74 h the management
0620: 0a 0a 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d ..vc::fossil::im
0630: 70 6f 72 74 3a 3a 63 76 73 3a 3a 70 61 73 73 20 port::cvs::pass
0640: 64 65 66 69 6e 65 20 5c 0a 20 20 20 20 43 6f 6c define \. Col
0650: 6c 65 63 74 52 65 76 20 5c 0a 20 20 20 20 7b 43 lectRev \. {C
0660: 6f 6c 6c 65 63 74 20 72 65 76 69 73 69 6f 6e 73 ollect revisions
0670: 20 61 6e 64 20 73 79 6d 62 6f 6c 73 7d 20 5c 0a and symbols} \.
0680: 20 20 20 20 3a 3a 76 63 3a 3a 66 6f 73 73 69 6c ::vc::fossil
0690: 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 70 ::import::cvs::p
06a0: 61 73 73 3a 3a 63 6f 6c 6c 72 65 76 0a 0a 23 20 ass::collrev..#
06b0: 23 20 23 23 20 23 23 23 20 23 23 23 23 23 20 23 # ## ### ##### #
06c0: 23 23 23 23 23 23 23 20 23 23 23 23 23 23 23 23 ####### ########
06d0: 23 23 23 23 23 20 23 23 23 23 23 23 23 23 23 23 ##### ##########
06e0: 23 23 23 23 23 23 23 23 23 23 23 0a 23 23 20 0a ###########.## .
06f0: 0a 73 6e 69 74 3a 3a 74 79 70 65 20 3a 3a 76 63 .snit::type ::vc
0700: 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 ::fossil::import
0710: 3a 3a 63 76 73 3a 3a 70 61 73 73 3a 3a 63 6f 6c ::cvs::pass::col
0720: 6c 72 65 76 20 7b 0a 20 20 20 20 23 20 23 20 23 lrev {. # # #
0730: 23 20 23 23 23 20 23 23 23 23 23 20 23 23 23 23 # ### ##### ####
0740: 23 23 23 23 20 23 23 23 23 23 23 23 23 23 23 23 #### ###########
0750: 23 23 0a 20 20 20 20 23 23 20 50 75 62 6c 69 63 ##. ## Public
0760: 20 41 50 49 0a 0a 20 20 20 20 74 79 70 65 6d 65 API.. typeme
0770: 74 68 6f 64 20 73 65 74 75 70 20 7b 7d 20 7b 0a thod setup {} {.
0780: 09 23 20 44 65 66 69 6e 65 20 6e 61 6d 65 73 20 .# Define names
0790: 61 6e 64 20 73 74 72 75 63 74 75 72 65 20 6f 66 and structure of
07a0: 20 74 68 65 20 70 65 72 73 69 73 74 65 6e 74 20 the persistent
07b0: 73 74 61 74 65 20 6f 66 20 74 68 69 73 0a 09 23 state of this..#
07c0: 20 70 61 73 73 2e 0a 0a 09 73 74 61 74 65 20 72 pass....state r
07d0: 65 61 64 69 6e 67 20 70 72 6f 6a 65 63 74 0a 09 eading project..
07e0: 73 74 61 74 65 20 72 65 61 64 69 6e 67 20 66 69 state reading fi
07f0: 6c 65 0a 0a 09 23 20 57 65 20 64 65 61 6c 20 77 le...# We deal w
0800: 69 74 68 20 70 65 72 20 70 72 6f 6a 65 63 74 20 ith per project
0810: 61 6e 64 20 70 65 72 20 66 69 6c 65 20 64 61 74 and per file dat
0820: 61 2c 20 74 68 65 20 66 69 72 73 74 0a 09 23 20 a, the first..#
0830: 63 6f 6c 6c 61 74 65 64 20 66 72 6f 6d 20 74 68 collated from th
0840: 65 20 73 65 63 6f 6e 64 2e 0a 0a 09 23 20 50 65 e second....# Pe
0850: 72 20 66 69 6c 65 20 77 65 20 68 61 76 65 20 67 r file we have g
0860: 65 6e 65 72 61 6c 20 69 6e 66 6f 72 6d 61 74 69 eneral informati
0870: 6f 6e 2c 20 2e 2e 2e 2c 20 61 6e 64 20 74 68 65 on, ..., and the
0880: 6e 0a 09 23 20 72 65 76 69 73 69 6f 6e 73 20 61 n..# revisions a
0890: 6e 64 20 73 79 6d 62 6f 6c 73 2e 20 54 68 65 20 nd symbols. The
08a0: 6c 61 74 74 65 72 20 63 61 6e 20 62 65 20 66 75 latter can be fu
08b0: 72 74 68 65 72 20 73 65 70 61 72 61 74 65 64 0a rther separated.
08c0: 09 23 20 69 6e 74 6f 20 74 61 67 73 20 61 6e 64 .# into tags and
08d0: 20 62 72 61 6e 63 68 65 73 2e 20 41 74 20 70 72 branches. At pr
08e0: 6f 6a 65 63 74 20 6c 65 76 65 6c 20 74 68 65 20 oject level the
08f0: 70 65 72 2d 66 69 6c 65 0a 09 23 20 73 79 6d 62 per-file..# symb
0900: 6f 6c 73 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 ols information
0910: 69 73 20 6d 65 72 67 65 64 2e 0a 0a 09 23 20 46 is merged....# F
0920: 69 6c 65 20 6c 65 76 65 6c 20 2e 2e 2e 0a 09 23 ile level .....#
0930: 09 52 65 76 69 73 69 6f 6e 73 2c 20 42 72 61 6e .Revisions, Bran
0940: 63 68 65 73 2c 20 54 61 67 73 0a 09 23 0a 09 23 ches, Tags..#..#
0950: 20 50 73 65 75 64 6f 20 63 6c 61 73 73 20 68 69 Pseudo class hi
0960: 65 72 61 72 63 68 79 0a 09 23 09 54 61 67 20 20 erarchy..#.Tag
0970: 20 20 20 20 3c 2d 20 53 79 6d 62 6f 6c 20 3c 2d <- Symbol <-
0980: 20 45 76 65 6e 74 0a 09 23 09 42 72 61 6e 63 68 Event..#.Branch
0990: 20 20 20 3c 2d 20 53 79 6d 62 6f 6c 20 3c 2d 20 <- Symbol <-
09a0: 45 76 65 6e 74 0a 09 23 09 52 65 76 69 73 69 6f Event..#.Revisio
09b0: 6e 20 20 20 20 20 20 20 20 20 20 20 3c 2d 20 45 n <- E
09c0: 76 65 6e 74 0a 0a 09 73 74 61 74 65 20 77 72 69 vent...state wri
09d0: 74 69 6e 67 20 72 65 76 69 73 69 6f 6e 20 7b 0a ting revision {.
09e0: 09 20 20 20 20 2d 2d 20 52 65 76 69 73 69 6f 6e . -- Revision
09f0: 73 2e 20 49 64 65 6e 74 69 66 69 65 64 20 62 79 s. Identified by
0a00: 20 61 20 67 6c 6f 62 61 6c 20 6e 75 6d 65 72 69 a global numeri
0a10: 63 20 69 64 20 65 61 63 68 0a 09 20 20 20 20 2d c id each.. -
0a20: 2d 20 62 65 6c 6f 6e 67 73 20 74 6f 20 61 20 73 - belongs to a s
0a30: 69 6e 67 6c 65 20 66 69 6c 65 2c 20 69 64 65 6e ingle file, iden
0a40: 74 69 66 69 65 64 20 62 79 20 69 74 73 20 69 64 tified by its id
0a50: 2e 20 49 74 0a 09 20 20 20 20 2d 2d 20 66 75 72 . It.. -- fur
0a60: 74 68 65 72 20 68 61 73 20 61 20 64 6f 74 74 65 ther has a dotte
0a70: 64 20 72 65 76 69 73 69 6f 6e 20 6e 75 6d 62 65 d revision numbe
0a80: 72 20 28 44 54 4e 29 2e 0a 09 20 20 20 20 2d 2d r (DTN)... --
0a90: 0a 09 20 20 20 20 2d 2d 20 43 6f 6e 73 74 72 61 .. -- Constra
0aa0: 69 6e 74 3a 20 54 68 65 20 64 6f 74 74 65 64 20 int: The dotted
0ab0: 72 65 76 69 73 69 6f 6e 20 6e 75 6d 62 65 72 20 revision number
0ac0: 69 73 20 75 6e 69 71 75 65 20 77 69 74 68 69 6e is unique within
0ad0: 0a 20 20 20 20 20 20 20 20 20 20 20 20 2d 2d 20 . --
0ae0: 20 20 20 20 20 20 20 20 20 20 20 20 74 68 65 20 the
0af0: 66 69 6c 65 2e 20 53 65 65 20 65 6e 64 20 6f 66 file. See end of
0b00: 20 64 65 66 69 6e 69 74 69 6f 6e 2e 0a 0a 09 20 definition....
0b10: 20 20 20 72 69 64 20 20 49 4e 54 45 47 45 52 20 rid INTEGER
0b20: 20 4e 4f 54 20 4e 55 4c 4c 20 20 50 52 49 4d 41 NOT NULL PRIMA
0b30: 52 59 20 4b 45 59 20 41 55 54 4f 49 4e 43 52 45 RY KEY AUTOINCRE
0b40: 4d 45 4e 54 2c 0a 09 20 20 20 20 66 69 64 20 20 MENT,.. fid
0b50: 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c INTEGER NOT NUL
0b60: 4c 20 20 52 45 46 45 52 45 4e 43 45 53 20 66 69 L REFERENCES fi
0b70: 6c 65 2c 20 20 20 2d 2d 20 46 69 6c 65 20 6f 77 le, -- File ow
0b80: 6e 69 6e 67 20 72 65 76 69 73 69 6f 6e 2e 0a 09 ning revision...
0b90: 20 20 20 20 72 65 76 20 20 54 45 58 54 20 20 20 rev TEXT
0ba0: 20 20 4e 4f 54 20 4e 55 4c 4c 2c 20 20 20 20 20 NOT NULL,
0bb0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2d -
0bc0: 2d 20 44 6f 74 74 65 64 20 52 65 76 20 4e 75 6d - Dotted Rev Num
0bd0: 62 65 72 2e 0a 0a 09 20 20 20 20 2d 2d 20 41 6c ber.... -- Al
0be0: 6c 20 72 65 76 69 73 69 6f 6e 73 20 62 65 6c 6f l revisions belo
0bf0: 6e 67 20 74 6f 20 61 20 6c 69 6e 65 2d 6f 66 2d ng to a line-of-
0c00: 64 65 76 65 6c 6f 70 6d 65 6e 74 2c 0a 09 20 20 development,..
0c10: 20 20 2d 2d 20 69 64 65 6e 74 69 66 69 65 64 20 -- identified
0c20: 62 79 20 61 20 73 79 6d 62 6f 6c 20 28 70 72 6f by a symbol (pro
0c30: 6a 65 63 74 20 6c 65 76 65 6c 29 2e 20 44 75 72 ject level). Dur
0c40: 69 6e 67 20 64 61 74 61 0a 09 20 20 20 20 2d 2d ing data.. --
0c50: 20 63 6f 6c 6c 65 63 74 69 6f 6e 20 69 74 20 77 collection it w
0c60: 61 73 20 61 20 66 69 6c 65 2d 6c 65 76 65 6c 20 as a file-level
0c70: 62 72 61 6e 63 68 20 73 79 6d 62 6f 6c 2e 0a 09 branch symbol...
0c80: 20 20 20 20 2d 2d 0a 09 20 20 20 20 2d 2d 20 43 --.. -- C
0c90: 6f 6e 73 74 72 61 69 6e 74 3a 20 41 6c 6c 20 74 onstraint: All t
0ca0: 68 65 20 4c 4f 44 20 73 79 6d 62 6f 6c 73 20 61 he LOD symbols a
0cb0: 72 65 20 69 6e 20 74 68 65 20 73 61 6d 65 20 70 re in the same p
0cc0: 72 6f 6a 65 63 74 0a 09 20 20 20 20 2d 2d 20 20 roject.. --
0cd0: 20 20 20 20 20 20 20 20 20 20 20 61 73 20 74 68 as th
0ce0: 65 20 66 69 6c 65 20 69 74 73 65 6c 66 2e 20 54 e file itself. T
0cf0: 68 69 73 20 63 61 6e 6e 6f 74 20 62 65 0a 09 20 his cannot be..
0d00: 20 20 20 2d 2d 20 20 20 20 20 20 20 20 20 20 20 --
0d10: 20 20 65 78 70 72 65 73 73 65 64 20 69 6e 20 43 expressed in C
0d20: 52 45 41 54 45 20 54 41 42 4c 45 20 73 79 6e 74 REATE TABLE synt
0d30: 61 78 2e 0a 0a 09 20 20 20 20 6c 6f 64 20 20 49 ax.... lod I
0d40: 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c NTEGER NOT NULL
0d50: 20 20 52 45 46 45 52 45 4e 43 45 53 20 73 79 6d REFERENCES sym
0d60: 62 6f 6c 2c 20 2d 2d 20 4c 69 6e 65 20 6f 66 20 bol, -- Line of
0d70: 64 65 76 65 6c 6f 70 6d 65 6e 74 0a 0a 09 20 20 development...
0d80: 20 20 2d 2d 20 54 68 65 20 72 65 76 69 73 69 6f -- The revisio
0d90: 6e 73 20 69 6e 20 61 20 66 69 6c 65 20 61 72 65 ns in a file are
0da0: 20 6f 72 67 61 6e 69 7a 65 64 20 69 6e 20 61 20 organized in a
0db0: 66 6f 72 65 73 74 20 6f 66 0a 09 20 20 20 20 2d forest of.. -
0dc0: 2d 20 74 72 65 65 73 2c 20 77 69 74 68 20 74 68 - trees, with th
0dd0: 65 20 6d 61 69 6e 20 6c 69 6e 65 73 20 64 65 66 e main lines def
0de0: 69 6e 65 64 20 74 68 72 6f 75 67 68 20 74 68 65 ined through the
0df0: 20 70 61 72 65 6e 74 20 2f 0a 09 20 20 20 20 2d parent /.. -
0e00: 2d 20 63 68 69 6c 64 20 72 65 66 65 72 65 6e 63 - child referenc
0e10: 65 73 2e 20 41 20 72 65 76 69 73 69 6f 6e 20 77 es. A revision w
0e20: 69 74 68 6f 75 74 20 61 20 70 61 72 65 6e 74 20 ithout a parent
0e30: 69 73 20 74 68 65 0a 09 20 20 20 20 2d 2d 20 72 is the.. -- r
0e40: 6f 6f 74 20 6f 66 20 61 20 74 72 65 65 2c 20 61 oot of a tree, a
0e50: 6e 64 20 61 20 72 65 76 69 73 69 6f 6e 20 77 69 nd a revision wi
0e60: 74 68 6f 75 74 20 61 20 63 68 69 6c 64 20 69 73 thout a child is
0e70: 20 61 0a 09 20 20 20 20 2d 2d 20 6c 65 61 66 2e a.. -- leaf.
0e80: 0a 0a 09 20 20 20 20 2d 2d 20 43 6f 6e 73 74 72 ... -- Constr
0e90: 61 69 6e 74 73 3a 20 41 6c 6c 20 72 65 76 69 73 aints: All revis
0ea0: 69 6f 6e 73 20 63 6f 75 70 6c 65 64 20 74 68 72 ions coupled thr
0eb0: 6f 75 67 68 20 70 61 72 65 6e 74 2f 63 68 69 6c ough parent/chil
0ec0: 64 0a 09 20 20 20 20 2d 2d 20 20 20 20 20 20 20 d.. --
0ed0: 20 20 20 20 20 20 20 72 65 66 65 72 20 74 6f 20 refer to
0ee0: 74 68 65 20 73 61 6d 65 20 4c 4f 44 20 73 79 6d the same LOD sym
0ef0: 62 6f 6c 2e 20 54 68 65 20 70 61 72 65 6e 74 0a bol. The parent.
0f00: 09 20 20 20 20 2d 2d 20 20 20 20 20 20 20 20 20 . --
0f10: 20 20 20 20 20 6f 66 20 61 20 63 68 69 6c 64 20 of a child
0f20: 6f 66 20 58 20 69 73 20 58 2e 20 54 68 65 20 63 of X is X. The c
0f30: 68 69 6c 64 20 6f 66 20 61 0a 09 20 20 20 20 2d hild of a.. -
0f40: 2d 20 20 20 20 20 20 20 20 20 20 20 20 20 20 70 - p
0f50: 61 72 65 6e 74 20 6f 66 20 58 20 69 73 20 58 2e arent of X is X.
0f60: 0a 0a 09 20 20 20 20 70 61 72 65 6e 74 20 20 49 ... parent I
0f70: 4e 54 45 47 45 52 20 20 20 20 20 20 20 20 20 20 NTEGER
0f80: 20 20 52 45 46 45 52 45 4e 43 45 53 20 72 65 76 REFERENCES rev
0f90: 69 73 69 6f 6e 2c 0a 09 20 20 20 20 63 68 69 6c ision,.. chil
0fa0: 64 20 20 20 49 4e 54 45 47 45 52 20 20 20 20 20 d INTEGER
0fb0: 20 20 20 20 20 20 20 52 45 46 45 52 45 4e 43 45 REFERENCE
0fc0: 53 20 72 65 76 69 73 69 6f 6e 2c 0a 0a 09 20 20 S revision,...
0fd0: 20 20 2d 2d 20 54 68 65 20 72 65 70 72 65 73 65 -- The represe
0fe0: 6e 74 61 74 69 6f 6e 20 6f 66 20 61 20 62 72 61 ntation of a bra
0ff0: 6e 63 68 20 69 6e 20 61 20 74 72 65 65 20 69 73 nch in a tree is
1000: 20 74 68 65 0a 09 20 20 20 20 2d 2d 20 65 78 63 the.. -- exc
1010: 65 70 74 69 6f 6e 20 74 6f 20 74 68 65 20 74 68 eption to the th
1020: 72 65 65 20 63 6f 6e 73 74 72 61 69 6e 74 73 20 ree constraints
1030: 61 62 6f 76 65 2e 0a 0a 09 20 20 20 20 2d 2d 20 above.... --
1040: 54 68 65 20 62 65 67 69 6e 6e 69 6e 67 20 6f 66 The beginning of
1050: 20 61 20 62 72 61 6e 63 68 20 69 73 20 72 65 70 a branch is rep
1060: 72 65 73 65 6e 74 65 64 20 62 79 20 61 20 6e 6f resented by a no
1070: 6e 2d 4e 55 4c 4c 0a 09 20 20 20 20 2d 2d 20 62 n-NULL.. -- b
1080: 70 61 72 65 6e 74 20 6f 66 20 61 20 72 65 76 69 parent of a revi
1090: 73 69 6f 6e 2e 20 54 68 69 73 20 72 65 76 69 73 sion. This revis
10a0: 69 6f 6e 20 42 20 69 73 20 74 68 65 20 66 69 72 ion B is the fir
10b0: 73 74 20 6f 6e 0a 09 20 20 20 20 2d 2d 20 74 68 st on.. -- th
10c0: 65 20 62 72 61 6e 63 68 2e 20 49 74 73 20 70 61 e branch. Its pa
10d0: 72 65 6e 74 20 50 20 69 73 20 74 68 65 20 72 65 rent P is the re
10e0: 76 69 73 69 6f 6e 20 74 68 65 20 62 72 61 6e 63 vision the branc
10f0: 68 20 69 73 0a 09 20 20 20 20 2d 2d 20 72 6f 6f h is.. -- roo
1100: 74 65 64 20 69 6e 2c 20 61 6e 64 20 69 74 20 69 ted in, and it i
1110: 73 20 6e 6f 74 20 74 68 65 20 63 68 69 6c 64 20 s not the child
1120: 6f 66 20 50 2e 20 42 20 61 6e 64 20 50 20 72 65 of P. B and P re
1130: 66 65 72 0a 09 20 20 20 20 2d 2d 20 74 6f 20 64 fer.. -- to d
1140: 69 66 66 65 72 65 6e 74 20 4c 4f 44 20 73 79 6d ifferent LOD sym
1150: 62 6f 6c 73 2e 20 54 68 65 20 62 70 61 72 65 6e bols. The bparen
1160: 74 20 6f 66 20 42 20 69 73 20 61 6c 73 6f 20 69 t of B is also i
1170: 74 73 0a 09 20 20 20 20 2d 2d 20 4c 4f 44 2c 20 ts.. -- LOD,
1180: 61 6e 64 20 74 68 65 20 4c 4f 44 20 6f 66 20 69 and the LOD of i
1190: 74 73 20 63 68 69 6c 64 72 65 6e 2e 0a 0a 09 20 ts children....
11a0: 20 20 20 62 70 61 72 65 6e 74 20 49 4e 54 45 47 bparent INTEG
11b0: 45 52 20 20 20 20 20 20 20 20 20 20 20 20 52 45 ER RE
11c0: 46 45 52 45 4e 43 45 53 20 73 79 6d 62 6f 6c 2c FERENCES symbol,
11d0: 0a 0a 09 20 20 20 20 2d 2d 20 4c 61 73 74 6c 79 ... -- Lastly
11e0: 20 77 65 20 6b 65 65 70 20 69 6e 66 6f 72 6d 61 we keep informa
11f0: 74 69 6f 6e 20 69 73 20 61 62 6f 75 74 20 6e 6f tion is about no
1200: 6e 2d 74 72 75 6e 6b 20 64 65 66 61 75 6c 74 0a n-trunk default.
1210: 09 20 20 20 20 2d 2d 20 62 72 61 6e 63 68 65 73 . -- branches
1220: 20 28 4e 54 44 42 29 20 69 6e 20 74 68 65 20 72 (NTDB) in the r
1230: 65 76 69 73 69 6f 6e 73 2e 0a 0a 09 20 20 20 20 evisions....
1240: 2d 2d 20 41 6c 6c 20 72 65 76 69 73 69 6f 6e 73 -- All revisions
1250: 20 6f 6e 20 74 68 65 20 4e 54 44 42 20 68 61 76 on the NTDB hav
1260: 65 20 27 69 73 64 65 66 61 75 6c 74 27 20 54 52 e 'isdefault' TR
1270: 55 45 2c 0a 09 20 20 20 20 2d 2d 20 65 76 65 72 UE,.. -- ever
1280: 79 6f 6e 65 20 65 6c 73 65 20 46 41 4c 53 45 2e yone else FALSE.
1290: 20 54 68 65 20 6c 61 73 74 20 72 65 76 69 73 69 The last revisi
12a0: 6f 6e 20 58 20 6f 6e 20 74 68 65 20 4e 54 44 42 on X on the NTDB
12b0: 0a 09 20 20 20 20 2d 2d 20 77 68 69 63 68 20 69 .. -- which i
12c0: 73 20 73 74 69 6c 6c 20 63 6f 6e 73 69 64 65 72 s still consider
12d0: 65 64 20 74 6f 20 62 65 20 6f 6e 20 74 68 65 20 ed to be on the
12e0: 74 72 75 6e 6b 20 61 73 20 77 65 6c 6c 0a 09 20 trunk as well..
12f0: 20 20 20 2d 2d 20 68 61 73 20 61 20 6e 6f 6e 2d -- has a non-
1300: 4e 55 4c 4c 20 27 64 62 63 68 69 6c 64 27 20 77 NULL 'dbchild' w
1310: 68 69 63 68 20 72 65 66 65 72 73 20 74 6f 20 74 hich refers to t
1320: 68 65 20 72 6f 6f 74 20 6f 66 0a 09 20 20 20 20 he root of..
1330: 2d 2d 20 74 68 65 20 74 72 75 6e 6b 2e 20 54 68 -- the trunk. Th
1340: 65 20 72 6f 6f 74 20 61 6c 73 6f 20 68 61 73 20 e root also has
1350: 61 20 6e 6f 6e 2d 4e 55 4c 4c 20 64 62 70 61 72 a non-NULL dbpar
1360: 65 6e 74 0a 09 20 20 20 20 2d 2d 20 72 65 66 65 ent.. -- refe
1370: 72 69 6e 67 20 74 6f 20 58 2e 0a 0a 09 20 20 20 ring to X....
1380: 20 69 73 64 65 66 61 75 6c 74 20 49 4e 54 45 47 isdefault INTEG
1390: 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 2c 0a 09 20 ER NOT NULL,..
13a0: 20 20 20 64 62 70 61 72 65 6e 74 20 20 49 4e 54 dbparent INT
13b0: 45 47 45 52 20 20 20 20 20 20 20 20 20 20 20 20 EGER
13c0: 52 45 46 45 52 45 4e 43 45 53 20 72 65 76 69 73 REFERENCES revis
13d0: 69 6f 6e 2c 0a 09 20 20 20 20 64 62 63 68 69 6c ion,.. dbchil
13e0: 64 20 20 20 49 4e 54 45 47 45 52 20 20 20 20 20 d INTEGER
13f0: 20 20 20 20 20 20 20 52 45 46 45 52 45 4e 43 45 REFERENCE
1400: 53 20 72 65 76 69 73 69 6f 6e 2c 0a 0a 09 20 20 S revision,...
1410: 20 20 2d 2d 20 54 68 65 20 6d 61 69 6e 20 70 61 -- The main pa
1420: 79 6c 6f 61 64 20 6f 66 20 74 68 65 20 72 65 76 yload of the rev
1430: 69 73 69 6f 6e 20 61 72 65 20 74 68 65 20 64 61 ision are the da
1440: 74 65 2f 74 69 6d 65 20 69 74 0a 09 20 20 20 20 te/time it..
1450: 2d 2d 20 77 61 73 20 65 6e 74 65 72 65 64 2c 20 -- was entered,
1460: 69 74 73 20 73 74 61 74 65 2c 20 6f 70 65 72 61 its state, opera
1470: 74 69 6f 6e 20 28 3d 20 74 79 70 65 2f 63 6c 61 tion (= type/cla
1480: 73 73 29 2c 20 74 65 78 74 0a 09 20 20 20 20 2d ss), text.. -
1490: 2d 20 63 6f 6e 74 65 6e 74 2c 20 61 6e 64 20 6d - content, and m
14a0: 65 74 61 20 64 61 74 61 20 28 61 75 74 68 6f 72 eta data (author
14b0: 2c 20 6c 6f 67 20 6d 65 73 73 61 67 65 2c 20 62 , log message, b
14c0: 72 61 6e 63 68 2c 0a 09 20 20 20 20 2d 2d 20 70 ranch,.. -- p
14d0: 72 6f 6a 65 63 74 29 2e 20 54 68 65 20 6c 61 73 roject). The las
14e0: 74 20 69 73 20 65 6e 63 6f 64 65 64 20 61 73 20 t is encoded as
14f0: 73 69 6e 67 6c 65 20 69 64 2c 20 73 65 65 20 74 single id, see t
1500: 61 62 6c 65 0a 09 20 20 20 20 2d 2d 20 27 6d 65 able.. -- 'me
1510: 74 61 27 2e 20 54 68 65 20 64 61 74 65 2f 74 69 ta'. The date/ti
1520: 6d 65 20 69 73 20 67 69 76 65 6e 20 69 6e 20 73 me is given in s
1530: 65 63 6f 6e 64 73 20 73 69 6e 63 65 20 74 68 65 econds since the
1540: 0a 09 20 20 20 20 2d 2d 20 65 70 6f 63 68 2c 20 .. -- epoch,
1550: 66 6f 72 20 65 61 73 79 20 63 6f 6d 70 61 72 69 for easy compari
1560: 73 6f 6e 2e 20 54 68 65 20 74 65 78 74 20 63 6f son. The text co
1570: 6e 74 65 6e 74 20 69 73 20 61 6e 0a 09 20 20 20 ntent is an..
1580: 20 2d 2d 20 28 6f 66 66 73 65 74 2c 6c 65 6e 67 -- (offset,leng
1590: 74 68 29 20 70 61 69 72 20 69 6e 74 6f 20 74 68 th) pair into th
15a0: 65 20 72 63 73 20 61 72 63 68 69 76 65 2e 0a 0a e rcs archive...
15b0: 09 20 20 20 20 6f 70 20 20 20 20 49 4e 54 45 47 . op INTEG
15c0: 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 2c 0a 09 20 ER NOT NULL,..
15d0: 20 20 20 64 61 74 65 20 20 49 4e 54 45 47 45 52 date INTEGER
15e0: 20 20 4e 4f 54 20 4e 55 4c 4c 2c 0a 09 20 20 20 NOT NULL,..
15f0: 20 73 74 61 74 65 20 54 45 58 54 20 20 20 20 20 state TEXT
1600: 4e 4f 54 20 4e 55 4c 4c 2c 0a 09 20 20 20 20 6d NOT NULL,.. m
1610: 69 64 20 20 20 49 4e 54 45 47 45 52 20 20 4e 4f id INTEGER NO
1620: 54 20 4e 55 4c 4c 20 52 45 46 45 52 45 4e 43 45 T NULL REFERENCE
1630: 53 20 6d 65 74 61 2c 0a 09 20 20 20 20 63 6f 66 S meta,.. cof
1640: 66 20 20 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 f INTEGER NOT
1650: 4e 55 4c 4c 2c 0a 09 20 20 20 20 63 6c 65 6e 20 NULL,.. clen
1660: 20 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 INTEGER NOT NU
1670: 4c 4c 2c 0a 0a 09 20 20 20 20 55 4e 49 51 55 45 LL,... UNIQUE
1680: 20 28 66 69 64 2c 20 72 65 76 29 20 2d 2d 20 54 (fid, rev) -- T
1690: 68 65 20 44 54 4e 20 69 73 20 75 6e 69 71 75 65 he DTN is unique
16a0: 20 77 69 74 68 69 6e 20 74 68 65 20 72 65 76 69 within the revi
16b0: 73 69 6f 6e 27 73 20 66 69 6c 65 2e 0a 09 7d 0a sion's file...}.
16c0: 0a 09 73 74 61 74 65 20 77 72 69 74 69 6e 67 20 ..state writing
16d0: 74 61 67 20 7b 0a 09 20 20 20 20 74 69 64 20 20 tag {.. tid
16e0: 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c INTEGER NOT NUL
16f0: 4c 20 20 50 52 49 4d 41 52 59 20 4b 45 59 20 41 L PRIMARY KEY A
1700: 55 54 4f 49 4e 43 52 45 4d 45 4e 54 2c 0a 09 20 UTOINCREMENT,..
1710: 20 20 20 66 69 64 20 20 49 4e 54 45 47 45 52 20 fid INTEGER
1720: 20 4e 4f 54 20 4e 55 4c 4c 20 20 52 45 46 45 52 NOT NULL REFER
1730: 45 4e 43 45 53 20 66 69 6c 65 2c 20 20 20 20 20 ENCES file,
1740: 2d 2d 20 46 69 6c 65 20 74 68 65 20 69 74 65 6d -- File the item
1750: 20 62 65 6c 6f 6e 67 73 20 74 6f 0a 09 20 20 20 belongs to..
1760: 20 6c 6f 64 20 20 49 4e 54 45 47 45 52 20 20 20 lod INTEGER
1770: 20 20 20 20 20 20 20 20 20 52 45 46 45 52 45 4e REFEREN
1780: 43 45 53 20 73 79 6d 62 6f 6c 2c 20 20 20 2d 2d CES symbol, --
1790: 20 4c 69 6e 65 20 6f 66 20 64 65 76 65 6c 6f 70 Line of develop
17a0: 6d 65 6e 74 20 28 4e 55 4c 4c 20 3d 3e 20 54 72 ment (NULL => Tr
17b0: 75 6e 6b 29 0a 0a 09 20 20 20 20 73 69 64 20 20 unk)... sid
17c0: 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c INTEGER NOT NUL
17d0: 4c 20 20 52 45 46 45 52 45 4e 43 45 53 20 73 79 L REFERENCES sy
17e0: 6d 62 6f 6c 2c 20 20 20 2d 2d 20 53 79 6d 62 6f mbol, -- Symbo
17f0: 6c 20 63 61 70 74 75 72 69 6e 67 20 74 68 65 20 l capturing the
1800: 74 61 67 0a 0a 09 20 20 20 20 72 65 76 20 20 49 tag... rev I
1810: 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c NTEGER NOT NULL
1820: 20 20 52 45 46 45 52 45 4e 43 45 53 20 72 65 76 REFERENCES rev
1830: 69 73 69 6f 6e 20 20 2d 2d 20 54 68 65 20 72 65 ision -- The re
1840: 76 69 73 69 6f 6e 20 62 65 69 6e 67 20 74 61 67 vision being tag
1850: 67 65 64 2e 0a 09 7d 0a 0a 09 73 74 61 74 65 20 ged...}...state
1860: 77 72 69 74 69 6e 67 20 62 72 61 6e 63 68 20 7b writing branch {
1870: 0a 09 20 20 20 20 62 69 64 20 20 20 49 4e 54 45 .. bid INTE
1880: 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 50 GER NOT NULL P
1890: 52 49 4d 41 52 59 20 4b 45 59 20 41 55 54 4f 49 RIMARY KEY AUTOI
18a0: 4e 43 52 45 4d 45 4e 54 2c 0a 09 20 20 20 20 66 NCREMENT,.. f
18b0: 69 64 20 20 20 49 4e 54 45 47 45 52 20 20 4e 4f id INTEGER NO
18c0: 54 20 4e 55 4c 4c 20 20 52 45 46 45 52 45 4e 43 T NULL REFERENC
18d0: 45 53 20 66 69 6c 65 2c 20 20 20 20 20 2d 2d 20 ES file, --
18e0: 46 69 6c 65 20 74 68 65 20 69 74 65 6d 20 62 65 File the item be
18f0: 6c 6f 6e 67 73 20 74 6f 0a 09 20 20 20 20 6c 6f longs to.. lo
1900: 64 20 20 20 49 4e 54 45 47 45 52 20 20 20 20 20 d INTEGER
1910: 20 20 20 20 20 20 20 52 45 46 45 52 45 4e 43 45 REFERENCE
1920: 53 20 73 79 6d 62 6f 6c 2c 20 20 20 2d 2d 20 4c S symbol, -- L
1930: 69 6e 65 20 6f 66 20 64 65 76 65 6c 6f 70 6d 65 ine of developme
1940: 6e 74 20 28 4e 55 4c 4c 20 3d 3e 20 54 72 75 6e nt (NULL => Trun
1950: 6b 29 0a 0a 09 20 20 20 20 73 69 64 20 20 20 49 k)... sid I
1960: 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c NTEGER NOT NULL
1970: 20 20 52 45 46 45 52 45 4e 43 45 53 20 73 79 6d REFERENCES sym
1980: 62 6f 6c 2c 20 20 20 2d 2d 20 53 79 6d 62 6f 6c bol, -- Symbol
1990: 20 63 61 70 74 75 72 69 6e 67 20 74 68 65 20 62 capturing the b
19a0: 72 61 6e 63 68 0a 0a 09 20 20 20 20 72 6f 6f 74 ranch... root
19b0: 20 20 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e INTEGER NOT N
19c0: 55 4c 4c 20 20 52 45 46 45 52 45 4e 43 45 53 20 ULL REFERENCES
19d0: 72 65 76 69 73 69 6f 6e 2c 20 2d 2d 20 52 65 76 revision, -- Rev
19e0: 69 73 69 6f 6e 20 74 68 65 20 62 72 61 6e 63 68 ision the branch
19f0: 20 73 70 72 6f 75 74 73 20 66 72 6f 6d 0a 09 20 sprouts from..
1a00: 20 20 20 66 69 72 73 74 20 49 4e 54 45 47 45 52 first INTEGER
1a10: 20 20 20 20 20 20 20 20 20 20 20 20 52 45 46 45 REFE
1a20: 52 45 4e 43 45 53 20 72 65 76 69 73 69 6f 6e 2c RENCES revision,
1a30: 20 2d 2d 20 46 69 72 73 74 20 72 65 76 69 73 69 -- First revisi
1a40: 6f 6e 20 63 6f 6d 6d 69 74 74 65 64 20 74 6f 20 on committed to
1a50: 74 68 65 20 62 72 61 6e 63 68 0a 09 20 20 20 20 the branch..
1a60: 62 72 61 20 20 20 54 45 58 54 20 20 20 20 20 4e bra TEXT N
1a70: 4f 54 20 4e 55 4c 4c 20 20 20 20 20 20 20 20 20 OT NULL
1a80: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2d 2d --
1a90: 20 62 72 61 6e 63 68 20 6e 75 6d 62 65 72 0a 09 branch number..
1aa0: 7d 0a 0a 09 23 20 50 72 6f 6a 65 63 74 20 6c 65 }...# Project le
1ab0: 76 65 6c 20 2e 2e 2e 0a 09 23 09 70 4c 69 6e 65 vel .....#.pLine
1ac0: 4f 66 44 65 76 65 6c 6f 70 6d 65 6e 74 2c 20 70 OfDevelopment, p
1ad0: 53 79 6d 62 6f 6c 2c 20 70 42 72 61 6e 63 68 2c Symbol, pBranch,
1ae0: 20 70 54 61 67 2c 20 70 54 72 75 6e 6b 0a 09 23 pTag, pTrunk..#
1af0: 0a 09 23 09 70 54 72 75 6e 6b 20 20 3c 2d 20 70 ..#.pTrunk <- p
1b00: 4c 69 6e 65 4f 66 44 65 76 65 6c 6f 70 6d 65 6e LineOfDevelopmen
1b10: 74 0a 09 23 09 70 42 72 61 6e 63 68 20 3c 2d 20 t..#.pBranch <-
1b20: 70 53 79 6d 62 6f 6c 2c 20 70 4c 69 6e 65 4f 66 pSymbol, pLineOf
1b30: 44 65 76 65 6c 6f 70 6d 65 6e 74 0a 09 23 09 70 Development..#.p
1b40: 54 61 67 20 20 20 20 3c 2d 20 70 53 79 6d 62 6f Tag <- pSymbo
1b50: 6c 2c 20 70 4c 69 6e 65 4f 66 44 65 76 65 6c 6f l, pLineOfDevelo
1b60: 70 6d 65 6e 74 0a 0a 09 73 74 61 74 65 20 77 72 pment...state wr
1b70: 69 74 69 6e 67 20 73 79 6d 62 6f 6c 20 7b 0a 09 iting symbol {..
1b80: 20 20 20 20 73 69 64 20 20 49 4e 54 45 47 45 52 sid INTEGER
1b90: 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 50 52 49 4d NOT NULL PRIM
1ba0: 41 52 59 20 4b 45 59 20 41 55 54 4f 49 4e 43 52 ARY KEY AUTOINCR
1bb0: 45 4d 45 4e 54 2c 0a 09 20 20 20 20 70 69 64 20 EMENT,.. pid
1bc0: 20 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 INTEGER NOT NU
1bd0: 4c 4c 20 20 52 45 46 45 52 45 4e 43 45 53 20 70 LL REFERENCES p
1be0: 72 6f 6a 65 63 74 2c 20 20 2d 2d 20 50 72 6f 6a roject, -- Proj
1bf0: 65 63 74 20 74 68 65 20 73 79 6d 62 6f 6c 20 62 ect the symbol b
1c00: 65 6c 6f 6e 67 73 20 74 6f 0a 09 20 20 20 20 6e elongs to.. n
1c10: 61 6d 65 20 54 45 58 54 20 20 20 20 20 4e 4f 54 ame TEXT NOT
1c20: 20 4e 55 4c 4c 2c 0a 09 20 20 20 20 74 79 70 65 NULL,.. type
1c30: 20 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 INTEGER NOT NU
1c40: 4c 4c 2c 20 20 20 20 20 20 20 20 20 20 20 20 20 LL,
1c50: 20 20 20 20 20 20 20 20 20 2d 2d 20 65 6e 75 6d -- enum
1c60: 20 7b 20 74 61 67 20 3d 20 31 2c 20 62 72 61 6e { tag = 1, bran
1c70: 63 68 2c 20 75 6e 64 65 66 69 6e 65 64 20 7d 0a ch, undefined }.
1c80: 0a 09 20 20 20 20 74 61 67 5f 63 6f 75 6e 74 20 .. tag_count
1c90: 20 20 20 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 INTEGER NOT
1ca0: 4e 55 4c 4c 2c 20 2d 2d 20 48 6f 77 20 6f 66 74 NULL, -- How oft
1cb0: 65 6e 20 74 68 65 20 73 79 6d 62 6f 6c 20 69 73 en the symbol is
1cc0: 20 75 73 65 64 20 61 73 20 74 61 67 2e 0a 09 20 used as tag...
1cd0: 20 20 20 62 72 61 6e 63 68 5f 63 6f 75 6e 74 20 branch_count
1ce0: 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c INTEGER NOT NUL
1cf0: 4c 2c 20 2d 2d 20 48 6f 77 20 6f 66 74 65 6e 20 L, -- How often
1d00: 74 68 65 20 73 79 6d 62 6f 6c 20 69 73 20 75 73 the symbol is us
1d10: 65 64 20 61 73 20 62 72 61 6e 63 68 0a 09 20 20 ed as branch..
1d20: 20 20 63 6f 6d 6d 69 74 5f 63 6f 75 6e 74 20 49 commit_count I
1d30: 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c NTEGER NOT NULL
1d40: 2c 20 2d 2d 20 48 6f 77 20 6f 66 74 65 6e 20 61 , -- How often a
1d50: 20 66 69 6c 65 20 77 61 73 20 63 6f 6d 6d 69 74 file was commit
1d60: 74 65 64 20 6f 6e 20 74 68 65 20 73 79 6d 62 6f ted on the symbo
1d70: 6c 0a 0a 09 20 20 20 20 55 4e 49 51 55 45 20 28 l... UNIQUE (
1d80: 70 69 64 2c 20 6e 61 6d 65 29 20 2d 2d 20 53 79 pid, name) -- Sy
1d90: 6d 62 6f 6c 73 20 61 72 65 20 75 6e 69 71 75 65 mbols are unique
1da0: 20 77 69 74 68 69 6e 20 74 68 65 20 70 72 6f 6a within the proj
1db0: 65 63 74 0a 09 7d 0a 0a 09 73 74 61 74 65 20 77 ect..}...state w
1dc0: 72 69 74 69 6e 67 20 62 6c 6f 63 6b 65 72 20 7b riting blocker {
1dd0: 0a 09 20 20 20 20 73 69 64 20 49 4e 54 45 47 45 .. sid INTEGE
1de0: 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 52 45 46 R NOT NULL REF
1df0: 45 52 45 4e 43 45 53 20 73 79 6d 62 6f 6c 2c 20 ERENCES symbol,
1e00: 2d 2d 20 0a 09 20 20 20 20 62 69 64 20 49 4e 54 -- .. bid INT
1e10: 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 EGER NOT NULL
1e20: 52 45 46 45 52 45 4e 43 45 53 20 73 79 6d 62 6f REFERENCES symbo
1e30: 6c 2c 20 2d 2d 20 53 70 72 6f 75 74 65 64 20 66 l, -- Sprouted f
1e40: 72 6f 6d 20 73 69 64 2c 20 62 6c 6f 63 6b 73 20 rom sid, blocks
1e50: 69 74 2e 0a 09 20 20 20 20 55 4e 49 51 55 45 20 it... UNIQUE
1e60: 28 73 69 64 2c 20 62 69 64 29 0a 09 7d 0a 0a 09 (sid, bid)..}...
1e70: 73 74 61 74 65 20 77 72 69 74 69 6e 67 20 70 61 state writing pa
1e80: 72 65 6e 74 20 7b 0a 09 20 20 20 20 73 69 64 20 rent {.. sid
1e90: 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c INTEGER NOT NUL
1ea0: 4c 20 20 52 45 46 45 52 45 4e 43 45 53 20 73 79 L REFERENCES sy
1eb0: 6d 62 6f 6c 2c 20 2d 2d 20 0a 09 20 20 20 20 70 mbol, -- .. p
1ec0: 69 64 20 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 id INTEGER NOT
1ed0: 4e 55 4c 4c 20 20 52 45 46 45 52 45 4e 43 45 53 NULL REFERENCES
1ee0: 20 73 79 6d 62 6f 6c 2c 20 2d 2d 20 50 6f 73 73 symbol, -- Poss
1ef0: 69 62 6c 65 20 70 61 72 65 6e 74 20 6f 66 20 73 ible parent of s
1f00: 69 64 0a 09 20 20 20 20 55 4e 49 51 55 45 20 28 id.. UNIQUE (
1f10: 73 69 64 2c 20 70 69 64 29 0a 09 7d 0a 0a 09 73 sid, pid)..}...s
1f20: 74 61 74 65 20 77 72 69 74 69 6e 67 20 6d 65 74 tate writing met
1f30: 61 20 7b 0a 09 20 20 20 20 2d 2d 20 4d 65 74 61 a {.. -- Meta
1f40: 20 64 61 74 61 20 6f 66 20 72 65 76 69 73 69 6f data of revisio
1f50: 6e 73 2e 20 53 65 65 20 72 65 76 69 73 69 6f 6e ns. See revision
1f60: 2e 6d 69 64 20 66 6f 72 20 74 68 65 0a 09 20 20 .mid for the..
1f70: 20 20 2d 2d 20 72 65 66 65 72 65 6e 63 65 2e 20 -- reference.
1f80: 4d 61 6e 79 20 72 65 76 69 73 69 6f 6e 73 20 63 Many revisions c
1f90: 61 6e 20 73 68 61 72 65 20 6d 65 74 61 20 64 61 an share meta da
1fa0: 74 61 2e 20 54 68 69 73 20 69 73 0a 09 20 20 20 ta. This is..
1fb0: 20 2d 2d 20 61 63 74 75 61 6c 6c 79 20 6f 6e 65 -- actually one
1fc0: 20 6f 66 20 74 68 65 20 63 72 69 74 65 72 69 6f of the criterio
1fd0: 6e 73 20 75 73 65 64 20 74 6f 20 73 6f 72 74 20 ns used to sort
1fe0: 72 65 76 69 73 69 6f 6e 73 0a 09 20 20 20 20 2d revisions.. -
1ff0: 2d 20 69 6e 74 6f 20 63 68 61 6e 67 65 73 65 74 - into changeset
2000: 73 2e 0a 0a 09 20 20 20 20 6d 69 64 20 49 4e 54 s.... mid INT
2010: 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 EGER NOT NULL
2020: 50 52 49 4d 41 52 59 20 4b 45 59 20 20 41 55 54 PRIMARY KEY AUT
2030: 4f 49 4e 43 52 45 4d 45 4e 54 2c 0a 0a 09 20 20 OINCREMENT,...
2040: 20 20 2d 2d 20 4d 65 74 61 20 64 61 74 61 20 62 -- Meta data b
2050: 65 6c 6f 6e 67 73 20 74 6f 20 61 20 73 70 65 63 elongs to a spec
2060: 69 66 69 63 20 70 72 6f 6a 65 63 74 2c 20 73 74 ific project, st
2070: 72 6f 6e 67 65 72 2c 20 74 6f 20 61 0a 09 20 20 ronger, to a..
2080: 20 20 2d 2d 20 62 72 61 6e 63 68 20 69 6e 20 74 -- branch in t
2090: 68 61 74 20 70 72 6f 6a 65 63 74 2e 20 49 74 20 hat project. It
20a0: 66 75 72 74 68 65 72 20 68 61 73 20 61 20 6c 6f further has a lo
20b0: 67 20 6d 65 73 73 61 67 65 2c 0a 09 20 20 20 20 g message,..
20c0: 2d 2d 20 61 6e 64 20 69 74 73 20 61 75 74 68 6f -- and its autho
20d0: 72 2e 20 54 68 69 73 20 69 73 20 75 6e 69 71 75 r. This is uniqu
20e0: 65 20 77 69 74 68 20 74 68 65 20 70 72 6f 6a 65 e with the proje
20f0: 63 74 20 61 6e 64 0a 09 20 20 20 20 2d 2d 20 62 ct and.. -- b
2100: 72 61 6e 63 68 2e 0a 0a 09 20 20 20 20 70 69 64 ranch.... pid
2110: 20 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 INTEGER NOT NU
2120: 4c 4c 20 20 52 45 46 45 52 45 4e 43 45 53 20 70 LL REFERENCES p
2130: 72 6f 6a 65 63 74 2c 20 20 2d 2d 0a 09 20 20 20 roject, --..
2140: 20 62 69 64 20 49 4e 54 45 47 45 52 20 20 4e 4f bid INTEGER NO
2150: 54 20 4e 55 4c 4c 20 20 52 45 46 45 52 45 4e 43 T NULL REFERENC
2160: 45 53 20 73 79 6d 62 6f 6c 2c 20 20 20 2d 2d 0a ES symbol, --.
2170: 09 20 20 20 20 61 69 64 20 49 4e 54 45 47 45 52 . aid INTEGER
2180: 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 52 45 46 45 NOT NULL REFE
2190: 52 45 4e 43 45 53 20 61 75 74 68 6f 72 2c 20 20 RENCES author,
21a0: 20 2d 2d 0a 09 20 20 20 20 63 69 64 20 49 4e 54 --.. cid INT
21b0: 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 EGER NOT NULL
21c0: 52 45 46 45 52 45 4e 43 45 53 20 63 6d 65 73 73 REFERENCES cmess
21d0: 61 67 65 2c 20 2d 2d 0a 0a 09 20 20 20 20 55 4e age, --... UN
21e0: 49 51 55 45 20 28 70 69 64 2c 20 62 69 64 2c 20 IQUE (pid, bid,
21f0: 61 69 64 2c 20 63 69 64 29 0a 0a 09 20 20 20 20 aid, cid)...
2200: 2d 2d 20 43 6f 6e 73 74 72 61 69 6e 74 73 3a 20 -- Constraints:
2210: 54 68 65 20 70 72 6f 6a 65 63 74 20 6f 66 20 74 The project of t
2220: 68 65 20 6d 65 74 61 20 64 61 74 61 20 6f 66 20 he meta data of
2230: 61 20 72 65 76 69 73 69 6f 6e 0a 09 20 20 20 20 a revision..
2240: 2d 2d 20 20 20 20 20 20 20 20 20 20 20 20 20 20 --
2250: 58 20 69 73 20 74 68 65 20 73 61 6d 65 20 61 73 X is the same as
2260: 20 74 68 65 20 70 72 6f 6a 65 63 74 20 6f 66 20 the project of
2270: 58 20 69 74 73 65 6c 66 2e 0a 09 20 20 20 20 2d X itself... -
2280: 2d 0a 09 20 20 20 20 2d 2d 20 2e 2e 2e 2e 2e 2e -.. -- ......
2290: 2e 2e 2e 2e 2e 2e 20 54 68 65 20 62 72 61 6e 63 ...... The branc
22a0: 68 20 6f 66 20 74 68 65 20 6d 65 74 61 20 64 61 h of the meta da
22b0: 74 61 20 6f 66 20 61 20 72 65 76 69 73 69 6f 6e ta of a revision
22c0: 0a 09 20 20 20 20 2d 2d 20 20 20 20 20 20 20 20 .. --
22d0: 20 20 20 20 20 20 58 20 69 73 20 74 68 65 20 73 X is the s
22e0: 61 6d 65 20 61 73 20 74 68 65 20 6c 69 6e 65 20 ame as the line
22f0: 6f 66 20 64 65 76 65 6c 6f 70 6d 65 6e 74 0a 09 of development..
2300: 20 20 20 20 2d 2d 20 20 20 20 20 20 20 20 20 20 --
2310: 20 20 20 20 6f 66 20 58 20 69 74 73 65 6c 66 2e of X itself.
2320: 0a 09 7d 0a 0a 09 23 20 41 75 74 68 6f 72 73 20 ..}...# Authors
2330: 61 6e 64 20 63 6f 6d 6d 69 74 20 6d 65 73 73 61 and commit messa
2340: 67 65 73 20 61 72 65 20 66 75 6c 6c 79 20 67 6c ges are fully gl
2350: 6f 62 61 6c 2c 20 69 2e 65 2e 20 70 65 72 0a 09 obal, i.e. per..
2360: 23 20 72 65 70 6f 73 69 74 6f 72 79 2e 0a 0a 09 # repository....
2370: 73 74 61 74 65 20 77 72 69 74 69 6e 67 20 61 75 state writing au
2380: 74 68 6f 72 20 7b 0a 09 20 20 20 20 61 69 64 20 thor {.. aid
2390: 20 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 INTEGER NOT NU
23a0: 4c 4c 20 20 50 52 49 4d 41 52 59 20 4b 45 59 20 LL PRIMARY KEY
23b0: 20 41 55 54 4f 49 4e 43 52 45 4d 45 4e 54 2c 0a AUTOINCREMENT,.
23c0: 09 20 20 20 20 6e 61 6d 65 20 54 45 58 54 20 20 . name TEXT
23d0: 20 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 55 4e 49 NOT NULL UNI
23e0: 51 55 45 0a 09 7d 0a 0a 09 73 74 61 74 65 20 77 QUE..}...state w
23f0: 72 69 74 69 6e 67 20 63 6d 65 73 73 61 67 65 20 riting cmessage
2400: 7b 0a 09 20 20 20 20 63 69 64 20 20 49 4e 54 45 {.. cid INTE
2410: 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 50 GER NOT NULL P
2420: 52 49 4d 41 52 59 20 4b 45 59 20 20 41 55 54 4f RIMARY KEY AUTO
2430: 49 4e 43 52 45 4d 45 4e 54 2c 0a 09 20 20 20 20 INCREMENT,..
2440: 74 65 78 74 20 54 45 58 54 20 20 20 20 20 4e 4f text TEXT NO
2450: 54 20 4e 55 4c 4c 20 20 55 4e 49 51 55 45 0a 09 T NULL UNIQUE..
2460: 7d 0a 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 7d }...return. }
2470: 0a 0a 20 20 20 20 74 79 70 65 6d 65 74 68 6f 64 .. typemethod
2480: 20 6c 6f 61 64 20 7b 7d 20 7b 0a 09 23 20 54 4f load {} {..# TO
2490: 44 4f 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 7d DO..return. }
24a0: 0a 0a 20 20 20 20 74 79 70 65 6d 65 74 68 6f 64 .. typemethod
24b0: 20 72 75 6e 20 7b 7d 20 7b 0a 09 23 20 50 61 73 run {} {..# Pas
24c0: 73 20 6d 61 6e 61 67 65 72 20 69 6e 74 65 72 66 s manager interf
24d0: 61 63 65 2e 20 45 78 65 63 75 74 65 64 20 74 6f ace. Executed to
24e0: 20 70 65 72 66 6f 72 6d 20 74 68 65 0a 09 23 20 perform the..#
24f0: 66 75 6e 63 74 69 6f 6e 61 6c 69 74 79 20 6f 66 functionality of
2500: 20 74 68 65 20 70 61 73 73 2e 0a 0a 09 73 65 74 the pass....set
2510: 20 72 62 61 73 65 20 5b 72 65 70 6f 73 69 74 6f rbase [reposito
2520: 72 79 20 62 61 73 65 3f 5d 0a 09 66 6f 72 65 61 ry base?]..forea
2530: 63 68 20 70 72 6f 6a 65 63 74 20 5b 72 65 70 6f ch project [repo
2540: 73 69 74 6f 72 79 20 70 72 6f 6a 65 63 74 73 5d sitory projects]
2550: 20 7b 0a 09 20 20 20 20 73 65 74 20 62 61 73 65 {.. set base
2560: 20 5b 66 69 6c 65 20 6a 6f 69 6e 20 24 72 62 61 [file join $rba
2570: 73 65 20 5b 24 70 72 6f 6a 65 63 74 20 62 61 73 se [$project bas
2580: 65 5d 5d 0a 09 20 20 20 20 6c 6f 67 20 77 72 69 e]].. log wri
2590: 74 65 20 31 20 63 6f 6c 6c 72 65 76 20 22 50 72 te 1 collrev "Pr
25a0: 6f 63 65 73 73 69 6e 67 20 24 62 61 73 65 22 0a ocessing $base".
25b0: 0a 09 20 20 20 20 66 6f 72 65 61 63 68 20 66 69 .. foreach fi
25c0: 6c 65 20 5b 24 70 72 6f 6a 65 63 74 20 66 69 6c le [$project fil
25d0: 65 73 5d 20 7b 0a 09 09 73 65 74 20 70 61 74 68 es] {...set path
25e0: 20 5b 24 66 69 6c 65 20 70 61 74 68 5d 0a 09 09 [$file path]...
25f0: 6c 6f 67 20 77 72 69 74 65 20 32 20 63 6f 6c 6c log write 2 coll
2600: 72 65 76 20 22 50 61 72 73 69 6e 67 20 24 70 61 rev "Parsing $pa
2610: 74 68 22 0a 09 09 69 66 20 7b 5b 63 61 74 63 68 th"...if {[catch
2620: 20 7b 0a 09 09 20 20 20 20 70 61 72 73 65 72 20 {... parser
2630: 70 72 6f 63 65 73 73 20 5b 66 69 6c 65 20 6a 6f process [file jo
2640: 69 6e 20 24 62 61 73 65 20 24 70 61 74 68 5d 20 in $base $path]
2650: 24 66 69 6c 65 0a 09 09 7d 20 6d 73 67 5d 7d 20 $file...} msg]}
2660: 7b 0a 09 09 20 20 20 20 67 6c 6f 62 61 6c 20 65 {... global e
2670: 72 72 6f 72 43 6f 64 65 0a 09 09 20 20 20 20 69 rrorCode... i
2680: 66 20 7b 24 65 72 72 6f 72 43 6f 64 65 20 65 71 f {$errorCode eq
2690: 20 22 76 63 3a 3a 72 63 73 3a 3a 70 61 72 73 65 "vc::rcs::parse
26a0: 72 22 7d 20 7b 0a 09 09 09 74 72 6f 75 62 6c 65 r"} {....trouble
26b0: 20 66 61 74 61 6c 20 22 24 70 61 74 68 20 69 73 fatal "$path is
26c0: 20 6e 6f 74 20 61 20 76 61 6c 69 64 20 52 43 53 not a valid RCS
26d0: 20 61 72 63 68 69 76 65 20 28 24 6d 73 67 29 22 archive ($msg)"
26e0: 0a 09 09 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a ... } else {.
26f0: 09 09 09 67 6c 6f 62 61 6c 20 65 72 72 6f 72 49 ...global errorI
2700: 6e 66 6f 0a 09 09 09 74 72 6f 75 62 6c 65 20 69 nfo....trouble i
2710: 6e 74 65 72 6e 61 6c 20 24 65 72 72 6f 72 49 6e nternal $errorIn
2720: 66 6f 0a 09 09 20 20 20 20 7d 0a 09 09 7d 20 65 fo... }...} e
2730: 6c 73 65 20 7b 0a 09 09 20 20 20 20 23 20 57 65 lse {... # We
2740: 20 70 65 72 73 69 73 74 20 74 68 65 20 63 6f 72 persist the cor
2750: 65 20 6f 66 20 74 68 65 20 64 61 74 61 20 63 6f e of the data co
2760: 6c 6c 65 63 74 65 64 20 61 62 6f 75 74 0a 09 09 llected about...
2770: 20 20 20 20 23 20 65 61 63 68 20 66 69 6c 65 20 # each file
2780: 69 6d 6d 65 64 69 61 74 65 6c 79 20 61 66 74 65 immediately afte
2790: 72 20 69 74 20 68 61 73 20 62 65 65 6e 20 70 61 r it has been pa
27a0: 72 73 65 64 0a 09 09 20 20 20 20 23 20 61 6e 64 rsed... # and
27b0: 20 77 72 61 6e 67 6c 65 64 20 69 6e 74 6f 20 73 wrangled into s
27c0: 68 61 70 65 2c 20 61 6e 64 20 74 68 65 6e 20 64 hape, and then d
27d0: 72 6f 70 20 69 74 20 66 72 6f 6d 0a 09 09 20 20 rop it from...
27e0: 20 20 23 20 6d 65 6d 6f 72 79 2e 20 54 68 69 73 # memory. This
27f0: 20 69 73 20 64 6f 6e 65 20 74 6f 20 6b 65 65 70 is done to keep
2800: 20 74 68 65 20 61 6d 6f 75 6e 74 20 6f 66 0a 09 the amount of..
2810: 09 20 20 20 20 23 20 72 65 71 75 69 72 65 64 20 . # required
2820: 6d 65 6d 6f 72 79 20 77 69 74 68 69 6e 20 73 65 memory within se
2830: 6e 73 69 62 6c 65 20 6c 69 6d 69 74 73 2e 20 57 nsible limits. W
2840: 69 74 68 6f 75 74 0a 09 09 20 20 20 20 23 20 64 ithout... # d
2850: 6f 69 6e 67 20 69 74 20 74 68 69 73 20 77 61 79 oing it this way
2860: 20 77 65 20 77 6f 75 6c 64 20 65 61 73 69 6c 79 we would easily
2870: 20 67 6f 62 62 6c 65 20 75 70 20 31 47 0a 09 09 gobble up 1G...
2880: 20 20 20 20 23 20 6f 66 20 52 41 4d 20 6f 72 20 # of RAM or
2890: 6d 6f 72 65 20 77 69 74 68 20 61 6c 6c 20 74 68 more with all th
28a0: 65 20 6f 62 6a 65 63 74 73 20 28 72 65 76 69 73 e objects (revis
28b0: 69 6f 6e 73 0a 09 09 20 20 20 20 23 20 61 6e 64 ions... # and
28c0: 20 66 69 6c 65 2d 6c 65 76 65 6c 20 73 79 6d 62 file-level symb
28d0: 6f 6c 73 29 2e 0a 0a 09 09 20 20 20 20 24 66 69 ols)..... $fi
28e0: 6c 65 20 70 65 72 73 69 73 74 0a 09 09 7d 0a 0a le persist...}..
28f0: 09 09 24 66 69 6c 65 20 64 72 6f 70 0a 09 20 20 ..$file drop..
2900: 20 20 7d 0a 09 7d 0a 0a 09 72 65 70 6f 73 69 74 }..}...reposit
2910: 6f 72 79 20 70 72 69 6e 74 72 65 76 73 74 61 74 ory printrevstat
2920: 69 73 74 69 63 73 0a 09 72 65 70 6f 73 69 74 6f istics..reposito
2930: 72 79 20 70 65 72 73 69 73 74 72 65 76 0a 0a 09 ry persistrev...
2940: 6c 6f 67 20 77 72 69 74 65 20 31 20 63 6f 6c 6c log write 1 coll
2950: 72 65 76 20 22 53 63 61 6e 20 63 6f 6d 70 6c 65 rev "Scan comple
2960: 74 65 64 22 0a 09 50 61 72 61 6e 6f 69 61 0a 09 ted"..Paranoia..
2970: 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 return. }..
2980: 20 20 74 79 70 65 6d 65 74 68 6f 64 20 64 69 73 typemethod dis
2990: 63 61 72 64 20 7b 7d 20 7b 0a 09 23 20 50 61 73 card {} {..# Pas
29a0: 73 20 6d 61 6e 61 67 65 72 20 69 6e 74 65 72 66 s manager interf
29b0: 61 63 65 2e 20 45 78 65 63 75 74 65 64 20 66 6f ace. Executed fo
29c0: 72 20 61 6c 6c 20 70 61 73 73 65 73 20 61 66 74 r all passes aft
29d0: 65 72 20 74 68 65 0a 09 23 20 72 75 6e 20 70 61 er the..# run pa
29e0: 73 73 65 73 2c 20 74 6f 20 72 65 6d 6f 76 65 20 sses, to remove
29f0: 61 6c 6c 20 64 61 74 61 20 6f 66 20 74 68 69 73 all data of this
2a00: 20 70 61 73 73 20 66 72 6f 6d 20 74 68 65 20 73 pass from the s
2a10: 74 61 74 65 2c 0a 09 23 20 61 73 20 62 65 69 6e tate,..# as bein
2a20: 67 20 6f 75 74 20 6f 66 20 64 61 74 65 2e 0a 0a g out of date...
2a30: 09 73 74 61 74 65 20 64 69 73 63 61 72 64 20 72 .state discard r
2a40: 65 76 69 73 69 6f 6e 0a 09 73 74 61 74 65 20 64 evision..state d
2a50: 69 73 63 61 72 64 20 74 61 67 0a 09 73 74 61 74 iscard tag..stat
2a60: 65 20 64 69 73 63 61 72 64 20 62 72 61 6e 63 68 e discard branch
2a70: 0a 09 73 74 61 74 65 20 64 69 73 63 61 72 64 20 ..state discard
2a80: 73 79 6d 62 6f 6c 0a 09 73 74 61 74 65 20 64 69 symbol..state di
2a90: 73 63 61 72 64 20 62 6c 6f 63 6b 65 72 0a 09 73 scard blocker..s
2aa0: 74 61 74 65 20 64 69 73 63 61 72 64 20 70 61 72 tate discard par
2ab0: 65 6e 74 0a 09 73 74 61 74 65 20 64 69 73 63 61 ent..state disca
2ac0: 72 64 20 6d 65 74 61 0a 09 73 74 61 74 65 20 64 rd meta..state d
2ad0: 69 73 63 61 72 64 20 61 75 74 68 6f 72 0a 09 73 iscard author..s
2ae0: 74 61 74 65 20 64 69 73 63 61 72 64 20 63 6d 65 tate discard cme
2af0: 73 73 61 67 65 0a 09 72 65 74 75 72 6e 0a 20 20 ssage..return.
2b00: 20 20 7d 0a 0a 20 20 20 20 70 72 6f 63 20 50 61 }.. proc Pa
2b10: 72 61 6e 6f 69 61 20 7b 7d 20 7b 0a 09 23 20 54 ranoia {} {..# T
2b20: 68 69 73 20 63 6f 64 65 20 70 65 72 66 6f 72 6d his code perform
2b30: 73 20 61 20 6e 75 6d 62 65 72 20 6f 66 20 70 61 s a number of pa
2b40: 72 61 6e 6f 69 64 20 63 68 65 63 6b 73 20 6f 66 ranoid checks of
2b50: 20 74 68 65 0a 09 23 20 64 61 74 61 62 61 73 65 the..# database
2b60: 20 66 6f 72 20 69 6e 63 6f 6e 73 69 73 74 65 6e for inconsisten
2b70: 74 20 63 72 6f 73 73 2d 72 65 66 65 72 65 6e 63 t cross-referenc
2b80: 65 73 2e 0a 09 6c 6f 67 20 77 72 69 74 65 20 34 es...log write 4
2b90: 20 63 6f 6c 6c 72 65 76 20 7b 43 68 65 63 6b 20 collrev {Check
2ba0: 64 61 74 61 62 61 73 65 20 63 6f 6e 73 69 73 74 database consist
2bb0: 65 6e 63 79 7d 0a 0a 09 73 65 74 20 6e 20 30 20 ency}...set n 0
2bc0: 3b 20 23 20 43 6f 75 6e 74 65 72 20 66 6f 72 20 ; # Counter for
2bd0: 74 68 65 20 63 68 65 63 6b 73 20 28 77 65 20 70 the checks (we p
2be0: 72 69 6e 74 20 61 6e 20 69 64 20 62 65 66 6f 72 rint an id befor
2bf0: 65 20 74 68 65 0a 09 09 20 20 23 20 6d 61 69 6e e the... # main
2c00: 20 6c 61 62 65 6c 29 2e 0a 0a 09 23 20 46 69 6e label)....# Fin
2c10: 64 20 61 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 d all revisions
2c20: 77 68 69 63 68 20 64 69 73 61 67 72 65 65 20 77 which disagree w
2c30: 69 74 68 20 74 68 65 69 72 20 6c 69 6e 65 20 6f ith their line o
2c40: 66 0a 09 23 20 64 65 76 65 6c 6f 70 6d 65 6e 74 f..# development
2c50: 20 61 62 6f 75 74 20 74 68 65 20 70 72 6f 6a 65 about the proje
2c60: 63 74 20 74 68 65 79 20 61 72 65 20 6f 77 6e 65 ct they are owne
2c70: 64 20 62 79 2e 0a 09 43 68 65 63 6b 20 5c 0a 09 d by...Check \..
2c80: 20 20 20 20 7b 52 65 76 69 73 69 6f 6e 73 20 61 {Revisions a
2c90: 6e 64 20 74 68 65 69 72 20 4c 4f 44 73 20 68 61 nd their LODs ha
2ca0: 76 65 20 74 6f 20 62 65 20 69 6e 20 74 68 65 20 ve to be in the
2cb0: 73 61 6d 65 20 70 72 6f 6a 65 63 74 7d 20 5c 0a same project} \.
2cc0: 09 20 20 20 20 7b 64 69 73 61 67 72 65 65 73 20 . {disagrees
2cd0: 77 69 74 68 20 69 74 73 20 4c 4f 44 20 61 62 6f with its LOD abo
2ce0: 75 74 20 6f 77 6e 69 6e 67 20 70 72 6f 6a 65 63 ut owning projec
2cf0: 74 7d 20 7b 0a 09 09 53 45 4c 45 43 54 20 46 2e t} {...SELECT F.
2d00: 6e 61 6d 65 2c 20 52 2e 72 65 76 0a 09 09 46 52 name, R.rev...FR
2d10: 4f 4d 20 72 65 76 69 73 69 6f 6e 20 52 2c 20 66 OM revision R, f
2d20: 69 6c 65 20 46 2c 20 73 79 6d 62 6f 6c 20 53 0a ile F, symbol S.
2d30: 09 09 57 48 45 52 45 20 52 2e 66 69 64 20 3d 20 ..WHERE R.fid =
2d40: 46 2e 66 69 64 0a 09 09 41 4e 44 20 20 20 52 2e F.fid...AND R.
2d50: 6c 6f 64 20 3d 20 53 2e 73 69 64 0a 09 09 41 4e lod = S.sid...AN
2d60: 44 20 20 20 46 2e 70 69 64 20 21 3d 20 53 2e 70 D F.pid != S.p
2d70: 69 64 0a 09 09 3b 0a 09 20 20 20 20 7d 0a 09 23 id...;.. }..#
2d80: 20 46 69 6e 64 20 61 6c 6c 20 72 65 76 69 73 69 Find all revisi
2d90: 6f 6e 73 20 77 68 69 63 68 20 64 69 73 67 72 65 ons which disgre
2da0: 65 20 77 69 74 68 20 74 68 65 69 72 20 6d 65 74 e with their met
2db0: 61 20 64 61 74 61 20 61 62 6f 75 74 0a 09 23 20 a data about..#
2dc0: 74 68 65 20 70 72 6f 6a 65 63 74 20 74 68 65 79 the project they
2dd0: 20 61 72 65 20 6f 77 6e 65 64 20 62 79 2e 0a 09 are owned by...
2de0: 43 68 65 63 6b 20 5c 0a 09 20 20 20 20 7b 52 65 Check \.. {Re
2df0: 76 69 73 69 6f 6e 73 20 61 6e 64 20 74 68 65 69 visions and thei
2e00: 72 20 6d 65 74 61 20 64 61 74 61 20 68 61 76 65 r meta data have
2e10: 20 74 6f 20 62 65 20 69 6e 20 74 68 65 20 73 61 to be in the sa
2e20: 6d 65 20 70 72 6f 6a 65 63 74 7d 20 5c 0a 09 20 me project} \..
2e30: 20 20 20 7b 64 69 73 61 67 72 65 65 73 20 77 69 {disagrees wi
2e40: 74 68 20 69 74 73 20 6d 65 74 61 20 64 61 74 61 th its meta data
2e50: 20 61 62 6f 75 74 20 6f 77 6e 69 6e 67 20 70 72 about owning pr
2e60: 6f 6a 65 63 74 7d 20 7b 0a 09 09 53 45 4c 45 43 oject} {...SELEC
2e70: 54 20 46 2e 6e 61 6d 65 2c 20 52 2e 72 65 76 0a T F.name, R.rev.
2e80: 09 09 46 52 4f 4d 20 72 65 76 69 73 69 6f 6e 20 ..FROM revision
2e90: 52 2c 20 66 69 6c 65 20 46 2c 20 6d 65 74 61 20 R, file F, meta
2ea0: 4d 0a 09 09 57 48 45 52 45 20 52 2e 66 69 64 20 M...WHERE R.fid
2eb0: 3d 20 46 2e 66 69 64 0a 09 09 41 4e 44 20 20 20 = F.fid...AND
2ec0: 52 2e 6d 69 64 20 3d 20 4d 2e 6d 69 64 0a 09 09 R.mid = M.mid...
2ed0: 41 4e 44 20 20 20 46 2e 70 69 64 20 21 3d 20 4d AND F.pid != M
2ee0: 2e 70 69 64 0a 09 09 3b 0a 09 20 20 20 20 7d 0a .pid...;.. }.
2ef0: 09 23 20 46 69 6e 64 20 61 6c 6c 20 72 65 76 69 .# Find all revi
2f00: 73 69 6f 6e 73 20 77 68 69 63 68 20 64 69 73 67 sions which disg
2f10: 72 65 65 20 77 69 74 68 20 74 68 65 69 72 20 6d ree with their m
2f20: 65 74 61 20 64 61 74 61 20 61 62 6f 75 74 0a 09 eta data about..
2f30: 23 20 74 68 65 20 62 72 61 6e 63 68 2f 6c 69 6e # the branch/lin
2f40: 65 20 6f 66 20 64 65 76 65 6c 6f 70 6d 65 6e 74 e of development
2f50: 20 74 68 65 79 20 62 65 6c 6f 6e 67 20 74 6f 2e they belong to.
2f60: 0a 09 43 68 65 63 6b 20 5c 0a 09 20 20 20 20 7b ..Check \.. {
2f70: 52 65 76 69 73 69 6f 6e 73 20 61 6e 64 20 74 68 Revisions and th
2f80: 65 69 72 20 6d 65 74 61 20 64 61 74 61 20 68 61 eir meta data ha
2f90: 76 65 20 74 6f 20 62 65 20 69 6e 20 74 68 65 20 ve to be in the
2fa0: 73 61 6d 65 20 4c 4f 44 7d 20 5c 0a 09 20 20 20 same LOD} \..
2fb0: 20 7b 64 69 73 61 67 72 65 65 73 20 77 69 74 68 {disagrees with
2fc0: 20 69 74 73 20 6d 65 74 61 20 64 61 74 61 20 61 its meta data a
2fd0: 62 6f 75 74 20 6f 77 6e 69 6e 67 20 4c 4f 44 7d bout owning LOD}
2fe0: 20 7b 0a 09 09 53 45 4c 45 43 54 20 46 2e 6e 61 {...SELECT F.na
2ff0: 6d 65 2c 20 52 2e 72 65 76 0a 09 09 46 52 4f 4d me, R.rev...FROM
3000: 20 72 65 76 69 73 69 6f 6e 20 52 2c 20 6d 65 74 revision R, met
3010: 61 20 4d 2c 20 66 69 6c 65 20 46 0a 09 09 57 48 a M, file F...WH
3020: 45 52 45 20 52 2e 6d 69 64 20 3d 20 4d 2e 6d 69 ERE R.mid = M.mi
3030: 64 0a 09 09 41 4e 44 20 20 20 52 2e 6c 6f 64 20 d...AND R.lod
3040: 21 3d 20 4d 2e 62 69 64 0a 09 09 41 4e 44 20 20 != M.bid...AND
3050: 20 52 2e 66 69 64 20 3d 20 46 2e 66 69 64 0a 09 R.fid = F.fid..
3060: 09 3b 0a 09 20 20 20 20 7d 0a 09 23 20 46 69 6e .;.. }..# Fin
3070: 64 20 61 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 d all revisions
3080: 77 69 74 68 20 61 20 70 72 69 6d 61 72 79 20 63 with a primary c
3090: 68 69 6c 64 20 77 68 69 63 68 20 64 69 73 61 67 hild which disag
30a0: 72 65 65 73 0a 09 23 20 61 62 6f 75 74 20 74 68 rees..# about th
30b0: 65 20 66 69 6c 65 20 74 68 65 79 20 62 65 6c 6f e file they belo
30c0: 6e 67 20 74 6f 2e 0a 09 43 68 65 63 6b 20 5c 0a ng to...Check \.
30d0: 09 20 20 20 20 7b 52 65 76 69 73 69 6f 6e 73 20 . {Revisions
30e0: 61 6e 64 20 74 68 65 69 72 20 70 72 69 6d 61 72 and their primar
30f0: 79 20 63 68 69 6c 64 72 65 6e 20 68 61 76 65 20 y children have
3100: 74 6f 20 62 65 20 69 6e 20 74 68 65 20 73 61 6d to be in the sam
3110: 65 20 66 69 6c 65 7d 20 5c 0a 09 20 20 20 20 7b e file} \.. {
3120: 64 69 73 61 67 72 65 65 73 20 77 69 74 68 20 69 disagrees with i
3130: 74 73 20 70 72 69 6d 61 72 79 20 63 68 69 6c 64 ts primary child
3140: 20 61 62 6f 75 74 20 74 68 65 20 6f 77 6e 69 6e about the ownin
3150: 67 20 66 69 6c 65 7d 20 7b 0a 09 09 53 45 4c 45 g file} {...SELE
3160: 43 54 20 46 2e 6e 61 6d 65 2c 20 52 2e 72 65 76 CT F.name, R.rev
3170: 0a 09 09 46 52 4f 4d 20 72 65 76 69 73 69 6f 6e ...FROM revision
3180: 20 52 2c 20 72 65 76 69 73 69 6f 6e 20 43 2c 20 R, revision C,
3190: 66 69 6c 65 20 46 0a 09 09 57 48 45 52 45 20 52 file F...WHERE R
31a0: 2e 66 69 64 20 3d 20 46 2e 66 69 64 0a 09 09 41 .fid = F.fid...A
31b0: 4e 44 20 20 20 52 2e 63 68 69 6c 64 20 49 53 20 ND R.child IS
31c0: 4e 4f 54 20 4e 55 4c 4c 0a 09 09 41 4e 44 20 20 NOT NULL...AND
31d0: 20 52 2e 63 68 69 6c 64 20 3d 20 43 2e 72 69 64 R.child = C.rid
31e0: 0a 09 09 41 4e 44 20 20 20 43 2e 66 69 64 20 21 ...AND C.fid !
31f0: 3d 20 52 2e 66 69 64 0a 09 09 3b 0a 09 20 20 20 = R.fid...;..
3200: 20 7d 0a 0a 09 23 20 46 69 6e 64 20 61 6c 6c 20 }...# Find all
3210: 72 65 76 69 73 69 6f 6e 73 20 77 69 74 68 20 61 revisions with a
3220: 20 62 72 61 6e 63 68 20 70 61 72 65 6e 74 20 73 branch parent s
3230: 79 6d 62 6f 6c 20 77 68 6f 73 65 20 70 61 72 65 ymbol whose pare
3240: 6e 74 0a 09 23 20 64 69 73 61 67 72 65 65 73 20 nt..# disagrees
3250: 61 62 6f 75 74 20 74 68 65 20 66 69 6c 65 20 74 about the file t
3260: 68 65 79 20 62 65 6c 6f 6e 67 20 74 6f 2e 0a 09 hey belong to...
3270: 43 68 65 63 6b 20 5c 0a 09 20 20 20 20 7b 52 65 Check \.. {Re
3280: 76 69 73 69 6f 6e 73 20 61 6e 64 20 74 68 65 69 visions and thei
3290: 72 20 62 72 61 6e 63 68 20 63 68 69 6c 64 72 65 r branch childre
32a0: 6e 20 68 61 76 65 20 74 6f 20 62 65 20 69 6e 20 n have to be in
32b0: 74 68 65 20 73 61 6d 65 20 66 69 6c 65 7d 20 5c the same file} \
32c0: 0a 09 20 20 20 20 7b 61 74 20 74 68 65 20 62 65 .. {at the be
32d0: 67 69 6e 6e 69 6e 67 20 6f 66 20 69 74 73 20 62 ginning of its b
32e0: 72 61 6e 63 68 20 61 6e 64 20 69 74 73 20 70 61 ranch and its pa
32f0: 72 65 6e 74 20 64 69 73 61 67 72 65 65 20 61 62 rent disagree ab
3300: 6f 75 74 20 74 68 65 20 6f 77 6e 69 6e 67 20 66 out the owning f
3310: 69 6c 65 7d 20 7b 0a 09 09 53 45 4c 45 43 54 20 ile} {...SELECT
3320: 46 2e 6e 61 6d 65 2c 20 52 2e 72 65 76 0a 09 09 F.name, R.rev...
3330: 46 52 4f 4d 20 72 65 76 69 73 69 6f 6e 20 52 2c FROM revision R,
3340: 20 72 65 76 69 73 69 6f 6e 20 50 2c 20 66 69 6c revision P, fil
3350: 65 20 46 0a 09 09 57 48 45 52 45 20 52 2e 66 69 e F...WHERE R.fi
3360: 64 20 3d 20 46 2e 66 69 64 0a 09 09 41 4e 44 20 d = F.fid...AND
3370: 20 20 52 2e 62 70 61 72 65 6e 74 20 49 53 20 4e R.bparent IS N
3380: 4f 54 20 4e 55 4c 4c 0a 09 09 41 4e 44 20 20 20 OT NULL...AND
3390: 52 2e 70 61 72 65 6e 74 20 3d 20 50 2e 72 69 64 R.parent = P.rid
33a0: 0a 09 09 41 4e 44 20 20 20 52 2e 66 69 64 20 21 ...AND R.fid !
33b0: 3d 20 50 2e 66 69 64 0a 09 09 3b 0a 09 20 20 20 = P.fid...;..
33c0: 20 7d 0a 09 23 20 46 69 6e 64 20 61 6c 6c 20 72 }..# Find all r
33d0: 65 76 69 73 69 6f 6e 73 20 77 69 74 68 20 61 20 evisions with a
33e0: 6e 6f 6e 2d 4e 54 44 42 20 63 68 69 6c 64 20 77 non-NTDB child w
33f0: 68 69 63 68 20 64 69 73 61 67 72 65 65 73 0a 09 hich disagrees..
3400: 23 20 61 62 6f 75 74 20 74 68 65 20 66 69 6c 65 # about the file
3410: 20 74 68 65 79 20 62 65 6c 6f 6e 67 20 74 6f 2e they belong to.
3420: 0a 09 43 68 65 63 6b 20 5c 0a 09 20 20 20 20 7b ..Check \.. {
3430: 52 65 76 69 73 69 6f 6e 73 20 61 6e 64 20 74 68 Revisions and th
3440: 65 69 72 20 6e 6f 6e 2d 4e 54 44 42 20 63 68 69 eir non-NTDB chi
3450: 6c 64 72 65 6e 20 68 61 76 65 20 74 6f 20 62 65 ldren have to be
3460: 20 69 6e 20 74 68 65 20 73 61 6d 65 20 66 69 6c in the same fil
3470: 65 7d 20 5c 0a 09 20 20 20 20 7b 64 69 73 61 67 e} \.. {disag
3480: 72 65 65 73 20 77 69 74 68 20 69 74 73 20 6e 6f rees with its no
3490: 6e 2d 4e 54 44 42 20 63 68 69 6c 64 20 61 62 6f n-NTDB child abo
34a0: 75 74 20 74 68 65 20 6f 77 6e 69 6e 67 20 66 69 ut the owning fi
34b0: 6c 65 7d 20 7b 0a 09 09 53 45 4c 45 43 54 20 46 le} {...SELECT F
34c0: 2e 6e 61 6d 65 2c 20 52 2e 72 65 76 0a 09 09 46 .name, R.rev...F
34d0: 52 4f 4d 20 72 65 76 69 73 69 6f 6e 20 52 2c 20 ROM revision R,
34e0: 72 65 76 69 73 69 6f 6e 20 43 2c 20 66 69 6c 65 revision C, file
34f0: 20 46 0a 09 09 57 48 45 52 45 20 52 2e 66 69 64 F...WHERE R.fid
3500: 20 3d 20 46 2e 66 69 64 0a 09 09 41 4e 44 20 20 = F.fid...AND
3510: 20 52 2e 64 62 63 68 69 6c 64 20 49 53 20 4e 4f R.dbchild IS NO
3520: 54 20 4e 55 4c 4c 0a 09 09 41 4e 44 20 20 20 52 T NULL...AND R
3530: 2e 64 62 63 68 69 6c 64 20 3d 20 43 2e 72 69 64 .dbchild = C.rid
3540: 0a 09 09 41 4e 44 20 20 20 43 2e 66 69 64 20 21 ...AND C.fid !
3550: 3d 20 52 2e 66 69 64 0a 09 09 3b 0a 09 20 20 20 = R.fid...;..
3560: 20 7d 0a 09 23 20 46 69 6e 64 20 61 6c 6c 20 72 }..# Find all r
3570: 65 76 69 73 69 6f 6e 73 20 77 68 69 63 68 20 68 evisions which h
3580: 61 76 65 20 61 20 70 72 69 6d 61 72 79 20 63 68 ave a primary ch
3590: 69 6c 64 2c 20 62 75 74 20 74 68 65 20 63 68 69 ild, but the chi
35a0: 6c 64 0a 09 23 20 64 6f 65 73 20 6e 6f 74 20 68 ld..# does not h
35b0: 61 76 65 20 74 68 65 6d 20 61 73 20 70 61 72 65 ave them as pare
35c0: 6e 74 2e 0a 09 43 68 65 63 6b 20 5c 0a 09 20 20 nt...Check \..
35d0: 20 20 7b 52 65 76 69 73 69 6f 6e 73 20 68 61 76 {Revisions hav
35e0: 65 20 74 6f 20 62 65 20 70 61 72 65 6e 74 73 20 e to be parents
35f0: 6f 66 20 74 68 65 69 72 20 70 72 69 6d 61 72 79 of their primary
3600: 20 63 68 69 6c 64 72 65 6e 7d 20 5c 0a 09 20 20 children} \..
3610: 20 20 7b 69 73 20 6e 6f 74 20 74 68 65 20 70 61 {is not the pa
3620: 72 65 6e 74 20 6f 66 20 69 74 73 20 70 72 69 6d rent of its prim
3630: 61 72 79 20 63 68 69 6c 64 7d 20 7b 0a 09 09 53 ary child} {...S
3640: 45 4c 45 43 54 20 46 2e 6e 61 6d 65 2c 20 52 2e ELECT F.name, R.
3650: 72 65 76 0a 09 09 46 52 4f 4d 20 72 65 76 69 73 rev...FROM revis
3660: 69 6f 6e 20 52 2c 20 72 65 76 69 73 69 6f 6e 20 ion R, revision
3670: 43 2c 20 66 69 6c 65 20 46 0a 09 09 57 48 45 52 C, file F...WHER
3680: 45 20 52 2e 66 69 64 20 3d 20 46 2e 66 69 64 0a E R.fid = F.fid.
3690: 09 09 41 4e 44 20 20 20 52 2e 63 68 69 6c 64 20 ..AND R.child
36a0: 49 53 20 4e 4f 54 20 4e 55 4c 4c 0a 09 09 41 4e IS NOT NULL...AN
36b0: 44 20 20 20 52 2e 63 68 69 6c 64 20 3d 20 43 2e D R.child = C.
36c0: 72 69 64 0a 09 09 41 4e 44 20 20 20 43 2e 70 61 rid...AND C.pa
36d0: 72 65 6e 74 20 21 3d 20 52 2e 72 69 64 0a 09 09 rent != R.rid...
36e0: 3b 0a 09 20 20 20 20 7d 0a 09 23 20 46 69 6e 64 ;.. }..# Find
36f0: 20 61 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 77 all revisions w
3700: 68 69 63 68 20 68 61 76 65 20 61 20 70 72 69 6d hich have a prim
3710: 72 61 72 79 20 63 68 69 6c 64 2c 20 62 75 74 20 rary child, but
3720: 74 68 65 0a 09 23 20 63 68 69 6c 64 20 68 61 73 the..# child has
3730: 20 61 20 62 72 61 6e 63 68 20 70 61 72 65 6e 74 a branch parent
3740: 20 73 79 6d 62 6f 6c 20 6d 61 6b 69 6e 67 20 74 symbol making t
3750: 68 65 6d 20 62 72 61 63 68 20 73 74 61 72 74 65 hem brach starte
3760: 72 73 2e 0a 09 43 68 65 63 6b 20 5c 0a 09 20 20 rs...Check \..
3770: 20 20 7b 50 72 69 6d 61 72 79 20 63 68 69 6c 64 {Primary child
3780: 72 65 6e 20 6f 66 20 72 65 76 69 73 69 6f 6e 73 ren of revisions
3790: 20 6d 75 73 74 20 6e 6f 74 20 73 74 61 72 74 20 must not start
37a0: 62 72 61 6e 63 68 65 73 7d 20 5c 0a 09 20 20 20 branches} \..
37b0: 20 7b 69 73 20 70 61 72 65 6e 74 20 6f 66 20 61 {is parent of a
37c0: 20 70 72 69 6d 61 72 79 20 63 68 69 6c 64 20 77 primary child w
37d0: 68 69 63 68 20 69 73 20 74 68 65 20 62 65 67 69 hich is the begi
37e0: 6e 6e 69 6e 67 20 6f 66 20 61 20 62 72 61 6e 63 nning of a branc
37f0: 68 7d 20 7b 0a 09 09 53 45 4c 45 43 54 20 46 2e h} {...SELECT F.
3800: 6e 61 6d 65 2c 20 52 2e 72 65 76 0a 09 09 46 52 name, R.rev...FR
3810: 4f 4d 20 72 65 76 69 73 69 6f 6e 20 52 2c 20 72 OM revision R, r
3820: 65 76 69 73 69 6f 6e 20 43 2c 20 66 69 6c 65 20 evision C, file
3830: 46 0a 09 09 57 48 45 52 45 20 52 2e 66 69 64 20 F...WHERE R.fid
3840: 3d 20 46 2e 66 69 64 0a 09 09 41 4e 44 20 20 20 = F.fid...AND
3850: 52 2e 63 68 69 6c 64 20 49 53 20 4e 4f 54 20 4e R.child IS NOT N
3860: 55 4c 4c 0a 09 09 41 4e 44 20 20 20 52 2e 63 68 ULL...AND R.ch
3870: 69 6c 64 20 3d 20 43 2e 72 69 64 0a 09 09 41 4e ild = C.rid...AN
3880: 44 20 20 20 43 2e 62 70 61 72 65 6e 74 20 49 53 D C.bparent IS
3890: 20 4e 4f 54 20 4e 55 4c 4c 0a 09 09 3b 0a 09 20 NOT NULL...;..
38a0: 20 20 20 7d 0a 09 23 20 46 69 6e 64 20 61 6c 6c }..# Find all
38b0: 20 72 65 76 69 73 69 6f 6e 73 20 77 69 74 68 6f revisions witho
38c0: 75 74 20 62 72 61 6e 63 68 20 70 61 72 65 6e 74 ut branch parent
38d0: 20 73 79 6d 62 6f 6c 20 77 68 69 63 68 20 68 61 symbol which ha
38e0: 76 65 20 61 0a 09 23 20 70 61 72 65 6e 74 2c 20 ve a..# parent,
38f0: 62 75 74 20 74 68 65 20 70 61 72 65 6e 74 20 64 but the parent d
3900: 6f 65 73 20 6e 6f 74 20 68 61 76 65 20 74 68 65 oes not have the
3910: 6d 20 61 73 20 70 72 69 6d 61 72 79 20 63 68 69 m as primary chi
3920: 6c 64 2e 0a 09 43 68 65 63 6b 20 5c 0a 09 20 20 ld...Check \..
3930: 20 20 7b 52 65 76 69 73 69 6f 6e 73 20 68 61 76 {Revisions hav
3940: 65 20 74 6f 20 62 65 20 70 72 69 6d 61 72 79 20 e to be primary
3950: 63 68 69 6c 64 72 65 6e 20 6f 66 20 74 68 65 69 children of thei
3960: 72 20 70 61 72 65 6e 74 73 2c 20 69 66 20 61 6e r parents, if an
3970: 79 7d 20 5c 0a 09 20 20 20 20 7b 69 73 20 6e 6f y} \.. {is no
3980: 74 20 74 68 65 20 63 68 69 6c 64 20 6f 66 20 69 t the child of i
3990: 74 73 20 70 61 72 65 6e 74 7d 20 7b 0a 09 09 53 ts parent} {...S
39a0: 45 4c 45 43 54 20 46 2e 6e 61 6d 65 2c 20 52 2e ELECT F.name, R.
39b0: 72 65 76 0a 09 09 46 52 4f 4d 20 72 65 76 69 73 rev...FROM revis
39c0: 69 6f 6e 20 52 2c 20 72 65 76 69 73 69 6f 6e 20 ion R, revision
39d0: 50 2c 20 66 69 6c 65 20 46 0a 09 09 57 48 45 52 P, file F...WHER
39e0: 45 20 52 2e 66 69 64 20 3d 20 46 2e 66 69 64 0a E R.fid = F.fid.
39f0: 09 09 41 4e 44 20 20 20 52 2e 62 70 61 72 65 6e ..AND R.bparen
3a00: 74 20 49 53 20 4e 55 4c 4c 0a 09 09 41 4e 44 20 t IS NULL...AND
3a10: 20 20 52 2e 70 61 72 65 6e 74 20 49 53 20 4e 4f R.parent IS NO
3a20: 54 20 4e 55 4c 4c 0a 09 09 41 4e 44 20 20 20 52 T NULL...AND R
3a30: 2e 70 61 72 65 6e 74 20 3d 20 50 2e 72 69 64 0a .parent = P.rid.
3a40: 09 09 41 4e 44 20 20 20 50 2e 63 68 69 6c 64 20 ..AND P.child
3a50: 21 3d 20 52 2e 72 69 64 0a 09 09 3b 0a 09 20 20 != R.rid...;..
3a60: 20 20 7d 0a 09 23 20 46 69 6e 64 20 61 6c 6c 20 }..# Find all
3a70: 72 65 76 69 73 69 6f 6e 73 20 77 69 74 68 20 61 revisions with a
3a80: 20 62 72 61 6e 63 68 20 70 61 72 65 6e 74 20 73 branch parent s
3a90: 79 6d 62 6f 6c 20 77 68 69 63 68 20 64 6f 20 6e ymbol which do n
3aa0: 6f 74 0a 09 23 20 68 61 76 65 20 61 20 70 61 72 ot..# have a par
3ab0: 65 6e 74 2e 0a 09 43 68 65 63 6b 20 5c 0a 09 20 ent...Check \..
3ac0: 20 20 20 7b 42 72 61 6e 63 68 20 73 74 61 72 74 {Branch start
3ad0: 69 6e 67 20 72 65 76 69 73 69 6f 6e 73 20 68 61 ing revisions ha
3ae0: 76 65 20 74 6f 20 68 61 76 65 20 61 20 70 61 72 ve to have a par
3af0: 65 6e 74 7d 20 5c 0a 09 20 20 20 20 7b 61 74 20 ent} \.. {at
3b00: 74 68 65 20 62 65 67 69 6e 6e 69 6e 67 20 6f 66 the beginning of
3b10: 20 69 74 73 20 62 72 61 6e 63 68 20 68 61 73 20 its branch has
3b20: 6e 6f 20 70 61 72 65 6e 74 7d 20 7b 0a 09 09 53 no parent} {...S
3b30: 45 4c 45 43 54 20 46 2e 6e 61 6d 65 2c 20 52 2e ELECT F.name, R.
3b40: 72 65 76 0a 09 09 46 52 4f 4d 20 72 65 76 69 73 rev...FROM revis
3b50: 69 6f 6e 20 52 2c 20 66 69 6c 65 20 46 0a 09 09 ion R, file F...
3b60: 57 48 45 52 45 20 52 2e 66 69 64 20 3d 20 46 2e WHERE R.fid = F.
3b70: 66 69 64 0a 09 09 41 4e 44 20 20 20 52 2e 62 70 fid...AND R.bp
3b80: 61 72 65 6e 74 20 49 53 20 4e 4f 54 20 4e 55 4c arent IS NOT NUL
3b90: 4c 0a 09 09 41 4e 44 20 20 20 52 2e 70 61 72 65 L...AND R.pare
3ba0: 6e 74 20 49 53 20 4e 55 4c 4c 0a 09 09 3b 0a 09 nt IS NULL...;..
3bb0: 20 20 20 20 7d 0a 09 23 20 46 69 6e 64 20 61 6c }..# Find al
3bc0: 6c 20 72 65 76 69 73 69 6f 6e 73 20 77 69 74 68 l revisions with
3bd0: 20 61 20 62 72 61 6e 63 68 20 70 61 72 65 6e 74 a branch parent
3be0: 20 73 79 6d 62 6f 6c 20 77 68 6f 73 65 20 70 61 symbol whose pa
3bf0: 72 65 6e 74 0a 09 23 20 68 61 73 20 74 68 65 6d rent..# has them
3c00: 20 61 73 20 70 72 69 6d 61 72 79 20 63 68 69 6c as primary chil
3c10: 64 2e 0a 09 43 68 65 63 6b 20 5c 0a 09 20 20 20 d...Check \..
3c20: 20 7b 42 72 61 6e 63 68 20 73 74 61 72 74 69 6e {Branch startin
3c30: 67 20 72 65 76 69 73 69 6f 6e 73 20 6d 75 73 74 g revisions must
3c40: 20 6e 6f 74 20 62 65 20 70 72 69 6d 61 72 79 20 not be primary
3c50: 63 68 69 6c 64 72 65 6e 20 6f 66 20 74 68 65 69 children of thei
3c60: 72 20 70 61 72 65 6e 74 73 7d 20 5c 0a 09 20 20 r parents} \..
3c70: 20 20 7b 61 74 20 74 68 65 20 62 65 67 69 6e 6e {at the beginn
3c80: 69 6e 67 20 6f 66 20 69 74 73 20 62 72 61 6e 63 ing of its branc
3c90: 68 20 69 73 20 74 68 65 20 70 72 69 6d 61 72 79 h is the primary
3ca0: 20 63 68 69 6c 64 20 6f 66 20 69 74 73 20 70 61 child of its pa
3cb0: 72 65 6e 74 7d 20 7b 0a 09 09 53 45 4c 45 43 54 rent} {...SELECT
3cc0: 20 46 2e 6e 61 6d 65 2c 20 52 2e 72 65 76 0a 09 F.name, R.rev..
3cd0: 09 46 52 4f 4d 20 72 65 76 69 73 69 6f 6e 20 52 .FROM revision R
3ce0: 2c 20 72 65 76 69 73 69 6f 6e 20 50 2c 20 66 69 , revision P, fi
3cf0: 6c 65 20 46 0a 09 09 57 48 45 52 45 20 52 2e 66 le F...WHERE R.f
3d00: 69 64 20 3d 20 46 2e 66 69 64 0a 09 09 41 4e 44 id = F.fid...AND
3d10: 20 20 20 52 2e 62 70 61 72 65 6e 74 20 49 53 20 R.bparent IS
3d20: 4e 4f 54 20 4e 55 4c 4c 0a 09 09 41 4e 44 20 20 NOT NULL...AND
3d30: 20 52 2e 70 61 72 65 6e 74 20 49 53 20 4e 4f 54 R.parent IS NOT
3d40: 20 4e 55 4c 4c 0a 09 09 41 4e 44 20 20 20 52 2e NULL...AND R.
3d50: 70 61 72 65 6e 74 20 3d 20 50 2e 72 69 64 0a 09 parent = P.rid..
3d60: 09 41 4e 44 20 20 20 50 2e 63 68 69 6c 64 20 3d .AND P.child =
3d70: 20 52 2e 72 69 64 0a 09 09 3b 0a 09 20 20 20 20 R.rid...;..
3d80: 7d 0a 09 23 20 46 69 6e 64 20 61 6c 6c 20 72 65 }..# Find all re
3d90: 76 69 73 69 6f 6e 73 20 77 69 74 68 20 61 20 6e visions with a n
3da0: 6f 6e 2d 4e 54 44 42 20 63 68 69 6c 64 20 77 68 on-NTDB child wh
3db0: 69 63 68 20 61 72 65 20 6e 6f 74 20 6f 6e 0a 09 ich are not on..
3dc0: 23 20 74 68 65 20 4e 54 44 42 2e 0a 09 43 68 65 # the NTDB...Che
3dd0: 63 6b 20 5c 0a 09 20 20 20 20 7b 4e 54 44 42 20 ck \.. {NTDB
3de0: 74 6f 20 74 72 75 6e 6b 20 74 72 61 6e 73 69 74 to trunk transit
3df0: 69 6f 6e 20 68 61 73 20 74 6f 20 62 65 67 69 6e ion has to begin
3e00: 20 6f 6e 20 4e 54 44 42 7d 20 5c 0a 09 20 20 20 on NTDB} \..
3e10: 20 7b 68 61 73 20 61 20 6e 6f 6e 2d 4e 54 44 42 {has a non-NTDB
3e20: 20 63 68 69 6c 64 2c 20 79 65 74 20 69 73 20 6e child, yet is n
3e30: 6f 74 20 6f 6e 20 74 68 65 20 4e 54 44 42 7d 20 ot on the NTDB}
3e40: 7b 0a 09 09 53 45 4c 45 43 54 20 46 2e 6e 61 6d {...SELECT F.nam
3e50: 65 2c 20 52 2e 72 65 76 0a 09 09 46 52 4f 4d 20 e, R.rev...FROM
3e60: 72 65 76 69 73 69 6f 6e 20 52 2c 20 66 69 6c 65 revision R, file
3e70: 20 46 0a 09 09 57 48 45 52 45 20 52 2e 66 69 64 F...WHERE R.fid
3e80: 20 3d 20 46 2e 66 69 64 0a 09 09 41 4e 44 20 20 = F.fid...AND
3e90: 20 52 2e 64 62 63 68 69 6c 64 20 49 53 20 4e 4f R.dbchild IS NO
3ea0: 54 20 4e 55 4c 4c 0a 09 09 41 4e 44 20 20 20 4e T NULL...AND N
3eb0: 4f 54 20 52 2e 69 73 64 65 66 61 75 6c 74 0a 09 OT R.isdefault..
3ec0: 09 3b 0a 09 20 20 20 20 7d 0a 09 23 20 46 69 6e .;.. }..# Fin
3ed0: 64 20 61 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 d all revisions
3ee0: 77 69 74 68 20 61 20 4e 54 44 42 20 70 61 72 65 with a NTDB pare
3ef0: 6e 74 20 77 68 69 63 68 20 61 72 65 20 6f 6e 20 nt which are on
3f00: 74 68 65 20 4e 54 44 42 2e 0a 09 43 68 65 63 6b the NTDB...Check
3f10: 20 5c 0a 09 20 20 20 20 7b 4e 54 44 42 20 74 6f \.. {NTDB to
3f20: 20 74 72 75 6e 6b 20 74 72 61 6e 73 69 74 69 6f trunk transitio
3f30: 6e 20 68 61 73 20 74 6f 20 65 6e 64 20 6f 6e 20 n has to end on
3f40: 6e 6f 6e 2d 4e 54 44 42 7d 20 5c 0a 09 20 20 20 non-NTDB} \..
3f50: 20 7b 68 61 73 20 61 20 4e 54 44 42 20 70 61 72 {has a NTDB par
3f60: 65 6e 74 2c 20 79 65 74 20 69 73 20 6f 6e 20 74 ent, yet is on t
3f70: 68 65 20 4e 54 44 42 7d 20 7b 0a 09 09 53 45 4c he NTDB} {...SEL
3f80: 45 43 54 20 46 2e 6e 61 6d 65 2c 20 52 2e 72 65 ECT F.name, R.re
3f90: 76 0a 09 09 46 52 4f 4d 20 72 65 76 69 73 69 6f v...FROM revisio
3fa0: 6e 20 52 2c 20 66 69 6c 65 20 46 0a 09 09 57 48 n R, file F...WH
3fb0: 45 52 45 20 52 2e 66 69 64 20 3d 20 46 2e 66 69 ERE R.fid = F.fi
3fc0: 64 0a 09 09 41 4e 44 20 20 20 52 2e 64 62 70 61 d...AND R.dbpa
3fd0: 72 65 6e 74 20 49 53 20 4e 4f 54 20 4e 55 4c 4c rent IS NOT NULL
3fe0: 0a 09 09 41 4e 44 20 20 20 52 2e 69 73 64 65 66 ...AND R.isdef
3ff0: 61 75 6c 74 0a 09 09 3b 0a 09 20 20 20 20 7d 0a ault...;.. }.
4000: 09 23 20 46 69 6e 64 20 61 6c 6c 20 72 65 76 69 .# Find all revi
4010: 73 69 6f 6e 73 20 77 69 74 68 20 61 20 63 68 69 sions with a chi
4020: 6c 64 20 77 68 69 63 68 20 64 69 73 61 67 72 65 ld which disagre
4030: 65 73 20 61 62 6f 75 74 20 74 68 65 0a 09 23 20 es about the..#
4040: 6c 69 6e 65 20 6f 66 20 64 65 76 65 6c 6f 70 6d line of developm
4050: 65 6e 74 20 74 68 65 79 20 62 65 6c 6f 6e 67 20 ent they belong
4060: 74 6f 2e 0a 09 43 68 65 63 6b 20 5c 0a 09 20 20 to...Check \..
4070: 20 20 7b 52 65 76 69 73 69 6f 6e 73 20 61 6e 64 {Revisions and
4080: 20 74 68 65 69 72 20 70 72 69 6d 61 72 79 20 63 their primary c
4090: 68 69 6c 64 72 65 6e 20 68 61 76 65 20 74 6f 20 hildren have to
40a0: 62 65 20 69 6e 20 74 68 65 20 73 61 6d 65 20 4c be in the same L
40b0: 4f 44 7d 20 5c 0a 09 20 20 20 20 7b 61 6e 64 20 OD} \.. {and
40c0: 69 74 73 20 70 72 69 6d 61 72 79 20 63 68 69 6c its primary chil
40d0: 64 20 64 69 73 61 67 72 65 65 20 61 62 6f 75 74 d disagree about
40e0: 20 74 68 65 69 72 20 4c 4f 44 7d 20 7b 0a 09 09 their LOD} {...
40f0: 53 45 4c 45 43 54 20 46 2e 6e 61 6d 65 2c 20 52 SELECT F.name, R
4100: 2e 72 65 76 0a 09 09 46 52 4f 4d 20 72 65 76 69 .rev...FROM revi
4110: 73 69 6f 6e 20 52 2c 20 72 65 76 69 73 69 6f 6e sion R, revision
4120: 20 43 2c 20 66 69 6c 65 20 46 0a 09 09 57 48 45 C, file F...WHE
4130: 52 45 20 52 2e 66 69 64 20 3d 20 46 2e 66 69 64 RE R.fid = F.fid
4140: 0a 09 09 41 4e 44 20 20 20 52 2e 63 68 69 6c 64 ...AND R.child
4150: 20 49 53 20 4e 4f 54 20 4e 55 4c 4c 0a 09 09 41 IS NOT NULL...A
4160: 4e 44 20 20 20 52 2e 63 68 69 6c 64 20 3d 20 43 ND R.child = C
4170: 2e 72 69 64 0a 09 09 41 4e 44 20 20 20 43 2e 6c .rid...AND C.l
4180: 6f 64 20 21 3d 20 52 2e 6c 6f 64 0a 09 09 3b 0a od != R.lod...;.
4190: 09 20 20 20 20 7d 0a 09 23 20 46 69 6e 64 20 61 . }..# Find a
41a0: 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 77 69 74 ll revisions wit
41b0: 68 20 61 20 6e 6f 6e 2d 4e 54 44 42 20 63 68 69 h a non-NTDB chi
41c0: 6c 64 20 77 68 69 63 68 20 61 67 72 65 65 73 20 ld which agrees
41d0: 61 62 6f 75 74 0a 09 23 20 74 68 65 20 6c 69 6e about..# the lin
41e0: 65 20 6f 66 20 64 65 76 65 6c 6f 70 6d 65 6e 74 e of development
41f0: 20 74 68 65 79 20 62 65 6c 6f 6e 67 20 74 6f 2e they belong to.
4200: 0a 09 43 68 65 63 6b 20 5c 0a 09 20 20 20 20 7b ..Check \.. {
4210: 4e 54 44 42 20 61 6e 64 20 74 72 75 6e 6b 20 72 NTDB and trunk r
4220: 65 76 69 73 69 6f 6e 73 20 68 61 76 65 20 74 6f evisions have to
4230: 20 62 65 20 69 6e 20 64 69 66 66 65 72 65 6e 74 be in different
4240: 20 4c 4f 44 73 7d 20 5c 0a 09 20 20 20 20 7b 6f LODs} \.. {o
4250: 6e 20 4e 54 44 42 20 61 6e 64 20 69 74 73 20 6e n NTDB and its n
4260: 6f 6e 2d 4e 54 44 42 20 63 68 69 6c 64 20 77 72 on-NTDB child wr
4270: 6f 6e 67 6c 79 20 61 67 72 65 65 20 61 62 6f 75 ongly agree abou
4280: 74 20 74 68 65 69 72 20 4c 4f 44 7d 20 7b 0a 09 t their LOD} {..
4290: 09 53 45 4c 45 43 54 20 46 2e 6e 61 6d 65 2c 20 .SELECT F.name,
42a0: 52 2e 72 65 76 0a 09 09 46 52 4f 4d 20 72 65 76 R.rev...FROM rev
42b0: 69 73 69 6f 6e 20 52 2c 20 72 65 76 69 73 69 6f ision R, revisio
42c0: 6e 20 43 2c 20 66 69 6c 65 20 46 0a 09 09 57 48 n C, file F...WH
42d0: 45 52 45 20 52 2e 66 69 64 20 3d 20 46 2e 66 69 ERE R.fid = F.fi
42e0: 64 0a 09 09 41 4e 44 20 20 20 52 2e 64 62 63 68 d...AND R.dbch
42f0: 69 6c 64 20 49 53 20 4e 4f 54 20 4e 55 4c 4c 0a ild IS NOT NULL.
4300: 09 09 41 4e 44 20 20 20 52 2e 64 62 63 68 69 6c ..AND R.dbchil
4310: 64 20 3d 20 43 2e 72 69 64 0a 09 09 41 4e 44 20 d = C.rid...AND
4320: 20 20 43 2e 6c 6f 64 20 3d 20 52 2e 6c 6f 64 0a C.lod = R.lod.
4330: 09 09 3b 0a 09 20 20 20 20 7d 0a 09 23 20 46 69 ..;.. }..# Fi
4340: 6e 64 20 61 6c 6c 20 72 65 76 69 73 69 6f 6e 73 nd all revisions
4350: 20 77 69 74 68 20 61 20 62 72 61 6e 63 68 20 70 with a branch p
4360: 61 72 65 6e 74 20 73 79 6d 62 6f 6c 20 77 68 69 arent symbol whi
4370: 63 68 20 69 73 20 6e 6f 74 0a 09 23 20 74 68 65 ch is not..# the
4380: 69 72 20 4c 4f 44 2e 0a 09 43 68 65 63 6b 20 5c ir LOD...Check \
4390: 0a 09 20 20 20 20 7b 42 72 61 6e 63 68 20 73 74 .. {Branch st
43a0: 61 72 74 69 6e 67 20 72 65 76 69 73 69 6f 6e 73 arting revisions
43b0: 20 68 61 76 65 20 74 6f 20 68 61 76 65 20 74 68 have to have th
43c0: 65 69 72 20 4c 4f 44 20 61 73 20 62 72 61 6e 63 eir LOD as branc
43d0: 68 20 70 61 72 65 6e 74 20 73 79 6d 62 6f 6c 7d h parent symbol}
43e0: 20 5c 0a 09 20 20 20 20 7b 61 74 20 74 68 65 20 \.. {at the
43f0: 62 65 67 69 6e 6e 69 6e 67 20 6f 66 20 69 74 73 beginning of its
4400: 20 62 72 61 6e 63 68 20 64 6f 65 73 20 6e 6f 74 branch does not
4410: 20 68 61 76 65 20 74 68 65 20 62 72 61 6e 63 68 have the branch
4420: 20 73 79 6d 62 6f 6c 20 61 73 20 69 74 73 20 4c symbol as its L
4430: 4f 44 7d 20 7b 0a 09 09 53 45 4c 45 43 54 20 46 OD} {...SELECT F
4440: 2e 6e 61 6d 65 2c 20 52 2e 72 65 76 0a 09 09 46 .name, R.rev...F
4450: 52 4f 4d 20 72 65 76 69 73 69 6f 6e 20 52 2c 20 ROM revision R,
4460: 66 69 6c 65 20 46 0a 09 09 57 48 45 52 45 20 52 file F...WHERE R
4470: 2e 66 69 64 20 3d 20 46 2e 66 69 64 0a 09 09 41 .fid = F.fid...A
4480: 4e 44 20 20 20 52 2e 62 70 61 72 65 6e 74 20 49 ND R.bparent I
4490: 53 20 4e 4f 54 20 4e 55 4c 4c 0a 09 09 41 4e 44 S NOT NULL...AND
44a0: 20 20 20 52 2e 6c 6f 64 20 21 3d 20 52 2e 62 70 R.lod != R.bp
44b0: 61 72 65 6e 74 0a 09 09 3b 0a 09 20 20 20 20 7d arent...;.. }
44c0: 0a 09 23 20 46 69 6e 64 20 61 6c 6c 20 72 65 76 ..# Find all rev
44d0: 69 73 69 6f 6e 73 20 77 69 74 68 20 61 20 62 72 isions with a br
44e0: 61 6e 63 68 20 70 61 72 65 6e 74 20 73 79 6d 62 anch parent symb
44f0: 6f 6c 20 77 68 6f 73 65 20 70 61 72 65 6e 74 0a ol whose parent.
4500: 09 23 20 69 73 20 69 6e 20 74 68 65 20 73 61 6d .# is in the sam
4510: 65 20 6c 69 6e 65 20 6f 66 20 64 65 76 65 6c 6f e line of develo
4520: 70 6d 65 6e 74 2e 0a 09 43 68 65 63 6b 20 5c 0a pment...Check \.
4530: 09 20 20 20 20 7b 52 65 76 69 73 69 6f 6e 73 20 . {Revisions
4540: 61 6e 64 20 74 68 65 69 72 20 62 72 61 6e 63 68 and their branch
4550: 20 63 68 69 6c 64 72 65 6e 20 68 61 76 65 20 74 children have t
4560: 6f 20 62 65 20 69 6e 20 64 69 66 66 65 72 65 6e o be in differen
4570: 74 20 4c 4f 44 73 7d 20 5c 0a 09 20 20 20 20 7b t LODs} \.. {
4580: 61 74 20 74 68 65 20 62 65 67 69 6e 6e 69 6e 67 at the beginning
4590: 20 6f 66 20 69 74 73 20 62 72 61 6e 63 68 20 61 of its branch a
45a0: 6e 64 20 69 74 73 20 70 61 72 65 6e 74 20 77 72 nd its parent wr
45b0: 6f 6e 67 6c 79 20 61 67 72 65 65 20 61 62 6f 75 ongly agree abou
45c0: 74 20 74 68 65 69 72 20 4c 4f 44 7d 20 7b 0a 09 t their LOD} {..
45d0: 09 53 45 4c 45 43 54 20 46 2e 6e 61 6d 65 2c 20 .SELECT F.name,
45e0: 52 2e 72 65 76 0a 09 09 46 52 4f 4d 20 72 65 76 R.rev...FROM rev
45f0: 69 73 69 6f 6e 20 52 2c 20 72 65 76 69 73 69 6f ision R, revisio
4600: 6e 20 50 2c 20 66 69 6c 65 20 46 0a 09 09 57 48 n P, file F...WH
4610: 45 52 45 20 52 2e 66 69 64 20 3d 20 46 2e 66 69 ERE R.fid = F.fi
4620: 64 0a 09 09 41 4e 44 20 20 20 52 2e 62 70 61 72 d...AND R.bpar
4630: 65 6e 74 20 49 53 20 4e 4f 54 20 4e 55 4c 4c 0a ent IS NOT NULL.
4640: 09 09 41 4e 44 20 20 20 52 2e 70 61 72 65 6e 74 ..AND R.parent
4650: 20 3d 20 50 2e 72 69 64 0a 09 09 41 4e 44 20 20 = P.rid...AND
4660: 20 52 2e 6c 6f 64 20 3d 20 50 2e 6c 6f 64 0a 09 R.lod = P.lod..
4670: 09 3b 0a 09 20 20 20 20 7d 0a 09 72 65 74 75 72 .;.. }..retur
4680: 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 70 72 6f n. }.. pro
4690: 63 20 43 68 65 63 6b 20 7b 68 65 61 64 65 72 20 c Check {header
46a0: 6c 61 62 65 6c 20 73 71 6c 7d 20 7b 0a 09 75 70 label sql} {..up
46b0: 76 61 72 20 31 20 6e 20 6e 0a 09 73 65 74 20 6f var 1 n n..set o
46c0: 6b 20 31 0a 09 66 6f 72 65 61 63 68 20 7b 66 6e k 1..foreach {fn
46d0: 61 6d 65 20 72 65 76 6e 72 7d 20 5b 73 74 61 74 ame revnr} [stat
46e0: 65 20 72 75 6e 20 24 73 71 6c 5d 20 7b 0a 09 20 e run $sql] {..
46f0: 20 20 20 73 65 74 20 6f 6b 20 30 0a 09 20 20 20 set ok 0..
4700: 20 74 72 6f 75 62 6c 65 20 66 61 74 61 6c 20 22 trouble fatal "
4710: 24 66 6e 61 6d 65 20 3c 24 72 65 76 6e 72 3e 20 $fname <$revnr>
4720: 24 6c 61 62 65 6c 22 0a 09 7d 0a 09 6c 6f 67 20 $label"..}..log
4730: 77 72 69 74 65 20 35 20 63 6f 6c 6c 72 65 76 20 write 5 collrev
4740: 22 5c 5b 5b 66 6f 72 6d 61 74 20 25 30 32 64 20 "\[[format %02d
4750: 5b 69 6e 63 72 20 6e 5d 5d 5c 5d 20 5b 65 78 70 [incr n]]\] [exp
4760: 72 20 7b 24 6f 6b 20 3f 20 22 4f 6b 20 20 20 20 r {$ok ? "Ok
4770: 22 20 3a 20 22 46 61 69 6c 65 64 22 7d 5d 20 2e " : "Failed"}] .
4780: 2e 2e 20 24 68 65 61 64 65 72 22 0a 09 72 65 74 .. $header"..ret
4790: 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 23 urn. }.. #
47a0: 20 23 20 23 23 20 23 23 23 20 23 23 23 23 23 20 # ## ### #####
47b0: 23 23 23 23 23 23 23 23 20 23 23 23 23 23 23 23 ######## #######
47c0: 23 23 23 23 23 23 0a 20 20 20 20 23 23 20 49 6e ######. ## In
47d0: 74 65 72 6e 61 6c 20 6d 65 74 68 6f 64 73 0a 0a ternal methods..
47e0: 20 20 20 20 23 20 23 20 23 23 20 23 23 23 20 23 # # ## ### #
47f0: 23 23 23 23 20 23 23 23 23 23 23 23 23 20 23 23 #### ######## ##
4800: 23 23 23 23 23 23 23 23 23 23 23 0a 20 20 20 20 ###########.
4810: 23 23 20 43 6f 6e 66 69 67 75 72 61 74 69 6f 6e ## Configuration
4820: 0a 0a 20 20 20 20 70 72 61 67 6d 61 20 2d 68 61 .. pragma -ha
4830: 73 69 6e 73 74 61 6e 63 65 73 20 20 20 6e 6f 20 sinstances no
4840: 3b 20 23 20 73 69 6e 67 6c 65 74 6f 6e 0a 20 20 ; # singleton.
4850: 20 20 70 72 61 67 6d 61 20 2d 68 61 73 74 79 70 pragma -hastyp
4860: 65 69 6e 66 6f 20 20 20 20 6e 6f 20 3b 20 23 20 einfo no ; #
4870: 6e 6f 20 69 6e 74 72 6f 73 70 65 63 74 69 6f 6e no introspection
4880: 0a 20 20 20 20 70 72 61 67 6d 61 20 2d 68 61 73 . pragma -has
4890: 74 79 70 65 64 65 73 74 72 6f 79 20 6e 6f 20 3b typedestroy no ;
48a0: 20 23 20 69 6d 6d 6f 72 74 61 6c 0a 0a 20 20 20 # immortal..
48b0: 20 23 20 23 20 23 23 20 23 23 23 20 23 23 23 23 # # ## ### ####
48c0: 23 20 23 23 23 23 23 23 23 23 20 23 23 23 23 23 # ######## #####
48d0: 23 23 23 23 23 23 23 23 0a 7d 0a 0a 6e 61 6d 65 ########.}..name
48e0: 73 70 61 63 65 20 65 76 61 6c 20 3a 3a 76 63 3a space eval ::vc:
48f0: 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a :fossil::import:
4900: 3a 63 76 73 3a 3a 70 61 73 73 20 7b 0a 20 20 20 :cvs::pass {.
4910: 20 6e 61 6d 65 73 70 61 63 65 20 65 78 70 6f 72 namespace expor
4920: 74 20 63 6f 6c 6c 72 65 76 0a 20 20 20 20 6e 61 t collrev. na
4930: 6d 65 73 70 61 63 65 20 65 76 61 6c 20 63 6f 6c mespace eval col
4940: 6c 72 65 76 20 7b 0a 09 6e 61 6d 65 73 70 61 63 lrev {..namespac
4950: 65 20 69 6d 70 6f 72 74 20 3a 3a 76 63 3a 3a 72 e import ::vc::r
4960: 63 73 3a 3a 70 61 72 73 65 72 0a 09 6e 61 6d 65 cs::parser..name
4970: 73 70 61 63 65 20 69 6d 70 6f 72 74 20 3a 3a 76 space import ::v
4980: 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 c::fossil::impor
4990: 74 3a 3a 63 76 73 3a 3a 72 65 70 6f 73 69 74 6f t::cvs::reposito
49a0: 72 79 0a 09 6e 61 6d 65 73 70 61 63 65 20 69 6d ry..namespace im
49b0: 70 6f 72 74 20 3a 3a 76 63 3a 3a 66 6f 73 73 69 port ::vc::fossi
49c0: 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a l::import::cvs::
49d0: 73 74 61 74 65 0a 09 6e 61 6d 65 73 70 61 63 65 state..namespace
49e0: 20 69 6d 70 6f 72 74 20 3a 3a 76 63 3a 3a 74 6f import ::vc::to
49f0: 6f 6c 73 3a 3a 74 72 6f 75 62 6c 65 0a 09 6e 61 ols::trouble..na
4a00: 6d 65 73 70 61 63 65 20 69 6d 70 6f 72 74 20 3a mespace import :
4a10: 3a 76 63 3a 3a 74 6f 6f 6c 73 3a 3a 6c 6f 67 0a :vc::tools::log.
4a20: 09 6c 6f 67 20 72 65 67 69 73 74 65 72 20 63 6f .log register co
4a30: 6c 6c 72 65 76 0a 20 20 20 20 7d 0a 7d 0a 0a 23 llrev. }.}..#
4a40: 20 23 20 23 23 20 23 23 23 20 23 23 23 23 23 20 # ## ### #####
4a50: 23 23 23 23 23 23 23 23 20 23 23 23 23 23 23 23 ######## #######
4a60: 23 23 23 23 23 23 20 23 23 23 23 23 23 23 23 23 ###### #########
4a70: 23 23 23 23 23 23 23 23 23 23 23 23 0a 23 23 20 ############.##
4a80: 52 65 61 64 79 0a 0a 70 61 63 6b 61 67 65 20 70 Ready..package p
4a90: 72 6f 76 69 64 65 20 76 63 3a 3a 66 6f 73 73 69 rovide vc::fossi
4aa0: 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a l::import::cvs::
4ab0: 70 61 73 73 3a 3a 63 6f 6c 6c 72 65 76 20 31 2e pass::collrev 1.
4ac0: 30 0a 72 65 74 75 72 6e 0a 0.return.