Hex Artifact Content
Not logged in

Artifact 3f927ba1109bd173ec1f72f31bdc41431e1568b7:

File tools/cvs2fossil/lib/c2f_pfiltersym.tcl part of check-in [83d75a6c23] - Modified filtering pass to drop the blobs of excluded revisions, for them we can be sure that we will not need them later, as whole branches are dropped. Modified the file import to use the new blob information to setup the expansion graph. This fixes the trouble we had with archive files in bwidget. They are now properly expanded. by aku on 2008-02-03 00:45:57.

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 72 65 70 6f 73 69 74 6f 72  ::cvs::repositor
0450: 79 20 20 20 3b 20 23 20 52 65 70 6f 73 69 74 6f  y   ; # Reposito
0460: 72 79 20 6d 61 6e 61 67 65 6d 65 6e 74 2e 0a 70  ry management..p
0470: 61 63 6b 61 67 65 20 72 65 71 75 69 72 65 20 76  ackage require v
0480: 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72  c::fossil::impor
0490: 74 3a 3a 63 76 73 3a 3a 73 74 61 74 65 20 20 20  t::cvs::state   
04a0: 20 20 20 20 20 3b 20 23 20 53 74 61 74 65 20 73       ; # State s
04b0: 74 6f 72 61 67 65 2e 0a 70 61 63 6b 61 67 65 20  torage..package 
04c0: 72 65 71 75 69 72 65 20 76 63 3a 3a 66 6f 73 73  require vc::foss
04d0: 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a  il::import::cvs:
04e0: 3a 69 6e 74 65 67 72 69 74 79 20 20 20 20 3b 20  :integrity    ; 
04f0: 23 20 53 74 61 74 65 20 73 74 6f 72 61 67 65 20  # State storage 
0500: 69 6e 74 65 67 72 69 74 79 20 63 68 65 63 6b 73  integrity checks
0510: 2e 0a 70 61 63 6b 61 67 65 20 72 65 71 75 69 72  ..package requir
0520: 65 20 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d  e vc::fossil::im
0530: 70 6f 72 74 3a 3a 63 76 73 3a 3a 70 72 6f 6a 65  port::cvs::proje
0540: 63 74 3a 3a 73 79 6d 20 3b 20 23 20 50 72 6f 6a  ct::sym ; # Proj
0550: 65 63 74 20 6c 65 76 65 6c 20 73 79 6d 62 6f 6c  ect level symbol
0560: 73 0a 0a 23 20 23 20 23 23 20 23 23 23 20 23 23  s..# # ## ### ##
0570: 23 23 23 20 23 23 23 23 23 23 23 23 20 23 23 23  ### ######## ###
0580: 23 23 23 23 23 23 23 23 23 23 20 23 23 23 23 23  ########## #####
0590: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23  ################
05a0: 0a 23 23 20 52 65 67 69 73 74 65 72 20 74 68 65  .## Register the
05b0: 20 70 61 73 73 20 77 69 74 68 20 74 68 65 20 6d   pass with the m
05c0: 61 6e 61 67 65 6d 65 6e 74 0a 0a 76 63 3a 3a 66  anagement..vc::f
05d0: 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63  ossil::import::c
05e0: 76 73 3a 3a 70 61 73 73 20 64 65 66 69 6e 65 20  vs::pass define 
05f0: 5c 0a 20 20 20 20 46 69 6c 74 65 72 53 79 6d 62  \.    FilterSymb
0600: 6f 6c 73 20 5c 0a 20 20 20 20 7b 46 69 6c 74 65  ols \.    {Filte
0610: 72 20 73 79 6d 62 6f 6c 73 2c 20 72 65 6d 6f 76  r symbols, remov
0620: 65 20 61 6c 6c 20 65 78 63 6c 75 64 65 64 20 70  e all excluded p
0630: 69 65 63 65 73 7d 20 5c 0a 20 20 20 20 3a 3a 76  ieces} \.    ::v
0640: 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72  c::fossil::impor
0650: 74 3a 3a 63 76 73 3a 3a 70 61 73 73 3a 3a 66 69  t::cvs::pass::fi
0660: 6c 74 65 72 73 79 6d 0a 0a 23 20 23 20 23 23 20  ltersym..# # ## 
0670: 23 23 23 20 23 23 23 23 23 20 23 23 23 23 23 23  ### ##### ######
0680: 23 23 20 23 23 23 23 23 23 23 23 23 23 23 23 23  ## #############
0690: 20 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23   ###############
06a0: 23 23 23 23 23 23 0a 23 23 0a 0a 73 6e 69 74 3a  ######.##..snit:
06b0: 3a 74 79 70 65 20 3a 3a 76 63 3a 3a 66 6f 73 73  :type ::vc::foss
06c0: 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a  il::import::cvs:
06d0: 3a 70 61 73 73 3a 3a 66 69 6c 74 65 72 73 79 6d  :pass::filtersym
06e0: 20 7b 0a 20 20 20 20 23 20 23 20 23 23 20 23 23   {.    # # ## ##
06f0: 23 20 23 23 23 23 23 20 23 23 23 23 23 23 23 23  # ##### ########
0700: 20 23 23 23 23 23 23 23 23 23 23 23 23 23 0a 20   #############. 
0710: 20 20 20 23 23 20 50 75 62 6c 69 63 20 41 50 49     ## Public API
0720: 0a 0a 20 20 20 20 74 79 70 65 6d 65 74 68 6f 64  ..    typemethod
0730: 20 73 65 74 75 70 20 7b 7d 20 7b 0a 09 23 20 44   setup {} {..# D
0740: 65 66 69 6e 65 20 6e 61 6d 65 73 20 61 6e 64 20  efine names and 
0750: 73 74 72 75 63 74 75 72 65 20 6f 66 20 74 68 65  structure of the
0760: 20 70 65 72 73 69 73 74 65 6e 74 20 73 74 61 74   persistent stat
0770: 65 20 6f 66 20 74 68 69 73 0a 09 23 20 70 61 73  e of this..# pas
0780: 73 2e 0a 0a 09 73 74 61 74 65 20 75 73 65 20 70  s....state use p
0790: 72 6f 6a 65 63 74 0a 09 73 74 61 74 65 20 75 73  roject..state us
07a0: 65 20 66 69 6c 65 0a 09 73 74 61 74 65 20 75 73  e file..state us
07b0: 65 20 72 65 76 69 73 69 6f 6e 0a 09 73 74 61 74  e revision..stat
07c0: 65 20 75 73 65 20 72 65 76 69 73 69 6f 6e 62 72  e use revisionbr
07d0: 61 6e 63 68 63 68 69 6c 64 72 65 6e 0a 09 73 74  anchchildren..st
07e0: 61 74 65 20 75 73 65 20 62 72 61 6e 63 68 0a 09  ate use branch..
07f0: 73 74 61 74 65 20 75 73 65 20 74 61 67 0a 09 73  state use tag..s
0800: 74 61 74 65 20 75 73 65 20 73 79 6d 62 6f 6c 0a  tate use symbol.
0810: 09 73 74 61 74 65 20 75 73 65 20 62 6c 6f 63 6b  .state use block
0820: 65 72 0a 09 73 74 61 74 65 20 75 73 65 20 70 61  er..state use pa
0830: 72 65 6e 74 0a 09 73 74 61 74 65 20 75 73 65 20  rent..state use 
0840: 61 75 74 68 6f 72 0a 09 73 74 61 74 65 20 75 73  author..state us
0850: 65 20 63 6d 65 73 73 61 67 65 0a 09 73 74 61 74  e cmessage..stat
0860: 65 20 75 73 65 20 70 72 65 66 65 72 65 64 70 61  e use preferedpa
0870: 72 65 6e 74 0a 0a 09 23 20 4e 4f 54 45 3a 20 53  rent...# NOTE: S
0880: 6f 20 66 61 72 20 6e 6f 20 70 61 73 73 20 63 6f  o far no pass co
0890: 6d 69 6e 67 20 61 66 74 65 72 20 74 68 69 73 20  ming after this 
08a0: 6d 61 6b 65 73 20 75 73 20 6f 66 20 74 68 69 73  makes us of this
08b0: 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 2e 0a 09 73   information...s
08c0: 74 61 74 65 20 65 78 74 65 6e 64 20 6e 6f 6f 70  tate extend noop
08d0: 20 7b 0a 09 20 20 20 20 69 64 20 20 20 20 49 4e   {..    id    IN
08e0: 54 45 47 45 52 20 4e 4f 54 20 4e 55 4c 4c 20 20  TEGER NOT NULL  
08f0: 50 52 49 4d 41 52 59 20 4b 45 59 2c 20 2d 2d 20  PRIMARY KEY, -- 
0900: 74 61 67 2f 62 72 61 6e 63 68 20 72 65 66 65 72  tag/branch refer
0910: 65 6e 63 65 0a 09 20 20 20 20 6e 6f 6f 70 20 20  ence..    noop  
0920: 49 4e 54 45 47 45 52 20 4e 4f 54 20 4e 55 4c 4c  INTEGER NOT NULL
0930: 0a 09 7d 0a 09 72 65 74 75 72 6e 0a 20 20 20 20  ..}..return.    
0940: 7d 0a 0a 20 20 20 20 74 79 70 65 6d 65 74 68 6f  }..    typemetho
0950: 64 20 6c 6f 61 64 20 7b 7d 20 7b 0a 09 23 20 50  d load {} {..# P
0960: 61 73 73 20 6d 61 6e 61 67 65 72 20 69 6e 74 65  ass manager inte
0970: 72 66 61 63 65 2e 20 45 78 65 63 75 74 65 64 20  rface. Executed 
0980: 74 6f 20 6c 6f 61 64 20 64 61 74 61 20 63 6f 6d  to load data com
0990: 70 75 74 65 64 20 62 79 0a 09 23 20 74 68 69 73  puted by..# this
09a0: 20 70 61 73 73 20 69 6e 74 6f 20 6d 65 6d 6f 72   pass into memor
09b0: 79 20 77 68 65 6e 20 74 68 69 73 20 70 61 73 73  y when this pass
09c0: 20 69 73 20 73 6b 69 70 70 65 64 20 69 6e 73 74   is skipped inst
09d0: 65 61 64 20 6f 66 0a 09 23 20 65 78 65 63 75 74  ead of..# execut
09e0: 65 64 2e 0a 0a 09 23 20 54 68 65 20 72 65 73 75  ed....# The resu
09f0: 6c 74 73 20 6f 66 20 74 68 69 73 20 70 61 73 73  lts of this pass
0a00: 20 61 72 65 20 66 75 6c 6c 79 20 69 6e 20 74 68   are fully in th
0a10: 65 20 70 65 72 73 69 73 74 65 6e 74 20 73 74 61  e persistent sta
0a20: 74 65 2c 0a 09 23 20 74 68 65 72 65 20 69 73 20  te,..# there is 
0a30: 6e 6f 74 68 69 6e 67 20 74 6f 20 6c 6f 61 64 20  nothing to load 
0a40: 66 6f 72 20 74 68 65 20 6e 65 78 74 20 6f 6e 65  for the next one
0a50: 2e 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a  ...return.    }.
0a60: 0a 20 20 20 20 74 79 70 65 6d 65 74 68 6f 64 20  .    typemethod 
0a70: 72 75 6e 20 7b 7d 20 7b 0a 09 23 20 50 61 73 73  run {} {..# Pass
0a80: 20 6d 61 6e 61 67 65 72 20 69 6e 74 65 72 66 61   manager interfa
0a90: 63 65 2e 20 45 78 65 63 75 74 65 64 20 74 6f 20  ce. Executed to 
0aa0: 70 65 72 66 6f 72 6d 20 74 68 65 0a 09 23 20 66  perform the..# f
0ab0: 75 6e 63 74 69 6f 6e 61 6c 69 74 79 20 6f 66 20  unctionality of 
0ac0: 74 68 65 20 70 61 73 73 2e 0a 0a 09 23 20 54 68  the pass....# Th
0ad0: 65 20 72 65 6d 6f 76 61 6c 20 6f 66 20 65 78 63  e removal of exc
0ae0: 6c 75 64 65 64 20 73 79 6d 62 6f 6c 73 20 61 6e  luded symbols an
0af0: 64 20 65 76 65 72 79 74 68 69 6e 67 20 72 65 66  d everything ref
0b00: 65 72 65 6e 63 69 6e 67 0a 09 23 20 74 6f 20 74  erencing..# to t
0b10: 68 65 6d 20 69 73 20 64 6f 6e 65 20 63 6f 6d 70  hem is done comp
0b20: 6c 65 74 65 6c 79 20 69 6e 20 74 68 65 20 64 61  letely in the da
0b30: 74 61 62 61 73 65 2e 0a 0a 09 73 74 61 74 65 20  tabase....state 
0b40: 74 72 61 6e 73 61 63 74 69 6f 6e 20 7b 0a 09 20  transaction {.. 
0b50: 20 20 20 46 69 6c 74 65 72 45 78 63 6c 75 64 65     FilterExclude
0b60: 64 53 79 6d 62 6f 6c 73 0a 09 20 20 20 20 4d 75  dSymbols..    Mu
0b70: 74 61 74 65 53 79 6d 62 6f 6c 73 0a 09 20 20 20  tateSymbols..   
0b80: 20 41 64 6a 75 73 74 50 61 72 65 6e 74 73 0a 09   AdjustParents..
0b90: 20 20 20 20 52 65 66 69 6e 65 53 79 6d 62 6f 6c      RefineSymbol
0ba0: 73 0a 0a 09 20 20 20 20 72 65 70 6f 73 69 74 6f  s...    reposito
0bb0: 72 79 20 70 72 69 6e 74 72 65 76 73 74 61 74 69  ry printrevstati
0bc0: 73 74 69 63 73 0a 0a 09 20 20 20 20 23 20 53 74  stics...    # St
0bd0: 72 69 63 74 20 69 6e 74 65 67 72 69 74 79 20 65  rict integrity e
0be0: 6e 66 6f 72 63 65 73 20 74 68 61 74 20 61 6c 6c  nforces that all
0bf0: 20 6d 65 74 61 20 65 6e 74 72 69 65 73 20 61 72   meta entries ar
0c00: 65 20 69 6e 0a 09 20 20 20 20 23 20 74 68 65 20  e in..    # the 
0c10: 73 61 6d 65 20 4c 4f 44 20 61 73 20 74 68 65 20  same LOD as the 
0c20: 72 65 76 69 73 69 6f 6e 20 75 73 69 6e 67 20 74  revision using t
0c30: 68 65 6d 2e 20 41 74 20 74 68 69 73 20 70 6f 69  hem. At this poi
0c40: 6e 74 0a 09 20 20 20 20 23 20 74 68 69 73 20 6d  nt..    # this m
0c50: 61 79 20 6e 6f 74 20 62 65 20 74 72 75 65 20 61  ay not be true a
0c60: 6e 79 20 6c 6f 6e 67 65 72 2e 20 49 66 20 61 20  ny longer. If a 
0c70: 4e 54 44 42 20 77 61 73 20 65 78 63 6c 75 64 65  NTDB was exclude
0c80: 64 0a 09 20 20 20 20 23 20 74 68 65 6e 20 61 6c  d..    # then al
0c90: 6c 20 72 65 76 69 73 69 6f 6e 73 20 69 74 20 73  l revisions it s
0ca0: 68 61 72 65 64 20 77 69 74 68 20 74 68 65 20 74  hared with the t
0cb0: 72 75 6e 6b 20 77 65 72 65 20 6d 6f 76 65 64 0a  runk were moved.
0cc0: 09 20 20 20 20 23 20 74 6f 20 74 68 65 20 74 72  .    # to the tr
0cd0: 75 6e 6b 20 4c 4f 44 2c 20 68 6f 77 65 76 65 72  unk LOD, however
0ce0: 20 74 68 65 69 72 20 6d 65 74 61 20 65 6e 74 72   their meta entr
0cf0: 69 65 73 20 77 69 6c 6c 20 73 74 69 6c 6c 0a 09  ies will still..
0d00: 20 20 20 20 23 20 72 65 66 65 72 20 74 6f 20 74      # refer to t
0d10: 68 65 20 6e 6f 77 20 67 6f 6e 65 20 4c 4f 44 20  he now gone LOD 
0d20: 73 79 6d 62 6f 6c 2e 20 54 68 69 73 20 69 73 20  symbol. This is 
0d30: 66 69 6e 65 20 68 6f 77 65 76 65 72 2c 0a 09 20  fine however,.. 
0d40: 20 20 20 23 20 69 74 20 77 69 6c 6c 20 6e 6f 74     # it will not
0d50: 20 61 66 66 65 63 74 20 6f 75 72 20 61 62 69 6c   affect our abil
0d60: 69 74 79 20 74 6f 20 75 73 65 20 74 68 65 20 6d  ity to use the m
0d70: 65 74 61 20 65 6e 74 72 69 65 73 0a 09 20 20 20  eta entries..   
0d80: 20 23 20 74 6f 20 64 69 73 74 69 6e 67 75 69 73   # to distinguis
0d90: 68 20 61 6e 64 20 67 72 6f 75 70 20 72 65 76 69  h and group revi
0da0: 73 69 6f 6e 73 20 69 6e 74 6f 20 63 68 61 6e 67  sions into chang
0db0: 65 73 65 74 73 2e 20 49 74 0a 09 20 20 20 20 23  esets. It..    #
0dc0: 20 73 68 6f 75 6c 64 20 62 65 20 6e 6f 74 65 64   should be noted
0dd0: 20 74 68 61 74 20 77 65 20 63 61 6e 6e 6f 74 20   that we cannot 
0de0: 73 69 6d 70 6c 79 20 73 77 69 74 63 68 20 74 68  simply switch th
0df0: 65 20 6d 65 74 61 0a 09 20 20 20 20 23 20 65 6e  e meta..    # en
0e00: 74 72 69 65 73 20 6f 76 65 72 20 74 6f 20 74 68  tries over to th
0e10: 65 20 74 72 75 6e 6b 20 65 69 74 68 65 72 2c 20  e trunk either, 
0e20: 61 73 20 74 68 61 74 20 6d 61 79 20 63 61 75 73  as that may caus
0e30: 65 20 74 68 65 0a 09 20 20 20 20 23 20 6d 6f 64  e the..    # mod
0e40: 69 66 69 65 64 20 65 6e 74 72 69 65 73 20 74 6f  ified entries to
0e50: 20 76 69 6f 6c 61 74 65 20 74 68 65 20 75 6e 69   violate the uni
0e60: 71 75 65 2d 6e 65 73 73 20 63 6f 6e 73 74 72 61  que-ness constra
0e70: 69 6e 0a 09 20 20 20 20 23 20 73 65 74 20 6f 6e  in..    # set on
0e80: 20 74 68 61 74 20 74 61 62 6c 65 2e 0a 09 20 20   that table...  
0e90: 20 20 69 6e 74 65 67 72 69 74 79 20 6d 65 74 61    integrity meta
0ea0: 72 65 6c 61 78 65 64 0a 09 7d 0a 0a 09 6c 6f 67  relaxed..}...log
0eb0: 20 77 72 69 74 65 20 31 20 66 69 6c 74 65 72 73   write 1 filters
0ec0: 79 6d 20 22 46 69 6c 74 65 72 69 6e 67 20 63 6f  ym "Filtering co
0ed0: 6d 70 6c 65 74 65 64 22 0a 09 72 65 74 75 72 6e  mpleted"..return
0ee0: 0a 20 20 20 20 7d 0a 0a 20 20 20 20 74 79 70 65  .    }..    type
0ef0: 6d 65 74 68 6f 64 20 64 69 73 63 61 72 64 20 7b  method discard {
0f00: 7d 20 7b 0a 09 23 20 50 61 73 73 20 6d 61 6e 61  } {..# Pass mana
0f10: 67 65 72 20 69 6e 74 65 72 66 61 63 65 2e 20 45  ger interface. E
0f20: 78 65 63 75 74 65 64 20 66 6f 72 20 61 6c 6c 20  xecuted for all 
0f30: 70 61 73 73 65 73 20 61 66 74 65 72 20 74 68 65  passes after the
0f40: 0a 09 23 20 72 75 6e 20 70 61 73 73 65 73 2c 20  ..# run passes, 
0f50: 74 6f 20 72 65 6d 6f 76 65 20 61 6c 6c 20 64 61  to remove all da
0f60: 74 61 20 6f 66 20 74 68 69 73 20 70 61 73 73 20  ta of this pass 
0f70: 66 72 6f 6d 20 74 68 65 20 73 74 61 74 65 2c 0a  from the state,.
0f80: 09 23 20 61 73 20 62 65 69 6e 67 20 6f 75 74 20  .# as being out 
0f90: 6f 66 20 64 61 74 65 2e 0a 09 72 65 74 75 72 6e  of date...return
0fa0: 0a 20 20 20 20 7d 0a 0a 20 20 20 20 23 20 23 20  .    }..    # # 
0fb0: 23 23 20 23 23 23 20 23 23 23 23 23 20 23 23 23  ## ### ##### ###
0fc0: 23 23 23 23 23 20 23 23 23 23 23 23 23 23 23 23  ##### ##########
0fd0: 23 23 23 0a 20 20 20 20 23 23 20 49 6e 74 65 72  ###.    ## Inter
0fe0: 6e 61 6c 20 6d 65 74 68 6f 64 73 0a 0a 20 20 20  nal methods..   
0ff0: 20 70 72 6f 63 20 46 69 6c 74 65 72 45 78 63 6c   proc FilterExcl
1000: 75 64 65 64 53 79 6d 62 6f 6c 73 20 7b 7d 20 7b  udedSymbols {} {
1010: 0a 09 6c 6f 67 20 77 72 69 74 65 20 33 20 66 69  ..log write 3 fi
1020: 6c 74 65 72 73 79 6d 20 22 52 65 6d 6f 76 65 20  ltersym "Remove 
1030: 74 68 65 20 65 78 63 6c 75 64 65 64 20 73 79 6d  the excluded sym
1040: 62 6f 6c 73 20 61 6e 64 20 74 68 65 69 72 20 75  bols and their u
1050: 73 65 72 73 22 0a 0a 09 23 20 57 65 20 70 75 6c  sers"...# We pul
1060: 6c 20 61 6c 6c 20 74 68 65 20 65 78 63 6c 75 64  l all the exclud
1070: 65 64 20 73 79 6d 62 6f 6c 73 20 74 6f 67 65 74  ed symbols toget
1080: 68 65 72 20 69 6e 74 6f 20 61 20 74 61 62 6c 65  her into a table
1090: 20 66 6f 72 0a 09 23 20 65 61 73 79 20 72 65 66   for..# easy ref
10a0: 65 72 65 6e 63 65 20 62 79 20 74 68 65 20 75 70  erence by the up
10b0: 63 6f 6d 69 6e 67 20 44 45 4c 45 54 45 20 61 6e  coming DELETE an
10c0: 64 20 6f 74 68 65 72 20 73 74 61 74 65 6d 65 6e  d other statemen
10d0: 74 73 2e 0a 09 23 20 28 27 78 20 49 4e 20 74 61  ts...# ('x IN ta
10e0: 62 6c 65 27 20 63 6c 61 75 73 65 73 29 2e 0a 0a  ble' clauses)...
10f0: 09 73 65 74 20 65 78 63 6c 20 5b 70 72 6f 6a 65  .set excl [proje
1100: 63 74 3a 3a 73 79 6d 20 65 78 63 6c 75 64 65 64  ct::sym excluded
1110: 5d 0a 0a 09 73 74 61 74 65 20 72 75 6e 20 7b 0a  ]...state run {.
1120: 09 20 20 20 20 43 52 45 41 54 45 20 54 45 4d 50  .    CREATE TEMP
1130: 4f 52 41 52 59 20 54 41 42 4c 45 20 65 78 63 6c  ORARY TABLE excl
1140: 75 64 65 64 73 79 6d 62 6f 6c 73 20 41 53 0a 09  udedsymbols AS..
1150: 20 20 20 20 53 45 4c 45 43 54 20 73 69 64 0a 09      SELECT sid..
1160: 20 20 20 20 46 52 4f 4d 20 20 20 73 79 6d 62 6f      FROM   symbo
1170: 6c 0a 09 20 20 20 20 57 48 45 52 45 20 20 74 79  l..    WHERE  ty
1180: 70 65 20 3d 20 24 65 78 63 6c 0a 09 7d 0a 0a 09  pe = $excl..}...
1190: 23 20 46 69 72 73 74 20 77 65 20 68 61 76 65 20  # First we have 
11a0: 74 6f 20 68 61 6e 64 6c 65 20 74 68 65 20 70 6f  to handle the po
11b0: 73 73 69 62 69 6c 69 74 79 20 6f 66 20 61 6e 20  ssibility of an 
11c0: 65 78 63 6c 75 64 65 64 0a 09 23 20 4e 54 44 42  excluded..# NTDB
11d0: 2e 20 54 68 69 73 20 69 73 20 61 20 73 70 65 63  . This is a spec
11e0: 69 61 6c 20 73 70 65 63 69 61 6c 20 63 61 73 65  ial special case
11f0: 20 74 68 65 72 65 20 77 65 20 68 61 76 65 20 74   there we have t
1200: 6f 0a 09 23 20 72 65 67 72 61 66 74 20 74 68 65  o..# regraft the
1210: 20 72 65 76 69 73 69 6f 6e 73 20 77 68 69 63 68   revisions which
1220: 20 61 72 65 20 73 68 61 72 65 64 20 62 65 74 77   are shared betw
1230: 65 65 6e 20 74 68 65 20 4e 54 44 42 20 61 6e 64  een the NTDB and
1240: 0a 09 23 20 54 72 75 6e 6b 20 6f 6e 74 6f 20 74  ..# Trunk onto t
1250: 68 65 20 74 72 75 6e 6b 2c 20 70 72 65 76 65 6e  he trunk, preven
1260: 74 69 6e 67 20 74 68 65 69 72 20 64 65 6c 65 74  ting their delet
1270: 69 6f 6e 20 6c 61 74 65 72 2e 20 57 65 0a 09 23  ion later. We..#
1280: 20 68 61 76 65 20 63 6f 64 65 20 66 6f 72 20 74   have code for t
1290: 68 61 74 20 69 6e 20 27 66 69 6c 65 27 2c 20 68  hat in 'file', h
12a0: 6f 77 65 76 65 72 20 74 68 61 74 20 6f 70 65 72  owever that oper
12b0: 61 74 65 64 20 6f 6e 20 74 68 65 0a 09 23 20 69  ated on the..# i
12c0: 6e 2d 6d 65 6d 6f 72 79 20 72 65 76 69 73 69 6f  n-memory revisio
12d0: 6e 20 6f 62 6a 65 63 74 73 2c 20 77 68 69 63 68  n objects, which
12e0: 20 77 65 20 64 6f 20 6e 6f 74 20 68 61 76 65 20   we do not have 
12f0: 68 65 72 65 2e 20 57 65 20 64 6f 0a 09 23 20 74  here. We do..# t
1300: 68 65 20 73 61 6d 65 20 6e 6f 77 20 77 69 74 68  he same now with
1310: 6f 75 74 20 6f 62 6a 65 63 74 2c 20 62 79 20 64  out object, by d
1320: 69 72 65 63 74 6c 79 20 6d 61 6e 69 70 75 6c 61  irectly manipula
1330: 74 69 6e 67 20 74 68 65 0a 09 23 20 6c 69 6e 6b  ting the..# link
1340: 73 20 69 6e 20 74 68 65 20 64 61 74 61 62 61 73  s in the databas
1350: 65 2e 0a 0a 09 61 72 72 61 79 20 73 65 74 20 6e  e....array set n
1360: 74 64 62 20 7b 7d 0a 09 61 72 72 61 79 20 73 65  tdb {}..array se
1370: 74 20 6c 69 6e 6b 20 7b 7d 0a 0a 09 66 6f 72 65  t link {}...fore
1380: 61 63 68 20 7b 69 64 20 70 61 72 65 6e 74 20 74  ach {id parent t
1390: 72 61 6e 73 66 65 72 7d 20 5b 73 74 61 74 65 20  ransfer} [state 
13a0: 72 75 6e 20 7b 0a 09 20 20 20 20 53 45 4c 45 43  run {..    SELEC
13b0: 54 20 52 2e 72 69 64 2c 20 52 2e 70 61 72 65 6e  T R.rid, R.paren
13c0: 74 2c 20 52 2e 64 62 63 68 69 6c 64 0a 09 20 20  t, R.dbchild..  
13d0: 20 20 46 52 4f 4d 20 20 72 65 76 69 73 69 6f 6e    FROM  revision
13e0: 20 52 2c 20 73 79 6d 62 6f 6c 20 53 0a 09 20 20   R, symbol S..  
13f0: 20 20 57 48 45 52 45 20 52 2e 6c 6f 64 20 3d 20    WHERE R.lod = 
1400: 53 2e 73 69 64 20 20 20 20 20 20 20 20 20 20 20  S.sid           
1410: 20 2d 2d 20 47 65 74 20 73 79 6d 62 6f 6c 20 6f   -- Get symbol o
1420: 66 20 6c 69 6e 65 2d 6f 66 2d 64 65 76 65 6c 6f  f line-of-develo
1430: 70 6d 65 6e 74 20 6f 66 20 61 6c 6c 20 72 65 76  pment of all rev
1440: 69 73 69 6f 6e 73 0a 09 20 20 20 20 41 4e 44 20  isions..    AND 
1450: 20 20 53 2e 73 69 64 20 49 4e 20 65 78 63 6c 75    S.sid IN exclu
1460: 64 65 64 73 79 6d 62 6f 6c 73 20 2d 2d 20 52 65  dedsymbols -- Re
1470: 73 74 72 69 63 74 20 74 6f 20 74 68 65 20 65 78  strict to the ex
1480: 63 6c 75 64 65 64 20 73 79 6d 62 6f 6c 73 0a 09  cluded symbols..
1490: 20 20 20 20 41 4e 44 20 20 20 52 2e 69 73 64 65      AND   R.isde
14a0: 66 61 75 6c 74 20 20 20 20 20 20 20 20 20 20 20  fault           
14b0: 20 20 20 2d 2d 20 52 65 73 74 72 69 63 74 20 74     -- Restrict t
14c0: 6f 20 4e 54 44 42 20 72 65 76 69 73 69 6f 6e 73  o NTDB revisions
14d0: 0a 09 7d 5d 20 7b 0a 09 20 20 20 20 73 65 74 20  ..}] {..    set 
14e0: 6e 74 64 62 28 24 69 64 29 20 24 70 61 72 65 6e  ntdb($id) $paren
14f0: 74 0a 09 20 20 20 20 69 66 20 7b 24 74 72 61 6e  t..    if {$tran
1500: 73 66 65 72 20 65 71 20 22 22 7d 20 63 6f 6e 74  sfer eq ""} cont
1510: 69 6e 75 65 0a 09 20 20 20 20 73 65 74 20 6c 69  inue..    set li
1520: 6e 6b 28 24 69 64 29 20 24 74 72 61 6e 73 66 65  nk($id) $transfe
1530: 72 0a 09 7d 0a 0a 09 66 6f 72 65 61 63 68 20 6a  r..}...foreach j
1540: 6f 69 6e 74 20 5b 61 72 72 61 79 20 6e 61 6d 65  oint [array name
1550: 73 20 6c 69 6e 6b 5d 20 7b 0a 09 20 20 20 20 23  s link] {..    #
1560: 20 54 68 65 20 6a 6f 69 6e 74 73 20 61 72 65 20   The joints are 
1570: 74 68 65 20 68 69 67 68 65 73 74 20 4e 54 44 42  the highest NTDB
1580: 20 72 65 76 69 73 69 6f 6e 73 20 77 68 69 63 68   revisions which
1590: 20 61 72 65 0a 09 20 20 20 20 23 20 73 68 61 72   are..    # shar
15a0: 65 64 20 77 69 74 68 20 74 68 65 69 72 20 72 65  ed with their re
15b0: 73 70 65 63 74 69 76 65 20 74 72 75 6e 6b 2e 20  spective trunk. 
15c0: 57 65 20 64 69 73 63 6f 6e 6e 65 63 74 20 66 72  We disconnect fr
15d0: 6f 6d 0a 09 20 20 20 20 23 20 74 68 65 69 72 20  om..    # their 
15e0: 4e 54 44 42 20 63 68 69 6c 64 72 65 6e 2c 20 61  NTDB children, a
15f0: 6e 64 20 6d 61 6b 65 20 74 68 65 6d 20 70 61 72  nd make them par
1600: 65 6e 74 73 20 6f 66 20 74 68 65 69 72 0a 09 20  ents of their.. 
1610: 20 20 20 23 20 27 64 62 63 68 69 6c 64 27 2e 20     # 'dbchild'. 
1620: 54 68 65 20 61 73 73 6f 63 69 61 74 65 64 20 27  The associated '
1630: 64 62 70 61 72 65 6e 74 27 20 69 73 20 73 71 75  dbparent' is squ
1640: 61 73 68 65 64 0a 09 20 20 20 20 23 20 69 6e 73  ashed..    # ins
1650: 74 65 61 64 2e 20 41 6c 6c 20 70 61 72 65 6e 74  tead. All parent
1660: 73 20 6f 66 20 74 68 65 20 6a 6f 69 6e 74 73 20  s of the joints 
1670: 61 72 65 20 6d 6f 76 65 64 20 74 6f 20 74 68 65  are moved to the
1680: 0a 09 20 20 20 20 23 20 74 72 75 6e 6b 20 61 73  ..    # trunk as
1690: 20 77 65 6c 6c 2e 0a 0a 09 20 20 20 20 73 65 74   well....    set
16a0: 20 74 6a 6f 69 6e 74 20 24 6c 69 6e 6b 28 24 6a   tjoint $link($j
16b0: 6f 69 6e 74 29 0a 09 20 20 20 20 73 65 74 20 74  oint)..    set t
16c0: 6c 6f 64 20 5b 73 74 61 74 65 20 6f 6e 65 20 7b  lod [state one {
16d0: 0a 09 09 53 45 4c 45 43 54 20 6c 6f 64 20 46 52  ...SELECT lod FR
16e0: 4f 4d 20 72 65 76 69 73 69 6f 6e 20 57 48 45 52  OM revision WHER
16f0: 45 20 72 69 64 20 3d 20 24 74 6a 6f 69 6e 74 0a  E rid = $tjoint.
1700: 09 20 20 20 20 7d 5d 0a 0a 09 20 20 20 20 23 20  .    }]...    # 
1710: 43 6f 76 6e 65 72 74 20 64 62 2f 70 61 72 65 6e  Covnert db/paren
1720: 74 2f 63 68 69 6c 64 20 69 6e 74 6f 20 72 65 67  t/child into reg
1730: 75 6c 61 72 20 70 61 72 65 6e 74 2f 63 68 69 6c  ular parent/chil
1740: 64 20 6c 69 6e 6b 73 2e 0a 09 20 20 20 20 73 74  d links...    st
1750: 61 74 65 20 72 75 6e 20 7b 0a 09 09 55 50 44 41  ate run {...UPDA
1760: 54 45 20 72 65 76 69 73 69 6f 6e 20 53 45 54 20  TE revision SET 
1770: 64 62 70 61 72 65 6e 74 20 3d 20 4e 55 4c 4c 2c  dbparent = NULL,
1780: 20 70 61 72 65 6e 74 20 3d 20 24 6a 6f 69 6e 74   parent = $joint
1790: 20 20 57 48 45 52 45 20 72 69 64 20 3d 20 24 74    WHERE rid = $t
17a0: 6a 6f 69 6e 74 20 3b 0a 09 09 55 50 44 41 54 45  joint ;...UPDATE
17b0: 20 72 65 76 69 73 69 6f 6e 20 53 45 54 20 64 62   revision SET db
17c0: 63 68 69 6c 64 20 20 3d 20 4e 55 4c 4c 2c 20 63  child  = NULL, c
17d0: 68 69 6c 64 20 20 3d 20 24 74 6a 6f 69 6e 74 20  hild  = $tjoint 
17e0: 57 48 45 52 45 20 72 69 64 20 3d 20 24 6a 6f 69  WHERE rid = $joi
17f0: 6e 74 20 20 3b 0a 09 20 20 20 20 7d 0a 09 20 20  nt  ;..    }..  
1800: 20 20 77 68 69 6c 65 20 7b 31 7d 20 7b 0a 09 09    while {1} {...
1810: 23 20 4d 6f 76 65 20 74 68 65 20 4e 54 44 42 20  # Move the NTDB 
1820: 74 72 75 6e 6b 20 72 65 76 69 73 69 6f 6e 73 20  trunk revisions 
1830: 74 6f 20 74 72 75 6e 6b 2e 0a 09 09 73 74 61 74  to trunk....stat
1840: 65 20 72 75 6e 20 7b 0a 09 09 20 20 20 20 55 50  e run {...    UP
1850: 44 41 54 45 20 72 65 76 69 73 69 6f 6e 20 53 45  DATE revision SE
1860: 54 20 6c 6f 64 20 3d 20 24 74 6c 6f 64 2c 20 69  T lod = $tlod, i
1870: 73 64 65 66 61 75 6c 74 20 3d 20 30 20 57 48 45  sdefault = 0 WHE
1880: 52 45 20 72 69 64 20 3d 20 24 6a 6f 69 6e 74 0a  RE rid = $joint.
1890: 09 09 7d 0a 09 09 73 65 74 20 6c 61 73 74 20 24  ..}...set last $
18a0: 6a 6f 69 6e 74 0a 09 09 73 65 74 20 6a 6f 69 6e  joint...set join
18b0: 74 20 24 6e 74 64 62 28 24 6a 6f 69 6e 74 29 0a  t $ntdb($joint).
18c0: 09 09 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69  ..if {![info exi
18d0: 73 74 73 20 6e 74 64 62 28 24 6a 6f 69 6e 74 29  sts ntdb($joint)
18e0: 5d 7d 20 62 72 65 61 6b 0a 09 20 20 20 20 7d 0a  ]} break..    }.
18f0: 0a 09 20 20 20 20 23 20 52 65 61 63 68 65 64 20  ..    # Reached 
1900: 74 68 65 20 4e 54 44 42 20 62 61 73 69 73 20 69  the NTDB basis i
1910: 6e 20 74 68 65 20 74 72 75 6e 6b 2e 20 46 69 6e  n the trunk. Fin
1920: 61 6c 69 7a 65 20 74 68 65 0a 09 20 20 20 20 23  alize the..    #
1930: 20 70 61 72 65 6e 74 2f 63 68 69 6c 64 20 6c 69   parent/child li
1940: 6e 6b 61 67 65 20 61 6e 64 20 73 71 75 61 73 68  nkage and squash
1950: 20 74 68 65 20 62 72 61 6e 63 68 20 70 61 72 65   the branch pare
1960: 6e 74 20 73 79 6d 62 6f 6c 0a 09 20 20 20 20 23  nt symbol..    #
1970: 20 72 65 66 65 72 65 6e 63 65 2e 0a 0a 09 20 20   reference....  
1980: 20 20 73 74 61 74 65 20 72 75 6e 20 7b 0a 09 09    state run {...
1990: 55 50 44 41 54 45 20 72 65 76 69 73 69 6f 6e 20  UPDATE revision 
19a0: 53 45 54 20 63 68 69 6c 64 20 20 20 3d 20 24 6c  SET child   = $l
19b0: 61 73 74 20 57 48 45 52 45 20 72 69 64 20 3d 20  ast WHERE rid = 
19c0: 24 6a 6f 69 6e 74 20 3b 0a 09 09 55 50 44 41 54  $joint ;...UPDAT
19d0: 45 20 72 65 76 69 73 69 6f 6e 20 53 45 54 20 62  E revision SET b
19e0: 70 61 72 65 6e 74 20 3d 20 4e 55 4c 4c 20 20 57  parent = NULL  W
19f0: 48 45 52 45 20 72 69 64 20 3d 20 24 6c 61 73 74  HERE rid = $last
1a00: 20 20 3b 0a 09 20 20 20 20 7d 0a 09 7d 0a 0a 09    ;..    }..}...
1a10: 23 20 4e 6f 77 20 74 68 61 74 20 74 68 65 20 73  # Now that the s
1a20: 70 65 63 69 61 6c 20 63 61 73 65 20 69 73 20 64  pecial case is d
1a30: 6f 6e 65 20 77 65 20 63 61 6e 20 73 69 6d 70 6c  one we can simpl
1a40: 79 20 6b 69 6c 6c 20 61 6c 6c 20 74 68 65 0a 09  y kill all the..
1a50: 23 20 72 65 76 69 73 69 6f 6e 73 2c 20 74 61 67  # revisions, tag
1a60: 73 2c 20 61 6e 64 20 62 72 61 6e 63 68 65 73 20  s, and branches 
1a70: 72 65 66 65 72 65 6e 63 69 6e 67 20 61 6e 79 20  referencing any 
1a80: 6f 66 20 74 68 65 0a 09 23 20 65 78 63 6c 75 64  of the..# exclud
1a90: 65 64 20 73 79 6d 62 6f 6c 73 20 69 6e 20 73 6f  ed symbols in so
1aa0: 6d 65 20 77 61 79 2e 20 54 68 69 73 20 69 73 20  me way. This is 
1ab0: 65 61 73 79 20 61 73 20 77 65 20 64 6f 20 6e 6f  easy as we do no
1ac0: 74 20 68 61 76 65 0a 09 23 20 74 6f 20 73 65 6c  t have..# to sel
1ad0: 65 63 74 20 74 68 65 6d 20 61 67 61 69 6e 20 61  ect them again a
1ae0: 6e 64 20 61 67 61 69 6e 20 66 72 6f 6d 20 74 68  nd again from th
1af0: 65 20 62 61 73 65 20 74 61 62 6c 65 73 20 61 6e  e base tables an
1b00: 79 0a 09 23 20 6c 6f 6e 67 65 72 2e 0a 0a 09 73  y..# longer....s
1b10: 74 61 74 65 20 72 75 6e 20 7b 0a 09 20 20 20 20  tate run {..    
1b20: 43 52 45 41 54 45 20 54 45 4d 50 4f 52 41 52 59  CREATE TEMPORARY
1b30: 20 54 41 42 4c 45 20 65 78 63 6c 75 64 65 64 72   TABLE excludedr
1b40: 65 76 69 73 69 6f 6e 73 20 41 53 0a 09 20 20 20  evisions AS..   
1b50: 20 53 45 4c 45 43 54 20 72 69 64 20 46 52 4f 4d   SELECT rid FROM
1b60: 20 72 65 76 69 73 69 6f 6e 20 57 48 45 52 45 20   revision WHERE 
1b70: 6c 6f 64 20 49 4e 20 65 78 63 6c 75 64 65 64 73  lod IN excludeds
1b80: 79 6d 62 6f 6c 73 3b 0a 0a 09 20 20 20 20 44 45  ymbols;...    DE
1b90: 4c 45 54 45 20 46 52 4f 4d 20 72 65 76 69 73 69  LETE FROM revisi
1ba0: 6f 6e 20 57 48 45 52 45 20 6c 6f 64 20 49 4e 20  on WHERE lod IN 
1bb0: 65 78 63 6c 75 64 65 64 73 79 6d 62 6f 6c 73 3b  excludedsymbols;
1bc0: 0a 09 20 20 20 20 44 45 4c 45 54 45 20 46 52 4f  ..    DELETE FRO
1bd0: 4d 20 74 61 67 20 20 20 20 20 20 57 48 45 52 45  M tag      WHERE
1be0: 20 6c 6f 64 20 49 4e 20 65 78 63 6c 75 64 65 64   lod IN excluded
1bf0: 73 79 6d 62 6f 6c 73 3b 0a 09 20 20 20 20 44 45  symbols;..    DE
1c00: 4c 45 54 45 20 46 52 4f 4d 20 74 61 67 20 20 20  LETE FROM tag   
1c10: 20 20 20 57 48 45 52 45 20 73 69 64 20 49 4e 20     WHERE sid IN 
1c20: 65 78 63 6c 75 64 65 64 73 79 6d 62 6f 6c 73 3b  excludedsymbols;
1c30: 0a 09 20 20 20 20 44 45 4c 45 54 45 20 46 52 4f  ..    DELETE FRO
1c40: 4d 20 62 72 61 6e 63 68 20 20 20 57 48 45 52 45  M branch   WHERE
1c50: 20 6c 6f 64 20 49 4e 20 65 78 63 6c 75 64 65 64   lod IN excluded
1c60: 73 79 6d 62 6f 6c 73 3b 0a 09 20 20 20 20 44 45  symbols;..    DE
1c70: 4c 45 54 45 20 46 52 4f 4d 20 62 72 61 6e 63 68  LETE FROM branch
1c80: 20 20 20 57 48 45 52 45 20 73 69 64 20 49 4e 20     WHERE sid IN 
1c90: 65 78 63 6c 75 64 65 64 73 79 6d 62 6f 6c 73 3b  excludedsymbols;
1ca0: 0a 0a 09 20 20 20 20 44 45 4c 45 54 45 20 46 52  ...    DELETE FR
1cb0: 4f 4d 20 72 65 76 69 73 69 6f 6e 62 72 61 6e 63  OM revisionbranc
1cc0: 68 63 68 69 6c 64 72 65 6e 20 57 48 45 52 45 20  hchildren WHERE 
1cd0: 72 69 64 20 20 49 4e 20 65 78 63 6c 75 64 65 64  rid  IN excluded
1ce0: 72 65 76 69 73 69 6f 6e 73 3b 0a 09 20 20 20 20  revisions;..    
1cf0: 44 45 4c 45 54 45 20 46 52 4f 4d 20 72 65 76 69  DELETE FROM revi
1d00: 73 69 6f 6e 62 72 61 6e 63 68 63 68 69 6c 64 72  sionbranchchildr
1d10: 65 6e 20 57 48 45 52 45 20 62 72 69 64 20 49 4e  en WHERE brid IN
1d20: 20 65 78 63 6c 75 64 65 64 72 65 76 69 73 69 6f   excludedrevisio
1d30: 6e 73 3b 0a 09 20 20 20 20 44 45 4c 45 54 45 20  ns;..    DELETE 
1d40: 46 52 4f 4d 20 62 6c 6f 62 20 20 20 20 20 20 20  FROM blob       
1d50: 20 20 20 20 20 20 20 20 20 20 20 20 57 48 45 52              WHER
1d60: 45 20 72 69 64 20 20 49 4e 20 65 78 63 6c 75 64  E rid  IN exclud
1d70: 65 64 72 65 76 69 73 69 6f 6e 73 3b 0a 0a 09 20  edrevisions;... 
1d80: 20 20 20 44 52 4f 50 20 54 41 42 4c 45 20 65 78     DROP TABLE ex
1d90: 63 6c 75 64 65 64 72 65 76 69 73 69 6f 6e 73 3b  cludedrevisions;
1da0: 0a 09 20 20 20 20 44 52 4f 50 20 54 41 42 4c 45  ..    DROP TABLE
1db0: 20 65 78 63 6c 75 64 65 64 73 79 6d 62 6f 6c 73   excludedsymbols
1dc0: 3b 0a 09 7d 0a 09 72 65 74 75 72 6e 0a 20 20 20  ;..}..return.   
1dd0: 20 7d 0a 0a 20 20 20 20 70 72 6f 63 20 4d 75 74   }..    proc Mut
1de0: 61 74 65 53 79 6d 62 6f 6c 73 20 7b 7d 20 7b 0a  ateSymbols {} {.
1df0: 09 23 20 4e 65 78 74 2c 20 6e 6f 77 20 74 68 61  .# Next, now tha
1e00: 74 20 77 65 20 6b 6e 6f 77 20 77 68 69 63 68 20  t we know which 
1e10: 73 79 6d 62 6f 6c 73 20 61 72 65 20 77 68 61 74  symbols are what
1e20: 20 77 65 20 6c 6f 6f 6b 20 66 6f 72 0a 09 23 20   we look for..# 
1e30: 66 69 6c 65 20 6c 65 76 65 6c 20 74 61 67 73 20  file level tags 
1e40: 77 68 69 63 68 20 61 72 65 20 61 63 74 75 61 6c  which are actual
1e50: 6c 79 20 63 6f 6e 76 65 72 74 65 64 20 61 73 20  ly converted as 
1e60: 62 72 61 6e 63 68 65 73 0a 09 23 20 28 70 72 6f  branches..# (pro
1e70: 6a 65 63 74 20 6c 65 76 65 6c 2c 20 61 6e 64 20  ject level, and 
1e80: 76 69 63 65 20 76 65 72 73 61 29 2c 20 61 6e 64  vice versa), and
1e90: 20 6d 6f 76 65 20 74 68 65 6d 20 74 6f 20 74 68   move them to th
1ea0: 65 0a 09 23 20 63 6f 72 72 65 63 74 20 74 61 62  e..# correct tab
1eb0: 6c 65 73 2e 0a 0a 09 23 20 23 20 23 23 20 23 23  les....# # ## ##
1ec0: 23 20 23 23 23 23 23 20 23 23 23 23 23 23 23 23  # ##### ########
1ed0: 20 23 23 23 23 23 23 23 23 23 23 23 23 23 0a 0a   #############..
1ee0: 09 6c 6f 67 20 77 72 69 74 65 20 33 20 66 69 6c  .log write 3 fil
1ef0: 74 65 72 73 79 6d 20 22 4d 75 74 61 74 65 20 73  tersym "Mutate s
1f00: 79 6d 62 6f 6c 73 2c 20 70 72 65 70 61 72 61 74  ymbols, preparat
1f10: 69 6f 6e 22 0a 0a 09 73 65 74 20 62 72 61 6e 63  ion"...set branc
1f20: 68 20 5b 70 72 6f 6a 65 63 74 3a 3a 73 79 6d 20  h [project::sym 
1f30: 62 72 61 6e 63 68 5d 0a 09 73 65 74 20 74 61 67  branch]..set tag
1f40: 20 20 20 20 5b 70 72 6f 6a 65 63 74 3a 3a 73 79      [project::sy
1f50: 6d 20 74 61 67 5d 0a 0a 09 73 65 74 20 74 61 67  m tag]...set tag
1f60: 73 74 6f 6d 75 74 61 74 65 20 5b 73 74 61 74 65  stomutate [state
1f70: 20 72 75 6e 20 7b 0a 09 20 20 20 20 53 45 4c 45   run {..    SELE
1f80: 43 54 20 54 2e 74 69 64 2c 20 54 2e 66 69 64 2c  CT T.tid, T.fid,
1f90: 20 54 2e 6c 6f 64 2c 20 54 2e 73 69 64 2c 20 54   T.lod, T.sid, T
1fa0: 2e 72 65 76 0a 09 20 20 20 20 46 52 4f 4d 20 74  .rev..    FROM t
1fb0: 61 67 20 54 2c 20 73 79 6d 62 6f 6c 20 53 0a 09  ag T, symbol S..
1fc0: 20 20 20 20 57 48 45 52 45 20 54 2e 73 69 64 20      WHERE T.sid 
1fd0: 3d 20 53 2e 73 69 64 0a 09 20 20 20 20 41 4e 44  = S.sid..    AND
1fe0: 20 53 2e 74 79 70 65 20 3d 20 24 62 72 61 6e 63   S.type = $branc
1ff0: 68 0a 09 7d 5d 0a 0a 09 73 65 74 20 62 72 61 6e  h..}]...set bran
2000: 63 68 65 73 74 6f 6d 75 74 61 74 65 20 5b 73 74  chestomutate [st
2010: 61 74 65 20 72 75 6e 20 7b 0a 09 20 20 20 20 53  ate run {..    S
2020: 45 4c 45 43 54 20 42 2e 62 69 64 2c 20 42 2e 66  ELECT B.bid, B.f
2030: 69 64 2c 20 42 2e 6c 6f 64 2c 20 42 2e 73 69 64  id, B.lod, B.sid
2040: 2c 20 42 2e 72 6f 6f 74 2c 20 42 2e 66 69 72 73  , B.root, B.firs
2050: 74 2c 20 42 2e 62 72 61 0a 09 20 20 20 20 46 52  t, B.bra..    FR
2060: 4f 4d 20 62 72 61 6e 63 68 20 42 2c 20 73 79 6d  OM branch B, sym
2070: 62 6f 6c 20 53 0a 09 20 20 20 20 57 48 45 52 45  bol S..    WHERE
2080: 20 42 2e 73 69 64 20 3d 20 53 2e 73 69 64 0a 09   B.sid = S.sid..
2090: 20 20 20 20 41 4e 44 20 53 2e 74 79 70 65 20 3d      AND S.type =
20a0: 20 24 74 61 67 0a 09 7d 5d 0a 0a 09 73 65 74 20   $tag..}]...set 
20b0: 6e 74 20 5b 65 78 70 72 20 7b 5b 6c 6c 65 6e 67  nt [expr {[lleng
20c0: 74 68 20 24 74 61 67 73 74 6f 6d 75 74 61 74 65  th $tagstomutate
20d0: 5d 2f 35 7d 5d 0a 09 73 65 74 20 6e 62 20 5b 65  ]/5}]..set nb [e
20e0: 78 70 72 20 7b 5b 6c 6c 65 6e 67 74 68 20 24 62  xpr {[llength $b
20f0: 72 61 6e 63 68 65 73 74 6f 6d 75 74 61 74 65 5d  ranchestomutate]
2100: 2f 37 7d 5d 0a 0a 09 6c 6f 67 20 77 72 69 74 65  /7}]...log write
2110: 20 34 20 66 69 6c 74 65 72 73 79 6d 20 22 43 68   4 filtersym "Ch
2120: 61 6e 67 69 6e 67 20 5b 6e 73 70 20 24 6e 74 20  anging [nsp $nt 
2130: 74 61 67 5d 20 69 6e 74 6f 20 20 5b 6e 73 70 20  tag] into  [nsp 
2140: 24 6e 74 20 62 72 61 6e 63 68 20 62 72 61 6e 63  $nt branch branc
2150: 68 65 73 5d 22 0a 09 6c 6f 67 20 77 72 69 74 65  hes]"..log write
2160: 20 34 20 66 69 6c 74 65 72 73 79 6d 20 22 43 68   4 filtersym "Ch
2170: 61 6e 67 69 6e 67 20 5b 6e 73 70 20 24 6e 62 20  anging [nsp $nb 
2180: 62 72 61 6e 63 68 20 62 72 61 6e 63 68 65 73 5d  branch branches]
2190: 20 69 6e 74 6f 20 20 5b 6e 73 70 20 24 6e 62 20   into  [nsp $nb 
21a0: 74 61 67 5d 22 0a 0a 09 23 20 23 20 23 23 20 23  tag]"...# # ## #
21b0: 23 23 20 23 23 23 23 23 20 23 23 23 23 23 23 23  ## ##### #######
21c0: 23 20 23 23 23 23 23 23 23 23 23 23 23 23 23 0a  # #############.
21d0: 0a 09 6c 6f 67 20 77 72 69 74 65 20 33 20 66 69  ..log write 3 fi
21e0: 6c 74 65 72 73 79 6d 20 22 4d 75 74 61 74 65 20  ltersym "Mutate 
21f0: 74 61 67 73 20 74 6f 20 62 72 61 6e 63 68 65 73  tags to branches
2200: 22 0a 0a 09 66 6f 72 65 61 63 68 20 7b 69 64 20  "...foreach {id 
2210: 66 69 64 20 6c 6f 64 20 73 69 64 20 72 65 76 7d  fid lod sid rev}
2220: 20 24 74 61 67 73 74 6f 6d 75 74 61 74 65 20 7b   $tagstomutate {
2230: 0a 09 20 20 20 20 73 74 61 74 65 20 72 75 6e 20  ..    state run 
2240: 7b 0a 09 09 44 45 4c 45 54 45 20 46 52 4f 4d 20  {...DELETE FROM 
2250: 74 61 67 20 57 48 45 52 45 20 74 69 64 20 3d 20  tag WHERE tid = 
2260: 24 69 64 20 3b 0a 09 09 49 4e 53 45 52 54 20 49  $id ;...INSERT I
2270: 4e 54 4f 20 62 72 61 6e 63 68 20 28 62 69 64 2c  NTO branch (bid,
2280: 20 66 69 64 2c 20 20 6c 6f 64 2c 20 20 73 69 64   fid,  lod,  sid
2290: 2c 20 20 72 6f 6f 74 2c 20 66 69 72 73 74 2c 20  ,  root, first, 
22a0: 62 72 61 2c 20 70 6f 73 29 0a 09 09 56 41 4c 55  bra, pos)...VALU
22b0: 45 53 20 20 20 20 20 20 20 20 20 20 20 20 20 28  ES             (
22c0: 24 69 64 2c 20 24 66 69 64 2c 20 24 6c 6f 64 2c  $id, $fid, $lod,
22d0: 20 24 73 69 64 2c 20 24 72 65 76 2c 20 4e 55 4c   $sid, $rev, NUL
22e0: 4c 2c 20 20 27 27 2c 20 20 2d 31 29 3b 0a 09 20  L,  '',  -1);.. 
22f0: 20 20 20 7d 0a 09 7d 0a 0a 09 6c 6f 67 20 77 72     }..}...log wr
2300: 69 74 65 20 33 20 66 69 6c 74 65 72 73 79 6d 20  ite 3 filtersym 
2310: 22 4f 6b 2e 22 0a 0a 09 23 20 23 20 23 23 20 23  "Ok."...# # ## #
2320: 23 23 20 23 23 23 23 23 20 23 23 23 23 23 23 23  ## ##### #######
2330: 23 20 23 23 23 23 23 23 23 23 23 23 23 23 23 0a  # #############.
2340: 0a 09 6c 6f 67 20 77 72 69 74 65 20 33 20 66 69  ..log write 3 fi
2350: 6c 74 65 72 73 79 6d 20 22 4d 75 74 61 74 65 20  ltersym "Mutate 
2360: 62 72 61 6e 63 68 65 73 20 74 6f 20 74 61 67 73  branches to tags
2370: 22 0a 0a 09 66 6f 72 65 61 63 68 20 7b 69 64 20  "...foreach {id 
2380: 66 69 64 20 6c 6f 64 20 73 69 64 20 72 6f 6f 74  fid lod sid root
2390: 20 66 69 72 73 74 20 62 72 61 7d 20 24 62 72 61   first bra} $bra
23a0: 6e 63 68 65 73 74 6f 6d 75 74 61 74 65 20 7b 0a  nchestomutate {.
23b0: 09 20 20 20 20 73 74 61 74 65 20 72 75 6e 20 7b  .    state run {
23c0: 0a 09 09 44 45 4c 45 54 45 20 46 52 4f 4d 20 62  ...DELETE FROM b
23d0: 72 61 6e 63 68 20 57 48 45 52 45 20 62 69 64 20  ranch WHERE bid 
23e0: 3d 20 24 69 64 20 3b 0a 09 09 49 4e 53 45 52 54  = $id ;...INSERT
23f0: 20 49 4e 54 4f 20 74 61 67 20 28 74 69 64 2c 20   INTO tag (tid, 
2400: 66 69 64 2c 20 20 6c 6f 64 2c 20 20 73 69 64 2c  fid,  lod,  sid,
2410: 20 20 72 65 76 29 0a 09 09 56 41 4c 55 45 53 20    rev)...VALUES 
2420: 20 20 20 20 20 20 20 20 20 28 24 69 64 2c 20 24           ($id, $
2430: 66 69 64 2c 20 24 6c 6f 64 2c 20 24 73 69 64 2c  fid, $lod, $sid,
2440: 20 24 72 6f 6f 74 29 3b 0a 09 20 20 20 20 7d 0a   $root);..    }.
2450: 09 7d 0a 0a 09 6c 6f 67 20 77 72 69 74 65 20 33  .}...log write 3
2460: 20 66 69 6c 74 65 72 73 79 6d 20 22 4f 6b 2e 22   filtersym "Ok."
2470: 0a 0a 09 23 20 23 20 23 23 20 23 23 23 20 23 23  ...# # ## ### ##
2480: 23 23 23 20 23 23 23 23 23 23 23 23 20 23 23 23  ### ######## ###
2490: 23 23 23 23 23 23 23 23 23 23 0a 09 72 65 74 75  ##########..retu
24a0: 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 23 20  rn.    }..    # 
24b0: 41 64 6a 75 73 74 20 74 68 65 20 70 61 72 65 6e  Adjust the paren
24c0: 74 73 20 6f 66 20 73 79 6d 62 6f 6c 73 20 74 6f  ts of symbols to
24d0: 20 74 68 65 69 72 20 70 72 65 66 65 72 72 65 64   their preferred
24e0: 20 70 61 72 65 6e 74 73 2e 0a 0a 20 20 20 20 23   parents...    #
24f0: 20 49 66 20 61 20 66 69 6c 65 20 6c 65 76 65 6c   If a file level
2500: 20 79 6d 62 6f 6c 20 68 61 73 20 61 20 70 72 65   ymbol has a pre
2510: 66 65 72 72 65 64 20 70 61 72 65 6e 74 20 74 68  ferred parent th
2520: 61 74 20 69 73 20 64 69 66 66 65 72 65 6e 74 0a  at is different.
2530: 20 20 20 20 23 20 74 68 61 6e 20 69 74 73 20 63      # than its c
2540: 75 72 72 65 6e 74 20 70 61 72 65 6e 74 2c 20 61  urrent parent, a
2550: 6e 64 20 69 66 20 74 68 65 20 70 72 65 66 65 72  nd if the prefer
2560: 72 65 64 20 70 61 72 65 6e 74 20 69 73 20 61 6e  red parent is an
2570: 0a 20 20 20 20 23 20 61 6c 6c 6f 77 65 64 20 70  .    # allowed p
2580: 61 72 65 6e 74 20 6f 66 20 74 68 65 20 73 79 6d  arent of the sym
2590: 62 6f 6c 20 69 6e 20 74 68 69 73 20 66 69 6c 65  bol in this file
25a0: 2c 20 74 68 65 6e 20 77 65 20 67 72 61 66 74 20  , then we graft 
25b0: 74 68 65 0a 20 20 20 20 23 20 61 53 79 6d 62 6f  the.    # aSymbo
25c0: 6c 20 6f 6e 74 6f 20 69 74 73 20 70 72 65 66 65  l onto its prefe
25d0: 72 72 65 64 20 70 61 72 65 6e 74 2e 0a 0a 20 20  rred parent...  
25e0: 20 20 70 72 6f 63 20 41 64 6a 75 73 74 50 61 72    proc AdjustPar
25f0: 65 6e 74 73 20 7b 7d 20 7b 0a 09 6c 6f 67 20 77  ents {} {..log w
2600: 72 69 74 65 20 33 20 66 69 6c 74 65 72 73 79 6d  rite 3 filtersym
2610: 20 22 41 64 6a 75 73 74 20 70 61 72 65 6e 74 73   "Adjust parents
2620: 2c 20 6c 6f 61 64 69 6e 67 20 64 61 74 61 20 69  , loading data i
2630: 6e 20 70 72 65 70 61 72 61 74 69 6f 6e 22 0a 0a  n preparation"..
2640: 09 23 20 57 65 20 70 75 6c 6c 20 69 6d 70 6f 72  .# We pull impor
2650: 74 61 6e 74 20 6d 61 70 73 20 6f 6e 63 65 20 69  tant maps once i
2660: 6e 74 6f 20 6d 65 6d 6f 72 79 20 73 6f 20 74 68  nto memory so th
2670: 61 74 20 77 65 20 64 6f 20 71 75 69 63 6b 0a 09  at we do quick..
2680: 23 20 68 61 73 68 20 6c 6f 6f 6b 75 70 20 6c 61  # hash lookup la
2690: 74 65 72 20 77 68 65 6e 20 70 72 6f 63 65 73 73  ter when process
26a0: 69 6e 67 20 74 68 65 20 67 72 61 66 74 20 63 61  ing the graft ca
26b0: 6e 64 69 64 61 74 65 73 2e 0a 0a 09 23 20 54 61  ndidates....# Ta
26c0: 67 2f 42 72 61 6e 63 68 20 6e 61 6d 65 73 20 2e  g/Branch names .
26d0: 2e 2e 0a 09 61 72 72 61 79 20 73 65 74 20 73 6e  ....array set sn
26e0: 20 5b 73 74 61 74 65 20 72 75 6e 20 7b 20 53 45   [state run { SE
26f0: 4c 45 43 54 20 54 2e 74 69 64 2c 20 53 2e 6e 61  LECT T.tid, S.na
2700: 6d 65 20 46 52 4f 4d 20 74 61 67 20 54 2c 20 20  me FROM tag T,  
2710: 20 20 73 79 6d 62 6f 6c 20 53 20 57 48 45 52 45    symbol S WHERE
2720: 20 54 2e 73 69 64 20 3d 20 53 2e 73 69 64 20 7d   T.sid = S.sid }
2730: 5d 0a 09 61 72 72 61 79 20 73 65 74 20 73 6e 20  ]..array set sn 
2740: 5b 73 74 61 74 65 20 72 75 6e 20 7b 20 53 45 4c  [state run { SEL
2750: 45 43 54 20 42 2e 62 69 64 2c 20 53 2e 6e 61 6d  ECT B.bid, S.nam
2760: 65 20 46 52 4f 4d 20 62 72 61 6e 63 68 20 42 2c  e FROM branch B,
2770: 20 73 79 6d 62 6f 6c 20 53 20 57 48 45 52 45 20   symbol S WHERE 
2780: 42 2e 73 69 64 20 3d 20 53 2e 73 69 64 20 7d 5d  B.sid = S.sid }]
2790: 0a 09 23 20 53 79 6d 62 6f 6c 20 6e 61 6d 65 73  ..# Symbol names
27a0: 20 2e 2e 2e 0a 09 61 72 72 61 79 20 73 65 74 20   .....array set 
27b0: 73 78 20 5b 73 74 61 74 65 20 72 75 6e 20 7b 20  sx [state run { 
27c0: 53 45 4c 45 43 54 20 4c 2e 73 69 64 2c 20 4c 2e  SELECT L.sid, L.
27d0: 6e 61 6d 65 20 46 52 4f 4d 20 73 79 6d 62 6f 6c  name FROM symbol
27e0: 20 4c 20 7d 5d 0a 09 23 20 46 69 6c 65 73 20 61   L }]..# Files a
27f0: 6e 64 20 70 72 6f 6a 65 63 74 73 2e 0a 09 61 72  nd projects...ar
2800: 72 61 79 20 73 65 74 20 66 70 6e 20 7b 7d 0a 09  ray set fpn {}..
2810: 66 6f 72 65 61 63 68 20 7b 69 64 20 66 6e 20 70  foreach {id fn p
2820: 6e 7d 20 5b 73 74 61 74 65 20 72 75 6e 20 7b 0a  n} [state run {.
2830: 09 09 53 45 4c 45 43 54 20 46 2e 66 69 64 2c 20  ..SELECT F.fid, 
2840: 46 2e 6e 61 6d 65 2c 20 50 2e 6e 61 6d 65 0a 09  F.name, P.name..
2850: 09 46 52 4f 4d 20 20 20 66 69 6c 65 20 46 2c 20  .FROM   file F, 
2860: 70 72 6f 6a 65 63 74 20 50 0a 09 09 57 48 45 52  project P...WHER
2870: 45 20 20 46 2e 70 69 64 20 3d 20 50 2e 70 69 64  E  F.pid = P.pid
2880: 0a 09 7d 5d 20 7b 20 73 65 74 20 66 70 6e 28 24  ..}] { set fpn($
2890: 69 64 29 20 5b 6c 69 73 74 20 24 66 6e 20 24 70  id) [list $fn $p
28a0: 6e 5d 20 7d 0a 0a 09 73 65 74 20 74 61 67 73 74  n] }...set tagst
28b0: 6f 61 64 6a 75 73 74 20 5b 73 74 61 74 65 20 72  oadjust [state r
28c0: 75 6e 20 7b 0a 09 20 20 20 20 53 45 4c 45 43 54  un {..    SELECT
28d0: 20 54 2e 74 69 64 2c 20 54 2e 66 69 64 2c 20 54   T.tid, T.fid, T
28e0: 2e 6c 6f 64 2c 20 50 2e 70 69 64 2c 20 53 2e 6e  .lod, P.pid, S.n
28f0: 61 6d 65 2c 20 52 2e 72 65 76 2c 20 52 2e 72 69  ame, R.rev, R.ri
2900: 64 0a 09 20 20 20 20 46 52 4f 4d 20 74 61 67 20  d..    FROM tag 
2910: 54 2c 20 70 72 65 66 65 72 65 64 70 61 72 65 6e  T, preferedparen
2920: 74 20 50 2c 20 73 79 6d 62 6f 6c 20 53 2c 20 72  t P, symbol S, r
2930: 65 76 69 73 69 6f 6e 20 52 0a 09 20 20 20 20 57  evision R..    W
2940: 48 45 52 45 20 54 2e 73 69 64 20 3d 20 50 2e 73  HERE T.sid = P.s
2950: 69 64 20 20 20 20 20 20 20 20 2d 2d 20 46 6f 72  id        -- For
2960: 20 61 6c 6c 20 74 61 67 73 2c 20 67 65 74 20 6c   all tags, get l
2970: 65 66 74 2d 68 61 6e 64 20 6f 66 20 70 72 65 66  eft-hand of pref
2980: 65 72 65 64 20 70 61 72 65 6e 74 20 76 69 61 20  ered parent via 
2990: 73 79 6d 62 6f 6c 0a 09 20 20 20 20 41 4e 44 20  symbol..    AND 
29a0: 20 20 54 2e 6c 6f 64 20 21 3d 20 50 2e 70 69 64    T.lod != P.pid
29b0: 20 20 20 20 20 20 20 2d 2d 20 52 65 73 74 72 69         -- Restri
29c0: 63 74 20 74 6f 20 74 61 67 73 20 77 68 6f 73 65  ct to tags whose
29d0: 20 4c 4f 44 20 69 73 20 6e 6f 74 20 74 68 65 69   LOD is not thei
29e0: 72 20 70 72 65 66 65 72 65 64 20 70 61 72 65 6e  r prefered paren
29f0: 74 0a 09 20 20 20 20 41 4e 44 20 20 20 50 2e 70  t..    AND   P.p
2a00: 69 64 20 3d 20 53 2e 73 69 64 20 20 20 20 20 20  id = S.sid      
2a10: 20 20 2d 2d 20 47 65 74 20 73 79 6d 62 6f 6c 20    -- Get symbol 
2a20: 6f 66 20 70 72 65 66 65 72 65 64 20 70 61 72 65  of prefered pare
2a30: 6e 74 0a 09 20 20 20 20 41 4e 44 20 20 20 53 2e  nt..    AND   S.
2a40: 6e 61 6d 65 20 21 3d 20 27 3a 74 72 75 6e 6b 3a  name != ':trunk:
2a50: 27 20 20 2d 2d 20 45 78 63 6c 75 64 65 20 74 72  '  -- Exclude tr
2a60: 75 6e 6b 20 70 61 72 65 6e 74 61 67 65 0a 09 20  unk parentage.. 
2a70: 20 20 20 41 4e 44 20 20 20 54 2e 72 65 76 20 3d     AND   T.rev =
2a80: 20 52 2e 72 69 64 20 20 20 20 20 20 20 20 2d 2d   R.rid        --
2a90: 20 47 65 74 20 72 65 76 69 73 69 6f 6e 20 74 68   Get revision th
2aa0: 65 20 74 61 67 20 69 73 20 61 74 74 61 63 68 65  e tag is attache
2ab0: 64 20 74 6f 2e 0a 09 7d 5d 0a 0a 09 73 65 74 20  d to...}]...set 
2ac0: 62 72 61 6e 63 68 65 73 74 6f 61 64 6a 75 73 74  branchestoadjust
2ad0: 20 5b 73 74 61 74 65 20 72 75 6e 20 7b 0a 09 20   [state run {.. 
2ae0: 20 20 20 53 45 4c 45 43 54 20 42 2e 62 69 64 2c     SELECT B.bid,
2af0: 20 42 2e 66 69 64 2c 20 42 2e 6c 6f 64 2c 20 42   B.fid, B.lod, B
2b00: 2e 70 6f 73 2c 20 50 2e 70 69 64 2c 20 53 2e 6e  .pos, P.pid, S.n
2b10: 61 6d 65 2c 20 4e 55 4c 4c 2c 20 4e 55 4c 4c 0a  ame, NULL, NULL.
2b20: 09 20 20 20 20 46 52 4f 4d 20 62 72 61 6e 63 68  .    FROM branch
2b30: 20 42 2c 20 70 72 65 66 65 72 65 64 70 61 72 65   B, preferedpare
2b40: 6e 74 20 50 2c 20 73 79 6d 62 6f 6c 20 53 0a 09  nt P, symbol S..
2b50: 20 20 20 20 57 48 45 52 45 20 42 2e 73 69 64 20      WHERE B.sid 
2b60: 3d 20 50 2e 73 69 64 20 20 20 20 20 20 20 20 2d  = P.sid        -
2b70: 2d 20 46 6f 72 20 61 6c 6c 20 62 72 61 6e 63 68  - For all branch
2b80: 65 73 2c 20 67 65 74 20 6c 65 66 74 2d 68 61 6e  es, get left-han
2b90: 64 20 6f 66 20 70 72 65 66 65 72 65 64 20 70 61  d of prefered pa
2ba0: 72 65 6e 74 20 76 69 61 20 73 79 6d 62 6f 6c 0a  rent via symbol.
2bb0: 09 20 20 20 20 41 4e 44 20 20 20 42 2e 6c 6f 64  .    AND   B.lod
2bc0: 20 21 3d 20 50 2e 70 69 64 20 20 20 20 20 20 20   != P.pid       
2bd0: 2d 2d 20 52 65 73 74 72 69 63 74 20 74 6f 20 62  -- Restrict to b
2be0: 72 61 6e 63 68 65 73 20 77 68 6f 73 65 20 4c 4f  ranches whose LO
2bf0: 44 20 69 73 20 6e 6f 74 20 74 68 65 69 72 20 70  D is not their p
2c00: 72 65 66 65 72 65 64 20 70 61 72 65 6e 74 0a 09  refered parent..
2c10: 20 20 20 20 41 4e 44 20 20 20 50 2e 70 69 64 20      AND   P.pid 
2c20: 3d 20 53 2e 73 69 64 20 20 20 20 20 20 20 20 2d  = S.sid        -
2c30: 2d 20 47 65 74 20 73 79 6d 62 6f 6c 20 6f 66 20  - Get symbol of 
2c40: 70 72 65 66 65 72 65 64 20 70 61 72 65 6e 74 0a  prefered parent.
2c50: 09 20 20 20 20 41 4e 44 20 20 20 53 2e 6e 61 6d  .    AND   S.nam
2c60: 65 20 21 3d 20 27 3a 74 72 75 6e 6b 3a 27 20 20  e != ':trunk:'  
2c70: 2d 2d 20 45 78 63 6c 75 64 65 20 74 72 75 6e 6b  -- Exclude trunk
2c80: 20 70 61 72 65 6e 74 61 67 65 0a 09 20 20 20 20   parentage..    
2c90: 41 4e 44 20 20 20 42 2e 72 6f 6f 74 20 49 53 20  AND   B.root IS 
2ca0: 4e 55 4c 4c 20 20 20 20 20 20 20 2d 2d 20 41 63  NULL       -- Ac
2cb0: 63 65 70 74 20 66 72 65 65 2d 66 6c 6f 61 74 69  cept free-floati
2cc0: 6e 67 20 62 72 61 6e 63 68 0a 20 20 20 20 55 4e  ng branch.    UN
2cd0: 49 4f 4e 0a 09 20 20 20 20 53 45 4c 45 43 54 20  ION..    SELECT 
2ce0: 42 2e 62 69 64 2c 20 42 2e 66 69 64 2c 20 42 2e  B.bid, B.fid, B.
2cf0: 6c 6f 64 2c 20 42 2e 70 6f 73 2c 20 50 2e 70 69  lod, B.pos, P.pi
2d00: 64 2c 20 53 2e 6e 61 6d 65 2c 20 52 2e 72 65 76  d, S.name, R.rev
2d10: 2c 20 52 2e 72 69 64 0a 09 20 20 20 20 46 52 4f  , R.rid..    FRO
2d20: 4d 20 62 72 61 6e 63 68 20 42 2c 20 70 72 65 66  M branch B, pref
2d30: 65 72 65 64 70 61 72 65 6e 74 20 50 2c 20 73 79  eredparent P, sy
2d40: 6d 62 6f 6c 20 53 2c 20 72 65 76 69 73 69 6f 6e  mbol S, revision
2d50: 20 52 0a 09 20 20 20 20 57 48 45 52 45 20 42 2e   R..    WHERE B.
2d60: 73 69 64 20 3d 20 50 2e 73 69 64 20 20 20 20 20  sid = P.sid     
2d70: 20 20 20 2d 2d 20 46 6f 72 20 61 6c 6c 20 62 72     -- For all br
2d80: 61 6e 63 68 65 73 2c 20 67 65 74 20 6c 65 66 74  anches, get left
2d90: 2d 68 61 6e 64 20 6f 66 20 70 72 65 66 65 72 65  -hand of prefere
2da0: 64 20 70 61 72 65 6e 74 20 76 69 61 20 73 79 6d  d parent via sym
2db0: 62 6f 6c 0a 09 20 20 20 20 41 4e 44 20 20 20 42  bol..    AND   B
2dc0: 2e 6c 6f 64 20 21 3d 20 50 2e 70 69 64 20 20 20  .lod != P.pid   
2dd0: 20 20 20 20 2d 2d 20 52 65 73 74 72 69 63 74 20      -- Restrict 
2de0: 74 6f 20 62 72 61 6e 63 68 65 73 20 77 68 6f 73  to branches whos
2df0: 65 20 4c 4f 44 20 69 73 20 6e 6f 74 20 74 68 65  e LOD is not the
2e00: 69 72 20 70 72 65 66 65 72 65 64 20 70 61 72 65  ir prefered pare
2e10: 6e 74 0a 09 20 20 20 20 41 4e 44 20 20 20 50 2e  nt..    AND   P.
2e20: 70 69 64 20 3d 20 53 2e 73 69 64 09 20 20 20 20  pid = S.sid.    
2e30: 20 20 20 2d 2d 20 47 65 74 20 73 79 6d 62 6f 6c     -- Get symbol
2e40: 20 6f 66 20 70 72 65 66 65 72 65 64 20 70 61 72   of prefered par
2e50: 65 6e 74 0a 09 20 20 20 20 41 4e 44 20 20 20 53  ent..    AND   S
2e60: 2e 6e 61 6d 65 20 21 3d 20 27 3a 74 72 75 6e 6b  .name != ':trunk
2e70: 3a 27 20 20 2d 2d 20 45 78 63 6c 75 64 65 20 74  :'  -- Exclude t
2e80: 72 75 6e 6b 20 70 61 72 65 6e 74 61 67 65 0a 09  runk parentage..
2e90: 20 20 20 20 41 4e 44 20 20 20 42 2e 72 6f 6f 74      AND   B.root
2ea0: 20 3d 20 52 2e 72 69 64 20 20 20 20 20 20 20 2d   = R.rid       -
2eb0: 2d 20 47 65 74 20 72 6f 6f 74 20 72 65 76 69 73  - Get root revis
2ec0: 69 6f 6e 20 6f 66 20 74 68 65 20 62 72 61 6e 63  ion of the branc
2ed0: 68 0a 09 7d 5d 0a 0a 09 73 65 74 20 74 6d 61 78  h..}]...set tmax
2ee0: 20 5b 65 78 70 72 20 7b 5b 6c 6c 65 6e 67 74 68   [expr {[llength
2ef0: 20 24 74 61 67 73 74 6f 61 64 6a 75 73 74 5d 20   $tagstoadjust] 
2f00: 2f 20 37 7d 5d 0a 09 73 65 74 20 62 6d 61 78 20  / 7}]..set bmax 
2f10: 5b 65 78 70 72 20 7b 5b 6c 6c 65 6e 67 74 68 20  [expr {[llength 
2f20: 24 62 72 61 6e 63 68 65 73 74 6f 61 64 6a 75 73  $branchestoadjus
2f30: 74 5d 20 2f 20 38 7d 5d 0a 0a 09 6c 6f 67 20 77  t] / 8}]...log w
2f40: 72 69 74 65 20 34 20 66 69 6c 74 65 72 73 79 6d  rite 4 filtersym
2f50: 20 22 52 65 70 61 72 65 6e 74 69 6e 67 20 61 74   "Reparenting at
2f60: 20 6d 6f 73 74 20 5b 6e 73 70 20 24 74 6d 61 78   most [nsp $tmax
2f70: 20 74 61 67 5d 22 0a 09 6c 6f 67 20 77 72 69 74   tag]"..log writ
2f80: 65 20 34 20 66 69 6c 74 65 72 73 79 6d 20 22 52  e 4 filtersym "R
2f90: 65 70 61 72 65 6e 74 69 6e 67 20 61 74 20 6d 6f  eparenting at mo
2fa0: 73 74 20 5b 6e 73 70 20 24 62 6d 61 78 20 62 72  st [nsp $bmax br
2fb0: 61 6e 63 68 20 62 72 61 6e 63 68 65 73 5d 22 0a  anch branches]".
2fc0: 0a 09 6c 6f 67 20 77 72 69 74 65 20 33 20 66 69  ..log write 3 fi
2fd0: 6c 74 65 72 73 79 6d 20 22 41 64 6a 75 73 74 20  ltersym "Adjust 
2fe0: 74 61 67 20 70 61 72 65 6e 74 73 22 0a 0a 09 23  tag parents"...#
2ff0: 20 46 69 6e 64 20 74 68 65 20 74 61 67 73 20 77   Find the tags w
3000: 68 6f 73 65 20 63 75 72 72 65 6e 74 20 70 61 72  hose current par
3010: 65 6e 74 20 28 6c 6f 64 29 20 69 73 20 6e 6f 74  ent (lod) is not
3020: 20 74 68 65 20 70 72 65 66 65 72 65 64 0a 09 23   the prefered..#
3030: 20 70 61 72 65 6e 74 2c 20 74 68 65 20 70 72 65   parent, the pre
3040: 66 65 72 65 64 20 70 61 72 65 6e 74 20 69 73 20  fered parent is 
3050: 6e 6f 74 20 74 68 65 20 74 72 75 6e 6b 2c 20 61  not the trunk, a
3060: 6e 64 20 74 68 65 0a 09 23 20 70 72 65 66 65 72  nd the..# prefer
3070: 65 64 20 70 61 72 65 6e 74 20 69 73 20 61 20 70  ed parent is a p
3080: 6f 73 73 69 62 6c 65 20 70 61 72 65 6e 74 20 70  ossible parent p
3090: 65 72 20 74 68 65 20 74 61 67 27 73 20 72 65 76  er the tag's rev
30a0: 69 73 69 6f 6e 2e 0a 0a 09 73 65 74 20 66 6d 74  ision....set fmt
30b0: 20 25 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68   %[string length
30c0: 20 24 74 6d 61 78 5d 73 0a 09 73 65 74 20 6d 78   $tmax]s..set mx
30d0: 73 20 5b 66 6f 72 6d 61 74 20 24 66 6d 74 20 24  s [format $fmt $
30e0: 74 6d 61 78 5d 0a 0a 09 73 65 74 20 6e 20 30 0a  tmax]...set n 0.
30f0: 09 66 6f 72 65 61 63 68 20 7b 69 64 20 66 69 64  .foreach {id fid
3100: 20 6c 6f 64 20 70 69 64 20 70 72 65 66 65 72 65   lod pid prefere
3110: 64 6e 61 6d 65 20 72 65 76 6e 72 20 72 69 64 7d  dname revnr rid}
3120: 20 24 74 61 67 73 74 6f 61 64 6a 75 73 74 20 7b   $tagstoadjust {
3130: 0a 09 20 20 20 20 23 20 42 4f 54 54 4c 45 2d 4e  ..    # BOTTLE-N
3140: 45 43 4b 20 2e 2e 2e 0a 09 20 20 20 20 23 0a 09  ECK .....    #..
3150: 20 20 20 20 23 20 54 68 65 20 63 68 65 63 6b 20      # The check 
3160: 69 66 20 74 68 65 20 63 61 6e 64 69 64 61 74 65  if the candidate
3170: 20 28 70 69 64 29 20 69 73 20 74 72 75 6c 79 20   (pid) is truly 
3180: 76 69 61 62 6c 65 20 69 73 0a 09 20 20 20 20 23  viable is..    #
3190: 20 62 61 73 65 64 20 6f 6e 20 66 69 6e 64 69 6e   based on findin
31a0: 67 20 74 68 65 20 62 72 61 6e 63 68 20 61 73 20  g the branch as 
31b0: 70 6f 73 73 69 62 6c 65 20 70 61 72 65 6e 74 2c  possible parent,
31c0: 20 61 6e 64 20 64 6f 6e 65 0a 09 20 20 20 20 23   and done..    #
31d0: 20 6e 6f 77 20 69 6e 73 74 65 61 64 20 6f 66 20   now instead of 
31e0: 61 73 20 70 61 72 74 20 6f 66 20 74 68 65 20 61  as part of the a
31f0: 6c 72 65 61 64 79 20 63 6f 6d 70 6c 65 78 20 6a  lready complex j
3200: 6f 69 6e 2e 0a 09 20 20 20 20 23 0a 09 20 20 20  oin...    #..   
3210: 20 23 20 2e 2e 2e 20 41 4e 44 20 50 2e 70 69 64   # ... AND P.pid
3220: 20 49 4e 20 28 53 45 4c 45 43 54 20 42 2e 73 69   IN (SELECT B.si
3230: 64 0a 09 20 20 20 20 23 20 20 20 20 20 20 20 20  d..    #        
3240: 20 20 20 20 20 20 20 20 20 20 20 46 52 4f 4d 20             FROM 
3250: 62 72 61 6e 63 68 20 42 0a 09 20 20 20 20 23 20  branch B..    # 
3260: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
3270: 20 20 57 48 45 52 45 20 42 2e 72 6f 6f 74 20 3d    WHERE B.root =
3280: 20 52 2e 72 69 64 29 0a 0a 09 20 20 20 20 69 66   R.rid)...    if
3290: 20 7b 21 5b 73 74 61 74 65 20 6f 6e 65 20 7b 0a   {![state one {.
32a0: 09 09 53 45 4c 45 43 54 20 43 4f 55 4e 54 28 2a  ..SELECT COUNT(*
32b0: 29 20 20 20 20 20 20 20 2d 2d 20 43 6f 75 6e 74  )       -- Count
32c0: 20 3c 3d 3e 20 43 68 65 63 6b 20 65 78 69 73 74   <=> Check exist
32d0: 65 6e 63 65 2e 0a 09 09 46 52 4f 4d 20 62 72 61  ence....FROM bra
32e0: 6e 63 68 20 42 0a 09 09 57 48 45 52 45 20 20 42  nch B...WHERE  B
32f0: 2e 73 69 64 20 20 3d 20 24 70 69 64 20 20 2d 2d  .sid  = $pid  --
3300: 20 52 65 73 74 72 69 63 74 20 74 6f 20 62 72 61   Restrict to bra
3310: 6e 63 68 20 66 6f 72 20 74 68 61 74 20 73 79 6d  nch for that sym
3320: 62 6f 6c 0a 09 09 41 4e 44 20 20 20 20 42 2e 72  bol...AND    B.r
3330: 6f 6f 74 20 3d 20 24 72 69 64 20 20 2d 2d 20 61  oot = $rid  -- a
3340: 74 74 61 63 68 65 64 20 74 6f 20 74 68 61 74 20  ttached to that 
3350: 72 65 76 69 73 69 6f 6e 0a 09 20 20 20 20 7d 5d  revision..    }]
3360: 7d 20 7b 0a 09 09 69 6e 63 72 20 74 6d 61 78 20  } {...incr tmax 
3370: 2d 31 0a 09 09 73 65 74 20 20 6d 78 73 20 5b 66  -1...set  mxs [f
3380: 6f 72 6d 61 74 20 24 66 6d 74 20 24 74 6d 61 78  ormat $fmt $tmax
3390: 5d 0a 09 09 63 6f 6e 74 69 6e 75 65 0a 09 20 20  ]...continue..  
33a0: 20 20 7d 0a 0a 09 20 20 20 20 23 0a 09 20 20 20    }...    #..   
33b0: 20 23 20 42 4f 54 54 4c 45 2d 4e 45 43 4b 20 2e   # BOTTLE-NECK .
33c0: 2e 2e 0a 0a 09 20 20 20 20 23 20 54 68 65 20 6e  .....    # The n
33d0: 61 6d 65 73 20 66 6f 72 20 75 73 65 20 69 6e 20  ames for use in 
33e0: 74 68 65 20 6c 6f 67 20 6f 75 74 70 75 74 20 61  the log output a
33f0: 72 65 20 72 65 74 72 69 65 76 65 64 0a 09 20 20  re retrieved..  
3400: 20 20 23 20 73 65 70 61 72 61 74 65 6c 79 2c 20    # separately, 
3410: 74 6f 20 6b 65 65 70 20 74 68 65 20 6a 6f 69 6e  to keep the join
3420: 20 73 65 6c 65 63 74 69 6e 67 20 74 68 65 20 61   selecting the a
3430: 64 6a 75 73 74 61 62 6c 65 0a 09 20 20 20 20 23  djustable..    #
3440: 20 74 61 67 73 20 73 6d 61 6c 6c 2c 20 6e 6f 74   tags small, not
3450: 20 62 75 72 64 65 6e 65 64 20 77 69 74 68 20 74   burdened with t
3460: 68 65 20 64 65 72 65 66 65 72 65 6e 63 69 6e 67  he dereferencing
3470: 20 6f 66 20 6c 69 6e 6b 73 0a 09 20 20 20 20 23   of links..    #
3480: 20 74 6f 20 6e 61 6d 65 2e 0a 0a 09 20 20 20 20   to name....    
3490: 73 65 74 20 74 61 67 6e 61 6d 65 20 24 73 6e 28  set tagname $sn(
34a0: 24 69 64 29 0a 09 20 20 20 20 73 65 74 20 6f 6c  $id)..    set ol
34b0: 64 6e 61 6d 65 20 24 73 78 28 24 6c 6f 64 29 0a  dname $sx($lod).
34c0: 09 20 20 20 20 73 74 72 75 63 74 3a 3a 6c 69 73  .    struct::lis
34d0: 74 20 61 73 73 69 67 6e 20 24 66 70 6e 28 24 66  t assign $fpn($f
34e0: 69 64 29 20 66 6e 61 6d 65 20 70 72 6e 61 6d 65  id) fname prname
34f0: 0a 0a 09 20 20 20 20 23 20 44 6f 20 74 68 65 20  ...    # Do the 
3500: 67 72 61 66 74 69 6e 67 2e 0a 0a 09 20 20 20 20  grafting....    
3510: 6c 6f 67 20 77 72 69 74 65 20 34 20 66 69 6c 74  log write 4 filt
3520: 65 72 73 79 6d 20 7b 5c 5b 5b 66 6f 72 6d 61 74  ersym {\[[format
3530: 20 24 66 6d 74 20 24 6e 5d 2f 24 6d 78 73 5c 5d   $fmt $n]/$mxs\]
3540: 20 24 70 72 6e 61 6d 65 20 3a 20 47 72 61 66 74   $prname : Graft
3550: 69 6e 67 20 74 61 67 20 27 24 74 61 67 6e 61 6d  ing tag '$tagnam
3560: 65 27 20 6f 6e 20 24 66 6e 61 6d 65 2f 24 72 65  e' on $fname/$re
3570: 76 6e 72 20 66 72 6f 6d 20 27 24 6f 6c 64 6e 61  vnr from '$oldna
3580: 6d 65 27 20 6f 6e 74 6f 20 27 24 70 72 65 66 65  me' onto '$prefe
3590: 72 65 64 6e 61 6d 65 27 7d 0a 09 20 20 20 20 73  redname'}..    s
35a0: 74 61 74 65 20 72 75 6e 20 7b 20 55 50 44 41 54  tate run { UPDAT
35b0: 45 20 74 61 67 20 53 45 54 20 6c 6f 64 20 3d 20  E tag SET lod = 
35c0: 24 70 69 64 20 57 48 45 52 45 20 74 69 64 20 3d  $pid WHERE tid =
35d0: 20 24 69 64 20 7d 0a 09 20 20 20 20 69 6e 63 72   $id }..    incr
35e0: 20 6e 0a 09 7d 0a 0a 09 6c 6f 67 20 77 72 69 74   n..}...log writ
35f0: 65 20 33 20 66 69 6c 74 65 72 73 79 6d 20 22 52  e 3 filtersym "R
3600: 65 70 61 72 65 6e 74 65 64 20 5b 6e 73 70 20 24  eparented [nsp $
3610: 6e 20 74 61 67 5d 22 0a 0a 09 6c 6f 67 20 77 72  n tag]"...log wr
3620: 69 74 65 20 33 20 66 69 6c 74 65 72 73 79 6d 20  ite 3 filtersym 
3630: 22 41 64 6a 75 73 74 20 62 72 61 6e 63 68 20 70  "Adjust branch p
3640: 61 72 65 6e 74 73 22 0a 0a 09 23 20 46 69 6e 64  arents"...# Find
3650: 20 74 68 65 20 62 72 61 6e 63 68 65 73 20 77 68   the branches wh
3660: 6f 73 65 20 63 75 72 72 65 6e 74 20 70 61 72 65  ose current pare
3670: 6e 74 20 28 6c 6f 64 29 20 69 73 20 6e 6f 74 20  nt (lod) is not 
3680: 74 68 65 0a 09 23 20 70 72 65 66 65 72 65 64 20  the..# prefered 
3690: 70 61 72 65 6e 74 2c 20 74 68 65 20 70 72 65 66  parent, the pref
36a0: 65 72 65 64 20 70 61 72 65 6e 74 20 69 73 20 6e  ered parent is n
36b0: 6f 74 20 74 68 65 20 74 72 75 6e 6b 2c 20 61 6e  ot the trunk, an
36c0: 64 0a 09 23 20 74 68 65 20 70 72 65 66 65 72 65  d..# the prefere
36d0: 64 20 70 61 72 65 6e 74 20 69 73 20 61 20 70 6f  d parent is a po
36e0: 73 73 69 62 6c 65 20 70 61 72 65 6e 74 20 70 65  ssible parent pe
36f0: 72 20 74 68 65 20 62 72 61 6e 63 68 27 73 0a 09  r the branch's..
3700: 23 20 72 65 76 69 73 69 6f 6e 2e 0a 0a 09 73 65  # revision....se
3710: 74 20 66 6d 74 20 25 5b 73 74 72 69 6e 67 20 6c  t fmt %[string l
3720: 65 6e 67 74 68 20 24 62 6d 61 78 5d 73 0a 09 73  ength $bmax]s..s
3730: 65 74 20 6d 78 73 20 5b 66 6f 72 6d 61 74 20 24  et mxs [format $
3740: 66 6d 74 20 24 62 6d 61 78 5d 0a 0a 09 73 65 74  fmt $bmax]...set
3750: 20 6e 20 30 0a 09 66 6f 72 65 61 63 68 20 7b 69   n 0..foreach {i
3760: 64 20 66 69 64 20 6c 6f 64 20 70 6f 73 20 70 69  d fid lod pos pi
3770: 64 20 70 72 65 66 65 72 65 64 6e 61 6d 65 20 72  d preferedname r
3780: 65 76 6e 72 20 72 69 64 7d 20 24 62 72 61 6e 63  evnr rid} $branc
3790: 68 65 73 74 6f 61 64 6a 75 73 74 20 7b 0a 0a 09  hestoadjust {...
37a0: 20 20 20 20 23 20 42 4f 54 54 4c 45 2d 4e 45 43      # BOTTLE-NEC
37b0: 4b 20 2e 2e 2e 0a 09 20 20 20 20 23 0a 09 20 20  K .....    #..  
37c0: 20 20 23 20 54 68 65 20 63 68 65 63 6b 20 69 66    # The check if
37d0: 20 74 68 65 20 63 61 6e 64 69 64 61 74 65 20 28   the candidate (
37e0: 70 69 64 29 20 69 73 20 74 72 75 6c 79 20 76 69  pid) is truly vi
37f0: 61 62 6c 65 20 69 73 0a 09 20 20 20 20 23 20 62  able is..    # b
3800: 61 73 65 64 20 6f 6e 20 74 68 65 20 62 72 61 6e  ased on the bran
3810: 63 68 20 70 6f 73 69 74 69 6f 6e 73 20 69 6e 20  ch positions in 
3820: 74 68 65 20 73 70 61 77 6e 69 6e 67 20 72 65 76  the spawning rev
3830: 69 73 69 6f 6e 2c 0a 09 20 20 20 20 23 20 61 6e  ision,..    # an
3840: 64 20 64 6f 6e 65 20 6e 6f 77 20 69 6e 73 74 65  d done now inste
3850: 61 64 20 6f 66 20 61 73 20 70 61 72 74 20 6f 66  ad of as part of
3860: 20 74 68 65 20 61 6c 72 65 61 64 79 20 63 6f 6d   the already com
3870: 70 6c 65 78 0a 09 20 20 20 20 23 20 6a 6f 69 6e  plex..    # join
3880: 2e 0a 09 20 20 20 20 23 0a 09 20 20 20 20 23 20  ...    #..    # 
3890: 2e 2e 2e 20 41 4e 44 20 50 2e 70 69 64 20 49 4e  ... AND P.pid IN
38a0: 20 28 53 45 4c 45 43 54 20 42 58 2e 73 69 64 0a   (SELECT BX.sid.
38b0: 09 20 20 20 20 23 20 20 20 20 20 20 20 20 20 20  .    #          
38c0: 20 20 20 20 20 20 20 20 20 46 52 4f 4d 20 62 72           FROM br
38d0: 61 6e 63 68 20 42 58 0a 09 20 20 20 20 23 20 20  anch BX..    #  
38e0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
38f0: 20 57 48 45 52 45 20 42 58 2e 72 6f 6f 74 20 3d   WHERE BX.root =
3900: 20 52 2e 72 69 64 0a 09 20 20 20 20 23 20 20 20   R.rid..    #   
3910: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
3920: 41 4e 44 20 20 20 42 58 2e 70 6f 73 20 3e 20 42  AND   BX.pos > B
3930: 2e 70 6f 73 29 0a 0a 09 20 20 20 20 23 20 4e 6f  .pos)...    # No
3940: 74 65 3a 20 72 69 64 20 65 71 20 22 22 20 68 65  te: rid eq "" he
3950: 61 72 20 6d 65 61 6e 73 20 74 68 61 74 20 74 68  ar means that th
3960: 69 73 20 69 73 20 61 20 66 72 65 65 2d 66 6c 6f  is is a free-flo
3970: 61 74 69 6e 67 0a 09 20 20 20 20 23 20 62 72 61  ating..    # bra
3980: 6e 63 68 2c 20 77 68 6f 73 65 20 6f 72 69 67 69  nch, whose origi
3990: 6e 61 6c 20 72 6f 6f 74 20 77 61 73 20 72 65 6d  nal root was rem
39a0: 6f 76 65 64 20 61 73 20 61 20 75 6e 6e 65 63 65  oved as a unnece
39b0: 73 73 61 72 79 0a 09 20 20 20 20 23 20 64 65 61  ssary..    # dea
39c0: 64 20 72 65 76 69 73 69 6f 6e 20 28 53 65 65 20  d revision (See 
39d0: 27 66 69 6c 65 3a 3a 52 65 6d 6f 76 65 49 72 72  'file::RemoveIrr
39e0: 65 6c 65 76 61 6e 74 44 65 6c 65 74 69 6f 6e 73  elevantDeletions
39f0: 27 29 2e 0a 09 20 20 20 20 23 20 53 75 63 68 20  ')...    # Such 
3a00: 61 20 62 72 61 6e 63 68 20 63 61 6e 20 62 65 20  a branch can be 
3a10: 72 65 67 72 61 66 74 65 64 20 77 69 74 68 6f 75  regrafted withou
3a20: 74 20 74 72 6f 75 62 6c 65 20 61 6e 64 20 74 68  t trouble and th
3a30: 65 72 65 0a 09 20 20 20 20 23 20 69 73 20 6e 6f  ere..    # is no
3a40: 20 6e 65 65 64 20 74 6f 20 6c 6f 6f 6b 20 66 6f   need to look fo
3a50: 72 20 74 68 65 20 6e 65 77 20 70 61 72 65 6e 74  r the new parent
3a60: 20 69 6e 20 69 74 73 0a 09 20 20 20 20 23 20 6e   in its..    # n
3a70: 6f 6e 2d 65 78 69 73 74 65 6e 74 20 72 6f 6f 74  on-existent root
3a80: 2e 0a 0a 09 20 20 20 20 69 66 20 7b 28 24 72 69  ....    if {($ri
3a90: 64 20 6e 65 20 22 22 29 20 26 26 20 21 5b 73 74  d ne "") && ![st
3aa0: 61 74 65 20 6f 6e 65 20 7b 0a 09 09 53 45 4c 45  ate one {...SELE
3ab0: 43 54 20 43 4f 55 4e 54 28 2a 29 20 20 20 20 20  CT COUNT(*)     
3ac0: 20 20 2d 2d 20 43 6f 75 6e 74 20 3c 3d 3e 20 43    -- Count <=> C
3ad0: 68 65 63 6b 20 65 78 69 73 74 65 6e 63 65 2e 0a  heck existence..
3ae0: 09 09 46 52 4f 4d 20 62 72 61 6e 63 68 20 42 0a  ..FROM branch B.
3af0: 09 09 57 48 45 52 45 20 20 42 2e 73 69 64 20 20  ..WHERE  B.sid  
3b00: 3d 20 24 70 69 64 20 20 2d 2d 20 4c 6f 6f 6b 20  = $pid  -- Look 
3b10: 66 6f 72 20 62 72 61 6e 63 68 20 62 79 20 73 79  for branch by sy
3b20: 6d 62 6f 6c 0a 09 09 41 4e 44 20 20 20 20 42 2e  mbol...AND    B.
3b30: 72 6f 6f 74 20 3d 20 24 72 69 64 20 20 2d 2d 20  root = $rid  -- 
3b40: 53 70 61 77 6e 65 64 20 62 79 20 74 68 65 20 67  Spawned by the g
3b50: 69 76 65 6e 20 72 65 76 69 73 69 6f 6e 0a 09 09  iven revision...
3b60: 41 4e 44 20 20 20 20 42 2e 70 6f 73 20 20 3e 20  AND    B.pos  > 
3b70: 24 70 6f 73 20 20 2d 2d 20 41 6e 64 20 64 65 66  $pos  -- And def
3b80: 69 6e 65 64 20 62 65 66 6f 72 65 20 62 72 61 6e  ined before bran
3b90: 63 68 20 74 6f 20 6d 75 74 61 74 65 0a 09 20 20  ch to mutate..  
3ba0: 20 20 7d 5d 7d 20 7b 0a 09 09 69 6e 63 72 20 62    }]} {...incr b
3bb0: 6d 61 78 20 2d 31 0a 09 09 73 65 74 20 20 6d 78  max -1...set  mx
3bc0: 73 20 5b 66 6f 72 6d 61 74 20 24 66 6d 74 20 24  s [format $fmt $
3bd0: 62 6d 61 78 5d 0a 09 09 63 6f 6e 74 69 6e 75 65  bmax]...continue
3be0: 0a 09 20 20 20 20 7d 0a 0a 09 20 20 20 20 23 0a  ..    }...    #.
3bf0: 09 20 20 20 20 23 20 42 4f 54 54 4c 45 2d 4e 45  .    # BOTTLE-NE
3c00: 43 4b 20 2e 2e 2e 0a 0a 09 20 20 20 20 23 20 54  CK ......    # T
3c10: 68 65 20 6e 61 6d 65 73 20 66 6f 72 20 75 73 65  he names for use
3c20: 20 69 6e 20 74 68 65 20 6c 6f 67 20 6f 75 74 70   in the log outp
3c30: 75 74 20 61 72 65 20 72 65 74 72 69 65 76 65 64  ut are retrieved
3c40: 0a 09 20 20 20 20 23 20 73 65 70 61 72 61 74 65  ..    # separate
3c50: 6c 79 2c 20 74 6f 20 6b 65 65 70 20 74 68 65 20  ly, to keep the 
3c60: 6a 6f 69 6e 20 73 65 6c 65 63 74 69 6e 67 20 74  join selecting t
3c70: 68 65 20 61 64 6a 75 73 74 61 62 6c 65 0a 09 20  he adjustable.. 
3c80: 20 20 20 23 20 74 61 67 73 20 73 6d 61 6c 6c 2c     # tags small,
3c90: 20 6e 6f 74 20 62 75 72 64 65 6e 65 64 20 77 69   not burdened wi
3ca0: 74 68 20 74 68 65 20 64 65 72 65 66 65 72 65 6e  th the dereferen
3cb0: 63 69 6e 67 20 6f 66 20 6c 69 6e 6b 73 0a 09 20  cing of links.. 
3cc0: 20 20 20 23 20 74 6f 20 6e 61 6d 65 2e 0a 0a 09     # to name....
3cd0: 20 20 20 20 73 65 74 20 62 72 61 6e 61 6d 65 20      set braname 
3ce0: 24 73 6e 28 24 69 64 29 0a 09 20 20 20 20 73 65  $sn($id)..    se
3cf0: 74 20 6f 6c 64 6e 61 6d 65 20 24 73 78 28 24 6c  t oldname $sx($l
3d00: 6f 64 29 0a 09 20 20 20 20 73 74 72 75 63 74 3a  od)..    struct:
3d10: 3a 6c 69 73 74 20 61 73 73 69 67 6e 20 24 66 70  :list assign $fp
3d20: 6e 28 24 66 69 64 29 20 66 6e 61 6d 65 20 70 72  n($fid) fname pr
3d30: 6e 61 6d 65 0a 0a 09 20 20 20 20 23 20 44 6f 20  name...    # Do 
3d40: 74 68 65 20 67 72 61 66 74 69 6e 67 2e 0a 0a 09  the grafting....
3d50: 20 20 20 20 6c 6f 67 20 77 72 69 74 65 20 34 20      log write 4 
3d60: 66 69 6c 74 65 72 73 79 6d 20 7b 5c 5b 5b 66 6f  filtersym {\[[fo
3d70: 72 6d 61 74 20 24 66 6d 74 20 24 6e 5d 2f 24 6d  rmat $fmt $n]/$m
3d80: 78 73 5c 5d 20 24 70 72 6e 61 6d 65 20 3a 20 47  xs\] $prname : G
3d90: 72 61 66 74 69 6e 67 20 62 72 61 6e 63 68 20 27  rafting branch '
3da0: 24 62 72 61 6e 61 6d 65 27 20 6f 6e 20 24 66 6e  $braname' on $fn
3db0: 61 6d 65 2f 24 72 65 76 6e 72 20 66 72 6f 6d 20  ame/$revnr from 
3dc0: 27 24 6f 6c 64 6e 61 6d 65 27 20 6f 6e 74 6f 20  '$oldname' onto 
3dd0: 27 24 70 72 65 66 65 72 65 64 6e 61 6d 65 27 7d  '$preferedname'}
3de0: 0a 09 20 20 20 20 73 74 61 74 65 20 72 75 6e 20  ..    state run 
3df0: 7b 20 55 50 44 41 54 45 20 62 72 61 6e 63 68 20  { UPDATE branch 
3e00: 53 45 54 20 6c 6f 64 20 3d 20 24 70 69 64 20 57  SET lod = $pid W
3e10: 48 45 52 45 20 62 69 64 20 3d 20 24 69 64 20 7d  HERE bid = $id }
3e20: 0a 09 20 20 20 20 69 6e 63 72 20 6e 0a 09 7d 0a  ..    incr n..}.
3e30: 0a 09 6c 6f 67 20 77 72 69 74 65 20 33 20 66 69  ..log write 3 fi
3e40: 6c 74 65 72 73 79 6d 20 22 52 65 70 61 72 65 6e  ltersym "Reparen
3e50: 74 65 64 20 5b 6e 73 70 20 24 6e 20 62 72 61 6e  ted [nsp $n bran
3e60: 63 68 20 62 72 61 6e 63 68 65 73 5d 22 0a 09 72  ch branches]"..r
3e70: 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20  eturn.    }..   
3e80: 20 70 72 6f 63 20 52 65 66 69 6e 65 53 79 6d 62   proc RefineSymb
3e90: 6f 6c 73 20 7b 7d 20 7b 0a 09 23 20 54 61 67 73  ols {} {..# Tags
3ea0: 20 61 6e 64 20 62 72 61 6e 63 68 65 73 20 61 72   and branches ar
3eb0: 65 20 6d 61 72 6b 65 64 20 61 73 20 6e 6f 72 6d  e marked as norm
3ec0: 61 6c 2f 6e 6f 6f 70 20 62 61 73 65 64 20 6f 6e  al/noop based on
3ed0: 20 74 68 65 20 6f 70 0a 09 23 20 6f 66 20 74 68   the op..# of th
3ee0: 65 69 72 20 72 65 76 69 73 69 6f 6e 2e 0a 0a 09  eir revision....
3ef0: 6c 6f 67 20 77 72 69 74 65 20 33 20 66 69 6c 74  log write 3 filt
3f00: 65 72 73 79 6d 20 22 52 65 66 69 6e 65 20 73 79  ersym "Refine sy
3f10: 6d 62 6f 6c 73 20 28 6e 6f 2d 6f 70 20 6f 72 20  mbols (no-op or 
3f20: 6e 6f 74 3f 29 22 0a 0a 09 23 20 4e 6f 74 65 3a  not?)"...# Note:
3f30: 20 54 68 65 20 6e 6f 6f 70 20 69 6e 66 6f 72 6d   The noop inform
3f40: 61 74 69 6f 6e 20 69 73 20 6e 6f 74 20 75 73 65  ation is not use
3f50: 64 20 61 6e 79 77 68 65 72 65 2e 20 43 6f 6e 73  d anywhere. Cons
3f60: 69 64 65 72 0a 09 23 20 64 69 73 61 62 6c 69 6e  ider..# disablin
3f70: 67 20 74 68 69 73 20 63 6f 64 65 2c 20 61 6e 64  g this code, and
3f80: 20 72 65 6d 6f 76 69 6e 67 20 74 68 65 20 64 61   removing the da
3f90: 74 61 20 66 72 6f 6d 20 74 68 65 20 73 74 61 74  ta from the stat
3fa0: 65 2e 0a 0a 09 6c 6f 67 20 77 72 69 74 65 20 34  e....log write 4
3fb0: 20 66 69 6c 74 65 72 73 79 6d 20 22 20 20 20 20   filtersym "    
3fc0: 52 65 67 75 6c 61 72 20 74 61 67 73 22 0a 09 73  Regular tags"..s
3fd0: 74 61 74 65 20 72 75 6e 20 7b 0a 09 20 20 20 20  tate run {..    
3fe0: 49 4e 53 45 52 54 20 49 4e 54 4f 20 6e 6f 6f 70  INSERT INTO noop
3ff0: 0a 09 20 20 20 20 53 45 4c 45 43 54 20 54 2e 74  ..    SELECT T.t
4000: 69 64 2c 20 30 0a 09 20 20 20 20 46 52 4f 4d 20  id, 0..    FROM 
4010: 74 61 67 20 54 2c 20 72 65 76 69 73 69 6f 6e 20  tag T, revision 
4020: 52 0a 09 20 20 20 20 57 48 45 52 45 20 54 2e 72  R..    WHERE T.r
4030: 65 76 20 20 3d 20 52 2e 72 69 64 0a 09 20 20 20  ev  = R.rid..   
4040: 20 41 4e 44 20 20 20 52 2e 6f 70 20 20 21 3d 20   AND   R.op  != 
4050: 30 20 2d 2d 20 30 20 3d 3d 20 6e 6f 74 68 69 6e  0 -- 0 == nothin
4060: 67 0a 09 7d 0a 0a 09 6c 6f 67 20 77 72 69 74 65  g..}...log write
4070: 20 34 20 66 69 6c 74 65 72 73 79 6d 20 22 20 20   4 filtersym "  
4080: 20 20 4e 6f 2d 6f 70 20 74 61 67 73 22 0a 09 73    No-op tags"..s
4090: 74 61 74 65 20 72 75 6e 20 7b 0a 09 20 20 20 20  tate run {..    
40a0: 49 4e 53 45 52 54 20 49 4e 54 4f 20 6e 6f 6f 70  INSERT INTO noop
40b0: 0a 09 20 20 20 20 53 45 4c 45 43 54 20 54 2e 74  ..    SELECT T.t
40c0: 69 64 2c 20 31 0a 09 20 20 20 20 46 52 4f 4d 20  id, 1..    FROM 
40d0: 74 61 67 20 54 2c 20 72 65 76 69 73 69 6f 6e 20  tag T, revision 
40e0: 52 0a 09 20 20 20 20 57 48 45 52 45 20 54 2e 72  R..    WHERE T.r
40f0: 65 76 20 20 3d 20 52 2e 72 69 64 0a 09 20 20 20  ev  = R.rid..   
4100: 20 41 4e 44 20 20 20 52 2e 6f 70 20 20 20 3d 20   AND   R.op   = 
4110: 30 20 2d 2d 20 6e 6f 74 68 69 6e 67 0a 09 7d 0a  0 -- nothing..}.
4120: 0a 09 6c 6f 67 20 77 72 69 74 65 20 34 20 66 69  ..log write 4 fi
4130: 6c 74 65 72 73 79 6d 20 22 20 20 20 20 52 65 67  ltersym "    Reg
4140: 75 6c 61 72 20 62 72 61 6e 63 68 65 73 22 0a 09  ular branches"..
4150: 73 74 61 74 65 20 72 75 6e 20 7b 0a 09 20 20 20  state run {..   
4160: 20 49 4e 53 45 52 54 20 49 4e 54 4f 20 6e 6f 6f   INSERT INTO noo
4170: 70 0a 09 20 20 20 20 53 45 4c 45 43 54 20 42 2e  p..    SELECT B.
4180: 62 69 64 2c 20 30 0a 09 20 20 20 20 46 52 4f 4d  bid, 0..    FROM
4190: 20 62 72 61 6e 63 68 20 42 2c 20 72 65 76 69 73   branch B, revis
41a0: 69 6f 6e 20 52 0a 09 20 20 20 20 57 48 45 52 45  ion R..    WHERE
41b0: 20 42 2e 72 6f 6f 74 20 3d 20 52 2e 72 69 64 0a   B.root = R.rid.
41c0: 09 20 20 20 20 41 4e 44 20 20 20 52 2e 6f 70 20  .    AND   R.op 
41d0: 20 21 3d 20 30 20 2d 2d 20 6e 6f 74 68 69 6e 67   != 0 -- nothing
41e0: 0a 09 7d 0a 0a 09 6c 6f 67 20 77 72 69 74 65 20  ..}...log write 
41f0: 34 20 66 69 6c 74 65 72 73 79 6d 20 22 20 20 20  4 filtersym "   
4200: 20 4e 6f 2d 6f 70 20 62 72 61 6e 63 68 65 73 22   No-op branches"
4210: 0a 09 73 74 61 74 65 20 72 75 6e 20 7b 0a 09 20  ..state run {.. 
4220: 20 20 20 49 4e 53 45 52 54 20 49 4e 54 4f 20 6e     INSERT INTO n
4230: 6f 6f 70 0a 09 20 20 20 20 53 45 4c 45 43 54 20  oop..    SELECT 
4240: 42 2e 62 69 64 2c 20 31 0a 09 20 20 20 20 46 52  B.bid, 1..    FR
4250: 4f 4d 20 62 72 61 6e 63 68 20 42 2c 20 72 65 76  OM branch B, rev
4260: 69 73 69 6f 6e 20 52 0a 09 20 20 20 20 57 48 45  ision R..    WHE
4270: 52 45 20 42 2e 72 6f 6f 74 20 3d 20 52 2e 72 69  RE B.root = R.ri
4280: 64 0a 09 20 20 20 20 41 4e 44 20 20 20 52 2e 6f  d..    AND   R.o
4290: 70 20 20 20 3d 20 30 20 2d 2d 20 6e 6f 74 68 69  p   = 0 -- nothi
42a0: 6e 67 0a 09 7d 0a 09 72 65 74 75 72 6e 0a 20 20  ng..}..return.  
42b0: 20 20 7d 0a 0a 20 20 20 20 23 20 23 20 23 23 20    }..    # # ## 
42c0: 23 23 23 20 23 23 23 23 23 20 23 23 23 23 23 23  ### ##### ######
42d0: 23 23 20 23 23 23 23 23 23 23 23 23 23 23 23 23  ## #############
42e0: 0a 20 20 20 20 23 23 20 43 6f 6e 66 69 67 75 72  .    ## Configur
42f0: 61 74 69 6f 6e 0a 0a 20 20 20 20 70 72 61 67 6d  ation..    pragm
4300: 61 20 2d 68 61 73 69 6e 73 74 61 6e 63 65 73 20  a -hasinstances 
4310: 20 20 6e 6f 20 3b 20 23 20 73 69 6e 67 6c 65 74    no ; # singlet
4320: 6f 6e 0a 20 20 20 20 70 72 61 67 6d 61 20 2d 68  on.    pragma -h
4330: 61 73 74 79 70 65 69 6e 66 6f 20 20 20 20 6e 6f  astypeinfo    no
4340: 20 3b 20 23 20 6e 6f 20 69 6e 74 72 6f 73 70 65   ; # no introspe
4350: 63 74 69 6f 6e 0a 20 20 20 20 70 72 61 67 6d 61  ction.    pragma
4360: 20 2d 68 61 73 74 79 70 65 64 65 73 74 72 6f 79   -hastypedestroy
4370: 20 6e 6f 20 3b 20 23 20 69 6d 6d 6f 72 74 61 6c   no ; # immortal
4380: 0a 0a 20 20 20 20 23 20 23 20 23 23 20 23 23 23  ..    # # ## ###
4390: 20 23 23 23 23 23 20 23 23 23 23 23 23 23 23 20   ##### ######## 
43a0: 23 23 23 23 23 23 23 23 23 23 23 23 23 0a 7d 0a  #############.}.
43b0: 0a 6e 61 6d 65 73 70 61 63 65 20 65 76 61 6c 20  .namespace eval 
43c0: 3a 3a 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d  ::vc::fossil::im
43d0: 70 6f 72 74 3a 3a 63 76 73 3a 3a 70 61 73 73 20  port::cvs::pass 
43e0: 7b 0a 20 20 20 20 6e 61 6d 65 73 70 61 63 65 20  {.    namespace 
43f0: 65 78 70 6f 72 74 20 66 69 6c 74 65 72 73 79 6d  export filtersym
4400: 0a 20 20 20 20 6e 61 6d 65 73 70 61 63 65 20 65  .    namespace e
4410: 76 61 6c 20 66 69 6c 74 65 72 73 79 6d 20 7b 0a  val filtersym {.
4420: 09 6e 61 6d 65 73 70 61 63 65 20 69 6d 70 6f 72  .namespace impor
4430: 74 20 3a 3a 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a  t ::vc::fossil::
4440: 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 72 65 70  import::cvs::rep
4450: 6f 73 69 74 6f 72 79 0a 09 6e 61 6d 65 73 70 61  ository..namespa
4460: 63 65 20 69 6d 70 6f 72 74 20 3a 3a 76 63 3a 3a  ce import ::vc::
4470: 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a  fossil::import::
4480: 63 76 73 3a 3a 73 74 61 74 65 0a 09 6e 61 6d 65  cvs::state..name
4490: 73 70 61 63 65 20 69 6d 70 6f 72 74 20 3a 3a 76  space import ::v
44a0: 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72  c::fossil::impor
44b0: 74 3a 3a 63 76 73 3a 3a 69 6e 74 65 67 72 69 74  t::cvs::integrit
44c0: 79 0a 09 6e 61 6d 65 73 70 61 63 65 20 65 76 61  y..namespace eva
44d0: 6c 20 70 72 6f 6a 65 63 74 20 7b 0a 09 20 20 20  l project {..   
44e0: 20 6e 61 6d 65 73 70 61 63 65 20 69 6d 70 6f 72   namespace impor
44f0: 74 20 3a 3a 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a  t ::vc::fossil::
4500: 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 70 72 6f  import::cvs::pro
4510: 6a 65 63 74 3a 3a 73 79 6d 0a 09 7d 0a 09 6e 61  ject::sym..}..na
4520: 6d 65 73 70 61 63 65 20 69 6d 70 6f 72 74 20 3a  mespace import :
4530: 3a 76 63 3a 3a 74 6f 6f 6c 73 3a 3a 6d 69 73 63  :vc::tools::misc
4540: 3a 3a 6e 73 70 0a 09 6e 61 6d 65 73 70 61 63 65  ::nsp..namespace
4550: 20 69 6d 70 6f 72 74 20 3a 3a 76 63 3a 3a 74 6f   import ::vc::to
4560: 6f 6c 73 3a 3a 6c 6f 67 0a 09 6c 6f 67 20 72 65  ols::log..log re
4570: 67 69 73 74 65 72 20 66 69 6c 74 65 72 73 79 6d  gister filtersym
4580: 0a 20 20 20 20 7d 0a 7d 0a 0a 23 20 23 20 23 23  .    }.}..# # ##
4590: 20 23 23 23 20 23 23 23 23 23 20 23 23 23 23 23   ### ##### #####
45a0: 23 23 23 20 23 23 23 23 23 23 23 23 23 23 23 23  ### ############
45b0: 23 20 23 23 23 23 23 23 23 23 23 23 23 23 23 23  # ##############
45c0: 23 23 23 23 23 23 23 0a 23 23 20 52 65 61 64 79  #######.## Ready
45d0: 0a 0a 70 61 63 6b 61 67 65 20 70 72 6f 76 69 64  ..package provid
45e0: 65 20 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d  e vc::fossil::im
45f0: 70 6f 72 74 3a 3a 63 76 73 3a 3a 70 61 73 73 3a  port::cvs::pass:
4600: 3a 66 69 6c 74 65 72 73 79 6d 20 31 2e 30 0a 72  :filtersym 1.0.r
4610: 65 74 75 72 6e 0a                                eturn.