Hex Artifact Content
Not logged in

Artifact 978a2b3f745713ba7935635b80adbca9175de519:

File tools/cvs2fossil/lib/c2f_pcollrev.tcl part of check-in [131f051880] - Moved the paranoid integrity checks of pass 2 into a separate package for use by other passes, and changed pass 4 to also run these checks, albeit in a (slightly) relaxed form. See the comments at the point of call for the reason. This completes pass 4. by aku on 2007-11-09 06:28:19.

0000: 23 23 20 2d 2a 2d 20 74 63 6c 20 2d 2a 2d 0a 23  ## -*- tcl -*-.#
0010: 20 23 20 23 23 20 23 23 23 20 23 23 23 23 23 20   # ## ### ##### 
0020: 23 23 23 23 23 23 23 23 20 23 23 23 23 23 23 23  ######## #######
0030: 23 23 23 23 23 23 20 23 23 23 23 23 23 23 23 23  ###### #########
0040: 23 23 23 23 23 23 23 23 23 23 23 23 0a 23 23 20  ############.## 
0050: 43 6f 70 79 72 69 67 68 74 20 28 63 29 20 32 30  Copyright (c) 20
0060: 30 37 20 41 6e 64 72 65 61 73 20 4b 75 70 72 69  07 Andreas Kupri
0070: 65 73 2e 0a 23 0a 23 20 54 68 69 73 20 73 6f 66  es..#.# This sof
0080: 74 77 61 72 65 20 69 73 20 6c 69 63 65 6e 73 65  tware is license
0090: 64 20 61 73 20 64 65 73 63 72 69 62 65 64 20 69  d as described i
00a0: 6e 20 74 68 65 20 66 69 6c 65 20 4c 49 43 45 4e  n the file LICEN
00b0: 53 45 2c 20 77 68 69 63 68 0a 23 20 79 6f 75 20  SE, which.# you 
00c0: 73 68 6f 75 6c 64 20 68 61 76 65 20 72 65 63 65  should have rece
00d0: 69 76 65 64 20 61 73 20 70 61 72 74 20 6f 66 20  ived as part of 
00e0: 74 68 69 73 20 64 69 73 74 72 69 62 75 74 69 6f  this distributio
00f0: 6e 2e 0a 23 0a 23 20 54 68 69 73 20 73 6f 66 74  n..#.# This soft
0100: 77 61 72 65 20 63 6f 6e 73 69 73 74 73 20 6f 66  ware consists of
0110: 20 76 6f 6c 75 6e 74 61 72 79 20 63 6f 6e 74 72   voluntary contr
0120: 69 62 75 74 69 6f 6e 73 20 6d 61 64 65 20 62 79  ibutions made by
0130: 20 6d 61 6e 79 0a 23 20 69 6e 64 69 76 69 64 75   many.# individu
0140: 61 6c 73 2e 20 20 46 6f 72 20 65 78 61 63 74 20  als.  For exact 
0150: 63 6f 6e 74 72 69 62 75 74 69 6f 6e 20 68 69 73  contribution his
0160: 74 6f 72 79 2c 20 73 65 65 20 74 68 65 20 72 65  tory, see the re
0170: 76 69 73 69 6f 6e 0a 23 20 68 69 73 74 6f 72 79  vision.# history
0180: 20 61 6e 64 20 6c 6f 67 73 2c 20 61 76 61 69 6c   and logs, avail
0190: 61 62 6c 65 20 61 74 20 68 74 74 70 3a 2f 2f 66  able at http://f
01a0: 6f 73 73 69 6c 2d 73 63 6d 2e 68 77 61 63 69 2e  ossil-scm.hwaci.
01b0: 63 6f 6d 2f 66 6f 73 73 69 6c 0a 23 20 23 20 23  com/fossil.# # #
01c0: 23 20 23 23 23 20 23 23 23 23 23 20 23 23 23 23  # ### ##### ####
01d0: 23 23 23 23 20 23 23 23 23 23 23 23 23 23 23 23  #### ###########
01e0: 23 23 20 23 23 23 23 23 23 23 23 23 23 23 23 23  ## #############
01f0: 23 23 23 23 23 23 23 23 0a 0a 23 23 20 50 61 73  ########..## Pas
0200: 73 20 49 49 2e 20 54 68 69 73 20 70 61 73 73 20  s II. This pass 
0210: 70 61 72 73 65 73 20 74 68 65 20 63 6f 6c 6c 65  parses the colle
0220: 63 74 65 64 20 72 63 73 20 61 72 63 68 69 76 65  cted rcs archive
0230: 73 20 61 6e 64 20 65 78 74 72 61 63 74 73 0a 23  s and extracts.#
0240: 23 20 61 6c 6c 20 74 68 65 20 69 6e 66 6f 72 6d  # all the inform
0250: 61 74 69 6f 6e 20 74 68 65 79 20 63 6f 6e 74 61  ation they conta
0260: 69 6e 20 28 72 65 76 69 73 69 6f 6e 73 2c 20 61  in (revisions, a
0270: 6e 64 20 73 79 6d 62 6f 6c 73 29 2e 0a 0a 23 20  nd symbols)...# 
0280: 23 20 23 23 20 23 23 23 20 23 23 23 23 23 20 23  # ## ### ##### #
0290: 23 23 23 23 23 23 23 20 23 23 23 23 23 23 23 23  ####### ########
02a0: 23 23 23 23 23 20 23 23 23 23 23 23 23 23 23 23  ##### ##########
02b0: 23 23 23 23 23 23 23 23 23 23 23 0a 23 23 20 52  ###########.## R
02c0: 65 71 75 69 72 65 6d 65 6e 74 73 0a 0a 70 61 63  equirements..pac
02d0: 6b 61 67 65 20 72 65 71 75 69 72 65 20 54 63 6c  kage require Tcl
02e0: 20 38 2e 34 20 20 20 20 20 20 20 20 20 20 20 20   8.4            
02f0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
0300: 20 20 20 3b 20 23 20 52 65 71 75 69 72 65 64 20     ; # Required 
0310: 72 75 6e 74 69 6d 65 2e 0a 70 61 63 6b 61 67 65  runtime..package
0320: 20 72 65 71 75 69 72 65 20 73 6e 69 74 20 20 20   require snit   
0330: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
0340: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 3b                 ;
0350: 20 23 20 4f 4f 20 73 79 73 74 65 6d 2e 0a 70 61   # OO system..pa
0360: 63 6b 61 67 65 20 72 65 71 75 69 72 65 20 76 63  ckage require vc
0370: 3a 3a 74 6f 6f 6c 73 3a 3a 74 72 6f 75 62 6c 65  ::tools::trouble
0380: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
0390: 20 20 20 20 3b 20 23 20 45 72 72 6f 72 20 72 65      ; # Error re
03a0: 70 6f 72 74 69 6e 67 2e 0a 70 61 63 6b 61 67 65  porting..package
03b0: 20 72 65 71 75 69 72 65 20 76 63 3a 3a 74 6f 6f   require vc::too
03c0: 6c 73 3a 3a 6c 6f 67 20 20 20 20 20 20 20 20 20  ls::log         
03d0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 3b                 ;
03e0: 20 23 20 55 73 65 72 20 66 65 65 64 62 61 63 6b   # User feedback
03f0: 2e 0a 70 61 63 6b 61 67 65 20 72 65 71 75 69 72  ..package requir
0400: 65 20 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d  e vc::fossil::im
0410: 70 6f 72 74 3a 3a 63 76 73 3a 3a 70 61 73 73 20  port::cvs::pass 
0420: 20 20 20 20 20 20 20 20 3b 20 23 20 50 61 73 73          ; # Pass
0430: 20 6d 61 6e 61 67 65 6d 65 6e 74 2e 0a 70 61 63   management..pac
0440: 6b 61 67 65 20 72 65 71 75 69 72 65 20 76 63 3a  kage require vc:
0450: 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a  :fossil::import:
0460: 3a 63 76 73 3a 3a 72 65 70 6f 73 69 74 6f 72 79  :cvs::repository
0470: 20 20 20 3b 20 23 20 52 65 70 6f 73 69 74 6f 72     ; # Repositor
0480: 79 20 6d 61 6e 61 67 65 6d 65 6e 74 2e 0a 70 61  y management..pa
0490: 63 6b 61 67 65 20 72 65 71 75 69 72 65 20 76 63  ckage require vc
04a0: 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 74  ::fossil::import
04b0: 3a 3a 63 76 73 3a 3a 73 74 61 74 65 20 20 20 20  ::cvs::state    
04c0: 20 20 20 20 3b 20 23 20 53 74 61 74 65 20 73 74      ; # State st
04d0: 6f 72 61 67 65 2e 0a 70 61 63 6b 61 67 65 20 72  orage..package r
04e0: 65 71 75 69 72 65 20 76 63 3a 3a 66 6f 73 73 69  equire vc::fossi
04f0: 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a  l::import::cvs::
0500: 69 6e 74 65 67 72 69 74 79 20 20 20 20 3b 20 23  integrity    ; #
0510: 20 53 74 61 74 65 20 69 6e 74 65 67 72 69 74 79   State integrity
0520: 20 63 68 65 63 6b 73 2e 0a 70 61 63 6b 61 67 65   checks..package
0530: 20 72 65 71 75 69 72 65 20 76 63 3a 3a 66 6f 73   require vc::fos
0540: 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73  sil::import::cvs
0550: 3a 3a 70 72 6f 6a 65 63 74 3a 3a 73 79 6d 20 3b  ::project::sym ;
0560: 20 23 20 50 72 6f 6a 65 63 74 20 6c 65 76 65 6c   # Project level
0570: 20 73 79 6d 62 6f 6c 73 2e 0a 70 61 63 6b 61 67   symbols..packag
0580: 65 20 72 65 71 75 69 72 65 20 76 63 3a 3a 66 6f  e require vc::fo
0590: 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76  ssil::import::cv
05a0: 73 3a 3a 66 69 6c 65 3a 3a 72 65 76 20 20 20 20  s::file::rev    
05b0: 3b 20 23 20 46 69 6c 65 20 6c 65 76 65 6c 20 72  ; # File level r
05c0: 65 76 69 73 69 6f 6e 73 2e 0a 70 61 63 6b 61 67  evisions..packag
05d0: 65 20 72 65 71 75 69 72 65 20 76 63 3a 3a 72 63  e require vc::rc
05e0: 73 3a 3a 70 61 72 73 65 72 20 20 20 20 20 20 20  s::parser       
05f0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
0600: 3b 20 23 20 52 63 73 20 61 72 63 68 69 76 65 20  ; # Rcs archive 
0610: 64 61 74 61 20 65 78 74 72 61 63 74 69 6f 6e 2e  data extraction.
0620: 0a 0a 23 20 23 20 23 23 20 23 23 23 20 23 23 23  ..# # ## ### ###
0630: 23 23 20 23 23 23 23 23 23 23 23 20 23 23 23 23  ## ######## ####
0640: 23 23 23 23 23 23 23 23 23 20 23 23 23 23 23 23  ######### ######
0650: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 0a  ###############.
0660: 23 23 20 52 65 67 69 73 74 65 72 20 74 68 65 20  ## Register the 
0670: 70 61 73 73 20 77 69 74 68 20 74 68 65 20 6d 61  pass with the ma
0680: 6e 61 67 65 6d 65 6e 74 0a 0a 76 63 3a 3a 66 6f  nagement..vc::fo
0690: 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76  ssil::import::cv
06a0: 73 3a 3a 70 61 73 73 20 64 65 66 69 6e 65 20 5c  s::pass define \
06b0: 0a 20 20 20 20 43 6f 6c 6c 65 63 74 52 65 76 20  .    CollectRev 
06c0: 5c 0a 20 20 20 20 7b 43 6f 6c 6c 65 63 74 20 72  \.    {Collect r
06d0: 65 76 69 73 69 6f 6e 73 20 61 6e 64 20 73 79 6d  evisions and sym
06e0: 62 6f 6c 73 7d 20 5c 0a 20 20 20 20 3a 3a 76 63  bols} \.    ::vc
06f0: 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 74  ::fossil::import
0700: 3a 3a 63 76 73 3a 3a 70 61 73 73 3a 3a 63 6f 6c  ::cvs::pass::col
0710: 6c 72 65 76 0a 0a 23 20 23 20 23 23 20 23 23 23  lrev..# # ## ###
0720: 20 23 23 23 23 23 20 23 23 23 23 23 23 23 23 20   ##### ######## 
0730: 23 23 23 23 23 23 23 23 23 23 23 23 23 20 23 23  ############# ##
0740: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23  ################
0750: 23 23 23 0a 23 23 20 0a 0a 73 6e 69 74 3a 3a 74  ###.## ..snit::t
0760: 79 70 65 20 3a 3a 76 63 3a 3a 66 6f 73 73 69 6c  ype ::vc::fossil
0770: 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 70  ::import::cvs::p
0780: 61 73 73 3a 3a 63 6f 6c 6c 72 65 76 20 7b 0a 20  ass::collrev {. 
0790: 20 20 20 23 20 23 20 23 23 20 23 23 23 20 23 23     # # ## ### ##
07a0: 23 23 23 20 23 23 23 23 23 23 23 23 20 23 23 23  ### ######## ###
07b0: 23 23 23 23 23 23 23 23 23 23 0a 20 20 20 20 23  ##########.    #
07c0: 23 20 50 75 62 6c 69 63 20 41 50 49 0a 0a 20 20  # Public API..  
07d0: 20 20 74 79 70 65 6d 65 74 68 6f 64 20 73 65 74    typemethod set
07e0: 75 70 20 7b 7d 20 7b 0a 09 23 20 44 65 66 69 6e  up {} {..# Defin
07f0: 65 20 6e 61 6d 65 73 20 61 6e 64 20 73 74 72 75  e names and stru
0800: 63 74 75 72 65 20 6f 66 20 74 68 65 20 70 65 72  cture of the per
0810: 73 69 73 74 65 6e 74 20 73 74 61 74 65 20 6f 66  sistent state of
0820: 20 74 68 69 73 0a 09 23 20 70 61 73 73 2e 0a 0a   this..# pass...
0830: 09 73 74 61 74 65 20 72 65 61 64 69 6e 67 20 70  .state reading p
0840: 72 6f 6a 65 63 74 0a 09 73 74 61 74 65 20 72 65  roject..state re
0850: 61 64 69 6e 67 20 66 69 6c 65 0a 0a 09 23 20 57  ading file...# W
0860: 65 20 64 65 61 6c 20 77 69 74 68 20 70 65 72 20  e deal with per 
0870: 70 72 6f 6a 65 63 74 20 61 6e 64 20 70 65 72 20  project and per 
0880: 66 69 6c 65 20 64 61 74 61 2c 20 74 68 65 20 66  file data, the f
0890: 69 72 73 74 0a 09 23 20 63 6f 6c 6c 61 74 65 64  irst..# collated
08a0: 20 66 72 6f 6d 20 74 68 65 20 73 65 63 6f 6e 64   from the second
08b0: 2e 0a 0a 09 23 20 50 65 72 20 66 69 6c 65 20 77  ....# Per file w
08c0: 65 20 68 61 76 65 20 67 65 6e 65 72 61 6c 20 69  e have general i
08d0: 6e 66 6f 72 6d 61 74 69 6f 6e 2c 20 2e 2e 2e 2c  nformation, ...,
08e0: 20 61 6e 64 20 74 68 65 6e 0a 09 23 20 72 65 76   and then..# rev
08f0: 69 73 69 6f 6e 73 20 61 6e 64 20 73 79 6d 62 6f  isions and symbo
0900: 6c 73 2e 20 54 68 65 20 6c 61 74 74 65 72 20 63  ls. The latter c
0910: 61 6e 20 62 65 20 66 75 72 74 68 65 72 20 73 65  an be further se
0920: 70 61 72 61 74 65 64 0a 09 23 20 69 6e 74 6f 20  parated..# into 
0930: 74 61 67 73 20 61 6e 64 20 62 72 61 6e 63 68 65  tags and branche
0940: 73 2e 20 41 74 20 70 72 6f 6a 65 63 74 20 6c 65  s. At project le
0950: 76 65 6c 20 74 68 65 20 70 65 72 2d 66 69 6c 65  vel the per-file
0960: 0a 09 23 20 73 79 6d 62 6f 6c 73 20 69 6e 66 6f  ..# symbols info
0970: 72 6d 61 74 69 6f 6e 20 69 73 20 6d 65 72 67 65  rmation is merge
0980: 64 2e 0a 0a 09 23 20 46 69 6c 65 20 6c 65 76 65  d....# File leve
0990: 6c 20 2e 2e 2e 0a 09 23 09 52 65 76 69 73 69 6f  l .....#.Revisio
09a0: 6e 73 2c 20 42 72 61 6e 63 68 65 73 2c 20 54 61  ns, Branches, Ta
09b0: 67 73 0a 09 23 0a 09 23 20 50 73 65 75 64 6f 20  gs..#..# Pseudo 
09c0: 63 6c 61 73 73 20 68 69 65 72 61 72 63 68 79 0a  class hierarchy.
09d0: 09 23 09 54 61 67 20 20 20 20 20 20 3c 2d 20 53  .#.Tag      <- S
09e0: 79 6d 62 6f 6c 20 3c 2d 20 45 76 65 6e 74 0a 09  ymbol <- Event..
09f0: 23 09 42 72 61 6e 63 68 20 20 20 3c 2d 20 53 79  #.Branch   <- Sy
0a00: 6d 62 6f 6c 20 3c 2d 20 45 76 65 6e 74 0a 09 23  mbol <- Event..#
0a10: 09 52 65 76 69 73 69 6f 6e 20 20 20 20 20 20 20  .Revision       
0a20: 20 20 20 20 3c 2d 20 45 76 65 6e 74 0a 0a 09 73      <- Event...s
0a30: 74 61 74 65 20 77 72 69 74 69 6e 67 20 72 65 76  tate writing rev
0a40: 69 73 69 6f 6e 20 7b 0a 09 20 20 20 20 2d 2d 20  ision {..    -- 
0a50: 52 65 76 69 73 69 6f 6e 73 2e 20 49 64 65 6e 74  Revisions. Ident
0a60: 69 66 69 65 64 20 62 79 20 61 20 67 6c 6f 62 61  ified by a globa
0a70: 6c 20 6e 75 6d 65 72 69 63 20 69 64 20 65 61 63  l numeric id eac
0a80: 68 0a 09 20 20 20 20 2d 2d 20 62 65 6c 6f 6e 67  h..    -- belong
0a90: 73 20 74 6f 20 61 20 73 69 6e 67 6c 65 20 66 69  s to a single fi
0aa0: 6c 65 2c 20 69 64 65 6e 74 69 66 69 65 64 20 62  le, identified b
0ab0: 79 20 69 74 73 20 69 64 2e 20 49 74 0a 09 20 20  y its id. It..  
0ac0: 20 20 2d 2d 20 66 75 72 74 68 65 72 20 68 61 73    -- further has
0ad0: 20 61 20 64 6f 74 74 65 64 20 72 65 76 69 73 69   a dotted revisi
0ae0: 6f 6e 20 6e 75 6d 62 65 72 20 28 44 54 4e 29 2e  on number (DTN).
0af0: 0a 09 20 20 20 20 2d 2d 0a 09 20 20 20 20 2d 2d  ..    --..    --
0b00: 20 43 6f 6e 73 74 72 61 69 6e 74 3a 20 54 68 65   Constraint: The
0b10: 20 64 6f 74 74 65 64 20 72 65 76 69 73 69 6f 6e   dotted revision
0b20: 20 6e 75 6d 62 65 72 20 69 73 20 75 6e 69 71 75   number is uniqu
0b30: 65 20 77 69 74 68 69 6e 0a 20 20 20 20 20 20 20  e within.       
0b40: 20 20 20 20 20 2d 2d 20 20 20 20 20 20 20 20 20       --         
0b50: 20 20 20 20 74 68 65 20 66 69 6c 65 2e 20 53 65      the file. Se
0b60: 65 20 65 6e 64 20 6f 66 20 64 65 66 69 6e 69 74  e end of definit
0b70: 69 6f 6e 2e 0a 0a 09 20 20 20 20 72 69 64 20 20  ion....    rid  
0b80: 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c  INTEGER  NOT NUL
0b90: 4c 20 20 50 52 49 4d 41 52 59 20 4b 45 59 20 41  L  PRIMARY KEY A
0ba0: 55 54 4f 49 4e 43 52 45 4d 45 4e 54 2c 0a 09 20  UTOINCREMENT,.. 
0bb0: 20 20 20 66 69 64 20 20 49 4e 54 45 47 45 52 20     fid  INTEGER 
0bc0: 20 4e 4f 54 20 4e 55 4c 4c 20 20 52 45 46 45 52   NOT NULL  REFER
0bd0: 45 4e 43 45 53 20 66 69 6c 65 2c 20 20 20 2d 2d  ENCES file,   --
0be0: 20 46 69 6c 65 20 6f 77 6e 69 6e 67 20 72 65 76   File owning rev
0bf0: 69 73 69 6f 6e 2e 0a 09 20 20 20 20 72 65 76 20  ision...    rev 
0c00: 20 54 45 58 54 20 20 20 20 20 4e 4f 54 20 4e 55   TEXT     NOT NU
0c10: 4c 4c 2c 20 20 20 20 20 20 20 20 20 20 20 20 20  LL,             
0c20: 20 20 20 20 20 20 20 2d 2d 20 44 6f 74 74 65 64         -- Dotted
0c30: 20 52 65 76 20 4e 75 6d 62 65 72 2e 0a 0a 09 20   Rev Number.... 
0c40: 20 20 20 2d 2d 20 41 6c 6c 20 72 65 76 69 73 69     -- All revisi
0c50: 6f 6e 73 20 62 65 6c 6f 6e 67 20 74 6f 20 61 20  ons belong to a 
0c60: 6c 69 6e 65 2d 6f 66 2d 64 65 76 65 6c 6f 70 6d  line-of-developm
0c70: 65 6e 74 2c 0a 09 20 20 20 20 2d 2d 20 69 64 65  ent,..    -- ide
0c80: 6e 74 69 66 69 65 64 20 62 79 20 61 20 73 79 6d  ntified by a sym
0c90: 62 6f 6c 20 28 70 72 6f 6a 65 63 74 20 6c 65 76  bol (project lev
0ca0: 65 6c 29 2e 20 44 75 72 69 6e 67 20 64 61 74 61  el). During data
0cb0: 0a 09 20 20 20 20 2d 2d 20 63 6f 6c 6c 65 63 74  ..    -- collect
0cc0: 69 6f 6e 20 69 74 20 77 61 73 20 61 20 66 69 6c  ion it was a fil
0cd0: 65 2d 6c 65 76 65 6c 20 62 72 61 6e 63 68 20 73  e-level branch s
0ce0: 79 6d 62 6f 6c 2e 0a 09 20 20 20 20 2d 2d 0a 09  ymbol...    --..
0cf0: 20 20 20 20 2d 2d 20 43 6f 6e 73 74 72 61 69 6e      -- Constrain
0d00: 74 3a 20 41 6c 6c 20 74 68 65 20 4c 4f 44 20 73  t: All the LOD s
0d10: 79 6d 62 6f 6c 73 20 61 72 65 20 69 6e 20 74 68  ymbols are in th
0d20: 65 20 73 61 6d 65 20 70 72 6f 6a 65 63 74 0a 09  e same project..
0d30: 20 20 20 20 2d 2d 20 20 20 20 20 20 20 20 20 20      --          
0d40: 20 20 20 61 73 20 74 68 65 20 66 69 6c 65 20 69     as the file i
0d50: 74 73 65 6c 66 2e 20 54 68 69 73 20 63 61 6e 6e  tself. This cann
0d60: 6f 74 20 62 65 0a 09 20 20 20 20 2d 2d 20 20 20  ot be..    --   
0d70: 20 20 20 20 20 20 20 20 20 20 65 78 70 72 65 73            expres
0d80: 73 65 64 20 69 6e 20 43 52 45 41 54 45 20 54 41  sed in CREATE TA
0d90: 42 4c 45 20 73 79 6e 74 61 78 2e 0a 0a 09 20 20  BLE syntax....  
0da0: 20 20 6c 6f 64 20 20 49 4e 54 45 47 45 52 20 20    lod  INTEGER  
0db0: 4e 4f 54 20 4e 55 4c 4c 20 20 52 45 46 45 52 45  NOT NULL  REFERE
0dc0: 4e 43 45 53 20 73 79 6d 62 6f 6c 2c 20 2d 2d 20  NCES symbol, -- 
0dd0: 4c 69 6e 65 20 6f 66 20 64 65 76 65 6c 6f 70 6d  Line of developm
0de0: 65 6e 74 0a 0a 09 20 20 20 20 2d 2d 20 54 68 65  ent...    -- The
0df0: 20 72 65 76 69 73 69 6f 6e 73 20 69 6e 20 61 20   revisions in a 
0e00: 66 69 6c 65 20 61 72 65 20 6f 72 67 61 6e 69 7a  file are organiz
0e10: 65 64 20 69 6e 20 61 20 66 6f 72 65 73 74 20 6f  ed in a forest o
0e20: 66 0a 09 20 20 20 20 2d 2d 20 74 72 65 65 73 2c  f..    -- trees,
0e30: 20 77 69 74 68 20 74 68 65 20 6d 61 69 6e 20 6c   with the main l
0e40: 69 6e 65 73 20 64 65 66 69 6e 65 64 20 74 68 72  ines defined thr
0e50: 6f 75 67 68 20 74 68 65 20 70 61 72 65 6e 74 20  ough the parent 
0e60: 2f 0a 09 20 20 20 20 2d 2d 20 63 68 69 6c 64 20  /..    -- child 
0e70: 72 65 66 65 72 65 6e 63 65 73 2e 20 41 20 72 65  references. A re
0e80: 76 69 73 69 6f 6e 20 77 69 74 68 6f 75 74 20 61  vision without a
0e90: 20 70 61 72 65 6e 74 20 69 73 20 74 68 65 0a 09   parent is the..
0ea0: 20 20 20 20 2d 2d 20 72 6f 6f 74 20 6f 66 20 61      -- root of a
0eb0: 20 74 72 65 65 2c 20 61 6e 64 20 61 20 72 65 76   tree, and a rev
0ec0: 69 73 69 6f 6e 20 77 69 74 68 6f 75 74 20 61 20  ision without a 
0ed0: 63 68 69 6c 64 20 69 73 20 61 0a 09 20 20 20 20  child is a..    
0ee0: 2d 2d 20 6c 65 61 66 2e 0a 0a 09 20 20 20 20 2d  -- leaf....    -
0ef0: 2d 20 43 6f 6e 73 74 72 61 69 6e 74 73 3a 20 41  - Constraints: A
0f00: 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 63 6f 75  ll revisions cou
0f10: 70 6c 65 64 20 74 68 72 6f 75 67 68 20 70 61 72  pled through par
0f20: 65 6e 74 2f 63 68 69 6c 64 0a 09 20 20 20 20 2d  ent/child..    -
0f30: 2d 20 20 20 20 20 20 20 20 20 20 20 20 20 20 72  -              r
0f40: 65 66 65 72 20 74 6f 20 74 68 65 20 73 61 6d 65  efer to the same
0f50: 20 4c 4f 44 20 73 79 6d 62 6f 6c 2e 20 54 68 65   LOD symbol. The
0f60: 20 70 61 72 65 6e 74 0a 09 20 20 20 20 2d 2d 20   parent..    -- 
0f70: 20 20 20 20 20 20 20 20 20 20 20 20 20 6f 66 20               of 
0f80: 61 20 63 68 69 6c 64 20 6f 66 20 58 20 69 73 20  a child of X is 
0f90: 58 2e 20 54 68 65 20 63 68 69 6c 64 20 6f 66 20  X. The child of 
0fa0: 61 0a 09 20 20 20 20 2d 2d 20 20 20 20 20 20 20  a..    --       
0fb0: 20 20 20 20 20 20 20 70 61 72 65 6e 74 20 6f 66         parent of
0fc0: 20 58 20 69 73 20 58 2e 0a 0a 09 20 20 20 20 70   X is X....    p
0fd0: 61 72 65 6e 74 20 20 49 4e 54 45 47 45 52 20 20  arent  INTEGER  
0fe0: 20 20 20 20 20 20 20 20 20 20 52 45 46 45 52 45            REFERE
0ff0: 4e 43 45 53 20 72 65 76 69 73 69 6f 6e 2c 0a 09  NCES revision,..
1000: 20 20 20 20 63 68 69 6c 64 20 20 20 49 4e 54 45      child   INTE
1010: 47 45 52 20 20 20 20 20 20 20 20 20 20 20 20 52  GER            R
1020: 45 46 45 52 45 4e 43 45 53 20 72 65 76 69 73 69  EFERENCES revisi
1030: 6f 6e 2c 0a 0a 09 20 20 20 20 2d 2d 20 54 68 65  on,...    -- The
1040: 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 20   representation 
1050: 6f 66 20 61 20 62 72 61 6e 63 68 20 69 6e 20 61  of a branch in a
1060: 20 74 72 65 65 20 69 73 20 74 68 65 0a 09 20 20   tree is the..  
1070: 20 20 2d 2d 20 65 78 63 65 70 74 69 6f 6e 20 74    -- exception t
1080: 6f 20 74 68 65 20 74 68 72 65 65 20 63 6f 6e 73  o the three cons
1090: 74 72 61 69 6e 74 73 20 61 62 6f 76 65 2e 0a 0a  traints above...
10a0: 09 20 20 20 20 2d 2d 20 54 68 65 20 62 65 67 69  .    -- The begi
10b0: 6e 6e 69 6e 67 20 6f 66 20 61 20 62 72 61 6e 63  nning of a branc
10c0: 68 20 69 73 20 72 65 70 72 65 73 65 6e 74 65 64  h is represented
10d0: 20 62 79 20 61 20 6e 6f 6e 2d 4e 55 4c 4c 0a 09   by a non-NULL..
10e0: 20 20 20 20 2d 2d 20 62 70 61 72 65 6e 74 20 6f      -- bparent o
10f0: 66 20 61 20 72 65 76 69 73 69 6f 6e 2e 20 54 68  f a revision. Th
1100: 69 73 20 72 65 76 69 73 69 6f 6e 20 42 20 69 73  is revision B is
1110: 20 74 68 65 20 66 69 72 73 74 20 6f 6e 0a 09 20   the first on.. 
1120: 20 20 20 2d 2d 20 74 68 65 20 62 72 61 6e 63 68     -- the branch
1130: 2e 20 49 74 73 20 70 61 72 65 6e 74 20 50 20 69  . Its parent P i
1140: 73 20 74 68 65 20 72 65 76 69 73 69 6f 6e 20 74  s the revision t
1150: 68 65 20 62 72 61 6e 63 68 20 69 73 0a 09 20 20  he branch is..  
1160: 20 20 2d 2d 20 72 6f 6f 74 65 64 20 69 6e 2c 20    -- rooted in, 
1170: 61 6e 64 20 69 74 20 69 73 20 6e 6f 74 20 74 68  and it is not th
1180: 65 20 63 68 69 6c 64 20 6f 66 20 50 2e 20 42 20  e child of P. B 
1190: 61 6e 64 20 50 20 72 65 66 65 72 0a 09 20 20 20  and P refer..   
11a0: 20 2d 2d 20 74 6f 20 64 69 66 66 65 72 65 6e 74   -- to different
11b0: 20 4c 4f 44 20 73 79 6d 62 6f 6c 73 2e 20 54 68   LOD symbols. Th
11c0: 65 20 62 70 61 72 65 6e 74 20 6f 66 20 42 20 69  e bparent of B i
11d0: 73 20 61 6c 73 6f 20 69 74 73 0a 09 20 20 20 20  s also its..    
11e0: 2d 2d 20 4c 4f 44 2c 20 61 6e 64 20 74 68 65 20  -- LOD, and the 
11f0: 4c 4f 44 20 6f 66 20 69 74 73 20 63 68 69 6c 64  LOD of its child
1200: 72 65 6e 2e 0a 0a 09 20 20 20 20 62 70 61 72 65  ren....    bpare
1210: 6e 74 20 49 4e 54 45 47 45 52 20 20 20 20 20 20  nt INTEGER      
1220: 20 20 20 20 20 20 52 45 46 45 52 45 4e 43 45 53        REFERENCES
1230: 20 73 79 6d 62 6f 6c 2c 0a 0a 09 20 20 20 20 2d   symbol,...    -
1240: 2d 20 4c 61 73 74 6c 79 20 77 65 20 6b 65 65 70  - Lastly we keep
1250: 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 69 73 20   information is 
1260: 61 62 6f 75 74 20 6e 6f 6e 2d 74 72 75 6e 6b 20  about non-trunk 
1270: 64 65 66 61 75 6c 74 0a 09 20 20 20 20 2d 2d 20  default..    -- 
1280: 62 72 61 6e 63 68 65 73 20 28 4e 54 44 42 29 20  branches (NTDB) 
1290: 69 6e 20 74 68 65 20 72 65 76 69 73 69 6f 6e 73  in the revisions
12a0: 2e 0a 0a 09 20 20 20 20 2d 2d 20 41 6c 6c 20 72  ....    -- All r
12b0: 65 76 69 73 69 6f 6e 73 20 6f 6e 20 74 68 65 20  evisions on the 
12c0: 4e 54 44 42 20 68 61 76 65 20 27 69 73 64 65 66  NTDB have 'isdef
12d0: 61 75 6c 74 27 20 54 52 55 45 2c 0a 09 20 20 20  ault' TRUE,..   
12e0: 20 2d 2d 20 65 76 65 72 79 6f 6e 65 20 65 6c 73   -- everyone els
12f0: 65 20 46 41 4c 53 45 2e 20 54 68 65 20 6c 61 73  e FALSE. The las
1300: 74 20 72 65 76 69 73 69 6f 6e 20 58 20 6f 6e 20  t revision X on 
1310: 74 68 65 20 4e 54 44 42 0a 09 20 20 20 20 2d 2d  the NTDB..    --
1320: 20 77 68 69 63 68 20 69 73 20 73 74 69 6c 6c 20   which is still 
1330: 63 6f 6e 73 69 64 65 72 65 64 20 74 6f 20 62 65  considered to be
1340: 20 6f 6e 20 74 68 65 20 74 72 75 6e 6b 20 61 73   on the trunk as
1350: 20 77 65 6c 6c 0a 09 20 20 20 20 2d 2d 20 68 61   well..    -- ha
1360: 73 20 61 20 6e 6f 6e 2d 4e 55 4c 4c 20 27 64 62  s a non-NULL 'db
1370: 63 68 69 6c 64 27 20 77 68 69 63 68 20 72 65 66  child' which ref
1380: 65 72 73 20 74 6f 20 74 68 65 20 72 6f 6f 74 20  ers to the root 
1390: 6f 66 0a 09 20 20 20 20 2d 2d 20 74 68 65 20 74  of..    -- the t
13a0: 72 75 6e 6b 2e 20 54 68 65 20 72 6f 6f 74 20 61  runk. The root a
13b0: 6c 73 6f 20 68 61 73 20 61 20 6e 6f 6e 2d 4e 55  lso has a non-NU
13c0: 4c 4c 20 64 62 70 61 72 65 6e 74 0a 09 20 20 20  LL dbparent..   
13d0: 20 2d 2d 20 72 65 66 65 72 69 6e 67 20 74 6f 20   -- refering to 
13e0: 58 2e 0a 0a 09 20 20 20 20 69 73 64 65 66 61 75  X....    isdefau
13f0: 6c 74 20 49 4e 54 45 47 45 52 20 20 4e 4f 54 20  lt INTEGER  NOT 
1400: 4e 55 4c 4c 2c 0a 09 20 20 20 20 64 62 70 61 72  NULL,..    dbpar
1410: 65 6e 74 20 20 49 4e 54 45 47 45 52 20 20 20 20  ent  INTEGER    
1420: 20 20 20 20 20 20 20 20 52 45 46 45 52 45 4e 43          REFERENC
1430: 45 53 20 72 65 76 69 73 69 6f 6e 2c 0a 09 20 20  ES revision,..  
1440: 20 20 64 62 63 68 69 6c 64 20 20 20 49 4e 54 45    dbchild   INTE
1450: 47 45 52 20 20 20 20 20 20 20 20 20 20 20 20 52  GER            R
1460: 45 46 45 52 45 4e 43 45 53 20 72 65 76 69 73 69  EFERENCES revisi
1470: 6f 6e 2c 0a 0a 09 20 20 20 20 2d 2d 20 54 68 65  on,...    -- The
1480: 20 6d 61 69 6e 20 70 61 79 6c 6f 61 64 20 6f 66   main payload of
1490: 20 74 68 65 20 72 65 76 69 73 69 6f 6e 20 61 72   the revision ar
14a0: 65 20 74 68 65 20 64 61 74 65 2f 74 69 6d 65 20  e the date/time 
14b0: 69 74 0a 09 20 20 20 20 2d 2d 20 77 61 73 20 65  it..    -- was e
14c0: 6e 74 65 72 65 64 2c 20 69 74 73 20 73 74 61 74  ntered, its stat
14d0: 65 2c 20 6f 70 65 72 61 74 69 6f 6e 20 28 3d 20  e, operation (= 
14e0: 74 79 70 65 2f 63 6c 61 73 73 29 2c 20 74 65 78  type/class), tex
14f0: 74 0a 09 20 20 20 20 2d 2d 20 63 6f 6e 74 65 6e  t..    -- conten
1500: 74 2c 20 61 6e 64 20 6d 65 74 61 20 64 61 74 61  t, and meta data
1510: 20 28 61 75 74 68 6f 72 2c 20 6c 6f 67 20 6d 65   (author, log me
1520: 73 73 61 67 65 2c 20 62 72 61 6e 63 68 2c 0a 09  ssage, branch,..
1530: 20 20 20 20 2d 2d 20 70 72 6f 6a 65 63 74 29 2e      -- project).
1540: 20 54 68 65 20 6c 61 73 74 20 69 73 20 65 6e 63   The last is enc
1550: 6f 64 65 64 20 61 73 20 73 69 6e 67 6c 65 20 69  oded as single i
1560: 64 2c 20 73 65 65 20 74 61 62 6c 65 0a 09 20 20  d, see table..  
1570: 20 20 2d 2d 20 27 6d 65 74 61 27 2e 20 54 68 65    -- 'meta'. The
1580: 20 64 61 74 65 2f 74 69 6d 65 20 69 73 20 67 69   date/time is gi
1590: 76 65 6e 20 69 6e 20 73 65 63 6f 6e 64 73 20 73  ven in seconds s
15a0: 69 6e 63 65 20 74 68 65 0a 09 20 20 20 20 2d 2d  ince the..    --
15b0: 20 65 70 6f 63 68 2c 20 66 6f 72 20 65 61 73 79   epoch, for easy
15c0: 20 63 6f 6d 70 61 72 69 73 6f 6e 2e 20 54 68 65   comparison. The
15d0: 20 74 65 78 74 20 63 6f 6e 74 65 6e 74 20 69 73   text content is
15e0: 20 61 6e 0a 09 20 20 20 20 2d 2d 20 28 6f 66 66   an..    -- (off
15f0: 73 65 74 2c 6c 65 6e 67 74 68 29 20 70 61 69 72  set,length) pair
1600: 20 69 6e 74 6f 20 74 68 65 20 72 63 73 20 61 72   into the rcs ar
1610: 63 68 69 76 65 2e 0a 0a 09 20 20 20 20 6f 70 20  chive....    op 
1620: 20 20 20 49 4e 54 45 47 45 52 20 20 4e 4f 54 20     INTEGER  NOT 
1630: 4e 55 4c 4c 20 20 52 45 46 45 52 45 4e 43 45 53  NULL  REFERENCES
1640: 20 6f 70 74 79 70 65 2c 0a 09 20 20 20 20 64 61   optype,..    da
1650: 74 65 20 20 49 4e 54 45 47 45 52 20 20 4e 4f 54  te  INTEGER  NOT
1660: 20 4e 55 4c 4c 2c 0a 09 20 20 20 20 73 74 61 74   NULL,..    stat
1670: 65 20 54 45 58 54 20 20 20 20 20 4e 4f 54 20 4e  e TEXT     NOT N
1680: 55 4c 4c 2c 0a 09 20 20 20 20 6d 69 64 20 20 20  ULL,..    mid   
1690: 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c  INTEGER  NOT NUL
16a0: 4c 20 20 52 45 46 45 52 45 4e 43 45 53 20 6d 65  L  REFERENCES me
16b0: 74 61 2c 0a 09 20 20 20 20 63 6f 66 66 20 20 49  ta,..    coff  I
16c0: 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c  NTEGER  NOT NULL
16d0: 2c 0a 09 20 20 20 20 63 6c 65 6e 20 20 49 4e 54  ,..    clen  INT
16e0: 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 2c 0a  EGER  NOT NULL,.
16f0: 0a 09 20 20 20 20 55 4e 49 51 55 45 20 28 66 69  ..    UNIQUE (fi
1700: 64 2c 20 72 65 76 29 20 2d 2d 20 54 68 65 20 44  d, rev) -- The D
1710: 54 4e 20 69 73 20 75 6e 69 71 75 65 20 77 69 74  TN is unique wit
1720: 68 69 6e 20 74 68 65 20 72 65 76 69 73 69 6f 6e  hin the revision
1730: 27 73 20 66 69 6c 65 2e 0a 09 7d 0a 09 73 74 61  's file...}..sta
1740: 74 65 20 77 72 69 74 69 6e 67 20 6f 70 74 79 70  te writing optyp
1750: 65 20 7b 0a 09 20 20 20 20 6f 69 64 20 20 20 49  e {..    oid   I
1760: 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c  NTEGER  NOT NULL
1770: 20 20 50 52 49 4d 41 52 59 20 4b 45 59 2c 0a 09    PRIMARY KEY,..
1780: 20 20 20 20 6e 61 6d 65 20 20 54 45 58 54 20 20      name  TEXT  
1790: 20 20 20 4e 4f 54 20 4e 55 4c 4c 2c 0a 09 20 20     NOT NULL,..  
17a0: 20 20 55 4e 49 51 55 45 28 6e 61 6d 65 29 0a 09    UNIQUE(name)..
17b0: 7d 0a 09 73 74 61 74 65 20 72 75 6e 20 7b 0a 09  }..state run {..
17c0: 20 20 20 20 49 4e 53 45 52 54 20 49 4e 54 4f 20      INSERT INTO 
17d0: 6f 70 74 79 70 65 20 56 41 4c 55 45 53 20 28 2d  optype VALUES (-
17e0: 31 2c 27 64 65 6c 65 74 65 27 29 3b 20 20 2d 2d  1,'delete');  --
17f0: 20 54 68 65 20 6f 70 63 6f 64 65 20 6e 61 6d 65   The opcode name
1800: 73 20 61 72 65 20 74 68 65 0a 09 20 20 20 20 49  s are the..    I
1810: 4e 53 45 52 54 20 49 4e 54 4f 20 6f 70 74 79 70  NSERT INTO optyp
1820: 65 20 56 41 4c 55 45 53 20 28 20 30 2c 27 6e 6f  e VALUES ( 0,'no
1830: 74 68 69 6e 67 27 29 3b 20 2d 2d 20 66 69 78 65  thing'); -- fixe
1840: 64 20 70 69 65 63 65 73 2c 20 73 65 65 20 6d 79  d pieces, see my
1850: 6f 70 73 74 61 74 65 0a 09 20 20 20 20 49 4e 53  opstate..    INS
1860: 45 52 54 20 49 4e 54 4f 20 6f 70 74 79 70 65 20  ERT INTO optype 
1870: 56 41 4c 55 45 53 20 28 20 31 2c 27 61 64 64 27  VALUES ( 1,'add'
1880: 29 3b 20 20 20 20 20 2d 2d 20 69 6e 20 66 69 6c  );     -- in fil
1890: 65 3a 3a 72 65 76 2e 20 6d 79 6f 70 63 6f 64 65  e::rev. myopcode
18a0: 20 69 73 0a 09 20 20 20 20 49 4e 53 45 52 54 20   is..    INSERT 
18b0: 49 4e 54 4f 20 6f 70 74 79 70 65 20 56 41 4c 55  INTO optype VALU
18c0: 45 53 20 28 20 32 2c 27 63 68 61 6e 67 65 27 29  ES ( 2,'change')
18d0: 3b 20 20 2d 2d 20 6c 6f 61 64 65 64 20 66 72 6f  ;  -- loaded fro
18e0: 6d 20 74 68 69 73 2e 0a 09 7d 0a 09 73 74 61 74  m this...}..stat
18f0: 65 20 77 72 69 74 69 6e 67 20 74 61 67 20 7b 0a  e writing tag {.
1900: 09 20 20 20 20 74 69 64 20 20 49 4e 54 45 47 45  .    tid  INTEGE
1910: 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 50 52 49  R  NOT NULL  PRI
1920: 4d 41 52 59 20 4b 45 59 20 41 55 54 4f 49 4e 43  MARY KEY AUTOINC
1930: 52 45 4d 45 4e 54 2c 0a 09 20 20 20 20 66 69 64  REMENT,..    fid
1940: 20 20 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e    INTEGER  NOT N
1950: 55 4c 4c 20 20 52 45 46 45 52 45 4e 43 45 53 20  ULL  REFERENCES 
1960: 66 69 6c 65 2c 20 20 20 20 20 2d 2d 20 46 69 6c  file,     -- Fil
1970: 65 20 74 68 65 20 69 74 65 6d 20 62 65 6c 6f 6e  e the item belon
1980: 67 73 20 74 6f 0a 09 20 20 20 20 6c 6f 64 20 20  gs to..    lod  
1990: 49 4e 54 45 47 45 52 20 20 20 20 20 20 20 20 20  INTEGER         
19a0: 20 20 20 52 45 46 45 52 45 4e 43 45 53 20 73 79     REFERENCES sy
19b0: 6d 62 6f 6c 2c 20 20 20 2d 2d 20 4c 69 6e 65 20  mbol,   -- Line 
19c0: 6f 66 20 64 65 76 65 6c 6f 70 6d 65 6e 74 20 28  of development (
19d0: 4e 55 4c 4c 20 3d 3e 20 54 72 75 6e 6b 29 0a 09  NULL => Trunk)..
19e0: 20 20 20 20 73 69 64 20 20 49 4e 54 45 47 45 52      sid  INTEGER
19f0: 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 52 45 46 45    NOT NULL  REFE
1a00: 52 45 4e 43 45 53 20 73 79 6d 62 6f 6c 2c 20 20  RENCES symbol,  
1a10: 20 2d 2d 20 53 79 6d 62 6f 6c 20 63 61 70 74 75   -- Symbol captu
1a20: 72 69 6e 67 20 74 68 65 20 74 61 67 0a 0a 09 20  ring the tag... 
1a30: 20 20 20 72 65 76 20 20 49 4e 54 45 47 45 52 20     rev  INTEGER 
1a40: 20 4e 4f 54 20 4e 55 4c 4c 20 20 52 45 46 45 52   NOT NULL  REFER
1a50: 45 4e 43 45 53 20 72 65 76 69 73 69 6f 6e 20 20  ENCES revision  
1a60: 2d 2d 20 54 68 65 20 72 65 76 69 73 69 6f 6e 20  -- The revision 
1a70: 62 65 69 6e 67 20 74 61 67 67 65 64 2e 0a 09 7d  being tagged...}
1a80: 0a 0a 09 73 74 61 74 65 20 77 72 69 74 69 6e 67  ...state writing
1a90: 20 62 72 61 6e 63 68 20 7b 0a 09 20 20 20 20 62   branch {..    b
1aa0: 69 64 20 20 20 49 4e 54 45 47 45 52 20 20 4e 4f  id   INTEGER  NO
1ab0: 54 20 4e 55 4c 4c 20 20 50 52 49 4d 41 52 59 20  T NULL  PRIMARY 
1ac0: 4b 45 59 20 41 55 54 4f 49 4e 43 52 45 4d 45 4e  KEY AUTOINCREMEN
1ad0: 54 2c 0a 09 20 20 20 20 66 69 64 20 20 20 49 4e  T,..    fid   IN
1ae0: 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 20  TEGER  NOT NULL 
1af0: 20 52 45 46 45 52 45 4e 43 45 53 20 66 69 6c 65   REFERENCES file
1b00: 2c 20 20 20 20 20 2d 2d 20 46 69 6c 65 20 74 68  ,     -- File th
1b10: 65 20 69 74 65 6d 20 62 65 6c 6f 6e 67 73 20 74  e item belongs t
1b20: 6f 0a 09 20 20 20 20 6c 6f 64 20 20 20 49 4e 54  o..    lod   INT
1b30: 45 47 45 52 20 20 20 20 20 20 20 20 20 20 20 20  EGER            
1b40: 52 45 46 45 52 45 4e 43 45 53 20 73 79 6d 62 6f  REFERENCES symbo
1b50: 6c 2c 20 20 20 2d 2d 20 4c 69 6e 65 20 6f 66 20  l,   -- Line of 
1b60: 64 65 76 65 6c 6f 70 6d 65 6e 74 20 28 4e 55 4c  development (NUL
1b70: 4c 20 3d 3e 20 54 72 75 6e 6b 29 0a 09 20 20 20  L => Trunk)..   
1b80: 20 73 69 64 20 20 20 49 4e 54 45 47 45 52 20 20   sid   INTEGER  
1b90: 4e 4f 54 20 4e 55 4c 4c 20 20 52 45 46 45 52 45  NOT NULL  REFERE
1ba0: 4e 43 45 53 20 73 79 6d 62 6f 6c 2c 20 20 20 2d  NCES symbol,   -
1bb0: 2d 20 53 79 6d 62 6f 6c 20 63 61 70 74 75 72 69  - Symbol capturi
1bc0: 6e 67 20 74 68 65 20 62 72 61 6e 63 68 0a 0a 09  ng the branch...
1bd0: 20 20 20 20 72 6f 6f 74 20 20 49 4e 54 45 47 45      root  INTEGE
1be0: 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 52 45 46  R  NOT NULL  REF
1bf0: 45 52 45 4e 43 45 53 20 72 65 76 69 73 69 6f 6e  ERENCES revision
1c00: 2c 20 2d 2d 20 52 65 76 69 73 69 6f 6e 20 74 68  , -- Revision th
1c10: 65 20 62 72 61 6e 63 68 20 73 70 72 6f 75 74 73  e branch sprouts
1c20: 20 66 72 6f 6d 0a 09 20 20 20 20 66 69 72 73 74   from..    first
1c30: 20 49 4e 54 45 47 45 52 20 20 20 20 20 20 20 20   INTEGER        
1c40: 20 20 20 20 52 45 46 45 52 45 4e 43 45 53 20 72      REFERENCES r
1c50: 65 76 69 73 69 6f 6e 2c 20 2d 2d 20 46 69 72 73  evision, -- Firs
1c60: 74 20 72 65 76 69 73 69 6f 6e 20 63 6f 6d 6d 69  t revision commi
1c70: 74 74 65 64 20 74 6f 20 74 68 65 20 62 72 61 6e  tted to the bran
1c80: 63 68 0a 09 20 20 20 20 62 72 61 20 20 20 54 45  ch..    bra   TE
1c90: 58 54 20 20 20 20 20 4e 4f 54 20 4e 55 4c 4c 2c  XT     NOT NULL,
1ca0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
1cb0: 20 20 20 20 20 20 2d 2d 20 62 72 61 6e 63 68 20        -- branch 
1cc0: 6e 75 6d 62 65 72 0a 09 20 20 20 20 70 6f 73 20  number..    pos 
1cd0: 20 20 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e    INTEGER  NOT N
1ce0: 55 4c 4c 20 20 20 20 20 20 20 20 20 20 20 20 20  ULL             
1cf0: 20 20 20 20 20 20 20 20 20 20 2d 2d 20 63 72 65            -- cre
1d00: 61 74 69 6f 6e 20 6f 72 64 65 72 20 69 6e 20 72  ation order in r
1d10: 6f 6f 74 2e 0a 09 7d 0a 0a 09 23 20 50 72 6f 6a  oot...}...# Proj
1d20: 65 63 74 20 6c 65 76 65 6c 20 2e 2e 2e 0a 09 23  ect level .....#
1d30: 09 70 4c 69 6e 65 4f 66 44 65 76 65 6c 6f 70 6d  .pLineOfDevelopm
1d40: 65 6e 74 2c 20 70 53 79 6d 62 6f 6c 2c 20 70 42  ent, pSymbol, pB
1d50: 72 61 6e 63 68 2c 20 70 54 61 67 2c 20 70 54 72  ranch, pTag, pTr
1d60: 75 6e 6b 0a 09 23 0a 09 23 09 70 54 72 75 6e 6b  unk..#..#.pTrunk
1d70: 20 20 3c 2d 20 70 4c 69 6e 65 4f 66 44 65 76 65    <- pLineOfDeve
1d80: 6c 6f 70 6d 65 6e 74 0a 09 23 09 70 42 72 61 6e  lopment..#.pBran
1d90: 63 68 20 3c 2d 20 70 53 79 6d 62 6f 6c 2c 20 70  ch <- pSymbol, p
1da0: 4c 69 6e 65 4f 66 44 65 76 65 6c 6f 70 6d 65 6e  LineOfDevelopmen
1db0: 74 0a 09 23 09 70 54 61 67 20 20 20 20 3c 2d 20  t..#.pTag    <- 
1dc0: 70 53 79 6d 62 6f 6c 2c 20 70 4c 69 6e 65 4f 66  pSymbol, pLineOf
1dd0: 44 65 76 65 6c 6f 70 6d 65 6e 74 0a 0a 09 73 74  Development...st
1de0: 61 74 65 20 77 72 69 74 69 6e 67 20 73 79 6d 62  ate writing symb
1df0: 6f 6c 20 7b 0a 09 20 20 20 20 73 69 64 20 20 49  ol {..    sid  I
1e00: 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c  NTEGER  NOT NULL
1e10: 20 20 50 52 49 4d 41 52 59 20 4b 45 59 20 41 55    PRIMARY KEY AU
1e20: 54 4f 49 4e 43 52 45 4d 45 4e 54 2c 0a 09 20 20  TOINCREMENT,..  
1e30: 20 20 70 69 64 20 20 49 4e 54 45 47 45 52 20 20    pid  INTEGER  
1e40: 4e 4f 54 20 4e 55 4c 4c 20 20 52 45 46 45 52 45  NOT NULL  REFERE
1e50: 4e 43 45 53 20 70 72 6f 6a 65 63 74 2c 20 20 2d  NCES project,  -
1e60: 2d 20 50 72 6f 6a 65 63 74 20 74 68 65 20 73 79  - Project the sy
1e70: 6d 62 6f 6c 20 62 65 6c 6f 6e 67 73 20 74 6f 0a  mbol belongs to.
1e80: 09 20 20 20 20 6e 61 6d 65 20 54 45 58 54 20 20  .    name TEXT  
1e90: 20 20 20 4e 4f 54 20 4e 55 4c 4c 2c 0a 09 20 20     NOT NULL,..  
1ea0: 20 20 74 79 70 65 20 49 4e 54 45 47 45 52 20 20    type INTEGER  
1eb0: 4e 4f 54 20 4e 55 4c 4c 20 20 52 45 46 45 52 45  NOT NULL  REFERE
1ec0: 4e 43 45 53 20 73 79 6d 74 79 70 65 2c 20 20 2d  NCES symtype,  -
1ed0: 2d 20 65 6e 75 6d 20 7b 20 65 78 63 6c 75 64 65  - enum { exclude
1ee0: 64 20 3d 20 30 2c 20 74 61 67 2c 20 62 72 61 6e  d = 0, tag, bran
1ef0: 63 68 2c 20 75 6e 64 65 66 69 6e 65 64 20 7d 0a  ch, undefined }.
1f00: 0a 09 20 20 20 20 74 61 67 5f 63 6f 75 6e 74 20  ..    tag_count 
1f10: 20 20 20 49 4e 54 45 47 45 52 20 20 4e 4f 54 20     INTEGER  NOT 
1f20: 4e 55 4c 4c 2c 20 2d 2d 20 48 6f 77 20 6f 66 74  NULL, -- How oft
1f30: 65 6e 20 74 68 65 20 73 79 6d 62 6f 6c 20 69 73  en the symbol is
1f40: 20 75 73 65 64 20 61 73 20 74 61 67 2e 0a 09 20   used as tag... 
1f50: 20 20 20 62 72 61 6e 63 68 5f 63 6f 75 6e 74 20     branch_count 
1f60: 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c  INTEGER  NOT NUL
1f70: 4c 2c 20 2d 2d 20 48 6f 77 20 6f 66 74 65 6e 20  L, -- How often 
1f80: 74 68 65 20 73 79 6d 62 6f 6c 20 69 73 20 75 73  the symbol is us
1f90: 65 64 20 61 73 20 62 72 61 6e 63 68 0a 09 20 20  ed as branch..  
1fa0: 20 20 63 6f 6d 6d 69 74 5f 63 6f 75 6e 74 20 49    commit_count I
1fb0: 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c  NTEGER  NOT NULL
1fc0: 2c 20 2d 2d 20 48 6f 77 20 6f 66 74 65 6e 20 61  , -- How often a
1fd0: 20 66 69 6c 65 20 77 61 73 20 63 6f 6d 6d 69 74   file was commit
1fe0: 74 65 64 20 6f 6e 20 74 68 65 20 73 79 6d 62 6f  ted on the symbo
1ff0: 6c 0a 0a 09 20 20 20 20 55 4e 49 51 55 45 20 28  l...    UNIQUE (
2000: 70 69 64 2c 20 6e 61 6d 65 29 20 2d 2d 20 53 79  pid, name) -- Sy
2010: 6d 62 6f 6c 73 20 61 72 65 20 75 6e 69 71 75 65  mbols are unique
2020: 20 77 69 74 68 69 6e 20 74 68 65 20 70 72 6f 6a   within the proj
2030: 65 63 74 0a 09 7d 0a 0a 09 73 74 61 74 65 20 77  ect..}...state w
2040: 72 69 74 69 6e 67 20 62 6c 6f 63 6b 65 72 20 7b  riting blocker {
2050: 0a 09 20 20 20 20 2d 2d 20 46 6f 72 20 65 61 63  ..    -- For eac
2060: 68 20 73 79 6d 62 6f 6c 20 77 65 20 73 61 76 65  h symbol we save
2070: 20 77 68 69 63 68 20 6f 74 68 65 72 20 73 79 6d   which other sym
2080: 62 6f 6c 73 20 61 72 65 0a 09 20 20 20 20 2d 2d  bols are..    --
2090: 20 62 6c 6f 63 6b 69 6e 67 20 69 74 73 20 72 65   blocking its re
20a0: 6d 6f 76 61 6c 20 28 69 66 20 74 68 65 20 75 73  moval (if the us
20b0: 65 72 20 61 73 6b 73 20 66 6f 72 20 69 74 29 2e  er asks for it).
20c0: 0a 0a 09 20 20 20 20 73 69 64 20 49 4e 54 45 47  ...    sid INTEG
20d0: 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 52 45  ER  NOT NULL  RE
20e0: 46 45 52 45 4e 43 45 53 20 73 79 6d 62 6f 6c 2c  FERENCES symbol,
20f0: 20 2d 2d 20 0a 09 20 20 20 20 62 69 64 20 49 4e   -- ..    bid IN
2100: 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 20  TEGER  NOT NULL 
2110: 20 52 45 46 45 52 45 4e 43 45 53 20 73 79 6d 62   REFERENCES symb
2120: 6f 6c 2c 20 2d 2d 20 53 70 72 6f 75 74 65 64 20  ol, -- Sprouted 
2130: 66 72 6f 6d 20 73 69 64 2c 20 62 6c 6f 63 6b 73  from sid, blocks
2140: 20 69 74 2e 0a 09 20 20 20 20 55 4e 49 51 55 45   it...    UNIQUE
2150: 20 28 73 69 64 2c 20 62 69 64 29 0a 09 7d 0a 0a   (sid, bid)..}..
2160: 09 73 74 61 74 65 20 77 72 69 74 69 6e 67 20 70  .state writing p
2170: 61 72 65 6e 74 20 7b 0a 09 20 20 20 20 2d 2d 20  arent {..    -- 
2180: 46 6f 72 20 65 61 63 68 20 73 79 6d 62 6f 6c 20  For each symbol 
2190: 77 65 20 73 61 76 65 20 77 68 69 63 68 20 6f 74  we save which ot
21a0: 68 65 72 20 73 79 6d 62 6f 6c 73 20 63 61 6e 20  her symbols can 
21b0: 61 63 74 20 61 73 0a 09 20 20 20 20 2d 2d 20 61  act as..    -- a
21c0: 20 70 6f 73 73 69 62 6c 65 20 70 61 72 65 6e 74   possible parent
21d0: 20 69 6e 20 73 6f 6d 65 20 66 69 6c 65 2c 20 61   in some file, a
21e0: 6e 64 20 68 6f 77 20 6f 66 74 65 6e 2e 0a 0a 09  nd how often....
21f0: 20 20 20 20 73 69 64 20 49 4e 54 45 47 45 52 20      sid INTEGER 
2200: 20 4e 4f 54 20 4e 55 4c 4c 20 20 52 45 46 45 52   NOT NULL  REFER
2210: 45 4e 43 45 53 20 73 79 6d 62 6f 6c 2c 20 2d 2d  ENCES symbol, --
2220: 20 0a 09 20 20 20 20 70 69 64 20 49 4e 54 45 47   ..    pid INTEG
2230: 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 52 45  ER  NOT NULL  RE
2240: 46 45 52 45 4e 43 45 53 20 73 79 6d 62 6f 6c 2c  FERENCES symbol,
2250: 20 2d 2d 20 50 6f 73 73 69 62 6c 65 20 70 61 72   -- Possible par
2260: 65 6e 74 20 6f 66 20 73 69 64 0a 09 20 20 20 20  ent of sid..    
2270: 6e 20 20 20 49 4e 54 45 47 45 52 20 20 4e 4f 54  n   INTEGER  NOT
2280: 20 4e 55 4c 4c 2c 20 20 20 20 20 20 20 20 20 20   NULL,          
2290: 20 20 20 20 20 20 20 20 20 20 2d 2d 20 48 6f 77            -- How
22a0: 20 6f 66 74 65 6e 20 70 69 64 20 63 61 6e 20 61   often pid can a
22b0: 63 74 20 61 73 20 70 61 72 65 6e 74 2e 0a 09 20  ct as parent... 
22c0: 20 20 20 55 4e 49 51 55 45 20 28 73 69 64 2c 20     UNIQUE (sid, 
22d0: 70 69 64 29 0a 09 7d 0a 0a 09 73 74 61 74 65 20  pid)..}...state 
22e0: 77 72 69 74 69 6e 67 20 73 79 6d 74 79 70 65 20  writing symtype 
22f0: 7b 0a 09 20 20 20 20 74 69 64 20 20 20 20 49 4e  {..    tid    IN
2300: 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 20  TEGER  NOT NULL 
2310: 20 50 52 49 4d 41 52 59 20 4b 45 59 2c 0a 09 20   PRIMARY KEY,.. 
2320: 20 20 20 6e 61 6d 65 20 20 20 54 45 58 54 20 20     name   TEXT  
2330: 20 20 20 4e 4f 54 20 4e 55 4c 4c 2c 0a 09 20 20     NOT NULL,..  
2340: 20 20 70 6c 75 72 61 6c 20 54 45 58 54 20 20 20    plural TEXT   
2350: 20 20 4e 4f 54 20 4e 55 4c 4c 2c 0a 09 20 20 20    NOT NULL,..   
2360: 20 55 4e 49 51 55 45 20 28 6e 61 6d 65 29 0a 09   UNIQUE (name)..
2370: 20 20 20 20 55 4e 49 51 55 45 20 28 70 6c 75 72      UNIQUE (plur
2380: 61 6c 29 0a 09 7d 0a 09 73 74 61 74 65 20 72 75  al)..}..state ru
2390: 6e 20 7b 0a 09 20 20 20 20 49 4e 53 45 52 54 20  n {..    INSERT 
23a0: 49 4e 54 4f 20 73 79 6d 74 79 70 65 20 56 41 4c  INTO symtype VAL
23b0: 55 45 53 20 28 30 2c 27 65 78 63 6c 75 64 65 64  UES (0,'excluded
23c0: 27 2c 20 27 65 78 63 6c 75 64 65 64 27 29 3b 0a  ', 'excluded');.
23d0: 09 20 20 20 20 49 4e 53 45 52 54 20 49 4e 54 4f  .    INSERT INTO
23e0: 20 73 79 6d 74 79 70 65 20 56 41 4c 55 45 53 20   symtype VALUES 
23f0: 28 31 2c 27 74 61 67 27 2c 20 20 20 20 20 20 27  (1,'tag',      '
2400: 74 61 67 73 27 29 3b 0a 09 20 20 20 20 49 4e 53  tags');..    INS
2410: 45 52 54 20 49 4e 54 4f 20 73 79 6d 74 79 70 65  ERT INTO symtype
2420: 20 56 41 4c 55 45 53 20 28 32 2c 27 62 72 61 6e   VALUES (2,'bran
2430: 63 68 27 2c 20 20 20 27 62 72 61 6e 63 68 65 73  ch',   'branches
2440: 27 29 3b 0a 09 20 20 20 20 49 4e 53 45 52 54 20  ');..    INSERT 
2450: 49 4e 54 4f 20 73 79 6d 74 79 70 65 20 56 41 4c  INTO symtype VAL
2460: 55 45 53 20 28 33 2c 27 75 6e 64 65 66 69 6e 65  UES (3,'undefine
2470: 64 27 2c 27 75 6e 64 65 66 69 6e 65 64 27 29 3b  d','undefined');
2480: 0a 09 7d 0a 0a 09 73 74 61 74 65 20 77 72 69 74  ..}...state writ
2490: 69 6e 67 20 6d 65 74 61 20 7b 0a 09 20 20 20 20  ing meta {..    
24a0: 2d 2d 20 4d 65 74 61 20 64 61 74 61 20 6f 66 20  -- Meta data of 
24b0: 72 65 76 69 73 69 6f 6e 73 2e 20 53 65 65 20 72  revisions. See r
24c0: 65 76 69 73 69 6f 6e 2e 6d 69 64 20 66 6f 72 20  evision.mid for 
24d0: 74 68 65 0a 09 20 20 20 20 2d 2d 20 72 65 66 65  the..    -- refe
24e0: 72 65 6e 63 65 2e 20 4d 61 6e 79 20 72 65 76 69  rence. Many revi
24f0: 73 69 6f 6e 73 20 63 61 6e 20 73 68 61 72 65 20  sions can share 
2500: 6d 65 74 61 20 64 61 74 61 2e 20 54 68 69 73 20  meta data. This 
2510: 69 73 0a 09 20 20 20 20 2d 2d 20 61 63 74 75 61  is..    -- actua
2520: 6c 6c 79 20 6f 6e 65 20 6f 66 20 74 68 65 20 63  lly one of the c
2530: 72 69 74 65 72 69 6f 6e 73 20 75 73 65 64 20 74  riterions used t
2540: 6f 20 73 6f 72 74 20 72 65 76 69 73 69 6f 6e 73  o sort revisions
2550: 0a 09 20 20 20 20 2d 2d 20 69 6e 74 6f 20 63 68  ..    -- into ch
2560: 61 6e 67 65 73 65 74 73 2e 0a 0a 09 20 20 20 20  angesets....    
2570: 6d 69 64 20 49 4e 54 45 47 45 52 20 20 4e 4f 54  mid INTEGER  NOT
2580: 20 4e 55 4c 4c 20 20 50 52 49 4d 41 52 59 20 4b   NULL  PRIMARY K
2590: 45 59 20 20 41 55 54 4f 49 4e 43 52 45 4d 45 4e  EY  AUTOINCREMEN
25a0: 54 2c 0a 0a 09 20 20 20 20 2d 2d 20 4d 65 74 61  T,...    -- Meta
25b0: 20 64 61 74 61 20 62 65 6c 6f 6e 67 73 20 74 6f   data belongs to
25c0: 20 61 20 73 70 65 63 69 66 69 63 20 70 72 6f 6a   a specific proj
25d0: 65 63 74 2c 20 73 74 72 6f 6e 67 65 72 2c 20 74  ect, stronger, t
25e0: 6f 20 61 0a 09 20 20 20 20 2d 2d 20 62 72 61 6e  o a..    -- bran
25f0: 63 68 20 69 6e 20 74 68 61 74 20 70 72 6f 6a 65  ch in that proje
2600: 63 74 2e 20 49 74 20 66 75 72 74 68 65 72 20 68  ct. It further h
2610: 61 73 20 61 20 6c 6f 67 20 6d 65 73 73 61 67 65  as a log message
2620: 2c 0a 09 20 20 20 20 2d 2d 20 61 6e 64 20 69 74  ,..    -- and it
2630: 73 20 61 75 74 68 6f 72 2e 20 54 68 69 73 20 69  s author. This i
2640: 73 20 75 6e 69 71 75 65 20 77 69 74 68 20 74 68  s unique with th
2650: 65 20 70 72 6f 6a 65 63 74 20 61 6e 64 0a 09 20  e project and.. 
2660: 20 20 20 2d 2d 20 62 72 61 6e 63 68 2e 0a 0a 09     -- branch....
2670: 20 20 20 20 70 69 64 20 49 4e 54 45 47 45 52 20      pid INTEGER 
2680: 20 4e 4f 54 20 4e 55 4c 4c 20 20 52 45 46 45 52   NOT NULL  REFER
2690: 45 4e 43 45 53 20 70 72 6f 6a 65 63 74 2c 20 20  ENCES project,  
26a0: 2d 2d 0a 09 20 20 20 20 62 69 64 20 49 4e 54 45  --..    bid INTE
26b0: 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 52  GER  NOT NULL  R
26c0: 45 46 45 52 45 4e 43 45 53 20 73 79 6d 62 6f 6c  EFERENCES symbol
26d0: 2c 20 20 20 2d 2d 0a 09 20 20 20 20 61 69 64 20  ,   --..    aid 
26e0: 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c  INTEGER  NOT NUL
26f0: 4c 20 20 52 45 46 45 52 45 4e 43 45 53 20 61 75  L  REFERENCES au
2700: 74 68 6f 72 2c 20 20 20 2d 2d 0a 09 20 20 20 20  thor,   --..    
2710: 63 69 64 20 49 4e 54 45 47 45 52 20 20 4e 4f 54  cid INTEGER  NOT
2720: 20 4e 55 4c 4c 20 20 52 45 46 45 52 45 4e 43 45   NULL  REFERENCE
2730: 53 20 63 6d 65 73 73 61 67 65 2c 20 2d 2d 0a 0a  S cmessage, --..
2740: 09 20 20 20 20 55 4e 49 51 55 45 20 28 70 69 64  .    UNIQUE (pid
2750: 2c 20 62 69 64 2c 20 61 69 64 2c 20 63 69 64 29  , bid, aid, cid)
2760: 0a 0a 09 20 20 20 20 2d 2d 20 43 6f 6e 73 74 72  ...    -- Constr
2770: 61 69 6e 74 73 3a 20 54 68 65 20 70 72 6f 6a 65  aints: The proje
2780: 63 74 20 6f 66 20 74 68 65 20 6d 65 74 61 20 64  ct of the meta d
2790: 61 74 61 20 6f 66 20 61 20 72 65 76 69 73 69 6f  ata of a revisio
27a0: 6e 0a 09 20 20 20 20 2d 2d 20 20 20 20 20 20 20  n..    --       
27b0: 20 20 20 20 20 20 20 58 20 69 73 20 74 68 65 20         X is the 
27c0: 73 61 6d 65 20 61 73 20 74 68 65 20 70 72 6f 6a  same as the proj
27d0: 65 63 74 20 6f 66 20 58 20 69 74 73 65 6c 66 2e  ect of X itself.
27e0: 0a 09 20 20 20 20 2d 2d 0a 09 20 20 20 20 2d 2d  ..    --..    --
27f0: 20 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 20 54 68   ............ Th
2800: 65 20 62 72 61 6e 63 68 20 6f 66 20 74 68 65 20  e branch of the 
2810: 6d 65 74 61 20 64 61 74 61 20 6f 66 20 61 20 72  meta data of a r
2820: 65 76 69 73 69 6f 6e 0a 09 20 20 20 20 2d 2d 20  evision..    -- 
2830: 20 20 20 20 20 20 20 20 20 20 20 20 20 58 20 69               X i
2840: 73 20 74 68 65 20 73 61 6d 65 20 61 73 20 74 68  s the same as th
2850: 65 20 6c 69 6e 65 20 6f 66 20 64 65 76 65 6c 6f  e line of develo
2860: 70 6d 65 6e 74 0a 09 20 20 20 20 2d 2d 20 20 20  pment..    --   
2870: 20 20 20 20 20 20 20 20 20 20 20 6f 66 20 58 20             of X 
2880: 69 74 73 65 6c 66 2e 0a 09 7d 0a 0a 09 23 20 41  itself...}...# A
2890: 75 74 68 6f 72 73 20 61 6e 64 20 63 6f 6d 6d 69  uthors and commi
28a0: 74 20 6d 65 73 73 61 67 65 73 20 61 72 65 20 66  t messages are f
28b0: 75 6c 6c 79 20 67 6c 6f 62 61 6c 2c 20 69 2e 65  ully global, i.e
28c0: 2e 20 70 65 72 0a 09 23 20 72 65 70 6f 73 69 74  . per..# reposit
28d0: 6f 72 79 2e 0a 0a 09 73 74 61 74 65 20 77 72 69  ory....state wri
28e0: 74 69 6e 67 20 61 75 74 68 6f 72 20 7b 0a 09 20  ting author {.. 
28f0: 20 20 20 61 69 64 20 20 49 4e 54 45 47 45 52 20     aid  INTEGER 
2900: 20 4e 4f 54 20 4e 55 4c 4c 20 20 50 52 49 4d 41   NOT NULL  PRIMA
2910: 52 59 20 4b 45 59 20 20 41 55 54 4f 49 4e 43 52  RY KEY  AUTOINCR
2920: 45 4d 45 4e 54 2c 0a 09 20 20 20 20 6e 61 6d 65  EMENT,..    name
2930: 20 54 45 58 54 20 20 20 20 20 4e 4f 54 20 4e 55   TEXT     NOT NU
2940: 4c 4c 20 20 55 4e 49 51 55 45 0a 09 7d 0a 0a 09  LL  UNIQUE..}...
2950: 73 74 61 74 65 20 77 72 69 74 69 6e 67 20 63 6d  state writing cm
2960: 65 73 73 61 67 65 20 7b 0a 09 20 20 20 20 63 69  essage {..    ci
2970: 64 20 20 49 4e 54 45 47 45 52 20 20 4e 4f 54 20  d  INTEGER  NOT 
2980: 4e 55 4c 4c 20 20 50 52 49 4d 41 52 59 20 4b 45  NULL  PRIMARY KE
2990: 59 20 20 41 55 54 4f 49 4e 43 52 45 4d 45 4e 54  Y  AUTOINCREMENT
29a0: 2c 0a 09 20 20 20 20 74 65 78 74 20 54 45 58 54  ,..    text TEXT
29b0: 20 20 20 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 55       NOT NULL  U
29c0: 4e 49 51 55 45 0a 09 7d 0a 0a 09 70 72 6f 6a 65  NIQUE..}...proje
29d0: 63 74 3a 3a 73 79 6d 20 67 65 74 73 79 6d 74 79  ct::sym getsymty
29e0: 70 65 73 0a 09 66 69 6c 65 3a 3a 72 65 76 20 20  pes..file::rev  
29f0: 20 20 67 65 74 6f 70 63 6f 64 65 73 0a 09 72 65    getopcodes..re
2a00: 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20  turn.    }..    
2a10: 74 79 70 65 6d 65 74 68 6f 64 20 6c 6f 61 64 20  typemethod load 
2a20: 7b 7d 20 7b 0a 09 73 74 61 74 65 20 72 65 61 64  {} {..state read
2a30: 69 6e 67 20 73 79 6d 62 6f 6c 0a 09 73 74 61 74  ing symbol..stat
2a40: 65 20 72 65 61 64 69 6e 67 20 73 79 6d 74 79 70  e reading symtyp
2a50: 65 0a 09 73 74 61 74 65 20 72 65 61 64 69 6e 67  e..state reading
2a60: 20 6f 70 74 79 70 65 0a 0a 09 70 72 6f 6a 65 63   optype...projec
2a70: 74 3a 3a 73 79 6d 20 67 65 74 73 79 6d 74 79 70  t::sym getsymtyp
2a80: 65 73 0a 09 66 69 6c 65 3a 3a 72 65 76 20 20 20  es..file::rev   
2a90: 20 67 65 74 6f 70 63 6f 64 65 73 0a 09 72 65 70   getopcodes..rep
2aa0: 6f 73 69 74 6f 72 79 20 20 20 6c 6f 61 64 73 79  ository   loadsy
2ab0: 6d 62 6f 6c 73 0a 09 72 65 74 75 72 6e 0a 20 20  mbols..return.  
2ac0: 20 20 7d 0a 0a 20 20 20 20 74 79 70 65 6d 65 74    }..    typemet
2ad0: 68 6f 64 20 72 75 6e 20 7b 7d 20 7b 0a 09 23 20  hod run {} {..# 
2ae0: 50 61 73 73 20 6d 61 6e 61 67 65 72 20 69 6e 74  Pass manager int
2af0: 65 72 66 61 63 65 2e 20 45 78 65 63 75 74 65 64  erface. Executed
2b00: 20 74 6f 20 70 65 72 66 6f 72 6d 20 74 68 65 0a   to perform the.
2b10: 09 23 20 66 75 6e 63 74 69 6f 6e 61 6c 69 74 79  .# functionality
2b20: 20 6f 66 20 74 68 65 20 70 61 73 73 2e 0a 0a 09   of the pass....
2b30: 73 65 74 20 72 62 61 73 65 20 5b 72 65 70 6f 73  set rbase [repos
2b40: 69 74 6f 72 79 20 62 61 73 65 3f 5d 0a 09 66 6f  itory base?]..fo
2b50: 72 65 61 63 68 20 70 72 6f 6a 65 63 74 20 5b 72  reach project [r
2b60: 65 70 6f 73 69 74 6f 72 79 20 70 72 6f 6a 65 63  epository projec
2b70: 74 73 5d 20 7b 0a 09 20 20 20 20 73 65 74 20 62  ts] {..    set b
2b80: 61 73 65 20 5b 66 69 6c 65 20 6a 6f 69 6e 20 24  ase [file join $
2b90: 72 62 61 73 65 20 5b 24 70 72 6f 6a 65 63 74 20  rbase [$project 
2ba0: 62 61 73 65 5d 5d 0a 09 20 20 20 20 6c 6f 67 20  base]]..    log 
2bb0: 77 72 69 74 65 20 31 20 63 6f 6c 6c 72 65 76 20  write 1 collrev 
2bc0: 22 50 72 6f 63 65 73 73 69 6e 67 20 24 62 61 73  "Processing $bas
2bd0: 65 22 0a 0a 09 20 20 20 20 66 6f 72 65 61 63 68  e"...    foreach
2be0: 20 66 69 6c 65 20 5b 24 70 72 6f 6a 65 63 74 20   file [$project 
2bf0: 66 69 6c 65 73 5d 20 7b 0a 09 09 73 65 74 20 70  files] {...set p
2c00: 61 74 68 20 5b 24 66 69 6c 65 20 70 61 74 68 5d  ath [$file path]
2c10: 0a 09 09 6c 6f 67 20 77 72 69 74 65 20 32 20 63  ...log write 2 c
2c20: 6f 6c 6c 72 65 76 20 22 50 61 72 73 69 6e 67 20  ollrev "Parsing 
2c30: 24 70 61 74 68 22 0a 09 09 69 66 20 7b 5b 63 61  $path"...if {[ca
2c40: 74 63 68 20 7b 0a 09 09 20 20 20 20 70 61 72 73  tch {...    pars
2c50: 65 72 20 70 72 6f 63 65 73 73 20 5b 66 69 6c 65  er process [file
2c60: 20 6a 6f 69 6e 20 24 62 61 73 65 20 24 70 61 74   join $base $pat
2c70: 68 5d 20 24 66 69 6c 65 0a 09 09 7d 20 6d 73 67  h] $file...} msg
2c80: 5d 7d 20 7b 0a 09 09 20 20 20 20 67 6c 6f 62 61  ]} {...    globa
2c90: 6c 20 65 72 72 6f 72 43 6f 64 65 0a 09 09 20 20  l errorCode...  
2ca0: 20 20 69 66 20 7b 24 65 72 72 6f 72 43 6f 64 65    if {$errorCode
2cb0: 20 65 71 20 22 76 63 3a 3a 72 63 73 3a 3a 70 61   eq "vc::rcs::pa
2cc0: 72 73 65 72 22 7d 20 7b 0a 09 09 09 74 72 6f 75  rser"} {....trou
2cd0: 62 6c 65 20 66 61 74 61 6c 20 22 24 70 61 74 68  ble fatal "$path
2ce0: 20 69 73 20 6e 6f 74 20 61 20 76 61 6c 69 64 20   is not a valid 
2cf0: 52 43 53 20 61 72 63 68 69 76 65 20 28 24 6d 73  RCS archive ($ms
2d00: 67 29 22 0a 09 09 20 20 20 20 7d 20 65 6c 73 65  g)"...    } else
2d10: 20 7b 0a 09 09 09 67 6c 6f 62 61 6c 20 65 72 72   {....global err
2d20: 6f 72 49 6e 66 6f 0a 09 09 09 74 72 6f 75 62 6c  orInfo....troubl
2d30: 65 20 69 6e 74 65 72 6e 61 6c 20 24 65 72 72 6f  e internal $erro
2d40: 72 49 6e 66 6f 0a 09 09 20 20 20 20 7d 0a 09 09  rInfo...    }...
2d50: 7d 20 65 6c 73 65 20 7b 0a 09 09 20 20 20 20 23  } else {...    #
2d60: 20 57 65 20 70 65 72 73 69 73 74 20 74 68 65 20   We persist the 
2d70: 63 6f 72 65 20 6f 66 20 74 68 65 20 64 61 74 61  core of the data
2d80: 20 63 6f 6c 6c 65 63 74 65 64 20 61 62 6f 75 74   collected about
2d90: 0a 09 09 20 20 20 20 23 20 65 61 63 68 20 66 69  ...    # each fi
2da0: 6c 65 20 69 6d 6d 65 64 69 61 74 65 6c 79 20 61  le immediately a
2db0: 66 74 65 72 20 69 74 20 68 61 73 20 62 65 65 6e  fter it has been
2dc0: 20 70 61 72 73 65 64 0a 09 09 20 20 20 20 23 20   parsed...    # 
2dd0: 61 6e 64 20 77 72 61 6e 67 6c 65 64 20 69 6e 74  and wrangled int
2de0: 6f 20 73 68 61 70 65 2c 20 61 6e 64 20 74 68 65  o shape, and the
2df0: 6e 20 64 72 6f 70 20 69 74 20 66 72 6f 6d 0a 09  n drop it from..
2e00: 09 20 20 20 20 23 20 6d 65 6d 6f 72 79 2e 20 54  .    # memory. T
2e10: 68 69 73 20 69 73 20 64 6f 6e 65 20 74 6f 20 6b  his is done to k
2e20: 65 65 70 20 74 68 65 20 61 6d 6f 75 6e 74 20 6f  eep the amount o
2e30: 66 0a 09 09 20 20 20 20 23 20 72 65 71 75 69 72  f...    # requir
2e40: 65 64 20 6d 65 6d 6f 72 79 20 77 69 74 68 69 6e  ed memory within
2e50: 20 73 65 6e 73 69 62 6c 65 20 6c 69 6d 69 74 73   sensible limits
2e60: 2e 20 57 69 74 68 6f 75 74 0a 09 09 20 20 20 20  . Without...    
2e70: 23 20 64 6f 69 6e 67 20 69 74 20 74 68 69 73 20  # doing it this 
2e80: 77 61 79 20 77 65 20 77 6f 75 6c 64 20 65 61 73  way we would eas
2e90: 69 6c 79 20 67 6f 62 62 6c 65 20 75 70 20 31 47  ily gobble up 1G
2ea0: 0a 09 09 20 20 20 20 23 20 6f 66 20 52 41 4d 20  ...    # of RAM 
2eb0: 6f 72 20 6d 6f 72 65 20 77 69 74 68 20 61 6c 6c  or more with all
2ec0: 20 74 68 65 20 6f 62 6a 65 63 74 73 20 28 72 65   the objects (re
2ed0: 76 69 73 69 6f 6e 73 0a 09 09 20 20 20 20 23 20  visions...    # 
2ee0: 61 6e 64 20 66 69 6c 65 2d 6c 65 76 65 6c 20 73  and file-level s
2ef0: 79 6d 62 6f 6c 73 29 2e 0a 0a 09 09 20 20 20 20  ymbols).....    
2f00: 24 66 69 6c 65 20 70 65 72 73 69 73 74 0a 09 09  $file persist...
2f10: 7d 0a 0a 09 09 24 66 69 6c 65 20 64 72 6f 70 0a  }....$file drop.
2f20: 09 20 20 20 20 7d 0a 0a 09 20 20 20 20 24 70 72  .    }...    $pr
2f30: 6f 6a 65 63 74 20 70 75 72 67 65 67 68 6f 73 74  oject purgeghost
2f40: 73 79 6d 62 6f 6c 73 0a 09 7d 0a 0a 09 72 65 70  symbols..}...rep
2f50: 6f 73 69 74 6f 72 79 20 70 72 69 6e 74 72 65 76  ository printrev
2f60: 73 74 61 74 69 73 74 69 63 73 0a 09 72 65 70 6f  statistics..repo
2f70: 73 69 74 6f 72 79 20 70 65 72 73 69 73 74 72 65  sitory persistre
2f80: 76 0a 09 69 6e 74 65 67 72 69 74 79 20 20 73 74  v..integrity  st
2f90: 72 69 63 74 0a 0a 09 6c 6f 67 20 77 72 69 74 65  rict...log write
2fa0: 20 31 20 63 6f 6c 6c 72 65 76 20 22 53 63 61 6e   1 collrev "Scan
2fb0: 20 63 6f 6d 70 6c 65 74 65 64 22 0a 09 72 65 74   completed"..ret
2fc0: 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 74  urn.    }..    t
2fd0: 79 70 65 6d 65 74 68 6f 64 20 64 69 73 63 61 72  ypemethod discar
2fe0: 64 20 7b 7d 20 7b 0a 09 23 20 50 61 73 73 20 6d  d {} {..# Pass m
2ff0: 61 6e 61 67 65 72 20 69 6e 74 65 72 66 61 63 65  anager interface
3000: 2e 20 45 78 65 63 75 74 65 64 20 66 6f 72 20 61  . Executed for a
3010: 6c 6c 20 70 61 73 73 65 73 20 61 66 74 65 72 20  ll passes after 
3020: 74 68 65 0a 09 23 20 72 75 6e 20 70 61 73 73 65  the..# run passe
3030: 73 2c 20 74 6f 20 72 65 6d 6f 76 65 20 61 6c 6c  s, to remove all
3040: 20 64 61 74 61 20 6f 66 20 74 68 69 73 20 70 61   data of this pa
3050: 73 73 20 66 72 6f 6d 20 74 68 65 20 73 74 61 74  ss from the stat
3060: 65 2c 0a 09 23 20 61 73 20 62 65 69 6e 67 20 6f  e,..# as being o
3070: 75 74 20 6f 66 20 64 61 74 65 2e 0a 0a 09 73 74  ut of date....st
3080: 61 74 65 20 64 69 73 63 61 72 64 20 72 65 76 69  ate discard revi
3090: 73 69 6f 6e 0a 09 73 74 61 74 65 20 64 69 73 63  sion..state disc
30a0: 61 72 64 20 74 61 67 0a 09 73 74 61 74 65 20 64  ard tag..state d
30b0: 69 73 63 61 72 64 20 62 72 61 6e 63 68 0a 09 73  iscard branch..s
30c0: 74 61 74 65 20 64 69 73 63 61 72 64 20 73 79 6d  tate discard sym
30d0: 62 6f 6c 0a 09 73 74 61 74 65 20 64 69 73 63 61  bol..state disca
30e0: 72 64 20 62 6c 6f 63 6b 65 72 0a 09 73 74 61 74  rd blocker..stat
30f0: 65 20 64 69 73 63 61 72 64 20 70 61 72 65 6e 74  e discard parent
3100: 0a 09 73 74 61 74 65 20 64 69 73 63 61 72 64 20  ..state discard 
3110: 73 79 6d 74 79 70 65 0a 09 73 74 61 74 65 20 64  symtype..state d
3120: 69 73 63 61 72 64 20 6d 65 74 61 0a 09 73 74 61  iscard meta..sta
3130: 74 65 20 64 69 73 63 61 72 64 20 61 75 74 68 6f  te discard autho
3140: 72 0a 09 73 74 61 74 65 20 64 69 73 63 61 72 64  r..state discard
3150: 20 63 6d 65 73 73 61 67 65 0a 09 72 65 74 75 72   cmessage..retur
3160: 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 70 72 6f  n.    }..    pro
3170: 63 20 50 61 72 61 6e 6f 69 61 20 7b 7d 20 7b 0a  c Paranoia {} {.
3180: 09 23 20 54 68 69 73 20 63 6f 64 65 20 70 65 72  .# This code per
3190: 66 6f 72 6d 73 20 61 20 6e 75 6d 62 65 72 20 6f  forms a number o
31a0: 66 20 70 61 72 61 6e 6f 69 64 20 63 68 65 63 6b  f paranoid check
31b0: 73 20 6f 66 20 74 68 65 0a 09 23 20 64 61 74 61  s of the..# data
31c0: 62 61 73 65 2c 20 73 65 61 72 63 68 69 6e 67 20  base, searching 
31d0: 66 6f 72 20 69 6e 63 6f 6e 73 69 73 74 65 6e 74  for inconsistent
31e0: 20 63 72 6f 73 73 2d 72 65 66 65 72 65 6e 63 65   cross-reference
31f0: 73 2e 0a 09 6c 6f 67 20 77 72 69 74 65 20 34 20  s...log write 4 
3200: 63 6f 6c 6c 72 65 76 20 7b 43 68 65 63 6b 20 64  collrev {Check d
3210: 61 74 61 62 61 73 65 20 63 6f 6e 73 69 73 74 65  atabase consiste
3220: 6e 63 79 7d 0a 0a 09 73 65 74 20 6e 20 30 20 3b  ncy}...set n 0 ;
3230: 20 23 20 43 6f 75 6e 74 65 72 20 66 6f 72 20 74   # Counter for t
3240: 68 65 20 63 68 65 63 6b 73 20 28 77 65 20 70 72  he checks (we pr
3250: 69 6e 74 20 61 6e 20 69 64 20 62 65 66 6f 72 65  int an id before
3260: 20 74 68 65 0a 09 09 20 20 23 20 6d 61 69 6e 20   the...  # main 
3270: 6c 61 62 65 6c 29 2e 0a 0a 09 23 20 46 69 6e 64  label)....# Find
3280: 20 61 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 77   all revisions w
3290: 68 69 63 68 20 64 69 73 61 67 72 65 65 20 77 69  hich disagree wi
32a0: 74 68 20 74 68 65 69 72 20 6c 69 6e 65 20 6f 66  th their line of
32b0: 0a 09 23 20 64 65 76 65 6c 6f 70 6d 65 6e 74 20  ..# development 
32c0: 61 62 6f 75 74 20 74 68 65 20 70 72 6f 6a 65 63  about the projec
32d0: 74 20 74 68 65 79 20 61 72 65 20 6f 77 6e 65 64  t they are owned
32e0: 20 62 79 2e 0a 09 43 68 65 63 6b 20 5c 0a 09 20   by...Check \.. 
32f0: 20 20 20 7b 52 65 76 69 73 69 6f 6e 73 20 61 6e     {Revisions an
3300: 64 20 74 68 65 69 72 20 4c 4f 44 73 20 68 61 76  d their LODs hav
3310: 65 20 74 6f 20 62 65 20 69 6e 20 74 68 65 20 73  e to be in the s
3320: 61 6d 65 20 70 72 6f 6a 65 63 74 7d 20 5c 0a 09  ame project} \..
3330: 20 20 20 20 7b 64 69 73 61 67 72 65 65 73 20 77      {disagrees w
3340: 69 74 68 20 69 74 73 20 4c 4f 44 20 61 62 6f 75  ith its LOD abou
3350: 74 20 6f 77 6e 69 6e 67 20 70 72 6f 6a 65 63 74  t owning project
3360: 7d 20 7b 0a 09 09 53 45 4c 45 43 54 20 46 2e 6e  } {...SELECT F.n
3370: 61 6d 65 2c 20 52 2e 72 65 76 0a 09 09 46 52 4f  ame, R.rev...FRO
3380: 4d 20 72 65 76 69 73 69 6f 6e 20 52 2c 20 66 69  M revision R, fi
3390: 6c 65 20 46 2c 20 73 79 6d 62 6f 6c 20 53 0a 09  le F, symbol S..
33a0: 09 57 48 45 52 45 20 52 2e 66 69 64 20 3d 20 46  .WHERE R.fid = F
33b0: 2e 66 69 64 0a 09 09 41 4e 44 20 20 20 52 2e 6c  .fid...AND   R.l
33c0: 6f 64 20 3d 20 53 2e 73 69 64 0a 09 09 41 4e 44  od = S.sid...AND
33d0: 20 20 20 46 2e 70 69 64 20 21 3d 20 53 2e 70 69     F.pid != S.pi
33e0: 64 0a 09 09 3b 0a 09 20 20 20 20 7d 0a 09 23 20  d...;..    }..# 
33f0: 46 69 6e 64 20 61 6c 6c 20 72 65 76 69 73 69 6f  Find all revisio
3400: 6e 73 20 77 68 69 63 68 20 64 69 73 67 72 65 65  ns which disgree
3410: 20 77 69 74 68 20 74 68 65 69 72 20 6d 65 74 61   with their meta
3420: 20 64 61 74 61 20 61 62 6f 75 74 0a 09 23 20 74   data about..# t
3430: 68 65 20 70 72 6f 6a 65 63 74 20 74 68 65 79 20  he project they 
3440: 61 72 65 20 6f 77 6e 65 64 20 62 79 2e 0a 09 43  are owned by...C
3450: 68 65 63 6b 20 5c 0a 09 20 20 20 20 7b 52 65 76  heck \..    {Rev
3460: 69 73 69 6f 6e 73 20 61 6e 64 20 74 68 65 69 72  isions and their
3470: 20 6d 65 74 61 20 64 61 74 61 20 68 61 76 65 20   meta data have 
3480: 74 6f 20 62 65 20 69 6e 20 74 68 65 20 73 61 6d  to be in the sam
3490: 65 20 70 72 6f 6a 65 63 74 7d 20 5c 0a 09 20 20  e project} \..  
34a0: 20 20 7b 64 69 73 61 67 72 65 65 73 20 77 69 74    {disagrees wit
34b0: 68 20 69 74 73 20 6d 65 74 61 20 64 61 74 61 20  h its meta data 
34c0: 61 62 6f 75 74 20 6f 77 6e 69 6e 67 20 70 72 6f  about owning pro
34d0: 6a 65 63 74 7d 20 7b 0a 09 09 53 45 4c 45 43 54  ject} {...SELECT
34e0: 20 46 2e 6e 61 6d 65 2c 20 52 2e 72 65 76 0a 09   F.name, R.rev..
34f0: 09 46 52 4f 4d 20 72 65 76 69 73 69 6f 6e 20 52  .FROM revision R
3500: 2c 20 66 69 6c 65 20 46 2c 20 6d 65 74 61 20 4d  , file F, meta M
3510: 0a 09 09 57 48 45 52 45 20 52 2e 66 69 64 20 3d  ...WHERE R.fid =
3520: 20 46 2e 66 69 64 0a 09 09 41 4e 44 20 20 20 52   F.fid...AND   R
3530: 2e 6d 69 64 20 3d 20 4d 2e 6d 69 64 0a 09 09 41  .mid = M.mid...A
3540: 4e 44 20 20 20 46 2e 70 69 64 20 21 3d 20 4d 2e  ND   F.pid != M.
3550: 70 69 64 0a 09 09 3b 0a 09 20 20 20 20 7d 0a 09  pid...;..    }..
3560: 23 20 46 69 6e 64 20 61 6c 6c 20 72 65 76 69 73  # Find all revis
3570: 69 6f 6e 73 20 77 68 69 63 68 20 64 69 73 67 72  ions which disgr
3580: 65 65 20 77 69 74 68 20 74 68 65 69 72 20 6d 65  ee with their me
3590: 74 61 20 64 61 74 61 20 61 62 6f 75 74 0a 09 23  ta data about..#
35a0: 20 74 68 65 20 62 72 61 6e 63 68 2f 6c 69 6e 65   the branch/line
35b0: 20 6f 66 20 64 65 76 65 6c 6f 70 6d 65 6e 74 20   of development 
35c0: 74 68 65 79 20 62 65 6c 6f 6e 67 20 74 6f 2e 0a  they belong to..
35d0: 09 43 68 65 63 6b 20 5c 0a 09 20 20 20 20 7b 52  .Check \..    {R
35e0: 65 76 69 73 69 6f 6e 73 20 61 6e 64 20 74 68 65  evisions and the
35f0: 69 72 20 6d 65 74 61 20 64 61 74 61 20 68 61 76  ir meta data hav
3600: 65 20 74 6f 20 62 65 20 69 6e 20 74 68 65 20 73  e to be in the s
3610: 61 6d 65 20 4c 4f 44 7d 20 5c 0a 09 20 20 20 20  ame LOD} \..    
3620: 7b 64 69 73 61 67 72 65 65 73 20 77 69 74 68 20  {disagrees with 
3630: 69 74 73 20 6d 65 74 61 20 64 61 74 61 20 61 62  its meta data ab
3640: 6f 75 74 20 6f 77 6e 69 6e 67 20 4c 4f 44 7d 20  out owning LOD} 
3650: 7b 0a 09 09 53 45 4c 45 43 54 20 46 2e 6e 61 6d  {...SELECT F.nam
3660: 65 2c 20 52 2e 72 65 76 0a 09 09 46 52 4f 4d 20  e, R.rev...FROM 
3670: 72 65 76 69 73 69 6f 6e 20 52 2c 20 6d 65 74 61  revision R, meta
3680: 20 4d 2c 20 66 69 6c 65 20 46 0a 09 09 57 48 45   M, file F...WHE
3690: 52 45 20 52 2e 6d 69 64 20 3d 20 4d 2e 6d 69 64  RE R.mid = M.mid
36a0: 0a 09 09 41 4e 44 20 20 20 52 2e 6c 6f 64 20 21  ...AND   R.lod !
36b0: 3d 20 4d 2e 62 69 64 0a 09 09 41 4e 44 20 20 20  = M.bid...AND   
36c0: 52 2e 66 69 64 20 3d 20 46 2e 66 69 64 0a 09 09  R.fid = F.fid...
36d0: 3b 0a 09 20 20 20 20 7d 0a 09 23 20 46 69 6e 64  ;..    }..# Find
36e0: 20 61 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 77   all revisions w
36f0: 69 74 68 20 61 20 70 72 69 6d 61 72 79 20 63 68  ith a primary ch
3700: 69 6c 64 20 77 68 69 63 68 20 64 69 73 61 67 72  ild which disagr
3710: 65 65 73 0a 09 23 20 61 62 6f 75 74 20 74 68 65  ees..# about the
3720: 20 66 69 6c 65 20 74 68 65 79 20 62 65 6c 6f 6e   file they belon
3730: 67 20 74 6f 2e 0a 09 43 68 65 63 6b 20 5c 0a 09  g to...Check \..
3740: 20 20 20 20 7b 52 65 76 69 73 69 6f 6e 73 20 61      {Revisions a
3750: 6e 64 20 74 68 65 69 72 20 70 72 69 6d 61 72 79  nd their primary
3760: 20 63 68 69 6c 64 72 65 6e 20 68 61 76 65 20 74   children have t
3770: 6f 20 62 65 20 69 6e 20 74 68 65 20 73 61 6d 65  o be in the same
3780: 20 66 69 6c 65 7d 20 5c 0a 09 20 20 20 20 7b 64   file} \..    {d
3790: 69 73 61 67 72 65 65 73 20 77 69 74 68 20 69 74  isagrees with it
37a0: 73 20 70 72 69 6d 61 72 79 20 63 68 69 6c 64 20  s primary child 
37b0: 61 62 6f 75 74 20 74 68 65 20 6f 77 6e 69 6e 67  about the owning
37c0: 20 66 69 6c 65 7d 20 7b 0a 09 09 53 45 4c 45 43   file} {...SELEC
37d0: 54 20 46 2e 6e 61 6d 65 2c 20 52 2e 72 65 76 0a  T F.name, R.rev.
37e0: 09 09 46 52 4f 4d 20 72 65 76 69 73 69 6f 6e 20  ..FROM revision 
37f0: 52 2c 20 72 65 76 69 73 69 6f 6e 20 43 2c 20 66  R, revision C, f
3800: 69 6c 65 20 46 0a 09 09 57 48 45 52 45 20 52 2e  ile F...WHERE R.
3810: 66 69 64 20 3d 20 46 2e 66 69 64 0a 09 09 41 4e  fid = F.fid...AN
3820: 44 20 20 20 52 2e 63 68 69 6c 64 20 49 53 20 4e  D   R.child IS N
3830: 4f 54 20 4e 55 4c 4c 0a 09 09 41 4e 44 20 20 20  OT NULL...AND   
3840: 52 2e 63 68 69 6c 64 20 3d 20 43 2e 72 69 64 0a  R.child = C.rid.
3850: 09 09 41 4e 44 20 20 20 43 2e 66 69 64 20 21 3d  ..AND   C.fid !=
3860: 20 52 2e 66 69 64 0a 09 09 3b 0a 09 20 20 20 20   R.fid...;..    
3870: 7d 0a 0a 09 23 20 46 69 6e 64 20 61 6c 6c 20 72  }...# Find all r
3880: 65 76 69 73 69 6f 6e 73 20 77 69 74 68 20 61 20  evisions with a 
3890: 62 72 61 6e 63 68 20 70 61 72 65 6e 74 20 73 79  branch parent sy
38a0: 6d 62 6f 6c 20 77 68 6f 73 65 20 70 61 72 65 6e  mbol whose paren
38b0: 74 0a 09 23 20 64 69 73 61 67 72 65 65 73 20 61  t..# disagrees a
38c0: 62 6f 75 74 20 74 68 65 20 66 69 6c 65 20 74 68  bout the file th
38d0: 65 79 20 62 65 6c 6f 6e 67 20 74 6f 2e 0a 09 43  ey belong to...C
38e0: 68 65 63 6b 20 5c 0a 09 20 20 20 20 7b 52 65 76  heck \..    {Rev
38f0: 69 73 69 6f 6e 73 20 61 6e 64 20 74 68 65 69 72  isions and their
3900: 20 62 72 61 6e 63 68 20 63 68 69 6c 64 72 65 6e   branch children
3910: 20 68 61 76 65 20 74 6f 20 62 65 20 69 6e 20 74   have to be in t
3920: 68 65 20 73 61 6d 65 20 66 69 6c 65 7d 20 5c 0a  he same file} \.
3930: 09 20 20 20 20 7b 61 74 20 74 68 65 20 62 65 67  .    {at the beg
3940: 69 6e 6e 69 6e 67 20 6f 66 20 69 74 73 20 62 72  inning of its br
3950: 61 6e 63 68 20 61 6e 64 20 69 74 73 20 70 61 72  anch and its par
3960: 65 6e 74 20 64 69 73 61 67 72 65 65 20 61 62 6f  ent disagree abo
3970: 75 74 20 74 68 65 20 6f 77 6e 69 6e 67 20 66 69  ut the owning fi
3980: 6c 65 7d 20 7b 0a 09 09 53 45 4c 45 43 54 20 46  le} {...SELECT F
3990: 2e 6e 61 6d 65 2c 20 52 2e 72 65 76 0a 09 09 46  .name, R.rev...F
39a0: 52 4f 4d 20 72 65 76 69 73 69 6f 6e 20 52 2c 20  ROM revision R, 
39b0: 72 65 76 69 73 69 6f 6e 20 50 2c 20 66 69 6c 65  revision P, file
39c0: 20 46 0a 09 09 57 48 45 52 45 20 52 2e 66 69 64   F...WHERE R.fid
39d0: 20 3d 20 46 2e 66 69 64 0a 09 09 41 4e 44 20 20   = F.fid...AND  
39e0: 20 52 2e 62 70 61 72 65 6e 74 20 49 53 20 4e 4f   R.bparent IS NO
39f0: 54 20 4e 55 4c 4c 0a 09 09 41 4e 44 20 20 20 52  T NULL...AND   R
3a00: 2e 70 61 72 65 6e 74 20 3d 20 50 2e 72 69 64 0a  .parent = P.rid.
3a10: 09 09 41 4e 44 20 20 20 52 2e 66 69 64 20 21 3d  ..AND   R.fid !=
3a20: 20 50 2e 66 69 64 0a 09 09 3b 0a 09 20 20 20 20   P.fid...;..    
3a30: 7d 0a 09 23 20 46 69 6e 64 20 61 6c 6c 20 72 65  }..# Find all re
3a40: 76 69 73 69 6f 6e 73 20 77 69 74 68 20 61 20 6e  visions with a n
3a50: 6f 6e 2d 4e 54 44 42 20 63 68 69 6c 64 20 77 68  on-NTDB child wh
3a60: 69 63 68 20 64 69 73 61 67 72 65 65 73 0a 09 23  ich disagrees..#
3a70: 20 61 62 6f 75 74 20 74 68 65 20 66 69 6c 65 20   about the file 
3a80: 74 68 65 79 20 62 65 6c 6f 6e 67 20 74 6f 2e 0a  they belong to..
3a90: 09 43 68 65 63 6b 20 5c 0a 09 20 20 20 20 7b 52  .Check \..    {R
3aa0: 65 76 69 73 69 6f 6e 73 20 61 6e 64 20 74 68 65  evisions and the
3ab0: 69 72 20 6e 6f 6e 2d 4e 54 44 42 20 63 68 69 6c  ir non-NTDB chil
3ac0: 64 72 65 6e 20 68 61 76 65 20 74 6f 20 62 65 20  dren have to be 
3ad0: 69 6e 20 74 68 65 20 73 61 6d 65 20 66 69 6c 65  in the same file
3ae0: 7d 20 5c 0a 09 20 20 20 20 7b 64 69 73 61 67 72  } \..    {disagr
3af0: 65 65 73 20 77 69 74 68 20 69 74 73 20 6e 6f 6e  ees with its non
3b00: 2d 4e 54 44 42 20 63 68 69 6c 64 20 61 62 6f 75  -NTDB child abou
3b10: 74 20 74 68 65 20 6f 77 6e 69 6e 67 20 66 69 6c  t the owning fil
3b20: 65 7d 20 7b 0a 09 09 53 45 4c 45 43 54 20 46 2e  e} {...SELECT F.
3b30: 6e 61 6d 65 2c 20 52 2e 72 65 76 0a 09 09 46 52  name, R.rev...FR
3b40: 4f 4d 20 72 65 76 69 73 69 6f 6e 20 52 2c 20 72  OM revision R, r
3b50: 65 76 69 73 69 6f 6e 20 43 2c 20 66 69 6c 65 20  evision C, file 
3b60: 46 0a 09 09 57 48 45 52 45 20 52 2e 66 69 64 20  F...WHERE R.fid 
3b70: 3d 20 46 2e 66 69 64 0a 09 09 41 4e 44 20 20 20  = F.fid...AND   
3b80: 52 2e 64 62 63 68 69 6c 64 20 49 53 20 4e 4f 54  R.dbchild IS NOT
3b90: 20 4e 55 4c 4c 0a 09 09 41 4e 44 20 20 20 52 2e   NULL...AND   R.
3ba0: 64 62 63 68 69 6c 64 20 3d 20 43 2e 72 69 64 0a  dbchild = C.rid.
3bb0: 09 09 41 4e 44 20 20 20 43 2e 66 69 64 20 21 3d  ..AND   C.fid !=
3bc0: 20 52 2e 66 69 64 0a 09 09 3b 0a 09 20 20 20 20   R.fid...;..    
3bd0: 7d 0a 09 23 20 46 69 6e 64 20 61 6c 6c 20 72 65  }..# Find all re
3be0: 76 69 73 69 6f 6e 73 20 77 68 69 63 68 20 68 61  visions which ha
3bf0: 76 65 20 61 20 70 72 69 6d 61 72 79 20 63 68 69  ve a primary chi
3c00: 6c 64 2c 20 62 75 74 20 74 68 65 20 63 68 69 6c  ld, but the chil
3c10: 64 0a 09 23 20 64 6f 65 73 20 6e 6f 74 20 68 61  d..# does not ha
3c20: 76 65 20 74 68 65 6d 20 61 73 20 70 61 72 65 6e  ve them as paren
3c30: 74 2e 0a 09 43 68 65 63 6b 20 5c 0a 09 20 20 20  t...Check \..   
3c40: 20 7b 52 65 76 69 73 69 6f 6e 73 20 68 61 76 65   {Revisions have
3c50: 20 74 6f 20 62 65 20 70 61 72 65 6e 74 73 20 6f   to be parents o
3c60: 66 20 74 68 65 69 72 20 70 72 69 6d 61 72 79 20  f their primary 
3c70: 63 68 69 6c 64 72 65 6e 7d 20 5c 0a 09 20 20 20  children} \..   
3c80: 20 7b 69 73 20 6e 6f 74 20 74 68 65 20 70 61 72   {is not the par
3c90: 65 6e 74 20 6f 66 20 69 74 73 20 70 72 69 6d 61  ent of its prima
3ca0: 72 79 20 63 68 69 6c 64 7d 20 7b 0a 09 09 53 45  ry child} {...SE
3cb0: 4c 45 43 54 20 46 2e 6e 61 6d 65 2c 20 52 2e 72  LECT F.name, R.r
3cc0: 65 76 0a 09 09 46 52 4f 4d 20 72 65 76 69 73 69  ev...FROM revisi
3cd0: 6f 6e 20 52 2c 20 72 65 76 69 73 69 6f 6e 20 43  on R, revision C
3ce0: 2c 20 66 69 6c 65 20 46 0a 09 09 57 48 45 52 45  , file F...WHERE
3cf0: 20 52 2e 66 69 64 20 3d 20 46 2e 66 69 64 0a 09   R.fid = F.fid..
3d00: 09 41 4e 44 20 20 20 52 2e 63 68 69 6c 64 20 49  .AND   R.child I
3d10: 53 20 4e 4f 54 20 4e 55 4c 4c 0a 09 09 41 4e 44  S NOT NULL...AND
3d20: 20 20 20 52 2e 63 68 69 6c 64 20 3d 20 43 2e 72     R.child = C.r
3d30: 69 64 0a 09 09 41 4e 44 20 20 20 43 2e 70 61 72  id...AND   C.par
3d40: 65 6e 74 20 21 3d 20 52 2e 72 69 64 0a 09 09 3b  ent != R.rid...;
3d50: 0a 09 20 20 20 20 7d 0a 09 23 20 46 69 6e 64 20  ..    }..# Find 
3d60: 61 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 77 68  all revisions wh
3d70: 69 63 68 20 68 61 76 65 20 61 20 70 72 69 6d 72  ich have a primr
3d80: 61 72 79 20 63 68 69 6c 64 2c 20 62 75 74 20 74  ary child, but t
3d90: 68 65 0a 09 23 20 63 68 69 6c 64 20 68 61 73 20  he..# child has 
3da0: 61 20 62 72 61 6e 63 68 20 70 61 72 65 6e 74 20  a branch parent 
3db0: 73 79 6d 62 6f 6c 20 6d 61 6b 69 6e 67 20 74 68  symbol making th
3dc0: 65 6d 20 62 72 61 63 68 20 73 74 61 72 74 65 72  em brach starter
3dd0: 73 2e 0a 09 43 68 65 63 6b 20 5c 0a 09 20 20 20  s...Check \..   
3de0: 20 7b 50 72 69 6d 61 72 79 20 63 68 69 6c 64 72   {Primary childr
3df0: 65 6e 20 6f 66 20 72 65 76 69 73 69 6f 6e 73 20  en of revisions 
3e00: 6d 75 73 74 20 6e 6f 74 20 73 74 61 72 74 20 62  must not start b
3e10: 72 61 6e 63 68 65 73 7d 20 5c 0a 09 20 20 20 20  ranches} \..    
3e20: 7b 69 73 20 70 61 72 65 6e 74 20 6f 66 20 61 20  {is parent of a 
3e30: 70 72 69 6d 61 72 79 20 63 68 69 6c 64 20 77 68  primary child wh
3e40: 69 63 68 20 69 73 20 74 68 65 20 62 65 67 69 6e  ich is the begin
3e50: 6e 69 6e 67 20 6f 66 20 61 20 62 72 61 6e 63 68  ning of a branch
3e60: 7d 20 7b 0a 09 09 53 45 4c 45 43 54 20 46 2e 6e  } {...SELECT F.n
3e70: 61 6d 65 2c 20 52 2e 72 65 76 0a 09 09 46 52 4f  ame, R.rev...FRO
3e80: 4d 20 72 65 76 69 73 69 6f 6e 20 52 2c 20 72 65  M revision R, re
3e90: 76 69 73 69 6f 6e 20 43 2c 20 66 69 6c 65 20 46  vision C, file F
3ea0: 0a 09 09 57 48 45 52 45 20 52 2e 66 69 64 20 3d  ...WHERE R.fid =
3eb0: 20 46 2e 66 69 64 0a 09 09 41 4e 44 20 20 20 52   F.fid...AND   R
3ec0: 2e 63 68 69 6c 64 20 49 53 20 4e 4f 54 20 4e 55  .child IS NOT NU
3ed0: 4c 4c 0a 09 09 41 4e 44 20 20 20 52 2e 63 68 69  LL...AND   R.chi
3ee0: 6c 64 20 3d 20 43 2e 72 69 64 0a 09 09 41 4e 44  ld = C.rid...AND
3ef0: 20 20 20 43 2e 62 70 61 72 65 6e 74 20 49 53 20     C.bparent IS 
3f00: 4e 4f 54 20 4e 55 4c 4c 0a 09 09 3b 0a 09 20 20  NOT NULL...;..  
3f10: 20 20 7d 0a 09 23 20 46 69 6e 64 20 61 6c 6c 20    }..# Find all 
3f20: 72 65 76 69 73 69 6f 6e 73 20 77 69 74 68 6f 75  revisions withou
3f30: 74 20 62 72 61 6e 63 68 20 70 61 72 65 6e 74 20  t branch parent 
3f40: 73 79 6d 62 6f 6c 20 77 68 69 63 68 20 68 61 76  symbol which hav
3f50: 65 20 61 0a 09 23 20 70 61 72 65 6e 74 2c 20 62  e a..# parent, b
3f60: 75 74 20 74 68 65 20 70 61 72 65 6e 74 20 64 6f  ut the parent do
3f70: 65 73 20 6e 6f 74 20 68 61 76 65 20 74 68 65 6d  es not have them
3f80: 20 61 73 20 70 72 69 6d 61 72 79 20 63 68 69 6c   as primary chil
3f90: 64 2e 0a 09 43 68 65 63 6b 20 5c 0a 09 20 20 20  d...Check \..   
3fa0: 20 7b 52 65 76 69 73 69 6f 6e 73 20 68 61 76 65   {Revisions have
3fb0: 20 74 6f 20 62 65 20 70 72 69 6d 61 72 79 20 63   to be primary c
3fc0: 68 69 6c 64 72 65 6e 20 6f 66 20 74 68 65 69 72  hildren of their
3fd0: 20 70 61 72 65 6e 74 73 2c 20 69 66 20 61 6e 79   parents, if any
3fe0: 7d 20 5c 0a 09 20 20 20 20 7b 69 73 20 6e 6f 74  } \..    {is not
3ff0: 20 74 68 65 20 63 68 69 6c 64 20 6f 66 20 69 74   the child of it
4000: 73 20 70 61 72 65 6e 74 7d 20 7b 0a 09 09 53 45  s parent} {...SE
4010: 4c 45 43 54 20 46 2e 6e 61 6d 65 2c 20 52 2e 72  LECT F.name, R.r
4020: 65 76 0a 09 09 46 52 4f 4d 20 72 65 76 69 73 69  ev...FROM revisi
4030: 6f 6e 20 52 2c 20 72 65 76 69 73 69 6f 6e 20 50  on R, revision P
4040: 2c 20 66 69 6c 65 20 46 0a 09 09 57 48 45 52 45  , file F...WHERE
4050: 20 52 2e 66 69 64 20 3d 20 46 2e 66 69 64 0a 09   R.fid = F.fid..
4060: 09 41 4e 44 20 20 20 52 2e 62 70 61 72 65 6e 74  .AND   R.bparent
4070: 20 49 53 20 4e 55 4c 4c 0a 09 09 41 4e 44 20 20   IS NULL...AND  
4080: 20 52 2e 70 61 72 65 6e 74 20 49 53 20 4e 4f 54   R.parent IS NOT
4090: 20 4e 55 4c 4c 0a 09 09 41 4e 44 20 20 20 52 2e   NULL...AND   R.
40a0: 70 61 72 65 6e 74 20 3d 20 50 2e 72 69 64 0a 09  parent = P.rid..
40b0: 09 41 4e 44 20 20 20 50 2e 63 68 69 6c 64 20 21  .AND   P.child !
40c0: 3d 20 52 2e 72 69 64 0a 09 09 3b 0a 09 20 20 20  = R.rid...;..   
40d0: 20 7d 0a 09 23 20 46 69 6e 64 20 61 6c 6c 20 72   }..# Find all r
40e0: 65 76 69 73 69 6f 6e 73 20 77 69 74 68 20 61 20  evisions with a 
40f0: 62 72 61 6e 63 68 20 70 61 72 65 6e 74 20 73 79  branch parent sy
4100: 6d 62 6f 6c 20 77 68 69 63 68 20 64 6f 20 6e 6f  mbol which do no
4110: 74 0a 09 23 20 68 61 76 65 20 61 20 70 61 72 65  t..# have a pare
4120: 6e 74 2e 0a 09 43 68 65 63 6b 20 5c 0a 09 20 20  nt...Check \..  
4130: 20 20 7b 42 72 61 6e 63 68 20 73 74 61 72 74 69    {Branch starti
4140: 6e 67 20 72 65 76 69 73 69 6f 6e 73 20 68 61 76  ng revisions hav
4150: 65 20 74 6f 20 68 61 76 65 20 61 20 70 61 72 65  e to have a pare
4160: 6e 74 7d 20 5c 0a 09 20 20 20 20 7b 61 74 20 74  nt} \..    {at t
4170: 68 65 20 62 65 67 69 6e 6e 69 6e 67 20 6f 66 20  he beginning of 
4180: 69 74 73 20 62 72 61 6e 63 68 20 68 61 73 20 6e  its branch has n
4190: 6f 20 70 61 72 65 6e 74 7d 20 7b 0a 09 09 53 45  o parent} {...SE
41a0: 4c 45 43 54 20 46 2e 6e 61 6d 65 2c 20 52 2e 72  LECT F.name, R.r
41b0: 65 76 0a 09 09 46 52 4f 4d 20 72 65 76 69 73 69  ev...FROM revisi
41c0: 6f 6e 20 52 2c 20 66 69 6c 65 20 46 0a 09 09 57  on R, file F...W
41d0: 48 45 52 45 20 52 2e 66 69 64 20 3d 20 46 2e 66  HERE R.fid = F.f
41e0: 69 64 0a 09 09 41 4e 44 20 20 20 52 2e 62 70 61  id...AND   R.bpa
41f0: 72 65 6e 74 20 49 53 20 4e 4f 54 20 4e 55 4c 4c  rent IS NOT NULL
4200: 0a 09 09 41 4e 44 20 20 20 52 2e 70 61 72 65 6e  ...AND   R.paren
4210: 74 20 49 53 20 4e 55 4c 4c 0a 09 09 3b 0a 09 20  t IS NULL...;.. 
4220: 20 20 20 7d 0a 09 23 20 46 69 6e 64 20 61 6c 6c     }..# Find all
4230: 20 72 65 76 69 73 69 6f 6e 73 20 77 69 74 68 20   revisions with 
4240: 61 20 62 72 61 6e 63 68 20 70 61 72 65 6e 74 20  a branch parent 
4250: 73 79 6d 62 6f 6c 20 77 68 6f 73 65 20 70 61 72  symbol whose par
4260: 65 6e 74 0a 09 23 20 68 61 73 20 74 68 65 6d 20  ent..# has them 
4270: 61 73 20 70 72 69 6d 61 72 79 20 63 68 69 6c 64  as primary child
4280: 2e 0a 09 43 68 65 63 6b 20 5c 0a 09 20 20 20 20  ...Check \..    
4290: 7b 42 72 61 6e 63 68 20 73 74 61 72 74 69 6e 67  {Branch starting
42a0: 20 72 65 76 69 73 69 6f 6e 73 20 6d 75 73 74 20   revisions must 
42b0: 6e 6f 74 20 62 65 20 70 72 69 6d 61 72 79 20 63  not be primary c
42c0: 68 69 6c 64 72 65 6e 20 6f 66 20 74 68 65 69 72  hildren of their
42d0: 20 70 61 72 65 6e 74 73 7d 20 5c 0a 09 20 20 20   parents} \..   
42e0: 20 7b 61 74 20 74 68 65 20 62 65 67 69 6e 6e 69   {at the beginni
42f0: 6e 67 20 6f 66 20 69 74 73 20 62 72 61 6e 63 68  ng of its branch
4300: 20 69 73 20 74 68 65 20 70 72 69 6d 61 72 79 20   is the primary 
4310: 63 68 69 6c 64 20 6f 66 20 69 74 73 20 70 61 72  child of its par
4320: 65 6e 74 7d 20 7b 0a 09 09 53 45 4c 45 43 54 20  ent} {...SELECT 
4330: 46 2e 6e 61 6d 65 2c 20 52 2e 72 65 76 0a 09 09  F.name, R.rev...
4340: 46 52 4f 4d 20 72 65 76 69 73 69 6f 6e 20 52 2c  FROM revision R,
4350: 20 72 65 76 69 73 69 6f 6e 20 50 2c 20 66 69 6c   revision P, fil
4360: 65 20 46 0a 09 09 57 48 45 52 45 20 52 2e 66 69  e F...WHERE R.fi
4370: 64 20 3d 20 46 2e 66 69 64 0a 09 09 41 4e 44 20  d = F.fid...AND 
4380: 20 20 52 2e 62 70 61 72 65 6e 74 20 49 53 20 4e    R.bparent IS N
4390: 4f 54 20 4e 55 4c 4c 0a 09 09 41 4e 44 20 20 20  OT NULL...AND   
43a0: 52 2e 70 61 72 65 6e 74 20 49 53 20 4e 4f 54 20  R.parent IS NOT 
43b0: 4e 55 4c 4c 0a 09 09 41 4e 44 20 20 20 52 2e 70  NULL...AND   R.p
43c0: 61 72 65 6e 74 20 3d 20 50 2e 72 69 64 0a 09 09  arent = P.rid...
43d0: 41 4e 44 20 20 20 50 2e 63 68 69 6c 64 20 3d 20  AND   P.child = 
43e0: 52 2e 72 69 64 0a 09 09 3b 0a 09 20 20 20 20 7d  R.rid...;..    }
43f0: 0a 09 23 20 46 69 6e 64 20 61 6c 6c 20 72 65 76  ..# Find all rev
4400: 69 73 69 6f 6e 73 20 77 69 74 68 20 61 20 6e 6f  isions with a no
4410: 6e 2d 4e 54 44 42 20 63 68 69 6c 64 20 77 68 69  n-NTDB child whi
4420: 63 68 20 61 72 65 20 6e 6f 74 20 6f 6e 0a 09 23  ch are not on..#
4430: 20 74 68 65 20 4e 54 44 42 2e 0a 09 43 68 65 63   the NTDB...Chec
4440: 6b 20 5c 0a 09 20 20 20 20 7b 4e 54 44 42 20 74  k \..    {NTDB t
4450: 6f 20 74 72 75 6e 6b 20 74 72 61 6e 73 69 74 69  o trunk transiti
4460: 6f 6e 20 68 61 73 20 74 6f 20 62 65 67 69 6e 20  on has to begin 
4470: 6f 6e 20 4e 54 44 42 7d 20 5c 0a 09 20 20 20 20  on NTDB} \..    
4480: 7b 68 61 73 20 61 20 6e 6f 6e 2d 4e 54 44 42 20  {has a non-NTDB 
4490: 63 68 69 6c 64 2c 20 79 65 74 20 69 73 20 6e 6f  child, yet is no
44a0: 74 20 6f 6e 20 74 68 65 20 4e 54 44 42 7d 20 7b  t on the NTDB} {
44b0: 0a 09 09 53 45 4c 45 43 54 20 46 2e 6e 61 6d 65  ...SELECT F.name
44c0: 2c 20 52 2e 72 65 76 0a 09 09 46 52 4f 4d 20 72  , R.rev...FROM r
44d0: 65 76 69 73 69 6f 6e 20 52 2c 20 66 69 6c 65 20  evision R, file 
44e0: 46 0a 09 09 57 48 45 52 45 20 52 2e 66 69 64 20  F...WHERE R.fid 
44f0: 3d 20 46 2e 66 69 64 0a 09 09 41 4e 44 20 20 20  = F.fid...AND   
4500: 52 2e 64 62 63 68 69 6c 64 20 49 53 20 4e 4f 54  R.dbchild IS NOT
4510: 20 4e 55 4c 4c 0a 09 09 41 4e 44 20 20 20 4e 4f   NULL...AND   NO
4520: 54 20 52 2e 69 73 64 65 66 61 75 6c 74 0a 09 09  T R.isdefault...
4530: 3b 0a 09 20 20 20 20 7d 0a 09 23 20 46 69 6e 64  ;..    }..# Find
4540: 20 61 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 77   all revisions w
4550: 69 74 68 20 61 20 4e 54 44 42 20 70 61 72 65 6e  ith a NTDB paren
4560: 74 20 77 68 69 63 68 20 61 72 65 20 6f 6e 20 74  t which are on t
4570: 68 65 20 4e 54 44 42 2e 0a 09 43 68 65 63 6b 20  he NTDB...Check 
4580: 5c 0a 09 20 20 20 20 7b 4e 54 44 42 20 74 6f 20  \..    {NTDB to 
4590: 74 72 75 6e 6b 20 74 72 61 6e 73 69 74 69 6f 6e  trunk transition
45a0: 20 68 61 73 20 74 6f 20 65 6e 64 20 6f 6e 20 6e   has to end on n
45b0: 6f 6e 2d 4e 54 44 42 7d 20 5c 0a 09 20 20 20 20  on-NTDB} \..    
45c0: 7b 68 61 73 20 61 20 4e 54 44 42 20 70 61 72 65  {has a NTDB pare
45d0: 6e 74 2c 20 79 65 74 20 69 73 20 6f 6e 20 74 68  nt, yet is on th
45e0: 65 20 4e 54 44 42 7d 20 7b 0a 09 09 53 45 4c 45  e NTDB} {...SELE
45f0: 43 54 20 46 2e 6e 61 6d 65 2c 20 52 2e 72 65 76  CT F.name, R.rev
4600: 0a 09 09 46 52 4f 4d 20 72 65 76 69 73 69 6f 6e  ...FROM revision
4610: 20 52 2c 20 66 69 6c 65 20 46 0a 09 09 57 48 45   R, file F...WHE
4620: 52 45 20 52 2e 66 69 64 20 3d 20 46 2e 66 69 64  RE R.fid = F.fid
4630: 0a 09 09 41 4e 44 20 20 20 52 2e 64 62 70 61 72  ...AND   R.dbpar
4640: 65 6e 74 20 49 53 20 4e 4f 54 20 4e 55 4c 4c 0a  ent IS NOT NULL.
4650: 09 09 41 4e 44 20 20 20 52 2e 69 73 64 65 66 61  ..AND   R.isdefa
4660: 75 6c 74 0a 09 09 3b 0a 09 20 20 20 20 7d 0a 09  ult...;..    }..
4670: 23 20 46 69 6e 64 20 61 6c 6c 20 72 65 76 69 73  # Find all revis
4680: 69 6f 6e 73 20 77 69 74 68 20 61 20 63 68 69 6c  ions with a chil
4690: 64 20 77 68 69 63 68 20 64 69 73 61 67 72 65 65  d which disagree
46a0: 73 20 61 62 6f 75 74 20 74 68 65 0a 09 23 20 6c  s about the..# l
46b0: 69 6e 65 20 6f 66 20 64 65 76 65 6c 6f 70 6d 65  ine of developme
46c0: 6e 74 20 74 68 65 79 20 62 65 6c 6f 6e 67 20 74  nt they belong t
46d0: 6f 2e 0a 09 43 68 65 63 6b 20 5c 0a 09 20 20 20  o...Check \..   
46e0: 20 7b 52 65 76 69 73 69 6f 6e 73 20 61 6e 64 20   {Revisions and 
46f0: 74 68 65 69 72 20 70 72 69 6d 61 72 79 20 63 68  their primary ch
4700: 69 6c 64 72 65 6e 20 68 61 76 65 20 74 6f 20 62  ildren have to b
4710: 65 20 69 6e 20 74 68 65 20 73 61 6d 65 20 4c 4f  e in the same LO
4720: 44 7d 20 5c 0a 09 20 20 20 20 7b 61 6e 64 20 69  D} \..    {and i
4730: 74 73 20 70 72 69 6d 61 72 79 20 63 68 69 6c 64  ts primary child
4740: 20 64 69 73 61 67 72 65 65 20 61 62 6f 75 74 20   disagree about 
4750: 74 68 65 69 72 20 4c 4f 44 7d 20 7b 0a 09 09 53  their LOD} {...S
4760: 45 4c 45 43 54 20 46 2e 6e 61 6d 65 2c 20 52 2e  ELECT F.name, R.
4770: 72 65 76 0a 09 09 46 52 4f 4d 20 72 65 76 69 73  rev...FROM revis
4780: 69 6f 6e 20 52 2c 20 72 65 76 69 73 69 6f 6e 20  ion R, revision 
4790: 43 2c 20 66 69 6c 65 20 46 0a 09 09 57 48 45 52  C, file F...WHER
47a0: 45 20 52 2e 66 69 64 20 3d 20 46 2e 66 69 64 0a  E R.fid = F.fid.
47b0: 09 09 41 4e 44 20 20 20 52 2e 63 68 69 6c 64 20  ..AND   R.child 
47c0: 49 53 20 4e 4f 54 20 4e 55 4c 4c 0a 09 09 41 4e  IS NOT NULL...AN
47d0: 44 20 20 20 52 2e 63 68 69 6c 64 20 3d 20 43 2e  D   R.child = C.
47e0: 72 69 64 0a 09 09 41 4e 44 20 20 20 43 2e 6c 6f  rid...AND   C.lo
47f0: 64 20 21 3d 20 52 2e 6c 6f 64 0a 09 09 3b 0a 09  d != R.lod...;..
4800: 20 20 20 20 7d 0a 09 23 20 46 69 6e 64 20 61 6c      }..# Find al
4810: 6c 20 72 65 76 69 73 69 6f 6e 73 20 77 69 74 68  l revisions with
4820: 20 61 20 6e 6f 6e 2d 4e 54 44 42 20 63 68 69 6c   a non-NTDB chil
4830: 64 20 77 68 69 63 68 20 61 67 72 65 65 73 20 61  d which agrees a
4840: 62 6f 75 74 0a 09 23 20 74 68 65 20 6c 69 6e 65  bout..# the line
4850: 20 6f 66 20 64 65 76 65 6c 6f 70 6d 65 6e 74 20   of development 
4860: 74 68 65 79 20 62 65 6c 6f 6e 67 20 74 6f 2e 0a  they belong to..
4870: 09 43 68 65 63 6b 20 5c 0a 09 20 20 20 20 7b 4e  .Check \..    {N
4880: 54 44 42 20 61 6e 64 20 74 72 75 6e 6b 20 72 65  TDB and trunk re
4890: 76 69 73 69 6f 6e 73 20 68 61 76 65 20 74 6f 20  visions have to 
48a0: 62 65 20 69 6e 20 64 69 66 66 65 72 65 6e 74 20  be in different 
48b0: 4c 4f 44 73 7d 20 5c 0a 09 20 20 20 20 7b 6f 6e  LODs} \..    {on
48c0: 20 4e 54 44 42 20 61 6e 64 20 69 74 73 20 6e 6f   NTDB and its no
48d0: 6e 2d 4e 54 44 42 20 63 68 69 6c 64 20 77 72 6f  n-NTDB child wro
48e0: 6e 67 6c 79 20 61 67 72 65 65 20 61 62 6f 75 74  ngly agree about
48f0: 20 74 68 65 69 72 20 4c 4f 44 7d 20 7b 0a 09 09   their LOD} {...
4900: 53 45 4c 45 43 54 20 46 2e 6e 61 6d 65 2c 20 52  SELECT F.name, R
4910: 2e 72 65 76 0a 09 09 46 52 4f 4d 20 72 65 76 69  .rev...FROM revi
4920: 73 69 6f 6e 20 52 2c 20 72 65 76 69 73 69 6f 6e  sion R, revision
4930: 20 43 2c 20 66 69 6c 65 20 46 0a 09 09 57 48 45   C, file F...WHE
4940: 52 45 20 52 2e 66 69 64 20 3d 20 46 2e 66 69 64  RE R.fid = F.fid
4950: 0a 09 09 41 4e 44 20 20 20 52 2e 64 62 63 68 69  ...AND   R.dbchi
4960: 6c 64 20 49 53 20 4e 4f 54 20 4e 55 4c 4c 0a 09  ld IS NOT NULL..
4970: 09 41 4e 44 20 20 20 52 2e 64 62 63 68 69 6c 64  .AND   R.dbchild
4980: 20 3d 20 43 2e 72 69 64 0a 09 09 41 4e 44 20 20   = C.rid...AND  
4990: 20 43 2e 6c 6f 64 20 3d 20 52 2e 6c 6f 64 0a 09   C.lod = R.lod..
49a0: 09 3b 0a 09 20 20 20 20 7d 0a 09 23 20 46 69 6e  .;..    }..# Fin
49b0: 64 20 61 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20  d all revisions 
49c0: 77 69 74 68 20 61 20 62 72 61 6e 63 68 20 70 61  with a branch pa
49d0: 72 65 6e 74 20 73 79 6d 62 6f 6c 20 77 68 69 63  rent symbol whic
49e0: 68 20 69 73 20 6e 6f 74 0a 09 23 20 74 68 65 69  h is not..# thei
49f0: 72 20 4c 4f 44 2e 0a 09 43 68 65 63 6b 20 5c 0a  r LOD...Check \.
4a00: 09 20 20 20 20 7b 42 72 61 6e 63 68 20 73 74 61  .    {Branch sta
4a10: 72 74 69 6e 67 20 72 65 76 69 73 69 6f 6e 73 20  rting revisions 
4a20: 68 61 76 65 20 74 6f 20 68 61 76 65 20 74 68 65  have to have the
4a30: 69 72 20 4c 4f 44 20 61 73 20 62 72 61 6e 63 68  ir LOD as branch
4a40: 20 70 61 72 65 6e 74 20 73 79 6d 62 6f 6c 7d 20   parent symbol} 
4a50: 5c 0a 09 20 20 20 20 7b 61 74 20 74 68 65 20 62  \..    {at the b
4a60: 65 67 69 6e 6e 69 6e 67 20 6f 66 20 69 74 73 20  eginning of its 
4a70: 62 72 61 6e 63 68 20 64 6f 65 73 20 6e 6f 74 20  branch does not 
4a80: 68 61 76 65 20 74 68 65 20 62 72 61 6e 63 68 20  have the branch 
4a90: 73 79 6d 62 6f 6c 20 61 73 20 69 74 73 20 4c 4f  symbol as its LO
4aa0: 44 7d 20 7b 0a 09 09 53 45 4c 45 43 54 20 46 2e  D} {...SELECT F.
4ab0: 6e 61 6d 65 2c 20 52 2e 72 65 76 0a 09 09 46 52  name, R.rev...FR
4ac0: 4f 4d 20 72 65 76 69 73 69 6f 6e 20 52 2c 20 66  OM revision R, f
4ad0: 69 6c 65 20 46 0a 09 09 57 48 45 52 45 20 52 2e  ile F...WHERE R.
4ae0: 66 69 64 20 3d 20 46 2e 66 69 64 0a 09 09 41 4e  fid = F.fid...AN
4af0: 44 20 20 20 52 2e 62 70 61 72 65 6e 74 20 49 53  D   R.bparent IS
4b00: 20 4e 4f 54 20 4e 55 4c 4c 0a 09 09 41 4e 44 20   NOT NULL...AND 
4b10: 20 20 52 2e 6c 6f 64 20 21 3d 20 52 2e 62 70 61    R.lod != R.bpa
4b20: 72 65 6e 74 0a 09 09 3b 0a 09 20 20 20 20 7d 0a  rent...;..    }.
4b30: 09 23 20 46 69 6e 64 20 61 6c 6c 20 72 65 76 69  .# Find all revi
4b40: 73 69 6f 6e 73 20 77 69 74 68 20 61 20 62 72 61  sions with a bra
4b50: 6e 63 68 20 70 61 72 65 6e 74 20 73 79 6d 62 6f  nch parent symbo
4b60: 6c 20 77 68 6f 73 65 20 70 61 72 65 6e 74 0a 09  l whose parent..
4b70: 23 20 69 73 20 69 6e 20 74 68 65 20 73 61 6d 65  # is in the same
4b80: 20 6c 69 6e 65 20 6f 66 20 64 65 76 65 6c 6f 70   line of develop
4b90: 6d 65 6e 74 2e 0a 09 43 68 65 63 6b 20 5c 0a 09  ment...Check \..
4ba0: 20 20 20 20 7b 52 65 76 69 73 69 6f 6e 73 20 61      {Revisions a
4bb0: 6e 64 20 74 68 65 69 72 20 62 72 61 6e 63 68 20  nd their branch 
4bc0: 63 68 69 6c 64 72 65 6e 20 68 61 76 65 20 74 6f  children have to
4bd0: 20 62 65 20 69 6e 20 64 69 66 66 65 72 65 6e 74   be in different
4be0: 20 4c 4f 44 73 7d 20 5c 0a 09 20 20 20 20 7b 61   LODs} \..    {a
4bf0: 74 20 74 68 65 20 62 65 67 69 6e 6e 69 6e 67 20  t the beginning 
4c00: 6f 66 20 69 74 73 20 62 72 61 6e 63 68 20 61 6e  of its branch an
4c10: 64 20 69 74 73 20 70 61 72 65 6e 74 20 77 72 6f  d its parent wro
4c20: 6e 67 6c 79 20 61 67 72 65 65 20 61 62 6f 75 74  ngly agree about
4c30: 20 74 68 65 69 72 20 4c 4f 44 7d 20 7b 0a 09 09   their LOD} {...
4c40: 53 45 4c 45 43 54 20 46 2e 6e 61 6d 65 2c 20 52  SELECT F.name, R
4c50: 2e 72 65 76 0a 09 09 46 52 4f 4d 20 72 65 76 69  .rev...FROM revi
4c60: 73 69 6f 6e 20 52 2c 20 72 65 76 69 73 69 6f 6e  sion R, revision
4c70: 20 50 2c 20 66 69 6c 65 20 46 0a 09 09 57 48 45   P, file F...WHE
4c80: 52 45 20 52 2e 66 69 64 20 3d 20 46 2e 66 69 64  RE R.fid = F.fid
4c90: 0a 09 09 41 4e 44 20 20 20 52 2e 62 70 61 72 65  ...AND   R.bpare
4ca0: 6e 74 20 49 53 20 4e 4f 54 20 4e 55 4c 4c 0a 09  nt IS NOT NULL..
4cb0: 09 41 4e 44 20 20 20 52 2e 70 61 72 65 6e 74 20  .AND   R.parent 
4cc0: 3d 20 50 2e 72 69 64 0a 09 09 41 4e 44 20 20 20  = P.rid...AND   
4cd0: 52 2e 6c 6f 64 20 3d 20 50 2e 6c 6f 64 0a 09 09  R.lod = P.lod...
4ce0: 3b 0a 09 20 20 20 20 7d 0a 09 72 65 74 75 72 6e  ;..    }..return
4cf0: 0a 20 20 20 20 7d 0a 0a 20 20 20 20 70 72 6f 63  .    }..    proc
4d00: 20 43 68 65 63 6b 20 7b 68 65 61 64 65 72 20 6c   Check {header l
4d10: 61 62 65 6c 20 73 71 6c 7d 20 7b 0a 09 75 70 76  abel sql} {..upv
4d20: 61 72 20 31 20 6e 20 6e 0a 09 73 65 74 20 6f 6b  ar 1 n n..set ok
4d30: 20 31 0a 09 66 6f 72 65 61 63 68 20 7b 66 6e 61   1..foreach {fna
4d40: 6d 65 20 72 65 76 6e 72 7d 20 5b 73 74 61 74 65  me revnr} [state
4d50: 20 72 75 6e 20 24 73 71 6c 5d 20 7b 0a 09 20 20   run $sql] {..  
4d60: 20 20 73 65 74 20 6f 6b 20 30 0a 09 20 20 20 20    set ok 0..    
4d70: 74 72 6f 75 62 6c 65 20 66 61 74 61 6c 20 22 24  trouble fatal "$
4d80: 66 6e 61 6d 65 20 3c 24 72 65 76 6e 72 3e 20 24  fname <$revnr> $
4d90: 6c 61 62 65 6c 22 0a 09 7d 0a 09 6c 6f 67 20 77  label"..}..log w
4da0: 72 69 74 65 20 35 20 63 6f 6c 6c 72 65 76 20 22  rite 5 collrev "
4db0: 5c 5b 5b 66 6f 72 6d 61 74 20 25 30 32 64 20 5b  \[[format %02d [
4dc0: 69 6e 63 72 20 6e 5d 5d 5c 5d 20 5b 65 78 70 72  incr n]]\] [expr
4dd0: 20 7b 24 6f 6b 20 3f 20 22 4f 6b 20 20 20 20 22   {$ok ? "Ok    "
4de0: 20 3a 20 22 46 61 69 6c 65 64 22 7d 5d 20 2e 2e   : "Failed"}] ..
4df0: 2e 20 24 68 65 61 64 65 72 22 0a 09 72 65 74 75  . $header"..retu
4e00: 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 23 20  rn.    }..    # 
4e10: 23 20 23 23 20 23 23 23 20 23 23 23 23 23 20 23  # ## ### ##### #
4e20: 23 23 23 23 23 23 23 20 23 23 23 23 23 23 23 23  ####### ########
4e30: 23 23 23 23 23 0a 20 20 20 20 23 23 20 49 6e 74  #####.    ## Int
4e40: 65 72 6e 61 6c 20 6d 65 74 68 6f 64 73 0a 0a 20  ernal methods.. 
4e50: 20 20 20 23 20 23 20 23 23 20 23 23 23 20 23 23     # # ## ### ##
4e60: 23 23 23 20 23 23 23 23 23 23 23 23 20 23 23 23  ### ######## ###
4e70: 23 23 23 23 23 23 23 23 23 23 0a 20 20 20 20 23  ##########.    #
4e80: 23 20 43 6f 6e 66 69 67 75 72 61 74 69 6f 6e 0a  # Configuration.
4e90: 0a 20 20 20 20 70 72 61 67 6d 61 20 2d 68 61 73  .    pragma -has
4ea0: 69 6e 73 74 61 6e 63 65 73 20 20 20 6e 6f 20 3b  instances   no ;
4eb0: 20 23 20 73 69 6e 67 6c 65 74 6f 6e 0a 20 20 20   # singleton.   
4ec0: 20 70 72 61 67 6d 61 20 2d 68 61 73 74 79 70 65   pragma -hastype
4ed0: 69 6e 66 6f 20 20 20 20 6e 6f 20 3b 20 23 20 6e  info    no ; # n
4ee0: 6f 20 69 6e 74 72 6f 73 70 65 63 74 69 6f 6e 0a  o introspection.
4ef0: 20 20 20 20 70 72 61 67 6d 61 20 2d 68 61 73 74      pragma -hast
4f00: 79 70 65 64 65 73 74 72 6f 79 20 6e 6f 20 3b 20  ypedestroy no ; 
4f10: 23 20 69 6d 6d 6f 72 74 61 6c 0a 0a 20 20 20 20  # immortal..    
4f20: 23 20 23 20 23 23 20 23 23 23 20 23 23 23 23 23  # # ## ### #####
4f30: 20 23 23 23 23 23 23 23 23 20 23 23 23 23 23 23   ######## ######
4f40: 23 23 23 23 23 23 23 0a 7d 0a 0a 6e 61 6d 65 73  #######.}..names
4f50: 70 61 63 65 20 65 76 61 6c 20 3a 3a 76 63 3a 3a  pace eval ::vc::
4f60: 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a  fossil::import::
4f70: 63 76 73 3a 3a 70 61 73 73 20 7b 0a 20 20 20 20  cvs::pass {.    
4f80: 6e 61 6d 65 73 70 61 63 65 20 65 78 70 6f 72 74  namespace export
4f90: 20 63 6f 6c 6c 72 65 76 0a 20 20 20 20 6e 61 6d   collrev.    nam
4fa0: 65 73 70 61 63 65 20 65 76 61 6c 20 63 6f 6c 6c  espace eval coll
4fb0: 72 65 76 20 7b 0a 09 6e 61 6d 65 73 70 61 63 65  rev {..namespace
4fc0: 20 69 6d 70 6f 72 74 20 3a 3a 76 63 3a 3a 72 63   import ::vc::rc
4fd0: 73 3a 3a 70 61 72 73 65 72 0a 09 6e 61 6d 65 73  s::parser..names
4fe0: 70 61 63 65 20 69 6d 70 6f 72 74 20 3a 3a 76 63  pace import ::vc
4ff0: 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 74  ::fossil::import
5000: 3a 3a 63 76 73 3a 3a 72 65 70 6f 73 69 74 6f 72  ::cvs::repositor
5010: 79 0a 09 6e 61 6d 65 73 70 61 63 65 20 69 6d 70  y..namespace imp
5020: 6f 72 74 20 3a 3a 76 63 3a 3a 66 6f 73 73 69 6c  ort ::vc::fossil
5030: 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 73  ::import::cvs::s
5040: 74 61 74 65 0a 09 6e 61 6d 65 73 70 61 63 65 20  tate..namespace 
5050: 69 6d 70 6f 72 74 20 3a 3a 76 63 3a 3a 66 6f 73  import ::vc::fos
5060: 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73  sil::import::cvs
5070: 3a 3a 69 6e 74 65 67 72 69 74 79 0a 09 6e 61 6d  ::integrity..nam
5080: 65 73 70 61 63 65 20 65 76 61 6c 20 70 72 6f 6a  espace eval proj
5090: 65 63 74 20 7b 0a 09 20 20 20 20 6e 61 6d 65 73  ect {..    names
50a0: 70 61 63 65 20 69 6d 70 6f 72 74 20 3a 3a 76 63  pace import ::vc
50b0: 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 74  ::fossil::import
50c0: 3a 3a 63 76 73 3a 3a 70 72 6f 6a 65 63 74 3a 3a  ::cvs::project::
50d0: 73 79 6d 0a 09 7d 0a 09 6e 61 6d 65 73 70 61 63  sym..}..namespac
50e0: 65 20 65 76 61 6c 20 66 69 6c 65 20 7b 0a 09 20  e eval file {.. 
50f0: 20 20 20 6e 61 6d 65 73 70 61 63 65 20 69 6d 70     namespace imp
5100: 6f 72 74 20 3a 3a 76 63 3a 3a 66 6f 73 73 69 6c  ort ::vc::fossil
5110: 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 66  ::import::cvs::f
5120: 69 6c 65 3a 3a 72 65 76 0a 09 7d 0a 09 6e 61 6d  ile::rev..}..nam
5130: 65 73 70 61 63 65 20 69 6d 70 6f 72 74 20 3a 3a  espace import ::
5140: 76 63 3a 3a 74 6f 6f 6c 73 3a 3a 74 72 6f 75 62  vc::tools::troub
5150: 6c 65 0a 09 6e 61 6d 65 73 70 61 63 65 20 69 6d  le..namespace im
5160: 70 6f 72 74 20 3a 3a 76 63 3a 3a 74 6f 6f 6c 73  port ::vc::tools
5170: 3a 3a 6c 6f 67 0a 09 6c 6f 67 20 72 65 67 69 73  ::log..log regis
5180: 74 65 72 20 63 6f 6c 6c 72 65 76 0a 20 20 20 20  ter collrev.    
5190: 7d 0a 7d 0a 0a 23 20 23 20 23 23 20 23 23 23 20  }.}..# # ## ### 
51a0: 23 23 23 23 23 20 23 23 23 23 23 23 23 23 20 23  ##### ######## #
51b0: 23 23 23 23 23 23 23 23 23 23 23 23 20 23 23 23  ############ ###
51c0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23  ################
51d0: 23 23 0a 23 23 20 52 65 61 64 79 0a 0a 70 61 63  ##.## Ready..pac
51e0: 6b 61 67 65 20 70 72 6f 76 69 64 65 20 76 63 3a  kage provide vc:
51f0: 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a  :fossil::import:
5200: 3a 63 76 73 3a 3a 70 61 73 73 3a 3a 63 6f 6c 6c  :cvs::pass::coll
5210: 72 65 76 20 31 2e 30 0a 72 65 74 75 72 6e 0a     rev 1.0.return.