Hex Artifact Content
Not logged in

Artifact cdbbe0703f6c5686e72fe0d1b4c8db6ba4d991a0:

File tools/cvs2fossil/lib/c2f_pfiltersym.tcl part of check-in [69bf6ab99b] - Continued work on pass 4. Implemented the deletion of excluded symbols and all parts referencing them. The complex part is the regrafting of NTDB revisions should a NTDB branch be excluded. This is like 'GraftNTDB2Trunk' in 'file' when excluding everything but the trunk. by aku on 2007-11-06 06:47:26.

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 56 2e 20 43 6f 6d 69 6e 67 20 61 66 74  s IV. Coming aft
0210: 65 72 20 74 68 65 20 73 79 6d 62 6f 6c 20 63 6f  er the symbol co
0220: 6c 6c 61 74 69 6f 6e 20 70 61 73 73 20 74 68 69  llation pass thi
0230: 73 20 70 61 73 73 20 6e 6f 77 0a 23 23 20 72 65  s pass now.## re
0240: 6d 6f 76 65 73 20 61 6c 6c 20 72 65 76 69 73 69  moves all revisi
0250: 6f 6e 73 20 61 6e 64 20 73 79 6d 62 6f 6c 73 20  ons and symbols 
0260: 72 65 66 65 72 65 6e 63 69 6e 67 20 61 6e 79 20  referencing any 
0270: 6f 66 20 74 68 65 20 65 78 63 6c 75 64 65 64 0a  of the excluded.
0280: 23 23 20 73 79 6d 62 6f 6c 73 20 66 72 6f 6d 20  ## symbols from 
0290: 74 68 65 20 70 65 72 73 69 73 74 65 6e 74 20 64  the persistent d
02a0: 61 74 61 62 61 73 65 2e 0a 0a 23 20 23 20 23 23  atabase...# # ##
02b0: 20 23 23 23 20 23 23 23 23 23 20 23 23 23 23 23   ### ##### #####
02c0: 23 23 23 20 23 23 23 23 23 23 23 23 23 23 23 23  ### ############
02d0: 23 20 23 23 23 23 23 23 23 23 23 23 23 23 23 23  # ##############
02e0: 23 23 23 23 23 23 23 0a 23 23 20 52 65 71 75 69  #######.## Requi
02f0: 72 65 6d 65 6e 74 73 0a 0a 70 61 63 6b 61 67 65  rements..package
0300: 20 72 65 71 75 69 72 65 20 54 63 6c 20 38 2e 34   require Tcl 8.4
0310: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
0320: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 3b                 ;
0330: 20 23 20 52 65 71 75 69 72 65 64 20 72 75 6e 74   # Required runt
0340: 69 6d 65 2e 0a 70 61 63 6b 61 67 65 20 72 65 71  ime..package req
0350: 75 69 72 65 20 73 6e 69 74 20 20 20 20 20 20 20  uire snit       
0360: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
0370: 20 20 20 20 20 20 20 20 20 20 20 3b 20 23 20 4f             ; # O
0380: 4f 20 73 79 73 74 65 6d 2e 0a 70 61 63 6b 61 67  O system..packag
0390: 65 20 72 65 71 75 69 72 65 20 76 63 3a 3a 74 6f  e require vc::to
03a0: 6f 6c 73 3a 3a 6c 6f 67 20 20 20 20 20 20 20 20  ols::log        
03b0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
03c0: 3b 20 23 20 55 73 65 72 20 66 65 65 64 62 61 63  ; # User feedbac
03d0: 6b 2e 0a 70 61 63 6b 61 67 65 20 72 65 71 75 69  k..package requi
03e0: 72 65 20 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69  re vc::fossil::i
03f0: 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 73 74 61 74  mport::cvs::stat
0400: 65 20 20 20 20 20 20 20 20 3b 20 23 20 53 74 61  e        ; # Sta
0410: 74 65 20 73 74 6f 72 61 67 65 2e 0a 70 61 63 6b  te storage..pack
0420: 61 67 65 20 72 65 71 75 69 72 65 20 76 63 3a 3a  age require vc::
0430: 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a  fossil::import::
0440: 63 76 73 3a 3a 70 72 6f 6a 65 63 74 3a 3a 73 79  cvs::project::sy
0450: 6d 20 3b 20 23 20 50 72 6f 6a 65 63 74 20 6c 65  m ; # Project le
0460: 76 65 6c 20 73 79 6d 62 6f 6c 73 0a 0a 23 20 23  vel symbols..# #
0470: 20 23 23 20 23 23 23 20 23 23 23 23 23 20 23 23   ## ### ##### ##
0480: 23 23 23 23 23 23 20 23 23 23 23 23 23 23 23 23  ###### #########
0490: 23 23 23 23 20 23 23 23 23 23 23 23 23 23 23 23  #### ###########
04a0: 23 23 23 23 23 23 23 23 23 23 0a 23 23 20 52 65  ##########.## Re
04b0: 67 69 73 74 65 72 20 74 68 65 20 70 61 73 73 20  gister the pass 
04c0: 77 69 74 68 20 74 68 65 20 6d 61 6e 61 67 65 6d  with the managem
04d0: 65 6e 74 0a 0a 76 63 3a 3a 66 6f 73 73 69 6c 3a  ent..vc::fossil:
04e0: 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 70 61  :import::cvs::pa
04f0: 73 73 20 64 65 66 69 6e 65 20 5c 0a 20 20 20 20  ss define \.    
0500: 46 69 6c 74 65 72 53 79 6d 62 6f 6c 73 20 5c 0a  FilterSymbols \.
0510: 20 20 20 20 7b 46 69 6c 74 65 72 20 73 79 6d 62      {Filter symb
0520: 6f 6c 73 2c 20 72 65 6d 6f 76 65 20 61 6c 6c 20  ols, remove all 
0530: 65 78 63 6c 75 64 65 64 20 70 69 65 63 65 73 7d  excluded pieces}
0540: 20 5c 0a 20 20 20 20 3a 3a 76 63 3a 3a 66 6f 73   \.    ::vc::fos
0550: 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73  sil::import::cvs
0560: 3a 3a 70 61 73 73 3a 3a 66 69 6c 74 65 72 73 79  ::pass::filtersy
0570: 6d 0a 0a 23 20 23 20 23 23 20 23 23 23 20 23 23  m..# # ## ### ##
0580: 23 23 23 20 23 23 23 23 23 23 23 23 20 23 23 23  ### ######## ###
0590: 23 23 23 23 23 23 23 23 23 23 20 23 23 23 23 23  ########## #####
05a0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23  ################
05b0: 0a 23 23 20 0a 0a 73 6e 69 74 3a 3a 74 79 70 65  .## ..snit::type
05c0: 20 3a 3a 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69   ::vc::fossil::i
05d0: 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 70 61 73 73  mport::cvs::pass
05e0: 3a 3a 66 69 6c 74 65 72 73 79 6d 20 7b 0a 20 20  ::filtersym {.  
05f0: 20 20 23 20 23 20 23 23 20 23 23 23 20 23 23 23    # # ## ### ###
0600: 23 23 20 23 23 23 23 23 23 23 23 20 23 23 23 23  ## ######## ####
0610: 23 23 23 23 23 23 23 23 23 0a 20 20 20 20 23 23  #########.    ##
0620: 20 50 75 62 6c 69 63 20 41 50 49 0a 0a 20 20 20   Public API..   
0630: 20 74 79 70 65 6d 65 74 68 6f 64 20 73 65 74 75   typemethod setu
0640: 70 20 7b 7d 20 7b 0a 09 23 20 44 65 66 69 6e 65  p {} {..# Define
0650: 20 6e 61 6d 65 73 20 61 6e 64 20 73 74 72 75 63   names and struc
0660: 74 75 72 65 20 6f 66 20 74 68 65 20 70 65 72 73  ture of the pers
0670: 69 73 74 65 6e 74 20 73 74 61 74 65 20 6f 66 20  istent state of 
0680: 74 68 69 73 0a 09 23 20 70 61 73 73 2e 0a 0a 09  this..# pass....
0690: 73 74 61 74 65 20 72 65 61 64 69 6e 67 20 73 79  state reading sy
06a0: 6d 62 6f 6c 0a 09 73 74 61 74 65 20 72 65 61 64  mbol..state read
06b0: 69 6e 67 20 62 6c 6f 63 6b 65 72 0a 09 73 74 61  ing blocker..sta
06c0: 74 65 20 72 65 61 64 69 6e 67 20 70 61 72 65 6e  te reading paren
06d0: 74 0a 09 73 74 61 74 65 20 72 65 61 64 69 6e 67  t..state reading
06e0: 20 70 72 65 66 65 72 65 64 70 61 72 65 6e 74 0a   preferedparent.
06f0: 09 73 74 61 74 65 20 72 65 61 64 69 6e 67 20 72  .state reading r
0700: 65 76 69 73 69 6f 6e 0a 09 73 74 61 74 65 20 72  evision..state r
0710: 65 61 64 69 6e 67 20 62 72 61 6e 63 68 0a 09 73  eading branch..s
0720: 74 61 74 65 20 72 65 61 64 69 6e 67 20 74 61 67  tate reading tag
0730: 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a  ..return.    }..
0740: 20 20 20 20 74 79 70 65 6d 65 74 68 6f 64 20 6c      typemethod l
0750: 6f 61 64 20 7b 7d 20 7b 0a 09 23 20 50 61 73 73  oad {} {..# Pass
0760: 20 6d 61 6e 61 67 65 72 20 69 6e 74 65 72 66 61   manager interfa
0770: 63 65 2e 20 45 78 65 63 75 74 65 64 20 74 6f 20  ce. Executed to 
0780: 6c 6f 61 64 20 64 61 74 61 20 63 6f 6d 70 75 74  load data comput
0790: 65 64 20 62 79 0a 09 23 20 74 68 69 73 20 70 61  ed by..# this pa
07a0: 73 73 20 69 6e 74 6f 20 6d 65 6d 6f 72 79 20 77  ss into memory w
07b0: 68 65 6e 20 74 68 69 73 20 70 61 73 73 20 69 73  hen this pass is
07c0: 20 73 6b 69 70 70 65 64 20 69 6e 73 74 65 61 64   skipped instead
07d0: 20 6f 66 0a 09 23 20 65 78 65 63 75 74 65 64 2e   of..# executed.
07e0: 0a 0a 09 23 20 54 68 65 20 72 65 73 75 6c 74 73  ...# The results
07f0: 20 6f 66 20 74 68 69 73 20 70 61 73 73 20 61 72   of this pass ar
0800: 65 20 66 75 6c 6c 79 20 69 6e 20 74 68 65 20 70  e fully in the p
0810: 65 72 73 69 73 74 65 6e 74 20 73 74 61 74 65 2c  ersistent state,
0820: 0a 09 23 20 74 68 65 72 65 20 69 73 20 6e 6f 74  ..# there is not
0830: 68 69 6e 67 20 74 6f 20 6c 6f 61 64 20 66 6f 72  hing to load for
0840: 20 74 68 65 20 6e 65 78 74 20 6f 6e 65 2e 0a 09   the next one...
0850: 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20  return.    }..  
0860: 20 20 74 79 70 65 6d 65 74 68 6f 64 20 72 75 6e    typemethod run
0870: 20 7b 7d 20 7b 0a 09 23 20 50 61 73 73 20 6d 61   {} {..# Pass ma
0880: 6e 61 67 65 72 20 69 6e 74 65 72 66 61 63 65 2e  nager interface.
0890: 20 45 78 65 63 75 74 65 64 20 74 6f 20 70 65 72   Executed to per
08a0: 66 6f 72 6d 20 74 68 65 0a 09 23 20 66 75 6e 63  form the..# func
08b0: 74 69 6f 6e 61 6c 69 74 79 20 6f 66 20 74 68 65  tionality of the
08c0: 20 70 61 73 73 2e 0a 0a 09 23 20 54 68 65 20 72   pass....# The r
08d0: 65 6d 6f 76 61 6c 20 6f 66 20 65 78 63 6c 75 64  emoval of exclud
08e0: 65 64 20 73 79 6d 62 6f 6c 73 20 61 6e 64 20 65  ed symbols and e
08f0: 76 65 72 79 74 68 69 6e 67 20 72 65 66 65 72 65  verything refere
0900: 6e 63 69 6e 67 0a 09 23 20 74 6f 20 74 68 65 6d  ncing..# to them
0910: 20 69 73 20 64 6f 6e 65 20 63 6f 6d 70 6c 65 74   is done complet
0920: 65 6c 79 20 69 6e 20 74 68 65 20 64 61 74 61 62  ely in the datab
0930: 61 73 65 2e 0a 0a 09 73 74 61 74 65 20 74 72 61  ase....state tra
0940: 6e 73 61 63 74 69 6f 6e 20 7b 0a 09 20 20 20 20  nsaction {..    
0950: 46 69 6c 74 65 72 45 78 63 6c 75 64 65 64 53 79  FilterExcludedSy
0960: 6d 62 6f 6c 73 0a 09 7d 0a 0a 09 6c 6f 67 20 77  mbols..}...log w
0970: 72 69 74 65 20 31 20 66 69 6c 74 65 72 73 79 6d  rite 1 filtersym
0980: 20 22 46 69 6c 74 65 72 69 6e 67 20 63 6f 6d 70   "Filtering comp
0990: 6c 65 74 65 64 22 0a 09 72 65 74 75 72 6e 0a 20  leted"..return. 
09a0: 20 20 20 7d 0a 0a 20 20 20 20 74 79 70 65 6d 65     }..    typeme
09b0: 74 68 6f 64 20 64 69 73 63 61 72 64 20 7b 7d 20  thod discard {} 
09c0: 7b 0a 09 23 20 50 61 73 73 20 6d 61 6e 61 67 65  {..# Pass manage
09d0: 72 20 69 6e 74 65 72 66 61 63 65 2e 20 45 78 65  r interface. Exe
09e0: 63 75 74 65 64 20 66 6f 72 20 61 6c 6c 20 70 61  cuted for all pa
09f0: 73 73 65 73 20 61 66 74 65 72 20 74 68 65 0a 09  sses after the..
0a00: 23 20 72 75 6e 20 70 61 73 73 65 73 2c 20 74 6f  # run passes, to
0a10: 20 72 65 6d 6f 76 65 20 61 6c 6c 20 64 61 74 61   remove all data
0a20: 20 6f 66 20 74 68 69 73 20 70 61 73 73 20 66 72   of this pass fr
0a30: 6f 6d 20 74 68 65 20 73 74 61 74 65 2c 0a 09 23  om the state,..#
0a40: 20 61 73 20 62 65 69 6e 67 20 6f 75 74 20 6f 66   as being out of
0a50: 20 64 61 74 65 2e 0a 09 72 65 74 75 72 6e 0a 20   date...return. 
0a60: 20 20 20 7d 0a 0a 20 20 20 20 23 20 23 20 23 23     }..    # # ##
0a70: 20 23 23 23 20 23 23 23 23 23 20 23 23 23 23 23   ### ##### #####
0a80: 23 23 23 20 23 23 23 23 23 23 23 23 23 23 23 23  ### ############
0a90: 23 0a 20 20 20 20 23 23 20 49 6e 74 65 72 6e 61  #.    ## Interna
0aa0: 6c 20 6d 65 74 68 6f 64 73 0a 0a 20 20 20 20 70  l methods..    p
0ab0: 72 6f 63 20 46 69 6c 74 65 72 45 78 63 6c 75 64  roc FilterExclud
0ac0: 65 64 53 79 6d 62 6f 6c 73 20 7b 7d 20 7b 0a 09  edSymbols {} {..
0ad0: 23 20 57 65 20 70 75 6c 6c 20 61 6c 6c 20 74 68  # We pull all th
0ae0: 65 20 65 78 63 6c 75 64 65 64 20 73 79 6d 62 6f  e excluded symbo
0af0: 6c 73 20 74 6f 67 65 74 68 65 72 20 69 6e 74 6f  ls together into
0b00: 20 61 20 74 61 62 6c 65 20 66 6f 72 0a 09 23 20   a table for..# 
0b10: 65 61 73 79 20 72 65 66 65 72 65 6e 63 65 20 62  easy reference b
0b20: 79 20 74 68 65 20 75 70 63 6f 6d 69 6e 67 20 44  y the upcoming D
0b30: 45 4c 45 54 45 20 61 6e 64 20 6f 74 68 65 72 20  ELETE and other 
0b40: 73 74 61 74 65 6d 65 6e 74 73 2e 0a 09 23 20 28  statements...# (
0b50: 27 78 20 49 4e 20 74 61 62 6c 65 27 20 63 6c 61  'x IN table' cla
0b60: 75 73 65 73 29 2e 0a 0a 09 73 65 74 20 65 78 63  uses)....set exc
0b70: 6c 20 5b 70 72 6f 6a 65 63 74 3a 3a 73 79 6d 20  l [project::sym 
0b80: 65 78 63 6c 75 64 65 64 5d 0a 0a 09 73 74 61 74  excluded]...stat
0b90: 65 20 72 75 6e 20 7b 0a 09 20 20 20 20 43 52 45  e run {..    CRE
0ba0: 41 54 45 20 54 45 4d 50 4f 52 41 52 59 20 54 41  ATE TEMPORARY TA
0bb0: 42 4c 45 20 65 78 63 6c 75 64 65 64 73 79 6d 62  BLE excludedsymb
0bc0: 6f 6c 73 20 41 53 0a 09 20 20 20 20 53 45 4c 45  ols AS..    SELE
0bd0: 43 54 20 73 69 64 0a 09 20 20 20 20 46 52 4f 4d  CT sid..    FROM
0be0: 20 20 20 73 79 6d 62 6f 6c 0a 09 20 20 20 20 57     symbol..    W
0bf0: 48 45 52 45 20 20 74 79 70 65 20 3d 20 24 65 78  HERE  type = $ex
0c00: 63 6c 0a 09 7d 0a 0a 09 23 20 46 69 72 73 74 20  cl..}...# First 
0c10: 77 65 20 68 61 76 65 20 74 6f 20 68 61 6e 64 6c  we have to handl
0c20: 65 20 74 68 65 20 70 6f 73 73 69 62 69 6c 69 74  e the possibilit
0c30: 79 20 6f 66 20 61 6e 20 65 78 63 6c 75 64 65 64  y of an excluded
0c40: 0a 09 23 20 4e 54 44 42 2e 20 54 68 69 73 20 69  ..# NTDB. This i
0c50: 73 20 61 20 73 70 65 63 69 61 6c 20 73 70 65 63  s a special spec
0c60: 69 61 6c 20 63 61 73 65 20 74 68 65 72 65 20 77  ial case there w
0c70: 65 20 68 61 76 65 20 74 6f 0a 09 23 20 72 65 67  e have to..# reg
0c80: 72 61 66 74 20 74 68 65 20 72 65 76 69 73 69 6f  raft the revisio
0c90: 6e 73 20 77 68 69 63 68 20 61 72 65 20 73 68 61  ns which are sha
0ca0: 72 65 64 20 62 65 74 77 65 65 6e 20 74 68 65 20  red between the 
0cb0: 4e 54 44 42 20 61 6e 64 0a 09 23 20 54 72 75 6e  NTDB and..# Trun
0cc0: 6b 20 6f 6e 74 6f 20 74 68 65 20 74 72 75 6e 6b  k onto the trunk
0cd0: 2c 20 70 72 65 76 65 6e 74 69 6e 67 20 74 68 65  , preventing the
0ce0: 69 72 20 64 65 6c 65 74 69 6f 6e 20 6c 61 74 65  ir deletion late
0cf0: 72 2e 20 57 65 0a 09 23 20 68 61 76 65 20 63 6f  r. We..# have co
0d00: 64 65 20 66 6f 72 20 74 68 61 74 20 69 6e 20 27  de for that in '
0d10: 66 69 6c 65 27 2c 20 68 6f 77 65 76 65 72 20 74  file', however t
0d20: 68 61 74 20 6f 70 65 72 61 74 65 64 20 6f 6e 20  hat operated on 
0d30: 74 68 65 0a 09 23 20 69 6e 2d 6d 65 6d 6f 72 79  the..# in-memory
0d40: 20 72 65 76 69 73 69 6f 6e 20 6f 62 6a 65 63 74   revision object
0d50: 73 2c 20 77 68 69 63 68 20 77 65 20 64 6f 20 6e  s, which we do n
0d60: 6f 74 20 68 61 76 65 20 68 65 72 65 2e 20 57 65  ot have here. We
0d70: 20 64 6f 0a 09 23 20 74 68 65 20 73 61 6d 65 20   do..# the same 
0d80: 6e 6f 77 20 77 69 74 68 6f 75 74 20 6f 62 6a 65  now without obje
0d90: 63 74 2c 20 62 79 20 64 69 72 65 63 74 6c 79 20  ct, by directly 
0da0: 6d 61 6e 69 70 75 6c 61 74 69 6e 67 20 74 68 65  manipulating the
0db0: 0a 09 23 20 6c 69 6e 6b 73 20 69 6e 20 74 68 65  ..# links in the
0dc0: 20 64 61 74 61 62 61 73 65 2e 0a 0a 09 61 72 72   database....arr
0dd0: 61 79 20 73 65 74 20 6e 74 64 62 20 7b 7d 0a 09  ay set ntdb {}..
0de0: 61 72 72 61 79 20 73 65 74 20 6c 69 6e 6b 20 7b  array set link {
0df0: 7d 0a 0a 09 66 6f 72 65 61 63 68 20 7b 69 64 20  }...foreach {id 
0e00: 70 61 72 65 6e 74 20 74 72 61 6e 73 66 65 72 7d  parent transfer}
0e10: 20 5b 73 74 61 74 65 20 72 75 6e 20 7b 0a 09 20   [state run {.. 
0e20: 20 20 20 53 45 4c 45 43 54 20 52 2e 72 69 64 2c     SELECT R.rid,
0e30: 20 52 2e 70 61 72 65 6e 74 2c 20 52 2e 64 62 63   R.parent, R.dbc
0e40: 68 69 6c 64 0a 09 20 20 20 20 46 52 4f 4d 20 20  hild..    FROM  
0e50: 72 65 76 69 73 69 6f 6e 20 52 2c 20 73 79 6d 62  revision R, symb
0e60: 6f 6c 20 53 0a 09 20 20 20 20 57 48 45 52 45 20  ol S..    WHERE 
0e70: 52 2e 6c 6f 64 20 3d 20 53 2e 73 69 64 0a 09 20  R.lod = S.sid.. 
0e80: 20 20 20 41 4e 44 20 20 20 53 2e 73 69 64 20 49     AND   S.sid I
0e90: 4e 20 65 78 63 6c 75 64 65 64 73 79 6d 62 6f 6c  N excludedsymbol
0ea0: 73 0a 09 20 20 20 20 41 4e 44 20 20 20 52 2e 69  s..    AND   R.i
0eb0: 73 64 65 66 61 75 6c 74 0a 09 7d 5d 20 7b 0a 09  sdefault..}] {..
0ec0: 20 20 20 20 73 65 74 20 6e 74 64 62 28 24 69 64      set ntdb($id
0ed0: 29 20 24 70 61 72 65 6e 74 0a 09 20 20 20 20 69  ) $parent..    i
0ee0: 66 20 7b 24 74 72 61 6e 73 66 65 72 20 65 71 20  f {$transfer eq 
0ef0: 22 22 7d 20 63 6f 6e 74 69 6e 75 65 0a 09 20 20  ""} continue..  
0f00: 20 20 73 65 74 20 6c 69 6e 6b 28 24 69 64 29 20    set link($id) 
0f10: 24 74 72 61 6e 73 66 65 72 0a 09 7d 0a 0a 09 66  $transfer..}...f
0f20: 6f 72 65 61 63 68 20 6a 6f 69 6e 74 20 5b 61 72  oreach joint [ar
0f30: 72 61 79 20 6e 61 6d 65 73 20 6c 69 6e 6b 5d 20  ray names link] 
0f40: 7b 0a 09 20 20 20 20 23 20 54 68 65 20 6a 6f 69  {..    # The joi
0f50: 6e 74 73 20 61 72 65 20 74 68 65 20 68 69 67 68  nts are the high
0f60: 65 73 74 20 4e 54 44 42 20 72 65 76 69 73 69 6f  est NTDB revisio
0f70: 6e 73 20 77 68 69 63 68 20 61 72 65 0a 09 20 20  ns which are..  
0f80: 20 20 23 20 73 68 61 72 65 64 20 77 69 74 68 20    # shared with 
0f90: 74 68 65 69 72 20 72 65 73 70 65 63 74 69 76 65  their respective
0fa0: 20 74 72 75 6e 6b 2e 20 57 65 20 64 69 73 63 6f   trunk. We disco
0fb0: 6e 6e 65 63 74 20 66 72 6f 6d 0a 09 20 20 20 20  nnect from..    
0fc0: 23 20 74 68 65 69 72 20 4e 54 44 42 20 63 68 69  # their NTDB chi
0fd0: 6c 64 72 65 6e 2c 20 61 6e 64 20 6d 61 6b 65 20  ldren, and make 
0fe0: 74 68 65 6d 20 70 61 72 65 6e 74 73 20 6f 66 20  them parents of 
0ff0: 74 68 65 69 72 0a 09 20 20 20 20 23 20 27 64 62  their..    # 'db
1000: 63 68 69 6c 64 27 2e 20 54 68 65 20 61 73 73 6f  child'. The asso
1010: 63 69 61 74 65 64 20 27 64 62 70 61 72 65 6e 74  ciated 'dbparent
1020: 27 20 69 73 20 73 71 75 61 73 68 65 64 0a 09 20  ' is squashed.. 
1030: 20 20 20 23 20 69 6e 73 74 65 61 64 2e 20 41 6c     # instead. Al
1040: 6c 20 70 61 72 65 6e 74 73 20 6f 66 20 74 68 65  l parents of the
1050: 20 6a 6f 69 6e 74 73 20 61 72 65 20 6d 6f 76 65   joints are move
1060: 64 20 74 6f 20 74 68 65 0a 09 20 20 20 20 23 20  d to the..    # 
1070: 74 72 75 6e 6b 20 61 73 20 77 65 6c 6c 2e 0a 0a  trunk as well...
1080: 09 20 20 20 20 73 65 74 20 74 6a 6f 69 6e 74 20  .    set tjoint 
1090: 24 6c 69 6e 6b 28 24 6a 6f 69 6e 74 29 0a 09 20  $link($joint).. 
10a0: 20 20 20 73 65 74 20 74 6c 6f 64 20 5b 6c 69 6e     set tlod [lin
10b0: 64 65 78 20 5b 73 74 61 74 65 20 72 75 6e 20 7b  dex [state run {
10c0: 0a 09 09 53 45 4c 45 43 54 20 6c 6f 64 20 46 52  ...SELECT lod FR
10d0: 4f 4d 20 72 65 76 69 73 69 6f 6e 20 57 48 45 52  OM revision WHER
10e0: 45 20 72 69 64 20 3d 20 24 74 6a 6f 69 6e 74 0a  E rid = $tjoint.
10f0: 09 20 20 20 20 7d 5d 20 30 5d 0a 0a 09 20 20 20  .    }] 0]...   
1100: 20 23 20 43 6f 76 6e 65 72 74 20 64 62 2f 70 61   # Covnert db/pa
1110: 72 65 6e 74 2f 63 68 69 6c 64 20 69 6e 74 6f 20  rent/child into 
1120: 72 65 67 75 6c 61 72 20 70 61 72 65 6e 74 2f 63  regular parent/c
1130: 68 69 6c 64 20 6c 69 6e 6b 73 2e 0a 09 20 20 20  hild links...   
1140: 20 73 74 61 74 65 20 72 75 6e 20 7b 0a 09 09 55   state run {...U
1150: 50 44 41 54 45 20 72 65 76 69 73 69 6f 6e 20 53  PDATE revision S
1160: 45 54 20 64 62 70 61 72 65 6e 74 20 3d 20 4e 55  ET dbparent = NU
1170: 4c 4c 2c 20 70 61 72 65 6e 74 20 3d 20 24 6a 6f  LL, parent = $jo
1180: 69 6e 74 20 20 57 48 45 52 45 20 72 69 64 20 3d  int  WHERE rid =
1190: 20 24 74 6a 6f 69 6e 74 20 3b 0a 09 09 55 50 44   $tjoint ;...UPD
11a0: 41 54 45 20 72 65 76 69 73 69 6f 6e 20 53 45 54  ATE revision SET
11b0: 20 64 62 63 68 69 6c 64 20 20 3d 20 4e 55 4c 4c   dbchild  = NULL
11c0: 2c 20 63 68 69 6c 64 20 20 3d 20 24 74 6a 6f 69  , child  = $tjoi
11d0: 6e 74 20 57 48 45 52 45 20 72 69 64 20 3d 20 24  nt WHERE rid = $
11e0: 6a 6f 69 6e 74 20 20 3b 0a 09 20 20 20 20 7d 0a  joint  ;..    }.
11f0: 09 20 20 20 20 77 68 69 6c 65 20 7b 31 7d 20 7b  .    while {1} {
1200: 0a 09 09 23 20 4d 6f 76 65 20 74 68 65 20 4e 54  ...# Move the NT
1210: 44 42 20 74 72 75 6e 6b 20 72 65 76 69 73 69 6f  DB trunk revisio
1220: 6e 73 20 74 6f 20 74 72 75 6e 6b 2e 0a 09 09 73  ns to trunk....s
1230: 74 61 74 65 20 72 75 6e 20 7b 0a 09 09 20 20 20  tate run {...   
1240: 20 55 50 44 41 54 45 20 72 65 76 69 73 69 6f 6e   UPDATE revision
1250: 20 53 45 54 20 6c 6f 64 20 3d 20 24 74 6c 6f 64   SET lod = $tlod
1260: 2c 20 69 73 64 65 66 61 75 6c 74 20 3d 20 30 20  , isdefault = 0 
1270: 57 48 45 52 45 20 72 69 64 20 3d 20 24 6a 6f 69  WHERE rid = $joi
1280: 6e 74 0a 09 09 7d 0a 09 09 73 65 74 20 6c 61 73  nt...}...set las
1290: 74 20 24 6a 6f 69 6e 74 0a 09 09 73 65 74 20 6a  t $joint...set j
12a0: 6f 69 6e 74 20 24 6e 74 64 62 28 24 6a 6f 69 6e  oint $ntdb($join
12b0: 74 29 0a 09 09 69 66 20 7b 21 5b 69 6e 66 6f 20  t)...if {![info 
12c0: 65 78 69 73 74 73 20 6e 74 64 62 28 24 6a 6f 69  exists ntdb($joi
12d0: 6e 74 29 5d 7d 20 62 72 65 61 6b 0a 09 20 20 20  nt)]} break..   
12e0: 20 7d 0a 0a 09 20 20 20 20 23 20 52 65 61 63 68   }...    # Reach
12f0: 65 64 20 74 68 65 20 4e 54 44 42 20 62 61 73 69  ed the NTDB basi
1300: 73 20 69 6e 20 74 68 65 20 74 72 75 6e 6b 2e 20  s in the trunk. 
1310: 46 69 6e 61 6c 69 7a 65 20 74 68 65 0a 09 20 20  Finalize the..  
1320: 20 20 23 20 70 61 72 65 6e 74 2f 63 68 69 6c 64    # parent/child
1330: 20 6c 69 6e 6b 61 67 65 20 61 6e 64 20 73 71 75   linkage and squ
1340: 61 73 68 20 74 68 65 20 62 72 61 6e 63 68 20 70  ash the branch p
1350: 61 72 65 6e 74 20 73 79 6d 62 6f 6c 0a 09 20 20  arent symbol..  
1360: 20 20 23 20 72 65 66 65 72 65 6e 63 65 2e 0a 0a    # reference...
1370: 09 20 20 20 20 73 74 61 74 65 20 72 75 6e 20 7b  .    state run {
1380: 0a 09 09 55 50 44 41 54 45 20 72 65 76 69 73 69  ...UPDATE revisi
1390: 6f 6e 20 53 45 54 20 63 68 69 6c 64 20 20 20 3d  on SET child   =
13a0: 20 24 6c 61 73 74 20 57 48 45 52 45 20 72 69 64   $last WHERE rid
13b0: 20 3d 20 24 6a 6f 69 6e 74 20 3b 0a 09 09 55 50   = $joint ;...UP
13c0: 44 41 54 45 20 72 65 76 69 73 69 6f 6e 20 53 45  DATE revision SE
13d0: 54 20 62 70 61 72 65 6e 74 20 3d 20 4e 55 4c 4c  T bparent = NULL
13e0: 20 20 57 48 45 52 45 20 72 69 64 20 3d 20 24 6c    WHERE rid = $l
13f0: 61 73 74 20 20 3b 0a 09 20 20 20 20 7d 0a 09 7d  ast  ;..    }..}
1400: 0a 0a 09 23 20 4e 6f 77 20 74 68 61 74 20 74 68  ...# Now that th
1410: 65 20 73 70 65 63 69 61 6c 20 63 61 73 65 20 69  e special case i
1420: 73 20 64 6f 6e 65 20 77 65 20 63 61 6e 20 73 69  s done we can si
1430: 6d 70 6c 79 20 6b 69 6c 6c 20 61 6c 6c 20 74 68  mply kill all th
1440: 65 0a 09 23 20 72 65 76 69 73 69 6f 6e 73 2c 20  e..# revisions, 
1450: 74 61 67 73 2c 20 61 6e 64 20 62 72 61 6e 63 68  tags, and branch
1460: 65 73 20 72 65 66 65 72 65 6e 63 69 6e 67 20 61  es referencing a
1470: 6e 79 20 6f 66 20 74 68 65 0a 09 23 20 65 78 63  ny of the..# exc
1480: 6c 75 64 65 64 20 73 79 6d 62 6f 6c 73 20 69 6e  luded symbols in
1490: 20 73 6f 6d 65 20 77 61 79 2e 20 54 68 69 73 20   some way. This 
14a0: 69 73 20 65 61 73 79 20 61 73 20 77 65 20 64 6f  is easy as we do
14b0: 20 6e 6f 74 20 68 61 76 65 0a 09 23 20 74 6f 20   not have..# to 
14c0: 73 65 6c 65 63 74 20 74 68 65 6d 20 61 67 61 69  select them agai
14d0: 6e 20 61 6e 64 20 61 67 61 69 6e 20 66 72 6f 6d  n and again from
14e0: 20 74 68 65 20 62 61 73 65 20 74 61 62 6c 65 73   the base tables
14f0: 20 61 6e 79 0a 09 23 20 6c 6f 6e 67 65 72 2e 0a   any..# longer..
1500: 0a 09 73 74 61 74 65 20 72 75 6e 20 7b 0a 09 20  ..state run {.. 
1510: 20 20 20 44 45 4c 45 54 45 20 46 52 4f 4d 20 72     DELETE FROM r
1520: 65 76 69 73 69 6f 6e 20 57 48 45 52 45 20 6c 6f  evision WHERE lo
1530: 64 20 49 4e 20 65 78 63 6c 75 64 65 64 73 79 6d  d IN excludedsym
1540: 62 6f 6c 73 3b 0a 09 20 20 20 20 44 45 4c 45 54  bols;..    DELET
1550: 45 20 46 52 4f 4d 20 74 61 67 20 20 20 20 20 20  E FROM tag      
1560: 57 48 45 52 45 20 6c 6f 64 20 49 4e 20 65 78 63  WHERE lod IN exc
1570: 6c 75 64 65 64 73 79 6d 62 6f 6c 73 3b 0a 09 20  ludedsymbols;.. 
1580: 20 20 20 44 45 4c 45 54 45 20 46 52 4f 4d 20 74     DELETE FROM t
1590: 61 67 20 20 20 20 20 20 57 48 45 52 45 20 73 69  ag      WHERE si
15a0: 64 20 49 4e 20 65 78 63 6c 75 64 65 64 73 79 6d  d IN excludedsym
15b0: 62 6f 6c 73 3b 0a 09 20 20 20 20 44 45 4c 45 54  bols;..    DELET
15c0: 45 20 46 52 4f 4d 20 62 72 61 6e 63 68 20 20 20  E FROM branch   
15d0: 57 48 45 52 45 20 6c 6f 64 20 49 4e 20 65 78 63  WHERE lod IN exc
15e0: 6c 75 64 65 64 73 79 6d 62 6f 6c 73 3b 0a 09 20  ludedsymbols;.. 
15f0: 20 20 20 44 45 4c 45 54 45 20 46 52 4f 4d 20 62     DELETE FROM b
1600: 72 61 6e 63 68 20 20 20 57 48 45 52 45 20 73 69  ranch   WHERE si
1610: 64 20 49 4e 20 65 78 63 6c 75 64 65 64 73 79 6d  d IN excludedsym
1620: 62 6f 6c 73 3b 0a 0a 09 20 20 20 20 44 52 4f 50  bols;...    DROP
1630: 20 54 41 42 4c 45 20 65 78 63 6c 75 64 65 64 73   TABLE excludeds
1640: 79 6d 62 6f 6c 73 3b 0a 09 7d 0a 09 72 65 74 75  ymbols;..}..retu
1650: 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 23 20  rn.    }..    # 
1660: 23 20 23 23 20 23 23 23 20 23 23 23 23 23 20 23  # ## ### ##### #
1670: 23 23 23 23 23 23 23 20 23 23 23 23 23 23 23 23  ####### ########
1680: 23 23 23 23 23 0a 20 20 20 20 23 23 20 43 6f 6e  #####.    ## Con
1690: 66 69 67 75 72 61 74 69 6f 6e 0a 0a 20 20 20 20  figuration..    
16a0: 70 72 61 67 6d 61 20 2d 68 61 73 69 6e 73 74 61  pragma -hasinsta
16b0: 6e 63 65 73 20 20 20 6e 6f 20 3b 20 23 20 73 69  nces   no ; # si
16c0: 6e 67 6c 65 74 6f 6e 0a 20 20 20 20 70 72 61 67  ngleton.    prag
16d0: 6d 61 20 2d 68 61 73 74 79 70 65 69 6e 66 6f 20  ma -hastypeinfo 
16e0: 20 20 20 6e 6f 20 3b 20 23 20 6e 6f 20 69 6e 74     no ; # no int
16f0: 72 6f 73 70 65 63 74 69 6f 6e 0a 20 20 20 20 70  rospection.    p
1700: 72 61 67 6d 61 20 2d 68 61 73 74 79 70 65 64 65  ragma -hastypede
1710: 73 74 72 6f 79 20 6e 6f 20 3b 20 23 20 69 6d 6d  stroy no ; # imm
1720: 6f 72 74 61 6c 0a 0a 20 20 20 20 23 20 23 20 23  ortal..    # # #
1730: 23 20 23 23 23 20 23 23 23 23 23 20 23 23 23 23  # ### ##### ####
1740: 23 23 23 23 20 23 23 23 23 23 23 23 23 23 23 23  #### ###########
1750: 23 23 0a 7d 0a 0a 6e 61 6d 65 73 70 61 63 65 20  ##.}..namespace 
1760: 65 76 61 6c 20 3a 3a 76 63 3a 3a 66 6f 73 73 69  eval ::vc::fossi
1770: 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a  l::import::cvs::
1780: 70 61 73 73 20 7b 0a 20 20 20 20 6e 61 6d 65 73  pass {.    names
1790: 70 61 63 65 20 65 78 70 6f 72 74 20 66 69 6c 74  pace export filt
17a0: 65 72 73 79 6d 0a 20 20 20 20 6e 61 6d 65 73 70  ersym.    namesp
17b0: 61 63 65 20 65 76 61 6c 20 66 69 6c 74 65 72 73  ace eval filters
17c0: 79 6d 20 7b 0a 09 6e 61 6d 65 73 70 61 63 65 20  ym {..namespace 
17d0: 69 6d 70 6f 72 74 20 3a 3a 76 63 3a 3a 66 6f 73  import ::vc::fos
17e0: 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73  sil::import::cvs
17f0: 3a 3a 73 74 61 74 65 0a 09 6e 61 6d 65 73 70 61  ::state..namespa
1800: 63 65 20 65 76 61 6c 20 70 72 6f 6a 65 63 74 20  ce eval project 
1810: 7b 0a 09 20 20 20 20 6e 61 6d 65 73 70 61 63 65  {..    namespace
1820: 20 69 6d 70 6f 72 74 20 3a 3a 76 63 3a 3a 66 6f   import ::vc::fo
1830: 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76  ssil::import::cv
1840: 73 3a 3a 70 72 6f 6a 65 63 74 3a 3a 73 79 6d 0a  s::project::sym.
1850: 09 7d 0a 09 6e 61 6d 65 73 70 61 63 65 20 69 6d  .}..namespace im
1860: 70 6f 72 74 20 3a 3a 76 63 3a 3a 74 6f 6f 6c 73  port ::vc::tools
1870: 3a 3a 6c 6f 67 0a 09 6c 6f 67 20 72 65 67 69 73  ::log..log regis
1880: 74 65 72 20 66 69 6c 74 65 72 73 79 6d 0a 20 20  ter filtersym.  
1890: 20 20 7d 0a 7d 0a 0a 23 20 23 20 23 23 20 23 23    }.}..# # ## ##
18a0: 23 20 23 23 23 23 23 20 23 23 23 23 23 23 23 23  # ##### ########
18b0: 20 23 23 23 23 23 23 23 23 23 23 23 23 23 20 23   ############# #
18c0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23  ################
18d0: 23 23 23 23 0a 23 23 20 52 65 61 64 79 0a 0a 70  ####.## Ready..p
18e0: 61 63 6b 61 67 65 20 70 72 6f 76 69 64 65 20 76  ackage provide v
18f0: 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72  c::fossil::impor
1900: 74 3a 3a 63 76 73 3a 3a 70 61 73 73 3a 3a 66 69  t::cvs::pass::fi
1910: 6c 74 65 72 73 79 6d 20 31 2e 30 0a 72 65 74 75  ltersym 1.0.retu
1920: 72 6e 0a                                         rn.