Hex Artifact Content
Not logged in

Artifact 3dc3d0fe9b761bf79ddad7337dd1b35f8a9e8a41:

File tools/cvs2fossil/lib/c2f_pfiltersym.tcl part of check-in [37734390ca] - Pass 4 nearly completed. Rewrite symbol mutation, completed adjustment of symbol parents, added symbol refinement (noop or not flags). Now only missing piece is replication of the pass 2 paranoia checks. Note: Checks in the adjustment of parents are a bottleneck. May need indices, or something we can do in memory. by aku on 2007-11-07 06:22:32.

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: 70 72 6f 6a 65 63 74 3a 3a 73 79 6d 20 3b 20 23  project::sym ; #
04a0: 20 50 72 6f 6a 65 63 74 20 6c 65 76 65 6c 20 73   Project level s
04b0: 79 6d 62 6f 6c 73 0a 0a 23 20 23 20 23 23 20 23  ymbols..# # ## #
04c0: 23 23 20 23 23 23 23 23 20 23 23 23 23 23 23 23  ## ##### #######
04d0: 23 20 23 23 23 23 23 23 23 23 23 23 23 23 23 20  # ############# 
04e0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23  ################
04f0: 23 23 23 23 23 0a 23 23 20 52 65 67 69 73 74 65  #####.## Registe
0500: 72 20 74 68 65 20 70 61 73 73 20 77 69 74 68 20  r the pass with 
0510: 74 68 65 20 6d 61 6e 61 67 65 6d 65 6e 74 0a 0a  the management..
0520: 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f  vc::fossil::impo
0530: 72 74 3a 3a 63 76 73 3a 3a 70 61 73 73 20 64 65  rt::cvs::pass de
0540: 66 69 6e 65 20 5c 0a 20 20 20 20 46 69 6c 74 65  fine \.    Filte
0550: 72 53 79 6d 62 6f 6c 73 20 5c 0a 20 20 20 20 7b  rSymbols \.    {
0560: 46 69 6c 74 65 72 20 73 79 6d 62 6f 6c 73 2c 20  Filter symbols, 
0570: 72 65 6d 6f 76 65 20 61 6c 6c 20 65 78 63 6c 75  remove all exclu
0580: 64 65 64 20 70 69 65 63 65 73 7d 20 5c 0a 20 20  ded pieces} \.  
0590: 20 20 3a 3a 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a    ::vc::fossil::
05a0: 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 70 61 73  import::cvs::pas
05b0: 73 3a 3a 66 69 6c 74 65 72 73 79 6d 0a 0a 23 20  s::filtersym..# 
05c0: 23 20 23 23 20 23 23 23 20 23 23 23 23 23 20 23  # ## ### ##### #
05d0: 23 23 23 23 23 23 23 20 23 23 23 23 23 23 23 23  ####### ########
05e0: 23 23 23 23 23 20 23 23 23 23 23 23 23 23 23 23  ##### ##########
05f0: 23 23 23 23 23 23 23 23 23 23 23 0a 23 23 20 0a  ###########.## .
0600: 0a 73 6e 69 74 3a 3a 74 79 70 65 20 3a 3a 76 63  .snit::type ::vc
0610: 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 74  ::fossil::import
0620: 3a 3a 63 76 73 3a 3a 70 61 73 73 3a 3a 66 69 6c  ::cvs::pass::fil
0630: 74 65 72 73 79 6d 20 7b 0a 20 20 20 20 23 20 23  tersym {.    # #
0640: 20 23 23 20 23 23 23 20 23 23 23 23 23 20 23 23   ## ### ##### ##
0650: 23 23 23 23 23 23 20 23 23 23 23 23 23 23 23 23  ###### #########
0660: 23 23 23 23 0a 20 20 20 20 23 23 20 50 75 62 6c  ####.    ## Publ
0670: 69 63 20 41 50 49 0a 0a 20 20 20 20 74 79 70 65  ic API..    type
0680: 6d 65 74 68 6f 64 20 73 65 74 75 70 20 7b 7d 20  method setup {} 
0690: 7b 0a 09 23 20 44 65 66 69 6e 65 20 6e 61 6d 65  {..# Define name
06a0: 73 20 61 6e 64 20 73 74 72 75 63 74 75 72 65 20  s and structure 
06b0: 6f 66 20 74 68 65 20 70 65 72 73 69 73 74 65 6e  of the persisten
06c0: 74 20 73 74 61 74 65 20 6f 66 20 74 68 69 73 0a  t state of this.
06d0: 09 23 20 70 61 73 73 2e 0a 0a 09 73 74 61 74 65  .# pass....state
06e0: 20 72 65 61 64 69 6e 67 20 73 79 6d 62 6f 6c 0a   reading symbol.
06f0: 09 73 74 61 74 65 20 72 65 61 64 69 6e 67 20 62  .state reading b
0700: 6c 6f 63 6b 65 72 0a 09 73 74 61 74 65 20 72 65  locker..state re
0710: 61 64 69 6e 67 20 70 61 72 65 6e 74 0a 09 73 74  ading parent..st
0720: 61 74 65 20 72 65 61 64 69 6e 67 20 70 72 65 66  ate reading pref
0730: 65 72 65 64 70 61 72 65 6e 74 0a 09 73 74 61 74  eredparent..stat
0740: 65 20 72 65 61 64 69 6e 67 20 72 65 76 69 73 69  e reading revisi
0750: 6f 6e 0a 09 73 74 61 74 65 20 72 65 61 64 69 6e  on..state readin
0760: 67 20 62 72 61 6e 63 68 0a 09 73 74 61 74 65 20  g branch..state 
0770: 72 65 61 64 69 6e 67 20 74 61 67 0a 0a 09 73 74  reading tag...st
0780: 61 74 65 20 77 72 69 74 69 6e 67 20 6e 6f 6f 70  ate writing noop
0790: 20 7b 0a 09 20 20 20 20 69 64 20 20 20 20 49 4e   {..    id    IN
07a0: 54 45 47 45 52 20 4e 4f 54 20 4e 55 4c 4c 20 20  TEGER NOT NULL  
07b0: 50 52 49 4d 41 52 59 20 4b 45 59 2c 20 2d 2d 20  PRIMARY KEY, -- 
07c0: 74 61 67 2f 62 72 61 6e 63 68 20 72 65 66 65 72  tag/branch refer
07d0: 65 6e 63 65 0a 09 20 20 20 20 6e 6f 6f 70 20 20  ence..    noop  
07e0: 49 4e 54 45 47 45 52 20 4e 4f 54 20 4e 55 4c 4c  INTEGER NOT NULL
07f0: 0a 09 7d 0a 09 72 65 74 75 72 6e 0a 20 20 20 20  ..}..return.    
0800: 7d 0a 0a 20 20 20 20 74 79 70 65 6d 65 74 68 6f  }..    typemetho
0810: 64 20 6c 6f 61 64 20 7b 7d 20 7b 0a 09 23 20 50  d load {} {..# P
0820: 61 73 73 20 6d 61 6e 61 67 65 72 20 69 6e 74 65  ass manager inte
0830: 72 66 61 63 65 2e 20 45 78 65 63 75 74 65 64 20  rface. Executed 
0840: 74 6f 20 6c 6f 61 64 20 64 61 74 61 20 63 6f 6d  to load data com
0850: 70 75 74 65 64 20 62 79 0a 09 23 20 74 68 69 73  puted by..# this
0860: 20 70 61 73 73 20 69 6e 74 6f 20 6d 65 6d 6f 72   pass into memor
0870: 79 20 77 68 65 6e 20 74 68 69 73 20 70 61 73 73  y when this pass
0880: 20 69 73 20 73 6b 69 70 70 65 64 20 69 6e 73 74   is skipped inst
0890: 65 61 64 20 6f 66 0a 09 23 20 65 78 65 63 75 74  ead of..# execut
08a0: 65 64 2e 0a 0a 09 23 20 54 68 65 20 72 65 73 75  ed....# The resu
08b0: 6c 74 73 20 6f 66 20 74 68 69 73 20 70 61 73 73  lts of this pass
08c0: 20 61 72 65 20 66 75 6c 6c 79 20 69 6e 20 74 68   are fully in th
08d0: 65 20 70 65 72 73 69 73 74 65 6e 74 20 73 74 61  e persistent sta
08e0: 74 65 2c 0a 09 23 20 74 68 65 72 65 20 69 73 20  te,..# there is 
08f0: 6e 6f 74 68 69 6e 67 20 74 6f 20 6c 6f 61 64 20  nothing to load 
0900: 66 6f 72 20 74 68 65 20 6e 65 78 74 20 6f 6e 65  for the next one
0910: 2e 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a  ...return.    }.
0920: 0a 20 20 20 20 74 79 70 65 6d 65 74 68 6f 64 20  .    typemethod 
0930: 72 75 6e 20 7b 7d 20 7b 0a 09 23 20 50 61 73 73  run {} {..# Pass
0940: 20 6d 61 6e 61 67 65 72 20 69 6e 74 65 72 66 61   manager interfa
0950: 63 65 2e 20 45 78 65 63 75 74 65 64 20 74 6f 20  ce. Executed to 
0960: 70 65 72 66 6f 72 6d 20 74 68 65 0a 09 23 20 66  perform the..# f
0970: 75 6e 63 74 69 6f 6e 61 6c 69 74 79 20 6f 66 20  unctionality of 
0980: 74 68 65 20 70 61 73 73 2e 0a 0a 09 23 20 54 68  the pass....# Th
0990: 65 20 72 65 6d 6f 76 61 6c 20 6f 66 20 65 78 63  e removal of exc
09a0: 6c 75 64 65 64 20 73 79 6d 62 6f 6c 73 20 61 6e  luded symbols an
09b0: 64 20 65 76 65 72 79 74 68 69 6e 67 20 72 65 66  d everything ref
09c0: 65 72 65 6e 63 69 6e 67 0a 09 23 20 74 6f 20 74  erencing..# to t
09d0: 68 65 6d 20 69 73 20 64 6f 6e 65 20 63 6f 6d 70  hem is done comp
09e0: 6c 65 74 65 6c 79 20 69 6e 20 74 68 65 20 64 61  letely in the da
09f0: 74 61 62 61 73 65 2e 0a 0a 09 73 74 61 74 65 20  tabase....state 
0a00: 74 72 61 6e 73 61 63 74 69 6f 6e 20 7b 0a 09 20  transaction {.. 
0a10: 20 20 20 46 69 6c 74 65 72 45 78 63 6c 75 64 65     FilterExclude
0a20: 64 53 79 6d 62 6f 6c 73 0a 09 20 20 20 20 4d 75  dSymbols..    Mu
0a30: 74 61 74 65 53 79 6d 62 6f 6c 73 0a 09 20 20 20  tateSymbols..   
0a40: 20 41 64 6a 75 73 74 50 61 72 65 6e 74 73 0a 09   AdjustParents..
0a50: 20 20 20 20 52 65 66 69 6e 65 53 79 6d 62 6f 6c      RefineSymbol
0a60: 73 0a 0a 09 20 20 20 20 23 20 43 6f 6e 73 69 64  s...    # Consid
0a70: 65 72 20 61 20 72 65 72 75 6e 20 6f 66 20 74 68  er a rerun of th
0a80: 65 20 70 61 73 73 20 32 20 70 61 72 61 6e 6f 69  e pass 2 paranoi
0a90: 61 20 63 68 65 63 6b 73 2e 0a 09 7d 0a 0a 09 6c  a checks...}...l
0aa0: 6f 67 20 77 72 69 74 65 20 31 20 66 69 6c 74 65  og write 1 filte
0ab0: 72 73 79 6d 20 22 46 69 6c 74 65 72 69 6e 67 20  rsym "Filtering 
0ac0: 63 6f 6d 70 6c 65 74 65 64 22 0a 09 72 65 74 75  completed"..retu
0ad0: 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 74 79  rn.    }..    ty
0ae0: 70 65 6d 65 74 68 6f 64 20 64 69 73 63 61 72 64  pemethod discard
0af0: 20 7b 7d 20 7b 0a 09 23 20 50 61 73 73 20 6d 61   {} {..# Pass ma
0b00: 6e 61 67 65 72 20 69 6e 74 65 72 66 61 63 65 2e  nager interface.
0b10: 20 45 78 65 63 75 74 65 64 20 66 6f 72 20 61 6c   Executed for al
0b20: 6c 20 70 61 73 73 65 73 20 61 66 74 65 72 20 74  l passes after t
0b30: 68 65 0a 09 23 20 72 75 6e 20 70 61 73 73 65 73  he..# run passes
0b40: 2c 20 74 6f 20 72 65 6d 6f 76 65 20 61 6c 6c 20  , to remove all 
0b50: 64 61 74 61 20 6f 66 20 74 68 69 73 20 70 61 73  data of this pas
0b60: 73 20 66 72 6f 6d 20 74 68 65 20 73 74 61 74 65  s from the state
0b70: 2c 0a 09 23 20 61 73 20 62 65 69 6e 67 20 6f 75  ,..# as being ou
0b80: 74 20 6f 66 20 64 61 74 65 2e 0a 09 72 65 74 75  t of date...retu
0b90: 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 23 20  rn.    }..    # 
0ba0: 23 20 23 23 20 23 23 23 20 23 23 23 23 23 20 23  # ## ### ##### #
0bb0: 23 23 23 23 23 23 23 20 23 23 23 23 23 23 23 23  ####### ########
0bc0: 23 23 23 23 23 0a 20 20 20 20 23 23 20 49 6e 74  #####.    ## Int
0bd0: 65 72 6e 61 6c 20 6d 65 74 68 6f 64 73 0a 0a 20  ernal methods.. 
0be0: 20 20 20 70 72 6f 63 20 46 69 6c 74 65 72 45 78     proc FilterEx
0bf0: 63 6c 75 64 65 64 53 79 6d 62 6f 6c 73 20 7b 7d  cludedSymbols {}
0c00: 20 7b 0a 09 6c 6f 67 20 77 72 69 74 65 20 33 20   {..log write 3 
0c10: 66 69 6c 74 65 72 73 79 6d 20 22 46 69 6c 74 65  filtersym "Filte
0c20: 72 20 6f 75 74 20 65 78 63 6c 75 64 65 64 20 73  r out excluded s
0c30: 79 6d 62 6f 6c 73 20 61 6e 64 20 75 73 65 72 73  ymbols and users
0c40: 22 0a 0a 09 23 20 57 65 20 70 75 6c 6c 20 61 6c  "...# We pull al
0c50: 6c 20 74 68 65 20 65 78 63 6c 75 64 65 64 20 73  l the excluded s
0c60: 79 6d 62 6f 6c 73 20 74 6f 67 65 74 68 65 72 20  ymbols together 
0c70: 69 6e 74 6f 20 61 20 74 61 62 6c 65 20 66 6f 72  into a table for
0c80: 0a 09 23 20 65 61 73 79 20 72 65 66 65 72 65 6e  ..# easy referen
0c90: 63 65 20 62 79 20 74 68 65 20 75 70 63 6f 6d 69  ce by the upcomi
0ca0: 6e 67 20 44 45 4c 45 54 45 20 61 6e 64 20 6f 74  ng DELETE and ot
0cb0: 68 65 72 20 73 74 61 74 65 6d 65 6e 74 73 2e 0a  her statements..
0cc0: 09 23 20 28 27 78 20 49 4e 20 74 61 62 6c 65 27  .# ('x IN table'
0cd0: 20 63 6c 61 75 73 65 73 29 2e 0a 0a 09 73 65 74   clauses)....set
0ce0: 20 65 78 63 6c 20 5b 70 72 6f 6a 65 63 74 3a 3a   excl [project::
0cf0: 73 79 6d 20 65 78 63 6c 75 64 65 64 5d 0a 0a 09  sym excluded]...
0d00: 73 74 61 74 65 20 72 75 6e 20 7b 0a 09 20 20 20  state run {..   
0d10: 20 43 52 45 41 54 45 20 54 45 4d 50 4f 52 41 52   CREATE TEMPORAR
0d20: 59 20 54 41 42 4c 45 20 65 78 63 6c 75 64 65 64  Y TABLE excluded
0d30: 73 79 6d 62 6f 6c 73 20 41 53 0a 09 20 20 20 20  symbols AS..    
0d40: 53 45 4c 45 43 54 20 73 69 64 0a 09 20 20 20 20  SELECT sid..    
0d50: 46 52 4f 4d 20 20 20 73 79 6d 62 6f 6c 0a 09 20  FROM   symbol.. 
0d60: 20 20 20 57 48 45 52 45 20 20 74 79 70 65 20 3d     WHERE  type =
0d70: 20 24 65 78 63 6c 0a 09 7d 0a 0a 09 23 20 46 69   $excl..}...# Fi
0d80: 72 73 74 20 77 65 20 68 61 76 65 20 74 6f 20 68  rst we have to h
0d90: 61 6e 64 6c 65 20 74 68 65 20 70 6f 73 73 69 62  andle the possib
0da0: 69 6c 69 74 79 20 6f 66 20 61 6e 20 65 78 63 6c  ility of an excl
0db0: 75 64 65 64 0a 09 23 20 4e 54 44 42 2e 20 54 68  uded..# NTDB. Th
0dc0: 69 73 20 69 73 20 61 20 73 70 65 63 69 61 6c 20  is is a special 
0dd0: 73 70 65 63 69 61 6c 20 63 61 73 65 20 74 68 65  special case the
0de0: 72 65 20 77 65 20 68 61 76 65 20 74 6f 0a 09 23  re we have to..#
0df0: 20 72 65 67 72 61 66 74 20 74 68 65 20 72 65 76   regraft the rev
0e00: 69 73 69 6f 6e 73 20 77 68 69 63 68 20 61 72 65  isions which are
0e10: 20 73 68 61 72 65 64 20 62 65 74 77 65 65 6e 20   shared between 
0e20: 74 68 65 20 4e 54 44 42 20 61 6e 64 0a 09 23 20  the NTDB and..# 
0e30: 54 72 75 6e 6b 20 6f 6e 74 6f 20 74 68 65 20 74  Trunk onto the t
0e40: 72 75 6e 6b 2c 20 70 72 65 76 65 6e 74 69 6e 67  runk, preventing
0e50: 20 74 68 65 69 72 20 64 65 6c 65 74 69 6f 6e 20   their deletion 
0e60: 6c 61 74 65 72 2e 20 57 65 0a 09 23 20 68 61 76  later. We..# hav
0e70: 65 20 63 6f 64 65 20 66 6f 72 20 74 68 61 74 20  e code for that 
0e80: 69 6e 20 27 66 69 6c 65 27 2c 20 68 6f 77 65 76  in 'file', howev
0e90: 65 72 20 74 68 61 74 20 6f 70 65 72 61 74 65 64  er that operated
0ea0: 20 6f 6e 20 74 68 65 0a 09 23 20 69 6e 2d 6d 65   on the..# in-me
0eb0: 6d 6f 72 79 20 72 65 76 69 73 69 6f 6e 20 6f 62  mory revision ob
0ec0: 6a 65 63 74 73 2c 20 77 68 69 63 68 20 77 65 20  jects, which we 
0ed0: 64 6f 20 6e 6f 74 20 68 61 76 65 20 68 65 72 65  do not have here
0ee0: 2e 20 57 65 20 64 6f 0a 09 23 20 74 68 65 20 73  . We do..# the s
0ef0: 61 6d 65 20 6e 6f 77 20 77 69 74 68 6f 75 74 20  ame now without 
0f00: 6f 62 6a 65 63 74 2c 20 62 79 20 64 69 72 65 63  object, by direc
0f10: 74 6c 79 20 6d 61 6e 69 70 75 6c 61 74 69 6e 67  tly manipulating
0f20: 20 74 68 65 0a 09 23 20 6c 69 6e 6b 73 20 69 6e   the..# links in
0f30: 20 74 68 65 20 64 61 74 61 62 61 73 65 2e 0a 0a   the database...
0f40: 09 61 72 72 61 79 20 73 65 74 20 6e 74 64 62 20  .array set ntdb 
0f50: 7b 7d 0a 09 61 72 72 61 79 20 73 65 74 20 6c 69  {}..array set li
0f60: 6e 6b 20 7b 7d 0a 0a 09 66 6f 72 65 61 63 68 20  nk {}...foreach 
0f70: 7b 69 64 20 70 61 72 65 6e 74 20 74 72 61 6e 73  {id parent trans
0f80: 66 65 72 7d 20 5b 73 74 61 74 65 20 72 75 6e 20  fer} [state run 
0f90: 7b 0a 09 20 20 20 20 53 45 4c 45 43 54 20 52 2e  {..    SELECT R.
0fa0: 72 69 64 2c 20 52 2e 70 61 72 65 6e 74 2c 20 52  rid, R.parent, R
0fb0: 2e 64 62 63 68 69 6c 64 0a 09 20 20 20 20 46 52  .dbchild..    FR
0fc0: 4f 4d 20 20 72 65 76 69 73 69 6f 6e 20 52 2c 20  OM  revision R, 
0fd0: 73 79 6d 62 6f 6c 20 53 0a 09 20 20 20 20 57 48  symbol S..    WH
0fe0: 45 52 45 20 52 2e 6c 6f 64 20 3d 20 53 2e 73 69  ERE R.lod = S.si
0ff0: 64 0a 09 20 20 20 20 41 4e 44 20 20 20 53 2e 73  d..    AND   S.s
1000: 69 64 20 49 4e 20 65 78 63 6c 75 64 65 64 73 79  id IN excludedsy
1010: 6d 62 6f 6c 73 0a 09 20 20 20 20 41 4e 44 20 20  mbols..    AND  
1020: 20 52 2e 69 73 64 65 66 61 75 6c 74 0a 09 7d 5d   R.isdefault..}]
1030: 20 7b 0a 09 20 20 20 20 73 65 74 20 6e 74 64 62   {..    set ntdb
1040: 28 24 69 64 29 20 24 70 61 72 65 6e 74 0a 09 20  ($id) $parent.. 
1050: 20 20 20 69 66 20 7b 24 74 72 61 6e 73 66 65 72     if {$transfer
1060: 20 65 71 20 22 22 7d 20 63 6f 6e 74 69 6e 75 65   eq ""} continue
1070: 0a 09 20 20 20 20 73 65 74 20 6c 69 6e 6b 28 24  ..    set link($
1080: 69 64 29 20 24 74 72 61 6e 73 66 65 72 0a 09 7d  id) $transfer..}
1090: 0a 0a 09 66 6f 72 65 61 63 68 20 6a 6f 69 6e 74  ...foreach joint
10a0: 20 5b 61 72 72 61 79 20 6e 61 6d 65 73 20 6c 69   [array names li
10b0: 6e 6b 5d 20 7b 0a 09 20 20 20 20 23 20 54 68 65  nk] {..    # The
10c0: 20 6a 6f 69 6e 74 73 20 61 72 65 20 74 68 65 20   joints are the 
10d0: 68 69 67 68 65 73 74 20 4e 54 44 42 20 72 65 76  highest NTDB rev
10e0: 69 73 69 6f 6e 73 20 77 68 69 63 68 20 61 72 65  isions which are
10f0: 0a 09 20 20 20 20 23 20 73 68 61 72 65 64 20 77  ..    # shared w
1100: 69 74 68 20 74 68 65 69 72 20 72 65 73 70 65 63  ith their respec
1110: 74 69 76 65 20 74 72 75 6e 6b 2e 20 57 65 20 64  tive trunk. We d
1120: 69 73 63 6f 6e 6e 65 63 74 20 66 72 6f 6d 0a 09  isconnect from..
1130: 20 20 20 20 23 20 74 68 65 69 72 20 4e 54 44 42      # their NTDB
1140: 20 63 68 69 6c 64 72 65 6e 2c 20 61 6e 64 20 6d   children, and m
1150: 61 6b 65 20 74 68 65 6d 20 70 61 72 65 6e 74 73  ake them parents
1160: 20 6f 66 20 74 68 65 69 72 0a 09 20 20 20 20 23   of their..    #
1170: 20 27 64 62 63 68 69 6c 64 27 2e 20 54 68 65 20   'dbchild'. The 
1180: 61 73 73 6f 63 69 61 74 65 64 20 27 64 62 70 61  associated 'dbpa
1190: 72 65 6e 74 27 20 69 73 20 73 71 75 61 73 68 65  rent' is squashe
11a0: 64 0a 09 20 20 20 20 23 20 69 6e 73 74 65 61 64  d..    # instead
11b0: 2e 20 41 6c 6c 20 70 61 72 65 6e 74 73 20 6f 66  . All parents of
11c0: 20 74 68 65 20 6a 6f 69 6e 74 73 20 61 72 65 20   the joints are 
11d0: 6d 6f 76 65 64 20 74 6f 20 74 68 65 0a 09 20 20  moved to the..  
11e0: 20 20 23 20 74 72 75 6e 6b 20 61 73 20 77 65 6c    # trunk as wel
11f0: 6c 2e 0a 0a 09 20 20 20 20 73 65 74 20 74 6a 6f  l....    set tjo
1200: 69 6e 74 20 24 6c 69 6e 6b 28 24 6a 6f 69 6e 74  int $link($joint
1210: 29 0a 09 20 20 20 20 73 65 74 20 74 6c 6f 64 20  )..    set tlod 
1220: 5b 6c 69 6e 64 65 78 20 5b 73 74 61 74 65 20 72  [lindex [state r
1230: 75 6e 20 7b 0a 09 09 53 45 4c 45 43 54 20 6c 6f  un {...SELECT lo
1240: 64 20 46 52 4f 4d 20 72 65 76 69 73 69 6f 6e 20  d FROM revision 
1250: 57 48 45 52 45 20 72 69 64 20 3d 20 24 74 6a 6f  WHERE rid = $tjo
1260: 69 6e 74 0a 09 20 20 20 20 7d 5d 20 30 5d 0a 0a  int..    }] 0]..
1270: 09 20 20 20 20 23 20 43 6f 76 6e 65 72 74 20 64  .    # Covnert d
1280: 62 2f 70 61 72 65 6e 74 2f 63 68 69 6c 64 20 69  b/parent/child i
1290: 6e 74 6f 20 72 65 67 75 6c 61 72 20 70 61 72 65  nto regular pare
12a0: 6e 74 2f 63 68 69 6c 64 20 6c 69 6e 6b 73 2e 0a  nt/child links..
12b0: 09 20 20 20 20 73 74 61 74 65 20 72 75 6e 20 7b  .    state run {
12c0: 0a 09 09 55 50 44 41 54 45 20 72 65 76 69 73 69  ...UPDATE revisi
12d0: 6f 6e 20 53 45 54 20 64 62 70 61 72 65 6e 74 20  on SET dbparent 
12e0: 3d 20 4e 55 4c 4c 2c 20 70 61 72 65 6e 74 20 3d  = NULL, parent =
12f0: 20 24 6a 6f 69 6e 74 20 20 57 48 45 52 45 20 72   $joint  WHERE r
1300: 69 64 20 3d 20 24 74 6a 6f 69 6e 74 20 3b 0a 09  id = $tjoint ;..
1310: 09 55 50 44 41 54 45 20 72 65 76 69 73 69 6f 6e  .UPDATE revision
1320: 20 53 45 54 20 64 62 63 68 69 6c 64 20 20 3d 20   SET dbchild  = 
1330: 4e 55 4c 4c 2c 20 63 68 69 6c 64 20 20 3d 20 24  NULL, child  = $
1340: 74 6a 6f 69 6e 74 20 57 48 45 52 45 20 72 69 64  tjoint WHERE rid
1350: 20 3d 20 24 6a 6f 69 6e 74 20 20 3b 0a 09 20 20   = $joint  ;..  
1360: 20 20 7d 0a 09 20 20 20 20 77 68 69 6c 65 20 7b    }..    while {
1370: 31 7d 20 7b 0a 09 09 23 20 4d 6f 76 65 20 74 68  1} {...# Move th
1380: 65 20 4e 54 44 42 20 74 72 75 6e 6b 20 72 65 76  e NTDB trunk rev
1390: 69 73 69 6f 6e 73 20 74 6f 20 74 72 75 6e 6b 2e  isions to trunk.
13a0: 0a 09 09 73 74 61 74 65 20 72 75 6e 20 7b 0a 09  ...state run {..
13b0: 09 20 20 20 20 55 50 44 41 54 45 20 72 65 76 69  .    UPDATE revi
13c0: 73 69 6f 6e 20 53 45 54 20 6c 6f 64 20 3d 20 24  sion SET lod = $
13d0: 74 6c 6f 64 2c 20 69 73 64 65 66 61 75 6c 74 20  tlod, isdefault 
13e0: 3d 20 30 20 57 48 45 52 45 20 72 69 64 20 3d 20  = 0 WHERE rid = 
13f0: 24 6a 6f 69 6e 74 0a 09 09 7d 0a 09 09 73 65 74  $joint...}...set
1400: 20 6c 61 73 74 20 24 6a 6f 69 6e 74 0a 09 09 73   last $joint...s
1410: 65 74 20 6a 6f 69 6e 74 20 24 6e 74 64 62 28 24  et joint $ntdb($
1420: 6a 6f 69 6e 74 29 0a 09 09 69 66 20 7b 21 5b 69  joint)...if {![i
1430: 6e 66 6f 20 65 78 69 73 74 73 20 6e 74 64 62 28  nfo exists ntdb(
1440: 24 6a 6f 69 6e 74 29 5d 7d 20 62 72 65 61 6b 0a  $joint)]} break.
1450: 09 20 20 20 20 7d 0a 0a 09 20 20 20 20 23 20 52  .    }...    # R
1460: 65 61 63 68 65 64 20 74 68 65 20 4e 54 44 42 20  eached the NTDB 
1470: 62 61 73 69 73 20 69 6e 20 74 68 65 20 74 72 75  basis in the tru
1480: 6e 6b 2e 20 46 69 6e 61 6c 69 7a 65 20 74 68 65  nk. Finalize the
1490: 0a 09 20 20 20 20 23 20 70 61 72 65 6e 74 2f 63  ..    # parent/c
14a0: 68 69 6c 64 20 6c 69 6e 6b 61 67 65 20 61 6e 64  hild linkage and
14b0: 20 73 71 75 61 73 68 20 74 68 65 20 62 72 61 6e   squash the bran
14c0: 63 68 20 70 61 72 65 6e 74 20 73 79 6d 62 6f 6c  ch parent symbol
14d0: 0a 09 20 20 20 20 23 20 72 65 66 65 72 65 6e 63  ..    # referenc
14e0: 65 2e 0a 0a 09 20 20 20 20 73 74 61 74 65 20 72  e....    state r
14f0: 75 6e 20 7b 0a 09 09 55 50 44 41 54 45 20 72 65  un {...UPDATE re
1500: 76 69 73 69 6f 6e 20 53 45 54 20 63 68 69 6c 64  vision SET child
1510: 20 20 20 3d 20 24 6c 61 73 74 20 57 48 45 52 45     = $last WHERE
1520: 20 72 69 64 20 3d 20 24 6a 6f 69 6e 74 20 3b 0a   rid = $joint ;.
1530: 09 09 55 50 44 41 54 45 20 72 65 76 69 73 69 6f  ..UPDATE revisio
1540: 6e 20 53 45 54 20 62 70 61 72 65 6e 74 20 3d 20  n SET bparent = 
1550: 4e 55 4c 4c 20 20 57 48 45 52 45 20 72 69 64 20  NULL  WHERE rid 
1560: 3d 20 24 6c 61 73 74 20 20 3b 0a 09 20 20 20 20  = $last  ;..    
1570: 7d 0a 09 7d 0a 0a 09 23 20 4e 6f 77 20 74 68 61  }..}...# Now tha
1580: 74 20 74 68 65 20 73 70 65 63 69 61 6c 20 63 61  t the special ca
1590: 73 65 20 69 73 20 64 6f 6e 65 20 77 65 20 63 61  se is done we ca
15a0: 6e 20 73 69 6d 70 6c 79 20 6b 69 6c 6c 20 61 6c  n simply kill al
15b0: 6c 20 74 68 65 0a 09 23 20 72 65 76 69 73 69 6f  l the..# revisio
15c0: 6e 73 2c 20 74 61 67 73 2c 20 61 6e 64 20 62 72  ns, tags, and br
15d0: 61 6e 63 68 65 73 20 72 65 66 65 72 65 6e 63 69  anches referenci
15e0: 6e 67 20 61 6e 79 20 6f 66 20 74 68 65 0a 09 23  ng any of the..#
15f0: 20 65 78 63 6c 75 64 65 64 20 73 79 6d 62 6f 6c   excluded symbol
1600: 73 20 69 6e 20 73 6f 6d 65 20 77 61 79 2e 20 54  s in some way. T
1610: 68 69 73 20 69 73 20 65 61 73 79 20 61 73 20 77  his is easy as w
1620: 65 20 64 6f 20 6e 6f 74 20 68 61 76 65 0a 09 23  e do not have..#
1630: 20 74 6f 20 73 65 6c 65 63 74 20 74 68 65 6d 20   to select them 
1640: 61 67 61 69 6e 20 61 6e 64 20 61 67 61 69 6e 20  again and again 
1650: 66 72 6f 6d 20 74 68 65 20 62 61 73 65 20 74 61  from the base ta
1660: 62 6c 65 73 20 61 6e 79 0a 09 23 20 6c 6f 6e 67  bles any..# long
1670: 65 72 2e 0a 0a 09 73 74 61 74 65 20 72 75 6e 20  er....state run 
1680: 7b 0a 09 20 20 20 20 44 45 4c 45 54 45 20 46 52  {..    DELETE FR
1690: 4f 4d 20 72 65 76 69 73 69 6f 6e 20 57 48 45 52  OM revision WHER
16a0: 45 20 6c 6f 64 20 49 4e 20 65 78 63 6c 75 64 65  E lod IN exclude
16b0: 64 73 79 6d 62 6f 6c 73 3b 0a 09 20 20 20 20 44  dsymbols;..    D
16c0: 45 4c 45 54 45 20 46 52 4f 4d 20 74 61 67 20 20  ELETE FROM tag  
16d0: 20 20 20 20 57 48 45 52 45 20 6c 6f 64 20 49 4e      WHERE lod IN
16e0: 20 65 78 63 6c 75 64 65 64 73 79 6d 62 6f 6c 73   excludedsymbols
16f0: 3b 0a 09 20 20 20 20 44 45 4c 45 54 45 20 46 52  ;..    DELETE FR
1700: 4f 4d 20 74 61 67 20 20 20 20 20 20 57 48 45 52  OM tag      WHER
1710: 45 20 73 69 64 20 49 4e 20 65 78 63 6c 75 64 65  E sid IN exclude
1720: 64 73 79 6d 62 6f 6c 73 3b 0a 09 20 20 20 20 44  dsymbols;..    D
1730: 45 4c 45 54 45 20 46 52 4f 4d 20 62 72 61 6e 63  ELETE FROM branc
1740: 68 20 20 20 57 48 45 52 45 20 6c 6f 64 20 49 4e  h   WHERE lod IN
1750: 20 65 78 63 6c 75 64 65 64 73 79 6d 62 6f 6c 73   excludedsymbols
1760: 3b 0a 09 20 20 20 20 44 45 4c 45 54 45 20 46 52  ;..    DELETE FR
1770: 4f 4d 20 62 72 61 6e 63 68 20 20 20 57 48 45 52  OM branch   WHER
1780: 45 20 73 69 64 20 49 4e 20 65 78 63 6c 75 64 65  E sid IN exclude
1790: 64 73 79 6d 62 6f 6c 73 3b 0a 0a 09 20 20 20 20  dsymbols;...    
17a0: 44 52 4f 50 20 54 41 42 4c 45 20 65 78 63 6c 75  DROP TABLE exclu
17b0: 64 65 64 73 79 6d 62 6f 6c 73 3b 0a 09 7d 0a 09  dedsymbols;..}..
17c0: 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20  return.    }..  
17d0: 20 20 70 72 6f 63 20 4d 75 74 61 74 65 53 79 6d    proc MutateSym
17e0: 62 6f 6c 73 20 7b 7d 20 7b 0a 09 23 20 4e 65 78  bols {} {..# Nex
17f0: 74 2c 20 6e 6f 77 20 74 68 61 74 20 77 65 20 6b  t, now that we k
1800: 6e 6f 77 20 77 68 69 63 68 20 73 79 6d 62 6f 6c  now which symbol
1810: 73 20 61 72 65 20 77 68 61 74 20 77 65 20 6c 6f  s are what we lo
1820: 6f 6b 20 66 6f 72 0a 09 23 20 66 69 6c 65 20 6c  ok for..# file l
1830: 65 76 65 6c 20 74 61 67 73 20 77 68 69 63 68 20  evel tags which 
1840: 61 72 65 20 61 63 74 75 61 6c 6c 79 20 63 6f 6e  are actually con
1850: 76 65 72 74 65 64 20 61 73 20 62 72 61 6e 63 68  verted as branch
1860: 65 73 0a 09 23 20 28 70 72 6f 6a 65 63 74 20 6c  es..# (project l
1870: 65 76 65 6c 2c 20 61 6e 64 20 76 69 63 65 20 76  evel, and vice v
1880: 65 72 73 61 29 2c 20 61 6e 64 20 6d 6f 76 65 20  ersa), and move 
1890: 74 68 65 6d 20 74 6f 20 74 68 65 0a 09 23 20 63  them to the..# c
18a0: 6f 72 72 65 63 74 20 74 61 62 6c 65 73 2e 0a 0a  orrect tables...
18b0: 09 23 20 23 20 23 23 20 23 23 23 20 23 23 23 23  .# # ## ### ####
18c0: 23 20 23 23 23 23 23 23 23 23 20 23 23 23 23 23  # ######## #####
18d0: 23 23 23 23 23 23 23 23 0a 0a 09 6c 6f 67 20 77  ########...log w
18e0: 72 69 74 65 20 33 20 66 69 6c 74 65 72 73 79 6d  rite 3 filtersym
18f0: 20 22 4d 75 74 61 74 65 20 73 79 6d 62 6f 6c 73   "Mutate symbols
1900: 2c 20 70 72 65 70 61 72 61 74 69 6f 6e 22 0a 0a  , preparation"..
1910: 09 73 65 74 20 62 72 61 6e 63 68 20 5b 70 72 6f  .set branch [pro
1920: 6a 65 63 74 3a 3a 73 79 6d 20 62 72 61 6e 63 68  ject::sym branch
1930: 5d 0a 09 73 65 74 20 74 61 67 20 20 20 20 5b 70  ]..set tag    [p
1940: 72 6f 6a 65 63 74 3a 3a 73 79 6d 20 74 61 67 5d  roject::sym tag]
1950: 0a 0a 09 73 65 74 20 74 61 67 73 74 6f 6d 75 74  ...set tagstomut
1960: 61 74 65 20 5b 73 74 61 74 65 20 72 75 6e 20 7b  ate [state run {
1970: 0a 09 20 20 20 20 53 45 4c 45 43 54 20 54 2e 74  ..    SELECT T.t
1980: 69 64 2c 20 54 2e 66 69 64 2c 20 54 2e 6c 6f 64  id, T.fid, T.lod
1990: 2c 20 54 2e 73 69 64 2c 20 54 2e 72 65 76 0a 09  , T.sid, T.rev..
19a0: 20 20 20 20 46 52 4f 4d 20 74 61 67 20 54 2c 20      FROM tag T, 
19b0: 73 79 6d 62 6f 6c 20 53 0a 09 20 20 20 20 57 48  symbol S..    WH
19c0: 45 52 45 20 54 2e 73 69 64 20 3d 20 53 2e 73 69  ERE T.sid = S.si
19d0: 64 0a 09 20 20 20 20 41 4e 44 20 53 2e 74 79 70  d..    AND S.typ
19e0: 65 20 3d 20 24 62 72 61 6e 63 68 0a 09 7d 5d 0a  e = $branch..}].
19f0: 0a 09 73 65 74 20 62 72 61 6e 63 68 65 73 74 6f  ..set branchesto
1a00: 6d 75 74 61 74 65 20 5b 73 74 61 74 65 20 72 75  mutate [state ru
1a10: 6e 20 7b 0a 09 20 20 20 20 53 45 4c 45 43 54 20  n {..    SELECT 
1a20: 42 2e 62 69 64 2c 20 42 2e 66 69 64 2c 20 42 2e  B.bid, B.fid, B.
1a30: 6c 6f 64 2c 20 42 2e 73 69 64 2c 20 42 2e 72 6f  lod, B.sid, B.ro
1a40: 6f 74 2c 20 42 2e 66 69 72 73 74 2c 20 42 2e 62  ot, B.first, B.b
1a50: 72 61 0a 09 20 20 20 20 46 52 4f 4d 20 62 72 61  ra..    FROM bra
1a60: 6e 63 68 20 42 2c 20 73 79 6d 62 6f 6c 20 53 0a  nch B, symbol S.
1a70: 09 20 20 20 20 57 48 45 52 45 20 42 2e 73 69 64  .    WHERE B.sid
1a80: 20 3d 20 53 2e 73 69 64 0a 09 20 20 20 20 41 4e   = S.sid..    AN
1a90: 44 20 53 2e 74 79 70 65 20 3d 20 24 74 61 67 0a  D S.type = $tag.
1aa0: 09 7d 5d 0a 0a 09 6c 6f 67 20 77 72 69 74 65 20  .}]...log write 
1ab0: 34 20 66 69 6c 74 65 72 73 79 6d 20 22 43 68 61  4 filtersym "Cha
1ac0: 6e 67 69 6e 67 20 5b 6e 73 70 20 5b 65 78 70 72  nging [nsp [expr
1ad0: 20 7b 5b 6c 6c 65 6e 67 74 68 20 24 74 61 67 73   {[llength $tags
1ae0: 74 6f 6d 75 74 61 74 65 5d 2f 35 7d 5d 20 74 61  tomutate]/5}] ta
1af0: 67 5d 20 69 6e 74 6f 20 62 72 61 6e 63 68 65 73  g] into branches
1b00: 22 0a 09 6c 6f 67 20 77 72 69 74 65 20 34 20 66  "..log write 4 f
1b10: 69 6c 74 65 72 73 79 6d 20 22 43 68 61 6e 67 69  iltersym "Changi
1b20: 6e 67 20 5b 6e 73 70 20 5b 65 78 70 72 20 7b 5b  ng [nsp [expr {[
1b30: 6c 6c 65 6e 67 74 68 20 24 62 72 61 6e 63 68 65  llength $branche
1b40: 73 74 6f 6d 75 74 61 74 65 5d 2f 37 7d 5d 20 62  stomutate]/7}] b
1b50: 72 61 6e 63 68 20 62 72 61 6e 63 68 65 73 5d 20  ranch branches] 
1b60: 69 6e 74 6f 20 74 61 67 73 22 0a 0a 09 23 20 23  into tags"...# #
1b70: 20 23 23 20 23 23 23 20 23 23 23 23 23 20 23 23   ## ### ##### ##
1b80: 23 23 23 23 23 23 20 23 23 23 23 23 23 23 23 23  ###### #########
1b90: 23 23 23 23 0a 0a 09 6c 6f 67 20 77 72 69 74 65  ####...log write
1ba0: 20 33 20 66 69 6c 74 65 72 73 79 6d 20 22 4d 75   3 filtersym "Mu
1bb0: 74 61 74 65 20 74 61 67 73 20 74 6f 20 62 72 61  tate tags to bra
1bc0: 6e 63 68 65 73 22 0a 0a 09 66 6f 72 65 61 63 68  nches"...foreach
1bd0: 20 7b 69 64 20 66 69 64 20 6c 6f 64 20 73 69 64   {id fid lod sid
1be0: 20 72 65 76 7d 20 24 74 61 67 73 74 6f 6d 75 74   rev} $tagstomut
1bf0: 61 74 65 20 7b 0a 09 20 20 20 20 73 74 61 74 65  ate {..    state
1c00: 20 72 75 6e 20 7b 0a 09 09 44 45 4c 45 54 45 20   run {...DELETE 
1c10: 46 52 4f 4d 20 74 61 67 20 57 48 45 52 45 20 74  FROM tag WHERE t
1c20: 69 64 20 3d 20 24 69 64 20 3b 0a 09 09 49 4e 53  id = $id ;...INS
1c30: 45 52 54 20 49 4e 54 4f 20 62 72 61 6e 63 68 20  ERT INTO branch 
1c40: 28 62 69 64 2c 20 66 69 64 2c 20 20 6c 6f 64 2c  (bid, fid,  lod,
1c50: 20 20 73 69 64 2c 20 20 72 6f 6f 74 2c 20 66 69    sid,  root, fi
1c60: 72 73 74 2c 20 62 72 61 2c 20 70 6f 73 29 0a 09  rst, bra, pos)..
1c70: 09 56 41 4c 55 45 53 20 20 20 20 20 20 20 20 20  .VALUES         
1c80: 20 20 20 20 28 24 69 64 2c 20 24 66 69 64 2c 20      ($id, $fid, 
1c90: 24 6c 6f 64 2c 20 24 73 69 64 2c 20 24 72 65 76  $lod, $sid, $rev
1ca0: 2c 20 4e 55 4c 4c 2c 20 20 27 27 2c 20 20 2d 31  , NULL,  '',  -1
1cb0: 29 3b 0a 09 20 20 20 20 7d 0a 09 7d 0a 0a 09 6c  );..    }..}...l
1cc0: 6f 67 20 77 72 69 74 65 20 33 20 66 69 6c 74 65  og write 3 filte
1cd0: 72 73 79 6d 20 22 4f 6b 2e 22 0a 0a 09 23 20 23  rsym "Ok."...# #
1ce0: 20 23 23 20 23 23 23 20 23 23 23 23 23 20 23 23   ## ### ##### ##
1cf0: 23 23 23 23 23 23 20 23 23 23 23 23 23 23 23 23  ###### #########
1d00: 23 23 23 23 0a 0a 09 6c 6f 67 20 77 72 69 74 65  ####...log write
1d10: 20 33 20 66 69 6c 74 65 72 73 79 6d 20 22 4d 75   3 filtersym "Mu
1d20: 74 61 74 65 20 62 72 61 6e 63 68 65 73 20 74 6f  tate branches to
1d30: 20 74 61 67 73 22 0a 0a 09 66 6f 72 65 61 63 68   tags"...foreach
1d40: 20 7b 69 64 20 66 69 64 20 6c 6f 64 20 73 69 64   {id fid lod sid
1d50: 20 72 6f 6f 74 20 66 69 72 73 74 20 62 72 61 7d   root first bra}
1d60: 20 24 62 72 61 6e 63 68 65 73 74 6f 6d 75 74 61   $branchestomuta
1d70: 74 65 20 7b 0a 09 20 20 20 20 73 74 61 74 65 20  te {..    state 
1d80: 72 75 6e 20 7b 0a 09 09 44 45 4c 45 54 45 20 46  run {...DELETE F
1d90: 52 4f 4d 20 62 72 61 6e 63 68 20 57 48 45 52 45  ROM branch WHERE
1da0: 20 62 69 64 20 3d 20 24 69 64 20 3b 0a 09 09 49   bid = $id ;...I
1db0: 4e 53 45 52 54 20 49 4e 54 4f 20 74 61 67 20 28  NSERT INTO tag (
1dc0: 74 69 64 2c 20 66 69 64 2c 20 20 6c 6f 64 2c 20  tid, fid,  lod, 
1dd0: 20 73 69 64 2c 20 20 72 65 76 29 0a 09 09 56 41   sid,  rev)...VA
1de0: 4c 55 45 53 20 20 20 20 20 20 20 20 20 20 28 24  LUES          ($
1df0: 69 64 2c 20 24 66 69 64 2c 20 24 6c 6f 64 2c 20  id, $fid, $lod, 
1e00: 24 73 69 64 2c 20 24 72 6f 6f 74 29 3b 0a 09 20  $sid, $root);.. 
1e10: 20 20 20 7d 0a 09 7d 0a 0a 09 6c 6f 67 20 77 72     }..}...log wr
1e20: 69 74 65 20 33 20 66 69 6c 74 65 72 73 79 6d 20  ite 3 filtersym 
1e30: 22 4f 6b 2e 22 0a 0a 09 23 20 23 20 23 23 20 23  "Ok."...# # ## #
1e40: 23 23 20 23 23 23 23 23 20 23 23 23 23 23 23 23  ## ##### #######
1e50: 23 20 23 23 23 23 23 23 23 23 23 23 23 23 23 0a  # #############.
1e60: 09 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20  .return.    }.. 
1e70: 20 20 20 23 20 41 64 6a 75 73 74 20 74 68 65 20     # Adjust the 
1e80: 70 61 72 65 6e 74 73 20 6f 66 20 73 79 6d 62 6f  parents of symbo
1e90: 6c 73 20 74 6f 20 74 68 65 69 72 20 70 72 65 66  ls to their pref
1ea0: 65 72 72 65 64 20 70 61 72 65 6e 74 73 2e 0a 0a  erred parents...
1eb0: 20 20 20 20 23 20 49 66 20 61 20 66 69 6c 65 20      # If a file 
1ec0: 6c 65 76 65 6c 20 79 6d 62 6f 6c 20 68 61 73 20  level ymbol has 
1ed0: 61 20 70 72 65 66 65 72 72 65 64 20 70 61 72 65  a preferred pare
1ee0: 6e 74 20 74 68 61 74 20 69 73 20 64 69 66 66 65  nt that is diffe
1ef0: 72 65 6e 74 0a 20 20 20 20 23 20 74 68 61 6e 20  rent.    # than 
1f00: 69 74 73 20 63 75 72 72 65 6e 74 20 70 61 72 65  its current pare
1f10: 6e 74 2c 20 61 6e 64 20 69 66 20 74 68 65 20 70  nt, and if the p
1f20: 72 65 66 65 72 72 65 64 20 70 61 72 65 6e 74 20  referred parent 
1f30: 69 73 20 61 6e 0a 20 20 20 20 23 20 61 6c 6c 6f  is an.    # allo
1f40: 77 65 64 20 70 61 72 65 6e 74 20 6f 66 20 74 68  wed parent of th
1f50: 65 20 73 79 6d 62 6f 6c 20 69 6e 20 74 68 69 73  e symbol in this
1f60: 20 66 69 6c 65 2c 20 74 68 65 6e 20 77 65 20 67   file, then we g
1f70: 72 61 66 74 20 74 68 65 0a 20 20 20 20 23 20 61  raft the.    # a
1f80: 53 79 6d 62 6f 6c 20 6f 6e 74 6f 20 69 74 73 20  Symbol onto its 
1f90: 70 72 65 66 65 72 72 65 64 20 70 61 72 65 6e 74  preferred parent
1fa0: 2e 0a 0a 20 20 20 20 70 72 6f 63 20 41 64 6a 75  ...    proc Adju
1fb0: 73 74 50 61 72 65 6e 74 73 20 7b 7d 20 7b 0a 09  stParents {} {..
1fc0: 6c 6f 67 20 77 72 69 74 65 20 33 20 66 69 6c 74  log write 3 filt
1fd0: 65 72 73 79 6d 20 22 41 64 6a 75 73 74 20 70 61  ersym "Adjust pa
1fe0: 72 65 6e 74 73 2c 20 6c 6f 61 64 69 6e 67 20 64  rents, loading d
1ff0: 61 74 61 20 69 6e 20 70 72 65 70 61 72 61 74 69  ata in preparati
2000: 6f 6e 22 0a 0a 09 23 20 57 65 20 70 75 6c 6c 20  on"...# We pull 
2010: 69 6d 70 6f 72 74 61 6e 74 20 6d 61 70 73 20 6f  important maps o
2020: 6e 63 65 20 69 6e 74 6f 20 6d 65 6d 6f 72 79 20  nce into memory 
2030: 73 6f 20 74 68 61 74 20 77 65 20 64 6f 20 71 75  so that we do qu
2040: 69 63 6b 0a 09 23 20 68 61 73 68 20 6c 6f 6f 6b  ick..# hash look
2050: 75 70 20 6c 61 74 65 72 20 77 68 65 6e 20 70 72  up later when pr
2060: 6f 63 65 73 73 69 6e 67 20 74 68 65 20 67 72 61  ocessing the gra
2070: 66 74 20 63 61 6e 64 69 64 61 74 65 73 2e 0a 0a  ft candidates...
2080: 09 23 20 54 61 67 2f 42 72 61 6e 63 68 20 6e 61  .# Tag/Branch na
2090: 6d 65 73 20 2e 2e 2e 0a 09 61 72 72 61 79 20 73  mes .....array s
20a0: 65 74 20 73 6e 20 5b 73 74 61 74 65 20 72 75 6e  et sn [state run
20b0: 20 7b 20 53 45 4c 45 43 54 20 54 2e 74 69 64 2c   { SELECT T.tid,
20c0: 20 53 2e 6e 61 6d 65 20 46 52 4f 4d 20 74 61 67   S.name FROM tag
20d0: 20 54 2c 20 20 20 20 73 79 6d 62 6f 6c 20 53 20   T,    symbol S 
20e0: 57 48 45 52 45 20 54 2e 73 69 64 20 3d 20 53 2e  WHERE T.sid = S.
20f0: 73 69 64 20 7d 5d 0a 09 61 72 72 61 79 20 73 65  sid }]..array se
2100: 74 20 73 6e 20 5b 73 74 61 74 65 20 72 75 6e 20  t sn [state run 
2110: 7b 20 53 45 4c 45 43 54 20 42 2e 62 69 64 2c 20  { SELECT B.bid, 
2120: 53 2e 6e 61 6d 65 20 46 52 4f 4d 20 62 72 61 6e  S.name FROM bran
2130: 63 68 20 42 2c 20 73 79 6d 62 6f 6c 20 53 20 57  ch B, symbol S W
2140: 48 45 52 45 20 42 2e 73 69 64 20 3d 20 53 2e 73  HERE B.sid = S.s
2150: 69 64 20 7d 5d 0a 09 23 20 53 79 6d 62 6f 6c 20  id }]..# Symbol 
2160: 6e 61 6d 65 73 20 2e 2e 2e 0a 09 61 72 72 61 79  names .....array
2170: 20 73 65 74 20 73 78 20 5b 73 74 61 74 65 20 72   set sx [state r
2180: 75 6e 20 7b 20 53 45 4c 45 43 54 20 4c 2e 73 69  un { SELECT L.si
2190: 64 2c 20 4c 2e 6e 61 6d 65 20 46 52 4f 4d 20 73  d, L.name FROM s
21a0: 79 6d 62 6f 6c 20 4c 20 7d 5d 0a 09 23 20 46 69  ymbol L }]..# Fi
21b0: 6c 65 73 20 61 6e 64 20 70 72 6f 6a 65 63 74 73  les and projects
21c0: 2e 0a 09 61 72 72 61 79 20 73 65 74 20 66 70 6e  ...array set fpn
21d0: 20 7b 7d 0a 09 66 6f 72 65 61 63 68 20 7b 69 64   {}..foreach {id
21e0: 20 66 6e 20 70 6e 7d 20 5b 73 74 61 74 65 20 72   fn pn} [state r
21f0: 75 6e 20 7b 0a 09 09 53 45 4c 45 43 54 20 46 2e  un {...SELECT F.
2200: 66 69 64 2c 20 46 2e 6e 61 6d 65 2c 20 50 2e 6e  fid, F.name, P.n
2210: 61 6d 65 0a 09 09 46 52 4f 4d 20 20 20 66 69 6c  ame...FROM   fil
2220: 65 20 46 2c 20 70 72 6f 6a 65 63 74 20 50 0a 09  e F, project P..
2230: 09 57 48 45 52 45 20 20 46 2e 70 69 64 20 3d 20  .WHERE  F.pid = 
2240: 50 2e 70 69 64 0a 09 7d 5d 20 7b 20 73 65 74 20  P.pid..}] { set 
2250: 66 70 6e 28 24 69 64 29 20 5b 6c 69 73 74 20 24  fpn($id) [list $
2260: 66 6e 20 24 70 6e 5d 20 7d 0a 0a 09 73 65 74 20  fn $pn] }...set 
2270: 74 61 67 73 74 6f 61 64 6a 75 73 74 20 5b 73 74  tagstoadjust [st
2280: 61 74 65 20 72 75 6e 20 7b 0a 09 20 20 20 20 53  ate run {..    S
2290: 45 4c 45 43 54 20 54 2e 74 69 64 2c 20 54 2e 66  ELECT T.tid, T.f
22a0: 69 64 2c 20 54 2e 6c 6f 64 2c 20 50 2e 70 69 64  id, T.lod, P.pid
22b0: 2c 20 53 2e 6e 61 6d 65 2c 20 52 2e 72 65 76 2c  , S.name, R.rev,
22c0: 20 52 2e 72 69 64 0a 09 20 20 20 20 46 52 4f 4d   R.rid..    FROM
22d0: 20 74 61 67 20 54 2c 20 70 72 65 66 65 72 65 64   tag T, prefered
22e0: 70 61 72 65 6e 74 20 50 2c 20 73 79 6d 62 6f 6c  parent P, symbol
22f0: 20 53 2c 20 72 65 76 69 73 69 6f 6e 20 52 0a 09   S, revision R..
2300: 20 20 20 20 57 48 45 52 45 20 54 2e 73 69 64 20      WHERE T.sid 
2310: 3d 20 50 2e 73 69 64 0a 09 20 20 20 20 41 4e 44  = P.sid..    AND
2320: 20 20 20 54 2e 6c 6f 64 20 21 3d 20 50 2e 70 69     T.lod != P.pi
2330: 64 0a 09 20 20 20 20 41 4e 44 20 20 20 50 2e 70  d..    AND   P.p
2340: 69 64 20 3d 20 53 2e 73 69 64 0a 09 20 20 20 20  id = S.sid..    
2350: 41 4e 44 20 20 20 53 2e 6e 61 6d 65 20 21 3d 20  AND   S.name != 
2360: 27 3a 74 72 75 6e 6b 3a 27 0a 09 20 20 20 20 41  ':trunk:'..    A
2370: 4e 44 20 20 20 54 2e 72 65 76 20 3d 20 52 2e 72  ND   T.rev = R.r
2380: 69 64 09 0a 09 7d 5d 0a 0a 09 73 65 74 20 62 72  id...}]...set br
2390: 61 6e 63 68 65 73 74 6f 61 64 6a 75 73 74 20 5b  anchestoadjust [
23a0: 73 74 61 74 65 20 72 75 6e 20 7b 0a 09 20 20 20  state run {..   
23b0: 20 53 45 4c 45 43 54 20 42 2e 62 69 64 2c 20 42   SELECT B.bid, B
23c0: 2e 66 69 64 2c 20 42 2e 6c 6f 64 2c 20 42 2e 70  .fid, B.lod, B.p
23d0: 6f 73 2c 20 50 2e 70 69 64 2c 20 53 2e 6e 61 6d  os, P.pid, S.nam
23e0: 65 2c 20 52 2e 72 65 76 2c 20 52 2e 72 69 64 0a  e, R.rev, R.rid.
23f0: 09 20 20 20 20 46 52 4f 4d 20 62 72 61 6e 63 68  .    FROM branch
2400: 20 42 2c 20 70 72 65 66 65 72 65 64 70 61 72 65   B, preferedpare
2410: 6e 74 20 50 2c 20 73 79 6d 62 6f 6c 20 53 2c 20  nt P, symbol S, 
2420: 72 65 76 69 73 69 6f 6e 20 52 0a 09 20 20 20 20  revision R..    
2430: 57 48 45 52 45 20 42 2e 73 69 64 20 3d 20 50 2e  WHERE B.sid = P.
2440: 73 69 64 0a 09 20 20 20 20 41 4e 44 20 20 20 42  sid..    AND   B
2450: 2e 6c 6f 64 20 21 3d 20 50 2e 70 69 64 0a 09 20  .lod != P.pid.. 
2460: 20 20 20 41 4e 44 20 20 20 50 2e 70 69 64 20 3d     AND   P.pid =
2470: 20 53 2e 73 69 64 0a 09 20 20 20 20 41 4e 44 20   S.sid..    AND 
2480: 20 20 53 2e 6e 61 6d 65 20 21 3d 20 27 3a 74 72    S.name != ':tr
2490: 75 6e 6b 3a 27 0a 09 20 20 20 20 41 4e 44 20 20  unk:'..    AND  
24a0: 20 42 2e 72 6f 6f 74 20 3d 20 52 2e 72 69 64 09   B.root = R.rid.
24b0: 0a 09 7d 5d 0a 0a 09 73 65 74 20 74 6d 61 78 20  ..}]...set tmax 
24c0: 5b 65 78 70 72 20 7b 5b 6c 6c 65 6e 67 74 68 20  [expr {[llength 
24d0: 24 74 61 67 73 74 6f 61 64 6a 75 73 74 5d 20 2f  $tagstoadjust] /
24e0: 20 37 7d 5d 0a 09 73 65 74 20 62 6d 61 78 20 5b   7}]..set bmax [
24f0: 65 78 70 72 20 7b 5b 6c 6c 65 6e 67 74 68 20 24  expr {[llength $
2500: 62 72 61 6e 63 68 65 73 74 6f 61 64 6a 75 73 74  branchestoadjust
2510: 5d 20 2f 20 38 7d 5d 0a 0a 09 6c 6f 67 20 77 72  ] / 8}]...log wr
2520: 69 74 65 20 34 20 66 69 6c 74 65 72 73 79 6d 20  ite 4 filtersym 
2530: 22 52 65 70 61 72 65 6e 74 69 6e 67 20 61 74 20  "Reparenting at 
2540: 6d 6f 73 74 20 5b 6e 73 70 20 24 74 6d 61 78 20  most [nsp $tmax 
2550: 74 61 67 5d 22 0a 09 6c 6f 67 20 77 72 69 74 65  tag]"..log write
2560: 20 34 20 66 69 6c 74 65 72 73 79 6d 20 22 52 65   4 filtersym "Re
2570: 70 61 72 65 6e 74 69 6e 67 20 61 74 20 6d 6f 73  parenting at mos
2580: 74 20 5b 6e 73 70 20 24 62 6d 61 78 20 62 72 61  t [nsp $bmax bra
2590: 6e 63 68 20 62 72 61 6e 63 68 65 73 5d 22 0a 0a  nch branches]"..
25a0: 09 6c 6f 67 20 77 72 69 74 65 20 33 20 66 69 6c  .log write 3 fil
25b0: 74 65 72 73 79 6d 20 22 41 64 6a 75 73 74 20 74  tersym "Adjust t
25c0: 61 67 20 70 61 72 65 6e 74 73 22 0a 0a 09 23 20  ag parents"...# 
25d0: 46 69 6e 64 20 74 68 65 20 74 61 67 73 20 77 68  Find the tags wh
25e0: 6f 73 65 20 63 75 72 72 65 6e 74 20 70 61 72 65  ose current pare
25f0: 6e 74 20 28 6c 6f 64 29 20 69 73 20 6e 6f 74 20  nt (lod) is not 
2600: 74 68 65 20 70 72 65 66 65 72 65 64 0a 09 23 20  the prefered..# 
2610: 70 61 72 65 6e 74 2c 20 74 68 65 20 70 72 65 66  parent, the pref
2620: 65 72 65 64 20 70 61 72 65 6e 74 20 69 73 20 6e  ered parent is n
2630: 6f 74 20 74 68 65 20 74 72 75 6e 6b 2c 20 61 6e  ot the trunk, an
2640: 64 20 74 68 65 0a 09 23 20 70 72 65 66 65 72 65  d the..# prefere
2650: 64 20 70 61 72 65 6e 74 20 69 73 20 61 20 70 6f  d parent is a po
2660: 73 73 69 62 6c 65 20 70 61 72 65 6e 74 20 70 65  ssible parent pe
2670: 72 20 74 68 65 20 74 61 67 27 73 20 72 65 76 69  r the tag's revi
2680: 73 69 6f 6e 2e 0a 0a 09 73 65 74 20 66 6d 74 20  sion....set fmt 
2690: 25 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20  %[string length 
26a0: 24 74 6d 61 78 5d 73 0a 09 73 65 74 20 6d 78 73  $tmax]s..set mxs
26b0: 20 5b 66 6f 72 6d 61 74 20 24 66 6d 74 20 24 74   [format $fmt $t
26c0: 6d 61 78 5d 0a 0a 09 73 65 74 20 6e 20 30 0a 09  max]...set n 0..
26d0: 66 6f 72 65 61 63 68 20 7b 69 64 20 66 69 64 20  foreach {id fid 
26e0: 6c 6f 64 20 70 69 64 20 70 72 65 66 65 72 65 64  lod pid prefered
26f0: 6e 61 6d 65 20 72 65 76 6e 72 20 72 69 64 7d 20  name revnr rid} 
2700: 24 74 61 67 73 74 6f 61 64 6a 75 73 74 20 7b 0a  $tagstoadjust {.
2710: 0a 09 20 20 20 20 23 20 42 4f 54 54 4c 45 2d 4e  ..    # BOTTLE-N
2720: 45 43 4b 20 2e 2e 2e 0a 09 20 20 20 20 23 0a 09  ECK .....    #..
2730: 20 20 20 20 23 20 54 68 65 20 63 68 65 63 6b 20      # The check 
2740: 69 66 20 74 68 65 20 63 61 6e 64 69 64 61 74 65  if the candidate
2750: 20 28 70 69 64 29 20 69 73 20 74 72 75 6c 79 20   (pid) is truly 
2760: 76 69 61 62 6c 65 20 69 73 0a 09 20 20 20 20 23  viable is..    #
2770: 20 62 61 73 65 64 20 66 69 6e 64 69 6e 67 20 74   based finding t
2780: 68 65 20 62 72 61 6e 63 68 20 61 73 20 70 6f 73  he branch as pos
2790: 73 69 62 6c 65 20 70 61 72 65 6e 74 2c 20 61 6e  sible parent, an
27a0: 64 20 64 6f 6e 65 0a 09 20 20 20 20 23 20 6e 6f  d done..    # no
27b0: 77 20 69 6e 73 74 65 61 64 20 6f 66 20 61 73 20  w instead of as 
27c0: 70 61 72 74 20 6f 66 20 74 68 65 20 61 6c 72 65  part of the alre
27d0: 61 64 79 20 63 6f 6d 70 6c 65 78 20 6a 6f 69 6e  ady complex join
27e0: 2e 0a 09 20 20 20 20 23 0a 09 20 20 20 20 23 20  ...    #..    # 
27f0: 2e 2e 2e 20 41 4e 44 20 50 2e 70 69 64 20 49 4e  ... AND P.pid IN
2800: 20 28 53 45 4c 45 43 54 20 42 2e 73 69 64 0a 09   (SELECT B.sid..
2810: 20 20 20 20 23 20 20 20 20 20 20 20 20 20 20 20      #           
2820: 20 20 20 20 20 20 20 20 46 52 4f 4d 20 62 72 61          FROM bra
2830: 6e 63 68 20 42 0a 09 20 20 20 20 23 20 20 20 20  nch B..    #    
2840: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 57                 W
2850: 48 45 52 45 20 42 2e 72 6f 6f 74 20 3d 20 52 2e  HERE B.root = R.
2860: 72 69 64 29 0a 0a 09 20 20 20 20 69 66 20 7b 21  rid)...    if {!
2870: 5b 6c 69 6e 64 65 78 20 5b 73 74 61 74 65 20 72  [lindex [state r
2880: 75 6e 20 7b 0a 09 09 53 45 4c 45 43 54 20 43 4f  un {...SELECT CO
2890: 55 4e 54 28 2a 29 0a 09 09 46 52 4f 4d 20 62 72  UNT(*)...FROM br
28a0: 61 6e 63 68 20 42 0a 09 09 57 48 45 52 45 20 20  anch B...WHERE  
28b0: 42 2e 73 69 64 20 20 3d 20 24 70 69 64 0a 09 09  B.sid  = $pid...
28c0: 41 4e 44 20 20 20 20 42 2e 72 6f 6f 74 20 3d 20  AND    B.root = 
28d0: 24 72 69 64 0a 09 20 20 20 20 7d 5d 20 30 5d 7d  $rid..    }] 0]}
28e0: 20 7b 0a 09 09 69 6e 63 72 20 74 6d 61 78 20 2d   {...incr tmax -
28f0: 31 0a 09 09 73 65 74 20 20 6d 78 73 20 5b 66 6f  1...set  mxs [fo
2900: 72 6d 61 74 20 24 66 6d 74 20 24 74 6d 61 78 5d  rmat $fmt $tmax]
2910: 0a 09 09 63 6f 6e 74 69 6e 75 65 0a 09 20 20 20  ...continue..   
2920: 20 7d 0a 0a 09 20 20 20 20 23 0a 09 20 20 20 20   }...    #..    
2930: 23 20 42 4f 54 54 4c 45 2d 4e 45 43 4b 20 2e 2e  # BOTTLE-NECK ..
2940: 2e 0a 0a 09 20 20 20 20 23 20 54 68 65 20 6e 61  ....    # The na
2950: 6d 65 73 20 66 6f 72 20 75 73 65 20 69 6e 20 74  mes for use in t
2960: 68 65 20 6c 6f 67 20 6f 75 74 70 75 74 20 61 72  he log output ar
2970: 65 20 72 65 74 72 69 65 76 65 64 0a 09 20 20 20  e retrieved..   
2980: 20 23 20 73 65 70 61 72 61 74 65 6c 79 2c 20 74   # separately, t
2990: 6f 20 6b 65 65 70 20 74 68 65 20 6a 6f 69 6e 20  o keep the join 
29a0: 73 65 6c 65 63 74 69 6e 67 20 74 68 65 20 61 64  selecting the ad
29b0: 6a 75 73 74 61 62 6c 65 0a 09 20 20 20 20 23 20  justable..    # 
29c0: 74 61 67 73 20 73 6d 61 6c 6c 2c 20 6e 6f 74 20  tags small, not 
29d0: 62 75 72 64 65 6e 65 64 20 77 69 74 68 20 74 68  burdened with th
29e0: 65 20 64 65 72 65 66 65 72 65 6e 63 69 6e 67 20  e dereferencing 
29f0: 6f 66 20 6c 69 6e 6b 73 0a 09 20 20 20 20 23 20  of links..    # 
2a00: 74 6f 20 6e 61 6d 65 2e 0a 0a 09 20 20 20 20 73  to name....    s
2a10: 65 74 20 74 61 67 6e 61 6d 65 20 24 73 6e 28 24  et tagname $sn($
2a20: 69 64 29 0a 09 20 20 20 20 73 65 74 20 6f 6c 64  id)..    set old
2a30: 6e 61 6d 65 20 24 73 78 28 24 6c 6f 64 29 0a 09  name $sx($lod)..
2a40: 20 20 20 20 73 74 72 75 63 74 3a 3a 6c 69 73 74      struct::list
2a50: 20 61 73 73 69 67 6e 20 24 66 70 6e 28 24 66 69   assign $fpn($fi
2a60: 64 29 20 66 6e 61 6d 65 20 70 72 6e 61 6d 65 0a  d) fname prname.
2a70: 0a 09 20 20 20 20 23 20 44 6f 20 74 68 65 20 67  ..    # Do the g
2a80: 72 61 66 74 69 6e 67 2e 0a 0a 09 20 20 20 20 6c  rafting....    l
2a90: 6f 67 20 77 72 69 74 65 20 34 20 66 69 6c 74 65  og write 4 filte
2aa0: 72 73 79 6d 20 22 5c 5b 5b 66 6f 72 6d 61 74 20  rsym "\[[format 
2ab0: 24 66 6d 74 20 24 6e 5d 2f 24 6d 78 73 5c 5d 20  $fmt $n]/$mxs\] 
2ac0: 24 70 72 6e 61 6d 65 20 3a 20 47 72 61 66 74 69  $prname : Grafti
2ad0: 6e 67 20 74 61 67 20 27 24 74 61 67 6e 61 6d 65  ng tag '$tagname
2ae0: 27 20 6f 6e 20 24 66 6e 61 6d 65 2f 24 72 65 76  ' on $fname/$rev
2af0: 6e 72 20 66 72 6f 6d 20 27 24 6f 6c 64 6e 61 6d  nr from '$oldnam
2b00: 65 27 20 6f 6e 74 6f 20 27 24 70 72 65 66 65 72  e' onto '$prefer
2b10: 65 64 6e 61 6d 65 27 22 0a 09 20 20 20 20 73 74  edname'"..    st
2b20: 61 74 65 20 72 75 6e 20 7b 20 55 50 44 41 54 45  ate run { UPDATE
2b30: 20 74 61 67 20 53 45 54 20 6c 6f 64 20 3d 20 24   tag SET lod = $
2b40: 70 69 64 20 57 48 45 52 45 20 74 69 64 20 3d 20  pid WHERE tid = 
2b50: 24 69 64 20 3b 20 7d 0a 09 20 20 20 20 69 6e 63  $id ; }..    inc
2b60: 72 20 6e 0a 09 7d 0a 0a 09 6c 6f 67 20 77 72 69  r n..}...log wri
2b70: 74 65 20 33 20 66 69 6c 74 65 72 73 79 6d 20 22  te 3 filtersym "
2b80: 52 65 70 61 72 65 6e 74 65 64 20 5b 6e 73 70 20  Reparented [nsp 
2b90: 24 6e 20 74 61 67 5d 22 0a 0a 09 6c 6f 67 20 77  $n tag]"...log w
2ba0: 72 69 74 65 20 33 20 66 69 6c 74 65 72 73 79 6d  rite 3 filtersym
2bb0: 20 22 41 64 6a 75 73 74 20 62 72 61 6e 63 68 20   "Adjust branch 
2bc0: 70 61 72 65 6e 74 73 22 0a 0a 09 23 20 46 69 6e  parents"...# Fin
2bd0: 64 20 74 68 65 20 62 72 61 6e 63 68 65 73 20 77  d the branches w
2be0: 68 6f 73 65 20 63 75 72 72 65 6e 74 20 70 61 72  hose current par
2bf0: 65 6e 74 20 28 6c 6f 64 29 20 69 73 20 6e 6f 74  ent (lod) is not
2c00: 20 74 68 65 0a 09 23 20 70 72 65 66 65 72 65 64   the..# prefered
2c10: 20 70 61 72 65 6e 74 2c 20 74 68 65 20 70 72 65   parent, the pre
2c20: 66 65 72 65 64 20 70 61 72 65 6e 74 20 69 73 20  fered parent is 
2c30: 6e 6f 74 20 74 68 65 20 74 72 75 6e 6b 2c 20 61  not the trunk, a
2c40: 6e 64 0a 09 23 20 74 68 65 20 70 72 65 66 65 72  nd..# the prefer
2c50: 65 64 20 70 61 72 65 6e 74 20 69 73 20 61 20 70  ed parent is a p
2c60: 6f 73 73 69 62 6c 65 20 70 61 72 65 6e 74 20 70  ossible parent p
2c70: 65 72 20 74 68 65 20 62 72 61 6e 63 68 27 73 0a  er the branch's.
2c80: 09 23 20 72 65 76 69 73 69 6f 6e 2e 0a 0a 09 73  .# revision....s
2c90: 65 74 20 66 6d 74 20 25 5b 73 74 72 69 6e 67 20  et fmt %[string 
2ca0: 6c 65 6e 67 74 68 20 24 62 6d 61 78 5d 73 0a 09  length $bmax]s..
2cb0: 73 65 74 20 6d 78 73 20 5b 66 6f 72 6d 61 74 20  set mxs [format 
2cc0: 24 66 6d 74 20 24 62 6d 61 78 5d 0a 0a 09 73 65  $fmt $bmax]...se
2cd0: 74 20 6e 20 30 0a 09 66 6f 72 65 61 63 68 20 7b  t n 0..foreach {
2ce0: 69 64 20 66 69 64 20 6c 6f 64 20 70 6f 73 20 70  id fid lod pos p
2cf0: 69 64 20 70 72 65 66 65 72 65 64 6e 61 6d 65 20  id preferedname 
2d00: 72 65 76 6e 72 20 72 69 64 7d 20 24 62 72 61 6e  revnr rid} $bran
2d10: 63 68 65 73 74 6f 61 64 6a 75 73 74 20 7b 0a 0a  chestoadjust {..
2d20: 09 20 20 20 20 23 20 42 4f 54 54 4c 45 2d 4e 45  .    # BOTTLE-NE
2d30: 43 4b 20 2e 2e 2e 0a 09 20 20 20 20 23 0a 09 20  CK .....    #.. 
2d40: 20 20 20 23 20 54 68 65 20 63 68 65 63 6b 20 69     # The check i
2d50: 66 20 74 68 65 20 63 61 6e 64 69 64 61 74 65 20  f the candidate 
2d60: 28 70 69 64 29 20 69 73 20 74 72 75 6c 79 20 76  (pid) is truly v
2d70: 69 61 62 6c 65 20 69 73 0a 09 20 20 20 20 23 20  iable is..    # 
2d80: 62 61 73 65 64 20 6f 6e 20 74 68 65 20 62 72 61  based on the bra
2d90: 6e 63 68 20 70 6f 73 69 74 69 6f 6e 73 20 69 6e  nch positions in
2da0: 20 74 68 65 20 73 70 61 77 6e 69 6e 67 20 72 65   the spawning re
2db0: 76 69 73 69 6f 6e 2c 0a 09 20 20 20 20 23 20 61  vision,..    # a
2dc0: 6e 64 20 64 6f 6e 65 20 6e 6f 77 20 69 6e 73 74  nd done now inst
2dd0: 65 61 64 20 6f 66 20 61 73 20 70 61 72 74 20 6f  ead of as part o
2de0: 66 20 74 68 65 20 61 6c 72 65 61 64 79 20 63 6f  f the already co
2df0: 6d 70 6c 65 78 0a 09 20 20 20 20 23 20 6a 6f 69  mplex..    # joi
2e00: 6e 2e 0a 09 20 20 20 20 23 0a 09 20 20 20 20 23  n...    #..    #
2e10: 20 2e 2e 2e 20 41 4e 44 20 50 2e 70 69 64 20 49   ... AND P.pid I
2e20: 4e 20 28 53 45 4c 45 43 54 20 42 58 2e 73 69 64  N (SELECT BX.sid
2e30: 0a 09 20 20 20 20 23 20 20 20 20 20 20 20 20 20  ..    #         
2e40: 20 20 20 20 20 20 20 20 20 20 46 52 4f 4d 20 62            FROM b
2e50: 72 61 6e 63 68 20 42 58 0a 09 20 20 20 20 23 20  ranch BX..    # 
2e60: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
2e70: 20 20 57 48 45 52 45 20 42 58 2e 72 6f 6f 74 20    WHERE BX.root 
2e80: 3d 20 52 2e 72 69 64 0a 09 20 20 20 20 23 20 20  = R.rid..    #  
2e90: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
2ea0: 20 41 4e 44 20 20 20 42 58 2e 70 6f 73 20 3e 20   AND   BX.pos > 
2eb0: 42 2e 70 6f 73 29 0a 0a 09 20 20 20 20 69 66 20  B.pos)...    if 
2ec0: 7b 21 5b 6c 69 6e 64 65 78 20 5b 73 74 61 74 65  {![lindex [state
2ed0: 20 72 75 6e 20 7b 0a 09 09 53 45 4c 45 43 54 20   run {...SELECT 
2ee0: 43 4f 55 4e 54 28 2a 29 0a 09 09 46 52 4f 4d 20  COUNT(*)...FROM 
2ef0: 62 72 61 6e 63 68 20 42 0a 09 09 57 48 45 52 45  branch B...WHERE
2f00: 20 20 42 2e 73 69 64 20 20 3d 20 24 70 69 64 0a    B.sid  = $pid.
2f10: 09 09 41 4e 44 20 20 20 20 42 2e 72 6f 6f 74 20  ..AND    B.root 
2f20: 3d 20 24 72 69 64 0a 09 09 41 4e 44 20 20 20 20  = $rid...AND    
2f30: 42 2e 70 6f 73 20 20 3e 20 24 70 6f 73 0a 09 20  B.pos  > $pos.. 
2f40: 20 20 20 7d 5d 20 30 5d 7d 20 7b 0a 09 09 69 6e     }] 0]} {...in
2f50: 63 72 20 62 6d 61 78 20 2d 31 0a 09 09 73 65 74  cr bmax -1...set
2f60: 20 20 6d 78 73 20 5b 66 6f 72 6d 61 74 20 24 66    mxs [format $f
2f70: 6d 74 20 24 62 6d 61 78 5d 0a 09 09 63 6f 6e 74  mt $bmax]...cont
2f80: 69 6e 75 65 0a 09 20 20 20 20 7d 0a 0a 09 20 20  inue..    }...  
2f90: 20 20 23 0a 09 20 20 20 20 23 20 42 4f 54 54 4c    #..    # BOTTL
2fa0: 45 2d 4e 45 43 4b 20 2e 2e 2e 0a 0a 09 20 20 20  E-NECK ......   
2fb0: 20 23 20 54 68 65 20 6e 61 6d 65 73 20 66 6f 72   # The names for
2fc0: 20 75 73 65 20 69 6e 20 74 68 65 20 6c 6f 67 20   use in the log 
2fd0: 6f 75 74 70 75 74 20 61 72 65 20 72 65 74 72 69  output are retri
2fe0: 65 76 65 64 0a 09 20 20 20 20 23 20 73 65 70 61  eved..    # sepa
2ff0: 72 61 74 65 6c 79 2c 20 74 6f 20 6b 65 65 70 20  rately, to keep 
3000: 74 68 65 20 6a 6f 69 6e 20 73 65 6c 65 63 74 69  the join selecti
3010: 6e 67 20 74 68 65 20 61 64 6a 75 73 74 61 62 6c  ng the adjustabl
3020: 65 0a 09 20 20 20 20 23 20 74 61 67 73 20 73 6d  e..    # tags sm
3030: 61 6c 6c 2c 20 6e 6f 74 20 62 75 72 64 65 6e 65  all, not burdene
3040: 64 20 77 69 74 68 20 74 68 65 20 64 65 72 65 66  d with the deref
3050: 65 72 65 6e 63 69 6e 67 20 6f 66 20 6c 69 6e 6b  erencing of link
3060: 73 0a 09 20 20 20 20 23 20 74 6f 20 6e 61 6d 65  s..    # to name
3070: 2e 0a 0a 09 20 20 20 20 73 65 74 20 62 72 61 6e  ....    set bran
3080: 61 6d 65 20 24 73 6e 28 24 69 64 29 0a 09 20 20  ame $sn($id)..  
3090: 20 20 73 65 74 20 6f 6c 64 6e 61 6d 65 20 24 73    set oldname $s
30a0: 78 28 24 6c 6f 64 29 0a 09 20 20 20 20 73 74 72  x($lod)..    str
30b0: 75 63 74 3a 3a 6c 69 73 74 20 61 73 73 69 67 6e  uct::list assign
30c0: 20 24 66 70 6e 28 24 66 69 64 29 20 66 6e 61 6d   $fpn($fid) fnam
30d0: 65 20 70 72 6e 61 6d 65 0a 0a 09 20 20 20 20 23  e prname...    #
30e0: 20 44 6f 20 74 68 65 20 67 72 61 66 74 69 6e 67   Do the grafting
30f0: 2e 0a 0a 09 20 20 20 20 6c 6f 67 20 77 72 69 74  ....    log writ
3100: 65 20 34 20 66 69 6c 74 65 72 73 79 6d 20 22 5c  e 4 filtersym "\
3110: 5b 5b 66 6f 72 6d 61 74 20 24 66 6d 74 20 24 6e  [[format $fmt $n
3120: 5d 2f 24 6d 78 73 5c 5d 20 24 70 72 6e 61 6d 65  ]/$mxs\] $prname
3130: 20 3a 20 47 72 61 66 74 69 6e 67 20 62 72 61 6e   : Grafting bran
3140: 63 68 20 27 24 62 72 61 6e 61 6d 65 27 20 6f 6e  ch '$braname' on
3150: 20 24 66 6e 61 6d 65 2f 24 72 65 76 6e 72 20 66   $fname/$revnr f
3160: 72 6f 6d 20 27 24 6f 6c 64 6e 61 6d 65 27 20 6f  rom '$oldname' o
3170: 6e 74 6f 20 27 24 70 72 65 66 65 72 65 64 6e 61  nto '$preferedna
3180: 6d 65 27 22 0a 09 20 20 20 20 73 74 61 74 65 20  me'"..    state 
3190: 72 75 6e 20 7b 20 55 50 44 41 54 45 20 74 61 67  run { UPDATE tag
31a0: 20 53 45 54 20 6c 6f 64 20 3d 20 24 70 69 64 20   SET lod = $pid 
31b0: 57 48 45 52 45 20 74 69 64 20 3d 20 24 69 64 20  WHERE tid = $id 
31c0: 3b 20 7d 0a 09 20 20 20 20 69 6e 63 72 20 6e 0a  ; }..    incr n.
31d0: 09 7d 0a 0a 09 6c 6f 67 20 77 72 69 74 65 20 33  .}...log write 3
31e0: 20 66 69 6c 74 65 72 73 79 6d 20 22 52 65 70 61   filtersym "Repa
31f0: 72 65 6e 74 65 64 20 5b 6e 73 70 20 24 6e 20 62  rented [nsp $n b
3200: 72 61 6e 63 68 20 62 72 61 6e 63 68 65 73 5d 22  ranch branches]"
3210: 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a  ..return.    }..
3220: 20 20 20 20 70 72 6f 63 20 52 65 66 69 6e 65 53      proc RefineS
3230: 79 6d 62 6f 6c 73 20 7b 7d 20 7b 0a 09 23 20 54  ymbols {} {..# T
3240: 61 67 73 20 61 6e 64 20 62 72 61 6e 63 68 65 73  ags and branches
3250: 20 61 72 65 20 6d 61 72 6b 65 64 20 61 73 20 6e   are marked as n
3260: 6f 72 6d 61 6c 2f 6e 6f 6f 70 20 62 61 73 65 64  ormal/noop based
3270: 20 6f 6e 20 74 68 65 20 6f 70 0a 09 23 20 6f 66   on the op..# of
3280: 20 74 68 65 69 72 20 72 65 76 69 73 69 6f 6e 2e   their revision.
3290: 0a 0a 09 6c 6f 67 20 77 72 69 74 65 20 33 20 66  ...log write 3 f
32a0: 69 6c 74 65 72 73 79 6d 20 22 52 65 66 69 6e 65  iltersym "Refine
32b0: 20 73 79 6d 62 6f 6c 73 20 28 6e 6f 2d 6f 70 20   symbols (no-op 
32c0: 6f 72 20 6e 6f 74 3f 29 22 0a 0a 09 6c 6f 67 20  or not?)"...log 
32d0: 77 72 69 74 65 20 34 20 66 69 6c 74 65 72 73 79  write 4 filtersy
32e0: 6d 20 22 20 20 20 20 52 65 67 75 6c 61 72 20 74  m "    Regular t
32f0: 61 67 73 22 0a 09 73 74 61 74 65 20 72 75 6e 20  ags"..state run 
3300: 7b 0a 09 20 20 20 20 49 4e 53 45 52 54 20 49 4e  {..    INSERT IN
3310: 54 4f 20 6e 6f 6f 70 0a 09 20 20 20 20 53 45 4c  TO noop..    SEL
3320: 45 43 54 20 54 2e 74 69 64 2c 20 30 0a 09 20 20  ECT T.tid, 0..  
3330: 20 20 46 52 4f 4d 20 74 61 67 20 54 2c 20 72 65    FROM tag T, re
3340: 76 69 73 69 6f 6e 20 52 0a 09 20 20 20 20 57 48  vision R..    WH
3350: 45 52 45 20 54 2e 72 65 76 20 20 3d 20 52 2e 72  ERE T.rev  = R.r
3360: 69 64 0a 09 20 20 20 20 41 4e 44 20 20 20 52 2e  id..    AND   R.
3370: 6f 70 20 20 21 3d 20 30 20 2d 2d 20 30 20 3d 3d  op  != 0 -- 0 ==
3380: 20 6e 6f 74 68 69 6e 67 0a 09 7d 0a 0a 09 6c 6f   nothing..}...lo
3390: 67 20 77 72 69 74 65 20 34 20 66 69 6c 74 65 72  g write 4 filter
33a0: 73 79 6d 20 22 20 20 20 20 4e 6f 2d 6f 70 20 74  sym "    No-op t
33b0: 61 67 73 22 0a 09 73 74 61 74 65 20 72 75 6e 20  ags"..state run 
33c0: 7b 0a 09 20 20 20 20 49 4e 53 45 52 54 20 49 4e  {..    INSERT IN
33d0: 54 4f 20 6e 6f 6f 70 0a 09 20 20 20 20 53 45 4c  TO noop..    SEL
33e0: 45 43 54 20 54 2e 74 69 64 2c 20 31 0a 09 20 20  ECT T.tid, 1..  
33f0: 20 20 46 52 4f 4d 20 74 61 67 20 54 2c 20 72 65    FROM tag T, re
3400: 76 69 73 69 6f 6e 20 52 0a 09 20 20 20 20 57 48  vision R..    WH
3410: 45 52 45 20 54 2e 72 65 76 20 20 3d 20 52 2e 72  ERE T.rev  = R.r
3420: 69 64 0a 09 20 20 20 20 41 4e 44 20 20 20 52 2e  id..    AND   R.
3430: 6f 70 20 20 20 3d 20 30 20 2d 2d 20 6e 6f 74 68  op   = 0 -- noth
3440: 69 6e 67 0a 09 7d 0a 0a 09 6c 6f 67 20 77 72 69  ing..}...log wri
3450: 74 65 20 34 20 66 69 6c 74 65 72 73 79 6d 20 22  te 4 filtersym "
3460: 20 20 20 20 52 65 67 75 6c 61 72 20 62 72 61 6e      Regular bran
3470: 63 68 65 73 22 0a 09 73 74 61 74 65 20 72 75 6e  ches"..state run
3480: 20 7b 0a 09 20 20 20 20 49 4e 53 45 52 54 20 49   {..    INSERT I
3490: 4e 54 4f 20 6e 6f 6f 70 0a 09 20 20 20 20 53 45  NTO noop..    SE
34a0: 4c 45 43 54 20 42 2e 62 69 64 2c 20 30 0a 09 20  LECT B.bid, 0.. 
34b0: 20 20 20 46 52 4f 4d 20 62 72 61 6e 63 68 20 42     FROM branch B
34c0: 2c 20 72 65 76 69 73 69 6f 6e 20 52 0a 09 20 20  , revision R..  
34d0: 20 20 57 48 45 52 45 20 42 2e 72 6f 6f 74 20 3d    WHERE B.root =
34e0: 20 52 2e 72 69 64 0a 09 20 20 20 20 41 4e 44 20   R.rid..    AND 
34f0: 20 20 52 2e 6f 70 20 20 21 3d 20 30 20 2d 2d 20    R.op  != 0 -- 
3500: 6e 6f 74 68 69 6e 67 0a 09 7d 0a 0a 09 6c 6f 67  nothing..}...log
3510: 20 77 72 69 74 65 20 34 20 66 69 6c 74 65 72 73   write 4 filters
3520: 79 6d 20 22 20 20 20 20 4e 6f 2d 6f 70 20 62 72  ym "    No-op br
3530: 61 6e 63 68 65 73 22 0a 09 73 74 61 74 65 20 72  anches"..state r
3540: 75 6e 20 7b 0a 09 20 20 20 20 49 4e 53 45 52 54  un {..    INSERT
3550: 20 49 4e 54 4f 20 6e 6f 6f 70 0a 09 20 20 20 20   INTO noop..    
3560: 53 45 4c 45 43 54 20 42 2e 62 69 64 2c 20 31 0a  SELECT B.bid, 1.
3570: 09 20 20 20 20 46 52 4f 4d 20 62 72 61 6e 63 68  .    FROM branch
3580: 20 42 2c 20 72 65 76 69 73 69 6f 6e 20 52 0a 09   B, revision R..
3590: 20 20 20 20 57 48 45 52 45 20 42 2e 72 6f 6f 74      WHERE B.root
35a0: 20 3d 20 52 2e 72 69 64 0a 09 20 20 20 20 41 4e   = R.rid..    AN
35b0: 44 20 20 20 52 2e 6f 70 20 20 20 3d 20 30 20 2d  D   R.op   = 0 -
35c0: 2d 20 6e 6f 74 68 69 6e 67 0a 09 7d 0a 09 72 65  - nothing..}..re
35d0: 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20  turn.    }..    
35e0: 23 20 23 20 23 23 20 23 23 23 20 23 23 23 23 23  # # ## ### #####
35f0: 20 23 23 23 23 23 23 23 23 20 23 23 23 23 23 23   ######## ######
3600: 23 23 23 23 23 23 23 0a 20 20 20 20 23 23 20 43  #######.    ## C
3610: 6f 6e 66 69 67 75 72 61 74 69 6f 6e 0a 0a 20 20  onfiguration..  
3620: 20 20 70 72 61 67 6d 61 20 2d 68 61 73 69 6e 73    pragma -hasins
3630: 74 61 6e 63 65 73 20 20 20 6e 6f 20 3b 20 23 20  tances   no ; # 
3640: 73 69 6e 67 6c 65 74 6f 6e 0a 20 20 20 20 70 72  singleton.    pr
3650: 61 67 6d 61 20 2d 68 61 73 74 79 70 65 69 6e 66  agma -hastypeinf
3660: 6f 20 20 20 20 6e 6f 20 3b 20 23 20 6e 6f 20 69  o    no ; # no i
3670: 6e 74 72 6f 73 70 65 63 74 69 6f 6e 0a 20 20 20  ntrospection.   
3680: 20 70 72 61 67 6d 61 20 2d 68 61 73 74 79 70 65   pragma -hastype
3690: 64 65 73 74 72 6f 79 20 6e 6f 20 3b 20 23 20 69  destroy no ; # i
36a0: 6d 6d 6f 72 74 61 6c 0a 0a 20 20 20 20 23 20 23  mmortal..    # #
36b0: 20 23 23 20 23 23 23 20 23 23 23 23 23 20 23 23   ## ### ##### ##
36c0: 23 23 23 23 23 23 20 23 23 23 23 23 23 23 23 23  ###### #########
36d0: 23 23 23 23 0a 7d 0a 0a 6e 61 6d 65 73 70 61 63  ####.}..namespac
36e0: 65 20 65 76 61 6c 20 3a 3a 76 63 3a 3a 66 6f 73  e eval ::vc::fos
36f0: 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73  sil::import::cvs
3700: 3a 3a 70 61 73 73 20 7b 0a 20 20 20 20 6e 61 6d  ::pass {.    nam
3710: 65 73 70 61 63 65 20 65 78 70 6f 72 74 20 66 69  espace export fi
3720: 6c 74 65 72 73 79 6d 0a 20 20 20 20 6e 61 6d 65  ltersym.    name
3730: 73 70 61 63 65 20 65 76 61 6c 20 66 69 6c 74 65  space eval filte
3740: 72 73 79 6d 20 7b 0a 09 6e 61 6d 65 73 70 61 63  rsym {..namespac
3750: 65 20 69 6d 70 6f 72 74 20 3a 3a 76 63 3a 3a 66  e import ::vc::f
3760: 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63  ossil::import::c
3770: 76 73 3a 3a 73 74 61 74 65 0a 09 6e 61 6d 65 73  vs::state..names
3780: 70 61 63 65 20 65 76 61 6c 20 70 72 6f 6a 65 63  pace eval projec
3790: 74 20 7b 0a 09 20 20 20 20 6e 61 6d 65 73 70 61  t {..    namespa
37a0: 63 65 20 69 6d 70 6f 72 74 20 3a 3a 76 63 3a 3a  ce import ::vc::
37b0: 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a  fossil::import::
37c0: 63 76 73 3a 3a 70 72 6f 6a 65 63 74 3a 3a 73 79  cvs::project::sy
37d0: 6d 0a 09 7d 0a 09 6e 61 6d 65 73 70 61 63 65 20  m..}..namespace 
37e0: 69 6d 70 6f 72 74 20 3a 3a 76 63 3a 3a 74 6f 6f  import ::vc::too
37f0: 6c 73 3a 3a 6d 69 73 63 3a 3a 6e 73 70 0a 09 6e  ls::misc::nsp..n
3800: 61 6d 65 73 70 61 63 65 20 69 6d 70 6f 72 74 20  amespace import 
3810: 3a 3a 76 63 3a 3a 74 6f 6f 6c 73 3a 3a 6c 6f 67  ::vc::tools::log
3820: 0a 09 6c 6f 67 20 72 65 67 69 73 74 65 72 20 66  ..log register f
3830: 69 6c 74 65 72 73 79 6d 0a 20 20 20 20 7d 0a 7d  iltersym.    }.}
3840: 0a 0a 23 20 23 20 23 23 20 23 23 23 20 23 23 23  ..# # ## ### ###
3850: 23 23 20 23 23 23 23 23 23 23 23 20 23 23 23 23  ## ######## ####
3860: 23 23 23 23 23 23 23 23 23 20 23 23 23 23 23 23  ######### ######
3870: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 0a  ###############.
3880: 23 23 20 52 65 61 64 79 0a 0a 70 61 63 6b 61 67  ## Ready..packag
3890: 65 20 70 72 6f 76 69 64 65 20 76 63 3a 3a 66 6f  e provide vc::fo
38a0: 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76  ssil::import::cv
38b0: 73 3a 3a 70 61 73 73 3a 3a 66 69 6c 74 65 72 73  s::pass::filters
38c0: 79 6d 20 31 2e 30 0a 72 65 74 75 72 6e 0a        ym 1.0.return.