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 66 6f 72 65 61 63 68 20 69 69 64 20 24 ...foreach iid $
07c0: 69 74 65 6d 73 20 7b 20 6c 61 70 70 65 6e 64 20 items { lappend
07d0: 6d 79 74 69 74 65 6d 73 20 5b 6c 69 73 74 20 24 mytitems [list $
07e0: 63 73 74 79 70 65 20 24 69 69 64 5d 20 7d 0a 0a cstype $iid] }..
07f0: 09 23 20 4b 65 65 70 20 74 72 61 63 6b 20 6f 66 .# Keep track of
0800: 20 74 68 65 20 67 65 6e 65 72 61 74 65 64 20 63 the generated c
0810: 68 61 6e 67 65 73 65 74 73 20 61 6e 64 20 6f 66 hangesets and of
0820: 20 74 68 65 20 69 6e 76 65 72 73 65 0a 09 23 20 the inverse..#
0830: 6d 61 70 70 69 6e 67 20 66 72 6f 6d 20 69 74 65 mapping from ite
0840: 6d 73 20 74 6f 20 74 68 65 6d 2e 0a 09 6c 61 70 ms to them...lap
0850: 70 65 6e 64 20 6d 79 63 68 61 6e 67 65 73 65 74 pend mychangeset
0860: 73 20 20 20 24 73 65 6c 66 0a 09 6c 61 70 70 65 s $self..lappe
0870: 6e 64 20 6d 79 74 63 68 61 6e 67 65 73 65 74 73 nd mytchangesets
0880: 28 24 63 73 74 79 70 65 29 20 24 73 65 6c 66 0a ($cstype) $self.
0890: 09 73 65 74 20 20 20 20 20 6d 79 69 64 6d 61 70 .set myidmap
08a0: 28 24 6d 79 69 64 29 20 24 73 65 6c 66 0a 0a 09 ($myid) $self...
08b0: 4d 61 70 49 74 65 6d 73 20 24 63 73 74 79 70 65 MapItems $cstype
08c0: 20 24 69 74 65 6d 73 0a 09 72 65 74 75 72 6e 0a $items..return.
08d0: 20 20 20 20 7d 0a 0a 20 20 20 20 64 65 73 74 72 }.. destr
08e0: 75 63 74 6f 72 20 7b 0a 09 23 20 57 65 20 6d 61 uctor {..# We ma
08f0: 79 20 62 65 20 61 62 6c 65 20 74 6f 20 67 65 74 y be able to get
0900: 20 72 69 64 20 6f 66 20 74 68 69 73 20 65 6e 74 rid of this ent
0910: 69 72 65 6c 79 2c 20 61 74 20 6c 65 61 73 74 20 irely, at least
0920: 66 6f 72 0a 09 23 20 28 64 65 29 63 6f 6e 73 74 for..# (de)const
0930: 72 75 63 74 69 6f 6e 20 61 6e 64 20 70 61 73 73 ruction and pass
0940: 20 49 6e 69 74 43 53 65 74 73 2e 0a 0a 09 55 6e InitCSets....Un
0950: 6d 61 70 49 74 65 6d 73 20 24 6d 79 74 79 70 65 mapItems $mytype
0960: 20 24 6d 79 69 74 65 6d 73 0a 09 75 6e 73 65 74 $myitems..unset
0970: 20 6d 79 69 64 6d 61 70 28 24 6d 79 69 64 29 0a myidmap($myid).
0980: 0a 09 73 65 74 20 70 6f 73 20 20 20 20 20 20 20 ..set pos
0990: 20 20 20 20 20 20 20 20 20 20 20 20 20 5b 6c 73 [ls
09a0: 65 61 72 63 68 20 2d 65 78 61 63 74 20 24 6d 79 earch -exact $my
09b0: 63 68 61 6e 67 65 73 65 74 73 20 24 73 65 6c 66 changesets $self
09c0: 5d 0a 09 73 65 74 20 6d 79 63 68 61 6e 67 65 73 ]..set mychanges
09d0: 65 74 73 20 20 20 20 20 20 20 20 20 20 20 5b 6c ets [l
09e0: 72 65 70 6c 61 63 65 20 20 20 20 20 20 20 24 6d replace $m
09f0: 79 63 68 61 6e 67 65 73 65 74 73 20 24 70 6f 73 ychangesets $pos
0a00: 20 24 70 6f 73 5d 0a 09 73 65 74 20 70 6f 73 20 $pos]..set pos
0a10: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0a20: 20 20 20 5b 6c 73 65 61 72 63 68 20 2d 65 78 61 [lsearch -exa
0a30: 63 74 20 24 6d 79 74 63 68 61 6e 67 65 73 65 74 ct $mytchangeset
0a40: 73 28 24 6d 79 74 79 70 65 29 20 24 73 65 6c 66 s($mytype) $self
0a50: 5d 0a 09 73 65 74 20 6d 79 74 63 68 61 6e 67 65 ]..set mytchange
0a60: 73 65 74 73 28 24 6d 79 74 79 70 65 29 20 5b 6c sets($mytype) [l
0a70: 72 65 70 6c 61 63 65 20 20 20 20 20 20 20 24 6d replace $m
0a80: 79 74 63 68 61 6e 67 65 73 65 74 73 28 24 6d 79 ytchangesets($my
0a90: 74 79 70 65 29 20 24 70 6f 73 20 24 70 6f 73 5d type) $pos $pos]
0aa0: 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a ..return. }..
0ab0: 20 20 20 20 6d 65 74 68 6f 64 20 73 74 72 20 7b method str {
0ac0: 7d 20 7b 0a 09 73 65 74 20 73 74 72 20 20 20 20 } {..set str
0ad0: 22 3c 22 0a 09 73 65 74 20 64 65 74 61 69 6c 20 "<"..set detail
0ae0: 22 22 0a 09 69 66 20 7b 5b 24 6d 79 74 79 70 65 ""..if {[$mytype
0af0: 6f 62 6a 20 62 79 73 79 6d 62 6f 6c 5d 7d 20 7b obj bysymbol]} {
0b00: 0a 09 20 20 20 20 73 65 74 20 64 65 74 61 69 6c .. set detail
0b10: 20 22 20 27 5b 73 74 61 74 65 20 6f 6e 65 20 7b " '[state one {
0b20: 0a 09 09 53 45 4c 45 43 54 20 53 2e 6e 61 6d 65 ...SELECT S.name
0b30: 0a 09 09 46 52 4f 4d 20 20 20 73 79 6d 62 6f 6c ...FROM symbol
0b40: 20 53 0a 09 09 57 48 45 52 45 20 20 53 2e 73 69 S...WHERE S.si
0b50: 64 20 3d 20 24 6d 79 73 72 63 69 64 0a 09 20 20 d = $mysrcid..
0b60: 20 20 7d 5d 27 22 0a 09 7d 0a 09 61 70 70 65 6e }]'"..}..appen
0b70: 64 20 73 74 72 20 22 24 6d 79 74 79 70 65 20 24 d str "$mytype $
0b80: 7b 6d 79 69 64 7d 24 7b 64 65 74 61 69 6c 7d 3e {myid}${detail}>
0b90: 22 0a 09 72 65 74 75 72 6e 20 24 73 74 72 0a 20 "..return $str.
0ba0: 20 20 20 7d 0a 0a 20 20 20 20 6d 65 74 68 6f 64 }.. method
0bb0: 20 6c 6f 64 20 7b 7d 20 7b 0a 09 72 65 74 75 72 lod {} {..retur
0bc0: 6e 20 5b 24 6d 79 74 79 70 65 6f 62 6a 20 63 73 n [$mytypeobj cs
0bd0: 5f 6c 6f 64 20 24 6d 79 69 74 65 6d 73 5d 0a 20 _lod $myitems].
0be0: 20 20 20 7d 0a 0a 20 20 20 20 6d 65 74 68 6f 64 }.. method
0bf0: 20 69 64 20 20 20 20 7b 7d 20 7b 20 72 65 74 75 id {} { retu
0c00: 72 6e 20 24 6d 79 69 64 20 7d 0a 20 20 20 20 6d rn $myid }. m
0c10: 65 74 68 6f 64 20 69 74 65 6d 73 20 7b 7d 20 7b ethod items {} {
0c20: 20 72 65 74 75 72 6e 20 24 6d 79 74 69 74 65 6d return $mytitem
0c30: 73 20 7d 0a 20 20 20 20 6d 65 74 68 6f 64 20 64 s }. method d
0c40: 61 74 61 20 20 7b 7d 20 7b 20 72 65 74 75 72 6e ata {} { return
0c50: 20 5b 6c 69 73 74 20 24 6d 79 70 72 6f 6a 65 63 [list $myprojec
0c60: 74 20 24 6d 79 74 79 70 65 20 24 6d 79 73 72 63 t $mytype $mysrc
0c70: 69 64 5d 20 7d 0a 0a 20 20 20 20 64 65 6c 65 67 id] }.. deleg
0c80: 61 74 65 20 6d 65 74 68 6f 64 20 62 79 73 79 6d ate method bysym
0c90: 62 6f 6c 20 20 20 74 6f 20 6d 79 74 79 70 65 6f bol to mytypeo
0ca0: 62 6a 0a 20 20 20 20 64 65 6c 65 67 61 74 65 20 bj. delegate
0cb0: 6d 65 74 68 6f 64 20 62 79 72 65 76 69 73 69 6f method byrevisio
0cc0: 6e 20 74 6f 20 6d 79 74 79 70 65 6f 62 6a 0a 20 n to mytypeobj.
0cd0: 20 20 20 64 65 6c 65 67 61 74 65 20 6d 65 74 68 delegate meth
0ce0: 6f 64 20 69 73 62 72 61 6e 63 68 20 20 20 74 6f od isbranch to
0cf0: 20 6d 79 74 79 70 65 6f 62 6a 0a 20 20 20 20 64 mytypeobj. d
0d00: 65 6c 65 67 61 74 65 20 6d 65 74 68 6f 64 20 69 elegate method i
0d10: 73 74 61 67 20 20 20 20 20 20 74 6f 20 6d 79 74 stag to myt
0d20: 79 70 65 6f 62 6a 0a 0a 20 20 20 20 6d 65 74 68 ypeobj.. meth
0d30: 6f 64 20 73 65 74 70 6f 73 20 7b 70 7d 20 7b 20 od setpos {p} {
0d40: 73 65 74 20 6d 79 70 6f 73 20 24 70 20 3b 20 72 set mypos $p ; r
0d50: 65 74 75 72 6e 20 7d 0a 20 20 20 20 6d 65 74 68 eturn }. meth
0d60: 6f 64 20 70 6f 73 20 20 20 20 7b 7d 20 20 7b 20 od pos {} {
0d70: 72 65 74 75 72 6e 20 24 6d 79 70 6f 73 20 7d 0a return $mypos }.
0d80: 0a 20 20 20 20 6d 65 74 68 6f 64 20 64 65 74 65 . method dete
0d90: 72 6d 69 6e 65 73 75 63 63 65 73 73 6f 72 73 20 rminesuccessors
0da0: 7b 7d 20 7b 0a 09 23 20 50 61 73 73 20 36 20 6f {} {..# Pass 6 o
0db0: 70 65 72 61 74 69 6f 6e 2e 20 43 6f 6d 70 75 74 peration. Comput
0dc0: 65 20 70 72 6f 6a 65 63 74 2d 6c 65 76 65 6c 20 e project-level
0dd0: 64 65 70 65 6e 64 65 6e 63 69 65 73 20 66 72 6f dependencies fro
0de0: 6d 0a 09 23 20 74 68 65 20 66 69 6c 65 2d 6c 65 m..# the file-le
0df0: 76 65 6c 20 64 61 74 61 20 61 6e 64 20 73 61 76 vel data and sav
0e00: 65 20 69 74 20 62 61 63 6b 20 74 6f 20 74 68 65 e it back to the
0e10: 20 73 74 61 74 65 2e 20 54 68 69 73 20 6d 61 79 state. This may
0e20: 0a 09 23 20 62 65 20 63 61 6c 6c 65 64 20 64 75 ..# be called du
0e30: 72 69 6e 67 20 74 68 65 20 63 79 63 6c 65 20 62 ring the cycle b
0e40: 72 65 61 6b 65 72 20 70 61 73 73 65 73 20 61 73 reaker passes as
0e50: 20 77 65 6c 6c 2c 20 74 6f 20 61 64 6a 75 73 74 well, to adjust
0e60: 0a 09 23 20 74 68 65 20 73 75 63 63 65 73 73 6f ..# the successo
0e70: 72 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 6f 66 r information of
0e80: 20 63 68 61 6e 67 65 73 65 74 73 20 77 68 69 63 changesets whic
0e90: 68 20 61 72 65 20 74 68 65 0a 09 23 20 70 72 65 h are the..# pre
0ea0: 64 65 63 65 73 73 6f 72 73 20 6f 66 20 64 72 6f decessors of dro
0eb0: 70 70 65 64 20 63 68 61 6e 67 65 73 65 74 73 2e pped changesets.
0ec0: 20 46 6f 72 20 74 68 65 6d 20 77 65 20 68 61 76 For them we hav
0ed0: 65 20 74 6f 0a 09 23 20 72 65 6d 6f 76 65 20 74 e to..# remove t
0ee0: 68 65 69 72 20 65 78 69 73 74 69 6e 67 20 69 6e heir existing in
0ef0: 66 6f 72 6d 61 74 69 6f 6e 20 66 69 72 73 74 20 formation first
0f00: 62 65 66 6f 72 65 20 69 6e 73 65 72 74 69 6e 67 before inserting
0f10: 20 74 68 65 0a 09 23 20 6e 65 77 20 64 61 74 61 the..# new data
0f20: 2e 0a 09 73 74 61 74 65 20 72 75 6e 20 7b 0a 09 ...state run {..
0f30: 20 20 20 20 44 45 4c 45 54 45 20 46 52 4f 4d 20 DELETE FROM
0f40: 63 73 73 75 63 63 65 73 73 6f 72 20 57 48 45 52 cssuccessor WHER
0f50: 45 20 63 69 64 20 3d 20 24 6d 79 69 64 3b 0a 09 E cid = $myid;..
0f60: 7d 0a 09 73 65 74 20 6c 6f 6f 70 20 30 0a 09 23 }..set loop 0..#
0f70: 20 54 4f 44 4f 3a 20 43 68 65 63 6b 20 6f 74 68 TODO: Check oth
0f80: 65 72 20 75 73 65 73 20 6f 66 20 63 73 5f 73 75 er uses of cs_su
0f90: 63 65 73 73 6f 72 73 2e 0a 09 23 20 54 4f 44 4f cessors...# TODO
0fa0: 3a 20 43 6f 6e 73 69 64 65 72 20 6d 65 72 67 69 : Consider mergi
0fb0: 6e 67 20 63 73 5f 73 75 63 65 73 73 6f 72 27 73 ng cs_sucessor's
0fc0: 20 53 45 4c 45 43 54 20 77 69 74 68 20 74 68 65 SELECT with the
0fd0: 20 49 4e 53 45 52 54 20 68 65 72 65 2e 0a 09 66 INSERT here...f
0fe0: 6f 72 65 61 63 68 20 6e 69 64 20 5b 24 6d 79 74 oreach nid [$myt
0ff0: 79 70 65 6f 62 6a 20 63 73 5f 73 75 63 63 65 73 ypeobj cs_succes
1000: 73 6f 72 73 20 24 6d 79 69 74 65 6d 73 5d 20 7b sors $myitems] {
1010: 0a 09 20 20 20 20 73 74 61 74 65 20 72 75 6e 20 .. state run
1020: 7b 0a 09 09 49 4e 53 45 52 54 20 49 4e 54 4f 20 {...INSERT INTO
1030: 63 73 73 75 63 63 65 73 73 6f 72 20 28 63 69 64 cssuccessor (cid
1040: 2c 20 20 6e 69 64 29 0a 09 09 56 41 4c 55 45 53 , nid)...VALUES
1050: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1060: 20 20 28 24 6d 79 69 64 2c 24 6e 69 64 29 0a 09 ($myid,$nid)..
1070: 20 20 20 20 7d 0a 09 20 20 20 20 69 66 20 7b 24 }.. if {$
1080: 6e 69 64 20 3d 3d 20 24 6d 79 69 64 7d 20 7b 20 nid == $myid} {
1090: 73 65 74 20 6c 6f 6f 70 20 31 20 7d 0a 09 7d 0a set loop 1 }..}.
10a0: 09 23 20 52 65 70 6f 72 74 20 61 66 74 65 72 20 .# Report after
10b0: 74 68 65 20 63 6f 6d 70 6c 65 74 65 20 73 74 72 the complete str
10c0: 75 63 74 75 72 65 20 68 61 73 20 62 65 65 6e 20 ucture has been
10d0: 73 61 76 65 64 2e 0a 09 69 66 20 7b 24 6c 6f 6f saved...if {$loo
10e0: 70 7d 20 7b 20 24 73 65 6c 66 20 72 65 70 6f 72 p} { $self repor
10f0: 74 6c 6f 6f 70 20 7d 0a 09 72 65 74 75 72 6e 0a tloop }..return.
1100: 20 20 20 20 7d 0a 0a 20 20 20 20 23 20 72 65 73 }.. # res
1110: 75 6c 74 20 3d 20 6c 69 73 74 20 28 63 68 61 6e ult = list (chan
1120: 67 65 73 65 74 29 0a 20 20 20 20 6d 65 74 68 6f geset). metho
1130: 64 20 73 75 63 63 65 73 73 6f 72 73 20 7b 7d 20 d successors {}
1140: 7b 0a 09 23 20 55 73 65 20 74 68 65 20 64 61 74 {..# Use the dat
1150: 61 20 73 61 76 65 64 20 62 79 20 70 61 73 73 20 a saved by pass
1160: 36 2e 0a 09 72 65 74 75 72 6e 20 5b 73 74 72 75 6...return [stru
1170: 63 74 3a 3a 6c 69 73 74 20 6d 61 70 20 5b 73 74 ct::list map [st
1180: 61 74 65 20 72 75 6e 20 7b 0a 09 20 20 20 20 53 ate run {.. S
1190: 45 4c 45 43 54 20 53 2e 6e 69 64 0a 09 20 20 20 ELECT S.nid..
11a0: 20 46 52 4f 4d 20 20 20 63 73 73 75 63 63 65 73 FROM cssucces
11b0: 73 6f 72 20 53 0a 09 20 20 20 20 57 48 45 52 45 sor S.. WHERE
11c0: 20 20 53 2e 63 69 64 20 3d 20 24 6d 79 69 64 0a S.cid = $myid.
11d0: 09 7d 5d 20 5b 6d 79 74 79 70 65 6d 65 74 68 6f .}] [mytypemetho
11e0: 64 20 6f 66 5d 5d 0a 20 20 20 20 7d 0a 0a 20 20 d of]]. }..
11f0: 20 20 23 20 69 74 65 6d 20 2d 3e 20 6c 69 73 74 # item -> list
1200: 20 28 69 74 65 6d 29 0a 20 20 20 20 6d 65 74 68 (item). meth
1210: 6f 64 20 6e 65 78 74 6d 61 70 20 7b 7d 20 7b 0a od nextmap {} {.
1220: 09 24 6d 79 74 79 70 65 6f 62 6a 20 73 75 63 63 .$mytypeobj succ
1230: 65 73 73 6f 72 73 20 74 6d 70 20 24 6d 79 69 74 essors tmp $myit
1240: 65 6d 73 0a 09 72 65 74 75 72 6e 20 5b 61 72 72 ems..return [arr
1250: 61 79 20 67 65 74 20 74 6d 70 5d 0a 20 20 20 20 ay get tmp].
1260: 7d 0a 0a 20 20 20 20 6d 65 74 68 6f 64 20 62 72 }.. method br
1270: 65 61 6b 69 6e 74 65 72 6e 61 6c 64 65 70 65 6e eakinternaldepen
1280: 64 65 6e 63 69 65 73 20 7b 63 76 7d 20 7b 0a 09 dencies {cv} {..
1290: 75 70 76 61 72 20 31 20 24 63 76 20 63 6f 75 6e upvar 1 $cv coun
12a0: 74 65 72 0a 09 6c 6f 67 20 77 72 69 74 65 20 31 ter..log write 1
12b0: 34 20 63 73 65 74 73 20 7b 5b 24 73 65 6c 66 20 4 csets {[$self
12c0: 73 74 72 5d 20 42 49 44 7d 0a 09 76 63 3a 3a 74 str] BID}..vc::t
12d0: 6f 6f 6c 73 3a 3a 6d 65 6d 3a 3a 6d 61 72 6b 0a ools::mem::mark.
12e0: 0a 09 23 20 54 68 69 73 20 6d 65 74 68 6f 64 20 ..# This method
12f0: 69 6e 73 70 65 63 74 73 20 74 68 65 20 63 68 61 inspects the cha
1300: 6e 67 65 73 65 74 2c 20 6c 6f 6f 6b 69 6e 67 20 ngeset, looking
1310: 66 6f 72 20 69 6e 74 65 72 6e 61 6c 0a 09 23 20 for internal..#
1320: 64 65 70 65 6e 64 65 6e 63 69 65 73 2e 20 4e 6f dependencies. No
1330: 74 68 69 6e 67 20 69 73 20 64 6f 6e 65 20 69 66 thing is done if
1340: 20 74 68 65 72 65 20 61 72 65 20 6e 6f 20 73 75 there are no su
1350: 63 68 2e 0a 0a 09 23 20 4f 74 68 65 72 77 69 73 ch....# Otherwis
1360: 65 20 74 68 65 20 63 68 61 6e 67 65 73 65 74 20 e the changeset
1370: 69 73 20 73 70 6c 69 74 20 69 6e 74 6f 20 61 20 is split into a
1380: 73 65 74 20 6f 66 20 66 72 61 67 6d 65 6e 74 73 set of fragments
1390: 0a 09 23 20 77 68 69 63 68 20 68 61 76 65 20 6e ..# which have n
13a0: 6f 20 69 6e 74 65 72 6e 61 6c 20 64 65 70 65 6e o internal depen
13b0: 64 65 6e 63 69 65 73 2c 20 74 72 61 6e 73 66 6f dencies, transfo
13c0: 72 6d 69 6e 67 20 74 68 65 0a 09 23 20 69 6e 74 rming the..# int
13d0: 65 72 6e 61 6c 20 64 65 70 65 6e 64 65 6e 63 69 ernal dependenci
13e0: 65 73 20 69 6e 74 6f 20 65 78 74 65 72 6e 61 6c es into external
13f0: 20 6f 6e 65 73 2e 20 54 68 65 20 6e 65 77 20 63 ones. The new c
1400: 68 61 6e 67 65 73 65 74 73 0a 09 23 20 67 65 6e hangesets..# gen
1410: 65 72 61 74 65 64 20 66 72 6f 6d 20 74 68 65 20 erated from the
1420: 66 72 61 67 6d 65 6e 74 20 69 6e 66 6f 72 6d 61 fragment informa
1430: 74 69 6f 6e 20 61 72 65 20 61 64 64 65 64 20 74 tion are added t
1440: 6f 20 74 68 65 0a 09 23 20 6c 69 73 74 20 6f 66 o the..# list of
1450: 20 61 6c 6c 20 63 68 61 6e 67 65 73 65 74 73 20 all changesets
1460: 28 62 79 20 74 68 65 20 63 61 6c 6c 65 72 29 2e (by the caller).
1470: 0a 0a 09 23 20 54 68 65 20 63 6f 64 65 20 63 68 ...# The code ch
1480: 65 63 6b 73 20 6f 6e 6c 79 20 73 75 63 63 65 73 ecks only succes
1490: 73 6f 72 20 64 65 70 65 6e 64 65 6e 63 69 65 73 sor dependencies
14a0: 2c 20 61 73 20 74 68 69 73 20 61 75 74 6f 2d 0a , as this auto-.
14b0: 09 23 20 6d 61 74 69 63 61 6c 6c 79 20 63 6f 76 .# matically cov
14c0: 65 72 73 20 74 68 65 20 70 72 65 64 65 63 65 73 ers the predeces
14d0: 73 6f 72 20 64 65 70 65 6e 64 65 6e 63 69 65 73 sor dependencies
14e0: 20 61 73 20 77 65 6c 6c 20 28 41 6e 79 0a 09 23 as well (Any..#
14f0: 20 73 75 63 63 65 73 73 6f 72 20 64 65 70 65 6e successor depen
1500: 64 65 6e 63 79 20 61 20 2d 3e 20 62 20 69 73 20 dency a -> b is
1510: 61 6c 73 6f 20 61 20 70 72 65 64 65 63 65 73 73 also a predecess
1520: 6f 72 20 64 65 70 65 6e 64 65 6e 63 79 0a 09 23 or dependency..#
1530: 20 62 20 2d 3e 20 61 29 2e 0a 0a 09 61 72 72 61 b -> a)....arra
1540: 79 20 73 65 74 20 62 72 65 61 6b 73 20 7b 7d 0a y set breaks {}.
1550: 0a 09 73 65 74 20 66 72 61 67 6d 65 6e 74 73 20 ..set fragments
1560: 5b 42 72 65 61 6b 44 69 72 65 63 74 44 65 70 65 [BreakDirectDepe
1570: 6e 64 65 6e 63 69 65 73 20 24 6d 79 69 74 65 6d ndencies $myitem
1580: 73 20 62 72 65 61 6b 73 5d 0a 0a 09 69 66 20 7b s breaks]...if {
1590: 21 5b 6c 6c 65 6e 67 74 68 20 24 66 72 61 67 6d ![llength $fragm
15a0: 65 6e 74 73 5d 7d 20 7b 20 72 65 74 75 72 6e 20 ents]} { return
15b0: 7b 7d 20 7d 0a 0a 09 72 65 74 75 72 6e 20 5b 24 {} }...return [$
15c0: 73 65 6c 66 20 43 72 65 61 74 65 46 72 6f 6d 46 self CreateFromF
15d0: 72 61 67 6d 65 6e 74 73 20 24 66 72 61 67 6d 65 ragments $fragme
15e0: 6e 74 73 20 63 6f 75 6e 74 65 72 20 62 72 65 61 nts counter brea
15f0: 6b 73 5d 0a 20 20 20 20 7d 0a 0a 20 20 20 20 6d ks]. }.. m
1600: 65 74 68 6f 64 20 70 65 72 73 69 73 74 20 7b 7d ethod persist {}
1610: 20 7b 0a 09 73 65 74 20 74 69 64 20 24 6d 79 63 {..set tid $myc
1620: 73 74 79 70 65 28 24 6d 79 74 79 70 65 29 0a 09 stype($mytype)..
1630: 73 65 74 20 70 69 64 20 5b 24 6d 79 70 72 6f 6a set pid [$myproj
1640: 65 63 74 20 69 64 5d 0a 09 73 65 74 20 70 6f 73 ect id]..set pos
1650: 20 30 0a 0a 09 73 74 61 74 65 20 74 72 61 6e 73 0...state trans
1660: 61 63 74 69 6f 6e 20 7b 0a 09 20 20 20 20 73 74 action {.. st
1670: 61 74 65 20 72 75 6e 20 7b 0a 09 09 49 4e 53 45 ate run {...INSE
1680: 52 54 20 49 4e 54 4f 20 63 68 61 6e 67 65 73 65 RT INTO changese
1690: 74 20 28 63 69 64 2c 20 20 20 70 69 64 2c 20 20 t (cid, pid,
16a0: 74 79 70 65 2c 20 73 72 63 29 0a 09 09 56 41 4c type, src)...VAL
16b0: 55 45 53 20 20 20 20 20 20 20 20 20 20 20 20 20 UES
16c0: 20 20 20 28 24 6d 79 69 64 2c 20 24 70 69 64 2c ($myid, $pid,
16d0: 20 24 74 69 64 2c 20 24 6d 79 73 72 63 69 64 29 $tid, $mysrcid)
16e0: 3b 0a 09 20 20 20 20 7d 0a 0a 09 20 20 20 20 66 ;.. }... f
16f0: 6f 72 65 61 63 68 20 69 69 64 20 24 6d 79 69 74 oreach iid $myit
1700: 65 6d 73 20 7b 0a 09 09 73 74 61 74 65 20 72 75 ems {...state ru
1710: 6e 20 7b 0a 09 09 20 20 20 20 49 4e 53 45 52 54 n {... INSERT
1720: 20 49 4e 54 4f 20 63 73 69 74 65 6d 20 28 63 69 INTO csitem (ci
1730: 64 2c 20 20 20 70 6f 73 2c 20 20 69 69 64 29 0a d, pos, iid).
1740: 09 09 20 20 20 20 56 41 4c 55 45 53 20 20 20 20 .. VALUES
1750: 20 20 20 20 20 20 20 20 20 28 24 6d 79 69 64 2c ($myid,
1760: 20 24 70 6f 73 2c 20 24 69 69 64 29 3b 0a 09 09 $pos, $iid);...
1770: 7d 0a 09 09 69 6e 63 72 20 70 6f 73 0a 09 20 20 }...incr pos..
1780: 20 20 7d 0a 09 7d 0a 09 72 65 74 75 72 6e 0a 20 }..}..return.
1790: 20 20 20 7d 0a 0a 20 20 20 20 6d 65 74 68 6f 64 }.. method
17a0: 20 74 69 6d 65 72 61 6e 67 65 20 7b 7d 20 7b 20 timerange {} {
17b0: 72 65 74 75 72 6e 20 5b 24 6d 79 74 79 70 65 6f return [$mytypeo
17c0: 62 6a 20 74 69 6d 65 72 61 6e 67 65 20 24 6d 79 bj timerange $my
17d0: 69 74 65 6d 73 5d 20 7d 0a 0a 20 20 20 20 6d 65 items] }.. me
17e0: 74 68 6f 64 20 6c 69 6d 69 74 73 20 7b 7d 20 7b thod limits {} {
17f0: 0a 09 73 74 72 75 63 74 3a 3a 6c 69 73 74 20 61 ..struct::list a
1800: 73 73 69 67 6e 20 5b 24 6d 79 74 79 70 65 6f 62 ssign [$mytypeob
1810: 6a 20 6c 69 6d 69 74 73 20 24 6d 79 69 74 65 6d j limits $myitem
1820: 73 5d 20 6d 61 78 70 20 6d 69 6e 73 0a 09 72 65 s] maxp mins..re
1830: 74 75 72 6e 20 5b 6c 69 73 74 20 5b 54 61 67 49 turn [list [TagI
1840: 74 65 6d 44 69 63 74 20 24 6d 61 78 70 20 24 6d temDict $maxp $m
1850: 79 74 79 70 65 5d 20 5b 54 61 67 49 74 65 6d 44 ytype] [TagItemD
1860: 69 63 74 20 24 6d 69 6e 73 20 24 6d 79 74 79 70 ict $mins $mytyp
1870: 65 5d 5d 0a 20 20 20 20 7d 0a 0a 20 20 20 20 6d e]]. }.. m
1880: 65 74 68 6f 64 20 64 72 6f 70 20 7b 7d 20 7b 0a ethod drop {} {.
1890: 09 6c 6f 67 20 77 72 69 74 65 20 38 20 63 73 65 .log write 8 cse
18a0: 74 73 20 7b 44 72 6f 70 70 69 6e 67 20 24 73 65 ts {Dropping $se
18b0: 6c 66 20 3d 20 5b 24 73 65 6c 66 20 73 74 72 5d lf = [$self str]
18c0: 7d 0a 0a 09 73 74 61 74 65 20 74 72 61 6e 73 61 }...state transa
18d0: 63 74 69 6f 6e 20 7b 0a 09 20 20 20 20 73 74 61 ction {.. sta
18e0: 74 65 20 72 75 6e 20 7b 0a 09 09 44 45 4c 45 54 te run {...DELET
18f0: 45 20 46 52 4f 4d 20 63 68 61 6e 67 65 73 65 74 E FROM changeset
1900: 20 20 20 57 48 45 52 45 20 63 69 64 20 3d 20 24 WHERE cid = $
1910: 6d 79 69 64 3b 0a 09 09 44 45 4c 45 54 45 20 46 myid;...DELETE F
1920: 52 4f 4d 20 63 73 69 74 65 6d 20 20 20 20 20 20 ROM csitem
1930: 57 48 45 52 45 20 63 69 64 20 3d 20 24 6d 79 69 WHERE cid = $myi
1940: 64 3b 0a 09 09 44 45 4c 45 54 45 20 46 52 4f 4d d;...DELETE FROM
1950: 20 63 73 73 75 63 63 65 73 73 6f 72 20 57 48 45 cssuccessor WHE
1960: 52 45 20 63 69 64 20 3d 20 24 6d 79 69 64 3b 0a RE cid = $myid;.
1970: 09 20 20 20 20 7d 0a 09 7d 0a 0a 09 55 6e 6d 61 . }..}...Unma
1980: 70 49 74 65 6d 73 20 24 6d 79 74 79 70 65 20 24 pItems $mytype $
1990: 6d 79 69 74 65 6d 73 0a 09 75 6e 73 65 74 20 6d myitems..unset m
19a0: 79 69 64 6d 61 70 28 24 6d 79 69 64 29 0a 0a 09 yidmap($myid)...
19b0: 73 65 74 20 70 6f 73 20 20 20 20 20 20 20 20 20 set pos
19c0: 20 20 20 20 20 20 20 20 20 20 20 5b 6c 73 65 61 [lsea
19d0: 72 63 68 20 2d 65 78 61 63 74 20 24 6d 79 63 68 rch -exact $mych
19e0: 61 6e 67 65 73 65 74 73 20 24 73 65 6c 66 5d 0a angesets $self].
19f0: 09 73 65 74 20 6d 79 63 68 61 6e 67 65 73 65 74 .set mychangeset
1a00: 73 20 20 20 20 20 20 20 20 20 20 20 5b 6c 72 65 s [lre
1a10: 70 6c 61 63 65 20 20 20 20 20 20 20 24 6d 79 63 place $myc
1a20: 68 61 6e 67 65 73 65 74 73 20 24 70 6f 73 20 24 hangesets $pos $
1a30: 70 6f 73 5d 0a 09 73 65 74 20 70 6f 73 20 20 20 pos]..set pos
1a40: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1a50: 20 5b 6c 73 65 61 72 63 68 20 2d 65 78 61 63 74 [lsearch -exact
1a60: 20 24 6d 79 74 63 68 61 6e 67 65 73 65 74 73 28 $mytchangesets(
1a70: 24 6d 79 74 79 70 65 29 20 24 73 65 6c 66 5d 0a $mytype) $self].
1a80: 09 73 65 74 20 6d 79 74 63 68 61 6e 67 65 73 65 .set mytchangese
1a90: 74 73 28 24 6d 79 74 79 70 65 29 20 5b 6c 72 65 ts($mytype) [lre
1aa0: 70 6c 61 63 65 20 20 20 20 20 20 20 24 6d 79 74 place $myt
1ab0: 63 68 61 6e 67 65 73 65 74 73 28 24 6d 79 74 79 changesets($myty
1ac0: 70 65 29 20 24 70 6f 73 20 24 70 6f 73 5d 0a 0a pe) $pos $pos]..
1ad0: 09 23 20 52 65 74 75 72 6e 20 74 68 65 20 6c 69 .# Return the li
1ae0: 73 74 20 6f 66 20 70 72 65 64 65 63 65 73 73 6f st of predecesso
1af0: 72 73 20 73 6f 20 74 68 61 74 20 74 68 65 79 20 rs so that they
1b00: 63 61 6e 20 62 65 20 61 64 6a 75 73 74 65 64 2e can be adjusted.
1b10: 0a 09 72 65 74 75 72 6e 20 5b 73 74 72 75 63 74 ..return [struct
1b20: 3a 3a 6c 69 73 74 20 6d 61 70 20 5b 73 74 61 74 ::list map [stat
1b30: 65 20 72 75 6e 20 7b 0a 09 20 20 20 20 53 45 4c e run {.. SEL
1b40: 45 43 54 20 63 69 64 0a 09 20 20 20 20 46 52 4f ECT cid.. FRO
1b50: 4d 20 20 20 63 73 73 75 63 63 65 73 73 6f 72 0a M cssuccessor.
1b60: 09 20 20 20 20 57 48 45 52 45 20 20 6e 69 64 20 . WHERE nid
1b70: 3d 20 24 6d 79 69 64 0a 09 7d 5d 20 5b 6d 79 74 = $myid..}] [myt
1b80: 79 70 65 6d 65 74 68 6f 64 20 6f 66 5d 5d 0a 20 ypemethod of]].
1b90: 20 20 20 7d 0a 0a 20 20 20 20 6d 65 74 68 6f 64 }.. method
1ba0: 20 72 65 70 6f 72 74 6c 6f 6f 70 20 7b 7b 6b 69 reportloop {{ki
1bb0: 6c 6c 20 31 7d 7d 20 7b 0a 09 23 20 57 65 20 70 ll 1}} {..# We p
1bc0: 72 69 6e 74 20 74 68 65 20 69 74 65 6d 73 20 77 rint the items w
1bd0: 68 69 63 68 20 61 72 65 20 70 72 6f 64 75 63 69 hich are produci
1be0: 6e 67 20 74 68 65 20 6c 6f 6f 70 2c 20 61 6e 64 ng the loop, and
1bf0: 20 68 6f 77 2e 0a 0a 09 73 65 74 20 68 64 72 20 how....set hdr
1c00: 22 53 65 6c 66 2d 72 65 66 65 72 65 6e 74 69 61 "Self-referentia
1c10: 6c 20 63 68 61 6e 67 65 73 65 74 20 5b 24 73 65 l changeset [$se
1c20: 6c 66 20 73 74 72 5d 20 5f 5f 5f 5f 5f 5f 5f 5f lf str] ________
1c30: 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 22 0a 09 73 65 74 __________"..set
1c40: 20 66 74 72 20 5b 72 65 67 73 75 62 20 2d 61 6c ftr [regsub -al
1c50: 6c 20 7b 5b 5e 20 09 5d 7d 20 24 68 64 72 20 7b l {[^ .]} $hdr {
1c60: 5f 7d 5d 0a 0a 09 6c 6f 67 20 77 72 69 74 65 20 _}]...log write
1c70: 30 20 63 73 65 74 73 20 24 68 64 72 0a 09 66 6f 0 csets $hdr..fo
1c80: 72 65 61 63 68 20 7b 69 74 65 6d 20 6e 65 78 74 reach {item next
1c90: 69 74 65 6d 7d 20 5b 24 6d 79 74 79 70 65 6f 62 item} [$mytypeob
1ca0: 6a 20 6c 6f 6f 70 73 20 24 6d 79 69 74 65 6d 73 j loops $myitems
1cb0: 5d 20 7b 0a 09 20 20 20 20 23 20 43 72 65 61 74 ] {.. # Creat
1cc0: 65 20 74 61 67 67 65 64 20 69 74 65 6d 73 20 66 e tagged items f
1cd0: 72 6f 6d 20 74 68 65 20 69 64 20 61 6e 64 20 6f rom the id and o
1ce0: 75 72 20 74 79 70 65 2e 0a 09 20 20 20 20 73 65 ur type... se
1cf0: 74 20 69 74 65 6d 20 20 20 20 20 5b 6c 69 73 74 t item [list
1d00: 20 24 6d 79 74 79 70 65 20 20 24 69 74 65 6d 5d $mytype $item]
1d10: 0a 09 20 20 20 20 73 65 74 20 6e 65 78 74 69 74 .. set nextit
1d20: 65 6d 20 5b 6c 69 73 74 20 24 6d 79 74 79 70 65 em [list $mytype
1d30: 20 24 6e 65 78 74 69 74 65 6d 5d 0a 09 20 20 20 $nextitem]..
1d40: 20 23 20 50 72 69 6e 74 61 62 6c 65 20 6c 61 62 # Printable lab
1d50: 65 6c 73 2e 0a 09 20 20 20 20 73 65 74 20 69 20 els... set i
1d60: 20 22 3c 5b 24 74 79 70 65 20 69 74 65 6d 73 74 "<[$type itemst
1d70: 72 20 24 69 74 65 6d 5d 3e 22 0a 09 20 20 20 20 r $item]>"..
1d80: 73 65 74 20 6e 20 20 22 3c 5b 24 74 79 70 65 20 set n "<[$type
1d90: 69 74 65 6d 73 74 72 20 24 6e 65 78 74 69 74 65 itemstr $nextite
1da0: 6d 5d 3e 22 0a 09 20 20 20 20 73 65 74 20 6e 63 m]>".. set nc
1db0: 73 20 24 6d 79 69 74 65 6d 6d 61 70 28 24 6e 65 s $myitemmap($ne
1dc0: 78 74 69 74 65 6d 29 0a 09 20 20 20 20 23 20 50 xtitem).. # P
1dd0: 72 69 6e 74 0a 09 20 20 20 20 6c 6f 67 20 77 72 rint.. log wr
1de0: 69 74 65 20 30 20 63 73 65 74 73 20 7b 2a 20 24 ite 0 csets {* $
1df0: 69 20 2d 2d 3e 20 24 6e 20 2d 2d 3e 20 63 73 20 i --> $n --> cs
1e00: 5b 24 6e 63 73 20 73 74 72 5d 7d 0a 09 7d 0a 09 [$ncs str]}..}..
1e10: 6c 6f 67 20 77 72 69 74 65 20 30 20 63 73 65 74 log write 0 cset
1e20: 73 20 24 66 74 72 0a 0a 09 69 66 20 7b 21 24 6b s $ftr...if {!$k
1e30: 69 6c 6c 7d 20 72 65 74 75 72 6e 0a 09 74 72 6f ill} return..tro
1e40: 75 62 6c 65 20 69 6e 74 65 72 6e 61 6c 20 22 5b uble internal "[
1e50: 24 73 65 6c 66 20 73 74 72 5d 20 64 65 70 65 6e $self str] depen
1e60: 64 73 20 6f 6e 20 69 74 73 65 6c 66 22 0a 09 72 ds on itself"..r
1e70: 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 eturn. }..
1e80: 20 6d 65 74 68 6f 64 20 70 75 73 68 74 6f 20 7b method pushto {
1e90: 72 65 70 6f 73 69 74 6f 72 79 20 64 61 74 65 20 repository date
1ea0: 72 73 74 61 74 65 7d 20 7b 0a 09 23 20 47 65 6e rstate} {..# Gen
1eb0: 65 72 61 74 65 20 61 6e 64 20 69 6d 70 6f 72 74 erate and import
1ec0: 20 74 68 65 20 6d 61 6e 69 66 65 73 74 20 66 6f the manifest fo
1ed0: 72 20 74 68 69 73 20 63 68 61 6e 67 65 73 65 74 r this changeset
1ee0: 2e 0a 09 23 0a 09 23 20 44 61 74 61 20 6e 65 65 ...#..# Data nee
1ef0: 64 65 64 3a 0a 09 23 20 2d 20 43 6f 6d 6d 69 74 ded:..# - Commit
1f00: 20 6d 65 73 73 61 67 65 20 20 20 20 20 20 20 20 message
1f10: 20 20 20 20 20 20 20 28 2d 2d 20 6d 79 73 72 63 (-- mysrc
1f20: 69 64 20 2d 3e 20 72 65 70 6f 73 69 74 6f 72 79 id -> repository
1f30: 20 6d 65 74 61 29 0a 09 23 20 2d 20 55 73 65 72 meta)..# - User
1f40: 20 64 6f 69 6e 67 20 74 68 65 20 63 6f 6d 6d 69 doing the commi
1f50: 74 20 20 20 20 20 20 20 20 28 73 2e 61 2e 29 0a t (s.a.).
1f60: 09 23 0a 09 23 20 2d 20 54 69 6d 65 73 74 61 6d .#..# - Timestam
1f70: 70 20 6f 66 20 77 68 65 6e 20 63 6f 6d 6d 69 74 p of when commit
1f80: 74 65 64 20 20 28 63 6f 6d 6d 61 6e 64 20 61 72 ted (command ar
1f90: 67 75 6d 65 6e 74 29 0a 09 23 0a 09 23 20 2d 20 gument)..#..# -
1fa0: 54 68 65 20 70 61 72 65 6e 74 20 63 68 61 6e 67 The parent chang
1fb0: 65 73 65 74 2c 20 69 66 20 61 6e 79 2e 20 49 66 eset, if any. If
1fc0: 20 74 68 65 72 65 20 69 73 20 6e 6f 20 70 61 72 there is no par
1fd0: 65 6e 74 20 66 6f 73 73 69 6c 0a 09 23 20 20 20 ent fossil..#
1fe0: 77 69 6c 6c 20 75 73 65 20 74 68 65 20 65 6d 70 will use the emp
1ff0: 74 79 20 62 61 73 65 20 72 65 76 69 73 69 6f 6e ty base revision
2000: 20 61 73 20 70 61 72 65 6e 74 2e 0a 09 23 0a 09 as parent...#..
2010: 23 20 2d 20 4c 69 73 74 20 6f 66 20 74 68 65 20 # - List of the
2020: 66 69 6c 65 20 72 65 76 69 73 69 6f 6e 73 20 69 file revisions i
2030: 6e 20 74 68 65 20 63 68 61 6e 67 65 73 65 74 2e n the changeset.
2040: 0a 0a 09 73 74 72 75 63 74 3a 3a 6c 69 73 74 20 ...struct::list
2050: 61 73 73 69 67 6e 20 5b 24 6d 79 70 72 6f 6a 65 assign [$myproje
2060: 63 74 20 67 65 74 6d 65 74 61 20 24 6d 79 73 72 ct getmeta $mysr
2070: 63 69 64 5d 20 5f 5f 20 5f 5f 20 75 73 65 72 20 cid] __ __ user
2080: 6d 65 73 73 61 67 65 0a 0a 09 23 20 57 65 20 64 message...# We d
2090: 65 72 69 76 65 20 74 68 65 20 6c 6f 64 20 69 6e erive the lod in
20a0: 66 6f 72 6d 61 74 69 6f 6e 20 64 69 72 65 63 74 formation direct
20b0: 6c 79 20 66 72 6f 6d 20 74 68 65 20 72 65 76 69 ly from the revi
20c0: 73 69 6f 6e 73 20 6f 66 0a 09 23 20 74 68 65 20 sions of..# the
20d0: 63 68 61 6e 67 65 73 65 74 2c 20 61 73 20 74 68 changeset, as th
20e0: 65 20 62 72 61 6e 63 68 20 70 61 72 74 20 6f 66 e branch part of
20f0: 20 74 68 65 20 6d 65 74 61 20 64 61 74 61 20 28 the meta data (
2100: 73 2e 61 2e 29 20 69 73 0a 09 23 20 6f 75 74 64 s.a.) is..# outd
2110: 61 74 65 64 20 73 69 6e 63 65 20 70 61 73 73 20 ated since pass
2120: 46 69 6c 74 65 72 53 79 6d 62 6f 6c 73 2e 0a 0a FilterSymbols...
2130: 09 73 65 74 20 6c 6f 64 6e 61 6d 65 20 5b 24 73 .set lodname [$s
2140: 65 6c 66 20 6c 6f 64 5d 0a 0a 09 6c 6f 67 20 77 elf lod]...log w
2150: 72 69 74 65 20 32 20 63 73 65 74 73 20 7b 49 6d rite 2 csets {Im
2160: 70 6f 72 74 69 6e 67 20 72 65 76 69 73 69 6f 6e porting revision
2170: 20 5b 24 73 65 6c 66 20 73 74 72 5d 20 6f 6e 20 [$self str] on
2180: 24 6c 6f 64 6e 61 6d 65 7d 0a 0a 09 23 20 50 65 $lodname}...# Pe
2190: 72 66 6f 72 6d 20 74 68 65 20 69 6d 70 6f 72 74 rform the import
21a0: 2e 20 41 73 20 70 61 72 74 20 6f 66 20 74 68 61 . As part of tha
21b0: 74 20 77 65 20 64 65 74 65 72 6d 69 6e 65 20 74 t we determine t
21c0: 68 65 20 70 61 72 65 6e 74 0a 09 23 20 77 65 20 he parent..# we
21d0: 6e 65 65 64 2c 20 61 6e 64 20 63 6f 6e 76 65 72 need, and conver
21e0: 74 20 74 68 65 20 6c 69 73 74 20 6f 66 20 69 74 t the list of it
21f0: 65 6d 73 20 69 6e 20 74 68 65 20 63 68 61 6e 67 ems in the chang
2200: 65 73 65 74 20 69 6e 74 6f 0a 09 23 20 75 75 69 eset into..# uui
2210: 64 73 20 61 6e 64 20 70 72 69 6e 74 61 62 6c 65 ds and printable
2220: 20 64 61 74 61 2e 0a 0a 09 73 74 72 75 63 74 3a data....struct:
2230: 3a 6c 69 73 74 20 61 73 73 69 67 6e 20 5b 47 65 :list assign [Ge
2240: 74 69 73 64 65 66 61 75 6c 74 20 24 6d 79 69 74 tisdefault $myit
2250: 65 6d 73 5d 20 69 73 64 65 66 61 75 6c 74 20 6c ems] isdefault l
2260: 61 73 74 64 65 66 61 75 6c 74 6f 6e 74 72 75 6e astdefaultontrun
2270: 6b 0a 0a 09 6c 6f 67 20 77 72 69 74 65 20 38 20 k...log write 8
2280: 63 73 65 74 73 20 7b 4c 4f 44 20 20 20 20 27 24 csets {LOD '$
2290: 6c 6f 64 6e 61 6d 65 27 7d 0a 09 6c 6f 67 20 77 lodname'}..log w
22a0: 72 69 74 65 20 38 20 63 73 65 74 73 20 7b 20 64 rite 8 csets { d
22b0: 65 66 3f 20 20 24 69 73 64 65 66 61 75 6c 74 7d ef? $isdefault}
22c0: 0a 09 6c 6f 67 20 77 72 69 74 65 20 38 20 63 73 ..log write 8 cs
22d0: 65 74 73 20 7b 20 6c 61 73 74 3f 20 24 6c 61 73 ets { last? $las
22e0: 74 64 65 66 61 75 6c 74 6f 6e 74 72 75 6e 6b 7d tdefaultontrunk}
22f0: 0a 0a 09 73 65 74 20 6c 77 73 20 20 5b 47 65 74 ...set lws [Get
2300: 77 6f 72 6b 73 70 61 63 65 20 20 20 20 24 72 73 workspace $rs
2310: 74 61 74 65 20 24 6c 6f 64 6e 61 6d 65 20 24 6d tate $lodname $m
2320: 79 70 72 6f 6a 65 63 74 20 24 69 73 64 65 66 61 yproject $isdefa
2330: 75 6c 74 5d 0a 09 24 6c 77 73 20 61 64 64 20 5b ult]..$lws add [
2340: 47 65 74 72 65 76 69 73 69 6f 6e 69 6e 66 6f 20 Getrevisioninfo
2350: 24 6d 79 69 74 65 6d 73 5d 0a 0a 09 73 65 74 20 $myitems]...set
2360: 75 75 69 64 20 5b 24 72 65 70 6f 73 69 74 6f 72 uuid [$repositor
2370: 79 20 69 6d 70 6f 72 74 72 65 76 69 73 69 6f 6e y importrevision
2380: 20 5b 24 73 65 6c 66 20 73 74 72 5d 20 5c 0a 09 [$self str] \..
2390: 09 20 20 20 20 20 20 24 75 73 65 72 20 24 6d 65 . $user $me
23a0: 73 73 61 67 65 20 24 64 61 74 65 20 5c 0a 09 09 ssage $date \...
23b0: 20 20 20 20 20 20 5b 24 6c 77 73 20 67 65 74 69 [$lws geti
23c0: 64 5d 20 5b 24 6c 77 73 20 67 65 74 5d 5d 0a 0a d] [$lws get]]..
23d0: 09 23 20 52 65 6d 65 6d 62 65 72 20 74 68 65 20 .# Remember the
23e0: 69 6d 70 6f 72 74 65 64 20 63 68 61 6e 67 65 73 imported changes
23f0: 65 74 20 69 6e 20 74 68 65 20 73 74 61 74 65 2c et in the state,
2400: 20 75 6e 64 65 72 20 6f 75 72 0a 09 23 20 4c 4f under our..# LO
2410: 44 2e 20 41 6e 64 20 69 66 20 69 74 20 69 73 20 D. And if it is
2420: 74 68 65 20 6c 61 73 74 20 74 72 75 6e 6b 20 63 the last trunk c
2430: 68 61 6e 67 65 73 65 74 20 6f 6e 20 74 68 65 20 hangeset on the
2440: 76 65 6e 64 6f 72 0a 09 23 20 62 72 61 6e 63 68 vendor..# branch
2450: 20 74 68 65 6e 20 74 68 65 20 72 65 76 69 73 69 then the revisi
2460: 6f 6e 20 69 73 20 61 6c 73 6f 20 74 68 65 20 61 on is also the a
2470: 63 74 75 61 6c 20 72 6f 6f 74 20 6f 66 20 74 68 ctual root of th
2480: 65 0a 09 23 20 3a 74 72 75 6e 6b 3a 2c 20 73 6f e..# :trunk:, so
2490: 20 77 65 20 72 65 6d 65 6d 62 65 72 20 69 74 20 we remember it
24a0: 61 73 20 73 75 63 68 20 69 6e 20 74 68 65 20 73 as such in the s
24b0: 74 61 74 65 2e 20 48 6f 77 65 76 65 72 20 69 66 tate. However if
24c0: 0a 09 23 20 74 68 65 20 74 72 75 6e 6b 20 61 6c ..# the trunk al
24d0: 72 65 61 64 79 20 65 78 69 73 74 73 20 74 68 65 ready exists the
24e0: 6e 20 74 68 65 20 63 68 61 6e 67 65 73 65 74 20 n the changeset
24f0: 63 61 6e 6e 6f 74 20 62 65 20 6f 6e 20 69 74 0a cannot be on it.
2500: 09 23 20 61 6e 79 20 6d 6f 72 65 2e 20 54 68 69 .# any more. Thi
2510: 73 20 69 6e 64 69 63 61 74 65 73 20 77 65 69 72 s indicates weir
2520: 64 6e 65 73 73 20 69 6e 20 74 68 65 20 73 65 74 dness in the set
2530: 75 70 20 6f 66 20 74 68 65 0a 09 23 20 76 65 6e up of the..# ven
2540: 64 6f 72 20 62 72 61 6e 63 68 2c 20 62 75 74 20 dor branch, but
2550: 6f 6e 65 20 77 65 20 63 61 6e 20 77 6f 72 6b 20 one we can work
2560: 61 72 6f 75 6e 64 2e 0a 0a 09 24 6c 77 73 20 64 around....$lws d
2570: 65 66 69 64 20 24 75 75 69 64 0a 09 69 66 20 7b efid $uuid..if {
2580: 24 6c 61 73 74 64 65 66 61 75 6c 74 6f 6e 74 72 $lastdefaultontr
2590: 75 6e 6b 7d 20 7b 0a 09 20 20 20 20 69 66 20 7b unk} {.. if {
25a0: 5b 24 72 73 74 61 74 65 20 68 61 73 20 3a 74 72 [$rstate has :tr
25b0: 75 6e 6b 3a 5d 7d 20 7b 0a 09 09 6c 6f 67 20 77 unk:]} {...log w
25c0: 72 69 74 65 20 32 20 63 73 65 74 73 20 7b 4d 75 rite 2 csets {Mu
25d0: 6c 74 69 70 6c 65 20 63 68 61 6e 67 65 73 65 74 ltiple changeset
25e0: 73 20 64 65 63 6c 61 72 65 64 20 74 6f 20 62 65 s declared to be
25f0: 20 74 68 65 20 6c 61 73 74 20 74 72 75 6e 6b 20 the last trunk
2600: 63 68 61 6e 67 65 73 65 74 20 6f 6e 20 74 68 65 changeset on the
2610: 20 76 65 6e 64 6f 72 2d 62 72 61 6e 63 68 7d 0a vendor-branch}.
2620: 09 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 09 09 . } else {...
2630: 24 72 73 74 61 74 65 20 6e 65 77 20 3a 74 72 75 $rstate new :tru
2640: 6e 6b 3a 20 5b 24 6c 77 73 20 6e 61 6d 65 5d 0a nk: [$lws name].
2650: 09 20 20 20 20 7d 0a 09 7d 0a 0a 09 23 20 52 65 . }..}...# Re
2660: 6d 65 6d 62 65 72 20 74 68 65 20 77 68 6f 6c 65 member the whole
2670: 20 63 68 61 6e 67 65 73 65 74 20 2f 20 75 75 69 changeset / uui
2680: 64 20 6d 61 70 70 69 6e 67 2c 20 66 6f 72 20 74 d mapping, for t
2690: 68 65 20 74 61 67 73 2e 0a 0a 09 73 74 61 74 65 he tags....state
26a0: 20 72 75 6e 20 7b 0a 09 20 20 20 20 49 4e 53 45 run {.. INSE
26b0: 52 54 20 49 4e 54 4f 20 63 73 75 75 69 64 20 28 RT INTO csuuid (
26c0: 63 69 64 2c 20 20 20 75 75 69 64 29 0a 09 20 20 cid, uuid)..
26d0: 20 20 56 41 4c 55 45 53 20 20 20 20 20 20 20 20 VALUES
26e0: 20 20 20 20 20 28 24 6d 79 69 64 2c 20 24 75 75 ($myid, $uu
26f0: 69 64 29 0a 09 7d 0a 09 72 65 74 75 72 6e 0a 20 id)..}..return.
2700: 20 20 20 7d 0a 0a 20 20 20 20 70 72 6f 63 20 47 }.. proc G
2710: 65 74 72 65 76 69 73 69 6f 6e 69 6e 66 6f 20 7b etrevisioninfo {
2720: 72 65 76 69 73 69 6f 6e 73 7d 20 7b 0a 09 73 65 revisions} {..se
2730: 74 20 74 68 65 73 65 74 20 28 27 5b 6a 6f 69 6e t theset ('[join
2740: 20 24 72 65 76 69 73 69 6f 6e 73 20 7b 27 2c 27 $revisions {','
2750: 7d 5d 27 29 0a 09 73 65 74 20 72 65 76 69 73 69 }]')..set revisi
2760: 6f 6e 73 20 7b 7d 0a 09 73 74 61 74 65 20 66 6f ons {}..state fo
2770: 72 65 61 63 68 72 6f 77 20 5b 73 75 62 73 74 20 reachrow [subst
2780: 2d 6e 6f 63 6f 6d 6d 61 6e 64 73 20 2d 6e 6f 62 -nocommands -nob
2790: 61 63 6b 73 6c 61 73 68 65 73 20 7b 0a 09 20 20 ackslashes {..
27a0: 20 20 53 45 4c 45 43 54 20 55 2e 75 75 69 64 20 SELECT U.uuid
27b0: 20 20 20 41 53 20 66 72 69 64 2c 0a 09 20 20 20 AS frid,..
27c0: 20 20 20 20 20 20 20 20 46 2e 76 69 73 69 62 6c F.visibl
27d0: 65 20 41 53 20 70 61 74 68 2c 0a 09 20 20 20 20 e AS path,..
27e0: 20 20 20 20 20 20 20 46 2e 6e 61 6d 65 20 20 20 F.name
27f0: 20 41 53 20 66 6e 61 6d 65 2c 0a 09 20 20 20 20 AS fname,..
2800: 20 20 20 20 20 20 20 52 2e 72 65 76 20 20 20 20 R.rev
2810: 20 41 53 20 72 65 76 6e 72 2c 0a 09 20 20 20 20 AS revnr,..
2820: 20 20 20 20 20 20 20 52 2e 6f 70 20 20 20 20 20 R.op
2830: 20 41 53 20 72 6f 70 0a 09 20 20 20 20 46 52 4f AS rop.. FRO
2840: 4d 20 20 20 72 65 76 69 73 69 6f 6e 20 52 2c 20 M revision R,
2850: 72 65 76 75 75 69 64 20 55 2c 20 66 69 6c 65 20 revuuid U, file
2860: 46 0a 09 20 20 20 20 57 48 45 52 45 20 20 52 2e F.. WHERE R.
2870: 72 69 64 20 49 4e 20 24 74 68 65 73 65 74 20 20 rid IN $theset
2880: 2d 2d 20 41 6c 6c 20 73 70 65 63 69 66 69 65 64 -- All specified
2890: 20 72 65 76 69 73 69 6f 6e 73 0a 09 20 20 20 20 revisions..
28a0: 41 4e 44 20 20 20 20 55 2e 72 69 64 20 3d 20 52 AND U.rid = R
28b0: 2e 72 69 64 20 20 20 20 20 2d 2d 20 67 65 74 20 .rid -- get
28c0: 66 6f 73 73 69 6c 20 75 75 69 64 20 6f 66 20 72 fossil uuid of r
28d0: 65 76 69 73 69 6f 6e 0a 09 20 20 20 20 41 4e 44 evision.. AND
28e0: 20 20 20 20 46 2e 66 69 64 20 3d 20 52 2e 66 69 F.fid = R.fi
28f0: 64 20 20 20 20 20 2d 2d 20 67 65 74 20 66 69 6c d -- get fil
2900: 65 20 6f 66 20 72 65 76 69 73 69 6f 6e 0a 09 7d e of revision..}
2910: 5d 20 7b 0a 09 20 20 20 20 6c 61 70 70 65 6e 64 ] {.. lappend
2920: 20 72 65 76 69 73 69 6f 6e 73 20 24 66 72 69 64 revisions $frid
2930: 20 24 70 61 74 68 20 24 66 6e 61 6d 65 2f 24 72 $path $fname/$r
2940: 65 76 6e 72 20 24 72 6f 70 0a 09 7d 0a 09 72 65 evnr $rop..}..re
2950: 74 75 72 6e 20 24 72 65 76 69 73 69 6f 6e 73 0a turn $revisions.
2960: 20 20 20 20 7d 0a 0a 20 20 20 20 70 72 6f 63 20 }.. proc
2970: 47 65 74 77 6f 72 6b 73 70 61 63 65 20 7b 72 73 Getworkspace {rs
2980: 74 61 74 65 20 6c 6f 64 6e 61 6d 65 20 70 72 6f tate lodname pro
2990: 6a 65 63 74 20 69 73 64 65 66 61 75 6c 74 7d 20 ject isdefault}
29a0: 7b 0a 0a 09 23 20 54 68 65 20 73 74 61 74 65 20 {...# The state
29b0: 6f 62 6a 65 63 74 20 68 6f 6c 64 73 20 74 68 65 object holds the
29c0: 20 77 6f 72 6b 73 70 61 63 65 20 73 74 61 74 65 workspace state
29d0: 20 6f 66 20 65 61 63 68 20 6b 6e 6f 77 6e 0a 09 of each known..
29e0: 23 20 6c 69 6e 65 2d 6f 66 2d 64 65 76 65 6c 6f # line-of-develo
29f0: 70 6d 65 6e 74 20 28 4c 4f 44 29 2c 20 75 70 20 pment (LOD), up
2a00: 74 6f 20 74 68 65 20 6c 61 73 74 20 63 6f 6d 6d to the last comm
2a10: 69 74 74 65 64 0a 09 23 20 63 68 61 6e 67 65 73 itted..# changes
2a20: 65 74 20 62 65 6c 6f 6e 67 69 6e 67 20 74 6f 20 et belonging to
2a30: 74 68 61 74 20 4c 4f 44 2e 0a 0a 09 23 20 28 2a that LOD....# (*
2a40: 29 20 53 74 61 6e 64 61 72 64 20 68 61 6e 64 6c ) Standard handl
2a50: 69 6e 67 20 69 66 20 69 6e 2d 4c 4f 44 20 63 68 ing if in-LOD ch
2a60: 61 6e 67 65 73 65 74 73 2e 20 49 66 20 74 68 65 angesets. If the
2a70: 20 4c 4f 44 20 6f 66 0a 09 23 20 20 20 20 20 74 LOD of..# t
2a80: 68 65 20 63 75 72 72 65 6e 74 20 63 68 61 6e 67 he current chang
2a90: 65 73 65 74 20 65 78 69 73 74 73 20 69 6e 20 74 eset exists in t
2aa0: 68 65 20 73 74 61 74 65 20 28 3d 20 68 61 73 20 he state (= has
2ab0: 62 65 65 6e 0a 09 23 20 20 20 20 20 63 6f 6d 6d been..# comm
2ac0: 69 74 74 65 64 20 74 6f 29 20 74 68 65 6e 20 74 itted to) then t
2ad0: 68 69 73 20 69 74 20 68 61 73 20 74 68 65 20 77 his it has the w
2ae0: 6f 72 6b 73 70 61 63 65 20 77 65 20 61 72 65 0a orkspace we are.
2af0: 09 23 20 20 20 20 20 6c 6f 6f 6b 69 6e 67 20 66 .# looking f
2b00: 6f 72 2e 0a 0a 09 69 66 20 7b 5b 24 72 73 74 61 or....if {[$rsta
2b10: 74 65 20 68 61 73 20 24 6c 6f 64 6e 61 6d 65 5d te has $lodname]
2b20: 7d 20 7b 0a 09 20 20 20 20 72 65 74 75 72 6e 20 } {.. return
2b30: 5b 24 72 73 74 61 74 65 20 67 65 74 20 24 6c 6f [$rstate get $lo
2b40: 64 6e 61 6d 65 5d 0a 09 7d 0a 0a 09 23 20 49 66 dname]..}...# If
2b50: 20 74 68 65 20 4c 4f 44 20 69 73 20 68 6f 77 65 the LOD is howe
2b60: 76 65 72 20 6e 6f 74 20 79 65 74 20 6b 6e 6f 77 ver not yet know
2b70: 6e 2c 20 74 68 65 6e 20 74 68 65 20 63 75 72 72 n, then the curr
2b80: 65 6e 74 0a 09 23 20 63 68 61 6e 67 65 73 65 74 ent..# changeset
2b90: 20 63 61 6e 20 62 65 20 65 69 74 68 65 72 20 6f can be either o
2ba0: 66 0a 09 23 20 28 61 29 20 72 6f 6f 74 20 6f 66 f..# (a) root of
2bb0: 20 61 20 76 65 6e 64 6f 72 20 62 72 61 6e 63 68 a vendor branch
2bc0: 2c 0a 09 23 20 28 62 29 20 72 6f 6f 74 20 6f 66 ,..# (b) root of
2bd0: 20 74 68 65 20 74 72 75 6e 6b 20 4c 4f 44 2c 20 the trunk LOD,
2be0: 6f 72 0a 09 23 20 28 63 29 20 74 68 65 20 66 69 or..# (c) the fi
2bf0: 72 73 74 20 63 68 61 6e 67 65 73 65 74 20 69 6e rst changeset in
2c00: 20 61 20 6e 65 77 20 4c 4f 44 20 77 68 69 63 68 a new LOD which
2c10: 20 77 61 73 20 73 70 61 77 6e 65 64 20 66 72 6f was spawned fro
2c20: 6d 0a 09 23 20 20 20 20 20 61 6e 20 65 78 69 73 m..# an exis
2c30: 74 69 6e 67 20 4c 4f 44 2e 0a 0a 09 23 20 46 6f ting LOD....# Fo
2c40: 72 20 62 6f 74 68 20 28 61 29 20 61 6e 64 20 28 r both (a) and (
2c50: 62 29 20 77 65 20 68 61 76 65 20 74 6f 20 63 72 b) we have to cr
2c60: 65 61 74 65 20 61 20 6e 65 77 20 77 6f 72 6b 73 eate a new works
2c70: 70 61 63 65 20 66 6f 72 0a 09 23 20 74 68 65 20 pace for..# the
2c80: 6c 6f 64 2c 20 61 6e 64 20 69 74 20 64 6f 65 73 lod, and it does
2c90: 6e 27 74 20 69 6e 68 65 72 69 74 20 66 72 6f 6d n't inherit from
2ca0: 20 61 6e 79 74 68 69 6e 67 2e 0a 0a 09 23 20 4f anything....# O
2cb0: 6e 65 20 65 78 63 65 70 74 69 6f 6e 20 66 6f 72 ne exception for
2cc0: 20 28 61 29 2e 20 49 66 20 77 65 20 61 6c 72 65 (a). If we alre
2cd0: 61 64 79 20 68 61 76 65 20 61 20 3a 76 65 6e 64 ady have a :vend
2ce0: 6f 72 3a 20 62 72 61 6e 63 68 0a 09 23 20 74 68 or: branch..# th
2cf0: 65 6e 20 6d 75 6c 74 69 70 6c 65 20 73 79 6d 62 en multiple symb
2d00: 6f 6c 73 20 77 65 72 65 20 75 73 65 64 20 66 6f ols were used fo
2d10: 72 20 74 68 65 20 76 65 6e 64 6f 72 20 62 72 61 r the vendor bra
2d20: 6e 63 68 20 62 79 0a 09 23 20 64 69 66 66 65 72 nch by..# differ
2d30: 65 6e 74 20 66 69 6c 65 73 2e 20 49 6e 20 74 68 ent files. In th
2d40: 61 74 20 63 61 73 65 20 74 68 65 20 27 6e 65 77 at case the 'new
2d50: 27 20 62 72 61 6e 63 68 20 69 73 20 6d 61 64 65 ' branch is made
2d60: 20 61 6e 0a 09 23 20 61 6c 69 61 73 20 6f 66 20 an..# alias of
2d70: 74 68 65 20 3a 76 65 6e 64 6f 72 3a 2c 20 65 66 the :vendor:, ef
2d80: 66 65 63 74 69 76 65 6c 79 20 6d 65 72 67 69 6e fectively mergin
2d90: 67 20 74 68 65 20 73 79 6d 62 6f 6c 73 0a 09 23 g the symbols..#
2da0: 20 74 6f 67 65 74 68 65 72 2e 0a 0a 09 23 20 4e together....# N
2db0: 6f 74 65 20 74 68 61 74 20 63 61 73 65 20 28 62 ote that case (b
2dc0: 29 20 6d 61 79 20 6e 65 76 65 72 20 6f 63 63 75 ) may never occu
2dd0: 72 2e 20 53 65 65 20 74 68 65 20 76 61 72 69 61 r. See the varia
2de0: 62 6c 65 0a 09 23 20 27 6c 61 73 74 64 65 66 61 ble..# 'lastdefa
2df0: 75 6c 74 6f 6e 74 72 75 6e 6b 27 20 69 6e 20 74 ultontrunk' in t
2e00: 68 65 20 63 61 6c 6c 65 72 20 28 6d 65 74 68 6f he caller (metho
2e10: 64 20 70 75 73 68 74 6f 29 2e 20 54 68 69 73 0a d pushto). This.
2e20: 09 23 20 66 6c 61 67 20 63 61 6e 20 74 68 65 20 .# flag can the
2e30: 67 65 6e 65 72 61 74 69 6f 6e 20 6f 66 20 74 68 generation of th
2e40: 65 20 77 6f 72 6b 73 70 61 63 65 20 66 6f 72 20 e workspace for
2e50: 74 68 65 20 3a 74 72 75 6e 6b 3a 20 4c 4f 44 0a the :trunk: LOD.
2e60: 09 23 20 61 73 20 77 65 6c 6c 2c 20 6d 61 6b 69 .# as well, maki
2e70: 6e 67 20 69 74 20 69 6e 68 65 72 69 74 20 74 68 ng it inherit th
2e80: 65 20 73 74 61 74 65 20 6f 66 20 74 68 65 20 6c e state of the l
2e90: 61 73 74 0a 09 23 20 74 72 75 6e 6b 2d 63 68 61 ast..# trunk-cha
2ea0: 6e 67 65 73 65 74 20 6f 6e 20 74 68 65 20 76 65 ngeset on the ve
2eb0: 6e 64 6f 72 2d 62 72 61 6e 63 68 2e 0a 0a 09 69 ndor-branch....i
2ec0: 66 20 7b 24 69 73 64 65 66 61 75 6c 74 7d 20 7b f {$isdefault} {
2ed0: 0a 09 20 20 20 20 69 66 20 7b 21 5b 24 72 73 74 .. if {![$rst
2ee0: 61 74 65 20 68 61 73 20 22 3a 76 65 6e 64 6f 72 ate has ":vendor
2ef0: 3a 22 5d 7d 20 7b 0a 09 09 23 20 43 72 65 61 74 :"]} {...# Creat
2f00: 65 20 74 68 65 20 76 65 6e 64 6f 72 20 62 72 61 e the vendor bra
2f10: 6e 63 68 20 69 66 20 6e 6f 74 20 70 72 65 73 65 nch if not prese
2f20: 6e 74 20 61 6c 72 65 61 64 79 2e 0a 09 09 24 72 nt already....$r
2f30: 73 74 61 74 65 20 6e 65 77 20 3a 76 65 6e 64 6f state new :vendo
2f40: 72 3a 0a 09 20 20 20 20 7d 0a 09 20 20 20 20 23 r:.. }.. #
2f50: 20 4d 65 72 67 65 20 74 68 65 20 6e 65 77 20 73 Merge the new s
2f60: 79 6d 62 6f 6c 20 74 6f 20 74 68 65 20 76 65 6e ymbol to the ven
2f70: 64 6f 72 20 62 72 61 6e 63 68 0a 09 20 20 20 20 dor branch..
2f80: 24 72 73 74 61 74 65 20 64 75 70 20 24 6c 6f 64 $rstate dup $lod
2f90: 6e 61 6d 65 20 3c 2d 2d 20 3a 76 65 6e 64 6f 72 name <-- :vendor
2fa0: 3a 0a 09 20 20 20 20 72 65 74 75 72 6e 20 5b 24 :.. return [$
2fb0: 72 73 74 61 74 65 20 67 65 74 20 24 6c 6f 64 6e rstate get $lodn
2fc0: 61 6d 65 5d 0a 09 7d 0a 0a 09 69 66 20 7b 24 6c ame]..}...if {$l
2fd0: 6f 64 6e 61 6d 65 20 65 71 20 22 3a 74 72 75 6e odname eq ":trun
2fe0: 6b 3a 22 7d 20 7b 0a 09 20 20 20 20 72 65 74 75 k:"} {.. retu
2ff0: 72 6e 20 5b 24 72 73 74 61 74 65 20 6e 65 77 20 rn [$rstate new
3000: 24 6c 6f 64 6e 61 6d 65 5d 0a 09 7d 0a 0a 09 23 $lodname]..}...#
3010: 20 43 61 73 65 20 28 63 29 2e 20 57 65 20 66 69 Case (c). We fi
3020: 6e 64 20 74 68 65 20 70 61 72 65 6e 74 20 4c 4f nd the parent LO
3030: 44 20 6f 66 20 6f 75 72 20 4c 4f 44 20 61 6e 64 D of our LOD and
3040: 20 6c 65 74 20 74 68 65 20 6e 65 77 0a 09 23 20 let the new..#
3050: 77 6f 72 6b 73 70 61 63 65 20 69 6e 68 65 72 69 workspace inheri
3060: 74 20 66 72 6f 6d 20 74 68 65 20 70 61 72 65 6e t from the paren
3070: 74 27 73 20 77 6f 72 6b 73 70 61 63 65 2e 0a 0a t's workspace...
3080: 09 73 65 74 20 70 6c 6f 64 6e 61 6d 65 20 5b 5b .set plodname [[
3090: 5b 24 70 72 6f 6a 65 63 74 20 67 65 74 73 79 6d [$project getsym
30a0: 62 6f 6c 20 24 6c 6f 64 6e 61 6d 65 5d 20 70 61 bol $lodname] pa
30b0: 72 65 6e 74 5d 20 6e 61 6d 65 5d 0a 0a 09 6c 6f rent] name]...lo
30c0: 67 20 77 72 69 74 65 20 38 20 63 73 65 74 73 20 g write 8 csets
30d0: 7b 70 4c 4f 44 20 20 20 27 24 70 6c 6f 64 6e 61 {pLOD '$plodna
30e0: 6d 65 27 7d 0a 0a 09 69 66 20 7b 5b 24 72 73 74 me'}...if {[$rst
30f0: 61 74 65 20 68 61 73 20 24 70 6c 6f 64 6e 61 6d ate has $plodnam
3100: 65 5d 7d 20 7b 0a 09 20 20 20 20 72 65 74 75 72 e]} {.. retur
3110: 6e 20 5b 24 72 73 74 61 74 65 20 6e 65 77 20 24 n [$rstate new $
3120: 6c 6f 64 6e 61 6d 65 20 24 70 6c 6f 64 6e 61 6d lodname $plodnam
3130: 65 5d 0a 09 7d 0a 0a 09 66 6f 72 65 61 63 68 20 e]..}...foreach
3140: 6b 20 5b 6c 73 6f 72 74 20 5b 24 72 73 74 61 74 k [lsort [$rstat
3150: 65 20 6e 61 6d 65 73 5d 5d 20 7b 0a 09 20 20 20 e names]] {..
3160: 20 6c 6f 67 20 77 72 69 74 65 20 38 20 63 73 65 log write 8 cse
3170: 74 73 20 7b 20 20 20 20 24 6b 20 3d 20 5b 5b 24 ts { $k = [[$
3180: 72 73 74 61 74 65 20 67 65 74 20 24 6b 5d 20 67 rstate get $k] g
3190: 65 74 69 64 5d 7d 0a 09 7d 0a 0a 09 74 72 6f 75 etid]}..}...trou
31a0: 62 6c 65 20 69 6e 74 65 72 6e 61 6c 20 7b 55 6e ble internal {Un
31b0: 61 62 6c 65 20 74 6f 20 64 65 74 65 72 6d 69 6e able to determin
31c0: 65 20 63 68 61 6e 67 65 73 65 74 20 70 61 72 65 e changeset pare
31d0: 6e 74 7d 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 nt}..return.
31e0: 7d 0a 0a 20 20 20 20 70 72 6f 63 20 47 65 74 69 }.. proc Geti
31f0: 73 64 65 66 61 75 6c 74 20 7b 72 65 76 69 73 69 sdefault {revisi
3200: 6f 6e 73 7d 20 7b 0a 09 73 65 74 20 74 68 65 73 ons} {..set thes
3210: 65 74 20 28 27 5b 6a 6f 69 6e 20 24 72 65 76 69 et ('[join $revi
3220: 73 69 6f 6e 73 20 7b 27 2c 27 7d 5d 27 29 0a 0a sions {','}]')..
3230: 09 73 74 72 75 63 74 3a 3a 6c 69 73 74 20 61 73 .struct::list as
3240: 73 69 67 6e 20 5b 73 74 61 74 65 20 72 75 6e 20 sign [state run
3250: 5b 73 75 62 73 74 20 2d 6e 6f 63 6f 6d 6d 61 6e [subst -nocomman
3260: 64 73 20 2d 6e 6f 62 61 63 6b 73 6c 61 73 68 65 ds -nobackslashe
3270: 73 20 7b 0a 09 20 20 20 20 53 45 4c 45 43 54 20 s {.. SELECT
3280: 52 2e 69 73 64 65 66 61 75 6c 74 2c 20 52 2e 64 R.isdefault, R.d
3290: 62 63 68 69 6c 64 0a 09 20 20 20 20 46 52 4f 4d bchild.. FROM
32a0: 20 20 20 72 65 76 69 73 69 6f 6e 20 52 0a 09 20 revision R..
32b0: 20 20 20 57 48 45 52 45 20 20 52 2e 72 69 64 20 WHERE R.rid
32c0: 49 4e 20 24 74 68 65 73 65 74 20 20 2d 2d 20 41 IN $theset -- A
32d0: 6c 6c 20 73 70 65 63 69 66 69 65 64 20 72 65 76 ll specified rev
32e0: 69 73 69 6f 6e 73 0a 09 20 20 20 20 4c 49 4d 49 isions.. LIMI
32f0: 54 20 31 0a 09 7d 5d 5d 20 64 65 66 20 6c 61 73 T 1..}]] def las
3300: 74 0a 0a 09 23 20 54 4f 44 4f 2f 43 48 45 43 4b t...# TODO/CHECK
3310: 3a 20 6c 6f 6f 6b 20 66 6f 72 20 63 68 61 6e 67 : look for chang
3320: 65 73 65 74 73 20 77 68 65 72 65 20 69 73 64 65 esets where isde
3330: 66 61 75 6c 74 2f 64 62 63 68 69 6c 64 20 69 73 fault/dbchild is
3340: 0a 09 23 20 61 6d 62 69 67 6f 75 73 2e 0a 0a 09 ..# ambigous....
3350: 72 65 74 75 72 6e 20 5b 6c 69 73 74 20 24 64 65 return [list $de
3360: 66 20 5b 65 78 70 72 20 7b 24 6c 61 73 74 20 6e f [expr {$last n
3370: 65 20 22 22 7d 5d 5d 0a 20 20 20 20 7d 0a 0a 20 e ""}]]. }..
3380: 20 20 20 74 79 70 65 6d 65 74 68 6f 64 20 73 70 typemethod sp
3390: 6c 69 74 20 7b 63 73 65 74 20 61 72 67 73 7d 20 lit {cset args}
33a0: 7b 0a 09 23 20 41 73 20 70 61 72 74 20 6f 66 20 {..# As part of
33b0: 74 68 65 20 63 72 65 61 74 69 6f 6e 20 6f 66 20 the creation of
33c0: 74 68 65 20 6e 65 77 20 63 68 61 6e 67 65 73 65 the new changese
33d0: 74 73 20 73 70 65 63 69 66 69 65 64 20 69 6e 0a ts specified in.
33e0: 09 23 20 41 52 47 53 20 61 73 20 73 65 74 73 20 .# ARGS as sets
33f0: 6f 66 20 69 74 65 6d 73 2c 20 61 6c 6c 20 73 75 of items, all su
3400: 62 73 65 74 73 20 6f 66 20 43 53 45 54 27 73 20 bsets of CSET's
3410: 69 74 65 6d 20 73 65 74 2c 20 43 53 45 54 0a 09 item set, CSET..
3420: 23 20 77 69 6c 6c 20 62 65 20 64 72 6f 70 70 65 # will be droppe
3430: 64 20 66 72 6f 6d 20 61 6c 6c 20 64 61 74 61 62 d from all datab
3440: 61 73 65 73 2c 20 69 6e 20 61 6e 64 20 6f 75 74 ases, in and out
3450: 20 6f 66 20 6d 65 6d 6f 72 79 2c 0a 09 23 20 61 of memory,..# a
3460: 6e 64 20 74 68 65 6e 20 64 65 73 74 72 6f 79 65 nd then destroye
3470: 64 2e 0a 09 23 0a 09 23 20 4e 6f 74 65 3a 20 54 d...#..# Note: T
3480: 68 65 20 69 74 65 6d 20 6c 69 73 74 73 20 66 6f he item lists fo
3490: 75 6e 64 20 69 6e 20 61 72 67 73 20 61 72 65 20 und in args are
34a0: 74 61 67 67 65 64 20 69 74 65 6d 73 2e 20 54 68 tagged items. Th
34b0: 65 79 0a 09 23 20 68 61 76 65 20 74 6f 20 68 61 ey..# have to ha
34c0: 76 65 20 74 68 65 20 73 61 6d 65 20 74 79 70 65 ve the same type
34d0: 20 61 73 20 74 68 65 20 63 68 61 6e 67 65 73 65 as the changese
34e0: 74 2c 20 62 65 69 6e 67 20 73 75 62 73 65 74 73 t, being subsets
34f0: 0a 09 23 20 6f 66 20 69 74 73 20 69 74 65 6d 73 ..# of its items
3500: 2e 20 54 68 69 73 20 69 73 20 63 68 65 63 6b 65 . This is checke
3510: 64 20 69 6e 20 55 6e 74 61 67 31 2e 0a 0a 09 6c d in Untag1....l
3520: 6f 67 20 77 72 69 74 65 20 38 20 63 73 65 74 73 og write 8 csets
3530: 20 7b 4f 4c 44 3a 20 5b 6c 73 6f 72 74 20 5b 24 {OLD: [lsort [$
3540: 63 73 65 74 20 69 74 65 6d 73 5d 5d 7d 0a 09 56 cset items]]}..V
3550: 61 6c 69 64 61 74 65 46 72 61 67 6d 65 6e 74 73 alidateFragments
3560: 20 24 63 73 65 74 20 24 61 72 67 73 0a 0a 09 23 $cset $args...#
3570: 20 41 6c 6c 20 63 68 65 63 6b 73 20 70 61 73 73 All checks pass
3580: 2c 20 61 63 74 75 61 6c 6c 79 20 70 65 72 66 6f , actually perfo
3590: 72 6d 20 74 68 65 20 73 70 6c 69 74 2e 0a 0a 09 rm the split....
35a0: 73 74 72 75 63 74 3a 3a 6c 69 73 74 20 61 73 73 struct::list ass
35b0: 69 67 6e 20 5b 24 63 73 65 74 20 64 61 74 61 5d ign [$cset data]
35c0: 20 70 72 6f 6a 65 63 74 20 63 73 74 79 70 65 20 project cstype
35d0: 63 73 73 72 63 0a 0a 09 73 65 74 20 70 72 65 64 cssrc...set pred
35e0: 65 63 65 73 73 6f 72 73 20 5b 24 63 73 65 74 20 ecessors [$cset
35f0: 64 72 6f 70 5d 0a 09 24 63 73 65 74 20 64 65 73 drop]..$cset des
3600: 74 72 6f 79 0a 0a 09 73 65 74 20 6e 65 77 63 73 troy...set newcs
3610: 65 74 73 20 7b 7d 0a 09 66 6f 72 65 61 63 68 20 ets {}..foreach
3620: 66 72 61 67 6d 65 6e 74 69 74 65 6d 73 20 24 61 fragmentitems $a
3630: 72 67 73 20 7b 0a 09 20 20 20 20 6c 6f 67 20 77 rgs {.. log w
3640: 72 69 74 65 20 38 20 63 73 65 74 73 20 7b 4d 41 rite 8 csets {MA
3650: 4b 45 3a 20 5b 6c 73 6f 72 74 20 24 66 72 61 67 KE: [lsort $frag
3660: 6d 65 6e 74 69 74 65 6d 73 5d 7d 0a 0a 09 20 20 mentitems]}...
3670: 20 20 73 65 74 20 66 72 61 67 6d 65 6e 74 20 5b set fragment [
3680: 24 74 79 70 65 20 25 41 55 54 4f 25 20 24 70 72 $type %AUTO% $pr
3690: 6f 6a 65 63 74 20 24 63 73 74 79 70 65 20 24 63 oject $cstype $c
36a0: 73 73 72 63 20 5c 0a 09 09 09 20 20 20 20 20 20 ssrc \....
36b0: 5b 55 6e 74 61 67 20 24 66 72 61 67 6d 65 6e 74 [Untag $fragment
36c0: 69 74 65 6d 73 20 24 63 73 74 79 70 65 5d 5d 0a items $cstype]].
36d0: 09 20 20 20 20 6c 61 70 70 65 6e 64 20 6e 65 77 . lappend new
36e0: 63 73 65 74 73 20 24 66 72 61 67 6d 65 6e 74 0a csets $fragment.
36f0: 0a 09 20 20 20 20 24 66 72 61 67 6d 65 6e 74 20 .. $fragment
3700: 70 65 72 73 69 73 74 0a 09 20 20 20 20 24 66 72 persist.. $fr
3710: 61 67 6d 65 6e 74 20 64 65 74 65 72 6d 69 6e 65 agment determine
3720: 73 75 63 63 65 73 73 6f 72 73 0a 09 7d 0a 0a 09 successors..}...
3730: 23 20 54 68 65 20 70 72 65 64 65 63 65 73 73 6f # The predecesso
3740: 72 73 20 68 61 76 65 20 74 6f 20 72 65 63 6f 6d rs have to recom
3750: 70 75 74 65 20 74 68 65 69 72 20 73 75 63 63 65 pute their succe
3760: 73 73 6f 72 73 2c 20 69 2e 65 2e 0a 09 23 20 72 ssors, i.e...# r
3770: 65 6d 6f 76 65 20 74 68 65 20 64 72 6f 70 70 65 emove the droppe
3780: 64 20 63 68 61 6e 67 65 73 65 74 20 61 6e 64 20 d changeset and
3790: 70 75 74 20 6f 6e 65 20 6f 66 20 74 68 65 20 66 put one of the f
37a0: 72 61 67 6d 65 6e 74 73 0a 09 23 20 69 6e 74 6f ragments..# into
37b0: 20 69 74 73 20 70 6c 61 63 65 2e 0a 09 66 6f 72 its place...for
37c0: 65 61 63 68 20 70 20 24 70 72 65 64 65 63 65 73 each p $predeces
37d0: 73 6f 72 73 20 7b 0a 09 20 20 20 20 24 70 20 64 sors {.. $p d
37e0: 65 74 65 72 6d 69 6e 65 73 75 63 63 65 73 73 6f eterminesuccesso
37f0: 72 73 0a 09 7d 0a 0a 09 72 65 74 75 72 6e 20 24 rs..}...return $
3800: 6e 65 77 63 73 65 74 73 0a 20 20 20 20 7d 0a 0a newcsets. }..
3810: 20 20 20 20 74 79 70 65 6d 65 74 68 6f 64 20 69 typemethod i
3820: 74 65 6d 73 74 72 20 7b 69 74 65 6d 7d 20 7b 0a temstr {item} {.
3830: 09 73 74 72 75 63 74 3a 3a 6c 69 73 74 20 61 73 .struct::list as
3840: 73 69 67 6e 20 24 69 74 65 6d 20 69 74 79 70 65 sign $item itype
3850: 20 69 69 64 0a 09 72 65 74 75 72 6e 20 5b 24 69 iid..return [$i
3860: 74 79 70 65 20 73 74 72 20 24 69 69 64 5d 0a 20 type str $iid].
3870: 20 20 20 7d 0a 0a 20 20 20 20 74 79 70 65 6d 65 }.. typeme
3880: 74 68 6f 64 20 73 74 72 6c 69 73 74 20 7b 63 68 thod strlist {ch
3890: 61 6e 67 65 73 65 74 73 7d 20 7b 0a 09 72 65 74 angesets} {..ret
38a0: 75 72 6e 20 5b 6a 6f 69 6e 20 5b 73 74 72 75 63 urn [join [struc
38b0: 74 3a 3a 6c 69 73 74 20 6d 61 70 20 24 63 68 61 t::list map $cha
38c0: 6e 67 65 73 65 74 73 20 5b 6d 79 70 72 6f 63 20 ngesets [myproc
38d0: 49 44 5d 5d 5d 0a 20 20 20 20 7d 0a 0a 20 20 20 ID]]]. }..
38e0: 20 70 72 6f 63 20 49 44 20 7b 63 73 65 74 7d 20 proc ID {cset}
38f0: 7b 20 24 63 73 65 74 20 73 74 72 20 7d 0a 0a 20 { $cset str }..
3900: 20 20 20 70 72 6f 63 20 55 6e 74 61 67 20 7b 74 proc Untag {t
3910: 61 67 67 65 64 69 74 65 6d 73 20 63 73 74 79 70 aggeditems cstyp
3920: 65 7d 20 7b 0a 09 72 65 74 75 72 6e 20 5b 73 74 e} {..return [st
3930: 72 75 63 74 3a 3a 6c 69 73 74 20 6d 61 70 20 24 ruct::list map $
3940: 74 61 67 67 65 64 69 74 65 6d 73 20 5b 6d 79 70 taggeditems [myp
3950: 72 6f 63 20 55 6e 74 61 67 31 20 24 63 73 74 79 roc Untag1 $csty
3960: 70 65 5d 5d 0a 20 20 20 20 7d 0a 0a 20 20 20 20 pe]]. }..
3970: 70 72 6f 63 20 55 6e 74 61 67 31 20 7b 63 73 74 proc Untag1 {cst
3980: 79 70 65 20 74 68 65 69 74 65 6d 7d 20 7b 0a 09 ype theitem} {..
3990: 73 74 72 75 63 74 3a 3a 6c 69 73 74 20 61 73 73 struct::list ass
39a0: 69 67 6e 20 24 74 68 65 69 74 65 6d 20 74 20 69 ign $theitem t i
39b0: 0a 09 69 6e 74 65 67 72 69 74 79 20 61 73 73 65 ..integrity asse
39c0: 72 74 20 7b 24 63 73 74 79 70 65 20 65 71 20 24 rt {$cstype eq $
39d0: 74 7d 20 7b 49 74 65 6d 20 24 69 27 73 20 74 79 t} {Item $i's ty
39e0: 70 65 20 69 73 20 27 24 74 27 2c 20 65 78 70 65 pe is '$t', expe
39f0: 63 74 65 64 20 27 24 63 73 74 79 70 65 27 7d 0a cted '$cstype'}.
3a00: 09 72 65 74 75 72 6e 20 24 69 0a 20 20 20 20 7d .return $i. }
3a10: 0a 0a 20 20 20 20 70 72 6f 63 20 54 61 67 49 74 .. proc TagIt
3a20: 65 6d 44 69 63 74 20 7b 69 74 65 6d 64 69 63 74 emDict {itemdict
3a30: 20 63 73 74 79 70 65 7d 20 7b 0a 09 73 65 74 20 cstype} {..set
3a40: 72 65 73 20 7b 7d 0a 09 66 6f 72 65 61 63 68 20 res {}..foreach
3a50: 7b 69 20 76 7d 20 24 69 74 65 6d 64 69 63 74 20 {i v} $itemdict
3a60: 7b 20 6c 61 70 70 65 6e 64 20 72 65 73 20 5b 6c { lappend res [l
3a70: 69 73 74 20 24 63 73 74 79 70 65 20 24 69 5d 20 ist $cstype $i]
3a80: 24 76 20 7d 0a 09 72 65 74 75 72 6e 20 24 72 65 $v }..return $re
3a90: 73 0a 20 20 20 20 7d 0a 0a 20 20 20 20 70 72 6f s. }.. pro
3aa0: 63 20 56 61 6c 69 64 61 74 65 46 72 61 67 6d 65 c ValidateFragme
3ab0: 6e 74 73 20 7b 63 73 65 74 20 66 72 61 67 6d 65 nts {cset fragme
3ac0: 6e 74 73 7d 20 7b 0a 09 23 20 43 68 65 63 6b 20 nts} {..# Check
3ad0: 74 68 65 20 76 61 72 69 6f 75 73 20 69 6e 74 65 the various inte
3ae0: 67 72 69 74 79 20 63 6f 6e 73 74 72 61 69 6e 74 grity constraint
3af0: 73 20 66 6f 72 20 74 68 65 20 66 72 61 67 6d 65 s for the fragme
3b00: 6e 74 73 0a 09 23 20 73 70 65 63 69 66 79 69 6e nts..# specifyin
3b10: 67 20 68 6f 77 20 74 6f 20 73 70 6c 69 74 20 74 g how to split t
3b20: 68 65 20 63 68 61 6e 67 65 73 65 74 3a 0a 09 23 he changeset:..#
3b30: 0a 09 23 20 2a 20 57 65 20 6d 75 73 74 20 68 61 ..# * We must ha
3b40: 76 65 20 74 77 6f 20 6f 72 20 6d 6f 72 65 20 66 ve two or more f
3b50: 72 61 67 6d 65 6e 74 73 2c 20 61 73 20 73 70 6c ragments, as spl
3b60: 69 74 74 69 6e 67 20 61 0a 09 23 20 20 20 63 68 itting a..# ch
3b70: 61 6e 67 65 73 65 74 20 69 6e 74 6f 20 6f 6e 65 angeset into one
3b80: 20 6d 61 6b 65 73 20 6e 6f 20 73 65 6e 73 65 2e makes no sense.
3b90: 0a 09 23 20 2a 20 4e 6f 20 66 72 61 67 6d 65 6e ..# * No fragmen
3ba0: 74 20 6d 61 79 20 62 65 20 65 6d 70 74 79 2e 0a t may be empty..
3bb0: 09 23 20 2a 20 41 6c 6c 20 66 72 61 67 6d 65 6e .# * All fragmen
3bc0: 74 73 20 68 61 76 65 20 74 6f 20 62 65 20 74 72 ts have to be tr
3bd0: 75 65 20 73 75 62 73 65 74 73 20 6f 66 20 74 68 ue subsets of th
3be0: 65 20 69 74 65 6d 73 20 69 6e 20 74 68 65 0a 09 e items in the..
3bf0: 23 20 20 20 63 68 61 6e 67 65 73 65 74 20 74 6f # changeset to
3c00: 20 73 70 6c 69 74 2e 20 54 68 65 20 27 74 72 75 split. The 'tru
3c10: 65 27 20 69 73 20 69 6d 70 6c 69 65 64 20 62 65 e' is implied be
3c20: 63 61 75 73 65 20 6e 6f 6e 65 20 61 72 65 0a 09 cause none are..
3c30: 23 20 20 20 61 6c 6c 6f 77 65 64 20 74 6f 20 62 # allowed to b
3c40: 65 20 65 6d 70 74 79 2c 20 73 6f 20 65 61 63 68 e empty, so each
3c50: 20 68 61 73 20 74 6f 20 62 65 20 73 6d 61 6c 6c has to be small
3c60: 65 72 20 74 68 61 6e 20 74 68 65 0a 09 23 20 20 er than the..#
3c70: 20 74 6f 74 61 6c 2e 0a 09 23 20 2a 20 54 68 65 total...# * The
3c80: 20 75 6e 69 6f 6e 20 6f 66 20 74 68 65 20 66 72 union of the fr
3c90: 61 67 6d 65 6e 74 73 20 68 61 73 20 74 6f 20 62 agments has to b
3ca0: 65 20 74 68 65 20 69 74 65 6d 20 73 65 74 20 6f e the item set o
3cb0: 66 20 74 68 65 0a 09 23 20 20 20 63 68 61 6e 67 f the..# chang
3cc0: 65 73 65 74 2e 0a 09 23 20 2a 20 54 68 65 20 66 eset...# * The f
3cd0: 72 61 67 6d 65 6e 74 20 6d 75 73 74 20 6e 6f 74 ragment must not
3ce0: 20 6f 76 65 72 6c 61 70 2c 20 69 2e 65 2e 20 74 overlap, i.e. t
3cf0: 68 65 69 72 20 70 61 69 72 77 69 73 65 0a 09 23 heir pairwise..#
3d00: 20 20 20 69 6e 74 65 72 73 65 63 74 69 6f 6e 73 intersections
3d10: 20 68 61 76 65 20 74 6f 20 62 65 20 65 6d 70 74 have to be empt
3d20: 79 2e 0a 0a 09 73 65 74 20 63 6f 76 65 72 20 7b y....set cover {
3d30: 7d 0a 09 66 6f 72 65 61 63 68 20 66 72 61 67 6d }..foreach fragm
3d40: 65 6e 74 69 74 65 6d 73 20 24 66 72 61 67 6d 65 entitems $fragme
3d50: 6e 74 73 20 7b 0a 09 20 20 20 20 6c 6f 67 20 77 nts {.. log w
3d60: 72 69 74 65 20 38 20 63 73 65 74 73 20 7b 4e 45 rite 8 csets {NE
3d70: 57 3a 20 5b 6c 73 6f 72 74 20 24 66 72 61 67 6d W: [lsort $fragm
3d80: 65 6e 74 69 74 65 6d 73 5d 7d 0a 0a 09 20 20 20 entitems]}...
3d90: 20 69 6e 74 65 67 72 69 74 79 20 61 73 73 65 72 integrity asser
3da0: 74 20 7b 0a 09 09 21 5b 73 74 72 75 63 74 3a 3a t {...![struct::
3db0: 73 65 74 20 65 6d 70 74 79 20 24 66 72 61 67 6d set empty $fragm
3dc0: 65 6e 74 69 74 65 6d 73 5d 0a 09 20 20 20 20 7d entitems].. }
3dd0: 20 7b 63 68 61 6e 67 65 73 65 74 20 66 72 61 67 {changeset frag
3de0: 6d 65 6e 74 20 69 73 20 65 6d 70 74 79 7d 0a 0a ment is empty}..
3df0: 09 20 20 20 20 69 6e 74 65 67 72 69 74 79 20 61 . integrity a
3e00: 73 73 65 72 74 20 7b 0a 09 09 5b 73 74 72 75 63 ssert {...[struc
3e10: 74 3a 3a 73 65 74 20 73 75 62 73 65 74 6f 66 20 t::set subsetof
3e20: 24 66 72 61 67 6d 65 6e 74 69 74 65 6d 73 20 5b $fragmentitems [
3e30: 24 63 73 65 74 20 69 74 65 6d 73 5d 5d 0a 09 20 $cset items]]..
3e40: 20 20 20 7d 20 7b 63 68 61 6e 67 65 73 65 74 20 } {changeset
3e50: 66 72 61 67 6d 65 6e 74 20 69 73 20 6e 6f 74 20 fragment is not
3e60: 61 20 73 75 62 73 65 74 7d 0a 09 20 20 20 20 73 a subset}.. s
3e70: 74 72 75 63 74 3a 3a 73 65 74 20 61 64 64 20 63 truct::set add c
3e80: 6f 76 65 72 20 24 66 72 61 67 6d 65 6e 74 69 74 over $fragmentit
3e90: 65 6d 73 0a 09 7d 0a 0a 09 69 6e 74 65 67 72 69 ems..}...integri
3ea0: 74 79 20 61 73 73 65 72 74 20 7b 0a 09 20 20 20 ty assert {..
3eb0: 20 5b 73 74 72 75 63 74 3a 3a 73 65 74 20 65 71 [struct::set eq
3ec0: 75 61 6c 20 24 63 6f 76 65 72 20 5b 24 63 73 65 ual $cover [$cse
3ed0: 74 20 69 74 65 6d 73 5d 5d 0a 09 20 7d 20 7b 54 t items]].. } {T
3ee0: 68 65 20 66 72 61 67 6d 65 6e 74 73 20 64 6f 20 he fragments do
3ef0: 6e 6f 74 20 63 6f 76 65 72 20 74 68 65 20 6f 72 not cover the or
3f00: 69 67 69 6e 61 6c 20 63 68 61 6e 67 65 73 65 74 iginal changeset
3f10: 7d 0a 0a 09 73 65 74 20 69 20 31 0a 09 66 6f 72 }...set i 1..for
3f20: 65 61 63 68 20 66 69 61 20 24 66 72 61 67 6d 65 each fia $fragme
3f30: 6e 74 73 20 7b 0a 09 20 20 20 20 66 6f 72 65 61 nts {.. forea
3f40: 63 68 20 66 69 62 20 5b 6c 72 61 6e 67 65 20 24 ch fib [lrange $
3f50: 66 72 61 67 6d 65 6e 74 73 20 24 69 20 65 6e 64 fragments $i end
3f60: 5d 20 7b 0a 09 09 69 6e 74 65 67 72 69 74 79 20 ] {...integrity
3f70: 61 73 73 65 72 74 20 7b 0a 09 09 20 20 20 20 5b assert {... [
3f80: 73 74 72 75 63 74 3a 3a 73 65 74 20 65 6d 70 74 struct::set empt
3f90: 79 20 5b 73 74 72 75 63 74 3a 3a 73 65 74 20 69 y [struct::set i
3fa0: 6e 74 65 72 73 65 63 74 20 24 66 69 61 20 24 66 ntersect $fia $f
3fb0: 69 62 5d 5d 0a 09 09 7d 20 7b 54 68 65 20 66 72 ib]]...} {The fr
3fc0: 61 67 6d 65 6e 74 73 20 3c 24 66 69 61 3e 20 61 agments <$fia> a
3fd0: 6e 64 20 3c 24 66 69 62 3e 20 6f 76 65 72 6c 61 nd <$fib> overla
3fe0: 70 7d 0a 09 20 20 20 20 7d 0a 09 20 20 20 20 69 p}.. }.. i
3ff0: 6e 63 72 20 69 0a 09 7d 0a 0a 09 72 65 74 75 72 ncr i..}...retur
4000: 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 23 20 23 n. }.. # #
4010: 20 23 23 20 23 23 23 20 23 23 23 23 23 20 23 23 ## ### ##### ##
4020: 23 23 23 23 23 23 20 23 23 23 23 23 23 23 23 23 ###### #########
4030: 23 23 23 23 0a 20 20 20 20 23 23 20 53 74 61 74 ####. ## Stat
4040: 65 0a 0a 20 20 20 20 76 61 72 69 61 62 6c 65 20 e.. variable
4050: 6d 79 69 64 20 20 20 20 20 20 20 20 7b 7d 20 3b myid {} ;
4060: 20 23 20 49 64 20 6f 66 20 74 68 65 20 63 73 65 # Id of the cse
4070: 74 20 66 6f 72 20 74 68 65 20 70 65 72 73 69 73 t for the persis
4080: 74 65 6e 74 0a 09 09 09 20 20 20 20 20 20 23 20 tent.... #
4090: 73 74 61 74 65 2e 0a 20 20 20 20 76 61 72 69 61 state.. varia
40a0: 62 6c 65 20 6d 79 70 72 6f 6a 65 63 74 20 20 20 ble myproject
40b0: 7b 7d 20 3b 20 23 20 52 65 66 65 72 65 6e 63 65 {} ; # Reference
40c0: 20 6f 66 20 74 68 65 20 70 72 6f 6a 65 63 74 20 of the project
40d0: 6f 62 6a 65 63 74 20 74 68 65 0a 09 09 09 20 20 object the....
40e0: 20 20 20 20 23 20 63 68 61 6e 67 65 73 65 74 20 # changeset
40f0: 62 65 6c 6f 6e 67 73 20 74 6f 2e 0a 20 20 20 20 belongs to..
4100: 76 61 72 69 61 62 6c 65 20 6d 79 74 79 70 65 20 variable mytype
4110: 20 20 20 20 20 7b 7d 20 3b 20 23 20 57 68 61 74 {} ; # What
4120: 20 74 68 65 20 63 68 61 6e 67 65 73 65 74 20 69 the changeset i
4130: 73 20 62 61 73 65 64 20 6f 6e 0a 09 09 09 20 20 s based on....
4140: 20 20 20 20 23 20 28 72 65 76 69 73 69 6f 6e 73 # (revisions
4150: 2c 20 74 61 67 73 2c 20 6f 72 20 62 72 61 6e 63 , tags, or branc
4160: 68 65 73 29 2e 0a 09 09 09 20 20 20 20 20 20 23 hes)..... #
4170: 20 56 61 6c 75 65 73 3a 20 53 65 65 20 6d 79 63 Values: See myc
4180: 73 74 79 70 65 2e 20 4e 6f 74 65 20 74 68 61 74 stype. Note that
4190: 20 77 65 0a 09 09 09 20 20 20 20 20 20 23 20 68 we.... # h
41a0: 61 76 65 20 74 6f 20 6b 65 65 70 20 74 68 65 20 ave to keep the
41b0: 6e 61 6d 65 73 20 6f 66 20 74 68 65 20 68 65 6c names of the hel
41c0: 70 65 72 0a 09 09 09 20 20 20 20 20 20 23 20 73 per.... # s
41d0: 69 6e 67 6c 65 74 6f 6e 73 20 69 6e 20 73 79 6e ingletons in syn
41e0: 63 20 77 69 74 68 20 74 68 65 20 63 6f 6e 74 65 c with the conte
41f0: 6e 74 73 0a 09 09 09 20 20 20 20 20 20 23 20 6f nts.... # o
4200: 66 20 73 74 61 74 65 20 74 61 62 6c 65 20 27 63 f state table 'c
4210: 73 74 79 70 65 27 2c 20 61 6e 64 20 76 61 72 69 stype', and vari
4220: 6f 75 73 0a 09 09 09 20 20 20 20 20 20 23 20 6f ous.... # o
4230: 74 68 65 72 20 70 6c 61 63 65 73 20 75 73 69 6e ther places usin
4240: 67 20 74 68 65 6d 20 68 61 72 64 77 69 72 65 64 g them hardwired
4250: 2e 0a 20 20 20 20 76 61 72 69 61 62 6c 65 20 6d .. variable m
4260: 79 74 79 70 65 6f 62 6a 20 20 20 7b 7d 20 3b 20 ytypeobj {} ;
4270: 23 20 52 65 66 65 72 65 6e 63 65 20 74 6f 20 74 # Reference to t
4280: 68 65 20 63 6f 6e 74 61 69 6e 65 72 20 66 6f 72 he container for
4290: 20 74 68 65 0a 09 09 09 20 20 20 20 20 20 23 20 the.... #
42a0: 74 79 70 65 20 64 65 70 65 6e 64 65 6e 74 20 63 type dependent c
42b0: 6f 64 65 2e 20 44 65 72 69 76 65 64 20 66 72 6f ode. Derived fro
42c0: 6d 0a 09 09 09 20 20 20 20 20 20 23 20 6d 79 74 m.... # myt
42d0: 79 70 65 2e 0a 20 20 20 20 76 61 72 69 61 62 6c ype.. variabl
42e0: 65 20 6d 79 73 72 63 69 64 20 20 20 20 20 7b 7d e mysrcid {}
42f0: 20 3b 20 23 20 49 64 20 6f 66 20 74 68 65 20 6d ; # Id of the m
4300: 65 74 61 64 61 74 61 20 6f 72 20 73 79 6d 62 6f etadata or symbo
4310: 6c 20 74 68 65 20 63 73 65 74 0a 09 09 09 20 20 l the cset....
4320: 20 20 20 20 23 20 69 73 20 62 61 73 65 64 20 6f # is based o
4330: 6e 2e 0a 20 20 20 20 76 61 72 69 61 62 6c 65 20 n.. variable
4340: 6d 79 69 74 65 6d 73 20 20 20 20 20 7b 7d 20 3b myitems {} ;
4350: 20 23 20 4c 69 73 74 20 6f 66 20 74 68 65 20 66 # List of the f
4360: 69 6c 65 20 6c 65 76 65 6c 20 72 65 76 69 73 69 ile level revisi
4370: 6f 6e 73 2c 0a 09 09 09 20 20 20 20 20 20 23 20 ons,.... #
4380: 74 61 67 73 2c 20 6f 72 20 62 72 61 6e 63 68 65 tags, or branche
4390: 73 20 69 6e 20 74 68 65 20 63 73 65 74 2c 20 61 s in the cset, a
43a0: 73 0a 09 09 09 20 20 20 20 20 20 23 20 69 64 73 s.... # ids
43b0: 2e 20 4e 6f 74 20 74 61 67 67 65 64 2e 0a 20 20 . Not tagged..
43c0: 20 20 76 61 72 69 61 62 6c 65 20 6d 79 74 69 74 variable mytit
43d0: 65 6d 73 20 20 20 20 7b 7d 20 3b 20 23 20 41 73 ems {} ; # As
43e0: 20 6d 79 69 74 65 6d 73 2c 20 74 68 65 20 74 61 myitems, the ta
43f0: 67 67 65 64 20 66 6f 72 6d 2e 0a 20 20 20 20 76 gged form.. v
4400: 61 72 69 61 62 6c 65 20 6d 79 70 6f 73 20 20 20 ariable mypos
4410: 20 20 20 20 7b 7d 20 3b 20 23 20 43 6f 6d 6d 69 {} ; # Commi
4420: 74 20 70 6f 73 69 74 69 6f 6e 20 6f 66 20 74 68 t position of th
4430: 65 20 63 68 61 6e 67 65 73 65 74 2c 20 69 66 0a e changeset, if.
4440: 09 09 09 20 20 20 20 20 20 23 20 6b 6e 6f 77 6e ... # known
4450: 2e 0a 0a 20 20 20 20 23 20 23 20 23 23 20 23 23 ... # # ## ##
4460: 23 20 23 23 23 23 23 20 23 23 23 23 23 23 23 23 # ##### ########
4470: 20 23 23 23 23 23 23 23 23 23 23 23 23 23 0a 20 #############.
4480: 20 20 20 23 23 20 49 6e 74 65 72 6e 61 6c 20 6d ## Internal m
4490: 65 74 68 6f 64 73 0a 0a 20 20 20 20 74 79 70 65 ethods.. type
44a0: 76 61 72 69 61 62 6c 65 20 6d 79 63 6f 75 6e 74 variable mycount
44b0: 65 72 20 20 20 20 20 20 20 20 30 20 3b 20 23 20 er 0 ; #
44c0: 49 64 20 63 6f 75 6e 74 65 72 20 66 6f 72 20 63 Id counter for c
44d0: 73 65 74 73 2e 20 4c 61 73 74 20 69 64 0a 09 09 sets. Last id...
44e0: 09 09 20 20 20 20 20 20 23 20 75 73 65 64 2e 0a .. # used..
44f0: 20 20 20 20 74 79 70 65 76 61 72 69 61 62 6c 65 typevariable
4500: 20 6d 79 63 73 74 79 70 65 20 2d 61 72 72 61 79 mycstype -array
4510: 20 7b 7d 20 3b 20 23 20 4d 61 70 20 63 73 74 79 {} ; # Map csty
4520: 70 65 73 20 28 6e 61 6d 65 73 29 20 74 6f 20 70 pes (names) to p
4530: 65 72 73 69 73 74 65 6e 74 0a 09 09 09 09 20 20 ersistent.....
4540: 20 20 20 20 23 20 69 64 73 2e 20 4e 6f 74 65 20 # ids. Note
4550: 74 68 61 74 20 77 65 20 68 61 76 65 20 74 6f 20 that we have to
4560: 6b 65 65 70 0a 09 09 09 09 20 20 20 20 20 20 23 keep..... #
4570: 20 74 68 65 20 6e 61 6d 65 73 20 69 6e 20 74 68 the names in th
4580: 65 20 74 61 62 6c 65 20 27 63 73 74 79 70 65 27 e table 'cstype'
4590: 0a 09 09 09 09 20 20 20 20 20 20 23 20 69 6e 20 ..... # in
45a0: 73 79 6e 63 20 77 69 74 68 20 74 68 65 20 6e 61 sync with the na
45b0: 6d 65 73 20 6f 66 20 74 68 65 0a 09 09 09 09 20 mes of the.....
45c0: 20 20 20 20 20 23 20 68 65 6c 70 65 72 20 73 69 # helper si
45d0: 6e 67 6c 65 74 6f 6e 73 2e 0a 0a 20 20 20 20 74 ngletons... t
45e0: 79 70 65 6d 65 74 68 6f 64 20 69 6e 6f 72 64 65 ypemethod inorde
45f0: 72 20 7b 70 72 6f 6a 65 63 74 69 64 7d 20 7b 0a r {projectid} {.
4600: 09 23 20 52 65 74 75 72 6e 20 61 6c 6c 20 72 65 .# Return all re
4610: 76 69 73 69 6f 6e 20 63 68 61 6e 67 65 73 65 74 vision changeset
4620: 73 20 66 6f 72 20 74 68 65 20 73 70 65 63 69 66 s for the specif
4630: 69 65 64 20 70 72 6f 6a 65 63 74 2c 20 69 6e 0a ied project, in.
4640: 09 23 20 74 68 65 20 6f 72 64 65 72 20 67 69 76 .# the order giv
4650: 65 6e 20 74 6f 20 74 68 65 6d 20 62 79 20 74 68 en to them by th
4660: 65 20 73 6f 72 74 20 70 61 73 73 65 73 2e 20 42 e sort passes. B
4670: 6f 74 68 20 74 68 65 0a 09 23 20 66 69 6c 74 65 oth the..# filte
4680: 72 69 6e 67 20 62 79 20 70 72 6f 6a 65 63 74 20 ring by project
4690: 61 6e 64 20 73 6f 72 74 69 6e 67 20 6d 61 6b 65 and sorting make
46a0: 20 75 73 65 20 6f 66 20 27 70 72 6f 6a 65 63 74 use of 'project
46b0: 3a 3a 72 65 76 0a 09 23 20 72 65 76 27 20 69 6d ::rev..# rev' im
46c0: 70 6f 73 73 69 62 6c 65 2e 0a 0a 09 73 65 74 20 possible....set
46d0: 72 65 73 20 7b 7d 0a 09 73 74 61 74 65 20 66 6f res {}..state fo
46e0: 72 65 61 63 68 72 6f 77 20 7b 0a 09 20 20 20 20 reachrow {..
46f0: 53 45 4c 45 43 54 20 43 2e 63 69 64 20 41 53 20 SELECT C.cid AS
4700: 78 63 69 64 2c 20 54 2e 64 61 74 65 20 41 53 20 xcid, T.date AS
4710: 63 64 61 74 65 0a 09 20 20 20 20 46 52 4f 4d 20 cdate.. FROM
4720: 20 20 63 68 61 6e 67 65 73 65 74 20 43 2c 20 63 changeset C, c
4730: 73 74 69 6d 65 73 74 61 6d 70 20 54 0a 09 20 20 stimestamp T..
4740: 20 20 57 48 45 52 45 20 20 43 2e 74 79 70 65 20 WHERE C.type
4750: 3d 20 30 20 20 20 20 20 20 20 20 20 20 2d 2d 20 = 0 --
4760: 6c 69 6d 69 74 20 74 6f 20 72 65 76 69 73 69 6f limit to revisio
4770: 6e 20 63 68 61 6e 67 65 73 65 74 73 0a 09 20 20 n changesets..
4780: 20 20 41 4e 44 20 20 20 20 43 2e 70 69 64 20 20 AND C.pid
4790: 3d 20 24 70 72 6f 6a 65 63 74 69 64 20 2d 2d 20 = $projectid --
47a0: 6c 69 6d 69 74 20 74 6f 20 63 68 61 6e 67 65 73 limit to changes
47b0: 65 74 73 20 69 6e 20 70 72 6f 6a 65 63 74 0a 09 ets in project..
47c0: 20 20 20 20 41 4e 44 20 20 20 20 54 2e 63 69 64 AND T.cid
47d0: 20 20 3d 20 43 2e 63 69 64 20 20 20 20 20 20 2d = C.cid -
47e0: 2d 20 67 65 74 20 6f 72 64 65 72 69 6e 67 20 69 - get ordering i
47f0: 6e 66 6f 72 6d 61 74 69 6f 6e 0a 09 20 20 20 20 nformation..
4800: 4f 52 44 45 52 20 42 59 20 54 2e 64 61 74 65 20 ORDER BY T.date
4810: 20 20 20 20 20 20 20 20 20 20 20 2d 2d 20 73 6f -- so
4820: 72 74 20 69 6e 74 6f 20 63 6f 6d 6d 69 74 20 6f rt into commit o
4830: 72 64 65 72 0a 09 7d 20 7b 0a 09 20 20 20 20 6c rder..} {.. l
4840: 61 70 70 65 6e 64 20 72 65 73 20 24 6d 79 69 64 append res $myid
4850: 6d 61 70 28 24 78 63 69 64 29 20 24 63 64 61 74 map($xcid) $cdat
4860: 65 0a 09 7d 0a 09 72 65 74 75 72 6e 20 24 72 65 e..}..return $re
4870: 73 0a 20 20 20 20 7d 0a 0a 20 20 20 20 74 79 70 s. }.. typ
4880: 65 6d 65 74 68 6f 64 20 67 65 74 63 73 74 79 70 emethod getcstyp
4890: 65 73 20 7b 7d 20 7b 0a 09 73 74 61 74 65 20 66 es {} {..state f
48a0: 6f 72 65 61 63 68 72 6f 77 20 7b 0a 09 20 20 20 oreachrow {..
48b0: 20 53 45 4c 45 43 54 20 74 69 64 2c 20 6e 61 6d SELECT tid, nam
48c0: 65 20 46 52 4f 4d 20 63 73 74 79 70 65 3b 0a 09 e FROM cstype;..
48d0: 7d 20 7b 20 73 65 74 20 6d 79 63 73 74 79 70 65 } { set mycstype
48e0: 28 24 6e 61 6d 65 29 20 24 74 69 64 20 7d 0a 09 ($name) $tid }..
48f0: 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 return. }..
4900: 20 20 74 79 70 65 6d 65 74 68 6f 64 20 6c 6f 61 typemethod loa
4910: 64 20 7b 72 65 70 6f 73 69 74 6f 72 79 7d 20 7b d {repository} {
4920: 0a 09 73 65 74 20 6e 20 30 0a 09 6c 6f 67 20 77 ..set n 0..log w
4930: 72 69 74 65 20 32 20 63 73 65 74 73 20 7b 4c 6f rite 2 csets {Lo
4940: 61 64 69 6e 67 20 74 68 65 20 63 68 61 6e 67 65 ading the change
4950: 73 65 74 73 7d 0a 09 73 74 61 74 65 20 66 6f 72 sets}..state for
4960: 65 61 63 68 72 6f 77 20 7b 0a 09 20 20 20 20 53 eachrow {.. S
4970: 45 4c 45 43 54 20 43 2e 63 69 64 20 20 20 41 53 ELECT C.cid AS
4980: 20 69 64 2c 0a 09 20 20 20 20 20 20 20 20 20 20 id,..
4990: 20 43 2e 70 69 64 20 20 20 41 53 20 78 70 69 64 C.pid AS xpid
49a0: 2c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ,.
49b0: 20 20 20 20 20 43 53 2e 6e 61 6d 65 20 41 53 20 CS.name AS
49c0: 63 73 74 79 70 65 2c 0a 09 20 20 20 20 20 20 20 cstype,..
49d0: 20 20 20 20 43 2e 73 72 63 20 20 20 41 53 20 73 C.src AS s
49e0: 72 63 69 64 0a 09 20 20 20 20 46 52 4f 4d 20 20 rcid.. FROM
49f0: 20 63 68 61 6e 67 65 73 65 74 20 43 2c 20 63 73 changeset C, cs
4a00: 74 79 70 65 20 43 53 0a 09 20 20 20 20 57 48 45 type CS.. WHE
4a10: 52 45 20 20 43 2e 74 79 70 65 20 3d 20 43 53 2e RE C.type = CS.
4a20: 74 69 64 0a 09 20 20 20 20 4f 52 44 45 52 20 42 tid.. ORDER B
4a30: 59 20 43 2e 63 69 64 0a 09 7d 20 7b 0a 09 20 20 Y C.cid..} {..
4a40: 20 20 6c 6f 67 20 70 72 6f 67 72 65 73 73 20 32 log progress 2
4a50: 20 63 73 65 74 73 20 24 6e 20 7b 7d 0a 09 20 20 csets $n {}..
4a60: 20 20 73 65 74 20 72 20 5b 24 74 79 70 65 20 25 set r [$type %
4a70: 41 55 54 4f 25 20 5b 24 72 65 70 6f 73 69 74 6f AUTO% [$reposito
4a80: 72 79 20 70 72 6f 6a 65 63 74 6f 66 20 24 78 70 ry projectof $xp
4a90: 69 64 5d 20 24 63 73 74 79 70 65 20 24 73 72 63 id] $cstype $src
4aa0: 69 64 20 5b 73 74 61 74 65 20 72 75 6e 20 7b 0a id [state run {.
4ab0: 09 09 53 45 4c 45 43 54 20 43 2e 69 69 64 0a 09 ..SELECT C.iid..
4ac0: 09 46 52 4f 4d 20 20 20 63 73 69 74 65 6d 20 43 .FROM csitem C
4ad0: 0a 09 09 57 48 45 52 45 20 20 43 2e 63 69 64 20 ...WHERE C.cid
4ae0: 3d 20 24 69 64 0a 09 09 4f 52 44 45 52 20 42 59 = $id...ORDER BY
4af0: 20 43 2e 70 6f 73 0a 09 20 20 20 20 7d 5d 20 24 C.pos.. }] $
4b00: 69 64 5d 0a 09 20 20 20 20 69 6e 63 72 20 6e 0a id].. incr n.
4b10: 09 7d 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 7d .}..return. }
4b20: 0a 0a 20 20 20 20 74 79 70 65 6d 65 74 68 6f 64 .. typemethod
4b30: 20 6c 6f 61 64 63 6f 75 6e 74 65 72 20 7b 7d 20 loadcounter {}
4b40: 7b 0a 09 23 20 49 6e 69 74 69 61 6c 69 7a 65 20 {..# Initialize
4b50: 74 68 65 20 63 6f 75 6e 74 65 72 20 66 72 6f 6d the counter from
4b60: 20 74 68 65 20 73 74 61 74 65 0a 09 6c 6f 67 20 the state..log
4b70: 77 72 69 74 65 20 32 20 63 73 65 74 73 20 7b 4c write 2 csets {L
4b80: 6f 61 64 69 6e 67 20 63 68 61 6e 67 65 73 65 74 oading changeset
4b90: 20 63 6f 75 6e 74 65 72 7d 0a 09 73 65 74 20 6d counter}..set m
4ba0: 79 63 6f 75 6e 74 65 72 20 5b 73 74 61 74 65 20 ycounter [state
4bb0: 6f 6e 65 20 7b 20 53 45 4c 45 43 54 20 4d 41 58 one { SELECT MAX
4bc0: 28 63 69 64 29 20 46 52 4f 4d 20 63 68 61 6e 67 (cid) FROM chang
4bd0: 65 73 65 74 20 7d 5d 0a 09 72 65 74 75 72 6e 0a eset }]..return.
4be0: 20 20 20 20 7d 0a 0a 20 20 20 20 74 79 70 65 6d }.. typem
4bf0: 65 74 68 6f 64 20 6e 75 6d 20 7b 7d 20 7b 20 72 ethod num {} { r
4c00: 65 74 75 72 6e 20 24 6d 79 63 6f 75 6e 74 65 72 eturn $mycounter
4c10: 20 7d 0a 0a 20 20 20 20 23 20 23 20 23 23 20 23 }.. # # ## #
4c20: 23 23 20 23 23 23 23 23 20 23 23 23 23 23 23 23 ## ##### #######
4c30: 23 20 23 23 23 23 23 23 23 23 23 23 23 23 23 0a # #############.
4c40: 0a 20 20 20 20 6d 65 74 68 6f 64 20 43 72 65 61 . method Crea
4c50: 74 65 46 72 6f 6d 46 72 61 67 6d 65 6e 74 73 20 teFromFragments
4c60: 7b 66 72 61 67 6d 65 6e 74 73 20 63 76 20 62 76 {fragments cv bv
4c70: 7d 20 7b 0a 09 75 70 76 61 72 20 31 20 24 63 76 } {..upvar 1 $cv
4c80: 20 63 6f 75 6e 74 65 72 20 24 62 76 20 62 72 65 counter $bv bre
4c90: 61 6b 73 0a 09 55 6e 6d 61 70 49 74 65 6d 73 20 aks..UnmapItems
4ca0: 24 6d 79 74 79 70 65 20 24 6d 79 69 74 65 6d 73 $mytype $myitems
4cb0: 0a 0a 09 23 20 43 72 65 61 74 65 20 63 68 61 6e ...# Create chan
4cc0: 67 65 73 65 74 73 20 66 6f 72 20 74 68 65 20 66 gesets for the f
4cd0: 72 61 67 6d 65 6e 74 73 2c 20 72 65 75 73 69 6e ragments, reusin
4ce0: 67 20 74 68 65 20 63 75 72 72 65 6e 74 20 6f 6e g the current on
4cf0: 65 0a 09 23 20 66 6f 72 20 74 68 65 20 66 69 72 e..# for the fir
4d00: 73 74 20 66 72 61 67 6d 65 6e 74 2e 20 57 65 20 st fragment. We
4d10: 73 6f 72 74 20 74 68 65 6d 20 69 6e 20 6f 72 64 sort them in ord
4d20: 65 72 20 74 6f 20 61 6c 6c 6f 77 0a 09 23 20 63 er to allow..# c
4d30: 68 65 63 6b 69 6e 67 20 66 6f 72 20 67 61 70 73 hecking for gaps
4d40: 20 61 6e 64 20 6e 69 63 65 20 6d 65 73 73 61 67 and nice messag
4d50: 65 73 2e 0a 0a 09 73 65 74 20 6e 65 77 63 73 65 es....set newcse
4d60: 74 73 20 20 7b 7d 0a 09 73 65 74 20 66 72 61 67 ts {}..set frag
4d70: 6d 65 6e 74 73 20 5b 6c 73 6f 72 74 20 2d 69 6e ments [lsort -in
4d80: 64 65 78 20 30 20 2d 69 6e 74 65 67 65 72 20 24 dex 0 -integer $
4d90: 66 72 61 67 6d 65 6e 74 73 5d 0a 0a 09 23 70 75 fragments]...#pu
4da0: 74 73 20 5c 74 2e 5b 6a 6f 69 6e 20 5b 50 52 73 ts \t.[join [PRs
4db0: 20 24 66 72 61 67 6d 65 6e 74 73 5d 20 2e 5c 6e $fragments] .\n
4dc0: 5c 74 2e 5d 2e 0a 0a 09 42 6f 72 64 65 72 20 5b \t.]....Border [
4dd0: 6c 69 6e 64 65 78 20 24 66 72 61 67 6d 65 6e 74 lindex $fragment
4de0: 73 20 30 5d 20 66 69 72 73 74 73 20 66 69 72 73 s 0] firsts firs
4df0: 74 65 0a 0a 09 69 6e 74 65 67 72 69 74 79 20 61 te...integrity a
4e00: 73 73 65 72 74 20 7b 0a 09 20 20 20 20 24 66 69 ssert {.. $fi
4e10: 72 73 74 73 20 3d 3d 20 30 0a 09 7d 20 7b 42 61 rsts == 0..} {Ba
4e20: 64 20 66 72 61 67 6d 65 6e 74 20 73 74 61 72 74 d fragment start
4e30: 20 40 20 24 66 69 72 73 74 73 2c 20 67 61 70 2c @ $firsts, gap,
4e40: 20 6f 72 20 62 65 66 6f 72 65 20 62 65 67 69 6e or before begin
4e50: 6e 69 6e 67 20 6f 66 20 74 68 65 20 72 61 6e 67 ning of the rang
4e60: 65 7d 0a 0a 09 73 65 74 20 6c 61 73 74 65 20 24 e}...set laste $
4e70: 66 69 72 73 74 65 0a 09 66 6f 72 65 61 63 68 20 firste..foreach
4e80: 66 72 61 67 6d 65 6e 74 20 5b 6c 72 61 6e 67 65 fragment [lrange
4e90: 20 24 66 72 61 67 6d 65 6e 74 73 20 31 20 65 6e $fragments 1 en
4ea0: 64 5d 20 7b 0a 09 20 20 20 20 42 6f 72 64 65 72 d] {.. Border
4eb0: 20 24 66 72 61 67 6d 65 6e 74 20 73 20 65 0a 09 $fragment s e..
4ec0: 20 20 20 20 69 6e 74 65 67 72 69 74 79 20 61 73 integrity as
4ed0: 73 65 72 74 20 7b 0a 09 09 24 6c 61 73 74 65 20 sert {...$laste
4ee0: 3d 3d 20 28 24 73 20 2d 20 31 29 0a 09 20 20 20 == ($s - 1)..
4ef0: 20 7d 20 7b 42 61 64 20 66 72 61 67 6d 65 6e 74 } {Bad fragment
4f00: 20 62 6f 72 64 65 72 20 3c 24 6c 61 73 74 65 20 border <$laste
4f10: 7c 20 24 73 3e 2c 20 67 61 70 20 6f 72 20 6f 76 | $s>, gap or ov
4f20: 65 72 6c 61 70 7d 0a 0a 09 20 20 20 20 73 65 74 erlap}... set
4f30: 20 6e 65 77 20 5b 24 74 79 70 65 20 25 41 55 54 new [$type %AUT
4f40: 4f 25 20 24 6d 79 70 72 6f 6a 65 63 74 20 24 6d O% $myproject $m
4f50: 79 74 79 70 65 20 24 6d 79 73 72 63 69 64 20 5b ytype $mysrcid [
4f60: 6c 72 61 6e 67 65 20 24 6d 79 69 74 65 6d 73 20 lrange $myitems
4f70: 24 73 20 24 65 5d 5d 0a 09 20 20 20 20 6c 61 70 $s $e]].. lap
4f80: 70 65 6e 64 20 6e 65 77 63 73 65 74 73 20 24 6e pend newcsets $n
4f90: 65 77 0a 09 20 20 20 20 69 6e 63 72 20 63 6f 75 ew.. incr cou
4fa0: 6e 74 65 72 0a 0a 20 20 20 20 20 20 20 20 20 20 nter..
4fb0: 20 20 6c 6f 67 20 77 72 69 74 65 20 34 20 63 73 log write 4 cs
4fc0: 65 74 73 20 7b 42 72 65 61 6b 69 6e 67 20 5b 24 ets {Breaking [$
4fd0: 73 65 6c 66 20 73 74 72 20 5d 20 40 20 24 6c 61 self str ] @ $la
4fe0: 73 74 65 2c 20 6e 65 77 20 5b 24 6e 65 77 20 73 ste, new [$new s
4ff0: 74 72 5d 2c 20 63 75 74 74 69 6e 67 20 24 62 72 tr], cutting $br
5000: 65 61 6b 73 28 24 6c 61 73 74 65 29 7d 0a 0a 09 eaks($laste)}...
5010: 20 20 20 20 73 65 74 20 6c 61 73 74 65 20 24 65 set laste $e
5020: 0a 09 7d 0a 0a 09 69 6e 74 65 67 72 69 74 79 20 ..}...integrity
5030: 61 73 73 65 72 74 20 7b 0a 09 20 20 20 20 24 6c assert {.. $l
5040: 61 73 74 65 20 3d 3d 20 28 5b 6c 6c 65 6e 67 74 aste == ([llengt
5050: 68 20 24 6d 79 69 74 65 6d 73 5d 2d 31 29 0a 09 h $myitems]-1)..
5060: 7d 20 7b 42 61 64 20 66 72 61 67 6d 65 6e 74 20 } {Bad fragment
5070: 65 6e 64 20 40 20 24 6c 61 73 74 65 2c 20 67 61 end @ $laste, ga
5080: 70 2c 20 6f 72 20 62 65 79 6f 6e 64 20 65 6e 64 p, or beyond end
5090: 20 6f 66 20 74 68 65 20 72 61 6e 67 65 7d 0a 0a of the range}..
50a0: 09 23 20 50 75 74 20 74 68 65 20 66 69 72 73 74 .# Put the first
50b0: 20 66 72 61 67 6d 65 6e 74 20 69 6e 74 6f 20 74 fragment into t
50c0: 68 65 20 63 75 72 72 65 6e 74 20 63 68 61 6e 67 he current chang
50d0: 65 73 65 74 2c 20 61 6e 64 0a 09 23 20 75 70 64 eset, and..# upd
50e0: 61 74 65 20 74 68 65 20 69 6e 2d 6d 65 6d 6f 72 ate the in-memor
50f0: 79 20 69 6e 64 65 78 2e 20 57 65 20 63 61 6e 20 y index. We can
5100: 73 69 6d 70 6c 79 20 28 72 65 29 61 64 64 20 74 simply (re)add t
5110: 68 65 20 69 74 65 6d 73 0a 09 23 20 62 65 63 61 he items..# beca
5120: 75 73 65 20 77 65 20 63 6c 65 61 72 65 64 20 74 use we cleared t
5130: 68 65 20 70 72 65 76 69 6f 75 73 6c 79 20 65 78 he previously ex
5140: 69 73 74 69 6e 67 20 69 6e 66 6f 72 6d 61 74 69 isting informati
5150: 6f 6e 2c 20 73 65 65 0a 09 23 20 27 55 6e 6d 61 on, see..# 'Unma
5160: 70 49 74 65 6d 73 27 20 61 62 6f 76 65 2e 20 50 pItems' above. P
5170: 65 72 73 69 73 74 65 6e 63 65 20 64 6f 65 73 20 ersistence does
5180: 6e 6f 74 20 6d 61 74 74 65 72 20 68 65 72 65 2c not matter here,
5190: 20 6e 6f 6e 65 0a 09 23 20 6f 66 20 74 68 65 20 none..# of the
51a0: 63 68 61 6e 67 65 73 65 74 73 20 68 61 73 20 62 changesets has b
51b0: 65 65 6e 20 73 61 76 65 64 20 74 6f 20 74 68 65 een saved to the
51c0: 20 70 65 72 73 69 73 74 65 6e 74 20 73 74 61 74 persistent stat
51d0: 65 0a 09 23 20 79 65 74 2e 0a 0a 09 73 65 74 20 e..# yet....set
51e0: 6d 79 69 74 65 6d 73 20 20 5b 6c 72 61 6e 67 65 myitems [lrange
51f0: 20 24 6d 79 69 74 65 6d 73 20 20 30 20 24 66 69 $myitems 0 $fi
5200: 72 73 74 65 5d 0a 09 73 65 74 20 6d 79 74 69 74 rste]..set mytit
5210: 65 6d 73 20 5b 6c 72 61 6e 67 65 20 24 6d 79 74 ems [lrange $myt
5220: 69 74 65 6d 73 20 30 20 24 66 69 72 73 74 65 5d items 0 $firste]
5230: 0a 09 4d 61 70 49 74 65 6d 73 20 24 6d 79 74 79 ..MapItems $myty
5240: 70 65 20 24 6d 79 69 74 65 6d 73 0a 09 72 65 74 pe $myitems..ret
5250: 75 72 6e 20 24 6e 65 77 63 73 65 74 73 0a 20 20 urn $newcsets.
5260: 20 20 7d 0a 0a 20 20 20 20 23 20 23 20 23 23 20 }.. # # ##
5270: 23 23 23 20 23 23 23 23 23 20 23 23 23 23 23 23 ### ##### ######
5280: 23 23 20 23 23 23 23 23 23 23 23 23 23 23 23 23 ## #############
5290: 0a 0a 20 20 20 20 70 72 6f 63 20 42 72 65 61 6b .. proc Break
52a0: 44 69 72 65 63 74 44 65 70 65 6e 64 65 6e 63 69 DirectDependenci
52b0: 65 73 20 7b 74 68 65 69 74 65 6d 73 20 62 76 7d es {theitems bv}
52c0: 20 7b 0a 09 75 70 76 61 72 20 31 20 6d 79 74 79 {..upvar 1 myty
52d0: 70 65 6f 62 6a 20 6d 79 74 79 70 65 6f 62 6a 20 peobj mytypeobj
52e0: 73 65 6c 66 20 73 65 6c 66 20 24 62 76 20 62 72 self self $bv br
52f0: 65 61 6b 73 0a 0a 09 23 20 41 72 72 61 79 20 6f eaks...# Array o
5300: 66 20 64 65 70 65 6e 64 65 6e 63 69 65 73 20 28 f dependencies (
5310: 70 61 72 65 6e 74 20 2d 3e 20 63 68 69 6c 64 29 parent -> child)
5320: 2e 20 54 68 69 73 20 69 73 20 70 75 6c 6c 65 64 . This is pulled
5330: 20 66 72 6f 6d 0a 09 23 20 74 68 65 20 73 74 61 from..# the sta
5340: 74 65 2c 20 61 6e 64 20 6c 69 6d 69 74 65 64 20 te, and limited
5350: 74 6f 20 73 75 63 63 65 73 73 6f 72 73 20 77 69 to successors wi
5360: 74 68 69 6e 20 74 68 65 20 63 68 61 6e 67 65 73 thin the changes
5370: 65 74 2e 0a 0a 09 61 72 72 61 79 20 73 65 74 20 et....array set
5380: 64 65 70 65 6e 64 65 6e 63 69 65 73 20 7b 7d 0a dependencies {}.
5390: 0a 09 24 6d 79 74 79 70 65 6f 62 6a 20 69 6e 74 ..$mytypeobj int
53a0: 65 72 6e 61 6c 73 75 63 63 65 73 73 6f 72 73 20 ernalsuccessors
53b0: 64 65 70 65 6e 64 65 6e 63 69 65 73 20 24 74 68 dependencies $th
53c0: 65 69 74 65 6d 73 0a 09 69 66 20 7b 21 5b 61 72 eitems..if {![ar
53d0: 72 61 79 20 73 69 7a 65 20 64 65 70 65 6e 64 65 ray size depende
53e0: 6e 63 69 65 73 5d 7d 20 7b 0a 09 20 20 20 20 72 ncies]} {.. r
53f0: 65 74 75 72 6e 20 7b 7d 0a 09 7d 20 3b 20 23 20 eturn {}..} ; #
5400: 4e 6f 74 68 69 6e 67 20 74 6f 20 62 72 65 61 6b Nothing to break
5410: 2e 0a 0a 09 6c 6f 67 20 77 72 69 74 65 20 35 20 ....log write 5
5420: 63 73 65 74 73 20 2e 2e 2e 5b 24 73 65 6c 66 20 csets ...[$self
5430: 73 74 72 5d 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e str]............
5440: 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e ................
5450: 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e ................
5460: 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 09 76 63 3a .............vc:
5470: 3a 74 6f 6f 6c 73 3a 3a 6d 65 6d 3a 3a 6d 61 72 :tools::mem::mar
5480: 6b 0a 0a 09 72 65 74 75 72 6e 20 5b 42 72 65 61 k...return [Brea
5490: 6b 65 72 43 6f 72 65 20 24 74 68 65 69 74 65 6d kerCore $theitem
54a0: 73 20 64 65 70 65 6e 64 65 6e 63 69 65 73 20 62 s dependencies b
54b0: 72 65 61 6b 73 5d 0a 20 20 20 20 7d 0a 0a 20 20 reaks]. }..
54c0: 20 20 70 72 6f 63 20 42 72 65 61 6b 65 72 43 6f proc BreakerCo
54d0: 72 65 20 7b 74 68 65 69 74 65 6d 73 20 64 76 20 re {theitems dv
54e0: 62 76 7d 20 7b 0a 09 23 20 42 72 65 61 6b 20 61 bv} {..# Break a
54f0: 20 73 65 74 20 6f 66 20 72 65 76 69 73 69 6f 6e set of revision
5500: 73 20 69 6e 74 6f 20 66 72 61 67 6d 65 6e 74 73 s into fragments
5510: 20 77 68 69 63 68 20 68 61 76 65 20 6e 6f 0a 09 which have no..
5520: 23 20 69 6e 74 65 72 6e 61 6c 20 64 65 70 65 6e # internal depen
5530: 64 65 6e 63 69 65 73 2e 0a 0a 09 23 20 57 65 20 dencies....# We
5540: 70 65 72 66 6f 72 6d 20 61 6c 6c 20 6e 65 63 65 perform all nece
5550: 73 73 61 72 79 20 73 70 6c 69 74 73 20 69 6e 20 ssary splits in
5560: 6f 6e 65 20 67 6f 2c 20 69 6e 73 74 65 61 64 20 one go, instead
5570: 6f 66 20 6f 6e 6c 79 0a 09 23 20 6f 6e 65 2e 20 of only..# one.
5580: 54 68 65 20 70 72 65 76 69 6f 75 73 20 61 6c 67 The previous alg
5590: 6f 72 69 74 68 6d 2c 20 61 64 61 70 74 65 64 20 orithm, adapted
55a0: 66 72 6f 6d 20 63 76 73 32 73 76 6e 2c 20 63 6f from cvs2svn, co
55b0: 6d 70 75 74 65 64 0a 09 23 20 61 20 6c 6f 74 20 mputed..# a lot
55c0: 6f 66 20 73 74 61 74 65 20 77 68 69 63 68 20 77 of state which w
55d0: 61 73 20 74 68 72 6f 77 6e 20 61 77 61 79 20 61 as thrown away a
55e0: 6e 64 20 74 68 65 6e 20 63 6f 6d 70 75 74 65 64 nd then computed
55f0: 20 61 67 61 69 6e 0a 09 23 20 66 6f 72 20 65 61 again..# for ea
5600: 63 68 20 6f 66 20 74 68 65 20 66 72 61 67 6d 65 ch of the fragme
5610: 6e 74 73 2e 20 49 74 20 73 68 6f 75 6c 64 20 62 nts. It should b
5620: 65 20 65 61 73 69 65 72 20 74 6f 20 75 70 64 61 e easier to upda
5630: 74 65 20 61 6e 64 0a 09 23 20 72 65 75 73 65 20 te and..# reuse
5640: 74 68 61 74 20 73 74 61 74 65 2e 0a 0a 09 75 70 that state....up
5650: 76 61 72 20 31 20 24 64 76 20 64 65 70 65 6e 64 var 1 $dv depend
5660: 65 6e 63 69 65 73 20 24 62 76 20 62 72 65 61 6b encies $bv break
5670: 73 0a 0a 09 23 20 57 65 20 68 61 76 65 20 69 6e s...# We have in
5680: 74 65 72 6e 61 6c 20 64 65 70 65 6e 64 65 6e 63 ternal dependenc
5690: 69 65 73 20 74 6f 20 62 72 65 61 6b 2e 20 57 65 ies to break. We
56a0: 20 6e 6f 77 20 69 74 65 72 61 74 65 20 6f 76 65 now iterate ove
56b0: 72 0a 09 23 20 61 6c 6c 20 70 6f 73 69 74 69 6f r..# all positio
56c0: 6e 73 20 69 6e 20 74 68 65 20 6c 69 73 74 20 28 ns in the list (
56d0: 77 68 69 63 68 20 69 73 20 63 68 72 6f 6e 6f 6c which is chronol
56e0: 6f 67 69 63 61 6c 2c 20 61 74 20 6c 65 61 73 74 ogical, at least
56f0: 0a 09 23 20 61 73 20 66 61 72 20 61 73 20 74 68 ..# as far as th
5700: 65 20 74 69 6d 65 73 74 61 6d 70 73 20 61 72 65 e timestamps are
5710: 20 63 6f 72 72 65 63 74 20 61 6e 64 20 75 6e 69 correct and uni
5720: 71 75 65 29 20 61 6e 64 0a 09 23 20 64 65 74 65 que) and..# dete
5730: 72 6d 69 6e 65 20 74 68 65 20 62 65 73 74 20 70 rmine the best p
5740: 6f 73 69 74 69 6f 6e 20 66 6f 72 20 74 68 65 20 osition for the
5750: 62 72 65 61 6b 2c 20 62 79 20 74 72 79 69 6e 67 break, by trying
5760: 20 74 6f 0a 09 23 20 62 72 65 61 6b 20 61 73 20 to..# break as
5770: 6d 61 6e 79 20 64 65 70 65 6e 64 65 6e 63 69 65 many dependencie
5780: 73 20 61 73 20 70 6f 73 73 69 62 6c 65 20 69 6e s as possible in
5790: 20 6f 6e 65 20 67 6f 2e 20 57 68 65 6e 20 61 0a one go. When a.
57a0: 09 23 20 62 72 65 61 6b 20 77 61 73 20 66 6f 75 .# break was fou
57b0: 6e 64 20 74 68 69 73 20 69 73 20 72 65 64 6f 6e nd this is redon
57c0: 65 20 66 6f 72 20 74 68 65 20 66 72 61 67 6d 65 e for the fragme
57d0: 6e 74 73 20 63 6f 6d 69 6e 67 20 61 6e 64 0a 09 nts coming and..
57e0: 23 20 61 66 74 65 72 2c 20 61 66 74 65 72 20 75 # after, after u
57f0: 70 64 69 6e 67 20 74 68 65 20 63 72 6f 73 73 69 pding the crossi
5800: 6e 67 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 2e 0a ng information..
5810: 0a 09 23 20 44 61 74 61 20 73 74 72 75 63 74 75 ..# Data structu
5820: 72 65 73 3a 0a 09 23 20 4d 61 70 3a 20 20 50 4f res:..# Map: PO
5830: 53 20 20 20 72 65 76 69 73 69 6f 6e 20 69 64 20 S revision id
5840: 20 20 20 20 20 2d 3e 20 70 6f 73 69 74 69 6f 6e -> position
5850: 20 69 6e 20 6c 69 73 74 2e 0a 09 23 20 20 20 20 in list...#
5860: 20 20 20 43 52 4f 53 53 20 70 6f 73 69 74 69 6f CROSS positio
5870: 6e 20 69 6e 20 6c 69 73 74 20 2d 3e 20 6e 75 6d n in list -> num
5880: 62 65 72 20 6f 66 20 64 65 70 65 6e 64 65 6e 63 ber of dependenc
5890: 69 65 73 20 63 72 6f 73 73 69 6e 67 20 69 74 0a ies crossing it.
58a0: 09 23 20 20 20 20 20 20 20 44 45 50 43 20 20 64 .# DEPC d
58b0: 65 70 65 6e 64 65 6e 63 79 20 20 20 20 20 20 20 ependency
58c0: 2d 3e 20 70 6f 73 69 74 69 6f 6e 73 20 69 74 20 -> positions it
58d0: 63 72 6f 73 73 65 73 0a 09 23 20 4c 69 73 74 3a crosses..# List:
58e0: 20 52 41 4e 47 45 20 4f 66 20 74 68 65 20 70 6f RANGE Of the po
58f0: 73 69 74 69 6f 6e 73 20 69 74 73 65 6c 66 2e 0a sitions itself..
5900: 09 23 20 4d 61 70 3a 20 20 44 45 4c 54 41 20 70 .# Map: DELTA p
5910: 6f 73 69 74 69 6f 6e 20 69 6e 20 6c 69 73 74 20 osition in list
5920: 2d 3e 20 74 69 6d 65 20 64 65 6c 74 61 20 62 65 -> time delta be
5930: 74 77 65 65 6e 20 69 74 73 20 72 65 76 69 73 69 tween its revisi
5940: 6f 6e 0a 09 23 20 20 20 20 20 20 20 20 20 20 20 on..#
5950: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
5960: 20 20 20 20 20 20 61 6e 64 20 74 68 65 20 6e 65 and the ne
5970: 78 74 2c 20 69 66 20 61 6e 79 2e 0a 09 23 20 41 xt, if any...# A
5980: 20 64 65 70 65 6e 64 65 6e 63 79 20 69 73 20 61 dependency is a
5990: 20 73 69 6e 67 6c 65 2d 65 6c 65 6d 65 6e 74 20 single-element
59a0: 6d 61 70 20 70 61 72 65 6e 74 20 2d 3e 20 63 68 map parent -> ch
59b0: 69 6c 64 0a 0a 09 23 20 49 6e 69 74 69 61 6c 69 ild...# Initiali
59c0: 7a 65 42 72 65 61 6b 53 74 61 74 65 20 69 6e 69 zeBreakState ini
59d0: 74 69 61 6c 69 7a 65 73 20 74 68 65 69 72 20 63 tializes their c
59e0: 6f 6e 74 65 6e 74 73 20 61 66 74 65 72 0a 09 23 ontents after..#
59f0: 20 75 70 76 61 72 27 69 6e 67 20 74 68 65 6d 20 upvar'ing them
5a00: 66 72 6f 6d 20 74 68 69 73 20 73 63 6f 70 65 2e from this scope.
5a10: 20 49 74 20 75 73 65 73 20 74 68 65 20 69 6e 66 It uses the inf
5a20: 6f 72 6d 61 74 69 6f 6e 20 69 6e 0a 09 23 20 44 ormation in..# D
5a30: 45 50 45 4e 44 45 4e 43 49 45 53 20 74 6f 20 64 EPENDENCIES to d
5a40: 6f 20 73 6f 2e 0a 0a 09 49 6e 69 74 69 61 6c 69 o so....Initiali
5a50: 7a 65 42 72 65 61 6b 53 74 61 74 65 20 24 74 68 zeBreakState $th
5a60: 65 69 74 65 6d 73 0a 0a 09 73 65 74 20 66 72 61 eitems...set fra
5a70: 67 6d 65 6e 74 73 20 7b 7d 0a 09 73 65 74 20 6e gments {}..set n
5a80: 65 77 20 20 20 20 20 20 20 5b 6c 69 73 74 20 24 ew [list $
5a90: 72 61 6e 67 65 5d 0a 0a 09 23 20 49 6e 73 74 65 range]...# Inste
5aa0: 61 64 20 6f 66 20 6f 6e 65 20 6c 69 73 74 20 68 ad of one list h
5ab0: 6f 6c 64 69 6e 67 20 62 6f 74 68 20 70 72 6f 63 olding both proc
5ac0: 65 73 73 65 64 20 61 6e 64 20 70 65 6e 64 69 6e essed and pendin
5ad0: 67 0a 09 23 20 66 72 61 67 6d 65 6e 74 73 20 77 g..# fragments w
5ae0: 65 20 75 73 65 20 74 77 6f 2c 20 6f 6e 65 20 66 e use two, one f
5af0: 6f 72 20 74 68 65 20 66 72 61 6d 65 6e 74 73 20 or the framents
5b00: 74 6f 20 70 72 6f 63 65 73 73 2c 20 6f 6e 65 0a to process, one.
5b10: 09 23 20 74 6f 20 68 6f 6c 64 20 74 68 65 20 6e .# to hold the n
5b20: 65 77 20 66 72 61 67 6d 65 6e 74 73 2c 20 61 6e ew fragments, an
5b30: 64 20 74 68 65 20 6c 61 74 74 65 72 20 69 73 20 d the latter is
5b40: 63 6f 70 69 65 64 20 74 6f 20 74 68 65 0a 09 23 copied to the..#
5b50: 20 66 6f 72 6d 65 72 20 77 68 65 6e 20 74 68 65 former when the
5b60: 79 20 72 75 6e 20 6f 75 74 2e 20 54 68 69 73 20 y run out. This
5b70: 6b 65 65 70 73 20 74 68 65 20 6c 69 73 74 20 6f keeps the list o
5b80: 66 20 70 65 6e 64 69 6e 67 0a 09 23 20 66 72 61 f pending..# fra
5b90: 67 6d 65 6e 74 73 20 73 68 6f 72 74 20 77 69 74 gments short wit
5ba0: 68 6f 75 74 20 73 61 63 72 69 66 69 63 69 6e 67 hout sacrificing
5bb0: 20 73 70 65 65 64 20 62 79 20 73 68 69 66 74 69 speed by shifti
5bc0: 6e 67 20 73 74 75 66 66 0a 09 23 20 64 6f 77 6e ng stuff..# down
5bd0: 2e 20 57 65 20 65 73 70 65 63 69 61 6c 6c 79 20 . We especially
5be0: 64 72 6f 70 20 74 68 65 20 6d 65 6d 6f 72 79 20 drop the memory
5bf0: 6f 66 20 66 72 61 67 6d 65 6e 74 73 20 62 72 6f of fragments bro
5c00: 6b 65 6e 0a 09 23 20 64 75 72 69 6e 67 20 70 72 ken..# during pr
5c10: 6f 63 65 73 73 69 6e 67 20 61 66 74 65 72 20 61 ocessing after a
5c20: 20 73 68 6f 72 74 20 74 69 6d 65 2c 20 69 6e 73 short time, ins
5c30: 74 65 61 64 20 6f 66 20 6c 65 74 74 69 6e 67 20 tead of letting
5c40: 69 74 0a 09 23 20 63 6f 6e 73 75 6d 65 20 6d 65 it..# consume me
5c50: 6d 6f 72 79 2e 0a 0a 09 77 68 69 6c 65 20 7b 5b mory....while {[
5c60: 6c 6c 65 6e 67 74 68 20 24 6e 65 77 5d 7d 20 7b llength $new]} {
5c70: 0a 0a 09 20 20 20 20 73 65 74 20 70 65 6e 64 69 ... set pendi
5c80: 6e 67 20 24 6e 65 77 0a 09 20 20 20 20 73 65 74 ng $new.. set
5c90: 20 6e 65 77 20 20 20 20 20 7b 7d 0a 09 20 20 20 new {}..
5ca0: 20 73 65 74 20 61 74 20 20 20 20 20 20 30 0a 0a set at 0..
5cb0: 09 20 20 20 20 77 68 69 6c 65 20 7b 24 61 74 20 . while {$at
5cc0: 3c 20 5b 6c 6c 65 6e 67 74 68 20 24 70 65 6e 64 < [llength $pend
5cd0: 69 6e 67 5d 7d 20 7b 0a 09 09 73 65 74 20 63 75 ing]} {...set cu
5ce0: 72 72 65 6e 74 20 5b 6c 69 6e 64 65 78 20 24 70 rrent [lindex $p
5cf0: 65 6e 64 69 6e 67 20 24 61 74 5d 0a 0a 09 09 6c ending $at]....l
5d00: 6f 67 20 77 72 69 74 65 20 36 20 63 73 65 74 73 og write 6 csets
5d10: 20 7b 2e 20 2e 20 2e 2e 20 2e 2e 2e 20 2e 2e 2e {. . .. ... ...
5d20: 2e 2e 20 2e 2e 2e 2e 2e 2e 2e 2e 20 2e 2e 2e 2e .. ........ ....
5d30: 2e 2e 2e 2e 2e 2e 2e 2e 2e 7d 0a 09 09 6c 6f 67 .........}...log
5d40: 20 77 72 69 74 65 20 36 20 63 73 65 74 73 20 7b write 6 csets {
5d50: 53 63 68 65 64 75 6c 65 64 20 20 20 5b 6a 6f 69 Scheduled [joi
5d60: 6e 20 5b 50 52 73 20 5b 6c 72 61 6e 67 65 20 24 n [PRs [lrange $
5d70: 70 65 6e 64 69 6e 67 20 24 61 74 20 65 6e 64 5d pending $at end]
5d80: 5d 20 7b 20 7d 5d 7d 0a 09 09 6c 6f 67 20 77 72 ] { }]}...log wr
5d90: 69 74 65 20 36 20 63 73 65 74 73 20 7b 43 6f 6e ite 6 csets {Con
5da0: 73 69 64 65 72 69 6e 67 20 5b 50 52 20 24 63 75 sidering [PR $cu
5db0: 72 72 65 6e 74 5d 20 5c 5b 24 61 74 2f 5b 6c 6c rrent] \[$at/[ll
5dc0: 65 6e 67 74 68 20 24 70 65 6e 64 69 6e 67 5d 5c ength $pending]\
5dd0: 5d 7d 0a 0a 09 09 73 65 74 20 62 65 73 74 20 5b ]}....set best [
5de0: 46 69 6e 64 42 65 73 74 42 72 65 61 6b 20 24 63 FindBestBreak $c
5df0: 75 72 72 65 6e 74 5d 0a 0a 09 09 69 66 20 7b 24 urrent]....if {$
5e00: 62 65 73 74 20 3c 20 30 7d 20 7b 0a 09 09 20 20 best < 0} {...
5e10: 20 20 23 20 54 68 65 20 69 6e 73 70 65 63 74 65 # The inspecte
5e20: 64 20 72 61 6e 67 65 20 68 61 73 20 6e 6f 20 69 d range has no i
5e30: 6e 74 65 72 6e 61 6c 0a 09 09 20 20 20 20 23 20 nternal... #
5e40: 64 65 70 65 6e 64 65 6e 63 69 65 73 2e 20 54 68 dependencies. Th
5e50: 69 73 20 69 73 20 61 20 63 6f 6d 70 6c 65 74 65 is is a complete
5e60: 20 66 72 61 67 6d 65 6e 74 2e 0a 09 09 20 20 20 fragment....
5e70: 20 6c 61 70 70 65 6e 64 20 66 72 61 67 6d 65 6e lappend fragmen
5e80: 74 73 20 24 63 75 72 72 65 6e 74 0a 0a 09 09 20 ts $current....
5e90: 20 20 20 6c 6f 67 20 77 72 69 74 65 20 36 20 63 log write 6 c
5ea0: 73 65 74 73 20 22 4e 6f 20 62 72 65 61 6b 73 2c sets "No breaks,
5eb0: 20 66 69 6e 61 6c 22 0a 09 09 7d 20 65 6c 73 65 final"...} else
5ec0: 20 7b 0a 09 09 20 20 20 20 23 20 53 70 6c 69 74 {... # Split
5ed0: 20 74 68 65 20 72 61 6e 67 65 20 61 6e 64 20 73 the range and s
5ee0: 63 68 65 64 75 6c 65 20 74 68 65 20 72 65 73 75 chedule the resu
5ef0: 6c 74 69 6e 67 0a 09 09 20 20 20 20 23 20 66 72 lting... # fr
5f00: 61 67 6d 65 6e 74 73 20 66 6f 72 20 66 75 72 74 agments for furt
5f10: 68 65 72 20 69 6e 73 70 65 63 74 69 6f 6e 2e 20 her inspection.
5f20: 52 65 6d 65 6d 62 65 72 20 74 68 65 0a 09 09 20 Remember the...
5f30: 20 20 20 23 20 6e 75 6d 62 65 72 20 6f 66 20 64 # number of d
5f40: 65 70 65 6e 64 65 6e 63 69 65 73 20 63 75 74 20 ependencies cut
5f50: 62 65 66 6f 72 65 20 77 65 20 72 65 6d 6f 76 65 before we remove
5f60: 20 74 68 65 6d 0a 09 09 20 20 20 20 23 20 66 72 them... # fr
5f70: 6f 6d 20 63 6f 6e 73 69 64 65 72 61 74 69 6f 6e om consideration
5f80: 2c 20 66 6f 72 20 64 6f 63 75 6d 65 6e 74 61 74 , for documentat
5f90: 69 6f 6e 20 6c 61 74 65 72 2e 0a 0a 09 09 20 20 ion later.....
5fa0: 20 20 73 65 74 20 62 72 65 61 6b 73 28 24 62 65 set breaks($be
5fb0: 73 74 29 20 24 63 72 6f 73 73 28 24 62 65 73 74 st) $cross($best
5fc0: 29 0a 0a 09 09 20 20 20 20 6c 6f 67 20 77 72 69 ).... log wri
5fd0: 74 65 20 36 20 63 73 65 74 73 20 22 42 65 73 74 te 6 csets "Best
5fe0: 20 62 72 65 61 6b 20 40 20 24 62 65 73 74 2c 20 break @ $best,
5ff0: 63 75 74 74 69 6e 67 20 5b 6e 73 70 20 24 63 72 cutting [nsp $cr
6000: 6f 73 73 28 24 62 65 73 74 29 20 64 65 70 65 6e oss($best) depen
6010: 64 65 6e 63 79 20 64 65 70 65 6e 64 65 6e 63 69 dency dependenci
6020: 65 73 5d 22 0a 0a 09 09 20 20 20 20 23 20 4e 6f es]".... # No
6030: 74 65 3a 20 54 68 65 20 76 61 6c 75 65 20 6f 66 te: The value of
6040: 20 62 65 73 74 20 69 73 20 61 6e 20 61 62 6f 6c best is an abol
6050: 75 74 65 20 6c 6f 63 61 74 69 6f 6e 0a 09 09 20 ute location...
6060: 20 20 20 23 20 69 6e 20 6d 79 69 74 65 6d 73 2e # in myitems.
6070: 20 55 73 65 20 74 68 65 20 73 74 61 72 74 20 6f Use the start o
6080: 66 20 63 75 72 72 65 6e 74 20 74 6f 20 6d 61 6b f current to mak
6090: 65 20 69 74 0a 09 09 20 20 20 20 23 20 61 6e 20 e it... # an
60a0: 69 6e 64 65 78 20 61 62 73 6f 6c 75 74 65 20 74 index absolute t
60b0: 6f 20 63 75 72 72 65 6e 74 2e 0a 0a 09 09 20 20 o current.....
60c0: 20 20 73 65 74 20 62 72 65 6c 20 5b 65 78 70 72 set brel [expr
60d0: 20 7b 24 62 65 73 74 20 2d 20 5b 6c 69 6e 64 65 {$best - [linde
60e0: 78 20 24 63 75 72 72 65 6e 74 20 30 5d 7d 5d 0a x $current 0]}].
60f0: 09 09 20 20 20 20 73 65 74 20 62 6e 65 78 74 20 .. set bnext
6100: 24 62 72 65 6c 20 3b 20 69 6e 63 72 20 62 6e 65 $brel ; incr bne
6110: 78 74 0a 09 09 20 20 20 20 73 65 74 20 66 72 61 xt... set fra
6120: 67 62 65 66 6f 72 65 20 5b 6c 72 61 6e 67 65 20 gbefore [lrange
6130: 24 63 75 72 72 65 6e 74 20 30 20 24 62 72 65 6c $current 0 $brel
6140: 5d 0a 09 09 20 20 20 20 73 65 74 20 66 72 61 67 ]... set frag
6150: 61 66 74 65 72 20 20 5b 6c 72 61 6e 67 65 20 24 after [lrange $
6160: 63 75 72 72 65 6e 74 20 24 62 6e 65 78 74 20 65 current $bnext e
6170: 6e 64 5d 0a 0a 09 09 20 20 20 20 6c 6f 67 20 77 nd].... log w
6180: 72 69 74 65 20 36 20 63 73 65 74 73 20 22 4e 65 rite 6 csets "Ne
6190: 77 20 70 69 65 63 65 73 20 20 5b 50 52 20 24 66 w pieces [PR $f
61a0: 72 61 67 62 65 66 6f 72 65 5d 20 5b 50 52 20 24 ragbefore] [PR $
61b0: 66 72 61 67 61 66 74 65 72 5d 22 0a 0a 09 09 20 fragafter]"....
61c0: 20 20 20 69 6e 74 65 67 72 69 74 79 20 61 73 73 integrity ass
61d0: 65 72 74 20 7b 5b 6c 6c 65 6e 67 74 68 20 24 66 ert {[llength $f
61e0: 72 61 67 62 65 66 6f 72 65 5d 7d 20 7b 46 6f 75 ragbefore]} {Fou
61f0: 6e 64 20 7a 65 72 6f 2d 6c 65 6e 67 74 68 20 66 nd zero-length f
6200: 72 61 67 6d 65 6e 74 20 61 74 20 74 68 65 20 62 ragment at the b
6210: 65 67 69 6e 6e 69 6e 67 7d 0a 09 09 20 20 20 20 eginning}...
6220: 69 6e 74 65 67 72 69 74 79 20 61 73 73 65 72 74 integrity assert
6230: 20 7b 5b 6c 6c 65 6e 67 74 68 20 24 66 72 61 67 {[llength $frag
6240: 61 66 74 65 72 5d 7d 20 20 7b 46 6f 75 6e 64 20 after]} {Found
6250: 7a 65 72 6f 2d 6c 65 6e 67 74 68 20 66 72 61 67 zero-length frag
6260: 6d 65 6e 74 20 61 74 20 74 68 65 20 65 6e 64 7d ment at the end}
6270: 0a 0a 09 09 20 20 20 20 6c 61 70 70 65 6e 64 20 .... lappend
6280: 6e 65 77 20 24 66 72 61 67 62 65 66 6f 72 65 20 new $fragbefore
6290: 24 66 72 61 67 61 66 74 65 72 0a 09 09 20 20 20 $fragafter...
62a0: 20 43 75 74 41 74 20 24 62 65 73 74 0a 09 09 7d CutAt $best...}
62b0: 0a 0a 09 09 69 6e 63 72 20 61 74 0a 09 20 20 20 ....incr at..
62c0: 20 7d 0a 09 7d 0a 0a 09 6c 6f 67 20 77 72 69 74 }..}...log writ
62d0: 65 20 36 20 63 73 65 74 73 20 22 2e 20 2e 20 2e e 6 csets ". . .
62e0: 2e 20 2e 2e 2e 20 2e 2e 2e 2e 2e 20 2e 2e 2e 2e . ... ..... ....
62f0: 2e 2e 2e 2e 20 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e .... ...........
6300: 2e 2e 22 0a 0a 09 72 65 74 75 72 6e 20 24 66 72 .."...return $fr
6310: 61 67 6d 65 6e 74 73 0a 20 20 20 20 7d 0a 0a 20 agments. }..
6320: 20 20 20 70 72 6f 63 20 49 6e 69 74 69 61 6c 69 proc Initiali
6330: 7a 65 42 72 65 61 6b 53 74 61 74 65 20 7b 72 65 zeBreakState {re
6340: 76 69 73 69 6f 6e 73 7d 20 7b 0a 09 75 70 76 61 visions} {..upva
6350: 72 20 31 20 70 6f 73 20 70 6f 73 20 63 72 6f 73 r 1 pos pos cros
6360: 73 20 63 72 6f 73 73 20 72 61 6e 67 65 20 72 61 s cross range ra
6370: 6e 67 65 20 64 65 70 63 20 64 65 70 63 20 64 65 nge depc depc de
6380: 6c 74 61 20 64 65 6c 74 61 20 5c 0a 09 20 20 20 lta delta \..
6390: 20 64 65 70 65 6e 64 65 6e 63 69 65 73 20 64 65 dependencies de
63a0: 70 65 6e 64 65 6e 63 69 65 73 0a 0a 09 23 20 46 pendencies...# F
63b0: 69 72 73 74 20 77 65 20 63 72 65 61 74 65 20 61 irst we create a
63c0: 20 6d 61 70 20 6f 66 20 70 6f 73 69 74 69 6f 6e map of position
63d0: 73 20 74 6f 20 6d 61 6b 65 20 69 74 20 65 61 73 s to make it eas
63e0: 69 65 72 20 74 6f 0a 09 23 20 64 65 74 65 72 6d ier to..# determ
63f0: 69 6e 65 20 77 68 65 74 68 65 72 20 61 20 64 65 ine whether a de
6400: 70 65 6e 64 65 6e 63 79 20 63 72 6f 73 73 65 73 pendency crosses
6410: 20 61 20 70 61 72 74 69 63 75 6c 61 72 20 69 6e a particular in
6420: 64 65 78 2e 0a 0a 09 6c 6f 67 20 77 72 69 74 65 dex....log write
6430: 20 31 34 20 63 73 65 74 73 20 7b 49 42 53 3a 20 14 csets {IBS:
6440: 23 72 65 76 20 5b 6c 6c 65 6e 67 74 68 20 24 72 #rev [llength $r
6450: 65 76 69 73 69 6f 6e 73 5d 7d 0a 09 6c 6f 67 20 evisions]}..log
6460: 77 72 69 74 65 20 31 34 20 63 73 65 74 73 20 7b write 14 csets {
6470: 49 42 53 3a 20 70 6f 73 20 6d 61 70 2c 20 63 72 IBS: pos map, cr
6480: 6f 73 73 20 63 6f 75 6e 74 65 72 7d 0a 0a 09 61 oss counter}...a
6490: 72 72 61 79 20 73 65 74 20 70 6f 73 20 20 20 7b rray set pos {
64a0: 7d 0a 09 61 72 72 61 79 20 73 65 74 20 63 72 6f }..array set cro
64b0: 73 73 20 7b 7d 0a 09 61 72 72 61 79 20 73 65 74 ss {}..array set
64c0: 20 64 65 70 63 20 20 7b 7d 0a 09 73 65 74 20 72 depc {}..set r
64d0: 61 6e 67 65 20 20 20 20 20 20 20 7b 7d 0a 09 73 ange {}..s
64e0: 65 74 20 6e 20 30 0a 09 66 6f 72 65 61 63 68 20 et n 0..foreach
64f0: 72 65 76 20 24 72 65 76 69 73 69 6f 6e 73 20 7b rev $revisions {
6500: 0a 09 20 20 20 20 6c 61 70 70 65 6e 64 20 72 61 .. lappend ra
6510: 6e 67 65 20 24 6e 0a 09 20 20 20 20 73 65 74 20 nge $n.. set
6520: 70 6f 73 28 24 72 65 76 29 20 24 6e 0a 09 20 20 pos($rev) $n..
6530: 20 20 73 65 74 20 63 72 6f 73 73 28 24 6e 29 20 set cross($n)
6540: 30 0a 09 20 20 20 20 69 6e 63 72 20 6e 0a 09 7d 0.. incr n..}
6550: 0a 0a 09 6c 6f 67 20 77 72 69 74 65 20 31 34 20 ...log write 14
6560: 63 73 65 74 73 20 7b 49 42 53 3a 20 70 6f 73 2f csets {IBS: pos/
6570: 5b 61 72 72 61 79 20 73 69 7a 65 20 70 6f 73 5d [array size pos]
6580: 2c 20 63 72 6f 73 73 2f 5b 61 72 72 61 79 20 73 , cross/[array s
6590: 69 7a 65 20 63 72 6f 73 73 5d 7d 0a 0a 09 23 20 ize cross]}...#
65a0: 53 65 63 6f 6e 64 6c 79 20 77 65 20 63 6f 75 6e Secondly we coun
65b0: 74 20 74 68 65 20 63 72 6f 73 73 69 6e 67 73 20 t the crossings
65c0: 70 65 72 20 70 6f 73 69 74 69 6f 6e 2c 20 62 79 per position, by
65d0: 20 69 74 65 72 61 74 69 6e 67 0a 09 23 20 6f 76 iterating..# ov
65e0: 65 72 20 74 68 65 20 72 65 63 6f 72 64 65 64 20 er the recorded
65f0: 69 6e 74 65 72 6e 61 6c 20 64 65 70 65 6e 64 65 internal depende
6600: 6e 63 69 65 73 2e 0a 0a 09 23 20 4e 6f 74 65 3a ncies....# Note:
6610: 20 49 66 20 74 68 65 20 74 69 6d 65 73 74 61 6d If the timestam
6620: 70 73 20 61 72 65 20 62 61 64 6c 79 20 6f 75 74 ps are badly out
6630: 20 6f 66 20 6f 72 64 65 72 20 69 74 20 69 73 0a of order it is.
6640: 09 23 20 20 20 20 20 20 20 70 6f 73 73 69 62 6c .# possibl
6650: 65 20 74 6f 20 68 61 76 65 20 61 20 62 61 63 6b e to have a back
6660: 77 61 72 64 20 73 75 63 63 65 73 73 6f 72 20 64 ward successor d
6670: 65 70 65 6e 64 65 6e 63 79 2c 0a 09 23 20 20 20 ependency,..#
6680: 20 20 20 20 69 2e 65 2e 20 77 69 74 68 20 73 74 i.e. with st
6690: 61 72 74 20 3e 20 65 6e 64 2e 20 57 65 20 6d 61 art > end. We ma
66a0: 79 20 68 61 76 65 20 74 6f 20 73 77 61 70 20 74 y have to swap t
66b0: 68 65 20 69 6e 64 69 63 65 73 0a 09 23 20 20 20 he indices..#
66c0: 20 20 20 20 74 6f 20 65 6e 73 75 72 65 20 74 68 to ensure th
66d0: 61 74 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 at the following
66e0: 20 6c 6f 6f 70 20 72 75 6e 73 20 63 6f 72 72 65 loop runs corre
66f0: 63 74 6c 79 2e 0a 09 23 0a 09 23 20 4e 6f 74 65 ctly...#..# Note
6700: 20 32 3a 20 73 74 61 72 74 20 3d 3d 20 65 6e 64 2: start == end
6710: 20 69 73 20 6e 6f 74 20 70 6f 73 73 69 62 6c 65 is not possible
6720: 2e 20 49 74 20 69 6e 64 69 63 61 74 65 73 20 61 . It indicates a
6730: 0a 09 23 20 20 20 20 20 20 20 20 20 73 65 6c 66 ..# self
6740: 2d 64 65 70 65 6e 64 65 6e 63 79 20 64 75 65 20 -dependency due
6750: 74 6f 20 74 68 65 20 75 6e 69 71 75 65 6e 65 73 to the uniquenes
6760: 73 20 6f 66 20 70 6f 73 69 74 69 6f 6e 73 2c 0a s of positions,.
6770: 09 23 20 20 20 20 20 20 20 20 20 61 6e 64 20 74 .# and t
6780: 68 61 74 20 69 73 20 73 6f 6d 65 74 68 69 6e 67 hat is something
6790: 20 77 65 20 68 61 76 65 20 72 75 6c 65 64 20 6f we have ruled o
67a0: 75 74 20 61 6c 72 65 61 64 79 2c 20 73 65 65 0a ut already, see.
67b0: 09 23 20 20 20 20 20 20 20 20 20 27 72 65 76 20 .# 'rev
67c0: 69 6e 74 65 72 6e 61 6c 73 75 63 63 65 73 73 6f internalsuccesso
67d0: 72 73 27 2e 0a 0a 09 6c 6f 67 20 77 72 69 74 65 rs'....log write
67e0: 20 31 34 20 63 73 65 74 73 20 7b 49 42 53 3a 20 14 csets {IBS:
67f0: 63 72 6f 73 73 20 63 6f 75 6e 74 65 72 20 66 69 cross counter fi
6800: 6c 6c 69 6e 67 2c 20 70 6f 73 2f 63 72 6f 73 73 lling, pos/cross
6810: 20 6d 61 70 7d 0a 0a 09 66 6f 72 65 61 63 68 20 map}...foreach
6820: 7b 72 69 64 20 63 68 69 6c 64 72 65 6e 7d 20 5b {rid children} [
6830: 61 72 72 61 79 20 67 65 74 20 64 65 70 65 6e 64 array get depend
6840: 65 6e 63 69 65 73 5d 20 7b 0a 09 20 20 20 20 66 encies] {.. f
6850: 6f 72 65 61 63 68 20 63 68 69 6c 64 20 24 63 68 oreach child $ch
6860: 69 6c 64 72 65 6e 20 7b 0a 09 09 73 65 74 20 64 ildren {...set d
6870: 6b 65 79 20 20 20 20 5b 6c 69 73 74 20 24 72 69 key [list $ri
6880: 64 20 24 63 68 69 6c 64 5d 0a 09 09 73 65 74 20 d $child]...set
6890: 73 74 61 72 74 20 20 20 24 70 6f 73 28 24 72 69 start $pos($ri
68a0: 64 29 0a 09 09 73 65 74 20 65 6e 64 20 20 20 20 d)...set end
68b0: 20 24 70 6f 73 28 24 63 68 69 6c 64 29 0a 0a 09 $pos($child)...
68c0: 09 69 66 20 7b 24 73 74 61 72 74 20 3e 20 24 65 .if {$start > $e
68d0: 6e 64 7d 20 7b 0a 09 09 20 20 20 20 73 65 74 20 nd} {... set
68e0: 63 72 6f 73 73 65 73 20 5b 6c 69 73 74 20 24 65 crosses [list $e
68f0: 6e 64 20 5b 65 78 70 72 20 7b 24 73 74 61 72 74 nd [expr {$start
6900: 2d 31 7d 5d 5d 0a 09 09 20 20 20 20 77 68 69 6c -1}]]... whil
6910: 65 20 7b 24 65 6e 64 20 3c 20 24 73 74 61 72 74 e {$end < $start
6920: 7d 20 7b 0a 09 09 09 69 6e 63 72 20 63 72 6f 73 } {....incr cros
6930: 73 28 24 65 6e 64 29 0a 09 09 09 69 6e 63 72 20 s($end)....incr
6940: 65 6e 64 0a 09 09 20 20 20 20 7d 0a 09 09 7d 20 end... }...}
6950: 65 6c 73 65 20 7b 0a 09 09 20 20 20 20 73 65 74 else {... set
6960: 20 63 72 6f 73 73 65 73 20 5b 6c 69 73 74 20 24 crosses [list $
6970: 73 74 61 72 74 20 5b 65 78 70 72 20 7b 24 65 6e start [expr {$en
6980: 64 2d 31 7d 5d 5d 0a 09 09 20 20 20 20 77 68 69 d-1}]]... whi
6990: 6c 65 20 7b 24 73 74 61 72 74 20 3c 20 24 65 6e le {$start < $en
69a0: 64 7d 20 7b 0a 09 09 09 69 6e 63 72 20 63 72 6f d} {....incr cro
69b0: 73 73 28 24 73 74 61 72 74 29 0a 09 09 09 69 6e ss($start)....in
69c0: 63 72 20 73 74 61 72 74 0a 09 09 20 20 20 20 7d cr start... }
69d0: 0a 09 09 7d 0a 09 09 73 65 74 20 64 65 70 63 28 ...}...set depc(
69e0: 24 64 6b 65 79 29 20 24 63 72 6f 73 73 65 73 0a $dkey) $crosses.
69f0: 09 20 20 20 20 7d 0a 09 7d 0a 0a 09 6c 6f 67 20 . }..}...log
6a00: 77 72 69 74 65 20 31 34 20 63 73 65 74 73 20 7b write 14 csets {
6a10: 49 42 53 3a 20 70 6f 73 2f 5b 61 72 72 61 79 20 IBS: pos/[array
6a20: 73 69 7a 65 20 70 6f 73 5d 2c 20 63 72 6f 73 73 size pos], cross
6a30: 2f 5b 61 72 72 61 79 20 73 69 7a 65 20 63 72 6f /[array size cro
6a40: 73 73 5d 2c 20 64 65 70 63 2f 5b 61 72 72 61 79 ss], depc/[array
6a50: 20 73 69 7a 65 20 64 65 70 63 5d 20 28 66 6f 72 size depc] (for
6a60: 20 5b 6c 6c 65 6e 67 74 68 20 24 72 65 76 69 73 [llength $revis
6a70: 69 6f 6e 73 5d 29 7d 0a 09 6c 6f 67 20 77 72 69 ions])}..log wri
6a80: 74 65 20 31 34 20 63 73 65 74 73 20 7b 49 42 53 te 14 csets {IBS
6a90: 3a 20 74 69 6d 65 73 74 61 6d 70 73 2c 20 64 65 : timestamps, de
6aa0: 6c 74 61 73 7d 0a 0a 09 49 6e 69 74 69 61 6c 69 ltas}...Initiali
6ab0: 7a 65 44 65 6c 74 61 73 20 24 72 65 76 69 73 69 zeDeltas $revisi
6ac0: 6f 6e 73 0a 0a 09 6c 6f 67 20 77 72 69 74 65 20 ons...log write
6ad0: 31 34 20 63 73 65 74 73 20 7b 49 42 53 3a 20 64 14 csets {IBS: d
6ae0: 65 6c 74 61 20 5b 61 72 72 61 79 20 73 69 7a 65 elta [array size
6af0: 20 64 65 6c 74 61 5d 7d 0a 09 72 65 74 75 72 6e delta]}..return
6b00: 0a 20 20 20 20 7d 0a 0a 20 20 20 20 70 72 6f 63 . }.. proc
6b10: 20 49 6e 69 74 69 61 6c 69 7a 65 44 65 6c 74 61 InitializeDelta
6b20: 73 20 7b 72 65 76 69 73 69 6f 6e 73 7d 20 7b 0a s {revisions} {.
6b30: 09 75 70 76 61 72 20 31 20 64 65 6c 74 61 20 64 .upvar 1 delta d
6b40: 65 6c 74 61 0a 0a 09 23 20 50 75 6c 6c 20 74 68 elta...# Pull th
6b50: 65 20 74 69 6d 65 73 74 61 6d 70 73 20 66 6f 72 e timestamps for
6b60: 20 61 6c 6c 20 72 65 76 69 73 69 6f 6e 73 20 69 all revisions i
6b70: 6e 20 74 68 65 20 63 68 61 6e 67 65 73 65 74 73 n the changesets
6b80: 20 61 6e 64 0a 09 23 20 63 6f 6d 70 75 74 65 20 and..# compute
6b90: 74 68 65 69 72 20 64 65 6c 74 61 73 20 66 6f 72 their deltas for
6ba0: 20 75 73 65 20 62 79 20 74 68 65 20 62 72 65 61 use by the brea
6bb0: 6b 20 66 69 6e 64 65 72 2e 0a 0a 09 61 72 72 61 k finder....arra
6bc0: 79 20 73 65 74 20 64 65 6c 74 61 20 7b 7d 0a 09 y set delta {}..
6bd0: 61 72 72 61 79 20 73 65 74 20 73 74 61 6d 70 20 array set stamp
6be0: 7b 7d 0a 0a 09 73 65 74 20 74 68 65 73 65 74 20 {}...set theset
6bf0: 28 27 5b 6a 6f 69 6e 20 24 72 65 76 69 73 69 6f ('[join $revisio
6c00: 6e 73 20 7b 27 2c 27 7d 5d 27 29 0a 09 73 74 61 ns {','}]')..sta
6c10: 74 65 20 66 6f 72 65 61 63 68 72 6f 77 20 5b 73 te foreachrow [s
6c20: 75 62 73 74 20 2d 6e 6f 63 6f 6d 6d 61 6e 64 73 ubst -nocommands
6c30: 20 2d 6e 6f 62 61 63 6b 73 6c 61 73 68 65 73 20 -nobackslashes
6c40: 7b 0a 09 20 20 20 20 53 45 4c 45 43 54 20 52 2e {.. SELECT R.
6c50: 72 69 64 20 41 53 20 78 72 69 64 2c 20 52 2e 64 rid AS xrid, R.d
6c60: 61 74 65 20 41 53 20 74 69 6d 65 0a 09 20 20 20 ate AS time..
6c70: 20 46 52 4f 4d 20 72 65 76 69 73 69 6f 6e 20 52 FROM revision R
6c80: 0a 09 20 20 20 20 57 48 45 52 45 20 52 2e 72 69 .. WHERE R.ri
6c90: 64 20 49 4e 20 24 74 68 65 73 65 74 0a 09 7d 5d d IN $theset..}]
6ca0: 20 7b 0a 09 20 20 20 20 73 65 74 20 73 74 61 6d {.. set stam
6cb0: 70 28 24 78 72 69 64 29 20 24 74 69 6d 65 0a 09 p($xrid) $time..
6cc0: 7d 0a 0a 09 6c 6f 67 20 77 72 69 74 65 20 31 34 }...log write 14
6cd0: 20 63 73 65 74 73 20 7b 49 42 53 3a 20 73 74 61 csets {IBS: sta
6ce0: 6d 70 20 5b 61 72 72 61 79 20 73 69 7a 65 20 73 mp [array size s
6cf0: 74 61 6d 70 5d 7d 0a 0a 09 73 65 74 20 6e 20 30 tamp]}...set n 0
6d00: 0a 09 66 6f 72 65 61 63 68 20 72 69 64 20 5b 6c ..foreach rid [l
6d10: 72 61 6e 67 65 20 24 72 65 76 69 73 69 6f 6e 73 range $revisions
6d20: 20 30 20 65 6e 64 2d 31 5d 20 72 6e 65 78 74 20 0 end-1] rnext
6d30: 5b 6c 72 61 6e 67 65 20 24 72 65 76 69 73 69 6f [lrange $revisio
6d40: 6e 73 20 31 20 65 6e 64 5d 20 7b 0a 09 20 20 20 ns 1 end] {..
6d50: 20 73 65 74 20 64 65 6c 74 61 28 24 6e 29 20 5b set delta($n) [
6d60: 65 78 70 72 20 7b 24 73 74 61 6d 70 28 24 72 6e expr {$stamp($rn
6d70: 65 78 74 29 20 2d 20 24 73 74 61 6d 70 28 24 72 ext) - $stamp($r
6d80: 69 64 29 7d 5d 0a 09 20 20 20 20 69 6e 63 72 20 id)}].. incr
6d90: 6e 0a 09 7d 0a 09 72 65 74 75 72 6e 0a 20 20 20 n..}..return.
6da0: 20 7d 0a 0a 20 20 20 20 70 72 6f 63 20 46 69 6e }.. proc Fin
6db0: 64 42 65 73 74 42 72 65 61 6b 20 7b 72 61 6e 67 dBestBreak {rang
6dc0: 65 7d 20 7b 0a 09 75 70 76 61 72 20 31 20 63 72 e} {..upvar 1 cr
6dd0: 6f 73 73 20 63 72 6f 73 73 20 64 65 6c 74 61 20 oss cross delta
6de0: 64 65 6c 74 61 0a 0a 09 23 20 44 65 74 65 72 6d delta...# Determ
6df0: 69 6e 65 20 74 68 65 20 62 65 73 74 20 62 72 65 ine the best bre
6e00: 61 6b 20 6c 6f 63 61 74 69 6f 6e 20 69 6e 20 74 ak location in t
6e10: 68 65 20 67 69 76 65 6e 20 72 61 6e 67 65 20 6f he given range o
6e20: 66 0a 09 23 20 70 6f 73 69 74 69 6f 6e 73 2e 20 f..# positions.
6e30: 46 69 72 73 74 20 77 65 20 6c 6f 6f 6b 20 66 6f First we look fo
6e40: 72 20 74 68 65 20 6c 6f 63 61 74 69 6f 6e 73 20 r the locations
6e50: 77 69 74 68 20 74 68 65 20 6d 61 78 69 6d 61 6c with the maximal
6e60: 0a 09 23 20 6e 75 6d 62 65 72 20 6f 66 20 63 72 ..# number of cr
6e70: 6f 73 73 69 6e 67 73 2e 20 49 66 20 74 68 65 72 ossings. If ther
6e80: 65 20 61 72 65 20 73 65 76 65 72 61 6c 20 77 65 e are several we
6e90: 20 6c 6f 6f 6b 20 66 6f 72 20 74 68 65 0a 09 23 look for the..#
6ea0: 20 73 68 6f 72 74 65 73 74 20 74 69 6d 65 20 69 shortest time i
6eb0: 6e 74 65 72 76 61 6c 20 61 6d 6f 6e 67 20 74 68 nterval among th
6ec0: 65 6d 2e 20 49 66 20 77 65 20 73 74 69 6c 6c 20 em. If we still
6ed0: 68 61 76 65 20 6d 75 6c 74 69 70 6c 65 0a 09 23 have multiple..#
6ee0: 20 70 6f 73 73 69 62 69 6c 69 74 69 65 73 20 61 possibilities a
6ef0: 66 74 65 72 20 74 68 61 74 20 77 65 20 73 65 6c fter that we sel
6f00: 65 63 74 20 74 68 65 20 65 61 72 6c 69 65 73 74 ect the earliest
6f10: 20 6c 6f 63 61 74 69 6f 6e 0a 09 23 20 61 6d 6f location..# amo
6f20: 6e 67 20 74 68 65 73 65 2e 0a 0a 09 23 20 4e 6f ng these....# No
6f30: 74 65 3a 20 49 66 20 74 68 65 20 6d 61 78 69 6d te: If the maxim
6f40: 61 6c 20 6e 75 6d 62 65 72 20 6f 66 20 63 72 6f al number of cro
6f50: 73 73 69 6e 67 73 20 69 73 20 30 20 74 68 65 6e ssings is 0 then
6f60: 20 74 68 65 20 72 61 6e 67 65 0a 09 23 20 20 20 the range..#
6f70: 20 20 20 20 68 61 73 20 6e 6f 20 69 6e 74 65 72 has no inter
6f80: 6e 61 6c 20 64 65 70 65 6e 64 65 6e 63 69 65 73 nal dependencies
6f90: 2c 20 61 6e 64 20 6e 6f 20 62 72 65 61 6b 20 6c , and no break l
6fa0: 6f 63 61 74 69 6f 6e 20 61 74 0a 09 23 20 20 20 ocation at..#
6fb0: 20 20 20 20 61 6c 6c 2e 20 54 68 69 73 20 70 6f all. This po
6fc0: 73 73 69 62 69 6c 69 74 79 20 69 73 20 73 69 67 ssibility is sig
6fd0: 6e 61 6c 65 64 20 76 69 61 20 72 65 73 75 6c 74 naled via result
6fe0: 20 2d 31 2e 0a 0a 09 23 20 4e 6f 74 65 3a 20 41 -1....# Note: A
6ff0: 20 72 61 6e 67 65 20 6f 66 20 6c 65 6e 67 74 68 range of length
7000: 20 31 20 6f 72 20 6c 65 73 73 20 63 61 6e 6e 6f 1 or less canno
7010: 74 20 68 61 76 65 20 69 6e 74 65 72 6e 61 6c 0a t have internal.
7020: 09 23 20 20 20 20 20 20 20 64 65 70 65 6e 64 65 .# depende
7030: 6e 63 69 65 73 2c 20 61 73 20 74 68 61 74 20 6e ncies, as that n
7040: 65 65 64 73 20 61 74 20 6c 65 61 73 74 20 74 77 eeds at least tw
7050: 6f 20 72 65 76 69 73 69 6f 6e 73 20 69 6e 0a 09 o revisions in..
7060: 23 20 20 20 20 20 20 20 74 68 65 20 72 61 6e 67 # the rang
7070: 65 2e 0a 0a 09 69 66 20 7b 5b 6c 6c 65 6e 67 74 e....if {[llengt
7080: 68 20 24 72 61 6e 67 65 5d 20 3c 20 32 7d 20 7b h $range] < 2} {
7090: 20 72 65 74 75 72 6e 20 2d 31 20 7d 0a 0a 09 73 return -1 }...s
70a0: 65 74 20 6d 61 78 20 2d 31 0a 09 73 65 74 20 62 et max -1..set b
70b0: 65 73 74 20 7b 7d 0a 0a 09 66 6f 72 65 61 63 68 est {}...foreach
70c0: 20 6c 6f 63 61 74 69 6f 6e 20 24 72 61 6e 67 65 location $range
70d0: 20 7b 0a 09 20 20 20 20 73 65 74 20 63 72 6f 73 {.. set cros
70e0: 73 69 6e 67 73 20 24 63 72 6f 73 73 28 24 6c 6f sings $cross($lo
70f0: 63 61 74 69 6f 6e 29 0a 09 20 20 20 20 69 66 20 cation).. if
7100: 7b 24 63 72 6f 73 73 69 6e 67 73 20 3e 20 24 6d {$crossings > $m
7110: 61 78 7d 20 7b 0a 09 09 73 65 74 20 6d 61 78 20 ax} {...set max
7120: 20 24 63 72 6f 73 73 69 6e 67 73 0a 09 09 73 65 $crossings...se
7130: 74 20 62 65 73 74 20 5b 6c 69 73 74 20 24 6c 6f t best [list $lo
7140: 63 61 74 69 6f 6e 5d 0a 09 09 63 6f 6e 74 69 6e cation]...contin
7150: 75 65 0a 09 20 20 20 20 7d 20 65 6c 73 65 69 66 ue.. } elseif
7160: 20 7b 24 63 72 6f 73 73 69 6e 67 73 20 3d 3d 20 {$crossings ==
7170: 24 6d 61 78 7d 20 7b 0a 09 09 6c 61 70 70 65 6e $max} {...lappen
7180: 64 20 62 65 73 74 20 24 6c 6f 63 61 74 69 6f 6e d best $location
7190: 0a 09 20 20 20 20 7d 0a 09 7d 0a 0a 09 69 66 20 .. }..}...if
71a0: 7b 24 6d 61 78 20 3d 3d 20 30 7d 20 20 20 20 20 {$max == 0}
71b0: 20 20 20 20 20 20 20 7b 20 72 65 74 75 72 6e 20 { return
71c0: 2d 31 20 7d 0a 09 69 66 20 7b 5b 6c 6c 65 6e 67 -1 }..if {[lleng
71d0: 74 68 20 24 62 65 73 74 5d 20 3d 3d 20 31 7d 20 th $best] == 1}
71e0: 7b 20 72 65 74 75 72 6e 20 5b 6c 69 6e 64 65 78 { return [lindex
71f0: 20 24 62 65 73 74 20 30 5d 20 7d 0a 0a 09 73 65 $best 0] }...se
7200: 74 20 6c 6f 63 61 74 69 6f 6e 73 20 24 62 65 73 t locations $bes
7210: 74 0a 09 73 65 74 20 62 65 73 74 20 7b 7d 0a 09 t..set best {}..
7220: 73 65 74 20 6d 69 6e 20 2d 31 0a 0a 09 66 6f 72 set min -1...for
7230: 65 61 63 68 20 6c 6f 63 61 74 69 6f 6e 20 24 6c each location $l
7240: 6f 63 61 74 69 6f 6e 73 20 7b 0a 09 20 20 20 20 ocations {..
7250: 73 65 74 20 69 6e 74 65 72 76 61 6c 20 24 64 65 set interval $de
7260: 6c 74 61 28 24 6c 6f 63 61 74 69 6f 6e 29 0a 09 lta($location)..
7270: 20 20 20 20 69 66 20 7b 28 24 6d 69 6e 20 3c 20 if {($min <
7280: 30 29 20 7c 7c 20 28 24 69 6e 74 65 72 76 61 6c 0) || ($interval
7290: 20 3c 20 24 6d 69 6e 29 7d 20 7b 0a 09 09 73 65 < $min)} {...se
72a0: 74 20 6d 69 6e 20 20 24 69 6e 74 65 72 76 61 6c t min $interval
72b0: 0a 09 09 73 65 74 20 62 65 73 74 20 5b 6c 69 73 ...set best [lis
72c0: 74 20 24 6c 6f 63 61 74 69 6f 6e 5d 0a 09 20 20 t $location]..
72d0: 20 20 7d 20 65 6c 73 65 69 66 20 7b 24 69 6e 74 } elseif {$int
72e0: 65 72 76 61 6c 20 3d 3d 20 24 6d 69 6e 7d 20 7b erval == $min} {
72f0: 0a 09 09 6c 61 70 70 65 6e 64 20 62 65 73 74 20 ...lappend best
7300: 24 6c 6f 63 61 74 69 6f 6e 0a 09 20 20 20 20 7d $location.. }
7310: 0a 09 7d 0a 0a 09 69 66 20 7b 5b 6c 6c 65 6e 67 ..}...if {[lleng
7320: 74 68 20 24 62 65 73 74 5d 20 3d 3d 20 31 7d 20 th $best] == 1}
7330: 7b 20 72 65 74 75 72 6e 20 5b 6c 69 6e 64 65 78 { return [lindex
7340: 20 24 62 65 73 74 20 30 5d 20 7d 0a 0a 09 72 65 $best 0] }...re
7350: 74 75 72 6e 20 5b 6c 69 6e 64 65 78 20 5b 6c 73 turn [lindex [ls
7360: 6f 72 74 20 2d 69 6e 74 65 67 65 72 20 2d 69 6e ort -integer -in
7370: 63 72 65 61 73 69 6e 67 20 24 62 65 73 74 5d 20 creasing $best]
7380: 30 5d 0a 20 20 20 20 7d 0a 0a 20 20 20 20 70 72 0]. }.. pr
7390: 6f 63 20 43 75 74 41 74 20 7b 6c 6f 63 61 74 69 oc CutAt {locati
73a0: 6f 6e 7d 20 7b 0a 09 75 70 76 61 72 20 31 20 63 on} {..upvar 1 c
73b0: 72 6f 73 73 20 63 72 6f 73 73 20 64 65 70 63 20 ross cross depc
73c0: 64 65 70 63 0a 0a 09 23 20 49 74 20 77 61 73 20 depc...# It was
73d0: 64 65 63 69 64 65 64 20 74 6f 20 73 70 6c 69 74 decided to split
73e0: 20 74 68 65 20 63 68 61 6e 67 65 73 65 74 20 61 the changeset a
73f0: 74 20 74 68 65 20 67 69 76 65 6e 0a 09 23 20 6c t the given..# l
7400: 6f 63 61 74 69 6f 6e 2e 20 54 68 69 73 20 63 75 ocation. This cu
7410: 74 73 20 61 20 6e 75 6d 62 65 72 20 6f 66 20 64 ts a number of d
7420: 65 70 65 6e 64 65 6e 63 69 65 73 2e 20 48 65 72 ependencies. Her
7430: 65 20 77 65 20 75 70 64 61 74 65 0a 09 23 20 74 e we update..# t
7440: 68 65 20 63 72 6f 73 73 20 69 6e 66 6f 72 6d 61 he cross informa
7450: 74 69 6f 6e 20 73 6f 20 74 68 61 74 20 74 68 65 tion so that the
7460: 20 62 72 65 61 6b 20 66 69 6e 64 65 72 20 68 61 break finder ha
7470: 73 20 61 63 63 75 72 61 74 65 0a 09 23 20 64 61 s accurate..# da
7480: 74 61 20 77 68 65 6e 20 77 65 20 6c 6f 6f 6b 20 ta when we look
7490: 61 74 20 74 68 65 20 67 65 6e 65 72 61 74 65 64 at the generated
74a0: 20 66 72 61 67 6d 65 6e 74 73 2e 0a 0a 09 73 65 fragments....se
74b0: 74 20 73 69 78 20 5b 6c 6f 67 20 76 69 73 69 62 t six [log visib
74c0: 6c 65 3f 20 36 5d 0a 0a 09 23 20 4e 6f 74 65 3a le? 6]...# Note:
74d0: 20 54 68 65 20 6c 6f 6f 70 20 62 65 6c 6f 77 20 The loop below
74e0: 63 6f 75 6c 64 20 62 65 20 6d 61 64 65 20 66 61 could be made fa
74f0: 73 74 65 72 20 62 79 20 6b 65 65 70 69 6e 67 20 ster by keeping
7500: 61 20 6d 61 70 0a 09 23 20 66 72 6f 6d 20 70 6f a map..# from po
7510: 73 69 74 69 6f 6e 73 20 74 6f 20 74 68 65 20 64 sitions to the d
7520: 65 70 65 6e 64 65 6e 63 69 65 73 20 63 72 6f 73 ependencies cros
7530: 73 69 6e 67 2e 20 41 6e 20 65 78 74 65 6e 73 69 sing. An extensi
7540: 6f 6e 20 6f 66 0a 09 23 20 43 52 4f 53 53 2c 20 on of..# CROSS,
7550: 69 2e 65 2e 20 6c 69 73 74 20 6f 66 20 64 65 70 i.e. list of dep
7560: 65 6e 64 65 6e 63 69 65 73 2c 20 63 6f 75 6e 74 endencies, count
7570: 65 72 20 69 73 20 69 6d 70 6c 69 65 64 2e 20 54 er is implied. T
7580: 61 6b 65 73 0a 09 23 20 61 20 6c 6f 74 20 6d 6f akes..# a lot mo
7590: 72 65 20 6d 65 6d 6f 72 79 20 68 6f 77 65 76 65 re memory howeve
75a0: 72 2c 20 61 6e 64 20 74 61 6b 65 73 20 74 69 6d r, and takes tim
75b0: 65 20 74 6f 20 75 70 64 61 74 65 20 68 65 72 65 e to update here
75c0: 0a 09 23 20 28 54 68 65 20 69 6e 6e 65 72 20 6c ..# (The inner l
75d0: 6f 6f 70 20 69 73 20 6e 6f 74 20 69 6e 63 72 20 oop is not incr
75e0: 2d 31 2c 20 62 75 74 20 6c 64 65 6c 65 74 65 29 -1, but ldelete)
75f0: 2e 0a 0a 09 66 6f 72 65 61 63 68 20 64 65 70 20 ....foreach dep
7600: 5b 61 72 72 61 79 20 6e 61 6d 65 73 20 64 65 70 [array names dep
7610: 63 5d 20 7b 0a 09 20 20 20 20 73 65 74 20 72 61 c] {.. set ra
7620: 6e 67 65 20 24 64 65 70 63 28 24 64 65 70 29 0a nge $depc($dep).
7630: 09 20 20 20 20 23 20 43 68 65 63 6b 20 61 6c 6c . # Check all
7640: 20 64 65 70 65 6e 64 65 6e 63 69 65 73 20 73 74 dependencies st
7650: 69 6c 6c 20 6b 6e 6f 77 6e 2c 20 74 61 6b 65 20 ill known, take
7660: 74 68 65 69 72 20 72 61 6e 67 65 20 61 6e 64 0a their range and.
7670: 09 20 20 20 20 23 20 73 65 65 20 69 66 20 74 68 . # see if th
7680: 65 20 62 72 65 61 6b 20 6c 6f 63 61 74 69 6f 6e e break location
7690: 20 66 61 6c 6c 73 20 77 69 74 68 69 6e 2e 0a 0a falls within...
76a0: 09 20 20 20 20 42 6f 72 64 65 72 20 24 72 61 6e . Border $ran
76b0: 67 65 20 73 20 65 0a 09 20 20 20 20 69 66 20 7b ge s e.. if {
76c0: 24 6c 6f 63 61 74 69 6f 6e 20 3c 20 24 73 7d 20 $location < $s}
76d0: 63 6f 6e 74 69 6e 75 65 20 3b 20 23 20 62 72 65 continue ; # bre
76e0: 61 6b 20 62 65 66 6f 72 65 20 72 61 6e 67 65 2c ak before range,
76f0: 20 69 67 6e 6f 72 65 0a 09 20 20 20 20 69 66 20 ignore.. if
7700: 7b 24 6c 6f 63 61 74 69 6f 6e 20 3e 20 24 65 7d {$location > $e}
7710: 20 63 6f 6e 74 69 6e 75 65 20 3b 20 23 20 62 72 continue ; # br
7720: 65 61 6b 20 61 66 74 65 72 20 72 61 6e 67 65 2c eak after range,
7730: 20 69 67 6e 6f 72 65 2e 0a 0a 09 20 20 20 20 23 ignore.... #
7740: 20 54 68 69 73 20 64 65 70 65 6e 64 65 6e 63 79 This dependency
7750: 20 63 72 6f 73 73 65 73 20 74 68 65 20 62 72 65 crosses the bre
7760: 61 6b 20 6c 6f 63 61 74 69 6f 6e 2e 20 57 65 20 ak location. We
7770: 72 65 6d 6f 76 65 20 69 74 0a 09 20 20 20 20 23 remove it.. #
7780: 20 66 72 6f 6d 20 74 68 65 20 63 72 6f 73 73 69 from the crossi
7790: 6e 67 73 20 63 6f 75 6e 74 65 72 73 2c 20 61 6e ngs counters, an
77a0: 64 20 74 68 65 6e 20 61 6c 73 6f 20 66 72 6f 6d d then also from
77b0: 20 74 68 65 20 73 65 74 0a 09 20 20 20 20 23 20 the set.. #
77c0: 6f 66 20 6b 6e 6f 77 6e 20 64 65 70 65 6e 64 65 of known depende
77d0: 6e 63 69 65 73 2c 20 61 73 20 77 65 20 61 72 65 ncies, as we are
77e0: 20 64 6f 6e 65 20 77 69 74 68 20 69 74 2e 0a 0a done with it...
77f0: 09 20 20 20 20 42 6f 72 64 65 72 20 24 64 65 70 . Border $dep
7800: 63 28 24 64 65 70 29 20 64 73 20 64 65 0a 09 20 c($dep) ds de..
7810: 20 20 20 66 6f 72 20 7b 73 65 74 20 6c 6f 63 20 for {set loc
7820: 24 64 73 7d 20 7b 24 6c 6f 63 20 3c 3d 20 24 64 $ds} {$loc <= $d
7830: 65 7d 20 7b 69 6e 63 72 20 6c 6f 63 7d 20 7b 0a e} {incr loc} {.
7840: 09 09 69 6e 63 72 20 63 72 6f 73 73 28 24 6c 6f ..incr cross($lo
7850: 63 29 20 2d 31 0a 09 20 20 20 20 7d 0a 09 20 20 c) -1.. }..
7860: 20 20 75 6e 73 65 74 20 64 65 70 63 28 24 64 65 unset depc($de
7870: 70 29 0a 0a 09 20 20 20 20 69 66 20 7b 21 24 73 p)... if {!$s
7880: 69 78 7d 20 63 6f 6e 74 69 6e 75 65 0a 0a 09 20 ix} continue...
7890: 20 20 20 73 74 72 75 63 74 3a 3a 6c 69 73 74 20 struct::list
78a0: 61 73 73 69 67 6e 20 24 64 65 70 20 70 61 72 65 assign $dep pare
78b0: 6e 74 20 63 68 69 6c 64 0a 09 20 20 20 20 6c 6f nt child.. lo
78c0: 67 20 77 72 69 74 65 20 35 20 63 73 65 74 73 20 g write 5 csets
78d0: 22 42 72 6f 6b 65 20 64 65 70 65 6e 64 65 6e 63 "Broke dependenc
78e0: 79 20 5b 50 44 20 24 70 61 72 65 6e 74 5d 20 2d y [PD $parent] -
78f0: 2d 3e 20 5b 50 44 20 24 63 68 69 6c 64 5d 22 0a -> [PD $child]".
7900: 09 7d 0a 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 .}...return.
7910: 7d 0a 0a 20 20 20 20 23 20 50 72 69 6e 74 20 69 }.. # Print i
7920: 64 65 6e 74 69 66 79 69 6e 67 20 64 61 74 61 20 dentifying data
7930: 66 6f 72 20 61 20 72 65 76 69 73 69 6f 6e 20 28 for a revision (
7940: 70 72 6f 6a 65 63 74 2c 20 66 69 6c 65 2c 20 64 project, file, d
7950: 6f 74 74 65 64 20 72 65 76 0a 20 20 20 20 23 20 otted rev. #
7960: 6e 75 6d 62 65 72 29 2c 20 66 6f 72 20 68 69 67 number), for hig
7970: 68 20 76 65 72 62 6f 73 69 74 79 20 6c 6f 67 20 h verbosity log
7980: 6f 75 74 70 75 74 2e 0a 20 20 20 20 23 20 54 4f output.. # TO
7990: 44 4f 3a 20 52 65 70 6c 61 63 65 20 77 69 74 68 DO: Replace with
79a0: 20 63 61 6c 6c 20 74 6f 20 69 74 65 6d 73 74 72 call to itemstr
79b0: 20 28 6c 69 73 74 20 72 65 76 20 24 69 64 29 0a (list rev $id).
79c0: 0a 20 20 20 20 70 72 6f 63 20 50 44 20 7b 69 64 . proc PD {id
79d0: 7d 20 7b 0a 09 66 6f 72 65 61 63 68 20 7b 70 20 } {..foreach {p
79e0: 66 20 72 7d 20 5b 73 74 61 74 65 20 72 75 6e 20 f r} [state run
79f0: 7b 0a 09 09 53 45 4c 45 43 54 20 50 2e 6e 61 6d {...SELECT P.nam
7a00: 65 20 2c 20 46 2e 6e 61 6d 65 2c 20 52 2e 72 65 e , F.name, R.re
7a10: 76 0a 09 09 46 52 4f 4d 20 72 65 76 69 73 69 6f v...FROM revisio
7a20: 6e 20 52 2c 20 66 69 6c 65 20 46 2c 20 70 72 6f n R, file F, pro
7a30: 6a 65 63 74 20 50 0a 09 09 57 48 45 52 45 20 52 ject P...WHERE R
7a40: 2e 72 69 64 20 3d 20 24 69 64 20 20 20 20 2d 2d .rid = $id --
7a50: 20 46 69 6e 64 20 73 70 65 63 69 66 69 65 64 20 Find specified
7a60: 66 69 6c 65 20 72 65 76 69 73 69 6f 6e 0a 09 09 file revision...
7a70: 41 4e 44 20 20 20 46 2e 66 69 64 20 3d 20 52 2e AND F.fid = R.
7a80: 66 69 64 20 20 2d 2d 20 47 65 74 20 66 69 6c 65 fid -- Get file
7a90: 20 6f 66 20 74 68 65 20 72 65 76 69 73 69 6f 6e of the revision
7aa0: 0a 09 09 41 4e 44 20 20 20 50 2e 70 69 64 20 3d ...AND P.pid =
7ab0: 20 46 2e 70 69 64 20 20 2d 2d 20 47 65 74 20 70 F.pid -- Get p
7ac0: 72 6f 6a 65 63 74 20 6f 66 20 74 68 65 20 66 69 roject of the fi
7ad0: 6c 65 2e 0a 09 7d 5d 20 62 72 65 61 6b 0a 09 72 le...}] break..r
7ae0: 65 74 75 72 6e 20 22 27 24 70 20 3a 20 24 66 2f eturn "'$p : $f/
7af0: 24 72 27 22 0a 20 20 20 20 7d 0a 0a 20 20 20 20 $r'". }..
7b00: 23 20 50 72 69 6e 74 69 6e 67 20 6f 6e 65 20 6f # Printing one o
7b10: 72 20 6d 6f 72 65 20 72 61 6e 67 65 73 2c 20 66 r more ranges, f
7b20: 6f 72 6d 61 74 74 65 64 2c 20 61 6e 64 20 6f 6e ormatted, and on
7b30: 6c 79 20 74 68 65 69 72 20 62 6f 72 64 65 72 20 ly their border
7b40: 74 6f 0a 20 20 20 20 23 20 6b 65 65 70 20 74 68 to. # keep th
7b50: 65 20 73 74 72 69 6e 67 73 20 73 68 6f 72 74 2e e strings short.
7b60: 0a 0a 20 20 20 20 70 72 6f 63 20 50 52 73 20 7b .. proc PRs {
7b70: 72 61 6e 67 65 73 7d 20 7b 0a 09 72 65 74 75 72 ranges} {..retur
7b80: 6e 20 5b 73 74 72 75 63 74 3a 3a 6c 69 73 74 20 n [struct::list
7b90: 6d 61 70 20 24 72 61 6e 67 65 73 20 5b 6d 79 70 map $ranges [myp
7ba0: 72 6f 63 20 50 52 5d 5d 0a 20 20 20 20 7d 0a 0a roc PR]]. }..
7bb0: 20 20 20 20 70 72 6f 63 20 50 52 20 7b 72 61 6e proc PR {ran
7bc0: 67 65 7d 20 7b 0a 09 42 6f 72 64 65 72 20 24 72 ge} {..Border $r
7bd0: 61 6e 67 65 20 73 20 65 0a 09 72 65 74 75 72 6e ange s e..return
7be0: 20 3c 24 7b 73 7d 2e 2e 2e 24 7b 65 7d 3e 0a 20 <${s}...${e}>.
7bf0: 20 20 20 7d 0a 0a 20 20 20 20 70 72 6f 63 20 42 }.. proc B
7c00: 6f 72 64 65 72 20 7b 72 61 6e 67 65 20 73 76 20 order {range sv
7c10: 65 76 7d 20 7b 0a 09 75 70 76 61 72 20 31 20 24 ev} {..upvar 1 $
7c20: 73 76 20 73 20 24 65 76 20 65 0a 09 73 65 74 20 sv s $ev e..set
7c30: 73 20 5b 6c 69 6e 64 65 78 20 24 72 61 6e 67 65 s [lindex $range
7c40: 20 30 5d 0a 09 73 65 74 20 65 20 5b 6c 69 6e 64 0]..set e [lind
7c50: 65 78 20 24 72 61 6e 67 65 20 65 6e 64 5d 0a 09 ex $range end]..
7c60: 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 return. }..
7c70: 20 20 23 20 23 20 23 23 20 23 23 23 20 23 23 23 # # ## ### ###
7c80: 23 23 20 23 23 23 23 23 23 23 23 20 23 23 23 23 ## ######## ####
7c90: 23 23 23 23 23 23 23 23 23 0a 0a 20 20 20 20 70 #########.. p
7ca0: 72 6f 63 20 55 6e 6d 61 70 49 74 65 6d 73 20 7b roc UnmapItems {
7cb0: 74 68 65 74 79 70 65 20 74 68 65 69 74 65 6d 73 thetype theitems
7cc0: 7d 20 7b 0a 09 23 20 28 2a 29 20 57 65 20 63 6c } {..# (*) We cl
7cd0: 65 61 72 20 6f 75 74 20 74 68 65 20 61 73 73 6f ear out the asso
7ce0: 63 69 61 74 65 64 20 70 61 72 74 20 6f 66 20 74 ciated part of t
7cf0: 68 65 20 6d 79 69 74 65 6d 6d 61 70 0a 09 23 20 he myitemmap..#
7d00: 69 6e 2d 6d 65 6d 6f 72 79 20 69 6e 64 65 78 20 in-memory index
7d10: 69 6e 20 70 72 65 70 61 72 61 74 69 6f 6e 20 66 in preparation f
7d20: 6f 72 20 6e 65 77 20 64 61 74 61 2c 20 6f 72 20 or new data, or
7d30: 61 73 20 70 61 72 74 20 6f 66 0a 09 23 20 6f 62 as part of..# ob
7d40: 6a 65 63 74 20 64 65 73 74 72 75 63 74 69 6f 6e ject destruction
7d50: 2e 20 41 20 73 69 6d 70 6c 65 20 75 6e 73 65 74 . A simple unset
7d60: 20 69 73 20 65 6e 6f 75 67 68 2c 20 77 65 20 68 is enough, we h
7d70: 61 76 65 20 6e 6f 0a 09 23 20 73 79 6d 62 6f 6c ave no..# symbol
7d80: 20 63 68 61 6e 67 65 73 65 74 73 20 61 74 20 74 changesets at t
7d90: 68 69 73 20 74 69 6d 65 2c 20 61 6e 64 20 74 68 his time, and th
7da0: 75 73 20 6e 65 76 65 72 20 6d 6f 72 65 20 74 68 us never more th
7db0: 61 6e 20 6f 6e 65 0a 09 23 20 72 65 66 65 72 65 an one..# refere
7dc0: 6e 63 65 20 69 6e 20 74 68 65 20 6c 69 73 74 2e nce in the list.
7dd0: 0a 0a 09 75 70 76 61 72 20 31 20 6d 79 69 74 65 ...upvar 1 myite
7de0: 6d 6d 61 70 20 6d 79 69 74 65 6d 6d 61 70 20 73 mmap myitemmap s
7df0: 65 6c 66 20 73 65 6c 66 0a 09 66 6f 72 65 61 63 elf self..foreac
7e00: 68 20 69 69 64 20 24 74 68 65 69 74 65 6d 73 20 h iid $theitems
7e10: 7b 0a 09 20 20 20 20 73 65 74 20 6b 65 79 20 5b {.. set key [
7e20: 6c 69 73 74 20 24 74 68 65 74 79 70 65 20 24 69 list $thetype $i
7e30: 69 64 5d 0a 09 20 20 20 20 75 6e 73 65 74 20 6d id].. unset m
7e40: 79 69 74 65 6d 6d 61 70 28 24 6b 65 79 29 0a 09 yitemmap($key)..
7e50: 20 20 20 20 6c 6f 67 20 77 72 69 74 65 20 38 20 log write 8
7e60: 63 73 65 74 73 20 7b 4d 41 50 2d 20 69 74 65 6d csets {MAP- item
7e70: 20 3c 24 6b 65 79 3e 20 24 73 65 6c 66 20 3d 20 <$key> $self =
7e80: 5b 24 73 65 6c 66 20 73 74 72 5d 7d 0a 09 7d 0a [$self str]}..}.
7e90: 09 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 .return. }..
7ea0: 20 20 20 70 72 6f 63 20 4d 61 70 49 74 65 6d 73 proc MapItems
7eb0: 20 7b 74 68 65 74 79 70 65 20 74 68 65 69 74 65 {thetype theite
7ec0: 6d 73 7d 20 7b 0a 09 75 70 76 61 72 20 31 20 6d ms} {..upvar 1 m
7ed0: 79 69 74 65 6d 6d 61 70 20 6d 79 69 74 65 6d 6d yitemmap myitemm
7ee0: 61 70 20 73 65 6c 66 20 73 65 6c 66 0a 0a 09 66 ap self self...f
7ef0: 6f 72 65 61 63 68 20 69 69 64 20 24 74 68 65 69 oreach iid $thei
7f00: 74 65 6d 73 20 7b 0a 09 20 20 20 20 73 65 74 20 tems {.. set
7f10: 6b 65 79 20 5b 6c 69 73 74 20 24 74 68 65 74 79 key [list $thety
7f20: 70 65 20 24 69 69 64 5d 0a 09 20 20 20 20 73 65 pe $iid].. se
7f30: 74 20 6d 79 69 74 65 6d 6d 61 70 28 24 6b 65 79 t myitemmap($key
7f40: 29 20 24 73 65 6c 66 0a 09 20 20 20 20 6c 6f 67 ) $self.. log
7f50: 20 77 72 69 74 65 20 38 20 63 73 65 74 73 20 7b write 8 csets {
7f60: 4d 41 50 2b 20 69 74 65 6d 20 3c 24 6b 65 79 3e MAP+ item <$key>
7f70: 20 24 73 65 6c 66 20 3d 20 5b 24 73 65 6c 66 20 $self = [$self
7f80: 73 74 72 5d 7d 0a 09 7d 0a 09 72 65 74 75 72 6e str]}..}..return
7f90: 0a 20 20 20 20 7d 0a 0a 20 20 20 20 23 20 23 20 . }.. # #
7fa0: 23 23 20 23 23 23 20 23 23 23 23 23 20 23 23 23 ## ### ##### ###
7fb0: 23 23 23 23 23 20 23 23 23 23 23 23 23 23 23 23 ##### ##########
7fc0: 23 23 23 0a 0a 20 20 20 20 74 79 70 65 76 61 72 ###.. typevar
7fd0: 69 61 62 6c 65 20 6d 79 63 68 61 6e 67 65 73 65 iable mychangese
7fe0: 74 73 20 20 20 20 20 20 20 20 20 7b 7d 20 3b 20 ts {} ;
7ff0: 23 20 4c 69 73 74 20 6f 66 20 61 6c 6c 20 6b 6e # List of all kn
8000: 6f 77 6e 0a 09 09 09 09 09 20 20 20 23 20 63 68 own...... # ch
8010: 61 6e 67 65 73 65 74 73 2e 0a 0a 20 20 20 20 23 angesets... #
8020: 20 4c 69 73 74 20 6f 66 20 61 6c 6c 20 6b 6e 6f List of all kno
8030: 77 6e 20 63 68 61 6e 67 65 73 65 74 73 20 6f 66 wn changesets of
8040: 20 61 20 74 79 70 65 2e 0a 20 20 20 20 74 79 70 a type.. typ
8050: 65 76 61 72 69 61 62 6c 65 20 6d 79 74 63 68 61 evariable mytcha
8060: 6e 67 65 73 65 74 73 20 2d 61 72 72 61 79 20 7b ngesets -array {
8070: 0a 09 73 79 6d 3a 3a 62 72 61 6e 63 68 20 7b 7d ..sym::branch {}
8080: 0a 09 73 79 6d 3a 3a 74 61 67 20 20 20 20 7b 7d ..sym::tag {}
8090: 0a 09 72 65 76 20 20 20 20 20 20 20 20 20 7b 7d ..rev {}
80a0: 0a 20 20 20 20 7d 0a 09 09 09 09 09 0a 20 20 20 . }.......
80b0: 20 74 79 70 65 76 61 72 69 61 62 6c 65 20 6d 79 typevariable my
80c0: 69 74 65 6d 6d 61 70 20 20 20 20 20 2d 61 72 72 itemmap -arr
80d0: 61 79 20 7b 7d 20 3b 20 23 20 4d 61 70 20 66 72 ay {} ; # Map fr
80e0: 6f 6d 20 69 74 65 6d 73 20 28 74 61 67 67 65 64 om items (tagged
80f0: 29 0a 09 09 09 09 09 20 20 20 23 20 74 6f 20 74 )...... # to t
8100: 68 65 20 6c 69 73 74 20 6f 66 20 63 68 61 6e 67 he list of chang
8110: 65 73 65 74 73 0a 09 09 09 09 09 20 20 20 23 20 esets...... #
8120: 63 6f 6e 74 61 69 6e 69 6e 67 20 69 74 2e 20 45 containing it. E
8130: 61 63 68 20 69 74 65 6d 0a 09 09 09 09 09 20 20 ach item......
8140: 20 23 20 63 61 6e 20 62 65 20 75 73 65 64 20 62 # can be used b
8150: 79 20 6f 6e 6c 79 20 6f 6e 65 0a 09 09 09 09 09 y only one......
8160: 20 20 20 23 20 63 68 61 6e 67 65 73 65 74 2e 0a # changeset..
8170: 20 20 20 20 74 79 70 65 76 61 72 69 61 62 6c 65 typevariable
8180: 20 6d 79 69 64 6d 61 70 20 20 20 2d 61 72 72 61 myidmap -arra
8190: 79 20 7b 7d 20 3b 20 23 20 4d 61 70 20 66 72 6f y {} ; # Map fro
81a0: 6d 20 63 68 61 6e 67 65 73 65 74 20 69 64 20 74 m changeset id t
81b0: 6f 0a 09 09 09 09 20 20 20 20 20 20 20 23 20 63 o..... # c
81c0: 68 61 6e 67 65 73 65 74 2e 0a 0a 20 20 20 20 74 hangeset... t
81d0: 79 70 65 6d 65 74 68 6f 64 20 61 6c 6c 20 20 20 ypemethod all
81e0: 20 7b 7d 20 20 20 20 7b 20 72 65 74 75 72 6e 20 {} { return
81f0: 24 6d 79 63 68 61 6e 67 65 73 65 74 73 20 7d 0a $mychangesets }.
8200: 20 20 20 20 74 79 70 65 6d 65 74 68 6f 64 20 6f typemethod o
8210: 66 20 20 20 20 20 7b 63 69 64 7d 20 7b 20 72 65 f {cid} { re
8220: 74 75 72 6e 20 24 6d 79 69 64 6d 61 70 28 24 63 turn $myidmap($c
8230: 69 64 29 20 7d 0a 20 20 20 20 74 79 70 65 6d 65 id) }. typeme
8240: 74 68 6f 64 20 6f 66 69 74 65 6d 20 7b 69 69 64 thod ofitem {iid
8250: 7d 20 7b 20 72 65 74 75 72 6e 20 24 6d 79 69 74 } { return $myit
8260: 65 6d 6d 61 70 28 24 69 69 64 29 20 7d 0a 0a 20 emmap($iid) }..
8270: 20 20 20 74 79 70 65 6d 65 74 68 6f 64 20 72 65 typemethod re
8280: 76 20 20 20 20 7b 7d 20 20 20 20 7b 20 72 65 74 v {} { ret
8290: 75 72 6e 20 24 6d 79 74 63 68 61 6e 67 65 73 65 urn $mytchangese
82a0: 74 73 28 72 65 76 29 20 7d 0a 20 20 20 20 74 79 ts(rev) }. ty
82b0: 70 65 6d 65 74 68 6f 64 20 73 79 6d 20 20 20 20 pemethod sym
82c0: 7b 7d 20 20 20 20 7b 20 72 65 74 75 72 6e 20 5b {} { return [
82d0: 63 6f 6e 63 61 74 20 5c 0a 09 09 09 09 09 20 20 concat \......
82e0: 24 7b 6d 79 74 63 68 61 6e 67 65 73 65 74 73 28 ${mytchangesets(
82f0: 73 79 6d 3a 3a 62 72 61 6e 63 68 29 7d 20 5c 0a sym::branch)} \.
8300: 09 09 09 09 09 20 20 24 7b 6d 79 74 63 68 61 6e ..... ${mytchan
8310: 67 65 73 65 74 73 28 73 79 6d 3a 3a 74 61 67 29 gesets(sym::tag)
8320: 7d 5d 20 7d 0a 0a 20 20 20 20 23 20 23 20 23 23 }] }.. # # ##
8330: 20 23 23 23 20 23 23 23 23 23 20 23 23 23 23 23 ### ##### #####
8340: 23 23 23 20 23 23 23 23 23 23 23 23 23 23 23 23 ### ############
8350: 23 0a 20 20 20 20 23 23 20 43 6f 6e 66 69 67 75 #. ## Configu
8360: 72 61 74 69 6f 6e 0a 0a 20 20 20 20 70 72 61 67 ration.. prag
8370: 6d 61 20 2d 68 61 73 74 79 70 65 69 6e 66 6f 20 ma -hastypeinfo
8380: 20 20 20 6e 6f 20 20 3b 20 23 20 6e 6f 20 74 79 no ; # no ty
8390: 70 65 20 69 6e 74 72 6f 73 70 65 63 74 69 6f 6e pe introspection
83a0: 0a 20 20 20 20 70 72 61 67 6d 61 20 2d 68 61 73 . pragma -has
83b0: 69 6e 66 6f 20 20 20 20 20 20 20 20 6e 6f 20 20 info no
83c0: 3b 20 23 20 6e 6f 20 6f 62 6a 65 63 74 20 69 6e ; # no object in
83d0: 74 72 6f 73 70 65 63 74 69 6f 6e 0a 0a 20 20 20 trospection..
83e0: 20 23 20 23 20 23 23 20 23 23 23 20 23 23 23 23 # # ## ### ####
83f0: 23 20 23 23 23 23 23 23 23 23 20 23 23 23 23 23 # ######## #####
8400: 23 23 23 23 23 23 23 23 0a 7d 0a 0a 23 23 0a 23 ########.}..##.#
8410: 23 20 4e 4f 54 45 3a 20 54 68 65 20 73 75 63 63 # NOTE: The succ
8420: 65 73 73 6f 72 20 61 6e 64 20 70 72 65 64 65 63 essor and predec
8430: 65 73 73 6f 72 20 6d 65 74 68 6f 64 73 20 64 65 essor methods de
8440: 66 69 6e 65 64 20 62 79 20 74 68 65 20 63 6c 61 fined by the cla
8450: 73 73 65 73 0a 23 23 20 20 20 20 20 20 20 62 65 sses.## be
8460: 6c 6f 77 20 61 72 65 20 2d 2d 20 62 6f 74 74 6c low are -- bottl
8470: 65 20 6e 65 63 6b 73 20 2d 2d 2e 20 4c 6f 6f 6b e necks --. Look
8480: 20 66 6f 72 20 77 61 79 73 20 74 6f 20 6d 61 6b for ways to mak
8490: 65 20 74 68 65 20 53 51 4c 0a 23 23 20 20 20 20 e the SQL.##
84a0: 20 20 20 66 61 73 74 65 72 2e 0a 23 23 0a 0a 23 faster..##..#
84b0: 20 23 20 23 23 20 23 23 23 20 23 23 23 23 23 20 # ## ### #####
84c0: 23 23 23 23 23 23 23 23 20 23 23 23 23 23 23 23 ######## #######
84d0: 23 23 23 23 23 23 20 23 23 23 23 23 23 23 23 23 ###### #########
84e0: 23 23 23 23 23 23 23 23 23 23 23 23 0a 23 23 20 ############.##
84f0: 48 65 6c 70 65 72 20 73 69 6e 67 6c 65 74 6f 6e Helper singleton
8500: 2e 20 43 6f 6d 6d 61 6e 64 73 20 66 6f 72 20 72 . Commands for r
8510: 65 76 69 73 69 6f 6e 20 63 68 61 6e 67 65 73 65 evision changese
8520: 74 73 2e 0a 0a 73 6e 69 74 3a 3a 74 79 70 65 20 ts...snit::type
8530: 3a 3a 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d ::vc::fossil::im
8540: 70 6f 72 74 3a 3a 63 76 73 3a 3a 70 72 6f 6a 65 port::cvs::proje
8550: 63 74 3a 3a 72 65 76 3a 3a 72 65 76 20 7b 0a 20 ct::rev::rev {.
8560: 20 20 20 74 79 70 65 6d 65 74 68 6f 64 20 62 79 typemethod by
8570: 72 65 76 69 73 69 6f 6e 20 7b 7d 20 7b 20 72 65 revision {} { re
8580: 74 75 72 6e 20 31 20 7d 0a 20 20 20 20 74 79 70 turn 1 }. typ
8590: 65 6d 65 74 68 6f 64 20 62 79 73 79 6d 62 6f 6c emethod bysymbol
85a0: 20 20 20 7b 7d 20 7b 20 72 65 74 75 72 6e 20 30 {} { return 0
85b0: 20 7d 0a 20 20 20 20 74 79 70 65 6d 65 74 68 6f }. typemetho
85c0: 64 20 69 73 74 61 67 20 20 20 20 20 20 7b 7d 20 d istag {}
85d0: 7b 20 72 65 74 75 72 6e 20 30 20 7d 0a 20 20 20 { return 0 }.
85e0: 20 74 79 70 65 6d 65 74 68 6f 64 20 69 73 62 72 typemethod isbr
85f0: 61 6e 63 68 20 20 20 7b 7d 20 7b 20 72 65 74 75 anch {} { retu
8600: 72 6e 20 30 20 7d 0a 0a 20 20 20 20 74 79 70 65 rn 0 }.. type
8610: 6d 65 74 68 6f 64 20 73 74 72 20 7b 72 65 76 69 method str {revi
8620: 73 69 6f 6e 7d 20 7b 0a 09 73 74 72 75 63 74 3a sion} {..struct:
8630: 3a 6c 69 73 74 20 61 73 73 69 67 6e 20 5b 73 74 :list assign [st
8640: 61 74 65 20 72 75 6e 20 7b 0a 09 20 20 20 20 53 ate run {.. S
8650: 45 4c 45 43 54 20 52 2e 72 65 76 2c 20 46 2e 6e ELECT R.rev, F.n
8660: 61 6d 65 2c 20 50 2e 6e 61 6d 65 0a 09 20 20 20 ame, P.name..
8670: 20 46 52 4f 4d 20 20 20 72 65 76 69 73 69 6f 6e FROM revision
8680: 20 52 2c 20 66 69 6c 65 20 46 2c 20 70 72 6f 6a R, file F, proj
8690: 65 63 74 20 50 0a 09 20 20 20 20 57 48 45 52 45 ect P.. WHERE
86a0: 20 20 52 2e 72 69 64 20 3d 20 24 72 65 76 69 73 R.rid = $revis
86b0: 69 6f 6e 20 2d 2d 20 46 69 6e 64 20 73 70 65 63 ion -- Find spec
86c0: 69 66 69 65 64 20 66 69 6c 65 20 72 65 76 69 73 ified file revis
86d0: 69 6f 6e 0a 09 20 20 20 20 41 4e 44 20 20 20 20 ion.. AND
86e0: 46 2e 66 69 64 20 3d 20 52 2e 66 69 64 20 20 20 F.fid = R.fid
86f0: 20 20 2d 2d 20 47 65 74 20 66 69 6c 65 20 6f 66 -- Get file of
8700: 20 74 68 65 20 72 65 76 69 73 69 6f 6e 0a 09 20 the revision..
8710: 20 20 20 41 4e 44 20 20 20 20 50 2e 70 69 64 20 AND P.pid
8720: 3d 20 46 2e 70 69 64 20 20 20 20 20 2d 2d 20 47 = F.pid -- G
8730: 65 74 20 70 72 6f 6a 65 63 74 20 6f 66 20 74 68 et project of th
8740: 65 20 66 69 6c 65 2e 0a 09 7d 5d 20 72 65 76 6e e file...}] revn
8750: 72 20 66 6e 61 6d 65 20 70 6e 61 6d 65 0a 09 72 r fname pname..r
8760: 65 74 75 72 6e 20 22 24 70 6e 61 6d 65 2f 24 7b eturn "$pname/${
8770: 72 65 76 6e 72 7d 3a 3a 24 66 6e 61 6d 65 22 0a revnr}::$fname".
8780: 20 20 20 20 7d 0a 0a 20 20 20 20 23 20 72 65 73 }.. # res
8790: 75 6c 74 20 3d 20 6c 69 73 74 20 28 6d 69 6e 74 ult = list (mint
87a0: 69 6d 65 2c 20 6d 61 78 74 69 6d 65 29 0a 20 20 ime, maxtime).
87b0: 20 20 74 79 70 65 6d 65 74 68 6f 64 20 74 69 6d typemethod tim
87c0: 65 72 61 6e 67 65 20 7b 69 74 65 6d 73 7d 20 7b erange {items} {
87d0: 0a 09 73 65 74 20 74 68 65 73 65 74 20 28 27 5b ..set theset ('[
87e0: 6a 6f 69 6e 20 24 69 74 65 6d 73 20 7b 27 2c 27 join $items {','
87f0: 7d 5d 27 29 0a 09 72 65 74 75 72 6e 20 5b 73 74 }]')..return [st
8800: 61 74 65 20 72 75 6e 20 5b 73 75 62 73 74 20 2d ate run [subst -
8810: 6e 6f 63 6f 6d 6d 61 6e 64 73 20 2d 6e 6f 62 61 nocommands -noba
8820: 63 6b 73 6c 61 73 68 65 73 20 7b 0a 09 20 20 20 ckslashes {..
8830: 20 53 45 4c 45 43 54 20 4d 49 4e 28 52 2e 64 61 SELECT MIN(R.da
8840: 74 65 29 2c 20 4d 41 58 28 52 2e 64 61 74 65 29 te), MAX(R.date)
8850: 0a 09 20 20 20 20 46 52 4f 4d 20 72 65 76 69 73 .. FROM revis
8860: 69 6f 6e 20 52 0a 09 20 20 20 20 57 48 45 52 45 ion R.. WHERE
8870: 20 52 2e 72 69 64 20 49 4e 20 24 74 68 65 73 65 R.rid IN $these
8880: 74 20 2d 2d 20 52 65 73 74 72 69 63 74 20 74 6f t -- Restrict to
8890: 20 72 65 76 69 73 69 6f 6e 73 20 6f 66 20 69 6e revisions of in
88a0: 74 65 72 65 73 74 0a 09 7d 5d 5d 0a 20 20 20 20 terest..}]].
88b0: 7d 0a 0a 20 20 20 20 23 20 76 61 72 28 64 76 29 }.. # var(dv)
88c0: 20 3d 20 64 69 63 74 20 28 72 65 76 69 73 69 6f = dict (revisio
88d0: 6e 20 2d 3e 20 6c 69 73 74 20 28 72 65 76 69 73 n -> list (revis
88e0: 69 6f 6e 29 29 0a 20 20 20 20 74 79 70 65 6d 65 ion)). typeme
88f0: 74 68 6f 64 20 69 6e 74 65 72 6e 61 6c 73 75 63 thod internalsuc
8900: 63 65 73 73 6f 72 73 20 7b 64 76 20 72 65 76 69 cessors {dv revi
8910: 73 69 6f 6e 73 7d 20 7b 0a 09 75 70 76 61 72 20 sions} {..upvar
8920: 31 20 24 64 76 20 64 65 70 65 6e 64 65 6e 63 69 1 $dv dependenci
8930: 65 73 0a 09 73 65 74 20 74 68 65 73 65 74 20 28 es..set theset (
8940: 27 5b 6a 6f 69 6e 20 24 72 65 76 69 73 69 6f 6e '[join $revision
8950: 73 20 7b 27 2c 27 7d 5d 27 29 0a 0a 09 6c 6f 67 s {','}]')...log
8960: 20 77 72 69 74 65 20 31 34 20 63 73 65 74 73 20 write 14 csets
8970: 69 6e 74 65 72 6e 61 6c 73 75 63 63 65 73 73 6f internalsuccesso
8980: 72 73 0a 0a 09 23 20 53 65 65 20 27 73 75 63 63 rs...# See 'succ
8990: 65 73 73 6f 72 73 27 20 62 65 6c 6f 77 20 66 6f essors' below fo
89a0: 72 20 74 68 65 20 6d 61 69 6e 20 65 78 70 6c 61 r the main expla
89b0: 6e 61 74 69 6f 6e 20 6f 66 0a 09 23 20 74 68 65 nation of..# the
89c0: 20 76 61 72 69 6f 75 73 20 63 61 73 65 73 2e 20 various cases.
89d0: 54 68 69 73 20 70 69 65 63 65 20 69 73 20 73 70 This piece is sp
89e0: 65 63 69 61 6c 20 69 6e 20 74 68 61 74 20 69 74 ecial in that it
89f0: 0a 09 23 20 72 65 73 74 72 69 63 74 73 20 74 68 ..# restricts th
8a00: 65 20 73 75 63 63 65 73 73 6f 72 73 20 77 65 20 e successors we
8a10: 6c 6f 6f 6b 20 66 6f 72 20 74 6f 20 74 68 65 20 look for to the
8a20: 73 61 6d 65 20 73 65 74 20 6f 66 0a 09 23 20 72 same set of..# r
8a30: 65 76 69 73 69 6f 6e 73 20 77 65 20 73 74 61 72 evisions we star
8a40: 74 20 66 72 6f 6d 2e 20 53 65 6e 73 69 62 6c 65 t from. Sensible
8a50: 20 61 73 20 77 65 20 61 72 65 20 6c 6f 6f 6b 69 as we are looki
8a60: 6e 67 20 66 6f 72 0a 09 23 20 63 68 61 6e 67 65 ng for..# change
8a70: 73 65 74 20 69 6e 74 65 72 6e 61 6c 20 64 65 70 set internal dep
8a80: 65 6e 64 65 6e 63 69 65 73 2e 0a 0a 09 61 72 72 endencies....arr
8a90: 61 79 20 73 65 74 20 64 65 70 20 7b 7d 0a 0a 09 ay set dep {}...
8aa0: 73 74 61 74 65 20 66 6f 72 65 61 63 68 72 6f 77 state foreachrow
8ab0: 20 5b 73 75 62 73 74 20 2d 6e 6f 63 6f 6d 6d 61 [subst -nocomma
8ac0: 6e 64 73 20 2d 6e 6f 62 61 63 6b 73 6c 61 73 68 nds -nobackslash
8ad0: 65 73 20 7b 0a 20 20 20 20 2d 2d 20 28 31 29 20 es {. -- (1)
8ae0: 50 72 69 6d 61 72 79 20 63 68 69 6c 64 0a 09 20 Primary child..
8af0: 20 20 20 53 45 4c 45 43 54 20 52 2e 72 69 64 20 SELECT R.rid
8b00: 41 53 20 78 72 69 64 2c 20 52 2e 63 68 69 6c 64 AS xrid, R.child
8b10: 20 41 53 20 78 63 68 69 6c 64 0a 09 20 20 20 20 AS xchild..
8b20: 46 52 4f 4d 20 20 20 72 65 76 69 73 69 6f 6e 20 FROM revision
8b30: 52 0a 09 20 20 20 20 57 48 45 52 45 20 20 52 2e R.. WHERE R.
8b40: 72 69 64 20 20 20 49 4e 20 24 74 68 65 73 65 74 rid IN $theset
8b50: 20 20 20 20 20 2d 2d 20 52 65 73 74 72 69 63 74 -- Restrict
8b60: 20 74 6f 20 72 65 76 69 73 69 6f 6e 73 20 6f 66 to revisions of
8b70: 20 69 6e 74 65 72 65 73 74 0a 09 20 20 20 20 41 interest.. A
8b80: 4e 44 20 20 20 20 52 2e 63 68 69 6c 64 20 49 53 ND R.child IS
8b90: 20 4e 4f 54 20 4e 55 4c 4c 20 20 20 20 2d 2d 20 NOT NULL --
8ba0: 48 61 73 20 70 72 69 6d 61 72 79 20 63 68 69 6c Has primary chil
8bb0: 64 0a 09 20 20 20 20 41 4e 44 20 20 20 20 52 2e d.. AND R.
8bc0: 63 68 69 6c 64 20 49 4e 20 24 74 68 65 73 65 74 child IN $theset
8bd0: 20 20 20 20 20 2d 2d 20 57 68 69 63 68 20 69 73 -- Which is
8be0: 20 61 6c 73 6f 20 6f 66 20 69 6e 74 65 72 65 73 also of interes
8bf0: 74 0a 20 20 20 20 55 4e 49 4f 4e 0a 20 20 20 20 t. UNION.
8c00: 2d 2d 20 28 32 29 20 53 65 63 6f 6e 64 61 72 79 -- (2) Secondary
8c10: 20 28 62 72 61 6e 63 68 29 20 63 68 69 6c 64 72 (branch) childr
8c20: 65 6e 0a 09 20 20 20 20 53 45 4c 45 43 54 20 52 en.. SELECT R
8c30: 2e 72 69 64 20 41 53 20 78 72 69 64 2c 20 42 2e .rid AS xrid, B.
8c40: 62 72 69 64 20 41 53 20 78 63 68 69 6c 64 0a 09 brid AS xchild..
8c50: 20 20 20 20 46 52 4f 4d 20 20 20 72 65 76 69 73 FROM revis
8c60: 69 6f 6e 20 52 2c 20 72 65 76 69 73 69 6f 6e 62 ion R, revisionb
8c70: 72 61 6e 63 68 63 68 69 6c 64 72 65 6e 20 42 0a ranchchildren B.
8c80: 09 20 20 20 20 57 48 45 52 45 20 20 52 2e 72 69 . WHERE R.ri
8c90: 64 20 20 20 49 4e 20 24 74 68 65 73 65 74 20 20 d IN $theset
8ca0: 20 20 20 2d 2d 20 52 65 73 74 72 69 63 74 20 74 -- Restrict t
8cb0: 6f 20 72 65 76 69 73 69 6f 6e 73 20 6f 66 20 69 o revisions of i
8cc0: 6e 74 65 72 65 73 74 0a 09 20 20 20 20 41 4e 44 nterest.. AND
8cd0: 20 20 20 20 52 2e 72 69 64 20 3d 20 42 2e 72 69 R.rid = B.ri
8ce0: 64 20 20 20 20 20 20 20 20 20 20 2d 2d 20 53 65 d -- Se
8cf0: 6c 65 63 74 20 73 75 62 73 65 74 20 6f 66 20 62 lect subset of b
8d00: 72 61 6e 63 68 20 63 68 69 6c 64 72 65 6e 0a 09 ranch children..
8d10: 20 20 20 20 41 4e 44 20 20 20 20 42 2e 62 72 69 AND B.bri
8d20: 64 20 49 4e 20 24 74 68 65 73 65 74 20 20 20 20 d IN $theset
8d30: 20 20 2d 2d 20 57 68 69 63 68 20 69 73 20 61 6c -- Which is al
8d40: 73 6f 20 6f 66 20 69 6e 74 65 72 65 73 74 0a 20 so of interest.
8d50: 20 20 20 55 4e 49 4f 4e 0a 20 20 20 20 2d 2d 20 UNION. --
8d60: 28 34 29 20 43 68 69 6c 64 20 6f 66 20 74 72 75 (4) Child of tru
8d70: 6e 6b 20 72 6f 6f 74 20 73 75 63 63 65 73 73 6f nk root successo
8d80: 72 20 6f 66 20 6c 61 73 74 20 4e 54 44 42 20 6f r of last NTDB o
8d90: 6e 20 74 72 75 6e 6b 2e 0a 09 20 20 20 20 53 45 n trunk... SE
8da0: 4c 45 43 54 20 52 2e 72 69 64 20 41 53 20 78 72 LECT R.rid AS xr
8db0: 69 64 2c 20 52 41 2e 63 68 69 6c 64 20 41 53 20 id, RA.child AS
8dc0: 78 63 68 69 6c 64 0a 09 20 20 20 20 46 52 4f 4d xchild.. FROM
8dd0: 20 72 65 76 69 73 69 6f 6e 20 52 2c 20 72 65 76 revision R, rev
8de0: 69 73 69 6f 6e 20 52 41 0a 09 20 20 20 20 57 48 ision RA.. WH
8df0: 45 52 45 20 52 2e 72 69 64 20 20 20 49 4e 20 24 ERE R.rid IN $
8e00: 74 68 65 73 65 74 20 20 20 20 20 20 2d 2d 20 52 theset -- R
8e10: 65 73 74 72 69 63 74 20 74 6f 20 72 65 76 69 73 estrict to revis
8e20: 69 6f 6e 73 20 6f 66 20 69 6e 74 65 72 65 73 74 ions of interest
8e30: 0a 09 20 20 20 20 41 4e 44 20 20 20 52 2e 69 73 .. AND R.is
8e40: 64 65 66 61 75 6c 74 20 20 20 20 20 20 20 20 20 default
8e50: 20 20 20 20 2d 2d 20 52 65 73 74 72 69 63 74 20 -- Restrict
8e60: 74 6f 20 4e 54 44 42 0a 09 20 20 20 20 41 4e 44 to NTDB.. AND
8e70: 20 20 20 52 2e 64 62 63 68 69 6c 64 20 49 53 20 R.dbchild IS
8e80: 4e 4f 54 20 4e 55 4c 4c 20 20 20 2d 2d 20 61 6e NOT NULL -- an
8e90: 64 20 6c 61 73 74 20 4e 54 44 42 20 62 65 6c 6f d last NTDB belo
8ea0: 6e 67 69 6e 67 20 74 6f 20 74 72 75 6e 6b 0a 09 nging to trunk..
8eb0: 20 20 20 20 41 4e 44 20 20 20 52 41 2e 72 69 64 AND RA.rid
8ec0: 20 3d 20 52 2e 64 62 63 68 69 6c 64 20 20 20 20 = R.dbchild
8ed0: 20 20 2d 2d 20 47 6f 20 64 69 72 65 63 74 6c 79 -- Go directly
8ee0: 20 74 6f 20 74 72 75 6e 6b 20 72 6f 6f 74 0a 09 to trunk root..
8ef0: 20 20 20 20 41 4e 44 20 20 20 52 41 2e 63 68 69 AND RA.chi
8f00: 6c 64 20 49 53 20 4e 4f 54 20 4e 55 4c 4c 20 20 ld IS NOT NULL
8f10: 20 20 2d 2d 20 48 61 73 20 70 72 69 6d 61 72 79 -- Has primary
8f20: 20 63 68 69 6c 64 2e 0a 20 20 20 20 20 20 20 20 child..
8f30: 20 20 20 20 41 4e 44 20 20 20 52 41 2e 63 68 69 AND RA.chi
8f40: 6c 64 20 49 4e 20 24 74 68 65 73 65 74 20 20 20 ld IN $theset
8f50: 20 20 2d 2d 20 57 68 69 63 68 20 69 73 20 61 6c -- Which is al
8f60: 73 6f 20 6f 66 20 69 6e 74 65 72 65 73 74 0a 09 so of interest..
8f70: 7d 5d 20 7b 0a 09 20 20 20 20 23 20 43 6f 6e 73 }] {.. # Cons
8f80: 69 64 65 72 20 6d 6f 76 69 6e 67 20 74 68 69 73 ider moving this
8f90: 20 74 6f 20 74 68 65 20 69 6e 74 65 67 72 69 74 to the integrit
8fa0: 79 20 6d 6f 64 75 6c 65 2e 0a 09 20 20 20 20 69 y module... i
8fb0: 6e 74 65 67 72 69 74 79 20 61 73 73 65 72 74 20 ntegrity assert
8fc0: 7b 24 78 72 69 64 20 21 3d 20 24 78 63 68 69 6c {$xrid != $xchil
8fd0: 64 7d 20 7b 52 65 76 69 73 69 6f 6e 20 24 78 72 d} {Revision $xr
8fe0: 69 64 20 64 65 70 65 6e 64 73 20 6f 6e 20 69 74 id depends on it
8ff0: 73 65 6c 66 2e 7d 0a 09 20 20 20 20 6c 61 70 70 self.}.. lapp
9000: 65 6e 64 20 64 65 70 65 6e 64 65 6e 63 69 65 73 end dependencies
9010: 28 24 78 72 69 64 29 20 24 78 63 68 69 6c 64 0a ($xrid) $xchild.
9020: 09 20 20 20 20 73 65 74 20 64 65 70 28 24 78 72 . set dep($xr
9030: 69 64 2c 24 78 63 68 69 6c 64 29 20 2e 0a 09 7d id,$xchild) ...}
9040: 0a 0a 09 23 20 54 68 65 20 73 71 6c 20 73 74 61 ...# The sql sta
9050: 74 65 6d 65 6e 74 73 20 61 62 6f 76 65 20 6c 6f tements above lo
9060: 6f 6b 73 20 6f 6e 6c 79 20 66 6f 72 20 64 69 72 oks only for dir
9070: 65 63 74 20 64 65 70 65 6e 64 65 6e 63 69 65 73 ect dependencies
9080: 0a 09 23 20 62 65 74 77 65 65 6e 20 72 65 76 69 ..# between revi
9090: 73 69 6f 6e 20 69 6e 20 74 68 65 20 63 68 61 6e sion in the chan
90a0: 67 65 73 65 74 2e 20 48 6f 77 65 76 65 72 20 64 geset. However d
90b0: 75 65 20 74 6f 20 74 68 65 0a 09 23 20 76 61 67 ue to the..# vag
90c0: 61 72 69 65 73 20 6f 66 20 6d 65 74 61 20 64 61 aries of meta da
90d0: 74 61 20 69 74 20 69 73 20 70 6f 73 73 69 62 6c ta it is possibl
90e0: 65 20 66 6f 72 20 74 77 6f 20 72 65 76 69 73 69 e for two revisi
90f0: 6f 6e 73 20 6f 66 0a 09 23 20 74 68 65 20 73 61 ons of..# the sa
9100: 6d 65 20 66 69 6c 65 20 74 6f 20 65 6e 64 20 75 me file to end u
9110: 70 20 69 6e 20 74 68 65 20 73 61 6d 65 20 63 68 p in the same ch
9120: 61 6e 67 65 73 65 74 2c 20 77 69 74 68 6f 75 74 angeset, without
9130: 20 61 0a 09 23 20 64 69 72 65 63 74 20 64 65 70 a..# direct dep
9140: 65 6e 64 65 6e 63 79 20 62 65 74 77 65 65 6e 20 endency between
9150: 74 68 65 6d 2e 20 48 6f 77 65 76 65 72 20 77 65 them. However we
9160: 20 6b 6e 6f 77 20 74 68 61 74 20 74 68 65 72 65 know that there
9170: 0a 09 23 20 68 61 73 20 74 6f 20 62 65 20 61 20 ..# has to be a
9180: 61 6e 20 69 6e 64 69 72 65 63 74 20 64 65 70 65 an indirect depe
9190: 6e 64 65 6e 63 79 2c 20 62 65 20 69 74 20 74 68 ndency, be it th
91a0: 72 6f 75 67 68 20 70 72 69 6d 61 72 79 0a 09 23 rough primary..#
91b0: 20 63 68 69 6c 64 72 65 6e 2c 20 62 72 61 6e 63 children, branc
91c0: 68 20 63 68 69 6c 64 72 65 6e 2c 20 6f 72 20 61 h children, or a
91d0: 20 63 6f 6d 62 69 6e 61 74 69 6f 6e 20 74 68 65 combination the
91e0: 72 65 6f 66 2e 0a 0a 09 23 20 57 65 20 6e 6f 77 reof....# We now
91f0: 20 66 69 6c 6c 20 69 6e 20 74 68 65 73 65 20 70 fill in these p
9200: 73 65 75 64 6f 2d 64 65 70 65 6e 64 65 6e 63 69 seudo-dependenci
9210: 65 73 2c 20 69 66 20 6e 6f 20 73 75 63 68 0a 09 es, if no such..
9220: 23 20 64 65 70 65 6e 64 65 6e 63 79 20 65 78 69 # dependency exi
9230: 73 74 73 20 61 6c 72 65 61 64 79 2e 20 54 68 65 sts already. The
9240: 20 64 69 72 65 63 74 69 6f 6e 20 6f 66 20 74 68 direction of th
9250: 65 20 64 65 70 65 6e 64 65 6e 63 79 0a 09 23 20 e dependency..#
9260: 69 73 20 61 63 74 75 61 6c 6c 79 20 69 72 72 65 is actually irre
9270: 6c 65 76 61 6e 74 20 66 6f 72 20 74 68 69 73 2e levant for this.
9280: 0a 0a 09 23 20 4e 4f 54 45 3a 20 54 68 69 73 20 ...# NOTE: This
9290: 69 73 20 64 69 66 66 65 72 65 6e 74 20 66 72 6f is different fro
92a0: 6d 20 63 76 73 32 73 76 6e 2e 20 4f 75 72 20 73 m cvs2svn. Our s
92b0: 70 69 72 69 74 75 61 6c 20 61 6e 63 65 73 74 6f piritual ancesto
92c0: 72 0a 09 23 20 64 6f 65 73 20 6e 6f 74 20 75 73 r..# does not us
92d0: 65 20 73 75 63 68 20 70 73 65 75 64 6f 2d 64 65 e such pseudo-de
92e0: 70 65 6e 64 65 6e 63 69 65 73 2c 20 68 6f 77 65 pendencies, howe
92f0: 76 65 72 20 69 74 20 75 73 65 73 20 61 0a 09 23 ver it uses a..#
9300: 20 43 4f 4d 4d 49 54 5f 54 48 52 45 53 48 4f 4c COMMIT_THRESHOL
9310: 44 2c 20 61 20 74 69 6d 65 20 69 6e 74 65 72 76 D, a time interv
9320: 61 6c 20 63 6f 6d 6d 69 74 73 20 73 68 6f 75 6c al commits shoul
9330: 64 20 66 61 6c 6c 2e 20 54 68 69 73 0a 09 23 20 d fall. This..#
9340: 77 69 6c 6c 20 67 72 65 61 74 6c 79 20 72 65 64 will greatly red
9350: 75 63 65 73 20 74 68 65 20 72 69 73 6b 20 6f 66 uces the risk of
9360: 20 67 65 74 74 69 6e 67 20 66 61 72 20 73 65 70 getting far sep
9370: 61 72 61 74 65 64 0a 09 23 20 72 65 76 69 73 69 arated..# revisi
9380: 6f 6e 73 20 6f 66 20 74 68 65 20 73 61 6d 65 20 ons of the same
9390: 66 69 6c 65 20 69 6e 74 6f 20 6f 6e 65 20 63 68 file into one ch
93a0: 61 6e 67 65 73 65 74 2e 0a 0a 09 23 20 57 65 20 angeset....# We
93b0: 61 6c 6c 6f 77 20 72 65 76 69 73 69 6f 6e 73 20 allow revisions
93c0: 74 6f 20 62 65 20 66 61 72 20 61 70 61 72 74 20 to be far apart
93d0: 69 6e 20 74 69 6d 65 20 69 6e 20 74 68 65 20 73 in time in the s
93e0: 61 6d 65 0a 09 23 20 63 68 61 6e 67 65 73 65 74 ame..# changeset
93f0: 2c 20 62 75 74 20 69 6e 20 74 75 72 6e 20 6e 65 , but in turn ne
9400: 65 64 20 74 68 65 20 70 73 65 75 64 6f 2d 64 65 ed the pseudo-de
9410: 70 65 6e 64 65 6e 63 69 65 73 20 74 6f 0a 09 23 pendencies to..#
9420: 20 68 61 6e 64 6c 65 20 74 68 69 73 2e 0a 0a 09 handle this....
9430: 6c 6f 67 20 77 72 69 74 65 20 31 34 20 63 73 65 log write 14 cse
9440: 74 73 20 7b 69 6e 74 65 72 6e 61 6c 20 20 5b 61 ts {internal [a
9450: 72 72 61 79 20 73 69 7a 65 20 64 65 70 5d 7d 0a rray size dep]}.
9460: 09 6c 6f 67 20 77 72 69 74 65 20 31 34 20 63 73 .log write 14 cs
9470: 65 74 73 20 7b 63 6f 6c 6c 65 63 74 65 64 20 5b ets {collected [
9480: 61 72 72 61 79 20 73 69 7a 65 20 64 65 70 65 6e array size depen
9490: 64 65 6e 63 69 65 73 5d 7d 0a 09 6c 6f 67 20 77 dencies]}..log w
94a0: 72 69 74 65 20 31 34 20 63 73 65 74 73 20 70 73 rite 14 csets ps
94b0: 65 75 64 6f 2d 69 6e 74 65 72 6e 61 6c 73 75 63 eudo-internalsuc
94c0: 63 65 73 73 6f 72 73 0a 0a 09 61 72 72 61 79 20 cessors...array
94d0: 73 65 74 20 66 69 64 73 20 7b 7d 0a 09 73 74 61 set fids {}..sta
94e0: 74 65 20 66 6f 72 65 61 63 68 72 6f 77 20 5b 73 te foreachrow [s
94f0: 75 62 73 74 20 2d 6e 6f 63 6f 6d 6d 61 6e 64 73 ubst -nocommands
9500: 20 2d 6e 6f 62 61 63 6b 73 6c 61 73 68 65 73 20 -nobackslashes
9510: 7b 0a 09 20 20 20 20 53 45 4c 45 43 54 20 52 2e {.. SELECT R.
9520: 72 69 64 20 41 53 20 78 72 69 64 2c 20 52 2e 66 rid AS xrid, R.f
9530: 69 64 20 41 53 20 78 66 69 64 0a 20 20 20 20 20 id AS xfid.
9540: 20 20 20 20 20 20 20 46 52 4f 4d 20 20 20 72 65 FROM re
9550: 76 69 73 69 6f 6e 20 52 0a 20 20 20 20 20 20 20 vision R.
9560: 20 20 20 20 20 57 48 45 52 45 20 20 52 2e 72 69 WHERE R.ri
9570: 64 20 49 4e 20 24 74 68 65 73 65 74 0a 09 7d 5d d IN $theset..}]
9580: 20 7b 20 6c 61 70 70 65 6e 64 20 66 69 64 73 28 { lappend fids(
9590: 24 78 66 69 64 29 20 24 78 72 69 64 20 7d 0a 0a $xfid) $xrid }..
95a0: 09 73 65 74 20 67 72 6f 75 70 73 20 7b 7d 0a 09 .set groups {}..
95b0: 66 6f 72 65 61 63 68 20 7b 66 69 64 20 72 69 64 foreach {fid rid
95c0: 73 7d 20 5b 61 72 72 61 79 20 67 65 74 20 66 69 s} [array get fi
95d0: 64 73 5d 20 7b 0a 09 20 20 20 20 69 66 20 7b 5b ds] {.. if {[
95e0: 6c 6c 65 6e 67 74 68 20 24 72 69 64 73 5d 20 3c llength $rids] <
95f0: 20 32 7d 20 63 6f 6e 74 69 6e 75 65 0a 09 20 20 2} continue..
9600: 20 20 66 6f 72 65 61 63 68 20 61 20 24 72 69 64 foreach a $rid
9610: 73 20 7b 0a 09 09 66 6f 72 65 61 63 68 20 62 20 s {...foreach b
9620: 24 72 69 64 73 20 7b 0a 09 09 20 20 20 20 69 66 $rids {... if
9630: 20 7b 24 61 20 3d 3d 20 24 62 7d 20 63 6f 6e 74 {$a == $b} cont
9640: 69 6e 75 65 0a 09 09 20 20 20 20 69 66 20 7b 5b inue... if {[
9650: 69 6e 66 6f 20 65 78 69 73 74 73 20 64 65 70 28 info exists dep(
9660: 24 61 2c 24 62 29 5d 7d 20 63 6f 6e 74 69 6e 75 $a,$b)]} continu
9670: 65 0a 09 09 20 20 20 20 69 66 20 7b 5b 69 6e 66 e... if {[inf
9680: 6f 20 65 78 69 73 74 73 20 64 65 70 28 24 62 2c o exists dep($b,
9690: 24 61 29 5d 7d 20 63 6f 6e 74 69 6e 75 65 0a 09 $a)]} continue..
96a0: 09 20 20 20 20 6c 61 70 70 65 6e 64 20 64 65 70 . lappend dep
96b0: 65 6e 64 65 6e 63 69 65 73 28 24 61 29 20 24 62 endencies($a) $b
96c0: 0a 09 09 20 20 20 20 73 65 74 20 64 65 70 28 24 ... set dep($
96d0: 61 2c 24 62 29 20 2e 0a 09 09 20 20 20 20 73 65 a,$b) .... se
96e0: 74 20 64 65 70 28 24 62 2c 24 61 29 20 2e 0a 09 t dep($b,$a) ...
96f0: 09 7d 0a 09 20 20 20 20 7d 0a 09 20 20 20 20 73 .}.. }.. s
9700: 65 74 20 6e 20 5b 6c 6c 65 6e 67 74 68 20 24 72 et n [llength $r
9710: 69 64 73 5d 0a 09 20 20 20 20 6c 61 70 70 65 6e ids].. lappen
9720: 64 20 67 72 6f 75 70 73 20 5b 6c 69 73 74 20 24 d groups [list $
9730: 6e 20 5b 65 78 70 72 20 7b 28 24 6e 2a 24 6e 2d n [expr {($n*$n-
9740: 24 6e 29 2f 32 7d 5d 5d 0a 09 7d 0a 0a 09 6c 6f $n)/2}]]..}...lo
9750: 67 20 77 72 69 74 65 20 31 34 20 63 73 65 74 73 g write 14 csets
9760: 20 7b 70 73 65 75 64 6f 20 20 20 20 5b 61 72 72 {pseudo [arr
9770: 61 79 20 73 69 7a 65 20 66 69 64 73 5d 20 28 5b ay size fids] ([
9780: 6c 73 6f 72 74 20 2d 69 6e 64 65 78 20 30 20 2d lsort -index 0 -
9790: 64 65 63 72 65 61 73 69 6e 67 20 2d 69 6e 74 65 decreasing -inte
97a0: 67 65 72 20 24 67 72 6f 75 70 73 5d 29 7d 0a 09 ger $groups])}..
97b0: 6c 6f 67 20 77 72 69 74 65 20 31 34 20 63 73 65 log write 14 cse
97c0: 74 73 20 7b 69 6e 74 65 72 6e 61 6c 20 20 5b 61 ts {internal [a
97d0: 72 72 61 79 20 73 69 7a 65 20 64 65 70 5d 7d 0a rray size dep]}.
97e0: 09 6c 6f 67 20 77 72 69 74 65 20 31 34 20 63 73 .log write 14 cs
97f0: 65 74 73 20 7b 63 6f 6c 6c 65 63 74 65 64 20 5b ets {collected [
9800: 61 72 72 61 79 20 73 69 7a 65 20 64 65 70 65 6e array size depen
9810: 64 65 6e 63 69 65 73 5d 7d 0a 09 6c 6f 67 20 77 dencies]}..log w
9820: 72 69 74 65 20 31 34 20 63 73 65 74 73 20 63 6f rite 14 csets co
9830: 6d 70 6c 65 74 65 0a 09 72 65 74 75 72 6e 0a 20 mplete..return.
9840: 20 20 20 7d 0a 0a 20 20 20 20 23 20 72 65 73 75 }.. # resu
9850: 6c 74 20 3d 20 34 2d 6c 69 73 74 20 28 69 74 65 lt = 4-list (ite
9860: 6d 74 79 70 65 20 69 74 65 6d 69 64 20 6e 65 78 mtype itemid nex
9870: 74 69 74 65 6d 74 79 70 65 20 6e 65 78 74 69 74 titemtype nextit
9880: 65 6d 69 64 20 2e 2e 2e 29 0a 20 20 20 20 74 79 emid ...). ty
9890: 70 65 6d 65 74 68 6f 64 20 6c 6f 6f 70 73 20 7b pemethod loops {
98a0: 72 65 76 69 73 69 6f 6e 73 7d 20 7b 0a 09 23 20 revisions} {..#
98b0: 4e 6f 74 65 3a 20 54 61 67 73 20 61 6e 64 20 62 Note: Tags and b
98c0: 72 61 6e 63 68 65 73 20 63 61 6e 6e 6f 74 20 63 ranches cannot c
98d0: 61 75 73 65 20 74 68 65 20 6c 6f 6f 70 2e 20 54 ause the loop. T
98e0: 68 65 69 72 20 69 64 27 73 2c 0a 09 23 20 62 65 heir id's,..# be
98f0: 69 6e 67 20 6f 66 20 61 20 66 75 6e 64 61 6d 65 ing of a fundame
9900: 6e 74 61 6c 6c 79 20 64 69 66 66 65 72 65 6e 74 ntally different
9910: 20 74 79 70 65 20 74 68 61 6e 20 74 68 65 20 72 type than the r
9920: 65 76 69 73 69 6f 6e 73 0a 09 23 20 63 6f 6d 69 evisions..# comi
9930: 6e 67 20 69 6e 20 63 61 6e 6e 6f 74 20 62 65 20 ng in cannot be
9940: 69 6e 20 74 68 65 20 73 65 74 2e 0a 0a 09 73 65 in the set....se
9950: 74 20 74 68 65 73 65 74 20 28 27 5b 6a 6f 69 6e t theset ('[join
9960: 20 24 72 65 76 69 73 69 6f 6e 73 20 7b 27 2c 27 $revisions {','
9970: 7d 5d 27 29 0a 09 72 65 74 75 72 6e 20 5b 73 74 }]')..return [st
9980: 61 74 65 20 72 75 6e 20 5b 73 75 62 73 74 20 2d ate run [subst -
9990: 6e 6f 63 6f 6d 6d 61 6e 64 73 20 2d 6e 6f 62 61 nocommands -noba
99a0: 63 6b 73 6c 61 73 68 65 73 20 7b 0a 09 20 20 20 ckslashes {..
99b0: 20 2d 2d 20 28 31 29 20 50 72 69 6d 61 72 79 20 -- (1) Primary
99c0: 63 68 69 6c 64 0a 09 20 20 20 20 53 45 4c 45 43 child.. SELEC
99d0: 54 20 52 2e 72 69 64 2c 20 52 2e 63 68 69 6c 64 T R.rid, R.child
99e0: 0a 09 20 20 20 20 46 52 4f 4d 20 20 20 72 65 76 .. FROM rev
99f0: 69 73 69 6f 6e 20 52 0a 09 20 20 20 20 57 48 45 ision R.. WHE
9a00: 52 45 20 20 52 2e 72 69 64 20 20 20 49 4e 20 24 RE R.rid IN $
9a10: 74 68 65 73 65 74 20 20 20 20 20 2d 2d 20 52 65 theset -- Re
9a20: 73 74 72 69 63 74 20 74 6f 20 72 65 76 69 73 69 strict to revisi
9a30: 6f 6e 73 20 6f 66 20 69 6e 74 65 72 65 73 74 0a ons of interest.
9a40: 09 20 20 20 20 41 4e 44 20 20 20 20 52 2e 63 68 . AND R.ch
9a50: 69 6c 64 20 49 53 20 4e 4f 54 20 4e 55 4c 4c 20 ild IS NOT NULL
9a60: 20 20 20 2d 2d 20 48 61 73 20 70 72 69 6d 61 72 -- Has primar
9a70: 79 20 63 68 69 6c 64 0a 09 20 20 20 20 41 4e 44 y child.. AND
9a80: 20 20 20 20 52 2e 63 68 69 6c 64 20 49 4e 20 24 R.child IN $
9a90: 74 68 65 73 65 74 20 20 20 20 20 2d 2d 20 4c 6f theset -- Lo
9aa0: 6f 70 0a 09 20 20 20 20 2d 2d 0a 09 20 20 20 20 op.. --..
9ab0: 55 4e 49 4f 4e 0a 09 20 20 20 20 2d 2d 20 28 32 UNION.. -- (2
9ac0: 29 20 53 65 63 6f 6e 64 61 72 79 20 28 62 72 61 ) Secondary (bra
9ad0: 6e 63 68 29 20 63 68 69 6c 64 72 65 6e 0a 09 20 nch) children..
9ae0: 20 20 20 53 45 4c 45 43 54 20 52 2e 72 69 64 2c SELECT R.rid,
9af0: 20 42 2e 62 72 69 64 0a 09 20 20 20 20 46 52 4f B.brid.. FRO
9b00: 4d 20 20 20 72 65 76 69 73 69 6f 6e 20 52 2c 20 M revision R,
9b10: 72 65 76 69 73 69 6f 6e 62 72 61 6e 63 68 63 68 revisionbranchch
9b20: 69 6c 64 72 65 6e 20 42 0a 09 20 20 20 20 57 48 ildren B.. WH
9b30: 45 52 45 20 20 52 2e 72 69 64 20 20 20 49 4e 20 ERE R.rid IN
9b40: 24 74 68 65 73 65 74 20 20 20 20 20 2d 2d 20 52 $theset -- R
9b50: 65 73 74 72 69 63 74 20 74 6f 20 72 65 76 69 73 estrict to revis
9b60: 69 6f 6e 73 20 6f 66 20 69 6e 74 65 72 65 73 74 ions of interest
9b70: 0a 09 20 20 20 20 41 4e 44 20 20 20 20 52 2e 72 .. AND R.r
9b80: 69 64 20 3d 20 42 2e 72 69 64 20 20 20 20 20 20 id = B.rid
9b90: 20 20 20 20 2d 2d 20 53 65 6c 65 63 74 20 73 75 -- Select su
9ba0: 62 73 65 74 20 6f 66 20 62 72 61 6e 63 68 20 63 bset of branch c
9bb0: 68 69 6c 64 72 65 6e 0a 09 20 20 20 20 41 4e 44 hildren.. AND
9bc0: 20 20 20 20 42 2e 72 69 64 20 20 20 49 4e 20 24 B.rid IN $
9bd0: 74 68 65 73 65 74 20 20 20 20 20 2d 2d 20 4c 6f theset -- Lo
9be0: 6f 70 0a 09 20 20 20 20 2d 2d 0a 09 20 20 20 20 op.. --..
9bf0: 55 4e 49 4f 4e 0a 09 20 20 20 20 2d 2d 20 28 34 UNION.. -- (4
9c00: 29 20 43 68 69 6c 64 20 6f 66 20 74 72 75 6e 6b ) Child of trunk
9c10: 20 72 6f 6f 74 20 73 75 63 63 65 73 73 6f 72 20 root successor
9c20: 6f 66 20 6c 61 73 74 20 4e 54 44 42 20 6f 6e 20 of last NTDB on
9c30: 74 72 75 6e 6b 2e 0a 09 20 20 20 20 53 45 4c 45 trunk... SELE
9c40: 43 54 20 52 2e 72 69 64 2c 20 52 41 2e 63 68 69 CT R.rid, RA.chi
9c50: 6c 64 0a 09 20 20 20 20 46 52 4f 4d 20 20 20 72 ld.. FROM r
9c60: 65 76 69 73 69 6f 6e 20 52 2c 20 72 65 76 69 73 evision R, revis
9c70: 69 6f 6e 20 52 41 0a 09 20 20 20 20 57 48 45 52 ion RA.. WHER
9c80: 45 20 20 52 2e 72 69 64 20 20 20 20 49 4e 20 24 E R.rid IN $
9c90: 74 68 65 73 65 74 20 20 20 20 20 2d 2d 20 52 65 theset -- Re
9ca0: 73 74 72 69 63 74 20 74 6f 20 72 65 76 69 73 69 strict to revisi
9cb0: 6f 6e 73 20 6f 66 20 69 6e 74 65 72 65 73 74 0a ons of interest.
9cc0: 09 20 20 20 20 41 4e 44 20 20 20 20 52 2e 69 73 . AND R.is
9cd0: 64 65 66 61 75 6c 74 20 20 20 20 20 20 20 20 20 default
9ce0: 20 20 20 20 2d 2d 20 52 65 73 74 72 69 63 74 20 -- Restrict
9cf0: 74 6f 20 4e 54 44 42 0a 09 20 20 20 20 41 4e 44 to NTDB.. AND
9d00: 20 20 20 20 52 2e 64 62 63 68 69 6c 64 20 49 53 R.dbchild IS
9d10: 20 4e 4f 54 20 4e 55 4c 4c 20 20 20 2d 2d 20 61 NOT NULL -- a
9d20: 6e 64 20 6c 61 73 74 20 4e 54 44 42 20 62 65 6c nd last NTDB bel
9d30: 6f 6e 67 69 6e 67 20 74 6f 20 74 72 75 6e 6b 0a onging to trunk.
9d40: 09 20 20 20 20 41 4e 44 20 20 20 20 52 41 2e 72 . AND RA.r
9d50: 69 64 20 3d 20 52 2e 64 62 63 68 69 6c 64 20 20 id = R.dbchild
9d60: 20 20 20 20 2d 2d 20 47 6f 20 64 69 72 65 63 74 -- Go direct
9d70: 6c 79 20 74 6f 20 74 72 75 6e 6b 20 72 6f 6f 74 ly to trunk root
9d80: 0a 09 20 20 20 20 41 4e 44 20 20 20 20 52 41 2e .. AND RA.
9d90: 63 68 69 6c 64 20 49 53 20 4e 4f 54 20 4e 55 4c child IS NOT NUL
9da0: 4c 20 20 20 20 2d 2d 20 48 61 73 20 70 72 69 6d L -- Has prim
9db0: 61 72 79 20 63 68 69 6c 64 2e 0a 09 20 20 20 20 ary child...
9dc0: 41 4e 44 20 20 20 20 52 41 2e 63 68 69 6c 64 20 AND RA.child
9dd0: 49 4e 20 24 74 68 65 73 65 74 20 20 20 20 20 2d IN $theset -
9de0: 2d 20 4c 6f 6f 70 0a 09 7d 5d 5d 0a 20 20 20 20 - Loop..}]].
9df0: 7d 0a 0a 20 20 20 20 23 20 76 61 72 28 64 76 29 }.. # var(dv)
9e00: 20 3d 20 64 69 63 74 20 28 69 74 65 6d 20 2d 3e = dict (item ->
9e10: 20 6c 69 73 74 20 28 69 74 65 6d 29 29 2c 20 69 list (item)), i
9e20: 74 65 6d 20 20 3d 20 6c 69 73 74 20 28 74 79 70 tem = list (typ
9e30: 65 20 69 64 29 0a 20 20 20 20 74 79 70 65 6d 65 e id). typeme
9e40: 74 68 6f 64 20 73 75 63 63 65 73 73 6f 72 73 20 thod successors
9e50: 7b 64 76 20 72 65 76 69 73 69 6f 6e 73 7d 20 7b {dv revisions} {
9e60: 0a 09 75 70 76 61 72 20 31 20 24 64 76 20 64 65 ..upvar 1 $dv de
9e70: 70 65 6e 64 65 6e 63 69 65 73 0a 09 73 65 74 20 pendencies..set
9e80: 74 68 65 73 65 74 20 28 27 5b 6a 6f 69 6e 20 24 theset ('[join $
9e90: 72 65 76 69 73 69 6f 6e 73 20 7b 27 2c 27 7d 5d revisions {','}]
9ea0: 27 29 0a 0a 09 23 20 54 68 65 20 66 6f 6c 6c 6f ')...# The follo
9eb0: 77 69 6e 67 20 63 61 73 65 73 20 73 70 65 63 69 wing cases speci
9ec0: 66 79 20 77 68 65 6e 20 61 20 72 65 76 69 73 69 fy when a revisi
9ed0: 6f 6e 20 53 20 69 73 20 61 20 73 75 63 63 65 73 on S is a succes
9ee0: 73 6f 72 0a 09 23 20 6f 66 20 61 20 72 65 76 69 sor..# of a revi
9ef0: 73 69 6f 6e 20 52 2e 20 45 61 63 68 20 6f 66 20 sion R. Each of
9f00: 74 68 65 20 63 61 73 65 73 20 74 72 61 6e 73 6c the cases transl
9f10: 61 74 65 73 20 69 6e 74 6f 20 6f 6e 65 20 6f 66 ates into one of
9f20: 0a 09 23 20 74 68 65 20 62 72 61 6e 63 68 65 73 ..# the branches
9f30: 20 6f 66 20 74 68 65 20 53 51 4c 20 55 4e 49 4f of the SQL UNIO
9f40: 4e 20 63 6f 6d 69 6e 67 20 62 65 6c 6f 77 2e 0a N coming below..
9f50: 09 23 0a 09 23 20 28 31 29 20 53 20 63 61 6e 20 .#..# (1) S can
9f60: 62 65 20 61 20 70 72 69 6d 61 72 79 20 63 68 69 be a primary chi
9f70: 6c 64 20 6f 66 20 52 2c 20 69 2e 65 2e 20 69 6e ld of R, i.e. in
9f80: 20 74 68 65 20 73 61 6d 65 20 4c 4f 44 2e 20 52 the same LOD. R
9f90: 0a 09 23 20 20 20 20 20 72 65 66 65 72 65 6e 63 ..# referenc
9fa0: 65 73 20 53 20 64 69 72 65 63 74 6c 79 2e 20 52 es S directly. R
9fb0: 2e 63 68 69 6c 64 20 3d 20 53 28 2e 72 69 64 29 .child = S(.rid)
9fc0: 2c 20 69 66 20 69 74 20 65 78 69 73 74 73 2e 0a , if it exists..
9fd0: 09 23 0a 09 23 20 28 32 29 20 53 20 63 61 6e 20 .#..# (2) S can
9fe0: 62 65 20 61 20 73 65 63 6f 6e 64 61 72 79 2c 20 be a secondary,
9ff0: 69 2e 65 2e 20 62 72 61 6e 63 68 2c 20 63 68 69 i.e. branch, chi
a000: 6c 64 20 6f 66 20 52 2e 20 48 65 72 65 20 74 68 ld of R. Here th
a010: 65 0a 09 23 20 20 20 20 20 6c 69 6e 6b 20 69 73 e..# link is
a020: 20 6d 61 64 65 20 74 68 72 6f 75 67 68 20 74 68 made through th
a030: 65 20 68 65 6c 70 65 72 20 74 61 62 6c 65 0a 09 e helper table..
a040: 23 20 20 20 20 20 52 45 56 49 53 49 4f 4e 42 52 # REVISIONBR
a050: 41 4e 43 48 43 48 49 4c 44 52 45 4e 2e 20 52 2e ANCHCHILDREN. R.
a060: 72 69 64 20 2d 3e 20 52 42 43 2e 72 69 64 2c 20 rid -> RBC.rid,
a070: 52 42 43 2e 62 72 69 64 20 3d 0a 09 23 20 20 20 RBC.brid =..#
a080: 20 20 53 28 2e 72 69 64 29 0a 09 23 0a 09 23 20 S(.rid)..#..#
a090: 28 33 29 20 4f 72 69 67 69 6e 61 6c 6c 79 20 74 (3) Originally t
a0a0: 68 69 73 20 75 73 65 20 63 61 73 65 20 64 65 66 his use case def
a0b0: 69 6e 65 64 20 74 68 65 20 72 6f 6f 74 20 6f 66 ined the root of
a0c0: 20 61 20 64 65 74 61 63 68 65 64 0a 09 23 20 20 a detached..#
a0d0: 20 20 20 4e 54 44 42 20 61 73 20 74 68 65 20 73 NTDB as the s
a0e0: 75 63 63 65 73 73 6f 72 20 6f 66 20 74 68 65 20 uccessor of the
a0f0: 74 72 75 6e 6b 20 72 6f 6f 74 2e 20 54 68 69 73 trunk root. This
a100: 20 6c 65 61 64 73 20 74 6f 20 61 0a 09 23 20 20 leads to a..#
a110: 20 20 20 62 61 64 20 74 61 6e 67 6c 65 20 6c 61 bad tangle la
a120: 74 65 72 20 6f 6e 2e 20 57 69 74 68 20 61 20 64 ter on. With a d
a130: 65 74 61 63 68 65 64 20 4e 54 44 42 20 74 68 65 etached NTDB the
a140: 20 6f 72 69 67 69 6e 61 6c 0a 09 23 20 20 20 20 original..#
a150: 20 74 72 75 6e 6b 20 72 6f 6f 74 20 72 65 76 69 trunk root revi
a160: 73 69 6f 6e 20 77 61 73 20 72 65 6d 6f 76 65 64 sion was removed
a170: 20 61 73 20 69 72 72 65 6c 65 76 61 6e 74 2c 20 as irrelevant,
a180: 61 6c 6c 6f 77 69 6e 67 0a 09 23 20 20 20 20 20 allowing..#
a190: 74 68 65 20 6e 6f 6d 69 6e 61 6c 20 72 6f 6f 74 the nominal root
a1a0: 20 74 6f 20 62 65 20 6c 61 74 65 72 20 69 6e 20 to be later in
a1b0: 74 69 6d 65 20 74 68 61 6e 20 74 68 65 20 4e 54 time than the NT
a1c0: 44 42 0a 09 23 20 20 20 20 20 72 6f 6f 74 2e 20 DB..# root.
a1d0: 4e 6f 77 20 73 65 74 74 69 6e 67 20 74 68 69 73 Now setting this
a1e0: 20 64 65 70 65 6e 64 65 6e 63 79 20 77 69 6c 6c dependency will
a1f0: 20 62 65 20 62 61 63 6b 77 61 72 64 20 69 6e 0a be backward in.
a200: 09 23 20 20 20 20 20 74 69 6d 65 2e 20 52 45 4d .# time. REM
a210: 4f 56 45 44 2e 0a 09 23 0a 09 23 20 28 34 29 20 OVED...#..# (4)
a220: 49 66 20 52 20 69 73 20 74 68 65 20 6c 61 73 74 If R is the last
a230: 20 6f 66 20 74 68 65 20 4e 54 44 42 20 72 65 76 of the NTDB rev
a240: 69 73 69 6f 6e 73 20 77 68 69 63 68 20 62 65 6c isions which bel
a250: 6f 6e 67 20 74 6f 0a 09 23 20 20 20 20 20 74 68 ong to..# th
a260: 65 20 74 72 75 6e 6b 2c 20 74 68 65 6e 20 74 68 e trunk, then th
a270: 65 20 70 72 69 6d 61 72 79 20 63 68 69 6c 64 20 e primary child
a280: 6f 66 20 74 68 65 20 74 72 75 6e 6b 20 72 6f 6f of the trunk roo
a290: 74 20 28 74 68 65 0a 09 23 20 20 20 20 20 27 31 t (the..# '1
a2a0: 2e 32 27 20 72 65 76 69 73 69 6f 6e 29 20 69 73 .2' revision) is
a2b0: 20 61 20 73 75 63 63 65 73 73 6f 72 2c 20 69 66 a successor, if
a2c0: 20 69 74 20 65 78 69 73 74 73 2e 0a 0a 09 23 20 it exists....#
a2d0: 4e 6f 74 65 20 74 68 61 74 20 74 68 65 20 62 72 Note that the br
a2e0: 61 6e 63 68 65 73 20 73 70 61 77 6e 65 64 20 66 anches spawned f
a2f0: 72 6f 6d 20 74 68 65 20 72 65 76 69 73 69 6f 6e rom the revision
a300: 73 2c 20 61 6e 64 20 74 68 65 0a 09 23 20 74 61 s, and the..# ta
a310: 67 73 20 61 73 73 6f 63 69 61 74 65 64 20 77 69 gs associated wi
a320: 74 68 20 74 68 65 6d 20 61 72 65 20 73 75 63 63 th them are succ
a330: 65 73 73 6f 72 73 20 61 73 20 77 65 6c 6c 2e 0a essors as well..
a340: 0a 09 73 74 61 74 65 20 66 6f 72 65 61 63 68 72 ..state foreachr
a350: 6f 77 20 5b 73 75 62 73 74 20 2d 6e 6f 63 6f 6d ow [subst -nocom
a360: 6d 61 6e 64 73 20 2d 6e 6f 62 61 63 6b 73 6c 61 mands -nobacksla
a370: 73 68 65 73 20 7b 0a 20 20 20 20 2d 2d 20 28 31 shes {. -- (1
a380: 29 20 50 72 69 6d 61 72 79 20 63 68 69 6c 64 0a ) Primary child.
a390: 09 20 20 20 20 53 45 4c 45 43 54 20 52 2e 72 69 . SELECT R.ri
a3a0: 64 20 41 53 20 78 72 69 64 2c 20 52 2e 63 68 69 d AS xrid, R.chi
a3b0: 6c 64 20 41 53 20 78 63 68 69 6c 64 0a 09 20 20 ld AS xchild..
a3c0: 20 20 46 52 4f 4d 20 20 20 72 65 76 69 73 69 6f FROM revisio
a3d0: 6e 20 52 0a 09 20 20 20 20 57 48 45 52 45 20 20 n R.. WHERE
a3e0: 52 2e 72 69 64 20 20 20 49 4e 20 24 74 68 65 73 R.rid IN $thes
a3f0: 65 74 20 20 20 20 20 2d 2d 20 52 65 73 74 72 69 et -- Restri
a400: 63 74 20 74 6f 20 72 65 76 69 73 69 6f 6e 73 20 ct to revisions
a410: 6f 66 20 69 6e 74 65 72 65 73 74 0a 09 20 20 20 of interest..
a420: 20 41 4e 44 20 20 20 20 52 2e 63 68 69 6c 64 20 AND R.child
a430: 49 53 20 4e 4f 54 20 4e 55 4c 4c 20 20 20 20 2d IS NOT NULL -
a440: 2d 20 48 61 73 20 70 72 69 6d 61 72 79 20 63 68 - Has primary ch
a450: 69 6c 64 0a 20 20 20 20 55 4e 49 4f 4e 0a 20 20 ild. UNION.
a460: 20 20 2d 2d 20 28 32 29 20 53 65 63 6f 6e 64 61 -- (2) Seconda
a470: 72 79 20 28 62 72 61 6e 63 68 29 20 63 68 69 6c ry (branch) chil
a480: 64 72 65 6e 0a 09 20 20 20 20 53 45 4c 45 43 54 dren.. SELECT
a490: 20 52 2e 72 69 64 20 41 53 20 78 72 69 64 2c 20 R.rid AS xrid,
a4a0: 42 2e 62 72 69 64 20 41 53 20 78 63 68 69 6c 64 B.brid AS xchild
a4b0: 0a 09 20 20 20 20 46 52 4f 4d 20 20 20 72 65 76 .. FROM rev
a4c0: 69 73 69 6f 6e 20 52 2c 20 72 65 76 69 73 69 6f ision R, revisio
a4d0: 6e 62 72 61 6e 63 68 63 68 69 6c 64 72 65 6e 20 nbranchchildren
a4e0: 42 0a 09 20 20 20 20 57 48 45 52 45 20 20 52 2e B.. WHERE R.
a4f0: 72 69 64 20 20 20 49 4e 20 24 74 68 65 73 65 74 rid IN $theset
a500: 20 20 20 20 20 2d 2d 20 52 65 73 74 72 69 63 74 -- Restrict
a510: 20 74 6f 20 72 65 76 69 73 69 6f 6e 73 20 6f 66 to revisions of
a520: 20 69 6e 74 65 72 65 73 74 0a 09 20 20 20 20 41 interest.. A
a530: 4e 44 20 20 20 20 52 2e 72 69 64 20 3d 20 42 2e ND R.rid = B.
a540: 72 69 64 20 20 20 20 20 20 20 20 20 20 2d 2d 20 rid --
a550: 53 65 6c 65 63 74 20 73 75 62 73 65 74 20 6f 66 Select subset of
a560: 20 62 72 61 6e 63 68 20 63 68 69 6c 64 72 65 6e branch children
a570: 0a 20 20 20 20 55 4e 49 4f 4e 0a 20 20 20 20 2d . UNION. -
a580: 2d 20 28 34 29 20 43 68 69 6c 64 20 6f 66 20 74 - (4) Child of t
a590: 72 75 6e 6b 20 72 6f 6f 74 20 73 75 63 63 65 73 runk root succes
a5a0: 73 6f 72 20 6f 66 20 6c 61 73 74 20 4e 54 44 42 sor of last NTDB
a5b0: 20 6f 6e 20 74 72 75 6e 6b 2e 0a 09 20 20 20 20 on trunk...
a5c0: 53 45 4c 45 43 54 20 52 2e 72 69 64 20 41 53 20 SELECT R.rid AS
a5d0: 78 72 69 64 2c 20 52 41 2e 63 68 69 6c 64 20 41 xrid, RA.child A
a5e0: 53 20 78 63 68 69 6c 64 0a 09 20 20 20 20 46 52 S xchild.. FR
a5f0: 4f 4d 20 72 65 76 69 73 69 6f 6e 20 52 2c 20 72 OM revision R, r
a600: 65 76 69 73 69 6f 6e 20 52 41 0a 09 20 20 20 20 evision RA..
a610: 57 48 45 52 45 20 52 2e 72 69 64 20 20 20 49 4e WHERE R.rid IN
a620: 20 24 74 68 65 73 65 74 20 20 20 20 20 20 2d 2d $theset --
a630: 20 52 65 73 74 72 69 63 74 20 74 6f 20 72 65 76 Restrict to rev
a640: 69 73 69 6f 6e 73 20 6f 66 20 69 6e 74 65 72 65 isions of intere
a650: 73 74 0a 09 20 20 20 20 41 4e 44 20 20 20 52 2e st.. AND R.
a660: 69 73 64 65 66 61 75 6c 74 20 20 20 20 20 20 20 isdefault
a670: 20 20 20 20 20 20 2d 2d 20 52 65 73 74 72 69 63 -- Restric
a680: 74 20 74 6f 20 4e 54 44 42 0a 09 20 20 20 20 41 t to NTDB.. A
a690: 4e 44 20 20 20 52 2e 64 62 63 68 69 6c 64 20 49 ND R.dbchild I
a6a0: 53 20 4e 4f 54 20 4e 55 4c 4c 20 20 20 2d 2d 20 S NOT NULL --
a6b0: 61 6e 64 20 6c 61 73 74 20 4e 54 44 42 20 62 65 and last NTDB be
a6c0: 6c 6f 6e 67 69 6e 67 20 74 6f 20 74 72 75 6e 6b longing to trunk
a6d0: 0a 09 20 20 20 20 41 4e 44 20 20 20 52 41 2e 72 .. AND RA.r
a6e0: 69 64 20 3d 20 52 2e 64 62 63 68 69 6c 64 20 20 id = R.dbchild
a6f0: 20 20 20 20 2d 2d 20 47 6f 20 64 69 72 65 63 74 -- Go direct
a700: 6c 79 20 74 6f 20 74 72 75 6e 6b 20 72 6f 6f 74 ly to trunk root
a710: 0a 09 20 20 20 20 41 4e 44 20 20 20 52 41 2e 63 .. AND RA.c
a720: 68 69 6c 64 20 49 53 20 4e 4f 54 20 4e 55 4c 4c hild IS NOT NULL
a730: 20 20 20 20 2d 2d 20 48 61 73 20 70 72 69 6d 61 -- Has prima
a740: 72 79 20 63 68 69 6c 64 2e 0a 09 7d 5d 20 7b 0a ry child...}] {.
a750: 09 20 20 20 20 23 20 43 6f 6e 73 69 64 65 72 20 . # Consider
a760: 6d 6f 76 69 6e 67 20 74 68 69 73 20 74 6f 20 74 moving this to t
a770: 68 65 20 69 6e 74 65 67 72 69 74 79 20 6d 6f 64 he integrity mod
a780: 75 6c 65 2e 0a 09 20 20 20 20 69 6e 74 65 67 72 ule... integr
a790: 69 74 79 20 61 73 73 65 72 74 20 7b 24 78 72 69 ity assert {$xri
a7a0: 64 20 21 3d 20 24 78 63 68 69 6c 64 7d 20 7b 52 d != $xchild} {R
a7b0: 65 76 69 73 69 6f 6e 20 24 78 72 69 64 20 64 65 evision $xrid de
a7c0: 70 65 6e 64 73 20 6f 6e 20 69 74 73 65 6c 66 2e pends on itself.
a7d0: 7d 0a 09 20 20 20 20 6c 61 70 70 65 6e 64 20 64 }.. lappend d
a7e0: 65 70 65 6e 64 65 6e 63 69 65 73 28 5b 6c 69 73 ependencies([lis
a7f0: 74 20 72 65 76 20 24 78 72 69 64 5d 29 20 5b 6c t rev $xrid]) [l
a800: 69 73 74 20 72 65 76 20 24 78 63 68 69 6c 64 5d ist rev $xchild]
a810: 0a 09 7d 0a 09 73 74 61 74 65 20 66 6f 72 65 61 ..}..state forea
a820: 63 68 72 6f 77 20 5b 73 75 62 73 74 20 2d 6e 6f chrow [subst -no
a830: 63 6f 6d 6d 61 6e 64 73 20 2d 6e 6f 62 61 63 6b commands -noback
a840: 73 6c 61 73 68 65 73 20 7b 0a 09 20 20 20 20 53 slashes {.. S
a850: 45 4c 45 43 54 20 52 2e 72 69 64 20 41 53 20 78 ELECT R.rid AS x
a860: 72 69 64 2c 20 54 2e 74 69 64 20 41 53 20 78 63 rid, T.tid AS xc
a870: 68 69 6c 64 0a 09 20 20 20 20 46 52 4f 4d 20 20 hild.. FROM
a880: 20 72 65 76 69 73 69 6f 6e 20 52 2c 20 74 61 67 revision R, tag
a890: 20 54 0a 09 20 20 20 20 57 48 45 52 45 20 20 52 T.. WHERE R
a8a0: 2e 72 69 64 20 49 4e 20 24 74 68 65 73 65 74 20 .rid IN $theset
a8b0: 20 20 20 20 20 20 2d 2d 20 52 65 73 74 72 69 63 -- Restric
a8c0: 74 20 74 6f 20 72 65 76 69 73 69 6f 6e 73 20 6f t to revisions o
a8d0: 66 20 69 6e 74 65 72 65 73 74 0a 09 20 20 20 20 f interest..
a8e0: 41 4e 44 20 20 20 20 54 2e 72 65 76 20 3d 20 52 AND T.rev = R
a8f0: 2e 72 69 64 20 20 20 20 20 20 20 20 20 20 2d 2d .rid --
a900: 20 53 65 6c 65 63 74 20 74 61 67 73 20 61 74 74 Select tags att
a910: 61 63 68 65 64 20 74 6f 20 74 68 65 6d 0a 09 7d ached to them..}
a920: 5d 20 7b 0a 09 20 20 20 20 6c 61 70 70 65 6e 64 ] {.. lappend
a930: 20 64 65 70 65 6e 64 65 6e 63 69 65 73 28 5b 6c dependencies([l
a940: 69 73 74 20 72 65 76 20 24 78 72 69 64 5d 29 20 ist rev $xrid])
a950: 5b 6c 69 73 74 20 73 79 6d 3a 3a 74 61 67 20 24 [list sym::tag $
a960: 78 63 68 69 6c 64 5d 0a 09 7d 0a 09 73 74 61 74 xchild]..}..stat
a970: 65 20 66 6f 72 65 61 63 68 72 6f 77 20 5b 73 75 e foreachrow [su
a980: 62 73 74 20 2d 6e 6f 63 6f 6d 6d 61 6e 64 73 20 bst -nocommands
a990: 2d 6e 6f 62 61 63 6b 73 6c 61 73 68 65 73 20 7b -nobackslashes {
a9a0: 0a 09 20 20 20 20 53 45 4c 45 43 54 20 52 2e 72 .. SELECT R.r
a9b0: 69 64 20 41 53 20 78 72 69 64 2c 20 42 2e 62 69 id AS xrid, B.bi
a9c0: 64 20 41 53 20 78 63 68 69 6c 64 0a 09 20 20 20 d AS xchild..
a9d0: 20 46 52 4f 4d 20 20 20 72 65 76 69 73 69 6f 6e FROM revision
a9e0: 20 52 2c 20 62 72 61 6e 63 68 20 42 0a 09 20 20 R, branch B..
a9f0: 20 20 57 48 45 52 45 20 20 52 2e 72 69 64 20 49 WHERE R.rid I
aa00: 4e 20 24 74 68 65 73 65 74 20 20 20 20 20 20 20 N $theset
aa10: 2d 2d 20 52 65 73 74 72 69 63 74 20 74 6f 20 72 -- Restrict to r
aa20: 65 76 69 73 69 6f 6e 73 20 6f 66 20 69 6e 74 65 evisions of inte
aa30: 72 65 73 74 0a 09 20 20 20 20 41 4e 44 20 20 20 rest.. AND
aa40: 20 42 2e 72 6f 6f 74 20 3d 20 52 2e 72 69 64 20 B.root = R.rid
aa50: 20 20 20 20 20 20 20 20 2d 2d 20 53 65 6c 65 63 -- Selec
aa60: 74 20 62 72 61 6e 63 68 65 73 20 61 74 74 61 63 t branches attac
aa70: 68 65 64 20 74 6f 20 74 68 65 6d 0a 09 7d 5d 20 hed to them..}]
aa80: 7b 0a 09 20 20 20 20 6c 61 70 70 65 6e 64 20 64 {.. lappend d
aa90: 65 70 65 6e 64 65 6e 63 69 65 73 28 5b 6c 69 73 ependencies([lis
aaa0: 74 20 72 65 76 20 24 78 72 69 64 5d 29 20 5b 6c t rev $xrid]) [l
aab0: 69 73 74 20 73 79 6d 3a 3a 62 72 61 6e 63 68 20 ist sym::branch
aac0: 24 78 63 68 69 6c 64 5d 0a 09 7d 0a 09 72 65 74 $xchild]..}..ret
aad0: 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 23 urn. }.. #
aae0: 20 72 65 73 75 6c 74 20 3d 20 6c 69 73 74 20 28 result = list (
aaf0: 63 68 61 6e 67 65 73 65 74 2d 69 64 29 0a 20 20 changeset-id).
ab00: 20 20 74 79 70 65 6d 65 74 68 6f 64 20 63 73 5f typemethod cs_
ab10: 73 75 63 63 65 73 73 6f 72 73 20 7b 72 65 76 69 successors {revi
ab20: 73 69 6f 6e 73 7d 20 7b 0a 20 20 20 20 20 20 20 sions} {.
ab30: 20 23 20 54 68 69 73 20 69 73 20 61 20 76 61 72 # This is a var
ab40: 69 61 6e 74 20 6f 66 20 27 73 75 63 63 65 73 73 iant of 'success
ab50: 6f 72 73 27 20 77 68 69 63 68 20 6d 61 70 73 20 ors' which maps
ab60: 74 68 65 20 6c 6f 77 2d 6c 65 76 65 6c 0a 20 20 the low-level.
ab70: 20 20 20 20 20 20 23 20 64 61 74 61 20 64 69 72 # data dir
ab80: 65 63 74 6c 79 20 74 6f 20 74 68 65 20 61 73 73 ectly to the ass
ab90: 6f 63 69 61 74 65 64 20 63 68 61 6e 67 65 73 65 ociated changese
aba0: 74 73 2e 20 49 2e 65 2e 20 69 6e 73 74 65 61 64 ts. I.e. instead
abb0: 0a 20 20 20 20 20 20 20 20 23 20 6d 69 6c 6c 69 . # milli
abc0: 6f 6e 73 20 6f 66 20 64 65 70 65 6e 64 65 6e 63 ons of dependenc
abd0: 79 20 70 61 69 72 73 20 28 69 6e 20 65 78 74 72 y pairs (in extr
abe0: 65 6d 65 20 63 61 73 65 73 20 28 45 78 61 6d 70 eme cases (Examp
abf0: 6c 65 3a 20 54 63 6c 0a 20 20 20 20 20 20 20 20 le: Tcl.
ac00: 23 20 43 56 53 29 29 20 77 65 20 72 65 74 75 72 # CVS)) we retur
ac10: 6e 20 61 20 76 65 72 79 20 73 68 6f 72 74 20 61 n a very short a
ac20: 6e 64 20 6d 75 63 68 20 6d 6f 72 65 20 6d 61 6e nd much more man
ac30: 61 67 65 61 62 6c 65 20 6c 69 73 74 0a 20 20 20 ageable list.
ac40: 20 20 20 20 20 23 20 6f 66 20 63 68 61 6e 67 65 # of change
ac50: 73 65 74 73 2e 0a 0a 09 73 65 74 20 74 68 65 73 sets....set thes
ac60: 65 74 20 28 27 5b 6a 6f 69 6e 20 24 72 65 76 69 et ('[join $revi
ac70: 73 69 6f 6e 73 20 7b 27 2c 27 7d 5d 27 29 0a 09 sions {','}]')..
ac80: 72 65 74 75 72 6e 20 5b 73 74 61 74 65 20 72 75 return [state ru
ac90: 6e 20 5b 73 75 62 73 74 20 2d 6e 6f 63 6f 6d 6d n [subst -nocomm
aca0: 61 6e 64 73 20 2d 6e 6f 62 61 63 6b 73 6c 61 73 ands -nobackslas
acb0: 68 65 73 20 7b 0a 20 20 20 20 2d 2d 20 28 31 29 hes {. -- (1)
acc0: 20 50 72 69 6d 61 72 79 20 63 68 69 6c 64 0a 09 Primary child..
acd0: 20 20 20 20 53 45 4c 45 43 54 20 43 2e 63 69 64 SELECT C.cid
ace0: 0a 09 20 20 20 20 46 52 4f 4d 20 20 20 72 65 76 .. FROM rev
acf0: 69 73 69 6f 6e 20 52 2c 20 63 73 69 74 65 6d 20 ision R, csitem
ad00: 43 49 2c 20 63 68 61 6e 67 65 73 65 74 20 43 0a CI, changeset C.
ad10: 09 20 20 20 20 57 48 45 52 45 20 20 52 2e 72 69 . WHERE R.ri
ad20: 64 20 20 20 49 4e 20 24 74 68 65 73 65 74 20 20 d IN $theset
ad30: 20 20 20 2d 2d 20 52 65 73 74 72 69 63 74 20 74 -- Restrict t
ad40: 6f 20 72 65 76 69 73 69 6f 6e 73 20 6f 66 20 69 o revisions of i
ad50: 6e 74 65 72 65 73 74 0a 09 20 20 20 20 41 4e 44 nterest.. AND
ad60: 20 20 20 20 52 2e 63 68 69 6c 64 20 49 53 20 4e R.child IS N
ad70: 4f 54 20 4e 55 4c 4c 20 20 20 20 2d 2d 20 48 61 OT NULL -- Ha
ad80: 73 20 70 72 69 6d 61 72 79 20 63 68 69 6c 64 0a s primary child.
ad90: 20 20 20 20 20 20 20 20 20 20 20 20 41 4e 44 20 AND
ada0: 20 20 20 43 49 2e 69 69 64 20 3d 20 52 2e 63 68 CI.iid = R.ch
adb0: 69 6c 64 20 20 20 20 20 20 20 2d 2d 20 53 65 6c ild -- Sel
adc0: 65 63 74 20 61 6c 6c 20 63 68 61 6e 67 65 73 65 ect all changese
add0: 74 73 0a 20 20 20 20 20 20 20 20 20 20 20 20 41 ts. A
ade0: 4e 44 20 20 20 20 43 2e 63 69 64 20 3d 20 43 49 ND C.cid = CI
adf0: 2e 63 69 64 20 20 20 20 20 20 20 20 20 2d 2d 20 .cid --
ae00: 63 6f 6e 74 61 69 6e 69 6e 67 20 74 68 65 20 70 containing the p
ae10: 72 69 6d 61 72 79 20 63 68 69 6c 64 0a 20 20 20 rimary child.
ae20: 20 20 20 20 20 20 20 20 20 41 4e 44 20 20 20 20 AND
ae30: 43 2e 74 79 70 65 20 3d 20 30 20 20 20 20 20 20 C.type = 0
ae40: 20 20 20 20 20 20 20 2d 2d 20 77 68 69 63 68 20 -- which
ae50: 61 72 65 20 72 65 76 69 73 69 6f 6e 20 63 68 61 are revision cha
ae60: 6e 67 65 73 65 74 73 0a 20 20 20 20 55 4e 49 4f ngesets. UNIO
ae70: 4e 0a 20 20 20 20 2d 2d 20 28 32 29 20 53 65 63 N. -- (2) Sec
ae80: 6f 6e 64 61 72 79 20 28 62 72 61 6e 63 68 29 20 ondary (branch)
ae90: 63 68 69 6c 64 72 65 6e 0a 09 20 20 20 20 53 45 children.. SE
aea0: 4c 45 43 54 20 43 2e 63 69 64 0a 09 20 20 20 20 LECT C.cid..
aeb0: 46 52 4f 4d 20 20 20 72 65 76 69 73 69 6f 6e 20 FROM revision
aec0: 52 2c 20 72 65 76 69 73 69 6f 6e 62 72 61 6e 63 R, revisionbranc
aed0: 68 63 68 69 6c 64 72 65 6e 20 42 2c 20 63 73 69 hchildren B, csi
aee0: 74 65 6d 20 43 49 2c 20 63 68 61 6e 67 65 73 65 tem CI, changese
aef0: 74 20 43 0a 09 20 20 20 20 57 48 45 52 45 20 20 t C.. WHERE
af00: 52 2e 72 69 64 20 20 20 49 4e 20 24 74 68 65 73 R.rid IN $thes
af10: 65 74 20 20 20 20 20 2d 2d 20 52 65 73 74 72 69 et -- Restri
af20: 63 74 20 74 6f 20 72 65 76 69 73 69 6f 6e 73 20 ct to revisions
af30: 6f 66 20 69 6e 74 65 72 65 73 74 0a 09 20 20 20 of interest..
af40: 20 41 4e 44 20 20 20 20 52 2e 72 69 64 20 3d 20 AND R.rid =
af50: 42 2e 72 69 64 20 20 20 20 20 20 20 20 20 20 2d B.rid -
af60: 2d 20 53 65 6c 65 63 74 20 73 75 62 73 65 74 20 - Select subset
af70: 6f 66 20 62 72 61 6e 63 68 20 63 68 69 6c 64 72 of branch childr
af80: 65 6e 0a 20 20 20 20 20 20 20 20 20 20 20 20 41 en. A
af90: 4e 44 20 20 20 20 43 49 2e 69 69 64 20 3d 20 42 ND CI.iid = B
afa0: 2e 62 72 69 64 20 20 20 20 20 20 20 20 2d 2d 20 .brid --
afb0: 53 65 6c 65 63 74 20 61 6c 6c 20 63 68 61 6e 67 Select all chang
afc0: 65 73 65 74 73 0a 20 20 20 20 20 20 20 20 20 20 esets.
afd0: 20 20 41 4e 44 20 20 20 20 43 2e 63 69 64 20 3d AND C.cid =
afe0: 20 43 49 2e 63 69 64 09 20 20 2d 2d 20 63 6f 6e CI.cid. -- con
aff0: 74 61 69 6e 69 6e 67 20 74 68 65 20 62 72 61 6e taining the bran
b000: 63 68 0a 20 20 20 20 20 20 20 20 20 20 20 20 41 ch. A
b010: 4e 44 20 20 20 20 43 2e 74 79 70 65 20 3d 20 30 ND C.type = 0
b020: 09 09 20 20 2d 2d 20 77 68 69 63 68 20 61 72 65 .. -- which are
b030: 20 72 65 76 69 73 69 6f 6e 20 63 68 61 6e 67 65 revision change
b040: 73 65 74 73 0a 20 20 20 20 55 4e 49 4f 4e 0a 20 sets. UNION.
b050: 20 20 20 2d 2d 20 28 34 29 20 43 68 69 6c 64 20 -- (4) Child
b060: 6f 66 20 74 72 75 6e 6b 20 72 6f 6f 74 20 73 75 of trunk root su
b070: 63 63 65 73 73 6f 72 20 6f 66 20 6c 61 73 74 20 ccessor of last
b080: 4e 54 44 42 20 6f 6e 20 74 72 75 6e 6b 2e 0a 09 NTDB on trunk...
b090: 20 20 20 20 53 45 4c 45 43 54 20 43 2e 63 69 64 SELECT C.cid
b0a0: 0a 09 20 20 20 20 46 52 4f 4d 20 20 20 72 65 76 .. FROM rev
b0b0: 69 73 69 6f 6e 20 52 2c 20 72 65 76 69 73 69 6f ision R, revisio
b0c0: 6e 20 52 41 2c 20 63 73 69 74 65 6d 20 43 49 2c n RA, csitem CI,
b0d0: 20 63 68 61 6e 67 65 73 65 74 20 43 0a 09 20 20 changeset C..
b0e0: 20 20 57 48 45 52 45 20 20 52 2e 72 69 64 20 20 WHERE R.rid
b0f0: 20 49 4e 20 24 74 68 65 73 65 74 20 20 20 20 20 IN $theset
b100: 20 2d 2d 20 52 65 73 74 72 69 63 74 20 74 6f 20 -- Restrict to
b110: 72 65 76 69 73 69 6f 6e 73 20 6f 66 20 69 6e 74 revisions of int
b120: 65 72 65 73 74 0a 09 20 20 20 20 41 4e 44 20 20 erest.. AND
b130: 20 20 52 2e 69 73 64 65 66 61 75 6c 74 20 20 20 R.isdefault
b140: 20 20 20 20 20 20 20 20 20 20 2d 2d 20 52 65 73 -- Res
b150: 74 72 69 63 74 20 74 6f 20 4e 54 44 42 0a 09 20 trict to NTDB..
b160: 20 20 20 41 4e 44 20 20 20 20 52 2e 64 62 63 68 AND R.dbch
b170: 69 6c 64 20 49 53 20 4e 4f 54 20 4e 55 4c 4c 20 ild IS NOT NULL
b180: 20 20 2d 2d 20 61 6e 64 20 6c 61 73 74 20 4e 54 -- and last NT
b190: 44 42 20 62 65 6c 6f 6e 67 69 6e 67 20 74 6f 20 DB belonging to
b1a0: 74 72 75 6e 6b 0a 09 20 20 20 20 41 4e 44 20 20 trunk.. AND
b1b0: 20 20 52 41 2e 72 69 64 20 3d 20 52 2e 64 62 63 RA.rid = R.dbc
b1c0: 68 69 6c 64 20 20 20 20 20 20 2d 2d 20 47 6f 20 hild -- Go
b1d0: 64 69 72 65 63 74 6c 79 20 74 6f 20 74 72 75 6e directly to trun
b1e0: 6b 20 72 6f 6f 74 0a 09 20 20 20 20 41 4e 44 20 k root.. AND
b1f0: 20 20 20 52 41 2e 63 68 69 6c 64 20 49 53 20 4e RA.child IS N
b200: 4f 54 20 4e 55 4c 4c 20 20 20 20 2d 2d 20 48 61 OT NULL -- Ha
b210: 73 20 70 72 69 6d 61 72 79 20 63 68 69 6c 64 2e s primary child.
b220: 0a 20 20 20 20 20 20 20 20 20 20 20 20 41 4e 44 . AND
b230: 20 20 20 20 43 49 2e 69 69 64 20 3d 20 52 41 2e CI.iid = RA.
b240: 63 68 69 6c 64 20 20 20 20 20 20 20 2d 2d 20 53 child -- S
b250: 65 6c 65 63 74 20 61 6c 6c 20 63 68 61 6e 67 65 elect all change
b260: 73 65 74 73 0a 20 20 20 20 20 20 20 20 20 20 20 sets.
b270: 20 41 4e 44 20 20 20 20 43 2e 63 69 64 20 3d 20 AND C.cid =
b280: 43 49 2e 63 69 64 09 20 20 20 2d 2d 20 63 6f 6e CI.cid. -- con
b290: 74 61 69 6e 69 6e 67 20 74 68 65 20 70 72 69 6d taining the prim
b2a0: 61 72 79 20 63 68 69 6c 64 0a 20 20 20 20 20 20 ary child.
b2b0: 20 20 20 20 20 20 41 4e 44 20 20 20 20 43 2e 74 AND C.t
b2c0: 79 70 65 20 3d 20 30 09 09 20 20 20 2d 2d 20 77 ype = 0.. -- w
b2d0: 68 69 63 68 20 61 72 65 20 72 65 76 69 73 69 6f hich are revisio
b2e0: 6e 20 63 68 61 6e 67 65 73 65 74 73 0a 20 20 20 n changesets.
b2f0: 20 55 4e 49 4f 4e 0a 09 20 20 20 20 53 45 4c 45 UNION.. SELE
b300: 43 54 20 43 2e 63 69 64 0a 09 20 20 20 20 46 52 CT C.cid.. FR
b310: 4f 4d 20 20 20 72 65 76 69 73 69 6f 6e 20 52 2c OM revision R,
b320: 20 74 61 67 20 54 2c 20 63 73 69 74 65 6d 20 43 tag T, csitem C
b330: 49 2c 20 63 68 61 6e 67 65 73 65 74 20 43 0a 09 I, changeset C..
b340: 20 20 20 20 57 48 45 52 45 20 20 52 2e 72 69 64 WHERE R.rid
b350: 20 69 6e 20 24 74 68 65 73 65 74 20 20 20 20 20 in $theset
b360: 20 20 20 2d 2d 20 52 65 73 74 72 69 63 74 20 74 -- Restrict t
b370: 6f 20 72 65 76 69 73 69 6f 6e 73 20 6f 66 20 69 o revisions of i
b380: 6e 74 65 72 65 73 74 0a 09 20 20 20 20 41 4e 44 nterest.. AND
b390: 20 20 20 20 54 2e 72 65 76 20 3d 20 52 2e 72 69 T.rev = R.ri
b3a0: 64 09 20 20 20 2d 2d 20 53 65 6c 65 63 74 20 74 d. -- Select t
b3b0: 61 67 73 20 61 74 74 61 63 68 65 64 20 74 6f 20 ags attached to
b3c0: 74 68 65 6d 0a 20 20 20 20 20 20 20 20 20 20 20 them.
b3d0: 20 41 4e 44 20 20 20 20 43 49 2e 69 69 64 20 3d AND CI.iid =
b3e0: 20 54 2e 74 69 64 20 20 20 20 20 20 20 20 20 20 T.tid
b3f0: 2d 2d 20 53 65 6c 65 63 74 20 61 6c 6c 20 63 68 -- Select all ch
b400: 61 6e 67 65 73 65 74 73 0a 20 20 20 20 20 20 20 angesets.
b410: 20 20 20 20 20 41 4e 44 20 20 20 20 43 2e 63 69 AND C.ci
b420: 64 20 3d 20 43 49 2e 63 69 64 09 20 20 20 2d 2d d = CI.cid. --
b430: 20 63 6f 6e 74 61 69 6e 69 6e 67 20 74 68 65 20 containing the
b440: 74 61 67 73 0a 20 20 20 20 20 20 20 20 20 20 20 tags.
b450: 20 41 4e 44 20 20 20 20 43 2e 74 79 70 65 20 3d AND C.type =
b460: 20 31 09 09 20 20 20 2d 2d 20 77 68 69 63 68 20 1.. -- which
b470: 61 72 65 20 74 61 67 20 63 68 61 6e 67 65 73 65 are tag changese
b480: 74 73 0a 20 20 20 20 55 4e 49 4f 4e 0a 09 20 20 ts. UNION..
b490: 20 20 53 45 4c 45 43 54 20 43 2e 63 69 64 0a 09 SELECT C.cid..
b4a0: 20 20 20 20 46 52 4f 4d 20 20 20 72 65 76 69 73 FROM revis
b4b0: 69 6f 6e 20 52 2c 20 62 72 61 6e 63 68 20 42 2c ion R, branch B,
b4c0: 20 63 73 69 74 65 6d 20 43 49 2c 20 63 68 61 6e csitem CI, chan
b4d0: 67 65 73 65 74 20 43 0a 09 20 20 20 20 57 48 45 geset C.. WHE
b4e0: 52 45 20 20 52 2e 72 69 64 20 69 6e 20 24 74 68 RE R.rid in $th
b4f0: 65 73 65 74 20 20 20 20 20 20 20 20 2d 2d 20 52 eset -- R
b500: 65 73 74 72 69 63 74 20 74 6f 20 72 65 76 69 73 estrict to revis
b510: 69 6f 6e 73 20 6f 66 20 69 6e 74 65 72 65 73 74 ions of interest
b520: 0a 09 20 20 20 20 41 4e 44 20 20 20 20 42 2e 72 .. AND B.r
b530: 6f 6f 74 20 3d 20 52 2e 72 69 64 09 20 20 20 2d oot = R.rid. -
b540: 2d 20 53 65 6c 65 63 74 20 62 72 61 6e 63 68 65 - Select branche
b550: 73 20 61 74 74 61 63 68 65 64 20 74 6f 20 74 68 s attached to th
b560: 65 6d 0a 20 20 20 20 20 20 20 20 20 20 20 20 41 em. A
b570: 4e 44 20 20 20 20 43 49 2e 69 69 64 20 3d 20 42 ND CI.iid = B
b580: 2e 62 69 64 20 20 20 20 20 20 20 20 20 20 2d 2d .bid --
b590: 20 53 65 6c 65 63 74 20 61 6c 6c 20 63 68 61 6e Select all chan
b5a0: 67 65 73 65 74 73 0a 20 20 20 20 20 20 20 20 20 gesets.
b5b0: 20 20 20 41 4e 44 20 20 20 20 43 2e 63 69 64 20 AND C.cid
b5c0: 3d 20 43 49 2e 63 69 64 09 20 20 20 2d 2d 20 63 = CI.cid. -- c
b5d0: 6f 6e 74 61 69 6e 69 6e 67 20 74 68 65 20 62 72 ontaining the br
b5e0: 61 6e 63 68 65 73 0a 20 20 20 20 20 20 20 20 20 anches.
b5f0: 20 20 20 41 4e 44 20 20 20 20 43 2e 74 79 70 65 AND C.type
b600: 20 3d 20 32 09 09 20 20 20 2d 2d 20 77 68 69 63 = 2.. -- whic
b610: 68 20 61 72 65 20 62 72 61 6e 63 68 20 63 68 61 h are branch cha
b620: 6e 67 65 73 65 74 73 0a 09 7d 5d 5d 0a 20 20 20 ngesets..}]].
b630: 20 7d 0a 0a 20 20 20 20 23 20 72 65 73 75 6c 74 }.. # result
b640: 20 3d 20 73 79 6d 62 6f 6c 20 6e 61 6d 65 0a 20 = symbol name.
b650: 20 20 20 74 79 70 65 6d 65 74 68 6f 64 20 63 73 typemethod cs
b660: 5f 6c 6f 64 20 7b 72 65 76 69 73 69 6f 6e 73 7d _lod {revisions}
b670: 20 7b 0a 09 23 20 44 65 74 65 72 6d 69 6e 65 73 {..# Determines
b680: 20 74 68 65 20 6e 61 6d 65 20 6f 66 20 74 68 65 the name of the
b690: 20 73 79 6d 62 6f 6c 20 77 68 69 63 68 20 69 73 symbol which is
b6a0: 20 74 68 65 20 6c 69 6e 65 20 6f 66 0a 09 23 20 the line of..#
b6b0: 64 65 76 65 6c 6f 70 6d 65 6e 74 20 66 6f 72 20 development for
b6c0: 74 68 65 20 72 65 76 69 73 69 6f 6e 73 20 69 6e the revisions in
b6d0: 20 61 20 63 68 61 6e 67 65 73 65 74 2e 0a 0a 09 a changeset....
b6e0: 73 65 74 20 74 68 65 73 65 74 20 28 27 5b 6a 6f set theset ('[jo
b6f0: 69 6e 20 24 72 65 76 69 73 69 6f 6e 73 20 7b 27 in $revisions {'
b700: 2c 27 7d 5d 27 29 0a 09 72 65 74 75 72 6e 20 5b ,'}]')..return [
b710: 73 74 61 74 65 20 72 75 6e 20 5b 73 75 62 73 74 state run [subst
b720: 20 2d 6e 6f 63 6f 6d 6d 61 6e 64 73 20 2d 6e 6f -nocommands -no
b730: 62 61 63 6b 73 6c 61 73 68 65 73 20 7b 0a 09 20 backslashes {..
b740: 20 20 20 53 45 4c 45 43 54 0a 09 20 20 20 20 44 SELECT.. D
b750: 49 53 54 49 4e 43 54 20 4c 2e 6e 61 6d 65 0a 09 ISTINCT L.name..
b760: 20 20 20 20 46 52 4f 4d 20 20 20 72 65 76 69 73 FROM revis
b770: 69 6f 6e 20 52 2c 20 73 79 6d 62 6f 6c 20 4c 0a ion R, symbol L.
b780: 09 20 20 20 20 57 48 45 52 45 20 20 52 2e 72 69 . WHERE R.ri
b790: 64 20 69 6e 20 24 74 68 65 73 65 74 20 20 20 20 d in $theset
b7a0: 20 20 20 20 2d 2d 20 52 65 73 74 72 69 63 74 20 -- Restrict
b7b0: 74 6f 20 72 65 76 69 73 69 6f 6e 73 20 6f 66 20 to revisions of
b7c0: 69 6e 74 65 72 65 73 74 0a 09 20 20 20 20 41 4e interest.. AN
b7d0: 44 20 20 20 20 4c 2e 73 69 64 20 3d 20 52 2e 6c D L.sid = R.l
b7e0: 6f 64 20 20 20 20 20 20 20 20 20 20 20 2d 2d 20 od --
b7f0: 47 65 74 20 6c 6f 64 20 73 79 6d 62 6f 6c 20 6f Get lod symbol o
b800: 66 20 72 65 76 69 73 69 6f 6e 0a 09 7d 5d 5d 0a f revision..}]].
b810: 20 20 20 20 7d 0a 7d 0a 0a 23 20 23 20 23 23 20 }.}..# # ##
b820: 23 23 23 20 23 23 23 23 23 20 23 23 23 23 23 23 ### ##### ######
b830: 23 23 20 23 23 23 23 23 23 23 23 23 23 23 23 23 ## #############
b840: 20 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ###############
b850: 23 23 23 23 23 23 0a 23 23 20 48 65 6c 70 65 72 ######.## Helper
b860: 20 73 69 6e 67 6c 65 74 6f 6e 2e 20 43 6f 6d 6d singleton. Comm
b870: 61 6e 64 73 20 66 6f 72 20 74 61 67 20 73 79 6d ands for tag sym
b880: 62 6f 6c 20 63 68 61 6e 67 65 73 65 74 73 2e 0a bol changesets..
b890: 0a 73 6e 69 74 3a 3a 74 79 70 65 20 3a 3a 76 63 .snit::type ::vc
b8a0: 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 ::fossil::import
b8b0: 3a 3a 63 76 73 3a 3a 70 72 6f 6a 65 63 74 3a 3a ::cvs::project::
b8c0: 72 65 76 3a 3a 73 79 6d 3a 3a 74 61 67 20 7b 0a rev::sym::tag {.
b8d0: 20 20 20 20 74 79 70 65 6d 65 74 68 6f 64 20 62 typemethod b
b8e0: 79 72 65 76 69 73 69 6f 6e 20 7b 7d 20 7b 20 72 yrevision {} { r
b8f0: 65 74 75 72 6e 20 30 20 7d 0a 20 20 20 20 74 79 eturn 0 }. ty
b900: 70 65 6d 65 74 68 6f 64 20 62 79 73 79 6d 62 6f pemethod bysymbo
b910: 6c 20 20 20 7b 7d 20 7b 20 72 65 74 75 72 6e 20 l {} { return
b920: 31 20 7d 0a 20 20 20 20 74 79 70 65 6d 65 74 68 1 }. typemeth
b930: 6f 64 20 69 73 74 61 67 20 20 20 20 20 20 7b 7d od istag {}
b940: 20 7b 20 72 65 74 75 72 6e 20 31 20 7d 0a 20 20 { return 1 }.
b950: 20 20 74 79 70 65 6d 65 74 68 6f 64 20 69 73 62 typemethod isb
b960: 72 61 6e 63 68 20 20 20 7b 7d 20 7b 20 72 65 74 ranch {} { ret
b970: 75 72 6e 20 30 20 7d 0a 0a 20 20 20 20 74 79 70 urn 0 }.. typ
b980: 65 6d 65 74 68 6f 64 20 73 74 72 20 7b 74 61 67 emethod str {tag
b990: 7d 20 7b 0a 09 73 74 72 75 63 74 3a 3a 6c 69 73 } {..struct::lis
b9a0: 74 20 61 73 73 69 67 6e 20 5b 73 74 61 74 65 20 t assign [state
b9b0: 72 75 6e 20 7b 0a 09 20 20 20 20 53 45 4c 45 43 run {.. SELEC
b9c0: 54 20 53 2e 6e 61 6d 65 2c 20 46 2e 6e 61 6d 65 T S.name, F.name
b9d0: 2c 20 50 2e 6e 61 6d 65 0a 09 20 20 20 20 46 52 , P.name.. FR
b9e0: 4f 4d 20 20 20 74 61 67 20 54 2c 20 73 79 6d 62 OM tag T, symb
b9f0: 6f 6c 20 53 2c 20 66 69 6c 65 20 46 2c 20 70 72 ol S, file F, pr
ba00: 6f 6a 65 63 74 20 50 0a 09 20 20 20 20 57 48 45 oject P.. WHE
ba10: 52 45 20 20 54 2e 74 69 64 20 3d 20 24 74 61 67 RE T.tid = $tag
ba20: 20 20 20 2d 2d 20 46 69 6e 64 20 73 70 65 63 69 -- Find speci
ba30: 66 69 65 64 20 74 61 67 0a 09 20 20 20 20 41 4e fied tag.. AN
ba40: 44 20 20 20 20 46 2e 66 69 64 20 3d 20 54 2e 66 D F.fid = T.f
ba50: 69 64 20 20 2d 2d 20 47 65 74 20 66 69 6c 65 20 id -- Get file
ba60: 6f 66 20 74 61 67 0a 09 20 20 20 20 41 4e 44 20 of tag.. AND
ba70: 20 20 20 50 2e 70 69 64 20 3d 20 46 2e 70 69 64 P.pid = F.pid
ba80: 20 20 2d 2d 20 47 65 74 20 70 72 6f 6a 65 63 74 -- Get project
ba90: 20 6f 66 20 66 69 6c 65 0a 09 20 20 20 20 41 4e of file.. AN
baa0: 44 20 20 20 20 53 2e 73 69 64 20 3d 20 54 2e 73 D S.sid = T.s
bab0: 69 64 20 20 2d 2d 20 47 65 74 20 73 79 6d 62 6f id -- Get symbo
bac0: 6c 20 6f 66 20 74 61 67 0a 09 7d 5d 20 73 6e 61 l of tag..}] sna
bad0: 6d 65 20 66 6e 61 6d 65 20 70 6e 61 6d 65 0a 09 me fname pname..
bae0: 72 65 74 75 72 6e 20 22 24 70 6e 61 6d 65 2f 54 return "$pname/T
baf0: 27 24 7b 73 6e 61 6d 65 7d 27 3a 3a 24 66 6e 61 '${sname}'::$fna
bb00: 6d 65 22 0a 20 20 20 20 7d 0a 0a 20 20 20 20 23 me". }.. #
bb10: 20 72 65 73 75 6c 74 20 3d 20 6c 69 73 74 20 28 result = list (
bb20: 6d 69 6e 74 69 6d 65 2c 20 6d 61 78 74 69 6d 65 mintime, maxtime
bb30: 29 0a 20 20 20 20 74 79 70 65 6d 65 74 68 6f 64 ). typemethod
bb40: 20 74 69 6d 65 72 61 6e 67 65 20 7b 74 61 67 73 timerange {tags
bb50: 7d 20 7b 0a 09 23 20 54 68 65 20 72 61 6e 67 65 } {..# The range
bb60: 20 69 73 20 64 65 66 69 6e 65 64 20 61 73 20 74 is defined as t
bb70: 68 65 20 72 61 6e 67 65 20 6f 66 20 74 68 65 20 he range of the
bb80: 72 65 76 69 73 69 6f 6e 73 20 74 68 65 20 74 61 revisions the ta
bb90: 67 73 0a 09 23 20 61 72 65 20 61 74 74 61 63 68 gs..# are attach
bba0: 65 64 20 74 6f 2e 0a 0a 09 73 65 74 20 74 68 65 ed to....set the
bbb0: 73 65 74 20 28 27 5b 6a 6f 69 6e 20 24 74 61 67 set ('[join $tag
bbc0: 73 20 7b 27 2c 27 7d 5d 27 29 0a 09 72 65 74 75 s {','}]')..retu
bbd0: 72 6e 20 5b 73 74 61 74 65 20 72 75 6e 20 5b 73 rn [state run [s
bbe0: 75 62 73 74 20 2d 6e 6f 63 6f 6d 6d 61 6e 64 73 ubst -nocommands
bbf0: 20 2d 6e 6f 62 61 63 6b 73 6c 61 73 68 65 73 20 -nobackslashes
bc00: 7b 0a 09 20 20 20 20 53 45 4c 45 43 54 20 4d 49 {.. SELECT MI
bc10: 4e 28 52 2e 64 61 74 65 29 2c 20 4d 41 58 28 52 N(R.date), MAX(R
bc20: 2e 64 61 74 65 29 0a 09 20 20 20 20 46 52 4f 4d .date).. FROM
bc30: 20 20 20 74 61 67 20 54 2c 20 72 65 76 69 73 69 tag T, revisi
bc40: 6f 6e 20 52 0a 09 20 20 20 20 57 48 45 52 45 20 on R.. WHERE
bc50: 20 54 2e 74 69 64 20 49 4e 20 24 74 68 65 73 65 T.tid IN $these
bc60: 74 20 20 2d 2d 20 52 65 73 74 72 69 63 74 20 74 t -- Restrict t
bc70: 6f 20 74 61 67 73 20 6f 66 20 69 6e 74 65 72 65 o tags of intere
bc80: 73 74 0a 20 20 20 20 20 20 20 20 20 20 20 20 41 st. A
bc90: 4e 44 20 20 20 20 52 2e 72 69 64 20 3d 20 54 2e ND R.rid = T.
bca0: 72 65 76 20 20 20 20 20 2d 2d 20 53 65 6c 65 63 rev -- Selec
bcb0: 74 20 74 61 67 20 70 61 72 65 6e 74 20 72 65 76 t tag parent rev
bcc0: 69 73 69 6f 6e 73 0a 09 7d 5d 5d 0a 20 20 20 20 isions..}]].
bcd0: 7d 0a 0a 20 20 20 20 23 20 76 61 72 28 64 76 29 }.. # var(dv)
bce0: 20 3d 20 64 69 63 74 20 28 69 74 65 6d 20 2d 3e = dict (item ->
bcf0: 20 6c 69 73 74 20 28 69 74 65 6d 29 29 2c 20 69 list (item)), i
bd00: 74 65 6d 20 20 3d 20 6c 69 73 74 20 28 74 79 70 tem = list (typ
bd10: 65 20 69 64 29 0a 20 20 20 20 74 79 70 65 6d 65 e id). typeme
bd20: 74 68 6f 64 20 73 75 63 63 65 73 73 6f 72 73 20 thod successors
bd30: 7b 64 76 20 74 61 67 73 7d 20 7b 0a 09 23 20 54 {dv tags} {..# T
bd40: 61 67 73 20 68 61 76 65 20 6e 6f 20 73 75 63 63 ags have no succ
bd50: 65 73 73 6f 72 73 2e 0a 09 72 65 74 75 72 6e 0a essors...return.
bd60: 20 20 20 20 7d 0a 0a 20 20 20 20 23 20 72 65 73 }.. # res
bd70: 75 6c 74 20 3d 20 34 2d 6c 69 73 74 20 28 69 74 ult = 4-list (it
bd80: 65 6d 74 79 70 65 20 69 74 65 6d 69 64 20 6e 65 emtype itemid ne
bd90: 78 74 69 74 65 6d 74 79 70 65 20 6e 65 78 74 69 xtitemtype nexti
bda0: 74 65 6d 69 64 20 2e 2e 2e 29 0a 20 20 20 20 74 temid ...). t
bdb0: 79 70 65 6d 65 74 68 6f 64 20 6c 6f 6f 70 73 20 ypemethod loops
bdc0: 7b 74 61 67 73 7d 20 7b 0a 09 23 20 54 61 67 73 {tags} {..# Tags
bdd0: 20 68 61 76 65 20 6e 6f 20 73 75 63 63 65 73 73 have no success
bde0: 6f 72 73 2c 20 74 68 65 72 65 66 6f 72 65 20 63 ors, therefore c
bdf0: 61 6e 6e 6f 74 20 63 61 75 73 65 20 6c 6f 6f 70 annot cause loop
be00: 73 0a 09 72 65 74 75 72 6e 20 7b 7d 0a 20 20 20 s..return {}.
be10: 20 7d 0a 0a 20 20 20 20 23 20 72 65 73 75 6c 74 }.. # result
be20: 20 3d 20 6c 69 73 74 20 28 63 68 61 6e 67 65 73 = list (changes
be30: 65 74 2d 69 64 29 0a 20 20 20 20 74 79 70 65 6d et-id). typem
be40: 65 74 68 6f 64 20 63 73 5f 73 75 63 63 65 73 73 ethod cs_success
be50: 6f 72 73 20 7b 74 61 67 73 7d 20 7b 0a 09 23 20 ors {tags} {..#
be60: 54 61 67 73 20 68 61 76 65 20 6e 6f 20 73 75 63 Tags have no suc
be70: 63 65 73 73 6f 72 73 2e 0a 09 72 65 74 75 72 6e cessors...return
be80: 0a 20 20 20 20 7d 0a 0a 20 20 20 20 23 20 72 65 . }.. # re
be90: 73 75 6c 74 20 3d 20 73 79 6d 62 6f 6c 20 6e 61 sult = symbol na
bea0: 6d 65 0a 20 20 20 20 74 79 70 65 6d 65 74 68 6f me. typemetho
beb0: 64 20 63 73 5f 6c 6f 64 20 7b 74 61 67 73 7d 20 d cs_lod {tags}
bec0: 7b 0a 09 23 20 44 65 74 65 72 6d 69 6e 65 73 20 {..# Determines
bed0: 74 68 65 20 6e 61 6d 65 20 6f 66 20 74 68 65 20 the name of the
bee0: 73 79 6d 62 6f 6c 20 77 68 69 63 68 20 69 73 20 symbol which is
bef0: 74 68 65 20 6c 69 6e 65 20 6f 66 0a 09 23 20 64 the line of..# d
bf00: 65 76 65 6c 6f 70 6d 65 6e 74 20 66 6f 72 20 74 evelopment for t
bf10: 68 65 20 74 61 67 73 20 69 6e 20 61 20 63 68 61 he tags in a cha
bf20: 6e 67 65 73 65 74 2e 0a 0a 09 73 65 74 20 74 68 ngeset....set th
bf30: 65 73 65 74 20 28 27 5b 6a 6f 69 6e 20 24 74 61 eset ('[join $ta
bf40: 67 73 20 7b 27 2c 27 7d 5d 27 29 0a 09 72 65 74 gs {','}]')..ret
bf50: 75 72 6e 20 5b 73 74 61 74 65 20 72 75 6e 20 5b urn [state run [
bf60: 73 75 62 73 74 20 2d 6e 6f 63 6f 6d 6d 61 6e 64 subst -nocommand
bf70: 73 20 2d 6e 6f 62 61 63 6b 73 6c 61 73 68 65 73 s -nobackslashes
bf80: 20 7b 0a 09 20 20 20 20 53 45 4c 45 43 54 0a 09 {.. SELECT..
bf90: 20 20 20 20 44 49 53 54 49 4e 43 54 20 4c 2e 6e DISTINCT L.n
bfa0: 61 6d 65 0a 09 20 20 20 20 46 52 4f 4d 20 20 20 ame.. FROM
bfb0: 74 61 67 20 54 2c 20 73 79 6d 62 6f 6c 20 4c 0a tag T, symbol L.
bfc0: 09 20 20 20 20 57 48 45 52 45 20 20 54 2e 74 69 . WHERE T.ti
bfd0: 64 20 69 6e 20 24 74 68 65 73 65 74 20 20 20 20 d in $theset
bfe0: 20 20 20 20 2d 2d 20 52 65 73 74 72 69 63 74 20 -- Restrict
bff0: 74 6f 20 74 61 67 73 20 6f 66 20 69 6e 74 65 72 to tags of inter
c000: 65 73 74 0a 09 20 20 20 20 41 4e 44 20 20 20 20 est.. AND
c010: 4c 2e 73 69 64 20 3d 20 54 2e 6c 6f 64 20 20 20 L.sid = T.lod
c020: 20 20 20 20 20 20 20 20 2d 2d 20 47 65 74 20 6c -- Get l
c030: 6f 64 20 73 79 6d 62 6f 6c 20 6f 66 20 74 61 67 od symbol of tag
c040: 0a 09 7d 5d 5d 0a 20 20 20 20 7d 0a 7d 0a 0a 23 ..}]]. }.}..#
c050: 20 23 20 23 23 20 23 23 23 20 23 23 23 23 23 20 # ## ### #####
c060: 23 23 23 23 23 23 23 23 20 23 23 23 23 23 23 23 ######## #######
c070: 23 23 23 23 23 23 20 23 23 23 23 23 23 23 23 23 ###### #########
c080: 23 23 23 23 23 23 23 23 23 23 23 23 0a 23 23 20 ############.##
c090: 48 65 6c 70 65 72 20 73 69 6e 67 6c 65 74 6f 6e Helper singleton
c0a0: 2e 20 43 6f 6d 6d 61 6e 64 73 20 66 6f 72 20 62 . Commands for b
c0b0: 72 61 6e 63 68 20 73 79 6d 62 6f 6c 20 63 68 61 ranch symbol cha
c0c0: 6e 67 65 73 65 74 73 2e 0a 0a 73 6e 69 74 3a 3a ngesets...snit::
c0d0: 74 79 70 65 20 3a 3a 76 63 3a 3a 66 6f 73 73 69 type ::vc::fossi
c0e0: 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a l::import::cvs::
c0f0: 70 72 6f 6a 65 63 74 3a 3a 72 65 76 3a 3a 73 79 project::rev::sy
c100: 6d 3a 3a 62 72 61 6e 63 68 20 7b 0a 20 20 20 20 m::branch {.
c110: 74 79 70 65 6d 65 74 68 6f 64 20 62 79 72 65 76 typemethod byrev
c120: 69 73 69 6f 6e 20 7b 7d 20 7b 20 72 65 74 75 72 ision {} { retur
c130: 6e 20 30 20 7d 0a 20 20 20 20 74 79 70 65 6d 65 n 0 }. typeme
c140: 74 68 6f 64 20 62 79 73 79 6d 62 6f 6c 20 20 20 thod bysymbol
c150: 7b 7d 20 7b 20 72 65 74 75 72 6e 20 31 20 7d 0a {} { return 1 }.
c160: 20 20 20 20 74 79 70 65 6d 65 74 68 6f 64 20 69 typemethod i
c170: 73 74 61 67 20 20 20 20 20 20 7b 7d 20 7b 20 72 stag {} { r
c180: 65 74 75 72 6e 20 30 20 7d 0a 20 20 20 20 74 79 eturn 0 }. ty
c190: 70 65 6d 65 74 68 6f 64 20 69 73 62 72 61 6e 63 pemethod isbranc
c1a0: 68 20 20 20 7b 7d 20 7b 20 72 65 74 75 72 6e 20 h {} { return
c1b0: 31 20 7d 0a 0a 20 20 20 20 74 79 70 65 6d 65 74 1 }.. typemet
c1c0: 68 6f 64 20 73 74 72 20 7b 62 72 61 6e 63 68 7d hod str {branch}
c1d0: 20 7b 0a 09 73 74 72 75 63 74 3a 3a 6c 69 73 74 {..struct::list
c1e0: 20 61 73 73 69 67 6e 20 5b 73 74 61 74 65 20 72 assign [state r
c1f0: 75 6e 20 7b 0a 09 20 20 20 20 53 45 4c 45 43 54 un {.. SELECT
c200: 20 53 2e 6e 61 6d 65 2c 20 46 2e 6e 61 6d 65 2c S.name, F.name,
c210: 20 50 2e 6e 61 6d 65 0a 09 20 20 20 20 46 52 4f P.name.. FRO
c220: 4d 20 20 20 62 72 61 6e 63 68 20 42 2c 20 73 79 M branch B, sy
c230: 6d 62 6f 6c 20 53 2c 20 66 69 6c 65 20 46 2c 20 mbol S, file F,
c240: 70 72 6f 6a 65 63 74 20 50 0a 09 20 20 20 20 57 project P.. W
c250: 48 45 52 45 20 20 42 2e 62 69 64 20 3d 20 24 62 HERE B.bid = $b
c260: 72 61 6e 63 68 20 20 2d 2d 20 46 69 6e 64 20 73 ranch -- Find s
c270: 70 65 63 69 66 69 65 64 20 62 72 61 6e 63 68 0a pecified branch.
c280: 09 20 20 20 20 41 4e 44 20 20 20 20 46 2e 66 69 . AND F.fi
c290: 64 20 3d 20 42 2e 66 69 64 20 20 20 20 2d 2d 20 d = B.fid --
c2a0: 47 65 74 20 66 69 6c 65 20 6f 66 20 62 72 61 6e Get file of bran
c2b0: 63 68 0a 09 20 20 20 20 41 4e 44 20 20 20 20 50 ch.. AND P
c2c0: 2e 70 69 64 20 3d 20 46 2e 70 69 64 20 20 20 20 .pid = F.pid
c2d0: 2d 2d 20 47 65 74 20 70 72 6f 6a 65 63 74 20 6f -- Get project o
c2e0: 66 20 66 69 6c 65 0a 09 20 20 20 20 41 4e 44 20 f file.. AND
c2f0: 20 20 20 53 2e 73 69 64 20 3d 20 42 2e 73 69 64 S.sid = B.sid
c300: 20 20 20 20 2d 2d 20 47 65 74 20 73 79 6d 62 6f -- Get symbo
c310: 6c 20 6f 66 20 62 72 61 6e 63 68 0a 09 7d 5d 20 l of branch..}]
c320: 73 6e 61 6d 65 20 66 6e 61 6d 65 20 70 6e 61 6d sname fname pnam
c330: 65 0a 09 72 65 74 75 72 6e 20 22 24 70 6e 61 6d e..return "$pnam
c340: 65 2f 42 27 24 7b 73 6e 61 6d 65 7d 27 3a 3a 24 e/B'${sname}'::$
c350: 66 6e 61 6d 65 22 0a 20 20 20 20 7d 0a 0a 20 20 fname". }..
c360: 20 20 23 20 72 65 73 75 6c 74 20 3d 20 6c 69 73 # result = lis
c370: 74 20 28 6d 69 6e 74 69 6d 65 2c 20 6d 61 78 74 t (mintime, maxt
c380: 69 6d 65 29 0a 20 20 20 20 74 79 70 65 6d 65 74 ime). typemet
c390: 68 6f 64 20 74 69 6d 65 72 61 6e 67 65 20 7b 62 hod timerange {b
c3a0: 72 61 6e 63 68 65 73 7d 20 7b 0a 09 23 20 54 68 ranches} {..# Th
c3b0: 65 20 72 61 6e 67 65 20 6f 66 20 61 20 62 72 61 e range of a bra
c3c0: 6e 63 68 20 69 73 20 64 65 66 69 6e 65 64 20 61 nch is defined a
c3d0: 73 20 74 68 65 20 72 61 6e 67 65 20 6f 66 20 74 s the range of t
c3e0: 68 65 0a 09 23 20 72 65 76 69 73 69 6f 6e 73 20 he..# revisions
c3f0: 74 68 65 20 62 72 61 6e 63 68 65 73 20 61 72 65 the branches are
c400: 20 73 70 61 77 6e 65 64 20 62 79 2e 20 4e 4f 54 spawned by. NOT
c410: 45 20 68 6f 77 65 76 65 72 20 74 68 61 74 20 74 E however that t
c420: 68 65 0a 09 23 20 62 72 61 6e 63 68 65 73 20 61 he..# branches a
c430: 73 73 6f 63 69 61 74 65 64 20 77 69 74 68 20 61 ssociated with a
c440: 20 64 65 74 61 63 68 65 64 20 4e 54 44 42 20 77 detached NTDB w
c450: 69 6c 6c 20 68 61 76 65 20 6e 6f 20 72 6f 6f 74 ill have no root
c460: 0a 09 23 20 73 70 61 77 6e 69 6e 67 20 74 68 65 ..# spawning the
c470: 6d 2c 20 68 65 6e 63 65 20 74 68 65 79 20 68 61 m, hence they ha
c480: 76 65 20 6e 6f 20 72 65 61 6c 20 74 69 6d 65 72 ve no real timer
c490: 61 6e 67 65 20 61 6e 79 0a 09 23 20 6c 6f 6e 67 ange any..# long
c4a0: 65 72 2e 20 42 79 20 75 73 69 6e 67 20 30 20 77 er. By using 0 w
c4b0: 65 20 70 75 74 20 74 68 65 6d 20 69 6e 20 66 72 e put them in fr
c4c0: 6f 6e 74 20 6f 66 20 65 76 65 72 79 74 68 69 6e ont of everythin
c4d0: 67 20 65 6c 73 65 2c 0a 09 23 20 61 73 20 74 68 g else,..# as th
c4e0: 65 79 20 6c 6f 67 69 63 61 6c 6c 79 20 61 72 65 ey logically are
c4f0: 2e 0a 0a 09 73 65 74 20 74 68 65 73 65 74 20 28 ....set theset (
c500: 27 5b 6a 6f 69 6e 20 24 62 72 61 6e 63 68 65 73 '[join $branches
c510: 20 7b 27 2c 27 7d 5d 27 29 0a 09 72 65 74 75 72 {','}]')..retur
c520: 6e 20 5b 73 74 61 74 65 20 72 75 6e 20 5b 73 75 n [state run [su
c530: 62 73 74 20 2d 6e 6f 63 6f 6d 6d 61 6e 64 73 20 bst -nocommands
c540: 2d 6e 6f 62 61 63 6b 73 6c 61 73 68 65 73 20 7b -nobackslashes {
c550: 0a 09 20 20 20 20 53 45 4c 45 43 54 20 49 46 4e .. SELECT IFN
c560: 55 4c 4c 28 4d 49 4e 28 52 2e 64 61 74 65 29 2c ULL(MIN(R.date),
c570: 30 29 2c 20 49 46 4e 55 4c 4c 28 4d 41 58 28 52 0), IFNULL(MAX(R
c580: 2e 64 61 74 65 29 2c 30 29 0a 09 20 20 20 20 46 .date),0).. F
c590: 52 4f 4d 20 20 62 72 61 6e 63 68 20 42 2c 20 72 ROM branch B, r
c5a0: 65 76 69 73 69 6f 6e 20 52 0a 09 20 20 20 20 57 evision R.. W
c5b0: 48 45 52 45 20 42 2e 62 69 64 20 49 4e 20 24 74 HERE B.bid IN $t
c5c0: 68 65 73 65 74 20 20 20 2d 2d 20 52 65 73 74 72 heset -- Restr
c5d0: 69 63 74 20 74 6f 20 62 72 61 6e 63 68 65 73 20 ict to branches
c5e0: 6f 66 20 69 6e 74 65 72 65 73 74 0a 20 20 20 20 of interest.
c5f0: 20 20 20 20 20 20 20 20 41 4e 44 20 20 20 52 2e AND R.
c600: 72 69 64 20 3d 20 42 2e 72 6f 6f 74 20 20 20 20 rid = B.root
c610: 20 2d 2d 20 53 65 6c 65 63 74 20 62 72 61 6e 63 -- Select branc
c620: 68 20 70 61 72 65 6e 74 20 72 65 76 69 73 69 6f h parent revisio
c630: 6e 73 0a 09 7d 5d 5d 0a 20 20 20 20 7d 0a 0a 20 ns..}]]. }..
c640: 20 20 20 23 20 72 65 73 75 6c 74 20 3d 20 34 2d # result = 4-
c650: 6c 69 73 74 20 28 69 74 65 6d 74 79 70 65 20 69 list (itemtype i
c660: 74 65 6d 69 64 20 6e 65 78 74 69 74 65 6d 74 79 temid nextitemty
c670: 70 65 20 6e 65 78 74 69 74 65 6d 69 64 20 2e 2e pe nextitemid ..
c680: 2e 29 0a 20 20 20 20 74 79 70 65 6d 65 74 68 6f .). typemetho
c690: 64 20 6c 6f 6f 70 73 20 7b 62 72 61 6e 63 68 65 d loops {branche
c6a0: 73 7d 20 7b 0a 09 23 20 4e 6f 74 65 3a 20 52 65 s} {..# Note: Re
c6b0: 76 69 73 69 6f 6e 73 20 61 6e 64 20 74 61 67 73 visions and tags
c6c0: 20 63 61 6e 6e 6f 74 20 63 61 75 73 65 20 74 68 cannot cause th
c6d0: 65 20 6c 6f 6f 70 2e 20 42 65 69 6e 67 20 6f 66 e loop. Being of
c6e0: 20 61 0a 09 23 20 66 75 6e 64 61 6d 65 6e 74 61 a..# fundamenta
c6f0: 6c 6c 79 20 64 69 66 66 65 72 65 6e 74 20 74 79 lly different ty
c700: 70 65 20 74 68 65 79 20 63 61 6e 6e 6f 74 20 62 pe they cannot b
c710: 65 20 69 6e 20 74 68 65 20 69 6e 63 6f 6d 69 6e e in the incomin
c720: 67 0a 09 23 20 73 65 74 20 6f 66 20 69 64 73 2e g..# set of ids.
c730: 0a 0a 09 73 65 74 20 74 68 65 73 65 74 20 28 27 ...set theset ('
c740: 5b 6a 6f 69 6e 20 24 62 72 61 6e 63 68 65 73 20 [join $branches
c750: 7b 27 2c 27 7d 5d 27 29 0a 09 72 65 74 75 72 6e {','}]')..return
c760: 20 5b 73 74 61 74 65 20 72 75 6e 20 5b 73 75 62 [state run [sub
c770: 73 74 20 2d 6e 6f 63 6f 6d 6d 61 6e 64 73 20 2d st -nocommands -
c780: 6e 6f 62 61 63 6b 73 6c 61 73 68 65 73 20 7b 0a nobackslashes {.
c790: 09 20 20 20 20 53 45 4c 45 43 54 20 42 2e 62 69 . SELECT B.bi
c7a0: 64 2c 20 42 58 2e 62 69 64 0a 09 20 20 20 20 46 d, BX.bid.. F
c7b0: 52 4f 4d 20 20 20 62 72 61 6e 63 68 20 42 2c 20 ROM branch B,
c7c0: 70 72 65 66 65 72 65 64 70 61 72 65 6e 74 20 50 preferedparent P
c7d0: 2c 20 62 72 61 6e 63 68 20 42 58 0a 09 20 20 20 , branch BX..
c7e0: 20 57 48 45 52 45 20 20 42 2e 62 69 64 20 49 4e WHERE B.bid IN
c7f0: 20 24 74 68 65 73 65 74 20 20 20 2d 2d 20 52 65 $theset -- Re
c800: 73 74 72 69 63 74 20 74 6f 20 62 72 61 6e 63 68 strict to branch
c810: 65 73 20 6f 66 20 69 6e 74 65 72 65 73 74 0a 09 es of interest..
c820: 20 20 20 20 41 4e 44 20 20 20 20 42 2e 73 69 64 AND B.sid
c830: 20 3d 20 50 2e 70 69 64 20 20 20 20 20 20 2d 2d = P.pid --
c840: 20 47 65 74 20 74 68 65 20 70 72 65 66 65 72 65 Get the prefere
c850: 64 20 62 72 61 6e 63 68 65 73 20 76 69 61 0a 09 d branches via..
c860: 20 20 20 20 41 4e 44 20 20 20 20 42 58 2e 73 69 AND BX.si
c870: 64 20 3d 20 50 2e 73 69 64 20 20 20 20 20 2d 2d d = P.sid --
c880: 20 74 68 65 20 62 72 61 6e 63 68 20 73 79 6d 62 the branch symb
c890: 6f 6c 73 0a 09 20 20 20 20 41 4e 44 20 20 20 20 ols.. AND
c8a0: 42 58 2e 62 69 64 20 49 4e 20 24 74 68 65 73 65 BX.bid IN $these
c8b0: 74 20 20 2d 2d 20 4c 6f 6f 70 0a 09 7d 5d 5d 0a t -- Loop..}]].
c8c0: 20 20 20 20 7d 0a 0a 20 20 20 20 23 20 76 61 72 }.. # var
c8d0: 28 64 76 29 20 3d 20 64 69 63 74 20 28 69 74 65 (dv) = dict (ite
c8e0: 6d 20 2d 3e 20 6c 69 73 74 20 28 69 74 65 6d 29 m -> list (item)
c8f0: 29 2c 20 69 74 65 6d 20 20 3d 20 6c 69 73 74 20 ), item = list
c900: 28 74 79 70 65 20 69 64 29 0a 20 20 20 20 74 79 (type id). ty
c910: 70 65 6d 65 74 68 6f 64 20 73 75 63 63 65 73 73 pemethod success
c920: 6f 72 73 20 7b 64 76 20 62 72 61 6e 63 68 65 73 ors {dv branches
c930: 7d 20 7b 0a 09 75 70 76 61 72 20 31 20 24 64 76 } {..upvar 1 $dv
c940: 20 64 65 70 65 6e 64 65 6e 63 69 65 73 0a 09 23 dependencies..#
c950: 20 54 68 65 20 66 69 72 73 74 20 72 65 76 69 73 The first revis
c960: 69 6f 6e 20 63 6f 6d 6d 69 74 74 65 64 20 6f 6e ion committed on
c970: 20 61 20 62 72 61 6e 63 68 2c 20 61 6e 64 20 61 a branch, and a
c980: 6c 6c 20 62 72 61 6e 63 68 65 73 0a 09 23 20 61 ll branches..# a
c990: 6e 64 20 74 61 67 73 20 77 68 69 63 68 20 68 61 nd tags which ha
c9a0: 76 65 20 69 74 20 61 73 20 74 68 65 69 72 20 70 ve it as their p
c9b0: 72 65 66 65 72 65 64 20 70 61 72 65 6e 74 20 61 refered parent a
c9c0: 72 65 20 74 68 65 0a 09 23 20 73 75 63 63 65 73 re the..# succes
c9d0: 73 6f 72 73 20 6f 66 20 61 20 62 72 61 6e 63 68 sors of a branch
c9e0: 2e 0a 0a 09 73 65 74 20 74 68 65 73 65 74 20 28 ....set theset (
c9f0: 27 5b 6a 6f 69 6e 20 24 62 72 61 6e 63 68 65 73 '[join $branches
ca00: 20 7b 27 2c 27 7d 5d 27 29 0a 09 73 74 61 74 65 {','}]')..state
ca10: 20 66 6f 72 65 61 63 68 72 6f 77 20 5b 73 75 62 foreachrow [sub
ca20: 73 74 20 2d 6e 6f 63 6f 6d 6d 61 6e 64 73 20 2d st -nocommands -
ca30: 6e 6f 62 61 63 6b 73 6c 61 73 68 65 73 20 7b 0a nobackslashes {.
ca40: 09 20 20 20 20 53 45 4c 45 43 54 20 42 2e 62 69 . SELECT B.bi
ca50: 64 20 41 53 20 78 62 69 64 2c 20 52 2e 72 69 64 d AS xbid, R.rid
ca60: 20 41 53 20 78 63 68 69 6c 64 0a 09 20 20 20 20 AS xchild..
ca70: 46 52 4f 4d 20 20 20 62 72 61 6e 63 68 20 42 2c FROM branch B,
ca80: 20 72 65 76 69 73 69 6f 6e 20 52 0a 09 20 20 20 revision R..
ca90: 20 57 48 45 52 45 20 20 42 2e 62 69 64 20 49 4e WHERE B.bid IN
caa0: 20 24 74 68 65 73 65 74 20 20 20 20 20 2d 2d 20 $theset --
cab0: 52 65 73 74 72 69 63 74 20 74 6f 20 62 72 61 6e Restrict to bran
cac0: 63 68 65 73 20 6f 66 20 69 6e 74 65 72 65 73 74 ches of interest
cad0: 0a 09 20 20 20 20 41 4e 44 20 20 20 20 42 2e 66 .. AND B.f
cae0: 69 72 73 74 20 3d 20 52 2e 72 69 64 20 20 20 20 irst = R.rid
caf0: 20 20 2d 2d 20 47 65 74 20 66 69 72 73 74 20 72 -- Get first r
cb00: 65 76 69 73 69 6f 6e 20 6f 6e 20 74 68 65 20 62 evision on the b
cb10: 72 61 6e 63 68 0a 09 7d 5d 20 7b 0a 09 20 20 20 ranch..}] {..
cb20: 20 6c 61 70 70 65 6e 64 20 64 65 70 65 6e 64 65 lappend depende
cb30: 6e 63 69 65 73 28 5b 6c 69 73 74 20 73 79 6d 3a ncies([list sym:
cb40: 3a 62 72 61 6e 63 68 20 24 78 62 69 64 5d 29 20 :branch $xbid])
cb50: 5b 6c 69 73 74 20 72 65 76 20 24 78 63 68 69 6c [list rev $xchil
cb60: 64 5d 0a 09 7d 0a 09 73 74 61 74 65 20 66 6f 72 d]..}..state for
cb70: 65 61 63 68 72 6f 77 20 5b 73 75 62 73 74 20 2d eachrow [subst -
cb80: 6e 6f 63 6f 6d 6d 61 6e 64 73 20 2d 6e 6f 62 61 nocommands -noba
cb90: 63 6b 73 6c 61 73 68 65 73 20 7b 0a 09 20 20 20 ckslashes {..
cba0: 20 53 45 4c 45 43 54 20 42 2e 62 69 64 20 41 53 SELECT B.bid AS
cbb0: 20 78 62 69 64 2c 20 42 58 2e 62 69 64 20 41 53 xbid, BX.bid AS
cbc0: 20 78 63 68 69 6c 64 0a 09 20 20 20 20 46 52 4f xchild.. FRO
cbd0: 4d 20 20 20 62 72 61 6e 63 68 20 42 2c 20 70 72 M branch B, pr
cbe0: 65 66 65 72 65 64 70 61 72 65 6e 74 20 50 2c 20 eferedparent P,
cbf0: 62 72 61 6e 63 68 20 42 58 0a 09 20 20 20 20 57 branch BX.. W
cc00: 48 45 52 45 20 20 42 2e 62 69 64 20 49 4e 20 24 HERE B.bid IN $
cc10: 74 68 65 73 65 74 20 20 20 20 20 2d 2d 20 52 65 theset -- Re
cc20: 73 74 72 69 63 74 20 74 6f 20 62 72 61 6e 63 68 strict to branch
cc30: 65 73 20 6f 66 20 69 6e 74 65 72 65 73 74 0a 09 es of interest..
cc40: 20 20 20 20 41 4e 44 20 20 20 20 42 2e 73 69 64 AND B.sid
cc50: 20 3d 20 50 2e 70 69 64 20 20 20 20 20 20 20 20 = P.pid
cc60: 2d 2d 20 47 65 74 20 73 75 62 6f 72 64 69 6e 61 -- Get subordina
cc70: 74 65 20 62 72 61 6e 63 68 65 73 20 76 69 61 20 te branches via
cc80: 74 68 65 0a 09 20 20 20 20 41 4e 44 20 20 20 20 the.. AND
cc90: 42 58 2e 73 69 64 20 3d 20 50 2e 73 69 64 20 20 BX.sid = P.sid
cca0: 20 20 20 20 20 2d 2d 20 70 72 65 66 65 72 65 64 -- prefered
ccb0: 20 70 61 72 65 6e 74 73 20 6f 66 20 74 68 65 69 parents of thei
ccc0: 72 20 73 79 6d 62 6f 6c 73 0a 09 7d 5d 20 7b 0a r symbols..}] {.
ccd0: 09 20 20 20 20 6c 61 70 70 65 6e 64 20 64 65 70 . lappend dep
cce0: 65 6e 64 65 6e 63 69 65 73 28 5b 6c 69 73 74 20 endencies([list
ccf0: 73 79 6d 3a 3a 62 72 61 6e 63 68 20 24 78 62 69 sym::branch $xbi
cd00: 64 5d 29 20 5b 6c 69 73 74 20 73 79 6d 3a 3a 62 d]) [list sym::b
cd10: 72 61 6e 63 68 20 24 78 63 68 69 6c 64 5d 0a 09 ranch $xchild]..
cd20: 7d 0a 09 73 74 61 74 65 20 66 6f 72 65 61 63 68 }..state foreach
cd30: 72 6f 77 20 5b 73 75 62 73 74 20 2d 6e 6f 63 6f row [subst -noco
cd40: 6d 6d 61 6e 64 73 20 2d 6e 6f 62 61 63 6b 73 6c mmands -nobacksl
cd50: 61 73 68 65 73 20 7b 0a 09 20 20 20 20 53 45 4c ashes {.. SEL
cd60: 45 43 54 20 42 2e 62 69 64 20 41 53 20 78 62 69 ECT B.bid AS xbi
cd70: 64 2c 20 54 2e 74 69 64 20 41 53 20 78 63 68 69 d, T.tid AS xchi
cd80: 6c 64 0a 09 20 20 20 20 46 52 4f 4d 20 20 20 62 ld.. FROM b
cd90: 72 61 6e 63 68 20 42 2c 20 70 72 65 66 65 72 65 ranch B, prefere
cda0: 64 70 61 72 65 6e 74 20 50 2c 20 74 61 67 20 54 dparent P, tag T
cdb0: 0a 09 20 20 20 20 57 48 45 52 45 20 20 42 2e 62 .. WHERE B.b
cdc0: 69 64 20 49 4e 20 24 74 68 65 73 65 74 20 20 20 id IN $theset
cdd0: 20 20 2d 2d 20 52 65 73 74 72 69 63 74 20 74 6f -- Restrict to
cde0: 20 62 72 61 6e 63 68 65 73 20 6f 66 20 69 6e 74 branches of int
cdf0: 65 72 65 73 74 0a 09 20 20 20 20 41 4e 44 20 20 erest.. AND
ce00: 20 20 42 2e 73 69 64 20 3d 20 50 2e 70 69 64 20 B.sid = P.pid
ce10: 20 20 20 20 20 20 20 2d 2d 20 47 65 74 20 73 75 -- Get su
ce20: 62 6f 72 64 69 6e 61 74 65 20 74 61 67 73 20 76 bordinate tags v
ce30: 69 61 20 74 68 65 0a 09 20 20 20 20 41 4e 44 20 ia the.. AND
ce40: 20 20 20 54 2e 73 69 64 20 3d 20 50 2e 73 69 64 T.sid = P.sid
ce50: 20 20 20 20 20 20 20 20 2d 2d 20 70 72 65 66 65 -- prefe
ce60: 72 65 64 20 70 61 72 65 6e 74 73 20 6f 66 20 74 red parents of t
ce70: 68 65 69 72 20 73 79 6d 62 6f 6c 73 0a 09 7d 5d heir symbols..}]
ce80: 20 7b 0a 09 20 20 20 20 6c 61 70 70 65 6e 64 20 {.. lappend
ce90: 64 65 70 65 6e 64 65 6e 63 69 65 73 28 5b 6c 69 dependencies([li
cea0: 73 74 20 73 79 6d 3a 3a 62 72 61 6e 63 68 20 24 st sym::branch $
ceb0: 78 62 69 64 5d 29 20 5b 6c 69 73 74 20 73 79 6d xbid]) [list sym
cec0: 3a 3a 74 61 67 20 24 78 63 68 69 6c 64 5d 0a 09 ::tag $xchild]..
ced0: 7d 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a }..return. }.
cee0: 0a 20 20 20 20 23 20 72 65 73 75 6c 74 20 3d 20 . # result =
cef0: 6c 69 73 74 20 28 63 68 61 6e 67 65 73 65 74 2d list (changeset-
cf00: 69 64 29 0a 20 20 20 20 74 79 70 65 6d 65 74 68 id). typemeth
cf10: 6f 64 20 63 73 5f 73 75 63 63 65 73 73 6f 72 73 od cs_successors
cf20: 20 7b 62 72 61 6e 63 68 65 73 7d 20 7b 0a 20 20 {branches} {.
cf30: 20 20 20 20 20 20 23 20 54 68 69 73 20 69 73 20 # This is
cf40: 61 20 76 61 72 69 61 6e 74 20 6f 66 20 27 73 75 a variant of 'su
cf50: 63 63 65 73 73 6f 72 73 27 20 77 68 69 63 68 20 ccessors' which
cf60: 6d 61 70 73 20 74 68 65 20 6c 6f 77 2d 6c 65 76 maps the low-lev
cf70: 65 6c 0a 20 20 20 20 20 20 20 20 23 20 64 61 74 el. # dat
cf80: 61 20 64 69 72 65 63 74 6c 79 20 74 6f 20 74 68 a directly to th
cf90: 65 20 61 73 73 6f 63 69 61 74 65 64 20 63 68 61 e associated cha
cfa0: 6e 67 65 73 65 74 73 2e 20 49 2e 65 2e 20 69 6e ngesets. I.e. in
cfb0: 73 74 65 61 64 0a 20 20 20 20 20 20 20 20 23 20 stead. #
cfc0: 6d 69 6c 6c 69 6f 6e 73 20 6f 66 20 64 65 70 65 millions of depe
cfd0: 6e 64 65 6e 63 79 20 70 61 69 72 73 20 28 69 6e ndency pairs (in
cfe0: 20 65 78 74 72 65 6d 65 20 63 61 73 65 73 20 28 extreme cases (
cff0: 45 78 61 6d 70 6c 65 3a 20 54 63 6c 0a 20 20 20 Example: Tcl.
d000: 20 20 20 20 20 23 20 43 56 53 29 29 20 77 65 20 # CVS)) we
d010: 72 65 74 75 72 6e 20 61 20 76 65 72 79 20 73 68 return a very sh
d020: 6f 72 74 20 61 6e 64 20 6d 75 63 68 20 6d 6f 72 ort and much mor
d030: 65 20 6d 61 6e 61 67 65 61 62 6c 65 20 6c 69 73 e manageable lis
d040: 74 0a 20 20 20 20 20 20 20 20 23 20 6f 66 20 63 t. # of c
d050: 68 61 6e 67 65 73 65 74 73 2e 0a 0a 09 73 65 74 hangesets....set
d060: 20 74 68 65 73 65 74 20 28 27 5b 6a 6f 69 6e 20 theset ('[join
d070: 24 62 72 61 6e 63 68 65 73 20 7b 27 2c 27 7d 5d $branches {','}]
d080: 27 29 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 '). retur
d090: 6e 20 5b 73 74 61 74 65 20 72 75 6e 20 5b 73 75 n [state run [su
d0a0: 62 73 74 20 2d 6e 6f 63 6f 6d 6d 61 6e 64 73 20 bst -nocommands
d0b0: 2d 6e 6f 62 61 63 6b 73 6c 61 73 68 65 73 20 7b -nobackslashes {
d0c0: 0a 09 20 20 20 20 53 45 4c 45 43 54 20 43 2e 63 .. SELECT C.c
d0d0: 69 64 0a 09 20 20 20 20 46 52 4f 4d 20 20 20 62 id.. FROM b
d0e0: 72 61 6e 63 68 20 42 2c 20 72 65 76 69 73 69 6f ranch B, revisio
d0f0: 6e 20 52 2c 20 63 73 69 74 65 6d 20 43 49 2c 20 n R, csitem CI,
d100: 63 68 61 6e 67 65 73 65 74 20 43 0a 09 20 20 20 changeset C..
d110: 20 57 48 45 52 45 20 20 42 2e 62 69 64 20 49 4e WHERE B.bid IN
d120: 20 24 74 68 65 73 65 74 20 20 20 20 20 2d 2d 20 $theset --
d130: 52 65 73 74 72 69 63 74 20 74 6f 20 62 72 61 6e Restrict to bran
d140: 63 68 65 73 20 6f 66 20 69 6e 74 65 72 65 73 74 ches of interest
d150: 0a 09 20 20 20 20 41 4e 44 20 20 20 20 42 2e 66 .. AND B.f
d160: 69 72 73 74 20 3d 20 52 2e 72 69 64 09 2d 2d 20 irst = R.rid.--
d170: 47 65 74 20 66 69 72 73 74 20 72 65 76 69 73 69 Get first revisi
d180: 6f 6e 20 6f 6e 20 74 68 65 20 62 72 61 6e 63 68 on on the branch
d190: 0a 20 20 20 20 20 20 20 20 20 20 20 20 41 4e 44 . AND
d1a0: 20 20 20 20 43 49 2e 69 69 64 20 3d 20 52 2e 72 CI.iid = R.r
d1b0: 69 64 20 20 20 20 20 20 20 2d 2d 20 53 65 6c 65 id -- Sele
d1c0: 63 74 20 61 6c 6c 20 63 68 61 6e 67 65 73 65 74 ct all changeset
d1d0: 73 0a 20 20 20 20 20 20 20 20 20 20 20 20 41 4e s. AN
d1e0: 44 20 20 20 20 43 2e 63 69 64 20 3d 20 43 49 2e D C.cid = CI.
d1f0: 63 69 64 09 2d 2d 20 63 6f 6e 74 61 69 6e 69 6e cid.-- containin
d200: 67 20 74 68 69 73 20 72 65 76 69 73 69 6f 6e 0a g this revision.
d210: 20 20 20 20 20 20 20 20 20 20 20 20 41 4e 44 20 AND
d220: 20 20 20 43 2e 74 79 70 65 20 3d 20 30 09 09 2d C.type = 0..-
d230: 2d 20 77 68 69 63 68 20 61 72 65 20 72 65 76 69 - which are revi
d240: 73 69 6f 6e 20 63 68 61 6e 67 65 73 65 74 73 0a sion changesets.
d250: 20 20 20 20 55 4e 49 4f 4e 0a 09 20 20 20 20 53 UNION.. S
d260: 45 4c 45 43 54 20 43 2e 63 69 64 0a 09 20 20 20 ELECT C.cid..
d270: 20 46 52 4f 4d 20 20 20 62 72 61 6e 63 68 20 42 FROM branch B
d280: 2c 20 70 72 65 66 65 72 65 64 70 61 72 65 6e 74 , preferedparent
d290: 20 50 2c 20 62 72 61 6e 63 68 20 42 58 2c 20 63 P, branch BX, c
d2a0: 73 69 74 65 6d 20 43 49 2c 20 63 68 61 6e 67 65 sitem CI, change
d2b0: 73 65 74 20 43 0a 09 20 20 20 20 57 48 45 52 45 set C.. WHERE
d2c0: 20 20 42 2e 62 69 64 20 49 4e 20 24 74 68 65 73 B.bid IN $thes
d2d0: 65 74 20 20 20 20 20 2d 2d 20 52 65 73 74 72 69 et -- Restri
d2e0: 63 74 20 74 6f 20 62 72 61 6e 63 68 65 73 20 6f ct to branches o
d2f0: 66 20 69 6e 74 65 72 65 73 74 0a 09 20 20 20 20 f interest..
d300: 41 4e 44 20 20 20 20 42 2e 73 69 64 20 3d 20 50 AND B.sid = P
d310: 2e 70 69 64 09 2d 2d 20 47 65 74 20 73 75 62 6f .pid.-- Get subo
d320: 72 64 69 6e 61 74 65 20 62 72 61 6e 63 68 65 73 rdinate branches
d330: 20 76 69 61 20 74 68 65 0a 09 20 20 20 20 41 4e via the.. AN
d340: 44 20 20 20 20 42 58 2e 73 69 64 20 3d 20 50 2e D BX.sid = P.
d350: 73 69 64 09 2d 2d 20 70 72 65 66 65 72 65 64 20 sid.-- prefered
d360: 70 61 72 65 6e 74 73 20 6f 66 20 74 68 65 69 72 parents of their
d370: 20 73 79 6d 62 6f 6c 73 0a 20 20 20 20 20 20 20 symbols.
d380: 20 20 20 20 20 41 4e 44 20 20 20 20 43 49 2e 69 AND CI.i
d390: 69 64 20 3d 20 42 58 2e 62 69 64 20 20 20 20 20 id = BX.bid
d3a0: 20 2d 2d 20 53 65 6c 65 63 74 20 61 6c 6c 20 63 -- Select all c
d3b0: 68 61 6e 67 65 73 65 74 73 0a 20 20 20 20 20 20 hangesets.
d3c0: 20 20 20 20 20 20 41 4e 44 20 20 20 20 43 2e 63 AND C.c
d3d0: 69 64 20 3d 20 43 49 2e 63 69 64 09 2d 2d 20 63 id = CI.cid.-- c
d3e0: 6f 6e 74 61 69 6e 69 6e 67 20 74 68 65 20 73 75 ontaining the su
d3f0: 62 6f 72 64 69 6e 61 74 65 20 62 72 61 6e 63 68 bordinate branch
d400: 65 73 0a 20 20 20 20 20 20 20 20 20 20 20 20 41 es. A
d410: 4e 44 20 20 20 20 43 2e 74 79 70 65 20 3d 20 32 ND C.type = 2
d420: 09 09 2d 2d 20 77 68 69 63 68 20 61 72 65 20 62 ..-- which are b
d430: 72 61 6e 63 68 20 63 68 61 6e 67 65 73 65 74 73 ranch changesets
d440: 0a 20 20 20 20 55 4e 49 4f 4e 0a 09 20 20 20 20 . UNION..
d450: 53 45 4c 45 43 54 20 43 2e 63 69 64 0a 09 20 20 SELECT C.cid..
d460: 20 20 46 52 4f 4d 20 20 20 62 72 61 6e 63 68 20 FROM branch
d470: 42 2c 20 70 72 65 66 65 72 65 64 70 61 72 65 6e B, preferedparen
d480: 74 20 50 2c 20 74 61 67 20 54 2c 20 63 73 69 74 t P, tag T, csit
d490: 65 6d 20 43 49 2c 20 63 68 61 6e 67 65 73 65 74 em CI, changeset
d4a0: 20 43 0a 09 20 20 20 20 57 48 45 52 45 20 20 42 C.. WHERE B
d4b0: 2e 62 69 64 20 49 4e 20 24 74 68 65 73 65 74 20 .bid IN $theset
d4c0: 20 20 20 20 2d 2d 20 52 65 73 74 72 69 63 74 20 -- Restrict
d4d0: 74 6f 20 62 72 61 6e 63 68 65 73 20 6f 66 20 69 to branches of i
d4e0: 6e 74 65 72 65 73 74 0a 09 20 20 20 20 41 4e 44 nterest.. AND
d4f0: 20 20 20 20 42 2e 73 69 64 20 3d 20 50 2e 70 69 B.sid = P.pi
d500: 64 09 2d 2d 20 47 65 74 20 73 75 62 6f 72 64 69 d.-- Get subordi
d510: 6e 61 74 65 20 74 61 67 73 20 76 69 61 20 74 68 nate tags via th
d520: 65 0a 09 20 20 20 20 41 4e 44 20 20 20 20 54 2e e.. AND T.
d530: 73 69 64 20 3d 20 50 2e 73 69 64 09 2d 2d 20 70 sid = P.sid.-- p
d540: 72 65 66 65 72 65 64 20 70 61 72 65 6e 74 73 20 refered parents
d550: 6f 66 20 74 68 65 69 72 20 73 79 6d 62 6f 6c 73 of their symbols
d560: 0a 20 20 20 20 20 20 20 20 20 20 20 20 41 4e 44 . AND
d570: 20 20 20 20 43 49 2e 69 69 64 20 3d 20 54 2e 74 CI.iid = T.t
d580: 69 64 20 20 20 20 20 20 20 2d 2d 20 53 65 6c 65 id -- Sele
d590: 63 74 20 61 6c 6c 20 63 68 61 6e 67 65 73 65 74 ct all changeset
d5a0: 73 0a 20 20 20 20 20 20 20 20 20 20 20 20 41 4e s. AN
d5b0: 44 20 20 20 20 43 2e 63 69 64 20 3d 20 43 49 2e D C.cid = CI.
d5c0: 63 69 64 09 2d 2d 20 63 6f 6e 74 61 69 6e 69 6e cid.-- containin
d5d0: 67 20 74 68 65 20 73 75 62 6f 72 64 69 6e 61 74 g the subordinat
d5e0: 65 20 74 61 67 73 0a 20 20 20 20 20 20 20 20 20 e tags.
d5f0: 20 20 20 41 4e 44 20 20 20 20 43 2e 74 79 70 65 AND C.type
d600: 20 3d 20 31 09 09 2d 2d 20 77 68 69 63 68 20 61 = 1..-- which a
d610: 72 65 20 74 61 67 20 63 68 61 6e 67 65 73 65 74 re tag changeset
d620: 73 0a 09 7d 5d 5d 0a 09 72 65 74 75 72 6e 0a 20 s..}]]..return.
d630: 20 20 20 7d 0a 0a 20 20 20 20 23 20 72 65 73 75 }.. # resu
d640: 6c 74 20 3d 20 73 79 6d 62 6f 6c 20 6e 61 6d 65 lt = symbol name
d650: 0a 20 20 20 20 74 79 70 65 6d 65 74 68 6f 64 20 . typemethod
d660: 63 73 5f 6c 6f 64 20 7b 62 72 61 6e 63 68 65 73 cs_lod {branches
d670: 7d 20 7b 0a 09 23 20 44 65 74 65 72 6d 69 6e 65 } {..# Determine
d680: 73 20 74 68 65 20 6e 61 6d 65 20 6f 66 20 74 68 s the name of th
d690: 65 20 73 79 6d 62 6f 6c 20 77 68 69 63 68 20 69 e symbol which i
d6a0: 73 20 74 68 65 20 6c 69 6e 65 20 6f 66 0a 09 23 s the line of..#
d6b0: 20 64 65 76 65 6c 6f 70 6d 65 6e 74 20 66 6f 72 development for
d6c0: 20 74 68 65 20 62 72 61 6e 63 68 65 73 20 69 6e the branches in
d6d0: 20 61 20 63 68 61 6e 67 65 73 65 74 2e 0a 0a 09 a changeset....
d6e0: 73 65 74 20 74 68 65 73 65 74 20 28 27 5b 6a 6f set theset ('[jo
d6f0: 69 6e 20 24 62 72 61 6e 63 68 65 73 20 7b 27 2c in $branches {',
d700: 27 7d 5d 27 29 0a 09 72 65 74 75 72 6e 20 5b 73 '}]')..return [s
d710: 74 61 74 65 20 72 75 6e 20 5b 73 75 62 73 74 20 tate run [subst
d720: 2d 6e 6f 63 6f 6d 6d 61 6e 64 73 20 2d 6e 6f 62 -nocommands -nob
d730: 61 63 6b 73 6c 61 73 68 65 73 20 7b 0a 09 20 20 ackslashes {..
d740: 20 20 53 45 4c 45 43 54 0a 09 20 20 20 20 44 49 SELECT.. DI
d750: 53 54 49 4e 43 54 20 4c 2e 6e 61 6d 65 0a 09 20 STINCT L.name..
d760: 20 20 20 46 52 4f 4d 20 20 20 62 72 61 6e 63 68 FROM branch
d770: 20 42 2c 20 73 79 6d 62 6f 6c 20 4c 0a 09 20 20 B, symbol L..
d780: 20 20 57 48 45 52 45 20 20 42 2e 62 69 64 20 69 WHERE B.bid i
d790: 6e 20 24 74 68 65 73 65 74 20 20 20 20 20 20 20 n $theset
d7a0: 20 2d 2d 20 52 65 73 74 72 69 63 74 20 74 6f 20 -- Restrict to
d7b0: 62 72 61 6e 63 68 65 73 20 6f 66 20 69 6e 74 65 branches of inte
d7c0: 72 65 73 74 0a 09 20 20 20 20 41 4e 44 20 20 20 rest.. AND
d7d0: 20 4c 2e 73 69 64 20 3d 20 42 2e 6c 6f 64 20 20 L.sid = B.lod
d7e0: 20 20 20 20 20 20 20 20 20 2d 2d 20 47 65 74 20 -- Get
d7f0: 6c 6f 64 20 73 79 6d 62 6f 6c 20 6f 66 20 62 72 lod symbol of br
d800: 61 6e 63 68 0a 09 7d 5d 5d 0a 20 20 20 20 7d 0a anch..}]]. }.
d810: 0a 20 20 20 20 74 79 70 65 6d 65 74 68 6f 64 20 . typemethod
d820: 6c 69 6d 69 74 73 20 7b 62 72 61 6e 63 68 65 73 limits {branches
d830: 7d 20 7b 0a 09 23 20 4e 6f 74 65 73 2e 20 54 68 } {..# Notes. Th
d840: 69 73 20 6d 65 74 68 6f 64 20 65 78 69 73 74 73 is method exists
d850: 20 6f 6e 6c 79 20 66 6f 72 20 62 72 61 6e 63 68 only for branch
d860: 65 73 2e 20 49 74 20 69 73 20 6e 65 65 64 65 64 es. It is needed
d870: 20 74 6f 0a 09 23 20 67 65 74 20 64 65 74 61 69 to..# get detai
d880: 6c 65 64 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 led information
d890: 61 62 6f 75 74 20 61 20 62 61 63 6b 77 61 72 64 about a backward
d8a0: 20 62 72 61 6e 63 68 2e 20 49 74 20 64 6f 65 73 branch. It does
d8b0: 0a 09 23 20 6e 6f 74 20 61 70 70 6c 79 20 74 6f ..# not apply to
d8c0: 20 74 61 67 73 2c 20 6e 6f 72 20 72 65 76 69 73 tags, nor revis
d8d0: 69 6f 6e 73 2e 20 54 68 65 20 71 75 65 72 69 65 ions. The querie
d8e0: 73 20 63 61 6e 20 61 6c 73 6f 0a 09 23 20 72 65 s can also..# re
d8f0: 73 74 72 69 63 74 20 74 68 65 6d 73 65 6c 76 65 strict themselve
d900: 73 20 74 6f 20 74 68 65 20 72 65 76 69 73 69 6f s to the revisio
d910: 6e 20 73 75 63 65 73 73 6f 72 73 2f 70 72 65 64 n sucessors/pred
d920: 65 63 65 73 73 6f 72 73 0a 09 23 20 6f 66 20 62 ecessors..# of b
d930: 72 61 6e 63 68 65 73 2c 20 61 73 20 6f 6e 6c 79 ranches, as only
d940: 20 74 68 65 79 20 68 61 76 65 20 6f 72 64 65 72 they have order
d950: 69 6e 67 20 64 61 74 61 20 61 6e 64 20 74 68 75 ing data and thu
d960: 73 20 63 61 6e 0a 09 23 20 63 61 75 73 65 20 74 s can..# cause t
d970: 68 65 20 62 61 63 6b 77 61 72 64 6e 65 73 73 2e he backwardness.
d980: 0a 0a 09 73 65 74 20 74 68 65 73 65 74 20 28 27 ...set theset ('
d990: 5b 6a 6f 69 6e 20 24 62 72 61 6e 63 68 65 73 20 [join $branches
d9a0: 7b 27 2c 27 7d 5d 27 29 0a 0a 09 73 65 74 20 6d {','}]')...set m
d9b0: 61 78 70 20 5b 73 74 61 74 65 20 72 75 6e 20 5b axp [state run [
d9c0: 73 75 62 73 74 20 2d 6e 6f 63 6f 6d 6d 61 6e 64 subst -nocommand
d9d0: 73 20 2d 6e 6f 62 61 63 6b 73 6c 61 73 68 65 73 s -nobackslashes
d9e0: 20 7b 0a 09 20 20 20 20 2d 2d 20 6d 61 78 69 6d {.. -- maxim
d9f0: 61 6c 20 70 72 65 64 65 63 65 73 73 6f 72 20 70 al predecessor p
da00: 6f 73 69 74 69 6f 6e 20 70 65 72 20 62 72 61 6e osition per bran
da10: 63 68 0a 09 20 20 20 20 53 45 4c 45 43 54 20 42 ch.. SELECT B
da20: 2e 62 69 64 2c 20 4d 41 58 20 28 43 4f 2e 70 6f .bid, MAX (CO.po
da30: 73 29 0a 09 20 20 20 20 46 52 4f 4d 20 20 20 62 s).. FROM b
da40: 72 61 6e 63 68 20 42 2c 20 72 65 76 69 73 69 6f ranch B, revisio
da50: 6e 20 52 2c 20 63 73 69 74 65 6d 20 43 49 2c 20 n R, csitem CI,
da60: 63 68 61 6e 67 65 73 65 74 20 43 2c 20 63 73 6f changeset C, cso
da70: 72 64 65 72 20 43 4f 0a 09 20 20 20 20 57 48 45 rder CO.. WHE
da80: 52 45 20 20 42 2e 62 69 64 20 49 4e 20 24 74 68 RE B.bid IN $th
da90: 65 73 65 74 20 20 20 20 20 2d 2d 20 52 65 73 74 eset -- Rest
daa0: 72 69 63 74 20 74 6f 20 62 72 61 6e 63 68 65 73 rict to branches
dab0: 20 6f 66 20 69 6e 74 65 72 65 73 74 0a 09 20 20 of interest..
dac0: 20 20 41 4e 44 20 20 20 20 42 2e 72 6f 6f 74 20 AND B.root
dad0: 3d 20 52 2e 72 69 64 20 20 20 20 20 20 20 2d 2d = R.rid --
dae0: 20 47 65 74 20 62 72 61 6e 63 68 20 72 6f 6f 74 Get branch root
daf0: 20 72 65 76 69 73 69 6f 6e 73 0a 09 20 20 20 20 revisions..
db00: 41 4e 44 20 20 20 20 43 49 2e 69 69 64 20 3d 20 AND CI.iid =
db10: 52 2e 72 69 64 20 20 20 20 20 20 20 2d 2d 20 47 R.rid -- G
db20: 65 74 20 63 68 61 6e 67 65 73 65 74 73 20 63 6f et changesets co
db30: 6e 74 61 69 6e 69 6e 67 20 74 68 65 0a 09 20 20 ntaining the..
db40: 20 20 41 4e 44 20 20 20 20 43 2e 63 69 64 20 3d AND C.cid =
db50: 20 43 49 2e 63 69 64 20 20 20 20 20 20 20 2d 2d CI.cid --
db60: 20 72 6f 6f 74 20 72 65 76 69 73 69 6f 6e 73 2c root revisions,
db70: 20 77 68 69 63 68 20 61 72 65 0a 09 20 20 20 20 which are..
db80: 41 4e 44 20 20 20 20 43 2e 74 79 70 65 20 3d 20 AND C.type =
db90: 30 20 20 20 20 20 20 20 20 20 20 20 2d 2d 20 72 0 -- r
dba0: 65 76 69 73 69 6f 6e 20 63 68 61 6e 67 65 73 65 evision changese
dbb0: 74 73 0a 09 20 20 20 20 41 4e 44 20 20 20 20 43 ts.. AND C
dbc0: 4f 2e 63 69 64 20 3d 20 43 2e 63 69 64 20 20 20 O.cid = C.cid
dbd0: 20 20 20 20 2d 2d 20 47 65 74 20 74 68 65 69 72 -- Get their
dbe0: 20 74 6f 70 6f 6c 6f 67 69 63 61 6c 20 6f 72 64 topological ord
dbf0: 65 72 69 6e 67 0a 09 20 20 20 20 47 52 4f 55 50 ering.. GROUP
dc00: 20 42 59 20 42 2e 62 69 64 0a 09 7d 5d 5d 0a 0a BY B.bid..}]]..
dc10: 09 73 65 74 20 6d 69 6e 73 20 5b 73 74 61 74 65 .set mins [state
dc20: 20 72 75 6e 20 5b 73 75 62 73 74 20 2d 6e 6f 63 run [subst -noc
dc30: 6f 6d 6d 61 6e 64 73 20 2d 6e 6f 62 61 63 6b 73 ommands -nobacks
dc40: 6c 61 73 68 65 73 20 7b 0a 09 20 20 20 20 2d 2d lashes {.. --
dc50: 20 6d 69 6e 69 6d 61 6c 20 73 75 63 63 65 73 73 minimal success
dc60: 6f 72 20 70 6f 73 69 74 69 6f 6e 20 70 65 72 20 or position per
dc70: 62 72 61 6e 63 68 0a 09 20 20 20 20 53 45 4c 45 branch.. SELE
dc80: 43 54 20 42 2e 62 69 64 2c 20 4d 49 4e 20 28 43 CT B.bid, MIN (C
dc90: 4f 2e 70 6f 73 29 0a 09 20 20 20 20 46 52 4f 4d O.pos).. FROM
dca0: 20 20 20 62 72 61 6e 63 68 20 42 2c 20 72 65 76 branch B, rev
dcb0: 69 73 69 6f 6e 20 52 2c 20 63 73 69 74 65 6d 20 ision R, csitem
dcc0: 43 49 2c 20 63 68 61 6e 67 65 73 65 74 20 43 2c CI, changeset C,
dcd0: 20 63 73 6f 72 64 65 72 20 43 4f 0a 09 20 20 20 csorder CO..
dce0: 20 57 48 45 52 45 20 20 42 2e 62 69 64 20 49 4e WHERE B.bid IN
dcf0: 20 24 74 68 65 73 65 74 20 20 20 20 20 2d 2d 20 $theset --
dd00: 52 65 73 74 72 69 63 74 20 74 6f 20 62 72 61 6e Restrict to bran
dd10: 63 68 65 73 20 6f 66 20 69 6e 74 65 72 65 73 74 ches of interest
dd20: 0a 09 20 20 20 20 41 4e 44 20 20 20 20 42 2e 66 .. AND B.f
dd30: 69 72 73 74 20 3d 20 52 2e 72 69 64 20 20 20 20 irst = R.rid
dd40: 20 20 2d 2d 20 47 65 74 20 74 68 65 20 66 69 72 -- Get the fir
dd50: 73 74 20 72 65 76 69 73 69 6f 6e 73 20 6f 6e 20 st revisions on
dd60: 74 68 65 20 62 72 61 6e 63 68 65 73 0a 09 20 20 the branches..
dd70: 20 20 41 4e 44 20 20 20 20 43 49 2e 69 69 64 20 AND CI.iid
dd80: 3d 20 52 2e 72 69 64 20 20 20 20 20 20 20 2d 2d = R.rid --
dd90: 20 47 65 74 20 63 68 61 6e 67 65 73 65 74 73 20 Get changesets
dda0: 63 6f 6e 74 61 69 6e 69 6e 67 20 74 68 65 0a 09 containing the..
ddb0: 20 20 20 20 41 4e 44 20 20 20 20 43 2e 63 69 64 AND C.cid
ddc0: 20 3d 20 43 49 2e 63 69 64 09 2d 2d 20 66 69 72 = CI.cid.-- fir
ddd0: 73 74 20 72 65 76 69 73 69 6f 6e 73 2c 20 77 68 st revisions, wh
dde0: 69 63 68 20 61 72 65 0a 09 20 20 20 20 41 4e 44 ich are.. AND
ddf0: 20 20 20 20 43 2e 74 79 70 65 20 3d 20 30 09 09 C.type = 0..
de00: 2d 2d 20 72 65 76 69 73 69 6f 6e 20 63 68 61 6e -- revision chan
de10: 67 65 73 65 74 73 0a 09 20 20 20 20 41 4e 44 20 gesets.. AND
de20: 20 20 20 43 4f 2e 63 69 64 20 3d 20 43 2e 63 69 CO.cid = C.ci
de30: 64 09 2d 2d 20 47 65 74 20 74 68 65 69 72 20 74 d.-- Get their t
de40: 6f 70 6f 6c 6f 67 69 63 61 6c 20 6f 72 64 65 72 opological order
de50: 69 6e 67 0a 09 20 20 20 20 47 52 4f 55 50 20 42 ing.. GROUP B
de60: 59 20 42 2e 62 69 64 0a 09 7d 5d 5d 0a 0a 20 20 Y B.bid..}]]..
de70: 20 20 20 20 20 20 72 65 74 75 72 6e 20 5b 6c 69 return [li
de80: 73 74 20 24 6d 61 78 70 20 24 6d 69 6e 73 5d 0a st $maxp $mins].
de90: 20 20 20 20 7d 0a 0a 20 20 20 20 23 20 23 20 23 }.. # # #
dea0: 23 20 23 23 23 20 23 23 23 23 23 20 23 23 23 23 # ### ##### ####
deb0: 23 23 23 23 20 23 23 23 23 23 23 23 23 23 23 23 #### ###########
dec0: 23 23 0a 20 20 20 20 23 23 20 43 6f 6e 66 69 67 ##. ## Config
ded0: 75 72 61 74 69 6f 6e 0a 0a 20 20 20 20 70 72 61 uration.. pra
dee0: 67 6d 61 20 2d 68 61 73 69 6e 73 74 61 6e 63 65 gma -hasinstance
def0: 73 20 20 20 6e 6f 20 3b 20 23 20 73 69 6e 67 6c s no ; # singl
df00: 65 74 6f 6e 0a 20 20 20 20 70 72 61 67 6d 61 20 eton. pragma
df10: 2d 68 61 73 74 79 70 65 69 6e 66 6f 20 20 20 20 -hastypeinfo
df20: 6e 6f 20 3b 20 23 20 6e 6f 20 69 6e 74 72 6f 73 no ; # no intros
df30: 70 65 63 74 69 6f 6e 0a 20 20 20 20 70 72 61 67 pection. prag
df40: 6d 61 20 2d 68 61 73 74 79 70 65 64 65 73 74 72 ma -hastypedestr
df50: 6f 79 20 6e 6f 20 3b 20 23 20 69 6d 6d 6f 72 74 oy no ; # immort
df60: 61 6c 0a 7d 0a 0a 23 20 23 20 23 23 20 23 23 23 al.}..# # ## ###
df70: 20 23 23 23 23 23 20 23 23 23 23 23 23 23 23 20 ##### ########
df80: 23 23 23 23 23 23 23 23 23 23 23 23 23 20 23 23 ############# ##
df90: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
dfa0: 23 23 23 0a 23 23 0a 0a 6e 61 6d 65 73 70 61 63 ###.##..namespac
dfb0: 65 20 65 76 61 6c 20 3a 3a 76 63 3a 3a 66 6f 73 e eval ::vc::fos
dfc0: 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 sil::import::cvs
dfd0: 3a 3a 70 72 6f 6a 65 63 74 20 7b 0a 20 20 20 20 ::project {.
dfe0: 6e 61 6d 65 73 70 61 63 65 20 65 78 70 6f 72 74 namespace export
dff0: 20 72 65 76 0a 20 20 20 20 6e 61 6d 65 73 70 61 rev. namespa
e000: 63 65 20 65 76 61 6c 20 72 65 76 20 7b 0a 09 6e ce eval rev {..n
e010: 61 6d 65 73 70 61 63 65 20 69 6d 70 6f 72 74 20 amespace import
e020: 3a 3a 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d ::vc::fossil::im
e030: 70 6f 72 74 3a 3a 63 76 73 3a 3a 73 74 61 74 65 port::cvs::state
e040: 0a 09 6e 61 6d 65 73 70 61 63 65 20 69 6d 70 6f ..namespace impo
e050: 72 74 20 3a 3a 76 63 3a 3a 66 6f 73 73 69 6c 3a rt ::vc::fossil:
e060: 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 69 6e :import::cvs::in
e070: 74 65 67 72 69 74 79 0a 09 6e 61 6d 65 73 70 61 tegrity..namespa
e080: 63 65 20 69 6d 70 6f 72 74 20 3a 3a 76 63 3a 3a ce import ::vc::
e090: 74 6f 6f 6c 73 3a 3a 6d 69 73 63 3a 3a 2a 0a 09 tools::misc::*..
e0a0: 6e 61 6d 65 73 70 61 63 65 20 69 6d 70 6f 72 74 namespace import
e0b0: 20 3a 3a 76 63 3a 3a 74 6f 6f 6c 73 3a 3a 74 72 ::vc::tools::tr
e0c0: 6f 75 62 6c 65 0a 09 6e 61 6d 65 73 70 61 63 65 ouble..namespace
e0d0: 20 69 6d 70 6f 72 74 20 3a 3a 76 63 3a 3a 74 6f import ::vc::to
e0e0: 6f 6c 73 3a 3a 6c 6f 67 0a 09 6c 6f 67 20 72 65 ols::log..log re
e0f0: 67 69 73 74 65 72 20 63 73 65 74 73 0a 0a 09 23 gister csets...#
e100: 20 53 65 74 20 75 70 20 74 68 65 20 68 65 6c 70 Set up the help
e110: 65 72 20 73 69 6e 67 6c 65 74 6f 6e 73 0a 09 6e er singletons..n
e120: 61 6d 65 73 70 61 63 65 20 65 76 61 6c 20 72 65 amespace eval re
e130: 76 20 7b 0a 09 20 20 20 20 6e 61 6d 65 73 70 61 v {.. namespa
e140: 63 65 20 69 6d 70 6f 72 74 20 3a 3a 76 63 3a 3a ce import ::vc::
e150: 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a fossil::import::
e160: 63 76 73 3a 3a 73 74 61 74 65 0a 09 20 20 20 20 cvs::state..
e170: 6e 61 6d 65 73 70 61 63 65 20 69 6d 70 6f 72 74 namespace import
e180: 20 3a 3a 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 ::vc::fossil::i
e190: 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 69 6e 74 65 mport::cvs::inte
e1a0: 67 72 69 74 79 0a 09 20 20 20 20 6e 61 6d 65 73 grity.. names
e1b0: 70 61 63 65 20 69 6d 70 6f 72 74 20 3a 3a 76 63 pace import ::vc
e1c0: 3a 3a 74 6f 6f 6c 73 3a 3a 6c 6f 67 0a 09 7d 0a ::tools::log..}.
e1d0: 09 6e 61 6d 65 73 70 61 63 65 20 65 76 61 6c 20 .namespace eval
e1e0: 73 79 6d 3a 3a 74 61 67 20 7b 0a 09 20 20 20 20 sym::tag {..
e1f0: 6e 61 6d 65 73 70 61 63 65 20 69 6d 70 6f 72 74 namespace import
e200: 20 3a 3a 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 ::vc::fossil::i
e210: 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 73 74 61 74 mport::cvs::stat
e220: 65 0a 09 20 20 20 20 6e 61 6d 65 73 70 61 63 65 e.. namespace
e230: 20 69 6d 70 6f 72 74 20 3a 3a 76 63 3a 3a 66 6f import ::vc::fo
e240: 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 ssil::import::cv
e250: 73 3a 3a 69 6e 74 65 67 72 69 74 79 0a 09 20 20 s::integrity..
e260: 20 20 6e 61 6d 65 73 70 61 63 65 20 69 6d 70 6f namespace impo
e270: 72 74 20 3a 3a 76 63 3a 3a 74 6f 6f 6c 73 3a 3a rt ::vc::tools::
e280: 6c 6f 67 0a 09 7d 0a 09 6e 61 6d 65 73 70 61 63 log..}..namespac
e290: 65 20 65 76 61 6c 20 73 79 6d 3a 3a 62 72 61 6e e eval sym::bran
e2a0: 63 68 20 7b 0a 09 20 20 20 20 6e 61 6d 65 73 70 ch {.. namesp
e2b0: 61 63 65 20 69 6d 70 6f 72 74 20 3a 3a 76 63 3a ace import ::vc:
e2c0: 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a :fossil::import:
e2d0: 3a 63 76 73 3a 3a 73 74 61 74 65 0a 09 20 20 20 :cvs::state..
e2e0: 20 6e 61 6d 65 73 70 61 63 65 20 69 6d 70 6f 72 namespace impor
e2f0: 74 20 3a 3a 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a t ::vc::fossil::
e300: 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 69 6e 74 import::cvs::int
e310: 65 67 72 69 74 79 0a 09 20 20 20 20 6e 61 6d 65 egrity.. name
e320: 73 70 61 63 65 20 69 6d 70 6f 72 74 20 3a 3a 76 space import ::v
e330: 63 3a 3a 74 6f 6f 6c 73 3a 3a 6c 6f 67 0a 09 7d c::tools::log..}
e340: 0a 20 20 20 20 7d 0a 7d 0a 0a 23 20 23 20 23 23 . }.}..# # ##
e350: 20 23 23 23 20 23 23 23 23 23 20 23 23 23 23 23 ### ##### #####
e360: 23 23 23 20 23 23 23 23 23 23 23 23 23 23 23 23 ### ############
e370: 23 20 23 23 23 23 23 23 23 23 23 23 23 23 23 23 # ##############
e380: 23 23 23 23 23 23 23 0a 23 23 20 52 65 61 64 79 #######.## Ready
e390: 0a 0a 70 61 63 6b 61 67 65 20 70 72 6f 76 69 64 ..package provid
e3a0: 65 20 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d e vc::fossil::im
e3b0: 70 6f 72 74 3a 3a 63 76 73 3a 3a 70 72 6f 6a 65 port::cvs::proje
e3c0: 63 74 3a 3a 72 65 76 20 31 2e 30 0a 72 65 74 75 ct::rev 1.0.retu
e3d0: 72 6e 0a rn.