Hex Artifact Content
Not logged in

Artifact e8bf2c5266a38dbf8057e410b7effc3dc05b552f:

File tools/cvs2fossil/lib/c2f_pcollar.tcl part of check-in [10f9d51bb2] - Added documentation to state definition, and debugging output to the state system itself. by aku on 2007-10-06 03:55:06.

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 2e 20 54 68 69 73 20 70 61 73 73 20 73  s I. This pass s
0210: 63 61 6e 73 20 74 68 65 20 72 65 70 6f 73 69 74  cans the reposit
0220: 6f 72 79 20 74 6f 20 69 6d 70 6f 72 74 20 66 6f  ory to import fo
0230: 72 20 52 43 53 20 61 72 63 68 69 76 65 73 2c 0a  r RCS archives,.
0240: 23 23 20 61 6e 64 20 73 6f 72 74 73 20 61 6e 64  ## and sorts and
0250: 20 66 69 6c 74 65 72 73 20 74 68 65 6d 20 69 6e   filters them in
0260: 74 6f 20 74 68 65 20 64 65 63 6c 61 72 65 64 20  to the declared 
0270: 70 72 6f 6a 65 63 74 73 2c 20 69 66 20 61 6e 79  projects, if any
0280: 0a 23 23 20 57 69 74 68 6f 75 74 20 64 65 63 6c  .## Without decl
0290: 61 72 65 64 20 70 72 6f 6a 65 63 74 73 20 74 68  ared projects th
02a0: 65 20 77 68 6f 6c 65 20 72 65 70 6f 73 69 74 6f  e whole reposito
02b0: 72 79 20 69 73 20 74 72 65 61 74 65 64 20 61 73  ry is treated as
02c0: 20 61 0a 23 23 20 73 69 6e 67 6c 65 20 70 72 6f   a.## single pro
02d0: 6a 65 63 74 2e 0a 0a 23 20 23 20 23 23 20 23 23  ject...# # ## ##
02e0: 23 20 23 23 23 23 23 20 23 23 23 23 23 23 23 23  # ##### ########
02f0: 20 23 23 23 23 23 23 23 23 23 23 23 23 23 20 23   ############# #
0300: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23  ################
0310: 23 23 23 23 0a 23 23 20 52 65 71 75 69 72 65 6d  ####.## Requirem
0320: 65 6e 74 73 0a 0a 70 61 63 6b 61 67 65 20 72 65  ents..package re
0330: 71 75 69 72 65 20 54 63 6c 20 38 2e 34 20 20 20  quire Tcl 8.4   
0340: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
0350: 20 20 20 20 20 20 20 20 20 20 3b 20 23 20 52 65            ; # Re
0360: 71 75 69 72 65 64 20 72 75 6e 74 69 6d 65 2e 0a  quired runtime..
0370: 70 61 63 6b 61 67 65 20 72 65 71 75 69 72 65 20  package require 
0380: 73 6e 69 74 20 20 20 20 20 20 20 20 20 20 20 20  snit            
0390: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
03a0: 20 20 20 20 3b 20 23 20 4f 4f 20 73 79 73 74 65      ; # OO syste
03b0: 6d 2e 0a 70 61 63 6b 61 67 65 20 72 65 71 75 69  m..package requi
03c0: 72 65 20 66 69 6c 65 75 74 69 6c 3a 3a 74 72 61  re fileutil::tra
03d0: 76 65 72 73 65 20 20 20 20 20 20 20 20 20 20 20  verse           
03e0: 20 20 20 20 20 20 20 3b 20 23 20 44 69 72 65 63         ; # Direc
03f0: 74 6f 72 79 20 74 72 61 76 65 72 73 61 6c 2e 0a  tory traversal..
0400: 70 61 63 6b 61 67 65 20 72 65 71 75 69 72 65 20  package require 
0410: 66 69 6c 65 75 74 69 6c 20 20 20 20 20 20 20 20  fileutil        
0420: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
0430: 20 20 20 20 3b 20 23 20 46 69 6c 65 20 26 20 70      ; # File & p
0440: 61 74 68 20 75 74 69 6c 69 74 69 65 73 2e 0a 70  ath utilities..p
0450: 61 63 6b 61 67 65 20 72 65 71 75 69 72 65 20 76  ackage require v
0460: 63 3a 3a 74 6f 6f 6c 73 3a 3a 74 72 6f 75 62 6c  c::tools::troubl
0470: 65 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20  e               
0480: 20 20 20 3b 20 23 20 45 72 72 6f 72 20 72 65 70     ; # Error rep
0490: 6f 72 74 69 6e 67 2e 0a 70 61 63 6b 61 67 65 20  orting..package 
04a0: 72 65 71 75 69 72 65 20 76 63 3a 3a 74 6f 6f 6c  require vc::tool
04b0: 73 3a 3a 6c 6f 67 20 20 20 20 20 20 20 20 20 20  s::log          
04c0: 20 20 20 20 20 20 20 20 20 20 20 20 3b 20 23 20              ; # 
04d0: 55 73 65 72 20 66 65 65 64 62 61 63 6b 2e 0a 70  User feedback..p
04e0: 61 63 6b 61 67 65 20 72 65 71 75 69 72 65 20 76  ackage require v
04f0: 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72  c::fossil::impor
0500: 74 3a 3a 63 76 73 3a 3a 70 61 73 73 20 20 20 20  t::cvs::pass    
0510: 20 20 20 3b 20 23 20 50 61 73 73 20 6d 61 6e 61     ; # Pass mana
0520: 67 65 6d 65 6e 74 2e 0a 70 61 63 6b 61 67 65 20  gement..package 
0530: 72 65 71 75 69 72 65 20 76 63 3a 3a 66 6f 73 73  require vc::foss
0540: 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a  il::import::cvs:
0550: 3a 72 65 70 6f 73 69 74 6f 72 79 20 3b 20 23 20  :repository ; # 
0560: 52 65 70 6f 73 69 74 6f 72 79 20 6d 61 6e 61 67  Repository manag
0570: 65 6d 65 6e 74 2e 0a 70 61 63 6b 61 67 65 20 72  ement..package r
0580: 65 71 75 69 72 65 20 76 63 3a 3a 66 6f 73 73 69  equire vc::fossi
0590: 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a  l::import::cvs::
05a0: 73 74 61 74 65 20 20 20 20 20 20 3b 20 23 20 53  state      ; # S
05b0: 74 61 74 65 20 73 74 6f 72 61 67 65 0a 0a 23 20  tate storage..# 
05c0: 23 20 23 23 20 23 23 23 20 23 23 23 23 23 20 23  # ## ### ##### #
05d0: 23 23 23 23 23 23 23 20 23 23 23 23 23 23 23 23  ####### ########
05e0: 23 23 23 23 23 20 23 23 23 23 23 23 23 23 23 23  ##### ##########
05f0: 23 23 23 23 23 23 23 23 23 23 23 0a 23 23 20 52  ###########.## R
0600: 65 67 69 73 74 65 72 20 74 68 65 20 70 61 73 73  egister the pass
0610: 20 77 69 74 68 20 74 68 65 20 6d 61 6e 61 67 65   with the manage
0620: 6d 65 6e 74 0a 0a 76 63 3a 3a 66 6f 73 73 69 6c  ment..vc::fossil
0630: 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 70  ::import::cvs::p
0640: 61 73 73 20 64 65 66 69 6e 65 20 5c 0a 20 20 20  ass define \.   
0650: 20 43 6f 6c 6c 65 63 74 41 72 20 5c 0a 20 20 20   CollectAr \.   
0660: 20 7b 43 6f 6c 6c 65 63 74 20 61 72 63 68 69 76   {Collect archiv
0670: 65 73 20 69 6e 20 72 65 70 6f 73 69 74 6f 72 79  es in repository
0680: 7d 20 5c 0a 20 20 20 20 3a 3a 76 63 3a 3a 66 6f  } \.    ::vc::fo
0690: 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76  ssil::import::cv
06a0: 73 3a 3a 70 61 73 73 3a 3a 63 6f 6c 6c 61 72 0a  s::pass::collar.
06b0: 0a 23 20 23 20 23 23 20 23 23 23 20 23 23 23 23  .# # ## ### ####
06c0: 23 20 23 23 23 23 23 23 23 23 20 23 23 23 23 23  # ######## #####
06d0: 23 23 23 23 23 23 23 23 20 23 23 23 23 23 23 23  ######## #######
06e0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 0a 23  ##############.#
06f0: 23 20 0a 0a 73 6e 69 74 3a 3a 74 79 70 65 20 3a  # ..snit::type :
0700: 3a 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70  :vc::fossil::imp
0710: 6f 72 74 3a 3a 63 76 73 3a 3a 70 61 73 73 3a 3a  ort::cvs::pass::
0720: 63 6f 6c 6c 61 72 20 7b 0a 20 20 20 20 23 20 23  collar {.    # #
0730: 20 23 23 20 23 23 23 20 23 23 23 23 23 20 23 23   ## ### ##### ##
0740: 23 23 23 23 23 23 20 23 23 23 23 23 23 23 23 23  ###### #########
0750: 23 23 23 23 0a 20 20 20 20 23 23 20 50 75 62 6c  ####.    ## Publ
0760: 69 63 20 41 50 49 0a 0a 20 20 20 20 74 79 70 65  ic API..    type
0770: 6d 65 74 68 6f 64 20 73 65 74 75 70 20 7b 7d 20  method setup {} 
0780: 7b 0a 09 23 20 44 65 66 69 6e 65 20 6e 61 6d 65  {..# Define name
0790: 73 20 61 6e 64 20 73 74 72 75 63 74 75 72 65 20  s and structure 
07a0: 6f 66 20 74 68 65 20 70 65 72 73 69 73 74 65 6e  of the persisten
07b0: 74 20 73 74 61 74 65 20 6f 66 20 74 68 69 73 0a  t state of this.
07c0: 09 23 20 70 61 73 73 2e 0a 0a 09 23 20 57 65 20  .# pass....# We 
07d0: 64 65 61 6c 20 77 69 74 68 20 72 65 70 6f 73 69  deal with reposi
07e0: 74 6f 72 79 20 70 72 6f 6a 65 63 74 73 2c 20 61  tory projects, a
07f0: 6e 64 20 74 68 65 20 72 63 73 20 61 72 63 68 69  nd the rcs archi
0800: 76 65 20 66 69 6c 65 73 0a 09 23 20 69 6e 20 74  ve files..# in t
0810: 68 65 20 70 72 6f 6a 65 63 74 73 2e 0a 0a 09 23  he projects....#
0820: 20 46 6f 72 20 74 68 65 20 66 69 72 73 74 2c 20   For the first, 
0830: 70 72 6f 6a 65 63 74 73 2c 20 77 65 20 6b 65 65  projects, we kee
0840: 70 20 74 68 65 69 72 20 6e 61 6d 65 73 2c 20 77  p their names, w
0850: 68 69 63 68 20 61 72 65 0a 09 23 20 74 68 65 69  hich are..# thei
0860: 72 20 70 61 74 68 73 20 72 65 6c 61 74 69 76 65  r paths relative
0870: 20 74 6f 20 74 68 65 20 62 61 73 65 20 64 69 72   to the base dir
0880: 65 63 74 6f 72 79 20 6f 66 20 74 68 65 20 77 68  ectory of the wh
0890: 6f 6c 65 0a 09 23 20 72 65 70 6f 73 69 74 6f 72  ole..# repositor
08a0: 79 2e 20 54 68 65 73 65 20 68 61 76 65 20 74 6f  y. These have to
08b0: 20 62 65 20 67 6c 6f 62 61 6c 6c 79 20 75 6e 69   be globally uni
08c0: 71 75 65 2c 20 69 2e 65 2e 20 6e 6f 20 74 77 6f  que, i.e. no two
08d0: 0a 09 23 20 70 72 6f 6a 65 63 74 73 20 63 61 6e  ..# projects can
08e0: 20 68 61 76 65 20 74 68 65 20 73 61 6d 65 20 6e   have the same n
08f0: 61 6d 65 2e 0a 0a 09 23 20 46 6f 72 20 74 68 65  ame....# For the
0900: 20 66 69 6c 65 73 20 77 65 20 6b 65 65 70 20 74   files we keep t
0910: 68 65 69 72 20 6e 61 6d 65 73 2c 20 77 68 69 63  heir names, whic
0920: 68 20 61 72 65 20 74 68 65 69 72 20 70 61 74 68  h are their path
0930: 73 0a 09 23 20 72 65 6c 61 74 69 76 65 20 74 6f  s..# relative to
0940: 20 74 68 65 20 62 61 73 65 20 64 69 72 65 63 74   the base direct
0950: 6f 72 79 20 6f 66 20 74 68 65 20 77 68 6f 6c 65  ory of the whole
0960: 20 70 72 6f 6a 65 63 74 21 20 54 68 65 73 65 0a   project! These.
0970: 09 23 20 68 61 76 65 20 74 6f 20 62 65 20 75 6e  .# have to be un
0980: 69 71 75 65 20 77 69 74 68 69 6e 20 61 20 70 72  ique within a pr
0990: 6f 6a 65 63 74 2c 20 68 6f 77 65 76 65 72 20 67  oject, however g
09a0: 6c 6f 62 61 6c 6c 79 20 74 68 69 73 0a 09 23 20  lobally this..# 
09b0: 64 6f 65 73 20 6e 6f 74 20 68 6f 6c 64 2c 20 61  does not hold, a
09c0: 20 6e 61 6d 65 20 6d 61 79 20 6f 63 63 75 72 20   name may occur 
09d0: 73 65 76 65 72 61 6c 20 74 69 6d 65 73 2c 20 69  several times, i
09e0: 6e 20 64 69 66 66 65 72 65 6e 74 0a 09 23 20 70  n different..# p
09f0: 72 6f 6a 65 63 74 73 2e 20 57 65 20 66 75 72 74  rojects. We furt
0a00: 68 65 72 20 73 74 6f 72 65 20 74 68 65 20 75 73  her store the us
0a10: 65 72 20 76 69 73 69 62 6c 65 20 66 69 6c 65 20  er visible file 
0a20: 6e 61 6d 65 0a 09 23 20 61 73 73 6f 63 69 61 74  name..# associat
0a30: 65 64 20 77 69 74 68 20 74 68 65 20 72 63 73 20  ed with the rcs 
0a40: 61 72 63 68 69 76 65 2e 0a 0a 09 23 20 42 6f 74  archive....# Bot
0a50: 68 20 70 72 6f 6a 65 63 74 73 20 61 6e 64 20 66  h projects and f
0a60: 69 6c 65 73 20 61 72 65 20 69 64 65 6e 74 69 66  iles are identif
0a70: 69 65 64 20 62 79 20 67 6c 6f 62 61 6c 6c 79 20  ied by globally 
0a80: 75 6e 69 71 75 65 0a 09 23 20 69 6e 74 65 67 65  unique..# intege
0a90: 72 20 69 64 73 2c 20 61 75 74 6f 6d 61 74 69 63  r ids, automatic
0aa0: 61 6c 6c 79 20 61 73 73 69 67 6e 65 64 20 62 79  ally assigned by
0ab0: 20 74 68 65 20 64 61 74 61 62 61 73 65 2e 0a 0a   the database...
0ac0: 09 73 74 61 74 65 20 77 72 69 74 69 6e 67 20 70  .state writing p
0ad0: 72 6f 6a 65 63 74 20 7b 0a 09 20 20 20 20 70 69  roject {..    pi
0ae0: 64 20 20 49 4e 54 45 47 45 52 20 20 4e 4f 54 20  d  INTEGER  NOT 
0af0: 4e 55 4c 4c 20 20 50 52 49 4d 41 52 59 20 4b 45  NULL  PRIMARY KE
0b00: 59 20 41 55 54 4f 49 4e 43 52 45 4d 45 4e 54 2c  Y AUTOINCREMENT,
0b10: 0a 09 20 20 20 20 6e 61 6d 65 20 54 45 58 54 20  ..    name TEXT 
0b20: 20 20 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 55 4e      NOT NULL  UN
0b30: 49 51 55 45 0a 09 7d 0a 09 73 74 61 74 65 20 77  IQUE..}..state w
0b40: 72 69 74 69 6e 67 20 66 69 6c 65 20 7b 0a 09 20  riting file {.. 
0b50: 20 20 20 66 69 64 20 20 20 20 20 49 4e 54 45 47     fid     INTEG
0b60: 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 50 52  ER  NOT NULL  PR
0b70: 49 4d 41 52 59 20 4b 45 59 20 41 55 54 4f 49 4e  IMARY KEY AUTOIN
0b80: 43 52 45 4d 45 4e 54 2c 0a 09 20 20 20 20 70 69  CREMENT,..    pi
0b90: 64 20 20 20 20 20 49 4e 54 45 47 45 52 20 20 4e  d     INTEGER  N
0ba0: 4f 54 20 4e 55 4c 4c 20 20 52 45 46 45 52 45 4e  OT NULL  REFEREN
0bb0: 43 45 53 20 70 72 6f 6a 65 63 74 2c 20 20 20 20  CES project,    
0bc0: 20 20 20 2d 2d 20 70 72 6f 6a 65 63 74 20 74 68     -- project th
0bd0: 65 20 66 69 6c 65 20 62 65 6c 6f 6e 67 73 20 74  e file belongs t
0be0: 6f 0a 09 20 20 20 20 6e 61 6d 65 20 20 20 20 54  o..    name    T
0bf0: 45 58 54 20 20 20 20 20 4e 4f 54 20 4e 55 4c 4c  EXT     NOT NULL
0c00: 2c 0a 09 20 20 20 20 76 69 73 69 62 6c 65 20 54  ,..    visible T
0c10: 45 58 54 20 20 20 20 20 4e 4f 54 20 4e 55 4c 4c  EXT     NOT NULL
0c20: 2c 0a 09 20 20 20 20 55 4e 49 51 55 45 20 28 70  ,..    UNIQUE (p
0c30: 69 64 2c 20 6e 61 6d 65 29 20 20 20 20 20 20 20  id, name)       
0c40: 20 20 2d 2d 20 66 69 6c 65 20 6e 61 6d 65 73 20    -- file names 
0c50: 61 72 65 20 75 6e 69 71 75 65 20 77 69 74 68 69  are unique withi
0c60: 6e 20 61 20 70 72 6f 6a 65 63 74 0a 09 7d 0a 09  n a project..}..
0c70: 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20  return.    }..  
0c80: 20 20 74 79 70 65 6d 65 74 68 6f 64 20 72 75 6e    typemethod run
0c90: 20 7b 7d 20 7b 0a 09 73 65 74 20 72 62 61 73 65   {} {..set rbase
0ca0: 20 5b 72 65 70 6f 73 69 74 6f 72 79 20 62 61 73   [repository bas
0cb0: 65 3f 5d 0a 09 66 6f 72 65 61 63 68 20 70 72 6f  e?]..foreach pro
0cc0: 6a 65 63 74 20 5b 72 65 70 6f 73 69 74 6f 72 79  ject [repository
0cd0: 20 70 72 6f 6a 65 63 74 73 5d 20 7b 0a 09 20 20   projects] {..  
0ce0: 20 20 73 65 74 20 62 61 73 65 20 5b 66 69 6c 65    set base [file
0cf0: 20 6a 6f 69 6e 20 24 72 62 61 73 65 20 5b 24 70   join $rbase [$p
0d00: 72 6f 6a 65 63 74 20 62 61 73 65 5d 5d 0a 09 20  roject base]].. 
0d10: 20 20 20 6c 6f 67 20 77 72 69 74 65 20 31 20 63     log write 1 c
0d20: 6f 6c 6c 61 72 20 22 53 63 61 6e 20 24 62 61 73  ollar "Scan $bas
0d30: 65 22 0a 0a 09 20 20 20 20 73 65 74 20 74 72 61  e"...    set tra
0d40: 76 65 72 73 65 20 5b 66 69 6c 65 75 74 69 6c 3a  verse [fileutil:
0d50: 3a 74 72 61 76 65 72 73 65 20 25 41 55 54 4f 25  :traverse %AUTO%
0d60: 20 24 62 61 73 65 5d 0a 09 20 20 20 20 73 65 74   $base]..    set
0d70: 20 6e 20 30 0a 09 20 20 20 20 73 65 74 20 72 20   n 0..    set r 
0d80: 7b 7d 0a 0a 09 20 20 20 20 24 74 72 61 76 65 72  {}...    $traver
0d90: 73 65 20 66 6f 72 65 61 63 68 20 70 61 74 68 20  se foreach path 
0da0: 7b 0a 09 09 73 65 74 20 72 63 73 20 5b 66 69 6c  {...set rcs [fil
0db0: 65 75 74 69 6c 3a 3a 73 74 72 69 70 50 61 74 68  eutil::stripPath
0dc0: 20 24 62 61 73 65 20 24 70 61 74 68 5d 0a 09 09   $base $path]...
0dd0: 69 66 20 7b 5b 49 73 43 56 53 41 64 6d 69 6e 20  if {[IsCVSAdmin 
0de0: 20 20 20 24 72 63 73 5d 7d 20 20 63 6f 6e 74 69     $rcs]}  conti
0df0: 6e 75 65 0a 09 09 69 66 20 7b 21 5b 49 73 52 43  nue...if {![IsRC
0e00: 53 41 72 63 68 69 76 65 20 24 70 61 74 68 5d 7d  SArchive $path]}
0e10: 20 63 6f 6e 74 69 6e 75 65 0a 0a 09 09 73 65 74   continue....set
0e20: 20 75 73 72 20 5b 55 73 65 72 50 61 74 68 20 24   usr [UserPath $
0e30: 72 63 73 20 69 73 61 74 74 69 63 5d 0a 09 09 69  rcs isattic]...i
0e40: 66 20 7b 5b 49 73 53 75 70 65 72 63 65 64 65 64  f {[IsSuperceded
0e50: 20 24 62 61 73 65 20 24 72 63 73 20 24 75 73 72   $base $rcs $usr
0e60: 20 24 69 73 61 74 74 69 63 5d 7d 20 63 6f 6e 74   $isattic]} cont
0e70: 69 6e 75 65 0a 0a 09 09 6c 6f 67 20 77 72 69 74  inue....log writ
0e80: 65 20 34 20 63 6f 6c 6c 61 72 20 22 46 6f 75 6e  e 4 collar "Foun
0e90: 64 20 20 20 24 72 63 73 22 0a 09 09 24 70 72 6f  d   $rcs"...$pro
0ea0: 6a 65 63 74 20 61 64 64 20 24 72 63 73 20 24 75  ject add $rcs $u
0eb0: 73 72 0a 0a 09 09 69 6e 63 72 20 6e 0a 09 09 69  sr....incr n...i
0ec0: 66 20 7b 5b 6c 6f 67 20 76 65 72 62 6f 73 69 74  f {[log verbosit
0ed0: 79 3f 5d 20 3c 20 34 7d 20 7b 0a 09 09 20 20 20  y?] < 4} {...   
0ee0: 20 6c 6f 67 20 70 72 6f 67 72 65 73 73 20 30 20   log progress 0 
0ef0: 63 6f 6c 6c 61 72 20 24 6e 20 7b 7d 0a 09 09 7d  collar $n {}...}
0f00: 0a 09 20 20 20 20 7d 0a 0a 09 20 20 20 20 24 74  ..    }...    $t
0f10: 72 61 76 65 72 73 65 20 64 65 73 74 72 6f 79 0a  raverse destroy.
0f20: 09 7d 0a 0a 09 72 65 70 6f 73 69 74 6f 72 79 20  .}...repository 
0f30: 70 72 69 6e 74 73 74 61 74 69 73 74 69 63 73 0a  printstatistics.
0f40: 09 72 65 70 6f 73 69 74 6f 72 79 20 70 65 72 73  .repository pers
0f50: 69 73 74 0a 0a 09 6c 6f 67 20 77 72 69 74 65 20  ist...log write 
0f60: 31 20 63 6f 6c 6c 61 72 20 22 53 63 61 6e 20 63  1 collar "Scan c
0f70: 6f 6d 70 6c 65 74 65 64 22 0a 09 72 65 74 75 72  ompleted"..retur
0f80: 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 74 79 70  n.    }..    typ
0f90: 65 6d 65 74 68 6f 64 20 69 67 6e 6f 72 65 5f 63  emethod ignore_c
0fa0: 6f 6e 66 6c 69 63 74 69 6e 67 5f 61 74 74 69 63  onflicting_attic
0fb0: 73 20 7b 7d 20 7b 0a 09 73 65 74 20 6d 79 69 67  s {} {..set myig
0fc0: 6e 6f 72 65 20 31 0a 09 72 65 74 75 72 6e 0a 20  nore 1..return. 
0fd0: 20 20 20 7d 0a 0a 20 20 20 20 23 20 23 20 23 23     }..    # # ##
0fe0: 20 23 23 23 20 23 23 23 23 23 20 23 23 23 23 23   ### ##### #####
0ff0: 23 23 23 20 23 23 23 23 23 23 23 23 23 23 23 23  ### ############
1000: 23 0a 20 20 20 20 23 23 20 49 6e 74 65 72 6e 61  #.    ## Interna
1010: 6c 20 6d 65 74 68 6f 64 73 0a 0a 20 20 20 20 74  l methods..    t
1020: 79 70 65 76 61 72 69 61 62 6c 65 20 6d 79 69 67  ypevariable myig
1030: 6e 6f 72 65 20 30 0a 0a 20 20 20 20 70 72 6f 63  nore 0..    proc
1040: 20 49 73 52 43 53 41 72 63 68 69 76 65 20 7b 70   IsRCSArchive {p
1050: 61 74 68 7d 20 7b 0a 09 69 66 20 7b 21 5b 73 74  ath} {..if {![st
1060: 72 69 6e 67 20 6d 61 74 63 68 20 2a 2c 76 20 24  ring match *,v $
1070: 70 61 74 68 5d 7d 20 20 20 20 20 7b 72 65 74 75  path]}     {retu
1080: 72 6e 20 30 7d 0a 09 69 66 20 7b 5b 66 69 6c 65  rn 0}..if {[file
1090: 75 74 69 6c 3a 3a 74 65 73 74 20 24 70 61 74 68  util::test $path
10a0: 20 66 72 20 6d 73 67 5d 7d 20 7b 72 65 74 75 72   fr msg]} {retur
10b0: 6e 20 31 7d 0a 09 74 72 6f 75 62 6c 65 20 77 61  n 1}..trouble wa
10c0: 72 6e 20 24 6d 73 67 0a 09 72 65 74 75 72 6e 20  rn $msg..return 
10d0: 30 0a 20 20 20 20 7d 0a 0a 20 20 20 20 70 72 6f  0.    }..    pro
10e0: 63 20 49 73 43 56 53 41 64 6d 69 6e 20 7b 72 63  c IsCVSAdmin {rc
10f0: 73 7d 20 7b 0a 09 69 66 20 7b 21 5b 73 74 72 69  s} {..if {![stri
1100: 6e 67 20 6d 61 74 63 68 20 43 56 53 52 4f 4f 54  ng match CVSROOT
1110: 2f 2a 20 24 72 63 73 5d 7d 20 7b 72 65 74 75 72  /* $rcs]} {retur
1120: 6e 20 30 7d 0a 09 6c 6f 67 20 77 72 69 74 65 20  n 0}..log write 
1130: 34 20 63 6f 6c 6c 61 72 20 22 49 67 6e 6f 72 65  4 collar "Ignore
1140: 64 20 24 72 63 73 2c 20 61 64 6d 69 6e 69 73 74  d $rcs, administ
1150: 72 61 74 69 76 65 20 61 72 63 68 69 76 65 22 0a  rative archive".
1160: 09 72 65 74 75 72 6e 20 31 0a 20 20 20 20 7d 0a  .return 1.    }.
1170: 0a 20 20 20 20 70 72 6f 63 20 55 73 65 72 50 61  .    proc UserPa
1180: 74 68 20 7b 72 63 73 20 69 61 76 7d 20 7b 0a 09  th {rcs iav} {..
1190: 75 70 76 61 72 20 31 20 24 69 61 76 20 69 73 61  upvar 1 $iav isa
11a0: 74 74 69 63 0a 0a 09 23 20 44 65 72 69 76 65 20  ttic...# Derive 
11b0: 74 68 65 20 75 73 65 72 2d 76 69 73 69 62 6c 65  the user-visible
11c0: 20 70 61 74 68 20 66 72 6f 6d 20 74 68 65 20 72   path from the r
11d0: 63 73 20 70 61 74 68 2e 20 4d 65 61 6e 69 6e 67  cs path. Meaning
11e0: 3a 0a 09 23 20 43 68 6f 70 20 6f 66 66 20 74 68  :..# Chop off th
11f0: 65 20 22 2c 76 22 20 73 75 66 66 69 78 2c 20 61  e ",v" suffix, a
1200: 6e 64 20 72 65 6d 6f 76 65 20 61 20 70 6f 73 73  nd remove a poss
1210: 69 62 6c 65 20 22 41 74 74 69 63 22 2e 0a 0a 09  ible "Attic"....
1220: 73 65 74 20 66 20 5b 73 74 72 69 6e 67 20 72 61  set f [string ra
1230: 6e 67 65 20 24 72 63 73 20 30 20 65 6e 64 2d 32  nge $rcs 0 end-2
1240: 5d 0a 0a 09 69 66 20 7b 22 41 74 74 69 63 22 20  ]...if {"Attic" 
1250: 65 71 20 5b 6c 69 6e 64 65 78 20 5b 66 69 6c 65  eq [lindex [file
1260: 20 73 70 6c 69 74 20 24 72 63 73 5d 20 65 6e 64   split $rcs] end
1270: 2d 31 5d 7d 20 7b 0a 0a 09 20 20 20 20 23 20 54  -1]} {...    # T
1280: 68 65 20 63 6f 6e 73 74 72 75 63 74 69 6f 6e 20  he construction 
1290: 62 65 6c 6f 77 20 65 6e 73 75 72 65 73 20 74 68  below ensures th
12a0: 61 74 20 41 74 74 69 63 2f 58 20 6d 61 70 73 20  at Attic/X maps 
12b0: 74 6f 20 58 0a 09 20 20 20 20 23 20 69 6e 73 74  to X..    # inst
12c0: 65 61 64 20 6f 66 20 2e 2f 58 2e 20 4f 74 68 65  ead of ./X. Othe
12d0: 72 77 69 73 65 2c 20 59 2f 41 74 74 69 63 2f 58  rwise, Y/Attic/X
12e0: 20 6d 61 70 73 20 74 6f 20 59 2f 58 2e 0a 0a 09   maps to Y/X....
12f0: 20 20 20 20 73 65 74 20 66 78 20 5b 66 69 6c 65      set fx [file
1300: 20 64 69 72 6e 61 6d 65 20 5b 66 69 6c 65 20 64   dirname [file d
1310: 69 72 6e 61 6d 65 20 24 66 5d 5d 0a 09 20 20 20  irname $f]]..   
1320: 20 73 65 74 20 66 20 20 5b 66 69 6c 65 20 74 61   set f  [file ta
1330: 69 6c 20 24 66 5d 0a 09 20 20 20 20 69 66 20 7b  il $f]..    if {
1340: 24 66 78 20 6e 65 20 22 2e 22 7d 20 7b 20 73 65  $fx ne "."} { se
1350: 74 20 66 20 5b 66 69 6c 65 20 6a 6f 69 6e 20 24  t f [file join $
1360: 66 78 20 24 66 5d 20 7d 0a 0a 09 20 20 20 20 73  fx $f] }...    s
1370: 65 74 20 69 73 61 74 74 69 63 20 31 0a 09 7d 20  et isattic 1..} 
1380: 65 6c 73 65 20 7b 0a 09 20 20 20 20 73 65 74 20  else {..    set 
1390: 69 73 61 74 74 69 63 20 30 0a 09 7d 0a 0a 09 72  isattic 0..}...r
13a0: 65 74 75 72 6e 20 24 66 0a 20 20 20 20 7d 0a 0a  eturn $f.    }..
13b0: 20 20 20 20 70 72 6f 63 20 49 73 53 75 70 65 72      proc IsSuper
13c0: 63 65 64 65 64 20 7b 62 61 73 65 20 72 63 73 20  ceded {base rcs 
13d0: 75 73 72 20 69 73 61 74 74 69 63 7d 20 7b 0a 09  usr isattic} {..
13e0: 69 66 20 7b 21 24 69 73 61 74 74 69 63 7d 20 20  if {!$isattic}  
13f0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
1400: 20 7b 72 65 74 75 72 6e 20 30 7d 0a 09 69 66 20   {return 0}..if 
1410: 7b 21 5b 66 69 6c 65 20 65 78 69 73 74 73 20 24  {![file exists $
1420: 62 61 73 65 2f 24 75 73 72 2c 76 5d 7d 20 7b 72  base/$usr,v]} {r
1430: 65 74 75 72 6e 20 30 7d 0a 0a 09 23 20 57 65 20  eturn 0}...# We 
1440: 68 61 76 65 20 61 20 72 65 67 75 6c 61 72 20 61  have a regular a
1450: 72 63 68 69 76 65 20 61 6e 64 20 61 6e 20 41 74  rchive and an At
1460: 74 69 63 20 61 72 63 68 69 76 65 20 72 65 66 65  tic archive refe
1470: 72 69 6e 67 20 74 6f 0a 09 23 20 74 68 65 20 73  ring to..# the s
1480: 61 6d 65 20 75 73 65 72 20 76 69 73 69 62 6c 65  ame user visible
1490: 20 66 69 6c 65 2e 20 49 67 6e 6f 72 65 20 74 68   file. Ignore th
14a0: 65 20 66 69 6c 65 20 69 6e 20 74 68 65 20 41 74  e file in the At
14b0: 74 69 63 2e 0a 09 23 0a 09 23 20 42 79 20 64 65  tic...#..# By de
14c0: 66 61 75 6c 74 20 74 68 69 73 20 69 73 20 61 20  fault this is a 
14d0: 70 72 6f 62 6c 65 6d 20 63 61 75 73 69 6e 67 20  problem causing 
14e0: 61 6e 20 61 62 6f 72 74 20 61 66 74 65 72 20 74  an abort after t
14f0: 68 65 20 70 61 73 73 0a 09 23 20 68 61 73 20 63  he pass..# has c
1500: 6f 6d 70 6c 65 74 65 64 2e 20 54 68 65 20 75 73  ompleted. The us
1510: 65 72 20 63 61 6e 20 68 6f 77 65 76 65 72 20 66  er can however f
1520: 6f 72 63 65 20 75 73 20 74 6f 20 69 67 6e 6f 72  orce us to ignor
1530: 65 20 69 74 2e 0a 09 23 20 49 6e 20 74 68 61 74  e it...# In that
1540: 20 63 61 73 65 20 74 68 65 20 77 61 72 6e 69 6e   case the warnin
1550: 67 20 69 73 20 73 74 69 6c 6c 20 70 72 69 6e 74  g is still print
1560: 65 64 2c 20 62 75 74 20 77 69 6c 6c 20 6e 6f 74  ed, but will not
1570: 0a 09 23 20 69 6e 64 75 63 65 20 61 6e 20 61 62  ..# induce an ab
1580: 6f 72 74 20 61 6e 79 20 6c 6f 6e 67 65 72 2e 0a  ort any longer..
1590: 0a 09 75 70 76 61 72 20 31 20 6d 79 69 67 6e 6f  ..upvar 1 myigno
15a0: 72 65 20 6d 79 69 67 6e 6f 72 65 0a 09 69 66 20  re myignore..if 
15b0: 7b 24 6d 79 69 67 6e 6f 72 65 7d 20 7b 0a 09 20  {$myignore} {.. 
15c0: 20 20 20 6c 6f 67 20 77 72 69 74 65 20 32 20 63     log write 2 c
15d0: 6f 6c 6c 61 72 20 22 49 67 6e 6f 72 65 64 20 24  ollar "Ignored $
15e0: 72 63 73 2c 20 73 75 70 65 72 63 65 64 65 64 20  rcs, superceded 
15f0: 61 72 63 68 69 76 65 22 0a 09 7d 20 65 6c 73 65  archive"..} else
1600: 20 7b 0a 09 20 20 20 20 74 72 6f 75 62 6c 65 20   {..    trouble 
1610: 77 61 72 6e 20 20 20 20 20 20 20 22 49 67 6e 6f  warn       "Igno
1620: 72 65 64 20 24 72 63 73 2c 20 73 75 70 65 72 63  red $rcs, superc
1630: 65 64 65 64 20 61 72 63 68 69 76 65 22 0a 09 7d  eded archive"..}
1640: 0a 09 72 65 74 75 72 6e 20 31 0a 20 20 20 20 7d  ..return 1.    }
1650: 0a 0a 20 20 20 20 23 20 23 20 23 23 20 23 23 23  ..    # # ## ###
1660: 20 23 23 23 23 23 20 23 23 23 23 23 23 23 23 20   ##### ######## 
1670: 23 23 23 23 23 23 23 23 23 23 23 23 23 0a 20 20  #############.  
1680: 20 20 23 23 20 43 6f 6e 66 69 67 75 72 61 74 69    ## Configurati
1690: 6f 6e 0a 0a 20 20 20 20 70 72 61 67 6d 61 20 2d  on..    pragma -
16a0: 68 61 73 69 6e 73 74 61 6e 63 65 73 20 20 20 6e  hasinstances   n
16b0: 6f 20 3b 20 23 20 73 69 6e 67 6c 65 74 6f 6e 0a  o ; # singleton.
16c0: 20 20 20 20 70 72 61 67 6d 61 20 2d 68 61 73 74      pragma -hast
16d0: 79 70 65 69 6e 66 6f 20 20 20 20 6e 6f 20 3b 20  ypeinfo    no ; 
16e0: 23 20 6e 6f 20 69 6e 74 72 6f 73 70 65 63 74 69  # no introspecti
16f0: 6f 6e 0a 20 20 20 20 70 72 61 67 6d 61 20 2d 68  on.    pragma -h
1700: 61 73 74 79 70 65 64 65 73 74 72 6f 79 20 6e 6f  astypedestroy no
1710: 20 3b 20 23 20 69 6d 6d 6f 72 74 61 6c 0a 0a 20   ; # immortal.. 
1720: 20 20 20 23 20 23 20 23 23 20 23 23 23 20 23 23     # # ## ### ##
1730: 23 23 23 20 23 23 23 23 23 23 23 23 20 23 23 23  ### ######## ###
1740: 23 23 23 23 23 23 23 23 23 23 0a 7d 0a 0a 6e 61  ##########.}..na
1750: 6d 65 73 70 61 63 65 20 65 76 61 6c 20 3a 3a 76  mespace eval ::v
1760: 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72  c::fossil::impor
1770: 74 3a 3a 63 76 73 3a 3a 70 61 73 73 20 7b 0a 20  t::cvs::pass {. 
1780: 20 20 20 6e 61 6d 65 73 70 61 63 65 20 65 78 70     namespace exp
1790: 6f 72 74 20 63 6f 6c 6c 61 72 0a 20 20 20 20 6e  ort collar.    n
17a0: 61 6d 65 73 70 61 63 65 20 65 76 61 6c 20 63 6f  amespace eval co
17b0: 6c 6c 61 72 20 7b 0a 09 6e 61 6d 65 73 70 61 63  llar {..namespac
17c0: 65 20 69 6d 70 6f 72 74 20 3a 3a 76 63 3a 3a 66  e import ::vc::f
17d0: 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63  ossil::import::c
17e0: 76 73 3a 3a 72 65 70 6f 73 69 74 6f 72 79 0a 09  vs::repository..
17f0: 6e 61 6d 65 73 70 61 63 65 20 69 6d 70 6f 72 74  namespace import
1800: 20 3a 3a 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69   ::vc::fossil::i
1810: 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 73 74 61 74  mport::cvs::stat
1820: 65 0a 09 6e 61 6d 65 73 70 61 63 65 20 69 6d 70  e..namespace imp
1830: 6f 72 74 20 3a 3a 76 63 3a 3a 74 6f 6f 6c 73 3a  ort ::vc::tools:
1840: 3a 74 72 6f 75 62 6c 65 0a 09 6e 61 6d 65 73 70  :trouble..namesp
1850: 61 63 65 20 69 6d 70 6f 72 74 20 3a 3a 76 63 3a  ace import ::vc:
1860: 3a 74 6f 6f 6c 73 3a 3a 6c 6f 67 0a 09 6c 6f 67  :tools::log..log
1870: 20 72 65 67 69 73 74 65 72 20 63 6f 6c 6c 61 72   register collar
1880: 0a 20 20 20 20 7d 0a 7d 0a 0a 23 20 23 20 23 23  .    }.}..# # ##
1890: 20 23 23 23 20 23 23 23 23 23 20 23 23 23 23 23   ### ##### #####
18a0: 23 23 23 20 23 23 23 23 23 23 23 23 23 23 23 23  ### ############
18b0: 23 20 23 23 23 23 23 23 23 23 23 23 23 23 23 23  # ##############
18c0: 23 23 23 23 23 23 23 0a 23 23 20 52 65 61 64 79  #######.## Ready
18d0: 0a 0a 70 61 63 6b 61 67 65 20 70 72 6f 76 69 64  ..package provid
18e0: 65 20 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d  e vc::fossil::im
18f0: 70 6f 72 74 3a 3a 63 76 73 3a 3a 70 61 73 73 3a  port::cvs::pass:
1900: 3a 63 6f 6c 6c 61 72 20 31 2e 30 0a 72 65 74 75  :collar 1.0.retu
1910: 72 6e 0a                                         rn.