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 76 63 3a 3a 74 6f 6f 6c 73 equire vc::tools
0380: 3a 3a 6d 69 73 63 20 20 20 20 20 20 20 20 20 20 ::misc
0390: 20 20 20 20 20 20 20 20 20 20 20 20 20 3b 20 23 ; #
03a0: 20 54 65 78 74 20 66 6f 72 6d 61 74 74 69 6e 67 Text formatting
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 74 72 6f 75 vc::tools::trou
03d0: 62 6c 65 20 20 20 20 20 20 20 20 20 20 20 20 20 ble
03e0: 20 20 20 20 20 20 20 3b 20 23 20 45 72 72 6f 72 ; # Error
03f0: 20 72 65 70 6f 72 74 69 6e 67 2e 0a 70 61 63 6b reporting..pack
0400: 61 67 65 20 72 65 71 75 69 72 65 20 76 63 3a 3a age require vc::
0410: 74 6f 6f 6c 73 3a 3a 6c 6f 67 20 20 20 20 20 20 tools::log
0420: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0430: 20 20 3b 20 23 20 55 73 65 72 20 66 65 65 64 62 ; # User feedb
0440: 61 63 6b 2e 0a 70 61 63 6b 61 67 65 20 72 65 71 ack..package req
0450: 75 69 72 65 20 76 63 3a 3a 66 6f 73 73 69 6c 3a uire vc::fossil:
0460: 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 73 74 :import::cvs::st
0470: 61 74 65 20 20 20 20 20 20 20 20 3b 20 23 20 53 ate ; # S
0480: 74 61 74 65 20 73 74 6f 72 61 67 65 2e 0a 0a 23 tate storage...#
0490: 20 23 20 23 23 20 23 23 23 20 23 23 23 23 23 20 # ## ### #####
04a0: 23 23 23 23 23 23 23 23 20 23 23 23 23 23 23 23 ######## #######
04b0: 23 23 23 23 23 23 20 23 23 23 23 23 23 23 23 23 ###### #########
04c0: 23 23 23 23 23 23 23 23 23 23 23 23 0a 23 23 20 ############.##
04d0: 0a 0a 73 6e 69 74 3a 3a 74 79 70 65 20 3a 3a 76 ..snit::type ::v
04e0: 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 c::fossil::impor
04f0: 74 3a 3a 63 76 73 3a 3a 70 72 6f 6a 65 63 74 3a t::cvs::project:
0500: 3a 72 65 76 20 7b 0a 20 20 20 20 23 20 23 20 23 :rev {. # # #
0510: 23 20 23 23 23 20 23 23 23 23 23 20 23 23 23 23 # ### ##### ####
0520: 23 23 23 23 20 23 23 23 23 23 23 23 23 23 23 23 #### ###########
0530: 23 23 0a 20 20 20 20 23 23 20 50 75 62 6c 69 63 ##. ## Public
0540: 20 41 50 49 0a 0a 20 20 20 20 63 6f 6e 73 74 72 API.. constr
0550: 75 63 74 6f 72 20 7b 70 72 6f 6a 65 63 74 20 63 uctor {project c
0560: 73 74 79 70 65 20 73 72 63 69 64 20 72 65 76 69 stype srcid revi
0570: 73 69 6f 6e 73 7d 20 7b 0a 09 73 65 74 20 6d 79 sions} {..set my
0580: 69 64 20 20 20 20 20 20 20 20 5b 69 6e 63 72 20 id [incr
0590: 6d 79 63 6f 75 6e 74 65 72 5d 0a 09 73 65 74 20 mycounter]..set
05a0: 6d 79 70 72 6f 6a 65 63 74 20 20 20 24 70 72 6f myproject $pro
05b0: 6a 65 63 74 0a 09 73 65 74 20 6d 79 74 79 70 65 ject..set mytype
05c0: 20 20 20 20 20 20 24 63 73 74 79 70 65 09 20 20 $cstype.
05d0: 0a 09 73 65 74 20 6d 79 73 72 63 69 64 09 24 73 ..set mysrcid.$s
05e0: 72 63 69 64 09 20 20 0a 09 73 65 74 20 6d 79 72 rcid. ..set myr
05f0: 65 76 69 73 69 6f 6e 73 20 24 72 65 76 69 73 69 evisions $revisi
0600: 6f 6e 73 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 ons..return.
0610: 7d 0a 0a 20 20 20 20 6d 65 74 68 6f 64 20 69 64 }.. method id
0620: 20 7b 7d 20 7b 20 72 65 74 75 72 6e 20 24 6d 79 {} { return $my
0630: 69 64 20 7d 0a 0a 20 20 20 20 6d 65 74 68 6f 64 id }.. method
0640: 20 62 72 65 61 6b 69 6e 74 65 72 6e 61 6c 64 65 breakinternalde
0650: 70 65 6e 64 65 6e 63 69 65 73 20 7b 63 76 7d 20 pendencies {cv}
0660: 7b 0a 09 75 70 76 61 72 20 32 20 24 63 76 20 63 {..upvar 2 $cv c
0670: 73 65 74 73 20 3b 20 23 20 73 69 6d 70 6c 65 2d sets ; # simple-
0680: 64 69 73 70 61 74 63 68 21 0a 0a 09 23 20 54 68 dispatch!...# Th
0690: 69 73 20 6d 65 74 68 6f 64 20 69 6e 73 70 65 63 is method inspec
06a0: 74 73 20 74 68 65 20 63 68 61 6e 67 65 73 65 74 ts the changeset
06b0: 73 20 66 6f 72 20 69 6e 74 65 72 6e 61 6c 0a 09 s for internal..
06c0: 23 20 64 65 70 65 6e 64 65 6e 63 69 65 73 2e 20 # dependencies.
06d0: 4e 6f 74 68 69 6e 67 20 69 73 20 64 6f 6e 65 20 Nothing is done
06e0: 69 66 20 74 68 65 72 65 20 61 72 65 20 6e 6f 0a if there are no.
06f0: 09 23 20 73 75 63 68 2e 20 4f 74 68 65 72 77 69 .# such. Otherwi
0700: 73 65 20 74 68 65 20 63 68 61 6e 67 65 73 65 74 se the changeset
0710: 20 69 73 20 73 70 6c 69 74 20 69 6e 74 6f 20 61 is split into a
0720: 20 73 65 74 20 6f 66 0a 09 23 20 66 72 61 67 6d set of..# fragm
0730: 65 6e 74 73 20 77 69 74 68 6f 75 74 20 69 6e 74 ents without int
0740: 65 72 6e 61 6c 20 64 65 70 65 6e 64 65 6e 63 69 ernal dependenci
0750: 65 73 2c 20 74 72 61 6e 73 66 6f 72 6d 69 6e 67 es, transforming
0760: 20 74 68 65 0a 09 23 20 69 6e 74 65 72 6e 61 6c the..# internal
0770: 20 64 65 70 65 6e 64 65 6e 63 69 65 73 20 69 6e dependencies in
0780: 74 6f 20 65 78 74 65 72 6e 61 6c 20 6f 6e 65 73 to external ones
0790: 2e 20 54 68 65 20 6e 65 77 20 63 68 61 6e 67 65 . The new change
07a0: 73 65 74 73 0a 09 23 20 61 72 65 20 61 64 64 65 sets..# are adde
07b0: 64 20 74 6f 20 74 68 65 20 6c 69 73 74 20 6f 66 d to the list of
07c0: 20 61 6c 6c 20 63 68 61 6e 67 65 73 65 74 73 2e all changesets.
07d0: 0a 0a 09 23 20 57 65 20 70 65 72 66 6f 72 6d 20 ...# We perform
07e0: 61 6c 6c 20 6e 65 63 65 73 73 61 72 79 20 73 70 all necessary sp
07f0: 6c 69 74 73 20 69 6e 20 6f 6e 65 20 67 6f 2c 20 lits in one go,
0800: 69 6e 73 74 65 61 64 20 6f 66 20 6f 6e 6c 79 0a instead of only.
0810: 09 23 20 6f 6e 65 2e 20 54 68 65 20 70 72 65 76 .# one. The prev
0820: 69 6f 75 73 20 61 6c 67 6f 72 69 74 68 6d 2c 20 ious algorithm,
0830: 61 64 61 70 74 65 64 20 66 72 6f 6d 20 63 76 73 adapted from cvs
0840: 32 73 76 6e 2c 20 63 6f 6d 70 75 74 65 64 0a 09 2svn, computed..
0850: 23 20 61 20 6c 6f 74 20 6f 66 20 73 74 61 74 65 # a lot of state
0860: 20 77 68 69 63 68 20 77 61 73 20 74 68 72 6f 77 which was throw
0870: 6e 20 61 77 61 79 20 61 6e 64 20 74 68 65 6e 20 n away and then
0880: 63 6f 6d 70 75 74 65 64 20 61 67 61 69 6e 0a 09 computed again..
0890: 23 20 66 6f 72 20 65 61 63 68 20 6f 66 20 74 68 # for each of th
08a0: 65 20 66 72 61 67 6d 65 6e 74 73 2e 20 49 74 20 e fragments. It
08b0: 73 68 6f 75 6c 64 20 62 65 20 65 61 73 69 65 72 should be easier
08c0: 20 74 6f 20 75 70 64 61 74 65 20 61 6e 64 0a 09 to update and..
08d0: 23 20 72 65 75 73 65 20 74 68 61 74 20 73 74 61 # reuse that sta
08e0: 74 65 2e 0a 0a 09 23 20 54 68 65 20 63 6f 64 65 te....# The code
08f0: 20 63 68 65 63 6b 73 20 6f 6e 6c 79 20 73 75 63 checks only suc
0900: 65 73 73 6f 72 20 64 65 70 65 6e 64 65 6e 63 69 essor dependenci
0910: 65 73 2c 20 61 73 20 74 68 69 73 0a 09 23 20 61 es, as this..# a
0920: 75 74 6f 6d 61 74 69 63 61 6c 6c 79 20 63 6f 76 utomatically cov
0930: 65 72 73 20 74 68 65 20 70 72 65 64 65 63 65 73 ers the predeces
0940: 73 6f 72 20 64 65 70 65 6e 64 65 6e 63 69 65 73 sor dependencies
0950: 20 61 73 20 77 65 6c 6c 20 28 41 0a 09 23 20 73 as well (A..# s
0960: 75 63 63 65 73 73 6f 72 20 64 65 70 65 6e 64 65 uccessor depende
0970: 6e 63 79 20 61 20 2d 3e 20 62 20 69 73 20 61 6c ncy a -> b is al
0980: 73 6f 20 61 20 70 72 65 64 65 63 65 73 73 6f 72 so a predecessor
0990: 20 64 65 70 65 6e 64 65 6e 63 79 0a 09 23 20 62 dependency..# b
09a0: 20 2d 3e 20 61 29 2e 0a 0a 09 23 20 41 72 72 61 -> a)....# Arra
09b0: 79 20 6f 66 20 64 65 70 65 6e 64 65 6e 63 69 65 y of dependencie
09c0: 73 20 28 70 61 72 65 6e 74 20 2d 3e 20 63 68 69 s (parent -> chi
09d0: 6c 64 29 2e 20 54 68 69 73 20 69 73 20 70 75 6c ld). This is pul
09e0: 6c 65 64 20 66 72 6f 6d 0a 09 23 20 74 68 65 20 led from..# the
09f0: 73 74 61 74 65 2c 20 61 6e 64 20 6c 69 6d 69 74 state, and limit
0a00: 65 64 20 74 6f 20 73 75 63 63 65 73 73 6f 72 73 ed to successors
0a10: 20 77 69 74 68 69 6e 20 74 68 65 20 63 68 61 6e within the chan
0a20: 67 65 73 65 74 2e 0a 0a 09 61 72 72 61 79 20 73 geset....array s
0a30: 65 74 20 64 65 70 65 6e 64 65 6e 63 69 65 73 20 et dependencies
0a40: 7b 7d 0a 09 50 75 6c 6c 49 6e 74 65 72 6e 61 6c {}..PullInternal
0a50: 44 65 70 65 6e 64 65 6e 63 69 65 73 20 64 65 70 Dependencies dep
0a60: 65 6e 64 65 6e 63 69 65 73 20 24 6d 79 72 65 76 endencies $myrev
0a70: 69 73 69 6f 6e 73 0a 09 69 66 20 7b 21 5b 61 72 isions..if {![ar
0a80: 72 61 79 20 73 69 7a 65 20 64 65 70 65 6e 64 65 ray size depende
0a90: 6e 63 69 65 73 5d 7d 20 7b 72 65 74 75 72 6e 20 ncies]} {return
0aa0: 30 7d 20 3b 20 23 20 4e 6f 74 68 69 6e 67 20 74 0} ; # Nothing t
0ab0: 6f 20 62 72 65 61 6b 2e 0a 0a 09 6c 6f 67 20 77 o break....log w
0ac0: 72 69 74 65 20 36 20 63 73 65 74 73 20 2e 2e 2e rite 6 csets ...
0ad0: 3c 24 6d 79 69 64 3e 2e 2e 2e 2e 2e 2e 2e 2e 2e <$myid>.........
0ae0: 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e ................
0af0: 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e ................
0b00: 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a ................
0b10: 09 23 20 57 65 20 68 61 76 65 20 69 6e 74 65 72 .# We have inter
0b20: 6e 61 6c 20 64 65 70 65 6e 64 65 6e 63 69 65 73 nal dependencies
0b30: 20 74 6f 20 62 72 65 61 6b 2e 20 57 65 20 6e 6f to break. We no
0b40: 77 20 69 74 65 72 61 74 65 20 6f 76 65 72 0a 09 w iterate over..
0b50: 23 20 61 6c 6c 20 70 6f 73 69 74 69 6f 6e 73 20 # all positions
0b60: 69 6e 20 74 68 65 20 6c 69 73 74 20 28 77 68 69 in the list (whi
0b70: 63 68 20 69 73 20 63 68 72 6f 6e 6f 6c 6f 67 69 ch is chronologi
0b80: 63 61 6c 2c 20 61 74 20 6c 65 61 73 74 0a 09 23 cal, at least..#
0b90: 20 61 73 20 66 61 72 20 61 73 20 74 68 65 20 74 as far as the t
0ba0: 69 6d 65 73 74 61 6d 70 73 20 61 72 65 20 63 6f imestamps are co
0bb0: 72 72 65 63 74 20 61 6e 64 20 75 6e 69 71 75 65 rrect and unique
0bc0: 29 20 61 6e 64 0a 09 23 20 64 65 74 65 72 6d 69 ) and..# determi
0bd0: 6e 65 20 74 68 65 20 62 65 73 74 20 70 6f 73 69 ne the best posi
0be0: 74 69 6f 6e 20 66 6f 72 20 74 68 65 20 62 72 65 tion for the bre
0bf0: 61 6b 2c 20 62 79 20 74 72 79 69 6e 67 20 74 6f ak, by trying to
0c00: 0a 09 23 20 62 72 65 61 6b 20 61 73 20 6d 61 6e ..# break as man
0c10: 79 20 64 65 70 65 6e 64 65 6e 63 69 65 73 20 61 y dependencies a
0c20: 73 20 70 6f 73 73 69 62 6c 65 20 69 6e 20 6f 6e s possible in on
0c30: 65 20 67 6f 2e 20 57 68 65 6e 20 61 0a 09 23 20 e go. When a..#
0c40: 62 72 65 61 6b 20 77 61 73 20 66 6f 75 6e 64 20 break was found
0c50: 74 68 69 73 20 69 73 20 72 65 64 6f 6e 65 20 66 this is redone f
0c60: 6f 72 20 74 68 65 20 66 72 61 67 6d 65 6e 74 73 or the fragments
0c70: 20 63 6f 6d 69 6e 67 20 61 6e 64 0a 09 23 20 61 coming and..# a
0c80: 66 74 65 72 2c 20 61 66 74 65 72 20 75 70 64 69 fter, after updi
0c90: 6e 67 20 74 68 65 20 63 72 6f 73 73 69 6e 67 20 ng the crossing
0ca0: 69 6e 66 6f 72 6d 61 74 69 6f 6e 2e 0a 0a 09 23 information....#
0cb0: 20 44 61 74 61 20 73 74 72 75 63 74 75 72 65 73 Data structures
0cc0: 3a 0a 09 23 20 4d 61 70 3a 20 20 50 4f 53 20 20 :..# Map: POS
0cd0: 20 72 65 76 69 73 69 6f 6e 20 69 64 20 20 20 20 revision id
0ce0: 20 20 2d 3e 20 70 6f 73 69 74 69 6f 6e 20 69 6e -> position in
0cf0: 20 6c 69 73 74 2e 0a 09 23 20 20 20 20 20 20 20 list...#
0d00: 43 52 4f 53 53 20 70 6f 73 69 74 69 6f 6e 20 69 CROSS position i
0d10: 6e 20 6c 69 73 74 20 2d 3e 20 6e 75 6d 62 65 72 n list -> number
0d20: 20 6f 66 20 64 65 70 65 6e 64 65 6e 63 69 65 73 of dependencies
0d30: 20 63 72 6f 73 73 69 6e 67 20 69 74 0a 09 23 20 crossing it..#
0d40: 20 20 20 20 20 20 44 45 50 43 20 20 64 65 70 65 DEPC depe
0d50: 6e 64 65 6e 63 79 20 20 20 20 20 20 20 2d 3e 20 ndency ->
0d60: 70 6f 73 69 74 69 6f 6e 73 20 69 74 20 63 72 6f positions it cro
0d70: 73 73 65 73 0a 09 23 20 4c 69 73 74 3a 20 52 41 sses..# List: RA
0d80: 4e 47 45 20 4f 66 20 74 68 65 20 70 6f 73 69 74 NGE Of the posit
0d90: 69 6f 6e 73 20 69 74 73 65 6c 66 2e 0a 09 23 20 ions itself...#
0da0: 41 20 64 65 70 65 6e 64 65 6e 63 79 20 69 73 20 A dependency is
0db0: 61 20 73 69 6e 67 6c 65 2d 65 6c 65 6d 65 6e 74 a single-element
0dc0: 20 6d 61 70 20 70 61 72 65 6e 74 20 2d 3e 20 63 map parent -> c
0dd0: 68 69 6c 64 0a 0a 09 49 6e 69 74 69 61 6c 69 7a hild...Initializ
0de0: 65 42 72 65 61 6b 53 74 61 74 65 20 24 6d 79 72 eBreakState $myr
0df0: 65 76 69 73 69 6f 6e 73 0a 0a 09 73 65 74 20 66 evisions...set f
0e00: 72 61 67 6d 65 6e 74 73 20 7b 7d 0a 09 73 65 74 ragments {}..set
0e10: 20 70 65 6e 64 69 6e 67 20 20 20 5b 6c 69 73 74 pending [list
0e20: 20 24 72 61 6e 67 65 5d 0a 09 73 65 74 20 61 74 $range]..set at
0e30: 20 20 20 20 20 20 20 20 30 0a 09 61 72 72 61 79 0..array
0e40: 20 73 65 74 20 62 72 65 61 6b 73 20 7b 7d 0a 0a set breaks {}..
0e50: 09 77 68 69 6c 65 20 7b 24 61 74 20 3c 20 5b 6c .while {$at < [l
0e60: 6c 65 6e 67 74 68 20 24 70 65 6e 64 69 6e 67 5d length $pending]
0e70: 7d 20 7b 0a 09 20 20 20 20 73 65 74 20 63 75 72 } {.. set cur
0e80: 72 65 6e 74 20 5b 6c 69 6e 64 65 78 20 24 70 65 rent [lindex $pe
0e90: 6e 64 69 6e 67 20 24 61 74 5d 0a 0a 09 20 20 20 nding $at]...
0ea0: 20 6c 6f 67 20 77 72 69 74 65 20 36 20 63 73 65 log write 6 cse
0eb0: 74 73 20 22 2e 20 2e 20 2e 2e 20 2e 2e 2e 20 2e ts ". . .. ... .
0ec0: 2e 2e 2e 2e 20 2e 2e 2e 2e 2e 2e 2e 2e 20 2e 2e .... ........ ..
0ed0: 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 22 0a 09 20 20 ..........."..
0ee0: 20 20 6c 6f 67 20 77 72 69 74 65 20 36 20 63 73 log write 6 cs
0ef0: 65 74 73 20 22 53 63 68 65 64 75 6c 65 64 20 20 ets "Scheduled
0f00: 20 5b 6a 6f 69 6e 20 5b 50 52 73 20 5b 6c 72 61 [join [PRs [lra
0f10: 6e 67 65 20 24 70 65 6e 64 69 6e 67 20 24 61 74 nge $pending $at
0f20: 20 65 6e 64 5d 5d 20 7b 20 7d 5d 22 0a 09 20 20 end]] { }]"..
0f30: 20 20 6c 6f 67 20 77 72 69 74 65 20 36 20 63 73 log write 6 cs
0f40: 65 74 73 20 22 43 6f 6e 73 69 64 65 72 69 6e 67 ets "Considering
0f50: 20 5b 50 52 20 24 63 75 72 72 65 6e 74 5d 20 5c [PR $current] \
0f60: 5b 24 61 74 2f 5b 6c 6c 65 6e 67 74 68 20 24 70 [$at/[llength $p
0f70: 65 6e 64 69 6e 67 5d 5c 5d 22 0a 0a 09 20 20 20 ending]\]"...
0f80: 20 73 65 74 20 62 65 73 74 20 5b 46 69 6e 64 42 set best [FindB
0f90: 65 73 74 42 72 65 61 6b 20 24 63 75 72 72 65 6e estBreak $curren
0fa0: 74 5d 0a 0a 09 20 20 20 20 69 66 20 7b 24 62 65 t]... if {$be
0fb0: 73 74 20 3c 20 30 7d 20 7b 0a 09 09 23 20 54 68 st < 0} {...# Th
0fc0: 65 20 69 6e 73 70 65 63 74 65 64 20 72 61 6e 67 e inspected rang
0fd0: 65 20 68 61 73 20 6e 6f 20 69 6e 74 65 72 6e 61 e has no interna
0fe0: 6c 0a 09 09 23 20 64 65 70 65 6e 64 65 6e 63 69 l...# dependenci
0ff0: 65 73 2e 20 54 68 69 73 20 69 73 20 61 20 63 6f es. This is a co
1000: 6d 70 6c 65 74 65 20 66 72 61 67 6d 65 6e 74 2e mplete fragment.
1010: 0a 09 09 6c 61 70 70 65 6e 64 20 66 72 61 67 6d ...lappend fragm
1020: 65 6e 74 73 20 24 63 75 72 72 65 6e 74 0a 0a 09 ents $current...
1030: 09 6c 6f 67 20 77 72 69 74 65 20 36 20 63 73 65 .log write 6 cse
1040: 74 73 20 22 4e 6f 20 62 72 65 61 6b 73 2c 20 66 ts "No breaks, f
1050: 69 6e 61 6c 22 0a 09 20 20 20 20 7d 20 65 6c 73 inal".. } els
1060: 65 20 7b 0a 09 09 23 20 53 70 6c 69 74 20 74 68 e {...# Split th
1070: 65 20 72 61 6e 67 65 20 61 6e 64 20 73 63 68 65 e range and sche
1080: 64 75 6c 65 20 74 68 65 20 72 65 73 75 6c 74 69 dule the resulti
1090: 6e 67 20 66 72 61 67 6d 65 6e 74 73 0a 09 09 23 ng fragments...#
10a0: 20 66 6f 72 20 66 75 72 74 68 65 72 20 69 6e 73 for further ins
10b0: 70 65 63 74 69 6f 6e 2e 20 52 65 6d 65 6d 62 65 pection. Remembe
10c0: 72 20 74 68 65 20 6e 75 6d 62 65 72 20 6f 66 0a r the number of.
10d0: 09 09 23 20 64 65 70 65 6e 64 65 6e 63 69 65 73 ..# dependencies
10e0: 20 63 75 74 20 62 65 66 6f 72 65 20 77 65 20 72 cut before we r
10f0: 65 6d 6f 76 65 20 74 68 65 6d 20 66 72 6f 6d 0a emove them from.
1100: 09 09 23 20 63 6f 6e 73 69 64 65 72 61 74 69 6f ..# consideratio
1110: 6e 2c 20 66 6f 72 20 64 6f 63 75 6d 65 6e 74 61 n, for documenta
1120: 74 69 6f 6e 20 6c 61 74 65 72 2e 0a 0a 09 09 73 tion later.....s
1130: 65 74 20 62 72 65 61 6b 73 28 24 62 65 73 74 29 et breaks($best)
1140: 20 24 63 72 6f 73 73 28 24 62 65 73 74 29 0a 0a $cross($best)..
1150: 09 09 6c 6f 67 20 77 72 69 74 65 20 36 20 63 73 ..log write 6 cs
1160: 65 74 73 20 22 42 65 73 74 20 62 72 65 61 6b 20 ets "Best break
1170: 40 20 24 62 65 73 74 2c 20 63 75 74 73 20 5b 6e @ $best, cuts [n
1180: 73 70 20 24 63 72 6f 73 73 28 24 62 65 73 74 29 sp $cross($best)
1190: 20 64 65 70 65 6e 64 65 6e 63 79 20 64 65 70 65 dependency depe
11a0: 6e 64 65 6e 63 69 65 73 5d 22 0a 0a 09 09 23 20 ndencies]"....#
11b0: 4e 6f 74 65 3a 20 54 68 65 20 76 61 6c 75 65 20 Note: The value
11c0: 6f 66 20 62 65 73 74 20 69 73 20 61 6e 20 61 62 of best is an ab
11d0: 6f 6c 75 74 65 20 6c 6f 63 61 74 69 6f 6e 20 69 olute location i
11e0: 6e 0a 09 09 23 20 6d 79 72 65 76 69 73 69 6f 6e n...# myrevision
11f0: 73 2e 20 55 73 65 20 74 68 65 20 73 74 61 72 74 s. Use the start
1200: 20 6f 66 20 63 75 72 72 65 6e 74 20 74 6f 20 6d of current to m
1210: 61 6b 65 20 69 74 20 61 6e 0a 09 09 23 20 69 6e ake it an...# in
1220: 64 65 78 20 61 62 73 6f 6c 75 74 65 20 74 6f 20 dex absolute to
1230: 63 75 72 72 65 6e 74 2e 0a 0a 09 09 73 65 74 20 current.....set
1240: 62 72 65 6c 20 5b 65 78 70 72 20 7b 24 62 65 73 brel [expr {$bes
1250: 74 20 2d 20 5b 6c 69 6e 64 65 78 20 24 63 75 72 t - [lindex $cur
1260: 72 65 6e 74 20 30 5d 7d 5d 0a 09 09 73 65 74 20 rent 0]}]...set
1270: 62 6e 65 78 74 20 24 62 72 65 6c 20 3b 20 69 6e bnext $brel ; in
1280: 63 72 20 62 6e 65 78 74 0a 09 09 73 65 74 20 66 cr bnext...set f
1290: 72 61 67 62 65 66 6f 72 65 20 5b 6c 72 61 6e 67 ragbefore [lrang
12a0: 65 20 24 63 75 72 72 65 6e 74 20 30 20 24 62 72 e $current 0 $br
12b0: 65 6c 5d 0a 09 09 73 65 74 20 66 72 61 67 61 66 el]...set fragaf
12c0: 74 65 72 20 20 5b 6c 72 61 6e 67 65 20 24 63 75 ter [lrange $cu
12d0: 72 72 65 6e 74 20 24 62 6e 65 78 74 20 65 6e 64 rrent $bnext end
12e0: 5d 0a 0a 09 09 6c 6f 67 20 77 72 69 74 65 20 36 ]....log write 6
12f0: 20 63 73 65 74 73 20 22 4e 65 77 20 70 69 65 63 csets "New piec
1300: 65 73 20 20 5b 50 52 20 24 66 72 61 67 62 65 66 es [PR $fragbef
1310: 6f 72 65 5d 20 5b 50 52 20 24 66 72 61 67 61 66 ore] [PR $fragaf
1320: 74 65 72 5d 22 0a 0a 09 09 69 66 20 7b 21 5b 6c ter]"....if {![l
1330: 6c 65 6e 67 74 68 20 24 66 72 61 67 62 65 66 6f length $fragbefo
1340: 72 65 5d 7d 20 7b 0a 09 09 20 20 20 20 74 72 6f re]} {... tro
1350: 75 62 6c 65 20 69 6e 74 65 72 6e 61 6c 20 22 54 uble internal "T
1360: 72 69 65 64 20 74 6f 20 73 70 6c 69 74 20 6f 66 ried to split of
1370: 66 20 61 20 7a 65 72 6f 2d 6c 65 6e 67 74 68 20 f a zero-length
1380: 66 72 61 67 6d 65 6e 74 20 61 74 20 74 68 65 20 fragment at the
1390: 62 65 67 69 6e 6e 69 6e 67 22 0a 09 09 7d 0a 09 beginning"...}..
13a0: 09 69 66 20 7b 21 5b 6c 6c 65 6e 67 74 68 20 24 .if {![llength $
13b0: 66 72 61 67 61 66 74 65 72 5d 7d 20 7b 0a 09 09 fragafter]} {...
13c0: 20 20 20 20 74 72 6f 75 62 6c 65 20 69 6e 74 65 trouble inte
13d0: 72 6e 61 6c 20 22 54 72 69 65 64 20 74 6f 20 73 rnal "Tried to s
13e0: 70 6c 69 74 20 6f 66 66 20 61 20 7a 65 72 6f 2d plit off a zero-
13f0: 6c 65 6e 67 74 68 20 66 72 61 67 6d 65 6e 74 20 length fragment
1400: 61 74 20 74 68 65 20 65 6e 64 22 0a 09 09 7d 0a at the end"...}.
1410: 0a 09 09 6c 61 70 70 65 6e 64 20 70 65 6e 64 69 ...lappend pendi
1420: 6e 67 20 24 66 72 61 67 62 65 66 6f 72 65 20 24 ng $fragbefore $
1430: 66 72 61 67 61 66 74 65 72 0a 09 09 43 75 74 41 fragafter...CutA
1440: 74 20 24 62 65 73 74 0a 09 20 20 20 20 7d 0a 0a t $best.. }..
1450: 09 20 20 20 20 69 6e 63 72 20 61 74 0a 09 7d 0a . incr at..}.
1460: 0a 09 6c 6f 67 20 77 72 69 74 65 20 36 20 63 73 ..log write 6 cs
1470: 65 74 73 20 22 2e 20 2e 20 2e 2e 20 2e 2e 2e 20 ets ". . .. ...
1480: 2e 2e 2e 2e 2e 20 2e 2e 2e 2e 2e 2e 2e 2e 20 2e ..... ........ .
1490: 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 22 0a 0a 09 ............"...
14a0: 23 20 43 72 65 61 74 65 20 63 68 61 6e 67 65 73 # Create changes
14b0: 65 74 73 20 66 6f 72 20 74 68 65 20 66 72 61 67 ets for the frag
14c0: 6d 65 6e 74 73 2c 20 72 65 75 73 69 6e 67 20 74 ments, reusing t
14d0: 68 65 20 63 75 72 72 65 6e 74 20 6f 6e 65 0a 09 he current one..
14e0: 23 20 66 6f 72 20 74 68 65 20 66 69 72 73 74 20 # for the first
14f0: 66 72 61 67 6d 65 6e 74 2e 20 57 65 20 73 6f 72 fragment. We sor
1500: 74 20 74 68 65 6d 20 69 6e 20 6f 72 64 65 72 20 t them in order
1510: 74 6f 20 61 6c 6c 6f 77 0a 09 23 20 63 68 65 63 to allow..# chec
1520: 6b 69 6e 67 20 66 6f 72 20 67 61 70 73 20 61 6e king for gaps an
1530: 64 20 6e 69 63 65 20 6d 65 73 73 61 67 65 73 2e d nice messages.
1540: 0a 0a 09 73 65 74 20 66 72 61 67 6d 65 6e 74 73 ...set fragments
1550: 20 5b 6c 73 6f 72 74 20 2d 69 6e 64 65 78 20 30 [lsort -index 0
1560: 20 2d 69 6e 74 65 67 65 72 20 24 66 72 61 67 6d -integer $fragm
1570: 65 6e 74 73 5d 0a 0a 09 23 70 75 74 73 20 5c 74 ents]...#puts \t
1580: 2e 5b 6a 6f 69 6e 20 5b 50 52 73 20 24 66 72 61 .[join [PRs $fra
1590: 67 6d 65 6e 74 73 5d 20 2e 5c 6e 5c 74 2e 5d 2e gments] .\n\t.].
15a0: 0a 0a 09 42 6f 72 64 65 72 20 5b 6c 69 6e 64 65 ...Border [linde
15b0: 78 20 24 66 72 61 67 6d 65 6e 74 73 20 30 5d 20 x $fragments 0]
15c0: 66 69 72 73 74 73 20 66 69 72 73 74 65 0a 0a 09 firsts firste...
15d0: 69 66 20 7b 24 66 69 72 73 74 73 20 21 3d 20 30 if {$firsts != 0
15e0: 7d 20 7b 0a 09 20 20 20 20 74 72 6f 75 62 6c 65 } {.. trouble
15f0: 20 69 6e 74 65 72 6e 61 6c 20 22 42 61 64 20 66 internal "Bad f
1600: 72 61 67 6d 65 6e 74 20 73 74 61 72 74 20 40 20 ragment start @
1610: 24 66 69 72 73 74 73 2c 20 67 61 70 2c 20 6f 72 $firsts, gap, or
1620: 20 62 65 66 6f 72 65 20 62 65 67 69 6e 6e 69 6e before beginnin
1630: 67 20 6f 66 20 74 68 65 20 72 61 6e 67 65 22 0a g of the range".
1640: 09 7d 0a 0a 09 73 65 74 20 6c 61 73 74 65 20 24 .}...set laste $
1650: 66 69 72 73 74 65 0a 09 66 6f 72 65 61 63 68 20 firste..foreach
1660: 66 72 61 67 6d 65 6e 74 20 5b 6c 72 61 6e 67 65 fragment [lrange
1670: 20 24 66 72 61 67 6d 65 6e 74 73 20 31 20 65 6e $fragments 1 en
1680: 64 5d 20 7b 0a 09 20 20 20 20 42 6f 72 64 65 72 d] {.. Border
1690: 20 24 66 72 61 67 6d 65 6e 74 20 73 20 65 0a 09 $fragment s e..
16a0: 20 20 20 20 69 66 20 7b 24 6c 61 73 74 65 20 21 if {$laste !
16b0: 3d 20 28 24 73 20 2d 20 31 29 7d 20 7b 0a 09 09 = ($s - 1)} {...
16c0: 74 72 6f 75 62 6c 65 20 69 6e 74 65 72 6e 61 6c trouble internal
16d0: 20 22 42 61 64 20 66 72 61 67 6d 65 6e 74 20 62 "Bad fragment b
16e0: 6f 72 64 65 72 20 3c 24 6c 61 73 74 65 20 7c 20 order <$laste |
16f0: 24 73 3e 2c 20 67 61 70 20 6f 72 20 6f 76 65 72 $s>, gap or over
1700: 6c 61 70 22 0a 09 20 20 20 20 7d 0a 0a 09 20 20 lap".. }...
1710: 20 20 73 65 74 20 6e 65 77 20 5b 24 74 79 70 65 set new [$type
1720: 20 25 41 55 54 4f 25 20 24 6d 79 70 72 6f 6a 65 %AUTO% $myproje
1730: 63 74 20 24 6d 79 74 79 70 65 20 24 6d 79 73 72 ct $mytype $mysr
1740: 63 69 64 20 5b 6c 72 61 6e 67 65 20 24 6d 79 72 cid [lrange $myr
1750: 65 76 69 73 69 6f 6e 73 20 24 73 20 24 65 5d 5d evisions $s $e]]
1760: 0a 09 20 20 20 20 6c 61 70 70 65 6e 64 20 63 73 .. lappend cs
1770: 65 74 73 20 24 6e 65 77 0a 0a 20 20 20 20 20 20 ets $new..
1780: 20 20 20 20 20 20 6c 6f 67 20 77 72 69 74 65 20 log write
1790: 34 20 63 73 65 74 73 20 22 42 72 65 61 6b 69 6e 4 csets "Breakin
17a0: 67 20 3c 24 6d 79 69 64 3e 20 40 20 24 6c 61 73 g <$myid> @ $las
17b0: 74 65 2c 20 6e 65 77 20 3c 5b 24 6e 65 77 20 69 te, new <[$new i
17c0: 64 5d 3e 2c 20 63 75 74 74 69 6e 67 20 24 62 72 d]>, cutting $br
17d0: 65 61 6b 73 28 24 6c 61 73 74 65 29 22 0a 0a 09 eaks($laste)"...
17e0: 20 20 20 20 73 65 74 20 6c 61 73 74 65 20 24 65 set laste $e
17f0: 0a 09 7d 0a 0a 09 69 66 20 7b 24 6c 61 73 74 65 ..}...if {$laste
1800: 20 21 3d 20 28 5b 6c 6c 65 6e 67 74 68 20 24 6d != ([llength $m
1810: 79 72 65 76 69 73 69 6f 6e 73 5d 2d 31 29 7d 20 yrevisions]-1)}
1820: 7b 0a 09 20 20 20 20 74 72 6f 75 62 6c 65 20 69 {.. trouble i
1830: 6e 74 65 72 6e 61 6c 20 22 42 61 64 20 66 72 61 nternal "Bad fra
1840: 67 6d 65 6e 74 20 65 6e 64 20 40 20 24 6c 61 73 gment end @ $las
1850: 74 65 2c 20 67 61 70 2c 20 6f 72 20 62 65 79 6f te, gap, or beyo
1860: 6e 64 20 65 6e 64 20 6f 66 20 74 68 65 20 72 61 nd end of the ra
1870: 6e 67 65 22 0a 09 7d 0a 0a 09 23 20 50 75 74 20 nge"..}...# Put
1880: 74 68 65 20 66 69 72 73 74 20 66 72 61 67 6d 65 the first fragme
1890: 6e 74 20 69 6e 74 6f 20 74 68 65 20 63 75 72 72 nt into the curr
18a0: 65 6e 74 20 63 68 61 6e 67 65 73 65 74 2e 0a 09 ent changeset...
18b0: 73 65 74 20 6d 79 72 65 76 69 73 69 6f 6e 73 20 set myrevisions
18c0: 5b 6c 72 61 6e 67 65 20 24 6d 79 72 65 76 69 73 [lrange $myrevis
18d0: 69 6f 6e 73 20 30 20 24 66 69 72 73 74 65 5d 0a ions 0 $firste].
18e0: 0a 09 72 65 74 75 72 6e 20 31 0a 20 20 20 20 7d ..return 1. }
18f0: 0a 0a 20 20 20 20 6d 65 74 68 6f 64 20 70 65 72 .. method per
1900: 73 69 73 74 20 7b 7d 20 7b 0a 09 73 65 74 20 74 sist {} {..set t
1910: 69 64 20 24 6d 79 63 73 74 79 70 65 28 24 6d 79 id $mycstype($my
1920: 74 79 70 65 29 0a 09 73 65 74 20 70 69 64 20 5b type)..set pid [
1930: 24 6d 79 70 72 6f 6a 65 63 74 20 69 64 5d 0a 09 $myproject id]..
1940: 73 65 74 20 70 6f 73 20 30 0a 0a 09 73 74 61 74 set pos 0...stat
1950: 65 20 74 72 61 6e 73 61 63 74 69 6f 6e 20 7b 0a e transaction {.
1960: 09 20 20 20 20 73 74 61 74 65 20 72 75 6e 20 7b . state run {
1970: 0a 09 09 49 4e 53 45 52 54 20 49 4e 54 4f 20 63 ...INSERT INTO c
1980: 68 61 6e 67 65 73 65 74 20 28 63 69 64 2c 20 20 hangeset (cid,
1990: 20 70 69 64 2c 20 20 74 79 70 65 2c 20 73 72 63 pid, type, src
19a0: 29 0a 09 09 56 41 4c 55 45 53 20 20 20 20 20 20 )...VALUES
19b0: 20 20 20 20 20 20 20 20 20 20 28 24 6d 79 69 64 ($myid
19c0: 2c 20 24 70 69 64 2c 20 24 74 69 64 2c 20 24 6d , $pid, $tid, $m
19d0: 79 73 72 63 69 64 29 3b 0a 09 20 20 20 20 7d 0a ysrcid);.. }.
19e0: 0a 09 20 20 20 20 66 6f 72 65 61 63 68 20 72 69 .. foreach ri
19f0: 64 20 24 6d 79 72 65 76 69 73 69 6f 6e 73 20 7b d $myrevisions {
1a00: 0a 09 09 73 74 61 74 65 20 72 75 6e 20 7b 0a 09 ...state run {..
1a10: 09 20 20 20 20 49 4e 53 45 52 54 20 49 4e 54 4f . INSERT INTO
1a20: 20 63 73 72 65 76 69 73 69 6f 6e 20 28 63 69 64 csrevision (cid
1a30: 2c 20 20 20 70 6f 73 2c 20 20 72 69 64 29 0a 09 , pos, rid)..
1a40: 09 20 20 20 20 56 41 4c 55 45 53 20 20 20 20 20 . VALUES
1a50: 20 20 20 20 20 20 20 20 20 20 20 20 28 24 6d 79 ($my
1a60: 69 64 2c 20 24 70 6f 73 2c 20 24 72 69 64 29 3b id, $pos, $rid);
1a70: 0a 09 09 7d 0a 09 09 69 6e 63 72 20 70 6f 73 0a ...}...incr pos.
1a80: 09 20 20 20 20 7d 0a 09 7d 0a 09 72 65 74 75 72 . }..}..retur
1a90: 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 23 20 23 n. }.. # #
1aa0: 20 23 23 20 23 23 23 20 23 23 23 23 23 20 23 23 ## ### ##### ##
1ab0: 23 23 23 23 23 23 20 23 23 23 23 23 23 23 23 23 ###### #########
1ac0: 23 23 23 23 0a 20 20 20 20 23 23 20 53 74 61 74 ####. ## Stat
1ad0: 65 0a 0a 20 20 20 20 76 61 72 69 61 62 6c 65 20 e.. variable
1ae0: 6d 79 69 64 20 20 20 20 20 20 20 20 3b 20 23 20 myid ; #
1af0: 49 64 20 6f 66 20 74 68 65 20 63 73 65 74 20 66 Id of the cset f
1b00: 6f 72 20 74 68 65 20 70 65 72 73 69 73 74 65 6e or the persisten
1b10: 74 20 73 74 61 74 65 2e 0a 20 20 20 20 76 61 72 t state.. var
1b20: 69 61 62 6c 65 20 6d 79 70 72 6f 6a 65 63 74 20 iable myproject
1b30: 20 20 3b 20 23 20 52 65 66 65 72 65 6e 63 65 20 ; # Reference
1b40: 6f 66 20 74 68 65 20 70 72 6f 6a 65 63 74 20 6f of the project o
1b50: 62 6a 65 63 74 20 74 68 65 20 63 68 61 6e 67 65 bject the change
1b60: 73 65 74 20 62 65 6c 6f 6e 67 73 20 74 6f 2e 0a set belongs to..
1b70: 20 20 20 20 76 61 72 69 61 62 6c 65 20 6d 79 74 variable myt
1b80: 79 70 65 20 20 20 20 20 20 3b 20 23 20 72 65 76 ype ; # rev
1b90: 20 6f 72 20 73 79 6d 2c 20 77 68 65 72 65 20 74 or sym, where t
1ba0: 68 65 20 63 73 65 74 20 6f 72 69 67 69 6e 61 74 he cset originat
1bb0: 65 64 20 66 72 6f 6d 2e 0a 20 20 20 20 76 61 72 ed from.. var
1bc0: 69 61 62 6c 65 20 6d 79 73 72 63 69 64 20 20 20 iable mysrcid
1bd0: 20 20 3b 20 23 20 69 64 20 6f 66 20 74 68 65 20 ; # id of the
1be0: 6d 65 74 61 64 61 74 61 20 6f 72 20 73 79 6d 62 metadata or symb
1bf0: 6f 6c 20 74 68 65 20 63 73 65 74 20 69 73 20 62 ol the cset is b
1c00: 61 73 65 64 20 6f 6e 2e 0a 20 20 20 20 76 61 72 ased on.. var
1c10: 69 61 62 6c 65 20 6d 79 72 65 76 69 73 69 6f 6e iable myrevision
1c20: 73 20 3b 20 23 20 4c 69 73 74 20 6f 66 20 74 68 s ; # List of th
1c30: 65 20 66 69 6c 65 20 6c 65 76 65 6c 20 72 65 76 e file level rev
1c40: 69 73 69 6f 6e 73 20 69 6e 20 74 68 65 20 63 73 isions in the cs
1c50: 65 74 2e 0a 0a 20 20 20 20 23 20 23 20 23 23 20 et... # # ##
1c60: 23 23 23 20 23 23 23 23 23 20 23 23 23 23 23 23 ### ##### ######
1c70: 23 23 20 23 23 23 23 23 23 23 23 23 23 23 23 23 ## #############
1c80: 0a 20 20 20 20 23 23 20 49 6e 74 65 72 6e 61 6c . ## Internal
1c90: 20 6d 65 74 68 6f 64 73 0a 0a 20 20 20 20 74 79 methods.. ty
1ca0: 70 65 76 61 72 69 61 62 6c 65 20 6d 79 63 6f 75 pevariable mycou
1cb0: 6e 74 65 72 20 20 20 20 20 20 20 20 30 20 3b 20 nter 0 ;
1cc0: 23 20 49 64 20 63 6f 75 6e 74 65 72 20 66 6f 72 # Id counter for
1cd0: 20 63 73 65 74 73 2e 0a 20 20 20 20 74 79 70 65 csets.. type
1ce0: 76 61 72 69 61 62 6c 65 20 6d 79 63 73 74 79 70 variable mycstyp
1cf0: 65 20 2d 61 72 72 61 79 20 7b 7d 20 3b 20 23 20 e -array {} ; #
1d00: 4d 61 70 20 63 73 74 79 70 65 73 20 74 6f 20 70 Map cstypes to p
1d10: 65 72 73 69 73 74 65 6e 74 20 69 64 73 2e 0a 0a ersistent ids...
1d20: 20 20 20 20 74 79 70 65 6d 65 74 68 6f 64 20 67 typemethod g
1d30: 65 74 63 73 74 79 70 65 73 20 7b 7d 20 7b 0a 09 etcstypes {} {..
1d40: 66 6f 72 65 61 63 68 20 7b 74 69 64 20 6e 61 6d foreach {tid nam
1d50: 65 7d 20 5b 73 74 61 74 65 20 72 75 6e 20 7b 0a e} [state run {.
1d60: 09 20 20 20 20 53 45 4c 45 43 54 20 74 69 64 2c . SELECT tid,
1d70: 20 6e 61 6d 65 20 46 52 4f 4d 20 63 73 74 79 70 name FROM cstyp
1d80: 65 3b 0a 09 7d 5d 20 7b 20 73 65 74 20 6d 79 63 e;..}] { set myc
1d90: 73 74 79 70 65 28 24 6e 61 6d 65 29 20 24 74 69 stype($name) $ti
1da0: 64 20 7d 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 d }..return.
1db0: 7d 0a 0a 20 20 20 20 70 72 6f 63 20 50 75 6c 6c }.. proc Pull
1dc0: 49 6e 74 65 72 6e 61 6c 44 65 70 65 6e 64 65 6e InternalDependen
1dd0: 63 69 65 73 20 7b 64 76 20 72 65 76 69 73 69 6f cies {dv revisio
1de0: 6e 73 7d 20 7b 0a 09 75 70 76 61 72 20 31 20 24 ns} {..upvar 1 $
1df0: 64 76 20 64 65 70 65 6e 64 65 6e 63 69 65 73 0a dv dependencies.
1e00: 09 73 65 74 20 74 68 65 73 65 74 20 28 27 5b 6a .set theset ('[j
1e10: 6f 69 6e 20 24 72 65 76 69 73 69 6f 6e 73 20 7b oin $revisions {
1e20: 27 2c 27 7d 5d 27 29 0a 0a 09 66 6f 72 65 61 63 ','}]')...foreac
1e30: 68 20 7b 72 69 64 20 63 68 69 6c 64 7d 20 5b 73 h {rid child} [s
1e40: 74 61 74 65 20 72 75 6e 20 22 0a 20 20 20 2d 2d tate run ". --
1e50: 20 50 72 69 6d 61 72 79 20 63 68 69 6c 64 72 65 Primary childre
1e60: 6e 0a 09 20 20 20 20 53 45 4c 45 43 54 20 52 2e n.. SELECT R.
1e70: 72 69 64 2c 20 52 2e 63 68 69 6c 64 0a 09 20 20 rid, R.child..
1e80: 20 20 46 52 4f 4d 20 20 20 72 65 76 69 73 69 6f FROM revisio
1e90: 6e 20 52 0a 09 20 20 20 20 57 48 45 52 45 20 20 n R.. WHERE
1ea0: 52 2e 72 69 64 20 20 20 49 4e 20 24 74 68 65 73 R.rid IN $thes
1eb0: 65 74 0a 09 20 20 20 20 41 4e 44 20 20 20 20 52 et.. AND R
1ec0: 2e 63 68 69 6c 64 20 49 53 20 4e 4f 54 20 4e 55 .child IS NOT NU
1ed0: 4c 4c 0a 09 20 20 20 20 41 4e 44 20 20 20 20 52 LL.. AND R
1ee0: 2e 63 68 69 6c 64 20 49 4e 20 24 74 68 65 73 65 .child IN $these
1ef0: 74 0a 20 20 20 20 55 4e 49 4f 4e 0a 20 20 20 20 t. UNION.
1f00: 2d 2d 20 54 72 61 6e 73 69 74 69 6f 6e 20 4e 54 -- Transition NT
1f10: 44 42 20 74 6f 20 74 72 75 6e 6b 0a 09 20 20 20 DB to trunk..
1f20: 20 53 45 4c 45 43 54 20 52 2e 72 69 64 2c 20 52 SELECT R.rid, R
1f30: 2e 64 62 63 68 69 6c 64 0a 09 20 20 20 20 46 52 .dbchild.. FR
1f40: 4f 4d 20 20 20 72 65 76 69 73 69 6f 6e 20 52 0a OM revision R.
1f50: 09 20 20 20 20 57 48 45 52 45 20 20 52 2e 72 69 . WHERE R.ri
1f60: 64 20 20 20 49 4e 20 24 74 68 65 73 65 74 0a 09 d IN $theset..
1f70: 20 20 20 20 41 4e 44 20 20 20 20 52 2e 64 62 63 AND R.dbc
1f80: 68 69 6c 64 20 49 53 20 4e 4f 54 20 4e 55 4c 4c hild IS NOT NULL
1f90: 0a 09 20 20 20 20 41 4e 44 20 20 20 20 52 2e 64 .. AND R.d
1fa0: 62 63 68 69 6c 64 20 49 4e 20 24 74 68 65 73 65 bchild IN $these
1fb0: 74 0a 20 20 20 20 55 4e 49 4f 4e 0a 20 20 20 20 t. UNION.
1fc0: 2d 2d 20 53 65 63 6f 6e 64 61 72 79 20 28 62 72 -- Secondary (br
1fd0: 61 6e 63 68 29 20 63 68 69 6c 64 72 65 6e 0a 09 anch) children..
1fe0: 20 20 20 20 53 45 4c 45 43 54 20 52 2e 72 69 64 SELECT R.rid
1ff0: 2c 20 42 2e 62 72 69 64 0a 09 20 20 20 20 46 52 , B.brid.. FR
2000: 4f 4d 20 20 20 72 65 76 69 73 69 6f 6e 20 52 2c OM revision R,
2010: 20 72 65 76 69 73 69 6f 6e 62 72 61 6e 63 68 63 revisionbranchc
2020: 68 69 6c 64 72 65 6e 20 42 0a 09 20 20 20 20 57 hildren B.. W
2030: 48 45 52 45 20 20 52 2e 72 69 64 20 20 20 49 4e HERE R.rid IN
2040: 20 24 74 68 65 73 65 74 0a 09 20 20 20 20 41 4e $theset.. AN
2050: 44 20 20 20 20 52 2e 72 69 64 20 3d 20 42 2e 72 D R.rid = B.r
2060: 69 64 0a 09 20 20 20 20 41 4e 44 20 20 20 20 42 id.. AND B
2070: 2e 62 72 69 64 20 49 4e 20 24 74 68 65 73 65 74 .brid IN $theset
2080: 0a 09 22 5d 20 7b 0a 09 20 20 20 20 23 20 43 6f .."] {.. # Co
2090: 6e 73 69 64 65 72 20 6d 6f 76 69 6e 67 20 74 68 nsider moving th
20a0: 69 73 20 74 6f 20 74 68 65 20 69 6e 74 65 67 72 is to the integr
20b0: 69 74 79 20 6d 6f 64 75 6c 65 2e 0a 09 20 20 20 ity module...
20c0: 20 69 66 20 7b 24 72 69 64 20 3d 3d 20 24 63 68 if {$rid == $ch
20d0: 69 6c 64 7d 20 7b 0a 09 09 74 72 6f 75 62 6c 65 ild} {...trouble
20e0: 20 69 6e 74 65 72 6e 61 6c 20 22 52 65 76 69 73 internal "Revis
20f0: 69 6f 6e 20 24 72 69 64 20 64 65 70 65 6e 64 73 ion $rid depends
2100: 20 6f 6e 20 69 74 73 65 6c 66 2e 22 0a 09 20 20 on itself."..
2110: 20 20 7d 0a 09 20 20 20 20 73 65 74 20 64 65 70 }.. set dep
2120: 65 6e 64 65 6e 63 69 65 73 28 24 72 69 64 29 20 endencies($rid)
2130: 24 63 68 69 6c 64 0a 09 7d 0a 20 20 20 20 7d 0a $child..}. }.
2140: 0a 20 20 20 20 70 72 6f 63 20 49 6e 69 74 69 61 . proc Initia
2150: 6c 69 7a 65 42 72 65 61 6b 53 74 61 74 65 20 7b lizeBreakState {
2160: 72 65 76 69 73 69 6f 6e 73 7d 20 7b 0a 09 75 70 revisions} {..up
2170: 76 61 72 20 31 20 70 6f 73 20 70 6f 73 20 63 72 var 1 pos pos cr
2180: 6f 73 73 20 63 72 6f 73 73 20 72 61 6e 67 65 20 oss cross range
2190: 72 61 6e 67 65 20 64 65 70 63 20 64 65 70 63 20 range depc depc
21a0: 64 65 6c 74 61 20 64 65 6c 74 61 20 5c 0a 09 20 delta delta \..
21b0: 20 20 20 64 65 70 65 6e 64 65 6e 63 69 65 73 20 dependencies
21c0: 64 65 70 65 6e 64 65 6e 63 69 65 73 0a 0a 09 23 dependencies...#
21d0: 20 46 69 72 73 74 20 77 65 20 63 72 65 61 74 65 First we create
21e0: 20 61 20 6d 61 70 20 6f 66 20 70 6f 73 69 74 69 a map of positi
21f0: 6f 6e 73 20 74 6f 20 6d 61 6b 65 20 69 74 20 65 ons to make it e
2200: 61 73 69 65 72 20 74 6f 0a 09 23 20 64 65 74 65 asier to..# dete
2210: 72 6d 69 6e 65 20 77 68 65 74 68 65 72 20 61 20 rmine whether a
2220: 64 65 70 65 6e 64 65 6e 63 79 20 63 72 6f 73 73 dependency cross
2230: 65 73 20 61 20 70 61 72 74 69 63 75 6c 61 72 20 es a particular
2240: 69 6e 64 65 78 2e 0a 0a 09 61 72 72 61 79 20 73 index....array s
2250: 65 74 20 70 6f 73 20 20 20 7b 7d 0a 09 61 72 72 et pos {}..arr
2260: 61 79 20 73 65 74 20 63 72 6f 73 73 20 7b 7d 0a ay set cross {}.
2270: 09 61 72 72 61 79 20 73 65 74 20 64 65 70 63 20 .array set depc
2280: 20 7b 7d 0a 09 73 65 74 20 72 61 6e 67 65 20 20 {}..set range
2290: 20 20 20 20 20 7b 7d 0a 09 73 65 74 20 6e 20 30 {}..set n 0
22a0: 0a 09 66 6f 72 65 61 63 68 20 72 65 76 20 24 72 ..foreach rev $r
22b0: 65 76 69 73 69 6f 6e 73 20 7b 20 0a 09 20 20 20 evisions { ..
22c0: 20 6c 61 70 70 65 6e 64 20 72 61 6e 67 65 20 24 lappend range $
22d0: 6e 0a 09 20 20 20 20 73 65 74 20 70 6f 73 28 24 n.. set pos($
22e0: 72 65 76 29 20 24 6e 0a 09 20 20 20 20 73 65 74 rev) $n.. set
22f0: 20 63 72 6f 73 73 28 24 6e 29 20 30 0a 09 20 20 cross($n) 0..
2300: 20 20 69 6e 63 72 20 6e 0a 09 7d 0a 0a 09 23 20 incr n..}...#
2310: 53 65 63 6f 6e 64 6c 79 20 77 65 20 63 6f 75 6e Secondly we coun
2320: 74 20 74 68 65 20 63 72 6f 73 73 69 6e 67 73 20 t the crossings
2330: 70 65 72 20 70 6f 73 69 74 69 6f 6e 2c 20 62 79 per position, by
2340: 20 69 74 65 72 61 74 69 6e 67 0a 09 23 20 6f 76 iterating..# ov
2350: 65 72 20 74 68 65 20 72 65 63 6f 72 64 65 64 20 er the recorded
2360: 69 6e 74 65 72 6e 61 6c 20 64 65 70 65 6e 64 65 internal depende
2370: 6e 63 69 65 73 2e 0a 0a 09 23 20 4e 6f 74 65 3a ncies....# Note:
2380: 20 49 66 20 74 68 65 20 74 69 6d 65 73 74 61 6d If the timestam
2390: 70 73 20 61 72 65 20 62 61 64 6c 79 20 6f 75 74 ps are badly out
23a0: 20 6f 66 20 6f 72 64 65 72 20 69 74 20 69 73 0a of order it is.
23b0: 09 23 20 20 20 20 20 20 20 70 6f 73 73 69 62 6c .# possibl
23c0: 65 20 74 6f 20 68 61 76 65 20 61 20 62 61 63 6b e to have a back
23d0: 77 61 72 64 20 73 75 63 63 65 73 73 6f 72 20 64 ward successor d
23e0: 65 70 65 6e 64 65 6e 63 79 2c 0a 09 23 20 20 20 ependency,..#
23f0: 20 20 20 20 69 2e 65 2e 20 77 69 74 68 20 73 74 i.e. with st
2400: 61 72 74 20 3e 20 65 6e 64 2e 20 57 65 20 6d 61 art > end. We ma
2410: 79 20 68 61 76 65 20 74 6f 20 73 77 61 70 20 74 y have to swap t
2420: 68 65 20 69 6e 64 69 63 65 73 0a 09 23 20 20 20 he indices..#
2430: 20 20 20 20 74 6f 20 65 6e 73 75 72 65 20 74 68 to ensure th
2440: 61 74 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 at the following
2450: 20 6c 6f 6f 70 20 72 75 6e 73 20 63 6f 72 72 65 loop runs corre
2460: 63 74 6c 79 2e 0a 09 23 0a 09 23 20 4e 6f 74 65 ctly...#..# Note
2470: 20 32 3a 20 73 74 61 72 74 20 3d 3d 20 65 6e 64 2: start == end
2480: 20 69 73 20 6e 6f 74 20 70 6f 73 73 69 62 6c 65 is not possible
2490: 2e 20 49 74 20 69 6e 64 69 63 61 74 65 73 20 61 . It indicates a
24a0: 0a 09 23 20 20 20 20 20 20 20 20 20 73 65 6c 66 ..# self
24b0: 2d 64 65 70 65 6e 64 65 6e 63 79 20 64 75 65 20 -dependency due
24c0: 74 6f 20 74 68 65 20 75 6e 69 71 75 65 6e 65 73 to the uniquenes
24d0: 73 20 6f 66 20 70 6f 73 69 74 69 6f 6e 73 2c 0a s of positions,.
24e0: 09 23 20 20 20 20 20 20 20 20 20 61 6e 64 20 74 .# and t
24f0: 68 61 74 20 69 73 20 73 6f 6d 65 74 68 69 6e 67 hat is something
2500: 20 77 65 20 68 61 76 65 20 72 75 6c 65 64 20 6f we have ruled o
2510: 75 74 20 61 6c 72 65 61 64 79 2c 20 73 65 65 0a ut already, see.
2520: 09 23 20 20 20 20 20 20 20 20 20 50 75 6c 6c 49 .# PullI
2530: 6e 74 65 72 6e 61 6c 44 65 70 65 6e 64 65 6e 63 nternalDependenc
2540: 69 65 73 2e 0a 0a 09 66 6f 72 65 61 63 68 20 7b ies....foreach {
2550: 72 69 64 20 63 68 69 6c 64 7d 20 5b 61 72 72 61 rid child} [arra
2560: 79 20 67 65 74 20 64 65 70 65 6e 64 65 6e 63 69 y get dependenci
2570: 65 73 5d 20 7b 0a 09 20 20 20 20 73 65 74 20 64 es] {.. set d
2580: 6b 65 79 20 20 20 20 5b 6c 69 73 74 20 24 72 69 key [list $ri
2590: 64 20 24 63 68 69 6c 64 5d 0a 09 20 20 20 20 73 d $child].. s
25a0: 65 74 20 73 74 61 72 74 20 20 20 24 70 6f 73 28 et start $pos(
25b0: 24 72 69 64 29 0a 09 20 20 20 20 73 65 74 20 65 $rid).. set e
25c0: 6e 64 20 20 20 20 20 24 70 6f 73 28 24 63 68 69 nd $pos($chi
25d0: 6c 64 29 0a 09 20 20 20 20 73 65 74 20 63 72 6f ld).. set cro
25e0: 73 73 65 73 20 7b 7d 0a 0a 09 20 20 20 20 69 66 sses {}... if
25f0: 20 7b 24 73 74 61 72 74 20 3e 20 24 65 6e 64 7d {$start > $end}
2600: 20 7b 0a 09 09 77 68 69 6c 65 20 7b 24 65 6e 64 {...while {$end
2610: 20 3c 20 24 73 74 61 72 74 7d 20 7b 0a 09 09 20 < $start} {...
2620: 20 20 20 6c 61 70 70 65 6e 64 20 63 72 6f 73 73 lappend cross
2630: 65 73 20 24 65 6e 64 0a 09 09 20 20 20 20 69 6e es $end... in
2640: 63 72 20 63 72 6f 73 73 28 24 65 6e 64 29 0a 09 cr cross($end)..
2650: 09 20 20 20 20 69 6e 63 72 20 65 6e 64 0a 09 09 . incr end...
2660: 7d 0a 09 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a }.. } else {.
2670: 09 09 77 68 69 6c 65 20 7b 24 73 74 61 72 74 20 ..while {$start
2680: 3c 20 24 65 6e 64 7d 20 7b 0a 09 09 20 20 20 20 < $end} {...
2690: 6c 61 70 70 65 6e 64 20 63 72 6f 73 73 65 73 20 lappend crosses
26a0: 24 73 74 61 72 74 0a 09 09 20 20 20 20 69 6e 63 $start... inc
26b0: 72 20 63 72 6f 73 73 28 24 73 74 61 72 74 29 0a r cross($start).
26c0: 09 09 20 20 20 20 69 6e 63 72 20 73 74 61 72 74 .. incr start
26d0: 0a 09 09 7d 0a 09 20 20 20 20 7d 0a 09 20 20 20 ...}.. }..
26e0: 20 73 65 74 20 64 65 70 63 28 24 64 6b 65 79 29 set depc($dkey)
26f0: 20 24 63 72 6f 73 73 65 73 0a 09 7d 0a 0a 09 49 $crosses..}...I
2700: 6e 69 74 69 61 6c 69 7a 65 44 65 6c 74 61 73 20 nitializeDeltas
2710: 24 72 65 76 69 73 69 6f 6e 73 0a 09 72 65 74 75 $revisions..retu
2720: 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 70 72 rn. }.. pr
2730: 6f 63 20 49 6e 69 74 69 61 6c 69 7a 65 44 65 6c oc InitializeDel
2740: 74 61 73 20 7b 72 65 76 69 73 69 6f 6e 73 7d 20 tas {revisions}
2750: 7b 0a 09 75 70 76 61 72 20 31 20 64 65 6c 74 61 {..upvar 1 delta
2760: 20 64 65 6c 74 61 0a 0a 09 23 20 50 75 6c 6c 20 delta...# Pull
2770: 74 68 65 20 74 69 6d 65 73 74 61 6d 70 73 20 66 the timestamps f
2780: 6f 72 20 61 6c 6c 20 72 65 76 69 73 69 6f 6e 73 or all revisions
2790: 20 69 6e 20 74 68 65 20 63 68 61 6e 67 65 73 65 in the changese
27a0: 74 73 20 61 6e 64 0a 09 23 20 63 6f 6d 70 75 74 ts and..# comput
27b0: 65 20 74 68 65 69 72 20 64 65 6c 74 61 73 20 66 e their deltas f
27c0: 6f 72 20 75 73 65 20 62 79 20 74 68 65 20 62 72 or use by the br
27d0: 65 61 6b 20 66 69 6e 64 65 72 2e 0a 0a 09 61 72 eak finder....ar
27e0: 72 61 79 20 73 65 74 20 64 65 6c 74 61 20 7b 7d ray set delta {}
27f0: 0a 09 61 72 72 61 79 20 73 65 74 20 73 74 61 6d ..array set stam
2800: 70 20 7b 7d 0a 0a 09 73 65 74 20 74 68 65 73 65 p {}...set these
2810: 74 20 28 27 5b 6a 6f 69 6e 20 24 72 65 76 69 73 t ('[join $revis
2820: 69 6f 6e 73 20 7b 27 2c 27 7d 5d 27 29 0a 09 66 ions {','}]')..f
2830: 6f 72 65 61 63 68 20 7b 72 69 64 20 74 69 6d 65 oreach {rid time
2840: 7d 20 5b 73 74 61 74 65 20 72 75 6e 20 22 0a 09 } [state run "..
2850: 20 20 20 20 53 45 4c 45 43 54 20 52 2e 72 69 64 SELECT R.rid
2860: 2c 20 52 2e 64 61 74 65 0a 09 20 20 20 20 46 52 , R.date.. FR
2870: 4f 4d 20 72 65 76 69 73 69 6f 6e 20 52 0a 09 20 OM revision R..
2880: 20 20 20 57 48 45 52 45 20 52 2e 72 69 64 20 49 WHERE R.rid I
2890: 4e 20 24 74 68 65 73 65 74 0a 09 22 5d 20 7b 0a N $theset.."] {.
28a0: 09 20 20 20 20 73 65 74 20 73 74 61 6d 70 28 24 . set stamp($
28b0: 72 69 64 29 20 24 74 69 6d 65 0a 09 7d 0a 0a 09 rid) $time..}...
28c0: 73 65 74 20 6e 20 30 0a 09 66 6f 72 65 61 63 68 set n 0..foreach
28d0: 20 72 69 64 20 5b 6c 72 61 6e 67 65 20 24 72 65 rid [lrange $re
28e0: 76 69 73 69 6f 6e 73 20 30 20 65 6e 64 2d 31 5d visions 0 end-1]
28f0: 20 72 6e 65 78 74 20 5b 6c 72 61 6e 67 65 20 24 rnext [lrange $
2900: 72 65 76 69 73 69 6f 6e 73 20 31 20 65 6e 64 5d revisions 1 end]
2910: 20 7b 0a 09 20 20 20 20 73 65 74 20 64 65 6c 74 {.. set delt
2920: 61 28 24 6e 29 20 5b 65 78 70 72 20 7b 24 73 74 a($n) [expr {$st
2930: 61 6d 70 28 24 72 6e 65 78 74 29 20 2d 20 24 73 amp($rnext) - $s
2940: 74 61 6d 70 28 24 72 69 64 29 7d 5d 0a 09 20 20 tamp($rid)}]..
2950: 20 20 69 6e 63 72 20 6e 0a 09 7d 0a 09 72 65 74 incr n..}..ret
2960: 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 70 urn. }.. p
2970: 72 6f 63 20 46 69 6e 64 42 65 73 74 42 72 65 61 roc FindBestBrea
2980: 6b 20 7b 72 61 6e 67 65 7d 20 7b 0a 09 75 70 76 k {range} {..upv
2990: 61 72 20 31 20 63 72 6f 73 73 20 63 72 6f 73 73 ar 1 cross cross
29a0: 20 64 65 6c 74 61 20 64 65 6c 74 61 0a 0a 09 23 delta delta...#
29b0: 20 44 65 74 65 72 6d 69 6e 65 20 74 68 65 20 62 Determine the b
29c0: 65 73 74 20 62 72 65 61 6b 20 6c 6f 63 61 74 69 est break locati
29d0: 6f 6e 20 69 6e 20 74 68 65 20 67 69 76 65 6e 20 on in the given
29e0: 72 61 6e 67 65 20 6f 66 0a 09 23 20 70 6f 73 69 range of..# posi
29f0: 74 69 6f 6e 73 2e 20 46 69 72 73 74 20 77 65 20 tions. First we
2a00: 6c 6f 6f 6b 20 66 6f 72 20 74 68 65 20 6c 6f 63 look for the loc
2a10: 61 74 69 6f 6e 73 20 77 69 74 68 20 74 68 65 20 ations with the
2a20: 6d 61 78 69 6d 61 6c 0a 09 23 20 6e 75 6d 62 65 maximal..# numbe
2a30: 72 20 6f 66 20 63 72 6f 73 73 69 6e 67 73 2e 20 r of crossings.
2a40: 49 66 20 74 68 65 72 65 20 61 72 65 20 73 65 76 If there are sev
2a50: 65 72 61 6c 20 77 65 20 6c 6f 6f 6b 20 66 6f 72 eral we look for
2a60: 20 74 68 65 0a 09 23 20 73 68 6f 72 74 65 73 74 the..# shortest
2a70: 20 74 69 6d 65 20 69 6e 74 65 72 76 61 6c 20 61 time interval a
2a80: 6d 6f 6e 67 20 74 68 65 6d 2e 20 49 66 20 77 65 mong them. If we
2a90: 20 73 74 69 6c 6c 20 68 61 76 65 20 6d 75 6c 74 still have mult
2aa0: 69 70 6c 65 0a 09 23 20 70 6f 73 73 69 62 69 6c iple..# possibil
2ab0: 69 74 69 65 73 20 61 66 74 65 72 20 74 68 61 74 ities after that
2ac0: 20 77 65 20 73 65 6c 65 63 74 20 74 68 65 20 65 we select the e
2ad0: 61 72 6c 69 65 73 74 20 6c 6f 63 61 74 69 6f 6e arliest location
2ae0: 0a 09 23 20 61 6d 6f 6e 67 20 74 68 65 73 65 2e ..# among these.
2af0: 0a 0a 09 23 20 4e 6f 74 65 3a 20 49 66 20 74 68 ...# Note: If th
2b00: 65 20 6d 61 78 69 6d 61 6c 20 6e 75 6d 62 65 72 e maximal number
2b10: 20 6f 66 20 63 72 6f 73 73 69 6e 67 73 20 69 73 of crossings is
2b20: 20 30 20 74 68 65 6e 20 74 68 65 20 72 61 6e 67 0 then the rang
2b30: 65 0a 09 23 20 20 20 20 20 20 20 68 61 73 20 6e e..# has n
2b40: 6f 20 69 6e 74 65 72 6e 61 6c 20 64 65 70 65 6e o internal depen
2b50: 64 65 6e 63 69 65 73 2c 20 61 6e 64 20 6e 6f 20 dencies, and no
2b60: 62 72 65 61 6b 20 6c 6f 63 61 74 69 6f 6e 20 61 break location a
2b70: 74 0a 09 23 20 20 20 20 20 20 20 61 6c 6c 2e 20 t..# all.
2b80: 54 68 69 73 20 70 6f 73 73 69 62 69 6c 69 74 79 This possibility
2b90: 20 69 73 20 73 69 67 6e 61 6c 65 64 20 76 69 61 is signaled via
2ba0: 20 72 65 73 75 6c 74 20 2d 31 2e 0a 0a 09 23 20 result -1....#
2bb0: 4e 6f 74 65 3a 20 41 20 72 61 6e 67 65 20 6f 66 Note: A range of
2bc0: 20 6c 65 6e 67 74 68 20 31 20 6f 72 20 6c 65 73 length 1 or les
2bd0: 73 20 63 61 6e 6e 6f 74 20 68 61 76 65 20 69 6e s cannot have in
2be0: 74 65 72 6e 61 6c 0a 09 23 20 20 20 20 20 20 20 ternal..#
2bf0: 64 65 70 65 6e 64 65 6e 63 69 65 73 2c 20 61 73 dependencies, as
2c00: 20 74 68 61 74 20 6e 65 65 64 73 20 61 74 20 6c that needs at l
2c10: 65 61 73 74 20 74 77 6f 20 72 65 76 69 73 69 6f east two revisio
2c20: 6e 73 20 69 6e 0a 09 23 20 20 20 20 20 20 20 74 ns in..# t
2c30: 68 65 20 72 61 6e 67 65 2e 0a 0a 09 69 66 20 7b he range....if {
2c40: 5b 6c 6c 65 6e 67 74 68 20 24 72 61 6e 67 65 5d [llength $range]
2c50: 20 3c 20 32 7d 20 7b 20 72 65 74 75 72 6e 20 2d < 2} { return -
2c60: 31 20 7d 0a 0a 09 73 65 74 20 6d 61 78 20 2d 31 1 }...set max -1
2c70: 0a 09 73 65 74 20 62 65 73 74 20 7b 7d 0a 0a 09 ..set best {}...
2c80: 66 6f 72 65 61 63 68 20 6c 6f 63 61 74 69 6f 6e foreach location
2c90: 20 24 72 61 6e 67 65 20 7b 0a 09 20 20 20 20 73 $range {.. s
2ca0: 65 74 20 63 72 6f 73 73 69 6e 67 73 20 24 63 72 et crossings $cr
2cb0: 6f 73 73 28 24 6c 6f 63 61 74 69 6f 6e 29 0a 09 oss($location)..
2cc0: 20 20 20 20 69 66 20 7b 24 63 72 6f 73 73 69 6e if {$crossin
2cd0: 67 73 20 3e 20 24 6d 61 78 7d 20 7b 0a 09 09 73 gs > $max} {...s
2ce0: 65 74 20 6d 61 78 20 20 24 63 72 6f 73 73 69 6e et max $crossin
2cf0: 67 73 0a 09 09 73 65 74 20 62 65 73 74 20 5b 6c gs...set best [l
2d00: 69 73 74 20 24 6c 6f 63 61 74 69 6f 6e 5d 0a 09 ist $location]..
2d10: 09 63 6f 6e 74 69 6e 75 65 0a 09 20 20 20 20 7d .continue.. }
2d20: 20 65 6c 73 65 69 66 20 7b 24 63 72 6f 73 73 69 elseif {$crossi
2d30: 6e 67 73 20 3d 3d 20 24 6d 61 78 7d 20 7b 0a 09 ngs == $max} {..
2d40: 09 6c 61 70 70 65 6e 64 20 62 65 73 74 20 24 6c .lappend best $l
2d50: 6f 63 61 74 69 6f 6e 0a 09 20 20 20 20 7d 0a 09 ocation.. }..
2d60: 7d 0a 0a 09 69 66 20 7b 24 6d 61 78 20 3d 3d 20 }...if {$max ==
2d70: 30 7d 20 20 20 20 20 20 20 20 20 20 20 20 7b 20 0} {
2d80: 72 65 74 75 72 6e 20 2d 31 20 7d 0a 09 69 66 20 return -1 }..if
2d90: 7b 5b 6c 6c 65 6e 67 74 68 20 24 62 65 73 74 5d {[llength $best]
2da0: 20 3d 3d 20 31 7d 20 7b 20 72 65 74 75 72 6e 20 == 1} { return
2db0: 5b 6c 69 6e 64 65 78 20 24 62 65 73 74 20 30 5d [lindex $best 0]
2dc0: 20 7d 0a 0a 09 73 65 74 20 6c 6f 63 61 74 69 6f }...set locatio
2dd0: 6e 73 20 24 62 65 73 74 0a 09 73 65 74 20 62 65 ns $best..set be
2de0: 73 74 20 7b 7d 0a 09 73 65 74 20 6d 69 6e 20 2d st {}..set min -
2df0: 31 0a 0a 09 66 6f 72 65 61 63 68 20 6c 6f 63 61 1...foreach loca
2e00: 74 69 6f 6e 20 24 6c 6f 63 61 74 69 6f 6e 73 20 tion $locations
2e10: 7b 0a 09 20 20 20 20 73 65 74 20 69 6e 74 65 72 {.. set inter
2e20: 76 61 6c 20 24 64 65 6c 74 61 28 24 6c 6f 63 61 val $delta($loca
2e30: 74 69 6f 6e 29 0a 09 20 20 20 20 69 66 20 7b 28 tion).. if {(
2e40: 24 6d 69 6e 20 3c 20 30 29 20 7c 7c 20 28 24 69 $min < 0) || ($i
2e50: 6e 74 65 72 76 61 6c 20 3c 20 24 6d 69 6e 29 7d nterval < $min)}
2e60: 20 7b 0a 09 09 73 65 74 20 6d 69 6e 20 20 24 69 {...set min $i
2e70: 6e 74 65 72 76 61 6c 0a 09 09 73 65 74 20 62 65 nterval...set be
2e80: 73 74 20 5b 6c 69 73 74 20 24 6c 6f 63 61 74 69 st [list $locati
2e90: 6f 6e 5d 0a 09 20 20 20 20 7d 20 65 6c 73 65 69 on].. } elsei
2ea0: 66 20 7b 24 69 6e 74 65 72 76 61 6c 20 3d 3d 20 f {$interval ==
2eb0: 24 6d 69 6e 7d 20 7b 0a 09 09 6c 61 70 70 65 6e $min} {...lappen
2ec0: 64 20 62 65 73 74 20 24 6c 6f 63 61 74 69 6f 6e d best $location
2ed0: 0a 09 20 20 20 20 7d 0a 09 7d 0a 0a 09 69 66 20 .. }..}...if
2ee0: 7b 5b 6c 6c 65 6e 67 74 68 20 24 62 65 73 74 5d {[llength $best]
2ef0: 20 3d 3d 20 31 7d 20 7b 20 72 65 74 75 72 6e 20 == 1} { return
2f00: 5b 6c 69 6e 64 65 78 20 24 62 65 73 74 20 30 5d [lindex $best 0]
2f10: 20 7d 0a 0a 09 72 65 74 75 72 6e 20 5b 6c 69 6e }...return [lin
2f20: 64 65 78 20 5b 6c 73 6f 72 74 20 2d 69 6e 74 65 dex [lsort -inte
2f30: 67 65 72 20 2d 69 6e 63 72 65 61 73 69 6e 67 20 ger -increasing
2f40: 24 62 65 73 74 5d 20 30 5d 0a 20 20 20 20 7d 0a $best] 0]. }.
2f50: 0a 20 20 20 20 70 72 6f 63 20 43 75 74 41 74 20 . proc CutAt
2f60: 7b 6c 6f 63 61 74 69 6f 6e 7d 20 7b 0a 09 75 70 {location} {..up
2f70: 76 61 72 20 31 20 63 72 6f 73 73 20 63 72 6f 73 var 1 cross cros
2f80: 73 20 64 65 70 63 20 64 65 70 63 0a 0a 09 23 20 s depc depc...#
2f90: 49 74 20 77 61 73 20 64 65 63 69 64 65 64 20 74 It was decided t
2fa0: 6f 20 73 70 6c 69 74 20 74 68 65 20 63 68 61 6e o split the chan
2fb0: 67 65 73 65 74 20 61 74 20 74 68 65 20 67 69 76 geset at the giv
2fc0: 65 6e 0a 09 23 20 6c 6f 63 61 74 69 6f 6e 2e 20 en..# location.
2fd0: 54 68 69 73 20 63 75 74 73 20 61 20 6e 75 6d 62 This cuts a numb
2fe0: 65 72 20 6f 66 20 64 65 70 65 6e 64 65 6e 63 69 er of dependenci
2ff0: 65 73 2e 20 48 65 72 65 20 77 65 20 75 70 64 61 es. Here we upda
3000: 74 65 0a 09 23 20 74 68 65 20 63 72 6f 73 73 20 te..# the cross
3010: 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 73 6f 20 74 information so t
3020: 68 61 74 20 74 68 65 20 62 72 65 61 6b 20 66 69 hat the break fi
3030: 6e 64 65 72 20 68 61 73 20 61 63 63 75 72 61 74 nder has accurat
3040: 65 0a 09 23 20 64 61 74 61 20 77 68 65 6e 20 77 e..# data when w
3050: 65 20 6c 6f 6f 6b 20 61 74 20 74 68 65 20 67 65 e look at the ge
3060: 6e 65 72 61 74 65 64 20 66 72 61 67 6d 65 6e 74 nerated fragment
3070: 73 2e 0a 0a 09 73 65 74 20 73 69 78 20 5b 6c 6f s....set six [lo
3080: 67 20 76 69 73 69 62 6c 65 3f 20 36 5d 0a 0a 09 g visible? 6]...
3090: 66 6f 72 65 61 63 68 20 7b 64 65 70 20 72 61 6e foreach {dep ran
30a0: 67 65 7d 20 5b 61 72 72 61 79 20 67 65 74 20 64 ge} [array get d
30b0: 65 70 63 5d 20 7b 0a 09 20 20 20 20 23 20 43 68 epc] {.. # Ch
30c0: 65 63 6b 20 61 6c 6c 20 64 65 70 65 6e 64 65 6e eck all dependen
30d0: 63 69 65 73 20 73 74 69 6c 6c 20 6b 6e 6f 77 6e cies still known
30e0: 2c 20 74 61 6b 65 20 74 68 65 69 72 20 72 61 6e , take their ran
30f0: 67 65 20 61 6e 64 0a 09 20 20 20 20 23 20 73 65 ge and.. # se
3100: 65 20 69 66 20 74 68 65 20 62 72 65 61 6b 20 6c e if the break l
3110: 6f 63 61 74 69 6f 6e 20 66 61 6c 6c 73 20 77 69 ocation falls wi
3120: 74 68 69 6e 2e 0a 0a 09 20 20 20 20 42 6f 72 64 thin.... Bord
3130: 65 72 20 24 72 61 6e 67 65 20 73 20 65 0a 09 20 er $range s e..
3140: 20 20 20 69 66 20 7b 24 6c 6f 63 61 74 69 6f 6e if {$location
3150: 20 3c 20 24 73 7d 20 63 6f 6e 74 69 6e 75 65 20 < $s} continue
3160: 3b 20 23 20 62 72 65 61 6b 20 62 65 66 6f 72 65 ; # break before
3170: 20 72 61 6e 67 65 2c 20 69 67 6e 6f 72 65 0a 09 range, ignore..
3180: 20 20 20 20 69 66 20 7b 24 6c 6f 63 61 74 69 6f if {$locatio
3190: 6e 20 3e 20 24 65 7d 20 63 6f 6e 74 69 6e 75 65 n > $e} continue
31a0: 20 3b 20 23 20 62 72 65 61 6b 20 61 66 74 65 72 ; # break after
31b0: 20 72 61 6e 67 65 2c 20 69 67 6e 6f 72 65 2e 0a range, ignore..
31c0: 0a 09 20 20 20 20 23 20 54 68 69 73 20 64 65 70 .. # This dep
31d0: 65 6e 64 65 6e 63 79 20 63 72 6f 73 73 65 73 20 endency crosses
31e0: 74 68 65 20 62 72 65 61 6b 20 6c 6f 63 61 74 69 the break locati
31f0: 6f 6e 2e 20 57 65 20 72 65 6d 6f 76 65 20 69 74 on. We remove it
3200: 0a 09 20 20 20 20 23 20 66 72 6f 6d 20 74 68 65 .. # from the
3210: 20 63 72 6f 73 73 69 6e 67 73 20 63 6f 75 6e 74 crossings count
3220: 65 72 73 2c 20 61 6e 64 20 74 68 65 6e 20 61 6c ers, and then al
3230: 73 6f 20 66 72 6f 6d 20 74 68 65 20 73 65 74 0a so from the set.
3240: 09 20 20 20 20 23 20 6f 66 20 6b 6e 6f 77 6e 20 . # of known
3250: 64 65 70 65 6e 64 65 6e 63 69 65 73 2c 20 61 73 dependencies, as
3260: 20 77 65 20 61 72 65 20 64 6f 6e 65 20 77 69 74 we are done wit
3270: 68 20 69 74 2e 0a 0a 09 20 20 20 20 66 6f 72 65 h it.... fore
3280: 61 63 68 20 6c 6f 63 20 24 64 65 70 63 28 24 64 ach loc $depc($d
3290: 65 70 29 20 7b 20 69 6e 63 72 20 63 72 6f 73 73 ep) { incr cross
32a0: 28 24 6c 6f 63 29 20 2d 31 20 7d 0a 09 20 20 20 ($loc) -1 }..
32b0: 20 75 6e 73 65 74 20 64 65 70 63 28 24 64 65 70 unset depc($dep
32c0: 29 0a 0a 09 20 20 20 20 69 66 20 7b 21 24 73 69 )... if {!$si
32d0: 78 7d 20 63 6f 6e 74 69 6e 75 65 0a 0a 09 20 20 x} continue...
32e0: 20 20 73 74 72 75 63 74 3a 3a 6c 69 73 74 20 61 struct::list a
32f0: 73 73 69 67 6e 20 24 64 65 70 20 70 61 72 65 6e ssign $dep paren
3300: 74 20 63 68 69 6c 64 0a 09 20 20 20 20 6c 6f 67 t child.. log
3310: 20 77 72 69 74 65 20 36 20 63 73 65 74 73 20 22 write 6 csets "
3320: 42 72 6f 6b 65 20 64 65 70 65 6e 64 65 6e 63 79 Broke dependency
3330: 20 5b 50 44 20 24 70 61 72 65 6e 74 5d 20 2d 2d [PD $parent] --
3340: 3e 20 5b 50 44 20 24 63 68 69 6c 64 5d 22 0a 09 > [PD $child]"..
3350: 7d 0a 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 7d }...return. }
3360: 0a 0a 20 20 20 20 23 20 50 72 69 6e 74 20 69 64 .. # Print id
3370: 65 6e 74 69 66 79 69 6e 67 20 64 61 74 61 20 66 entifying data f
3380: 6f 72 20 61 20 72 65 76 69 73 69 6f 6e 20 28 70 or a revision (p
3390: 72 6f 6a 65 63 74 2c 20 66 69 6c 65 2c 20 64 6f roject, file, do
33a0: 74 74 65 64 20 72 65 76 0a 20 20 20 20 23 20 6e tted rev. # n
33b0: 75 6d 62 65 72 29 2c 20 66 6f 72 20 68 69 67 68 umber), for high
33c0: 20 76 65 72 62 6f 73 69 74 79 20 6c 6f 67 20 6f verbosity log o
33d0: 75 74 70 75 74 2e 0a 0a 20 20 20 20 70 72 6f 63 utput... proc
33e0: 20 50 44 20 7b 69 64 7d 20 7b 0a 09 66 6f 72 65 PD {id} {..fore
33f0: 61 63 68 20 7b 70 20 66 20 72 7d 20 5b 73 74 61 ach {p f r} [sta
3400: 74 65 20 72 75 6e 20 7b 0a 09 09 53 45 4c 45 43 te run {...SELEC
3410: 54 20 50 2e 6e 61 6d 65 20 2c 20 46 2e 6e 61 6d T P.name , F.nam
3420: 65 2c 20 52 2e 72 65 76 0a 09 09 46 52 4f 4d 20 e, R.rev...FROM
3430: 72 65 76 69 73 69 6f 6e 20 52 2c 20 66 69 6c 65 revision R, file
3440: 20 46 2c 20 70 72 6f 6a 65 63 74 20 50 0a 09 09 F, project P...
3450: 57 48 45 52 45 20 52 2e 72 69 64 20 3d 20 24 69 WHERE R.rid = $i
3460: 64 0a 09 09 41 4e 44 20 20 20 52 2e 66 69 64 20 d...AND R.fid
3470: 3d 20 46 2e 66 69 64 0a 09 09 41 4e 44 20 20 20 = F.fid...AND
3480: 46 2e 70 69 64 20 3d 20 50 2e 70 69 64 0a 09 7d F.pid = P.pid..}
3490: 5d 20 62 72 65 61 6b 0a 09 72 65 74 75 72 6e 20 ] break..return
34a0: 22 27 24 70 20 3a 20 24 66 2f 24 72 27 22 0a 20 "'$p : $f/$r'".
34b0: 20 20 20 7d 0a 0a 20 20 20 20 23 20 50 72 69 6e }.. # Prin
34c0: 74 69 6e 67 20 6f 6e 65 20 6f 72 20 6d 6f 72 65 ting one or more
34d0: 20 72 61 6e 67 65 73 2c 20 66 6f 72 6d 61 74 74 ranges, formatt
34e0: 65 64 2c 20 61 6e 64 20 6f 6e 6c 79 20 74 68 65 ed, and only the
34f0: 69 72 20 62 6f 72 64 65 72 20 74 6f 0a 20 20 20 ir border to.
3500: 20 23 20 6b 65 65 70 20 74 68 65 20 73 74 72 69 # keep the stri
3510: 6e 67 73 20 73 68 6f 72 74 2e 0a 0a 20 20 20 20 ngs short...
3520: 70 72 6f 63 20 50 52 73 20 7b 72 61 6e 67 65 73 proc PRs {ranges
3530: 7d 20 7b 0a 09 72 65 74 75 72 6e 20 5b 73 74 72 } {..return [str
3540: 75 63 74 3a 3a 6c 69 73 74 20 6d 61 70 20 24 72 uct::list map $r
3550: 61 6e 67 65 73 20 5b 6d 79 70 72 6f 63 20 50 52 anges [myproc PR
3560: 5d 5d 0a 20 20 20 20 7d 0a 0a 20 20 20 20 70 72 ]]. }.. pr
3570: 6f 63 20 50 52 20 7b 72 61 6e 67 65 7d 20 7b 0a oc PR {range} {.
3580: 09 42 6f 72 64 65 72 20 24 72 61 6e 67 65 20 73 .Border $range s
3590: 20 65 0a 09 72 65 74 75 72 6e 20 3c 24 7b 73 7d e..return <${s}
35a0: 2e 2e 2e 24 7b 65 7d 3e 0a 20 20 20 20 7d 0a 0a ...${e}>. }..
35b0: 20 20 20 20 70 72 6f 63 20 42 6f 72 64 65 72 20 proc Border
35c0: 7b 72 61 6e 67 65 20 73 76 20 65 76 7d 20 7b 0a {range sv ev} {.
35d0: 09 75 70 76 61 72 20 31 20 24 73 76 20 73 20 24 .upvar 1 $sv s $
35e0: 65 76 20 65 0a 09 73 65 74 20 73 20 5b 6c 69 6e ev e..set s [lin
35f0: 64 65 78 20 24 72 61 6e 67 65 20 30 5d 0a 09 73 dex $range 0]..s
3600: 65 74 20 65 20 5b 6c 69 6e 64 65 78 20 24 72 61 et e [lindex $ra
3610: 6e 67 65 20 65 6e 64 5d 0a 09 72 65 74 75 72 6e nge end]..return
3620: 0a 20 20 20 20 7d 0a 0a 20 20 20 20 23 20 23 20 . }.. # #
3630: 23 23 20 23 23 23 20 23 23 23 23 23 20 23 23 23 ## ### ##### ###
3640: 23 23 23 23 23 20 23 23 23 23 23 23 23 23 23 23 ##### ##########
3650: 23 23 23 0a 20 20 20 20 23 23 20 43 6f 6e 66 69 ###. ## Confi
3660: 67 75 72 61 74 69 6f 6e 0a 0a 20 20 20 20 70 72 guration.. pr
3670: 61 67 6d 61 20 2d 68 61 73 74 79 70 65 69 6e 66 agma -hastypeinf
3680: 6f 20 20 20 20 6e 6f 20 20 3b 20 23 20 6e 6f 20 o no ; # no
3690: 74 79 70 65 20 69 6e 74 72 6f 73 70 65 63 74 69 type introspecti
36a0: 6f 6e 0a 20 20 20 20 70 72 61 67 6d 61 20 2d 68 on. pragma -h
36b0: 61 73 69 6e 66 6f 20 20 20 20 20 20 20 20 6e 6f asinfo no
36c0: 20 20 3b 20 23 20 6e 6f 20 6f 62 6a 65 63 74 20 ; # no object
36d0: 69 6e 74 72 6f 73 70 65 63 74 69 6f 6e 0a 20 20 introspection.
36e0: 20 20 70 72 61 67 6d 61 20 2d 73 69 6d 70 6c 65 pragma -simple
36f0: 64 69 73 70 61 74 63 68 20 79 65 73 20 3b 20 23 dispatch yes ; #
3700: 20 73 69 6d 70 6c 65 20 66 61 73 74 20 64 69 73 simple fast dis
3710: 70 61 74 63 68 0a 0a 20 20 20 20 23 20 23 20 23 patch.. # # #
3720: 23 20 23 23 23 20 23 23 23 23 23 20 23 23 23 23 # ### ##### ####
3730: 23 23 23 23 20 23 23 23 23 23 23 23 23 23 23 23 #### ###########
3740: 23 23 0a 7d 0a 0a 6e 61 6d 65 73 70 61 63 65 20 ##.}..namespace
3750: 65 76 61 6c 20 3a 3a 76 63 3a 3a 66 6f 73 73 69 eval ::vc::fossi
3760: 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a l::import::cvs::
3770: 70 72 6f 6a 65 63 74 20 7b 0a 20 20 20 20 6e 61 project {. na
3780: 6d 65 73 70 61 63 65 20 65 78 70 6f 72 74 20 72 mespace export r
3790: 65 76 0a 20 20 20 20 6e 61 6d 65 73 70 61 63 65 ev. namespace
37a0: 20 65 76 61 6c 20 72 65 76 20 7b 0a 09 6e 61 6d eval rev {..nam
37b0: 65 73 70 61 63 65 20 69 6d 70 6f 72 74 20 3a 3a espace import ::
37c0: 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f vc::fossil::impo
37d0: 72 74 3a 3a 63 76 73 3a 3a 73 74 61 74 65 0a 09 rt::cvs::state..
37e0: 6e 61 6d 65 73 70 61 63 65 20 69 6d 70 6f 72 74 namespace import
37f0: 20 3a 3a 76 63 3a 3a 74 6f 6f 6c 73 3a 3a 6d 69 ::vc::tools::mi
3800: 73 63 3a 3a 2a 0a 09 6e 61 6d 65 73 70 61 63 65 sc::*..namespace
3810: 20 69 6d 70 6f 72 74 20 3a 3a 76 63 3a 3a 74 6f import ::vc::to
3820: 6f 6c 73 3a 3a 74 72 6f 75 62 6c 65 0a 09 6e 61 ols::trouble..na
3830: 6d 65 73 70 61 63 65 20 69 6d 70 6f 72 74 20 3a mespace import :
3840: 3a 76 63 3a 3a 74 6f 6f 6c 73 3a 3a 6c 6f 67 0a :vc::tools::log.
3850: 09 6c 6f 67 20 72 65 67 69 73 74 65 72 20 63 73 .log register cs
3860: 65 74 73 0a 20 20 20 20 7d 0a 7d 0a 0a 23 20 23 ets. }.}..# #
3870: 20 23 23 20 23 23 23 20 23 23 23 23 23 20 23 23 ## ### ##### ##
3880: 23 23 23 23 23 23 20 23 23 23 23 23 23 23 23 23 ###### #########
3890: 23 23 23 23 20 23 23 23 23 23 23 23 23 23 23 23 #### ###########
38a0: 23 23 23 23 23 23 23 23 23 23 0a 23 23 20 52 65 ##########.## Re
38b0: 61 64 79 0a 0a 70 61 63 6b 61 67 65 20 70 72 6f ady..package pro
38c0: 76 69 64 65 20 76 63 3a 3a 66 6f 73 73 69 6c 3a vide vc::fossil:
38d0: 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 70 72 :import::cvs::pr
38e0: 6f 6a 65 63 74 3a 3a 72 65 76 20 31 2e 30 0a 72 oject::rev 1.0.r
38f0: 65 74 75 72 6e 0a eturn.