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 20 0a 0a 73 6e 69 74 ######.## ..snit
06b0: 3a 3a 74 79 70 65 20 3a 3a 76 63 3a 3a 66 6f 73 ::type ::vc::fos
06c0: 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 sil::import::cvs
06d0: 3a 3a 70 61 73 73 3a 3a 66 69 6c 74 65 72 73 79 ::pass::filtersy
06e0: 6d 20 7b 0a 20 20 20 20 23 20 23 20 23 23 20 23 m {. # # ## #
06f0: 23 23 20 23 23 23 23 23 20 23 23 23 23 23 23 23 ## ##### #######
0700: 23 20 23 23 23 23 23 23 23 23 23 23 23 23 23 0a # #############.
0710: 20 20 20 20 23 23 20 50 75 62 6c 69 63 20 41 50 ## Public AP
0720: 49 0a 0a 20 20 20 20 74 79 70 65 6d 65 74 68 6f I.. typemetho
0730: 64 20 73 65 74 75 70 20 7b 7d 20 7b 0a 09 23 20 d setup {} {..#
0740: 44 65 66 69 6e 65 20 6e 61 6d 65 73 20 61 6e 64 Define names and
0750: 20 73 74 72 75 63 74 75 72 65 20 6f 66 20 74 68 structure of th
0760: 65 20 70 65 72 73 69 73 74 65 6e 74 20 73 74 61 e persistent sta
0770: 74 65 20 6f 66 20 74 68 69 73 0a 09 23 20 70 61 te of this..# pa
0780: 73 73 2e 0a 0a 09 73 74 61 74 65 20 72 65 61 64 ss....state read
0790: 69 6e 67 20 73 79 6d 62 6f 6c 0a 09 73 74 61 74 ing symbol..stat
07a0: 65 20 72 65 61 64 69 6e 67 20 62 6c 6f 63 6b 65 e reading blocke
07b0: 72 0a 09 73 74 61 74 65 20 72 65 61 64 69 6e 67 r..state reading
07c0: 20 70 61 72 65 6e 74 0a 09 73 74 61 74 65 20 72 parent..state r
07d0: 65 61 64 69 6e 67 20 70 72 65 66 65 72 65 64 70 eading preferedp
07e0: 61 72 65 6e 74 0a 09 73 74 61 74 65 20 72 65 61 arent..state rea
07f0: 64 69 6e 67 20 72 65 76 69 73 69 6f 6e 0a 09 73 ding revision..s
0800: 74 61 74 65 20 72 65 61 64 69 6e 67 20 72 65 76 tate reading rev
0810: 69 73 69 6f 6e 62 72 61 6e 63 68 63 68 69 6c 64 isionbranchchild
0820: 72 65 6e 0a 09 73 74 61 74 65 20 72 65 61 64 69 ren..state readi
0830: 6e 67 20 62 72 61 6e 63 68 0a 09 73 74 61 74 65 ng branch..state
0840: 20 72 65 61 64 69 6e 67 20 74 61 67 0a 0a 09 73 reading tag...s
0850: 74 61 74 65 20 77 72 69 74 69 6e 67 20 6e 6f 6f tate writing noo
0860: 70 20 7b 0a 09 20 20 20 20 69 64 20 20 20 20 49 p {.. id I
0870: 4e 54 45 47 45 52 20 4e 4f 54 20 4e 55 4c 4c 20 NTEGER NOT NULL
0880: 20 50 52 49 4d 41 52 59 20 4b 45 59 2c 20 2d 2d PRIMARY KEY, --
0890: 20 74 61 67 2f 62 72 61 6e 63 68 20 72 65 66 65 tag/branch refe
08a0: 72 65 6e 63 65 0a 09 20 20 20 20 6e 6f 6f 70 20 rence.. noop
08b0: 20 49 4e 54 45 47 45 52 20 4e 4f 54 20 4e 55 4c INTEGER NOT NUL
08c0: 4c 0a 09 7d 0a 09 72 65 74 75 72 6e 0a 20 20 20 L..}..return.
08d0: 20 7d 0a 0a 20 20 20 20 74 79 70 65 6d 65 74 68 }.. typemeth
08e0: 6f 64 20 6c 6f 61 64 20 7b 7d 20 7b 0a 09 23 20 od load {} {..#
08f0: 50 61 73 73 20 6d 61 6e 61 67 65 72 20 69 6e 74 Pass manager int
0900: 65 72 66 61 63 65 2e 20 45 78 65 63 75 74 65 64 erface. Executed
0910: 20 74 6f 20 6c 6f 61 64 20 64 61 74 61 20 63 6f to load data co
0920: 6d 70 75 74 65 64 20 62 79 0a 09 23 20 74 68 69 mputed by..# thi
0930: 73 20 70 61 73 73 20 69 6e 74 6f 20 6d 65 6d 6f s pass into memo
0940: 72 79 20 77 68 65 6e 20 74 68 69 73 20 70 61 73 ry when this pas
0950: 73 20 69 73 20 73 6b 69 70 70 65 64 20 69 6e 73 s is skipped ins
0960: 74 65 61 64 20 6f 66 0a 09 23 20 65 78 65 63 75 tead of..# execu
0970: 74 65 64 2e 0a 0a 09 23 20 54 68 65 20 72 65 73 ted....# The res
0980: 75 6c 74 73 20 6f 66 20 74 68 69 73 20 70 61 73 ults of this pas
0990: 73 20 61 72 65 20 66 75 6c 6c 79 20 69 6e 20 74 s are fully in t
09a0: 68 65 20 70 65 72 73 69 73 74 65 6e 74 20 73 74 he persistent st
09b0: 61 74 65 2c 0a 09 23 20 74 68 65 72 65 20 69 73 ate,..# there is
09c0: 20 6e 6f 74 68 69 6e 67 20 74 6f 20 6c 6f 61 64 nothing to load
09d0: 20 66 6f 72 20 74 68 65 20 6e 65 78 74 20 6f 6e for the next on
09e0: 65 2e 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 7d e...return. }
09f0: 0a 0a 20 20 20 20 74 79 70 65 6d 65 74 68 6f 64 .. typemethod
0a00: 20 72 75 6e 20 7b 7d 20 7b 0a 09 23 20 50 61 73 run {} {..# Pas
0a10: 73 20 6d 61 6e 61 67 65 72 20 69 6e 74 65 72 66 s manager interf
0a20: 61 63 65 2e 20 45 78 65 63 75 74 65 64 20 74 6f ace. Executed to
0a30: 20 70 65 72 66 6f 72 6d 20 74 68 65 0a 09 23 20 perform the..#
0a40: 66 75 6e 63 74 69 6f 6e 61 6c 69 74 79 20 6f 66 functionality of
0a50: 20 74 68 65 20 70 61 73 73 2e 0a 0a 09 23 20 54 the pass....# T
0a60: 68 65 20 72 65 6d 6f 76 61 6c 20 6f 66 20 65 78 he removal of ex
0a70: 63 6c 75 64 65 64 20 73 79 6d 62 6f 6c 73 20 61 cluded symbols a
0a80: 6e 64 20 65 76 65 72 79 74 68 69 6e 67 20 72 65 nd everything re
0a90: 66 65 72 65 6e 63 69 6e 67 0a 09 23 20 74 6f 20 ferencing..# to
0aa0: 74 68 65 6d 20 69 73 20 64 6f 6e 65 20 63 6f 6d them is done com
0ab0: 70 6c 65 74 65 6c 79 20 69 6e 20 74 68 65 20 64 pletely in the d
0ac0: 61 74 61 62 61 73 65 2e 0a 0a 09 73 74 61 74 65 atabase....state
0ad0: 20 74 72 61 6e 73 61 63 74 69 6f 6e 20 7b 0a 09 transaction {..
0ae0: 20 20 20 20 46 69 6c 74 65 72 45 78 63 6c 75 64 FilterExclud
0af0: 65 64 53 79 6d 62 6f 6c 73 0a 09 20 20 20 20 4d edSymbols.. M
0b00: 75 74 61 74 65 53 79 6d 62 6f 6c 73 0a 09 20 20 utateSymbols..
0b10: 20 20 41 64 6a 75 73 74 50 61 72 65 6e 74 73 0a AdjustParents.
0b20: 09 20 20 20 20 52 65 66 69 6e 65 53 79 6d 62 6f . RefineSymbo
0b30: 6c 73 0a 0a 09 20 20 20 20 72 65 70 6f 73 69 74 ls... reposit
0b40: 6f 72 79 20 70 72 69 6e 74 72 65 76 73 74 61 74 ory printrevstat
0b50: 69 73 74 69 63 73 0a 0a 09 20 20 20 20 23 20 53 istics... # S
0b60: 74 72 69 63 74 20 69 6e 74 65 67 72 69 74 79 20 trict integrity
0b70: 65 6e 66 6f 72 63 65 73 20 74 68 61 74 20 61 6c enforces that al
0b80: 6c 20 6d 65 74 61 20 65 6e 74 72 69 65 73 20 61 l meta entries a
0b90: 72 65 20 69 6e 0a 09 20 20 20 20 23 20 74 68 65 re in.. # the
0ba0: 20 73 61 6d 65 20 4c 4f 44 20 61 73 20 74 68 65 same LOD as the
0bb0: 20 72 65 76 69 73 69 6f 6e 20 75 73 69 6e 67 20 revision using
0bc0: 74 68 65 6d 2e 20 41 74 20 74 68 69 73 20 70 6f them. At this po
0bd0: 69 6e 74 0a 09 20 20 20 20 23 20 74 68 69 73 20 int.. # this
0be0: 6d 61 79 20 6e 6f 74 20 62 65 20 74 72 75 65 20 may not be true
0bf0: 61 6e 79 20 6c 6f 6e 67 65 72 2e 20 49 66 20 61 any longer. If a
0c00: 20 4e 54 44 42 20 77 61 73 20 65 78 63 6c 75 64 NTDB was exclud
0c10: 65 64 0a 09 20 20 20 20 23 20 74 68 65 6e 20 61 ed.. # then a
0c20: 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 69 74 20 ll revisions it
0c30: 73 68 61 72 65 64 20 77 69 74 68 20 74 68 65 20 shared with the
0c40: 74 72 75 6e 6b 20 77 65 72 65 20 6d 6f 76 65 64 trunk were moved
0c50: 0a 09 20 20 20 20 23 20 74 6f 20 74 68 65 20 74 .. # to the t
0c60: 72 75 6e 6b 20 4c 4f 44 2c 20 68 6f 77 65 76 65 runk LOD, howeve
0c70: 72 20 74 68 65 69 72 20 6d 65 74 61 20 65 6e 74 r their meta ent
0c80: 72 69 65 73 20 77 69 6c 6c 20 73 74 69 6c 6c 0a ries will still.
0c90: 09 20 20 20 20 23 20 72 65 66 65 72 20 74 6f 20 . # refer to
0ca0: 74 68 65 20 6e 6f 77 20 67 6f 6e 65 20 4c 4f 44 the now gone LOD
0cb0: 20 73 79 6d 62 6f 6c 2e 20 54 68 69 73 20 69 73 symbol. This is
0cc0: 20 66 69 6e 65 20 68 6f 77 65 76 65 72 2c 0a 09 fine however,..
0cd0: 20 20 20 20 23 20 69 74 20 77 69 6c 6c 20 6e 6f # it will no
0ce0: 74 20 61 66 66 65 63 74 20 6f 75 72 20 61 62 69 t affect our abi
0cf0: 6c 69 74 79 20 74 6f 20 75 73 65 20 74 68 65 20 lity to use the
0d00: 6d 65 74 61 20 65 6e 74 72 69 65 73 0a 09 20 20 meta entries..
0d10: 20 20 23 20 74 6f 20 64 69 73 74 69 6e 67 75 69 # to distingui
0d20: 73 68 20 61 6e 64 20 67 72 6f 75 70 20 72 65 76 sh and group rev
0d30: 69 73 69 6f 6e 73 20 69 6e 74 6f 20 63 68 61 6e isions into chan
0d40: 67 65 73 65 74 73 2e 20 49 74 0a 09 20 20 20 20 gesets. It..
0d50: 23 20 73 68 6f 75 6c 64 20 62 65 20 6e 6f 74 65 # should be note
0d60: 64 20 74 68 61 74 20 77 65 20 63 61 6e 6e 6f 74 d that we cannot
0d70: 20 73 69 6d 70 6c 79 20 73 77 69 74 63 68 20 74 simply switch t
0d80: 68 65 20 6d 65 74 61 0a 09 20 20 20 20 23 20 65 he meta.. # e
0d90: 6e 74 72 69 65 73 20 6f 76 65 72 20 74 6f 20 74 ntries over to t
0da0: 68 65 20 74 72 75 6e 6b 20 65 69 74 68 65 72 2c he trunk either,
0db0: 20 61 73 20 74 68 61 74 20 6d 61 79 20 63 61 75 as that may cau
0dc0: 73 65 20 74 68 65 0a 09 20 20 20 20 23 20 6d 6f se the.. # mo
0dd0: 64 69 66 69 65 64 20 65 6e 74 72 69 65 73 20 74 dified entries t
0de0: 6f 20 76 69 6f 6c 61 74 65 20 74 68 65 20 75 6e o violate the un
0df0: 69 71 75 65 2d 6e 65 73 73 20 63 6f 6e 73 74 72 ique-ness constr
0e00: 61 69 6e 0a 09 20 20 20 20 23 20 73 65 74 20 6f ain.. # set o
0e10: 6e 20 74 68 61 74 20 74 61 62 6c 65 2e 0a 09 20 n that table...
0e20: 20 20 20 69 6e 74 65 67 72 69 74 79 20 6d 65 74 integrity met
0e30: 61 72 65 6c 61 78 65 64 0a 09 7d 0a 0a 09 6c 6f arelaxed..}...lo
0e40: 67 20 77 72 69 74 65 20 31 20 66 69 6c 74 65 72 g write 1 filter
0e50: 73 79 6d 20 22 46 69 6c 74 65 72 69 6e 67 20 63 sym "Filtering c
0e60: 6f 6d 70 6c 65 74 65 64 22 0a 09 72 65 74 75 72 ompleted"..retur
0e70: 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 74 79 70 n. }.. typ
0e80: 65 6d 65 74 68 6f 64 20 64 69 73 63 61 72 64 20 emethod discard
0e90: 7b 7d 20 7b 0a 09 23 20 50 61 73 73 20 6d 61 6e {} {..# Pass man
0ea0: 61 67 65 72 20 69 6e 74 65 72 66 61 63 65 2e 20 ager interface.
0eb0: 45 78 65 63 75 74 65 64 20 66 6f 72 20 61 6c 6c Executed for all
0ec0: 20 70 61 73 73 65 73 20 61 66 74 65 72 20 74 68 passes after th
0ed0: 65 0a 09 23 20 72 75 6e 20 70 61 73 73 65 73 2c e..# run passes,
0ee0: 20 74 6f 20 72 65 6d 6f 76 65 20 61 6c 6c 20 64 to remove all d
0ef0: 61 74 61 20 6f 66 20 74 68 69 73 20 70 61 73 73 ata of this pass
0f00: 20 66 72 6f 6d 20 74 68 65 20 73 74 61 74 65 2c from the state,
0f10: 0a 09 23 20 61 73 20 62 65 69 6e 67 20 6f 75 74 ..# as being out
0f20: 20 6f 66 20 64 61 74 65 2e 0a 09 72 65 74 75 72 of date...retur
0f30: 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 23 20 23 n. }.. # #
0f40: 20 23 23 20 23 23 23 20 23 23 23 23 23 20 23 23 ## ### ##### ##
0f50: 23 23 23 23 23 23 20 23 23 23 23 23 23 23 23 23 ###### #########
0f60: 23 23 23 23 0a 20 20 20 20 23 23 20 49 6e 74 65 ####. ## Inte
0f70: 72 6e 61 6c 20 6d 65 74 68 6f 64 73 0a 0a 20 20 rnal methods..
0f80: 20 20 70 72 6f 63 20 46 69 6c 74 65 72 45 78 63 proc FilterExc
0f90: 6c 75 64 65 64 53 79 6d 62 6f 6c 73 20 7b 7d 20 ludedSymbols {}
0fa0: 7b 0a 09 6c 6f 67 20 77 72 69 74 65 20 33 20 66 {..log write 3 f
0fb0: 69 6c 74 65 72 73 79 6d 20 22 52 65 6d 6f 76 65 iltersym "Remove
0fc0: 20 74 68 65 20 65 78 63 6c 75 64 65 64 20 73 79 the excluded sy
0fd0: 6d 62 6f 6c 73 20 61 6e 64 20 74 68 65 69 72 20 mbols and their
0fe0: 75 73 65 72 73 22 0a 0a 09 23 20 57 65 20 70 75 users"...# We pu
0ff0: 6c 6c 20 61 6c 6c 20 74 68 65 20 65 78 63 6c 75 ll all the exclu
1000: 64 65 64 20 73 79 6d 62 6f 6c 73 20 74 6f 67 65 ded symbols toge
1010: 74 68 65 72 20 69 6e 74 6f 20 61 20 74 61 62 6c ther into a tabl
1020: 65 20 66 6f 72 0a 09 23 20 65 61 73 79 20 72 65 e for..# easy re
1030: 66 65 72 65 6e 63 65 20 62 79 20 74 68 65 20 75 ference by the u
1040: 70 63 6f 6d 69 6e 67 20 44 45 4c 45 54 45 20 61 pcoming DELETE a
1050: 6e 64 20 6f 74 68 65 72 20 73 74 61 74 65 6d 65 nd other stateme
1060: 6e 74 73 2e 0a 09 23 20 28 27 78 20 49 4e 20 74 nts...# ('x IN t
1070: 61 62 6c 65 27 20 63 6c 61 75 73 65 73 29 2e 0a able' clauses)..
1080: 0a 09 73 65 74 20 65 78 63 6c 20 5b 70 72 6f 6a ..set excl [proj
1090: 65 63 74 3a 3a 73 79 6d 20 65 78 63 6c 75 64 65 ect::sym exclude
10a0: 64 5d 0a 0a 09 73 74 61 74 65 20 72 75 6e 20 7b d]...state run {
10b0: 0a 09 20 20 20 20 43 52 45 41 54 45 20 54 45 4d .. CREATE TEM
10c0: 50 4f 52 41 52 59 20 54 41 42 4c 45 20 65 78 63 PORARY TABLE exc
10d0: 6c 75 64 65 64 73 79 6d 62 6f 6c 73 20 41 53 0a ludedsymbols AS.
10e0: 09 20 20 20 20 53 45 4c 45 43 54 20 73 69 64 0a . SELECT sid.
10f0: 09 20 20 20 20 46 52 4f 4d 20 20 20 73 79 6d 62 . FROM symb
1100: 6f 6c 0a 09 20 20 20 20 57 48 45 52 45 20 20 74 ol.. WHERE t
1110: 79 70 65 20 3d 20 24 65 78 63 6c 0a 09 7d 0a 0a ype = $excl..}..
1120: 09 23 20 46 69 72 73 74 20 77 65 20 68 61 76 65 .# First we have
1130: 20 74 6f 20 68 61 6e 64 6c 65 20 74 68 65 20 70 to handle the p
1140: 6f 73 73 69 62 69 6c 69 74 79 20 6f 66 20 61 6e ossibility of an
1150: 20 65 78 63 6c 75 64 65 64 0a 09 23 20 4e 54 44 excluded..# NTD
1160: 42 2e 20 54 68 69 73 20 69 73 20 61 20 73 70 65 B. This is a spe
1170: 63 69 61 6c 20 73 70 65 63 69 61 6c 20 63 61 73 cial special cas
1180: 65 20 74 68 65 72 65 20 77 65 20 68 61 76 65 20 e there we have
1190: 74 6f 0a 09 23 20 72 65 67 72 61 66 74 20 74 68 to..# regraft th
11a0: 65 20 72 65 76 69 73 69 6f 6e 73 20 77 68 69 63 e revisions whic
11b0: 68 20 61 72 65 20 73 68 61 72 65 64 20 62 65 74 h are shared bet
11c0: 77 65 65 6e 20 74 68 65 20 4e 54 44 42 20 61 6e ween the NTDB an
11d0: 64 0a 09 23 20 54 72 75 6e 6b 20 6f 6e 74 6f 20 d..# Trunk onto
11e0: 74 68 65 20 74 72 75 6e 6b 2c 20 70 72 65 76 65 the trunk, preve
11f0: 6e 74 69 6e 67 20 74 68 65 69 72 20 64 65 6c 65 nting their dele
1200: 74 69 6f 6e 20 6c 61 74 65 72 2e 20 57 65 0a 09 tion later. We..
1210: 23 20 68 61 76 65 20 63 6f 64 65 20 66 6f 72 20 # have code for
1220: 74 68 61 74 20 69 6e 20 27 66 69 6c 65 27 2c 20 that in 'file',
1230: 68 6f 77 65 76 65 72 20 74 68 61 74 20 6f 70 65 however that ope
1240: 72 61 74 65 64 20 6f 6e 20 74 68 65 0a 09 23 20 rated on the..#
1250: 69 6e 2d 6d 65 6d 6f 72 79 20 72 65 76 69 73 69 in-memory revisi
1260: 6f 6e 20 6f 62 6a 65 63 74 73 2c 20 77 68 69 63 on objects, whic
1270: 68 20 77 65 20 64 6f 20 6e 6f 74 20 68 61 76 65 h we do not have
1280: 20 68 65 72 65 2e 20 57 65 20 64 6f 0a 09 23 20 here. We do..#
1290: 74 68 65 20 73 61 6d 65 20 6e 6f 77 20 77 69 74 the same now wit
12a0: 68 6f 75 74 20 6f 62 6a 65 63 74 2c 20 62 79 20 hout object, by
12b0: 64 69 72 65 63 74 6c 79 20 6d 61 6e 69 70 75 6c directly manipul
12c0: 61 74 69 6e 67 20 74 68 65 0a 09 23 20 6c 69 6e ating the..# lin
12d0: 6b 73 20 69 6e 20 74 68 65 20 64 61 74 61 62 61 ks in the databa
12e0: 73 65 2e 0a 0a 09 61 72 72 61 79 20 73 65 74 20 se....array set
12f0: 6e 74 64 62 20 7b 7d 0a 09 61 72 72 61 79 20 73 ntdb {}..array s
1300: 65 74 20 6c 69 6e 6b 20 7b 7d 0a 0a 09 66 6f 72 et link {}...for
1310: 65 61 63 68 20 7b 69 64 20 70 61 72 65 6e 74 20 each {id parent
1320: 74 72 61 6e 73 66 65 72 7d 20 5b 73 74 61 74 65 transfer} [state
1330: 20 72 75 6e 20 7b 0a 09 20 20 20 20 53 45 4c 45 run {.. SELE
1340: 43 54 20 52 2e 72 69 64 2c 20 52 2e 70 61 72 65 CT R.rid, R.pare
1350: 6e 74 2c 20 52 2e 64 62 63 68 69 6c 64 0a 09 20 nt, R.dbchild..
1360: 20 20 20 46 52 4f 4d 20 20 72 65 76 69 73 69 6f FROM revisio
1370: 6e 20 52 2c 20 73 79 6d 62 6f 6c 20 53 0a 09 20 n R, symbol S..
1380: 20 20 20 57 48 45 52 45 20 52 2e 6c 6f 64 20 3d WHERE R.lod =
1390: 20 53 2e 73 69 64 0a 09 20 20 20 20 41 4e 44 20 S.sid.. AND
13a0: 20 20 53 2e 73 69 64 20 49 4e 20 65 78 63 6c 75 S.sid IN exclu
13b0: 64 65 64 73 79 6d 62 6f 6c 73 0a 09 20 20 20 20 dedsymbols..
13c0: 41 4e 44 20 20 20 52 2e 69 73 64 65 66 61 75 6c AND R.isdefaul
13d0: 74 0a 09 7d 5d 20 7b 0a 09 20 20 20 20 73 65 74 t..}] {.. set
13e0: 20 6e 74 64 62 28 24 69 64 29 20 24 70 61 72 65 ntdb($id) $pare
13f0: 6e 74 0a 09 20 20 20 20 69 66 20 7b 24 74 72 61 nt.. if {$tra
1400: 6e 73 66 65 72 20 65 71 20 22 22 7d 20 63 6f 6e nsfer eq ""} con
1410: 74 69 6e 75 65 0a 09 20 20 20 20 73 65 74 20 6c tinue.. set l
1420: 69 6e 6b 28 24 69 64 29 20 24 74 72 61 6e 73 66 ink($id) $transf
1430: 65 72 0a 09 7d 0a 0a 09 66 6f 72 65 61 63 68 20 er..}...foreach
1440: 6a 6f 69 6e 74 20 5b 61 72 72 61 79 20 6e 61 6d joint [array nam
1450: 65 73 20 6c 69 6e 6b 5d 20 7b 0a 09 20 20 20 20 es link] {..
1460: 23 20 54 68 65 20 6a 6f 69 6e 74 73 20 61 72 65 # The joints are
1470: 20 74 68 65 20 68 69 67 68 65 73 74 20 4e 54 44 the highest NTD
1480: 42 20 72 65 76 69 73 69 6f 6e 73 20 77 68 69 63 B revisions whic
1490: 68 20 61 72 65 0a 09 20 20 20 20 23 20 73 68 61 h are.. # sha
14a0: 72 65 64 20 77 69 74 68 20 74 68 65 69 72 20 72 red with their r
14b0: 65 73 70 65 63 74 69 76 65 20 74 72 75 6e 6b 2e espective trunk.
14c0: 20 57 65 20 64 69 73 63 6f 6e 6e 65 63 74 20 66 We disconnect f
14d0: 72 6f 6d 0a 09 20 20 20 20 23 20 74 68 65 69 72 rom.. # their
14e0: 20 4e 54 44 42 20 63 68 69 6c 64 72 65 6e 2c 20 NTDB children,
14f0: 61 6e 64 20 6d 61 6b 65 20 74 68 65 6d 20 70 61 and make them pa
1500: 72 65 6e 74 73 20 6f 66 20 74 68 65 69 72 0a 09 rents of their..
1510: 20 20 20 20 23 20 27 64 62 63 68 69 6c 64 27 2e # 'dbchild'.
1520: 20 54 68 65 20 61 73 73 6f 63 69 61 74 65 64 20 The associated
1530: 27 64 62 70 61 72 65 6e 74 27 20 69 73 20 73 71 'dbparent' is sq
1540: 75 61 73 68 65 64 0a 09 20 20 20 20 23 20 69 6e uashed.. # in
1550: 73 74 65 61 64 2e 20 41 6c 6c 20 70 61 72 65 6e stead. All paren
1560: 74 73 20 6f 66 20 74 68 65 20 6a 6f 69 6e 74 73 ts of the joints
1570: 20 61 72 65 20 6d 6f 76 65 64 20 74 6f 20 74 68 are moved to th
1580: 65 0a 09 20 20 20 20 23 20 74 72 75 6e 6b 20 61 e.. # trunk a
1590: 73 20 77 65 6c 6c 2e 0a 0a 09 20 20 20 20 73 65 s well.... se
15a0: 74 20 74 6a 6f 69 6e 74 20 24 6c 69 6e 6b 28 24 t tjoint $link($
15b0: 6a 6f 69 6e 74 29 0a 09 20 20 20 20 73 65 74 20 joint).. set
15c0: 74 6c 6f 64 20 5b 73 74 61 74 65 20 6f 6e 65 20 tlod [state one
15d0: 7b 0a 09 09 53 45 4c 45 43 54 20 6c 6f 64 20 46 {...SELECT lod F
15e0: 52 4f 4d 20 72 65 76 69 73 69 6f 6e 20 57 48 45 ROM revision WHE
15f0: 52 45 20 72 69 64 20 3d 20 24 74 6a 6f 69 6e 74 RE rid = $tjoint
1600: 0a 09 20 20 20 20 7d 5d 0a 0a 09 20 20 20 20 23 .. }]... #
1610: 20 43 6f 76 6e 65 72 74 20 64 62 2f 70 61 72 65 Covnert db/pare
1620: 6e 74 2f 63 68 69 6c 64 20 69 6e 74 6f 20 72 65 nt/child into re
1630: 67 75 6c 61 72 20 70 61 72 65 6e 74 2f 63 68 69 gular parent/chi
1640: 6c 64 20 6c 69 6e 6b 73 2e 0a 09 20 20 20 20 73 ld links... s
1650: 74 61 74 65 20 72 75 6e 20 7b 0a 09 09 55 50 44 tate run {...UPD
1660: 41 54 45 20 72 65 76 69 73 69 6f 6e 20 53 45 54 ATE revision SET
1670: 20 64 62 70 61 72 65 6e 74 20 3d 20 4e 55 4c 4c dbparent = NULL
1680: 2c 20 70 61 72 65 6e 74 20 3d 20 24 6a 6f 69 6e , parent = $join
1690: 74 20 20 57 48 45 52 45 20 72 69 64 20 3d 20 24 t WHERE rid = $
16a0: 74 6a 6f 69 6e 74 20 3b 0a 09 09 55 50 44 41 54 tjoint ;...UPDAT
16b0: 45 20 72 65 76 69 73 69 6f 6e 20 53 45 54 20 64 E revision SET d
16c0: 62 63 68 69 6c 64 20 20 3d 20 4e 55 4c 4c 2c 20 bchild = NULL,
16d0: 63 68 69 6c 64 20 20 3d 20 24 74 6a 6f 69 6e 74 child = $tjoint
16e0: 20 57 48 45 52 45 20 72 69 64 20 3d 20 24 6a 6f WHERE rid = $jo
16f0: 69 6e 74 20 20 3b 0a 09 20 20 20 20 7d 0a 09 20 int ;.. }..
1700: 20 20 20 77 68 69 6c 65 20 7b 31 7d 20 7b 0a 09 while {1} {..
1710: 09 23 20 4d 6f 76 65 20 74 68 65 20 4e 54 44 42 .# Move the NTDB
1720: 20 74 72 75 6e 6b 20 72 65 76 69 73 69 6f 6e 73 trunk revisions
1730: 20 74 6f 20 74 72 75 6e 6b 2e 0a 09 09 73 74 61 to trunk....sta
1740: 74 65 20 72 75 6e 20 7b 0a 09 09 20 20 20 20 55 te run {... U
1750: 50 44 41 54 45 20 72 65 76 69 73 69 6f 6e 20 53 PDATE revision S
1760: 45 54 20 6c 6f 64 20 3d 20 24 74 6c 6f 64 2c 20 ET lod = $tlod,
1770: 69 73 64 65 66 61 75 6c 74 20 3d 20 30 20 57 48 isdefault = 0 WH
1780: 45 52 45 20 72 69 64 20 3d 20 24 6a 6f 69 6e 74 ERE rid = $joint
1790: 0a 09 09 7d 0a 09 09 73 65 74 20 6c 61 73 74 20 ...}...set last
17a0: 24 6a 6f 69 6e 74 0a 09 09 73 65 74 20 6a 6f 69 $joint...set joi
17b0: 6e 74 20 24 6e 74 64 62 28 24 6a 6f 69 6e 74 29 nt $ntdb($joint)
17c0: 0a 09 09 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 ...if {![info ex
17d0: 69 73 74 73 20 6e 74 64 62 28 24 6a 6f 69 6e 74 ists ntdb($joint
17e0: 29 5d 7d 20 62 72 65 61 6b 0a 09 20 20 20 20 7d )]} break.. }
17f0: 0a 0a 09 20 20 20 20 23 20 52 65 61 63 68 65 64 ... # Reached
1800: 20 74 68 65 20 4e 54 44 42 20 62 61 73 69 73 20 the NTDB basis
1810: 69 6e 20 74 68 65 20 74 72 75 6e 6b 2e 20 46 69 in the trunk. Fi
1820: 6e 61 6c 69 7a 65 20 74 68 65 0a 09 20 20 20 20 nalize the..
1830: 23 20 70 61 72 65 6e 74 2f 63 68 69 6c 64 20 6c # parent/child l
1840: 69 6e 6b 61 67 65 20 61 6e 64 20 73 71 75 61 73 inkage and squas
1850: 68 20 74 68 65 20 62 72 61 6e 63 68 20 70 61 72 h the branch par
1860: 65 6e 74 20 73 79 6d 62 6f 6c 0a 09 20 20 20 20 ent symbol..
1870: 23 20 72 65 66 65 72 65 6e 63 65 2e 0a 0a 09 20 # reference....
1880: 20 20 20 73 74 61 74 65 20 72 75 6e 20 7b 0a 09 state run {..
1890: 09 55 50 44 41 54 45 20 72 65 76 69 73 69 6f 6e .UPDATE revision
18a0: 20 53 45 54 20 63 68 69 6c 64 20 20 20 3d 20 24 SET child = $
18b0: 6c 61 73 74 20 57 48 45 52 45 20 72 69 64 20 3d last WHERE rid =
18c0: 20 24 6a 6f 69 6e 74 20 3b 0a 09 09 55 50 44 41 $joint ;...UPDA
18d0: 54 45 20 72 65 76 69 73 69 6f 6e 20 53 45 54 20 TE revision SET
18e0: 62 70 61 72 65 6e 74 20 3d 20 4e 55 4c 4c 20 20 bparent = NULL
18f0: 57 48 45 52 45 20 72 69 64 20 3d 20 24 6c 61 73 WHERE rid = $las
1900: 74 20 20 3b 0a 09 20 20 20 20 7d 0a 09 7d 0a 0a t ;.. }..}..
1910: 09 23 20 4e 6f 77 20 74 68 61 74 20 74 68 65 20 .# Now that the
1920: 73 70 65 63 69 61 6c 20 63 61 73 65 20 69 73 20 special case is
1930: 64 6f 6e 65 20 77 65 20 63 61 6e 20 73 69 6d 70 done we can simp
1940: 6c 79 20 6b 69 6c 6c 20 61 6c 6c 20 74 68 65 0a ly kill all the.
1950: 09 23 20 72 65 76 69 73 69 6f 6e 73 2c 20 74 61 .# revisions, ta
1960: 67 73 2c 20 61 6e 64 20 62 72 61 6e 63 68 65 73 gs, and branches
1970: 20 72 65 66 65 72 65 6e 63 69 6e 67 20 61 6e 79 referencing any
1980: 20 6f 66 20 74 68 65 0a 09 23 20 65 78 63 6c 75 of the..# exclu
1990: 64 65 64 20 73 79 6d 62 6f 6c 73 20 69 6e 20 73 ded symbols in s
19a0: 6f 6d 65 20 77 61 79 2e 20 54 68 69 73 20 69 73 ome way. This is
19b0: 20 65 61 73 79 20 61 73 20 77 65 20 64 6f 20 6e easy as we do n
19c0: 6f 74 20 68 61 76 65 0a 09 23 20 74 6f 20 73 65 ot have..# to se
19d0: 6c 65 63 74 20 74 68 65 6d 20 61 67 61 69 6e 20 lect them again
19e0: 61 6e 64 20 61 67 61 69 6e 20 66 72 6f 6d 20 74 and again from t
19f0: 68 65 20 62 61 73 65 20 74 61 62 6c 65 73 20 61 he base tables a
1a00: 6e 79 0a 09 23 20 6c 6f 6e 67 65 72 2e 0a 0a 09 ny..# longer....
1a10: 73 74 61 74 65 20 72 75 6e 20 7b 0a 09 20 20 20 state run {..
1a20: 20 43 52 45 41 54 45 20 54 45 4d 50 4f 52 41 52 CREATE TEMPORAR
1a30: 59 20 54 41 42 4c 45 20 65 78 63 6c 75 64 65 64 Y TABLE excluded
1a40: 72 65 76 69 73 69 6f 6e 73 20 41 53 0a 09 20 20 revisions AS..
1a50: 20 20 53 45 4c 45 43 54 20 72 69 64 20 46 52 4f SELECT rid FRO
1a60: 4d 20 72 65 76 69 73 69 6f 6e 20 57 48 45 52 45 M revision WHERE
1a70: 20 6c 6f 64 20 49 4e 20 65 78 63 6c 75 64 65 64 lod IN excluded
1a80: 73 79 6d 62 6f 6c 73 3b 0a 0a 09 20 20 20 20 44 symbols;... D
1a90: 45 4c 45 54 45 20 46 52 4f 4d 20 72 65 76 69 73 ELETE FROM revis
1aa0: 69 6f 6e 20 57 48 45 52 45 20 6c 6f 64 20 49 4e ion WHERE lod IN
1ab0: 20 65 78 63 6c 75 64 65 64 73 79 6d 62 6f 6c 73 excludedsymbols
1ac0: 3b 0a 09 20 20 20 20 44 45 4c 45 54 45 20 46 52 ;.. DELETE FR
1ad0: 4f 4d 20 74 61 67 20 20 20 20 20 20 57 48 45 52 OM tag WHER
1ae0: 45 20 6c 6f 64 20 49 4e 20 65 78 63 6c 75 64 65 E lod IN exclude
1af0: 64 73 79 6d 62 6f 6c 73 3b 0a 09 20 20 20 20 44 dsymbols;.. D
1b00: 45 4c 45 54 45 20 46 52 4f 4d 20 74 61 67 20 20 ELETE FROM tag
1b10: 20 20 20 20 57 48 45 52 45 20 73 69 64 20 49 4e WHERE sid IN
1b20: 20 65 78 63 6c 75 64 65 64 73 79 6d 62 6f 6c 73 excludedsymbols
1b30: 3b 0a 09 20 20 20 20 44 45 4c 45 54 45 20 46 52 ;.. DELETE FR
1b40: 4f 4d 20 62 72 61 6e 63 68 20 20 20 57 48 45 52 OM branch WHER
1b50: 45 20 6c 6f 64 20 49 4e 20 65 78 63 6c 75 64 65 E lod IN exclude
1b60: 64 73 79 6d 62 6f 6c 73 3b 0a 09 20 20 20 20 44 dsymbols;.. D
1b70: 45 4c 45 54 45 20 46 52 4f 4d 20 62 72 61 6e 63 ELETE FROM branc
1b80: 68 20 20 20 57 48 45 52 45 20 73 69 64 20 49 4e h WHERE sid IN
1b90: 20 65 78 63 6c 75 64 65 64 73 79 6d 62 6f 6c 73 excludedsymbols
1ba0: 3b 0a 0a 09 20 20 20 20 44 45 4c 45 54 45 20 46 ;... DELETE F
1bb0: 52 4f 4d 20 72 65 76 69 73 69 6f 6e 62 72 61 6e ROM revisionbran
1bc0: 63 68 63 68 69 6c 64 72 65 6e 20 57 48 45 52 45 chchildren WHERE
1bd0: 20 72 69 64 20 20 49 4e 20 65 78 63 6c 75 64 65 rid IN exclude
1be0: 64 72 65 76 69 73 69 6f 6e 73 3b 0a 09 20 20 20 drevisions;..
1bf0: 20 44 45 4c 45 54 45 20 46 52 4f 4d 20 72 65 76 DELETE FROM rev
1c00: 69 73 69 6f 6e 62 72 61 6e 63 68 63 68 69 6c 64 isionbranchchild
1c10: 72 65 6e 20 57 48 45 52 45 20 62 72 69 64 20 49 ren WHERE brid I
1c20: 4e 20 65 78 63 6c 75 64 65 64 72 65 76 69 73 69 N excludedrevisi
1c30: 6f 6e 73 3b 0a 0a 09 20 20 20 20 44 52 4f 50 20 ons;... DROP
1c40: 54 41 42 4c 45 20 65 78 63 6c 75 64 65 64 72 65 TABLE excludedre
1c50: 76 69 73 69 6f 6e 73 3b 0a 09 20 20 20 20 44 52 visions;.. DR
1c60: 4f 50 20 54 41 42 4c 45 20 65 78 63 6c 75 64 65 OP TABLE exclude
1c70: 64 73 79 6d 62 6f 6c 73 3b 0a 09 7d 0a 09 72 65 dsymbols;..}..re
1c80: 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 turn. }..
1c90: 70 72 6f 63 20 4d 75 74 61 74 65 53 79 6d 62 6f proc MutateSymbo
1ca0: 6c 73 20 7b 7d 20 7b 0a 09 23 20 4e 65 78 74 2c ls {} {..# Next,
1cb0: 20 6e 6f 77 20 74 68 61 74 20 77 65 20 6b 6e 6f now that we kno
1cc0: 77 20 77 68 69 63 68 20 73 79 6d 62 6f 6c 73 20 w which symbols
1cd0: 61 72 65 20 77 68 61 74 20 77 65 20 6c 6f 6f 6b are what we look
1ce0: 20 66 6f 72 0a 09 23 20 66 69 6c 65 20 6c 65 76 for..# file lev
1cf0: 65 6c 20 74 61 67 73 20 77 68 69 63 68 20 61 72 el tags which ar
1d00: 65 20 61 63 74 75 61 6c 6c 79 20 63 6f 6e 76 65 e actually conve
1d10: 72 74 65 64 20 61 73 20 62 72 61 6e 63 68 65 73 rted as branches
1d20: 0a 09 23 20 28 70 72 6f 6a 65 63 74 20 6c 65 76 ..# (project lev
1d30: 65 6c 2c 20 61 6e 64 20 76 69 63 65 20 76 65 72 el, and vice ver
1d40: 73 61 29 2c 20 61 6e 64 20 6d 6f 76 65 20 74 68 sa), and move th
1d50: 65 6d 20 74 6f 20 74 68 65 0a 09 23 20 63 6f 72 em to the..# cor
1d60: 72 65 63 74 20 74 61 62 6c 65 73 2e 0a 0a 09 23 rect tables....#
1d70: 20 23 20 23 23 20 23 23 23 20 23 23 23 23 23 20 # ## ### #####
1d80: 23 23 23 23 23 23 23 23 20 23 23 23 23 23 23 23 ######## #######
1d90: 23 23 23 23 23 23 0a 0a 09 6c 6f 67 20 77 72 69 ######...log wri
1da0: 74 65 20 33 20 66 69 6c 74 65 72 73 79 6d 20 22 te 3 filtersym "
1db0: 4d 75 74 61 74 65 20 73 79 6d 62 6f 6c 73 2c 20 Mutate symbols,
1dc0: 70 72 65 70 61 72 61 74 69 6f 6e 22 0a 0a 09 73 preparation"...s
1dd0: 65 74 20 62 72 61 6e 63 68 20 5b 70 72 6f 6a 65 et branch [proje
1de0: 63 74 3a 3a 73 79 6d 20 62 72 61 6e 63 68 5d 0a ct::sym branch].
1df0: 09 73 65 74 20 74 61 67 20 20 20 20 5b 70 72 6f .set tag [pro
1e00: 6a 65 63 74 3a 3a 73 79 6d 20 74 61 67 5d 0a 0a ject::sym tag]..
1e10: 09 73 65 74 20 74 61 67 73 74 6f 6d 75 74 61 74 .set tagstomutat
1e20: 65 20 5b 73 74 61 74 65 20 72 75 6e 20 7b 0a 09 e [state run {..
1e30: 20 20 20 20 53 45 4c 45 43 54 20 54 2e 74 69 64 SELECT T.tid
1e40: 2c 20 54 2e 66 69 64 2c 20 54 2e 6c 6f 64 2c 20 , T.fid, T.lod,
1e50: 54 2e 73 69 64 2c 20 54 2e 72 65 76 0a 09 20 20 T.sid, T.rev..
1e60: 20 20 46 52 4f 4d 20 74 61 67 20 54 2c 20 73 79 FROM tag T, sy
1e70: 6d 62 6f 6c 20 53 0a 09 20 20 20 20 57 48 45 52 mbol S.. WHER
1e80: 45 20 54 2e 73 69 64 20 3d 20 53 2e 73 69 64 0a E T.sid = S.sid.
1e90: 09 20 20 20 20 41 4e 44 20 53 2e 74 79 70 65 20 . AND S.type
1ea0: 3d 20 24 62 72 61 6e 63 68 0a 09 7d 5d 0a 0a 09 = $branch..}]...
1eb0: 73 65 74 20 62 72 61 6e 63 68 65 73 74 6f 6d 75 set branchestomu
1ec0: 74 61 74 65 20 5b 73 74 61 74 65 20 72 75 6e 20 tate [state run
1ed0: 7b 0a 09 20 20 20 20 53 45 4c 45 43 54 20 42 2e {.. SELECT B.
1ee0: 62 69 64 2c 20 42 2e 66 69 64 2c 20 42 2e 6c 6f bid, B.fid, B.lo
1ef0: 64 2c 20 42 2e 73 69 64 2c 20 42 2e 72 6f 6f 74 d, B.sid, B.root
1f00: 2c 20 42 2e 66 69 72 73 74 2c 20 42 2e 62 72 61 , B.first, B.bra
1f10: 0a 09 20 20 20 20 46 52 4f 4d 20 62 72 61 6e 63 .. FROM branc
1f20: 68 20 42 2c 20 73 79 6d 62 6f 6c 20 53 0a 09 20 h B, symbol S..
1f30: 20 20 20 57 48 45 52 45 20 42 2e 73 69 64 20 3d WHERE B.sid =
1f40: 20 53 2e 73 69 64 0a 09 20 20 20 20 41 4e 44 20 S.sid.. AND
1f50: 53 2e 74 79 70 65 20 3d 20 24 74 61 67 0a 09 7d S.type = $tag..}
1f60: 5d 0a 0a 09 73 65 74 20 6e 74 20 5b 65 78 70 72 ]...set nt [expr
1f70: 20 7b 5b 6c 6c 65 6e 67 74 68 20 24 74 61 67 73 {[llength $tags
1f80: 74 6f 6d 75 74 61 74 65 5d 2f 35 7d 5d 0a 09 73 tomutate]/5}]..s
1f90: 65 74 20 6e 62 20 5b 65 78 70 72 20 7b 5b 6c 6c et nb [expr {[ll
1fa0: 65 6e 67 74 68 20 24 62 72 61 6e 63 68 65 73 74 ength $branchest
1fb0: 6f 6d 75 74 61 74 65 5d 2f 37 7d 5d 0a 0a 09 6c omutate]/7}]...l
1fc0: 6f 67 20 77 72 69 74 65 20 34 20 66 69 6c 74 65 og write 4 filte
1fd0: 72 73 79 6d 20 22 43 68 61 6e 67 69 6e 67 20 5b rsym "Changing [
1fe0: 6e 73 70 20 24 6e 74 20 74 61 67 5d 20 69 6e 74 nsp $nt tag] int
1ff0: 6f 20 20 5b 6e 73 70 20 24 6e 74 20 62 72 61 6e o [nsp $nt bran
2000: 63 68 20 62 72 61 6e 63 68 65 73 5d 22 0a 09 6c ch branches]"..l
2010: 6f 67 20 77 72 69 74 65 20 34 20 66 69 6c 74 65 og write 4 filte
2020: 72 73 79 6d 20 22 43 68 61 6e 67 69 6e 67 20 5b rsym "Changing [
2030: 6e 73 70 20 24 6e 62 20 62 72 61 6e 63 68 20 62 nsp $nb branch b
2040: 72 61 6e 63 68 65 73 5d 20 69 6e 74 6f 20 20 5b ranches] into [
2050: 6e 73 70 20 24 6e 62 20 74 61 67 5d 22 0a 0a 09 nsp $nb tag]"...
2060: 23 20 23 20 23 23 20 23 23 23 20 23 23 23 23 23 # # ## ### #####
2070: 20 23 23 23 23 23 23 23 23 20 23 23 23 23 23 23 ######## ######
2080: 23 23 23 23 23 23 23 0a 0a 09 6c 6f 67 20 77 72 #######...log wr
2090: 69 74 65 20 33 20 66 69 6c 74 65 72 73 79 6d 20 ite 3 filtersym
20a0: 22 4d 75 74 61 74 65 20 74 61 67 73 20 74 6f 20 "Mutate tags to
20b0: 62 72 61 6e 63 68 65 73 22 0a 0a 09 66 6f 72 65 branches"...fore
20c0: 61 63 68 20 7b 69 64 20 66 69 64 20 6c 6f 64 20 ach {id fid lod
20d0: 73 69 64 20 72 65 76 7d 20 24 74 61 67 73 74 6f sid rev} $tagsto
20e0: 6d 75 74 61 74 65 20 7b 0a 09 20 20 20 20 73 74 mutate {.. st
20f0: 61 74 65 20 72 75 6e 20 7b 0a 09 09 44 45 4c 45 ate run {...DELE
2100: 54 45 20 46 52 4f 4d 20 74 61 67 20 57 48 45 52 TE FROM tag WHER
2110: 45 20 74 69 64 20 3d 20 24 69 64 20 3b 0a 09 09 E tid = $id ;...
2120: 49 4e 53 45 52 54 20 49 4e 54 4f 20 62 72 61 6e INSERT INTO bran
2130: 63 68 20 28 62 69 64 2c 20 66 69 64 2c 20 20 6c ch (bid, fid, l
2140: 6f 64 2c 20 20 73 69 64 2c 20 20 72 6f 6f 74 2c od, sid, root,
2150: 20 66 69 72 73 74 2c 20 62 72 61 2c 20 70 6f 73 first, bra, pos
2160: 29 0a 09 09 56 41 4c 55 45 53 20 20 20 20 20 20 )...VALUES
2170: 20 20 20 20 20 20 20 28 24 69 64 2c 20 24 66 69 ($id, $fi
2180: 64 2c 20 24 6c 6f 64 2c 20 24 73 69 64 2c 20 24 d, $lod, $sid, $
2190: 72 65 76 2c 20 4e 55 4c 4c 2c 20 20 27 27 2c 20 rev, NULL, '',
21a0: 20 2d 31 29 3b 0a 09 20 20 20 20 7d 0a 09 7d 0a -1);.. }..}.
21b0: 0a 09 6c 6f 67 20 77 72 69 74 65 20 33 20 66 69 ..log write 3 fi
21c0: 6c 74 65 72 73 79 6d 20 22 4f 6b 2e 22 0a 0a 09 ltersym "Ok."...
21d0: 23 20 23 20 23 23 20 23 23 23 20 23 23 23 23 23 # # ## ### #####
21e0: 20 23 23 23 23 23 23 23 23 20 23 23 23 23 23 23 ######## ######
21f0: 23 23 23 23 23 23 23 0a 0a 09 6c 6f 67 20 77 72 #######...log wr
2200: 69 74 65 20 33 20 66 69 6c 74 65 72 73 79 6d 20 ite 3 filtersym
2210: 22 4d 75 74 61 74 65 20 62 72 61 6e 63 68 65 73 "Mutate branches
2220: 20 74 6f 20 74 61 67 73 22 0a 0a 09 66 6f 72 65 to tags"...fore
2230: 61 63 68 20 7b 69 64 20 66 69 64 20 6c 6f 64 20 ach {id fid lod
2240: 73 69 64 20 72 6f 6f 74 20 66 69 72 73 74 20 62 sid root first b
2250: 72 61 7d 20 24 62 72 61 6e 63 68 65 73 74 6f 6d ra} $branchestom
2260: 75 74 61 74 65 20 7b 0a 09 20 20 20 20 73 74 61 utate {.. sta
2270: 74 65 20 72 75 6e 20 7b 0a 09 09 44 45 4c 45 54 te run {...DELET
2280: 45 20 46 52 4f 4d 20 62 72 61 6e 63 68 20 57 48 E FROM branch WH
2290: 45 52 45 20 62 69 64 20 3d 20 24 69 64 20 3b 0a ERE bid = $id ;.
22a0: 09 09 49 4e 53 45 52 54 20 49 4e 54 4f 20 74 61 ..INSERT INTO ta
22b0: 67 20 28 74 69 64 2c 20 66 69 64 2c 20 20 6c 6f g (tid, fid, lo
22c0: 64 2c 20 20 73 69 64 2c 20 20 72 65 76 29 0a 09 d, sid, rev)..
22d0: 09 56 41 4c 55 45 53 20 20 20 20 20 20 20 20 20 .VALUES
22e0: 20 28 24 69 64 2c 20 24 66 69 64 2c 20 24 6c 6f ($id, $fid, $lo
22f0: 64 2c 20 24 73 69 64 2c 20 24 72 6f 6f 74 29 3b d, $sid, $root);
2300: 0a 09 20 20 20 20 7d 0a 09 7d 0a 0a 09 6c 6f 67 .. }..}...log
2310: 20 77 72 69 74 65 20 33 20 66 69 6c 74 65 72 73 write 3 filters
2320: 79 6d 20 22 4f 6b 2e 22 0a 0a 09 23 20 23 20 23 ym "Ok."...# # #
2330: 23 20 23 23 23 20 23 23 23 23 23 20 23 23 23 23 # ### ##### ####
2340: 23 23 23 23 20 23 23 23 23 23 23 23 23 23 23 23 #### ###########
2350: 23 23 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 7d ##..return. }
2360: 0a 0a 20 20 20 20 23 20 41 64 6a 75 73 74 20 74 .. # Adjust t
2370: 68 65 20 70 61 72 65 6e 74 73 20 6f 66 20 73 79 he parents of sy
2380: 6d 62 6f 6c 73 20 74 6f 20 74 68 65 69 72 20 70 mbols to their p
2390: 72 65 66 65 72 72 65 64 20 70 61 72 65 6e 74 73 referred parents
23a0: 2e 0a 0a 20 20 20 20 23 20 49 66 20 61 20 66 69 ... # If a fi
23b0: 6c 65 20 6c 65 76 65 6c 20 79 6d 62 6f 6c 20 68 le level ymbol h
23c0: 61 73 20 61 20 70 72 65 66 65 72 72 65 64 20 70 as a preferred p
23d0: 61 72 65 6e 74 20 74 68 61 74 20 69 73 20 64 69 arent that is di
23e0: 66 66 65 72 65 6e 74 0a 20 20 20 20 23 20 74 68 fferent. # th
23f0: 61 6e 20 69 74 73 20 63 75 72 72 65 6e 74 20 70 an its current p
2400: 61 72 65 6e 74 2c 20 61 6e 64 20 69 66 20 74 68 arent, and if th
2410: 65 20 70 72 65 66 65 72 72 65 64 20 70 61 72 65 e preferred pare
2420: 6e 74 20 69 73 20 61 6e 0a 20 20 20 20 23 20 61 nt is an. # a
2430: 6c 6c 6f 77 65 64 20 70 61 72 65 6e 74 20 6f 66 llowed parent of
2440: 20 74 68 65 20 73 79 6d 62 6f 6c 20 69 6e 20 74 the symbol in t
2450: 68 69 73 20 66 69 6c 65 2c 20 74 68 65 6e 20 77 his file, then w
2460: 65 20 67 72 61 66 74 20 74 68 65 0a 20 20 20 20 e graft the.
2470: 23 20 61 53 79 6d 62 6f 6c 20 6f 6e 74 6f 20 69 # aSymbol onto i
2480: 74 73 20 70 72 65 66 65 72 72 65 64 20 70 61 72 ts preferred par
2490: 65 6e 74 2e 0a 0a 20 20 20 20 70 72 6f 63 20 41 ent... proc A
24a0: 64 6a 75 73 74 50 61 72 65 6e 74 73 20 7b 7d 20 djustParents {}
24b0: 7b 0a 09 6c 6f 67 20 77 72 69 74 65 20 33 20 66 {..log write 3 f
24c0: 69 6c 74 65 72 73 79 6d 20 22 41 64 6a 75 73 74 iltersym "Adjust
24d0: 20 70 61 72 65 6e 74 73 2c 20 6c 6f 61 64 69 6e parents, loadin
24e0: 67 20 64 61 74 61 20 69 6e 20 70 72 65 70 61 72 g data in prepar
24f0: 61 74 69 6f 6e 22 0a 0a 09 23 20 57 65 20 70 75 ation"...# We pu
2500: 6c 6c 20 69 6d 70 6f 72 74 61 6e 74 20 6d 61 70 ll important map
2510: 73 20 6f 6e 63 65 20 69 6e 74 6f 20 6d 65 6d 6f s once into memo
2520: 72 79 20 73 6f 20 74 68 61 74 20 77 65 20 64 6f ry so that we do
2530: 20 71 75 69 63 6b 0a 09 23 20 68 61 73 68 20 6c quick..# hash l
2540: 6f 6f 6b 75 70 20 6c 61 74 65 72 20 77 68 65 6e ookup later when
2550: 20 70 72 6f 63 65 73 73 69 6e 67 20 74 68 65 20 processing the
2560: 67 72 61 66 74 20 63 61 6e 64 69 64 61 74 65 73 graft candidates
2570: 2e 0a 0a 09 23 20 54 61 67 2f 42 72 61 6e 63 68 ....# Tag/Branch
2580: 20 6e 61 6d 65 73 20 2e 2e 2e 0a 09 61 72 72 61 names .....arra
2590: 79 20 73 65 74 20 73 6e 20 5b 73 74 61 74 65 20 y set sn [state
25a0: 72 75 6e 20 7b 20 53 45 4c 45 43 54 20 54 2e 74 run { SELECT T.t
25b0: 69 64 2c 20 53 2e 6e 61 6d 65 20 46 52 4f 4d 20 id, S.name FROM
25c0: 74 61 67 20 54 2c 20 20 20 20 73 79 6d 62 6f 6c tag T, symbol
25d0: 20 53 20 57 48 45 52 45 20 54 2e 73 69 64 20 3d S WHERE T.sid =
25e0: 20 53 2e 73 69 64 20 7d 5d 0a 09 61 72 72 61 79 S.sid }]..array
25f0: 20 73 65 74 20 73 6e 20 5b 73 74 61 74 65 20 72 set sn [state r
2600: 75 6e 20 7b 20 53 45 4c 45 43 54 20 42 2e 62 69 un { SELECT B.bi
2610: 64 2c 20 53 2e 6e 61 6d 65 20 46 52 4f 4d 20 62 d, S.name FROM b
2620: 72 61 6e 63 68 20 42 2c 20 73 79 6d 62 6f 6c 20 ranch B, symbol
2630: 53 20 57 48 45 52 45 20 42 2e 73 69 64 20 3d 20 S WHERE B.sid =
2640: 53 2e 73 69 64 20 7d 5d 0a 09 23 20 53 79 6d 62 S.sid }]..# Symb
2650: 6f 6c 20 6e 61 6d 65 73 20 2e 2e 2e 0a 09 61 72 ol names .....ar
2660: 72 61 79 20 73 65 74 20 73 78 20 5b 73 74 61 74 ray set sx [stat
2670: 65 20 72 75 6e 20 7b 20 53 45 4c 45 43 54 20 4c e run { SELECT L
2680: 2e 73 69 64 2c 20 4c 2e 6e 61 6d 65 20 46 52 4f .sid, L.name FRO
2690: 4d 20 73 79 6d 62 6f 6c 20 4c 20 7d 5d 0a 09 23 M symbol L }]..#
26a0: 20 46 69 6c 65 73 20 61 6e 64 20 70 72 6f 6a 65 Files and proje
26b0: 63 74 73 2e 0a 09 61 72 72 61 79 20 73 65 74 20 cts...array set
26c0: 66 70 6e 20 7b 7d 0a 09 66 6f 72 65 61 63 68 20 fpn {}..foreach
26d0: 7b 69 64 20 66 6e 20 70 6e 7d 20 5b 73 74 61 74 {id fn pn} [stat
26e0: 65 20 72 75 6e 20 7b 0a 09 09 53 45 4c 45 43 54 e run {...SELECT
26f0: 20 46 2e 66 69 64 2c 20 46 2e 6e 61 6d 65 2c 20 F.fid, F.name,
2700: 50 2e 6e 61 6d 65 0a 09 09 46 52 4f 4d 20 20 20 P.name...FROM
2710: 66 69 6c 65 20 46 2c 20 70 72 6f 6a 65 63 74 20 file F, project
2720: 50 0a 09 09 57 48 45 52 45 20 20 46 2e 70 69 64 P...WHERE F.pid
2730: 20 3d 20 50 2e 70 69 64 0a 09 7d 5d 20 7b 20 73 = P.pid..}] { s
2740: 65 74 20 66 70 6e 28 24 69 64 29 20 5b 6c 69 73 et fpn($id) [lis
2750: 74 20 24 66 6e 20 24 70 6e 5d 20 7d 0a 0a 09 73 t $fn $pn] }...s
2760: 65 74 20 74 61 67 73 74 6f 61 64 6a 75 73 74 20 et tagstoadjust
2770: 5b 73 74 61 74 65 20 72 75 6e 20 7b 0a 09 20 20 [state run {..
2780: 20 20 53 45 4c 45 43 54 20 54 2e 74 69 64 2c 20 SELECT T.tid,
2790: 54 2e 66 69 64 2c 20 54 2e 6c 6f 64 2c 20 50 2e T.fid, T.lod, P.
27a0: 70 69 64 2c 20 53 2e 6e 61 6d 65 2c 20 52 2e 72 pid, S.name, R.r
27b0: 65 76 2c 20 52 2e 72 69 64 0a 09 20 20 20 20 46 ev, R.rid.. F
27c0: 52 4f 4d 20 74 61 67 20 54 2c 20 70 72 65 66 65 ROM tag T, prefe
27d0: 72 65 64 70 61 72 65 6e 74 20 50 2c 20 73 79 6d redparent P, sym
27e0: 62 6f 6c 20 53 2c 20 72 65 76 69 73 69 6f 6e 20 bol S, revision
27f0: 52 0a 09 20 20 20 20 57 48 45 52 45 20 54 2e 73 R.. WHERE T.s
2800: 69 64 20 3d 20 50 2e 73 69 64 0a 09 20 20 20 20 id = P.sid..
2810: 41 4e 44 20 20 20 54 2e 6c 6f 64 20 21 3d 20 50 AND T.lod != P
2820: 2e 70 69 64 0a 09 20 20 20 20 41 4e 44 20 20 20 .pid.. AND
2830: 50 2e 70 69 64 20 3d 20 53 2e 73 69 64 0a 09 20 P.pid = S.sid..
2840: 20 20 20 41 4e 44 20 20 20 53 2e 6e 61 6d 65 20 AND S.name
2850: 21 3d 20 27 3a 74 72 75 6e 6b 3a 27 0a 09 20 20 != ':trunk:'..
2860: 20 20 41 4e 44 20 20 20 54 2e 72 65 76 20 3d 20 AND T.rev =
2870: 52 2e 72 69 64 09 0a 09 7d 5d 0a 0a 09 73 65 74 R.rid...}]...set
2880: 20 62 72 61 6e 63 68 65 73 74 6f 61 64 6a 75 73 branchestoadjus
2890: 74 20 5b 73 74 61 74 65 20 72 75 6e 20 7b 0a 09 t [state run {..
28a0: 20 20 20 20 53 45 4c 45 43 54 20 42 2e 62 69 64 SELECT B.bid
28b0: 2c 20 42 2e 66 69 64 2c 20 42 2e 6c 6f 64 2c 20 , B.fid, B.lod,
28c0: 42 2e 70 6f 73 2c 20 50 2e 70 69 64 2c 20 53 2e B.pos, P.pid, S.
28d0: 6e 61 6d 65 2c 20 52 2e 72 65 76 2c 20 52 2e 72 name, R.rev, R.r
28e0: 69 64 0a 09 20 20 20 20 46 52 4f 4d 20 62 72 61 id.. FROM bra
28f0: 6e 63 68 20 42 2c 20 70 72 65 66 65 72 65 64 70 nch B, preferedp
2900: 61 72 65 6e 74 20 50 2c 20 73 79 6d 62 6f 6c 20 arent P, symbol
2910: 53 2c 20 72 65 76 69 73 69 6f 6e 20 52 0a 09 20 S, revision R..
2920: 20 20 20 57 48 45 52 45 20 42 2e 73 69 64 20 3d WHERE B.sid =
2930: 20 50 2e 73 69 64 0a 09 20 20 20 20 41 4e 44 20 P.sid.. AND
2940: 20 20 42 2e 6c 6f 64 20 21 3d 20 50 2e 70 69 64 B.lod != P.pid
2950: 0a 09 20 20 20 20 41 4e 44 20 20 20 50 2e 70 69 .. AND P.pi
2960: 64 20 3d 20 53 2e 73 69 64 0a 09 20 20 20 20 41 d = S.sid.. A
2970: 4e 44 20 20 20 53 2e 6e 61 6d 65 20 21 3d 20 27 ND S.name != '
2980: 3a 74 72 75 6e 6b 3a 27 0a 09 20 20 20 20 41 4e :trunk:'.. AN
2990: 44 20 20 20 42 2e 72 6f 6f 74 20 3d 20 52 2e 72 D B.root = R.r
29a0: 69 64 09 0a 09 7d 5d 0a 0a 09 73 65 74 20 74 6d id...}]...set tm
29b0: 61 78 20 5b 65 78 70 72 20 7b 5b 6c 6c 65 6e 67 ax [expr {[lleng
29c0: 74 68 20 24 74 61 67 73 74 6f 61 64 6a 75 73 74 th $tagstoadjust
29d0: 5d 20 2f 20 37 7d 5d 0a 09 73 65 74 20 62 6d 61 ] / 7}]..set bma
29e0: 78 20 5b 65 78 70 72 20 7b 5b 6c 6c 65 6e 67 74 x [expr {[llengt
29f0: 68 20 24 62 72 61 6e 63 68 65 73 74 6f 61 64 6a h $branchestoadj
2a00: 75 73 74 5d 20 2f 20 38 7d 5d 0a 0a 09 6c 6f 67 ust] / 8}]...log
2a10: 20 77 72 69 74 65 20 34 20 66 69 6c 74 65 72 73 write 4 filters
2a20: 79 6d 20 22 52 65 70 61 72 65 6e 74 69 6e 67 20 ym "Reparenting
2a30: 61 74 20 6d 6f 73 74 20 5b 6e 73 70 20 24 74 6d at most [nsp $tm
2a40: 61 78 20 74 61 67 5d 22 0a 09 6c 6f 67 20 77 72 ax tag]"..log wr
2a50: 69 74 65 20 34 20 66 69 6c 74 65 72 73 79 6d 20 ite 4 filtersym
2a60: 22 52 65 70 61 72 65 6e 74 69 6e 67 20 61 74 20 "Reparenting at
2a70: 6d 6f 73 74 20 5b 6e 73 70 20 24 62 6d 61 78 20 most [nsp $bmax
2a80: 62 72 61 6e 63 68 20 62 72 61 6e 63 68 65 73 5d branch branches]
2a90: 22 0a 0a 09 6c 6f 67 20 77 72 69 74 65 20 33 20 "...log write 3
2aa0: 66 69 6c 74 65 72 73 79 6d 20 22 41 64 6a 75 73 filtersym "Adjus
2ab0: 74 20 74 61 67 20 70 61 72 65 6e 74 73 22 0a 0a t tag parents"..
2ac0: 09 23 20 46 69 6e 64 20 74 68 65 20 74 61 67 73 .# Find the tags
2ad0: 20 77 68 6f 73 65 20 63 75 72 72 65 6e 74 20 70 whose current p
2ae0: 61 72 65 6e 74 20 28 6c 6f 64 29 20 69 73 20 6e arent (lod) is n
2af0: 6f 74 20 74 68 65 20 70 72 65 66 65 72 65 64 0a ot the prefered.
2b00: 09 23 20 70 61 72 65 6e 74 2c 20 74 68 65 20 70 .# parent, the p
2b10: 72 65 66 65 72 65 64 20 70 61 72 65 6e 74 20 69 refered parent i
2b20: 73 20 6e 6f 74 20 74 68 65 20 74 72 75 6e 6b 2c s not the trunk,
2b30: 20 61 6e 64 20 74 68 65 0a 09 23 20 70 72 65 66 and the..# pref
2b40: 65 72 65 64 20 70 61 72 65 6e 74 20 69 73 20 61 ered parent is a
2b50: 20 70 6f 73 73 69 62 6c 65 20 70 61 72 65 6e 74 possible parent
2b60: 20 70 65 72 20 74 68 65 20 74 61 67 27 73 20 72 per the tag's r
2b70: 65 76 69 73 69 6f 6e 2e 0a 0a 09 73 65 74 20 66 evision....set f
2b80: 6d 74 20 25 5b 73 74 72 69 6e 67 20 6c 65 6e 67 mt %[string leng
2b90: 74 68 20 24 74 6d 61 78 5d 73 0a 09 73 65 74 20 th $tmax]s..set
2ba0: 6d 78 73 20 5b 66 6f 72 6d 61 74 20 24 66 6d 74 mxs [format $fmt
2bb0: 20 24 74 6d 61 78 5d 0a 0a 09 73 65 74 20 6e 20 $tmax]...set n
2bc0: 30 0a 09 66 6f 72 65 61 63 68 20 7b 69 64 20 66 0..foreach {id f
2bd0: 69 64 20 6c 6f 64 20 70 69 64 20 70 72 65 66 65 id lod pid prefe
2be0: 72 65 64 6e 61 6d 65 20 72 65 76 6e 72 20 72 69 redname revnr ri
2bf0: 64 7d 20 24 74 61 67 73 74 6f 61 64 6a 75 73 74 d} $tagstoadjust
2c00: 20 7b 0a 0a 09 20 20 20 20 23 20 42 4f 54 54 4c {... # BOTTL
2c10: 45 2d 4e 45 43 4b 20 2e 2e 2e 0a 09 20 20 20 20 E-NECK .....
2c20: 23 0a 09 20 20 20 20 23 20 54 68 65 20 63 68 65 #.. # The che
2c30: 63 6b 20 69 66 20 74 68 65 20 63 61 6e 64 69 64 ck if the candid
2c40: 61 74 65 20 28 70 69 64 29 20 69 73 20 74 72 75 ate (pid) is tru
2c50: 6c 79 20 76 69 61 62 6c 65 20 69 73 0a 09 20 20 ly viable is..
2c60: 20 20 23 20 62 61 73 65 64 20 66 69 6e 64 69 6e # based findin
2c70: 67 20 74 68 65 20 62 72 61 6e 63 68 20 61 73 20 g the branch as
2c80: 70 6f 73 73 69 62 6c 65 20 70 61 72 65 6e 74 2c possible parent,
2c90: 20 61 6e 64 20 64 6f 6e 65 0a 09 20 20 20 20 23 and done.. #
2ca0: 20 6e 6f 77 20 69 6e 73 74 65 61 64 20 6f 66 20 now instead of
2cb0: 61 73 20 70 61 72 74 20 6f 66 20 74 68 65 20 61 as part of the a
2cc0: 6c 72 65 61 64 79 20 63 6f 6d 70 6c 65 78 20 6a lready complex j
2cd0: 6f 69 6e 2e 0a 09 20 20 20 20 23 0a 09 20 20 20 oin... #..
2ce0: 20 23 20 2e 2e 2e 20 41 4e 44 20 50 2e 70 69 64 # ... AND P.pid
2cf0: 20 49 4e 20 28 53 45 4c 45 43 54 20 42 2e 73 69 IN (SELECT B.si
2d00: 64 0a 09 20 20 20 20 23 20 20 20 20 20 20 20 20 d.. #
2d10: 20 20 20 20 20 20 20 20 20 20 20 46 52 4f 4d 20 FROM
2d20: 62 72 61 6e 63 68 20 42 0a 09 20 20 20 20 23 20 branch B.. #
2d30: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
2d40: 20 20 57 48 45 52 45 20 42 2e 72 6f 6f 74 20 3d WHERE B.root =
2d50: 20 52 2e 72 69 64 29 0a 0a 09 20 20 20 20 69 66 R.rid)... if
2d60: 20 7b 21 5b 73 74 61 74 65 20 6f 6e 65 20 7b 0a {![state one {.
2d70: 09 09 53 45 4c 45 43 54 20 43 4f 55 4e 54 28 2a ..SELECT COUNT(*
2d80: 29 0a 09 09 46 52 4f 4d 20 62 72 61 6e 63 68 20 )...FROM branch
2d90: 42 0a 09 09 57 48 45 52 45 20 20 42 2e 73 69 64 B...WHERE B.sid
2da0: 20 20 3d 20 24 70 69 64 0a 09 09 41 4e 44 20 20 = $pid...AND
2db0: 20 20 42 2e 72 6f 6f 74 20 3d 20 24 72 69 64 0a B.root = $rid.
2dc0: 09 20 20 20 20 7d 5d 7d 20 7b 0a 09 09 69 6e 63 . }]} {...inc
2dd0: 72 20 74 6d 61 78 20 2d 31 0a 09 09 73 65 74 20 r tmax -1...set
2de0: 20 6d 78 73 20 5b 66 6f 72 6d 61 74 20 24 66 6d mxs [format $fm
2df0: 74 20 24 74 6d 61 78 5d 0a 09 09 63 6f 6e 74 69 t $tmax]...conti
2e00: 6e 75 65 0a 09 20 20 20 20 7d 0a 0a 09 20 20 20 nue.. }...
2e10: 20 23 0a 09 20 20 20 20 23 20 42 4f 54 54 4c 45 #.. # BOTTLE
2e20: 2d 4e 45 43 4b 20 2e 2e 2e 0a 0a 09 20 20 20 20 -NECK ......
2e30: 23 20 54 68 65 20 6e 61 6d 65 73 20 66 6f 72 20 # The names for
2e40: 75 73 65 20 69 6e 20 74 68 65 20 6c 6f 67 20 6f use in the log o
2e50: 75 74 70 75 74 20 61 72 65 20 72 65 74 72 69 65 utput are retrie
2e60: 76 65 64 0a 09 20 20 20 20 23 20 73 65 70 61 72 ved.. # separ
2e70: 61 74 65 6c 79 2c 20 74 6f 20 6b 65 65 70 20 74 ately, to keep t
2e80: 68 65 20 6a 6f 69 6e 20 73 65 6c 65 63 74 69 6e he join selectin
2e90: 67 20 74 68 65 20 61 64 6a 75 73 74 61 62 6c 65 g the adjustable
2ea0: 0a 09 20 20 20 20 23 20 74 61 67 73 20 73 6d 61 .. # tags sma
2eb0: 6c 6c 2c 20 6e 6f 74 20 62 75 72 64 65 6e 65 64 ll, not burdened
2ec0: 20 77 69 74 68 20 74 68 65 20 64 65 72 65 66 65 with the derefe
2ed0: 72 65 6e 63 69 6e 67 20 6f 66 20 6c 69 6e 6b 73 rencing of links
2ee0: 0a 09 20 20 20 20 23 20 74 6f 20 6e 61 6d 65 2e .. # to name.
2ef0: 0a 0a 09 20 20 20 20 73 65 74 20 74 61 67 6e 61 ... set tagna
2f00: 6d 65 20 24 73 6e 28 24 69 64 29 0a 09 20 20 20 me $sn($id)..
2f10: 20 73 65 74 20 6f 6c 64 6e 61 6d 65 20 24 73 78 set oldname $sx
2f20: 28 24 6c 6f 64 29 0a 09 20 20 20 20 73 74 72 75 ($lod).. stru
2f30: 63 74 3a 3a 6c 69 73 74 20 61 73 73 69 67 6e 20 ct::list assign
2f40: 24 66 70 6e 28 24 66 69 64 29 20 66 6e 61 6d 65 $fpn($fid) fname
2f50: 20 70 72 6e 61 6d 65 0a 0a 09 20 20 20 20 23 20 prname... #
2f60: 44 6f 20 74 68 65 20 67 72 61 66 74 69 6e 67 2e Do the grafting.
2f70: 0a 0a 09 20 20 20 20 6c 6f 67 20 77 72 69 74 65 ... log write
2f80: 20 34 20 66 69 6c 74 65 72 73 79 6d 20 22 5c 5b 4 filtersym "\[
2f90: 5b 66 6f 72 6d 61 74 20 24 66 6d 74 20 24 6e 5d [format $fmt $n]
2fa0: 2f 24 6d 78 73 5c 5d 20 24 70 72 6e 61 6d 65 20 /$mxs\] $prname
2fb0: 3a 20 47 72 61 66 74 69 6e 67 20 74 61 67 20 27 : Grafting tag '
2fc0: 24 74 61 67 6e 61 6d 65 27 20 6f 6e 20 24 66 6e $tagname' on $fn
2fd0: 61 6d 65 2f 24 72 65 76 6e 72 20 66 72 6f 6d 20 ame/$revnr from
2fe0: 27 24 6f 6c 64 6e 61 6d 65 27 20 6f 6e 74 6f 20 '$oldname' onto
2ff0: 27 24 70 72 65 66 65 72 65 64 6e 61 6d 65 27 22 '$preferedname'"
3000: 0a 09 20 20 20 20 73 74 61 74 65 20 72 75 6e 20 .. state run
3010: 7b 20 55 50 44 41 54 45 20 74 61 67 20 53 45 54 { UPDATE tag SET
3020: 20 6c 6f 64 20 3d 20 24 70 69 64 20 57 48 45 52 lod = $pid WHER
3030: 45 20 74 69 64 20 3d 20 24 69 64 20 3b 20 7d 0a E tid = $id ; }.
3040: 09 20 20 20 20 69 6e 63 72 20 6e 0a 09 7d 0a 0a . incr n..}..
3050: 09 6c 6f 67 20 77 72 69 74 65 20 33 20 66 69 6c .log write 3 fil
3060: 74 65 72 73 79 6d 20 22 52 65 70 61 72 65 6e 74 tersym "Reparent
3070: 65 64 20 5b 6e 73 70 20 24 6e 20 74 61 67 5d 22 ed [nsp $n tag]"
3080: 0a 0a 09 6c 6f 67 20 77 72 69 74 65 20 33 20 66 ...log write 3 f
3090: 69 6c 74 65 72 73 79 6d 20 22 41 64 6a 75 73 74 iltersym "Adjust
30a0: 20 62 72 61 6e 63 68 20 70 61 72 65 6e 74 73 22 branch parents"
30b0: 0a 0a 09 23 20 46 69 6e 64 20 74 68 65 20 62 72 ...# Find the br
30c0: 61 6e 63 68 65 73 20 77 68 6f 73 65 20 63 75 72 anches whose cur
30d0: 72 65 6e 74 20 70 61 72 65 6e 74 20 28 6c 6f 64 rent parent (lod
30e0: 29 20 69 73 20 6e 6f 74 20 74 68 65 0a 09 23 20 ) is not the..#
30f0: 70 72 65 66 65 72 65 64 20 70 61 72 65 6e 74 2c prefered parent,
3100: 20 74 68 65 20 70 72 65 66 65 72 65 64 20 70 61 the prefered pa
3110: 72 65 6e 74 20 69 73 20 6e 6f 74 20 74 68 65 20 rent is not the
3120: 74 72 75 6e 6b 2c 20 61 6e 64 0a 09 23 20 74 68 trunk, and..# th
3130: 65 20 70 72 65 66 65 72 65 64 20 70 61 72 65 6e e prefered paren
3140: 74 20 69 73 20 61 20 70 6f 73 73 69 62 6c 65 20 t is a possible
3150: 70 61 72 65 6e 74 20 70 65 72 20 74 68 65 20 62 parent per the b
3160: 72 61 6e 63 68 27 73 0a 09 23 20 72 65 76 69 73 ranch's..# revis
3170: 69 6f 6e 2e 0a 0a 09 73 65 74 20 66 6d 74 20 25 ion....set fmt %
3180: 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 [string length $
3190: 62 6d 61 78 5d 73 0a 09 73 65 74 20 6d 78 73 20 bmax]s..set mxs
31a0: 5b 66 6f 72 6d 61 74 20 24 66 6d 74 20 24 62 6d [format $fmt $bm
31b0: 61 78 5d 0a 0a 09 73 65 74 20 6e 20 30 0a 09 66 ax]...set n 0..f
31c0: 6f 72 65 61 63 68 20 7b 69 64 20 66 69 64 20 6c oreach {id fid l
31d0: 6f 64 20 70 6f 73 20 70 69 64 20 70 72 65 66 65 od pos pid prefe
31e0: 72 65 64 6e 61 6d 65 20 72 65 76 6e 72 20 72 69 redname revnr ri
31f0: 64 7d 20 24 62 72 61 6e 63 68 65 73 74 6f 61 64 d} $branchestoad
3200: 6a 75 73 74 20 7b 0a 0a 09 20 20 20 20 23 20 42 just {... # B
3210: 4f 54 54 4c 45 2d 4e 45 43 4b 20 2e 2e 2e 0a 09 OTTLE-NECK .....
3220: 20 20 20 20 23 0a 09 20 20 20 20 23 20 54 68 65 #.. # The
3230: 20 63 68 65 63 6b 20 69 66 20 74 68 65 20 63 61 check if the ca
3240: 6e 64 69 64 61 74 65 20 28 70 69 64 29 20 69 73 ndidate (pid) is
3250: 20 74 72 75 6c 79 20 76 69 61 62 6c 65 20 69 73 truly viable is
3260: 0a 09 20 20 20 20 23 20 62 61 73 65 64 20 6f 6e .. # based on
3270: 20 74 68 65 20 62 72 61 6e 63 68 20 70 6f 73 69 the branch posi
3280: 74 69 6f 6e 73 20 69 6e 20 74 68 65 20 73 70 61 tions in the spa
3290: 77 6e 69 6e 67 20 72 65 76 69 73 69 6f 6e 2c 0a wning revision,.
32a0: 09 20 20 20 20 23 20 61 6e 64 20 64 6f 6e 65 20 . # and done
32b0: 6e 6f 77 20 69 6e 73 74 65 61 64 20 6f 66 20 61 now instead of a
32c0: 73 20 70 61 72 74 20 6f 66 20 74 68 65 20 61 6c s part of the al
32d0: 72 65 61 64 79 20 63 6f 6d 70 6c 65 78 0a 09 20 ready complex..
32e0: 20 20 20 23 20 6a 6f 69 6e 2e 0a 09 20 20 20 20 # join...
32f0: 23 0a 09 20 20 20 20 23 20 2e 2e 2e 20 41 4e 44 #.. # ... AND
3300: 20 50 2e 70 69 64 20 49 4e 20 28 53 45 4c 45 43 P.pid IN (SELEC
3310: 54 20 42 58 2e 73 69 64 0a 09 20 20 20 20 23 20 T BX.sid.. #
3320: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
3330: 20 20 46 52 4f 4d 20 62 72 61 6e 63 68 20 42 58 FROM branch BX
3340: 0a 09 20 20 20 20 23 20 20 20 20 20 20 20 20 20 .. #
3350: 20 20 20 20 20 20 20 20 20 20 57 48 45 52 45 20 WHERE
3360: 42 58 2e 72 6f 6f 74 20 3d 20 52 2e 72 69 64 0a BX.root = R.rid.
3370: 09 20 20 20 20 23 20 20 20 20 20 20 20 20 20 20 . #
3380: 20 20 20 20 20 20 20 20 20 41 4e 44 20 20 20 42 AND B
3390: 58 2e 70 6f 73 20 3e 20 42 2e 70 6f 73 29 0a 0a X.pos > B.pos)..
33a0: 09 20 20 20 20 69 66 20 7b 21 5b 73 74 61 74 65 . if {![state
33b0: 20 6f 6e 65 20 7b 0a 09 09 53 45 4c 45 43 54 20 one {...SELECT
33c0: 43 4f 55 4e 54 28 2a 29 0a 09 09 46 52 4f 4d 20 COUNT(*)...FROM
33d0: 62 72 61 6e 63 68 20 42 0a 09 09 57 48 45 52 45 branch B...WHERE
33e0: 20 20 42 2e 73 69 64 20 20 3d 20 24 70 69 64 0a B.sid = $pid.
33f0: 09 09 41 4e 44 20 20 20 20 42 2e 72 6f 6f 74 20 ..AND B.root
3400: 3d 20 24 72 69 64 0a 09 09 41 4e 44 20 20 20 20 = $rid...AND
3410: 42 2e 70 6f 73 20 20 3e 20 24 70 6f 73 0a 09 20 B.pos > $pos..
3420: 20 20 20 7d 5d 7d 20 7b 0a 09 09 69 6e 63 72 20 }]} {...incr
3430: 62 6d 61 78 20 2d 31 0a 09 09 73 65 74 20 20 6d bmax -1...set m
3440: 78 73 20 5b 66 6f 72 6d 61 74 20 24 66 6d 74 20 xs [format $fmt
3450: 24 62 6d 61 78 5d 0a 09 09 63 6f 6e 74 69 6e 75 $bmax]...continu
3460: 65 0a 09 20 20 20 20 7d 0a 0a 09 20 20 20 20 23 e.. }... #
3470: 0a 09 20 20 20 20 23 20 42 4f 54 54 4c 45 2d 4e .. # BOTTLE-N
3480: 45 43 4b 20 2e 2e 2e 0a 0a 09 20 20 20 20 23 20 ECK ...... #
3490: 54 68 65 20 6e 61 6d 65 73 20 66 6f 72 20 75 73 The names for us
34a0: 65 20 69 6e 20 74 68 65 20 6c 6f 67 20 6f 75 74 e in the log out
34b0: 70 75 74 20 61 72 65 20 72 65 74 72 69 65 76 65 put are retrieve
34c0: 64 0a 09 20 20 20 20 23 20 73 65 70 61 72 61 74 d.. # separat
34d0: 65 6c 79 2c 20 74 6f 20 6b 65 65 70 20 74 68 65 ely, to keep the
34e0: 20 6a 6f 69 6e 20 73 65 6c 65 63 74 69 6e 67 20 join selecting
34f0: 74 68 65 20 61 64 6a 75 73 74 61 62 6c 65 0a 09 the adjustable..
3500: 20 20 20 20 23 20 74 61 67 73 20 73 6d 61 6c 6c # tags small
3510: 2c 20 6e 6f 74 20 62 75 72 64 65 6e 65 64 20 77 , not burdened w
3520: 69 74 68 20 74 68 65 20 64 65 72 65 66 65 72 65 ith the derefere
3530: 6e 63 69 6e 67 20 6f 66 20 6c 69 6e 6b 73 0a 09 ncing of links..
3540: 20 20 20 20 23 20 74 6f 20 6e 61 6d 65 2e 0a 0a # to name...
3550: 09 20 20 20 20 73 65 74 20 62 72 61 6e 61 6d 65 . set braname
3560: 20 24 73 6e 28 24 69 64 29 0a 09 20 20 20 20 73 $sn($id).. s
3570: 65 74 20 6f 6c 64 6e 61 6d 65 20 24 73 78 28 24 et oldname $sx($
3580: 6c 6f 64 29 0a 09 20 20 20 20 73 74 72 75 63 74 lod).. struct
3590: 3a 3a 6c 69 73 74 20 61 73 73 69 67 6e 20 24 66 ::list assign $f
35a0: 70 6e 28 24 66 69 64 29 20 66 6e 61 6d 65 20 70 pn($fid) fname p
35b0: 72 6e 61 6d 65 0a 0a 09 20 20 20 20 23 20 44 6f rname... # Do
35c0: 20 74 68 65 20 67 72 61 66 74 69 6e 67 2e 0a 0a the grafting...
35d0: 09 20 20 20 20 6c 6f 67 20 77 72 69 74 65 20 34 . log write 4
35e0: 20 66 69 6c 74 65 72 73 79 6d 20 22 5c 5b 5b 66 filtersym "\[[f
35f0: 6f 72 6d 61 74 20 24 66 6d 74 20 24 6e 5d 2f 24 ormat $fmt $n]/$
3600: 6d 78 73 5c 5d 20 24 70 72 6e 61 6d 65 20 3a 20 mxs\] $prname :
3610: 47 72 61 66 74 69 6e 67 20 62 72 61 6e 63 68 20 Grafting branch
3620: 27 24 62 72 61 6e 61 6d 65 27 20 6f 6e 20 24 66 '$braname' on $f
3630: 6e 61 6d 65 2f 24 72 65 76 6e 72 20 66 72 6f 6d name/$revnr from
3640: 20 27 24 6f 6c 64 6e 61 6d 65 27 20 6f 6e 74 6f '$oldname' onto
3650: 20 27 24 70 72 65 66 65 72 65 64 6e 61 6d 65 27 '$preferedname'
3660: 22 0a 09 20 20 20 20 73 74 61 74 65 20 72 75 6e ".. state run
3670: 20 7b 20 55 50 44 41 54 45 20 74 61 67 20 53 45 { UPDATE tag SE
3680: 54 20 6c 6f 64 20 3d 20 24 70 69 64 20 57 48 45 T lod = $pid WHE
3690: 52 45 20 74 69 64 20 3d 20 24 69 64 20 3b 20 7d RE tid = $id ; }
36a0: 0a 09 20 20 20 20 69 6e 63 72 20 6e 0a 09 7d 0a .. incr n..}.
36b0: 0a 09 6c 6f 67 20 77 72 69 74 65 20 33 20 66 69 ..log write 3 fi
36c0: 6c 74 65 72 73 79 6d 20 22 52 65 70 61 72 65 6e ltersym "Reparen
36d0: 74 65 64 20 5b 6e 73 70 20 24 6e 20 62 72 61 6e ted [nsp $n bran
36e0: 63 68 20 62 72 61 6e 63 68 65 73 5d 22 0a 09 72 ch branches]"..r
36f0: 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 eturn. }..
3700: 20 70 72 6f 63 20 52 65 66 69 6e 65 53 79 6d 62 proc RefineSymb
3710: 6f 6c 73 20 7b 7d 20 7b 0a 09 23 20 54 61 67 73 ols {} {..# Tags
3720: 20 61 6e 64 20 62 72 61 6e 63 68 65 73 20 61 72 and branches ar
3730: 65 20 6d 61 72 6b 65 64 20 61 73 20 6e 6f 72 6d e marked as norm
3740: 61 6c 2f 6e 6f 6f 70 20 62 61 73 65 64 20 6f 6e al/noop based on
3750: 20 74 68 65 20 6f 70 0a 09 23 20 6f 66 20 74 68 the op..# of th
3760: 65 69 72 20 72 65 76 69 73 69 6f 6e 2e 0a 0a 09 eir revision....
3770: 6c 6f 67 20 77 72 69 74 65 20 33 20 66 69 6c 74 log write 3 filt
3780: 65 72 73 79 6d 20 22 52 65 66 69 6e 65 20 73 79 ersym "Refine sy
3790: 6d 62 6f 6c 73 20 28 6e 6f 2d 6f 70 20 6f 72 20 mbols (no-op or
37a0: 6e 6f 74 3f 29 22 0a 0a 09 6c 6f 67 20 77 72 69 not?)"...log wri
37b0: 74 65 20 34 20 66 69 6c 74 65 72 73 79 6d 20 22 te 4 filtersym "
37c0: 20 20 20 20 52 65 67 75 6c 61 72 20 74 61 67 73 Regular tags
37d0: 22 0a 09 73 74 61 74 65 20 72 75 6e 20 7b 0a 09 "..state run {..
37e0: 20 20 20 20 49 4e 53 45 52 54 20 49 4e 54 4f 20 INSERT INTO
37f0: 6e 6f 6f 70 0a 09 20 20 20 20 53 45 4c 45 43 54 noop.. SELECT
3800: 20 54 2e 74 69 64 2c 20 30 0a 09 20 20 20 20 46 T.tid, 0.. F
3810: 52 4f 4d 20 74 61 67 20 54 2c 20 72 65 76 69 73 ROM tag T, revis
3820: 69 6f 6e 20 52 0a 09 20 20 20 20 57 48 45 52 45 ion R.. WHERE
3830: 20 54 2e 72 65 76 20 20 3d 20 52 2e 72 69 64 0a T.rev = R.rid.
3840: 09 20 20 20 20 41 4e 44 20 20 20 52 2e 6f 70 20 . AND R.op
3850: 20 21 3d 20 30 20 2d 2d 20 30 20 3d 3d 20 6e 6f != 0 -- 0 == no
3860: 74 68 69 6e 67 0a 09 7d 0a 0a 09 6c 6f 67 20 77 thing..}...log w
3870: 72 69 74 65 20 34 20 66 69 6c 74 65 72 73 79 6d rite 4 filtersym
3880: 20 22 20 20 20 20 4e 6f 2d 6f 70 20 74 61 67 73 " No-op tags
3890: 22 0a 09 73 74 61 74 65 20 72 75 6e 20 7b 0a 09 "..state run {..
38a0: 20 20 20 20 49 4e 53 45 52 54 20 49 4e 54 4f 20 INSERT INTO
38b0: 6e 6f 6f 70 0a 09 20 20 20 20 53 45 4c 45 43 54 noop.. SELECT
38c0: 20 54 2e 74 69 64 2c 20 31 0a 09 20 20 20 20 46 T.tid, 1.. F
38d0: 52 4f 4d 20 74 61 67 20 54 2c 20 72 65 76 69 73 ROM tag T, revis
38e0: 69 6f 6e 20 52 0a 09 20 20 20 20 57 48 45 52 45 ion R.. WHERE
38f0: 20 54 2e 72 65 76 20 20 3d 20 52 2e 72 69 64 0a T.rev = R.rid.
3900: 09 20 20 20 20 41 4e 44 20 20 20 52 2e 6f 70 20 . AND R.op
3910: 20 20 3d 20 30 20 2d 2d 20 6e 6f 74 68 69 6e 67 = 0 -- nothing
3920: 0a 09 7d 0a 0a 09 6c 6f 67 20 77 72 69 74 65 20 ..}...log write
3930: 34 20 66 69 6c 74 65 72 73 79 6d 20 22 20 20 20 4 filtersym "
3940: 20 52 65 67 75 6c 61 72 20 62 72 61 6e 63 68 65 Regular branche
3950: 73 22 0a 09 73 74 61 74 65 20 72 75 6e 20 7b 0a s"..state run {.
3960: 09 20 20 20 20 49 4e 53 45 52 54 20 49 4e 54 4f . INSERT INTO
3970: 20 6e 6f 6f 70 0a 09 20 20 20 20 53 45 4c 45 43 noop.. SELEC
3980: 54 20 42 2e 62 69 64 2c 20 30 0a 09 20 20 20 20 T B.bid, 0..
3990: 46 52 4f 4d 20 62 72 61 6e 63 68 20 42 2c 20 72 FROM branch B, r
39a0: 65 76 69 73 69 6f 6e 20 52 0a 09 20 20 20 20 57 evision R.. W
39b0: 48 45 52 45 20 42 2e 72 6f 6f 74 20 3d 20 52 2e HERE B.root = R.
39c0: 72 69 64 0a 09 20 20 20 20 41 4e 44 20 20 20 52 rid.. AND R
39d0: 2e 6f 70 20 20 21 3d 20 30 20 2d 2d 20 6e 6f 74 .op != 0 -- not
39e0: 68 69 6e 67 0a 09 7d 0a 0a 09 6c 6f 67 20 77 72 hing..}...log wr
39f0: 69 74 65 20 34 20 66 69 6c 74 65 72 73 79 6d 20 ite 4 filtersym
3a00: 22 20 20 20 20 4e 6f 2d 6f 70 20 62 72 61 6e 63 " No-op branc
3a10: 68 65 73 22 0a 09 73 74 61 74 65 20 72 75 6e 20 hes"..state run
3a20: 7b 0a 09 20 20 20 20 49 4e 53 45 52 54 20 49 4e {.. INSERT IN
3a30: 54 4f 20 6e 6f 6f 70 0a 09 20 20 20 20 53 45 4c TO noop.. SEL
3a40: 45 43 54 20 42 2e 62 69 64 2c 20 31 0a 09 20 20 ECT B.bid, 1..
3a50: 20 20 46 52 4f 4d 20 62 72 61 6e 63 68 20 42 2c FROM branch B,
3a60: 20 72 65 76 69 73 69 6f 6e 20 52 0a 09 20 20 20 revision R..
3a70: 20 57 48 45 52 45 20 42 2e 72 6f 6f 74 20 3d 20 WHERE B.root =
3a80: 52 2e 72 69 64 0a 09 20 20 20 20 41 4e 44 20 20 R.rid.. AND
3a90: 20 52 2e 6f 70 20 20 20 3d 20 30 20 2d 2d 20 6e R.op = 0 -- n
3aa0: 6f 74 68 69 6e 67 0a 09 7d 0a 09 72 65 74 75 72 othing..}..retur
3ab0: 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 23 20 23 n. }.. # #
3ac0: 20 23 23 20 23 23 23 20 23 23 23 23 23 20 23 23 ## ### ##### ##
3ad0: 23 23 23 23 23 23 20 23 23 23 23 23 23 23 23 23 ###### #########
3ae0: 23 23 23 23 0a 20 20 20 20 23 23 20 43 6f 6e 66 ####. ## Conf
3af0: 69 67 75 72 61 74 69 6f 6e 0a 0a 20 20 20 20 70 iguration.. p
3b00: 72 61 67 6d 61 20 2d 68 61 73 69 6e 73 74 61 6e ragma -hasinstan
3b10: 63 65 73 20 20 20 6e 6f 20 3b 20 23 20 73 69 6e ces no ; # sin
3b20: 67 6c 65 74 6f 6e 0a 20 20 20 20 70 72 61 67 6d gleton. pragm
3b30: 61 20 2d 68 61 73 74 79 70 65 69 6e 66 6f 20 20 a -hastypeinfo
3b40: 20 20 6e 6f 20 3b 20 23 20 6e 6f 20 69 6e 74 72 no ; # no intr
3b50: 6f 73 70 65 63 74 69 6f 6e 0a 20 20 20 20 70 72 ospection. pr
3b60: 61 67 6d 61 20 2d 68 61 73 74 79 70 65 64 65 73 agma -hastypedes
3b70: 74 72 6f 79 20 6e 6f 20 3b 20 23 20 69 6d 6d 6f troy no ; # immo
3b80: 72 74 61 6c 0a 0a 20 20 20 20 23 20 23 20 23 23 rtal.. # # ##
3b90: 20 23 23 23 20 23 23 23 23 23 20 23 23 23 23 23 ### ##### #####
3ba0: 23 23 23 20 23 23 23 23 23 23 23 23 23 23 23 23 ### ############
3bb0: 23 0a 7d 0a 0a 6e 61 6d 65 73 70 61 63 65 20 65 #.}..namespace e
3bc0: 76 61 6c 20 3a 3a 76 63 3a 3a 66 6f 73 73 69 6c val ::vc::fossil
3bd0: 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 70 ::import::cvs::p
3be0: 61 73 73 20 7b 0a 20 20 20 20 6e 61 6d 65 73 70 ass {. namesp
3bf0: 61 63 65 20 65 78 70 6f 72 74 20 66 69 6c 74 65 ace export filte
3c00: 72 73 79 6d 0a 20 20 20 20 6e 61 6d 65 73 70 61 rsym. namespa
3c10: 63 65 20 65 76 61 6c 20 66 69 6c 74 65 72 73 79 ce eval filtersy
3c20: 6d 20 7b 0a 09 6e 61 6d 65 73 70 61 63 65 20 69 m {..namespace i
3c30: 6d 70 6f 72 74 20 3a 3a 76 63 3a 3a 66 6f 73 73 mport ::vc::foss
3c40: 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a il::import::cvs:
3c50: 3a 72 65 70 6f 73 69 74 6f 72 79 0a 09 6e 61 6d :repository..nam
3c60: 65 73 70 61 63 65 20 69 6d 70 6f 72 74 20 3a 3a espace import ::
3c70: 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f vc::fossil::impo
3c80: 72 74 3a 3a 63 76 73 3a 3a 73 74 61 74 65 0a 09 rt::cvs::state..
3c90: 6e 61 6d 65 73 70 61 63 65 20 69 6d 70 6f 72 74 namespace import
3ca0: 20 3a 3a 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 ::vc::fossil::i
3cb0: 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 69 6e 74 65 mport::cvs::inte
3cc0: 67 72 69 74 79 0a 09 6e 61 6d 65 73 70 61 63 65 grity..namespace
3cd0: 20 65 76 61 6c 20 70 72 6f 6a 65 63 74 20 7b 0a eval project {.
3ce0: 09 20 20 20 20 6e 61 6d 65 73 70 61 63 65 20 69 . namespace i
3cf0: 6d 70 6f 72 74 20 3a 3a 76 63 3a 3a 66 6f 73 73 mport ::vc::foss
3d00: 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a il::import::cvs:
3d10: 3a 70 72 6f 6a 65 63 74 3a 3a 73 79 6d 0a 09 7d :project::sym..}
3d20: 0a 09 6e 61 6d 65 73 70 61 63 65 20 69 6d 70 6f ..namespace impo
3d30: 72 74 20 3a 3a 76 63 3a 3a 74 6f 6f 6c 73 3a 3a rt ::vc::tools::
3d40: 6d 69 73 63 3a 3a 6e 73 70 0a 09 6e 61 6d 65 73 misc::nsp..names
3d50: 70 61 63 65 20 69 6d 70 6f 72 74 20 3a 3a 76 63 pace import ::vc
3d60: 3a 3a 74 6f 6f 6c 73 3a 3a 6c 6f 67 0a 09 6c 6f ::tools::log..lo
3d70: 67 20 72 65 67 69 73 74 65 72 20 66 69 6c 74 65 g register filte
3d80: 72 73 79 6d 0a 20 20 20 20 7d 0a 7d 0a 0a 23 20 rsym. }.}..#
3d90: 23 20 23 23 20 23 23 23 20 23 23 23 23 23 20 23 # ## ### ##### #
3da0: 23 23 23 23 23 23 23 20 23 23 23 23 23 23 23 23 ####### ########
3db0: 23 23 23 23 23 20 23 23 23 23 23 23 23 23 23 23 ##### ##########
3dc0: 23 23 23 23 23 23 23 23 23 23 23 0a 23 23 20 52 ###########.## R
3dd0: 65 61 64 79 0a 0a 70 61 63 6b 61 67 65 20 70 72 eady..package pr
3de0: 6f 76 69 64 65 20 76 63 3a 3a 66 6f 73 73 69 6c ovide vc::fossil
3df0: 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 70 ::import::cvs::p
3e00: 61 73 73 3a 3a 66 69 6c 74 65 72 73 79 6d 20 31 ass::filtersym 1
3e10: 2e 30 0a 72 65 74 75 72 6e 0a .0.return.