Hex Artifact Content
Not logged in

Artifact ea94dc166cfb94b6428a406a77c5b4c07b08824a:

File tools/cvs2fossil/lib/c2f_pcollrev.tcl part of check-in [b679ca3356] - Code cleanup. Removed trailing whitespace across the board. by aku on 2007-11-25 07:54:09.

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 72 65 61 64 69 6e 67 20 70 72  state reading pr
0840: 6f 6a 65 63 74 0a 09 73 74 61 74 65 20 72 65 61  oject..state rea
0850: 64 69 6e 67 20 66 69 6c 65 0a 0a 09 23 20 57 65  ding file...# We
0860: 20 64 65 61 6c 20 77 69 74 68 20 70 65 72 20 70   deal with per p
0870: 72 6f 6a 65 63 74 20 61 6e 64 20 70 65 72 20 66  roject and per f
0880: 69 6c 65 20 64 61 74 61 2c 20 74 68 65 20 66 69  ile data, the fi
0890: 72 73 74 0a 09 23 20 63 6f 6c 6c 61 74 65 64 20  rst..# collated 
08a0: 66 72 6f 6d 20 74 68 65 20 73 65 63 6f 6e 64 2e  from the second.
08b0: 0a 0a 09 23 20 50 65 72 20 66 69 6c 65 20 77 65  ...# Per file we
08c0: 20 68 61 76 65 20 67 65 6e 65 72 61 6c 20 69 6e   have general in
08d0: 66 6f 72 6d 61 74 69 6f 6e 2c 20 2e 2e 2e 2c 20  formation, ..., 
08e0: 61 6e 64 20 74 68 65 6e 0a 09 23 20 72 65 76 69  and then..# revi
08f0: 73 69 6f 6e 73 20 61 6e 64 20 73 79 6d 62 6f 6c  sions and symbol
0900: 73 2e 20 54 68 65 20 6c 61 74 74 65 72 20 63 61  s. The latter ca
0910: 6e 20 62 65 20 66 75 72 74 68 65 72 20 73 65 70  n be further sep
0920: 61 72 61 74 65 64 0a 09 23 20 69 6e 74 6f 20 74  arated..# into t
0930: 61 67 73 20 61 6e 64 20 62 72 61 6e 63 68 65 73  ags and branches
0940: 2e 20 41 74 20 70 72 6f 6a 65 63 74 20 6c 65 76  . At project lev
0950: 65 6c 20 74 68 65 20 70 65 72 2d 66 69 6c 65 0a  el the per-file.
0960: 09 23 20 73 79 6d 62 6f 6c 73 20 69 6e 66 6f 72  .# symbols infor
0970: 6d 61 74 69 6f 6e 20 69 73 20 6d 65 72 67 65 64  mation is merged
0980: 2e 0a 0a 09 23 20 46 69 6c 65 20 6c 65 76 65 6c  ....# File level
0990: 20 2e 2e 2e 0a 09 23 09 52 65 76 69 73 69 6f 6e   .....#.Revision
09a0: 73 2c 20 42 72 61 6e 63 68 65 73 2c 20 54 61 67  s, Branches, Tag
09b0: 73 0a 09 23 0a 09 23 20 50 73 65 75 64 6f 20 63  s..#..# Pseudo c
09c0: 6c 61 73 73 20 68 69 65 72 61 72 63 68 79 0a 09  lass hierarchy..
09d0: 23 09 54 61 67 20 20 20 20 20 20 3c 2d 20 53 79  #.Tag      <- Sy
09e0: 6d 62 6f 6c 20 3c 2d 20 45 76 65 6e 74 0a 09 23  mbol <- Event..#
09f0: 09 42 72 61 6e 63 68 20 20 20 3c 2d 20 53 79 6d  .Branch   <- Sym
0a00: 62 6f 6c 20 3c 2d 20 45 76 65 6e 74 0a 09 23 09  bol <- Event..#.
0a10: 52 65 76 69 73 69 6f 6e 20 20 20 20 20 20 20 20  Revision        
0a20: 20 20 20 3c 2d 20 45 76 65 6e 74 0a 0a 09 73 74     <- Event...st
0a30: 61 74 65 20 77 72 69 74 69 6e 67 20 72 65 76 69  ate writing revi
0a40: 73 69 6f 6e 20 7b 0a 09 20 20 20 20 2d 2d 20 52  sion {..    -- R
0a50: 65 76 69 73 69 6f 6e 73 2e 20 49 64 65 6e 74 69  evisions. Identi
0a60: 66 69 65 64 20 62 79 20 61 20 67 6c 6f 62 61 6c  fied by a global
0a70: 20 6e 75 6d 65 72 69 63 20 69 64 20 65 61 63 68   numeric id each
0a80: 0a 09 20 20 20 20 2d 2d 20 62 65 6c 6f 6e 67 73  ..    -- belongs
0a90: 20 74 6f 20 61 20 73 69 6e 67 6c 65 20 66 69 6c   to a single fil
0aa0: 65 2c 20 69 64 65 6e 74 69 66 69 65 64 20 62 79  e, identified by
0ab0: 20 69 74 73 20 69 64 2e 20 49 74 0a 09 20 20 20   its id. It..   
0ac0: 20 2d 2d 20 66 75 72 74 68 65 72 20 68 61 73 20   -- further has 
0ad0: 61 20 64 6f 74 74 65 64 20 72 65 76 69 73 69 6f  a dotted revisio
0ae0: 6e 20 6e 75 6d 62 65 72 20 28 44 54 4e 29 2e 0a  n number (DTN)..
0af0: 09 20 20 20 20 2d 2d 0a 09 20 20 20 20 2d 2d 20  .    --..    -- 
0b00: 43 6f 6e 73 74 72 61 69 6e 74 3a 20 54 68 65 20  Constraint: The 
0b10: 64 6f 74 74 65 64 20 72 65 76 69 73 69 6f 6e 20  dotted revision 
0b20: 6e 75 6d 62 65 72 20 69 73 20 75 6e 69 71 75 65  number is unique
0b30: 20 77 69 74 68 69 6e 0a 20 20 20 20 20 20 20 20   within.        
0b40: 20 20 20 20 2d 2d 20 20 20 20 20 20 20 20 20 20      --          
0b50: 20 20 20 74 68 65 20 66 69 6c 65 2e 20 53 65 65     the file. See
0b60: 20 65 6e 64 20 6f 66 20 64 65 66 69 6e 69 74 69   end of definiti
0b70: 6f 6e 2e 0a 0a 09 20 20 20 20 72 69 64 20 20 49  on....    rid  I
0b80: 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c  NTEGER  NOT NULL
0b90: 20 20 50 52 49 4d 41 52 59 20 4b 45 59 20 41 55    PRIMARY KEY AU
0ba0: 54 4f 49 4e 43 52 45 4d 45 4e 54 2c 0a 09 20 20  TOINCREMENT,..  
0bb0: 20 20 66 69 64 20 20 49 4e 54 45 47 45 52 20 20    fid  INTEGER  
0bc0: 4e 4f 54 20 4e 55 4c 4c 20 20 52 45 46 45 52 45  NOT NULL  REFERE
0bd0: 4e 43 45 53 20 66 69 6c 65 2c 20 20 20 2d 2d 20  NCES file,   -- 
0be0: 46 69 6c 65 20 6f 77 6e 69 6e 67 20 72 65 76 69  File owning revi
0bf0: 73 69 6f 6e 2e 0a 09 20 20 20 20 72 65 76 20 20  sion...    rev  
0c00: 54 45 58 54 20 20 20 20 20 4e 4f 54 20 4e 55 4c  TEXT     NOT NUL
0c10: 4c 2c 20 20 20 20 20 20 20 20 20 20 20 20 20 20  L,              
0c20: 20 20 20 20 20 20 2d 2d 20 44 6f 74 74 65 64 20        -- Dotted 
0c30: 52 65 76 20 4e 75 6d 62 65 72 2e 0a 0a 09 20 20  Rev Number....  
0c40: 20 20 2d 2d 20 41 6c 6c 20 72 65 76 69 73 69 6f    -- All revisio
0c50: 6e 73 20 62 65 6c 6f 6e 67 20 74 6f 20 61 20 6c  ns belong to a l
0c60: 69 6e 65 2d 6f 66 2d 64 65 76 65 6c 6f 70 6d 65  ine-of-developme
0c70: 6e 74 2c 0a 09 20 20 20 20 2d 2d 20 69 64 65 6e  nt,..    -- iden
0c80: 74 69 66 69 65 64 20 62 79 20 61 20 73 79 6d 62  tified by a symb
0c90: 6f 6c 20 28 70 72 6f 6a 65 63 74 20 6c 65 76 65  ol (project leve
0ca0: 6c 29 2e 20 44 75 72 69 6e 67 20 64 61 74 61 0a  l). During data.
0cb0: 09 20 20 20 20 2d 2d 20 63 6f 6c 6c 65 63 74 69  .    -- collecti
0cc0: 6f 6e 20 69 74 20 77 61 73 20 61 20 66 69 6c 65  on it was a file
0cd0: 2d 6c 65 76 65 6c 20 62 72 61 6e 63 68 20 73 79  -level branch sy
0ce0: 6d 62 6f 6c 2e 0a 09 20 20 20 20 2d 2d 0a 09 20  mbol...    --.. 
0cf0: 20 20 20 2d 2d 20 43 6f 6e 73 74 72 61 69 6e 74     -- Constraint
0d00: 3a 20 41 6c 6c 20 74 68 65 20 4c 4f 44 20 73 79  : All the LOD sy
0d10: 6d 62 6f 6c 73 20 61 72 65 20 69 6e 20 74 68 65  mbols are in the
0d20: 20 73 61 6d 65 20 70 72 6f 6a 65 63 74 0a 09 20   same project.. 
0d30: 20 20 20 2d 2d 20 20 20 20 20 20 20 20 20 20 20     --           
0d40: 20 20 61 73 20 74 68 65 20 66 69 6c 65 20 69 74    as the file it
0d50: 73 65 6c 66 2e 20 54 68 69 73 20 63 61 6e 6e 6f  self. This canno
0d60: 74 20 62 65 0a 09 20 20 20 20 2d 2d 20 20 20 20  t be..    --    
0d70: 20 20 20 20 20 20 20 20 20 65 78 70 72 65 73 73           express
0d80: 65 64 20 69 6e 20 43 52 45 41 54 45 20 54 41 42  ed in CREATE TAB
0d90: 4c 45 20 73 79 6e 74 61 78 2e 0a 0a 09 20 20 20  LE syntax....   
0da0: 20 6c 6f 64 20 20 49 4e 54 45 47 45 52 20 20 4e   lod  INTEGER  N
0db0: 4f 54 20 4e 55 4c 4c 20 20 52 45 46 45 52 45 4e  OT NULL  REFEREN
0dc0: 43 45 53 20 73 79 6d 62 6f 6c 2c 20 2d 2d 20 4c  CES symbol, -- L
0dd0: 69 6e 65 20 6f 66 20 64 65 76 65 6c 6f 70 6d 65  ine of developme
0de0: 6e 74 0a 0a 09 20 20 20 20 2d 2d 20 54 68 65 20  nt...    -- The 
0df0: 72 65 76 69 73 69 6f 6e 73 20 69 6e 20 61 20 66  revisions in a f
0e00: 69 6c 65 20 61 72 65 20 6f 72 67 61 6e 69 7a 65  ile are organize
0e10: 64 20 69 6e 20 61 20 66 6f 72 65 73 74 20 6f 66  d in a forest of
0e20: 0a 09 20 20 20 20 2d 2d 20 74 72 65 65 73 2c 20  ..    -- trees, 
0e30: 77 69 74 68 20 74 68 65 20 6d 61 69 6e 20 6c 69  with the main li
0e40: 6e 65 73 20 64 65 66 69 6e 65 64 20 74 68 72 6f  nes defined thro
0e50: 75 67 68 20 74 68 65 20 70 61 72 65 6e 74 20 2f  ugh the parent /
0e60: 0a 09 20 20 20 20 2d 2d 20 63 68 69 6c 64 20 72  ..    -- child r
0e70: 65 66 65 72 65 6e 63 65 73 2e 20 41 20 72 65 76  eferences. A rev
0e80: 69 73 69 6f 6e 20 77 69 74 68 6f 75 74 20 61 20  ision without a 
0e90: 70 61 72 65 6e 74 20 69 73 20 74 68 65 0a 09 20  parent is the.. 
0ea0: 20 20 20 2d 2d 20 72 6f 6f 74 20 6f 66 20 61 20     -- root of a 
0eb0: 74 72 65 65 2c 20 61 6e 64 20 61 20 72 65 76 69  tree, and a revi
0ec0: 73 69 6f 6e 20 77 69 74 68 6f 75 74 20 61 20 63  sion without a c
0ed0: 68 69 6c 64 20 69 73 20 61 0a 09 20 20 20 20 2d  hild is a..    -
0ee0: 2d 20 6c 65 61 66 2e 0a 0a 09 20 20 20 20 2d 2d  - leaf....    --
0ef0: 20 43 6f 6e 73 74 72 61 69 6e 74 73 3a 20 41 6c   Constraints: Al
0f00: 6c 20 72 65 76 69 73 69 6f 6e 73 20 63 6f 75 70  l revisions coup
0f10: 6c 65 64 20 74 68 72 6f 75 67 68 20 70 61 72 65  led through pare
0f20: 6e 74 2f 63 68 69 6c 64 0a 09 20 20 20 20 2d 2d  nt/child..    --
0f30: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 72 65                re
0f40: 66 65 72 20 74 6f 20 74 68 65 20 73 61 6d 65 20  fer to the same 
0f50: 4c 4f 44 20 73 79 6d 62 6f 6c 2e 20 54 68 65 20  LOD symbol. The 
0f60: 70 61 72 65 6e 74 0a 09 20 20 20 20 2d 2d 20 20  parent..    --  
0f70: 20 20 20 20 20 20 20 20 20 20 20 20 6f 66 20 61              of a
0f80: 20 63 68 69 6c 64 20 6f 66 20 58 20 69 73 20 58   child of X is X
0f90: 2e 20 54 68 65 20 63 68 69 6c 64 20 6f 66 20 61  . The child of a
0fa0: 0a 09 20 20 20 20 2d 2d 20 20 20 20 20 20 20 20  ..    --        
0fb0: 20 20 20 20 20 20 70 61 72 65 6e 74 20 6f 66 20        parent of 
0fc0: 58 20 69 73 20 58 2e 0a 0a 09 20 20 20 20 70 61  X is X....    pa
0fd0: 72 65 6e 74 20 20 49 4e 54 45 47 45 52 20 20 20  rent  INTEGER   
0fe0: 20 20 20 20 20 20 20 20 20 52 45 46 45 52 45 4e           REFEREN
0ff0: 43 45 53 20 72 65 76 69 73 69 6f 6e 2c 0a 09 20  CES revision,.. 
1000: 20 20 20 63 68 69 6c 64 20 20 20 49 4e 54 45 47     child   INTEG
1010: 45 52 20 20 20 20 20 20 20 20 20 20 20 20 52 45  ER            RE
1020: 46 45 52 45 4e 43 45 53 20 72 65 76 69 73 69 6f  FERENCES revisio
1030: 6e 2c 0a 0a 09 20 20 20 20 2d 2d 20 54 68 65 20  n,...    -- The 
1040: 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 20 6f  representation o
1050: 66 20 61 20 62 72 61 6e 63 68 20 69 6e 20 61 20  f a branch in a 
1060: 74 72 65 65 20 69 73 20 74 68 65 0a 09 20 20 20  tree is the..   
1070: 20 2d 2d 20 65 78 63 65 70 74 69 6f 6e 20 74 6f   -- exception to
1080: 20 74 68 65 20 74 68 72 65 65 20 63 6f 6e 73 74   the three const
1090: 72 61 69 6e 74 73 20 61 62 6f 76 65 2e 0a 0a 09  raints above....
10a0: 20 20 20 20 2d 2d 20 54 68 65 20 62 65 67 69 6e      -- The begin
10b0: 6e 69 6e 67 20 6f 66 20 61 20 62 72 61 6e 63 68  ning of a branch
10c0: 20 69 73 20 72 65 70 72 65 73 65 6e 74 65 64 20   is represented 
10d0: 62 79 20 61 20 6e 6f 6e 2d 4e 55 4c 4c 0a 09 20  by a non-NULL.. 
10e0: 20 20 20 2d 2d 20 62 70 61 72 65 6e 74 20 6f 66     -- bparent of
10f0: 20 61 20 72 65 76 69 73 69 6f 6e 2e 20 54 68 69   a revision. Thi
1100: 73 20 72 65 76 69 73 69 6f 6e 20 42 20 69 73 20  s revision B is 
1110: 74 68 65 20 66 69 72 73 74 20 6f 6e 0a 09 20 20  the first on..  
1120: 20 20 2d 2d 20 74 68 65 20 62 72 61 6e 63 68 2e    -- the branch.
1130: 20 49 74 73 20 70 61 72 65 6e 74 20 50 20 69 73   Its parent P is
1140: 20 74 68 65 20 72 65 76 69 73 69 6f 6e 20 74 68   the revision th
1150: 65 20 62 72 61 6e 63 68 20 69 73 0a 09 20 20 20  e branch is..   
1160: 20 2d 2d 20 72 6f 6f 74 65 64 20 69 6e 2c 20 61   -- rooted in, a
1170: 6e 64 20 69 74 20 69 73 20 6e 6f 74 20 74 68 65  nd it is not the
1180: 20 63 68 69 6c 64 20 6f 66 20 50 2e 20 42 20 61   child of P. B a
1190: 6e 64 20 50 20 72 65 66 65 72 0a 09 20 20 20 20  nd P refer..    
11a0: 2d 2d 20 74 6f 20 64 69 66 66 65 72 65 6e 74 20  -- to different 
11b0: 4c 4f 44 20 73 79 6d 62 6f 6c 73 2e 20 54 68 65  LOD symbols. The
11c0: 20 62 70 61 72 65 6e 74 20 6f 66 20 42 20 69 73   bparent of B is
11d0: 20 61 6c 73 6f 20 69 74 73 0a 09 20 20 20 20 2d   also its..    -
11e0: 2d 20 4c 4f 44 2c 20 61 6e 64 20 74 68 65 20 4c  - LOD, and the L
11f0: 4f 44 20 6f 66 20 69 74 73 20 63 68 69 6c 64 72  OD of its childr
1200: 65 6e 2e 0a 0a 09 20 20 20 20 62 70 61 72 65 6e  en....    bparen
1210: 74 20 49 4e 54 45 47 45 52 20 20 20 20 20 20 20  t INTEGER       
1220: 20 20 20 20 20 52 45 46 45 52 45 4e 43 45 53 20       REFERENCES 
1230: 73 79 6d 62 6f 6c 2c 0a 0a 09 20 20 20 20 2d 2d  symbol,...    --
1240: 20 4c 61 73 74 6c 79 20 77 65 20 6b 65 65 70 20   Lastly we keep 
1250: 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 69 73 20 61  information is a
1260: 62 6f 75 74 20 6e 6f 6e 2d 74 72 75 6e 6b 20 64  bout non-trunk d
1270: 65 66 61 75 6c 74 0a 09 20 20 20 20 2d 2d 20 62  efault..    -- b
1280: 72 61 6e 63 68 65 73 20 28 4e 54 44 42 29 20 69  ranches (NTDB) i
1290: 6e 20 74 68 65 20 72 65 76 69 73 69 6f 6e 73 2e  n the revisions.
12a0: 0a 0a 09 20 20 20 20 2d 2d 20 41 6c 6c 20 72 65  ...    -- All re
12b0: 76 69 73 69 6f 6e 73 20 6f 6e 20 74 68 65 20 4e  visions on the N
12c0: 54 44 42 20 68 61 76 65 20 27 69 73 64 65 66 61  TDB have 'isdefa
12d0: 75 6c 74 27 20 54 52 55 45 2c 0a 09 20 20 20 20  ult' TRUE,..    
12e0: 2d 2d 20 65 76 65 72 79 6f 6e 65 20 65 6c 73 65  -- everyone else
12f0: 20 46 41 4c 53 45 2e 20 54 68 65 20 6c 61 73 74   FALSE. The last
1300: 20 72 65 76 69 73 69 6f 6e 20 58 20 6f 6e 20 74   revision X on t
1310: 68 65 20 4e 54 44 42 0a 09 20 20 20 20 2d 2d 20  he NTDB..    -- 
1320: 77 68 69 63 68 20 69 73 20 73 74 69 6c 6c 20 63  which is still c
1330: 6f 6e 73 69 64 65 72 65 64 20 74 6f 20 62 65 20  onsidered to be 
1340: 6f 6e 20 74 68 65 20 74 72 75 6e 6b 20 61 73 20  on the trunk as 
1350: 77 65 6c 6c 0a 09 20 20 20 20 2d 2d 20 68 61 73  well..    -- has
1360: 20 61 20 6e 6f 6e 2d 4e 55 4c 4c 20 27 64 62 63   a non-NULL 'dbc
1370: 68 69 6c 64 27 20 77 68 69 63 68 20 72 65 66 65  hild' which refe
1380: 72 73 20 74 6f 20 74 68 65 20 72 6f 6f 74 20 6f  rs to the root o
1390: 66 0a 09 20 20 20 20 2d 2d 20 74 68 65 20 74 72  f..    -- the tr
13a0: 75 6e 6b 2e 20 54 68 65 20 72 6f 6f 74 20 61 6c  unk. The root al
13b0: 73 6f 20 68 61 73 20 61 20 6e 6f 6e 2d 4e 55 4c  so has a non-NUL
13c0: 4c 20 64 62 70 61 72 65 6e 74 0a 09 20 20 20 20  L dbparent..    
13d0: 2d 2d 20 72 65 66 65 72 69 6e 67 20 74 6f 20 58  -- refering to X
13e0: 2e 0a 0a 09 20 20 20 20 69 73 64 65 66 61 75 6c  ....    isdefaul
13f0: 74 20 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e  t INTEGER  NOT N
1400: 55 4c 4c 2c 0a 09 20 20 20 20 64 62 70 61 72 65  ULL,..    dbpare
1410: 6e 74 20 20 49 4e 54 45 47 45 52 20 20 20 20 20  nt  INTEGER     
1420: 20 20 20 20 20 20 20 52 45 46 45 52 45 4e 43 45         REFERENCE
1430: 53 20 72 65 76 69 73 69 6f 6e 2c 0a 09 20 20 20  S revision,..   
1440: 20 64 62 63 68 69 6c 64 20 20 20 49 4e 54 45 47   dbchild   INTEG
1450: 45 52 20 20 20 20 20 20 20 20 20 20 20 20 52 45  ER            RE
1460: 46 45 52 45 4e 43 45 53 20 72 65 76 69 73 69 6f  FERENCES revisio
1470: 6e 2c 0a 0a 09 20 20 20 20 2d 2d 20 54 68 65 20  n,...    -- The 
1480: 6d 61 69 6e 20 70 61 79 6c 6f 61 64 20 6f 66 20  main payload of 
1490: 74 68 65 20 72 65 76 69 73 69 6f 6e 20 61 72 65  the revision are
14a0: 20 74 68 65 20 64 61 74 65 2f 74 69 6d 65 20 69   the date/time i
14b0: 74 0a 09 20 20 20 20 2d 2d 20 77 61 73 20 65 6e  t..    -- was en
14c0: 74 65 72 65 64 2c 20 69 74 73 20 73 74 61 74 65  tered, its state
14d0: 2c 20 6f 70 65 72 61 74 69 6f 6e 20 28 3d 20 74  , operation (= t
14e0: 79 70 65 2f 63 6c 61 73 73 29 2c 20 74 65 78 74  ype/class), text
14f0: 0a 09 20 20 20 20 2d 2d 20 63 6f 6e 74 65 6e 74  ..    -- content
1500: 2c 20 61 6e 64 20 6d 65 74 61 20 64 61 74 61 20  , and meta data 
1510: 28 61 75 74 68 6f 72 2c 20 6c 6f 67 20 6d 65 73  (author, log mes
1520: 73 61 67 65 2c 20 62 72 61 6e 63 68 2c 0a 09 20  sage, branch,.. 
1530: 20 20 20 2d 2d 20 70 72 6f 6a 65 63 74 29 2e 20     -- project). 
1540: 54 68 65 20 6c 61 73 74 20 69 73 20 65 6e 63 6f  The last is enco
1550: 64 65 64 20 61 73 20 73 69 6e 67 6c 65 20 69 64  ded as single id
1560: 2c 20 73 65 65 20 74 61 62 6c 65 0a 09 20 20 20  , see table..   
1570: 20 2d 2d 20 27 6d 65 74 61 27 2e 20 54 68 65 20   -- 'meta'. The 
1580: 64 61 74 65 2f 74 69 6d 65 20 69 73 20 67 69 76  date/time is giv
1590: 65 6e 20 69 6e 20 73 65 63 6f 6e 64 73 20 73 69  en in seconds si
15a0: 6e 63 65 20 74 68 65 0a 09 20 20 20 20 2d 2d 20  nce the..    -- 
15b0: 65 70 6f 63 68 2c 20 66 6f 72 20 65 61 73 79 20  epoch, for easy 
15c0: 63 6f 6d 70 61 72 69 73 6f 6e 2e 20 54 68 65 20  comparison. The 
15d0: 74 65 78 74 20 63 6f 6e 74 65 6e 74 20 69 73 20  text content is 
15e0: 61 6e 0a 09 20 20 20 20 2d 2d 20 28 6f 66 66 73  an..    -- (offs
15f0: 65 74 2c 6c 65 6e 67 74 68 29 20 70 61 69 72 20  et,length) pair 
1600: 69 6e 74 6f 20 74 68 65 20 72 63 73 20 61 72 63  into the rcs arc
1610: 68 69 76 65 2e 0a 0a 09 20 20 20 20 6f 70 20 20  hive....    op  
1620: 20 20 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e    INTEGER  NOT N
1630: 55 4c 4c 20 20 52 45 46 45 52 45 4e 43 45 53 20  ULL  REFERENCES 
1640: 6f 70 74 79 70 65 2c 0a 09 20 20 20 20 64 61 74  optype,..    dat
1650: 65 20 20 49 4e 54 45 47 45 52 20 20 4e 4f 54 20  e  INTEGER  NOT 
1660: 4e 55 4c 4c 2c 0a 09 20 20 20 20 73 74 61 74 65  NULL,..    state
1670: 20 54 45 58 54 20 20 20 20 20 4e 4f 54 20 4e 55   TEXT     NOT NU
1680: 4c 4c 2c 0a 09 20 20 20 20 6d 69 64 20 20 20 49  LL,..    mid   I
1690: 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c  NTEGER  NOT NULL
16a0: 20 20 52 45 46 45 52 45 4e 43 45 53 20 6d 65 74    REFERENCES met
16b0: 61 2c 0a 09 20 20 20 20 63 6f 66 66 20 20 49 4e  a,..    coff  IN
16c0: 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 2c  TEGER  NOT NULL,
16d0: 0a 09 20 20 20 20 63 6c 65 6e 20 20 49 4e 54 45  ..    clen  INTE
16e0: 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 2c 0a 0a  GER  NOT NULL,..
16f0: 09 20 20 20 20 55 4e 49 51 55 45 20 28 66 69 64  .    UNIQUE (fid
1700: 2c 20 72 65 76 29 20 2d 2d 20 54 68 65 20 44 54  , rev) -- The DT
1710: 4e 20 69 73 20 75 6e 69 71 75 65 20 77 69 74 68  N is unique with
1720: 69 6e 20 74 68 65 20 72 65 76 69 73 69 6f 6e 27  in the revision'
1730: 73 20 66 69 6c 65 2e 0a 09 7d 0a 0a 09 73 74 61  s file...}...sta
1740: 74 65 20 77 72 69 74 69 6e 67 20 6f 70 74 79 70  te writing optyp
1750: 65 20 7b 0a 09 20 20 20 20 6f 69 64 20 20 20 49  e {..    oid   I
1760: 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c  NTEGER  NOT NULL
1770: 20 20 50 52 49 4d 41 52 59 20 4b 45 59 2c 0a 09    PRIMARY KEY,..
1780: 20 20 20 20 6e 61 6d 65 20 20 54 45 58 54 20 20      name  TEXT  
1790: 20 20 20 4e 4f 54 20 4e 55 4c 4c 2c 0a 09 20 20     NOT NULL,..  
17a0: 20 20 55 4e 49 51 55 45 28 6e 61 6d 65 29 0a 09    UNIQUE(name)..
17b0: 7d 0a 09 73 74 61 74 65 20 72 75 6e 20 7b 0a 09  }..state run {..
17c0: 20 20 20 20 49 4e 53 45 52 54 20 49 4e 54 4f 20      INSERT INTO 
17d0: 6f 70 74 79 70 65 20 56 41 4c 55 45 53 20 28 2d  optype VALUES (-
17e0: 31 2c 27 64 65 6c 65 74 65 27 29 3b 20 20 2d 2d  1,'delete');  --
17f0: 20 54 68 65 20 6f 70 63 6f 64 65 20 6e 61 6d 65   The opcode name
1800: 73 20 61 72 65 20 74 68 65 0a 09 20 20 20 20 49  s are the..    I
1810: 4e 53 45 52 54 20 49 4e 54 4f 20 6f 70 74 79 70  NSERT INTO optyp
1820: 65 20 56 41 4c 55 45 53 20 28 20 30 2c 27 6e 6f  e VALUES ( 0,'no
1830: 74 68 69 6e 67 27 29 3b 20 2d 2d 20 66 69 78 65  thing'); -- fixe
1840: 64 20 70 69 65 63 65 73 2c 20 73 65 65 20 6d 79  d pieces, see my
1850: 6f 70 73 74 61 74 65 0a 09 20 20 20 20 49 4e 53  opstate..    INS
1860: 45 52 54 20 49 4e 54 4f 20 6f 70 74 79 70 65 20  ERT INTO optype 
1870: 56 41 4c 55 45 53 20 28 20 31 2c 27 61 64 64 27  VALUES ( 1,'add'
1880: 29 3b 20 20 20 20 20 2d 2d 20 69 6e 20 66 69 6c  );     -- in fil
1890: 65 3a 3a 72 65 76 2e 20 6d 79 6f 70 63 6f 64 65  e::rev. myopcode
18a0: 20 69 73 0a 09 20 20 20 20 49 4e 53 45 52 54 20   is..    INSERT 
18b0: 49 4e 54 4f 20 6f 70 74 79 70 65 20 56 41 4c 55  INTO optype VALU
18c0: 45 53 20 28 20 32 2c 27 63 68 61 6e 67 65 27 29  ES ( 2,'change')
18d0: 3b 20 20 2d 2d 20 6c 6f 61 64 65 64 20 66 72 6f  ;  -- loaded fro
18e0: 6d 20 74 68 69 73 2e 0a 09 7d 0a 0a 09 73 74 61  m this...}...sta
18f0: 74 65 20 77 72 69 74 69 6e 67 20 72 65 76 69 73  te writing revis
1900: 69 6f 6e 62 72 61 6e 63 68 63 68 69 6c 64 72 65  ionbranchchildre
1910: 6e 20 7b 0a 09 20 20 20 20 2d 2d 20 54 68 65 20  n {..    -- The 
1920: 6e 6f 6e 2d 70 72 69 6d 61 72 79 20 63 68 69 6c  non-primary chil
1930: 64 72 65 6e 20 6f 66 20 61 20 72 65 76 69 73 69  dren of a revisi
1940: 6f 6e 2c 20 61 73 20 72 65 61 63 68 61 62 6c 65  on, as reachable
1950: 0a 09 20 20 20 20 2d 2d 20 74 68 72 6f 75 67 68  ..    -- through
1960: 20 61 20 62 72 61 6e 63 68 20 73 79 6d 62 6f 6c   a branch symbol
1970: 2c 20 61 72 65 20 6c 69 73 74 65 64 20 68 65 72  , are listed her
1980: 65 2e 20 54 68 69 73 20 69 73 0a 09 20 20 20 20  e. This is..    
1990: 2d 2d 20 6e 65 65 64 65 64 20 62 79 20 70 61 73  -- needed by pas
19a0: 73 20 35 20 74 6f 20 62 72 65 61 6b 20 69 6e 74  s 5 to break int
19b0: 65 72 6e 61 6c 20 64 65 70 65 6e 64 65 6e 63 69  ernal dependenci
19c0: 65 73 20 69 6e 20 61 0a 09 20 20 20 20 2d 2d 20  es in a..    -- 
19d0: 63 68 61 6e 67 65 73 65 74 2e 0a 0a 09 20 20 20  changeset....   
19e0: 20 72 69 64 20 20 20 49 4e 54 45 47 45 52 20 20   rid   INTEGER  
19f0: 4e 4f 54 20 4e 55 4c 4c 20 20 52 45 46 45 52 45  NOT NULL  REFERE
1a00: 4e 43 45 53 20 72 65 76 69 73 69 6f 6e 2c 0a 09  NCES revision,..
1a10: 20 20 20 20 62 72 69 64 20 20 49 4e 54 45 47 45      brid  INTEGE
1a20: 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 52 45 46  R  NOT NULL  REF
1a30: 45 52 45 4e 43 45 53 20 72 65 76 69 73 69 6f 6e  ERENCES revision
1a40: 2c 0a 09 20 20 20 20 55 4e 49 51 55 45 28 72 69  ,..    UNIQUE(ri
1a50: 64 2c 62 72 69 64 29 0a 09 7d 0a 0a 09 73 74 61  d,brid)..}...sta
1a60: 74 65 20 77 72 69 74 69 6e 67 20 74 61 67 20 7b  te writing tag {
1a70: 0a 09 20 20 20 20 74 69 64 20 20 49 4e 54 45 47  ..    tid  INTEG
1a80: 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 50 52  ER  NOT NULL  PR
1a90: 49 4d 41 52 59 20 4b 45 59 20 41 55 54 4f 49 4e  IMARY KEY AUTOIN
1aa0: 43 52 45 4d 45 4e 54 2c 0a 09 20 20 20 20 66 69  CREMENT,..    fi
1ab0: 64 20 20 49 4e 54 45 47 45 52 20 20 4e 4f 54 20  d  INTEGER  NOT 
1ac0: 4e 55 4c 4c 20 20 52 45 46 45 52 45 4e 43 45 53  NULL  REFERENCES
1ad0: 20 66 69 6c 65 2c 20 20 20 20 20 2d 2d 20 46 69   file,     -- Fi
1ae0: 6c 65 20 74 68 65 20 69 74 65 6d 20 62 65 6c 6f  le the item belo
1af0: 6e 67 73 20 74 6f 0a 09 20 20 20 20 6c 6f 64 20  ngs to..    lod 
1b00: 20 49 4e 54 45 47 45 52 20 20 20 20 20 20 20 20   INTEGER        
1b10: 20 20 20 20 52 45 46 45 52 45 4e 43 45 53 20 73      REFERENCES s
1b20: 79 6d 62 6f 6c 2c 20 20 20 2d 2d 20 4c 69 6e 65  ymbol,   -- Line
1b30: 20 6f 66 20 64 65 76 65 6c 6f 70 6d 65 6e 74 20   of development 
1b40: 28 4e 55 4c 4c 20 3d 3e 20 54 72 75 6e 6b 29 0a  (NULL => Trunk).
1b50: 09 20 20 20 20 73 69 64 20 20 49 4e 54 45 47 45  .    sid  INTEGE
1b60: 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 52 45 46  R  NOT NULL  REF
1b70: 45 52 45 4e 43 45 53 20 73 79 6d 62 6f 6c 2c 20  ERENCES symbol, 
1b80: 20 20 2d 2d 20 53 79 6d 62 6f 6c 20 63 61 70 74    -- Symbol capt
1b90: 75 72 69 6e 67 20 74 68 65 20 74 61 67 0a 0a 09  uring the tag...
1ba0: 20 20 20 20 72 65 76 20 20 49 4e 54 45 47 45 52      rev  INTEGER
1bb0: 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 52 45 46 45    NOT NULL  REFE
1bc0: 52 45 4e 43 45 53 20 72 65 76 69 73 69 6f 6e 20  RENCES revision 
1bd0: 20 2d 2d 20 54 68 65 20 72 65 76 69 73 69 6f 6e   -- The revision
1be0: 20 62 65 69 6e 67 20 74 61 67 67 65 64 2e 0a 09   being tagged...
1bf0: 7d 0a 0a 09 73 74 61 74 65 20 77 72 69 74 69 6e  }...state writin
1c00: 67 20 62 72 61 6e 63 68 20 7b 0a 09 20 20 20 20  g branch {..    
1c10: 62 69 64 20 20 20 49 4e 54 45 47 45 52 20 20 4e  bid   INTEGER  N
1c20: 4f 54 20 4e 55 4c 4c 20 20 50 52 49 4d 41 52 59  OT NULL  PRIMARY
1c30: 20 4b 45 59 20 41 55 54 4f 49 4e 43 52 45 4d 45   KEY AUTOINCREME
1c40: 4e 54 2c 0a 09 20 20 20 20 66 69 64 20 20 20 49  NT,..    fid   I
1c50: 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c  NTEGER  NOT NULL
1c60: 20 20 52 45 46 45 52 45 4e 43 45 53 20 66 69 6c    REFERENCES fil
1c70: 65 2c 20 20 20 20 20 2d 2d 20 46 69 6c 65 20 74  e,     -- File t
1c80: 68 65 20 69 74 65 6d 20 62 65 6c 6f 6e 67 73 20  he item belongs 
1c90: 74 6f 0a 09 20 20 20 20 6c 6f 64 20 20 20 49 4e  to..    lod   IN
1ca0: 54 45 47 45 52 20 20 20 20 20 20 20 20 20 20 20  TEGER           
1cb0: 20 52 45 46 45 52 45 4e 43 45 53 20 73 79 6d 62   REFERENCES symb
1cc0: 6f 6c 2c 20 20 20 2d 2d 20 4c 69 6e 65 20 6f 66  ol,   -- Line of
1cd0: 20 64 65 76 65 6c 6f 70 6d 65 6e 74 20 28 4e 55   development (NU
1ce0: 4c 4c 20 3d 3e 20 54 72 75 6e 6b 29 0a 09 20 20  LL => Trunk)..  
1cf0: 20 20 73 69 64 20 20 20 49 4e 54 45 47 45 52 20    sid   INTEGER 
1d00: 20 4e 4f 54 20 4e 55 4c 4c 20 20 52 45 46 45 52   NOT NULL  REFER
1d10: 45 4e 43 45 53 20 73 79 6d 62 6f 6c 2c 20 20 20  ENCES symbol,   
1d20: 2d 2d 20 53 79 6d 62 6f 6c 20 63 61 70 74 75 72  -- Symbol captur
1d30: 69 6e 67 20 74 68 65 20 62 72 61 6e 63 68 0a 0a  ing the branch..
1d40: 09 20 20 20 20 72 6f 6f 74 20 20 49 4e 54 45 47  .    root  INTEG
1d50: 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 52 45  ER  NOT NULL  RE
1d60: 46 45 52 45 4e 43 45 53 20 72 65 76 69 73 69 6f  FERENCES revisio
1d70: 6e 2c 20 2d 2d 20 52 65 76 69 73 69 6f 6e 20 74  n, -- Revision t
1d80: 68 65 20 62 72 61 6e 63 68 20 73 70 72 6f 75 74  he branch sprout
1d90: 73 20 66 72 6f 6d 0a 09 20 20 20 20 66 69 72 73  s from..    firs
1da0: 74 20 49 4e 54 45 47 45 52 20 20 20 20 20 20 20  t INTEGER       
1db0: 20 20 20 20 20 52 45 46 45 52 45 4e 43 45 53 20       REFERENCES 
1dc0: 72 65 76 69 73 69 6f 6e 2c 20 2d 2d 20 46 69 72  revision, -- Fir
1dd0: 73 74 20 72 65 76 69 73 69 6f 6e 20 63 6f 6d 6d  st revision comm
1de0: 69 74 74 65 64 20 74 6f 20 74 68 65 20 62 72 61  itted to the bra
1df0: 6e 63 68 0a 09 20 20 20 20 62 72 61 20 20 20 54  nch..    bra   T
1e00: 45 58 54 20 20 20 20 20 4e 4f 54 20 4e 55 4c 4c  EXT     NOT NULL
1e10: 2c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20  ,               
1e20: 20 20 20 20 20 20 20 2d 2d 20 62 72 61 6e 63 68         -- branch
1e30: 20 6e 75 6d 62 65 72 0a 09 20 20 20 20 70 6f 73   number..    pos
1e40: 20 20 20 49 4e 54 45 47 45 52 20 20 4e 4f 54 20     INTEGER  NOT 
1e50: 4e 55 4c 4c 20 20 20 20 20 20 20 20 20 20 20 20  NULL            
1e60: 20 20 20 20 20 20 20 20 20 20 20 2d 2d 20 63 72             -- cr
1e70: 65 61 74 69 6f 6e 20 6f 72 64 65 72 20 69 6e 20  eation order in 
1e80: 72 6f 6f 74 2e 0a 09 7d 0a 0a 09 23 20 50 72 6f  root...}...# Pro
1e90: 6a 65 63 74 20 6c 65 76 65 6c 20 2e 2e 2e 0a 09  ject level .....
1ea0: 23 09 70 4c 69 6e 65 4f 66 44 65 76 65 6c 6f 70  #.pLineOfDevelop
1eb0: 6d 65 6e 74 2c 20 70 53 79 6d 62 6f 6c 2c 20 70  ment, pSymbol, p
1ec0: 42 72 61 6e 63 68 2c 20 70 54 61 67 2c 20 70 54  Branch, pTag, pT
1ed0: 72 75 6e 6b 0a 09 23 0a 09 23 09 70 54 72 75 6e  runk..#..#.pTrun
1ee0: 6b 20 20 3c 2d 20 70 4c 69 6e 65 4f 66 44 65 76  k  <- pLineOfDev
1ef0: 65 6c 6f 70 6d 65 6e 74 0a 09 23 09 70 42 72 61  elopment..#.pBra
1f00: 6e 63 68 20 3c 2d 20 70 53 79 6d 62 6f 6c 2c 20  nch <- pSymbol, 
1f10: 70 4c 69 6e 65 4f 66 44 65 76 65 6c 6f 70 6d 65  pLineOfDevelopme
1f20: 6e 74 0a 09 23 09 70 54 61 67 20 20 20 20 3c 2d  nt..#.pTag    <-
1f30: 20 70 53 79 6d 62 6f 6c 2c 20 70 4c 69 6e 65 4f   pSymbol, pLineO
1f40: 66 44 65 76 65 6c 6f 70 6d 65 6e 74 0a 0a 09 73  fDevelopment...s
1f50: 74 61 74 65 20 77 72 69 74 69 6e 67 20 73 79 6d  tate writing sym
1f60: 62 6f 6c 20 7b 0a 09 20 20 20 20 73 69 64 20 20  bol {..    sid  
1f70: 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c  INTEGER  NOT NUL
1f80: 4c 20 20 50 52 49 4d 41 52 59 20 4b 45 59 20 41  L  PRIMARY KEY A
1f90: 55 54 4f 49 4e 43 52 45 4d 45 4e 54 2c 0a 09 20  UTOINCREMENT,.. 
1fa0: 20 20 20 70 69 64 20 20 49 4e 54 45 47 45 52 20     pid  INTEGER 
1fb0: 20 4e 4f 54 20 4e 55 4c 4c 20 20 52 45 46 45 52   NOT NULL  REFER
1fc0: 45 4e 43 45 53 20 70 72 6f 6a 65 63 74 2c 20 20  ENCES project,  
1fd0: 2d 2d 20 50 72 6f 6a 65 63 74 20 74 68 65 20 73  -- Project the s
1fe0: 79 6d 62 6f 6c 20 62 65 6c 6f 6e 67 73 20 74 6f  ymbol belongs to
1ff0: 0a 09 20 20 20 20 6e 61 6d 65 20 54 45 58 54 20  ..    name TEXT 
2000: 20 20 20 20 4e 4f 54 20 4e 55 4c 4c 2c 0a 09 20      NOT NULL,.. 
2010: 20 20 20 74 79 70 65 20 49 4e 54 45 47 45 52 20     type INTEGER 
2020: 20 4e 4f 54 20 4e 55 4c 4c 20 20 52 45 46 45 52   NOT NULL  REFER
2030: 45 4e 43 45 53 20 73 79 6d 74 79 70 65 2c 20 20  ENCES symtype,  
2040: 2d 2d 20 65 6e 75 6d 20 7b 20 65 78 63 6c 75 64  -- enum { exclud
2050: 65 64 20 3d 20 30 2c 20 74 61 67 2c 20 62 72 61  ed = 0, tag, bra
2060: 6e 63 68 2c 20 75 6e 64 65 66 69 6e 65 64 20 7d  nch, undefined }
2070: 0a 0a 09 20 20 20 20 74 61 67 5f 63 6f 75 6e 74  ...    tag_count
2080: 20 20 20 20 49 4e 54 45 47 45 52 20 20 4e 4f 54      INTEGER  NOT
2090: 20 4e 55 4c 4c 2c 20 2d 2d 20 48 6f 77 20 6f 66   NULL, -- How of
20a0: 74 65 6e 20 74 68 65 20 73 79 6d 62 6f 6c 20 69  ten the symbol i
20b0: 73 20 75 73 65 64 20 61 73 20 74 61 67 2e 0a 09  s used as tag...
20c0: 20 20 20 20 62 72 61 6e 63 68 5f 63 6f 75 6e 74      branch_count
20d0: 20 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55   INTEGER  NOT NU
20e0: 4c 4c 2c 20 2d 2d 20 48 6f 77 20 6f 66 74 65 6e  LL, -- How often
20f0: 20 74 68 65 20 73 79 6d 62 6f 6c 20 69 73 20 75   the symbol is u
2100: 73 65 64 20 61 73 20 62 72 61 6e 63 68 0a 09 20  sed as branch.. 
2110: 20 20 20 63 6f 6d 6d 69 74 5f 63 6f 75 6e 74 20     commit_count 
2120: 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c  INTEGER  NOT NUL
2130: 4c 2c 20 2d 2d 20 48 6f 77 20 6f 66 74 65 6e 20  L, -- How often 
2140: 61 20 66 69 6c 65 20 77 61 73 20 63 6f 6d 6d 69  a file was commi
2150: 74 74 65 64 20 6f 6e 20 74 68 65 20 73 79 6d 62  tted on the symb
2160: 6f 6c 0a 0a 09 20 20 20 20 55 4e 49 51 55 45 20  ol...    UNIQUE 
2170: 28 70 69 64 2c 20 6e 61 6d 65 29 20 2d 2d 20 53  (pid, name) -- S
2180: 79 6d 62 6f 6c 73 20 61 72 65 20 75 6e 69 71 75  ymbols are uniqu
2190: 65 20 77 69 74 68 69 6e 20 74 68 65 20 70 72 6f  e within the pro
21a0: 6a 65 63 74 0a 09 7d 0a 0a 09 73 74 61 74 65 20  ject..}...state 
21b0: 77 72 69 74 69 6e 67 20 62 6c 6f 63 6b 65 72 20  writing blocker 
21c0: 7b 0a 09 20 20 20 20 2d 2d 20 46 6f 72 20 65 61  {..    -- For ea
21d0: 63 68 20 73 79 6d 62 6f 6c 20 77 65 20 73 61 76  ch symbol we sav
21e0: 65 20 77 68 69 63 68 20 6f 74 68 65 72 20 73 79  e which other sy
21f0: 6d 62 6f 6c 73 20 61 72 65 0a 09 20 20 20 20 2d  mbols are..    -
2200: 2d 20 62 6c 6f 63 6b 69 6e 67 20 69 74 73 20 72  - blocking its r
2210: 65 6d 6f 76 61 6c 20 28 69 66 20 74 68 65 20 75  emoval (if the u
2220: 73 65 72 20 61 73 6b 73 20 66 6f 72 20 69 74 29  ser asks for it)
2230: 2e 0a 0a 09 20 20 20 20 73 69 64 20 49 4e 54 45  ....    sid INTE
2240: 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 52  GER  NOT NULL  R
2250: 45 46 45 52 45 4e 43 45 53 20 73 79 6d 62 6f 6c  EFERENCES symbol
2260: 2c 20 2d 2d 0a 09 20 20 20 20 62 69 64 20 49 4e  , --..    bid IN
2270: 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 20  TEGER  NOT NULL 
2280: 20 52 45 46 45 52 45 4e 43 45 53 20 73 79 6d 62   REFERENCES symb
2290: 6f 6c 2c 20 2d 2d 20 53 70 72 6f 75 74 65 64 20  ol, -- Sprouted 
22a0: 66 72 6f 6d 20 73 69 64 2c 20 62 6c 6f 63 6b 73  from sid, blocks
22b0: 20 69 74 2e 0a 09 20 20 20 20 55 4e 49 51 55 45   it...    UNIQUE
22c0: 20 28 73 69 64 2c 20 62 69 64 29 0a 09 7d 0a 0a   (sid, bid)..}..
22d0: 09 73 74 61 74 65 20 77 72 69 74 69 6e 67 20 70  .state writing p
22e0: 61 72 65 6e 74 20 7b 0a 09 20 20 20 20 2d 2d 20  arent {..    -- 
22f0: 46 6f 72 20 65 61 63 68 20 73 79 6d 62 6f 6c 20  For each symbol 
2300: 77 65 20 73 61 76 65 20 77 68 69 63 68 20 6f 74  we save which ot
2310: 68 65 72 20 73 79 6d 62 6f 6c 73 20 63 61 6e 20  her symbols can 
2320: 61 63 74 20 61 73 0a 09 20 20 20 20 2d 2d 20 61  act as..    -- a
2330: 20 70 6f 73 73 69 62 6c 65 20 70 61 72 65 6e 74   possible parent
2340: 20 69 6e 20 73 6f 6d 65 20 66 69 6c 65 2c 20 61   in some file, a
2350: 6e 64 20 68 6f 77 20 6f 66 74 65 6e 2e 0a 0a 09  nd how often....
2360: 20 20 20 20 73 69 64 20 49 4e 54 45 47 45 52 20      sid INTEGER 
2370: 20 4e 4f 54 20 4e 55 4c 4c 20 20 52 45 46 45 52   NOT NULL  REFER
2380: 45 4e 43 45 53 20 73 79 6d 62 6f 6c 2c 20 2d 2d  ENCES symbol, --
2390: 0a 09 20 20 20 20 70 69 64 20 49 4e 54 45 47 45  ..    pid INTEGE
23a0: 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 52 45 46  R  NOT NULL  REF
23b0: 45 52 45 4e 43 45 53 20 73 79 6d 62 6f 6c 2c 20  ERENCES symbol, 
23c0: 2d 2d 20 50 6f 73 73 69 62 6c 65 20 70 61 72 65  -- Possible pare
23d0: 6e 74 20 6f 66 20 73 69 64 0a 09 20 20 20 20 6e  nt of sid..    n
23e0: 20 20 20 49 4e 54 45 47 45 52 20 20 4e 4f 54 20     INTEGER  NOT 
23f0: 4e 55 4c 4c 2c 20 20 20 20 20 20 20 20 20 20 20  NULL,           
2400: 20 20 20 20 20 20 20 20 20 2d 2d 20 48 6f 77 20           -- How 
2410: 6f 66 74 65 6e 20 70 69 64 20 63 61 6e 20 61 63  often pid can ac
2420: 74 20 61 73 20 70 61 72 65 6e 74 2e 0a 09 20 20  t as parent...  
2430: 20 20 55 4e 49 51 55 45 20 28 73 69 64 2c 20 70    UNIQUE (sid, p
2440: 69 64 29 0a 09 7d 0a 0a 09 73 74 61 74 65 20 77  id)..}...state w
2450: 72 69 74 69 6e 67 20 73 79 6d 74 79 70 65 20 7b  riting symtype {
2460: 0a 09 20 20 20 20 74 69 64 20 20 20 20 49 4e 54  ..    tid    INT
2470: 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 20  EGER  NOT NULL  
2480: 50 52 49 4d 41 52 59 20 4b 45 59 2c 0a 09 20 20  PRIMARY KEY,..  
2490: 20 20 6e 61 6d 65 20 20 20 54 45 58 54 20 20 20    name   TEXT   
24a0: 20 20 4e 4f 54 20 4e 55 4c 4c 2c 0a 09 20 20 20    NOT NULL,..   
24b0: 20 70 6c 75 72 61 6c 20 54 45 58 54 20 20 20 20   plural TEXT    
24c0: 20 4e 4f 54 20 4e 55 4c 4c 2c 0a 09 20 20 20 20   NOT NULL,..    
24d0: 55 4e 49 51 55 45 20 28 6e 61 6d 65 29 0a 09 20  UNIQUE (name).. 
24e0: 20 20 20 55 4e 49 51 55 45 20 28 70 6c 75 72 61     UNIQUE (plura
24f0: 6c 29 0a 09 7d 0a 09 73 74 61 74 65 20 72 75 6e  l)..}..state run
2500: 20 7b 0a 09 20 20 20 20 49 4e 53 45 52 54 20 49   {..    INSERT I
2510: 4e 54 4f 20 73 79 6d 74 79 70 65 20 56 41 4c 55  NTO symtype VALU
2520: 45 53 20 28 30 2c 27 65 78 63 6c 75 64 65 64 27  ES (0,'excluded'
2530: 2c 20 27 65 78 63 6c 75 64 65 64 27 29 3b 0a 09  , 'excluded');..
2540: 20 20 20 20 49 4e 53 45 52 54 20 49 4e 54 4f 20      INSERT INTO 
2550: 73 79 6d 74 79 70 65 20 56 41 4c 55 45 53 20 28  symtype VALUES (
2560: 31 2c 27 74 61 67 27 2c 20 20 20 20 20 20 27 74  1,'tag',      't
2570: 61 67 73 27 29 3b 0a 09 20 20 20 20 49 4e 53 45  ags');..    INSE
2580: 52 54 20 49 4e 54 4f 20 73 79 6d 74 79 70 65 20  RT INTO symtype 
2590: 56 41 4c 55 45 53 20 28 32 2c 27 62 72 61 6e 63  VALUES (2,'branc
25a0: 68 27 2c 20 20 20 27 62 72 61 6e 63 68 65 73 27  h',   'branches'
25b0: 29 3b 0a 09 20 20 20 20 49 4e 53 45 52 54 20 49  );..    INSERT I
25c0: 4e 54 4f 20 73 79 6d 74 79 70 65 20 56 41 4c 55  NTO symtype VALU
25d0: 45 53 20 28 33 2c 27 75 6e 64 65 66 69 6e 65 64  ES (3,'undefined
25e0: 27 2c 27 75 6e 64 65 66 69 6e 65 64 27 29 3b 0a  ','undefined');.
25f0: 09 7d 0a 0a 09 73 74 61 74 65 20 77 72 69 74 69  .}...state writi
2600: 6e 67 20 6d 65 74 61 20 7b 0a 09 20 20 20 20 2d  ng meta {..    -
2610: 2d 20 4d 65 74 61 20 64 61 74 61 20 6f 66 20 72  - Meta data of r
2620: 65 76 69 73 69 6f 6e 73 2e 20 53 65 65 20 72 65  evisions. See re
2630: 76 69 73 69 6f 6e 2e 6d 69 64 20 66 6f 72 20 74  vision.mid for t
2640: 68 65 0a 09 20 20 20 20 2d 2d 20 72 65 66 65 72  he..    -- refer
2650: 65 6e 63 65 2e 20 4d 61 6e 79 20 72 65 76 69 73  ence. Many revis
2660: 69 6f 6e 73 20 63 61 6e 20 73 68 61 72 65 20 6d  ions can share m
2670: 65 74 61 20 64 61 74 61 2e 20 54 68 69 73 20 69  eta data. This i
2680: 73 0a 09 20 20 20 20 2d 2d 20 61 63 74 75 61 6c  s..    -- actual
2690: 6c 79 20 6f 6e 65 20 6f 66 20 74 68 65 20 63 72  ly one of the cr
26a0: 69 74 65 72 69 6f 6e 73 20 75 73 65 64 20 74 6f  iterions used to
26b0: 20 73 6f 72 74 20 72 65 76 69 73 69 6f 6e 73 0a   sort revisions.
26c0: 09 20 20 20 20 2d 2d 20 69 6e 74 6f 20 63 68 61  .    -- into cha
26d0: 6e 67 65 73 65 74 73 2e 0a 0a 09 20 20 20 20 6d  ngesets....    m
26e0: 69 64 20 49 4e 54 45 47 45 52 20 20 4e 4f 54 20  id INTEGER  NOT 
26f0: 4e 55 4c 4c 20 20 50 52 49 4d 41 52 59 20 4b 45  NULL  PRIMARY KE
2700: 59 20 20 41 55 54 4f 49 4e 43 52 45 4d 45 4e 54  Y  AUTOINCREMENT
2710: 2c 0a 0a 09 20 20 20 20 2d 2d 20 4d 65 74 61 20  ,...    -- Meta 
2720: 64 61 74 61 20 62 65 6c 6f 6e 67 73 20 74 6f 20  data belongs to 
2730: 61 20 73 70 65 63 69 66 69 63 20 70 72 6f 6a 65  a specific proje
2740: 63 74 2c 20 73 74 72 6f 6e 67 65 72 2c 20 74 6f  ct, stronger, to
2750: 20 61 0a 09 20 20 20 20 2d 2d 20 62 72 61 6e 63   a..    -- branc
2760: 68 20 69 6e 20 74 68 61 74 20 70 72 6f 6a 65 63  h in that projec
2770: 74 2e 20 49 74 20 66 75 72 74 68 65 72 20 68 61  t. It further ha
2780: 73 20 61 20 6c 6f 67 20 6d 65 73 73 61 67 65 2c  s a log message,
2790: 0a 09 20 20 20 20 2d 2d 20 61 6e 64 20 69 74 73  ..    -- and its
27a0: 20 61 75 74 68 6f 72 2e 20 54 68 69 73 20 69 73   author. This is
27b0: 20 75 6e 69 71 75 65 20 77 69 74 68 20 74 68 65   unique with the
27c0: 20 70 72 6f 6a 65 63 74 20 61 6e 64 0a 09 20 20   project and..  
27d0: 20 20 2d 2d 20 62 72 61 6e 63 68 2e 0a 0a 09 20    -- branch.... 
27e0: 20 20 20 70 69 64 20 49 4e 54 45 47 45 52 20 20     pid INTEGER  
27f0: 4e 4f 54 20 4e 55 4c 4c 20 20 52 45 46 45 52 45  NOT NULL  REFERE
2800: 4e 43 45 53 20 70 72 6f 6a 65 63 74 2c 20 20 2d  NCES project,  -
2810: 2d 0a 09 20 20 20 20 62 69 64 20 49 4e 54 45 47  -..    bid INTEG
2820: 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 52 45  ER  NOT NULL  RE
2830: 46 45 52 45 4e 43 45 53 20 73 79 6d 62 6f 6c 2c  FERENCES symbol,
2840: 20 20 20 2d 2d 0a 09 20 20 20 20 61 69 64 20 49     --..    aid I
2850: 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c  NTEGER  NOT NULL
2860: 20 20 52 45 46 45 52 45 4e 43 45 53 20 61 75 74    REFERENCES aut
2870: 68 6f 72 2c 20 20 20 2d 2d 0a 09 20 20 20 20 63  hor,   --..    c
2880: 69 64 20 49 4e 54 45 47 45 52 20 20 4e 4f 54 20  id INTEGER  NOT 
2890: 4e 55 4c 4c 20 20 52 45 46 45 52 45 4e 43 45 53  NULL  REFERENCES
28a0: 20 63 6d 65 73 73 61 67 65 2c 20 2d 2d 0a 0a 09   cmessage, --...
28b0: 20 20 20 20 55 4e 49 51 55 45 20 28 70 69 64 2c      UNIQUE (pid,
28c0: 20 62 69 64 2c 20 61 69 64 2c 20 63 69 64 29 0a   bid, aid, cid).
28d0: 0a 09 20 20 20 20 2d 2d 20 43 6f 6e 73 74 72 61  ..    -- Constra
28e0: 69 6e 74 73 3a 20 54 68 65 20 70 72 6f 6a 65 63  ints: The projec
28f0: 74 20 6f 66 20 74 68 65 20 6d 65 74 61 20 64 61  t of the meta da
2900: 74 61 20 6f 66 20 61 20 72 65 76 69 73 69 6f 6e  ta of a revision
2910: 0a 09 20 20 20 20 2d 2d 20 20 20 20 20 20 20 20  ..    --        
2920: 20 20 20 20 20 20 58 20 69 73 20 74 68 65 20 73        X is the s
2930: 61 6d 65 20 61 73 20 74 68 65 20 70 72 6f 6a 65  ame as the proje
2940: 63 74 20 6f 66 20 58 20 69 74 73 65 6c 66 2e 0a  ct of X itself..
2950: 09 20 20 20 20 2d 2d 0a 09 20 20 20 20 2d 2d 20  .    --..    -- 
2960: 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 20 54 68 65  ............ The
2970: 20 62 72 61 6e 63 68 20 6f 66 20 74 68 65 20 6d   branch of the m
2980: 65 74 61 20 64 61 74 61 20 6f 66 20 61 20 72 65  eta data of a re
2990: 76 69 73 69 6f 6e 0a 09 20 20 20 20 2d 2d 20 20  vision..    --  
29a0: 20 20 20 20 20 20 20 20 20 20 20 20 58 20 69 73              X is
29b0: 20 74 68 65 20 73 61 6d 65 20 61 73 20 74 68 65   the same as the
29c0: 20 6c 69 6e 65 20 6f 66 20 64 65 76 65 6c 6f 70   line of develop
29d0: 6d 65 6e 74 0a 09 20 20 20 20 2d 2d 20 20 20 20  ment..    --    
29e0: 20 20 20 20 20 20 20 20 20 20 6f 66 20 58 20 69            of X i
29f0: 74 73 65 6c 66 2e 0a 09 7d 0a 0a 09 23 20 41 75  tself...}...# Au
2a00: 74 68 6f 72 73 20 61 6e 64 20 63 6f 6d 6d 69 74  thors and commit
2a10: 20 6d 65 73 73 61 67 65 73 20 61 72 65 20 66 75   messages are fu
2a20: 6c 6c 79 20 67 6c 6f 62 61 6c 2c 20 69 2e 65 2e  lly global, i.e.
2a30: 20 70 65 72 0a 09 23 20 72 65 70 6f 73 69 74 6f   per..# reposito
2a40: 72 79 2e 0a 0a 09 73 74 61 74 65 20 77 72 69 74  ry....state writ
2a50: 69 6e 67 20 61 75 74 68 6f 72 20 7b 0a 09 20 20  ing author {..  
2a60: 20 20 61 69 64 20 20 49 4e 54 45 47 45 52 20 20    aid  INTEGER  
2a70: 4e 4f 54 20 4e 55 4c 4c 20 20 50 52 49 4d 41 52  NOT NULL  PRIMAR
2a80: 59 20 4b 45 59 20 20 41 55 54 4f 49 4e 43 52 45  Y KEY  AUTOINCRE
2a90: 4d 45 4e 54 2c 0a 09 20 20 20 20 6e 61 6d 65 20  MENT,..    name 
2aa0: 54 45 58 54 20 20 20 20 20 4e 4f 54 20 4e 55 4c  TEXT     NOT NUL
2ab0: 4c 20 20 55 4e 49 51 55 45 0a 09 7d 0a 0a 09 73  L  UNIQUE..}...s
2ac0: 74 61 74 65 20 77 72 69 74 69 6e 67 20 63 6d 65  tate writing cme
2ad0: 73 73 61 67 65 20 7b 0a 09 20 20 20 20 63 69 64  ssage {..    cid
2ae0: 20 20 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e    INTEGER  NOT N
2af0: 55 4c 4c 20 20 50 52 49 4d 41 52 59 20 4b 45 59  ULL  PRIMARY KEY
2b00: 20 20 41 55 54 4f 49 4e 43 52 45 4d 45 4e 54 2c    AUTOINCREMENT,
2b10: 0a 09 20 20 20 20 74 65 78 74 20 54 45 58 54 20  ..    text TEXT 
2b20: 20 20 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 55 4e      NOT NULL  UN
2b30: 49 51 55 45 0a 09 7d 0a 0a 09 70 72 6f 6a 65 63  IQUE..}...projec
2b40: 74 3a 3a 73 79 6d 20 67 65 74 73 79 6d 74 79 70  t::sym getsymtyp
2b50: 65 73 0a 09 66 69 6c 65 3a 3a 72 65 76 20 20 20  es..file::rev   
2b60: 20 67 65 74 6f 70 63 6f 64 65 73 0a 09 72 65 74   getopcodes..ret
2b70: 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 74  urn.    }..    t
2b80: 79 70 65 6d 65 74 68 6f 64 20 6c 6f 61 64 20 7b  ypemethod load {
2b90: 7d 20 7b 0a 09 73 74 61 74 65 20 72 65 61 64 69  } {..state readi
2ba0: 6e 67 20 73 79 6d 62 6f 6c 0a 09 73 74 61 74 65  ng symbol..state
2bb0: 20 72 65 61 64 69 6e 67 20 73 79 6d 74 79 70 65   reading symtype
2bc0: 0a 09 73 74 61 74 65 20 72 65 61 64 69 6e 67 20  ..state reading 
2bd0: 6f 70 74 79 70 65 0a 0a 09 70 72 6f 6a 65 63 74  optype...project
2be0: 3a 3a 73 79 6d 20 67 65 74 73 79 6d 74 79 70 65  ::sym getsymtype
2bf0: 73 0a 09 66 69 6c 65 3a 3a 72 65 76 20 20 20 20  s..file::rev    
2c00: 67 65 74 6f 70 63 6f 64 65 73 0a 09 72 65 70 6f  getopcodes..repo
2c10: 73 69 74 6f 72 79 20 20 20 6c 6f 61 64 73 79 6d  sitory   loadsym
2c20: 62 6f 6c 73 0a 09 72 65 74 75 72 6e 0a 20 20 20  bols..return.   
2c30: 20 7d 0a 0a 20 20 20 20 74 79 70 65 6d 65 74 68   }..    typemeth
2c40: 6f 64 20 72 75 6e 20 7b 7d 20 7b 0a 09 23 20 50  od run {} {..# P
2c50: 61 73 73 20 6d 61 6e 61 67 65 72 20 69 6e 74 65  ass manager inte
2c60: 72 66 61 63 65 2e 20 45 78 65 63 75 74 65 64 20  rface. Executed 
2c70: 74 6f 20 70 65 72 66 6f 72 6d 20 74 68 65 0a 09  to perform the..
2c80: 23 20 66 75 6e 63 74 69 6f 6e 61 6c 69 74 79 20  # functionality 
2c90: 6f 66 20 74 68 65 20 70 61 73 73 2e 0a 0a 09 73  of the pass....s
2ca0: 65 74 20 72 62 61 73 65 20 5b 72 65 70 6f 73 69  et rbase [reposi
2cb0: 74 6f 72 79 20 62 61 73 65 3f 5d 0a 09 66 6f 72  tory base?]..for
2cc0: 65 61 63 68 20 70 72 6f 6a 65 63 74 20 5b 72 65  each project [re
2cd0: 70 6f 73 69 74 6f 72 79 20 70 72 6f 6a 65 63 74  pository project
2ce0: 73 5d 20 7b 0a 09 20 20 20 20 73 65 74 20 62 61  s] {..    set ba
2cf0: 73 65 20 5b 66 69 6c 65 20 6a 6f 69 6e 20 24 72  se [file join $r
2d00: 62 61 73 65 20 5b 24 70 72 6f 6a 65 63 74 20 62  base [$project b
2d10: 61 73 65 5d 5d 0a 09 20 20 20 20 6c 6f 67 20 77  ase]]..    log w
2d20: 72 69 74 65 20 31 20 63 6f 6c 6c 72 65 76 20 22  rite 1 collrev "
2d30: 50 72 6f 63 65 73 73 69 6e 67 20 24 62 61 73 65  Processing $base
2d40: 22 0a 0a 09 20 20 20 20 66 6f 72 65 61 63 68 20  "...    foreach 
2d50: 66 69 6c 65 20 5b 24 70 72 6f 6a 65 63 74 20 66  file [$project f
2d60: 69 6c 65 73 5d 20 7b 0a 09 09 73 65 74 20 70 61  iles] {...set pa
2d70: 74 68 20 5b 24 66 69 6c 65 20 70 61 74 68 5d 0a  th [$file path].
2d80: 09 09 6c 6f 67 20 77 72 69 74 65 20 32 20 63 6f  ..log write 2 co
2d90: 6c 6c 72 65 76 20 22 50 61 72 73 69 6e 67 20 24  llrev "Parsing $
2da0: 70 61 74 68 22 0a 09 09 69 66 20 7b 5b 63 61 74  path"...if {[cat
2db0: 63 68 20 7b 0a 09 09 20 20 20 20 70 61 72 73 65  ch {...    parse
2dc0: 72 20 70 72 6f 63 65 73 73 20 5b 66 69 6c 65 20  r process [file 
2dd0: 6a 6f 69 6e 20 24 62 61 73 65 20 24 70 61 74 68  join $base $path
2de0: 5d 20 24 66 69 6c 65 0a 09 09 7d 20 6d 73 67 5d  ] $file...} msg]
2df0: 7d 20 7b 0a 09 09 20 20 20 20 67 6c 6f 62 61 6c  } {...    global
2e00: 20 65 72 72 6f 72 43 6f 64 65 0a 09 09 20 20 20   errorCode...   
2e10: 20 69 66 20 7b 24 65 72 72 6f 72 43 6f 64 65 20   if {$errorCode 
2e20: 65 71 20 22 76 63 3a 3a 72 63 73 3a 3a 70 61 72  eq "vc::rcs::par
2e30: 73 65 72 22 7d 20 7b 0a 09 09 09 74 72 6f 75 62  ser"} {....troub
2e40: 6c 65 20 66 61 74 61 6c 20 22 24 70 61 74 68 20  le fatal "$path 
2e50: 69 73 20 6e 6f 74 20 61 20 76 61 6c 69 64 20 52  is not a valid R
2e60: 43 53 20 61 72 63 68 69 76 65 20 28 24 6d 73 67  CS archive ($msg
2e70: 29 22 0a 09 09 20 20 20 20 7d 20 65 6c 73 65 20  )"...    } else 
2e80: 7b 0a 09 09 09 67 6c 6f 62 61 6c 20 65 72 72 6f  {....global erro
2e90: 72 49 6e 66 6f 0a 09 09 09 74 72 6f 75 62 6c 65  rInfo....trouble
2ea0: 20 69 6e 74 65 72 6e 61 6c 20 24 65 72 72 6f 72   internal $error
2eb0: 49 6e 66 6f 0a 09 09 20 20 20 20 7d 0a 09 09 7d  Info...    }...}
2ec0: 20 65 6c 73 65 20 7b 0a 09 09 20 20 20 20 23 20   else {...    # 
2ed0: 57 65 20 70 65 72 73 69 73 74 20 74 68 65 20 63  We persist the c
2ee0: 6f 72 65 20 6f 66 20 74 68 65 20 64 61 74 61 20  ore of the data 
2ef0: 63 6f 6c 6c 65 63 74 65 64 20 61 62 6f 75 74 0a  collected about.
2f00: 09 09 20 20 20 20 23 20 65 61 63 68 20 66 69 6c  ..    # each fil
2f10: 65 20 69 6d 6d 65 64 69 61 74 65 6c 79 20 61 66  e immediately af
2f20: 74 65 72 20 69 74 20 68 61 73 20 62 65 65 6e 20  ter it has been 
2f30: 70 61 72 73 65 64 0a 09 09 20 20 20 20 23 20 61  parsed...    # a
2f40: 6e 64 20 77 72 61 6e 67 6c 65 64 20 69 6e 74 6f  nd wrangled into
2f50: 20 73 68 61 70 65 2c 20 61 6e 64 20 74 68 65 6e   shape, and then
2f60: 20 64 72 6f 70 20 69 74 20 66 72 6f 6d 0a 09 09   drop it from...
2f70: 20 20 20 20 23 20 6d 65 6d 6f 72 79 2e 20 54 68      # memory. Th
2f80: 69 73 20 69 73 20 64 6f 6e 65 20 74 6f 20 6b 65  is is done to ke
2f90: 65 70 20 74 68 65 20 61 6d 6f 75 6e 74 20 6f 66  ep the amount of
2fa0: 0a 09 09 20 20 20 20 23 20 72 65 71 75 69 72 65  ...    # require
2fb0: 64 20 6d 65 6d 6f 72 79 20 77 69 74 68 69 6e 20  d memory within 
2fc0: 73 65 6e 73 69 62 6c 65 20 6c 69 6d 69 74 73 2e  sensible limits.
2fd0: 20 57 69 74 68 6f 75 74 0a 09 09 20 20 20 20 23   Without...    #
2fe0: 20 64 6f 69 6e 67 20 69 74 20 74 68 69 73 20 77   doing it this w
2ff0: 61 79 20 77 65 20 77 6f 75 6c 64 20 65 61 73 69  ay we would easi
3000: 6c 79 20 67 6f 62 62 6c 65 20 75 70 20 31 47 0a  ly gobble up 1G.
3010: 09 09 20 20 20 20 23 20 6f 66 20 52 41 4d 20 6f  ..    # of RAM o
3020: 72 20 6d 6f 72 65 20 77 69 74 68 20 61 6c 6c 20  r more with all 
3030: 74 68 65 20 6f 62 6a 65 63 74 73 20 28 72 65 76  the objects (rev
3040: 69 73 69 6f 6e 73 0a 09 09 20 20 20 20 23 20 61  isions...    # a
3050: 6e 64 20 66 69 6c 65 2d 6c 65 76 65 6c 20 73 79  nd file-level sy
3060: 6d 62 6f 6c 73 29 2e 0a 0a 09 09 20 20 20 20 24  mbols).....    $
3070: 66 69 6c 65 20 70 65 72 73 69 73 74 0a 09 09 7d  file persist...}
3080: 0a 0a 09 09 24 66 69 6c 65 20 64 72 6f 70 0a 09  ....$file drop..
3090: 20 20 20 20 7d 0a 0a 09 20 20 20 20 24 70 72 6f      }...    $pro
30a0: 6a 65 63 74 20 70 75 72 67 65 67 68 6f 73 74 73  ject purgeghosts
30b0: 79 6d 62 6f 6c 73 0a 09 7d 0a 0a 09 72 65 70 6f  ymbols..}...repo
30c0: 73 69 74 6f 72 79 20 70 65 72 73 69 73 74 72 65  sitory persistre
30d0: 76 0a 09 72 65 70 6f 73 69 74 6f 72 79 20 70 72  v..repository pr
30e0: 69 6e 74 72 65 76 73 74 61 74 69 73 74 69 63 73  intrevstatistics
30f0: 0a 09 69 6e 74 65 67 72 69 74 79 20 20 73 74 72  ..integrity  str
3100: 69 63 74 0a 0a 09 6c 6f 67 20 77 72 69 74 65 20  ict...log write 
3110: 31 20 63 6f 6c 6c 72 65 76 20 22 53 63 61 6e 20  1 collrev "Scan 
3120: 63 6f 6d 70 6c 65 74 65 64 22 0a 09 72 65 74 75  completed"..retu
3130: 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 74 79  rn.    }..    ty
3140: 70 65 6d 65 74 68 6f 64 20 64 69 73 63 61 72 64  pemethod discard
3150: 20 7b 7d 20 7b 0a 09 23 20 50 61 73 73 20 6d 61   {} {..# Pass ma
3160: 6e 61 67 65 72 20 69 6e 74 65 72 66 61 63 65 2e  nager interface.
3170: 20 45 78 65 63 75 74 65 64 20 66 6f 72 20 61 6c   Executed for al
3180: 6c 20 70 61 73 73 65 73 20 61 66 74 65 72 20 74  l passes after t
3190: 68 65 0a 09 23 20 72 75 6e 20 70 61 73 73 65 73  he..# run passes
31a0: 2c 20 74 6f 20 72 65 6d 6f 76 65 20 61 6c 6c 20  , to remove all 
31b0: 64 61 74 61 20 6f 66 20 74 68 69 73 20 70 61 73  data of this pas
31c0: 73 20 66 72 6f 6d 20 74 68 65 20 73 74 61 74 65  s from the state
31d0: 2c 0a 09 23 20 61 73 20 62 65 69 6e 67 20 6f 75  ,..# as being ou
31e0: 74 20 6f 66 20 64 61 74 65 2e 0a 0a 09 73 74 61  t of date....sta
31f0: 74 65 20 64 69 73 63 61 72 64 20 72 65 76 69 73  te discard revis
3200: 69 6f 6e 0a 09 73 74 61 74 65 20 64 69 73 63 61  ion..state disca
3210: 72 64 20 74 61 67 0a 09 73 74 61 74 65 20 64 69  rd tag..state di
3220: 73 63 61 72 64 20 62 72 61 6e 63 68 0a 09 73 74  scard branch..st
3230: 61 74 65 20 64 69 73 63 61 72 64 20 73 79 6d 62  ate discard symb
3240: 6f 6c 0a 09 73 74 61 74 65 20 64 69 73 63 61 72  ol..state discar
3250: 64 20 62 6c 6f 63 6b 65 72 0a 09 73 74 61 74 65  d blocker..state
3260: 20 64 69 73 63 61 72 64 20 70 61 72 65 6e 74 0a   discard parent.
3270: 09 73 74 61 74 65 20 64 69 73 63 61 72 64 20 73  .state discard s
3280: 79 6d 74 79 70 65 0a 09 73 74 61 74 65 20 64 69  ymtype..state di
3290: 73 63 61 72 64 20 6d 65 74 61 0a 09 73 74 61 74  scard meta..stat
32a0: 65 20 64 69 73 63 61 72 64 20 61 75 74 68 6f 72  e discard author
32b0: 0a 09 73 74 61 74 65 20 64 69 73 63 61 72 64 20  ..state discard 
32c0: 63 6d 65 73 73 61 67 65 0a 09 72 65 74 75 72 6e  cmessage..return
32d0: 0a 20 20 20 20 7d 0a 0a 20 20 20 20 70 72 6f 63  .    }..    proc
32e0: 20 50 61 72 61 6e 6f 69 61 20 7b 7d 20 7b 0a 09   Paranoia {} {..
32f0: 23 20 54 68 69 73 20 63 6f 64 65 20 70 65 72 66  # This code perf
3300: 6f 72 6d 73 20 61 20 6e 75 6d 62 65 72 20 6f 66  orms a number of
3310: 20 70 61 72 61 6e 6f 69 64 20 63 68 65 63 6b 73   paranoid checks
3320: 20 6f 66 20 74 68 65 0a 09 23 20 64 61 74 61 62   of the..# datab
3330: 61 73 65 2c 20 73 65 61 72 63 68 69 6e 67 20 66  ase, searching f
3340: 6f 72 20 69 6e 63 6f 6e 73 69 73 74 65 6e 74 20  or inconsistent 
3350: 63 72 6f 73 73 2d 72 65 66 65 72 65 6e 63 65 73  cross-references
3360: 2e 0a 09 6c 6f 67 20 77 72 69 74 65 20 34 20 63  ...log write 4 c
3370: 6f 6c 6c 72 65 76 20 7b 43 68 65 63 6b 20 64 61  ollrev {Check da
3380: 74 61 62 61 73 65 20 63 6f 6e 73 69 73 74 65 6e  tabase consisten
3390: 63 79 7d 0a 0a 09 73 65 74 20 6e 20 30 20 3b 20  cy}...set n 0 ; 
33a0: 23 20 43 6f 75 6e 74 65 72 20 66 6f 72 20 74 68  # Counter for th
33b0: 65 20 63 68 65 63 6b 73 20 28 77 65 20 70 72 69  e checks (we pri
33c0: 6e 74 20 61 6e 20 69 64 20 62 65 66 6f 72 65 20  nt an id before 
33d0: 74 68 65 0a 09 09 20 20 23 20 6d 61 69 6e 20 6c  the...  # main l
33e0: 61 62 65 6c 29 2e 0a 0a 09 23 20 46 69 6e 64 20  abel)....# Find 
33f0: 61 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 77 68  all revisions wh
3400: 69 63 68 20 64 69 73 61 67 72 65 65 20 77 69 74  ich disagree wit
3410: 68 20 74 68 65 69 72 20 6c 69 6e 65 20 6f 66 0a  h their line of.
3420: 09 23 20 64 65 76 65 6c 6f 70 6d 65 6e 74 20 61  .# development a
3430: 62 6f 75 74 20 74 68 65 20 70 72 6f 6a 65 63 74  bout the project
3440: 20 74 68 65 79 20 61 72 65 20 6f 77 6e 65 64 20   they are owned 
3450: 62 79 2e 0a 09 43 68 65 63 6b 20 5c 0a 09 20 20  by...Check \..  
3460: 20 20 7b 52 65 76 69 73 69 6f 6e 73 20 61 6e 64    {Revisions and
3470: 20 74 68 65 69 72 20 4c 4f 44 73 20 68 61 76 65   their LODs have
3480: 20 74 6f 20 62 65 20 69 6e 20 74 68 65 20 73 61   to be in the sa
3490: 6d 65 20 70 72 6f 6a 65 63 74 7d 20 5c 0a 09 20  me project} \.. 
34a0: 20 20 20 7b 64 69 73 61 67 72 65 65 73 20 77 69     {disagrees wi
34b0: 74 68 20 69 74 73 20 4c 4f 44 20 61 62 6f 75 74  th its LOD about
34c0: 20 6f 77 6e 69 6e 67 20 70 72 6f 6a 65 63 74 7d   owning project}
34d0: 20 7b 0a 09 09 53 45 4c 45 43 54 20 46 2e 6e 61   {...SELECT F.na
34e0: 6d 65 2c 20 52 2e 72 65 76 0a 09 09 46 52 4f 4d  me, R.rev...FROM
34f0: 20 72 65 76 69 73 69 6f 6e 20 52 2c 20 66 69 6c   revision R, fil
3500: 65 20 46 2c 20 73 79 6d 62 6f 6c 20 53 0a 09 09  e F, symbol S...
3510: 57 48 45 52 45 20 52 2e 66 69 64 20 3d 20 46 2e  WHERE R.fid = F.
3520: 66 69 64 0a 09 09 41 4e 44 20 20 20 52 2e 6c 6f  fid...AND   R.lo
3530: 64 20 3d 20 53 2e 73 69 64 0a 09 09 41 4e 44 20  d = S.sid...AND 
3540: 20 20 46 2e 70 69 64 20 21 3d 20 53 2e 70 69 64    F.pid != S.pid
3550: 0a 09 09 3b 0a 09 20 20 20 20 7d 0a 09 23 20 46  ...;..    }..# F
3560: 69 6e 64 20 61 6c 6c 20 72 65 76 69 73 69 6f 6e  ind all revision
3570: 73 20 77 68 69 63 68 20 64 69 73 67 72 65 65 20  s which disgree 
3580: 77 69 74 68 20 74 68 65 69 72 20 6d 65 74 61 20  with their meta 
3590: 64 61 74 61 20 61 62 6f 75 74 0a 09 23 20 74 68  data about..# th
35a0: 65 20 70 72 6f 6a 65 63 74 20 74 68 65 79 20 61  e project they a
35b0: 72 65 20 6f 77 6e 65 64 20 62 79 2e 0a 09 43 68  re owned by...Ch
35c0: 65 63 6b 20 5c 0a 09 20 20 20 20 7b 52 65 76 69  eck \..    {Revi
35d0: 73 69 6f 6e 73 20 61 6e 64 20 74 68 65 69 72 20  sions and their 
35e0: 6d 65 74 61 20 64 61 74 61 20 68 61 76 65 20 74  meta data have t
35f0: 6f 20 62 65 20 69 6e 20 74 68 65 20 73 61 6d 65  o be in the same
3600: 20 70 72 6f 6a 65 63 74 7d 20 5c 0a 09 20 20 20   project} \..   
3610: 20 7b 64 69 73 61 67 72 65 65 73 20 77 69 74 68   {disagrees with
3620: 20 69 74 73 20 6d 65 74 61 20 64 61 74 61 20 61   its meta data a
3630: 62 6f 75 74 20 6f 77 6e 69 6e 67 20 70 72 6f 6a  bout owning proj
3640: 65 63 74 7d 20 7b 0a 09 09 53 45 4c 45 43 54 20  ect} {...SELECT 
3650: 46 2e 6e 61 6d 65 2c 20 52 2e 72 65 76 0a 09 09  F.name, R.rev...
3660: 46 52 4f 4d 20 72 65 76 69 73 69 6f 6e 20 52 2c  FROM revision R,
3670: 20 66 69 6c 65 20 46 2c 20 6d 65 74 61 20 4d 0a   file F, meta M.
3680: 09 09 57 48 45 52 45 20 52 2e 66 69 64 20 3d 20  ..WHERE R.fid = 
3690: 46 2e 66 69 64 0a 09 09 41 4e 44 20 20 20 52 2e  F.fid...AND   R.
36a0: 6d 69 64 20 3d 20 4d 2e 6d 69 64 0a 09 09 41 4e  mid = M.mid...AN
36b0: 44 20 20 20 46 2e 70 69 64 20 21 3d 20 4d 2e 70  D   F.pid != M.p
36c0: 69 64 0a 09 09 3b 0a 09 20 20 20 20 7d 0a 09 23  id...;..    }..#
36d0: 20 46 69 6e 64 20 61 6c 6c 20 72 65 76 69 73 69   Find all revisi
36e0: 6f 6e 73 20 77 68 69 63 68 20 64 69 73 67 72 65  ons which disgre
36f0: 65 20 77 69 74 68 20 74 68 65 69 72 20 6d 65 74  e with their met
3700: 61 20 64 61 74 61 20 61 62 6f 75 74 0a 09 23 20  a data about..# 
3710: 74 68 65 20 62 72 61 6e 63 68 2f 6c 69 6e 65 20  the branch/line 
3720: 6f 66 20 64 65 76 65 6c 6f 70 6d 65 6e 74 20 74  of development t
3730: 68 65 79 20 62 65 6c 6f 6e 67 20 74 6f 2e 0a 09  hey belong to...
3740: 43 68 65 63 6b 20 5c 0a 09 20 20 20 20 7b 52 65  Check \..    {Re
3750: 76 69 73 69 6f 6e 73 20 61 6e 64 20 74 68 65 69  visions and thei
3760: 72 20 6d 65 74 61 20 64 61 74 61 20 68 61 76 65  r meta data have
3770: 20 74 6f 20 62 65 20 69 6e 20 74 68 65 20 73 61   to be in the sa
3780: 6d 65 20 4c 4f 44 7d 20 5c 0a 09 20 20 20 20 7b  me LOD} \..    {
3790: 64 69 73 61 67 72 65 65 73 20 77 69 74 68 20 69  disagrees with i
37a0: 74 73 20 6d 65 74 61 20 64 61 74 61 20 61 62 6f  ts meta data abo
37b0: 75 74 20 6f 77 6e 69 6e 67 20 4c 4f 44 7d 20 7b  ut owning LOD} {
37c0: 0a 09 09 53 45 4c 45 43 54 20 46 2e 6e 61 6d 65  ...SELECT F.name
37d0: 2c 20 52 2e 72 65 76 0a 09 09 46 52 4f 4d 20 72  , R.rev...FROM r
37e0: 65 76 69 73 69 6f 6e 20 52 2c 20 6d 65 74 61 20  evision R, meta 
37f0: 4d 2c 20 66 69 6c 65 20 46 0a 09 09 57 48 45 52  M, file F...WHER
3800: 45 20 52 2e 6d 69 64 20 3d 20 4d 2e 6d 69 64 0a  E R.mid = M.mid.
3810: 09 09 41 4e 44 20 20 20 52 2e 6c 6f 64 20 21 3d  ..AND   R.lod !=
3820: 20 4d 2e 62 69 64 0a 09 09 41 4e 44 20 20 20 52   M.bid...AND   R
3830: 2e 66 69 64 20 3d 20 46 2e 66 69 64 0a 09 09 3b  .fid = F.fid...;
3840: 0a 09 20 20 20 20 7d 0a 09 23 20 46 69 6e 64 20  ..    }..# Find 
3850: 61 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 77 69  all revisions wi
3860: 74 68 20 61 20 70 72 69 6d 61 72 79 20 63 68 69  th a primary chi
3870: 6c 64 20 77 68 69 63 68 20 64 69 73 61 67 72 65  ld which disagre
3880: 65 73 0a 09 23 20 61 62 6f 75 74 20 74 68 65 20  es..# about the 
3890: 66 69 6c 65 20 74 68 65 79 20 62 65 6c 6f 6e 67  file they belong
38a0: 20 74 6f 2e 0a 09 43 68 65 63 6b 20 5c 0a 09 20   to...Check \.. 
38b0: 20 20 20 7b 52 65 76 69 73 69 6f 6e 73 20 61 6e     {Revisions an
38c0: 64 20 74 68 65 69 72 20 70 72 69 6d 61 72 79 20  d their primary 
38d0: 63 68 69 6c 64 72 65 6e 20 68 61 76 65 20 74 6f  children have to
38e0: 20 62 65 20 69 6e 20 74 68 65 20 73 61 6d 65 20   be in the same 
38f0: 66 69 6c 65 7d 20 5c 0a 09 20 20 20 20 7b 64 69  file} \..    {di
3900: 73 61 67 72 65 65 73 20 77 69 74 68 20 69 74 73  sagrees with its
3910: 20 70 72 69 6d 61 72 79 20 63 68 69 6c 64 20 61   primary child a
3920: 62 6f 75 74 20 74 68 65 20 6f 77 6e 69 6e 67 20  bout the owning 
3930: 66 69 6c 65 7d 20 7b 0a 09 09 53 45 4c 45 43 54  file} {...SELECT
3940: 20 46 2e 6e 61 6d 65 2c 20 52 2e 72 65 76 0a 09   F.name, R.rev..
3950: 09 46 52 4f 4d 20 72 65 76 69 73 69 6f 6e 20 52  .FROM revision R
3960: 2c 20 72 65 76 69 73 69 6f 6e 20 43 2c 20 66 69  , revision C, fi
3970: 6c 65 20 46 0a 09 09 57 48 45 52 45 20 52 2e 66  le F...WHERE R.f
3980: 69 64 20 3d 20 46 2e 66 69 64 0a 09 09 41 4e 44  id = F.fid...AND
3990: 20 20 20 52 2e 63 68 69 6c 64 20 49 53 20 4e 4f     R.child IS NO
39a0: 54 20 4e 55 4c 4c 0a 09 09 41 4e 44 20 20 20 52  T NULL...AND   R
39b0: 2e 63 68 69 6c 64 20 3d 20 43 2e 72 69 64 0a 09  .child = C.rid..
39c0: 09 41 4e 44 20 20 20 43 2e 66 69 64 20 21 3d 20  .AND   C.fid != 
39d0: 52 2e 66 69 64 0a 09 09 3b 0a 09 20 20 20 20 7d  R.fid...;..    }
39e0: 0a 0a 09 23 20 46 69 6e 64 20 61 6c 6c 20 72 65  ...# Find all re
39f0: 76 69 73 69 6f 6e 73 20 77 69 74 68 20 61 20 62  visions with a b
3a00: 72 61 6e 63 68 20 70 61 72 65 6e 74 20 73 79 6d  ranch parent sym
3a10: 62 6f 6c 20 77 68 6f 73 65 20 70 61 72 65 6e 74  bol whose parent
3a20: 0a 09 23 20 64 69 73 61 67 72 65 65 73 20 61 62  ..# disagrees ab
3a30: 6f 75 74 20 74 68 65 20 66 69 6c 65 20 74 68 65  out the file the
3a40: 79 20 62 65 6c 6f 6e 67 20 74 6f 2e 0a 09 43 68  y belong to...Ch
3a50: 65 63 6b 20 5c 0a 09 20 20 20 20 7b 52 65 76 69  eck \..    {Revi
3a60: 73 69 6f 6e 73 20 61 6e 64 20 74 68 65 69 72 20  sions and their 
3a70: 62 72 61 6e 63 68 20 63 68 69 6c 64 72 65 6e 20  branch children 
3a80: 68 61 76 65 20 74 6f 20 62 65 20 69 6e 20 74 68  have to be in th
3a90: 65 20 73 61 6d 65 20 66 69 6c 65 7d 20 5c 0a 09  e same file} \..
3aa0: 20 20 20 20 7b 61 74 20 74 68 65 20 62 65 67 69      {at the begi
3ab0: 6e 6e 69 6e 67 20 6f 66 20 69 74 73 20 62 72 61  nning of its bra
3ac0: 6e 63 68 20 61 6e 64 20 69 74 73 20 70 61 72 65  nch and its pare
3ad0: 6e 74 20 64 69 73 61 67 72 65 65 20 61 62 6f 75  nt disagree abou
3ae0: 74 20 74 68 65 20 6f 77 6e 69 6e 67 20 66 69 6c  t the owning fil
3af0: 65 7d 20 7b 0a 09 09 53 45 4c 45 43 54 20 46 2e  e} {...SELECT F.
3b00: 6e 61 6d 65 2c 20 52 2e 72 65 76 0a 09 09 46 52  name, R.rev...FR
3b10: 4f 4d 20 72 65 76 69 73 69 6f 6e 20 52 2c 20 72  OM revision R, r
3b20: 65 76 69 73 69 6f 6e 20 50 2c 20 66 69 6c 65 20  evision P, file 
3b30: 46 0a 09 09 57 48 45 52 45 20 52 2e 66 69 64 20  F...WHERE R.fid 
3b40: 3d 20 46 2e 66 69 64 0a 09 09 41 4e 44 20 20 20  = F.fid...AND   
3b50: 52 2e 62 70 61 72 65 6e 74 20 49 53 20 4e 4f 54  R.bparent IS NOT
3b60: 20 4e 55 4c 4c 0a 09 09 41 4e 44 20 20 20 52 2e   NULL...AND   R.
3b70: 70 61 72 65 6e 74 20 3d 20 50 2e 72 69 64 0a 09  parent = P.rid..
3b80: 09 41 4e 44 20 20 20 52 2e 66 69 64 20 21 3d 20  .AND   R.fid != 
3b90: 50 2e 66 69 64 0a 09 09 3b 0a 09 20 20 20 20 7d  P.fid...;..    }
3ba0: 0a 09 23 20 46 69 6e 64 20 61 6c 6c 20 72 65 76  ..# Find all rev
3bb0: 69 73 69 6f 6e 73 20 77 69 74 68 20 61 20 6e 6f  isions with a no
3bc0: 6e 2d 4e 54 44 42 20 63 68 69 6c 64 20 77 68 69  n-NTDB child whi
3bd0: 63 68 20 64 69 73 61 67 72 65 65 73 0a 09 23 20  ch disagrees..# 
3be0: 61 62 6f 75 74 20 74 68 65 20 66 69 6c 65 20 74  about the file t
3bf0: 68 65 79 20 62 65 6c 6f 6e 67 20 74 6f 2e 0a 09  hey belong to...
3c00: 43 68 65 63 6b 20 5c 0a 09 20 20 20 20 7b 52 65  Check \..    {Re
3c10: 76 69 73 69 6f 6e 73 20 61 6e 64 20 74 68 65 69  visions and thei
3c20: 72 20 6e 6f 6e 2d 4e 54 44 42 20 63 68 69 6c 64  r non-NTDB child
3c30: 72 65 6e 20 68 61 76 65 20 74 6f 20 62 65 20 69  ren have to be i
3c40: 6e 20 74 68 65 20 73 61 6d 65 20 66 69 6c 65 7d  n the same file}
3c50: 20 5c 0a 09 20 20 20 20 7b 64 69 73 61 67 72 65   \..    {disagre
3c60: 65 73 20 77 69 74 68 20 69 74 73 20 6e 6f 6e 2d  es with its non-
3c70: 4e 54 44 42 20 63 68 69 6c 64 20 61 62 6f 75 74  NTDB child about
3c80: 20 74 68 65 20 6f 77 6e 69 6e 67 20 66 69 6c 65   the owning file
3c90: 7d 20 7b 0a 09 09 53 45 4c 45 43 54 20 46 2e 6e  } {...SELECT F.n
3ca0: 61 6d 65 2c 20 52 2e 72 65 76 0a 09 09 46 52 4f  ame, R.rev...FRO
3cb0: 4d 20 72 65 76 69 73 69 6f 6e 20 52 2c 20 72 65  M revision R, re
3cc0: 76 69 73 69 6f 6e 20 43 2c 20 66 69 6c 65 20 46  vision C, file F
3cd0: 0a 09 09 57 48 45 52 45 20 52 2e 66 69 64 20 3d  ...WHERE R.fid =
3ce0: 20 46 2e 66 69 64 0a 09 09 41 4e 44 20 20 20 52   F.fid...AND   R
3cf0: 2e 64 62 63 68 69 6c 64 20 49 53 20 4e 4f 54 20  .dbchild IS NOT 
3d00: 4e 55 4c 4c 0a 09 09 41 4e 44 20 20 20 52 2e 64  NULL...AND   R.d
3d10: 62 63 68 69 6c 64 20 3d 20 43 2e 72 69 64 0a 09  bchild = C.rid..
3d20: 09 41 4e 44 20 20 20 43 2e 66 69 64 20 21 3d 20  .AND   C.fid != 
3d30: 52 2e 66 69 64 0a 09 09 3b 0a 09 20 20 20 20 7d  R.fid...;..    }
3d40: 0a 09 23 20 46 69 6e 64 20 61 6c 6c 20 72 65 76  ..# Find all rev
3d50: 69 73 69 6f 6e 73 20 77 68 69 63 68 20 68 61 76  isions which hav
3d60: 65 20 61 20 70 72 69 6d 61 72 79 20 63 68 69 6c  e a primary chil
3d70: 64 2c 20 62 75 74 20 74 68 65 20 63 68 69 6c 64  d, but the child
3d80: 0a 09 23 20 64 6f 65 73 20 6e 6f 74 20 68 61 76  ..# does not hav
3d90: 65 20 74 68 65 6d 20 61 73 20 70 61 72 65 6e 74  e them as parent
3da0: 2e 0a 09 43 68 65 63 6b 20 5c 0a 09 20 20 20 20  ...Check \..    
3db0: 7b 52 65 76 69 73 69 6f 6e 73 20 68 61 76 65 20  {Revisions have 
3dc0: 74 6f 20 62 65 20 70 61 72 65 6e 74 73 20 6f 66  to be parents of
3dd0: 20 74 68 65 69 72 20 70 72 69 6d 61 72 79 20 63   their primary c
3de0: 68 69 6c 64 72 65 6e 7d 20 5c 0a 09 20 20 20 20  hildren} \..    
3df0: 7b 69 73 20 6e 6f 74 20 74 68 65 20 70 61 72 65  {is not the pare
3e00: 6e 74 20 6f 66 20 69 74 73 20 70 72 69 6d 61 72  nt of its primar
3e10: 79 20 63 68 69 6c 64 7d 20 7b 0a 09 09 53 45 4c  y child} {...SEL
3e20: 45 43 54 20 46 2e 6e 61 6d 65 2c 20 52 2e 72 65  ECT F.name, R.re
3e30: 76 0a 09 09 46 52 4f 4d 20 72 65 76 69 73 69 6f  v...FROM revisio
3e40: 6e 20 52 2c 20 72 65 76 69 73 69 6f 6e 20 43 2c  n R, revision C,
3e50: 20 66 69 6c 65 20 46 0a 09 09 57 48 45 52 45 20   file F...WHERE 
3e60: 52 2e 66 69 64 20 3d 20 46 2e 66 69 64 0a 09 09  R.fid = F.fid...
3e70: 41 4e 44 20 20 20 52 2e 63 68 69 6c 64 20 49 53  AND   R.child IS
3e80: 20 4e 4f 54 20 4e 55 4c 4c 0a 09 09 41 4e 44 20   NOT NULL...AND 
3e90: 20 20 52 2e 63 68 69 6c 64 20 3d 20 43 2e 72 69    R.child = C.ri
3ea0: 64 0a 09 09 41 4e 44 20 20 20 43 2e 70 61 72 65  d...AND   C.pare
3eb0: 6e 74 20 21 3d 20 52 2e 72 69 64 0a 09 09 3b 0a  nt != R.rid...;.
3ec0: 09 20 20 20 20 7d 0a 09 23 20 46 69 6e 64 20 61  .    }..# Find a
3ed0: 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 77 68 69  ll revisions whi
3ee0: 63 68 20 68 61 76 65 20 61 20 70 72 69 6d 72 61  ch have a primra
3ef0: 72 79 20 63 68 69 6c 64 2c 20 62 75 74 20 74 68  ry child, but th
3f00: 65 0a 09 23 20 63 68 69 6c 64 20 68 61 73 20 61  e..# child has a
3f10: 20 62 72 61 6e 63 68 20 70 61 72 65 6e 74 20 73   branch parent s
3f20: 79 6d 62 6f 6c 20 6d 61 6b 69 6e 67 20 74 68 65  ymbol making the
3f30: 6d 20 62 72 61 63 68 20 73 74 61 72 74 65 72 73  m brach starters
3f40: 2e 0a 09 43 68 65 63 6b 20 5c 0a 09 20 20 20 20  ...Check \..    
3f50: 7b 50 72 69 6d 61 72 79 20 63 68 69 6c 64 72 65  {Primary childre
3f60: 6e 20 6f 66 20 72 65 76 69 73 69 6f 6e 73 20 6d  n of revisions m
3f70: 75 73 74 20 6e 6f 74 20 73 74 61 72 74 20 62 72  ust not start br
3f80: 61 6e 63 68 65 73 7d 20 5c 0a 09 20 20 20 20 7b  anches} \..    {
3f90: 69 73 20 70 61 72 65 6e 74 20 6f 66 20 61 20 70  is parent of a p
3fa0: 72 69 6d 61 72 79 20 63 68 69 6c 64 20 77 68 69  rimary child whi
3fb0: 63 68 20 69 73 20 74 68 65 20 62 65 67 69 6e 6e  ch is the beginn
3fc0: 69 6e 67 20 6f 66 20 61 20 62 72 61 6e 63 68 7d  ing of a branch}
3fd0: 20 7b 0a 09 09 53 45 4c 45 43 54 20 46 2e 6e 61   {...SELECT F.na
3fe0: 6d 65 2c 20 52 2e 72 65 76 0a 09 09 46 52 4f 4d  me, R.rev...FROM
3ff0: 20 72 65 76 69 73 69 6f 6e 20 52 2c 20 72 65 76   revision R, rev
4000: 69 73 69 6f 6e 20 43 2c 20 66 69 6c 65 20 46 0a  ision C, file F.
4010: 09 09 57 48 45 52 45 20 52 2e 66 69 64 20 3d 20  ..WHERE R.fid = 
4020: 46 2e 66 69 64 0a 09 09 41 4e 44 20 20 20 52 2e  F.fid...AND   R.
4030: 63 68 69 6c 64 20 49 53 20 4e 4f 54 20 4e 55 4c  child IS NOT NUL
4040: 4c 0a 09 09 41 4e 44 20 20 20 52 2e 63 68 69 6c  L...AND   R.chil
4050: 64 20 3d 20 43 2e 72 69 64 0a 09 09 41 4e 44 20  d = C.rid...AND 
4060: 20 20 43 2e 62 70 61 72 65 6e 74 20 49 53 20 4e    C.bparent IS N
4070: 4f 54 20 4e 55 4c 4c 0a 09 09 3b 0a 09 20 20 20  OT NULL...;..   
4080: 20 7d 0a 09 23 20 46 69 6e 64 20 61 6c 6c 20 72   }..# Find all r
4090: 65 76 69 73 69 6f 6e 73 20 77 69 74 68 6f 75 74  evisions without
40a0: 20 62 72 61 6e 63 68 20 70 61 72 65 6e 74 20 73   branch parent s
40b0: 79 6d 62 6f 6c 20 77 68 69 63 68 20 68 61 76 65  ymbol which have
40c0: 20 61 0a 09 23 20 70 61 72 65 6e 74 2c 20 62 75   a..# parent, bu
40d0: 74 20 74 68 65 20 70 61 72 65 6e 74 20 64 6f 65  t the parent doe
40e0: 73 20 6e 6f 74 20 68 61 76 65 20 74 68 65 6d 20  s not have them 
40f0: 61 73 20 70 72 69 6d 61 72 79 20 63 68 69 6c 64  as primary child
4100: 2e 0a 09 43 68 65 63 6b 20 5c 0a 09 20 20 20 20  ...Check \..    
4110: 7b 52 65 76 69 73 69 6f 6e 73 20 68 61 76 65 20  {Revisions have 
4120: 74 6f 20 62 65 20 70 72 69 6d 61 72 79 20 63 68  to be primary ch
4130: 69 6c 64 72 65 6e 20 6f 66 20 74 68 65 69 72 20  ildren of their 
4140: 70 61 72 65 6e 74 73 2c 20 69 66 20 61 6e 79 7d  parents, if any}
4150: 20 5c 0a 09 20 20 20 20 7b 69 73 20 6e 6f 74 20   \..    {is not 
4160: 74 68 65 20 63 68 69 6c 64 20 6f 66 20 69 74 73  the child of its
4170: 20 70 61 72 65 6e 74 7d 20 7b 0a 09 09 53 45 4c   parent} {...SEL
4180: 45 43 54 20 46 2e 6e 61 6d 65 2c 20 52 2e 72 65  ECT F.name, R.re
4190: 76 0a 09 09 46 52 4f 4d 20 72 65 76 69 73 69 6f  v...FROM revisio
41a0: 6e 20 52 2c 20 72 65 76 69 73 69 6f 6e 20 50 2c  n R, revision P,
41b0: 20 66 69 6c 65 20 46 0a 09 09 57 48 45 52 45 20   file F...WHERE 
41c0: 52 2e 66 69 64 20 3d 20 46 2e 66 69 64 0a 09 09  R.fid = F.fid...
41d0: 41 4e 44 20 20 20 52 2e 62 70 61 72 65 6e 74 20  AND   R.bparent 
41e0: 49 53 20 4e 55 4c 4c 0a 09 09 41 4e 44 20 20 20  IS NULL...AND   
41f0: 52 2e 70 61 72 65 6e 74 20 49 53 20 4e 4f 54 20  R.parent IS NOT 
4200: 4e 55 4c 4c 0a 09 09 41 4e 44 20 20 20 52 2e 70  NULL...AND   R.p
4210: 61 72 65 6e 74 20 3d 20 50 2e 72 69 64 0a 09 09  arent = P.rid...
4220: 41 4e 44 20 20 20 50 2e 63 68 69 6c 64 20 21 3d  AND   P.child !=
4230: 20 52 2e 72 69 64 0a 09 09 3b 0a 09 20 20 20 20   R.rid...;..    
4240: 7d 0a 09 23 20 46 69 6e 64 20 61 6c 6c 20 72 65  }..# Find all re
4250: 76 69 73 69 6f 6e 73 20 77 69 74 68 20 61 20 62  visions with a b
4260: 72 61 6e 63 68 20 70 61 72 65 6e 74 20 73 79 6d  ranch parent sym
4270: 62 6f 6c 20 77 68 69 63 68 20 64 6f 20 6e 6f 74  bol which do not
4280: 0a 09 23 20 68 61 76 65 20 61 20 70 61 72 65 6e  ..# have a paren
4290: 74 2e 0a 09 43 68 65 63 6b 20 5c 0a 09 20 20 20  t...Check \..   
42a0: 20 7b 42 72 61 6e 63 68 20 73 74 61 72 74 69 6e   {Branch startin
42b0: 67 20 72 65 76 69 73 69 6f 6e 73 20 68 61 76 65  g revisions have
42c0: 20 74 6f 20 68 61 76 65 20 61 20 70 61 72 65 6e   to have a paren
42d0: 74 7d 20 5c 0a 09 20 20 20 20 7b 61 74 20 74 68  t} \..    {at th
42e0: 65 20 62 65 67 69 6e 6e 69 6e 67 20 6f 66 20 69  e beginning of i
42f0: 74 73 20 62 72 61 6e 63 68 20 68 61 73 20 6e 6f  ts branch has no
4300: 20 70 61 72 65 6e 74 7d 20 7b 0a 09 09 53 45 4c   parent} {...SEL
4310: 45 43 54 20 46 2e 6e 61 6d 65 2c 20 52 2e 72 65  ECT F.name, R.re
4320: 76 0a 09 09 46 52 4f 4d 20 72 65 76 69 73 69 6f  v...FROM revisio
4330: 6e 20 52 2c 20 66 69 6c 65 20 46 0a 09 09 57 48  n R, file F...WH
4340: 45 52 45 20 52 2e 66 69 64 20 3d 20 46 2e 66 69  ERE R.fid = F.fi
4350: 64 0a 09 09 41 4e 44 20 20 20 52 2e 62 70 61 72  d...AND   R.bpar
4360: 65 6e 74 20 49 53 20 4e 4f 54 20 4e 55 4c 4c 0a  ent IS NOT NULL.
4370: 09 09 41 4e 44 20 20 20 52 2e 70 61 72 65 6e 74  ..AND   R.parent
4380: 20 49 53 20 4e 55 4c 4c 0a 09 09 3b 0a 09 20 20   IS NULL...;..  
4390: 20 20 7d 0a 09 23 20 46 69 6e 64 20 61 6c 6c 20    }..# Find all 
43a0: 72 65 76 69 73 69 6f 6e 73 20 77 69 74 68 20 61  revisions with a
43b0: 20 62 72 61 6e 63 68 20 70 61 72 65 6e 74 20 73   branch parent s
43c0: 79 6d 62 6f 6c 20 77 68 6f 73 65 20 70 61 72 65  ymbol whose pare
43d0: 6e 74 0a 09 23 20 68 61 73 20 74 68 65 6d 20 61  nt..# has them a
43e0: 73 20 70 72 69 6d 61 72 79 20 63 68 69 6c 64 2e  s primary child.
43f0: 0a 09 43 68 65 63 6b 20 5c 0a 09 20 20 20 20 7b  ..Check \..    {
4400: 42 72 61 6e 63 68 20 73 74 61 72 74 69 6e 67 20  Branch starting 
4410: 72 65 76 69 73 69 6f 6e 73 20 6d 75 73 74 20 6e  revisions must n
4420: 6f 74 20 62 65 20 70 72 69 6d 61 72 79 20 63 68  ot be primary ch
4430: 69 6c 64 72 65 6e 20 6f 66 20 74 68 65 69 72 20  ildren of their 
4440: 70 61 72 65 6e 74 73 7d 20 5c 0a 09 20 20 20 20  parents} \..    
4450: 7b 61 74 20 74 68 65 20 62 65 67 69 6e 6e 69 6e  {at the beginnin
4460: 67 20 6f 66 20 69 74 73 20 62 72 61 6e 63 68 20  g of its branch 
4470: 69 73 20 74 68 65 20 70 72 69 6d 61 72 79 20 63  is the primary c
4480: 68 69 6c 64 20 6f 66 20 69 74 73 20 70 61 72 65  hild of its pare
4490: 6e 74 7d 20 7b 0a 09 09 53 45 4c 45 43 54 20 46  nt} {...SELECT F
44a0: 2e 6e 61 6d 65 2c 20 52 2e 72 65 76 0a 09 09 46  .name, R.rev...F
44b0: 52 4f 4d 20 72 65 76 69 73 69 6f 6e 20 52 2c 20  ROM revision R, 
44c0: 72 65 76 69 73 69 6f 6e 20 50 2c 20 66 69 6c 65  revision P, file
44d0: 20 46 0a 09 09 57 48 45 52 45 20 52 2e 66 69 64   F...WHERE R.fid
44e0: 20 3d 20 46 2e 66 69 64 0a 09 09 41 4e 44 20 20   = F.fid...AND  
44f0: 20 52 2e 62 70 61 72 65 6e 74 20 49 53 20 4e 4f   R.bparent IS NO
4500: 54 20 4e 55 4c 4c 0a 09 09 41 4e 44 20 20 20 52  T NULL...AND   R
4510: 2e 70 61 72 65 6e 74 20 49 53 20 4e 4f 54 20 4e  .parent IS NOT N
4520: 55 4c 4c 0a 09 09 41 4e 44 20 20 20 52 2e 70 61  ULL...AND   R.pa
4530: 72 65 6e 74 20 3d 20 50 2e 72 69 64 0a 09 09 41  rent = P.rid...A
4540: 4e 44 20 20 20 50 2e 63 68 69 6c 64 20 3d 20 52  ND   P.child = R
4550: 2e 72 69 64 0a 09 09 3b 0a 09 20 20 20 20 7d 0a  .rid...;..    }.
4560: 09 23 20 46 69 6e 64 20 61 6c 6c 20 72 65 76 69  .# Find all revi
4570: 73 69 6f 6e 73 20 77 69 74 68 20 61 20 6e 6f 6e  sions with a non
4580: 2d 4e 54 44 42 20 63 68 69 6c 64 20 77 68 69 63  -NTDB child whic
4590: 68 20 61 72 65 20 6e 6f 74 20 6f 6e 0a 09 23 20  h are not on..# 
45a0: 74 68 65 20 4e 54 44 42 2e 0a 09 43 68 65 63 6b  the NTDB...Check
45b0: 20 5c 0a 09 20 20 20 20 7b 4e 54 44 42 20 74 6f   \..    {NTDB to
45c0: 20 74 72 75 6e 6b 20 74 72 61 6e 73 69 74 69 6f   trunk transitio
45d0: 6e 20 68 61 73 20 74 6f 20 62 65 67 69 6e 20 6f  n has to begin o
45e0: 6e 20 4e 54 44 42 7d 20 5c 0a 09 20 20 20 20 7b  n NTDB} \..    {
45f0: 68 61 73 20 61 20 6e 6f 6e 2d 4e 54 44 42 20 63  has a non-NTDB c
4600: 68 69 6c 64 2c 20 79 65 74 20 69 73 20 6e 6f 74  hild, yet is not
4610: 20 6f 6e 20 74 68 65 20 4e 54 44 42 7d 20 7b 0a   on the NTDB} {.
4620: 09 09 53 45 4c 45 43 54 20 46 2e 6e 61 6d 65 2c  ..SELECT F.name,
4630: 20 52 2e 72 65 76 0a 09 09 46 52 4f 4d 20 72 65   R.rev...FROM re
4640: 76 69 73 69 6f 6e 20 52 2c 20 66 69 6c 65 20 46  vision R, file F
4650: 0a 09 09 57 48 45 52 45 20 52 2e 66 69 64 20 3d  ...WHERE R.fid =
4660: 20 46 2e 66 69 64 0a 09 09 41 4e 44 20 20 20 52   F.fid...AND   R
4670: 2e 64 62 63 68 69 6c 64 20 49 53 20 4e 4f 54 20  .dbchild IS NOT 
4680: 4e 55 4c 4c 0a 09 09 41 4e 44 20 20 20 4e 4f 54  NULL...AND   NOT
4690: 20 52 2e 69 73 64 65 66 61 75 6c 74 0a 09 09 3b   R.isdefault...;
46a0: 0a 09 20 20 20 20 7d 0a 09 23 20 46 69 6e 64 20  ..    }..# Find 
46b0: 61 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 77 69  all revisions wi
46c0: 74 68 20 61 20 4e 54 44 42 20 70 61 72 65 6e 74  th a NTDB parent
46d0: 20 77 68 69 63 68 20 61 72 65 20 6f 6e 20 74 68   which are on th
46e0: 65 20 4e 54 44 42 2e 0a 09 43 68 65 63 6b 20 5c  e NTDB...Check \
46f0: 0a 09 20 20 20 20 7b 4e 54 44 42 20 74 6f 20 74  ..    {NTDB to t
4700: 72 75 6e 6b 20 74 72 61 6e 73 69 74 69 6f 6e 20  runk transition 
4710: 68 61 73 20 74 6f 20 65 6e 64 20 6f 6e 20 6e 6f  has to end on no
4720: 6e 2d 4e 54 44 42 7d 20 5c 0a 09 20 20 20 20 7b  n-NTDB} \..    {
4730: 68 61 73 20 61 20 4e 54 44 42 20 70 61 72 65 6e  has a NTDB paren
4740: 74 2c 20 79 65 74 20 69 73 20 6f 6e 20 74 68 65  t, yet is on the
4750: 20 4e 54 44 42 7d 20 7b 0a 09 09 53 45 4c 45 43   NTDB} {...SELEC
4760: 54 20 46 2e 6e 61 6d 65 2c 20 52 2e 72 65 76 0a  T F.name, R.rev.
4770: 09 09 46 52 4f 4d 20 72 65 76 69 73 69 6f 6e 20  ..FROM revision 
4780: 52 2c 20 66 69 6c 65 20 46 0a 09 09 57 48 45 52  R, file F...WHER
4790: 45 20 52 2e 66 69 64 20 3d 20 46 2e 66 69 64 0a  E R.fid = F.fid.
47a0: 09 09 41 4e 44 20 20 20 52 2e 64 62 70 61 72 65  ..AND   R.dbpare
47b0: 6e 74 20 49 53 20 4e 4f 54 20 4e 55 4c 4c 0a 09  nt IS NOT NULL..
47c0: 09 41 4e 44 20 20 20 52 2e 69 73 64 65 66 61 75  .AND   R.isdefau
47d0: 6c 74 0a 09 09 3b 0a 09 20 20 20 20 7d 0a 09 23  lt...;..    }..#
47e0: 20 46 69 6e 64 20 61 6c 6c 20 72 65 76 69 73 69   Find all revisi
47f0: 6f 6e 73 20 77 69 74 68 20 61 20 63 68 69 6c 64  ons with a child
4800: 20 77 68 69 63 68 20 64 69 73 61 67 72 65 65 73   which disagrees
4810: 20 61 62 6f 75 74 20 74 68 65 0a 09 23 20 6c 69   about the..# li
4820: 6e 65 20 6f 66 20 64 65 76 65 6c 6f 70 6d 65 6e  ne of developmen
4830: 74 20 74 68 65 79 20 62 65 6c 6f 6e 67 20 74 6f  t they belong to
4840: 2e 0a 09 43 68 65 63 6b 20 5c 0a 09 20 20 20 20  ...Check \..    
4850: 7b 52 65 76 69 73 69 6f 6e 73 20 61 6e 64 20 74  {Revisions and t
4860: 68 65 69 72 20 70 72 69 6d 61 72 79 20 63 68 69  heir primary chi
4870: 6c 64 72 65 6e 20 68 61 76 65 20 74 6f 20 62 65  ldren have to be
4880: 20 69 6e 20 74 68 65 20 73 61 6d 65 20 4c 4f 44   in the same LOD
4890: 7d 20 5c 0a 09 20 20 20 20 7b 61 6e 64 20 69 74  } \..    {and it
48a0: 73 20 70 72 69 6d 61 72 79 20 63 68 69 6c 64 20  s primary child 
48b0: 64 69 73 61 67 72 65 65 20 61 62 6f 75 74 20 74  disagree about t
48c0: 68 65 69 72 20 4c 4f 44 7d 20 7b 0a 09 09 53 45  heir LOD} {...SE
48d0: 4c 45 43 54 20 46 2e 6e 61 6d 65 2c 20 52 2e 72  LECT F.name, R.r
48e0: 65 76 0a 09 09 46 52 4f 4d 20 72 65 76 69 73 69  ev...FROM revisi
48f0: 6f 6e 20 52 2c 20 72 65 76 69 73 69 6f 6e 20 43  on R, revision C
4900: 2c 20 66 69 6c 65 20 46 0a 09 09 57 48 45 52 45  , file F...WHERE
4910: 20 52 2e 66 69 64 20 3d 20 46 2e 66 69 64 0a 09   R.fid = F.fid..
4920: 09 41 4e 44 20 20 20 52 2e 63 68 69 6c 64 20 49  .AND   R.child I
4930: 53 20 4e 4f 54 20 4e 55 4c 4c 0a 09 09 41 4e 44  S NOT NULL...AND
4940: 20 20 20 52 2e 63 68 69 6c 64 20 3d 20 43 2e 72     R.child = C.r
4950: 69 64 0a 09 09 41 4e 44 20 20 20 43 2e 6c 6f 64  id...AND   C.lod
4960: 20 21 3d 20 52 2e 6c 6f 64 0a 09 09 3b 0a 09 20   != R.lod...;.. 
4970: 20 20 20 7d 0a 09 23 20 46 69 6e 64 20 61 6c 6c     }..# Find all
4980: 20 72 65 76 69 73 69 6f 6e 73 20 77 69 74 68 20   revisions with 
4990: 61 20 6e 6f 6e 2d 4e 54 44 42 20 63 68 69 6c 64  a non-NTDB child
49a0: 20 77 68 69 63 68 20 61 67 72 65 65 73 20 61 62   which agrees ab
49b0: 6f 75 74 0a 09 23 20 74 68 65 20 6c 69 6e 65 20  out..# the line 
49c0: 6f 66 20 64 65 76 65 6c 6f 70 6d 65 6e 74 20 74  of development t
49d0: 68 65 79 20 62 65 6c 6f 6e 67 20 74 6f 2e 0a 09  hey belong to...
49e0: 43 68 65 63 6b 20 5c 0a 09 20 20 20 20 7b 4e 54  Check \..    {NT
49f0: 44 42 20 61 6e 64 20 74 72 75 6e 6b 20 72 65 76  DB and trunk rev
4a00: 69 73 69 6f 6e 73 20 68 61 76 65 20 74 6f 20 62  isions have to b
4a10: 65 20 69 6e 20 64 69 66 66 65 72 65 6e 74 20 4c  e in different L
4a20: 4f 44 73 7d 20 5c 0a 09 20 20 20 20 7b 6f 6e 20  ODs} \..    {on 
4a30: 4e 54 44 42 20 61 6e 64 20 69 74 73 20 6e 6f 6e  NTDB and its non
4a40: 2d 4e 54 44 42 20 63 68 69 6c 64 20 77 72 6f 6e  -NTDB child wron
4a50: 67 6c 79 20 61 67 72 65 65 20 61 62 6f 75 74 20  gly agree about 
4a60: 74 68 65 69 72 20 4c 4f 44 7d 20 7b 0a 09 09 53  their LOD} {...S
4a70: 45 4c 45 43 54 20 46 2e 6e 61 6d 65 2c 20 52 2e  ELECT F.name, R.
4a80: 72 65 76 0a 09 09 46 52 4f 4d 20 72 65 76 69 73  rev...FROM revis
4a90: 69 6f 6e 20 52 2c 20 72 65 76 69 73 69 6f 6e 20  ion R, revision 
4aa0: 43 2c 20 66 69 6c 65 20 46 0a 09 09 57 48 45 52  C, file F...WHER
4ab0: 45 20 52 2e 66 69 64 20 3d 20 46 2e 66 69 64 0a  E R.fid = F.fid.
4ac0: 09 09 41 4e 44 20 20 20 52 2e 64 62 63 68 69 6c  ..AND   R.dbchil
4ad0: 64 20 49 53 20 4e 4f 54 20 4e 55 4c 4c 0a 09 09  d IS NOT NULL...
4ae0: 41 4e 44 20 20 20 52 2e 64 62 63 68 69 6c 64 20  AND   R.dbchild 
4af0: 3d 20 43 2e 72 69 64 0a 09 09 41 4e 44 20 20 20  = C.rid...AND   
4b00: 43 2e 6c 6f 64 20 3d 20 52 2e 6c 6f 64 0a 09 09  C.lod = R.lod...
4b10: 3b 0a 09 20 20 20 20 7d 0a 09 23 20 46 69 6e 64  ;..    }..# Find
4b20: 20 61 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 77   all revisions w
4b30: 69 74 68 20 61 20 62 72 61 6e 63 68 20 70 61 72  ith a branch par
4b40: 65 6e 74 20 73 79 6d 62 6f 6c 20 77 68 69 63 68  ent symbol which
4b50: 20 69 73 20 6e 6f 74 0a 09 23 20 74 68 65 69 72   is not..# their
4b60: 20 4c 4f 44 2e 0a 09 43 68 65 63 6b 20 5c 0a 09   LOD...Check \..
4b70: 20 20 20 20 7b 42 72 61 6e 63 68 20 73 74 61 72      {Branch star
4b80: 74 69 6e 67 20 72 65 76 69 73 69 6f 6e 73 20 68  ting revisions h
4b90: 61 76 65 20 74 6f 20 68 61 76 65 20 74 68 65 69  ave to have thei
4ba0: 72 20 4c 4f 44 20 61 73 20 62 72 61 6e 63 68 20  r LOD as branch 
4bb0: 70 61 72 65 6e 74 20 73 79 6d 62 6f 6c 7d 20 5c  parent symbol} \
4bc0: 0a 09 20 20 20 20 7b 61 74 20 74 68 65 20 62 65  ..    {at the be
4bd0: 67 69 6e 6e 69 6e 67 20 6f 66 20 69 74 73 20 62  ginning of its b
4be0: 72 61 6e 63 68 20 64 6f 65 73 20 6e 6f 74 20 68  ranch does not h
4bf0: 61 76 65 20 74 68 65 20 62 72 61 6e 63 68 20 73  ave the branch s
4c00: 79 6d 62 6f 6c 20 61 73 20 69 74 73 20 4c 4f 44  ymbol as its LOD
4c10: 7d 20 7b 0a 09 09 53 45 4c 45 43 54 20 46 2e 6e  } {...SELECT F.n
4c20: 61 6d 65 2c 20 52 2e 72 65 76 0a 09 09 46 52 4f  ame, R.rev...FRO
4c30: 4d 20 72 65 76 69 73 69 6f 6e 20 52 2c 20 66 69  M revision R, fi
4c40: 6c 65 20 46 0a 09 09 57 48 45 52 45 20 52 2e 66  le F...WHERE R.f
4c50: 69 64 20 3d 20 46 2e 66 69 64 0a 09 09 41 4e 44  id = F.fid...AND
4c60: 20 20 20 52 2e 62 70 61 72 65 6e 74 20 49 53 20     R.bparent IS 
4c70: 4e 4f 54 20 4e 55 4c 4c 0a 09 09 41 4e 44 20 20  NOT NULL...AND  
4c80: 20 52 2e 6c 6f 64 20 21 3d 20 52 2e 62 70 61 72   R.lod != R.bpar
4c90: 65 6e 74 0a 09 09 3b 0a 09 20 20 20 20 7d 0a 09  ent...;..    }..
4ca0: 23 20 46 69 6e 64 20 61 6c 6c 20 72 65 76 69 73  # Find all revis
4cb0: 69 6f 6e 73 20 77 69 74 68 20 61 20 62 72 61 6e  ions with a bran
4cc0: 63 68 20 70 61 72 65 6e 74 20 73 79 6d 62 6f 6c  ch parent symbol
4cd0: 20 77 68 6f 73 65 20 70 61 72 65 6e 74 0a 09 23   whose parent..#
4ce0: 20 69 73 20 69 6e 20 74 68 65 20 73 61 6d 65 20   is in the same 
4cf0: 6c 69 6e 65 20 6f 66 20 64 65 76 65 6c 6f 70 6d  line of developm
4d00: 65 6e 74 2e 0a 09 43 68 65 63 6b 20 5c 0a 09 20  ent...Check \.. 
4d10: 20 20 20 7b 52 65 76 69 73 69 6f 6e 73 20 61 6e     {Revisions an
4d20: 64 20 74 68 65 69 72 20 62 72 61 6e 63 68 20 63  d their branch c
4d30: 68 69 6c 64 72 65 6e 20 68 61 76 65 20 74 6f 20  hildren have to 
4d40: 62 65 20 69 6e 20 64 69 66 66 65 72 65 6e 74 20  be in different 
4d50: 4c 4f 44 73 7d 20 5c 0a 09 20 20 20 20 7b 61 74  LODs} \..    {at
4d60: 20 74 68 65 20 62 65 67 69 6e 6e 69 6e 67 20 6f   the beginning o
4d70: 66 20 69 74 73 20 62 72 61 6e 63 68 20 61 6e 64  f its branch and
4d80: 20 69 74 73 20 70 61 72 65 6e 74 20 77 72 6f 6e   its parent wron
4d90: 67 6c 79 20 61 67 72 65 65 20 61 62 6f 75 74 20  gly agree about 
4da0: 74 68 65 69 72 20 4c 4f 44 7d 20 7b 0a 09 09 53  their LOD} {...S
4db0: 45 4c 45 43 54 20 46 2e 6e 61 6d 65 2c 20 52 2e  ELECT F.name, R.
4dc0: 72 65 76 0a 09 09 46 52 4f 4d 20 72 65 76 69 73  rev...FROM revis
4dd0: 69 6f 6e 20 52 2c 20 72 65 76 69 73 69 6f 6e 20  ion R, revision 
4de0: 50 2c 20 66 69 6c 65 20 46 0a 09 09 57 48 45 52  P, file F...WHER
4df0: 45 20 52 2e 66 69 64 20 3d 20 46 2e 66 69 64 0a  E R.fid = F.fid.
4e00: 09 09 41 4e 44 20 20 20 52 2e 62 70 61 72 65 6e  ..AND   R.bparen
4e10: 74 20 49 53 20 4e 4f 54 20 4e 55 4c 4c 0a 09 09  t IS NOT NULL...
4e20: 41 4e 44 20 20 20 52 2e 70 61 72 65 6e 74 20 3d  AND   R.parent =
4e30: 20 50 2e 72 69 64 0a 09 09 41 4e 44 20 20 20 52   P.rid...AND   R
4e40: 2e 6c 6f 64 20 3d 20 50 2e 6c 6f 64 0a 09 09 3b  .lod = P.lod...;
4e50: 0a 09 20 20 20 20 7d 0a 09 72 65 74 75 72 6e 0a  ..    }..return.
4e60: 20 20 20 20 7d 0a 0a 20 20 20 20 70 72 6f 63 20      }..    proc 
4e70: 43 68 65 63 6b 20 7b 68 65 61 64 65 72 20 6c 61  Check {header la
4e80: 62 65 6c 20 73 71 6c 7d 20 7b 0a 09 75 70 76 61  bel sql} {..upva
4e90: 72 20 31 20 6e 20 6e 0a 09 73 65 74 20 6f 6b 20  r 1 n n..set ok 
4ea0: 31 0a 09 66 6f 72 65 61 63 68 20 7b 66 6e 61 6d  1..foreach {fnam
4eb0: 65 20 72 65 76 6e 72 7d 20 5b 73 74 61 74 65 20  e revnr} [state 
4ec0: 72 75 6e 20 24 73 71 6c 5d 20 7b 0a 09 20 20 20  run $sql] {..   
4ed0: 20 73 65 74 20 6f 6b 20 30 0a 09 20 20 20 20 74   set ok 0..    t
4ee0: 72 6f 75 62 6c 65 20 66 61 74 61 6c 20 22 24 66  rouble fatal "$f
4ef0: 6e 61 6d 65 20 3c 24 72 65 76 6e 72 3e 20 24 6c  name <$revnr> $l
4f00: 61 62 65 6c 22 0a 09 7d 0a 09 6c 6f 67 20 77 72  abel"..}..log wr
4f10: 69 74 65 20 35 20 63 6f 6c 6c 72 65 76 20 22 5c  ite 5 collrev "\
4f20: 5b 5b 66 6f 72 6d 61 74 20 25 30 32 64 20 5b 69  [[format %02d [i
4f30: 6e 63 72 20 6e 5d 5d 5c 5d 20 5b 65 78 70 72 20  ncr n]]\] [expr 
4f40: 7b 24 6f 6b 20 3f 20 22 4f 6b 20 20 20 20 22 20  {$ok ? "Ok    " 
4f50: 3a 20 22 46 61 69 6c 65 64 22 7d 5d 20 2e 2e 2e  : "Failed"}] ...
4f60: 20 24 68 65 61 64 65 72 22 0a 09 72 65 74 75 72   $header"..retur
4f70: 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 23 20 23  n.    }..    # #
4f80: 20 23 23 20 23 23 23 20 23 23 23 23 23 20 23 23   ## ### ##### ##
4f90: 23 23 23 23 23 23 20 23 23 23 23 23 23 23 23 23  ###### #########
4fa0: 23 23 23 23 0a 20 20 20 20 23 23 20 49 6e 74 65  ####.    ## Inte
4fb0: 72 6e 61 6c 20 6d 65 74 68 6f 64 73 0a 0a 20 20  rnal methods..  
4fc0: 20 20 23 20 23 20 23 23 20 23 23 23 20 23 23 23    # # ## ### ###
4fd0: 23 23 20 23 23 23 23 23 23 23 23 20 23 23 23 23  ## ######## ####
4fe0: 23 23 23 23 23 23 23 23 23 0a 20 20 20 20 23 23  #########.    ##
4ff0: 20 43 6f 6e 66 69 67 75 72 61 74 69 6f 6e 0a 0a   Configuration..
5000: 20 20 20 20 70 72 61 67 6d 61 20 2d 68 61 73 69      pragma -hasi
5010: 6e 73 74 61 6e 63 65 73 20 20 20 6e 6f 20 3b 20  nstances   no ; 
5020: 23 20 73 69 6e 67 6c 65 74 6f 6e 0a 20 20 20 20  # singleton.    
5030: 70 72 61 67 6d 61 20 2d 68 61 73 74 79 70 65 69  pragma -hastypei
5040: 6e 66 6f 20 20 20 20 6e 6f 20 3b 20 23 20 6e 6f  nfo    no ; # no
5050: 20 69 6e 74 72 6f 73 70 65 63 74 69 6f 6e 0a 20   introspection. 
5060: 20 20 20 70 72 61 67 6d 61 20 2d 68 61 73 74 79     pragma -hasty
5070: 70 65 64 65 73 74 72 6f 79 20 6e 6f 20 3b 20 23  pedestroy no ; #
5080: 20 69 6d 6d 6f 72 74 61 6c 0a 0a 20 20 20 20 23   immortal..    #
5090: 20 23 20 23 23 20 23 23 23 20 23 23 23 23 23 20   # ## ### ##### 
50a0: 23 23 23 23 23 23 23 23 20 23 23 23 23 23 23 23  ######## #######
50b0: 23 23 23 23 23 23 0a 7d 0a 0a 6e 61 6d 65 73 70  ######.}..namesp
50c0: 61 63 65 20 65 76 61 6c 20 3a 3a 76 63 3a 3a 66  ace eval ::vc::f
50d0: 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63  ossil::import::c
50e0: 76 73 3a 3a 70 61 73 73 20 7b 0a 20 20 20 20 6e  vs::pass {.    n
50f0: 61 6d 65 73 70 61 63 65 20 65 78 70 6f 72 74 20  amespace export 
5100: 63 6f 6c 6c 72 65 76 0a 20 20 20 20 6e 61 6d 65  collrev.    name
5110: 73 70 61 63 65 20 65 76 61 6c 20 63 6f 6c 6c 72  space eval collr
5120: 65 76 20 7b 0a 09 6e 61 6d 65 73 70 61 63 65 20  ev {..namespace 
5130: 69 6d 70 6f 72 74 20 3a 3a 76 63 3a 3a 72 63 73  import ::vc::rcs
5140: 3a 3a 70 61 72 73 65 72 0a 09 6e 61 6d 65 73 70  ::parser..namesp
5150: 61 63 65 20 69 6d 70 6f 72 74 20 3a 3a 76 63 3a  ace import ::vc:
5160: 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a  :fossil::import:
5170: 3a 63 76 73 3a 3a 72 65 70 6f 73 69 74 6f 72 79  :cvs::repository
5180: 0a 09 6e 61 6d 65 73 70 61 63 65 20 69 6d 70 6f  ..namespace impo
5190: 72 74 20 3a 3a 76 63 3a 3a 66 6f 73 73 69 6c 3a  rt ::vc::fossil:
51a0: 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 73 74  :import::cvs::st
51b0: 61 74 65 0a 09 6e 61 6d 65 73 70 61 63 65 20 69  ate..namespace i
51c0: 6d 70 6f 72 74 20 3a 3a 76 63 3a 3a 66 6f 73 73  mport ::vc::foss
51d0: 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a  il::import::cvs:
51e0: 3a 69 6e 74 65 67 72 69 74 79 0a 09 6e 61 6d 65  :integrity..name
51f0: 73 70 61 63 65 20 65 76 61 6c 20 70 72 6f 6a 65  space eval proje
5200: 63 74 20 7b 0a 09 20 20 20 20 6e 61 6d 65 73 70  ct {..    namesp
5210: 61 63 65 20 69 6d 70 6f 72 74 20 3a 3a 76 63 3a  ace import ::vc:
5220: 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a  :fossil::import:
5230: 3a 63 76 73 3a 3a 70 72 6f 6a 65 63 74 3a 3a 73  :cvs::project::s
5240: 79 6d 0a 09 7d 0a 09 6e 61 6d 65 73 70 61 63 65  ym..}..namespace
5250: 20 65 76 61 6c 20 66 69 6c 65 20 7b 0a 09 20 20   eval file {..  
5260: 20 20 6e 61 6d 65 73 70 61 63 65 20 69 6d 70 6f    namespace impo
5270: 72 74 20 3a 3a 76 63 3a 3a 66 6f 73 73 69 6c 3a  rt ::vc::fossil:
5280: 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 66 69  :import::cvs::fi
5290: 6c 65 3a 3a 72 65 76 0a 09 7d 0a 09 6e 61 6d 65  le::rev..}..name
52a0: 73 70 61 63 65 20 69 6d 70 6f 72 74 20 3a 3a 76  space import ::v
52b0: 63 3a 3a 74 6f 6f 6c 73 3a 3a 74 72 6f 75 62 6c  c::tools::troubl
52c0: 65 0a 09 6e 61 6d 65 73 70 61 63 65 20 69 6d 70  e..namespace imp
52d0: 6f 72 74 20 3a 3a 76 63 3a 3a 74 6f 6f 6c 73 3a  ort ::vc::tools:
52e0: 3a 6c 6f 67 0a 09 6c 6f 67 20 72 65 67 69 73 74  :log..log regist
52f0: 65 72 20 63 6f 6c 6c 72 65 76 0a 20 20 20 20 7d  er collrev.    }
5300: 0a 7d 0a 0a 23 20 23 20 23 23 20 23 23 23 20 23  .}..# # ## ### #
5310: 23 23 23 23 20 23 23 23 23 23 23 23 23 20 23 23  #### ######## ##
5320: 23 23 23 23 23 23 23 23 23 23 23 20 23 23 23 23  ########### ####
5330: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23  ################
5340: 23 0a 23 23 20 52 65 61 64 79 0a 0a 70 61 63 6b  #.## Ready..pack
5350: 61 67 65 20 70 72 6f 76 69 64 65 20 76 63 3a 3a  age provide vc::
5360: 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a  fossil::import::
5370: 63 76 73 3a 3a 70 61 73 73 3a 3a 63 6f 6c 6c 72  cvs::pass::collr
5380: 65 76 20 31 2e 30 0a 72 65 74 75 72 6e 0a        ev 1.0.return.