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 2d 32 30 30 38 20 41 6e 64 72 65 61 73 20 07-2008 Andreas
0070: 4b 75 70 72 69 65 73 2e 0a 23 0a 23 20 54 68 69 Kupries..#.# Thi
0080: 73 20 73 6f 66 74 77 61 72 65 20 69 73 20 6c 69 s software is li
0090: 63 65 6e 73 65 64 20 61 73 20 64 65 73 63 72 69 censed as descri
00a0: 62 65 64 20 69 6e 20 74 68 65 20 66 69 6c 65 20 bed in the file
00b0: 4c 49 43 45 4e 53 45 2c 20 77 68 69 63 68 0a 23 LICENSE, which.#
00c0: 20 79 6f 75 20 73 68 6f 75 6c 64 20 68 61 76 65 you should have
00d0: 20 72 65 63 65 69 76 65 64 20 61 73 20 70 61 72 received as par
00e0: 74 20 6f 66 20 74 68 69 73 20 64 69 73 74 72 69 t of this distri
00f0: 62 75 74 69 6f 6e 2e 0a 23 0a 23 20 54 68 69 73 bution..#.# This
0100: 20 73 6f 66 74 77 61 72 65 20 63 6f 6e 73 69 73 software consis
0110: 74 73 20 6f 66 20 76 6f 6c 75 6e 74 61 72 79 20 ts of voluntary
0120: 63 6f 6e 74 72 69 62 75 74 69 6f 6e 73 20 6d 61 contributions ma
0130: 64 65 20 62 79 20 6d 61 6e 79 0a 23 20 69 6e 64 de by many.# ind
0140: 69 76 69 64 75 61 6c 73 2e 20 20 46 6f 72 20 65 ividuals. For e
0150: 78 61 63 74 20 63 6f 6e 74 72 69 62 75 74 69 6f xact contributio
0160: 6e 20 68 69 73 74 6f 72 79 2c 20 73 65 65 20 74 n history, see t
0170: 68 65 20 72 65 76 69 73 69 6f 6e 0a 23 20 68 69 he revision.# hi
0180: 73 74 6f 72 79 20 61 6e 64 20 6c 6f 67 73 2c 20 story and logs,
0190: 61 76 61 69 6c 61 62 6c 65 20 61 74 20 68 74 74 available at htt
01a0: 70 3a 2f 2f 66 6f 73 73 69 6c 2d 73 63 6d 2e 68 p://fossil-scm.h
01b0: 77 61 63 69 2e 63 6f 6d 2f 66 6f 73 73 69 6c 0a waci.com/fossil.
01c0: 23 20 23 20 23 23 20 23 23 23 20 23 23 23 23 23 # # ## ### #####
01d0: 20 23 23 23 23 23 23 23 23 20 23 23 23 23 23 23 ######## ######
01e0: 23 23 23 23 23 23 23 20 23 23 23 23 23 23 23 23 ####### ########
01f0: 23 23 23 23 23 23 23 23 23 23 23 23 23 0a 0a 23 #############..#
0200: 23 20 52 65 76 69 73 69 6f 6e 73 20 70 65 72 20 # Revisions per
0210: 70 72 6f 6a 65 63 74 2c 20 61 6b 61 20 43 68 61 project, aka Cha
0220: 6e 67 65 73 65 74 73 2e 20 54 68 65 73 65 20 6f ngesets. These o
0230: 62 6a 65 63 74 73 20 61 72 65 20 66 69 72 73 74 bjects are first
0240: 20 75 73 65 64 0a 23 23 20 69 6e 20 70 61 73 73 used.## in pass
0250: 20 35 2c 20 77 68 69 63 68 20 63 72 65 61 74 65 5, which create
0260: 73 20 74 68 65 20 69 6e 69 74 69 61 6c 20 73 65 s the initial se
0270: 74 20 63 6f 76 65 72 69 6e 67 20 74 68 65 20 72 t covering the r
0280: 65 70 6f 73 69 74 6f 72 79 2e 0a 0a 23 20 23 20 epository...# #
0290: 23 23 20 23 23 23 20 23 23 23 23 23 20 23 23 23 ## ### ##### ###
02a0: 23 23 23 23 23 20 23 23 23 23 23 23 23 23 23 23 ##### ##########
02b0: 23 23 23 20 23 23 23 23 23 23 23 23 23 23 23 23 ### ############
02c0: 23 23 23 23 23 23 23 23 23 0a 23 23 20 52 65 71 #########.## Req
02d0: 75 69 72 65 6d 65 6e 74 73 0a 0a 70 61 63 6b 61 uirements..packa
02e0: 67 65 20 72 65 71 75 69 72 65 20 54 63 6c 20 38 ge require Tcl 8
02f0: 2e 34 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .4
0300: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0310: 20 3b 20 23 20 52 65 71 75 69 72 65 64 20 72 75 ; # Required ru
0320: 6e 74 69 6d 65 2e 0a 70 61 63 6b 61 67 65 20 72 ntime..package r
0330: 65 71 75 69 72 65 20 73 6e 69 74 20 20 20 20 20 equire snit
0340: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0350: 20 20 20 20 20 20 20 20 20 20 20 20 20 3b 20 23 ; #
0360: 20 4f 4f 20 73 79 73 74 65 6d 2e 0a 70 61 63 6b OO system..pack
0370: 61 67 65 20 72 65 71 75 69 72 65 20 73 74 72 75 age require stru
0380: 63 74 3a 3a 73 65 74 20 20 20 20 20 20 20 20 20 ct::set
0390: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
03a0: 20 20 3b 20 23 20 53 65 74 20 6f 70 65 72 61 74 ; # Set operat
03b0: 69 6f 6e 73 2e 0a 70 61 63 6b 61 67 65 20 72 65 ions..package re
03c0: 71 75 69 72 65 20 76 63 3a 3a 74 6f 6f 6c 73 3a quire vc::tools:
03d0: 3a 6d 69 73 63 20 20 20 20 20 20 20 20 20 20 20 :misc
03e0: 20 20 20 20 20 20 20 20 20 20 20 20 3b 20 23 20 ; #
03f0: 54 65 78 74 20 66 6f 72 6d 61 74 74 69 6e 67 0a Text formatting.
0400: 70 61 63 6b 61 67 65 20 72 65 71 75 69 72 65 20 package require
0410: 76 63 3a 3a 74 6f 6f 6c 73 3a 3a 74 72 6f 75 62 vc::tools::troub
0420: 6c 65 20 20 20 20 20 20 20 20 20 20 20 20 20 20 le
0430: 20 20 20 20 20 20 3b 20 23 20 45 72 72 6f 72 20 ; # Error
0440: 72 65 70 6f 72 74 69 6e 67 2e 0a 70 61 63 6b 61 reporting..packa
0450: 67 65 20 72 65 71 75 69 72 65 20 76 63 3a 3a 74 ge require vc::t
0460: 6f 6f 6c 73 3a 3a 6c 6f 67 20 20 20 20 20 20 20 ools::log
0470: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0480: 20 3b 20 23 20 55 73 65 72 20 66 65 65 64 62 61 ; # User feedba
0490: 63 6b 2e 0a 70 61 63 6b 61 67 65 20 72 65 71 75 ck..package requ
04a0: 69 72 65 20 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a ire vc::fossil::
04b0: 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 73 74 61 import::cvs::sta
04c0: 74 65 20 20 20 20 20 20 20 20 3b 20 23 20 53 74 te ; # St
04d0: 61 74 65 20 73 74 6f 72 61 67 65 2e 0a 70 61 63 ate storage..pac
04e0: 6b 61 67 65 20 72 65 71 75 69 72 65 20 76 63 3a kage require vc:
04f0: 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a :fossil::import:
0500: 3a 63 76 73 3a 3a 69 6e 74 65 67 72 69 74 79 20 :cvs::integrity
0510: 20 20 20 3b 20 23 20 53 74 61 74 65 20 69 6e 74 ; # State int
0520: 65 67 72 69 74 79 20 63 68 65 63 6b 73 2e 0a 0a egrity checks...
0530: 23 20 23 20 23 23 20 23 23 23 20 23 23 23 23 23 # # ## ### #####
0540: 20 23 23 23 23 23 23 23 23 20 23 23 23 23 23 23 ######## ######
0550: 23 23 23 23 23 23 23 20 23 23 23 23 23 23 23 23 ####### ########
0560: 23 23 23 23 23 23 23 23 23 23 23 23 23 0a 23 23 #############.##
0570: 0a 0a 73 6e 69 74 3a 3a 74 79 70 65 20 3a 3a 76 ..snit::type ::v
0580: 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 c::fossil::impor
0590: 74 3a 3a 63 76 73 3a 3a 70 72 6f 6a 65 63 74 3a t::cvs::project:
05a0: 3a 72 65 76 20 7b 0a 20 20 20 20 23 20 23 20 23 :rev {. # # #
05b0: 23 20 23 23 23 20 23 23 23 23 23 20 23 23 23 23 # ### ##### ####
05c0: 23 23 23 23 20 23 23 23 23 23 23 23 23 23 23 23 #### ###########
05d0: 23 23 0a 20 20 20 20 23 23 20 50 75 62 6c 69 63 ##. ## Public
05e0: 20 41 50 49 0a 0a 20 20 20 20 63 6f 6e 73 74 72 API.. constr
05f0: 75 63 74 6f 72 20 7b 70 72 6f 6a 65 63 74 20 63 uctor {project c
0600: 73 74 79 70 65 20 73 72 63 69 64 20 69 74 65 6d stype srcid item
0610: 73 20 7b 74 68 65 69 64 20 7b 7d 7d 7d 20 7b 0a s {theid {}}} {.
0620: 09 69 66 20 7b 24 74 68 65 69 64 20 6e 65 20 22 .if {$theid ne "
0630: 22 7d 20 7b 0a 09 20 20 20 20 73 65 74 20 6d 79 "} {.. set my
0640: 69 64 20 24 74 68 65 69 64 0a 09 7d 20 65 6c 73 id $theid..} els
0650: 65 20 7b 0a 09 20 20 20 20 73 65 74 20 6d 79 69 e {.. set myi
0660: 64 20 5b 69 6e 63 72 20 6d 79 63 6f 75 6e 74 65 d [incr mycounte
0670: 72 5d 0a 09 7d 0a 0a 09 69 6e 74 65 67 72 69 74 r]..}...integrit
0680: 79 20 61 73 73 65 72 74 20 7b 0a 09 20 20 20 20 y assert {..
0690: 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 6d 79 63 [info exists myc
06a0: 73 74 79 70 65 28 24 63 73 74 79 70 65 29 5d 0a stype($cstype)].
06b0: 09 7d 20 7b 42 61 64 20 63 68 61 6e 67 65 73 65 .} {Bad changese
06c0: 74 20 74 79 70 65 20 27 24 63 73 74 79 70 65 27 t type '$cstype'
06d0: 2e 7d 0a 0a 09 73 65 74 20 6d 79 70 72 6f 6a 65 .}...set myproje
06e0: 63 74 20 20 20 24 70 72 6f 6a 65 63 74 0a 09 73 ct $project..s
06f0: 65 74 20 6d 79 74 79 70 65 20 20 20 20 20 20 24 et mytype $
0700: 63 73 74 79 70 65 0a 09 73 65 74 20 6d 79 74 79 cstype..set myty
0710: 70 65 6f 62 6a 20 20 20 3a 3a 76 63 3a 3a 66 6f peobj ::vc::fo
0720: 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 ssil::import::cv
0730: 73 3a 3a 70 72 6f 6a 65 63 74 3a 3a 72 65 76 3a s::project::rev:
0740: 3a 24 7b 63 73 74 79 70 65 7d 0a 09 73 65 74 20 :${cstype}..set
0750: 6d 79 73 72 63 69 64 09 24 73 72 63 69 64 0a 09 mysrcid.$srcid..
0760: 73 65 74 20 6d 79 69 74 65 6d 73 20 20 20 20 20 set myitems
0770: 24 69 74 65 6d 73 0a 09 73 65 74 20 6d 79 70 6f $items..set mypo
0780: 73 20 20 20 20 20 20 20 7b 7d 20 3b 20 23 20 43 s {} ; # C
0790: 6f 6d 6d 69 74 20 6c 6f 63 61 74 69 6f 6e 20 69 ommit location i
07a0: 73 20 6e 6f 74 20 6b 6e 6f 77 6e 20 79 65 74 2e s not known yet.
07b0: 0a 0a 09 23 20 4b 65 65 70 20 74 72 61 63 6b 20 ...# Keep track
07c0: 6f 66 20 74 68 65 20 67 65 6e 65 72 61 74 65 64 of the generated
07d0: 20 63 68 61 6e 67 65 73 65 74 73 20 61 6e 64 20 changesets and
07e0: 6f 66 20 74 68 65 20 69 6e 76 65 72 73 65 0a 09 of the inverse..
07f0: 23 20 6d 61 70 70 69 6e 67 20 66 72 6f 6d 20 69 # mapping from i
0800: 74 65 6d 73 20 74 6f 20 74 68 65 6d 2e 0a 09 6c tems to them...l
0810: 61 70 70 65 6e 64 20 6d 79 63 68 61 6e 67 65 73 append mychanges
0820: 65 74 73 20 20 20 24 73 65 6c 66 0a 09 6c 61 70 ets $self..lap
0830: 70 65 6e 64 20 6d 79 74 63 68 61 6e 67 65 73 65 pend mytchangese
0840: 74 73 28 24 63 73 74 79 70 65 29 20 24 73 65 6c ts($cstype) $sel
0850: 66 0a 09 73 65 74 20 20 20 20 20 6d 79 69 64 6d f..set myidm
0860: 61 70 28 24 6d 79 69 64 29 20 24 73 65 6c 66 0a ap($myid) $self.
0870: 09 66 6f 72 65 61 63 68 20 69 69 64 20 24 69 74 .foreach iid $it
0880: 65 6d 73 20 7b 0a 09 20 20 20 20 73 65 74 20 6b ems {.. set k
0890: 65 79 20 5b 6c 69 73 74 20 24 63 73 74 79 70 65 ey [list $cstype
08a0: 20 24 69 69 64 5d 0a 09 20 20 20 20 73 65 74 20 $iid].. set
08b0: 6d 79 69 74 65 6d 6d 61 70 28 24 6b 65 79 29 20 myitemmap($key)
08c0: 24 73 65 6c 66 0a 09 20 20 20 20 6c 61 70 70 65 $self.. lappe
08d0: 6e 64 20 6d 79 74 69 74 65 6d 73 20 24 6b 65 79 nd mytitems $key
08e0: 0a 09 20 20 20 20 6c 6f 67 20 77 72 69 74 65 20 .. log write
08f0: 38 20 63 73 65 74 73 20 7b 4d 41 50 2b 20 69 74 8 csets {MAP+ it
0900: 65 6d 20 3c 24 6b 65 79 3e 20 24 73 65 6c 66 20 em <$key> $self
0910: 3d 20 5b 24 73 65 6c 66 20 73 74 72 5d 7d 0a 09 = [$self str]}..
0920: 7d 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a }..return. }.
0930: 0a 20 20 20 20 6d 65 74 68 6f 64 20 73 74 72 20 . method str
0940: 7b 7d 20 7b 0a 09 73 65 74 20 73 74 72 20 20 20 {} {..set str
0950: 20 22 3c 22 0a 09 73 65 74 20 64 65 74 61 69 6c "<"..set detail
0960: 20 22 22 0a 09 69 66 20 7b 5b 24 6d 79 74 79 70 ""..if {[$mytyp
0970: 65 6f 62 6a 20 62 79 73 79 6d 62 6f 6c 5d 7d 20 eobj bysymbol]}
0980: 7b 0a 09 20 20 20 20 73 65 74 20 64 65 74 61 69 {.. set detai
0990: 6c 20 22 20 27 5b 73 74 61 74 65 20 6f 6e 65 20 l " '[state one
09a0: 7b 0a 09 09 53 45 4c 45 43 54 20 53 2e 6e 61 6d {...SELECT S.nam
09b0: 65 0a 09 09 46 52 4f 4d 20 20 20 73 79 6d 62 6f e...FROM symbo
09c0: 6c 20 53 0a 09 09 57 48 45 52 45 20 20 53 2e 73 l S...WHERE S.s
09d0: 69 64 20 3d 20 24 6d 79 73 72 63 69 64 0a 09 20 id = $mysrcid..
09e0: 20 20 20 7d 5d 27 22 0a 09 7d 0a 09 61 70 70 65 }]'"..}..appe
09f0: 6e 64 20 73 74 72 20 22 24 6d 79 74 79 70 65 20 nd str "$mytype
0a00: 24 7b 6d 79 69 64 7d 24 7b 64 65 74 61 69 6c 7d ${myid}${detail}
0a10: 3e 22 0a 09 72 65 74 75 72 6e 20 24 73 74 72 0a >"..return $str.
0a20: 20 20 20 20 7d 0a 0a 20 20 20 20 6d 65 74 68 6f }.. metho
0a30: 64 20 6c 6f 64 20 7b 7d 20 7b 0a 09 72 65 74 75 d lod {} {..retu
0a40: 72 6e 20 5b 24 6d 79 74 79 70 65 6f 62 6a 20 63 rn [$mytypeobj c
0a50: 73 5f 6c 6f 64 20 24 6d 79 69 74 65 6d 73 5d 0a s_lod $myitems].
0a60: 20 20 20 20 7d 0a 0a 20 20 20 20 6d 65 74 68 6f }.. metho
0a70: 64 20 69 64 20 20 20 20 7b 7d 20 7b 20 72 65 74 d id {} { ret
0a80: 75 72 6e 20 24 6d 79 69 64 20 7d 0a 20 20 20 20 urn $myid }.
0a90: 6d 65 74 68 6f 64 20 69 74 65 6d 73 20 7b 7d 20 method items {}
0aa0: 7b 20 72 65 74 75 72 6e 20 24 6d 79 74 69 74 65 { return $mytite
0ab0: 6d 73 20 7d 0a 20 20 20 20 6d 65 74 68 6f 64 20 ms }. method
0ac0: 64 61 74 61 20 20 7b 7d 20 7b 20 72 65 74 75 72 data {} { retur
0ad0: 6e 20 5b 6c 69 73 74 20 24 6d 79 70 72 6f 6a 65 n [list $myproje
0ae0: 63 74 20 24 6d 79 74 79 70 65 20 24 6d 79 73 72 ct $mytype $mysr
0af0: 63 69 64 5d 20 7d 0a 0a 20 20 20 20 64 65 6c 65 cid] }.. dele
0b00: 67 61 74 65 20 6d 65 74 68 6f 64 20 62 79 73 79 gate method bysy
0b10: 6d 62 6f 6c 20 20 20 74 6f 20 6d 79 74 79 70 65 mbol to mytype
0b20: 6f 62 6a 0a 20 20 20 20 64 65 6c 65 67 61 74 65 obj. delegate
0b30: 20 6d 65 74 68 6f 64 20 62 79 72 65 76 69 73 69 method byrevisi
0b40: 6f 6e 20 74 6f 20 6d 79 74 79 70 65 6f 62 6a 0a on to mytypeobj.
0b50: 20 20 20 20 64 65 6c 65 67 61 74 65 20 6d 65 74 delegate met
0b60: 68 6f 64 20 69 73 62 72 61 6e 63 68 20 20 20 74 hod isbranch t
0b70: 6f 20 6d 79 74 79 70 65 6f 62 6a 0a 20 20 20 20 o mytypeobj.
0b80: 64 65 6c 65 67 61 74 65 20 6d 65 74 68 6f 64 20 delegate method
0b90: 69 73 74 61 67 20 20 20 20 20 20 74 6f 20 6d 79 istag to my
0ba0: 74 79 70 65 6f 62 6a 0a 0a 20 20 20 20 6d 65 74 typeobj.. met
0bb0: 68 6f 64 20 73 65 74 70 6f 73 20 7b 70 7d 20 7b hod setpos {p} {
0bc0: 20 73 65 74 20 6d 79 70 6f 73 20 24 70 20 3b 20 set mypos $p ;
0bd0: 72 65 74 75 72 6e 20 7d 0a 20 20 20 20 6d 65 74 return }. met
0be0: 68 6f 64 20 70 6f 73 20 20 20 20 7b 7d 20 20 7b hod pos {} {
0bf0: 20 72 65 74 75 72 6e 20 24 6d 79 70 6f 73 20 7d return $mypos }
0c00: 0a 0a 20 20 20 20 6d 65 74 68 6f 64 20 64 65 74 .. method det
0c10: 65 72 6d 69 6e 65 73 75 63 63 65 73 73 6f 72 73 erminesuccessors
0c20: 20 7b 7d 20 7b 0a 09 23 20 50 61 73 73 20 36 20 {} {..# Pass 6
0c30: 6f 70 65 72 61 74 69 6f 6e 2e 20 43 6f 6d 70 75 operation. Compu
0c40: 74 65 20 70 72 6f 6a 65 63 74 2d 6c 65 76 65 6c te project-level
0c50: 20 64 65 70 65 6e 64 65 6e 63 69 65 73 20 66 72 dependencies fr
0c60: 6f 6d 0a 09 23 20 74 68 65 20 66 69 6c 65 2d 6c om..# the file-l
0c70: 65 76 65 6c 20 64 61 74 61 20 61 6e 64 20 73 61 evel data and sa
0c80: 76 65 20 69 74 20 62 61 63 6b 20 74 6f 20 74 68 ve it back to th
0c90: 65 20 73 74 61 74 65 2e 20 54 68 69 73 20 6d 61 e state. This ma
0ca0: 79 0a 09 23 20 62 65 20 63 61 6c 6c 65 64 20 64 y..# be called d
0cb0: 75 72 69 6e 67 20 74 68 65 20 63 79 63 6c 65 20 uring the cycle
0cc0: 62 72 65 61 6b 65 72 20 70 61 73 73 65 73 20 61 breaker passes a
0cd0: 73 20 77 65 6c 6c 2c 20 74 6f 20 61 64 6a 75 73 s well, to adjus
0ce0: 74 0a 09 23 20 74 68 65 20 73 75 63 63 65 73 73 t..# the success
0cf0: 6f 72 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 6f or information o
0d00: 66 20 63 68 61 6e 67 65 73 65 74 73 20 77 68 69 f changesets whi
0d10: 63 68 20 61 72 65 20 74 68 65 0a 09 23 20 70 72 ch are the..# pr
0d20: 65 64 65 63 65 73 73 6f 72 73 20 6f 66 20 64 72 edecessors of dr
0d30: 6f 70 70 65 64 20 63 68 61 6e 67 65 73 65 74 73 opped changesets
0d40: 2e 20 46 6f 72 20 74 68 65 6d 20 77 65 20 68 61 . For them we ha
0d50: 76 65 20 74 6f 0a 09 23 20 72 65 6d 6f 76 65 20 ve to..# remove
0d60: 74 68 65 69 72 20 65 78 69 73 74 69 6e 67 20 69 their existing i
0d70: 6e 66 6f 72 6d 61 74 69 6f 6e 20 66 69 72 73 74 nformation first
0d80: 20 62 65 66 6f 72 65 20 69 6e 73 65 72 74 69 6e before insertin
0d90: 67 20 74 68 65 0a 09 23 20 6e 65 77 20 64 61 74 g the..# new dat
0da0: 61 2e 0a 09 73 74 61 74 65 20 72 75 6e 20 7b 0a a...state run {.
0db0: 09 20 20 20 20 44 45 4c 45 54 45 20 46 52 4f 4d . DELETE FROM
0dc0: 20 63 73 73 75 63 63 65 73 73 6f 72 20 57 48 45 cssuccessor WHE
0dd0: 52 45 20 63 69 64 20 3d 20 24 6d 79 69 64 3b 0a RE cid = $myid;.
0de0: 09 7d 0a 09 73 65 74 20 6c 6f 6f 70 20 30 0a 09 .}..set loop 0..
0df0: 66 6f 72 65 61 63 68 20 6e 69 64 20 5b 24 6d 79 foreach nid [$my
0e00: 74 79 70 65 6f 62 6a 20 63 73 5f 73 75 63 63 65 typeobj cs_succe
0e10: 73 73 6f 72 73 20 24 6d 79 69 74 65 6d 73 5d 20 ssors $myitems]
0e20: 7b 0a 09 20 20 20 20 73 74 61 74 65 20 72 75 6e {.. state run
0e30: 20 7b 0a 09 09 49 4e 53 45 52 54 20 49 4e 54 4f {...INSERT INTO
0e40: 20 63 73 73 75 63 63 65 73 73 6f 72 20 28 63 69 cssuccessor (ci
0e50: 64 2c 20 20 6e 69 64 29 0a 09 09 56 41 4c 55 45 d, nid)...VALUE
0e60: 53 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 S
0e70: 20 20 20 28 24 6d 79 69 64 2c 24 6e 69 64 29 0a ($myid,$nid).
0e80: 09 20 20 20 20 7d 0a 09 20 20 20 20 69 66 20 7b . }.. if {
0e90: 24 6e 69 64 20 3d 3d 20 24 6d 79 69 64 7d 20 7b $nid == $myid} {
0ea0: 20 73 65 74 20 6c 6f 6f 70 20 31 20 7d 0a 09 7d set loop 1 }..}
0eb0: 0a 09 23 20 52 65 70 6f 72 74 20 61 66 74 65 72 ..# Report after
0ec0: 20 74 68 65 20 63 6f 6d 70 6c 65 74 65 20 73 74 the complete st
0ed0: 72 75 63 74 75 72 65 20 68 61 73 20 62 65 65 6e ructure has been
0ee0: 20 73 61 76 65 64 2e 0a 09 69 66 20 7b 24 6c 6f saved...if {$lo
0ef0: 6f 70 7d 20 7b 20 24 73 65 6c 66 20 72 65 70 6f op} { $self repo
0f00: 72 74 6c 6f 6f 70 20 7d 0a 09 72 65 74 75 72 6e rtloop }..return
0f10: 0a 20 20 20 20 7d 0a 0a 20 20 20 20 23 20 72 65 . }.. # re
0f20: 73 75 6c 74 20 3d 20 6c 69 73 74 20 28 63 68 61 sult = list (cha
0f30: 6e 67 65 73 65 74 29 0a 20 20 20 20 6d 65 74 68 ngeset). meth
0f40: 6f 64 20 73 75 63 63 65 73 73 6f 72 73 20 7b 7d od successors {}
0f50: 20 7b 0a 09 23 20 55 73 65 20 74 68 65 20 64 61 {..# Use the da
0f60: 74 61 20 73 61 76 65 64 20 62 79 20 70 61 73 73 ta saved by pass
0f70: 20 36 2e 0a 09 72 65 74 75 72 6e 20 5b 73 74 72 6...return [str
0f80: 75 63 74 3a 3a 6c 69 73 74 20 6d 61 70 20 5b 73 uct::list map [s
0f90: 74 61 74 65 20 72 75 6e 20 7b 0a 09 20 20 20 20 tate run {..
0fa0: 53 45 4c 45 43 54 20 53 2e 6e 69 64 0a 09 20 20 SELECT S.nid..
0fb0: 20 20 46 52 4f 4d 20 20 20 63 73 73 75 63 63 65 FROM cssucce
0fc0: 73 73 6f 72 20 53 0a 09 20 20 20 20 57 48 45 52 ssor S.. WHER
0fd0: 45 20 20 53 2e 63 69 64 20 3d 20 24 6d 79 69 64 E S.cid = $myid
0fe0: 0a 09 7d 5d 20 5b 6d 79 74 79 70 65 6d 65 74 68 ..}] [mytypemeth
0ff0: 6f 64 20 6f 66 5d 5d 0a 20 20 20 20 7d 0a 0a 20 od of]]. }..
1000: 20 20 20 23 20 69 74 65 6d 20 2d 3e 20 6c 69 73 # item -> lis
1010: 74 20 28 69 74 65 6d 29 0a 20 20 20 20 6d 65 74 t (item). met
1020: 68 6f 64 20 6e 65 78 74 6d 61 70 20 7b 7d 20 7b hod nextmap {} {
1030: 0a 09 24 6d 79 74 79 70 65 6f 62 6a 20 73 75 63 ..$mytypeobj suc
1040: 63 65 73 73 6f 72 73 20 74 6d 70 20 24 6d 79 69 cessors tmp $myi
1050: 74 65 6d 73 0a 09 72 65 74 75 72 6e 20 5b 61 72 tems..return [ar
1060: 72 61 79 20 67 65 74 20 74 6d 70 5d 0a 20 20 20 ray get tmp].
1070: 20 7d 0a 0a 20 20 20 20 6d 65 74 68 6f 64 20 62 }.. method b
1080: 72 65 61 6b 69 6e 74 65 72 6e 61 6c 64 65 70 65 reakinternaldepe
1090: 6e 64 65 6e 63 69 65 73 20 7b 7d 20 7b 0a 0a 09 ndencies {} {...
10a0: 23 23 0a 09 23 23 20 4e 4f 54 45 3a 20 54 68 69 ##..## NOTE: Thi
10b0: 73 20 6d 65 74 68 6f 64 2c 20 6d 61 79 62 65 20 s method, maybe
10c0: 69 6e 20 63 6f 6e 6a 75 6e 63 74 69 6f 6e 20 77 in conjunction w
10d0: 69 74 68 20 69 74 73 20 63 61 6c 6c 65 72 0a 09 ith its caller..
10e0: 23 23 20 20 20 20 20 20 20 73 65 65 6d 73 20 74 ## seems t
10f0: 6f 20 62 65 20 61 20 6d 65 6d 6f 72 79 20 68 6f o be a memory ho
1100: 67 2c 20 65 73 70 65 63 69 61 6c 6c 79 20 66 6f g, especially fo
1110: 72 20 6c 61 72 67 65 0a 09 23 23 20 20 20 20 20 r large..##
1120: 20 20 63 68 61 6e 67 65 73 65 74 73 2c 20 77 69 changesets, wi
1130: 74 68 20 27 6c 61 72 67 65 27 20 6d 65 61 6e 69 th 'large' meani
1140: 6e 67 20 74 6f 20 68 61 76 65 20 61 20 27 6c 6f ng to have a 'lo
1150: 6e 67 20 6c 69 73 74 0a 09 23 23 20 20 20 20 20 ng list..##
1160: 20 20 6f 66 20 69 74 65 6d 73 2c 20 73 65 76 65 of items, seve
1170: 72 61 6c 20 74 68 6f 75 73 61 6e 64 27 2e 20 49 ral thousand'. I
1180: 6e 76 65 73 74 69 67 61 74 65 20 77 68 65 72 65 nvestigate where
1190: 20 74 68 65 0a 09 23 23 20 20 20 20 20 20 20 6d the..## m
11a0: 65 6d 6f 72 79 20 69 73 20 73 70 65 6e 74 20 61 emory is spent a
11b0: 6e 64 20 74 68 65 6e 20 6c 6f 6f 6b 20 66 6f 72 nd then look for
11c0: 20 77 61 79 73 20 6f 66 20 72 65 63 74 69 66 79 ways of rectify
11d0: 69 6e 67 0a 09 23 23 20 20 20 20 20 20 20 74 68 ing..## th
11e0: 65 20 70 72 6f 62 6c 65 6d 2e 0a 09 23 23 0a 0a e problem...##..
11f0: 09 23 20 54 68 69 73 20 6d 65 74 68 6f 64 20 69 .# This method i
1200: 6e 73 70 65 63 74 73 20 74 68 65 20 63 68 61 6e nspects the chan
1210: 67 65 73 65 74 73 20 66 6f 72 20 69 6e 74 65 72 gesets for inter
1220: 6e 61 6c 0a 09 23 20 64 65 70 65 6e 64 65 6e 63 nal..# dependenc
1230: 69 65 73 2e 20 4e 6f 74 68 69 6e 67 20 69 73 20 ies. Nothing is
1240: 64 6f 6e 65 20 69 66 20 74 68 65 72 65 20 61 72 done if there ar
1250: 65 20 6e 6f 0a 09 23 20 73 75 63 68 2e 20 4f 74 e no..# such. Ot
1260: 68 65 72 77 69 73 65 20 74 68 65 20 63 68 61 6e herwise the chan
1270: 67 65 73 65 74 20 69 73 20 73 70 6c 69 74 20 69 geset is split i
1280: 6e 74 6f 20 61 20 73 65 74 20 6f 66 0a 09 23 20 nto a set of..#
1290: 66 72 61 67 6d 65 6e 74 73 20 77 69 74 68 6f 75 fragments withou
12a0: 74 20 69 6e 74 65 72 6e 61 6c 20 64 65 70 65 6e t internal depen
12b0: 64 65 6e 63 69 65 73 2c 20 74 72 61 6e 73 66 6f dencies, transfo
12c0: 72 6d 69 6e 67 20 74 68 65 0a 09 23 20 69 6e 74 rming the..# int
12d0: 65 72 6e 61 6c 20 64 65 70 65 6e 64 65 6e 63 69 ernal dependenci
12e0: 65 73 20 69 6e 74 6f 20 65 78 74 65 72 6e 61 6c es into external
12f0: 20 6f 6e 65 73 2e 20 54 68 65 20 6e 65 77 20 63 ones. The new c
1300: 68 61 6e 67 65 73 65 74 73 0a 09 23 20 61 72 65 hangesets..# are
1310: 20 61 64 64 65 64 20 74 6f 20 74 68 65 20 6c 69 added to the li
1320: 73 74 20 6f 66 20 61 6c 6c 20 63 68 61 6e 67 65 st of all change
1330: 73 65 74 73 2e 0a 0a 09 23 20 57 65 20 70 65 72 sets....# We per
1340: 66 6f 72 6d 20 61 6c 6c 20 6e 65 63 65 73 73 61 form all necessa
1350: 72 79 20 73 70 6c 69 74 73 20 69 6e 20 6f 6e 65 ry splits in one
1360: 20 67 6f 2c 20 69 6e 73 74 65 61 64 20 6f 66 20 go, instead of
1370: 6f 6e 6c 79 0a 09 23 20 6f 6e 65 2e 20 54 68 65 only..# one. The
1380: 20 70 72 65 76 69 6f 75 73 20 61 6c 67 6f 72 69 previous algori
1390: 74 68 6d 2c 20 61 64 61 70 74 65 64 20 66 72 6f thm, adapted fro
13a0: 6d 20 63 76 73 32 73 76 6e 2c 20 63 6f 6d 70 75 m cvs2svn, compu
13b0: 74 65 64 0a 09 23 20 61 20 6c 6f 74 20 6f 66 20 ted..# a lot of
13c0: 73 74 61 74 65 20 77 68 69 63 68 20 77 61 73 20 state which was
13d0: 74 68 72 6f 77 6e 20 61 77 61 79 20 61 6e 64 20 thrown away and
13e0: 74 68 65 6e 20 63 6f 6d 70 75 74 65 64 20 61 67 then computed ag
13f0: 61 69 6e 0a 09 23 20 66 6f 72 20 65 61 63 68 20 ain..# for each
1400: 6f 66 20 74 68 65 20 66 72 61 67 6d 65 6e 74 73 of the fragments
1410: 2e 20 49 74 20 73 68 6f 75 6c 64 20 62 65 20 65 . It should be e
1420: 61 73 69 65 72 20 74 6f 20 75 70 64 61 74 65 20 asier to update
1430: 61 6e 64 0a 09 23 20 72 65 75 73 65 20 74 68 61 and..# reuse tha
1440: 74 20 73 74 61 74 65 2e 0a 0a 09 23 20 54 68 65 t state....# The
1450: 20 63 6f 64 65 20 63 68 65 63 6b 73 20 6f 6e 6c code checks onl
1460: 79 20 73 75 63 63 65 73 73 6f 72 20 64 65 70 65 y successor depe
1470: 6e 64 65 6e 63 69 65 73 2c 20 61 73 20 74 68 69 ndencies, as thi
1480: 73 0a 09 23 20 61 75 74 6f 6d 61 74 69 63 61 6c s..# automatical
1490: 6c 79 20 63 6f 76 65 72 73 20 74 68 65 20 70 72 ly covers the pr
14a0: 65 64 65 63 65 73 73 6f 72 20 64 65 70 65 6e 64 edecessor depend
14b0: 65 6e 63 69 65 73 20 61 73 20 77 65 6c 6c 20 28 encies as well (
14c0: 41 0a 09 23 20 73 75 63 63 65 73 73 6f 72 20 64 A..# successor d
14d0: 65 70 65 6e 64 65 6e 63 79 20 61 20 2d 3e 20 62 ependency a -> b
14e0: 20 69 73 20 61 6c 73 6f 20 61 20 70 72 65 64 65 is also a prede
14f0: 63 65 73 73 6f 72 20 64 65 70 65 6e 64 65 6e 63 cessor dependenc
1500: 79 0a 09 23 20 62 20 2d 3e 20 61 29 2e 0a 0a 09 y..# b -> a)....
1510: 23 20 41 72 72 61 79 20 6f 66 20 64 65 70 65 6e # Array of depen
1520: 64 65 6e 63 69 65 73 20 28 70 61 72 65 6e 74 20 dencies (parent
1530: 2d 3e 20 63 68 69 6c 64 29 2e 20 54 68 69 73 20 -> child). This
1540: 69 73 20 70 75 6c 6c 65 64 20 66 72 6f 6d 0a 09 is pulled from..
1550: 23 20 74 68 65 20 73 74 61 74 65 2c 20 61 6e 64 # the state, and
1560: 20 6c 69 6d 69 74 65 64 20 74 6f 20 73 75 63 63 limited to succ
1570: 65 73 73 6f 72 73 20 77 69 74 68 69 6e 20 74 68 essors within th
1580: 65 20 63 68 61 6e 67 65 73 65 74 2e 0a 0a 09 61 e changeset....a
1590: 72 72 61 79 20 73 65 74 20 64 65 70 65 6e 64 65 rray set depende
15a0: 6e 63 69 65 73 20 7b 7d 0a 09 24 6d 79 74 79 70 ncies {}..$mytyp
15b0: 65 6f 62 6a 20 69 6e 74 65 72 6e 61 6c 73 75 63 eobj internalsuc
15c0: 63 65 73 73 6f 72 73 20 64 65 70 65 6e 64 65 6e cessors dependen
15d0: 63 69 65 73 20 24 6d 79 69 74 65 6d 73 0a 09 69 cies $myitems..i
15e0: 66 20 7b 21 5b 61 72 72 61 79 20 73 69 7a 65 20 f {![array size
15f0: 64 65 70 65 6e 64 65 6e 63 69 65 73 5d 7d 20 7b dependencies]} {
1600: 72 65 74 75 72 6e 20 30 7d 20 3b 20 23 20 4e 6f return 0} ; # No
1610: 74 68 69 6e 67 20 74 6f 20 62 72 65 61 6b 2e 0a thing to break..
1620: 0a 09 6c 6f 67 20 77 72 69 74 65 20 35 20 63 73 ..log write 5 cs
1630: 65 74 73 20 2e 2e 2e 5b 24 73 65 6c 66 20 73 74 ets ...[$self st
1640: 72 5d 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e r]..............
1650: 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e ................
1660: 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e ................
1670: 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 09 23 20 57 65 ............# We
1680: 20 68 61 76 65 20 69 6e 74 65 72 6e 61 6c 20 64 have internal d
1690: 65 70 65 6e 64 65 6e 63 69 65 73 20 74 6f 20 62 ependencies to b
16a0: 72 65 61 6b 2e 20 57 65 20 6e 6f 77 20 69 74 65 reak. We now ite
16b0: 72 61 74 65 20 6f 76 65 72 0a 09 23 20 61 6c 6c rate over..# all
16c0: 20 70 6f 73 69 74 69 6f 6e 73 20 69 6e 20 74 68 positions in th
16d0: 65 20 6c 69 73 74 20 28 77 68 69 63 68 20 69 73 e list (which is
16e0: 20 63 68 72 6f 6e 6f 6c 6f 67 69 63 61 6c 2c 20 chronological,
16f0: 61 74 20 6c 65 61 73 74 0a 09 23 20 61 73 20 66 at least..# as f
1700: 61 72 20 61 73 20 74 68 65 20 74 69 6d 65 73 74 ar as the timest
1710: 61 6d 70 73 20 61 72 65 20 63 6f 72 72 65 63 74 amps are correct
1720: 20 61 6e 64 20 75 6e 69 71 75 65 29 20 61 6e 64 and unique) and
1730: 0a 09 23 20 64 65 74 65 72 6d 69 6e 65 20 74 68 ..# determine th
1740: 65 20 62 65 73 74 20 70 6f 73 69 74 69 6f 6e 20 e best position
1750: 66 6f 72 20 74 68 65 20 62 72 65 61 6b 2c 20 62 for the break, b
1760: 79 20 74 72 79 69 6e 67 20 74 6f 0a 09 23 20 62 y trying to..# b
1770: 72 65 61 6b 20 61 73 20 6d 61 6e 79 20 64 65 70 reak as many dep
1780: 65 6e 64 65 6e 63 69 65 73 20 61 73 20 70 6f 73 endencies as pos
1790: 73 69 62 6c 65 20 69 6e 20 6f 6e 65 20 67 6f 2e sible in one go.
17a0: 20 57 68 65 6e 20 61 0a 09 23 20 62 72 65 61 6b When a..# break
17b0: 20 77 61 73 20 66 6f 75 6e 64 20 74 68 69 73 20 was found this
17c0: 69 73 20 72 65 64 6f 6e 65 20 66 6f 72 20 74 68 is redone for th
17d0: 65 20 66 72 61 67 6d 65 6e 74 73 20 63 6f 6d 69 e fragments comi
17e0: 6e 67 20 61 6e 64 0a 09 23 20 61 66 74 65 72 2c ng and..# after,
17f0: 20 61 66 74 65 72 20 75 70 64 69 6e 67 20 74 68 after upding th
1800: 65 20 63 72 6f 73 73 69 6e 67 20 69 6e 66 6f 72 e crossing infor
1810: 6d 61 74 69 6f 6e 2e 0a 0a 09 23 20 44 61 74 61 mation....# Data
1820: 20 73 74 72 75 63 74 75 72 65 73 3a 0a 09 23 20 structures:..#
1830: 4d 61 70 3a 20 20 50 4f 53 20 20 20 72 65 76 69 Map: POS revi
1840: 73 69 6f 6e 20 69 64 20 20 20 20 20 20 2d 3e 20 sion id ->
1850: 70 6f 73 69 74 69 6f 6e 20 69 6e 20 6c 69 73 74 position in list
1860: 2e 0a 09 23 20 20 20 20 20 20 20 43 52 4f 53 53 ...# CROSS
1870: 20 70 6f 73 69 74 69 6f 6e 20 69 6e 20 6c 69 73 position in lis
1880: 74 20 2d 3e 20 6e 75 6d 62 65 72 20 6f 66 20 64 t -> number of d
1890: 65 70 65 6e 64 65 6e 63 69 65 73 20 63 72 6f 73 ependencies cros
18a0: 73 69 6e 67 20 69 74 0a 09 23 20 20 20 20 20 20 sing it..#
18b0: 20 44 45 50 43 20 20 64 65 70 65 6e 64 65 6e 63 DEPC dependenc
18c0: 79 20 20 20 20 20 20 20 2d 3e 20 70 6f 73 69 74 y -> posit
18d0: 69 6f 6e 73 20 69 74 20 63 72 6f 73 73 65 73 0a ions it crosses.
18e0: 09 23 20 4c 69 73 74 3a 20 52 41 4e 47 45 20 4f .# List: RANGE O
18f0: 66 20 74 68 65 20 70 6f 73 69 74 69 6f 6e 73 20 f the positions
1900: 69 74 73 65 6c 66 2e 0a 09 23 20 41 20 64 65 70 itself...# A dep
1910: 65 6e 64 65 6e 63 79 20 69 73 20 61 20 73 69 6e endency is a sin
1920: 67 6c 65 2d 65 6c 65 6d 65 6e 74 20 6d 61 70 20 gle-element map
1930: 70 61 72 65 6e 74 20 2d 3e 20 63 68 69 6c 64 0a parent -> child.
1940: 0a 09 49 6e 69 74 69 61 6c 69 7a 65 42 72 65 61 ..InitializeBrea
1950: 6b 53 74 61 74 65 20 24 6d 79 69 74 65 6d 73 0a kState $myitems.
1960: 0a 09 73 65 74 20 66 72 61 67 6d 65 6e 74 73 20 ..set fragments
1970: 7b 7d 0a 09 73 65 74 20 6e 65 77 20 20 20 20 20 {}..set new
1980: 20 20 5b 6c 69 73 74 20 24 72 61 6e 67 65 5d 0a [list $range].
1990: 09 61 72 72 61 79 20 73 65 74 20 62 72 65 61 6b .array set break
19a0: 73 20 7b 7d 0a 0a 09 23 20 49 6e 73 74 65 61 64 s {}...# Instead
19b0: 20 6f 66 20 6f 6e 65 20 6c 69 73 74 20 68 6f 6c of one list hol
19c0: 64 69 6e 67 20 62 6f 74 68 20 70 72 6f 63 65 73 ding both proces
19d0: 73 65 64 20 61 6e 64 20 70 65 6e 64 69 6e 67 0a sed and pending.
19e0: 09 23 20 66 72 61 67 6d 65 6e 74 73 20 77 65 20 .# fragments we
19f0: 75 73 65 20 74 77 6f 2c 20 6f 6e 65 20 66 6f 72 use two, one for
1a00: 20 74 68 65 20 66 72 61 6d 65 6e 74 73 20 74 6f the framents to
1a10: 20 70 72 6f 63 65 73 73 2c 20 6f 6e 65 0a 09 23 process, one..#
1a20: 20 74 6f 20 68 6f 6c 64 20 74 68 65 20 6e 65 77 to hold the new
1a30: 20 66 72 61 67 6d 65 6e 74 73 2c 20 61 6e 64 20 fragments, and
1a40: 74 68 65 20 6c 61 74 74 65 72 20 69 73 20 63 6f the latter is co
1a50: 70 69 65 64 20 74 6f 20 74 68 65 0a 09 23 20 66 pied to the..# f
1a60: 6f 72 6d 65 72 20 77 68 65 6e 20 74 68 65 79 20 ormer when they
1a70: 72 75 6e 20 6f 75 74 2e 20 54 68 69 73 20 6b 65 run out. This ke
1a80: 65 70 73 20 74 68 65 20 6c 69 73 74 20 6f 66 20 eps the list of
1a90: 70 65 6e 64 69 6e 67 0a 09 23 20 66 72 61 67 6d pending..# fragm
1aa0: 65 6e 74 73 20 73 68 6f 72 74 20 77 69 74 68 6f ents short witho
1ab0: 75 74 20 73 61 63 72 69 66 69 63 69 6e 67 20 73 ut sacrificing s
1ac0: 70 65 65 64 20 62 79 20 73 68 69 66 74 69 6e 67 peed by shifting
1ad0: 20 73 74 75 66 66 0a 09 23 20 64 6f 77 6e 2e 20 stuff..# down.
1ae0: 57 65 20 65 73 70 65 63 69 61 6c 6c 79 20 64 72 We especially dr
1af0: 6f 70 20 74 68 65 20 6d 65 6d 6f 72 79 20 6f 66 op the memory of
1b00: 20 66 72 61 67 6d 65 6e 74 73 20 62 72 6f 6b 65 fragments broke
1b10: 6e 0a 09 23 20 64 75 72 69 6e 67 20 70 72 6f 63 n..# during proc
1b20: 65 73 73 69 6e 67 20 61 66 74 65 72 20 61 20 73 essing after a s
1b30: 68 6f 72 74 20 74 69 6d 65 2c 20 69 6e 73 74 65 hort time, inste
1b40: 61 64 20 6f 66 20 6c 65 74 74 69 6e 67 20 69 74 ad of letting it
1b50: 0a 09 23 20 63 6f 6e 73 75 6d 65 20 6d 65 6d 6f ..# consume memo
1b60: 72 79 2e 0a 0a 09 77 68 69 6c 65 20 7b 5b 6c 6c ry....while {[ll
1b70: 65 6e 67 74 68 20 24 6e 65 77 5d 7d 20 7b 0a 0a ength $new]} {..
1b80: 09 20 20 20 20 73 65 74 20 70 65 6e 64 69 6e 67 . set pending
1b90: 20 24 6e 65 77 0a 09 20 20 20 20 73 65 74 20 6e $new.. set n
1ba0: 65 77 20 20 20 20 20 7b 7d 0a 09 20 20 20 20 73 ew {}.. s
1bb0: 65 74 20 61 74 20 20 20 20 20 20 30 0a 0a 09 20 et at 0...
1bc0: 20 20 20 77 68 69 6c 65 20 7b 24 61 74 20 3c 20 while {$at <
1bd0: 5b 6c 6c 65 6e 67 74 68 20 24 70 65 6e 64 69 6e [llength $pendin
1be0: 67 5d 7d 20 7b 0a 09 09 73 65 74 20 63 75 72 72 g]} {...set curr
1bf0: 65 6e 74 20 5b 6c 69 6e 64 65 78 20 24 70 65 6e ent [lindex $pen
1c00: 64 69 6e 67 20 24 61 74 5d 0a 0a 09 09 6c 6f 67 ding $at]....log
1c10: 20 77 72 69 74 65 20 36 20 63 73 65 74 73 20 7b write 6 csets {
1c20: 2e 20 2e 20 2e 2e 20 2e 2e 2e 20 2e 2e 2e 2e 2e . . .. ... .....
1c30: 20 2e 2e 2e 2e 2e 2e 2e 2e 20 2e 2e 2e 2e 2e 2e ........ ......
1c40: 2e 2e 2e 2e 2e 2e 2e 7d 0a 09 09 6c 6f 67 20 77 .......}...log w
1c50: 72 69 74 65 20 36 20 63 73 65 74 73 20 7b 53 63 rite 6 csets {Sc
1c60: 68 65 64 75 6c 65 64 20 20 20 5b 6a 6f 69 6e 20 heduled [join
1c70: 5b 50 52 73 20 5b 6c 72 61 6e 67 65 20 24 70 65 [PRs [lrange $pe
1c80: 6e 64 69 6e 67 20 24 61 74 20 65 6e 64 5d 5d 20 nding $at end]]
1c90: 7b 20 7d 5d 7d 0a 09 09 6c 6f 67 20 77 72 69 74 { }]}...log writ
1ca0: 65 20 36 20 63 73 65 74 73 20 7b 43 6f 6e 73 69 e 6 csets {Consi
1cb0: 64 65 72 69 6e 67 20 5b 50 52 20 24 63 75 72 72 dering [PR $curr
1cc0: 65 6e 74 5d 20 5c 5b 24 61 74 2f 5b 6c 6c 65 6e ent] \[$at/[llen
1cd0: 67 74 68 20 24 70 65 6e 64 69 6e 67 5d 5c 5d 7d gth $pending]\]}
1ce0: 0a 0a 09 09 73 65 74 20 62 65 73 74 20 5b 46 69 ....set best [Fi
1cf0: 6e 64 42 65 73 74 42 72 65 61 6b 20 24 63 75 72 ndBestBreak $cur
1d00: 72 65 6e 74 5d 0a 0a 09 09 69 66 20 7b 24 62 65 rent]....if {$be
1d10: 73 74 20 3c 20 30 7d 20 7b 0a 09 09 20 20 20 20 st < 0} {...
1d20: 23 20 54 68 65 20 69 6e 73 70 65 63 74 65 64 20 # The inspected
1d30: 72 61 6e 67 65 20 68 61 73 20 6e 6f 20 69 6e 74 range has no int
1d40: 65 72 6e 61 6c 0a 09 09 20 20 20 20 23 20 64 65 ernal... # de
1d50: 70 65 6e 64 65 6e 63 69 65 73 2e 20 54 68 69 73 pendencies. This
1d60: 20 69 73 20 61 20 63 6f 6d 70 6c 65 74 65 20 66 is a complete f
1d70: 72 61 67 6d 65 6e 74 2e 0a 09 09 20 20 20 20 6c ragment.... l
1d80: 61 70 70 65 6e 64 20 66 72 61 67 6d 65 6e 74 73 append fragments
1d90: 20 24 63 75 72 72 65 6e 74 0a 0a 09 09 20 20 20 $current....
1da0: 20 6c 6f 67 20 77 72 69 74 65 20 36 20 63 73 65 log write 6 cse
1db0: 74 73 20 22 4e 6f 20 62 72 65 61 6b 73 2c 20 66 ts "No breaks, f
1dc0: 69 6e 61 6c 22 0a 09 09 7d 20 65 6c 73 65 20 7b inal"...} else {
1dd0: 0a 09 09 20 20 20 20 23 20 53 70 6c 69 74 20 74 ... # Split t
1de0: 68 65 20 72 61 6e 67 65 20 61 6e 64 20 73 63 68 he range and sch
1df0: 65 64 75 6c 65 20 74 68 65 20 72 65 73 75 6c 74 edule the result
1e00: 69 6e 67 0a 09 09 20 20 20 20 23 20 66 72 61 67 ing... # frag
1e10: 6d 65 6e 74 73 20 66 6f 72 20 66 75 72 74 68 65 ments for furthe
1e20: 72 20 69 6e 73 70 65 63 74 69 6f 6e 2e 20 52 65 r inspection. Re
1e30: 6d 65 6d 62 65 72 20 74 68 65 0a 09 09 20 20 20 member the...
1e40: 20 23 20 6e 75 6d 62 65 72 20 6f 66 20 64 65 70 # number of dep
1e50: 65 6e 64 65 6e 63 69 65 73 20 63 75 74 20 62 65 endencies cut be
1e60: 66 6f 72 65 20 77 65 20 72 65 6d 6f 76 65 20 74 fore we remove t
1e70: 68 65 6d 0a 09 09 20 20 20 20 23 20 66 72 6f 6d hem... # from
1e80: 20 63 6f 6e 73 69 64 65 72 61 74 69 6f 6e 2c 20 consideration,
1e90: 66 6f 72 20 64 6f 63 75 6d 65 6e 74 61 74 69 6f for documentatio
1ea0: 6e 20 6c 61 74 65 72 2e 0a 0a 09 09 20 20 20 20 n later.....
1eb0: 73 65 74 20 62 72 65 61 6b 73 28 24 62 65 73 74 set breaks($best
1ec0: 29 20 24 63 72 6f 73 73 28 24 62 65 73 74 29 0a ) $cross($best).
1ed0: 0a 09 09 20 20 20 20 6c 6f 67 20 77 72 69 74 65 ... log write
1ee0: 20 36 20 63 73 65 74 73 20 22 42 65 73 74 20 62 6 csets "Best b
1ef0: 72 65 61 6b 20 40 20 24 62 65 73 74 2c 20 63 75 reak @ $best, cu
1f00: 74 74 69 6e 67 20 5b 6e 73 70 20 24 63 72 6f 73 tting [nsp $cros
1f10: 73 28 24 62 65 73 74 29 20 64 65 70 65 6e 64 65 s($best) depende
1f20: 6e 63 79 20 64 65 70 65 6e 64 65 6e 63 69 65 73 ncy dependencies
1f30: 5d 22 0a 0a 09 09 20 20 20 20 23 20 4e 6f 74 65 ]".... # Note
1f40: 3a 20 54 68 65 20 76 61 6c 75 65 20 6f 66 20 62 : The value of b
1f50: 65 73 74 20 69 73 20 61 6e 20 61 62 6f 6c 75 74 est is an abolut
1f60: 65 20 6c 6f 63 61 74 69 6f 6e 0a 09 09 20 20 20 e location...
1f70: 20 23 20 69 6e 20 6d 79 69 74 65 6d 73 2e 20 55 # in myitems. U
1f80: 73 65 20 74 68 65 20 73 74 61 72 74 20 6f 66 20 se the start of
1f90: 63 75 72 72 65 6e 74 20 74 6f 20 6d 61 6b 65 20 current to make
1fa0: 69 74 0a 09 09 20 20 20 20 23 20 61 6e 20 69 6e it... # an in
1fb0: 64 65 78 20 61 62 73 6f 6c 75 74 65 20 74 6f 20 dex absolute to
1fc0: 63 75 72 72 65 6e 74 2e 0a 0a 09 09 20 20 20 20 current.....
1fd0: 73 65 74 20 62 72 65 6c 20 5b 65 78 70 72 20 7b set brel [expr {
1fe0: 24 62 65 73 74 20 2d 20 5b 6c 69 6e 64 65 78 20 $best - [lindex
1ff0: 24 63 75 72 72 65 6e 74 20 30 5d 7d 5d 0a 09 09 $current 0]}]...
2000: 20 20 20 20 73 65 74 20 62 6e 65 78 74 20 24 62 set bnext $b
2010: 72 65 6c 20 3b 20 69 6e 63 72 20 62 6e 65 78 74 rel ; incr bnext
2020: 0a 09 09 20 20 20 20 73 65 74 20 66 72 61 67 62 ... set fragb
2030: 65 66 6f 72 65 20 5b 6c 72 61 6e 67 65 20 24 63 efore [lrange $c
2040: 75 72 72 65 6e 74 20 30 20 24 62 72 65 6c 5d 0a urrent 0 $brel].
2050: 09 09 20 20 20 20 73 65 74 20 66 72 61 67 61 66 .. set fragaf
2060: 74 65 72 20 20 5b 6c 72 61 6e 67 65 20 24 63 75 ter [lrange $cu
2070: 72 72 65 6e 74 20 24 62 6e 65 78 74 20 65 6e 64 rrent $bnext end
2080: 5d 0a 0a 09 09 20 20 20 20 6c 6f 67 20 77 72 69 ].... log wri
2090: 74 65 20 36 20 63 73 65 74 73 20 22 4e 65 77 20 te 6 csets "New
20a0: 70 69 65 63 65 73 20 20 5b 50 52 20 24 66 72 61 pieces [PR $fra
20b0: 67 62 65 66 6f 72 65 5d 20 5b 50 52 20 24 66 72 gbefore] [PR $fr
20c0: 61 67 61 66 74 65 72 5d 22 0a 0a 09 09 20 20 20 agafter]"....
20d0: 20 69 6e 74 65 67 72 69 74 79 20 61 73 73 65 72 integrity asser
20e0: 74 20 7b 5b 6c 6c 65 6e 67 74 68 20 24 66 72 61 t {[llength $fra
20f0: 67 62 65 66 6f 72 65 5d 7d 20 7b 46 6f 75 6e 64 gbefore]} {Found
2100: 20 7a 65 72 6f 2d 6c 65 6e 67 74 68 20 66 72 61 zero-length fra
2110: 67 6d 65 6e 74 20 61 74 20 74 68 65 20 62 65 67 gment at the beg
2120: 69 6e 6e 69 6e 67 7d 0a 09 09 20 20 20 20 69 6e inning}... in
2130: 74 65 67 72 69 74 79 20 61 73 73 65 72 74 20 7b tegrity assert {
2140: 5b 6c 6c 65 6e 67 74 68 20 24 66 72 61 67 61 66 [llength $fragaf
2150: 74 65 72 5d 7d 20 20 7b 46 6f 75 6e 64 20 7a 65 ter]} {Found ze
2160: 72 6f 2d 6c 65 6e 67 74 68 20 66 72 61 67 6d 65 ro-length fragme
2170: 6e 74 20 61 74 20 74 68 65 20 65 6e 64 7d 0a 0a nt at the end}..
2180: 09 09 20 20 20 20 6c 61 70 70 65 6e 64 20 6e 65 .. lappend ne
2190: 77 20 24 66 72 61 67 62 65 66 6f 72 65 20 24 66 w $fragbefore $f
21a0: 72 61 67 61 66 74 65 72 0a 09 09 20 20 20 20 43 ragafter... C
21b0: 75 74 41 74 20 24 62 65 73 74 0a 09 09 7d 0a 0a utAt $best...}..
21c0: 09 09 69 6e 63 72 20 61 74 0a 09 20 20 20 20 7d ..incr at.. }
21d0: 0a 09 7d 0a 0a 09 6c 6f 67 20 77 72 69 74 65 20 ..}...log write
21e0: 36 20 63 73 65 74 73 20 22 2e 20 2e 20 2e 2e 20 6 csets ". . ..
21f0: 2e 2e 2e 20 2e 2e 2e 2e 2e 20 2e 2e 2e 2e 2e 2e ... ..... ......
2200: 2e 2e 20 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e .. .............
2210: 22 0a 0a 09 23 20 28 2a 29 20 57 65 20 63 6c 65 "...# (*) We cle
2220: 61 72 20 6f 75 74 20 74 68 65 20 61 73 73 6f 63 ar out the assoc
2230: 69 61 74 65 64 20 70 61 72 74 20 6f 66 20 74 68 iated part of th
2240: 65 20 6d 79 69 74 65 6d 6d 61 70 0a 09 23 20 69 e myitemmap..# i
2250: 6e 2d 6d 65 6d 6f 72 79 20 69 6e 64 65 78 20 69 n-memory index i
2260: 6e 20 70 72 65 70 61 72 61 74 69 6f 6e 20 66 6f n preparation fo
2270: 72 20 6e 65 77 20 64 61 74 61 2e 20 41 20 73 69 r new data. A si
2280: 6d 70 6c 65 20 75 6e 73 65 74 0a 09 23 20 69 73 mple unset..# is
2290: 20 65 6e 6f 75 67 68 2c 20 77 65 20 68 61 76 65 enough, we have
22a0: 20 6e 6f 20 73 79 6d 62 6f 6c 20 63 68 61 6e 67 no symbol chang
22b0: 65 73 65 74 73 20 61 74 20 74 68 69 73 20 74 69 esets at this ti
22c0: 6d 65 2c 20 61 6e 64 0a 09 23 20 74 68 75 73 20 me, and..# thus
22d0: 6e 65 76 65 72 20 6d 6f 72 65 20 74 68 61 6e 20 never more than
22e0: 6f 6e 65 20 72 65 66 65 72 65 6e 63 65 20 69 6e one reference in
22f0: 20 74 68 65 20 6c 69 73 74 2e 0a 0a 09 66 6f 72 the list....for
2300: 65 61 63 68 20 69 69 64 20 24 6d 79 69 74 65 6d each iid $myitem
2310: 73 20 7b 0a 09 20 20 20 20 73 65 74 20 6b 65 79 s {.. set key
2320: 20 5b 6c 69 73 74 20 24 6d 79 74 79 70 65 20 24 [list $mytype $
2330: 69 69 64 5d 0a 09 20 20 20 20 75 6e 73 65 74 20 iid].. unset
2340: 6d 79 69 74 65 6d 6d 61 70 28 24 6b 65 79 29 0a myitemmap($key).
2350: 09 20 20 20 20 6c 6f 67 20 77 72 69 74 65 20 38 . log write 8
2360: 20 63 73 65 74 73 20 7b 4d 41 50 2d 20 69 74 65 csets {MAP- ite
2370: 6d 20 3c 24 6b 65 79 3e 20 24 73 65 6c 66 20 3d m <$key> $self =
2380: 20 5b 24 73 65 6c 66 20 73 74 72 5d 7d 0a 09 7d [$self str]}..}
2390: 0a 0a 09 23 20 43 72 65 61 74 65 20 63 68 61 6e ...# Create chan
23a0: 67 65 73 65 74 73 20 66 6f 72 20 74 68 65 20 66 gesets for the f
23b0: 72 61 67 6d 65 6e 74 73 2c 20 72 65 75 73 69 6e ragments, reusin
23c0: 67 20 74 68 65 20 63 75 72 72 65 6e 74 20 6f 6e g the current on
23d0: 65 0a 09 23 20 66 6f 72 20 74 68 65 20 66 69 72 e..# for the fir
23e0: 73 74 20 66 72 61 67 6d 65 6e 74 2e 20 57 65 20 st fragment. We
23f0: 73 6f 72 74 20 74 68 65 6d 20 69 6e 20 6f 72 64 sort them in ord
2400: 65 72 20 74 6f 20 61 6c 6c 6f 77 0a 09 23 20 63 er to allow..# c
2410: 68 65 63 6b 69 6e 67 20 66 6f 72 20 67 61 70 73 hecking for gaps
2420: 20 61 6e 64 20 6e 69 63 65 20 6d 65 73 73 61 67 and nice messag
2430: 65 73 2e 0a 0a 09 73 65 74 20 66 72 61 67 6d 65 es....set fragme
2440: 6e 74 73 20 5b 6c 73 6f 72 74 20 2d 69 6e 64 65 nts [lsort -inde
2450: 78 20 30 20 2d 69 6e 74 65 67 65 72 20 24 66 72 x 0 -integer $fr
2460: 61 67 6d 65 6e 74 73 5d 0a 0a 09 23 70 75 74 73 agments]...#puts
2470: 20 5c 74 2e 5b 6a 6f 69 6e 20 5b 50 52 73 20 24 \t.[join [PRs $
2480: 66 72 61 67 6d 65 6e 74 73 5d 20 2e 5c 6e 5c 74 fragments] .\n\t
2490: 2e 5d 2e 0a 0a 09 42 6f 72 64 65 72 20 5b 6c 69 .]....Border [li
24a0: 6e 64 65 78 20 24 66 72 61 67 6d 65 6e 74 73 20 ndex $fragments
24b0: 30 5d 20 66 69 72 73 74 73 20 66 69 72 73 74 65 0] firsts firste
24c0: 0a 0a 09 69 6e 74 65 67 72 69 74 79 20 61 73 73 ...integrity ass
24d0: 65 72 74 20 7b 24 66 69 72 73 74 73 20 3d 3d 20 ert {$firsts ==
24e0: 30 7d 20 7b 42 61 64 20 66 72 61 67 6d 65 6e 74 0} {Bad fragment
24f0: 20 73 74 61 72 74 20 40 20 24 66 69 72 73 74 73 start @ $firsts
2500: 2c 20 67 61 70 2c 20 6f 72 20 62 65 66 6f 72 65 , gap, or before
2510: 20 62 65 67 69 6e 6e 69 6e 67 20 6f 66 20 74 68 beginning of th
2520: 65 20 72 61 6e 67 65 7d 0a 0a 09 73 65 74 20 6c e range}...set l
2530: 61 73 74 65 20 24 66 69 72 73 74 65 0a 09 66 6f aste $firste..fo
2540: 72 65 61 63 68 20 66 72 61 67 6d 65 6e 74 20 5b reach fragment [
2550: 6c 72 61 6e 67 65 20 24 66 72 61 67 6d 65 6e 74 lrange $fragment
2560: 73 20 31 20 65 6e 64 5d 20 7b 0a 09 20 20 20 20 s 1 end] {..
2570: 42 6f 72 64 65 72 20 24 66 72 61 67 6d 65 6e 74 Border $fragment
2580: 20 73 20 65 0a 09 20 20 20 20 69 6e 74 65 67 72 s e.. integr
2590: 69 74 79 20 61 73 73 65 72 74 20 7b 24 6c 61 73 ity assert {$las
25a0: 74 65 20 3d 3d 20 28 24 73 20 2d 20 31 29 7d 20 te == ($s - 1)}
25b0: 7b 42 61 64 20 66 72 61 67 6d 65 6e 74 20 62 6f {Bad fragment bo
25c0: 72 64 65 72 20 3c 24 6c 61 73 74 65 20 7c 20 24 rder <$laste | $
25d0: 73 3e 2c 20 67 61 70 20 6f 72 20 6f 76 65 72 6c s>, gap or overl
25e0: 61 70 7d 0a 0a 09 20 20 20 20 73 65 74 20 6e 65 ap}... set ne
25f0: 77 20 5b 24 74 79 70 65 20 25 41 55 54 4f 25 20 w [$type %AUTO%
2600: 24 6d 79 70 72 6f 6a 65 63 74 20 24 6d 79 74 79 $myproject $myty
2610: 70 65 20 24 6d 79 73 72 63 69 64 20 5b 6c 72 61 pe $mysrcid [lra
2620: 6e 67 65 20 24 6d 79 69 74 65 6d 73 20 24 73 20 nge $myitems $s
2630: 24 65 5d 5d 0a 0a 20 20 20 20 20 20 20 20 20 20 $e]]..
2640: 20 20 6c 6f 67 20 77 72 69 74 65 20 34 20 63 73 log write 4 cs
2650: 65 74 73 20 22 42 72 65 61 6b 69 6e 67 20 5b 24 ets "Breaking [$
2660: 73 65 6c 66 20 73 74 72 20 5d 20 40 20 24 6c 61 self str ] @ $la
2670: 73 74 65 2c 20 6e 65 77 20 5b 24 6e 65 77 20 73 ste, new [$new s
2680: 74 72 5d 2c 20 63 75 74 74 69 6e 67 20 24 62 72 tr], cutting $br
2690: 65 61 6b 73 28 24 6c 61 73 74 65 29 22 0a 0a 09 eaks($laste)"...
26a0: 20 20 20 20 73 65 74 20 6c 61 73 74 65 20 24 65 set laste $e
26b0: 0a 09 7d 0a 0a 09 69 6e 74 65 67 72 69 74 79 20 ..}...integrity
26c0: 61 73 73 65 72 74 20 7b 0a 09 20 20 20 20 24 6c assert {.. $l
26d0: 61 73 74 65 20 3d 3d 20 28 5b 6c 6c 65 6e 67 74 aste == ([llengt
26e0: 68 20 24 6d 79 69 74 65 6d 73 5d 2d 31 29 0a 09 h $myitems]-1)..
26f0: 7d 20 7b 42 61 64 20 66 72 61 67 6d 65 6e 74 20 } {Bad fragment
2700: 65 6e 64 20 40 20 24 6c 61 73 74 65 2c 20 67 61 end @ $laste, ga
2710: 70 2c 20 6f 72 20 62 65 79 6f 6e 64 20 65 6e 64 p, or beyond end
2720: 20 6f 66 20 74 68 65 20 72 61 6e 67 65 7d 0a 0a of the range}..
2730: 09 23 20 50 75 74 20 74 68 65 20 66 69 72 73 74 .# Put the first
2740: 20 66 72 61 67 6d 65 6e 74 20 69 6e 74 6f 20 74 fragment into t
2750: 68 65 20 63 75 72 72 65 6e 74 20 63 68 61 6e 67 he current chang
2760: 65 73 65 74 2c 20 61 6e 64 0a 09 23 20 75 70 64 eset, and..# upd
2770: 61 74 65 20 74 68 65 20 69 6e 2d 6d 65 6d 6f 72 ate the in-memor
2780: 79 20 69 6e 64 65 78 2e 20 57 65 20 63 61 6e 20 y index. We can
2790: 73 69 6d 70 6c 79 20 28 72 65 29 61 64 64 20 74 simply (re)add t
27a0: 68 65 20 69 74 65 6d 73 0a 09 23 20 62 65 63 61 he items..# beca
27b0: 75 73 65 20 77 65 20 63 6c 65 61 72 65 64 20 74 use we cleared t
27c0: 68 65 20 70 72 65 76 69 6f 75 73 6c 79 20 65 78 he previously ex
27d0: 69 73 74 69 6e 67 20 69 6e 66 6f 72 6d 61 74 69 isting informati
27e0: 6f 6e 2c 20 73 65 65 0a 09 23 20 28 2a 29 20 61 on, see..# (*) a
27f0: 62 6f 76 65 2e 20 50 65 72 73 69 73 74 65 6e 63 bove. Persistenc
2800: 65 20 64 6f 65 73 20 6e 6f 74 20 6d 61 74 74 65 e does not matte
2810: 72 20 68 65 72 65 2c 20 6e 6f 6e 65 20 6f 66 20 r here, none of
2820: 74 68 65 0a 09 23 20 63 68 61 6e 67 65 73 65 74 the..# changeset
2830: 73 20 68 61 73 20 62 65 65 6e 20 73 61 76 65 64 s has been saved
2840: 20 74 6f 20 74 68 65 20 70 65 72 73 69 73 74 65 to the persiste
2850: 6e 74 20 73 74 61 74 65 20 79 65 74 2e 0a 0a 09 nt state yet....
2860: 73 65 74 20 6d 79 69 74 65 6d 73 20 20 5b 6c 72 set myitems [lr
2870: 61 6e 67 65 20 24 6d 79 69 74 65 6d 73 20 20 30 ange $myitems 0
2880: 20 24 66 69 72 73 74 65 5d 0a 09 73 65 74 20 6d $firste]..set m
2890: 79 74 69 74 65 6d 73 20 5b 6c 72 61 6e 67 65 20 ytitems [lrange
28a0: 24 6d 79 74 69 74 65 6d 73 20 30 20 24 66 69 72 $mytitems 0 $fir
28b0: 73 74 65 5d 0a 09 66 6f 72 65 61 63 68 20 69 69 ste]..foreach ii
28c0: 64 20 24 6d 79 69 74 65 6d 73 20 7b 0a 09 20 20 d $myitems {..
28d0: 20 20 73 65 74 20 6b 65 79 20 5b 6c 69 73 74 20 set key [list
28e0: 24 6d 79 74 79 70 65 20 24 69 69 64 5d 0a 09 20 $mytype $iid]..
28f0: 20 20 20 73 65 74 20 6d 79 69 74 65 6d 6d 61 70 set myitemmap
2900: 28 24 6b 65 79 29 20 24 73 65 6c 66 0a 09 20 20 ($key) $self..
2910: 20 20 6c 6f 67 20 77 72 69 74 65 20 38 20 63 73 log write 8 cs
2920: 65 74 73 20 7b 4d 41 50 2b 20 69 74 65 6d 20 3c ets {MAP+ item <
2930: 24 6b 65 79 3e 20 24 73 65 6c 66 20 3d 20 5b 24 $key> $self = [$
2940: 73 65 6c 66 20 73 74 72 5d 7d 0a 09 7d 0a 0a 09 self str]}..}...
2950: 72 65 74 75 72 6e 20 31 0a 20 20 20 20 7d 0a 0a return 1. }..
2960: 20 20 20 20 6d 65 74 68 6f 64 20 70 65 72 73 69 method persi
2970: 73 74 20 7b 7d 20 7b 0a 09 73 65 74 20 74 69 64 st {} {..set tid
2980: 20 24 6d 79 63 73 74 79 70 65 28 24 6d 79 74 79 $mycstype($myty
2990: 70 65 29 0a 09 73 65 74 20 70 69 64 20 5b 24 6d pe)..set pid [$m
29a0: 79 70 72 6f 6a 65 63 74 20 69 64 5d 0a 09 73 65 yproject id]..se
29b0: 74 20 70 6f 73 20 30 0a 0a 09 73 74 61 74 65 20 t pos 0...state
29c0: 74 72 61 6e 73 61 63 74 69 6f 6e 20 7b 0a 09 20 transaction {..
29d0: 20 20 20 73 74 61 74 65 20 72 75 6e 20 7b 0a 09 state run {..
29e0: 09 49 4e 53 45 52 54 20 49 4e 54 4f 20 63 68 61 .INSERT INTO cha
29f0: 6e 67 65 73 65 74 20 28 63 69 64 2c 20 20 20 70 ngeset (cid, p
2a00: 69 64 2c 20 20 74 79 70 65 2c 20 73 72 63 29 0a id, type, src).
2a10: 09 09 56 41 4c 55 45 53 20 20 20 20 20 20 20 20 ..VALUES
2a20: 20 20 20 20 20 20 20 20 28 24 6d 79 69 64 2c 20 ($myid,
2a30: 24 70 69 64 2c 20 24 74 69 64 2c 20 24 6d 79 73 $pid, $tid, $mys
2a40: 72 63 69 64 29 3b 0a 09 20 20 20 20 7d 0a 0a 09 rcid);.. }...
2a50: 20 20 20 20 66 6f 72 65 61 63 68 20 69 69 64 20 foreach iid
2a60: 24 6d 79 69 74 65 6d 73 20 7b 0a 09 09 73 74 61 $myitems {...sta
2a70: 74 65 20 72 75 6e 20 7b 0a 09 09 20 20 20 20 49 te run {... I
2a80: 4e 53 45 52 54 20 49 4e 54 4f 20 63 73 69 74 65 NSERT INTO csite
2a90: 6d 20 28 63 69 64 2c 20 20 20 70 6f 73 2c 20 20 m (cid, pos,
2aa0: 69 69 64 29 0a 09 09 20 20 20 20 56 41 4c 55 45 iid)... VALUE
2ab0: 53 20 20 20 20 20 20 20 20 20 20 20 20 20 28 24 S ($
2ac0: 6d 79 69 64 2c 20 24 70 6f 73 2c 20 24 69 69 64 myid, $pos, $iid
2ad0: 29 3b 0a 09 09 7d 0a 09 09 69 6e 63 72 20 70 6f );...}...incr po
2ae0: 73 0a 09 20 20 20 20 7d 0a 09 7d 0a 09 72 65 74 s.. }..}..ret
2af0: 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 6d urn. }.. m
2b00: 65 74 68 6f 64 20 74 69 6d 65 72 61 6e 67 65 20 ethod timerange
2b10: 7b 7d 20 7b 20 72 65 74 75 72 6e 20 5b 24 6d 79 {} { return [$my
2b20: 74 79 70 65 6f 62 6a 20 74 69 6d 65 72 61 6e 67 typeobj timerang
2b30: 65 20 24 6d 79 69 74 65 6d 73 5d 20 7d 0a 0a 20 e $myitems] }..
2b40: 20 20 20 6d 65 74 68 6f 64 20 6c 69 6d 69 74 73 method limits
2b50: 20 7b 7d 20 7b 0a 09 73 74 72 75 63 74 3a 3a 6c {} {..struct::l
2b60: 69 73 74 20 61 73 73 69 67 6e 20 5b 24 6d 79 74 ist assign [$myt
2b70: 79 70 65 6f 62 6a 20 6c 69 6d 69 74 73 20 24 6d ypeobj limits $m
2b80: 79 69 74 65 6d 73 5d 20 6d 61 78 70 20 6d 69 6e yitems] maxp min
2b90: 73 0a 09 72 65 74 75 72 6e 20 5b 6c 69 73 74 20 s..return [list
2ba0: 5b 54 61 67 49 74 65 6d 44 69 63 74 20 24 6d 61 [TagItemDict $ma
2bb0: 78 70 20 24 6d 79 74 79 70 65 5d 20 5b 54 61 67 xp $mytype] [Tag
2bc0: 49 74 65 6d 44 69 63 74 20 24 6d 69 6e 73 20 24 ItemDict $mins $
2bd0: 6d 79 74 79 70 65 5d 5d 0a 20 20 20 20 7d 0a 0a mytype]]. }..
2be0: 20 20 20 20 6d 65 74 68 6f 64 20 64 72 6f 70 20 method drop
2bf0: 7b 7d 20 7b 0a 09 6c 6f 67 20 77 72 69 74 65 20 {} {..log write
2c00: 38 20 63 73 65 74 73 20 7b 44 72 6f 70 70 69 6e 8 csets {Droppin
2c10: 67 20 24 73 65 6c 66 20 3d 20 5b 24 73 65 6c 66 g $self = [$self
2c20: 20 73 74 72 5d 7d 0a 0a 09 73 74 61 74 65 20 74 str]}...state t
2c30: 72 61 6e 73 61 63 74 69 6f 6e 20 7b 0a 09 20 20 ransaction {..
2c40: 20 20 73 74 61 74 65 20 72 75 6e 20 7b 0a 09 09 state run {...
2c50: 44 45 4c 45 54 45 20 46 52 4f 4d 20 63 68 61 6e DELETE FROM chan
2c60: 67 65 73 65 74 20 20 20 57 48 45 52 45 20 63 69 geset WHERE ci
2c70: 64 20 3d 20 24 6d 79 69 64 3b 0a 09 09 44 45 4c d = $myid;...DEL
2c80: 45 54 45 20 46 52 4f 4d 20 63 73 69 74 65 6d 20 ETE FROM csitem
2c90: 20 20 20 20 20 57 48 45 52 45 20 63 69 64 20 3d WHERE cid =
2ca0: 20 24 6d 79 69 64 3b 0a 09 09 44 45 4c 45 54 45 $myid;...DELETE
2cb0: 20 46 52 4f 4d 20 63 73 73 75 63 63 65 73 73 6f FROM cssuccesso
2cc0: 72 20 57 48 45 52 45 20 63 69 64 20 3d 20 24 6d r WHERE cid = $m
2cd0: 79 69 64 3b 0a 09 20 20 20 20 7d 0a 09 7d 0a 09 yid;.. }..}..
2ce0: 66 6f 72 65 61 63 68 20 69 69 64 20 24 6d 79 69 foreach iid $myi
2cf0: 74 65 6d 73 20 7b 0a 09 20 20 20 20 73 65 74 20 tems {.. set
2d00: 6b 65 79 20 5b 6c 69 73 74 20 24 6d 79 74 79 70 key [list $mytyp
2d10: 65 20 24 69 69 64 5d 0a 09 20 20 20 20 75 6e 73 e $iid].. uns
2d20: 65 74 20 6d 79 69 74 65 6d 6d 61 70 28 24 6b 65 et myitemmap($ke
2d30: 79 29 0a 09 20 20 20 20 6c 6f 67 20 77 72 69 74 y).. log writ
2d40: 65 20 38 20 63 73 65 74 73 20 7b 4d 41 50 2d 20 e 8 csets {MAP-
2d50: 69 74 65 6d 20 3c 24 6b 65 79 3e 20 24 73 65 6c item <$key> $sel
2d60: 66 20 3d 20 5b 24 73 65 6c 66 20 73 74 72 5d 7d f = [$self str]}
2d70: 0a 09 7d 0a 09 73 65 74 20 70 6f 73 20 20 20 20 ..}..set pos
2d80: 20 20 20 20 20 20 5b 6c 73 65 61 72 63 68 20 2d [lsearch -
2d90: 65 78 61 63 74 20 24 6d 79 63 68 61 6e 67 65 73 exact $mychanges
2da0: 65 74 73 20 24 73 65 6c 66 5d 0a 09 73 65 74 20 ets $self]..set
2db0: 6d 79 63 68 61 6e 67 65 73 65 74 73 20 5b 6c 72 mychangesets [lr
2dc0: 65 70 6c 61 63 65 20 24 6d 79 63 68 61 6e 67 65 eplace $mychange
2dd0: 73 65 74 73 20 24 70 6f 73 20 24 70 6f 73 5d 0a sets $pos $pos].
2de0: 09 73 65 74 20 70 6f 73 20 20 20 20 20 20 20 20 .set pos
2df0: 20 20 20 20 20 20 20 20 20 20 20 20 5b 6c 73 65 [lse
2e00: 61 72 63 68 20 2d 65 78 61 63 74 20 24 6d 79 74 arch -exact $myt
2e10: 63 68 61 6e 67 65 73 65 74 73 28 24 6d 79 74 79 changesets($myty
2e20: 70 65 29 20 24 73 65 6c 66 5d 0a 09 73 65 74 20 pe) $self]..set
2e30: 6d 79 74 63 68 61 6e 67 65 73 65 74 73 28 24 6d mytchangesets($m
2e40: 79 74 79 70 65 29 20 5b 6c 72 65 70 6c 61 63 65 ytype) [lreplace
2e50: 20 24 6d 79 74 63 68 61 6e 67 65 73 65 74 73 28 $mytchangesets(
2e60: 24 6d 79 74 79 70 65 29 20 24 70 6f 73 20 24 70 $mytype) $pos $p
2e70: 6f 73 5d 0a 0a 09 23 20 52 65 74 75 72 6e 20 74 os]...# Return t
2e80: 68 65 20 6c 69 73 74 20 6f 66 20 70 72 65 64 65 he list of prede
2e90: 63 65 73 73 6f 72 73 20 73 6f 20 74 68 61 74 20 cessors so that
2ea0: 74 68 65 79 20 63 61 6e 20 62 65 20 61 64 6a 75 they can be adju
2eb0: 73 74 65 64 2e 0a 09 72 65 74 75 72 6e 20 5b 73 sted...return [s
2ec0: 74 72 75 63 74 3a 3a 6c 69 73 74 20 6d 61 70 20 truct::list map
2ed0: 5b 73 74 61 74 65 20 72 75 6e 20 7b 0a 09 20 20 [state run {..
2ee0: 20 20 53 45 4c 45 43 54 20 63 69 64 0a 09 20 20 SELECT cid..
2ef0: 20 20 46 52 4f 4d 20 20 20 63 73 73 75 63 63 65 FROM cssucce
2f00: 73 73 6f 72 0a 09 20 20 20 20 57 48 45 52 45 20 ssor.. WHERE
2f10: 20 6e 69 64 20 3d 20 24 6d 79 69 64 0a 09 7d 5d nid = $myid..}]
2f20: 20 5b 6d 79 74 79 70 65 6d 65 74 68 6f 64 20 6f [mytypemethod o
2f30: 66 5d 5d 0a 20 20 20 20 7d 0a 0a 20 20 20 20 6d f]]. }.. m
2f40: 65 74 68 6f 64 20 72 65 70 6f 72 74 6c 6f 6f 70 ethod reportloop
2f50: 20 7b 7b 6b 69 6c 6c 20 31 7d 7d 20 7b 0a 09 23 {{kill 1}} {..#
2f60: 20 57 65 20 70 72 69 6e 74 20 74 68 65 20 69 74 We print the it
2f70: 65 6d 73 20 77 68 69 63 68 20 61 72 65 20 70 72 ems which are pr
2f80: 6f 64 75 63 69 6e 67 20 74 68 65 20 6c 6f 6f 70 oducing the loop
2f90: 2c 20 61 6e 64 20 68 6f 77 2e 0a 0a 09 73 65 74 , and how....set
2fa0: 20 68 64 72 20 22 53 65 6c 66 2d 72 65 66 65 72 hdr "Self-refer
2fb0: 65 6e 74 69 61 6c 20 63 68 61 6e 67 65 73 65 74 ential changeset
2fc0: 20 5b 24 73 65 6c 66 20 73 74 72 5d 20 5f 5f 5f [$self str] ___
2fd0: 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 22 _______________"
2fe0: 0a 09 73 65 74 20 66 74 72 20 5b 72 65 67 73 75 ..set ftr [regsu
2ff0: 62 20 2d 61 6c 6c 20 7b 5b 5e 20 09 5d 7d 20 24 b -all {[^ .]} $
3000: 68 64 72 20 7b 5f 7d 5d 0a 0a 09 6c 6f 67 20 77 hdr {_}]...log w
3010: 72 69 74 65 20 30 20 63 73 65 74 73 20 24 68 64 rite 0 csets $hd
3020: 72 0a 09 66 6f 72 65 61 63 68 20 7b 69 74 65 6d r..foreach {item
3030: 20 6e 65 78 74 69 74 65 6d 7d 20 5b 24 6d 79 74 nextitem} [$myt
3040: 79 70 65 6f 62 6a 20 6c 6f 6f 70 73 20 24 6d 79 ypeobj loops $my
3050: 69 74 65 6d 73 5d 20 7b 0a 09 20 20 20 20 23 20 items] {.. #
3060: 43 72 65 61 74 65 20 74 61 67 67 65 64 20 69 74 Create tagged it
3070: 65 6d 73 20 66 72 6f 6d 20 74 68 65 20 69 64 20 ems from the id
3080: 61 6e 64 20 6f 75 72 20 74 79 70 65 2e 0a 09 20 and our type...
3090: 20 20 20 73 65 74 20 69 74 65 6d 20 20 20 20 20 set item
30a0: 5b 6c 69 73 74 20 24 6d 79 74 79 70 65 20 20 24 [list $mytype $
30b0: 69 74 65 6d 5d 0a 09 20 20 20 20 73 65 74 20 6e item].. set n
30c0: 65 78 74 69 74 65 6d 20 5b 6c 69 73 74 20 24 6d extitem [list $m
30d0: 79 74 79 70 65 20 24 6e 65 78 74 69 74 65 6d 5d ytype $nextitem]
30e0: 0a 09 20 20 20 20 23 20 50 72 69 6e 74 61 62 6c .. # Printabl
30f0: 65 20 6c 61 62 65 6c 73 2e 0a 09 20 20 20 20 73 e labels... s
3100: 65 74 20 69 20 20 22 3c 5b 24 74 79 70 65 20 69 et i "<[$type i
3110: 74 65 6d 73 74 72 20 24 69 74 65 6d 5d 3e 22 0a temstr $item]>".
3120: 09 20 20 20 20 73 65 74 20 6e 20 20 22 3c 5b 24 . set n "<[$
3130: 74 79 70 65 20 69 74 65 6d 73 74 72 20 24 6e 65 type itemstr $ne
3140: 78 74 69 74 65 6d 5d 3e 22 0a 09 20 20 20 20 73 xtitem]>".. s
3150: 65 74 20 6e 63 73 20 24 6d 79 69 74 65 6d 6d 61 et ncs $myitemma
3160: 70 28 24 6e 65 78 74 69 74 65 6d 29 0a 09 20 20 p($nextitem)..
3170: 20 20 23 20 50 72 69 6e 74 0a 09 20 20 20 20 6c # Print.. l
3180: 6f 67 20 77 72 69 74 65 20 30 20 63 73 65 74 73 og write 0 csets
3190: 20 7b 2a 20 24 69 20 2d 2d 3e 20 24 6e 20 2d 2d {* $i --> $n --
31a0: 3e 20 63 73 20 5b 24 6e 63 73 20 73 74 72 5d 7d > cs [$ncs str]}
31b0: 0a 09 7d 0a 09 6c 6f 67 20 77 72 69 74 65 20 30 ..}..log write 0
31c0: 20 63 73 65 74 73 20 24 66 74 72 0a 0a 09 69 66 csets $ftr...if
31d0: 20 7b 21 24 6b 69 6c 6c 7d 20 72 65 74 75 72 6e {!$kill} return
31e0: 0a 09 74 72 6f 75 62 6c 65 20 69 6e 74 65 72 6e ..trouble intern
31f0: 61 6c 20 22 5b 24 73 65 6c 66 20 73 74 72 5d 20 al "[$self str]
3200: 64 65 70 65 6e 64 73 20 6f 6e 20 69 74 73 65 6c depends on itsel
3210: 66 22 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 7d f"..return. }
3220: 0a 0a 20 20 20 20 6d 65 74 68 6f 64 20 70 75 73 .. method pus
3230: 68 74 6f 20 7b 72 65 70 6f 73 69 74 6f 72 79 20 hto {repository
3240: 64 61 74 65 20 72 73 74 61 74 65 7d 20 7b 0a 09 date rstate} {..
3250: 23 20 47 65 6e 65 72 61 74 65 20 61 6e 64 20 69 # Generate and i
3260: 6d 70 6f 72 74 20 74 68 65 20 6d 61 6e 69 66 65 mport the manife
3270: 73 74 20 66 6f 72 20 74 68 69 73 20 63 68 61 6e st for this chan
3280: 67 65 73 65 74 2e 0a 09 23 0a 09 23 20 44 61 74 geset...#..# Dat
3290: 61 20 6e 65 65 64 65 64 3a 0a 09 23 20 2d 20 43 a needed:..# - C
32a0: 6f 6d 6d 69 74 20 6d 65 73 73 61 67 65 20 20 20 ommit message
32b0: 20 20 20 20 20 20 20 20 20 20 20 20 28 2d 2d 20 (--
32c0: 6d 79 73 72 63 69 64 20 2d 3e 20 72 65 70 6f 73 mysrcid -> repos
32d0: 69 74 6f 72 79 20 6d 65 74 61 29 0a 09 23 20 2d itory meta)..# -
32e0: 20 55 73 65 72 20 64 6f 69 6e 67 20 74 68 65 20 User doing the
32f0: 63 6f 6d 6d 69 74 20 20 20 20 20 20 20 20 28 73 commit (s
3300: 2e 61 2e 29 0a 09 23 0a 09 23 20 2d 20 54 69 6d .a.)..#..# - Tim
3310: 65 73 74 61 6d 70 20 6f 66 20 77 68 65 6e 20 63 estamp of when c
3320: 6f 6d 6d 69 74 74 65 64 20 20 28 63 6f 6d 6d 61 ommitted (comma
3330: 6e 64 20 61 72 67 75 6d 65 6e 74 29 0a 09 23 0a nd argument)..#.
3340: 09 23 20 2d 20 54 68 65 20 70 61 72 65 6e 74 20 .# - The parent
3350: 63 68 61 6e 67 65 73 65 74 2c 20 69 66 20 61 6e changeset, if an
3360: 79 2e 20 49 66 20 74 68 65 72 65 20 69 73 20 6e y. If there is n
3370: 6f 20 70 61 72 65 6e 74 20 66 6f 73 73 69 6c 0a o parent fossil.
3380: 09 23 20 20 20 77 69 6c 6c 20 75 73 65 20 74 68 .# will use th
3390: 65 20 65 6d 70 74 79 20 62 61 73 65 20 72 65 76 e empty base rev
33a0: 69 73 69 6f 6e 20 61 73 20 70 61 72 65 6e 74 2e ision as parent.
33b0: 0a 09 23 0a 09 23 20 2d 20 4c 69 73 74 20 6f 66 ..#..# - List of
33c0: 20 74 68 65 20 66 69 6c 65 20 72 65 76 69 73 69 the file revisi
33d0: 6f 6e 73 20 69 6e 20 74 68 65 20 63 68 61 6e 67 ons in the chang
33e0: 65 73 65 74 2e 0a 0a 09 73 74 72 75 63 74 3a 3a eset....struct::
33f0: 6c 69 73 74 20 61 73 73 69 67 6e 20 5b 24 6d 79 list assign [$my
3400: 70 72 6f 6a 65 63 74 20 67 65 74 6d 65 74 61 20 project getmeta
3410: 24 6d 79 73 72 63 69 64 5d 20 5f 5f 20 5f 5f 20 $mysrcid] __ __
3420: 75 73 65 72 20 6d 65 73 73 61 67 65 0a 0a 09 23 user message...#
3430: 20 57 65 20 64 65 72 69 76 65 20 74 68 65 20 6c We derive the l
3440: 6f 64 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 64 od information d
3450: 69 72 65 63 74 6c 79 20 66 72 6f 6d 20 74 68 65 irectly from the
3460: 20 72 65 76 69 73 69 6f 6e 73 20 6f 66 0a 09 23 revisions of..#
3470: 20 74 68 65 20 63 68 61 6e 67 65 73 65 74 2c 20 the changeset,
3480: 61 73 20 74 68 65 20 62 72 61 6e 63 68 20 70 61 as the branch pa
3490: 72 74 20 6f 66 20 74 68 65 20 6d 65 74 61 20 64 rt of the meta d
34a0: 61 74 61 20 28 73 2e 61 2e 29 20 69 73 0a 09 23 ata (s.a.) is..#
34b0: 20 6f 75 74 64 61 74 65 64 20 73 69 6e 63 65 20 outdated since
34c0: 70 61 73 73 20 46 69 6c 74 65 72 53 79 6d 62 6f pass FilterSymbo
34d0: 6c 73 2e 0a 0a 09 73 65 74 20 6c 6f 64 6e 61 6d ls....set lodnam
34e0: 65 20 5b 24 73 65 6c 66 20 6c 6f 64 5d 0a 0a 09 e [$self lod]...
34f0: 6c 6f 67 20 77 72 69 74 65 20 32 20 63 73 65 74 log write 2 cset
3500: 73 20 7b 49 6d 70 6f 72 74 69 6e 67 20 72 65 76 s {Importing rev
3510: 69 73 69 6f 6e 20 5b 24 73 65 6c 66 20 73 74 72 ision [$self str
3520: 5d 20 6f 6e 20 24 6c 6f 64 6e 61 6d 65 7d 0a 0a ] on $lodname}..
3530: 09 23 20 50 65 72 66 6f 72 6d 20 74 68 65 20 69 .# Perform the i
3540: 6d 70 6f 72 74 2e 20 41 73 20 70 61 72 74 20 6f mport. As part o
3550: 66 20 74 68 61 74 20 77 65 20 64 65 74 65 72 6d f that we determ
3560: 69 6e 65 20 74 68 65 20 70 61 72 65 6e 74 0a 09 ine the parent..
3570: 23 20 77 65 20 6e 65 65 64 2c 20 61 6e 64 20 63 # we need, and c
3580: 6f 6e 76 65 72 74 20 74 68 65 20 6c 69 73 74 20 onvert the list
3590: 6f 66 20 69 74 65 6d 73 20 69 6e 20 74 68 65 20 of items in the
35a0: 63 68 61 6e 67 65 73 65 74 20 69 6e 74 6f 0a 09 changeset into..
35b0: 23 20 75 75 69 64 73 20 61 6e 64 20 70 72 69 6e # uuids and prin
35c0: 74 61 62 6c 65 20 64 61 74 61 2e 0a 0a 09 73 74 table data....st
35d0: 72 75 63 74 3a 3a 6c 69 73 74 20 61 73 73 69 67 ruct::list assig
35e0: 6e 20 5b 47 65 74 69 73 64 65 66 61 75 6c 74 20 n [Getisdefault
35f0: 24 6d 79 69 74 65 6d 73 5d 20 69 73 64 65 66 61 $myitems] isdefa
3600: 75 6c 74 20 6c 61 73 74 64 65 66 61 75 6c 74 6f ult lastdefaulto
3610: 6e 74 72 75 6e 6b 0a 0a 09 6c 6f 67 20 77 72 69 ntrunk...log wri
3620: 74 65 20 38 20 63 73 65 74 73 20 7b 4c 4f 44 20 te 8 csets {LOD
3630: 20 20 20 27 24 6c 6f 64 6e 61 6d 65 27 7d 0a 09 '$lodname'}..
3640: 6c 6f 67 20 77 72 69 74 65 20 38 20 63 73 65 74 log write 8 cset
3650: 73 20 7b 20 64 65 66 3f 20 20 24 69 73 64 65 66 s { def? $isdef
3660: 61 75 6c 74 7d 0a 09 6c 6f 67 20 77 72 69 74 65 ault}..log write
3670: 20 38 20 63 73 65 74 73 20 7b 20 6c 61 73 74 3f 8 csets { last?
3680: 20 24 6c 61 73 74 64 65 66 61 75 6c 74 6f 6e 74 $lastdefaultont
3690: 72 75 6e 6b 7d 0a 0a 09 73 65 74 20 6c 77 73 20 runk}...set lws
36a0: 20 5b 47 65 74 77 6f 72 6b 73 70 61 63 65 20 20 [Getworkspace
36b0: 20 20 24 72 73 74 61 74 65 20 24 6c 6f 64 6e 61 $rstate $lodna
36c0: 6d 65 20 24 6d 79 70 72 6f 6a 65 63 74 20 24 69 me $myproject $i
36d0: 73 64 65 66 61 75 6c 74 5d 0a 09 24 6c 77 73 20 sdefault]..$lws
36e0: 61 64 64 20 5b 47 65 74 72 65 76 69 73 69 6f 6e add [Getrevision
36f0: 69 6e 66 6f 20 24 6d 79 69 74 65 6d 73 5d 0a 0a info $myitems]..
3700: 09 73 65 74 20 75 75 69 64 20 5b 24 72 65 70 6f .set uuid [$repo
3710: 73 69 74 6f 72 79 20 69 6d 70 6f 72 74 72 65 76 sitory importrev
3720: 69 73 69 6f 6e 20 5b 24 73 65 6c 66 20 73 74 72 ision [$self str
3730: 5d 20 5c 0a 09 09 20 20 20 20 20 20 24 75 73 65 ] \... $use
3740: 72 20 24 6d 65 73 73 61 67 65 20 24 64 61 74 65 r $message $date
3750: 20 5c 0a 09 09 20 20 20 20 20 20 5b 24 6c 77 73 \... [$lws
3760: 20 67 65 74 69 64 5d 20 5b 24 6c 77 73 20 67 65 getid] [$lws ge
3770: 74 5d 5d 0a 0a 09 23 20 52 65 6d 65 6d 62 65 72 t]]...# Remember
3780: 20 74 68 65 20 69 6d 70 6f 72 74 65 64 20 63 68 the imported ch
3790: 61 6e 67 65 73 65 74 20 69 6e 20 74 68 65 20 73 angeset in the s
37a0: 74 61 74 65 2c 20 75 6e 64 65 72 20 6f 75 72 0a tate, under our.
37b0: 09 23 20 4c 4f 44 2e 20 41 6e 64 20 69 66 20 69 .# LOD. And if i
37c0: 74 20 69 73 20 74 68 65 20 6c 61 73 74 20 74 72 t is the last tr
37d0: 75 6e 6b 20 63 68 61 6e 67 65 73 65 74 20 6f 6e unk changeset on
37e0: 20 74 68 65 20 76 65 6e 64 6f 72 0a 09 23 20 62 the vendor..# b
37f0: 72 61 6e 63 68 20 74 68 65 6e 20 74 68 65 20 72 ranch then the r
3800: 65 76 69 73 69 6f 6e 20 69 73 20 61 6c 73 6f 20 evision is also
3810: 74 68 65 20 61 63 74 75 61 6c 20 72 6f 6f 74 20 the actual root
3820: 6f 66 20 74 68 65 0a 09 23 20 3a 74 72 75 6e 6b of the..# :trunk
3830: 3a 2c 20 73 6f 20 77 65 20 72 65 6d 65 6d 62 65 :, so we remembe
3840: 72 20 69 74 20 61 73 20 73 75 63 68 20 69 6e 20 r it as such in
3850: 74 68 65 20 73 74 61 74 65 2e 20 48 6f 77 65 76 the state. Howev
3860: 65 72 20 69 66 0a 09 23 20 74 68 65 20 74 72 75 er if..# the tru
3870: 6e 6b 20 61 6c 72 65 61 64 79 20 65 78 69 73 74 nk already exist
3880: 73 20 74 68 65 6e 20 74 68 65 20 63 68 61 6e 67 s then the chang
3890: 65 73 65 74 20 63 61 6e 6e 6f 74 20 62 65 20 6f eset cannot be o
38a0: 6e 20 69 74 0a 09 23 20 61 6e 79 20 6d 6f 72 65 n it..# any more
38b0: 2e 20 54 68 69 73 20 69 6e 64 69 63 61 74 65 73 . This indicates
38c0: 20 77 65 69 72 64 6e 65 73 73 20 69 6e 20 74 68 weirdness in th
38d0: 65 20 73 65 74 75 70 20 6f 66 20 74 68 65 0a 09 e setup of the..
38e0: 23 20 76 65 6e 64 6f 72 20 62 72 61 6e 63 68 2c # vendor branch,
38f0: 20 62 75 74 20 6f 6e 65 20 77 65 20 63 61 6e 20 but one we can
3900: 77 6f 72 6b 20 61 72 6f 75 6e 64 2e 0a 0a 09 24 work around....$
3910: 6c 77 73 20 64 65 66 69 64 20 24 75 75 69 64 0a lws defid $uuid.
3920: 09 69 66 20 7b 24 6c 61 73 74 64 65 66 61 75 6c .if {$lastdefaul
3930: 74 6f 6e 74 72 75 6e 6b 7d 20 7b 0a 09 20 20 20 tontrunk} {..
3940: 20 69 66 20 7b 5b 24 72 73 74 61 74 65 20 68 61 if {[$rstate ha
3950: 73 20 3a 74 72 75 6e 6b 3a 5d 7d 20 7b 0a 09 09 s :trunk:]} {...
3960: 6c 6f 67 20 77 72 69 74 65 20 32 20 63 73 65 74 log write 2 cset
3970: 73 20 7b 4d 75 6c 74 69 70 6c 65 20 63 68 61 6e s {Multiple chan
3980: 67 65 73 65 74 73 20 64 65 63 6c 61 72 65 64 20 gesets declared
3990: 74 6f 20 62 65 20 74 68 65 20 6c 61 73 74 20 74 to be the last t
39a0: 72 75 6e 6b 20 63 68 61 6e 67 65 73 65 74 20 6f runk changeset o
39b0: 6e 20 74 68 65 20 76 65 6e 64 6f 72 2d 62 72 61 n the vendor-bra
39c0: 6e 63 68 7d 0a 09 20 20 20 20 7d 20 65 6c 73 65 nch}.. } else
39d0: 20 7b 0a 09 09 24 72 73 74 61 74 65 20 6e 65 77 {...$rstate new
39e0: 20 3a 74 72 75 6e 6b 3a 20 5b 24 6c 77 73 20 6e :trunk: [$lws n
39f0: 61 6d 65 5d 0a 09 20 20 20 20 7d 0a 09 7d 0a 0a ame].. }..}..
3a00: 09 23 20 52 65 6d 65 6d 62 65 72 20 74 68 65 20 .# Remember the
3a10: 77 68 6f 6c 65 20 63 68 61 6e 67 65 73 65 74 20 whole changeset
3a20: 2f 20 75 75 69 64 20 6d 61 70 70 69 6e 67 2c 20 / uuid mapping,
3a30: 66 6f 72 20 74 68 65 20 74 61 67 73 2e 0a 0a 09 for the tags....
3a40: 73 74 61 74 65 20 72 75 6e 20 7b 0a 09 20 20 20 state run {..
3a50: 20 49 4e 53 45 52 54 20 49 4e 54 4f 20 63 73 75 INSERT INTO csu
3a60: 75 69 64 20 28 63 69 64 2c 20 20 20 75 75 69 64 uid (cid, uuid
3a70: 29 0a 09 20 20 20 20 56 41 4c 55 45 53 20 20 20 ).. VALUES
3a80: 20 20 20 20 20 20 20 20 20 20 28 24 6d 79 69 64 ($myid
3a90: 2c 20 24 75 75 69 64 29 0a 09 7d 0a 09 72 65 74 , $uuid)..}..ret
3aa0: 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 70 urn. }.. p
3ab0: 72 6f 63 20 47 65 74 72 65 76 69 73 69 6f 6e 69 roc Getrevisioni
3ac0: 6e 66 6f 20 7b 72 65 76 69 73 69 6f 6e 73 7d 20 nfo {revisions}
3ad0: 7b 0a 09 73 65 74 20 74 68 65 73 65 74 20 28 27 {..set theset ('
3ae0: 5b 6a 6f 69 6e 20 24 72 65 76 69 73 69 6f 6e 73 [join $revisions
3af0: 20 7b 27 2c 27 7d 5d 27 29 0a 09 73 65 74 20 72 {','}]')..set r
3b00: 65 76 69 73 69 6f 6e 73 20 7b 7d 0a 09 66 6f 72 evisions {}..for
3b10: 65 61 63 68 20 7b 66 72 69 64 20 70 61 74 68 20 each {frid path
3b20: 66 6e 61 6d 65 20 72 65 76 6e 72 20 72 6f 70 7d fname revnr rop}
3b30: 20 5b 73 74 61 74 65 20 72 75 6e 20 5b 73 75 62 [state run [sub
3b40: 73 74 20 2d 6e 6f 63 6f 6d 6d 61 6e 64 73 20 2d st -nocommands -
3b50: 6e 6f 62 61 63 6b 73 6c 61 73 68 65 73 20 7b 0a nobackslashes {.
3b60: 09 20 20 20 20 53 45 4c 45 43 54 20 55 2e 75 75 . SELECT U.uu
3b70: 69 64 2c 20 46 2e 76 69 73 69 62 6c 65 2c 20 46 id, F.visible, F
3b80: 2e 6e 61 6d 65 2c 20 52 2e 72 65 76 2c 20 52 2e .name, R.rev, R.
3b90: 6f 70 0a 09 20 20 20 20 46 52 4f 4d 20 20 20 72 op.. FROM r
3ba0: 65 76 69 73 69 6f 6e 20 52 2c 20 72 65 76 75 75 evision R, revuu
3bb0: 69 64 20 55 2c 20 66 69 6c 65 20 46 0a 09 20 20 id U, file F..
3bc0: 20 20 57 48 45 52 45 20 20 52 2e 72 69 64 20 49 WHERE R.rid I
3bd0: 4e 20 24 74 68 65 73 65 74 20 20 2d 2d 20 41 6c N $theset -- Al
3be0: 6c 20 73 70 65 63 69 66 69 65 64 20 72 65 76 69 l specified revi
3bf0: 73 69 6f 6e 73 0a 09 20 20 20 20 41 4e 44 20 20 sions.. AND
3c00: 20 20 55 2e 72 69 64 20 3d 20 52 2e 72 69 64 20 U.rid = R.rid
3c10: 20 20 20 20 2d 2d 20 67 65 74 20 66 6f 73 73 69 -- get fossi
3c20: 6c 20 75 75 69 64 20 6f 66 20 72 65 76 69 73 69 l uuid of revisi
3c30: 6f 6e 0a 09 20 20 20 20 41 4e 44 20 20 20 20 46 on.. AND F
3c40: 2e 66 69 64 20 3d 20 52 2e 66 69 64 20 20 20 20 .fid = R.fid
3c50: 20 2d 2d 20 67 65 74 20 66 69 6c 65 20 6f 66 20 -- get file of
3c60: 72 65 76 69 73 69 6f 6e 0a 09 7d 5d 5d 20 7b 0a revision..}]] {.
3c70: 09 20 20 20 20 6c 61 70 70 65 6e 64 20 72 65 76 . lappend rev
3c80: 69 73 69 6f 6e 73 20 24 66 72 69 64 20 24 70 61 isions $frid $pa
3c90: 74 68 20 24 66 6e 61 6d 65 2f 24 72 65 76 6e 72 th $fname/$revnr
3ca0: 20 24 72 6f 70 0a 09 7d 0a 09 72 65 74 75 72 6e $rop..}..return
3cb0: 20 24 72 65 76 69 73 69 6f 6e 73 0a 20 20 20 20 $revisions.
3cc0: 7d 0a 0a 20 20 20 20 70 72 6f 63 20 47 65 74 77 }.. proc Getw
3cd0: 6f 72 6b 73 70 61 63 65 20 7b 72 73 74 61 74 65 orkspace {rstate
3ce0: 20 6c 6f 64 6e 61 6d 65 20 70 72 6f 6a 65 63 74 lodname project
3cf0: 20 69 73 64 65 66 61 75 6c 74 7d 20 7b 0a 0a 09 isdefault} {...
3d00: 23 20 54 68 65 20 73 74 61 74 65 20 6f 62 6a 65 # The state obje
3d10: 63 74 20 68 6f 6c 64 73 20 74 68 65 20 77 6f 72 ct holds the wor
3d20: 6b 73 70 61 63 65 20 73 74 61 74 65 20 6f 66 20 kspace state of
3d30: 65 61 63 68 20 6b 6e 6f 77 6e 0a 09 23 20 6c 69 each known..# li
3d40: 6e 65 2d 6f 66 2d 64 65 76 65 6c 6f 70 6d 65 6e ne-of-developmen
3d50: 74 20 28 4c 4f 44 29 2c 20 75 70 20 74 6f 20 74 t (LOD), up to t
3d60: 68 65 20 6c 61 73 74 20 63 6f 6d 6d 69 74 74 65 he last committe
3d70: 64 0a 09 23 20 63 68 61 6e 67 65 73 65 74 20 62 d..# changeset b
3d80: 65 6c 6f 6e 67 69 6e 67 20 74 6f 20 74 68 61 74 elonging to that
3d90: 20 4c 4f 44 2e 0a 0a 09 23 20 28 2a 29 20 53 74 LOD....# (*) St
3da0: 61 6e 64 61 72 64 20 68 61 6e 64 6c 69 6e 67 20 andard handling
3db0: 69 66 20 69 6e 2d 4c 4f 44 20 63 68 61 6e 67 65 if in-LOD change
3dc0: 73 65 74 73 2e 20 49 66 20 74 68 65 20 4c 4f 44 sets. If the LOD
3dd0: 20 6f 66 0a 09 23 20 20 20 20 20 74 68 65 20 63 of..# the c
3de0: 75 72 72 65 6e 74 20 63 68 61 6e 67 65 73 65 74 urrent changeset
3df0: 20 65 78 69 73 74 73 20 69 6e 20 74 68 65 20 73 exists in the s
3e00: 74 61 74 65 20 28 3d 20 68 61 73 20 62 65 65 6e tate (= has been
3e10: 0a 09 23 20 20 20 20 20 63 6f 6d 6d 69 74 74 65 ..# committe
3e20: 64 20 74 6f 29 20 74 68 65 6e 20 74 68 69 73 20 d to) then this
3e30: 69 74 20 68 61 73 20 74 68 65 20 77 6f 72 6b 73 it has the works
3e40: 70 61 63 65 20 77 65 20 61 72 65 0a 09 23 20 20 pace we are..#
3e50: 20 20 20 6c 6f 6f 6b 69 6e 67 20 66 6f 72 2e 0a looking for..
3e60: 0a 09 69 66 20 7b 5b 24 72 73 74 61 74 65 20 68 ..if {[$rstate h
3e70: 61 73 20 24 6c 6f 64 6e 61 6d 65 5d 7d 20 7b 0a as $lodname]} {.
3e80: 09 20 20 20 20 72 65 74 75 72 6e 20 5b 24 72 73 . return [$rs
3e90: 74 61 74 65 20 67 65 74 20 24 6c 6f 64 6e 61 6d tate get $lodnam
3ea0: 65 5d 0a 09 7d 0a 0a 09 23 20 49 66 20 74 68 65 e]..}...# If the
3eb0: 20 4c 4f 44 20 69 73 20 68 6f 77 65 76 65 72 20 LOD is however
3ec0: 6e 6f 74 20 79 65 74 20 6b 6e 6f 77 6e 2c 20 74 not yet known, t
3ed0: 68 65 6e 20 74 68 65 20 63 75 72 72 65 6e 74 0a hen the current.
3ee0: 09 23 20 63 68 61 6e 67 65 73 65 74 20 63 61 6e .# changeset can
3ef0: 20 62 65 20 65 69 74 68 65 72 20 6f 66 0a 09 23 be either of..#
3f00: 20 28 61 29 20 72 6f 6f 74 20 6f 66 20 61 20 76 (a) root of a v
3f10: 65 6e 64 6f 72 20 62 72 61 6e 63 68 2c 0a 09 23 endor branch,..#
3f20: 20 28 62 29 20 72 6f 6f 74 20 6f 66 20 74 68 65 (b) root of the
3f30: 20 74 72 75 6e 6b 20 4c 4f 44 2c 20 6f 72 0a 09 trunk LOD, or..
3f40: 23 20 28 63 29 20 74 68 65 20 66 69 72 73 74 20 # (c) the first
3f50: 63 68 61 6e 67 65 73 65 74 20 69 6e 20 61 20 6e changeset in a n
3f60: 65 77 20 4c 4f 44 20 77 68 69 63 68 20 77 61 73 ew LOD which was
3f70: 20 73 70 61 77 6e 65 64 20 66 72 6f 6d 0a 09 23 spawned from..#
3f80: 20 20 20 20 20 61 6e 20 65 78 69 73 74 69 6e 67 an existing
3f90: 20 4c 4f 44 2e 0a 0a 09 23 20 46 6f 72 20 62 6f LOD....# For bo
3fa0: 74 68 20 28 61 29 20 61 6e 64 20 28 62 29 20 77 th (a) and (b) w
3fb0: 65 20 68 61 76 65 20 74 6f 20 63 72 65 61 74 65 e have to create
3fc0: 20 61 20 6e 65 77 20 77 6f 72 6b 73 70 61 63 65 a new workspace
3fd0: 20 66 6f 72 0a 09 23 20 74 68 65 20 6c 6f 64 2c for..# the lod,
3fe0: 20 61 6e 64 20 69 74 20 64 6f 65 73 6e 27 74 20 and it doesn't
3ff0: 69 6e 68 65 72 69 74 20 66 72 6f 6d 20 61 6e 79 inherit from any
4000: 74 68 69 6e 67 2e 0a 0a 09 23 20 4f 6e 65 20 65 thing....# One e
4010: 78 63 65 70 74 69 6f 6e 20 66 6f 72 20 28 61 29 xception for (a)
4020: 2e 20 49 66 20 77 65 20 61 6c 72 65 61 64 79 20 . If we already
4030: 68 61 76 65 20 61 20 3a 76 65 6e 64 6f 72 3a 20 have a :vendor:
4040: 62 72 61 6e 63 68 0a 09 23 20 74 68 65 6e 20 6d branch..# then m
4050: 75 6c 74 69 70 6c 65 20 73 79 6d 62 6f 6c 73 20 ultiple symbols
4060: 77 65 72 65 20 75 73 65 64 20 66 6f 72 20 74 68 were used for th
4070: 65 20 76 65 6e 64 6f 72 20 62 72 61 6e 63 68 20 e vendor branch
4080: 62 79 0a 09 23 20 64 69 66 66 65 72 65 6e 74 20 by..# different
4090: 66 69 6c 65 73 2e 20 49 6e 20 74 68 61 74 20 63 files. In that c
40a0: 61 73 65 20 74 68 65 20 27 6e 65 77 27 20 62 72 ase the 'new' br
40b0: 61 6e 63 68 20 69 73 20 6d 61 64 65 20 61 6e 0a anch is made an.
40c0: 09 23 20 61 6c 69 61 73 20 6f 66 20 74 68 65 20 .# alias of the
40d0: 3a 76 65 6e 64 6f 72 3a 2c 20 65 66 66 65 63 74 :vendor:, effect
40e0: 69 76 65 6c 79 20 6d 65 72 67 69 6e 67 20 74 68 ively merging th
40f0: 65 20 73 79 6d 62 6f 6c 73 0a 09 23 20 74 6f 67 e symbols..# tog
4100: 65 74 68 65 72 2e 0a 0a 09 23 20 4e 6f 74 65 20 ether....# Note
4110: 74 68 61 74 20 63 61 73 65 20 28 62 29 20 6d 61 that case (b) ma
4120: 79 20 6e 65 76 65 72 20 6f 63 63 75 72 2e 20 53 y never occur. S
4130: 65 65 20 74 68 65 20 76 61 72 69 61 62 6c 65 0a ee the variable.
4140: 09 23 20 27 6c 61 73 74 64 65 66 61 75 6c 74 6f .# 'lastdefaulto
4150: 6e 74 72 75 6e 6b 27 20 69 6e 20 74 68 65 20 63 ntrunk' in the c
4160: 61 6c 6c 65 72 20 28 6d 65 74 68 6f 64 20 70 75 aller (method pu
4170: 73 68 74 6f 29 2e 20 54 68 69 73 0a 09 23 20 66 shto). This..# f
4180: 6c 61 67 20 63 61 6e 20 74 68 65 20 67 65 6e 65 lag can the gene
4190: 72 61 74 69 6f 6e 20 6f 66 20 74 68 65 20 77 6f ration of the wo
41a0: 72 6b 73 70 61 63 65 20 66 6f 72 20 74 68 65 20 rkspace for the
41b0: 3a 74 72 75 6e 6b 3a 20 4c 4f 44 0a 09 23 20 61 :trunk: LOD..# a
41c0: 73 20 77 65 6c 6c 2c 20 6d 61 6b 69 6e 67 20 69 s well, making i
41d0: 74 20 69 6e 68 65 72 69 74 20 74 68 65 20 73 74 t inherit the st
41e0: 61 74 65 20 6f 66 20 74 68 65 20 6c 61 73 74 0a ate of the last.
41f0: 09 23 20 74 72 75 6e 6b 2d 63 68 61 6e 67 65 73 .# trunk-changes
4200: 65 74 20 6f 6e 20 74 68 65 20 76 65 6e 64 6f 72 et on the vendor
4210: 2d 62 72 61 6e 63 68 2e 0a 0a 09 69 66 20 7b 24 -branch....if {$
4220: 69 73 64 65 66 61 75 6c 74 7d 20 7b 0a 09 20 20 isdefault} {..
4230: 20 20 69 66 20 7b 21 5b 24 72 73 74 61 74 65 20 if {![$rstate
4240: 68 61 73 20 22 3a 76 65 6e 64 6f 72 3a 22 5d 7d has ":vendor:"]}
4250: 20 7b 0a 09 09 23 20 43 72 65 61 74 65 20 74 68 {...# Create th
4260: 65 20 76 65 6e 64 6f 72 20 62 72 61 6e 63 68 20 e vendor branch
4270: 69 66 20 6e 6f 74 20 70 72 65 73 65 6e 74 20 61 if not present a
4280: 6c 72 65 61 64 79 2e 0a 09 09 24 72 73 74 61 74 lready....$rstat
4290: 65 20 6e 65 77 20 3a 76 65 6e 64 6f 72 3a 0a 09 e new :vendor:..
42a0: 20 20 20 20 7d 0a 09 20 20 20 20 23 20 4d 65 72 }.. # Mer
42b0: 67 65 20 74 68 65 20 6e 65 77 20 73 79 6d 62 6f ge the new symbo
42c0: 6c 20 74 6f 20 74 68 65 20 76 65 6e 64 6f 72 20 l to the vendor
42d0: 62 72 61 6e 63 68 0a 09 20 20 20 20 24 72 73 74 branch.. $rst
42e0: 61 74 65 20 64 75 70 20 24 6c 6f 64 6e 61 6d 65 ate dup $lodname
42f0: 20 3c 2d 2d 20 3a 76 65 6e 64 6f 72 3a 0a 09 20 <-- :vendor:..
4300: 20 20 20 72 65 74 75 72 6e 20 5b 24 72 73 74 61 return [$rsta
4310: 74 65 20 67 65 74 20 24 6c 6f 64 6e 61 6d 65 5d te get $lodname]
4320: 0a 09 7d 0a 0a 09 69 66 20 7b 24 6c 6f 64 6e 61 ..}...if {$lodna
4330: 6d 65 20 65 71 20 22 3a 74 72 75 6e 6b 3a 22 7d me eq ":trunk:"}
4340: 20 7b 0a 09 20 20 20 20 72 65 74 75 72 6e 20 5b {.. return [
4350: 24 72 73 74 61 74 65 20 6e 65 77 20 24 6c 6f 64 $rstate new $lod
4360: 6e 61 6d 65 5d 0a 09 7d 0a 0a 09 23 20 43 61 73 name]..}...# Cas
4370: 65 20 28 63 29 2e 20 57 65 20 66 69 6e 64 20 74 e (c). We find t
4380: 68 65 20 70 61 72 65 6e 74 20 4c 4f 44 20 6f 66 he parent LOD of
4390: 20 6f 75 72 20 4c 4f 44 20 61 6e 64 20 6c 65 74 our LOD and let
43a0: 20 74 68 65 20 6e 65 77 0a 09 23 20 77 6f 72 6b the new..# work
43b0: 73 70 61 63 65 20 69 6e 68 65 72 69 74 20 66 72 space inherit fr
43c0: 6f 6d 20 74 68 65 20 70 61 72 65 6e 74 27 73 20 om the parent's
43d0: 77 6f 72 6b 73 70 61 63 65 2e 0a 0a 09 73 65 74 workspace....set
43e0: 20 70 6c 6f 64 6e 61 6d 65 20 5b 5b 5b 24 70 72 plodname [[[$pr
43f0: 6f 6a 65 63 74 20 67 65 74 73 79 6d 62 6f 6c 20 oject getsymbol
4400: 24 6c 6f 64 6e 61 6d 65 5d 20 70 61 72 65 6e 74 $lodname] parent
4410: 5d 20 6e 61 6d 65 5d 0a 0a 09 6c 6f 67 20 77 72 ] name]...log wr
4420: 69 74 65 20 38 20 63 73 65 74 73 20 7b 70 4c 4f ite 8 csets {pLO
4430: 44 20 20 20 27 24 70 6c 6f 64 6e 61 6d 65 27 7d D '$plodname'}
4440: 0a 0a 09 69 66 20 7b 5b 24 72 73 74 61 74 65 20 ...if {[$rstate
4450: 68 61 73 20 24 70 6c 6f 64 6e 61 6d 65 5d 7d 20 has $plodname]}
4460: 7b 0a 09 20 20 20 20 72 65 74 75 72 6e 20 5b 24 {.. return [$
4470: 72 73 74 61 74 65 20 6e 65 77 20 24 6c 6f 64 6e rstate new $lodn
4480: 61 6d 65 20 24 70 6c 6f 64 6e 61 6d 65 5d 0a 09 ame $plodname]..
4490: 7d 0a 0a 09 66 6f 72 65 61 63 68 20 6b 20 5b 6c }...foreach k [l
44a0: 73 6f 72 74 20 5b 24 72 73 74 61 74 65 20 6e 61 sort [$rstate na
44b0: 6d 65 73 5d 5d 20 7b 0a 09 20 20 20 20 6c 6f 67 mes]] {.. log
44c0: 20 77 72 69 74 65 20 38 20 63 73 65 74 73 20 7b write 8 csets {
44d0: 20 20 20 20 24 6b 20 3d 20 5b 5b 24 72 73 74 61 $k = [[$rsta
44e0: 74 65 20 67 65 74 20 24 6b 5d 20 67 65 74 69 64 te get $k] getid
44f0: 5d 7d 0a 09 7d 0a 0a 09 74 72 6f 75 62 6c 65 20 ]}..}...trouble
4500: 69 6e 74 65 72 6e 61 6c 20 7b 55 6e 61 62 6c 65 internal {Unable
4510: 20 74 6f 20 64 65 74 65 72 6d 69 6e 65 20 63 68 to determine ch
4520: 61 6e 67 65 73 65 74 20 70 61 72 65 6e 74 7d 0a angeset parent}.
4530: 09 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 .return. }..
4540: 20 20 20 70 72 6f 63 20 47 65 74 69 73 64 65 66 proc Getisdef
4550: 61 75 6c 74 20 7b 72 65 76 69 73 69 6f 6e 73 7d ault {revisions}
4560: 20 7b 0a 09 73 65 74 20 74 68 65 73 65 74 20 28 {..set theset (
4570: 27 5b 6a 6f 69 6e 20 24 72 65 76 69 73 69 6f 6e '[join $revision
4580: 73 20 7b 27 2c 27 7d 5d 27 29 0a 0a 09 73 74 72 s {','}]')...str
4590: 75 63 74 3a 3a 6c 69 73 74 20 61 73 73 69 67 6e uct::list assign
45a0: 20 5b 73 74 61 74 65 20 72 75 6e 20 5b 73 75 62 [state run [sub
45b0: 73 74 20 2d 6e 6f 63 6f 6d 6d 61 6e 64 73 20 2d st -nocommands -
45c0: 6e 6f 62 61 63 6b 73 6c 61 73 68 65 73 20 7b 0a nobackslashes {.
45d0: 09 20 20 20 20 53 45 4c 45 43 54 20 52 2e 69 73 . SELECT R.is
45e0: 64 65 66 61 75 6c 74 2c 20 52 2e 64 62 63 68 69 default, R.dbchi
45f0: 6c 64 0a 09 20 20 20 20 46 52 4f 4d 20 20 20 72 ld.. FROM r
4600: 65 76 69 73 69 6f 6e 20 52 0a 09 20 20 20 20 57 evision R.. W
4610: 48 45 52 45 20 20 52 2e 72 69 64 20 49 4e 20 24 HERE R.rid IN $
4620: 74 68 65 73 65 74 20 20 2d 2d 20 41 6c 6c 20 73 theset -- All s
4630: 70 65 63 69 66 69 65 64 20 72 65 76 69 73 69 6f pecified revisio
4640: 6e 73 0a 09 20 20 20 20 4c 49 4d 49 54 20 31 0a ns.. LIMIT 1.
4650: 09 7d 5d 5d 20 64 65 66 20 6c 61 73 74 0a 0a 09 .}]] def last...
4660: 23 20 54 4f 44 4f 2f 43 48 45 43 4b 3a 20 6c 6f # TODO/CHECK: lo
4670: 6f 6b 20 66 6f 72 20 63 68 61 6e 67 65 73 65 74 ok for changeset
4680: 73 20 77 68 65 72 65 20 69 73 64 65 66 61 75 6c s where isdefaul
4690: 74 2f 64 62 63 68 69 6c 64 20 69 73 0a 09 23 20 t/dbchild is..#
46a0: 61 6d 62 69 67 6f 75 73 2e 0a 0a 09 72 65 74 75 ambigous....retu
46b0: 72 6e 20 5b 6c 69 73 74 20 24 64 65 66 20 5b 65 rn [list $def [e
46c0: 78 70 72 20 7b 24 6c 61 73 74 20 6e 65 20 22 22 xpr {$last ne ""
46d0: 7d 5d 5d 0a 20 20 20 20 7d 0a 0a 20 20 20 20 74 }]]. }.. t
46e0: 79 70 65 6d 65 74 68 6f 64 20 73 70 6c 69 74 20 ypemethod split
46f0: 7b 63 73 65 74 20 61 72 67 73 7d 20 7b 0a 09 23 {cset args} {..#
4700: 20 41 73 20 70 61 72 74 20 6f 66 20 74 68 65 20 As part of the
4710: 63 72 65 61 74 69 6f 6e 20 6f 66 20 74 68 65 20 creation of the
4720: 6e 65 77 20 63 68 61 6e 67 65 73 65 74 73 20 73 new changesets s
4730: 70 65 63 69 66 69 65 64 20 69 6e 0a 09 23 20 41 pecified in..# A
4740: 52 47 53 20 61 73 20 73 65 74 73 20 6f 66 20 69 RGS as sets of i
4750: 74 65 6d 73 2c 20 61 6c 6c 20 73 75 62 73 65 74 tems, all subset
4760: 73 20 6f 66 20 43 53 45 54 27 73 20 69 74 65 6d s of CSET's item
4770: 20 73 65 74 2c 20 43 53 45 54 0a 09 23 20 77 69 set, CSET..# wi
4780: 6c 6c 20 62 65 20 64 72 6f 70 70 65 64 20 66 72 ll be dropped fr
4790: 6f 6d 20 61 6c 6c 20 64 61 74 61 62 61 73 65 73 om all databases
47a0: 2c 20 69 6e 20 61 6e 64 20 6f 75 74 20 6f 66 20 , in and out of
47b0: 6d 65 6d 6f 72 79 2c 0a 09 23 20 61 6e 64 20 74 memory,..# and t
47c0: 68 65 6e 20 64 65 73 74 72 6f 79 65 64 2e 0a 09 hen destroyed...
47d0: 23 0a 09 23 20 4e 6f 74 65 3a 20 54 68 65 20 69 #..# Note: The i
47e0: 74 65 6d 20 6c 69 73 74 73 20 66 6f 75 6e 64 20 tem lists found
47f0: 69 6e 20 61 72 67 73 20 61 72 65 20 74 61 67 67 in args are tagg
4800: 65 64 20 69 74 65 6d 73 2e 20 54 68 65 79 0a 09 ed items. They..
4810: 23 20 68 61 76 65 20 74 6f 20 68 61 76 65 20 74 # have to have t
4820: 68 65 20 73 61 6d 65 20 74 79 70 65 20 61 73 20 he same type as
4830: 74 68 65 20 63 68 61 6e 67 65 73 65 74 2c 20 62 the changeset, b
4840: 65 69 6e 67 20 73 75 62 73 65 74 73 0a 09 23 20 eing subsets..#
4850: 6f 66 20 69 74 73 20 69 74 65 6d 73 2e 20 54 68 of its items. Th
4860: 69 73 20 69 73 20 63 68 65 63 6b 65 64 20 69 6e is is checked in
4870: 20 55 6e 74 61 67 31 2e 0a 0a 09 6c 6f 67 20 77 Untag1....log w
4880: 72 69 74 65 20 38 20 63 73 65 74 73 20 7b 4f 4c rite 8 csets {OL
4890: 44 3a 20 5b 6c 73 6f 72 74 20 5b 24 63 73 65 74 D: [lsort [$cset
48a0: 20 69 74 65 6d 73 5d 5d 7d 0a 09 56 61 6c 69 64 items]]}..Valid
48b0: 61 74 65 46 72 61 67 6d 65 6e 74 73 20 24 63 73 ateFragments $cs
48c0: 65 74 20 24 61 72 67 73 0a 0a 09 23 20 41 6c 6c et $args...# All
48d0: 20 63 68 65 63 6b 73 20 70 61 73 73 2c 20 61 63 checks pass, ac
48e0: 74 75 61 6c 6c 79 20 70 65 72 66 6f 72 6d 20 74 tually perform t
48f0: 68 65 20 73 70 6c 69 74 2e 0a 0a 09 73 74 72 75 he split....stru
4900: 63 74 3a 3a 6c 69 73 74 20 61 73 73 69 67 6e 20 ct::list assign
4910: 5b 24 63 73 65 74 20 64 61 74 61 5d 20 70 72 6f [$cset data] pro
4920: 6a 65 63 74 20 63 73 74 79 70 65 20 63 73 73 72 ject cstype cssr
4930: 63 0a 0a 09 73 65 74 20 70 72 65 64 65 63 65 73 c...set predeces
4940: 73 6f 72 73 20 5b 24 63 73 65 74 20 64 72 6f 70 sors [$cset drop
4950: 5d 0a 09 24 63 73 65 74 20 64 65 73 74 72 6f 79 ]..$cset destroy
4960: 0a 0a 09 73 65 74 20 6e 65 77 63 73 65 74 73 20 ...set newcsets
4970: 7b 7d 0a 09 66 6f 72 65 61 63 68 20 66 72 61 67 {}..foreach frag
4980: 6d 65 6e 74 69 74 65 6d 73 20 24 61 72 67 73 20 mentitems $args
4990: 7b 0a 09 20 20 20 20 6c 6f 67 20 77 72 69 74 65 {.. log write
49a0: 20 38 20 63 73 65 74 73 20 7b 4d 41 4b 45 3a 20 8 csets {MAKE:
49b0: 5b 6c 73 6f 72 74 20 24 66 72 61 67 6d 65 6e 74 [lsort $fragment
49c0: 69 74 65 6d 73 5d 7d 0a 0a 09 20 20 20 20 73 65 items]}... se
49d0: 74 20 66 72 61 67 6d 65 6e 74 20 5b 24 74 79 70 t fragment [$typ
49e0: 65 20 25 41 55 54 4f 25 20 24 70 72 6f 6a 65 63 e %AUTO% $projec
49f0: 74 20 24 63 73 74 79 70 65 20 24 63 73 73 72 63 t $cstype $cssrc
4a00: 20 5c 0a 09 09 09 20 20 20 20 20 20 5b 55 6e 74 \.... [Unt
4a10: 61 67 20 24 66 72 61 67 6d 65 6e 74 69 74 65 6d ag $fragmentitem
4a20: 73 20 24 63 73 74 79 70 65 5d 5d 0a 09 20 20 20 s $cstype]]..
4a30: 20 6c 61 70 70 65 6e 64 20 6e 65 77 63 73 65 74 lappend newcset
4a40: 73 20 24 66 72 61 67 6d 65 6e 74 0a 0a 09 20 20 s $fragment...
4a50: 20 20 24 66 72 61 67 6d 65 6e 74 20 70 65 72 73 $fragment pers
4a60: 69 73 74 0a 09 20 20 20 20 24 66 72 61 67 6d 65 ist.. $fragme
4a70: 6e 74 20 64 65 74 65 72 6d 69 6e 65 73 75 63 63 nt determinesucc
4a80: 65 73 73 6f 72 73 0a 09 7d 0a 0a 09 23 20 54 68 essors..}...# Th
4a90: 65 20 70 72 65 64 65 63 65 73 73 6f 72 73 20 68 e predecessors h
4aa0: 61 76 65 20 74 6f 20 72 65 63 6f 6d 70 75 74 65 ave to recompute
4ab0: 20 74 68 65 69 72 20 73 75 63 63 65 73 73 6f 72 their successor
4ac0: 73 2c 20 69 2e 65 2e 0a 09 23 20 72 65 6d 6f 76 s, i.e...# remov
4ad0: 65 20 74 68 65 20 64 72 6f 70 70 65 64 20 63 68 e the dropped ch
4ae0: 61 6e 67 65 73 65 74 20 61 6e 64 20 70 75 74 20 angeset and put
4af0: 6f 6e 65 20 6f 66 20 74 68 65 20 66 72 61 67 6d one of the fragm
4b00: 65 6e 74 73 0a 09 23 20 69 6e 74 6f 20 69 74 73 ents..# into its
4b10: 20 70 6c 61 63 65 2e 0a 09 66 6f 72 65 61 63 68 place...foreach
4b20: 20 70 20 24 70 72 65 64 65 63 65 73 73 6f 72 73 p $predecessors
4b30: 20 7b 0a 09 20 20 20 20 24 70 20 64 65 74 65 72 {.. $p deter
4b40: 6d 69 6e 65 73 75 63 63 65 73 73 6f 72 73 0a 09 minesuccessors..
4b50: 7d 0a 0a 09 72 65 74 75 72 6e 20 24 6e 65 77 63 }...return $newc
4b60: 73 65 74 73 0a 20 20 20 20 7d 0a 0a 20 20 20 20 sets. }..
4b70: 74 79 70 65 6d 65 74 68 6f 64 20 69 74 65 6d 73 typemethod items
4b80: 74 72 20 7b 69 74 65 6d 7d 20 7b 0a 09 73 74 72 tr {item} {..str
4b90: 75 63 74 3a 3a 6c 69 73 74 20 61 73 73 69 67 6e uct::list assign
4ba0: 20 24 69 74 65 6d 20 69 74 79 70 65 20 69 69 64 $item itype iid
4bb0: 0a 09 72 65 74 75 72 6e 20 5b 24 69 74 79 70 65 ..return [$itype
4bc0: 20 73 74 72 20 24 69 69 64 5d 0a 20 20 20 20 7d str $iid]. }
4bd0: 0a 0a 20 20 20 20 74 79 70 65 6d 65 74 68 6f 64 .. typemethod
4be0: 20 73 74 72 6c 69 73 74 20 7b 63 68 61 6e 67 65 strlist {change
4bf0: 73 65 74 73 7d 20 7b 0a 09 72 65 74 75 72 6e 20 sets} {..return
4c00: 5b 6a 6f 69 6e 20 5b 73 74 72 75 63 74 3a 3a 6c [join [struct::l
4c10: 69 73 74 20 6d 61 70 20 24 63 68 61 6e 67 65 73 ist map $changes
4c20: 65 74 73 20 5b 6d 79 70 72 6f 63 20 49 44 5d 5d ets [myproc ID]]
4c30: 5d 0a 20 20 20 20 7d 0a 0a 20 20 20 20 70 72 6f ]. }.. pro
4c40: 63 20 49 44 20 7b 63 73 65 74 7d 20 7b 20 24 63 c ID {cset} { $c
4c50: 73 65 74 20 73 74 72 20 7d 0a 0a 20 20 20 20 70 set str }.. p
4c60: 72 6f 63 20 55 6e 74 61 67 20 7b 74 61 67 67 65 roc Untag {tagge
4c70: 64 69 74 65 6d 73 20 63 73 74 79 70 65 7d 20 7b ditems cstype} {
4c80: 0a 09 72 65 74 75 72 6e 20 5b 73 74 72 75 63 74 ..return [struct
4c90: 3a 3a 6c 69 73 74 20 6d 61 70 20 24 74 61 67 67 ::list map $tagg
4ca0: 65 64 69 74 65 6d 73 20 5b 6d 79 70 72 6f 63 20 editems [myproc
4cb0: 55 6e 74 61 67 31 20 24 63 73 74 79 70 65 5d 5d Untag1 $cstype]]
4cc0: 0a 20 20 20 20 7d 0a 0a 20 20 20 20 70 72 6f 63 . }.. proc
4cd0: 20 55 6e 74 61 67 31 20 7b 63 73 74 79 70 65 20 Untag1 {cstype
4ce0: 74 68 65 69 74 65 6d 7d 20 7b 0a 09 73 74 72 75 theitem} {..stru
4cf0: 63 74 3a 3a 6c 69 73 74 20 61 73 73 69 67 6e 20 ct::list assign
4d00: 24 74 68 65 69 74 65 6d 20 74 20 69 0a 09 69 6e $theitem t i..in
4d10: 74 65 67 72 69 74 79 20 61 73 73 65 72 74 20 7b tegrity assert {
4d20: 24 63 73 74 79 70 65 20 65 71 20 24 74 7d 20 7b $cstype eq $t} {
4d30: 49 74 65 6d 20 24 69 27 73 20 74 79 70 65 20 69 Item $i's type i
4d40: 73 20 27 24 74 27 2c 20 65 78 70 65 63 74 65 64 s '$t', expected
4d50: 20 27 24 63 73 74 79 70 65 27 7d 0a 09 72 65 74 '$cstype'}..ret
4d60: 75 72 6e 20 24 69 0a 20 20 20 20 7d 0a 0a 20 20 urn $i. }..
4d70: 20 20 70 72 6f 63 20 54 61 67 49 74 65 6d 44 69 proc TagItemDi
4d80: 63 74 20 7b 69 74 65 6d 64 69 63 74 20 63 73 74 ct {itemdict cst
4d90: 79 70 65 7d 20 7b 0a 09 73 65 74 20 72 65 73 20 ype} {..set res
4da0: 7b 7d 0a 09 66 6f 72 65 61 63 68 20 7b 69 20 76 {}..foreach {i v
4db0: 7d 20 24 69 74 65 6d 64 69 63 74 20 7b 20 6c 61 } $itemdict { la
4dc0: 70 70 65 6e 64 20 72 65 73 20 5b 6c 69 73 74 20 ppend res [list
4dd0: 24 63 73 74 79 70 65 20 24 69 5d 20 24 76 20 7d $cstype $i] $v }
4de0: 0a 09 72 65 74 75 72 6e 20 24 72 65 73 0a 20 20 ..return $res.
4df0: 20 20 7d 0a 0a 20 20 20 20 70 72 6f 63 20 56 61 }.. proc Va
4e00: 6c 69 64 61 74 65 46 72 61 67 6d 65 6e 74 73 20 lidateFragments
4e10: 7b 63 73 65 74 20 66 72 61 67 6d 65 6e 74 73 7d {cset fragments}
4e20: 20 7b 0a 09 23 20 43 68 65 63 6b 20 74 68 65 20 {..# Check the
4e30: 76 61 72 69 6f 75 73 20 69 6e 74 65 67 72 69 74 various integrit
4e40: 79 20 63 6f 6e 73 74 72 61 69 6e 74 73 20 66 6f y constraints fo
4e50: 72 20 74 68 65 20 66 72 61 67 6d 65 6e 74 73 0a r the fragments.
4e60: 09 23 20 73 70 65 63 69 66 79 69 6e 67 20 68 6f .# specifying ho
4e70: 77 20 74 6f 20 73 70 6c 69 74 20 74 68 65 20 63 w to split the c
4e80: 68 61 6e 67 65 73 65 74 3a 0a 09 23 0a 09 23 20 hangeset:..#..#
4e90: 2a 20 57 65 20 6d 75 73 74 20 68 61 76 65 20 74 * We must have t
4ea0: 77 6f 20 6f 72 20 6d 6f 72 65 20 66 72 61 67 6d wo or more fragm
4eb0: 65 6e 74 73 2c 20 61 73 20 73 70 6c 69 74 74 69 ents, as splitti
4ec0: 6e 67 20 61 0a 09 23 20 20 20 63 68 61 6e 67 65 ng a..# change
4ed0: 73 65 74 20 69 6e 74 6f 20 6f 6e 65 20 6d 61 6b set into one mak
4ee0: 65 73 20 6e 6f 20 73 65 6e 73 65 2e 0a 09 23 20 es no sense...#
4ef0: 2a 20 4e 6f 20 66 72 61 67 6d 65 6e 74 20 6d 61 * No fragment ma
4f00: 79 20 62 65 20 65 6d 70 74 79 2e 0a 09 23 20 2a y be empty...# *
4f10: 20 41 6c 6c 20 66 72 61 67 6d 65 6e 74 73 20 68 All fragments h
4f20: 61 76 65 20 74 6f 20 62 65 20 74 72 75 65 20 73 ave to be true s
4f30: 75 62 73 65 74 73 20 6f 66 20 74 68 65 20 69 74 ubsets of the it
4f40: 65 6d 73 20 69 6e 20 74 68 65 0a 09 23 20 20 20 ems in the..#
4f50: 63 68 61 6e 67 65 73 65 74 20 74 6f 20 73 70 6c changeset to spl
4f60: 69 74 2e 20 54 68 65 20 27 74 72 75 65 27 20 69 it. The 'true' i
4f70: 73 20 69 6d 70 6c 69 65 64 20 62 65 63 61 75 73 s implied becaus
4f80: 65 20 6e 6f 6e 65 20 61 72 65 0a 09 23 20 20 20 e none are..#
4f90: 61 6c 6c 6f 77 65 64 20 74 6f 20 62 65 20 65 6d allowed to be em
4fa0: 70 74 79 2c 20 73 6f 20 65 61 63 68 20 68 61 73 pty, so each has
4fb0: 20 74 6f 20 62 65 20 73 6d 61 6c 6c 65 72 20 74 to be smaller t
4fc0: 68 61 6e 20 74 68 65 0a 09 23 20 20 20 74 6f 74 han the..# tot
4fd0: 61 6c 2e 0a 09 23 20 2a 20 54 68 65 20 75 6e 69 al...# * The uni
4fe0: 6f 6e 20 6f 66 20 74 68 65 20 66 72 61 67 6d 65 on of the fragme
4ff0: 6e 74 73 20 68 61 73 20 74 6f 20 62 65 20 74 68 nts has to be th
5000: 65 20 69 74 65 6d 20 73 65 74 20 6f 66 20 74 68 e item set of th
5010: 65 0a 09 23 20 20 20 63 68 61 6e 67 65 73 65 74 e..# changeset
5020: 2e 0a 09 23 20 2a 20 54 68 65 20 66 72 61 67 6d ...# * The fragm
5030: 65 6e 74 20 6d 75 73 74 20 6e 6f 74 20 6f 76 65 ent must not ove
5040: 72 6c 61 70 2c 20 69 2e 65 2e 20 74 68 65 69 72 rlap, i.e. their
5050: 20 70 61 69 72 77 69 73 65 0a 09 23 20 20 20 69 pairwise..# i
5060: 6e 74 65 72 73 65 63 74 69 6f 6e 73 20 68 61 76 ntersections hav
5070: 65 20 74 6f 20 62 65 20 65 6d 70 74 79 2e 0a 0a e to be empty...
5080: 09 73 65 74 20 63 6f 76 65 72 20 7b 7d 0a 09 66 .set cover {}..f
5090: 6f 72 65 61 63 68 20 66 72 61 67 6d 65 6e 74 69 oreach fragmenti
50a0: 74 65 6d 73 20 24 66 72 61 67 6d 65 6e 74 73 20 tems $fragments
50b0: 7b 0a 09 20 20 20 20 6c 6f 67 20 77 72 69 74 65 {.. log write
50c0: 20 38 20 63 73 65 74 73 20 7b 4e 45 57 3a 20 5b 8 csets {NEW: [
50d0: 6c 73 6f 72 74 20 24 66 72 61 67 6d 65 6e 74 69 lsort $fragmenti
50e0: 74 65 6d 73 5d 7d 0a 0a 09 20 20 20 20 69 6e 74 tems]}... int
50f0: 65 67 72 69 74 79 20 61 73 73 65 72 74 20 7b 0a egrity assert {.
5100: 09 09 21 5b 73 74 72 75 63 74 3a 3a 73 65 74 20 ..![struct::set
5110: 65 6d 70 74 79 20 24 66 72 61 67 6d 65 6e 74 69 empty $fragmenti
5120: 74 65 6d 73 5d 0a 09 20 20 20 20 7d 20 7b 63 68 tems].. } {ch
5130: 61 6e 67 65 73 65 74 20 66 72 61 67 6d 65 6e 74 angeset fragment
5140: 20 69 73 20 65 6d 70 74 79 7d 0a 0a 09 20 20 20 is empty}...
5150: 20 69 6e 74 65 67 72 69 74 79 20 61 73 73 65 72 integrity asser
5160: 74 20 7b 0a 09 09 5b 73 74 72 75 63 74 3a 3a 73 t {...[struct::s
5170: 65 74 20 73 75 62 73 65 74 6f 66 20 24 66 72 61 et subsetof $fra
5180: 67 6d 65 6e 74 69 74 65 6d 73 20 5b 24 63 73 65 gmentitems [$cse
5190: 74 20 69 74 65 6d 73 5d 5d 0a 09 20 20 20 20 7d t items]].. }
51a0: 20 7b 63 68 61 6e 67 65 73 65 74 20 66 72 61 67 {changeset frag
51b0: 6d 65 6e 74 20 69 73 20 6e 6f 74 20 61 20 73 75 ment is not a su
51c0: 62 73 65 74 7d 0a 09 20 20 20 20 73 74 72 75 63 bset}.. struc
51d0: 74 3a 3a 73 65 74 20 61 64 64 20 63 6f 76 65 72 t::set add cover
51e0: 20 24 66 72 61 67 6d 65 6e 74 69 74 65 6d 73 0a $fragmentitems.
51f0: 09 7d 0a 0a 09 69 6e 74 65 67 72 69 74 79 20 61 .}...integrity a
5200: 73 73 65 72 74 20 7b 0a 09 20 20 20 20 5b 73 74 ssert {.. [st
5210: 72 75 63 74 3a 3a 73 65 74 20 65 71 75 61 6c 20 ruct::set equal
5220: 24 63 6f 76 65 72 20 5b 24 63 73 65 74 20 69 74 $cover [$cset it
5230: 65 6d 73 5d 5d 0a 09 20 7d 20 7b 54 68 65 20 66 ems]].. } {The f
5240: 72 61 67 6d 65 6e 74 73 20 64 6f 20 6e 6f 74 20 ragments do not
5250: 63 6f 76 65 72 20 74 68 65 20 6f 72 69 67 69 6e cover the origin
5260: 61 6c 20 63 68 61 6e 67 65 73 65 74 7d 0a 0a 09 al changeset}...
5270: 73 65 74 20 69 20 31 0a 09 66 6f 72 65 61 63 68 set i 1..foreach
5280: 20 66 69 61 20 24 66 72 61 67 6d 65 6e 74 73 20 fia $fragments
5290: 7b 0a 09 20 20 20 20 66 6f 72 65 61 63 68 20 66 {.. foreach f
52a0: 69 62 20 5b 6c 72 61 6e 67 65 20 24 66 72 61 67 ib [lrange $frag
52b0: 6d 65 6e 74 73 20 24 69 20 65 6e 64 5d 20 7b 0a ments $i end] {.
52c0: 09 09 69 6e 74 65 67 72 69 74 79 20 61 73 73 65 ..integrity asse
52d0: 72 74 20 7b 0a 09 09 20 20 20 20 5b 73 74 72 75 rt {... [stru
52e0: 63 74 3a 3a 73 65 74 20 65 6d 70 74 79 20 5b 73 ct::set empty [s
52f0: 74 72 75 63 74 3a 3a 73 65 74 20 69 6e 74 65 72 truct::set inter
5300: 73 65 63 74 20 24 66 69 61 20 24 66 69 62 5d 5d sect $fia $fib]]
5310: 0a 09 09 7d 20 7b 54 68 65 20 66 72 61 67 6d 65 ...} {The fragme
5320: 6e 74 73 20 3c 24 66 69 61 3e 20 61 6e 64 20 3c nts <$fia> and <
5330: 24 66 69 62 3e 20 6f 76 65 72 6c 61 70 7d 0a 09 $fib> overlap}..
5340: 20 20 20 20 7d 0a 09 20 20 20 20 69 6e 63 72 20 }.. incr
5350: 69 0a 09 7d 0a 0a 09 72 65 74 75 72 6e 0a 20 20 i..}...return.
5360: 20 20 7d 0a 0a 20 20 20 20 23 20 23 20 23 23 20 }.. # # ##
5370: 23 23 23 20 23 23 23 23 23 20 23 23 23 23 23 23 ### ##### ######
5380: 23 23 20 23 23 23 23 23 23 23 23 23 23 23 23 23 ## #############
5390: 0a 20 20 20 20 23 23 20 53 74 61 74 65 0a 0a 20 . ## State..
53a0: 20 20 20 76 61 72 69 61 62 6c 65 20 6d 79 69 64 variable myid
53b0: 20 20 20 20 20 20 20 20 7b 7d 20 3b 20 23 20 49 {} ; # I
53c0: 64 20 6f 66 20 74 68 65 20 63 73 65 74 20 66 6f d of the cset fo
53d0: 72 20 74 68 65 20 70 65 72 73 69 73 74 65 6e 74 r the persistent
53e0: 0a 09 09 09 20 20 20 20 20 20 23 20 73 74 61 74 .... # stat
53f0: 65 2e 0a 20 20 20 20 76 61 72 69 61 62 6c 65 20 e.. variable
5400: 6d 79 70 72 6f 6a 65 63 74 20 20 20 7b 7d 20 3b myproject {} ;
5410: 20 23 20 52 65 66 65 72 65 6e 63 65 20 6f 66 20 # Reference of
5420: 74 68 65 20 70 72 6f 6a 65 63 74 20 6f 62 6a 65 the project obje
5430: 63 74 20 74 68 65 0a 09 09 09 20 20 20 20 20 20 ct the....
5440: 23 20 63 68 61 6e 67 65 73 65 74 20 62 65 6c 6f # changeset belo
5450: 6e 67 73 20 74 6f 2e 0a 20 20 20 20 76 61 72 69 ngs to.. vari
5460: 61 62 6c 65 20 6d 79 74 79 70 65 20 20 20 20 20 able mytype
5470: 20 7b 7d 20 3b 20 23 20 57 68 61 74 20 74 68 65 {} ; # What the
5480: 20 63 68 61 6e 67 65 73 65 74 20 69 73 20 62 61 changeset is ba
5490: 73 65 64 20 6f 6e 0a 09 09 09 20 20 20 20 20 20 sed on....
54a0: 23 20 28 72 65 76 69 73 69 6f 6e 73 2c 20 74 61 # (revisions, ta
54b0: 67 73 2c 20 6f 72 20 62 72 61 6e 63 68 65 73 29 gs, or branches)
54c0: 2e 0a 09 09 09 20 20 20 20 20 20 23 20 56 61 6c ..... # Val
54d0: 75 65 73 3a 20 53 65 65 20 6d 79 63 73 74 79 70 ues: See mycstyp
54e0: 65 2e 20 4e 6f 74 65 20 74 68 61 74 20 77 65 0a e. Note that we.
54f0: 09 09 09 20 20 20 20 20 20 23 20 68 61 76 65 20 ... # have
5500: 74 6f 20 6b 65 65 70 20 74 68 65 20 6e 61 6d 65 to keep the name
5510: 73 20 6f 66 20 74 68 65 20 68 65 6c 70 65 72 0a s of the helper.
5520: 09 09 09 20 20 20 20 20 20 23 20 73 69 6e 67 6c ... # singl
5530: 65 74 6f 6e 73 20 69 6e 20 73 79 6e 63 20 77 69 etons in sync wi
5540: 74 68 20 74 68 65 20 63 6f 6e 74 65 6e 74 73 0a th the contents.
5550: 09 09 09 20 20 20 20 20 20 23 20 6f 66 20 73 74 ... # of st
5560: 61 74 65 20 74 61 62 6c 65 20 27 63 73 74 79 70 ate table 'cstyp
5570: 65 27 2c 20 61 6e 64 20 76 61 72 69 6f 75 73 0a e', and various.
5580: 09 09 09 20 20 20 20 20 20 23 20 6f 74 68 65 72 ... # other
5590: 20 70 6c 61 63 65 73 20 75 73 69 6e 67 20 74 68 places using th
55a0: 65 6d 20 68 61 72 64 77 69 72 65 64 2e 0a 20 20 em hardwired..
55b0: 20 20 76 61 72 69 61 62 6c 65 20 6d 79 74 79 70 variable mytyp
55c0: 65 6f 62 6a 20 20 20 7b 7d 20 3b 20 23 20 52 65 eobj {} ; # Re
55d0: 66 65 72 65 6e 63 65 20 74 6f 20 74 68 65 20 63 ference to the c
55e0: 6f 6e 74 61 69 6e 65 72 20 66 6f 72 20 74 68 65 ontainer for the
55f0: 0a 09 09 09 20 20 20 20 20 20 23 20 74 79 70 65 .... # type
5600: 20 64 65 70 65 6e 64 65 6e 74 20 63 6f 64 65 2e dependent code.
5610: 20 44 65 72 69 76 65 64 20 66 72 6f 6d 0a 09 09 Derived from...
5620: 09 20 20 20 20 20 20 23 20 6d 79 74 79 70 65 2e . # mytype.
5630: 0a 20 20 20 20 76 61 72 69 61 62 6c 65 20 6d 79 . variable my
5640: 73 72 63 69 64 20 20 20 20 20 7b 7d 20 3b 20 23 srcid {} ; #
5650: 20 49 64 20 6f 66 20 74 68 65 20 6d 65 74 61 64 Id of the metad
5660: 61 74 61 20 6f 72 20 73 79 6d 62 6f 6c 20 74 68 ata or symbol th
5670: 65 20 63 73 65 74 0a 09 09 09 20 20 20 20 20 20 e cset....
5680: 23 20 69 73 20 62 61 73 65 64 20 6f 6e 2e 0a 20 # is based on..
5690: 20 20 20 76 61 72 69 61 62 6c 65 20 6d 79 69 74 variable myit
56a0: 65 6d 73 20 20 20 20 20 7b 7d 20 3b 20 23 20 4c ems {} ; # L
56b0: 69 73 74 20 6f 66 20 74 68 65 20 66 69 6c 65 20 ist of the file
56c0: 6c 65 76 65 6c 20 72 65 76 69 73 69 6f 6e 73 2c level revisions,
56d0: 0a 09 09 09 20 20 20 20 20 20 23 20 74 61 67 73 .... # tags
56e0: 2c 20 6f 72 20 62 72 61 6e 63 68 65 73 20 69 6e , or branches in
56f0: 20 74 68 65 20 63 73 65 74 2c 20 61 73 0a 09 09 the cset, as...
5700: 09 20 20 20 20 20 20 23 20 69 64 73 2e 20 4e 6f . # ids. No
5710: 74 20 74 61 67 67 65 64 2e 0a 20 20 20 20 76 61 t tagged.. va
5720: 72 69 61 62 6c 65 20 6d 79 74 69 74 65 6d 73 20 riable mytitems
5730: 20 20 20 7b 7d 20 3b 20 23 20 41 73 20 6d 79 69 {} ; # As myi
5740: 74 65 6d 73 2c 20 74 68 65 20 74 61 67 67 65 64 tems, the tagged
5750: 20 66 6f 72 6d 2e 0a 20 20 20 20 76 61 72 69 61 form.. varia
5760: 62 6c 65 20 6d 79 70 6f 73 20 20 20 20 20 20 20 ble mypos
5770: 7b 7d 20 3b 20 23 20 43 6f 6d 6d 69 74 20 70 6f {} ; # Commit po
5780: 73 69 74 69 6f 6e 20 6f 66 20 74 68 65 20 63 68 sition of the ch
5790: 61 6e 67 65 73 65 74 2c 20 69 66 0a 09 09 09 20 angeset, if....
57a0: 20 20 20 20 20 23 20 6b 6e 6f 77 6e 2e 0a 0a 20 # known...
57b0: 20 20 20 23 20 23 20 23 23 20 23 23 23 20 23 23 # # ## ### ##
57c0: 23 23 23 20 23 23 23 23 23 23 23 23 20 23 23 23 ### ######## ###
57d0: 23 23 23 23 23 23 23 23 23 23 0a 20 20 20 20 23 ##########. #
57e0: 23 20 49 6e 74 65 72 6e 61 6c 20 6d 65 74 68 6f # Internal metho
57f0: 64 73 0a 0a 20 20 20 20 74 79 70 65 76 61 72 69 ds.. typevari
5800: 61 62 6c 65 20 6d 79 63 6f 75 6e 74 65 72 20 20 able mycounter
5810: 20 20 20 20 20 20 30 20 3b 20 23 20 49 64 20 63 0 ; # Id c
5820: 6f 75 6e 74 65 72 20 66 6f 72 20 63 73 65 74 73 ounter for csets
5830: 2e 20 4c 61 73 74 20 69 64 0a 09 09 09 09 20 20 . Last id.....
5840: 20 20 20 20 23 20 75 73 65 64 2e 0a 20 20 20 20 # used..
5850: 74 79 70 65 76 61 72 69 61 62 6c 65 20 6d 79 63 typevariable myc
5860: 73 74 79 70 65 20 2d 61 72 72 61 79 20 7b 7d 20 stype -array {}
5870: 3b 20 23 20 4d 61 70 20 63 73 74 79 70 65 73 20 ; # Map cstypes
5880: 28 6e 61 6d 65 73 29 20 74 6f 20 70 65 72 73 69 (names) to persi
5890: 73 74 65 6e 74 0a 09 09 09 09 20 20 20 20 20 20 stent.....
58a0: 23 20 69 64 73 2e 20 4e 6f 74 65 20 74 68 61 74 # ids. Note that
58b0: 20 77 65 20 68 61 76 65 20 74 6f 20 6b 65 65 70 we have to keep
58c0: 0a 09 09 09 09 20 20 20 20 20 20 23 20 74 68 65 ..... # the
58d0: 20 6e 61 6d 65 73 20 69 6e 20 74 68 65 20 74 61 names in the ta
58e0: 62 6c 65 20 27 63 73 74 79 70 65 27 0a 09 09 09 ble 'cstype'....
58f0: 09 20 20 20 20 20 20 23 20 69 6e 20 73 79 6e 63 . # in sync
5900: 20 77 69 74 68 20 74 68 65 20 6e 61 6d 65 73 20 with the names
5910: 6f 66 20 74 68 65 0a 09 09 09 09 20 20 20 20 20 of the.....
5920: 20 23 20 68 65 6c 70 65 72 20 73 69 6e 67 6c 65 # helper single
5930: 74 6f 6e 73 2e 0a 0a 20 20 20 20 74 79 70 65 6d tons... typem
5940: 65 74 68 6f 64 20 69 6e 6f 72 64 65 72 20 7b 70 ethod inorder {p
5950: 72 6f 6a 65 63 74 69 64 7d 20 7b 0a 09 23 20 52 rojectid} {..# R
5960: 65 74 75 72 6e 20 61 6c 6c 20 72 65 76 69 73 69 eturn all revisi
5970: 6f 6e 20 63 68 61 6e 67 65 73 65 74 73 20 66 6f on changesets fo
5980: 72 20 74 68 65 20 73 70 65 63 69 66 69 65 64 20 r the specified
5990: 70 72 6f 6a 65 63 74 2c 20 69 6e 0a 09 23 20 74 project, in..# t
59a0: 68 65 20 6f 72 64 65 72 20 67 69 76 65 6e 20 74 he order given t
59b0: 6f 20 74 68 65 6d 20 62 79 20 74 68 65 20 73 6f o them by the so
59c0: 72 74 20 70 61 73 73 65 73 2e 20 42 6f 74 68 20 rt passes. Both
59d0: 74 68 65 0a 09 23 20 66 69 6c 74 65 72 69 6e 67 the..# filtering
59e0: 20 62 79 20 70 72 6f 6a 65 63 74 20 61 6e 64 20 by project and
59f0: 73 6f 72 74 69 6e 67 20 6d 61 6b 65 20 75 73 65 sorting make use
5a00: 20 6f 66 20 27 70 72 6f 6a 65 63 74 3a 3a 72 65 of 'project::re
5a10: 76 0a 09 23 20 72 65 76 27 20 69 6d 70 6f 73 73 v..# rev' imposs
5a20: 69 62 6c 65 2e 0a 0a 09 73 65 74 20 72 65 73 20 ible....set res
5a30: 7b 7d 0a 09 66 6f 72 65 61 63 68 20 7b 63 69 64 {}..foreach {cid
5a40: 20 63 64 61 74 65 7d 20 5b 73 74 61 74 65 20 72 cdate} [state r
5a50: 75 6e 20 7b 0a 09 20 20 20 20 53 45 4c 45 43 54 un {.. SELECT
5a60: 20 43 2e 63 69 64 2c 20 54 2e 64 61 74 65 0a 09 C.cid, T.date..
5a70: 20 20 20 20 46 52 4f 4d 20 20 20 63 68 61 6e 67 FROM chang
5a80: 65 73 65 74 20 43 2c 20 63 73 74 69 6d 65 73 74 eset C, cstimest
5a90: 61 6d 70 20 54 0a 09 20 20 20 20 57 48 45 52 45 amp T.. WHERE
5aa0: 20 20 43 2e 74 79 70 65 20 3d 20 30 20 20 20 20 C.type = 0
5ab0: 20 20 20 20 20 20 2d 2d 20 6c 69 6d 69 74 20 74 -- limit t
5ac0: 6f 20 72 65 76 69 73 69 6f 6e 20 63 68 61 6e 67 o revision chang
5ad0: 65 73 65 74 73 0a 09 20 20 20 20 41 4e 44 20 20 esets.. AND
5ae0: 20 20 43 2e 70 69 64 20 20 3d 20 24 70 72 6f 6a C.pid = $proj
5af0: 65 63 74 69 64 20 2d 2d 20 6c 69 6d 69 74 20 74 ectid -- limit t
5b00: 6f 20 63 68 61 6e 67 65 73 65 74 73 20 69 6e 20 o changesets in
5b10: 70 72 6f 6a 65 63 74 0a 09 20 20 20 20 41 4e 44 project.. AND
5b20: 20 20 20 20 54 2e 63 69 64 20 20 3d 20 43 2e 63 T.cid = C.c
5b30: 69 64 20 20 20 20 20 20 2d 2d 20 67 65 74 20 6f id -- get o
5b40: 72 64 65 72 69 6e 67 20 69 6e 66 6f 72 6d 61 74 rdering informat
5b50: 69 6f 6e 0a 09 20 20 20 20 4f 52 44 45 52 20 42 ion.. ORDER B
5b60: 59 20 54 2e 64 61 74 65 20 20 20 20 20 20 20 20 Y T.date
5b70: 20 20 20 20 2d 2d 20 73 6f 72 74 20 69 6e 74 6f -- sort into
5b80: 20 63 6f 6d 6d 69 74 20 6f 72 64 65 72 0a 09 7d commit order..}
5b90: 5d 20 7b 0a 09 20 20 20 20 6c 61 70 70 65 6e 64 ] {.. lappend
5ba0: 20 72 65 73 20 24 6d 79 69 64 6d 61 70 28 24 63 res $myidmap($c
5bb0: 69 64 29 20 24 63 64 61 74 65 0a 09 7d 0a 09 72 id) $cdate..}..r
5bc0: 65 74 75 72 6e 20 24 72 65 73 0a 20 20 20 20 7d eturn $res. }
5bd0: 0a 0a 20 20 20 20 74 79 70 65 6d 65 74 68 6f 64 .. typemethod
5be0: 20 67 65 74 63 73 74 79 70 65 73 20 7b 7d 20 7b getcstypes {} {
5bf0: 0a 09 66 6f 72 65 61 63 68 20 7b 74 69 64 20 6e ..foreach {tid n
5c00: 61 6d 65 7d 20 5b 73 74 61 74 65 20 72 75 6e 20 ame} [state run
5c10: 7b 0a 09 20 20 20 20 53 45 4c 45 43 54 20 74 69 {.. SELECT ti
5c20: 64 2c 20 6e 61 6d 65 20 46 52 4f 4d 20 63 73 74 d, name FROM cst
5c30: 79 70 65 3b 0a 09 7d 5d 20 7b 20 73 65 74 20 6d ype;..}] { set m
5c40: 79 63 73 74 79 70 65 28 24 6e 61 6d 65 29 20 24 ycstype($name) $
5c50: 74 69 64 20 7d 0a 09 72 65 74 75 72 6e 0a 20 20 tid }..return.
5c60: 20 20 7d 0a 0a 20 20 20 20 74 79 70 65 6d 65 74 }.. typemet
5c70: 68 6f 64 20 6c 6f 61 64 20 7b 72 65 70 6f 73 69 hod load {reposi
5c80: 74 6f 72 79 7d 20 7b 0a 09 73 65 74 20 6e 20 30 tory} {..set n 0
5c90: 0a 09 6c 6f 67 20 77 72 69 74 65 20 32 20 63 73 ..log write 2 cs
5ca0: 65 74 73 20 7b 4c 6f 61 64 69 6e 67 20 74 68 65 ets {Loading the
5cb0: 20 63 68 61 6e 67 65 73 65 74 73 7d 0a 09 66 6f changesets}..fo
5cc0: 72 65 61 63 68 20 7b 69 64 20 70 69 64 20 63 73 reach {id pid cs
5cd0: 74 79 70 65 20 73 72 63 69 64 7d 20 5b 73 74 61 type srcid} [sta
5ce0: 74 65 20 72 75 6e 20 7b 0a 09 20 20 20 20 53 45 te run {.. SE
5cf0: 4c 45 43 54 20 43 2e 63 69 64 2c 20 43 2e 70 69 LECT C.cid, C.pi
5d00: 64 2c 20 43 53 2e 6e 61 6d 65 2c 20 43 2e 73 72 d, CS.name, C.sr
5d10: 63 0a 09 20 20 20 20 46 52 4f 4d 20 20 20 63 68 c.. FROM ch
5d20: 61 6e 67 65 73 65 74 20 43 2c 20 63 73 74 79 70 angeset C, cstyp
5d30: 65 20 43 53 0a 09 20 20 20 20 57 48 45 52 45 20 e CS.. WHERE
5d40: 20 43 2e 74 79 70 65 20 3d 20 43 53 2e 74 69 64 C.type = CS.tid
5d50: 0a 09 20 20 20 20 4f 52 44 45 52 20 42 59 20 43 .. ORDER BY C
5d60: 2e 63 69 64 0a 09 7d 5d 20 7b 0a 09 20 20 20 20 .cid..}] {..
5d70: 6c 6f 67 20 70 72 6f 67 72 65 73 73 20 32 20 63 log progress 2 c
5d80: 73 65 74 73 20 24 6e 20 7b 7d 0a 09 20 20 20 20 sets $n {}..
5d90: 73 65 74 20 72 20 5b 24 74 79 70 65 20 25 41 55 set r [$type %AU
5da0: 54 4f 25 20 5b 24 72 65 70 6f 73 69 74 6f 72 79 TO% [$repository
5db0: 20 70 72 6f 6a 65 63 74 6f 66 20 24 70 69 64 5d projectof $pid]
5dc0: 20 24 63 73 74 79 70 65 20 24 73 72 63 69 64 20 $cstype $srcid
5dd0: 5b 73 74 61 74 65 20 72 75 6e 20 7b 0a 09 09 53 [state run {...S
5de0: 45 4c 45 43 54 20 43 2e 69 69 64 0a 09 09 46 52 ELECT C.iid...FR
5df0: 4f 4d 20 20 20 63 73 69 74 65 6d 20 43 0a 09 09 OM csitem C...
5e00: 57 48 45 52 45 20 20 43 2e 63 69 64 20 3d 20 24 WHERE C.cid = $
5e10: 69 64 0a 09 09 4f 52 44 45 52 20 42 59 20 43 2e id...ORDER BY C.
5e20: 70 6f 73 0a 09 20 20 20 20 7d 5d 20 24 69 64 5d pos.. }] $id]
5e30: 0a 09 20 20 20 20 69 6e 63 72 20 6e 0a 09 7d 0a .. incr n..}.
5e40: 09 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 .return. }..
5e50: 20 20 20 74 79 70 65 6d 65 74 68 6f 64 20 6c 6f typemethod lo
5e60: 61 64 63 6f 75 6e 74 65 72 20 7b 7d 20 7b 0a 09 adcounter {} {..
5e70: 23 20 49 6e 69 74 69 61 6c 69 7a 65 20 74 68 65 # Initialize the
5e80: 20 63 6f 75 6e 74 65 72 20 66 72 6f 6d 20 74 68 counter from th
5e90: 65 20 73 74 61 74 65 0a 09 6c 6f 67 20 77 72 69 e state..log wri
5ea0: 74 65 20 32 20 63 73 65 74 73 20 7b 4c 6f 61 64 te 2 csets {Load
5eb0: 69 6e 67 20 63 68 61 6e 67 65 73 65 74 20 63 6f ing changeset co
5ec0: 75 6e 74 65 72 7d 0a 09 73 65 74 20 6d 79 63 6f unter}..set myco
5ed0: 75 6e 74 65 72 20 5b 73 74 61 74 65 20 6f 6e 65 unter [state one
5ee0: 20 7b 20 53 45 4c 45 43 54 20 4d 41 58 28 63 69 { SELECT MAX(ci
5ef0: 64 29 20 46 52 4f 4d 20 63 68 61 6e 67 65 73 65 d) FROM changese
5f00: 74 20 7d 5d 0a 09 72 65 74 75 72 6e 0a 20 20 20 t }]..return.
5f10: 20 7d 0a 0a 20 20 20 20 74 79 70 65 6d 65 74 68 }.. typemeth
5f20: 6f 64 20 6e 75 6d 20 7b 7d 20 7b 20 72 65 74 75 od num {} { retu
5f30: 72 6e 20 24 6d 79 63 6f 75 6e 74 65 72 20 7d 0a rn $mycounter }.
5f40: 0a 20 20 20 20 70 72 6f 63 20 49 6e 69 74 69 61 . proc Initia
5f50: 6c 69 7a 65 42 72 65 61 6b 53 74 61 74 65 20 7b lizeBreakState {
5f60: 72 65 76 69 73 69 6f 6e 73 7d 20 7b 0a 09 75 70 revisions} {..up
5f70: 76 61 72 20 31 20 70 6f 73 20 70 6f 73 20 63 72 var 1 pos pos cr
5f80: 6f 73 73 20 63 72 6f 73 73 20 72 61 6e 67 65 20 oss cross range
5f90: 72 61 6e 67 65 20 64 65 70 63 20 64 65 70 63 20 range depc depc
5fa0: 64 65 6c 74 61 20 64 65 6c 74 61 20 5c 0a 09 20 delta delta \..
5fb0: 20 20 20 64 65 70 65 6e 64 65 6e 63 69 65 73 20 dependencies
5fc0: 64 65 70 65 6e 64 65 6e 63 69 65 73 0a 0a 09 23 dependencies...#
5fd0: 20 46 69 72 73 74 20 77 65 20 63 72 65 61 74 65 First we create
5fe0: 20 61 20 6d 61 70 20 6f 66 20 70 6f 73 69 74 69 a map of positi
5ff0: 6f 6e 73 20 74 6f 20 6d 61 6b 65 20 69 74 20 65 ons to make it e
6000: 61 73 69 65 72 20 74 6f 0a 09 23 20 64 65 74 65 asier to..# dete
6010: 72 6d 69 6e 65 20 77 68 65 74 68 65 72 20 61 20 rmine whether a
6020: 64 65 70 65 6e 64 65 6e 63 79 20 63 72 6f 73 73 dependency cross
6030: 65 73 20 61 20 70 61 72 74 69 63 75 6c 61 72 20 es a particular
6040: 69 6e 64 65 78 2e 0a 0a 09 61 72 72 61 79 20 73 index....array s
6050: 65 74 20 70 6f 73 20 20 20 7b 7d 0a 09 61 72 72 et pos {}..arr
6060: 61 79 20 73 65 74 20 63 72 6f 73 73 20 7b 7d 0a ay set cross {}.
6070: 09 61 72 72 61 79 20 73 65 74 20 64 65 70 63 20 .array set depc
6080: 20 7b 7d 0a 09 73 65 74 20 72 61 6e 67 65 20 20 {}..set range
6090: 20 20 20 20 20 7b 7d 0a 09 73 65 74 20 6e 20 30 {}..set n 0
60a0: 0a 09 66 6f 72 65 61 63 68 20 72 65 76 20 24 72 ..foreach rev $r
60b0: 65 76 69 73 69 6f 6e 73 20 7b 0a 09 20 20 20 20 evisions {..
60c0: 6c 61 70 70 65 6e 64 20 72 61 6e 67 65 20 24 6e lappend range $n
60d0: 0a 09 20 20 20 20 73 65 74 20 70 6f 73 28 24 72 .. set pos($r
60e0: 65 76 29 20 24 6e 0a 09 20 20 20 20 73 65 74 20 ev) $n.. set
60f0: 63 72 6f 73 73 28 24 6e 29 20 30 0a 09 20 20 20 cross($n) 0..
6100: 20 69 6e 63 72 20 6e 0a 09 7d 0a 0a 09 23 20 53 incr n..}...# S
6110: 65 63 6f 6e 64 6c 79 20 77 65 20 63 6f 75 6e 74 econdly we count
6120: 20 74 68 65 20 63 72 6f 73 73 69 6e 67 73 20 70 the crossings p
6130: 65 72 20 70 6f 73 69 74 69 6f 6e 2c 20 62 79 20 er position, by
6140: 69 74 65 72 61 74 69 6e 67 0a 09 23 20 6f 76 65 iterating..# ove
6150: 72 20 74 68 65 20 72 65 63 6f 72 64 65 64 20 69 r the recorded i
6160: 6e 74 65 72 6e 61 6c 20 64 65 70 65 6e 64 65 6e nternal dependen
6170: 63 69 65 73 2e 0a 0a 09 23 20 4e 6f 74 65 3a 20 cies....# Note:
6180: 49 66 20 74 68 65 20 74 69 6d 65 73 74 61 6d 70 If the timestamp
6190: 73 20 61 72 65 20 62 61 64 6c 79 20 6f 75 74 20 s are badly out
61a0: 6f 66 20 6f 72 64 65 72 20 69 74 20 69 73 0a 09 of order it is..
61b0: 23 20 20 20 20 20 20 20 70 6f 73 73 69 62 6c 65 # possible
61c0: 20 74 6f 20 68 61 76 65 20 61 20 62 61 63 6b 77 to have a backw
61d0: 61 72 64 20 73 75 63 63 65 73 73 6f 72 20 64 65 ard successor de
61e0: 70 65 6e 64 65 6e 63 79 2c 0a 09 23 20 20 20 20 pendency,..#
61f0: 20 20 20 69 2e 65 2e 20 77 69 74 68 20 73 74 61 i.e. with sta
6200: 72 74 20 3e 20 65 6e 64 2e 20 57 65 20 6d 61 79 rt > end. We may
6210: 20 68 61 76 65 20 74 6f 20 73 77 61 70 20 74 68 have to swap th
6220: 65 20 69 6e 64 69 63 65 73 0a 09 23 20 20 20 20 e indices..#
6230: 20 20 20 74 6f 20 65 6e 73 75 72 65 20 74 68 61 to ensure tha
6240: 74 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 t the following
6250: 6c 6f 6f 70 20 72 75 6e 73 20 63 6f 72 72 65 63 loop runs correc
6260: 74 6c 79 2e 0a 09 23 0a 09 23 20 4e 6f 74 65 20 tly...#..# Note
6270: 32 3a 20 73 74 61 72 74 20 3d 3d 20 65 6e 64 20 2: start == end
6280: 69 73 20 6e 6f 74 20 70 6f 73 73 69 62 6c 65 2e is not possible.
6290: 20 49 74 20 69 6e 64 69 63 61 74 65 73 20 61 0a It indicates a.
62a0: 09 23 20 20 20 20 20 20 20 20 20 73 65 6c 66 2d .# self-
62b0: 64 65 70 65 6e 64 65 6e 63 79 20 64 75 65 20 74 dependency due t
62c0: 6f 20 74 68 65 20 75 6e 69 71 75 65 6e 65 73 73 o the uniqueness
62d0: 20 6f 66 20 70 6f 73 69 74 69 6f 6e 73 2c 0a 09 of positions,..
62e0: 23 20 20 20 20 20 20 20 20 20 61 6e 64 20 74 68 # and th
62f0: 61 74 20 69 73 20 73 6f 6d 65 74 68 69 6e 67 20 at is something
6300: 77 65 20 68 61 76 65 20 72 75 6c 65 64 20 6f 75 we have ruled ou
6310: 74 20 61 6c 72 65 61 64 79 2c 20 73 65 65 0a 09 t already, see..
6320: 23 20 20 20 20 20 20 20 20 20 27 72 65 76 20 69 # 'rev i
6330: 6e 74 65 72 6e 61 6c 73 75 63 63 65 73 73 6f 72 nternalsuccessor
6340: 73 27 2e 0a 0a 09 66 6f 72 65 61 63 68 20 7b 72 s'....foreach {r
6350: 69 64 20 63 68 69 6c 64 72 65 6e 7d 20 5b 61 72 id children} [ar
6360: 72 61 79 20 67 65 74 20 64 65 70 65 6e 64 65 6e ray get dependen
6370: 63 69 65 73 5d 20 7b 0a 09 20 20 20 20 66 6f 72 cies] {.. for
6380: 65 61 63 68 20 63 68 69 6c 64 20 24 63 68 69 6c each child $chil
6390: 64 72 65 6e 20 7b 0a 09 09 73 65 74 20 64 6b 65 dren {...set dke
63a0: 79 20 20 20 20 5b 6c 69 73 74 20 24 72 69 64 20 y [list $rid
63b0: 24 63 68 69 6c 64 5d 0a 09 09 73 65 74 20 73 74 $child]...set st
63c0: 61 72 74 20 20 20 24 70 6f 73 28 24 72 69 64 29 art $pos($rid)
63d0: 0a 09 09 73 65 74 20 65 6e 64 20 20 20 20 20 24 ...set end $
63e0: 70 6f 73 28 24 63 68 69 6c 64 29 0a 09 09 73 65 pos($child)...se
63f0: 74 20 63 72 6f 73 73 65 73 20 7b 7d 0a 0a 09 09 t crosses {}....
6400: 69 66 20 7b 24 73 74 61 72 74 20 3e 20 24 65 6e if {$start > $en
6410: 64 7d 20 7b 0a 09 09 20 20 20 20 77 68 69 6c 65 d} {... while
6420: 20 7b 24 65 6e 64 20 3c 20 24 73 74 61 72 74 7d {$end < $start}
6430: 20 7b 0a 09 09 09 6c 61 70 70 65 6e 64 20 63 72 {....lappend cr
6440: 6f 73 73 65 73 20 24 65 6e 64 0a 09 09 09 69 6e osses $end....in
6450: 63 72 20 63 72 6f 73 73 28 24 65 6e 64 29 0a 09 cr cross($end)..
6460: 09 09 69 6e 63 72 20 65 6e 64 0a 09 09 20 20 20 ..incr end...
6470: 20 7d 0a 09 09 7d 20 65 6c 73 65 20 7b 0a 09 09 }...} else {...
6480: 20 20 20 20 77 68 69 6c 65 20 7b 24 73 74 61 72 while {$star
6490: 74 20 3c 20 24 65 6e 64 7d 20 7b 0a 09 09 09 6c t < $end} {....l
64a0: 61 70 70 65 6e 64 20 63 72 6f 73 73 65 73 20 24 append crosses $
64b0: 73 74 61 72 74 0a 09 09 09 69 6e 63 72 20 63 72 start....incr cr
64c0: 6f 73 73 28 24 73 74 61 72 74 29 0a 09 09 09 69 oss($start)....i
64d0: 6e 63 72 20 73 74 61 72 74 0a 09 09 20 20 20 20 ncr start...
64e0: 7d 0a 09 09 7d 0a 09 09 73 65 74 20 64 65 70 63 }...}...set depc
64f0: 28 24 64 6b 65 79 29 20 24 63 72 6f 73 73 65 73 ($dkey) $crosses
6500: 0a 09 20 20 20 20 7d 0a 09 7d 0a 0a 09 49 6e 69 .. }..}...Ini
6510: 74 69 61 6c 69 7a 65 44 65 6c 74 61 73 20 24 72 tializeDeltas $r
6520: 65 76 69 73 69 6f 6e 73 0a 09 72 65 74 75 72 6e evisions..return
6530: 0a 20 20 20 20 7d 0a 0a 20 20 20 20 70 72 6f 63 . }.. proc
6540: 20 49 6e 69 74 69 61 6c 69 7a 65 44 65 6c 74 61 InitializeDelta
6550: 73 20 7b 72 65 76 69 73 69 6f 6e 73 7d 20 7b 0a s {revisions} {.
6560: 09 75 70 76 61 72 20 31 20 64 65 6c 74 61 20 64 .upvar 1 delta d
6570: 65 6c 74 61 0a 0a 09 23 20 50 75 6c 6c 20 74 68 elta...# Pull th
6580: 65 20 74 69 6d 65 73 74 61 6d 70 73 20 66 6f 72 e timestamps for
6590: 20 61 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 69 all revisions i
65a0: 6e 20 74 68 65 20 63 68 61 6e 67 65 73 65 74 73 n the changesets
65b0: 20 61 6e 64 0a 09 23 20 63 6f 6d 70 75 74 65 20 and..# compute
65c0: 74 68 65 69 72 20 64 65 6c 74 61 73 20 66 6f 72 their deltas for
65d0: 20 75 73 65 20 62 79 20 74 68 65 20 62 72 65 61 use by the brea
65e0: 6b 20 66 69 6e 64 65 72 2e 0a 0a 09 61 72 72 61 k finder....arra
65f0: 79 20 73 65 74 20 64 65 6c 74 61 20 7b 7d 0a 09 y set delta {}..
6600: 61 72 72 61 79 20 73 65 74 20 73 74 61 6d 70 20 array set stamp
6610: 7b 7d 0a 0a 09 73 65 74 20 74 68 65 73 65 74 20 {}...set theset
6620: 28 27 5b 6a 6f 69 6e 20 24 72 65 76 69 73 69 6f ('[join $revisio
6630: 6e 73 20 7b 27 2c 27 7d 5d 27 29 0a 09 66 6f 72 ns {','}]')..for
6640: 65 61 63 68 20 7b 72 69 64 20 74 69 6d 65 7d 20 each {rid time}
6650: 5b 73 74 61 74 65 20 72 75 6e 20 5b 73 75 62 73 [state run [subs
6660: 74 20 2d 6e 6f 63 6f 6d 6d 61 6e 64 73 20 2d 6e t -nocommands -n
6670: 6f 62 61 63 6b 73 6c 61 73 68 65 73 20 7b 0a 09 obackslashes {..
6680: 20 20 20 20 53 45 4c 45 43 54 20 52 2e 72 69 64 SELECT R.rid
6690: 2c 20 52 2e 64 61 74 65 0a 09 20 20 20 20 46 52 , R.date.. FR
66a0: 4f 4d 20 72 65 76 69 73 69 6f 6e 20 52 0a 09 20 OM revision R..
66b0: 20 20 20 57 48 45 52 45 20 52 2e 72 69 64 20 49 WHERE R.rid I
66c0: 4e 20 24 74 68 65 73 65 74 0a 09 7d 5d 5d 20 7b N $theset..}]] {
66d0: 0a 09 20 20 20 20 73 65 74 20 73 74 61 6d 70 28 .. set stamp(
66e0: 24 72 69 64 29 20 24 74 69 6d 65 0a 09 7d 0a 0a $rid) $time..}..
66f0: 09 73 65 74 20 6e 20 30 0a 09 66 6f 72 65 61 63 .set n 0..foreac
6700: 68 20 72 69 64 20 5b 6c 72 61 6e 67 65 20 24 72 h rid [lrange $r
6710: 65 76 69 73 69 6f 6e 73 20 30 20 65 6e 64 2d 31 evisions 0 end-1
6720: 5d 20 72 6e 65 78 74 20 5b 6c 72 61 6e 67 65 20 ] rnext [lrange
6730: 24 72 65 76 69 73 69 6f 6e 73 20 31 20 65 6e 64 $revisions 1 end
6740: 5d 20 7b 0a 09 20 20 20 20 73 65 74 20 64 65 6c ] {.. set del
6750: 74 61 28 24 6e 29 20 5b 65 78 70 72 20 7b 24 73 ta($n) [expr {$s
6760: 74 61 6d 70 28 24 72 6e 65 78 74 29 20 2d 20 24 tamp($rnext) - $
6770: 73 74 61 6d 70 28 24 72 69 64 29 7d 5d 0a 09 20 stamp($rid)}]..
6780: 20 20 20 69 6e 63 72 20 6e 0a 09 7d 0a 09 72 65 incr n..}..re
6790: 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 turn. }..
67a0: 70 72 6f 63 20 46 69 6e 64 42 65 73 74 42 72 65 proc FindBestBre
67b0: 61 6b 20 7b 72 61 6e 67 65 7d 20 7b 0a 09 75 70 ak {range} {..up
67c0: 76 61 72 20 31 20 63 72 6f 73 73 20 63 72 6f 73 var 1 cross cros
67d0: 73 20 64 65 6c 74 61 20 64 65 6c 74 61 0a 0a 09 s delta delta...
67e0: 23 20 44 65 74 65 72 6d 69 6e 65 20 74 68 65 20 # Determine the
67f0: 62 65 73 74 20 62 72 65 61 6b 20 6c 6f 63 61 74 best break locat
6800: 69 6f 6e 20 69 6e 20 74 68 65 20 67 69 76 65 6e ion in the given
6810: 20 72 61 6e 67 65 20 6f 66 0a 09 23 20 70 6f 73 range of..# pos
6820: 69 74 69 6f 6e 73 2e 20 46 69 72 73 74 20 77 65 itions. First we
6830: 20 6c 6f 6f 6b 20 66 6f 72 20 74 68 65 20 6c 6f look for the lo
6840: 63 61 74 69 6f 6e 73 20 77 69 74 68 20 74 68 65 cations with the
6850: 20 6d 61 78 69 6d 61 6c 0a 09 23 20 6e 75 6d 62 maximal..# numb
6860: 65 72 20 6f 66 20 63 72 6f 73 73 69 6e 67 73 2e er of crossings.
6870: 20 49 66 20 74 68 65 72 65 20 61 72 65 20 73 65 If there are se
6880: 76 65 72 61 6c 20 77 65 20 6c 6f 6f 6b 20 66 6f veral we look fo
6890: 72 20 74 68 65 0a 09 23 20 73 68 6f 72 74 65 73 r the..# shortes
68a0: 74 20 74 69 6d 65 20 69 6e 74 65 72 76 61 6c 20 t time interval
68b0: 61 6d 6f 6e 67 20 74 68 65 6d 2e 20 49 66 20 77 among them. If w
68c0: 65 20 73 74 69 6c 6c 20 68 61 76 65 20 6d 75 6c e still have mul
68d0: 74 69 70 6c 65 0a 09 23 20 70 6f 73 73 69 62 69 tiple..# possibi
68e0: 6c 69 74 69 65 73 20 61 66 74 65 72 20 74 68 61 lities after tha
68f0: 74 20 77 65 20 73 65 6c 65 63 74 20 74 68 65 20 t we select the
6900: 65 61 72 6c 69 65 73 74 20 6c 6f 63 61 74 69 6f earliest locatio
6910: 6e 0a 09 23 20 61 6d 6f 6e 67 20 74 68 65 73 65 n..# among these
6920: 2e 0a 0a 09 23 20 4e 6f 74 65 3a 20 49 66 20 74 ....# Note: If t
6930: 68 65 20 6d 61 78 69 6d 61 6c 20 6e 75 6d 62 65 he maximal numbe
6940: 72 20 6f 66 20 63 72 6f 73 73 69 6e 67 73 20 69 r of crossings i
6950: 73 20 30 20 74 68 65 6e 20 74 68 65 20 72 61 6e s 0 then the ran
6960: 67 65 0a 09 23 20 20 20 20 20 20 20 68 61 73 20 ge..# has
6970: 6e 6f 20 69 6e 74 65 72 6e 61 6c 20 64 65 70 65 no internal depe
6980: 6e 64 65 6e 63 69 65 73 2c 20 61 6e 64 20 6e 6f ndencies, and no
6990: 20 62 72 65 61 6b 20 6c 6f 63 61 74 69 6f 6e 20 break location
69a0: 61 74 0a 09 23 20 20 20 20 20 20 20 61 6c 6c 2e at..# all.
69b0: 20 54 68 69 73 20 70 6f 73 73 69 62 69 6c 69 74 This possibilit
69c0: 79 20 69 73 20 73 69 67 6e 61 6c 65 64 20 76 69 y is signaled vi
69d0: 61 20 72 65 73 75 6c 74 20 2d 31 2e 0a 0a 09 23 a result -1....#
69e0: 20 4e 6f 74 65 3a 20 41 20 72 61 6e 67 65 20 6f Note: A range o
69f0: 66 20 6c 65 6e 67 74 68 20 31 20 6f 72 20 6c 65 f length 1 or le
6a00: 73 73 20 63 61 6e 6e 6f 74 20 68 61 76 65 20 69 ss cannot have i
6a10: 6e 74 65 72 6e 61 6c 0a 09 23 20 20 20 20 20 20 nternal..#
6a20: 20 64 65 70 65 6e 64 65 6e 63 69 65 73 2c 20 61 dependencies, a
6a30: 73 20 74 68 61 74 20 6e 65 65 64 73 20 61 74 20 s that needs at
6a40: 6c 65 61 73 74 20 74 77 6f 20 72 65 76 69 73 69 least two revisi
6a50: 6f 6e 73 20 69 6e 0a 09 23 20 20 20 20 20 20 20 ons in..#
6a60: 74 68 65 20 72 61 6e 67 65 2e 0a 0a 09 69 66 20 the range....if
6a70: 7b 5b 6c 6c 65 6e 67 74 68 20 24 72 61 6e 67 65 {[llength $range
6a80: 5d 20 3c 20 32 7d 20 7b 20 72 65 74 75 72 6e 20 ] < 2} { return
6a90: 2d 31 20 7d 0a 0a 09 73 65 74 20 6d 61 78 20 2d -1 }...set max -
6aa0: 31 0a 09 73 65 74 20 62 65 73 74 20 7b 7d 0a 0a 1..set best {}..
6ab0: 09 66 6f 72 65 61 63 68 20 6c 6f 63 61 74 69 6f .foreach locatio
6ac0: 6e 20 24 72 61 6e 67 65 20 7b 0a 09 20 20 20 20 n $range {..
6ad0: 73 65 74 20 63 72 6f 73 73 69 6e 67 73 20 24 63 set crossings $c
6ae0: 72 6f 73 73 28 24 6c 6f 63 61 74 69 6f 6e 29 0a ross($location).
6af0: 09 20 20 20 20 69 66 20 7b 24 63 72 6f 73 73 69 . if {$crossi
6b00: 6e 67 73 20 3e 20 24 6d 61 78 7d 20 7b 0a 09 09 ngs > $max} {...
6b10: 73 65 74 20 6d 61 78 20 20 24 63 72 6f 73 73 69 set max $crossi
6b20: 6e 67 73 0a 09 09 73 65 74 20 62 65 73 74 20 5b ngs...set best [
6b30: 6c 69 73 74 20 24 6c 6f 63 61 74 69 6f 6e 5d 0a list $location].
6b40: 09 09 63 6f 6e 74 69 6e 75 65 0a 09 20 20 20 20 ..continue..
6b50: 7d 20 65 6c 73 65 69 66 20 7b 24 63 72 6f 73 73 } elseif {$cross
6b60: 69 6e 67 73 20 3d 3d 20 24 6d 61 78 7d 20 7b 0a ings == $max} {.
6b70: 09 09 6c 61 70 70 65 6e 64 20 62 65 73 74 20 24 ..lappend best $
6b80: 6c 6f 63 61 74 69 6f 6e 0a 09 20 20 20 20 7d 0a location.. }.
6b90: 09 7d 0a 0a 09 69 66 20 7b 24 6d 61 78 20 3d 3d .}...if {$max ==
6ba0: 20 30 7d 20 20 20 20 20 20 20 20 20 20 20 20 7b 0} {
6bb0: 20 72 65 74 75 72 6e 20 2d 31 20 7d 0a 09 69 66 return -1 }..if
6bc0: 20 7b 5b 6c 6c 65 6e 67 74 68 20 24 62 65 73 74 {[llength $best
6bd0: 5d 20 3d 3d 20 31 7d 20 7b 20 72 65 74 75 72 6e ] == 1} { return
6be0: 20 5b 6c 69 6e 64 65 78 20 24 62 65 73 74 20 30 [lindex $best 0
6bf0: 5d 20 7d 0a 0a 09 73 65 74 20 6c 6f 63 61 74 69 ] }...set locati
6c00: 6f 6e 73 20 24 62 65 73 74 0a 09 73 65 74 20 62 ons $best..set b
6c10: 65 73 74 20 7b 7d 0a 09 73 65 74 20 6d 69 6e 20 est {}..set min
6c20: 2d 31 0a 0a 09 66 6f 72 65 61 63 68 20 6c 6f 63 -1...foreach loc
6c30: 61 74 69 6f 6e 20 24 6c 6f 63 61 74 69 6f 6e 73 ation $locations
6c40: 20 7b 0a 09 20 20 20 20 73 65 74 20 69 6e 74 65 {.. set inte
6c50: 72 76 61 6c 20 24 64 65 6c 74 61 28 24 6c 6f 63 rval $delta($loc
6c60: 61 74 69 6f 6e 29 0a 09 20 20 20 20 69 66 20 7b ation).. if {
6c70: 28 24 6d 69 6e 20 3c 20 30 29 20 7c 7c 20 28 24 ($min < 0) || ($
6c80: 69 6e 74 65 72 76 61 6c 20 3c 20 24 6d 69 6e 29 interval < $min)
6c90: 7d 20 7b 0a 09 09 73 65 74 20 6d 69 6e 20 20 24 } {...set min $
6ca0: 69 6e 74 65 72 76 61 6c 0a 09 09 73 65 74 20 62 interval...set b
6cb0: 65 73 74 20 5b 6c 69 73 74 20 24 6c 6f 63 61 74 est [list $locat
6cc0: 69 6f 6e 5d 0a 09 20 20 20 20 7d 20 65 6c 73 65 ion].. } else
6cd0: 69 66 20 7b 24 69 6e 74 65 72 76 61 6c 20 3d 3d if {$interval ==
6ce0: 20 24 6d 69 6e 7d 20 7b 0a 09 09 6c 61 70 70 65 $min} {...lappe
6cf0: 6e 64 20 62 65 73 74 20 24 6c 6f 63 61 74 69 6f nd best $locatio
6d00: 6e 0a 09 20 20 20 20 7d 0a 09 7d 0a 0a 09 69 66 n.. }..}...if
6d10: 20 7b 5b 6c 6c 65 6e 67 74 68 20 24 62 65 73 74 {[llength $best
6d20: 5d 20 3d 3d 20 31 7d 20 7b 20 72 65 74 75 72 6e ] == 1} { return
6d30: 20 5b 6c 69 6e 64 65 78 20 24 62 65 73 74 20 30 [lindex $best 0
6d40: 5d 20 7d 0a 0a 09 72 65 74 75 72 6e 20 5b 6c 69 ] }...return [li
6d50: 6e 64 65 78 20 5b 6c 73 6f 72 74 20 2d 69 6e 74 ndex [lsort -int
6d60: 65 67 65 72 20 2d 69 6e 63 72 65 61 73 69 6e 67 eger -increasing
6d70: 20 24 62 65 73 74 5d 20 30 5d 0a 20 20 20 20 7d $best] 0]. }
6d80: 0a 0a 20 20 20 20 70 72 6f 63 20 43 75 74 41 74 .. proc CutAt
6d90: 20 7b 6c 6f 63 61 74 69 6f 6e 7d 20 7b 0a 09 75 {location} {..u
6da0: 70 76 61 72 20 31 20 63 72 6f 73 73 20 63 72 6f pvar 1 cross cro
6db0: 73 73 20 64 65 70 63 20 64 65 70 63 0a 0a 09 23 ss depc depc...#
6dc0: 20 49 74 20 77 61 73 20 64 65 63 69 64 65 64 20 It was decided
6dd0: 74 6f 20 73 70 6c 69 74 20 74 68 65 20 63 68 61 to split the cha
6de0: 6e 67 65 73 65 74 20 61 74 20 74 68 65 20 67 69 ngeset at the gi
6df0: 76 65 6e 0a 09 23 20 6c 6f 63 61 74 69 6f 6e 2e ven..# location.
6e00: 20 54 68 69 73 20 63 75 74 73 20 61 20 6e 75 6d This cuts a num
6e10: 62 65 72 20 6f 66 20 64 65 70 65 6e 64 65 6e 63 ber of dependenc
6e20: 69 65 73 2e 20 48 65 72 65 20 77 65 20 75 70 64 ies. Here we upd
6e30: 61 74 65 0a 09 23 20 74 68 65 20 63 72 6f 73 73 ate..# the cross
6e40: 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 73 6f 20 information so
6e50: 74 68 61 74 20 74 68 65 20 62 72 65 61 6b 20 66 that the break f
6e60: 69 6e 64 65 72 20 68 61 73 20 61 63 63 75 72 61 inder has accura
6e70: 74 65 0a 09 23 20 64 61 74 61 20 77 68 65 6e 20 te..# data when
6e80: 77 65 20 6c 6f 6f 6b 20 61 74 20 74 68 65 20 67 we look at the g
6e90: 65 6e 65 72 61 74 65 64 20 66 72 61 67 6d 65 6e enerated fragmen
6ea0: 74 73 2e 0a 0a 09 73 65 74 20 73 69 78 20 5b 6c ts....set six [l
6eb0: 6f 67 20 76 69 73 69 62 6c 65 3f 20 36 5d 0a 0a og visible? 6]..
6ec0: 09 66 6f 72 65 61 63 68 20 7b 64 65 70 20 72 61 .foreach {dep ra
6ed0: 6e 67 65 7d 20 5b 61 72 72 61 79 20 67 65 74 20 nge} [array get
6ee0: 64 65 70 63 5d 20 7b 0a 09 20 20 20 20 23 20 43 depc] {.. # C
6ef0: 68 65 63 6b 20 61 6c 6c 20 64 65 70 65 6e 64 65 heck all depende
6f00: 6e 63 69 65 73 20 73 74 69 6c 6c 20 6b 6e 6f 77 ncies still know
6f10: 6e 2c 20 74 61 6b 65 20 74 68 65 69 72 20 72 61 n, take their ra
6f20: 6e 67 65 20 61 6e 64 0a 09 20 20 20 20 23 20 73 nge and.. # s
6f30: 65 65 20 69 66 20 74 68 65 20 62 72 65 61 6b 20 ee if the break
6f40: 6c 6f 63 61 74 69 6f 6e 20 66 61 6c 6c 73 20 77 location falls w
6f50: 69 74 68 69 6e 2e 0a 0a 09 20 20 20 20 42 6f 72 ithin.... Bor
6f60: 64 65 72 20 24 72 61 6e 67 65 20 73 20 65 0a 09 der $range s e..
6f70: 20 20 20 20 69 66 20 7b 24 6c 6f 63 61 74 69 6f if {$locatio
6f80: 6e 20 3c 20 24 73 7d 20 63 6f 6e 74 69 6e 75 65 n < $s} continue
6f90: 20 3b 20 23 20 62 72 65 61 6b 20 62 65 66 6f 72 ; # break befor
6fa0: 65 20 72 61 6e 67 65 2c 20 69 67 6e 6f 72 65 0a e range, ignore.
6fb0: 09 20 20 20 20 69 66 20 7b 24 6c 6f 63 61 74 69 . if {$locati
6fc0: 6f 6e 20 3e 20 24 65 7d 20 63 6f 6e 74 69 6e 75 on > $e} continu
6fd0: 65 20 3b 20 23 20 62 72 65 61 6b 20 61 66 74 65 e ; # break afte
6fe0: 72 20 72 61 6e 67 65 2c 20 69 67 6e 6f 72 65 2e r range, ignore.
6ff0: 0a 0a 09 20 20 20 20 23 20 54 68 69 73 20 64 65 ... # This de
7000: 70 65 6e 64 65 6e 63 79 20 63 72 6f 73 73 65 73 pendency crosses
7010: 20 74 68 65 20 62 72 65 61 6b 20 6c 6f 63 61 74 the break locat
7020: 69 6f 6e 2e 20 57 65 20 72 65 6d 6f 76 65 20 69 ion. We remove i
7030: 74 0a 09 20 20 20 20 23 20 66 72 6f 6d 20 74 68 t.. # from th
7040: 65 20 63 72 6f 73 73 69 6e 67 73 20 63 6f 75 6e e crossings coun
7050: 74 65 72 73 2c 20 61 6e 64 20 74 68 65 6e 20 61 ters, and then a
7060: 6c 73 6f 20 66 72 6f 6d 20 74 68 65 20 73 65 74 lso from the set
7070: 0a 09 20 20 20 20 23 20 6f 66 20 6b 6e 6f 77 6e .. # of known
7080: 20 64 65 70 65 6e 64 65 6e 63 69 65 73 2c 20 61 dependencies, a
7090: 73 20 77 65 20 61 72 65 20 64 6f 6e 65 20 77 69 s we are done wi
70a0: 74 68 20 69 74 2e 0a 0a 09 20 20 20 20 66 6f 72 th it.... for
70b0: 65 61 63 68 20 6c 6f 63 20 24 64 65 70 63 28 24 each loc $depc($
70c0: 64 65 70 29 20 7b 20 69 6e 63 72 20 63 72 6f 73 dep) { incr cros
70d0: 73 28 24 6c 6f 63 29 20 2d 31 20 7d 0a 09 20 20 s($loc) -1 }..
70e0: 20 20 75 6e 73 65 74 20 64 65 70 63 28 24 64 65 unset depc($de
70f0: 70 29 0a 0a 09 20 20 20 20 69 66 20 7b 21 24 73 p)... if {!$s
7100: 69 78 7d 20 63 6f 6e 74 69 6e 75 65 0a 0a 09 20 ix} continue...
7110: 20 20 20 73 74 72 75 63 74 3a 3a 6c 69 73 74 20 struct::list
7120: 61 73 73 69 67 6e 20 24 64 65 70 20 70 61 72 65 assign $dep pare
7130: 6e 74 20 63 68 69 6c 64 0a 09 20 20 20 20 6c 6f nt child.. lo
7140: 67 20 77 72 69 74 65 20 35 20 63 73 65 74 73 20 g write 5 csets
7150: 22 42 72 6f 6b 65 20 64 65 70 65 6e 64 65 6e 63 "Broke dependenc
7160: 79 20 5b 50 44 20 24 70 61 72 65 6e 74 5d 20 2d y [PD $parent] -
7170: 2d 3e 20 5b 50 44 20 24 63 68 69 6c 64 5d 22 0a -> [PD $child]".
7180: 09 7d 0a 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 .}...return.
7190: 7d 0a 0a 20 20 20 20 23 20 50 72 69 6e 74 20 69 }.. # Print i
71a0: 64 65 6e 74 69 66 79 69 6e 67 20 64 61 74 61 20 dentifying data
71b0: 66 6f 72 20 61 20 72 65 76 69 73 69 6f 6e 20 28 for a revision (
71c0: 70 72 6f 6a 65 63 74 2c 20 66 69 6c 65 2c 20 64 project, file, d
71d0: 6f 74 74 65 64 20 72 65 76 0a 20 20 20 20 23 20 otted rev. #
71e0: 6e 75 6d 62 65 72 29 2c 20 66 6f 72 20 68 69 67 number), for hig
71f0: 68 20 76 65 72 62 6f 73 69 74 79 20 6c 6f 67 20 h verbosity log
7200: 6f 75 74 70 75 74 2e 0a 20 20 20 20 23 20 54 4f output.. # TO
7210: 44 4f 3a 20 52 65 70 6c 61 63 65 20 77 69 74 68 DO: Replace with
7220: 20 63 61 6c 6c 20 74 6f 20 69 74 65 6d 73 74 72 call to itemstr
7230: 20 28 6c 69 73 74 20 72 65 76 20 24 69 64 29 0a (list rev $id).
7240: 0a 20 20 20 20 70 72 6f 63 20 50 44 20 7b 69 64 . proc PD {id
7250: 7d 20 7b 0a 09 66 6f 72 65 61 63 68 20 7b 70 20 } {..foreach {p
7260: 66 20 72 7d 20 5b 73 74 61 74 65 20 72 75 6e 20 f r} [state run
7270: 7b 0a 09 09 53 45 4c 45 43 54 20 50 2e 6e 61 6d {...SELECT P.nam
7280: 65 20 2c 20 46 2e 6e 61 6d 65 2c 20 52 2e 72 65 e , F.name, R.re
7290: 76 0a 09 09 46 52 4f 4d 20 72 65 76 69 73 69 6f v...FROM revisio
72a0: 6e 20 52 2c 20 66 69 6c 65 20 46 2c 20 70 72 6f n R, file F, pro
72b0: 6a 65 63 74 20 50 0a 09 09 57 48 45 52 45 20 52 ject P...WHERE R
72c0: 2e 72 69 64 20 3d 20 24 69 64 20 20 20 20 2d 2d .rid = $id --
72d0: 20 46 69 6e 64 20 73 70 65 63 69 66 69 65 64 20 Find specified
72e0: 66 69 6c 65 20 72 65 76 69 73 69 6f 6e 0a 09 09 file revision...
72f0: 41 4e 44 20 20 20 46 2e 66 69 64 20 3d 20 52 2e AND F.fid = R.
7300: 66 69 64 20 20 2d 2d 20 47 65 74 20 66 69 6c 65 fid -- Get file
7310: 20 6f 66 20 74 68 65 20 72 65 76 69 73 69 6f 6e of the revision
7320: 0a 09 09 41 4e 44 20 20 20 50 2e 70 69 64 20 3d ...AND P.pid =
7330: 20 46 2e 70 69 64 20 20 2d 2d 20 47 65 74 20 70 F.pid -- Get p
7340: 72 6f 6a 65 63 74 20 6f 66 20 74 68 65 20 66 69 roject of the fi
7350: 6c 65 2e 0a 09 7d 5d 20 62 72 65 61 6b 0a 09 72 le...}] break..r
7360: 65 74 75 72 6e 20 22 27 24 70 20 3a 20 24 66 2f eturn "'$p : $f/
7370: 24 72 27 22 0a 20 20 20 20 7d 0a 0a 20 20 20 20 $r'". }..
7380: 23 20 50 72 69 6e 74 69 6e 67 20 6f 6e 65 20 6f # Printing one o
7390: 72 20 6d 6f 72 65 20 72 61 6e 67 65 73 2c 20 66 r more ranges, f
73a0: 6f 72 6d 61 74 74 65 64 2c 20 61 6e 64 20 6f 6e ormatted, and on
73b0: 6c 79 20 74 68 65 69 72 20 62 6f 72 64 65 72 20 ly their border
73c0: 74 6f 0a 20 20 20 20 23 20 6b 65 65 70 20 74 68 to. # keep th
73d0: 65 20 73 74 72 69 6e 67 73 20 73 68 6f 72 74 2e e strings short.
73e0: 0a 0a 20 20 20 20 70 72 6f 63 20 50 52 73 20 7b .. proc PRs {
73f0: 72 61 6e 67 65 73 7d 20 7b 0a 09 72 65 74 75 72 ranges} {..retur
7400: 6e 20 5b 73 74 72 75 63 74 3a 3a 6c 69 73 74 20 n [struct::list
7410: 6d 61 70 20 24 72 61 6e 67 65 73 20 5b 6d 79 70 map $ranges [myp
7420: 72 6f 63 20 50 52 5d 5d 0a 20 20 20 20 7d 0a 0a roc PR]]. }..
7430: 20 20 20 20 70 72 6f 63 20 50 52 20 7b 72 61 6e proc PR {ran
7440: 67 65 7d 20 7b 0a 09 42 6f 72 64 65 72 20 24 72 ge} {..Border $r
7450: 61 6e 67 65 20 73 20 65 0a 09 72 65 74 75 72 6e ange s e..return
7460: 20 3c 24 7b 73 7d 2e 2e 2e 24 7b 65 7d 3e 0a 20 <${s}...${e}>.
7470: 20 20 20 7d 0a 0a 20 20 20 20 70 72 6f 63 20 42 }.. proc B
7480: 6f 72 64 65 72 20 7b 72 61 6e 67 65 20 73 76 20 order {range sv
7490: 65 76 7d 20 7b 0a 09 75 70 76 61 72 20 31 20 24 ev} {..upvar 1 $
74a0: 73 76 20 73 20 24 65 76 20 65 0a 09 73 65 74 20 sv s $ev e..set
74b0: 73 20 5b 6c 69 6e 64 65 78 20 24 72 61 6e 67 65 s [lindex $range
74c0: 20 30 5d 0a 09 73 65 74 20 65 20 5b 6c 69 6e 64 0]..set e [lind
74d0: 65 78 20 24 72 61 6e 67 65 20 65 6e 64 5d 0a 09 ex $range end]..
74e0: 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 return. }..
74f0: 20 20 23 20 23 20 23 23 20 23 23 23 20 23 23 23 # # ## ### ###
7500: 23 23 20 23 23 23 23 23 23 23 23 20 23 23 23 23 ## ######## ####
7510: 23 23 23 23 23 23 23 23 23 0a 0a 20 20 20 20 74 #########.. t
7520: 79 70 65 76 61 72 69 61 62 6c 65 20 6d 79 63 68 ypevariable mych
7530: 61 6e 67 65 73 65 74 73 20 20 20 20 20 20 20 20 angesets
7540: 20 7b 7d 20 3b 20 23 20 4c 69 73 74 20 6f 66 20 {} ; # List of
7550: 61 6c 6c 20 6b 6e 6f 77 6e 0a 09 09 09 09 09 20 all known......
7560: 20 20 23 20 63 68 61 6e 67 65 73 65 74 73 2e 0a # changesets..
7570: 0a 20 20 20 20 23 20 4c 69 73 74 20 6f 66 20 61 . # List of a
7580: 6c 6c 20 6b 6e 6f 77 6e 20 63 68 61 6e 67 65 73 ll known changes
7590: 65 74 73 20 6f 66 20 61 20 74 79 70 65 2e 0a 20 ets of a type..
75a0: 20 20 20 74 79 70 65 76 61 72 69 61 62 6c 65 20 typevariable
75b0: 6d 79 74 63 68 61 6e 67 65 73 65 74 73 20 2d 61 mytchangesets -a
75c0: 72 72 61 79 20 7b 0a 09 73 79 6d 3a 3a 62 72 61 rray {..sym::bra
75d0: 6e 63 68 20 7b 7d 0a 09 73 79 6d 3a 3a 74 61 67 nch {}..sym::tag
75e0: 20 20 20 20 7b 7d 0a 09 72 65 76 20 20 20 20 20 {}..rev
75f0: 20 20 20 20 7b 7d 0a 20 20 20 20 7d 0a 09 09 09 {}. }....
7600: 09 09 0a 20 20 20 20 74 79 70 65 76 61 72 69 61 ... typevaria
7610: 62 6c 65 20 6d 79 69 74 65 6d 6d 61 70 20 20 20 ble myitemmap
7620: 20 20 2d 61 72 72 61 79 20 7b 7d 20 3b 20 23 20 -array {} ; #
7630: 4d 61 70 20 66 72 6f 6d 20 69 74 65 6d 73 20 28 Map from items (
7640: 74 61 67 67 65 64 29 0a 09 09 09 09 09 20 20 20 tagged)......
7650: 23 20 74 6f 20 74 68 65 20 6c 69 73 74 20 6f 66 # to the list of
7660: 20 63 68 61 6e 67 65 73 65 74 73 0a 09 09 09 09 changesets.....
7670: 09 20 20 20 23 20 63 6f 6e 74 61 69 6e 69 6e 67 . # containing
7680: 20 69 74 2e 20 45 61 63 68 20 69 74 65 6d 0a 09 it. Each item..
7690: 09 09 09 09 20 20 20 23 20 63 61 6e 20 62 65 20 .... # can be
76a0: 75 73 65 64 20 62 79 20 6f 6e 6c 79 20 6f 6e 65 used by only one
76b0: 0a 09 09 09 09 09 20 20 20 23 20 63 68 61 6e 67 ...... # chang
76c0: 65 73 65 74 2e 0a 20 20 20 20 74 79 70 65 76 61 eset.. typeva
76d0: 72 69 61 62 6c 65 20 6d 79 69 64 6d 61 70 20 20 riable myidmap
76e0: 20 2d 61 72 72 61 79 20 7b 7d 20 3b 20 23 20 4d -array {} ; # M
76f0: 61 70 20 66 72 6f 6d 20 63 68 61 6e 67 65 73 65 ap from changese
7700: 74 20 69 64 20 74 6f 0a 09 09 09 09 20 20 20 20 t id to.....
7710: 20 20 20 23 20 63 68 61 6e 67 65 73 65 74 2e 0a # changeset..
7720: 0a 20 20 20 20 74 79 70 65 6d 65 74 68 6f 64 20 . typemethod
7730: 61 6c 6c 20 20 20 20 7b 7d 20 20 20 20 7b 20 72 all {} { r
7740: 65 74 75 72 6e 20 24 6d 79 63 68 61 6e 67 65 73 eturn $mychanges
7750: 65 74 73 20 7d 0a 20 20 20 20 74 79 70 65 6d 65 ets }. typeme
7760: 74 68 6f 64 20 6f 66 20 20 20 20 20 7b 63 69 64 thod of {cid
7770: 7d 20 7b 20 72 65 74 75 72 6e 20 24 6d 79 69 64 } { return $myid
7780: 6d 61 70 28 24 63 69 64 29 20 7d 0a 20 20 20 20 map($cid) }.
7790: 74 79 70 65 6d 65 74 68 6f 64 20 6f 66 69 74 65 typemethod ofite
77a0: 6d 20 7b 69 69 64 7d 20 7b 20 72 65 74 75 72 6e m {iid} { return
77b0: 20 24 6d 79 69 74 65 6d 6d 61 70 28 24 69 69 64 $myitemmap($iid
77c0: 29 20 7d 0a 0a 20 20 20 20 74 79 70 65 6d 65 74 ) }.. typemet
77d0: 68 6f 64 20 72 65 76 20 20 20 20 7b 7d 20 20 20 hod rev {}
77e0: 20 7b 20 72 65 74 75 72 6e 20 24 6d 79 74 63 68 { return $mytch
77f0: 61 6e 67 65 73 65 74 73 28 72 65 76 29 20 7d 0a angesets(rev) }.
7800: 20 20 20 20 74 79 70 65 6d 65 74 68 6f 64 20 73 typemethod s
7810: 79 6d 20 20 20 20 7b 7d 20 20 20 20 7b 20 72 65 ym {} { re
7820: 74 75 72 6e 20 5b 63 6f 6e 63 61 74 20 5c 0a 09 turn [concat \..
7830: 09 09 09 09 20 20 24 7b 6d 79 74 63 68 61 6e 67 .... ${mytchang
7840: 65 73 65 74 73 28 73 79 6d 3a 3a 62 72 61 6e 63 esets(sym::branc
7850: 68 29 7d 20 5c 0a 09 09 09 09 09 20 20 24 7b 6d h)} \...... ${m
7860: 79 74 63 68 61 6e 67 65 73 65 74 73 28 73 79 6d ytchangesets(sym
7870: 3a 3a 74 61 67 29 7d 5d 20 7d 0a 0a 20 20 20 20 ::tag)}] }..
7880: 23 20 23 20 23 23 20 23 23 23 20 23 23 23 23 23 # # ## ### #####
7890: 20 23 23 23 23 23 23 23 23 20 23 23 23 23 23 23 ######## ######
78a0: 23 23 23 23 23 23 23 0a 20 20 20 20 23 23 20 43 #######. ## C
78b0: 6f 6e 66 69 67 75 72 61 74 69 6f 6e 0a 0a 20 20 onfiguration..
78c0: 20 20 70 72 61 67 6d 61 20 2d 68 61 73 74 79 70 pragma -hastyp
78d0: 65 69 6e 66 6f 20 20 20 20 6e 6f 20 20 3b 20 23 einfo no ; #
78e0: 20 6e 6f 20 74 79 70 65 20 69 6e 74 72 6f 73 70 no type introsp
78f0: 65 63 74 69 6f 6e 0a 20 20 20 20 70 72 61 67 6d ection. pragm
7900: 61 20 2d 68 61 73 69 6e 66 6f 20 20 20 20 20 20 a -hasinfo
7910: 20 20 6e 6f 20 20 3b 20 23 20 6e 6f 20 6f 62 6a no ; # no obj
7920: 65 63 74 20 69 6e 74 72 6f 73 70 65 63 74 69 6f ect introspectio
7930: 6e 0a 0a 20 20 20 20 23 20 23 20 23 23 20 23 23 n.. # # ## ##
7940: 23 20 23 23 23 23 23 20 23 23 23 23 23 23 23 23 # ##### ########
7950: 20 23 23 23 23 23 23 23 23 23 23 23 23 23 0a 7d #############.}
7960: 0a 0a 23 23 0a 23 23 20 4e 4f 54 45 3a 20 54 68 ..##.## NOTE: Th
7970: 65 20 73 75 63 63 65 73 73 6f 72 20 61 6e 64 20 e successor and
7980: 70 72 65 64 65 63 65 73 73 6f 72 20 6d 65 74 68 predecessor meth
7990: 6f 64 73 20 64 65 66 69 6e 65 64 20 62 79 20 74 ods defined by t
79a0: 68 65 20 63 6c 61 73 73 65 73 0a 23 23 20 20 20 he classes.##
79b0: 20 20 20 20 62 65 6c 6f 77 20 61 72 65 20 2d 2d below are --
79c0: 20 62 6f 74 74 6c 65 20 6e 65 63 6b 73 20 2d 2d bottle necks --
79d0: 2e 20 4c 6f 6f 6b 20 66 6f 72 20 77 61 79 73 20 . Look for ways
79e0: 74 6f 20 6d 61 6b 65 20 74 68 65 20 53 51 4c 0a to make the SQL.
79f0: 23 23 20 20 20 20 20 20 20 66 61 73 74 65 72 2e ## faster.
7a00: 0a 23 23 0a 0a 23 20 23 20 23 23 20 23 23 23 20 .##..# # ## ###
7a10: 23 23 23 23 23 20 23 23 23 23 23 23 23 23 20 23 ##### ######## #
7a20: 23 23 23 23 23 23 23 23 23 23 23 23 20 23 23 23 ############ ###
7a30: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
7a40: 23 23 0a 23 23 20 48 65 6c 70 65 72 20 73 69 6e ##.## Helper sin
7a50: 67 6c 65 74 6f 6e 2e 20 43 6f 6d 6d 61 6e 64 73 gleton. Commands
7a60: 20 66 6f 72 20 72 65 76 69 73 69 6f 6e 20 63 68 for revision ch
7a70: 61 6e 67 65 73 65 74 73 2e 0a 0a 73 6e 69 74 3a angesets...snit:
7a80: 3a 74 79 70 65 20 3a 3a 76 63 3a 3a 66 6f 73 73 :type ::vc::foss
7a90: 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a il::import::cvs:
7aa0: 3a 70 72 6f 6a 65 63 74 3a 3a 72 65 76 3a 3a 72 :project::rev::r
7ab0: 65 76 20 7b 0a 20 20 20 20 74 79 70 65 6d 65 74 ev {. typemet
7ac0: 68 6f 64 20 62 79 72 65 76 69 73 69 6f 6e 20 7b hod byrevision {
7ad0: 7d 20 7b 20 72 65 74 75 72 6e 20 31 20 7d 0a 20 } { return 1 }.
7ae0: 20 20 20 74 79 70 65 6d 65 74 68 6f 64 20 62 79 typemethod by
7af0: 73 79 6d 62 6f 6c 20 20 20 7b 7d 20 7b 20 72 65 symbol {} { re
7b00: 74 75 72 6e 20 30 20 7d 0a 20 20 20 20 74 79 70 turn 0 }. typ
7b10: 65 6d 65 74 68 6f 64 20 69 73 74 61 67 20 20 20 emethod istag
7b20: 20 20 20 7b 7d 20 7b 20 72 65 74 75 72 6e 20 30 {} { return 0
7b30: 20 7d 0a 20 20 20 20 74 79 70 65 6d 65 74 68 6f }. typemetho
7b40: 64 20 69 73 62 72 61 6e 63 68 20 20 20 7b 7d 20 d isbranch {}
7b50: 7b 20 72 65 74 75 72 6e 20 30 20 7d 0a 0a 20 20 { return 0 }..
7b60: 20 20 74 79 70 65 6d 65 74 68 6f 64 20 73 74 72 typemethod str
7b70: 20 7b 72 65 76 69 73 69 6f 6e 7d 20 7b 0a 09 73 {revision} {..s
7b80: 74 72 75 63 74 3a 3a 6c 69 73 74 20 61 73 73 69 truct::list assi
7b90: 67 6e 20 5b 73 74 61 74 65 20 72 75 6e 20 7b 0a gn [state run {.
7ba0: 09 20 20 20 20 53 45 4c 45 43 54 20 52 2e 72 65 . SELECT R.re
7bb0: 76 2c 20 46 2e 6e 61 6d 65 2c 20 50 2e 6e 61 6d v, F.name, P.nam
7bc0: 65 0a 09 20 20 20 20 46 52 4f 4d 20 20 20 72 65 e.. FROM re
7bd0: 76 69 73 69 6f 6e 20 52 2c 20 66 69 6c 65 20 46 vision R, file F
7be0: 2c 20 70 72 6f 6a 65 63 74 20 50 0a 09 20 20 20 , project P..
7bf0: 20 57 48 45 52 45 20 20 52 2e 72 69 64 20 3d 20 WHERE R.rid =
7c00: 24 72 65 76 69 73 69 6f 6e 20 2d 2d 20 46 69 6e $revision -- Fin
7c10: 64 20 73 70 65 63 69 66 69 65 64 20 66 69 6c 65 d specified file
7c20: 20 72 65 76 69 73 69 6f 6e 0a 09 20 20 20 20 41 revision.. A
7c30: 4e 44 20 20 20 20 46 2e 66 69 64 20 3d 20 52 2e ND F.fid = R.
7c40: 66 69 64 20 20 20 20 20 2d 2d 20 47 65 74 20 66 fid -- Get f
7c50: 69 6c 65 20 6f 66 20 74 68 65 20 72 65 76 69 73 ile of the revis
7c60: 69 6f 6e 0a 09 20 20 20 20 41 4e 44 20 20 20 20 ion.. AND
7c70: 50 2e 70 69 64 20 3d 20 46 2e 70 69 64 20 20 20 P.pid = F.pid
7c80: 20 20 2d 2d 20 47 65 74 20 70 72 6f 6a 65 63 74 -- Get project
7c90: 20 6f 66 20 74 68 65 20 66 69 6c 65 2e 0a 09 7d of the file...}
7ca0: 5d 20 72 65 76 6e 72 20 66 6e 61 6d 65 20 70 6e ] revnr fname pn
7cb0: 61 6d 65 0a 09 72 65 74 75 72 6e 20 22 24 70 6e ame..return "$pn
7cc0: 61 6d 65 2f 24 7b 72 65 76 6e 72 7d 3a 3a 24 66 ame/${revnr}::$f
7cd0: 6e 61 6d 65 22 0a 20 20 20 20 7d 0a 0a 20 20 20 name". }..
7ce0: 20 23 20 72 65 73 75 6c 74 20 3d 20 6c 69 73 74 # result = list
7cf0: 20 28 6d 69 6e 74 69 6d 65 2c 20 6d 61 78 74 69 (mintime, maxti
7d00: 6d 65 29 0a 20 20 20 20 74 79 70 65 6d 65 74 68 me). typemeth
7d10: 6f 64 20 74 69 6d 65 72 61 6e 67 65 20 7b 69 74 od timerange {it
7d20: 65 6d 73 7d 20 7b 0a 09 73 65 74 20 74 68 65 73 ems} {..set thes
7d30: 65 74 20 28 27 5b 6a 6f 69 6e 20 24 69 74 65 6d et ('[join $item
7d40: 73 20 7b 27 2c 27 7d 5d 27 29 0a 09 72 65 74 75 s {','}]')..retu
7d50: 72 6e 20 5b 73 74 61 74 65 20 72 75 6e 20 5b 73 rn [state run [s
7d60: 75 62 73 74 20 2d 6e 6f 63 6f 6d 6d 61 6e 64 73 ubst -nocommands
7d70: 20 2d 6e 6f 62 61 63 6b 73 6c 61 73 68 65 73 20 -nobackslashes
7d80: 7b 0a 09 20 20 20 20 53 45 4c 45 43 54 20 4d 49 {.. SELECT MI
7d90: 4e 28 52 2e 64 61 74 65 29 2c 20 4d 41 58 28 52 N(R.date), MAX(R
7da0: 2e 64 61 74 65 29 0a 09 20 20 20 20 46 52 4f 4d .date).. FROM
7db0: 20 72 65 76 69 73 69 6f 6e 20 52 0a 09 20 20 20 revision R..
7dc0: 20 57 48 45 52 45 20 52 2e 72 69 64 20 49 4e 20 WHERE R.rid IN
7dd0: 24 74 68 65 73 65 74 20 2d 2d 20 52 65 73 74 72 $theset -- Restr
7de0: 69 63 74 20 74 6f 20 72 65 76 69 73 69 6f 6e 73 ict to revisions
7df0: 20 6f 66 20 69 6e 74 65 72 65 73 74 0a 09 7d 5d of interest..}]
7e00: 5d 0a 20 20 20 20 7d 0a 0a 20 20 20 20 23 20 76 ]. }.. # v
7e10: 61 72 28 64 76 29 20 3d 20 64 69 63 74 20 28 72 ar(dv) = dict (r
7e20: 65 76 69 73 69 6f 6e 20 2d 3e 20 6c 69 73 74 20 evision -> list
7e30: 28 72 65 76 69 73 69 6f 6e 29 29 0a 20 20 20 20 (revision)).
7e40: 74 79 70 65 6d 65 74 68 6f 64 20 69 6e 74 65 72 typemethod inter
7e50: 6e 61 6c 73 75 63 63 65 73 73 6f 72 73 20 7b 64 nalsuccessors {d
7e60: 76 20 72 65 76 69 73 69 6f 6e 73 7d 20 7b 0a 09 v revisions} {..
7e70: 75 70 76 61 72 20 31 20 24 64 76 20 64 65 70 65 upvar 1 $dv depe
7e80: 6e 64 65 6e 63 69 65 73 0a 09 73 65 74 20 74 68 ndencies..set th
7e90: 65 73 65 74 20 28 27 5b 6a 6f 69 6e 20 24 72 65 eset ('[join $re
7ea0: 76 69 73 69 6f 6e 73 20 7b 27 2c 27 7d 5d 27 29 visions {','}]')
7eb0: 0a 0a 09 23 20 53 65 65 20 27 73 75 63 63 65 73 ...# See 'succes
7ec0: 73 6f 72 73 27 20 62 65 6c 6f 77 20 66 6f 72 20 sors' below for
7ed0: 74 68 65 20 6d 61 69 6e 20 65 78 70 6c 61 6e 61 the main explana
7ee0: 74 69 6f 6e 20 6f 66 0a 09 23 20 74 68 65 20 76 tion of..# the v
7ef0: 61 72 69 6f 75 73 20 63 61 73 65 73 2e 20 54 68 arious cases. Th
7f00: 69 73 20 70 69 65 63 65 20 69 73 20 73 70 65 63 is piece is spec
7f10: 69 61 6c 20 69 6e 20 74 68 61 74 20 69 74 0a 09 ial in that it..
7f20: 23 20 72 65 73 74 72 69 63 74 73 20 74 68 65 20 # restricts the
7f30: 73 75 63 63 65 73 73 6f 72 73 20 77 65 20 6c 6f successors we lo
7f40: 6f 6b 20 66 6f 72 20 74 6f 20 74 68 65 20 73 61 ok for to the sa
7f50: 6d 65 20 73 65 74 20 6f 66 0a 09 23 20 72 65 76 me set of..# rev
7f60: 69 73 69 6f 6e 73 20 77 65 20 73 74 61 72 74 20 isions we start
7f70: 66 72 6f 6d 2e 20 53 65 6e 73 69 62 6c 65 20 61 from. Sensible a
7f80: 73 20 77 65 20 61 72 65 20 6c 6f 6f 6b 69 6e 67 s we are looking
7f90: 20 66 6f 72 0a 09 23 20 63 68 61 6e 67 65 73 65 for..# changese
7fa0: 74 20 69 6e 74 65 72 6e 61 6c 20 64 65 70 65 6e t internal depen
7fb0: 64 65 6e 63 69 65 73 2e 0a 0a 09 61 72 72 61 79 dencies....array
7fc0: 20 73 65 74 20 64 65 70 20 7b 7d 0a 0a 09 66 6f set dep {}...fo
7fd0: 72 65 61 63 68 20 7b 72 69 64 20 63 68 69 6c 64 reach {rid child
7fe0: 7d 20 5b 73 74 61 74 65 20 72 75 6e 20 5b 73 75 } [state run [su
7ff0: 62 73 74 20 2d 6e 6f 63 6f 6d 6d 61 6e 64 73 20 bst -nocommands
8000: 2d 6e 6f 62 61 63 6b 73 6c 61 73 68 65 73 20 7b -nobackslashes {
8010: 0a 20 20 20 20 2d 2d 20 28 31 29 20 50 72 69 6d . -- (1) Prim
8020: 61 72 79 20 63 68 69 6c 64 0a 09 20 20 20 20 53 ary child.. S
8030: 45 4c 45 43 54 20 52 2e 72 69 64 2c 20 52 2e 63 ELECT R.rid, R.c
8040: 68 69 6c 64 0a 09 20 20 20 20 46 52 4f 4d 20 20 hild.. FROM
8050: 20 72 65 76 69 73 69 6f 6e 20 52 0a 09 20 20 20 revision R..
8060: 20 57 48 45 52 45 20 20 52 2e 72 69 64 20 20 20 WHERE R.rid
8070: 49 4e 20 24 74 68 65 73 65 74 20 20 20 20 20 2d IN $theset -
8080: 2d 20 52 65 73 74 72 69 63 74 20 74 6f 20 72 65 - Restrict to re
8090: 76 69 73 69 6f 6e 73 20 6f 66 20 69 6e 74 65 72 visions of inter
80a0: 65 73 74 0a 09 20 20 20 20 41 4e 44 20 20 20 20 est.. AND
80b0: 52 2e 63 68 69 6c 64 20 49 53 20 4e 4f 54 20 4e R.child IS NOT N
80c0: 55 4c 4c 20 20 20 20 2d 2d 20 48 61 73 20 70 72 ULL -- Has pr
80d0: 69 6d 61 72 79 20 63 68 69 6c 64 0a 09 20 20 20 imary child..
80e0: 20 41 4e 44 20 20 20 20 52 2e 63 68 69 6c 64 20 AND R.child
80f0: 49 4e 20 24 74 68 65 73 65 74 20 20 20 20 20 2d IN $theset -
8100: 2d 20 57 68 69 63 68 20 69 73 20 61 6c 73 6f 20 - Which is also
8110: 6f 66 20 69 6e 74 65 72 65 73 74 0a 20 20 20 20 of interest.
8120: 55 4e 49 4f 4e 0a 20 20 20 20 2d 2d 20 28 32 29 UNION. -- (2)
8130: 20 53 65 63 6f 6e 64 61 72 79 20 28 62 72 61 6e Secondary (bran
8140: 63 68 29 20 63 68 69 6c 64 72 65 6e 0a 09 20 20 ch) children..
8150: 20 20 53 45 4c 45 43 54 20 52 2e 72 69 64 2c 20 SELECT R.rid,
8160: 42 2e 62 72 69 64 0a 09 20 20 20 20 46 52 4f 4d B.brid.. FROM
8170: 20 20 20 72 65 76 69 73 69 6f 6e 20 52 2c 20 72 revision R, r
8180: 65 76 69 73 69 6f 6e 62 72 61 6e 63 68 63 68 69 evisionbranchchi
8190: 6c 64 72 65 6e 20 42 0a 09 20 20 20 20 57 48 45 ldren B.. WHE
81a0: 52 45 20 20 52 2e 72 69 64 20 20 20 49 4e 20 24 RE R.rid IN $
81b0: 74 68 65 73 65 74 20 20 20 20 20 2d 2d 20 52 65 theset -- Re
81c0: 73 74 72 69 63 74 20 74 6f 20 72 65 76 69 73 69 strict to revisi
81d0: 6f 6e 73 20 6f 66 20 69 6e 74 65 72 65 73 74 0a ons of interest.
81e0: 09 20 20 20 20 41 4e 44 20 20 20 20 52 2e 72 69 . AND R.ri
81f0: 64 20 3d 20 42 2e 72 69 64 20 20 20 20 20 20 20 d = B.rid
8200: 20 20 20 2d 2d 20 53 65 6c 65 63 74 20 73 75 62 -- Select sub
8210: 73 65 74 20 6f 66 20 62 72 61 6e 63 68 20 63 68 set of branch ch
8220: 69 6c 64 72 65 6e 0a 09 20 20 20 20 41 4e 44 20 ildren.. AND
8230: 20 20 20 42 2e 62 72 69 64 20 49 4e 20 24 74 68 B.brid IN $th
8240: 65 73 65 74 20 20 20 20 20 20 2d 2d 20 57 68 69 eset -- Whi
8250: 63 68 20 69 73 20 61 6c 73 6f 20 6f 66 20 69 6e ch is also of in
8260: 74 65 72 65 73 74 0a 20 20 20 20 55 4e 49 4f 4e terest. UNION
8270: 0a 20 20 20 20 2d 2d 20 28 34 29 20 43 68 69 6c . -- (4) Chil
8280: 64 20 6f 66 20 74 72 75 6e 6b 20 72 6f 6f 74 20 d of trunk root
8290: 73 75 63 63 65 73 73 6f 72 20 6f 66 20 6c 61 73 successor of las
82a0: 74 20 4e 54 44 42 20 6f 6e 20 74 72 75 6e 6b 2e t NTDB on trunk.
82b0: 0a 09 20 20 20 20 53 45 4c 45 43 54 20 52 2e 72 .. SELECT R.r
82c0: 69 64 2c 20 52 41 2e 63 68 69 6c 64 0a 09 20 20 id, RA.child..
82d0: 20 20 46 52 4f 4d 20 72 65 76 69 73 69 6f 6e 20 FROM revision
82e0: 52 2c 20 72 65 76 69 73 69 6f 6e 20 52 41 0a 09 R, revision RA..
82f0: 20 20 20 20 57 48 45 52 45 20 52 2e 72 69 64 20 WHERE R.rid
8300: 20 20 49 4e 20 24 74 68 65 73 65 74 20 20 20 20 IN $theset
8310: 20 20 2d 2d 20 52 65 73 74 72 69 63 74 20 74 6f -- Restrict to
8320: 20 72 65 76 69 73 69 6f 6e 73 20 6f 66 20 69 6e revisions of in
8330: 74 65 72 65 73 74 0a 09 20 20 20 20 41 4e 44 20 terest.. AND
8340: 20 20 52 2e 69 73 64 65 66 61 75 6c 74 20 20 20 R.isdefault
8350: 20 20 20 20 20 20 20 20 20 20 2d 2d 20 52 65 73 -- Res
8360: 74 72 69 63 74 20 74 6f 20 4e 54 44 42 0a 09 20 trict to NTDB..
8370: 20 20 20 41 4e 44 20 20 20 52 2e 64 62 63 68 69 AND R.dbchi
8380: 6c 64 20 49 53 20 4e 4f 54 20 4e 55 4c 4c 20 20 ld IS NOT NULL
8390: 20 2d 2d 20 61 6e 64 20 6c 61 73 74 20 4e 54 44 -- and last NTD
83a0: 42 20 62 65 6c 6f 6e 67 69 6e 67 20 74 6f 20 74 B belonging to t
83b0: 72 75 6e 6b 0a 09 20 20 20 20 41 4e 44 20 20 20 runk.. AND
83c0: 52 41 2e 72 69 64 20 3d 20 52 2e 64 62 63 68 69 RA.rid = R.dbchi
83d0: 6c 64 20 20 20 20 20 20 2d 2d 20 47 6f 20 64 69 ld -- Go di
83e0: 72 65 63 74 6c 79 20 74 6f 20 74 72 75 6e 6b 20 rectly to trunk
83f0: 72 6f 6f 74 0a 09 20 20 20 20 41 4e 44 20 20 20 root.. AND
8400: 52 41 2e 63 68 69 6c 64 20 49 53 20 4e 4f 54 20 RA.child IS NOT
8410: 4e 55 4c 4c 20 20 20 20 2d 2d 20 48 61 73 20 70 NULL -- Has p
8420: 72 69 6d 61 72 79 20 63 68 69 6c 64 2e 0a 20 20 rimary child..
8430: 20 20 20 20 20 20 20 20 20 20 41 4e 44 20 20 20 AND
8440: 52 41 2e 63 68 69 6c 64 20 49 4e 20 24 74 68 65 RA.child IN $the
8450: 73 65 74 20 20 20 20 20 2d 2d 20 57 68 69 63 68 set -- Which
8460: 20 69 73 20 61 6c 73 6f 20 6f 66 20 69 6e 74 65 is also of inte
8470: 72 65 73 74 0a 09 7d 5d 5d 20 7b 0a 09 20 20 20 rest..}]] {..
8480: 20 23 20 43 6f 6e 73 69 64 65 72 20 6d 6f 76 69 # Consider movi
8490: 6e 67 20 74 68 69 73 20 74 6f 20 74 68 65 20 69 ng this to the i
84a0: 6e 74 65 67 72 69 74 79 20 6d 6f 64 75 6c 65 2e ntegrity module.
84b0: 0a 09 20 20 20 20 69 6e 74 65 67 72 69 74 79 20 .. integrity
84c0: 61 73 73 65 72 74 20 7b 24 72 69 64 20 21 3d 20 assert {$rid !=
84d0: 24 63 68 69 6c 64 7d 20 7b 52 65 76 69 73 69 6f $child} {Revisio
84e0: 6e 20 24 72 69 64 20 64 65 70 65 6e 64 73 20 6f n $rid depends o
84f0: 6e 20 69 74 73 65 6c 66 2e 7d 0a 09 20 20 20 20 n itself.}..
8500: 6c 61 70 70 65 6e 64 20 64 65 70 65 6e 64 65 6e lappend dependen
8510: 63 69 65 73 28 24 72 69 64 29 20 24 63 68 69 6c cies($rid) $chil
8520: 64 0a 09 20 20 20 20 73 65 74 20 64 65 70 28 24 d.. set dep($
8530: 72 69 64 2c 24 63 68 69 6c 64 29 20 2e 0a 09 7d rid,$child) ...}
8540: 0a 0a 09 23 20 54 68 65 20 73 71 6c 20 73 74 61 ...# The sql sta
8550: 74 65 6d 65 6e 74 73 20 61 62 6f 76 65 20 6c 6f tements above lo
8560: 6f 6b 73 20 6f 6e 6c 79 20 66 6f 72 20 64 69 72 oks only for dir
8570: 65 63 74 20 64 65 70 65 6e 64 65 6e 63 69 65 73 ect dependencies
8580: 0a 09 23 20 62 65 74 77 65 65 6e 20 72 65 76 69 ..# between revi
8590: 73 69 6f 6e 20 69 6e 20 74 68 65 20 63 68 61 6e sion in the chan
85a0: 67 65 73 65 74 2e 20 48 6f 77 65 76 65 72 20 64 geset. However d
85b0: 75 65 20 74 6f 20 74 68 65 0a 09 23 20 76 61 67 ue to the..# vag
85c0: 61 72 69 65 73 20 6f 66 20 6d 65 74 61 20 64 61 aries of meta da
85d0: 74 61 20 69 74 20 69 73 20 70 6f 73 73 69 62 6c ta it is possibl
85e0: 65 20 66 6f 72 20 74 77 6f 20 72 65 76 69 73 69 e for two revisi
85f0: 6f 6e 73 20 6f 66 0a 09 23 20 74 68 65 20 73 61 ons of..# the sa
8600: 6d 65 20 66 69 6c 65 20 74 6f 20 65 6e 64 20 75 me file to end u
8610: 70 20 69 6e 20 74 68 65 20 73 61 6d 65 20 63 68 p in the same ch
8620: 61 6e 67 65 73 65 74 2c 20 77 69 74 68 6f 75 74 angeset, without
8630: 20 61 0a 09 23 20 64 69 72 65 63 74 20 64 65 70 a..# direct dep
8640: 65 6e 64 65 6e 63 79 20 62 65 74 77 65 65 6e 20 endency between
8650: 74 68 65 6d 2e 20 48 6f 77 65 76 65 72 20 77 65 them. However we
8660: 20 6b 6e 6f 77 20 74 68 61 74 20 74 68 65 72 65 know that there
8670: 0a 09 23 20 68 61 73 20 74 6f 20 62 65 20 61 20 ..# has to be a
8680: 61 6e 20 69 6e 64 69 72 65 63 74 20 64 65 70 65 an indirect depe
8690: 6e 64 65 6e 63 79 2c 20 62 65 20 69 74 20 74 68 ndency, be it th
86a0: 72 6f 75 67 68 20 70 72 69 6d 61 72 79 0a 09 23 rough primary..#
86b0: 20 63 68 69 6c 64 72 65 6e 2c 20 62 72 61 6e 63 children, branc
86c0: 68 20 63 68 69 6c 64 72 65 6e 2c 20 6f 72 20 61 h children, or a
86d0: 20 63 6f 6d 62 69 6e 61 74 69 6f 6e 20 74 68 65 combination the
86e0: 72 65 6f 66 2e 0a 0a 09 23 20 57 65 20 6e 6f 77 reof....# We now
86f0: 20 66 69 6c 6c 20 69 6e 20 74 68 65 73 65 20 70 fill in these p
8700: 73 65 75 64 6f 2d 64 65 70 65 6e 64 65 6e 63 69 seudo-dependenci
8710: 65 73 2c 20 69 66 20 6e 6f 20 73 75 63 68 0a 09 es, if no such..
8720: 23 20 64 65 70 65 6e 64 65 6e 63 79 20 65 78 69 # dependency exi
8730: 73 74 73 20 61 6c 72 65 61 64 79 2e 20 54 68 65 sts already. The
8740: 20 64 69 72 65 63 74 69 6f 6e 20 6f 66 20 74 68 direction of th
8750: 65 20 64 65 70 65 6e 64 65 6e 63 79 0a 09 23 20 e dependency..#
8760: 69 73 20 61 63 74 75 61 6c 6c 79 20 69 72 72 65 is actually irre
8770: 6c 65 76 61 6e 74 20 66 6f 72 20 74 68 69 73 2e levant for this.
8780: 0a 0a 09 23 20 4e 4f 54 45 3a 20 54 68 69 73 20 ...# NOTE: This
8790: 69 73 20 64 69 66 66 65 72 65 6e 74 20 66 72 6f is different fro
87a0: 6d 20 63 76 73 32 73 76 6e 2e 20 4f 75 72 20 73 m cvs2svn. Our s
87b0: 70 69 72 69 74 75 61 6c 20 61 6e 63 65 73 74 6f piritual ancesto
87c0: 72 0a 09 23 20 64 6f 65 73 20 6e 6f 74 20 75 73 r..# does not us
87d0: 65 20 73 75 63 68 20 70 73 65 75 64 6f 2d 64 65 e such pseudo-de
87e0: 70 65 6e 64 65 6e 63 69 65 73 2c 20 68 6f 77 65 pendencies, howe
87f0: 76 65 72 20 69 74 20 75 73 65 73 20 61 0a 09 23 ver it uses a..#
8800: 20 43 4f 4d 4d 49 54 5f 54 48 52 45 53 48 4f 4c COMMIT_THRESHOL
8810: 44 2c 20 61 20 74 69 6d 65 20 69 6e 74 65 72 76 D, a time interv
8820: 61 6c 20 63 6f 6d 6d 69 74 73 20 73 68 6f 75 6c al commits shoul
8830: 64 20 66 61 6c 6c 2e 20 54 68 69 73 0a 09 23 20 d fall. This..#
8840: 77 69 6c 6c 20 67 72 65 61 74 6c 79 20 72 65 64 will greatly red
8850: 75 63 65 73 20 74 68 65 20 72 69 73 6b 20 6f 66 uces the risk of
8860: 20 67 65 74 74 69 6e 67 20 66 61 72 20 73 65 70 getting far sep
8870: 61 72 61 74 65 64 0a 09 23 20 72 65 76 69 73 69 arated..# revisi
8880: 6f 6e 73 20 6f 66 20 74 68 65 20 73 61 6d 65 20 ons of the same
8890: 66 69 6c 65 20 69 6e 74 6f 20 6f 6e 65 20 63 68 file into one ch
88a0: 61 6e 67 65 73 65 74 2e 0a 0a 09 23 20 57 65 20 angeset....# We
88b0: 61 6c 6c 6f 77 20 72 65 76 69 73 69 6f 6e 73 20 allow revisions
88c0: 74 6f 20 62 65 20 66 61 72 20 61 70 61 72 74 20 to be far apart
88d0: 69 6e 20 74 69 6d 65 20 69 6e 20 74 68 65 20 73 in time in the s
88e0: 61 6d 65 0a 09 23 20 63 68 61 6e 67 65 73 65 74 ame..# changeset
88f0: 2c 20 62 75 74 20 69 6e 20 74 75 72 6e 20 6e 65 , but in turn ne
8900: 65 64 20 74 68 65 20 70 73 65 75 64 6f 2d 64 65 ed the pseudo-de
8910: 70 65 6e 64 65 6e 63 69 65 73 20 74 6f 0a 09 23 pendencies to..#
8920: 20 68 61 6e 64 6c 65 20 74 68 69 73 2e 0a 0a 09 handle this....
8930: 61 72 72 61 79 20 73 65 74 20 66 69 64 73 20 7b array set fids {
8940: 7d 0a 09 66 6f 72 65 61 63 68 20 7b 72 69 64 20 }..foreach {rid
8950: 66 69 64 7d 20 5b 73 74 61 74 65 20 72 75 6e 20 fid} [state run
8960: 5b 73 75 62 73 74 20 2d 6e 6f 63 6f 6d 6d 61 6e [subst -nocomman
8970: 64 73 20 2d 6e 6f 62 61 63 6b 73 6c 61 73 68 65 ds -nobackslashe
8980: 73 20 7b 0a 09 20 20 20 20 53 45 4c 45 43 54 20 s {.. SELECT
8990: 52 2e 72 69 64 2c 20 52 2e 66 69 64 0a 20 20 20 R.rid, R.fid.
89a0: 20 20 20 20 20 20 20 20 20 46 52 4f 4d 20 20 20 FROM
89b0: 72 65 76 69 73 69 6f 6e 20 52 0a 20 20 20 20 20 revision R.
89c0: 20 20 20 20 20 20 20 57 48 45 52 45 20 20 52 2e WHERE R.
89d0: 72 69 64 20 49 4e 20 24 74 68 65 73 65 74 0a 09 rid IN $theset..
89e0: 7d 5d 5d 20 7b 20 6c 61 70 70 65 6e 64 20 66 69 }]] { lappend fi
89f0: 64 73 28 24 66 69 64 29 20 24 72 69 64 20 7d 0a ds($fid) $rid }.
8a00: 0a 09 66 6f 72 65 61 63 68 20 7b 66 69 64 20 72 ..foreach {fid r
8a10: 69 64 73 7d 20 5b 61 72 72 61 79 20 67 65 74 20 ids} [array get
8a20: 66 69 64 73 5d 20 7b 0a 09 20 20 20 20 69 66 20 fids] {.. if
8a30: 7b 5b 6c 6c 65 6e 67 74 68 20 24 72 69 64 73 5d {[llength $rids]
8a40: 20 3c 20 32 7d 20 63 6f 6e 74 69 6e 75 65 0a 09 < 2} continue..
8a50: 20 20 20 20 66 6f 72 65 61 63 68 20 61 20 24 72 foreach a $r
8a60: 69 64 73 20 7b 0a 09 09 66 6f 72 65 61 63 68 20 ids {...foreach
8a70: 62 20 24 72 69 64 73 20 7b 0a 09 09 20 20 20 20 b $rids {...
8a80: 69 66 20 7b 24 61 20 3d 3d 20 24 62 7d 20 63 6f if {$a == $b} co
8a90: 6e 74 69 6e 75 65 0a 09 09 20 20 20 20 69 66 20 ntinue... if
8aa0: 7b 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 64 65 {[info exists de
8ab0: 70 28 24 61 2c 24 62 29 5d 7d 20 63 6f 6e 74 69 p($a,$b)]} conti
8ac0: 6e 75 65 0a 09 09 20 20 20 20 69 66 20 7b 5b 69 nue... if {[i
8ad0: 6e 66 6f 20 65 78 69 73 74 73 20 64 65 70 28 24 nfo exists dep($
8ae0: 62 2c 24 61 29 5d 7d 20 63 6f 6e 74 69 6e 75 65 b,$a)]} continue
8af0: 0a 09 09 20 20 20 20 6c 61 70 70 65 6e 64 20 64 ... lappend d
8b00: 65 70 65 6e 64 65 6e 63 69 65 73 28 24 61 29 20 ependencies($a)
8b10: 24 62 0a 09 09 20 20 20 20 73 65 74 20 64 65 70 $b... set dep
8b20: 28 24 61 2c 24 62 29 20 2e 0a 09 09 20 20 20 20 ($a,$b) ....
8b30: 73 65 74 20 64 65 70 28 24 62 2c 24 61 29 20 2e set dep($b,$a) .
8b40: 0a 09 09 7d 0a 09 20 20 20 20 7d 0a 09 7d 0a 09 ...}.. }..}..
8b50: 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 return. }..
8b60: 20 20 23 20 72 65 73 75 6c 74 20 3d 20 34 2d 6c # result = 4-l
8b70: 69 73 74 20 28 69 74 65 6d 74 79 70 65 20 69 74 ist (itemtype it
8b80: 65 6d 69 64 20 6e 65 78 74 69 74 65 6d 74 79 70 emid nextitemtyp
8b90: 65 20 6e 65 78 74 69 74 65 6d 69 64 20 2e 2e 2e e nextitemid ...
8ba0: 29 0a 20 20 20 20 74 79 70 65 6d 65 74 68 6f 64 ). typemethod
8bb0: 20 6c 6f 6f 70 73 20 7b 72 65 76 69 73 69 6f 6e loops {revision
8bc0: 73 7d 20 7b 0a 09 23 20 4e 6f 74 65 3a 20 54 61 s} {..# Note: Ta
8bd0: 67 73 20 61 6e 64 20 62 72 61 6e 63 68 65 73 20 gs and branches
8be0: 63 61 6e 6e 6f 74 20 63 61 75 73 65 20 74 68 65 cannot cause the
8bf0: 20 6c 6f 6f 70 2e 20 54 68 65 69 72 20 69 64 27 loop. Their id'
8c00: 73 2c 0a 09 23 20 62 65 69 6e 67 20 6f 66 20 61 s,..# being of a
8c10: 20 66 75 6e 64 61 6d 65 6e 74 61 6c 6c 79 20 64 fundamentally d
8c20: 69 66 66 65 72 65 6e 74 20 74 79 70 65 20 74 68 ifferent type th
8c30: 61 6e 20 74 68 65 20 72 65 76 69 73 69 6f 6e 73 an the revisions
8c40: 0a 09 23 20 63 6f 6d 69 6e 67 20 69 6e 20 63 61 ..# coming in ca
8c50: 6e 6e 6f 74 20 62 65 20 69 6e 20 74 68 65 20 73 nnot be in the s
8c60: 65 74 2e 0a 0a 09 73 65 74 20 74 68 65 73 65 74 et....set theset
8c70: 20 28 27 5b 6a 6f 69 6e 20 24 72 65 76 69 73 69 ('[join $revisi
8c80: 6f 6e 73 20 7b 27 2c 27 7d 5d 27 29 0a 09 72 65 ons {','}]')..re
8c90: 74 75 72 6e 20 5b 73 74 61 74 65 20 72 75 6e 20 turn [state run
8ca0: 5b 73 75 62 73 74 20 2d 6e 6f 63 6f 6d 6d 61 6e [subst -nocomman
8cb0: 64 73 20 2d 6e 6f 62 61 63 6b 73 6c 61 73 68 65 ds -nobackslashe
8cc0: 73 20 7b 0a 09 20 20 20 20 2d 2d 20 28 31 29 20 s {.. -- (1)
8cd0: 50 72 69 6d 61 72 79 20 63 68 69 6c 64 0a 09 20 Primary child..
8ce0: 20 20 20 53 45 4c 45 43 54 20 52 2e 72 69 64 2c SELECT R.rid,
8cf0: 20 52 2e 63 68 69 6c 64 0a 09 20 20 20 20 46 52 R.child.. FR
8d00: 4f 4d 20 20 20 72 65 76 69 73 69 6f 6e 20 52 0a OM revision R.
8d10: 09 20 20 20 20 57 48 45 52 45 20 20 52 2e 72 69 . WHERE R.ri
8d20: 64 20 20 20 49 4e 20 24 74 68 65 73 65 74 20 20 d IN $theset
8d30: 20 20 20 2d 2d 20 52 65 73 74 72 69 63 74 20 74 -- Restrict t
8d40: 6f 20 72 65 76 69 73 69 6f 6e 73 20 6f 66 20 69 o revisions of i
8d50: 6e 74 65 72 65 73 74 0a 09 20 20 20 20 41 4e 44 nterest.. AND
8d60: 20 20 20 20 52 2e 63 68 69 6c 64 20 49 53 20 4e R.child IS N
8d70: 4f 54 20 4e 55 4c 4c 20 20 20 20 2d 2d 20 48 61 OT NULL -- Ha
8d80: 73 20 70 72 69 6d 61 72 79 20 63 68 69 6c 64 0a s primary child.
8d90: 09 20 20 20 20 41 4e 44 20 20 20 20 52 2e 63 68 . AND R.ch
8da0: 69 6c 64 20 49 4e 20 24 74 68 65 73 65 74 20 20 ild IN $theset
8db0: 20 20 20 2d 2d 20 4c 6f 6f 70 0a 09 20 20 20 20 -- Loop..
8dc0: 2d 2d 0a 09 20 20 20 20 55 4e 49 4f 4e 0a 09 20 --.. UNION..
8dd0: 20 20 20 2d 2d 20 28 32 29 20 53 65 63 6f 6e 64 -- (2) Second
8de0: 61 72 79 20 28 62 72 61 6e 63 68 29 20 63 68 69 ary (branch) chi
8df0: 6c 64 72 65 6e 0a 09 20 20 20 20 53 45 4c 45 43 ldren.. SELEC
8e00: 54 20 52 2e 72 69 64 2c 20 42 2e 62 72 69 64 0a T R.rid, B.brid.
8e10: 09 20 20 20 20 46 52 4f 4d 20 20 20 72 65 76 69 . FROM revi
8e20: 73 69 6f 6e 20 52 2c 20 72 65 76 69 73 69 6f 6e sion R, revision
8e30: 62 72 61 6e 63 68 63 68 69 6c 64 72 65 6e 20 42 branchchildren B
8e40: 0a 09 20 20 20 20 57 48 45 52 45 20 20 52 2e 72 .. WHERE R.r
8e50: 69 64 20 20 20 49 4e 20 24 74 68 65 73 65 74 20 id IN $theset
8e60: 20 20 20 20 2d 2d 20 52 65 73 74 72 69 63 74 20 -- Restrict
8e70: 74 6f 20 72 65 76 69 73 69 6f 6e 73 20 6f 66 20 to revisions of
8e80: 69 6e 74 65 72 65 73 74 0a 09 20 20 20 20 41 4e interest.. AN
8e90: 44 20 20 20 20 52 2e 72 69 64 20 3d 20 42 2e 72 D R.rid = B.r
8ea0: 69 64 20 20 20 20 20 20 20 20 20 20 2d 2d 20 53 id -- S
8eb0: 65 6c 65 63 74 20 73 75 62 73 65 74 20 6f 66 20 elect subset of
8ec0: 62 72 61 6e 63 68 20 63 68 69 6c 64 72 65 6e 0a branch children.
8ed0: 09 20 20 20 20 41 4e 44 20 20 20 20 42 2e 72 69 . AND B.ri
8ee0: 64 20 20 20 49 4e 20 24 74 68 65 73 65 74 20 20 d IN $theset
8ef0: 20 20 20 2d 2d 20 4c 6f 6f 70 0a 09 20 20 20 20 -- Loop..
8f00: 2d 2d 0a 09 20 20 20 20 55 4e 49 4f 4e 0a 09 20 --.. UNION..
8f10: 20 20 20 2d 2d 20 28 34 29 20 43 68 69 6c 64 20 -- (4) Child
8f20: 6f 66 20 74 72 75 6e 6b 20 72 6f 6f 74 20 73 75 of trunk root su
8f30: 63 63 65 73 73 6f 72 20 6f 66 20 6c 61 73 74 20 ccessor of last
8f40: 4e 54 44 42 20 6f 6e 20 74 72 75 6e 6b 2e 0a 09 NTDB on trunk...
8f50: 20 20 20 20 53 45 4c 45 43 54 20 52 2e 72 69 64 SELECT R.rid
8f60: 2c 20 52 41 2e 63 68 69 6c 64 0a 09 20 20 20 20 , RA.child..
8f70: 46 52 4f 4d 20 20 20 72 65 76 69 73 69 6f 6e 20 FROM revision
8f80: 52 2c 20 72 65 76 69 73 69 6f 6e 20 52 41 0a 09 R, revision RA..
8f90: 20 20 20 20 57 48 45 52 45 20 20 52 2e 72 69 64 WHERE R.rid
8fa0: 20 20 20 20 49 4e 20 24 74 68 65 73 65 74 20 20 IN $theset
8fb0: 20 20 20 2d 2d 20 52 65 73 74 72 69 63 74 20 74 -- Restrict t
8fc0: 6f 20 72 65 76 69 73 69 6f 6e 73 20 6f 66 20 69 o revisions of i
8fd0: 6e 74 65 72 65 73 74 0a 09 20 20 20 20 41 4e 44 nterest.. AND
8fe0: 20 20 20 20 52 2e 69 73 64 65 66 61 75 6c 74 20 R.isdefault
8ff0: 20 20 20 20 20 20 20 20 20 20 20 20 2d 2d 20 52 -- R
9000: 65 73 74 72 69 63 74 20 74 6f 20 4e 54 44 42 0a estrict to NTDB.
9010: 09 20 20 20 20 41 4e 44 20 20 20 20 52 2e 64 62 . AND R.db
9020: 63 68 69 6c 64 20 49 53 20 4e 4f 54 20 4e 55 4c child IS NOT NUL
9030: 4c 20 20 20 2d 2d 20 61 6e 64 20 6c 61 73 74 20 L -- and last
9040: 4e 54 44 42 20 62 65 6c 6f 6e 67 69 6e 67 20 74 NTDB belonging t
9050: 6f 20 74 72 75 6e 6b 0a 09 20 20 20 20 41 4e 44 o trunk.. AND
9060: 20 20 20 20 52 41 2e 72 69 64 20 3d 20 52 2e 64 RA.rid = R.d
9070: 62 63 68 69 6c 64 20 20 20 20 20 20 2d 2d 20 47 bchild -- G
9080: 6f 20 64 69 72 65 63 74 6c 79 20 74 6f 20 74 72 o directly to tr
9090: 75 6e 6b 20 72 6f 6f 74 0a 09 20 20 20 20 41 4e unk root.. AN
90a0: 44 20 20 20 20 52 41 2e 63 68 69 6c 64 20 49 53 D RA.child IS
90b0: 20 4e 4f 54 20 4e 55 4c 4c 20 20 20 20 2d 2d 20 NOT NULL --
90c0: 48 61 73 20 70 72 69 6d 61 72 79 20 63 68 69 6c Has primary chil
90d0: 64 2e 0a 09 20 20 20 20 41 4e 44 20 20 20 20 52 d... AND R
90e0: 41 2e 63 68 69 6c 64 20 49 4e 20 24 74 68 65 73 A.child IN $thes
90f0: 65 74 20 20 20 20 20 2d 2d 20 4c 6f 6f 70 0a 09 et -- Loop..
9100: 7d 5d 5d 0a 20 20 20 20 7d 0a 0a 20 20 20 20 23 }]]. }.. #
9110: 20 76 61 72 28 64 76 29 20 3d 20 64 69 63 74 20 var(dv) = dict
9120: 28 69 74 65 6d 20 2d 3e 20 6c 69 73 74 20 28 69 (item -> list (i
9130: 74 65 6d 29 29 2c 20 69 74 65 6d 20 20 3d 20 6c tem)), item = l
9140: 69 73 74 20 28 74 79 70 65 20 69 64 29 0a 20 20 ist (type id).
9150: 20 20 74 79 70 65 6d 65 74 68 6f 64 20 73 75 63 typemethod suc
9160: 63 65 73 73 6f 72 73 20 7b 64 76 20 72 65 76 69 cessors {dv revi
9170: 73 69 6f 6e 73 7d 20 7b 0a 09 75 70 76 61 72 20 sions} {..upvar
9180: 31 20 24 64 76 20 64 65 70 65 6e 64 65 6e 63 69 1 $dv dependenci
9190: 65 73 0a 09 73 65 74 20 74 68 65 73 65 74 20 28 es..set theset (
91a0: 27 5b 6a 6f 69 6e 20 24 72 65 76 69 73 69 6f 6e '[join $revision
91b0: 73 20 7b 27 2c 27 7d 5d 27 29 0a 0a 09 23 20 54 s {','}]')...# T
91c0: 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 63 61 73 he following cas
91d0: 65 73 20 73 70 65 63 69 66 79 20 77 68 65 6e 20 es specify when
91e0: 61 20 72 65 76 69 73 69 6f 6e 20 53 20 69 73 20 a revision S is
91f0: 61 20 73 75 63 63 65 73 73 6f 72 0a 09 23 20 6f a successor..# o
9200: 66 20 61 20 72 65 76 69 73 69 6f 6e 20 52 2e 20 f a revision R.
9210: 45 61 63 68 20 6f 66 20 74 68 65 20 63 61 73 65 Each of the case
9220: 73 20 74 72 61 6e 73 6c 61 74 65 73 20 69 6e 74 s translates int
9230: 6f 20 6f 6e 65 20 6f 66 0a 09 23 20 74 68 65 20 o one of..# the
9240: 62 72 61 6e 63 68 65 73 20 6f 66 20 74 68 65 20 branches of the
9250: 53 51 4c 20 55 4e 49 4f 4e 20 63 6f 6d 69 6e 67 SQL UNION coming
9260: 20 62 65 6c 6f 77 2e 0a 09 23 0a 09 23 20 28 31 below...#..# (1
9270: 29 20 53 20 63 61 6e 20 62 65 20 61 20 70 72 69 ) S can be a pri
9280: 6d 61 72 79 20 63 68 69 6c 64 20 6f 66 20 52 2c mary child of R,
9290: 20 69 2e 65 2e 20 69 6e 20 74 68 65 20 73 61 6d i.e. in the sam
92a0: 65 20 4c 4f 44 2e 20 52 0a 09 23 20 20 20 20 20 e LOD. R..#
92b0: 72 65 66 65 72 65 6e 63 65 73 20 53 20 64 69 72 references S dir
92c0: 65 63 74 6c 79 2e 20 52 2e 63 68 69 6c 64 20 3d ectly. R.child =
92d0: 20 53 28 2e 72 69 64 29 2c 20 69 66 20 69 74 20 S(.rid), if it
92e0: 65 78 69 73 74 73 2e 0a 09 23 0a 09 23 20 28 32 exists...#..# (2
92f0: 29 20 53 20 63 61 6e 20 62 65 20 61 20 73 65 63 ) S can be a sec
9300: 6f 6e 64 61 72 79 2c 20 69 2e 65 2e 20 62 72 61 ondary, i.e. bra
9310: 6e 63 68 2c 20 63 68 69 6c 64 20 6f 66 20 52 2e nch, child of R.
9320: 20 48 65 72 65 20 74 68 65 0a 09 23 20 20 20 20 Here the..#
9330: 20 6c 69 6e 6b 20 69 73 20 6d 61 64 65 20 74 68 link is made th
9340: 72 6f 75 67 68 20 74 68 65 20 68 65 6c 70 65 72 rough the helper
9350: 20 74 61 62 6c 65 0a 09 23 20 20 20 20 20 52 45 table..# RE
9360: 56 49 53 49 4f 4e 42 52 41 4e 43 48 43 48 49 4c VISIONBRANCHCHIL
9370: 44 52 45 4e 2e 20 52 2e 72 69 64 20 2d 3e 20 52 DREN. R.rid -> R
9380: 42 43 2e 72 69 64 2c 20 52 42 43 2e 62 72 69 64 BC.rid, RBC.brid
9390: 20 3d 0a 09 23 20 20 20 20 20 53 28 2e 72 69 64 =..# S(.rid
93a0: 29 0a 09 23 0a 09 23 20 28 33 29 20 4f 72 69 67 )..#..# (3) Orig
93b0: 69 6e 61 6c 6c 79 20 74 68 69 73 20 75 73 65 20 inally this use
93c0: 63 61 73 65 20 64 65 66 69 6e 65 64 20 74 68 65 case defined the
93d0: 20 72 6f 6f 74 20 6f 66 20 61 20 64 65 74 61 63 root of a detac
93e0: 68 65 64 0a 09 23 20 20 20 20 20 4e 54 44 42 20 hed..# NTDB
93f0: 61 73 20 74 68 65 20 73 75 63 63 65 73 73 6f 72 as the successor
9400: 20 6f 66 20 74 68 65 20 74 72 75 6e 6b 20 72 6f of the trunk ro
9410: 6f 74 2e 20 54 68 69 73 20 6c 65 61 64 73 20 74 ot. This leads t
9420: 6f 20 61 0a 09 23 20 20 20 20 20 62 61 64 20 74 o a..# bad t
9430: 61 6e 67 6c 65 20 6c 61 74 65 72 20 6f 6e 2e 20 angle later on.
9440: 57 69 74 68 20 61 20 64 65 74 61 63 68 65 64 20 With a detached
9450: 4e 54 44 42 20 74 68 65 20 6f 72 69 67 69 6e 61 NTDB the origina
9460: 6c 0a 09 23 20 20 20 20 20 74 72 75 6e 6b 20 72 l..# trunk r
9470: 6f 6f 74 20 72 65 76 69 73 69 6f 6e 20 77 61 73 oot revision was
9480: 20 72 65 6d 6f 76 65 64 20 61 73 20 69 72 72 65 removed as irre
9490: 6c 65 76 61 6e 74 2c 20 61 6c 6c 6f 77 69 6e 67 levant, allowing
94a0: 0a 09 23 20 20 20 20 20 74 68 65 20 6e 6f 6d 69 ..# the nomi
94b0: 6e 61 6c 20 72 6f 6f 74 20 74 6f 20 62 65 20 6c nal root to be l
94c0: 61 74 65 72 20 69 6e 20 74 69 6d 65 20 74 68 61 ater in time tha
94d0: 6e 20 74 68 65 20 4e 54 44 42 0a 09 23 20 20 20 n the NTDB..#
94e0: 20 20 72 6f 6f 74 2e 20 4e 6f 77 20 73 65 74 74 root. Now sett
94f0: 69 6e 67 20 74 68 69 73 20 64 65 70 65 6e 64 65 ing this depende
9500: 6e 63 79 20 77 69 6c 6c 20 62 65 20 62 61 63 6b ncy will be back
9510: 77 61 72 64 20 69 6e 0a 09 23 20 20 20 20 20 74 ward in..# t
9520: 69 6d 65 2e 20 52 45 4d 4f 56 45 44 2e 0a 09 23 ime. REMOVED...#
9530: 0a 09 23 20 28 34 29 20 49 66 20 52 20 69 73 20 ..# (4) If R is
9540: 74 68 65 20 6c 61 73 74 20 6f 66 20 74 68 65 20 the last of the
9550: 4e 54 44 42 20 72 65 76 69 73 69 6f 6e 73 20 77 NTDB revisions w
9560: 68 69 63 68 20 62 65 6c 6f 6e 67 20 74 6f 0a 09 hich belong to..
9570: 23 20 20 20 20 20 74 68 65 20 74 72 75 6e 6b 2c # the trunk,
9580: 20 74 68 65 6e 20 74 68 65 20 70 72 69 6d 61 72 then the primar
9590: 79 20 63 68 69 6c 64 20 6f 66 20 74 68 65 20 74 y child of the t
95a0: 72 75 6e 6b 20 72 6f 6f 74 20 28 74 68 65 0a 09 runk root (the..
95b0: 23 20 20 20 20 20 27 31 2e 32 27 20 72 65 76 69 # '1.2' revi
95c0: 73 69 6f 6e 29 20 69 73 20 61 20 73 75 63 63 65 sion) is a succe
95d0: 73 73 6f 72 2c 20 69 66 20 69 74 20 65 78 69 73 ssor, if it exis
95e0: 74 73 2e 0a 0a 09 23 20 4e 6f 74 65 20 74 68 61 ts....# Note tha
95f0: 74 20 74 68 65 20 62 72 61 6e 63 68 65 73 20 73 t the branches s
9600: 70 61 77 6e 65 64 20 66 72 6f 6d 20 74 68 65 20 pawned from the
9610: 72 65 76 69 73 69 6f 6e 73 2c 20 61 6e 64 20 74 revisions, and t
9620: 68 65 0a 09 23 20 74 61 67 73 20 61 73 73 6f 63 he..# tags assoc
9630: 69 61 74 65 64 20 77 69 74 68 20 74 68 65 6d 20 iated with them
9640: 61 72 65 20 73 75 63 63 65 73 73 6f 72 73 20 61 are successors a
9650: 73 20 77 65 6c 6c 2e 0a 0a 09 66 6f 72 65 61 63 s well....foreac
9660: 68 20 7b 72 69 64 20 63 68 69 6c 64 7d 20 5b 73 h {rid child} [s
9670: 74 61 74 65 20 72 75 6e 20 5b 73 75 62 73 74 20 tate run [subst
9680: 2d 6e 6f 63 6f 6d 6d 61 6e 64 73 20 2d 6e 6f 62 -nocommands -nob
9690: 61 63 6b 73 6c 61 73 68 65 73 20 7b 0a 20 20 20 ackslashes {.
96a0: 20 2d 2d 20 28 31 29 20 50 72 69 6d 61 72 79 20 -- (1) Primary
96b0: 63 68 69 6c 64 0a 09 20 20 20 20 53 45 4c 45 43 child.. SELEC
96c0: 54 20 52 2e 72 69 64 2c 20 52 2e 63 68 69 6c 64 T R.rid, R.child
96d0: 0a 09 20 20 20 20 46 52 4f 4d 20 20 20 72 65 76 .. FROM rev
96e0: 69 73 69 6f 6e 20 52 0a 09 20 20 20 20 57 48 45 ision R.. WHE
96f0: 52 45 20 20 52 2e 72 69 64 20 20 20 49 4e 20 24 RE R.rid IN $
9700: 74 68 65 73 65 74 20 20 20 20 20 2d 2d 20 52 65 theset -- Re
9710: 73 74 72 69 63 74 20 74 6f 20 72 65 76 69 73 69 strict to revisi
9720: 6f 6e 73 20 6f 66 20 69 6e 74 65 72 65 73 74 0a ons of interest.
9730: 09 20 20 20 20 41 4e 44 20 20 20 20 52 2e 63 68 . AND R.ch
9740: 69 6c 64 20 49 53 20 4e 4f 54 20 4e 55 4c 4c 20 ild IS NOT NULL
9750: 20 20 20 2d 2d 20 48 61 73 20 70 72 69 6d 61 72 -- Has primar
9760: 79 20 63 68 69 6c 64 0a 20 20 20 20 55 4e 49 4f y child. UNIO
9770: 4e 0a 20 20 20 20 2d 2d 20 28 32 29 20 53 65 63 N. -- (2) Sec
9780: 6f 6e 64 61 72 79 20 28 62 72 61 6e 63 68 29 20 ondary (branch)
9790: 63 68 69 6c 64 72 65 6e 0a 09 20 20 20 20 53 45 children.. SE
97a0: 4c 45 43 54 20 52 2e 72 69 64 2c 20 42 2e 62 72 LECT R.rid, B.br
97b0: 69 64 0a 09 20 20 20 20 46 52 4f 4d 20 20 20 72 id.. FROM r
97c0: 65 76 69 73 69 6f 6e 20 52 2c 20 72 65 76 69 73 evision R, revis
97d0: 69 6f 6e 62 72 61 6e 63 68 63 68 69 6c 64 72 65 ionbranchchildre
97e0: 6e 20 42 0a 09 20 20 20 20 57 48 45 52 45 20 20 n B.. WHERE
97f0: 52 2e 72 69 64 20 20 20 49 4e 20 24 74 68 65 73 R.rid IN $thes
9800: 65 74 20 20 20 20 20 2d 2d 20 52 65 73 74 72 69 et -- Restri
9810: 63 74 20 74 6f 20 72 65 76 69 73 69 6f 6e 73 20 ct to revisions
9820: 6f 66 20 69 6e 74 65 72 65 73 74 0a 09 20 20 20 of interest..
9830: 20 41 4e 44 20 20 20 20 52 2e 72 69 64 20 3d 20 AND R.rid =
9840: 42 2e 72 69 64 20 20 20 20 20 20 20 20 20 20 2d B.rid -
9850: 2d 20 53 65 6c 65 63 74 20 73 75 62 73 65 74 20 - Select subset
9860: 6f 66 20 62 72 61 6e 63 68 20 63 68 69 6c 64 72 of branch childr
9870: 65 6e 0a 20 20 20 20 55 4e 49 4f 4e 0a 20 20 20 en. UNION.
9880: 20 2d 2d 20 28 34 29 20 43 68 69 6c 64 20 6f 66 -- (4) Child of
9890: 20 74 72 75 6e 6b 20 72 6f 6f 74 20 73 75 63 63 trunk root succ
98a0: 65 73 73 6f 72 20 6f 66 20 6c 61 73 74 20 4e 54 essor of last NT
98b0: 44 42 20 6f 6e 20 74 72 75 6e 6b 2e 0a 09 20 20 DB on trunk...
98c0: 20 20 53 45 4c 45 43 54 20 52 2e 72 69 64 2c 20 SELECT R.rid,
98d0: 52 41 2e 63 68 69 6c 64 0a 09 20 20 20 20 46 52 RA.child.. FR
98e0: 4f 4d 20 72 65 76 69 73 69 6f 6e 20 52 2c 20 72 OM revision R, r
98f0: 65 76 69 73 69 6f 6e 20 52 41 0a 09 20 20 20 20 evision RA..
9900: 57 48 45 52 45 20 52 2e 72 69 64 20 20 20 49 4e WHERE R.rid IN
9910: 20 24 74 68 65 73 65 74 20 20 20 20 20 20 2d 2d $theset --
9920: 20 52 65 73 74 72 69 63 74 20 74 6f 20 72 65 76 Restrict to rev
9930: 69 73 69 6f 6e 73 20 6f 66 20 69 6e 74 65 72 65 isions of intere
9940: 73 74 0a 09 20 20 20 20 41 4e 44 20 20 20 52 2e st.. AND R.
9950: 69 73 64 65 66 61 75 6c 74 20 20 20 20 20 20 20 isdefault
9960: 20 20 20 20 20 20 2d 2d 20 52 65 73 74 72 69 63 -- Restric
9970: 74 20 74 6f 20 4e 54 44 42 0a 09 20 20 20 20 41 t to NTDB.. A
9980: 4e 44 20 20 20 52 2e 64 62 63 68 69 6c 64 20 49 ND R.dbchild I
9990: 53 20 4e 4f 54 20 4e 55 4c 4c 20 20 20 2d 2d 20 S NOT NULL --
99a0: 61 6e 64 20 6c 61 73 74 20 4e 54 44 42 20 62 65 and last NTDB be
99b0: 6c 6f 6e 67 69 6e 67 20 74 6f 20 74 72 75 6e 6b longing to trunk
99c0: 0a 09 20 20 20 20 41 4e 44 20 20 20 52 41 2e 72 .. AND RA.r
99d0: 69 64 20 3d 20 52 2e 64 62 63 68 69 6c 64 20 20 id = R.dbchild
99e0: 20 20 20 20 2d 2d 20 47 6f 20 64 69 72 65 63 74 -- Go direct
99f0: 6c 79 20 74 6f 20 74 72 75 6e 6b 20 72 6f 6f 74 ly to trunk root
9a00: 0a 09 20 20 20 20 41 4e 44 20 20 20 52 41 2e 63 .. AND RA.c
9a10: 68 69 6c 64 20 49 53 20 4e 4f 54 20 4e 55 4c 4c hild IS NOT NULL
9a20: 20 20 20 20 2d 2d 20 48 61 73 20 70 72 69 6d 61 -- Has prima
9a30: 72 79 20 63 68 69 6c 64 2e 0a 09 7d 5d 5d 20 7b ry child...}]] {
9a40: 0a 09 20 20 20 20 23 20 43 6f 6e 73 69 64 65 72 .. # Consider
9a50: 20 6d 6f 76 69 6e 67 20 74 68 69 73 20 74 6f 20 moving this to
9a60: 74 68 65 20 69 6e 74 65 67 72 69 74 79 20 6d 6f the integrity mo
9a70: 64 75 6c 65 2e 0a 09 20 20 20 20 69 6e 74 65 67 dule... integ
9a80: 72 69 74 79 20 61 73 73 65 72 74 20 7b 24 72 69 rity assert {$ri
9a90: 64 20 21 3d 20 24 63 68 69 6c 64 7d 20 7b 52 65 d != $child} {Re
9aa0: 76 69 73 69 6f 6e 20 24 72 69 64 20 64 65 70 65 vision $rid depe
9ab0: 6e 64 73 20 6f 6e 20 69 74 73 65 6c 66 2e 7d 0a nds on itself.}.
9ac0: 09 20 20 20 20 6c 61 70 70 65 6e 64 20 64 65 70 . lappend dep
9ad0: 65 6e 64 65 6e 63 69 65 73 28 5b 6c 69 73 74 20 endencies([list
9ae0: 72 65 76 20 24 72 69 64 5d 29 20 5b 6c 69 73 74 rev $rid]) [list
9af0: 20 72 65 76 20 24 63 68 69 6c 64 5d 0a 09 7d 0a rev $child]..}.
9b00: 09 66 6f 72 65 61 63 68 20 7b 72 69 64 20 63 68 .foreach {rid ch
9b10: 69 6c 64 7d 20 5b 73 74 61 74 65 20 72 75 6e 20 ild} [state run
9b20: 5b 73 75 62 73 74 20 2d 6e 6f 63 6f 6d 6d 61 6e [subst -nocomman
9b30: 64 73 20 2d 6e 6f 62 61 63 6b 73 6c 61 73 68 65 ds -nobackslashe
9b40: 73 20 7b 0a 09 20 20 20 20 53 45 4c 45 43 54 20 s {.. SELECT
9b50: 52 2e 72 69 64 2c 20 54 2e 74 69 64 0a 09 20 20 R.rid, T.tid..
9b60: 20 20 46 52 4f 4d 20 20 20 72 65 76 69 73 69 6f FROM revisio
9b70: 6e 20 52 2c 20 74 61 67 20 54 0a 09 20 20 20 20 n R, tag T..
9b80: 57 48 45 52 45 20 20 52 2e 72 69 64 20 49 4e 20 WHERE R.rid IN
9b90: 24 74 68 65 73 65 74 20 20 20 20 20 20 20 2d 2d $theset --
9ba0: 20 52 65 73 74 72 69 63 74 20 74 6f 20 72 65 76 Restrict to rev
9bb0: 69 73 69 6f 6e 73 20 6f 66 20 69 6e 74 65 72 65 isions of intere
9bc0: 73 74 0a 09 20 20 20 20 41 4e 44 20 20 20 20 54 st.. AND T
9bd0: 2e 72 65 76 20 3d 20 52 2e 72 69 64 20 20 20 20 .rev = R.rid
9be0: 20 20 20 20 20 20 2d 2d 20 53 65 6c 65 63 74 20 -- Select
9bf0: 74 61 67 73 20 61 74 74 61 63 68 65 64 20 74 6f tags attached to
9c00: 20 74 68 65 6d 0a 09 7d 5d 5d 20 7b 0a 09 20 20 them..}]] {..
9c10: 20 20 6c 61 70 70 65 6e 64 20 64 65 70 65 6e 64 lappend depend
9c20: 65 6e 63 69 65 73 28 5b 6c 69 73 74 20 72 65 76 encies([list rev
9c30: 20 24 72 69 64 5d 29 20 5b 6c 69 73 74 20 73 79 $rid]) [list sy
9c40: 6d 3a 3a 74 61 67 20 24 63 68 69 6c 64 5d 0a 09 m::tag $child]..
9c50: 7d 0a 09 66 6f 72 65 61 63 68 20 7b 72 69 64 20 }..foreach {rid
9c60: 63 68 69 6c 64 7d 20 5b 73 74 61 74 65 20 72 75 child} [state ru
9c70: 6e 20 5b 73 75 62 73 74 20 2d 6e 6f 63 6f 6d 6d n [subst -nocomm
9c80: 61 6e 64 73 20 2d 6e 6f 62 61 63 6b 73 6c 61 73 ands -nobackslas
9c90: 68 65 73 20 7b 0a 09 20 20 20 20 53 45 4c 45 43 hes {.. SELEC
9ca0: 54 20 52 2e 72 69 64 2c 20 42 2e 62 69 64 0a 09 T R.rid, B.bid..
9cb0: 20 20 20 20 46 52 4f 4d 20 20 20 72 65 76 69 73 FROM revis
9cc0: 69 6f 6e 20 52 2c 20 62 72 61 6e 63 68 20 42 0a ion R, branch B.
9cd0: 09 20 20 20 20 57 48 45 52 45 20 20 52 2e 72 69 . WHERE R.ri
9ce0: 64 20 49 4e 20 24 74 68 65 73 65 74 20 20 20 20 d IN $theset
9cf0: 20 20 20 2d 2d 20 52 65 73 74 72 69 63 74 20 74 -- Restrict t
9d00: 6f 20 72 65 76 69 73 69 6f 6e 73 20 6f 66 20 69 o revisions of i
9d10: 6e 74 65 72 65 73 74 0a 09 20 20 20 20 41 4e 44 nterest.. AND
9d20: 20 20 20 20 42 2e 72 6f 6f 74 20 3d 20 52 2e 72 B.root = R.r
9d30: 69 64 20 20 20 20 20 20 20 20 20 2d 2d 20 53 65 id -- Se
9d40: 6c 65 63 74 20 62 72 61 6e 63 68 65 73 20 61 74 lect branches at
9d50: 74 61 63 68 65 64 20 74 6f 20 74 68 65 6d 0a 09 tached to them..
9d60: 7d 5d 5d 20 7b 0a 09 20 20 20 20 6c 61 70 70 65 }]] {.. lappe
9d70: 6e 64 20 64 65 70 65 6e 64 65 6e 63 69 65 73 28 nd dependencies(
9d80: 5b 6c 69 73 74 20 72 65 76 20 24 72 69 64 5d 29 [list rev $rid])
9d90: 20 5b 6c 69 73 74 20 73 79 6d 3a 3a 62 72 61 6e [list sym::bran
9da0: 63 68 20 24 63 68 69 6c 64 5d 0a 09 7d 0a 09 72 ch $child]..}..r
9db0: 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 eturn. }..
9dc0: 20 23 20 72 65 73 75 6c 74 20 3d 20 6c 69 73 74 # result = list
9dd0: 20 28 63 68 61 6e 67 65 73 65 74 2d 69 64 29 0a (changeset-id).
9de0: 20 20 20 20 74 79 70 65 6d 65 74 68 6f 64 20 63 typemethod c
9df0: 73 5f 73 75 63 63 65 73 73 6f 72 73 20 7b 72 65 s_successors {re
9e00: 76 69 73 69 6f 6e 73 7d 20 7b 0a 20 20 20 20 20 visions} {.
9e10: 20 20 20 23 20 54 68 69 73 20 69 73 20 61 20 76 # This is a v
9e20: 61 72 69 61 6e 74 20 6f 66 20 27 73 75 63 63 65 ariant of 'succe
9e30: 73 73 6f 72 73 27 20 77 68 69 63 68 20 6d 61 70 ssors' which map
9e40: 73 20 74 68 65 20 6c 6f 77 2d 6c 65 76 65 6c 0a s the low-level.
9e50: 20 20 20 20 20 20 20 20 23 20 64 61 74 61 20 64 # data d
9e60: 69 72 65 63 74 6c 79 20 74 6f 20 74 68 65 20 61 irectly to the a
9e70: 73 73 6f 63 69 61 74 65 64 20 63 68 61 6e 67 65 ssociated change
9e80: 73 65 74 73 2e 20 49 2e 65 2e 20 69 6e 73 74 65 sets. I.e. inste
9e90: 61 64 0a 20 20 20 20 20 20 20 20 23 20 6d 69 6c ad. # mil
9ea0: 6c 69 6f 6e 73 20 6f 66 20 64 65 70 65 6e 64 65 lions of depende
9eb0: 6e 63 79 20 70 61 69 72 73 20 28 69 6e 20 65 78 ncy pairs (in ex
9ec0: 74 72 65 6d 65 20 63 61 73 65 73 20 28 45 78 61 treme cases (Exa
9ed0: 6d 70 6c 65 3a 20 54 63 6c 0a 20 20 20 20 20 20 mple: Tcl.
9ee0: 20 20 23 20 43 56 53 29 29 20 77 65 20 72 65 74 # CVS)) we ret
9ef0: 75 72 6e 20 61 20 76 65 72 79 20 73 68 6f 72 74 urn a very short
9f00: 20 61 6e 64 20 6d 75 63 68 20 6d 6f 72 65 20 6d and much more m
9f10: 61 6e 61 67 65 61 62 6c 65 20 6c 69 73 74 0a 20 anageable list.
9f20: 20 20 20 20 20 20 20 23 20 6f 66 20 63 68 61 6e # of chan
9f30: 67 65 73 65 74 73 2e 0a 0a 09 73 65 74 20 74 68 gesets....set th
9f40: 65 73 65 74 20 28 27 5b 6a 6f 69 6e 20 24 72 65 eset ('[join $re
9f50: 76 69 73 69 6f 6e 73 20 7b 27 2c 27 7d 5d 27 29 visions {','}]')
9f60: 0a 09 72 65 74 75 72 6e 20 5b 73 74 61 74 65 20 ..return [state
9f70: 72 75 6e 20 5b 73 75 62 73 74 20 2d 6e 6f 63 6f run [subst -noco
9f80: 6d 6d 61 6e 64 73 20 2d 6e 6f 62 61 63 6b 73 6c mmands -nobacksl
9f90: 61 73 68 65 73 20 7b 0a 20 20 20 20 2d 2d 20 28 ashes {. -- (
9fa0: 31 29 20 50 72 69 6d 61 72 79 20 63 68 69 6c 64 1) Primary child
9fb0: 0a 09 20 20 20 20 53 45 4c 45 43 54 20 43 2e 63 .. SELECT C.c
9fc0: 69 64 0a 09 20 20 20 20 46 52 4f 4d 20 20 20 72 id.. FROM r
9fd0: 65 76 69 73 69 6f 6e 20 52 2c 20 63 73 69 74 65 evision R, csite
9fe0: 6d 20 43 49 2c 20 63 68 61 6e 67 65 73 65 74 20 m CI, changeset
9ff0: 43 0a 09 20 20 20 20 57 48 45 52 45 20 20 52 2e C.. WHERE R.
a000: 72 69 64 20 20 20 49 4e 20 24 74 68 65 73 65 74 rid IN $theset
a010: 20 20 20 20 20 2d 2d 20 52 65 73 74 72 69 63 74 -- Restrict
a020: 20 74 6f 20 72 65 76 69 73 69 6f 6e 73 20 6f 66 to revisions of
a030: 20 69 6e 74 65 72 65 73 74 0a 09 20 20 20 20 41 interest.. A
a040: 4e 44 20 20 20 20 52 2e 63 68 69 6c 64 20 49 53 ND R.child IS
a050: 20 4e 4f 54 20 4e 55 4c 4c 20 20 20 20 2d 2d 20 NOT NULL --
a060: 48 61 73 20 70 72 69 6d 61 72 79 20 63 68 69 6c Has primary chil
a070: 64 0a 20 20 20 20 20 20 20 20 20 20 20 20 41 4e d. AN
a080: 44 20 20 20 20 43 49 2e 69 69 64 20 3d 20 52 2e D CI.iid = R.
a090: 63 68 69 6c 64 20 20 20 20 20 20 20 2d 2d 20 53 child -- S
a0a0: 65 6c 65 63 74 20 61 6c 6c 20 63 68 61 6e 67 65 elect all change
a0b0: 73 65 74 73 0a 20 20 20 20 20 20 20 20 20 20 20 sets.
a0c0: 20 41 4e 44 20 20 20 20 43 2e 63 69 64 20 3d 20 AND C.cid =
a0d0: 43 49 2e 63 69 64 20 20 20 20 20 20 20 20 20 2d CI.cid -
a0e0: 2d 20 63 6f 6e 74 61 69 6e 69 6e 67 20 74 68 65 - containing the
a0f0: 20 70 72 69 6d 61 72 79 20 63 68 69 6c 64 0a 20 primary child.
a100: 20 20 20 20 20 20 20 20 20 20 20 41 4e 44 20 20 AND
a110: 20 20 43 2e 74 79 70 65 20 3d 20 30 20 20 20 20 C.type = 0
a120: 20 20 20 20 20 20 20 20 20 2d 2d 20 77 68 69 63 -- whic
a130: 68 20 61 72 65 20 72 65 76 69 73 69 6f 6e 20 63 h are revision c
a140: 68 61 6e 67 65 73 65 74 73 0a 20 20 20 20 55 4e hangesets. UN
a150: 49 4f 4e 0a 20 20 20 20 2d 2d 20 28 32 29 20 53 ION. -- (2) S
a160: 65 63 6f 6e 64 61 72 79 20 28 62 72 61 6e 63 68 econdary (branch
a170: 29 20 63 68 69 6c 64 72 65 6e 0a 09 20 20 20 20 ) children..
a180: 53 45 4c 45 43 54 20 43 2e 63 69 64 0a 09 20 20 SELECT C.cid..
a190: 20 20 46 52 4f 4d 20 20 20 72 65 76 69 73 69 6f FROM revisio
a1a0: 6e 20 52 2c 20 72 65 76 69 73 69 6f 6e 62 72 61 n R, revisionbra
a1b0: 6e 63 68 63 68 69 6c 64 72 65 6e 20 42 2c 20 63 nchchildren B, c
a1c0: 73 69 74 65 6d 20 43 49 2c 20 63 68 61 6e 67 65 sitem CI, change
a1d0: 73 65 74 20 43 0a 09 20 20 20 20 57 48 45 52 45 set C.. WHERE
a1e0: 20 20 52 2e 72 69 64 20 20 20 49 4e 20 24 74 68 R.rid IN $th
a1f0: 65 73 65 74 20 20 20 20 20 2d 2d 20 52 65 73 74 eset -- Rest
a200: 72 69 63 74 20 74 6f 20 72 65 76 69 73 69 6f 6e rict to revision
a210: 73 20 6f 66 20 69 6e 74 65 72 65 73 74 0a 09 20 s of interest..
a220: 20 20 20 41 4e 44 20 20 20 20 52 2e 72 69 64 20 AND R.rid
a230: 3d 20 42 2e 72 69 64 20 20 20 20 20 20 20 20 20 = B.rid
a240: 20 2d 2d 20 53 65 6c 65 63 74 20 73 75 62 73 65 -- Select subse
a250: 74 20 6f 66 20 62 72 61 6e 63 68 20 63 68 69 6c t of branch chil
a260: 64 72 65 6e 0a 20 20 20 20 20 20 20 20 20 20 20 dren.
a270: 20 41 4e 44 20 20 20 20 43 49 2e 69 69 64 20 3d AND CI.iid =
a280: 20 42 2e 62 72 69 64 20 20 20 20 20 20 20 20 2d B.brid -
a290: 2d 20 53 65 6c 65 63 74 20 61 6c 6c 20 63 68 61 - Select all cha
a2a0: 6e 67 65 73 65 74 73 0a 20 20 20 20 20 20 20 20 ngesets.
a2b0: 20 20 20 20 41 4e 44 20 20 20 20 43 2e 63 69 64 AND C.cid
a2c0: 20 3d 20 43 49 2e 63 69 64 09 20 20 2d 2d 20 63 = CI.cid. -- c
a2d0: 6f 6e 74 61 69 6e 69 6e 67 20 74 68 65 20 62 72 ontaining the br
a2e0: 61 6e 63 68 0a 20 20 20 20 20 20 20 20 20 20 20 anch.
a2f0: 20 41 4e 44 20 20 20 20 43 2e 74 79 70 65 20 3d AND C.type =
a300: 20 30 09 09 20 20 2d 2d 20 77 68 69 63 68 20 61 0.. -- which a
a310: 72 65 20 72 65 76 69 73 69 6f 6e 20 63 68 61 6e re revision chan
a320: 67 65 73 65 74 73 0a 20 20 20 20 55 4e 49 4f 4e gesets. UNION
a330: 0a 20 20 20 20 2d 2d 20 28 34 29 20 43 68 69 6c . -- (4) Chil
a340: 64 20 6f 66 20 74 72 75 6e 6b 20 72 6f 6f 74 20 d of trunk root
a350: 73 75 63 63 65 73 73 6f 72 20 6f 66 20 6c 61 73 successor of las
a360: 74 20 4e 54 44 42 20 6f 6e 20 74 72 75 6e 6b 2e t NTDB on trunk.
a370: 0a 09 20 20 20 20 53 45 4c 45 43 54 20 43 2e 63 .. SELECT C.c
a380: 69 64 0a 09 20 20 20 20 46 52 4f 4d 20 20 20 72 id.. FROM r
a390: 65 76 69 73 69 6f 6e 20 52 2c 20 72 65 76 69 73 evision R, revis
a3a0: 69 6f 6e 20 52 41 2c 20 63 73 69 74 65 6d 20 43 ion RA, csitem C
a3b0: 49 2c 20 63 68 61 6e 67 65 73 65 74 20 43 0a 09 I, changeset C..
a3c0: 20 20 20 20 57 48 45 52 45 20 20 52 2e 72 69 64 WHERE R.rid
a3d0: 20 20 20 49 4e 20 24 74 68 65 73 65 74 20 20 20 IN $theset
a3e0: 20 20 20 2d 2d 20 52 65 73 74 72 69 63 74 20 74 -- Restrict t
a3f0: 6f 20 72 65 76 69 73 69 6f 6e 73 20 6f 66 20 69 o revisions of i
a400: 6e 74 65 72 65 73 74 0a 09 20 20 20 20 41 4e 44 nterest.. AND
a410: 20 20 20 20 52 2e 69 73 64 65 66 61 75 6c 74 20 R.isdefault
a420: 20 20 20 20 20 20 20 20 20 20 20 20 2d 2d 20 52 -- R
a430: 65 73 74 72 69 63 74 20 74 6f 20 4e 54 44 42 0a estrict to NTDB.
a440: 09 20 20 20 20 41 4e 44 20 20 20 20 52 2e 64 62 . AND R.db
a450: 63 68 69 6c 64 20 49 53 20 4e 4f 54 20 4e 55 4c child IS NOT NUL
a460: 4c 20 20 20 2d 2d 20 61 6e 64 20 6c 61 73 74 20 L -- and last
a470: 4e 54 44 42 20 62 65 6c 6f 6e 67 69 6e 67 20 74 NTDB belonging t
a480: 6f 20 74 72 75 6e 6b 0a 09 20 20 20 20 41 4e 44 o trunk.. AND
a490: 20 20 20 20 52 41 2e 72 69 64 20 3d 20 52 2e 64 RA.rid = R.d
a4a0: 62 63 68 69 6c 64 20 20 20 20 20 20 2d 2d 20 47 bchild -- G
a4b0: 6f 20 64 69 72 65 63 74 6c 79 20 74 6f 20 74 72 o directly to tr
a4c0: 75 6e 6b 20 72 6f 6f 74 0a 09 20 20 20 20 41 4e unk root.. AN
a4d0: 44 20 20 20 20 52 41 2e 63 68 69 6c 64 20 49 53 D RA.child IS
a4e0: 20 4e 4f 54 20 4e 55 4c 4c 20 20 20 20 2d 2d 20 NOT NULL --
a4f0: 48 61 73 20 70 72 69 6d 61 72 79 20 63 68 69 6c Has primary chil
a500: 64 2e 0a 20 20 20 20 20 20 20 20 20 20 20 20 41 d.. A
a510: 4e 44 20 20 20 20 43 49 2e 69 69 64 20 3d 20 52 ND CI.iid = R
a520: 41 2e 63 68 69 6c 64 20 20 20 20 20 20 20 2d 2d A.child --
a530: 20 53 65 6c 65 63 74 20 61 6c 6c 20 63 68 61 6e Select all chan
a540: 67 65 73 65 74 73 0a 20 20 20 20 20 20 20 20 20 gesets.
a550: 20 20 20 41 4e 44 20 20 20 20 43 2e 63 69 64 20 AND C.cid
a560: 3d 20 43 49 2e 63 69 64 09 20 20 20 2d 2d 20 63 = CI.cid. -- c
a570: 6f 6e 74 61 69 6e 69 6e 67 20 74 68 65 20 70 72 ontaining the pr
a580: 69 6d 61 72 79 20 63 68 69 6c 64 0a 20 20 20 20 imary child.
a590: 20 20 20 20 20 20 20 20 41 4e 44 20 20 20 20 43 AND C
a5a0: 2e 74 79 70 65 20 3d 20 30 09 09 20 20 20 2d 2d .type = 0.. --
a5b0: 20 77 68 69 63 68 20 61 72 65 20 72 65 76 69 73 which are revis
a5c0: 69 6f 6e 20 63 68 61 6e 67 65 73 65 74 73 0a 20 ion changesets.
a5d0: 20 20 20 55 4e 49 4f 4e 0a 09 20 20 20 20 53 45 UNION.. SE
a5e0: 4c 45 43 54 20 43 2e 63 69 64 0a 09 20 20 20 20 LECT C.cid..
a5f0: 46 52 4f 4d 20 20 20 72 65 76 69 73 69 6f 6e 20 FROM revision
a600: 52 2c 20 74 61 67 20 54 2c 20 63 73 69 74 65 6d R, tag T, csitem
a610: 20 43 49 2c 20 63 68 61 6e 67 65 73 65 74 20 43 CI, changeset C
a620: 0a 09 20 20 20 20 57 48 45 52 45 20 20 52 2e 72 .. WHERE R.r
a630: 69 64 20 69 6e 20 24 74 68 65 73 65 74 20 20 20 id in $theset
a640: 20 20 20 20 20 2d 2d 20 52 65 73 74 72 69 63 74 -- Restrict
a650: 20 74 6f 20 72 65 76 69 73 69 6f 6e 73 20 6f 66 to revisions of
a660: 20 69 6e 74 65 72 65 73 74 0a 09 20 20 20 20 41 interest.. A
a670: 4e 44 20 20 20 20 54 2e 72 65 76 20 3d 20 52 2e ND T.rev = R.
a680: 72 69 64 09 20 20 20 2d 2d 20 53 65 6c 65 63 74 rid. -- Select
a690: 20 74 61 67 73 20 61 74 74 61 63 68 65 64 20 74 tags attached t
a6a0: 6f 20 74 68 65 6d 0a 20 20 20 20 20 20 20 20 20 o them.
a6b0: 20 20 20 41 4e 44 20 20 20 20 43 49 2e 69 69 64 AND CI.iid
a6c0: 20 3d 20 54 2e 74 69 64 20 20 20 20 20 20 20 20 = T.tid
a6d0: 20 20 2d 2d 20 53 65 6c 65 63 74 20 61 6c 6c 20 -- Select all
a6e0: 63 68 61 6e 67 65 73 65 74 73 0a 20 20 20 20 20 changesets.
a6f0: 20 20 20 20 20 20 20 41 4e 44 20 20 20 20 43 2e AND C.
a700: 63 69 64 20 3d 20 43 49 2e 63 69 64 09 20 20 20 cid = CI.cid.
a710: 2d 2d 20 63 6f 6e 74 61 69 6e 69 6e 67 20 74 68 -- containing th
a720: 65 20 74 61 67 73 0a 20 20 20 20 20 20 20 20 20 e tags.
a730: 20 20 20 41 4e 44 20 20 20 20 43 2e 74 79 70 65 AND C.type
a740: 20 3d 20 31 09 09 20 20 20 2d 2d 20 77 68 69 63 = 1.. -- whic
a750: 68 20 61 72 65 20 74 61 67 20 63 68 61 6e 67 65 h are tag change
a760: 73 65 74 73 0a 20 20 20 20 55 4e 49 4f 4e 0a 09 sets. UNION..
a770: 20 20 20 20 53 45 4c 45 43 54 20 43 2e 63 69 64 SELECT C.cid
a780: 0a 09 20 20 20 20 46 52 4f 4d 20 20 20 72 65 76 .. FROM rev
a790: 69 73 69 6f 6e 20 52 2c 20 62 72 61 6e 63 68 20 ision R, branch
a7a0: 42 2c 20 63 73 69 74 65 6d 20 43 49 2c 20 63 68 B, csitem CI, ch
a7b0: 61 6e 67 65 73 65 74 20 43 0a 09 20 20 20 20 57 angeset C.. W
a7c0: 48 45 52 45 20 20 52 2e 72 69 64 20 69 6e 20 24 HERE R.rid in $
a7d0: 74 68 65 73 65 74 20 20 20 20 20 20 20 20 2d 2d theset --
a7e0: 20 52 65 73 74 72 69 63 74 20 74 6f 20 72 65 76 Restrict to rev
a7f0: 69 73 69 6f 6e 73 20 6f 66 20 69 6e 74 65 72 65 isions of intere
a800: 73 74 0a 09 20 20 20 20 41 4e 44 20 20 20 20 42 st.. AND B
a810: 2e 72 6f 6f 74 20 3d 20 52 2e 72 69 64 09 20 20 .root = R.rid.
a820: 20 2d 2d 20 53 65 6c 65 63 74 20 62 72 61 6e 63 -- Select branc
a830: 68 65 73 20 61 74 74 61 63 68 65 64 20 74 6f 20 hes attached to
a840: 74 68 65 6d 0a 20 20 20 20 20 20 20 20 20 20 20 them.
a850: 20 41 4e 44 20 20 20 20 43 49 2e 69 69 64 20 3d AND CI.iid =
a860: 20 42 2e 62 69 64 20 20 20 20 20 20 20 20 20 20 B.bid
a870: 2d 2d 20 53 65 6c 65 63 74 20 61 6c 6c 20 63 68 -- Select all ch
a880: 61 6e 67 65 73 65 74 73 0a 20 20 20 20 20 20 20 angesets.
a890: 20 20 20 20 20 41 4e 44 20 20 20 20 43 2e 63 69 AND C.ci
a8a0: 64 20 3d 20 43 49 2e 63 69 64 09 20 20 20 2d 2d d = CI.cid. --
a8b0: 20 63 6f 6e 74 61 69 6e 69 6e 67 20 74 68 65 20 containing the
a8c0: 62 72 61 6e 63 68 65 73 0a 20 20 20 20 20 20 20 branches.
a8d0: 20 20 20 20 20 41 4e 44 20 20 20 20 43 2e 74 79 AND C.ty
a8e0: 70 65 20 3d 20 32 09 09 20 20 20 2d 2d 20 77 68 pe = 2.. -- wh
a8f0: 69 63 68 20 61 72 65 20 62 72 61 6e 63 68 20 63 ich are branch c
a900: 68 61 6e 67 65 73 65 74 73 0a 09 7d 5d 5d 0a 20 hangesets..}]].
a910: 20 20 20 7d 0a 0a 20 20 20 20 23 20 72 65 73 75 }.. # resu
a920: 6c 74 20 3d 20 73 79 6d 62 6f 6c 20 6e 61 6d 65 lt = symbol name
a930: 0a 20 20 20 20 74 79 70 65 6d 65 74 68 6f 64 20 . typemethod
a940: 63 73 5f 6c 6f 64 20 7b 72 65 76 69 73 69 6f 6e cs_lod {revision
a950: 73 7d 20 7b 0a 09 23 20 44 65 74 65 72 6d 69 6e s} {..# Determin
a960: 65 73 20 74 68 65 20 6e 61 6d 65 20 6f 66 20 74 es the name of t
a970: 68 65 20 73 79 6d 62 6f 6c 20 77 68 69 63 68 20 he symbol which
a980: 69 73 20 74 68 65 20 6c 69 6e 65 20 6f 66 0a 09 is the line of..
a990: 23 20 64 65 76 65 6c 6f 70 6d 65 6e 74 20 66 6f # development fo
a9a0: 72 20 74 68 65 20 72 65 76 69 73 69 6f 6e 73 20 r the revisions
a9b0: 69 6e 20 61 20 63 68 61 6e 67 65 73 65 74 2e 0a in a changeset..
a9c0: 0a 09 73 65 74 20 74 68 65 73 65 74 20 28 27 5b ..set theset ('[
a9d0: 6a 6f 69 6e 20 24 72 65 76 69 73 69 6f 6e 73 20 join $revisions
a9e0: 7b 27 2c 27 7d 5d 27 29 0a 09 72 65 74 75 72 6e {','}]')..return
a9f0: 20 5b 73 74 61 74 65 20 72 75 6e 20 5b 73 75 62 [state run [sub
aa00: 73 74 20 2d 6e 6f 63 6f 6d 6d 61 6e 64 73 20 2d st -nocommands -
aa10: 6e 6f 62 61 63 6b 73 6c 61 73 68 65 73 20 7b 0a nobackslashes {.
aa20: 09 20 20 20 20 53 45 4c 45 43 54 0a 09 20 20 20 . SELECT..
aa30: 20 44 49 53 54 49 4e 43 54 20 4c 2e 6e 61 6d 65 DISTINCT L.name
aa40: 0a 09 20 20 20 20 46 52 4f 4d 20 20 20 72 65 76 .. FROM rev
aa50: 69 73 69 6f 6e 20 52 2c 20 73 79 6d 62 6f 6c 20 ision R, symbol
aa60: 4c 0a 09 20 20 20 20 57 48 45 52 45 20 20 52 2e L.. WHERE R.
aa70: 72 69 64 20 69 6e 20 24 74 68 65 73 65 74 20 20 rid in $theset
aa80: 20 20 20 20 20 20 2d 2d 20 52 65 73 74 72 69 63 -- Restric
aa90: 74 20 74 6f 20 72 65 76 69 73 69 6f 6e 73 20 6f t to revisions o
aaa0: 66 20 69 6e 74 65 72 65 73 74 0a 09 20 20 20 20 f interest..
aab0: 41 4e 44 20 20 20 20 4c 2e 73 69 64 20 3d 20 52 AND L.sid = R
aac0: 2e 6c 6f 64 20 20 20 20 20 20 20 20 20 20 20 2d .lod -
aad0: 2d 20 47 65 74 20 6c 6f 64 20 73 79 6d 62 6f 6c - Get lod symbol
aae0: 20 6f 66 20 72 65 76 69 73 69 6f 6e 0a 09 7d 5d of revision..}]
aaf0: 5d 0a 20 20 20 20 7d 0a 7d 0a 0a 23 20 23 20 23 ]. }.}..# # #
ab00: 23 20 23 23 23 20 23 23 23 23 23 20 23 23 23 23 # ### ##### ####
ab10: 23 23 23 23 20 23 23 23 23 23 23 23 23 23 23 23 #### ###########
ab20: 23 23 20 23 23 23 23 23 23 23 23 23 23 23 23 23 ## #############
ab30: 23 23 23 23 23 23 23 23 0a 23 23 20 48 65 6c 70 ########.## Help
ab40: 65 72 20 73 69 6e 67 6c 65 74 6f 6e 2e 20 43 6f er singleton. Co
ab50: 6d 6d 61 6e 64 73 20 66 6f 72 20 74 61 67 20 73 mmands for tag s
ab60: 79 6d 62 6f 6c 20 63 68 61 6e 67 65 73 65 74 73 ymbol changesets
ab70: 2e 0a 0a 73 6e 69 74 3a 3a 74 79 70 65 20 3a 3a ...snit::type ::
ab80: 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f vc::fossil::impo
ab90: 72 74 3a 3a 63 76 73 3a 3a 70 72 6f 6a 65 63 74 rt::cvs::project
aba0: 3a 3a 72 65 76 3a 3a 73 79 6d 3a 3a 74 61 67 20 ::rev::sym::tag
abb0: 7b 0a 20 20 20 20 74 79 70 65 6d 65 74 68 6f 64 {. typemethod
abc0: 20 62 79 72 65 76 69 73 69 6f 6e 20 7b 7d 20 7b byrevision {} {
abd0: 20 72 65 74 75 72 6e 20 30 20 7d 0a 20 20 20 20 return 0 }.
abe0: 74 79 70 65 6d 65 74 68 6f 64 20 62 79 73 79 6d typemethod bysym
abf0: 62 6f 6c 20 20 20 7b 7d 20 7b 20 72 65 74 75 72 bol {} { retur
ac00: 6e 20 31 20 7d 0a 20 20 20 20 74 79 70 65 6d 65 n 1 }. typeme
ac10: 74 68 6f 64 20 69 73 74 61 67 20 20 20 20 20 20 thod istag
ac20: 7b 7d 20 7b 20 72 65 74 75 72 6e 20 31 20 7d 0a {} { return 1 }.
ac30: 20 20 20 20 74 79 70 65 6d 65 74 68 6f 64 20 69 typemethod i
ac40: 73 62 72 61 6e 63 68 20 20 20 7b 7d 20 7b 20 72 sbranch {} { r
ac50: 65 74 75 72 6e 20 30 20 7d 0a 0a 20 20 20 20 74 eturn 0 }.. t
ac60: 79 70 65 6d 65 74 68 6f 64 20 73 74 72 20 7b 74 ypemethod str {t
ac70: 61 67 7d 20 7b 0a 09 73 74 72 75 63 74 3a 3a 6c ag} {..struct::l
ac80: 69 73 74 20 61 73 73 69 67 6e 20 5b 73 74 61 74 ist assign [stat
ac90: 65 20 72 75 6e 20 7b 0a 09 20 20 20 20 53 45 4c e run {.. SEL
aca0: 45 43 54 20 53 2e 6e 61 6d 65 2c 20 46 2e 6e 61 ECT S.name, F.na
acb0: 6d 65 2c 20 50 2e 6e 61 6d 65 0a 09 20 20 20 20 me, P.name..
acc0: 46 52 4f 4d 20 20 20 74 61 67 20 54 2c 20 73 79 FROM tag T, sy
acd0: 6d 62 6f 6c 20 53 2c 20 66 69 6c 65 20 46 2c 20 mbol S, file F,
ace0: 70 72 6f 6a 65 63 74 20 50 0a 09 20 20 20 20 57 project P.. W
acf0: 48 45 52 45 20 20 54 2e 74 69 64 20 3d 20 24 74 HERE T.tid = $t
ad00: 61 67 20 20 20 2d 2d 20 46 69 6e 64 20 73 70 65 ag -- Find spe
ad10: 63 69 66 69 65 64 20 74 61 67 0a 09 20 20 20 20 cified tag..
ad20: 41 4e 44 20 20 20 20 46 2e 66 69 64 20 3d 20 54 AND F.fid = T
ad30: 2e 66 69 64 20 20 2d 2d 20 47 65 74 20 66 69 6c .fid -- Get fil
ad40: 65 20 6f 66 20 74 61 67 0a 09 20 20 20 20 41 4e e of tag.. AN
ad50: 44 20 20 20 20 50 2e 70 69 64 20 3d 20 46 2e 70 D P.pid = F.p
ad60: 69 64 20 20 2d 2d 20 47 65 74 20 70 72 6f 6a 65 id -- Get proje
ad70: 63 74 20 6f 66 20 66 69 6c 65 0a 09 20 20 20 20 ct of file..
ad80: 41 4e 44 20 20 20 20 53 2e 73 69 64 20 3d 20 54 AND S.sid = T
ad90: 2e 73 69 64 20 20 2d 2d 20 47 65 74 20 73 79 6d .sid -- Get sym
ada0: 62 6f 6c 20 6f 66 20 74 61 67 0a 09 7d 5d 20 73 bol of tag..}] s
adb0: 6e 61 6d 65 20 66 6e 61 6d 65 20 70 6e 61 6d 65 name fname pname
adc0: 0a 09 72 65 74 75 72 6e 20 22 24 70 6e 61 6d 65 ..return "$pname
add0: 2f 54 27 24 7b 73 6e 61 6d 65 7d 27 3a 3a 24 66 /T'${sname}'::$f
ade0: 6e 61 6d 65 22 0a 20 20 20 20 7d 0a 0a 20 20 20 name". }..
adf0: 20 23 20 72 65 73 75 6c 74 20 3d 20 6c 69 73 74 # result = list
ae00: 20 28 6d 69 6e 74 69 6d 65 2c 20 6d 61 78 74 69 (mintime, maxti
ae10: 6d 65 29 0a 20 20 20 20 74 79 70 65 6d 65 74 68 me). typemeth
ae20: 6f 64 20 74 69 6d 65 72 61 6e 67 65 20 7b 74 61 od timerange {ta
ae30: 67 73 7d 20 7b 0a 09 23 20 54 68 65 20 72 61 6e gs} {..# The ran
ae40: 67 65 20 69 73 20 64 65 66 69 6e 65 64 20 61 73 ge is defined as
ae50: 20 74 68 65 20 72 61 6e 67 65 20 6f 66 20 74 68 the range of th
ae60: 65 20 72 65 76 69 73 69 6f 6e 73 20 74 68 65 20 e revisions the
ae70: 74 61 67 73 0a 09 23 20 61 72 65 20 61 74 74 61 tags..# are atta
ae80: 63 68 65 64 20 74 6f 2e 0a 0a 09 73 65 74 20 74 ched to....set t
ae90: 68 65 73 65 74 20 28 27 5b 6a 6f 69 6e 20 24 74 heset ('[join $t
aea0: 61 67 73 20 7b 27 2c 27 7d 5d 27 29 0a 09 72 65 ags {','}]')..re
aeb0: 74 75 72 6e 20 5b 73 74 61 74 65 20 72 75 6e 20 turn [state run
aec0: 5b 73 75 62 73 74 20 2d 6e 6f 63 6f 6d 6d 61 6e [subst -nocomman
aed0: 64 73 20 2d 6e 6f 62 61 63 6b 73 6c 61 73 68 65 ds -nobackslashe
aee0: 73 20 7b 0a 09 20 20 20 20 53 45 4c 45 43 54 20 s {.. SELECT
aef0: 4d 49 4e 28 52 2e 64 61 74 65 29 2c 20 4d 41 58 MIN(R.date), MAX
af00: 28 52 2e 64 61 74 65 29 0a 09 20 20 20 20 46 52 (R.date).. FR
af10: 4f 4d 20 20 20 74 61 67 20 54 2c 20 72 65 76 69 OM tag T, revi
af20: 73 69 6f 6e 20 52 0a 09 20 20 20 20 57 48 45 52 sion R.. WHER
af30: 45 20 20 54 2e 74 69 64 20 49 4e 20 24 74 68 65 E T.tid IN $the
af40: 73 65 74 20 20 2d 2d 20 52 65 73 74 72 69 63 74 set -- Restrict
af50: 20 74 6f 20 74 61 67 73 20 6f 66 20 69 6e 74 65 to tags of inte
af60: 72 65 73 74 0a 20 20 20 20 20 20 20 20 20 20 20 rest.
af70: 20 41 4e 44 20 20 20 20 52 2e 72 69 64 20 3d 20 AND R.rid =
af80: 54 2e 72 65 76 20 20 20 20 20 2d 2d 20 53 65 6c T.rev -- Sel
af90: 65 63 74 20 74 61 67 20 70 61 72 65 6e 74 20 72 ect tag parent r
afa0: 65 76 69 73 69 6f 6e 73 0a 09 7d 5d 5d 0a 20 20 evisions..}]].
afb0: 20 20 7d 0a 0a 20 20 20 20 23 20 76 61 72 28 64 }.. # var(d
afc0: 76 29 20 3d 20 64 69 63 74 20 28 69 74 65 6d 20 v) = dict (item
afd0: 2d 3e 20 6c 69 73 74 20 28 69 74 65 6d 29 29 2c -> list (item)),
afe0: 20 69 74 65 6d 20 20 3d 20 6c 69 73 74 20 28 74 item = list (t
aff0: 79 70 65 20 69 64 29 0a 20 20 20 20 74 79 70 65 ype id). type
b000: 6d 65 74 68 6f 64 20 73 75 63 63 65 73 73 6f 72 method successor
b010: 73 20 7b 64 76 20 74 61 67 73 7d 20 7b 0a 09 23 s {dv tags} {..#
b020: 20 54 61 67 73 20 68 61 76 65 20 6e 6f 20 73 75 Tags have no su
b030: 63 63 65 73 73 6f 72 73 2e 0a 09 72 65 74 75 72 ccessors...retur
b040: 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 23 20 72 n. }.. # r
b050: 65 73 75 6c 74 20 3d 20 34 2d 6c 69 73 74 20 28 esult = 4-list (
b060: 69 74 65 6d 74 79 70 65 20 69 74 65 6d 69 64 20 itemtype itemid
b070: 6e 65 78 74 69 74 65 6d 74 79 70 65 20 6e 65 78 nextitemtype nex
b080: 74 69 74 65 6d 69 64 20 2e 2e 2e 29 0a 20 20 20 titemid ...).
b090: 20 74 79 70 65 6d 65 74 68 6f 64 20 6c 6f 6f 70 typemethod loop
b0a0: 73 20 7b 74 61 67 73 7d 20 7b 0a 09 23 20 54 61 s {tags} {..# Ta
b0b0: 67 73 20 68 61 76 65 20 6e 6f 20 73 75 63 63 65 gs have no succe
b0c0: 73 73 6f 72 73 2c 20 74 68 65 72 65 66 6f 72 65 ssors, therefore
b0d0: 20 63 61 6e 6e 6f 74 20 63 61 75 73 65 20 6c 6f cannot cause lo
b0e0: 6f 70 73 0a 09 72 65 74 75 72 6e 20 7b 7d 0a 20 ops..return {}.
b0f0: 20 20 20 7d 0a 0a 20 20 20 20 23 20 72 65 73 75 }.. # resu
b100: 6c 74 20 3d 20 6c 69 73 74 20 28 63 68 61 6e 67 lt = list (chang
b110: 65 73 65 74 2d 69 64 29 0a 20 20 20 20 74 79 70 eset-id). typ
b120: 65 6d 65 74 68 6f 64 20 63 73 5f 73 75 63 63 65 emethod cs_succe
b130: 73 73 6f 72 73 20 7b 74 61 67 73 7d 20 7b 0a 09 ssors {tags} {..
b140: 23 20 54 61 67 73 20 68 61 76 65 20 6e 6f 20 73 # Tags have no s
b150: 75 63 63 65 73 73 6f 72 73 2e 0a 09 72 65 74 75 uccessors...retu
b160: 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 23 20 rn. }.. #
b170: 72 65 73 75 6c 74 20 3d 20 73 79 6d 62 6f 6c 20 result = symbol
b180: 6e 61 6d 65 0a 20 20 20 20 74 79 70 65 6d 65 74 name. typemet
b190: 68 6f 64 20 63 73 5f 6c 6f 64 20 7b 74 61 67 73 hod cs_lod {tags
b1a0: 7d 20 7b 0a 09 23 20 44 65 74 65 72 6d 69 6e 65 } {..# Determine
b1b0: 73 20 74 68 65 20 6e 61 6d 65 20 6f 66 20 74 68 s the name of th
b1c0: 65 20 73 79 6d 62 6f 6c 20 77 68 69 63 68 20 69 e symbol which i
b1d0: 73 20 74 68 65 20 6c 69 6e 65 20 6f 66 0a 09 23 s the line of..#
b1e0: 20 64 65 76 65 6c 6f 70 6d 65 6e 74 20 66 6f 72 development for
b1f0: 20 74 68 65 20 74 61 67 73 20 69 6e 20 61 20 63 the tags in a c
b200: 68 61 6e 67 65 73 65 74 2e 0a 0a 09 73 65 74 20 hangeset....set
b210: 74 68 65 73 65 74 20 28 27 5b 6a 6f 69 6e 20 24 theset ('[join $
b220: 74 61 67 73 20 7b 27 2c 27 7d 5d 27 29 0a 09 72 tags {','}]')..r
b230: 65 74 75 72 6e 20 5b 73 74 61 74 65 20 72 75 6e eturn [state run
b240: 20 5b 73 75 62 73 74 20 2d 6e 6f 63 6f 6d 6d 61 [subst -nocomma
b250: 6e 64 73 20 2d 6e 6f 62 61 63 6b 73 6c 61 73 68 nds -nobackslash
b260: 65 73 20 7b 0a 09 20 20 20 20 53 45 4c 45 43 54 es {.. SELECT
b270: 0a 09 20 20 20 20 44 49 53 54 49 4e 43 54 20 4c .. DISTINCT L
b280: 2e 6e 61 6d 65 0a 09 20 20 20 20 46 52 4f 4d 20 .name.. FROM
b290: 20 20 74 61 67 20 54 2c 20 73 79 6d 62 6f 6c 20 tag T, symbol
b2a0: 4c 0a 09 20 20 20 20 57 48 45 52 45 20 20 54 2e L.. WHERE T.
b2b0: 74 69 64 20 69 6e 20 24 74 68 65 73 65 74 20 20 tid in $theset
b2c0: 20 20 20 20 20 20 2d 2d 20 52 65 73 74 72 69 63 -- Restric
b2d0: 74 20 74 6f 20 74 61 67 73 20 6f 66 20 69 6e 74 t to tags of int
b2e0: 65 72 65 73 74 0a 09 20 20 20 20 41 4e 44 20 20 erest.. AND
b2f0: 20 20 4c 2e 73 69 64 20 3d 20 54 2e 6c 6f 64 20 L.sid = T.lod
b300: 20 20 20 20 20 20 20 20 20 20 2d 2d 20 47 65 74 -- Get
b310: 20 6c 6f 64 20 73 79 6d 62 6f 6c 20 6f 66 20 74 lod symbol of t
b320: 61 67 0a 09 7d 5d 5d 0a 20 20 20 20 7d 0a 7d 0a ag..}]]. }.}.
b330: 0a 23 20 23 20 23 23 20 23 23 23 20 23 23 23 23 .# # ## ### ####
b340: 23 20 23 23 23 23 23 23 23 23 20 23 23 23 23 23 # ######## #####
b350: 23 23 23 23 23 23 23 23 20 23 23 23 23 23 23 23 ######## #######
b360: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 0a 23 ##############.#
b370: 23 20 48 65 6c 70 65 72 20 73 69 6e 67 6c 65 74 # Helper singlet
b380: 6f 6e 2e 20 43 6f 6d 6d 61 6e 64 73 20 66 6f 72 on. Commands for
b390: 20 62 72 61 6e 63 68 20 73 79 6d 62 6f 6c 20 63 branch symbol c
b3a0: 68 61 6e 67 65 73 65 74 73 2e 0a 0a 73 6e 69 74 hangesets...snit
b3b0: 3a 3a 74 79 70 65 20 3a 3a 76 63 3a 3a 66 6f 73 ::type ::vc::fos
b3c0: 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 sil::import::cvs
b3d0: 3a 3a 70 72 6f 6a 65 63 74 3a 3a 72 65 76 3a 3a ::project::rev::
b3e0: 73 79 6d 3a 3a 62 72 61 6e 63 68 20 7b 0a 20 20 sym::branch {.
b3f0: 20 20 74 79 70 65 6d 65 74 68 6f 64 20 62 79 72 typemethod byr
b400: 65 76 69 73 69 6f 6e 20 7b 7d 20 7b 20 72 65 74 evision {} { ret
b410: 75 72 6e 20 30 20 7d 0a 20 20 20 20 74 79 70 65 urn 0 }. type
b420: 6d 65 74 68 6f 64 20 62 79 73 79 6d 62 6f 6c 20 method bysymbol
b430: 20 20 7b 7d 20 7b 20 72 65 74 75 72 6e 20 31 20 {} { return 1
b440: 7d 0a 20 20 20 20 74 79 70 65 6d 65 74 68 6f 64 }. typemethod
b450: 20 69 73 74 61 67 20 20 20 20 20 20 7b 7d 20 7b istag {} {
b460: 20 72 65 74 75 72 6e 20 30 20 7d 0a 20 20 20 20 return 0 }.
b470: 74 79 70 65 6d 65 74 68 6f 64 20 69 73 62 72 61 typemethod isbra
b480: 6e 63 68 20 20 20 7b 7d 20 7b 20 72 65 74 75 72 nch {} { retur
b490: 6e 20 31 20 7d 0a 0a 20 20 20 20 74 79 70 65 6d n 1 }.. typem
b4a0: 65 74 68 6f 64 20 73 74 72 20 7b 62 72 61 6e 63 ethod str {branc
b4b0: 68 7d 20 7b 0a 09 73 74 72 75 63 74 3a 3a 6c 69 h} {..struct::li
b4c0: 73 74 20 61 73 73 69 67 6e 20 5b 73 74 61 74 65 st assign [state
b4d0: 20 72 75 6e 20 7b 0a 09 20 20 20 20 53 45 4c 45 run {.. SELE
b4e0: 43 54 20 53 2e 6e 61 6d 65 2c 20 46 2e 6e 61 6d CT S.name, F.nam
b4f0: 65 2c 20 50 2e 6e 61 6d 65 0a 09 20 20 20 20 46 e, P.name.. F
b500: 52 4f 4d 20 20 20 62 72 61 6e 63 68 20 42 2c 20 ROM branch B,
b510: 73 79 6d 62 6f 6c 20 53 2c 20 66 69 6c 65 20 46 symbol S, file F
b520: 2c 20 70 72 6f 6a 65 63 74 20 50 0a 09 20 20 20 , project P..
b530: 20 57 48 45 52 45 20 20 42 2e 62 69 64 20 3d 20 WHERE B.bid =
b540: 24 62 72 61 6e 63 68 20 20 2d 2d 20 46 69 6e 64 $branch -- Find
b550: 20 73 70 65 63 69 66 69 65 64 20 62 72 61 6e 63 specified branc
b560: 68 0a 09 20 20 20 20 41 4e 44 20 20 20 20 46 2e h.. AND F.
b570: 66 69 64 20 3d 20 42 2e 66 69 64 20 20 20 20 2d fid = B.fid -
b580: 2d 20 47 65 74 20 66 69 6c 65 20 6f 66 20 62 72 - Get file of br
b590: 61 6e 63 68 0a 09 20 20 20 20 41 4e 44 20 20 20 anch.. AND
b5a0: 20 50 2e 70 69 64 20 3d 20 46 2e 70 69 64 20 20 P.pid = F.pid
b5b0: 20 20 2d 2d 20 47 65 74 20 70 72 6f 6a 65 63 74 -- Get project
b5c0: 20 6f 66 20 66 69 6c 65 0a 09 20 20 20 20 41 4e of file.. AN
b5d0: 44 20 20 20 20 53 2e 73 69 64 20 3d 20 42 2e 73 D S.sid = B.s
b5e0: 69 64 20 20 20 20 2d 2d 20 47 65 74 20 73 79 6d id -- Get sym
b5f0: 62 6f 6c 20 6f 66 20 62 72 61 6e 63 68 0a 09 7d bol of branch..}
b600: 5d 20 73 6e 61 6d 65 20 66 6e 61 6d 65 20 70 6e ] sname fname pn
b610: 61 6d 65 0a 09 72 65 74 75 72 6e 20 22 24 70 6e ame..return "$pn
b620: 61 6d 65 2f 42 27 24 7b 73 6e 61 6d 65 7d 27 3a ame/B'${sname}':
b630: 3a 24 66 6e 61 6d 65 22 0a 20 20 20 20 7d 0a 0a :$fname". }..
b640: 20 20 20 20 23 20 72 65 73 75 6c 74 20 3d 20 6c # result = l
b650: 69 73 74 20 28 6d 69 6e 74 69 6d 65 2c 20 6d 61 ist (mintime, ma
b660: 78 74 69 6d 65 29 0a 20 20 20 20 74 79 70 65 6d xtime). typem
b670: 65 74 68 6f 64 20 74 69 6d 65 72 61 6e 67 65 20 ethod timerange
b680: 7b 62 72 61 6e 63 68 65 73 7d 20 7b 0a 09 23 20 {branches} {..#
b690: 54 68 65 20 72 61 6e 67 65 20 6f 66 20 61 20 62 The range of a b
b6a0: 72 61 6e 63 68 20 69 73 20 64 65 66 69 6e 65 64 ranch is defined
b6b0: 20 61 73 20 74 68 65 20 72 61 6e 67 65 20 6f 66 as the range of
b6c0: 20 74 68 65 0a 09 23 20 72 65 76 69 73 69 6f 6e the..# revision
b6d0: 73 20 74 68 65 20 62 72 61 6e 63 68 65 73 20 61 s the branches a
b6e0: 72 65 20 73 70 61 77 6e 65 64 20 62 79 2e 20 4e re spawned by. N
b6f0: 4f 54 45 20 68 6f 77 65 76 65 72 20 74 68 61 74 OTE however that
b700: 20 74 68 65 0a 09 23 20 62 72 61 6e 63 68 65 73 the..# branches
b710: 20 61 73 73 6f 63 69 61 74 65 64 20 77 69 74 68 associated with
b720: 20 61 20 64 65 74 61 63 68 65 64 20 4e 54 44 42 a detached NTDB
b730: 20 77 69 6c 6c 20 68 61 76 65 20 6e 6f 20 72 6f will have no ro
b740: 6f 74 0a 09 23 20 73 70 61 77 6e 69 6e 67 20 74 ot..# spawning t
b750: 68 65 6d 2c 20 68 65 6e 63 65 20 74 68 65 79 20 hem, hence they
b760: 68 61 76 65 20 6e 6f 20 72 65 61 6c 20 74 69 6d have no real tim
b770: 65 72 61 6e 67 65 20 61 6e 79 0a 09 23 20 6c 6f erange any..# lo
b780: 6e 67 65 72 2e 20 42 79 20 75 73 69 6e 67 20 30 nger. By using 0
b790: 20 77 65 20 70 75 74 20 74 68 65 6d 20 69 6e 20 we put them in
b7a0: 66 72 6f 6e 74 20 6f 66 20 65 76 65 72 79 74 68 front of everyth
b7b0: 69 6e 67 20 65 6c 73 65 2c 0a 09 23 20 61 73 20 ing else,..# as
b7c0: 74 68 65 79 20 6c 6f 67 69 63 61 6c 6c 79 20 61 they logically a
b7d0: 72 65 2e 0a 0a 09 73 65 74 20 74 68 65 73 65 74 re....set theset
b7e0: 20 28 27 5b 6a 6f 69 6e 20 24 62 72 61 6e 63 68 ('[join $branch
b7f0: 65 73 20 7b 27 2c 27 7d 5d 27 29 0a 09 72 65 74 es {','}]')..ret
b800: 75 72 6e 20 5b 73 74 61 74 65 20 72 75 6e 20 5b urn [state run [
b810: 73 75 62 73 74 20 2d 6e 6f 63 6f 6d 6d 61 6e 64 subst -nocommand
b820: 73 20 2d 6e 6f 62 61 63 6b 73 6c 61 73 68 65 73 s -nobackslashes
b830: 20 7b 0a 09 20 20 20 20 53 45 4c 45 43 54 20 49 {.. SELECT I
b840: 46 4e 55 4c 4c 28 4d 49 4e 28 52 2e 64 61 74 65 FNULL(MIN(R.date
b850: 29 2c 30 29 2c 20 49 46 4e 55 4c 4c 28 4d 41 58 ),0), IFNULL(MAX
b860: 28 52 2e 64 61 74 65 29 2c 30 29 0a 09 20 20 20 (R.date),0)..
b870: 20 46 52 4f 4d 20 20 62 72 61 6e 63 68 20 42 2c FROM branch B,
b880: 20 72 65 76 69 73 69 6f 6e 20 52 0a 09 20 20 20 revision R..
b890: 20 57 48 45 52 45 20 42 2e 62 69 64 20 49 4e 20 WHERE B.bid IN
b8a0: 24 74 68 65 73 65 74 20 20 20 2d 2d 20 52 65 73 $theset -- Res
b8b0: 74 72 69 63 74 20 74 6f 20 62 72 61 6e 63 68 65 trict to branche
b8c0: 73 20 6f 66 20 69 6e 74 65 72 65 73 74 0a 20 20 s of interest.
b8d0: 20 20 20 20 20 20 20 20 20 20 41 4e 44 20 20 20 AND
b8e0: 52 2e 72 69 64 20 3d 20 42 2e 72 6f 6f 74 20 20 R.rid = B.root
b8f0: 20 20 20 2d 2d 20 53 65 6c 65 63 74 20 62 72 61 -- Select bra
b900: 6e 63 68 20 70 61 72 65 6e 74 20 72 65 76 69 73 nch parent revis
b910: 69 6f 6e 73 0a 09 7d 5d 5d 0a 20 20 20 20 7d 0a ions..}]]. }.
b920: 0a 20 20 20 20 23 20 72 65 73 75 6c 74 20 3d 20 . # result =
b930: 34 2d 6c 69 73 74 20 28 69 74 65 6d 74 79 70 65 4-list (itemtype
b940: 20 69 74 65 6d 69 64 20 6e 65 78 74 69 74 65 6d itemid nextitem
b950: 74 79 70 65 20 6e 65 78 74 69 74 65 6d 69 64 20 type nextitemid
b960: 2e 2e 2e 29 0a 20 20 20 20 74 79 70 65 6d 65 74 ...). typemet
b970: 68 6f 64 20 6c 6f 6f 70 73 20 7b 62 72 61 6e 63 hod loops {branc
b980: 68 65 73 7d 20 7b 0a 09 23 20 4e 6f 74 65 3a 20 hes} {..# Note:
b990: 52 65 76 69 73 69 6f 6e 73 20 61 6e 64 20 74 61 Revisions and ta
b9a0: 67 73 20 63 61 6e 6e 6f 74 20 63 61 75 73 65 20 gs cannot cause
b9b0: 74 68 65 20 6c 6f 6f 70 2e 20 42 65 69 6e 67 20 the loop. Being
b9c0: 6f 66 20 61 0a 09 23 20 66 75 6e 64 61 6d 65 6e of a..# fundamen
b9d0: 74 61 6c 6c 79 20 64 69 66 66 65 72 65 6e 74 20 tally different
b9e0: 74 79 70 65 20 74 68 65 79 20 63 61 6e 6e 6f 74 type they cannot
b9f0: 20 62 65 20 69 6e 20 74 68 65 20 69 6e 63 6f 6d be in the incom
ba00: 69 6e 67 0a 09 23 20 73 65 74 20 6f 66 20 69 64 ing..# set of id
ba10: 73 2e 0a 0a 09 73 65 74 20 74 68 65 73 65 74 20 s....set theset
ba20: 28 27 5b 6a 6f 69 6e 20 24 62 72 61 6e 63 68 65 ('[join $branche
ba30: 73 20 7b 27 2c 27 7d 5d 27 29 0a 09 72 65 74 75 s {','}]')..retu
ba40: 72 6e 20 5b 73 74 61 74 65 20 72 75 6e 20 5b 73 rn [state run [s
ba50: 75 62 73 74 20 2d 6e 6f 63 6f 6d 6d 61 6e 64 73 ubst -nocommands
ba60: 20 2d 6e 6f 62 61 63 6b 73 6c 61 73 68 65 73 20 -nobackslashes
ba70: 7b 0a 09 20 20 20 20 53 45 4c 45 43 54 20 42 2e {.. SELECT B.
ba80: 62 69 64 2c 20 42 58 2e 62 69 64 0a 09 20 20 20 bid, BX.bid..
ba90: 20 46 52 4f 4d 20 20 20 62 72 61 6e 63 68 20 42 FROM branch B
baa0: 2c 20 70 72 65 66 65 72 65 64 70 61 72 65 6e 74 , preferedparent
bab0: 20 50 2c 20 62 72 61 6e 63 68 20 42 58 0a 09 20 P, branch BX..
bac0: 20 20 20 57 48 45 52 45 20 20 42 2e 62 69 64 20 WHERE B.bid
bad0: 49 4e 20 24 74 68 65 73 65 74 20 20 20 2d 2d 20 IN $theset --
bae0: 52 65 73 74 72 69 63 74 20 74 6f 20 62 72 61 6e Restrict to bran
baf0: 63 68 65 73 20 6f 66 20 69 6e 74 65 72 65 73 74 ches of interest
bb00: 0a 09 20 20 20 20 41 4e 44 20 20 20 20 42 2e 73 .. AND B.s
bb10: 69 64 20 3d 20 50 2e 70 69 64 20 20 20 20 20 20 id = P.pid
bb20: 2d 2d 20 47 65 74 20 74 68 65 20 70 72 65 66 65 -- Get the prefe
bb30: 72 65 64 20 62 72 61 6e 63 68 65 73 20 76 69 61 red branches via
bb40: 0a 09 20 20 20 20 41 4e 44 20 20 20 20 42 58 2e .. AND BX.
bb50: 73 69 64 20 3d 20 50 2e 73 69 64 20 20 20 20 20 sid = P.sid
bb60: 2d 2d 20 74 68 65 20 62 72 61 6e 63 68 20 73 79 -- the branch sy
bb70: 6d 62 6f 6c 73 0a 09 20 20 20 20 41 4e 44 20 20 mbols.. AND
bb80: 20 20 42 58 2e 62 69 64 20 49 4e 20 24 74 68 65 BX.bid IN $the
bb90: 73 65 74 20 20 2d 2d 20 4c 6f 6f 70 0a 09 7d 5d set -- Loop..}]
bba0: 5d 0a 20 20 20 20 7d 0a 0a 20 20 20 20 23 20 76 ]. }.. # v
bbb0: 61 72 28 64 76 29 20 3d 20 64 69 63 74 20 28 69 ar(dv) = dict (i
bbc0: 74 65 6d 20 2d 3e 20 6c 69 73 74 20 28 69 74 65 tem -> list (ite
bbd0: 6d 29 29 2c 20 69 74 65 6d 20 20 3d 20 6c 69 73 m)), item = lis
bbe0: 74 20 28 74 79 70 65 20 69 64 29 0a 20 20 20 20 t (type id).
bbf0: 74 79 70 65 6d 65 74 68 6f 64 20 73 75 63 63 65 typemethod succe
bc00: 73 73 6f 72 73 20 7b 64 76 20 62 72 61 6e 63 68 ssors {dv branch
bc10: 65 73 7d 20 7b 0a 09 75 70 76 61 72 20 31 20 24 es} {..upvar 1 $
bc20: 64 76 20 64 65 70 65 6e 64 65 6e 63 69 65 73 0a dv dependencies.
bc30: 09 23 20 54 68 65 20 66 69 72 73 74 20 72 65 76 .# The first rev
bc40: 69 73 69 6f 6e 20 63 6f 6d 6d 69 74 74 65 64 20 ision committed
bc50: 6f 6e 20 61 20 62 72 61 6e 63 68 2c 20 61 6e 64 on a branch, and
bc60: 20 61 6c 6c 20 62 72 61 6e 63 68 65 73 0a 09 23 all branches..#
bc70: 20 61 6e 64 20 74 61 67 73 20 77 68 69 63 68 20 and tags which
bc80: 68 61 76 65 20 69 74 20 61 73 20 74 68 65 69 72 have it as their
bc90: 20 70 72 65 66 65 72 65 64 20 70 61 72 65 6e 74 prefered parent
bca0: 20 61 72 65 20 74 68 65 0a 09 23 20 73 75 63 63 are the..# succ
bcb0: 65 73 73 6f 72 73 20 6f 66 20 61 20 62 72 61 6e essors of a bran
bcc0: 63 68 2e 0a 0a 09 73 65 74 20 74 68 65 73 65 74 ch....set theset
bcd0: 20 28 27 5b 6a 6f 69 6e 20 24 62 72 61 6e 63 68 ('[join $branch
bce0: 65 73 20 7b 27 2c 27 7d 5d 27 29 0a 09 66 6f 72 es {','}]')..for
bcf0: 65 61 63 68 20 7b 62 69 64 20 63 68 69 6c 64 7d each {bid child}
bd00: 20 5b 73 74 61 74 65 20 72 75 6e 20 5b 73 75 62 [state run [sub
bd10: 73 74 20 2d 6e 6f 63 6f 6d 6d 61 6e 64 73 20 2d st -nocommands -
bd20: 6e 6f 62 61 63 6b 73 6c 61 73 68 65 73 20 7b 0a nobackslashes {.
bd30: 09 20 20 20 20 53 45 4c 45 43 54 20 42 2e 62 69 . SELECT B.bi
bd40: 64 2c 20 52 2e 72 69 64 0a 09 20 20 20 20 46 52 d, R.rid.. FR
bd50: 4f 4d 20 20 20 62 72 61 6e 63 68 20 42 2c 20 72 OM branch B, r
bd60: 65 76 69 73 69 6f 6e 20 52 0a 09 20 20 20 20 57 evision R.. W
bd70: 48 45 52 45 20 20 42 2e 62 69 64 20 49 4e 20 24 HERE B.bid IN $
bd80: 74 68 65 73 65 74 20 20 20 20 20 2d 2d 20 52 65 theset -- Re
bd90: 73 74 72 69 63 74 20 74 6f 20 62 72 61 6e 63 68 strict to branch
bda0: 65 73 20 6f 66 20 69 6e 74 65 72 65 73 74 0a 09 es of interest..
bdb0: 20 20 20 20 41 4e 44 20 20 20 20 42 2e 66 69 72 AND B.fir
bdc0: 73 74 20 3d 20 52 2e 72 69 64 20 20 20 20 20 20 st = R.rid
bdd0: 2d 2d 20 47 65 74 20 66 69 72 73 74 20 72 65 76 -- Get first rev
bde0: 69 73 69 6f 6e 20 6f 6e 20 74 68 65 20 62 72 61 ision on the bra
bdf0: 6e 63 68 0a 09 7d 5d 5d 20 7b 0a 09 20 20 20 20 nch..}]] {..
be00: 6c 61 70 70 65 6e 64 20 64 65 70 65 6e 64 65 6e lappend dependen
be10: 63 69 65 73 28 5b 6c 69 73 74 20 73 79 6d 3a 3a cies([list sym::
be20: 62 72 61 6e 63 68 20 24 62 69 64 5d 29 20 5b 6c branch $bid]) [l
be30: 69 73 74 20 72 65 76 20 24 63 68 69 6c 64 5d 0a ist rev $child].
be40: 09 7d 0a 09 66 6f 72 65 61 63 68 20 7b 62 69 64 .}..foreach {bid
be50: 20 63 68 69 6c 64 7d 20 5b 73 74 61 74 65 20 72 child} [state r
be60: 75 6e 20 5b 73 75 62 73 74 20 2d 6e 6f 63 6f 6d un [subst -nocom
be70: 6d 61 6e 64 73 20 2d 6e 6f 62 61 63 6b 73 6c 61 mands -nobacksla
be80: 73 68 65 73 20 7b 0a 09 20 20 20 20 53 45 4c 45 shes {.. SELE
be90: 43 54 20 42 2e 62 69 64 2c 20 42 58 2e 62 69 64 CT B.bid, BX.bid
bea0: 0a 09 20 20 20 20 46 52 4f 4d 20 20 20 62 72 61 .. FROM bra
beb0: 6e 63 68 20 42 2c 20 70 72 65 66 65 72 65 64 70 nch B, preferedp
bec0: 61 72 65 6e 74 20 50 2c 20 62 72 61 6e 63 68 20 arent P, branch
bed0: 42 58 0a 09 20 20 20 20 57 48 45 52 45 20 20 42 BX.. WHERE B
bee0: 2e 62 69 64 20 49 4e 20 24 74 68 65 73 65 74 20 .bid IN $theset
bef0: 20 20 20 20 2d 2d 20 52 65 73 74 72 69 63 74 20 -- Restrict
bf00: 74 6f 20 62 72 61 6e 63 68 65 73 20 6f 66 20 69 to branches of i
bf10: 6e 74 65 72 65 73 74 0a 09 20 20 20 20 41 4e 44 nterest.. AND
bf20: 20 20 20 20 42 2e 73 69 64 20 3d 20 50 2e 70 69 B.sid = P.pi
bf30: 64 20 20 20 20 20 20 20 20 2d 2d 20 47 65 74 20 d -- Get
bf40: 73 75 62 6f 72 64 69 6e 61 74 65 20 62 72 61 6e subordinate bran
bf50: 63 68 65 73 20 76 69 61 20 74 68 65 0a 09 20 20 ches via the..
bf60: 20 20 41 4e 44 20 20 20 20 42 58 2e 73 69 64 20 AND BX.sid
bf70: 3d 20 50 2e 73 69 64 20 20 20 20 20 20 20 2d 2d = P.sid --
bf80: 20 70 72 65 66 65 72 65 64 20 70 61 72 65 6e 74 prefered parent
bf90: 73 20 6f 66 20 74 68 65 69 72 20 73 79 6d 62 6f s of their symbo
bfa0: 6c 73 0a 09 7d 5d 5d 20 7b 0a 09 20 20 20 20 6c ls..}]] {.. l
bfb0: 61 70 70 65 6e 64 20 64 65 70 65 6e 64 65 6e 63 append dependenc
bfc0: 69 65 73 28 5b 6c 69 73 74 20 73 79 6d 3a 3a 62 ies([list sym::b
bfd0: 72 61 6e 63 68 20 24 62 69 64 5d 29 20 5b 6c 69 ranch $bid]) [li
bfe0: 73 74 20 73 79 6d 3a 3a 62 72 61 6e 63 68 20 24 st sym::branch $
bff0: 63 68 69 6c 64 5d 0a 09 7d 0a 09 66 6f 72 65 61 child]..}..forea
c000: 63 68 20 7b 62 69 64 20 63 68 69 6c 64 7d 20 5b ch {bid child} [
c010: 73 74 61 74 65 20 72 75 6e 20 5b 73 75 62 73 74 state run [subst
c020: 20 2d 6e 6f 63 6f 6d 6d 61 6e 64 73 20 2d 6e 6f -nocommands -no
c030: 62 61 63 6b 73 6c 61 73 68 65 73 20 7b 0a 09 20 backslashes {..
c040: 20 20 20 53 45 4c 45 43 54 20 42 2e 62 69 64 2c SELECT B.bid,
c050: 20 54 2e 74 69 64 0a 09 20 20 20 20 46 52 4f 4d T.tid.. FROM
c060: 20 20 20 62 72 61 6e 63 68 20 42 2c 20 70 72 65 branch B, pre
c070: 66 65 72 65 64 70 61 72 65 6e 74 20 50 2c 20 74 feredparent P, t
c080: 61 67 20 54 0a 09 20 20 20 20 57 48 45 52 45 20 ag T.. WHERE
c090: 20 42 2e 62 69 64 20 49 4e 20 24 74 68 65 73 65 B.bid IN $these
c0a0: 74 20 20 20 20 20 2d 2d 20 52 65 73 74 72 69 63 t -- Restric
c0b0: 74 20 74 6f 20 62 72 61 6e 63 68 65 73 20 6f 66 t to branches of
c0c0: 20 69 6e 74 65 72 65 73 74 0a 09 20 20 20 20 41 interest.. A
c0d0: 4e 44 20 20 20 20 42 2e 73 69 64 20 3d 20 50 2e ND B.sid = P.
c0e0: 70 69 64 20 20 20 20 20 20 20 20 2d 2d 20 47 65 pid -- Ge
c0f0: 74 20 73 75 62 6f 72 64 69 6e 61 74 65 20 74 61 t subordinate ta
c100: 67 73 20 76 69 61 20 74 68 65 0a 09 20 20 20 20 gs via the..
c110: 41 4e 44 20 20 20 20 54 2e 73 69 64 20 3d 20 50 AND T.sid = P
c120: 2e 73 69 64 20 20 20 20 20 20 20 20 2d 2d 20 70 .sid -- p
c130: 72 65 66 65 72 65 64 20 70 61 72 65 6e 74 73 20 refered parents
c140: 6f 66 20 74 68 65 69 72 20 73 79 6d 62 6f 6c 73 of their symbols
c150: 0a 09 7d 5d 5d 20 7b 0a 09 20 20 20 20 6c 61 70 ..}]] {.. lap
c160: 70 65 6e 64 20 64 65 70 65 6e 64 65 6e 63 69 65 pend dependencie
c170: 73 28 5b 6c 69 73 74 20 73 79 6d 3a 3a 62 72 61 s([list sym::bra
c180: 6e 63 68 20 24 62 69 64 5d 29 20 5b 6c 69 73 74 nch $bid]) [list
c190: 20 73 79 6d 3a 3a 74 61 67 20 24 63 68 69 6c 64 sym::tag $child
c1a0: 5d 0a 09 7d 0a 09 72 65 74 75 72 6e 0a 20 20 20 ]..}..return.
c1b0: 20 7d 0a 0a 20 20 20 20 23 20 72 65 73 75 6c 74 }.. # result
c1c0: 20 3d 20 6c 69 73 74 20 28 63 68 61 6e 67 65 73 = list (changes
c1d0: 65 74 2d 69 64 29 0a 20 20 20 20 74 79 70 65 6d et-id). typem
c1e0: 65 74 68 6f 64 20 63 73 5f 73 75 63 63 65 73 73 ethod cs_success
c1f0: 6f 72 73 20 7b 62 72 61 6e 63 68 65 73 7d 20 7b ors {branches} {
c200: 0a 20 20 20 20 20 20 20 20 23 20 54 68 69 73 20 . # This
c210: 69 73 20 61 20 76 61 72 69 61 6e 74 20 6f 66 20 is a variant of
c220: 27 73 75 63 63 65 73 73 6f 72 73 27 20 77 68 69 'successors' whi
c230: 63 68 20 6d 61 70 73 20 74 68 65 20 6c 6f 77 2d ch maps the low-
c240: 6c 65 76 65 6c 0a 20 20 20 20 20 20 20 20 23 20 level. #
c250: 64 61 74 61 20 64 69 72 65 63 74 6c 79 20 74 6f data directly to
c260: 20 74 68 65 20 61 73 73 6f 63 69 61 74 65 64 20 the associated
c270: 63 68 61 6e 67 65 73 65 74 73 2e 20 49 2e 65 2e changesets. I.e.
c280: 20 69 6e 73 74 65 61 64 0a 20 20 20 20 20 20 20 instead.
c290: 20 23 20 6d 69 6c 6c 69 6f 6e 73 20 6f 66 20 64 # millions of d
c2a0: 65 70 65 6e 64 65 6e 63 79 20 70 61 69 72 73 20 ependency pairs
c2b0: 28 69 6e 20 65 78 74 72 65 6d 65 20 63 61 73 65 (in extreme case
c2c0: 73 20 28 45 78 61 6d 70 6c 65 3a 20 54 63 6c 0a s (Example: Tcl.
c2d0: 20 20 20 20 20 20 20 20 23 20 43 56 53 29 29 20 # CVS))
c2e0: 77 65 20 72 65 74 75 72 6e 20 61 20 76 65 72 79 we return a very
c2f0: 20 73 68 6f 72 74 20 61 6e 64 20 6d 75 63 68 20 short and much
c300: 6d 6f 72 65 20 6d 61 6e 61 67 65 61 62 6c 65 20 more manageable
c310: 6c 69 73 74 0a 20 20 20 20 20 20 20 20 23 20 6f list. # o
c320: 66 20 63 68 61 6e 67 65 73 65 74 73 2e 0a 0a 09 f changesets....
c330: 73 65 74 20 74 68 65 73 65 74 20 28 27 5b 6a 6f set theset ('[jo
c340: 69 6e 20 24 62 72 61 6e 63 68 65 73 20 7b 27 2c in $branches {',
c350: 27 7d 5d 27 29 0a 20 20 20 20 20 20 20 20 72 65 '}]'). re
c360: 74 75 72 6e 20 5b 73 74 61 74 65 20 72 75 6e 20 turn [state run
c370: 5b 73 75 62 73 74 20 2d 6e 6f 63 6f 6d 6d 61 6e [subst -nocomman
c380: 64 73 20 2d 6e 6f 62 61 63 6b 73 6c 61 73 68 65 ds -nobackslashe
c390: 73 20 7b 0a 09 20 20 20 20 53 45 4c 45 43 54 20 s {.. SELECT
c3a0: 43 2e 63 69 64 0a 09 20 20 20 20 46 52 4f 4d 20 C.cid.. FROM
c3b0: 20 20 62 72 61 6e 63 68 20 42 2c 20 72 65 76 69 branch B, revi
c3c0: 73 69 6f 6e 20 52 2c 20 63 73 69 74 65 6d 20 43 sion R, csitem C
c3d0: 49 2c 20 63 68 61 6e 67 65 73 65 74 20 43 0a 09 I, changeset C..
c3e0: 20 20 20 20 57 48 45 52 45 20 20 42 2e 62 69 64 WHERE B.bid
c3f0: 20 49 4e 20 24 74 68 65 73 65 74 20 20 20 20 20 IN $theset
c400: 2d 2d 20 52 65 73 74 72 69 63 74 20 74 6f 20 62 -- Restrict to b
c410: 72 61 6e 63 68 65 73 20 6f 66 20 69 6e 74 65 72 ranches of inter
c420: 65 73 74 0a 09 20 20 20 20 41 4e 44 20 20 20 20 est.. AND
c430: 42 2e 66 69 72 73 74 20 3d 20 52 2e 72 69 64 09 B.first = R.rid.
c440: 2d 2d 20 47 65 74 20 66 69 72 73 74 20 72 65 76 -- Get first rev
c450: 69 73 69 6f 6e 20 6f 6e 20 74 68 65 20 62 72 61 ision on the bra
c460: 6e 63 68 0a 20 20 20 20 20 20 20 20 20 20 20 20 nch.
c470: 41 4e 44 20 20 20 20 43 49 2e 69 69 64 20 3d 20 AND CI.iid =
c480: 52 2e 72 69 64 20 20 20 20 20 20 20 2d 2d 20 53 R.rid -- S
c490: 65 6c 65 63 74 20 61 6c 6c 20 63 68 61 6e 67 65 elect all change
c4a0: 73 65 74 73 0a 20 20 20 20 20 20 20 20 20 20 20 sets.
c4b0: 20 41 4e 44 20 20 20 20 43 2e 63 69 64 20 3d 20 AND C.cid =
c4c0: 43 49 2e 63 69 64 09 2d 2d 20 63 6f 6e 74 61 69 CI.cid.-- contai
c4d0: 6e 69 6e 67 20 74 68 69 73 20 72 65 76 69 73 69 ning this revisi
c4e0: 6f 6e 0a 20 20 20 20 20 20 20 20 20 20 20 20 41 on. A
c4f0: 4e 44 20 20 20 20 43 2e 74 79 70 65 20 3d 20 30 ND C.type = 0
c500: 09 09 2d 2d 20 77 68 69 63 68 20 61 72 65 20 72 ..-- which are r
c510: 65 76 69 73 69 6f 6e 20 63 68 61 6e 67 65 73 65 evision changese
c520: 74 73 0a 20 20 20 20 55 4e 49 4f 4e 0a 09 20 20 ts. UNION..
c530: 20 20 53 45 4c 45 43 54 20 43 2e 63 69 64 0a 09 SELECT C.cid..
c540: 20 20 20 20 46 52 4f 4d 20 20 20 62 72 61 6e 63 FROM branc
c550: 68 20 42 2c 20 70 72 65 66 65 72 65 64 70 61 72 h B, preferedpar
c560: 65 6e 74 20 50 2c 20 62 72 61 6e 63 68 20 42 58 ent P, branch BX
c570: 2c 20 63 73 69 74 65 6d 20 43 49 2c 20 63 68 61 , csitem CI, cha
c580: 6e 67 65 73 65 74 20 43 0a 09 20 20 20 20 57 48 ngeset C.. WH
c590: 45 52 45 20 20 42 2e 62 69 64 20 49 4e 20 24 74 ERE B.bid IN $t
c5a0: 68 65 73 65 74 20 20 20 20 20 2d 2d 20 52 65 73 heset -- Res
c5b0: 74 72 69 63 74 20 74 6f 20 62 72 61 6e 63 68 65 trict to branche
c5c0: 73 20 6f 66 20 69 6e 74 65 72 65 73 74 0a 09 20 s of interest..
c5d0: 20 20 20 41 4e 44 20 20 20 20 42 2e 73 69 64 20 AND B.sid
c5e0: 3d 20 50 2e 70 69 64 09 2d 2d 20 47 65 74 20 73 = P.pid.-- Get s
c5f0: 75 62 6f 72 64 69 6e 61 74 65 20 62 72 61 6e 63 ubordinate branc
c600: 68 65 73 20 76 69 61 20 74 68 65 0a 09 20 20 20 hes via the..
c610: 20 41 4e 44 20 20 20 20 42 58 2e 73 69 64 20 3d AND BX.sid =
c620: 20 50 2e 73 69 64 09 2d 2d 20 70 72 65 66 65 72 P.sid.-- prefer
c630: 65 64 20 70 61 72 65 6e 74 73 20 6f 66 20 74 68 ed parents of th
c640: 65 69 72 20 73 79 6d 62 6f 6c 73 0a 20 20 20 20 eir symbols.
c650: 20 20 20 20 20 20 20 20 41 4e 44 20 20 20 20 43 AND C
c660: 49 2e 69 69 64 20 3d 20 42 58 2e 62 69 64 20 20 I.iid = BX.bid
c670: 20 20 20 20 2d 2d 20 53 65 6c 65 63 74 20 61 6c -- Select al
c680: 6c 20 63 68 61 6e 67 65 73 65 74 73 0a 20 20 20 l changesets.
c690: 20 20 20 20 20 20 20 20 20 41 4e 44 20 20 20 20 AND
c6a0: 43 2e 63 69 64 20 3d 20 43 49 2e 63 69 64 09 2d C.cid = CI.cid.-
c6b0: 2d 20 63 6f 6e 74 61 69 6e 69 6e 67 20 74 68 65 - containing the
c6c0: 20 73 75 62 6f 72 64 69 6e 61 74 65 20 62 72 61 subordinate bra
c6d0: 6e 63 68 65 73 0a 20 20 20 20 20 20 20 20 20 20 nches.
c6e0: 20 20 41 4e 44 20 20 20 20 43 2e 74 79 70 65 20 AND C.type
c6f0: 3d 20 32 09 09 2d 2d 20 77 68 69 63 68 20 61 72 = 2..-- which ar
c700: 65 20 62 72 61 6e 63 68 20 63 68 61 6e 67 65 73 e branch changes
c710: 65 74 73 0a 20 20 20 20 55 4e 49 4f 4e 0a 09 20 ets. UNION..
c720: 20 20 20 53 45 4c 45 43 54 20 43 2e 63 69 64 0a SELECT C.cid.
c730: 09 20 20 20 20 46 52 4f 4d 20 20 20 62 72 61 6e . FROM bran
c740: 63 68 20 42 2c 20 70 72 65 66 65 72 65 64 70 61 ch B, preferedpa
c750: 72 65 6e 74 20 50 2c 20 74 61 67 20 54 2c 20 63 rent P, tag T, c
c760: 73 69 74 65 6d 20 43 49 2c 20 63 68 61 6e 67 65 sitem CI, change
c770: 73 65 74 20 43 0a 09 20 20 20 20 57 48 45 52 45 set C.. WHERE
c780: 20 20 42 2e 62 69 64 20 49 4e 20 24 74 68 65 73 B.bid IN $thes
c790: 65 74 20 20 20 20 20 2d 2d 20 52 65 73 74 72 69 et -- Restri
c7a0: 63 74 20 74 6f 20 62 72 61 6e 63 68 65 73 20 6f ct to branches o
c7b0: 66 20 69 6e 74 65 72 65 73 74 0a 09 20 20 20 20 f interest..
c7c0: 41 4e 44 20 20 20 20 42 2e 73 69 64 20 3d 20 50 AND B.sid = P
c7d0: 2e 70 69 64 09 2d 2d 20 47 65 74 20 73 75 62 6f .pid.-- Get subo
c7e0: 72 64 69 6e 61 74 65 20 74 61 67 73 20 76 69 61 rdinate tags via
c7f0: 20 74 68 65 0a 09 20 20 20 20 41 4e 44 20 20 20 the.. AND
c800: 20 54 2e 73 69 64 20 3d 20 50 2e 73 69 64 09 2d T.sid = P.sid.-
c810: 2d 20 70 72 65 66 65 72 65 64 20 70 61 72 65 6e - prefered paren
c820: 74 73 20 6f 66 20 74 68 65 69 72 20 73 79 6d 62 ts of their symb
c830: 6f 6c 73 0a 20 20 20 20 20 20 20 20 20 20 20 20 ols.
c840: 41 4e 44 20 20 20 20 43 49 2e 69 69 64 20 3d 20 AND CI.iid =
c850: 54 2e 74 69 64 20 20 20 20 20 20 20 2d 2d 20 53 T.tid -- S
c860: 65 6c 65 63 74 20 61 6c 6c 20 63 68 61 6e 67 65 elect all change
c870: 73 65 74 73 0a 20 20 20 20 20 20 20 20 20 20 20 sets.
c880: 20 41 4e 44 20 20 20 20 43 2e 63 69 64 20 3d 20 AND C.cid =
c890: 43 49 2e 63 69 64 09 2d 2d 20 63 6f 6e 74 61 69 CI.cid.-- contai
c8a0: 6e 69 6e 67 20 74 68 65 20 73 75 62 6f 72 64 69 ning the subordi
c8b0: 6e 61 74 65 20 74 61 67 73 0a 20 20 20 20 20 20 nate tags.
c8c0: 20 20 20 20 20 20 41 4e 44 20 20 20 20 43 2e 74 AND C.t
c8d0: 79 70 65 20 3d 20 31 09 09 2d 2d 20 77 68 69 63 ype = 1..-- whic
c8e0: 68 20 61 72 65 20 74 61 67 20 63 68 61 6e 67 65 h are tag change
c8f0: 73 65 74 73 0a 09 7d 5d 5d 0a 09 72 65 74 75 72 sets..}]]..retur
c900: 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 23 20 72 n. }.. # r
c910: 65 73 75 6c 74 20 3d 20 73 79 6d 62 6f 6c 20 6e esult = symbol n
c920: 61 6d 65 0a 20 20 20 20 74 79 70 65 6d 65 74 68 ame. typemeth
c930: 6f 64 20 63 73 5f 6c 6f 64 20 7b 62 72 61 6e 63 od cs_lod {branc
c940: 68 65 73 7d 20 7b 0a 09 23 20 44 65 74 65 72 6d hes} {..# Determ
c950: 69 6e 65 73 20 74 68 65 20 6e 61 6d 65 20 6f 66 ines the name of
c960: 20 74 68 65 20 73 79 6d 62 6f 6c 20 77 68 69 63 the symbol whic
c970: 68 20 69 73 20 74 68 65 20 6c 69 6e 65 20 6f 66 h is the line of
c980: 0a 09 23 20 64 65 76 65 6c 6f 70 6d 65 6e 74 20 ..# development
c990: 66 6f 72 20 74 68 65 20 62 72 61 6e 63 68 65 73 for the branches
c9a0: 20 69 6e 20 61 20 63 68 61 6e 67 65 73 65 74 2e in a changeset.
c9b0: 0a 0a 09 73 65 74 20 74 68 65 73 65 74 20 28 27 ...set theset ('
c9c0: 5b 6a 6f 69 6e 20 24 62 72 61 6e 63 68 65 73 20 [join $branches
c9d0: 7b 27 2c 27 7d 5d 27 29 0a 09 72 65 74 75 72 6e {','}]')..return
c9e0: 20 5b 73 74 61 74 65 20 72 75 6e 20 5b 73 75 62 [state run [sub
c9f0: 73 74 20 2d 6e 6f 63 6f 6d 6d 61 6e 64 73 20 2d st -nocommands -
ca00: 6e 6f 62 61 63 6b 73 6c 61 73 68 65 73 20 7b 0a nobackslashes {.
ca10: 09 20 20 20 20 53 45 4c 45 43 54 0a 09 20 20 20 . SELECT..
ca20: 20 44 49 53 54 49 4e 43 54 20 4c 2e 6e 61 6d 65 DISTINCT L.name
ca30: 0a 09 20 20 20 20 46 52 4f 4d 20 20 20 62 72 61 .. FROM bra
ca40: 6e 63 68 20 42 2c 20 73 79 6d 62 6f 6c 20 4c 0a nch B, symbol L.
ca50: 09 20 20 20 20 57 48 45 52 45 20 20 42 2e 62 69 . WHERE B.bi
ca60: 64 20 69 6e 20 24 74 68 65 73 65 74 20 20 20 20 d in $theset
ca70: 20 20 20 20 2d 2d 20 52 65 73 74 72 69 63 74 20 -- Restrict
ca80: 74 6f 20 62 72 61 6e 63 68 65 73 20 6f 66 20 69 to branches of i
ca90: 6e 74 65 72 65 73 74 0a 09 20 20 20 20 41 4e 44 nterest.. AND
caa0: 20 20 20 20 4c 2e 73 69 64 20 3d 20 42 2e 6c 6f L.sid = B.lo
cab0: 64 20 20 20 20 20 20 20 20 20 20 20 2d 2d 20 47 d -- G
cac0: 65 74 20 6c 6f 64 20 73 79 6d 62 6f 6c 20 6f 66 et lod symbol of
cad0: 20 62 72 61 6e 63 68 0a 09 7d 5d 5d 0a 20 20 20 branch..}]].
cae0: 20 7d 0a 0a 20 20 20 20 74 79 70 65 6d 65 74 68 }.. typemeth
caf0: 6f 64 20 6c 69 6d 69 74 73 20 7b 62 72 61 6e 63 od limits {branc
cb00: 68 65 73 7d 20 7b 0a 09 23 20 4e 6f 74 65 73 2e hes} {..# Notes.
cb10: 20 54 68 69 73 20 6d 65 74 68 6f 64 20 65 78 69 This method exi
cb20: 73 74 73 20 6f 6e 6c 79 20 66 6f 72 20 62 72 61 sts only for bra
cb30: 6e 63 68 65 73 2e 20 49 74 20 69 73 20 6e 65 65 nches. It is nee
cb40: 64 65 64 20 74 6f 0a 09 23 20 67 65 74 20 64 65 ded to..# get de
cb50: 74 61 69 6c 65 64 20 69 6e 66 6f 72 6d 61 74 69 tailed informati
cb60: 6f 6e 20 61 62 6f 75 74 20 61 20 62 61 63 6b 77 on about a backw
cb70: 61 72 64 20 62 72 61 6e 63 68 2e 20 49 74 20 64 ard branch. It d
cb80: 6f 65 73 0a 09 23 20 6e 6f 74 20 61 70 70 6c 79 oes..# not apply
cb90: 20 74 6f 20 74 61 67 73 2c 20 6e 6f 72 20 72 65 to tags, nor re
cba0: 76 69 73 69 6f 6e 73 2e 20 54 68 65 20 71 75 65 visions. The que
cbb0: 72 69 65 73 20 63 61 6e 20 61 6c 73 6f 0a 09 23 ries can also..#
cbc0: 20 72 65 73 74 72 69 63 74 20 74 68 65 6d 73 65 restrict themse
cbd0: 6c 76 65 73 20 74 6f 20 74 68 65 20 72 65 76 69 lves to the revi
cbe0: 73 69 6f 6e 20 73 75 63 65 73 73 6f 72 73 2f 70 sion sucessors/p
cbf0: 72 65 64 65 63 65 73 73 6f 72 73 0a 09 23 20 6f redecessors..# o
cc00: 66 20 62 72 61 6e 63 68 65 73 2c 20 61 73 20 6f f branches, as o
cc10: 6e 6c 79 20 74 68 65 79 20 68 61 76 65 20 6f 72 nly they have or
cc20: 64 65 72 69 6e 67 20 64 61 74 61 20 61 6e 64 20 dering data and
cc30: 74 68 75 73 20 63 61 6e 0a 09 23 20 63 61 75 73 thus can..# caus
cc40: 65 20 74 68 65 20 62 61 63 6b 77 61 72 64 6e 65 e the backwardne
cc50: 73 73 2e 0a 0a 09 73 65 74 20 74 68 65 73 65 74 ss....set theset
cc60: 20 28 27 5b 6a 6f 69 6e 20 24 62 72 61 6e 63 68 ('[join $branch
cc70: 65 73 20 7b 27 2c 27 7d 5d 27 29 0a 0a 09 73 65 es {','}]')...se
cc80: 74 20 6d 61 78 70 20 5b 73 74 61 74 65 20 72 75 t maxp [state ru
cc90: 6e 20 5b 73 75 62 73 74 20 2d 6e 6f 63 6f 6d 6d n [subst -nocomm
cca0: 61 6e 64 73 20 2d 6e 6f 62 61 63 6b 73 6c 61 73 ands -nobackslas
ccb0: 68 65 73 20 7b 0a 09 20 20 20 20 2d 2d 20 6d 61 hes {.. -- ma
ccc0: 78 69 6d 61 6c 20 70 72 65 64 65 63 65 73 73 6f ximal predecesso
ccd0: 72 20 70 6f 73 69 74 69 6f 6e 20 70 65 72 20 62 r position per b
cce0: 72 61 6e 63 68 0a 09 20 20 20 20 53 45 4c 45 43 ranch.. SELEC
ccf0: 54 20 42 2e 62 69 64 2c 20 4d 41 58 20 28 43 4f T B.bid, MAX (CO
cd00: 2e 70 6f 73 29 0a 09 20 20 20 20 46 52 4f 4d 20 .pos).. FROM
cd10: 20 20 62 72 61 6e 63 68 20 42 2c 20 72 65 76 69 branch B, revi
cd20: 73 69 6f 6e 20 52 2c 20 63 73 69 74 65 6d 20 43 sion R, csitem C
cd30: 49 2c 20 63 68 61 6e 67 65 73 65 74 20 43 2c 20 I, changeset C,
cd40: 63 73 6f 72 64 65 72 20 43 4f 0a 09 20 20 20 20 csorder CO..
cd50: 57 48 45 52 45 20 20 42 2e 62 69 64 20 49 4e 20 WHERE B.bid IN
cd60: 24 74 68 65 73 65 74 20 20 20 20 20 2d 2d 20 52 $theset -- R
cd70: 65 73 74 72 69 63 74 20 74 6f 20 62 72 61 6e 63 estrict to branc
cd80: 68 65 73 20 6f 66 20 69 6e 74 65 72 65 73 74 0a hes of interest.
cd90: 09 20 20 20 20 41 4e 44 20 20 20 20 42 2e 72 6f . AND B.ro
cda0: 6f 74 20 3d 20 52 2e 72 69 64 20 20 20 20 20 20 ot = R.rid
cdb0: 20 2d 2d 20 47 65 74 20 62 72 61 6e 63 68 20 72 -- Get branch r
cdc0: 6f 6f 74 20 72 65 76 69 73 69 6f 6e 73 0a 09 20 oot revisions..
cdd0: 20 20 20 41 4e 44 20 20 20 20 43 49 2e 69 69 64 AND CI.iid
cde0: 20 3d 20 52 2e 72 69 64 20 20 20 20 20 20 20 2d = R.rid -
cdf0: 2d 20 47 65 74 20 63 68 61 6e 67 65 73 65 74 73 - Get changesets
ce00: 20 63 6f 6e 74 61 69 6e 69 6e 67 20 74 68 65 0a containing the.
ce10: 09 20 20 20 20 41 4e 44 20 20 20 20 43 2e 63 69 . AND C.ci
ce20: 64 20 3d 20 43 49 2e 63 69 64 20 20 20 20 20 20 d = CI.cid
ce30: 20 2d 2d 20 72 6f 6f 74 20 72 65 76 69 73 69 6f -- root revisio
ce40: 6e 73 2c 20 77 68 69 63 68 20 61 72 65 0a 09 20 ns, which are..
ce50: 20 20 20 41 4e 44 20 20 20 20 43 2e 74 79 70 65 AND C.type
ce60: 20 3d 20 30 20 20 20 20 20 20 20 20 20 20 20 2d = 0 -
ce70: 2d 20 72 65 76 69 73 69 6f 6e 20 63 68 61 6e 67 - revision chang
ce80: 65 73 65 74 73 0a 09 20 20 20 20 41 4e 44 20 20 esets.. AND
ce90: 20 20 43 4f 2e 63 69 64 20 3d 20 43 2e 63 69 64 CO.cid = C.cid
cea0: 20 20 20 20 20 20 20 2d 2d 20 47 65 74 20 74 68 -- Get th
ceb0: 65 69 72 20 74 6f 70 6f 6c 6f 67 69 63 61 6c 20 eir topological
cec0: 6f 72 64 65 72 69 6e 67 0a 09 20 20 20 20 47 52 ordering.. GR
ced0: 4f 55 50 20 42 59 20 42 2e 62 69 64 0a 09 7d 5d OUP BY B.bid..}]
cee0: 5d 0a 0a 09 73 65 74 20 6d 69 6e 73 20 5b 73 74 ]...set mins [st
cef0: 61 74 65 20 72 75 6e 20 5b 73 75 62 73 74 20 2d ate run [subst -
cf00: 6e 6f 63 6f 6d 6d 61 6e 64 73 20 2d 6e 6f 62 61 nocommands -noba
cf10: 63 6b 73 6c 61 73 68 65 73 20 7b 0a 09 20 20 20 ckslashes {..
cf20: 20 2d 2d 20 6d 69 6e 69 6d 61 6c 20 73 75 63 63 -- minimal succ
cf30: 65 73 73 6f 72 20 70 6f 73 69 74 69 6f 6e 20 70 essor position p
cf40: 65 72 20 62 72 61 6e 63 68 0a 09 20 20 20 20 53 er branch.. S
cf50: 45 4c 45 43 54 20 42 2e 62 69 64 2c 20 4d 49 4e ELECT B.bid, MIN
cf60: 20 28 43 4f 2e 70 6f 73 29 0a 09 20 20 20 20 46 (CO.pos).. F
cf70: 52 4f 4d 20 20 20 62 72 61 6e 63 68 20 42 2c 20 ROM branch B,
cf80: 72 65 76 69 73 69 6f 6e 20 52 2c 20 63 73 69 74 revision R, csit
cf90: 65 6d 20 43 49 2c 20 63 68 61 6e 67 65 73 65 74 em CI, changeset
cfa0: 20 43 2c 20 63 73 6f 72 64 65 72 20 43 4f 0a 09 C, csorder CO..
cfb0: 20 20 20 20 57 48 45 52 45 20 20 42 2e 62 69 64 WHERE B.bid
cfc0: 20 49 4e 20 24 74 68 65 73 65 74 20 20 20 20 20 IN $theset
cfd0: 2d 2d 20 52 65 73 74 72 69 63 74 20 74 6f 20 62 -- Restrict to b
cfe0: 72 61 6e 63 68 65 73 20 6f 66 20 69 6e 74 65 72 ranches of inter
cff0: 65 73 74 0a 09 20 20 20 20 41 4e 44 20 20 20 20 est.. AND
d000: 42 2e 66 69 72 73 74 20 3d 20 52 2e 72 69 64 20 B.first = R.rid
d010: 20 20 20 20 20 2d 2d 20 47 65 74 20 74 68 65 20 -- Get the
d020: 66 69 72 73 74 20 72 65 76 69 73 69 6f 6e 73 20 first revisions
d030: 6f 6e 20 74 68 65 20 62 72 61 6e 63 68 65 73 0a on the branches.
d040: 09 20 20 20 20 41 4e 44 20 20 20 20 43 49 2e 69 . AND CI.i
d050: 69 64 20 3d 20 52 2e 72 69 64 20 20 20 20 20 20 id = R.rid
d060: 20 2d 2d 20 47 65 74 20 63 68 61 6e 67 65 73 65 -- Get changese
d070: 74 73 20 63 6f 6e 74 61 69 6e 69 6e 67 20 74 68 ts containing th
d080: 65 0a 09 20 20 20 20 41 4e 44 20 20 20 20 43 2e e.. AND C.
d090: 63 69 64 20 3d 20 43 49 2e 63 69 64 09 2d 2d 20 cid = CI.cid.--
d0a0: 66 69 72 73 74 20 72 65 76 69 73 69 6f 6e 73 2c first revisions,
d0b0: 20 77 68 69 63 68 20 61 72 65 0a 09 20 20 20 20 which are..
d0c0: 41 4e 44 20 20 20 20 43 2e 74 79 70 65 20 3d 20 AND C.type =
d0d0: 30 09 09 2d 2d 20 72 65 76 69 73 69 6f 6e 20 63 0..-- revision c
d0e0: 68 61 6e 67 65 73 65 74 73 0a 09 20 20 20 20 41 hangesets.. A
d0f0: 4e 44 20 20 20 20 43 4f 2e 63 69 64 20 3d 20 43 ND CO.cid = C
d100: 2e 63 69 64 09 2d 2d 20 47 65 74 20 74 68 65 69 .cid.-- Get thei
d110: 72 20 74 6f 70 6f 6c 6f 67 69 63 61 6c 20 6f 72 r topological or
d120: 64 65 72 69 6e 67 0a 09 20 20 20 20 47 52 4f 55 dering.. GROU
d130: 50 20 42 59 20 42 2e 62 69 64 0a 09 7d 5d 5d 0a P BY B.bid..}]].
d140: 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 . return
d150: 5b 6c 69 73 74 20 24 6d 61 78 70 20 24 6d 69 6e [list $maxp $min
d160: 73 5d 0a 20 20 20 20 7d 0a 0a 20 20 20 20 23 20 s]. }.. #
d170: 23 20 23 23 20 23 23 23 20 23 23 23 23 23 20 23 # ## ### ##### #
d180: 23 23 23 23 23 23 23 20 23 23 23 23 23 23 23 23 ####### ########
d190: 23 23 23 23 23 0a 20 20 20 20 23 23 20 43 6f 6e #####. ## Con
d1a0: 66 69 67 75 72 61 74 69 6f 6e 0a 0a 20 20 20 20 figuration..
d1b0: 70 72 61 67 6d 61 20 2d 68 61 73 69 6e 73 74 61 pragma -hasinsta
d1c0: 6e 63 65 73 20 20 20 6e 6f 20 3b 20 23 20 73 69 nces no ; # si
d1d0: 6e 67 6c 65 74 6f 6e 0a 20 20 20 20 70 72 61 67 ngleton. prag
d1e0: 6d 61 20 2d 68 61 73 74 79 70 65 69 6e 66 6f 20 ma -hastypeinfo
d1f0: 20 20 20 6e 6f 20 3b 20 23 20 6e 6f 20 69 6e 74 no ; # no int
d200: 72 6f 73 70 65 63 74 69 6f 6e 0a 20 20 20 20 70 rospection. p
d210: 72 61 67 6d 61 20 2d 68 61 73 74 79 70 65 64 65 ragma -hastypede
d220: 73 74 72 6f 79 20 6e 6f 20 3b 20 23 20 69 6d 6d stroy no ; # imm
d230: 6f 72 74 61 6c 0a 7d 0a 0a 23 20 23 20 23 23 20 ortal.}..# # ##
d240: 23 23 23 20 23 23 23 23 23 20 23 23 23 23 23 23 ### ##### ######
d250: 23 23 20 23 23 23 23 23 23 23 23 23 23 23 23 23 ## #############
d260: 20 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ###############
d270: 23 23 23 23 23 23 0a 23 23 0a 0a 6e 61 6d 65 73 ######.##..names
d280: 70 61 63 65 20 65 76 61 6c 20 3a 3a 76 63 3a 3a pace eval ::vc::
d290: 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a fossil::import::
d2a0: 63 76 73 3a 3a 70 72 6f 6a 65 63 74 20 7b 0a 20 cvs::project {.
d2b0: 20 20 20 6e 61 6d 65 73 70 61 63 65 20 65 78 70 namespace exp
d2c0: 6f 72 74 20 72 65 76 0a 20 20 20 20 6e 61 6d 65 ort rev. name
d2d0: 73 70 61 63 65 20 65 76 61 6c 20 72 65 76 20 7b space eval rev {
d2e0: 0a 09 6e 61 6d 65 73 70 61 63 65 20 69 6d 70 6f ..namespace impo
d2f0: 72 74 20 3a 3a 76 63 3a 3a 66 6f 73 73 69 6c 3a rt ::vc::fossil:
d300: 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 73 74 :import::cvs::st
d310: 61 74 65 0a 09 6e 61 6d 65 73 70 61 63 65 20 69 ate..namespace i
d320: 6d 70 6f 72 74 20 3a 3a 76 63 3a 3a 66 6f 73 73 mport ::vc::foss
d330: 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a il::import::cvs:
d340: 3a 69 6e 74 65 67 72 69 74 79 0a 09 6e 61 6d 65 :integrity..name
d350: 73 70 61 63 65 20 69 6d 70 6f 72 74 20 3a 3a 76 space import ::v
d360: 63 3a 3a 74 6f 6f 6c 73 3a 3a 6d 69 73 63 3a 3a c::tools::misc::
d370: 2a 0a 09 6e 61 6d 65 73 70 61 63 65 20 69 6d 70 *..namespace imp
d380: 6f 72 74 20 3a 3a 76 63 3a 3a 74 6f 6f 6c 73 3a ort ::vc::tools:
d390: 3a 74 72 6f 75 62 6c 65 0a 09 6e 61 6d 65 73 70 :trouble..namesp
d3a0: 61 63 65 20 69 6d 70 6f 72 74 20 3a 3a 76 63 3a ace import ::vc:
d3b0: 3a 74 6f 6f 6c 73 3a 3a 6c 6f 67 0a 09 6c 6f 67 :tools::log..log
d3c0: 20 72 65 67 69 73 74 65 72 20 63 73 65 74 73 0a register csets.
d3d0: 0a 09 23 20 53 65 74 20 75 70 20 74 68 65 20 68 ..# Set up the h
d3e0: 65 6c 70 65 72 20 73 69 6e 67 6c 65 74 6f 6e 73 elper singletons
d3f0: 0a 09 6e 61 6d 65 73 70 61 63 65 20 65 76 61 6c ..namespace eval
d400: 20 72 65 76 20 7b 0a 09 20 20 20 20 6e 61 6d 65 rev {.. name
d410: 73 70 61 63 65 20 69 6d 70 6f 72 74 20 3a 3a 76 space import ::v
d420: 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 c::fossil::impor
d430: 74 3a 3a 63 76 73 3a 3a 73 74 61 74 65 0a 09 20 t::cvs::state..
d440: 20 20 20 6e 61 6d 65 73 70 61 63 65 20 69 6d 70 namespace imp
d450: 6f 72 74 20 3a 3a 76 63 3a 3a 66 6f 73 73 69 6c ort ::vc::fossil
d460: 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 69 ::import::cvs::i
d470: 6e 74 65 67 72 69 74 79 0a 09 7d 0a 09 6e 61 6d ntegrity..}..nam
d480: 65 73 70 61 63 65 20 65 76 61 6c 20 73 79 6d 3a espace eval sym:
d490: 3a 74 61 67 20 7b 0a 09 20 20 20 20 6e 61 6d 65 :tag {.. name
d4a0: 73 70 61 63 65 20 69 6d 70 6f 72 74 20 3a 3a 76 space import ::v
d4b0: 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 c::fossil::impor
d4c0: 74 3a 3a 63 76 73 3a 3a 73 74 61 74 65 0a 09 20 t::cvs::state..
d4d0: 20 20 20 6e 61 6d 65 73 70 61 63 65 20 69 6d 70 namespace imp
d4e0: 6f 72 74 20 3a 3a 76 63 3a 3a 66 6f 73 73 69 6c ort ::vc::fossil
d4f0: 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 69 ::import::cvs::i
d500: 6e 74 65 67 72 69 74 79 0a 09 7d 0a 09 6e 61 6d ntegrity..}..nam
d510: 65 73 70 61 63 65 20 65 76 61 6c 20 73 79 6d 3a espace eval sym:
d520: 3a 62 72 61 6e 63 68 20 7b 0a 09 20 20 20 20 6e :branch {.. n
d530: 61 6d 65 73 70 61 63 65 20 69 6d 70 6f 72 74 20 amespace import
d540: 3a 3a 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d ::vc::fossil::im
d550: 70 6f 72 74 3a 3a 63 76 73 3a 3a 73 74 61 74 65 port::cvs::state
d560: 0a 09 20 20 20 20 6e 61 6d 65 73 70 61 63 65 20 .. namespace
d570: 69 6d 70 6f 72 74 20 3a 3a 76 63 3a 3a 66 6f 73 import ::vc::fos
d580: 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 sil::import::cvs
d590: 3a 3a 69 6e 74 65 67 72 69 74 79 0a 09 7d 0a 20 ::integrity..}.
d5a0: 20 20 20 7d 0a 7d 0a 0a 23 20 23 20 23 23 20 23 }.}..# # ## #
d5b0: 23 23 20 23 23 23 23 23 20 23 23 23 23 23 23 23 ## ##### #######
d5c0: 23 20 23 23 23 23 23 23 23 23 23 23 23 23 23 20 # #############
d5d0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
d5e0: 23 23 23 23 23 0a 23 23 20 52 65 61 64 79 0a 0a #####.## Ready..
d5f0: 70 61 63 6b 61 67 65 20 70 72 6f 76 69 64 65 20 package provide
d600: 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f vc::fossil::impo
d610: 72 74 3a 3a 63 76 73 3a 3a 70 72 6f 6a 65 63 74 rt::cvs::project
d620: 3a 3a 72 65 76 20 31 2e 30 0a 72 65 74 75 72 6e ::rev 1.0.return
d630: 0a .