Hex Artifact Content
Not logged in

Artifact 53988122b99428b764ad276fdccd9d297a94b51b:

File tools/cvs2fossil/lib/c2f_pfiltersym.tcl part of check-in [131f051880] - Moved the paranoid integrity checks of pass 2 into a separate package for use by other passes, and changed pass 4 to also run these checks, albeit in a (slightly) relaxed form. See the comments at the point of call for the reason. This completes pass 4. by aku on 2007-11-09 06:28:19.

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 6d 69 73 63 20 20 20 20 20 20 20  ols::misc       
03b0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
03c0: 3b 20 23 20 54 65 78 74 20 66 6f 72 6d 61 74 74  ; # Text formatt
03d0: 69 6e 67 2e 0a 70 61 63 6b 61 67 65 20 72 65 71  ing..package req
03e0: 75 69 72 65 20 76 63 3a 3a 74 6f 6f 6c 73 3a 3a  uire vc::tools::
03f0: 6c 6f 67 20 20 20 20 20 20 20 20 20 20 20 20 20  log             
0400: 20 20 20 20 20 20 20 20 20 20 20 3b 20 23 20 55             ; # U
0410: 73 65 72 20 66 65 65 64 62 61 63 6b 2e 0a 70 61  ser feedback..pa
0420: 63 6b 61 67 65 20 72 65 71 75 69 72 65 20 76 63  ckage require vc
0430: 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 74  ::fossil::import
0440: 3a 3a 63 76 73 3a 3a 73 74 61 74 65 20 20 20 20  ::cvs::state    
0450: 20 20 20 20 3b 20 23 20 53 74 61 74 65 20 73 74      ; # State st
0460: 6f 72 61 67 65 2e 0a 70 61 63 6b 61 67 65 20 72  orage..package r
0470: 65 71 75 69 72 65 20 76 63 3a 3a 66 6f 73 73 69  equire vc::fossi
0480: 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a  l::import::cvs::
0490: 69 6e 74 65 67 72 69 74 79 20 20 20 20 3b 20 23  integrity    ; #
04a0: 20 53 74 61 74 65 20 73 74 6f 72 61 67 65 20 69   State storage i
04b0: 6e 74 65 67 72 69 74 79 20 63 68 65 63 6b 73 2e  ntegrity checks.
04c0: 0a 70 61 63 6b 61 67 65 20 72 65 71 75 69 72 65  .package require
04d0: 20 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70   vc::fossil::imp
04e0: 6f 72 74 3a 3a 63 76 73 3a 3a 70 72 6f 6a 65 63  ort::cvs::projec
04f0: 74 3a 3a 73 79 6d 20 3b 20 23 20 50 72 6f 6a 65  t::sym ; # Proje
0500: 63 74 20 6c 65 76 65 6c 20 73 79 6d 62 6f 6c 73  ct level symbols
0510: 0a 0a 23 20 23 20 23 23 20 23 23 23 20 23 23 23  ..# # ## ### ###
0520: 23 23 20 23 23 23 23 23 23 23 23 20 23 23 23 23  ## ######## ####
0530: 23 23 23 23 23 23 23 23 23 20 23 23 23 23 23 23  ######### ######
0540: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 0a  ###############.
0550: 23 23 20 52 65 67 69 73 74 65 72 20 74 68 65 20  ## Register the 
0560: 70 61 73 73 20 77 69 74 68 20 74 68 65 20 6d 61  pass with the ma
0570: 6e 61 67 65 6d 65 6e 74 0a 0a 76 63 3a 3a 66 6f  nagement..vc::fo
0580: 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76  ssil::import::cv
0590: 73 3a 3a 70 61 73 73 20 64 65 66 69 6e 65 20 5c  s::pass define \
05a0: 0a 20 20 20 20 46 69 6c 74 65 72 53 79 6d 62 6f  .    FilterSymbo
05b0: 6c 73 20 5c 0a 20 20 20 20 7b 46 69 6c 74 65 72  ls \.    {Filter
05c0: 20 73 79 6d 62 6f 6c 73 2c 20 72 65 6d 6f 76 65   symbols, remove
05d0: 20 61 6c 6c 20 65 78 63 6c 75 64 65 64 20 70 69   all excluded pi
05e0: 65 63 65 73 7d 20 5c 0a 20 20 20 20 3a 3a 76 63  eces} \.    ::vc
05f0: 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 74  ::fossil::import
0600: 3a 3a 63 76 73 3a 3a 70 61 73 73 3a 3a 66 69 6c  ::cvs::pass::fil
0610: 74 65 72 73 79 6d 0a 0a 23 20 23 20 23 23 20 23  tersym..# # ## #
0620: 23 23 20 23 23 23 23 23 20 23 23 23 23 23 23 23  ## ##### #######
0630: 23 20 23 23 23 23 23 23 23 23 23 23 23 23 23 20  # ############# 
0640: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23  ################
0650: 23 23 23 23 23 0a 23 23 20 0a 0a 73 6e 69 74 3a  #####.## ..snit:
0660: 3a 74 79 70 65 20 3a 3a 76 63 3a 3a 66 6f 73 73  :type ::vc::foss
0670: 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a  il::import::cvs:
0680: 3a 70 61 73 73 3a 3a 66 69 6c 74 65 72 73 79 6d  :pass::filtersym
0690: 20 7b 0a 20 20 20 20 23 20 23 20 23 23 20 23 23   {.    # # ## ##
06a0: 23 20 23 23 23 23 23 20 23 23 23 23 23 23 23 23  # ##### ########
06b0: 20 23 23 23 23 23 23 23 23 23 23 23 23 23 0a 20   #############. 
06c0: 20 20 20 23 23 20 50 75 62 6c 69 63 20 41 50 49     ## Public API
06d0: 0a 0a 20 20 20 20 74 79 70 65 6d 65 74 68 6f 64  ..    typemethod
06e0: 20 73 65 74 75 70 20 7b 7d 20 7b 0a 09 23 20 44   setup {} {..# D
06f0: 65 66 69 6e 65 20 6e 61 6d 65 73 20 61 6e 64 20  efine names and 
0700: 73 74 72 75 63 74 75 72 65 20 6f 66 20 74 68 65  structure of the
0710: 20 70 65 72 73 69 73 74 65 6e 74 20 73 74 61 74   persistent stat
0720: 65 20 6f 66 20 74 68 69 73 0a 09 23 20 70 61 73  e of this..# pas
0730: 73 2e 0a 0a 09 73 74 61 74 65 20 72 65 61 64 69  s....state readi
0740: 6e 67 20 73 79 6d 62 6f 6c 0a 09 73 74 61 74 65  ng symbol..state
0750: 20 72 65 61 64 69 6e 67 20 62 6c 6f 63 6b 65 72   reading blocker
0760: 0a 09 73 74 61 74 65 20 72 65 61 64 69 6e 67 20  ..state reading 
0770: 70 61 72 65 6e 74 0a 09 73 74 61 74 65 20 72 65  parent..state re
0780: 61 64 69 6e 67 20 70 72 65 66 65 72 65 64 70 61  ading preferedpa
0790: 72 65 6e 74 0a 09 73 74 61 74 65 20 72 65 61 64  rent..state read
07a0: 69 6e 67 20 72 65 76 69 73 69 6f 6e 0a 09 73 74  ing revision..st
07b0: 61 74 65 20 72 65 61 64 69 6e 67 20 62 72 61 6e  ate reading bran
07c0: 63 68 0a 09 73 74 61 74 65 20 72 65 61 64 69 6e  ch..state readin
07d0: 67 20 74 61 67 0a 0a 09 73 74 61 74 65 20 77 72  g tag...state wr
07e0: 69 74 69 6e 67 20 6e 6f 6f 70 20 7b 0a 09 20 20  iting noop {..  
07f0: 20 20 69 64 20 20 20 20 49 4e 54 45 47 45 52 20    id    INTEGER 
0800: 4e 4f 54 20 4e 55 4c 4c 20 20 50 52 49 4d 41 52  NOT NULL  PRIMAR
0810: 59 20 4b 45 59 2c 20 2d 2d 20 74 61 67 2f 62 72  Y KEY, -- tag/br
0820: 61 6e 63 68 20 72 65 66 65 72 65 6e 63 65 0a 09  anch reference..
0830: 20 20 20 20 6e 6f 6f 70 20 20 49 4e 54 45 47 45      noop  INTEGE
0840: 52 20 4e 4f 54 20 4e 55 4c 4c 0a 09 7d 0a 09 72  R NOT NULL..}..r
0850: 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20  eturn.    }..   
0860: 20 74 79 70 65 6d 65 74 68 6f 64 20 6c 6f 61 64   typemethod load
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 6c 6f 61   Executed to loa
08a0: 64 20 64 61 74 61 20 63 6f 6d 70 75 74 65 64 20  d data computed 
08b0: 62 79 0a 09 23 20 74 68 69 73 20 70 61 73 73 20  by..# this pass 
08c0: 69 6e 74 6f 20 6d 65 6d 6f 72 79 20 77 68 65 6e  into memory when
08d0: 20 74 68 69 73 20 70 61 73 73 20 69 73 20 73 6b   this pass is sk
08e0: 69 70 70 65 64 20 69 6e 73 74 65 61 64 20 6f 66  ipped instead of
08f0: 0a 09 23 20 65 78 65 63 75 74 65 64 2e 0a 0a 09  ..# executed....
0900: 23 20 54 68 65 20 72 65 73 75 6c 74 73 20 6f 66  # The results of
0910: 20 74 68 69 73 20 70 61 73 73 20 61 72 65 20 66   this pass are f
0920: 75 6c 6c 79 20 69 6e 20 74 68 65 20 70 65 72 73  ully in the pers
0930: 69 73 74 65 6e 74 20 73 74 61 74 65 2c 0a 09 23  istent state,..#
0940: 20 74 68 65 72 65 20 69 73 20 6e 6f 74 68 69 6e   there is nothin
0950: 67 20 74 6f 20 6c 6f 61 64 20 66 6f 72 20 74 68  g to load for th
0960: 65 20 6e 65 78 74 20 6f 6e 65 2e 0a 09 72 65 74  e next one...ret
0970: 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 74  urn.    }..    t
0980: 79 70 65 6d 65 74 68 6f 64 20 72 75 6e 20 7b 7d  ypemethod run {}
0990: 20 7b 0a 09 23 20 50 61 73 73 20 6d 61 6e 61 67   {..# Pass manag
09a0: 65 72 20 69 6e 74 65 72 66 61 63 65 2e 20 45 78  er interface. Ex
09b0: 65 63 75 74 65 64 20 74 6f 20 70 65 72 66 6f 72  ecuted to perfor
09c0: 6d 20 74 68 65 0a 09 23 20 66 75 6e 63 74 69 6f  m the..# functio
09d0: 6e 61 6c 69 74 79 20 6f 66 20 74 68 65 20 70 61  nality of the pa
09e0: 73 73 2e 0a 0a 09 23 20 54 68 65 20 72 65 6d 6f  ss....# The remo
09f0: 76 61 6c 20 6f 66 20 65 78 63 6c 75 64 65 64 20  val of excluded 
0a00: 73 79 6d 62 6f 6c 73 20 61 6e 64 20 65 76 65 72  symbols and ever
0a10: 79 74 68 69 6e 67 20 72 65 66 65 72 65 6e 63 69  ything referenci
0a20: 6e 67 0a 09 23 20 74 6f 20 74 68 65 6d 20 69 73  ng..# to them is
0a30: 20 64 6f 6e 65 20 63 6f 6d 70 6c 65 74 65 6c 79   done completely
0a40: 20 69 6e 20 74 68 65 20 64 61 74 61 62 61 73 65   in the database
0a50: 2e 0a 0a 09 73 74 61 74 65 20 74 72 61 6e 73 61  ....state transa
0a60: 63 74 69 6f 6e 20 7b 0a 09 20 20 20 20 46 69 6c  ction {..    Fil
0a70: 74 65 72 45 78 63 6c 75 64 65 64 53 79 6d 62 6f  terExcludedSymbo
0a80: 6c 73 0a 09 20 20 20 20 4d 75 74 61 74 65 53 79  ls..    MutateSy
0a90: 6d 62 6f 6c 73 0a 09 20 20 20 20 41 64 6a 75 73  mbols..    Adjus
0aa0: 74 50 61 72 65 6e 74 73 0a 09 20 20 20 20 52 65  tParents..    Re
0ab0: 66 69 6e 65 53 79 6d 62 6f 6c 73 0a 0a 09 20 20  fineSymbols...  
0ac0: 20 20 23 20 53 74 72 69 63 74 20 69 6e 74 65 67    # Strict integ
0ad0: 72 69 74 79 20 65 6e 66 6f 72 63 65 73 20 74 68  rity enforces th
0ae0: 61 74 20 61 6c 6c 20 6d 65 74 61 20 65 6e 74 72  at all meta entr
0af0: 69 65 73 20 61 72 65 20 69 6e 0a 09 20 20 20 20  ies are in..    
0b00: 23 20 74 68 65 20 73 61 6d 65 20 4c 4f 44 20 61  # the same LOD a
0b10: 73 20 74 68 65 20 72 65 76 69 73 69 6f 6e 20 75  s the revision u
0b20: 73 69 6e 67 20 74 68 65 6d 2e 20 41 74 20 74 68  sing them. At th
0b30: 69 73 20 70 6f 69 6e 74 0a 09 20 20 20 20 23 20  is point..    # 
0b40: 74 68 69 73 20 6d 61 79 20 6e 6f 74 20 62 65 20  this may not be 
0b50: 74 72 75 65 20 61 6e 79 20 6c 6f 6e 67 65 72 2e  true any longer.
0b60: 20 49 66 20 61 20 4e 54 44 42 20 77 61 73 20 65   If a NTDB was e
0b70: 78 63 6c 75 64 65 64 0a 09 20 20 20 20 23 20 74  xcluded..    # t
0b80: 68 65 6e 20 61 6c 6c 20 72 65 76 69 73 69 6f 6e  hen all revision
0b90: 73 20 69 74 20 73 68 61 72 65 64 20 77 69 74 68  s it shared with
0ba0: 20 74 68 65 20 74 72 75 6e 6b 20 77 65 72 65 20   the trunk were 
0bb0: 6d 6f 76 65 64 0a 09 20 20 20 20 23 20 74 6f 20  moved..    # to 
0bc0: 74 68 65 20 74 72 75 6e 6b 20 4c 4f 44 2c 20 68  the trunk LOD, h
0bd0: 6f 77 65 76 65 72 20 74 68 65 69 72 20 6d 65 74  owever their met
0be0: 61 20 65 6e 74 72 69 65 73 20 77 69 6c 6c 20 73  a entries will s
0bf0: 74 69 6c 6c 0a 09 20 20 20 20 23 20 72 65 66 65  till..    # refe
0c00: 72 20 74 6f 20 74 68 65 20 6e 6f 77 20 67 6f 6e  r to the now gon
0c10: 65 20 4c 4f 44 20 73 79 6d 62 6f 6c 2e 20 54 68  e LOD symbol. Th
0c20: 69 73 20 69 73 20 66 69 6e 65 20 68 6f 77 65 76  is is fine howev
0c30: 65 72 2c 0a 09 20 20 20 20 23 20 69 74 20 77 69  er,..    # it wi
0c40: 6c 6c 20 6e 6f 74 20 61 66 66 65 63 74 20 6f 75  ll not affect ou
0c50: 72 20 61 62 69 6c 69 74 79 20 74 6f 20 75 73 65  r ability to use
0c60: 20 74 68 65 20 6d 65 74 61 20 65 6e 74 72 69 65   the meta entrie
0c70: 73 0a 09 20 20 20 20 23 20 74 6f 20 64 69 73 74  s..    # to dist
0c80: 69 6e 67 75 69 73 68 20 61 6e 64 20 67 72 6f 75  inguish and grou
0c90: 70 20 72 65 76 69 73 69 6f 6e 73 20 69 6e 74 6f  p revisions into
0ca0: 20 63 68 61 6e 67 65 73 65 74 73 2e 20 49 74 0a   changesets. It.
0cb0: 09 20 20 20 20 23 20 73 68 6f 75 6c 64 20 62 65  .    # should be
0cc0: 20 6e 6f 74 65 64 20 74 68 61 74 20 77 65 20 63   noted that we c
0cd0: 61 6e 6e 6f 74 20 73 69 6d 70 6c 79 20 73 77 69  annot simply swi
0ce0: 74 63 68 20 74 68 65 20 6d 65 74 61 0a 09 20 20  tch the meta..  
0cf0: 20 20 23 20 65 6e 74 72 69 65 73 20 6f 76 65 72    # entries over
0d00: 20 74 6f 20 74 68 65 20 74 72 75 6e 6b 20 65 69   to the trunk ei
0d10: 74 68 65 72 2c 20 61 73 20 74 68 61 74 20 6d 61  ther, as that ma
0d20: 79 20 63 61 75 73 65 20 74 68 65 0a 09 20 20 20  y cause the..   
0d30: 20 23 20 6d 6f 64 69 66 69 65 64 20 65 6e 74 72   # modified entr
0d40: 69 65 73 20 74 6f 20 76 69 6f 6c 61 74 65 20 74  ies to violate t
0d50: 68 65 20 75 6e 69 71 75 65 2d 6e 65 73 73 20 63  he unique-ness c
0d60: 6f 6e 73 74 72 61 69 6e 0a 09 20 20 20 20 23 20  onstrain..    # 
0d70: 73 65 74 20 6f 6e 20 74 68 61 74 20 74 61 62 6c  set on that tabl
0d80: 65 2e 0a 09 20 20 20 20 69 6e 74 65 67 72 69 74  e...    integrit
0d90: 79 20 6d 65 74 61 72 65 6c 61 78 65 64 0a 09 7d  y metarelaxed..}
0da0: 0a 0a 09 6c 6f 67 20 77 72 69 74 65 20 31 20 66  ...log write 1 f
0db0: 69 6c 74 65 72 73 79 6d 20 22 46 69 6c 74 65 72  iltersym "Filter
0dc0: 69 6e 67 20 63 6f 6d 70 6c 65 74 65 64 22 0a 09  ing completed"..
0dd0: 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20  return.    }..  
0de0: 20 20 74 79 70 65 6d 65 74 68 6f 64 20 64 69 73    typemethod dis
0df0: 63 61 72 64 20 7b 7d 20 7b 0a 09 23 20 50 61 73  card {} {..# Pas
0e00: 73 20 6d 61 6e 61 67 65 72 20 69 6e 74 65 72 66  s manager interf
0e10: 61 63 65 2e 20 45 78 65 63 75 74 65 64 20 66 6f  ace. Executed fo
0e20: 72 20 61 6c 6c 20 70 61 73 73 65 73 20 61 66 74  r all passes aft
0e30: 65 72 20 74 68 65 0a 09 23 20 72 75 6e 20 70 61  er the..# run pa
0e40: 73 73 65 73 2c 20 74 6f 20 72 65 6d 6f 76 65 20  sses, to remove 
0e50: 61 6c 6c 20 64 61 74 61 20 6f 66 20 74 68 69 73  all data of this
0e60: 20 70 61 73 73 20 66 72 6f 6d 20 74 68 65 20 73   pass from the s
0e70: 74 61 74 65 2c 0a 09 23 20 61 73 20 62 65 69 6e  tate,..# as bein
0e80: 67 20 6f 75 74 20 6f 66 20 64 61 74 65 2e 0a 09  g out of date...
0e90: 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20  return.    }..  
0ea0: 20 20 23 20 23 20 23 23 20 23 23 23 20 23 23 23    # # ## ### ###
0eb0: 23 23 20 23 23 23 23 23 23 23 23 20 23 23 23 23  ## ######## ####
0ec0: 23 23 23 23 23 23 23 23 23 0a 20 20 20 20 23 23  #########.    ##
0ed0: 20 49 6e 74 65 72 6e 61 6c 20 6d 65 74 68 6f 64   Internal method
0ee0: 73 0a 0a 20 20 20 20 70 72 6f 63 20 46 69 6c 74  s..    proc Filt
0ef0: 65 72 45 78 63 6c 75 64 65 64 53 79 6d 62 6f 6c  erExcludedSymbol
0f00: 73 20 7b 7d 20 7b 0a 09 6c 6f 67 20 77 72 69 74  s {} {..log writ
0f10: 65 20 33 20 66 69 6c 74 65 72 73 79 6d 20 22 46  e 3 filtersym "F
0f20: 69 6c 74 65 72 20 6f 75 74 20 65 78 63 6c 75 64  ilter out exclud
0f30: 65 64 20 73 79 6d 62 6f 6c 73 20 61 6e 64 20 75  ed symbols and u
0f40: 73 65 72 73 22 0a 0a 09 23 20 57 65 20 70 75 6c  sers"...# We pul
0f50: 6c 20 61 6c 6c 20 74 68 65 20 65 78 63 6c 75 64  l all the exclud
0f60: 65 64 20 73 79 6d 62 6f 6c 73 20 74 6f 67 65 74  ed symbols toget
0f70: 68 65 72 20 69 6e 74 6f 20 61 20 74 61 62 6c 65  her into a table
0f80: 20 66 6f 72 0a 09 23 20 65 61 73 79 20 72 65 66   for..# easy ref
0f90: 65 72 65 6e 63 65 20 62 79 20 74 68 65 20 75 70  erence by the up
0fa0: 63 6f 6d 69 6e 67 20 44 45 4c 45 54 45 20 61 6e  coming DELETE an
0fb0: 64 20 6f 74 68 65 72 20 73 74 61 74 65 6d 65 6e  d other statemen
0fc0: 74 73 2e 0a 09 23 20 28 27 78 20 49 4e 20 74 61  ts...# ('x IN ta
0fd0: 62 6c 65 27 20 63 6c 61 75 73 65 73 29 2e 0a 0a  ble' clauses)...
0fe0: 09 73 65 74 20 65 78 63 6c 20 5b 70 72 6f 6a 65  .set excl [proje
0ff0: 63 74 3a 3a 73 79 6d 20 65 78 63 6c 75 64 65 64  ct::sym excluded
1000: 5d 0a 0a 09 73 74 61 74 65 20 72 75 6e 20 7b 0a  ]...state run {.
1010: 09 20 20 20 20 43 52 45 41 54 45 20 54 45 4d 50  .    CREATE TEMP
1020: 4f 52 41 52 59 20 54 41 42 4c 45 20 65 78 63 6c  ORARY TABLE excl
1030: 75 64 65 64 73 79 6d 62 6f 6c 73 20 41 53 0a 09  udedsymbols AS..
1040: 20 20 20 20 53 45 4c 45 43 54 20 73 69 64 0a 09      SELECT sid..
1050: 20 20 20 20 46 52 4f 4d 20 20 20 73 79 6d 62 6f      FROM   symbo
1060: 6c 0a 09 20 20 20 20 57 48 45 52 45 20 20 74 79  l..    WHERE  ty
1070: 70 65 20 3d 20 24 65 78 63 6c 0a 09 7d 0a 0a 09  pe = $excl..}...
1080: 23 20 46 69 72 73 74 20 77 65 20 68 61 76 65 20  # First we have 
1090: 74 6f 20 68 61 6e 64 6c 65 20 74 68 65 20 70 6f  to handle the po
10a0: 73 73 69 62 69 6c 69 74 79 20 6f 66 20 61 6e 20  ssibility of an 
10b0: 65 78 63 6c 75 64 65 64 0a 09 23 20 4e 54 44 42  excluded..# NTDB
10c0: 2e 20 54 68 69 73 20 69 73 20 61 20 73 70 65 63  . This is a spec
10d0: 69 61 6c 20 73 70 65 63 69 61 6c 20 63 61 73 65  ial special case
10e0: 20 74 68 65 72 65 20 77 65 20 68 61 76 65 20 74   there we have t
10f0: 6f 0a 09 23 20 72 65 67 72 61 66 74 20 74 68 65  o..# regraft the
1100: 20 72 65 76 69 73 69 6f 6e 73 20 77 68 69 63 68   revisions which
1110: 20 61 72 65 20 73 68 61 72 65 64 20 62 65 74 77   are shared betw
1120: 65 65 6e 20 74 68 65 20 4e 54 44 42 20 61 6e 64  een the NTDB and
1130: 0a 09 23 20 54 72 75 6e 6b 20 6f 6e 74 6f 20 74  ..# Trunk onto t
1140: 68 65 20 74 72 75 6e 6b 2c 20 70 72 65 76 65 6e  he trunk, preven
1150: 74 69 6e 67 20 74 68 65 69 72 20 64 65 6c 65 74  ting their delet
1160: 69 6f 6e 20 6c 61 74 65 72 2e 20 57 65 0a 09 23  ion later. We..#
1170: 20 68 61 76 65 20 63 6f 64 65 20 66 6f 72 20 74   have code for t
1180: 68 61 74 20 69 6e 20 27 66 69 6c 65 27 2c 20 68  hat in 'file', h
1190: 6f 77 65 76 65 72 20 74 68 61 74 20 6f 70 65 72  owever that oper
11a0: 61 74 65 64 20 6f 6e 20 74 68 65 0a 09 23 20 69  ated on the..# i
11b0: 6e 2d 6d 65 6d 6f 72 79 20 72 65 76 69 73 69 6f  n-memory revisio
11c0: 6e 20 6f 62 6a 65 63 74 73 2c 20 77 68 69 63 68  n objects, which
11d0: 20 77 65 20 64 6f 20 6e 6f 74 20 68 61 76 65 20   we do not have 
11e0: 68 65 72 65 2e 20 57 65 20 64 6f 0a 09 23 20 74  here. We do..# t
11f0: 68 65 20 73 61 6d 65 20 6e 6f 77 20 77 69 74 68  he same now with
1200: 6f 75 74 20 6f 62 6a 65 63 74 2c 20 62 79 20 64  out object, by d
1210: 69 72 65 63 74 6c 79 20 6d 61 6e 69 70 75 6c 61  irectly manipula
1220: 74 69 6e 67 20 74 68 65 0a 09 23 20 6c 69 6e 6b  ting the..# link
1230: 73 20 69 6e 20 74 68 65 20 64 61 74 61 62 61 73  s in the databas
1240: 65 2e 0a 0a 09 61 72 72 61 79 20 73 65 74 20 6e  e....array set n
1250: 74 64 62 20 7b 7d 0a 09 61 72 72 61 79 20 73 65  tdb {}..array se
1260: 74 20 6c 69 6e 6b 20 7b 7d 0a 0a 09 66 6f 72 65  t link {}...fore
1270: 61 63 68 20 7b 69 64 20 70 61 72 65 6e 74 20 74  ach {id parent t
1280: 72 61 6e 73 66 65 72 7d 20 5b 73 74 61 74 65 20  ransfer} [state 
1290: 72 75 6e 20 7b 0a 09 20 20 20 20 53 45 4c 45 43  run {..    SELEC
12a0: 54 20 52 2e 72 69 64 2c 20 52 2e 70 61 72 65 6e  T R.rid, R.paren
12b0: 74 2c 20 52 2e 64 62 63 68 69 6c 64 0a 09 20 20  t, R.dbchild..  
12c0: 20 20 46 52 4f 4d 20 20 72 65 76 69 73 69 6f 6e    FROM  revision
12d0: 20 52 2c 20 73 79 6d 62 6f 6c 20 53 0a 09 20 20   R, symbol S..  
12e0: 20 20 57 48 45 52 45 20 52 2e 6c 6f 64 20 3d 20    WHERE R.lod = 
12f0: 53 2e 73 69 64 0a 09 20 20 20 20 41 4e 44 20 20  S.sid..    AND  
1300: 20 53 2e 73 69 64 20 49 4e 20 65 78 63 6c 75 64   S.sid IN exclud
1310: 65 64 73 79 6d 62 6f 6c 73 0a 09 20 20 20 20 41  edsymbols..    A
1320: 4e 44 20 20 20 52 2e 69 73 64 65 66 61 75 6c 74  ND   R.isdefault
1330: 0a 09 7d 5d 20 7b 0a 09 20 20 20 20 73 65 74 20  ..}] {..    set 
1340: 6e 74 64 62 28 24 69 64 29 20 24 70 61 72 65 6e  ntdb($id) $paren
1350: 74 0a 09 20 20 20 20 69 66 20 7b 24 74 72 61 6e  t..    if {$tran
1360: 73 66 65 72 20 65 71 20 22 22 7d 20 63 6f 6e 74  sfer eq ""} cont
1370: 69 6e 75 65 0a 09 20 20 20 20 73 65 74 20 6c 69  inue..    set li
1380: 6e 6b 28 24 69 64 29 20 24 74 72 61 6e 73 66 65  nk($id) $transfe
1390: 72 0a 09 7d 0a 0a 09 66 6f 72 65 61 63 68 20 6a  r..}...foreach j
13a0: 6f 69 6e 74 20 5b 61 72 72 61 79 20 6e 61 6d 65  oint [array name
13b0: 73 20 6c 69 6e 6b 5d 20 7b 0a 09 20 20 20 20 23  s link] {..    #
13c0: 20 54 68 65 20 6a 6f 69 6e 74 73 20 61 72 65 20   The joints are 
13d0: 74 68 65 20 68 69 67 68 65 73 74 20 4e 54 44 42  the highest NTDB
13e0: 20 72 65 76 69 73 69 6f 6e 73 20 77 68 69 63 68   revisions which
13f0: 20 61 72 65 0a 09 20 20 20 20 23 20 73 68 61 72   are..    # shar
1400: 65 64 20 77 69 74 68 20 74 68 65 69 72 20 72 65  ed with their re
1410: 73 70 65 63 74 69 76 65 20 74 72 75 6e 6b 2e 20  spective trunk. 
1420: 57 65 20 64 69 73 63 6f 6e 6e 65 63 74 20 66 72  We disconnect fr
1430: 6f 6d 0a 09 20 20 20 20 23 20 74 68 65 69 72 20  om..    # their 
1440: 4e 54 44 42 20 63 68 69 6c 64 72 65 6e 2c 20 61  NTDB children, a
1450: 6e 64 20 6d 61 6b 65 20 74 68 65 6d 20 70 61 72  nd make them par
1460: 65 6e 74 73 20 6f 66 20 74 68 65 69 72 0a 09 20  ents of their.. 
1470: 20 20 20 23 20 27 64 62 63 68 69 6c 64 27 2e 20     # 'dbchild'. 
1480: 54 68 65 20 61 73 73 6f 63 69 61 74 65 64 20 27  The associated '
1490: 64 62 70 61 72 65 6e 74 27 20 69 73 20 73 71 75  dbparent' is squ
14a0: 61 73 68 65 64 0a 09 20 20 20 20 23 20 69 6e 73  ashed..    # ins
14b0: 74 65 61 64 2e 20 41 6c 6c 20 70 61 72 65 6e 74  tead. All parent
14c0: 73 20 6f 66 20 74 68 65 20 6a 6f 69 6e 74 73 20  s of the joints 
14d0: 61 72 65 20 6d 6f 76 65 64 20 74 6f 20 74 68 65  are moved to the
14e0: 0a 09 20 20 20 20 23 20 74 72 75 6e 6b 20 61 73  ..    # trunk as
14f0: 20 77 65 6c 6c 2e 0a 0a 09 20 20 20 20 73 65 74   well....    set
1500: 20 74 6a 6f 69 6e 74 20 24 6c 69 6e 6b 28 24 6a   tjoint $link($j
1510: 6f 69 6e 74 29 0a 09 20 20 20 20 73 65 74 20 74  oint)..    set t
1520: 6c 6f 64 20 5b 6c 69 6e 64 65 78 20 5b 73 74 61  lod [lindex [sta
1530: 74 65 20 72 75 6e 20 7b 0a 09 09 53 45 4c 45 43  te run {...SELEC
1540: 54 20 6c 6f 64 20 46 52 4f 4d 20 72 65 76 69 73  T lod FROM revis
1550: 69 6f 6e 20 57 48 45 52 45 20 72 69 64 20 3d 20  ion WHERE rid = 
1560: 24 74 6a 6f 69 6e 74 0a 09 20 20 20 20 7d 5d 20  $tjoint..    }] 
1570: 30 5d 0a 0a 09 20 20 20 20 23 20 43 6f 76 6e 65  0]...    # Covne
1580: 72 74 20 64 62 2f 70 61 72 65 6e 74 2f 63 68 69  rt db/parent/chi
1590: 6c 64 20 69 6e 74 6f 20 72 65 67 75 6c 61 72 20  ld into regular 
15a0: 70 61 72 65 6e 74 2f 63 68 69 6c 64 20 6c 69 6e  parent/child lin
15b0: 6b 73 2e 0a 09 20 20 20 20 73 74 61 74 65 20 72  ks...    state r
15c0: 75 6e 20 7b 0a 09 09 55 50 44 41 54 45 20 72 65  un {...UPDATE re
15d0: 76 69 73 69 6f 6e 20 53 45 54 20 64 62 70 61 72  vision SET dbpar
15e0: 65 6e 74 20 3d 20 4e 55 4c 4c 2c 20 70 61 72 65  ent = NULL, pare
15f0: 6e 74 20 3d 20 24 6a 6f 69 6e 74 20 20 57 48 45  nt = $joint  WHE
1600: 52 45 20 72 69 64 20 3d 20 24 74 6a 6f 69 6e 74  RE rid = $tjoint
1610: 20 3b 0a 09 09 55 50 44 41 54 45 20 72 65 76 69   ;...UPDATE revi
1620: 73 69 6f 6e 20 53 45 54 20 64 62 63 68 69 6c 64  sion SET dbchild
1630: 20 20 3d 20 4e 55 4c 4c 2c 20 63 68 69 6c 64 20    = NULL, child 
1640: 20 3d 20 24 74 6a 6f 69 6e 74 20 57 48 45 52 45   = $tjoint WHERE
1650: 20 72 69 64 20 3d 20 24 6a 6f 69 6e 74 20 20 3b   rid = $joint  ;
1660: 0a 09 20 20 20 20 7d 0a 09 20 20 20 20 77 68 69  ..    }..    whi
1670: 6c 65 20 7b 31 7d 20 7b 0a 09 09 23 20 4d 6f 76  le {1} {...# Mov
1680: 65 20 74 68 65 20 4e 54 44 42 20 74 72 75 6e 6b  e the NTDB trunk
1690: 20 72 65 76 69 73 69 6f 6e 73 20 74 6f 20 74 72   revisions to tr
16a0: 75 6e 6b 2e 0a 09 09 73 74 61 74 65 20 72 75 6e  unk....state run
16b0: 20 7b 0a 09 09 20 20 20 20 55 50 44 41 54 45 20   {...    UPDATE 
16c0: 72 65 76 69 73 69 6f 6e 20 53 45 54 20 6c 6f 64  revision SET lod
16d0: 20 3d 20 24 74 6c 6f 64 2c 20 69 73 64 65 66 61   = $tlod, isdefa
16e0: 75 6c 74 20 3d 20 30 20 57 48 45 52 45 20 72 69  ult = 0 WHERE ri
16f0: 64 20 3d 20 24 6a 6f 69 6e 74 0a 09 09 7d 0a 09  d = $joint...}..
1700: 09 73 65 74 20 6c 61 73 74 20 24 6a 6f 69 6e 74  .set last $joint
1710: 0a 09 09 73 65 74 20 6a 6f 69 6e 74 20 24 6e 74  ...set joint $nt
1720: 64 62 28 24 6a 6f 69 6e 74 29 0a 09 09 69 66 20  db($joint)...if 
1730: 7b 21 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 6e  {![info exists n
1740: 74 64 62 28 24 6a 6f 69 6e 74 29 5d 7d 20 62 72  tdb($joint)]} br
1750: 65 61 6b 0a 09 20 20 20 20 7d 0a 0a 09 20 20 20  eak..    }...   
1760: 20 23 20 52 65 61 63 68 65 64 20 74 68 65 20 4e   # Reached the N
1770: 54 44 42 20 62 61 73 69 73 20 69 6e 20 74 68 65  TDB basis in the
1780: 20 74 72 75 6e 6b 2e 20 46 69 6e 61 6c 69 7a 65   trunk. Finalize
1790: 20 74 68 65 0a 09 20 20 20 20 23 20 70 61 72 65   the..    # pare
17a0: 6e 74 2f 63 68 69 6c 64 20 6c 69 6e 6b 61 67 65  nt/child linkage
17b0: 20 61 6e 64 20 73 71 75 61 73 68 20 74 68 65 20   and squash the 
17c0: 62 72 61 6e 63 68 20 70 61 72 65 6e 74 20 73 79  branch parent sy
17d0: 6d 62 6f 6c 0a 09 20 20 20 20 23 20 72 65 66 65  mbol..    # refe
17e0: 72 65 6e 63 65 2e 0a 0a 09 20 20 20 20 73 74 61  rence....    sta
17f0: 74 65 20 72 75 6e 20 7b 0a 09 09 55 50 44 41 54  te run {...UPDAT
1800: 45 20 72 65 76 69 73 69 6f 6e 20 53 45 54 20 63  E revision SET c
1810: 68 69 6c 64 20 20 20 3d 20 24 6c 61 73 74 20 57  hild   = $last W
1820: 48 45 52 45 20 72 69 64 20 3d 20 24 6a 6f 69 6e  HERE rid = $join
1830: 74 20 3b 0a 09 09 55 50 44 41 54 45 20 72 65 76  t ;...UPDATE rev
1840: 69 73 69 6f 6e 20 53 45 54 20 62 70 61 72 65 6e  ision SET bparen
1850: 74 20 3d 20 4e 55 4c 4c 20 20 57 48 45 52 45 20  t = NULL  WHERE 
1860: 72 69 64 20 3d 20 24 6c 61 73 74 20 20 3b 0a 09  rid = $last  ;..
1870: 20 20 20 20 7d 0a 09 7d 0a 0a 09 23 20 4e 6f 77      }..}...# Now
1880: 20 74 68 61 74 20 74 68 65 20 73 70 65 63 69 61   that the specia
1890: 6c 20 63 61 73 65 20 69 73 20 64 6f 6e 65 20 77  l case is done w
18a0: 65 20 63 61 6e 20 73 69 6d 70 6c 79 20 6b 69 6c  e can simply kil
18b0: 6c 20 61 6c 6c 20 74 68 65 0a 09 23 20 72 65 76  l all the..# rev
18c0: 69 73 69 6f 6e 73 2c 20 74 61 67 73 2c 20 61 6e  isions, tags, an
18d0: 64 20 62 72 61 6e 63 68 65 73 20 72 65 66 65 72  d branches refer
18e0: 65 6e 63 69 6e 67 20 61 6e 79 20 6f 66 20 74 68  encing any of th
18f0: 65 0a 09 23 20 65 78 63 6c 75 64 65 64 20 73 79  e..# excluded sy
1900: 6d 62 6f 6c 73 20 69 6e 20 73 6f 6d 65 20 77 61  mbols in some wa
1910: 79 2e 20 54 68 69 73 20 69 73 20 65 61 73 79 20  y. This is easy 
1920: 61 73 20 77 65 20 64 6f 20 6e 6f 74 20 68 61 76  as we do not hav
1930: 65 0a 09 23 20 74 6f 20 73 65 6c 65 63 74 20 74  e..# to select t
1940: 68 65 6d 20 61 67 61 69 6e 20 61 6e 64 20 61 67  hem again and ag
1950: 61 69 6e 20 66 72 6f 6d 20 74 68 65 20 62 61 73  ain from the bas
1960: 65 20 74 61 62 6c 65 73 20 61 6e 79 0a 09 23 20  e tables any..# 
1970: 6c 6f 6e 67 65 72 2e 0a 0a 09 73 74 61 74 65 20  longer....state 
1980: 72 75 6e 20 7b 0a 09 20 20 20 20 44 45 4c 45 54  run {..    DELET
1990: 45 20 46 52 4f 4d 20 72 65 76 69 73 69 6f 6e 20  E FROM revision 
19a0: 57 48 45 52 45 20 6c 6f 64 20 49 4e 20 65 78 63  WHERE lod IN exc
19b0: 6c 75 64 65 64 73 79 6d 62 6f 6c 73 3b 0a 09 20  ludedsymbols;.. 
19c0: 20 20 20 44 45 4c 45 54 45 20 46 52 4f 4d 20 74     DELETE FROM t
19d0: 61 67 20 20 20 20 20 20 57 48 45 52 45 20 6c 6f  ag      WHERE lo
19e0: 64 20 49 4e 20 65 78 63 6c 75 64 65 64 73 79 6d  d IN excludedsym
19f0: 62 6f 6c 73 3b 0a 09 20 20 20 20 44 45 4c 45 54  bols;..    DELET
1a00: 45 20 46 52 4f 4d 20 74 61 67 20 20 20 20 20 20  E FROM tag      
1a10: 57 48 45 52 45 20 73 69 64 20 49 4e 20 65 78 63  WHERE sid IN exc
1a20: 6c 75 64 65 64 73 79 6d 62 6f 6c 73 3b 0a 09 20  ludedsymbols;.. 
1a30: 20 20 20 44 45 4c 45 54 45 20 46 52 4f 4d 20 62     DELETE FROM b
1a40: 72 61 6e 63 68 20 20 20 57 48 45 52 45 20 6c 6f  ranch   WHERE lo
1a50: 64 20 49 4e 20 65 78 63 6c 75 64 65 64 73 79 6d  d IN excludedsym
1a60: 62 6f 6c 73 3b 0a 09 20 20 20 20 44 45 4c 45 54  bols;..    DELET
1a70: 45 20 46 52 4f 4d 20 62 72 61 6e 63 68 20 20 20  E FROM branch   
1a80: 57 48 45 52 45 20 73 69 64 20 49 4e 20 65 78 63  WHERE sid IN exc
1a90: 6c 75 64 65 64 73 79 6d 62 6f 6c 73 3b 0a 0a 09  ludedsymbols;...
1aa0: 20 20 20 20 44 52 4f 50 20 54 41 42 4c 45 20 65      DROP TABLE e
1ab0: 78 63 6c 75 64 65 64 73 79 6d 62 6f 6c 73 3b 0a  xcludedsymbols;.
1ac0: 09 7d 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 7d  .}..return.    }
1ad0: 0a 0a 20 20 20 20 70 72 6f 63 20 4d 75 74 61 74  ..    proc Mutat
1ae0: 65 53 79 6d 62 6f 6c 73 20 7b 7d 20 7b 0a 09 23  eSymbols {} {..#
1af0: 20 4e 65 78 74 2c 20 6e 6f 77 20 74 68 61 74 20   Next, now that 
1b00: 77 65 20 6b 6e 6f 77 20 77 68 69 63 68 20 73 79  we know which sy
1b10: 6d 62 6f 6c 73 20 61 72 65 20 77 68 61 74 20 77  mbols are what w
1b20: 65 20 6c 6f 6f 6b 20 66 6f 72 0a 09 23 20 66 69  e look for..# fi
1b30: 6c 65 20 6c 65 76 65 6c 20 74 61 67 73 20 77 68  le level tags wh
1b40: 69 63 68 20 61 72 65 20 61 63 74 75 61 6c 6c 79  ich are actually
1b50: 20 63 6f 6e 76 65 72 74 65 64 20 61 73 20 62 72   converted as br
1b60: 61 6e 63 68 65 73 0a 09 23 20 28 70 72 6f 6a 65  anches..# (proje
1b70: 63 74 20 6c 65 76 65 6c 2c 20 61 6e 64 20 76 69  ct level, and vi
1b80: 63 65 20 76 65 72 73 61 29 2c 20 61 6e 64 20 6d  ce versa), and m
1b90: 6f 76 65 20 74 68 65 6d 20 74 6f 20 74 68 65 0a  ove them to the.
1ba0: 09 23 20 63 6f 72 72 65 63 74 20 74 61 62 6c 65  .# correct table
1bb0: 73 2e 0a 0a 09 23 20 23 20 23 23 20 23 23 23 20  s....# # ## ### 
1bc0: 23 23 23 23 23 20 23 23 23 23 23 23 23 23 20 23  ##### ######## #
1bd0: 23 23 23 23 23 23 23 23 23 23 23 23 0a 0a 09 6c  ############...l
1be0: 6f 67 20 77 72 69 74 65 20 33 20 66 69 6c 74 65  og write 3 filte
1bf0: 72 73 79 6d 20 22 4d 75 74 61 74 65 20 73 79 6d  rsym "Mutate sym
1c00: 62 6f 6c 73 2c 20 70 72 65 70 61 72 61 74 69 6f  bols, preparatio
1c10: 6e 22 0a 0a 09 73 65 74 20 62 72 61 6e 63 68 20  n"...set branch 
1c20: 5b 70 72 6f 6a 65 63 74 3a 3a 73 79 6d 20 62 72  [project::sym br
1c30: 61 6e 63 68 5d 0a 09 73 65 74 20 74 61 67 20 20  anch]..set tag  
1c40: 20 20 5b 70 72 6f 6a 65 63 74 3a 3a 73 79 6d 20    [project::sym 
1c50: 74 61 67 5d 0a 0a 09 73 65 74 20 74 61 67 73 74  tag]...set tagst
1c60: 6f 6d 75 74 61 74 65 20 5b 73 74 61 74 65 20 72  omutate [state r
1c70: 75 6e 20 7b 0a 09 20 20 20 20 53 45 4c 45 43 54  un {..    SELECT
1c80: 20 54 2e 74 69 64 2c 20 54 2e 66 69 64 2c 20 54   T.tid, T.fid, T
1c90: 2e 6c 6f 64 2c 20 54 2e 73 69 64 2c 20 54 2e 72  .lod, T.sid, T.r
1ca0: 65 76 0a 09 20 20 20 20 46 52 4f 4d 20 74 61 67  ev..    FROM tag
1cb0: 20 54 2c 20 73 79 6d 62 6f 6c 20 53 0a 09 20 20   T, symbol S..  
1cc0: 20 20 57 48 45 52 45 20 54 2e 73 69 64 20 3d 20    WHERE T.sid = 
1cd0: 53 2e 73 69 64 0a 09 20 20 20 20 41 4e 44 20 53  S.sid..    AND S
1ce0: 2e 74 79 70 65 20 3d 20 24 62 72 61 6e 63 68 0a  .type = $branch.
1cf0: 09 7d 5d 0a 0a 09 73 65 74 20 62 72 61 6e 63 68  .}]...set branch
1d00: 65 73 74 6f 6d 75 74 61 74 65 20 5b 73 74 61 74  estomutate [stat
1d10: 65 20 72 75 6e 20 7b 0a 09 20 20 20 20 53 45 4c  e run {..    SEL
1d20: 45 43 54 20 42 2e 62 69 64 2c 20 42 2e 66 69 64  ECT B.bid, B.fid
1d30: 2c 20 42 2e 6c 6f 64 2c 20 42 2e 73 69 64 2c 20  , B.lod, B.sid, 
1d40: 42 2e 72 6f 6f 74 2c 20 42 2e 66 69 72 73 74 2c  B.root, B.first,
1d50: 20 42 2e 62 72 61 0a 09 20 20 20 20 46 52 4f 4d   B.bra..    FROM
1d60: 20 62 72 61 6e 63 68 20 42 2c 20 73 79 6d 62 6f   branch B, symbo
1d70: 6c 20 53 0a 09 20 20 20 20 57 48 45 52 45 20 42  l S..    WHERE B
1d80: 2e 73 69 64 20 3d 20 53 2e 73 69 64 0a 09 20 20  .sid = S.sid..  
1d90: 20 20 41 4e 44 20 53 2e 74 79 70 65 20 3d 20 24    AND S.type = $
1da0: 74 61 67 0a 09 7d 5d 0a 0a 09 6c 6f 67 20 77 72  tag..}]...log wr
1db0: 69 74 65 20 34 20 66 69 6c 74 65 72 73 79 6d 20  ite 4 filtersym 
1dc0: 22 43 68 61 6e 67 69 6e 67 20 5b 6e 73 70 20 5b  "Changing [nsp [
1dd0: 65 78 70 72 20 7b 5b 6c 6c 65 6e 67 74 68 20 24  expr {[llength $
1de0: 74 61 67 73 74 6f 6d 75 74 61 74 65 5d 2f 35 7d  tagstomutate]/5}
1df0: 5d 20 74 61 67 5d 20 69 6e 74 6f 20 62 72 61 6e  ] tag] into bran
1e00: 63 68 65 73 22 0a 09 6c 6f 67 20 77 72 69 74 65  ches"..log write
1e10: 20 34 20 66 69 6c 74 65 72 73 79 6d 20 22 43 68   4 filtersym "Ch
1e20: 61 6e 67 69 6e 67 20 5b 6e 73 70 20 5b 65 78 70  anging [nsp [exp
1e30: 72 20 7b 5b 6c 6c 65 6e 67 74 68 20 24 62 72 61  r {[llength $bra
1e40: 6e 63 68 65 73 74 6f 6d 75 74 61 74 65 5d 2f 37  nchestomutate]/7
1e50: 7d 5d 20 62 72 61 6e 63 68 20 62 72 61 6e 63 68  }] branch branch
1e60: 65 73 5d 20 69 6e 74 6f 20 74 61 67 73 22 0a 0a  es] into tags"..
1e70: 09 23 20 23 20 23 23 20 23 23 23 20 23 23 23 23  .# # ## ### ####
1e80: 23 20 23 23 23 23 23 23 23 23 20 23 23 23 23 23  # ######## #####
1e90: 23 23 23 23 23 23 23 23 0a 0a 09 6c 6f 67 20 77  ########...log w
1ea0: 72 69 74 65 20 33 20 66 69 6c 74 65 72 73 79 6d  rite 3 filtersym
1eb0: 20 22 4d 75 74 61 74 65 20 74 61 67 73 20 74 6f   "Mutate tags to
1ec0: 20 62 72 61 6e 63 68 65 73 22 0a 0a 09 66 6f 72   branches"...for
1ed0: 65 61 63 68 20 7b 69 64 20 66 69 64 20 6c 6f 64  each {id fid lod
1ee0: 20 73 69 64 20 72 65 76 7d 20 24 74 61 67 73 74   sid rev} $tagst
1ef0: 6f 6d 75 74 61 74 65 20 7b 0a 09 20 20 20 20 73  omutate {..    s
1f00: 74 61 74 65 20 72 75 6e 20 7b 0a 09 09 44 45 4c  tate run {...DEL
1f10: 45 54 45 20 46 52 4f 4d 20 74 61 67 20 57 48 45  ETE FROM tag WHE
1f20: 52 45 20 74 69 64 20 3d 20 24 69 64 20 3b 0a 09  RE tid = $id ;..
1f30: 09 49 4e 53 45 52 54 20 49 4e 54 4f 20 62 72 61  .INSERT INTO bra
1f40: 6e 63 68 20 28 62 69 64 2c 20 66 69 64 2c 20 20  nch (bid, fid,  
1f50: 6c 6f 64 2c 20 20 73 69 64 2c 20 20 72 6f 6f 74  lod,  sid,  root
1f60: 2c 20 66 69 72 73 74 2c 20 62 72 61 2c 20 70 6f  , first, bra, po
1f70: 73 29 0a 09 09 56 41 4c 55 45 53 20 20 20 20 20  s)...VALUES     
1f80: 20 20 20 20 20 20 20 20 28 24 69 64 2c 20 24 66          ($id, $f
1f90: 69 64 2c 20 24 6c 6f 64 2c 20 24 73 69 64 2c 20  id, $lod, $sid, 
1fa0: 24 72 65 76 2c 20 4e 55 4c 4c 2c 20 20 27 27 2c  $rev, NULL,  '',
1fb0: 20 20 2d 31 29 3b 0a 09 20 20 20 20 7d 0a 09 7d    -1);..    }..}
1fc0: 0a 0a 09 6c 6f 67 20 77 72 69 74 65 20 33 20 66  ...log write 3 f
1fd0: 69 6c 74 65 72 73 79 6d 20 22 4f 6b 2e 22 0a 0a  iltersym "Ok."..
1fe0: 09 23 20 23 20 23 23 20 23 23 23 20 23 23 23 23  .# # ## ### ####
1ff0: 23 20 23 23 23 23 23 23 23 23 20 23 23 23 23 23  # ######## #####
2000: 23 23 23 23 23 23 23 23 0a 0a 09 6c 6f 67 20 77  ########...log w
2010: 72 69 74 65 20 33 20 66 69 6c 74 65 72 73 79 6d  rite 3 filtersym
2020: 20 22 4d 75 74 61 74 65 20 62 72 61 6e 63 68 65   "Mutate branche
2030: 73 20 74 6f 20 74 61 67 73 22 0a 0a 09 66 6f 72  s to tags"...for
2040: 65 61 63 68 20 7b 69 64 20 66 69 64 20 6c 6f 64  each {id fid lod
2050: 20 73 69 64 20 72 6f 6f 74 20 66 69 72 73 74 20   sid root first 
2060: 62 72 61 7d 20 24 62 72 61 6e 63 68 65 73 74 6f  bra} $branchesto
2070: 6d 75 74 61 74 65 20 7b 0a 09 20 20 20 20 73 74  mutate {..    st
2080: 61 74 65 20 72 75 6e 20 7b 0a 09 09 44 45 4c 45  ate run {...DELE
2090: 54 45 20 46 52 4f 4d 20 62 72 61 6e 63 68 20 57  TE FROM branch W
20a0: 48 45 52 45 20 62 69 64 20 3d 20 24 69 64 20 3b  HERE bid = $id ;
20b0: 0a 09 09 49 4e 53 45 52 54 20 49 4e 54 4f 20 74  ...INSERT INTO t
20c0: 61 67 20 28 74 69 64 2c 20 66 69 64 2c 20 20 6c  ag (tid, fid,  l
20d0: 6f 64 2c 20 20 73 69 64 2c 20 20 72 65 76 29 0a  od,  sid,  rev).
20e0: 09 09 56 41 4c 55 45 53 20 20 20 20 20 20 20 20  ..VALUES        
20f0: 20 20 28 24 69 64 2c 20 24 66 69 64 2c 20 24 6c    ($id, $fid, $l
2100: 6f 64 2c 20 24 73 69 64 2c 20 24 72 6f 6f 74 29  od, $sid, $root)
2110: 3b 0a 09 20 20 20 20 7d 0a 09 7d 0a 0a 09 6c 6f  ;..    }..}...lo
2120: 67 20 77 72 69 74 65 20 33 20 66 69 6c 74 65 72  g write 3 filter
2130: 73 79 6d 20 22 4f 6b 2e 22 0a 0a 09 23 20 23 20  sym "Ok."...# # 
2140: 23 23 20 23 23 23 20 23 23 23 23 23 20 23 23 23  ## ### ##### ###
2150: 23 23 23 23 23 20 23 23 23 23 23 23 23 23 23 23  ##### ##########
2160: 23 23 23 0a 09 72 65 74 75 72 6e 0a 20 20 20 20  ###..return.    
2170: 7d 0a 0a 20 20 20 20 23 20 41 64 6a 75 73 74 20  }..    # Adjust 
2180: 74 68 65 20 70 61 72 65 6e 74 73 20 6f 66 20 73  the parents of s
2190: 79 6d 62 6f 6c 73 20 74 6f 20 74 68 65 69 72 20  ymbols to their 
21a0: 70 72 65 66 65 72 72 65 64 20 70 61 72 65 6e 74  preferred parent
21b0: 73 2e 0a 0a 20 20 20 20 23 20 49 66 20 61 20 66  s...    # If a f
21c0: 69 6c 65 20 6c 65 76 65 6c 20 79 6d 62 6f 6c 20  ile level ymbol 
21d0: 68 61 73 20 61 20 70 72 65 66 65 72 72 65 64 20  has a preferred 
21e0: 70 61 72 65 6e 74 20 74 68 61 74 20 69 73 20 64  parent that is d
21f0: 69 66 66 65 72 65 6e 74 0a 20 20 20 20 23 20 74  ifferent.    # t
2200: 68 61 6e 20 69 74 73 20 63 75 72 72 65 6e 74 20  han its current 
2210: 70 61 72 65 6e 74 2c 20 61 6e 64 20 69 66 20 74  parent, and if t
2220: 68 65 20 70 72 65 66 65 72 72 65 64 20 70 61 72  he preferred par
2230: 65 6e 74 20 69 73 20 61 6e 0a 20 20 20 20 23 20  ent is an.    # 
2240: 61 6c 6c 6f 77 65 64 20 70 61 72 65 6e 74 20 6f  allowed parent o
2250: 66 20 74 68 65 20 73 79 6d 62 6f 6c 20 69 6e 20  f the symbol in 
2260: 74 68 69 73 20 66 69 6c 65 2c 20 74 68 65 6e 20  this file, then 
2270: 77 65 20 67 72 61 66 74 20 74 68 65 0a 20 20 20  we graft the.   
2280: 20 23 20 61 53 79 6d 62 6f 6c 20 6f 6e 74 6f 20   # aSymbol onto 
2290: 69 74 73 20 70 72 65 66 65 72 72 65 64 20 70 61  its preferred pa
22a0: 72 65 6e 74 2e 0a 0a 20 20 20 20 70 72 6f 63 20  rent...    proc 
22b0: 41 64 6a 75 73 74 50 61 72 65 6e 74 73 20 7b 7d  AdjustParents {}
22c0: 20 7b 0a 09 6c 6f 67 20 77 72 69 74 65 20 33 20   {..log write 3 
22d0: 66 69 6c 74 65 72 73 79 6d 20 22 41 64 6a 75 73  filtersym "Adjus
22e0: 74 20 70 61 72 65 6e 74 73 2c 20 6c 6f 61 64 69  t parents, loadi
22f0: 6e 67 20 64 61 74 61 20 69 6e 20 70 72 65 70 61  ng data in prepa
2300: 72 61 74 69 6f 6e 22 0a 0a 09 23 20 57 65 20 70  ration"...# We p
2310: 75 6c 6c 20 69 6d 70 6f 72 74 61 6e 74 20 6d 61  ull important ma
2320: 70 73 20 6f 6e 63 65 20 69 6e 74 6f 20 6d 65 6d  ps once into mem
2330: 6f 72 79 20 73 6f 20 74 68 61 74 20 77 65 20 64  ory so that we d
2340: 6f 20 71 75 69 63 6b 0a 09 23 20 68 61 73 68 20  o quick..# hash 
2350: 6c 6f 6f 6b 75 70 20 6c 61 74 65 72 20 77 68 65  lookup later whe
2360: 6e 20 70 72 6f 63 65 73 73 69 6e 67 20 74 68 65  n processing the
2370: 20 67 72 61 66 74 20 63 61 6e 64 69 64 61 74 65   graft candidate
2380: 73 2e 0a 0a 09 23 20 54 61 67 2f 42 72 61 6e 63  s....# Tag/Branc
2390: 68 20 6e 61 6d 65 73 20 2e 2e 2e 0a 09 61 72 72  h names .....arr
23a0: 61 79 20 73 65 74 20 73 6e 20 5b 73 74 61 74 65  ay set sn [state
23b0: 20 72 75 6e 20 7b 20 53 45 4c 45 43 54 20 54 2e   run { SELECT T.
23c0: 74 69 64 2c 20 53 2e 6e 61 6d 65 20 46 52 4f 4d  tid, S.name FROM
23d0: 20 74 61 67 20 54 2c 20 20 20 20 73 79 6d 62 6f   tag T,    symbo
23e0: 6c 20 53 20 57 48 45 52 45 20 54 2e 73 69 64 20  l S WHERE T.sid 
23f0: 3d 20 53 2e 73 69 64 20 7d 5d 0a 09 61 72 72 61  = S.sid }]..arra
2400: 79 20 73 65 74 20 73 6e 20 5b 73 74 61 74 65 20  y set sn [state 
2410: 72 75 6e 20 7b 20 53 45 4c 45 43 54 20 42 2e 62  run { SELECT B.b
2420: 69 64 2c 20 53 2e 6e 61 6d 65 20 46 52 4f 4d 20  id, S.name FROM 
2430: 62 72 61 6e 63 68 20 42 2c 20 73 79 6d 62 6f 6c  branch B, symbol
2440: 20 53 20 57 48 45 52 45 20 42 2e 73 69 64 20 3d   S WHERE B.sid =
2450: 20 53 2e 73 69 64 20 7d 5d 0a 09 23 20 53 79 6d   S.sid }]..# Sym
2460: 62 6f 6c 20 6e 61 6d 65 73 20 2e 2e 2e 0a 09 61  bol names .....a
2470: 72 72 61 79 20 73 65 74 20 73 78 20 5b 73 74 61  rray set sx [sta
2480: 74 65 20 72 75 6e 20 7b 20 53 45 4c 45 43 54 20  te run { SELECT 
2490: 4c 2e 73 69 64 2c 20 4c 2e 6e 61 6d 65 20 46 52  L.sid, L.name FR
24a0: 4f 4d 20 73 79 6d 62 6f 6c 20 4c 20 7d 5d 0a 09  OM symbol L }]..
24b0: 23 20 46 69 6c 65 73 20 61 6e 64 20 70 72 6f 6a  # Files and proj
24c0: 65 63 74 73 2e 0a 09 61 72 72 61 79 20 73 65 74  ects...array set
24d0: 20 66 70 6e 20 7b 7d 0a 09 66 6f 72 65 61 63 68   fpn {}..foreach
24e0: 20 7b 69 64 20 66 6e 20 70 6e 7d 20 5b 73 74 61   {id fn pn} [sta
24f0: 74 65 20 72 75 6e 20 7b 0a 09 09 53 45 4c 45 43  te run {...SELEC
2500: 54 20 46 2e 66 69 64 2c 20 46 2e 6e 61 6d 65 2c  T F.fid, F.name,
2510: 20 50 2e 6e 61 6d 65 0a 09 09 46 52 4f 4d 20 20   P.name...FROM  
2520: 20 66 69 6c 65 20 46 2c 20 70 72 6f 6a 65 63 74   file F, project
2530: 20 50 0a 09 09 57 48 45 52 45 20 20 46 2e 70 69   P...WHERE  F.pi
2540: 64 20 3d 20 50 2e 70 69 64 0a 09 7d 5d 20 7b 20  d = P.pid..}] { 
2550: 73 65 74 20 66 70 6e 28 24 69 64 29 20 5b 6c 69  set fpn($id) [li
2560: 73 74 20 24 66 6e 20 24 70 6e 5d 20 7d 0a 0a 09  st $fn $pn] }...
2570: 73 65 74 20 74 61 67 73 74 6f 61 64 6a 75 73 74  set tagstoadjust
2580: 20 5b 73 74 61 74 65 20 72 75 6e 20 7b 0a 09 20   [state run {.. 
2590: 20 20 20 53 45 4c 45 43 54 20 54 2e 74 69 64 2c     SELECT T.tid,
25a0: 20 54 2e 66 69 64 2c 20 54 2e 6c 6f 64 2c 20 50   T.fid, T.lod, P
25b0: 2e 70 69 64 2c 20 53 2e 6e 61 6d 65 2c 20 52 2e  .pid, S.name, R.
25c0: 72 65 76 2c 20 52 2e 72 69 64 0a 09 20 20 20 20  rev, R.rid..    
25d0: 46 52 4f 4d 20 74 61 67 20 54 2c 20 70 72 65 66  FROM tag T, pref
25e0: 65 72 65 64 70 61 72 65 6e 74 20 50 2c 20 73 79  eredparent P, sy
25f0: 6d 62 6f 6c 20 53 2c 20 72 65 76 69 73 69 6f 6e  mbol S, revision
2600: 20 52 0a 09 20 20 20 20 57 48 45 52 45 20 54 2e   R..    WHERE T.
2610: 73 69 64 20 3d 20 50 2e 73 69 64 0a 09 20 20 20  sid = P.sid..   
2620: 20 41 4e 44 20 20 20 54 2e 6c 6f 64 20 21 3d 20   AND   T.lod != 
2630: 50 2e 70 69 64 0a 09 20 20 20 20 41 4e 44 20 20  P.pid..    AND  
2640: 20 50 2e 70 69 64 20 3d 20 53 2e 73 69 64 0a 09   P.pid = S.sid..
2650: 20 20 20 20 41 4e 44 20 20 20 53 2e 6e 61 6d 65      AND   S.name
2660: 20 21 3d 20 27 3a 74 72 75 6e 6b 3a 27 0a 09 20   != ':trunk:'.. 
2670: 20 20 20 41 4e 44 20 20 20 54 2e 72 65 76 20 3d     AND   T.rev =
2680: 20 52 2e 72 69 64 09 0a 09 7d 5d 0a 0a 09 73 65   R.rid...}]...se
2690: 74 20 62 72 61 6e 63 68 65 73 74 6f 61 64 6a 75  t branchestoadju
26a0: 73 74 20 5b 73 74 61 74 65 20 72 75 6e 20 7b 0a  st [state run {.
26b0: 09 20 20 20 20 53 45 4c 45 43 54 20 42 2e 62 69  .    SELECT B.bi
26c0: 64 2c 20 42 2e 66 69 64 2c 20 42 2e 6c 6f 64 2c  d, B.fid, B.lod,
26d0: 20 42 2e 70 6f 73 2c 20 50 2e 70 69 64 2c 20 53   B.pos, P.pid, S
26e0: 2e 6e 61 6d 65 2c 20 52 2e 72 65 76 2c 20 52 2e  .name, R.rev, R.
26f0: 72 69 64 0a 09 20 20 20 20 46 52 4f 4d 20 62 72  rid..    FROM br
2700: 61 6e 63 68 20 42 2c 20 70 72 65 66 65 72 65 64  anch B, prefered
2710: 70 61 72 65 6e 74 20 50 2c 20 73 79 6d 62 6f 6c  parent P, symbol
2720: 20 53 2c 20 72 65 76 69 73 69 6f 6e 20 52 0a 09   S, revision R..
2730: 20 20 20 20 57 48 45 52 45 20 42 2e 73 69 64 20      WHERE B.sid 
2740: 3d 20 50 2e 73 69 64 0a 09 20 20 20 20 41 4e 44  = P.sid..    AND
2750: 20 20 20 42 2e 6c 6f 64 20 21 3d 20 50 2e 70 69     B.lod != P.pi
2760: 64 0a 09 20 20 20 20 41 4e 44 20 20 20 50 2e 70  d..    AND   P.p
2770: 69 64 20 3d 20 53 2e 73 69 64 0a 09 20 20 20 20  id = S.sid..    
2780: 41 4e 44 20 20 20 53 2e 6e 61 6d 65 20 21 3d 20  AND   S.name != 
2790: 27 3a 74 72 75 6e 6b 3a 27 0a 09 20 20 20 20 41  ':trunk:'..    A
27a0: 4e 44 20 20 20 42 2e 72 6f 6f 74 20 3d 20 52 2e  ND   B.root = R.
27b0: 72 69 64 09 0a 09 7d 5d 0a 0a 09 73 65 74 20 74  rid...}]...set t
27c0: 6d 61 78 20 5b 65 78 70 72 20 7b 5b 6c 6c 65 6e  max [expr {[llen
27d0: 67 74 68 20 24 74 61 67 73 74 6f 61 64 6a 75 73  gth $tagstoadjus
27e0: 74 5d 20 2f 20 37 7d 5d 0a 09 73 65 74 20 62 6d  t] / 7}]..set bm
27f0: 61 78 20 5b 65 78 70 72 20 7b 5b 6c 6c 65 6e 67  ax [expr {[lleng
2800: 74 68 20 24 62 72 61 6e 63 68 65 73 74 6f 61 64  th $branchestoad
2810: 6a 75 73 74 5d 20 2f 20 38 7d 5d 0a 0a 09 6c 6f  just] / 8}]...lo
2820: 67 20 77 72 69 74 65 20 34 20 66 69 6c 74 65 72  g write 4 filter
2830: 73 79 6d 20 22 52 65 70 61 72 65 6e 74 69 6e 67  sym "Reparenting
2840: 20 61 74 20 6d 6f 73 74 20 5b 6e 73 70 20 24 74   at most [nsp $t
2850: 6d 61 78 20 74 61 67 5d 22 0a 09 6c 6f 67 20 77  max tag]"..log w
2860: 72 69 74 65 20 34 20 66 69 6c 74 65 72 73 79 6d  rite 4 filtersym
2870: 20 22 52 65 70 61 72 65 6e 74 69 6e 67 20 61 74   "Reparenting at
2880: 20 6d 6f 73 74 20 5b 6e 73 70 20 24 62 6d 61 78   most [nsp $bmax
2890: 20 62 72 61 6e 63 68 20 62 72 61 6e 63 68 65 73   branch branches
28a0: 5d 22 0a 0a 09 6c 6f 67 20 77 72 69 74 65 20 33  ]"...log write 3
28b0: 20 66 69 6c 74 65 72 73 79 6d 20 22 41 64 6a 75   filtersym "Adju
28c0: 73 74 20 74 61 67 20 70 61 72 65 6e 74 73 22 0a  st tag parents".
28d0: 0a 09 23 20 46 69 6e 64 20 74 68 65 20 74 61 67  ..# Find the tag
28e0: 73 20 77 68 6f 73 65 20 63 75 72 72 65 6e 74 20  s whose current 
28f0: 70 61 72 65 6e 74 20 28 6c 6f 64 29 20 69 73 20  parent (lod) is 
2900: 6e 6f 74 20 74 68 65 20 70 72 65 66 65 72 65 64  not the prefered
2910: 0a 09 23 20 70 61 72 65 6e 74 2c 20 74 68 65 20  ..# parent, the 
2920: 70 72 65 66 65 72 65 64 20 70 61 72 65 6e 74 20  prefered parent 
2930: 69 73 20 6e 6f 74 20 74 68 65 20 74 72 75 6e 6b  is not the trunk
2940: 2c 20 61 6e 64 20 74 68 65 0a 09 23 20 70 72 65  , and the..# pre
2950: 66 65 72 65 64 20 70 61 72 65 6e 74 20 69 73 20  fered parent is 
2960: 61 20 70 6f 73 73 69 62 6c 65 20 70 61 72 65 6e  a possible paren
2970: 74 20 70 65 72 20 74 68 65 20 74 61 67 27 73 20  t per the tag's 
2980: 72 65 76 69 73 69 6f 6e 2e 0a 0a 09 73 65 74 20  revision....set 
2990: 66 6d 74 20 25 5b 73 74 72 69 6e 67 20 6c 65 6e  fmt %[string len
29a0: 67 74 68 20 24 74 6d 61 78 5d 73 0a 09 73 65 74  gth $tmax]s..set
29b0: 20 6d 78 73 20 5b 66 6f 72 6d 61 74 20 24 66 6d   mxs [format $fm
29c0: 74 20 24 74 6d 61 78 5d 0a 0a 09 73 65 74 20 6e  t $tmax]...set n
29d0: 20 30 0a 09 66 6f 72 65 61 63 68 20 7b 69 64 20   0..foreach {id 
29e0: 66 69 64 20 6c 6f 64 20 70 69 64 20 70 72 65 66  fid lod pid pref
29f0: 65 72 65 64 6e 61 6d 65 20 72 65 76 6e 72 20 72  eredname revnr r
2a00: 69 64 7d 20 24 74 61 67 73 74 6f 61 64 6a 75 73  id} $tagstoadjus
2a10: 74 20 7b 0a 0a 09 20 20 20 20 23 20 42 4f 54 54  t {...    # BOTT
2a20: 4c 45 2d 4e 45 43 4b 20 2e 2e 2e 0a 09 20 20 20  LE-NECK .....   
2a30: 20 23 0a 09 20 20 20 20 23 20 54 68 65 20 63 68   #..    # The ch
2a40: 65 63 6b 20 69 66 20 74 68 65 20 63 61 6e 64 69  eck if the candi
2a50: 64 61 74 65 20 28 70 69 64 29 20 69 73 20 74 72  date (pid) is tr
2a60: 75 6c 79 20 76 69 61 62 6c 65 20 69 73 0a 09 20  uly viable is.. 
2a70: 20 20 20 23 20 62 61 73 65 64 20 66 69 6e 64 69     # based findi
2a80: 6e 67 20 74 68 65 20 62 72 61 6e 63 68 20 61 73  ng the branch as
2a90: 20 70 6f 73 73 69 62 6c 65 20 70 61 72 65 6e 74   possible parent
2aa0: 2c 20 61 6e 64 20 64 6f 6e 65 0a 09 20 20 20 20  , and done..    
2ab0: 23 20 6e 6f 77 20 69 6e 73 74 65 61 64 20 6f 66  # now instead of
2ac0: 20 61 73 20 70 61 72 74 20 6f 66 20 74 68 65 20   as part of the 
2ad0: 61 6c 72 65 61 64 79 20 63 6f 6d 70 6c 65 78 20  already complex 
2ae0: 6a 6f 69 6e 2e 0a 09 20 20 20 20 23 0a 09 20 20  join...    #..  
2af0: 20 20 23 20 2e 2e 2e 20 41 4e 44 20 50 2e 70 69    # ... AND P.pi
2b00: 64 20 49 4e 20 28 53 45 4c 45 43 54 20 42 2e 73  d IN (SELECT B.s
2b10: 69 64 0a 09 20 20 20 20 23 20 20 20 20 20 20 20  id..    #       
2b20: 20 20 20 20 20 20 20 20 20 20 20 20 46 52 4f 4d              FROM
2b30: 20 62 72 61 6e 63 68 20 42 0a 09 20 20 20 20 23   branch B..    #
2b40: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
2b50: 20 20 20 57 48 45 52 45 20 42 2e 72 6f 6f 74 20     WHERE B.root 
2b60: 3d 20 52 2e 72 69 64 29 0a 0a 09 20 20 20 20 69  = R.rid)...    i
2b70: 66 20 7b 21 5b 6c 69 6e 64 65 78 20 5b 73 74 61  f {![lindex [sta
2b80: 74 65 20 72 75 6e 20 7b 0a 09 09 53 45 4c 45 43  te run {...SELEC
2b90: 54 20 43 4f 55 4e 54 28 2a 29 0a 09 09 46 52 4f  T COUNT(*)...FRO
2ba0: 4d 20 62 72 61 6e 63 68 20 42 0a 09 09 57 48 45  M branch B...WHE
2bb0: 52 45 20 20 42 2e 73 69 64 20 20 3d 20 24 70 69  RE  B.sid  = $pi
2bc0: 64 0a 09 09 41 4e 44 20 20 20 20 42 2e 72 6f 6f  d...AND    B.roo
2bd0: 74 20 3d 20 24 72 69 64 0a 09 20 20 20 20 7d 5d  t = $rid..    }]
2be0: 20 30 5d 7d 20 7b 0a 09 09 69 6e 63 72 20 74 6d   0]} {...incr tm
2bf0: 61 78 20 2d 31 0a 09 09 73 65 74 20 20 6d 78 73  ax -1...set  mxs
2c00: 20 5b 66 6f 72 6d 61 74 20 24 66 6d 74 20 24 74   [format $fmt $t
2c10: 6d 61 78 5d 0a 09 09 63 6f 6e 74 69 6e 75 65 0a  max]...continue.
2c20: 09 20 20 20 20 7d 0a 0a 09 20 20 20 20 23 0a 09  .    }...    #..
2c30: 20 20 20 20 23 20 42 4f 54 54 4c 45 2d 4e 45 43      # BOTTLE-NEC
2c40: 4b 20 2e 2e 2e 0a 0a 09 20 20 20 20 23 20 54 68  K ......    # Th
2c50: 65 20 6e 61 6d 65 73 20 66 6f 72 20 75 73 65 20  e names for use 
2c60: 69 6e 20 74 68 65 20 6c 6f 67 20 6f 75 74 70 75  in the log outpu
2c70: 74 20 61 72 65 20 72 65 74 72 69 65 76 65 64 0a  t are retrieved.
2c80: 09 20 20 20 20 23 20 73 65 70 61 72 61 74 65 6c  .    # separatel
2c90: 79 2c 20 74 6f 20 6b 65 65 70 20 74 68 65 20 6a  y, to keep the j
2ca0: 6f 69 6e 20 73 65 6c 65 63 74 69 6e 67 20 74 68  oin selecting th
2cb0: 65 20 61 64 6a 75 73 74 61 62 6c 65 0a 09 20 20  e adjustable..  
2cc0: 20 20 23 20 74 61 67 73 20 73 6d 61 6c 6c 2c 20    # tags small, 
2cd0: 6e 6f 74 20 62 75 72 64 65 6e 65 64 20 77 69 74  not burdened wit
2ce0: 68 20 74 68 65 20 64 65 72 65 66 65 72 65 6e 63  h the dereferenc
2cf0: 69 6e 67 20 6f 66 20 6c 69 6e 6b 73 0a 09 20 20  ing of links..  
2d00: 20 20 23 20 74 6f 20 6e 61 6d 65 2e 0a 0a 09 20    # to name.... 
2d10: 20 20 20 73 65 74 20 74 61 67 6e 61 6d 65 20 24     set tagname $
2d20: 73 6e 28 24 69 64 29 0a 09 20 20 20 20 73 65 74  sn($id)..    set
2d30: 20 6f 6c 64 6e 61 6d 65 20 24 73 78 28 24 6c 6f   oldname $sx($lo
2d40: 64 29 0a 09 20 20 20 20 73 74 72 75 63 74 3a 3a  d)..    struct::
2d50: 6c 69 73 74 20 61 73 73 69 67 6e 20 24 66 70 6e  list assign $fpn
2d60: 28 24 66 69 64 29 20 66 6e 61 6d 65 20 70 72 6e  ($fid) fname prn
2d70: 61 6d 65 0a 0a 09 20 20 20 20 23 20 44 6f 20 74  ame...    # Do t
2d80: 68 65 20 67 72 61 66 74 69 6e 67 2e 0a 0a 09 20  he grafting.... 
2d90: 20 20 20 6c 6f 67 20 77 72 69 74 65 20 34 20 66     log write 4 f
2da0: 69 6c 74 65 72 73 79 6d 20 22 5c 5b 5b 66 6f 72  iltersym "\[[for
2db0: 6d 61 74 20 24 66 6d 74 20 24 6e 5d 2f 24 6d 78  mat $fmt $n]/$mx
2dc0: 73 5c 5d 20 24 70 72 6e 61 6d 65 20 3a 20 47 72  s\] $prname : Gr
2dd0: 61 66 74 69 6e 67 20 74 61 67 20 27 24 74 61 67  afting tag '$tag
2de0: 6e 61 6d 65 27 20 6f 6e 20 24 66 6e 61 6d 65 2f  name' on $fname/
2df0: 24 72 65 76 6e 72 20 66 72 6f 6d 20 27 24 6f 6c  $revnr from '$ol
2e00: 64 6e 61 6d 65 27 20 6f 6e 74 6f 20 27 24 70 72  dname' onto '$pr
2e10: 65 66 65 72 65 64 6e 61 6d 65 27 22 0a 09 20 20  eferedname'"..  
2e20: 20 20 73 74 61 74 65 20 72 75 6e 20 7b 20 55 50    state run { UP
2e30: 44 41 54 45 20 74 61 67 20 53 45 54 20 6c 6f 64  DATE tag SET lod
2e40: 20 3d 20 24 70 69 64 20 57 48 45 52 45 20 74 69   = $pid WHERE ti
2e50: 64 20 3d 20 24 69 64 20 3b 20 7d 0a 09 20 20 20  d = $id ; }..   
2e60: 20 69 6e 63 72 20 6e 0a 09 7d 0a 0a 09 6c 6f 67   incr n..}...log
2e70: 20 77 72 69 74 65 20 33 20 66 69 6c 74 65 72 73   write 3 filters
2e80: 79 6d 20 22 52 65 70 61 72 65 6e 74 65 64 20 5b  ym "Reparented [
2e90: 6e 73 70 20 24 6e 20 74 61 67 5d 22 0a 0a 09 6c  nsp $n tag]"...l
2ea0: 6f 67 20 77 72 69 74 65 20 33 20 66 69 6c 74 65  og write 3 filte
2eb0: 72 73 79 6d 20 22 41 64 6a 75 73 74 20 62 72 61  rsym "Adjust bra
2ec0: 6e 63 68 20 70 61 72 65 6e 74 73 22 0a 0a 09 23  nch parents"...#
2ed0: 20 46 69 6e 64 20 74 68 65 20 62 72 61 6e 63 68   Find the branch
2ee0: 65 73 20 77 68 6f 73 65 20 63 75 72 72 65 6e 74  es whose current
2ef0: 20 70 61 72 65 6e 74 20 28 6c 6f 64 29 20 69 73   parent (lod) is
2f00: 20 6e 6f 74 20 74 68 65 0a 09 23 20 70 72 65 66   not the..# pref
2f10: 65 72 65 64 20 70 61 72 65 6e 74 2c 20 74 68 65  ered parent, the
2f20: 20 70 72 65 66 65 72 65 64 20 70 61 72 65 6e 74   prefered parent
2f30: 20 69 73 20 6e 6f 74 20 74 68 65 20 74 72 75 6e   is not the trun
2f40: 6b 2c 20 61 6e 64 0a 09 23 20 74 68 65 20 70 72  k, and..# the pr
2f50: 65 66 65 72 65 64 20 70 61 72 65 6e 74 20 69 73  efered parent is
2f60: 20 61 20 70 6f 73 73 69 62 6c 65 20 70 61 72 65   a possible pare
2f70: 6e 74 20 70 65 72 20 74 68 65 20 62 72 61 6e 63  nt per the branc
2f80: 68 27 73 0a 09 23 20 72 65 76 69 73 69 6f 6e 2e  h's..# revision.
2f90: 0a 0a 09 73 65 74 20 66 6d 74 20 25 5b 73 74 72  ...set fmt %[str
2fa0: 69 6e 67 20 6c 65 6e 67 74 68 20 24 62 6d 61 78  ing length $bmax
2fb0: 5d 73 0a 09 73 65 74 20 6d 78 73 20 5b 66 6f 72  ]s..set mxs [for
2fc0: 6d 61 74 20 24 66 6d 74 20 24 62 6d 61 78 5d 0a  mat $fmt $bmax].
2fd0: 0a 09 73 65 74 20 6e 20 30 0a 09 66 6f 72 65 61  ..set n 0..forea
2fe0: 63 68 20 7b 69 64 20 66 69 64 20 6c 6f 64 20 70  ch {id fid lod p
2ff0: 6f 73 20 70 69 64 20 70 72 65 66 65 72 65 64 6e  os pid preferedn
3000: 61 6d 65 20 72 65 76 6e 72 20 72 69 64 7d 20 24  ame revnr rid} $
3010: 62 72 61 6e 63 68 65 73 74 6f 61 64 6a 75 73 74  branchestoadjust
3020: 20 7b 0a 0a 09 20 20 20 20 23 20 42 4f 54 54 4c   {...    # BOTTL
3030: 45 2d 4e 45 43 4b 20 2e 2e 2e 0a 09 20 20 20 20  E-NECK .....    
3040: 23 0a 09 20 20 20 20 23 20 54 68 65 20 63 68 65  #..    # The che
3050: 63 6b 20 69 66 20 74 68 65 20 63 61 6e 64 69 64  ck if the candid
3060: 61 74 65 20 28 70 69 64 29 20 69 73 20 74 72 75  ate (pid) is tru
3070: 6c 79 20 76 69 61 62 6c 65 20 69 73 0a 09 20 20  ly viable is..  
3080: 20 20 23 20 62 61 73 65 64 20 6f 6e 20 74 68 65    # based on the
3090: 20 62 72 61 6e 63 68 20 70 6f 73 69 74 69 6f 6e   branch position
30a0: 73 20 69 6e 20 74 68 65 20 73 70 61 77 6e 69 6e  s in the spawnin
30b0: 67 20 72 65 76 69 73 69 6f 6e 2c 0a 09 20 20 20  g revision,..   
30c0: 20 23 20 61 6e 64 20 64 6f 6e 65 20 6e 6f 77 20   # and done now 
30d0: 69 6e 73 74 65 61 64 20 6f 66 20 61 73 20 70 61  instead of as pa
30e0: 72 74 20 6f 66 20 74 68 65 20 61 6c 72 65 61 64  rt of the alread
30f0: 79 20 63 6f 6d 70 6c 65 78 0a 09 20 20 20 20 23  y complex..    #
3100: 20 6a 6f 69 6e 2e 0a 09 20 20 20 20 23 0a 09 20   join...    #.. 
3110: 20 20 20 23 20 2e 2e 2e 20 41 4e 44 20 50 2e 70     # ... AND P.p
3120: 69 64 20 49 4e 20 28 53 45 4c 45 43 54 20 42 58  id IN (SELECT BX
3130: 2e 73 69 64 0a 09 20 20 20 20 23 20 20 20 20 20  .sid..    #     
3140: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 46 52                FR
3150: 4f 4d 20 62 72 61 6e 63 68 20 42 58 0a 09 20 20  OM branch BX..  
3160: 20 20 23 20 20 20 20 20 20 20 20 20 20 20 20 20    #             
3170: 20 20 20 20 20 20 57 48 45 52 45 20 42 58 2e 72        WHERE BX.r
3180: 6f 6f 74 20 3d 20 52 2e 72 69 64 0a 09 20 20 20  oot = R.rid..   
3190: 20 23 20 20 20 20 20 20 20 20 20 20 20 20 20 20   #              
31a0: 20 20 20 20 20 41 4e 44 20 20 20 42 58 2e 70 6f       AND   BX.po
31b0: 73 20 3e 20 42 2e 70 6f 73 29 0a 0a 09 20 20 20  s > B.pos)...   
31c0: 20 69 66 20 7b 21 5b 6c 69 6e 64 65 78 20 5b 73   if {![lindex [s
31d0: 74 61 74 65 20 72 75 6e 20 7b 0a 09 09 53 45 4c  tate run {...SEL
31e0: 45 43 54 20 43 4f 55 4e 54 28 2a 29 0a 09 09 46  ECT COUNT(*)...F
31f0: 52 4f 4d 20 62 72 61 6e 63 68 20 42 0a 09 09 57  ROM branch B...W
3200: 48 45 52 45 20 20 42 2e 73 69 64 20 20 3d 20 24  HERE  B.sid  = $
3210: 70 69 64 0a 09 09 41 4e 44 20 20 20 20 42 2e 72  pid...AND    B.r
3220: 6f 6f 74 20 3d 20 24 72 69 64 0a 09 09 41 4e 44  oot = $rid...AND
3230: 20 20 20 20 42 2e 70 6f 73 20 20 3e 20 24 70 6f      B.pos  > $po
3240: 73 0a 09 20 20 20 20 7d 5d 20 30 5d 7d 20 7b 0a  s..    }] 0]} {.
3250: 09 09 69 6e 63 72 20 62 6d 61 78 20 2d 31 0a 09  ..incr bmax -1..
3260: 09 73 65 74 20 20 6d 78 73 20 5b 66 6f 72 6d 61  .set  mxs [forma
3270: 74 20 24 66 6d 74 20 24 62 6d 61 78 5d 0a 09 09  t $fmt $bmax]...
3280: 63 6f 6e 74 69 6e 75 65 0a 09 20 20 20 20 7d 0a  continue..    }.
3290: 0a 09 20 20 20 20 23 0a 09 20 20 20 20 23 20 42  ..    #..    # B
32a0: 4f 54 54 4c 45 2d 4e 45 43 4b 20 2e 2e 2e 0a 0a  OTTLE-NECK .....
32b0: 09 20 20 20 20 23 20 54 68 65 20 6e 61 6d 65 73  .    # The names
32c0: 20 66 6f 72 20 75 73 65 20 69 6e 20 74 68 65 20   for use in the 
32d0: 6c 6f 67 20 6f 75 74 70 75 74 20 61 72 65 20 72  log output are r
32e0: 65 74 72 69 65 76 65 64 0a 09 20 20 20 20 23 20  etrieved..    # 
32f0: 73 65 70 61 72 61 74 65 6c 79 2c 20 74 6f 20 6b  separately, to k
3300: 65 65 70 20 74 68 65 20 6a 6f 69 6e 20 73 65 6c  eep the join sel
3310: 65 63 74 69 6e 67 20 74 68 65 20 61 64 6a 75 73  ecting the adjus
3320: 74 61 62 6c 65 0a 09 20 20 20 20 23 20 74 61 67  table..    # tag
3330: 73 20 73 6d 61 6c 6c 2c 20 6e 6f 74 20 62 75 72  s small, not bur
3340: 64 65 6e 65 64 20 77 69 74 68 20 74 68 65 20 64  dened with the d
3350: 65 72 65 66 65 72 65 6e 63 69 6e 67 20 6f 66 20  ereferencing of 
3360: 6c 69 6e 6b 73 0a 09 20 20 20 20 23 20 74 6f 20  links..    # to 
3370: 6e 61 6d 65 2e 0a 0a 09 20 20 20 20 73 65 74 20  name....    set 
3380: 62 72 61 6e 61 6d 65 20 24 73 6e 28 24 69 64 29  braname $sn($id)
3390: 0a 09 20 20 20 20 73 65 74 20 6f 6c 64 6e 61 6d  ..    set oldnam
33a0: 65 20 24 73 78 28 24 6c 6f 64 29 0a 09 20 20 20  e $sx($lod)..   
33b0: 20 73 74 72 75 63 74 3a 3a 6c 69 73 74 20 61 73   struct::list as
33c0: 73 69 67 6e 20 24 66 70 6e 28 24 66 69 64 29 20  sign $fpn($fid) 
33d0: 66 6e 61 6d 65 20 70 72 6e 61 6d 65 0a 0a 09 20  fname prname... 
33e0: 20 20 20 23 20 44 6f 20 74 68 65 20 67 72 61 66     # Do the graf
33f0: 74 69 6e 67 2e 0a 0a 09 20 20 20 20 6c 6f 67 20  ting....    log 
3400: 77 72 69 74 65 20 34 20 66 69 6c 74 65 72 73 79  write 4 filtersy
3410: 6d 20 22 5c 5b 5b 66 6f 72 6d 61 74 20 24 66 6d  m "\[[format $fm
3420: 74 20 24 6e 5d 2f 24 6d 78 73 5c 5d 20 24 70 72  t $n]/$mxs\] $pr
3430: 6e 61 6d 65 20 3a 20 47 72 61 66 74 69 6e 67 20  name : Grafting 
3440: 62 72 61 6e 63 68 20 27 24 62 72 61 6e 61 6d 65  branch '$braname
3450: 27 20 6f 6e 20 24 66 6e 61 6d 65 2f 24 72 65 76  ' on $fname/$rev
3460: 6e 72 20 66 72 6f 6d 20 27 24 6f 6c 64 6e 61 6d  nr from '$oldnam
3470: 65 27 20 6f 6e 74 6f 20 27 24 70 72 65 66 65 72  e' onto '$prefer
3480: 65 64 6e 61 6d 65 27 22 0a 09 20 20 20 20 73 74  edname'"..    st
3490: 61 74 65 20 72 75 6e 20 7b 20 55 50 44 41 54 45  ate run { UPDATE
34a0: 20 74 61 67 20 53 45 54 20 6c 6f 64 20 3d 20 24   tag SET lod = $
34b0: 70 69 64 20 57 48 45 52 45 20 74 69 64 20 3d 20  pid WHERE tid = 
34c0: 24 69 64 20 3b 20 7d 0a 09 20 20 20 20 69 6e 63  $id ; }..    inc
34d0: 72 20 6e 0a 09 7d 0a 0a 09 6c 6f 67 20 77 72 69  r n..}...log wri
34e0: 74 65 20 33 20 66 69 6c 74 65 72 73 79 6d 20 22  te 3 filtersym "
34f0: 52 65 70 61 72 65 6e 74 65 64 20 5b 6e 73 70 20  Reparented [nsp 
3500: 24 6e 20 62 72 61 6e 63 68 20 62 72 61 6e 63 68  $n branch branch
3510: 65 73 5d 22 0a 09 72 65 74 75 72 6e 0a 20 20 20  es]"..return.   
3520: 20 7d 0a 0a 20 20 20 20 70 72 6f 63 20 52 65 66   }..    proc Ref
3530: 69 6e 65 53 79 6d 62 6f 6c 73 20 7b 7d 20 7b 0a  ineSymbols {} {.
3540: 09 23 20 54 61 67 73 20 61 6e 64 20 62 72 61 6e  .# Tags and bran
3550: 63 68 65 73 20 61 72 65 20 6d 61 72 6b 65 64 20  ches are marked 
3560: 61 73 20 6e 6f 72 6d 61 6c 2f 6e 6f 6f 70 20 62  as normal/noop b
3570: 61 73 65 64 20 6f 6e 20 74 68 65 20 6f 70 0a 09  ased on the op..
3580: 23 20 6f 66 20 74 68 65 69 72 20 72 65 76 69 73  # of their revis
3590: 69 6f 6e 2e 0a 0a 09 6c 6f 67 20 77 72 69 74 65  ion....log write
35a0: 20 33 20 66 69 6c 74 65 72 73 79 6d 20 22 52 65   3 filtersym "Re
35b0: 66 69 6e 65 20 73 79 6d 62 6f 6c 73 20 28 6e 6f  fine symbols (no
35c0: 2d 6f 70 20 6f 72 20 6e 6f 74 3f 29 22 0a 0a 09  -op or not?)"...
35d0: 6c 6f 67 20 77 72 69 74 65 20 34 20 66 69 6c 74  log write 4 filt
35e0: 65 72 73 79 6d 20 22 20 20 20 20 52 65 67 75 6c  ersym "    Regul
35f0: 61 72 20 74 61 67 73 22 0a 09 73 74 61 74 65 20  ar tags"..state 
3600: 72 75 6e 20 7b 0a 09 20 20 20 20 49 4e 53 45 52  run {..    INSER
3610: 54 20 49 4e 54 4f 20 6e 6f 6f 70 0a 09 20 20 20  T INTO noop..   
3620: 20 53 45 4c 45 43 54 20 54 2e 74 69 64 2c 20 30   SELECT T.tid, 0
3630: 0a 09 20 20 20 20 46 52 4f 4d 20 74 61 67 20 54  ..    FROM tag T
3640: 2c 20 72 65 76 69 73 69 6f 6e 20 52 0a 09 20 20  , revision R..  
3650: 20 20 57 48 45 52 45 20 54 2e 72 65 76 20 20 3d    WHERE T.rev  =
3660: 20 52 2e 72 69 64 0a 09 20 20 20 20 41 4e 44 20   R.rid..    AND 
3670: 20 20 52 2e 6f 70 20 20 21 3d 20 30 20 2d 2d 20    R.op  != 0 -- 
3680: 30 20 3d 3d 20 6e 6f 74 68 69 6e 67 0a 09 7d 0a  0 == nothing..}.
3690: 0a 09 6c 6f 67 20 77 72 69 74 65 20 34 20 66 69  ..log write 4 fi
36a0: 6c 74 65 72 73 79 6d 20 22 20 20 20 20 4e 6f 2d  ltersym "    No-
36b0: 6f 70 20 74 61 67 73 22 0a 09 73 74 61 74 65 20  op tags"..state 
36c0: 72 75 6e 20 7b 0a 09 20 20 20 20 49 4e 53 45 52  run {..    INSER
36d0: 54 20 49 4e 54 4f 20 6e 6f 6f 70 0a 09 20 20 20  T INTO noop..   
36e0: 20 53 45 4c 45 43 54 20 54 2e 74 69 64 2c 20 31   SELECT T.tid, 1
36f0: 0a 09 20 20 20 20 46 52 4f 4d 20 74 61 67 20 54  ..    FROM tag T
3700: 2c 20 72 65 76 69 73 69 6f 6e 20 52 0a 09 20 20  , revision R..  
3710: 20 20 57 48 45 52 45 20 54 2e 72 65 76 20 20 3d    WHERE T.rev  =
3720: 20 52 2e 72 69 64 0a 09 20 20 20 20 41 4e 44 20   R.rid..    AND 
3730: 20 20 52 2e 6f 70 20 20 20 3d 20 30 20 2d 2d 20    R.op   = 0 -- 
3740: 6e 6f 74 68 69 6e 67 0a 09 7d 0a 0a 09 6c 6f 67  nothing..}...log
3750: 20 77 72 69 74 65 20 34 20 66 69 6c 74 65 72 73   write 4 filters
3760: 79 6d 20 22 20 20 20 20 52 65 67 75 6c 61 72 20  ym "    Regular 
3770: 62 72 61 6e 63 68 65 73 22 0a 09 73 74 61 74 65  branches"..state
3780: 20 72 75 6e 20 7b 0a 09 20 20 20 20 49 4e 53 45   run {..    INSE
3790: 52 54 20 49 4e 54 4f 20 6e 6f 6f 70 0a 09 20 20  RT INTO noop..  
37a0: 20 20 53 45 4c 45 43 54 20 42 2e 62 69 64 2c 20    SELECT B.bid, 
37b0: 30 0a 09 20 20 20 20 46 52 4f 4d 20 62 72 61 6e  0..    FROM bran
37c0: 63 68 20 42 2c 20 72 65 76 69 73 69 6f 6e 20 52  ch B, revision R
37d0: 0a 09 20 20 20 20 57 48 45 52 45 20 42 2e 72 6f  ..    WHERE B.ro
37e0: 6f 74 20 3d 20 52 2e 72 69 64 0a 09 20 20 20 20  ot = R.rid..    
37f0: 41 4e 44 20 20 20 52 2e 6f 70 20 20 21 3d 20 30  AND   R.op  != 0
3800: 20 2d 2d 20 6e 6f 74 68 69 6e 67 0a 09 7d 0a 0a   -- nothing..}..
3810: 09 6c 6f 67 20 77 72 69 74 65 20 34 20 66 69 6c  .log write 4 fil
3820: 74 65 72 73 79 6d 20 22 20 20 20 20 4e 6f 2d 6f  tersym "    No-o
3830: 70 20 62 72 61 6e 63 68 65 73 22 0a 09 73 74 61  p branches"..sta
3840: 74 65 20 72 75 6e 20 7b 0a 09 20 20 20 20 49 4e  te run {..    IN
3850: 53 45 52 54 20 49 4e 54 4f 20 6e 6f 6f 70 0a 09  SERT INTO noop..
3860: 20 20 20 20 53 45 4c 45 43 54 20 42 2e 62 69 64      SELECT B.bid
3870: 2c 20 31 0a 09 20 20 20 20 46 52 4f 4d 20 62 72  , 1..    FROM br
3880: 61 6e 63 68 20 42 2c 20 72 65 76 69 73 69 6f 6e  anch B, revision
3890: 20 52 0a 09 20 20 20 20 57 48 45 52 45 20 42 2e   R..    WHERE B.
38a0: 72 6f 6f 74 20 3d 20 52 2e 72 69 64 0a 09 20 20  root = R.rid..  
38b0: 20 20 41 4e 44 20 20 20 52 2e 6f 70 20 20 20 3d    AND   R.op   =
38c0: 20 30 20 2d 2d 20 6e 6f 74 68 69 6e 67 0a 09 7d   0 -- nothing..}
38d0: 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a  ..return.    }..
38e0: 20 20 20 20 23 20 23 20 23 23 20 23 23 23 20 23      # # ## ### #
38f0: 23 23 23 23 20 23 23 23 23 23 23 23 23 20 23 23  #### ######## ##
3900: 23 23 23 23 23 23 23 23 23 23 23 0a 20 20 20 20  ###########.    
3910: 23 23 20 43 6f 6e 66 69 67 75 72 61 74 69 6f 6e  ## Configuration
3920: 0a 0a 20 20 20 20 70 72 61 67 6d 61 20 2d 68 61  ..    pragma -ha
3930: 73 69 6e 73 74 61 6e 63 65 73 20 20 20 6e 6f 20  sinstances   no 
3940: 3b 20 23 20 73 69 6e 67 6c 65 74 6f 6e 0a 20 20  ; # singleton.  
3950: 20 20 70 72 61 67 6d 61 20 2d 68 61 73 74 79 70    pragma -hastyp
3960: 65 69 6e 66 6f 20 20 20 20 6e 6f 20 3b 20 23 20  einfo    no ; # 
3970: 6e 6f 20 69 6e 74 72 6f 73 70 65 63 74 69 6f 6e  no introspection
3980: 0a 20 20 20 20 70 72 61 67 6d 61 20 2d 68 61 73  .    pragma -has
3990: 74 79 70 65 64 65 73 74 72 6f 79 20 6e 6f 20 3b  typedestroy no ;
39a0: 20 23 20 69 6d 6d 6f 72 74 61 6c 0a 0a 20 20 20   # immortal..   
39b0: 20 23 20 23 20 23 23 20 23 23 23 20 23 23 23 23   # # ## ### ####
39c0: 23 20 23 23 23 23 23 23 23 23 20 23 23 23 23 23  # ######## #####
39d0: 23 23 23 23 23 23 23 23 0a 7d 0a 0a 6e 61 6d 65  ########.}..name
39e0: 73 70 61 63 65 20 65 76 61 6c 20 3a 3a 76 63 3a  space eval ::vc:
39f0: 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a  :fossil::import:
3a00: 3a 63 76 73 3a 3a 70 61 73 73 20 7b 0a 20 20 20  :cvs::pass {.   
3a10: 20 6e 61 6d 65 73 70 61 63 65 20 65 78 70 6f 72   namespace expor
3a20: 74 20 66 69 6c 74 65 72 73 79 6d 0a 20 20 20 20  t filtersym.    
3a30: 6e 61 6d 65 73 70 61 63 65 20 65 76 61 6c 20 66  namespace eval f
3a40: 69 6c 74 65 72 73 79 6d 20 7b 0a 09 6e 61 6d 65  iltersym {..name
3a50: 73 70 61 63 65 20 69 6d 70 6f 72 74 20 3a 3a 76  space import ::v
3a60: 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72  c::fossil::impor
3a70: 74 3a 3a 63 76 73 3a 3a 73 74 61 74 65 0a 09 6e  t::cvs::state..n
3a80: 61 6d 65 73 70 61 63 65 20 69 6d 70 6f 72 74 20  amespace import 
3a90: 3a 3a 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d  ::vc::fossil::im
3aa0: 70 6f 72 74 3a 3a 63 76 73 3a 3a 69 6e 74 65 67  port::cvs::integ
3ab0: 72 69 74 79 0a 09 6e 61 6d 65 73 70 61 63 65 20  rity..namespace 
3ac0: 65 76 61 6c 20 70 72 6f 6a 65 63 74 20 7b 0a 09  eval project {..
3ad0: 20 20 20 20 6e 61 6d 65 73 70 61 63 65 20 69 6d      namespace im
3ae0: 70 6f 72 74 20 3a 3a 76 63 3a 3a 66 6f 73 73 69  port ::vc::fossi
3af0: 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a  l::import::cvs::
3b00: 70 72 6f 6a 65 63 74 3a 3a 73 79 6d 0a 09 7d 0a  project::sym..}.
3b10: 09 6e 61 6d 65 73 70 61 63 65 20 69 6d 70 6f 72  .namespace impor
3b20: 74 20 3a 3a 76 63 3a 3a 74 6f 6f 6c 73 3a 3a 6d  t ::vc::tools::m
3b30: 69 73 63 3a 3a 6e 73 70 0a 09 6e 61 6d 65 73 70  isc::nsp..namesp
3b40: 61 63 65 20 69 6d 70 6f 72 74 20 3a 3a 76 63 3a  ace import ::vc:
3b50: 3a 74 6f 6f 6c 73 3a 3a 6c 6f 67 0a 09 6c 6f 67  :tools::log..log
3b60: 20 72 65 67 69 73 74 65 72 20 66 69 6c 74 65 72   register filter
3b70: 73 79 6d 0a 20 20 20 20 7d 0a 7d 0a 0a 23 20 23  sym.    }.}..# #
3b80: 20 23 23 20 23 23 23 20 23 23 23 23 23 20 23 23   ## ### ##### ##
3b90: 23 23 23 23 23 23 20 23 23 23 23 23 23 23 23 23  ###### #########
3ba0: 23 23 23 23 20 23 23 23 23 23 23 23 23 23 23 23  #### ###########
3bb0: 23 23 23 23 23 23 23 23 23 23 0a 23 23 20 52 65  ##########.## Re
3bc0: 61 64 79 0a 0a 70 61 63 6b 61 67 65 20 70 72 6f  ady..package pro
3bd0: 76 69 64 65 20 76 63 3a 3a 66 6f 73 73 69 6c 3a  vide vc::fossil:
3be0: 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 70 61  :import::cvs::pa
3bf0: 73 73 3a 3a 66 69 6c 74 65 72 73 79 6d 20 31 2e  ss::filtersym 1.
3c00: 30 0a 72 65 74 75 72 6e 0a                       0.return.