Hex Artifact Content
Not logged in

Artifact 1a71981488df969893b3dd68a8fa88e7ac43348b:

File tools/cvs2fossil/lib/c2f_pcollrev.tcl part of check-in [7208c7ac4d] - Changes to cvs2fossil to import tcllib CVS into fossil on Win32

* using ::file instead of file in snit methods to get the core file command * taking care of files that only differ in case in the Attic and the repo on case insensitive FS * passing platform specific

by mjanssen on 2008-01-28 23:57:27.

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 0a 0a 73 6e 69 74 3a 3a 74 79  ###.##..snit::ty
0760: 70 65 20 3a 3a 76 63 3a 3a 66 6f 73 73 69 6c 3a  pe ::vc::fossil:
0770: 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 70 61  :import::cvs::pa
0780: 73 73 3a 3a 63 6f 6c 6c 72 65 76 20 7b 0a 20 20  ss::collrev {.  
0790: 20 20 23 20 23 20 23 23 20 23 23 23 20 23 23 23    # # ## ### ###
07a0: 23 23 20 23 23 23 23 23 23 23 23 20 23 23 23 23  ## ######## ####
07b0: 23 23 23 23 23 23 23 23 23 0a 20 20 20 20 23 23  #########.    ##
07c0: 20 50 75 62 6c 69 63 20 41 50 49 0a 0a 20 20 20   Public API..   
07d0: 20 74 79 70 65 6d 65 74 68 6f 64 20 73 65 74 75   typemethod setu
07e0: 70 20 7b 7d 20 7b 0a 09 23 20 44 65 66 69 6e 65  p {} {..# Define
07f0: 20 6e 61 6d 65 73 20 61 6e 64 20 73 74 72 75 63   names and struc
0800: 74 75 72 65 20 6f 66 20 74 68 65 20 70 65 72 73  ture of the pers
0810: 69 73 74 65 6e 74 20 73 74 61 74 65 20 6f 66 20  istent state of 
0820: 74 68 69 73 0a 09 23 20 70 61 73 73 2e 0a 0a 09  this..# pass....
0830: 73 74 61 74 65 20 75 73 65 20 70 72 6f 6a 65 63  state use projec
0840: 74 0a 09 73 74 61 74 65 20 75 73 65 20 66 69 6c  t..state use fil
0850: 65 0a 0a 09 23 20 57 65 20 64 65 61 6c 20 77 69  e...# We deal wi
0860: 74 68 20 70 65 72 20 70 72 6f 6a 65 63 74 20 61  th per project a
0870: 6e 64 20 70 65 72 20 66 69 6c 65 20 64 61 74 61  nd per file data
0880: 2c 20 74 68 65 20 66 69 72 73 74 0a 09 23 20 63  , the first..# c
0890: 6f 6c 6c 61 74 65 64 20 66 72 6f 6d 20 74 68 65  ollated from the
08a0: 20 73 65 63 6f 6e 64 2e 0a 0a 09 23 20 50 65 72   second....# Per
08b0: 20 66 69 6c 65 20 77 65 20 68 61 76 65 20 67 65   file we have ge
08c0: 6e 65 72 61 6c 20 69 6e 66 6f 72 6d 61 74 69 6f  neral informatio
08d0: 6e 2c 20 2e 2e 2e 2c 20 61 6e 64 20 74 68 65 6e  n, ..., and then
08e0: 0a 09 23 20 72 65 76 69 73 69 6f 6e 73 20 61 6e  ..# revisions an
08f0: 64 20 73 79 6d 62 6f 6c 73 2e 20 54 68 65 20 6c  d symbols. The l
0900: 61 74 74 65 72 20 63 61 6e 20 62 65 20 66 75 72  atter can be fur
0910: 74 68 65 72 20 73 65 70 61 72 61 74 65 64 0a 09  ther separated..
0920: 23 20 69 6e 74 6f 20 74 61 67 73 20 61 6e 64 20  # into tags and 
0930: 62 72 61 6e 63 68 65 73 2e 20 41 74 20 70 72 6f  branches. At pro
0940: 6a 65 63 74 20 6c 65 76 65 6c 20 74 68 65 20 70  ject level the p
0950: 65 72 2d 66 69 6c 65 0a 09 23 20 73 79 6d 62 6f  er-file..# symbo
0960: 6c 73 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 69  ls information i
0970: 73 20 6d 65 72 67 65 64 2e 0a 0a 09 23 20 46 69  s merged....# Fi
0980: 6c 65 20 6c 65 76 65 6c 20 2e 2e 2e 0a 09 23 09  le level .....#.
0990: 52 65 76 69 73 69 6f 6e 73 2c 20 42 72 61 6e 63  Revisions, Branc
09a0: 68 65 73 2c 20 54 61 67 73 0a 09 23 0a 09 23 20  hes, Tags..#..# 
09b0: 50 73 65 75 64 6f 20 63 6c 61 73 73 20 68 69 65  Pseudo class hie
09c0: 72 61 72 63 68 79 0a 09 23 09 54 61 67 20 20 20  rarchy..#.Tag   
09d0: 20 20 20 3c 2d 20 53 79 6d 62 6f 6c 20 3c 2d 20     <- Symbol <- 
09e0: 45 76 65 6e 74 0a 09 23 09 42 72 61 6e 63 68 20  Event..#.Branch 
09f0: 20 20 3c 2d 20 53 79 6d 62 6f 6c 20 3c 2d 20 45    <- Symbol <- E
0a00: 76 65 6e 74 0a 09 23 09 52 65 76 69 73 69 6f 6e  vent..#.Revision
0a10: 20 20 20 20 20 20 20 20 20 20 20 3c 2d 20 45 76             <- Ev
0a20: 65 6e 74 0a 0a 09 73 74 61 74 65 20 65 78 74 65  ent...state exte
0a30: 6e 64 20 72 65 76 69 73 69 6f 6e 20 7b 0a 09 20  nd revision {.. 
0a40: 20 20 20 2d 2d 20 52 65 76 69 73 69 6f 6e 73 2e     -- Revisions.
0a50: 20 49 64 65 6e 74 69 66 69 65 64 20 62 79 20 61   Identified by a
0a60: 20 67 6c 6f 62 61 6c 20 6e 75 6d 65 72 69 63 20   global numeric 
0a70: 69 64 20 65 61 63 68 0a 09 20 20 20 20 2d 2d 20  id each..    -- 
0a80: 62 65 6c 6f 6e 67 73 20 74 6f 20 61 20 73 69 6e  belongs to a sin
0a90: 67 6c 65 20 66 69 6c 65 2c 20 69 64 65 6e 74 69  gle file, identi
0aa0: 66 69 65 64 20 62 79 20 69 74 73 20 69 64 2e 20  fied by its id. 
0ab0: 49 74 0a 09 20 20 20 20 2d 2d 20 66 75 72 74 68  It..    -- furth
0ac0: 65 72 20 68 61 73 20 61 20 64 6f 74 74 65 64 20  er has a dotted 
0ad0: 72 65 76 69 73 69 6f 6e 20 6e 75 6d 62 65 72 20  revision number 
0ae0: 28 44 54 4e 29 2e 0a 09 20 20 20 20 2d 2d 0a 09  (DTN)...    --..
0af0: 20 20 20 20 2d 2d 20 43 6f 6e 73 74 72 61 69 6e      -- Constrain
0b00: 74 3a 20 54 68 65 20 64 6f 74 74 65 64 20 72 65  t: The dotted re
0b10: 76 69 73 69 6f 6e 20 6e 75 6d 62 65 72 20 69 73  vision number is
0b20: 20 75 6e 69 71 75 65 20 77 69 74 68 69 6e 0a 20   unique within. 
0b30: 20 20 20 20 20 20 20 20 20 20 20 2d 2d 20 20 20             --   
0b40: 20 20 20 20 20 20 20 20 20 20 74 68 65 20 66 69            the fi
0b50: 6c 65 2e 20 53 65 65 20 65 6e 64 20 6f 66 20 64  le. See end of d
0b60: 65 66 69 6e 69 74 69 6f 6e 2e 0a 0a 09 20 20 20  efinition....   
0b70: 20 72 69 64 20 20 49 4e 54 45 47 45 52 20 20 4e   rid  INTEGER  N
0b80: 4f 54 20 4e 55 4c 4c 20 20 50 52 49 4d 41 52 59  OT NULL  PRIMARY
0b90: 20 4b 45 59 20 41 55 54 4f 49 4e 43 52 45 4d 45   KEY AUTOINCREME
0ba0: 4e 54 2c 0a 09 20 20 20 20 66 69 64 20 20 49 4e  NT,..    fid  IN
0bb0: 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 20  TEGER  NOT NULL 
0bc0: 20 52 45 46 45 52 45 4e 43 45 53 20 66 69 6c 65   REFERENCES file
0bd0: 2c 20 20 20 2d 2d 20 46 69 6c 65 20 6f 77 6e 69  ,   -- File owni
0be0: 6e 67 20 72 65 76 69 73 69 6f 6e 2e 0a 09 20 20  ng revision...  
0bf0: 20 20 72 65 76 20 20 54 45 58 54 20 20 20 20 20    rev  TEXT     
0c00: 4e 4f 54 20 4e 55 4c 4c 2c 20 20 20 20 20 20 20  NOT NULL,       
0c10: 20 20 20 20 20 20 20 20 20 20 20 20 20 2d 2d 20               -- 
0c20: 44 6f 74 74 65 64 20 52 65 76 20 4e 75 6d 62 65  Dotted Rev Numbe
0c30: 72 2e 0a 0a 09 20 20 20 20 2d 2d 20 41 6c 6c 20  r....    -- All 
0c40: 72 65 76 69 73 69 6f 6e 73 20 62 65 6c 6f 6e 67  revisions belong
0c50: 20 74 6f 20 61 20 6c 69 6e 65 2d 6f 66 2d 64 65   to a line-of-de
0c60: 76 65 6c 6f 70 6d 65 6e 74 2c 0a 09 20 20 20 20  velopment,..    
0c70: 2d 2d 20 69 64 65 6e 74 69 66 69 65 64 20 62 79  -- identified by
0c80: 20 61 20 73 79 6d 62 6f 6c 20 28 70 72 6f 6a 65   a symbol (proje
0c90: 63 74 20 6c 65 76 65 6c 29 2e 20 44 75 72 69 6e  ct level). Durin
0ca0: 67 20 64 61 74 61 0a 09 20 20 20 20 2d 2d 20 63  g data..    -- c
0cb0: 6f 6c 6c 65 63 74 69 6f 6e 20 69 74 20 77 61 73  ollection it was
0cc0: 20 61 20 66 69 6c 65 2d 6c 65 76 65 6c 20 62 72   a file-level br
0cd0: 61 6e 63 68 20 73 79 6d 62 6f 6c 2e 0a 09 20 20  anch symbol...  
0ce0: 20 20 2d 2d 0a 09 20 20 20 20 2d 2d 20 43 6f 6e    --..    -- Con
0cf0: 73 74 72 61 69 6e 74 3a 20 41 6c 6c 20 74 68 65  straint: All the
0d00: 20 4c 4f 44 20 73 79 6d 62 6f 6c 73 20 61 72 65   LOD symbols are
0d10: 20 69 6e 20 74 68 65 20 73 61 6d 65 20 70 72 6f   in the same pro
0d20: 6a 65 63 74 0a 09 20 20 20 20 2d 2d 20 20 20 20  ject..    --    
0d30: 20 20 20 20 20 20 20 20 20 61 73 20 74 68 65 20           as the 
0d40: 66 69 6c 65 20 69 74 73 65 6c 66 2e 20 54 68 69  file itself. Thi
0d50: 73 20 63 61 6e 6e 6f 74 20 62 65 0a 09 20 20 20  s cannot be..   
0d60: 20 2d 2d 20 20 20 20 20 20 20 20 20 20 20 20 20   --             
0d70: 65 78 70 72 65 73 73 65 64 20 69 6e 20 43 52 45  expressed in CRE
0d80: 41 54 45 20 54 41 42 4c 45 20 73 79 6e 74 61 78  ATE TABLE syntax
0d90: 2e 0a 0a 09 20 20 20 20 6c 6f 64 20 20 49 4e 54  ....    lod  INT
0da0: 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 20  EGER  NOT NULL  
0db0: 52 45 46 45 52 45 4e 43 45 53 20 73 79 6d 62 6f  REFERENCES symbo
0dc0: 6c 2c 20 2d 2d 20 4c 69 6e 65 20 6f 66 20 64 65  l, -- Line of de
0dd0: 76 65 6c 6f 70 6d 65 6e 74 0a 0a 09 20 20 20 20  velopment...    
0de0: 2d 2d 20 54 68 65 20 72 65 76 69 73 69 6f 6e 73  -- The revisions
0df0: 20 69 6e 20 61 20 66 69 6c 65 20 61 72 65 20 6f   in a file are o
0e00: 72 67 61 6e 69 7a 65 64 20 69 6e 20 61 20 66 6f  rganized in a fo
0e10: 72 65 73 74 20 6f 66 0a 09 20 20 20 20 2d 2d 20  rest of..    -- 
0e20: 74 72 65 65 73 2c 20 77 69 74 68 20 74 68 65 20  trees, with the 
0e30: 6d 61 69 6e 20 6c 69 6e 65 73 20 64 65 66 69 6e  main lines defin
0e40: 65 64 20 74 68 72 6f 75 67 68 20 74 68 65 20 70  ed through the p
0e50: 61 72 65 6e 74 20 2f 0a 09 20 20 20 20 2d 2d 20  arent /..    -- 
0e60: 63 68 69 6c 64 20 72 65 66 65 72 65 6e 63 65 73  child references
0e70: 2e 20 41 20 72 65 76 69 73 69 6f 6e 20 77 69 74  . A revision wit
0e80: 68 6f 75 74 20 61 20 70 61 72 65 6e 74 20 69 73  hout a parent is
0e90: 20 74 68 65 0a 09 20 20 20 20 2d 2d 20 72 6f 6f   the..    -- roo
0ea0: 74 20 6f 66 20 61 20 74 72 65 65 2c 20 61 6e 64  t of a tree, and
0eb0: 20 61 20 72 65 76 69 73 69 6f 6e 20 77 69 74 68   a revision with
0ec0: 6f 75 74 20 61 20 63 68 69 6c 64 20 69 73 20 61  out a child is a
0ed0: 0a 09 20 20 20 20 2d 2d 20 6c 65 61 66 2e 0a 0a  ..    -- leaf...
0ee0: 09 20 20 20 20 2d 2d 20 43 6f 6e 73 74 72 61 69  .    -- Constrai
0ef0: 6e 74 73 3a 20 41 6c 6c 20 72 65 76 69 73 69 6f  nts: All revisio
0f00: 6e 73 20 63 6f 75 70 6c 65 64 20 74 68 72 6f 75  ns coupled throu
0f10: 67 68 20 70 61 72 65 6e 74 2f 63 68 69 6c 64 0a  gh parent/child.
0f20: 09 20 20 20 20 2d 2d 20 20 20 20 20 20 20 20 20  .    --         
0f30: 20 20 20 20 20 72 65 66 65 72 20 74 6f 20 74 68       refer to th
0f40: 65 20 73 61 6d 65 20 4c 4f 44 20 73 79 6d 62 6f  e same LOD symbo
0f50: 6c 2e 20 54 68 65 20 70 61 72 65 6e 74 0a 09 20  l. The parent.. 
0f60: 20 20 20 2d 2d 20 20 20 20 20 20 20 20 20 20 20     --           
0f70: 20 20 20 6f 66 20 61 20 63 68 69 6c 64 20 6f 66     of a child of
0f80: 20 58 20 69 73 20 58 2e 20 54 68 65 20 63 68 69   X is X. The chi
0f90: 6c 64 20 6f 66 20 61 0a 09 20 20 20 20 2d 2d 20  ld of a..    -- 
0fa0: 20 20 20 20 20 20 20 20 20 20 20 20 20 70 61 72               par
0fb0: 65 6e 74 20 6f 66 20 58 20 69 73 20 58 2e 0a 0a  ent of X is X...
0fc0: 09 20 20 20 20 70 61 72 65 6e 74 20 20 49 4e 54  .    parent  INT
0fd0: 45 47 45 52 20 20 20 20 20 20 20 20 20 20 20 20  EGER            
0fe0: 52 45 46 45 52 45 4e 43 45 53 20 72 65 76 69 73  REFERENCES revis
0ff0: 69 6f 6e 2c 0a 09 20 20 20 20 63 68 69 6c 64 20  ion,..    child 
1000: 20 20 49 4e 54 45 47 45 52 20 20 20 20 20 20 20    INTEGER       
1010: 20 20 20 20 20 52 45 46 45 52 45 4e 43 45 53 20       REFERENCES 
1020: 72 65 76 69 73 69 6f 6e 2c 0a 0a 09 20 20 20 20  revision,...    
1030: 2d 2d 20 54 68 65 20 72 65 70 72 65 73 65 6e 74  -- The represent
1040: 61 74 69 6f 6e 20 6f 66 20 61 20 62 72 61 6e 63  ation of a branc
1050: 68 20 69 6e 20 61 20 74 72 65 65 20 69 73 20 74  h in a tree is t
1060: 68 65 0a 09 20 20 20 20 2d 2d 20 65 78 63 65 70  he..    -- excep
1070: 74 69 6f 6e 20 74 6f 20 74 68 65 20 74 68 72 65  tion to the thre
1080: 65 20 63 6f 6e 73 74 72 61 69 6e 74 73 20 61 62  e constraints ab
1090: 6f 76 65 2e 0a 0a 09 20 20 20 20 2d 2d 20 54 68  ove....    -- Th
10a0: 65 20 62 65 67 69 6e 6e 69 6e 67 20 6f 66 20 61  e beginning of a
10b0: 20 62 72 61 6e 63 68 20 69 73 20 72 65 70 72 65   branch is repre
10c0: 73 65 6e 74 65 64 20 62 79 20 61 20 6e 6f 6e 2d  sented by a non-
10d0: 4e 55 4c 4c 0a 09 20 20 20 20 2d 2d 20 62 70 61  NULL..    -- bpa
10e0: 72 65 6e 74 20 6f 66 20 61 20 72 65 76 69 73 69  rent of a revisi
10f0: 6f 6e 2e 20 54 68 69 73 20 72 65 76 69 73 69 6f  on. This revisio
1100: 6e 20 42 20 69 73 20 74 68 65 20 66 69 72 73 74  n B is the first
1110: 20 6f 6e 0a 09 20 20 20 20 2d 2d 20 74 68 65 20   on..    -- the 
1120: 62 72 61 6e 63 68 2e 20 49 74 73 20 70 61 72 65  branch. Its pare
1130: 6e 74 20 50 20 69 73 20 74 68 65 20 72 65 76 69  nt P is the revi
1140: 73 69 6f 6e 20 74 68 65 20 62 72 61 6e 63 68 20  sion the branch 
1150: 69 73 0a 09 20 20 20 20 2d 2d 20 72 6f 6f 74 65  is..    -- roote
1160: 64 20 69 6e 2c 20 61 6e 64 20 69 74 20 69 73 20  d in, and it is 
1170: 6e 6f 74 20 74 68 65 20 63 68 69 6c 64 20 6f 66  not the child of
1180: 20 50 2e 20 42 20 61 6e 64 20 50 20 72 65 66 65   P. B and P refe
1190: 72 0a 09 20 20 20 20 2d 2d 20 74 6f 20 64 69 66  r..    -- to dif
11a0: 66 65 72 65 6e 74 20 4c 4f 44 20 73 79 6d 62 6f  ferent LOD symbo
11b0: 6c 73 2e 20 54 68 65 20 62 70 61 72 65 6e 74 20  ls. The bparent 
11c0: 6f 66 20 42 20 69 73 20 61 6c 73 6f 20 69 74 73  of B is also its
11d0: 0a 09 20 20 20 20 2d 2d 20 4c 4f 44 2c 20 61 6e  ..    -- LOD, an
11e0: 64 20 74 68 65 20 4c 4f 44 20 6f 66 20 69 74 73  d the LOD of its
11f0: 20 63 68 69 6c 64 72 65 6e 2e 0a 0a 09 20 20 20   children....   
1200: 20 62 70 61 72 65 6e 74 20 49 4e 54 45 47 45 52   bparent INTEGER
1210: 20 20 20 20 20 20 20 20 20 20 20 20 52 45 46 45              REFE
1220: 52 45 4e 43 45 53 20 73 79 6d 62 6f 6c 2c 0a 0a  RENCES symbol,..
1230: 09 20 20 20 20 2d 2d 20 4c 61 73 74 6c 79 20 77  .    -- Lastly w
1240: 65 20 6b 65 65 70 20 69 6e 66 6f 72 6d 61 74 69  e keep informati
1250: 6f 6e 20 69 73 20 61 62 6f 75 74 20 6e 6f 6e 2d  on is about non-
1260: 74 72 75 6e 6b 20 64 65 66 61 75 6c 74 0a 09 20  trunk default.. 
1270: 20 20 20 2d 2d 20 62 72 61 6e 63 68 65 73 20 28     -- branches (
1280: 4e 54 44 42 29 20 69 6e 20 74 68 65 20 72 65 76  NTDB) in the rev
1290: 69 73 69 6f 6e 73 2e 0a 0a 09 20 20 20 20 2d 2d  isions....    --
12a0: 20 41 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 6f   All revisions o
12b0: 6e 20 74 68 65 20 4e 54 44 42 20 68 61 76 65 20  n the NTDB have 
12c0: 27 69 73 64 65 66 61 75 6c 74 27 20 54 52 55 45  'isdefault' TRUE
12d0: 2c 0a 09 20 20 20 20 2d 2d 20 65 76 65 72 79 6f  ,..    -- everyo
12e0: 6e 65 20 65 6c 73 65 20 46 41 4c 53 45 2e 20 54  ne else FALSE. T
12f0: 68 65 20 6c 61 73 74 20 72 65 76 69 73 69 6f 6e  he last revision
1300: 20 58 20 6f 6e 20 74 68 65 20 4e 54 44 42 0a 09   X on the NTDB..
1310: 20 20 20 20 2d 2d 20 77 68 69 63 68 20 69 73 20      -- which is 
1320: 73 74 69 6c 6c 20 63 6f 6e 73 69 64 65 72 65 64  still considered
1330: 20 74 6f 20 62 65 20 6f 6e 20 74 68 65 20 74 72   to be on the tr
1340: 75 6e 6b 20 61 73 20 77 65 6c 6c 0a 09 20 20 20  unk as well..   
1350: 20 2d 2d 20 68 61 73 20 61 20 6e 6f 6e 2d 4e 55   -- has a non-NU
1360: 4c 4c 20 27 64 62 63 68 69 6c 64 27 20 77 68 69  LL 'dbchild' whi
1370: 63 68 20 72 65 66 65 72 73 20 74 6f 20 74 68 65  ch refers to the
1380: 20 72 6f 6f 74 20 6f 66 0a 09 20 20 20 20 2d 2d   root of..    --
1390: 20 74 68 65 20 74 72 75 6e 6b 2e 20 54 68 65 20   the trunk. The 
13a0: 72 6f 6f 74 20 61 6c 73 6f 20 68 61 73 20 61 20  root also has a 
13b0: 6e 6f 6e 2d 4e 55 4c 4c 20 64 62 70 61 72 65 6e  non-NULL dbparen
13c0: 74 0a 09 20 20 20 20 2d 2d 20 72 65 66 65 72 69  t..    -- referi
13d0: 6e 67 20 74 6f 20 58 2e 0a 0a 09 20 20 20 20 69  ng to X....    i
13e0: 73 64 65 66 61 75 6c 74 20 49 4e 54 45 47 45 52  sdefault INTEGER
13f0: 20 20 4e 4f 54 20 4e 55 4c 4c 2c 0a 09 20 20 20    NOT NULL,..   
1400: 20 64 62 70 61 72 65 6e 74 20 20 49 4e 54 45 47   dbparent  INTEG
1410: 45 52 20 20 20 20 20 20 20 20 20 20 20 20 52 45  ER            RE
1420: 46 45 52 45 4e 43 45 53 20 72 65 76 69 73 69 6f  FERENCES revisio
1430: 6e 2c 0a 09 20 20 20 20 64 62 63 68 69 6c 64 20  n,..    dbchild 
1440: 20 20 49 4e 54 45 47 45 52 20 20 20 20 20 20 20    INTEGER       
1450: 20 20 20 20 20 52 45 46 45 52 45 4e 43 45 53 20       REFERENCES 
1460: 72 65 76 69 73 69 6f 6e 2c 0a 0a 09 20 20 20 20  revision,...    
1470: 2d 2d 20 54 68 65 20 6d 61 69 6e 20 70 61 79 6c  -- The main payl
1480: 6f 61 64 20 6f 66 20 74 68 65 20 72 65 76 69 73  oad of the revis
1490: 69 6f 6e 20 61 72 65 20 74 68 65 20 64 61 74 65  ion are the date
14a0: 2f 74 69 6d 65 20 69 74 0a 09 20 20 20 20 2d 2d  /time it..    --
14b0: 20 77 61 73 20 65 6e 74 65 72 65 64 2c 20 69 74   was entered, it
14c0: 73 20 73 74 61 74 65 2c 20 6f 70 65 72 61 74 69  s state, operati
14d0: 6f 6e 20 28 3d 20 74 79 70 65 2f 63 6c 61 73 73  on (= type/class
14e0: 29 2c 20 74 65 78 74 0a 09 20 20 20 20 2d 2d 20  ), text..    -- 
14f0: 63 6f 6e 74 65 6e 74 2c 20 61 6e 64 20 6d 65 74  content, and met
1500: 61 20 64 61 74 61 20 28 61 75 74 68 6f 72 2c 20  a data (author, 
1510: 6c 6f 67 20 6d 65 73 73 61 67 65 2c 20 62 72 61  log message, bra
1520: 6e 63 68 2c 0a 09 20 20 20 20 2d 2d 20 70 72 6f  nch,..    -- pro
1530: 6a 65 63 74 29 2e 20 54 68 65 20 6c 61 73 74 20  ject). The last 
1540: 69 73 20 65 6e 63 6f 64 65 64 20 61 73 20 73 69  is encoded as si
1550: 6e 67 6c 65 20 69 64 2c 20 73 65 65 20 74 61 62  ngle id, see tab
1560: 6c 65 0a 09 20 20 20 20 2d 2d 20 27 6d 65 74 61  le..    -- 'meta
1570: 27 2e 20 54 68 65 20 64 61 74 65 2f 74 69 6d 65  '. The date/time
1580: 20 69 73 20 67 69 76 65 6e 20 69 6e 20 73 65 63   is given in sec
1590: 6f 6e 64 73 20 73 69 6e 63 65 20 74 68 65 0a 09  onds since the..
15a0: 20 20 20 20 2d 2d 20 65 70 6f 63 68 2c 20 66 6f      -- epoch, fo
15b0: 72 20 65 61 73 79 20 63 6f 6d 70 61 72 69 73 6f  r easy compariso
15c0: 6e 2e 20 54 68 65 20 74 65 78 74 20 63 6f 6e 74  n. The text cont
15d0: 65 6e 74 20 69 73 20 61 6e 0a 09 20 20 20 20 2d  ent is an..    -
15e0: 2d 20 28 6f 66 66 73 65 74 2c 6c 65 6e 67 74 68  - (offset,length
15f0: 29 20 70 61 69 72 20 69 6e 74 6f 20 74 68 65 20  ) pair into the 
1600: 72 63 73 20 61 72 63 68 69 76 65 2e 0a 0a 09 20  rcs archive.... 
1610: 20 20 20 6f 70 20 20 20 20 49 4e 54 45 47 45 52     op    INTEGER
1620: 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 52 45 46 45    NOT NULL  REFE
1630: 52 45 4e 43 45 53 20 6f 70 74 79 70 65 2c 0a 09  RENCES optype,..
1640: 20 20 20 20 64 61 74 65 20 20 49 4e 54 45 47 45      date  INTEGE
1650: 52 20 20 4e 4f 54 20 4e 55 4c 4c 2c 0a 09 20 20  R  NOT NULL,..  
1660: 20 20 73 74 61 74 65 20 54 45 58 54 20 20 20 20    state TEXT    
1670: 20 4e 4f 54 20 4e 55 4c 4c 2c 0a 09 20 20 20 20   NOT NULL,..    
1680: 6d 69 64 20 20 20 49 4e 54 45 47 45 52 20 20 4e  mid   INTEGER  N
1690: 4f 54 20 4e 55 4c 4c 20 20 52 45 46 45 52 45 4e  OT NULL  REFEREN
16a0: 43 45 53 20 6d 65 74 61 2c 0a 09 20 20 20 20 63  CES meta,..    c
16b0: 6f 66 66 20 20 49 4e 54 45 47 45 52 20 20 4e 4f  off  INTEGER  NO
16c0: 54 20 4e 55 4c 4c 2c 0a 09 20 20 20 20 63 6c 65  T NULL,..    cle
16d0: 6e 20 20 49 4e 54 45 47 45 52 20 20 4e 4f 54 20  n  INTEGER  NOT 
16e0: 4e 55 4c 4c 2c 0a 0a 09 20 20 20 20 55 4e 49 51  NULL,...    UNIQ
16f0: 55 45 20 28 66 69 64 2c 20 72 65 76 29 20 2d 2d  UE (fid, rev) --
1700: 20 54 68 65 20 44 54 4e 20 69 73 20 75 6e 69 71   The DTN is uniq
1710: 75 65 20 77 69 74 68 69 6e 20 74 68 65 20 72 65  ue within the re
1720: 76 69 73 69 6f 6e 27 73 20 66 69 6c 65 2e 0a 09  vision's file...
1730: 7d 0a 0a 09 73 74 61 74 65 20 65 78 74 65 6e 64  }...state extend
1740: 20 6f 70 74 79 70 65 20 7b 0a 09 20 20 20 20 6f   optype {..    o
1750: 69 64 20 20 20 49 4e 54 45 47 45 52 20 20 4e 4f  id   INTEGER  NO
1760: 54 20 4e 55 4c 4c 20 20 50 52 49 4d 41 52 59 20  T NULL  PRIMARY 
1770: 4b 45 59 2c 0a 09 20 20 20 20 6e 61 6d 65 20 20  KEY,..    name  
1780: 54 45 58 54 20 20 20 20 20 4e 4f 54 20 4e 55 4c  TEXT     NOT NUL
1790: 4c 2c 0a 09 20 20 20 20 55 4e 49 51 55 45 28 6e  L,..    UNIQUE(n
17a0: 61 6d 65 29 0a 09 7d 0a 09 73 74 61 74 65 20 72  ame)..}..state r
17b0: 75 6e 20 7b 0a 09 20 20 20 20 49 4e 53 45 52 54  un {..    INSERT
17c0: 20 49 4e 54 4f 20 6f 70 74 79 70 65 20 56 41 4c   INTO optype VAL
17d0: 55 45 53 20 28 2d 31 2c 27 64 65 6c 65 74 65 27  UES (-1,'delete'
17e0: 29 3b 20 20 2d 2d 20 54 68 65 20 6f 70 63 6f 64  );  -- The opcod
17f0: 65 20 6e 61 6d 65 73 20 61 72 65 20 74 68 65 0a  e names are the.
1800: 09 20 20 20 20 49 4e 53 45 52 54 20 49 4e 54 4f  .    INSERT INTO
1810: 20 6f 70 74 79 70 65 20 56 41 4c 55 45 53 20 28   optype VALUES (
1820: 20 30 2c 27 6e 6f 74 68 69 6e 67 27 29 3b 20 2d   0,'nothing'); -
1830: 2d 20 66 69 78 65 64 20 70 69 65 63 65 73 2c 20  - fixed pieces, 
1840: 73 65 65 20 6d 79 6f 70 73 74 61 74 65 0a 09 20  see myopstate.. 
1850: 20 20 20 49 4e 53 45 52 54 20 49 4e 54 4f 20 6f     INSERT INTO o
1860: 70 74 79 70 65 20 56 41 4c 55 45 53 20 28 20 31  ptype VALUES ( 1
1870: 2c 27 61 64 64 27 29 3b 20 20 20 20 20 2d 2d 20  ,'add');     -- 
1880: 69 6e 20 66 69 6c 65 3a 3a 72 65 76 2e 20 6d 79  in file::rev. my
1890: 6f 70 63 6f 64 65 20 69 73 0a 09 20 20 20 20 49  opcode is..    I
18a0: 4e 53 45 52 54 20 49 4e 54 4f 20 6f 70 74 79 70  NSERT INTO optyp
18b0: 65 20 56 41 4c 55 45 53 20 28 20 32 2c 27 63 68  e VALUES ( 2,'ch
18c0: 61 6e 67 65 27 29 3b 20 20 2d 2d 20 6c 6f 61 64  ange');  -- load
18d0: 65 64 20 66 72 6f 6d 20 74 68 69 73 2e 0a 09 7d  ed from this...}
18e0: 0a 0a 09 73 74 61 74 65 20 65 78 74 65 6e 64 20  ...state extend 
18f0: 72 65 76 69 73 69 6f 6e 62 72 61 6e 63 68 63 68  revisionbranchch
1900: 69 6c 64 72 65 6e 20 7b 0a 09 20 20 20 20 2d 2d  ildren {..    --
1910: 20 54 68 65 20 6e 6f 6e 2d 70 72 69 6d 61 72 79   The non-primary
1920: 20 63 68 69 6c 64 72 65 6e 20 6f 66 20 61 20 72   children of a r
1930: 65 76 69 73 69 6f 6e 2c 20 61 73 20 72 65 61 63  evision, as reac
1940: 68 61 62 6c 65 0a 09 20 20 20 20 2d 2d 20 74 68  hable..    -- th
1950: 72 6f 75 67 68 20 61 20 62 72 61 6e 63 68 20 73  rough a branch s
1960: 79 6d 62 6f 6c 2c 20 61 72 65 20 6c 69 73 74 65  ymbol, are liste
1970: 64 20 68 65 72 65 2e 20 54 68 69 73 20 69 73 0a  d here. This is.
1980: 09 20 20 20 20 2d 2d 20 6e 65 65 64 65 64 20 62  .    -- needed b
1990: 79 20 70 61 73 73 20 35 20 74 6f 20 62 72 65 61  y pass 5 to brea
19a0: 6b 20 69 6e 74 65 72 6e 61 6c 20 64 65 70 65 6e  k internal depen
19b0: 64 65 6e 63 69 65 73 20 69 6e 20 61 0a 09 20 20  dencies in a..  
19c0: 20 20 2d 2d 20 63 68 61 6e 67 65 73 65 74 2e 0a    -- changeset..
19d0: 0a 09 20 20 20 20 72 69 64 20 20 20 49 4e 54 45  ..    rid   INTE
19e0: 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 52  GER  NOT NULL  R
19f0: 45 46 45 52 45 4e 43 45 53 20 72 65 76 69 73 69  EFERENCES revisi
1a00: 6f 6e 2c 0a 09 20 20 20 20 62 72 69 64 20 20 49  on,..    brid  I
1a10: 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c  NTEGER  NOT NULL
1a20: 20 20 52 45 46 45 52 45 4e 43 45 53 20 72 65 76    REFERENCES rev
1a30: 69 73 69 6f 6e 2c 0a 09 20 20 20 20 55 4e 49 51  ision,..    UNIQ
1a40: 55 45 28 72 69 64 2c 62 72 69 64 29 0a 09 7d 0a  UE(rid,brid)..}.
1a50: 0a 09 73 74 61 74 65 20 65 78 74 65 6e 64 20 74  ..state extend t
1a60: 61 67 20 7b 0a 09 20 20 20 20 74 69 64 20 20 49  ag {..    tid  I
1a70: 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c  NTEGER  NOT NULL
1a80: 20 20 50 52 49 4d 41 52 59 20 4b 45 59 20 41 55    PRIMARY KEY AU
1a90: 54 4f 49 4e 43 52 45 4d 45 4e 54 2c 0a 09 20 20  TOINCREMENT,..  
1aa0: 20 20 66 69 64 20 20 49 4e 54 45 47 45 52 20 20    fid  INTEGER  
1ab0: 4e 4f 54 20 4e 55 4c 4c 20 20 52 45 46 45 52 45  NOT NULL  REFERE
1ac0: 4e 43 45 53 20 66 69 6c 65 2c 20 20 20 20 20 2d  NCES file,     -
1ad0: 2d 20 46 69 6c 65 20 74 68 65 20 69 74 65 6d 20  - File the item 
1ae0: 62 65 6c 6f 6e 67 73 20 74 6f 0a 09 20 20 20 20  belongs to..    
1af0: 6c 6f 64 20 20 49 4e 54 45 47 45 52 20 20 20 20  lod  INTEGER    
1b00: 20 20 20 20 20 20 20 20 52 45 46 45 52 45 4e 43          REFERENC
1b10: 45 53 20 73 79 6d 62 6f 6c 2c 20 20 20 2d 2d 20  ES symbol,   -- 
1b20: 4c 69 6e 65 20 6f 66 20 64 65 76 65 6c 6f 70 6d  Line of developm
1b30: 65 6e 74 20 28 4e 55 4c 4c 20 3d 3e 20 54 72 75  ent (NULL => Tru
1b40: 6e 6b 29 0a 09 20 20 20 20 73 69 64 20 20 49 4e  nk)..    sid  IN
1b50: 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 20  TEGER  NOT NULL 
1b60: 20 52 45 46 45 52 45 4e 43 45 53 20 73 79 6d 62   REFERENCES symb
1b70: 6f 6c 2c 20 20 20 2d 2d 20 53 79 6d 62 6f 6c 20  ol,   -- Symbol 
1b80: 63 61 70 74 75 72 69 6e 67 20 74 68 65 20 74 61  capturing the ta
1b90: 67 0a 0a 09 20 20 20 20 72 65 76 20 20 49 4e 54  g...    rev  INT
1ba0: 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 20  EGER  NOT NULL  
1bb0: 52 45 46 45 52 45 4e 43 45 53 20 72 65 76 69 73  REFERENCES revis
1bc0: 69 6f 6e 20 20 2d 2d 20 54 68 65 20 72 65 76 69  ion  -- The revi
1bd0: 73 69 6f 6e 20 62 65 69 6e 67 20 74 61 67 67 65  sion being tagge
1be0: 64 2e 0a 09 7d 20 7b 20 72 65 76 20 73 69 64 20  d...} { rev sid 
1bf0: 7d 0a 09 23 20 49 6e 64 69 63 65 73 20 6f 6e 3a  }..# Indices on:
1c00: 20 72 65 76 20 28 72 65 76 69 73 69 6f 6e 20 73   rev (revision s
1c10: 75 63 63 65 73 73 6f 72 73 29 0a 09 23 20 20 20  uccessors)..#   
1c20: 20 20 20 20 20 20 20 20 20 20 73 69 64 20 28 74            sid (t
1c30: 61 67 20 70 72 65 64 65 63 65 73 73 6f 72 73 2c  ag predecessors,
1c40: 20 62 72 61 6e 63 68 20 73 75 63 63 65 73 73 6f   branch successo
1c50: 72 73 2f 70 72 65 64 65 63 65 73 73 6f 72 73 29  rs/predecessors)
1c60: 0a 0a 09 73 74 61 74 65 20 65 78 74 65 6e 64 20  ...state extend 
1c70: 62 72 61 6e 63 68 20 7b 0a 09 20 20 20 20 62 69  branch {..    bi
1c80: 64 20 20 20 49 4e 54 45 47 45 52 20 20 4e 4f 54  d   INTEGER  NOT
1c90: 20 4e 55 4c 4c 20 20 50 52 49 4d 41 52 59 20 4b   NULL  PRIMARY K
1ca0: 45 59 20 41 55 54 4f 49 4e 43 52 45 4d 45 4e 54  EY AUTOINCREMENT
1cb0: 2c 0a 09 20 20 20 20 66 69 64 20 20 20 49 4e 54  ,..    fid   INT
1cc0: 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 20  EGER  NOT NULL  
1cd0: 52 45 46 45 52 45 4e 43 45 53 20 66 69 6c 65 2c  REFERENCES file,
1ce0: 20 20 20 20 20 2d 2d 20 46 69 6c 65 20 74 68 65       -- File the
1cf0: 20 69 74 65 6d 20 62 65 6c 6f 6e 67 73 20 74 6f   item belongs to
1d00: 0a 09 20 20 20 20 6c 6f 64 20 20 20 49 4e 54 45  ..    lod   INTE
1d10: 47 45 52 20 20 20 20 20 20 20 20 20 20 20 20 52  GER            R
1d20: 45 46 45 52 45 4e 43 45 53 20 73 79 6d 62 6f 6c  EFERENCES symbol
1d30: 2c 20 20 20 2d 2d 20 4c 69 6e 65 20 6f 66 20 64  ,   -- Line of d
1d40: 65 76 65 6c 6f 70 6d 65 6e 74 20 28 4e 55 4c 4c  evelopment (NULL
1d50: 20 3d 3e 20 54 72 75 6e 6b 29 0a 09 20 20 20 20   => Trunk)..    
1d60: 73 69 64 20 20 20 49 4e 54 45 47 45 52 20 20 4e  sid   INTEGER  N
1d70: 4f 54 20 4e 55 4c 4c 20 20 52 45 46 45 52 45 4e  OT NULL  REFEREN
1d80: 43 45 53 20 73 79 6d 62 6f 6c 2c 20 20 20 2d 2d  CES symbol,   --
1d90: 20 53 79 6d 62 6f 6c 20 63 61 70 74 75 72 69 6e   Symbol capturin
1da0: 67 20 74 68 65 20 62 72 61 6e 63 68 0a 0a 09 20  g the branch... 
1db0: 20 20 20 72 6f 6f 74 20 20 49 4e 54 45 47 45 52     root  INTEGER
1dc0: 20 20 20 20 20 20 20 20 20 20 20 20 52 45 46 45              REFE
1dd0: 52 45 4e 43 45 53 20 72 65 76 69 73 69 6f 6e 2c  RENCES revision,
1de0: 20 2d 2d 20 52 65 76 69 73 69 6f 6e 20 74 68 65   -- Revision the
1df0: 20 62 72 61 6e 63 68 20 73 70 72 6f 75 74 73 20   branch sprouts 
1e00: 66 72 6f 6d 0a 09 20 20 20 20 66 69 72 73 74 20  from..    first 
1e10: 49 4e 54 45 47 45 52 20 20 20 20 20 20 20 20 20  INTEGER         
1e20: 20 20 20 52 45 46 45 52 45 4e 43 45 53 20 72 65     REFERENCES re
1e30: 76 69 73 69 6f 6e 2c 20 2d 2d 20 46 69 72 73 74  vision, -- First
1e40: 20 72 65 76 69 73 69 6f 6e 20 63 6f 6d 6d 69 74   revision commit
1e50: 74 65 64 20 74 6f 20 74 68 65 20 62 72 61 6e 63  ted to the branc
1e60: 68 0a 09 20 20 20 20 62 72 61 20 20 20 54 45 58  h..    bra   TEX
1e70: 54 20 20 20 20 20 4e 4f 54 20 4e 55 4c 4c 2c 20  T     NOT NULL, 
1e80: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
1e90: 20 20 20 20 20 2d 2d 20 62 72 61 6e 63 68 20 6e       -- branch n
1ea0: 75 6d 62 65 72 0a 09 20 20 20 20 70 6f 73 20 20  umber..    pos  
1eb0: 20 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55   INTEGER  NOT NU
1ec0: 4c 4c 20 20 20 20 20 20 20 20 20 20 20 20 20 20  LL              
1ed0: 20 20 20 20 20 20 20 20 20 2d 2d 20 63 72 65 61           -- crea
1ee0: 74 69 6f 6e 20 6f 72 64 65 72 20 69 6e 20 72 6f  tion order in ro
1ef0: 6f 74 2e 0a 0a 09 20 20 20 20 2d 2d 20 41 20 62  ot....    -- A b
1f00: 72 61 6e 63 68 20 63 61 6e 20 65 78 69 73 74 20  ranch can exist 
1f10: 77 69 74 68 6f 75 74 20 72 6f 6f 74 2e 20 49 74  without root. It
1f20: 20 68 61 70 70 65 6e 73 20 77 68 65 6e 20 74 68   happens when th
1f30: 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 2d 2d  e.            --
1f40: 20 6f 6e 6c 79 20 72 65 76 69 73 69 6f 6e 20 6f   only revision o
1f50: 6e 20 74 72 75 6e 6b 20 69 73 20 74 68 65 20 75  n trunk is the u
1f60: 6e 6e 65 63 65 73 73 61 72 79 20 64 65 61 64 20  nnecessary dead 
1f70: 6f 6e 65 20 74 68 65 0a 20 20 20 20 20 20 20 20  one the.        
1f80: 20 20 20 20 2d 2d 20 62 72 61 6e 63 68 20 77 61      -- branch wa
1f90: 73 20 73 70 72 6f 75 74 65 64 20 66 72 6f 6d 20  s sprouted from 
1fa0: 61 6e 64 20 69 74 20 68 61 73 20 63 6f 6d 6d 69  and it has commi
1fb0: 74 73 2e 20 54 68 65 20 62 72 61 6e 63 68 0a 20  ts. The branch. 
1fc0: 20 20 20 20 20 20 20 20 20 20 20 2d 2d 20 77 69             -- wi
1fd0: 6c 6c 20 65 78 69 73 74 20 74 6f 20 62 65 20 74  ll exist to be t
1fe0: 68 65 20 4c 4f 44 20 6f 66 20 69 74 73 20 72 65  he LOD of its re
1ff0: 76 69 73 69 6f 6e 73 2c 20 6e 6f 74 68 69 6e 67  visions, nothing
2000: 20 74 6f 0a 20 20 20 20 20 20 20 20 20 20 20 20   to.            
2010: 2d 2d 20 73 70 72 6f 75 74 20 66 72 6f 6d 2c 20  -- sprout from, 
2020: 74 68 65 20 64 65 61 64 20 72 65 76 69 73 69 6f  the dead revisio
2030: 6e 20 77 61 73 20 72 65 6d 6f 76 65 64 2c 20 68  n was removed, h
2040: 65 6e 63 65 20 6e 6f 0a 20 20 20 20 20 20 20 20  ence no.        
2050: 20 20 20 20 2d 2d 20 72 6f 6f 74 2e 0a 09 7d 20      -- root...} 
2060: 7b 20 72 6f 6f 74 20 66 69 72 73 74 20 73 69 64  { root first sid
2070: 20 7d 0a 09 23 20 49 6e 64 69 63 65 73 20 6f 6e   }..# Indices on
2080: 3a 20 72 6f 6f 74 20 20 28 72 65 76 69 73 69 6f  : root  (revisio
2090: 6e 20 73 75 63 63 65 73 73 6f 72 73 29 0a 09 23  n successors)..#
20a0: 20 20 20 20 20 20 20 20 20 20 20 20 20 66 69 72               fir
20b0: 73 74 20 28 72 65 76 69 73 69 6f 6e 20 70 72 65  st (revision pre
20c0: 64 65 63 65 73 73 6f 72 73 29 0a 09 23 20 20 20  decessors)..#   
20d0: 20 20 20 20 20 20 20 20 20 20 73 69 64 20 20 20            sid   
20e0: 28 74 61 67 20 70 72 65 64 65 63 65 73 73 6f 72  (tag predecessor
20f0: 73 2c 20 62 72 61 6e 63 68 20 73 75 63 63 65 73  s, branch succes
2100: 73 6f 72 73 2f 70 72 65 64 65 63 65 73 73 6f 72  sors/predecessor
2110: 73 29 0a 0a 09 23 20 50 72 6f 6a 65 63 74 20 6c  s)...# Project l
2120: 65 76 65 6c 20 2e 2e 2e 0a 09 23 09 70 4c 69 6e  evel .....#.pLin
2130: 65 4f 66 44 65 76 65 6c 6f 70 6d 65 6e 74 2c 20  eOfDevelopment, 
2140: 70 53 79 6d 62 6f 6c 2c 20 70 42 72 61 6e 63 68  pSymbol, pBranch
2150: 2c 20 70 54 61 67 2c 20 70 54 72 75 6e 6b 0a 09  , pTag, pTrunk..
2160: 23 0a 09 23 09 70 54 72 75 6e 6b 20 20 3c 2d 20  #..#.pTrunk  <- 
2170: 70 4c 69 6e 65 4f 66 44 65 76 65 6c 6f 70 6d 65  pLineOfDevelopme
2180: 6e 74 0a 09 23 09 70 42 72 61 6e 63 68 20 3c 2d  nt..#.pBranch <-
2190: 20 70 53 79 6d 62 6f 6c 2c 20 70 4c 69 6e 65 4f   pSymbol, pLineO
21a0: 66 44 65 76 65 6c 6f 70 6d 65 6e 74 0a 09 23 09  fDevelopment..#.
21b0: 70 54 61 67 20 20 20 20 3c 2d 20 70 53 79 6d 62  pTag    <- pSymb
21c0: 6f 6c 2c 20 70 4c 69 6e 65 4f 66 44 65 76 65 6c  ol, pLineOfDevel
21d0: 6f 70 6d 65 6e 74 0a 0a 09 73 74 61 74 65 20 65  opment...state e
21e0: 78 74 65 6e 64 20 73 79 6d 62 6f 6c 20 7b 0a 09  xtend symbol {..
21f0: 20 20 20 20 73 69 64 20 20 49 4e 54 45 47 45 52      sid  INTEGER
2200: 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 50 52 49 4d    NOT NULL  PRIM
2210: 41 52 59 20 4b 45 59 20 41 55 54 4f 49 4e 43 52  ARY KEY AUTOINCR
2220: 45 4d 45 4e 54 2c 0a 09 20 20 20 20 70 69 64 20  EMENT,..    pid 
2230: 20 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55   INTEGER  NOT NU
2240: 4c 4c 20 20 52 45 46 45 52 45 4e 43 45 53 20 70  LL  REFERENCES p
2250: 72 6f 6a 65 63 74 2c 20 20 2d 2d 20 50 72 6f 6a  roject,  -- Proj
2260: 65 63 74 20 74 68 65 20 73 79 6d 62 6f 6c 20 62  ect the symbol b
2270: 65 6c 6f 6e 67 73 20 74 6f 0a 09 20 20 20 20 6e  elongs to..    n
2280: 61 6d 65 20 54 45 58 54 20 20 20 20 20 4e 4f 54  ame TEXT     NOT
2290: 20 4e 55 4c 4c 2c 0a 09 20 20 20 20 74 79 70 65   NULL,..    type
22a0: 20 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55   INTEGER  NOT NU
22b0: 4c 4c 20 20 52 45 46 45 52 45 4e 43 45 53 20 73  LL  REFERENCES s
22c0: 79 6d 74 79 70 65 2c 20 20 2d 2d 20 65 6e 75 6d  ymtype,  -- enum
22d0: 20 7b 20 65 78 63 6c 75 64 65 64 20 3d 20 30 2c   { excluded = 0,
22e0: 20 74 61 67 2c 20 62 72 61 6e 63 68 2c 20 75 6e   tag, branch, un
22f0: 64 65 66 69 6e 65 64 20 7d 0a 0a 09 20 20 20 20  defined }...    
2300: 74 61 67 5f 63 6f 75 6e 74 20 20 20 20 49 4e 54  tag_count    INT
2310: 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 2c 20  EGER  NOT NULL, 
2320: 2d 2d 20 48 6f 77 20 6f 66 74 65 6e 20 74 68 65  -- How often the
2330: 20 73 79 6d 62 6f 6c 20 69 73 20 75 73 65 64 20   symbol is used 
2340: 61 73 20 74 61 67 2e 0a 09 20 20 20 20 62 72 61  as tag...    bra
2350: 6e 63 68 5f 63 6f 75 6e 74 20 49 4e 54 45 47 45  nch_count INTEGE
2360: 52 20 20 4e 4f 54 20 4e 55 4c 4c 2c 20 2d 2d 20  R  NOT NULL, -- 
2370: 48 6f 77 20 6f 66 74 65 6e 20 74 68 65 20 73 79  How often the sy
2380: 6d 62 6f 6c 20 69 73 20 75 73 65 64 20 61 73 20  mbol is used as 
2390: 62 72 61 6e 63 68 0a 09 20 20 20 20 63 6f 6d 6d  branch..    comm
23a0: 69 74 5f 63 6f 75 6e 74 20 49 4e 54 45 47 45 52  it_count INTEGER
23b0: 20 20 4e 4f 54 20 4e 55 4c 4c 2c 20 2d 2d 20 48    NOT NULL, -- H
23c0: 6f 77 20 6f 66 74 65 6e 20 61 20 66 69 6c 65 20  ow often a file 
23d0: 77 61 73 20 63 6f 6d 6d 69 74 74 65 64 20 6f 6e  was committed on
23e0: 20 74 68 65 20 73 79 6d 62 6f 6c 0a 0a 09 20 20   the symbol...  
23f0: 20 20 55 4e 49 51 55 45 20 28 70 69 64 2c 20 6e    UNIQUE (pid, n
2400: 61 6d 65 29 20 2d 2d 20 53 79 6d 62 6f 6c 73 20  ame) -- Symbols 
2410: 61 72 65 20 75 6e 69 71 75 65 20 77 69 74 68 69  are unique withi
2420: 6e 20 74 68 65 20 70 72 6f 6a 65 63 74 0a 09 7d  n the project..}
2430: 0a 0a 09 73 74 61 74 65 20 65 78 74 65 6e 64 20  ...state extend 
2440: 62 6c 6f 63 6b 65 72 20 7b 0a 09 20 20 20 20 2d  blocker {..    -
2450: 2d 20 46 6f 72 20 65 61 63 68 20 73 79 6d 62 6f  - For each symbo
2460: 6c 20 77 65 20 73 61 76 65 20 77 68 69 63 68 20  l we save which 
2470: 6f 74 68 65 72 20 73 79 6d 62 6f 6c 73 20 61 72  other symbols ar
2480: 65 0a 09 20 20 20 20 2d 2d 20 62 6c 6f 63 6b 69  e..    -- blocki
2490: 6e 67 20 69 74 73 20 72 65 6d 6f 76 61 6c 20 28  ng its removal (
24a0: 69 66 20 74 68 65 20 75 73 65 72 20 61 73 6b 73  if the user asks
24b0: 20 66 6f 72 20 69 74 29 2e 0a 0a 09 20 20 20 20   for it)....    
24c0: 73 69 64 20 49 4e 54 45 47 45 52 20 20 4e 4f 54  sid INTEGER  NOT
24d0: 20 4e 55 4c 4c 20 20 52 45 46 45 52 45 4e 43 45   NULL  REFERENCE
24e0: 53 20 73 79 6d 62 6f 6c 2c 20 2d 2d 0a 09 20 20  S symbol, --..  
24f0: 20 20 62 69 64 20 49 4e 54 45 47 45 52 20 20 4e    bid INTEGER  N
2500: 4f 54 20 4e 55 4c 4c 20 20 52 45 46 45 52 45 4e  OT NULL  REFEREN
2510: 43 45 53 20 73 79 6d 62 6f 6c 2c 20 2d 2d 20 53  CES symbol, -- S
2520: 70 72 6f 75 74 65 64 20 66 72 6f 6d 20 73 69 64  prouted from sid
2530: 2c 20 62 6c 6f 63 6b 73 20 69 74 2e 0a 09 20 20  , blocks it...  
2540: 20 20 55 4e 49 51 55 45 20 28 73 69 64 2c 20 62    UNIQUE (sid, b
2550: 69 64 29 0a 09 7d 0a 0a 09 73 74 61 74 65 20 65  id)..}...state e
2560: 78 74 65 6e 64 20 70 61 72 65 6e 74 20 7b 0a 09  xtend parent {..
2570: 20 20 20 20 2d 2d 20 46 6f 72 20 65 61 63 68 20      -- For each 
2580: 73 79 6d 62 6f 6c 20 77 65 20 73 61 76 65 20 77  symbol we save w
2590: 68 69 63 68 20 6f 74 68 65 72 20 73 79 6d 62 6f  hich other symbo
25a0: 6c 73 20 63 61 6e 20 61 63 74 20 61 73 0a 09 20  ls can act as.. 
25b0: 20 20 20 2d 2d 20 61 20 70 6f 73 73 69 62 6c 65     -- a possible
25c0: 20 70 61 72 65 6e 74 20 69 6e 20 73 6f 6d 65 20   parent in some 
25d0: 66 69 6c 65 2c 20 61 6e 64 20 68 6f 77 20 6f 66  file, and how of
25e0: 74 65 6e 2e 0a 0a 09 20 20 20 20 73 69 64 20 49  ten....    sid I
25f0: 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c  NTEGER  NOT NULL
2600: 20 20 52 45 46 45 52 45 4e 43 45 53 20 73 79 6d    REFERENCES sym
2610: 62 6f 6c 2c 20 2d 2d 0a 09 20 20 20 20 70 69 64  bol, --..    pid
2620: 20 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55   INTEGER  NOT NU
2630: 4c 4c 20 20 52 45 46 45 52 45 4e 43 45 53 20 73  LL  REFERENCES s
2640: 79 6d 62 6f 6c 2c 20 2d 2d 20 50 6f 73 73 69 62  ymbol, -- Possib
2650: 6c 65 20 70 61 72 65 6e 74 20 6f 66 20 73 69 64  le parent of sid
2660: 0a 09 20 20 20 20 6e 20 20 20 49 4e 54 45 47 45  ..    n   INTEGE
2670: 52 20 20 4e 4f 54 20 4e 55 4c 4c 2c 20 20 20 20  R  NOT NULL,    
2680: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
2690: 2d 2d 20 48 6f 77 20 6f 66 74 65 6e 20 70 69 64  -- How often pid
26a0: 20 63 61 6e 20 61 63 74 20 61 73 20 70 61 72 65   can act as pare
26b0: 6e 74 2e 0a 09 20 20 20 20 55 4e 49 51 55 45 20  nt...    UNIQUE 
26c0: 28 73 69 64 2c 20 70 69 64 29 0a 09 7d 0a 0a 09  (sid, pid)..}...
26d0: 73 74 61 74 65 20 65 78 74 65 6e 64 20 73 79 6d  state extend sym
26e0: 74 79 70 65 20 7b 0a 09 20 20 20 20 74 69 64 20  type {..    tid 
26f0: 20 20 20 49 4e 54 45 47 45 52 20 20 4e 4f 54 20     INTEGER  NOT 
2700: 4e 55 4c 4c 20 20 50 52 49 4d 41 52 59 20 4b 45  NULL  PRIMARY KE
2710: 59 2c 0a 09 20 20 20 20 6e 61 6d 65 20 20 20 54  Y,..    name   T
2720: 45 58 54 20 20 20 20 20 4e 4f 54 20 4e 55 4c 4c  EXT     NOT NULL
2730: 2c 0a 09 20 20 20 20 70 6c 75 72 61 6c 20 54 45  ,..    plural TE
2740: 58 54 20 20 20 20 20 4e 4f 54 20 4e 55 4c 4c 2c  XT     NOT NULL,
2750: 0a 09 20 20 20 20 55 4e 49 51 55 45 20 28 6e 61  ..    UNIQUE (na
2760: 6d 65 29 0a 09 20 20 20 20 55 4e 49 51 55 45 20  me)..    UNIQUE 
2770: 28 70 6c 75 72 61 6c 29 0a 09 7d 0a 09 73 74 61  (plural)..}..sta
2780: 74 65 20 72 75 6e 20 7b 0a 09 20 20 20 20 49 4e  te run {..    IN
2790: 53 45 52 54 20 49 4e 54 4f 20 73 79 6d 74 79 70  SERT INTO symtyp
27a0: 65 20 56 41 4c 55 45 53 20 28 30 2c 27 65 78 63  e VALUES (0,'exc
27b0: 6c 75 64 65 64 27 2c 20 27 65 78 63 6c 75 64 65  luded', 'exclude
27c0: 64 27 29 3b 20 20 2d 2d 20 54 68 65 20 69 64 73  d');  -- The ids
27d0: 20 61 72 65 20 74 68 65 20 66 69 78 65 64 0a 09   are the fixed..
27e0: 20 20 20 20 49 4e 53 45 52 54 20 49 4e 54 4f 20      INSERT INTO 
27f0: 73 79 6d 74 79 70 65 20 56 41 4c 55 45 53 20 28  symtype VALUES (
2800: 31 2c 27 74 61 67 27 2c 20 20 20 20 20 20 27 74  1,'tag',      't
2810: 61 67 73 27 29 3b 20 20 20 20 20 20 2d 2d 20 70  ags');      -- p
2820: 69 65 63 65 73 2c 20 73 65 65 20 70 72 6f 6a 65  ieces, see proje
2830: 63 74 3a 3a 73 79 6d 2c 0a 09 20 20 20 20 49 4e  ct::sym,..    IN
2840: 53 45 52 54 20 49 4e 54 4f 20 73 79 6d 74 79 70  SERT INTO symtyp
2850: 65 20 56 41 4c 55 45 53 20 28 32 2c 27 62 72 61  e VALUES (2,'bra
2860: 6e 63 68 27 2c 20 20 20 27 62 72 61 6e 63 68 65  nch',   'branche
2870: 73 27 29 3b 20 20 2d 2d 20 67 65 74 73 79 6d 74  s');  -- getsymt
2880: 79 70 65 73 20 61 6e 64 20 61 73 73 6f 63 69 61  ypes and associa
2890: 74 65 64 0a 09 20 20 20 20 49 4e 53 45 52 54 20  ted..    INSERT 
28a0: 49 4e 54 4f 20 73 79 6d 74 79 70 65 20 56 41 4c  INTO symtype VAL
28b0: 55 45 53 20 28 33 2c 27 75 6e 64 65 66 69 6e 65  UES (3,'undefine
28c0: 64 27 2c 27 75 6e 64 65 66 69 6e 65 64 27 29 3b  d','undefined');
28d0: 20 2d 2d 20 74 79 70 65 76 61 72 69 61 62 6c 65   -- typevariable
28e0: 73 2e 0a 09 7d 0a 0a 09 73 74 61 74 65 20 65 78  s...}...state ex
28f0: 74 65 6e 64 20 6d 65 74 61 20 7b 0a 09 20 20 20  tend meta {..   
2900: 20 2d 2d 20 4d 65 74 61 20 64 61 74 61 20 6f 66   -- Meta data of
2910: 20 72 65 76 69 73 69 6f 6e 73 2e 20 53 65 65 20   revisions. See 
2920: 72 65 76 69 73 69 6f 6e 2e 6d 69 64 20 66 6f 72  revision.mid for
2930: 20 74 68 65 0a 09 20 20 20 20 2d 2d 20 72 65 66   the..    -- ref
2940: 65 72 65 6e 63 65 2e 20 4d 61 6e 79 20 72 65 76  erence. Many rev
2950: 69 73 69 6f 6e 73 20 63 61 6e 20 73 68 61 72 65  isions can share
2960: 20 6d 65 74 61 20 64 61 74 61 2e 20 54 68 69 73   meta data. This
2970: 20 69 73 0a 09 20 20 20 20 2d 2d 20 61 63 74 75   is..    -- actu
2980: 61 6c 6c 79 20 6f 6e 65 20 6f 66 20 74 68 65 20  ally one of the 
2990: 63 72 69 74 65 72 69 6f 6e 73 20 75 73 65 64 20  criterions used 
29a0: 74 6f 20 73 6f 72 74 20 72 65 76 69 73 69 6f 6e  to sort revision
29b0: 73 0a 09 20 20 20 20 2d 2d 20 69 6e 74 6f 20 63  s..    -- into c
29c0: 68 61 6e 67 65 73 65 74 73 2e 0a 0a 09 20 20 20  hangesets....   
29d0: 20 6d 69 64 20 49 4e 54 45 47 45 52 20 20 4e 4f   mid INTEGER  NO
29e0: 54 20 4e 55 4c 4c 20 20 50 52 49 4d 41 52 59 20  T NULL  PRIMARY 
29f0: 4b 45 59 20 20 41 55 54 4f 49 4e 43 52 45 4d 45  KEY  AUTOINCREME
2a00: 4e 54 2c 0a 0a 09 20 20 20 20 2d 2d 20 4d 65 74  NT,...    -- Met
2a10: 61 20 64 61 74 61 20 62 65 6c 6f 6e 67 73 20 74  a data belongs t
2a20: 6f 20 61 20 73 70 65 63 69 66 69 63 20 70 72 6f  o a specific pro
2a30: 6a 65 63 74 2c 20 73 74 72 6f 6e 67 65 72 2c 20  ject, stronger, 
2a40: 74 6f 20 61 0a 09 20 20 20 20 2d 2d 20 62 72 61  to a..    -- bra
2a50: 6e 63 68 20 69 6e 20 74 68 61 74 20 70 72 6f 6a  nch in that proj
2a60: 65 63 74 2e 20 49 74 20 66 75 72 74 68 65 72 20  ect. It further 
2a70: 68 61 73 20 61 20 6c 6f 67 20 6d 65 73 73 61 67  has a log messag
2a80: 65 2c 0a 09 20 20 20 20 2d 2d 20 61 6e 64 20 69  e,..    -- and i
2a90: 74 73 20 61 75 74 68 6f 72 2e 20 54 68 69 73 20  ts author. This 
2aa0: 69 73 20 75 6e 69 71 75 65 20 77 69 74 68 20 74  is unique with t
2ab0: 68 65 20 70 72 6f 6a 65 63 74 20 61 6e 64 0a 09  he project and..
2ac0: 20 20 20 20 2d 2d 20 62 72 61 6e 63 68 2e 0a 0a      -- branch...
2ad0: 09 20 20 20 20 70 69 64 20 49 4e 54 45 47 45 52  .    pid INTEGER
2ae0: 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 52 45 46 45    NOT NULL  REFE
2af0: 52 45 4e 43 45 53 20 70 72 6f 6a 65 63 74 2c 20  RENCES project, 
2b00: 20 2d 2d 0a 09 20 20 20 20 62 69 64 20 49 4e 54   --..    bid INT
2b10: 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 20  EGER  NOT NULL  
2b20: 52 45 46 45 52 45 4e 43 45 53 20 73 79 6d 62 6f  REFERENCES symbo
2b30: 6c 2c 20 20 20 2d 2d 0a 09 20 20 20 20 61 69 64  l,   --..    aid
2b40: 20 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55   INTEGER  NOT NU
2b50: 4c 4c 20 20 52 45 46 45 52 45 4e 43 45 53 20 61  LL  REFERENCES a
2b60: 75 74 68 6f 72 2c 20 20 20 2d 2d 0a 09 20 20 20  uthor,   --..   
2b70: 20 63 69 64 20 49 4e 54 45 47 45 52 20 20 4e 4f   cid INTEGER  NO
2b80: 54 20 4e 55 4c 4c 20 20 52 45 46 45 52 45 4e 43  T NULL  REFERENC
2b90: 45 53 20 63 6d 65 73 73 61 67 65 2c 20 2d 2d 0a  ES cmessage, --.
2ba0: 0a 09 20 20 20 20 55 4e 49 51 55 45 20 28 70 69  ..    UNIQUE (pi
2bb0: 64 2c 20 62 69 64 2c 20 61 69 64 2c 20 63 69 64  d, bid, aid, cid
2bc0: 29 0a 0a 09 20 20 20 20 2d 2d 20 43 6f 6e 73 74  )...    -- Const
2bd0: 72 61 69 6e 74 73 3a 20 54 68 65 20 70 72 6f 6a  raints: The proj
2be0: 65 63 74 20 6f 66 20 74 68 65 20 6d 65 74 61 20  ect of the meta 
2bf0: 64 61 74 61 20 6f 66 20 61 20 72 65 76 69 73 69  data of a revisi
2c00: 6f 6e 0a 09 20 20 20 20 2d 2d 20 20 20 20 20 20  on..    --      
2c10: 20 20 20 20 20 20 20 20 58 20 69 73 20 74 68 65          X is the
2c20: 20 73 61 6d 65 20 61 73 20 74 68 65 20 70 72 6f   same as the pro
2c30: 6a 65 63 74 20 6f 66 20 58 20 69 74 73 65 6c 66  ject of X itself
2c40: 2e 0a 09 20 20 20 20 2d 2d 0a 09 20 20 20 20 2d  ...    --..    -
2c50: 2d 20 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 20 54  - ............ T
2c60: 68 65 20 62 72 61 6e 63 68 20 6f 66 20 74 68 65  he branch of the
2c70: 20 6d 65 74 61 20 64 61 74 61 20 6f 66 20 61 20   meta data of a 
2c80: 72 65 76 69 73 69 6f 6e 0a 09 20 20 20 20 2d 2d  revision..    --
2c90: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 58 20                X 
2ca0: 69 73 20 74 68 65 20 73 61 6d 65 20 61 73 20 74  is the same as t
2cb0: 68 65 20 6c 69 6e 65 20 6f 66 20 64 65 76 65 6c  he line of devel
2cc0: 6f 70 6d 65 6e 74 0a 09 20 20 20 20 2d 2d 20 20  opment..    --  
2cd0: 20 20 20 20 20 20 20 20 20 20 20 20 6f 66 20 58              of X
2ce0: 20 69 74 73 65 6c 66 2e 0a 09 7d 0a 0a 09 23 20   itself...}...# 
2cf0: 41 75 74 68 6f 72 73 20 61 6e 64 20 63 6f 6d 6d  Authors and comm
2d00: 69 74 20 6d 65 73 73 61 67 65 73 20 61 72 65 20  it messages are 
2d10: 66 75 6c 6c 79 20 67 6c 6f 62 61 6c 2c 20 69 2e  fully global, i.
2d20: 65 2e 20 70 65 72 0a 09 23 20 72 65 70 6f 73 69  e. per..# reposi
2d30: 74 6f 72 79 2e 0a 0a 09 73 74 61 74 65 20 65 78  tory....state ex
2d40: 74 65 6e 64 20 61 75 74 68 6f 72 20 7b 0a 09 20  tend author {.. 
2d50: 20 20 20 61 69 64 20 20 49 4e 54 45 47 45 52 20     aid  INTEGER 
2d60: 20 4e 4f 54 20 4e 55 4c 4c 20 20 50 52 49 4d 41   NOT NULL  PRIMA
2d70: 52 59 20 4b 45 59 20 20 41 55 54 4f 49 4e 43 52  RY KEY  AUTOINCR
2d80: 45 4d 45 4e 54 2c 20 2d 2d 20 50 6f 6f 6c 20 6f  EMENT, -- Pool o
2d90: 66 20 74 68 65 20 75 6e 69 71 75 65 0a 09 20 20  f the unique..  
2da0: 20 20 6e 61 6d 65 20 54 45 58 54 20 20 20 20 20    name TEXT     
2db0: 4e 4f 54 20 4e 55 4c 4c 20 20 55 4e 49 51 55 45  NOT NULL  UNIQUE
2dc0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
2dd0: 20 20 20 20 20 20 2d 2d 20 61 75 74 68 6f 72 20        -- author 
2de0: 6e 61 6d 65 73 2e 0a 09 7d 0a 0a 09 73 74 61 74  names...}...stat
2df0: 65 20 65 78 74 65 6e 64 20 63 6d 65 73 73 61 67  e extend cmessag
2e00: 65 20 7b 0a 09 20 20 20 20 63 69 64 20 20 49 4e  e {..    cid  IN
2e10: 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 20  TEGER  NOT NULL 
2e20: 20 50 52 49 4d 41 52 59 20 4b 45 59 20 20 41 55   PRIMARY KEY  AU
2e30: 54 4f 49 4e 43 52 45 4d 45 4e 54 2c 20 2d 2d 20  TOINCREMENT, -- 
2e40: 50 6f 6f 6c 20 6f 66 20 74 68 65 20 75 6e 69 71  Pool of the uniq
2e50: 75 65 0a 09 20 20 20 20 74 65 78 74 20 54 45 58  ue..    text TEX
2e60: 54 20 20 20 20 20 4e 4f 54 20 4e 55 4c 4c 20 20  T     NOT NULL  
2e70: 55 4e 49 51 55 45 20 20 20 20 20 20 20 20 20 20  UNIQUE          
2e80: 20 20 20 20 20 20 20 20 20 20 20 20 2d 2d 20 6c              -- l
2e90: 6f 67 20 6d 65 73 73 61 67 65 73 0a 09 7d 0a 0a  og messages..}..
2ea0: 09 70 72 6f 6a 65 63 74 3a 3a 73 79 6d 20 67 65  .project::sym ge
2eb0: 74 73 79 6d 74 79 70 65 73 0a 09 66 69 6c 65 3a  tsymtypes..file:
2ec0: 3a 72 65 76 20 20 20 20 67 65 74 6f 70 63 6f 64  :rev    getopcod
2ed0: 65 73 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 7d  es..return.    }
2ee0: 0a 0a 20 20 20 20 74 79 70 65 6d 65 74 68 6f 64  ..    typemethod
2ef0: 20 6c 6f 61 64 20 7b 7d 20 7b 0a 09 73 74 61 74   load {} {..stat
2f00: 65 20 75 73 65 20 73 79 6d 62 6f 6c 0a 09 73 74  e use symbol..st
2f10: 61 74 65 20 75 73 65 20 73 79 6d 74 79 70 65 0a  ate use symtype.
2f20: 09 73 74 61 74 65 20 75 73 65 20 6f 70 74 79 70  .state use optyp
2f30: 65 0a 0a 09 70 72 6f 6a 65 63 74 3a 3a 73 79 6d  e...project::sym
2f40: 20 67 65 74 73 79 6d 74 79 70 65 73 0a 09 66 69   getsymtypes..fi
2f50: 6c 65 3a 3a 72 65 76 20 20 20 20 67 65 74 6f 70  le::rev    getop
2f60: 63 6f 64 65 73 0a 09 72 65 70 6f 73 69 74 6f 72  codes..repositor
2f70: 79 20 20 20 6c 6f 61 64 73 79 6d 62 6f 6c 73 0a  y   loadsymbols.
2f80: 09 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20  .return.    }.. 
2f90: 20 20 20 74 79 70 65 6d 65 74 68 6f 64 20 72 75     typemethod ru
2fa0: 6e 20 7b 7d 20 7b 0a 09 23 20 50 61 73 73 20 6d  n {} {..# Pass m
2fb0: 61 6e 61 67 65 72 20 69 6e 74 65 72 66 61 63 65  anager interface
2fc0: 2e 20 45 78 65 63 75 74 65 64 20 74 6f 20 70 65  . Executed to pe
2fd0: 72 66 6f 72 6d 20 74 68 65 0a 09 23 20 66 75 6e  rform the..# fun
2fe0: 63 74 69 6f 6e 61 6c 69 74 79 20 6f 66 20 74 68  ctionality of th
2ff0: 65 20 70 61 73 73 2e 0a 0a 09 73 65 74 20 72 62  e pass....set rb
3000: 61 73 65 20 5b 72 65 70 6f 73 69 74 6f 72 79 20  ase [repository 
3010: 62 61 73 65 3f 5d 0a 09 66 6f 72 65 61 63 68 20  base?]..foreach 
3020: 70 72 6f 6a 65 63 74 20 5b 72 65 70 6f 73 69 74  project [reposit
3030: 6f 72 79 20 70 72 6f 6a 65 63 74 73 5d 20 7b 0a  ory projects] {.
3040: 09 20 20 20 20 73 65 74 20 62 61 73 65 20 5b 3a  .    set base [:
3050: 3a 66 69 6c 65 20 6a 6f 69 6e 20 24 72 62 61 73  :file join $rbas
3060: 65 20 5b 24 70 72 6f 6a 65 63 74 20 62 61 73 65  e [$project base
3070: 5d 5d 0a 09 20 20 20 20 6c 6f 67 20 77 72 69 74  ]]..    log writ
3080: 65 20 31 20 63 6f 6c 6c 72 65 76 20 22 50 72 6f  e 1 collrev "Pro
3090: 63 65 73 73 69 6e 67 20 24 62 61 73 65 22 0a 0a  cessing $base"..
30a0: 09 20 20 20 20 66 6f 72 65 61 63 68 20 66 69 6c  .    foreach fil
30b0: 65 20 5b 24 70 72 6f 6a 65 63 74 20 66 69 6c 65  e [$project file
30c0: 73 5d 20 7b 0a 09 09 73 65 74 20 70 61 74 68 20  s] {...set path 
30d0: 5b 24 66 69 6c 65 20 70 61 74 68 5d 0a 09 09 6c  [$file path]...l
30e0: 6f 67 20 77 72 69 74 65 20 32 20 63 6f 6c 6c 72  og write 2 collr
30f0: 65 76 20 22 50 61 72 73 69 6e 67 20 24 70 61 74  ev "Parsing $pat
3100: 68 22 0a 09 09 69 66 20 7b 5b 63 61 74 63 68 20  h"...if {[catch 
3110: 7b 0a 09 09 20 20 20 20 70 61 72 73 65 72 20 70  {...    parser p
3120: 72 6f 63 65 73 73 20 5b 3a 3a 66 69 6c 65 20 6a  rocess [::file j
3130: 6f 69 6e 20 24 62 61 73 65 20 24 70 61 74 68 5d  oin $base $path]
3140: 20 24 66 69 6c 65 0a 09 09 7d 20 6d 73 67 5d 7d   $file...} msg]}
3150: 20 7b 0a 09 09 20 20 20 20 67 6c 6f 62 61 6c 20   {...    global 
3160: 65 72 72 6f 72 43 6f 64 65 0a 09 09 20 20 20 20  errorCode...    
3170: 69 66 20 7b 24 65 72 72 6f 72 43 6f 64 65 20 65  if {$errorCode e
3180: 71 20 22 76 63 3a 3a 72 63 73 3a 3a 70 61 72 73  q "vc::rcs::pars
3190: 65 72 22 7d 20 7b 0a 09 09 09 74 72 6f 75 62 6c  er"} {....troubl
31a0: 65 20 66 61 74 61 6c 20 22 24 70 61 74 68 20 69  e fatal "$path i
31b0: 73 20 6e 6f 74 20 61 20 76 61 6c 69 64 20 52 43  s not a valid RC
31c0: 53 20 61 72 63 68 69 76 65 20 28 24 6d 73 67 29  S archive ($msg)
31d0: 22 0a 09 09 20 20 20 20 7d 20 65 6c 73 65 20 7b  "...    } else {
31e0: 0a 09 09 09 67 6c 6f 62 61 6c 20 65 72 72 6f 72  ....global error
31f0: 49 6e 66 6f 0a 09 09 09 74 72 6f 75 62 6c 65 20  Info....trouble 
3200: 69 6e 74 65 72 6e 61 6c 20 24 65 72 72 6f 72 49  internal $errorI
3210: 6e 66 6f 0a 09 09 20 20 20 20 7d 0a 09 09 7d 20  nfo...    }...} 
3220: 65 6c 73 65 20 7b 0a 09 09 20 20 20 20 23 20 57  else {...    # W
3230: 65 20 70 65 72 73 69 73 74 20 74 68 65 20 63 6f  e persist the co
3240: 72 65 20 6f 66 20 74 68 65 20 64 61 74 61 20 63  re of the data c
3250: 6f 6c 6c 65 63 74 65 64 20 61 62 6f 75 74 0a 09  ollected about..
3260: 09 20 20 20 20 23 20 65 61 63 68 20 66 69 6c 65  .    # each file
3270: 20 69 6d 6d 65 64 69 61 74 65 6c 79 20 61 66 74   immediately aft
3280: 65 72 20 69 74 20 68 61 73 20 62 65 65 6e 20 70  er it has been p
3290: 61 72 73 65 64 0a 09 09 20 20 20 20 23 20 61 6e  arsed...    # an
32a0: 64 20 77 72 61 6e 67 6c 65 64 20 69 6e 74 6f 20  d wrangled into 
32b0: 73 68 61 70 65 2c 20 61 6e 64 20 74 68 65 6e 20  shape, and then 
32c0: 64 72 6f 70 20 69 74 20 66 72 6f 6d 0a 09 09 20  drop it from... 
32d0: 20 20 20 23 20 6d 65 6d 6f 72 79 2e 20 54 68 69     # memory. Thi
32e0: 73 20 69 73 20 64 6f 6e 65 20 74 6f 20 6b 65 65  s is done to kee
32f0: 70 20 74 68 65 20 61 6d 6f 75 6e 74 20 6f 66 0a  p the amount of.
3300: 09 09 20 20 20 20 23 20 72 65 71 75 69 72 65 64  ..    # required
3310: 20 6d 65 6d 6f 72 79 20 77 69 74 68 69 6e 20 73   memory within s
3320: 65 6e 73 69 62 6c 65 20 6c 69 6d 69 74 73 2e 20  ensible limits. 
3330: 57 69 74 68 6f 75 74 0a 09 09 20 20 20 20 23 20  Without...    # 
3340: 64 6f 69 6e 67 20 69 74 20 74 68 69 73 20 77 61  doing it this wa
3350: 79 20 77 65 20 77 6f 75 6c 64 20 65 61 73 69 6c  y we would easil
3360: 79 20 67 6f 62 62 6c 65 20 75 70 20 31 47 0a 09  y gobble up 1G..
3370: 09 20 20 20 20 23 20 6f 66 20 52 41 4d 20 6f 72  .    # of RAM or
3380: 20 6d 6f 72 65 20 77 69 74 68 20 61 6c 6c 20 74   more with all t
3390: 68 65 20 6f 62 6a 65 63 74 73 20 28 72 65 76 69  he objects (revi
33a0: 73 69 6f 6e 73 0a 09 09 20 20 20 20 23 20 61 6e  sions...    # an
33b0: 64 20 66 69 6c 65 2d 6c 65 76 65 6c 20 73 79 6d  d file-level sym
33c0: 62 6f 6c 73 29 2e 0a 0a 09 09 20 20 20 20 24 66  bols).....    $f
33d0: 69 6c 65 20 70 65 72 73 69 73 74 0a 09 09 7d 0a  ile persist...}.
33e0: 0a 09 09 24 66 69 6c 65 20 64 72 6f 70 0a 09 20  ...$file drop.. 
33f0: 20 20 20 7d 0a 0a 09 20 20 20 20 24 70 72 6f 6a     }...    $proj
3400: 65 63 74 20 70 75 72 67 65 67 68 6f 73 74 73 79  ect purgeghostsy
3410: 6d 62 6f 6c 73 0a 09 7d 0a 0a 09 72 65 70 6f 73  mbols..}...repos
3420: 69 74 6f 72 79 20 70 65 72 73 69 73 74 72 65 76  itory persistrev
3430: 0a 09 72 65 70 6f 73 69 74 6f 72 79 20 70 72 69  ..repository pri
3440: 6e 74 72 65 76 73 74 61 74 69 73 74 69 63 73 0a  ntrevstatistics.
3450: 09 69 6e 74 65 67 72 69 74 79 20 20 73 74 72 69  .integrity  stri
3460: 63 74 0a 0a 09 6c 6f 67 20 77 72 69 74 65 20 31  ct...log write 1
3470: 20 63 6f 6c 6c 72 65 76 20 22 53 63 61 6e 20 63   collrev "Scan c
3480: 6f 6d 70 6c 65 74 65 64 22 0a 09 72 65 74 75 72  ompleted"..retur
3490: 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 74 79 70  n.    }..    typ
34a0: 65 6d 65 74 68 6f 64 20 64 69 73 63 61 72 64 20  emethod discard 
34b0: 7b 7d 20 7b 0a 09 23 20 50 61 73 73 20 6d 61 6e  {} {..# Pass man
34c0: 61 67 65 72 20 69 6e 74 65 72 66 61 63 65 2e 20  ager interface. 
34d0: 45 78 65 63 75 74 65 64 20 66 6f 72 20 61 6c 6c  Executed for all
34e0: 20 70 61 73 73 65 73 20 61 66 74 65 72 20 74 68   passes after th
34f0: 65 0a 09 23 20 72 75 6e 20 70 61 73 73 65 73 2c  e..# run passes,
3500: 20 74 6f 20 72 65 6d 6f 76 65 20 61 6c 6c 20 64   to remove all d
3510: 61 74 61 20 6f 66 20 74 68 69 73 20 70 61 73 73  ata of this pass
3520: 20 66 72 6f 6d 20 74 68 65 20 73 74 61 74 65 2c   from the state,
3530: 0a 09 23 20 61 73 20 62 65 69 6e 67 20 6f 75 74  ..# as being out
3540: 20 6f 66 20 64 61 74 65 2e 0a 0a 09 73 74 61 74   of date....stat
3550: 65 20 64 69 73 63 61 72 64 20 72 65 76 69 73 69  e discard revisi
3560: 6f 6e 0a 09 73 74 61 74 65 20 64 69 73 63 61 72  on..state discar
3570: 64 20 74 61 67 0a 09 73 74 61 74 65 20 64 69 73  d tag..state dis
3580: 63 61 72 64 20 62 72 61 6e 63 68 0a 09 73 74 61  card branch..sta
3590: 74 65 20 64 69 73 63 61 72 64 20 73 79 6d 62 6f  te discard symbo
35a0: 6c 0a 09 73 74 61 74 65 20 64 69 73 63 61 72 64  l..state discard
35b0: 20 62 6c 6f 63 6b 65 72 0a 09 73 74 61 74 65 20   blocker..state 
35c0: 64 69 73 63 61 72 64 20 70 61 72 65 6e 74 0a 09  discard parent..
35d0: 73 74 61 74 65 20 64 69 73 63 61 72 64 20 73 79  state discard sy
35e0: 6d 74 79 70 65 0a 09 73 74 61 74 65 20 64 69 73  mtype..state dis
35f0: 63 61 72 64 20 6d 65 74 61 0a 09 73 74 61 74 65  card meta..state
3600: 20 64 69 73 63 61 72 64 20 61 75 74 68 6f 72 0a   discard author.
3610: 09 73 74 61 74 65 20 64 69 73 63 61 72 64 20 63  .state discard c
3620: 6d 65 73 73 61 67 65 0a 09 72 65 74 75 72 6e 0a  message..return.
3630: 20 20 20 20 7d 0a 0a 20 20 20 20 23 20 54 4f 44      }..    # TOD
3640: 4f 3a 20 4d 6f 76 65 20 74 68 69 73 20 63 6f 64  O: Move this cod
3650: 65 20 74 6f 20 74 68 65 20 69 6e 74 65 67 72 69  e to the integri
3660: 74 79 20 6d 6f 64 75 6c 65 0a 20 20 20 20 70 72  ty module.    pr
3670: 6f 63 20 50 61 72 61 6e 6f 69 61 20 7b 7d 20 7b  oc Paranoia {} {
3680: 0a 09 23 20 54 68 69 73 20 63 6f 64 65 20 70 65  ..# This code pe
3690: 72 66 6f 72 6d 73 20 61 20 6e 75 6d 62 65 72 20  rforms a number 
36a0: 6f 66 20 70 61 72 61 6e 6f 69 64 20 63 68 65 63  of paranoid chec
36b0: 6b 73 20 6f 66 20 74 68 65 0a 09 23 20 64 61 74  ks of the..# dat
36c0: 61 62 61 73 65 2c 20 73 65 61 72 63 68 69 6e 67  abase, searching
36d0: 20 66 6f 72 20 69 6e 63 6f 6e 73 69 73 74 65 6e   for inconsisten
36e0: 74 20 63 72 6f 73 73 2d 72 65 66 65 72 65 6e 63  t cross-referenc
36f0: 65 73 2e 0a 09 6c 6f 67 20 77 72 69 74 65 20 34  es...log write 4
3700: 20 63 6f 6c 6c 72 65 76 20 7b 43 68 65 63 6b 20   collrev {Check 
3710: 64 61 74 61 62 61 73 65 20 63 6f 6e 73 69 73 74  database consist
3720: 65 6e 63 79 7d 0a 0a 09 73 65 74 20 6e 20 30 20  ency}...set n 0 
3730: 3b 20 23 20 43 6f 75 6e 74 65 72 20 66 6f 72 20  ; # Counter for 
3740: 74 68 65 20 63 68 65 63 6b 73 20 28 77 65 20 70  the checks (we p
3750: 72 69 6e 74 20 61 6e 20 69 64 20 62 65 66 6f 72  rint an id befor
3760: 65 20 74 68 65 0a 09 09 20 20 23 20 6d 61 69 6e  e the...  # main
3770: 20 6c 61 62 65 6c 29 2e 0a 0a 09 23 20 46 69 6e   label)....# Fin
3780: 64 20 61 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20  d all revisions 
3790: 77 68 69 63 68 20 64 69 73 61 67 72 65 65 20 77  which disagree w
37a0: 69 74 68 20 74 68 65 69 72 20 6c 69 6e 65 20 6f  ith their line o
37b0: 66 0a 09 23 20 64 65 76 65 6c 6f 70 6d 65 6e 74  f..# development
37c0: 20 61 62 6f 75 74 20 74 68 65 20 70 72 6f 6a 65   about the proje
37d0: 63 74 20 74 68 65 79 20 61 72 65 20 6f 77 6e 65  ct they are owne
37e0: 64 20 62 79 2e 0a 09 43 68 65 63 6b 20 5c 0a 09  d by...Check \..
37f0: 20 20 20 20 7b 52 65 76 69 73 69 6f 6e 73 20 61      {Revisions a
3800: 6e 64 20 74 68 65 69 72 20 4c 4f 44 73 20 68 61  nd their LODs ha
3810: 76 65 20 74 6f 20 62 65 20 69 6e 20 74 68 65 20  ve to be in the 
3820: 73 61 6d 65 20 70 72 6f 6a 65 63 74 7d 20 5c 0a  same project} \.
3830: 09 20 20 20 20 7b 64 69 73 61 67 72 65 65 73 20  .    {disagrees 
3840: 77 69 74 68 20 69 74 73 20 4c 4f 44 20 61 62 6f  with its LOD abo
3850: 75 74 20 6f 77 6e 69 6e 67 20 70 72 6f 6a 65 63  ut owning projec
3860: 74 7d 20 7b 0a 09 09 53 45 4c 45 43 54 20 46 2e  t} {...SELECT F.
3870: 6e 61 6d 65 2c 20 52 2e 72 65 76 0a 09 09 46 52  name, R.rev...FR
3880: 4f 4d 20 20 20 72 65 76 69 73 69 6f 6e 20 52 2c  OM   revision R,
3890: 20 66 69 6c 65 20 46 2c 20 73 79 6d 62 6f 6c 20   file F, symbol 
38a0: 53 0a 09 09 57 48 45 52 45 20 20 52 2e 66 69 64  S...WHERE  R.fid
38b0: 20 3d 20 46 2e 66 69 64 20 20 20 2d 2d 20 47 65   = F.fid   -- Ge
38c0: 74 20 66 69 6c 65 20 6f 66 20 72 65 76 69 73 69  t file of revisi
38d0: 6f 6e 0a 09 09 41 4e 44 20 20 20 20 52 2e 6c 6f  on...AND    R.lo
38e0: 64 20 3d 20 53 2e 73 69 64 20 20 20 2d 2d 20 47  d = S.sid   -- G
38f0: 65 74 20 73 79 6d 62 6f 6c 20 66 6f 72 20 72 65  et symbol for re
3900: 76 69 73 69 6f 6e 27 73 20 4c 4f 44 0a 09 09 41  vision's LOD...A
3910: 4e 44 20 20 20 20 46 2e 70 69 64 20 21 3d 20 53  ND    F.pid != S
3920: 2e 70 69 64 20 20 2d 2d 20 62 75 74 20 73 79 6d  .pid  -- but sym
3930: 62 6f 6c 20 69 73 20 66 6f 72 20 61 20 64 69 66  bol is for a dif
3940: 66 65 72 65 6e 74 20 70 72 6f 6a 65 63 74 0a 09  ferent project..
3950: 09 3b 0a 09 20 20 20 20 7d 0a 09 23 20 46 69 6e  .;..    }..# Fin
3960: 64 20 61 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20  d all revisions 
3970: 77 68 69 63 68 20 64 69 73 67 72 65 65 20 77 69  which disgree wi
3980: 74 68 20 74 68 65 69 72 20 6d 65 74 61 20 64 61  th their meta da
3990: 74 61 20 61 62 6f 75 74 0a 09 23 20 74 68 65 20  ta about..# the 
39a0: 70 72 6f 6a 65 63 74 20 74 68 65 79 20 61 72 65  project they are
39b0: 20 6f 77 6e 65 64 20 62 79 2e 0a 09 43 68 65 63   owned by...Chec
39c0: 6b 20 5c 0a 09 20 20 20 20 7b 52 65 76 69 73 69  k \..    {Revisi
39d0: 6f 6e 73 20 61 6e 64 20 74 68 65 69 72 20 6d 65  ons and their me
39e0: 74 61 20 64 61 74 61 20 68 61 76 65 20 74 6f 20  ta data have to 
39f0: 62 65 20 69 6e 20 74 68 65 20 73 61 6d 65 20 70  be in the same p
3a00: 72 6f 6a 65 63 74 7d 20 5c 0a 09 20 20 20 20 7b  roject} \..    {
3a10: 64 69 73 61 67 72 65 65 73 20 77 69 74 68 20 69  disagrees with i
3a20: 74 73 20 6d 65 74 61 20 64 61 74 61 20 61 62 6f  ts meta data abo
3a30: 75 74 20 6f 77 6e 69 6e 67 20 70 72 6f 6a 65 63  ut owning projec
3a40: 74 7d 20 7b 0a 09 09 53 45 4c 45 43 54 20 46 2e  t} {...SELECT F.
3a50: 6e 61 6d 65 2c 20 52 2e 72 65 76 0a 09 09 46 52  name, R.rev...FR
3a60: 4f 4d 20 20 20 72 65 76 69 73 69 6f 6e 20 52 2c  OM   revision R,
3a70: 20 66 69 6c 65 20 46 2c 20 6d 65 74 61 20 4d 0a   file F, meta M.
3a80: 09 09 57 48 45 52 45 20 20 52 2e 66 69 64 20 3d  ..WHERE  R.fid =
3a90: 20 46 2e 66 69 64 20 20 20 2d 2d 20 47 65 74 20   F.fid   -- Get 
3aa0: 66 69 6c 65 20 6f 66 20 72 65 76 69 73 69 6f 6e  file of revision
3ab0: 0a 09 09 41 4e 44 20 20 20 20 52 2e 6d 69 64 20  ...AND    R.mid 
3ac0: 3d 20 4d 2e 6d 69 64 20 20 20 2d 2d 20 47 65 74  = M.mid   -- Get
3ad0: 20 6d 65 74 61 20 64 61 74 61 20 6f 66 20 72 65   meta data of re
3ae0: 76 69 73 69 6f 6e 0a 09 09 41 4e 44 20 20 20 20  vision...AND    
3af0: 46 2e 70 69 64 20 21 3d 20 4d 2e 70 69 64 20 20  F.pid != M.pid  
3b00: 2d 2d 20 62 75 74 20 69 73 20 66 6f 72 20 61 20  -- but is for a 
3b10: 64 69 66 66 65 72 65 6e 74 20 70 72 6f 6a 65 63  different projec
3b20: 74 0a 09 09 3b 0a 09 20 20 20 20 7d 0a 09 23 20  t...;..    }..# 
3b30: 46 69 6e 64 20 61 6c 6c 20 72 65 76 69 73 69 6f  Find all revisio
3b40: 6e 73 20 77 68 69 63 68 20 64 69 73 67 72 65 65  ns which disgree
3b50: 20 77 69 74 68 20 74 68 65 69 72 20 6d 65 74 61   with their meta
3b60: 20 64 61 74 61 20 61 62 6f 75 74 0a 09 23 20 74   data about..# t
3b70: 68 65 20 62 72 61 6e 63 68 2f 6c 69 6e 65 20 6f  he branch/line o
3b80: 66 20 64 65 76 65 6c 6f 70 6d 65 6e 74 20 74 68  f development th
3b90: 65 79 20 62 65 6c 6f 6e 67 20 74 6f 2e 0a 09 43  ey belong to...C
3ba0: 68 65 63 6b 20 5c 0a 09 20 20 20 20 7b 52 65 76  heck \..    {Rev
3bb0: 69 73 69 6f 6e 73 20 61 6e 64 20 74 68 65 69 72  isions and their
3bc0: 20 6d 65 74 61 20 64 61 74 61 20 68 61 76 65 20   meta data have 
3bd0: 74 6f 20 62 65 20 69 6e 20 74 68 65 20 73 61 6d  to be in the sam
3be0: 65 20 4c 4f 44 7d 20 5c 0a 09 20 20 20 20 7b 64  e LOD} \..    {d
3bf0: 69 73 61 67 72 65 65 73 20 77 69 74 68 20 69 74  isagrees with it
3c00: 73 20 6d 65 74 61 20 64 61 74 61 20 61 62 6f 75  s meta data abou
3c10: 74 20 6f 77 6e 69 6e 67 20 4c 4f 44 7d 20 7b 0a  t owning LOD} {.
3c20: 09 09 53 45 4c 45 43 54 20 46 2e 6e 61 6d 65 2c  ..SELECT F.name,
3c30: 20 52 2e 72 65 76 0a 09 09 46 52 4f 4d 20 20 20   R.rev...FROM   
3c40: 72 65 76 69 73 69 6f 6e 20 52 2c 20 6d 65 74 61  revision R, meta
3c50: 20 4d 2c 20 66 69 6c 65 20 46 0a 09 09 57 48 45   M, file F...WHE
3c60: 52 45 20 20 52 2e 6d 69 64 20 3d 20 4d 2e 6d 69  RE  R.mid = M.mi
3c70: 64 20 20 20 2d 2d 20 47 65 74 20 6d 65 74 61 20  d   -- Get meta 
3c80: 64 61 74 61 20 6f 66 20 72 65 76 69 73 69 6f 6e  data of revision
3c90: 0a 09 09 41 4e 44 20 20 20 20 52 2e 6c 6f 64 20  ...AND    R.lod 
3ca0: 21 3d 20 4d 2e 62 69 64 20 20 2d 2d 20 62 75 74  != M.bid  -- but
3cb0: 20 69 73 20 66 6f 72 20 61 20 64 69 66 66 65 72   is for a differ
3cc0: 65 6e 74 20 4c 4f 44 0a 09 09 41 4e 44 20 20 20  ent LOD...AND   
3cd0: 20 52 2e 66 69 64 20 3d 20 46 2e 66 69 64 20 20   R.fid = F.fid  
3ce0: 20 2d 2d 20 47 65 74 20 66 69 6c 65 20 6f 66 20   -- Get file of 
3cf0: 72 65 76 69 73 69 6f 6e 0a 09 09 3b 0a 09 20 20  revision...;..  
3d00: 20 20 7d 0a 09 23 20 46 69 6e 64 20 61 6c 6c 20    }..# Find all 
3d10: 72 65 76 69 73 69 6f 6e 73 20 77 69 74 68 20 61  revisions with a
3d20: 20 70 72 69 6d 61 72 79 20 63 68 69 6c 64 20 77   primary child w
3d30: 68 69 63 68 20 64 69 73 61 67 72 65 65 73 0a 09  hich disagrees..
3d40: 23 20 61 62 6f 75 74 20 74 68 65 20 66 69 6c 65  # about the file
3d50: 20 74 68 65 79 20 62 65 6c 6f 6e 67 20 74 6f 2e   they belong to.
3d60: 0a 09 43 68 65 63 6b 20 5c 0a 09 20 20 20 20 7b  ..Check \..    {
3d70: 52 65 76 69 73 69 6f 6e 73 20 61 6e 64 20 74 68  Revisions and th
3d80: 65 69 72 20 70 72 69 6d 61 72 79 20 63 68 69 6c  eir primary chil
3d90: 64 72 65 6e 20 68 61 76 65 20 74 6f 20 62 65 20  dren have to be 
3da0: 69 6e 20 74 68 65 20 73 61 6d 65 20 66 69 6c 65  in the same file
3db0: 7d 20 5c 0a 09 20 20 20 20 7b 64 69 73 61 67 72  } \..    {disagr
3dc0: 65 65 73 20 77 69 74 68 20 69 74 73 20 70 72 69  ees with its pri
3dd0: 6d 61 72 79 20 63 68 69 6c 64 20 61 62 6f 75 74  mary child about
3de0: 20 74 68 65 20 6f 77 6e 69 6e 67 20 66 69 6c 65   the owning file
3df0: 7d 20 7b 0a 09 09 53 45 4c 45 43 54 20 46 2e 6e  } {...SELECT F.n
3e00: 61 6d 65 2c 20 52 2e 72 65 76 0a 09 09 46 52 4f  ame, R.rev...FRO
3e10: 4d 20 20 20 72 65 76 69 73 69 6f 6e 20 52 2c 20  M   revision R, 
3e20: 72 65 76 69 73 69 6f 6e 20 43 2c 20 66 69 6c 65  revision C, file
3e30: 20 46 0a 09 09 57 48 45 52 45 20 20 52 2e 66 69   F...WHERE  R.fi
3e40: 64 20 3d 20 46 2e 66 69 64 20 20 20 20 20 20 20  d = F.fid       
3e50: 20 2d 2d 20 47 65 74 20 66 69 6c 65 20 6f 66 20   -- Get file of 
3e60: 72 65 76 69 73 69 6f 6e 0a 09 09 41 4e 44 20 20  revision...AND  
3e70: 20 20 52 2e 63 68 69 6c 64 20 49 53 20 4e 4f 54    R.child IS NOT
3e80: 20 4e 55 4c 4c 20 20 2d 2d 20 52 65 73 74 72 69   NULL  -- Restri
3e90: 63 74 20 74 6f 20 6e 6f 6e 2d 6c 65 61 66 20 72  ct to non-leaf r
3ea0: 65 76 69 73 69 6f 6e 73 0a 09 09 41 4e 44 20 20  evisions...AND  
3eb0: 20 20 52 2e 63 68 69 6c 64 20 3d 20 43 2e 72 69    R.child = C.ri
3ec0: 64 20 20 20 20 20 20 2d 2d 20 47 65 74 20 63 68  d      -- Get ch
3ed0: 69 6c 64 20 28 68 61 73 20 74 6f 20 65 78 69 73  ild (has to exis
3ee0: 74 29 0a 09 09 41 4e 44 20 20 20 20 43 2e 66 69  t)...AND    C.fi
3ef0: 64 20 21 3d 20 52 2e 66 69 64 20 20 20 20 20 20  d != R.fid      
3f00: 20 2d 2d 20 57 68 69 63 20 77 72 6f 6e 67 6c 79   -- Whic wrongly
3f10: 20 69 73 20 69 6e 20 61 20 64 69 66 66 65 72 65   is in a differe
3f20: 6e 74 20 66 69 6c 65 0a 09 09 3b 0a 09 20 20 20  nt file...;..   
3f30: 20 7d 0a 0a 09 23 20 46 69 6e 64 20 61 6c 6c 20   }...# Find all 
3f40: 72 65 76 69 73 69 6f 6e 73 20 77 69 74 68 20 61  revisions with a
3f50: 20 62 72 61 6e 63 68 20 70 61 72 65 6e 74 20 73   branch parent s
3f60: 79 6d 62 6f 6c 20 77 68 6f 73 65 20 70 61 72 65  ymbol whose pare
3f70: 6e 74 0a 09 23 20 64 69 73 61 67 72 65 65 73 20  nt..# disagrees 
3f80: 61 62 6f 75 74 20 74 68 65 20 66 69 6c 65 20 74  about the file t
3f90: 68 65 79 20 62 65 6c 6f 6e 67 20 74 6f 2e 0a 09  hey belong to...
3fa0: 43 68 65 63 6b 20 5c 0a 09 20 20 20 20 7b 52 65  Check \..    {Re
3fb0: 76 69 73 69 6f 6e 73 20 61 6e 64 20 74 68 65 69  visions and thei
3fc0: 72 20 62 72 61 6e 63 68 20 63 68 69 6c 64 72 65  r branch childre
3fd0: 6e 20 68 61 76 65 20 74 6f 20 62 65 20 69 6e 20  n have to be in 
3fe0: 74 68 65 20 73 61 6d 65 20 66 69 6c 65 7d 20 5c  the same file} \
3ff0: 0a 09 20 20 20 20 7b 61 74 20 74 68 65 20 62 65  ..    {at the be
4000: 67 69 6e 6e 69 6e 67 20 6f 66 20 69 74 73 20 62  ginning of its b
4010: 72 61 6e 63 68 20 61 6e 64 20 69 74 73 20 70 61  ranch and its pa
4020: 72 65 6e 74 20 64 69 73 61 67 72 65 65 20 61 62  rent disagree ab
4030: 6f 75 74 20 74 68 65 20 6f 77 6e 69 6e 67 20 66  out the owning f
4040: 69 6c 65 7d 20 7b 0a 09 09 53 45 4c 45 43 54 20  ile} {...SELECT 
4050: 46 2e 6e 61 6d 65 2c 20 52 2e 72 65 76 0a 09 09  F.name, R.rev...
4060: 46 52 4f 4d 20 20 20 72 65 76 69 73 69 6f 6e 20  FROM   revision 
4070: 52 2c 20 72 65 76 69 73 69 6f 6e 20 50 2c 20 66  R, revision P, f
4080: 69 6c 65 20 46 0a 09 09 57 48 45 52 45 20 20 52  ile F...WHERE  R
4090: 2e 66 69 64 20 3d 20 46 2e 66 69 64 20 20 20 20  .fid = F.fid    
40a0: 20 20 20 20 20 20 2d 2d 20 47 65 74 20 66 69 6c        -- Get fil
40b0: 65 20 6f 66 20 72 65 76 69 73 69 6f 6e 0a 09 09  e of revision...
40c0: 41 4e 44 20 20 20 20 52 2e 62 70 61 72 65 6e 74  AND    R.bparent
40d0: 20 49 53 20 4e 4f 54 20 4e 55 4c 4c 20 20 2d 2d   IS NOT NULL  --
40e0: 20 52 65 73 74 72 69 63 74 20 74 6f 20 66 69 72   Restrict to fir
40f0: 73 74 20 6f 6e 20 62 72 61 6e 63 68 0a 09 09 41  st on branch...A
4100: 4e 44 20 20 20 20 52 2e 70 61 72 65 6e 74 20 3d  ND    R.parent =
4110: 20 50 2e 72 69 64 20 20 20 20 20 20 20 2d 2d 20   P.rid       -- 
4120: 47 65 74 20 6f 75 74 2d 6f 66 2d 62 72 61 6e 63  Get out-of-branc
4130: 68 20 70 61 72 65 6e 74 0a 09 09 41 4e 44 20 20  h parent...AND  
4140: 20 20 52 2e 66 69 64 20 21 3d 20 50 2e 66 69 64    R.fid != P.fid
4150: 20 20 20 20 20 20 20 20 20 2d 2d 20 57 68 69 63           -- Whic
4160: 68 20 77 72 6f 6e 67 6c 79 20 69 73 20 69 6e 20  h wrongly is in 
4170: 61 20 64 69 66 66 65 72 65 6e 74 20 66 69 6c 65  a different file
4180: 0a 09 09 3b 0a 09 20 20 20 20 7d 0a 09 23 20 46  ...;..    }..# F
4190: 69 6e 64 20 61 6c 6c 20 72 65 76 69 73 69 6f 6e  ind all revision
41a0: 73 20 77 69 74 68 20 61 20 6e 6f 6e 2d 4e 54 44  s with a non-NTD
41b0: 42 20 63 68 69 6c 64 20 77 68 69 63 68 20 64 69  B child which di
41c0: 73 61 67 72 65 65 73 0a 09 23 20 61 62 6f 75 74  sagrees..# about
41d0: 20 74 68 65 20 66 69 6c 65 20 74 68 65 79 20 62   the file they b
41e0: 65 6c 6f 6e 67 20 74 6f 2e 0a 09 43 68 65 63 6b  elong to...Check
41f0: 20 5c 0a 09 20 20 20 20 7b 52 65 76 69 73 69 6f   \..    {Revisio
4200: 6e 73 20 61 6e 64 20 74 68 65 69 72 20 6e 6f 6e  ns and their non
4210: 2d 4e 54 44 42 20 63 68 69 6c 64 72 65 6e 20 68  -NTDB children h
4220: 61 76 65 20 74 6f 20 62 65 20 69 6e 20 74 68 65  ave to be in the
4230: 20 73 61 6d 65 20 66 69 6c 65 7d 20 5c 0a 09 20   same file} \.. 
4240: 20 20 20 7b 64 69 73 61 67 72 65 65 73 20 77 69     {disagrees wi
4250: 74 68 20 69 74 73 20 6e 6f 6e 2d 4e 54 44 42 20  th its non-NTDB 
4260: 63 68 69 6c 64 20 61 62 6f 75 74 20 74 68 65 20  child about the 
4270: 6f 77 6e 69 6e 67 20 66 69 6c 65 7d 20 7b 0a 09  owning file} {..
4280: 09 53 45 4c 45 43 54 20 46 2e 6e 61 6d 65 2c 20  .SELECT F.name, 
4290: 52 2e 72 65 76 0a 09 09 46 52 4f 4d 20 20 20 72  R.rev...FROM   r
42a0: 65 76 69 73 69 6f 6e 20 52 2c 20 72 65 76 69 73  evision R, revis
42b0: 69 6f 6e 20 43 2c 20 66 69 6c 65 20 46 0a 09 09  ion C, file F...
42c0: 57 48 45 52 45 20 20 52 2e 66 69 64 20 3d 20 46  WHERE  R.fid = F
42d0: 2e 66 69 64 20 20 20 20 20 20 20 20 20 20 2d 2d  .fid          --
42e0: 20 47 65 74 20 66 69 6c 65 20 6f 66 20 72 65 76   Get file of rev
42f0: 69 73 69 6f 6e 0a 09 09 41 4e 44 20 20 20 20 52  ision...AND    R
4300: 2e 64 62 63 68 69 6c 64 20 49 53 20 4e 4f 54 20  .dbchild IS NOT 
4310: 4e 55 4c 4c 20 20 2d 2d 20 52 65 73 74 72 69 63  NULL  -- Restric
4320: 74 20 74 6f 20 73 65 6d 69 2d 6c 61 73 74 20 4e  t to semi-last N
4330: 54 44 42 20 72 65 76 69 73 69 6f 6e 0a 09 09 41  TDB revision...A
4340: 4e 44 20 20 20 20 52 2e 64 62 63 68 69 6c 64 20  ND    R.dbchild 
4350: 3d 20 43 2e 72 69 64 20 20 20 20 20 20 2d 2d 20  = C.rid      -- 
4360: 47 6f 74 20 74 6f 20 61 73 73 6f 63 69 61 74 65  Got to associate
4370: 64 20 74 72 75 6e 6b 20 72 65 76 69 73 69 6f 6e  d trunk revision
4380: 0a 09 09 41 4e 44 20 20 20 20 43 2e 66 69 64 20  ...AND    C.fid 
4390: 21 3d 20 52 2e 66 69 64 20 20 20 20 20 20 20 20  != R.fid        
43a0: 20 2d 2d 20 57 68 69 63 68 20 77 72 6f 6e 67 6c   -- Which wrongl
43b0: 79 20 69 73 20 69 6e 20 61 20 64 69 66 66 65 72  y is in a differ
43c0: 65 6e 74 20 66 69 6c 65 0a 09 09 3b 0a 09 20 20  ent file...;..  
43d0: 20 20 7d 0a 09 23 20 46 69 6e 64 20 61 6c 6c 20    }..# Find all 
43e0: 72 65 76 69 73 69 6f 6e 73 20 77 68 69 63 68 20  revisions which 
43f0: 68 61 76 65 20 61 20 70 72 69 6d 61 72 79 20 63  have a primary c
4400: 68 69 6c 64 2c 20 62 75 74 20 74 68 65 20 63 68  hild, but the ch
4410: 69 6c 64 0a 09 23 20 64 6f 65 73 20 6e 6f 74 20  ild..# does not 
4420: 68 61 76 65 20 74 68 65 6d 20 61 73 20 70 61 72  have them as par
4430: 65 6e 74 2e 0a 09 43 68 65 63 6b 20 5c 0a 09 20  ent...Check \.. 
4440: 20 20 20 7b 52 65 76 69 73 69 6f 6e 73 20 68 61     {Revisions ha
4450: 76 65 20 74 6f 20 62 65 20 70 61 72 65 6e 74 73  ve to be parents
4460: 20 6f 66 20 74 68 65 69 72 20 70 72 69 6d 61 72   of their primar
4470: 79 20 63 68 69 6c 64 72 65 6e 7d 20 5c 0a 09 20  y children} \.. 
4480: 20 20 20 7b 69 73 20 6e 6f 74 20 74 68 65 20 70     {is not the p
4490: 61 72 65 6e 74 20 6f 66 20 69 74 73 20 70 72 69  arent of its pri
44a0: 6d 61 72 79 20 63 68 69 6c 64 7d 20 7b 0a 09 09  mary child} {...
44b0: 53 45 4c 45 43 54 20 46 2e 6e 61 6d 65 2c 20 52  SELECT F.name, R
44c0: 2e 72 65 76 0a 09 09 46 52 4f 4d 20 20 20 72 65  .rev...FROM   re
44d0: 76 69 73 69 6f 6e 20 52 2c 20 72 65 76 69 73 69  vision R, revisi
44e0: 6f 6e 20 43 2c 20 66 69 6c 65 20 46 0a 09 09 57  on C, file F...W
44f0: 48 45 52 45 20 20 52 2e 66 69 64 20 3d 20 46 2e  HERE  R.fid = F.
4500: 66 69 64 20 20 20 20 20 20 20 20 2d 2d 20 47 65  fid        -- Ge
4510: 74 20 66 69 6c 65 20 6f 66 20 72 65 76 69 73 69  t file of revisi
4520: 6f 6e 0a 09 09 41 4e 44 20 20 20 20 52 2e 63 68  on...AND    R.ch
4530: 69 6c 64 20 49 53 20 4e 4f 54 20 4e 55 4c 4c 20  ild IS NOT NULL 
4540: 20 2d 2d 20 52 65 73 74 72 69 63 74 20 74 6f 20   -- Restrict to 
4550: 6e 6f 6e 2d 6c 65 61 76 65 73 0a 09 09 41 4e 44  non-leaves...AND
4560: 20 20 20 20 52 2e 63 68 69 6c 64 20 3d 20 43 2e      R.child = C.
4570: 72 69 64 20 20 20 20 20 20 2d 2d 20 47 65 74 20  rid      -- Get 
4580: 74 68 65 20 63 68 69 6c 64 20 28 68 61 73 20 74  the child (has t
4590: 6f 20 65 78 69 73 74 29 0a 09 09 41 4e 44 20 20  o exist)...AND  
45a0: 20 20 43 2e 70 61 72 65 6e 74 20 21 3d 20 52 2e    C.parent != R.
45b0: 72 69 64 20 20 20 20 2d 2d 20 57 68 69 63 68 20  rid    -- Which 
45c0: 64 6f 65 73 20 6e 6f 74 20 68 61 76 65 20 75 73  does not have us
45d0: 20 61 73 20 69 74 73 20 70 61 72 65 6e 74 2e 0a   as its parent..
45e0: 09 09 3b 0a 09 20 20 20 20 7d 0a 09 23 20 46 69  ..;..    }..# Fi
45f0: 6e 64 20 61 6c 6c 20 72 65 76 69 73 69 6f 6e 73  nd all revisions
4600: 20 77 68 69 63 68 20 68 61 76 65 20 61 20 70 72   which have a pr
4610: 69 6d 72 61 72 79 20 63 68 69 6c 64 2c 20 62 75  imrary child, bu
4620: 74 20 74 68 65 0a 09 23 20 63 68 69 6c 64 20 68  t the..# child h
4630: 61 73 20 61 20 62 72 61 6e 63 68 20 70 61 72 65  as a branch pare
4640: 6e 74 20 73 79 6d 62 6f 6c 20 6d 61 6b 69 6e 67  nt symbol making
4650: 20 74 68 65 6d 20 62 72 61 63 68 20 73 74 61 72   them brach star
4660: 74 65 72 73 2e 0a 09 43 68 65 63 6b 20 5c 0a 09  ters...Check \..
4670: 20 20 20 20 7b 50 72 69 6d 61 72 79 20 63 68 69      {Primary chi
4680: 6c 64 72 65 6e 20 6f 66 20 72 65 76 69 73 69 6f  ldren of revisio
4690: 6e 73 20 6d 75 73 74 20 6e 6f 74 20 73 74 61 72  ns must not star
46a0: 74 20 62 72 61 6e 63 68 65 73 7d 20 5c 0a 09 20  t branches} \.. 
46b0: 20 20 20 7b 69 73 20 70 61 72 65 6e 74 20 6f 66     {is parent of
46c0: 20 61 20 70 72 69 6d 61 72 79 20 63 68 69 6c 64   a primary child
46d0: 20 77 68 69 63 68 20 69 73 20 74 68 65 20 62 65   which is the be
46e0: 67 69 6e 6e 69 6e 67 20 6f 66 20 61 20 62 72 61  ginning of a bra
46f0: 6e 63 68 7d 20 7b 0a 09 09 53 45 4c 45 43 54 20  nch} {...SELECT 
4700: 46 2e 6e 61 6d 65 2c 20 52 2e 72 65 76 0a 09 09  F.name, R.rev...
4710: 46 52 4f 4d 20 20 20 72 65 76 69 73 69 6f 6e 20  FROM   revision 
4720: 52 2c 20 72 65 76 69 73 69 6f 6e 20 43 2c 20 66  R, revision C, f
4730: 69 6c 65 20 46 0a 09 09 57 48 45 52 45 20 20 52  ile F...WHERE  R
4740: 2e 66 69 64 20 3d 20 46 2e 66 69 64 20 20 20 20  .fid = F.fid    
4750: 20 20 20 20 20 20 20 2d 2d 20 47 65 74 20 66 69         -- Get fi
4760: 6c 65 20 6f 66 20 72 65 76 69 73 69 6f 6e 0a 09  le of revision..
4770: 09 41 4e 44 20 20 20 20 52 2e 63 68 69 6c 64 20  .AND    R.child 
4780: 49 53 20 4e 4f 54 20 4e 55 4c 4c 20 20 20 20 20  IS NOT NULL     
4790: 2d 2d 20 52 65 73 74 72 69 63 74 20 74 6f 20 6e  -- Restrict to n
47a0: 6f 6e 2d 6c 65 61 76 65 73 0a 09 09 41 4e 44 20  on-leaves...AND 
47b0: 20 20 20 52 2e 63 68 69 6c 64 20 3d 20 43 2e 72     R.child = C.r
47c0: 69 64 20 20 20 20 20 20 20 20 20 2d 2d 20 47 65  id         -- Ge
47d0: 74 20 74 68 65 20 63 68 69 6c 64 20 28 68 61 73  t the child (has
47e0: 20 74 6f 20 65 78 69 73 74 29 0a 09 09 41 4e 44   to exist)...AND
47f0: 20 20 20 20 43 2e 62 70 61 72 65 6e 74 20 49 53      C.bparent IS
4800: 20 4e 4f 54 20 4e 55 4c 4c 20 20 20 2d 2d 20 77   NOT NULL   -- w
4810: 72 6f 6e 67 6c 79 20 63 6c 61 69 6d 69 6e 67 20  rongly claiming 
4820: 74 6f 20 62 65 20 66 69 72 73 74 20 6f 6e 20 62  to be first on b
4830: 72 61 6e 63 68 0a 09 09 3b 0a 09 20 20 20 20 7d  ranch...;..    }
4840: 0a 09 23 20 46 69 6e 64 20 61 6c 6c 20 72 65 76  ..# Find all rev
4850: 69 73 69 6f 6e 73 20 77 69 74 68 6f 75 74 20 62  isions without b
4860: 72 61 6e 63 68 20 70 61 72 65 6e 74 20 73 79 6d  ranch parent sym
4870: 62 6f 6c 20 77 68 69 63 68 20 68 61 76 65 20 61  bol which have a
4880: 0a 09 23 20 70 61 72 65 6e 74 2c 20 62 75 74 20  ..# parent, but 
4890: 74 68 65 20 70 61 72 65 6e 74 20 64 6f 65 73 20  the parent does 
48a0: 6e 6f 74 20 68 61 76 65 20 74 68 65 6d 20 61 73  not have them as
48b0: 20 70 72 69 6d 61 72 79 20 63 68 69 6c 64 2e 0a   primary child..
48c0: 09 43 68 65 63 6b 20 5c 0a 09 20 20 20 20 7b 52  .Check \..    {R
48d0: 65 76 69 73 69 6f 6e 73 20 68 61 76 65 20 74 6f  evisions have to
48e0: 20 62 65 20 70 72 69 6d 61 72 79 20 63 68 69 6c   be primary chil
48f0: 64 72 65 6e 20 6f 66 20 74 68 65 69 72 20 70 61  dren of their pa
4900: 72 65 6e 74 73 2c 20 69 66 20 61 6e 79 7d 20 5c  rents, if any} \
4910: 0a 09 20 20 20 20 7b 69 73 20 6e 6f 74 20 74 68  ..    {is not th
4920: 65 20 63 68 69 6c 64 20 6f 66 20 69 74 73 20 70  e child of its p
4930: 61 72 65 6e 74 7d 20 7b 0a 09 09 53 45 4c 45 43  arent} {...SELEC
4940: 54 20 46 2e 6e 61 6d 65 2c 20 52 2e 72 65 76 0a  T F.name, R.rev.
4950: 09 09 46 52 4f 4d 20 20 20 72 65 76 69 73 69 6f  ..FROM   revisio
4960: 6e 20 52 2c 20 72 65 76 69 73 69 6f 6e 20 50 2c  n R, revision P,
4970: 20 66 69 6c 65 20 46 0a 09 09 57 48 45 52 45 20   file F...WHERE 
4980: 20 52 2e 66 69 64 20 3d 20 46 2e 66 69 64 0a 09   R.fid = F.fid..
4990: 09 41 4e 44 20 20 20 20 52 2e 62 70 61 72 65 6e  .AND    R.bparen
49a0: 74 20 49 53 20 4e 55 4c 4c 20 20 20 20 20 2d 2d  t IS NULL     --
49b0: 20 47 65 74 20 66 69 6c 65 20 6f 66 20 72 65 76   Get file of rev
49c0: 69 73 69 6f 6e 0a 09 09 41 4e 44 20 20 20 20 52  ision...AND    R
49d0: 2e 70 61 72 65 6e 74 20 49 53 20 4e 4f 54 20 4e  .parent IS NOT N
49e0: 55 4c 4c 20 20 2d 2d 20 52 65 73 74 72 69 63 74  ULL  -- Restrict
49f0: 20 74 6f 20 65 76 65 72 79 74 68 69 6e 67 20 6e   to everything n
4a00: 6f 74 20 66 69 72 73 74 20 6f 6e 20 61 20 62 72  ot first on a br
4a10: 61 6e 63 68 0a 09 09 41 4e 44 20 20 20 20 52 2e  anch...AND    R.
4a20: 70 61 72 65 6e 74 20 3d 20 50 2e 72 69 64 20 20  parent = P.rid  
4a30: 20 20 20 20 2d 2d 20 47 65 74 20 74 68 65 20 70      -- Get the p
4a40: 61 72 65 6e 74 20 28 68 61 73 20 74 6f 20 65 78  arent (has to ex
4a50: 69 73 74 29 0a 09 09 41 4e 44 20 20 20 20 50 2e  ist)...AND    P.
4a60: 63 68 69 6c 64 20 21 3d 20 52 2e 72 69 64 20 20  child != R.rid  
4a70: 20 20 20 20 2d 2d 20 57 68 69 63 68 20 64 6f 20      -- Which do 
4a80: 6e 6f 74 20 68 61 76 65 20 75 73 20 61 73 20 74  not have us as t
4a90: 68 65 69 72 20 63 68 69 6c 64 0a 09 09 3b 0a 09  heir child...;..
4aa0: 20 20 20 20 7d 0a 09 23 20 46 69 6e 64 20 61 6c      }..# Find al
4ab0: 6c 20 72 65 76 69 73 69 6f 6e 73 20 77 69 74 68  l revisions with
4ac0: 20 61 20 62 72 61 6e 63 68 20 70 61 72 65 6e 74   a branch parent
4ad0: 20 73 79 6d 62 6f 6c 20 77 68 69 63 68 20 64 6f   symbol which do
4ae0: 20 6e 6f 74 0a 09 23 20 68 61 76 65 20 61 20 70   not..# have a p
4af0: 61 72 65 6e 74 2e 0a 09 43 68 65 63 6b 20 5c 0a  arent...Check \.
4b00: 09 20 20 20 20 7b 42 72 61 6e 63 68 20 73 74 61  .    {Branch sta
4b10: 72 74 69 6e 67 20 72 65 76 69 73 69 6f 6e 73 20  rting revisions 
4b20: 68 61 76 65 20 74 6f 20 68 61 76 65 20 61 20 70  have to have a p
4b30: 61 72 65 6e 74 7d 20 5c 0a 09 20 20 20 20 7b 61  arent} \..    {a
4b40: 74 20 74 68 65 20 62 65 67 69 6e 6e 69 6e 67 20  t the beginning 
4b50: 6f 66 20 69 74 73 20 62 72 61 6e 63 68 20 68 61  of its branch ha
4b60: 73 20 6e 6f 20 70 61 72 65 6e 74 7d 20 7b 0a 09  s no parent} {..
4b70: 09 53 45 4c 45 43 54 20 46 2e 6e 61 6d 65 2c 20  .SELECT F.name, 
4b80: 52 2e 72 65 76 0a 09 09 46 52 4f 4d 20 20 20 72  R.rev...FROM   r
4b90: 65 76 69 73 69 6f 6e 20 52 2c 20 66 69 6c 65 20  evision R, file 
4ba0: 46 0a 09 09 57 48 45 52 45 20 20 52 2e 66 69 64  F...WHERE  R.fid
4bb0: 20 3d 20 46 2e 66 69 64 20 20 20 20 20 20 20 20   = F.fid        
4bc0: 20 20 2d 2d 20 47 65 74 20 66 69 6c 65 20 6f 66    -- Get file of
4bd0: 20 72 65 76 69 73 69 6f 6e 0a 09 09 41 4e 44 20   revision...AND 
4be0: 20 20 20 52 2e 62 70 61 72 65 6e 74 20 49 53 20     R.bparent IS 
4bf0: 4e 4f 54 20 4e 55 4c 4c 20 20 2d 2d 20 52 65 73  NOT NULL  -- Res
4c00: 74 72 69 63 74 20 74 6f 20 66 69 72 73 74 20 6f  trict to first o
4c10: 6e 20 61 20 62 72 61 6e 63 68 0a 09 09 41 4e 44  n a branch...AND
4c20: 20 20 20 20 52 2e 70 61 72 65 6e 74 20 49 53 20      R.parent IS 
4c30: 4e 55 4c 4c 20 20 20 20 20 20 20 2d 2d 20 42 75  NULL       -- Bu
4c40: 74 20 74 68 65 72 65 20 69 73 20 6e 6f 20 6f 75  t there is no ou
4c50: 74 2d 6f 66 2d 62 72 61 6e 63 68 20 70 61 72 65  t-of-branch pare
4c60: 6e 74 0a 09 09 3b 0a 09 20 20 20 20 7d 0a 09 23  nt...;..    }..#
4c70: 20 46 69 6e 64 20 61 6c 6c 20 72 65 76 69 73 69   Find all revisi
4c80: 6f 6e 73 20 77 69 74 68 20 61 20 62 72 61 6e 63  ons with a branc
4c90: 68 20 70 61 72 65 6e 74 20 73 79 6d 62 6f 6c 20  h parent symbol 
4ca0: 77 68 6f 73 65 20 70 61 72 65 6e 74 0a 09 23 20  whose parent..# 
4cb0: 68 61 73 20 74 68 65 6d 20 61 73 20 70 72 69 6d  has them as prim
4cc0: 61 72 79 20 63 68 69 6c 64 2e 0a 09 43 68 65 63  ary child...Chec
4cd0: 6b 20 5c 0a 09 20 20 20 20 7b 42 72 61 6e 63 68  k \..    {Branch
4ce0: 20 73 74 61 72 74 69 6e 67 20 72 65 76 69 73 69   starting revisi
4cf0: 6f 6e 73 20 6d 75 73 74 20 6e 6f 74 20 62 65 20  ons must not be 
4d00: 70 72 69 6d 61 72 79 20 63 68 69 6c 64 72 65 6e  primary children
4d10: 20 6f 66 20 74 68 65 69 72 20 70 61 72 65 6e 74   of their parent
4d20: 73 7d 20 5c 0a 09 20 20 20 20 7b 61 74 20 74 68  s} \..    {at th
4d30: 65 20 62 65 67 69 6e 6e 69 6e 67 20 6f 66 20 69  e beginning of i
4d40: 74 73 20 62 72 61 6e 63 68 20 69 73 20 74 68 65  ts branch is the
4d50: 20 70 72 69 6d 61 72 79 20 63 68 69 6c 64 20 6f   primary child o
4d60: 66 20 69 74 73 20 70 61 72 65 6e 74 7d 20 7b 0a  f its parent} {.
4d70: 09 09 53 45 4c 45 43 54 20 46 2e 6e 61 6d 65 2c  ..SELECT F.name,
4d80: 20 52 2e 72 65 76 0a 09 09 46 52 4f 4d 20 20 20   R.rev...FROM   
4d90: 72 65 76 69 73 69 6f 6e 20 52 2c 20 72 65 76 69  revision R, revi
4da0: 73 69 6f 6e 20 50 2c 20 66 69 6c 65 20 46 0a 09  sion P, file F..
4db0: 09 57 48 45 52 45 20 20 52 2e 66 69 64 20 3d 20  .WHERE  R.fid = 
4dc0: 46 2e 66 69 64 20 20 20 20 20 20 20 20 20 20 2d  F.fid          -
4dd0: 2d 20 47 65 74 20 66 69 6c 65 20 6f 66 20 72 65  - Get file of re
4de0: 76 69 73 69 6f 6e 0a 09 09 41 4e 44 20 20 20 20  vision...AND    
4df0: 52 2e 62 70 61 72 65 6e 74 20 49 53 20 4e 4f 54  R.bparent IS NOT
4e00: 20 4e 55 4c 4c 20 20 2d 2d 20 52 65 73 74 72 69   NULL  -- Restri
4e10: 63 74 20 74 6f 20 66 69 72 73 74 20 6f 6e 20 61  ct to first on a
4e20: 20 62 72 61 6e 63 68 0a 09 09 41 4e 44 20 20 20   branch...AND   
4e30: 20 52 2e 70 61 72 65 6e 74 20 49 53 20 4e 4f 54   R.parent IS NOT
4e40: 20 4e 55 4c 4c 20 20 20 2d 2d 20 57 68 69 63 68   NULL   -- Which
4e50: 20 61 72 65 20 6e 6f 74 20 64 65 74 61 63 68 65   are not detache
4e60: 64 0a 09 09 41 4e 44 20 20 20 20 52 2e 70 61 72  d...AND    R.par
4e70: 65 6e 74 20 3d 20 50 2e 72 69 64 20 20 20 20 20  ent = P.rid     
4e80: 20 20 2d 2d 20 47 65 74 20 74 68 65 69 72 20 6e    -- Get their n
4e90: 6f 6e 2d 62 72 61 6e 63 68 20 70 61 72 65 6e 74  on-branch parent
4ea0: 0a 09 09 41 4e 44 20 20 20 20 50 2e 63 68 69 6c  ...AND    P.chil
4eb0: 64 20 3d 20 52 2e 72 69 64 20 20 20 20 20 20 20  d = R.rid       
4ec0: 20 2d 2d 20 77 68 69 63 68 20 69 6d 70 72 6f 70   -- which improp
4ed0: 65 72 6c 79 20 68 61 73 20 74 68 65 6d 20 61 73  erly has them as
4ee0: 20 70 72 69 6d 61 72 79 20 63 68 69 6c 64 0a 09   primary child..
4ef0: 09 3b 0a 09 20 20 20 20 7d 0a 09 23 20 46 69 6e  .;..    }..# Fin
4f00: 64 20 61 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20  d all revisions 
4f10: 77 69 74 68 20 61 20 6e 6f 6e 2d 4e 54 44 42 20  with a non-NTDB 
4f20: 63 68 69 6c 64 20 77 68 69 63 68 20 61 72 65 20  child which are 
4f30: 6e 6f 74 20 6f 6e 0a 09 23 20 74 68 65 20 4e 54  not on..# the NT
4f40: 44 42 2e 0a 09 43 68 65 63 6b 20 5c 0a 09 20 20  DB...Check \..  
4f50: 20 20 7b 4e 54 44 42 20 74 6f 20 74 72 75 6e 6b    {NTDB to trunk
4f60: 20 74 72 61 6e 73 69 74 69 6f 6e 20 68 61 73 20   transition has 
4f70: 74 6f 20 62 65 67 69 6e 20 6f 6e 20 4e 54 44 42  to begin on NTDB
4f80: 7d 20 5c 0a 09 20 20 20 20 7b 68 61 73 20 61 20  } \..    {has a 
4f90: 6e 6f 6e 2d 4e 54 44 42 20 63 68 69 6c 64 2c 20  non-NTDB child, 
4fa0: 79 65 74 20 69 73 20 6e 6f 74 20 6f 6e 20 74 68  yet is not on th
4fb0: 65 20 4e 54 44 42 7d 20 7b 0a 09 09 53 45 4c 45  e NTDB} {...SELE
4fc0: 43 54 20 46 2e 6e 61 6d 65 2c 20 52 2e 72 65 76  CT F.name, R.rev
4fd0: 0a 09 09 46 52 4f 4d 20 20 20 72 65 76 69 73 69  ...FROM   revisi
4fe0: 6f 6e 20 52 2c 20 66 69 6c 65 20 46 0a 09 09 57  on R, file F...W
4ff0: 48 45 52 45 20 20 52 2e 66 69 64 20 3d 20 46 2e  HERE  R.fid = F.
5000: 66 69 64 20 20 20 20 20 20 20 20 20 20 2d 2d 20  fid          -- 
5010: 47 65 74 20 66 69 6c 65 20 6f 66 20 72 65 76 69  Get file of revi
5020: 73 69 6f 6e 0a 09 09 41 4e 44 20 20 20 20 52 2e  sion...AND    R.
5030: 64 62 63 68 69 6c 64 20 49 53 20 4e 4f 54 20 4e  dbchild IS NOT N
5040: 55 4c 4c 20 20 2d 2d 20 52 65 73 74 72 69 63 74  ULL  -- Restrict
5050: 20 74 6f 20 73 65 6d 69 2d 6c 61 73 74 20 4e 54   to semi-last NT
5060: 44 42 20 72 65 76 69 73 69 6f 6e 0a 09 09 41 4e  DB revision...AN
5070: 44 20 20 20 20 4e 4f 54 20 52 2e 69 73 64 65 66  D    NOT R.isdef
5080: 61 75 6c 74 20 20 20 20 20 20 20 20 2d 2d 20 49  ault        -- I
5090: 6d 70 72 6f 70 65 72 6c 79 20 63 6c 61 69 6d 69  mproperly claimi
50a0: 6e 67 20 74 6f 20 6e 6f 74 20 62 65 20 6f 6e 20  ng to not be on 
50b0: 4e 54 44 42 0a 09 09 3b 0a 09 20 20 20 20 7d 0a  NTDB...;..    }.
50c0: 09 23 20 46 69 6e 64 20 61 6c 6c 20 72 65 76 69  .# Find all revi
50d0: 73 69 6f 6e 73 20 77 69 74 68 20 61 20 4e 54 44  sions with a NTD
50e0: 42 20 70 61 72 65 6e 74 20 77 68 69 63 68 20 61  B parent which a
50f0: 72 65 20 6f 6e 20 74 68 65 20 4e 54 44 42 2e 0a  re on the NTDB..
5100: 09 43 68 65 63 6b 20 5c 0a 09 20 20 20 20 7b 4e  .Check \..    {N
5110: 54 44 42 20 74 6f 20 74 72 75 6e 6b 20 74 72 61  TDB to trunk tra
5120: 6e 73 69 74 69 6f 6e 20 68 61 73 20 74 6f 20 65  nsition has to e
5130: 6e 64 20 6f 6e 20 6e 6f 6e 2d 4e 54 44 42 7d 20  nd on non-NTDB} 
5140: 5c 0a 09 20 20 20 20 7b 68 61 73 20 61 20 4e 54  \..    {has a NT
5150: 44 42 20 70 61 72 65 6e 74 2c 20 79 65 74 20 69  DB parent, yet i
5160: 73 20 6f 6e 20 74 68 65 20 4e 54 44 42 7d 20 7b  s on the NTDB} {
5170: 0a 09 09 53 45 4c 45 43 54 20 46 2e 6e 61 6d 65  ...SELECT F.name
5180: 2c 20 52 2e 72 65 76 0a 09 09 46 52 4f 4d 20 20  , R.rev...FROM  
5190: 20 72 65 76 69 73 69 6f 6e 20 52 2c 20 66 69 6c   revision R, fil
51a0: 65 20 46 0a 09 09 57 48 45 52 45 20 20 52 2e 66  e F...WHERE  R.f
51b0: 69 64 20 3d 20 46 2e 66 69 64 20 20 20 20 20 20  id = F.fid      
51c0: 20 20 20 20 20 2d 2d 20 47 65 74 20 66 69 6c 65       -- Get file
51d0: 20 6f 66 20 72 65 76 69 73 69 6f 6e 0a 09 09 41   of revision...A
51e0: 4e 44 20 20 20 20 52 2e 64 62 70 61 72 65 6e 74  ND    R.dbparent
51f0: 20 49 53 20 4e 4f 54 20 4e 55 4c 4c 20 20 2d 2d   IS NOT NULL  --
5200: 20 52 65 73 74 72 69 63 74 20 74 6f 20 74 72 75   Restrict to tru
5210: 6e 6b 20 72 6f 6f 74 73 20 77 69 74 68 20 4e 54  nk roots with NT
5220: 44 42 20 61 72 6f 75 6e 64 0a 09 09 41 4e 44 20  DB around...AND 
5230: 20 20 20 52 2e 69 73 64 65 66 61 75 6c 74 20 20     R.isdefault  
5240: 20 20 20 20 20 20 20 20 20 20 20 2d 2d 20 42 75             -- Bu
5250: 74 20 72 6f 6f 74 20 69 6d 70 72 6f 70 65 72 6c  t root improperl
5260: 79 20 63 6c 61 69 6d 73 20 74 6f 20 62 65 20 6f  y claims to be o
5270: 6e 20 4e 54 44 42 0a 09 09 3b 0a 09 20 20 20 20  n NTDB...;..    
5280: 7d 0a 09 23 20 46 69 6e 64 20 61 6c 6c 20 72 65  }..# Find all re
5290: 76 69 73 69 6f 6e 73 20 77 69 74 68 20 61 20 63  visions with a c
52a0: 68 69 6c 64 20 77 68 69 63 68 20 64 69 73 61 67  hild which disag
52b0: 72 65 65 73 20 61 62 6f 75 74 20 74 68 65 0a 09  rees about the..
52c0: 23 20 6c 69 6e 65 20 6f 66 20 64 65 76 65 6c 6f  # line of develo
52d0: 70 6d 65 6e 74 20 74 68 65 79 20 62 65 6c 6f 6e  pment they belon
52e0: 67 20 74 6f 2e 0a 09 43 68 65 63 6b 20 5c 0a 09  g to...Check \..
52f0: 20 20 20 20 7b 52 65 76 69 73 69 6f 6e 73 20 61      {Revisions a
5300: 6e 64 20 74 68 65 69 72 20 70 72 69 6d 61 72 79  nd their primary
5310: 20 63 68 69 6c 64 72 65 6e 20 68 61 76 65 20 74   children have t
5320: 6f 20 62 65 20 69 6e 20 74 68 65 20 73 61 6d 65  o be in the same
5330: 20 4c 4f 44 7d 20 5c 0a 09 20 20 20 20 7b 61 6e   LOD} \..    {an
5340: 64 20 69 74 73 20 70 72 69 6d 61 72 79 20 63 68  d its primary ch
5350: 69 6c 64 20 64 69 73 61 67 72 65 65 20 61 62 6f  ild disagree abo
5360: 75 74 20 74 68 65 69 72 20 4c 4f 44 7d 20 7b 0a  ut their LOD} {.
5370: 09 09 53 45 4c 45 43 54 20 46 2e 6e 61 6d 65 2c  ..SELECT F.name,
5380: 20 52 2e 72 65 76 0a 09 09 46 52 4f 4d 20 20 20   R.rev...FROM   
5390: 72 65 76 69 73 69 6f 6e 20 52 2c 20 72 65 76 69  revision R, revi
53a0: 73 69 6f 6e 20 43 2c 20 66 69 6c 65 20 46 0a 09  sion C, file F..
53b0: 09 57 48 45 52 45 20 20 52 2e 66 69 64 20 3d 20  .WHERE  R.fid = 
53c0: 46 2e 66 69 64 20 20 20 20 20 20 20 20 2d 2d 20  F.fid        -- 
53d0: 47 65 74 20 66 69 6c 65 20 6f 66 20 72 65 76 69  Get file of revi
53e0: 73 69 6f 6e 0a 09 09 41 4e 44 20 20 20 20 52 2e  sion...AND    R.
53f0: 63 68 69 6c 64 20 49 53 20 4e 4f 54 20 4e 55 4c  child IS NOT NUL
5400: 4c 20 20 2d 2d 20 52 65 73 74 72 69 63 74 20 74  L  -- Restrict t
5410: 6f 20 6e 6f 6e 2d 6c 65 61 76 65 73 0a 09 09 41  o non-leaves...A
5420: 4e 44 20 20 20 20 52 2e 63 68 69 6c 64 20 3d 20  ND    R.child = 
5430: 43 2e 72 69 64 20 20 20 20 20 20 2d 2d 20 47 65  C.rid      -- Ge
5440: 74 20 63 68 69 6c 64 20 28 68 61 73 20 74 6f 20  t child (has to 
5450: 65 78 69 73 74 29 0a 09 09 41 4e 44 20 20 20 20  exist)...AND    
5460: 43 2e 6c 6f 64 20 21 3d 20 52 2e 6c 6f 64 20 20  C.lod != R.lod  
5470: 20 20 20 20 20 2d 2d 20 77 68 69 63 68 20 69 6d       -- which im
5480: 70 72 6f 70 65 72 6c 79 20 75 73 65 73 20 61 20  properly uses a 
5490: 64 69 66 66 65 72 65 6e 74 20 4c 4f 44 0a 09 09  different LOD...
54a0: 3b 0a 09 20 20 20 20 7d 0a 09 23 20 46 69 6e 64  ;..    }..# Find
54b0: 20 61 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 77   all revisions w
54c0: 69 74 68 20 61 20 6e 6f 6e 2d 4e 54 44 42 20 63  ith a non-NTDB c
54d0: 68 69 6c 64 20 77 68 69 63 68 20 61 67 72 65 65  hild which agree
54e0: 73 20 61 62 6f 75 74 0a 09 23 20 74 68 65 20 6c  s about..# the l
54f0: 69 6e 65 20 6f 66 20 64 65 76 65 6c 6f 70 6d 65  ine of developme
5500: 6e 74 20 74 68 65 79 20 62 65 6c 6f 6e 67 20 74  nt they belong t
5510: 6f 2e 0a 09 43 68 65 63 6b 20 5c 0a 09 20 20 20  o...Check \..   
5520: 20 7b 4e 54 44 42 20 61 6e 64 20 74 72 75 6e 6b   {NTDB and trunk
5530: 20 72 65 76 69 73 69 6f 6e 73 20 68 61 76 65 20   revisions have 
5540: 74 6f 20 62 65 20 69 6e 20 64 69 66 66 65 72 65  to be in differe
5550: 6e 74 20 4c 4f 44 73 7d 20 5c 0a 09 20 20 20 20  nt LODs} \..    
5560: 7b 6f 6e 20 4e 54 44 42 20 61 6e 64 20 69 74 73  {on NTDB and its
5570: 20 6e 6f 6e 2d 4e 54 44 42 20 63 68 69 6c 64 20   non-NTDB child 
5580: 77 72 6f 6e 67 6c 79 20 61 67 72 65 65 20 61 62  wrongly agree ab
5590: 6f 75 74 20 74 68 65 69 72 20 4c 4f 44 7d 20 7b  out their LOD} {
55a0: 0a 09 09 53 45 4c 45 43 54 20 46 2e 6e 61 6d 65  ...SELECT F.name
55b0: 2c 20 52 2e 72 65 76 0a 09 09 46 52 4f 4d 20 20  , R.rev...FROM  
55c0: 20 72 65 76 69 73 69 6f 6e 20 52 2c 20 72 65 76   revision R, rev
55d0: 69 73 69 6f 6e 20 43 2c 20 66 69 6c 65 20 46 0a  ision C, file F.
55e0: 09 09 57 48 45 52 45 20 20 52 2e 66 69 64 20 3d  ..WHERE  R.fid =
55f0: 20 46 2e 66 69 64 20 20 20 20 20 20 20 20 20 20   F.fid          
5600: 2d 2d 20 47 65 74 20 66 69 6c 65 20 6f 66 20 72  -- Get file of r
5610: 65 76 69 73 69 6f 6e 0a 09 09 41 4e 44 20 20 20  evision...AND   
5620: 20 52 2e 64 62 63 68 69 6c 64 20 49 53 20 4e 4f   R.dbchild IS NO
5630: 54 20 4e 55 4c 4c 20 20 2d 2d 20 52 65 73 74 72  T NULL  -- Restr
5640: 69 63 74 20 74 6f 20 73 65 6d 69 2d 6c 61 73 74  ict to semi-last
5650: 20 4e 54 44 42 20 72 65 76 69 73 69 6f 6e 0a 09   NTDB revision..
5660: 09 41 4e 44 20 20 20 20 52 2e 64 62 63 68 69 6c  .AND    R.dbchil
5670: 64 20 3d 20 43 2e 72 69 64 20 20 20 20 20 20 2d  d = C.rid      -
5680: 2d 20 47 65 74 20 61 73 73 6f 63 69 61 74 65 64  - Get associated
5690: 20 74 72 75 6e 6b 20 72 6f 6f 74 20 72 65 76 69   trunk root revi
56a0: 73 69 6f 6e 0a 09 09 41 4e 44 20 20 20 20 43 2e  sion...AND    C.
56b0: 6c 6f 64 20 3d 20 52 2e 6c 6f 64 20 20 20 20 20  lod = R.lod     
56c0: 20 20 20 20 20 2d 2d 20 49 6d 70 72 6f 70 65 72       -- Improper
56d0: 6c 79 20 75 73 65 73 20 74 68 65 20 73 61 6d 65  ly uses the same
56e0: 20 4c 4f 44 0a 09 09 3b 0a 09 20 20 20 20 7d 0a   LOD...;..    }.
56f0: 09 23 20 46 69 6e 64 20 61 6c 6c 20 72 65 76 69  .# Find all revi
5700: 73 69 6f 6e 73 20 77 69 74 68 20 61 20 62 72 61  sions with a bra
5710: 6e 63 68 20 70 61 72 65 6e 74 20 73 79 6d 62 6f  nch parent symbo
5720: 6c 20 77 68 69 63 68 20 69 73 20 6e 6f 74 0a 09  l which is not..
5730: 23 20 74 68 65 69 72 20 4c 4f 44 2e 0a 09 43 68  # their LOD...Ch
5740: 65 63 6b 20 5c 0a 09 20 20 20 20 7b 42 72 61 6e  eck \..    {Bran
5750: 63 68 20 73 74 61 72 74 69 6e 67 20 72 65 76 69  ch starting revi
5760: 73 69 6f 6e 73 20 68 61 76 65 20 74 6f 20 68 61  sions have to ha
5770: 76 65 20 74 68 65 69 72 20 4c 4f 44 20 61 73 20  ve their LOD as 
5780: 62 72 61 6e 63 68 20 70 61 72 65 6e 74 20 73 79  branch parent sy
5790: 6d 62 6f 6c 7d 20 5c 0a 09 20 20 20 20 7b 61 74  mbol} \..    {at
57a0: 20 74 68 65 20 62 65 67 69 6e 6e 69 6e 67 20 6f   the beginning o
57b0: 66 20 69 74 73 20 62 72 61 6e 63 68 20 64 6f 65  f its branch doe
57c0: 73 20 6e 6f 74 20 68 61 76 65 20 74 68 65 20 62  s not have the b
57d0: 72 61 6e 63 68 20 73 79 6d 62 6f 6c 20 61 73 20  ranch symbol as 
57e0: 69 74 73 20 4c 4f 44 7d 20 7b 0a 09 09 53 45 4c  its LOD} {...SEL
57f0: 45 43 54 20 46 2e 6e 61 6d 65 2c 20 52 2e 72 65  ECT F.name, R.re
5800: 76 0a 09 09 46 52 4f 4d 20 20 20 72 65 76 69 73  v...FROM   revis
5810: 69 6f 6e 20 52 2c 20 66 69 6c 65 20 46 0a 09 09  ion R, file F...
5820: 57 48 45 52 45 20 20 52 2e 66 69 64 20 3d 20 46  WHERE  R.fid = F
5830: 2e 66 69 64 20 20 20 20 20 20 20 20 20 20 2d 2d  .fid          --
5840: 20 47 65 74 20 66 69 6c 65 20 6f 66 20 72 65 76   Get file of rev
5850: 69 73 69 6f 6e 0a 09 09 41 4e 44 20 20 20 20 52  ision...AND    R
5860: 2e 62 70 61 72 65 6e 74 20 49 53 20 4e 4f 54 20  .bparent IS NOT 
5870: 4e 55 4c 4c 20 20 2d 2d 20 52 65 73 74 72 69 63  NULL  -- Restric
5880: 74 20 74 6f 20 72 65 76 69 73 69 6f 6e 73 20 66  t to revisions f
5890: 69 72 73 74 20 6f 6e 20 61 20 62 72 61 6e 63 68  irst on a branch
58a0: 0a 09 09 41 4e 44 20 20 20 20 52 2e 6c 6f 64 20  ...AND    R.lod 
58b0: 21 3d 20 52 2e 62 70 61 72 65 6e 74 20 20 20 20  != R.bparent    
58c0: 20 2d 2d 20 61 6e 64 20 74 68 65 69 72 20 62 72   -- and their br
58d0: 61 6e 63 68 20 69 73 20 6e 6f 74 20 74 68 65 69  anch is not thei
58e0: 72 20 4c 4f 44 0a 09 09 3b 0a 09 20 20 20 20 7d  r LOD...;..    }
58f0: 0a 09 23 20 46 69 6e 64 20 61 6c 6c 20 72 65 76  ..# Find all rev
5900: 69 73 69 6f 6e 73 20 77 69 74 68 20 61 20 62 72  isions with a br
5910: 61 6e 63 68 20 70 61 72 65 6e 74 20 73 79 6d 62  anch parent symb
5920: 6f 6c 20 77 68 6f 73 65 20 70 61 72 65 6e 74 0a  ol whose parent.
5930: 09 23 20 69 73 20 69 6e 20 74 68 65 20 73 61 6d  .# is in the sam
5940: 65 20 6c 69 6e 65 20 6f 66 20 64 65 76 65 6c 6f  e line of develo
5950: 70 6d 65 6e 74 2e 0a 09 43 68 65 63 6b 20 5c 0a  pment...Check \.
5960: 09 20 20 20 20 7b 52 65 76 69 73 69 6f 6e 73 20  .    {Revisions 
5970: 61 6e 64 20 74 68 65 69 72 20 62 72 61 6e 63 68  and their branch
5980: 20 63 68 69 6c 64 72 65 6e 20 68 61 76 65 20 74   children have t
5990: 6f 20 62 65 20 69 6e 20 64 69 66 66 65 72 65 6e  o be in differen
59a0: 74 20 4c 4f 44 73 7d 20 5c 0a 09 20 20 20 20 7b  t LODs} \..    {
59b0: 61 74 20 74 68 65 20 62 65 67 69 6e 6e 69 6e 67  at the beginning
59c0: 20 6f 66 20 69 74 73 20 62 72 61 6e 63 68 20 61   of its branch a
59d0: 6e 64 20 69 74 73 20 70 61 72 65 6e 74 20 77 72  nd its parent wr
59e0: 6f 6e 67 6c 79 20 61 67 72 65 65 20 61 62 6f 75  ongly agree abou
59f0: 74 20 74 68 65 69 72 20 4c 4f 44 7d 20 7b 0a 09  t their LOD} {..
5a00: 09 53 45 4c 45 43 54 20 46 2e 6e 61 6d 65 2c 20  .SELECT F.name, 
5a10: 52 2e 72 65 76 0a 09 09 46 52 4f 4d 20 20 20 72  R.rev...FROM   r
5a20: 65 76 69 73 69 6f 6e 20 52 2c 20 72 65 76 69 73  evision R, revis
5a30: 69 6f 6e 20 50 2c 20 66 69 6c 65 20 46 0a 09 09  ion P, file F...
5a40: 57 48 45 52 45 20 20 52 2e 66 69 64 20 3d 20 46  WHERE  R.fid = F
5a50: 2e 66 69 64 20 20 20 20 20 20 20 20 20 20 2d 2d  .fid          --
5a60: 20 47 65 74 20 66 69 6c 65 20 6f 66 20 72 65 76   Get file of rev
5a70: 69 73 69 6f 6e 0a 09 09 41 4e 44 20 20 20 20 52  ision...AND    R
5a80: 2e 62 70 61 72 65 6e 74 20 49 53 20 4e 4f 54 20  .bparent IS NOT 
5a90: 4e 55 4c 4c 20 20 2d 2d 20 52 65 73 74 72 69 63  NULL  -- Restric
5aa0: 74 20 74 6f 20 72 65 76 69 73 69 6f 6e 73 20 66  t to revisions f
5ab0: 69 72 73 74 20 6f 6e 20 61 20 62 72 61 6e 63 68  irst on a branch
5ac0: 0a 09 09 41 4e 44 20 20 20 20 52 2e 70 61 72 65  ...AND    R.pare
5ad0: 6e 74 20 3d 20 50 2e 72 69 64 20 20 20 20 20 20  nt = P.rid      
5ae0: 20 2d 2d 20 47 65 74 20 74 68 65 69 72 20 6e 6f   -- Get their no
5af0: 6e 2d 62 72 61 6e 63 68 20 70 61 72 65 6e 74 0a  n-branch parent.
5b00: 09 09 41 4e 44 20 20 20 20 52 2e 6c 6f 64 20 3d  ..AND    R.lod =
5b10: 20 50 2e 6c 6f 64 20 20 20 20 20 20 20 20 20 20   P.lod          
5b20: 2d 2d 20 57 68 69 63 68 20 69 6d 70 72 6f 70 65  -- Which imprope
5b30: 72 6c 79 20 75 73 65 73 20 74 68 65 20 73 61 6d  rly uses the sam
5b40: 65 20 4c 4f 44 0a 09 09 3b 0a 09 20 20 20 20 7d  e LOD...;..    }
5b50: 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a  ..return.    }..
5b60: 20 20 20 20 70 72 6f 63 20 43 68 65 63 6b 20 7b      proc Check {
5b70: 68 65 61 64 65 72 20 6c 61 62 65 6c 20 73 71 6c  header label sql
5b80: 7d 20 7b 0a 09 75 70 76 61 72 20 31 20 6e 20 6e  } {..upvar 1 n n
5b90: 0a 09 73 65 74 20 6f 6b 20 31 0a 09 66 6f 72 65  ..set ok 1..fore
5ba0: 61 63 68 20 7b 66 6e 61 6d 65 20 72 65 76 6e 72  ach {fname revnr
5bb0: 7d 20 5b 73 74 61 74 65 20 72 75 6e 20 24 73 71  } [state run $sq
5bc0: 6c 5d 20 7b 0a 09 20 20 20 20 73 65 74 20 6f 6b  l] {..    set ok
5bd0: 20 30 0a 09 20 20 20 20 74 72 6f 75 62 6c 65 20   0..    trouble 
5be0: 66 61 74 61 6c 20 22 24 66 6e 61 6d 65 20 3c 24  fatal "$fname <$
5bf0: 72 65 76 6e 72 3e 20 24 6c 61 62 65 6c 22 0a 09  revnr> $label"..
5c00: 7d 0a 09 6c 6f 67 20 77 72 69 74 65 20 35 20 63  }..log write 5 c
5c10: 6f 6c 6c 72 65 76 20 22 5c 5b 5b 66 6f 72 6d 61  ollrev "\[[forma
5c20: 74 20 25 30 32 64 20 5b 69 6e 63 72 20 6e 5d 5d  t %02d [incr n]]
5c30: 5c 5d 20 5b 65 78 70 72 20 7b 24 6f 6b 20 3f 20  \] [expr {$ok ? 
5c40: 22 4f 6b 20 20 20 20 22 20 3a 20 22 46 61 69 6c  "Ok    " : "Fail
5c50: 65 64 22 7d 5d 20 2e 2e 2e 20 24 68 65 61 64 65  ed"}] ... $heade
5c60: 72 22 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 7d  r"..return.    }
5c70: 0a 0a 20 20 20 20 23 20 23 20 23 23 20 23 23 23  ..    # # ## ###
5c80: 20 23 23 23 23 23 20 23 23 23 23 23 23 23 23 20   ##### ######## 
5c90: 23 23 23 23 23 23 23 23 23 23 23 23 23 0a 20 20  #############.  
5ca0: 20 20 23 23 20 49 6e 74 65 72 6e 61 6c 20 6d 65    ## Internal me
5cb0: 74 68 6f 64 73 0a 0a 20 20 20 20 23 20 23 20 23  thods..    # # #
5cc0: 23 20 23 23 23 20 23 23 23 23 23 20 23 23 23 23  # ### ##### ####
5cd0: 23 23 23 23 20 23 23 23 23 23 23 23 23 23 23 23  #### ###########
5ce0: 23 23 0a 20 20 20 20 23 23 20 43 6f 6e 66 69 67  ##.    ## Config
5cf0: 75 72 61 74 69 6f 6e 0a 0a 20 20 20 20 70 72 61  uration..    pra
5d00: 67 6d 61 20 2d 68 61 73 69 6e 73 74 61 6e 63 65  gma -hasinstance
5d10: 73 20 20 20 6e 6f 20 3b 20 23 20 73 69 6e 67 6c  s   no ; # singl
5d20: 65 74 6f 6e 0a 20 20 20 20 70 72 61 67 6d 61 20  eton.    pragma 
5d30: 2d 68 61 73 74 79 70 65 69 6e 66 6f 20 20 20 20  -hastypeinfo    
5d40: 6e 6f 20 3b 20 23 20 6e 6f 20 69 6e 74 72 6f 73  no ; # no intros
5d50: 70 65 63 74 69 6f 6e 0a 20 20 20 20 70 72 61 67  pection.    prag
5d60: 6d 61 20 2d 68 61 73 74 79 70 65 64 65 73 74 72  ma -hastypedestr
5d70: 6f 79 20 6e 6f 20 3b 20 23 20 69 6d 6d 6f 72 74  oy no ; # immort
5d80: 61 6c 0a 0a 20 20 20 20 23 20 23 20 23 23 20 23  al..    # # ## #
5d90: 23 23 20 23 23 23 23 23 20 23 23 23 23 23 23 23  ## ##### #######
5da0: 23 20 23 23 23 23 23 23 23 23 23 23 23 23 23 0a  # #############.
5db0: 7d 0a 0a 6e 61 6d 65 73 70 61 63 65 20 65 76 61  }..namespace eva
5dc0: 6c 20 3a 3a 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a  l ::vc::fossil::
5dd0: 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 70 61 73  import::cvs::pas
5de0: 73 20 7b 0a 20 20 20 20 6e 61 6d 65 73 70 61 63  s {.    namespac
5df0: 65 20 65 78 70 6f 72 74 20 63 6f 6c 6c 72 65 76  e export collrev
5e00: 0a 20 20 20 20 6e 61 6d 65 73 70 61 63 65 20 65  .    namespace e
5e10: 76 61 6c 20 63 6f 6c 6c 72 65 76 20 7b 0a 09 6e  val collrev {..n
5e20: 61 6d 65 73 70 61 63 65 20 69 6d 70 6f 72 74 20  amespace import 
5e30: 3a 3a 76 63 3a 3a 72 63 73 3a 3a 70 61 72 73 65  ::vc::rcs::parse
5e40: 72 0a 09 6e 61 6d 65 73 70 61 63 65 20 69 6d 70  r..namespace imp
5e50: 6f 72 74 20 3a 3a 76 63 3a 3a 66 6f 73 73 69 6c  ort ::vc::fossil
5e60: 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 72  ::import::cvs::r
5e70: 65 70 6f 73 69 74 6f 72 79 0a 09 6e 61 6d 65 73  epository..names
5e80: 70 61 63 65 20 69 6d 70 6f 72 74 20 3a 3a 76 63  pace import ::vc
5e90: 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 74  ::fossil::import
5ea0: 3a 3a 63 76 73 3a 3a 73 74 61 74 65 0a 09 6e 61  ::cvs::state..na
5eb0: 6d 65 73 70 61 63 65 20 69 6d 70 6f 72 74 20 3a  mespace import :
5ec0: 3a 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70  :vc::fossil::imp
5ed0: 6f 72 74 3a 3a 63 76 73 3a 3a 69 6e 74 65 67 72  ort::cvs::integr
5ee0: 69 74 79 0a 09 6e 61 6d 65 73 70 61 63 65 20 65  ity..namespace e
5ef0: 76 61 6c 20 70 72 6f 6a 65 63 74 20 7b 0a 09 20  val project {.. 
5f00: 20 20 20 6e 61 6d 65 73 70 61 63 65 20 69 6d 70     namespace imp
5f10: 6f 72 74 20 3a 3a 76 63 3a 3a 66 6f 73 73 69 6c  ort ::vc::fossil
5f20: 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 70  ::import::cvs::p
5f30: 72 6f 6a 65 63 74 3a 3a 73 79 6d 0a 09 7d 0a 09  roject::sym..}..
5f40: 6e 61 6d 65 73 70 61 63 65 20 65 76 61 6c 20 66  namespace eval f
5f50: 69 6c 65 20 7b 0a 09 20 20 20 20 6e 61 6d 65 73  ile {..    names
5f60: 70 61 63 65 20 69 6d 70 6f 72 74 20 3a 3a 76 63  pace import ::vc
5f70: 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 74  ::fossil::import
5f80: 3a 3a 63 76 73 3a 3a 66 69 6c 65 3a 3a 72 65 76  ::cvs::file::rev
5f90: 0a 09 7d 0a 09 6e 61 6d 65 73 70 61 63 65 20 69  ..}..namespace i
5fa0: 6d 70 6f 72 74 20 3a 3a 76 63 3a 3a 74 6f 6f 6c  mport ::vc::tool
5fb0: 73 3a 3a 74 72 6f 75 62 6c 65 0a 09 6e 61 6d 65  s::trouble..name
5fc0: 73 70 61 63 65 20 69 6d 70 6f 72 74 20 3a 3a 76  space import ::v
5fd0: 63 3a 3a 74 6f 6f 6c 73 3a 3a 6c 6f 67 0a 09 6c  c::tools::log..l
5fe0: 6f 67 20 72 65 67 69 73 74 65 72 20 63 6f 6c 6c  og register coll
5ff0: 72 65 76 0a 20 20 20 20 7d 0a 7d 0a 0a 23 20 23  rev.    }.}..# #
6000: 20 23 23 20 23 23 23 20 23 23 23 23 23 20 23 23   ## ### ##### ##
6010: 23 23 23 23 23 23 20 23 23 23 23 23 23 23 23 23  ###### #########
6020: 23 23 23 23 20 23 23 23 23 23 23 23 23 23 23 23  #### ###########
6030: 23 23 23 23 23 23 23 23 23 23 0a 23 23 20 52 65  ##########.## Re
6040: 61 64 79 0a 0a 70 61 63 6b 61 67 65 20 70 72 6f  ady..package pro
6050: 76 69 64 65 20 76 63 3a 3a 66 6f 73 73 69 6c 3a  vide vc::fossil:
6060: 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 70 61  :import::cvs::pa
6070: 73 73 3a 3a 63 6f 6c 6c 72 65 76 20 31 2e 30 0a  ss::collrev 1.0.
6080: 72 65 74 75 72 6e 0a                             return.