Hex Artifact Content
Not logged in

Artifact daf2ded7dd513fa15aec921c7fe268c81c006052:

File tools/cvs2fossil/lib/c2f_pcollrev.tcl part of check-in [ec053168a8] - Nicer parser integration into pass II, and sort files for easier filesystem traversal during parsing. by aku on 2007-10-06 20:58:24.

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 45 76 65 6e 74 2c 20 52 65 76 69 73 69 6f 6e  .Event, Revision
0940: 2c 20 53 79 6d 62 6f 6c 2c 20 42 72 61 6e 63 68  , Symbol, Branch
0950: 2c 20 54 61 67 0a 09 23 0a 09 23 09 54 61 67 20  , Tag..#..#.Tag 
0960: 20 20 20 3c 2d 20 53 79 6d 62 6f 6c 20 3c 2d 20     <- Symbol <- 
0970: 45 76 65 6e 74 0a 09 23 09 42 72 61 6e 63 68 20  Event..#.Branch 
0980: 3c 2d 20 53 79 6d 62 6f 6c 20 3c 2d 20 45 76 65  <- Symbol <- Eve
0990: 6e 74 0a 09 23 09 52 65 76 69 73 69 6f 6e 20 3c  nt..#.Revision <
09a0: 2d 20 45 76 65 6e 74 0a 09 23 0a 09 23 09 48 65  - Event..#..#.He
09b0: 61 64 20 72 65 76 69 73 69 6f 6e 2c 20 50 72 69  ad revision, Pri
09c0: 6e 63 69 70 61 6c 20 62 72 61 6e 63 68 2c 20 43  ncipal branch, C
09d0: 6f 6d 6d 65 6e 74 0a 0a 09 73 74 61 74 65 20 77  omment...state w
09e0: 72 69 74 69 6e 67 20 72 63 73 20 7b 0a 09 20 20  riting rcs {..  
09f0: 20 20 66 69 64 20 20 20 20 20 20 20 49 4e 54 45    fid       INTE
0a00: 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 52  GER  NOT NULL  R
0a10: 45 46 45 52 45 4e 43 45 53 20 66 69 6c 65 2c 20  EFERENCES file, 
0a20: 20 20 20 2d 2d 20 52 43 53 20 69 6e 68 65 72 69     -- RCS inheri
0a30: 74 20 66 72 6f 6d 20 46 49 4c 45 0a 09 20 20 20  t from FILE..   
0a40: 20 68 65 61 64 20 20 20 20 20 20 49 4e 54 45 47   head      INTEG
0a50: 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 52 45  ER  NOT NULL  RE
0a60: 46 45 52 45 4e 43 45 53 20 72 65 76 69 73 69 6f  FERENCES revisio
0a70: 6e 2c 0a 09 20 20 20 20 70 72 69 6e 63 69 70 61  n,..    principa
0a80: 6c 20 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e  l INTEGER  NOT N
0a90: 55 4c 4c 20 20 52 45 46 45 52 45 4e 43 45 53 20  ULL  REFERENCES 
0aa0: 62 72 61 6e 63 68 2c 0a 09 20 20 20 20 63 6f 6d  branch,..    com
0ab0: 6d 65 6e 74 20 20 20 54 45 58 54 20 20 20 20 20  ment   TEXT     
0ac0: 4e 4f 54 20 4e 55 4c 4c 0a 09 7d 0a 0a 09 73 74  NOT NULL..}...st
0ad0: 61 74 65 20 77 72 69 74 69 6e 67 20 69 74 65 6d  ate writing item
0ae0: 20 7b 0a 09 20 20 20 20 69 69 64 20 20 49 4e 54   {..    iid  INT
0af0: 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 20  EGER  NOT NULL  
0b00: 50 52 49 4d 41 52 59 20 4b 45 59 20 41 55 54 4f  PRIMARY KEY AUTO
0b10: 49 4e 43 52 45 4d 45 4e 54 2c 0a 09 20 20 20 20  INCREMENT,..    
0b20: 74 79 70 65 20 49 4e 54 45 47 45 52 20 20 4e 4f  type INTEGER  NO
0b30: 54 20 4e 55 4c 4c 2c 20 20 20 20 20 20 20 20 20  T NULL,         
0b40: 20 20 20 20 20 20 20 20 2d 2d 20 65 6e 75 6d 20          -- enum 
0b50: 7b 20 74 61 67 20 3d 20 31 2c 20 62 72 61 6e 63  { tag = 1, branc
0b60: 68 2c 20 72 65 76 69 73 69 6f 6e 20 7d 0a 09 20  h, revision }.. 
0b70: 20 20 20 66 69 64 20 20 49 4e 54 45 47 45 52 20     fid  INTEGER 
0b80: 20 4e 4f 54 20 4e 55 4c 4c 20 20 52 45 46 45 52   NOT NULL  REFER
0b90: 45 4e 43 45 53 20 66 69 6c 65 20 20 2d 2d 20 46  ENCES file  -- F
0ba0: 69 6c 65 20 74 68 65 20 69 74 65 6d 20 62 65 6c  ile the item bel
0bb0: 6f 6e 67 73 20 74 6f 0a 09 7d 0a 0a 09 73 74 61  ongs to..}...sta
0bc0: 74 65 20 77 72 69 74 69 6e 67 20 72 65 76 69 73  te writing revis
0bd0: 69 6f 6e 20 7b 0a 09 20 20 20 20 69 69 64 20 20  ion {..    iid  
0be0: 20 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55   INTEGER  NOT NU
0bf0: 4c 4c 20 20 52 45 46 45 52 45 4e 43 45 53 20 69  LL  REFERENCES i
0c00: 74 65 6d 2c 20 20 20 2d 2d 20 52 45 56 49 53 49  tem,   -- REVISI
0c10: 4f 4e 20 69 6e 68 65 72 69 74 20 66 72 6f 6d 20  ON inherit from 
0c20: 49 54 45 4d 0a 09 20 20 20 20 6c 6f 64 20 20 20  ITEM..    lod   
0c30: 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c  INTEGER  NOT NUL
0c40: 4c 20 20 52 45 46 45 52 45 4e 43 45 53 20 73 79  L  REFERENCES sy
0c50: 6d 62 6f 6c 2c 20 2d 2d 20 4c 69 6e 65 20 6f 66  mbol, -- Line of
0c60: 20 64 65 76 65 6c 6f 70 6d 65 6e 74 0a 0a 09 20   development... 
0c70: 20 20 20 2d 2d 20 54 68 65 20 74 61 67 73 20 61     -- The tags a
0c80: 6e 64 20 62 72 61 6e 63 68 65 73 20 62 65 6c 6f  nd branches belo
0c90: 6e 67 69 6e 67 20 74 6f 20 61 20 72 65 76 69 73  nging to a revis
0ca0: 69 6f 6e 20 63 61 6e 20 62 65 0a 09 20 20 20 20  ion can be..    
0cb0: 2d 2d 20 64 65 74 65 72 6d 69 6e 65 64 20 62 79  -- determined by
0cc0: 20 73 65 6c 65 63 74 69 6e 67 20 6f 6e 20 74 68   selecting on th
0cd0: 65 20 62 61 63 6b 72 65 66 65 72 65 6e 63 65 73  e backreferences
0ce0: 20 69 6e 20 74 68 65 0a 09 20 20 20 20 2d 2d 20   in the..    -- 
0cf0: 74 61 67 20 61 6e 64 20 62 72 61 6e 63 68 20 74  tag and branch t
0d00: 61 62 6c 65 73 2e 0a 0a 09 20 20 20 20 72 65 76  ables....    rev
0d10: 20 20 20 54 45 58 54 20 20 20 20 20 4e 4f 54 20     TEXT     NOT 
0d20: 4e 55 4c 4c 2c 20 20 20 20 20 20 20 20 20 20 20  NULL,           
0d30: 20 20 20 20 20 20 20 20 20 20 2d 2d 20 72 65 76            -- rev
0d40: 69 73 69 6f 6e 20 6e 75 6d 62 65 72 0a 09 20 20  ision number..  
0d50: 20 20 64 61 74 65 20 20 49 4e 54 45 47 45 52 20    date  INTEGER 
0d60: 20 4e 4f 54 20 4e 55 4c 4c 2c 20 20 20 20 20 20   NOT NULL,      
0d70: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2d                 -
0d80: 2d 20 64 61 74 65 20 6f 66 20 65 6e 74 72 79 2c  - date of entry,
0d90: 20 73 65 63 6f 6e 64 73 20 73 69 6e 63 65 20 65   seconds since e
0da0: 70 6f 63 68 0a 09 20 20 20 20 73 74 61 74 65 20  poch..    state 
0db0: 54 45 58 54 20 20 20 20 20 4e 4f 54 20 4e 55 4c  TEXT     NOT NUL
0dc0: 4c 2c 20 20 20 20 20 20 20 20 20 20 20 20 20 20  L,              
0dd0: 20 20 20 20 20 20 20 2d 2d 20 73 74 61 74 65 20         -- state 
0de0: 6f 66 20 72 65 76 69 73 69 6f 6e 0a 09 20 20 20  of revision..   
0df0: 20 6d 69 64 20 20 20 49 4e 54 45 47 45 52 20 20   mid   INTEGER  
0e00: 4e 4f 54 20 4e 55 4c 4c 20 52 45 46 45 52 45 4e  NOT NULL REFEREN
0e10: 43 45 53 20 6d 65 74 61 2c 20 20 20 20 20 2d 2d  CES meta,     --
0e20: 20 6d 65 74 61 20 64 61 74 61 20 28 61 75 74 68   meta data (auth
0e30: 6f 72 2c 20 63 6f 6d 6d 69 74 20 6d 65 73 73 61  or, commit messa
0e40: 67 65 29 0a 09 20 20 20 20 6e 65 78 74 20 20 49  ge)..    next  I
0e50: 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c  NTEGER  NOT NULL
0e60: 20 52 45 46 45 52 45 4e 43 45 53 20 72 65 76 69   REFERENCES revi
0e70: 73 69 6f 6e 2c 20 2d 2d 20 6e 65 78 74 20 69 6e  sion, -- next in
0e80: 20 63 68 61 69 6e 20 6f 66 20 72 65 76 69 73 69   chain of revisi
0e90: 6f 6e 73 2e 0a 09 20 20 20 20 63 73 20 20 20 20  ons...    cs    
0ea0: 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c  INTEGER  NOT NUL
0eb0: 4c 2c 20 2d 2d 20 52 65 76 69 73 69 6f 6e 20 63  L, -- Revision c
0ec0: 6f 6e 74 65 6e 74 20 61 73 20 6f 66 66 73 65 74  ontent as offset
0ed0: 20 61 6e 64 20 6c 65 6e 67 74 68 0a 09 20 20 20   and length..   
0ee0: 20 63 6c 20 20 20 20 49 4e 54 45 47 45 52 20 20   cl    INTEGER  
0ef0: 4e 4f 54 20 4e 55 4c 4c 20 20 2d 2d 20 69 6e 74  NOT NULL  -- int
0f00: 6f 20 74 68 65 20 61 72 63 68 69 76 65 20 66 69  o the archive fi
0f10: 6c 65 2e 0a 09 7d 0a 0a 09 73 74 61 74 65 20 77  le...}...state w
0f20: 72 69 74 69 6e 67 20 74 61 67 20 7b 0a 09 20 20  riting tag {..  
0f30: 20 20 69 69 64 20 49 4e 54 45 47 45 52 20 20 4e    iid INTEGER  N
0f40: 4f 54 20 4e 55 4c 4c 20 20 52 45 46 45 52 45 4e  OT NULL  REFEREN
0f50: 43 45 53 20 69 74 65 6d 2c 20 20 20 20 20 2d 2d  CES item,     --
0f60: 20 54 41 47 20 69 6e 68 65 72 69 74 20 66 72 6f   TAG inherit fro
0f70: 6d 20 49 54 45 4d 0a 09 20 20 20 20 73 69 64 20  m ITEM..    sid 
0f80: 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c  INTEGER  NOT NUL
0f90: 4c 20 20 52 45 46 45 52 45 4e 43 45 53 20 73 79  L  REFERENCES sy
0fa0: 6d 62 6f 6c 2c 20 20 20 2d 2d 20 53 79 6d 62 6f  mbol,   -- Symbo
0fb0: 6c 20 63 61 70 74 75 72 69 6e 67 20 74 68 65 20  l capturing the 
0fc0: 74 61 67 0a 09 20 20 20 20 72 65 76 20 49 4e 54  tag..    rev INT
0fd0: 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 20  EGER  NOT NULL  
0fe0: 52 45 46 45 52 45 4e 43 45 53 20 72 65 76 69 73  REFERENCES revis
0ff0: 69 6f 6e 20 2d 2d 20 54 68 65 20 72 65 76 69 73  ion -- The revis
1000: 69 6f 6e 20 62 65 69 6e 67 20 74 61 67 67 65 64  ion being tagged
1010: 2e 0a 09 7d 0a 0a 09 73 74 61 74 65 20 77 72 69  ...}...state wri
1020: 74 69 6e 67 20 62 72 61 6e 63 68 20 7b 0a 09 20  ting branch {.. 
1030: 20 20 20 69 69 64 20 20 20 49 4e 54 45 47 45 52     iid   INTEGER
1040: 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 52 45 46 45    NOT NULL  REFE
1050: 52 45 4e 43 45 53 20 69 74 65 6d 2c 20 20 20 20  RENCES item,    
1060: 20 2d 2d 20 42 52 41 4e 43 48 20 69 6e 68 65 72   -- BRANCH inher
1070: 69 74 20 66 72 6f 6d 20 49 54 45 4d 0a 09 20 20  it from ITEM..  
1080: 20 20 73 69 64 20 20 20 49 4e 54 45 47 45 52 20    sid   INTEGER 
1090: 20 4e 4f 54 20 4e 55 4c 4c 20 20 52 45 46 45 52   NOT NULL  REFER
10a0: 45 4e 43 45 53 20 73 79 6d 62 6f 6c 2c 20 20 20  ENCES symbol,   
10b0: 2d 2d 20 53 79 6d 62 6f 6c 20 63 61 70 74 75 72  -- Symbol captur
10c0: 69 6e 67 20 74 68 65 20 62 72 61 6e 63 68 0a 09  ing the branch..
10d0: 20 20 20 20 72 6f 6f 74 20 20 49 4e 54 45 47 45      root  INTEGE
10e0: 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 52 45 46  R  NOT NULL  REF
10f0: 45 52 45 4e 43 45 53 20 72 65 76 69 73 69 6f 6e  ERENCES revision
1100: 2c 20 2d 2d 20 52 65 76 69 73 69 6f 6e 20 74 68  , -- Revision th
1110: 65 20 62 72 61 6e 63 68 20 73 70 72 6f 75 74 73  e branch sprouts
1120: 20 66 72 6f 6d 0a 09 20 20 20 20 66 69 72 73 74   from..    first
1130: 20 49 4e 54 45 47 45 52 20 20 20 20 20 20 20 20   INTEGER        
1140: 20 20 20 20 52 45 46 45 52 45 4e 43 45 53 20 72      REFERENCES r
1150: 65 76 69 73 69 6f 6e 2c 20 2d 2d 20 46 69 72 73  evision, -- Firs
1160: 74 20 72 65 76 69 73 69 6f 6e 20 63 6f 6d 6d 69  t revision commi
1170: 74 74 65 64 20 74 6f 20 74 68 65 20 62 72 61 6e  tted to the bran
1180: 63 68 0a 09 20 20 20 20 62 72 61 20 20 20 54 45  ch..    bra   TE
1190: 58 54 20 20 20 20 20 4e 4f 54 20 4e 55 4c 4c 20  XT     NOT NULL 
11a0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
11b0: 20 20 20 20 20 20 2d 2d 20 62 72 61 6e 63 68 20        -- branch 
11c0: 6e 75 6d 62 65 72 0a 09 7d 0a 0a 09 23 20 49 74  number..}...# It
11d0: 20 69 73 20 69 6e 20 70 72 69 6e 63 69 70 6c 65   is in principle
11e0: 20 70 6f 73 73 69 62 6c 65 20 74 6f 20 63 6f 6c   possible to col
11f0: 6c 61 70 73 65 20 74 68 65 20 66 6f 75 72 20 74  lapse the four t
1200: 61 62 6c 65 73 0a 09 23 20 61 62 6f 76 65 20 28  ables..# above (
1210: 66 72 6f 6d 20 69 74 65 6d 20 74 6f 20 62 61 72  from item to bar
1220: 6e 63 68 29 20 69 6e 74 6f 20 61 20 73 69 6e 67  nch) into a sing
1230: 6c 65 20 74 61 62 6c 65 2c 20 77 69 74 68 0a 09  le table, with..
1240: 23 20 73 69 6d 69 6c 61 72 20 63 6f 6c 75 6d 6e  # similar column
1250: 73 20 6d 65 72 67 65 64 2c 20 61 6e 64 20 75 6e  s merged, and un
1260: 75 73 65 64 20 63 6f 6c 75 6d 6e 73 20 61 6c 6c  used columns all
1270: 6f 77 69 6e 67 20 4e 55 4c 4c 2c 0a 09 23 20 74  owing NULL,..# t
1280: 68 65 20 75 73 65 20 64 65 74 65 72 6d 69 6e 65  he use determine
1290: 64 20 62 79 20 74 68 65 20 74 79 70 65 2e 20 57  d by the type. W
12a0: 65 20 6d 61 79 20 64 6f 20 74 68 61 74 20 69 66  e may do that if
12b0: 20 74 68 65 0a 09 23 20 70 65 72 66 6f 72 6d 61   the..# performa
12c0: 6e 63 65 20 69 73 20 6e 6f 74 20 67 6f 6f 64 20  nce is not good 
12d0: 65 6e 6f 75 67 68 2c 20 62 75 74 20 66 6f 72 20  enough, but for 
12e0: 6e 6f 77 20 63 6c 61 72 69 74 79 20 6f 66 0a 09  now clarity of..
12f0: 23 20 73 74 72 75 63 74 75 72 65 20 6f 76 65 72  # structure over
1300: 20 65 66 66 69 63 69 65 6e 63 79 2e 0a 0a 09 23   efficiency....#
1310: 20 50 72 6f 6a 65 63 74 20 6c 65 76 65 6c 20 2e   Project level .
1320: 2e 2e 0a 09 23 09 70 4c 69 6e 65 4f 66 44 65 76  ....#.pLineOfDev
1330: 65 6c 6f 70 6d 65 6e 74 2c 20 70 53 79 6d 62 6f  elopment, pSymbo
1340: 6c 2c 20 70 42 72 61 6e 63 68 2c 20 70 54 61 67  l, pBranch, pTag
1350: 2c 20 70 54 72 75 6e 6b 0a 09 23 0a 09 23 09 70  , pTrunk..#..#.p
1360: 54 72 75 6e 6b 20 20 3c 2d 20 70 4c 69 6e 65 4f  Trunk  <- pLineO
1370: 66 44 65 76 65 6c 6f 70 6d 65 6e 74 0a 09 23 09  fDevelopment..#.
1380: 70 42 72 61 6e 63 68 20 3c 2d 20 70 53 79 6d 62  pBranch <- pSymb
1390: 6f 6c 2c 20 70 4c 69 6e 65 4f 66 44 65 76 65 6c  ol, pLineOfDevel
13a0: 6f 70 6d 65 6e 74 0a 09 23 09 70 54 61 67 20 20  opment..#.pTag  
13b0: 20 20 3c 2d 20 70 53 79 6d 62 6f 6c 2c 20 70 4c    <- pSymbol, pL
13c0: 69 6e 65 4f 66 44 65 76 65 6c 6f 70 6d 65 6e 74  ineOfDevelopment
13d0: 0a 0a 09 73 74 61 74 65 20 77 72 69 74 69 6e 67  ...state writing
13e0: 20 73 79 6d 62 6f 6c 20 7b 0a 09 20 20 20 20 73   symbol {..    s
13f0: 69 64 20 20 49 4e 54 45 47 45 52 20 20 4e 4f 54  id  INTEGER  NOT
1400: 20 4e 55 4c 4c 20 20 50 52 49 4d 41 52 59 20 4b   NULL  PRIMARY K
1410: 45 59 20 41 55 54 4f 49 4e 43 52 45 4d 45 4e 54  EY AUTOINCREMENT
1420: 2c 0a 09 20 20 20 20 70 69 64 20 20 49 4e 54 45  ,..    pid  INTE
1430: 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 52  GER  NOT NULL  R
1440: 45 46 45 52 45 4e 43 45 53 20 70 72 6f 6a 65 63  EFERENCES projec
1450: 74 2c 20 20 2d 2d 20 50 72 6f 6a 65 63 74 20 74  t,  -- Project t
1460: 68 65 20 73 79 6d 62 6f 6c 20 62 65 6c 6f 6e 67  he symbol belong
1470: 73 20 74 6f 0a 09 20 20 20 20 6e 61 6d 65 20 54  s to..    name T
1480: 45 58 54 20 20 20 20 20 4e 4f 54 20 4e 55 4c 4c  EXT     NOT NULL
1490: 2c 0a 09 20 20 20 20 74 79 70 65 20 49 4e 54 45  ,..    type INTE
14a0: 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 2c 20 20  GER  NOT NULL,  
14b0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
14c0: 20 20 20 20 2d 2d 20 65 6e 75 6d 20 7b 20 74 61      -- enum { ta
14d0: 67 20 3d 20 31 2c 20 62 72 61 6e 63 68 2c 20 75  g = 1, branch, u
14e0: 6e 64 65 66 69 6e 65 64 20 7d 0a 0a 09 20 20 20  ndefined }...   
14f0: 20 74 61 67 5f 63 6f 75 6e 74 20 20 20 20 49 4e   tag_count    IN
1500: 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 2c  TEGER  NOT NULL,
1510: 20 2d 2d 20 48 6f 77 20 6f 66 74 65 6e 20 74 68   -- How often th
1520: 65 20 73 79 6d 62 6f 6c 20 69 73 20 75 73 65 64  e symbol is used
1530: 20 61 73 20 74 61 67 2e 0a 09 20 20 20 20 62 72   as tag...    br
1540: 61 6e 63 68 5f 63 6f 75 6e 74 20 49 4e 54 45 47  anch_count INTEG
1550: 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 2c 20 2d 2d  ER  NOT NULL, --
1560: 20 48 6f 77 20 6f 66 74 65 6e 20 74 68 65 20 73   How often the s
1570: 79 6d 62 6f 6c 20 69 73 20 75 73 65 64 20 61 73  ymbol is used as
1580: 20 62 72 61 6e 63 68 0a 09 20 20 20 20 63 6f 6d   branch..    com
1590: 6d 69 74 5f 63 6f 75 6e 74 20 49 4e 54 45 47 45  mit_count INTEGE
15a0: 52 20 20 4e 4f 54 20 4e 55 4c 4c 2c 20 2d 2d 20  R  NOT NULL, -- 
15b0: 48 6f 77 20 6f 66 74 65 6e 20 61 20 66 69 6c 65  How often a file
15c0: 20 77 61 73 20 63 6f 6d 6d 69 74 74 65 64 20 6f   was committed o
15d0: 6e 20 74 68 65 20 73 79 6d 62 6f 6c 0a 0a 09 20  n the symbol... 
15e0: 20 20 20 55 4e 49 51 55 45 20 28 70 69 64 2c 20     UNIQUE (pid, 
15f0: 6e 61 6d 65 29 20 2d 2d 20 53 79 6d 62 6f 6c 73  name) -- Symbols
1600: 20 61 72 65 20 75 6e 69 71 75 65 20 77 69 74 68   are unique with
1610: 69 6e 20 74 68 65 20 70 72 6f 6a 65 63 74 0a 09  in the project..
1620: 7d 0a 0a 09 73 74 61 74 65 20 77 72 69 74 69 6e  }...state writin
1630: 67 20 62 6c 6f 63 6b 65 72 20 7b 0a 09 20 20 20  g blocker {..   
1640: 20 73 69 64 20 49 4e 54 45 47 45 52 20 20 4e 4f   sid INTEGER  NO
1650: 54 20 4e 55 4c 4c 20 20 52 45 46 45 52 45 4e 43  T NULL  REFERENC
1660: 45 53 20 73 79 6d 62 6f 6c 2c 20 2d 2d 20 0a 09  ES symbol, -- ..
1670: 20 20 20 20 62 69 64 20 49 4e 54 45 47 45 52 20      bid INTEGER 
1680: 20 4e 4f 54 20 4e 55 4c 4c 20 20 52 45 46 45 52   NOT NULL  REFER
1690: 45 4e 43 45 53 20 73 79 6d 62 6f 6c 2c 20 2d 2d  ENCES symbol, --
16a0: 20 53 70 72 6f 75 74 65 64 20 66 72 6f 6d 20 73   Sprouted from s
16b0: 69 64 2c 20 62 6c 6f 63 6b 73 20 69 74 2e 0a 09  id, blocks it...
16c0: 20 20 20 20 55 4e 49 51 55 45 20 28 73 69 64 2c      UNIQUE (sid,
16d0: 20 62 69 64 29 0a 09 7d 0a 0a 09 73 74 61 74 65   bid)..}...state
16e0: 20 77 72 69 74 69 6e 67 20 70 61 72 65 6e 74 20   writing parent 
16f0: 7b 0a 09 20 20 20 20 73 69 64 20 49 4e 54 45 47  {..    sid INTEG
1700: 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 52 45  ER  NOT NULL  RE
1710: 46 45 52 45 4e 43 45 53 20 73 79 6d 62 6f 6c 2c  FERENCES symbol,
1720: 20 2d 2d 20 0a 09 20 20 20 20 70 69 64 20 49 4e   -- ..    pid IN
1730: 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 20  TEGER  NOT NULL 
1740: 20 52 45 46 45 52 45 4e 43 45 53 20 73 79 6d 62   REFERENCES symb
1750: 6f 6c 2c 20 2d 2d 20 50 6f 73 73 69 62 6c 65 20  ol, -- Possible 
1760: 70 61 72 65 6e 74 20 6f 66 20 73 69 64 0a 09 20  parent of sid.. 
1770: 20 20 20 55 4e 49 51 55 45 20 28 73 69 64 2c 20     UNIQUE (sid, 
1780: 70 69 64 29 0a 09 7d 0a 0a 09 73 74 61 74 65 20  pid)..}...state 
1790: 77 72 69 74 69 6e 67 20 6d 65 74 61 20 7b 0a 09  writing meta {..
17a0: 20 20 20 20 6d 69 64 20 49 4e 54 45 47 45 52 20      mid INTEGER 
17b0: 20 4e 4f 54 20 4e 55 4c 4c 20 20 50 52 49 4d 41   NOT NULL  PRIMA
17c0: 52 59 20 4b 45 59 20 20 41 55 54 4f 49 4e 43 52  RY KEY  AUTOINCR
17d0: 45 4d 45 4e 54 2c 0a 09 20 20 20 20 70 69 64 20  EMENT,..    pid 
17e0: 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c  INTEGER  NOT NUL
17f0: 4c 20 20 52 45 46 45 52 45 4e 43 45 53 20 70 72  L  REFERENCES pr
1800: 6f 6a 65 63 74 2c 20 20 2d 2d 20 70 72 6f 6a 65  oject,  -- proje
1810: 63 74 20 74 68 65 20 63 6f 6d 6d 69 74 20 77 61  ct the commit wa
1820: 73 20 6f 6e 0a 09 20 20 20 20 62 69 64 20 49 4e  s on..    bid IN
1830: 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 20  TEGER  NOT NULL 
1840: 20 52 45 46 45 52 45 4e 43 45 53 20 73 79 6d 62   REFERENCES symb
1850: 6f 6c 2c 20 20 20 2d 2d 20 62 72 61 6e 63 68 20  ol,   -- branch 
1860: 74 68 65 20 63 6f 6d 6d 69 74 20 77 61 73 20 6f  the commit was o
1870: 6e 0a 09 20 20 20 20 61 69 64 20 49 4e 54 45 47  n..    aid INTEG
1880: 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 52 45  ER  NOT NULL  RE
1890: 46 45 52 45 4e 43 45 53 20 61 75 74 68 6f 72 2c  FERENCES author,
18a0: 0a 09 20 20 20 20 63 69 64 20 49 4e 54 45 47 45  ..    cid INTEGE
18b0: 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 52 45 46  R  NOT NULL  REF
18c0: 45 52 45 4e 43 45 53 20 63 6d 65 73 73 61 67 65  ERENCES cmessage
18d0: 2c 0a 0a 09 20 20 20 20 55 4e 49 51 55 45 20 28  ,...    UNIQUE (
18e0: 70 69 64 2c 20 62 69 64 2c 20 61 69 64 2c 20 63  pid, bid, aid, c
18f0: 69 64 29 0a 09 7d 0a 0a 09 23 20 41 75 74 68 6f  id)..}...# Autho
1900: 72 20 61 6e 64 20 63 6f 6d 6d 69 74 20 6d 65 73  r and commit mes
1910: 73 61 67 65 20 69 6e 66 6f 72 6d 61 74 69 6f 6e  sage information
1920: 20 69 73 20 66 75 6c 6c 79 20 67 6c 6f 62 61 6c   is fully global
1930: 2c 0a 09 23 20 69 2e 65 2e 20 70 65 72 20 72 65  ,..# i.e. per re
1940: 70 6f 73 69 74 6f 72 79 2e 0a 0a 09 73 74 61 74  pository....stat
1950: 65 20 77 72 69 74 69 6e 67 20 61 75 74 68 6f 72  e writing author
1960: 20 7b 0a 09 20 20 20 20 61 69 64 20 20 49 4e 54   {..    aid  INT
1970: 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 20  EGER  NOT NULL  
1980: 50 52 49 4d 41 52 59 20 4b 45 59 20 20 41 55 54  PRIMARY KEY  AUT
1990: 4f 49 4e 43 52 45 4d 45 4e 54 2c 0a 09 20 20 20  OINCREMENT,..   
19a0: 20 6e 61 6d 65 20 54 45 58 54 20 20 20 20 20 4e   name TEXT     N
19b0: 4f 54 20 4e 55 4c 4c 20 20 55 4e 49 51 55 45 0a  OT NULL  UNIQUE.
19c0: 09 7d 0a 0a 09 73 74 61 74 65 20 77 72 69 74 69  .}...state writi
19d0: 6e 67 20 63 6d 65 73 73 61 67 65 20 7b 0a 09 20  ng cmessage {.. 
19e0: 20 20 20 63 69 64 20 20 49 4e 54 45 47 45 52 20     cid  INTEGER 
19f0: 20 4e 4f 54 20 4e 55 4c 4c 20 20 50 52 49 4d 41   NOT NULL  PRIMA
1a00: 52 59 20 4b 45 59 20 20 41 55 54 4f 49 4e 43 52  RY KEY  AUTOINCR
1a10: 45 4d 45 4e 54 2c 0a 09 20 20 20 20 74 65 78 74  EMENT,..    text
1a20: 20 54 45 58 54 20 20 20 20 20 4e 4f 54 20 4e 55   TEXT     NOT NU
1a30: 4c 4c 20 20 55 4e 49 51 55 45 0a 09 7d 0a 0a 09  LL  UNIQUE..}...
1a40: 23 20 43 6f 6e 73 69 73 74 65 6e 63 79 20 63 6f  # Consistency co
1a50: 6e 73 74 72 61 69 6e 74 73 2e 0a 09 23 0a 09 23  nstraints...#..#
1a60: 20 49 74 65 6d 73 20 28 54 61 67 73 2c 20 42 72   Items (Tags, Br
1a70: 61 6e 63 68 65 73 2c 20 52 65 76 69 73 69 6f 6e  anches, Revision
1a80: 73 29 20 62 65 6c 6f 6e 67 20 74 6f 20 61 20 66  s) belong to a f
1a90: 69 6c 65 20 74 6f 20 61 0a 09 23 20 70 72 6f 6a  ile to a..# proj
1aa0: 65 63 74 2e 20 41 6c 6c 20 72 65 66 65 72 20 74  ect. All refer t
1ab0: 6f 20 6f 74 68 65 72 20 69 74 65 6d 73 2c 20 61  o other items, a
1ac0: 6e 64 20 73 79 6d 62 6f 6c 73 2c 20 77 68 69 63  nd symbols, whic
1ad0: 68 20 61 67 61 69 6e 0a 09 23 20 62 65 6c 6f 6e  h again..# belon
1ae0: 67 20 74 6f 20 61 20 70 72 6f 6a 65 63 74 2e 20  g to a project. 
1af0: 54 68 65 20 70 72 6f 6a 65 63 74 73 20 68 61 76  The projects hav
1b00: 65 20 74 6f 20 61 67 72 65 65 20 77 69 74 68 20  e to agree with 
1b10: 65 61 63 68 0a 09 23 20 6f 74 68 65 72 2e 20 49  each..# other. I
1b20: 2e 65 2e 20 69 74 65 6d 73 20 6d 61 79 20 6e 6f  .e. items may no
1b30: 74 20 72 65 66 65 72 20 74 6f 20 69 74 65 6d 73  t refer to items
1b40: 20 6f 72 20 73 79 6d 62 6f 6c 73 20 77 68 69 63   or symbols whic
1b50: 68 0a 09 23 20 62 65 6c 6f 6e 67 20 74 6f 20 61  h..# belong to a
1b60: 20 64 69 66 66 65 72 65 6e 74 20 70 72 6f 6a 65   different proje
1b70: 63 74 20 74 68 61 6e 20 74 68 65 69 72 20 6f 77  ct than their ow
1b80: 6e 2e 0a 0a 09 72 65 74 75 72 6e 0a 20 20 20 20  n....return.    
1b90: 7d 0a 0a 20 20 20 20 74 79 70 65 6d 65 74 68 6f  }..    typemetho
1ba0: 64 20 72 75 6e 20 7b 7d 20 7b 0a 09 73 65 74 20  d run {} {..set 
1bb0: 72 62 61 73 65 20 5b 72 65 70 6f 73 69 74 6f 72  rbase [repositor
1bc0: 79 20 62 61 73 65 3f 5d 0a 09 66 6f 72 65 61 63  y base?]..foreac
1bd0: 68 20 70 72 6f 6a 65 63 74 20 5b 72 65 70 6f 73  h project [repos
1be0: 69 74 6f 72 79 20 70 72 6f 6a 65 63 74 73 5d 20  itory projects] 
1bf0: 7b 0a 09 20 20 20 20 73 65 74 20 62 61 73 65 20  {..    set base 
1c00: 5b 66 69 6c 65 20 6a 6f 69 6e 20 24 72 62 61 73  [file join $rbas
1c10: 65 20 5b 24 70 72 6f 6a 65 63 74 20 62 61 73 65  e [$project base
1c20: 5d 5d 0a 09 20 20 20 20 6c 6f 67 20 77 72 69 74  ]]..    log writ
1c30: 65 20 31 20 63 6f 6c 6c 72 65 76 20 22 50 72 6f  e 1 collrev "Pro
1c40: 63 65 73 73 69 6e 67 20 24 62 61 73 65 22 0a 0a  cessing $base"..
1c50: 09 20 20 20 20 66 6f 72 65 61 63 68 20 66 69 6c  .    foreach fil
1c60: 65 20 5b 24 70 72 6f 6a 65 63 74 20 66 69 6c 65  e [$project file
1c70: 73 5d 20 7b 0a 09 09 73 65 74 20 70 61 74 68 20  s] {...set path 
1c80: 5b 24 66 69 6c 65 20 70 61 74 68 5d 0a 09 09 6c  [$file path]...l
1c90: 6f 67 20 77 72 69 74 65 20 32 20 63 6f 6c 6c 72  og write 2 collr
1ca0: 65 76 20 22 50 61 72 73 69 6e 67 20 24 70 61 74  ev "Parsing $pat
1cb0: 68 22 0a 09 09 70 61 72 73 65 72 20 70 72 6f 63  h"...parser proc
1cc0: 65 73 73 20 5b 66 69 6c 65 20 6a 6f 69 6e 20 24  ess [file join $
1cd0: 62 61 73 65 20 24 70 61 74 68 5d 20 24 66 69 6c  base $path] $fil
1ce0: 65 0a 09 20 20 20 20 7d 0a 09 7d 0a 0a 09 72 65  e..    }..}...re
1cf0: 70 6f 73 69 74 6f 72 79 20 70 72 69 6e 74 72 65  pository printre
1d00: 76 73 74 61 74 69 73 74 69 63 73 0a 09 72 65 70  vstatistics..rep
1d10: 6f 73 69 74 6f 72 79 20 70 65 72 73 69 73 74 72  ository persistr
1d20: 65 76 0a 0a 09 6c 6f 67 20 77 72 69 74 65 20 31  ev...log write 1
1d30: 20 63 6f 6c 6c 72 65 76 20 22 53 63 61 6e 20 63   collrev "Scan c
1d40: 6f 6d 70 6c 65 74 65 64 22 0a 09 72 65 74 75 72  ompleted"..retur
1d50: 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 23 20 23  n.    }..    # #
1d60: 20 23 23 20 23 23 23 20 23 23 23 23 23 20 23 23   ## ### ##### ##
1d70: 23 23 23 23 23 23 20 23 23 23 23 23 23 23 23 23  ###### #########
1d80: 23 23 23 23 0a 20 20 20 20 23 23 20 49 6e 74 65  ####.    ## Inte
1d90: 72 6e 61 6c 20 6d 65 74 68 6f 64 73 0a 0a 20 20  rnal methods..  
1da0: 20 20 23 20 23 20 23 23 20 23 23 23 20 23 23 23    # # ## ### ###
1db0: 23 23 20 23 23 23 23 23 23 23 23 20 23 23 23 23  ## ######## ####
1dc0: 23 23 23 23 23 23 23 23 23 0a 20 20 20 20 23 23  #########.    ##
1dd0: 20 43 6f 6e 66 69 67 75 72 61 74 69 6f 6e 0a 0a   Configuration..
1de0: 20 20 20 20 70 72 61 67 6d 61 20 2d 68 61 73 69      pragma -hasi
1df0: 6e 73 74 61 6e 63 65 73 20 20 20 6e 6f 20 3b 20  nstances   no ; 
1e00: 23 20 73 69 6e 67 6c 65 74 6f 6e 0a 20 20 20 20  # singleton.    
1e10: 70 72 61 67 6d 61 20 2d 68 61 73 74 79 70 65 69  pragma -hastypei
1e20: 6e 66 6f 20 20 20 20 6e 6f 20 3b 20 23 20 6e 6f  nfo    no ; # no
1e30: 20 69 6e 74 72 6f 73 70 65 63 74 69 6f 6e 0a 20   introspection. 
1e40: 20 20 20 70 72 61 67 6d 61 20 2d 68 61 73 74 79     pragma -hasty
1e50: 70 65 64 65 73 74 72 6f 79 20 6e 6f 20 3b 20 23  pedestroy no ; #
1e60: 20 69 6d 6d 6f 72 74 61 6c 0a 0a 20 20 20 20 23   immortal..    #
1e70: 20 23 20 23 23 20 23 23 23 20 23 23 23 23 23 20   # ## ### ##### 
1e80: 23 23 23 23 23 23 23 23 20 23 23 23 23 23 23 23  ######## #######
1e90: 23 23 23 23 23 23 0a 7d 0a 0a 6e 61 6d 65 73 70  ######.}..namesp
1ea0: 61 63 65 20 65 76 61 6c 20 3a 3a 76 63 3a 3a 66  ace eval ::vc::f
1eb0: 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63  ossil::import::c
1ec0: 76 73 3a 3a 70 61 73 73 20 7b 0a 20 20 20 20 6e  vs::pass {.    n
1ed0: 61 6d 65 73 70 61 63 65 20 65 78 70 6f 72 74 20  amespace export 
1ee0: 63 6f 6c 6c 72 65 76 0a 20 20 20 20 6e 61 6d 65  collrev.    name
1ef0: 73 70 61 63 65 20 65 76 61 6c 20 63 6f 6c 6c 72  space eval collr
1f00: 65 76 20 7b 0a 09 6e 61 6d 65 73 70 61 63 65 20  ev {..namespace 
1f10: 69 6d 70 6f 72 74 20 3a 3a 76 63 3a 3a 72 63 73  import ::vc::rcs
1f20: 3a 3a 70 61 72 73 65 72 0a 09 6e 61 6d 65 73 70  ::parser..namesp
1f30: 61 63 65 20 69 6d 70 6f 72 74 20 3a 3a 76 63 3a  ace import ::vc:
1f40: 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a  :fossil::import:
1f50: 3a 63 76 73 3a 3a 72 65 70 6f 73 69 74 6f 72 79  :cvs::repository
1f60: 0a 09 6e 61 6d 65 73 70 61 63 65 20 69 6d 70 6f  ..namespace impo
1f70: 72 74 20 3a 3a 76 63 3a 3a 66 6f 73 73 69 6c 3a  rt ::vc::fossil:
1f80: 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 73 74  :import::cvs::st
1f90: 61 74 65 0a 09 6e 61 6d 65 73 70 61 63 65 20 69  ate..namespace i
1fa0: 6d 70 6f 72 74 20 3a 3a 76 63 3a 3a 74 6f 6f 6c  mport ::vc::tool
1fb0: 73 3a 3a 74 72 6f 75 62 6c 65 0a 09 6e 61 6d 65  s::trouble..name
1fc0: 73 70 61 63 65 20 69 6d 70 6f 72 74 20 3a 3a 76  space import ::v
1fd0: 63 3a 3a 74 6f 6f 6c 73 3a 3a 6c 6f 67 0a 09 6c  c::tools::log..l
1fe0: 6f 67 20 72 65 67 69 73 74 65 72 20 63 6f 6c 6c  og register coll
1ff0: 72 65 76 0a 20 20 20 20 7d 0a 7d 0a 0a 23 20 23  rev.    }.}..# #
2000: 20 23 23 20 23 23 23 20 23 23 23 23 23 20 23 23   ## ### ##### ##
2010: 23 23 23 23 23 23 20 23 23 23 23 23 23 23 23 23  ###### #########
2020: 23 23 23 23 20 23 23 23 23 23 23 23 23 23 23 23  #### ###########
2030: 23 23 23 23 23 23 23 23 23 23 0a 23 23 20 52 65  ##########.## Re
2040: 61 64 79 0a 0a 70 61 63 6b 61 67 65 20 70 72 6f  ady..package pro
2050: 76 69 64 65 20 76 63 3a 3a 66 6f 73 73 69 6c 3a  vide vc::fossil:
2060: 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 70 61  :import::cvs::pa
2070: 73 73 3a 3a 63 6f 6c 6c 72 65 76 20 31 2e 30 0a  ss::collrev 1.0.
2080: 72 65 74 75 72 6e 0a                             return.