Hex Artifact Content
Not logged in

Artifact 0cf7d28b6923f940fd95a6d430c62097ad406d70:

File tools/cvs2fossil/lib/c2f_pcollrev.tcl part of check-in [2c08006d9d] - Changed the coding of trunk symbols. Using NULL makes for difficult comparisons later when doing integrity checks. Each trunk now has a regular unique id as a symbol. Added documentation to the table definitions, about references, constraints, etc. by aku on 2007-10-25 05:13:41.

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 65 63  parses the colec
0220: 74 65 64 20 72 63 73 20 61 72 63 68 69 76 65 73  ted rcs archives
0230: 20 61 6e 64 20 65 78 74 72 61 63 74 73 0a 23 23   and extracts.##
0240: 20 61 6c 6c 20 74 68 65 20 69 6e 66 6f 72 6d 61   all the informa
0250: 74 69 6f 6e 20 74 68 65 79 20 63 6f 6e 74 61 69  tion they contai
0260: 6e 20 28 72 65 76 69 73 69 6f 6e 73 2c 20 61 6e  n (revisions, an
0270: 64 20 73 79 6d 62 6f 6c 73 29 2e 0a 0a 23 20 23  d symbols)...# #
0280: 20 23 23 20 23 23 23 20 23 23 23 23 23 20 23 23   ## ### ##### ##
0290: 23 23 23 23 23 23 20 23 23 23 23 23 23 23 23 23  ###### #########
02a0: 23 23 23 23 20 23 23 23 23 23 23 23 23 23 23 23  #### ###########
02b0: 23 23 23 23 23 23 23 23 23 23 0a 23 23 20 52 65  ##########.## Re
02c0: 71 75 69 72 65 6d 65 6e 74 73 0a 0a 70 61 63 6b  quirements..pack
02d0: 61 67 65 20 72 65 71 75 69 72 65 20 54 63 6c 20  age require Tcl 
02e0: 38 2e 34 20 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: 3b 20 23 20 52 65 71 75 69 72 65 64 20 72 75 6e  ; # Required run
0310: 74 69 6d 65 2e 0a 70 61 63 6b 61 67 65 20 72 65  time..package re
0320: 71 75 69 72 65 20 73 6e 69 74 20 20 20 20 20 20  quire 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 3b 20 23 20 4f 4f            ; # OO
0350: 20 73 79 73 74 65 6d 2e 0a 70 61 63 6b 61 67 65   system..package
0360: 20 72 65 71 75 69 72 65 20 66 69 6c 65 75 74 69   require fileuti
0370: 6c 3a 3a 74 72 61 76 65 72 73 65 20 20 20 20 20  l::traverse     
0380: 20 20 20 20 20 20 20 20 20 20 20 20 20 3b 20 23               ; #
0390: 20 44 69 72 65 63 74 6f 72 79 20 74 72 61 76 65   Directory trave
03a0: 72 73 61 6c 2e 0a 70 61 63 6b 61 67 65 20 72 65  rsal..package re
03b0: 71 75 69 72 65 20 66 69 6c 65 75 74 69 6c 20 20  quire fileutil  
03c0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
03d0: 20 20 20 20 20 20 20 20 20 20 3b 20 23 20 46 69            ; # Fi
03e0: 6c 65 20 26 20 70 61 74 68 20 75 74 69 6c 69 74  le & path utilit
03f0: 69 65 73 2e 0a 70 61 63 6b 61 67 65 20 72 65 71  ies..package req
0400: 75 69 72 65 20 76 63 3a 3a 74 6f 6f 6c 73 3a 3a  uire vc::tools::
0410: 74 72 6f 75 62 6c 65 20 20 20 20 20 20 20 20 20  trouble         
0420: 20 20 20 20 20 20 20 20 20 3b 20 23 20 45 72 72           ; # Err
0430: 6f 72 20 72 65 70 6f 72 74 69 6e 67 2e 0a 70 61  or reporting..pa
0440: 63 6b 61 67 65 20 72 65 71 75 69 72 65 20 76 63  ckage require vc
0450: 3a 3a 74 6f 6f 6c 73 3a 3a 6c 6f 67 20 20 20 20  ::tools::log    
0460: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
0470: 20 20 3b 20 23 20 55 73 65 72 20 66 65 65 64 62    ; # User feedb
0480: 61 63 6b 2e 0a 70 61 63 6b 61 67 65 20 72 65 71  ack..package req
0490: 75 69 72 65 20 76 63 3a 3a 66 6f 73 73 69 6c 3a  uire vc::fossil:
04a0: 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 70 61  :import::cvs::pa
04b0: 73 73 20 20 20 20 20 20 20 3b 20 23 20 50 61 73  ss       ; # Pas
04c0: 73 20 6d 61 6e 61 67 65 6d 65 6e 74 2e 0a 70 61  s management..pa
04d0: 63 6b 61 67 65 20 72 65 71 75 69 72 65 20 76 63  ckage require vc
04e0: 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 74  ::fossil::import
04f0: 3a 3a 63 76 73 3a 3a 72 65 70 6f 73 69 74 6f 72  ::cvs::repositor
0500: 79 20 3b 20 23 20 52 65 70 6f 73 69 74 6f 72 79  y ; # Repository
0510: 20 6d 61 6e 61 67 65 6d 65 6e 74 2e 0a 70 61 63   management..pac
0520: 6b 61 67 65 20 72 65 71 75 69 72 65 20 76 63 3a  kage require vc:
0530: 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a  :fossil::import:
0540: 3a 63 76 73 3a 3a 73 74 61 74 65 20 20 20 20 20  :cvs::state     
0550: 20 3b 20 23 20 53 74 61 74 65 20 73 74 6f 72 61   ; # State stora
0560: 67 65 2e 0a 70 61 63 6b 61 67 65 20 72 65 71 75  ge..package requ
0570: 69 72 65 20 76 63 3a 3a 72 63 73 3a 3a 70 61 72  ire vc::rcs::par
0580: 73 65 72 20 20 20 20 20 20 20 20 20 20 20 20 20  ser             
0590: 20 20 20 20 20 20 20 20 3b 20 23 20 52 63 73 20          ; # Rcs 
05a0: 61 72 63 68 69 76 65 20 64 61 74 61 20 65 78 74  archive data ext
05b0: 72 61 63 74 69 6f 6e 2e 0a 0a 23 20 23 20 23 23  raction...# # ##
05c0: 20 23 23 23 20 23 23 23 23 23 20 23 23 23 23 23   ### ##### #####
05d0: 23 23 23 20 23 23 23 23 23 23 23 23 23 23 23 23  ### ############
05e0: 23 20 23 23 23 23 23 23 23 23 23 23 23 23 23 23  # ##############
05f0: 23 23 23 23 23 23 23 0a 23 23 20 52 65 67 69 73  #######.## Regis
0600: 74 65 72 20 74 68 65 20 70 61 73 73 20 77 69 74  ter the pass wit
0610: 68 20 74 68 65 20 6d 61 6e 61 67 65 6d 65 6e 74  h the management
0620: 0a 0a 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d  ..vc::fossil::im
0630: 70 6f 72 74 3a 3a 63 76 73 3a 3a 70 61 73 73 20  port::cvs::pass 
0640: 64 65 66 69 6e 65 20 5c 0a 20 20 20 20 43 6f 6c  define \.    Col
0650: 6c 65 63 74 52 65 76 20 5c 0a 20 20 20 20 7b 43  lectRev \.    {C
0660: 6f 6c 6c 65 63 74 20 72 65 76 69 73 69 6f 6e 73  ollect revisions
0670: 20 61 6e 64 20 73 79 6d 62 6f 6c 73 7d 20 5c 0a   and symbols} \.
0680: 20 20 20 20 3a 3a 76 63 3a 3a 66 6f 73 73 69 6c      ::vc::fossil
0690: 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 70  ::import::cvs::p
06a0: 61 73 73 3a 3a 63 6f 6c 6c 72 65 76 0a 0a 23 20  ass::collrev..# 
06b0: 23 20 23 23 20 23 23 23 20 23 23 23 23 23 20 23  # ## ### ##### #
06c0: 23 23 23 23 23 23 23 20 23 23 23 23 23 23 23 23  ####### ########
06d0: 23 23 23 23 23 20 23 23 23 23 23 23 23 23 23 23  ##### ##########
06e0: 23 23 23 23 23 23 23 23 23 23 23 0a 23 23 20 0a  ###########.## .
06f0: 0a 73 6e 69 74 3a 3a 74 79 70 65 20 3a 3a 76 63  .snit::type ::vc
0700: 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 74  ::fossil::import
0710: 3a 3a 63 76 73 3a 3a 70 61 73 73 3a 3a 63 6f 6c  ::cvs::pass::col
0720: 6c 72 65 76 20 7b 0a 20 20 20 20 23 20 23 20 23  lrev {.    # # #
0730: 23 20 23 23 23 20 23 23 23 23 23 20 23 23 23 23  # ### ##### ####
0740: 23 23 23 23 20 23 23 23 23 23 23 23 23 23 23 23  #### ###########
0750: 23 23 0a 20 20 20 20 23 23 20 50 75 62 6c 69 63  ##.    ## Public
0760: 20 41 50 49 0a 0a 20 20 20 20 74 79 70 65 6d 65   API..    typeme
0770: 74 68 6f 64 20 73 65 74 75 70 20 7b 7d 20 7b 0a  thod setup {} {.
0780: 09 23 20 44 65 66 69 6e 65 20 6e 61 6d 65 73 20  .# Define names 
0790: 61 6e 64 20 73 74 72 75 63 74 75 72 65 20 6f 66  and structure of
07a0: 20 74 68 65 20 70 65 72 73 69 73 74 65 6e 74 20   the persistent 
07b0: 73 74 61 74 65 20 6f 66 20 74 68 69 73 0a 09 23  state of this..#
07c0: 20 70 61 73 73 2e 0a 0a 09 73 74 61 74 65 20 72   pass....state r
07d0: 65 61 64 69 6e 67 20 70 72 6f 6a 65 63 74 0a 09  eading project..
07e0: 73 74 61 74 65 20 72 65 61 64 69 6e 67 20 66 69  state reading fi
07f0: 6c 65 0a 0a 09 23 20 57 65 20 64 65 61 6c 20 77  le...# We deal w
0800: 69 74 68 20 70 65 72 20 70 72 6f 6a 65 63 74 20  ith per project 
0810: 61 6e 64 20 70 65 72 20 66 69 6c 65 20 64 61 74  and per file dat
0820: 61 2c 20 74 68 65 20 66 69 72 73 74 0a 09 23 20  a, the first..# 
0830: 63 6f 6c 6c 61 74 65 64 20 66 72 6f 6d 20 74 68  collated from th
0840: 65 20 73 65 63 6f 6e 64 2e 0a 0a 09 23 20 50 65  e second....# Pe
0850: 72 20 66 69 6c 65 20 77 65 20 68 61 76 65 20 67  r file we have g
0860: 65 6e 65 72 61 6c 20 69 6e 66 6f 72 6d 61 74 69  eneral informati
0870: 6f 6e 2c 20 2e 2e 2e 2c 20 61 6e 64 20 74 68 65  on, ..., and the
0880: 6e 0a 09 23 20 72 65 76 69 73 69 6f 6e 73 20 61  n..# revisions a
0890: 6e 64 20 73 79 6d 62 6f 6c 73 2e 20 54 68 65 20  nd symbols. The 
08a0: 6c 61 74 74 65 72 20 63 61 6e 20 62 65 20 66 75  latter can be fu
08b0: 72 74 68 65 72 20 73 65 70 61 72 61 74 65 64 0a  rther separated.
08c0: 09 23 20 69 6e 74 6f 20 74 61 67 73 20 61 6e 64  .# into tags and
08d0: 20 62 72 61 6e 63 68 65 73 2e 20 41 74 20 70 72   branches. At pr
08e0: 6f 6a 65 63 74 20 6c 65 76 65 6c 20 74 68 65 20  oject level the 
08f0: 70 65 72 2d 66 69 6c 65 0a 09 23 20 73 79 6d 62  per-file..# symb
0900: 6f 6c 73 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20  ols information 
0910: 69 73 20 6d 65 72 67 65 64 2e 0a 0a 09 23 20 46  is merged....# F
0920: 69 6c 65 20 6c 65 76 65 6c 20 2e 2e 2e 0a 09 23  ile level .....#
0930: 09 52 65 76 69 73 69 6f 6e 73 2c 20 42 72 61 6e  .Revisions, Bran
0940: 63 68 65 73 2c 20 54 61 67 73 0a 09 23 0a 09 23  ches, Tags..#..#
0950: 20 50 73 65 75 64 6f 20 63 6c 61 73 73 20 68 69   Pseudo class hi
0960: 65 72 61 72 63 68 79 0a 09 23 09 54 61 67 20 20  erarchy..#.Tag  
0970: 20 20 20 20 3c 2d 20 53 79 6d 62 6f 6c 20 3c 2d      <- Symbol <-
0980: 20 45 76 65 6e 74 0a 09 23 09 42 72 61 6e 63 68   Event..#.Branch
0990: 20 20 20 3c 2d 20 53 79 6d 62 6f 6c 20 3c 2d 20     <- Symbol <- 
09a0: 45 76 65 6e 74 0a 09 23 09 52 65 76 69 73 69 6f  Event..#.Revisio
09b0: 6e 20 20 20 20 20 20 20 20 20 20 20 3c 2d 20 45  n           <- E
09c0: 76 65 6e 74 0a 0a 09 73 74 61 74 65 20 77 72 69  vent...state wri
09d0: 74 69 6e 67 20 72 65 76 69 73 69 6f 6e 20 7b 0a  ting revision {.
09e0: 09 20 20 20 20 2d 2d 20 52 65 76 69 73 69 6f 6e  .    -- Revision
09f0: 73 2e 20 49 64 65 6e 74 69 66 69 65 64 20 62 79  s. Identified by
0a00: 20 61 20 67 6c 6f 62 61 6c 20 6e 75 6d 65 72 69   a global numeri
0a10: 63 20 69 64 20 65 61 63 68 0a 09 20 20 20 20 2d  c id each..    -
0a20: 2d 20 62 65 6c 6f 6e 67 73 20 74 6f 20 61 20 73  - belongs to a s
0a30: 69 6e 67 6c 65 20 66 69 6c 65 2c 20 69 64 65 6e  ingle file, iden
0a40: 74 69 66 69 65 64 20 62 79 20 69 74 73 20 69 64  tified by its id
0a50: 2e 20 49 74 0a 09 20 20 20 20 2d 2d 20 66 75 72  . It..    -- fur
0a60: 74 68 65 72 20 68 61 73 20 61 20 64 6f 74 74 65  ther has a dotte
0a70: 64 20 72 65 76 69 73 69 6f 6e 20 6e 75 6d 62 65  d revision numbe
0a80: 72 20 28 44 54 4e 29 2e 0a 09 20 20 20 20 2d 2d  r (DTN)...    --
0a90: 0a 09 20 20 20 20 2d 2d 20 43 6f 6e 73 74 72 61  ..    -- Constra
0aa0: 69 6e 74 3a 20 54 68 65 20 64 6f 74 74 65 64 20  int: The dotted 
0ab0: 72 65 76 69 73 69 6f 6e 20 6e 75 6d 62 65 72 20  revision number 
0ac0: 69 73 20 75 6e 69 71 75 65 20 77 69 74 68 69 6e  is unique within
0ad0: 0a 20 20 20 20 20 20 20 20 20 20 20 20 2d 2d 20  .            -- 
0ae0: 20 20 20 20 20 20 20 20 20 20 20 20 74 68 65 20              the 
0af0: 66 69 6c 65 2e 20 53 65 65 20 65 6e 64 20 6f 66  file. See end of
0b00: 20 64 65 66 69 6e 69 74 69 6f 6e 2e 0a 0a 09 20   definition.... 
0b10: 20 20 20 72 69 64 20 20 49 4e 54 45 47 45 52 20     rid  INTEGER 
0b20: 20 4e 4f 54 20 4e 55 4c 4c 20 20 50 52 49 4d 41   NOT NULL  PRIMA
0b30: 52 59 20 4b 45 59 20 41 55 54 4f 49 4e 43 52 45  RY KEY AUTOINCRE
0b40: 4d 45 4e 54 2c 0a 09 20 20 20 20 66 69 64 20 20  MENT,..    fid  
0b50: 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c  INTEGER  NOT NUL
0b60: 4c 20 20 52 45 46 45 52 45 4e 43 45 53 20 66 69  L  REFERENCES fi
0b70: 6c 65 2c 20 20 20 2d 2d 20 46 69 6c 65 20 6f 77  le,   -- File ow
0b80: 6e 69 6e 67 20 72 65 76 69 73 69 6f 6e 2e 0a 09  ning revision...
0b90: 20 20 20 20 72 65 76 20 20 54 45 58 54 20 20 20      rev  TEXT   
0ba0: 20 20 4e 4f 54 20 4e 55 4c 4c 2c 20 20 20 20 20    NOT NULL,     
0bb0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2d                 -
0bc0: 2d 20 44 6f 74 74 65 64 20 52 65 76 20 4e 75 6d  - Dotted Rev Num
0bd0: 62 65 72 2e 0a 0a 09 20 20 20 20 2d 2d 20 41 6c  ber....    -- Al
0be0: 6c 20 72 65 76 69 73 69 6f 6e 73 20 62 65 6c 6f  l revisions belo
0bf0: 6e 67 20 74 6f 20 61 20 6c 69 6e 65 2d 6f 66 2d  ng to a line-of-
0c00: 64 65 76 65 6c 6f 70 6d 65 6e 74 2c 0a 09 20 20  development,..  
0c10: 20 20 2d 2d 20 69 64 65 6e 74 69 66 69 65 64 20    -- identified 
0c20: 62 79 20 61 20 73 79 6d 62 6f 6c 20 28 70 72 6f  by a symbol (pro
0c30: 6a 65 63 74 20 6c 65 76 65 6c 29 2e 20 44 75 72  ject level). Dur
0c40: 69 6e 67 20 64 61 74 61 0a 09 20 20 20 20 2d 2d  ing data..    --
0c50: 20 63 6f 6c 6c 65 63 74 69 6f 6e 20 69 74 20 77   collection it w
0c60: 61 73 20 61 20 66 69 6c 65 2d 6c 65 76 65 6c 20  as a file-level 
0c70: 62 72 61 6e 63 68 20 73 79 6d 62 6f 6c 2e 0a 09  branch symbol...
0c80: 20 20 20 20 2d 2d 0a 09 20 20 20 20 2d 2d 20 43      --..    -- C
0c90: 6f 6e 73 74 72 61 69 6e 74 3a 20 41 6c 6c 20 74  onstraint: All t
0ca0: 68 65 20 4c 4f 44 20 73 79 6d 62 6f 6c 73 20 61  he LOD symbols a
0cb0: 72 65 20 69 6e 20 74 68 65 20 73 61 6d 65 20 70  re in the same p
0cc0: 72 6f 6a 65 63 74 0a 09 20 20 20 20 2d 2d 20 20  roject..    --  
0cd0: 20 20 20 20 20 20 20 20 20 20 20 61 73 20 74 68             as th
0ce0: 65 20 66 69 6c 65 20 69 74 73 65 6c 66 2e 20 54  e file itself. T
0cf0: 68 69 73 20 63 61 6e 6e 6f 74 20 62 65 0a 09 20  his cannot be.. 
0d00: 20 20 20 2d 2d 20 20 20 20 20 20 20 20 20 20 20     --           
0d10: 20 20 65 78 70 72 65 73 73 65 64 20 69 6e 20 43    expressed in C
0d20: 52 45 41 54 45 20 54 41 42 4c 45 20 73 79 6e 74  REATE TABLE synt
0d30: 61 78 2e 0a 0a 09 20 20 20 20 6c 6f 64 20 20 49  ax....    lod  I
0d40: 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c  NTEGER  NOT NULL
0d50: 20 20 52 45 46 45 52 45 4e 43 45 53 20 73 79 6d    REFERENCES sym
0d60: 62 6f 6c 2c 20 2d 2d 20 4c 69 6e 65 20 6f 66 20  bol, -- Line of 
0d70: 64 65 76 65 6c 6f 70 6d 65 6e 74 0a 0a 09 20 20  development...  
0d80: 20 20 2d 2d 20 54 68 65 20 72 65 76 69 73 69 6f    -- The revisio
0d90: 6e 73 20 69 6e 20 61 20 66 69 6c 65 20 61 72 65  ns in a file are
0da0: 20 6f 72 67 61 6e 69 7a 65 64 20 69 6e 20 61 20   organized in a 
0db0: 66 6f 72 65 73 74 20 6f 66 0a 09 20 20 20 20 2d  forest of..    -
0dc0: 2d 20 74 72 65 65 73 2c 20 77 69 74 68 20 74 68  - trees, with th
0dd0: 65 20 6d 61 69 6e 20 6c 69 6e 65 73 20 64 65 66  e main lines def
0de0: 69 6e 65 64 20 74 68 72 6f 75 67 68 20 74 68 65  ined through the
0df0: 20 70 61 72 65 6e 74 20 2f 0a 09 20 20 20 20 2d   parent /..    -
0e00: 2d 20 63 68 69 6c 64 20 72 65 66 65 72 65 6e 63  - child referenc
0e10: 65 73 2e 20 41 20 72 65 76 69 73 69 6f 6e 20 77  es. A revision w
0e20: 69 74 68 6f 75 74 20 61 20 70 61 72 65 6e 74 20  ithout a parent 
0e30: 69 73 20 74 68 65 0a 09 20 20 20 20 2d 2d 20 72  is the..    -- r
0e40: 6f 6f 74 20 6f 66 20 61 20 74 72 65 65 2c 20 61  oot of a tree, a
0e50: 6e 64 20 61 20 72 65 76 69 73 69 6f 6e 20 77 69  nd a revision wi
0e60: 74 68 6f 75 74 20 61 20 63 68 69 6c 64 20 69 73  thout a child is
0e70: 20 61 0a 09 20 20 20 20 2d 2d 20 6c 65 61 66 2e   a..    -- leaf.
0e80: 0a 0a 09 20 20 20 20 2d 2d 20 43 6f 6e 73 74 72  ...    -- Constr
0e90: 61 69 6e 74 73 3a 20 41 6c 6c 20 72 65 76 69 73  aints: All revis
0ea0: 69 6f 6e 73 20 63 6f 75 70 6c 65 64 20 74 68 72  ions coupled thr
0eb0: 6f 75 67 68 20 70 61 72 65 6e 74 2f 63 68 69 6c  ough parent/chil
0ec0: 64 0a 09 20 20 20 20 2d 2d 20 20 20 20 20 20 20  d..    --       
0ed0: 20 20 20 20 20 20 20 72 65 66 65 72 20 74 6f 20         refer to 
0ee0: 74 68 65 20 73 61 6d 65 20 4c 4f 44 20 73 79 6d  the same LOD sym
0ef0: 62 6f 6c 2e 20 54 68 65 20 70 61 72 65 6e 74 0a  bol. The parent.
0f00: 09 20 20 20 20 2d 2d 20 20 20 20 20 20 20 20 20  .    --         
0f10: 20 20 20 20 20 6f 66 20 61 20 63 68 69 6c 64 20       of a child 
0f20: 6f 66 20 58 20 69 73 20 58 2e 20 54 68 65 20 63  of X is X. The c
0f30: 68 69 6c 64 20 6f 66 20 61 0a 09 20 20 20 20 2d  hild of a..    -
0f40: 2d 20 20 20 20 20 20 20 20 20 20 20 20 20 20 70  -              p
0f50: 61 72 65 6e 74 20 6f 66 20 58 20 69 73 20 58 2e  arent of X is X.
0f60: 0a 0a 09 20 20 20 20 70 61 72 65 6e 74 20 20 49  ...    parent  I
0f70: 4e 54 45 47 45 52 20 20 20 20 20 20 20 20 20 20  NTEGER          
0f80: 20 20 52 45 46 45 52 45 4e 43 45 53 20 72 65 76    REFERENCES rev
0f90: 69 73 69 6f 6e 2c 0a 09 20 20 20 20 63 68 69 6c  ision,..    chil
0fa0: 64 20 20 20 49 4e 54 45 47 45 52 20 20 20 20 20  d   INTEGER     
0fb0: 20 20 20 20 20 20 20 52 45 46 45 52 45 4e 43 45         REFERENCE
0fc0: 53 20 72 65 76 69 73 69 6f 6e 2c 0a 0a 09 20 20  S revision,...  
0fd0: 20 20 2d 2d 20 54 68 65 20 72 65 70 72 65 73 65    -- The represe
0fe0: 6e 74 61 74 69 6f 6e 20 6f 66 20 61 20 62 72 61  ntation of a bra
0ff0: 6e 63 68 20 69 6e 20 61 20 74 72 65 65 20 69 73  nch in a tree is
1000: 20 74 68 65 0a 09 20 20 20 20 2d 2d 20 65 78 63   the..    -- exc
1010: 65 70 74 69 6f 6e 20 74 6f 20 74 68 65 20 74 68  eption to the th
1020: 72 65 65 20 63 6f 6e 73 74 72 61 69 6e 74 73 20  ree constraints 
1030: 61 62 6f 76 65 2e 0a 0a 09 20 20 20 20 2d 2d 20  above....    -- 
1040: 54 68 65 20 62 65 67 69 6e 6e 69 6e 67 20 6f 66  The beginning of
1050: 20 61 20 62 72 61 6e 63 68 20 69 73 20 72 65 70   a branch is rep
1060: 72 65 73 65 6e 74 65 64 20 62 79 20 61 20 6e 6f  resented by a no
1070: 6e 2d 4e 55 4c 4c 0a 09 20 20 20 20 2d 2d 20 62  n-NULL..    -- b
1080: 70 61 72 65 6e 74 20 6f 66 20 61 20 72 65 76 69  parent of a revi
1090: 73 69 6f 6e 2e 20 54 68 69 73 20 72 65 76 69 73  sion. This revis
10a0: 69 6f 6e 20 42 20 69 73 20 74 68 65 20 66 69 72  ion B is the fir
10b0: 73 74 20 6f 6e 0a 09 20 20 20 20 2d 2d 20 74 68  st on..    -- th
10c0: 65 20 62 72 61 6e 63 68 2e 20 49 74 73 20 70 61  e branch. Its pa
10d0: 72 65 6e 74 20 50 20 69 73 20 74 68 65 20 72 65  rent P is the re
10e0: 76 69 73 69 6f 6e 20 74 68 65 20 62 72 61 6e 63  vision the branc
10f0: 68 20 69 73 0a 09 20 20 20 20 2d 2d 20 72 6f 6f  h is..    -- roo
1100: 74 65 64 20 69 6e 2c 20 61 6e 64 20 69 74 20 69  ted in, and it i
1110: 73 20 6e 6f 74 20 74 68 65 20 63 68 69 6c 64 20  s not the child 
1120: 6f 66 20 50 2e 20 42 20 61 6e 64 20 50 20 72 65  of P. B and P re
1130: 66 65 72 0a 09 20 20 20 20 2d 2d 20 74 6f 20 64  fer..    -- to d
1140: 69 66 66 65 72 65 6e 74 20 4c 4f 44 20 73 79 6d  ifferent LOD sym
1150: 62 6f 6c 73 2e 20 54 68 65 20 62 70 61 72 65 6e  bols. The bparen
1160: 74 20 6f 66 20 42 20 69 73 20 61 6c 73 6f 20 69  t of B is also i
1170: 74 73 0a 09 20 20 20 20 2d 2d 20 4c 4f 44 2c 20  ts..    -- LOD, 
1180: 61 6e 64 20 74 68 65 20 4c 4f 44 20 6f 66 20 69  and the LOD of i
1190: 74 73 20 63 68 69 6c 64 72 65 6e 2e 0a 0a 09 20  ts children.... 
11a0: 20 20 20 62 70 61 72 65 6e 74 20 49 4e 54 45 47     bparent INTEG
11b0: 45 52 20 20 20 20 20 20 20 20 20 20 20 20 52 45  ER            RE
11c0: 46 45 52 45 4e 43 45 53 20 73 79 6d 62 6f 6c 2c  FERENCES symbol,
11d0: 0a 0a 09 20 20 20 20 2d 2d 20 4c 61 73 74 6c 79  ...    -- Lastly
11e0: 20 77 65 20 6b 65 65 70 20 69 6e 66 6f 72 6d 61   we keep informa
11f0: 74 69 6f 6e 20 69 73 20 61 62 6f 75 74 20 6e 6f  tion is about no
1200: 6e 2d 74 72 75 6e 6b 20 64 65 66 61 75 6c 74 0a  n-trunk default.
1210: 09 20 20 20 20 2d 2d 20 62 72 61 6e 63 68 65 73  .    -- branches
1220: 20 28 4e 54 44 42 29 20 69 6e 20 74 68 65 20 72   (NTDB) in the r
1230: 65 76 69 73 69 6f 6e 73 2e 0a 0a 09 20 20 20 20  evisions....    
1240: 2d 2d 20 41 6c 6c 20 72 65 76 69 73 69 6f 6e 73  -- All revisions
1250: 20 6f 6e 20 74 68 65 20 4e 54 44 42 20 68 61 76   on the NTDB hav
1260: 65 20 27 69 73 64 65 66 61 75 6c 74 27 20 54 52  e 'isdefault' TR
1270: 55 45 2c 0a 09 20 20 20 20 2d 2d 20 65 76 65 72  UE,..    -- ever
1280: 79 6f 6e 65 20 65 6c 73 65 20 46 41 4c 53 45 2e  yone else FALSE.
1290: 20 54 68 65 20 6c 61 73 74 20 72 65 76 69 73 69   The last revisi
12a0: 6f 6e 20 58 20 6f 6e 20 74 68 65 20 4e 54 44 42  on X on the NTDB
12b0: 0a 09 20 20 20 20 2d 2d 20 77 68 69 63 68 20 69  ..    -- which i
12c0: 73 20 73 74 69 6c 6c 20 63 6f 6e 73 69 64 65 72  s still consider
12d0: 65 64 20 74 6f 20 62 65 20 6f 6e 20 74 68 65 20  ed to be on the 
12e0: 74 72 75 6e 6b 20 61 73 20 77 65 6c 6c 0a 09 20  trunk as well.. 
12f0: 20 20 20 2d 2d 20 68 61 73 20 61 20 6e 6f 6e 2d     -- has a non-
1300: 4e 55 4c 4c 20 27 64 62 63 68 69 6c 64 27 20 77  NULL 'dbchild' w
1310: 68 69 63 68 20 72 65 66 65 72 73 20 74 6f 20 74  hich refers to t
1320: 68 65 20 72 6f 6f 74 20 6f 66 0a 09 20 20 20 20  he root of..    
1330: 2d 2d 20 74 68 65 20 74 72 75 6e 6b 2e 20 54 68  -- the trunk. Th
1340: 65 20 72 6f 6f 74 20 61 6c 73 6f 20 68 61 73 20  e root also has 
1350: 61 20 6e 6f 6e 2d 4e 55 4c 4c 20 64 62 70 61 72  a non-NULL dbpar
1360: 65 6e 74 0a 09 20 20 20 20 2d 2d 20 72 65 66 65  ent..    -- refe
1370: 72 69 6e 67 20 74 6f 20 58 2e 0a 0a 09 20 20 20  ring to X....   
1380: 20 69 73 64 65 66 61 75 6c 74 20 49 4e 54 45 47   isdefault INTEG
1390: 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 2c 0a 09 20  ER  NOT NULL,.. 
13a0: 20 20 20 64 62 70 61 72 65 6e 74 20 20 49 4e 54     dbparent  INT
13b0: 45 47 45 52 20 20 20 20 20 20 20 20 20 20 20 20  EGER            
13c0: 52 45 46 45 52 45 4e 43 45 53 20 72 65 76 69 73  REFERENCES revis
13d0: 69 6f 6e 2c 0a 09 20 20 20 20 64 62 63 68 69 6c  ion,..    dbchil
13e0: 64 20 20 20 49 4e 54 45 47 45 52 20 20 20 20 20  d   INTEGER     
13f0: 20 20 20 20 20 20 20 52 45 46 45 52 45 4e 43 45         REFERENCE
1400: 53 20 72 65 76 69 73 69 6f 6e 2c 0a 0a 09 20 20  S revision,...  
1410: 20 20 2d 2d 20 54 68 65 20 6d 61 69 6e 20 70 61    -- The main pa
1420: 79 6c 6f 61 64 20 6f 66 20 74 68 65 20 72 65 76  yload of the rev
1430: 69 73 69 6f 6e 20 61 72 65 20 74 68 65 20 64 61  ision are the da
1440: 74 65 2f 74 69 6d 65 20 69 74 0a 09 20 20 20 20  te/time it..    
1450: 2d 2d 20 77 61 73 20 65 6e 74 65 72 65 64 2c 20  -- was entered, 
1460: 69 74 73 20 73 74 61 74 65 2c 20 6f 70 65 72 61  its state, opera
1470: 74 69 6f 6e 20 28 3d 20 74 79 70 65 2f 63 6c 61  tion (= type/cla
1480: 73 73 29 2c 20 74 65 78 74 0a 09 20 20 20 20 2d  ss), text..    -
1490: 2d 20 63 6f 6e 74 65 6e 74 2c 20 61 6e 64 20 6d  - content, and m
14a0: 65 74 61 20 64 61 74 61 20 28 61 75 74 68 6f 72  eta data (author
14b0: 2c 20 6c 6f 67 20 6d 65 73 73 61 67 65 2c 20 62  , log message, b
14c0: 72 61 6e 63 68 2c 0a 09 20 20 20 20 2d 2d 20 70  ranch,..    -- p
14d0: 72 6f 6a 65 63 74 29 2e 20 54 68 65 20 6c 61 73  roject). The las
14e0: 74 20 69 73 20 65 6e 63 6f 64 65 64 20 61 73 20  t is encoded as 
14f0: 73 69 6e 67 6c 65 20 69 64 2c 20 73 65 65 20 74  single id, see t
1500: 61 62 6c 65 0a 09 20 20 20 20 2d 2d 20 27 6d 65  able..    -- 'me
1510: 74 61 27 2e 20 54 68 65 20 64 61 74 65 2f 74 69  ta'. The date/ti
1520: 6d 65 20 69 73 20 67 69 76 65 6e 20 69 6e 20 73  me is given in s
1530: 65 63 6f 6e 64 73 20 73 69 6e 63 65 20 74 68 65  econds since the
1540: 0a 09 20 20 20 20 2d 2d 20 65 70 6f 63 68 2c 20  ..    -- epoch, 
1550: 66 6f 72 20 65 61 73 79 20 63 6f 6d 70 61 72 69  for easy compari
1560: 73 6f 6e 2e 20 54 68 65 20 74 65 78 74 20 63 6f  son. The text co
1570: 6e 74 65 6e 74 20 69 73 20 61 6e 0a 09 20 20 20  ntent is an..   
1580: 20 2d 2d 20 28 6f 66 66 73 65 74 2c 6c 65 6e 67   -- (offset,leng
1590: 74 68 29 20 70 61 69 72 20 69 6e 74 6f 20 74 68  th) pair into th
15a0: 65 20 72 63 73 20 61 72 63 68 69 76 65 2e 0a 0a  e rcs archive...
15b0: 09 20 20 20 20 6f 70 20 20 20 20 49 4e 54 45 47  .    op    INTEG
15c0: 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 2c 0a 09 20  ER  NOT NULL,.. 
15d0: 20 20 20 64 61 74 65 20 20 49 4e 54 45 47 45 52     date  INTEGER
15e0: 20 20 4e 4f 54 20 4e 55 4c 4c 2c 0a 09 20 20 20    NOT NULL,..   
15f0: 20 73 74 61 74 65 20 54 45 58 54 20 20 20 20 20   state TEXT     
1600: 4e 4f 54 20 4e 55 4c 4c 2c 0a 09 20 20 20 20 6d  NOT NULL,..    m
1610: 69 64 20 20 20 49 4e 54 45 47 45 52 20 20 4e 4f  id   INTEGER  NO
1620: 54 20 4e 55 4c 4c 20 52 45 46 45 52 45 4e 43 45  T NULL REFERENCE
1630: 53 20 6d 65 74 61 2c 0a 09 20 20 20 20 63 6f 66  S meta,..    cof
1640: 66 20 20 49 4e 54 45 47 45 52 20 20 4e 4f 54 20  f  INTEGER  NOT 
1650: 4e 55 4c 4c 2c 0a 09 20 20 20 20 63 6c 65 6e 20  NULL,..    clen 
1660: 20 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55   INTEGER  NOT NU
1670: 4c 4c 2c 0a 0a 09 20 20 20 20 55 4e 49 51 55 45  LL,...    UNIQUE
1680: 20 28 66 69 64 2c 20 72 65 76 29 20 2d 2d 20 54   (fid, rev) -- T
1690: 68 65 20 44 54 4e 20 69 73 20 75 6e 69 71 75 65  he DTN is unique
16a0: 20 77 69 74 68 69 6e 20 74 68 65 20 72 65 76 69   within the revi
16b0: 73 69 6f 6e 27 73 20 66 69 6c 65 2e 0a 09 7d 0a  sion's file...}.
16c0: 0a 09 73 74 61 74 65 20 77 72 69 74 69 6e 67 20  ..state writing 
16d0: 74 61 67 20 7b 0a 09 20 20 20 20 74 69 64 20 20  tag {..    tid  
16e0: 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c  INTEGER  NOT NUL
16f0: 4c 20 20 50 52 49 4d 41 52 59 20 4b 45 59 20 41  L  PRIMARY KEY A
1700: 55 54 4f 49 4e 43 52 45 4d 45 4e 54 2c 0a 09 20  UTOINCREMENT,.. 
1710: 20 20 20 66 69 64 20 20 49 4e 54 45 47 45 52 20     fid  INTEGER 
1720: 20 4e 4f 54 20 4e 55 4c 4c 20 20 52 45 46 45 52   NOT NULL  REFER
1730: 45 4e 43 45 53 20 66 69 6c 65 2c 20 20 20 20 20  ENCES file,     
1740: 2d 2d 20 46 69 6c 65 20 74 68 65 20 69 74 65 6d  -- File the item
1750: 20 62 65 6c 6f 6e 67 73 20 74 6f 0a 09 20 20 20   belongs to..   
1760: 20 6c 6f 64 20 20 49 4e 54 45 47 45 52 20 20 20   lod  INTEGER   
1770: 20 20 20 20 20 20 20 20 20 52 45 46 45 52 45 4e           REFEREN
1780: 43 45 53 20 73 79 6d 62 6f 6c 2c 20 20 20 2d 2d  CES symbol,   --
1790: 20 4c 69 6e 65 20 6f 66 20 64 65 76 65 6c 6f 70   Line of develop
17a0: 6d 65 6e 74 20 28 4e 55 4c 4c 20 3d 3e 20 54 72  ment (NULL => Tr
17b0: 75 6e 6b 29 0a 0a 09 20 20 20 20 73 69 64 20 20  unk)...    sid  
17c0: 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c  INTEGER  NOT NUL
17d0: 4c 20 20 52 45 46 45 52 45 4e 43 45 53 20 73 79  L  REFERENCES sy
17e0: 6d 62 6f 6c 2c 20 20 20 2d 2d 20 53 79 6d 62 6f  mbol,   -- Symbo
17f0: 6c 20 63 61 70 74 75 72 69 6e 67 20 74 68 65 20  l capturing the 
1800: 74 61 67 0a 0a 09 20 20 20 20 72 65 76 20 20 49  tag...    rev  I
1810: 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c  NTEGER  NOT NULL
1820: 20 20 52 45 46 45 52 45 4e 43 45 53 20 72 65 76    REFERENCES rev
1830: 69 73 69 6f 6e 20 20 2d 2d 20 54 68 65 20 72 65  ision  -- The re
1840: 76 69 73 69 6f 6e 20 62 65 69 6e 67 20 74 61 67  vision being tag
1850: 67 65 64 2e 0a 09 7d 0a 0a 09 73 74 61 74 65 20  ged...}...state 
1860: 77 72 69 74 69 6e 67 20 62 72 61 6e 63 68 20 7b  writing branch {
1870: 0a 09 20 20 20 20 62 69 64 20 20 20 49 4e 54 45  ..    bid   INTE
1880: 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 50  GER  NOT NULL  P
1890: 52 49 4d 41 52 59 20 4b 45 59 20 41 55 54 4f 49  RIMARY KEY AUTOI
18a0: 4e 43 52 45 4d 45 4e 54 2c 0a 09 20 20 20 20 66  NCREMENT,..    f
18b0: 69 64 20 20 20 49 4e 54 45 47 45 52 20 20 4e 4f  id   INTEGER  NO
18c0: 54 20 4e 55 4c 4c 20 20 52 45 46 45 52 45 4e 43  T NULL  REFERENC
18d0: 45 53 20 66 69 6c 65 2c 20 20 20 20 20 2d 2d 20  ES file,     -- 
18e0: 46 69 6c 65 20 74 68 65 20 69 74 65 6d 20 62 65  File the item be
18f0: 6c 6f 6e 67 73 20 74 6f 0a 09 20 20 20 20 6c 6f  longs to..    lo
1900: 64 20 20 20 49 4e 54 45 47 45 52 20 20 20 20 20  d   INTEGER     
1910: 20 20 20 20 20 20 20 52 45 46 45 52 45 4e 43 45         REFERENCE
1920: 53 20 73 79 6d 62 6f 6c 2c 20 20 20 2d 2d 20 4c  S symbol,   -- L
1930: 69 6e 65 20 6f 66 20 64 65 76 65 6c 6f 70 6d 65  ine of developme
1940: 6e 74 20 28 4e 55 4c 4c 20 3d 3e 20 54 72 75 6e  nt (NULL => Trun
1950: 6b 29 0a 0a 09 20 20 20 20 73 69 64 20 20 20 49  k)...    sid   I
1960: 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c  NTEGER  NOT NULL
1970: 20 20 52 45 46 45 52 45 4e 43 45 53 20 73 79 6d    REFERENCES sym
1980: 62 6f 6c 2c 20 20 20 2d 2d 20 53 79 6d 62 6f 6c  bol,   -- Symbol
1990: 20 63 61 70 74 75 72 69 6e 67 20 74 68 65 20 62   capturing the b
19a0: 72 61 6e 63 68 0a 0a 09 20 20 20 20 72 6f 6f 74  ranch...    root
19b0: 20 20 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e    INTEGER  NOT N
19c0: 55 4c 4c 20 20 52 45 46 45 52 45 4e 43 45 53 20  ULL  REFERENCES 
19d0: 72 65 76 69 73 69 6f 6e 2c 20 2d 2d 20 52 65 76  revision, -- Rev
19e0: 69 73 69 6f 6e 20 74 68 65 20 62 72 61 6e 63 68  ision the branch
19f0: 20 73 70 72 6f 75 74 73 20 66 72 6f 6d 0a 09 20   sprouts from.. 
1a00: 20 20 20 66 69 72 73 74 20 49 4e 54 45 47 45 52     first INTEGER
1a10: 20 20 20 20 20 20 20 20 20 20 20 20 52 45 46 45              REFE
1a20: 52 45 4e 43 45 53 20 72 65 76 69 73 69 6f 6e 2c  RENCES revision,
1a30: 20 2d 2d 20 46 69 72 73 74 20 72 65 76 69 73 69   -- First revisi
1a40: 6f 6e 20 63 6f 6d 6d 69 74 74 65 64 20 74 6f 20  on committed to 
1a50: 74 68 65 20 62 72 61 6e 63 68 0a 09 20 20 20 20  the branch..    
1a60: 62 72 61 20 20 20 54 45 58 54 20 20 20 20 20 4e  bra   TEXT     N
1a70: 4f 54 20 4e 55 4c 4c 20 20 20 20 20 20 20 20 20  OT NULL         
1a80: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2d 2d                --
1a90: 20 62 72 61 6e 63 68 20 6e 75 6d 62 65 72 0a 09   branch number..
1aa0: 7d 0a 0a 09 23 20 49 74 20 69 73 20 69 6e 20 70  }...# It is in p
1ab0: 72 69 6e 63 69 70 6c 65 20 70 6f 73 73 69 62 6c  rinciple possibl
1ac0: 65 20 74 6f 20 63 6f 6c 6c 61 70 73 65 20 74 68  e to collapse th
1ad0: 65 20 66 6f 75 72 20 74 61 62 6c 65 73 0a 09 23  e four tables..#
1ae0: 20 61 62 6f 76 65 20 28 66 72 6f 6d 20 69 74 65   above (from ite
1af0: 6d 20 74 6f 20 62 61 72 6e 63 68 29 20 69 6e 74  m to barnch) int
1b00: 6f 20 61 20 73 69 6e 67 6c 65 20 74 61 62 6c 65  o a single table
1b10: 2c 20 77 69 74 68 0a 09 23 20 73 69 6d 69 6c 61  , with..# simila
1b20: 72 20 63 6f 6c 75 6d 6e 73 20 6d 65 72 67 65 64  r columns merged
1b30: 2c 20 61 6e 64 20 75 6e 75 73 65 64 20 63 6f 6c  , and unused col
1b40: 75 6d 6e 73 20 61 6c 6c 6f 77 69 6e 67 20 4e 55  umns allowing NU
1b50: 4c 4c 2c 0a 09 23 20 74 68 65 20 75 73 65 20 64  LL,..# the use d
1b60: 65 74 65 72 6d 69 6e 65 64 20 62 79 20 74 68 65  etermined by the
1b70: 20 74 79 70 65 2e 20 57 65 20 6d 61 79 20 64 6f   type. We may do
1b80: 20 74 68 61 74 20 69 66 20 74 68 65 0a 09 23 20   that if the..# 
1b90: 70 65 72 66 6f 72 6d 61 6e 63 65 20 69 73 20 6e  performance is n
1ba0: 6f 74 20 67 6f 6f 64 20 65 6e 6f 75 67 68 2c 20  ot good enough, 
1bb0: 62 75 74 20 66 6f 72 20 6e 6f 77 20 63 6c 61 72  but for now clar
1bc0: 69 74 79 20 6f 66 0a 09 23 20 73 74 72 75 63 74  ity of..# struct
1bd0: 75 72 65 20 6f 76 65 72 20 65 66 66 69 63 69 65  ure over efficie
1be0: 6e 63 79 2e 0a 0a 09 23 20 50 72 6f 6a 65 63 74  ncy....# Project
1bf0: 20 6c 65 76 65 6c 20 2e 2e 2e 0a 09 23 09 70 4c   level .....#.pL
1c00: 69 6e 65 4f 66 44 65 76 65 6c 6f 70 6d 65 6e 74  ineOfDevelopment
1c10: 2c 20 70 53 79 6d 62 6f 6c 2c 20 70 42 72 61 6e  , pSymbol, pBran
1c20: 63 68 2c 20 70 54 61 67 2c 20 70 54 72 75 6e 6b  ch, pTag, pTrunk
1c30: 0a 09 23 0a 09 23 09 70 54 72 75 6e 6b 20 20 3c  ..#..#.pTrunk  <
1c40: 2d 20 70 4c 69 6e 65 4f 66 44 65 76 65 6c 6f 70  - pLineOfDevelop
1c50: 6d 65 6e 74 0a 09 23 09 70 42 72 61 6e 63 68 20  ment..#.pBranch 
1c60: 3c 2d 20 70 53 79 6d 62 6f 6c 2c 20 70 4c 69 6e  <- pSymbol, pLin
1c70: 65 4f 66 44 65 76 65 6c 6f 70 6d 65 6e 74 0a 09  eOfDevelopment..
1c80: 23 09 70 54 61 67 20 20 20 20 3c 2d 20 70 53 79  #.pTag    <- pSy
1c90: 6d 62 6f 6c 2c 20 70 4c 69 6e 65 4f 66 44 65 76  mbol, pLineOfDev
1ca0: 65 6c 6f 70 6d 65 6e 74 0a 0a 09 73 74 61 74 65  elopment...state
1cb0: 20 77 72 69 74 69 6e 67 20 73 79 6d 62 6f 6c 20   writing symbol 
1cc0: 7b 0a 09 20 20 20 20 73 69 64 20 20 49 4e 54 45  {..    sid  INTE
1cd0: 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 50  GER  NOT NULL  P
1ce0: 52 49 4d 41 52 59 20 4b 45 59 20 41 55 54 4f 49  RIMARY KEY AUTOI
1cf0: 4e 43 52 45 4d 45 4e 54 2c 0a 09 20 20 20 20 70  NCREMENT,..    p
1d00: 69 64 20 20 49 4e 54 45 47 45 52 20 20 4e 4f 54  id  INTEGER  NOT
1d10: 20 4e 55 4c 4c 20 20 52 45 46 45 52 45 4e 43 45   NULL  REFERENCE
1d20: 53 20 70 72 6f 6a 65 63 74 2c 20 20 2d 2d 20 50  S project,  -- P
1d30: 72 6f 6a 65 63 74 20 74 68 65 20 73 79 6d 62 6f  roject the symbo
1d40: 6c 20 62 65 6c 6f 6e 67 73 20 74 6f 0a 09 20 20  l belongs to..  
1d50: 20 20 6e 61 6d 65 20 54 45 58 54 20 20 20 20 20    name TEXT     
1d60: 4e 4f 54 20 4e 55 4c 4c 2c 0a 09 20 20 20 20 74  NOT NULL,..    t
1d70: 79 70 65 20 49 4e 54 45 47 45 52 20 20 4e 4f 54  ype INTEGER  NOT
1d80: 20 4e 55 4c 4c 2c 20 20 20 20 20 20 20 20 20 20   NULL,          
1d90: 20 20 20 20 20 20 20 20 20 20 20 20 2d 2d 20 65              -- e
1da0: 6e 75 6d 20 7b 20 74 61 67 20 3d 20 31 2c 20 62  num { tag = 1, b
1db0: 72 61 6e 63 68 2c 20 75 6e 64 65 66 69 6e 65 64  ranch, undefined
1dc0: 20 7d 0a 0a 09 20 20 20 20 74 61 67 5f 63 6f 75   }...    tag_cou
1dd0: 6e 74 20 20 20 20 49 4e 54 45 47 45 52 20 20 4e  nt    INTEGER  N
1de0: 4f 54 20 4e 55 4c 4c 2c 20 2d 2d 20 48 6f 77 20  OT NULL, -- How 
1df0: 6f 66 74 65 6e 20 74 68 65 20 73 79 6d 62 6f 6c  often the symbol
1e00: 20 69 73 20 75 73 65 64 20 61 73 20 74 61 67 2e   is used as tag.
1e10: 0a 09 20 20 20 20 62 72 61 6e 63 68 5f 63 6f 75  ..    branch_cou
1e20: 6e 74 20 49 4e 54 45 47 45 52 20 20 4e 4f 54 20  nt INTEGER  NOT 
1e30: 4e 55 4c 4c 2c 20 2d 2d 20 48 6f 77 20 6f 66 74  NULL, -- How oft
1e40: 65 6e 20 74 68 65 20 73 79 6d 62 6f 6c 20 69 73  en the symbol is
1e50: 20 75 73 65 64 20 61 73 20 62 72 61 6e 63 68 0a   used as branch.
1e60: 09 20 20 20 20 63 6f 6d 6d 69 74 5f 63 6f 75 6e  .    commit_coun
1e70: 74 20 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e  t INTEGER  NOT N
1e80: 55 4c 4c 2c 20 2d 2d 20 48 6f 77 20 6f 66 74 65  ULL, -- How ofte
1e90: 6e 20 61 20 66 69 6c 65 20 77 61 73 20 63 6f 6d  n a file was com
1ea0: 6d 69 74 74 65 64 20 6f 6e 20 74 68 65 20 73 79  mitted on the sy
1eb0: 6d 62 6f 6c 0a 0a 09 20 20 20 20 55 4e 49 51 55  mbol...    UNIQU
1ec0: 45 20 28 70 69 64 2c 20 6e 61 6d 65 29 20 2d 2d  E (pid, name) --
1ed0: 20 53 79 6d 62 6f 6c 73 20 61 72 65 20 75 6e 69   Symbols are uni
1ee0: 71 75 65 20 77 69 74 68 69 6e 20 74 68 65 20 70  que within the p
1ef0: 72 6f 6a 65 63 74 0a 09 7d 0a 0a 09 73 74 61 74  roject..}...stat
1f00: 65 20 77 72 69 74 69 6e 67 20 62 6c 6f 63 6b 65  e writing blocke
1f10: 72 20 7b 0a 09 20 20 20 20 73 69 64 20 49 4e 54  r {..    sid INT
1f20: 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 20  EGER  NOT NULL  
1f30: 52 45 46 45 52 45 4e 43 45 53 20 73 79 6d 62 6f  REFERENCES symbo
1f40: 6c 2c 20 2d 2d 20 0a 09 20 20 20 20 62 69 64 20  l, -- ..    bid 
1f50: 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c  INTEGER  NOT NUL
1f60: 4c 20 20 52 45 46 45 52 45 4e 43 45 53 20 73 79  L  REFERENCES sy
1f70: 6d 62 6f 6c 2c 20 2d 2d 20 53 70 72 6f 75 74 65  mbol, -- Sproute
1f80: 64 20 66 72 6f 6d 20 73 69 64 2c 20 62 6c 6f 63  d from sid, bloc
1f90: 6b 73 20 69 74 2e 0a 09 20 20 20 20 55 4e 49 51  ks it...    UNIQ
1fa0: 55 45 20 28 73 69 64 2c 20 62 69 64 29 0a 09 7d  UE (sid, bid)..}
1fb0: 0a 0a 09 73 74 61 74 65 20 77 72 69 74 69 6e 67  ...state writing
1fc0: 20 70 61 72 65 6e 74 20 7b 0a 09 20 20 20 20 73   parent {..    s
1fd0: 69 64 20 49 4e 54 45 47 45 52 20 20 4e 4f 54 20  id INTEGER  NOT 
1fe0: 4e 55 4c 4c 20 20 52 45 46 45 52 45 4e 43 45 53  NULL  REFERENCES
1ff0: 20 73 79 6d 62 6f 6c 2c 20 2d 2d 20 0a 09 20 20   symbol, -- ..  
2000: 20 20 70 69 64 20 49 4e 54 45 47 45 52 20 20 4e    pid INTEGER  N
2010: 4f 54 20 4e 55 4c 4c 20 20 52 45 46 45 52 45 4e  OT NULL  REFEREN
2020: 43 45 53 20 73 79 6d 62 6f 6c 2c 20 2d 2d 20 50  CES symbol, -- P
2030: 6f 73 73 69 62 6c 65 20 70 61 72 65 6e 74 20 6f  ossible parent o
2040: 66 20 73 69 64 0a 09 20 20 20 20 55 4e 49 51 55  f sid..    UNIQU
2050: 45 20 28 73 69 64 2c 20 70 69 64 29 0a 09 7d 0a  E (sid, pid)..}.
2060: 0a 09 73 74 61 74 65 20 77 72 69 74 69 6e 67 20  ..state writing 
2070: 6d 65 74 61 20 7b 0a 09 20 20 20 20 2d 2d 20 4d  meta {..    -- M
2080: 65 74 61 20 64 61 74 61 20 6f 66 20 72 65 76 69  eta data of revi
2090: 73 69 6f 6e 73 2e 20 53 65 65 20 72 65 76 69 73  sions. See revis
20a0: 69 6f 6e 2e 6d 69 64 20 66 6f 72 20 74 68 65 0a  ion.mid for the.
20b0: 09 20 20 20 20 2d 2d 20 72 65 66 65 72 65 6e 63  .    -- referenc
20c0: 65 2e 20 4d 61 6e 79 20 72 65 76 69 73 69 6f 6e  e. Many revision
20d0: 73 20 63 61 6e 20 73 68 61 72 65 20 6d 65 74 61  s can share meta
20e0: 20 64 61 74 61 2e 20 54 68 69 73 20 69 73 0a 09   data. This is..
20f0: 20 20 20 20 2d 2d 20 61 63 74 75 61 6c 6c 79 20      -- actually 
2100: 6f 6e 65 20 6f 66 20 74 68 65 20 63 72 69 74 65  one of the crite
2110: 72 69 6f 6e 73 20 75 73 65 64 20 74 6f 20 73 6f  rions used to so
2120: 72 74 20 72 65 76 69 73 69 6f 6e 73 0a 09 20 20  rt revisions..  
2130: 20 20 2d 2d 20 69 6e 74 6f 20 63 68 61 6e 67 65    -- into change
2140: 73 65 74 73 2e 0a 0a 09 20 20 20 20 6d 69 64 20  sets....    mid 
2150: 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c  INTEGER  NOT NUL
2160: 4c 20 20 50 52 49 4d 41 52 59 20 4b 45 59 20 20  L  PRIMARY KEY  
2170: 41 55 54 4f 49 4e 43 52 45 4d 45 4e 54 2c 0a 0a  AUTOINCREMENT,..
2180: 09 20 20 20 20 2d 2d 20 4d 65 74 61 20 64 61 74  .    -- Meta dat
2190: 61 20 62 65 6c 6f 6e 67 73 20 74 6f 20 61 20 73  a belongs to a s
21a0: 70 65 63 69 66 69 63 20 70 72 6f 6a 65 63 74 2c  pecific project,
21b0: 20 73 74 72 6f 6e 67 65 72 2c 20 74 6f 20 61 0a   stronger, to a.
21c0: 09 20 20 20 20 2d 2d 20 62 72 61 6e 63 68 20 69  .    -- branch i
21d0: 6e 20 74 68 61 74 20 70 72 6f 6a 65 63 74 2e 20  n that project. 
21e0: 49 74 20 66 75 72 74 68 65 72 20 68 61 73 20 61  It further has a
21f0: 20 6c 6f 67 20 6d 65 73 73 61 67 65 2c 0a 09 20   log message,.. 
2200: 20 20 20 2d 2d 20 61 6e 64 20 69 74 73 20 61 75     -- and its au
2210: 74 68 6f 72 2e 20 54 68 69 73 20 69 73 20 75 6e  thor. This is un
2220: 69 71 75 65 20 77 69 74 68 20 74 68 65 20 70 72  ique with the pr
2230: 6f 6a 65 63 74 20 61 6e 64 0a 09 20 20 20 20 2d  oject and..    -
2240: 2d 20 62 72 61 6e 63 68 2e 0a 0a 09 20 20 20 20  - branch....    
2250: 70 69 64 20 49 4e 54 45 47 45 52 20 20 4e 4f 54  pid INTEGER  NOT
2260: 20 4e 55 4c 4c 20 20 52 45 46 45 52 45 4e 43 45   NULL  REFERENCE
2270: 53 20 70 72 6f 6a 65 63 74 2c 20 20 2d 2d 0a 09  S project,  --..
2280: 20 20 20 20 62 69 64 20 49 4e 54 45 47 45 52 20      bid INTEGER 
2290: 20 4e 4f 54 20 4e 55 4c 4c 20 20 52 45 46 45 52   NOT NULL  REFER
22a0: 45 4e 43 45 53 20 73 79 6d 62 6f 6c 2c 20 20 20  ENCES symbol,   
22b0: 2d 2d 0a 09 20 20 20 20 61 69 64 20 49 4e 54 45  --..    aid INTE
22c0: 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 52  GER  NOT NULL  R
22d0: 45 46 45 52 45 4e 43 45 53 20 61 75 74 68 6f 72  EFERENCES author
22e0: 2c 20 20 20 2d 2d 0a 09 20 20 20 20 63 69 64 20  ,   --..    cid 
22f0: 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c  INTEGER  NOT NUL
2300: 4c 20 20 52 45 46 45 52 45 4e 43 45 53 20 63 6d  L  REFERENCES cm
2310: 65 73 73 61 67 65 2c 20 2d 2d 0a 0a 09 20 20 20  essage, --...   
2320: 20 55 4e 49 51 55 45 20 28 70 69 64 2c 20 62 69   UNIQUE (pid, bi
2330: 64 2c 20 61 69 64 2c 20 63 69 64 29 0a 0a 09 20  d, aid, cid)... 
2340: 20 20 20 2d 2d 20 43 6f 6e 73 74 72 61 69 6e 74     -- Constraint
2350: 73 3a 20 54 68 65 20 70 72 6f 6a 65 63 74 20 6f  s: The project o
2360: 66 20 74 68 65 20 6d 65 74 61 20 64 61 74 61 20  f the meta data 
2370: 6f 66 20 61 20 72 65 76 69 73 69 6f 6e 0a 09 20  of a revision.. 
2380: 20 20 20 2d 2d 20 20 20 20 20 20 20 20 20 20 20     --           
2390: 20 20 20 58 20 69 73 20 74 68 65 20 73 61 6d 65     X is the same
23a0: 20 61 73 20 74 68 65 20 70 72 6f 6a 65 63 74 20   as the project 
23b0: 6f 66 20 58 20 69 74 73 65 6c 66 2e 0a 09 20 20  of X itself...  
23c0: 20 20 2d 2d 0a 09 20 20 20 20 2d 2d 20 2e 2e 2e    --..    -- ...
23d0: 2e 2e 2e 2e 2e 2e 2e 2e 2e 20 54 68 65 20 62 72  ......... The br
23e0: 61 6e 63 68 20 6f 66 20 74 68 65 20 6d 65 74 61  anch of the meta
23f0: 20 64 61 74 61 20 6f 66 20 61 20 72 65 76 69 73   data of a revis
2400: 69 6f 6e 0a 09 20 20 20 20 2d 2d 20 20 20 20 20  ion..    --     
2410: 20 20 20 20 20 20 20 20 20 58 20 69 73 20 74 68           X is th
2420: 65 20 73 61 6d 65 20 61 73 20 74 68 65 20 6c 69  e same as the li
2430: 6e 65 20 6f 66 20 64 65 76 65 6c 6f 70 6d 65 6e  ne of developmen
2440: 74 0a 09 20 20 20 20 2d 2d 20 20 20 20 20 20 20  t..    --       
2450: 20 20 20 20 20 20 20 6f 66 20 58 20 69 74 73 65         of X itse
2460: 6c 66 2e 0a 09 7d 0a 0a 09 23 20 41 75 74 68 6f  lf...}...# Autho
2470: 72 73 20 61 6e 64 20 63 6f 6d 6d 69 74 20 6d 65  rs and commit me
2480: 73 73 61 67 65 73 20 61 72 65 20 66 75 6c 6c 79  ssages are fully
2490: 20 67 6c 6f 62 61 6c 2c 20 69 2e 65 2e 20 70 65   global, i.e. pe
24a0: 72 0a 09 23 20 72 65 70 6f 73 69 74 6f 72 79 2e  r..# repository.
24b0: 0a 0a 09 73 74 61 74 65 20 77 72 69 74 69 6e 67  ...state writing
24c0: 20 61 75 74 68 6f 72 20 7b 0a 09 20 20 20 20 61   author {..    a
24d0: 69 64 20 20 49 4e 54 45 47 45 52 20 20 4e 4f 54  id  INTEGER  NOT
24e0: 20 4e 55 4c 4c 20 20 50 52 49 4d 41 52 59 20 4b   NULL  PRIMARY K
24f0: 45 59 20 20 41 55 54 4f 49 4e 43 52 45 4d 45 4e  EY  AUTOINCREMEN
2500: 54 2c 0a 09 20 20 20 20 6e 61 6d 65 20 54 45 58  T,..    name TEX
2510: 54 20 20 20 20 20 4e 4f 54 20 4e 55 4c 4c 20 20  T     NOT NULL  
2520: 55 4e 49 51 55 45 0a 09 7d 0a 0a 09 73 74 61 74  UNIQUE..}...stat
2530: 65 20 77 72 69 74 69 6e 67 20 63 6d 65 73 73 61  e writing cmessa
2540: 67 65 20 7b 0a 09 20 20 20 20 63 69 64 20 20 49  ge {..    cid  I
2550: 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c  NTEGER  NOT NULL
2560: 20 20 50 52 49 4d 41 52 59 20 4b 45 59 20 20 41    PRIMARY KEY  A
2570: 55 54 4f 49 4e 43 52 45 4d 45 4e 54 2c 0a 09 20  UTOINCREMENT,.. 
2580: 20 20 20 74 65 78 74 20 54 45 58 54 20 20 20 20     text TEXT    
2590: 20 4e 4f 54 20 4e 55 4c 4c 20 20 55 4e 49 51 55   NOT NULL  UNIQU
25a0: 45 0a 09 7d 0a 0a 09 72 65 74 75 72 6e 0a 20 20  E..}...return.  
25b0: 20 20 7d 0a 0a 20 20 20 20 74 79 70 65 6d 65 74    }..    typemet
25c0: 68 6f 64 20 6c 6f 61 64 20 7b 7d 20 7b 0a 09 23  hod load {} {..#
25d0: 20 54 4f 44 4f 0a 09 72 65 74 75 72 6e 0a 20 20   TODO..return.  
25e0: 20 20 7d 0a 0a 20 20 20 20 74 79 70 65 6d 65 74    }..    typemet
25f0: 68 6f 64 20 72 75 6e 20 7b 7d 20 7b 0a 09 23 20  hod run {} {..# 
2600: 50 61 73 73 20 6d 61 6e 61 67 65 72 20 69 6e 74  Pass manager int
2610: 65 72 66 61 63 65 2e 20 45 78 65 63 75 74 65 64  erface. Executed
2620: 20 74 6f 20 70 65 72 66 6f 72 6d 20 74 68 65 0a   to perform the.
2630: 09 23 20 66 75 6e 63 74 69 6f 6e 61 6c 69 74 79  .# functionality
2640: 20 6f 66 20 74 68 65 20 70 61 73 73 2e 0a 0a 09   of the pass....
2650: 73 65 74 20 72 62 61 73 65 20 5b 72 65 70 6f 73  set rbase [repos
2660: 69 74 6f 72 79 20 62 61 73 65 3f 5d 0a 09 66 6f  itory base?]..fo
2670: 72 65 61 63 68 20 70 72 6f 6a 65 63 74 20 5b 72  reach project [r
2680: 65 70 6f 73 69 74 6f 72 79 20 70 72 6f 6a 65 63  epository projec
2690: 74 73 5d 20 7b 0a 09 20 20 20 20 73 65 74 20 62  ts] {..    set b
26a0: 61 73 65 20 5b 66 69 6c 65 20 6a 6f 69 6e 20 24  ase [file join $
26b0: 72 62 61 73 65 20 5b 24 70 72 6f 6a 65 63 74 20  rbase [$project 
26c0: 62 61 73 65 5d 5d 0a 09 20 20 20 20 6c 6f 67 20  base]]..    log 
26d0: 77 72 69 74 65 20 31 20 63 6f 6c 6c 72 65 76 20  write 1 collrev 
26e0: 22 50 72 6f 63 65 73 73 69 6e 67 20 24 62 61 73  "Processing $bas
26f0: 65 22 0a 0a 09 20 20 20 20 66 6f 72 65 61 63 68  e"...    foreach
2700: 20 66 69 6c 65 20 5b 24 70 72 6f 6a 65 63 74 20   file [$project 
2710: 66 69 6c 65 73 5d 20 7b 0a 09 09 73 65 74 20 70  files] {...set p
2720: 61 74 68 20 5b 24 66 69 6c 65 20 70 61 74 68 5d  ath [$file path]
2730: 0a 09 09 6c 6f 67 20 77 72 69 74 65 20 32 20 63  ...log write 2 c
2740: 6f 6c 6c 72 65 76 20 22 50 61 72 73 69 6e 67 20  ollrev "Parsing 
2750: 24 70 61 74 68 22 0a 09 09 69 66 20 7b 5b 63 61  $path"...if {[ca
2760: 74 63 68 20 7b 0a 09 09 20 20 20 20 70 61 72 73  tch {...    pars
2770: 65 72 20 70 72 6f 63 65 73 73 20 5b 66 69 6c 65  er process [file
2780: 20 6a 6f 69 6e 20 24 62 61 73 65 20 24 70 61 74   join $base $pat
2790: 68 5d 20 24 66 69 6c 65 0a 09 09 7d 20 6d 73 67  h] $file...} msg
27a0: 5d 7d 20 7b 0a 09 09 20 20 20 20 67 6c 6f 62 61  ]} {...    globa
27b0: 6c 20 65 72 72 6f 72 43 6f 64 65 0a 09 09 20 20  l errorCode...  
27c0: 20 20 69 66 20 7b 24 65 72 72 6f 72 43 6f 64 65    if {$errorCode
27d0: 20 65 71 20 22 76 63 3a 3a 72 63 73 3a 3a 70 61   eq "vc::rcs::pa
27e0: 72 73 65 72 22 7d 20 7b 0a 09 09 09 74 72 6f 75  rser"} {....trou
27f0: 62 6c 65 20 66 61 74 61 6c 20 22 24 70 61 74 68  ble fatal "$path
2800: 20 69 73 20 6e 6f 74 20 61 20 76 61 6c 69 64 20   is not a valid 
2810: 52 43 53 20 61 72 63 68 69 76 65 20 28 24 6d 73  RCS archive ($ms
2820: 67 29 22 0a 09 09 20 20 20 20 7d 20 65 6c 73 65  g)"...    } else
2830: 20 7b 0a 09 09 09 67 6c 6f 62 61 6c 20 65 72 72   {....global err
2840: 6f 72 49 6e 66 6f 0a 09 09 09 74 72 6f 75 62 6c  orInfo....troubl
2850: 65 20 69 6e 74 65 72 6e 61 6c 20 24 65 72 72 6f  e internal $erro
2860: 72 49 6e 66 6f 0a 09 09 20 20 20 20 7d 0a 09 09  rInfo...    }...
2870: 7d 20 65 6c 73 65 20 7b 0a 09 09 20 20 20 20 23  } else {...    #
2880: 20 57 65 20 70 65 72 73 69 73 74 20 74 68 65 20   We persist the 
2890: 63 6f 72 65 20 6f 66 20 74 68 65 20 64 61 74 61  core of the data
28a0: 20 63 6f 6c 6c 65 63 74 65 64 20 61 62 6f 75 74   collected about
28b0: 0a 09 09 20 20 20 20 23 20 65 61 63 68 20 66 69  ...    # each fi
28c0: 6c 65 20 69 6d 6d 65 64 69 61 74 65 6c 79 20 61  le immediately a
28d0: 66 74 65 72 20 69 74 20 68 61 73 20 62 65 65 6e  fter it has been
28e0: 20 70 61 72 73 65 64 0a 09 09 20 20 20 20 23 20   parsed...    # 
28f0: 61 6e 64 20 77 72 61 6e 67 6c 65 64 20 69 6e 74  and wrangled int
2900: 6f 20 73 68 61 70 65 2c 20 61 6e 64 20 74 68 65  o shape, and the
2910: 6e 20 64 72 6f 70 20 69 74 20 66 72 6f 6d 0a 09  n drop it from..
2920: 09 20 20 20 20 23 20 6d 65 6d 6f 72 79 2e 20 54  .    # memory. T
2930: 68 69 73 20 69 73 20 64 6f 6e 65 20 74 6f 20 6b  his is done to k
2940: 65 65 70 20 74 68 65 20 61 6d 6f 75 6e 74 20 6f  eep the amount o
2950: 66 0a 09 09 20 20 20 20 23 20 72 65 71 75 69 72  f...    # requir
2960: 65 64 20 6d 65 6d 6f 72 79 20 77 69 74 68 69 6e  ed memory within
2970: 20 73 65 6e 73 69 62 6c 65 20 6c 69 6d 69 74 73   sensible limits
2980: 2e 20 57 69 74 68 6f 75 74 0a 09 09 20 20 20 20  . Without...    
2990: 23 20 64 6f 69 6e 67 20 69 74 20 74 68 69 73 20  # doing it this 
29a0: 77 61 79 20 77 65 20 77 6f 75 6c 64 20 65 61 73  way we would eas
29b0: 69 6c 79 20 67 6f 62 62 6c 65 20 75 70 20 31 47  ily gobble up 1G
29c0: 0a 09 09 20 20 20 20 23 20 6f 66 20 52 41 4d 20  ...    # of RAM 
29d0: 6f 72 20 6d 6f 72 65 20 77 69 74 68 20 61 6c 6c  or more with all
29e0: 20 74 68 65 20 6f 62 6a 65 63 74 73 20 28 72 65   the objects (re
29f0: 76 69 73 69 6f 6e 73 0a 09 09 20 20 20 20 23 20  visions...    # 
2a00: 61 6e 64 20 66 69 6c 65 2d 6c 65 76 65 6c 20 73  and file-level s
2a10: 79 6d 62 6f 6c 73 29 2e 0a 0a 09 09 20 20 20 20  ymbols).....    
2a20: 24 66 69 6c 65 20 70 65 72 73 69 73 74 0a 09 09  $file persist...
2a30: 7d 0a 0a 09 09 24 66 69 6c 65 20 64 72 6f 70 0a  }....$file drop.
2a40: 09 20 20 20 20 7d 0a 09 7d 0a 0a 09 72 65 70 6f  .    }..}...repo
2a50: 73 69 74 6f 72 79 20 70 72 69 6e 74 72 65 76 73  sitory printrevs
2a60: 74 61 74 69 73 74 69 63 73 0a 09 72 65 70 6f 73  tatistics..repos
2a70: 69 74 6f 72 79 20 70 65 72 73 69 73 74 72 65 76  itory persistrev
2a80: 0a 0a 09 6c 6f 67 20 77 72 69 74 65 20 31 20 63  ...log write 1 c
2a90: 6f 6c 6c 72 65 76 20 22 53 63 61 6e 20 63 6f 6d  ollrev "Scan com
2aa0: 70 6c 65 74 65 64 22 0a 09 72 65 74 75 72 6e 0a  pleted"..return.
2ab0: 20 20 20 20 7d 0a 0a 20 20 20 20 74 79 70 65 6d      }..    typem
2ac0: 65 74 68 6f 64 20 64 69 73 63 61 72 64 20 7b 7d  ethod discard {}
2ad0: 20 7b 0a 09 23 20 50 61 73 73 20 6d 61 6e 61 67   {..# Pass manag
2ae0: 65 72 20 69 6e 74 65 72 66 61 63 65 2e 20 45 78  er interface. Ex
2af0: 65 63 75 74 65 64 20 66 6f 72 20 61 6c 6c 20 70  ecuted for all p
2b00: 61 73 73 65 73 20 61 66 74 65 72 20 74 68 65 0a  asses after the.
2b10: 09 23 20 72 75 6e 20 70 61 73 73 65 73 2c 20 74  .# run passes, t
2b20: 6f 20 72 65 6d 6f 76 65 20 61 6c 6c 20 64 61 74  o remove all dat
2b30: 61 20 6f 66 20 74 68 69 73 20 70 61 73 73 20 66  a of this pass f
2b40: 72 6f 6d 20 74 68 65 20 73 74 61 74 65 2c 0a 09  rom the state,..
2b50: 23 20 61 73 20 62 65 69 6e 67 20 6f 75 74 20 6f  # as being out o
2b60: 66 20 64 61 74 65 2e 0a 0a 09 73 74 61 74 65 20  f date....state 
2b70: 64 69 73 63 61 72 64 20 72 65 76 69 73 69 6f 6e  discard revision
2b80: 0a 09 73 74 61 74 65 20 64 69 73 63 61 72 64 20  ..state discard 
2b90: 74 61 67 0a 09 73 74 61 74 65 20 64 69 73 63 61  tag..state disca
2ba0: 72 64 20 62 72 61 6e 63 68 0a 09 73 74 61 74 65  rd branch..state
2bb0: 20 64 69 73 63 61 72 64 20 73 79 6d 62 6f 6c 0a   discard symbol.
2bc0: 09 73 74 61 74 65 20 64 69 73 63 61 72 64 20 62  .state discard b
2bd0: 6c 6f 63 6b 65 72 0a 09 73 74 61 74 65 20 64 69  locker..state di
2be0: 73 63 61 72 64 20 70 61 72 65 6e 74 0a 09 73 74  scard parent..st
2bf0: 61 74 65 20 64 69 73 63 61 72 64 20 6d 65 74 61  ate discard meta
2c00: 0a 09 73 74 61 74 65 20 64 69 73 63 61 72 64 20  ..state discard 
2c10: 61 75 74 68 6f 72 0a 09 73 74 61 74 65 20 64 69  author..state di
2c20: 73 63 61 72 64 20 63 6d 65 73 73 61 67 65 0a 09  scard cmessage..
2c30: 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20  return.    }..  
2c40: 20 20 23 20 23 20 23 23 20 23 23 23 20 23 23 23    # # ## ### ###
2c50: 23 23 20 23 23 23 23 23 23 23 23 20 23 23 23 23  ## ######## ####
2c60: 23 23 23 23 23 23 23 23 23 0a 20 20 20 20 23 23  #########.    ##
2c70: 20 49 6e 74 65 72 6e 61 6c 20 6d 65 74 68 6f 64   Internal method
2c80: 73 0a 0a 20 20 20 20 23 20 23 20 23 23 20 23 23  s..    # # ## ##
2c90: 23 20 23 23 23 23 23 20 23 23 23 23 23 23 23 23  # ##### ########
2ca0: 20 23 23 23 23 23 23 23 23 23 23 23 23 23 0a 20   #############. 
2cb0: 20 20 20 23 23 20 43 6f 6e 66 69 67 75 72 61 74     ## Configurat
2cc0: 69 6f 6e 0a 0a 20 20 20 20 70 72 61 67 6d 61 20  ion..    pragma 
2cd0: 2d 68 61 73 69 6e 73 74 61 6e 63 65 73 20 20 20  -hasinstances   
2ce0: 6e 6f 20 3b 20 23 20 73 69 6e 67 6c 65 74 6f 6e  no ; # singleton
2cf0: 0a 20 20 20 20 70 72 61 67 6d 61 20 2d 68 61 73  .    pragma -has
2d00: 74 79 70 65 69 6e 66 6f 20 20 20 20 6e 6f 20 3b  typeinfo    no ;
2d10: 20 23 20 6e 6f 20 69 6e 74 72 6f 73 70 65 63 74   # no introspect
2d20: 69 6f 6e 0a 20 20 20 20 70 72 61 67 6d 61 20 2d  ion.    pragma -
2d30: 68 61 73 74 79 70 65 64 65 73 74 72 6f 79 20 6e  hastypedestroy n
2d40: 6f 20 3b 20 23 20 69 6d 6d 6f 72 74 61 6c 0a 0a  o ; # immortal..
2d50: 20 20 20 20 23 20 23 20 23 23 20 23 23 23 20 23      # # ## ### #
2d60: 23 23 23 23 20 23 23 23 23 23 23 23 23 20 23 23  #### ######## ##
2d70: 23 23 23 23 23 23 23 23 23 23 23 0a 7d 0a 0a 6e  ###########.}..n
2d80: 61 6d 65 73 70 61 63 65 20 65 76 61 6c 20 3a 3a  amespace eval ::
2d90: 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f  vc::fossil::impo
2da0: 72 74 3a 3a 63 76 73 3a 3a 70 61 73 73 20 7b 0a  rt::cvs::pass {.
2db0: 20 20 20 20 6e 61 6d 65 73 70 61 63 65 20 65 78      namespace ex
2dc0: 70 6f 72 74 20 63 6f 6c 6c 72 65 76 0a 20 20 20  port collrev.   
2dd0: 20 6e 61 6d 65 73 70 61 63 65 20 65 76 61 6c 20   namespace eval 
2de0: 63 6f 6c 6c 72 65 76 20 7b 0a 09 6e 61 6d 65 73  collrev {..names
2df0: 70 61 63 65 20 69 6d 70 6f 72 74 20 3a 3a 76 63  pace import ::vc
2e00: 3a 3a 72 63 73 3a 3a 70 61 72 73 65 72 0a 09 6e  ::rcs::parser..n
2e10: 61 6d 65 73 70 61 63 65 20 69 6d 70 6f 72 74 20  amespace import 
2e20: 3a 3a 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d  ::vc::fossil::im
2e30: 70 6f 72 74 3a 3a 63 76 73 3a 3a 72 65 70 6f 73  port::cvs::repos
2e40: 69 74 6f 72 79 0a 09 6e 61 6d 65 73 70 61 63 65  itory..namespace
2e50: 20 69 6d 70 6f 72 74 20 3a 3a 76 63 3a 3a 66 6f   import ::vc::fo
2e60: 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76  ssil::import::cv
2e70: 73 3a 3a 73 74 61 74 65 0a 09 6e 61 6d 65 73 70  s::state..namesp
2e80: 61 63 65 20 69 6d 70 6f 72 74 20 3a 3a 76 63 3a  ace import ::vc:
2e90: 3a 74 6f 6f 6c 73 3a 3a 74 72 6f 75 62 6c 65 0a  :tools::trouble.
2ea0: 09 6e 61 6d 65 73 70 61 63 65 20 69 6d 70 6f 72  .namespace impor
2eb0: 74 20 3a 3a 76 63 3a 3a 74 6f 6f 6c 73 3a 3a 6c  t ::vc::tools::l
2ec0: 6f 67 0a 09 6c 6f 67 20 72 65 67 69 73 74 65 72  og..log register
2ed0: 20 63 6f 6c 6c 72 65 76 0a 20 20 20 20 7d 0a 7d   collrev.    }.}
2ee0: 0a 0a 23 20 23 20 23 23 20 23 23 23 20 23 23 23  ..# # ## ### ###
2ef0: 23 23 20 23 23 23 23 23 23 23 23 20 23 23 23 23  ## ######## ####
2f00: 23 23 23 23 23 23 23 23 23 20 23 23 23 23 23 23  ######### ######
2f10: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 0a  ###############.
2f20: 23 23 20 52 65 61 64 79 0a 0a 70 61 63 6b 61 67  ## Ready..packag
2f30: 65 20 70 72 6f 76 69 64 65 20 76 63 3a 3a 66 6f  e provide vc::fo
2f40: 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76  ssil::import::cv
2f50: 73 3a 3a 70 61 73 73 3a 3a 63 6f 6c 6c 72 65 76  s::pass::collrev
2f60: 20 31 2e 30 0a 72 65 74 75 72 6e 0a               1.0.return.