Hex Artifact Content
Not logged in

Artifact 7d94939b63ae5f2e2291d3a6f3d816dad9a12126:

File tools/cvs2fossil/lib/c2f_pcollar.tcl part of check-in [be2f99e6a4] - Merge with aku's branch. by drh on 2008-02-13 14:44:50. Also file tools/cvs2fossil/lib/c2f_pcollar.tcl part of check-in [c1dc8701ef] - Added code to skip of administrative .cvsignore files. Added code to detect and warn about dot files (.FOO). Allow the user to import dot files by converting their names to non-dot form (.FOO -> dot-FOO). by aku on 2008-02-12 04:24:42.

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 2d 32 30 30 38 20 41 6e 64 72 65 61 73 20  07-2008 Andreas 
0070: 4b 75 70 72 69 65 73 2e 0a 23 0a 23 20 54 68 69  Kupries..#.# Thi
0080: 73 20 73 6f 66 74 77 61 72 65 20 69 73 20 6c 69  s software is li
0090: 63 65 6e 73 65 64 20 61 73 20 64 65 73 63 72 69  censed as descri
00a0: 62 65 64 20 69 6e 20 74 68 65 20 66 69 6c 65 20  bed in the file 
00b0: 4c 49 43 45 4e 53 45 2c 20 77 68 69 63 68 0a 23  LICENSE, which.#
00c0: 20 79 6f 75 20 73 68 6f 75 6c 64 20 68 61 76 65   you should have
00d0: 20 72 65 63 65 69 76 65 64 20 61 73 20 70 61 72   received as par
00e0: 74 20 6f 66 20 74 68 69 73 20 64 69 73 74 72 69  t of this distri
00f0: 62 75 74 69 6f 6e 2e 0a 23 0a 23 20 54 68 69 73  bution..#.# This
0100: 20 73 6f 66 74 77 61 72 65 20 63 6f 6e 73 69 73   software consis
0110: 74 73 20 6f 66 20 76 6f 6c 75 6e 74 61 72 79 20  ts of voluntary 
0120: 63 6f 6e 74 72 69 62 75 74 69 6f 6e 73 20 6d 61  contributions ma
0130: 64 65 20 62 79 20 6d 61 6e 79 0a 23 20 69 6e 64  de by many.# ind
0140: 69 76 69 64 75 61 6c 73 2e 20 20 46 6f 72 20 65  ividuals.  For e
0150: 78 61 63 74 20 63 6f 6e 74 72 69 62 75 74 69 6f  xact contributio
0160: 6e 20 68 69 73 74 6f 72 79 2c 20 73 65 65 20 74  n history, see t
0170: 68 65 20 72 65 76 69 73 69 6f 6e 0a 23 20 68 69  he revision.# hi
0180: 73 74 6f 72 79 20 61 6e 64 20 6c 6f 67 73 2c 20  story and logs, 
0190: 61 76 61 69 6c 61 62 6c 65 20 61 74 20 68 74 74  available at htt
01a0: 70 3a 2f 2f 66 6f 73 73 69 6c 2d 73 63 6d 2e 68  p://fossil-scm.h
01b0: 77 61 63 69 2e 63 6f 6d 2f 66 6f 73 73 69 6c 0a  waci.com/fossil.
01c0: 23 20 23 20 23 23 20 23 23 23 20 23 23 23 23 23  # # ## ### #####
01d0: 20 23 23 23 23 23 23 23 23 20 23 23 23 23 23 23   ######## ######
01e0: 23 23 23 23 23 23 23 20 23 23 23 23 23 23 23 23  ####### ########
01f0: 23 23 23 23 23 23 23 23 23 23 23 23 23 0a 0a 23  #############..#
0200: 23 20 50 61 73 73 20 49 2e 20 54 68 69 73 20 70  # Pass I. This p
0210: 61 73 73 20 73 63 61 6e 73 20 74 68 65 20 72 65  ass scans the re
0220: 70 6f 73 69 74 6f 72 79 20 74 6f 20 69 6d 70 6f  pository to impo
0230: 72 74 20 66 6f 72 20 52 43 53 20 61 72 63 68 69  rt for RCS archi
0240: 76 65 73 2c 0a 23 23 20 61 6e 64 20 73 6f 72 74  ves,.## and sort
0250: 73 20 61 6e 64 20 66 69 6c 74 65 72 73 20 74 68  s and filters th
0260: 65 6d 20 69 6e 74 6f 20 74 68 65 20 64 65 63 6c  em into the decl
0270: 61 72 65 64 20 70 72 6f 6a 65 63 74 73 2c 20 69  ared projects, i
0280: 66 20 61 6e 79 0a 23 23 20 57 69 74 68 6f 75 74  f any.## Without
0290: 20 64 65 63 6c 61 72 65 64 20 70 72 6f 6a 65 63   declared projec
02a0: 74 73 20 74 68 65 20 77 68 6f 6c 65 20 72 65 70  ts the whole rep
02b0: 6f 73 69 74 6f 72 79 20 69 73 20 74 72 65 61 74  ository is treat
02c0: 65 64 20 61 73 20 61 0a 23 23 20 73 69 6e 67 6c  ed as a.## singl
02d0: 65 20 70 72 6f 6a 65 63 74 2e 0a 0a 23 20 23 20  e project...# # 
02e0: 23 23 20 23 23 23 20 23 23 23 23 23 20 23 23 23  ## ### ##### ###
02f0: 23 23 23 23 23 20 23 23 23 23 23 23 23 23 23 23  ##### ##########
0300: 23 23 23 20 23 23 23 23 23 23 23 23 23 23 23 23  ### ############
0310: 23 23 23 23 23 23 23 23 23 0a 23 23 20 52 65 71  #########.## Req
0320: 75 69 72 65 6d 65 6e 74 73 0a 0a 70 61 63 6b 61  uirements..packa
0330: 67 65 20 72 65 71 75 69 72 65 20 54 63 6c 20 38  ge require Tcl 8
0340: 2e 34 20 20 20 20 20 20 20 20 20 20 20 20 20 20  .4              
0350: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 3b                 ;
0360: 20 23 20 52 65 71 75 69 72 65 64 20 72 75 6e 74   # Required runt
0370: 69 6d 65 2e 0a 70 61 63 6b 61 67 65 20 72 65 71  ime..package req
0380: 75 69 72 65 20 73 6e 69 74 20 20 20 20 20 20 20  uire snit       
0390: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
03a0: 20 20 20 20 20 20 20 20 20 3b 20 23 20 4f 4f 20           ; # OO 
03b0: 73 79 73 74 65 6d 2e 0a 70 61 63 6b 61 67 65 20  system..package 
03c0: 72 65 71 75 69 72 65 20 66 69 6c 65 75 74 69 6c  require fileutil
03d0: 3a 3a 74 72 61 76 65 72 73 65 20 20 20 20 20 20  ::traverse      
03e0: 20 20 20 20 20 20 20 20 20 20 20 20 3b 20 23 20              ; # 
03f0: 44 69 72 65 63 74 6f 72 79 20 74 72 61 76 65 72  Directory traver
0400: 73 61 6c 2e 0a 70 61 63 6b 61 67 65 20 72 65 71  sal..package req
0410: 75 69 72 65 20 66 69 6c 65 75 74 69 6c 20 20 20  uire fileutil   
0420: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
0430: 20 20 20 20 20 20 20 20 20 3b 20 23 20 46 69 6c           ; # Fil
0440: 65 20 26 20 70 61 74 68 20 75 74 69 6c 69 74 69  e & path utiliti
0450: 65 73 2e 0a 70 61 63 6b 61 67 65 20 72 65 71 75  es..package requ
0460: 69 72 65 20 76 63 3a 3a 74 6f 6f 6c 73 3a 3a 74  ire vc::tools::t
0470: 72 6f 75 62 6c 65 20 20 20 20 20 20 20 20 20 20  rouble          
0480: 20 20 20 20 20 20 20 20 3b 20 23 20 45 72 72 6f          ; # Erro
0490: 72 20 72 65 70 6f 72 74 69 6e 67 2e 0a 70 61 63  r reporting..pac
04a0: 6b 61 67 65 20 72 65 71 75 69 72 65 20 76 63 3a  kage require vc:
04b0: 3a 74 6f 6f 6c 73 3a 3a 6c 6f 67 20 20 20 20 20  :tools::log     
04c0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
04d0: 20 3b 20 23 20 55 73 65 72 20 66 65 65 64 62 61   ; # User feedba
04e0: 63 6b 2e 0a 70 61 63 6b 61 67 65 20 72 65 71 75  ck..package requ
04f0: 69 72 65 20 76 63 3a 3a 74 6f 6f 6c 73 3a 3a 6d  ire vc::tools::m
0500: 69 73 63 20 20 20 20 20 20 20 20 20 20 20 20 20  isc             
0510: 20 20 20 20 20 20 20 20 3b 20 23 20 4c 6f 63 61          ; # Loca
0520: 6c 20 66 69 6c 65 20 75 74 69 6c 69 74 69 65 73  l file utilities
0530: 2e 0a 70 61 63 6b 61 67 65 20 72 65 71 75 69 72  ..package requir
0540: 65 20 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d  e vc::fossil::im
0550: 70 6f 72 74 3a 3a 63 76 73 3a 3a 70 61 73 73 20  port::cvs::pass 
0560: 20 20 20 20 20 20 3b 20 23 20 50 61 73 73 20 6d        ; # Pass m
0570: 61 6e 61 67 65 6d 65 6e 74 2e 0a 70 61 63 6b 61  anagement..packa
0580: 67 65 20 72 65 71 75 69 72 65 20 76 63 3a 3a 66  ge require vc::f
0590: 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63  ossil::import::c
05a0: 76 73 3a 3a 72 65 70 6f 73 69 74 6f 72 79 20 3b  vs::repository ;
05b0: 20 23 20 52 65 70 6f 73 69 74 6f 72 79 20 6d 61   # Repository ma
05c0: 6e 61 67 65 6d 65 6e 74 2e 0a 70 61 63 6b 61 67  nagement..packag
05d0: 65 20 72 65 71 75 69 72 65 20 76 63 3a 3a 66 6f  e require vc::fo
05e0: 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76  ssil::import::cv
05f0: 73 3a 3a 73 74 61 74 65 20 20 20 20 20 20 3b 20  s::state      ; 
0600: 23 20 53 74 61 74 65 20 73 74 6f 72 61 67 65 0a  # State storage.
0610: 0a 23 20 23 20 23 23 20 23 23 23 20 23 23 23 23  .# # ## ### ####
0620: 23 20 23 23 23 23 23 23 23 23 20 23 23 23 23 23  # ######## #####
0630: 23 23 23 23 23 23 23 23 20 23 23 23 23 23 23 23  ######## #######
0640: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 0a 23  ##############.#
0650: 23 20 52 65 67 69 73 74 65 72 20 74 68 65 20 70  # Register the p
0660: 61 73 73 20 77 69 74 68 20 74 68 65 20 6d 61 6e  ass with the man
0670: 61 67 65 6d 65 6e 74 0a 0a 76 63 3a 3a 66 6f 73  agement..vc::fos
0680: 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73  sil::import::cvs
0690: 3a 3a 70 61 73 73 20 64 65 66 69 6e 65 20 5c 0a  ::pass define \.
06a0: 20 20 20 20 43 6f 6c 6c 65 63 74 41 72 20 5c 0a      CollectAr \.
06b0: 20 20 20 20 7b 43 6f 6c 6c 65 63 74 20 61 72 63      {Collect arc
06c0: 68 69 76 65 73 20 69 6e 20 72 65 70 6f 73 69 74  hives in reposit
06d0: 6f 72 79 7d 20 5c 0a 20 20 20 20 3a 3a 76 63 3a  ory} \.    ::vc:
06e0: 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a  :fossil::import:
06f0: 3a 63 76 73 3a 3a 70 61 73 73 3a 3a 63 6f 6c 6c  :cvs::pass::coll
0700: 61 72 0a 0a 23 20 23 20 23 23 20 23 23 23 20 23  ar..# # ## ### #
0710: 23 23 23 23 20 23 23 23 23 23 23 23 23 20 23 23  #### ######## ##
0720: 23 23 23 23 23 23 23 23 23 23 23 20 23 23 23 23  ########### ####
0730: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23  ################
0740: 23 0a 23 23 0a 0a 73 6e 69 74 3a 3a 74 79 70 65  #.##..snit::type
0750: 20 3a 3a 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69   ::vc::fossil::i
0760: 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 70 61 73 73  mport::cvs::pass
0770: 3a 3a 63 6f 6c 6c 61 72 20 7b 0a 20 20 20 20 23  ::collar {.    #
0780: 20 23 20 23 23 20 23 23 23 20 23 23 23 23 23 20   # ## ### ##### 
0790: 23 23 23 23 23 23 23 23 20 23 23 23 23 23 23 23  ######## #######
07a0: 23 23 23 23 23 23 0a 20 20 20 20 23 23 20 50 75  ######.    ## Pu
07b0: 62 6c 69 63 20 41 50 49 0a 0a 20 20 20 20 74 79  blic API..    ty
07c0: 70 65 6d 65 74 68 6f 64 20 73 65 74 75 70 20 7b  pemethod setup {
07d0: 7d 20 7b 0a 09 23 20 44 65 66 69 6e 65 20 6e 61  } {..# Define na
07e0: 6d 65 73 20 61 6e 64 20 73 74 72 75 63 74 75 72  mes and structur
07f0: 65 20 6f 66 20 74 68 65 20 70 65 72 73 69 73 74  e of the persist
0800: 65 6e 74 20 73 74 61 74 65 20 6f 66 20 74 68 69  ent state of thi
0810: 73 0a 09 23 20 70 61 73 73 2e 0a 0a 09 23 20 57  s..# pass....# W
0820: 65 20 64 65 61 6c 20 77 69 74 68 20 72 65 70 6f  e deal with repo
0830: 73 69 74 6f 72 79 20 70 72 6f 6a 65 63 74 73 2c  sitory projects,
0840: 20 61 6e 64 20 74 68 65 20 72 63 73 20 61 72 63   and the rcs arc
0850: 68 69 76 65 20 66 69 6c 65 73 0a 09 23 20 69 6e  hive files..# in
0860: 20 74 68 65 20 70 72 6f 6a 65 63 74 73 2e 0a 0a   the projects...
0870: 09 23 20 46 6f 72 20 74 68 65 20 66 69 72 73 74  .# For the first
0880: 2c 20 70 72 6f 6a 65 63 74 73 2c 20 77 65 20 6b  , projects, we k
0890: 65 65 70 20 74 68 65 69 72 20 6e 61 6d 65 73 2c  eep their names,
08a0: 20 77 68 69 63 68 20 61 72 65 0a 09 23 20 74 68   which are..# th
08b0: 65 69 72 20 70 61 74 68 73 20 72 65 6c 61 74 69  eir paths relati
08c0: 76 65 20 74 6f 20 74 68 65 20 62 61 73 65 20 64  ve to the base d
08d0: 69 72 65 63 74 6f 72 79 20 6f 66 20 74 68 65 20  irectory of the 
08e0: 77 68 6f 6c 65 0a 09 23 20 72 65 70 6f 73 69 74  whole..# reposit
08f0: 6f 72 79 2e 20 54 68 65 73 65 20 68 61 76 65 20  ory. These have 
0900: 74 6f 20 62 65 20 67 6c 6f 62 61 6c 6c 79 20 75  to be globally u
0910: 6e 69 71 75 65 2c 20 69 2e 65 2e 20 6e 6f 20 74  nique, i.e. no t
0920: 77 6f 0a 09 23 20 70 72 6f 6a 65 63 74 73 20 63  wo..# projects c
0930: 61 6e 20 68 61 76 65 20 74 68 65 20 73 61 6d 65  an have the same
0940: 20 6e 61 6d 65 2e 0a 0a 09 23 20 46 6f 72 20 74   name....# For t
0950: 68 65 20 66 69 6c 65 73 20 77 65 20 6b 65 65 70  he files we keep
0960: 20 74 68 65 69 72 20 6e 61 6d 65 73 2c 20 77 68   their names, wh
0970: 69 63 68 20 61 72 65 20 74 68 65 69 72 20 70 61  ich are their pa
0980: 74 68 73 0a 09 23 20 72 65 6c 61 74 69 76 65 20  ths..# relative 
0990: 74 6f 20 74 68 65 20 62 61 73 65 20 64 69 72 65  to the base dire
09a0: 63 74 6f 72 79 20 6f 66 20 74 68 65 20 77 68 6f  ctory of the who
09b0: 6c 65 20 70 72 6f 6a 65 63 74 21 20 54 68 65 73  le project! Thes
09c0: 65 0a 09 23 20 68 61 76 65 20 74 6f 20 62 65 20  e..# have to be 
09d0: 75 6e 69 71 75 65 20 77 69 74 68 69 6e 20 61 20  unique within a 
09e0: 70 72 6f 6a 65 63 74 2c 20 68 6f 77 65 76 65 72  project, however
09f0: 20 67 6c 6f 62 61 6c 6c 79 20 74 68 69 73 0a 09   globally this..
0a00: 23 20 64 6f 65 73 20 6e 6f 74 20 68 6f 6c 64 2c  # does not hold,
0a10: 20 61 20 6e 61 6d 65 20 6d 61 79 20 6f 63 63 75   a name may occu
0a20: 72 20 73 65 76 65 72 61 6c 20 74 69 6d 65 73 2c  r several times,
0a30: 20 69 6e 20 64 69 66 66 65 72 65 6e 74 0a 09 23   in different..#
0a40: 20 70 72 6f 6a 65 63 74 73 2e 20 57 65 20 66 75   projects. We fu
0a50: 72 74 68 65 72 20 73 74 6f 72 65 20 74 68 65 20  rther store the 
0a60: 75 73 65 72 20 76 69 73 69 62 6c 65 20 66 69 6c  user visible fil
0a70: 65 20 6e 61 6d 65 0a 09 23 20 61 73 73 6f 63 69  e name..# associ
0a80: 61 74 65 64 20 77 69 74 68 20 74 68 65 20 72 63  ated with the rc
0a90: 73 20 61 72 63 68 69 76 65 2e 0a 0a 09 23 20 42  s archive....# B
0aa0: 6f 74 68 20 70 72 6f 6a 65 63 74 73 20 61 6e 64  oth projects and
0ab0: 20 66 69 6c 65 73 20 61 72 65 20 69 64 65 6e 74   files are ident
0ac0: 69 66 69 65 64 20 62 79 20 67 6c 6f 62 61 6c 6c  ified by globall
0ad0: 79 20 75 6e 69 71 75 65 0a 09 23 20 69 6e 74 65  y unique..# inte
0ae0: 67 65 72 20 69 64 73 2c 20 61 75 74 6f 6d 61 74  ger ids, automat
0af0: 69 63 61 6c 6c 79 20 61 73 73 69 67 6e 65 64 20  ically assigned 
0b00: 62 79 20 74 68 65 20 64 61 74 61 62 61 73 65 2e  by the database.
0b10: 0a 0a 09 73 74 61 74 65 20 65 78 74 65 6e 64 20  ...state extend 
0b20: 70 72 6f 6a 65 63 74 20 7b 0a 09 20 20 20 20 70  project {..    p
0b30: 69 64 20 20 49 4e 54 45 47 45 52 20 20 4e 4f 54  id  INTEGER  NOT
0b40: 20 4e 55 4c 4c 20 20 50 52 49 4d 41 52 59 20 4b   NULL  PRIMARY K
0b50: 45 59 20 41 55 54 4f 49 4e 43 52 45 4d 45 4e 54  EY AUTOINCREMENT
0b60: 2c 0a 09 20 20 20 20 6e 61 6d 65 20 54 45 58 54  ,..    name TEXT
0b70: 20 20 20 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 55       NOT NULL  U
0b80: 4e 49 51 55 45 0a 09 7d 0a 09 73 74 61 74 65 20  NIQUE..}..state 
0b90: 65 78 74 65 6e 64 20 66 69 6c 65 20 7b 0a 09 20  extend file {.. 
0ba0: 20 20 20 66 69 64 20 20 20 20 20 49 4e 54 45 47     fid     INTEG
0bb0: 45 52 20 20 4e 4f 54 20 4e 55 4c 4c 20 20 50 52  ER  NOT NULL  PR
0bc0: 49 4d 41 52 59 20 4b 45 59 20 41 55 54 4f 49 4e  IMARY KEY AUTOIN
0bd0: 43 52 45 4d 45 4e 54 2c 0a 09 20 20 20 20 70 69  CREMENT,..    pi
0be0: 64 20 20 20 20 20 49 4e 54 45 47 45 52 20 20 4e  d     INTEGER  N
0bf0: 4f 54 20 4e 55 4c 4c 20 20 52 45 46 45 52 45 4e  OT NULL  REFEREN
0c00: 43 45 53 20 70 72 6f 6a 65 63 74 2c 20 20 20 20  CES project,    
0c10: 20 20 20 2d 2d 20 70 72 6f 6a 65 63 74 20 74 68     -- project th
0c20: 65 20 66 69 6c 65 20 62 65 6c 6f 6e 67 73 20 74  e file belongs t
0c30: 6f 0a 09 20 20 20 20 6e 61 6d 65 20 20 20 20 54  o..    name    T
0c40: 45 58 54 20 20 20 20 20 4e 4f 54 20 4e 55 4c 4c  EXT     NOT NULL
0c50: 2c 0a 09 20 20 20 20 76 69 73 69 62 6c 65 20 54  ,..    visible T
0c60: 45 58 54 20 20 20 20 20 4e 4f 54 20 4e 55 4c 4c  EXT     NOT NULL
0c70: 2c 0a 09 20 20 20 20 65 78 65 63 20 20 20 20 49  ,..    exec    I
0c80: 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c  NTEGER  NOT NULL
0c90: 2c 20 2d 2d 20 62 6f 6f 6c 65 61 6e 2c 20 27 66  , -- boolean, 'f
0ca0: 69 6c 65 20 65 78 65 63 75 74 61 62 6c 65 27 2e  ile executable'.
0cb0: 0a 09 20 20 20 20 55 4e 49 51 55 45 20 28 70 69  ..    UNIQUE (pi
0cc0: 64 2c 20 6e 61 6d 65 29 20 20 20 20 20 20 20 20  d, name)        
0cd0: 20 2d 2d 20 66 69 6c 65 20 6e 61 6d 65 73 20 61   -- file names a
0ce0: 72 65 20 75 6e 69 71 75 65 20 77 69 74 68 69 6e  re unique within
0cf0: 20 61 20 70 72 6f 6a 65 63 74 0a 09 7d 0a 09 72   a project..}..r
0d00: 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20  eturn.    }..   
0d10: 20 74 79 70 65 6d 65 74 68 6f 64 20 6c 6f 61 64   typemethod load
0d20: 20 7b 7d 20 7b 0a 09 23 20 50 61 73 73 20 6d 61   {} {..# Pass ma
0d30: 6e 61 67 65 72 20 69 6e 74 65 72 66 61 63 65 2e  nager interface.
0d40: 20 45 78 65 63 75 74 65 64 20 66 6f 72 20 61 6c   Executed for al
0d50: 6c 20 70 61 73 73 65 73 20 62 65 66 6f 72 65 20  l passes before 
0d60: 74 68 65 0a 09 23 20 72 75 6e 20 70 61 73 73 65  the..# run passe
0d70: 73 2c 20 74 6f 20 6c 6f 61 64 20 61 6c 6c 20 64  s, to load all d
0d80: 61 74 61 20 6f 66 20 74 68 65 69 72 20 70 61 73  ata of their pas
0d90: 73 20 66 72 6f 6d 20 74 68 65 20 73 74 61 74 65  s from the state
0da0: 2c 0a 09 23 20 61 73 20 69 66 20 69 74 20 68 61  ,..# as if it ha
0db0: 64 20 62 65 65 6e 20 63 6f 6d 70 75 74 65 64 20  d been computed 
0dc0: 62 79 20 74 68 65 20 70 61 73 73 20 69 74 73 65  by the pass itse
0dd0: 6c 66 2e 0a 0a 09 73 74 61 74 65 20 75 73 65 20  lf....state use 
0de0: 70 72 6f 6a 65 63 74 0a 09 73 74 61 74 65 20 75  project..state u
0df0: 73 65 20 66 69 6c 65 0a 0a 09 72 65 70 6f 73 69  se file...reposi
0e00: 74 6f 72 79 20 6c 6f 61 64 0a 09 72 65 74 75 72  tory load..retur
0e10: 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 74 79 70  n.    }..    typ
0e20: 65 6d 65 74 68 6f 64 20 72 75 6e 20 7b 7d 20 7b  emethod run {} {
0e30: 0a 09 23 20 50 61 73 73 20 6d 61 6e 61 67 65 72  ..# Pass manager
0e40: 20 69 6e 74 65 72 66 61 63 65 2e 20 45 78 65 63   interface. Exec
0e50: 75 74 65 64 20 74 6f 20 70 65 72 66 6f 72 6d 20  uted to perform 
0e60: 74 68 65 0a 09 23 20 66 75 6e 63 74 69 6f 6e 61  the..# functiona
0e70: 6c 69 74 79 20 6f 66 20 74 68 65 20 70 61 73 73  lity of the pass
0e80: 2e 0a 0a 09 73 65 74 20 72 62 61 73 65 20 5b 72  ....set rbase [r
0e90: 65 70 6f 73 69 74 6f 72 79 20 62 61 73 65 3f 5d  epository base?]
0ea0: 0a 09 66 6f 72 65 61 63 68 20 70 72 6f 6a 65 63  ..foreach projec
0eb0: 74 20 5b 72 65 70 6f 73 69 74 6f 72 79 20 70 72  t [repository pr
0ec0: 6f 6a 65 63 74 73 5d 20 7b 0a 09 20 20 20 20 73  ojects] {..    s
0ed0: 65 74 20 62 61 73 65 20 5b 3a 3a 66 69 6c 65 20  et base [::file 
0ee0: 6a 6f 69 6e 20 24 72 62 61 73 65 20 5b 24 70 72  join $rbase [$pr
0ef0: 6f 6a 65 63 74 20 62 61 73 65 5d 5d 0a 09 20 20  oject base]]..  
0f00: 20 20 6c 6f 67 20 77 72 69 74 65 20 31 20 63 6f    log write 1 co
0f10: 6c 6c 61 72 20 22 53 63 61 6e 20 24 62 61 73 65  llar "Scan $base
0f20: 22 0a 0a 09 20 20 20 20 73 65 74 20 74 72 61 76  "...    set trav
0f30: 65 72 73 65 20 5b 66 69 6c 65 75 74 69 6c 3a 3a  erse [fileutil::
0f40: 74 72 61 76 65 72 73 65 20 25 41 55 54 4f 25 20  traverse %AUTO% 
0f50: 24 62 61 73 65 20 5c 0a 09 09 09 20 20 20 20 20  $base \....     
0f60: 20 2d 70 72 65 66 69 6c 74 65 72 20 5b 6d 79 70   -prefilter [myp
0f70: 72 6f 63 20 46 69 6c 74 65 72 41 74 74 69 63 53  roc FilterAtticS
0f80: 75 62 64 69 72 20 24 62 61 73 65 5d 5d 0a 09 20  ubdir $base]].. 
0f90: 20 20 20 73 65 74 20 6e 20 30 0a 09 20 20 20 20     set n 0..    
0fa0: 73 65 74 20 72 20 7b 7d 0a 0a 09 20 20 20 20 24  set r {}...    $
0fb0: 74 72 61 76 65 72 73 65 20 66 6f 72 65 61 63 68  traverse foreach
0fc0: 20 70 61 74 68 20 7b 0a 09 09 73 65 74 20 72 63   path {...set rc
0fd0: 73 20 5b 66 69 6c 65 75 74 69 6c 3a 3a 73 74 72  s [fileutil::str
0fe0: 69 70 50 61 74 68 20 24 62 61 73 65 20 24 70 61  ipPath $base $pa
0ff0: 74 68 5d 0a 09 09 69 66 20 7b 5b 49 73 43 56 53  th]...if {[IsCVS
1000: 41 64 6d 69 6e 20 20 20 20 24 72 63 73 5d 7d 20  Admin    $rcs]} 
1010: 20 63 6f 6e 74 69 6e 75 65 0a 09 09 69 66 20 7b   continue...if {
1020: 21 5b 49 73 52 43 53 41 72 63 68 69 76 65 20 24  ![IsRCSArchive $
1030: 70 61 74 68 5d 7d 20 63 6f 6e 74 69 6e 75 65 0a  path]} continue.
1040: 0a 09 09 73 65 74 20 75 73 72 20 5b 55 73 65 72  ...set usr [User
1050: 50 61 74 68 20 24 72 63 73 20 69 73 61 74 74 69  Path $rcs isatti
1060: 63 5d 0a 0a 09 09 69 66 20 7b 5b 43 68 65 63 6b  c]....if {[Check
1070: 46 6f 72 41 6e 64 52 65 70 6f 72 74 50 61 74 68  ForAndReportPath
1080: 43 6f 6e 66 6c 69 63 74 73 20 24 62 61 73 65 20  Conflicts $base 
1090: 24 72 63 73 20 24 75 73 72 20 24 69 73 61 74 74  $rcs $usr $isatt
10a0: 69 63 5d 7d 20 63 6f 6e 74 69 6e 75 65 0a 09 09  ic]} continue...
10b0: 69 66 20 7b 5b 48 61 6e 64 6c 65 44 6f 74 46 69  if {[HandleDotFi
10c0: 6c 65 20 20 20 20 20 20 20 20 20 20 20 20 20 20  le              
10d0: 20 20 20 20 24 62 61 73 65 20 24 72 63 73 20 75      $base $rcs u
10e0: 73 72 20 20 24 69 73 61 74 74 69 63 5d 7d 20 63  sr  $isattic]} c
10f0: 6f 6e 74 69 6e 75 65 0a 0a 09 09 6c 6f 67 20 77  ontinue....log w
1100: 72 69 74 65 20 34 20 63 6f 6c 6c 61 72 20 22 46  rite 4 collar "F
1110: 6f 75 6e 64 20 20 20 24 72 63 73 22 0a 09 09 24  ound   $rcs"...$
1120: 70 72 6f 6a 65 63 74 20 61 64 64 66 69 6c 65 20  project addfile 
1130: 24 72 63 73 20 24 75 73 72 20 5b 66 69 6c 65 20  $rcs $usr [file 
1140: 65 78 65 63 75 74 61 62 6c 65 20 24 72 63 73 5d  executable $rcs]
1150: 0a 0a 09 09 69 6e 63 72 20 6e 0a 09 09 69 66 20  ....incr n...if 
1160: 7b 5b 6c 6f 67 20 76 65 72 62 6f 73 69 74 79 3f  {[log verbosity?
1170: 5d 20 3c 20 34 7d 20 7b 0a 09 09 20 20 20 20 6c  ] < 4} {...    l
1180: 6f 67 20 70 72 6f 67 72 65 73 73 20 30 20 63 6f  og progress 0 co
1190: 6c 6c 61 72 20 24 6e 20 7b 7d 0a 09 09 7d 0a 09  llar $n {}...}..
11a0: 20 20 20 20 7d 0a 0a 09 20 20 20 20 24 74 72 61      }...    $tra
11b0: 76 65 72 73 65 20 64 65 73 74 72 6f 79 0a 09 7d  verse destroy..}
11c0: 0a 0a 09 72 65 70 6f 73 69 74 6f 72 79 20 70 72  ...repository pr
11d0: 69 6e 74 73 74 61 74 69 73 74 69 63 73 0a 09 72  intstatistics..r
11e0: 65 70 6f 73 69 74 6f 72 79 20 70 65 72 73 69 73  epository persis
11f0: 74 0a 0a 09 6c 6f 67 20 77 72 69 74 65 20 31 20  t...log write 1 
1200: 63 6f 6c 6c 61 72 20 22 53 63 61 6e 20 63 6f 6d  collar "Scan com
1210: 70 6c 65 74 65 64 22 0a 09 72 65 74 75 72 6e 0a  pleted"..return.
1220: 20 20 20 20 7d 0a 0a 20 20 20 20 74 79 70 65 6d      }..    typem
1230: 65 74 68 6f 64 20 64 69 73 63 61 72 64 20 7b 7d  ethod discard {}
1240: 20 7b 0a 09 23 20 50 61 73 73 20 6d 61 6e 61 67   {..# Pass manag
1250: 65 72 20 69 6e 74 65 72 66 61 63 65 2e 20 45 78  er interface. Ex
1260: 65 63 75 74 65 64 20 66 6f 72 20 61 6c 6c 20 70  ecuted for all p
1270: 61 73 73 65 73 20 61 66 74 65 72 20 74 68 65 0a  asses after the.
1280: 09 23 20 72 75 6e 20 70 61 73 73 65 73 2c 20 74  .# run passes, t
1290: 6f 20 72 65 6d 6f 76 65 20 61 6c 6c 20 64 61 74  o remove all dat
12a0: 61 20 6f 66 20 74 68 69 73 20 70 61 73 73 20 66  a of this pass f
12b0: 72 6f 6d 20 74 68 65 20 73 74 61 74 65 2c 0a 09  rom the state,..
12c0: 23 20 61 73 20 62 65 69 6e 67 20 6f 75 74 20 6f  # as being out o
12d0: 66 20 64 61 74 65 2e 0a 0a 09 73 74 61 74 65 20  f date....state 
12e0: 64 69 73 63 61 72 64 20 70 72 6f 6a 65 63 74 0a  discard project.
12f0: 09 73 74 61 74 65 20 64 69 73 63 61 72 64 20 66  .state discard f
1300: 69 6c 65 0a 09 72 65 74 75 72 6e 0a 20 20 20 20  ile..return.    
1310: 7d 0a 0a 20 20 20 20 74 79 70 65 6d 65 74 68 6f  }..    typemetho
1320: 64 20 69 67 6e 6f 72 65 5f 63 6f 6e 66 6c 69 63  d ignore_conflic
1330: 74 69 6e 67 5f 61 74 74 69 63 73 20 7b 7d 20 7b  ting_attics {} {
1340: 0a 09 73 65 74 20 6d 79 69 67 6e 6f 72 65 20 31  ..set myignore 1
1350: 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a  ..return.    }..
1360: 20 20 20 20 74 79 70 65 6d 65 74 68 6f 64 20 61      typemethod a
1370: 63 63 65 70 74 5f 61 6e 64 5f 63 6f 6e 76 65 72  ccept_and_conver
1380: 74 5f 64 6f 74 66 69 6c 65 73 20 7b 7d 20 7b 0a  t_dotfiles {} {.
1390: 09 73 65 74 20 6d 79 63 6f 6e 76 65 72 74 64 6f  .set myconvertdo
13a0: 74 20 31 0a 09 72 65 74 75 72 6e 0a 20 20 20 20  t 1..return.    
13b0: 7d 0a 0a 20 20 20 20 23 20 23 20 23 23 20 23 23  }..    # # ## ##
13c0: 23 20 23 23 23 23 23 20 23 23 23 23 23 23 23 23  # ##### ########
13d0: 20 23 23 23 23 23 23 23 23 23 23 23 23 23 0a 20   #############. 
13e0: 20 20 20 23 23 20 49 6e 74 65 72 6e 61 6c 20 6d     ## Internal m
13f0: 65 74 68 6f 64 73 0a 0a 20 20 20 20 74 79 70 65  ethods..    type
1400: 76 61 72 69 61 62 6c 65 20 6d 79 69 67 6e 6f 72  variable myignor
1410: 65 20 20 20 20 20 30 20 3b 20 23 20 46 6c 61 67  e     0 ; # Flag
1420: 2e 20 57 68 65 6e 20 73 65 74 20 41 74 74 69 63  . When set Attic
1430: 20 66 69 6c 65 73 0a 09 09 09 09 20 20 23 20 73   files.....  # s
1440: 75 70 65 72 63 65 64 65 64 20 62 79 20 72 65 67  uperceded by reg
1450: 75 6c 61 72 20 66 69 6c 65 73 0a 09 09 09 09 20  ular files..... 
1460: 20 23 20 69 67 6e 6f 72 65 64 2e 0a 20 20 20 20   # ignored..    
1470: 74 79 70 65 76 61 72 69 61 62 6c 65 20 6d 79 63  typevariable myc
1480: 6f 6e 76 65 72 74 64 6f 74 20 30 20 3b 20 23 20  onvertdot 0 ; # 
1490: 46 6c 61 67 2e 20 57 68 65 6e 20 73 65 74 20 64  Flag. When set d
14a0: 6f 74 66 69 6c 65 73 20 64 6f 20 6e 6f 74 0a 09  otfiles do not..
14b0: 09 09 09 20 20 23 20 63 61 75 73 65 20 72 65 6a  ...  # cause rej
14c0: 65 63 74 69 6f 6e 2c 20 62 75 74 20 74 68 65 69  ection, but thei
14d0: 72 20 6e 61 6d 65 73 0a 09 09 09 09 20 20 23 20  r names.....  # 
14e0: 61 72 65 20 63 6f 6e 76 65 72 74 65 64 20 74 6f  are converted to
14f0: 20 61 20 64 6f 74 6c 65 73 73 20 66 6f 72 6d 0a   a dotless form.
1500: 09 09 09 09 20 20 23 20 28 27 64 6f 74 2d 27 20  ....  # ('dot-' 
1510: 70 72 65 66 69 78 20 69 6e 73 74 65 61 64 20 6f  prefix instead o
1520: 66 20 27 2e 27 29 2e 0a 0a 20 20 20 20 70 72 6f  f '.')...    pro
1530: 63 20 46 69 6c 74 65 72 41 74 74 69 63 53 75 62  c FilterAtticSub
1540: 64 69 72 20 7b 62 61 73 65 20 70 61 74 68 7d 20  dir {base path} 
1550: 7b 0a 09 23 20 54 68 69 73 20 63 6f 6d 6d 61 6e  {..# This comman
1560: 64 20 69 73 20 75 73 65 64 20 62 79 20 74 68 65  d is used by the
1570: 20 74 72 61 76 65 72 73 65 72 20 74 6f 20 70 72   traverser to pr
1580: 65 76 65 6e 74 20 69 74 20 66 72 6f 6d 0a 09 23  event it from..#
1590: 20 73 63 61 6e 6e 69 6e 67 20 69 6e 74 6f 20 73   scanning into s
15a0: 75 62 64 69 72 65 63 74 6f 72 69 65 73 20 6f 66  ubdirectories of
15b0: 20 61 6e 20 41 74 74 69 63 2e 20 57 65 20 67 65   an Attic. We ge
15c0: 74 20 61 77 61 79 20 77 69 74 68 0a 09 23 20 63  t away with..# c
15d0: 68 65 63 6b 69 6e 67 20 74 68 65 20 69 6d 6d 65  hecking the imme
15e0: 64 69 61 74 65 20 70 61 72 65 6e 74 20 64 69 72  diate parent dir
15f0: 65 63 74 6f 72 79 20 6f 66 20 74 68 65 20 63 75  ectory of the cu
1600: 72 72 65 6e 74 20 70 61 74 68 0a 09 23 20 61 73  rrent path..# as
1610: 20 6f 75 72 20 72 65 6a 65 63 74 69 6f 6e 20 6d   our rejection m
1620: 65 61 6e 73 20 74 68 61 74 20 64 65 65 70 65 72  eans that deeper
1630: 20 70 61 74 68 20 64 6f 20 6e 6f 74 20 6f 63 63   path do not occ
1640: 75 72 2e 0a 0a 09 69 66 20 7b 5b 66 69 6c 65 20  ur....if {[file 
1650: 74 61 69 6c 20 5b 66 69 6c 65 20 64 69 72 6e 61  tail [file dirna
1660: 6d 65 20 24 70 61 74 68 5d 5d 20 65 71 20 22 41  me $path]] eq "A
1670: 74 74 69 63 22 7d 20 7b 0a 09 20 20 20 20 73 65  ttic"} {..    se
1680: 74 20 61 64 20 5b 66 69 6c 65 75 74 69 6c 3a 3a  t ad [fileutil::
1690: 73 74 72 69 70 50 61 74 68 20 24 62 61 73 65 20  stripPath $base 
16a0: 24 70 61 74 68 5d 0a 09 20 20 20 20 6c 6f 67 20  $path]..    log 
16b0: 77 72 69 74 65 20 31 20 63 6f 6c 6c 61 72 20 22  write 1 collar "
16c0: 44 69 72 65 63 74 6f 72 79 20 24 61 64 20 66 6f  Directory $ad fo
16d0: 75 6e 64 20 69 6e 20 41 74 74 69 63 2c 20 69 67  und in Attic, ig
16e0: 6e 6f 72 69 6e 67 2e 22 0a 09 20 20 20 20 72 65  noring."..    re
16f0: 74 75 72 6e 20 30 0a 09 7d 0a 09 72 65 74 75 72  turn 0..}..retur
1700: 6e 20 31 0a 20 20 20 20 7d 0a 0a 20 20 20 20 70  n 1.    }..    p
1710: 72 6f 63 20 49 73 52 43 53 41 72 63 68 69 76 65  roc IsRCSArchive
1720: 20 7b 70 61 74 68 7d 20 7b 0a 09 69 66 20 7b 21   {path} {..if {!
1730: 5b 73 74 72 69 6e 67 20 6d 61 74 63 68 20 2a 2c  [string match *,
1740: 76 20 24 70 61 74 68 5d 7d 20 20 20 20 20 7b 72  v $path]}     {r
1750: 65 74 75 72 6e 20 30 7d 0a 09 69 66 20 7b 5b 66  eturn 0}..if {[f
1760: 69 6c 65 75 74 69 6c 3a 3a 74 65 73 74 20 24 70  ileutil::test $p
1770: 61 74 68 20 66 72 20 6d 73 67 5d 7d 20 7b 72 65  ath fr msg]} {re
1780: 74 75 72 6e 20 31 7d 0a 09 74 72 6f 75 62 6c 65  turn 1}..trouble
1790: 20 77 61 72 6e 20 24 6d 73 67 0a 09 72 65 74 75   warn $msg..retu
17a0: 72 6e 20 30 0a 20 20 20 20 7d 0a 0a 20 20 20 20  rn 0.    }..    
17b0: 70 72 6f 63 20 49 73 43 56 53 41 64 6d 69 6e 20  proc IsCVSAdmin 
17c0: 7b 72 63 73 7d 20 7b 0a 09 69 66 20 7b 0a 09 20  {rcs} {..if {.. 
17d0: 20 20 20 5b 73 74 72 69 6e 67 20 6d 61 74 63 68     [string match
17e0: 20 7b 43 56 53 52 4f 4f 54 2f 2a 7d 20 20 20 20   {CVSROOT/*}    
17f0: 20 20 20 20 20 20 20 20 20 20 24 72 63 73 5d 20            $rcs] 
1800: 7c 7c 0a 09 20 20 20 20 5b 73 74 72 69 6e 67 20  ||..    [string 
1810: 6d 61 74 63 68 20 7b 2e 63 76 73 69 67 6e 6f 72  match {.cvsignor
1820: 65 2a 7d 20 5b 66 69 6c 65 20 74 61 69 6c 20 24  e*} [file tail $
1830: 72 63 73 5d 5d 0a 09 7d 20 7b 0a 09 20 20 20 20  rcs]]..} {..    
1840: 6c 6f 67 20 77 72 69 74 65 20 34 20 63 6f 6c 6c  log write 4 coll
1850: 61 72 20 22 49 67 6e 6f 72 65 64 20 24 72 63 73  ar "Ignored $rcs
1860: 2c 20 61 64 6d 69 6e 69 73 74 72 61 74 69 76 65  , administrative
1870: 20 61 72 63 68 69 76 65 22 0a 09 20 20 20 20 72   archive"..    r
1880: 65 74 75 72 6e 20 31 0a 09 7d 0a 09 72 65 74 75  eturn 1..}..retu
1890: 72 6e 20 30 0a 20 20 20 20 7d 0a 0a 20 20 20 20  rn 0.    }..    
18a0: 70 72 6f 63 20 55 73 65 72 50 61 74 68 20 7b 72  proc UserPath {r
18b0: 63 73 20 69 61 76 7d 20 7b 0a 09 75 70 76 61 72  cs iav} {..upvar
18c0: 20 31 20 24 69 61 76 20 69 73 61 74 74 69 63 0a   1 $iav isattic.
18d0: 0a 09 23 20 44 65 72 69 76 65 20 74 68 65 20 75  ..# Derive the u
18e0: 73 65 72 2d 76 69 73 69 62 6c 65 20 70 61 74 68  ser-visible path
18f0: 20 66 72 6f 6d 20 74 68 65 20 72 63 73 20 70 61   from the rcs pa
1900: 74 68 2e 20 4d 65 61 6e 69 6e 67 3a 0a 09 23 20  th. Meaning:..# 
1910: 43 68 6f 70 20 6f 66 66 20 74 68 65 20 22 2c 76  Chop off the ",v
1920: 22 20 73 75 66 66 69 78 2c 20 61 6e 64 20 72 65  " suffix, and re
1930: 6d 6f 76 65 20 61 20 70 6f 73 73 69 62 6c 65 20  move a possible 
1940: 22 41 74 74 69 63 22 2e 0a 0a 09 73 65 74 20 66  "Attic"....set f
1950: 20 5b 73 74 72 69 6e 67 20 72 61 6e 67 65 20 24   [string range $
1960: 72 63 73 20 30 20 65 6e 64 2d 32 5d 0a 0a 09 69  rcs 0 end-2]...i
1970: 66 20 7b 22 41 74 74 69 63 22 20 65 71 20 5b 6c  f {"Attic" eq [l
1980: 69 6e 64 65 78 20 5b 66 69 6c 65 20 73 70 6c 69  index [file spli
1990: 74 20 24 72 63 73 5d 20 65 6e 64 2d 31 5d 7d 20  t $rcs] end-1]} 
19a0: 7b 0a 0a 09 20 20 20 20 23 20 54 68 65 20 63 6f  {...    # The co
19b0: 6e 73 74 72 75 63 74 69 6f 6e 20 62 65 6c 6f 77  nstruction below
19c0: 20 65 6e 73 75 72 65 73 20 74 68 61 74 20 41 74   ensures that At
19d0: 74 69 63 2f 58 20 6d 61 70 73 20 74 6f 20 58 0a  tic/X maps to X.
19e0: 09 20 20 20 20 23 20 69 6e 73 74 65 61 64 20 6f  .    # instead o
19f0: 66 20 2e 2f 58 2e 20 4f 74 68 65 72 77 69 73 65  f ./X. Otherwise
1a00: 2c 20 59 2f 41 74 74 69 63 2f 58 20 6d 61 70 73  , Y/Attic/X maps
1a10: 20 74 6f 20 59 2f 58 2e 0a 0a 09 20 20 20 20 73   to Y/X....    s
1a20: 65 74 20 66 78 20 5b 66 69 6c 65 20 64 69 72 6e  et fx [file dirn
1a30: 61 6d 65 20 5b 66 69 6c 65 20 64 69 72 6e 61 6d  ame [file dirnam
1a40: 65 20 24 66 5d 5d 0a 09 20 20 20 20 73 65 74 20  e $f]]..    set 
1a50: 66 20 20 5b 66 69 6c 65 20 74 61 69 6c 20 24 66  f  [file tail $f
1a60: 5d 0a 09 20 20 20 20 69 66 20 7b 24 66 78 20 6e  ]..    if {$fx n
1a70: 65 20 22 2e 22 7d 20 7b 20 73 65 74 20 66 20 5b  e "."} { set f [
1a80: 66 69 6c 65 20 6a 6f 69 6e 20 24 66 78 20 24 66  file join $fx $f
1a90: 5d 20 7d 0a 0a 09 20 20 20 20 73 65 74 20 69 73  ] }...    set is
1aa0: 61 74 74 69 63 20 31 0a 09 7d 20 65 6c 73 65 20  attic 1..} else 
1ab0: 7b 0a 09 20 20 20 20 73 65 74 20 69 73 61 74 74  {..    set isatt
1ac0: 69 63 20 30 0a 09 7d 0a 0a 09 72 65 74 75 72 6e  ic 0..}...return
1ad0: 20 24 66 0a 20 20 20 20 7d 0a 0a 20 20 20 20 70   $f.    }..    p
1ae0: 72 6f 63 20 49 73 53 75 70 65 72 63 65 64 65 64  roc IsSuperceded
1af0: 20 7b 62 61 73 65 20 72 63 73 20 75 73 72 20 69   {base rcs usr i
1b00: 73 61 74 74 69 63 7d 20 7b 0a 09 3a 3a 76 61 72  sattic} {..::var
1b10: 69 61 62 6c 65 20 6d 79 69 67 6e 6f 72 65 0a 0a  iable myignore..
1b20: 09 69 66 20 7b 21 24 69 73 61 74 74 69 63 7d 20  .if {!$isattic} 
1b30: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
1b40: 20 20 20 20 7b 72 65 74 75 72 6e 20 30 7d 0a 09      {return 0}..
1b50: 69 66 20 7b 21 5b 66 69 6c 65 65 78 69 73 74 73  if {![fileexists
1b60: 5f 63 73 20 24 62 61 73 65 2f 24 75 73 72 2c 76  _cs $base/$usr,v
1b70: 5d 7d 20 7b 72 65 74 75 72 6e 20 30 7d 0a 0a 09  ]} {return 0}...
1b80: 23 20 57 65 20 68 61 76 65 20 61 20 72 65 67 75  # We have a regu
1b90: 6c 61 72 20 61 72 63 68 69 76 65 20 61 6e 64 20  lar archive and 
1ba0: 61 6e 20 41 74 74 69 63 20 61 72 63 68 69 76 65  an Attic archive
1bb0: 20 72 65 66 65 72 69 6e 67 20 74 6f 0a 09 23 20   refering to..# 
1bc0: 74 68 65 20 73 61 6d 65 20 75 73 65 72 20 76 69  the same user vi
1bd0: 73 69 62 6c 65 20 66 69 6c 65 2e 20 49 67 6e 6f  sible file. Igno
1be0: 72 65 20 74 68 65 20 66 69 6c 65 20 69 6e 20 74  re the file in t
1bf0: 68 65 20 41 74 74 69 63 2e 0a 09 23 0a 09 23 20  he Attic...#..# 
1c00: 42 79 20 64 65 66 61 75 6c 74 20 74 68 69 73 20  By default this 
1c10: 69 73 20 61 20 70 72 6f 62 6c 65 6d 20 63 61 75  is a problem cau
1c20: 73 69 6e 67 20 61 6e 20 61 62 6f 72 74 20 61 66  sing an abort af
1c30: 74 65 72 20 74 68 65 20 70 61 73 73 0a 09 23 20  ter the pass..# 
1c40: 68 61 73 20 63 6f 6d 70 6c 65 74 65 64 2e 20 54  has completed. T
1c50: 68 65 20 75 73 65 72 20 63 61 6e 20 68 6f 77 65  he user can howe
1c60: 76 65 72 20 66 6f 72 63 65 20 75 73 20 74 6f 20  ver force us to 
1c70: 69 67 6e 6f 72 65 20 69 74 2e 0a 09 23 20 49 6e  ignore it...# In
1c80: 20 74 68 61 74 20 63 61 73 65 20 74 68 65 20 77   that case the w
1c90: 61 72 6e 69 6e 67 20 69 73 20 73 74 69 6c 6c 20  arning is still 
1ca0: 70 72 69 6e 74 65 64 2c 20 62 75 74 20 77 69 6c  printed, but wil
1cb0: 6c 20 6e 6f 74 0a 09 23 20 69 6e 64 75 63 65 20  l not..# induce 
1cc0: 61 6e 20 61 62 6f 72 74 20 61 6e 79 20 6c 6f 6e  an abort any lon
1cd0: 67 65 72 2e 0a 0a 09 69 66 20 7b 24 6d 79 69 67  ger....if {$myig
1ce0: 6e 6f 72 65 7d 20 7b 0a 09 20 20 20 20 6c 6f 67  nore} {..    log
1cf0: 20 77 72 69 74 65 20 32 20 63 6f 6c 6c 61 72 20   write 2 collar 
1d00: 22 49 67 6e 6f 72 65 64 20 24 72 63 73 2c 20 73  "Ignored $rcs, s
1d10: 75 70 65 72 63 65 64 65 64 20 61 72 63 68 69 76  uperceded archiv
1d20: 65 22 0a 09 7d 20 65 6c 73 65 20 7b 0a 09 20 20  e"..} else {..  
1d30: 20 20 74 72 6f 75 62 6c 65 20 77 61 72 6e 20 20    trouble warn  
1d40: 20 20 20 20 20 22 49 67 6e 6f 72 65 64 20 24 72       "Ignored $r
1d50: 63 73 2c 20 73 75 70 65 72 63 65 64 65 64 20 61  cs, superceded a
1d60: 72 63 68 69 76 65 22 0a 09 7d 0a 09 72 65 74 75  rchive"..}..retu
1d70: 72 6e 20 31 0a 20 20 20 20 7d 0a 0a 20 20 20 20  rn 1.    }..    
1d80: 23 20 49 6e 20 74 68 65 20 66 75 74 75 72 65 20  # In the future 
1d90: 77 65 20 73 68 6f 75 6c 64 20 6d 6f 76 65 20 74  we should move t
1da0: 68 65 20 61 63 74 69 76 69 74 79 20 62 65 6c 6f  he activity belo
1db0: 77 20 69 6e 74 6f 20 74 68 65 20 66 6f 73 73 69  w into the fossi
1dc0: 6c 0a 20 20 20 20 23 20 62 61 63 6b 65 6e 64 2c  l.    # backend,
1dd0: 20 61 73 20 74 68 65 20 65 78 61 63 74 20 73 65   as the exact se
1de0: 74 20 6f 66 20 70 61 74 68 73 20 72 65 71 75 69  t of paths requi
1df0: 72 69 6e 67 20 74 72 61 6e 73 6c 61 74 69 6f 6e  ring translation
1e00: 2c 20 61 6e 64 0a 20 20 20 20 23 20 68 6f 77 20  , and.    # how 
1e10: 74 6f 20 74 72 61 6e 73 6c 61 74 65 20 74 68 65  to translate the
1e20: 6d 2c 20 64 65 70 65 6e 64 73 20 65 6e 74 69 72  m, depends entir
1e30: 65 6c 79 20 6f 6e 20 74 68 65 20 6c 69 6d 69 74  ely on the limit
1e40: 61 74 69 6f 6e 73 0a 20 20 20 20 23 20 69 6d 70  ations.    # imp
1e50: 6f 73 65 64 20 62 79 20 74 68 65 20 64 65 73 74  osed by the dest
1e60: 69 6e 61 74 69 6f 6e 20 72 65 70 6f 73 69 74 6f  ination reposito
1e70: 72 79 2e 0a 0a 20 20 20 20 70 72 6f 63 20 48 61  ry...    proc Ha
1e80: 6e 64 6c 65 44 6f 74 46 69 6c 65 20 7b 62 61 73  ndleDotFile {bas
1e90: 65 20 72 63 73 20 75 73 72 76 61 72 20 69 73 61  e rcs usrvar isa
1ea0: 74 74 69 63 7d 20 7b 0a 09 3a 3a 76 61 72 69 61  ttic} {..::varia
1eb0: 62 6c 65 20 6d 79 63 6f 6e 76 65 72 74 64 6f 74  ble myconvertdot
1ec0: 0a 09 75 70 76 61 72 20 31 20 24 75 73 72 76 61  ..upvar 1 $usrva
1ed0: 72 20 75 73 72 0a 0a 09 73 65 74 20 64 65 64 6f  r usr...set dedo
1ee0: 74 20 5b 44 65 44 6f 74 20 24 75 73 72 5d 0a 09  t [DeDot $usr]..
1ef0: 69 66 20 7b 24 64 65 64 6f 74 20 65 71 20 24 75  if {$dedot eq $u
1f00: 73 72 7d 20 7b 20 72 65 74 75 72 6e 20 30 20 7d  sr} { return 0 }
1f10: 0a 0a 09 23 20 4f 6b 2c 20 77 65 20 6e 6f 77 20  ...# Ok, we now 
1f20: 68 61 76 65 20 65 73 74 61 62 6c 69 73 68 65 64  have established
1f30: 20 74 68 61 74 20 74 68 65 20 70 61 74 68 20 68   that the path h
1f40: 61 73 20 74 6f 20 62 65 0a 09 23 20 74 72 61 6e  as to be..# tran
1f50: 73 6c 61 74 65 64 2e 20 57 68 69 63 68 20 61 73  slated. Which as
1f60: 20 61 6c 72 65 61 64 79 20 68 61 70 70 65 6e 65   already happene
1f70: 64 20 61 73 20 70 61 72 74 20 6f 66 20 74 68 65  d as part of the
1f80: 20 63 68 65 63 6b 0a 09 23 20 61 62 6f 76 65 2e   check..# above.
1f90: 20 4c 65 66 74 20 69 73 20 74 6f 20 72 65 70 6f   Left is to repo
1fa0: 72 74 20 74 68 65 20 61 63 74 69 6f 6e 2c 20 61  rt the action, a
1fb0: 6e 64 20 74 6f 20 63 68 65 63 6b 20 69 66 20 74  nd to check if t
1fc0: 68 65 20 6e 65 77 0a 09 23 20 70 61 74 68 20 63  he new..# path c
1fd0: 6f 6c 6c 69 64 65 73 20 77 69 74 68 20 65 78 69  ollides with exi
1fe0: 73 74 69 6e 67 20 66 69 6c 65 73 20 61 6e 64 20  sting files and 
1ff0: 64 69 72 65 63 74 6f 72 69 65 73 2e 0a 0a 09 69  directories....i
2000: 66 20 7b 21 24 6d 79 63 6f 6e 76 65 72 74 64 6f  f {!$myconvertdo
2010: 74 7d 20 7b 0a 09 20 20 20 20 74 72 6f 75 62 6c  t} {..    troubl
2020: 65 20 77 61 72 6e 20 20 20 20 20 20 20 22 49 67  e warn       "Ig
2030: 6e 6f 72 65 64 20 24 72 63 73 2c 20 69 73 20 61  nored $rcs, is a
2040: 20 64 6f 74 2d 66 69 6c 65 22 0a 09 20 20 20 20   dot-file"..    
2050: 72 65 74 75 72 6e 20 31 0a 09 7d 0a 0a 09 6c 6f  return 1..}...lo
2060: 67 20 77 72 69 74 65 20 32 20 63 6f 6c 6c 61 72  g write 2 collar
2070: 20 22 43 6f 6e 76 65 72 74 20 24 72 63 73 2c 20   "Convert $rcs, 
2080: 69 73 20 61 20 64 6f 74 2d 66 69 6c 65 22 0a 09  is a dot-file"..
2090: 73 65 74 20 75 73 72 20 24 64 65 64 6f 74 0a 0a  set usr $dedot..
20a0: 09 72 65 74 75 72 6e 20 5b 43 68 65 63 6b 46 6f  .return [CheckFo
20b0: 72 41 6e 64 52 65 70 6f 72 74 50 61 74 68 43 6f  rAndReportPathCo
20c0: 6e 66 6c 69 63 74 73 20 24 62 61 73 65 20 24 72  nflicts $base $r
20d0: 63 73 20 24 75 73 72 20 24 69 73 61 74 74 69 63  cs $usr $isattic
20e0: 5d 0a 20 20 20 20 7d 0a 0a 20 20 20 20 70 72 6f  ].    }..    pro
20f0: 63 20 44 65 44 6f 74 20 7b 70 61 74 68 7d 20 7b  c DeDot {path} {
2100: 0a 09 73 65 74 20 72 65 73 20 7b 7d 0a 09 66 6f  ..set res {}..fo
2110: 72 65 61 63 68 20 73 65 67 6d 65 6e 74 20 5b 66  reach segment [f
2120: 69 6c 65 20 73 70 6c 69 74 20 24 70 61 74 68 5d  ile split $path]
2130: 20 7b 0a 09 20 20 20 20 6c 61 70 70 65 6e 64 20   {..    lappend 
2140: 72 65 73 20 5b 65 78 70 72 20 7b 0a 09 09 09 20  res [expr {.... 
2150: 20 20 20 20 20 20 5b 73 74 72 69 6e 67 20 6d 61        [string ma
2160: 74 63 68 20 7b 2e 2a 7d 20 24 73 65 67 6d 65 6e  tch {.*} $segmen
2170: 74 5d 0a 09 09 09 20 20 20 20 20 20 20 3f 20 22  t]....       ? "
2180: 64 6f 74 2d 5b 73 74 72 69 6e 67 20 72 61 6e 67  dot-[string rang
2190: 65 20 24 73 65 67 6d 65 6e 74 20 31 20 65 6e 64  e $segment 1 end
21a0: 5d 22 0a 09 09 09 20 20 20 20 20 20 20 3a 20 24  ]"....       : $
21b0: 73 65 67 6d 65 6e 74 0a 09 09 09 20 20 20 7d 5d  segment....   }]
21c0: 0a 09 7d 0a 09 72 65 74 75 72 6e 20 5b 65 76 61  ..}..return [eva
21d0: 6c 20 5b 6c 69 6e 73 65 72 74 20 24 72 65 73 20  l [linsert $res 
21e0: 30 20 66 69 6c 65 20 6a 6f 69 6e 5d 5d 0a 09 23  0 file join]]..#
21f0: 38 2e 35 3a 20 72 65 74 75 72 6e 20 5b 66 69 6c  8.5: return [fil
2200: 65 20 6a 6f 69 6e 20 7b 2a 7d 24 72 65 73 5d 0a  e join {*}$res].
2210: 20 20 20 20 7d 0a 0a 20 20 20 20 70 72 6f 63 20      }..    proc 
2220: 43 68 65 63 6b 46 6f 72 41 6e 64 52 65 70 6f 72  CheckForAndRepor
2230: 74 50 61 74 68 43 6f 6e 66 6c 69 63 74 73 20 7b  tPathConflicts {
2240: 62 61 73 65 20 72 63 73 20 75 73 72 20 69 73 61  base rcs usr isa
2250: 74 74 69 63 20 7b 69 6e 74 72 6f 20 7b 7d 7d 7d  ttic {intro {}}}
2260: 20 7b 0a 09 69 66 20 7b 5b 49 73 53 75 70 65 72   {..if {[IsSuper
2270: 63 65 64 65 64 20 24 62 61 73 65 20 24 72 63 73  ceded $base $rcs
2280: 20 24 75 73 72 20 24 69 73 61 74 74 69 63 5d 7d   $usr $isattic]}
2290: 20 7b 20 72 65 74 75 72 6e 20 31 20 7d 0a 0a 09   { return 1 }...
22a0: 23 20 58 58 58 20 43 68 65 63 6b 6d 65 3a 20 6e  # XXX Checkme: n
22b0: 6f 74 20 73 75 72 65 20 69 66 20 74 68 69 73 20  ot sure if this 
22c0: 77 69 6c 6c 20 73 74 69 6c 6c 20 66 61 69 6c 20  will still fail 
22d0: 69 6e 20 74 68 65 20 63 61 73 65 0a 09 23 20 77  in the case..# w
22e0: 68 65 72 65 20 61 20 64 69 72 65 63 74 6f 72 79  here a directory
22f0: 20 64 6f 65 73 20 63 6f 6e 66 6c 69 63 74 20 77   does conflict w
2300: 69 74 68 20 61 20 66 69 6c 65 20 58 58 58 0a 09  ith a file XXX..
2310: 69 66 20 7b 0a 09 20 20 20 20 5b 66 69 6c 65 65  if {..    [filee
2320: 78 69 73 74 73 5f 63 73 20 24 62 61 73 65 2f 24  xists_cs $base/$
2330: 75 73 72 5d 20 26 26 0a 09 20 20 20 20 5b 66 69  usr] &&..    [fi
2340: 6c 65 69 73 64 69 72 5f 63 73 20 20 24 62 61 73  leisdir_cs  $bas
2350: 65 2f 24 75 73 72 5d 0a 09 7d 20 7b 0a 09 20 20  e/$usr]..} {..  
2360: 20 20 69 66 20 7b 24 69 6e 74 72 6f 20 6e 65 20    if {$intro ne 
2370: 7b 7d 7d 20 7b 0a 09 09 74 72 6f 75 62 6c 65 20  {}} {...trouble 
2380: 66 61 74 61 6c 20 24 69 6e 74 72 6f 0a 09 20 20  fatal $intro..  
2390: 20 20 7d 0a 09 20 20 20 20 74 72 6f 75 62 6c 65    }..    trouble
23a0: 20 66 61 74 61 6c 20 22 44 69 72 65 63 74 6f 72   fatal "Director
23b0: 79 20 6e 61 6d 65 20 63 6f 6e 66 6c 69 63 74 73  y name conflicts
23c0: 20 77 69 74 68 20 66 69 6c 65 6e 61 6d 65 2e 22   with filename."
23d0: 0a 09 20 20 20 20 74 72 6f 75 62 6c 65 20 66 61  ..    trouble fa
23e0: 74 61 6c 20 22 50 6c 65 61 73 65 20 72 65 6d 6f  tal "Please remo
23f0: 76 65 20 6f 72 20 72 65 6e 61 6d 65 20 6f 6e 65  ve or rename one
2400: 20 6f 66 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e   of the followin
2410: 67 3a 22 0a 09 20 20 20 20 74 72 6f 75 62 6c 65  g:"..    trouble
2420: 20 66 61 74 61 6c 20 22 20 20 20 20 24 62 61 73   fatal "    $bas
2430: 65 2f 24 75 73 72 22 0a 09 20 20 20 20 74 72 6f  e/$usr"..    tro
2440: 75 62 6c 65 20 66 61 74 61 6c 20 22 20 20 20 20  uble fatal "    
2450: 24 62 61 73 65 2f 24 72 63 73 22 0a 09 20 20 20  $base/$rcs"..   
2460: 20 72 65 74 75 72 6e 20 31 0a 09 7d 0a 09 72 65   return 1..}..re
2470: 74 75 72 6e 20 30 0a 20 20 20 20 7d 0a 0a 20 20  turn 0.    }..  
2480: 20 20 23 20 23 20 23 23 20 23 23 23 20 23 23 23    # # ## ### ###
2490: 23 23 20 23 23 23 23 23 23 23 23 20 23 23 23 23  ## ######## ####
24a0: 23 23 23 23 23 23 23 23 23 0a 20 20 20 20 23 23  #########.    ##
24b0: 20 43 6f 6e 66 69 67 75 72 61 74 69 6f 6e 0a 0a   Configuration..
24c0: 20 20 20 20 70 72 61 67 6d 61 20 2d 68 61 73 69      pragma -hasi
24d0: 6e 73 74 61 6e 63 65 73 20 20 20 6e 6f 20 3b 20  nstances   no ; 
24e0: 23 20 73 69 6e 67 6c 65 74 6f 6e 0a 20 20 20 20  # singleton.    
24f0: 70 72 61 67 6d 61 20 2d 68 61 73 74 79 70 65 69  pragma -hastypei
2500: 6e 66 6f 20 20 20 20 6e 6f 20 3b 20 23 20 6e 6f  nfo    no ; # no
2510: 20 69 6e 74 72 6f 73 70 65 63 74 69 6f 6e 0a 20   introspection. 
2520: 20 20 20 70 72 61 67 6d 61 20 2d 68 61 73 74 79     pragma -hasty
2530: 70 65 64 65 73 74 72 6f 79 20 6e 6f 20 3b 20 23  pedestroy no ; #
2540: 20 69 6d 6d 6f 72 74 61 6c 0a 0a 20 20 20 20 23   immortal..    #
2550: 20 23 20 23 23 20 23 23 23 20 23 23 23 23 23 20   # ## ### ##### 
2560: 23 23 23 23 23 23 23 23 20 23 23 23 23 23 23 23  ######## #######
2570: 23 23 23 23 23 23 0a 7d 0a 0a 6e 61 6d 65 73 70  ######.}..namesp
2580: 61 63 65 20 65 76 61 6c 20 3a 3a 76 63 3a 3a 66  ace eval ::vc::f
2590: 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63  ossil::import::c
25a0: 76 73 3a 3a 70 61 73 73 20 7b 0a 20 20 20 20 6e  vs::pass {.    n
25b0: 61 6d 65 73 70 61 63 65 20 65 78 70 6f 72 74 20  amespace export 
25c0: 63 6f 6c 6c 61 72 0a 20 20 20 20 6e 61 6d 65 73  collar.    names
25d0: 70 61 63 65 20 65 76 61 6c 20 63 6f 6c 6c 61 72  pace eval collar
25e0: 20 7b 0a 09 6e 61 6d 65 73 70 61 63 65 20 69 6d   {..namespace im
25f0: 70 6f 72 74 20 3a 3a 76 63 3a 3a 66 6f 73 73 69  port ::vc::fossi
2600: 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a  l::import::cvs::
2610: 72 65 70 6f 73 69 74 6f 72 79 0a 09 6e 61 6d 65  repository..name
2620: 73 70 61 63 65 20 69 6d 70 6f 72 74 20 3a 3a 76  space import ::v
2630: 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72  c::fossil::impor
2640: 74 3a 3a 63 76 73 3a 3a 73 74 61 74 65 0a 09 6e  t::cvs::state..n
2650: 61 6d 65 73 70 61 63 65 20 69 6d 70 6f 72 74 20  amespace import 
2660: 3a 3a 76 63 3a 3a 74 6f 6f 6c 73 3a 3a 74 72 6f  ::vc::tools::tro
2670: 75 62 6c 65 0a 09 6e 61 6d 65 73 70 61 63 65 20  uble..namespace 
2680: 69 6d 70 6f 72 74 20 3a 3a 76 63 3a 3a 74 6f 6f  import ::vc::too
2690: 6c 73 3a 3a 6c 6f 67 0a 09 6e 61 6d 65 73 70 61  ls::log..namespa
26a0: 63 65 20 69 6d 70 6f 72 74 20 3a 3a 76 63 3a 3a  ce import ::vc::
26b0: 74 6f 6f 6c 73 3a 3a 6d 69 73 63 3a 3a 66 69 6c  tools::misc::fil
26c0: 65 2a 0a 09 6c 6f 67 20 72 65 67 69 73 74 65 72  e*..log register
26d0: 20 63 6f 6c 6c 61 72 0a 20 20 20 20 7d 0a 7d 0a   collar.    }.}.
26e0: 0a 23 20 23 20 23 23 20 23 23 23 20 23 23 23 23  .# # ## ### ####
26f0: 23 20 23 23 23 23 23 23 23 23 20 23 23 23 23 23  # ######## #####
2700: 23 23 23 23 23 23 23 23 20 23 23 23 23 23 23 23  ######## #######
2710: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 0a 23  ##############.#
2720: 23 20 52 65 61 64 79 0a 0a 70 61 63 6b 61 67 65  # Ready..package
2730: 20 70 72 6f 76 69 64 65 20 76 63 3a 3a 66 6f 73   provide vc::fos
2740: 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73  sil::import::cvs
2750: 3a 3a 70 61 73 73 3a 3a 63 6f 6c 6c 61 72 20 31  ::pass::collar 1
2760: 2e 30 0a 72 65 74 75 72 6e 0a                    .0.return.