Hex Artifact Content
Not logged in

Artifact 3d675ee00abf88ebad3126d7a5d9f8a5ba170f43:

File tools/cvs2fossil/lib/c2f_pcollrev.tcl part of check-in [e45f47ec4a] - Opcode synchronization reworked, optype table is master from which the in-memory array is loaded. by aku on 2007-11-07 07:46:31.

0000: 23 23 20 2d 2a 2d 20 74 63 6c 20 2d 2a 2d 0a 23  ## -*- tcl -*-.#
0010: 20 23 20 23 23 20 23 23 23 20 23 23 23 23 23 20   # ## ### ##### 
0020: 23 23 23 23 23 23 23 23 20 23 23 23 23 23 23 23  ######## #######
0030: 23 23 23 23 23 23 20 23 23 23 23 23 23 23 23 23  ###### #########
0040: 23 23 23 23 23 23 23 23 23 23 23 23 0a 23 23 20  ############.## 
0050: 43 6f 70 79 72 69 67 68 74 20 28 63 29 20 32 30  Copyright (c) 20
0060: 30 37 20 41 6e 64 72 65 61 73 20 4b 75 70 72 69  07 Andreas Kupri
0070: 65 73 2e 0a 23 0a 23 20 54 68 69 73 20 73 6f 66  es..#.# This sof
0080: 74 77 61 72 65 20 69 73 20 6c 69 63 65 6e 73 65  tware is license
0090: 64 20 61 73 20 64 65 73 63 72 69 62 65 64 20 69  d as described i
00a0: 6e 20 74 68 65 20 66 69 6c 65 20 4c 49 43 45 4e  n the file LICEN
00b0: 53 45 2c 20 77 68 69 63 68 0a 23 20 79 6f 75 20  SE, which.# you 
00c0: 73 68 6f 75 6c 64 20 68 61 76 65 20 72 65 63 65  should have rece
00d0: 69 76 65 64 20 61 73 20 70 61 72 74 20 6f 66 20  ived as part of 
00e0: 74 68 69 73 20 64 69 73 74 72 69 62 75 74 69 6f  this distributio
00f0: 6e 2e 0a 23 0a 23 20 54 68 69 73 20 73 6f 66 74  n..#.# This soft
0100: 77 61 72 65 20 63 6f 6e 73 69 73 74 73 20 6f 66  ware consists of
0110: 20 76 6f 6c 75 6e 74 61 72 79 20 63 6f 6e 74 72   voluntary contr
0120: 69 62 75 74 69 6f 6e 73 20 6d 61 64 65 20 62 79  ibutions made by
0130: 20 6d 61 6e 79 0a 23 20 69 6e 64 69 76 69 64 75   many.# individu
0140: 61 6c 73 2e 20 20 46 6f 72 20 65 78 61 63 74 20  als.  For exact 
0150: 63 6f 6e 74 72 69 62 75 74 69 6f 6e 20 68 69 73  contribution his
0160: 74 6f 72 79 2c 20 73 65 65 20 74 68 65 20 72 65  tory, see the re
0170: 76 69 73 69 6f 6e 0a 23 20 68 69 73 74 6f 72 79  vision.# history
0180: 20 61 6e 64 20 6c 6f 67 73 2c 20 61 76 61 69 6c   and logs, avail
0190: 61 62 6c 65 20 61 74 20 68 74 74 70 3a 2f 2f 66  able at http://f
01a0: 6f 73 73 69 6c 2d 73 63 6d 2e 68 77 61 63 69 2e  ossil-scm.hwaci.
01b0: 63 6f 6d 2f 66 6f 73 73 69 6c 0a 23 20 23 20 23  com/fossil.# # #
01c0: 23 20 23 23 23 20 23 23 23 23 23 20 23 23 23 23  # ### ##### ####
01d0: 23 23 23 23 20 23 23 23 23 23 23 23 23 23 23 23  #### ###########
01e0: 23 23 20 23 23 23 23 23 23 23 23 23 23 23 23 23  ## #############
01f0: 23 23 23 23 23 23 23 23 0a 0a 23 23 20 50 61 73  ########..## Pas
0200: 73 20 49 49 2e 20 54 68 69 73 20 70 61 73 73 20  s II. This pass 
0210: 70 61 72 73 65 73 20 74 68 65 20 63 6f 6c 6c 65  parses the colle
0220: 63 74 65 64 20 72 63 73 20 61 72 63 68 69 76 65  cted rcs archive
0230: 73 20 61 6e 64 20 65 78 74 72 61 63 74 73 0a 23  s and extracts.#
0240: 23 20 61 6c 6c 20 74 68 65 20 69 6e 66 6f 72 6d  # all the inform
0250: 61 74 69 6f 6e 20 74 68 65 79 20 63 6f 6e 74 61  ation they conta
0260: 69 6e 20 28 72 65 76 69 73 69 6f 6e 73 2c 20 61  in (revisions, a
0270: 6e 64 20 73 79 6d 62 6f 6c 73 29 2e 0a 0a 23 20  nd symbols)...# 
0280: 23 20 23 23 20 23 23 23 20 23 23 23 23 23 20 23  # ## ### ##### #
0290: 23 23 23 23 23 23 23 20 23 23 23 23 23 23 23 23  ####### ########
02a0: 23 23 23 23 23 20 23 23 23 23 23 23 23 23 23 23  ##### ##########
02b0: 23 23 23 23 23 23 23 23 23 23 23 0a 23 23 20 52  ###########.## R
02c0: 65 71 75 69 72 65 6d 65 6e 74 73 0a 0a 70 61 63  equirements..pac
02d0: 6b 61 67 65 20 72 65 71 75 69 72 65 20 54 63 6c  kage require Tcl
02e0: 20 38 2e 34 20 20 20 20 20 20 20 20 20 20 20 20   8.4            
02f0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
0300: 20 20 20 3b 20 23 20 52 65 71 75 69 72 65 64 20     ; # Required 
0310: 72 75 6e 74 69 6d 65 2e 0a 70 61 63 6b 61 67 65  runtime..package
0320: 20 72 65 71 75 69 72 65 20 73 6e 69 74 20 20 20   require snit   
0330: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
0340: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 3b                 ;
0350: 20 23 20 4f 4f 20 73 79 73 74 65 6d 2e 0a 70 61   # OO system..pa
0360: 63 6b 61 67 65 20 72 65 71 75 69 72 65 20 76 63  ckage require vc
0370: 3a 3a 74 6f 6f 6c 73 3a 3a 74 72 6f 75 62 6c 65  ::tools::trouble
0380: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
0390: 20 20 20 20 3b 20 23 20 45 72 72 6f 72 20 72 65      ; # Error re
03a0: 70 6f 72 74 69 6e 67 2e 0a 70 61 63 6b 61 67 65  porting..package
03b0: 20 72 65 71 75 69 72 65 20 76 63 3a 3a 74 6f 6f   require vc::too
03c0: 6c 73 3a 3a 6c 6f 67 20 20 20 20 20 20 20 20 20  ls::log         
03d0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 3b                 ;
03e0: 20 23 20 55 73 65 72 20 66 65 65 64 62 61 63 6b   # User feedback
03f0: 2e 0a 70 61 63 6b 61 67 65 20 72 65 71 75 69 72  ..package requir
0400: 65 20 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d  e vc::fossil::im
0410: 70 6f 72 74 3a 3a 63 76 73 3a 3a 70 61 73 73 20  port::cvs::pass 
0420: 20 20 20 20 20 20 20 20 3b 20 23 20 50 61 73 73          ; # Pass
0430: 20 6d 61 6e 61 67 65 6d 65 6e 74 2e 0a 70 61 63   management..pac
0440: 6b 61 67 65 20 72 65 71 75 69 72 65 20 76 63 3a  kage require vc:
0450: 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a  :fossil::import:
0460: 3a 63 76 73 3a 3a 72 65 70 6f 73 69 74 6f 72 79  :cvs::repository
0470: 20 20 20 3b 20 23 20 52 65 70 6f 73 69 74 6f 72     ; # Repositor
0480: 79 20 6d 61 6e 61 67 65 6d 65 6e 74 2e 0a 70 61  y management..pa
0490: 63 6b 61 67 65 20 72 65 71 75 69 72 65 20 76 63  ckage require vc
04a0: 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 74  ::fossil::import
04b0: 3a 3a 63 76 73 3a 3a 73 74 61 74 65 20 20 20 20  ::cvs::state    
04c0: 20 20 20 20 3b 20 23 20 53 74 61 74 65 20 73 74      ; # State st
04d0: 6f 72 61 67 65 2e 0a 70 61 63 6b 61 67 65 20 72  orage..package r
04e0: 65 71 75 69 72 65 20 76 63 3a 3a 66 6f 73 73 69  equire vc::fossi
04f0: 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a  l::import::cvs::
0500: 70 72 6f 6a 65 63 74 3a 3a 73 79 6d 20 3b 20 23  project::sym ; #
0510: 20 50 72 6f 6a 65 63 74 20 6c 65 76 65 6c 20 73   Project level s
0520: 79 6d 62 6f 6c 73 2e 0a 70 61 63 6b 61 67 65 20  ymbols..package 
0530: 72 65 71 75 69 72 65 20 76 63 3a 3a 66 6f 73 73  require vc::foss
0540: 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a  il::import::cvs:
0550: 3a 66 69 6c 65 3a 3a 72 65 76 20 20 20 20 3b 20  :file::rev    ; 
0560: 23 20 46 69 6c 65 20 6c 65 76 65 6c 20 72 65 76  # File level rev
0570: 69 73 69 6f 6e 73 2e 0a 70 61 63 6b 61 67 65 20  isions..package 
0580: 72 65 71 75 69 72 65 20 76 63 3a 3a 72 63 73 3a  require vc::rcs:
0590: 3a 70 61 72 73 65 72 20 20 20 20 20 20 20 20 20  :parser         
05a0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 3b 20                ; 
05b0: 23 20 52 63 73 20 61 72 63 68 69 76 65 20 64 61  # Rcs archive da
05c0: 74 61 20 65 78 74 72 61 63 74 69 6f 6e 2e 0a 0a  ta extraction...
05d0: 23 20 23 20 23 23 20 23 23 23 20 23 23 23 23 23  # # ## ### #####
05e0: 20 23 23 23 23 23 23 23 23 20 23 23 23 23 23 23   ######## ######
05f0: 23 23 23 23 23 23 23 20 23 23 23 23 23 23 23 23  ####### ########
0600: 23 23 23 23 23 23 23 23 23 23 23 23 23 0a 23 23  #############.##
0610: 20 52 65 67 69 73 74 65 72 20 74 68 65 20 70 61   Register the pa
0620: 73 73 20 77 69 74 68 20 74 68 65 20 6d 61 6e 61  ss with the mana
0630: 67 65 6d 65 6e 74 0a 0a 76 63 3a 3a 66 6f 73 73  gement..vc::foss
0640: 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a  il::import::cvs:
0650: 3a 70 61 73 73 20 64 65 66 69 6e 65 20 5c 0a 20  :pass define \. 
0660: 20 20 20 43 6f 6c 6c 65 63 74 52 65 76 20 5c 0a     CollectRev \.
0670: 20 20 20 20 7b 43 6f 6c 6c 65 63 74 20 72 65 76      {Collect rev
0680: 69 73 69 6f 6e 73 20 61 6e 64 20 73 79 6d 62 6f  isions and symbo
0690: 6c 73 7d 20 5c 0a 20 20 20 20 3a 3a 76 63 3a 3a  ls} \.    ::vc::
06a0: 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a  fossil::import::
06b0: 63 76 73 3a 3a 70 61 73 73 3a 3a 63 6f 6c 6c 72  cvs::pass::collr
06c0: 65 76 0a 0a 23 20 23 20 23 23 20 23 23 23 20 23  ev..# # ## ### #
06d0: 23 23 23 23 20 23 23 23 23 23 23 23 23 20 23 23  #### ######## ##
06e0: 23 23 23 23 23 23 23 23 23 23 23 20 23 23 23 23  ########### ####
06f0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23  ################
0700: 23 0a 23 23 20 0a 0a 73 6e 69 74 3a 3a 74 79 70  #.## ..snit::typ
0710: 65 20 3a 3a 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a  e ::vc::fossil::
0720: 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 70 61 73  import::cvs::pas
0730: 73 3a 3a 63 6f 6c 6c 72 65 76 20 7b 0a 20 20 20  s::collrev {.   
0740: 20 23 20 23 20 23 23 20 23 23 23 20 23 23 23 23   # # ## ### ####
0750: 23 20 23 23 23 23 23 23 23 23 20 23 23 23 23 23  # ######## #####
0760: 23 23 23 23 23 23 23 23 0a 20 20 20 20 23 23 20  ########.    ## 
0770: 50 75 62 6c 69 63 20 41 50 49 0a 0a 20 20 20 20  Public API..    
0780: 74 79 70 65 6d 65 74 68 6f 64 20 73 65 74 75 70  typemethod setup
0790: 20 7b 7d 20 7b 0a 09 23 20 44 65 66 69 6e 65 20   {} {..# Define 
07a0: 6e 61 6d 65 73 20 61 6e 64 20 73 74 72 75 63 74  names and struct
07b0: 75 72 65 20 6f 66 20 74 68 65 20 70 65 72 73 69  ure of the persi
07c0: 73 74 65 6e 74 20 73 74 61 74 65 20 6f 66 20 74  stent state of t
07d0: 68 69 73 0a 09 23 20 70 61 73 73 2e 0a 0a 09 73  his..# pass....s
07e0: 74 61 74 65 20 72 65 61 64 69 6e 67 20 70 72 6f  tate reading pro
07f0: 6a 65 63 74 0a 09 73 74 61 74 65 20 72 65 61 64  ject..state read
0800: 69 6e 67 20 66 69 6c 65 0a 0a 09 23 20 57 65 20  ing file...# We 
0810: 64 65 61 6c 20 77 69 74 68 20 70 65 72 20 70 72  deal with per pr
0820: 6f 6a 65 63 74 20 61 6e 64 20 70 65 72 20 66 69  oject and per fi
0830: 6c 65 20 64 61 74 61 2c 20 74 68 65 20 66 69 72  le data, the fir
0840: 73 74 0a 09 23 20 63 6f 6c 6c 61 74 65 64 20 66  st..# collated f
0850: 72 6f 6d 20 74 68 65 20 73 65 63 6f 6e 64 2e 0a  rom the second..
0860: 0a 09 23 20 50 65 72 20 66 69 6c 65 20 77 65 20  ..# Per file we 
0870: 68 61 76 65 20 67 65 6e 65 72 61 6c 20 69 6e 66  have general inf
0880: 6f 72 6d 61 74 69 6f 6e 2c 20 2e 2e 2e 2c 20 61  ormation, ..., a
0890: 6e 64 20 74 68 65 6e 0a 09 23 20 72 65 76 69 73  nd then..# revis
08a0: 69 6f 6e 73 20 61 6e 64 20 73 79 6d 62 6f 6c 73  ions and symbols
08b0: 2e 20 54 68 65 20 6c 61 74 74 65 72 20 63 61 6e  . The latter can
08c0: 20 62 65 20 66 75 72 74 68 65 72 20 73 65 70 61   be further sepa
08d0: 72 61 74 65 64 0a 09 23 20 69 6e 74 6f 20 74 61  rated..# into ta
08e0: 67 73 20 61 6e 64 20 62 72 61 6e 63 68 65 73 2e  gs and branches.
08f0: 20 41 74 20 70 72 6f 6a 65 63 74 20 6c 65 76 65   At project leve
0900: 6c 20 74 68 65 20 70 65 72 2d 66 69 6c 65 0a 09  l the per-file..
0910: 23 20 73 79 6d 62 6f 6c 73 20 69 6e 66 6f 72 6d  # symbols inform
0920: 61 74 69 6f 6e 20 69 73 20 6d 65 72 67 65 64 2e  ation is merged.
0930: 0a 0a 09 23 20 46 69 6c 65 20 6c 65 76 65 6c 20  ...# File level 
0940: 2e 2e 2e 0a 09 23 09 52 65 76 69 73 69 6f 6e 73  .....#.Revisions
0950: 2c 20 42 72 61 6e 63 68 65 73 2c 20 54 61 67 73  , Branches, Tags
0960: 0a 09 23 0a 09 23 20 50 73 65 75 64 6f 20 63 6c  ..#..# Pseudo cl
0970: 61 73 73 20 68 69 65 72 61 72 63 68 79 0a 09 23  ass hierarchy..#
0980: 09 54 61 67 20 20 20 20 20 20 3c 2d 20 53 79 6d  .Tag      <- Sym
0990: 62 6f 6c 20 3c 2d 20 45 76 65 6e 74 0a 09 23 09  bol <- Event..#.
09a0: 42 72 61 6e 63 68 20 20 20 3c 2d 20 53 79 6d 62  Branch   <- Symb
09b0: 6f 6c 20 3c 2d 20 45 76 65 6e 74 0a 09 23 09 52  ol <- Event..#.R
09c0: 65 76 69 73 69 6f 6e 20 20 20 20 20 20 20 20 20  evision         
09d0: 20 20 3c 2d 20 45 76 65 6e 74 0a 0a 09 73 74 61    <- Event...sta
09e0: 74 65 20 77 72 69 74 69 6e 67 20 72 65 76 69 73  te writing revis
09f0: 69 6f 6e 20 7b 0a 09 20 20 20 20 2d 2d 20 52 65  ion {..    -- Re
0a00: 76 69 73 69 6f 6e 73 2e 20 49 64 65 6e 74 69 66  visions. Identif
0a10: 69 65 64 20 62 79 20 61 20 67 6c 6f 62 61 6c 20  ied by a global 
0a20: 6e 75 6d 65 72 69 63 20 69 64 20 65 61 63 68 0a  numeric id each.
0a30: 09 20 20 20 20 2d 2d 20 62 65 6c 6f 6e 67 73 20  .    -- belongs 
0a40: 74 6f 20 61 20 73 69 6e 67 6c 65 20 66 69 6c 65  to a single file
0a50: 2c 20 69 64 65 6e 74 69 66 69 65 64 20 62 79 20  , identified by 
0a60: 69 74 73 20 69 64 2e 20 49 74 0a 09 20 20 20 20  its id. It..    
0a70: 2d 2d 20 66 75 72 74 68 65 72 20 68 61 73 20 61  -- further has a
0a80: 20 64 6f 74 74 65 64 20 72 65 76 69 73 69 6f 6e   dotted revision
0a90: 20 6e 75 6d 62 65 72 20 28 44 54 4e 29 2e 0a 09   number (DTN)...
0aa0: 20 20 20 20 2d 2d 0a 09 20 20 20 20 2d 2d 20 43      --..    -- C
0ab0: 6f 6e 73 74 72 61 69 6e 74 3a 20 54 68 65 20 64  onstraint: The d
0ac0: 6f 74 74 65 64 20 72 65 76 69 73 69 6f 6e 20 6e  otted revision n
0ad0: 75 6d 62 65 72 20 69 73 20 75 6e 69 71 75 65 20  umber is unique 
0ae0: 77 69 74 68 69 6e 0a 20 20 20 20 20 20 20 20 20  within.         
0af0: 20 20 20 2d 2d 20 20 20 20 20 20 20 20 20 20 20     --           
0b00: 20 20 74 68 65 20 66 69 6c 65 2e 20 53 65 65 20    the file. See 
0b10: 65 6e 64 20 6f 66 20 64 65 66 69 6e 69 74 69 6f  end of definitio
0b20: 6e 2e 0a 0a 09 20 20 20 20 72 69 64 20 20 49 4e  n....    rid  IN
0b30: 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 20  TEGER  NOT NULL 
0b40: 20 50 52 49 4d 41 52 59 20 4b 45 59 20 41 55 54   PRIMARY KEY AUT
0b50: 4f 49 4e 43 52 45 4d 45 4e 54 2c 0a 09 20 20 20  OINCREMENT,..   
0b60: 20 66 69 64 20 20 49 4e 54 45 47 45 52 20 20 4e   fid  INTEGER  N
0b70: 4f 54 20 4e 55 4c 4c 20 20 52 45 46 45 52 45 4e  OT NULL  REFEREN
0b80: 43 45 53 20 66 69 6c 65 2c 20 20 20 2d 2d 20 46  CES file,   -- F
0b90: 69 6c 65 20 6f 77 6e 69 6e 67 20 72 65 76 69 73  ile owning revis
0ba0: 69 6f 6e 2e 0a 09 20 20 20 20 72 65 76 20 20 54  ion...    rev  T
0bb0: 45 58 54 20 20 20 20 20 4e 4f 54 20 4e 55 4c 4c  EXT     NOT NULL
0bc0: 2c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20  ,               
0bd0: 20 20 20 20 20 2d 2d 20 44 6f 74 74 65 64 20 52       -- Dotted R
0be0: 65 76 20 4e 75 6d 62 65 72 2e 0a 0a 09 20 20 20  ev Number....   
0bf0: 20 2d 2d 20 41 6c 6c 20 72 65 76 69 73 69 6f 6e   -- All revision
0c00: 73 20 62 65 6c 6f 6e 67 20 74 6f 20 61 20 6c 69  s belong to a li
0c10: 6e 65 2d 6f 66 2d 64 65 76 65 6c 6f 70 6d 65 6e  ne-of-developmen
0c20: 74 2c 0a 09 20 20 20 20 2d 2d 20 69 64 65 6e 74  t,..    -- ident
0c30: 69 66 69 65 64 20 62 79 20 61 20 73 79 6d 62 6f  ified by a symbo
0c40: 6c 20 28 70 72 6f 6a 65 63 74 20 6c 65 76 65 6c  l (project level
0c50: 29 2e 20 44 75 72 69 6e 67 20 64 61 74 61 0a 09  ). During data..
0c60: 20 20 20 20 2d 2d 20 63 6f 6c 6c 65 63 74 69 6f      -- collectio
0c70: 6e 20 69 74 20 77 61 73 20 61 20 66 69 6c 65 2d  n it was a file-
0c80: 6c 65 76 65 6c 20 62 72 61 6e 63 68 20 73 79 6d  level branch sym
0c90: 62 6f 6c 2e 0a 09 20 20 20 20 2d 2d 0a 09 20 20  bol...    --..  
0ca0: 20 20 2d 2d 20 43 6f 6e 73 74 72 61 69 6e 74 3a    -- Constraint:
0cb0: 20 41 6c 6c 20 74 68 65 20 4c 4f 44 20 73 79 6d   All the LOD sym
0cc0: 62 6f 6c 73 20 61 72 65 20 69 6e 20 74 68 65 20  bols are in the 
0cd0: 73 61 6d 65 20 70 72 6f 6a 65 63 74 0a 09 20 20  same project..  
0ce0: 20 20 2d 2d 20 20 20 20 20 20 20 20 20 20 20 20    --            
0cf0: 20 61 73 20 74 68 65 20 66 69 6c 65 20 69 74 73   as the file its
0d00: 65 6c 66 2e 20 54 68 69 73 20 63 61 6e 6e 6f 74  elf. This cannot
0d10: 20 62 65 0a 09 20 20 20 20 2d 2d 20 20 20 20 20   be..    --     
0d20: 20 20 20 20 20 20 20 20 65 78 70 72 65 73 73 65          expresse
0d30: 64 20 69 6e 20 43 52 45 41 54 45 20 54 41 42 4c  d in CREATE TABL
0d40: 45 20 73 79 6e 74 61 78 2e 0a 0a 09 20 20 20 20  E syntax....    
0d50: 6c 6f 64 20 20 49 4e 54 45 47 45 52 20 20 4e 4f  lod  INTEGER  NO
0d60: 54 20 4e 55 4c 4c 20 20 52 45 46 45 52 45 4e 43  T NULL  REFERENC
0d70: 45 53 20 73 79 6d 62 6f 6c 2c 20 2d 2d 20 4c 69  ES symbol, -- Li
0d80: 6e 65 20 6f 66 20 64 65 76 65 6c 6f 70 6d 65 6e  ne of developmen
0d90: 74 0a 0a 09 20 20 20 20 2d 2d 20 54 68 65 20 72  t...    -- The r
0da0: 65 76 69 73 69 6f 6e 73 20 69 6e 20 61 20 66 69  evisions in a fi
0db0: 6c 65 20 61 72 65 20 6f 72 67 61 6e 69 7a 65 64  le are organized
0dc0: 20 69 6e 20 61 20 66 6f 72 65 73 74 20 6f 66 0a   in a forest of.
0dd0: 09 20 20 20 20 2d 2d 20 74 72 65 65 73 2c 20 77  .    -- trees, w
0de0: 69 74 68 20 74 68 65 20 6d 61 69 6e 20 6c 69 6e  ith the main lin
0df0: 65 73 20 64 65 66 69 6e 65 64 20 74 68 72 6f 75  es defined throu
0e00: 67 68 20 74 68 65 20 70 61 72 65 6e 74 20 2f 0a  gh the parent /.
0e10: 09 20 20 20 20 2d 2d 20 63 68 69 6c 64 20 72 65  .    -- child re
0e20: 66 65 72 65 6e 63 65 73 2e 20 41 20 72 65 76 69  ferences. A revi
0e30: 73 69 6f 6e 20 77 69 74 68 6f 75 74 20 61 20 70  sion without a p
0e40: 61 72 65 6e 74 20 69 73 20 74 68 65 0a 09 20 20  arent is the..  
0e50: 20 20 2d 2d 20 72 6f 6f 74 20 6f 66 20 61 20 74    -- root of a t
0e60: 72 65 65 2c 20 61 6e 64 20 61 20 72 65 76 69 73  ree, and a revis
0e70: 69 6f 6e 20 77 69 74 68 6f 75 74 20 61 20 63 68  ion without a ch
0e80: 69 6c 64 20 69 73 20 61 0a 09 20 20 20 20 2d 2d  ild is a..    --
0e90: 20 6c 65 61 66 2e 0a 0a 09 20 20 20 20 2d 2d 20   leaf....    -- 
0ea0: 43 6f 6e 73 74 72 61 69 6e 74 73 3a 20 41 6c 6c  Constraints: All
0eb0: 20 72 65 76 69 73 69 6f 6e 73 20 63 6f 75 70 6c   revisions coupl
0ec0: 65 64 20 74 68 72 6f 75 67 68 20 70 61 72 65 6e  ed through paren
0ed0: 74 2f 63 68 69 6c 64 0a 09 20 20 20 20 2d 2d 20  t/child..    -- 
0ee0: 20 20 20 20 20 20 20 20 20 20 20 20 20 72 65 66               ref
0ef0: 65 72 20 74 6f 20 74 68 65 20 73 61 6d 65 20 4c  er to the same L
0f00: 4f 44 20 73 79 6d 62 6f 6c 2e 20 54 68 65 20 70  OD symbol. The p
0f10: 61 72 65 6e 74 0a 09 20 20 20 20 2d 2d 20 20 20  arent..    --   
0f20: 20 20 20 20 20 20 20 20 20 20 20 6f 66 20 61 20             of a 
0f30: 63 68 69 6c 64 20 6f 66 20 58 20 69 73 20 58 2e  child of X is X.
0f40: 20 54 68 65 20 63 68 69 6c 64 20 6f 66 20 61 0a   The child of a.
0f50: 09 20 20 20 20 2d 2d 20 20 20 20 20 20 20 20 20  .    --         
0f60: 20 20 20 20 20 70 61 72 65 6e 74 20 6f 66 20 58       parent of X
0f70: 20 69 73 20 58 2e 0a 0a 09 20 20 20 20 70 61 72   is X....    par
0f80: 65 6e 74 20 20 49 4e 54 45 47 45 52 20 20 20 20  ent  INTEGER    
0f90: 20 20 20 20 20 20 20 20 52 45 46 45 52 45 4e 43          REFERENC
0fa0: 45 53 20 72 65 76 69 73 69 6f 6e 2c 0a 09 20 20  ES revision,..  
0fb0: 20 20 63 68 69 6c 64 20 20 20 49 4e 54 45 47 45    child   INTEGE
0fc0: 52 20 20 20 20 20 20 20 20 20 20 20 20 52 45 46  R            REF
0fd0: 45 52 45 4e 43 45 53 20 72 65 76 69 73 69 6f 6e  ERENCES revision
0fe0: 2c 0a 0a 09 20 20 20 20 2d 2d 20 54 68 65 20 72  ,...    -- The r
0ff0: 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 20 6f 66  epresentation of
1000: 20 61 20 62 72 61 6e 63 68 20 69 6e 20 61 20 74   a branch in a t
1010: 72 65 65 20 69 73 20 74 68 65 0a 09 20 20 20 20  ree is the..    
1020: 2d 2d 20 65 78 63 65 70 74 69 6f 6e 20 74 6f 20  -- exception to 
1030: 74 68 65 20 74 68 72 65 65 20 63 6f 6e 73 74 72  the three constr
1040: 61 69 6e 74 73 20 61 62 6f 76 65 2e 0a 0a 09 20  aints above.... 
1050: 20 20 20 2d 2d 20 54 68 65 20 62 65 67 69 6e 6e     -- The beginn
1060: 69 6e 67 20 6f 66 20 61 20 62 72 61 6e 63 68 20  ing of a branch 
1070: 69 73 20 72 65 70 72 65 73 65 6e 74 65 64 20 62  is represented b
1080: 79 20 61 20 6e 6f 6e 2d 4e 55 4c 4c 0a 09 20 20  y a non-NULL..  
1090: 20 20 2d 2d 20 62 70 61 72 65 6e 74 20 6f 66 20    -- bparent of 
10a0: 61 20 72 65 76 69 73 69 6f 6e 2e 20 54 68 69 73  a revision. This
10b0: 20 72 65 76 69 73 69 6f 6e 20 42 20 69 73 20 74   revision B is t
10c0: 68 65 20 66 69 72 73 74 20 6f 6e 0a 09 20 20 20  he first on..   
10d0: 20 2d 2d 20 74 68 65 20 62 72 61 6e 63 68 2e 20   -- the branch. 
10e0: 49 74 73 20 70 61 72 65 6e 74 20 50 20 69 73 20  Its parent P is 
10f0: 74 68 65 20 72 65 76 69 73 69 6f 6e 20 74 68 65  the revision the
1100: 20 62 72 61 6e 63 68 20 69 73 0a 09 20 20 20 20   branch is..    
1110: 2d 2d 20 72 6f 6f 74 65 64 20 69 6e 2c 20 61 6e  -- rooted in, an
1120: 64 20 69 74 20 69 73 20 6e 6f 74 20 74 68 65 20  d it is not the 
1130: 63 68 69 6c 64 20 6f 66 20 50 2e 20 42 20 61 6e  child of P. B an
1140: 64 20 50 20 72 65 66 65 72 0a 09 20 20 20 20 2d  d P refer..    -
1150: 2d 20 74 6f 20 64 69 66 66 65 72 65 6e 74 20 4c  - to different L
1160: 4f 44 20 73 79 6d 62 6f 6c 73 2e 20 54 68 65 20  OD symbols. The 
1170: 62 70 61 72 65 6e 74 20 6f 66 20 42 20 69 73 20  bparent of B is 
1180: 61 6c 73 6f 20 69 74 73 0a 09 20 20 20 20 2d 2d  also its..    --
1190: 20 4c 4f 44 2c 20 61 6e 64 20 74 68 65 20 4c 4f   LOD, and the LO
11a0: 44 20 6f 66 20 69 74 73 20 63 68 69 6c 64 72 65  D of its childre
11b0: 6e 2e 0a 0a 09 20 20 20 20 62 70 61 72 65 6e 74  n....    bparent
11c0: 20 49 4e 54 45 47 45 52 20 20 20 20 20 20 20 20   INTEGER        
11d0: 20 20 20 20 52 45 46 45 52 45 4e 43 45 53 20 73      REFERENCES s
11e0: 79 6d 62 6f 6c 2c 0a 0a 09 20 20 20 20 2d 2d 20  ymbol,...    -- 
11f0: 4c 61 73 74 6c 79 20 77 65 20 6b 65 65 70 20 69  Lastly we keep i
1200: 6e 66 6f 72 6d 61 74 69 6f 6e 20 69 73 20 61 62  nformation is ab
1210: 6f 75 74 20 6e 6f 6e 2d 74 72 75 6e 6b 20 64 65  out non-trunk de
1220: 66 61 75 6c 74 0a 09 20 20 20 20 2d 2d 20 62 72  fault..    -- br
1230: 61 6e 63 68 65 73 20 28 4e 54 44 42 29 20 69 6e  anches (NTDB) in
1240: 20 74 68 65 20 72 65 76 69 73 69 6f 6e 73 2e 0a   the revisions..
1250: 0a 09 20 20 20 20 2d 2d 20 41 6c 6c 20 72 65 76  ..    -- All rev
1260: 69 73 69 6f 6e 73 20 6f 6e 20 74 68 65 20 4e 54  isions on the NT
1270: 44 42 20 68 61 76 65 20 27 69 73 64 65 66 61 75  DB have 'isdefau
1280: 6c 74 27 20 54 52 55 45 2c 0a 09 20 20 20 20 2d  lt' TRUE,..    -
1290: 2d 20 65 76 65 72 79 6f 6e 65 20 65 6c 73 65 20  - everyone else 
12a0: 46 41 4c 53 45 2e 20 54 68 65 20 6c 61 73 74 20  FALSE. The last 
12b0: 72 65 76 69 73 69 6f 6e 20 58 20 6f 6e 20 74 68  revision X on th
12c0: 65 20 4e 54 44 42 0a 09 20 20 20 20 2d 2d 20 77  e NTDB..    -- w
12d0: 68 69 63 68 20 69 73 20 73 74 69 6c 6c 20 63 6f  hich is still co
12e0: 6e 73 69 64 65 72 65 64 20 74 6f 20 62 65 20 6f  nsidered to be o
12f0: 6e 20 74 68 65 20 74 72 75 6e 6b 20 61 73 20 77  n the trunk as w
1300: 65 6c 6c 0a 09 20 20 20 20 2d 2d 20 68 61 73 20  ell..    -- has 
1310: 61 20 6e 6f 6e 2d 4e 55 4c 4c 20 27 64 62 63 68  a non-NULL 'dbch
1320: 69 6c 64 27 20 77 68 69 63 68 20 72 65 66 65 72  ild' which refer
1330: 73 20 74 6f 20 74 68 65 20 72 6f 6f 74 20 6f 66  s to the root of
1340: 0a 09 20 20 20 20 2d 2d 20 74 68 65 20 74 72 75  ..    -- the tru
1350: 6e 6b 2e 20 54 68 65 20 72 6f 6f 74 20 61 6c 73  nk. The root als
1360: 6f 20 68 61 73 20 61 20 6e 6f 6e 2d 4e 55 4c 4c  o has a non-NULL
1370: 20 64 62 70 61 72 65 6e 74 0a 09 20 20 20 20 2d   dbparent..    -
1380: 2d 20 72 65 66 65 72 69 6e 67 20 74 6f 20 58 2e  - refering to X.
1390: 0a 0a 09 20 20 20 20 69 73 64 65 66 61 75 6c 74  ...    isdefault
13a0: 20 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55   INTEGER  NOT NU
13b0: 4c 4c 2c 0a 09 20 20 20 20 64 62 70 61 72 65 6e  LL,..    dbparen
13c0: 74 20 20 49 4e 54 45 47 45 52 20 20 20 20 20 20  t  INTEGER      
13d0: 20 20 20 20 20 20 52 45 46 45 52 45 4e 43 45 53        REFERENCES
13e0: 20 72 65 76 69 73 69 6f 6e 2c 0a 09 20 20 20 20   revision,..    
13f0: 64 62 63 68 69 6c 64 20 20 20 49 4e 54 45 47 45  dbchild   INTEGE
1400: 52 20 20 20 20 20 20 20 20 20 20 20 20 52 45 46  R            REF
1410: 45 52 45 4e 43 45 53 20 72 65 76 69 73 69 6f 6e  ERENCES revision
1420: 2c 0a 0a 09 20 20 20 20 2d 2d 20 54 68 65 20 6d  ,...    -- The m
1430: 61 69 6e 20 70 61 79 6c 6f 61 64 20 6f 66 20 74  ain payload of t
1440: 68 65 20 72 65 76 69 73 69 6f 6e 20 61 72 65 20  he revision are 
1450: 74 68 65 20 64 61 74 65 2f 74 69 6d 65 20 69 74  the date/time it
1460: 0a 09 20 20 20 20 2d 2d 20 77 61 73 20 65 6e 74  ..    -- was ent
1470: 65 72 65 64 2c 20 69 74 73 20 73 74 61 74 65 2c  ered, its state,
1480: 20 6f 70 65 72 61 74 69 6f 6e 20 28 3d 20 74 79   operation (= ty
1490: 70 65 2f 63 6c 61 73 73 29 2c 20 74 65 78 74 0a  pe/class), text.
14a0: 09 20 20 20 20 2d 2d 20 63 6f 6e 74 65 6e 74 2c  .    -- content,
14b0: 20 61 6e 64 20 6d 65 74 61 20 64 61 74 61 20 28   and meta data (
14c0: 61 75 74 68 6f 72 2c 20 6c 6f 67 20 6d 65 73 73  author, log mess
14d0: 61 67 65 2c 20 62 72 61 6e 63 68 2c 0a 09 20 20  age, branch,..  
14e0: 20 20 2d 2d 20 70 72 6f 6a 65 63 74 29 2e 20 54    -- project). T
14f0: 68 65 20 6c 61 73 74 20 69 73 20 65 6e 63 6f 64  he last is encod
1500: 65 64 20 61 73 20 73 69 6e 67 6c 65 20 69 64 2c  ed as single id,
1510: 20 73 65 65 20 74 61 62 6c 65 0a 09 20 20 20 20   see table..    
1520: 2d 2d 20 27 6d 65 74 61 27 2e 20 54 68 65 20 64  -- 'meta'. The d
1530: 61 74 65 2f 74 69 6d 65 20 69 73 20 67 69 76 65  ate/time is give
1540: 6e 20 69 6e 20 73 65 63 6f 6e 64 73 20 73 69 6e  n in seconds sin
1550: 63 65 20 74 68 65 0a 09 20 20 20 20 2d 2d 20 65  ce the..    -- e
1560: 70 6f 63 68 2c 20 66 6f 72 20 65 61 73 79 20 63  poch, for easy c
1570: 6f 6d 70 61 72 69 73 6f 6e 2e 20 54 68 65 20 74  omparison. The t
1580: 65 78 74 20 63 6f 6e 74 65 6e 74 20 69 73 20 61  ext content is a
1590: 6e 0a 09 20 20 20 20 2d 2d 20 28 6f 66 66 73 65  n..    -- (offse
15a0: 74 2c 6c 65 6e 67 74 68 29 20 70 61 69 72 20 69  t,length) pair i
15b0: 6e 74 6f 20 74 68 65 20 72 63 73 20 61 72 63 68  nto the rcs arch
15c0: 69 76 65 2e 0a 0a 09 20 20 20 20 6f 70 20 20 20  ive....    op   
15d0: 20 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55   INTEGER  NOT NU
15e0: 4c 4c 20 20 52 45 46 45 52 45 4e 43 45 53 20 6f  LL  REFERENCES o
15f0: 70 74 79 70 65 2c 0a 09 20 20 20 20 64 61 74 65  ptype,..    date
1600: 20 20 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e    INTEGER  NOT N
1610: 55 4c 4c 2c 0a 09 20 20 20 20 73 74 61 74 65 20  ULL,..    state 
1620: 54 45 58 54 20 20 20 20 20 4e 4f 54 20 4e 55 4c  TEXT     NOT NUL
1630: 4c 2c 0a 09 20 20 20 20 6d 69 64 20 20 20 49 4e  L,..    mid   IN
1640: 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 20  TEGER  NOT NULL 
1650: 20 52 45 46 45 52 45 4e 43 45 53 20 6d 65 74 61   REFERENCES meta
1660: 2c 0a 09 20 20 20 20 63 6f 66 66 20 20 49 4e 54  ,..    coff  INT
1670: 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 2c 0a  EGER  NOT NULL,.
1680: 09 20 20 20 20 63 6c 65 6e 20 20 49 4e 54 45 47  .    clen  INTEG
1690: 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 2c 0a 0a 09  ER  NOT NULL,...
16a0: 20 20 20 20 55 4e 49 51 55 45 20 28 66 69 64 2c      UNIQUE (fid,
16b0: 20 72 65 76 29 20 2d 2d 20 54 68 65 20 44 54 4e   rev) -- The DTN
16c0: 20 69 73 20 75 6e 69 71 75 65 20 77 69 74 68 69   is unique withi
16d0: 6e 20 74 68 65 20 72 65 76 69 73 69 6f 6e 27 73  n the revision's
16e0: 20 66 69 6c 65 2e 0a 09 7d 0a 09 73 74 61 74 65   file...}..state
16f0: 20 77 72 69 74 69 6e 67 20 6f 70 74 79 70 65 20   writing optype 
1700: 7b 0a 09 20 20 20 20 6f 69 64 20 20 20 49 4e 54  {..    oid   INT
1710: 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 20  EGER  NOT NULL  
1720: 50 52 49 4d 41 52 59 20 4b 45 59 2c 0a 09 20 20  PRIMARY KEY,..  
1730: 20 20 6e 61 6d 65 20 20 54 45 58 54 20 20 20 20    name  TEXT    
1740: 20 4e 4f 54 20 4e 55 4c 4c 2c 0a 09 20 20 20 20   NOT NULL,..    
1750: 55 4e 49 51 55 45 28 6e 61 6d 65 29 0a 09 7d 0a  UNIQUE(name)..}.
1760: 09 73 74 61 74 65 20 72 75 6e 20 7b 0a 09 20 20  .state run {..  
1770: 20 20 49 4e 53 45 52 54 20 49 4e 54 4f 20 6f 70    INSERT INTO op
1780: 74 79 70 65 20 56 41 4c 55 45 53 20 28 2d 31 2c  type VALUES (-1,
1790: 27 64 65 6c 65 74 65 27 29 3b 20 20 2d 2d 20 54  'delete');  -- T
17a0: 68 65 20 6f 70 63 6f 64 65 20 6e 61 6d 65 73 20  he opcode names 
17b0: 61 72 65 20 74 68 65 0a 09 20 20 20 20 49 4e 53  are the..    INS
17c0: 45 52 54 20 49 4e 54 4f 20 6f 70 74 79 70 65 20  ERT INTO optype 
17d0: 56 41 4c 55 45 53 20 28 20 30 2c 27 6e 6f 74 68  VALUES ( 0,'noth
17e0: 69 6e 67 27 29 3b 20 2d 2d 20 66 69 78 65 64 20  ing'); -- fixed 
17f0: 70 69 65 63 65 73 2c 20 73 65 65 20 6d 79 6f 70  pieces, see myop
1800: 73 74 61 74 65 0a 09 20 20 20 20 49 4e 53 45 52  state..    INSER
1810: 54 20 49 4e 54 4f 20 6f 70 74 79 70 65 20 56 41  T INTO optype VA
1820: 4c 55 45 53 20 28 20 31 2c 27 61 64 64 27 29 3b  LUES ( 1,'add');
1830: 20 20 20 20 20 2d 2d 20 69 6e 20 66 69 6c 65 3a       -- in file:
1840: 3a 72 65 76 2e 20 6d 79 6f 70 63 6f 64 65 20 69  :rev. myopcode i
1850: 73 0a 09 20 20 20 20 49 4e 53 45 52 54 20 49 4e  s..    INSERT IN
1860: 54 4f 20 6f 70 74 79 70 65 20 56 41 4c 55 45 53  TO optype VALUES
1870: 20 28 20 32 2c 27 63 68 61 6e 67 65 27 29 3b 20   ( 2,'change'); 
1880: 20 2d 2d 20 6c 6f 61 64 65 64 20 66 72 6f 6d 20   -- loaded from 
1890: 74 68 69 73 2e 0a 09 7d 0a 09 73 74 61 74 65 20  this...}..state 
18a0: 77 72 69 74 69 6e 67 20 74 61 67 20 7b 0a 09 20  writing tag {.. 
18b0: 20 20 20 74 69 64 20 20 49 4e 54 45 47 45 52 20     tid  INTEGER 
18c0: 20 4e 4f 54 20 4e 55 4c 4c 20 20 50 52 49 4d 41   NOT NULL  PRIMA
18d0: 52 59 20 4b 45 59 20 41 55 54 4f 49 4e 43 52 45  RY KEY AUTOINCRE
18e0: 4d 45 4e 54 2c 0a 09 20 20 20 20 66 69 64 20 20  MENT,..    fid  
18f0: 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c  INTEGER  NOT NUL
1900: 4c 20 20 52 45 46 45 52 45 4e 43 45 53 20 66 69  L  REFERENCES fi
1910: 6c 65 2c 20 20 20 20 20 2d 2d 20 46 69 6c 65 20  le,     -- File 
1920: 74 68 65 20 69 74 65 6d 20 62 65 6c 6f 6e 67 73  the item belongs
1930: 20 74 6f 0a 09 20 20 20 20 6c 6f 64 20 20 49 4e   to..    lod  IN
1940: 54 45 47 45 52 20 20 20 20 20 20 20 20 20 20 20  TEGER           
1950: 20 52 45 46 45 52 45 4e 43 45 53 20 73 79 6d 62   REFERENCES symb
1960: 6f 6c 2c 20 20 20 2d 2d 20 4c 69 6e 65 20 6f 66  ol,   -- Line of
1970: 20 64 65 76 65 6c 6f 70 6d 65 6e 74 20 28 4e 55   development (NU
1980: 4c 4c 20 3d 3e 20 54 72 75 6e 6b 29 0a 09 20 20  LL => Trunk)..  
1990: 20 20 73 69 64 20 20 49 4e 54 45 47 45 52 20 20    sid  INTEGER  
19a0: 4e 4f 54 20 4e 55 4c 4c 20 20 52 45 46 45 52 45  NOT NULL  REFERE
19b0: 4e 43 45 53 20 73 79 6d 62 6f 6c 2c 20 20 20 2d  NCES symbol,   -
19c0: 2d 20 53 79 6d 62 6f 6c 20 63 61 70 74 75 72 69  - Symbol capturi
19d0: 6e 67 20 74 68 65 20 74 61 67 0a 0a 09 20 20 20  ng the tag...   
19e0: 20 72 65 76 20 20 49 4e 54 45 47 45 52 20 20 4e   rev  INTEGER  N
19f0: 4f 54 20 4e 55 4c 4c 20 20 52 45 46 45 52 45 4e  OT NULL  REFEREN
1a00: 43 45 53 20 72 65 76 69 73 69 6f 6e 20 20 2d 2d  CES revision  --
1a10: 20 54 68 65 20 72 65 76 69 73 69 6f 6e 20 62 65   The revision be
1a20: 69 6e 67 20 74 61 67 67 65 64 2e 0a 09 7d 0a 0a  ing tagged...}..
1a30: 09 73 74 61 74 65 20 77 72 69 74 69 6e 67 20 62  .state writing b
1a40: 72 61 6e 63 68 20 7b 0a 09 20 20 20 20 62 69 64  ranch {..    bid
1a50: 20 20 20 49 4e 54 45 47 45 52 20 20 4e 4f 54 20     INTEGER  NOT 
1a60: 4e 55 4c 4c 20 20 50 52 49 4d 41 52 59 20 4b 45  NULL  PRIMARY KE
1a70: 59 20 41 55 54 4f 49 4e 43 52 45 4d 45 4e 54 2c  Y AUTOINCREMENT,
1a80: 0a 09 20 20 20 20 66 69 64 20 20 20 49 4e 54 45  ..    fid   INTE
1a90: 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 52  GER  NOT NULL  R
1aa0: 45 46 45 52 45 4e 43 45 53 20 66 69 6c 65 2c 20  EFERENCES file, 
1ab0: 20 20 20 20 2d 2d 20 46 69 6c 65 20 74 68 65 20      -- File the 
1ac0: 69 74 65 6d 20 62 65 6c 6f 6e 67 73 20 74 6f 0a  item belongs to.
1ad0: 09 20 20 20 20 6c 6f 64 20 20 20 49 4e 54 45 47  .    lod   INTEG
1ae0: 45 52 20 20 20 20 20 20 20 20 20 20 20 20 52 45  ER            RE
1af0: 46 45 52 45 4e 43 45 53 20 73 79 6d 62 6f 6c 2c  FERENCES symbol,
1b00: 20 20 20 2d 2d 20 4c 69 6e 65 20 6f 66 20 64 65     -- Line of de
1b10: 76 65 6c 6f 70 6d 65 6e 74 20 28 4e 55 4c 4c 20  velopment (NULL 
1b20: 3d 3e 20 54 72 75 6e 6b 29 0a 09 20 20 20 20 73  => Trunk)..    s
1b30: 69 64 20 20 20 49 4e 54 45 47 45 52 20 20 4e 4f  id   INTEGER  NO
1b40: 54 20 4e 55 4c 4c 20 20 52 45 46 45 52 45 4e 43  T NULL  REFERENC
1b50: 45 53 20 73 79 6d 62 6f 6c 2c 20 20 20 2d 2d 20  ES symbol,   -- 
1b60: 53 79 6d 62 6f 6c 20 63 61 70 74 75 72 69 6e 67  Symbol capturing
1b70: 20 74 68 65 20 62 72 61 6e 63 68 0a 0a 09 20 20   the branch...  
1b80: 20 20 72 6f 6f 74 20 20 49 4e 54 45 47 45 52 20    root  INTEGER 
1b90: 20 4e 4f 54 20 4e 55 4c 4c 20 20 52 45 46 45 52   NOT NULL  REFER
1ba0: 45 4e 43 45 53 20 72 65 76 69 73 69 6f 6e 2c 20  ENCES revision, 
1bb0: 2d 2d 20 52 65 76 69 73 69 6f 6e 20 74 68 65 20  -- Revision the 
1bc0: 62 72 61 6e 63 68 20 73 70 72 6f 75 74 73 20 66  branch sprouts f
1bd0: 72 6f 6d 0a 09 20 20 20 20 66 69 72 73 74 20 49  rom..    first I
1be0: 4e 54 45 47 45 52 20 20 20 20 20 20 20 20 20 20  NTEGER          
1bf0: 20 20 52 45 46 45 52 45 4e 43 45 53 20 72 65 76    REFERENCES rev
1c00: 69 73 69 6f 6e 2c 20 2d 2d 20 46 69 72 73 74 20  ision, -- First 
1c10: 72 65 76 69 73 69 6f 6e 20 63 6f 6d 6d 69 74 74  revision committ
1c20: 65 64 20 74 6f 20 74 68 65 20 62 72 61 6e 63 68  ed to the branch
1c30: 0a 09 20 20 20 20 62 72 61 20 20 20 54 45 58 54  ..    bra   TEXT
1c40: 20 20 20 20 20 4e 4f 54 20 4e 55 4c 4c 2c 20 20       NOT NULL,  
1c50: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
1c60: 20 20 20 20 2d 2d 20 62 72 61 6e 63 68 20 6e 75      -- branch nu
1c70: 6d 62 65 72 0a 09 20 20 20 20 70 6f 73 20 20 20  mber..    pos   
1c80: 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c  INTEGER  NOT NUL
1c90: 4c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20  L               
1ca0: 20 20 20 20 20 20 20 20 2d 2d 20 63 72 65 61 74          -- creat
1cb0: 69 6f 6e 20 6f 72 64 65 72 20 69 6e 20 72 6f 6f  ion order in roo
1cc0: 74 2e 0a 09 7d 0a 0a 09 23 20 50 72 6f 6a 65 63  t...}...# Projec
1cd0: 74 20 6c 65 76 65 6c 20 2e 2e 2e 0a 09 23 09 70  t level .....#.p
1ce0: 4c 69 6e 65 4f 66 44 65 76 65 6c 6f 70 6d 65 6e  LineOfDevelopmen
1cf0: 74 2c 20 70 53 79 6d 62 6f 6c 2c 20 70 42 72 61  t, pSymbol, pBra
1d00: 6e 63 68 2c 20 70 54 61 67 2c 20 70 54 72 75 6e  nch, pTag, pTrun
1d10: 6b 0a 09 23 0a 09 23 09 70 54 72 75 6e 6b 20 20  k..#..#.pTrunk  
1d20: 3c 2d 20 70 4c 69 6e 65 4f 66 44 65 76 65 6c 6f  <- pLineOfDevelo
1d30: 70 6d 65 6e 74 0a 09 23 09 70 42 72 61 6e 63 68  pment..#.pBranch
1d40: 20 3c 2d 20 70 53 79 6d 62 6f 6c 2c 20 70 4c 69   <- pSymbol, pLi
1d50: 6e 65 4f 66 44 65 76 65 6c 6f 70 6d 65 6e 74 0a  neOfDevelopment.
1d60: 09 23 09 70 54 61 67 20 20 20 20 3c 2d 20 70 53  .#.pTag    <- pS
1d70: 79 6d 62 6f 6c 2c 20 70 4c 69 6e 65 4f 66 44 65  ymbol, pLineOfDe
1d80: 76 65 6c 6f 70 6d 65 6e 74 0a 0a 09 73 74 61 74  velopment...stat
1d90: 65 20 77 72 69 74 69 6e 67 20 73 79 6d 62 6f 6c  e writing symbol
1da0: 20 7b 0a 09 20 20 20 20 73 69 64 20 20 49 4e 54   {..    sid  INT
1db0: 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 20  EGER  NOT NULL  
1dc0: 50 52 49 4d 41 52 59 20 4b 45 59 20 41 55 54 4f  PRIMARY KEY AUTO
1dd0: 49 4e 43 52 45 4d 45 4e 54 2c 0a 09 20 20 20 20  INCREMENT,..    
1de0: 70 69 64 20 20 49 4e 54 45 47 45 52 20 20 4e 4f  pid  INTEGER  NO
1df0: 54 20 4e 55 4c 4c 20 20 52 45 46 45 52 45 4e 43  T NULL  REFERENC
1e00: 45 53 20 70 72 6f 6a 65 63 74 2c 20 20 2d 2d 20  ES project,  -- 
1e10: 50 72 6f 6a 65 63 74 20 74 68 65 20 73 79 6d 62  Project the symb
1e20: 6f 6c 20 62 65 6c 6f 6e 67 73 20 74 6f 0a 09 20  ol belongs to.. 
1e30: 20 20 20 6e 61 6d 65 20 54 45 58 54 20 20 20 20     name TEXT    
1e40: 20 4e 4f 54 20 4e 55 4c 4c 2c 0a 09 20 20 20 20   NOT NULL,..    
1e50: 74 79 70 65 20 49 4e 54 45 47 45 52 20 20 4e 4f  type INTEGER  NO
1e60: 54 20 4e 55 4c 4c 20 20 52 45 46 45 52 45 4e 43  T NULL  REFERENC
1e70: 45 53 20 73 79 6d 74 79 70 65 2c 20 20 2d 2d 20  ES symtype,  -- 
1e80: 65 6e 75 6d 20 7b 20 65 78 63 6c 75 64 65 64 20  enum { excluded 
1e90: 3d 20 30 2c 20 74 61 67 2c 20 62 72 61 6e 63 68  = 0, tag, branch
1ea0: 2c 20 75 6e 64 65 66 69 6e 65 64 20 7d 0a 0a 09  , undefined }...
1eb0: 20 20 20 20 74 61 67 5f 63 6f 75 6e 74 20 20 20      tag_count   
1ec0: 20 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55   INTEGER  NOT NU
1ed0: 4c 4c 2c 20 2d 2d 20 48 6f 77 20 6f 66 74 65 6e  LL, -- How often
1ee0: 20 74 68 65 20 73 79 6d 62 6f 6c 20 69 73 20 75   the symbol is u
1ef0: 73 65 64 20 61 73 20 74 61 67 2e 0a 09 20 20 20  sed as tag...   
1f00: 20 62 72 61 6e 63 68 5f 63 6f 75 6e 74 20 49 4e   branch_count IN
1f10: 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 2c  TEGER  NOT NULL,
1f20: 20 2d 2d 20 48 6f 77 20 6f 66 74 65 6e 20 74 68   -- How often th
1f30: 65 20 73 79 6d 62 6f 6c 20 69 73 20 75 73 65 64  e symbol is used
1f40: 20 61 73 20 62 72 61 6e 63 68 0a 09 20 20 20 20   as branch..    
1f50: 63 6f 6d 6d 69 74 5f 63 6f 75 6e 74 20 49 4e 54  commit_count INT
1f60: 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 2c 20  EGER  NOT NULL, 
1f70: 2d 2d 20 48 6f 77 20 6f 66 74 65 6e 20 61 20 66  -- How often a f
1f80: 69 6c 65 20 77 61 73 20 63 6f 6d 6d 69 74 74 65  ile was committe
1f90: 64 20 6f 6e 20 74 68 65 20 73 79 6d 62 6f 6c 0a  d on the symbol.
1fa0: 0a 09 20 20 20 20 55 4e 49 51 55 45 20 28 70 69  ..    UNIQUE (pi
1fb0: 64 2c 20 6e 61 6d 65 29 20 2d 2d 20 53 79 6d 62  d, name) -- Symb
1fc0: 6f 6c 73 20 61 72 65 20 75 6e 69 71 75 65 20 77  ols are unique w
1fd0: 69 74 68 69 6e 20 74 68 65 20 70 72 6f 6a 65 63  ithin the projec
1fe0: 74 0a 09 7d 0a 0a 09 73 74 61 74 65 20 77 72 69  t..}...state wri
1ff0: 74 69 6e 67 20 62 6c 6f 63 6b 65 72 20 7b 0a 09  ting blocker {..
2000: 20 20 20 20 2d 2d 20 46 6f 72 20 65 61 63 68 20      -- For each 
2010: 73 79 6d 62 6f 6c 20 77 65 20 73 61 76 65 20 77  symbol we save w
2020: 68 69 63 68 20 6f 74 68 65 72 20 73 79 6d 62 6f  hich other symbo
2030: 6c 73 20 61 72 65 0a 09 20 20 20 20 2d 2d 20 62  ls are..    -- b
2040: 6c 6f 63 6b 69 6e 67 20 69 74 73 20 72 65 6d 6f  locking its remo
2050: 76 61 6c 20 28 69 66 20 74 68 65 20 75 73 65 72  val (if the user
2060: 20 61 73 6b 73 20 66 6f 72 20 69 74 29 2e 0a 0a   asks for it)...
2070: 09 20 20 20 20 73 69 64 20 49 4e 54 45 47 45 52  .    sid INTEGER
2080: 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 52 45 46 45    NOT NULL  REFE
2090: 52 45 4e 43 45 53 20 73 79 6d 62 6f 6c 2c 20 2d  RENCES symbol, -
20a0: 2d 20 0a 09 20 20 20 20 62 69 64 20 49 4e 54 45  - ..    bid INTE
20b0: 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 52  GER  NOT NULL  R
20c0: 45 46 45 52 45 4e 43 45 53 20 73 79 6d 62 6f 6c  EFERENCES symbol
20d0: 2c 20 2d 2d 20 53 70 72 6f 75 74 65 64 20 66 72  , -- Sprouted fr
20e0: 6f 6d 20 73 69 64 2c 20 62 6c 6f 63 6b 73 20 69  om sid, blocks i
20f0: 74 2e 0a 09 20 20 20 20 55 4e 49 51 55 45 20 28  t...    UNIQUE (
2100: 73 69 64 2c 20 62 69 64 29 0a 09 7d 0a 0a 09 73  sid, bid)..}...s
2110: 74 61 74 65 20 77 72 69 74 69 6e 67 20 70 61 72  tate writing par
2120: 65 6e 74 20 7b 0a 09 20 20 20 20 2d 2d 20 46 6f  ent {..    -- Fo
2130: 72 20 65 61 63 68 20 73 79 6d 62 6f 6c 20 77 65  r each symbol we
2140: 20 73 61 76 65 20 77 68 69 63 68 20 6f 74 68 65   save which othe
2150: 72 20 73 79 6d 62 6f 6c 73 20 63 61 6e 20 61 63  r symbols can ac
2160: 74 20 61 73 0a 09 20 20 20 20 2d 2d 20 61 20 70  t as..    -- a p
2170: 6f 73 73 69 62 6c 65 20 70 61 72 65 6e 74 20 69  ossible parent i
2180: 6e 20 73 6f 6d 65 20 66 69 6c 65 2c 20 61 6e 64  n some file, and
2190: 20 68 6f 77 20 6f 66 74 65 6e 2e 0a 0a 09 20 20   how often....  
21a0: 20 20 73 69 64 20 49 4e 54 45 47 45 52 20 20 4e    sid INTEGER  N
21b0: 4f 54 20 4e 55 4c 4c 20 20 52 45 46 45 52 45 4e  OT NULL  REFEREN
21c0: 43 45 53 20 73 79 6d 62 6f 6c 2c 20 2d 2d 20 0a  CES symbol, -- .
21d0: 09 20 20 20 20 70 69 64 20 49 4e 54 45 47 45 52  .    pid INTEGER
21e0: 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 52 45 46 45    NOT NULL  REFE
21f0: 52 45 4e 43 45 53 20 73 79 6d 62 6f 6c 2c 20 2d  RENCES symbol, -
2200: 2d 20 50 6f 73 73 69 62 6c 65 20 70 61 72 65 6e  - Possible paren
2210: 74 20 6f 66 20 73 69 64 0a 09 20 20 20 20 6e 20  t of sid..    n 
2220: 20 20 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e    INTEGER  NOT N
2230: 55 4c 4c 2c 20 20 20 20 20 20 20 20 20 20 20 20  ULL,            
2240: 20 20 20 20 20 20 20 20 2d 2d 20 48 6f 77 20 6f          -- How o
2250: 66 74 65 6e 20 70 69 64 20 63 61 6e 20 61 63 74  ften pid can act
2260: 20 61 73 20 70 61 72 65 6e 74 2e 0a 09 20 20 20   as parent...   
2270: 20 55 4e 49 51 55 45 20 28 73 69 64 2c 20 70 69   UNIQUE (sid, pi
2280: 64 29 0a 09 7d 0a 0a 09 73 74 61 74 65 20 77 72  d)..}...state wr
2290: 69 74 69 6e 67 20 73 79 6d 74 79 70 65 20 7b 0a  iting symtype {.
22a0: 09 20 20 20 20 74 69 64 20 20 20 20 49 4e 54 45  .    tid    INTE
22b0: 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 50  GER  NOT NULL  P
22c0: 52 49 4d 41 52 59 20 4b 45 59 2c 0a 09 20 20 20  RIMARY KEY,..   
22d0: 20 6e 61 6d 65 20 20 20 54 45 58 54 20 20 20 20   name   TEXT    
22e0: 20 4e 4f 54 20 4e 55 4c 4c 2c 0a 09 20 20 20 20   NOT NULL,..    
22f0: 70 6c 75 72 61 6c 20 54 45 58 54 20 20 20 20 20  plural TEXT     
2300: 4e 4f 54 20 4e 55 4c 4c 2c 0a 09 20 20 20 20 55  NOT NULL,..    U
2310: 4e 49 51 55 45 20 28 6e 61 6d 65 29 0a 09 20 20  NIQUE (name)..  
2320: 20 20 55 4e 49 51 55 45 20 28 70 6c 75 72 61 6c    UNIQUE (plural
2330: 29 0a 09 7d 0a 09 73 74 61 74 65 20 72 75 6e 20  )..}..state run 
2340: 7b 0a 09 20 20 20 20 49 4e 53 45 52 54 20 49 4e  {..    INSERT IN
2350: 54 4f 20 73 79 6d 74 79 70 65 20 56 41 4c 55 45  TO symtype VALUE
2360: 53 20 28 30 2c 27 65 78 63 6c 75 64 65 64 27 2c  S (0,'excluded',
2370: 20 27 65 78 63 6c 75 64 65 64 27 29 3b 0a 09 20   'excluded');.. 
2380: 20 20 20 49 4e 53 45 52 54 20 49 4e 54 4f 20 73     INSERT INTO s
2390: 79 6d 74 79 70 65 20 56 41 4c 55 45 53 20 28 31  ymtype VALUES (1
23a0: 2c 27 74 61 67 27 2c 20 20 20 20 20 20 27 74 61  ,'tag',      'ta
23b0: 67 73 27 29 3b 0a 09 20 20 20 20 49 4e 53 45 52  gs');..    INSER
23c0: 54 20 49 4e 54 4f 20 73 79 6d 74 79 70 65 20 56  T INTO symtype V
23d0: 41 4c 55 45 53 20 28 32 2c 27 62 72 61 6e 63 68  ALUES (2,'branch
23e0: 27 2c 20 20 20 27 62 72 61 6e 63 68 65 73 27 29  ',   'branches')
23f0: 3b 0a 09 20 20 20 20 49 4e 53 45 52 54 20 49 4e  ;..    INSERT IN
2400: 54 4f 20 73 79 6d 74 79 70 65 20 56 41 4c 55 45  TO symtype VALUE
2410: 53 20 28 33 2c 27 75 6e 64 65 66 69 6e 65 64 27  S (3,'undefined'
2420: 2c 27 75 6e 64 65 66 69 6e 65 64 27 29 3b 0a 09  ,'undefined');..
2430: 7d 0a 0a 09 73 74 61 74 65 20 77 72 69 74 69 6e  }...state writin
2440: 67 20 6d 65 74 61 20 7b 0a 09 20 20 20 20 2d 2d  g meta {..    --
2450: 20 4d 65 74 61 20 64 61 74 61 20 6f 66 20 72 65   Meta data of re
2460: 76 69 73 69 6f 6e 73 2e 20 53 65 65 20 72 65 76  visions. See rev
2470: 69 73 69 6f 6e 2e 6d 69 64 20 66 6f 72 20 74 68  ision.mid for th
2480: 65 0a 09 20 20 20 20 2d 2d 20 72 65 66 65 72 65  e..    -- refere
2490: 6e 63 65 2e 20 4d 61 6e 79 20 72 65 76 69 73 69  nce. Many revisi
24a0: 6f 6e 73 20 63 61 6e 20 73 68 61 72 65 20 6d 65  ons can share me
24b0: 74 61 20 64 61 74 61 2e 20 54 68 69 73 20 69 73  ta data. This is
24c0: 0a 09 20 20 20 20 2d 2d 20 61 63 74 75 61 6c 6c  ..    -- actuall
24d0: 79 20 6f 6e 65 20 6f 66 20 74 68 65 20 63 72 69  y one of the cri
24e0: 74 65 72 69 6f 6e 73 20 75 73 65 64 20 74 6f 20  terions used to 
24f0: 73 6f 72 74 20 72 65 76 69 73 69 6f 6e 73 0a 09  sort revisions..
2500: 20 20 20 20 2d 2d 20 69 6e 74 6f 20 63 68 61 6e      -- into chan
2510: 67 65 73 65 74 73 2e 0a 0a 09 20 20 20 20 6d 69  gesets....    mi
2520: 64 20 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e  d INTEGER  NOT N
2530: 55 4c 4c 20 20 50 52 49 4d 41 52 59 20 4b 45 59  ULL  PRIMARY KEY
2540: 20 20 41 55 54 4f 49 4e 43 52 45 4d 45 4e 54 2c    AUTOINCREMENT,
2550: 0a 0a 09 20 20 20 20 2d 2d 20 4d 65 74 61 20 64  ...    -- Meta d
2560: 61 74 61 20 62 65 6c 6f 6e 67 73 20 74 6f 20 61  ata belongs to a
2570: 20 73 70 65 63 69 66 69 63 20 70 72 6f 6a 65 63   specific projec
2580: 74 2c 20 73 74 72 6f 6e 67 65 72 2c 20 74 6f 20  t, stronger, to 
2590: 61 0a 09 20 20 20 20 2d 2d 20 62 72 61 6e 63 68  a..    -- branch
25a0: 20 69 6e 20 74 68 61 74 20 70 72 6f 6a 65 63 74   in that project
25b0: 2e 20 49 74 20 66 75 72 74 68 65 72 20 68 61 73  . It further has
25c0: 20 61 20 6c 6f 67 20 6d 65 73 73 61 67 65 2c 0a   a log message,.
25d0: 09 20 20 20 20 2d 2d 20 61 6e 64 20 69 74 73 20  .    -- and its 
25e0: 61 75 74 68 6f 72 2e 20 54 68 69 73 20 69 73 20  author. This is 
25f0: 75 6e 69 71 75 65 20 77 69 74 68 20 74 68 65 20  unique with the 
2600: 70 72 6f 6a 65 63 74 20 61 6e 64 0a 09 20 20 20  project and..   
2610: 20 2d 2d 20 62 72 61 6e 63 68 2e 0a 0a 09 20 20   -- branch....  
2620: 20 20 70 69 64 20 49 4e 54 45 47 45 52 20 20 4e    pid INTEGER  N
2630: 4f 54 20 4e 55 4c 4c 20 20 52 45 46 45 52 45 4e  OT NULL  REFEREN
2640: 43 45 53 20 70 72 6f 6a 65 63 74 2c 20 20 2d 2d  CES project,  --
2650: 0a 09 20 20 20 20 62 69 64 20 49 4e 54 45 47 45  ..    bid INTEGE
2660: 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 52 45 46  R  NOT NULL  REF
2670: 45 52 45 4e 43 45 53 20 73 79 6d 62 6f 6c 2c 20  ERENCES symbol, 
2680: 20 20 2d 2d 0a 09 20 20 20 20 61 69 64 20 49 4e    --..    aid IN
2690: 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 20  TEGER  NOT NULL 
26a0: 20 52 45 46 45 52 45 4e 43 45 53 20 61 75 74 68   REFERENCES auth
26b0: 6f 72 2c 20 20 20 2d 2d 0a 09 20 20 20 20 63 69  or,   --..    ci
26c0: 64 20 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e  d INTEGER  NOT N
26d0: 55 4c 4c 20 20 52 45 46 45 52 45 4e 43 45 53 20  ULL  REFERENCES 
26e0: 63 6d 65 73 73 61 67 65 2c 20 2d 2d 0a 0a 09 20  cmessage, --... 
26f0: 20 20 20 55 4e 49 51 55 45 20 28 70 69 64 2c 20     UNIQUE (pid, 
2700: 62 69 64 2c 20 61 69 64 2c 20 63 69 64 29 0a 0a  bid, aid, cid)..
2710: 09 20 20 20 20 2d 2d 20 43 6f 6e 73 74 72 61 69  .    -- Constrai
2720: 6e 74 73 3a 20 54 68 65 20 70 72 6f 6a 65 63 74  nts: The project
2730: 20 6f 66 20 74 68 65 20 6d 65 74 61 20 64 61 74   of the meta dat
2740: 61 20 6f 66 20 61 20 72 65 76 69 73 69 6f 6e 0a  a of a revision.
2750: 09 20 20 20 20 2d 2d 20 20 20 20 20 20 20 20 20  .    --         
2760: 20 20 20 20 20 58 20 69 73 20 74 68 65 20 73 61       X is the sa
2770: 6d 65 20 61 73 20 74 68 65 20 70 72 6f 6a 65 63  me as the projec
2780: 74 20 6f 66 20 58 20 69 74 73 65 6c 66 2e 0a 09  t of X itself...
2790: 20 20 20 20 2d 2d 0a 09 20 20 20 20 2d 2d 20 2e      --..    -- .
27a0: 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 20 54 68 65 20  ........... The 
27b0: 62 72 61 6e 63 68 20 6f 66 20 74 68 65 20 6d 65  branch of the me
27c0: 74 61 20 64 61 74 61 20 6f 66 20 61 20 72 65 76  ta data of a rev
27d0: 69 73 69 6f 6e 0a 09 20 20 20 20 2d 2d 20 20 20  ision..    --   
27e0: 20 20 20 20 20 20 20 20 20 20 20 58 20 69 73 20             X is 
27f0: 74 68 65 20 73 61 6d 65 20 61 73 20 74 68 65 20  the same as the 
2800: 6c 69 6e 65 20 6f 66 20 64 65 76 65 6c 6f 70 6d  line of developm
2810: 65 6e 74 0a 09 20 20 20 20 2d 2d 20 20 20 20 20  ent..    --     
2820: 20 20 20 20 20 20 20 20 20 6f 66 20 58 20 69 74           of X it
2830: 73 65 6c 66 2e 0a 09 7d 0a 0a 09 23 20 41 75 74  self...}...# Aut
2840: 68 6f 72 73 20 61 6e 64 20 63 6f 6d 6d 69 74 20  hors and commit 
2850: 6d 65 73 73 61 67 65 73 20 61 72 65 20 66 75 6c  messages are ful
2860: 6c 79 20 67 6c 6f 62 61 6c 2c 20 69 2e 65 2e 20  ly global, i.e. 
2870: 70 65 72 0a 09 23 20 72 65 70 6f 73 69 74 6f 72  per..# repositor
2880: 79 2e 0a 0a 09 73 74 61 74 65 20 77 72 69 74 69  y....state writi
2890: 6e 67 20 61 75 74 68 6f 72 20 7b 0a 09 20 20 20  ng author {..   
28a0: 20 61 69 64 20 20 49 4e 54 45 47 45 52 20 20 4e   aid  INTEGER  N
28b0: 4f 54 20 4e 55 4c 4c 20 20 50 52 49 4d 41 52 59  OT NULL  PRIMARY
28c0: 20 4b 45 59 20 20 41 55 54 4f 49 4e 43 52 45 4d   KEY  AUTOINCREM
28d0: 45 4e 54 2c 0a 09 20 20 20 20 6e 61 6d 65 20 54  ENT,..    name T
28e0: 45 58 54 20 20 20 20 20 4e 4f 54 20 4e 55 4c 4c  EXT     NOT NULL
28f0: 20 20 55 4e 49 51 55 45 0a 09 7d 0a 0a 09 73 74    UNIQUE..}...st
2900: 61 74 65 20 77 72 69 74 69 6e 67 20 63 6d 65 73  ate writing cmes
2910: 73 61 67 65 20 7b 0a 09 20 20 20 20 63 69 64 20  sage {..    cid 
2920: 20 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55   INTEGER  NOT NU
2930: 4c 4c 20 20 50 52 49 4d 41 52 59 20 4b 45 59 20  LL  PRIMARY KEY 
2940: 20 41 55 54 4f 49 4e 43 52 45 4d 45 4e 54 2c 0a   AUTOINCREMENT,.
2950: 09 20 20 20 20 74 65 78 74 20 54 45 58 54 20 20  .    text TEXT  
2960: 20 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 55 4e 49     NOT NULL  UNI
2970: 51 55 45 0a 09 7d 0a 0a 09 70 72 6f 6a 65 63 74  QUE..}...project
2980: 3a 3a 73 79 6d 20 67 65 74 73 79 6d 74 79 70 65  ::sym getsymtype
2990: 73 0a 09 66 69 6c 65 3a 3a 72 65 76 20 20 20 20  s..file::rev    
29a0: 67 65 74 6f 70 63 6f 64 65 73 0a 09 72 65 74 75  getopcodes..retu
29b0: 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 74 79  rn.    }..    ty
29c0: 70 65 6d 65 74 68 6f 64 20 6c 6f 61 64 20 7b 7d  pemethod load {}
29d0: 20 7b 0a 09 73 74 61 74 65 20 72 65 61 64 69 6e   {..state readin
29e0: 67 20 73 79 6d 62 6f 6c 0a 09 73 74 61 74 65 20  g symbol..state 
29f0: 72 65 61 64 69 6e 67 20 73 79 6d 74 79 70 65 0a  reading symtype.
2a00: 09 73 74 61 74 65 20 72 65 61 64 69 6e 67 20 6f  .state reading o
2a10: 70 74 79 70 65 0a 0a 09 70 72 6f 6a 65 63 74 3a  ptype...project:
2a20: 3a 73 79 6d 20 67 65 74 73 79 6d 74 79 70 65 73  :sym getsymtypes
2a30: 0a 09 66 69 6c 65 3a 3a 72 65 76 20 20 20 20 67  ..file::rev    g
2a40: 65 74 6f 70 63 6f 64 65 73 0a 09 72 65 70 6f 73  etopcodes..repos
2a50: 69 74 6f 72 79 20 20 20 6c 6f 61 64 73 79 6d 62  itory   loadsymb
2a60: 6f 6c 73 0a 09 72 65 74 75 72 6e 0a 20 20 20 20  ols..return.    
2a70: 7d 0a 0a 20 20 20 20 74 79 70 65 6d 65 74 68 6f  }..    typemetho
2a80: 64 20 72 75 6e 20 7b 7d 20 7b 0a 09 23 20 50 61  d run {} {..# Pa
2a90: 73 73 20 6d 61 6e 61 67 65 72 20 69 6e 74 65 72  ss manager inter
2aa0: 66 61 63 65 2e 20 45 78 65 63 75 74 65 64 20 74  face. Executed t
2ab0: 6f 20 70 65 72 66 6f 72 6d 20 74 68 65 0a 09 23  o perform the..#
2ac0: 20 66 75 6e 63 74 69 6f 6e 61 6c 69 74 79 20 6f   functionality o
2ad0: 66 20 74 68 65 20 70 61 73 73 2e 0a 0a 09 73 65  f the pass....se
2ae0: 74 20 72 62 61 73 65 20 5b 72 65 70 6f 73 69 74  t rbase [reposit
2af0: 6f 72 79 20 62 61 73 65 3f 5d 0a 09 66 6f 72 65  ory base?]..fore
2b00: 61 63 68 20 70 72 6f 6a 65 63 74 20 5b 72 65 70  ach project [rep
2b10: 6f 73 69 74 6f 72 79 20 70 72 6f 6a 65 63 74 73  ository projects
2b20: 5d 20 7b 0a 09 20 20 20 20 73 65 74 20 62 61 73  ] {..    set bas
2b30: 65 20 5b 66 69 6c 65 20 6a 6f 69 6e 20 24 72 62  e [file join $rb
2b40: 61 73 65 20 5b 24 70 72 6f 6a 65 63 74 20 62 61  ase [$project ba
2b50: 73 65 5d 5d 0a 09 20 20 20 20 6c 6f 67 20 77 72  se]]..    log wr
2b60: 69 74 65 20 31 20 63 6f 6c 6c 72 65 76 20 22 50  ite 1 collrev "P
2b70: 72 6f 63 65 73 73 69 6e 67 20 24 62 61 73 65 22  rocessing $base"
2b80: 0a 0a 09 20 20 20 20 66 6f 72 65 61 63 68 20 66  ...    foreach f
2b90: 69 6c 65 20 5b 24 70 72 6f 6a 65 63 74 20 66 69  ile [$project fi
2ba0: 6c 65 73 5d 20 7b 0a 09 09 73 65 74 20 70 61 74  les] {...set pat
2bb0: 68 20 5b 24 66 69 6c 65 20 70 61 74 68 5d 0a 09  h [$file path]..
2bc0: 09 6c 6f 67 20 77 72 69 74 65 20 32 20 63 6f 6c  .log write 2 col
2bd0: 6c 72 65 76 20 22 50 61 72 73 69 6e 67 20 24 70  lrev "Parsing $p
2be0: 61 74 68 22 0a 09 09 69 66 20 7b 5b 63 61 74 63  ath"...if {[catc
2bf0: 68 20 7b 0a 09 09 20 20 20 20 70 61 72 73 65 72  h {...    parser
2c00: 20 70 72 6f 63 65 73 73 20 5b 66 69 6c 65 20 6a   process [file j
2c10: 6f 69 6e 20 24 62 61 73 65 20 24 70 61 74 68 5d  oin $base $path]
2c20: 20 24 66 69 6c 65 0a 09 09 7d 20 6d 73 67 5d 7d   $file...} msg]}
2c30: 20 7b 0a 09 09 20 20 20 20 67 6c 6f 62 61 6c 20   {...    global 
2c40: 65 72 72 6f 72 43 6f 64 65 0a 09 09 20 20 20 20  errorCode...    
2c50: 69 66 20 7b 24 65 72 72 6f 72 43 6f 64 65 20 65  if {$errorCode e
2c60: 71 20 22 76 63 3a 3a 72 63 73 3a 3a 70 61 72 73  q "vc::rcs::pars
2c70: 65 72 22 7d 20 7b 0a 09 09 09 74 72 6f 75 62 6c  er"} {....troubl
2c80: 65 20 66 61 74 61 6c 20 22 24 70 61 74 68 20 69  e fatal "$path i
2c90: 73 20 6e 6f 74 20 61 20 76 61 6c 69 64 20 52 43  s not a valid RC
2ca0: 53 20 61 72 63 68 69 76 65 20 28 24 6d 73 67 29  S archive ($msg)
2cb0: 22 0a 09 09 20 20 20 20 7d 20 65 6c 73 65 20 7b  "...    } else {
2cc0: 0a 09 09 09 67 6c 6f 62 61 6c 20 65 72 72 6f 72  ....global error
2cd0: 49 6e 66 6f 0a 09 09 09 74 72 6f 75 62 6c 65 20  Info....trouble 
2ce0: 69 6e 74 65 72 6e 61 6c 20 24 65 72 72 6f 72 49  internal $errorI
2cf0: 6e 66 6f 0a 09 09 20 20 20 20 7d 0a 09 09 7d 20  nfo...    }...} 
2d00: 65 6c 73 65 20 7b 0a 09 09 20 20 20 20 23 20 57  else {...    # W
2d10: 65 20 70 65 72 73 69 73 74 20 74 68 65 20 63 6f  e persist the co
2d20: 72 65 20 6f 66 20 74 68 65 20 64 61 74 61 20 63  re of the data c
2d30: 6f 6c 6c 65 63 74 65 64 20 61 62 6f 75 74 0a 09  ollected about..
2d40: 09 20 20 20 20 23 20 65 61 63 68 20 66 69 6c 65  .    # each file
2d50: 20 69 6d 6d 65 64 69 61 74 65 6c 79 20 61 66 74   immediately aft
2d60: 65 72 20 69 74 20 68 61 73 20 62 65 65 6e 20 70  er it has been p
2d70: 61 72 73 65 64 0a 09 09 20 20 20 20 23 20 61 6e  arsed...    # an
2d80: 64 20 77 72 61 6e 67 6c 65 64 20 69 6e 74 6f 20  d wrangled into 
2d90: 73 68 61 70 65 2c 20 61 6e 64 20 74 68 65 6e 20  shape, and then 
2da0: 64 72 6f 70 20 69 74 20 66 72 6f 6d 0a 09 09 20  drop it from... 
2db0: 20 20 20 23 20 6d 65 6d 6f 72 79 2e 20 54 68 69     # memory. Thi
2dc0: 73 20 69 73 20 64 6f 6e 65 20 74 6f 20 6b 65 65  s is done to kee
2dd0: 70 20 74 68 65 20 61 6d 6f 75 6e 74 20 6f 66 0a  p the amount of.
2de0: 09 09 20 20 20 20 23 20 72 65 71 75 69 72 65 64  ..    # required
2df0: 20 6d 65 6d 6f 72 79 20 77 69 74 68 69 6e 20 73   memory within s
2e00: 65 6e 73 69 62 6c 65 20 6c 69 6d 69 74 73 2e 20  ensible limits. 
2e10: 57 69 74 68 6f 75 74 0a 09 09 20 20 20 20 23 20  Without...    # 
2e20: 64 6f 69 6e 67 20 69 74 20 74 68 69 73 20 77 61  doing it this wa
2e30: 79 20 77 65 20 77 6f 75 6c 64 20 65 61 73 69 6c  y we would easil
2e40: 79 20 67 6f 62 62 6c 65 20 75 70 20 31 47 0a 09  y gobble up 1G..
2e50: 09 20 20 20 20 23 20 6f 66 20 52 41 4d 20 6f 72  .    # of RAM or
2e60: 20 6d 6f 72 65 20 77 69 74 68 20 61 6c 6c 20 74   more with all t
2e70: 68 65 20 6f 62 6a 65 63 74 73 20 28 72 65 76 69  he objects (revi
2e80: 73 69 6f 6e 73 0a 09 09 20 20 20 20 23 20 61 6e  sions...    # an
2e90: 64 20 66 69 6c 65 2d 6c 65 76 65 6c 20 73 79 6d  d file-level sym
2ea0: 62 6f 6c 73 29 2e 0a 0a 09 09 20 20 20 20 24 66  bols).....    $f
2eb0: 69 6c 65 20 70 65 72 73 69 73 74 0a 09 09 7d 0a  ile persist...}.
2ec0: 0a 09 09 24 66 69 6c 65 20 64 72 6f 70 0a 09 20  ...$file drop.. 
2ed0: 20 20 20 7d 0a 0a 09 20 20 20 20 24 70 72 6f 6a     }...    $proj
2ee0: 65 63 74 20 70 75 72 67 65 67 68 6f 73 74 73 79  ect purgeghostsy
2ef0: 6d 62 6f 6c 73 0a 09 7d 0a 0a 09 72 65 70 6f 73  mbols..}...repos
2f00: 69 74 6f 72 79 20 70 72 69 6e 74 72 65 76 73 74  itory printrevst
2f10: 61 74 69 73 74 69 63 73 0a 09 72 65 70 6f 73 69  atistics..reposi
2f20: 74 6f 72 79 20 70 65 72 73 69 73 74 72 65 76 0a  tory persistrev.
2f30: 0a 09 50 61 72 61 6e 6f 69 61 0a 09 6c 6f 67 20  ..Paranoia..log 
2f40: 77 72 69 74 65 20 31 20 63 6f 6c 6c 72 65 76 20  write 1 collrev 
2f50: 22 53 63 61 6e 20 63 6f 6d 70 6c 65 74 65 64 22  "Scan completed"
2f60: 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a  ..return.    }..
2f70: 20 20 20 20 74 79 70 65 6d 65 74 68 6f 64 20 64      typemethod d
2f80: 69 73 63 61 72 64 20 7b 7d 20 7b 0a 09 23 20 50  iscard {} {..# P
2f90: 61 73 73 20 6d 61 6e 61 67 65 72 20 69 6e 74 65  ass manager inte
2fa0: 72 66 61 63 65 2e 20 45 78 65 63 75 74 65 64 20  rface. Executed 
2fb0: 66 6f 72 20 61 6c 6c 20 70 61 73 73 65 73 20 61  for all passes a
2fc0: 66 74 65 72 20 74 68 65 0a 09 23 20 72 75 6e 20  fter the..# run 
2fd0: 70 61 73 73 65 73 2c 20 74 6f 20 72 65 6d 6f 76  passes, to remov
2fe0: 65 20 61 6c 6c 20 64 61 74 61 20 6f 66 20 74 68  e all data of th
2ff0: 69 73 20 70 61 73 73 20 66 72 6f 6d 20 74 68 65  is pass from the
3000: 20 73 74 61 74 65 2c 0a 09 23 20 61 73 20 62 65   state,..# as be
3010: 69 6e 67 20 6f 75 74 20 6f 66 20 64 61 74 65 2e  ing out of date.
3020: 0a 0a 09 73 74 61 74 65 20 64 69 73 63 61 72 64  ...state discard
3030: 20 72 65 76 69 73 69 6f 6e 0a 09 73 74 61 74 65   revision..state
3040: 20 64 69 73 63 61 72 64 20 74 61 67 0a 09 73 74   discard tag..st
3050: 61 74 65 20 64 69 73 63 61 72 64 20 62 72 61 6e  ate discard bran
3060: 63 68 0a 09 73 74 61 74 65 20 64 69 73 63 61 72  ch..state discar
3070: 64 20 73 79 6d 62 6f 6c 0a 09 73 74 61 74 65 20  d symbol..state 
3080: 64 69 73 63 61 72 64 20 62 6c 6f 63 6b 65 72 0a  discard blocker.
3090: 09 73 74 61 74 65 20 64 69 73 63 61 72 64 20 70  .state discard p
30a0: 61 72 65 6e 74 0a 09 73 74 61 74 65 20 64 69 73  arent..state dis
30b0: 63 61 72 64 20 73 79 6d 74 79 70 65 0a 09 73 74  card symtype..st
30c0: 61 74 65 20 64 69 73 63 61 72 64 20 6d 65 74 61  ate discard meta
30d0: 0a 09 73 74 61 74 65 20 64 69 73 63 61 72 64 20  ..state discard 
30e0: 61 75 74 68 6f 72 0a 09 73 74 61 74 65 20 64 69  author..state di
30f0: 73 63 61 72 64 20 63 6d 65 73 73 61 67 65 0a 09  scard cmessage..
3100: 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20  return.    }..  
3110: 20 20 70 72 6f 63 20 50 61 72 61 6e 6f 69 61 20    proc Paranoia 
3120: 7b 7d 20 7b 0a 09 23 20 54 68 69 73 20 63 6f 64  {} {..# This cod
3130: 65 20 70 65 72 66 6f 72 6d 73 20 61 20 6e 75 6d  e performs a num
3140: 62 65 72 20 6f 66 20 70 61 72 61 6e 6f 69 64 20  ber of paranoid 
3150: 63 68 65 63 6b 73 20 6f 66 20 74 68 65 0a 09 23  checks of the..#
3160: 20 64 61 74 61 62 61 73 65 2c 20 73 65 61 72 63   database, searc
3170: 68 69 6e 67 20 66 6f 72 20 69 6e 63 6f 6e 73 69  hing for inconsi
3180: 73 74 65 6e 74 20 63 72 6f 73 73 2d 72 65 66 65  stent cross-refe
3190: 72 65 6e 63 65 73 2e 0a 09 6c 6f 67 20 77 72 69  rences...log wri
31a0: 74 65 20 34 20 63 6f 6c 6c 72 65 76 20 7b 43 68  te 4 collrev {Ch
31b0: 65 63 6b 20 64 61 74 61 62 61 73 65 20 63 6f 6e  eck database con
31c0: 73 69 73 74 65 6e 63 79 7d 0a 0a 09 73 65 74 20  sistency}...set 
31d0: 6e 20 30 20 3b 20 23 20 43 6f 75 6e 74 65 72 20  n 0 ; # Counter 
31e0: 66 6f 72 20 74 68 65 20 63 68 65 63 6b 73 20 28  for the checks (
31f0: 77 65 20 70 72 69 6e 74 20 61 6e 20 69 64 20 62  we print an id b
3200: 65 66 6f 72 65 20 74 68 65 0a 09 09 20 20 23 20  efore the...  # 
3210: 6d 61 69 6e 20 6c 61 62 65 6c 29 2e 0a 0a 09 23  main label)....#
3220: 20 46 69 6e 64 20 61 6c 6c 20 72 65 76 69 73 69   Find all revisi
3230: 6f 6e 73 20 77 68 69 63 68 20 64 69 73 61 67 72  ons which disagr
3240: 65 65 20 77 69 74 68 20 74 68 65 69 72 20 6c 69  ee with their li
3250: 6e 65 20 6f 66 0a 09 23 20 64 65 76 65 6c 6f 70  ne of..# develop
3260: 6d 65 6e 74 20 61 62 6f 75 74 20 74 68 65 20 70  ment about the p
3270: 72 6f 6a 65 63 74 20 74 68 65 79 20 61 72 65 20  roject they are 
3280: 6f 77 6e 65 64 20 62 79 2e 0a 09 43 68 65 63 6b  owned by...Check
3290: 20 5c 0a 09 20 20 20 20 7b 52 65 76 69 73 69 6f   \..    {Revisio
32a0: 6e 73 20 61 6e 64 20 74 68 65 69 72 20 4c 4f 44  ns and their LOD
32b0: 73 20 68 61 76 65 20 74 6f 20 62 65 20 69 6e 20  s have to be in 
32c0: 74 68 65 20 73 61 6d 65 20 70 72 6f 6a 65 63 74  the same project
32d0: 7d 20 5c 0a 09 20 20 20 20 7b 64 69 73 61 67 72  } \..    {disagr
32e0: 65 65 73 20 77 69 74 68 20 69 74 73 20 4c 4f 44  ees with its LOD
32f0: 20 61 62 6f 75 74 20 6f 77 6e 69 6e 67 20 70 72   about owning pr
3300: 6f 6a 65 63 74 7d 20 7b 0a 09 09 53 45 4c 45 43  oject} {...SELEC
3310: 54 20 46 2e 6e 61 6d 65 2c 20 52 2e 72 65 76 0a  T F.name, R.rev.
3320: 09 09 46 52 4f 4d 20 72 65 76 69 73 69 6f 6e 20  ..FROM revision 
3330: 52 2c 20 66 69 6c 65 20 46 2c 20 73 79 6d 62 6f  R, file F, symbo
3340: 6c 20 53 0a 09 09 57 48 45 52 45 20 52 2e 66 69  l S...WHERE R.fi
3350: 64 20 3d 20 46 2e 66 69 64 0a 09 09 41 4e 44 20  d = F.fid...AND 
3360: 20 20 52 2e 6c 6f 64 20 3d 20 53 2e 73 69 64 0a    R.lod = S.sid.
3370: 09 09 41 4e 44 20 20 20 46 2e 70 69 64 20 21 3d  ..AND   F.pid !=
3380: 20 53 2e 70 69 64 0a 09 09 3b 0a 09 20 20 20 20   S.pid...;..    
3390: 7d 0a 09 23 20 46 69 6e 64 20 61 6c 6c 20 72 65  }..# Find all re
33a0: 76 69 73 69 6f 6e 73 20 77 68 69 63 68 20 64 69  visions which di
33b0: 73 67 72 65 65 20 77 69 74 68 20 74 68 65 69 72  sgree with their
33c0: 20 6d 65 74 61 20 64 61 74 61 20 61 62 6f 75 74   meta data about
33d0: 0a 09 23 20 74 68 65 20 70 72 6f 6a 65 63 74 20  ..# the project 
33e0: 74 68 65 79 20 61 72 65 20 6f 77 6e 65 64 20 62  they are owned b
33f0: 79 2e 0a 09 43 68 65 63 6b 20 5c 0a 09 20 20 20  y...Check \..   
3400: 20 7b 52 65 76 69 73 69 6f 6e 73 20 61 6e 64 20   {Revisions and 
3410: 74 68 65 69 72 20 6d 65 74 61 20 64 61 74 61 20  their meta data 
3420: 68 61 76 65 20 74 6f 20 62 65 20 69 6e 20 74 68  have to be in th
3430: 65 20 73 61 6d 65 20 70 72 6f 6a 65 63 74 7d 20  e same project} 
3440: 5c 0a 09 20 20 20 20 7b 64 69 73 61 67 72 65 65  \..    {disagree
3450: 73 20 77 69 74 68 20 69 74 73 20 6d 65 74 61 20  s with its meta 
3460: 64 61 74 61 20 61 62 6f 75 74 20 6f 77 6e 69 6e  data about ownin
3470: 67 20 70 72 6f 6a 65 63 74 7d 20 7b 0a 09 09 53  g project} {...S
3480: 45 4c 45 43 54 20 46 2e 6e 61 6d 65 2c 20 52 2e  ELECT F.name, R.
3490: 72 65 76 0a 09 09 46 52 4f 4d 20 72 65 76 69 73  rev...FROM revis
34a0: 69 6f 6e 20 52 2c 20 66 69 6c 65 20 46 2c 20 6d  ion R, file F, m
34b0: 65 74 61 20 4d 0a 09 09 57 48 45 52 45 20 52 2e  eta M...WHERE R.
34c0: 66 69 64 20 3d 20 46 2e 66 69 64 0a 09 09 41 4e  fid = F.fid...AN
34d0: 44 20 20 20 52 2e 6d 69 64 20 3d 20 4d 2e 6d 69  D   R.mid = M.mi
34e0: 64 0a 09 09 41 4e 44 20 20 20 46 2e 70 69 64 20  d...AND   F.pid 
34f0: 21 3d 20 4d 2e 70 69 64 0a 09 09 3b 0a 09 20 20  != M.pid...;..  
3500: 20 20 7d 0a 09 23 20 46 69 6e 64 20 61 6c 6c 20    }..# Find all 
3510: 72 65 76 69 73 69 6f 6e 73 20 77 68 69 63 68 20  revisions which 
3520: 64 69 73 67 72 65 65 20 77 69 74 68 20 74 68 65  disgree with the
3530: 69 72 20 6d 65 74 61 20 64 61 74 61 20 61 62 6f  ir meta data abo
3540: 75 74 0a 09 23 20 74 68 65 20 62 72 61 6e 63 68  ut..# the branch
3550: 2f 6c 69 6e 65 20 6f 66 20 64 65 76 65 6c 6f 70  /line of develop
3560: 6d 65 6e 74 20 74 68 65 79 20 62 65 6c 6f 6e 67  ment they belong
3570: 20 74 6f 2e 0a 09 43 68 65 63 6b 20 5c 0a 09 20   to...Check \.. 
3580: 20 20 20 7b 52 65 76 69 73 69 6f 6e 73 20 61 6e     {Revisions an
3590: 64 20 74 68 65 69 72 20 6d 65 74 61 20 64 61 74  d their meta dat
35a0: 61 20 68 61 76 65 20 74 6f 20 62 65 20 69 6e 20  a have to be in 
35b0: 74 68 65 20 73 61 6d 65 20 4c 4f 44 7d 20 5c 0a  the same LOD} \.
35c0: 09 20 20 20 20 7b 64 69 73 61 67 72 65 65 73 20  .    {disagrees 
35d0: 77 69 74 68 20 69 74 73 20 6d 65 74 61 20 64 61  with its meta da
35e0: 74 61 20 61 62 6f 75 74 20 6f 77 6e 69 6e 67 20  ta about owning 
35f0: 4c 4f 44 7d 20 7b 0a 09 09 53 45 4c 45 43 54 20  LOD} {...SELECT 
3600: 46 2e 6e 61 6d 65 2c 20 52 2e 72 65 76 0a 09 09  F.name, R.rev...
3610: 46 52 4f 4d 20 72 65 76 69 73 69 6f 6e 20 52 2c  FROM revision R,
3620: 20 6d 65 74 61 20 4d 2c 20 66 69 6c 65 20 46 0a   meta M, file F.
3630: 09 09 57 48 45 52 45 20 52 2e 6d 69 64 20 3d 20  ..WHERE R.mid = 
3640: 4d 2e 6d 69 64 0a 09 09 41 4e 44 20 20 20 52 2e  M.mid...AND   R.
3650: 6c 6f 64 20 21 3d 20 4d 2e 62 69 64 0a 09 09 41  lod != M.bid...A
3660: 4e 44 20 20 20 52 2e 66 69 64 20 3d 20 46 2e 66  ND   R.fid = F.f
3670: 69 64 0a 09 09 3b 0a 09 20 20 20 20 7d 0a 09 23  id...;..    }..#
3680: 20 46 69 6e 64 20 61 6c 6c 20 72 65 76 69 73 69   Find all revisi
3690: 6f 6e 73 20 77 69 74 68 20 61 20 70 72 69 6d 61  ons with a prima
36a0: 72 79 20 63 68 69 6c 64 20 77 68 69 63 68 20 64  ry child which d
36b0: 69 73 61 67 72 65 65 73 0a 09 23 20 61 62 6f 75  isagrees..# abou
36c0: 74 20 74 68 65 20 66 69 6c 65 20 74 68 65 79 20  t the file they 
36d0: 62 65 6c 6f 6e 67 20 74 6f 2e 0a 09 43 68 65 63  belong to...Chec
36e0: 6b 20 5c 0a 09 20 20 20 20 7b 52 65 76 69 73 69  k \..    {Revisi
36f0: 6f 6e 73 20 61 6e 64 20 74 68 65 69 72 20 70 72  ons and their pr
3700: 69 6d 61 72 79 20 63 68 69 6c 64 72 65 6e 20 68  imary children h
3710: 61 76 65 20 74 6f 20 62 65 20 69 6e 20 74 68 65  ave to be in the
3720: 20 73 61 6d 65 20 66 69 6c 65 7d 20 5c 0a 09 20   same file} \.. 
3730: 20 20 20 7b 64 69 73 61 67 72 65 65 73 20 77 69     {disagrees wi
3740: 74 68 20 69 74 73 20 70 72 69 6d 61 72 79 20 63  th its primary c
3750: 68 69 6c 64 20 61 62 6f 75 74 20 74 68 65 20 6f  hild about the o
3760: 77 6e 69 6e 67 20 66 69 6c 65 7d 20 7b 0a 09 09  wning file} {...
3770: 53 45 4c 45 43 54 20 46 2e 6e 61 6d 65 2c 20 52  SELECT F.name, R
3780: 2e 72 65 76 0a 09 09 46 52 4f 4d 20 72 65 76 69  .rev...FROM revi
3790: 73 69 6f 6e 20 52 2c 20 72 65 76 69 73 69 6f 6e  sion R, revision
37a0: 20 43 2c 20 66 69 6c 65 20 46 0a 09 09 57 48 45   C, file F...WHE
37b0: 52 45 20 52 2e 66 69 64 20 3d 20 46 2e 66 69 64  RE R.fid = F.fid
37c0: 0a 09 09 41 4e 44 20 20 20 52 2e 63 68 69 6c 64  ...AND   R.child
37d0: 20 49 53 20 4e 4f 54 20 4e 55 4c 4c 0a 09 09 41   IS NOT NULL...A
37e0: 4e 44 20 20 20 52 2e 63 68 69 6c 64 20 3d 20 43  ND   R.child = C
37f0: 2e 72 69 64 0a 09 09 41 4e 44 20 20 20 43 2e 66  .rid...AND   C.f
3800: 69 64 20 21 3d 20 52 2e 66 69 64 0a 09 09 3b 0a  id != R.fid...;.
3810: 09 20 20 20 20 7d 0a 0a 09 23 20 46 69 6e 64 20  .    }...# Find 
3820: 61 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 77 69  all revisions wi
3830: 74 68 20 61 20 62 72 61 6e 63 68 20 70 61 72 65  th a branch pare
3840: 6e 74 20 73 79 6d 62 6f 6c 20 77 68 6f 73 65 20  nt symbol whose 
3850: 70 61 72 65 6e 74 0a 09 23 20 64 69 73 61 67 72  parent..# disagr
3860: 65 65 73 20 61 62 6f 75 74 20 74 68 65 20 66 69  ees about the fi
3870: 6c 65 20 74 68 65 79 20 62 65 6c 6f 6e 67 20 74  le they belong t
3880: 6f 2e 0a 09 43 68 65 63 6b 20 5c 0a 09 20 20 20  o...Check \..   
3890: 20 7b 52 65 76 69 73 69 6f 6e 73 20 61 6e 64 20   {Revisions and 
38a0: 74 68 65 69 72 20 62 72 61 6e 63 68 20 63 68 69  their branch chi
38b0: 6c 64 72 65 6e 20 68 61 76 65 20 74 6f 20 62 65  ldren have to be
38c0: 20 69 6e 20 74 68 65 20 73 61 6d 65 20 66 69 6c   in the same fil
38d0: 65 7d 20 5c 0a 09 20 20 20 20 7b 61 74 20 74 68  e} \..    {at th
38e0: 65 20 62 65 67 69 6e 6e 69 6e 67 20 6f 66 20 69  e beginning of i
38f0: 74 73 20 62 72 61 6e 63 68 20 61 6e 64 20 69 74  ts branch and it
3900: 73 20 70 61 72 65 6e 74 20 64 69 73 61 67 72 65  s parent disagre
3910: 65 20 61 62 6f 75 74 20 74 68 65 20 6f 77 6e 69  e about the owni
3920: 6e 67 20 66 69 6c 65 7d 20 7b 0a 09 09 53 45 4c  ng file} {...SEL
3930: 45 43 54 20 46 2e 6e 61 6d 65 2c 20 52 2e 72 65  ECT F.name, R.re
3940: 76 0a 09 09 46 52 4f 4d 20 72 65 76 69 73 69 6f  v...FROM revisio
3950: 6e 20 52 2c 20 72 65 76 69 73 69 6f 6e 20 50 2c  n R, revision P,
3960: 20 66 69 6c 65 20 46 0a 09 09 57 48 45 52 45 20   file F...WHERE 
3970: 52 2e 66 69 64 20 3d 20 46 2e 66 69 64 0a 09 09  R.fid = F.fid...
3980: 41 4e 44 20 20 20 52 2e 62 70 61 72 65 6e 74 20  AND   R.bparent 
3990: 49 53 20 4e 4f 54 20 4e 55 4c 4c 0a 09 09 41 4e  IS NOT NULL...AN
39a0: 44 20 20 20 52 2e 70 61 72 65 6e 74 20 3d 20 50  D   R.parent = P
39b0: 2e 72 69 64 0a 09 09 41 4e 44 20 20 20 52 2e 66  .rid...AND   R.f
39c0: 69 64 20 21 3d 20 50 2e 66 69 64 0a 09 09 3b 0a  id != P.fid...;.
39d0: 09 20 20 20 20 7d 0a 09 23 20 46 69 6e 64 20 61  .    }..# Find a
39e0: 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 77 69 74  ll revisions wit
39f0: 68 20 61 20 6e 6f 6e 2d 4e 54 44 42 20 63 68 69  h a non-NTDB chi
3a00: 6c 64 20 77 68 69 63 68 20 64 69 73 61 67 72 65  ld which disagre
3a10: 65 73 0a 09 23 20 61 62 6f 75 74 20 74 68 65 20  es..# about the 
3a20: 66 69 6c 65 20 74 68 65 79 20 62 65 6c 6f 6e 67  file they belong
3a30: 20 74 6f 2e 0a 09 43 68 65 63 6b 20 5c 0a 09 20   to...Check \.. 
3a40: 20 20 20 7b 52 65 76 69 73 69 6f 6e 73 20 61 6e     {Revisions an
3a50: 64 20 74 68 65 69 72 20 6e 6f 6e 2d 4e 54 44 42  d their non-NTDB
3a60: 20 63 68 69 6c 64 72 65 6e 20 68 61 76 65 20 74   children have t
3a70: 6f 20 62 65 20 69 6e 20 74 68 65 20 73 61 6d 65  o be in the same
3a80: 20 66 69 6c 65 7d 20 5c 0a 09 20 20 20 20 7b 64   file} \..    {d
3a90: 69 73 61 67 72 65 65 73 20 77 69 74 68 20 69 74  isagrees with it
3aa0: 73 20 6e 6f 6e 2d 4e 54 44 42 20 63 68 69 6c 64  s non-NTDB child
3ab0: 20 61 62 6f 75 74 20 74 68 65 20 6f 77 6e 69 6e   about the ownin
3ac0: 67 20 66 69 6c 65 7d 20 7b 0a 09 09 53 45 4c 45  g file} {...SELE
3ad0: 43 54 20 46 2e 6e 61 6d 65 2c 20 52 2e 72 65 76  CT F.name, R.rev
3ae0: 0a 09 09 46 52 4f 4d 20 72 65 76 69 73 69 6f 6e  ...FROM revision
3af0: 20 52 2c 20 72 65 76 69 73 69 6f 6e 20 43 2c 20   R, revision C, 
3b00: 66 69 6c 65 20 46 0a 09 09 57 48 45 52 45 20 52  file F...WHERE R
3b10: 2e 66 69 64 20 3d 20 46 2e 66 69 64 0a 09 09 41  .fid = F.fid...A
3b20: 4e 44 20 20 20 52 2e 64 62 63 68 69 6c 64 20 49  ND   R.dbchild I
3b30: 53 20 4e 4f 54 20 4e 55 4c 4c 0a 09 09 41 4e 44  S NOT NULL...AND
3b40: 20 20 20 52 2e 64 62 63 68 69 6c 64 20 3d 20 43     R.dbchild = C
3b50: 2e 72 69 64 0a 09 09 41 4e 44 20 20 20 43 2e 66  .rid...AND   C.f
3b60: 69 64 20 21 3d 20 52 2e 66 69 64 0a 09 09 3b 0a  id != R.fid...;.
3b70: 09 20 20 20 20 7d 0a 09 23 20 46 69 6e 64 20 61  .    }..# Find a
3b80: 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 77 68 69  ll revisions whi
3b90: 63 68 20 68 61 76 65 20 61 20 70 72 69 6d 61 72  ch have a primar
3ba0: 79 20 63 68 69 6c 64 2c 20 62 75 74 20 74 68 65  y child, but the
3bb0: 20 63 68 69 6c 64 0a 09 23 20 64 6f 65 73 20 6e   child..# does n
3bc0: 6f 74 20 68 61 76 65 20 74 68 65 6d 20 61 73 20  ot have them as 
3bd0: 70 61 72 65 6e 74 2e 0a 09 43 68 65 63 6b 20 5c  parent...Check \
3be0: 0a 09 20 20 20 20 7b 52 65 76 69 73 69 6f 6e 73  ..    {Revisions
3bf0: 20 68 61 76 65 20 74 6f 20 62 65 20 70 61 72 65   have to be pare
3c00: 6e 74 73 20 6f 66 20 74 68 65 69 72 20 70 72 69  nts of their pri
3c10: 6d 61 72 79 20 63 68 69 6c 64 72 65 6e 7d 20 5c  mary children} \
3c20: 0a 09 20 20 20 20 7b 69 73 20 6e 6f 74 20 74 68  ..    {is not th
3c30: 65 20 70 61 72 65 6e 74 20 6f 66 20 69 74 73 20  e parent of its 
3c40: 70 72 69 6d 61 72 79 20 63 68 69 6c 64 7d 20 7b  primary child} {
3c50: 0a 09 09 53 45 4c 45 43 54 20 46 2e 6e 61 6d 65  ...SELECT F.name
3c60: 2c 20 52 2e 72 65 76 0a 09 09 46 52 4f 4d 20 72  , R.rev...FROM r
3c70: 65 76 69 73 69 6f 6e 20 52 2c 20 72 65 76 69 73  evision R, revis
3c80: 69 6f 6e 20 43 2c 20 66 69 6c 65 20 46 0a 09 09  ion C, file F...
3c90: 57 48 45 52 45 20 52 2e 66 69 64 20 3d 20 46 2e  WHERE R.fid = F.
3ca0: 66 69 64 0a 09 09 41 4e 44 20 20 20 52 2e 63 68  fid...AND   R.ch
3cb0: 69 6c 64 20 49 53 20 4e 4f 54 20 4e 55 4c 4c 0a  ild IS NOT NULL.
3cc0: 09 09 41 4e 44 20 20 20 52 2e 63 68 69 6c 64 20  ..AND   R.child 
3cd0: 3d 20 43 2e 72 69 64 0a 09 09 41 4e 44 20 20 20  = C.rid...AND   
3ce0: 43 2e 70 61 72 65 6e 74 20 21 3d 20 52 2e 72 69  C.parent != R.ri
3cf0: 64 0a 09 09 3b 0a 09 20 20 20 20 7d 0a 09 23 20  d...;..    }..# 
3d00: 46 69 6e 64 20 61 6c 6c 20 72 65 76 69 73 69 6f  Find all revisio
3d10: 6e 73 20 77 68 69 63 68 20 68 61 76 65 20 61 20  ns which have a 
3d20: 70 72 69 6d 72 61 72 79 20 63 68 69 6c 64 2c 20  primrary child, 
3d30: 62 75 74 20 74 68 65 0a 09 23 20 63 68 69 6c 64  but the..# child
3d40: 20 68 61 73 20 61 20 62 72 61 6e 63 68 20 70 61   has a branch pa
3d50: 72 65 6e 74 20 73 79 6d 62 6f 6c 20 6d 61 6b 69  rent symbol maki
3d60: 6e 67 20 74 68 65 6d 20 62 72 61 63 68 20 73 74  ng them brach st
3d70: 61 72 74 65 72 73 2e 0a 09 43 68 65 63 6b 20 5c  arters...Check \
3d80: 0a 09 20 20 20 20 7b 50 72 69 6d 61 72 79 20 63  ..    {Primary c
3d90: 68 69 6c 64 72 65 6e 20 6f 66 20 72 65 76 69 73  hildren of revis
3da0: 69 6f 6e 73 20 6d 75 73 74 20 6e 6f 74 20 73 74  ions must not st
3db0: 61 72 74 20 62 72 61 6e 63 68 65 73 7d 20 5c 0a  art branches} \.
3dc0: 09 20 20 20 20 7b 69 73 20 70 61 72 65 6e 74 20  .    {is parent 
3dd0: 6f 66 20 61 20 70 72 69 6d 61 72 79 20 63 68 69  of a primary chi
3de0: 6c 64 20 77 68 69 63 68 20 69 73 20 74 68 65 20  ld which is the 
3df0: 62 65 67 69 6e 6e 69 6e 67 20 6f 66 20 61 20 62  beginning of a b
3e00: 72 61 6e 63 68 7d 20 7b 0a 09 09 53 45 4c 45 43  ranch} {...SELEC
3e10: 54 20 46 2e 6e 61 6d 65 2c 20 52 2e 72 65 76 0a  T F.name, R.rev.
3e20: 09 09 46 52 4f 4d 20 72 65 76 69 73 69 6f 6e 20  ..FROM revision 
3e30: 52 2c 20 72 65 76 69 73 69 6f 6e 20 43 2c 20 66  R, revision C, f
3e40: 69 6c 65 20 46 0a 09 09 57 48 45 52 45 20 52 2e  ile F...WHERE R.
3e50: 66 69 64 20 3d 20 46 2e 66 69 64 0a 09 09 41 4e  fid = F.fid...AN
3e60: 44 20 20 20 52 2e 63 68 69 6c 64 20 49 53 20 4e  D   R.child IS N
3e70: 4f 54 20 4e 55 4c 4c 0a 09 09 41 4e 44 20 20 20  OT NULL...AND   
3e80: 52 2e 63 68 69 6c 64 20 3d 20 43 2e 72 69 64 0a  R.child = C.rid.
3e90: 09 09 41 4e 44 20 20 20 43 2e 62 70 61 72 65 6e  ..AND   C.bparen
3ea0: 74 20 49 53 20 4e 4f 54 20 4e 55 4c 4c 0a 09 09  t IS NOT NULL...
3eb0: 3b 0a 09 20 20 20 20 7d 0a 09 23 20 46 69 6e 64  ;..    }..# Find
3ec0: 20 61 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 77   all revisions w
3ed0: 69 74 68 6f 75 74 20 62 72 61 6e 63 68 20 70 61  ithout branch pa
3ee0: 72 65 6e 74 20 73 79 6d 62 6f 6c 20 77 68 69 63  rent symbol whic
3ef0: 68 20 68 61 76 65 20 61 0a 09 23 20 70 61 72 65  h have a..# pare
3f00: 6e 74 2c 20 62 75 74 20 74 68 65 20 70 61 72 65  nt, but the pare
3f10: 6e 74 20 64 6f 65 73 20 6e 6f 74 20 68 61 76 65  nt does not have
3f20: 20 74 68 65 6d 20 61 73 20 70 72 69 6d 61 72 79   them as primary
3f30: 20 63 68 69 6c 64 2e 0a 09 43 68 65 63 6b 20 5c   child...Check \
3f40: 0a 09 20 20 20 20 7b 52 65 76 69 73 69 6f 6e 73  ..    {Revisions
3f50: 20 68 61 76 65 20 74 6f 20 62 65 20 70 72 69 6d   have to be prim
3f60: 61 72 79 20 63 68 69 6c 64 72 65 6e 20 6f 66 20  ary children of 
3f70: 74 68 65 69 72 20 70 61 72 65 6e 74 73 2c 20 69  their parents, i
3f80: 66 20 61 6e 79 7d 20 5c 0a 09 20 20 20 20 7b 69  f any} \..    {i
3f90: 73 20 6e 6f 74 20 74 68 65 20 63 68 69 6c 64 20  s not the child 
3fa0: 6f 66 20 69 74 73 20 70 61 72 65 6e 74 7d 20 7b  of its parent} {
3fb0: 0a 09 09 53 45 4c 45 43 54 20 46 2e 6e 61 6d 65  ...SELECT F.name
3fc0: 2c 20 52 2e 72 65 76 0a 09 09 46 52 4f 4d 20 72  , R.rev...FROM r
3fd0: 65 76 69 73 69 6f 6e 20 52 2c 20 72 65 76 69 73  evision R, revis
3fe0: 69 6f 6e 20 50 2c 20 66 69 6c 65 20 46 0a 09 09  ion P, file F...
3ff0: 57 48 45 52 45 20 52 2e 66 69 64 20 3d 20 46 2e  WHERE R.fid = F.
4000: 66 69 64 0a 09 09 41 4e 44 20 20 20 52 2e 62 70  fid...AND   R.bp
4010: 61 72 65 6e 74 20 49 53 20 4e 55 4c 4c 0a 09 09  arent IS NULL...
4020: 41 4e 44 20 20 20 52 2e 70 61 72 65 6e 74 20 49  AND   R.parent I
4030: 53 20 4e 4f 54 20 4e 55 4c 4c 0a 09 09 41 4e 44  S NOT NULL...AND
4040: 20 20 20 52 2e 70 61 72 65 6e 74 20 3d 20 50 2e     R.parent = P.
4050: 72 69 64 0a 09 09 41 4e 44 20 20 20 50 2e 63 68  rid...AND   P.ch
4060: 69 6c 64 20 21 3d 20 52 2e 72 69 64 0a 09 09 3b  ild != R.rid...;
4070: 0a 09 20 20 20 20 7d 0a 09 23 20 46 69 6e 64 20  ..    }..# Find 
4080: 61 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 77 69  all revisions wi
4090: 74 68 20 61 20 62 72 61 6e 63 68 20 70 61 72 65  th a branch pare
40a0: 6e 74 20 73 79 6d 62 6f 6c 20 77 68 69 63 68 20  nt symbol which 
40b0: 64 6f 20 6e 6f 74 0a 09 23 20 68 61 76 65 20 61  do not..# have a
40c0: 20 70 61 72 65 6e 74 2e 0a 09 43 68 65 63 6b 20   parent...Check 
40d0: 5c 0a 09 20 20 20 20 7b 42 72 61 6e 63 68 20 73  \..    {Branch s
40e0: 74 61 72 74 69 6e 67 20 72 65 76 69 73 69 6f 6e  tarting revision
40f0: 73 20 68 61 76 65 20 74 6f 20 68 61 76 65 20 61  s have to have a
4100: 20 70 61 72 65 6e 74 7d 20 5c 0a 09 20 20 20 20   parent} \..    
4110: 7b 61 74 20 74 68 65 20 62 65 67 69 6e 6e 69 6e  {at the beginnin
4120: 67 20 6f 66 20 69 74 73 20 62 72 61 6e 63 68 20  g of its branch 
4130: 68 61 73 20 6e 6f 20 70 61 72 65 6e 74 7d 20 7b  has no parent} {
4140: 0a 09 09 53 45 4c 45 43 54 20 46 2e 6e 61 6d 65  ...SELECT F.name
4150: 2c 20 52 2e 72 65 76 0a 09 09 46 52 4f 4d 20 72  , R.rev...FROM r
4160: 65 76 69 73 69 6f 6e 20 52 2c 20 66 69 6c 65 20  evision R, file 
4170: 46 0a 09 09 57 48 45 52 45 20 52 2e 66 69 64 20  F...WHERE R.fid 
4180: 3d 20 46 2e 66 69 64 0a 09 09 41 4e 44 20 20 20  = F.fid...AND   
4190: 52 2e 62 70 61 72 65 6e 74 20 49 53 20 4e 4f 54  R.bparent IS NOT
41a0: 20 4e 55 4c 4c 0a 09 09 41 4e 44 20 20 20 52 2e   NULL...AND   R.
41b0: 70 61 72 65 6e 74 20 49 53 20 4e 55 4c 4c 0a 09  parent IS NULL..
41c0: 09 3b 0a 09 20 20 20 20 7d 0a 09 23 20 46 69 6e  .;..    }..# Fin
41d0: 64 20 61 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20  d all revisions 
41e0: 77 69 74 68 20 61 20 62 72 61 6e 63 68 20 70 61  with a branch pa
41f0: 72 65 6e 74 20 73 79 6d 62 6f 6c 20 77 68 6f 73  rent symbol whos
4200: 65 20 70 61 72 65 6e 74 0a 09 23 20 68 61 73 20  e parent..# has 
4210: 74 68 65 6d 20 61 73 20 70 72 69 6d 61 72 79 20  them as primary 
4220: 63 68 69 6c 64 2e 0a 09 43 68 65 63 6b 20 5c 0a  child...Check \.
4230: 09 20 20 20 20 7b 42 72 61 6e 63 68 20 73 74 61  .    {Branch sta
4240: 72 74 69 6e 67 20 72 65 76 69 73 69 6f 6e 73 20  rting revisions 
4250: 6d 75 73 74 20 6e 6f 74 20 62 65 20 70 72 69 6d  must not be prim
4260: 61 72 79 20 63 68 69 6c 64 72 65 6e 20 6f 66 20  ary children of 
4270: 74 68 65 69 72 20 70 61 72 65 6e 74 73 7d 20 5c  their parents} \
4280: 0a 09 20 20 20 20 7b 61 74 20 74 68 65 20 62 65  ..    {at the be
4290: 67 69 6e 6e 69 6e 67 20 6f 66 20 69 74 73 20 62  ginning of its b
42a0: 72 61 6e 63 68 20 69 73 20 74 68 65 20 70 72 69  ranch is the pri
42b0: 6d 61 72 79 20 63 68 69 6c 64 20 6f 66 20 69 74  mary child of it
42c0: 73 20 70 61 72 65 6e 74 7d 20 7b 0a 09 09 53 45  s parent} {...SE
42d0: 4c 45 43 54 20 46 2e 6e 61 6d 65 2c 20 52 2e 72  LECT F.name, R.r
42e0: 65 76 0a 09 09 46 52 4f 4d 20 72 65 76 69 73 69  ev...FROM revisi
42f0: 6f 6e 20 52 2c 20 72 65 76 69 73 69 6f 6e 20 50  on R, revision P
4300: 2c 20 66 69 6c 65 20 46 0a 09 09 57 48 45 52 45  , file F...WHERE
4310: 20 52 2e 66 69 64 20 3d 20 46 2e 66 69 64 0a 09   R.fid = F.fid..
4320: 09 41 4e 44 20 20 20 52 2e 62 70 61 72 65 6e 74  .AND   R.bparent
4330: 20 49 53 20 4e 4f 54 20 4e 55 4c 4c 0a 09 09 41   IS NOT NULL...A
4340: 4e 44 20 20 20 52 2e 70 61 72 65 6e 74 20 49 53  ND   R.parent IS
4350: 20 4e 4f 54 20 4e 55 4c 4c 0a 09 09 41 4e 44 20   NOT NULL...AND 
4360: 20 20 52 2e 70 61 72 65 6e 74 20 3d 20 50 2e 72    R.parent = P.r
4370: 69 64 0a 09 09 41 4e 44 20 20 20 50 2e 63 68 69  id...AND   P.chi
4380: 6c 64 20 3d 20 52 2e 72 69 64 0a 09 09 3b 0a 09  ld = R.rid...;..
4390: 20 20 20 20 7d 0a 09 23 20 46 69 6e 64 20 61 6c      }..# Find al
43a0: 6c 20 72 65 76 69 73 69 6f 6e 73 20 77 69 74 68  l revisions with
43b0: 20 61 20 6e 6f 6e 2d 4e 54 44 42 20 63 68 69 6c   a non-NTDB chil
43c0: 64 20 77 68 69 63 68 20 61 72 65 20 6e 6f 74 20  d which are not 
43d0: 6f 6e 0a 09 23 20 74 68 65 20 4e 54 44 42 2e 0a  on..# the NTDB..
43e0: 09 43 68 65 63 6b 20 5c 0a 09 20 20 20 20 7b 4e  .Check \..    {N
43f0: 54 44 42 20 74 6f 20 74 72 75 6e 6b 20 74 72 61  TDB to trunk tra
4400: 6e 73 69 74 69 6f 6e 20 68 61 73 20 74 6f 20 62  nsition has to b
4410: 65 67 69 6e 20 6f 6e 20 4e 54 44 42 7d 20 5c 0a  egin on NTDB} \.
4420: 09 20 20 20 20 7b 68 61 73 20 61 20 6e 6f 6e 2d  .    {has a non-
4430: 4e 54 44 42 20 63 68 69 6c 64 2c 20 79 65 74 20  NTDB child, yet 
4440: 69 73 20 6e 6f 74 20 6f 6e 20 74 68 65 20 4e 54  is not on the NT
4450: 44 42 7d 20 7b 0a 09 09 53 45 4c 45 43 54 20 46  DB} {...SELECT F
4460: 2e 6e 61 6d 65 2c 20 52 2e 72 65 76 0a 09 09 46  .name, R.rev...F
4470: 52 4f 4d 20 72 65 76 69 73 69 6f 6e 20 52 2c 20  ROM revision R, 
4480: 66 69 6c 65 20 46 0a 09 09 57 48 45 52 45 20 52  file F...WHERE R
4490: 2e 66 69 64 20 3d 20 46 2e 66 69 64 0a 09 09 41  .fid = F.fid...A
44a0: 4e 44 20 20 20 52 2e 64 62 63 68 69 6c 64 20 49  ND   R.dbchild I
44b0: 53 20 4e 4f 54 20 4e 55 4c 4c 0a 09 09 41 4e 44  S NOT NULL...AND
44c0: 20 20 20 4e 4f 54 20 52 2e 69 73 64 65 66 61 75     NOT R.isdefau
44d0: 6c 74 0a 09 09 3b 0a 09 20 20 20 20 7d 0a 09 23  lt...;..    }..#
44e0: 20 46 69 6e 64 20 61 6c 6c 20 72 65 76 69 73 69   Find all revisi
44f0: 6f 6e 73 20 77 69 74 68 20 61 20 4e 54 44 42 20  ons with a NTDB 
4500: 70 61 72 65 6e 74 20 77 68 69 63 68 20 61 72 65  parent which are
4510: 20 6f 6e 20 74 68 65 20 4e 54 44 42 2e 0a 09 43   on the NTDB...C
4520: 68 65 63 6b 20 5c 0a 09 20 20 20 20 7b 4e 54 44  heck \..    {NTD
4530: 42 20 74 6f 20 74 72 75 6e 6b 20 74 72 61 6e 73  B to trunk trans
4540: 69 74 69 6f 6e 20 68 61 73 20 74 6f 20 65 6e 64  ition has to end
4550: 20 6f 6e 20 6e 6f 6e 2d 4e 54 44 42 7d 20 5c 0a   on non-NTDB} \.
4560: 09 20 20 20 20 7b 68 61 73 20 61 20 4e 54 44 42  .    {has a NTDB
4570: 20 70 61 72 65 6e 74 2c 20 79 65 74 20 69 73 20   parent, yet is 
4580: 6f 6e 20 74 68 65 20 4e 54 44 42 7d 20 7b 0a 09  on the NTDB} {..
4590: 09 53 45 4c 45 43 54 20 46 2e 6e 61 6d 65 2c 20  .SELECT F.name, 
45a0: 52 2e 72 65 76 0a 09 09 46 52 4f 4d 20 72 65 76  R.rev...FROM rev
45b0: 69 73 69 6f 6e 20 52 2c 20 66 69 6c 65 20 46 0a  ision R, file F.
45c0: 09 09 57 48 45 52 45 20 52 2e 66 69 64 20 3d 20  ..WHERE R.fid = 
45d0: 46 2e 66 69 64 0a 09 09 41 4e 44 20 20 20 52 2e  F.fid...AND   R.
45e0: 64 62 70 61 72 65 6e 74 20 49 53 20 4e 4f 54 20  dbparent IS NOT 
45f0: 4e 55 4c 4c 0a 09 09 41 4e 44 20 20 20 52 2e 69  NULL...AND   R.i
4600: 73 64 65 66 61 75 6c 74 0a 09 09 3b 0a 09 20 20  sdefault...;..  
4610: 20 20 7d 0a 09 23 20 46 69 6e 64 20 61 6c 6c 20    }..# Find all 
4620: 72 65 76 69 73 69 6f 6e 73 20 77 69 74 68 20 61  revisions with a
4630: 20 63 68 69 6c 64 20 77 68 69 63 68 20 64 69 73   child which dis
4640: 61 67 72 65 65 73 20 61 62 6f 75 74 20 74 68 65  agrees about the
4650: 0a 09 23 20 6c 69 6e 65 20 6f 66 20 64 65 76 65  ..# line of deve
4660: 6c 6f 70 6d 65 6e 74 20 74 68 65 79 20 62 65 6c  lopment they bel
4670: 6f 6e 67 20 74 6f 2e 0a 09 43 68 65 63 6b 20 5c  ong to...Check \
4680: 0a 09 20 20 20 20 7b 52 65 76 69 73 69 6f 6e 73  ..    {Revisions
4690: 20 61 6e 64 20 74 68 65 69 72 20 70 72 69 6d 61   and their prima
46a0: 72 79 20 63 68 69 6c 64 72 65 6e 20 68 61 76 65  ry children have
46b0: 20 74 6f 20 62 65 20 69 6e 20 74 68 65 20 73 61   to be in the sa
46c0: 6d 65 20 4c 4f 44 7d 20 5c 0a 09 20 20 20 20 7b  me LOD} \..    {
46d0: 61 6e 64 20 69 74 73 20 70 72 69 6d 61 72 79 20  and its primary 
46e0: 63 68 69 6c 64 20 64 69 73 61 67 72 65 65 20 61  child disagree a
46f0: 62 6f 75 74 20 74 68 65 69 72 20 4c 4f 44 7d 20  bout their LOD} 
4700: 7b 0a 09 09 53 45 4c 45 43 54 20 46 2e 6e 61 6d  {...SELECT F.nam
4710: 65 2c 20 52 2e 72 65 76 0a 09 09 46 52 4f 4d 20  e, R.rev...FROM 
4720: 72 65 76 69 73 69 6f 6e 20 52 2c 20 72 65 76 69  revision R, revi
4730: 73 69 6f 6e 20 43 2c 20 66 69 6c 65 20 46 0a 09  sion C, file F..
4740: 09 57 48 45 52 45 20 52 2e 66 69 64 20 3d 20 46  .WHERE R.fid = F
4750: 2e 66 69 64 0a 09 09 41 4e 44 20 20 20 52 2e 63  .fid...AND   R.c
4760: 68 69 6c 64 20 49 53 20 4e 4f 54 20 4e 55 4c 4c  hild IS NOT NULL
4770: 0a 09 09 41 4e 44 20 20 20 52 2e 63 68 69 6c 64  ...AND   R.child
4780: 20 3d 20 43 2e 72 69 64 0a 09 09 41 4e 44 20 20   = C.rid...AND  
4790: 20 43 2e 6c 6f 64 20 21 3d 20 52 2e 6c 6f 64 0a   C.lod != R.lod.
47a0: 09 09 3b 0a 09 20 20 20 20 7d 0a 09 23 20 46 69  ..;..    }..# Fi
47b0: 6e 64 20 61 6c 6c 20 72 65 76 69 73 69 6f 6e 73  nd all revisions
47c0: 20 77 69 74 68 20 61 20 6e 6f 6e 2d 4e 54 44 42   with a non-NTDB
47d0: 20 63 68 69 6c 64 20 77 68 69 63 68 20 61 67 72   child which agr
47e0: 65 65 73 20 61 62 6f 75 74 0a 09 23 20 74 68 65  ees about..# the
47f0: 20 6c 69 6e 65 20 6f 66 20 64 65 76 65 6c 6f 70   line of develop
4800: 6d 65 6e 74 20 74 68 65 79 20 62 65 6c 6f 6e 67  ment they belong
4810: 20 74 6f 2e 0a 09 43 68 65 63 6b 20 5c 0a 09 20   to...Check \.. 
4820: 20 20 20 7b 4e 54 44 42 20 61 6e 64 20 74 72 75     {NTDB and tru
4830: 6e 6b 20 72 65 76 69 73 69 6f 6e 73 20 68 61 76  nk revisions hav
4840: 65 20 74 6f 20 62 65 20 69 6e 20 64 69 66 66 65  e to be in diffe
4850: 72 65 6e 74 20 4c 4f 44 73 7d 20 5c 0a 09 20 20  rent LODs} \..  
4860: 20 20 7b 6f 6e 20 4e 54 44 42 20 61 6e 64 20 69    {on NTDB and i
4870: 74 73 20 6e 6f 6e 2d 4e 54 44 42 20 63 68 69 6c  ts non-NTDB chil
4880: 64 20 77 72 6f 6e 67 6c 79 20 61 67 72 65 65 20  d wrongly agree 
4890: 61 62 6f 75 74 20 74 68 65 69 72 20 4c 4f 44 7d  about their LOD}
48a0: 20 7b 0a 09 09 53 45 4c 45 43 54 20 46 2e 6e 61   {...SELECT F.na
48b0: 6d 65 2c 20 52 2e 72 65 76 0a 09 09 46 52 4f 4d  me, R.rev...FROM
48c0: 20 72 65 76 69 73 69 6f 6e 20 52 2c 20 72 65 76   revision R, rev
48d0: 69 73 69 6f 6e 20 43 2c 20 66 69 6c 65 20 46 0a  ision C, file F.
48e0: 09 09 57 48 45 52 45 20 52 2e 66 69 64 20 3d 20  ..WHERE R.fid = 
48f0: 46 2e 66 69 64 0a 09 09 41 4e 44 20 20 20 52 2e  F.fid...AND   R.
4900: 64 62 63 68 69 6c 64 20 49 53 20 4e 4f 54 20 4e  dbchild IS NOT N
4910: 55 4c 4c 0a 09 09 41 4e 44 20 20 20 52 2e 64 62  ULL...AND   R.db
4920: 63 68 69 6c 64 20 3d 20 43 2e 72 69 64 0a 09 09  child = C.rid...
4930: 41 4e 44 20 20 20 43 2e 6c 6f 64 20 3d 20 52 2e  AND   C.lod = R.
4940: 6c 6f 64 0a 09 09 3b 0a 09 20 20 20 20 7d 0a 09  lod...;..    }..
4950: 23 20 46 69 6e 64 20 61 6c 6c 20 72 65 76 69 73  # Find all revis
4960: 69 6f 6e 73 20 77 69 74 68 20 61 20 62 72 61 6e  ions with a bran
4970: 63 68 20 70 61 72 65 6e 74 20 73 79 6d 62 6f 6c  ch parent symbol
4980: 20 77 68 69 63 68 20 69 73 20 6e 6f 74 0a 09 23   which is not..#
4990: 20 74 68 65 69 72 20 4c 4f 44 2e 0a 09 43 68 65   their LOD...Che
49a0: 63 6b 20 5c 0a 09 20 20 20 20 7b 42 72 61 6e 63  ck \..    {Branc
49b0: 68 20 73 74 61 72 74 69 6e 67 20 72 65 76 69 73  h starting revis
49c0: 69 6f 6e 73 20 68 61 76 65 20 74 6f 20 68 61 76  ions have to hav
49d0: 65 20 74 68 65 69 72 20 4c 4f 44 20 61 73 20 62  e their LOD as b
49e0: 72 61 6e 63 68 20 70 61 72 65 6e 74 20 73 79 6d  ranch parent sym
49f0: 62 6f 6c 7d 20 5c 0a 09 20 20 20 20 7b 61 74 20  bol} \..    {at 
4a00: 74 68 65 20 62 65 67 69 6e 6e 69 6e 67 20 6f 66  the beginning of
4a10: 20 69 74 73 20 62 72 61 6e 63 68 20 64 6f 65 73   its branch does
4a20: 20 6e 6f 74 20 68 61 76 65 20 74 68 65 20 62 72   not have the br
4a30: 61 6e 63 68 20 73 79 6d 62 6f 6c 20 61 73 20 69  anch symbol as i
4a40: 74 73 20 4c 4f 44 7d 20 7b 0a 09 09 53 45 4c 45  ts LOD} {...SELE
4a50: 43 54 20 46 2e 6e 61 6d 65 2c 20 52 2e 72 65 76  CT F.name, R.rev
4a60: 0a 09 09 46 52 4f 4d 20 72 65 76 69 73 69 6f 6e  ...FROM revision
4a70: 20 52 2c 20 66 69 6c 65 20 46 0a 09 09 57 48 45   R, file F...WHE
4a80: 52 45 20 52 2e 66 69 64 20 3d 20 46 2e 66 69 64  RE R.fid = F.fid
4a90: 0a 09 09 41 4e 44 20 20 20 52 2e 62 70 61 72 65  ...AND   R.bpare
4aa0: 6e 74 20 49 53 20 4e 4f 54 20 4e 55 4c 4c 0a 09  nt IS NOT NULL..
4ab0: 09 41 4e 44 20 20 20 52 2e 6c 6f 64 20 21 3d 20  .AND   R.lod != 
4ac0: 52 2e 62 70 61 72 65 6e 74 0a 09 09 3b 0a 09 20  R.bparent...;.. 
4ad0: 20 20 20 7d 0a 09 23 20 46 69 6e 64 20 61 6c 6c     }..# Find all
4ae0: 20 72 65 76 69 73 69 6f 6e 73 20 77 69 74 68 20   revisions with 
4af0: 61 20 62 72 61 6e 63 68 20 70 61 72 65 6e 74 20  a branch parent 
4b00: 73 79 6d 62 6f 6c 20 77 68 6f 73 65 20 70 61 72  symbol whose par
4b10: 65 6e 74 0a 09 23 20 69 73 20 69 6e 20 74 68 65  ent..# is in the
4b20: 20 73 61 6d 65 20 6c 69 6e 65 20 6f 66 20 64 65   same line of de
4b30: 76 65 6c 6f 70 6d 65 6e 74 2e 0a 09 43 68 65 63  velopment...Chec
4b40: 6b 20 5c 0a 09 20 20 20 20 7b 52 65 76 69 73 69  k \..    {Revisi
4b50: 6f 6e 73 20 61 6e 64 20 74 68 65 69 72 20 62 72  ons and their br
4b60: 61 6e 63 68 20 63 68 69 6c 64 72 65 6e 20 68 61  anch children ha
4b70: 76 65 20 74 6f 20 62 65 20 69 6e 20 64 69 66 66  ve to be in diff
4b80: 65 72 65 6e 74 20 4c 4f 44 73 7d 20 5c 0a 09 20  erent LODs} \.. 
4b90: 20 20 20 7b 61 74 20 74 68 65 20 62 65 67 69 6e     {at the begin
4ba0: 6e 69 6e 67 20 6f 66 20 69 74 73 20 62 72 61 6e  ning of its bran
4bb0: 63 68 20 61 6e 64 20 69 74 73 20 70 61 72 65 6e  ch and its paren
4bc0: 74 20 77 72 6f 6e 67 6c 79 20 61 67 72 65 65 20  t wrongly agree 
4bd0: 61 62 6f 75 74 20 74 68 65 69 72 20 4c 4f 44 7d  about their LOD}
4be0: 20 7b 0a 09 09 53 45 4c 45 43 54 20 46 2e 6e 61   {...SELECT F.na
4bf0: 6d 65 2c 20 52 2e 72 65 76 0a 09 09 46 52 4f 4d  me, R.rev...FROM
4c00: 20 72 65 76 69 73 69 6f 6e 20 52 2c 20 72 65 76   revision R, rev
4c10: 69 73 69 6f 6e 20 50 2c 20 66 69 6c 65 20 46 0a  ision P, file F.
4c20: 09 09 57 48 45 52 45 20 52 2e 66 69 64 20 3d 20  ..WHERE R.fid = 
4c30: 46 2e 66 69 64 0a 09 09 41 4e 44 20 20 20 52 2e  F.fid...AND   R.
4c40: 62 70 61 72 65 6e 74 20 49 53 20 4e 4f 54 20 4e  bparent IS NOT N
4c50: 55 4c 4c 0a 09 09 41 4e 44 20 20 20 52 2e 70 61  ULL...AND   R.pa
4c60: 72 65 6e 74 20 3d 20 50 2e 72 69 64 0a 09 09 41  rent = P.rid...A
4c70: 4e 44 20 20 20 52 2e 6c 6f 64 20 3d 20 50 2e 6c  ND   R.lod = P.l
4c80: 6f 64 0a 09 09 3b 0a 09 20 20 20 20 7d 0a 09 72  od...;..    }..r
4c90: 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20  eturn.    }..   
4ca0: 20 70 72 6f 63 20 43 68 65 63 6b 20 7b 68 65 61   proc Check {hea
4cb0: 64 65 72 20 6c 61 62 65 6c 20 73 71 6c 7d 20 7b  der label sql} {
4cc0: 0a 09 75 70 76 61 72 20 31 20 6e 20 6e 0a 09 73  ..upvar 1 n n..s
4cd0: 65 74 20 6f 6b 20 31 0a 09 66 6f 72 65 61 63 68  et ok 1..foreach
4ce0: 20 7b 66 6e 61 6d 65 20 72 65 76 6e 72 7d 20 5b   {fname revnr} [
4cf0: 73 74 61 74 65 20 72 75 6e 20 24 73 71 6c 5d 20  state run $sql] 
4d00: 7b 0a 09 20 20 20 20 73 65 74 20 6f 6b 20 30 0a  {..    set ok 0.
4d10: 09 20 20 20 20 74 72 6f 75 62 6c 65 20 66 61 74  .    trouble fat
4d20: 61 6c 20 22 24 66 6e 61 6d 65 20 3c 24 72 65 76  al "$fname <$rev
4d30: 6e 72 3e 20 24 6c 61 62 65 6c 22 0a 09 7d 0a 09  nr> $label"..}..
4d40: 6c 6f 67 20 77 72 69 74 65 20 35 20 63 6f 6c 6c  log write 5 coll
4d50: 72 65 76 20 22 5c 5b 5b 66 6f 72 6d 61 74 20 25  rev "\[[format %
4d60: 30 32 64 20 5b 69 6e 63 72 20 6e 5d 5d 5c 5d 20  02d [incr n]]\] 
4d70: 5b 65 78 70 72 20 7b 24 6f 6b 20 3f 20 22 4f 6b  [expr {$ok ? "Ok
4d80: 20 20 20 20 22 20 3a 20 22 46 61 69 6c 65 64 22      " : "Failed"
4d90: 7d 5d 20 2e 2e 2e 20 24 68 65 61 64 65 72 22 0a  }] ... $header".
4da0: 09 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20  .return.    }.. 
4db0: 20 20 20 23 20 23 20 23 23 20 23 23 23 20 23 23     # # ## ### ##
4dc0: 23 23 23 20 23 23 23 23 23 23 23 23 20 23 23 23  ### ######## ###
4dd0: 23 23 23 23 23 23 23 23 23 23 0a 20 20 20 20 23  ##########.    #
4de0: 23 20 49 6e 74 65 72 6e 61 6c 20 6d 65 74 68 6f  # Internal metho
4df0: 64 73 0a 0a 20 20 20 20 23 20 23 20 23 23 20 23  ds..    # # ## #
4e00: 23 23 20 23 23 23 23 23 20 23 23 23 23 23 23 23  ## ##### #######
4e10: 23 20 23 23 23 23 23 23 23 23 23 23 23 23 23 0a  # #############.
4e20: 20 20 20 20 23 23 20 43 6f 6e 66 69 67 75 72 61      ## Configura
4e30: 74 69 6f 6e 0a 0a 20 20 20 20 70 72 61 67 6d 61  tion..    pragma
4e40: 20 2d 68 61 73 69 6e 73 74 61 6e 63 65 73 20 20   -hasinstances  
4e50: 20 6e 6f 20 3b 20 23 20 73 69 6e 67 6c 65 74 6f   no ; # singleto
4e60: 6e 0a 20 20 20 20 70 72 61 67 6d 61 20 2d 68 61  n.    pragma -ha
4e70: 73 74 79 70 65 69 6e 66 6f 20 20 20 20 6e 6f 20  stypeinfo    no 
4e80: 3b 20 23 20 6e 6f 20 69 6e 74 72 6f 73 70 65 63  ; # no introspec
4e90: 74 69 6f 6e 0a 20 20 20 20 70 72 61 67 6d 61 20  tion.    pragma 
4ea0: 2d 68 61 73 74 79 70 65 64 65 73 74 72 6f 79 20  -hastypedestroy 
4eb0: 6e 6f 20 3b 20 23 20 69 6d 6d 6f 72 74 61 6c 0a  no ; # immortal.
4ec0: 0a 20 20 20 20 23 20 23 20 23 23 20 23 23 23 20  .    # # ## ### 
4ed0: 23 23 23 23 23 20 23 23 23 23 23 23 23 23 20 23  ##### ######## #
4ee0: 23 23 23 23 23 23 23 23 23 23 23 23 0a 7d 0a 0a  ############.}..
4ef0: 6e 61 6d 65 73 70 61 63 65 20 65 76 61 6c 20 3a  namespace eval :
4f00: 3a 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70  :vc::fossil::imp
4f10: 6f 72 74 3a 3a 63 76 73 3a 3a 70 61 73 73 20 7b  ort::cvs::pass {
4f20: 0a 20 20 20 20 6e 61 6d 65 73 70 61 63 65 20 65  .    namespace e
4f30: 78 70 6f 72 74 20 63 6f 6c 6c 72 65 76 0a 20 20  xport collrev.  
4f40: 20 20 6e 61 6d 65 73 70 61 63 65 20 65 76 61 6c    namespace eval
4f50: 20 63 6f 6c 6c 72 65 76 20 7b 0a 09 6e 61 6d 65   collrev {..name
4f60: 73 70 61 63 65 20 69 6d 70 6f 72 74 20 3a 3a 76  space import ::v
4f70: 63 3a 3a 72 63 73 3a 3a 70 61 72 73 65 72 0a 09  c::rcs::parser..
4f80: 6e 61 6d 65 73 70 61 63 65 20 69 6d 70 6f 72 74  namespace import
4f90: 20 3a 3a 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69   ::vc::fossil::i
4fa0: 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 72 65 70 6f  mport::cvs::repo
4fb0: 73 69 74 6f 72 79 0a 09 6e 61 6d 65 73 70 61 63  sitory..namespac
4fc0: 65 20 69 6d 70 6f 72 74 20 3a 3a 76 63 3a 3a 66  e import ::vc::f
4fd0: 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63  ossil::import::c
4fe0: 76 73 3a 3a 73 74 61 74 65 0a 09 6e 61 6d 65 73  vs::state..names
4ff0: 70 61 63 65 20 65 76 61 6c 20 70 72 6f 6a 65 63  pace eval projec
5000: 74 20 7b 0a 09 20 20 20 20 6e 61 6d 65 73 70 61  t {..    namespa
5010: 63 65 20 69 6d 70 6f 72 74 20 3a 3a 76 63 3a 3a  ce import ::vc::
5020: 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a  fossil::import::
5030: 63 76 73 3a 3a 70 72 6f 6a 65 63 74 3a 3a 73 79  cvs::project::sy
5040: 6d 0a 09 7d 0a 09 6e 61 6d 65 73 70 61 63 65 20  m..}..namespace 
5050: 65 76 61 6c 20 66 69 6c 65 20 7b 0a 09 20 20 20  eval file {..   
5060: 20 6e 61 6d 65 73 70 61 63 65 20 69 6d 70 6f 72   namespace impor
5070: 74 20 3a 3a 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a  t ::vc::fossil::
5080: 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 66 69 6c  import::cvs::fil
5090: 65 3a 3a 72 65 76 0a 09 7d 0a 09 6e 61 6d 65 73  e::rev..}..names
50a0: 70 61 63 65 20 69 6d 70 6f 72 74 20 3a 3a 76 63  pace import ::vc
50b0: 3a 3a 74 6f 6f 6c 73 3a 3a 74 72 6f 75 62 6c 65  ::tools::trouble
50c0: 0a 09 6e 61 6d 65 73 70 61 63 65 20 69 6d 70 6f  ..namespace impo
50d0: 72 74 20 3a 3a 76 63 3a 3a 74 6f 6f 6c 73 3a 3a  rt ::vc::tools::
50e0: 6c 6f 67 0a 09 6c 6f 67 20 72 65 67 69 73 74 65  log..log registe
50f0: 72 20 63 6f 6c 6c 72 65 76 0a 20 20 20 20 7d 0a  r collrev.    }.
5100: 7d 0a 0a 23 20 23 20 23 23 20 23 23 23 20 23 23  }..# # ## ### ##
5110: 23 23 23 20 23 23 23 23 23 23 23 23 20 23 23 23  ### ######## ###
5120: 23 23 23 23 23 23 23 23 23 23 20 23 23 23 23 23  ########## #####
5130: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23  ################
5140: 0a 23 23 20 52 65 61 64 79 0a 0a 70 61 63 6b 61  .## Ready..packa
5150: 67 65 20 70 72 6f 76 69 64 65 20 76 63 3a 3a 66  ge provide vc::f
5160: 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63  ossil::import::c
5170: 76 73 3a 3a 70 61 73 73 3a 3a 63 6f 6c 6c 72 65  vs::pass::collre
5180: 76 20 31 2e 30 0a 72 65 74 75 72 6e 0a           v 1.0.return.