Hex Artifact Content
Not logged in

Artifact ef1b5512b84952336891659aa13aae334a7aac1f:

File tools/cvs2fossil/lib/c2f_pcollrev.tcl part of check-in [7ab490df24] - Extended pass 2, save branch positions, needed for pass 4, and added optype table to have the revision opcodes available in the state as well. by aku on 2007-11-07 06:19:13.

0000: 23 23 20 2d 2a 2d 20 74 63 6c 20 2d 2a 2d 0a 23  ## -*- tcl -*-.#
0010: 20 23 20 23 23 20 23 23 23 20 23 23 23 23 23 20   # ## ### ##### 
0020: 23 23 23 23 23 23 23 23 20 23 23 23 23 23 23 23  ######## #######
0030: 23 23 23 23 23 23 20 23 23 23 23 23 23 23 23 23  ###### #########
0040: 23 23 23 23 23 23 23 23 23 23 23 23 0a 23 23 20  ############.## 
0050: 43 6f 70 79 72 69 67 68 74 20 28 63 29 20 32 30  Copyright (c) 20
0060: 30 37 20 41 6e 64 72 65 61 73 20 4b 75 70 72 69  07 Andreas Kupri
0070: 65 73 2e 0a 23 0a 23 20 54 68 69 73 20 73 6f 66  es..#.# This sof
0080: 74 77 61 72 65 20 69 73 20 6c 69 63 65 6e 73 65  tware is license
0090: 64 20 61 73 20 64 65 73 63 72 69 62 65 64 20 69  d as described i
00a0: 6e 20 74 68 65 20 66 69 6c 65 20 4c 49 43 45 4e  n the file LICEN
00b0: 53 45 2c 20 77 68 69 63 68 0a 23 20 79 6f 75 20  SE, which.# you 
00c0: 73 68 6f 75 6c 64 20 68 61 76 65 20 72 65 63 65  should have rece
00d0: 69 76 65 64 20 61 73 20 70 61 72 74 20 6f 66 20  ived as part of 
00e0: 74 68 69 73 20 64 69 73 74 72 69 62 75 74 69 6f  this distributio
00f0: 6e 2e 0a 23 0a 23 20 54 68 69 73 20 73 6f 66 74  n..#.# This soft
0100: 77 61 72 65 20 63 6f 6e 73 69 73 74 73 20 6f 66  ware consists of
0110: 20 76 6f 6c 75 6e 74 61 72 79 20 63 6f 6e 74 72   voluntary contr
0120: 69 62 75 74 69 6f 6e 73 20 6d 61 64 65 20 62 79  ibutions made by
0130: 20 6d 61 6e 79 0a 23 20 69 6e 64 69 76 69 64 75   many.# individu
0140: 61 6c 73 2e 20 20 46 6f 72 20 65 78 61 63 74 20  als.  For exact 
0150: 63 6f 6e 74 72 69 62 75 74 69 6f 6e 20 68 69 73  contribution his
0160: 74 6f 72 79 2c 20 73 65 65 20 74 68 65 20 72 65  tory, see the re
0170: 76 69 73 69 6f 6e 0a 23 20 68 69 73 74 6f 72 79  vision.# history
0180: 20 61 6e 64 20 6c 6f 67 73 2c 20 61 76 61 69 6c   and logs, avail
0190: 61 62 6c 65 20 61 74 20 68 74 74 70 3a 2f 2f 66  able at http://f
01a0: 6f 73 73 69 6c 2d 73 63 6d 2e 68 77 61 63 69 2e  ossil-scm.hwaci.
01b0: 63 6f 6d 2f 66 6f 73 73 69 6c 0a 23 20 23 20 23  com/fossil.# # #
01c0: 23 20 23 23 23 20 23 23 23 23 23 20 23 23 23 23  # ### ##### ####
01d0: 23 23 23 23 20 23 23 23 23 23 23 23 23 23 23 23  #### ###########
01e0: 23 23 20 23 23 23 23 23 23 23 23 23 23 23 23 23  ## #############
01f0: 23 23 23 23 23 23 23 23 0a 0a 23 23 20 50 61 73  ########..## Pas
0200: 73 20 49 49 2e 20 54 68 69 73 20 70 61 73 73 20  s II. This pass 
0210: 70 61 72 73 65 73 20 74 68 65 20 63 6f 6c 6c 65  parses the colle
0220: 63 74 65 64 20 72 63 73 20 61 72 63 68 69 76 65  cted rcs archive
0230: 73 20 61 6e 64 20 65 78 74 72 61 63 74 73 0a 23  s and extracts.#
0240: 23 20 61 6c 6c 20 74 68 65 20 69 6e 66 6f 72 6d  # all the inform
0250: 61 74 69 6f 6e 20 74 68 65 79 20 63 6f 6e 74 61  ation they conta
0260: 69 6e 20 28 72 65 76 69 73 69 6f 6e 73 2c 20 61  in (revisions, a
0270: 6e 64 20 73 79 6d 62 6f 6c 73 29 2e 0a 0a 23 20  nd symbols)...# 
0280: 23 20 23 23 20 23 23 23 20 23 23 23 23 23 20 23  # ## ### ##### #
0290: 23 23 23 23 23 23 23 20 23 23 23 23 23 23 23 23  ####### ########
02a0: 23 23 23 23 23 20 23 23 23 23 23 23 23 23 23 23  ##### ##########
02b0: 23 23 23 23 23 23 23 23 23 23 23 0a 23 23 20 52  ###########.## R
02c0: 65 71 75 69 72 65 6d 65 6e 74 73 0a 0a 70 61 63  equirements..pac
02d0: 6b 61 67 65 20 72 65 71 75 69 72 65 20 54 63 6c  kage require Tcl
02e0: 20 38 2e 34 20 20 20 20 20 20 20 20 20 20 20 20   8.4            
02f0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
0300: 20 20 20 3b 20 23 20 52 65 71 75 69 72 65 64 20     ; # Required 
0310: 72 75 6e 74 69 6d 65 2e 0a 70 61 63 6b 61 67 65  runtime..package
0320: 20 72 65 71 75 69 72 65 20 73 6e 69 74 20 20 20   require snit   
0330: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
0340: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 3b                 ;
0350: 20 23 20 4f 4f 20 73 79 73 74 65 6d 2e 0a 70 61   # OO system..pa
0360: 63 6b 61 67 65 20 72 65 71 75 69 72 65 20 76 63  ckage require vc
0370: 3a 3a 74 6f 6f 6c 73 3a 3a 74 72 6f 75 62 6c 65  ::tools::trouble
0380: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
0390: 20 20 20 20 3b 20 23 20 45 72 72 6f 72 20 72 65      ; # Error re
03a0: 70 6f 72 74 69 6e 67 2e 0a 70 61 63 6b 61 67 65  porting..package
03b0: 20 72 65 71 75 69 72 65 20 76 63 3a 3a 74 6f 6f   require vc::too
03c0: 6c 73 3a 3a 6c 6f 67 20 20 20 20 20 20 20 20 20  ls::log         
03d0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 3b                 ;
03e0: 20 23 20 55 73 65 72 20 66 65 65 64 62 61 63 6b   # User feedback
03f0: 2e 0a 70 61 63 6b 61 67 65 20 72 65 71 75 69 72  ..package requir
0400: 65 20 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d  e vc::fossil::im
0410: 70 6f 72 74 3a 3a 63 76 73 3a 3a 70 61 73 73 20  port::cvs::pass 
0420: 20 20 20 20 20 20 20 20 3b 20 23 20 50 61 73 73          ; # Pass
0430: 20 6d 61 6e 61 67 65 6d 65 6e 74 2e 0a 70 61 63   management..pac
0440: 6b 61 67 65 20 72 65 71 75 69 72 65 20 76 63 3a  kage require vc:
0450: 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a  :fossil::import:
0460: 3a 63 76 73 3a 3a 72 65 70 6f 73 69 74 6f 72 79  :cvs::repository
0470: 20 20 20 3b 20 23 20 52 65 70 6f 73 69 74 6f 72     ; # Repositor
0480: 79 20 6d 61 6e 61 67 65 6d 65 6e 74 2e 0a 70 61  y management..pa
0490: 63 6b 61 67 65 20 72 65 71 75 69 72 65 20 76 63  ckage require vc
04a0: 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 74  ::fossil::import
04b0: 3a 3a 63 76 73 3a 3a 73 74 61 74 65 20 20 20 20  ::cvs::state    
04c0: 20 20 20 20 3b 20 23 20 53 74 61 74 65 20 73 74      ; # State st
04d0: 6f 72 61 67 65 2e 0a 70 61 63 6b 61 67 65 20 72  orage..package r
04e0: 65 71 75 69 72 65 20 76 63 3a 3a 66 6f 73 73 69  equire vc::fossi
04f0: 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a  l::import::cvs::
0500: 70 72 6f 6a 65 63 74 3a 3a 73 79 6d 20 3b 20 23  project::sym ; #
0510: 20 50 72 6f 6a 65 63 74 20 6c 65 76 65 6c 20 73   Project level s
0520: 79 6d 62 6f 6c 73 0a 70 61 63 6b 61 67 65 20 72  ymbols.package r
0530: 65 71 75 69 72 65 20 76 63 3a 3a 72 63 73 3a 3a  equire vc::rcs::
0540: 70 61 72 73 65 72 20 20 20 20 20 20 20 20 20 20  parser          
0550: 20 20 20 20 20 20 20 20 20 20 20 20 20 3b 20 23               ; #
0560: 20 52 63 73 20 61 72 63 68 69 76 65 20 64 61 74   Rcs archive dat
0570: 61 20 65 78 74 72 61 63 74 69 6f 6e 2e 0a 0a 23  a extraction...#
0580: 20 23 20 23 23 20 23 23 23 20 23 23 23 23 23 20   # ## ### ##### 
0590: 23 23 23 23 23 23 23 23 20 23 23 23 23 23 23 23  ######## #######
05a0: 23 23 23 23 23 23 20 23 23 23 23 23 23 23 23 23  ###### #########
05b0: 23 23 23 23 23 23 23 23 23 23 23 23 0a 23 23 20  ############.## 
05c0: 52 65 67 69 73 74 65 72 20 74 68 65 20 70 61 73  Register the pas
05d0: 73 20 77 69 74 68 20 74 68 65 20 6d 61 6e 61 67  s with the manag
05e0: 65 6d 65 6e 74 0a 0a 76 63 3a 3a 66 6f 73 73 69  ement..vc::fossi
05f0: 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a  l::import::cvs::
0600: 70 61 73 73 20 64 65 66 69 6e 65 20 5c 0a 20 20  pass define \.  
0610: 20 20 43 6f 6c 6c 65 63 74 52 65 76 20 5c 0a 20    CollectRev \. 
0620: 20 20 20 7b 43 6f 6c 6c 65 63 74 20 72 65 76 69     {Collect revi
0630: 73 69 6f 6e 73 20 61 6e 64 20 73 79 6d 62 6f 6c  sions and symbol
0640: 73 7d 20 5c 0a 20 20 20 20 3a 3a 76 63 3a 3a 66  s} \.    ::vc::f
0650: 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63  ossil::import::c
0660: 76 73 3a 3a 70 61 73 73 3a 3a 63 6f 6c 6c 72 65  vs::pass::collre
0670: 76 0a 0a 23 20 23 20 23 23 20 23 23 23 20 23 23  v..# # ## ### ##
0680: 23 23 23 20 23 23 23 23 23 23 23 23 20 23 23 23  ### ######## ###
0690: 23 23 23 23 23 23 23 23 23 23 20 23 23 23 23 23  ########## #####
06a0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23  ################
06b0: 0a 23 23 20 0a 0a 73 6e 69 74 3a 3a 74 79 70 65  .## ..snit::type
06c0: 20 3a 3a 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69   ::vc::fossil::i
06d0: 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 70 61 73 73  mport::cvs::pass
06e0: 3a 3a 63 6f 6c 6c 72 65 76 20 7b 0a 20 20 20 20  ::collrev {.    
06f0: 23 20 23 20 23 23 20 23 23 23 20 23 23 23 23 23  # # ## ### #####
0700: 20 23 23 23 23 23 23 23 23 20 23 23 23 23 23 23   ######## ######
0710: 23 23 23 23 23 23 23 0a 20 20 20 20 23 23 20 50  #######.    ## P
0720: 75 62 6c 69 63 20 41 50 49 0a 0a 20 20 20 20 74  ublic API..    t
0730: 79 70 65 6d 65 74 68 6f 64 20 73 65 74 75 70 20  ypemethod setup 
0740: 7b 7d 20 7b 0a 09 23 20 44 65 66 69 6e 65 20 6e  {} {..# Define n
0750: 61 6d 65 73 20 61 6e 64 20 73 74 72 75 63 74 75  ames and structu
0760: 72 65 20 6f 66 20 74 68 65 20 70 65 72 73 69 73  re of the persis
0770: 74 65 6e 74 20 73 74 61 74 65 20 6f 66 20 74 68  tent state of th
0780: 69 73 0a 09 23 20 70 61 73 73 2e 0a 0a 09 73 74  is..# pass....st
0790: 61 74 65 20 72 65 61 64 69 6e 67 20 70 72 6f 6a  ate reading proj
07a0: 65 63 74 0a 09 73 74 61 74 65 20 72 65 61 64 69  ect..state readi
07b0: 6e 67 20 66 69 6c 65 0a 0a 09 23 20 57 65 20 64  ng file...# We d
07c0: 65 61 6c 20 77 69 74 68 20 70 65 72 20 70 72 6f  eal with per pro
07d0: 6a 65 63 74 20 61 6e 64 20 70 65 72 20 66 69 6c  ject and per fil
07e0: 65 20 64 61 74 61 2c 20 74 68 65 20 66 69 72 73  e data, the firs
07f0: 74 0a 09 23 20 63 6f 6c 6c 61 74 65 64 20 66 72  t..# collated fr
0800: 6f 6d 20 74 68 65 20 73 65 63 6f 6e 64 2e 0a 0a  om the second...
0810: 09 23 20 50 65 72 20 66 69 6c 65 20 77 65 20 68  .# Per file we h
0820: 61 76 65 20 67 65 6e 65 72 61 6c 20 69 6e 66 6f  ave general info
0830: 72 6d 61 74 69 6f 6e 2c 20 2e 2e 2e 2c 20 61 6e  rmation, ..., an
0840: 64 20 74 68 65 6e 0a 09 23 20 72 65 76 69 73 69  d then..# revisi
0850: 6f 6e 73 20 61 6e 64 20 73 79 6d 62 6f 6c 73 2e  ons and symbols.
0860: 20 54 68 65 20 6c 61 74 74 65 72 20 63 61 6e 20   The latter can 
0870: 62 65 20 66 75 72 74 68 65 72 20 73 65 70 61 72  be further separ
0880: 61 74 65 64 0a 09 23 20 69 6e 74 6f 20 74 61 67  ated..# into tag
0890: 73 20 61 6e 64 20 62 72 61 6e 63 68 65 73 2e 20  s and branches. 
08a0: 41 74 20 70 72 6f 6a 65 63 74 20 6c 65 76 65 6c  At project level
08b0: 20 74 68 65 20 70 65 72 2d 66 69 6c 65 0a 09 23   the per-file..#
08c0: 20 73 79 6d 62 6f 6c 73 20 69 6e 66 6f 72 6d 61   symbols informa
08d0: 74 69 6f 6e 20 69 73 20 6d 65 72 67 65 64 2e 0a  tion is merged..
08e0: 0a 09 23 20 46 69 6c 65 20 6c 65 76 65 6c 20 2e  ..# File level .
08f0: 2e 2e 0a 09 23 09 52 65 76 69 73 69 6f 6e 73 2c  ....#.Revisions,
0900: 20 42 72 61 6e 63 68 65 73 2c 20 54 61 67 73 0a   Branches, Tags.
0910: 09 23 0a 09 23 20 50 73 65 75 64 6f 20 63 6c 61  .#..# Pseudo cla
0920: 73 73 20 68 69 65 72 61 72 63 68 79 0a 09 23 09  ss hierarchy..#.
0930: 54 61 67 20 20 20 20 20 20 3c 2d 20 53 79 6d 62  Tag      <- Symb
0940: 6f 6c 20 3c 2d 20 45 76 65 6e 74 0a 09 23 09 42  ol <- Event..#.B
0950: 72 61 6e 63 68 20 20 20 3c 2d 20 53 79 6d 62 6f  ranch   <- Symbo
0960: 6c 20 3c 2d 20 45 76 65 6e 74 0a 09 23 09 52 65  l <- Event..#.Re
0970: 76 69 73 69 6f 6e 20 20 20 20 20 20 20 20 20 20  vision          
0980: 20 3c 2d 20 45 76 65 6e 74 0a 0a 09 73 74 61 74   <- Event...stat
0990: 65 20 77 72 69 74 69 6e 67 20 72 65 76 69 73 69  e writing revisi
09a0: 6f 6e 20 7b 0a 09 20 20 20 20 2d 2d 20 52 65 76  on {..    -- Rev
09b0: 69 73 69 6f 6e 73 2e 20 49 64 65 6e 74 69 66 69  isions. Identifi
09c0: 65 64 20 62 79 20 61 20 67 6c 6f 62 61 6c 20 6e  ed by a global n
09d0: 75 6d 65 72 69 63 20 69 64 20 65 61 63 68 0a 09  umeric id each..
09e0: 20 20 20 20 2d 2d 20 62 65 6c 6f 6e 67 73 20 74      -- belongs t
09f0: 6f 20 61 20 73 69 6e 67 6c 65 20 66 69 6c 65 2c  o a single file,
0a00: 20 69 64 65 6e 74 69 66 69 65 64 20 62 79 20 69   identified by i
0a10: 74 73 20 69 64 2e 20 49 74 0a 09 20 20 20 20 2d  ts id. It..    -
0a20: 2d 20 66 75 72 74 68 65 72 20 68 61 73 20 61 20  - further has a 
0a30: 64 6f 74 74 65 64 20 72 65 76 69 73 69 6f 6e 20  dotted revision 
0a40: 6e 75 6d 62 65 72 20 28 44 54 4e 29 2e 0a 09 20  number (DTN)... 
0a50: 20 20 20 2d 2d 0a 09 20 20 20 20 2d 2d 20 43 6f     --..    -- Co
0a60: 6e 73 74 72 61 69 6e 74 3a 20 54 68 65 20 64 6f  nstraint: The do
0a70: 74 74 65 64 20 72 65 76 69 73 69 6f 6e 20 6e 75  tted revision nu
0a80: 6d 62 65 72 20 69 73 20 75 6e 69 71 75 65 20 77  mber is unique w
0a90: 69 74 68 69 6e 0a 20 20 20 20 20 20 20 20 20 20  ithin.          
0aa0: 20 20 2d 2d 20 20 20 20 20 20 20 20 20 20 20 20    --            
0ab0: 20 74 68 65 20 66 69 6c 65 2e 20 53 65 65 20 65   the file. See e
0ac0: 6e 64 20 6f 66 20 64 65 66 69 6e 69 74 69 6f 6e  nd of definition
0ad0: 2e 0a 0a 09 20 20 20 20 72 69 64 20 20 49 4e 54  ....    rid  INT
0ae0: 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 20  EGER  NOT NULL  
0af0: 50 52 49 4d 41 52 59 20 4b 45 59 20 41 55 54 4f  PRIMARY KEY AUTO
0b00: 49 4e 43 52 45 4d 45 4e 54 2c 0a 09 20 20 20 20  INCREMENT,..    
0b10: 66 69 64 20 20 49 4e 54 45 47 45 52 20 20 4e 4f  fid  INTEGER  NO
0b20: 54 20 4e 55 4c 4c 20 20 52 45 46 45 52 45 4e 43  T NULL  REFERENC
0b30: 45 53 20 66 69 6c 65 2c 20 20 20 2d 2d 20 46 69  ES file,   -- Fi
0b40: 6c 65 20 6f 77 6e 69 6e 67 20 72 65 76 69 73 69  le owning revisi
0b50: 6f 6e 2e 0a 09 20 20 20 20 72 65 76 20 20 54 45  on...    rev  TE
0b60: 58 54 20 20 20 20 20 4e 4f 54 20 4e 55 4c 4c 2c  XT     NOT NULL,
0b70: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
0b80: 20 20 20 20 2d 2d 20 44 6f 74 74 65 64 20 52 65      -- Dotted Re
0b90: 76 20 4e 75 6d 62 65 72 2e 0a 0a 09 20 20 20 20  v Number....    
0ba0: 2d 2d 20 41 6c 6c 20 72 65 76 69 73 69 6f 6e 73  -- All revisions
0bb0: 20 62 65 6c 6f 6e 67 20 74 6f 20 61 20 6c 69 6e   belong to a lin
0bc0: 65 2d 6f 66 2d 64 65 76 65 6c 6f 70 6d 65 6e 74  e-of-development
0bd0: 2c 0a 09 20 20 20 20 2d 2d 20 69 64 65 6e 74 69  ,..    -- identi
0be0: 66 69 65 64 20 62 79 20 61 20 73 79 6d 62 6f 6c  fied by a symbol
0bf0: 20 28 70 72 6f 6a 65 63 74 20 6c 65 76 65 6c 29   (project level)
0c00: 2e 20 44 75 72 69 6e 67 20 64 61 74 61 0a 09 20  . During data.. 
0c10: 20 20 20 2d 2d 20 63 6f 6c 6c 65 63 74 69 6f 6e     -- collection
0c20: 20 69 74 20 77 61 73 20 61 20 66 69 6c 65 2d 6c   it was a file-l
0c30: 65 76 65 6c 20 62 72 61 6e 63 68 20 73 79 6d 62  evel branch symb
0c40: 6f 6c 2e 0a 09 20 20 20 20 2d 2d 0a 09 20 20 20  ol...    --..   
0c50: 20 2d 2d 20 43 6f 6e 73 74 72 61 69 6e 74 3a 20   -- Constraint: 
0c60: 41 6c 6c 20 74 68 65 20 4c 4f 44 20 73 79 6d 62  All the LOD symb
0c70: 6f 6c 73 20 61 72 65 20 69 6e 20 74 68 65 20 73  ols are in the s
0c80: 61 6d 65 20 70 72 6f 6a 65 63 74 0a 09 20 20 20  ame project..   
0c90: 20 2d 2d 20 20 20 20 20 20 20 20 20 20 20 20 20   --             
0ca0: 61 73 20 74 68 65 20 66 69 6c 65 20 69 74 73 65  as the file itse
0cb0: 6c 66 2e 20 54 68 69 73 20 63 61 6e 6e 6f 74 20  lf. This cannot 
0cc0: 62 65 0a 09 20 20 20 20 2d 2d 20 20 20 20 20 20  be..    --      
0cd0: 20 20 20 20 20 20 20 65 78 70 72 65 73 73 65 64         expressed
0ce0: 20 69 6e 20 43 52 45 41 54 45 20 54 41 42 4c 45   in CREATE TABLE
0cf0: 20 73 79 6e 74 61 78 2e 0a 0a 09 20 20 20 20 6c   syntax....    l
0d00: 6f 64 20 20 49 4e 54 45 47 45 52 20 20 4e 4f 54  od  INTEGER  NOT
0d10: 20 4e 55 4c 4c 20 20 52 45 46 45 52 45 4e 43 45   NULL  REFERENCE
0d20: 53 20 73 79 6d 62 6f 6c 2c 20 2d 2d 20 4c 69 6e  S symbol, -- Lin
0d30: 65 20 6f 66 20 64 65 76 65 6c 6f 70 6d 65 6e 74  e of development
0d40: 0a 0a 09 20 20 20 20 2d 2d 20 54 68 65 20 72 65  ...    -- The re
0d50: 76 69 73 69 6f 6e 73 20 69 6e 20 61 20 66 69 6c  visions in a fil
0d60: 65 20 61 72 65 20 6f 72 67 61 6e 69 7a 65 64 20  e are organized 
0d70: 69 6e 20 61 20 66 6f 72 65 73 74 20 6f 66 0a 09  in a forest of..
0d80: 20 20 20 20 2d 2d 20 74 72 65 65 73 2c 20 77 69      -- trees, wi
0d90: 74 68 20 74 68 65 20 6d 61 69 6e 20 6c 69 6e 65  th the main line
0da0: 73 20 64 65 66 69 6e 65 64 20 74 68 72 6f 75 67  s defined throug
0db0: 68 20 74 68 65 20 70 61 72 65 6e 74 20 2f 0a 09  h the parent /..
0dc0: 20 20 20 20 2d 2d 20 63 68 69 6c 64 20 72 65 66      -- child ref
0dd0: 65 72 65 6e 63 65 73 2e 20 41 20 72 65 76 69 73  erences. A revis
0de0: 69 6f 6e 20 77 69 74 68 6f 75 74 20 61 20 70 61  ion without a pa
0df0: 72 65 6e 74 20 69 73 20 74 68 65 0a 09 20 20 20  rent is the..   
0e00: 20 2d 2d 20 72 6f 6f 74 20 6f 66 20 61 20 74 72   -- root of a tr
0e10: 65 65 2c 20 61 6e 64 20 61 20 72 65 76 69 73 69  ee, and a revisi
0e20: 6f 6e 20 77 69 74 68 6f 75 74 20 61 20 63 68 69  on without a chi
0e30: 6c 64 20 69 73 20 61 0a 09 20 20 20 20 2d 2d 20  ld is a..    -- 
0e40: 6c 65 61 66 2e 0a 0a 09 20 20 20 20 2d 2d 20 43  leaf....    -- C
0e50: 6f 6e 73 74 72 61 69 6e 74 73 3a 20 41 6c 6c 20  onstraints: All 
0e60: 72 65 76 69 73 69 6f 6e 73 20 63 6f 75 70 6c 65  revisions couple
0e70: 64 20 74 68 72 6f 75 67 68 20 70 61 72 65 6e 74  d through parent
0e80: 2f 63 68 69 6c 64 0a 09 20 20 20 20 2d 2d 20 20  /child..    --  
0e90: 20 20 20 20 20 20 20 20 20 20 20 20 72 65 66 65              refe
0ea0: 72 20 74 6f 20 74 68 65 20 73 61 6d 65 20 4c 4f  r to the same LO
0eb0: 44 20 73 79 6d 62 6f 6c 2e 20 54 68 65 20 70 61  D symbol. The pa
0ec0: 72 65 6e 74 0a 09 20 20 20 20 2d 2d 20 20 20 20  rent..    --    
0ed0: 20 20 20 20 20 20 20 20 20 20 6f 66 20 61 20 63            of a c
0ee0: 68 69 6c 64 20 6f 66 20 58 20 69 73 20 58 2e 20  hild of X is X. 
0ef0: 54 68 65 20 63 68 69 6c 64 20 6f 66 20 61 0a 09  The child of a..
0f00: 20 20 20 20 2d 2d 20 20 20 20 20 20 20 20 20 20      --          
0f10: 20 20 20 20 70 61 72 65 6e 74 20 6f 66 20 58 20      parent of X 
0f20: 69 73 20 58 2e 0a 0a 09 20 20 20 20 70 61 72 65  is X....    pare
0f30: 6e 74 20 20 49 4e 54 45 47 45 52 20 20 20 20 20  nt  INTEGER     
0f40: 20 20 20 20 20 20 20 52 45 46 45 52 45 4e 43 45         REFERENCE
0f50: 53 20 72 65 76 69 73 69 6f 6e 2c 0a 09 20 20 20  S revision,..   
0f60: 20 63 68 69 6c 64 20 20 20 49 4e 54 45 47 45 52   child   INTEGER
0f70: 20 20 20 20 20 20 20 20 20 20 20 20 52 45 46 45              REFE
0f80: 52 45 4e 43 45 53 20 72 65 76 69 73 69 6f 6e 2c  RENCES revision,
0f90: 0a 0a 09 20 20 20 20 2d 2d 20 54 68 65 20 72 65  ...    -- The re
0fa0: 70 72 65 73 65 6e 74 61 74 69 6f 6e 20 6f 66 20  presentation of 
0fb0: 61 20 62 72 61 6e 63 68 20 69 6e 20 61 20 74 72  a branch in a tr
0fc0: 65 65 20 69 73 20 74 68 65 0a 09 20 20 20 20 2d  ee is the..    -
0fd0: 2d 20 65 78 63 65 70 74 69 6f 6e 20 74 6f 20 74  - exception to t
0fe0: 68 65 20 74 68 72 65 65 20 63 6f 6e 73 74 72 61  he three constra
0ff0: 69 6e 74 73 20 61 62 6f 76 65 2e 0a 0a 09 20 20  ints above....  
1000: 20 20 2d 2d 20 54 68 65 20 62 65 67 69 6e 6e 69    -- The beginni
1010: 6e 67 20 6f 66 20 61 20 62 72 61 6e 63 68 20 69  ng of a branch i
1020: 73 20 72 65 70 72 65 73 65 6e 74 65 64 20 62 79  s represented by
1030: 20 61 20 6e 6f 6e 2d 4e 55 4c 4c 0a 09 20 20 20   a non-NULL..   
1040: 20 2d 2d 20 62 70 61 72 65 6e 74 20 6f 66 20 61   -- bparent of a
1050: 20 72 65 76 69 73 69 6f 6e 2e 20 54 68 69 73 20   revision. This 
1060: 72 65 76 69 73 69 6f 6e 20 42 20 69 73 20 74 68  revision B is th
1070: 65 20 66 69 72 73 74 20 6f 6e 0a 09 20 20 20 20  e first on..    
1080: 2d 2d 20 74 68 65 20 62 72 61 6e 63 68 2e 20 49  -- the branch. I
1090: 74 73 20 70 61 72 65 6e 74 20 50 20 69 73 20 74  ts parent P is t
10a0: 68 65 20 72 65 76 69 73 69 6f 6e 20 74 68 65 20  he revision the 
10b0: 62 72 61 6e 63 68 20 69 73 0a 09 20 20 20 20 2d  branch is..    -
10c0: 2d 20 72 6f 6f 74 65 64 20 69 6e 2c 20 61 6e 64  - rooted in, and
10d0: 20 69 74 20 69 73 20 6e 6f 74 20 74 68 65 20 63   it is not the c
10e0: 68 69 6c 64 20 6f 66 20 50 2e 20 42 20 61 6e 64  hild of P. B and
10f0: 20 50 20 72 65 66 65 72 0a 09 20 20 20 20 2d 2d   P refer..    --
1100: 20 74 6f 20 64 69 66 66 65 72 65 6e 74 20 4c 4f   to different LO
1110: 44 20 73 79 6d 62 6f 6c 73 2e 20 54 68 65 20 62  D symbols. The b
1120: 70 61 72 65 6e 74 20 6f 66 20 42 20 69 73 20 61  parent of B is a
1130: 6c 73 6f 20 69 74 73 0a 09 20 20 20 20 2d 2d 20  lso its..    -- 
1140: 4c 4f 44 2c 20 61 6e 64 20 74 68 65 20 4c 4f 44  LOD, and the LOD
1150: 20 6f 66 20 69 74 73 20 63 68 69 6c 64 72 65 6e   of its children
1160: 2e 0a 0a 09 20 20 20 20 62 70 61 72 65 6e 74 20  ....    bparent 
1170: 49 4e 54 45 47 45 52 20 20 20 20 20 20 20 20 20  INTEGER         
1180: 20 20 20 52 45 46 45 52 45 4e 43 45 53 20 73 79     REFERENCES sy
1190: 6d 62 6f 6c 2c 0a 0a 09 20 20 20 20 2d 2d 20 4c  mbol,...    -- L
11a0: 61 73 74 6c 79 20 77 65 20 6b 65 65 70 20 69 6e  astly we keep in
11b0: 66 6f 72 6d 61 74 69 6f 6e 20 69 73 20 61 62 6f  formation is abo
11c0: 75 74 20 6e 6f 6e 2d 74 72 75 6e 6b 20 64 65 66  ut non-trunk def
11d0: 61 75 6c 74 0a 09 20 20 20 20 2d 2d 20 62 72 61  ault..    -- bra
11e0: 6e 63 68 65 73 20 28 4e 54 44 42 29 20 69 6e 20  nches (NTDB) in 
11f0: 74 68 65 20 72 65 76 69 73 69 6f 6e 73 2e 0a 0a  the revisions...
1200: 09 20 20 20 20 2d 2d 20 41 6c 6c 20 72 65 76 69  .    -- All revi
1210: 73 69 6f 6e 73 20 6f 6e 20 74 68 65 20 4e 54 44  sions on the NTD
1220: 42 20 68 61 76 65 20 27 69 73 64 65 66 61 75 6c  B have 'isdefaul
1230: 74 27 20 54 52 55 45 2c 0a 09 20 20 20 20 2d 2d  t' TRUE,..    --
1240: 20 65 76 65 72 79 6f 6e 65 20 65 6c 73 65 20 46   everyone else F
1250: 41 4c 53 45 2e 20 54 68 65 20 6c 61 73 74 20 72  ALSE. The last r
1260: 65 76 69 73 69 6f 6e 20 58 20 6f 6e 20 74 68 65  evision X on the
1270: 20 4e 54 44 42 0a 09 20 20 20 20 2d 2d 20 77 68   NTDB..    -- wh
1280: 69 63 68 20 69 73 20 73 74 69 6c 6c 20 63 6f 6e  ich is still con
1290: 73 69 64 65 72 65 64 20 74 6f 20 62 65 20 6f 6e  sidered to be on
12a0: 20 74 68 65 20 74 72 75 6e 6b 20 61 73 20 77 65   the trunk as we
12b0: 6c 6c 0a 09 20 20 20 20 2d 2d 20 68 61 73 20 61  ll..    -- has a
12c0: 20 6e 6f 6e 2d 4e 55 4c 4c 20 27 64 62 63 68 69   non-NULL 'dbchi
12d0: 6c 64 27 20 77 68 69 63 68 20 72 65 66 65 72 73  ld' which refers
12e0: 20 74 6f 20 74 68 65 20 72 6f 6f 74 20 6f 66 0a   to the root of.
12f0: 09 20 20 20 20 2d 2d 20 74 68 65 20 74 72 75 6e  .    -- the trun
1300: 6b 2e 20 54 68 65 20 72 6f 6f 74 20 61 6c 73 6f  k. The root also
1310: 20 68 61 73 20 61 20 6e 6f 6e 2d 4e 55 4c 4c 20   has a non-NULL 
1320: 64 62 70 61 72 65 6e 74 0a 09 20 20 20 20 2d 2d  dbparent..    --
1330: 20 72 65 66 65 72 69 6e 67 20 74 6f 20 58 2e 0a   refering to X..
1340: 0a 09 20 20 20 20 69 73 64 65 66 61 75 6c 74 20  ..    isdefault 
1350: 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c  INTEGER  NOT NUL
1360: 4c 2c 0a 09 20 20 20 20 64 62 70 61 72 65 6e 74  L,..    dbparent
1370: 20 20 49 4e 54 45 47 45 52 20 20 20 20 20 20 20    INTEGER       
1380: 20 20 20 20 20 52 45 46 45 52 45 4e 43 45 53 20       REFERENCES 
1390: 72 65 76 69 73 69 6f 6e 2c 0a 09 20 20 20 20 64  revision,..    d
13a0: 62 63 68 69 6c 64 20 20 20 49 4e 54 45 47 45 52  bchild   INTEGER
13b0: 20 20 20 20 20 20 20 20 20 20 20 20 52 45 46 45              REFE
13c0: 52 45 4e 43 45 53 20 72 65 76 69 73 69 6f 6e 2c  RENCES revision,
13d0: 0a 0a 09 20 20 20 20 2d 2d 20 54 68 65 20 6d 61  ...    -- The ma
13e0: 69 6e 20 70 61 79 6c 6f 61 64 20 6f 66 20 74 68  in payload of th
13f0: 65 20 72 65 76 69 73 69 6f 6e 20 61 72 65 20 74  e revision are t
1400: 68 65 20 64 61 74 65 2f 74 69 6d 65 20 69 74 0a  he date/time it.
1410: 09 20 20 20 20 2d 2d 20 77 61 73 20 65 6e 74 65  .    -- was ente
1420: 72 65 64 2c 20 69 74 73 20 73 74 61 74 65 2c 20  red, its state, 
1430: 6f 70 65 72 61 74 69 6f 6e 20 28 3d 20 74 79 70  operation (= typ
1440: 65 2f 63 6c 61 73 73 29 2c 20 74 65 78 74 0a 09  e/class), text..
1450: 20 20 20 20 2d 2d 20 63 6f 6e 74 65 6e 74 2c 20      -- content, 
1460: 61 6e 64 20 6d 65 74 61 20 64 61 74 61 20 28 61  and meta data (a
1470: 75 74 68 6f 72 2c 20 6c 6f 67 20 6d 65 73 73 61  uthor, log messa
1480: 67 65 2c 20 62 72 61 6e 63 68 2c 0a 09 20 20 20  ge, branch,..   
1490: 20 2d 2d 20 70 72 6f 6a 65 63 74 29 2e 20 54 68   -- project). Th
14a0: 65 20 6c 61 73 74 20 69 73 20 65 6e 63 6f 64 65  e last is encode
14b0: 64 20 61 73 20 73 69 6e 67 6c 65 20 69 64 2c 20  d as single id, 
14c0: 73 65 65 20 74 61 62 6c 65 0a 09 20 20 20 20 2d  see table..    -
14d0: 2d 20 27 6d 65 74 61 27 2e 20 54 68 65 20 64 61  - 'meta'. The da
14e0: 74 65 2f 74 69 6d 65 20 69 73 20 67 69 76 65 6e  te/time is given
14f0: 20 69 6e 20 73 65 63 6f 6e 64 73 20 73 69 6e 63   in seconds sinc
1500: 65 20 74 68 65 0a 09 20 20 20 20 2d 2d 20 65 70  e the..    -- ep
1510: 6f 63 68 2c 20 66 6f 72 20 65 61 73 79 20 63 6f  och, for easy co
1520: 6d 70 61 72 69 73 6f 6e 2e 20 54 68 65 20 74 65  mparison. The te
1530: 78 74 20 63 6f 6e 74 65 6e 74 20 69 73 20 61 6e  xt content is an
1540: 0a 09 20 20 20 20 2d 2d 20 28 6f 66 66 73 65 74  ..    -- (offset
1550: 2c 6c 65 6e 67 74 68 29 20 70 61 69 72 20 69 6e  ,length) pair in
1560: 74 6f 20 74 68 65 20 72 63 73 20 61 72 63 68 69  to the rcs archi
1570: 76 65 2e 0a 0a 09 20 20 20 20 6f 70 20 20 20 20  ve....    op    
1580: 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c  INTEGER  NOT NUL
1590: 4c 20 20 52 45 46 45 52 45 4e 43 45 53 20 6f 70  L  REFERENCES op
15a0: 74 79 70 65 2c 0a 09 20 20 20 20 64 61 74 65 20  type,..    date 
15b0: 20 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55   INTEGER  NOT NU
15c0: 4c 4c 2c 0a 09 20 20 20 20 73 74 61 74 65 20 54  LL,..    state T
15d0: 45 58 54 20 20 20 20 20 4e 4f 54 20 4e 55 4c 4c  EXT     NOT NULL
15e0: 2c 0a 09 20 20 20 20 6d 69 64 20 20 20 49 4e 54  ,..    mid   INT
15f0: 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 20  EGER  NOT NULL  
1600: 52 45 46 45 52 45 4e 43 45 53 20 6d 65 74 61 2c  REFERENCES meta,
1610: 0a 09 20 20 20 20 63 6f 66 66 20 20 49 4e 54 45  ..    coff  INTE
1620: 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 2c 0a 09  GER  NOT NULL,..
1630: 20 20 20 20 63 6c 65 6e 20 20 49 4e 54 45 47 45      clen  INTEGE
1640: 52 20 20 4e 4f 54 20 4e 55 4c 4c 2c 0a 0a 09 20  R  NOT NULL,... 
1650: 20 20 20 55 4e 49 51 55 45 20 28 66 69 64 2c 20     UNIQUE (fid, 
1660: 72 65 76 29 20 2d 2d 20 54 68 65 20 44 54 4e 20  rev) -- The DTN 
1670: 69 73 20 75 6e 69 71 75 65 20 77 69 74 68 69 6e  is unique within
1680: 20 74 68 65 20 72 65 76 69 73 69 6f 6e 27 73 20   the revision's 
1690: 66 69 6c 65 2e 0a 09 7d 0a 09 73 74 61 74 65 20  file...}..state 
16a0: 77 72 69 74 69 6e 67 20 6f 70 74 79 70 65 20 7b  writing optype {
16b0: 0a 09 20 20 20 20 6f 69 64 20 20 20 49 4e 54 45  ..    oid   INTE
16c0: 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 50  GER  NOT NULL  P
16d0: 52 49 4d 41 52 59 20 4b 45 59 2c 0a 09 20 20 20  RIMARY KEY,..   
16e0: 20 6e 61 6d 65 20 20 54 45 58 54 20 20 20 20 20   name  TEXT     
16f0: 4e 4f 54 20 4e 55 4c 4c 2c 0a 09 20 20 20 20 55  NOT NULL,..    U
1700: 4e 49 51 55 45 28 74 65 78 74 29 0a 09 7d 0a 09  NIQUE(text)..}..
1710: 23 20 4b 65 65 70 20 6f 70 74 79 70 65 20 69 6e  # Keep optype in
1720: 20 73 79 6e 63 20 77 69 74 68 20 66 69 6c 65 3a   sync with file:
1730: 3a 72 65 76 2e 6d 79 6f 70 63 6f 64 65 0a 09 73  :rev.myopcode..s
1740: 74 61 74 65 20 72 75 6e 20 7b 0a 09 20 20 20 20  tate run {..    
1750: 49 4e 53 45 52 54 20 49 4e 54 4f 20 6f 70 74 79  INSERT INTO opty
1760: 70 65 20 56 41 4c 55 45 53 20 28 2d 31 2c 27 64  pe VALUES (-1,'d
1770: 65 6c 65 74 65 27 29 3b 0a 09 20 20 20 20 49 4e  elete');..    IN
1780: 53 45 52 54 20 49 4e 54 4f 20 6f 70 74 79 70 65  SERT INTO optype
1790: 20 56 41 4c 55 45 53 20 28 20 30 2c 27 6e 6f 74   VALUES ( 0,'not
17a0: 68 69 6e 67 27 29 3b 0a 09 20 20 20 20 49 4e 53  hing');..    INS
17b0: 45 52 54 20 49 4e 54 4f 20 6f 70 74 79 70 65 20  ERT INTO optype 
17c0: 56 41 4c 55 45 53 20 28 20 31 2c 27 61 64 64 27  VALUES ( 1,'add'
17d0: 29 3b 0a 09 20 20 20 20 49 4e 53 45 52 54 20 49  );..    INSERT I
17e0: 4e 54 4f 20 6f 70 74 79 70 65 20 56 41 4c 55 45  NTO optype VALUE
17f0: 53 20 28 20 32 2c 27 63 68 61 6e 67 65 27 29 3b  S ( 2,'change');
1800: 0a 09 7d 0a 09 73 74 61 74 65 20 77 72 69 74 69  ..}..state writi
1810: 6e 67 20 74 61 67 20 7b 0a 09 20 20 20 20 74 69  ng tag {..    ti
1820: 64 20 20 49 4e 54 45 47 45 52 20 20 4e 4f 54 20  d  INTEGER  NOT 
1830: 4e 55 4c 4c 20 20 50 52 49 4d 41 52 59 20 4b 45  NULL  PRIMARY KE
1840: 59 20 41 55 54 4f 49 4e 43 52 45 4d 45 4e 54 2c  Y AUTOINCREMENT,
1850: 0a 09 20 20 20 20 66 69 64 20 20 49 4e 54 45 47  ..    fid  INTEG
1860: 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 52 45  ER  NOT NULL  RE
1870: 46 45 52 45 4e 43 45 53 20 66 69 6c 65 2c 20 20  FERENCES file,  
1880: 20 20 20 2d 2d 20 46 69 6c 65 20 74 68 65 20 69     -- File the i
1890: 74 65 6d 20 62 65 6c 6f 6e 67 73 20 74 6f 0a 09  tem belongs to..
18a0: 20 20 20 20 6c 6f 64 20 20 49 4e 54 45 47 45 52      lod  INTEGER
18b0: 20 20 20 20 20 20 20 20 20 20 20 20 52 45 46 45              REFE
18c0: 52 45 4e 43 45 53 20 73 79 6d 62 6f 6c 2c 20 20  RENCES symbol,  
18d0: 20 2d 2d 20 4c 69 6e 65 20 6f 66 20 64 65 76 65   -- Line of deve
18e0: 6c 6f 70 6d 65 6e 74 20 28 4e 55 4c 4c 20 3d 3e  lopment (NULL =>
18f0: 20 54 72 75 6e 6b 29 0a 09 20 20 20 20 73 69 64   Trunk)..    sid
1900: 20 20 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e    INTEGER  NOT N
1910: 55 4c 4c 20 20 52 45 46 45 52 45 4e 43 45 53 20  ULL  REFERENCES 
1920: 73 79 6d 62 6f 6c 2c 20 20 20 2d 2d 20 53 79 6d  symbol,   -- Sym
1930: 62 6f 6c 20 63 61 70 74 75 72 69 6e 67 20 74 68  bol capturing th
1940: 65 20 74 61 67 0a 0a 09 20 20 20 20 72 65 76 20  e tag...    rev 
1950: 20 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55   INTEGER  NOT NU
1960: 4c 4c 20 20 52 45 46 45 52 45 4e 43 45 53 20 72  LL  REFERENCES r
1970: 65 76 69 73 69 6f 6e 20 20 2d 2d 20 54 68 65 20  evision  -- The 
1980: 72 65 76 69 73 69 6f 6e 20 62 65 69 6e 67 20 74  revision being t
1990: 61 67 67 65 64 2e 0a 09 7d 0a 0a 09 73 74 61 74  agged...}...stat
19a0: 65 20 77 72 69 74 69 6e 67 20 62 72 61 6e 63 68  e writing branch
19b0: 20 7b 0a 09 20 20 20 20 62 69 64 20 20 20 49 4e   {..    bid   IN
19c0: 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 20  TEGER  NOT NULL 
19d0: 20 50 52 49 4d 41 52 59 20 4b 45 59 20 41 55 54   PRIMARY KEY AUT
19e0: 4f 49 4e 43 52 45 4d 45 4e 54 2c 0a 09 20 20 20  OINCREMENT,..   
19f0: 20 66 69 64 20 20 20 49 4e 54 45 47 45 52 20 20   fid   INTEGER  
1a00: 4e 4f 54 20 4e 55 4c 4c 20 20 52 45 46 45 52 45  NOT NULL  REFERE
1a10: 4e 43 45 53 20 66 69 6c 65 2c 20 20 20 20 20 2d  NCES file,     -
1a20: 2d 20 46 69 6c 65 20 74 68 65 20 69 74 65 6d 20  - File the item 
1a30: 62 65 6c 6f 6e 67 73 20 74 6f 0a 09 20 20 20 20  belongs to..    
1a40: 6c 6f 64 20 20 20 49 4e 54 45 47 45 52 20 20 20  lod   INTEGER   
1a50: 20 20 20 20 20 20 20 20 20 52 45 46 45 52 45 4e           REFEREN
1a60: 43 45 53 20 73 79 6d 62 6f 6c 2c 20 20 20 2d 2d  CES symbol,   --
1a70: 20 4c 69 6e 65 20 6f 66 20 64 65 76 65 6c 6f 70   Line of develop
1a80: 6d 65 6e 74 20 28 4e 55 4c 4c 20 3d 3e 20 54 72  ment (NULL => Tr
1a90: 75 6e 6b 29 0a 09 20 20 20 20 73 69 64 20 20 20  unk)..    sid   
1aa0: 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c  INTEGER  NOT NUL
1ab0: 4c 20 20 52 45 46 45 52 45 4e 43 45 53 20 73 79  L  REFERENCES sy
1ac0: 6d 62 6f 6c 2c 20 20 20 2d 2d 20 53 79 6d 62 6f  mbol,   -- Symbo
1ad0: 6c 20 63 61 70 74 75 72 69 6e 67 20 74 68 65 20  l capturing the 
1ae0: 62 72 61 6e 63 68 0a 0a 09 20 20 20 20 72 6f 6f  branch...    roo
1af0: 74 20 20 49 4e 54 45 47 45 52 20 20 4e 4f 54 20  t  INTEGER  NOT 
1b00: 4e 55 4c 4c 20 20 52 45 46 45 52 45 4e 43 45 53  NULL  REFERENCES
1b10: 20 72 65 76 69 73 69 6f 6e 2c 20 2d 2d 20 52 65   revision, -- Re
1b20: 76 69 73 69 6f 6e 20 74 68 65 20 62 72 61 6e 63  vision the branc
1b30: 68 20 73 70 72 6f 75 74 73 20 66 72 6f 6d 0a 09  h sprouts from..
1b40: 20 20 20 20 66 69 72 73 74 20 49 4e 54 45 47 45      first INTEGE
1b50: 52 20 20 20 20 20 20 20 20 20 20 20 20 52 45 46  R            REF
1b60: 45 52 45 4e 43 45 53 20 72 65 76 69 73 69 6f 6e  ERENCES revision
1b70: 2c 20 2d 2d 20 46 69 72 73 74 20 72 65 76 69 73  , -- First revis
1b80: 69 6f 6e 20 63 6f 6d 6d 69 74 74 65 64 20 74 6f  ion committed to
1b90: 20 74 68 65 20 62 72 61 6e 63 68 0a 09 20 20 20   the branch..   
1ba0: 20 62 72 61 20 20 20 54 45 58 54 20 20 20 20 20   bra   TEXT     
1bb0: 4e 4f 54 20 4e 55 4c 4c 2c 20 20 20 20 20 20 20  NOT NULL,       
1bc0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2d                 -
1bd0: 2d 20 62 72 61 6e 63 68 20 6e 75 6d 62 65 72 0a  - branch number.
1be0: 09 20 20 20 20 70 6f 73 20 20 20 49 4e 54 45 47  .    pos   INTEG
1bf0: 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 20 20  ER  NOT NULL    
1c00: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
1c10: 20 20 20 2d 2d 20 63 72 65 61 74 69 6f 6e 20 6f     -- creation o
1c20: 72 64 65 72 20 69 6e 20 72 6f 6f 74 2e 0a 09 7d  rder in root...}
1c30: 0a 0a 09 23 20 50 72 6f 6a 65 63 74 20 6c 65 76  ...# Project lev
1c40: 65 6c 20 2e 2e 2e 0a 09 23 09 70 4c 69 6e 65 4f  el .....#.pLineO
1c50: 66 44 65 76 65 6c 6f 70 6d 65 6e 74 2c 20 70 53  fDevelopment, pS
1c60: 79 6d 62 6f 6c 2c 20 70 42 72 61 6e 63 68 2c 20  ymbol, pBranch, 
1c70: 70 54 61 67 2c 20 70 54 72 75 6e 6b 0a 09 23 0a  pTag, pTrunk..#.
1c80: 09 23 09 70 54 72 75 6e 6b 20 20 3c 2d 20 70 4c  .#.pTrunk  <- pL
1c90: 69 6e 65 4f 66 44 65 76 65 6c 6f 70 6d 65 6e 74  ineOfDevelopment
1ca0: 0a 09 23 09 70 42 72 61 6e 63 68 20 3c 2d 20 70  ..#.pBranch <- p
1cb0: 53 79 6d 62 6f 6c 2c 20 70 4c 69 6e 65 4f 66 44  Symbol, pLineOfD
1cc0: 65 76 65 6c 6f 70 6d 65 6e 74 0a 09 23 09 70 54  evelopment..#.pT
1cd0: 61 67 20 20 20 20 3c 2d 20 70 53 79 6d 62 6f 6c  ag    <- pSymbol
1ce0: 2c 20 70 4c 69 6e 65 4f 66 44 65 76 65 6c 6f 70  , pLineOfDevelop
1cf0: 6d 65 6e 74 0a 0a 09 73 74 61 74 65 20 77 72 69  ment...state wri
1d00: 74 69 6e 67 20 73 79 6d 62 6f 6c 20 7b 0a 09 20  ting symbol {.. 
1d10: 20 20 20 73 69 64 20 20 49 4e 54 45 47 45 52 20     sid  INTEGER 
1d20: 20 4e 4f 54 20 4e 55 4c 4c 20 20 50 52 49 4d 41   NOT NULL  PRIMA
1d30: 52 59 20 4b 45 59 20 41 55 54 4f 49 4e 43 52 45  RY KEY AUTOINCRE
1d40: 4d 45 4e 54 2c 0a 09 20 20 20 20 70 69 64 20 20  MENT,..    pid  
1d50: 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c  INTEGER  NOT NUL
1d60: 4c 20 20 52 45 46 45 52 45 4e 43 45 53 20 70 72  L  REFERENCES pr
1d70: 6f 6a 65 63 74 2c 20 20 2d 2d 20 50 72 6f 6a 65  oject,  -- Proje
1d80: 63 74 20 74 68 65 20 73 79 6d 62 6f 6c 20 62 65  ct the symbol be
1d90: 6c 6f 6e 67 73 20 74 6f 0a 09 20 20 20 20 6e 61  longs to..    na
1da0: 6d 65 20 54 45 58 54 20 20 20 20 20 4e 4f 54 20  me TEXT     NOT 
1db0: 4e 55 4c 4c 2c 0a 09 20 20 20 20 74 79 70 65 20  NULL,..    type 
1dc0: 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c  INTEGER  NOT NUL
1dd0: 4c 20 20 52 45 46 45 52 45 4e 43 45 53 20 73 79  L  REFERENCES sy
1de0: 6d 74 79 70 65 2c 20 20 2d 2d 20 65 6e 75 6d 20  mtype,  -- enum 
1df0: 7b 20 65 78 63 6c 75 64 65 64 20 3d 20 30 2c 20  { excluded = 0, 
1e00: 74 61 67 2c 20 62 72 61 6e 63 68 2c 20 75 6e 64  tag, branch, und
1e10: 65 66 69 6e 65 64 20 7d 0a 0a 09 20 20 20 20 74  efined }...    t
1e20: 61 67 5f 63 6f 75 6e 74 20 20 20 20 49 4e 54 45  ag_count    INTE
1e30: 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 2c 20 2d  GER  NOT NULL, -
1e40: 2d 20 48 6f 77 20 6f 66 74 65 6e 20 74 68 65 20  - How often the 
1e50: 73 79 6d 62 6f 6c 20 69 73 20 75 73 65 64 20 61  symbol is used a
1e60: 73 20 74 61 67 2e 0a 09 20 20 20 20 62 72 61 6e  s tag...    bran
1e70: 63 68 5f 63 6f 75 6e 74 20 49 4e 54 45 47 45 52  ch_count INTEGER
1e80: 20 20 4e 4f 54 20 4e 55 4c 4c 2c 20 2d 2d 20 48    NOT NULL, -- H
1e90: 6f 77 20 6f 66 74 65 6e 20 74 68 65 20 73 79 6d  ow often the sym
1ea0: 62 6f 6c 20 69 73 20 75 73 65 64 20 61 73 20 62  bol is used as b
1eb0: 72 61 6e 63 68 0a 09 20 20 20 20 63 6f 6d 6d 69  ranch..    commi
1ec0: 74 5f 63 6f 75 6e 74 20 49 4e 54 45 47 45 52 20  t_count INTEGER 
1ed0: 20 4e 4f 54 20 4e 55 4c 4c 2c 20 2d 2d 20 48 6f   NOT NULL, -- Ho
1ee0: 77 20 6f 66 74 65 6e 20 61 20 66 69 6c 65 20 77  w often a file w
1ef0: 61 73 20 63 6f 6d 6d 69 74 74 65 64 20 6f 6e 20  as committed on 
1f00: 74 68 65 20 73 79 6d 62 6f 6c 0a 0a 09 20 20 20  the symbol...   
1f10: 20 55 4e 49 51 55 45 20 28 70 69 64 2c 20 6e 61   UNIQUE (pid, na
1f20: 6d 65 29 20 2d 2d 20 53 79 6d 62 6f 6c 73 20 61  me) -- Symbols a
1f30: 72 65 20 75 6e 69 71 75 65 20 77 69 74 68 69 6e  re unique within
1f40: 20 74 68 65 20 70 72 6f 6a 65 63 74 0a 09 7d 0a   the project..}.
1f50: 0a 09 73 74 61 74 65 20 77 72 69 74 69 6e 67 20  ..state writing 
1f60: 62 6c 6f 63 6b 65 72 20 7b 0a 09 20 20 20 20 2d  blocker {..    -
1f70: 2d 20 46 6f 72 20 65 61 63 68 20 73 79 6d 62 6f  - For each symbo
1f80: 6c 20 77 65 20 73 61 76 65 20 77 68 69 63 68 20  l we save which 
1f90: 6f 74 68 65 72 20 73 79 6d 62 6f 6c 73 20 61 72  other symbols ar
1fa0: 65 0a 09 20 20 20 20 2d 2d 20 62 6c 6f 63 6b 69  e..    -- blocki
1fb0: 6e 67 20 69 74 73 20 72 65 6d 6f 76 61 6c 20 28  ng its removal (
1fc0: 69 66 20 74 68 65 20 75 73 65 72 20 61 73 6b 73  if the user asks
1fd0: 20 66 6f 72 20 69 74 29 2e 0a 0a 09 20 20 20 20   for it)....    
1fe0: 73 69 64 20 49 4e 54 45 47 45 52 20 20 4e 4f 54  sid INTEGER  NOT
1ff0: 20 4e 55 4c 4c 20 20 52 45 46 45 52 45 4e 43 45   NULL  REFERENCE
2000: 53 20 73 79 6d 62 6f 6c 2c 20 2d 2d 20 0a 09 20  S symbol, -- .. 
2010: 20 20 20 62 69 64 20 49 4e 54 45 47 45 52 20 20     bid INTEGER  
2020: 4e 4f 54 20 4e 55 4c 4c 20 20 52 45 46 45 52 45  NOT NULL  REFERE
2030: 4e 43 45 53 20 73 79 6d 62 6f 6c 2c 20 2d 2d 20  NCES symbol, -- 
2040: 53 70 72 6f 75 74 65 64 20 66 72 6f 6d 20 73 69  Sprouted from si
2050: 64 2c 20 62 6c 6f 63 6b 73 20 69 74 2e 0a 09 20  d, blocks it... 
2060: 20 20 20 55 4e 49 51 55 45 20 28 73 69 64 2c 20     UNIQUE (sid, 
2070: 62 69 64 29 0a 09 7d 0a 0a 09 73 74 61 74 65 20  bid)..}...state 
2080: 77 72 69 74 69 6e 67 20 70 61 72 65 6e 74 20 7b  writing parent {
2090: 0a 09 20 20 20 20 2d 2d 20 46 6f 72 20 65 61 63  ..    -- For eac
20a0: 68 20 73 79 6d 62 6f 6c 20 77 65 20 73 61 76 65  h symbol we save
20b0: 20 77 68 69 63 68 20 6f 74 68 65 72 20 73 79 6d   which other sym
20c0: 62 6f 6c 73 20 63 61 6e 20 61 63 74 20 61 73 0a  bols can act as.
20d0: 09 20 20 20 20 2d 2d 20 61 20 70 6f 73 73 69 62  .    -- a possib
20e0: 6c 65 20 70 61 72 65 6e 74 20 69 6e 20 73 6f 6d  le parent in som
20f0: 65 20 66 69 6c 65 2c 20 61 6e 64 20 68 6f 77 20  e file, and how 
2100: 6f 66 74 65 6e 2e 0a 0a 09 20 20 20 20 73 69 64  often....    sid
2110: 20 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55   INTEGER  NOT NU
2120: 4c 4c 20 20 52 45 46 45 52 45 4e 43 45 53 20 73  LL  REFERENCES s
2130: 79 6d 62 6f 6c 2c 20 2d 2d 20 0a 09 20 20 20 20  ymbol, -- ..    
2140: 70 69 64 20 49 4e 54 45 47 45 52 20 20 4e 4f 54  pid INTEGER  NOT
2150: 20 4e 55 4c 4c 20 20 52 45 46 45 52 45 4e 43 45   NULL  REFERENCE
2160: 53 20 73 79 6d 62 6f 6c 2c 20 2d 2d 20 50 6f 73  S symbol, -- Pos
2170: 73 69 62 6c 65 20 70 61 72 65 6e 74 20 6f 66 20  sible parent of 
2180: 73 69 64 0a 09 20 20 20 20 6e 20 20 20 49 4e 54  sid..    n   INT
2190: 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 2c 20  EGER  NOT NULL, 
21a0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
21b0: 20 20 20 2d 2d 20 48 6f 77 20 6f 66 74 65 6e 20     -- How often 
21c0: 70 69 64 20 63 61 6e 20 61 63 74 20 61 73 20 70  pid can act as p
21d0: 61 72 65 6e 74 2e 0a 09 20 20 20 20 55 4e 49 51  arent...    UNIQ
21e0: 55 45 20 28 73 69 64 2c 20 70 69 64 29 0a 09 7d  UE (sid, pid)..}
21f0: 0a 0a 09 73 74 61 74 65 20 77 72 69 74 69 6e 67  ...state writing
2200: 20 73 79 6d 74 79 70 65 20 7b 0a 09 20 20 20 20   symtype {..    
2210: 74 69 64 20 20 20 20 49 4e 54 45 47 45 52 20 20  tid    INTEGER  
2220: 4e 4f 54 20 4e 55 4c 4c 20 20 50 52 49 4d 41 52  NOT NULL  PRIMAR
2230: 59 20 4b 45 59 2c 0a 09 20 20 20 20 6e 61 6d 65  Y KEY,..    name
2240: 20 20 20 54 45 58 54 20 20 20 20 20 4e 4f 54 20     TEXT     NOT 
2250: 4e 55 4c 4c 2c 0a 09 20 20 20 20 70 6c 75 72 61  NULL,..    plura
2260: 6c 20 54 45 58 54 20 20 20 20 20 4e 4f 54 20 4e  l TEXT     NOT N
2270: 55 4c 4c 2c 0a 09 20 20 20 20 55 4e 49 51 55 45  ULL,..    UNIQUE
2280: 20 28 6e 61 6d 65 29 0a 09 20 20 20 20 55 4e 49   (name)..    UNI
2290: 51 55 45 20 28 70 6c 75 72 61 6c 29 0a 09 7d 0a  QUE (plural)..}.
22a0: 09 73 74 61 74 65 20 72 75 6e 20 7b 0a 09 20 20  .state run {..  
22b0: 20 20 49 4e 53 45 52 54 20 49 4e 54 4f 20 73 79    INSERT INTO sy
22c0: 6d 74 79 70 65 20 56 41 4c 55 45 53 20 28 30 2c  mtype VALUES (0,
22d0: 27 65 78 63 6c 75 64 65 64 27 2c 20 27 65 78 63  'excluded', 'exc
22e0: 6c 75 64 65 64 27 29 3b 0a 09 20 20 20 20 49 4e  luded');..    IN
22f0: 53 45 52 54 20 49 4e 54 4f 20 73 79 6d 74 79 70  SERT INTO symtyp
2300: 65 20 56 41 4c 55 45 53 20 28 31 2c 27 74 61 67  e VALUES (1,'tag
2310: 27 2c 20 20 20 20 20 20 27 74 61 67 73 27 29 3b  ',      'tags');
2320: 0a 09 20 20 20 20 49 4e 53 45 52 54 20 49 4e 54  ..    INSERT INT
2330: 4f 20 73 79 6d 74 79 70 65 20 56 41 4c 55 45 53  O symtype VALUES
2340: 20 28 32 2c 27 62 72 61 6e 63 68 27 2c 20 20 20   (2,'branch',   
2350: 27 62 72 61 6e 63 68 65 73 27 29 3b 0a 09 20 20  'branches');..  
2360: 20 20 49 4e 53 45 52 54 20 49 4e 54 4f 20 73 79    INSERT INTO sy
2370: 6d 74 79 70 65 20 56 41 4c 55 45 53 20 28 33 2c  mtype VALUES (3,
2380: 27 75 6e 64 65 66 69 6e 65 64 27 2c 27 75 6e 64  'undefined','und
2390: 65 66 69 6e 65 64 27 29 3b 0a 09 7d 0a 0a 09 73  efined');..}...s
23a0: 74 61 74 65 20 77 72 69 74 69 6e 67 20 6d 65 74  tate writing met
23b0: 61 20 7b 0a 09 20 20 20 20 2d 2d 20 4d 65 74 61  a {..    -- Meta
23c0: 20 64 61 74 61 20 6f 66 20 72 65 76 69 73 69 6f   data of revisio
23d0: 6e 73 2e 20 53 65 65 20 72 65 76 69 73 69 6f 6e  ns. See revision
23e0: 2e 6d 69 64 20 66 6f 72 20 74 68 65 0a 09 20 20  .mid for the..  
23f0: 20 20 2d 2d 20 72 65 66 65 72 65 6e 63 65 2e 20    -- reference. 
2400: 4d 61 6e 79 20 72 65 76 69 73 69 6f 6e 73 20 63  Many revisions c
2410: 61 6e 20 73 68 61 72 65 20 6d 65 74 61 20 64 61  an share meta da
2420: 74 61 2e 20 54 68 69 73 20 69 73 0a 09 20 20 20  ta. This is..   
2430: 20 2d 2d 20 61 63 74 75 61 6c 6c 79 20 6f 6e 65   -- actually one
2440: 20 6f 66 20 74 68 65 20 63 72 69 74 65 72 69 6f   of the criterio
2450: 6e 73 20 75 73 65 64 20 74 6f 20 73 6f 72 74 20  ns used to sort 
2460: 72 65 76 69 73 69 6f 6e 73 0a 09 20 20 20 20 2d  revisions..    -
2470: 2d 20 69 6e 74 6f 20 63 68 61 6e 67 65 73 65 74  - into changeset
2480: 73 2e 0a 0a 09 20 20 20 20 6d 69 64 20 49 4e 54  s....    mid INT
2490: 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 20  EGER  NOT NULL  
24a0: 50 52 49 4d 41 52 59 20 4b 45 59 20 20 41 55 54  PRIMARY KEY  AUT
24b0: 4f 49 4e 43 52 45 4d 45 4e 54 2c 0a 0a 09 20 20  OINCREMENT,...  
24c0: 20 20 2d 2d 20 4d 65 74 61 20 64 61 74 61 20 62    -- Meta data b
24d0: 65 6c 6f 6e 67 73 20 74 6f 20 61 20 73 70 65 63  elongs to a spec
24e0: 69 66 69 63 20 70 72 6f 6a 65 63 74 2c 20 73 74  ific project, st
24f0: 72 6f 6e 67 65 72 2c 20 74 6f 20 61 0a 09 20 20  ronger, to a..  
2500: 20 20 2d 2d 20 62 72 61 6e 63 68 20 69 6e 20 74    -- branch in t
2510: 68 61 74 20 70 72 6f 6a 65 63 74 2e 20 49 74 20  hat project. It 
2520: 66 75 72 74 68 65 72 20 68 61 73 20 61 20 6c 6f  further has a lo
2530: 67 20 6d 65 73 73 61 67 65 2c 0a 09 20 20 20 20  g message,..    
2540: 2d 2d 20 61 6e 64 20 69 74 73 20 61 75 74 68 6f  -- and its autho
2550: 72 2e 20 54 68 69 73 20 69 73 20 75 6e 69 71 75  r. This is uniqu
2560: 65 20 77 69 74 68 20 74 68 65 20 70 72 6f 6a 65  e with the proje
2570: 63 74 20 61 6e 64 0a 09 20 20 20 20 2d 2d 20 62  ct and..    -- b
2580: 72 61 6e 63 68 2e 0a 0a 09 20 20 20 20 70 69 64  ranch....    pid
2590: 20 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55   INTEGER  NOT NU
25a0: 4c 4c 20 20 52 45 46 45 52 45 4e 43 45 53 20 70  LL  REFERENCES p
25b0: 72 6f 6a 65 63 74 2c 20 20 2d 2d 0a 09 20 20 20  roject,  --..   
25c0: 20 62 69 64 20 49 4e 54 45 47 45 52 20 20 4e 4f   bid INTEGER  NO
25d0: 54 20 4e 55 4c 4c 20 20 52 45 46 45 52 45 4e 43  T NULL  REFERENC
25e0: 45 53 20 73 79 6d 62 6f 6c 2c 20 20 20 2d 2d 0a  ES symbol,   --.
25f0: 09 20 20 20 20 61 69 64 20 49 4e 54 45 47 45 52  .    aid INTEGER
2600: 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 52 45 46 45    NOT NULL  REFE
2610: 52 45 4e 43 45 53 20 61 75 74 68 6f 72 2c 20 20  RENCES author,  
2620: 20 2d 2d 0a 09 20 20 20 20 63 69 64 20 49 4e 54   --..    cid INT
2630: 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 20  EGER  NOT NULL  
2640: 52 45 46 45 52 45 4e 43 45 53 20 63 6d 65 73 73  REFERENCES cmess
2650: 61 67 65 2c 20 2d 2d 0a 0a 09 20 20 20 20 55 4e  age, --...    UN
2660: 49 51 55 45 20 28 70 69 64 2c 20 62 69 64 2c 20  IQUE (pid, bid, 
2670: 61 69 64 2c 20 63 69 64 29 0a 0a 09 20 20 20 20  aid, cid)...    
2680: 2d 2d 20 43 6f 6e 73 74 72 61 69 6e 74 73 3a 20  -- Constraints: 
2690: 54 68 65 20 70 72 6f 6a 65 63 74 20 6f 66 20 74  The project of t
26a0: 68 65 20 6d 65 74 61 20 64 61 74 61 20 6f 66 20  he meta data of 
26b0: 61 20 72 65 76 69 73 69 6f 6e 0a 09 20 20 20 20  a revision..    
26c0: 2d 2d 20 20 20 20 20 20 20 20 20 20 20 20 20 20  --              
26d0: 58 20 69 73 20 74 68 65 20 73 61 6d 65 20 61 73  X is the same as
26e0: 20 74 68 65 20 70 72 6f 6a 65 63 74 20 6f 66 20   the project of 
26f0: 58 20 69 74 73 65 6c 66 2e 0a 09 20 20 20 20 2d  X itself...    -
2700: 2d 0a 09 20 20 20 20 2d 2d 20 2e 2e 2e 2e 2e 2e  -..    -- ......
2710: 2e 2e 2e 2e 2e 2e 20 54 68 65 20 62 72 61 6e 63  ...... The branc
2720: 68 20 6f 66 20 74 68 65 20 6d 65 74 61 20 64 61  h of the meta da
2730: 74 61 20 6f 66 20 61 20 72 65 76 69 73 69 6f 6e  ta of a revision
2740: 0a 09 20 20 20 20 2d 2d 20 20 20 20 20 20 20 20  ..    --        
2750: 20 20 20 20 20 20 58 20 69 73 20 74 68 65 20 73        X is the s
2760: 61 6d 65 20 61 73 20 74 68 65 20 6c 69 6e 65 20  ame as the line 
2770: 6f 66 20 64 65 76 65 6c 6f 70 6d 65 6e 74 0a 09  of development..
2780: 20 20 20 20 2d 2d 20 20 20 20 20 20 20 20 20 20      --          
2790: 20 20 20 20 6f 66 20 58 20 69 74 73 65 6c 66 2e      of X itself.
27a0: 0a 09 7d 0a 0a 09 23 20 41 75 74 68 6f 72 73 20  ..}...# Authors 
27b0: 61 6e 64 20 63 6f 6d 6d 69 74 20 6d 65 73 73 61  and commit messa
27c0: 67 65 73 20 61 72 65 20 66 75 6c 6c 79 20 67 6c  ges are fully gl
27d0: 6f 62 61 6c 2c 20 69 2e 65 2e 20 70 65 72 0a 09  obal, i.e. per..
27e0: 23 20 72 65 70 6f 73 69 74 6f 72 79 2e 0a 0a 09  # repository....
27f0: 73 74 61 74 65 20 77 72 69 74 69 6e 67 20 61 75  state writing au
2800: 74 68 6f 72 20 7b 0a 09 20 20 20 20 61 69 64 20  thor {..    aid 
2810: 20 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55   INTEGER  NOT NU
2820: 4c 4c 20 20 50 52 49 4d 41 52 59 20 4b 45 59 20  LL  PRIMARY KEY 
2830: 20 41 55 54 4f 49 4e 43 52 45 4d 45 4e 54 2c 0a   AUTOINCREMENT,.
2840: 09 20 20 20 20 6e 61 6d 65 20 54 45 58 54 20 20  .    name TEXT  
2850: 20 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 55 4e 49     NOT NULL  UNI
2860: 51 55 45 0a 09 7d 0a 0a 09 73 74 61 74 65 20 77  QUE..}...state w
2870: 72 69 74 69 6e 67 20 63 6d 65 73 73 61 67 65 20  riting cmessage 
2880: 7b 0a 09 20 20 20 20 63 69 64 20 20 49 4e 54 45  {..    cid  INTE
2890: 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 50  GER  NOT NULL  P
28a0: 52 49 4d 41 52 59 20 4b 45 59 20 20 41 55 54 4f  RIMARY KEY  AUTO
28b0: 49 4e 43 52 45 4d 45 4e 54 2c 0a 09 20 20 20 20  INCREMENT,..    
28c0: 74 65 78 74 20 54 45 58 54 20 20 20 20 20 4e 4f  text TEXT     NO
28d0: 54 20 4e 55 4c 4c 20 20 55 4e 49 51 55 45 0a 09  T NULL  UNIQUE..
28e0: 7d 0a 0a 09 70 72 6f 6a 65 63 74 3a 3a 73 79 6d  }...project::sym
28f0: 20 67 65 74 73 79 6d 74 79 70 65 73 0a 09 72 65   getsymtypes..re
2900: 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20  turn.    }..    
2910: 74 79 70 65 6d 65 74 68 6f 64 20 6c 6f 61 64 20  typemethod load 
2920: 7b 7d 20 7b 0a 09 73 74 61 74 65 20 72 65 61 64  {} {..state read
2930: 69 6e 67 20 73 79 6d 62 6f 6c 0a 09 73 74 61 74  ing symbol..stat
2940: 65 20 72 65 61 64 69 6e 67 20 73 79 6d 74 79 70  e reading symtyp
2950: 65 0a 0a 09 70 72 6f 6a 65 63 74 3a 3a 73 79 6d  e...project::sym
2960: 20 67 65 74 73 79 6d 74 79 70 65 73 0a 09 72 65   getsymtypes..re
2970: 70 6f 73 69 74 6f 72 79 20 20 20 6c 6f 61 64 73  pository   loads
2980: 79 6d 62 6f 6c 73 0a 09 72 65 74 75 72 6e 0a 20  ymbols..return. 
2990: 20 20 20 7d 0a 0a 20 20 20 20 74 79 70 65 6d 65     }..    typeme
29a0: 74 68 6f 64 20 72 75 6e 20 7b 7d 20 7b 0a 09 23  thod run {} {..#
29b0: 20 50 61 73 73 20 6d 61 6e 61 67 65 72 20 69 6e   Pass manager in
29c0: 74 65 72 66 61 63 65 2e 20 45 78 65 63 75 74 65  terface. Execute
29d0: 64 20 74 6f 20 70 65 72 66 6f 72 6d 20 74 68 65  d to perform the
29e0: 0a 09 23 20 66 75 6e 63 74 69 6f 6e 61 6c 69 74  ..# functionalit
29f0: 79 20 6f 66 20 74 68 65 20 70 61 73 73 2e 0a 0a  y of the pass...
2a00: 09 73 65 74 20 72 62 61 73 65 20 5b 72 65 70 6f  .set rbase [repo
2a10: 73 69 74 6f 72 79 20 62 61 73 65 3f 5d 0a 09 66  sitory base?]..f
2a20: 6f 72 65 61 63 68 20 70 72 6f 6a 65 63 74 20 5b  oreach project [
2a30: 72 65 70 6f 73 69 74 6f 72 79 20 70 72 6f 6a 65  repository proje
2a40: 63 74 73 5d 20 7b 0a 09 20 20 20 20 73 65 74 20  cts] {..    set 
2a50: 62 61 73 65 20 5b 66 69 6c 65 20 6a 6f 69 6e 20  base [file join 
2a60: 24 72 62 61 73 65 20 5b 24 70 72 6f 6a 65 63 74  $rbase [$project
2a70: 20 62 61 73 65 5d 5d 0a 09 20 20 20 20 6c 6f 67   base]]..    log
2a80: 20 77 72 69 74 65 20 31 20 63 6f 6c 6c 72 65 76   write 1 collrev
2a90: 20 22 50 72 6f 63 65 73 73 69 6e 67 20 24 62 61   "Processing $ba
2aa0: 73 65 22 0a 0a 09 20 20 20 20 66 6f 72 65 61 63  se"...    foreac
2ab0: 68 20 66 69 6c 65 20 5b 24 70 72 6f 6a 65 63 74  h file [$project
2ac0: 20 66 69 6c 65 73 5d 20 7b 0a 09 09 73 65 74 20   files] {...set 
2ad0: 70 61 74 68 20 5b 24 66 69 6c 65 20 70 61 74 68  path [$file path
2ae0: 5d 0a 09 09 6c 6f 67 20 77 72 69 74 65 20 32 20  ]...log write 2 
2af0: 63 6f 6c 6c 72 65 76 20 22 50 61 72 73 69 6e 67  collrev "Parsing
2b00: 20 24 70 61 74 68 22 0a 09 09 69 66 20 7b 5b 63   $path"...if {[c
2b10: 61 74 63 68 20 7b 0a 09 09 20 20 20 20 70 61 72  atch {...    par
2b20: 73 65 72 20 70 72 6f 63 65 73 73 20 5b 66 69 6c  ser process [fil
2b30: 65 20 6a 6f 69 6e 20 24 62 61 73 65 20 24 70 61  e join $base $pa
2b40: 74 68 5d 20 24 66 69 6c 65 0a 09 09 7d 20 6d 73  th] $file...} ms
2b50: 67 5d 7d 20 7b 0a 09 09 20 20 20 20 67 6c 6f 62  g]} {...    glob
2b60: 61 6c 20 65 72 72 6f 72 43 6f 64 65 0a 09 09 20  al errorCode... 
2b70: 20 20 20 69 66 20 7b 24 65 72 72 6f 72 43 6f 64     if {$errorCod
2b80: 65 20 65 71 20 22 76 63 3a 3a 72 63 73 3a 3a 70  e eq "vc::rcs::p
2b90: 61 72 73 65 72 22 7d 20 7b 0a 09 09 09 74 72 6f  arser"} {....tro
2ba0: 75 62 6c 65 20 66 61 74 61 6c 20 22 24 70 61 74  uble fatal "$pat
2bb0: 68 20 69 73 20 6e 6f 74 20 61 20 76 61 6c 69 64  h is not a valid
2bc0: 20 52 43 53 20 61 72 63 68 69 76 65 20 28 24 6d   RCS archive ($m
2bd0: 73 67 29 22 0a 09 09 20 20 20 20 7d 20 65 6c 73  sg)"...    } els
2be0: 65 20 7b 0a 09 09 09 67 6c 6f 62 61 6c 20 65 72  e {....global er
2bf0: 72 6f 72 49 6e 66 6f 0a 09 09 09 74 72 6f 75 62  rorInfo....troub
2c00: 6c 65 20 69 6e 74 65 72 6e 61 6c 20 24 65 72 72  le internal $err
2c10: 6f 72 49 6e 66 6f 0a 09 09 20 20 20 20 7d 0a 09  orInfo...    }..
2c20: 09 7d 20 65 6c 73 65 20 7b 0a 09 09 20 20 20 20  .} else {...    
2c30: 23 20 57 65 20 70 65 72 73 69 73 74 20 74 68 65  # We persist the
2c40: 20 63 6f 72 65 20 6f 66 20 74 68 65 20 64 61 74   core of the dat
2c50: 61 20 63 6f 6c 6c 65 63 74 65 64 20 61 62 6f 75  a collected abou
2c60: 74 0a 09 09 20 20 20 20 23 20 65 61 63 68 20 66  t...    # each f
2c70: 69 6c 65 20 69 6d 6d 65 64 69 61 74 65 6c 79 20  ile immediately 
2c80: 61 66 74 65 72 20 69 74 20 68 61 73 20 62 65 65  after it has bee
2c90: 6e 20 70 61 72 73 65 64 0a 09 09 20 20 20 20 23  n parsed...    #
2ca0: 20 61 6e 64 20 77 72 61 6e 67 6c 65 64 20 69 6e   and wrangled in
2cb0: 74 6f 20 73 68 61 70 65 2c 20 61 6e 64 20 74 68  to shape, and th
2cc0: 65 6e 20 64 72 6f 70 20 69 74 20 66 72 6f 6d 0a  en drop it from.
2cd0: 09 09 20 20 20 20 23 20 6d 65 6d 6f 72 79 2e 20  ..    # memory. 
2ce0: 54 68 69 73 20 69 73 20 64 6f 6e 65 20 74 6f 20  This is done to 
2cf0: 6b 65 65 70 20 74 68 65 20 61 6d 6f 75 6e 74 20  keep the amount 
2d00: 6f 66 0a 09 09 20 20 20 20 23 20 72 65 71 75 69  of...    # requi
2d10: 72 65 64 20 6d 65 6d 6f 72 79 20 77 69 74 68 69  red memory withi
2d20: 6e 20 73 65 6e 73 69 62 6c 65 20 6c 69 6d 69 74  n sensible limit
2d30: 73 2e 20 57 69 74 68 6f 75 74 0a 09 09 20 20 20  s. Without...   
2d40: 20 23 20 64 6f 69 6e 67 20 69 74 20 74 68 69 73   # doing it this
2d50: 20 77 61 79 20 77 65 20 77 6f 75 6c 64 20 65 61   way we would ea
2d60: 73 69 6c 79 20 67 6f 62 62 6c 65 20 75 70 20 31  sily gobble up 1
2d70: 47 0a 09 09 20 20 20 20 23 20 6f 66 20 52 41 4d  G...    # of RAM
2d80: 20 6f 72 20 6d 6f 72 65 20 77 69 74 68 20 61 6c   or more with al
2d90: 6c 20 74 68 65 20 6f 62 6a 65 63 74 73 20 28 72  l the objects (r
2da0: 65 76 69 73 69 6f 6e 73 0a 09 09 20 20 20 20 23  evisions...    #
2db0: 20 61 6e 64 20 66 69 6c 65 2d 6c 65 76 65 6c 20   and file-level 
2dc0: 73 79 6d 62 6f 6c 73 29 2e 0a 0a 09 09 20 20 20  symbols).....   
2dd0: 20 24 66 69 6c 65 20 70 65 72 73 69 73 74 0a 09   $file persist..
2de0: 09 7d 0a 0a 09 09 24 66 69 6c 65 20 64 72 6f 70  .}....$file drop
2df0: 0a 09 20 20 20 20 7d 0a 0a 09 20 20 20 20 24 70  ..    }...    $p
2e00: 72 6f 6a 65 63 74 20 70 75 72 67 65 67 68 6f 73  roject purgeghos
2e10: 74 73 79 6d 62 6f 6c 73 0a 09 7d 0a 0a 09 72 65  tsymbols..}...re
2e20: 70 6f 73 69 74 6f 72 79 20 70 72 69 6e 74 72 65  pository printre
2e30: 76 73 74 61 74 69 73 74 69 63 73 0a 09 72 65 70  vstatistics..rep
2e40: 6f 73 69 74 6f 72 79 20 70 65 72 73 69 73 74 72  ository persistr
2e50: 65 76 0a 0a 09 50 61 72 61 6e 6f 69 61 0a 09 6c  ev...Paranoia..l
2e60: 6f 67 20 77 72 69 74 65 20 31 20 63 6f 6c 6c 72  og write 1 collr
2e70: 65 76 20 22 53 63 61 6e 20 63 6f 6d 70 6c 65 74  ev "Scan complet
2e80: 65 64 22 0a 09 72 65 74 75 72 6e 0a 20 20 20 20  ed"..return.    
2e90: 7d 0a 0a 20 20 20 20 74 79 70 65 6d 65 74 68 6f  }..    typemetho
2ea0: 64 20 64 69 73 63 61 72 64 20 7b 7d 20 7b 0a 09  d discard {} {..
2eb0: 23 20 50 61 73 73 20 6d 61 6e 61 67 65 72 20 69  # Pass manager i
2ec0: 6e 74 65 72 66 61 63 65 2e 20 45 78 65 63 75 74  nterface. Execut
2ed0: 65 64 20 66 6f 72 20 61 6c 6c 20 70 61 73 73 65  ed for all passe
2ee0: 73 20 61 66 74 65 72 20 74 68 65 0a 09 23 20 72  s after the..# r
2ef0: 75 6e 20 70 61 73 73 65 73 2c 20 74 6f 20 72 65  un passes, to re
2f00: 6d 6f 76 65 20 61 6c 6c 20 64 61 74 61 20 6f 66  move all data of
2f10: 20 74 68 69 73 20 70 61 73 73 20 66 72 6f 6d 20   this pass from 
2f20: 74 68 65 20 73 74 61 74 65 2c 0a 09 23 20 61 73  the state,..# as
2f30: 20 62 65 69 6e 67 20 6f 75 74 20 6f 66 20 64 61   being out of da
2f40: 74 65 2e 0a 0a 09 73 74 61 74 65 20 64 69 73 63  te....state disc
2f50: 61 72 64 20 72 65 76 69 73 69 6f 6e 0a 09 73 74  ard revision..st
2f60: 61 74 65 20 64 69 73 63 61 72 64 20 74 61 67 0a  ate discard tag.
2f70: 09 73 74 61 74 65 20 64 69 73 63 61 72 64 20 62  .state discard b
2f80: 72 61 6e 63 68 0a 09 73 74 61 74 65 20 64 69 73  ranch..state dis
2f90: 63 61 72 64 20 73 79 6d 62 6f 6c 0a 09 73 74 61  card symbol..sta
2fa0: 74 65 20 64 69 73 63 61 72 64 20 62 6c 6f 63 6b  te discard block
2fb0: 65 72 0a 09 73 74 61 74 65 20 64 69 73 63 61 72  er..state discar
2fc0: 64 20 70 61 72 65 6e 74 0a 09 73 74 61 74 65 20  d parent..state 
2fd0: 64 69 73 63 61 72 64 20 73 79 6d 74 79 70 65 0a  discard symtype.
2fe0: 09 73 74 61 74 65 20 64 69 73 63 61 72 64 20 6d  .state discard m
2ff0: 65 74 61 0a 09 73 74 61 74 65 20 64 69 73 63 61  eta..state disca
3000: 72 64 20 61 75 74 68 6f 72 0a 09 73 74 61 74 65  rd author..state
3010: 20 64 69 73 63 61 72 64 20 63 6d 65 73 73 61 67   discard cmessag
3020: 65 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a  e..return.    }.
3030: 0a 20 20 20 20 70 72 6f 63 20 50 61 72 61 6e 6f  .    proc Parano
3040: 69 61 20 7b 7d 20 7b 0a 09 23 20 54 68 69 73 20  ia {} {..# This 
3050: 63 6f 64 65 20 70 65 72 66 6f 72 6d 73 20 61 20  code performs a 
3060: 6e 75 6d 62 65 72 20 6f 66 20 70 61 72 61 6e 6f  number of parano
3070: 69 64 20 63 68 65 63 6b 73 20 6f 66 20 74 68 65  id checks of the
3080: 0a 09 23 20 64 61 74 61 62 61 73 65 2c 20 73 65  ..# database, se
3090: 61 72 63 68 69 6e 67 20 66 6f 72 20 69 6e 63 6f  arching for inco
30a0: 6e 73 69 73 74 65 6e 74 20 63 72 6f 73 73 2d 72  nsistent cross-r
30b0: 65 66 65 72 65 6e 63 65 73 2e 0a 09 6c 6f 67 20  eferences...log 
30c0: 77 72 69 74 65 20 34 20 63 6f 6c 6c 72 65 76 20  write 4 collrev 
30d0: 7b 43 68 65 63 6b 20 64 61 74 61 62 61 73 65 20  {Check database 
30e0: 63 6f 6e 73 69 73 74 65 6e 63 79 7d 0a 0a 09 73  consistency}...s
30f0: 65 74 20 6e 20 30 20 3b 20 23 20 43 6f 75 6e 74  et n 0 ; # Count
3100: 65 72 20 66 6f 72 20 74 68 65 20 63 68 65 63 6b  er for the check
3110: 73 20 28 77 65 20 70 72 69 6e 74 20 61 6e 20 69  s (we print an i
3120: 64 20 62 65 66 6f 72 65 20 74 68 65 0a 09 09 20  d before the... 
3130: 20 23 20 6d 61 69 6e 20 6c 61 62 65 6c 29 2e 0a   # main label)..
3140: 0a 09 23 20 46 69 6e 64 20 61 6c 6c 20 72 65 76  ..# Find all rev
3150: 69 73 69 6f 6e 73 20 77 68 69 63 68 20 64 69 73  isions which dis
3160: 61 67 72 65 65 20 77 69 74 68 20 74 68 65 69 72  agree with their
3170: 20 6c 69 6e 65 20 6f 66 0a 09 23 20 64 65 76 65   line of..# deve
3180: 6c 6f 70 6d 65 6e 74 20 61 62 6f 75 74 20 74 68  lopment about th
3190: 65 20 70 72 6f 6a 65 63 74 20 74 68 65 79 20 61  e project they a
31a0: 72 65 20 6f 77 6e 65 64 20 62 79 2e 0a 09 43 68  re owned by...Ch
31b0: 65 63 6b 20 5c 0a 09 20 20 20 20 7b 52 65 76 69  eck \..    {Revi
31c0: 73 69 6f 6e 73 20 61 6e 64 20 74 68 65 69 72 20  sions and their 
31d0: 4c 4f 44 73 20 68 61 76 65 20 74 6f 20 62 65 20  LODs have to be 
31e0: 69 6e 20 74 68 65 20 73 61 6d 65 20 70 72 6f 6a  in the same proj
31f0: 65 63 74 7d 20 5c 0a 09 20 20 20 20 7b 64 69 73  ect} \..    {dis
3200: 61 67 72 65 65 73 20 77 69 74 68 20 69 74 73 20  agrees with its 
3210: 4c 4f 44 20 61 62 6f 75 74 20 6f 77 6e 69 6e 67  LOD about owning
3220: 20 70 72 6f 6a 65 63 74 7d 20 7b 0a 09 09 53 45   project} {...SE
3230: 4c 45 43 54 20 46 2e 6e 61 6d 65 2c 20 52 2e 72  LECT F.name, R.r
3240: 65 76 0a 09 09 46 52 4f 4d 20 72 65 76 69 73 69  ev...FROM revisi
3250: 6f 6e 20 52 2c 20 66 69 6c 65 20 46 2c 20 73 79  on R, file F, sy
3260: 6d 62 6f 6c 20 53 0a 09 09 57 48 45 52 45 20 52  mbol S...WHERE R
3270: 2e 66 69 64 20 3d 20 46 2e 66 69 64 0a 09 09 41  .fid = F.fid...A
3280: 4e 44 20 20 20 52 2e 6c 6f 64 20 3d 20 53 2e 73  ND   R.lod = S.s
3290: 69 64 0a 09 09 41 4e 44 20 20 20 46 2e 70 69 64  id...AND   F.pid
32a0: 20 21 3d 20 53 2e 70 69 64 0a 09 09 3b 0a 09 20   != S.pid...;.. 
32b0: 20 20 20 7d 0a 09 23 20 46 69 6e 64 20 61 6c 6c     }..# Find all
32c0: 20 72 65 76 69 73 69 6f 6e 73 20 77 68 69 63 68   revisions which
32d0: 20 64 69 73 67 72 65 65 20 77 69 74 68 20 74 68   disgree with th
32e0: 65 69 72 20 6d 65 74 61 20 64 61 74 61 20 61 62  eir meta data ab
32f0: 6f 75 74 0a 09 23 20 74 68 65 20 70 72 6f 6a 65  out..# the proje
3300: 63 74 20 74 68 65 79 20 61 72 65 20 6f 77 6e 65  ct they are owne
3310: 64 20 62 79 2e 0a 09 43 68 65 63 6b 20 5c 0a 09  d by...Check \..
3320: 20 20 20 20 7b 52 65 76 69 73 69 6f 6e 73 20 61      {Revisions a
3330: 6e 64 20 74 68 65 69 72 20 6d 65 74 61 20 64 61  nd their meta da
3340: 74 61 20 68 61 76 65 20 74 6f 20 62 65 20 69 6e  ta have to be in
3350: 20 74 68 65 20 73 61 6d 65 20 70 72 6f 6a 65 63   the same projec
3360: 74 7d 20 5c 0a 09 20 20 20 20 7b 64 69 73 61 67  t} \..    {disag
3370: 72 65 65 73 20 77 69 74 68 20 69 74 73 20 6d 65  rees with its me
3380: 74 61 20 64 61 74 61 20 61 62 6f 75 74 20 6f 77  ta data about ow
3390: 6e 69 6e 67 20 70 72 6f 6a 65 63 74 7d 20 7b 0a  ning project} {.
33a0: 09 09 53 45 4c 45 43 54 20 46 2e 6e 61 6d 65 2c  ..SELECT F.name,
33b0: 20 52 2e 72 65 76 0a 09 09 46 52 4f 4d 20 72 65   R.rev...FROM re
33c0: 76 69 73 69 6f 6e 20 52 2c 20 66 69 6c 65 20 46  vision R, file F
33d0: 2c 20 6d 65 74 61 20 4d 0a 09 09 57 48 45 52 45  , meta M...WHERE
33e0: 20 52 2e 66 69 64 20 3d 20 46 2e 66 69 64 0a 09   R.fid = F.fid..
33f0: 09 41 4e 44 20 20 20 52 2e 6d 69 64 20 3d 20 4d  .AND   R.mid = M
3400: 2e 6d 69 64 0a 09 09 41 4e 44 20 20 20 46 2e 70  .mid...AND   F.p
3410: 69 64 20 21 3d 20 4d 2e 70 69 64 0a 09 09 3b 0a  id != M.pid...;.
3420: 09 20 20 20 20 7d 0a 09 23 20 46 69 6e 64 20 61  .    }..# Find a
3430: 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 77 68 69  ll revisions whi
3440: 63 68 20 64 69 73 67 72 65 65 20 77 69 74 68 20  ch disgree with 
3450: 74 68 65 69 72 20 6d 65 74 61 20 64 61 74 61 20  their meta data 
3460: 61 62 6f 75 74 0a 09 23 20 74 68 65 20 62 72 61  about..# the bra
3470: 6e 63 68 2f 6c 69 6e 65 20 6f 66 20 64 65 76 65  nch/line of deve
3480: 6c 6f 70 6d 65 6e 74 20 74 68 65 79 20 62 65 6c  lopment they bel
3490: 6f 6e 67 20 74 6f 2e 0a 09 43 68 65 63 6b 20 5c  ong to...Check \
34a0: 0a 09 20 20 20 20 7b 52 65 76 69 73 69 6f 6e 73  ..    {Revisions
34b0: 20 61 6e 64 20 74 68 65 69 72 20 6d 65 74 61 20   and their meta 
34c0: 64 61 74 61 20 68 61 76 65 20 74 6f 20 62 65 20  data have to be 
34d0: 69 6e 20 74 68 65 20 73 61 6d 65 20 4c 4f 44 7d  in the same LOD}
34e0: 20 5c 0a 09 20 20 20 20 7b 64 69 73 61 67 72 65   \..    {disagre
34f0: 65 73 20 77 69 74 68 20 69 74 73 20 6d 65 74 61  es with its meta
3500: 20 64 61 74 61 20 61 62 6f 75 74 20 6f 77 6e 69   data about owni
3510: 6e 67 20 4c 4f 44 7d 20 7b 0a 09 09 53 45 4c 45  ng LOD} {...SELE
3520: 43 54 20 46 2e 6e 61 6d 65 2c 20 52 2e 72 65 76  CT F.name, R.rev
3530: 0a 09 09 46 52 4f 4d 20 72 65 76 69 73 69 6f 6e  ...FROM revision
3540: 20 52 2c 20 6d 65 74 61 20 4d 2c 20 66 69 6c 65   R, meta M, file
3550: 20 46 0a 09 09 57 48 45 52 45 20 52 2e 6d 69 64   F...WHERE R.mid
3560: 20 3d 20 4d 2e 6d 69 64 0a 09 09 41 4e 44 20 20   = M.mid...AND  
3570: 20 52 2e 6c 6f 64 20 21 3d 20 4d 2e 62 69 64 0a   R.lod != M.bid.
3580: 09 09 41 4e 44 20 20 20 52 2e 66 69 64 20 3d 20  ..AND   R.fid = 
3590: 46 2e 66 69 64 0a 09 09 3b 0a 09 20 20 20 20 7d  F.fid...;..    }
35a0: 0a 09 23 20 46 69 6e 64 20 61 6c 6c 20 72 65 76  ..# Find all rev
35b0: 69 73 69 6f 6e 73 20 77 69 74 68 20 61 20 70 72  isions with a pr
35c0: 69 6d 61 72 79 20 63 68 69 6c 64 20 77 68 69 63  imary child whic
35d0: 68 20 64 69 73 61 67 72 65 65 73 0a 09 23 20 61  h disagrees..# a
35e0: 62 6f 75 74 20 74 68 65 20 66 69 6c 65 20 74 68  bout the file th
35f0: 65 79 20 62 65 6c 6f 6e 67 20 74 6f 2e 0a 09 43  ey belong to...C
3600: 68 65 63 6b 20 5c 0a 09 20 20 20 20 7b 52 65 76  heck \..    {Rev
3610: 69 73 69 6f 6e 73 20 61 6e 64 20 74 68 65 69 72  isions and their
3620: 20 70 72 69 6d 61 72 79 20 63 68 69 6c 64 72 65   primary childre
3630: 6e 20 68 61 76 65 20 74 6f 20 62 65 20 69 6e 20  n have to be in 
3640: 74 68 65 20 73 61 6d 65 20 66 69 6c 65 7d 20 5c  the same file} \
3650: 0a 09 20 20 20 20 7b 64 69 73 61 67 72 65 65 73  ..    {disagrees
3660: 20 77 69 74 68 20 69 74 73 20 70 72 69 6d 61 72   with its primar
3670: 79 20 63 68 69 6c 64 20 61 62 6f 75 74 20 74 68  y child about th
3680: 65 20 6f 77 6e 69 6e 67 20 66 69 6c 65 7d 20 7b  e owning file} {
3690: 0a 09 09 53 45 4c 45 43 54 20 46 2e 6e 61 6d 65  ...SELECT F.name
36a0: 2c 20 52 2e 72 65 76 0a 09 09 46 52 4f 4d 20 72  , R.rev...FROM r
36b0: 65 76 69 73 69 6f 6e 20 52 2c 20 72 65 76 69 73  evision R, revis
36c0: 69 6f 6e 20 43 2c 20 66 69 6c 65 20 46 0a 09 09  ion C, file F...
36d0: 57 48 45 52 45 20 52 2e 66 69 64 20 3d 20 46 2e  WHERE R.fid = F.
36e0: 66 69 64 0a 09 09 41 4e 44 20 20 20 52 2e 63 68  fid...AND   R.ch
36f0: 69 6c 64 20 49 53 20 4e 4f 54 20 4e 55 4c 4c 0a  ild IS NOT NULL.
3700: 09 09 41 4e 44 20 20 20 52 2e 63 68 69 6c 64 20  ..AND   R.child 
3710: 3d 20 43 2e 72 69 64 0a 09 09 41 4e 44 20 20 20  = C.rid...AND   
3720: 43 2e 66 69 64 20 21 3d 20 52 2e 66 69 64 0a 09  C.fid != R.fid..
3730: 09 3b 0a 09 20 20 20 20 7d 0a 0a 09 23 20 46 69  .;..    }...# Fi
3740: 6e 64 20 61 6c 6c 20 72 65 76 69 73 69 6f 6e 73  nd all revisions
3750: 20 77 69 74 68 20 61 20 62 72 61 6e 63 68 20 70   with a branch p
3760: 61 72 65 6e 74 20 73 79 6d 62 6f 6c 20 77 68 6f  arent symbol who
3770: 73 65 20 70 61 72 65 6e 74 0a 09 23 20 64 69 73  se parent..# dis
3780: 61 67 72 65 65 73 20 61 62 6f 75 74 20 74 68 65  agrees about the
3790: 20 66 69 6c 65 20 74 68 65 79 20 62 65 6c 6f 6e   file they belon
37a0: 67 20 74 6f 2e 0a 09 43 68 65 63 6b 20 5c 0a 09  g to...Check \..
37b0: 20 20 20 20 7b 52 65 76 69 73 69 6f 6e 73 20 61      {Revisions a
37c0: 6e 64 20 74 68 65 69 72 20 62 72 61 6e 63 68 20  nd their branch 
37d0: 63 68 69 6c 64 72 65 6e 20 68 61 76 65 20 74 6f  children have to
37e0: 20 62 65 20 69 6e 20 74 68 65 20 73 61 6d 65 20   be in the same 
37f0: 66 69 6c 65 7d 20 5c 0a 09 20 20 20 20 7b 61 74  file} \..    {at
3800: 20 74 68 65 20 62 65 67 69 6e 6e 69 6e 67 20 6f   the beginning o
3810: 66 20 69 74 73 20 62 72 61 6e 63 68 20 61 6e 64  f its branch and
3820: 20 69 74 73 20 70 61 72 65 6e 74 20 64 69 73 61   its parent disa
3830: 67 72 65 65 20 61 62 6f 75 74 20 74 68 65 20 6f  gree about the o
3840: 77 6e 69 6e 67 20 66 69 6c 65 7d 20 7b 0a 09 09  wning file} {...
3850: 53 45 4c 45 43 54 20 46 2e 6e 61 6d 65 2c 20 52  SELECT F.name, R
3860: 2e 72 65 76 0a 09 09 46 52 4f 4d 20 72 65 76 69  .rev...FROM revi
3870: 73 69 6f 6e 20 52 2c 20 72 65 76 69 73 69 6f 6e  sion R, revision
3880: 20 50 2c 20 66 69 6c 65 20 46 0a 09 09 57 48 45   P, file F...WHE
3890: 52 45 20 52 2e 66 69 64 20 3d 20 46 2e 66 69 64  RE R.fid = F.fid
38a0: 0a 09 09 41 4e 44 20 20 20 52 2e 62 70 61 72 65  ...AND   R.bpare
38b0: 6e 74 20 49 53 20 4e 4f 54 20 4e 55 4c 4c 0a 09  nt IS NOT NULL..
38c0: 09 41 4e 44 20 20 20 52 2e 70 61 72 65 6e 74 20  .AND   R.parent 
38d0: 3d 20 50 2e 72 69 64 0a 09 09 41 4e 44 20 20 20  = P.rid...AND   
38e0: 52 2e 66 69 64 20 21 3d 20 50 2e 66 69 64 0a 09  R.fid != P.fid..
38f0: 09 3b 0a 09 20 20 20 20 7d 0a 09 23 20 46 69 6e  .;..    }..# Fin
3900: 64 20 61 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20  d all revisions 
3910: 77 69 74 68 20 61 20 6e 6f 6e 2d 4e 54 44 42 20  with a non-NTDB 
3920: 63 68 69 6c 64 20 77 68 69 63 68 20 64 69 73 61  child which disa
3930: 67 72 65 65 73 0a 09 23 20 61 62 6f 75 74 20 74  grees..# about t
3940: 68 65 20 66 69 6c 65 20 74 68 65 79 20 62 65 6c  he file they bel
3950: 6f 6e 67 20 74 6f 2e 0a 09 43 68 65 63 6b 20 5c  ong to...Check \
3960: 0a 09 20 20 20 20 7b 52 65 76 69 73 69 6f 6e 73  ..    {Revisions
3970: 20 61 6e 64 20 74 68 65 69 72 20 6e 6f 6e 2d 4e   and their non-N
3980: 54 44 42 20 63 68 69 6c 64 72 65 6e 20 68 61 76  TDB children hav
3990: 65 20 74 6f 20 62 65 20 69 6e 20 74 68 65 20 73  e to be in the s
39a0: 61 6d 65 20 66 69 6c 65 7d 20 5c 0a 09 20 20 20  ame file} \..   
39b0: 20 7b 64 69 73 61 67 72 65 65 73 20 77 69 74 68   {disagrees with
39c0: 20 69 74 73 20 6e 6f 6e 2d 4e 54 44 42 20 63 68   its non-NTDB ch
39d0: 69 6c 64 20 61 62 6f 75 74 20 74 68 65 20 6f 77  ild about the ow
39e0: 6e 69 6e 67 20 66 69 6c 65 7d 20 7b 0a 09 09 53  ning file} {...S
39f0: 45 4c 45 43 54 20 46 2e 6e 61 6d 65 2c 20 52 2e  ELECT F.name, R.
3a00: 72 65 76 0a 09 09 46 52 4f 4d 20 72 65 76 69 73  rev...FROM revis
3a10: 69 6f 6e 20 52 2c 20 72 65 76 69 73 69 6f 6e 20  ion R, revision 
3a20: 43 2c 20 66 69 6c 65 20 46 0a 09 09 57 48 45 52  C, file F...WHER
3a30: 45 20 52 2e 66 69 64 20 3d 20 46 2e 66 69 64 0a  E R.fid = F.fid.
3a40: 09 09 41 4e 44 20 20 20 52 2e 64 62 63 68 69 6c  ..AND   R.dbchil
3a50: 64 20 49 53 20 4e 4f 54 20 4e 55 4c 4c 0a 09 09  d IS NOT NULL...
3a60: 41 4e 44 20 20 20 52 2e 64 62 63 68 69 6c 64 20  AND   R.dbchild 
3a70: 3d 20 43 2e 72 69 64 0a 09 09 41 4e 44 20 20 20  = C.rid...AND   
3a80: 43 2e 66 69 64 20 21 3d 20 52 2e 66 69 64 0a 09  C.fid != R.fid..
3a90: 09 3b 0a 09 20 20 20 20 7d 0a 09 23 20 46 69 6e  .;..    }..# Fin
3aa0: 64 20 61 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20  d all revisions 
3ab0: 77 68 69 63 68 20 68 61 76 65 20 61 20 70 72 69  which have a pri
3ac0: 6d 61 72 79 20 63 68 69 6c 64 2c 20 62 75 74 20  mary child, but 
3ad0: 74 68 65 20 63 68 69 6c 64 0a 09 23 20 64 6f 65  the child..# doe
3ae0: 73 20 6e 6f 74 20 68 61 76 65 20 74 68 65 6d 20  s not have them 
3af0: 61 73 20 70 61 72 65 6e 74 2e 0a 09 43 68 65 63  as parent...Chec
3b00: 6b 20 5c 0a 09 20 20 20 20 7b 52 65 76 69 73 69  k \..    {Revisi
3b10: 6f 6e 73 20 68 61 76 65 20 74 6f 20 62 65 20 70  ons have to be p
3b20: 61 72 65 6e 74 73 20 6f 66 20 74 68 65 69 72 20  arents of their 
3b30: 70 72 69 6d 61 72 79 20 63 68 69 6c 64 72 65 6e  primary children
3b40: 7d 20 5c 0a 09 20 20 20 20 7b 69 73 20 6e 6f 74  } \..    {is not
3b50: 20 74 68 65 20 70 61 72 65 6e 74 20 6f 66 20 69   the parent of i
3b60: 74 73 20 70 72 69 6d 61 72 79 20 63 68 69 6c 64  ts primary child
3b70: 7d 20 7b 0a 09 09 53 45 4c 45 43 54 20 46 2e 6e  } {...SELECT F.n
3b80: 61 6d 65 2c 20 52 2e 72 65 76 0a 09 09 46 52 4f  ame, R.rev...FRO
3b90: 4d 20 72 65 76 69 73 69 6f 6e 20 52 2c 20 72 65  M revision R, re
3ba0: 76 69 73 69 6f 6e 20 43 2c 20 66 69 6c 65 20 46  vision C, file F
3bb0: 0a 09 09 57 48 45 52 45 20 52 2e 66 69 64 20 3d  ...WHERE R.fid =
3bc0: 20 46 2e 66 69 64 0a 09 09 41 4e 44 20 20 20 52   F.fid...AND   R
3bd0: 2e 63 68 69 6c 64 20 49 53 20 4e 4f 54 20 4e 55  .child IS NOT NU
3be0: 4c 4c 0a 09 09 41 4e 44 20 20 20 52 2e 63 68 69  LL...AND   R.chi
3bf0: 6c 64 20 3d 20 43 2e 72 69 64 0a 09 09 41 4e 44  ld = C.rid...AND
3c00: 20 20 20 43 2e 70 61 72 65 6e 74 20 21 3d 20 52     C.parent != R
3c10: 2e 72 69 64 0a 09 09 3b 0a 09 20 20 20 20 7d 0a  .rid...;..    }.
3c20: 09 23 20 46 69 6e 64 20 61 6c 6c 20 72 65 76 69  .# Find all revi
3c30: 73 69 6f 6e 73 20 77 68 69 63 68 20 68 61 76 65  sions which have
3c40: 20 61 20 70 72 69 6d 72 61 72 79 20 63 68 69 6c   a primrary chil
3c50: 64 2c 20 62 75 74 20 74 68 65 0a 09 23 20 63 68  d, but the..# ch
3c60: 69 6c 64 20 68 61 73 20 61 20 62 72 61 6e 63 68  ild has a branch
3c70: 20 70 61 72 65 6e 74 20 73 79 6d 62 6f 6c 20 6d   parent symbol m
3c80: 61 6b 69 6e 67 20 74 68 65 6d 20 62 72 61 63 68  aking them brach
3c90: 20 73 74 61 72 74 65 72 73 2e 0a 09 43 68 65 63   starters...Chec
3ca0: 6b 20 5c 0a 09 20 20 20 20 7b 50 72 69 6d 61 72  k \..    {Primar
3cb0: 79 20 63 68 69 6c 64 72 65 6e 20 6f 66 20 72 65  y children of re
3cc0: 76 69 73 69 6f 6e 73 20 6d 75 73 74 20 6e 6f 74  visions must not
3cd0: 20 73 74 61 72 74 20 62 72 61 6e 63 68 65 73 7d   start branches}
3ce0: 20 5c 0a 09 20 20 20 20 7b 69 73 20 70 61 72 65   \..    {is pare
3cf0: 6e 74 20 6f 66 20 61 20 70 72 69 6d 61 72 79 20  nt of a primary 
3d00: 63 68 69 6c 64 20 77 68 69 63 68 20 69 73 20 74  child which is t
3d10: 68 65 20 62 65 67 69 6e 6e 69 6e 67 20 6f 66 20  he beginning of 
3d20: 61 20 62 72 61 6e 63 68 7d 20 7b 0a 09 09 53 45  a branch} {...SE
3d30: 4c 45 43 54 20 46 2e 6e 61 6d 65 2c 20 52 2e 72  LECT F.name, R.r
3d40: 65 76 0a 09 09 46 52 4f 4d 20 72 65 76 69 73 69  ev...FROM revisi
3d50: 6f 6e 20 52 2c 20 72 65 76 69 73 69 6f 6e 20 43  on R, revision C
3d60: 2c 20 66 69 6c 65 20 46 0a 09 09 57 48 45 52 45  , file F...WHERE
3d70: 20 52 2e 66 69 64 20 3d 20 46 2e 66 69 64 0a 09   R.fid = F.fid..
3d80: 09 41 4e 44 20 20 20 52 2e 63 68 69 6c 64 20 49  .AND   R.child I
3d90: 53 20 4e 4f 54 20 4e 55 4c 4c 0a 09 09 41 4e 44  S NOT NULL...AND
3da0: 20 20 20 52 2e 63 68 69 6c 64 20 3d 20 43 2e 72     R.child = C.r
3db0: 69 64 0a 09 09 41 4e 44 20 20 20 43 2e 62 70 61  id...AND   C.bpa
3dc0: 72 65 6e 74 20 49 53 20 4e 4f 54 20 4e 55 4c 4c  rent IS NOT NULL
3dd0: 0a 09 09 3b 0a 09 20 20 20 20 7d 0a 09 23 20 46  ...;..    }..# F
3de0: 69 6e 64 20 61 6c 6c 20 72 65 76 69 73 69 6f 6e  ind all revision
3df0: 73 20 77 69 74 68 6f 75 74 20 62 72 61 6e 63 68  s without branch
3e00: 20 70 61 72 65 6e 74 20 73 79 6d 62 6f 6c 20 77   parent symbol w
3e10: 68 69 63 68 20 68 61 76 65 20 61 0a 09 23 20 70  hich have a..# p
3e20: 61 72 65 6e 74 2c 20 62 75 74 20 74 68 65 20 70  arent, but the p
3e30: 61 72 65 6e 74 20 64 6f 65 73 20 6e 6f 74 20 68  arent does not h
3e40: 61 76 65 20 74 68 65 6d 20 61 73 20 70 72 69 6d  ave them as prim
3e50: 61 72 79 20 63 68 69 6c 64 2e 0a 09 43 68 65 63  ary child...Chec
3e60: 6b 20 5c 0a 09 20 20 20 20 7b 52 65 76 69 73 69  k \..    {Revisi
3e70: 6f 6e 73 20 68 61 76 65 20 74 6f 20 62 65 20 70  ons have to be p
3e80: 72 69 6d 61 72 79 20 63 68 69 6c 64 72 65 6e 20  rimary children 
3e90: 6f 66 20 74 68 65 69 72 20 70 61 72 65 6e 74 73  of their parents
3ea0: 2c 20 69 66 20 61 6e 79 7d 20 5c 0a 09 20 20 20  , if any} \..   
3eb0: 20 7b 69 73 20 6e 6f 74 20 74 68 65 20 63 68 69   {is not the chi
3ec0: 6c 64 20 6f 66 20 69 74 73 20 70 61 72 65 6e 74  ld of its parent
3ed0: 7d 20 7b 0a 09 09 53 45 4c 45 43 54 20 46 2e 6e  } {...SELECT F.n
3ee0: 61 6d 65 2c 20 52 2e 72 65 76 0a 09 09 46 52 4f  ame, R.rev...FRO
3ef0: 4d 20 72 65 76 69 73 69 6f 6e 20 52 2c 20 72 65  M revision R, re
3f00: 76 69 73 69 6f 6e 20 50 2c 20 66 69 6c 65 20 46  vision P, file F
3f10: 0a 09 09 57 48 45 52 45 20 52 2e 66 69 64 20 3d  ...WHERE R.fid =
3f20: 20 46 2e 66 69 64 0a 09 09 41 4e 44 20 20 20 52   F.fid...AND   R
3f30: 2e 62 70 61 72 65 6e 74 20 49 53 20 4e 55 4c 4c  .bparent IS NULL
3f40: 0a 09 09 41 4e 44 20 20 20 52 2e 70 61 72 65 6e  ...AND   R.paren
3f50: 74 20 49 53 20 4e 4f 54 20 4e 55 4c 4c 0a 09 09  t IS NOT NULL...
3f60: 41 4e 44 20 20 20 52 2e 70 61 72 65 6e 74 20 3d  AND   R.parent =
3f70: 20 50 2e 72 69 64 0a 09 09 41 4e 44 20 20 20 50   P.rid...AND   P
3f80: 2e 63 68 69 6c 64 20 21 3d 20 52 2e 72 69 64 0a  .child != R.rid.
3f90: 09 09 3b 0a 09 20 20 20 20 7d 0a 09 23 20 46 69  ..;..    }..# Fi
3fa0: 6e 64 20 61 6c 6c 20 72 65 76 69 73 69 6f 6e 73  nd all revisions
3fb0: 20 77 69 74 68 20 61 20 62 72 61 6e 63 68 20 70   with a branch p
3fc0: 61 72 65 6e 74 20 73 79 6d 62 6f 6c 20 77 68 69  arent symbol whi
3fd0: 63 68 20 64 6f 20 6e 6f 74 0a 09 23 20 68 61 76  ch do not..# hav
3fe0: 65 20 61 20 70 61 72 65 6e 74 2e 0a 09 43 68 65  e a parent...Che
3ff0: 63 6b 20 5c 0a 09 20 20 20 20 7b 42 72 61 6e 63  ck \..    {Branc
4000: 68 20 73 74 61 72 74 69 6e 67 20 72 65 76 69 73  h starting revis
4010: 69 6f 6e 73 20 68 61 76 65 20 74 6f 20 68 61 76  ions have to hav
4020: 65 20 61 20 70 61 72 65 6e 74 7d 20 5c 0a 09 20  e a parent} \.. 
4030: 20 20 20 7b 61 74 20 74 68 65 20 62 65 67 69 6e     {at the begin
4040: 6e 69 6e 67 20 6f 66 20 69 74 73 20 62 72 61 6e  ning of its bran
4050: 63 68 20 68 61 73 20 6e 6f 20 70 61 72 65 6e 74  ch has no parent
4060: 7d 20 7b 0a 09 09 53 45 4c 45 43 54 20 46 2e 6e  } {...SELECT F.n
4070: 61 6d 65 2c 20 52 2e 72 65 76 0a 09 09 46 52 4f  ame, R.rev...FRO
4080: 4d 20 72 65 76 69 73 69 6f 6e 20 52 2c 20 66 69  M revision R, fi
4090: 6c 65 20 46 0a 09 09 57 48 45 52 45 20 52 2e 66  le F...WHERE R.f
40a0: 69 64 20 3d 20 46 2e 66 69 64 0a 09 09 41 4e 44  id = F.fid...AND
40b0: 20 20 20 52 2e 62 70 61 72 65 6e 74 20 49 53 20     R.bparent IS 
40c0: 4e 4f 54 20 4e 55 4c 4c 0a 09 09 41 4e 44 20 20  NOT NULL...AND  
40d0: 20 52 2e 70 61 72 65 6e 74 20 49 53 20 4e 55 4c   R.parent IS NUL
40e0: 4c 0a 09 09 3b 0a 09 20 20 20 20 7d 0a 09 23 20  L...;..    }..# 
40f0: 46 69 6e 64 20 61 6c 6c 20 72 65 76 69 73 69 6f  Find all revisio
4100: 6e 73 20 77 69 74 68 20 61 20 62 72 61 6e 63 68  ns with a branch
4110: 20 70 61 72 65 6e 74 20 73 79 6d 62 6f 6c 20 77   parent symbol w
4120: 68 6f 73 65 20 70 61 72 65 6e 74 0a 09 23 20 68  hose parent..# h
4130: 61 73 20 74 68 65 6d 20 61 73 20 70 72 69 6d 61  as them as prima
4140: 72 79 20 63 68 69 6c 64 2e 0a 09 43 68 65 63 6b  ry child...Check
4150: 20 5c 0a 09 20 20 20 20 7b 42 72 61 6e 63 68 20   \..    {Branch 
4160: 73 74 61 72 74 69 6e 67 20 72 65 76 69 73 69 6f  starting revisio
4170: 6e 73 20 6d 75 73 74 20 6e 6f 74 20 62 65 20 70  ns must not be p
4180: 72 69 6d 61 72 79 20 63 68 69 6c 64 72 65 6e 20  rimary children 
4190: 6f 66 20 74 68 65 69 72 20 70 61 72 65 6e 74 73  of their parents
41a0: 7d 20 5c 0a 09 20 20 20 20 7b 61 74 20 74 68 65  } \..    {at the
41b0: 20 62 65 67 69 6e 6e 69 6e 67 20 6f 66 20 69 74   beginning of it
41c0: 73 20 62 72 61 6e 63 68 20 69 73 20 74 68 65 20  s branch is the 
41d0: 70 72 69 6d 61 72 79 20 63 68 69 6c 64 20 6f 66  primary child of
41e0: 20 69 74 73 20 70 61 72 65 6e 74 7d 20 7b 0a 09   its parent} {..
41f0: 09 53 45 4c 45 43 54 20 46 2e 6e 61 6d 65 2c 20  .SELECT F.name, 
4200: 52 2e 72 65 76 0a 09 09 46 52 4f 4d 20 72 65 76  R.rev...FROM rev
4210: 69 73 69 6f 6e 20 52 2c 20 72 65 76 69 73 69 6f  ision R, revisio
4220: 6e 20 50 2c 20 66 69 6c 65 20 46 0a 09 09 57 48  n P, file F...WH
4230: 45 52 45 20 52 2e 66 69 64 20 3d 20 46 2e 66 69  ERE R.fid = F.fi
4240: 64 0a 09 09 41 4e 44 20 20 20 52 2e 62 70 61 72  d...AND   R.bpar
4250: 65 6e 74 20 49 53 20 4e 4f 54 20 4e 55 4c 4c 0a  ent IS NOT NULL.
4260: 09 09 41 4e 44 20 20 20 52 2e 70 61 72 65 6e 74  ..AND   R.parent
4270: 20 49 53 20 4e 4f 54 20 4e 55 4c 4c 0a 09 09 41   IS NOT NULL...A
4280: 4e 44 20 20 20 52 2e 70 61 72 65 6e 74 20 3d 20  ND   R.parent = 
4290: 50 2e 72 69 64 0a 09 09 41 4e 44 20 20 20 50 2e  P.rid...AND   P.
42a0: 63 68 69 6c 64 20 3d 20 52 2e 72 69 64 0a 09 09  child = R.rid...
42b0: 3b 0a 09 20 20 20 20 7d 0a 09 23 20 46 69 6e 64  ;..    }..# Find
42c0: 20 61 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 77   all revisions w
42d0: 69 74 68 20 61 20 6e 6f 6e 2d 4e 54 44 42 20 63  ith a non-NTDB c
42e0: 68 69 6c 64 20 77 68 69 63 68 20 61 72 65 20 6e  hild which are n
42f0: 6f 74 20 6f 6e 0a 09 23 20 74 68 65 20 4e 54 44  ot on..# the NTD
4300: 42 2e 0a 09 43 68 65 63 6b 20 5c 0a 09 20 20 20  B...Check \..   
4310: 20 7b 4e 54 44 42 20 74 6f 20 74 72 75 6e 6b 20   {NTDB to trunk 
4320: 74 72 61 6e 73 69 74 69 6f 6e 20 68 61 73 20 74  transition has t
4330: 6f 20 62 65 67 69 6e 20 6f 6e 20 4e 54 44 42 7d  o begin on NTDB}
4340: 20 5c 0a 09 20 20 20 20 7b 68 61 73 20 61 20 6e   \..    {has a n
4350: 6f 6e 2d 4e 54 44 42 20 63 68 69 6c 64 2c 20 79  on-NTDB child, y
4360: 65 74 20 69 73 20 6e 6f 74 20 6f 6e 20 74 68 65  et is not on the
4370: 20 4e 54 44 42 7d 20 7b 0a 09 09 53 45 4c 45 43   NTDB} {...SELEC
4380: 54 20 46 2e 6e 61 6d 65 2c 20 52 2e 72 65 76 0a  T F.name, R.rev.
4390: 09 09 46 52 4f 4d 20 72 65 76 69 73 69 6f 6e 20  ..FROM revision 
43a0: 52 2c 20 66 69 6c 65 20 46 0a 09 09 57 48 45 52  R, file F...WHER
43b0: 45 20 52 2e 66 69 64 20 3d 20 46 2e 66 69 64 0a  E R.fid = F.fid.
43c0: 09 09 41 4e 44 20 20 20 52 2e 64 62 63 68 69 6c  ..AND   R.dbchil
43d0: 64 20 49 53 20 4e 4f 54 20 4e 55 4c 4c 0a 09 09  d IS NOT NULL...
43e0: 41 4e 44 20 20 20 4e 4f 54 20 52 2e 69 73 64 65  AND   NOT R.isde
43f0: 66 61 75 6c 74 0a 09 09 3b 0a 09 20 20 20 20 7d  fault...;..    }
4400: 0a 09 23 20 46 69 6e 64 20 61 6c 6c 20 72 65 76  ..# Find all rev
4410: 69 73 69 6f 6e 73 20 77 69 74 68 20 61 20 4e 54  isions with a NT
4420: 44 42 20 70 61 72 65 6e 74 20 77 68 69 63 68 20  DB parent which 
4430: 61 72 65 20 6f 6e 20 74 68 65 20 4e 54 44 42 2e  are on the NTDB.
4440: 0a 09 43 68 65 63 6b 20 5c 0a 09 20 20 20 20 7b  ..Check \..    {
4450: 4e 54 44 42 20 74 6f 20 74 72 75 6e 6b 20 74 72  NTDB to trunk tr
4460: 61 6e 73 69 74 69 6f 6e 20 68 61 73 20 74 6f 20  ansition has to 
4470: 65 6e 64 20 6f 6e 20 6e 6f 6e 2d 4e 54 44 42 7d  end on non-NTDB}
4480: 20 5c 0a 09 20 20 20 20 7b 68 61 73 20 61 20 4e   \..    {has a N
4490: 54 44 42 20 70 61 72 65 6e 74 2c 20 79 65 74 20  TDB parent, yet 
44a0: 69 73 20 6f 6e 20 74 68 65 20 4e 54 44 42 7d 20  is on the NTDB} 
44b0: 7b 0a 09 09 53 45 4c 45 43 54 20 46 2e 6e 61 6d  {...SELECT F.nam
44c0: 65 2c 20 52 2e 72 65 76 0a 09 09 46 52 4f 4d 20  e, R.rev...FROM 
44d0: 72 65 76 69 73 69 6f 6e 20 52 2c 20 66 69 6c 65  revision R, file
44e0: 20 46 0a 09 09 57 48 45 52 45 20 52 2e 66 69 64   F...WHERE R.fid
44f0: 20 3d 20 46 2e 66 69 64 0a 09 09 41 4e 44 20 20   = F.fid...AND  
4500: 20 52 2e 64 62 70 61 72 65 6e 74 20 49 53 20 4e   R.dbparent IS N
4510: 4f 54 20 4e 55 4c 4c 0a 09 09 41 4e 44 20 20 20  OT NULL...AND   
4520: 52 2e 69 73 64 65 66 61 75 6c 74 0a 09 09 3b 0a  R.isdefault...;.
4530: 09 20 20 20 20 7d 0a 09 23 20 46 69 6e 64 20 61  .    }..# Find a
4540: 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 77 69 74  ll revisions wit
4550: 68 20 61 20 63 68 69 6c 64 20 77 68 69 63 68 20  h a child which 
4560: 64 69 73 61 67 72 65 65 73 20 61 62 6f 75 74 20  disagrees about 
4570: 74 68 65 0a 09 23 20 6c 69 6e 65 20 6f 66 20 64  the..# line of d
4580: 65 76 65 6c 6f 70 6d 65 6e 74 20 74 68 65 79 20  evelopment they 
4590: 62 65 6c 6f 6e 67 20 74 6f 2e 0a 09 43 68 65 63  belong to...Chec
45a0: 6b 20 5c 0a 09 20 20 20 20 7b 52 65 76 69 73 69  k \..    {Revisi
45b0: 6f 6e 73 20 61 6e 64 20 74 68 65 69 72 20 70 72  ons and their pr
45c0: 69 6d 61 72 79 20 63 68 69 6c 64 72 65 6e 20 68  imary children h
45d0: 61 76 65 20 74 6f 20 62 65 20 69 6e 20 74 68 65  ave to be in the
45e0: 20 73 61 6d 65 20 4c 4f 44 7d 20 5c 0a 09 20 20   same LOD} \..  
45f0: 20 20 7b 61 6e 64 20 69 74 73 20 70 72 69 6d 61    {and its prima
4600: 72 79 20 63 68 69 6c 64 20 64 69 73 61 67 72 65  ry child disagre
4610: 65 20 61 62 6f 75 74 20 74 68 65 69 72 20 4c 4f  e about their LO
4620: 44 7d 20 7b 0a 09 09 53 45 4c 45 43 54 20 46 2e  D} {...SELECT F.
4630: 6e 61 6d 65 2c 20 52 2e 72 65 76 0a 09 09 46 52  name, R.rev...FR
4640: 4f 4d 20 72 65 76 69 73 69 6f 6e 20 52 2c 20 72  OM revision R, r
4650: 65 76 69 73 69 6f 6e 20 43 2c 20 66 69 6c 65 20  evision C, file 
4660: 46 0a 09 09 57 48 45 52 45 20 52 2e 66 69 64 20  F...WHERE R.fid 
4670: 3d 20 46 2e 66 69 64 0a 09 09 41 4e 44 20 20 20  = F.fid...AND   
4680: 52 2e 63 68 69 6c 64 20 49 53 20 4e 4f 54 20 4e  R.child IS NOT N
4690: 55 4c 4c 0a 09 09 41 4e 44 20 20 20 52 2e 63 68  ULL...AND   R.ch
46a0: 69 6c 64 20 3d 20 43 2e 72 69 64 0a 09 09 41 4e  ild = C.rid...AN
46b0: 44 20 20 20 43 2e 6c 6f 64 20 21 3d 20 52 2e 6c  D   C.lod != R.l
46c0: 6f 64 0a 09 09 3b 0a 09 20 20 20 20 7d 0a 09 23  od...;..    }..#
46d0: 20 46 69 6e 64 20 61 6c 6c 20 72 65 76 69 73 69   Find all revisi
46e0: 6f 6e 73 20 77 69 74 68 20 61 20 6e 6f 6e 2d 4e  ons with a non-N
46f0: 54 44 42 20 63 68 69 6c 64 20 77 68 69 63 68 20  TDB child which 
4700: 61 67 72 65 65 73 20 61 62 6f 75 74 0a 09 23 20  agrees about..# 
4710: 74 68 65 20 6c 69 6e 65 20 6f 66 20 64 65 76 65  the line of deve
4720: 6c 6f 70 6d 65 6e 74 20 74 68 65 79 20 62 65 6c  lopment they bel
4730: 6f 6e 67 20 74 6f 2e 0a 09 43 68 65 63 6b 20 5c  ong to...Check \
4740: 0a 09 20 20 20 20 7b 4e 54 44 42 20 61 6e 64 20  ..    {NTDB and 
4750: 74 72 75 6e 6b 20 72 65 76 69 73 69 6f 6e 73 20  trunk revisions 
4760: 68 61 76 65 20 74 6f 20 62 65 20 69 6e 20 64 69  have to be in di
4770: 66 66 65 72 65 6e 74 20 4c 4f 44 73 7d 20 5c 0a  fferent LODs} \.
4780: 09 20 20 20 20 7b 6f 6e 20 4e 54 44 42 20 61 6e  .    {on NTDB an
4790: 64 20 69 74 73 20 6e 6f 6e 2d 4e 54 44 42 20 63  d its non-NTDB c
47a0: 68 69 6c 64 20 77 72 6f 6e 67 6c 79 20 61 67 72  hild wrongly agr
47b0: 65 65 20 61 62 6f 75 74 20 74 68 65 69 72 20 4c  ee about their L
47c0: 4f 44 7d 20 7b 0a 09 09 53 45 4c 45 43 54 20 46  OD} {...SELECT F
47d0: 2e 6e 61 6d 65 2c 20 52 2e 72 65 76 0a 09 09 46  .name, R.rev...F
47e0: 52 4f 4d 20 72 65 76 69 73 69 6f 6e 20 52 2c 20  ROM revision R, 
47f0: 72 65 76 69 73 69 6f 6e 20 43 2c 20 66 69 6c 65  revision C, file
4800: 20 46 0a 09 09 57 48 45 52 45 20 52 2e 66 69 64   F...WHERE R.fid
4810: 20 3d 20 46 2e 66 69 64 0a 09 09 41 4e 44 20 20   = F.fid...AND  
4820: 20 52 2e 64 62 63 68 69 6c 64 20 49 53 20 4e 4f   R.dbchild IS NO
4830: 54 20 4e 55 4c 4c 0a 09 09 41 4e 44 20 20 20 52  T NULL...AND   R
4840: 2e 64 62 63 68 69 6c 64 20 3d 20 43 2e 72 69 64  .dbchild = C.rid
4850: 0a 09 09 41 4e 44 20 20 20 43 2e 6c 6f 64 20 3d  ...AND   C.lod =
4860: 20 52 2e 6c 6f 64 0a 09 09 3b 0a 09 20 20 20 20   R.lod...;..    
4870: 7d 0a 09 23 20 46 69 6e 64 20 61 6c 6c 20 72 65  }..# Find all re
4880: 76 69 73 69 6f 6e 73 20 77 69 74 68 20 61 20 62  visions with a b
4890: 72 61 6e 63 68 20 70 61 72 65 6e 74 20 73 79 6d  ranch parent sym
48a0: 62 6f 6c 20 77 68 69 63 68 20 69 73 20 6e 6f 74  bol which is not
48b0: 0a 09 23 20 74 68 65 69 72 20 4c 4f 44 2e 0a 09  ..# their LOD...
48c0: 43 68 65 63 6b 20 5c 0a 09 20 20 20 20 7b 42 72  Check \..    {Br
48d0: 61 6e 63 68 20 73 74 61 72 74 69 6e 67 20 72 65  anch starting re
48e0: 76 69 73 69 6f 6e 73 20 68 61 76 65 20 74 6f 20  visions have to 
48f0: 68 61 76 65 20 74 68 65 69 72 20 4c 4f 44 20 61  have their LOD a
4900: 73 20 62 72 61 6e 63 68 20 70 61 72 65 6e 74 20  s branch parent 
4910: 73 79 6d 62 6f 6c 7d 20 5c 0a 09 20 20 20 20 7b  symbol} \..    {
4920: 61 74 20 74 68 65 20 62 65 67 69 6e 6e 69 6e 67  at the beginning
4930: 20 6f 66 20 69 74 73 20 62 72 61 6e 63 68 20 64   of its branch d
4940: 6f 65 73 20 6e 6f 74 20 68 61 76 65 20 74 68 65  oes not have the
4950: 20 62 72 61 6e 63 68 20 73 79 6d 62 6f 6c 20 61   branch symbol a
4960: 73 20 69 74 73 20 4c 4f 44 7d 20 7b 0a 09 09 53  s its LOD} {...S
4970: 45 4c 45 43 54 20 46 2e 6e 61 6d 65 2c 20 52 2e  ELECT F.name, R.
4980: 72 65 76 0a 09 09 46 52 4f 4d 20 72 65 76 69 73  rev...FROM revis
4990: 69 6f 6e 20 52 2c 20 66 69 6c 65 20 46 0a 09 09  ion R, file F...
49a0: 57 48 45 52 45 20 52 2e 66 69 64 20 3d 20 46 2e  WHERE R.fid = F.
49b0: 66 69 64 0a 09 09 41 4e 44 20 20 20 52 2e 62 70  fid...AND   R.bp
49c0: 61 72 65 6e 74 20 49 53 20 4e 4f 54 20 4e 55 4c  arent IS NOT NUL
49d0: 4c 0a 09 09 41 4e 44 20 20 20 52 2e 6c 6f 64 20  L...AND   R.lod 
49e0: 21 3d 20 52 2e 62 70 61 72 65 6e 74 0a 09 09 3b  != R.bparent...;
49f0: 0a 09 20 20 20 20 7d 0a 09 23 20 46 69 6e 64 20  ..    }..# Find 
4a00: 61 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 77 69  all revisions wi
4a10: 74 68 20 61 20 62 72 61 6e 63 68 20 70 61 72 65  th a branch pare
4a20: 6e 74 20 73 79 6d 62 6f 6c 20 77 68 6f 73 65 20  nt symbol whose 
4a30: 70 61 72 65 6e 74 0a 09 23 20 69 73 20 69 6e 20  parent..# is in 
4a40: 74 68 65 20 73 61 6d 65 20 6c 69 6e 65 20 6f 66  the same line of
4a50: 20 64 65 76 65 6c 6f 70 6d 65 6e 74 2e 0a 09 43   development...C
4a60: 68 65 63 6b 20 5c 0a 09 20 20 20 20 7b 52 65 76  heck \..    {Rev
4a70: 69 73 69 6f 6e 73 20 61 6e 64 20 74 68 65 69 72  isions and their
4a80: 20 62 72 61 6e 63 68 20 63 68 69 6c 64 72 65 6e   branch children
4a90: 20 68 61 76 65 20 74 6f 20 62 65 20 69 6e 20 64   have to be in d
4aa0: 69 66 66 65 72 65 6e 74 20 4c 4f 44 73 7d 20 5c  ifferent LODs} \
4ab0: 0a 09 20 20 20 20 7b 61 74 20 74 68 65 20 62 65  ..    {at the be
4ac0: 67 69 6e 6e 69 6e 67 20 6f 66 20 69 74 73 20 62  ginning of its b
4ad0: 72 61 6e 63 68 20 61 6e 64 20 69 74 73 20 70 61  ranch and its pa
4ae0: 72 65 6e 74 20 77 72 6f 6e 67 6c 79 20 61 67 72  rent wrongly agr
4af0: 65 65 20 61 62 6f 75 74 20 74 68 65 69 72 20 4c  ee about their L
4b00: 4f 44 7d 20 7b 0a 09 09 53 45 4c 45 43 54 20 46  OD} {...SELECT F
4b10: 2e 6e 61 6d 65 2c 20 52 2e 72 65 76 0a 09 09 46  .name, R.rev...F
4b20: 52 4f 4d 20 72 65 76 69 73 69 6f 6e 20 52 2c 20  ROM revision R, 
4b30: 72 65 76 69 73 69 6f 6e 20 50 2c 20 66 69 6c 65  revision P, file
4b40: 20 46 0a 09 09 57 48 45 52 45 20 52 2e 66 69 64   F...WHERE R.fid
4b50: 20 3d 20 46 2e 66 69 64 0a 09 09 41 4e 44 20 20   = F.fid...AND  
4b60: 20 52 2e 62 70 61 72 65 6e 74 20 49 53 20 4e 4f   R.bparent IS NO
4b70: 54 20 4e 55 4c 4c 0a 09 09 41 4e 44 20 20 20 52  T NULL...AND   R
4b80: 2e 70 61 72 65 6e 74 20 3d 20 50 2e 72 69 64 0a  .parent = P.rid.
4b90: 09 09 41 4e 44 20 20 20 52 2e 6c 6f 64 20 3d 20  ..AND   R.lod = 
4ba0: 50 2e 6c 6f 64 0a 09 09 3b 0a 09 20 20 20 20 7d  P.lod...;..    }
4bb0: 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a  ..return.    }..
4bc0: 20 20 20 20 70 72 6f 63 20 43 68 65 63 6b 20 7b      proc Check {
4bd0: 68 65 61 64 65 72 20 6c 61 62 65 6c 20 73 71 6c  header label sql
4be0: 7d 20 7b 0a 09 75 70 76 61 72 20 31 20 6e 20 6e  } {..upvar 1 n n
4bf0: 0a 09 73 65 74 20 6f 6b 20 31 0a 09 66 6f 72 65  ..set ok 1..fore
4c00: 61 63 68 20 7b 66 6e 61 6d 65 20 72 65 76 6e 72  ach {fname revnr
4c10: 7d 20 5b 73 74 61 74 65 20 72 75 6e 20 24 73 71  } [state run $sq
4c20: 6c 5d 20 7b 0a 09 20 20 20 20 73 65 74 20 6f 6b  l] {..    set ok
4c30: 20 30 0a 09 20 20 20 20 74 72 6f 75 62 6c 65 20   0..    trouble 
4c40: 66 61 74 61 6c 20 22 24 66 6e 61 6d 65 20 3c 24  fatal "$fname <$
4c50: 72 65 76 6e 72 3e 20 24 6c 61 62 65 6c 22 0a 09  revnr> $label"..
4c60: 7d 0a 09 6c 6f 67 20 77 72 69 74 65 20 35 20 63  }..log write 5 c
4c70: 6f 6c 6c 72 65 76 20 22 5c 5b 5b 66 6f 72 6d 61  ollrev "\[[forma
4c80: 74 20 25 30 32 64 20 5b 69 6e 63 72 20 6e 5d 5d  t %02d [incr n]]
4c90: 5c 5d 20 5b 65 78 70 72 20 7b 24 6f 6b 20 3f 20  \] [expr {$ok ? 
4ca0: 22 4f 6b 20 20 20 20 22 20 3a 20 22 46 61 69 6c  "Ok    " : "Fail
4cb0: 65 64 22 7d 5d 20 2e 2e 2e 20 24 68 65 61 64 65  ed"}] ... $heade
4cc0: 72 22 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 7d  r"..return.    }
4cd0: 0a 0a 20 20 20 20 23 20 23 20 23 23 20 23 23 23  ..    # # ## ###
4ce0: 20 23 23 23 23 23 20 23 23 23 23 23 23 23 23 20   ##### ######## 
4cf0: 23 23 23 23 23 23 23 23 23 23 23 23 23 0a 20 20  #############.  
4d00: 20 20 23 23 20 49 6e 74 65 72 6e 61 6c 20 6d 65    ## Internal me
4d10: 74 68 6f 64 73 0a 0a 20 20 20 20 23 20 23 20 23  thods..    # # #
4d20: 23 20 23 23 23 20 23 23 23 23 23 20 23 23 23 23  # ### ##### ####
4d30: 23 23 23 23 20 23 23 23 23 23 23 23 23 23 23 23  #### ###########
4d40: 23 23 0a 20 20 20 20 23 23 20 43 6f 6e 66 69 67  ##.    ## Config
4d50: 75 72 61 74 69 6f 6e 0a 0a 20 20 20 20 70 72 61  uration..    pra
4d60: 67 6d 61 20 2d 68 61 73 69 6e 73 74 61 6e 63 65  gma -hasinstance
4d70: 73 20 20 20 6e 6f 20 3b 20 23 20 73 69 6e 67 6c  s   no ; # singl
4d80: 65 74 6f 6e 0a 20 20 20 20 70 72 61 67 6d 61 20  eton.    pragma 
4d90: 2d 68 61 73 74 79 70 65 69 6e 66 6f 20 20 20 20  -hastypeinfo    
4da0: 6e 6f 20 3b 20 23 20 6e 6f 20 69 6e 74 72 6f 73  no ; # no intros
4db0: 70 65 63 74 69 6f 6e 0a 20 20 20 20 70 72 61 67  pection.    prag
4dc0: 6d 61 20 2d 68 61 73 74 79 70 65 64 65 73 74 72  ma -hastypedestr
4dd0: 6f 79 20 6e 6f 20 3b 20 23 20 69 6d 6d 6f 72 74  oy no ; # immort
4de0: 61 6c 0a 0a 20 20 20 20 23 20 23 20 23 23 20 23  al..    # # ## #
4df0: 23 23 20 23 23 23 23 23 20 23 23 23 23 23 23 23  ## ##### #######
4e00: 23 20 23 23 23 23 23 23 23 23 23 23 23 23 23 0a  # #############.
4e10: 7d 0a 0a 6e 61 6d 65 73 70 61 63 65 20 65 76 61  }..namespace eva
4e20: 6c 20 3a 3a 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a  l ::vc::fossil::
4e30: 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 70 61 73  import::cvs::pas
4e40: 73 20 7b 0a 20 20 20 20 6e 61 6d 65 73 70 61 63  s {.    namespac
4e50: 65 20 65 78 70 6f 72 74 20 63 6f 6c 6c 72 65 76  e export collrev
4e60: 0a 20 20 20 20 6e 61 6d 65 73 70 61 63 65 20 65  .    namespace e
4e70: 76 61 6c 20 63 6f 6c 6c 72 65 76 20 7b 0a 09 6e  val collrev {..n
4e80: 61 6d 65 73 70 61 63 65 20 69 6d 70 6f 72 74 20  amespace import 
4e90: 3a 3a 76 63 3a 3a 72 63 73 3a 3a 70 61 72 73 65  ::vc::rcs::parse
4ea0: 72 0a 09 6e 61 6d 65 73 70 61 63 65 20 69 6d 70  r..namespace imp
4eb0: 6f 72 74 20 3a 3a 76 63 3a 3a 66 6f 73 73 69 6c  ort ::vc::fossil
4ec0: 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 72  ::import::cvs::r
4ed0: 65 70 6f 73 69 74 6f 72 79 0a 09 6e 61 6d 65 73  epository..names
4ee0: 70 61 63 65 20 69 6d 70 6f 72 74 20 3a 3a 76 63  pace import ::vc
4ef0: 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 74  ::fossil::import
4f00: 3a 3a 63 76 73 3a 3a 73 74 61 74 65 0a 09 6e 61  ::cvs::state..na
4f10: 6d 65 73 70 61 63 65 20 65 76 61 6c 20 70 72 6f  mespace eval pro
4f20: 6a 65 63 74 20 7b 0a 09 20 20 20 20 6e 61 6d 65  ject {..    name
4f30: 73 70 61 63 65 20 69 6d 70 6f 72 74 20 3a 3a 76  space import ::v
4f40: 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72  c::fossil::impor
4f50: 74 3a 3a 63 76 73 3a 3a 70 72 6f 6a 65 63 74 3a  t::cvs::project:
4f60: 3a 73 79 6d 0a 09 7d 0a 09 6e 61 6d 65 73 70 61  :sym..}..namespa
4f70: 63 65 20 69 6d 70 6f 72 74 20 3a 3a 76 63 3a 3a  ce import ::vc::
4f80: 74 6f 6f 6c 73 3a 3a 74 72 6f 75 62 6c 65 0a 09  tools::trouble..
4f90: 6e 61 6d 65 73 70 61 63 65 20 69 6d 70 6f 72 74  namespace import
4fa0: 20 3a 3a 76 63 3a 3a 74 6f 6f 6c 73 3a 3a 6c 6f   ::vc::tools::lo
4fb0: 67 0a 09 6c 6f 67 20 72 65 67 69 73 74 65 72 20  g..log register 
4fc0: 63 6f 6c 6c 72 65 76 0a 20 20 20 20 7d 0a 7d 0a  collrev.    }.}.
4fd0: 0a 23 20 23 20 23 23 20 23 23 23 20 23 23 23 23  .# # ## ### ####
4fe0: 23 20 23 23 23 23 23 23 23 23 20 23 23 23 23 23  # ######## #####
4ff0: 23 23 23 23 23 23 23 23 20 23 23 23 23 23 23 23  ######## #######
5000: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 0a 23  ##############.#
5010: 23 20 52 65 61 64 79 0a 0a 70 61 63 6b 61 67 65  # Ready..package
5020: 20 70 72 6f 76 69 64 65 20 76 63 3a 3a 66 6f 73   provide vc::fos
5030: 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73  sil::import::cvs
5040: 3a 3a 70 61 73 73 3a 3a 63 6f 6c 6c 72 65 76 20  ::pass::collrev 
5050: 31 2e 30 0a 72 65 74 75 72 6e 0a                 1.0.return.