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 72 65 61 64 69 s....state readi
0790: 6e 67 20 73 79 6d 62 6f 6c 0a 09 73 74 61 74 65 ng symbol..state
07a0: 20 72 65 61 64 69 6e 67 20 62 6c 6f 63 6b 65 72 reading blocker
07b0: 0a 09 73 74 61 74 65 20 72 65 61 64 69 6e 67 20 ..state reading
07c0: 70 61 72 65 6e 74 0a 09 73 74 61 74 65 20 72 65 parent..state re
07d0: 61 64 69 6e 67 20 70 72 65 66 65 72 65 64 70 61 ading preferedpa
07e0: 72 65 6e 74 0a 09 73 74 61 74 65 20 72 65 61 64 rent..state read
07f0: 69 6e 67 20 72 65 76 69 73 69 6f 6e 0a 09 73 74 ing revision..st
0800: 61 74 65 20 72 65 61 64 69 6e 67 20 72 65 76 69 ate reading revi
0810: 73 69 6f 6e 62 72 61 6e 63 68 63 68 69 6c 64 72 sionbranchchildr
0820: 65 6e 0a 09 73 74 61 74 65 20 72 65 61 64 69 6e en..state readin
0830: 67 20 62 72 61 6e 63 68 0a 09 73 74 61 74 65 20 g branch..state
0840: 72 65 61 64 69 6e 67 20 74 61 67 0a 0a 09 73 74 reading tag...st
0850: 61 74 65 20 77 72 69 74 69 6e 67 20 6e 6f 6f 70 ate writing noop
0860: 20 7b 0a 09 20 20 20 20 69 64 20 20 20 20 49 4e {.. id IN
0870: 54 45 47 45 52 20 4e 4f 54 20 4e 55 4c 4c 20 20 TEGER NOT NULL
0880: 50 52 49 4d 41 52 59 20 4b 45 59 2c 20 2d 2d 20 PRIMARY KEY, --
0890: 74 61 67 2f 62 72 61 6e 63 68 20 72 65 66 65 72 tag/branch refer
08a0: 65 6e 63 65 0a 09 20 20 20 20 6e 6f 6f 70 20 20 ence.. noop
08b0: 49 4e 54 45 47 45 52 20 4e 4f 54 20 4e 55 4c 4c INTEGER NOT NULL
08c0: 0a 09 7d 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 ..}..return.
08d0: 7d 0a 0a 20 20 20 20 74 79 70 65 6d 65 74 68 6f }.. typemetho
08e0: 64 20 6c 6f 61 64 20 7b 7d 20 7b 0a 09 23 20 50 d load {} {..# P
08f0: 61 73 73 20 6d 61 6e 61 67 65 72 20 69 6e 74 65 ass manager inte
0900: 72 66 61 63 65 2e 20 45 78 65 63 75 74 65 64 20 rface. Executed
0910: 74 6f 20 6c 6f 61 64 20 64 61 74 61 20 63 6f 6d to load data com
0920: 70 75 74 65 64 20 62 79 0a 09 23 20 74 68 69 73 puted by..# this
0930: 20 70 61 73 73 20 69 6e 74 6f 20 6d 65 6d 6f 72 pass into memor
0940: 79 20 77 68 65 6e 20 74 68 69 73 20 70 61 73 73 y when this pass
0950: 20 69 73 20 73 6b 69 70 70 65 64 20 69 6e 73 74 is skipped inst
0960: 65 61 64 20 6f 66 0a 09 23 20 65 78 65 63 75 74 ead of..# execut
0970: 65 64 2e 0a 0a 09 23 20 54 68 65 20 72 65 73 75 ed....# The resu
0980: 6c 74 73 20 6f 66 20 74 68 69 73 20 70 61 73 73 lts of this pass
0990: 20 61 72 65 20 66 75 6c 6c 79 20 69 6e 20 74 68 are fully in th
09a0: 65 20 70 65 72 73 69 73 74 65 6e 74 20 73 74 61 e persistent sta
09b0: 74 65 2c 0a 09 23 20 74 68 65 72 65 20 69 73 20 te,..# there is
09c0: 6e 6f 74 68 69 6e 67 20 74 6f 20 6c 6f 61 64 20 nothing to load
09d0: 66 6f 72 20 74 68 65 20 6e 65 78 74 20 6f 6e 65 for the next one
09e0: 2e 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a ...return. }.
09f0: 0a 20 20 20 20 74 79 70 65 6d 65 74 68 6f 64 20 . typemethod
0a00: 72 75 6e 20 7b 7d 20 7b 0a 09 23 20 50 61 73 73 run {} {..# Pass
0a10: 20 6d 61 6e 61 67 65 72 20 69 6e 74 65 72 66 61 manager interfa
0a20: 63 65 2e 20 45 78 65 63 75 74 65 64 20 74 6f 20 ce. Executed to
0a30: 70 65 72 66 6f 72 6d 20 74 68 65 0a 09 23 20 66 perform the..# f
0a40: 75 6e 63 74 69 6f 6e 61 6c 69 74 79 20 6f 66 20 unctionality of
0a50: 74 68 65 20 70 61 73 73 2e 0a 0a 09 23 20 54 68 the pass....# Th
0a60: 65 20 72 65 6d 6f 76 61 6c 20 6f 66 20 65 78 63 e removal of exc
0a70: 6c 75 64 65 64 20 73 79 6d 62 6f 6c 73 20 61 6e luded symbols an
0a80: 64 20 65 76 65 72 79 74 68 69 6e 67 20 72 65 66 d everything ref
0a90: 65 72 65 6e 63 69 6e 67 0a 09 23 20 74 6f 20 74 erencing..# to t
0aa0: 68 65 6d 20 69 73 20 64 6f 6e 65 20 63 6f 6d 70 hem is done comp
0ab0: 6c 65 74 65 6c 79 20 69 6e 20 74 68 65 20 64 61 letely in the da
0ac0: 74 61 62 61 73 65 2e 0a 0a 09 73 74 61 74 65 20 tabase....state
0ad0: 74 72 61 6e 73 61 63 74 69 6f 6e 20 7b 0a 09 20 transaction {..
0ae0: 20 20 20 46 69 6c 74 65 72 45 78 63 6c 75 64 65 FilterExclude
0af0: 64 53 79 6d 62 6f 6c 73 0a 09 20 20 20 20 4d 75 dSymbols.. Mu
0b00: 74 61 74 65 53 79 6d 62 6f 6c 73 0a 09 20 20 20 tateSymbols..
0b10: 20 41 64 6a 75 73 74 50 61 72 65 6e 74 73 0a 09 AdjustParents..
0b20: 20 20 20 20 52 65 66 69 6e 65 53 79 6d 62 6f 6c RefineSymbol
0b30: 73 0a 0a 09 20 20 20 20 72 65 70 6f 73 69 74 6f s... reposito
0b40: 72 79 20 70 72 69 6e 74 72 65 76 73 74 61 74 69 ry printrevstati
0b50: 73 74 69 63 73 0a 0a 09 20 20 20 20 23 20 53 74 stics... # St
0b60: 72 69 63 74 20 69 6e 74 65 67 72 69 74 79 20 65 rict integrity e
0b70: 6e 66 6f 72 63 65 73 20 74 68 61 74 20 61 6c 6c nforces that all
0b80: 20 6d 65 74 61 20 65 6e 74 72 69 65 73 20 61 72 meta entries ar
0b90: 65 20 69 6e 0a 09 20 20 20 20 23 20 74 68 65 20 e in.. # the
0ba0: 73 61 6d 65 20 4c 4f 44 20 61 73 20 74 68 65 20 same LOD as the
0bb0: 72 65 76 69 73 69 6f 6e 20 75 73 69 6e 67 20 74 revision using t
0bc0: 68 65 6d 2e 20 41 74 20 74 68 69 73 20 70 6f 69 hem. At this poi
0bd0: 6e 74 0a 09 20 20 20 20 23 20 74 68 69 73 20 6d nt.. # this m
0be0: 61 79 20 6e 6f 74 20 62 65 20 74 72 75 65 20 61 ay not be true a
0bf0: 6e 79 20 6c 6f 6e 67 65 72 2e 20 49 66 20 61 20 ny longer. If a
0c00: 4e 54 44 42 20 77 61 73 20 65 78 63 6c 75 64 65 NTDB was exclude
0c10: 64 0a 09 20 20 20 20 23 20 74 68 65 6e 20 61 6c d.. # then al
0c20: 6c 20 72 65 76 69 73 69 6f 6e 73 20 69 74 20 73 l revisions it s
0c30: 68 61 72 65 64 20 77 69 74 68 20 74 68 65 20 74 hared with the t
0c40: 72 75 6e 6b 20 77 65 72 65 20 6d 6f 76 65 64 0a runk were moved.
0c50: 09 20 20 20 20 23 20 74 6f 20 74 68 65 20 74 72 . # to the tr
0c60: 75 6e 6b 20 4c 4f 44 2c 20 68 6f 77 65 76 65 72 unk LOD, however
0c70: 20 74 68 65 69 72 20 6d 65 74 61 20 65 6e 74 72 their meta entr
0c80: 69 65 73 20 77 69 6c 6c 20 73 74 69 6c 6c 0a 09 ies will still..
0c90: 20 20 20 20 23 20 72 65 66 65 72 20 74 6f 20 74 # refer to t
0ca0: 68 65 20 6e 6f 77 20 67 6f 6e 65 20 4c 4f 44 20 he now gone LOD
0cb0: 73 79 6d 62 6f 6c 2e 20 54 68 69 73 20 69 73 20 symbol. This is
0cc0: 66 69 6e 65 20 68 6f 77 65 76 65 72 2c 0a 09 20 fine however,..
0cd0: 20 20 20 23 20 69 74 20 77 69 6c 6c 20 6e 6f 74 # it will not
0ce0: 20 61 66 66 65 63 74 20 6f 75 72 20 61 62 69 6c affect our abil
0cf0: 69 74 79 20 74 6f 20 75 73 65 20 74 68 65 20 6d ity to use the m
0d00: 65 74 61 20 65 6e 74 72 69 65 73 0a 09 20 20 20 eta entries..
0d10: 20 23 20 74 6f 20 64 69 73 74 69 6e 67 75 69 73 # to distinguis
0d20: 68 20 61 6e 64 20 67 72 6f 75 70 20 72 65 76 69 h and group revi
0d30: 73 69 6f 6e 73 20 69 6e 74 6f 20 63 68 61 6e 67 sions into chang
0d40: 65 73 65 74 73 2e 20 49 74 0a 09 20 20 20 20 23 esets. It.. #
0d50: 20 73 68 6f 75 6c 64 20 62 65 20 6e 6f 74 65 64 should be noted
0d60: 20 74 68 61 74 20 77 65 20 63 61 6e 6e 6f 74 20 that we cannot
0d70: 73 69 6d 70 6c 79 20 73 77 69 74 63 68 20 74 68 simply switch th
0d80: 65 20 6d 65 74 61 0a 09 20 20 20 20 23 20 65 6e e meta.. # en
0d90: 74 72 69 65 73 20 6f 76 65 72 20 74 6f 20 74 68 tries over to th
0da0: 65 20 74 72 75 6e 6b 20 65 69 74 68 65 72 2c 20 e trunk either,
0db0: 61 73 20 74 68 61 74 20 6d 61 79 20 63 61 75 73 as that may caus
0dc0: 65 20 74 68 65 0a 09 20 20 20 20 23 20 6d 6f 64 e the.. # mod
0dd0: 69 66 69 65 64 20 65 6e 74 72 69 65 73 20 74 6f ified entries to
0de0: 20 76 69 6f 6c 61 74 65 20 74 68 65 20 75 6e 69 violate the uni
0df0: 71 75 65 2d 6e 65 73 73 20 63 6f 6e 73 74 72 61 que-ness constra
0e00: 69 6e 0a 09 20 20 20 20 23 20 73 65 74 20 6f 6e in.. # set on
0e10: 20 74 68 61 74 20 74 61 62 6c 65 2e 0a 09 20 20 that table...
0e20: 20 20 69 6e 74 65 67 72 69 74 79 20 6d 65 74 61 integrity meta
0e30: 72 65 6c 61 78 65 64 0a 09 7d 0a 0a 09 6c 6f 67 relaxed..}...log
0e40: 20 77 72 69 74 65 20 31 20 66 69 6c 74 65 72 73 write 1 filters
0e50: 79 6d 20 22 46 69 6c 74 65 72 69 6e 67 20 63 6f ym "Filtering co
0e60: 6d 70 6c 65 74 65 64 22 0a 09 72 65 74 75 72 6e mpleted"..return
0e70: 0a 20 20 20 20 7d 0a 0a 20 20 20 20 74 79 70 65 . }.. type
0e80: 6d 65 74 68 6f 64 20 64 69 73 63 61 72 64 20 7b method discard {
0e90: 7d 20 7b 0a 09 23 20 50 61 73 73 20 6d 61 6e 61 } {..# Pass mana
0ea0: 67 65 72 20 69 6e 74 65 72 66 61 63 65 2e 20 45 ger interface. E
0eb0: 78 65 63 75 74 65 64 20 66 6f 72 20 61 6c 6c 20 xecuted for all
0ec0: 70 61 73 73 65 73 20 61 66 74 65 72 20 74 68 65 passes after the
0ed0: 0a 09 23 20 72 75 6e 20 70 61 73 73 65 73 2c 20 ..# run passes,
0ee0: 74 6f 20 72 65 6d 6f 76 65 20 61 6c 6c 20 64 61 to remove all da
0ef0: 74 61 20 6f 66 20 74 68 69 73 20 70 61 73 73 20 ta of this pass
0f00: 66 72 6f 6d 20 74 68 65 20 73 74 61 74 65 2c 0a from the state,.
0f10: 09 23 20 61 73 20 62 65 69 6e 67 20 6f 75 74 20 .# as being out
0f20: 6f 66 20 64 61 74 65 2e 0a 09 72 65 74 75 72 6e of date...return
0f30: 0a 20 20 20 20 7d 0a 0a 20 20 20 20 23 20 23 20 . }.. # #
0f40: 23 23 20 23 23 23 20 23 23 23 23 23 20 23 23 23 ## ### ##### ###
0f50: 23 23 23 23 23 20 23 23 23 23 23 23 23 23 23 23 ##### ##########
0f60: 23 23 23 0a 20 20 20 20 23 23 20 49 6e 74 65 72 ###. ## Inter
0f70: 6e 61 6c 20 6d 65 74 68 6f 64 73 0a 0a 20 20 20 nal methods..
0f80: 20 70 72 6f 63 20 46 69 6c 74 65 72 45 78 63 6c proc FilterExcl
0f90: 75 64 65 64 53 79 6d 62 6f 6c 73 20 7b 7d 20 7b udedSymbols {} {
0fa0: 0a 09 6c 6f 67 20 77 72 69 74 65 20 33 20 66 69 ..log write 3 fi
0fb0: 6c 74 65 72 73 79 6d 20 22 52 65 6d 6f 76 65 20 ltersym "Remove
0fc0: 74 68 65 20 65 78 63 6c 75 64 65 64 20 73 79 6d the excluded sym
0fd0: 62 6f 6c 73 20 61 6e 64 20 74 68 65 69 72 20 75 bols and their u
0fe0: 73 65 72 73 22 0a 0a 09 23 20 57 65 20 70 75 6c sers"...# We pul
0ff0: 6c 20 61 6c 6c 20 74 68 65 20 65 78 63 6c 75 64 l all the exclud
1000: 65 64 20 73 79 6d 62 6f 6c 73 20 74 6f 67 65 74 ed symbols toget
1010: 68 65 72 20 69 6e 74 6f 20 61 20 74 61 62 6c 65 her into a table
1020: 20 66 6f 72 0a 09 23 20 65 61 73 79 20 72 65 66 for..# easy ref
1030: 65 72 65 6e 63 65 20 62 79 20 74 68 65 20 75 70 erence by the up
1040: 63 6f 6d 69 6e 67 20 44 45 4c 45 54 45 20 61 6e coming DELETE an
1050: 64 20 6f 74 68 65 72 20 73 74 61 74 65 6d 65 6e d other statemen
1060: 74 73 2e 0a 09 23 20 28 27 78 20 49 4e 20 74 61 ts...# ('x IN ta
1070: 62 6c 65 27 20 63 6c 61 75 73 65 73 29 2e 0a 0a ble' clauses)...
1080: 09 73 65 74 20 65 78 63 6c 20 5b 70 72 6f 6a 65 .set excl [proje
1090: 63 74 3a 3a 73 79 6d 20 65 78 63 6c 75 64 65 64 ct::sym excluded
10a0: 5d 0a 0a 09 73 74 61 74 65 20 72 75 6e 20 7b 0a ]...state run {.
10b0: 09 20 20 20 20 43 52 45 41 54 45 20 54 45 4d 50 . CREATE TEMP
10c0: 4f 52 41 52 59 20 54 41 42 4c 45 20 65 78 63 6c ORARY TABLE excl
10d0: 75 64 65 64 73 79 6d 62 6f 6c 73 20 41 53 0a 09 udedsymbols AS..
10e0: 20 20 20 20 53 45 4c 45 43 54 20 73 69 64 0a 09 SELECT sid..
10f0: 20 20 20 20 46 52 4f 4d 20 20 20 73 79 6d 62 6f FROM symbo
1100: 6c 0a 09 20 20 20 20 57 48 45 52 45 20 20 74 79 l.. WHERE ty
1110: 70 65 20 3d 20 24 65 78 63 6c 0a 09 7d 0a 0a 09 pe = $excl..}...
1120: 23 20 46 69 72 73 74 20 77 65 20 68 61 76 65 20 # First we have
1130: 74 6f 20 68 61 6e 64 6c 65 20 74 68 65 20 70 6f to handle the po
1140: 73 73 69 62 69 6c 69 74 79 20 6f 66 20 61 6e 20 ssibility of an
1150: 65 78 63 6c 75 64 65 64 0a 09 23 20 4e 54 44 42 excluded..# NTDB
1160: 2e 20 54 68 69 73 20 69 73 20 61 20 73 70 65 63 . This is a spec
1170: 69 61 6c 20 73 70 65 63 69 61 6c 20 63 61 73 65 ial special case
1180: 20 74 68 65 72 65 20 77 65 20 68 61 76 65 20 74 there we have t
1190: 6f 0a 09 23 20 72 65 67 72 61 66 74 20 74 68 65 o..# regraft the
11a0: 20 72 65 76 69 73 69 6f 6e 73 20 77 68 69 63 68 revisions which
11b0: 20 61 72 65 20 73 68 61 72 65 64 20 62 65 74 77 are shared betw
11c0: 65 65 6e 20 74 68 65 20 4e 54 44 42 20 61 6e 64 een the NTDB and
11d0: 0a 09 23 20 54 72 75 6e 6b 20 6f 6e 74 6f 20 74 ..# Trunk onto t
11e0: 68 65 20 74 72 75 6e 6b 2c 20 70 72 65 76 65 6e he trunk, preven
11f0: 74 69 6e 67 20 74 68 65 69 72 20 64 65 6c 65 74 ting their delet
1200: 69 6f 6e 20 6c 61 74 65 72 2e 20 57 65 0a 09 23 ion later. We..#
1210: 20 68 61 76 65 20 63 6f 64 65 20 66 6f 72 20 74 have code for t
1220: 68 61 74 20 69 6e 20 27 66 69 6c 65 27 2c 20 68 hat in 'file', h
1230: 6f 77 65 76 65 72 20 74 68 61 74 20 6f 70 65 72 owever that oper
1240: 61 74 65 64 20 6f 6e 20 74 68 65 0a 09 23 20 69 ated on the..# i
1250: 6e 2d 6d 65 6d 6f 72 79 20 72 65 76 69 73 69 6f n-memory revisio
1260: 6e 20 6f 62 6a 65 63 74 73 2c 20 77 68 69 63 68 n objects, which
1270: 20 77 65 20 64 6f 20 6e 6f 74 20 68 61 76 65 20 we do not have
1280: 68 65 72 65 2e 20 57 65 20 64 6f 0a 09 23 20 74 here. We do..# t
1290: 68 65 20 73 61 6d 65 20 6e 6f 77 20 77 69 74 68 he same now with
12a0: 6f 75 74 20 6f 62 6a 65 63 74 2c 20 62 79 20 64 out object, by d
12b0: 69 72 65 63 74 6c 79 20 6d 61 6e 69 70 75 6c 61 irectly manipula
12c0: 74 69 6e 67 20 74 68 65 0a 09 23 20 6c 69 6e 6b ting the..# link
12d0: 73 20 69 6e 20 74 68 65 20 64 61 74 61 62 61 73 s in the databas
12e0: 65 2e 0a 0a 09 61 72 72 61 79 20 73 65 74 20 6e e....array set n
12f0: 74 64 62 20 7b 7d 0a 09 61 72 72 61 79 20 73 65 tdb {}..array se
1300: 74 20 6c 69 6e 6b 20 7b 7d 0a 0a 09 66 6f 72 65 t link {}...fore
1310: 61 63 68 20 7b 69 64 20 70 61 72 65 6e 74 20 74 ach {id parent t
1320: 72 61 6e 73 66 65 72 7d 20 5b 73 74 61 74 65 20 ransfer} [state
1330: 72 75 6e 20 7b 0a 09 20 20 20 20 53 45 4c 45 43 run {.. SELEC
1340: 54 20 52 2e 72 69 64 2c 20 52 2e 70 61 72 65 6e T R.rid, R.paren
1350: 74 2c 20 52 2e 64 62 63 68 69 6c 64 0a 09 20 20 t, R.dbchild..
1360: 20 20 46 52 4f 4d 20 20 72 65 76 69 73 69 6f 6e FROM revision
1370: 20 52 2c 20 73 79 6d 62 6f 6c 20 53 0a 09 20 20 R, symbol S..
1380: 20 20 57 48 45 52 45 20 52 2e 6c 6f 64 20 3d 20 WHERE R.lod =
1390: 53 2e 73 69 64 0a 09 20 20 20 20 41 4e 44 20 20 S.sid.. AND
13a0: 20 53 2e 73 69 64 20 49 4e 20 65 78 63 6c 75 64 S.sid IN exclud
13b0: 65 64 73 79 6d 62 6f 6c 73 0a 09 20 20 20 20 41 edsymbols.. A
13c0: 4e 44 20 20 20 52 2e 69 73 64 65 66 61 75 6c 74 ND R.isdefault
13d0: 0a 09 7d 5d 20 7b 0a 09 20 20 20 20 73 65 74 20 ..}] {.. set
13e0: 6e 74 64 62 28 24 69 64 29 20 24 70 61 72 65 6e ntdb($id) $paren
13f0: 74 0a 09 20 20 20 20 69 66 20 7b 24 74 72 61 6e t.. if {$tran
1400: 73 66 65 72 20 65 71 20 22 22 7d 20 63 6f 6e 74 sfer eq ""} cont
1410: 69 6e 75 65 0a 09 20 20 20 20 73 65 74 20 6c 69 inue.. set li
1420: 6e 6b 28 24 69 64 29 20 24 74 72 61 6e 73 66 65 nk($id) $transfe
1430: 72 0a 09 7d 0a 0a 09 66 6f 72 65 61 63 68 20 6a r..}...foreach j
1440: 6f 69 6e 74 20 5b 61 72 72 61 79 20 6e 61 6d 65 oint [array name
1450: 73 20 6c 69 6e 6b 5d 20 7b 0a 09 20 20 20 20 23 s link] {.. #
1460: 20 54 68 65 20 6a 6f 69 6e 74 73 20 61 72 65 20 The joints are
1470: 74 68 65 20 68 69 67 68 65 73 74 20 4e 54 44 42 the highest NTDB
1480: 20 72 65 76 69 73 69 6f 6e 73 20 77 68 69 63 68 revisions which
1490: 20 61 72 65 0a 09 20 20 20 20 23 20 73 68 61 72 are.. # shar
14a0: 65 64 20 77 69 74 68 20 74 68 65 69 72 20 72 65 ed with their re
14b0: 73 70 65 63 74 69 76 65 20 74 72 75 6e 6b 2e 20 spective trunk.
14c0: 57 65 20 64 69 73 63 6f 6e 6e 65 63 74 20 66 72 We disconnect fr
14d0: 6f 6d 0a 09 20 20 20 20 23 20 74 68 65 69 72 20 om.. # their
14e0: 4e 54 44 42 20 63 68 69 6c 64 72 65 6e 2c 20 61 NTDB children, a
14f0: 6e 64 20 6d 61 6b 65 20 74 68 65 6d 20 70 61 72 nd make them par
1500: 65 6e 74 73 20 6f 66 20 74 68 65 69 72 0a 09 20 ents of their..
1510: 20 20 20 23 20 27 64 62 63 68 69 6c 64 27 2e 20 # 'dbchild'.
1520: 54 68 65 20 61 73 73 6f 63 69 61 74 65 64 20 27 The associated '
1530: 64 62 70 61 72 65 6e 74 27 20 69 73 20 73 71 75 dbparent' is squ
1540: 61 73 68 65 64 0a 09 20 20 20 20 23 20 69 6e 73 ashed.. # ins
1550: 74 65 61 64 2e 20 41 6c 6c 20 70 61 72 65 6e 74 tead. All parent
1560: 73 20 6f 66 20 74 68 65 20 6a 6f 69 6e 74 73 20 s of the joints
1570: 61 72 65 20 6d 6f 76 65 64 20 74 6f 20 74 68 65 are moved to the
1580: 0a 09 20 20 20 20 23 20 74 72 75 6e 6b 20 61 73 .. # trunk as
1590: 20 77 65 6c 6c 2e 0a 0a 09 20 20 20 20 73 65 74 well.... set
15a0: 20 74 6a 6f 69 6e 74 20 24 6c 69 6e 6b 28 24 6a tjoint $link($j
15b0: 6f 69 6e 74 29 0a 09 20 20 20 20 73 65 74 20 74 oint).. set t
15c0: 6c 6f 64 20 5b 73 74 61 74 65 20 6f 6e 65 20 7b lod [state one {
15d0: 0a 09 09 53 45 4c 45 43 54 20 6c 6f 64 20 46 52 ...SELECT lod FR
15e0: 4f 4d 20 72 65 76 69 73 69 6f 6e 20 57 48 45 52 OM revision WHER
15f0: 45 20 72 69 64 20 3d 20 24 74 6a 6f 69 6e 74 0a E rid = $tjoint.
1600: 09 20 20 20 20 7d 5d 0a 0a 09 20 20 20 20 23 20 . }]... #
1610: 43 6f 76 6e 65 72 74 20 64 62 2f 70 61 72 65 6e Covnert db/paren
1620: 74 2f 63 68 69 6c 64 20 69 6e 74 6f 20 72 65 67 t/child into reg
1630: 75 6c 61 72 20 70 61 72 65 6e 74 2f 63 68 69 6c ular parent/chil
1640: 64 20 6c 69 6e 6b 73 2e 0a 09 20 20 20 20 73 74 d links... st
1650: 61 74 65 20 72 75 6e 20 7b 0a 09 09 55 50 44 41 ate run {...UPDA
1660: 54 45 20 72 65 76 69 73 69 6f 6e 20 53 45 54 20 TE revision SET
1670: 64 62 70 61 72 65 6e 74 20 3d 20 4e 55 4c 4c 2c dbparent = NULL,
1680: 20 70 61 72 65 6e 74 20 3d 20 24 6a 6f 69 6e 74 parent = $joint
1690: 20 20 57 48 45 52 45 20 72 69 64 20 3d 20 24 74 WHERE rid = $t
16a0: 6a 6f 69 6e 74 20 3b 0a 09 09 55 50 44 41 54 45 joint ;...UPDATE
16b0: 20 72 65 76 69 73 69 6f 6e 20 53 45 54 20 64 62 revision SET db
16c0: 63 68 69 6c 64 20 20 3d 20 4e 55 4c 4c 2c 20 63 child = NULL, c
16d0: 68 69 6c 64 20 20 3d 20 24 74 6a 6f 69 6e 74 20 hild = $tjoint
16e0: 57 48 45 52 45 20 72 69 64 20 3d 20 24 6a 6f 69 WHERE rid = $joi
16f0: 6e 74 20 20 3b 0a 09 20 20 20 20 7d 0a 09 20 20 nt ;.. }..
1700: 20 20 77 68 69 6c 65 20 7b 31 7d 20 7b 0a 09 09 while {1} {...
1710: 23 20 4d 6f 76 65 20 74 68 65 20 4e 54 44 42 20 # Move the NTDB
1720: 74 72 75 6e 6b 20 72 65 76 69 73 69 6f 6e 73 20 trunk revisions
1730: 74 6f 20 74 72 75 6e 6b 2e 0a 09 09 73 74 61 74 to trunk....stat
1740: 65 20 72 75 6e 20 7b 0a 09 09 20 20 20 20 55 50 e run {... UP
1750: 44 41 54 45 20 72 65 76 69 73 69 6f 6e 20 53 45 DATE revision SE
1760: 54 20 6c 6f 64 20 3d 20 24 74 6c 6f 64 2c 20 69 T lod = $tlod, i
1770: 73 64 65 66 61 75 6c 74 20 3d 20 30 20 57 48 45 sdefault = 0 WHE
1780: 52 45 20 72 69 64 20 3d 20 24 6a 6f 69 6e 74 0a RE rid = $joint.
1790: 09 09 7d 0a 09 09 73 65 74 20 6c 61 73 74 20 24 ..}...set last $
17a0: 6a 6f 69 6e 74 0a 09 09 73 65 74 20 6a 6f 69 6e joint...set join
17b0: 74 20 24 6e 74 64 62 28 24 6a 6f 69 6e 74 29 0a t $ntdb($joint).
17c0: 09 09 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 ..if {![info exi
17d0: 73 74 73 20 6e 74 64 62 28 24 6a 6f 69 6e 74 29 sts ntdb($joint)
17e0: 5d 7d 20 62 72 65 61 6b 0a 09 20 20 20 20 7d 0a ]} break.. }.
17f0: 0a 09 20 20 20 20 23 20 52 65 61 63 68 65 64 20 .. # Reached
1800: 74 68 65 20 4e 54 44 42 20 62 61 73 69 73 20 69 the NTDB basis i
1810: 6e 20 74 68 65 20 74 72 75 6e 6b 2e 20 46 69 6e n the trunk. Fin
1820: 61 6c 69 7a 65 20 74 68 65 0a 09 20 20 20 20 23 alize the.. #
1830: 20 70 61 72 65 6e 74 2f 63 68 69 6c 64 20 6c 69 parent/child li
1840: 6e 6b 61 67 65 20 61 6e 64 20 73 71 75 61 73 68 nkage and squash
1850: 20 74 68 65 20 62 72 61 6e 63 68 20 70 61 72 65 the branch pare
1860: 6e 74 20 73 79 6d 62 6f 6c 0a 09 20 20 20 20 23 nt symbol.. #
1870: 20 72 65 66 65 72 65 6e 63 65 2e 0a 0a 09 20 20 reference....
1880: 20 20 73 74 61 74 65 20 72 75 6e 20 7b 0a 09 09 state run {...
1890: 55 50 44 41 54 45 20 72 65 76 69 73 69 6f 6e 20 UPDATE revision
18a0: 53 45 54 20 63 68 69 6c 64 20 20 20 3d 20 24 6c SET child = $l
18b0: 61 73 74 20 57 48 45 52 45 20 72 69 64 20 3d 20 ast WHERE rid =
18c0: 24 6a 6f 69 6e 74 20 3b 0a 09 09 55 50 44 41 54 $joint ;...UPDAT
18d0: 45 20 72 65 76 69 73 69 6f 6e 20 53 45 54 20 62 E revision SET b
18e0: 70 61 72 65 6e 74 20 3d 20 4e 55 4c 4c 20 20 57 parent = NULL W
18f0: 48 45 52 45 20 72 69 64 20 3d 20 24 6c 61 73 74 HERE rid = $last
1900: 20 20 3b 0a 09 20 20 20 20 7d 0a 09 7d 0a 0a 09 ;.. }..}...
1910: 23 20 4e 6f 77 20 74 68 61 74 20 74 68 65 20 73 # Now that the s
1920: 70 65 63 69 61 6c 20 63 61 73 65 20 69 73 20 64 pecial case is d
1930: 6f 6e 65 20 77 65 20 63 61 6e 20 73 69 6d 70 6c one we can simpl
1940: 79 20 6b 69 6c 6c 20 61 6c 6c 20 74 68 65 0a 09 y kill all the..
1950: 23 20 72 65 76 69 73 69 6f 6e 73 2c 20 74 61 67 # revisions, tag
1960: 73 2c 20 61 6e 64 20 62 72 61 6e 63 68 65 73 20 s, and branches
1970: 72 65 66 65 72 65 6e 63 69 6e 67 20 61 6e 79 20 referencing any
1980: 6f 66 20 74 68 65 0a 09 23 20 65 78 63 6c 75 64 of the..# exclud
1990: 65 64 20 73 79 6d 62 6f 6c 73 20 69 6e 20 73 6f ed symbols in so
19a0: 6d 65 20 77 61 79 2e 20 54 68 69 73 20 69 73 20 me way. This is
19b0: 65 61 73 79 20 61 73 20 77 65 20 64 6f 20 6e 6f easy as we do no
19c0: 74 20 68 61 76 65 0a 09 23 20 74 6f 20 73 65 6c t have..# to sel
19d0: 65 63 74 20 74 68 65 6d 20 61 67 61 69 6e 20 61 ect them again a
19e0: 6e 64 20 61 67 61 69 6e 20 66 72 6f 6d 20 74 68 nd again from th
19f0: 65 20 62 61 73 65 20 74 61 62 6c 65 73 20 61 6e e base tables an
1a00: 79 0a 09 23 20 6c 6f 6e 67 65 72 2e 0a 0a 09 73 y..# longer....s
1a10: 74 61 74 65 20 72 75 6e 20 7b 0a 09 20 20 20 20 tate run {..
1a20: 43 52 45 41 54 45 20 54 45 4d 50 4f 52 41 52 59 CREATE TEMPORARY
1a30: 20 54 41 42 4c 45 20 65 78 63 6c 75 64 65 64 72 TABLE excludedr
1a40: 65 76 69 73 69 6f 6e 73 20 41 53 0a 09 20 20 20 evisions AS..
1a50: 20 53 45 4c 45 43 54 20 72 69 64 20 46 52 4f 4d SELECT rid FROM
1a60: 20 72 65 76 69 73 69 6f 6e 20 57 48 45 52 45 20 revision WHERE
1a70: 6c 6f 64 20 49 4e 20 65 78 63 6c 75 64 65 64 73 lod IN excludeds
1a80: 79 6d 62 6f 6c 73 3b 0a 0a 09 20 20 20 20 44 45 ymbols;... DE
1a90: 4c 45 54 45 20 46 52 4f 4d 20 72 65 76 69 73 69 LETE FROM revisi
1aa0: 6f 6e 20 57 48 45 52 45 20 6c 6f 64 20 49 4e 20 on WHERE lod IN
1ab0: 65 78 63 6c 75 64 65 64 73 79 6d 62 6f 6c 73 3b excludedsymbols;
1ac0: 0a 09 20 20 20 20 44 45 4c 45 54 45 20 46 52 4f .. DELETE FRO
1ad0: 4d 20 74 61 67 20 20 20 20 20 20 57 48 45 52 45 M tag WHERE
1ae0: 20 6c 6f 64 20 49 4e 20 65 78 63 6c 75 64 65 64 lod IN excluded
1af0: 73 79 6d 62 6f 6c 73 3b 0a 09 20 20 20 20 44 45 symbols;.. DE
1b00: 4c 45 54 45 20 46 52 4f 4d 20 74 61 67 20 20 20 LETE FROM tag
1b10: 20 20 20 57 48 45 52 45 20 73 69 64 20 49 4e 20 WHERE sid IN
1b20: 65 78 63 6c 75 64 65 64 73 79 6d 62 6f 6c 73 3b excludedsymbols;
1b30: 0a 09 20 20 20 20 44 45 4c 45 54 45 20 46 52 4f .. DELETE FRO
1b40: 4d 20 62 72 61 6e 63 68 20 20 20 57 48 45 52 45 M branch WHERE
1b50: 20 6c 6f 64 20 49 4e 20 65 78 63 6c 75 64 65 64 lod IN excluded
1b60: 73 79 6d 62 6f 6c 73 3b 0a 09 20 20 20 20 44 45 symbols;.. DE
1b70: 4c 45 54 45 20 46 52 4f 4d 20 62 72 61 6e 63 68 LETE FROM branch
1b80: 20 20 20 57 48 45 52 45 20 73 69 64 20 49 4e 20 WHERE sid IN
1b90: 65 78 63 6c 75 64 65 64 73 79 6d 62 6f 6c 73 3b excludedsymbols;
1ba0: 0a 0a 09 20 20 20 20 44 45 4c 45 54 45 20 46 52 ... DELETE FR
1bb0: 4f 4d 20 72 65 76 69 73 69 6f 6e 62 72 61 6e 63 OM revisionbranc
1bc0: 68 63 68 69 6c 64 72 65 6e 20 57 48 45 52 45 20 hchildren WHERE
1bd0: 72 69 64 20 20 49 4e 20 65 78 63 6c 75 64 65 64 rid IN excluded
1be0: 72 65 76 69 73 69 6f 6e 73 3b 0a 09 20 20 20 20 revisions;..
1bf0: 44 45 4c 45 54 45 20 46 52 4f 4d 20 72 65 76 69 DELETE FROM revi
1c00: 73 69 6f 6e 62 72 61 6e 63 68 63 68 69 6c 64 72 sionbranchchildr
1c10: 65 6e 20 57 48 45 52 45 20 62 72 69 64 20 49 4e en WHERE brid IN
1c20: 20 65 78 63 6c 75 64 65 64 72 65 76 69 73 69 6f excludedrevisio
1c30: 6e 73 3b 0a 0a 09 20 20 20 20 44 52 4f 50 20 54 ns;... DROP T
1c40: 41 42 4c 45 20 65 78 63 6c 75 64 65 64 72 65 76 ABLE excludedrev
1c50: 69 73 69 6f 6e 73 3b 0a 09 20 20 20 20 44 52 4f isions;.. DRO
1c60: 50 20 54 41 42 4c 45 20 65 78 63 6c 75 64 65 64 P TABLE excluded
1c70: 73 79 6d 62 6f 6c 73 3b 0a 09 7d 0a 09 72 65 74 symbols;..}..ret
1c80: 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 70 urn. }.. p
1c90: 72 6f 63 20 4d 75 74 61 74 65 53 79 6d 62 6f 6c roc MutateSymbol
1ca0: 73 20 7b 7d 20 7b 0a 09 23 20 4e 65 78 74 2c 20 s {} {..# Next,
1cb0: 6e 6f 77 20 74 68 61 74 20 77 65 20 6b 6e 6f 77 now that we know
1cc0: 20 77 68 69 63 68 20 73 79 6d 62 6f 6c 73 20 61 which symbols a
1cd0: 72 65 20 77 68 61 74 20 77 65 20 6c 6f 6f 6b 20 re what we look
1ce0: 66 6f 72 0a 09 23 20 66 69 6c 65 20 6c 65 76 65 for..# file leve
1cf0: 6c 20 74 61 67 73 20 77 68 69 63 68 20 61 72 65 l tags which are
1d00: 20 61 63 74 75 61 6c 6c 79 20 63 6f 6e 76 65 72 actually conver
1d10: 74 65 64 20 61 73 20 62 72 61 6e 63 68 65 73 0a ted as branches.
1d20: 09 23 20 28 70 72 6f 6a 65 63 74 20 6c 65 76 65 .# (project leve
1d30: 6c 2c 20 61 6e 64 20 76 69 63 65 20 76 65 72 73 l, and vice vers
1d40: 61 29 2c 20 61 6e 64 20 6d 6f 76 65 20 74 68 65 a), and move the
1d50: 6d 20 74 6f 20 74 68 65 0a 09 23 20 63 6f 72 72 m to the..# corr
1d60: 65 63 74 20 74 61 62 6c 65 73 2e 0a 0a 09 23 20 ect tables....#
1d70: 23 20 23 23 20 23 23 23 20 23 23 23 23 23 20 23 # ## ### ##### #
1d80: 23 23 23 23 23 23 23 20 23 23 23 23 23 23 23 23 ####### ########
1d90: 23 23 23 23 23 0a 0a 09 6c 6f 67 20 77 72 69 74 #####...log writ
1da0: 65 20 33 20 66 69 6c 74 65 72 73 79 6d 20 22 4d e 3 filtersym "M
1db0: 75 74 61 74 65 20 73 79 6d 62 6f 6c 73 2c 20 70 utate symbols, p
1dc0: 72 65 70 61 72 61 74 69 6f 6e 22 0a 0a 09 73 65 reparation"...se
1dd0: 74 20 62 72 61 6e 63 68 20 5b 70 72 6f 6a 65 63 t branch [projec
1de0: 74 3a 3a 73 79 6d 20 62 72 61 6e 63 68 5d 0a 09 t::sym branch]..
1df0: 73 65 74 20 74 61 67 20 20 20 20 5b 70 72 6f 6a set tag [proj
1e00: 65 63 74 3a 3a 73 79 6d 20 74 61 67 5d 0a 0a 09 ect::sym tag]...
1e10: 73 65 74 20 74 61 67 73 74 6f 6d 75 74 61 74 65 set tagstomutate
1e20: 20 5b 73 74 61 74 65 20 72 75 6e 20 7b 0a 09 20 [state run {..
1e30: 20 20 20 53 45 4c 45 43 54 20 54 2e 74 69 64 2c SELECT T.tid,
1e40: 20 54 2e 66 69 64 2c 20 54 2e 6c 6f 64 2c 20 54 T.fid, T.lod, T
1e50: 2e 73 69 64 2c 20 54 2e 72 65 76 0a 09 20 20 20 .sid, T.rev..
1e60: 20 46 52 4f 4d 20 74 61 67 20 54 2c 20 73 79 6d FROM tag T, sym
1e70: 62 6f 6c 20 53 0a 09 20 20 20 20 57 48 45 52 45 bol S.. WHERE
1e80: 20 54 2e 73 69 64 20 3d 20 53 2e 73 69 64 0a 09 T.sid = S.sid..
1e90: 20 20 20 20 41 4e 44 20 53 2e 74 79 70 65 20 3d AND S.type =
1ea0: 20 24 62 72 61 6e 63 68 0a 09 7d 5d 0a 0a 09 73 $branch..}]...s
1eb0: 65 74 20 62 72 61 6e 63 68 65 73 74 6f 6d 75 74 et branchestomut
1ec0: 61 74 65 20 5b 73 74 61 74 65 20 72 75 6e 20 7b ate [state run {
1ed0: 0a 09 20 20 20 20 53 45 4c 45 43 54 20 42 2e 62 .. SELECT B.b
1ee0: 69 64 2c 20 42 2e 66 69 64 2c 20 42 2e 6c 6f 64 id, B.fid, B.lod
1ef0: 2c 20 42 2e 73 69 64 2c 20 42 2e 72 6f 6f 74 2c , B.sid, B.root,
1f00: 20 42 2e 66 69 72 73 74 2c 20 42 2e 62 72 61 0a B.first, B.bra.
1f10: 09 20 20 20 20 46 52 4f 4d 20 62 72 61 6e 63 68 . FROM branch
1f20: 20 42 2c 20 73 79 6d 62 6f 6c 20 53 0a 09 20 20 B, symbol S..
1f30: 20 20 57 48 45 52 45 20 42 2e 73 69 64 20 3d 20 WHERE B.sid =
1f40: 53 2e 73 69 64 0a 09 20 20 20 20 41 4e 44 20 53 S.sid.. AND S
1f50: 2e 74 79 70 65 20 3d 20 24 74 61 67 0a 09 7d 5d .type = $tag..}]
1f60: 0a 0a 09 73 65 74 20 6e 74 20 5b 65 78 70 72 20 ...set nt [expr
1f70: 7b 5b 6c 6c 65 6e 67 74 68 20 24 74 61 67 73 74 {[llength $tagst
1f80: 6f 6d 75 74 61 74 65 5d 2f 35 7d 5d 0a 09 73 65 omutate]/5}]..se
1f90: 74 20 6e 62 20 5b 65 78 70 72 20 7b 5b 6c 6c 65 t nb [expr {[lle
1fa0: 6e 67 74 68 20 24 62 72 61 6e 63 68 65 73 74 6f ngth $branchesto
1fb0: 6d 75 74 61 74 65 5d 2f 37 7d 5d 0a 0a 09 6c 6f mutate]/7}]...lo
1fc0: 67 20 77 72 69 74 65 20 34 20 66 69 6c 74 65 72 g write 4 filter
1fd0: 73 79 6d 20 22 43 68 61 6e 67 69 6e 67 20 5b 6e sym "Changing [n
1fe0: 73 70 20 24 6e 74 20 74 61 67 5d 20 69 6e 74 6f sp $nt tag] into
1ff0: 20 20 5b 6e 73 70 20 24 6e 74 20 62 72 61 6e 63 [nsp $nt branc
2000: 68 20 62 72 61 6e 63 68 65 73 5d 22 0a 09 6c 6f h branches]"..lo
2010: 67 20 77 72 69 74 65 20 34 20 66 69 6c 74 65 72 g write 4 filter
2020: 73 79 6d 20 22 43 68 61 6e 67 69 6e 67 20 5b 6e sym "Changing [n
2030: 73 70 20 24 6e 62 20 62 72 61 6e 63 68 20 62 72 sp $nb branch br
2040: 61 6e 63 68 65 73 5d 20 69 6e 74 6f 20 20 5b 6e anches] into [n
2050: 73 70 20 24 6e 62 20 74 61 67 5d 22 0a 0a 09 23 sp $nb tag]"...#
2060: 20 23 20 23 23 20 23 23 23 20 23 23 23 23 23 20 # ## ### #####
2070: 23 23 23 23 23 23 23 23 20 23 23 23 23 23 23 23 ######## #######
2080: 23 23 23 23 23 23 0a 0a 09 6c 6f 67 20 77 72 69 ######...log wri
2090: 74 65 20 33 20 66 69 6c 74 65 72 73 79 6d 20 22 te 3 filtersym "
20a0: 4d 75 74 61 74 65 20 74 61 67 73 20 74 6f 20 62 Mutate tags to b
20b0: 72 61 6e 63 68 65 73 22 0a 0a 09 66 6f 72 65 61 ranches"...forea
20c0: 63 68 20 7b 69 64 20 66 69 64 20 6c 6f 64 20 73 ch {id fid lod s
20d0: 69 64 20 72 65 76 7d 20 24 74 61 67 73 74 6f 6d id rev} $tagstom
20e0: 75 74 61 74 65 20 7b 0a 09 20 20 20 20 73 74 61 utate {.. sta
20f0: 74 65 20 72 75 6e 20 7b 0a 09 09 44 45 4c 45 54 te run {...DELET
2100: 45 20 46 52 4f 4d 20 74 61 67 20 57 48 45 52 45 E FROM tag WHERE
2110: 20 74 69 64 20 3d 20 24 69 64 20 3b 0a 09 09 49 tid = $id ;...I
2120: 4e 53 45 52 54 20 49 4e 54 4f 20 62 72 61 6e 63 NSERT INTO branc
2130: 68 20 28 62 69 64 2c 20 66 69 64 2c 20 20 6c 6f h (bid, fid, lo
2140: 64 2c 20 20 73 69 64 2c 20 20 72 6f 6f 74 2c 20 d, sid, root,
2150: 66 69 72 73 74 2c 20 62 72 61 2c 20 70 6f 73 29 first, bra, pos)
2160: 0a 09 09 56 41 4c 55 45 53 20 20 20 20 20 20 20 ...VALUES
2170: 20 20 20 20 20 20 28 24 69 64 2c 20 24 66 69 64 ($id, $fid
2180: 2c 20 24 6c 6f 64 2c 20 24 73 69 64 2c 20 24 72 , $lod, $sid, $r
2190: 65 76 2c 20 4e 55 4c 4c 2c 20 20 27 27 2c 20 20 ev, NULL, '',
21a0: 2d 31 29 3b 0a 09 20 20 20 20 7d 0a 09 7d 0a 0a -1);.. }..}..
21b0: 09 6c 6f 67 20 77 72 69 74 65 20 33 20 66 69 6c .log write 3 fil
21c0: 74 65 72 73 79 6d 20 22 4f 6b 2e 22 0a 0a 09 23 tersym "Ok."...#
21d0: 20 23 20 23 23 20 23 23 23 20 23 23 23 23 23 20 # ## ### #####
21e0: 23 23 23 23 23 23 23 23 20 23 23 23 23 23 23 23 ######## #######
21f0: 23 23 23 23 23 23 0a 0a 09 6c 6f 67 20 77 72 69 ######...log wri
2200: 74 65 20 33 20 66 69 6c 74 65 72 73 79 6d 20 22 te 3 filtersym "
2210: 4d 75 74 61 74 65 20 62 72 61 6e 63 68 65 73 20 Mutate branches
2220: 74 6f 20 74 61 67 73 22 0a 0a 09 66 6f 72 65 61 to tags"...forea
2230: 63 68 20 7b 69 64 20 66 69 64 20 6c 6f 64 20 73 ch {id fid lod s
2240: 69 64 20 72 6f 6f 74 20 66 69 72 73 74 20 62 72 id root first br
2250: 61 7d 20 24 62 72 61 6e 63 68 65 73 74 6f 6d 75 a} $branchestomu
2260: 74 61 74 65 20 7b 0a 09 20 20 20 20 73 74 61 74 tate {.. stat
2270: 65 20 72 75 6e 20 7b 0a 09 09 44 45 4c 45 54 45 e run {...DELETE
2280: 20 46 52 4f 4d 20 62 72 61 6e 63 68 20 57 48 45 FROM branch WHE
2290: 52 45 20 62 69 64 20 3d 20 24 69 64 20 3b 0a 09 RE bid = $id ;..
22a0: 09 49 4e 53 45 52 54 20 49 4e 54 4f 20 74 61 67 .INSERT INTO tag
22b0: 20 28 74 69 64 2c 20 66 69 64 2c 20 20 6c 6f 64 (tid, fid, lod
22c0: 2c 20 20 73 69 64 2c 20 20 72 65 76 29 0a 09 09 , sid, rev)...
22d0: 56 41 4c 55 45 53 20 20 20 20 20 20 20 20 20 20 VALUES
22e0: 28 24 69 64 2c 20 24 66 69 64 2c 20 24 6c 6f 64 ($id, $fid, $lod
22f0: 2c 20 24 73 69 64 2c 20 24 72 6f 6f 74 29 3b 0a , $sid, $root);.
2300: 09 20 20 20 20 7d 0a 09 7d 0a 0a 09 6c 6f 67 20 . }..}...log
2310: 77 72 69 74 65 20 33 20 66 69 6c 74 65 72 73 79 write 3 filtersy
2320: 6d 20 22 4f 6b 2e 22 0a 0a 09 23 20 23 20 23 23 m "Ok."...# # ##
2330: 20 23 23 23 20 23 23 23 23 23 20 23 23 23 23 23 ### ##### #####
2340: 23 23 23 20 23 23 23 23 23 23 23 23 23 23 23 23 ### ############
2350: 23 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a #..return. }.
2360: 0a 20 20 20 20 23 20 41 64 6a 75 73 74 20 74 68 . # Adjust th
2370: 65 20 70 61 72 65 6e 74 73 20 6f 66 20 73 79 6d e parents of sym
2380: 62 6f 6c 73 20 74 6f 20 74 68 65 69 72 20 70 72 bols to their pr
2390: 65 66 65 72 72 65 64 20 70 61 72 65 6e 74 73 2e eferred parents.
23a0: 0a 0a 20 20 20 20 23 20 49 66 20 61 20 66 69 6c .. # If a fil
23b0: 65 20 6c 65 76 65 6c 20 79 6d 62 6f 6c 20 68 61 e level ymbol ha
23c0: 73 20 61 20 70 72 65 66 65 72 72 65 64 20 70 61 s a preferred pa
23d0: 72 65 6e 74 20 74 68 61 74 20 69 73 20 64 69 66 rent that is dif
23e0: 66 65 72 65 6e 74 0a 20 20 20 20 23 20 74 68 61 ferent. # tha
23f0: 6e 20 69 74 73 20 63 75 72 72 65 6e 74 20 70 61 n its current pa
2400: 72 65 6e 74 2c 20 61 6e 64 20 69 66 20 74 68 65 rent, and if the
2410: 20 70 72 65 66 65 72 72 65 64 20 70 61 72 65 6e preferred paren
2420: 74 20 69 73 20 61 6e 0a 20 20 20 20 23 20 61 6c t is an. # al
2430: 6c 6f 77 65 64 20 70 61 72 65 6e 74 20 6f 66 20 lowed parent of
2440: 74 68 65 20 73 79 6d 62 6f 6c 20 69 6e 20 74 68 the symbol in th
2450: 69 73 20 66 69 6c 65 2c 20 74 68 65 6e 20 77 65 is file, then we
2460: 20 67 72 61 66 74 20 74 68 65 0a 20 20 20 20 23 graft the. #
2470: 20 61 53 79 6d 62 6f 6c 20 6f 6e 74 6f 20 69 74 aSymbol onto it
2480: 73 20 70 72 65 66 65 72 72 65 64 20 70 61 72 65 s preferred pare
2490: 6e 74 2e 0a 0a 20 20 20 20 70 72 6f 63 20 41 64 nt... proc Ad
24a0: 6a 75 73 74 50 61 72 65 6e 74 73 20 7b 7d 20 7b justParents {} {
24b0: 0a 09 6c 6f 67 20 77 72 69 74 65 20 33 20 66 69 ..log write 3 fi
24c0: 6c 74 65 72 73 79 6d 20 22 41 64 6a 75 73 74 20 ltersym "Adjust
24d0: 70 61 72 65 6e 74 73 2c 20 6c 6f 61 64 69 6e 67 parents, loading
24e0: 20 64 61 74 61 20 69 6e 20 70 72 65 70 61 72 61 data in prepara
24f0: 74 69 6f 6e 22 0a 0a 09 23 20 57 65 20 70 75 6c tion"...# We pul
2500: 6c 20 69 6d 70 6f 72 74 61 6e 74 20 6d 61 70 73 l important maps
2510: 20 6f 6e 63 65 20 69 6e 74 6f 20 6d 65 6d 6f 72 once into memor
2520: 79 20 73 6f 20 74 68 61 74 20 77 65 20 64 6f 20 y so that we do
2530: 71 75 69 63 6b 0a 09 23 20 68 61 73 68 20 6c 6f quick..# hash lo
2540: 6f 6b 75 70 20 6c 61 74 65 72 20 77 68 65 6e 20 okup later when
2550: 70 72 6f 63 65 73 73 69 6e 67 20 74 68 65 20 67 processing the g
2560: 72 61 66 74 20 63 61 6e 64 69 64 61 74 65 73 2e raft candidates.
2570: 0a 0a 09 23 20 54 61 67 2f 42 72 61 6e 63 68 20 ...# Tag/Branch
2580: 6e 61 6d 65 73 20 2e 2e 2e 0a 09 61 72 72 61 79 names .....array
2590: 20 73 65 74 20 73 6e 20 5b 73 74 61 74 65 20 72 set sn [state r
25a0: 75 6e 20 7b 20 53 45 4c 45 43 54 20 54 2e 74 69 un { SELECT T.ti
25b0: 64 2c 20 53 2e 6e 61 6d 65 20 46 52 4f 4d 20 74 d, S.name FROM t
25c0: 61 67 20 54 2c 20 20 20 20 73 79 6d 62 6f 6c 20 ag T, symbol
25d0: 53 20 57 48 45 52 45 20 54 2e 73 69 64 20 3d 20 S WHERE T.sid =
25e0: 53 2e 73 69 64 20 7d 5d 0a 09 61 72 72 61 79 20 S.sid }]..array
25f0: 73 65 74 20 73 6e 20 5b 73 74 61 74 65 20 72 75 set sn [state ru
2600: 6e 20 7b 20 53 45 4c 45 43 54 20 42 2e 62 69 64 n { SELECT B.bid
2610: 2c 20 53 2e 6e 61 6d 65 20 46 52 4f 4d 20 62 72 , S.name FROM br
2620: 61 6e 63 68 20 42 2c 20 73 79 6d 62 6f 6c 20 53 anch B, symbol S
2630: 20 57 48 45 52 45 20 42 2e 73 69 64 20 3d 20 53 WHERE B.sid = S
2640: 2e 73 69 64 20 7d 5d 0a 09 23 20 53 79 6d 62 6f .sid }]..# Symbo
2650: 6c 20 6e 61 6d 65 73 20 2e 2e 2e 0a 09 61 72 72 l names .....arr
2660: 61 79 20 73 65 74 20 73 78 20 5b 73 74 61 74 65 ay set sx [state
2670: 20 72 75 6e 20 7b 20 53 45 4c 45 43 54 20 4c 2e run { SELECT L.
2680: 73 69 64 2c 20 4c 2e 6e 61 6d 65 20 46 52 4f 4d sid, L.name FROM
2690: 20 73 79 6d 62 6f 6c 20 4c 20 7d 5d 0a 09 23 20 symbol L }]..#
26a0: 46 69 6c 65 73 20 61 6e 64 20 70 72 6f 6a 65 63 Files and projec
26b0: 74 73 2e 0a 09 61 72 72 61 79 20 73 65 74 20 66 ts...array set f
26c0: 70 6e 20 7b 7d 0a 09 66 6f 72 65 61 63 68 20 7b pn {}..foreach {
26d0: 69 64 20 66 6e 20 70 6e 7d 20 5b 73 74 61 74 65 id fn pn} [state
26e0: 20 72 75 6e 20 7b 0a 09 09 53 45 4c 45 43 54 20 run {...SELECT
26f0: 46 2e 66 69 64 2c 20 46 2e 6e 61 6d 65 2c 20 50 F.fid, F.name, P
2700: 2e 6e 61 6d 65 0a 09 09 46 52 4f 4d 20 20 20 66 .name...FROM f
2710: 69 6c 65 20 46 2c 20 70 72 6f 6a 65 63 74 20 50 ile F, project P
2720: 0a 09 09 57 48 45 52 45 20 20 46 2e 70 69 64 20 ...WHERE F.pid
2730: 3d 20 50 2e 70 69 64 0a 09 7d 5d 20 7b 20 73 65 = P.pid..}] { se
2740: 74 20 66 70 6e 28 24 69 64 29 20 5b 6c 69 73 74 t fpn($id) [list
2750: 20 24 66 6e 20 24 70 6e 5d 20 7d 0a 0a 09 73 65 $fn $pn] }...se
2760: 74 20 74 61 67 73 74 6f 61 64 6a 75 73 74 20 5b t tagstoadjust [
2770: 73 74 61 74 65 20 72 75 6e 20 7b 0a 09 20 20 20 state run {..
2780: 20 53 45 4c 45 43 54 20 54 2e 74 69 64 2c 20 54 SELECT T.tid, T
2790: 2e 66 69 64 2c 20 54 2e 6c 6f 64 2c 20 50 2e 70 .fid, T.lod, P.p
27a0: 69 64 2c 20 53 2e 6e 61 6d 65 2c 20 52 2e 72 65 id, S.name, R.re
27b0: 76 2c 20 52 2e 72 69 64 0a 09 20 20 20 20 46 52 v, R.rid.. FR
27c0: 4f 4d 20 74 61 67 20 54 2c 20 70 72 65 66 65 72 OM tag T, prefer
27d0: 65 64 70 61 72 65 6e 74 20 50 2c 20 73 79 6d 62 edparent P, symb
27e0: 6f 6c 20 53 2c 20 72 65 76 69 73 69 6f 6e 20 52 ol S, revision R
27f0: 0a 09 20 20 20 20 57 48 45 52 45 20 54 2e 73 69 .. WHERE T.si
2800: 64 20 3d 20 50 2e 73 69 64 0a 09 20 20 20 20 41 d = P.sid.. A
2810: 4e 44 20 20 20 54 2e 6c 6f 64 20 21 3d 20 50 2e ND T.lod != P.
2820: 70 69 64 0a 09 20 20 20 20 41 4e 44 20 20 20 50 pid.. AND P
2830: 2e 70 69 64 20 3d 20 53 2e 73 69 64 0a 09 20 20 .pid = S.sid..
2840: 20 20 41 4e 44 20 20 20 53 2e 6e 61 6d 65 20 21 AND S.name !
2850: 3d 20 27 3a 74 72 75 6e 6b 3a 27 0a 09 20 20 20 = ':trunk:'..
2860: 20 41 4e 44 20 20 20 54 2e 72 65 76 20 3d 20 52 AND T.rev = R
2870: 2e 72 69 64 0a 09 7d 5d 0a 0a 09 73 65 74 20 62 .rid..}]...set b
2880: 72 61 6e 63 68 65 73 74 6f 61 64 6a 75 73 74 20 ranchestoadjust
2890: 5b 73 74 61 74 65 20 72 75 6e 20 7b 0a 09 20 20 [state run {..
28a0: 20 20 53 45 4c 45 43 54 20 42 2e 62 69 64 2c 20 SELECT B.bid,
28b0: 42 2e 66 69 64 2c 20 42 2e 6c 6f 64 2c 20 42 2e B.fid, B.lod, B.
28c0: 70 6f 73 2c 20 50 2e 70 69 64 2c 20 53 2e 6e 61 pos, P.pid, S.na
28d0: 6d 65 2c 20 52 2e 72 65 76 2c 20 52 2e 72 69 64 me, R.rev, R.rid
28e0: 0a 09 20 20 20 20 46 52 4f 4d 20 62 72 61 6e 63 .. FROM branc
28f0: 68 20 42 2c 20 70 72 65 66 65 72 65 64 70 61 72 h B, preferedpar
2900: 65 6e 74 20 50 2c 20 73 79 6d 62 6f 6c 20 53 2c ent P, symbol S,
2910: 20 72 65 76 69 73 69 6f 6e 20 52 0a 09 20 20 20 revision R..
2920: 20 57 48 45 52 45 20 42 2e 73 69 64 20 3d 20 50 WHERE B.sid = P
2930: 2e 73 69 64 0a 09 20 20 20 20 41 4e 44 20 20 20 .sid.. AND
2940: 42 2e 6c 6f 64 20 21 3d 20 50 2e 70 69 64 0a 09 B.lod != P.pid..
2950: 20 20 20 20 41 4e 44 20 20 20 50 2e 70 69 64 20 AND P.pid
2960: 3d 20 53 2e 73 69 64 0a 09 20 20 20 20 41 4e 44 = S.sid.. AND
2970: 20 20 20 53 2e 6e 61 6d 65 20 21 3d 20 27 3a 74 S.name != ':t
2980: 72 75 6e 6b 3a 27 0a 09 20 20 20 20 41 4e 44 20 runk:'.. AND
2990: 20 20 42 2e 72 6f 6f 74 20 3d 20 52 2e 72 69 64 B.root = R.rid
29a0: 0a 09 7d 5d 0a 0a 09 73 65 74 20 74 6d 61 78 20 ..}]...set tmax
29b0: 5b 65 78 70 72 20 7b 5b 6c 6c 65 6e 67 74 68 20 [expr {[llength
29c0: 24 74 61 67 73 74 6f 61 64 6a 75 73 74 5d 20 2f $tagstoadjust] /
29d0: 20 37 7d 5d 0a 09 73 65 74 20 62 6d 61 78 20 5b 7}]..set bmax [
29e0: 65 78 70 72 20 7b 5b 6c 6c 65 6e 67 74 68 20 24 expr {[llength $
29f0: 62 72 61 6e 63 68 65 73 74 6f 61 64 6a 75 73 74 branchestoadjust
2a00: 5d 20 2f 20 38 7d 5d 0a 0a 09 6c 6f 67 20 77 72 ] / 8}]...log wr
2a10: 69 74 65 20 34 20 66 69 6c 74 65 72 73 79 6d 20 ite 4 filtersym
2a20: 22 52 65 70 61 72 65 6e 74 69 6e 67 20 61 74 20 "Reparenting at
2a30: 6d 6f 73 74 20 5b 6e 73 70 20 24 74 6d 61 78 20 most [nsp $tmax
2a40: 74 61 67 5d 22 0a 09 6c 6f 67 20 77 72 69 74 65 tag]"..log write
2a50: 20 34 20 66 69 6c 74 65 72 73 79 6d 20 22 52 65 4 filtersym "Re
2a60: 70 61 72 65 6e 74 69 6e 67 20 61 74 20 6d 6f 73 parenting at mos
2a70: 74 20 5b 6e 73 70 20 24 62 6d 61 78 20 62 72 61 t [nsp $bmax bra
2a80: 6e 63 68 20 62 72 61 6e 63 68 65 73 5d 22 0a 0a nch branches]"..
2a90: 09 6c 6f 67 20 77 72 69 74 65 20 33 20 66 69 6c .log write 3 fil
2aa0: 74 65 72 73 79 6d 20 22 41 64 6a 75 73 74 20 74 tersym "Adjust t
2ab0: 61 67 20 70 61 72 65 6e 74 73 22 0a 0a 09 23 20 ag parents"...#
2ac0: 46 69 6e 64 20 74 68 65 20 74 61 67 73 20 77 68 Find the tags wh
2ad0: 6f 73 65 20 63 75 72 72 65 6e 74 20 70 61 72 65 ose current pare
2ae0: 6e 74 20 28 6c 6f 64 29 20 69 73 20 6e 6f 74 20 nt (lod) is not
2af0: 74 68 65 20 70 72 65 66 65 72 65 64 0a 09 23 20 the prefered..#
2b00: 70 61 72 65 6e 74 2c 20 74 68 65 20 70 72 65 66 parent, the pref
2b10: 65 72 65 64 20 70 61 72 65 6e 74 20 69 73 20 6e ered parent is n
2b20: 6f 74 20 74 68 65 20 74 72 75 6e 6b 2c 20 61 6e ot the trunk, an
2b30: 64 20 74 68 65 0a 09 23 20 70 72 65 66 65 72 65 d the..# prefere
2b40: 64 20 70 61 72 65 6e 74 20 69 73 20 61 20 70 6f d parent is a po
2b50: 73 73 69 62 6c 65 20 70 61 72 65 6e 74 20 70 65 ssible parent pe
2b60: 72 20 74 68 65 20 74 61 67 27 73 20 72 65 76 69 r the tag's revi
2b70: 73 69 6f 6e 2e 0a 0a 09 73 65 74 20 66 6d 74 20 sion....set fmt
2b80: 25 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 %[string length
2b90: 24 74 6d 61 78 5d 73 0a 09 73 65 74 20 6d 78 73 $tmax]s..set mxs
2ba0: 20 5b 66 6f 72 6d 61 74 20 24 66 6d 74 20 24 74 [format $fmt $t
2bb0: 6d 61 78 5d 0a 0a 09 73 65 74 20 6e 20 30 0a 09 max]...set n 0..
2bc0: 66 6f 72 65 61 63 68 20 7b 69 64 20 66 69 64 20 foreach {id fid
2bd0: 6c 6f 64 20 70 69 64 20 70 72 65 66 65 72 65 64 lod pid prefered
2be0: 6e 61 6d 65 20 72 65 76 6e 72 20 72 69 64 7d 20 name revnr rid}
2bf0: 24 74 61 67 73 74 6f 61 64 6a 75 73 74 20 7b 0a $tagstoadjust {.
2c00: 0a 09 20 20 20 20 23 20 42 4f 54 54 4c 45 2d 4e .. # BOTTLE-N
2c10: 45 43 4b 20 2e 2e 2e 0a 09 20 20 20 20 23 0a 09 ECK ..... #..
2c20: 20 20 20 20 23 20 54 68 65 20 63 68 65 63 6b 20 # The check
2c30: 69 66 20 74 68 65 20 63 61 6e 64 69 64 61 74 65 if the candidate
2c40: 20 28 70 69 64 29 20 69 73 20 74 72 75 6c 79 20 (pid) is truly
2c50: 76 69 61 62 6c 65 20 69 73 0a 09 20 20 20 20 23 viable is.. #
2c60: 20 62 61 73 65 64 20 66 69 6e 64 69 6e 67 20 74 based finding t
2c70: 68 65 20 62 72 61 6e 63 68 20 61 73 20 70 6f 73 he branch as pos
2c80: 73 69 62 6c 65 20 70 61 72 65 6e 74 2c 20 61 6e sible parent, an
2c90: 64 20 64 6f 6e 65 0a 09 20 20 20 20 23 20 6e 6f d done.. # no
2ca0: 77 20 69 6e 73 74 65 61 64 20 6f 66 20 61 73 20 w instead of as
2cb0: 70 61 72 74 20 6f 66 20 74 68 65 20 61 6c 72 65 part of the alre
2cc0: 61 64 79 20 63 6f 6d 70 6c 65 78 20 6a 6f 69 6e ady complex join
2cd0: 2e 0a 09 20 20 20 20 23 0a 09 20 20 20 20 23 20 ... #.. #
2ce0: 2e 2e 2e 20 41 4e 44 20 50 2e 70 69 64 20 49 4e ... AND P.pid IN
2cf0: 20 28 53 45 4c 45 43 54 20 42 2e 73 69 64 0a 09 (SELECT B.sid..
2d00: 20 20 20 20 23 20 20 20 20 20 20 20 20 20 20 20 #
2d10: 20 20 20 20 20 20 20 20 46 52 4f 4d 20 62 72 61 FROM bra
2d20: 6e 63 68 20 42 0a 09 20 20 20 20 23 20 20 20 20 nch B.. #
2d30: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 57 W
2d40: 48 45 52 45 20 42 2e 72 6f 6f 74 20 3d 20 52 2e HERE B.root = R.
2d50: 72 69 64 29 0a 0a 09 20 20 20 20 69 66 20 7b 21 rid)... if {!
2d60: 5b 73 74 61 74 65 20 6f 6e 65 20 7b 0a 09 09 53 [state one {...S
2d70: 45 4c 45 43 54 20 43 4f 55 4e 54 28 2a 29 0a 09 ELECT COUNT(*)..
2d80: 09 46 52 4f 4d 20 62 72 61 6e 63 68 20 42 0a 09 .FROM branch B..
2d90: 09 57 48 45 52 45 20 20 42 2e 73 69 64 20 20 3d .WHERE B.sid =
2da0: 20 24 70 69 64 0a 09 09 41 4e 44 20 20 20 20 42 $pid...AND B
2db0: 2e 72 6f 6f 74 20 3d 20 24 72 69 64 0a 09 20 20 .root = $rid..
2dc0: 20 20 7d 5d 7d 20 7b 0a 09 09 69 6e 63 72 20 74 }]} {...incr t
2dd0: 6d 61 78 20 2d 31 0a 09 09 73 65 74 20 20 6d 78 max -1...set mx
2de0: 73 20 5b 66 6f 72 6d 61 74 20 24 66 6d 74 20 24 s [format $fmt $
2df0: 74 6d 61 78 5d 0a 09 09 63 6f 6e 74 69 6e 75 65 tmax]...continue
2e00: 0a 09 20 20 20 20 7d 0a 0a 09 20 20 20 20 23 0a .. }... #.
2e10: 09 20 20 20 20 23 20 42 4f 54 54 4c 45 2d 4e 45 . # BOTTLE-NE
2e20: 43 4b 20 2e 2e 2e 0a 0a 09 20 20 20 20 23 20 54 CK ...... # T
2e30: 68 65 20 6e 61 6d 65 73 20 66 6f 72 20 75 73 65 he names for use
2e40: 20 69 6e 20 74 68 65 20 6c 6f 67 20 6f 75 74 70 in the log outp
2e50: 75 74 20 61 72 65 20 72 65 74 72 69 65 76 65 64 ut are retrieved
2e60: 0a 09 20 20 20 20 23 20 73 65 70 61 72 61 74 65 .. # separate
2e70: 6c 79 2c 20 74 6f 20 6b 65 65 70 20 74 68 65 20 ly, to keep the
2e80: 6a 6f 69 6e 20 73 65 6c 65 63 74 69 6e 67 20 74 join selecting t
2e90: 68 65 20 61 64 6a 75 73 74 61 62 6c 65 0a 09 20 he adjustable..
2ea0: 20 20 20 23 20 74 61 67 73 20 73 6d 61 6c 6c 2c # tags small,
2eb0: 20 6e 6f 74 20 62 75 72 64 65 6e 65 64 20 77 69 not burdened wi
2ec0: 74 68 20 74 68 65 20 64 65 72 65 66 65 72 65 6e th the dereferen
2ed0: 63 69 6e 67 20 6f 66 20 6c 69 6e 6b 73 0a 09 20 cing of links..
2ee0: 20 20 20 23 20 74 6f 20 6e 61 6d 65 2e 0a 0a 09 # to name....
2ef0: 20 20 20 20 73 65 74 20 74 61 67 6e 61 6d 65 20 set tagname
2f00: 24 73 6e 28 24 69 64 29 0a 09 20 20 20 20 73 65 $sn($id).. se
2f10: 74 20 6f 6c 64 6e 61 6d 65 20 24 73 78 28 24 6c t oldname $sx($l
2f20: 6f 64 29 0a 09 20 20 20 20 73 74 72 75 63 74 3a od).. struct:
2f30: 3a 6c 69 73 74 20 61 73 73 69 67 6e 20 24 66 70 :list assign $fp
2f40: 6e 28 24 66 69 64 29 20 66 6e 61 6d 65 20 70 72 n($fid) fname pr
2f50: 6e 61 6d 65 0a 0a 09 20 20 20 20 23 20 44 6f 20 name... # Do
2f60: 74 68 65 20 67 72 61 66 74 69 6e 67 2e 0a 0a 09 the grafting....
2f70: 20 20 20 20 6c 6f 67 20 77 72 69 74 65 20 34 20 log write 4
2f80: 66 69 6c 74 65 72 73 79 6d 20 7b 5c 5b 5b 66 6f filtersym {\[[fo
2f90: 72 6d 61 74 20 24 66 6d 74 20 24 6e 5d 2f 24 6d rmat $fmt $n]/$m
2fa0: 78 73 5c 5d 20 24 70 72 6e 61 6d 65 20 3a 20 47 xs\] $prname : G
2fb0: 72 61 66 74 69 6e 67 20 74 61 67 20 27 24 74 61 rafting tag '$ta
2fc0: 67 6e 61 6d 65 27 20 6f 6e 20 24 66 6e 61 6d 65 gname' on $fname
2fd0: 2f 24 72 65 76 6e 72 20 66 72 6f 6d 20 27 24 6f /$revnr from '$o
2fe0: 6c 64 6e 61 6d 65 27 20 6f 6e 74 6f 20 27 24 70 ldname' onto '$p
2ff0: 72 65 66 65 72 65 64 6e 61 6d 65 27 7d 0a 09 20 referedname'}..
3000: 20 20 20 73 74 61 74 65 20 72 75 6e 20 7b 20 55 state run { U
3010: 50 44 41 54 45 20 74 61 67 20 53 45 54 20 6c 6f PDATE tag SET lo
3020: 64 20 3d 20 24 70 69 64 20 57 48 45 52 45 20 74 d = $pid WHERE t
3030: 69 64 20 3d 20 24 69 64 20 3b 20 7d 0a 09 20 20 id = $id ; }..
3040: 20 20 69 6e 63 72 20 6e 0a 09 7d 0a 0a 09 6c 6f incr n..}...lo
3050: 67 20 77 72 69 74 65 20 33 20 66 69 6c 74 65 72 g write 3 filter
3060: 73 79 6d 20 22 52 65 70 61 72 65 6e 74 65 64 20 sym "Reparented
3070: 5b 6e 73 70 20 24 6e 20 74 61 67 5d 22 0a 0a 09 [nsp $n tag]"...
3080: 6c 6f 67 20 77 72 69 74 65 20 33 20 66 69 6c 74 log write 3 filt
3090: 65 72 73 79 6d 20 22 41 64 6a 75 73 74 20 62 72 ersym "Adjust br
30a0: 61 6e 63 68 20 70 61 72 65 6e 74 73 22 0a 0a 09 anch parents"...
30b0: 23 20 46 69 6e 64 20 74 68 65 20 62 72 61 6e 63 # Find the branc
30c0: 68 65 73 20 77 68 6f 73 65 20 63 75 72 72 65 6e hes whose curren
30d0: 74 20 70 61 72 65 6e 74 20 28 6c 6f 64 29 20 69 t parent (lod) i
30e0: 73 20 6e 6f 74 20 74 68 65 0a 09 23 20 70 72 65 s not the..# pre
30f0: 66 65 72 65 64 20 70 61 72 65 6e 74 2c 20 74 68 fered parent, th
3100: 65 20 70 72 65 66 65 72 65 64 20 70 61 72 65 6e e prefered paren
3110: 74 20 69 73 20 6e 6f 74 20 74 68 65 20 74 72 75 t is not the tru
3120: 6e 6b 2c 20 61 6e 64 0a 09 23 20 74 68 65 20 70 nk, and..# the p
3130: 72 65 66 65 72 65 64 20 70 61 72 65 6e 74 20 69 refered parent i
3140: 73 20 61 20 70 6f 73 73 69 62 6c 65 20 70 61 72 s a possible par
3150: 65 6e 74 20 70 65 72 20 74 68 65 20 62 72 61 6e ent per the bran
3160: 63 68 27 73 0a 09 23 20 72 65 76 69 73 69 6f 6e ch's..# revision
3170: 2e 0a 0a 09 73 65 74 20 66 6d 74 20 25 5b 73 74 ....set fmt %[st
3180: 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 62 6d 61 ring length $bma
3190: 78 5d 73 0a 09 73 65 74 20 6d 78 73 20 5b 66 6f x]s..set mxs [fo
31a0: 72 6d 61 74 20 24 66 6d 74 20 24 62 6d 61 78 5d rmat $fmt $bmax]
31b0: 0a 0a 09 73 65 74 20 6e 20 30 0a 09 66 6f 72 65 ...set n 0..fore
31c0: 61 63 68 20 7b 69 64 20 66 69 64 20 6c 6f 64 20 ach {id fid lod
31d0: 70 6f 73 20 70 69 64 20 70 72 65 66 65 72 65 64 pos pid prefered
31e0: 6e 61 6d 65 20 72 65 76 6e 72 20 72 69 64 7d 20 name revnr rid}
31f0: 24 62 72 61 6e 63 68 65 73 74 6f 61 64 6a 75 73 $branchestoadjus
3200: 74 20 7b 0a 0a 09 20 20 20 20 23 20 42 4f 54 54 t {... # BOTT
3210: 4c 45 2d 4e 45 43 4b 20 2e 2e 2e 0a 09 20 20 20 LE-NECK .....
3220: 20 23 0a 09 20 20 20 20 23 20 54 68 65 20 63 68 #.. # The ch
3230: 65 63 6b 20 69 66 20 74 68 65 20 63 61 6e 64 69 eck if the candi
3240: 64 61 74 65 20 28 70 69 64 29 20 69 73 20 74 72 date (pid) is tr
3250: 75 6c 79 20 76 69 61 62 6c 65 20 69 73 0a 09 20 uly viable is..
3260: 20 20 20 23 20 62 61 73 65 64 20 6f 6e 20 74 68 # based on th
3270: 65 20 62 72 61 6e 63 68 20 70 6f 73 69 74 69 6f e branch positio
3280: 6e 73 20 69 6e 20 74 68 65 20 73 70 61 77 6e 69 ns in the spawni
3290: 6e 67 20 72 65 76 69 73 69 6f 6e 2c 0a 09 20 20 ng revision,..
32a0: 20 20 23 20 61 6e 64 20 64 6f 6e 65 20 6e 6f 77 # and done now
32b0: 20 69 6e 73 74 65 61 64 20 6f 66 20 61 73 20 70 instead of as p
32c0: 61 72 74 20 6f 66 20 74 68 65 20 61 6c 72 65 61 art of the alrea
32d0: 64 79 20 63 6f 6d 70 6c 65 78 0a 09 20 20 20 20 dy complex..
32e0: 23 20 6a 6f 69 6e 2e 0a 09 20 20 20 20 23 0a 09 # join... #..
32f0: 20 20 20 20 23 20 2e 2e 2e 20 41 4e 44 20 50 2e # ... AND P.
3300: 70 69 64 20 49 4e 20 28 53 45 4c 45 43 54 20 42 pid IN (SELECT B
3310: 58 2e 73 69 64 0a 09 20 20 20 20 23 20 20 20 20 X.sid.. #
3320: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 46 F
3330: 52 4f 4d 20 62 72 61 6e 63 68 20 42 58 0a 09 20 ROM branch BX..
3340: 20 20 20 23 20 20 20 20 20 20 20 20 20 20 20 20 #
3350: 20 20 20 20 20 20 20 57 48 45 52 45 20 42 58 2e WHERE BX.
3360: 72 6f 6f 74 20 3d 20 52 2e 72 69 64 0a 09 20 20 root = R.rid..
3370: 20 20 23 20 20 20 20 20 20 20 20 20 20 20 20 20 #
3380: 20 20 20 20 20 20 41 4e 44 20 20 20 42 58 2e 70 AND BX.p
3390: 6f 73 20 3e 20 42 2e 70 6f 73 29 0a 0a 09 20 20 os > B.pos)...
33a0: 20 20 69 66 20 7b 21 5b 73 74 61 74 65 20 6f 6e if {![state on
33b0: 65 20 7b 0a 09 09 53 45 4c 45 43 54 20 43 4f 55 e {...SELECT COU
33c0: 4e 54 28 2a 29 0a 09 09 46 52 4f 4d 20 62 72 61 NT(*)...FROM bra
33d0: 6e 63 68 20 42 0a 09 09 57 48 45 52 45 20 20 42 nch B...WHERE B
33e0: 2e 73 69 64 20 20 3d 20 24 70 69 64 0a 09 09 41 .sid = $pid...A
33f0: 4e 44 20 20 20 20 42 2e 72 6f 6f 74 20 3d 20 24 ND B.root = $
3400: 72 69 64 0a 09 09 41 4e 44 20 20 20 20 42 2e 70 rid...AND B.p
3410: 6f 73 20 20 3e 20 24 70 6f 73 0a 09 20 20 20 20 os > $pos..
3420: 7d 5d 7d 20 7b 0a 09 09 69 6e 63 72 20 62 6d 61 }]} {...incr bma
3430: 78 20 2d 31 0a 09 09 73 65 74 20 20 6d 78 73 20 x -1...set mxs
3440: 5b 66 6f 72 6d 61 74 20 24 66 6d 74 20 24 62 6d [format $fmt $bm
3450: 61 78 5d 0a 09 09 63 6f 6e 74 69 6e 75 65 0a 09 ax]...continue..
3460: 20 20 20 20 7d 0a 0a 09 20 20 20 20 23 0a 09 20 }... #..
3470: 20 20 20 23 20 42 4f 54 54 4c 45 2d 4e 45 43 4b # BOTTLE-NECK
3480: 20 2e 2e 2e 0a 0a 09 20 20 20 20 23 20 54 68 65 ...... # The
3490: 20 6e 61 6d 65 73 20 66 6f 72 20 75 73 65 20 69 names for use i
34a0: 6e 20 74 68 65 20 6c 6f 67 20 6f 75 74 70 75 74 n the log output
34b0: 20 61 72 65 20 72 65 74 72 69 65 76 65 64 0a 09 are retrieved..
34c0: 20 20 20 20 23 20 73 65 70 61 72 61 74 65 6c 79 # separately
34d0: 2c 20 74 6f 20 6b 65 65 70 20 74 68 65 20 6a 6f , to keep the jo
34e0: 69 6e 20 73 65 6c 65 63 74 69 6e 67 20 74 68 65 in selecting the
34f0: 20 61 64 6a 75 73 74 61 62 6c 65 0a 09 20 20 20 adjustable..
3500: 20 23 20 74 61 67 73 20 73 6d 61 6c 6c 2c 20 6e # tags small, n
3510: 6f 74 20 62 75 72 64 65 6e 65 64 20 77 69 74 68 ot burdened with
3520: 20 74 68 65 20 64 65 72 65 66 65 72 65 6e 63 69 the dereferenci
3530: 6e 67 20 6f 66 20 6c 69 6e 6b 73 0a 09 20 20 20 ng of links..
3540: 20 23 20 74 6f 20 6e 61 6d 65 2e 0a 0a 09 20 20 # to name....
3550: 20 20 73 65 74 20 62 72 61 6e 61 6d 65 20 24 73 set braname $s
3560: 6e 28 24 69 64 29 0a 09 20 20 20 20 73 65 74 20 n($id).. set
3570: 6f 6c 64 6e 61 6d 65 20 24 73 78 28 24 6c 6f 64 oldname $sx($lod
3580: 29 0a 09 20 20 20 20 73 74 72 75 63 74 3a 3a 6c ).. struct::l
3590: 69 73 74 20 61 73 73 69 67 6e 20 24 66 70 6e 28 ist assign $fpn(
35a0: 24 66 69 64 29 20 66 6e 61 6d 65 20 70 72 6e 61 $fid) fname prna
35b0: 6d 65 0a 0a 09 20 20 20 20 23 20 44 6f 20 74 68 me... # Do th
35c0: 65 20 67 72 61 66 74 69 6e 67 2e 0a 0a 09 20 20 e grafting....
35d0: 20 20 6c 6f 67 20 77 72 69 74 65 20 34 20 66 69 log write 4 fi
35e0: 6c 74 65 72 73 79 6d 20 7b 5c 5b 5b 66 6f 72 6d ltersym {\[[form
35f0: 61 74 20 24 66 6d 74 20 24 6e 5d 2f 24 6d 78 73 at $fmt $n]/$mxs
3600: 5c 5d 20 24 70 72 6e 61 6d 65 20 3a 20 47 72 61 \] $prname : Gra
3610: 66 74 69 6e 67 20 62 72 61 6e 63 68 20 27 24 62 fting branch '$b
3620: 72 61 6e 61 6d 65 27 20 6f 6e 20 24 66 6e 61 6d raname' on $fnam
3630: 65 2f 24 72 65 76 6e 72 20 66 72 6f 6d 20 27 24 e/$revnr from '$
3640: 6f 6c 64 6e 61 6d 65 27 20 6f 6e 74 6f 20 27 24 oldname' onto '$
3650: 70 72 65 66 65 72 65 64 6e 61 6d 65 27 7d 0a 09 preferedname'}..
3660: 20 20 20 20 73 74 61 74 65 20 72 75 6e 20 7b 20 state run {
3670: 55 50 44 41 54 45 20 74 61 67 20 53 45 54 20 6c UPDATE tag SET l
3680: 6f 64 20 3d 20 24 70 69 64 20 57 48 45 52 45 20 od = $pid WHERE
3690: 74 69 64 20 3d 20 24 69 64 20 3b 20 7d 0a 09 20 tid = $id ; }..
36a0: 20 20 20 69 6e 63 72 20 6e 0a 09 7d 0a 0a 09 6c incr n..}...l
36b0: 6f 67 20 77 72 69 74 65 20 33 20 66 69 6c 74 65 og write 3 filte
36c0: 72 73 79 6d 20 22 52 65 70 61 72 65 6e 74 65 64 rsym "Reparented
36d0: 20 5b 6e 73 70 20 24 6e 20 62 72 61 6e 63 68 20 [nsp $n branch
36e0: 62 72 61 6e 63 68 65 73 5d 22 0a 09 72 65 74 75 branches]"..retu
36f0: 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 70 72 rn. }.. pr
3700: 6f 63 20 52 65 66 69 6e 65 53 79 6d 62 6f 6c 73 oc RefineSymbols
3710: 20 7b 7d 20 7b 0a 09 23 20 54 61 67 73 20 61 6e {} {..# Tags an
3720: 64 20 62 72 61 6e 63 68 65 73 20 61 72 65 20 6d d branches are m
3730: 61 72 6b 65 64 20 61 73 20 6e 6f 72 6d 61 6c 2f arked as normal/
3740: 6e 6f 6f 70 20 62 61 73 65 64 20 6f 6e 20 74 68 noop based on th
3750: 65 20 6f 70 0a 09 23 20 6f 66 20 74 68 65 69 72 e op..# of their
3760: 20 72 65 76 69 73 69 6f 6e 2e 0a 0a 09 6c 6f 67 revision....log
3770: 20 77 72 69 74 65 20 33 20 66 69 6c 74 65 72 73 write 3 filters
3780: 79 6d 20 22 52 65 66 69 6e 65 20 73 79 6d 62 6f ym "Refine symbo
3790: 6c 73 20 28 6e 6f 2d 6f 70 20 6f 72 20 6e 6f 74 ls (no-op or not
37a0: 3f 29 22 0a 0a 09 6c 6f 67 20 77 72 69 74 65 20 ?)"...log write
37b0: 34 20 66 69 6c 74 65 72 73 79 6d 20 22 20 20 20 4 filtersym "
37c0: 20 52 65 67 75 6c 61 72 20 74 61 67 73 22 0a 09 Regular tags"..
37d0: 73 74 61 74 65 20 72 75 6e 20 7b 0a 09 20 20 20 state run {..
37e0: 20 49 4e 53 45 52 54 20 49 4e 54 4f 20 6e 6f 6f INSERT INTO noo
37f0: 70 0a 09 20 20 20 20 53 45 4c 45 43 54 20 54 2e p.. SELECT T.
3800: 74 69 64 2c 20 30 0a 09 20 20 20 20 46 52 4f 4d tid, 0.. FROM
3810: 20 74 61 67 20 54 2c 20 72 65 76 69 73 69 6f 6e tag T, revision
3820: 20 52 0a 09 20 20 20 20 57 48 45 52 45 20 54 2e R.. WHERE T.
3830: 72 65 76 20 20 3d 20 52 2e 72 69 64 0a 09 20 20 rev = R.rid..
3840: 20 20 41 4e 44 20 20 20 52 2e 6f 70 20 20 21 3d AND R.op !=
3850: 20 30 20 2d 2d 20 30 20 3d 3d 20 6e 6f 74 68 69 0 -- 0 == nothi
3860: 6e 67 0a 09 7d 0a 0a 09 6c 6f 67 20 77 72 69 74 ng..}...log writ
3870: 65 20 34 20 66 69 6c 74 65 72 73 79 6d 20 22 20 e 4 filtersym "
3880: 20 20 20 4e 6f 2d 6f 70 20 74 61 67 73 22 0a 09 No-op tags"..
3890: 73 74 61 74 65 20 72 75 6e 20 7b 0a 09 20 20 20 state run {..
38a0: 20 49 4e 53 45 52 54 20 49 4e 54 4f 20 6e 6f 6f INSERT INTO noo
38b0: 70 0a 09 20 20 20 20 53 45 4c 45 43 54 20 54 2e p.. SELECT T.
38c0: 74 69 64 2c 20 31 0a 09 20 20 20 20 46 52 4f 4d tid, 1.. FROM
38d0: 20 74 61 67 20 54 2c 20 72 65 76 69 73 69 6f 6e tag T, revision
38e0: 20 52 0a 09 20 20 20 20 57 48 45 52 45 20 54 2e R.. WHERE T.
38f0: 72 65 76 20 20 3d 20 52 2e 72 69 64 0a 09 20 20 rev = R.rid..
3900: 20 20 41 4e 44 20 20 20 52 2e 6f 70 20 20 20 3d AND R.op =
3910: 20 30 20 2d 2d 20 6e 6f 74 68 69 6e 67 0a 09 7d 0 -- nothing..}
3920: 0a 0a 09 6c 6f 67 20 77 72 69 74 65 20 34 20 66 ...log write 4 f
3930: 69 6c 74 65 72 73 79 6d 20 22 20 20 20 20 52 65 iltersym " Re
3940: 67 75 6c 61 72 20 62 72 61 6e 63 68 65 73 22 0a gular branches".
3950: 09 73 74 61 74 65 20 72 75 6e 20 7b 0a 09 20 20 .state run {..
3960: 20 20 49 4e 53 45 52 54 20 49 4e 54 4f 20 6e 6f INSERT INTO no
3970: 6f 70 0a 09 20 20 20 20 53 45 4c 45 43 54 20 42 op.. SELECT B
3980: 2e 62 69 64 2c 20 30 0a 09 20 20 20 20 46 52 4f .bid, 0.. FRO
3990: 4d 20 62 72 61 6e 63 68 20 42 2c 20 72 65 76 69 M branch B, revi
39a0: 73 69 6f 6e 20 52 0a 09 20 20 20 20 57 48 45 52 sion R.. WHER
39b0: 45 20 42 2e 72 6f 6f 74 20 3d 20 52 2e 72 69 64 E B.root = R.rid
39c0: 0a 09 20 20 20 20 41 4e 44 20 20 20 52 2e 6f 70 .. AND R.op
39d0: 20 20 21 3d 20 30 20 2d 2d 20 6e 6f 74 68 69 6e != 0 -- nothin
39e0: 67 0a 09 7d 0a 0a 09 6c 6f 67 20 77 72 69 74 65 g..}...log write
39f0: 20 34 20 66 69 6c 74 65 72 73 79 6d 20 22 20 20 4 filtersym "
3a00: 20 20 4e 6f 2d 6f 70 20 62 72 61 6e 63 68 65 73 No-op branches
3a10: 22 0a 09 73 74 61 74 65 20 72 75 6e 20 7b 0a 09 "..state run {..
3a20: 20 20 20 20 49 4e 53 45 52 54 20 49 4e 54 4f 20 INSERT INTO
3a30: 6e 6f 6f 70 0a 09 20 20 20 20 53 45 4c 45 43 54 noop.. SELECT
3a40: 20 42 2e 62 69 64 2c 20 31 0a 09 20 20 20 20 46 B.bid, 1.. F
3a50: 52 4f 4d 20 62 72 61 6e 63 68 20 42 2c 20 72 65 ROM branch B, re
3a60: 76 69 73 69 6f 6e 20 52 0a 09 20 20 20 20 57 48 vision R.. WH
3a70: 45 52 45 20 42 2e 72 6f 6f 74 20 3d 20 52 2e 72 ERE B.root = R.r
3a80: 69 64 0a 09 20 20 20 20 41 4e 44 20 20 20 52 2e id.. AND R.
3a90: 6f 70 20 20 20 3d 20 30 20 2d 2d 20 6e 6f 74 68 op = 0 -- noth
3aa0: 69 6e 67 0a 09 7d 0a 09 72 65 74 75 72 6e 0a 20 ing..}..return.
3ab0: 20 20 20 7d 0a 0a 20 20 20 20 23 20 23 20 23 23 }.. # # ##
3ac0: 20 23 23 23 20 23 23 23 23 23 20 23 23 23 23 23 ### ##### #####
3ad0: 23 23 23 20 23 23 23 23 23 23 23 23 23 23 23 23 ### ############
3ae0: 23 0a 20 20 20 20 23 23 20 43 6f 6e 66 69 67 75 #. ## Configu
3af0: 72 61 74 69 6f 6e 0a 0a 20 20 20 20 70 72 61 67 ration.. prag
3b00: 6d 61 20 2d 68 61 73 69 6e 73 74 61 6e 63 65 73 ma -hasinstances
3b10: 20 20 20 6e 6f 20 3b 20 23 20 73 69 6e 67 6c 65 no ; # single
3b20: 74 6f 6e 0a 20 20 20 20 70 72 61 67 6d 61 20 2d ton. pragma -
3b30: 68 61 73 74 79 70 65 69 6e 66 6f 20 20 20 20 6e hastypeinfo n
3b40: 6f 20 3b 20 23 20 6e 6f 20 69 6e 74 72 6f 73 70 o ; # no introsp
3b50: 65 63 74 69 6f 6e 0a 20 20 20 20 70 72 61 67 6d ection. pragm
3b60: 61 20 2d 68 61 73 74 79 70 65 64 65 73 74 72 6f a -hastypedestro
3b70: 79 20 6e 6f 20 3b 20 23 20 69 6d 6d 6f 72 74 61 y no ; # immorta
3b80: 6c 0a 0a 20 20 20 20 23 20 23 20 23 23 20 23 23 l.. # # ## ##
3b90: 23 20 23 23 23 23 23 20 23 23 23 23 23 23 23 23 # ##### ########
3ba0: 20 23 23 23 23 23 23 23 23 23 23 23 23 23 0a 7d #############.}
3bb0: 0a 0a 6e 61 6d 65 73 70 61 63 65 20 65 76 61 6c ..namespace eval
3bc0: 20 3a 3a 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 ::vc::fossil::i
3bd0: 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 70 61 73 73 mport::cvs::pass
3be0: 20 7b 0a 20 20 20 20 6e 61 6d 65 73 70 61 63 65 {. namespace
3bf0: 20 65 78 70 6f 72 74 20 66 69 6c 74 65 72 73 79 export filtersy
3c00: 6d 0a 20 20 20 20 6e 61 6d 65 73 70 61 63 65 20 m. namespace
3c10: 65 76 61 6c 20 66 69 6c 74 65 72 73 79 6d 20 7b eval filtersym {
3c20: 0a 09 6e 61 6d 65 73 70 61 63 65 20 69 6d 70 6f ..namespace impo
3c30: 72 74 20 3a 3a 76 63 3a 3a 66 6f 73 73 69 6c 3a rt ::vc::fossil:
3c40: 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 72 65 :import::cvs::re
3c50: 70 6f 73 69 74 6f 72 79 0a 09 6e 61 6d 65 73 70 pository..namesp
3c60: 61 63 65 20 69 6d 70 6f 72 74 20 3a 3a 76 63 3a ace import ::vc:
3c70: 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a :fossil::import:
3c80: 3a 63 76 73 3a 3a 73 74 61 74 65 0a 09 6e 61 6d :cvs::state..nam
3c90: 65 73 70 61 63 65 20 69 6d 70 6f 72 74 20 3a 3a espace import ::
3ca0: 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f vc::fossil::impo
3cb0: 72 74 3a 3a 63 76 73 3a 3a 69 6e 74 65 67 72 69 rt::cvs::integri
3cc0: 74 79 0a 09 6e 61 6d 65 73 70 61 63 65 20 65 76 ty..namespace ev
3cd0: 61 6c 20 70 72 6f 6a 65 63 74 20 7b 0a 09 20 20 al project {..
3ce0: 20 20 6e 61 6d 65 73 70 61 63 65 20 69 6d 70 6f namespace impo
3cf0: 72 74 20 3a 3a 76 63 3a 3a 66 6f 73 73 69 6c 3a rt ::vc::fossil:
3d00: 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 70 72 :import::cvs::pr
3d10: 6f 6a 65 63 74 3a 3a 73 79 6d 0a 09 7d 0a 09 6e oject::sym..}..n
3d20: 61 6d 65 73 70 61 63 65 20 69 6d 70 6f 72 74 20 amespace import
3d30: 3a 3a 76 63 3a 3a 74 6f 6f 6c 73 3a 3a 6d 69 73 ::vc::tools::mis
3d40: 63 3a 3a 6e 73 70 0a 09 6e 61 6d 65 73 70 61 63 c::nsp..namespac
3d50: 65 20 69 6d 70 6f 72 74 20 3a 3a 76 63 3a 3a 74 e import ::vc::t
3d60: 6f 6f 6c 73 3a 3a 6c 6f 67 0a 09 6c 6f 67 20 72 ools::log..log r
3d70: 65 67 69 73 74 65 72 20 66 69 6c 74 65 72 73 79 egister filtersy
3d80: 6d 0a 20 20 20 20 7d 0a 7d 0a 0a 23 20 23 20 23 m. }.}..# # #
3d90: 23 20 23 23 23 20 23 23 23 23 23 20 23 23 23 23 # ### ##### ####
3da0: 23 23 23 23 20 23 23 23 23 23 23 23 23 23 23 23 #### ###########
3db0: 23 23 20 23 23 23 23 23 23 23 23 23 23 23 23 23 ## #############
3dc0: 23 23 23 23 23 23 23 23 0a 23 23 20 52 65 61 64 ########.## Read
3dd0: 79 0a 0a 70 61 63 6b 61 67 65 20 70 72 6f 76 69 y..package provi
3de0: 64 65 20 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 de vc::fossil::i
3df0: 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 70 61 73 73 mport::cvs::pass
3e00: 3a 3a 66 69 6c 74 65 72 73 79 6d 20 31 2e 30 0a ::filtersym 1.0.
3e10: 72 65 74 75 72 6e 0a return.