0000: 23 23 20 2d 2a 2d 20 74 63 6c 20 2d 2a 2d 0a 23 ## -*- tcl -*-.#
0010: 20 23 20 23 23 20 23 23 23 20 23 23 23 23 23 20 # ## ### #####
0020: 23 23 23 23 23 23 23 23 20 23 23 23 23 23 23 23 ######## #######
0030: 23 23 23 23 23 23 20 23 23 23 23 23 23 23 23 23 ###### #########
0040: 23 23 23 23 23 23 23 23 23 23 23 23 0a 23 23 20 ############.##
0050: 43 6f 70 79 72 69 67 68 74 20 28 63 29 20 32 30 Copyright (c) 20
0060: 30 37 20 41 6e 64 72 65 61 73 20 4b 75 70 72 69 07 Andreas Kupri
0070: 65 73 2e 0a 23 0a 23 20 54 68 69 73 20 73 6f 66 es..#.# This sof
0080: 74 77 61 72 65 20 69 73 20 6c 69 63 65 6e 73 65 tware is license
0090: 64 20 61 73 20 64 65 73 63 72 69 62 65 64 20 69 d as described i
00a0: 6e 20 74 68 65 20 66 69 6c 65 20 4c 49 43 45 4e n the file LICEN
00b0: 53 45 2c 20 77 68 69 63 68 0a 23 20 79 6f 75 20 SE, which.# you
00c0: 73 68 6f 75 6c 64 20 68 61 76 65 20 72 65 63 65 should have rece
00d0: 69 76 65 64 20 61 73 20 70 61 72 74 20 6f 66 20 ived as part of
00e0: 74 68 69 73 20 64 69 73 74 72 69 62 75 74 69 6f this distributio
00f0: 6e 2e 0a 23 0a 23 20 54 68 69 73 20 73 6f 66 74 n..#.# This soft
0100: 77 61 72 65 20 63 6f 6e 73 69 73 74 73 20 6f 66 ware consists of
0110: 20 76 6f 6c 75 6e 74 61 72 79 20 63 6f 6e 74 72 voluntary contr
0120: 69 62 75 74 69 6f 6e 73 20 6d 61 64 65 20 62 79 ibutions made by
0130: 20 6d 61 6e 79 0a 23 20 69 6e 64 69 76 69 64 75 many.# individu
0140: 61 6c 73 2e 20 20 46 6f 72 20 65 78 61 63 74 20 als. For exact
0150: 63 6f 6e 74 72 69 62 75 74 69 6f 6e 20 68 69 73 contribution his
0160: 74 6f 72 79 2c 20 73 65 65 20 74 68 65 20 72 65 tory, see the re
0170: 76 69 73 69 6f 6e 0a 23 20 68 69 73 74 6f 72 79 vision.# history
0180: 20 61 6e 64 20 6c 6f 67 73 2c 20 61 76 61 69 6c and logs, avail
0190: 61 62 6c 65 20 61 74 20 68 74 74 70 3a 2f 2f 66 able at http://f
01a0: 6f 73 73 69 6c 2d 73 63 6d 2e 68 77 61 63 69 2e ossil-scm.hwaci.
01b0: 63 6f 6d 2f 66 6f 73 73 69 6c 0a 23 20 23 20 23 com/fossil.# # #
01c0: 23 20 23 23 23 20 23 23 23 23 23 20 23 23 23 23 # ### ##### ####
01d0: 23 23 23 23 20 23 23 23 23 23 23 23 23 23 23 23 #### ###########
01e0: 23 23 20 23 23 23 23 23 23 23 23 23 23 23 23 23 ## #############
01f0: 23 23 23 23 23 23 23 23 0a 0a 23 23 20 52 65 76 ########..## Rev
0200: 69 73 69 6f 6e 73 20 70 65 72 20 70 72 6f 6a 65 isions per proje
0210: 63 74 2c 20 61 6b 61 20 43 68 61 6e 67 65 73 65 ct, aka Changese
0220: 74 73 2e 20 54 68 65 73 65 20 6f 62 6a 65 63 74 ts. These object
0230: 73 20 61 72 65 20 66 69 72 73 74 20 75 73 65 64 s are first used
0240: 0a 23 23 20 69 6e 20 70 61 73 73 20 35 2c 20 77 .## in pass 5, w
0250: 68 69 63 68 20 63 72 65 61 74 65 73 20 74 68 65 hich creates the
0260: 20 69 6e 69 74 69 61 6c 20 73 65 74 20 63 6f 76 initial set cov
0270: 65 72 69 6e 67 20 74 68 65 20 72 65 70 6f 73 69 ering the reposi
0280: 74 6f 72 79 2e 0a 0a 23 20 23 20 23 23 20 23 23 tory...# # ## ##
0290: 23 20 23 23 23 23 23 20 23 23 23 23 23 23 23 23 # ##### ########
02a0: 20 23 23 23 23 23 23 23 23 23 23 23 23 23 20 23 ############# #
02b0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
02c0: 23 23 23 23 0a 23 23 20 52 65 71 75 69 72 65 6d ####.## Requirem
02d0: 65 6e 74 73 0a 0a 70 61 63 6b 61 67 65 20 72 65 ents..package re
02e0: 71 75 69 72 65 20 54 63 6c 20 38 2e 34 20 20 20 quire Tcl 8.4
02f0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0300: 20 20 20 20 20 20 20 20 20 20 20 20 3b 20 23 20 ; #
0310: 52 65 71 75 69 72 65 64 20 72 75 6e 74 69 6d 65 Required runtime
0320: 2e 0a 70 61 63 6b 61 67 65 20 72 65 71 75 69 72 ..package requir
0330: 65 20 73 6e 69 74 20 20 20 20 20 20 20 20 20 20 e 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 3b 20 23 20 4f 4f 20 73 ; # OO s
0360: 79 73 74 65 6d 2e 0a 70 61 63 6b 61 67 65 20 72 ystem..package r
0370: 65 71 75 69 72 65 20 73 74 72 75 63 74 3a 3a 73 equire struct::s
0380: 65 74 20 20 20 20 20 20 20 20 20 20 20 20 20 20 et
0390: 20 20 20 20 20 20 20 20 20 20 20 20 20 3b 20 23 ; #
03a0: 20 53 65 74 20 6f 70 65 72 61 74 69 6f 6e 73 2e Set operations.
03b0: 0a 70 61 63 6b 61 67 65 20 72 65 71 75 69 72 65 .package require
03c0: 20 76 63 3a 3a 74 6f 6f 6c 73 3a 3a 6d 69 73 63 vc::tools::misc
03d0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
03e0: 20 20 20 20 20 20 20 3b 20 23 20 54 65 78 74 20 ; # Text
03f0: 66 6f 72 6d 61 74 74 69 6e 67 0a 70 61 63 6b 61 formatting.packa
0400: 67 65 20 72 65 71 75 69 72 65 20 76 63 3a 3a 74 ge require vc::t
0410: 6f 6f 6c 73 3a 3a 74 72 6f 75 62 6c 65 20 20 20 ools::trouble
0420: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0430: 20 3b 20 23 20 45 72 72 6f 72 20 72 65 70 6f 72 ; # Error repor
0440: 74 69 6e 67 2e 0a 70 61 63 6b 61 67 65 20 72 65 ting..package re
0450: 71 75 69 72 65 20 76 63 3a 3a 74 6f 6f 6c 73 3a quire vc::tools:
0460: 3a 6c 6f 67 20 20 20 20 20 20 20 20 20 20 20 20 :log
0470: 20 20 20 20 20 20 20 20 20 20 20 20 3b 20 23 20 ; #
0480: 55 73 65 72 20 66 65 65 64 62 61 63 6b 2e 0a 70 User feedback..p
0490: 61 63 6b 61 67 65 20 72 65 71 75 69 72 65 20 76 ackage require v
04a0: 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 c::fossil::impor
04b0: 74 3a 3a 63 76 73 3a 3a 73 74 61 74 65 20 20 20 t::cvs::state
04c0: 20 20 20 20 20 3b 20 23 20 53 74 61 74 65 20 73 ; # State s
04d0: 74 6f 72 61 67 65 2e 0a 70 61 63 6b 61 67 65 20 torage..package
04e0: 72 65 71 75 69 72 65 20 76 63 3a 3a 66 6f 73 73 require vc::foss
04f0: 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a il::import::cvs:
0500: 3a 69 6e 74 65 67 72 69 74 79 20 20 20 20 3b 20 :integrity ;
0510: 23 20 53 74 61 74 65 20 69 6e 74 65 67 72 69 74 # State integrit
0520: 79 20 63 68 65 63 6b 73 2e 0a 0a 23 20 23 20 23 y checks...# # #
0530: 23 20 23 23 23 20 23 23 23 23 23 20 23 23 23 23 # ### ##### ####
0540: 23 23 23 23 20 23 23 23 23 23 23 23 23 23 23 23 #### ###########
0550: 23 23 20 23 23 23 23 23 23 23 23 23 23 23 23 23 ## #############
0560: 23 23 23 23 23 23 23 23 0a 23 23 0a 0a 73 6e 69 ########.##..sni
0570: 74 3a 3a 74 79 70 65 20 3a 3a 76 63 3a 3a 66 6f t::type ::vc::fo
0580: 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 ssil::import::cv
0590: 73 3a 3a 70 72 6f 6a 65 63 74 3a 3a 72 65 76 20 s::project::rev
05a0: 7b 0a 20 20 20 20 23 20 23 20 23 23 20 23 23 23 {. # # ## ###
05b0: 20 23 23 23 23 23 20 23 23 23 23 23 23 23 23 20 ##### ########
05c0: 23 23 23 23 23 23 23 23 23 23 23 23 23 0a 20 20 #############.
05d0: 20 20 23 23 20 50 75 62 6c 69 63 20 41 50 49 0a ## Public API.
05e0: 0a 20 20 20 20 63 6f 6e 73 74 72 75 63 74 6f 72 . constructor
05f0: 20 7b 70 72 6f 6a 65 63 74 20 63 73 74 79 70 65 {project cstype
0600: 20 73 72 63 69 64 20 69 74 65 6d 73 20 7b 74 68 srcid items {th
0610: 65 69 64 20 7b 7d 7d 7d 20 7b 0a 09 69 66 20 7b eid {}}} {..if {
0620: 24 74 68 65 69 64 20 6e 65 20 22 22 7d 20 7b 0a $theid ne ""} {.
0630: 09 20 20 20 20 73 65 74 20 6d 79 69 64 20 24 74 . set myid $t
0640: 68 65 69 64 0a 09 7d 20 65 6c 73 65 20 7b 0a 09 heid..} else {..
0650: 20 20 20 20 73 65 74 20 6d 79 69 64 20 5b 69 6e set myid [in
0660: 63 72 20 6d 79 63 6f 75 6e 74 65 72 5d 0a 09 7d cr mycounter]..}
0670: 0a 0a 09 69 6e 74 65 67 72 69 74 79 20 61 73 73 ...integrity ass
0680: 65 72 74 20 7b 0a 09 20 20 20 20 5b 69 6e 66 6f ert {.. [info
0690: 20 65 78 69 73 74 73 20 6d 79 63 73 74 79 70 65 exists mycstype
06a0: 28 24 63 73 74 79 70 65 29 5d 0a 09 7d 20 7b 42 ($cstype)]..} {B
06b0: 61 64 20 63 68 61 6e 67 65 73 65 74 20 74 79 70 ad changeset typ
06c0: 65 20 27 24 63 73 74 79 70 65 27 2e 7d 0a 0a 09 e '$cstype'.}...
06d0: 73 65 74 20 6d 79 70 72 6f 6a 65 63 74 20 20 20 set myproject
06e0: 24 70 72 6f 6a 65 63 74 0a 09 73 65 74 20 6d 79 $project..set my
06f0: 74 79 70 65 20 20 20 20 20 20 24 63 73 74 79 70 type $cstyp
0700: 65 0a 09 73 65 74 20 6d 79 74 79 70 65 6f 62 6a e..set mytypeobj
0710: 20 20 20 3a 3a 76 63 3a 3a 66 6f 73 73 69 6c 3a ::vc::fossil:
0720: 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 70 72 :import::cvs::pr
0730: 6f 6a 65 63 74 3a 3a 72 65 76 3a 3a 24 7b 63 73 oject::rev::${cs
0740: 74 79 70 65 7d 0a 09 73 65 74 20 6d 79 73 72 63 type}..set mysrc
0750: 69 64 09 24 73 72 63 69 64 0a 09 73 65 74 20 6d id.$srcid..set m
0760: 79 69 74 65 6d 73 20 20 20 20 20 24 69 74 65 6d yitems $item
0770: 73 0a 09 73 65 74 20 6d 79 70 6f 73 20 20 20 20 s..set mypos
0780: 20 20 20 7b 7d 20 3b 20 23 20 43 6f 6d 6d 69 74 {} ; # Commit
0790: 20 6c 6f 63 61 74 69 6f 6e 20 69 73 20 6e 6f 74 location is not
07a0: 20 6b 6e 6f 77 6e 20 79 65 74 2e 0a 0a 09 23 20 known yet....#
07b0: 4b 65 65 70 20 74 72 61 63 6b 20 6f 66 20 74 68 Keep track of th
07c0: 65 20 67 65 6e 65 72 61 74 65 64 20 63 68 61 6e e generated chan
07d0: 67 65 73 65 74 73 20 61 6e 64 20 6f 66 20 74 68 gesets and of th
07e0: 65 20 69 6e 76 65 72 73 65 0a 09 23 20 6d 61 70 e inverse..# map
07f0: 70 69 6e 67 20 66 72 6f 6d 20 69 74 65 6d 73 20 ping from items
0800: 74 6f 20 74 68 65 6d 2e 0a 09 6c 61 70 70 65 6e to them...lappen
0810: 64 20 6d 79 63 68 61 6e 67 65 73 65 74 73 20 20 d mychangesets
0820: 20 24 73 65 6c 66 0a 09 6c 61 70 70 65 6e 64 20 $self..lappend
0830: 6d 79 74 63 68 61 6e 67 65 73 65 74 73 28 24 63 mytchangesets($c
0840: 73 74 79 70 65 29 20 24 73 65 6c 66 0a 09 73 65 stype) $self..se
0850: 74 20 20 20 20 20 6d 79 69 64 6d 61 70 28 24 6d t myidmap($m
0860: 79 69 64 29 20 24 73 65 6c 66 0a 09 66 6f 72 65 yid) $self..fore
0870: 61 63 68 20 69 69 64 20 24 69 74 65 6d 73 20 7b ach iid $items {
0880: 0a 09 20 20 20 20 73 65 74 20 6b 65 79 20 5b 6c .. set key [l
0890: 69 73 74 20 24 63 73 74 79 70 65 20 24 69 69 64 ist $cstype $iid
08a0: 5d 0a 09 20 20 20 20 73 65 74 20 6d 79 69 74 65 ].. set myite
08b0: 6d 6d 61 70 28 24 6b 65 79 29 20 24 73 65 6c 66 mmap($key) $self
08c0: 0a 09 20 20 20 20 6c 61 70 70 65 6e 64 20 6d 79 .. lappend my
08d0: 74 69 74 65 6d 73 20 24 6b 65 79 0a 09 20 20 20 titems $key..
08e0: 20 6c 6f 67 20 77 72 69 74 65 20 38 20 63 73 65 log write 8 cse
08f0: 74 73 20 7b 4d 41 50 2b 20 69 74 65 6d 20 3c 24 ts {MAP+ item <$
0900: 6b 65 79 3e 20 24 73 65 6c 66 20 3d 20 5b 24 73 key> $self = [$s
0910: 65 6c 66 20 73 74 72 5d 7d 0a 09 7d 0a 09 72 65 elf str]}..}..re
0920: 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 turn. }..
0930: 6d 65 74 68 6f 64 20 73 74 72 20 7b 7d 20 7b 0a method str {} {.
0940: 09 73 65 74 20 73 74 72 20 20 20 20 22 3c 22 0a .set str "<".
0950: 09 73 65 74 20 64 65 74 61 69 6c 20 22 22 0a 09 .set detail ""..
0960: 69 66 20 7b 5b 24 6d 79 74 79 70 65 6f 62 6a 20 if {[$mytypeobj
0970: 62 79 73 79 6d 62 6f 6c 5d 7d 20 7b 0a 09 20 20 bysymbol]} {..
0980: 20 20 73 65 74 20 64 65 74 61 69 6c 20 22 20 27 set detail " '
0990: 5b 73 74 61 74 65 20 6f 6e 65 20 7b 0a 09 09 53 [state one {...S
09a0: 45 4c 45 43 54 20 53 2e 6e 61 6d 65 0a 09 09 46 ELECT S.name...F
09b0: 52 4f 4d 20 20 20 73 79 6d 62 6f 6c 20 53 0a 09 ROM symbol S..
09c0: 09 57 48 45 52 45 20 20 53 2e 73 69 64 20 3d 20 .WHERE S.sid =
09d0: 24 6d 79 73 72 63 69 64 0a 09 20 20 20 20 7d 5d $mysrcid.. }]
09e0: 27 22 0a 09 7d 0a 09 61 70 70 65 6e 64 20 73 74 '"..}..append st
09f0: 72 20 22 24 6d 79 74 79 70 65 20 24 7b 6d 79 69 r "$mytype ${myi
0a00: 64 7d 24 7b 64 65 74 61 69 6c 7d 3e 22 0a 09 72 d}${detail}>"..r
0a10: 65 74 75 72 6e 20 24 73 74 72 0a 20 20 20 20 7d eturn $str. }
0a20: 0a 0a 20 20 20 20 6d 65 74 68 6f 64 20 69 64 20 .. method id
0a30: 20 20 20 7b 7d 20 7b 20 72 65 74 75 72 6e 20 24 {} { return $
0a40: 6d 79 69 64 20 7d 0a 20 20 20 20 6d 65 74 68 6f myid }. metho
0a50: 64 20 69 74 65 6d 73 20 7b 7d 20 7b 20 72 65 74 d items {} { ret
0a60: 75 72 6e 20 24 6d 79 74 69 74 65 6d 73 20 7d 0a urn $mytitems }.
0a70: 20 20 20 20 6d 65 74 68 6f 64 20 64 61 74 61 20 method data
0a80: 20 7b 7d 20 7b 20 72 65 74 75 72 6e 20 5b 6c 69 {} { return [li
0a90: 73 74 20 24 6d 79 70 72 6f 6a 65 63 74 20 24 6d st $myproject $m
0aa0: 79 74 79 70 65 20 24 6d 79 73 72 63 69 64 5d 20 ytype $mysrcid]
0ab0: 7d 0a 0a 20 20 20 20 64 65 6c 65 67 61 74 65 20 }.. delegate
0ac0: 6d 65 74 68 6f 64 20 62 79 73 79 6d 62 6f 6c 20 method bysymbol
0ad0: 20 20 74 6f 20 6d 79 74 79 70 65 6f 62 6a 0a 20 to mytypeobj.
0ae0: 20 20 20 64 65 6c 65 67 61 74 65 20 6d 65 74 68 delegate meth
0af0: 6f 64 20 62 79 72 65 76 69 73 69 6f 6e 20 74 6f od byrevision to
0b00: 20 6d 79 74 79 70 65 6f 62 6a 0a 20 20 20 20 64 mytypeobj. d
0b10: 65 6c 65 67 61 74 65 20 6d 65 74 68 6f 64 20 69 elegate method i
0b20: 73 62 72 61 6e 63 68 20 20 20 74 6f 20 6d 79 74 sbranch to myt
0b30: 79 70 65 6f 62 6a 0a 20 20 20 20 64 65 6c 65 67 ypeobj. deleg
0b40: 61 74 65 20 6d 65 74 68 6f 64 20 69 73 74 61 67 ate method istag
0b50: 20 20 20 20 20 20 74 6f 20 6d 79 74 79 70 65 6f to mytypeo
0b60: 62 6a 0a 0a 20 20 20 20 6d 65 74 68 6f 64 20 73 bj.. method s
0b70: 65 74 70 6f 73 20 7b 70 7d 20 7b 20 73 65 74 20 etpos {p} { set
0b80: 6d 79 70 6f 73 20 24 70 20 3b 20 72 65 74 75 72 mypos $p ; retur
0b90: 6e 20 7d 0a 20 20 20 20 6d 65 74 68 6f 64 20 70 n }. method p
0ba0: 6f 73 20 20 20 20 7b 7d 20 20 7b 20 72 65 74 75 os {} { retu
0bb0: 72 6e 20 24 6d 79 70 6f 73 20 7d 0a 0a 20 20 20 rn $mypos }..
0bc0: 20 6d 65 74 68 6f 64 20 64 65 74 65 72 6d 69 6e method determin
0bd0: 65 73 75 63 63 65 73 73 6f 72 73 20 7b 7d 20 7b esuccessors {} {
0be0: 0a 09 23 20 50 61 73 73 20 36 20 6f 70 65 72 61 ..# Pass 6 opera
0bf0: 74 69 6f 6e 2e 20 43 6f 6d 70 75 74 65 20 70 72 tion. Compute pr
0c00: 6f 6a 65 63 74 2d 6c 65 76 65 6c 20 64 65 70 65 oject-level depe
0c10: 6e 64 65 6e 63 69 65 73 20 66 72 6f 6d 0a 09 23 ndencies from..#
0c20: 20 74 68 65 20 66 69 6c 65 2d 6c 65 76 65 6c 20 the file-level
0c30: 64 61 74 61 20 61 6e 64 20 73 61 76 65 20 69 74 data and save it
0c40: 20 62 61 63 6b 20 74 6f 20 74 68 65 20 73 74 61 back to the sta
0c50: 74 65 2e 20 54 68 69 73 20 6d 61 79 0a 09 23 20 te. This may..#
0c60: 62 65 20 63 61 6c 6c 65 64 20 64 75 72 69 6e 67 be called during
0c70: 20 74 68 65 20 63 79 63 6c 65 20 62 72 65 61 6b the cycle break
0c80: 65 72 20 70 61 73 73 65 73 20 61 73 20 77 65 6c er passes as wel
0c90: 6c 2c 20 74 6f 20 61 64 6a 75 73 74 0a 09 23 20 l, to adjust..#
0ca0: 74 68 65 20 73 75 63 63 65 73 73 6f 72 20 69 6e the successor in
0cb0: 66 6f 72 6d 61 74 69 6f 6e 20 6f 66 20 63 68 61 formation of cha
0cc0: 6e 67 65 73 65 74 73 20 77 68 69 63 68 20 61 72 ngesets which ar
0cd0: 65 20 74 68 65 0a 09 23 20 70 72 65 64 65 63 65 e the..# predece
0ce0: 73 73 6f 72 73 20 6f 66 20 64 72 6f 70 70 65 64 ssors of dropped
0cf0: 20 63 68 61 6e 67 65 73 65 74 73 2e 20 46 6f 72 changesets. For
0d00: 20 74 68 65 6d 20 77 65 20 68 61 76 65 20 74 6f them we have to
0d10: 0a 09 23 20 72 65 6d 6f 76 65 20 74 68 65 69 72 ..# remove their
0d20: 20 65 78 69 73 74 69 6e 67 20 69 6e 66 6f 72 6d existing inform
0d30: 61 74 69 6f 6e 20 66 69 72 73 74 20 62 65 66 6f ation first befo
0d40: 72 65 20 69 6e 73 65 72 74 69 6e 67 20 74 68 65 re inserting the
0d50: 0a 09 23 20 6e 65 77 20 64 61 74 61 2e 0a 09 73 ..# new data...s
0d60: 74 61 74 65 20 72 75 6e 20 7b 0a 09 20 20 20 20 tate run {..
0d70: 44 45 4c 45 54 45 20 46 52 4f 4d 20 63 73 73 75 DELETE FROM cssu
0d80: 63 63 65 73 73 6f 72 20 57 48 45 52 45 20 63 69 ccessor WHERE ci
0d90: 64 20 3d 20 24 6d 79 69 64 3b 0a 09 7d 0a 09 73 d = $myid;..}..s
0da0: 65 74 20 6c 6f 6f 70 20 30 0a 09 66 6f 72 65 61 et loop 0..forea
0db0: 63 68 20 6e 69 64 20 5b 24 6d 79 74 79 70 65 6f ch nid [$mytypeo
0dc0: 62 6a 20 63 73 5f 73 75 63 63 65 73 73 6f 72 73 bj cs_successors
0dd0: 20 24 6d 79 69 74 65 6d 73 5d 20 7b 0a 09 20 20 $myitems] {..
0de0: 20 20 73 74 61 74 65 20 72 75 6e 20 7b 0a 09 09 state run {...
0df0: 49 4e 53 45 52 54 20 49 4e 54 4f 20 63 73 73 75 INSERT INTO cssu
0e00: 63 63 65 73 73 6f 72 20 28 63 69 64 2c 20 20 6e ccessor (cid, n
0e10: 69 64 29 0a 09 09 56 41 4c 55 45 53 20 20 20 20 id)...VALUES
0e20: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 24 ($
0e30: 6d 79 69 64 2c 24 6e 69 64 29 0a 09 20 20 20 20 myid,$nid)..
0e40: 7d 0a 09 20 20 20 20 69 66 20 7b 24 6e 69 64 20 }.. if {$nid
0e50: 3d 3d 20 24 6d 79 69 64 7d 20 7b 20 73 65 74 20 == $myid} { set
0e60: 6c 6f 6f 70 20 31 20 7d 0a 09 7d 0a 09 23 20 52 loop 1 }..}..# R
0e70: 65 70 6f 72 74 20 61 66 74 65 72 20 74 68 65 20 eport after the
0e80: 63 6f 6d 70 6c 65 74 65 20 73 74 72 75 63 74 75 complete structu
0e90: 72 65 20 68 61 73 20 62 65 65 6e 20 73 61 76 65 re has been save
0ea0: 64 2e 0a 09 69 66 20 7b 24 6c 6f 6f 70 7d 20 7b d...if {$loop} {
0eb0: 20 24 73 65 6c 66 20 72 65 70 6f 72 74 6c 6f 6f $self reportloo
0ec0: 70 20 7d 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 p }..return.
0ed0: 7d 0a 0a 20 20 20 20 23 20 72 65 73 75 6c 74 20 }.. # result
0ee0: 3d 20 6c 69 73 74 20 28 63 68 61 6e 67 65 73 65 = list (changese
0ef0: 74 29 0a 20 20 20 20 6d 65 74 68 6f 64 20 73 75 t). method su
0f00: 63 63 65 73 73 6f 72 73 20 7b 7d 20 7b 0a 09 23 ccessors {} {..#
0f10: 20 55 73 65 20 74 68 65 20 64 61 74 61 20 73 61 Use the data sa
0f20: 76 65 64 20 62 79 20 70 61 73 73 20 36 2e 0a 09 ved by pass 6...
0f30: 72 65 74 75 72 6e 20 5b 73 74 72 75 63 74 3a 3a return [struct::
0f40: 6c 69 73 74 20 6d 61 70 20 5b 73 74 61 74 65 20 list map [state
0f50: 72 75 6e 20 7b 0a 09 20 20 20 20 53 45 4c 45 43 run {.. SELEC
0f60: 54 20 53 2e 6e 69 64 0a 09 20 20 20 20 46 52 4f T S.nid.. FRO
0f70: 4d 20 20 20 63 73 73 75 63 63 65 73 73 6f 72 20 M cssuccessor
0f80: 53 0a 09 20 20 20 20 57 48 45 52 45 20 20 53 2e S.. WHERE S.
0f90: 63 69 64 20 3d 20 24 6d 79 69 64 0a 09 7d 5d 20 cid = $myid..}]
0fa0: 5b 6d 79 74 79 70 65 6d 65 74 68 6f 64 20 6f 66 [mytypemethod of
0fb0: 5d 5d 0a 20 20 20 20 7d 0a 0a 20 20 20 20 23 20 ]]. }.. #
0fc0: 69 74 65 6d 20 2d 3e 20 6c 69 73 74 20 28 69 74 item -> list (it
0fd0: 65 6d 29 0a 20 20 20 20 6d 65 74 68 6f 64 20 6e em). method n
0fe0: 65 78 74 6d 61 70 20 7b 7d 20 7b 0a 09 24 6d 79 extmap {} {..$my
0ff0: 74 79 70 65 6f 62 6a 20 73 75 63 63 65 73 73 6f typeobj successo
1000: 72 73 20 74 6d 70 20 24 6d 79 69 74 65 6d 73 0a rs tmp $myitems.
1010: 09 72 65 74 75 72 6e 20 5b 61 72 72 61 79 20 67 .return [array g
1020: 65 74 20 74 6d 70 5d 0a 20 20 20 20 7d 0a 0a 20 et tmp]. }..
1030: 20 20 20 6d 65 74 68 6f 64 20 62 72 65 61 6b 69 method breaki
1040: 6e 74 65 72 6e 61 6c 64 65 70 65 6e 64 65 6e 63 nternaldependenc
1050: 69 65 73 20 7b 7d 20 7b 0a 0a 09 23 23 0a 09 23 ies {} {...##..#
1060: 23 20 4e 4f 54 45 3a 20 54 68 69 73 20 6d 65 74 # NOTE: This met
1070: 68 6f 64 2c 20 6d 61 79 62 65 20 69 6e 20 63 6f hod, maybe in co
1080: 6e 6a 75 6e 63 74 69 6f 6e 20 77 69 74 68 20 69 njunction with i
1090: 74 73 20 63 61 6c 6c 65 72 0a 09 23 23 20 20 20 ts caller..##
10a0: 20 20 20 20 73 65 65 6d 73 20 74 6f 20 62 65 20 seems to be
10b0: 61 20 6d 65 6d 6f 72 79 20 68 6f 67 2c 20 65 73 a memory hog, es
10c0: 70 65 63 69 61 6c 6c 79 20 66 6f 72 20 6c 61 72 pecially for lar
10d0: 67 65 0a 09 23 23 20 20 20 20 20 20 20 63 68 61 ge..## cha
10e0: 6e 67 65 73 65 74 73 2c 20 77 69 74 68 20 27 6c ngesets, with 'l
10f0: 61 72 67 65 27 20 6d 65 61 6e 69 6e 67 20 74 6f arge' meaning to
1100: 20 68 61 76 65 20 61 20 27 6c 6f 6e 67 20 6c 69 have a 'long li
1110: 73 74 0a 09 23 23 20 20 20 20 20 20 20 6f 66 20 st..## of
1120: 69 74 65 6d 73 2c 20 73 65 76 65 72 61 6c 20 74 items, several t
1130: 68 6f 75 73 61 6e 64 27 2e 20 49 6e 76 65 73 74 housand'. Invest
1140: 69 67 61 74 65 20 77 68 65 72 65 20 74 68 65 0a igate where the.
1150: 09 23 23 20 20 20 20 20 20 20 6d 65 6d 6f 72 79 .## memory
1160: 20 69 73 20 73 70 65 6e 74 20 61 6e 64 20 74 68 is spent and th
1170: 65 6e 20 6c 6f 6f 6b 20 66 6f 72 20 77 61 79 73 en look for ways
1180: 20 6f 66 20 72 65 63 74 69 66 79 69 6e 67 0a 09 of rectifying..
1190: 23 23 20 20 20 20 20 20 20 74 68 65 20 70 72 6f ## the pro
11a0: 62 6c 65 6d 2e 0a 09 23 23 0a 0a 09 23 20 54 68 blem...##...# Th
11b0: 69 73 20 6d 65 74 68 6f 64 20 69 6e 73 70 65 63 is method inspec
11c0: 74 73 20 74 68 65 20 63 68 61 6e 67 65 73 65 74 ts the changeset
11d0: 73 20 66 6f 72 20 69 6e 74 65 72 6e 61 6c 0a 09 s for internal..
11e0: 23 20 64 65 70 65 6e 64 65 6e 63 69 65 73 2e 20 # dependencies.
11f0: 4e 6f 74 68 69 6e 67 20 69 73 20 64 6f 6e 65 20 Nothing is done
1200: 69 66 20 74 68 65 72 65 20 61 72 65 20 6e 6f 0a if there are no.
1210: 09 23 20 73 75 63 68 2e 20 4f 74 68 65 72 77 69 .# such. Otherwi
1220: 73 65 20 74 68 65 20 63 68 61 6e 67 65 73 65 74 se the changeset
1230: 20 69 73 20 73 70 6c 69 74 20 69 6e 74 6f 20 61 is split into a
1240: 20 73 65 74 20 6f 66 0a 09 23 20 66 72 61 67 6d set of..# fragm
1250: 65 6e 74 73 20 77 69 74 68 6f 75 74 20 69 6e 74 ents without int
1260: 65 72 6e 61 6c 20 64 65 70 65 6e 64 65 6e 63 69 ernal dependenci
1270: 65 73 2c 20 74 72 61 6e 73 66 6f 72 6d 69 6e 67 es, transforming
1280: 20 74 68 65 0a 09 23 20 69 6e 74 65 72 6e 61 6c the..# internal
1290: 20 64 65 70 65 6e 64 65 6e 63 69 65 73 20 69 6e dependencies in
12a0: 74 6f 20 65 78 74 65 72 6e 61 6c 20 6f 6e 65 73 to external ones
12b0: 2e 20 54 68 65 20 6e 65 77 20 63 68 61 6e 67 65 . The new change
12c0: 73 65 74 73 0a 09 23 20 61 72 65 20 61 64 64 65 sets..# are adde
12d0: 64 20 74 6f 20 74 68 65 20 6c 69 73 74 20 6f 66 d to the list of
12e0: 20 61 6c 6c 20 63 68 61 6e 67 65 73 65 74 73 2e all changesets.
12f0: 0a 0a 09 23 20 57 65 20 70 65 72 66 6f 72 6d 20 ...# We perform
1300: 61 6c 6c 20 6e 65 63 65 73 73 61 72 79 20 73 70 all necessary sp
1310: 6c 69 74 73 20 69 6e 20 6f 6e 65 20 67 6f 2c 20 lits in one go,
1320: 69 6e 73 74 65 61 64 20 6f 66 20 6f 6e 6c 79 0a instead of only.
1330: 09 23 20 6f 6e 65 2e 20 54 68 65 20 70 72 65 76 .# one. The prev
1340: 69 6f 75 73 20 61 6c 67 6f 72 69 74 68 6d 2c 20 ious algorithm,
1350: 61 64 61 70 74 65 64 20 66 72 6f 6d 20 63 76 73 adapted from cvs
1360: 32 73 76 6e 2c 20 63 6f 6d 70 75 74 65 64 0a 09 2svn, computed..
1370: 23 20 61 20 6c 6f 74 20 6f 66 20 73 74 61 74 65 # a lot of state
1380: 20 77 68 69 63 68 20 77 61 73 20 74 68 72 6f 77 which was throw
1390: 6e 20 61 77 61 79 20 61 6e 64 20 74 68 65 6e 20 n away and then
13a0: 63 6f 6d 70 75 74 65 64 20 61 67 61 69 6e 0a 09 computed again..
13b0: 23 20 66 6f 72 20 65 61 63 68 20 6f 66 20 74 68 # for each of th
13c0: 65 20 66 72 61 67 6d 65 6e 74 73 2e 20 49 74 20 e fragments. It
13d0: 73 68 6f 75 6c 64 20 62 65 20 65 61 73 69 65 72 should be easier
13e0: 20 74 6f 20 75 70 64 61 74 65 20 61 6e 64 0a 09 to update and..
13f0: 23 20 72 65 75 73 65 20 74 68 61 74 20 73 74 61 # reuse that sta
1400: 74 65 2e 0a 0a 09 23 20 54 68 65 20 63 6f 64 65 te....# The code
1410: 20 63 68 65 63 6b 73 20 6f 6e 6c 79 20 73 75 63 checks only suc
1420: 63 65 73 73 6f 72 20 64 65 70 65 6e 64 65 6e 63 cessor dependenc
1430: 69 65 73 2c 20 61 73 20 74 68 69 73 0a 09 23 20 ies, as this..#
1440: 61 75 74 6f 6d 61 74 69 63 61 6c 6c 79 20 63 6f automatically co
1450: 76 65 72 73 20 74 68 65 20 70 72 65 64 65 63 65 vers the predece
1460: 73 73 6f 72 20 64 65 70 65 6e 64 65 6e 63 69 65 ssor dependencie
1470: 73 20 61 73 20 77 65 6c 6c 20 28 41 0a 09 23 20 s as well (A..#
1480: 73 75 63 63 65 73 73 6f 72 20 64 65 70 65 6e 64 successor depend
1490: 65 6e 63 79 20 61 20 2d 3e 20 62 20 69 73 20 61 ency a -> b is a
14a0: 6c 73 6f 20 61 20 70 72 65 64 65 63 65 73 73 6f lso a predecesso
14b0: 72 20 64 65 70 65 6e 64 65 6e 63 79 0a 09 23 20 r dependency..#
14c0: 62 20 2d 3e 20 61 29 2e 0a 0a 09 23 20 41 72 72 b -> a)....# Arr
14d0: 61 79 20 6f 66 20 64 65 70 65 6e 64 65 6e 63 69 ay of dependenci
14e0: 65 73 20 28 70 61 72 65 6e 74 20 2d 3e 20 63 68 es (parent -> ch
14f0: 69 6c 64 29 2e 20 54 68 69 73 20 69 73 20 70 75 ild). This is pu
1500: 6c 6c 65 64 20 66 72 6f 6d 0a 09 23 20 74 68 65 lled from..# the
1510: 20 73 74 61 74 65 2c 20 61 6e 64 20 6c 69 6d 69 state, and limi
1520: 74 65 64 20 74 6f 20 73 75 63 63 65 73 73 6f 72 ted to successor
1530: 73 20 77 69 74 68 69 6e 20 74 68 65 20 63 68 61 s within the cha
1540: 6e 67 65 73 65 74 2e 0a 0a 09 61 72 72 61 79 20 ngeset....array
1550: 73 65 74 20 64 65 70 65 6e 64 65 6e 63 69 65 73 set dependencies
1560: 20 7b 7d 0a 09 24 6d 79 74 79 70 65 6f 62 6a 20 {}..$mytypeobj
1570: 69 6e 74 65 72 6e 61 6c 73 75 63 63 65 73 73 6f internalsuccesso
1580: 72 73 20 64 65 70 65 6e 64 65 6e 63 69 65 73 20 rs dependencies
1590: 24 6d 79 69 74 65 6d 73 0a 09 69 66 20 7b 21 5b $myitems..if {![
15a0: 61 72 72 61 79 20 73 69 7a 65 20 64 65 70 65 6e array size depen
15b0: 64 65 6e 63 69 65 73 5d 7d 20 7b 72 65 74 75 72 dencies]} {retur
15c0: 6e 20 30 7d 20 3b 20 23 20 4e 6f 74 68 69 6e 67 n 0} ; # Nothing
15d0: 20 74 6f 20 62 72 65 61 6b 2e 0a 0a 09 6c 6f 67 to break....log
15e0: 20 77 72 69 74 65 20 35 20 63 73 65 74 73 20 2e write 5 csets .
15f0: 2e 2e 5b 24 73 65 6c 66 20 73 74 72 5d 2e 2e 2e ..[$self str]...
1600: 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e ................
1610: 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e ................
1620: 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e ................
1630: 2e 2e 2e 2e 0a 0a 09 23 20 57 65 20 68 61 76 65 .......# We have
1640: 20 69 6e 74 65 72 6e 61 6c 20 64 65 70 65 6e 64 internal depend
1650: 65 6e 63 69 65 73 20 74 6f 20 62 72 65 61 6b 2e encies to break.
1660: 20 57 65 20 6e 6f 77 20 69 74 65 72 61 74 65 20 We now iterate
1670: 6f 76 65 72 0a 09 23 20 61 6c 6c 20 70 6f 73 69 over..# all posi
1680: 74 69 6f 6e 73 20 69 6e 20 74 68 65 20 6c 69 73 tions in the lis
1690: 74 20 28 77 68 69 63 68 20 69 73 20 63 68 72 6f t (which is chro
16a0: 6e 6f 6c 6f 67 69 63 61 6c 2c 20 61 74 20 6c 65 nological, at le
16b0: 61 73 74 0a 09 23 20 61 73 20 66 61 72 20 61 73 ast..# as far as
16c0: 20 74 68 65 20 74 69 6d 65 73 74 61 6d 70 73 20 the timestamps
16d0: 61 72 65 20 63 6f 72 72 65 63 74 20 61 6e 64 20 are correct and
16e0: 75 6e 69 71 75 65 29 20 61 6e 64 0a 09 23 20 64 unique) and..# d
16f0: 65 74 65 72 6d 69 6e 65 20 74 68 65 20 62 65 73 etermine the bes
1700: 74 20 70 6f 73 69 74 69 6f 6e 20 66 6f 72 20 74 t position for t
1710: 68 65 20 62 72 65 61 6b 2c 20 62 79 20 74 72 79 he break, by try
1720: 69 6e 67 20 74 6f 0a 09 23 20 62 72 65 61 6b 20 ing to..# break
1730: 61 73 20 6d 61 6e 79 20 64 65 70 65 6e 64 65 6e as many dependen
1740: 63 69 65 73 20 61 73 20 70 6f 73 73 69 62 6c 65 cies as possible
1750: 20 69 6e 20 6f 6e 65 20 67 6f 2e 20 57 68 65 6e in one go. When
1760: 20 61 0a 09 23 20 62 72 65 61 6b 20 77 61 73 20 a..# break was
1770: 66 6f 75 6e 64 20 74 68 69 73 20 69 73 20 72 65 found this is re
1780: 64 6f 6e 65 20 66 6f 72 20 74 68 65 20 66 72 61 done for the fra
1790: 67 6d 65 6e 74 73 20 63 6f 6d 69 6e 67 20 61 6e gments coming an
17a0: 64 0a 09 23 20 61 66 74 65 72 2c 20 61 66 74 65 d..# after, afte
17b0: 72 20 75 70 64 69 6e 67 20 74 68 65 20 63 72 6f r upding the cro
17c0: 73 73 69 6e 67 20 69 6e 66 6f 72 6d 61 74 69 6f ssing informatio
17d0: 6e 2e 0a 0a 09 23 20 44 61 74 61 20 73 74 72 75 n....# Data stru
17e0: 63 74 75 72 65 73 3a 0a 09 23 20 4d 61 70 3a 20 ctures:..# Map:
17f0: 20 50 4f 53 20 20 20 72 65 76 69 73 69 6f 6e 20 POS revision
1800: 69 64 20 20 20 20 20 20 2d 3e 20 70 6f 73 69 74 id -> posit
1810: 69 6f 6e 20 69 6e 20 6c 69 73 74 2e 0a 09 23 20 ion in list...#
1820: 20 20 20 20 20 20 43 52 4f 53 53 20 70 6f 73 69 CROSS posi
1830: 74 69 6f 6e 20 69 6e 20 6c 69 73 74 20 2d 3e 20 tion in list ->
1840: 6e 75 6d 62 65 72 20 6f 66 20 64 65 70 65 6e 64 number of depend
1850: 65 6e 63 69 65 73 20 63 72 6f 73 73 69 6e 67 20 encies crossing
1860: 69 74 0a 09 23 20 20 20 20 20 20 20 44 45 50 43 it..# DEPC
1870: 20 20 64 65 70 65 6e 64 65 6e 63 79 20 20 20 20 dependency
1880: 20 20 20 2d 3e 20 70 6f 73 69 74 69 6f 6e 73 20 -> positions
1890: 69 74 20 63 72 6f 73 73 65 73 0a 09 23 20 4c 69 it crosses..# Li
18a0: 73 74 3a 20 52 41 4e 47 45 20 4f 66 20 74 68 65 st: RANGE Of the
18b0: 20 70 6f 73 69 74 69 6f 6e 73 20 69 74 73 65 6c positions itsel
18c0: 66 2e 0a 09 23 20 41 20 64 65 70 65 6e 64 65 6e f...# A dependen
18d0: 63 79 20 69 73 20 61 20 73 69 6e 67 6c 65 2d 65 cy is a single-e
18e0: 6c 65 6d 65 6e 74 20 6d 61 70 20 70 61 72 65 6e lement map paren
18f0: 74 20 2d 3e 20 63 68 69 6c 64 0a 0a 09 49 6e 69 t -> child...Ini
1900: 74 69 61 6c 69 7a 65 42 72 65 61 6b 53 74 61 74 tializeBreakStat
1910: 65 20 24 6d 79 69 74 65 6d 73 0a 0a 09 73 65 74 e $myitems...set
1920: 20 66 72 61 67 6d 65 6e 74 73 20 7b 7d 0a 09 73 fragments {}..s
1930: 65 74 20 6e 65 77 20 20 20 20 20 20 20 5b 6c 69 et new [li
1940: 73 74 20 24 72 61 6e 67 65 5d 0a 09 61 72 72 61 st $range]..arra
1950: 79 20 73 65 74 20 62 72 65 61 6b 73 20 7b 7d 0a y set breaks {}.
1960: 0a 09 23 20 49 6e 73 74 65 61 64 20 6f 66 20 6f ..# Instead of o
1970: 6e 65 20 6c 69 73 74 20 68 6f 6c 64 69 6e 67 20 ne list holding
1980: 62 6f 74 68 20 70 72 6f 63 65 73 73 65 64 20 61 both processed a
1990: 6e 64 20 70 65 6e 64 69 6e 67 0a 09 23 20 66 72 nd pending..# fr
19a0: 61 67 6d 65 6e 74 73 20 77 65 20 75 73 65 20 74 agments we use t
19b0: 77 6f 2c 20 6f 6e 65 20 66 6f 72 20 74 68 65 20 wo, one for the
19c0: 66 72 61 6d 65 6e 74 73 20 74 6f 20 70 72 6f 63 framents to proc
19d0: 65 73 73 2c 20 6f 6e 65 0a 09 23 20 74 6f 20 68 ess, one..# to h
19e0: 6f 6c 64 20 74 68 65 20 6e 65 77 20 66 72 61 67 old the new frag
19f0: 6d 65 6e 74 73 2c 20 61 6e 64 20 74 68 65 20 6c ments, and the l
1a00: 61 74 74 65 72 20 69 73 20 63 6f 70 69 65 64 20 atter is copied
1a10: 74 6f 20 74 68 65 0a 09 23 20 66 6f 72 6d 65 72 to the..# former
1a20: 20 77 68 65 6e 20 74 68 65 79 20 72 75 6e 20 6f when they run o
1a30: 75 74 2e 20 54 68 69 73 20 6b 65 65 70 73 20 74 ut. This keeps t
1a40: 68 65 20 6c 69 73 74 20 6f 66 20 70 65 6e 64 69 he list of pendi
1a50: 6e 67 0a 09 23 20 66 72 61 67 6d 65 6e 74 73 20 ng..# fragments
1a60: 73 68 6f 72 74 20 77 69 74 68 6f 75 74 20 73 61 short without sa
1a70: 63 72 69 66 69 63 69 6e 67 20 73 70 65 65 64 20 crificing speed
1a80: 62 79 20 73 68 69 66 74 69 6e 67 20 73 74 75 66 by shifting stuf
1a90: 66 0a 09 23 20 64 6f 77 6e 2e 20 57 65 20 65 73 f..# down. We es
1aa0: 70 65 63 69 61 6c 6c 79 20 64 72 6f 70 20 74 68 pecially drop th
1ab0: 65 20 6d 65 6d 6f 72 79 20 6f 66 20 66 72 61 67 e memory of frag
1ac0: 6d 65 6e 74 73 20 62 72 6f 6b 65 6e 0a 09 23 20 ments broken..#
1ad0: 64 75 72 69 6e 67 20 70 72 6f 63 65 73 73 69 6e during processin
1ae0: 67 20 61 66 74 65 72 20 61 20 73 68 6f 72 74 20 g after a short
1af0: 74 69 6d 65 2c 20 69 6e 73 74 65 61 64 20 6f 66 time, instead of
1b00: 20 6c 65 74 74 69 6e 67 20 69 74 0a 09 23 20 63 letting it..# c
1b10: 6f 6e 73 75 6d 65 20 6d 65 6d 6f 72 79 2e 0a 0a onsume memory...
1b20: 09 77 68 69 6c 65 20 7b 5b 6c 6c 65 6e 67 74 68 .while {[llength
1b30: 20 24 6e 65 77 5d 7d 20 7b 0a 0a 09 20 20 20 20 $new]} {...
1b40: 73 65 74 20 70 65 6e 64 69 6e 67 20 24 6e 65 77 set pending $new
1b50: 0a 09 20 20 20 20 73 65 74 20 6e 65 77 20 20 20 .. set new
1b60: 20 20 7b 7d 0a 09 20 20 20 20 73 65 74 20 61 74 {}.. set at
1b70: 20 20 20 20 20 20 30 0a 0a 09 20 20 20 20 77 68 0... wh
1b80: 69 6c 65 20 7b 24 61 74 20 3c 20 5b 6c 6c 65 6e ile {$at < [llen
1b90: 67 74 68 20 24 70 65 6e 64 69 6e 67 5d 7d 20 7b gth $pending]} {
1ba0: 0a 09 09 73 65 74 20 63 75 72 72 65 6e 74 20 5b ...set current [
1bb0: 6c 69 6e 64 65 78 20 24 70 65 6e 64 69 6e 67 20 lindex $pending
1bc0: 24 61 74 5d 0a 0a 09 09 6c 6f 67 20 77 72 69 74 $at]....log writ
1bd0: 65 20 36 20 63 73 65 74 73 20 7b 2e 20 2e 20 2e e 6 csets {. . .
1be0: 2e 20 2e 2e 2e 20 2e 2e 2e 2e 2e 20 2e 2e 2e 2e . ... ..... ....
1bf0: 2e 2e 2e 2e 20 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e .... ...........
1c00: 2e 2e 7d 0a 09 09 6c 6f 67 20 77 72 69 74 65 20 ..}...log write
1c10: 36 20 63 73 65 74 73 20 7b 53 63 68 65 64 75 6c 6 csets {Schedul
1c20: 65 64 20 20 20 5b 6a 6f 69 6e 20 5b 50 52 73 20 ed [join [PRs
1c30: 5b 6c 72 61 6e 67 65 20 24 70 65 6e 64 69 6e 67 [lrange $pending
1c40: 20 24 61 74 20 65 6e 64 5d 5d 20 7b 20 7d 5d 7d $at end]] { }]}
1c50: 0a 09 09 6c 6f 67 20 77 72 69 74 65 20 36 20 63 ...log write 6 c
1c60: 73 65 74 73 20 7b 43 6f 6e 73 69 64 65 72 69 6e sets {Considerin
1c70: 67 20 5b 50 52 20 24 63 75 72 72 65 6e 74 5d 20 g [PR $current]
1c80: 5c 5b 24 61 74 2f 5b 6c 6c 65 6e 67 74 68 20 24 \[$at/[llength $
1c90: 70 65 6e 64 69 6e 67 5d 5c 5d 7d 0a 0a 09 09 73 pending]\]}....s
1ca0: 65 74 20 62 65 73 74 20 5b 46 69 6e 64 42 65 73 et best [FindBes
1cb0: 74 42 72 65 61 6b 20 24 63 75 72 72 65 6e 74 5d tBreak $current]
1cc0: 0a 0a 09 09 69 66 20 7b 24 62 65 73 74 20 3c 20 ....if {$best <
1cd0: 30 7d 20 7b 0a 09 09 20 20 20 20 23 20 54 68 65 0} {... # The
1ce0: 20 69 6e 73 70 65 63 74 65 64 20 72 61 6e 67 65 inspected range
1cf0: 20 68 61 73 20 6e 6f 20 69 6e 74 65 72 6e 61 6c has no internal
1d00: 0a 09 09 20 20 20 20 23 20 64 65 70 65 6e 64 65 ... # depende
1d10: 6e 63 69 65 73 2e 20 54 68 69 73 20 69 73 20 61 ncies. This is a
1d20: 20 63 6f 6d 70 6c 65 74 65 20 66 72 61 67 6d 65 complete fragme
1d30: 6e 74 2e 0a 09 09 20 20 20 20 6c 61 70 70 65 6e nt.... lappen
1d40: 64 20 66 72 61 67 6d 65 6e 74 73 20 24 63 75 72 d fragments $cur
1d50: 72 65 6e 74 0a 0a 09 09 20 20 20 20 6c 6f 67 20 rent.... log
1d60: 77 72 69 74 65 20 36 20 63 73 65 74 73 20 22 4e write 6 csets "N
1d70: 6f 20 62 72 65 61 6b 73 2c 20 66 69 6e 61 6c 22 o breaks, final"
1d80: 0a 09 09 7d 20 65 6c 73 65 20 7b 0a 09 09 20 20 ...} else {...
1d90: 20 20 23 20 53 70 6c 69 74 20 74 68 65 20 72 61 # Split the ra
1da0: 6e 67 65 20 61 6e 64 20 73 63 68 65 64 75 6c 65 nge and schedule
1db0: 20 74 68 65 20 72 65 73 75 6c 74 69 6e 67 0a 09 the resulting..
1dc0: 09 20 20 20 20 23 20 66 72 61 67 6d 65 6e 74 73 . # fragments
1dd0: 20 66 6f 72 20 66 75 72 74 68 65 72 20 69 6e 73 for further ins
1de0: 70 65 63 74 69 6f 6e 2e 20 52 65 6d 65 6d 62 65 pection. Remembe
1df0: 72 20 74 68 65 0a 09 09 20 20 20 20 23 20 6e 75 r the... # nu
1e00: 6d 62 65 72 20 6f 66 20 64 65 70 65 6e 64 65 6e mber of dependen
1e10: 63 69 65 73 20 63 75 74 20 62 65 66 6f 72 65 20 cies cut before
1e20: 77 65 20 72 65 6d 6f 76 65 20 74 68 65 6d 0a 09 we remove them..
1e30: 09 20 20 20 20 23 20 66 72 6f 6d 20 63 6f 6e 73 . # from cons
1e40: 69 64 65 72 61 74 69 6f 6e 2c 20 66 6f 72 20 64 ideration, for d
1e50: 6f 63 75 6d 65 6e 74 61 74 69 6f 6e 20 6c 61 74 ocumentation lat
1e60: 65 72 2e 0a 0a 09 09 20 20 20 20 73 65 74 20 62 er..... set b
1e70: 72 65 61 6b 73 28 24 62 65 73 74 29 20 24 63 72 reaks($best) $cr
1e80: 6f 73 73 28 24 62 65 73 74 29 0a 0a 09 09 20 20 oss($best)....
1e90: 20 20 6c 6f 67 20 77 72 69 74 65 20 36 20 63 73 log write 6 cs
1ea0: 65 74 73 20 22 42 65 73 74 20 62 72 65 61 6b 20 ets "Best break
1eb0: 40 20 24 62 65 73 74 2c 20 63 75 74 74 69 6e 67 @ $best, cutting
1ec0: 20 5b 6e 73 70 20 24 63 72 6f 73 73 28 24 62 65 [nsp $cross($be
1ed0: 73 74 29 20 64 65 70 65 6e 64 65 6e 63 79 20 64 st) dependency d
1ee0: 65 70 65 6e 64 65 6e 63 69 65 73 5d 22 0a 0a 09 ependencies]"...
1ef0: 09 20 20 20 20 23 20 4e 6f 74 65 3a 20 54 68 65 . # Note: The
1f00: 20 76 61 6c 75 65 20 6f 66 20 62 65 73 74 20 69 value of best i
1f10: 73 20 61 6e 20 61 62 6f 6c 75 74 65 20 6c 6f 63 s an abolute loc
1f20: 61 74 69 6f 6e 0a 09 09 20 20 20 20 23 20 69 6e ation... # in
1f30: 20 6d 79 69 74 65 6d 73 2e 20 55 73 65 20 74 68 myitems. Use th
1f40: 65 20 73 74 61 72 74 20 6f 66 20 63 75 72 72 65 e start of curre
1f50: 6e 74 20 74 6f 20 6d 61 6b 65 20 69 74 0a 09 09 nt to make it...
1f60: 20 20 20 20 23 20 61 6e 20 69 6e 64 65 78 20 61 # an index a
1f70: 62 73 6f 6c 75 74 65 20 74 6f 20 63 75 72 72 65 bsolute to curre
1f80: 6e 74 2e 0a 0a 09 09 20 20 20 20 73 65 74 20 62 nt..... set b
1f90: 72 65 6c 20 5b 65 78 70 72 20 7b 24 62 65 73 74 rel [expr {$best
1fa0: 20 2d 20 5b 6c 69 6e 64 65 78 20 24 63 75 72 72 - [lindex $curr
1fb0: 65 6e 74 20 30 5d 7d 5d 0a 09 09 20 20 20 20 73 ent 0]}]... s
1fc0: 65 74 20 62 6e 65 78 74 20 24 62 72 65 6c 20 3b et bnext $brel ;
1fd0: 20 69 6e 63 72 20 62 6e 65 78 74 0a 09 09 20 20 incr bnext...
1fe0: 20 20 73 65 74 20 66 72 61 67 62 65 66 6f 72 65 set fragbefore
1ff0: 20 5b 6c 72 61 6e 67 65 20 24 63 75 72 72 65 6e [lrange $curren
2000: 74 20 30 20 24 62 72 65 6c 5d 0a 09 09 20 20 20 t 0 $brel]...
2010: 20 73 65 74 20 66 72 61 67 61 66 74 65 72 20 20 set fragafter
2020: 5b 6c 72 61 6e 67 65 20 24 63 75 72 72 65 6e 74 [lrange $current
2030: 20 24 62 6e 65 78 74 20 65 6e 64 5d 0a 0a 09 09 $bnext end]....
2040: 20 20 20 20 6c 6f 67 20 77 72 69 74 65 20 36 20 log write 6
2050: 63 73 65 74 73 20 22 4e 65 77 20 70 69 65 63 65 csets "New piece
2060: 73 20 20 5b 50 52 20 24 66 72 61 67 62 65 66 6f s [PR $fragbefo
2070: 72 65 5d 20 5b 50 52 20 24 66 72 61 67 61 66 74 re] [PR $fragaft
2080: 65 72 5d 22 0a 0a 09 09 20 20 20 20 69 6e 74 65 er]".... inte
2090: 67 72 69 74 79 20 61 73 73 65 72 74 20 7b 5b 6c grity assert {[l
20a0: 6c 65 6e 67 74 68 20 24 66 72 61 67 62 65 66 6f length $fragbefo
20b0: 72 65 5d 7d 20 7b 46 6f 75 6e 64 20 7a 65 72 6f re]} {Found zero
20c0: 2d 6c 65 6e 67 74 68 20 66 72 61 67 6d 65 6e 74 -length fragment
20d0: 20 61 74 20 74 68 65 20 62 65 67 69 6e 6e 69 6e at the beginnin
20e0: 67 7d 0a 09 09 20 20 20 20 69 6e 74 65 67 72 69 g}... integri
20f0: 74 79 20 61 73 73 65 72 74 20 7b 5b 6c 6c 65 6e ty assert {[llen
2100: 67 74 68 20 24 66 72 61 67 61 66 74 65 72 5d 7d gth $fragafter]}
2110: 20 20 7b 46 6f 75 6e 64 20 7a 65 72 6f 2d 6c 65 {Found zero-le
2120: 6e 67 74 68 20 66 72 61 67 6d 65 6e 74 20 61 74 ngth fragment at
2130: 20 74 68 65 20 65 6e 64 7d 0a 0a 09 09 20 20 20 the end}....
2140: 20 6c 61 70 70 65 6e 64 20 6e 65 77 20 24 66 72 lappend new $fr
2150: 61 67 62 65 66 6f 72 65 20 24 66 72 61 67 61 66 agbefore $fragaf
2160: 74 65 72 0a 09 09 20 20 20 20 43 75 74 41 74 20 ter... CutAt
2170: 24 62 65 73 74 0a 09 09 7d 0a 0a 09 09 69 6e 63 $best...}....inc
2180: 72 20 61 74 0a 09 20 20 20 20 7d 0a 09 7d 0a 0a r at.. }..}..
2190: 09 6c 6f 67 20 77 72 69 74 65 20 36 20 63 73 65 .log write 6 cse
21a0: 74 73 20 22 2e 20 2e 20 2e 2e 20 2e 2e 2e 20 2e ts ". . .. ... .
21b0: 2e 2e 2e 2e 20 2e 2e 2e 2e 2e 2e 2e 2e 20 2e 2e .... ........ ..
21c0: 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 22 0a 0a 09 23 ..........."...#
21d0: 20 28 2a 29 20 57 65 20 63 6c 65 61 72 20 6f 75 (*) We clear ou
21e0: 74 20 74 68 65 20 61 73 73 6f 63 69 61 74 65 64 t the associated
21f0: 20 70 61 72 74 20 6f 66 20 74 68 65 20 6d 79 69 part of the myi
2200: 74 65 6d 6d 61 70 0a 09 23 20 69 6e 2d 6d 65 6d temmap..# in-mem
2210: 6f 72 79 20 69 6e 64 65 78 20 69 6e 20 70 72 65 ory index in pre
2220: 70 61 72 61 74 69 6f 6e 20 66 6f 72 20 6e 65 77 paration for new
2230: 20 64 61 74 61 2e 20 41 20 73 69 6d 70 6c 65 20 data. A simple
2240: 75 6e 73 65 74 0a 09 23 20 69 73 20 65 6e 6f 75 unset..# is enou
2250: 67 68 2c 20 77 65 20 68 61 76 65 20 6e 6f 20 73 gh, we have no s
2260: 79 6d 62 6f 6c 20 63 68 61 6e 67 65 73 65 74 73 ymbol changesets
2270: 20 61 74 20 74 68 69 73 20 74 69 6d 65 2c 20 61 at this time, a
2280: 6e 64 0a 09 23 20 74 68 75 73 20 6e 65 76 65 72 nd..# thus never
2290: 20 6d 6f 72 65 20 74 68 61 6e 20 6f 6e 65 20 72 more than one r
22a0: 65 66 65 72 65 6e 63 65 20 69 6e 20 74 68 65 20 eference in the
22b0: 6c 69 73 74 2e 0a 0a 09 66 6f 72 65 61 63 68 20 list....foreach
22c0: 69 69 64 20 24 6d 79 69 74 65 6d 73 20 7b 0a 09 iid $myitems {..
22d0: 20 20 20 20 73 65 74 20 6b 65 79 20 5b 6c 69 73 set key [lis
22e0: 74 20 24 6d 79 74 79 70 65 20 24 69 69 64 5d 0a t $mytype $iid].
22f0: 09 20 20 20 20 75 6e 73 65 74 20 6d 79 69 74 65 . unset myite
2300: 6d 6d 61 70 28 24 6b 65 79 29 0a 09 20 20 20 20 mmap($key)..
2310: 6c 6f 67 20 77 72 69 74 65 20 38 20 63 73 65 74 log write 8 cset
2320: 73 20 7b 4d 41 50 2d 20 69 74 65 6d 20 3c 24 6b s {MAP- item <$k
2330: 65 79 3e 20 24 73 65 6c 66 20 3d 20 5b 24 73 65 ey> $self = [$se
2340: 6c 66 20 73 74 72 5d 7d 0a 09 7d 0a 0a 09 23 20 lf str]}..}...#
2350: 43 72 65 61 74 65 20 63 68 61 6e 67 65 73 65 74 Create changeset
2360: 73 20 66 6f 72 20 74 68 65 20 66 72 61 67 6d 65 s for the fragme
2370: 6e 74 73 2c 20 72 65 75 73 69 6e 67 20 74 68 65 nts, reusing the
2380: 20 63 75 72 72 65 6e 74 20 6f 6e 65 0a 09 23 20 current one..#
2390: 66 6f 72 20 74 68 65 20 66 69 72 73 74 20 66 72 for the first fr
23a0: 61 67 6d 65 6e 74 2e 20 57 65 20 73 6f 72 74 20 agment. We sort
23b0: 74 68 65 6d 20 69 6e 20 6f 72 64 65 72 20 74 6f them in order to
23c0: 20 61 6c 6c 6f 77 0a 09 23 20 63 68 65 63 6b 69 allow..# checki
23d0: 6e 67 20 66 6f 72 20 67 61 70 73 20 61 6e 64 20 ng for gaps and
23e0: 6e 69 63 65 20 6d 65 73 73 61 67 65 73 2e 0a 0a nice messages...
23f0: 09 73 65 74 20 66 72 61 67 6d 65 6e 74 73 20 5b .set fragments [
2400: 6c 73 6f 72 74 20 2d 69 6e 64 65 78 20 30 20 2d lsort -index 0 -
2410: 69 6e 74 65 67 65 72 20 24 66 72 61 67 6d 65 6e integer $fragmen
2420: 74 73 5d 0a 0a 09 23 70 75 74 73 20 5c 74 2e 5b ts]...#puts \t.[
2430: 6a 6f 69 6e 20 5b 50 52 73 20 24 66 72 61 67 6d join [PRs $fragm
2440: 65 6e 74 73 5d 20 2e 5c 6e 5c 74 2e 5d 2e 0a 0a ents] .\n\t.]...
2450: 09 42 6f 72 64 65 72 20 5b 6c 69 6e 64 65 78 20 .Border [lindex
2460: 24 66 72 61 67 6d 65 6e 74 73 20 30 5d 20 66 69 $fragments 0] fi
2470: 72 73 74 73 20 66 69 72 73 74 65 0a 0a 09 69 6e rsts firste...in
2480: 74 65 67 72 69 74 79 20 61 73 73 65 72 74 20 7b tegrity assert {
2490: 24 66 69 72 73 74 73 20 3d 3d 20 30 7d 20 7b 42 $firsts == 0} {B
24a0: 61 64 20 66 72 61 67 6d 65 6e 74 20 73 74 61 72 ad fragment star
24b0: 74 20 40 20 24 66 69 72 73 74 73 2c 20 67 61 70 t @ $firsts, gap
24c0: 2c 20 6f 72 20 62 65 66 6f 72 65 20 62 65 67 69 , or before begi
24d0: 6e 6e 69 6e 67 20 6f 66 20 74 68 65 20 72 61 6e nning of the ran
24e0: 67 65 7d 0a 0a 09 73 65 74 20 6c 61 73 74 65 20 ge}...set laste
24f0: 24 66 69 72 73 74 65 0a 09 66 6f 72 65 61 63 68 $firste..foreach
2500: 20 66 72 61 67 6d 65 6e 74 20 5b 6c 72 61 6e 67 fragment [lrang
2510: 65 20 24 66 72 61 67 6d 65 6e 74 73 20 31 20 65 e $fragments 1 e
2520: 6e 64 5d 20 7b 0a 09 20 20 20 20 42 6f 72 64 65 nd] {.. Borde
2530: 72 20 24 66 72 61 67 6d 65 6e 74 20 73 20 65 0a r $fragment s e.
2540: 09 20 20 20 20 69 6e 74 65 67 72 69 74 79 20 61 . integrity a
2550: 73 73 65 72 74 20 7b 24 6c 61 73 74 65 20 3d 3d ssert {$laste ==
2560: 20 28 24 73 20 2d 20 31 29 7d 20 7b 42 61 64 20 ($s - 1)} {Bad
2570: 66 72 61 67 6d 65 6e 74 20 62 6f 72 64 65 72 20 fragment border
2580: 3c 24 6c 61 73 74 65 20 7c 20 24 73 3e 2c 20 67 <$laste | $s>, g
2590: 61 70 20 6f 72 20 6f 76 65 72 6c 61 70 7d 0a 0a ap or overlap}..
25a0: 09 20 20 20 20 73 65 74 20 6e 65 77 20 5b 24 74 . set new [$t
25b0: 79 70 65 20 25 41 55 54 4f 25 20 24 6d 79 70 72 ype %AUTO% $mypr
25c0: 6f 6a 65 63 74 20 24 6d 79 74 79 70 65 20 24 6d oject $mytype $m
25d0: 79 73 72 63 69 64 20 5b 6c 72 61 6e 67 65 20 24 ysrcid [lrange $
25e0: 6d 79 69 74 65 6d 73 20 24 73 20 24 65 5d 5d 0a myitems $s $e]].
25f0: 0a 20 20 20 20 20 20 20 20 20 20 20 20 6c 6f 67 . log
2600: 20 77 72 69 74 65 20 34 20 63 73 65 74 73 20 22 write 4 csets "
2610: 42 72 65 61 6b 69 6e 67 20 5b 24 73 65 6c 66 20 Breaking [$self
2620: 73 74 72 20 5d 20 40 20 24 6c 61 73 74 65 2c 20 str ] @ $laste,
2630: 6e 65 77 20 5b 24 6e 65 77 20 73 74 72 5d 2c 20 new [$new str],
2640: 63 75 74 74 69 6e 67 20 24 62 72 65 61 6b 73 28 cutting $breaks(
2650: 24 6c 61 73 74 65 29 22 0a 0a 09 20 20 20 20 73 $laste)"... s
2660: 65 74 20 6c 61 73 74 65 20 24 65 0a 09 7d 0a 0a et laste $e..}..
2670: 09 69 6e 74 65 67 72 69 74 79 20 61 73 73 65 72 .integrity asser
2680: 74 20 7b 0a 09 20 20 20 20 24 6c 61 73 74 65 20 t {.. $laste
2690: 3d 3d 20 28 5b 6c 6c 65 6e 67 74 68 20 24 6d 79 == ([llength $my
26a0: 69 74 65 6d 73 5d 2d 31 29 0a 09 7d 20 7b 42 61 items]-1)..} {Ba
26b0: 64 20 66 72 61 67 6d 65 6e 74 20 65 6e 64 20 40 d fragment end @
26c0: 20 24 6c 61 73 74 65 2c 20 67 61 70 2c 20 6f 72 $laste, gap, or
26d0: 20 62 65 79 6f 6e 64 20 65 6e 64 20 6f 66 20 74 beyond end of t
26e0: 68 65 20 72 61 6e 67 65 7d 0a 0a 09 23 20 50 75 he range}...# Pu
26f0: 74 20 74 68 65 20 66 69 72 73 74 20 66 72 61 67 t the first frag
2700: 6d 65 6e 74 20 69 6e 74 6f 20 74 68 65 20 63 75 ment into the cu
2710: 72 72 65 6e 74 20 63 68 61 6e 67 65 73 65 74 2c rrent changeset,
2720: 20 61 6e 64 0a 09 23 20 75 70 64 61 74 65 20 74 and..# update t
2730: 68 65 20 69 6e 2d 6d 65 6d 6f 72 79 20 69 6e 64 he in-memory ind
2740: 65 78 2e 20 57 65 20 63 61 6e 20 73 69 6d 70 6c ex. We can simpl
2750: 79 20 28 72 65 29 61 64 64 20 74 68 65 20 69 74 y (re)add the it
2760: 65 6d 73 0a 09 23 20 62 65 63 61 75 73 65 20 77 ems..# because w
2770: 65 20 63 6c 65 61 72 65 64 20 74 68 65 20 70 72 e cleared the pr
2780: 65 76 69 6f 75 73 6c 79 20 65 78 69 73 74 69 6e eviously existin
2790: 67 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 2c 20 73 g information, s
27a0: 65 65 0a 09 23 20 28 2a 29 20 61 62 6f 76 65 2e ee..# (*) above.
27b0: 20 50 65 72 73 69 73 74 65 6e 63 65 20 64 6f 65 Persistence doe
27c0: 73 20 6e 6f 74 20 6d 61 74 74 65 72 20 68 65 72 s not matter her
27d0: 65 2c 20 6e 6f 6e 65 20 6f 66 20 74 68 65 0a 09 e, none of the..
27e0: 23 20 63 68 61 6e 67 65 73 65 74 73 20 68 61 73 # changesets has
27f0: 20 62 65 65 6e 20 73 61 76 65 64 20 74 6f 20 74 been saved to t
2800: 68 65 20 70 65 72 73 69 73 74 65 6e 74 20 73 74 he persistent st
2810: 61 74 65 20 79 65 74 2e 0a 0a 09 73 65 74 20 6d ate yet....set m
2820: 79 69 74 65 6d 73 20 20 5b 6c 72 61 6e 67 65 20 yitems [lrange
2830: 24 6d 79 69 74 65 6d 73 20 20 30 20 24 66 69 72 $myitems 0 $fir
2840: 73 74 65 5d 0a 09 73 65 74 20 6d 79 74 69 74 65 ste]..set mytite
2850: 6d 73 20 5b 6c 72 61 6e 67 65 20 24 6d 79 74 69 ms [lrange $myti
2860: 74 65 6d 73 20 30 20 24 66 69 72 73 74 65 5d 0a tems 0 $firste].
2870: 09 66 6f 72 65 61 63 68 20 69 69 64 20 24 6d 79 .foreach iid $my
2880: 69 74 65 6d 73 20 7b 0a 09 20 20 20 20 73 65 74 items {.. set
2890: 20 6b 65 79 20 5b 6c 69 73 74 20 24 6d 79 74 79 key [list $myty
28a0: 70 65 20 24 69 69 64 5d 0a 09 20 20 20 20 73 65 pe $iid].. se
28b0: 74 20 6d 79 69 74 65 6d 6d 61 70 28 24 6b 65 79 t myitemmap($key
28c0: 29 20 24 73 65 6c 66 0a 09 20 20 20 20 6c 6f 67 ) $self.. log
28d0: 20 77 72 69 74 65 20 38 20 63 73 65 74 73 20 7b write 8 csets {
28e0: 4d 41 50 2b 20 69 74 65 6d 20 3c 24 6b 65 79 3e MAP+ item <$key>
28f0: 20 24 73 65 6c 66 20 3d 20 5b 24 73 65 6c 66 20 $self = [$self
2900: 73 74 72 5d 7d 0a 09 7d 0a 0a 09 72 65 74 75 72 str]}..}...retur
2910: 6e 20 31 0a 20 20 20 20 7d 0a 0a 20 20 20 20 6d n 1. }.. m
2920: 65 74 68 6f 64 20 70 65 72 73 69 73 74 20 7b 7d ethod persist {}
2930: 20 7b 0a 09 73 65 74 20 74 69 64 20 24 6d 79 63 {..set tid $myc
2940: 73 74 79 70 65 28 24 6d 79 74 79 70 65 29 0a 09 stype($mytype)..
2950: 73 65 74 20 70 69 64 20 5b 24 6d 79 70 72 6f 6a set pid [$myproj
2960: 65 63 74 20 69 64 5d 0a 09 73 65 74 20 70 6f 73 ect id]..set pos
2970: 20 30 0a 0a 09 73 74 61 74 65 20 74 72 61 6e 73 0...state trans
2980: 61 63 74 69 6f 6e 20 7b 0a 09 20 20 20 20 73 74 action {.. st
2990: 61 74 65 20 72 75 6e 20 7b 0a 09 09 49 4e 53 45 ate run {...INSE
29a0: 52 54 20 49 4e 54 4f 20 63 68 61 6e 67 65 73 65 RT INTO changese
29b0: 74 20 28 63 69 64 2c 20 20 20 70 69 64 2c 20 20 t (cid, pid,
29c0: 74 79 70 65 2c 20 73 72 63 29 0a 09 09 56 41 4c type, src)...VAL
29d0: 55 45 53 20 20 20 20 20 20 20 20 20 20 20 20 20 UES
29e0: 20 20 20 28 24 6d 79 69 64 2c 20 24 70 69 64 2c ($myid, $pid,
29f0: 20 24 74 69 64 2c 20 24 6d 79 73 72 63 69 64 29 $tid, $mysrcid)
2a00: 3b 0a 09 20 20 20 20 7d 0a 0a 09 20 20 20 20 66 ;.. }... f
2a10: 6f 72 65 61 63 68 20 69 69 64 20 24 6d 79 69 74 oreach iid $myit
2a20: 65 6d 73 20 7b 0a 09 09 73 74 61 74 65 20 72 75 ems {...state ru
2a30: 6e 20 7b 0a 09 09 20 20 20 20 49 4e 53 45 52 54 n {... INSERT
2a40: 20 49 4e 54 4f 20 63 73 69 74 65 6d 20 28 63 69 INTO csitem (ci
2a50: 64 2c 20 20 20 70 6f 73 2c 20 20 69 69 64 29 0a d, pos, iid).
2a60: 09 09 20 20 20 20 56 41 4c 55 45 53 20 20 20 20 .. VALUES
2a70: 20 20 20 20 20 20 20 20 20 28 24 6d 79 69 64 2c ($myid,
2a80: 20 24 70 6f 73 2c 20 24 69 69 64 29 3b 0a 09 09 $pos, $iid);...
2a90: 7d 0a 09 09 69 6e 63 72 20 70 6f 73 0a 09 20 20 }...incr pos..
2aa0: 20 20 7d 0a 09 7d 0a 09 72 65 74 75 72 6e 0a 20 }..}..return.
2ab0: 20 20 20 7d 0a 0a 20 20 20 20 6d 65 74 68 6f 64 }.. method
2ac0: 20 74 69 6d 65 72 61 6e 67 65 20 7b 7d 20 7b 20 timerange {} {
2ad0: 72 65 74 75 72 6e 20 5b 24 6d 79 74 79 70 65 6f return [$mytypeo
2ae0: 62 6a 20 74 69 6d 65 72 61 6e 67 65 20 24 6d 79 bj timerange $my
2af0: 69 74 65 6d 73 5d 20 7d 0a 0a 20 20 20 20 6d 65 items] }.. me
2b00: 74 68 6f 64 20 6c 69 6d 69 74 73 20 7b 7d 20 7b thod limits {} {
2b10: 0a 09 73 74 72 75 63 74 3a 3a 6c 69 73 74 20 61 ..struct::list a
2b20: 73 73 69 67 6e 20 5b 24 6d 79 74 79 70 65 6f 62 ssign [$mytypeob
2b30: 6a 20 6c 69 6d 69 74 73 20 24 6d 79 69 74 65 6d j limits $myitem
2b40: 73 5d 20 6d 61 78 70 20 6d 69 6e 73 0a 09 72 65 s] maxp mins..re
2b50: 74 75 72 6e 20 5b 6c 69 73 74 20 5b 54 61 67 49 turn [list [TagI
2b60: 74 65 6d 44 69 63 74 20 24 6d 61 78 70 20 24 6d temDict $maxp $m
2b70: 79 74 79 70 65 5d 20 5b 54 61 67 49 74 65 6d 44 ytype] [TagItemD
2b80: 69 63 74 20 24 6d 69 6e 73 20 24 6d 79 74 79 70 ict $mins $mytyp
2b90: 65 5d 5d 0a 20 20 20 20 7d 0a 0a 20 20 20 20 6d e]]. }.. m
2ba0: 65 74 68 6f 64 20 64 72 6f 70 20 7b 7d 20 7b 0a ethod drop {} {.
2bb0: 09 6c 6f 67 20 77 72 69 74 65 20 38 20 63 73 65 .log write 8 cse
2bc0: 74 73 20 7b 44 72 6f 70 70 69 6e 67 20 24 73 65 ts {Dropping $se
2bd0: 6c 66 20 3d 20 5b 24 73 65 6c 66 20 73 74 72 5d lf = [$self str]
2be0: 7d 0a 0a 09 73 74 61 74 65 20 74 72 61 6e 73 61 }...state transa
2bf0: 63 74 69 6f 6e 20 7b 0a 09 20 20 20 20 73 74 61 ction {.. sta
2c00: 74 65 20 72 75 6e 20 7b 0a 09 09 44 45 4c 45 54 te run {...DELET
2c10: 45 20 46 52 4f 4d 20 63 68 61 6e 67 65 73 65 74 E FROM changeset
2c20: 20 20 20 57 48 45 52 45 20 63 69 64 20 3d 20 24 WHERE cid = $
2c30: 6d 79 69 64 3b 0a 09 09 44 45 4c 45 54 45 20 46 myid;...DELETE F
2c40: 52 4f 4d 20 63 73 69 74 65 6d 20 20 20 20 20 20 ROM csitem
2c50: 57 48 45 52 45 20 63 69 64 20 3d 20 24 6d 79 69 WHERE cid = $myi
2c60: 64 3b 0a 09 09 44 45 4c 45 54 45 20 46 52 4f 4d d;...DELETE FROM
2c70: 20 63 73 73 75 63 63 65 73 73 6f 72 20 57 48 45 cssuccessor WHE
2c80: 52 45 20 63 69 64 20 3d 20 24 6d 79 69 64 3b 0a RE cid = $myid;.
2c90: 09 20 20 20 20 7d 0a 09 7d 0a 09 66 6f 72 65 61 . }..}..forea
2ca0: 63 68 20 69 69 64 20 24 6d 79 69 74 65 6d 73 20 ch iid $myitems
2cb0: 7b 0a 09 20 20 20 20 73 65 74 20 6b 65 79 20 5b {.. set key [
2cc0: 6c 69 73 74 20 24 6d 79 74 79 70 65 20 24 69 69 list $mytype $ii
2cd0: 64 5d 0a 09 20 20 20 20 75 6e 73 65 74 20 6d 79 d].. unset my
2ce0: 69 74 65 6d 6d 61 70 28 24 6b 65 79 29 0a 09 20 itemmap($key)..
2cf0: 20 20 20 6c 6f 67 20 77 72 69 74 65 20 38 20 63 log write 8 c
2d00: 73 65 74 73 20 7b 4d 41 50 2d 20 69 74 65 6d 20 sets {MAP- item
2d10: 3c 24 6b 65 79 3e 20 24 73 65 6c 66 20 3d 20 5b <$key> $self = [
2d20: 24 73 65 6c 66 20 73 74 72 5d 7d 0a 09 7d 0a 09 $self str]}..}..
2d30: 73 65 74 20 70 6f 73 20 20 20 20 20 20 20 20 20 set pos
2d40: 20 5b 6c 73 65 61 72 63 68 20 2d 65 78 61 63 74 [lsearch -exact
2d50: 20 24 6d 79 63 68 61 6e 67 65 73 65 74 73 20 24 $mychangesets $
2d60: 73 65 6c 66 5d 0a 09 73 65 74 20 6d 79 63 68 61 self]..set mycha
2d70: 6e 67 65 73 65 74 73 20 5b 6c 72 65 70 6c 61 63 ngesets [lreplac
2d80: 65 20 24 6d 79 63 68 61 6e 67 65 73 65 74 73 20 e $mychangesets
2d90: 24 70 6f 73 20 24 70 6f 73 5d 0a 09 73 65 74 20 $pos $pos]..set
2da0: 70 6f 73 20 20 20 20 20 20 20 20 20 20 20 20 20 pos
2db0: 20 20 20 20 20 20 20 5b 6c 73 65 61 72 63 68 20 [lsearch
2dc0: 2d 65 78 61 63 74 20 24 6d 79 74 63 68 61 6e 67 -exact $mytchang
2dd0: 65 73 65 74 73 28 24 6d 79 74 79 70 65 29 20 24 esets($mytype) $
2de0: 73 65 6c 66 5d 0a 09 73 65 74 20 6d 79 74 63 68 self]..set mytch
2df0: 61 6e 67 65 73 65 74 73 28 24 6d 79 74 79 70 65 angesets($mytype
2e00: 29 20 5b 6c 72 65 70 6c 61 63 65 20 24 6d 79 74 ) [lreplace $myt
2e10: 63 68 61 6e 67 65 73 65 74 73 28 24 6d 79 74 79 changesets($myty
2e20: 70 65 29 20 24 70 6f 73 20 24 70 6f 73 5d 0a 0a pe) $pos $pos]..
2e30: 09 23 20 52 65 74 75 72 6e 20 74 68 65 20 6c 69 .# Return the li
2e40: 73 74 20 6f 66 20 70 72 65 64 65 63 65 73 73 6f st of predecesso
2e50: 72 73 20 73 6f 20 74 68 61 74 20 74 68 65 79 20 rs so that they
2e60: 63 61 6e 20 62 65 20 61 64 6a 75 73 74 65 64 2e can be adjusted.
2e70: 0a 09 72 65 74 75 72 6e 20 5b 73 74 72 75 63 74 ..return [struct
2e80: 3a 3a 6c 69 73 74 20 6d 61 70 20 5b 73 74 61 74 ::list map [stat
2e90: 65 20 72 75 6e 20 7b 0a 09 20 20 20 20 53 45 4c e run {.. SEL
2ea0: 45 43 54 20 63 69 64 0a 09 20 20 20 20 46 52 4f ECT cid.. FRO
2eb0: 4d 20 20 20 63 73 73 75 63 63 65 73 73 6f 72 0a M cssuccessor.
2ec0: 09 20 20 20 20 57 48 45 52 45 20 20 6e 69 64 20 . WHERE nid
2ed0: 3d 20 24 6d 79 69 64 0a 09 7d 5d 20 5b 6d 79 74 = $myid..}] [myt
2ee0: 79 70 65 6d 65 74 68 6f 64 20 6f 66 5d 5d 0a 20 ypemethod of]].
2ef0: 20 20 20 7d 0a 0a 20 20 20 20 6d 65 74 68 6f 64 }.. method
2f00: 20 72 65 70 6f 72 74 6c 6f 6f 70 20 7b 7b 6b 69 reportloop {{ki
2f10: 6c 6c 20 31 7d 7d 20 7b 0a 09 23 20 57 65 20 70 ll 1}} {..# We p
2f20: 72 69 6e 74 20 74 68 65 20 69 74 65 6d 73 20 77 rint the items w
2f30: 68 69 63 68 20 61 72 65 20 70 72 6f 64 75 63 69 hich are produci
2f40: 6e 67 20 74 68 65 20 6c 6f 6f 70 2c 20 61 6e 64 ng the loop, and
2f50: 20 68 6f 77 2e 0a 0a 09 73 65 74 20 68 64 72 20 how....set hdr
2f60: 22 53 65 6c 66 2d 72 65 66 65 72 65 6e 74 69 61 "Self-referentia
2f70: 6c 20 63 68 61 6e 67 65 73 65 74 20 5b 24 73 65 l changeset [$se
2f80: 6c 66 20 73 74 72 5d 20 5f 5f 5f 5f 5f 5f 5f 5f lf str] ________
2f90: 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 22 0a 09 73 65 74 __________"..set
2fa0: 20 66 74 72 20 5b 72 65 67 73 75 62 20 2d 61 6c ftr [regsub -al
2fb0: 6c 20 7b 5b 5e 20 09 5d 7d 20 24 68 64 72 20 7b l {[^ .]} $hdr {
2fc0: 5f 7d 5d 0a 0a 09 6c 6f 67 20 77 72 69 74 65 20 _}]...log write
2fd0: 30 20 63 73 65 74 73 20 24 68 64 72 0a 09 66 6f 0 csets $hdr..fo
2fe0: 72 65 61 63 68 20 7b 69 74 65 6d 20 6e 65 78 74 reach {item next
2ff0: 69 74 65 6d 7d 20 5b 24 6d 79 74 79 70 65 6f 62 item} [$mytypeob
3000: 6a 20 6c 6f 6f 70 73 20 24 6d 79 69 74 65 6d 73 j loops $myitems
3010: 5d 20 7b 0a 09 20 20 20 20 23 20 43 72 65 61 74 ] {.. # Creat
3020: 65 20 74 61 67 67 65 64 20 69 74 65 6d 73 20 66 e tagged items f
3030: 72 6f 6d 20 74 68 65 20 69 64 20 61 6e 64 20 6f rom the id and o
3040: 75 72 20 74 79 70 65 2e 0a 09 20 20 20 20 73 65 ur type... se
3050: 74 20 69 74 65 6d 20 20 20 20 20 5b 6c 69 73 74 t item [list
3060: 20 24 6d 79 74 79 70 65 20 20 24 69 74 65 6d 5d $mytype $item]
3070: 0a 09 20 20 20 20 73 65 74 20 6e 65 78 74 69 74 .. set nextit
3080: 65 6d 20 5b 6c 69 73 74 20 24 6d 79 74 79 70 65 em [list $mytype
3090: 20 24 6e 65 78 74 69 74 65 6d 5d 0a 09 20 20 20 $nextitem]..
30a0: 20 23 20 50 72 69 6e 74 61 62 6c 65 20 6c 61 62 # Printable lab
30b0: 65 6c 73 2e 0a 09 20 20 20 20 73 65 74 20 69 20 els... set i
30c0: 20 22 3c 5b 24 74 79 70 65 20 69 74 65 6d 73 74 "<[$type itemst
30d0: 72 20 24 69 74 65 6d 5d 3e 22 0a 09 20 20 20 20 r $item]>"..
30e0: 73 65 74 20 6e 20 20 22 3c 5b 24 74 79 70 65 20 set n "<[$type
30f0: 69 74 65 6d 73 74 72 20 24 6e 65 78 74 69 74 65 itemstr $nextite
3100: 6d 5d 3e 22 0a 09 20 20 20 20 73 65 74 20 6e 63 m]>".. set nc
3110: 73 20 24 6d 79 69 74 65 6d 6d 61 70 28 24 6e 65 s $myitemmap($ne
3120: 78 74 69 74 65 6d 29 0a 09 20 20 20 20 23 20 50 xtitem).. # P
3130: 72 69 6e 74 0a 09 20 20 20 20 6c 6f 67 20 77 72 rint.. log wr
3140: 69 74 65 20 30 20 63 73 65 74 73 20 7b 2a 20 24 ite 0 csets {* $
3150: 69 20 2d 2d 3e 20 24 6e 20 2d 2d 3e 20 63 73 20 i --> $n --> cs
3160: 5b 24 6e 63 73 20 73 74 72 5d 7d 0a 09 7d 0a 09 [$ncs str]}..}..
3170: 6c 6f 67 20 77 72 69 74 65 20 30 20 63 73 65 74 log write 0 cset
3180: 73 20 24 66 74 72 0a 0a 09 69 66 20 7b 21 24 6b s $ftr...if {!$k
3190: 69 6c 6c 7d 20 72 65 74 75 72 6e 0a 09 74 72 6f ill} return..tro
31a0: 75 62 6c 65 20 69 6e 74 65 72 6e 61 6c 20 22 5b uble internal "[
31b0: 24 73 65 6c 66 20 73 74 72 5d 20 64 65 70 65 6e $self str] depen
31c0: 64 73 20 6f 6e 20 69 74 73 65 6c 66 22 0a 09 72 ds on itself"..r
31d0: 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 eturn. }..
31e0: 20 6d 65 74 68 6f 64 20 70 75 73 68 74 6f 20 7b method pushto {
31f0: 72 65 70 6f 73 69 74 6f 72 79 20 64 61 74 65 20 repository date
3200: 72 73 74 61 74 65 7d 20 7b 0a 09 23 20 47 65 6e rstate} {..# Gen
3210: 65 72 61 74 65 20 61 6e 64 20 69 6d 70 6f 72 74 erate and import
3220: 20 74 68 65 20 6d 61 6e 69 66 65 73 74 20 66 6f the manifest fo
3230: 72 20 74 68 69 73 20 63 68 61 6e 67 65 73 65 74 r this changeset
3240: 2e 0a 09 23 0a 09 23 20 44 61 74 61 20 6e 65 65 ...#..# Data nee
3250: 64 65 64 3a 0a 09 23 20 2d 20 43 6f 6d 6d 69 74 ded:..# - Commit
3260: 20 6d 65 73 73 61 67 65 20 20 20 20 20 20 20 20 message
3270: 20 20 20 20 20 20 20 28 2d 2d 20 6d 79 73 72 63 (-- mysrc
3280: 69 64 20 2d 3e 20 72 65 70 6f 73 69 74 6f 72 79 id -> repository
3290: 20 6d 65 74 61 29 0a 09 23 20 2d 20 55 73 65 72 meta)..# - User
32a0: 20 64 6f 69 6e 67 20 74 68 65 20 63 6f 6d 6d 69 doing the commi
32b0: 74 20 20 20 20 20 20 20 20 28 73 2e 61 2e 29 0a t (s.a.).
32c0: 09 23 0a 09 23 20 2d 20 54 69 6d 65 73 74 61 6d .#..# - Timestam
32d0: 70 20 6f 66 20 77 68 65 6e 20 63 6f 6d 6d 69 74 p of when commit
32e0: 74 65 64 20 20 28 63 6f 6d 6d 61 6e 64 20 61 72 ted (command ar
32f0: 67 75 6d 65 6e 74 29 0a 09 23 0a 09 23 20 2d 20 gument)..#..# -
3300: 54 68 65 20 70 61 72 65 6e 74 20 63 68 61 6e 67 The parent chang
3310: 65 73 65 74 2c 20 69 66 20 61 6e 79 2e 20 49 66 eset, if any. If
3320: 20 74 68 65 72 65 20 69 73 20 6e 6f 20 70 61 72 there is no par
3330: 65 6e 74 20 66 6f 73 73 69 6c 0a 09 23 20 20 20 ent fossil..#
3340: 77 69 6c 6c 20 75 73 65 20 74 68 65 20 65 6d 70 will use the emp
3350: 74 79 20 62 61 73 65 20 72 65 76 69 73 69 6f 6e ty base revision
3360: 20 61 73 20 70 61 72 65 6e 74 2e 0a 09 23 0a 09 as parent...#..
3370: 23 20 2d 20 4c 69 73 74 20 6f 66 20 74 68 65 20 # - List of the
3380: 66 69 6c 65 20 72 65 76 69 73 69 6f 6e 73 20 69 file revisions i
3390: 6e 20 74 68 65 20 63 68 61 6e 67 65 73 65 74 2e n the changeset.
33a0: 0a 0a 09 73 74 72 75 63 74 3a 3a 6c 69 73 74 20 ...struct::list
33b0: 61 73 73 69 67 6e 20 5b 24 6d 79 70 72 6f 6a 65 assign [$myproje
33c0: 63 74 20 67 65 74 6d 65 74 61 20 24 6d 79 73 72 ct getmeta $mysr
33d0: 63 69 64 5d 20 5f 5f 20 62 72 61 6e 63 68 20 75 cid] __ branch u
33e0: 73 65 72 20 6d 65 73 73 61 67 65 0a 09 73 74 72 ser message..str
33f0: 75 63 74 3a 3a 6c 69 73 74 20 61 73 73 69 67 6e uct::list assign
3400: 20 24 62 72 61 6e 63 68 20 5f 5f 20 6c 6f 64 6e $branch __ lodn
3410: 61 6d 65 0a 0a 09 6c 6f 67 20 77 72 69 74 65 20 ame...log write
3420: 32 20 63 73 65 74 73 20 7b 49 6d 70 6f 72 74 69 2 csets {Importi
3430: 6e 67 20 72 65 76 69 73 69 6f 6e 20 5b 24 73 65 ng revision [$se
3440: 6c 66 20 73 74 72 5d 20 6f 6e 20 24 6c 6f 64 6e lf str] on $lodn
3450: 61 6d 65 7d 0a 0a 09 23 20 50 65 72 66 6f 72 6d ame}...# Perform
3460: 20 74 68 65 20 69 6d 70 6f 72 74 2e 20 41 73 20 the import. As
3470: 70 61 72 74 20 6f 66 20 74 68 61 74 20 77 65 20 part of that we
3480: 64 65 74 65 72 6d 69 6e 65 20 74 68 65 20 70 61 determine the pa
3490: 72 65 6e 74 0a 09 23 20 77 65 20 6e 65 65 64 2c rent..# we need,
34a0: 20 61 6e 64 20 63 6f 6e 76 65 72 74 20 74 68 65 and convert the
34b0: 20 6c 69 73 74 20 6f 66 20 69 74 65 6d 73 20 69 list of items i
34c0: 6e 20 74 68 65 20 63 68 61 6e 67 65 73 65 74 20 n the changeset
34d0: 69 6e 74 6f 0a 09 23 20 75 75 69 64 73 20 61 6e into..# uuids an
34e0: 64 20 70 72 69 6e 74 61 62 6c 65 20 64 61 74 61 d printable data
34f0: 2e 0a 0a 09 73 74 72 75 63 74 3a 3a 6c 69 73 74 ....struct::list
3500: 20 61 73 73 69 67 6e 20 5b 47 65 74 69 73 64 65 assign [Getisde
3510: 66 61 75 6c 74 20 24 6d 79 69 74 65 6d 73 5d 20 fault $myitems]
3520: 69 73 64 65 66 61 75 6c 74 20 6c 61 73 74 64 65 isdefault lastde
3530: 66 61 75 6c 74 6f 6e 74 72 75 6e 6b 0a 0a 09 6c faultontrunk...l
3540: 6f 67 20 77 72 69 74 65 20 38 20 63 73 65 74 73 og write 8 csets
3550: 20 7b 4c 4f 44 20 20 20 20 27 24 6c 6f 64 6e 61 {LOD '$lodna
3560: 6d 65 27 7d 0a 09 6c 6f 67 20 77 72 69 74 65 20 me'}..log write
3570: 38 20 63 73 65 74 73 20 7b 20 64 65 66 3f 20 20 8 csets { def?
3580: 24 69 73 64 65 66 61 75 6c 74 7d 0a 09 6c 6f 67 $isdefault}..log
3590: 20 77 72 69 74 65 20 38 20 63 73 65 74 73 20 7b write 8 csets {
35a0: 20 6c 61 73 74 3f 20 24 6c 61 73 74 64 65 66 61 last? $lastdefa
35b0: 75 6c 74 6f 6e 74 72 75 6e 6b 7d 0a 0a 09 73 65 ultontrunk}...se
35c0: 74 20 6c 77 73 20 20 5b 47 65 74 77 6f 72 6b 73 t lws [Getworks
35d0: 70 61 63 65 20 20 20 20 24 72 73 74 61 74 65 20 pace $rstate
35e0: 24 6c 6f 64 6e 61 6d 65 20 24 6d 79 70 72 6f 6a $lodname $myproj
35f0: 65 63 74 20 24 69 73 64 65 66 61 75 6c 74 5d 0a ect $isdefault].
3600: 09 24 6c 77 73 20 61 64 64 20 5b 47 65 74 72 65 .$lws add [Getre
3610: 76 69 73 69 6f 6e 69 6e 66 6f 20 24 6d 79 69 74 visioninfo $myit
3620: 65 6d 73 5d 0a 0a 09 73 65 74 20 75 75 69 64 20 ems]...set uuid
3630: 5b 24 72 65 70 6f 73 69 74 6f 72 79 20 69 6d 70 [$repository imp
3640: 6f 72 74 72 65 76 69 73 69 6f 6e 20 5b 24 73 65 ortrevision [$se
3650: 6c 66 20 73 74 72 5d 20 5c 0a 09 09 20 20 20 20 lf str] \...
3660: 20 20 24 75 73 65 72 20 24 6d 65 73 73 61 67 65 $user $message
3670: 20 24 64 61 74 65 20 5c 0a 09 09 20 20 20 20 20 $date \...
3680: 20 5b 24 6c 77 73 20 67 65 74 69 64 5d 20 5b 24 [$lws getid] [$
3690: 6c 77 73 20 67 65 74 5d 5d 0a 0a 09 23 20 52 65 lws get]]...# Re
36a0: 6d 65 6d 62 65 72 20 74 68 65 20 69 6d 70 6f 72 member the impor
36b0: 74 65 64 20 63 68 61 6e 67 65 73 65 74 20 69 6e ted changeset in
36c0: 20 74 68 65 20 73 74 61 74 65 2c 20 75 6e 64 65 the state, unde
36d0: 72 20 6f 75 72 0a 09 23 20 4c 4f 44 2e 20 41 6e r our..# LOD. An
36e0: 64 20 69 66 20 69 74 20 69 73 20 74 68 65 20 6c d if it is the l
36f0: 61 73 74 20 74 72 75 6e 6b 20 63 68 61 6e 67 65 ast trunk change
3700: 73 65 74 20 6f 6e 20 74 68 65 20 76 65 6e 64 6f set on the vendo
3710: 72 0a 09 23 20 62 72 61 6e 63 68 20 74 68 65 6e r..# branch then
3720: 20 74 68 65 20 72 65 76 69 73 69 6f 6e 20 69 73 the revision is
3730: 20 61 6c 73 6f 20 74 68 65 20 61 63 74 75 61 6c also the actual
3740: 20 72 6f 6f 74 20 6f 66 20 74 68 65 0a 09 23 20 root of the..#
3750: 3a 74 72 75 6e 6b 3a 2c 20 73 6f 20 77 65 20 72 :trunk:, so we r
3760: 65 6d 65 6d 62 65 72 20 69 74 20 61 73 20 73 75 emember it as su
3770: 63 68 20 69 6e 20 74 68 65 20 73 74 61 74 65 2e ch in the state.
3780: 20 48 6f 77 65 76 65 72 20 69 66 0a 09 23 20 74 However if..# t
3790: 68 65 20 74 72 75 6e 6b 20 61 6c 72 65 61 64 79 he trunk already
37a0: 20 65 78 69 73 74 73 20 74 68 65 6e 20 74 68 65 exists then the
37b0: 20 63 68 61 6e 67 65 73 65 74 20 63 61 6e 6e 6f changeset canno
37c0: 74 20 62 65 20 6f 6e 20 69 74 0a 09 23 20 61 6e t be on it..# an
37d0: 79 20 6d 6f 72 65 2e 20 54 68 69 73 20 69 6e 64 y more. This ind
37e0: 69 63 61 74 65 73 20 77 65 69 72 64 6e 65 73 73 icates weirdness
37f0: 20 69 6e 20 74 68 65 20 73 65 74 75 70 20 6f 66 in the setup of
3800: 20 74 68 65 0a 09 23 20 76 65 6e 64 6f 72 20 62 the..# vendor b
3810: 72 61 6e 63 68 2c 20 62 75 74 20 6f 6e 65 20 77 ranch, but one w
3820: 65 20 63 61 6e 20 77 6f 72 6b 20 61 72 6f 75 6e e can work aroun
3830: 64 2e 0a 0a 09 24 6c 77 73 20 64 65 66 69 64 20 d....$lws defid
3840: 24 75 75 69 64 0a 09 69 66 20 7b 24 6c 61 73 74 $uuid..if {$last
3850: 64 65 66 61 75 6c 74 6f 6e 74 72 75 6e 6b 7d 20 defaultontrunk}
3860: 7b 0a 09 20 20 20 20 69 66 20 7b 5b 24 72 73 74 {.. if {[$rst
3870: 61 74 65 20 68 61 73 20 3a 74 72 75 6e 6b 3a 5d ate has :trunk:]
3880: 7d 20 7b 0a 09 09 6c 6f 67 20 77 72 69 74 65 20 } {...log write
3890: 32 20 63 73 65 74 73 20 7b 4d 75 6c 74 69 70 6c 2 csets {Multipl
38a0: 65 20 63 68 61 6e 67 65 73 65 74 73 20 64 65 63 e changesets dec
38b0: 6c 61 72 65 64 20 74 6f 20 62 65 20 74 68 65 20 lared to be the
38c0: 6c 61 73 74 20 74 72 75 6e 6b 20 63 68 61 6e 67 last trunk chang
38d0: 65 73 65 74 20 6f 6e 20 74 68 65 20 76 65 6e 64 eset on the vend
38e0: 6f 72 2d 62 72 61 6e 63 68 7d 0a 09 20 20 20 20 or-branch}..
38f0: 7d 20 65 6c 73 65 20 7b 0a 09 09 24 72 73 74 61 } else {...$rsta
3900: 74 65 20 6e 65 77 20 3a 74 72 75 6e 6b 3a 20 5b te new :trunk: [
3910: 24 6c 77 73 20 6e 61 6d 65 5d 0a 09 20 20 20 20 $lws name]..
3920: 7d 0a 09 7d 0a 0a 09 23 20 52 65 6d 65 6d 62 65 }..}...# Remembe
3930: 72 20 74 68 65 20 77 68 6f 6c 65 20 63 68 61 6e r the whole chan
3940: 67 65 73 65 74 20 2f 20 75 75 69 64 20 6d 61 70 geset / uuid map
3950: 70 69 6e 67 2c 20 66 6f 72 20 74 68 65 20 74 61 ping, for the ta
3960: 67 73 2e 0a 0a 09 73 74 61 74 65 20 72 75 6e 20 gs....state run
3970: 7b 0a 09 20 20 20 20 49 4e 53 45 52 54 20 49 4e {.. INSERT IN
3980: 54 4f 20 63 73 75 75 69 64 20 28 63 69 64 2c 20 TO csuuid (cid,
3990: 20 20 75 75 69 64 29 0a 09 20 20 20 20 56 41 4c uuid).. VAL
39a0: 55 45 53 20 20 20 20 20 20 20 20 20 20 20 20 20 UES
39b0: 28 24 6d 79 69 64 2c 20 24 75 75 69 64 29 0a 09 ($myid, $uuid)..
39c0: 7d 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a }..return. }.
39d0: 0a 20 20 20 20 70 72 6f 63 20 47 65 74 72 65 76 . proc Getrev
39e0: 69 73 69 6f 6e 69 6e 66 6f 20 7b 72 65 76 69 73 isioninfo {revis
39f0: 69 6f 6e 73 7d 20 7b 0a 09 73 65 74 20 74 68 65 ions} {..set the
3a00: 73 65 74 20 28 27 5b 6a 6f 69 6e 20 24 72 65 76 set ('[join $rev
3a10: 69 73 69 6f 6e 73 20 7b 27 2c 27 7d 5d 27 29 0a isions {','}]').
3a20: 09 73 65 74 20 72 65 76 69 73 69 6f 6e 73 20 7b .set revisions {
3a30: 7d 0a 09 66 6f 72 65 61 63 68 20 7b 66 72 69 64 }..foreach {frid
3a40: 20 70 61 74 68 20 66 6e 61 6d 65 20 72 65 76 6e path fname revn
3a50: 72 7d 20 5b 73 74 61 74 65 20 72 75 6e 20 5b 73 r} [state run [s
3a60: 75 62 73 74 20 2d 6e 6f 63 6f 6d 6d 61 6e 64 73 ubst -nocommands
3a70: 20 2d 6e 6f 62 61 63 6b 73 6c 61 73 68 65 73 20 -nobackslashes
3a80: 7b 0a 09 20 20 20 20 53 45 4c 45 43 54 20 55 2e {.. SELECT U.
3a90: 75 75 69 64 2c 20 46 2e 76 69 73 69 62 6c 65 2c uuid, F.visible,
3aa0: 20 46 2e 6e 61 6d 65 2c 20 52 2e 72 65 76 0a 09 F.name, R.rev..
3ab0: 20 20 20 20 46 52 4f 4d 20 20 20 72 65 76 69 73 FROM revis
3ac0: 69 6f 6e 20 52 2c 20 72 65 76 75 75 69 64 20 55 ion R, revuuid U
3ad0: 2c 20 66 69 6c 65 20 46 0a 09 20 20 20 20 57 48 , file F.. WH
3ae0: 45 52 45 20 20 52 2e 72 69 64 20 49 4e 20 24 74 ERE R.rid IN $t
3af0: 68 65 73 65 74 20 20 2d 2d 20 41 6c 6c 20 73 70 heset -- All sp
3b00: 65 63 69 66 69 65 64 20 72 65 76 69 73 69 6f 6e ecified revision
3b10: 73 0a 09 20 20 20 20 41 4e 44 20 20 20 20 55 2e s.. AND U.
3b20: 72 69 64 20 3d 20 52 2e 72 69 64 20 20 20 20 20 rid = R.rid
3b30: 2d 2d 20 67 65 74 20 66 6f 73 73 69 6c 20 75 75 -- get fossil uu
3b40: 69 64 20 6f 66 20 72 65 76 69 73 69 6f 6e 0a 09 id of revision..
3b50: 20 20 20 20 41 4e 44 20 20 20 20 46 2e 66 69 64 AND F.fid
3b60: 20 3d 20 52 2e 66 69 64 20 20 20 20 20 2d 2d 20 = R.fid --
3b70: 67 65 74 20 66 69 6c 65 20 6f 66 20 72 65 76 69 get file of revi
3b80: 73 69 6f 6e 0a 09 7d 5d 5d 20 7b 0a 09 20 20 20 sion..}]] {..
3b90: 20 6c 61 70 70 65 6e 64 20 72 65 76 69 73 69 6f lappend revisio
3ba0: 6e 73 20 24 66 72 69 64 20 24 70 61 74 68 20 24 ns $frid $path $
3bb0: 66 6e 61 6d 65 2f 24 72 65 76 6e 72 0a 09 7d 0a fname/$revnr..}.
3bc0: 09 72 65 74 75 72 6e 20 24 72 65 76 69 73 69 6f .return $revisio
3bd0: 6e 73 0a 20 20 20 20 7d 0a 0a 20 20 20 20 70 72 ns. }.. pr
3be0: 6f 63 20 47 65 74 77 6f 72 6b 73 70 61 63 65 20 oc Getworkspace
3bf0: 7b 72 73 74 61 74 65 20 6c 6f 64 6e 61 6d 65 20 {rstate lodname
3c00: 70 72 6f 6a 65 63 74 20 69 73 64 65 66 61 75 6c project isdefaul
3c10: 74 7d 20 7b 0a 0a 09 23 20 54 68 65 20 73 74 61 t} {...# The sta
3c20: 74 65 20 6f 62 6a 65 63 74 20 68 6f 6c 64 73 20 te object holds
3c30: 74 68 65 20 77 6f 72 6b 73 70 61 63 65 20 73 74 the workspace st
3c40: 61 74 65 20 6f 66 20 65 61 63 68 20 6b 6e 6f 77 ate of each know
3c50: 6e 0a 09 23 20 6c 69 6e 65 2d 6f 66 2d 64 65 76 n..# line-of-dev
3c60: 65 6c 6f 70 6d 65 6e 74 20 28 4c 4f 44 29 2c 20 elopment (LOD),
3c70: 75 70 20 74 6f 20 74 68 65 20 6c 61 73 74 20 63 up to the last c
3c80: 6f 6d 6d 69 74 74 65 64 0a 09 23 20 63 68 61 6e ommitted..# chan
3c90: 67 65 73 65 74 20 62 65 6c 6f 6e 67 69 6e 67 20 geset belonging
3ca0: 74 6f 20 74 68 61 74 20 4c 4f 44 2e 0a 0a 09 23 to that LOD....#
3cb0: 20 28 2a 29 20 53 74 61 6e 64 61 72 64 20 68 61 (*) Standard ha
3cc0: 6e 64 6c 69 6e 67 20 69 66 20 69 6e 2d 4c 4f 44 ndling if in-LOD
3cd0: 20 63 68 61 6e 67 65 73 65 74 73 2e 20 49 66 20 changesets. If
3ce0: 74 68 65 20 4c 4f 44 20 6f 66 0a 09 23 20 20 20 the LOD of..#
3cf0: 20 20 74 68 65 20 63 75 72 72 65 6e 74 20 63 68 the current ch
3d00: 61 6e 67 65 73 65 74 20 65 78 69 73 74 73 20 69 angeset exists i
3d10: 6e 20 74 68 65 20 73 74 61 74 65 20 28 3d 20 68 n the state (= h
3d20: 61 73 20 62 65 65 6e 0a 09 23 20 20 20 20 20 63 as been..# c
3d30: 6f 6d 6d 69 74 74 65 64 20 74 6f 29 20 74 68 65 ommitted to) the
3d40: 6e 20 74 68 69 73 20 69 74 20 68 61 73 20 74 68 n this it has th
3d50: 65 20 77 6f 72 6b 73 70 61 63 65 20 77 65 20 61 e workspace we a
3d60: 72 65 0a 09 23 20 20 20 20 20 6c 6f 6f 6b 69 6e re..# lookin
3d70: 67 20 66 6f 72 2e 0a 0a 09 69 66 20 7b 5b 24 72 g for....if {[$r
3d80: 73 74 61 74 65 20 68 61 73 20 24 6c 6f 64 6e 61 state has $lodna
3d90: 6d 65 5d 7d 20 7b 0a 09 20 20 20 20 72 65 74 75 me]} {.. retu
3da0: 72 6e 20 5b 24 72 73 74 61 74 65 20 67 65 74 20 rn [$rstate get
3db0: 24 6c 6f 64 6e 61 6d 65 5d 0a 09 7d 0a 0a 09 23 $lodname]..}...#
3dc0: 20 49 66 20 74 68 65 20 4c 4f 44 20 69 73 20 68 If the LOD is h
3dd0: 6f 77 65 76 65 72 20 6e 6f 74 20 79 65 74 20 6b owever not yet k
3de0: 6e 6f 77 6e 2c 20 74 68 65 6e 20 74 68 65 20 63 nown, then the c
3df0: 75 72 72 65 6e 74 0a 09 23 20 63 68 61 6e 67 65 urrent..# change
3e00: 73 65 74 20 63 61 6e 20 62 65 20 65 69 74 68 65 set can be eithe
3e10: 72 20 6f 66 0a 09 23 20 28 61 29 20 72 6f 6f 74 r of..# (a) root
3e20: 20 6f 66 20 61 20 76 65 6e 64 6f 72 20 62 72 61 of a vendor bra
3e30: 6e 63 68 2c 0a 09 23 20 28 62 29 20 72 6f 6f 74 nch,..# (b) root
3e40: 20 6f 66 20 74 68 65 20 74 72 75 6e 6b 20 4c 4f of the trunk LO
3e50: 44 2c 20 6f 72 0a 09 23 20 28 63 29 20 74 68 65 D, or..# (c) the
3e60: 20 66 69 72 73 74 20 63 68 61 6e 67 65 73 65 74 first changeset
3e70: 20 69 6e 20 61 20 6e 65 77 20 4c 4f 44 20 77 68 in a new LOD wh
3e80: 69 63 68 20 77 61 73 20 73 70 61 77 6e 65 64 20 ich was spawned
3e90: 66 72 6f 6d 0a 09 23 20 20 20 20 20 61 6e 20 65 from..# an e
3ea0: 78 69 73 74 69 6e 67 20 4c 4f 44 2e 0a 0a 09 69 xisting LOD....i
3eb0: 66 20 7b 24 69 73 64 65 66 61 75 6c 74 20 7c 7c f {$isdefault ||
3ec0: 20 28 24 6c 6f 64 6e 61 6d 65 20 65 71 20 22 3a ($lodname eq ":
3ed0: 74 72 75 6e 6b 3a 22 29 7d 20 7b 0a 09 20 20 20 trunk:")} {..
3ee0: 20 23 20 46 6f 72 20 62 6f 74 68 20 28 61 29 20 # For both (a)
3ef0: 61 6e 64 20 28 62 29 20 77 65 20 68 61 76 65 20 and (b) we have
3f00: 74 6f 20 63 72 65 61 74 65 20 61 20 6e 65 77 20 to create a new
3f10: 77 6f 72 6b 73 70 61 63 65 0a 09 20 20 20 20 23 workspace.. #
3f20: 20 66 6f 72 20 74 68 65 20 6c 6f 64 2c 20 61 6e for the lod, an
3f30: 64 20 69 74 20 64 6f 65 73 6e 27 74 20 69 6e 68 d it doesn't inh
3f40: 65 72 69 74 20 66 72 6f 6d 20 61 6e 79 74 68 69 erit from anythi
3f50: 6e 67 2e 0a 0a 09 20 20 20 20 23 20 4e 6f 74 65 ng.... # Note
3f60: 20 74 68 61 74 20 63 61 73 65 20 28 62 29 20 6d that case (b) m
3f70: 61 79 20 6e 65 76 65 72 20 6f 63 63 75 72 2e 20 ay never occur.
3f80: 53 65 65 20 74 68 65 20 76 61 72 69 61 62 6c 65 See the variable
3f90: 0a 09 20 20 20 20 23 20 27 6c 61 73 74 64 65 66 .. # 'lastdef
3fa0: 61 75 6c 74 6f 6e 74 72 75 6e 6b 27 20 69 6e 20 aultontrunk' in
3fb0: 74 68 65 20 63 61 6c 6c 65 72 20 28 6d 65 74 68 the caller (meth
3fc0: 6f 64 20 70 75 73 68 74 6f 29 2e 20 54 68 69 73 od pushto). This
3fd0: 0a 09 20 20 20 20 23 20 66 6c 61 67 20 63 61 6e .. # flag can
3fe0: 20 74 68 65 20 67 65 6e 65 72 61 74 69 6f 6e 20 the generation
3ff0: 6f 66 20 74 68 65 20 77 6f 72 6b 73 70 61 63 65 of the workspace
4000: 20 66 6f 72 20 74 68 65 20 3a 74 72 75 6e 6b 3a for the :trunk:
4010: 0a 09 20 20 20 20 23 20 4c 4f 44 20 61 73 20 77 .. # LOD as w
4020: 65 6c 6c 2c 20 6d 61 6b 69 6e 67 20 69 74 20 69 ell, making it i
4030: 6e 68 65 72 69 74 20 74 68 65 20 73 74 61 74 65 nherit the state
4040: 20 6f 66 20 74 68 65 20 6c 61 73 74 0a 09 20 20 of the last..
4050: 20 20 23 20 74 72 75 6e 6b 2d 63 68 61 6e 67 65 # trunk-change
4060: 73 65 74 20 6f 6e 20 74 68 65 20 76 65 6e 64 6f set on the vendo
4070: 72 2d 62 72 61 6e 63 68 2e 0a 0a 09 20 20 20 20 r-branch....
4080: 72 65 74 75 72 6e 20 5b 24 72 73 74 61 74 65 20 return [$rstate
4090: 6e 65 77 20 24 6c 6f 64 6e 61 6d 65 5d 0a 09 7d new $lodname]..}
40a0: 0a 0a 09 23 20 43 61 73 65 20 28 63 29 2e 20 57 ...# Case (c). W
40b0: 65 20 66 69 6e 64 20 74 68 65 20 70 61 72 65 6e e find the paren
40c0: 74 20 4c 4f 44 20 6f 66 20 6f 75 72 20 4c 4f 44 t LOD of our LOD
40d0: 20 61 6e 64 20 6c 65 74 20 74 68 65 20 6e 65 77 and let the new
40e0: 0a 09 23 20 77 6f 72 6b 73 70 61 63 65 20 69 6e ..# workspace in
40f0: 68 65 72 69 74 20 66 72 6f 6d 20 74 68 65 20 70 herit from the p
4100: 61 72 65 6e 74 27 73 20 77 6f 72 6b 73 70 61 63 arent's workspac
4110: 65 2e 0a 0a 09 73 65 74 20 70 6c 6f 64 6e 61 6d e....set plodnam
4120: 65 20 5b 5b 5b 24 70 72 6f 6a 65 63 74 20 67 65 e [[[$project ge
4130: 74 73 79 6d 62 6f 6c 20 24 6c 6f 64 6e 61 6d 65 tsymbol $lodname
4140: 5d 20 70 61 72 65 6e 74 5d 20 6e 61 6d 65 5d 0a ] parent] name].
4150: 0a 09 6c 6f 67 20 77 72 69 74 65 20 38 20 63 73 ..log write 8 cs
4160: 65 74 73 20 7b 70 4c 4f 44 20 20 20 27 24 70 6c ets {pLOD '$pl
4170: 6f 64 6e 61 6d 65 27 7d 0a 0a 09 69 66 20 7b 5b odname'}...if {[
4180: 24 72 73 74 61 74 65 20 68 61 73 20 24 70 6c 6f $rstate has $plo
4190: 64 6e 61 6d 65 5d 7d 20 7b 0a 09 20 20 20 20 72 dname]} {.. r
41a0: 65 74 75 72 6e 20 5b 24 72 73 74 61 74 65 20 6e eturn [$rstate n
41b0: 65 77 20 24 6c 6f 64 6e 61 6d 65 20 24 70 6c 6f ew $lodname $plo
41c0: 64 6e 61 6d 65 5d 0a 09 7d 0a 0a 09 66 6f 72 65 dname]..}...fore
41d0: 61 63 68 20 6b 20 5b 6c 73 6f 72 74 20 5b 24 72 ach k [lsort [$r
41e0: 73 74 61 74 65 20 6e 61 6d 65 73 5d 5d 20 7b 0a state names]] {.
41f0: 09 20 20 20 20 6c 6f 67 20 77 72 69 74 65 20 38 . log write 8
4200: 20 63 73 65 74 73 20 7b 20 20 20 20 24 6b 20 3d csets { $k =
4210: 20 5b 5b 24 72 73 74 61 74 65 20 67 65 74 20 24 [[$rstate get $
4220: 6b 5d 20 67 65 74 69 64 5d 7d 0a 09 7d 0a 0a 09 k] getid]}..}...
4230: 74 72 6f 75 62 6c 65 20 69 6e 74 65 72 6e 61 6c trouble internal
4240: 20 7b 55 6e 61 62 6c 65 20 74 6f 20 64 65 74 65 {Unable to dete
4250: 72 6d 69 6e 65 20 63 68 61 6e 67 65 73 65 74 20 rmine changeset
4260: 70 61 72 65 6e 74 7d 0a 09 72 65 74 75 72 6e 0a parent}..return.
4270: 20 20 20 20 7d 0a 0a 20 20 20 20 70 72 6f 63 20 }.. proc
4280: 47 65 74 69 73 64 65 66 61 75 6c 74 20 7b 72 65 Getisdefault {re
4290: 76 69 73 69 6f 6e 73 7d 20 7b 0a 09 73 65 74 20 visions} {..set
42a0: 74 68 65 73 65 74 20 28 27 5b 6a 6f 69 6e 20 24 theset ('[join $
42b0: 72 65 76 69 73 69 6f 6e 73 20 7b 27 2c 27 7d 5d revisions {','}]
42c0: 27 29 0a 0a 09 73 74 72 75 63 74 3a 3a 6c 69 73 ')...struct::lis
42d0: 74 20 61 73 73 69 67 6e 20 5b 73 74 61 74 65 20 t assign [state
42e0: 72 75 6e 20 5b 73 75 62 73 74 20 2d 6e 6f 63 6f run [subst -noco
42f0: 6d 6d 61 6e 64 73 20 2d 6e 6f 62 61 63 6b 73 6c mmands -nobacksl
4300: 61 73 68 65 73 20 7b 0a 09 20 20 20 20 53 45 4c ashes {.. SEL
4310: 45 43 54 20 52 2e 69 73 64 65 66 61 75 6c 74 2c ECT R.isdefault,
4320: 20 52 2e 64 62 63 68 69 6c 64 0a 09 20 20 20 20 R.dbchild..
4330: 46 52 4f 4d 20 20 20 72 65 76 69 73 69 6f 6e 20 FROM revision
4340: 52 0a 09 20 20 20 20 57 48 45 52 45 20 20 52 2e R.. WHERE R.
4350: 72 69 64 20 49 4e 20 24 74 68 65 73 65 74 20 20 rid IN $theset
4360: 2d 2d 20 41 6c 6c 20 73 70 65 63 69 66 69 65 64 -- All specified
4370: 20 72 65 76 69 73 69 6f 6e 73 0a 09 20 20 20 20 revisions..
4380: 4c 49 4d 49 54 20 31 0a 09 7d 5d 5d 20 64 65 66 LIMIT 1..}]] def
4390: 20 6c 61 73 74 0a 0a 09 23 20 54 4f 44 4f 2f 43 last...# TODO/C
43a0: 48 45 43 4b 3a 20 6c 6f 6f 6b 20 66 6f 72 20 63 HECK: look for c
43b0: 68 61 6e 67 65 73 65 74 73 20 77 68 65 72 65 20 hangesets where
43c0: 69 73 64 65 66 61 75 6c 74 2f 64 62 63 68 69 6c isdefault/dbchil
43d0: 64 20 69 73 0a 09 23 20 61 6d 62 69 67 6f 75 73 d is..# ambigous
43e0: 2e 0a 0a 09 72 65 74 75 72 6e 20 5b 6c 69 73 74 ....return [list
43f0: 20 24 64 65 66 20 5b 65 78 70 72 20 7b 24 6c 61 $def [expr {$la
4400: 73 74 20 6e 65 20 22 22 7d 5d 5d 0a 20 20 20 20 st ne ""}]].
4410: 7d 0a 0a 20 20 20 20 74 79 70 65 6d 65 74 68 6f }.. typemetho
4420: 64 20 73 70 6c 69 74 20 7b 63 73 65 74 20 61 72 d split {cset ar
4430: 67 73 7d 20 7b 0a 09 23 20 41 73 20 70 61 72 74 gs} {..# As part
4440: 20 6f 66 20 74 68 65 20 63 72 65 61 74 69 6f 6e of the creation
4450: 20 6f 66 20 74 68 65 20 6e 65 77 20 63 68 61 6e of the new chan
4460: 67 65 73 65 74 73 20 73 70 65 63 69 66 69 65 64 gesets specified
4470: 20 69 6e 0a 09 23 20 41 52 47 53 20 61 73 20 73 in..# ARGS as s
4480: 65 74 73 20 6f 66 20 69 74 65 6d 73 2c 20 61 6c ets of items, al
4490: 6c 20 73 75 62 73 65 74 73 20 6f 66 20 43 53 45 l subsets of CSE
44a0: 54 27 73 20 69 74 65 6d 20 73 65 74 2c 20 43 53 T's item set, CS
44b0: 45 54 0a 09 23 20 77 69 6c 6c 20 62 65 20 64 72 ET..# will be dr
44c0: 6f 70 70 65 64 20 66 72 6f 6d 20 61 6c 6c 20 64 opped from all d
44d0: 61 74 61 62 61 73 65 73 2c 20 69 6e 20 61 6e 64 atabases, in and
44e0: 20 6f 75 74 20 6f 66 20 6d 65 6d 6f 72 79 2c 0a out of memory,.
44f0: 09 23 20 61 6e 64 20 74 68 65 6e 20 64 65 73 74 .# and then dest
4500: 72 6f 79 65 64 2e 0a 09 23 0a 09 23 20 4e 6f 74 royed...#..# Not
4510: 65 3a 20 54 68 65 20 69 74 65 6d 20 6c 69 73 74 e: The item list
4520: 73 20 66 6f 75 6e 64 20 69 6e 20 61 72 67 73 20 s found in args
4530: 61 72 65 20 74 61 67 67 65 64 20 69 74 65 6d 73 are tagged items
4540: 2e 20 54 68 65 79 0a 09 23 20 68 61 76 65 20 74 . They..# have t
4550: 6f 20 68 61 76 65 20 74 68 65 20 73 61 6d 65 20 o have the same
4560: 74 79 70 65 20 61 73 20 74 68 65 20 63 68 61 6e type as the chan
4570: 67 65 73 65 74 2c 20 62 65 69 6e 67 20 73 75 62 geset, being sub
4580: 73 65 74 73 0a 09 23 20 6f 66 20 69 74 73 20 69 sets..# of its i
4590: 74 65 6d 73 2e 20 54 68 69 73 20 69 73 20 63 68 tems. This is ch
45a0: 65 63 6b 65 64 20 69 6e 20 55 6e 74 61 67 31 2e ecked in Untag1.
45b0: 0a 0a 09 6c 6f 67 20 77 72 69 74 65 20 38 20 63 ...log write 8 c
45c0: 73 65 74 73 20 7b 4f 4c 44 3a 20 5b 6c 73 6f 72 sets {OLD: [lsor
45d0: 74 20 5b 24 63 73 65 74 20 69 74 65 6d 73 5d 5d t [$cset items]]
45e0: 7d 0a 09 56 61 6c 69 64 61 74 65 46 72 61 67 6d }..ValidateFragm
45f0: 65 6e 74 73 20 24 63 73 65 74 20 24 61 72 67 73 ents $cset $args
4600: 0a 0a 09 23 20 41 6c 6c 20 63 68 65 63 6b 73 20 ...# All checks
4610: 70 61 73 73 2c 20 61 63 74 75 61 6c 6c 79 20 70 pass, actually p
4620: 65 72 66 6f 72 6d 20 74 68 65 20 73 70 6c 69 74 erform the split
4630: 2e 0a 0a 09 73 74 72 75 63 74 3a 3a 6c 69 73 74 ....struct::list
4640: 20 61 73 73 69 67 6e 20 5b 24 63 73 65 74 20 64 assign [$cset d
4650: 61 74 61 5d 20 70 72 6f 6a 65 63 74 20 63 73 74 ata] project cst
4660: 79 70 65 20 63 73 73 72 63 0a 0a 09 73 65 74 20 ype cssrc...set
4670: 70 72 65 64 65 63 65 73 73 6f 72 73 20 5b 24 63 predecessors [$c
4680: 73 65 74 20 64 72 6f 70 5d 0a 09 24 63 73 65 74 set drop]..$cset
4690: 20 64 65 73 74 72 6f 79 0a 0a 09 73 65 74 20 6e destroy...set n
46a0: 65 77 63 73 65 74 73 20 7b 7d 0a 09 66 6f 72 65 ewcsets {}..fore
46b0: 61 63 68 20 66 72 61 67 6d 65 6e 74 69 74 65 6d ach fragmentitem
46c0: 73 20 24 61 72 67 73 20 7b 0a 09 20 20 20 20 6c s $args {.. l
46d0: 6f 67 20 77 72 69 74 65 20 38 20 63 73 65 74 73 og write 8 csets
46e0: 20 7b 4d 41 4b 45 3a 20 5b 6c 73 6f 72 74 20 24 {MAKE: [lsort $
46f0: 66 72 61 67 6d 65 6e 74 69 74 65 6d 73 5d 7d 0a fragmentitems]}.
4700: 0a 09 20 20 20 20 73 65 74 20 66 72 61 67 6d 65 .. set fragme
4710: 6e 74 20 5b 24 74 79 70 65 20 25 41 55 54 4f 25 nt [$type %AUTO%
4720: 20 24 70 72 6f 6a 65 63 74 20 24 63 73 74 79 70 $project $cstyp
4730: 65 20 24 63 73 73 72 63 20 5c 0a 09 09 09 20 20 e $cssrc \....
4740: 20 20 20 20 5b 55 6e 74 61 67 20 24 66 72 61 67 [Untag $frag
4750: 6d 65 6e 74 69 74 65 6d 73 20 24 63 73 74 79 70 mentitems $cstyp
4760: 65 5d 5d 0a 09 20 20 20 20 6c 61 70 70 65 6e 64 e]].. lappend
4770: 20 6e 65 77 63 73 65 74 73 20 24 66 72 61 67 6d newcsets $fragm
4780: 65 6e 74 0a 0a 09 20 20 20 20 24 66 72 61 67 6d ent... $fragm
4790: 65 6e 74 20 70 65 72 73 69 73 74 0a 09 20 20 20 ent persist..
47a0: 20 24 66 72 61 67 6d 65 6e 74 20 64 65 74 65 72 $fragment deter
47b0: 6d 69 6e 65 73 75 63 63 65 73 73 6f 72 73 0a 09 minesuccessors..
47c0: 7d 0a 0a 09 23 20 54 68 65 20 70 72 65 64 65 63 }...# The predec
47d0: 65 73 73 6f 72 73 20 68 61 76 65 20 74 6f 20 72 essors have to r
47e0: 65 63 6f 6d 70 75 74 65 20 74 68 65 69 72 20 73 ecompute their s
47f0: 75 63 63 65 73 73 6f 72 73 2c 20 69 2e 65 2e 0a uccessors, i.e..
4800: 09 23 20 72 65 6d 6f 76 65 20 74 68 65 20 64 72 .# remove the dr
4810: 6f 70 70 65 64 20 63 68 61 6e 67 65 73 65 74 20 opped changeset
4820: 61 6e 64 20 70 75 74 20 6f 6e 65 20 6f 66 20 74 and put one of t
4830: 68 65 20 66 72 61 67 6d 65 6e 74 73 0a 09 23 20 he fragments..#
4840: 69 6e 74 6f 20 69 74 73 20 70 6c 61 63 65 2e 0a into its place..
4850: 09 66 6f 72 65 61 63 68 20 70 20 24 70 72 65 64 .foreach p $pred
4860: 65 63 65 73 73 6f 72 73 20 7b 0a 09 20 20 20 20 ecessors {..
4870: 24 70 20 64 65 74 65 72 6d 69 6e 65 73 75 63 63 $p determinesucc
4880: 65 73 73 6f 72 73 0a 09 7d 0a 0a 09 72 65 74 75 essors..}...retu
4890: 72 6e 20 24 6e 65 77 63 73 65 74 73 0a 20 20 20 rn $newcsets.
48a0: 20 7d 0a 0a 20 20 20 20 74 79 70 65 6d 65 74 68 }.. typemeth
48b0: 6f 64 20 69 74 65 6d 73 74 72 20 7b 69 74 65 6d od itemstr {item
48c0: 7d 20 7b 0a 09 73 74 72 75 63 74 3a 3a 6c 69 73 } {..struct::lis
48d0: 74 20 61 73 73 69 67 6e 20 24 69 74 65 6d 20 69 t assign $item i
48e0: 74 79 70 65 20 69 69 64 0a 09 72 65 74 75 72 6e type iid..return
48f0: 20 5b 24 69 74 79 70 65 20 73 74 72 20 24 69 69 [$itype str $ii
4900: 64 5d 0a 20 20 20 20 7d 0a 0a 20 20 20 20 74 79 d]. }.. ty
4910: 70 65 6d 65 74 68 6f 64 20 73 74 72 6c 69 73 74 pemethod strlist
4920: 20 7b 63 68 61 6e 67 65 73 65 74 73 7d 20 7b 0a {changesets} {.
4930: 09 72 65 74 75 72 6e 20 5b 6a 6f 69 6e 20 5b 73 .return [join [s
4940: 74 72 75 63 74 3a 3a 6c 69 73 74 20 6d 61 70 20 truct::list map
4950: 24 63 68 61 6e 67 65 73 65 74 73 20 5b 6d 79 70 $changesets [myp
4960: 72 6f 63 20 49 44 5d 5d 5d 0a 20 20 20 20 7d 0a roc ID]]]. }.
4970: 0a 20 20 20 20 70 72 6f 63 20 49 44 20 7b 63 73 . proc ID {cs
4980: 65 74 7d 20 7b 20 24 63 73 65 74 20 73 74 72 20 et} { $cset str
4990: 7d 0a 0a 20 20 20 20 70 72 6f 63 20 55 6e 74 61 }.. proc Unta
49a0: 67 20 7b 74 61 67 67 65 64 69 74 65 6d 73 20 63 g {taggeditems c
49b0: 73 74 79 70 65 7d 20 7b 0a 09 72 65 74 75 72 6e stype} {..return
49c0: 20 5b 73 74 72 75 63 74 3a 3a 6c 69 73 74 20 6d [struct::list m
49d0: 61 70 20 24 74 61 67 67 65 64 69 74 65 6d 73 20 ap $taggeditems
49e0: 5b 6d 79 70 72 6f 63 20 55 6e 74 61 67 31 20 24 [myproc Untag1 $
49f0: 63 73 74 79 70 65 5d 5d 0a 20 20 20 20 7d 0a 0a cstype]]. }..
4a00: 20 20 20 20 70 72 6f 63 20 55 6e 74 61 67 31 20 proc Untag1
4a10: 7b 63 73 74 79 70 65 20 74 68 65 69 74 65 6d 7d {cstype theitem}
4a20: 20 7b 0a 09 73 74 72 75 63 74 3a 3a 6c 69 73 74 {..struct::list
4a30: 20 61 73 73 69 67 6e 20 24 74 68 65 69 74 65 6d assign $theitem
4a40: 20 74 20 69 0a 09 69 6e 74 65 67 72 69 74 79 20 t i..integrity
4a50: 61 73 73 65 72 74 20 7b 24 63 73 74 79 70 65 20 assert {$cstype
4a60: 65 71 20 24 74 7d 20 7b 49 74 65 6d 20 24 69 27 eq $t} {Item $i'
4a70: 73 20 74 79 70 65 20 69 73 20 27 24 74 27 2c 20 s type is '$t',
4a80: 65 78 70 65 63 74 65 64 20 27 24 63 73 74 79 70 expected '$cstyp
4a90: 65 27 7d 0a 09 72 65 74 75 72 6e 20 24 69 0a 20 e'}..return $i.
4aa0: 20 20 20 7d 0a 0a 20 20 20 20 70 72 6f 63 20 54 }.. proc T
4ab0: 61 67 49 74 65 6d 44 69 63 74 20 7b 69 74 65 6d agItemDict {item
4ac0: 64 69 63 74 20 63 73 74 79 70 65 7d 20 7b 0a 09 dict cstype} {..
4ad0: 73 65 74 20 72 65 73 20 7b 7d 0a 09 66 6f 72 65 set res {}..fore
4ae0: 61 63 68 20 7b 69 20 76 7d 20 24 69 74 65 6d 64 ach {i v} $itemd
4af0: 69 63 74 20 7b 20 6c 61 70 70 65 6e 64 20 72 65 ict { lappend re
4b00: 73 20 5b 6c 69 73 74 20 24 63 73 74 79 70 65 20 s [list $cstype
4b10: 24 69 5d 20 24 76 20 7d 0a 09 72 65 74 75 72 6e $i] $v }..return
4b20: 20 24 72 65 73 0a 20 20 20 20 7d 0a 0a 20 20 20 $res. }..
4b30: 20 70 72 6f 63 20 56 61 6c 69 64 61 74 65 46 72 proc ValidateFr
4b40: 61 67 6d 65 6e 74 73 20 7b 63 73 65 74 20 66 72 agments {cset fr
4b50: 61 67 6d 65 6e 74 73 7d 20 7b 0a 09 23 20 43 68 agments} {..# Ch
4b60: 65 63 6b 20 74 68 65 20 76 61 72 69 6f 75 73 20 eck the various
4b70: 69 6e 74 65 67 72 69 74 79 20 63 6f 6e 73 74 72 integrity constr
4b80: 61 69 6e 74 73 20 66 6f 72 20 74 68 65 20 66 72 aints for the fr
4b90: 61 67 6d 65 6e 74 73 0a 09 23 20 73 70 65 63 69 agments..# speci
4ba0: 66 79 69 6e 67 20 68 6f 77 20 74 6f 20 73 70 6c fying how to spl
4bb0: 69 74 20 74 68 65 20 63 68 61 6e 67 65 73 65 74 it the changeset
4bc0: 3a 0a 09 23 0a 09 23 20 2a 20 57 65 20 6d 75 73 :..#..# * We mus
4bd0: 74 20 68 61 76 65 20 74 77 6f 20 6f 72 20 6d 6f t have two or mo
4be0: 72 65 20 66 72 61 67 6d 65 6e 74 73 2c 20 61 73 re fragments, as
4bf0: 20 73 70 6c 69 74 74 69 6e 67 20 61 0a 09 23 20 splitting a..#
4c00: 20 20 63 68 61 6e 67 65 73 65 74 20 69 6e 74 6f changeset into
4c10: 20 6f 6e 65 20 6d 61 6b 65 73 20 6e 6f 20 73 65 one makes no se
4c20: 6e 73 65 2e 0a 09 23 20 2a 20 4e 6f 20 66 72 61 nse...# * No fra
4c30: 67 6d 65 6e 74 20 6d 61 79 20 62 65 20 65 6d 70 gment may be emp
4c40: 74 79 2e 0a 09 23 20 2a 20 41 6c 6c 20 66 72 61 ty...# * All fra
4c50: 67 6d 65 6e 74 73 20 68 61 76 65 20 74 6f 20 62 gments have to b
4c60: 65 20 74 72 75 65 20 73 75 62 73 65 74 73 20 6f e true subsets o
4c70: 66 20 74 68 65 20 69 74 65 6d 73 20 69 6e 20 74 f the items in t
4c80: 68 65 0a 09 23 20 20 20 63 68 61 6e 67 65 73 65 he..# changese
4c90: 74 20 74 6f 20 73 70 6c 69 74 2e 20 54 68 65 20 t to split. The
4ca0: 27 74 72 75 65 27 20 69 73 20 69 6d 70 6c 69 65 'true' is implie
4cb0: 64 20 62 65 63 61 75 73 65 20 6e 6f 6e 65 20 61 d because none a
4cc0: 72 65 0a 09 23 20 20 20 61 6c 6c 6f 77 65 64 20 re..# allowed
4cd0: 74 6f 20 62 65 20 65 6d 70 74 79 2c 20 73 6f 20 to be empty, so
4ce0: 65 61 63 68 20 68 61 73 20 74 6f 20 62 65 20 73 each has to be s
4cf0: 6d 61 6c 6c 65 72 20 74 68 61 6e 20 74 68 65 0a maller than the.
4d00: 09 23 20 20 20 74 6f 74 61 6c 2e 0a 09 23 20 2a .# total...# *
4d10: 20 54 68 65 20 75 6e 69 6f 6e 20 6f 66 20 74 68 The union of th
4d20: 65 20 66 72 61 67 6d 65 6e 74 73 20 68 61 73 20 e fragments has
4d30: 74 6f 20 62 65 20 74 68 65 20 69 74 65 6d 20 73 to be the item s
4d40: 65 74 20 6f 66 20 74 68 65 0a 09 23 20 20 20 63 et of the..# c
4d50: 68 61 6e 67 65 73 65 74 2e 0a 09 23 20 2a 20 54 hangeset...# * T
4d60: 68 65 20 66 72 61 67 6d 65 6e 74 20 6d 75 73 74 he fragment must
4d70: 20 6e 6f 74 20 6f 76 65 72 6c 61 70 2c 20 69 2e not overlap, i.
4d80: 65 2e 20 74 68 65 69 72 20 70 61 69 72 77 69 73 e. their pairwis
4d90: 65 0a 09 23 20 20 20 69 6e 74 65 72 73 65 63 74 e..# intersect
4da0: 69 6f 6e 73 20 68 61 76 65 20 74 6f 20 62 65 20 ions have to be
4db0: 65 6d 70 74 79 2e 0a 0a 09 73 65 74 20 63 6f 76 empty....set cov
4dc0: 65 72 20 7b 7d 0a 09 66 6f 72 65 61 63 68 20 66 er {}..foreach f
4dd0: 72 61 67 6d 65 6e 74 69 74 65 6d 73 20 24 66 72 ragmentitems $fr
4de0: 61 67 6d 65 6e 74 73 20 7b 0a 09 20 20 20 20 6c agments {.. l
4df0: 6f 67 20 77 72 69 74 65 20 38 20 63 73 65 74 73 og write 8 csets
4e00: 20 7b 4e 45 57 3a 20 5b 6c 73 6f 72 74 20 24 66 {NEW: [lsort $f
4e10: 72 61 67 6d 65 6e 74 69 74 65 6d 73 5d 7d 0a 0a ragmentitems]}..
4e20: 09 20 20 20 20 69 6e 74 65 67 72 69 74 79 20 61 . integrity a
4e30: 73 73 65 72 74 20 7b 0a 09 09 21 5b 73 74 72 75 ssert {...![stru
4e40: 63 74 3a 3a 73 65 74 20 65 6d 70 74 79 20 24 66 ct::set empty $f
4e50: 72 61 67 6d 65 6e 74 69 74 65 6d 73 5d 0a 09 20 ragmentitems]..
4e60: 20 20 20 7d 20 7b 63 68 61 6e 67 65 73 65 74 20 } {changeset
4e70: 66 72 61 67 6d 65 6e 74 20 69 73 20 65 6d 70 74 fragment is empt
4e80: 79 7d 0a 0a 09 20 20 20 20 69 6e 74 65 67 72 69 y}... integri
4e90: 74 79 20 61 73 73 65 72 74 20 7b 0a 09 09 5b 73 ty assert {...[s
4ea0: 74 72 75 63 74 3a 3a 73 65 74 20 73 75 62 73 65 truct::set subse
4eb0: 74 6f 66 20 24 66 72 61 67 6d 65 6e 74 69 74 65 tof $fragmentite
4ec0: 6d 73 20 5b 24 63 73 65 74 20 69 74 65 6d 73 5d ms [$cset items]
4ed0: 5d 0a 09 20 20 20 20 7d 20 7b 63 68 61 6e 67 65 ].. } {change
4ee0: 73 65 74 20 66 72 61 67 6d 65 6e 74 20 69 73 20 set fragment is
4ef0: 6e 6f 74 20 61 20 73 75 62 73 65 74 7d 0a 09 20 not a subset}..
4f00: 20 20 20 73 74 72 75 63 74 3a 3a 73 65 74 20 61 struct::set a
4f10: 64 64 20 63 6f 76 65 72 20 24 66 72 61 67 6d 65 dd cover $fragme
4f20: 6e 74 69 74 65 6d 73 0a 09 7d 0a 0a 09 69 6e 74 ntitems..}...int
4f30: 65 67 72 69 74 79 20 61 73 73 65 72 74 20 7b 0a egrity assert {.
4f40: 09 20 20 20 20 5b 73 74 72 75 63 74 3a 3a 73 65 . [struct::se
4f50: 74 20 65 71 75 61 6c 20 24 63 6f 76 65 72 20 5b t equal $cover [
4f60: 24 63 73 65 74 20 69 74 65 6d 73 5d 5d 0a 09 20 $cset items]]..
4f70: 7d 20 7b 54 68 65 20 66 72 61 67 6d 65 6e 74 73 } {The fragments
4f80: 20 64 6f 20 6e 6f 74 20 63 6f 76 65 72 20 74 68 do not cover th
4f90: 65 20 6f 72 69 67 69 6e 61 6c 20 63 68 61 6e 67 e original chang
4fa0: 65 73 65 74 7d 0a 0a 09 73 65 74 20 69 20 31 0a eset}...set i 1.
4fb0: 09 66 6f 72 65 61 63 68 20 66 69 61 20 24 66 72 .foreach fia $fr
4fc0: 61 67 6d 65 6e 74 73 20 7b 0a 09 20 20 20 20 66 agments {.. f
4fd0: 6f 72 65 61 63 68 20 66 69 62 20 5b 6c 72 61 6e oreach fib [lran
4fe0: 67 65 20 24 66 72 61 67 6d 65 6e 74 73 20 24 69 ge $fragments $i
4ff0: 20 65 6e 64 5d 20 7b 0a 09 09 69 6e 74 65 67 72 end] {...integr
5000: 69 74 79 20 61 73 73 65 72 74 20 7b 0a 09 09 20 ity assert {...
5010: 20 20 20 5b 73 74 72 75 63 74 3a 3a 73 65 74 20 [struct::set
5020: 65 6d 70 74 79 20 5b 73 74 72 75 63 74 3a 3a 73 empty [struct::s
5030: 65 74 20 69 6e 74 65 72 73 65 63 74 20 24 66 69 et intersect $fi
5040: 61 20 24 66 69 62 5d 5d 0a 09 09 7d 20 7b 54 68 a $fib]]...} {Th
5050: 65 20 66 72 61 67 6d 65 6e 74 73 20 3c 24 66 69 e fragments <$fi
5060: 61 3e 20 61 6e 64 20 3c 24 66 69 62 3e 20 6f 76 a> and <$fib> ov
5070: 65 72 6c 61 70 7d 0a 09 20 20 20 20 7d 0a 09 20 erlap}.. }..
5080: 20 20 20 69 6e 63 72 20 69 0a 09 7d 0a 0a 09 72 incr i..}...r
5090: 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 eturn. }..
50a0: 20 23 20 23 20 23 23 20 23 23 23 20 23 23 23 23 # # ## ### ####
50b0: 23 20 23 23 23 23 23 23 23 23 20 23 23 23 23 23 # ######## #####
50c0: 23 23 23 23 23 23 23 23 0a 20 20 20 20 23 23 20 ########. ##
50d0: 53 74 61 74 65 0a 0a 20 20 20 20 76 61 72 69 61 State.. varia
50e0: 62 6c 65 20 6d 79 69 64 20 20 20 20 20 20 20 20 ble myid
50f0: 7b 7d 20 3b 20 23 20 49 64 20 6f 66 20 74 68 65 {} ; # Id of the
5100: 20 63 73 65 74 20 66 6f 72 20 74 68 65 20 70 65 cset for the pe
5110: 72 73 69 73 74 65 6e 74 0a 09 09 09 20 20 20 20 rsistent....
5120: 20 20 23 20 73 74 61 74 65 2e 0a 20 20 20 20 76 # state.. v
5130: 61 72 69 61 62 6c 65 20 6d 79 70 72 6f 6a 65 63 ariable myprojec
5140: 74 20 20 20 7b 7d 20 3b 20 23 20 52 65 66 65 72 t {} ; # Refer
5150: 65 6e 63 65 20 6f 66 20 74 68 65 20 70 72 6f 6a ence of the proj
5160: 65 63 74 20 6f 62 6a 65 63 74 20 74 68 65 0a 09 ect object the..
5170: 09 09 20 20 20 20 20 20 23 20 63 68 61 6e 67 65 .. # change
5180: 73 65 74 20 62 65 6c 6f 6e 67 73 20 74 6f 2e 0a set belongs to..
5190: 20 20 20 20 76 61 72 69 61 62 6c 65 20 6d 79 74 variable myt
51a0: 79 70 65 20 20 20 20 20 20 7b 7d 20 3b 20 23 20 ype {} ; #
51b0: 57 68 61 74 20 74 68 65 20 63 68 61 6e 67 65 73 What the changes
51c0: 65 74 20 69 73 20 62 61 73 65 64 20 6f 6e 0a 09 et is based on..
51d0: 09 09 20 20 20 20 20 20 23 20 28 72 65 76 69 73 .. # (revis
51e0: 69 6f 6e 73 2c 20 74 61 67 73 2c 20 6f 72 20 62 ions, tags, or b
51f0: 72 61 6e 63 68 65 73 29 2e 0a 09 09 09 20 20 20 ranches).....
5200: 20 20 20 23 20 56 61 6c 75 65 73 3a 20 53 65 65 # Values: See
5210: 20 6d 79 63 73 74 79 70 65 2e 20 4e 6f 74 65 20 mycstype. Note
5220: 74 68 61 74 20 77 65 0a 09 09 09 20 20 20 20 20 that we....
5230: 20 23 20 68 61 76 65 20 74 6f 20 6b 65 65 70 20 # have to keep
5240: 74 68 65 20 6e 61 6d 65 73 20 6f 66 20 74 68 65 the names of the
5250: 20 68 65 6c 70 65 72 0a 09 09 09 20 20 20 20 20 helper....
5260: 20 23 20 73 69 6e 67 6c 65 74 6f 6e 73 20 69 6e # singletons in
5270: 20 73 79 6e 63 20 77 69 74 68 20 74 68 65 20 63 sync with the c
5280: 6f 6e 74 65 6e 74 73 0a 09 09 09 20 20 20 20 20 ontents....
5290: 20 23 20 6f 66 20 73 74 61 74 65 20 74 61 62 6c # of state tabl
52a0: 65 20 27 63 73 74 79 70 65 27 2c 20 61 6e 64 20 e 'cstype', and
52b0: 76 61 72 69 6f 75 73 0a 09 09 09 20 20 20 20 20 various....
52c0: 20 23 20 6f 74 68 65 72 20 70 6c 61 63 65 73 20 # other places
52d0: 75 73 69 6e 67 20 74 68 65 6d 20 68 61 72 64 77 using them hardw
52e0: 69 72 65 64 2e 0a 20 20 20 20 76 61 72 69 61 62 ired.. variab
52f0: 6c 65 20 6d 79 74 79 70 65 6f 62 6a 20 20 20 7b le mytypeobj {
5300: 7d 20 3b 20 23 20 52 65 66 65 72 65 6e 63 65 20 } ; # Reference
5310: 74 6f 20 74 68 65 20 63 6f 6e 74 61 69 6e 65 72 to the container
5320: 20 66 6f 72 20 74 68 65 0a 09 09 09 20 20 20 20 for the....
5330: 20 20 23 20 74 79 70 65 20 64 65 70 65 6e 64 65 # type depende
5340: 6e 74 20 63 6f 64 65 2e 20 44 65 72 69 76 65 64 nt code. Derived
5350: 20 66 72 6f 6d 0a 09 09 09 20 20 20 20 20 20 23 from.... #
5360: 20 6d 79 74 79 70 65 2e 0a 20 20 20 20 76 61 72 mytype.. var
5370: 69 61 62 6c 65 20 6d 79 73 72 63 69 64 20 20 20 iable mysrcid
5380: 20 20 7b 7d 20 3b 20 23 20 49 64 20 6f 66 20 74 {} ; # Id of t
5390: 68 65 20 6d 65 74 61 64 61 74 61 20 6f 72 20 73 he metadata or s
53a0: 79 6d 62 6f 6c 20 74 68 65 20 63 73 65 74 0a 09 ymbol the cset..
53b0: 09 09 20 20 20 20 20 20 23 20 69 73 20 62 61 73 .. # is bas
53c0: 65 64 20 6f 6e 2e 0a 20 20 20 20 76 61 72 69 61 ed on.. varia
53d0: 62 6c 65 20 6d 79 69 74 65 6d 73 20 20 20 20 20 ble myitems
53e0: 7b 7d 20 3b 20 23 20 4c 69 73 74 20 6f 66 20 74 {} ; # List of t
53f0: 68 65 20 66 69 6c 65 20 6c 65 76 65 6c 20 72 65 he file level re
5400: 76 69 73 69 6f 6e 73 2c 0a 09 09 09 20 20 20 20 visions,....
5410: 20 20 23 20 74 61 67 73 2c 20 6f 72 20 62 72 61 # tags, or bra
5420: 6e 63 68 65 73 20 69 6e 20 74 68 65 20 63 73 65 nches in the cse
5430: 74 2c 20 61 73 0a 09 09 09 20 20 20 20 20 20 23 t, as.... #
5440: 20 69 64 73 2e 20 4e 6f 74 20 74 61 67 67 65 64 ids. Not tagged
5450: 2e 0a 20 20 20 20 76 61 72 69 61 62 6c 65 20 6d .. variable m
5460: 79 74 69 74 65 6d 73 20 20 20 20 7b 7d 20 3b 20 ytitems {} ;
5470: 23 20 41 73 20 6d 79 69 74 65 6d 73 2c 20 74 68 # As myitems, th
5480: 65 20 74 61 67 67 65 64 20 66 6f 72 6d 2e 0a 20 e tagged form..
5490: 20 20 20 76 61 72 69 61 62 6c 65 20 6d 79 70 6f variable mypo
54a0: 73 20 20 20 20 20 20 20 7b 7d 20 3b 20 23 20 43 s {} ; # C
54b0: 6f 6d 6d 69 74 20 70 6f 73 69 74 69 6f 6e 20 6f ommit position o
54c0: 66 20 74 68 65 20 63 68 61 6e 67 65 73 65 74 2c f the changeset,
54d0: 20 69 66 0a 09 09 09 20 20 20 20 20 20 23 20 6b if.... # k
54e0: 6e 6f 77 6e 2e 0a 0a 20 20 20 20 23 20 23 20 23 nown... # # #
54f0: 23 20 23 23 23 20 23 23 23 23 23 20 23 23 23 23 # ### ##### ####
5500: 23 23 23 23 20 23 23 23 23 23 23 23 23 23 23 23 #### ###########
5510: 23 23 0a 20 20 20 20 23 23 20 49 6e 74 65 72 6e ##. ## Intern
5520: 61 6c 20 6d 65 74 68 6f 64 73 0a 0a 20 20 20 20 al methods..
5530: 74 79 70 65 76 61 72 69 61 62 6c 65 20 6d 79 63 typevariable myc
5540: 6f 75 6e 74 65 72 20 20 20 20 20 20 20 20 30 20 ounter 0
5550: 3b 20 23 20 49 64 20 63 6f 75 6e 74 65 72 20 66 ; # Id counter f
5560: 6f 72 20 63 73 65 74 73 2e 20 4c 61 73 74 20 69 or csets. Last i
5570: 64 0a 09 09 09 09 20 20 20 20 20 20 23 20 75 73 d..... # us
5580: 65 64 2e 0a 20 20 20 20 74 79 70 65 76 61 72 69 ed.. typevari
5590: 61 62 6c 65 20 6d 79 63 73 74 79 70 65 20 2d 61 able mycstype -a
55a0: 72 72 61 79 20 7b 7d 20 3b 20 23 20 4d 61 70 20 rray {} ; # Map
55b0: 63 73 74 79 70 65 73 20 28 6e 61 6d 65 73 29 20 cstypes (names)
55c0: 74 6f 20 70 65 72 73 69 73 74 65 6e 74 0a 09 09 to persistent...
55d0: 09 09 20 20 20 20 20 20 23 20 69 64 73 2e 20 4e .. # ids. N
55e0: 6f 74 65 20 74 68 61 74 20 77 65 20 68 61 76 65 ote that we have
55f0: 20 74 6f 20 6b 65 65 70 0a 09 09 09 09 20 20 20 to keep.....
5600: 20 20 20 23 20 74 68 65 20 6e 61 6d 65 73 20 69 # the names i
5610: 6e 20 74 68 65 20 74 61 62 6c 65 20 27 63 73 74 n the table 'cst
5620: 79 70 65 27 0a 09 09 09 09 20 20 20 20 20 20 23 ype'..... #
5630: 20 69 6e 20 73 79 6e 63 20 77 69 74 68 20 74 68 in sync with th
5640: 65 20 6e 61 6d 65 73 20 6f 66 20 74 68 65 0a 09 e names of the..
5650: 09 09 09 20 20 20 20 20 20 23 20 68 65 6c 70 65 ... # helpe
5660: 72 20 73 69 6e 67 6c 65 74 6f 6e 73 2e 0a 0a 20 r singletons...
5670: 20 20 20 74 79 70 65 6d 65 74 68 6f 64 20 69 6e typemethod in
5680: 6f 72 64 65 72 20 7b 70 72 6f 6a 65 63 74 69 64 order {projectid
5690: 7d 20 7b 0a 09 23 20 52 65 74 75 72 6e 20 61 6c } {..# Return al
56a0: 6c 20 72 65 76 69 73 69 6f 6e 20 63 68 61 6e 67 l revision chang
56b0: 65 73 65 74 73 20 66 6f 72 20 74 68 65 20 73 70 esets for the sp
56c0: 65 63 69 66 69 65 64 20 70 72 6f 6a 65 63 74 2c ecified project,
56d0: 20 69 6e 0a 09 23 20 74 68 65 20 6f 72 64 65 72 in..# the order
56e0: 20 67 69 76 65 6e 20 74 6f 20 74 68 65 6d 20 62 given to them b
56f0: 79 20 74 68 65 20 73 6f 72 74 20 70 61 73 73 65 y the sort passe
5700: 73 2e 20 42 6f 74 68 20 74 68 65 0a 09 23 20 66 s. Both the..# f
5710: 69 6c 74 65 72 69 6e 67 20 62 79 20 70 72 6f 6a iltering by proj
5720: 65 63 74 20 61 6e 64 20 73 6f 72 74 69 6e 67 20 ect and sorting
5730: 6d 61 6b 65 20 75 73 65 20 6f 66 20 27 70 72 6f make use of 'pro
5740: 6a 65 63 74 3a 3a 72 65 76 0a 09 23 20 72 65 76 ject::rev..# rev
5750: 27 20 69 6d 70 6f 73 73 69 62 6c 65 2e 0a 0a 09 ' impossible....
5760: 73 65 74 20 72 65 73 20 7b 7d 0a 09 66 6f 72 65 set res {}..fore
5770: 61 63 68 20 7b 63 69 64 20 63 64 61 74 65 7d 20 ach {cid cdate}
5780: 5b 73 74 61 74 65 20 72 75 6e 20 7b 0a 09 20 20 [state run {..
5790: 20 20 53 45 4c 45 43 54 20 43 2e 63 69 64 2c 20 SELECT C.cid,
57a0: 54 2e 64 61 74 65 0a 09 20 20 20 20 46 52 4f 4d T.date.. FROM
57b0: 20 20 20 63 68 61 6e 67 65 73 65 74 20 43 2c 20 changeset C,
57c0: 63 73 74 69 6d 65 73 74 61 6d 70 20 54 0a 09 20 cstimestamp T..
57d0: 20 20 20 57 48 45 52 45 20 20 43 2e 74 79 70 65 WHERE C.type
57e0: 20 3d 20 30 20 20 20 20 20 20 20 20 20 20 2d 2d = 0 --
57f0: 20 6c 69 6d 69 74 20 74 6f 20 72 65 76 69 73 69 limit to revisi
5800: 6f 6e 20 63 68 61 6e 67 65 73 65 74 73 0a 09 20 on changesets..
5810: 20 20 20 41 4e 44 20 20 20 20 43 2e 70 69 64 20 AND C.pid
5820: 20 3d 20 24 70 72 6f 6a 65 63 74 69 64 20 2d 2d = $projectid --
5830: 20 6c 69 6d 69 74 20 74 6f 20 63 68 61 6e 67 65 limit to change
5840: 73 65 74 73 20 69 6e 20 70 72 6f 6a 65 63 74 0a sets in project.
5850: 09 20 20 20 20 41 4e 44 20 20 20 20 54 2e 63 69 . AND T.ci
5860: 64 20 20 3d 20 43 2e 63 69 64 20 20 20 20 20 20 d = C.cid
5870: 2d 2d 20 67 65 74 20 6f 72 64 65 72 69 6e 67 20 -- get ordering
5880: 69 6e 66 6f 72 6d 61 74 69 6f 6e 0a 09 20 20 20 information..
5890: 20 4f 52 44 45 52 20 42 59 20 54 2e 64 61 74 65 ORDER BY T.date
58a0: 20 20 20 20 20 20 20 20 20 20 20 20 2d 2d 20 73 -- s
58b0: 6f 72 74 20 69 6e 74 6f 20 63 6f 6d 6d 69 74 20 ort into commit
58c0: 6f 72 64 65 72 0a 09 7d 5d 20 7b 0a 09 20 20 20 order..}] {..
58d0: 20 6c 61 70 70 65 6e 64 20 72 65 73 20 24 6d 79 lappend res $my
58e0: 69 64 6d 61 70 28 24 63 69 64 29 20 24 63 64 61 idmap($cid) $cda
58f0: 74 65 0a 09 7d 0a 09 72 65 74 75 72 6e 20 24 72 te..}..return $r
5900: 65 73 0a 20 20 20 20 7d 0a 0a 20 20 20 20 74 79 es. }.. ty
5910: 70 65 6d 65 74 68 6f 64 20 67 65 74 63 73 74 79 pemethod getcsty
5920: 70 65 73 20 7b 7d 20 7b 0a 09 66 6f 72 65 61 63 pes {} {..foreac
5930: 68 20 7b 74 69 64 20 6e 61 6d 65 7d 20 5b 73 74 h {tid name} [st
5940: 61 74 65 20 72 75 6e 20 7b 0a 09 20 20 20 20 53 ate run {.. S
5950: 45 4c 45 43 54 20 74 69 64 2c 20 6e 61 6d 65 20 ELECT tid, name
5960: 46 52 4f 4d 20 63 73 74 79 70 65 3b 0a 09 7d 5d FROM cstype;..}]
5970: 20 7b 20 73 65 74 20 6d 79 63 73 74 79 70 65 28 { set mycstype(
5980: 24 6e 61 6d 65 29 20 24 74 69 64 20 7d 0a 09 72 $name) $tid }..r
5990: 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 eturn. }..
59a0: 20 74 79 70 65 6d 65 74 68 6f 64 20 6c 6f 61 64 typemethod load
59b0: 20 7b 72 65 70 6f 73 69 74 6f 72 79 7d 20 7b 0a {repository} {.
59c0: 09 73 65 74 20 6e 20 30 0a 09 6c 6f 67 20 77 72 .set n 0..log wr
59d0: 69 74 65 20 32 20 63 73 65 74 73 20 7b 4c 6f 61 ite 2 csets {Loa
59e0: 64 69 6e 67 20 74 68 65 20 63 68 61 6e 67 65 73 ding the changes
59f0: 65 74 73 7d 0a 09 66 6f 72 65 61 63 68 20 7b 69 ets}..foreach {i
5a00: 64 20 70 69 64 20 63 73 74 79 70 65 20 73 72 63 d pid cstype src
5a10: 69 64 7d 20 5b 73 74 61 74 65 20 72 75 6e 20 7b id} [state run {
5a20: 0a 09 20 20 20 20 53 45 4c 45 43 54 20 43 2e 63 .. SELECT C.c
5a30: 69 64 2c 20 43 2e 70 69 64 2c 20 43 53 2e 6e 61 id, C.pid, CS.na
5a40: 6d 65 2c 20 43 2e 73 72 63 0a 09 20 20 20 20 46 me, C.src.. F
5a50: 52 4f 4d 20 20 20 63 68 61 6e 67 65 73 65 74 20 ROM changeset
5a60: 43 2c 20 63 73 74 79 70 65 20 43 53 0a 09 20 20 C, cstype CS..
5a70: 20 20 57 48 45 52 45 20 20 43 2e 74 79 70 65 20 WHERE C.type
5a80: 3d 20 43 53 2e 74 69 64 0a 09 20 20 20 20 4f 52 = CS.tid.. OR
5a90: 44 45 52 20 42 59 20 43 2e 63 69 64 0a 09 7d 5d DER BY C.cid..}]
5aa0: 20 7b 0a 09 20 20 20 20 6c 6f 67 20 70 72 6f 67 {.. log prog
5ab0: 72 65 73 73 20 32 20 63 73 65 74 73 20 24 6e 20 ress 2 csets $n
5ac0: 7b 7d 0a 09 20 20 20 20 73 65 74 20 72 20 5b 24 {}.. set r [$
5ad0: 74 79 70 65 20 25 41 55 54 4f 25 20 5b 24 72 65 type %AUTO% [$re
5ae0: 70 6f 73 69 74 6f 72 79 20 70 72 6f 6a 65 63 74 pository project
5af0: 6f 66 20 24 70 69 64 5d 20 24 63 73 74 79 70 65 of $pid] $cstype
5b00: 20 24 73 72 63 69 64 20 5b 73 74 61 74 65 20 72 $srcid [state r
5b10: 75 6e 20 7b 0a 09 09 53 45 4c 45 43 54 20 43 2e un {...SELECT C.
5b20: 69 69 64 0a 09 09 46 52 4f 4d 20 20 20 63 73 69 iid...FROM csi
5b30: 74 65 6d 20 43 0a 09 09 57 48 45 52 45 20 20 43 tem C...WHERE C
5b40: 2e 63 69 64 20 3d 20 24 69 64 0a 09 09 4f 52 44 .cid = $id...ORD
5b50: 45 52 20 42 59 20 43 2e 70 6f 73 0a 09 20 20 20 ER BY C.pos..
5b60: 20 7d 5d 20 24 69 64 5d 0a 09 20 20 20 20 69 6e }] $id].. in
5b70: 63 72 20 6e 0a 09 7d 0a 09 72 65 74 75 72 6e 0a cr n..}..return.
5b80: 20 20 20 20 7d 0a 0a 20 20 20 20 74 79 70 65 6d }.. typem
5b90: 65 74 68 6f 64 20 6c 6f 61 64 63 6f 75 6e 74 65 ethod loadcounte
5ba0: 72 20 7b 7d 20 7b 0a 09 23 20 49 6e 69 74 69 61 r {} {..# Initia
5bb0: 6c 69 7a 65 20 74 68 65 20 63 6f 75 6e 74 65 72 lize the counter
5bc0: 20 66 72 6f 6d 20 74 68 65 20 73 74 61 74 65 0a from the state.
5bd0: 09 6c 6f 67 20 77 72 69 74 65 20 32 20 63 73 65 .log write 2 cse
5be0: 74 73 20 7b 4c 6f 61 64 69 6e 67 20 63 68 61 6e ts {Loading chan
5bf0: 67 65 73 65 74 20 63 6f 75 6e 74 65 72 7d 0a 09 geset counter}..
5c00: 73 65 74 20 6d 79 63 6f 75 6e 74 65 72 20 5b 73 set mycounter [s
5c10: 74 61 74 65 20 6f 6e 65 20 7b 20 53 45 4c 45 43 tate one { SELEC
5c20: 54 20 4d 41 58 28 63 69 64 29 20 46 52 4f 4d 20 T MAX(cid) FROM
5c30: 63 68 61 6e 67 65 73 65 74 20 7d 5d 0a 09 72 65 changeset }]..re
5c40: 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 turn. }..
5c50: 74 79 70 65 6d 65 74 68 6f 64 20 6e 75 6d 20 7b typemethod num {
5c60: 7d 20 7b 20 72 65 74 75 72 6e 20 24 6d 79 63 6f } { return $myco
5c70: 75 6e 74 65 72 20 7d 0a 0a 20 20 20 20 70 72 6f unter }.. pro
5c80: 63 20 49 6e 69 74 69 61 6c 69 7a 65 42 72 65 61 c InitializeBrea
5c90: 6b 53 74 61 74 65 20 7b 72 65 76 69 73 69 6f 6e kState {revision
5ca0: 73 7d 20 7b 0a 09 75 70 76 61 72 20 31 20 70 6f s} {..upvar 1 po
5cb0: 73 20 70 6f 73 20 63 72 6f 73 73 20 63 72 6f 73 s pos cross cros
5cc0: 73 20 72 61 6e 67 65 20 72 61 6e 67 65 20 64 65 s range range de
5cd0: 70 63 20 64 65 70 63 20 64 65 6c 74 61 20 64 65 pc depc delta de
5ce0: 6c 74 61 20 5c 0a 09 20 20 20 20 64 65 70 65 6e lta \.. depen
5cf0: 64 65 6e 63 69 65 73 20 64 65 70 65 6e 64 65 6e dencies dependen
5d00: 63 69 65 73 0a 0a 09 23 20 46 69 72 73 74 20 77 cies...# First w
5d10: 65 20 63 72 65 61 74 65 20 61 20 6d 61 70 20 6f e create a map o
5d20: 66 20 70 6f 73 69 74 69 6f 6e 73 20 74 6f 20 6d f positions to m
5d30: 61 6b 65 20 69 74 20 65 61 73 69 65 72 20 74 6f ake it easier to
5d40: 0a 09 23 20 64 65 74 65 72 6d 69 6e 65 20 77 68 ..# determine wh
5d50: 65 74 68 65 72 20 61 20 64 65 70 65 6e 64 65 6e ether a dependen
5d60: 63 79 20 63 72 6f 73 73 65 73 20 61 20 70 61 72 cy crosses a par
5d70: 74 69 63 75 6c 61 72 20 69 6e 64 65 78 2e 0a 0a ticular index...
5d80: 09 61 72 72 61 79 20 73 65 74 20 70 6f 73 20 20 .array set pos
5d90: 20 7b 7d 0a 09 61 72 72 61 79 20 73 65 74 20 63 {}..array set c
5da0: 72 6f 73 73 20 7b 7d 0a 09 61 72 72 61 79 20 73 ross {}..array s
5db0: 65 74 20 64 65 70 63 20 20 7b 7d 0a 09 73 65 74 et depc {}..set
5dc0: 20 72 61 6e 67 65 20 20 20 20 20 20 20 7b 7d 0a range {}.
5dd0: 09 73 65 74 20 6e 20 30 0a 09 66 6f 72 65 61 63 .set n 0..foreac
5de0: 68 20 72 65 76 20 24 72 65 76 69 73 69 6f 6e 73 h rev $revisions
5df0: 20 7b 0a 09 20 20 20 20 6c 61 70 70 65 6e 64 20 {.. lappend
5e00: 72 61 6e 67 65 20 24 6e 0a 09 20 20 20 20 73 65 range $n.. se
5e10: 74 20 70 6f 73 28 24 72 65 76 29 20 24 6e 0a 09 t pos($rev) $n..
5e20: 20 20 20 20 73 65 74 20 63 72 6f 73 73 28 24 6e set cross($n
5e30: 29 20 30 0a 09 20 20 20 20 69 6e 63 72 20 6e 0a ) 0.. incr n.
5e40: 09 7d 0a 0a 09 23 20 53 65 63 6f 6e 64 6c 79 20 .}...# Secondly
5e50: 77 65 20 63 6f 75 6e 74 20 74 68 65 20 63 72 6f we count the cro
5e60: 73 73 69 6e 67 73 20 70 65 72 20 70 6f 73 69 74 ssings per posit
5e70: 69 6f 6e 2c 20 62 79 20 69 74 65 72 61 74 69 6e ion, by iteratin
5e80: 67 0a 09 23 20 6f 76 65 72 20 74 68 65 20 72 65 g..# over the re
5e90: 63 6f 72 64 65 64 20 69 6e 74 65 72 6e 61 6c 20 corded internal
5ea0: 64 65 70 65 6e 64 65 6e 63 69 65 73 2e 0a 0a 09 dependencies....
5eb0: 23 20 4e 6f 74 65 3a 20 49 66 20 74 68 65 20 74 # Note: If the t
5ec0: 69 6d 65 73 74 61 6d 70 73 20 61 72 65 20 62 61 imestamps are ba
5ed0: 64 6c 79 20 6f 75 74 20 6f 66 20 6f 72 64 65 72 dly out of order
5ee0: 20 69 74 20 69 73 0a 09 23 20 20 20 20 20 20 20 it is..#
5ef0: 70 6f 73 73 69 62 6c 65 20 74 6f 20 68 61 76 65 possible to have
5f00: 20 61 20 62 61 63 6b 77 61 72 64 20 73 75 63 63 a backward succ
5f10: 65 73 73 6f 72 20 64 65 70 65 6e 64 65 6e 63 79 essor dependency
5f20: 2c 0a 09 23 20 20 20 20 20 20 20 69 2e 65 2e 20 ,..# i.e.
5f30: 77 69 74 68 20 73 74 61 72 74 20 3e 20 65 6e 64 with start > end
5f40: 2e 20 57 65 20 6d 61 79 20 68 61 76 65 20 74 6f . We may have to
5f50: 20 73 77 61 70 20 74 68 65 20 69 6e 64 69 63 65 swap the indice
5f60: 73 0a 09 23 20 20 20 20 20 20 20 74 6f 20 65 6e s..# to en
5f70: 73 75 72 65 20 74 68 61 74 20 74 68 65 20 66 6f sure that the fo
5f80: 6c 6c 6f 77 69 6e 67 20 6c 6f 6f 70 20 72 75 6e llowing loop run
5f90: 73 20 63 6f 72 72 65 63 74 6c 79 2e 0a 09 23 0a s correctly...#.
5fa0: 09 23 20 4e 6f 74 65 20 32 3a 20 73 74 61 72 74 .# Note 2: start
5fb0: 20 3d 3d 20 65 6e 64 20 69 73 20 6e 6f 74 20 70 == end is not p
5fc0: 6f 73 73 69 62 6c 65 2e 20 49 74 20 69 6e 64 69 ossible. It indi
5fd0: 63 61 74 65 73 20 61 0a 09 23 20 20 20 20 20 20 cates a..#
5fe0: 20 20 20 73 65 6c 66 2d 64 65 70 65 6e 64 65 6e self-dependen
5ff0: 63 79 20 64 75 65 20 74 6f 20 74 68 65 20 75 6e cy due to the un
6000: 69 71 75 65 6e 65 73 73 20 6f 66 20 70 6f 73 69 iqueness of posi
6010: 74 69 6f 6e 73 2c 0a 09 23 20 20 20 20 20 20 20 tions,..#
6020: 20 20 61 6e 64 20 74 68 61 74 20 69 73 20 73 6f and that is so
6030: 6d 65 74 68 69 6e 67 20 77 65 20 68 61 76 65 20 mething we have
6040: 72 75 6c 65 64 20 6f 75 74 20 61 6c 72 65 61 64 ruled out alread
6050: 79 2c 20 73 65 65 0a 09 23 20 20 20 20 20 20 20 y, see..#
6060: 20 20 27 72 65 76 20 69 6e 74 65 72 6e 61 6c 73 'rev internals
6070: 75 63 63 65 73 73 6f 72 73 27 2e 0a 0a 09 66 6f uccessors'....fo
6080: 72 65 61 63 68 20 7b 72 69 64 20 63 68 69 6c 64 reach {rid child
6090: 72 65 6e 7d 20 5b 61 72 72 61 79 20 67 65 74 20 ren} [array get
60a0: 64 65 70 65 6e 64 65 6e 63 69 65 73 5d 20 7b 0a dependencies] {.
60b0: 09 20 20 20 20 66 6f 72 65 61 63 68 20 63 68 69 . foreach chi
60c0: 6c 64 20 24 63 68 69 6c 64 72 65 6e 20 7b 0a 09 ld $children {..
60d0: 09 73 65 74 20 64 6b 65 79 20 20 20 20 5b 6c 69 .set dkey [li
60e0: 73 74 20 24 72 69 64 20 24 63 68 69 6c 64 5d 0a st $rid $child].
60f0: 09 09 73 65 74 20 73 74 61 72 74 20 20 20 24 70 ..set start $p
6100: 6f 73 28 24 72 69 64 29 0a 09 09 73 65 74 20 65 os($rid)...set e
6110: 6e 64 20 20 20 20 20 24 70 6f 73 28 24 63 68 69 nd $pos($chi
6120: 6c 64 29 0a 09 09 73 65 74 20 63 72 6f 73 73 65 ld)...set crosse
6130: 73 20 7b 7d 0a 0a 09 09 69 66 20 7b 24 73 74 61 s {}....if {$sta
6140: 72 74 20 3e 20 24 65 6e 64 7d 20 7b 0a 09 09 20 rt > $end} {...
6150: 20 20 20 77 68 69 6c 65 20 7b 24 65 6e 64 20 3c while {$end <
6160: 20 24 73 74 61 72 74 7d 20 7b 0a 09 09 09 6c 61 $start} {....la
6170: 70 70 65 6e 64 20 63 72 6f 73 73 65 73 20 24 65 ppend crosses $e
6180: 6e 64 0a 09 09 09 69 6e 63 72 20 63 72 6f 73 73 nd....incr cross
6190: 28 24 65 6e 64 29 0a 09 09 09 69 6e 63 72 20 65 ($end)....incr e
61a0: 6e 64 0a 09 09 20 20 20 20 7d 0a 09 09 7d 20 65 nd... }...} e
61b0: 6c 73 65 20 7b 0a 09 09 20 20 20 20 77 68 69 6c lse {... whil
61c0: 65 20 7b 24 73 74 61 72 74 20 3c 20 24 65 6e 64 e {$start < $end
61d0: 7d 20 7b 0a 09 09 09 6c 61 70 70 65 6e 64 20 63 } {....lappend c
61e0: 72 6f 73 73 65 73 20 24 73 74 61 72 74 0a 09 09 rosses $start...
61f0: 09 69 6e 63 72 20 63 72 6f 73 73 28 24 73 74 61 .incr cross($sta
6200: 72 74 29 0a 09 09 09 69 6e 63 72 20 73 74 61 72 rt)....incr star
6210: 74 0a 09 09 20 20 20 20 7d 0a 09 09 7d 0a 09 09 t... }...}...
6220: 73 65 74 20 64 65 70 63 28 24 64 6b 65 79 29 20 set depc($dkey)
6230: 24 63 72 6f 73 73 65 73 0a 09 20 20 20 20 7d 0a $crosses.. }.
6240: 09 7d 0a 0a 09 49 6e 69 74 69 61 6c 69 7a 65 44 .}...InitializeD
6250: 65 6c 74 61 73 20 24 72 65 76 69 73 69 6f 6e 73 eltas $revisions
6260: 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a ..return. }..
6270: 20 20 20 20 70 72 6f 63 20 49 6e 69 74 69 61 6c proc Initial
6280: 69 7a 65 44 65 6c 74 61 73 20 7b 72 65 76 69 73 izeDeltas {revis
6290: 69 6f 6e 73 7d 20 7b 0a 09 75 70 76 61 72 20 31 ions} {..upvar 1
62a0: 20 64 65 6c 74 61 20 64 65 6c 74 61 0a 0a 09 23 delta delta...#
62b0: 20 50 75 6c 6c 20 74 68 65 20 74 69 6d 65 73 74 Pull the timest
62c0: 61 6d 70 73 20 66 6f 72 20 61 6c 6c 20 72 65 76 amps for all rev
62d0: 69 73 69 6f 6e 73 20 69 6e 20 74 68 65 20 63 68 isions in the ch
62e0: 61 6e 67 65 73 65 74 73 20 61 6e 64 0a 09 23 20 angesets and..#
62f0: 63 6f 6d 70 75 74 65 20 74 68 65 69 72 20 64 65 compute their de
6300: 6c 74 61 73 20 66 6f 72 20 75 73 65 20 62 79 20 ltas for use by
6310: 74 68 65 20 62 72 65 61 6b 20 66 69 6e 64 65 72 the break finder
6320: 2e 0a 0a 09 61 72 72 61 79 20 73 65 74 20 64 65 ....array set de
6330: 6c 74 61 20 7b 7d 0a 09 61 72 72 61 79 20 73 65 lta {}..array se
6340: 74 20 73 74 61 6d 70 20 7b 7d 0a 0a 09 73 65 74 t stamp {}...set
6350: 20 74 68 65 73 65 74 20 28 27 5b 6a 6f 69 6e 20 theset ('[join
6360: 24 72 65 76 69 73 69 6f 6e 73 20 7b 27 2c 27 7d $revisions {','}
6370: 5d 27 29 0a 09 66 6f 72 65 61 63 68 20 7b 72 69 ]')..foreach {ri
6380: 64 20 74 69 6d 65 7d 20 5b 73 74 61 74 65 20 72 d time} [state r
6390: 75 6e 20 5b 73 75 62 73 74 20 2d 6e 6f 63 6f 6d un [subst -nocom
63a0: 6d 61 6e 64 73 20 2d 6e 6f 62 61 63 6b 73 6c 61 mands -nobacksla
63b0: 73 68 65 73 20 7b 0a 09 20 20 20 20 53 45 4c 45 shes {.. SELE
63c0: 43 54 20 52 2e 72 69 64 2c 20 52 2e 64 61 74 65 CT R.rid, R.date
63d0: 0a 09 20 20 20 20 46 52 4f 4d 20 72 65 76 69 73 .. FROM revis
63e0: 69 6f 6e 20 52 0a 09 20 20 20 20 57 48 45 52 45 ion R.. WHERE
63f0: 20 52 2e 72 69 64 20 49 4e 20 24 74 68 65 73 65 R.rid IN $these
6400: 74 0a 09 7d 5d 5d 20 7b 0a 09 20 20 20 20 73 65 t..}]] {.. se
6410: 74 20 73 74 61 6d 70 28 24 72 69 64 29 20 24 74 t stamp($rid) $t
6420: 69 6d 65 0a 09 7d 0a 0a 09 73 65 74 20 6e 20 30 ime..}...set n 0
6430: 0a 09 66 6f 72 65 61 63 68 20 72 69 64 20 5b 6c ..foreach rid [l
6440: 72 61 6e 67 65 20 24 72 65 76 69 73 69 6f 6e 73 range $revisions
6450: 20 30 20 65 6e 64 2d 31 5d 20 72 6e 65 78 74 20 0 end-1] rnext
6460: 5b 6c 72 61 6e 67 65 20 24 72 65 76 69 73 69 6f [lrange $revisio
6470: 6e 73 20 31 20 65 6e 64 5d 20 7b 0a 09 20 20 20 ns 1 end] {..
6480: 20 73 65 74 20 64 65 6c 74 61 28 24 6e 29 20 5b set delta($n) [
6490: 65 78 70 72 20 7b 24 73 74 61 6d 70 28 24 72 6e expr {$stamp($rn
64a0: 65 78 74 29 20 2d 20 24 73 74 61 6d 70 28 24 72 ext) - $stamp($r
64b0: 69 64 29 7d 5d 0a 09 20 20 20 20 69 6e 63 72 20 id)}].. incr
64c0: 6e 0a 09 7d 0a 09 72 65 74 75 72 6e 0a 20 20 20 n..}..return.
64d0: 20 7d 0a 0a 20 20 20 20 70 72 6f 63 20 46 69 6e }.. proc Fin
64e0: 64 42 65 73 74 42 72 65 61 6b 20 7b 72 61 6e 67 dBestBreak {rang
64f0: 65 7d 20 7b 0a 09 75 70 76 61 72 20 31 20 63 72 e} {..upvar 1 cr
6500: 6f 73 73 20 63 72 6f 73 73 20 64 65 6c 74 61 20 oss cross delta
6510: 64 65 6c 74 61 0a 0a 09 23 20 44 65 74 65 72 6d delta...# Determ
6520: 69 6e 65 20 74 68 65 20 62 65 73 74 20 62 72 65 ine the best bre
6530: 61 6b 20 6c 6f 63 61 74 69 6f 6e 20 69 6e 20 74 ak location in t
6540: 68 65 20 67 69 76 65 6e 20 72 61 6e 67 65 20 6f he given range o
6550: 66 0a 09 23 20 70 6f 73 69 74 69 6f 6e 73 2e 20 f..# positions.
6560: 46 69 72 73 74 20 77 65 20 6c 6f 6f 6b 20 66 6f First we look fo
6570: 72 20 74 68 65 20 6c 6f 63 61 74 69 6f 6e 73 20 r the locations
6580: 77 69 74 68 20 74 68 65 20 6d 61 78 69 6d 61 6c with the maximal
6590: 0a 09 23 20 6e 75 6d 62 65 72 20 6f 66 20 63 72 ..# number of cr
65a0: 6f 73 73 69 6e 67 73 2e 20 49 66 20 74 68 65 72 ossings. If ther
65b0: 65 20 61 72 65 20 73 65 76 65 72 61 6c 20 77 65 e are several we
65c0: 20 6c 6f 6f 6b 20 66 6f 72 20 74 68 65 0a 09 23 look for the..#
65d0: 20 73 68 6f 72 74 65 73 74 20 74 69 6d 65 20 69 shortest time i
65e0: 6e 74 65 72 76 61 6c 20 61 6d 6f 6e 67 20 74 68 nterval among th
65f0: 65 6d 2e 20 49 66 20 77 65 20 73 74 69 6c 6c 20 em. If we still
6600: 68 61 76 65 20 6d 75 6c 74 69 70 6c 65 0a 09 23 have multiple..#
6610: 20 70 6f 73 73 69 62 69 6c 69 74 69 65 73 20 61 possibilities a
6620: 66 74 65 72 20 74 68 61 74 20 77 65 20 73 65 6c fter that we sel
6630: 65 63 74 20 74 68 65 20 65 61 72 6c 69 65 73 74 ect the earliest
6640: 20 6c 6f 63 61 74 69 6f 6e 0a 09 23 20 61 6d 6f location..# amo
6650: 6e 67 20 74 68 65 73 65 2e 0a 0a 09 23 20 4e 6f ng these....# No
6660: 74 65 3a 20 49 66 20 74 68 65 20 6d 61 78 69 6d te: If the maxim
6670: 61 6c 20 6e 75 6d 62 65 72 20 6f 66 20 63 72 6f al number of cro
6680: 73 73 69 6e 67 73 20 69 73 20 30 20 74 68 65 6e ssings is 0 then
6690: 20 74 68 65 20 72 61 6e 67 65 0a 09 23 20 20 20 the range..#
66a0: 20 20 20 20 68 61 73 20 6e 6f 20 69 6e 74 65 72 has no inter
66b0: 6e 61 6c 20 64 65 70 65 6e 64 65 6e 63 69 65 73 nal dependencies
66c0: 2c 20 61 6e 64 20 6e 6f 20 62 72 65 61 6b 20 6c , and no break l
66d0: 6f 63 61 74 69 6f 6e 20 61 74 0a 09 23 20 20 20 ocation at..#
66e0: 20 20 20 20 61 6c 6c 2e 20 54 68 69 73 20 70 6f all. This po
66f0: 73 73 69 62 69 6c 69 74 79 20 69 73 20 73 69 67 ssibility is sig
6700: 6e 61 6c 65 64 20 76 69 61 20 72 65 73 75 6c 74 naled via result
6710: 20 2d 31 2e 0a 0a 09 23 20 4e 6f 74 65 3a 20 41 -1....# Note: A
6720: 20 72 61 6e 67 65 20 6f 66 20 6c 65 6e 67 74 68 range of length
6730: 20 31 20 6f 72 20 6c 65 73 73 20 63 61 6e 6e 6f 1 or less canno
6740: 74 20 68 61 76 65 20 69 6e 74 65 72 6e 61 6c 0a t have internal.
6750: 09 23 20 20 20 20 20 20 20 64 65 70 65 6e 64 65 .# depende
6760: 6e 63 69 65 73 2c 20 61 73 20 74 68 61 74 20 6e ncies, as that n
6770: 65 65 64 73 20 61 74 20 6c 65 61 73 74 20 74 77 eeds at least tw
6780: 6f 20 72 65 76 69 73 69 6f 6e 73 20 69 6e 0a 09 o revisions in..
6790: 23 20 20 20 20 20 20 20 74 68 65 20 72 61 6e 67 # the rang
67a0: 65 2e 0a 0a 09 69 66 20 7b 5b 6c 6c 65 6e 67 74 e....if {[llengt
67b0: 68 20 24 72 61 6e 67 65 5d 20 3c 20 32 7d 20 7b h $range] < 2} {
67c0: 20 72 65 74 75 72 6e 20 2d 31 20 7d 0a 0a 09 73 return -1 }...s
67d0: 65 74 20 6d 61 78 20 2d 31 0a 09 73 65 74 20 62 et max -1..set b
67e0: 65 73 74 20 7b 7d 0a 0a 09 66 6f 72 65 61 63 68 est {}...foreach
67f0: 20 6c 6f 63 61 74 69 6f 6e 20 24 72 61 6e 67 65 location $range
6800: 20 7b 0a 09 20 20 20 20 73 65 74 20 63 72 6f 73 {.. set cros
6810: 73 69 6e 67 73 20 24 63 72 6f 73 73 28 24 6c 6f sings $cross($lo
6820: 63 61 74 69 6f 6e 29 0a 09 20 20 20 20 69 66 20 cation).. if
6830: 7b 24 63 72 6f 73 73 69 6e 67 73 20 3e 20 24 6d {$crossings > $m
6840: 61 78 7d 20 7b 0a 09 09 73 65 74 20 6d 61 78 20 ax} {...set max
6850: 20 24 63 72 6f 73 73 69 6e 67 73 0a 09 09 73 65 $crossings...se
6860: 74 20 62 65 73 74 20 5b 6c 69 73 74 20 24 6c 6f t best [list $lo
6870: 63 61 74 69 6f 6e 5d 0a 09 09 63 6f 6e 74 69 6e cation]...contin
6880: 75 65 0a 09 20 20 20 20 7d 20 65 6c 73 65 69 66 ue.. } elseif
6890: 20 7b 24 63 72 6f 73 73 69 6e 67 73 20 3d 3d 20 {$crossings ==
68a0: 24 6d 61 78 7d 20 7b 0a 09 09 6c 61 70 70 65 6e $max} {...lappen
68b0: 64 20 62 65 73 74 20 24 6c 6f 63 61 74 69 6f 6e d best $location
68c0: 0a 09 20 20 20 20 7d 0a 09 7d 0a 0a 09 69 66 20 .. }..}...if
68d0: 7b 24 6d 61 78 20 3d 3d 20 30 7d 20 20 20 20 20 {$max == 0}
68e0: 20 20 20 20 20 20 20 7b 20 72 65 74 75 72 6e 20 { return
68f0: 2d 31 20 7d 0a 09 69 66 20 7b 5b 6c 6c 65 6e 67 -1 }..if {[lleng
6900: 74 68 20 24 62 65 73 74 5d 20 3d 3d 20 31 7d 20 th $best] == 1}
6910: 7b 20 72 65 74 75 72 6e 20 5b 6c 69 6e 64 65 78 { return [lindex
6920: 20 24 62 65 73 74 20 30 5d 20 7d 0a 0a 09 73 65 $best 0] }...se
6930: 74 20 6c 6f 63 61 74 69 6f 6e 73 20 24 62 65 73 t locations $bes
6940: 74 0a 09 73 65 74 20 62 65 73 74 20 7b 7d 0a 09 t..set best {}..
6950: 73 65 74 20 6d 69 6e 20 2d 31 0a 0a 09 66 6f 72 set min -1...for
6960: 65 61 63 68 20 6c 6f 63 61 74 69 6f 6e 20 24 6c each location $l
6970: 6f 63 61 74 69 6f 6e 73 20 7b 0a 09 20 20 20 20 ocations {..
6980: 73 65 74 20 69 6e 74 65 72 76 61 6c 20 24 64 65 set interval $de
6990: 6c 74 61 28 24 6c 6f 63 61 74 69 6f 6e 29 0a 09 lta($location)..
69a0: 20 20 20 20 69 66 20 7b 28 24 6d 69 6e 20 3c 20 if {($min <
69b0: 30 29 20 7c 7c 20 28 24 69 6e 74 65 72 76 61 6c 0) || ($interval
69c0: 20 3c 20 24 6d 69 6e 29 7d 20 7b 0a 09 09 73 65 < $min)} {...se
69d0: 74 20 6d 69 6e 20 20 24 69 6e 74 65 72 76 61 6c t min $interval
69e0: 0a 09 09 73 65 74 20 62 65 73 74 20 5b 6c 69 73 ...set best [lis
69f0: 74 20 24 6c 6f 63 61 74 69 6f 6e 5d 0a 09 20 20 t $location]..
6a00: 20 20 7d 20 65 6c 73 65 69 66 20 7b 24 69 6e 74 } elseif {$int
6a10: 65 72 76 61 6c 20 3d 3d 20 24 6d 69 6e 7d 20 7b erval == $min} {
6a20: 0a 09 09 6c 61 70 70 65 6e 64 20 62 65 73 74 20 ...lappend best
6a30: 24 6c 6f 63 61 74 69 6f 6e 0a 09 20 20 20 20 7d $location.. }
6a40: 0a 09 7d 0a 0a 09 69 66 20 7b 5b 6c 6c 65 6e 67 ..}...if {[lleng
6a50: 74 68 20 24 62 65 73 74 5d 20 3d 3d 20 31 7d 20 th $best] == 1}
6a60: 7b 20 72 65 74 75 72 6e 20 5b 6c 69 6e 64 65 78 { return [lindex
6a70: 20 24 62 65 73 74 20 30 5d 20 7d 0a 0a 09 72 65 $best 0] }...re
6a80: 74 75 72 6e 20 5b 6c 69 6e 64 65 78 20 5b 6c 73 turn [lindex [ls
6a90: 6f 72 74 20 2d 69 6e 74 65 67 65 72 20 2d 69 6e ort -integer -in
6aa0: 63 72 65 61 73 69 6e 67 20 24 62 65 73 74 5d 20 creasing $best]
6ab0: 30 5d 0a 20 20 20 20 7d 0a 0a 20 20 20 20 70 72 0]. }.. pr
6ac0: 6f 63 20 43 75 74 41 74 20 7b 6c 6f 63 61 74 69 oc CutAt {locati
6ad0: 6f 6e 7d 20 7b 0a 09 75 70 76 61 72 20 31 20 63 on} {..upvar 1 c
6ae0: 72 6f 73 73 20 63 72 6f 73 73 20 64 65 70 63 20 ross cross depc
6af0: 64 65 70 63 0a 0a 09 23 20 49 74 20 77 61 73 20 depc...# It was
6b00: 64 65 63 69 64 65 64 20 74 6f 20 73 70 6c 69 74 decided to split
6b10: 20 74 68 65 20 63 68 61 6e 67 65 73 65 74 20 61 the changeset a
6b20: 74 20 74 68 65 20 67 69 76 65 6e 0a 09 23 20 6c t the given..# l
6b30: 6f 63 61 74 69 6f 6e 2e 20 54 68 69 73 20 63 75 ocation. This cu
6b40: 74 73 20 61 20 6e 75 6d 62 65 72 20 6f 66 20 64 ts a number of d
6b50: 65 70 65 6e 64 65 6e 63 69 65 73 2e 20 48 65 72 ependencies. Her
6b60: 65 20 77 65 20 75 70 64 61 74 65 0a 09 23 20 74 e we update..# t
6b70: 68 65 20 63 72 6f 73 73 20 69 6e 66 6f 72 6d 61 he cross informa
6b80: 74 69 6f 6e 20 73 6f 20 74 68 61 74 20 74 68 65 tion so that the
6b90: 20 62 72 65 61 6b 20 66 69 6e 64 65 72 20 68 61 break finder ha
6ba0: 73 20 61 63 63 75 72 61 74 65 0a 09 23 20 64 61 s accurate..# da
6bb0: 74 61 20 77 68 65 6e 20 77 65 20 6c 6f 6f 6b 20 ta when we look
6bc0: 61 74 20 74 68 65 20 67 65 6e 65 72 61 74 65 64 at the generated
6bd0: 20 66 72 61 67 6d 65 6e 74 73 2e 0a 0a 09 73 65 fragments....se
6be0: 74 20 73 69 78 20 5b 6c 6f 67 20 76 69 73 69 62 t six [log visib
6bf0: 6c 65 3f 20 36 5d 0a 0a 09 66 6f 72 65 61 63 68 le? 6]...foreach
6c00: 20 7b 64 65 70 20 72 61 6e 67 65 7d 20 5b 61 72 {dep range} [ar
6c10: 72 61 79 20 67 65 74 20 64 65 70 63 5d 20 7b 0a ray get depc] {.
6c20: 09 20 20 20 20 23 20 43 68 65 63 6b 20 61 6c 6c . # Check all
6c30: 20 64 65 70 65 6e 64 65 6e 63 69 65 73 20 73 74 dependencies st
6c40: 69 6c 6c 20 6b 6e 6f 77 6e 2c 20 74 61 6b 65 20 ill known, take
6c50: 74 68 65 69 72 20 72 61 6e 67 65 20 61 6e 64 0a their range and.
6c60: 09 20 20 20 20 23 20 73 65 65 20 69 66 20 74 68 . # see if th
6c70: 65 20 62 72 65 61 6b 20 6c 6f 63 61 74 69 6f 6e e break location
6c80: 20 66 61 6c 6c 73 20 77 69 74 68 69 6e 2e 0a 0a falls within...
6c90: 09 20 20 20 20 42 6f 72 64 65 72 20 24 72 61 6e . Border $ran
6ca0: 67 65 20 73 20 65 0a 09 20 20 20 20 69 66 20 7b ge s e.. if {
6cb0: 24 6c 6f 63 61 74 69 6f 6e 20 3c 20 24 73 7d 20 $location < $s}
6cc0: 63 6f 6e 74 69 6e 75 65 20 3b 20 23 20 62 72 65 continue ; # bre
6cd0: 61 6b 20 62 65 66 6f 72 65 20 72 61 6e 67 65 2c ak before range,
6ce0: 20 69 67 6e 6f 72 65 0a 09 20 20 20 20 69 66 20 ignore.. if
6cf0: 7b 24 6c 6f 63 61 74 69 6f 6e 20 3e 20 24 65 7d {$location > $e}
6d00: 20 63 6f 6e 74 69 6e 75 65 20 3b 20 23 20 62 72 continue ; # br
6d10: 65 61 6b 20 61 66 74 65 72 20 72 61 6e 67 65 2c eak after range,
6d20: 20 69 67 6e 6f 72 65 2e 0a 0a 09 20 20 20 20 23 ignore.... #
6d30: 20 54 68 69 73 20 64 65 70 65 6e 64 65 6e 63 79 This dependency
6d40: 20 63 72 6f 73 73 65 73 20 74 68 65 20 62 72 65 crosses the bre
6d50: 61 6b 20 6c 6f 63 61 74 69 6f 6e 2e 20 57 65 20 ak location. We
6d60: 72 65 6d 6f 76 65 20 69 74 0a 09 20 20 20 20 23 remove it.. #
6d70: 20 66 72 6f 6d 20 74 68 65 20 63 72 6f 73 73 69 from the crossi
6d80: 6e 67 73 20 63 6f 75 6e 74 65 72 73 2c 20 61 6e ngs counters, an
6d90: 64 20 74 68 65 6e 20 61 6c 73 6f 20 66 72 6f 6d d then also from
6da0: 20 74 68 65 20 73 65 74 0a 09 20 20 20 20 23 20 the set.. #
6db0: 6f 66 20 6b 6e 6f 77 6e 20 64 65 70 65 6e 64 65 of known depende
6dc0: 6e 63 69 65 73 2c 20 61 73 20 77 65 20 61 72 65 ncies, as we are
6dd0: 20 64 6f 6e 65 20 77 69 74 68 20 69 74 2e 0a 0a done with it...
6de0: 09 20 20 20 20 66 6f 72 65 61 63 68 20 6c 6f 63 . foreach loc
6df0: 20 24 64 65 70 63 28 24 64 65 70 29 20 7b 20 69 $depc($dep) { i
6e00: 6e 63 72 20 63 72 6f 73 73 28 24 6c 6f 63 29 20 ncr cross($loc)
6e10: 2d 31 20 7d 0a 09 20 20 20 20 75 6e 73 65 74 20 -1 }.. unset
6e20: 64 65 70 63 28 24 64 65 70 29 0a 0a 09 20 20 20 depc($dep)...
6e30: 20 69 66 20 7b 21 24 73 69 78 7d 20 63 6f 6e 74 if {!$six} cont
6e40: 69 6e 75 65 0a 0a 09 20 20 20 20 73 74 72 75 63 inue... struc
6e50: 74 3a 3a 6c 69 73 74 20 61 73 73 69 67 6e 20 24 t::list assign $
6e60: 64 65 70 20 70 61 72 65 6e 74 20 63 68 69 6c 64 dep parent child
6e70: 0a 09 20 20 20 20 6c 6f 67 20 77 72 69 74 65 20 .. log write
6e80: 35 20 63 73 65 74 73 20 22 42 72 6f 6b 65 20 64 5 csets "Broke d
6e90: 65 70 65 6e 64 65 6e 63 79 20 5b 50 44 20 24 70 ependency [PD $p
6ea0: 61 72 65 6e 74 5d 20 2d 2d 3e 20 5b 50 44 20 24 arent] --> [PD $
6eb0: 63 68 69 6c 64 5d 22 0a 09 7d 0a 0a 09 72 65 74 child]"..}...ret
6ec0: 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 23 urn. }.. #
6ed0: 20 50 72 69 6e 74 20 69 64 65 6e 74 69 66 79 69 Print identifyi
6ee0: 6e 67 20 64 61 74 61 20 66 6f 72 20 61 20 72 65 ng data for a re
6ef0: 76 69 73 69 6f 6e 20 28 70 72 6f 6a 65 63 74 2c vision (project,
6f00: 20 66 69 6c 65 2c 20 64 6f 74 74 65 64 20 72 65 file, dotted re
6f10: 76 0a 20 20 20 20 23 20 6e 75 6d 62 65 72 29 2c v. # number),
6f20: 20 66 6f 72 20 68 69 67 68 20 76 65 72 62 6f 73 for high verbos
6f30: 69 74 79 20 6c 6f 67 20 6f 75 74 70 75 74 2e 0a ity log output..
6f40: 20 20 20 20 23 20 54 4f 44 4f 3a 20 52 65 70 6c # TODO: Repl
6f50: 61 63 65 20 77 69 74 68 20 63 61 6c 6c 20 74 6f ace with call to
6f60: 20 69 74 65 6d 73 74 72 20 28 6c 69 73 74 20 72 itemstr (list r
6f70: 65 76 20 24 69 64 29 0a 0a 20 20 20 20 70 72 6f ev $id).. pro
6f80: 63 20 50 44 20 7b 69 64 7d 20 7b 0a 09 66 6f 72 c PD {id} {..for
6f90: 65 61 63 68 20 7b 70 20 66 20 72 7d 20 5b 73 74 each {p f r} [st
6fa0: 61 74 65 20 72 75 6e 20 7b 0a 09 09 53 45 4c 45 ate run {...SELE
6fb0: 43 54 20 50 2e 6e 61 6d 65 20 2c 20 46 2e 6e 61 CT P.name , F.na
6fc0: 6d 65 2c 20 52 2e 72 65 76 0a 09 09 46 52 4f 4d me, R.rev...FROM
6fd0: 20 72 65 76 69 73 69 6f 6e 20 52 2c 20 66 69 6c revision R, fil
6fe0: 65 20 46 2c 20 70 72 6f 6a 65 63 74 20 50 0a 09 e F, project P..
6ff0: 09 57 48 45 52 45 20 52 2e 72 69 64 20 3d 20 24 .WHERE R.rid = $
7000: 69 64 20 20 20 20 2d 2d 20 46 69 6e 64 20 73 70 id -- Find sp
7010: 65 63 69 66 69 65 64 20 66 69 6c 65 20 72 65 76 ecified file rev
7020: 69 73 69 6f 6e 0a 09 09 41 4e 44 20 20 20 46 2e ision...AND F.
7030: 66 69 64 20 3d 20 52 2e 66 69 64 20 20 2d 2d 20 fid = R.fid --
7040: 47 65 74 20 66 69 6c 65 20 6f 66 20 74 68 65 20 Get file of the
7050: 72 65 76 69 73 69 6f 6e 0a 09 09 41 4e 44 20 20 revision...AND
7060: 20 50 2e 70 69 64 20 3d 20 46 2e 70 69 64 20 20 P.pid = F.pid
7070: 2d 2d 20 47 65 74 20 70 72 6f 6a 65 63 74 20 6f -- Get project o
7080: 66 20 74 68 65 20 66 69 6c 65 2e 0a 09 7d 5d 20 f the file...}]
7090: 62 72 65 61 6b 0a 09 72 65 74 75 72 6e 20 22 27 break..return "'
70a0: 24 70 20 3a 20 24 66 2f 24 72 27 22 0a 20 20 20 $p : $f/$r'".
70b0: 20 7d 0a 0a 20 20 20 20 23 20 50 72 69 6e 74 69 }.. # Printi
70c0: 6e 67 20 6f 6e 65 20 6f 72 20 6d 6f 72 65 20 72 ng one or more r
70d0: 61 6e 67 65 73 2c 20 66 6f 72 6d 61 74 74 65 64 anges, formatted
70e0: 2c 20 61 6e 64 20 6f 6e 6c 79 20 74 68 65 69 72 , and only their
70f0: 20 62 6f 72 64 65 72 20 74 6f 0a 20 20 20 20 23 border to. #
7100: 20 6b 65 65 70 20 74 68 65 20 73 74 72 69 6e 67 keep the string
7110: 73 20 73 68 6f 72 74 2e 0a 0a 20 20 20 20 70 72 s short... pr
7120: 6f 63 20 50 52 73 20 7b 72 61 6e 67 65 73 7d 20 oc PRs {ranges}
7130: 7b 0a 09 72 65 74 75 72 6e 20 5b 73 74 72 75 63 {..return [struc
7140: 74 3a 3a 6c 69 73 74 20 6d 61 70 20 24 72 61 6e t::list map $ran
7150: 67 65 73 20 5b 6d 79 70 72 6f 63 20 50 52 5d 5d ges [myproc PR]]
7160: 0a 20 20 20 20 7d 0a 0a 20 20 20 20 70 72 6f 63 . }.. proc
7170: 20 50 52 20 7b 72 61 6e 67 65 7d 20 7b 0a 09 42 PR {range} {..B
7180: 6f 72 64 65 72 20 24 72 61 6e 67 65 20 73 20 65 order $range s e
7190: 0a 09 72 65 74 75 72 6e 20 3c 24 7b 73 7d 2e 2e ..return <${s}..
71a0: 2e 24 7b 65 7d 3e 0a 20 20 20 20 7d 0a 0a 20 20 .${e}>. }..
71b0: 20 20 70 72 6f 63 20 42 6f 72 64 65 72 20 7b 72 proc Border {r
71c0: 61 6e 67 65 20 73 76 20 65 76 7d 20 7b 0a 09 75 ange sv ev} {..u
71d0: 70 76 61 72 20 31 20 24 73 76 20 73 20 24 65 76 pvar 1 $sv s $ev
71e0: 20 65 0a 09 73 65 74 20 73 20 5b 6c 69 6e 64 65 e..set s [linde
71f0: 78 20 24 72 61 6e 67 65 20 30 5d 0a 09 73 65 74 x $range 0]..set
7200: 20 65 20 5b 6c 69 6e 64 65 78 20 24 72 61 6e 67 e [lindex $rang
7210: 65 20 65 6e 64 5d 0a 09 72 65 74 75 72 6e 0a 20 e end]..return.
7220: 20 20 20 7d 0a 0a 20 20 20 20 23 20 23 20 23 23 }.. # # ##
7230: 20 23 23 23 20 23 23 23 23 23 20 23 23 23 23 23 ### ##### #####
7240: 23 23 23 20 23 23 23 23 23 23 23 23 23 23 23 23 ### ############
7250: 23 0a 0a 20 20 20 20 74 79 70 65 76 61 72 69 61 #.. typevaria
7260: 62 6c 65 20 6d 79 63 68 61 6e 67 65 73 65 74 73 ble mychangesets
7270: 20 20 20 20 20 20 20 20 20 7b 7d 20 3b 20 23 20 {} ; #
7280: 4c 69 73 74 20 6f 66 20 61 6c 6c 20 6b 6e 6f 77 List of all know
7290: 6e 0a 09 09 09 09 09 20 20 20 23 20 63 68 61 6e n...... # chan
72a0: 67 65 73 65 74 73 2e 0a 20 20 20 20 74 79 70 65 gesets.. type
72b0: 76 61 72 69 61 62 6c 65 20 6d 79 74 63 68 61 6e variable mytchan
72c0: 67 65 73 65 74 73 20 2d 61 72 72 61 79 20 7b 7d gesets -array {}
72d0: 20 3b 20 23 20 4c 69 73 74 20 6f 66 20 61 6c 6c ; # List of all
72e0: 20 6b 6e 6f 77 6e 0a 09 09 09 09 09 20 20 20 23 known...... #
72f0: 20 63 68 61 6e 67 65 73 65 74 73 20 6f 66 20 61 changesets of a
7300: 20 74 79 70 65 2e 0a 20 20 20 20 74 79 70 65 76 type.. typev
7310: 61 72 69 61 62 6c 65 20 6d 79 69 74 65 6d 6d 61 ariable myitemma
7320: 70 20 20 20 20 20 2d 61 72 72 61 79 20 7b 7d 20 p -array {}
7330: 3b 20 23 20 4d 61 70 20 66 72 6f 6d 20 69 74 65 ; # Map from ite
7340: 6d 73 20 28 74 61 67 67 65 64 29 0a 09 09 09 09 ms (tagged).....
7350: 09 20 20 20 23 20 74 6f 20 74 68 65 20 6c 69 73 . # to the lis
7360: 74 20 6f 66 20 63 68 61 6e 67 65 73 65 74 73 0a t of changesets.
7370: 09 09 09 09 09 20 20 20 23 20 63 6f 6e 74 61 69 ..... # contai
7380: 6e 69 6e 67 20 69 74 2e 20 45 61 63 68 20 69 74 ning it. Each it
7390: 65 6d 0a 09 09 09 09 09 20 20 20 23 20 63 61 6e em...... # can
73a0: 20 62 65 20 75 73 65 64 20 62 79 20 6f 6e 6c 79 be used by only
73b0: 20 6f 6e 65 0a 09 09 09 09 09 20 20 20 23 20 63 one...... # c
73c0: 68 61 6e 67 65 73 65 74 2e 0a 20 20 20 20 74 79 hangeset.. ty
73d0: 70 65 76 61 72 69 61 62 6c 65 20 6d 79 69 64 6d pevariable myidm
73e0: 61 70 20 20 20 2d 61 72 72 61 79 20 7b 7d 20 3b ap -array {} ;
73f0: 20 23 20 4d 61 70 20 66 72 6f 6d 20 63 68 61 6e # Map from chan
7400: 67 65 73 65 74 20 69 64 20 74 6f 0a 09 09 09 09 geset id to.....
7410: 20 20 20 20 20 20 20 23 20 63 68 61 6e 67 65 73 # changes
7420: 65 74 2e 0a 0a 20 20 20 20 74 79 70 65 6d 65 74 et... typemet
7430: 68 6f 64 20 61 6c 6c 20 20 20 20 7b 7d 20 20 20 hod all {}
7440: 20 7b 20 72 65 74 75 72 6e 20 24 6d 79 63 68 61 { return $mycha
7450: 6e 67 65 73 65 74 73 20 7d 0a 20 20 20 20 74 79 ngesets }. ty
7460: 70 65 6d 65 74 68 6f 64 20 6f 66 20 20 20 20 20 pemethod of
7470: 7b 63 69 64 7d 20 7b 20 72 65 74 75 72 6e 20 24 {cid} { return $
7480: 6d 79 69 64 6d 61 70 28 24 63 69 64 29 20 7d 0a myidmap($cid) }.
7490: 20 20 20 20 74 79 70 65 6d 65 74 68 6f 64 20 6f typemethod o
74a0: 66 69 74 65 6d 20 7b 69 69 64 7d 20 7b 20 72 65 fitem {iid} { re
74b0: 74 75 72 6e 20 24 6d 79 69 74 65 6d 6d 61 70 28 turn $myitemmap(
74c0: 24 69 69 64 29 20 7d 0a 0a 20 20 20 20 74 79 70 $iid) }.. typ
74d0: 65 6d 65 74 68 6f 64 20 72 65 76 20 20 20 20 7b emethod rev {
74e0: 7d 20 20 20 20 7b 20 72 65 74 75 72 6e 20 24 6d } { return $m
74f0: 79 74 63 68 61 6e 67 65 73 65 74 73 28 72 65 76 ytchangesets(rev
7500: 29 20 7d 0a 20 20 20 20 74 79 70 65 6d 65 74 68 ) }. typemeth
7510: 6f 64 20 73 79 6d 20 20 20 20 7b 7d 20 20 20 20 od sym {}
7520: 7b 20 72 65 74 75 72 6e 20 5b 63 6f 6e 63 61 74 { return [concat
7530: 20 5c 0a 09 09 09 09 09 20 20 24 7b 6d 79 74 63 \...... ${mytc
7540: 68 61 6e 67 65 73 65 74 73 28 73 79 6d 3a 3a 62 hangesets(sym::b
7550: 72 61 6e 63 68 29 7d 20 5c 0a 09 09 09 09 09 20 ranch)} \......
7560: 20 24 7b 6d 79 74 63 68 61 6e 67 65 73 65 74 73 ${mytchangesets
7570: 28 73 79 6d 3a 3a 74 61 67 29 7d 5d 20 7d 0a 0a (sym::tag)}] }..
7580: 20 20 20 20 23 20 23 20 23 23 20 23 23 23 20 23 # # ## ### #
7590: 23 23 23 23 20 23 23 23 23 23 23 23 23 20 23 23 #### ######## ##
75a0: 23 23 23 23 23 23 23 23 23 23 23 0a 20 20 20 20 ###########.
75b0: 23 23 20 43 6f 6e 66 69 67 75 72 61 74 69 6f 6e ## Configuration
75c0: 0a 0a 20 20 20 20 70 72 61 67 6d 61 20 2d 68 61 .. pragma -ha
75d0: 73 74 79 70 65 69 6e 66 6f 20 20 20 20 6e 6f 20 stypeinfo no
75e0: 20 3b 20 23 20 6e 6f 20 74 79 70 65 20 69 6e 74 ; # no type int
75f0: 72 6f 73 70 65 63 74 69 6f 6e 0a 20 20 20 20 70 rospection. p
7600: 72 61 67 6d 61 20 2d 68 61 73 69 6e 66 6f 20 20 ragma -hasinfo
7610: 20 20 20 20 20 20 6e 6f 20 20 3b 20 23 20 6e 6f no ; # no
7620: 20 6f 62 6a 65 63 74 20 69 6e 74 72 6f 73 70 65 object introspe
7630: 63 74 69 6f 6e 0a 0a 20 20 20 20 23 20 23 20 23 ction.. # # #
7640: 23 20 23 23 23 20 23 23 23 23 23 20 23 23 23 23 # ### ##### ####
7650: 23 23 23 23 20 23 23 23 23 23 23 23 23 23 23 23 #### ###########
7660: 23 23 0a 7d 0a 0a 23 23 0a 23 23 20 4e 4f 54 45 ##.}..##.## NOTE
7670: 3a 20 54 68 65 20 73 75 63 63 65 73 73 6f 72 20 : The successor
7680: 61 6e 64 20 70 72 65 64 65 63 65 73 73 6f 72 20 and predecessor
7690: 6d 65 74 68 6f 64 73 20 64 65 66 69 6e 65 64 20 methods defined
76a0: 62 79 20 74 68 65 20 63 6c 61 73 73 65 73 0a 23 by the classes.#
76b0: 23 20 20 20 20 20 20 20 62 65 6c 6f 77 20 61 72 # below ar
76c0: 65 20 2d 2d 20 62 6f 74 74 6c 65 20 6e 65 63 6b e -- bottle neck
76d0: 73 20 2d 2d 2e 20 4c 6f 6f 6b 20 66 6f 72 20 77 s --. Look for w
76e0: 61 79 73 20 74 6f 20 6d 61 6b 65 20 74 68 65 20 ays to make the
76f0: 53 51 4c 0a 23 23 20 20 20 20 20 20 20 66 61 73 SQL.## fas
7700: 74 65 72 2e 0a 23 23 0a 0a 23 20 23 20 23 23 20 ter..##..# # ##
7710: 23 23 23 20 23 23 23 23 23 20 23 23 23 23 23 23 ### ##### ######
7720: 23 23 20 23 23 23 23 23 23 23 23 23 23 23 23 23 ## #############
7730: 20 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ###############
7740: 23 23 23 23 23 23 0a 23 23 20 48 65 6c 70 65 72 ######.## Helper
7750: 20 73 69 6e 67 6c 65 74 6f 6e 2e 20 43 6f 6d 6d singleton. Comm
7760: 61 6e 64 73 20 66 6f 72 20 72 65 76 69 73 69 6f ands for revisio
7770: 6e 20 63 68 61 6e 67 65 73 65 74 73 2e 0a 0a 73 n changesets...s
7780: 6e 69 74 3a 3a 74 79 70 65 20 3a 3a 76 63 3a 3a nit::type ::vc::
7790: 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a fossil::import::
77a0: 63 76 73 3a 3a 70 72 6f 6a 65 63 74 3a 3a 72 65 cvs::project::re
77b0: 76 3a 3a 72 65 76 20 7b 0a 20 20 20 20 74 79 70 v::rev {. typ
77c0: 65 6d 65 74 68 6f 64 20 62 79 72 65 76 69 73 69 emethod byrevisi
77d0: 6f 6e 20 7b 7d 20 7b 20 72 65 74 75 72 6e 20 31 on {} { return 1
77e0: 20 7d 0a 20 20 20 20 74 79 70 65 6d 65 74 68 6f }. typemetho
77f0: 64 20 62 79 73 79 6d 62 6f 6c 20 20 20 7b 7d 20 d bysymbol {}
7800: 7b 20 72 65 74 75 72 6e 20 30 20 7d 0a 20 20 20 { return 0 }.
7810: 20 74 79 70 65 6d 65 74 68 6f 64 20 69 73 74 61 typemethod ista
7820: 67 20 20 20 20 20 20 7b 7d 20 7b 20 72 65 74 75 g {} { retu
7830: 72 6e 20 30 20 7d 0a 20 20 20 20 74 79 70 65 6d rn 0 }. typem
7840: 65 74 68 6f 64 20 69 73 62 72 61 6e 63 68 20 20 ethod isbranch
7850: 20 7b 7d 20 7b 20 72 65 74 75 72 6e 20 30 20 7d {} { return 0 }
7860: 0a 0a 20 20 20 20 74 79 70 65 6d 65 74 68 6f 64 .. typemethod
7870: 20 73 74 72 20 7b 72 65 76 69 73 69 6f 6e 7d 20 str {revision}
7880: 7b 0a 09 73 74 72 75 63 74 3a 3a 6c 69 73 74 20 {..struct::list
7890: 61 73 73 69 67 6e 20 5b 73 74 61 74 65 20 72 75 assign [state ru
78a0: 6e 20 7b 0a 09 20 20 20 20 53 45 4c 45 43 54 20 n {.. SELECT
78b0: 52 2e 72 65 76 2c 20 46 2e 6e 61 6d 65 2c 20 50 R.rev, F.name, P
78c0: 2e 6e 61 6d 65 0a 09 20 20 20 20 46 52 4f 4d 20 .name.. FROM
78d0: 20 20 72 65 76 69 73 69 6f 6e 20 52 2c 20 66 69 revision R, fi
78e0: 6c 65 20 46 2c 20 70 72 6f 6a 65 63 74 20 50 0a le F, project P.
78f0: 09 20 20 20 20 57 48 45 52 45 20 20 52 2e 72 69 . WHERE R.ri
7900: 64 20 3d 20 24 72 65 76 69 73 69 6f 6e 20 2d 2d d = $revision --
7910: 20 46 69 6e 64 20 73 70 65 63 69 66 69 65 64 20 Find specified
7920: 66 69 6c 65 20 72 65 76 69 73 69 6f 6e 0a 09 20 file revision..
7930: 20 20 20 41 4e 44 20 20 20 20 46 2e 66 69 64 20 AND F.fid
7940: 3d 20 52 2e 66 69 64 20 20 20 20 20 2d 2d 20 47 = R.fid -- G
7950: 65 74 20 66 69 6c 65 20 6f 66 20 74 68 65 20 72 et file of the r
7960: 65 76 69 73 69 6f 6e 0a 09 20 20 20 20 41 4e 44 evision.. AND
7970: 20 20 20 20 50 2e 70 69 64 20 3d 20 46 2e 70 69 P.pid = F.pi
7980: 64 20 20 20 20 20 2d 2d 20 47 65 74 20 70 72 6f d -- Get pro
7990: 6a 65 63 74 20 6f 66 20 74 68 65 20 66 69 6c 65 ject of the file
79a0: 2e 0a 09 7d 5d 20 72 65 76 6e 72 20 66 6e 61 6d ...}] revnr fnam
79b0: 65 20 70 6e 61 6d 65 0a 09 72 65 74 75 72 6e 20 e pname..return
79c0: 22 24 70 6e 61 6d 65 2f 24 7b 72 65 76 6e 72 7d "$pname/${revnr}
79d0: 3a 3a 24 66 6e 61 6d 65 22 0a 20 20 20 20 7d 0a ::$fname". }.
79e0: 0a 20 20 20 20 23 20 72 65 73 75 6c 74 20 3d 20 . # result =
79f0: 6c 69 73 74 20 28 6d 69 6e 74 69 6d 65 2c 20 6d list (mintime, m
7a00: 61 78 74 69 6d 65 29 0a 20 20 20 20 74 79 70 65 axtime). type
7a10: 6d 65 74 68 6f 64 20 74 69 6d 65 72 61 6e 67 65 method timerange
7a20: 20 7b 69 74 65 6d 73 7d 20 7b 0a 09 73 65 74 20 {items} {..set
7a30: 74 68 65 73 65 74 20 28 27 5b 6a 6f 69 6e 20 24 theset ('[join $
7a40: 69 74 65 6d 73 20 7b 27 2c 27 7d 5d 27 29 0a 09 items {','}]')..
7a50: 72 65 74 75 72 6e 20 5b 73 74 61 74 65 20 72 75 return [state ru
7a60: 6e 20 5b 73 75 62 73 74 20 2d 6e 6f 63 6f 6d 6d n [subst -nocomm
7a70: 61 6e 64 73 20 2d 6e 6f 62 61 63 6b 73 6c 61 73 ands -nobackslas
7a80: 68 65 73 20 7b 0a 09 20 20 20 20 53 45 4c 45 43 hes {.. SELEC
7a90: 54 20 4d 49 4e 28 52 2e 64 61 74 65 29 2c 20 4d T MIN(R.date), M
7aa0: 41 58 28 52 2e 64 61 74 65 29 0a 09 20 20 20 20 AX(R.date)..
7ab0: 46 52 4f 4d 20 72 65 76 69 73 69 6f 6e 20 52 0a FROM revision R.
7ac0: 09 20 20 20 20 57 48 45 52 45 20 52 2e 72 69 64 . WHERE R.rid
7ad0: 20 49 4e 20 24 74 68 65 73 65 74 20 2d 2d 20 52 IN $theset -- R
7ae0: 65 73 74 72 69 63 74 20 74 6f 20 72 65 76 69 73 estrict to revis
7af0: 69 6f 6e 73 20 6f 66 20 69 6e 74 65 72 65 73 74 ions of interest
7b00: 0a 09 7d 5d 5d 0a 20 20 20 20 7d 0a 0a 20 20 20 ..}]]. }..
7b10: 20 23 20 76 61 72 28 64 76 29 20 3d 20 64 69 63 # var(dv) = dic
7b20: 74 20 28 72 65 76 69 73 69 6f 6e 20 2d 3e 20 6c t (revision -> l
7b30: 69 73 74 20 28 72 65 76 69 73 69 6f 6e 29 29 0a ist (revision)).
7b40: 20 20 20 20 74 79 70 65 6d 65 74 68 6f 64 20 69 typemethod i
7b50: 6e 74 65 72 6e 61 6c 73 75 63 63 65 73 73 6f 72 nternalsuccessor
7b60: 73 20 7b 64 76 20 72 65 76 69 73 69 6f 6e 73 7d s {dv revisions}
7b70: 20 7b 0a 09 75 70 76 61 72 20 31 20 24 64 76 20 {..upvar 1 $dv
7b80: 64 65 70 65 6e 64 65 6e 63 69 65 73 0a 09 73 65 dependencies..se
7b90: 74 20 74 68 65 73 65 74 20 28 27 5b 6a 6f 69 6e t theset ('[join
7ba0: 20 24 72 65 76 69 73 69 6f 6e 73 20 7b 27 2c 27 $revisions {','
7bb0: 7d 5d 27 29 0a 0a 09 23 20 53 65 65 20 27 73 75 }]')...# See 'su
7bc0: 63 63 65 73 73 6f 72 73 27 20 62 65 6c 6f 77 20 ccessors' below
7bd0: 66 6f 72 20 74 68 65 20 6d 61 69 6e 20 65 78 70 for the main exp
7be0: 6c 61 6e 61 74 69 6f 6e 20 6f 66 0a 09 23 20 74 lanation of..# t
7bf0: 68 65 20 76 61 72 69 6f 75 73 20 63 61 73 65 73 he various cases
7c00: 2e 20 54 68 69 73 20 70 69 65 63 65 20 69 73 20 . This piece is
7c10: 73 70 65 63 69 61 6c 20 69 6e 20 74 68 61 74 20 special in that
7c20: 69 74 0a 09 23 20 72 65 73 74 72 69 63 74 73 20 it..# restricts
7c30: 74 68 65 20 73 75 63 63 65 73 73 6f 72 73 20 77 the successors w
7c40: 65 20 6c 6f 6f 6b 20 66 6f 72 20 74 6f 20 74 68 e look for to th
7c50: 65 20 73 61 6d 65 20 73 65 74 20 6f 66 0a 09 23 e same set of..#
7c60: 20 72 65 76 69 73 69 6f 6e 73 20 77 65 20 73 74 revisions we st
7c70: 61 72 74 20 66 72 6f 6d 2e 20 53 65 6e 73 69 62 art from. Sensib
7c80: 6c 65 20 61 73 20 77 65 20 61 72 65 20 6c 6f 6f le as we are loo
7c90: 6b 69 6e 67 20 66 6f 72 0a 09 23 20 63 68 61 6e king for..# chan
7ca0: 67 65 73 65 74 20 69 6e 74 65 72 6e 61 6c 20 64 geset internal d
7cb0: 65 70 65 6e 64 65 6e 63 69 65 73 2e 0a 0a 09 61 ependencies....a
7cc0: 72 72 61 79 20 73 65 74 20 64 65 70 20 7b 7d 0a rray set dep {}.
7cd0: 0a 09 66 6f 72 65 61 63 68 20 7b 72 69 64 20 63 ..foreach {rid c
7ce0: 68 69 6c 64 7d 20 5b 73 74 61 74 65 20 72 75 6e hild} [state run
7cf0: 20 5b 73 75 62 73 74 20 2d 6e 6f 63 6f 6d 6d 61 [subst -nocomma
7d00: 6e 64 73 20 2d 6e 6f 62 61 63 6b 73 6c 61 73 68 nds -nobackslash
7d10: 65 73 20 7b 0a 20 20 20 20 2d 2d 20 28 31 29 20 es {. -- (1)
7d20: 50 72 69 6d 61 72 79 20 63 68 69 6c 64 0a 09 20 Primary child..
7d30: 20 20 20 53 45 4c 45 43 54 20 52 2e 72 69 64 2c SELECT R.rid,
7d40: 20 52 2e 63 68 69 6c 64 0a 09 20 20 20 20 46 52 R.child.. FR
7d50: 4f 4d 20 20 20 72 65 76 69 73 69 6f 6e 20 52 0a OM revision R.
7d60: 09 20 20 20 20 57 48 45 52 45 20 20 52 2e 72 69 . WHERE R.ri
7d70: 64 20 20 20 49 4e 20 24 74 68 65 73 65 74 20 20 d IN $theset
7d80: 20 20 20 2d 2d 20 52 65 73 74 72 69 63 74 20 74 -- Restrict t
7d90: 6f 20 72 65 76 69 73 69 6f 6e 73 20 6f 66 20 69 o revisions of i
7da0: 6e 74 65 72 65 73 74 0a 09 20 20 20 20 41 4e 44 nterest.. AND
7db0: 20 20 20 20 52 2e 63 68 69 6c 64 20 49 53 20 4e R.child IS N
7dc0: 4f 54 20 4e 55 4c 4c 20 20 20 20 2d 2d 20 48 61 OT NULL -- Ha
7dd0: 73 20 70 72 69 6d 61 72 79 20 63 68 69 6c 64 0a s primary child.
7de0: 09 20 20 20 20 41 4e 44 20 20 20 20 52 2e 63 68 . AND R.ch
7df0: 69 6c 64 20 49 4e 20 24 74 68 65 73 65 74 20 20 ild IN $theset
7e00: 20 20 20 2d 2d 20 57 68 69 63 68 20 69 73 20 61 -- Which is a
7e10: 6c 73 6f 20 6f 66 20 69 6e 74 65 72 65 73 74 0a lso of interest.
7e20: 20 20 20 20 55 4e 49 4f 4e 0a 20 20 20 20 2d 2d UNION. --
7e30: 20 28 32 29 20 53 65 63 6f 6e 64 61 72 79 20 28 (2) Secondary (
7e40: 62 72 61 6e 63 68 29 20 63 68 69 6c 64 72 65 6e branch) children
7e50: 0a 09 20 20 20 20 53 45 4c 45 43 54 20 52 2e 72 .. SELECT R.r
7e60: 69 64 2c 20 42 2e 62 72 69 64 0a 09 20 20 20 20 id, B.brid..
7e70: 46 52 4f 4d 20 20 20 72 65 76 69 73 69 6f 6e 20 FROM revision
7e80: 52 2c 20 72 65 76 69 73 69 6f 6e 62 72 61 6e 63 R, revisionbranc
7e90: 68 63 68 69 6c 64 72 65 6e 20 42 0a 09 20 20 20 hchildren B..
7ea0: 20 57 48 45 52 45 20 20 52 2e 72 69 64 20 20 20 WHERE R.rid
7eb0: 49 4e 20 24 74 68 65 73 65 74 20 20 20 20 20 2d IN $theset -
7ec0: 2d 20 52 65 73 74 72 69 63 74 20 74 6f 20 72 65 - Restrict to re
7ed0: 76 69 73 69 6f 6e 73 20 6f 66 20 69 6e 74 65 72 visions of inter
7ee0: 65 73 74 0a 09 20 20 20 20 41 4e 44 20 20 20 20 est.. AND
7ef0: 52 2e 72 69 64 20 3d 20 42 2e 72 69 64 20 20 20 R.rid = B.rid
7f00: 20 20 20 20 20 20 20 2d 2d 20 53 65 6c 65 63 74 -- Select
7f10: 20 73 75 62 73 65 74 20 6f 66 20 62 72 61 6e 63 subset of branc
7f20: 68 20 63 68 69 6c 64 72 65 6e 0a 09 20 20 20 20 h children..
7f30: 41 4e 44 20 20 20 20 42 2e 62 72 69 64 20 49 4e AND B.brid IN
7f40: 20 24 74 68 65 73 65 74 20 20 20 20 20 20 2d 2d $theset --
7f50: 20 57 68 69 63 68 20 69 73 20 61 6c 73 6f 20 6f Which is also o
7f60: 66 20 69 6e 74 65 72 65 73 74 0a 20 20 20 20 55 f interest. U
7f70: 4e 49 4f 4e 0a 20 20 20 20 2d 2d 20 28 34 29 20 NION. -- (4)
7f80: 43 68 69 6c 64 20 6f 66 20 74 72 75 6e 6b 20 72 Child of trunk r
7f90: 6f 6f 74 20 73 75 63 63 65 73 73 6f 72 20 6f 66 oot successor of
7fa0: 20 6c 61 73 74 20 4e 54 44 42 20 6f 6e 20 74 72 last NTDB on tr
7fb0: 75 6e 6b 2e 0a 09 20 20 20 20 53 45 4c 45 43 54 unk... SELECT
7fc0: 20 52 2e 72 69 64 2c 20 52 41 2e 63 68 69 6c 64 R.rid, RA.child
7fd0: 0a 09 20 20 20 20 46 52 4f 4d 20 72 65 76 69 73 .. FROM revis
7fe0: 69 6f 6e 20 52 2c 20 72 65 76 69 73 69 6f 6e 20 ion R, revision
7ff0: 52 41 0a 09 20 20 20 20 57 48 45 52 45 20 52 2e RA.. WHERE R.
8000: 72 69 64 20 20 20 49 4e 20 24 74 68 65 73 65 74 rid IN $theset
8010: 20 20 20 20 20 20 2d 2d 20 52 65 73 74 72 69 63 -- Restric
8020: 74 20 74 6f 20 72 65 76 69 73 69 6f 6e 73 20 6f t to revisions o
8030: 66 20 69 6e 74 65 72 65 73 74 0a 09 20 20 20 20 f interest..
8040: 41 4e 44 20 20 20 52 2e 69 73 64 65 66 61 75 6c AND R.isdefaul
8050: 74 20 20 20 20 20 20 20 20 20 20 20 20 20 2d 2d t --
8060: 20 52 65 73 74 72 69 63 74 20 74 6f 20 4e 54 44 Restrict to NTD
8070: 42 0a 09 20 20 20 20 41 4e 44 20 20 20 52 2e 64 B.. AND R.d
8080: 62 63 68 69 6c 64 20 49 53 20 4e 4f 54 20 4e 55 bchild IS NOT NU
8090: 4c 4c 20 20 20 2d 2d 20 61 6e 64 20 6c 61 73 74 LL -- and last
80a0: 20 4e 54 44 42 20 62 65 6c 6f 6e 67 69 6e 67 20 NTDB belonging
80b0: 74 6f 20 74 72 75 6e 6b 0a 09 20 20 20 20 41 4e to trunk.. AN
80c0: 44 20 20 20 52 41 2e 72 69 64 20 3d 20 52 2e 64 D RA.rid = R.d
80d0: 62 63 68 69 6c 64 20 20 20 20 20 20 2d 2d 20 47 bchild -- G
80e0: 6f 20 64 69 72 65 63 74 6c 79 20 74 6f 20 74 72 o directly to tr
80f0: 75 6e 6b 20 72 6f 6f 74 0a 09 20 20 20 20 41 4e unk root.. AN
8100: 44 20 20 20 52 41 2e 63 68 69 6c 64 20 49 53 20 D RA.child IS
8110: 4e 4f 54 20 4e 55 4c 4c 20 20 20 20 2d 2d 20 48 NOT NULL -- H
8120: 61 73 20 70 72 69 6d 61 72 79 20 63 68 69 6c 64 as primary child
8130: 2e 0a 20 20 20 20 20 20 20 20 20 20 20 20 41 4e .. AN
8140: 44 20 20 20 52 41 2e 63 68 69 6c 64 20 49 4e 20 D RA.child IN
8150: 24 74 68 65 73 65 74 20 20 20 20 20 2d 2d 20 57 $theset -- W
8160: 68 69 63 68 20 69 73 20 61 6c 73 6f 20 6f 66 20 hich is also of
8170: 69 6e 74 65 72 65 73 74 0a 09 7d 5d 5d 20 7b 0a interest..}]] {.
8180: 09 20 20 20 20 23 20 43 6f 6e 73 69 64 65 72 20 . # Consider
8190: 6d 6f 76 69 6e 67 20 74 68 69 73 20 74 6f 20 74 moving this to t
81a0: 68 65 20 69 6e 74 65 67 72 69 74 79 20 6d 6f 64 he integrity mod
81b0: 75 6c 65 2e 0a 09 20 20 20 20 69 6e 74 65 67 72 ule... integr
81c0: 69 74 79 20 61 73 73 65 72 74 20 7b 24 72 69 64 ity assert {$rid
81d0: 20 21 3d 20 24 63 68 69 6c 64 7d 20 7b 52 65 76 != $child} {Rev
81e0: 69 73 69 6f 6e 20 24 72 69 64 20 64 65 70 65 6e ision $rid depen
81f0: 64 73 20 6f 6e 20 69 74 73 65 6c 66 2e 7d 0a 09 ds on itself.}..
8200: 20 20 20 20 6c 61 70 70 65 6e 64 20 64 65 70 65 lappend depe
8210: 6e 64 65 6e 63 69 65 73 28 24 72 69 64 29 20 24 ndencies($rid) $
8220: 63 68 69 6c 64 0a 09 20 20 20 20 73 65 74 20 64 child.. set d
8230: 65 70 28 24 72 69 64 2c 24 63 68 69 6c 64 29 20 ep($rid,$child)
8240: 2e 0a 09 7d 0a 0a 09 23 20 54 68 65 20 73 71 6c ...}...# The sql
8250: 20 73 74 61 74 65 6d 65 6e 74 73 20 61 62 6f 76 statements abov
8260: 65 20 6c 6f 6f 6b 73 20 6f 6e 6c 79 20 66 6f 72 e looks only for
8270: 20 64 69 72 65 63 74 20 64 65 70 65 6e 64 65 6e direct dependen
8280: 63 69 65 73 0a 09 23 20 62 65 74 77 65 65 6e 20 cies..# between
8290: 72 65 76 69 73 69 6f 6e 20 69 6e 20 74 68 65 20 revision in the
82a0: 63 68 61 6e 67 65 73 65 74 2e 20 48 6f 77 65 76 changeset. Howev
82b0: 65 72 20 64 75 65 20 74 6f 20 74 68 65 0a 09 23 er due to the..#
82c0: 20 76 61 67 61 72 69 65 73 20 6f 66 20 6d 65 74 vagaries of met
82d0: 61 20 64 61 74 61 20 69 74 20 69 73 20 70 6f 73 a data it is pos
82e0: 73 69 62 6c 65 20 66 6f 72 20 74 77 6f 20 72 65 sible for two re
82f0: 76 69 73 69 6f 6e 73 20 6f 66 0a 09 23 20 74 68 visions of..# th
8300: 65 20 73 61 6d 65 20 66 69 6c 65 20 74 6f 20 65 e same file to e
8310: 6e 64 20 75 70 20 69 6e 20 74 68 65 20 73 61 6d nd up in the sam
8320: 65 20 63 68 61 6e 67 65 73 65 74 2c 20 77 69 74 e changeset, wit
8330: 68 6f 75 74 20 61 0a 09 23 20 64 69 72 65 63 74 hout a..# direct
8340: 20 64 65 70 65 6e 64 65 6e 63 79 20 62 65 74 77 dependency betw
8350: 65 65 6e 20 74 68 65 6d 2e 20 48 6f 77 65 76 65 een them. Howeve
8360: 72 20 77 65 20 6b 6e 6f 77 20 74 68 61 74 20 74 r we know that t
8370: 68 65 72 65 0a 09 23 20 68 61 73 20 74 6f 20 62 here..# has to b
8380: 65 20 61 20 61 6e 20 69 6e 64 69 72 65 63 74 20 e a an indirect
8390: 64 65 70 65 6e 64 65 6e 63 79 2c 20 62 65 20 69 dependency, be i
83a0: 74 20 74 68 72 6f 75 67 68 20 70 72 69 6d 61 72 t through primar
83b0: 79 0a 09 23 20 63 68 69 6c 64 72 65 6e 2c 20 62 y..# children, b
83c0: 72 61 6e 63 68 20 63 68 69 6c 64 72 65 6e 2c 20 ranch children,
83d0: 6f 72 20 61 20 63 6f 6d 62 69 6e 61 74 69 6f 6e or a combination
83e0: 20 74 68 65 72 65 6f 66 2e 0a 0a 09 23 20 57 65 thereof....# We
83f0: 20 6e 6f 77 20 66 69 6c 6c 20 69 6e 20 74 68 65 now fill in the
8400: 73 65 20 70 73 65 75 64 6f 2d 64 65 70 65 6e 64 se pseudo-depend
8410: 65 6e 63 69 65 73 2c 20 69 66 20 6e 6f 20 73 75 encies, if no su
8420: 63 68 0a 09 23 20 64 65 70 65 6e 64 65 6e 63 79 ch..# dependency
8430: 20 65 78 69 73 74 73 20 61 6c 72 65 61 64 79 2e exists already.
8440: 20 54 68 65 20 64 69 72 65 63 74 69 6f 6e 20 6f The direction o
8450: 66 20 74 68 65 20 64 65 70 65 6e 64 65 6e 63 79 f the dependency
8460: 0a 09 23 20 69 73 20 61 63 74 75 61 6c 6c 79 20 ..# is actually
8470: 69 72 72 65 6c 65 76 61 6e 74 20 66 6f 72 20 74 irrelevant for t
8480: 68 69 73 2e 0a 0a 09 23 20 4e 4f 54 45 3a 20 54 his....# NOTE: T
8490: 68 69 73 20 69 73 20 64 69 66 66 65 72 65 6e 74 his is different
84a0: 20 66 72 6f 6d 20 63 76 73 32 73 76 6e 2e 20 4f from cvs2svn. O
84b0: 75 72 20 73 70 69 72 69 74 75 61 6c 20 61 6e 63 ur spiritual anc
84c0: 65 73 74 6f 72 0a 09 23 20 64 6f 65 73 20 6e 6f estor..# does no
84d0: 74 20 75 73 65 20 73 75 63 68 20 70 73 65 75 64 t use such pseud
84e0: 6f 2d 64 65 70 65 6e 64 65 6e 63 69 65 73 2c 20 o-dependencies,
84f0: 68 6f 77 65 76 65 72 20 69 74 20 75 73 65 73 20 however it uses
8500: 61 0a 09 23 20 43 4f 4d 4d 49 54 5f 54 48 52 45 a..# COMMIT_THRE
8510: 53 48 4f 4c 44 2c 20 61 20 74 69 6d 65 20 69 6e SHOLD, a time in
8520: 74 65 72 76 61 6c 20 63 6f 6d 6d 69 74 73 20 73 terval commits s
8530: 68 6f 75 6c 64 20 66 61 6c 6c 2e 20 54 68 69 73 hould fall. This
8540: 0a 09 23 20 77 69 6c 6c 20 67 72 65 61 74 6c 79 ..# will greatly
8550: 20 72 65 64 75 63 65 73 20 74 68 65 20 72 69 73 reduces the ris
8560: 6b 20 6f 66 20 67 65 74 74 69 6e 67 20 66 61 72 k of getting far
8570: 20 73 65 70 61 72 61 74 65 64 0a 09 23 20 72 65 separated..# re
8580: 76 69 73 69 6f 6e 73 20 6f 66 20 74 68 65 20 73 visions of the s
8590: 61 6d 65 20 66 69 6c 65 20 69 6e 74 6f 20 6f 6e ame file into on
85a0: 65 20 63 68 61 6e 67 65 73 65 74 2e 0a 0a 09 23 e changeset....#
85b0: 20 57 65 20 61 6c 6c 6f 77 20 72 65 76 69 73 69 We allow revisi
85c0: 6f 6e 73 20 74 6f 20 62 65 20 66 61 72 20 61 70 ons to be far ap
85d0: 61 72 74 20 69 6e 20 74 69 6d 65 20 69 6e 20 74 art in time in t
85e0: 68 65 20 73 61 6d 65 0a 09 23 20 63 68 61 6e 67 he same..# chang
85f0: 65 73 65 74 2c 20 62 75 74 20 69 6e 20 74 75 72 eset, but in tur
8600: 6e 20 6e 65 65 64 20 74 68 65 20 70 73 65 75 64 n need the pseud
8610: 6f 2d 64 65 70 65 6e 64 65 6e 63 69 65 73 20 74 o-dependencies t
8620: 6f 0a 09 23 20 68 61 6e 64 6c 65 20 74 68 69 73 o..# handle this
8630: 2e 0a 0a 09 61 72 72 61 79 20 73 65 74 20 66 69 ....array set fi
8640: 64 73 20 7b 7d 0a 09 66 6f 72 65 61 63 68 20 7b ds {}..foreach {
8650: 72 69 64 20 66 69 64 7d 20 5b 73 74 61 74 65 20 rid fid} [state
8660: 72 75 6e 20 5b 73 75 62 73 74 20 2d 6e 6f 63 6f run [subst -noco
8670: 6d 6d 61 6e 64 73 20 2d 6e 6f 62 61 63 6b 73 6c mmands -nobacksl
8680: 61 73 68 65 73 20 7b 0a 09 20 20 20 20 53 45 4c ashes {.. SEL
8690: 45 43 54 20 52 2e 72 69 64 2c 20 52 2e 66 69 64 ECT R.rid, R.fid
86a0: 0a 20 20 20 20 20 20 20 20 20 20 20 20 46 52 4f . FRO
86b0: 4d 20 20 20 72 65 76 69 73 69 6f 6e 20 52 0a 20 M revision R.
86c0: 20 20 20 20 20 20 20 20 20 20 20 57 48 45 52 45 WHERE
86d0: 20 20 52 2e 72 69 64 20 49 4e 20 24 74 68 65 73 R.rid IN $thes
86e0: 65 74 0a 09 7d 5d 5d 20 7b 20 6c 61 70 70 65 6e et..}]] { lappen
86f0: 64 20 66 69 64 73 28 24 66 69 64 29 20 24 72 69 d fids($fid) $ri
8700: 64 20 7d 0a 0a 09 66 6f 72 65 61 63 68 20 7b 66 d }...foreach {f
8710: 69 64 20 72 69 64 73 7d 20 5b 61 72 72 61 79 20 id rids} [array
8720: 67 65 74 20 66 69 64 73 5d 20 7b 0a 09 20 20 20 get fids] {..
8730: 20 69 66 20 7b 5b 6c 6c 65 6e 67 74 68 20 24 72 if {[llength $r
8740: 69 64 73 5d 20 3c 20 32 7d 20 63 6f 6e 74 69 6e ids] < 2} contin
8750: 75 65 0a 09 20 20 20 20 66 6f 72 65 61 63 68 20 ue.. foreach
8760: 61 20 24 72 69 64 73 20 7b 0a 09 09 66 6f 72 65 a $rids {...fore
8770: 61 63 68 20 62 20 24 72 69 64 73 20 7b 0a 09 09 ach b $rids {...
8780: 20 20 20 20 69 66 20 7b 24 61 20 3d 3d 20 24 62 if {$a == $b
8790: 7d 20 63 6f 6e 74 69 6e 75 65 0a 09 09 20 20 20 } continue...
87a0: 20 69 66 20 7b 5b 69 6e 66 6f 20 65 78 69 73 74 if {[info exist
87b0: 73 20 64 65 70 28 24 61 2c 24 62 29 5d 7d 20 63 s dep($a,$b)]} c
87c0: 6f 6e 74 69 6e 75 65 0a 09 09 20 20 20 20 69 66 ontinue... if
87d0: 20 7b 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 64 {[info exists d
87e0: 65 70 28 24 62 2c 24 61 29 5d 7d 20 63 6f 6e 74 ep($b,$a)]} cont
87f0: 69 6e 75 65 0a 09 09 20 20 20 20 6c 61 70 70 65 inue... lappe
8800: 6e 64 20 64 65 70 65 6e 64 65 6e 63 69 65 73 28 nd dependencies(
8810: 24 61 29 20 24 62 0a 09 09 20 20 20 20 73 65 74 $a) $b... set
8820: 20 64 65 70 28 24 61 2c 24 62 29 20 2e 0a 09 09 dep($a,$b) ....
8830: 20 20 20 20 73 65 74 20 64 65 70 28 24 62 2c 24 set dep($b,$
8840: 61 29 20 2e 0a 09 09 7d 0a 09 20 20 20 20 7d 0a a) ....}.. }.
8850: 09 7d 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 7d .}..return. }
8860: 0a 0a 20 20 20 20 23 20 72 65 73 75 6c 74 20 3d .. # result =
8870: 20 34 2d 6c 69 73 74 20 28 69 74 65 6d 74 79 70 4-list (itemtyp
8880: 65 20 69 74 65 6d 69 64 20 6e 65 78 74 69 74 65 e itemid nextite
8890: 6d 74 79 70 65 20 6e 65 78 74 69 74 65 6d 69 64 mtype nextitemid
88a0: 20 2e 2e 2e 29 0a 20 20 20 20 74 79 70 65 6d 65 ...). typeme
88b0: 74 68 6f 64 20 6c 6f 6f 70 73 20 7b 72 65 76 69 thod loops {revi
88c0: 73 69 6f 6e 73 7d 20 7b 0a 09 23 20 4e 6f 74 65 sions} {..# Note
88d0: 3a 20 54 61 67 73 20 61 6e 64 20 62 72 61 6e 63 : Tags and branc
88e0: 68 65 73 20 63 61 6e 6e 6f 74 20 63 61 75 73 65 hes cannot cause
88f0: 20 74 68 65 20 6c 6f 6f 70 2e 20 54 68 65 69 72 the loop. Their
8900: 20 69 64 27 73 2c 0a 09 23 20 62 65 69 6e 67 20 id's,..# being
8910: 6f 66 20 61 20 66 75 6e 64 61 6d 65 6e 74 61 6c of a fundamental
8920: 6c 79 20 64 69 66 66 65 72 65 6e 74 20 74 79 70 ly different typ
8930: 65 20 74 68 61 6e 20 74 68 65 20 72 65 76 69 73 e than the revis
8940: 69 6f 6e 73 0a 09 23 20 63 6f 6d 69 6e 67 20 69 ions..# coming i
8950: 6e 20 63 61 6e 6e 6f 74 20 62 65 20 69 6e 20 74 n cannot be in t
8960: 68 65 20 73 65 74 2e 0a 0a 09 73 65 74 20 74 68 he set....set th
8970: 65 73 65 74 20 28 27 5b 6a 6f 69 6e 20 24 72 65 eset ('[join $re
8980: 76 69 73 69 6f 6e 73 20 7b 27 2c 27 7d 5d 27 29 visions {','}]')
8990: 0a 09 72 65 74 75 72 6e 20 5b 73 74 61 74 65 20 ..return [state
89a0: 72 75 6e 20 5b 73 75 62 73 74 20 2d 6e 6f 63 6f run [subst -noco
89b0: 6d 6d 61 6e 64 73 20 2d 6e 6f 62 61 63 6b 73 6c mmands -nobacksl
89c0: 61 73 68 65 73 20 7b 0a 09 20 20 20 20 2d 2d 20 ashes {.. --
89d0: 28 31 29 20 50 72 69 6d 61 72 79 20 63 68 69 6c (1) Primary chil
89e0: 64 0a 09 20 20 20 20 53 45 4c 45 43 54 20 52 2e d.. SELECT R.
89f0: 72 69 64 2c 20 52 2e 63 68 69 6c 64 0a 09 20 20 rid, R.child..
8a00: 20 20 46 52 4f 4d 20 20 20 72 65 76 69 73 69 6f FROM revisio
8a10: 6e 20 52 0a 09 20 20 20 20 57 48 45 52 45 20 20 n R.. WHERE
8a20: 52 2e 72 69 64 20 20 20 49 4e 20 24 74 68 65 73 R.rid IN $thes
8a30: 65 74 20 20 20 20 20 2d 2d 20 52 65 73 74 72 69 et -- Restri
8a40: 63 74 20 74 6f 20 72 65 76 69 73 69 6f 6e 73 20 ct to revisions
8a50: 6f 66 20 69 6e 74 65 72 65 73 74 0a 09 20 20 20 of interest..
8a60: 20 41 4e 44 20 20 20 20 52 2e 63 68 69 6c 64 20 AND R.child
8a70: 49 53 20 4e 4f 54 20 4e 55 4c 4c 20 20 20 20 2d IS NOT NULL -
8a80: 2d 20 48 61 73 20 70 72 69 6d 61 72 79 20 63 68 - Has primary ch
8a90: 69 6c 64 0a 09 20 20 20 20 41 4e 44 20 20 20 20 ild.. AND
8aa0: 52 2e 63 68 69 6c 64 20 49 4e 20 24 74 68 65 73 R.child IN $thes
8ab0: 65 74 20 20 20 20 20 2d 2d 20 4c 6f 6f 70 0a 09 et -- Loop..
8ac0: 20 20 20 20 2d 2d 0a 09 20 20 20 20 55 4e 49 4f --.. UNIO
8ad0: 4e 0a 09 20 20 20 20 2d 2d 20 28 32 29 20 53 65 N.. -- (2) Se
8ae0: 63 6f 6e 64 61 72 79 20 28 62 72 61 6e 63 68 29 condary (branch)
8af0: 20 63 68 69 6c 64 72 65 6e 0a 09 20 20 20 20 53 children.. S
8b00: 45 4c 45 43 54 20 52 2e 72 69 64 2c 20 42 2e 62 ELECT R.rid, B.b
8b10: 72 69 64 0a 09 20 20 20 20 46 52 4f 4d 20 20 20 rid.. FROM
8b20: 72 65 76 69 73 69 6f 6e 20 52 2c 20 72 65 76 69 revision R, revi
8b30: 73 69 6f 6e 62 72 61 6e 63 68 63 68 69 6c 64 72 sionbranchchildr
8b40: 65 6e 20 42 0a 09 20 20 20 20 57 48 45 52 45 20 en B.. WHERE
8b50: 20 52 2e 72 69 64 20 20 20 49 4e 20 24 74 68 65 R.rid IN $the
8b60: 73 65 74 20 20 20 20 20 2d 2d 20 52 65 73 74 72 set -- Restr
8b70: 69 63 74 20 74 6f 20 72 65 76 69 73 69 6f 6e 73 ict to revisions
8b80: 20 6f 66 20 69 6e 74 65 72 65 73 74 0a 09 20 20 of interest..
8b90: 20 20 41 4e 44 20 20 20 20 52 2e 72 69 64 20 3d AND R.rid =
8ba0: 20 42 2e 72 69 64 20 20 20 20 20 20 20 20 20 20 B.rid
8bb0: 2d 2d 20 53 65 6c 65 63 74 20 73 75 62 73 65 74 -- Select subset
8bc0: 20 6f 66 20 62 72 61 6e 63 68 20 63 68 69 6c 64 of branch child
8bd0: 72 65 6e 0a 09 20 20 20 20 41 4e 44 20 20 20 20 ren.. AND
8be0: 42 2e 72 69 64 20 20 20 49 4e 20 24 74 68 65 73 B.rid IN $thes
8bf0: 65 74 20 20 20 20 20 2d 2d 20 4c 6f 6f 70 0a 09 et -- Loop..
8c00: 20 20 20 20 2d 2d 0a 09 20 20 20 20 55 4e 49 4f --.. UNIO
8c10: 4e 0a 09 20 20 20 20 2d 2d 20 28 34 29 20 43 68 N.. -- (4) Ch
8c20: 69 6c 64 20 6f 66 20 74 72 75 6e 6b 20 72 6f 6f ild of trunk roo
8c30: 74 20 73 75 63 63 65 73 73 6f 72 20 6f 66 20 6c t successor of l
8c40: 61 73 74 20 4e 54 44 42 20 6f 6e 20 74 72 75 6e ast NTDB on trun
8c50: 6b 2e 0a 09 20 20 20 20 53 45 4c 45 43 54 20 52 k... SELECT R
8c60: 2e 72 69 64 2c 20 52 41 2e 63 68 69 6c 64 0a 09 .rid, RA.child..
8c70: 20 20 20 20 46 52 4f 4d 20 20 20 72 65 76 69 73 FROM revis
8c80: 69 6f 6e 20 52 2c 20 72 65 76 69 73 69 6f 6e 20 ion R, revision
8c90: 52 41 0a 09 20 20 20 20 57 48 45 52 45 20 20 52 RA.. WHERE R
8ca0: 2e 72 69 64 20 20 20 20 49 4e 20 24 74 68 65 73 .rid IN $thes
8cb0: 65 74 20 20 20 20 20 2d 2d 20 52 65 73 74 72 69 et -- Restri
8cc0: 63 74 20 74 6f 20 72 65 76 69 73 69 6f 6e 73 20 ct to revisions
8cd0: 6f 66 20 69 6e 74 65 72 65 73 74 0a 09 20 20 20 of interest..
8ce0: 20 41 4e 44 20 20 20 20 52 2e 69 73 64 65 66 61 AND R.isdefa
8cf0: 75 6c 74 20 20 20 20 20 20 20 20 20 20 20 20 20 ult
8d00: 2d 2d 20 52 65 73 74 72 69 63 74 20 74 6f 20 4e -- Restrict to N
8d10: 54 44 42 0a 09 20 20 20 20 41 4e 44 20 20 20 20 TDB.. AND
8d20: 52 2e 64 62 63 68 69 6c 64 20 49 53 20 4e 4f 54 R.dbchild IS NOT
8d30: 20 4e 55 4c 4c 20 20 20 2d 2d 20 61 6e 64 20 6c NULL -- and l
8d40: 61 73 74 20 4e 54 44 42 20 62 65 6c 6f 6e 67 69 ast NTDB belongi
8d50: 6e 67 20 74 6f 20 74 72 75 6e 6b 0a 09 20 20 20 ng to trunk..
8d60: 20 41 4e 44 20 20 20 20 52 41 2e 72 69 64 20 3d AND RA.rid =
8d70: 20 52 2e 64 62 63 68 69 6c 64 20 20 20 20 20 20 R.dbchild
8d80: 2d 2d 20 47 6f 20 64 69 72 65 63 74 6c 79 20 74 -- Go directly t
8d90: 6f 20 74 72 75 6e 6b 20 72 6f 6f 74 0a 09 20 20 o trunk root..
8da0: 20 20 41 4e 44 20 20 20 20 52 41 2e 63 68 69 6c AND RA.chil
8db0: 64 20 49 53 20 4e 4f 54 20 4e 55 4c 4c 20 20 20 d IS NOT NULL
8dc0: 20 2d 2d 20 48 61 73 20 70 72 69 6d 61 72 79 20 -- Has primary
8dd0: 63 68 69 6c 64 2e 0a 09 20 20 20 20 41 4e 44 20 child... AND
8de0: 20 20 20 52 41 2e 63 68 69 6c 64 20 49 4e 20 24 RA.child IN $
8df0: 74 68 65 73 65 74 20 20 20 20 20 2d 2d 20 4c 6f theset -- Lo
8e00: 6f 70 0a 09 7d 5d 5d 0a 20 20 20 20 7d 0a 0a 20 op..}]]. }..
8e10: 20 20 20 23 20 76 61 72 28 64 76 29 20 3d 20 64 # var(dv) = d
8e20: 69 63 74 20 28 69 74 65 6d 20 2d 3e 20 6c 69 73 ict (item -> lis
8e30: 74 20 28 69 74 65 6d 29 29 2c 20 69 74 65 6d 20 t (item)), item
8e40: 20 3d 20 6c 69 73 74 20 28 74 79 70 65 20 69 64 = list (type id
8e50: 29 0a 20 20 20 20 74 79 70 65 6d 65 74 68 6f 64 ). typemethod
8e60: 20 73 75 63 63 65 73 73 6f 72 73 20 7b 64 76 20 successors {dv
8e70: 72 65 76 69 73 69 6f 6e 73 7d 20 7b 0a 09 75 70 revisions} {..up
8e80: 76 61 72 20 31 20 24 64 76 20 64 65 70 65 6e 64 var 1 $dv depend
8e90: 65 6e 63 69 65 73 0a 09 73 65 74 20 74 68 65 73 encies..set thes
8ea0: 65 74 20 28 27 5b 6a 6f 69 6e 20 24 72 65 76 69 et ('[join $revi
8eb0: 73 69 6f 6e 73 20 7b 27 2c 27 7d 5d 27 29 0a 0a sions {','}]')..
8ec0: 09 23 20 54 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 .# The following
8ed0: 20 63 61 73 65 73 20 73 70 65 63 69 66 79 20 77 cases specify w
8ee0: 68 65 6e 20 61 20 72 65 76 69 73 69 6f 6e 20 53 hen a revision S
8ef0: 20 69 73 20 61 20 73 75 63 63 65 73 73 6f 72 0a is a successor.
8f00: 09 23 20 6f 66 20 61 20 72 65 76 69 73 69 6f 6e .# of a revision
8f10: 20 52 2e 20 45 61 63 68 20 6f 66 20 74 68 65 20 R. Each of the
8f20: 63 61 73 65 73 20 74 72 61 6e 73 6c 61 74 65 73 cases translates
8f30: 20 69 6e 74 6f 20 6f 6e 65 20 6f 66 0a 09 23 20 into one of..#
8f40: 74 68 65 20 62 72 61 6e 63 68 65 73 20 6f 66 20 the branches of
8f50: 74 68 65 20 53 51 4c 20 55 4e 49 4f 4e 20 63 6f the SQL UNION co
8f60: 6d 69 6e 67 20 62 65 6c 6f 77 2e 0a 09 23 0a 09 ming below...#..
8f70: 23 20 28 31 29 20 53 20 63 61 6e 20 62 65 20 61 # (1) S can be a
8f80: 20 70 72 69 6d 61 72 79 20 63 68 69 6c 64 20 6f primary child o
8f90: 66 20 52 2c 20 69 2e 65 2e 20 69 6e 20 74 68 65 f R, i.e. in the
8fa0: 20 73 61 6d 65 20 4c 4f 44 2e 20 52 0a 09 23 20 same LOD. R..#
8fb0: 20 20 20 20 72 65 66 65 72 65 6e 63 65 73 20 53 references S
8fc0: 20 64 69 72 65 63 74 6c 79 2e 20 52 2e 63 68 69 directly. R.chi
8fd0: 6c 64 20 3d 20 53 28 2e 72 69 64 29 2c 20 69 66 ld = S(.rid), if
8fe0: 20 69 74 20 65 78 69 73 74 73 2e 0a 09 23 0a 09 it exists...#..
8ff0: 23 20 28 32 29 20 53 20 63 61 6e 20 62 65 20 61 # (2) S can be a
9000: 20 73 65 63 6f 6e 64 61 72 79 2c 20 69 2e 65 2e secondary, i.e.
9010: 20 62 72 61 6e 63 68 2c 20 63 68 69 6c 64 20 6f branch, child o
9020: 66 20 52 2e 20 48 65 72 65 20 74 68 65 0a 09 23 f R. Here the..#
9030: 20 20 20 20 20 6c 69 6e 6b 20 69 73 20 6d 61 64 link is mad
9040: 65 20 74 68 72 6f 75 67 68 20 74 68 65 20 68 65 e through the he
9050: 6c 70 65 72 20 74 61 62 6c 65 0a 09 23 20 20 20 lper table..#
9060: 20 20 52 45 56 49 53 49 4f 4e 42 52 41 4e 43 48 REVISIONBRANCH
9070: 43 48 49 4c 44 52 45 4e 2e 20 52 2e 72 69 64 20 CHILDREN. R.rid
9080: 2d 3e 20 52 42 43 2e 72 69 64 2c 20 52 42 43 2e -> RBC.rid, RBC.
9090: 62 72 69 64 20 3d 0a 09 23 20 20 20 20 20 53 28 brid =..# S(
90a0: 2e 72 69 64 29 0a 09 23 0a 09 23 20 28 33 29 20 .rid)..#..# (3)
90b0: 4f 72 69 67 69 6e 61 6c 6c 79 20 74 68 69 73 20 Originally this
90c0: 75 73 65 20 63 61 73 65 20 64 65 66 69 6e 65 64 use case defined
90d0: 20 74 68 65 20 72 6f 6f 74 20 6f 66 20 61 20 64 the root of a d
90e0: 65 74 61 63 68 65 64 0a 09 23 20 20 20 20 20 4e etached..# N
90f0: 54 44 42 20 61 73 20 74 68 65 20 73 75 63 63 65 TDB as the succe
9100: 73 73 6f 72 20 6f 66 20 74 68 65 20 74 72 75 6e ssor of the trun
9110: 6b 20 72 6f 6f 74 2e 20 54 68 69 73 20 6c 65 61 k root. This lea
9120: 64 73 20 74 6f 20 61 0a 09 23 20 20 20 20 20 62 ds to a..# b
9130: 61 64 20 74 61 6e 67 6c 65 20 6c 61 74 65 72 20 ad tangle later
9140: 6f 6e 2e 20 57 69 74 68 20 61 20 64 65 74 61 63 on. With a detac
9150: 68 65 64 20 4e 54 44 42 20 74 68 65 20 6f 72 69 hed NTDB the ori
9160: 67 69 6e 61 6c 0a 09 23 20 20 20 20 20 74 72 75 ginal..# tru
9170: 6e 6b 20 72 6f 6f 74 20 72 65 76 69 73 69 6f 6e nk root revision
9180: 20 77 61 73 20 72 65 6d 6f 76 65 64 20 61 73 20 was removed as
9190: 69 72 72 65 6c 65 76 61 6e 74 2c 20 61 6c 6c 6f irrelevant, allo
91a0: 77 69 6e 67 0a 09 23 20 20 20 20 20 74 68 65 20 wing..# the
91b0: 6e 6f 6d 69 6e 61 6c 20 72 6f 6f 74 20 74 6f 20 nominal root to
91c0: 62 65 20 6c 61 74 65 72 20 69 6e 20 74 69 6d 65 be later in time
91d0: 20 74 68 61 6e 20 74 68 65 20 4e 54 44 42 0a 09 than the NTDB..
91e0: 23 20 20 20 20 20 72 6f 6f 74 2e 20 4e 6f 77 20 # root. Now
91f0: 73 65 74 74 69 6e 67 20 74 68 69 73 20 64 65 70 setting this dep
9200: 65 6e 64 65 6e 63 79 20 77 69 6c 6c 20 62 65 20 endency will be
9210: 62 61 63 6b 77 61 72 64 20 69 6e 0a 09 23 20 20 backward in..#
9220: 20 20 20 74 69 6d 65 2e 20 52 45 4d 4f 56 45 44 time. REMOVED
9230: 2e 0a 09 23 0a 09 23 20 28 34 29 20 49 66 20 52 ...#..# (4) If R
9240: 20 69 73 20 74 68 65 20 6c 61 73 74 20 6f 66 20 is the last of
9250: 74 68 65 20 4e 54 44 42 20 72 65 76 69 73 69 6f the NTDB revisio
9260: 6e 73 20 77 68 69 63 68 20 62 65 6c 6f 6e 67 20 ns which belong
9270: 74 6f 0a 09 23 20 20 20 20 20 74 68 65 20 74 72 to..# the tr
9280: 75 6e 6b 2c 20 74 68 65 6e 20 74 68 65 20 70 72 unk, then the pr
9290: 69 6d 61 72 79 20 63 68 69 6c 64 20 6f 66 20 74 imary child of t
92a0: 68 65 20 74 72 75 6e 6b 20 72 6f 6f 74 20 28 74 he trunk root (t
92b0: 68 65 0a 09 23 20 20 20 20 20 27 31 2e 32 27 20 he..# '1.2'
92c0: 72 65 76 69 73 69 6f 6e 29 20 69 73 20 61 20 73 revision) is a s
92d0: 75 63 63 65 73 73 6f 72 2c 20 69 66 20 69 74 20 uccessor, if it
92e0: 65 78 69 73 74 73 2e 0a 0a 09 23 20 4e 6f 74 65 exists....# Note
92f0: 20 74 68 61 74 20 74 68 65 20 62 72 61 6e 63 68 that the branch
9300: 65 73 20 73 70 61 77 6e 65 64 20 66 72 6f 6d 20 es spawned from
9310: 74 68 65 20 72 65 76 69 73 69 6f 6e 73 2c 20 61 the revisions, a
9320: 6e 64 20 74 68 65 0a 09 23 20 74 61 67 73 20 61 nd the..# tags a
9330: 73 73 6f 63 69 61 74 65 64 20 77 69 74 68 20 74 ssociated with t
9340: 68 65 6d 20 61 72 65 20 73 75 63 63 65 73 73 6f hem are successo
9350: 72 73 20 61 73 20 77 65 6c 6c 2e 0a 0a 09 66 6f rs as well....fo
9360: 72 65 61 63 68 20 7b 72 69 64 20 63 68 69 6c 64 reach {rid child
9370: 7d 20 5b 73 74 61 74 65 20 72 75 6e 20 5b 73 75 } [state run [su
9380: 62 73 74 20 2d 6e 6f 63 6f 6d 6d 61 6e 64 73 20 bst -nocommands
9390: 2d 6e 6f 62 61 63 6b 73 6c 61 73 68 65 73 20 7b -nobackslashes {
93a0: 0a 20 20 20 20 2d 2d 20 28 31 29 20 50 72 69 6d . -- (1) Prim
93b0: 61 72 79 20 63 68 69 6c 64 0a 09 20 20 20 20 53 ary child.. S
93c0: 45 4c 45 43 54 20 52 2e 72 69 64 2c 20 52 2e 63 ELECT R.rid, R.c
93d0: 68 69 6c 64 0a 09 20 20 20 20 46 52 4f 4d 20 20 hild.. FROM
93e0: 20 72 65 76 69 73 69 6f 6e 20 52 0a 09 20 20 20 revision R..
93f0: 20 57 48 45 52 45 20 20 52 2e 72 69 64 20 20 20 WHERE R.rid
9400: 49 4e 20 24 74 68 65 73 65 74 20 20 20 20 20 2d IN $theset -
9410: 2d 20 52 65 73 74 72 69 63 74 20 74 6f 20 72 65 - Restrict to re
9420: 76 69 73 69 6f 6e 73 20 6f 66 20 69 6e 74 65 72 visions of inter
9430: 65 73 74 0a 09 20 20 20 20 41 4e 44 20 20 20 20 est.. AND
9440: 52 2e 63 68 69 6c 64 20 49 53 20 4e 4f 54 20 4e R.child IS NOT N
9450: 55 4c 4c 20 20 20 20 2d 2d 20 48 61 73 20 70 72 ULL -- Has pr
9460: 69 6d 61 72 79 20 63 68 69 6c 64 0a 20 20 20 20 imary child.
9470: 55 4e 49 4f 4e 0a 20 20 20 20 2d 2d 20 28 32 29 UNION. -- (2)
9480: 20 53 65 63 6f 6e 64 61 72 79 20 28 62 72 61 6e Secondary (bran
9490: 63 68 29 20 63 68 69 6c 64 72 65 6e 0a 09 20 20 ch) children..
94a0: 20 20 53 45 4c 45 43 54 20 52 2e 72 69 64 2c 20 SELECT R.rid,
94b0: 42 2e 62 72 69 64 0a 09 20 20 20 20 46 52 4f 4d B.brid.. FROM
94c0: 20 20 20 72 65 76 69 73 69 6f 6e 20 52 2c 20 72 revision R, r
94d0: 65 76 69 73 69 6f 6e 62 72 61 6e 63 68 63 68 69 evisionbranchchi
94e0: 6c 64 72 65 6e 20 42 0a 09 20 20 20 20 57 48 45 ldren B.. WHE
94f0: 52 45 20 20 52 2e 72 69 64 20 20 20 49 4e 20 24 RE R.rid IN $
9500: 74 68 65 73 65 74 20 20 20 20 20 2d 2d 20 52 65 theset -- Re
9510: 73 74 72 69 63 74 20 74 6f 20 72 65 76 69 73 69 strict to revisi
9520: 6f 6e 73 20 6f 66 20 69 6e 74 65 72 65 73 74 0a ons of interest.
9530: 09 20 20 20 20 41 4e 44 20 20 20 20 52 2e 72 69 . AND R.ri
9540: 64 20 3d 20 42 2e 72 69 64 20 20 20 20 20 20 20 d = B.rid
9550: 20 20 20 2d 2d 20 53 65 6c 65 63 74 20 73 75 62 -- Select sub
9560: 73 65 74 20 6f 66 20 62 72 61 6e 63 68 20 63 68 set of branch ch
9570: 69 6c 64 72 65 6e 0a 20 20 20 20 55 4e 49 4f 4e ildren. UNION
9580: 0a 20 20 20 20 2d 2d 20 28 34 29 20 43 68 69 6c . -- (4) Chil
9590: 64 20 6f 66 20 74 72 75 6e 6b 20 72 6f 6f 74 20 d of trunk root
95a0: 73 75 63 63 65 73 73 6f 72 20 6f 66 20 6c 61 73 successor of las
95b0: 74 20 4e 54 44 42 20 6f 6e 20 74 72 75 6e 6b 2e t NTDB on trunk.
95c0: 0a 09 20 20 20 20 53 45 4c 45 43 54 20 52 2e 72 .. SELECT R.r
95d0: 69 64 2c 20 52 41 2e 63 68 69 6c 64 0a 09 20 20 id, RA.child..
95e0: 20 20 46 52 4f 4d 20 72 65 76 69 73 69 6f 6e 20 FROM revision
95f0: 52 2c 20 72 65 76 69 73 69 6f 6e 20 52 41 0a 09 R, revision RA..
9600: 20 20 20 20 57 48 45 52 45 20 52 2e 72 69 64 20 WHERE R.rid
9610: 20 20 49 4e 20 24 74 68 65 73 65 74 20 20 20 20 IN $theset
9620: 20 20 2d 2d 20 52 65 73 74 72 69 63 74 20 74 6f -- Restrict to
9630: 20 72 65 76 69 73 69 6f 6e 73 20 6f 66 20 69 6e revisions of in
9640: 74 65 72 65 73 74 0a 09 20 20 20 20 41 4e 44 20 terest.. AND
9650: 20 20 52 2e 69 73 64 65 66 61 75 6c 74 20 20 20 R.isdefault
9660: 20 20 20 20 20 20 20 20 20 20 2d 2d 20 52 65 73 -- Res
9670: 74 72 69 63 74 20 74 6f 20 4e 54 44 42 0a 09 20 trict to NTDB..
9680: 20 20 20 41 4e 44 20 20 20 52 2e 64 62 63 68 69 AND R.dbchi
9690: 6c 64 20 49 53 20 4e 4f 54 20 4e 55 4c 4c 20 20 ld IS NOT NULL
96a0: 20 2d 2d 20 61 6e 64 20 6c 61 73 74 20 4e 54 44 -- and last NTD
96b0: 42 20 62 65 6c 6f 6e 67 69 6e 67 20 74 6f 20 74 B belonging to t
96c0: 72 75 6e 6b 0a 09 20 20 20 20 41 4e 44 20 20 20 runk.. AND
96d0: 52 41 2e 72 69 64 20 3d 20 52 2e 64 62 63 68 69 RA.rid = R.dbchi
96e0: 6c 64 20 20 20 20 20 20 2d 2d 20 47 6f 20 64 69 ld -- Go di
96f0: 72 65 63 74 6c 79 20 74 6f 20 74 72 75 6e 6b 20 rectly to trunk
9700: 72 6f 6f 74 0a 09 20 20 20 20 41 4e 44 20 20 20 root.. AND
9710: 52 41 2e 63 68 69 6c 64 20 49 53 20 4e 4f 54 20 RA.child IS NOT
9720: 4e 55 4c 4c 20 20 20 20 2d 2d 20 48 61 73 20 70 NULL -- Has p
9730: 72 69 6d 61 72 79 20 63 68 69 6c 64 2e 0a 09 7d rimary child...}
9740: 5d 5d 20 7b 0a 09 20 20 20 20 23 20 43 6f 6e 73 ]] {.. # Cons
9750: 69 64 65 72 20 6d 6f 76 69 6e 67 20 74 68 69 73 ider moving this
9760: 20 74 6f 20 74 68 65 20 69 6e 74 65 67 72 69 74 to the integrit
9770: 79 20 6d 6f 64 75 6c 65 2e 0a 09 20 20 20 20 69 y module... i
9780: 6e 74 65 67 72 69 74 79 20 61 73 73 65 72 74 20 ntegrity assert
9790: 7b 24 72 69 64 20 21 3d 20 24 63 68 69 6c 64 7d {$rid != $child}
97a0: 20 7b 52 65 76 69 73 69 6f 6e 20 24 72 69 64 20 {Revision $rid
97b0: 64 65 70 65 6e 64 73 20 6f 6e 20 69 74 73 65 6c depends on itsel
97c0: 66 2e 7d 0a 09 20 20 20 20 6c 61 70 70 65 6e 64 f.}.. lappend
97d0: 20 64 65 70 65 6e 64 65 6e 63 69 65 73 28 5b 6c dependencies([l
97e0: 69 73 74 20 72 65 76 20 24 72 69 64 5d 29 20 5b ist rev $rid]) [
97f0: 6c 69 73 74 20 72 65 76 20 24 63 68 69 6c 64 5d list rev $child]
9800: 0a 09 7d 0a 09 66 6f 72 65 61 63 68 20 7b 72 69 ..}..foreach {ri
9810: 64 20 63 68 69 6c 64 7d 20 5b 73 74 61 74 65 20 d child} [state
9820: 72 75 6e 20 5b 73 75 62 73 74 20 2d 6e 6f 63 6f run [subst -noco
9830: 6d 6d 61 6e 64 73 20 2d 6e 6f 62 61 63 6b 73 6c mmands -nobacksl
9840: 61 73 68 65 73 20 7b 0a 09 20 20 20 20 53 45 4c ashes {.. SEL
9850: 45 43 54 20 52 2e 72 69 64 2c 20 54 2e 74 69 64 ECT R.rid, T.tid
9860: 0a 09 20 20 20 20 46 52 4f 4d 20 20 20 72 65 76 .. FROM rev
9870: 69 73 69 6f 6e 20 52 2c 20 74 61 67 20 54 0a 09 ision R, tag T..
9880: 20 20 20 20 57 48 45 52 45 20 20 52 2e 72 69 64 WHERE R.rid
9890: 20 49 4e 20 24 74 68 65 73 65 74 20 20 20 20 20 IN $theset
98a0: 20 20 2d 2d 20 52 65 73 74 72 69 63 74 20 74 6f -- Restrict to
98b0: 20 72 65 76 69 73 69 6f 6e 73 20 6f 66 20 69 6e revisions of in
98c0: 74 65 72 65 73 74 0a 09 20 20 20 20 41 4e 44 20 terest.. AND
98d0: 20 20 20 54 2e 72 65 76 20 3d 20 52 2e 72 69 64 T.rev = R.rid
98e0: 20 20 20 20 20 20 20 20 20 20 2d 2d 20 53 65 6c -- Sel
98f0: 65 63 74 20 74 61 67 73 20 61 74 74 61 63 68 65 ect tags attache
9900: 64 20 74 6f 20 74 68 65 6d 0a 09 7d 5d 5d 20 7b d to them..}]] {
9910: 0a 09 20 20 20 20 6c 61 70 70 65 6e 64 20 64 65 .. lappend de
9920: 70 65 6e 64 65 6e 63 69 65 73 28 5b 6c 69 73 74 pendencies([list
9930: 20 72 65 76 20 24 72 69 64 5d 29 20 5b 6c 69 73 rev $rid]) [lis
9940: 74 20 73 79 6d 3a 3a 74 61 67 20 24 63 68 69 6c t sym::tag $chil
9950: 64 5d 0a 09 7d 0a 09 66 6f 72 65 61 63 68 20 7b d]..}..foreach {
9960: 72 69 64 20 63 68 69 6c 64 7d 20 5b 73 74 61 74 rid child} [stat
9970: 65 20 72 75 6e 20 5b 73 75 62 73 74 20 2d 6e 6f e run [subst -no
9980: 63 6f 6d 6d 61 6e 64 73 20 2d 6e 6f 62 61 63 6b commands -noback
9990: 73 6c 61 73 68 65 73 20 7b 0a 09 20 20 20 20 53 slashes {.. S
99a0: 45 4c 45 43 54 20 52 2e 72 69 64 2c 20 42 2e 62 ELECT R.rid, B.b
99b0: 69 64 0a 09 20 20 20 20 46 52 4f 4d 20 20 20 72 id.. FROM r
99c0: 65 76 69 73 69 6f 6e 20 52 2c 20 62 72 61 6e 63 evision R, branc
99d0: 68 20 42 0a 09 20 20 20 20 57 48 45 52 45 20 20 h B.. WHERE
99e0: 52 2e 72 69 64 20 49 4e 20 24 74 68 65 73 65 74 R.rid IN $theset
99f0: 20 20 20 20 20 20 20 2d 2d 20 52 65 73 74 72 69 -- Restri
9a00: 63 74 20 74 6f 20 72 65 76 69 73 69 6f 6e 73 20 ct to revisions
9a10: 6f 66 20 69 6e 74 65 72 65 73 74 0a 09 20 20 20 of interest..
9a20: 20 41 4e 44 20 20 20 20 42 2e 72 6f 6f 74 20 3d AND B.root =
9a30: 20 52 2e 72 69 64 20 20 20 20 20 20 20 20 20 2d R.rid -
9a40: 2d 20 53 65 6c 65 63 74 20 62 72 61 6e 63 68 65 - Select branche
9a50: 73 20 61 74 74 61 63 68 65 64 20 74 6f 20 74 68 s attached to th
9a60: 65 6d 0a 09 7d 5d 5d 20 7b 0a 09 20 20 20 20 6c em..}]] {.. l
9a70: 61 70 70 65 6e 64 20 64 65 70 65 6e 64 65 6e 63 append dependenc
9a80: 69 65 73 28 5b 6c 69 73 74 20 72 65 76 20 24 72 ies([list rev $r
9a90: 69 64 5d 29 20 5b 6c 69 73 74 20 73 79 6d 3a 3a id]) [list sym::
9aa0: 62 72 61 6e 63 68 20 24 63 68 69 6c 64 5d 0a 09 branch $child]..
9ab0: 7d 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a }..return. }.
9ac0: 0a 20 20 20 20 23 20 72 65 73 75 6c 74 20 3d 20 . # result =
9ad0: 6c 69 73 74 20 28 63 68 61 6e 67 65 73 65 74 2d list (changeset-
9ae0: 69 64 29 0a 20 20 20 20 74 79 70 65 6d 65 74 68 id). typemeth
9af0: 6f 64 20 63 73 5f 73 75 63 63 65 73 73 6f 72 73 od cs_successors
9b00: 20 7b 72 65 76 69 73 69 6f 6e 73 7d 20 7b 0a 20 {revisions} {.
9b10: 20 20 20 20 20 20 20 23 20 54 68 69 73 20 69 73 # This is
9b20: 20 61 20 76 61 72 69 61 6e 74 20 6f 66 20 27 73 a variant of 's
9b30: 75 63 63 65 73 73 6f 72 73 27 20 77 68 69 63 68 uccessors' which
9b40: 20 6d 61 70 73 20 74 68 65 20 6c 6f 77 2d 6c 65 maps the low-le
9b50: 76 65 6c 0a 20 20 20 20 20 20 20 20 23 20 64 61 vel. # da
9b60: 74 61 20 64 69 72 65 63 74 6c 79 20 74 6f 20 74 ta directly to t
9b70: 68 65 20 61 73 73 6f 63 69 61 74 65 64 20 63 68 he associated ch
9b80: 61 6e 67 65 73 65 74 73 2e 20 49 2e 65 2e 20 69 angesets. I.e. i
9b90: 6e 73 74 65 61 64 0a 20 20 20 20 20 20 20 20 23 nstead. #
9ba0: 20 6d 69 6c 6c 69 6f 6e 73 20 6f 66 20 64 65 70 millions of dep
9bb0: 65 6e 64 65 6e 63 79 20 70 61 69 72 73 20 28 69 endency pairs (i
9bc0: 6e 20 65 78 74 72 65 6d 65 20 63 61 73 65 73 20 n extreme cases
9bd0: 28 45 78 61 6d 70 6c 65 3a 20 54 63 6c 0a 20 20 (Example: Tcl.
9be0: 20 20 20 20 20 20 23 20 43 56 53 29 29 20 77 65 # CVS)) we
9bf0: 20 72 65 74 75 72 6e 20 61 20 76 65 72 79 20 73 return a very s
9c00: 68 6f 72 74 20 61 6e 64 20 6d 75 63 68 20 6d 6f hort and much mo
9c10: 72 65 20 6d 61 6e 61 67 65 61 62 6c 65 20 6c 69 re manageable li
9c20: 73 74 0a 20 20 20 20 20 20 20 20 23 20 6f 66 20 st. # of
9c30: 63 68 61 6e 67 65 73 65 74 73 2e 0a 0a 09 73 65 changesets....se
9c40: 74 20 74 68 65 73 65 74 20 28 27 5b 6a 6f 69 6e t theset ('[join
9c50: 20 24 72 65 76 69 73 69 6f 6e 73 20 7b 27 2c 27 $revisions {','
9c60: 7d 5d 27 29 0a 09 72 65 74 75 72 6e 20 5b 73 74 }]')..return [st
9c70: 61 74 65 20 72 75 6e 20 5b 73 75 62 73 74 20 2d ate run [subst -
9c80: 6e 6f 63 6f 6d 6d 61 6e 64 73 20 2d 6e 6f 62 61 nocommands -noba
9c90: 63 6b 73 6c 61 73 68 65 73 20 7b 0a 20 20 20 20 ckslashes {.
9ca0: 2d 2d 20 28 31 29 20 50 72 69 6d 61 72 79 20 63 -- (1) Primary c
9cb0: 68 69 6c 64 0a 09 20 20 20 20 53 45 4c 45 43 54 hild.. SELECT
9cc0: 20 43 2e 63 69 64 0a 09 20 20 20 20 46 52 4f 4d C.cid.. FROM
9cd0: 20 20 20 72 65 76 69 73 69 6f 6e 20 52 2c 20 63 revision R, c
9ce0: 73 69 74 65 6d 20 43 49 2c 20 63 68 61 6e 67 65 sitem CI, change
9cf0: 73 65 74 20 43 0a 09 20 20 20 20 57 48 45 52 45 set C.. WHERE
9d00: 20 20 52 2e 72 69 64 20 20 20 49 4e 20 24 74 68 R.rid IN $th
9d10: 65 73 65 74 20 20 20 20 20 2d 2d 20 52 65 73 74 eset -- Rest
9d20: 72 69 63 74 20 74 6f 20 72 65 76 69 73 69 6f 6e rict to revision
9d30: 73 20 6f 66 20 69 6e 74 65 72 65 73 74 0a 09 20 s of interest..
9d40: 20 20 20 41 4e 44 20 20 20 20 52 2e 63 68 69 6c AND R.chil
9d50: 64 20 49 53 20 4e 4f 54 20 4e 55 4c 4c 20 20 20 d IS NOT NULL
9d60: 20 2d 2d 20 48 61 73 20 70 72 69 6d 61 72 79 20 -- Has primary
9d70: 63 68 69 6c 64 0a 20 20 20 20 20 20 20 20 20 20 child.
9d80: 20 20 41 4e 44 20 20 20 20 43 49 2e 69 69 64 20 AND CI.iid
9d90: 3d 20 52 2e 63 68 69 6c 64 20 20 20 20 20 20 20 = R.child
9da0: 2d 2d 20 53 65 6c 65 63 74 20 61 6c 6c 20 63 68 -- Select all ch
9db0: 61 6e 67 65 73 65 74 73 0a 20 20 20 20 20 20 20 angesets.
9dc0: 20 20 20 20 20 41 4e 44 20 20 20 20 43 2e 63 69 AND C.ci
9dd0: 64 20 3d 20 43 49 2e 63 69 64 20 20 20 20 20 20 d = CI.cid
9de0: 20 20 20 2d 2d 20 63 6f 6e 74 61 69 6e 69 6e 67 -- containing
9df0: 20 74 68 65 20 70 72 69 6d 61 72 79 20 63 68 69 the primary chi
9e00: 6c 64 0a 20 20 20 20 20 20 20 20 20 20 20 20 41 ld. A
9e10: 4e 44 20 20 20 20 43 2e 74 79 70 65 20 3d 20 30 ND C.type = 0
9e20: 20 20 20 20 20 20 20 20 20 20 20 20 20 2d 2d 20 --
9e30: 77 68 69 63 68 20 61 72 65 20 72 65 76 69 73 69 which are revisi
9e40: 6f 6e 20 63 68 61 6e 67 65 73 65 74 73 0a 20 20 on changesets.
9e50: 20 20 55 4e 49 4f 4e 0a 20 20 20 20 2d 2d 20 28 UNION. -- (
9e60: 32 29 20 53 65 63 6f 6e 64 61 72 79 20 28 62 72 2) Secondary (br
9e70: 61 6e 63 68 29 20 63 68 69 6c 64 72 65 6e 0a 09 anch) children..
9e80: 20 20 20 20 53 45 4c 45 43 54 20 43 2e 63 69 64 SELECT C.cid
9e90: 0a 09 20 20 20 20 46 52 4f 4d 20 20 20 72 65 76 .. FROM rev
9ea0: 69 73 69 6f 6e 20 52 2c 20 72 65 76 69 73 69 6f ision R, revisio
9eb0: 6e 62 72 61 6e 63 68 63 68 69 6c 64 72 65 6e 20 nbranchchildren
9ec0: 42 2c 20 63 73 69 74 65 6d 20 43 49 2c 20 63 68 B, csitem CI, ch
9ed0: 61 6e 67 65 73 65 74 20 43 0a 09 20 20 20 20 57 angeset C.. W
9ee0: 48 45 52 45 20 20 52 2e 72 69 64 20 20 20 49 4e HERE R.rid IN
9ef0: 20 24 74 68 65 73 65 74 20 20 20 20 20 2d 2d 20 $theset --
9f00: 52 65 73 74 72 69 63 74 20 74 6f 20 72 65 76 69 Restrict to revi
9f10: 73 69 6f 6e 73 20 6f 66 20 69 6e 74 65 72 65 73 sions of interes
9f20: 74 0a 09 20 20 20 20 41 4e 44 20 20 20 20 52 2e t.. AND R.
9f30: 72 69 64 20 3d 20 42 2e 72 69 64 20 20 20 20 20 rid = B.rid
9f40: 20 20 20 20 20 2d 2d 20 53 65 6c 65 63 74 20 73 -- Select s
9f50: 75 62 73 65 74 20 6f 66 20 62 72 61 6e 63 68 20 ubset of branch
9f60: 63 68 69 6c 64 72 65 6e 0a 20 20 20 20 20 20 20 children.
9f70: 20 20 20 20 20 41 4e 44 20 20 20 20 43 49 2e 69 AND CI.i
9f80: 69 64 20 3d 20 42 2e 62 72 69 64 20 20 20 20 20 id = B.brid
9f90: 20 20 20 2d 2d 20 53 65 6c 65 63 74 20 61 6c 6c -- Select all
9fa0: 20 63 68 61 6e 67 65 73 65 74 73 0a 20 20 20 20 changesets.
9fb0: 20 20 20 20 20 20 20 20 41 4e 44 20 20 20 20 43 AND C
9fc0: 2e 63 69 64 20 3d 20 43 49 2e 63 69 64 09 20 20 .cid = CI.cid.
9fd0: 2d 2d 20 63 6f 6e 74 61 69 6e 69 6e 67 20 74 68 -- containing th
9fe0: 65 20 62 72 61 6e 63 68 0a 20 20 20 20 20 20 20 e branch.
9ff0: 20 20 20 20 20 41 4e 44 20 20 20 20 43 2e 74 79 AND C.ty
a000: 70 65 20 3d 20 30 09 09 20 20 2d 2d 20 77 68 69 pe = 0.. -- whi
a010: 63 68 20 61 72 65 20 72 65 76 69 73 69 6f 6e 20 ch are revision
a020: 63 68 61 6e 67 65 73 65 74 73 0a 20 20 20 20 55 changesets. U
a030: 4e 49 4f 4e 0a 20 20 20 20 2d 2d 20 28 34 29 20 NION. -- (4)
a040: 43 68 69 6c 64 20 6f 66 20 74 72 75 6e 6b 20 72 Child of trunk r
a050: 6f 6f 74 20 73 75 63 63 65 73 73 6f 72 20 6f 66 oot successor of
a060: 20 6c 61 73 74 20 4e 54 44 42 20 6f 6e 20 74 72 last NTDB on tr
a070: 75 6e 6b 2e 0a 09 20 20 20 20 53 45 4c 45 43 54 unk... SELECT
a080: 20 43 2e 63 69 64 0a 09 20 20 20 20 46 52 4f 4d C.cid.. FROM
a090: 20 20 20 72 65 76 69 73 69 6f 6e 20 52 2c 20 72 revision R, r
a0a0: 65 76 69 73 69 6f 6e 20 52 41 2c 20 63 73 69 74 evision RA, csit
a0b0: 65 6d 20 43 49 2c 20 63 68 61 6e 67 65 73 65 74 em CI, changeset
a0c0: 20 43 0a 09 20 20 20 20 57 48 45 52 45 20 20 52 C.. WHERE R
a0d0: 2e 72 69 64 20 20 20 49 4e 20 24 74 68 65 73 65 .rid IN $these
a0e0: 74 20 20 20 20 20 20 2d 2d 20 52 65 73 74 72 69 t -- Restri
a0f0: 63 74 20 74 6f 20 72 65 76 69 73 69 6f 6e 73 20 ct to revisions
a100: 6f 66 20 69 6e 74 65 72 65 73 74 0a 09 20 20 20 of interest..
a110: 20 41 4e 44 20 20 20 20 52 2e 69 73 64 65 66 61 AND R.isdefa
a120: 75 6c 74 20 20 20 20 20 20 20 20 20 20 20 20 20 ult
a130: 2d 2d 20 52 65 73 74 72 69 63 74 20 74 6f 20 4e -- Restrict to N
a140: 54 44 42 0a 09 20 20 20 20 41 4e 44 20 20 20 20 TDB.. AND
a150: 52 2e 64 62 63 68 69 6c 64 20 49 53 20 4e 4f 54 R.dbchild IS NOT
a160: 20 4e 55 4c 4c 20 20 20 2d 2d 20 61 6e 64 20 6c NULL -- and l
a170: 61 73 74 20 4e 54 44 42 20 62 65 6c 6f 6e 67 69 ast NTDB belongi
a180: 6e 67 20 74 6f 20 74 72 75 6e 6b 0a 09 20 20 20 ng to trunk..
a190: 20 41 4e 44 20 20 20 20 52 41 2e 72 69 64 20 3d AND RA.rid =
a1a0: 20 52 2e 64 62 63 68 69 6c 64 20 20 20 20 20 20 R.dbchild
a1b0: 2d 2d 20 47 6f 20 64 69 72 65 63 74 6c 79 20 74 -- Go directly t
a1c0: 6f 20 74 72 75 6e 6b 20 72 6f 6f 74 0a 09 20 20 o trunk root..
a1d0: 20 20 41 4e 44 20 20 20 20 52 41 2e 63 68 69 6c AND RA.chil
a1e0: 64 20 49 53 20 4e 4f 54 20 4e 55 4c 4c 20 20 20 d IS NOT NULL
a1f0: 20 2d 2d 20 48 61 73 20 70 72 69 6d 61 72 79 20 -- Has primary
a200: 63 68 69 6c 64 2e 0a 20 20 20 20 20 20 20 20 20 child..
a210: 20 20 20 41 4e 44 20 20 20 20 43 49 2e 69 69 64 AND CI.iid
a220: 20 3d 20 52 41 2e 63 68 69 6c 64 20 20 20 20 20 = RA.child
a230: 20 20 2d 2d 20 53 65 6c 65 63 74 20 61 6c 6c 20 -- Select all
a240: 63 68 61 6e 67 65 73 65 74 73 0a 20 20 20 20 20 changesets.
a250: 20 20 20 20 20 20 20 41 4e 44 20 20 20 20 43 2e AND C.
a260: 63 69 64 20 3d 20 43 49 2e 63 69 64 09 20 20 20 cid = CI.cid.
a270: 2d 2d 20 63 6f 6e 74 61 69 6e 69 6e 67 20 74 68 -- containing th
a280: 65 20 70 72 69 6d 61 72 79 20 63 68 69 6c 64 0a e primary child.
a290: 20 20 20 20 20 20 20 20 20 20 20 20 41 4e 44 20 AND
a2a0: 20 20 20 43 2e 74 79 70 65 20 3d 20 30 09 09 20 C.type = 0..
a2b0: 20 20 2d 2d 20 77 68 69 63 68 20 61 72 65 20 72 -- which are r
a2c0: 65 76 69 73 69 6f 6e 20 63 68 61 6e 67 65 73 65 evision changese
a2d0: 74 73 0a 20 20 20 20 55 4e 49 4f 4e 0a 09 20 20 ts. UNION..
a2e0: 20 20 53 45 4c 45 43 54 20 43 2e 63 69 64 0a 09 SELECT C.cid..
a2f0: 20 20 20 20 46 52 4f 4d 20 20 20 72 65 76 69 73 FROM revis
a300: 69 6f 6e 20 52 2c 20 74 61 67 20 54 2c 20 63 73 ion R, tag T, cs
a310: 69 74 65 6d 20 43 49 2c 20 63 68 61 6e 67 65 73 item CI, changes
a320: 65 74 20 43 0a 09 20 20 20 20 57 48 45 52 45 20 et C.. WHERE
a330: 20 52 2e 72 69 64 20 69 6e 20 24 74 68 65 73 65 R.rid in $these
a340: 74 20 20 20 20 20 20 20 20 2d 2d 20 52 65 73 74 t -- Rest
a350: 72 69 63 74 20 74 6f 20 72 65 76 69 73 69 6f 6e rict to revision
a360: 73 20 6f 66 20 69 6e 74 65 72 65 73 74 0a 09 20 s of interest..
a370: 20 20 20 41 4e 44 20 20 20 20 54 2e 72 65 76 20 AND T.rev
a380: 3d 20 52 2e 72 69 64 09 20 20 20 2d 2d 20 53 65 = R.rid. -- Se
a390: 6c 65 63 74 20 74 61 67 73 20 61 74 74 61 63 68 lect tags attach
a3a0: 65 64 20 74 6f 20 74 68 65 6d 0a 20 20 20 20 20 ed to them.
a3b0: 20 20 20 20 20 20 20 41 4e 44 20 20 20 20 43 49 AND CI
a3c0: 2e 69 69 64 20 3d 20 54 2e 74 69 64 20 20 20 20 .iid = T.tid
a3d0: 20 20 20 20 20 20 2d 2d 20 53 65 6c 65 63 74 20 -- Select
a3e0: 61 6c 6c 20 63 68 61 6e 67 65 73 65 74 73 0a 20 all changesets.
a3f0: 20 20 20 20 20 20 20 20 20 20 20 41 4e 44 20 20 AND
a400: 20 20 43 2e 63 69 64 20 3d 20 43 49 2e 63 69 64 C.cid = CI.cid
a410: 09 20 20 20 2d 2d 20 63 6f 6e 74 61 69 6e 69 6e . -- containin
a420: 67 20 74 68 65 20 74 61 67 73 0a 20 20 20 20 20 g the tags.
a430: 20 20 20 20 20 20 20 41 4e 44 20 20 20 20 43 2e AND C.
a440: 74 79 70 65 20 3d 20 31 09 09 20 20 20 2d 2d 20 type = 1.. --
a450: 77 68 69 63 68 20 61 72 65 20 74 61 67 20 63 68 which are tag ch
a460: 61 6e 67 65 73 65 74 73 0a 20 20 20 20 55 4e 49 angesets. UNI
a470: 4f 4e 0a 09 20 20 20 20 53 45 4c 45 43 54 20 43 ON.. SELECT C
a480: 2e 63 69 64 0a 09 20 20 20 20 46 52 4f 4d 20 20 .cid.. FROM
a490: 20 72 65 76 69 73 69 6f 6e 20 52 2c 20 62 72 61 revision R, bra
a4a0: 6e 63 68 20 42 2c 20 63 73 69 74 65 6d 20 43 49 nch B, csitem CI
a4b0: 2c 20 63 68 61 6e 67 65 73 65 74 20 43 0a 09 20 , changeset C..
a4c0: 20 20 20 57 48 45 52 45 20 20 52 2e 72 69 64 20 WHERE R.rid
a4d0: 69 6e 20 24 74 68 65 73 65 74 20 20 20 20 20 20 in $theset
a4e0: 20 20 2d 2d 20 52 65 73 74 72 69 63 74 20 74 6f -- Restrict to
a4f0: 20 72 65 76 69 73 69 6f 6e 73 20 6f 66 20 69 6e revisions of in
a500: 74 65 72 65 73 74 0a 09 20 20 20 20 41 4e 44 20 terest.. AND
a510: 20 20 20 42 2e 72 6f 6f 74 20 3d 20 52 2e 72 69 B.root = R.ri
a520: 64 09 20 20 20 2d 2d 20 53 65 6c 65 63 74 20 62 d. -- Select b
a530: 72 61 6e 63 68 65 73 20 61 74 74 61 63 68 65 64 ranches attached
a540: 20 74 6f 20 74 68 65 6d 0a 20 20 20 20 20 20 20 to them.
a550: 20 20 20 20 20 41 4e 44 20 20 20 20 43 49 2e 69 AND CI.i
a560: 69 64 20 3d 20 42 2e 62 69 64 20 20 20 20 20 20 id = B.bid
a570: 20 20 20 20 2d 2d 20 53 65 6c 65 63 74 20 61 6c -- Select al
a580: 6c 20 63 68 61 6e 67 65 73 65 74 73 0a 20 20 20 l changesets.
a590: 20 20 20 20 20 20 20 20 20 41 4e 44 20 20 20 20 AND
a5a0: 43 2e 63 69 64 20 3d 20 43 49 2e 63 69 64 09 20 C.cid = CI.cid.
a5b0: 20 20 2d 2d 20 63 6f 6e 74 61 69 6e 69 6e 67 20 -- containing
a5c0: 74 68 65 20 62 72 61 6e 63 68 65 73 0a 20 20 20 the branches.
a5d0: 20 20 20 20 20 20 20 20 20 41 4e 44 20 20 20 20 AND
a5e0: 43 2e 74 79 70 65 20 3d 20 32 09 09 20 20 20 2d C.type = 2.. -
a5f0: 2d 20 77 68 69 63 68 20 61 72 65 20 62 72 61 6e - which are bran
a600: 63 68 20 63 68 61 6e 67 65 73 65 74 73 0a 09 7d ch changesets..}
a610: 5d 5d 0a 20 20 20 20 7d 0a 7d 0a 0a 23 20 23 20 ]]. }.}..# #
a620: 23 23 20 23 23 23 20 23 23 23 23 23 20 23 23 23 ## ### ##### ###
a630: 23 23 23 23 23 20 23 23 23 23 23 23 23 23 23 23 ##### ##########
a640: 23 23 23 20 23 23 23 23 23 23 23 23 23 23 23 23 ### ############
a650: 23 23 23 23 23 23 23 23 23 0a 23 23 20 48 65 6c #########.## Hel
a660: 70 65 72 20 73 69 6e 67 6c 65 74 6f 6e 2e 20 43 per singleton. C
a670: 6f 6d 6d 61 6e 64 73 20 66 6f 72 20 74 61 67 20 ommands for tag
a680: 73 79 6d 62 6f 6c 20 63 68 61 6e 67 65 73 65 74 symbol changeset
a690: 73 2e 0a 0a 73 6e 69 74 3a 3a 74 79 70 65 20 3a s...snit::type :
a6a0: 3a 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 :vc::fossil::imp
a6b0: 6f 72 74 3a 3a 63 76 73 3a 3a 70 72 6f 6a 65 63 ort::cvs::projec
a6c0: 74 3a 3a 72 65 76 3a 3a 73 79 6d 3a 3a 74 61 67 t::rev::sym::tag
a6d0: 20 7b 0a 20 20 20 20 74 79 70 65 6d 65 74 68 6f {. typemetho
a6e0: 64 20 62 79 72 65 76 69 73 69 6f 6e 20 7b 7d 20 d byrevision {}
a6f0: 7b 20 72 65 74 75 72 6e 20 30 20 7d 0a 20 20 20 { return 0 }.
a700: 20 74 79 70 65 6d 65 74 68 6f 64 20 62 79 73 79 typemethod bysy
a710: 6d 62 6f 6c 20 20 20 7b 7d 20 7b 20 72 65 74 75 mbol {} { retu
a720: 72 6e 20 31 20 7d 0a 20 20 20 20 74 79 70 65 6d rn 1 }. typem
a730: 65 74 68 6f 64 20 69 73 74 61 67 20 20 20 20 20 ethod istag
a740: 20 7b 7d 20 7b 20 72 65 74 75 72 6e 20 31 20 7d {} { return 1 }
a750: 0a 20 20 20 20 74 79 70 65 6d 65 74 68 6f 64 20 . typemethod
a760: 69 73 62 72 61 6e 63 68 20 20 20 7b 7d 20 7b 20 isbranch {} {
a770: 72 65 74 75 72 6e 20 30 20 7d 0a 0a 20 20 20 20 return 0 }..
a780: 74 79 70 65 6d 65 74 68 6f 64 20 73 74 72 20 7b typemethod str {
a790: 74 61 67 7d 20 7b 0a 09 73 74 72 75 63 74 3a 3a tag} {..struct::
a7a0: 6c 69 73 74 20 61 73 73 69 67 6e 20 5b 73 74 61 list assign [sta
a7b0: 74 65 20 72 75 6e 20 7b 0a 09 20 20 20 20 53 45 te run {.. SE
a7c0: 4c 45 43 54 20 53 2e 6e 61 6d 65 2c 20 46 2e 6e LECT S.name, F.n
a7d0: 61 6d 65 2c 20 50 2e 6e 61 6d 65 0a 09 20 20 20 ame, P.name..
a7e0: 20 46 52 4f 4d 20 20 20 74 61 67 20 54 2c 20 73 FROM tag T, s
a7f0: 79 6d 62 6f 6c 20 53 2c 20 66 69 6c 65 20 46 2c ymbol S, file F,
a800: 20 70 72 6f 6a 65 63 74 20 50 0a 09 20 20 20 20 project P..
a810: 57 48 45 52 45 20 20 54 2e 74 69 64 20 3d 20 24 WHERE T.tid = $
a820: 74 61 67 20 20 20 2d 2d 20 46 69 6e 64 20 73 70 tag -- Find sp
a830: 65 63 69 66 69 65 64 20 74 61 67 0a 09 20 20 20 ecified tag..
a840: 20 41 4e 44 20 20 20 20 46 2e 66 69 64 20 3d 20 AND F.fid =
a850: 54 2e 66 69 64 20 20 2d 2d 20 47 65 74 20 66 69 T.fid -- Get fi
a860: 6c 65 20 6f 66 20 74 61 67 0a 09 20 20 20 20 41 le of tag.. A
a870: 4e 44 20 20 20 20 50 2e 70 69 64 20 3d 20 46 2e ND P.pid = F.
a880: 70 69 64 20 20 2d 2d 20 47 65 74 20 70 72 6f 6a pid -- Get proj
a890: 65 63 74 20 6f 66 20 66 69 6c 65 0a 09 20 20 20 ect of file..
a8a0: 20 41 4e 44 20 20 20 20 53 2e 73 69 64 20 3d 20 AND S.sid =
a8b0: 54 2e 73 69 64 20 20 2d 2d 20 47 65 74 20 73 79 T.sid -- Get sy
a8c0: 6d 62 6f 6c 20 6f 66 20 74 61 67 0a 09 7d 5d 20 mbol of tag..}]
a8d0: 73 6e 61 6d 65 20 66 6e 61 6d 65 20 70 6e 61 6d sname fname pnam
a8e0: 65 0a 09 72 65 74 75 72 6e 20 22 24 70 6e 61 6d e..return "$pnam
a8f0: 65 2f 54 27 24 7b 73 6e 61 6d 65 7d 27 3a 3a 24 e/T'${sname}'::$
a900: 66 6e 61 6d 65 22 0a 20 20 20 20 7d 0a 0a 20 20 fname". }..
a910: 20 20 23 20 72 65 73 75 6c 74 20 3d 20 6c 69 73 # result = lis
a920: 74 20 28 6d 69 6e 74 69 6d 65 2c 20 6d 61 78 74 t (mintime, maxt
a930: 69 6d 65 29 0a 20 20 20 20 74 79 70 65 6d 65 74 ime). typemet
a940: 68 6f 64 20 74 69 6d 65 72 61 6e 67 65 20 7b 74 hod timerange {t
a950: 61 67 73 7d 20 7b 0a 09 23 20 54 68 65 20 72 61 ags} {..# The ra
a960: 6e 67 65 20 69 73 20 64 65 66 69 6e 65 64 20 61 nge is defined a
a970: 73 20 74 68 65 20 72 61 6e 67 65 20 6f 66 20 74 s the range of t
a980: 68 65 20 72 65 76 69 73 69 6f 6e 73 20 74 68 65 he revisions the
a990: 20 74 61 67 73 0a 09 23 20 61 72 65 20 61 74 74 tags..# are att
a9a0: 61 63 68 65 64 20 74 6f 2e 0a 0a 09 73 65 74 20 ached to....set
a9b0: 74 68 65 73 65 74 20 28 27 5b 6a 6f 69 6e 20 24 theset ('[join $
a9c0: 74 61 67 73 20 7b 27 2c 27 7d 5d 27 29 0a 09 72 tags {','}]')..r
a9d0: 65 74 75 72 6e 20 5b 73 74 61 74 65 20 72 75 6e eturn [state run
a9e0: 20 5b 73 75 62 73 74 20 2d 6e 6f 63 6f 6d 6d 61 [subst -nocomma
a9f0: 6e 64 73 20 2d 6e 6f 62 61 63 6b 73 6c 61 73 68 nds -nobackslash
aa00: 65 73 20 7b 0a 09 20 20 20 20 53 45 4c 45 43 54 es {.. SELECT
aa10: 20 4d 49 4e 28 52 2e 64 61 74 65 29 2c 20 4d 41 MIN(R.date), MA
aa20: 58 28 52 2e 64 61 74 65 29 0a 09 20 20 20 20 46 X(R.date).. F
aa30: 52 4f 4d 20 20 20 74 61 67 20 54 2c 20 72 65 76 ROM tag T, rev
aa40: 69 73 69 6f 6e 20 52 0a 09 20 20 20 20 57 48 45 ision R.. WHE
aa50: 52 45 20 20 54 2e 74 69 64 20 49 4e 20 24 74 68 RE T.tid IN $th
aa60: 65 73 65 74 20 20 2d 2d 20 52 65 73 74 72 69 63 eset -- Restric
aa70: 74 20 74 6f 20 74 61 67 73 20 6f 66 20 69 6e 74 t to tags of int
aa80: 65 72 65 73 74 0a 20 20 20 20 20 20 20 20 20 20 erest.
aa90: 20 20 41 4e 44 20 20 20 20 52 2e 72 69 64 20 3d AND R.rid =
aaa0: 20 54 2e 72 65 76 20 20 20 20 20 2d 2d 20 53 65 T.rev -- Se
aab0: 6c 65 63 74 20 74 61 67 20 70 61 72 65 6e 74 20 lect tag parent
aac0: 72 65 76 69 73 69 6f 6e 73 0a 09 7d 5d 5d 0a 20 revisions..}]].
aad0: 20 20 20 7d 0a 0a 20 20 20 20 23 20 76 61 72 28 }.. # var(
aae0: 64 76 29 20 3d 20 64 69 63 74 20 28 69 74 65 6d dv) = dict (item
aaf0: 20 2d 3e 20 6c 69 73 74 20 28 69 74 65 6d 29 29 -> list (item))
ab00: 2c 20 69 74 65 6d 20 20 3d 20 6c 69 73 74 20 28 , item = list (
ab10: 74 79 70 65 20 69 64 29 0a 20 20 20 20 74 79 70 type id). typ
ab20: 65 6d 65 74 68 6f 64 20 73 75 63 63 65 73 73 6f emethod successo
ab30: 72 73 20 7b 64 76 20 74 61 67 73 7d 20 7b 0a 09 rs {dv tags} {..
ab40: 23 20 54 61 67 73 20 68 61 76 65 20 6e 6f 20 73 # Tags have no s
ab50: 75 63 63 65 73 73 6f 72 73 2e 0a 09 72 65 74 75 uccessors...retu
ab60: 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 23 20 rn. }.. #
ab70: 72 65 73 75 6c 74 20 3d 20 34 2d 6c 69 73 74 20 result = 4-list
ab80: 28 69 74 65 6d 74 79 70 65 20 69 74 65 6d 69 64 (itemtype itemid
ab90: 20 6e 65 78 74 69 74 65 6d 74 79 70 65 20 6e 65 nextitemtype ne
aba0: 78 74 69 74 65 6d 69 64 20 2e 2e 2e 29 0a 20 20 xtitemid ...).
abb0: 20 20 74 79 70 65 6d 65 74 68 6f 64 20 6c 6f 6f typemethod loo
abc0: 70 73 20 7b 74 61 67 73 7d 20 7b 0a 09 23 20 54 ps {tags} {..# T
abd0: 61 67 73 20 68 61 76 65 20 6e 6f 20 73 75 63 63 ags have no succ
abe0: 65 73 73 6f 72 73 2c 20 74 68 65 72 65 66 6f 72 essors, therefor
abf0: 65 20 63 61 6e 6e 6f 74 20 63 61 75 73 65 20 6c e cannot cause l
ac00: 6f 6f 70 73 0a 09 72 65 74 75 72 6e 20 7b 7d 0a oops..return {}.
ac10: 20 20 20 20 7d 0a 0a 20 20 20 20 23 20 72 65 73 }.. # res
ac20: 75 6c 74 20 3d 20 6c 69 73 74 20 28 63 68 61 6e ult = list (chan
ac30: 67 65 73 65 74 2d 69 64 29 0a 20 20 20 20 74 79 geset-id). ty
ac40: 70 65 6d 65 74 68 6f 64 20 63 73 5f 73 75 63 63 pemethod cs_succ
ac50: 65 73 73 6f 72 73 20 7b 74 61 67 73 7d 20 7b 0a essors {tags} {.
ac60: 09 23 20 54 61 67 73 20 68 61 76 65 20 6e 6f 20 .# Tags have no
ac70: 73 75 63 63 65 73 73 6f 72 73 2e 0a 09 72 65 74 successors...ret
ac80: 75 72 6e 0a 20 20 20 20 7d 0a 7d 0a 0a 23 20 23 urn. }.}..# #
ac90: 20 23 23 20 23 23 23 20 23 23 23 23 23 20 23 23 ## ### ##### ##
aca0: 23 23 23 23 23 23 20 23 23 23 23 23 23 23 23 23 ###### #########
acb0: 23 23 23 23 20 23 23 23 23 23 23 23 23 23 23 23 #### ###########
acc0: 23 23 23 23 23 23 23 23 23 23 0a 23 23 20 48 65 ##########.## He
acd0: 6c 70 65 72 20 73 69 6e 67 6c 65 74 6f 6e 2e 20 lper singleton.
ace0: 43 6f 6d 6d 61 6e 64 73 20 66 6f 72 20 62 72 61 Commands for bra
acf0: 6e 63 68 20 73 79 6d 62 6f 6c 20 63 68 61 6e 67 nch symbol chang
ad00: 65 73 65 74 73 2e 0a 0a 73 6e 69 74 3a 3a 74 79 esets...snit::ty
ad10: 70 65 20 3a 3a 76 63 3a 3a 66 6f 73 73 69 6c 3a pe ::vc::fossil:
ad20: 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 70 72 :import::cvs::pr
ad30: 6f 6a 65 63 74 3a 3a 72 65 76 3a 3a 73 79 6d 3a oject::rev::sym:
ad40: 3a 62 72 61 6e 63 68 20 7b 0a 20 20 20 20 74 79 :branch {. ty
ad50: 70 65 6d 65 74 68 6f 64 20 62 79 72 65 76 69 73 pemethod byrevis
ad60: 69 6f 6e 20 7b 7d 20 7b 20 72 65 74 75 72 6e 20 ion {} { return
ad70: 30 20 7d 0a 20 20 20 20 74 79 70 65 6d 65 74 68 0 }. typemeth
ad80: 6f 64 20 62 79 73 79 6d 62 6f 6c 20 20 20 7b 7d od bysymbol {}
ad90: 20 7b 20 72 65 74 75 72 6e 20 31 20 7d 0a 20 20 { return 1 }.
ada0: 20 20 74 79 70 65 6d 65 74 68 6f 64 20 69 73 74 typemethod ist
adb0: 61 67 20 20 20 20 20 20 7b 7d 20 7b 20 72 65 74 ag {} { ret
adc0: 75 72 6e 20 30 20 7d 0a 20 20 20 20 74 79 70 65 urn 0 }. type
add0: 6d 65 74 68 6f 64 20 69 73 62 72 61 6e 63 68 20 method isbranch
ade0: 20 20 7b 7d 20 7b 20 72 65 74 75 72 6e 20 31 20 {} { return 1
adf0: 7d 0a 0a 20 20 20 20 74 79 70 65 6d 65 74 68 6f }.. typemetho
ae00: 64 20 73 74 72 20 7b 62 72 61 6e 63 68 7d 20 7b d str {branch} {
ae10: 0a 09 73 74 72 75 63 74 3a 3a 6c 69 73 74 20 61 ..struct::list a
ae20: 73 73 69 67 6e 20 5b 73 74 61 74 65 20 72 75 6e ssign [state run
ae30: 20 7b 0a 09 20 20 20 20 53 45 4c 45 43 54 20 53 {.. SELECT S
ae40: 2e 6e 61 6d 65 2c 20 46 2e 6e 61 6d 65 2c 20 50 .name, F.name, P
ae50: 2e 6e 61 6d 65 0a 09 20 20 20 20 46 52 4f 4d 20 .name.. FROM
ae60: 20 20 62 72 61 6e 63 68 20 42 2c 20 73 79 6d 62 branch B, symb
ae70: 6f 6c 20 53 2c 20 66 69 6c 65 20 46 2c 20 70 72 ol S, file F, pr
ae80: 6f 6a 65 63 74 20 50 0a 09 20 20 20 20 57 48 45 oject P.. WHE
ae90: 52 45 20 20 42 2e 62 69 64 20 3d 20 24 62 72 61 RE B.bid = $bra
aea0: 6e 63 68 20 20 2d 2d 20 46 69 6e 64 20 73 70 65 nch -- Find spe
aeb0: 63 69 66 69 65 64 20 62 72 61 6e 63 68 0a 09 20 cified branch..
aec0: 20 20 20 41 4e 44 20 20 20 20 46 2e 66 69 64 20 AND F.fid
aed0: 3d 20 42 2e 66 69 64 20 20 20 20 2d 2d 20 47 65 = B.fid -- Ge
aee0: 74 20 66 69 6c 65 20 6f 66 20 62 72 61 6e 63 68 t file of branch
aef0: 0a 09 20 20 20 20 41 4e 44 20 20 20 20 50 2e 70 .. AND P.p
af00: 69 64 20 3d 20 46 2e 70 69 64 20 20 20 20 2d 2d id = F.pid --
af10: 20 47 65 74 20 70 72 6f 6a 65 63 74 20 6f 66 20 Get project of
af20: 66 69 6c 65 0a 09 20 20 20 20 41 4e 44 20 20 20 file.. AND
af30: 20 53 2e 73 69 64 20 3d 20 42 2e 73 69 64 20 20 S.sid = B.sid
af40: 20 20 2d 2d 20 47 65 74 20 73 79 6d 62 6f 6c 20 -- Get symbol
af50: 6f 66 20 62 72 61 6e 63 68 0a 09 7d 5d 20 73 6e of branch..}] sn
af60: 61 6d 65 20 66 6e 61 6d 65 20 70 6e 61 6d 65 0a ame fname pname.
af70: 09 72 65 74 75 72 6e 20 22 24 70 6e 61 6d 65 2f .return "$pname/
af80: 42 27 24 7b 73 6e 61 6d 65 7d 27 3a 3a 24 66 6e B'${sname}'::$fn
af90: 61 6d 65 22 0a 20 20 20 20 7d 0a 0a 20 20 20 20 ame". }..
afa0: 23 20 72 65 73 75 6c 74 20 3d 20 6c 69 73 74 20 # result = list
afb0: 28 6d 69 6e 74 69 6d 65 2c 20 6d 61 78 74 69 6d (mintime, maxtim
afc0: 65 29 0a 20 20 20 20 74 79 70 65 6d 65 74 68 6f e). typemetho
afd0: 64 20 74 69 6d 65 72 61 6e 67 65 20 7b 62 72 61 d timerange {bra
afe0: 6e 63 68 65 73 7d 20 7b 0a 09 23 20 54 68 65 20 nches} {..# The
aff0: 72 61 6e 67 65 20 6f 66 20 61 20 62 72 61 6e 63 range of a branc
b000: 68 20 69 73 20 64 65 66 69 6e 65 64 20 61 73 20 h is defined as
b010: 74 68 65 20 72 61 6e 67 65 20 6f 66 20 74 68 65 the range of the
b020: 0a 09 23 20 72 65 76 69 73 69 6f 6e 73 20 74 68 ..# revisions th
b030: 65 20 62 72 61 6e 63 68 65 73 20 61 72 65 20 73 e branches are s
b040: 70 61 77 6e 65 64 20 62 79 2e 20 4e 4f 54 45 20 pawned by. NOTE
b050: 68 6f 77 65 76 65 72 20 74 68 61 74 20 74 68 65 however that the
b060: 0a 09 23 20 62 72 61 6e 63 68 65 73 20 61 73 73 ..# branches ass
b070: 6f 63 69 61 74 65 64 20 77 69 74 68 20 61 20 64 ociated with a d
b080: 65 74 61 63 68 65 64 20 4e 54 44 42 20 77 69 6c etached NTDB wil
b090: 6c 20 68 61 76 65 20 6e 6f 20 72 6f 6f 74 0a 09 l have no root..
b0a0: 23 20 73 70 61 77 6e 69 6e 67 20 74 68 65 6d 2c # spawning them,
b0b0: 20 68 65 6e 63 65 20 74 68 65 79 20 68 61 76 65 hence they have
b0c0: 20 6e 6f 20 72 65 61 6c 20 74 69 6d 65 72 61 6e no real timeran
b0d0: 67 65 20 61 6e 79 0a 09 23 20 6c 6f 6e 67 65 72 ge any..# longer
b0e0: 2e 20 42 79 20 75 73 69 6e 67 20 30 20 77 65 20 . By using 0 we
b0f0: 70 75 74 20 74 68 65 6d 20 69 6e 20 66 72 6f 6e put them in fron
b100: 74 20 6f 66 20 65 76 65 72 79 74 68 69 6e 67 20 t of everything
b110: 65 6c 73 65 2c 0a 09 23 20 61 73 20 74 68 65 79 else,..# as they
b120: 20 6c 6f 67 69 63 61 6c 6c 79 20 61 72 65 2e 0a logically are..
b130: 0a 09 73 65 74 20 74 68 65 73 65 74 20 28 27 5b ..set theset ('[
b140: 6a 6f 69 6e 20 24 62 72 61 6e 63 68 65 73 20 7b join $branches {
b150: 27 2c 27 7d 5d 27 29 0a 09 72 65 74 75 72 6e 20 ','}]')..return
b160: 5b 73 74 61 74 65 20 72 75 6e 20 5b 73 75 62 73 [state run [subs
b170: 74 20 2d 6e 6f 63 6f 6d 6d 61 6e 64 73 20 2d 6e t -nocommands -n
b180: 6f 62 61 63 6b 73 6c 61 73 68 65 73 20 7b 0a 09 obackslashes {..
b190: 20 20 20 20 53 45 4c 45 43 54 20 49 46 4e 55 4c SELECT IFNUL
b1a0: 4c 28 4d 49 4e 28 52 2e 64 61 74 65 29 2c 30 29 L(MIN(R.date),0)
b1b0: 2c 20 49 46 4e 55 4c 4c 28 4d 41 58 28 52 2e 64 , IFNULL(MAX(R.d
b1c0: 61 74 65 29 2c 30 29 0a 09 20 20 20 20 46 52 4f ate),0).. FRO
b1d0: 4d 20 20 62 72 61 6e 63 68 20 42 2c 20 72 65 76 M branch B, rev
b1e0: 69 73 69 6f 6e 20 52 0a 09 20 20 20 20 57 48 45 ision R.. WHE
b1f0: 52 45 20 42 2e 62 69 64 20 49 4e 20 24 74 68 65 RE B.bid IN $the
b200: 73 65 74 20 20 20 2d 2d 20 52 65 73 74 72 69 63 set -- Restric
b210: 74 20 74 6f 20 62 72 61 6e 63 68 65 73 20 6f 66 t to branches of
b220: 20 69 6e 74 65 72 65 73 74 0a 20 20 20 20 20 20 interest.
b230: 20 20 20 20 20 20 41 4e 44 20 20 20 52 2e 72 69 AND R.ri
b240: 64 20 3d 20 42 2e 72 6f 6f 74 20 20 20 20 20 2d d = B.root -
b250: 2d 20 53 65 6c 65 63 74 20 62 72 61 6e 63 68 20 - Select branch
b260: 70 61 72 65 6e 74 20 72 65 76 69 73 69 6f 6e 73 parent revisions
b270: 0a 09 7d 5d 5d 0a 20 20 20 20 7d 0a 0a 20 20 20 ..}]]. }..
b280: 20 23 20 72 65 73 75 6c 74 20 3d 20 34 2d 6c 69 # result = 4-li
b290: 73 74 20 28 69 74 65 6d 74 79 70 65 20 69 74 65 st (itemtype ite
b2a0: 6d 69 64 20 6e 65 78 74 69 74 65 6d 74 79 70 65 mid nextitemtype
b2b0: 20 6e 65 78 74 69 74 65 6d 69 64 20 2e 2e 2e 29 nextitemid ...)
b2c0: 0a 20 20 20 20 74 79 70 65 6d 65 74 68 6f 64 20 . typemethod
b2d0: 6c 6f 6f 70 73 20 7b 62 72 61 6e 63 68 65 73 7d loops {branches}
b2e0: 20 7b 0a 09 23 20 4e 6f 74 65 3a 20 52 65 76 69 {..# Note: Revi
b2f0: 73 69 6f 6e 73 20 61 6e 64 20 74 61 67 73 20 63 sions and tags c
b300: 61 6e 6e 6f 74 20 63 61 75 73 65 20 74 68 65 20 annot cause the
b310: 6c 6f 6f 70 2e 20 42 65 69 6e 67 20 6f 66 20 61 loop. Being of a
b320: 0a 09 23 20 66 75 6e 64 61 6d 65 6e 74 61 6c 6c ..# fundamentall
b330: 79 20 64 69 66 66 65 72 65 6e 74 20 74 79 70 65 y different type
b340: 20 74 68 65 79 20 63 61 6e 6e 6f 74 20 62 65 20 they cannot be
b350: 69 6e 20 74 68 65 20 69 6e 63 6f 6d 69 6e 67 0a in the incoming.
b360: 09 23 20 73 65 74 20 6f 66 20 69 64 73 2e 0a 0a .# set of ids...
b370: 09 73 65 74 20 74 68 65 73 65 74 20 28 27 5b 6a .set theset ('[j
b380: 6f 69 6e 20 24 62 72 61 6e 63 68 65 73 20 7b 27 oin $branches {'
b390: 2c 27 7d 5d 27 29 0a 09 72 65 74 75 72 6e 20 5b ,'}]')..return [
b3a0: 73 74 61 74 65 20 72 75 6e 20 5b 73 75 62 73 74 state run [subst
b3b0: 20 2d 6e 6f 63 6f 6d 6d 61 6e 64 73 20 2d 6e 6f -nocommands -no
b3c0: 62 61 63 6b 73 6c 61 73 68 65 73 20 7b 0a 09 20 backslashes {..
b3d0: 20 20 20 53 45 4c 45 43 54 20 42 2e 62 69 64 2c SELECT B.bid,
b3e0: 20 42 58 2e 62 69 64 0a 09 20 20 20 20 46 52 4f BX.bid.. FRO
b3f0: 4d 20 20 20 62 72 61 6e 63 68 20 42 2c 20 70 72 M branch B, pr
b400: 65 66 65 72 65 64 70 61 72 65 6e 74 20 50 2c 20 eferedparent P,
b410: 62 72 61 6e 63 68 20 42 58 0a 09 20 20 20 20 57 branch BX.. W
b420: 48 45 52 45 20 20 42 2e 62 69 64 20 49 4e 20 24 HERE B.bid IN $
b430: 74 68 65 73 65 74 20 20 20 2d 2d 20 52 65 73 74 theset -- Rest
b440: 72 69 63 74 20 74 6f 20 62 72 61 6e 63 68 65 73 rict to branches
b450: 20 6f 66 20 69 6e 74 65 72 65 73 74 0a 09 20 20 of interest..
b460: 20 20 41 4e 44 20 20 20 20 42 2e 73 69 64 20 3d AND B.sid =
b470: 20 50 2e 70 69 64 20 20 20 20 20 20 2d 2d 20 47 P.pid -- G
b480: 65 74 20 74 68 65 20 70 72 65 66 65 72 65 64 20 et the prefered
b490: 62 72 61 6e 63 68 65 73 20 76 69 61 0a 09 20 20 branches via..
b4a0: 20 20 41 4e 44 20 20 20 20 42 58 2e 73 69 64 20 AND BX.sid
b4b0: 3d 20 50 2e 73 69 64 20 20 20 20 20 2d 2d 20 74 = P.sid -- t
b4c0: 68 65 20 62 72 61 6e 63 68 20 73 79 6d 62 6f 6c he branch symbol
b4d0: 73 0a 09 20 20 20 20 41 4e 44 20 20 20 20 42 58 s.. AND BX
b4e0: 2e 62 69 64 20 49 4e 20 24 74 68 65 73 65 74 20 .bid IN $theset
b4f0: 20 2d 2d 20 4c 6f 6f 70 0a 09 7d 5d 5d 0a 20 20 -- Loop..}]].
b500: 20 20 7d 0a 0a 20 20 20 20 23 20 76 61 72 28 64 }.. # var(d
b510: 76 29 20 3d 20 64 69 63 74 20 28 69 74 65 6d 20 v) = dict (item
b520: 2d 3e 20 6c 69 73 74 20 28 69 74 65 6d 29 29 2c -> list (item)),
b530: 20 69 74 65 6d 20 20 3d 20 6c 69 73 74 20 28 74 item = list (t
b540: 79 70 65 20 69 64 29 0a 20 20 20 20 74 79 70 65 ype id). type
b550: 6d 65 74 68 6f 64 20 73 75 63 63 65 73 73 6f 72 method successor
b560: 73 20 7b 64 76 20 62 72 61 6e 63 68 65 73 7d 20 s {dv branches}
b570: 7b 0a 09 75 70 76 61 72 20 31 20 24 64 76 20 64 {..upvar 1 $dv d
b580: 65 70 65 6e 64 65 6e 63 69 65 73 0a 09 23 20 54 ependencies..# T
b590: 68 65 20 66 69 72 73 74 20 72 65 76 69 73 69 6f he first revisio
b5a0: 6e 20 63 6f 6d 6d 69 74 74 65 64 20 6f 6e 20 61 n committed on a
b5b0: 20 62 72 61 6e 63 68 2c 20 61 6e 64 20 61 6c 6c branch, and all
b5c0: 20 62 72 61 6e 63 68 65 73 0a 09 23 20 61 6e 64 branches..# and
b5d0: 20 74 61 67 73 20 77 68 69 63 68 20 68 61 76 65 tags which have
b5e0: 20 69 74 20 61 73 20 74 68 65 69 72 20 70 72 65 it as their pre
b5f0: 66 65 72 65 64 20 70 61 72 65 6e 74 20 61 72 65 fered parent are
b600: 20 74 68 65 0a 09 23 20 73 75 63 63 65 73 73 6f the..# successo
b610: 72 73 20 6f 66 20 61 20 62 72 61 6e 63 68 2e 0a rs of a branch..
b620: 0a 09 73 65 74 20 74 68 65 73 65 74 20 28 27 5b ..set theset ('[
b630: 6a 6f 69 6e 20 24 62 72 61 6e 63 68 65 73 20 7b join $branches {
b640: 27 2c 27 7d 5d 27 29 0a 09 66 6f 72 65 61 63 68 ','}]')..foreach
b650: 20 7b 62 69 64 20 63 68 69 6c 64 7d 20 5b 73 74 {bid child} [st
b660: 61 74 65 20 72 75 6e 20 5b 73 75 62 73 74 20 2d ate run [subst -
b670: 6e 6f 63 6f 6d 6d 61 6e 64 73 20 2d 6e 6f 62 61 nocommands -noba
b680: 63 6b 73 6c 61 73 68 65 73 20 7b 0a 09 20 20 20 ckslashes {..
b690: 20 53 45 4c 45 43 54 20 42 2e 62 69 64 2c 20 52 SELECT B.bid, R
b6a0: 2e 72 69 64 0a 09 20 20 20 20 46 52 4f 4d 20 20 .rid.. FROM
b6b0: 20 62 72 61 6e 63 68 20 42 2c 20 72 65 76 69 73 branch B, revis
b6c0: 69 6f 6e 20 52 0a 09 20 20 20 20 57 48 45 52 45 ion R.. WHERE
b6d0: 20 20 42 2e 62 69 64 20 49 4e 20 24 74 68 65 73 B.bid IN $thes
b6e0: 65 74 20 20 20 20 20 2d 2d 20 52 65 73 74 72 69 et -- Restri
b6f0: 63 74 20 74 6f 20 62 72 61 6e 63 68 65 73 20 6f ct to branches o
b700: 66 20 69 6e 74 65 72 65 73 74 0a 09 20 20 20 20 f interest..
b710: 41 4e 44 20 20 20 20 42 2e 66 69 72 73 74 20 3d AND B.first =
b720: 20 52 2e 72 69 64 20 20 20 20 20 20 2d 2d 20 47 R.rid -- G
b730: 65 74 20 66 69 72 73 74 20 72 65 76 69 73 69 6f et first revisio
b740: 6e 20 6f 6e 20 74 68 65 20 62 72 61 6e 63 68 0a n on the branch.
b750: 09 7d 5d 5d 20 7b 0a 09 20 20 20 20 6c 61 70 70 .}]] {.. lapp
b760: 65 6e 64 20 64 65 70 65 6e 64 65 6e 63 69 65 73 end dependencies
b770: 28 5b 6c 69 73 74 20 73 79 6d 3a 3a 62 72 61 6e ([list sym::bran
b780: 63 68 20 24 62 69 64 5d 29 20 5b 6c 69 73 74 20 ch $bid]) [list
b790: 72 65 76 20 24 63 68 69 6c 64 5d 0a 09 7d 0a 09 rev $child]..}..
b7a0: 66 6f 72 65 61 63 68 20 7b 62 69 64 20 63 68 69 foreach {bid chi
b7b0: 6c 64 7d 20 5b 73 74 61 74 65 20 72 75 6e 20 5b ld} [state run [
b7c0: 73 75 62 73 74 20 2d 6e 6f 63 6f 6d 6d 61 6e 64 subst -nocommand
b7d0: 73 20 2d 6e 6f 62 61 63 6b 73 6c 61 73 68 65 73 s -nobackslashes
b7e0: 20 7b 0a 09 20 20 20 20 53 45 4c 45 43 54 20 42 {.. SELECT B
b7f0: 2e 62 69 64 2c 20 42 58 2e 62 69 64 0a 09 20 20 .bid, BX.bid..
b800: 20 20 46 52 4f 4d 20 20 20 62 72 61 6e 63 68 20 FROM branch
b810: 42 2c 20 70 72 65 66 65 72 65 64 70 61 72 65 6e B, preferedparen
b820: 74 20 50 2c 20 62 72 61 6e 63 68 20 42 58 0a 09 t P, branch BX..
b830: 20 20 20 20 57 48 45 52 45 20 20 42 2e 62 69 64 WHERE B.bid
b840: 20 49 4e 20 24 74 68 65 73 65 74 20 20 20 20 20 IN $theset
b850: 2d 2d 20 52 65 73 74 72 69 63 74 20 74 6f 20 62 -- Restrict to b
b860: 72 61 6e 63 68 65 73 20 6f 66 20 69 6e 74 65 72 ranches of inter
b870: 65 73 74 0a 09 20 20 20 20 41 4e 44 20 20 20 20 est.. AND
b880: 42 2e 73 69 64 20 3d 20 50 2e 70 69 64 20 20 20 B.sid = P.pid
b890: 20 20 20 20 20 2d 2d 20 47 65 74 20 73 75 62 6f -- Get subo
b8a0: 72 64 69 6e 61 74 65 20 62 72 61 6e 63 68 65 73 rdinate branches
b8b0: 20 76 69 61 20 74 68 65 0a 09 20 20 20 20 41 4e via the.. AN
b8c0: 44 20 20 20 20 42 58 2e 73 69 64 20 3d 20 50 2e D BX.sid = P.
b8d0: 73 69 64 20 20 20 20 20 20 20 2d 2d 20 70 72 65 sid -- pre
b8e0: 66 65 72 65 64 20 70 61 72 65 6e 74 73 20 6f 66 fered parents of
b8f0: 20 74 68 65 69 72 20 73 79 6d 62 6f 6c 73 0a 09 their symbols..
b900: 7d 5d 5d 20 7b 0a 09 20 20 20 20 6c 61 70 70 65 }]] {.. lappe
b910: 6e 64 20 64 65 70 65 6e 64 65 6e 63 69 65 73 28 nd dependencies(
b920: 5b 6c 69 73 74 20 73 79 6d 3a 3a 62 72 61 6e 63 [list sym::branc
b930: 68 20 24 62 69 64 5d 29 20 5b 6c 69 73 74 20 73 h $bid]) [list s
b940: 79 6d 3a 3a 62 72 61 6e 63 68 20 24 63 68 69 6c ym::branch $chil
b950: 64 5d 0a 09 7d 0a 09 66 6f 72 65 61 63 68 20 7b d]..}..foreach {
b960: 62 69 64 20 63 68 69 6c 64 7d 20 5b 73 74 61 74 bid child} [stat
b970: 65 20 72 75 6e 20 5b 73 75 62 73 74 20 2d 6e 6f e run [subst -no
b980: 63 6f 6d 6d 61 6e 64 73 20 2d 6e 6f 62 61 63 6b commands -noback
b990: 73 6c 61 73 68 65 73 20 7b 0a 09 20 20 20 20 53 slashes {.. S
b9a0: 45 4c 45 43 54 20 42 2e 62 69 64 2c 20 54 2e 74 ELECT B.bid, T.t
b9b0: 69 64 0a 09 20 20 20 20 46 52 4f 4d 20 20 20 62 id.. FROM b
b9c0: 72 61 6e 63 68 20 42 2c 20 70 72 65 66 65 72 65 ranch B, prefere
b9d0: 64 70 61 72 65 6e 74 20 50 2c 20 74 61 67 20 54 dparent P, tag T
b9e0: 0a 09 20 20 20 20 57 48 45 52 45 20 20 42 2e 62 .. WHERE B.b
b9f0: 69 64 20 49 4e 20 24 74 68 65 73 65 74 20 20 20 id IN $theset
ba00: 20 20 2d 2d 20 52 65 73 74 72 69 63 74 20 74 6f -- Restrict to
ba10: 20 62 72 61 6e 63 68 65 73 20 6f 66 20 69 6e 74 branches of int
ba20: 65 72 65 73 74 0a 09 20 20 20 20 41 4e 44 20 20 erest.. AND
ba30: 20 20 42 2e 73 69 64 20 3d 20 50 2e 70 69 64 20 B.sid = P.pid
ba40: 20 20 20 20 20 20 20 2d 2d 20 47 65 74 20 73 75 -- Get su
ba50: 62 6f 72 64 69 6e 61 74 65 20 74 61 67 73 20 76 bordinate tags v
ba60: 69 61 20 74 68 65 0a 09 20 20 20 20 41 4e 44 20 ia the.. AND
ba70: 20 20 20 54 2e 73 69 64 20 3d 20 50 2e 73 69 64 T.sid = P.sid
ba80: 20 20 20 20 20 20 20 20 2d 2d 20 70 72 65 66 65 -- prefe
ba90: 72 65 64 20 70 61 72 65 6e 74 73 20 6f 66 20 74 red parents of t
baa0: 68 65 69 72 20 73 79 6d 62 6f 6c 73 0a 09 7d 5d heir symbols..}]
bab0: 5d 20 7b 0a 09 20 20 20 20 6c 61 70 70 65 6e 64 ] {.. lappend
bac0: 20 64 65 70 65 6e 64 65 6e 63 69 65 73 28 5b 6c dependencies([l
bad0: 69 73 74 20 73 79 6d 3a 3a 62 72 61 6e 63 68 20 ist sym::branch
bae0: 24 62 69 64 5d 29 20 5b 6c 69 73 74 20 73 79 6d $bid]) [list sym
baf0: 3a 3a 74 61 67 20 24 63 68 69 6c 64 5d 0a 09 7d ::tag $child]..}
bb00: 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a ..return. }..
bb10: 20 20 20 20 23 20 72 65 73 75 6c 74 20 3d 20 6c # result = l
bb20: 69 73 74 20 28 63 68 61 6e 67 65 73 65 74 2d 69 ist (changeset-i
bb30: 64 29 0a 20 20 20 20 74 79 70 65 6d 65 74 68 6f d). typemetho
bb40: 64 20 63 73 5f 73 75 63 63 65 73 73 6f 72 73 20 d cs_successors
bb50: 7b 62 72 61 6e 63 68 65 73 7d 20 7b 0a 20 20 20 {branches} {.
bb60: 20 20 20 20 20 23 20 54 68 69 73 20 69 73 20 61 # This is a
bb70: 20 76 61 72 69 61 6e 74 20 6f 66 20 27 73 75 63 variant of 'suc
bb80: 63 65 73 73 6f 72 73 27 20 77 68 69 63 68 20 6d cessors' which m
bb90: 61 70 73 20 74 68 65 20 6c 6f 77 2d 6c 65 76 65 aps the low-leve
bba0: 6c 0a 20 20 20 20 20 20 20 20 23 20 64 61 74 61 l. # data
bbb0: 20 64 69 72 65 63 74 6c 79 20 74 6f 20 74 68 65 directly to the
bbc0: 20 61 73 73 6f 63 69 61 74 65 64 20 63 68 61 6e associated chan
bbd0: 67 65 73 65 74 73 2e 20 49 2e 65 2e 20 69 6e 73 gesets. I.e. ins
bbe0: 74 65 61 64 0a 20 20 20 20 20 20 20 20 23 20 6d tead. # m
bbf0: 69 6c 6c 69 6f 6e 73 20 6f 66 20 64 65 70 65 6e illions of depen
bc00: 64 65 6e 63 79 20 70 61 69 72 73 20 28 69 6e 20 dency pairs (in
bc10: 65 78 74 72 65 6d 65 20 63 61 73 65 73 20 28 45 extreme cases (E
bc20: 78 61 6d 70 6c 65 3a 20 54 63 6c 0a 20 20 20 20 xample: Tcl.
bc30: 20 20 20 20 23 20 43 56 53 29 29 20 77 65 20 72 # CVS)) we r
bc40: 65 74 75 72 6e 20 61 20 76 65 72 79 20 73 68 6f eturn a very sho
bc50: 72 74 20 61 6e 64 20 6d 75 63 68 20 6d 6f 72 65 rt and much more
bc60: 20 6d 61 6e 61 67 65 61 62 6c 65 20 6c 69 73 74 manageable list
bc70: 0a 20 20 20 20 20 20 20 20 23 20 6f 66 20 63 68 . # of ch
bc80: 61 6e 67 65 73 65 74 73 2e 0a 0a 09 73 65 74 20 angesets....set
bc90: 74 68 65 73 65 74 20 28 27 5b 6a 6f 69 6e 20 24 theset ('[join $
bca0: 62 72 61 6e 63 68 65 73 20 7b 27 2c 27 7d 5d 27 branches {','}]'
bcb0: 29 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e ). return
bcc0: 20 5b 73 74 61 74 65 20 72 75 6e 20 5b 73 75 62 [state run [sub
bcd0: 73 74 20 2d 6e 6f 63 6f 6d 6d 61 6e 64 73 20 2d st -nocommands -
bce0: 6e 6f 62 61 63 6b 73 6c 61 73 68 65 73 20 7b 0a nobackslashes {.
bcf0: 09 20 20 20 20 53 45 4c 45 43 54 20 43 2e 63 69 . SELECT C.ci
bd00: 64 0a 09 20 20 20 20 46 52 4f 4d 20 20 20 62 72 d.. FROM br
bd10: 61 6e 63 68 20 42 2c 20 72 65 76 69 73 69 6f 6e anch B, revision
bd20: 20 52 2c 20 63 73 69 74 65 6d 20 43 49 2c 20 63 R, csitem CI, c
bd30: 68 61 6e 67 65 73 65 74 20 43 0a 09 20 20 20 20 hangeset C..
bd40: 57 48 45 52 45 20 20 42 2e 62 69 64 20 49 4e 20 WHERE B.bid IN
bd50: 24 74 68 65 73 65 74 20 20 20 20 20 2d 2d 20 52 $theset -- R
bd60: 65 73 74 72 69 63 74 20 74 6f 20 62 72 61 6e 63 estrict to branc
bd70: 68 65 73 20 6f 66 20 69 6e 74 65 72 65 73 74 0a hes of interest.
bd80: 09 20 20 20 20 41 4e 44 20 20 20 20 42 2e 66 69 . AND B.fi
bd90: 72 73 74 20 3d 20 52 2e 72 69 64 09 2d 2d 20 47 rst = R.rid.-- G
bda0: 65 74 20 66 69 72 73 74 20 72 65 76 69 73 69 6f et first revisio
bdb0: 6e 20 6f 6e 20 74 68 65 20 62 72 61 6e 63 68 0a n on the branch.
bdc0: 20 20 20 20 20 20 20 20 20 20 20 20 41 4e 44 20 AND
bdd0: 20 20 20 43 49 2e 69 69 64 20 3d 20 52 2e 72 69 CI.iid = R.ri
bde0: 64 20 20 20 20 20 20 20 2d 2d 20 53 65 6c 65 63 d -- Selec
bdf0: 74 20 61 6c 6c 20 63 68 61 6e 67 65 73 65 74 73 t all changesets
be00: 0a 20 20 20 20 20 20 20 20 20 20 20 20 41 4e 44 . AND
be10: 20 20 20 20 43 2e 63 69 64 20 3d 20 43 49 2e 63 C.cid = CI.c
be20: 69 64 09 2d 2d 20 63 6f 6e 74 61 69 6e 69 6e 67 id.-- containing
be30: 20 74 68 69 73 20 72 65 76 69 73 69 6f 6e 0a 20 this revision.
be40: 20 20 20 20 20 20 20 20 20 20 20 41 4e 44 20 20 AND
be50: 20 20 43 2e 74 79 70 65 20 3d 20 30 09 09 2d 2d C.type = 0..--
be60: 20 77 68 69 63 68 20 61 72 65 20 72 65 76 69 73 which are revis
be70: 69 6f 6e 20 63 68 61 6e 67 65 73 65 74 73 0a 20 ion changesets.
be80: 20 20 20 55 4e 49 4f 4e 0a 09 20 20 20 20 53 45 UNION.. SE
be90: 4c 45 43 54 20 43 2e 63 69 64 0a 09 20 20 20 20 LECT C.cid..
bea0: 46 52 4f 4d 20 20 20 62 72 61 6e 63 68 20 42 2c FROM branch B,
beb0: 20 70 72 65 66 65 72 65 64 70 61 72 65 6e 74 20 preferedparent
bec0: 50 2c 20 62 72 61 6e 63 68 20 42 58 2c 20 63 73 P, branch BX, cs
bed0: 69 74 65 6d 20 43 49 2c 20 63 68 61 6e 67 65 73 item CI, changes
bee0: 65 74 20 43 0a 09 20 20 20 20 57 48 45 52 45 20 et C.. WHERE
bef0: 20 42 2e 62 69 64 20 49 4e 20 24 74 68 65 73 65 B.bid IN $these
bf00: 74 20 20 20 20 20 2d 2d 20 52 65 73 74 72 69 63 t -- Restric
bf10: 74 20 74 6f 20 62 72 61 6e 63 68 65 73 20 6f 66 t to branches of
bf20: 20 69 6e 74 65 72 65 73 74 0a 09 20 20 20 20 41 interest.. A
bf30: 4e 44 20 20 20 20 42 2e 73 69 64 20 3d 20 50 2e ND B.sid = P.
bf40: 70 69 64 09 2d 2d 20 47 65 74 20 73 75 62 6f 72 pid.-- Get subor
bf50: 64 69 6e 61 74 65 20 62 72 61 6e 63 68 65 73 20 dinate branches
bf60: 76 69 61 20 74 68 65 0a 09 20 20 20 20 41 4e 44 via the.. AND
bf70: 20 20 20 20 42 58 2e 73 69 64 20 3d 20 50 2e 73 BX.sid = P.s
bf80: 69 64 09 2d 2d 20 70 72 65 66 65 72 65 64 20 70 id.-- prefered p
bf90: 61 72 65 6e 74 73 20 6f 66 20 74 68 65 69 72 20 arents of their
bfa0: 73 79 6d 62 6f 6c 73 0a 20 20 20 20 20 20 20 20 symbols.
bfb0: 20 20 20 20 41 4e 44 20 20 20 20 43 49 2e 69 69 AND CI.ii
bfc0: 64 20 3d 20 42 58 2e 62 69 64 20 20 20 20 20 20 d = BX.bid
bfd0: 2d 2d 20 53 65 6c 65 63 74 20 61 6c 6c 20 63 68 -- Select all ch
bfe0: 61 6e 67 65 73 65 74 73 0a 20 20 20 20 20 20 20 angesets.
bff0: 20 20 20 20 20 41 4e 44 20 20 20 20 43 2e 63 69 AND C.ci
c000: 64 20 3d 20 43 49 2e 63 69 64 09 2d 2d 20 63 6f d = CI.cid.-- co
c010: 6e 74 61 69 6e 69 6e 67 20 74 68 65 20 73 75 62 ntaining the sub
c020: 6f 72 64 69 6e 61 74 65 20 62 72 61 6e 63 68 65 ordinate branche
c030: 73 0a 20 20 20 20 20 20 20 20 20 20 20 20 41 4e s. AN
c040: 44 20 20 20 20 43 2e 74 79 70 65 20 3d 20 32 09 D C.type = 2.
c050: 09 2d 2d 20 77 68 69 63 68 20 61 72 65 20 62 72 .-- which are br
c060: 61 6e 63 68 20 63 68 61 6e 67 65 73 65 74 73 0a anch changesets.
c070: 20 20 20 20 55 4e 49 4f 4e 0a 09 20 20 20 20 53 UNION.. S
c080: 45 4c 45 43 54 20 43 2e 63 69 64 0a 09 20 20 20 ELECT C.cid..
c090: 20 46 52 4f 4d 20 20 20 62 72 61 6e 63 68 20 42 FROM branch B
c0a0: 2c 20 70 72 65 66 65 72 65 64 70 61 72 65 6e 74 , preferedparent
c0b0: 20 50 2c 20 74 61 67 20 54 2c 20 63 73 69 74 65 P, tag T, csite
c0c0: 6d 20 43 49 2c 20 63 68 61 6e 67 65 73 65 74 20 m CI, changeset
c0d0: 43 0a 09 20 20 20 20 57 48 45 52 45 20 20 42 2e C.. WHERE B.
c0e0: 62 69 64 20 49 4e 20 24 74 68 65 73 65 74 20 20 bid IN $theset
c0f0: 20 20 20 2d 2d 20 52 65 73 74 72 69 63 74 20 74 -- Restrict t
c100: 6f 20 62 72 61 6e 63 68 65 73 20 6f 66 20 69 6e o branches of in
c110: 74 65 72 65 73 74 0a 09 20 20 20 20 41 4e 44 20 terest.. AND
c120: 20 20 20 42 2e 73 69 64 20 3d 20 50 2e 70 69 64 B.sid = P.pid
c130: 09 2d 2d 20 47 65 74 20 73 75 62 6f 72 64 69 6e .-- Get subordin
c140: 61 74 65 20 74 61 67 73 20 76 69 61 20 74 68 65 ate tags via the
c150: 0a 09 20 20 20 20 41 4e 44 20 20 20 20 54 2e 73 .. AND T.s
c160: 69 64 20 3d 20 50 2e 73 69 64 09 2d 2d 20 70 72 id = P.sid.-- pr
c170: 65 66 65 72 65 64 20 70 61 72 65 6e 74 73 20 6f efered parents o
c180: 66 20 74 68 65 69 72 20 73 79 6d 62 6f 6c 73 0a f their symbols.
c190: 20 20 20 20 20 20 20 20 20 20 20 20 41 4e 44 20 AND
c1a0: 20 20 20 43 49 2e 69 69 64 20 3d 20 54 2e 74 69 CI.iid = T.ti
c1b0: 64 20 20 20 20 20 20 20 2d 2d 20 53 65 6c 65 63 d -- Selec
c1c0: 74 20 61 6c 6c 20 63 68 61 6e 67 65 73 65 74 73 t all changesets
c1d0: 0a 20 20 20 20 20 20 20 20 20 20 20 20 41 4e 44 . AND
c1e0: 20 20 20 20 43 2e 63 69 64 20 3d 20 43 49 2e 63 C.cid = CI.c
c1f0: 69 64 09 2d 2d 20 63 6f 6e 74 61 69 6e 69 6e 67 id.-- containing
c200: 20 74 68 65 20 73 75 62 6f 72 64 69 6e 61 74 65 the subordinate
c210: 20 74 61 67 73 0a 20 20 20 20 20 20 20 20 20 20 tags.
c220: 20 20 41 4e 44 20 20 20 20 43 2e 74 79 70 65 20 AND C.type
c230: 3d 20 31 09 09 2d 2d 20 77 68 69 63 68 20 61 72 = 1..-- which ar
c240: 65 20 74 61 67 20 63 68 61 6e 67 65 73 65 74 73 e tag changesets
c250: 0a 09 7d 5d 5d 0a 09 72 65 74 75 72 6e 0a 20 20 ..}]]..return.
c260: 20 20 7d 0a 0a 20 20 20 20 74 79 70 65 6d 65 74 }.. typemet
c270: 68 6f 64 20 6c 69 6d 69 74 73 20 7b 62 72 61 6e hod limits {bran
c280: 63 68 65 73 7d 20 7b 0a 09 23 20 4e 6f 74 65 73 ches} {..# Notes
c290: 2e 20 54 68 69 73 20 6d 65 74 68 6f 64 20 65 78 . This method ex
c2a0: 69 73 74 73 20 6f 6e 6c 79 20 66 6f 72 20 62 72 ists only for br
c2b0: 61 6e 63 68 65 73 2e 20 49 74 20 69 73 20 6e 65 anches. It is ne
c2c0: 65 64 65 64 20 74 6f 0a 09 23 20 67 65 74 20 64 eded to..# get d
c2d0: 65 74 61 69 6c 65 64 20 69 6e 66 6f 72 6d 61 74 etailed informat
c2e0: 69 6f 6e 20 61 62 6f 75 74 20 61 20 62 61 63 6b ion about a back
c2f0: 77 61 72 64 20 62 72 61 6e 63 68 2e 20 49 74 20 ward branch. It
c300: 64 6f 65 73 0a 09 23 20 6e 6f 74 20 61 70 70 6c does..# not appl
c310: 79 20 74 6f 20 74 61 67 73 2c 20 6e 6f 72 20 72 y to tags, nor r
c320: 65 76 69 73 69 6f 6e 73 2e 20 54 68 65 20 71 75 evisions. The qu
c330: 65 72 69 65 73 20 63 61 6e 20 61 6c 73 6f 0a 09 eries can also..
c340: 23 20 72 65 73 74 72 69 63 74 20 74 68 65 6d 73 # restrict thems
c350: 65 6c 76 65 73 20 74 6f 20 74 68 65 20 72 65 76 elves to the rev
c360: 69 73 69 6f 6e 20 73 75 63 65 73 73 6f 72 73 2f ision sucessors/
c370: 70 72 65 64 65 63 65 73 73 6f 72 73 0a 09 23 20 predecessors..#
c380: 6f 66 20 62 72 61 6e 63 68 65 73 2c 20 61 73 20 of branches, as
c390: 6f 6e 6c 79 20 74 68 65 79 20 68 61 76 65 20 6f only they have o
c3a0: 72 64 65 72 69 6e 67 20 64 61 74 61 20 61 6e 64 rdering data and
c3b0: 20 74 68 75 73 20 63 61 6e 0a 09 23 20 63 61 75 thus can..# cau
c3c0: 73 65 20 74 68 65 20 62 61 63 6b 77 61 72 64 6e se the backwardn
c3d0: 65 73 73 2e 0a 0a 09 73 65 74 20 74 68 65 73 65 ess....set these
c3e0: 74 20 28 27 5b 6a 6f 69 6e 20 24 62 72 61 6e 63 t ('[join $branc
c3f0: 68 65 73 20 7b 27 2c 27 7d 5d 27 29 0a 0a 09 73 hes {','}]')...s
c400: 65 74 20 6d 61 78 70 20 5b 73 74 61 74 65 20 72 et maxp [state r
c410: 75 6e 20 5b 73 75 62 73 74 20 2d 6e 6f 63 6f 6d un [subst -nocom
c420: 6d 61 6e 64 73 20 2d 6e 6f 62 61 63 6b 73 6c 61 mands -nobacksla
c430: 73 68 65 73 20 7b 0a 09 20 20 20 20 2d 2d 20 6d shes {.. -- m
c440: 61 78 69 6d 61 6c 20 70 72 65 64 65 63 65 73 73 aximal predecess
c450: 6f 72 20 70 6f 73 69 74 69 6f 6e 20 70 65 72 20 or position per
c460: 62 72 61 6e 63 68 0a 09 20 20 20 20 53 45 4c 45 branch.. SELE
c470: 43 54 20 42 2e 62 69 64 2c 20 4d 41 58 20 28 43 CT B.bid, MAX (C
c480: 4f 2e 70 6f 73 29 0a 09 20 20 20 20 46 52 4f 4d O.pos).. FROM
c490: 20 20 20 62 72 61 6e 63 68 20 42 2c 20 72 65 76 branch B, rev
c4a0: 69 73 69 6f 6e 20 52 2c 20 63 73 69 74 65 6d 20 ision R, csitem
c4b0: 43 49 2c 20 63 68 61 6e 67 65 73 65 74 20 43 2c CI, changeset C,
c4c0: 20 63 73 6f 72 64 65 72 20 43 4f 0a 09 20 20 20 csorder CO..
c4d0: 20 57 48 45 52 45 20 20 42 2e 62 69 64 20 49 4e WHERE B.bid IN
c4e0: 20 24 74 68 65 73 65 74 20 20 20 20 20 2d 2d 20 $theset --
c4f0: 52 65 73 74 72 69 63 74 20 74 6f 20 62 72 61 6e Restrict to bran
c500: 63 68 65 73 20 6f 66 20 69 6e 74 65 72 65 73 74 ches of interest
c510: 0a 09 20 20 20 20 41 4e 44 20 20 20 20 42 2e 72 .. AND B.r
c520: 6f 6f 74 20 3d 20 52 2e 72 69 64 20 20 20 20 20 oot = R.rid
c530: 20 20 2d 2d 20 47 65 74 20 62 72 61 6e 63 68 20 -- Get branch
c540: 72 6f 6f 74 20 72 65 76 69 73 69 6f 6e 73 0a 09 root revisions..
c550: 20 20 20 20 41 4e 44 20 20 20 20 43 49 2e 69 69 AND CI.ii
c560: 64 20 3d 20 52 2e 72 69 64 20 20 20 20 20 20 20 d = R.rid
c570: 2d 2d 20 47 65 74 20 63 68 61 6e 67 65 73 65 74 -- Get changeset
c580: 73 20 63 6f 6e 74 61 69 6e 69 6e 67 20 74 68 65 s containing the
c590: 0a 09 20 20 20 20 41 4e 44 20 20 20 20 43 2e 63 .. AND C.c
c5a0: 69 64 20 3d 20 43 49 2e 63 69 64 20 20 20 20 20 id = CI.cid
c5b0: 20 20 2d 2d 20 72 6f 6f 74 20 72 65 76 69 73 69 -- root revisi
c5c0: 6f 6e 73 2c 20 77 68 69 63 68 20 61 72 65 0a 09 ons, which are..
c5d0: 20 20 20 20 41 4e 44 20 20 20 20 43 2e 74 79 70 AND C.typ
c5e0: 65 20 3d 20 30 20 20 20 20 20 20 20 20 20 20 20 e = 0
c5f0: 2d 2d 20 72 65 76 69 73 69 6f 6e 20 63 68 61 6e -- revision chan
c600: 67 65 73 65 74 73 0a 09 20 20 20 20 41 4e 44 20 gesets.. AND
c610: 20 20 20 43 4f 2e 63 69 64 20 3d 20 43 2e 63 69 CO.cid = C.ci
c620: 64 20 20 20 20 20 20 20 2d 2d 20 47 65 74 20 74 d -- Get t
c630: 68 65 69 72 20 74 6f 70 6f 6c 6f 67 69 63 61 6c heir topological
c640: 20 6f 72 64 65 72 69 6e 67 0a 09 20 20 20 20 47 ordering.. G
c650: 52 4f 55 50 20 42 59 20 42 2e 62 69 64 0a 09 7d ROUP BY B.bid..}
c660: 5d 5d 0a 0a 09 73 65 74 20 6d 69 6e 73 20 5b 73 ]]...set mins [s
c670: 74 61 74 65 20 72 75 6e 20 5b 73 75 62 73 74 20 tate run [subst
c680: 2d 6e 6f 63 6f 6d 6d 61 6e 64 73 20 2d 6e 6f 62 -nocommands -nob
c690: 61 63 6b 73 6c 61 73 68 65 73 20 7b 0a 09 20 20 ackslashes {..
c6a0: 20 20 2d 2d 20 6d 69 6e 69 6d 61 6c 20 73 75 63 -- minimal suc
c6b0: 63 65 73 73 6f 72 20 70 6f 73 69 74 69 6f 6e 20 cessor position
c6c0: 70 65 72 20 62 72 61 6e 63 68 0a 09 20 20 20 20 per branch..
c6d0: 53 45 4c 45 43 54 20 42 2e 62 69 64 2c 20 4d 49 SELECT B.bid, MI
c6e0: 4e 20 28 43 4f 2e 70 6f 73 29 0a 09 20 20 20 20 N (CO.pos)..
c6f0: 46 52 4f 4d 20 20 20 62 72 61 6e 63 68 20 42 2c FROM branch B,
c700: 20 72 65 76 69 73 69 6f 6e 20 52 2c 20 63 73 69 revision R, csi
c710: 74 65 6d 20 43 49 2c 20 63 68 61 6e 67 65 73 65 tem CI, changese
c720: 74 20 43 2c 20 63 73 6f 72 64 65 72 20 43 4f 0a t C, csorder CO.
c730: 09 20 20 20 20 57 48 45 52 45 20 20 42 2e 62 69 . WHERE B.bi
c740: 64 20 49 4e 20 24 74 68 65 73 65 74 20 20 20 20 d IN $theset
c750: 20 2d 2d 20 52 65 73 74 72 69 63 74 20 74 6f 20 -- Restrict to
c760: 62 72 61 6e 63 68 65 73 20 6f 66 20 69 6e 74 65 branches of inte
c770: 72 65 73 74 0a 09 20 20 20 20 41 4e 44 20 20 20 rest.. AND
c780: 20 42 2e 66 69 72 73 74 20 3d 20 52 2e 72 69 64 B.first = R.rid
c790: 20 20 20 20 20 20 2d 2d 20 47 65 74 20 74 68 65 -- Get the
c7a0: 20 66 69 72 73 74 20 72 65 76 69 73 69 6f 6e 73 first revisions
c7b0: 20 6f 6e 20 74 68 65 20 62 72 61 6e 63 68 65 73 on the branches
c7c0: 0a 09 20 20 20 20 41 4e 44 20 20 20 20 43 49 2e .. AND CI.
c7d0: 69 69 64 20 3d 20 52 2e 72 69 64 20 20 20 20 20 iid = R.rid
c7e0: 20 20 2d 2d 20 47 65 74 20 63 68 61 6e 67 65 73 -- Get changes
c7f0: 65 74 73 20 63 6f 6e 74 61 69 6e 69 6e 67 20 74 ets containing t
c800: 68 65 0a 09 20 20 20 20 41 4e 44 20 20 20 20 43 he.. AND C
c810: 2e 63 69 64 20 3d 20 43 49 2e 63 69 64 09 2d 2d .cid = CI.cid.--
c820: 20 66 69 72 73 74 20 72 65 76 69 73 69 6f 6e 73 first revisions
c830: 2c 20 77 68 69 63 68 20 61 72 65 0a 09 20 20 20 , which are..
c840: 20 41 4e 44 20 20 20 20 43 2e 74 79 70 65 20 3d AND C.type =
c850: 20 30 09 09 2d 2d 20 72 65 76 69 73 69 6f 6e 20 0..-- revision
c860: 63 68 61 6e 67 65 73 65 74 73 0a 09 20 20 20 20 changesets..
c870: 41 4e 44 20 20 20 20 43 4f 2e 63 69 64 20 3d 20 AND CO.cid =
c880: 43 2e 63 69 64 09 2d 2d 20 47 65 74 20 74 68 65 C.cid.-- Get the
c890: 69 72 20 74 6f 70 6f 6c 6f 67 69 63 61 6c 20 6f ir topological o
c8a0: 72 64 65 72 69 6e 67 0a 09 20 20 20 20 47 52 4f rdering.. GRO
c8b0: 55 50 20 42 59 20 42 2e 62 69 64 0a 09 7d 5d 5d UP BY B.bid..}]]
c8c0: 0a 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e .. return
c8d0: 20 5b 6c 69 73 74 20 24 6d 61 78 70 20 24 6d 69 [list $maxp $mi
c8e0: 6e 73 5d 0a 20 20 20 20 7d 0a 0a 20 20 20 20 23 ns]. }.. #
c8f0: 20 23 20 23 23 20 23 23 23 20 23 23 23 23 23 20 # ## ### #####
c900: 23 23 23 23 23 23 23 23 20 23 23 23 23 23 23 23 ######## #######
c910: 23 23 23 23 23 23 0a 20 20 20 20 23 23 20 43 6f ######. ## Co
c920: 6e 66 69 67 75 72 61 74 69 6f 6e 0a 0a 20 20 20 nfiguration..
c930: 20 70 72 61 67 6d 61 20 2d 68 61 73 69 6e 73 74 pragma -hasinst
c940: 61 6e 63 65 73 20 20 20 6e 6f 20 3b 20 23 20 73 ances no ; # s
c950: 69 6e 67 6c 65 74 6f 6e 0a 20 20 20 20 70 72 61 ingleton. pra
c960: 67 6d 61 20 2d 68 61 73 74 79 70 65 69 6e 66 6f gma -hastypeinfo
c970: 20 20 20 20 6e 6f 20 3b 20 23 20 6e 6f 20 69 6e no ; # no in
c980: 74 72 6f 73 70 65 63 74 69 6f 6e 0a 20 20 20 20 trospection.
c990: 70 72 61 67 6d 61 20 2d 68 61 73 74 79 70 65 64 pragma -hastyped
c9a0: 65 73 74 72 6f 79 20 6e 6f 20 3b 20 23 20 69 6d estroy no ; # im
c9b0: 6d 6f 72 74 61 6c 0a 7d 0a 0a 23 20 23 20 23 23 mortal.}..# # ##
c9c0: 20 23 23 23 20 23 23 23 23 23 20 23 23 23 23 23 ### ##### #####
c9d0: 23 23 23 20 23 23 23 23 23 23 23 23 23 23 23 23 ### ############
c9e0: 23 20 23 23 23 23 23 23 23 23 23 23 23 23 23 23 # ##############
c9f0: 23 23 23 23 23 23 23 0a 23 23 0a 0a 6e 61 6d 65 #######.##..name
ca00: 73 70 61 63 65 20 65 76 61 6c 20 3a 3a 76 63 3a space eval ::vc:
ca10: 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a :fossil::import:
ca20: 3a 63 76 73 3a 3a 70 72 6f 6a 65 63 74 20 7b 0a :cvs::project {.
ca30: 20 20 20 20 6e 61 6d 65 73 70 61 63 65 20 65 78 namespace ex
ca40: 70 6f 72 74 20 72 65 76 0a 20 20 20 20 6e 61 6d port rev. nam
ca50: 65 73 70 61 63 65 20 65 76 61 6c 20 72 65 76 20 espace eval rev
ca60: 7b 0a 09 6e 61 6d 65 73 70 61 63 65 20 69 6d 70 {..namespace imp
ca70: 6f 72 74 20 3a 3a 76 63 3a 3a 66 6f 73 73 69 6c ort ::vc::fossil
ca80: 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 73 ::import::cvs::s
ca90: 74 61 74 65 0a 09 6e 61 6d 65 73 70 61 63 65 20 tate..namespace
caa0: 69 6d 70 6f 72 74 20 3a 3a 76 63 3a 3a 66 6f 73 import ::vc::fos
cab0: 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 sil::import::cvs
cac0: 3a 3a 69 6e 74 65 67 72 69 74 79 0a 09 6e 61 6d ::integrity..nam
cad0: 65 73 70 61 63 65 20 69 6d 70 6f 72 74 20 3a 3a espace import ::
cae0: 76 63 3a 3a 74 6f 6f 6c 73 3a 3a 6d 69 73 63 3a vc::tools::misc:
caf0: 3a 2a 0a 09 6e 61 6d 65 73 70 61 63 65 20 69 6d :*..namespace im
cb00: 70 6f 72 74 20 3a 3a 76 63 3a 3a 74 6f 6f 6c 73 port ::vc::tools
cb10: 3a 3a 74 72 6f 75 62 6c 65 0a 09 6e 61 6d 65 73 ::trouble..names
cb20: 70 61 63 65 20 69 6d 70 6f 72 74 20 3a 3a 76 63 pace import ::vc
cb30: 3a 3a 74 6f 6f 6c 73 3a 3a 6c 6f 67 0a 09 6c 6f ::tools::log..lo
cb40: 67 20 72 65 67 69 73 74 65 72 20 63 73 65 74 73 g register csets
cb50: 0a 0a 09 23 20 53 65 74 20 75 70 20 74 68 65 20 ...# Set up the
cb60: 68 65 6c 70 65 72 20 73 69 6e 67 6c 65 74 6f 6e helper singleton
cb70: 73 0a 09 6e 61 6d 65 73 70 61 63 65 20 65 76 61 s..namespace eva
cb80: 6c 20 72 65 76 20 7b 0a 09 20 20 20 20 6e 61 6d l rev {.. nam
cb90: 65 73 70 61 63 65 20 69 6d 70 6f 72 74 20 3a 3a espace import ::
cba0: 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f vc::fossil::impo
cbb0: 72 74 3a 3a 63 76 73 3a 3a 73 74 61 74 65 0a 09 rt::cvs::state..
cbc0: 20 20 20 20 6e 61 6d 65 73 70 61 63 65 20 69 6d namespace im
cbd0: 70 6f 72 74 20 3a 3a 76 63 3a 3a 66 6f 73 73 69 port ::vc::fossi
cbe0: 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a l::import::cvs::
cbf0: 69 6e 74 65 67 72 69 74 79 0a 09 7d 0a 09 6e 61 integrity..}..na
cc00: 6d 65 73 70 61 63 65 20 65 76 61 6c 20 73 79 6d mespace eval sym
cc10: 3a 3a 74 61 67 20 7b 0a 09 20 20 20 20 6e 61 6d ::tag {.. nam
cc20: 65 73 70 61 63 65 20 69 6d 70 6f 72 74 20 3a 3a espace import ::
cc30: 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f vc::fossil::impo
cc40: 72 74 3a 3a 63 76 73 3a 3a 73 74 61 74 65 0a 09 rt::cvs::state..
cc50: 20 20 20 20 6e 61 6d 65 73 70 61 63 65 20 69 6d namespace im
cc60: 70 6f 72 74 20 3a 3a 76 63 3a 3a 66 6f 73 73 69 port ::vc::fossi
cc70: 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a l::import::cvs::
cc80: 69 6e 74 65 67 72 69 74 79 0a 09 7d 0a 09 6e 61 integrity..}..na
cc90: 6d 65 73 70 61 63 65 20 65 76 61 6c 20 73 79 6d mespace eval sym
cca0: 3a 3a 62 72 61 6e 63 68 20 7b 0a 09 20 20 20 20 ::branch {..
ccb0: 6e 61 6d 65 73 70 61 63 65 20 69 6d 70 6f 72 74 namespace import
ccc0: 20 3a 3a 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 ::vc::fossil::i
ccd0: 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 73 74 61 74 mport::cvs::stat
cce0: 65 0a 09 20 20 20 20 6e 61 6d 65 73 70 61 63 65 e.. namespace
ccf0: 20 69 6d 70 6f 72 74 20 3a 3a 76 63 3a 3a 66 6f import ::vc::fo
cd00: 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 ssil::import::cv
cd10: 73 3a 3a 69 6e 74 65 67 72 69 74 79 0a 09 7d 0a s::integrity..}.
cd20: 20 20 20 20 7d 0a 7d 0a 0a 23 20 23 20 23 23 20 }.}..# # ##
cd30: 23 23 23 20 23 23 23 23 23 20 23 23 23 23 23 23 ### ##### ######
cd40: 23 23 20 23 23 23 23 23 23 23 23 23 23 23 23 23 ## #############
cd50: 20 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ###############
cd60: 23 23 23 23 23 23 0a 23 23 20 52 65 61 64 79 0a ######.## Ready.
cd70: 0a 70 61 63 6b 61 67 65 20 70 72 6f 76 69 64 65 .package provide
cd80: 20 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 vc::fossil::imp
cd90: 6f 72 74 3a 3a 63 76 73 3a 3a 70 72 6f 6a 65 63 ort::cvs::projec
cda0: 74 3a 3a 72 65 76 20 31 2e 30 0a 72 65 74 75 72 t::rev 1.0.retur
cdb0: 6e 0a n.