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 2d 2d 20 46 6f 72 20 65 61 63 .. -- For eac
1de0: 68 20 73 79 6d 62 6f 6c 20 77 65 20 73 61 76 65 h symbol we save
1df0: 20 77 68 69 63 68 20 6f 74 68 65 72 20 73 79 6d which other sym
1e00: 62 6f 6c 73 20 61 72 65 0a 09 20 20 20 20 2d 2d bols are.. --
1e10: 20 62 6c 6f 63 6b 69 6e 67 20 69 74 73 20 72 65 blocking its re
1e20: 6d 6f 76 61 6c 20 28 69 66 20 74 68 65 20 75 73 moval (if the us
1e30: 65 72 20 61 73 6b 73 20 66 6f 72 20 69 74 29 2e er asks for it).
1e40: 0a 0a 09 20 20 20 20 73 69 64 20 49 4e 54 45 47 ... sid INTEG
1e50: 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 52 45 ER NOT NULL RE
1e60: 46 45 52 45 4e 43 45 53 20 73 79 6d 62 6f 6c 2c FERENCES symbol,
1e70: 20 2d 2d 20 0a 09 20 20 20 20 62 69 64 20 49 4e -- .. bid IN
1e80: 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 TEGER NOT NULL
1e90: 20 52 45 46 45 52 45 4e 43 45 53 20 73 79 6d 62 REFERENCES symb
1ea0: 6f 6c 2c 20 2d 2d 20 53 70 72 6f 75 74 65 64 20 ol, -- Sprouted
1eb0: 66 72 6f 6d 20 73 69 64 2c 20 62 6c 6f 63 6b 73 from sid, blocks
1ec0: 20 69 74 2e 0a 09 20 20 20 20 55 4e 49 51 55 45 it... UNIQUE
1ed0: 20 28 73 69 64 2c 20 62 69 64 29 0a 09 7d 0a 0a (sid, bid)..}..
1ee0: 09 73 74 61 74 65 20 77 72 69 74 69 6e 67 20 70 .state writing p
1ef0: 61 72 65 6e 74 20 7b 0a 09 20 20 20 20 2d 2d 20 arent {.. --
1f00: 46 6f 72 20 65 61 63 68 20 73 79 6d 62 6f 6c 20 For each symbol
1f10: 77 65 20 73 61 76 65 20 77 68 69 63 68 20 6f 74 we save which ot
1f20: 68 65 72 20 73 79 6d 62 6f 6c 73 20 63 61 6e 20 her symbols can
1f30: 61 63 74 20 61 73 0a 09 20 20 20 20 2d 2d 20 61 act as.. -- a
1f40: 20 70 6f 73 73 69 62 6c 65 20 70 61 72 65 6e 74 possible parent
1f50: 20 69 6e 20 73 6f 6d 65 20 66 69 6c 65 2c 20 61 in some file, a
1f60: 6e 64 20 68 6f 77 20 6f 66 74 65 6e 2e 0a 0a 09 nd how often....
1f70: 20 20 20 20 73 69 64 20 49 4e 54 45 47 45 52 20 sid INTEGER
1f80: 20 4e 4f 54 20 4e 55 4c 4c 20 20 52 45 46 45 52 NOT NULL REFER
1f90: 45 4e 43 45 53 20 73 79 6d 62 6f 6c 2c 20 2d 2d ENCES symbol, --
1fa0: 20 0a 09 20 20 20 20 70 69 64 20 49 4e 54 45 47 .. pid INTEG
1fb0: 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 52 45 ER NOT NULL RE
1fc0: 46 45 52 45 4e 43 45 53 20 73 79 6d 62 6f 6c 2c FERENCES symbol,
1fd0: 20 2d 2d 20 50 6f 73 73 69 62 6c 65 20 70 61 72 -- Possible par
1fe0: 65 6e 74 20 6f 66 20 73 69 64 0a 09 20 20 20 20 ent of sid..
1ff0: 6e 20 20 20 49 4e 54 45 47 45 52 20 20 4e 4f 54 n INTEGER NOT
2000: 20 4e 55 4c 4c 2c 20 20 20 20 20 20 20 20 20 20 NULL,
2010: 20 20 20 20 20 20 20 20 20 20 2d 2d 20 48 6f 77 -- How
2020: 20 6f 66 74 65 6e 20 70 69 64 20 63 61 6e 20 61 often pid can a
2030: 63 74 20 61 73 20 70 61 72 65 6e 74 2e 0a 09 20 ct as parent...
2040: 20 20 20 55 4e 49 51 55 45 20 28 73 69 64 2c 20 UNIQUE (sid,
2050: 70 69 64 29 0a 09 7d 0a 0a 09 73 74 61 74 65 20 pid)..}...state
2060: 77 72 69 74 69 6e 67 20 6d 65 74 61 20 7b 0a 09 writing meta {..
2070: 20 20 20 20 2d 2d 20 4d 65 74 61 20 64 61 74 61 -- Meta data
2080: 20 6f 66 20 72 65 76 69 73 69 6f 6e 73 2e 20 53 of revisions. S
2090: 65 65 20 72 65 76 69 73 69 6f 6e 2e 6d 69 64 20 ee revision.mid
20a0: 66 6f 72 20 74 68 65 0a 09 20 20 20 20 2d 2d 20 for the.. --
20b0: 72 65 66 65 72 65 6e 63 65 2e 20 4d 61 6e 79 20 reference. Many
20c0: 72 65 76 69 73 69 6f 6e 73 20 63 61 6e 20 73 68 revisions can sh
20d0: 61 72 65 20 6d 65 74 61 20 64 61 74 61 2e 20 54 are meta data. T
20e0: 68 69 73 20 69 73 0a 09 20 20 20 20 2d 2d 20 61 his is.. -- a
20f0: 63 74 75 61 6c 6c 79 20 6f 6e 65 20 6f 66 20 74 ctually one of t
2100: 68 65 20 63 72 69 74 65 72 69 6f 6e 73 20 75 73 he criterions us
2110: 65 64 20 74 6f 20 73 6f 72 74 20 72 65 76 69 73 ed to sort revis
2120: 69 6f 6e 73 0a 09 20 20 20 20 2d 2d 20 69 6e 74 ions.. -- int
2130: 6f 20 63 68 61 6e 67 65 73 65 74 73 2e 0a 0a 09 o changesets....
2140: 20 20 20 20 6d 69 64 20 49 4e 54 45 47 45 52 20 mid INTEGER
2150: 20 4e 4f 54 20 4e 55 4c 4c 20 20 50 52 49 4d 41 NOT NULL PRIMA
2160: 52 59 20 4b 45 59 20 20 41 55 54 4f 49 4e 43 52 RY KEY AUTOINCR
2170: 45 4d 45 4e 54 2c 0a 0a 09 20 20 20 20 2d 2d 20 EMENT,... --
2180: 4d 65 74 61 20 64 61 74 61 20 62 65 6c 6f 6e 67 Meta data belong
2190: 73 20 74 6f 20 61 20 73 70 65 63 69 66 69 63 20 s to a specific
21a0: 70 72 6f 6a 65 63 74 2c 20 73 74 72 6f 6e 67 65 project, stronge
21b0: 72 2c 20 74 6f 20 61 0a 09 20 20 20 20 2d 2d 20 r, to a.. --
21c0: 62 72 61 6e 63 68 20 69 6e 20 74 68 61 74 20 70 branch in that p
21d0: 72 6f 6a 65 63 74 2e 20 49 74 20 66 75 72 74 68 roject. It furth
21e0: 65 72 20 68 61 73 20 61 20 6c 6f 67 20 6d 65 73 er has a log mes
21f0: 73 61 67 65 2c 0a 09 20 20 20 20 2d 2d 20 61 6e sage,.. -- an
2200: 64 20 69 74 73 20 61 75 74 68 6f 72 2e 20 54 68 d its author. Th
2210: 69 73 20 69 73 20 75 6e 69 71 75 65 20 77 69 74 is is unique wit
2220: 68 20 74 68 65 20 70 72 6f 6a 65 63 74 20 61 6e h the project an
2230: 64 0a 09 20 20 20 20 2d 2d 20 62 72 61 6e 63 68 d.. -- branch
2240: 2e 0a 0a 09 20 20 20 20 70 69 64 20 49 4e 54 45 .... pid INTE
2250: 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 52 GER NOT NULL R
2260: 45 46 45 52 45 4e 43 45 53 20 70 72 6f 6a 65 63 EFERENCES projec
2270: 74 2c 20 20 2d 2d 0a 09 20 20 20 20 62 69 64 20 t, --.. bid
2280: 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c INTEGER NOT NUL
2290: 4c 20 20 52 45 46 45 52 45 4e 43 45 53 20 73 79 L REFERENCES sy
22a0: 6d 62 6f 6c 2c 20 20 20 2d 2d 0a 09 20 20 20 20 mbol, --..
22b0: 61 69 64 20 49 4e 54 45 47 45 52 20 20 4e 4f 54 aid INTEGER NOT
22c0: 20 4e 55 4c 4c 20 20 52 45 46 45 52 45 4e 43 45 NULL REFERENCE
22d0: 53 20 61 75 74 68 6f 72 2c 20 20 20 2d 2d 0a 09 S author, --..
22e0: 20 20 20 20 63 69 64 20 49 4e 54 45 47 45 52 20 cid INTEGER
22f0: 20 4e 4f 54 20 4e 55 4c 4c 20 20 52 45 46 45 52 NOT NULL REFER
2300: 45 4e 43 45 53 20 63 6d 65 73 73 61 67 65 2c 20 ENCES cmessage,
2310: 2d 2d 0a 0a 09 20 20 20 20 55 4e 49 51 55 45 20 --... UNIQUE
2320: 28 70 69 64 2c 20 62 69 64 2c 20 61 69 64 2c 20 (pid, bid, aid,
2330: 63 69 64 29 0a 0a 09 20 20 20 20 2d 2d 20 43 6f cid)... -- Co
2340: 6e 73 74 72 61 69 6e 74 73 3a 20 54 68 65 20 70 nstraints: The p
2350: 72 6f 6a 65 63 74 20 6f 66 20 74 68 65 20 6d 65 roject of the me
2360: 74 61 20 64 61 74 61 20 6f 66 20 61 20 72 65 76 ta data of a rev
2370: 69 73 69 6f 6e 0a 09 20 20 20 20 2d 2d 20 20 20 ision.. --
2380: 20 20 20 20 20 20 20 20 20 20 20 58 20 69 73 20 X is
2390: 74 68 65 20 73 61 6d 65 20 61 73 20 74 68 65 20 the same as the
23a0: 70 72 6f 6a 65 63 74 20 6f 66 20 58 20 69 74 73 project of X its
23b0: 65 6c 66 2e 0a 09 20 20 20 20 2d 2d 0a 09 20 20 elf... --..
23c0: 20 20 2d 2d 20 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e -- ...........
23d0: 2e 20 54 68 65 20 62 72 61 6e 63 68 20 6f 66 20 . The branch of
23e0: 74 68 65 20 6d 65 74 61 20 64 61 74 61 20 6f 66 the meta data of
23f0: 20 61 20 72 65 76 69 73 69 6f 6e 0a 09 20 20 20 a revision..
2400: 20 2d 2d 20 20 20 20 20 20 20 20 20 20 20 20 20 --
2410: 20 58 20 69 73 20 74 68 65 20 73 61 6d 65 20 61 X is the same a
2420: 73 20 74 68 65 20 6c 69 6e 65 20 6f 66 20 64 65 s the line of de
2430: 76 65 6c 6f 70 6d 65 6e 74 0a 09 20 20 20 20 2d velopment.. -
2440: 2d 20 20 20 20 20 20 20 20 20 20 20 20 20 20 6f - o
2450: 66 20 58 20 69 74 73 65 6c 66 2e 0a 09 7d 0a 0a f X itself...}..
2460: 09 23 20 41 75 74 68 6f 72 73 20 61 6e 64 20 63 .# Authors and c
2470: 6f 6d 6d 69 74 20 6d 65 73 73 61 67 65 73 20 61 ommit messages a
2480: 72 65 20 66 75 6c 6c 79 20 67 6c 6f 62 61 6c 2c re fully global,
2490: 20 69 2e 65 2e 20 70 65 72 0a 09 23 20 72 65 70 i.e. per..# rep
24a0: 6f 73 69 74 6f 72 79 2e 0a 0a 09 73 74 61 74 65 ository....state
24b0: 20 77 72 69 74 69 6e 67 20 61 75 74 68 6f 72 20 writing author
24c0: 7b 0a 09 20 20 20 20 61 69 64 20 20 49 4e 54 45 {.. aid INTE
24d0: 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 50 GER NOT NULL P
24e0: 52 49 4d 41 52 59 20 4b 45 59 20 20 41 55 54 4f RIMARY KEY AUTO
24f0: 49 4e 43 52 45 4d 45 4e 54 2c 0a 09 20 20 20 20 INCREMENT,..
2500: 6e 61 6d 65 20 54 45 58 54 20 20 20 20 20 4e 4f name TEXT NO
2510: 54 20 4e 55 4c 4c 20 20 55 4e 49 51 55 45 0a 09 T NULL UNIQUE..
2520: 7d 0a 0a 09 73 74 61 74 65 20 77 72 69 74 69 6e }...state writin
2530: 67 20 63 6d 65 73 73 61 67 65 20 7b 0a 09 20 20 g cmessage {..
2540: 20 20 63 69 64 20 20 49 4e 54 45 47 45 52 20 20 cid INTEGER
2550: 4e 4f 54 20 4e 55 4c 4c 20 20 50 52 49 4d 41 52 NOT NULL PRIMAR
2560: 59 20 4b 45 59 20 20 41 55 54 4f 49 4e 43 52 45 Y KEY AUTOINCRE
2570: 4d 45 4e 54 2c 0a 09 20 20 20 20 74 65 78 74 20 MENT,.. text
2580: 54 45 58 54 20 20 20 20 20 4e 4f 54 20 4e 55 4c TEXT NOT NUL
2590: 4c 20 20 55 4e 49 51 55 45 0a 09 7d 0a 0a 09 72 L UNIQUE..}...r
25a0: 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 eturn. }..
25b0: 20 74 79 70 65 6d 65 74 68 6f 64 20 6c 6f 61 64 typemethod load
25c0: 20 7b 7d 20 7b 0a 09 23 20 54 4f 44 4f 0a 09 72 {} {..# TODO..r
25d0: 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 eturn. }..
25e0: 20 74 79 70 65 6d 65 74 68 6f 64 20 72 75 6e 20 typemethod run
25f0: 7b 7d 20 7b 0a 09 23 20 50 61 73 73 20 6d 61 6e {} {..# Pass man
2600: 61 67 65 72 20 69 6e 74 65 72 66 61 63 65 2e 20 ager interface.
2610: 45 78 65 63 75 74 65 64 20 74 6f 20 70 65 72 66 Executed to perf
2620: 6f 72 6d 20 74 68 65 0a 09 23 20 66 75 6e 63 74 orm the..# funct
2630: 69 6f 6e 61 6c 69 74 79 20 6f 66 20 74 68 65 20 ionality of the
2640: 70 61 73 73 2e 0a 0a 09 73 65 74 20 72 62 61 73 pass....set rbas
2650: 65 20 5b 72 65 70 6f 73 69 74 6f 72 79 20 62 61 e [repository ba
2660: 73 65 3f 5d 0a 09 66 6f 72 65 61 63 68 20 70 72 se?]..foreach pr
2670: 6f 6a 65 63 74 20 5b 72 65 70 6f 73 69 74 6f 72 oject [repositor
2680: 79 20 70 72 6f 6a 65 63 74 73 5d 20 7b 0a 09 20 y projects] {..
2690: 20 20 20 73 65 74 20 62 61 73 65 20 5b 66 69 6c set base [fil
26a0: 65 20 6a 6f 69 6e 20 24 72 62 61 73 65 20 5b 24 e join $rbase [$
26b0: 70 72 6f 6a 65 63 74 20 62 61 73 65 5d 5d 0a 09 project base]]..
26c0: 20 20 20 20 6c 6f 67 20 77 72 69 74 65 20 31 20 log write 1
26d0: 63 6f 6c 6c 72 65 76 20 22 50 72 6f 63 65 73 73 collrev "Process
26e0: 69 6e 67 20 24 62 61 73 65 22 0a 0a 09 20 20 20 ing $base"...
26f0: 20 66 6f 72 65 61 63 68 20 66 69 6c 65 20 5b 24 foreach file [$
2700: 70 72 6f 6a 65 63 74 20 66 69 6c 65 73 5d 20 7b project files] {
2710: 0a 09 09 73 65 74 20 70 61 74 68 20 5b 24 66 69 ...set path [$fi
2720: 6c 65 20 70 61 74 68 5d 0a 09 09 6c 6f 67 20 77 le path]...log w
2730: 72 69 74 65 20 32 20 63 6f 6c 6c 72 65 76 20 22 rite 2 collrev "
2740: 50 61 72 73 69 6e 67 20 24 70 61 74 68 22 0a 09 Parsing $path"..
2750: 09 69 66 20 7b 5b 63 61 74 63 68 20 7b 0a 09 09 .if {[catch {...
2760: 20 20 20 20 70 61 72 73 65 72 20 70 72 6f 63 65 parser proce
2770: 73 73 20 5b 66 69 6c 65 20 6a 6f 69 6e 20 24 62 ss [file join $b
2780: 61 73 65 20 24 70 61 74 68 5d 20 24 66 69 6c 65 ase $path] $file
2790: 0a 09 09 7d 20 6d 73 67 5d 7d 20 7b 0a 09 09 20 ...} msg]} {...
27a0: 20 20 20 67 6c 6f 62 61 6c 20 65 72 72 6f 72 43 global errorC
27b0: 6f 64 65 0a 09 09 20 20 20 20 69 66 20 7b 24 65 ode... if {$e
27c0: 72 72 6f 72 43 6f 64 65 20 65 71 20 22 76 63 3a rrorCode eq "vc:
27d0: 3a 72 63 73 3a 3a 70 61 72 73 65 72 22 7d 20 7b :rcs::parser"} {
27e0: 0a 09 09 09 74 72 6f 75 62 6c 65 20 66 61 74 61 ....trouble fata
27f0: 6c 20 22 24 70 61 74 68 20 69 73 20 6e 6f 74 20 l "$path is not
2800: 61 20 76 61 6c 69 64 20 52 43 53 20 61 72 63 68 a valid RCS arch
2810: 69 76 65 20 28 24 6d 73 67 29 22 0a 09 09 20 20 ive ($msg)"...
2820: 20 20 7d 20 65 6c 73 65 20 7b 0a 09 09 09 67 6c } else {....gl
2830: 6f 62 61 6c 20 65 72 72 6f 72 49 6e 66 6f 0a 09 obal errorInfo..
2840: 09 09 74 72 6f 75 62 6c 65 20 69 6e 74 65 72 6e ..trouble intern
2850: 61 6c 20 24 65 72 72 6f 72 49 6e 66 6f 0a 09 09 al $errorInfo...
2860: 20 20 20 20 7d 0a 09 09 7d 20 65 6c 73 65 20 7b }...} else {
2870: 0a 09 09 20 20 20 20 23 20 57 65 20 70 65 72 73 ... # We pers
2880: 69 73 74 20 74 68 65 20 63 6f 72 65 20 6f 66 20 ist the core of
2890: 74 68 65 20 64 61 74 61 20 63 6f 6c 6c 65 63 74 the data collect
28a0: 65 64 20 61 62 6f 75 74 0a 09 09 20 20 20 20 23 ed about... #
28b0: 20 65 61 63 68 20 66 69 6c 65 20 69 6d 6d 65 64 each file immed
28c0: 69 61 74 65 6c 79 20 61 66 74 65 72 20 69 74 20 iately after it
28d0: 68 61 73 20 62 65 65 6e 20 70 61 72 73 65 64 0a has been parsed.
28e0: 09 09 20 20 20 20 23 20 61 6e 64 20 77 72 61 6e .. # and wran
28f0: 67 6c 65 64 20 69 6e 74 6f 20 73 68 61 70 65 2c gled into shape,
2900: 20 61 6e 64 20 74 68 65 6e 20 64 72 6f 70 20 69 and then drop i
2910: 74 20 66 72 6f 6d 0a 09 09 20 20 20 20 23 20 6d t from... # m
2920: 65 6d 6f 72 79 2e 20 54 68 69 73 20 69 73 20 64 emory. This is d
2930: 6f 6e 65 20 74 6f 20 6b 65 65 70 20 74 68 65 20 one to keep the
2940: 61 6d 6f 75 6e 74 20 6f 66 0a 09 09 20 20 20 20 amount of...
2950: 23 20 72 65 71 75 69 72 65 64 20 6d 65 6d 6f 72 # required memor
2960: 79 20 77 69 74 68 69 6e 20 73 65 6e 73 69 62 6c y within sensibl
2970: 65 20 6c 69 6d 69 74 73 2e 20 57 69 74 68 6f 75 e limits. Withou
2980: 74 0a 09 09 20 20 20 20 23 20 64 6f 69 6e 67 20 t... # doing
2990: 69 74 20 74 68 69 73 20 77 61 79 20 77 65 20 77 it this way we w
29a0: 6f 75 6c 64 20 65 61 73 69 6c 79 20 67 6f 62 62 ould easily gobb
29b0: 6c 65 20 75 70 20 31 47 0a 09 09 20 20 20 20 23 le up 1G... #
29c0: 20 6f 66 20 52 41 4d 20 6f 72 20 6d 6f 72 65 20 of RAM or more
29d0: 77 69 74 68 20 61 6c 6c 20 74 68 65 20 6f 62 6a with all the obj
29e0: 65 63 74 73 20 28 72 65 76 69 73 69 6f 6e 73 0a ects (revisions.
29f0: 09 09 20 20 20 20 23 20 61 6e 64 20 66 69 6c 65 .. # and file
2a00: 2d 6c 65 76 65 6c 20 73 79 6d 62 6f 6c 73 29 2e -level symbols).
2a10: 0a 0a 09 09 20 20 20 20 24 66 69 6c 65 20 70 65 .... $file pe
2a20: 72 73 69 73 74 0a 09 09 7d 0a 0a 09 09 24 66 69 rsist...}....$fi
2a30: 6c 65 20 64 72 6f 70 0a 09 20 20 20 20 7d 0a 0a le drop.. }..
2a40: 09 20 20 20 20 24 70 72 6f 6a 65 63 74 20 70 75 . $project pu
2a50: 72 67 65 67 68 6f 73 74 73 79 6d 62 6f 6c 73 0a rgeghostsymbols.
2a60: 09 7d 0a 0a 09 72 65 70 6f 73 69 74 6f 72 79 20 .}...repository
2a70: 70 72 69 6e 74 72 65 76 73 74 61 74 69 73 74 69 printrevstatisti
2a80: 63 73 0a 09 72 65 70 6f 73 69 74 6f 72 79 20 70 cs..repository p
2a90: 65 72 73 69 73 74 72 65 76 0a 0a 09 6c 6f 67 20 ersistrev...log
2aa0: 77 72 69 74 65 20 31 20 63 6f 6c 6c 72 65 76 20 write 1 collrev
2ab0: 22 53 63 61 6e 20 63 6f 6d 70 6c 65 74 65 64 22 "Scan completed"
2ac0: 0a 09 50 61 72 61 6e 6f 69 61 0a 09 72 65 74 75 ..Paranoia..retu
2ad0: 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 74 79 rn. }.. ty
2ae0: 70 65 6d 65 74 68 6f 64 20 64 69 73 63 61 72 64 pemethod discard
2af0: 20 7b 7d 20 7b 0a 09 23 20 50 61 73 73 20 6d 61 {} {..# Pass ma
2b00: 6e 61 67 65 72 20 69 6e 74 65 72 66 61 63 65 2e nager interface.
2b10: 20 45 78 65 63 75 74 65 64 20 66 6f 72 20 61 6c Executed for al
2b20: 6c 20 70 61 73 73 65 73 20 61 66 74 65 72 20 74 l passes after t
2b30: 68 65 0a 09 23 20 72 75 6e 20 70 61 73 73 65 73 he..# run passes
2b40: 2c 20 74 6f 20 72 65 6d 6f 76 65 20 61 6c 6c 20 , to remove all
2b50: 64 61 74 61 20 6f 66 20 74 68 69 73 20 70 61 73 data of this pas
2b60: 73 20 66 72 6f 6d 20 74 68 65 20 73 74 61 74 65 s from the state
2b70: 2c 0a 09 23 20 61 73 20 62 65 69 6e 67 20 6f 75 ,..# as being ou
2b80: 74 20 6f 66 20 64 61 74 65 2e 0a 0a 09 73 74 61 t of date....sta
2b90: 74 65 20 64 69 73 63 61 72 64 20 72 65 76 69 73 te discard revis
2ba0: 69 6f 6e 0a 09 73 74 61 74 65 20 64 69 73 63 61 ion..state disca
2bb0: 72 64 20 74 61 67 0a 09 73 74 61 74 65 20 64 69 rd tag..state di
2bc0: 73 63 61 72 64 20 62 72 61 6e 63 68 0a 09 73 74 scard branch..st
2bd0: 61 74 65 20 64 69 73 63 61 72 64 20 73 79 6d 62 ate discard symb
2be0: 6f 6c 0a 09 73 74 61 74 65 20 64 69 73 63 61 72 ol..state discar
2bf0: 64 20 62 6c 6f 63 6b 65 72 0a 09 73 74 61 74 65 d blocker..state
2c00: 20 64 69 73 63 61 72 64 20 70 61 72 65 6e 74 0a discard parent.
2c10: 09 73 74 61 74 65 20 64 69 73 63 61 72 64 20 6d .state discard m
2c20: 65 74 61 0a 09 73 74 61 74 65 20 64 69 73 63 61 eta..state disca
2c30: 72 64 20 61 75 74 68 6f 72 0a 09 73 74 61 74 65 rd author..state
2c40: 20 64 69 73 63 61 72 64 20 63 6d 65 73 73 61 67 discard cmessag
2c50: 65 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a e..return. }.
2c60: 0a 20 20 20 20 70 72 6f 63 20 50 61 72 61 6e 6f . proc Parano
2c70: 69 61 20 7b 7d 20 7b 0a 09 23 20 54 68 69 73 20 ia {} {..# This
2c80: 63 6f 64 65 20 70 65 72 66 6f 72 6d 73 20 61 20 code performs a
2c90: 6e 75 6d 62 65 72 20 6f 66 20 70 61 72 61 6e 6f number of parano
2ca0: 69 64 20 63 68 65 63 6b 73 20 6f 66 20 74 68 65 id checks of the
2cb0: 0a 09 23 20 64 61 74 61 62 61 73 65 2c 20 73 65 ..# database, se
2cc0: 61 72 63 68 69 6e 67 20 66 6f 72 20 69 6e 63 6f arching for inco
2cd0: 6e 73 69 73 74 65 6e 74 20 63 72 6f 73 73 2d 72 nsistent cross-r
2ce0: 65 66 65 72 65 6e 63 65 73 2e 0a 09 6c 6f 67 20 eferences...log
2cf0: 77 72 69 74 65 20 34 20 63 6f 6c 6c 72 65 76 20 write 4 collrev
2d00: 7b 43 68 65 63 6b 20 64 61 74 61 62 61 73 65 20 {Check database
2d10: 63 6f 6e 73 69 73 74 65 6e 63 79 7d 0a 0a 09 73 consistency}...s
2d20: 65 74 20 6e 20 30 20 3b 20 23 20 43 6f 75 6e 74 et n 0 ; # Count
2d30: 65 72 20 66 6f 72 20 74 68 65 20 63 68 65 63 6b er for the check
2d40: 73 20 28 77 65 20 70 72 69 6e 74 20 61 6e 20 69 s (we print an i
2d50: 64 20 62 65 66 6f 72 65 20 74 68 65 0a 09 09 20 d before the...
2d60: 20 23 20 6d 61 69 6e 20 6c 61 62 65 6c 29 2e 0a # main label)..
2d70: 0a 09 23 20 46 69 6e 64 20 61 6c 6c 20 72 65 76 ..# Find all rev
2d80: 69 73 69 6f 6e 73 20 77 68 69 63 68 20 64 69 73 isions which dis
2d90: 61 67 72 65 65 20 77 69 74 68 20 74 68 65 69 72 agree with their
2da0: 20 6c 69 6e 65 20 6f 66 0a 09 23 20 64 65 76 65 line of..# deve
2db0: 6c 6f 70 6d 65 6e 74 20 61 62 6f 75 74 20 74 68 lopment about th
2dc0: 65 20 70 72 6f 6a 65 63 74 20 74 68 65 79 20 61 e project they a
2dd0: 72 65 20 6f 77 6e 65 64 20 62 79 2e 0a 09 43 68 re owned by...Ch
2de0: 65 63 6b 20 5c 0a 09 20 20 20 20 7b 52 65 76 69 eck \.. {Revi
2df0: 73 69 6f 6e 73 20 61 6e 64 20 74 68 65 69 72 20 sions and their
2e00: 4c 4f 44 73 20 68 61 76 65 20 74 6f 20 62 65 20 LODs have to be
2e10: 69 6e 20 74 68 65 20 73 61 6d 65 20 70 72 6f 6a in the same proj
2e20: 65 63 74 7d 20 5c 0a 09 20 20 20 20 7b 64 69 73 ect} \.. {dis
2e30: 61 67 72 65 65 73 20 77 69 74 68 20 69 74 73 20 agrees with its
2e40: 4c 4f 44 20 61 62 6f 75 74 20 6f 77 6e 69 6e 67 LOD about owning
2e50: 20 70 72 6f 6a 65 63 74 7d 20 7b 0a 09 09 53 45 project} {...SE
2e60: 4c 45 43 54 20 46 2e 6e 61 6d 65 2c 20 52 2e 72 LECT F.name, R.r
2e70: 65 76 0a 09 09 46 52 4f 4d 20 72 65 76 69 73 69 ev...FROM revisi
2e80: 6f 6e 20 52 2c 20 66 69 6c 65 20 46 2c 20 73 79 on R, file F, sy
2e90: 6d 62 6f 6c 20 53 0a 09 09 57 48 45 52 45 20 52 mbol S...WHERE R
2ea0: 2e 66 69 64 20 3d 20 46 2e 66 69 64 0a 09 09 41 .fid = F.fid...A
2eb0: 4e 44 20 20 20 52 2e 6c 6f 64 20 3d 20 53 2e 73 ND R.lod = S.s
2ec0: 69 64 0a 09 09 41 4e 44 20 20 20 46 2e 70 69 64 id...AND F.pid
2ed0: 20 21 3d 20 53 2e 70 69 64 0a 09 09 3b 0a 09 20 != S.pid...;..
2ee0: 20 20 20 7d 0a 09 23 20 46 69 6e 64 20 61 6c 6c }..# Find all
2ef0: 20 72 65 76 69 73 69 6f 6e 73 20 77 68 69 63 68 revisions which
2f00: 20 64 69 73 67 72 65 65 20 77 69 74 68 20 74 68 disgree with th
2f10: 65 69 72 20 6d 65 74 61 20 64 61 74 61 20 61 62 eir meta data ab
2f20: 6f 75 74 0a 09 23 20 74 68 65 20 70 72 6f 6a 65 out..# the proje
2f30: 63 74 20 74 68 65 79 20 61 72 65 20 6f 77 6e 65 ct they are owne
2f40: 64 20 62 79 2e 0a 09 43 68 65 63 6b 20 5c 0a 09 d by...Check \..
2f50: 20 20 20 20 7b 52 65 76 69 73 69 6f 6e 73 20 61 {Revisions a
2f60: 6e 64 20 74 68 65 69 72 20 6d 65 74 61 20 64 61 nd their meta da
2f70: 74 61 20 68 61 76 65 20 74 6f 20 62 65 20 69 6e ta have to be in
2f80: 20 74 68 65 20 73 61 6d 65 20 70 72 6f 6a 65 63 the same projec
2f90: 74 7d 20 5c 0a 09 20 20 20 20 7b 64 69 73 61 67 t} \.. {disag
2fa0: 72 65 65 73 20 77 69 74 68 20 69 74 73 20 6d 65 rees with its me
2fb0: 74 61 20 64 61 74 61 20 61 62 6f 75 74 20 6f 77 ta data about ow
2fc0: 6e 69 6e 67 20 70 72 6f 6a 65 63 74 7d 20 7b 0a ning project} {.
2fd0: 09 09 53 45 4c 45 43 54 20 46 2e 6e 61 6d 65 2c ..SELECT F.name,
2fe0: 20 52 2e 72 65 76 0a 09 09 46 52 4f 4d 20 72 65 R.rev...FROM re
2ff0: 76 69 73 69 6f 6e 20 52 2c 20 66 69 6c 65 20 46 vision R, file F
3000: 2c 20 6d 65 74 61 20 4d 0a 09 09 57 48 45 52 45 , meta M...WHERE
3010: 20 52 2e 66 69 64 20 3d 20 46 2e 66 69 64 0a 09 R.fid = F.fid..
3020: 09 41 4e 44 20 20 20 52 2e 6d 69 64 20 3d 20 4d .AND R.mid = M
3030: 2e 6d 69 64 0a 09 09 41 4e 44 20 20 20 46 2e 70 .mid...AND F.p
3040: 69 64 20 21 3d 20 4d 2e 70 69 64 0a 09 09 3b 0a id != M.pid...;.
3050: 09 20 20 20 20 7d 0a 09 23 20 46 69 6e 64 20 61 . }..# Find a
3060: 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 77 68 69 ll revisions whi
3070: 63 68 20 64 69 73 67 72 65 65 20 77 69 74 68 20 ch disgree with
3080: 74 68 65 69 72 20 6d 65 74 61 20 64 61 74 61 20 their meta data
3090: 61 62 6f 75 74 0a 09 23 20 74 68 65 20 62 72 61 about..# the bra
30a0: 6e 63 68 2f 6c 69 6e 65 20 6f 66 20 64 65 76 65 nch/line of deve
30b0: 6c 6f 70 6d 65 6e 74 20 74 68 65 79 20 62 65 6c lopment they bel
30c0: 6f 6e 67 20 74 6f 2e 0a 09 43 68 65 63 6b 20 5c ong to...Check \
30d0: 0a 09 20 20 20 20 7b 52 65 76 69 73 69 6f 6e 73 .. {Revisions
30e0: 20 61 6e 64 20 74 68 65 69 72 20 6d 65 74 61 20 and their meta
30f0: 64 61 74 61 20 68 61 76 65 20 74 6f 20 62 65 20 data have to be
3100: 69 6e 20 74 68 65 20 73 61 6d 65 20 4c 4f 44 7d in the same LOD}
3110: 20 5c 0a 09 20 20 20 20 7b 64 69 73 61 67 72 65 \.. {disagre
3120: 65 73 20 77 69 74 68 20 69 74 73 20 6d 65 74 61 es with its meta
3130: 20 64 61 74 61 20 61 62 6f 75 74 20 6f 77 6e 69 data about owni
3140: 6e 67 20 4c 4f 44 7d 20 7b 0a 09 09 53 45 4c 45 ng LOD} {...SELE
3150: 43 54 20 46 2e 6e 61 6d 65 2c 20 52 2e 72 65 76 CT F.name, R.rev
3160: 0a 09 09 46 52 4f 4d 20 72 65 76 69 73 69 6f 6e ...FROM revision
3170: 20 52 2c 20 6d 65 74 61 20 4d 2c 20 66 69 6c 65 R, meta M, file
3180: 20 46 0a 09 09 57 48 45 52 45 20 52 2e 6d 69 64 F...WHERE R.mid
3190: 20 3d 20 4d 2e 6d 69 64 0a 09 09 41 4e 44 20 20 = M.mid...AND
31a0: 20 52 2e 6c 6f 64 20 21 3d 20 4d 2e 62 69 64 0a R.lod != M.bid.
31b0: 09 09 41 4e 44 20 20 20 52 2e 66 69 64 20 3d 20 ..AND R.fid =
31c0: 46 2e 66 69 64 0a 09 09 3b 0a 09 20 20 20 20 7d F.fid...;.. }
31d0: 0a 09 23 20 46 69 6e 64 20 61 6c 6c 20 72 65 76 ..# Find all rev
31e0: 69 73 69 6f 6e 73 20 77 69 74 68 20 61 20 70 72 isions with a pr
31f0: 69 6d 61 72 79 20 63 68 69 6c 64 20 77 68 69 63 imary child whic
3200: 68 20 64 69 73 61 67 72 65 65 73 0a 09 23 20 61 h disagrees..# a
3210: 62 6f 75 74 20 74 68 65 20 66 69 6c 65 20 74 68 bout the file th
3220: 65 79 20 62 65 6c 6f 6e 67 20 74 6f 2e 0a 09 43 ey belong to...C
3230: 68 65 63 6b 20 5c 0a 09 20 20 20 20 7b 52 65 76 heck \.. {Rev
3240: 69 73 69 6f 6e 73 20 61 6e 64 20 74 68 65 69 72 isions and their
3250: 20 70 72 69 6d 61 72 79 20 63 68 69 6c 64 72 65 primary childre
3260: 6e 20 68 61 76 65 20 74 6f 20 62 65 20 69 6e 20 n have to be in
3270: 74 68 65 20 73 61 6d 65 20 66 69 6c 65 7d 20 5c the same file} \
3280: 0a 09 20 20 20 20 7b 64 69 73 61 67 72 65 65 73 .. {disagrees
3290: 20 77 69 74 68 20 69 74 73 20 70 72 69 6d 61 72 with its primar
32a0: 79 20 63 68 69 6c 64 20 61 62 6f 75 74 20 74 68 y child about th
32b0: 65 20 6f 77 6e 69 6e 67 20 66 69 6c 65 7d 20 7b e owning file} {
32c0: 0a 09 09 53 45 4c 45 43 54 20 46 2e 6e 61 6d 65 ...SELECT F.name
32d0: 2c 20 52 2e 72 65 76 0a 09 09 46 52 4f 4d 20 72 , R.rev...FROM r
32e0: 65 76 69 73 69 6f 6e 20 52 2c 20 72 65 76 69 73 evision R, revis
32f0: 69 6f 6e 20 43 2c 20 66 69 6c 65 20 46 0a 09 09 ion C, file F...
3300: 57 48 45 52 45 20 52 2e 66 69 64 20 3d 20 46 2e WHERE R.fid = F.
3310: 66 69 64 0a 09 09 41 4e 44 20 20 20 52 2e 63 68 fid...AND R.ch
3320: 69 6c 64 20 49 53 20 4e 4f 54 20 4e 55 4c 4c 0a ild IS NOT NULL.
3330: 09 09 41 4e 44 20 20 20 52 2e 63 68 69 6c 64 20 ..AND R.child
3340: 3d 20 43 2e 72 69 64 0a 09 09 41 4e 44 20 20 20 = C.rid...AND
3350: 43 2e 66 69 64 20 21 3d 20 52 2e 66 69 64 0a 09 C.fid != R.fid..
3360: 09 3b 0a 09 20 20 20 20 7d 0a 0a 09 23 20 46 69 .;.. }...# Fi
3370: 6e 64 20 61 6c 6c 20 72 65 76 69 73 69 6f 6e 73 nd all revisions
3380: 20 77 69 74 68 20 61 20 62 72 61 6e 63 68 20 70 with a branch p
3390: 61 72 65 6e 74 20 73 79 6d 62 6f 6c 20 77 68 6f arent symbol who
33a0: 73 65 20 70 61 72 65 6e 74 0a 09 23 20 64 69 73 se parent..# dis
33b0: 61 67 72 65 65 73 20 61 62 6f 75 74 20 74 68 65 agrees about the
33c0: 20 66 69 6c 65 20 74 68 65 79 20 62 65 6c 6f 6e file they belon
33d0: 67 20 74 6f 2e 0a 09 43 68 65 63 6b 20 5c 0a 09 g to...Check \..
33e0: 20 20 20 20 7b 52 65 76 69 73 69 6f 6e 73 20 61 {Revisions a
33f0: 6e 64 20 74 68 65 69 72 20 62 72 61 6e 63 68 20 nd their branch
3400: 63 68 69 6c 64 72 65 6e 20 68 61 76 65 20 74 6f children have to
3410: 20 62 65 20 69 6e 20 74 68 65 20 73 61 6d 65 20 be in the same
3420: 66 69 6c 65 7d 20 5c 0a 09 20 20 20 20 7b 61 74 file} \.. {at
3430: 20 74 68 65 20 62 65 67 69 6e 6e 69 6e 67 20 6f the beginning o
3440: 66 20 69 74 73 20 62 72 61 6e 63 68 20 61 6e 64 f its branch and
3450: 20 69 74 73 20 70 61 72 65 6e 74 20 64 69 73 61 its parent disa
3460: 67 72 65 65 20 61 62 6f 75 74 20 74 68 65 20 6f gree about the o
3470: 77 6e 69 6e 67 20 66 69 6c 65 7d 20 7b 0a 09 09 wning file} {...
3480: 53 45 4c 45 43 54 20 46 2e 6e 61 6d 65 2c 20 52 SELECT F.name, R
3490: 2e 72 65 76 0a 09 09 46 52 4f 4d 20 72 65 76 69 .rev...FROM revi
34a0: 73 69 6f 6e 20 52 2c 20 72 65 76 69 73 69 6f 6e sion R, revision
34b0: 20 50 2c 20 66 69 6c 65 20 46 0a 09 09 57 48 45 P, file F...WHE
34c0: 52 45 20 52 2e 66 69 64 20 3d 20 46 2e 66 69 64 RE R.fid = F.fid
34d0: 0a 09 09 41 4e 44 20 20 20 52 2e 62 70 61 72 65 ...AND R.bpare
34e0: 6e 74 20 49 53 20 4e 4f 54 20 4e 55 4c 4c 0a 09 nt IS NOT NULL..
34f0: 09 41 4e 44 20 20 20 52 2e 70 61 72 65 6e 74 20 .AND R.parent
3500: 3d 20 50 2e 72 69 64 0a 09 09 41 4e 44 20 20 20 = P.rid...AND
3510: 52 2e 66 69 64 20 21 3d 20 50 2e 66 69 64 0a 09 R.fid != P.fid..
3520: 09 3b 0a 09 20 20 20 20 7d 0a 09 23 20 46 69 6e .;.. }..# Fin
3530: 64 20 61 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 d all revisions
3540: 77 69 74 68 20 61 20 6e 6f 6e 2d 4e 54 44 42 20 with a non-NTDB
3550: 63 68 69 6c 64 20 77 68 69 63 68 20 64 69 73 61 child which disa
3560: 67 72 65 65 73 0a 09 23 20 61 62 6f 75 74 20 74 grees..# about t
3570: 68 65 20 66 69 6c 65 20 74 68 65 79 20 62 65 6c he file they bel
3580: 6f 6e 67 20 74 6f 2e 0a 09 43 68 65 63 6b 20 5c ong to...Check \
3590: 0a 09 20 20 20 20 7b 52 65 76 69 73 69 6f 6e 73 .. {Revisions
35a0: 20 61 6e 64 20 74 68 65 69 72 20 6e 6f 6e 2d 4e and their non-N
35b0: 54 44 42 20 63 68 69 6c 64 72 65 6e 20 68 61 76 TDB children hav
35c0: 65 20 74 6f 20 62 65 20 69 6e 20 74 68 65 20 73 e to be in the s
35d0: 61 6d 65 20 66 69 6c 65 7d 20 5c 0a 09 20 20 20 ame file} \..
35e0: 20 7b 64 69 73 61 67 72 65 65 73 20 77 69 74 68 {disagrees with
35f0: 20 69 74 73 20 6e 6f 6e 2d 4e 54 44 42 20 63 68 its non-NTDB ch
3600: 69 6c 64 20 61 62 6f 75 74 20 74 68 65 20 6f 77 ild about the ow
3610: 6e 69 6e 67 20 66 69 6c 65 7d 20 7b 0a 09 09 53 ning file} {...S
3620: 45 4c 45 43 54 20 46 2e 6e 61 6d 65 2c 20 52 2e ELECT F.name, R.
3630: 72 65 76 0a 09 09 46 52 4f 4d 20 72 65 76 69 73 rev...FROM revis
3640: 69 6f 6e 20 52 2c 20 72 65 76 69 73 69 6f 6e 20 ion R, revision
3650: 43 2c 20 66 69 6c 65 20 46 0a 09 09 57 48 45 52 C, file F...WHER
3660: 45 20 52 2e 66 69 64 20 3d 20 46 2e 66 69 64 0a E R.fid = F.fid.
3670: 09 09 41 4e 44 20 20 20 52 2e 64 62 63 68 69 6c ..AND R.dbchil
3680: 64 20 49 53 20 4e 4f 54 20 4e 55 4c 4c 0a 09 09 d IS NOT NULL...
3690: 41 4e 44 20 20 20 52 2e 64 62 63 68 69 6c 64 20 AND R.dbchild
36a0: 3d 20 43 2e 72 69 64 0a 09 09 41 4e 44 20 20 20 = C.rid...AND
36b0: 43 2e 66 69 64 20 21 3d 20 52 2e 66 69 64 0a 09 C.fid != R.fid..
36c0: 09 3b 0a 09 20 20 20 20 7d 0a 09 23 20 46 69 6e .;.. }..# Fin
36d0: 64 20 61 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 d all revisions
36e0: 77 68 69 63 68 20 68 61 76 65 20 61 20 70 72 69 which have a pri
36f0: 6d 61 72 79 20 63 68 69 6c 64 2c 20 62 75 74 20 mary child, but
3700: 74 68 65 20 63 68 69 6c 64 0a 09 23 20 64 6f 65 the child..# doe
3710: 73 20 6e 6f 74 20 68 61 76 65 20 74 68 65 6d 20 s not have them
3720: 61 73 20 70 61 72 65 6e 74 2e 0a 09 43 68 65 63 as parent...Chec
3730: 6b 20 5c 0a 09 20 20 20 20 7b 52 65 76 69 73 69 k \.. {Revisi
3740: 6f 6e 73 20 68 61 76 65 20 74 6f 20 62 65 20 70 ons have to be p
3750: 61 72 65 6e 74 73 20 6f 66 20 74 68 65 69 72 20 arents of their
3760: 70 72 69 6d 61 72 79 20 63 68 69 6c 64 72 65 6e primary children
3770: 7d 20 5c 0a 09 20 20 20 20 7b 69 73 20 6e 6f 74 } \.. {is not
3780: 20 74 68 65 20 70 61 72 65 6e 74 20 6f 66 20 69 the parent of i
3790: 74 73 20 70 72 69 6d 61 72 79 20 63 68 69 6c 64 ts primary child
37a0: 7d 20 7b 0a 09 09 53 45 4c 45 43 54 20 46 2e 6e } {...SELECT F.n
37b0: 61 6d 65 2c 20 52 2e 72 65 76 0a 09 09 46 52 4f ame, R.rev...FRO
37c0: 4d 20 72 65 76 69 73 69 6f 6e 20 52 2c 20 72 65 M revision R, re
37d0: 76 69 73 69 6f 6e 20 43 2c 20 66 69 6c 65 20 46 vision C, file F
37e0: 0a 09 09 57 48 45 52 45 20 52 2e 66 69 64 20 3d ...WHERE R.fid =
37f0: 20 46 2e 66 69 64 0a 09 09 41 4e 44 20 20 20 52 F.fid...AND R
3800: 2e 63 68 69 6c 64 20 49 53 20 4e 4f 54 20 4e 55 .child IS NOT NU
3810: 4c 4c 0a 09 09 41 4e 44 20 20 20 52 2e 63 68 69 LL...AND R.chi
3820: 6c 64 20 3d 20 43 2e 72 69 64 0a 09 09 41 4e 44 ld = C.rid...AND
3830: 20 20 20 43 2e 70 61 72 65 6e 74 20 21 3d 20 52 C.parent != R
3840: 2e 72 69 64 0a 09 09 3b 0a 09 20 20 20 20 7d 0a .rid...;.. }.
3850: 09 23 20 46 69 6e 64 20 61 6c 6c 20 72 65 76 69 .# Find all revi
3860: 73 69 6f 6e 73 20 77 68 69 63 68 20 68 61 76 65 sions which have
3870: 20 61 20 70 72 69 6d 72 61 72 79 20 63 68 69 6c a primrary chil
3880: 64 2c 20 62 75 74 20 74 68 65 0a 09 23 20 63 68 d, but the..# ch
3890: 69 6c 64 20 68 61 73 20 61 20 62 72 61 6e 63 68 ild has a branch
38a0: 20 70 61 72 65 6e 74 20 73 79 6d 62 6f 6c 20 6d parent symbol m
38b0: 61 6b 69 6e 67 20 74 68 65 6d 20 62 72 61 63 68 aking them brach
38c0: 20 73 74 61 72 74 65 72 73 2e 0a 09 43 68 65 63 starters...Chec
38d0: 6b 20 5c 0a 09 20 20 20 20 7b 50 72 69 6d 61 72 k \.. {Primar
38e0: 79 20 63 68 69 6c 64 72 65 6e 20 6f 66 20 72 65 y children of re
38f0: 76 69 73 69 6f 6e 73 20 6d 75 73 74 20 6e 6f 74 visions must not
3900: 20 73 74 61 72 74 20 62 72 61 6e 63 68 65 73 7d start branches}
3910: 20 5c 0a 09 20 20 20 20 7b 69 73 20 70 61 72 65 \.. {is pare
3920: 6e 74 20 6f 66 20 61 20 70 72 69 6d 61 72 79 20 nt of a primary
3930: 63 68 69 6c 64 20 77 68 69 63 68 20 69 73 20 74 child which is t
3940: 68 65 20 62 65 67 69 6e 6e 69 6e 67 20 6f 66 20 he beginning of
3950: 61 20 62 72 61 6e 63 68 7d 20 7b 0a 09 09 53 45 a branch} {...SE
3960: 4c 45 43 54 20 46 2e 6e 61 6d 65 2c 20 52 2e 72 LECT F.name, R.r
3970: 65 76 0a 09 09 46 52 4f 4d 20 72 65 76 69 73 69 ev...FROM revisi
3980: 6f 6e 20 52 2c 20 72 65 76 69 73 69 6f 6e 20 43 on R, revision C
3990: 2c 20 66 69 6c 65 20 46 0a 09 09 57 48 45 52 45 , file F...WHERE
39a0: 20 52 2e 66 69 64 20 3d 20 46 2e 66 69 64 0a 09 R.fid = F.fid..
39b0: 09 41 4e 44 20 20 20 52 2e 63 68 69 6c 64 20 49 .AND R.child I
39c0: 53 20 4e 4f 54 20 4e 55 4c 4c 0a 09 09 41 4e 44 S NOT NULL...AND
39d0: 20 20 20 52 2e 63 68 69 6c 64 20 3d 20 43 2e 72 R.child = C.r
39e0: 69 64 0a 09 09 41 4e 44 20 20 20 43 2e 62 70 61 id...AND C.bpa
39f0: 72 65 6e 74 20 49 53 20 4e 4f 54 20 4e 55 4c 4c rent IS NOT NULL
3a00: 0a 09 09 3b 0a 09 20 20 20 20 7d 0a 09 23 20 46 ...;.. }..# F
3a10: 69 6e 64 20 61 6c 6c 20 72 65 76 69 73 69 6f 6e ind all revision
3a20: 73 20 77 69 74 68 6f 75 74 20 62 72 61 6e 63 68 s without branch
3a30: 20 70 61 72 65 6e 74 20 73 79 6d 62 6f 6c 20 77 parent symbol w
3a40: 68 69 63 68 20 68 61 76 65 20 61 0a 09 23 20 70 hich have a..# p
3a50: 61 72 65 6e 74 2c 20 62 75 74 20 74 68 65 20 70 arent, but the p
3a60: 61 72 65 6e 74 20 64 6f 65 73 20 6e 6f 74 20 68 arent does not h
3a70: 61 76 65 20 74 68 65 6d 20 61 73 20 70 72 69 6d ave them as prim
3a80: 61 72 79 20 63 68 69 6c 64 2e 0a 09 43 68 65 63 ary child...Chec
3a90: 6b 20 5c 0a 09 20 20 20 20 7b 52 65 76 69 73 69 k \.. {Revisi
3aa0: 6f 6e 73 20 68 61 76 65 20 74 6f 20 62 65 20 70 ons have to be p
3ab0: 72 69 6d 61 72 79 20 63 68 69 6c 64 72 65 6e 20 rimary children
3ac0: 6f 66 20 74 68 65 69 72 20 70 61 72 65 6e 74 73 of their parents
3ad0: 2c 20 69 66 20 61 6e 79 7d 20 5c 0a 09 20 20 20 , if any} \..
3ae0: 20 7b 69 73 20 6e 6f 74 20 74 68 65 20 63 68 69 {is not the chi
3af0: 6c 64 20 6f 66 20 69 74 73 20 70 61 72 65 6e 74 ld of its parent
3b00: 7d 20 7b 0a 09 09 53 45 4c 45 43 54 20 46 2e 6e } {...SELECT F.n
3b10: 61 6d 65 2c 20 52 2e 72 65 76 0a 09 09 46 52 4f ame, R.rev...FRO
3b20: 4d 20 72 65 76 69 73 69 6f 6e 20 52 2c 20 72 65 M revision R, re
3b30: 76 69 73 69 6f 6e 20 50 2c 20 66 69 6c 65 20 46 vision P, file F
3b40: 0a 09 09 57 48 45 52 45 20 52 2e 66 69 64 20 3d ...WHERE R.fid =
3b50: 20 46 2e 66 69 64 0a 09 09 41 4e 44 20 20 20 52 F.fid...AND R
3b60: 2e 62 70 61 72 65 6e 74 20 49 53 20 4e 55 4c 4c .bparent IS NULL
3b70: 0a 09 09 41 4e 44 20 20 20 52 2e 70 61 72 65 6e ...AND R.paren
3b80: 74 20 49 53 20 4e 4f 54 20 4e 55 4c 4c 0a 09 09 t IS NOT NULL...
3b90: 41 4e 44 20 20 20 52 2e 70 61 72 65 6e 74 20 3d AND R.parent =
3ba0: 20 50 2e 72 69 64 0a 09 09 41 4e 44 20 20 20 50 P.rid...AND P
3bb0: 2e 63 68 69 6c 64 20 21 3d 20 52 2e 72 69 64 0a .child != R.rid.
3bc0: 09 09 3b 0a 09 20 20 20 20 7d 0a 09 23 20 46 69 ..;.. }..# Fi
3bd0: 6e 64 20 61 6c 6c 20 72 65 76 69 73 69 6f 6e 73 nd all revisions
3be0: 20 77 69 74 68 20 61 20 62 72 61 6e 63 68 20 70 with a branch p
3bf0: 61 72 65 6e 74 20 73 79 6d 62 6f 6c 20 77 68 69 arent symbol whi
3c00: 63 68 20 64 6f 20 6e 6f 74 0a 09 23 20 68 61 76 ch do not..# hav
3c10: 65 20 61 20 70 61 72 65 6e 74 2e 0a 09 43 68 65 e a parent...Che
3c20: 63 6b 20 5c 0a 09 20 20 20 20 7b 42 72 61 6e 63 ck \.. {Branc
3c30: 68 20 73 74 61 72 74 69 6e 67 20 72 65 76 69 73 h starting revis
3c40: 69 6f 6e 73 20 68 61 76 65 20 74 6f 20 68 61 76 ions have to hav
3c50: 65 20 61 20 70 61 72 65 6e 74 7d 20 5c 0a 09 20 e a parent} \..
3c60: 20 20 20 7b 61 74 20 74 68 65 20 62 65 67 69 6e {at the begin
3c70: 6e 69 6e 67 20 6f 66 20 69 74 73 20 62 72 61 6e ning of its bran
3c80: 63 68 20 68 61 73 20 6e 6f 20 70 61 72 65 6e 74 ch has no parent
3c90: 7d 20 7b 0a 09 09 53 45 4c 45 43 54 20 46 2e 6e } {...SELECT F.n
3ca0: 61 6d 65 2c 20 52 2e 72 65 76 0a 09 09 46 52 4f ame, R.rev...FRO
3cb0: 4d 20 72 65 76 69 73 69 6f 6e 20 52 2c 20 66 69 M revision R, fi
3cc0: 6c 65 20 46 0a 09 09 57 48 45 52 45 20 52 2e 66 le F...WHERE R.f
3cd0: 69 64 20 3d 20 46 2e 66 69 64 0a 09 09 41 4e 44 id = F.fid...AND
3ce0: 20 20 20 52 2e 62 70 61 72 65 6e 74 20 49 53 20 R.bparent IS
3cf0: 4e 4f 54 20 4e 55 4c 4c 0a 09 09 41 4e 44 20 20 NOT NULL...AND
3d00: 20 52 2e 70 61 72 65 6e 74 20 49 53 20 4e 55 4c R.parent IS NUL
3d10: 4c 0a 09 09 3b 0a 09 20 20 20 20 7d 0a 09 23 20 L...;.. }..#
3d20: 46 69 6e 64 20 61 6c 6c 20 72 65 76 69 73 69 6f Find all revisio
3d30: 6e 73 20 77 69 74 68 20 61 20 62 72 61 6e 63 68 ns with a branch
3d40: 20 70 61 72 65 6e 74 20 73 79 6d 62 6f 6c 20 77 parent symbol w
3d50: 68 6f 73 65 20 70 61 72 65 6e 74 0a 09 23 20 68 hose parent..# h
3d60: 61 73 20 74 68 65 6d 20 61 73 20 70 72 69 6d 61 as them as prima
3d70: 72 79 20 63 68 69 6c 64 2e 0a 09 43 68 65 63 6b ry child...Check
3d80: 20 5c 0a 09 20 20 20 20 7b 42 72 61 6e 63 68 20 \.. {Branch
3d90: 73 74 61 72 74 69 6e 67 20 72 65 76 69 73 69 6f starting revisio
3da0: 6e 73 20 6d 75 73 74 20 6e 6f 74 20 62 65 20 70 ns must not be p
3db0: 72 69 6d 61 72 79 20 63 68 69 6c 64 72 65 6e 20 rimary children
3dc0: 6f 66 20 74 68 65 69 72 20 70 61 72 65 6e 74 73 of their parents
3dd0: 7d 20 5c 0a 09 20 20 20 20 7b 61 74 20 74 68 65 } \.. {at the
3de0: 20 62 65 67 69 6e 6e 69 6e 67 20 6f 66 20 69 74 beginning of it
3df0: 73 20 62 72 61 6e 63 68 20 69 73 20 74 68 65 20 s branch is the
3e00: 70 72 69 6d 61 72 79 20 63 68 69 6c 64 20 6f 66 primary child of
3e10: 20 69 74 73 20 70 61 72 65 6e 74 7d 20 7b 0a 09 its parent} {..
3e20: 09 53 45 4c 45 43 54 20 46 2e 6e 61 6d 65 2c 20 .SELECT F.name,
3e30: 52 2e 72 65 76 0a 09 09 46 52 4f 4d 20 72 65 76 R.rev...FROM rev
3e40: 69 73 69 6f 6e 20 52 2c 20 72 65 76 69 73 69 6f ision R, revisio
3e50: 6e 20 50 2c 20 66 69 6c 65 20 46 0a 09 09 57 48 n P, file F...WH
3e60: 45 52 45 20 52 2e 66 69 64 20 3d 20 46 2e 66 69 ERE R.fid = F.fi
3e70: 64 0a 09 09 41 4e 44 20 20 20 52 2e 62 70 61 72 d...AND R.bpar
3e80: 65 6e 74 20 49 53 20 4e 4f 54 20 4e 55 4c 4c 0a ent IS NOT NULL.
3e90: 09 09 41 4e 44 20 20 20 52 2e 70 61 72 65 6e 74 ..AND R.parent
3ea0: 20 49 53 20 4e 4f 54 20 4e 55 4c 4c 0a 09 09 41 IS NOT NULL...A
3eb0: 4e 44 20 20 20 52 2e 70 61 72 65 6e 74 20 3d 20 ND R.parent =
3ec0: 50 2e 72 69 64 0a 09 09 41 4e 44 20 20 20 50 2e P.rid...AND P.
3ed0: 63 68 69 6c 64 20 3d 20 52 2e 72 69 64 0a 09 09 child = R.rid...
3ee0: 3b 0a 09 20 20 20 20 7d 0a 09 23 20 46 69 6e 64 ;.. }..# Find
3ef0: 20 61 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 77 all revisions w
3f00: 69 74 68 20 61 20 6e 6f 6e 2d 4e 54 44 42 20 63 ith a non-NTDB c
3f10: 68 69 6c 64 20 77 68 69 63 68 20 61 72 65 20 6e hild which are n
3f20: 6f 74 20 6f 6e 0a 09 23 20 74 68 65 20 4e 54 44 ot on..# the NTD
3f30: 42 2e 0a 09 43 68 65 63 6b 20 5c 0a 09 20 20 20 B...Check \..
3f40: 20 7b 4e 54 44 42 20 74 6f 20 74 72 75 6e 6b 20 {NTDB to trunk
3f50: 74 72 61 6e 73 69 74 69 6f 6e 20 68 61 73 20 74 transition has t
3f60: 6f 20 62 65 67 69 6e 20 6f 6e 20 4e 54 44 42 7d o begin on NTDB}
3f70: 20 5c 0a 09 20 20 20 20 7b 68 61 73 20 61 20 6e \.. {has a n
3f80: 6f 6e 2d 4e 54 44 42 20 63 68 69 6c 64 2c 20 79 on-NTDB child, y
3f90: 65 74 20 69 73 20 6e 6f 74 20 6f 6e 20 74 68 65 et is not on the
3fa0: 20 4e 54 44 42 7d 20 7b 0a 09 09 53 45 4c 45 43 NTDB} {...SELEC
3fb0: 54 20 46 2e 6e 61 6d 65 2c 20 52 2e 72 65 76 0a T F.name, R.rev.
3fc0: 09 09 46 52 4f 4d 20 72 65 76 69 73 69 6f 6e 20 ..FROM revision
3fd0: 52 2c 20 66 69 6c 65 20 46 0a 09 09 57 48 45 52 R, file F...WHER
3fe0: 45 20 52 2e 66 69 64 20 3d 20 46 2e 66 69 64 0a E R.fid = F.fid.
3ff0: 09 09 41 4e 44 20 20 20 52 2e 64 62 63 68 69 6c ..AND R.dbchil
4000: 64 20 49 53 20 4e 4f 54 20 4e 55 4c 4c 0a 09 09 d IS NOT NULL...
4010: 41 4e 44 20 20 20 4e 4f 54 20 52 2e 69 73 64 65 AND NOT R.isde
4020: 66 61 75 6c 74 0a 09 09 3b 0a 09 20 20 20 20 7d fault...;.. }
4030: 0a 09 23 20 46 69 6e 64 20 61 6c 6c 20 72 65 76 ..# Find all rev
4040: 69 73 69 6f 6e 73 20 77 69 74 68 20 61 20 4e 54 isions with a NT
4050: 44 42 20 70 61 72 65 6e 74 20 77 68 69 63 68 20 DB parent which
4060: 61 72 65 20 6f 6e 20 74 68 65 20 4e 54 44 42 2e are on the NTDB.
4070: 0a 09 43 68 65 63 6b 20 5c 0a 09 20 20 20 20 7b ..Check \.. {
4080: 4e 54 44 42 20 74 6f 20 74 72 75 6e 6b 20 74 72 NTDB to trunk tr
4090: 61 6e 73 69 74 69 6f 6e 20 68 61 73 20 74 6f 20 ansition has to
40a0: 65 6e 64 20 6f 6e 20 6e 6f 6e 2d 4e 54 44 42 7d end on non-NTDB}
40b0: 20 5c 0a 09 20 20 20 20 7b 68 61 73 20 61 20 4e \.. {has a N
40c0: 54 44 42 20 70 61 72 65 6e 74 2c 20 79 65 74 20 TDB parent, yet
40d0: 69 73 20 6f 6e 20 74 68 65 20 4e 54 44 42 7d 20 is on the NTDB}
40e0: 7b 0a 09 09 53 45 4c 45 43 54 20 46 2e 6e 61 6d {...SELECT F.nam
40f0: 65 2c 20 52 2e 72 65 76 0a 09 09 46 52 4f 4d 20 e, R.rev...FROM
4100: 72 65 76 69 73 69 6f 6e 20 52 2c 20 66 69 6c 65 revision R, file
4110: 20 46 0a 09 09 57 48 45 52 45 20 52 2e 66 69 64 F...WHERE R.fid
4120: 20 3d 20 46 2e 66 69 64 0a 09 09 41 4e 44 20 20 = F.fid...AND
4130: 20 52 2e 64 62 70 61 72 65 6e 74 20 49 53 20 4e R.dbparent IS N
4140: 4f 54 20 4e 55 4c 4c 0a 09 09 41 4e 44 20 20 20 OT NULL...AND
4150: 52 2e 69 73 64 65 66 61 75 6c 74 0a 09 09 3b 0a R.isdefault...;.
4160: 09 20 20 20 20 7d 0a 09 23 20 46 69 6e 64 20 61 . }..# Find a
4170: 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 77 69 74 ll revisions wit
4180: 68 20 61 20 63 68 69 6c 64 20 77 68 69 63 68 20 h a child which
4190: 64 69 73 61 67 72 65 65 73 20 61 62 6f 75 74 20 disagrees about
41a0: 74 68 65 0a 09 23 20 6c 69 6e 65 20 6f 66 20 64 the..# line of d
41b0: 65 76 65 6c 6f 70 6d 65 6e 74 20 74 68 65 79 20 evelopment they
41c0: 62 65 6c 6f 6e 67 20 74 6f 2e 0a 09 43 68 65 63 belong to...Chec
41d0: 6b 20 5c 0a 09 20 20 20 20 7b 52 65 76 69 73 69 k \.. {Revisi
41e0: 6f 6e 73 20 61 6e 64 20 74 68 65 69 72 20 70 72 ons and their pr
41f0: 69 6d 61 72 79 20 63 68 69 6c 64 72 65 6e 20 68 imary children h
4200: 61 76 65 20 74 6f 20 62 65 20 69 6e 20 74 68 65 ave to be in the
4210: 20 73 61 6d 65 20 4c 4f 44 7d 20 5c 0a 09 20 20 same LOD} \..
4220: 20 20 7b 61 6e 64 20 69 74 73 20 70 72 69 6d 61 {and its prima
4230: 72 79 20 63 68 69 6c 64 20 64 69 73 61 67 72 65 ry child disagre
4240: 65 20 61 62 6f 75 74 20 74 68 65 69 72 20 4c 4f e about their LO
4250: 44 7d 20 7b 0a 09 09 53 45 4c 45 43 54 20 46 2e D} {...SELECT F.
4260: 6e 61 6d 65 2c 20 52 2e 72 65 76 0a 09 09 46 52 name, R.rev...FR
4270: 4f 4d 20 72 65 76 69 73 69 6f 6e 20 52 2c 20 72 OM revision R, r
4280: 65 76 69 73 69 6f 6e 20 43 2c 20 66 69 6c 65 20 evision C, file
4290: 46 0a 09 09 57 48 45 52 45 20 52 2e 66 69 64 20 F...WHERE R.fid
42a0: 3d 20 46 2e 66 69 64 0a 09 09 41 4e 44 20 20 20 = F.fid...AND
42b0: 52 2e 63 68 69 6c 64 20 49 53 20 4e 4f 54 20 4e R.child IS NOT N
42c0: 55 4c 4c 0a 09 09 41 4e 44 20 20 20 52 2e 63 68 ULL...AND R.ch
42d0: 69 6c 64 20 3d 20 43 2e 72 69 64 0a 09 09 41 4e ild = C.rid...AN
42e0: 44 20 20 20 43 2e 6c 6f 64 20 21 3d 20 52 2e 6c D C.lod != R.l
42f0: 6f 64 0a 09 09 3b 0a 09 20 20 20 20 7d 0a 09 23 od...;.. }..#
4300: 20 46 69 6e 64 20 61 6c 6c 20 72 65 76 69 73 69 Find all revisi
4310: 6f 6e 73 20 77 69 74 68 20 61 20 6e 6f 6e 2d 4e ons with a non-N
4320: 54 44 42 20 63 68 69 6c 64 20 77 68 69 63 68 20 TDB child which
4330: 61 67 72 65 65 73 20 61 62 6f 75 74 0a 09 23 20 agrees about..#
4340: 74 68 65 20 6c 69 6e 65 20 6f 66 20 64 65 76 65 the line of deve
4350: 6c 6f 70 6d 65 6e 74 20 74 68 65 79 20 62 65 6c lopment they bel
4360: 6f 6e 67 20 74 6f 2e 0a 09 43 68 65 63 6b 20 5c ong to...Check \
4370: 0a 09 20 20 20 20 7b 4e 54 44 42 20 61 6e 64 20 .. {NTDB and
4380: 74 72 75 6e 6b 20 72 65 76 69 73 69 6f 6e 73 20 trunk revisions
4390: 68 61 76 65 20 74 6f 20 62 65 20 69 6e 20 64 69 have to be in di
43a0: 66 66 65 72 65 6e 74 20 4c 4f 44 73 7d 20 5c 0a fferent LODs} \.
43b0: 09 20 20 20 20 7b 6f 6e 20 4e 54 44 42 20 61 6e . {on NTDB an
43c0: 64 20 69 74 73 20 6e 6f 6e 2d 4e 54 44 42 20 63 d its non-NTDB c
43d0: 68 69 6c 64 20 77 72 6f 6e 67 6c 79 20 61 67 72 hild wrongly agr
43e0: 65 65 20 61 62 6f 75 74 20 74 68 65 69 72 20 4c ee about their L
43f0: 4f 44 7d 20 7b 0a 09 09 53 45 4c 45 43 54 20 46 OD} {...SELECT F
4400: 2e 6e 61 6d 65 2c 20 52 2e 72 65 76 0a 09 09 46 .name, R.rev...F
4410: 52 4f 4d 20 72 65 76 69 73 69 6f 6e 20 52 2c 20 ROM revision R,
4420: 72 65 76 69 73 69 6f 6e 20 43 2c 20 66 69 6c 65 revision C, file
4430: 20 46 0a 09 09 57 48 45 52 45 20 52 2e 66 69 64 F...WHERE R.fid
4440: 20 3d 20 46 2e 66 69 64 0a 09 09 41 4e 44 20 20 = F.fid...AND
4450: 20 52 2e 64 62 63 68 69 6c 64 20 49 53 20 4e 4f R.dbchild IS NO
4460: 54 20 4e 55 4c 4c 0a 09 09 41 4e 44 20 20 20 52 T NULL...AND R
4470: 2e 64 62 63 68 69 6c 64 20 3d 20 43 2e 72 69 64 .dbchild = C.rid
4480: 0a 09 09 41 4e 44 20 20 20 43 2e 6c 6f 64 20 3d ...AND C.lod =
4490: 20 52 2e 6c 6f 64 0a 09 09 3b 0a 09 20 20 20 20 R.lod...;..
44a0: 7d 0a 09 23 20 46 69 6e 64 20 61 6c 6c 20 72 65 }..# Find all re
44b0: 76 69 73 69 6f 6e 73 20 77 69 74 68 20 61 20 62 visions with a b
44c0: 72 61 6e 63 68 20 70 61 72 65 6e 74 20 73 79 6d ranch parent sym
44d0: 62 6f 6c 20 77 68 69 63 68 20 69 73 20 6e 6f 74 bol which is not
44e0: 0a 09 23 20 74 68 65 69 72 20 4c 4f 44 2e 0a 09 ..# their LOD...
44f0: 43 68 65 63 6b 20 5c 0a 09 20 20 20 20 7b 42 72 Check \.. {Br
4500: 61 6e 63 68 20 73 74 61 72 74 69 6e 67 20 72 65 anch starting re
4510: 76 69 73 69 6f 6e 73 20 68 61 76 65 20 74 6f 20 visions have to
4520: 68 61 76 65 20 74 68 65 69 72 20 4c 4f 44 20 61 have their LOD a
4530: 73 20 62 72 61 6e 63 68 20 70 61 72 65 6e 74 20 s branch parent
4540: 73 79 6d 62 6f 6c 7d 20 5c 0a 09 20 20 20 20 7b symbol} \.. {
4550: 61 74 20 74 68 65 20 62 65 67 69 6e 6e 69 6e 67 at the beginning
4560: 20 6f 66 20 69 74 73 20 62 72 61 6e 63 68 20 64 of its branch d
4570: 6f 65 73 20 6e 6f 74 20 68 61 76 65 20 74 68 65 oes not have the
4580: 20 62 72 61 6e 63 68 20 73 79 6d 62 6f 6c 20 61 branch symbol a
4590: 73 20 69 74 73 20 4c 4f 44 7d 20 7b 0a 09 09 53 s its LOD} {...S
45a0: 45 4c 45 43 54 20 46 2e 6e 61 6d 65 2c 20 52 2e ELECT F.name, R.
45b0: 72 65 76 0a 09 09 46 52 4f 4d 20 72 65 76 69 73 rev...FROM revis
45c0: 69 6f 6e 20 52 2c 20 66 69 6c 65 20 46 0a 09 09 ion R, file F...
45d0: 57 48 45 52 45 20 52 2e 66 69 64 20 3d 20 46 2e WHERE R.fid = F.
45e0: 66 69 64 0a 09 09 41 4e 44 20 20 20 52 2e 62 70 fid...AND R.bp
45f0: 61 72 65 6e 74 20 49 53 20 4e 4f 54 20 4e 55 4c arent IS NOT NUL
4600: 4c 0a 09 09 41 4e 44 20 20 20 52 2e 6c 6f 64 20 L...AND R.lod
4610: 21 3d 20 52 2e 62 70 61 72 65 6e 74 0a 09 09 3b != R.bparent...;
4620: 0a 09 20 20 20 20 7d 0a 09 23 20 46 69 6e 64 20 .. }..# Find
4630: 61 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 77 69 all revisions wi
4640: 74 68 20 61 20 62 72 61 6e 63 68 20 70 61 72 65 th a branch pare
4650: 6e 74 20 73 79 6d 62 6f 6c 20 77 68 6f 73 65 20 nt symbol whose
4660: 70 61 72 65 6e 74 0a 09 23 20 69 73 20 69 6e 20 parent..# is in
4670: 74 68 65 20 73 61 6d 65 20 6c 69 6e 65 20 6f 66 the same line of
4680: 20 64 65 76 65 6c 6f 70 6d 65 6e 74 2e 0a 09 43 development...C
4690: 68 65 63 6b 20 5c 0a 09 20 20 20 20 7b 52 65 76 heck \.. {Rev
46a0: 69 73 69 6f 6e 73 20 61 6e 64 20 74 68 65 69 72 isions and their
46b0: 20 62 72 61 6e 63 68 20 63 68 69 6c 64 72 65 6e branch children
46c0: 20 68 61 76 65 20 74 6f 20 62 65 20 69 6e 20 64 have to be in d
46d0: 69 66 66 65 72 65 6e 74 20 4c 4f 44 73 7d 20 5c ifferent LODs} \
46e0: 0a 09 20 20 20 20 7b 61 74 20 74 68 65 20 62 65 .. {at the be
46f0: 67 69 6e 6e 69 6e 67 20 6f 66 20 69 74 73 20 62 ginning of its b
4700: 72 61 6e 63 68 20 61 6e 64 20 69 74 73 20 70 61 ranch and its pa
4710: 72 65 6e 74 20 77 72 6f 6e 67 6c 79 20 61 67 72 rent wrongly agr
4720: 65 65 20 61 62 6f 75 74 20 74 68 65 69 72 20 4c ee about their L
4730: 4f 44 7d 20 7b 0a 09 09 53 45 4c 45 43 54 20 46 OD} {...SELECT F
4740: 2e 6e 61 6d 65 2c 20 52 2e 72 65 76 0a 09 09 46 .name, R.rev...F
4750: 52 4f 4d 20 72 65 76 69 73 69 6f 6e 20 52 2c 20 ROM revision R,
4760: 72 65 76 69 73 69 6f 6e 20 50 2c 20 66 69 6c 65 revision P, file
4770: 20 46 0a 09 09 57 48 45 52 45 20 52 2e 66 69 64 F...WHERE R.fid
4780: 20 3d 20 46 2e 66 69 64 0a 09 09 41 4e 44 20 20 = F.fid...AND
4790: 20 52 2e 62 70 61 72 65 6e 74 20 49 53 20 4e 4f R.bparent IS NO
47a0: 54 20 4e 55 4c 4c 0a 09 09 41 4e 44 20 20 20 52 T NULL...AND R
47b0: 2e 70 61 72 65 6e 74 20 3d 20 50 2e 72 69 64 0a .parent = P.rid.
47c0: 09 09 41 4e 44 20 20 20 52 2e 6c 6f 64 20 3d 20 ..AND R.lod =
47d0: 50 2e 6c 6f 64 0a 09 09 3b 0a 09 20 20 20 20 7d P.lod...;.. }
47e0: 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a ..return. }..
47f0: 20 20 20 20 70 72 6f 63 20 43 68 65 63 6b 20 7b proc Check {
4800: 68 65 61 64 65 72 20 6c 61 62 65 6c 20 73 71 6c header label sql
4810: 7d 20 7b 0a 09 75 70 76 61 72 20 31 20 6e 20 6e } {..upvar 1 n n
4820: 0a 09 73 65 74 20 6f 6b 20 31 0a 09 66 6f 72 65 ..set ok 1..fore
4830: 61 63 68 20 7b 66 6e 61 6d 65 20 72 65 76 6e 72 ach {fname revnr
4840: 7d 20 5b 73 74 61 74 65 20 72 75 6e 20 24 73 71 } [state run $sq
4850: 6c 5d 20 7b 0a 09 20 20 20 20 73 65 74 20 6f 6b l] {.. set ok
4860: 20 30 0a 09 20 20 20 20 74 72 6f 75 62 6c 65 20 0.. trouble
4870: 66 61 74 61 6c 20 22 24 66 6e 61 6d 65 20 3c 24 fatal "$fname <$
4880: 72 65 76 6e 72 3e 20 24 6c 61 62 65 6c 22 0a 09 revnr> $label"..
4890: 7d 0a 09 6c 6f 67 20 77 72 69 74 65 20 35 20 63 }..log write 5 c
48a0: 6f 6c 6c 72 65 76 20 22 5c 5b 5b 66 6f 72 6d 61 ollrev "\[[forma
48b0: 74 20 25 30 32 64 20 5b 69 6e 63 72 20 6e 5d 5d t %02d [incr n]]
48c0: 5c 5d 20 5b 65 78 70 72 20 7b 24 6f 6b 20 3f 20 \] [expr {$ok ?
48d0: 22 4f 6b 20 20 20 20 22 20 3a 20 22 46 61 69 6c "Ok " : "Fail
48e0: 65 64 22 7d 5d 20 2e 2e 2e 20 24 68 65 61 64 65 ed"}] ... $heade
48f0: 72 22 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 7d r"..return. }
4900: 0a 0a 20 20 20 20 23 20 23 20 23 23 20 23 23 23 .. # # ## ###
4910: 20 23 23 23 23 23 20 23 23 23 23 23 23 23 23 20 ##### ########
4920: 23 23 23 23 23 23 23 23 23 23 23 23 23 0a 20 20 #############.
4930: 20 20 23 23 20 49 6e 74 65 72 6e 61 6c 20 6d 65 ## Internal me
4940: 74 68 6f 64 73 0a 0a 20 20 20 20 23 20 23 20 23 thods.. # # #
4950: 23 20 23 23 23 20 23 23 23 23 23 20 23 23 23 23 # ### ##### ####
4960: 23 23 23 23 20 23 23 23 23 23 23 23 23 23 23 23 #### ###########
4970: 23 23 0a 20 20 20 20 23 23 20 43 6f 6e 66 69 67 ##. ## Config
4980: 75 72 61 74 69 6f 6e 0a 0a 20 20 20 20 70 72 61 uration.. pra
4990: 67 6d 61 20 2d 68 61 73 69 6e 73 74 61 6e 63 65 gma -hasinstance
49a0: 73 20 20 20 6e 6f 20 3b 20 23 20 73 69 6e 67 6c s no ; # singl
49b0: 65 74 6f 6e 0a 20 20 20 20 70 72 61 67 6d 61 20 eton. pragma
49c0: 2d 68 61 73 74 79 70 65 69 6e 66 6f 20 20 20 20 -hastypeinfo
49d0: 6e 6f 20 3b 20 23 20 6e 6f 20 69 6e 74 72 6f 73 no ; # no intros
49e0: 70 65 63 74 69 6f 6e 0a 20 20 20 20 70 72 61 67 pection. prag
49f0: 6d 61 20 2d 68 61 73 74 79 70 65 64 65 73 74 72 ma -hastypedestr
4a00: 6f 79 20 6e 6f 20 3b 20 23 20 69 6d 6d 6f 72 74 oy no ; # immort
4a10: 61 6c 0a 0a 20 20 20 20 23 20 23 20 23 23 20 23 al.. # # ## #
4a20: 23 23 20 23 23 23 23 23 20 23 23 23 23 23 23 23 ## ##### #######
4a30: 23 20 23 23 23 23 23 23 23 23 23 23 23 23 23 0a # #############.
4a40: 7d 0a 0a 6e 61 6d 65 73 70 61 63 65 20 65 76 61 }..namespace eva
4a50: 6c 20 3a 3a 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a l ::vc::fossil::
4a60: 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 70 61 73 import::cvs::pas
4a70: 73 20 7b 0a 20 20 20 20 6e 61 6d 65 73 70 61 63 s {. namespac
4a80: 65 20 65 78 70 6f 72 74 20 63 6f 6c 6c 72 65 76 e export collrev
4a90: 0a 20 20 20 20 6e 61 6d 65 73 70 61 63 65 20 65 . namespace e
4aa0: 76 61 6c 20 63 6f 6c 6c 72 65 76 20 7b 0a 09 6e val collrev {..n
4ab0: 61 6d 65 73 70 61 63 65 20 69 6d 70 6f 72 74 20 amespace import
4ac0: 3a 3a 76 63 3a 3a 72 63 73 3a 3a 70 61 72 73 65 ::vc::rcs::parse
4ad0: 72 0a 09 6e 61 6d 65 73 70 61 63 65 20 69 6d 70 r..namespace imp
4ae0: 6f 72 74 20 3a 3a 76 63 3a 3a 66 6f 73 73 69 6c ort ::vc::fossil
4af0: 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 72 ::import::cvs::r
4b00: 65 70 6f 73 69 74 6f 72 79 0a 09 6e 61 6d 65 73 epository..names
4b10: 70 61 63 65 20 69 6d 70 6f 72 74 20 3a 3a 76 63 pace import ::vc
4b20: 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 ::fossil::import
4b30: 3a 3a 63 76 73 3a 3a 73 74 61 74 65 0a 09 6e 61 ::cvs::state..na
4b40: 6d 65 73 70 61 63 65 20 69 6d 70 6f 72 74 20 3a mespace import :
4b50: 3a 76 63 3a 3a 74 6f 6f 6c 73 3a 3a 74 72 6f 75 :vc::tools::trou
4b60: 62 6c 65 0a 09 6e 61 6d 65 73 70 61 63 65 20 69 ble..namespace i
4b70: 6d 70 6f 72 74 20 3a 3a 76 63 3a 3a 74 6f 6f 6c mport ::vc::tool
4b80: 73 3a 3a 6c 6f 67 0a 09 6c 6f 67 20 72 65 67 69 s::log..log regi
4b90: 73 74 65 72 20 63 6f 6c 6c 72 65 76 0a 20 20 20 ster collrev.
4ba0: 20 7d 0a 7d 0a 0a 23 20 23 20 23 23 20 23 23 23 }.}..# # ## ###
4bb0: 20 23 23 23 23 23 20 23 23 23 23 23 23 23 23 20 ##### ########
4bc0: 23 23 23 23 23 23 23 23 23 23 23 23 23 20 23 23 ############# ##
4bd0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
4be0: 23 23 23 0a 23 23 20 52 65 61 64 79 0a 0a 70 61 ###.## Ready..pa
4bf0: 63 6b 61 67 65 20 70 72 6f 76 69 64 65 20 76 63 ckage provide vc
4c00: 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 ::fossil::import
4c10: 3a 3a 63 76 73 3a 3a 70 61 73 73 3a 3a 63 6f 6c ::cvs::pass::col
4c20: 6c 72 65 76 20 31 2e 30 0a 72 65 74 75 72 6e 0a lrev 1.0.return.