Hex Artifact Content
Not logged in

Artifact 47f6b87c0bc9b02c3caafae9dfe20253b87f3b6f:

File tools/cvs2fossil/lib/c2f_pcollrev.tcl part of check-in [67c24820c7] - Reworked the whole handling of meta data (author, commit message, plus project/branch information), so that revisions now store only the meta id, everything else is stored centrally. All the relevant pieces (author, cmessage, symbols, projects) now also get numeric ids assigned early instead of when being saved to the state. Project ids are loaded from the state now too. by aku on 2007-10-14 01:58:07.

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 20 20 20 20 20 20 20 20 20  TEGER           
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 2c 20 4e 55 4c 4c 20 66 6f 72 20 3a 74 72 75  n, NULL for :tru
1880: 6e 6b 3a 0a 09 20 20 20 20 61 69 64 20 49 4e 54  nk:..    aid INT
1890: 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 20  EGER  NOT NULL  
18a0: 52 45 46 45 52 45 4e 43 45 53 20 61 75 74 68 6f  REFERENCES autho
18b0: 72 2c 0a 09 20 20 20 20 63 69 64 20 49 4e 54 45  r,..    cid INTE
18c0: 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 52  GER  NOT NULL  R
18d0: 45 46 45 52 45 4e 43 45 53 20 63 6d 65 73 73 61  EFERENCES cmessa
18e0: 67 65 2c 0a 09 20 20 20 20 55 4e 49 51 55 45 20  ge,..    UNIQUE 
18f0: 28 70 69 64 2c 20 62 69 64 2c 20 61 69 64 2c 20  (pid, bid, aid, 
1900: 63 69 64 29 0a 09 7d 0a 0a 09 23 20 41 75 74 68  cid)..}...# Auth
1910: 6f 72 20 61 6e 64 20 63 6f 6d 6d 69 74 20 6d 65  or and commit me
1920: 73 73 61 67 65 20 69 6e 66 6f 72 6d 61 74 69 6f  ssage informatio
1930: 6e 20 69 73 20 66 75 6c 6c 79 20 67 6c 6f 62 61  n is fully globa
1940: 6c 2c 0a 09 23 20 69 2e 65 2e 20 70 65 72 20 72  l,..# i.e. per r
1950: 65 70 6f 73 69 74 6f 72 79 2e 0a 0a 09 73 74 61  epository....sta
1960: 74 65 20 77 72 69 74 69 6e 67 20 61 75 74 68 6f  te writing autho
1970: 72 20 7b 0a 09 20 20 20 20 61 69 64 20 20 49 4e  r {..    aid  IN
1980: 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 20  TEGER  NOT NULL 
1990: 20 50 52 49 4d 41 52 59 20 4b 45 59 20 20 41 55   PRIMARY KEY  AU
19a0: 54 4f 49 4e 43 52 45 4d 45 4e 54 2c 0a 09 20 20  TOINCREMENT,..  
19b0: 20 20 6e 61 6d 65 20 54 45 58 54 20 20 20 20 20    name TEXT     
19c0: 4e 4f 54 20 4e 55 4c 4c 20 20 55 4e 49 51 55 45  NOT NULL  UNIQUE
19d0: 0a 09 7d 0a 0a 09 73 74 61 74 65 20 77 72 69 74  ..}...state writ
19e0: 69 6e 67 20 63 6d 65 73 73 61 67 65 20 7b 0a 09  ing cmessage {..
19f0: 20 20 20 20 63 69 64 20 20 49 4e 54 45 47 45 52      cid  INTEGER
1a00: 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 50 52 49 4d    NOT NULL  PRIM
1a10: 41 52 59 20 4b 45 59 20 20 41 55 54 4f 49 4e 43  ARY KEY  AUTOINC
1a20: 52 45 4d 45 4e 54 2c 0a 09 20 20 20 20 74 65 78  REMENT,..    tex
1a30: 74 20 54 45 58 54 20 20 20 20 20 4e 4f 54 20 4e  t TEXT     NOT N
1a40: 55 4c 4c 20 20 55 4e 49 51 55 45 0a 09 7d 0a 0a  ULL  UNIQUE..}..
1a50: 09 23 20 43 6f 6e 73 69 73 74 65 6e 63 79 20 63  .# Consistency c
1a60: 6f 6e 73 74 72 61 69 6e 74 73 2e 0a 09 23 0a 09  onstraints...#..
1a70: 23 20 49 74 65 6d 73 20 28 54 61 67 73 2c 20 42  # Items (Tags, B
1a80: 72 61 6e 63 68 65 73 2c 20 52 65 76 69 73 69 6f  ranches, Revisio
1a90: 6e 73 29 20 62 65 6c 6f 6e 67 20 74 6f 20 61 20  ns) belong to a 
1aa0: 66 69 6c 65 20 74 6f 20 61 0a 09 23 20 70 72 6f  file to a..# pro
1ab0: 6a 65 63 74 2e 20 41 6c 6c 20 72 65 66 65 72 20  ject. All refer 
1ac0: 74 6f 20 6f 74 68 65 72 20 69 74 65 6d 73 2c 20  to other items, 
1ad0: 61 6e 64 20 73 79 6d 62 6f 6c 73 2c 20 77 68 69  and symbols, whi
1ae0: 63 68 20 61 67 61 69 6e 0a 09 23 20 62 65 6c 6f  ch again..# belo
1af0: 6e 67 20 74 6f 20 61 20 70 72 6f 6a 65 63 74 2e  ng to a project.
1b00: 20 54 68 65 20 70 72 6f 6a 65 63 74 73 20 68 61   The projects ha
1b10: 76 65 20 74 6f 20 61 67 72 65 65 20 77 69 74 68  ve to agree with
1b20: 20 65 61 63 68 0a 09 23 20 6f 74 68 65 72 2e 20   each..# other. 
1b30: 49 2e 65 2e 20 69 74 65 6d 73 20 6d 61 79 20 6e  I.e. items may n
1b40: 6f 74 20 72 65 66 65 72 20 74 6f 20 69 74 65 6d  ot refer to item
1b50: 73 20 6f 72 20 73 79 6d 62 6f 6c 73 20 77 68 69  s or symbols whi
1b60: 63 68 0a 09 23 20 62 65 6c 6f 6e 67 20 74 6f 20  ch..# belong to 
1b70: 61 20 64 69 66 66 65 72 65 6e 74 20 70 72 6f 6a  a different proj
1b80: 65 63 74 20 74 68 61 6e 20 74 68 65 69 72 20 6f  ect than their o
1b90: 77 6e 2e 0a 0a 09 72 65 74 75 72 6e 0a 20 20 20  wn....return.   
1ba0: 20 7d 0a 0a 20 20 20 20 74 79 70 65 6d 65 74 68   }..    typemeth
1bb0: 6f 64 20 6c 6f 61 64 20 7b 7d 20 7b 0a 09 23 20  od load {} {..# 
1bc0: 54 4f 44 4f 0a 09 72 65 74 75 72 6e 0a 20 20 20  TODO..return.   
1bd0: 20 7d 0a 0a 20 20 20 20 74 79 70 65 6d 65 74 68   }..    typemeth
1be0: 6f 64 20 72 75 6e 20 7b 7d 20 7b 0a 09 23 20 50  od run {} {..# P
1bf0: 61 73 73 20 6d 61 6e 61 67 65 72 20 69 6e 74 65  ass manager inte
1c00: 72 66 61 63 65 2e 20 45 78 65 63 75 74 65 64 20  rface. Executed 
1c10: 74 6f 20 70 65 72 66 6f 72 6d 20 74 68 65 0a 09  to perform the..
1c20: 23 20 66 75 6e 63 74 69 6f 6e 61 6c 69 74 79 20  # functionality 
1c30: 6f 66 20 74 68 65 20 70 61 73 73 2e 0a 0a 09 73  of the pass....s
1c40: 65 74 20 72 62 61 73 65 20 5b 72 65 70 6f 73 69  et rbase [reposi
1c50: 74 6f 72 79 20 62 61 73 65 3f 5d 0a 09 66 6f 72  tory base?]..for
1c60: 65 61 63 68 20 70 72 6f 6a 65 63 74 20 5b 72 65  each project [re
1c70: 70 6f 73 69 74 6f 72 79 20 70 72 6f 6a 65 63 74  pository project
1c80: 73 5d 20 7b 0a 09 20 20 20 20 73 65 74 20 62 61  s] {..    set ba
1c90: 73 65 20 5b 66 69 6c 65 20 6a 6f 69 6e 20 24 72  se [file join $r
1ca0: 62 61 73 65 20 5b 24 70 72 6f 6a 65 63 74 20 62  base [$project b
1cb0: 61 73 65 5d 5d 0a 09 20 20 20 20 6c 6f 67 20 77  ase]]..    log w
1cc0: 72 69 74 65 20 31 20 63 6f 6c 6c 72 65 76 20 22  rite 1 collrev "
1cd0: 50 72 6f 63 65 73 73 69 6e 67 20 24 62 61 73 65  Processing $base
1ce0: 22 0a 0a 09 20 20 20 20 66 6f 72 65 61 63 68 20  "...    foreach 
1cf0: 66 69 6c 65 20 5b 24 70 72 6f 6a 65 63 74 20 66  file [$project f
1d00: 69 6c 65 73 5d 20 7b 0a 09 09 73 65 74 20 70 61  iles] {...set pa
1d10: 74 68 20 5b 24 66 69 6c 65 20 70 61 74 68 5d 0a  th [$file path].
1d20: 09 09 6c 6f 67 20 77 72 69 74 65 20 32 20 63 6f  ..log write 2 co
1d30: 6c 6c 72 65 76 20 22 50 61 72 73 69 6e 67 20 24  llrev "Parsing $
1d40: 70 61 74 68 22 0a 09 09 69 66 20 7b 5b 63 61 74  path"...if {[cat
1d50: 63 68 20 7b 0a 09 09 20 20 20 20 70 61 72 73 65  ch {...    parse
1d60: 72 20 70 72 6f 63 65 73 73 20 5b 66 69 6c 65 20  r process [file 
1d70: 6a 6f 69 6e 20 24 62 61 73 65 20 24 70 61 74 68  join $base $path
1d80: 5d 20 24 66 69 6c 65 0a 09 09 7d 20 6d 73 67 5d  ] $file...} msg]
1d90: 7d 20 7b 0a 09 09 20 20 20 20 67 6c 6f 62 61 6c  } {...    global
1da0: 20 65 72 72 6f 72 43 6f 64 65 0a 09 09 20 20 20   errorCode...   
1db0: 20 69 66 20 7b 24 65 72 72 6f 72 43 6f 64 65 20   if {$errorCode 
1dc0: 65 71 20 22 76 63 3a 3a 72 63 73 3a 3a 70 61 72  eq "vc::rcs::par
1dd0: 73 65 72 22 7d 20 7b 0a 09 09 09 74 72 6f 75 62  ser"} {....troub
1de0: 6c 65 20 66 61 74 61 6c 20 22 24 70 61 74 68 20  le fatal "$path 
1df0: 69 73 20 6e 6f 74 20 61 20 76 61 6c 69 64 20 52  is not a valid R
1e00: 43 53 20 61 72 63 68 69 76 65 20 28 24 6d 73 67  CS archive ($msg
1e10: 29 22 0a 09 09 20 20 20 20 7d 20 65 6c 73 65 20  )"...    } else 
1e20: 7b 0a 09 09 09 67 6c 6f 62 61 6c 20 65 72 72 6f  {....global erro
1e30: 72 49 6e 66 6f 0a 09 09 09 74 72 6f 75 62 6c 65  rInfo....trouble
1e40: 20 69 6e 74 65 72 6e 61 6c 20 24 65 72 72 6f 72   internal $error
1e50: 49 6e 66 6f 0a 09 09 20 20 20 20 7d 0a 09 09 7d  Info...    }...}
1e60: 0a 09 20 20 20 20 7d 0a 09 7d 0a 0a 09 72 65 70  ..    }..}...rep
1e70: 6f 73 69 74 6f 72 79 20 70 72 69 6e 74 72 65 76  ository printrev
1e80: 73 74 61 74 69 73 74 69 63 73 0a 09 72 65 70 6f  statistics..repo
1e90: 73 69 74 6f 72 79 20 70 65 72 73 69 73 74 72 65  sitory persistre
1ea0: 76 0a 0a 09 6c 6f 67 20 77 72 69 74 65 20 31 20  v...log write 1 
1eb0: 63 6f 6c 6c 72 65 76 20 22 53 63 61 6e 20 63 6f  collrev "Scan co
1ec0: 6d 70 6c 65 74 65 64 22 0a 09 72 65 74 75 72 6e  mpleted"..return
1ed0: 0a 20 20 20 20 7d 0a 0a 20 20 20 20 74 79 70 65  .    }..    type
1ee0: 6d 65 74 68 6f 64 20 64 69 73 63 61 72 64 20 7b  method discard {
1ef0: 7d 20 7b 0a 09 23 20 50 61 73 73 20 6d 61 6e 61  } {..# Pass mana
1f00: 67 65 72 20 69 6e 74 65 72 66 61 63 65 2e 20 45  ger interface. E
1f10: 78 65 63 75 74 65 64 20 66 6f 72 20 61 6c 6c 20  xecuted for all 
1f20: 70 61 73 73 65 73 20 61 66 74 65 72 20 74 68 65  passes after the
1f30: 0a 09 23 20 72 75 6e 20 70 61 73 73 65 73 2c 20  ..# run passes, 
1f40: 74 6f 20 72 65 6d 6f 76 65 20 61 6c 6c 20 64 61  to remove all da
1f50: 74 61 20 6f 66 20 74 68 69 73 20 70 61 73 73 20  ta of this pass 
1f60: 66 72 6f 6d 20 74 68 65 20 73 74 61 74 65 2c 0a  from the state,.
1f70: 09 23 20 61 73 20 62 65 69 6e 67 20 6f 75 74 20  .# as being out 
1f80: 6f 66 20 64 61 74 65 2e 0a 0a 09 73 74 61 74 65  of date....state
1f90: 20 64 69 73 63 61 72 64 20 72 63 73 0a 09 73 74   discard rcs..st
1fa0: 61 74 65 20 64 69 73 63 61 72 64 20 69 74 65 6d  ate discard item
1fb0: 0a 09 73 74 61 74 65 20 64 69 73 63 61 72 64 20  ..state discard 
1fc0: 72 65 76 69 73 69 6f 6e 0a 09 73 74 61 74 65 20  revision..state 
1fd0: 64 69 73 63 61 72 64 20 74 61 67 0a 09 73 74 61  discard tag..sta
1fe0: 74 65 20 64 69 73 63 61 72 64 20 62 72 61 6e 63  te discard branc
1ff0: 68 0a 09 73 74 61 74 65 20 64 69 73 63 61 72 64  h..state discard
2000: 20 73 79 6d 62 6f 6c 0a 09 73 74 61 74 65 20 64   symbol..state d
2010: 69 73 63 61 72 64 20 62 6c 6f 63 6b 65 72 0a 09  iscard blocker..
2020: 73 74 61 74 65 20 64 69 73 63 61 72 64 20 70 61  state discard pa
2030: 72 65 6e 74 0a 09 73 74 61 74 65 20 64 69 73 63  rent..state disc
2040: 61 72 64 20 6d 65 74 61 0a 09 73 74 61 74 65 20  ard meta..state 
2050: 64 69 73 63 61 72 64 20 61 75 74 68 6f 72 0a 09  discard author..
2060: 73 74 61 74 65 20 64 69 73 63 61 72 64 20 63 6d  state discard cm
2070: 65 73 73 61 67 65 0a 09 72 65 74 75 72 6e 0a 20  essage..return. 
2080: 20 20 20 7d 0a 0a 20 20 20 20 23 20 23 20 23 23     }..    # # ##
2090: 20 23 23 23 20 23 23 23 23 23 20 23 23 23 23 23   ### ##### #####
20a0: 23 23 23 20 23 23 23 23 23 23 23 23 23 23 23 23  ### ############
20b0: 23 0a 20 20 20 20 23 23 20 49 6e 74 65 72 6e 61  #.    ## Interna
20c0: 6c 20 6d 65 74 68 6f 64 73 0a 0a 20 20 20 20 23  l methods..    #
20d0: 20 23 20 23 23 20 23 23 23 20 23 23 23 23 23 20   # ## ### ##### 
20e0: 23 23 23 23 23 23 23 23 20 23 23 23 23 23 23 23  ######## #######
20f0: 23 23 23 23 23 23 0a 20 20 20 20 23 23 20 43 6f  ######.    ## Co
2100: 6e 66 69 67 75 72 61 74 69 6f 6e 0a 0a 20 20 20  nfiguration..   
2110: 20 70 72 61 67 6d 61 20 2d 68 61 73 69 6e 73 74   pragma -hasinst
2120: 61 6e 63 65 73 20 20 20 6e 6f 20 3b 20 23 20 73  ances   no ; # s
2130: 69 6e 67 6c 65 74 6f 6e 0a 20 20 20 20 70 72 61  ingleton.    pra
2140: 67 6d 61 20 2d 68 61 73 74 79 70 65 69 6e 66 6f  gma -hastypeinfo
2150: 20 20 20 20 6e 6f 20 3b 20 23 20 6e 6f 20 69 6e      no ; # no in
2160: 74 72 6f 73 70 65 63 74 69 6f 6e 0a 20 20 20 20  trospection.    
2170: 70 72 61 67 6d 61 20 2d 68 61 73 74 79 70 65 64  pragma -hastyped
2180: 65 73 74 72 6f 79 20 6e 6f 20 3b 20 23 20 69 6d  estroy no ; # im
2190: 6d 6f 72 74 61 6c 0a 0a 20 20 20 20 23 20 23 20  mortal..    # # 
21a0: 23 23 20 23 23 23 20 23 23 23 23 23 20 23 23 23  ## ### ##### ###
21b0: 23 23 23 23 23 20 23 23 23 23 23 23 23 23 23 23  ##### ##########
21c0: 23 23 23 0a 7d 0a 0a 6e 61 6d 65 73 70 61 63 65  ###.}..namespace
21d0: 20 65 76 61 6c 20 3a 3a 76 63 3a 3a 66 6f 73 73   eval ::vc::foss
21e0: 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a  il::import::cvs:
21f0: 3a 70 61 73 73 20 7b 0a 20 20 20 20 6e 61 6d 65  :pass {.    name
2200: 73 70 61 63 65 20 65 78 70 6f 72 74 20 63 6f 6c  space export col
2210: 6c 72 65 76 0a 20 20 20 20 6e 61 6d 65 73 70 61  lrev.    namespa
2220: 63 65 20 65 76 61 6c 20 63 6f 6c 6c 72 65 76 20  ce eval collrev 
2230: 7b 0a 09 6e 61 6d 65 73 70 61 63 65 20 69 6d 70  {..namespace imp
2240: 6f 72 74 20 3a 3a 76 63 3a 3a 72 63 73 3a 3a 70  ort ::vc::rcs::p
2250: 61 72 73 65 72 0a 09 6e 61 6d 65 73 70 61 63 65  arser..namespace
2260: 20 69 6d 70 6f 72 74 20 3a 3a 76 63 3a 3a 66 6f   import ::vc::fo
2270: 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76  ssil::import::cv
2280: 73 3a 3a 72 65 70 6f 73 69 74 6f 72 79 0a 09 6e  s::repository..n
2290: 61 6d 65 73 70 61 63 65 20 69 6d 70 6f 72 74 20  amespace import 
22a0: 3a 3a 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d  ::vc::fossil::im
22b0: 70 6f 72 74 3a 3a 63 76 73 3a 3a 73 74 61 74 65  port::cvs::state
22c0: 0a 09 6e 61 6d 65 73 70 61 63 65 20 69 6d 70 6f  ..namespace impo
22d0: 72 74 20 3a 3a 76 63 3a 3a 74 6f 6f 6c 73 3a 3a  rt ::vc::tools::
22e0: 74 72 6f 75 62 6c 65 0a 09 6e 61 6d 65 73 70 61  trouble..namespa
22f0: 63 65 20 69 6d 70 6f 72 74 20 3a 3a 76 63 3a 3a  ce import ::vc::
2300: 74 6f 6f 6c 73 3a 3a 6c 6f 67 0a 09 6c 6f 67 20  tools::log..log 
2310: 72 65 67 69 73 74 65 72 20 63 6f 6c 6c 72 65 76  register collrev
2320: 0a 20 20 20 20 7d 0a 7d 0a 0a 23 20 23 20 23 23  .    }.}..# # ##
2330: 20 23 23 23 20 23 23 23 23 23 20 23 23 23 23 23   ### ##### #####
2340: 23 23 23 20 23 23 23 23 23 23 23 23 23 23 23 23  ### ############
2350: 23 20 23 23 23 23 23 23 23 23 23 23 23 23 23 23  # ##############
2360: 23 23 23 23 23 23 23 0a 23 23 20 52 65 61 64 79  #######.## Ready
2370: 0a 0a 70 61 63 6b 61 67 65 20 70 72 6f 76 69 64  ..package provid
2380: 65 20 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d  e vc::fossil::im
2390: 70 6f 72 74 3a 3a 63 76 73 3a 3a 70 61 73 73 3a  port::cvs::pass:
23a0: 3a 63 6f 6c 6c 72 65 76 20 31 2e 30 0a 72 65 74  :collrev 1.0.ret
23b0: 75 72 6e 0a                                      urn.