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 0a 09 23 20 4b 65 65 70 20 74 72 61 ons...# Keep tra
0610: 63 6b 20 6f 66 20 74 68 65 20 67 65 6e 65 72 61 ck of the genera
0620: 74 65 64 20 63 68 61 6e 67 65 73 65 74 73 2e 0a ted changesets..
0630: 09 6c 61 70 70 65 6e 64 20 6d 79 63 68 61 6e 67 .lappend mychang
0640: 65 73 65 74 73 20 24 73 65 6c 66 0a 09 72 65 74 esets $self..ret
0650: 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 6d urn. }.. m
0660: 65 74 68 6f 64 20 69 64 20 7b 7d 20 7b 20 72 65 ethod id {} { re
0670: 74 75 72 6e 20 24 6d 79 69 64 20 7d 0a 20 20 20 turn $myid }.
0680: 20 6d 65 74 68 6f 64 20 73 65 74 69 64 20 7b 69 method setid {i
0690: 64 7d 20 7b 20 73 65 74 20 6d 79 69 64 20 24 69 d} { set myid $i
06a0: 64 20 3b 20 72 65 74 75 72 6e 20 7d 0a 0a 20 20 d ; return }..
06b0: 20 20 6d 65 74 68 6f 64 20 62 72 65 61 6b 69 6e method breakin
06c0: 74 65 72 6e 61 6c 64 65 70 65 6e 64 65 6e 63 69 ternaldependenci
06d0: 65 73 20 7b 7d 20 7b 0a 09 23 20 54 68 69 73 20 es {} {..# This
06e0: 6d 65 74 68 6f 64 20 69 6e 73 70 65 63 74 73 20 method inspects
06f0: 74 68 65 20 63 68 61 6e 67 65 73 65 74 73 20 66 the changesets f
0700: 6f 72 20 69 6e 74 65 72 6e 61 6c 0a 09 23 20 64 or internal..# d
0710: 65 70 65 6e 64 65 6e 63 69 65 73 2e 20 4e 6f 74 ependencies. Not
0720: 68 69 6e 67 20 69 73 20 64 6f 6e 65 20 69 66 20 hing is done if
0730: 74 68 65 72 65 20 61 72 65 20 6e 6f 0a 09 23 20 there are no..#
0740: 73 75 63 68 2e 20 4f 74 68 65 72 77 69 73 65 20 such. Otherwise
0750: 74 68 65 20 63 68 61 6e 67 65 73 65 74 20 69 73 the changeset is
0760: 20 73 70 6c 69 74 20 69 6e 74 6f 20 61 20 73 65 split into a se
0770: 74 20 6f 66 0a 09 23 20 66 72 61 67 6d 65 6e 74 t of..# fragment
0780: 73 20 77 69 74 68 6f 75 74 20 69 6e 74 65 72 6e s without intern
0790: 61 6c 20 64 65 70 65 6e 64 65 6e 63 69 65 73 2c al dependencies,
07a0: 20 74 72 61 6e 73 66 6f 72 6d 69 6e 67 20 74 68 transforming th
07b0: 65 0a 09 23 20 69 6e 74 65 72 6e 61 6c 20 64 65 e..# internal de
07c0: 70 65 6e 64 65 6e 63 69 65 73 20 69 6e 74 6f 20 pendencies into
07d0: 65 78 74 65 72 6e 61 6c 20 6f 6e 65 73 2e 20 54 external ones. T
07e0: 68 65 20 6e 65 77 20 63 68 61 6e 67 65 73 65 74 he new changeset
07f0: 73 0a 09 23 20 61 72 65 20 61 64 64 65 64 20 74 s..# are added t
0800: 6f 20 74 68 65 20 6c 69 73 74 20 6f 66 20 61 6c o the list of al
0810: 6c 20 63 68 61 6e 67 65 73 65 74 73 2e 0a 0a 09 l changesets....
0820: 23 20 57 65 20 70 65 72 66 6f 72 6d 20 61 6c 6c # We perform all
0830: 20 6e 65 63 65 73 73 61 72 79 20 73 70 6c 69 74 necessary split
0840: 73 20 69 6e 20 6f 6e 65 20 67 6f 2c 20 69 6e 73 s in one go, ins
0850: 74 65 61 64 20 6f 66 20 6f 6e 6c 79 0a 09 23 20 tead of only..#
0860: 6f 6e 65 2e 20 54 68 65 20 70 72 65 76 69 6f 75 one. The previou
0870: 73 20 61 6c 67 6f 72 69 74 68 6d 2c 20 61 64 61 s algorithm, ada
0880: 70 74 65 64 20 66 72 6f 6d 20 63 76 73 32 73 76 pted from cvs2sv
0890: 6e 2c 20 63 6f 6d 70 75 74 65 64 0a 09 23 20 61 n, computed..# a
08a0: 20 6c 6f 74 20 6f 66 20 73 74 61 74 65 20 77 68 lot of state wh
08b0: 69 63 68 20 77 61 73 20 74 68 72 6f 77 6e 20 61 ich was thrown a
08c0: 77 61 79 20 61 6e 64 20 74 68 65 6e 20 63 6f 6d way and then com
08d0: 70 75 74 65 64 20 61 67 61 69 6e 0a 09 23 20 66 puted again..# f
08e0: 6f 72 20 65 61 63 68 20 6f 66 20 74 68 65 20 66 or each of the f
08f0: 72 61 67 6d 65 6e 74 73 2e 20 49 74 20 73 68 6f ragments. It sho
0900: 75 6c 64 20 62 65 20 65 61 73 69 65 72 20 74 6f uld be easier to
0910: 20 75 70 64 61 74 65 20 61 6e 64 0a 09 23 20 72 update and..# r
0920: 65 75 73 65 20 74 68 61 74 20 73 74 61 74 65 2e euse that state.
0930: 0a 0a 09 23 20 54 68 65 20 63 6f 64 65 20 63 68 ...# The code ch
0940: 65 63 6b 73 20 6f 6e 6c 79 20 73 75 63 65 73 73 ecks only sucess
0950: 6f 72 20 64 65 70 65 6e 64 65 6e 63 69 65 73 2c or dependencies,
0960: 20 61 73 20 74 68 69 73 0a 09 23 20 61 75 74 6f as this..# auto
0970: 6d 61 74 69 63 61 6c 6c 79 20 63 6f 76 65 72 73 matically covers
0980: 20 74 68 65 20 70 72 65 64 65 63 65 73 73 6f 72 the predecessor
0990: 20 64 65 70 65 6e 64 65 6e 63 69 65 73 20 61 73 dependencies as
09a0: 20 77 65 6c 6c 20 28 41 0a 09 23 20 73 75 63 63 well (A..# succ
09b0: 65 73 73 6f 72 20 64 65 70 65 6e 64 65 6e 63 79 essor dependency
09c0: 20 61 20 2d 3e 20 62 20 69 73 20 61 6c 73 6f 20 a -> b is also
09d0: 61 20 70 72 65 64 65 63 65 73 73 6f 72 20 64 65 a predecessor de
09e0: 70 65 6e 64 65 6e 63 79 0a 09 23 20 62 20 2d 3e pendency..# b ->
09f0: 20 61 29 2e 0a 0a 09 23 20 41 72 72 61 79 20 6f a)....# Array o
0a00: 66 20 64 65 70 65 6e 64 65 6e 63 69 65 73 20 28 f dependencies (
0a10: 70 61 72 65 6e 74 20 2d 3e 20 63 68 69 6c 64 29 parent -> child)
0a20: 2e 20 54 68 69 73 20 69 73 20 70 75 6c 6c 65 64 . This is pulled
0a30: 20 66 72 6f 6d 0a 09 23 20 74 68 65 20 73 74 61 from..# the sta
0a40: 74 65 2c 20 61 6e 64 20 6c 69 6d 69 74 65 64 20 te, and limited
0a50: 74 6f 20 73 75 63 63 65 73 73 6f 72 73 20 77 69 to successors wi
0a60: 74 68 69 6e 20 74 68 65 20 63 68 61 6e 67 65 73 thin the changes
0a70: 65 74 2e 0a 0a 09 61 72 72 61 79 20 73 65 74 20 et....array set
0a80: 64 65 70 65 6e 64 65 6e 63 69 65 73 20 7b 7d 0a dependencies {}.
0a90: 09 50 75 6c 6c 49 6e 74 65 72 6e 61 6c 44 65 70 .PullInternalDep
0aa0: 65 6e 64 65 6e 63 69 65 73 20 64 65 70 65 6e 64 endencies depend
0ab0: 65 6e 63 69 65 73 20 24 6d 79 72 65 76 69 73 69 encies $myrevisi
0ac0: 6f 6e 73 0a 09 69 66 20 7b 21 5b 61 72 72 61 79 ons..if {![array
0ad0: 20 73 69 7a 65 20 64 65 70 65 6e 64 65 6e 63 69 size dependenci
0ae0: 65 73 5d 7d 20 7b 72 65 74 75 72 6e 20 30 7d 20 es]} {return 0}
0af0: 3b 20 23 20 4e 6f 74 68 69 6e 67 20 74 6f 20 62 ; # Nothing to b
0b00: 72 65 61 6b 2e 0a 0a 09 6c 6f 67 20 77 72 69 74 reak....log writ
0b10: 65 20 36 20 63 73 65 74 73 20 2e 2e 2e 3c 24 6d e 6 csets ...<$m
0b20: 79 69 64 3e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e yid>............
0b30: 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e ................
0b40: 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e ................
0b50: 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 09 23 20 ..............#
0b60: 57 65 20 68 61 76 65 20 69 6e 74 65 72 6e 61 6c We have internal
0b70: 20 64 65 70 65 6e 64 65 6e 63 69 65 73 20 74 6f dependencies to
0b80: 20 62 72 65 61 6b 2e 20 57 65 20 6e 6f 77 20 69 break. We now i
0b90: 74 65 72 61 74 65 20 6f 76 65 72 0a 09 23 20 61 terate over..# a
0ba0: 6c 6c 20 70 6f 73 69 74 69 6f 6e 73 20 69 6e 20 ll positions in
0bb0: 74 68 65 20 6c 69 73 74 20 28 77 68 69 63 68 20 the list (which
0bc0: 69 73 20 63 68 72 6f 6e 6f 6c 6f 67 69 63 61 6c is chronological
0bd0: 2c 20 61 74 20 6c 65 61 73 74 0a 09 23 20 61 73 , at least..# as
0be0: 20 66 61 72 20 61 73 20 74 68 65 20 74 69 6d 65 far as the time
0bf0: 73 74 61 6d 70 73 20 61 72 65 20 63 6f 72 72 65 stamps are corre
0c00: 63 74 20 61 6e 64 20 75 6e 69 71 75 65 29 20 61 ct and unique) a
0c10: 6e 64 0a 09 23 20 64 65 74 65 72 6d 69 6e 65 20 nd..# determine
0c20: 74 68 65 20 62 65 73 74 20 70 6f 73 69 74 69 6f the best positio
0c30: 6e 20 66 6f 72 20 74 68 65 20 62 72 65 61 6b 2c n for the break,
0c40: 20 62 79 20 74 72 79 69 6e 67 20 74 6f 0a 09 23 by trying to..#
0c50: 20 62 72 65 61 6b 20 61 73 20 6d 61 6e 79 20 64 break as many d
0c60: 65 70 65 6e 64 65 6e 63 69 65 73 20 61 73 20 70 ependencies as p
0c70: 6f 73 73 69 62 6c 65 20 69 6e 20 6f 6e 65 20 67 ossible in one g
0c80: 6f 2e 20 57 68 65 6e 20 61 0a 09 23 20 62 72 65 o. When a..# bre
0c90: 61 6b 20 77 61 73 20 66 6f 75 6e 64 20 74 68 69 ak was found thi
0ca0: 73 20 69 73 20 72 65 64 6f 6e 65 20 66 6f 72 20 s is redone for
0cb0: 74 68 65 20 66 72 61 67 6d 65 6e 74 73 20 63 6f the fragments co
0cc0: 6d 69 6e 67 20 61 6e 64 0a 09 23 20 61 66 74 65 ming and..# afte
0cd0: 72 2c 20 61 66 74 65 72 20 75 70 64 69 6e 67 20 r, after upding
0ce0: 74 68 65 20 63 72 6f 73 73 69 6e 67 20 69 6e 66 the crossing inf
0cf0: 6f 72 6d 61 74 69 6f 6e 2e 0a 0a 09 23 20 44 61 ormation....# Da
0d00: 74 61 20 73 74 72 75 63 74 75 72 65 73 3a 0a 09 ta structures:..
0d10: 23 20 4d 61 70 3a 20 20 50 4f 53 20 20 20 72 65 # Map: POS re
0d20: 76 69 73 69 6f 6e 20 69 64 20 20 20 20 20 20 2d vision id -
0d30: 3e 20 70 6f 73 69 74 69 6f 6e 20 69 6e 20 6c 69 > position in li
0d40: 73 74 2e 0a 09 23 20 20 20 20 20 20 20 43 52 4f st...# CRO
0d50: 53 53 20 70 6f 73 69 74 69 6f 6e 20 69 6e 20 6c SS position in l
0d60: 69 73 74 20 2d 3e 20 6e 75 6d 62 65 72 20 6f 66 ist -> number of
0d70: 20 64 65 70 65 6e 64 65 6e 63 69 65 73 20 63 72 dependencies cr
0d80: 6f 73 73 69 6e 67 20 69 74 0a 09 23 20 20 20 20 ossing it..#
0d90: 20 20 20 44 45 50 43 20 20 64 65 70 65 6e 64 65 DEPC depende
0da0: 6e 63 79 20 20 20 20 20 20 20 2d 3e 20 70 6f 73 ncy -> pos
0db0: 69 74 69 6f 6e 73 20 69 74 20 63 72 6f 73 73 65 itions it crosse
0dc0: 73 0a 09 23 20 4c 69 73 74 3a 20 52 41 4e 47 45 s..# List: RANGE
0dd0: 20 4f 66 20 74 68 65 20 70 6f 73 69 74 69 6f 6e Of the position
0de0: 73 20 69 74 73 65 6c 66 2e 0a 09 23 20 41 20 64 s itself...# A d
0df0: 65 70 65 6e 64 65 6e 63 79 20 69 73 20 61 20 73 ependency is a s
0e00: 69 6e 67 6c 65 2d 65 6c 65 6d 65 6e 74 20 6d 61 ingle-element ma
0e10: 70 20 70 61 72 65 6e 74 20 2d 3e 20 63 68 69 6c p parent -> chil
0e20: 64 0a 0a 09 49 6e 69 74 69 61 6c 69 7a 65 42 72 d...InitializeBr
0e30: 65 61 6b 53 74 61 74 65 20 24 6d 79 72 65 76 69 eakState $myrevi
0e40: 73 69 6f 6e 73 0a 0a 09 73 65 74 20 66 72 61 67 sions...set frag
0e50: 6d 65 6e 74 73 20 7b 7d 0a 09 73 65 74 20 70 65 ments {}..set pe
0e60: 6e 64 69 6e 67 20 20 20 5b 6c 69 73 74 20 24 72 nding [list $r
0e70: 61 6e 67 65 5d 0a 09 73 65 74 20 61 74 20 20 20 ange]..set at
0e80: 20 20 20 20 20 30 0a 09 61 72 72 61 79 20 73 65 0..array se
0e90: 74 20 62 72 65 61 6b 73 20 7b 7d 0a 0a 09 77 68 t breaks {}...wh
0ea0: 69 6c 65 20 7b 24 61 74 20 3c 20 5b 6c 6c 65 6e ile {$at < [llen
0eb0: 67 74 68 20 24 70 65 6e 64 69 6e 67 5d 7d 20 7b gth $pending]} {
0ec0: 0a 09 20 20 20 20 73 65 74 20 63 75 72 72 65 6e .. set curren
0ed0: 74 20 5b 6c 69 6e 64 65 78 20 24 70 65 6e 64 69 t [lindex $pendi
0ee0: 6e 67 20 24 61 74 5d 0a 0a 09 20 20 20 20 6c 6f ng $at]... lo
0ef0: 67 20 77 72 69 74 65 20 36 20 63 73 65 74 73 20 g write 6 csets
0f00: 22 2e 20 2e 20 2e 2e 20 2e 2e 2e 20 2e 2e 2e 2e ". . .. ... ....
0f10: 2e 20 2e 2e 2e 2e 2e 2e 2e 2e 20 2e 2e 2e 2e 2e . ........ .....
0f20: 2e 2e 2e 2e 2e 2e 2e 2e 22 0a 09 20 20 20 20 6c ........".. l
0f30: 6f 67 20 77 72 69 74 65 20 36 20 63 73 65 74 73 og write 6 csets
0f40: 20 22 53 63 68 65 64 75 6c 65 64 20 20 20 5b 6a "Scheduled [j
0f50: 6f 69 6e 20 5b 50 52 73 20 5b 6c 72 61 6e 67 65 oin [PRs [lrange
0f60: 20 24 70 65 6e 64 69 6e 67 20 24 61 74 20 65 6e $pending $at en
0f70: 64 5d 5d 20 7b 20 7d 5d 22 0a 09 20 20 20 20 6c d]] { }]".. l
0f80: 6f 67 20 77 72 69 74 65 20 36 20 63 73 65 74 73 og write 6 csets
0f90: 20 22 43 6f 6e 73 69 64 65 72 69 6e 67 20 5b 50 "Considering [P
0fa0: 52 20 24 63 75 72 72 65 6e 74 5d 20 5c 5b 24 61 R $current] \[$a
0fb0: 74 2f 5b 6c 6c 65 6e 67 74 68 20 24 70 65 6e 64 t/[llength $pend
0fc0: 69 6e 67 5d 5c 5d 22 0a 0a 09 20 20 20 20 73 65 ing]\]"... se
0fd0: 74 20 62 65 73 74 20 5b 46 69 6e 64 42 65 73 74 t best [FindBest
0fe0: 42 72 65 61 6b 20 24 63 75 72 72 65 6e 74 5d 0a Break $current].
0ff0: 0a 09 20 20 20 20 69 66 20 7b 24 62 65 73 74 20 .. if {$best
1000: 3c 20 30 7d 20 7b 0a 09 09 23 20 54 68 65 20 69 < 0} {...# The i
1010: 6e 73 70 65 63 74 65 64 20 72 61 6e 67 65 20 68 nspected range h
1020: 61 73 20 6e 6f 20 69 6e 74 65 72 6e 61 6c 0a 09 as no internal..
1030: 09 23 20 64 65 70 65 6e 64 65 6e 63 69 65 73 2e .# dependencies.
1040: 20 54 68 69 73 20 69 73 20 61 20 63 6f 6d 70 6c This is a compl
1050: 65 74 65 20 66 72 61 67 6d 65 6e 74 2e 0a 09 09 ete fragment....
1060: 6c 61 70 70 65 6e 64 20 66 72 61 67 6d 65 6e 74 lappend fragment
1070: 73 20 24 63 75 72 72 65 6e 74 0a 0a 09 09 6c 6f s $current....lo
1080: 67 20 77 72 69 74 65 20 36 20 63 73 65 74 73 20 g write 6 csets
1090: 22 4e 6f 20 62 72 65 61 6b 73 2c 20 66 69 6e 61 "No breaks, fina
10a0: 6c 22 0a 09 20 20 20 20 7d 20 65 6c 73 65 20 7b l".. } else {
10b0: 0a 09 09 23 20 53 70 6c 69 74 20 74 68 65 20 72 ...# Split the r
10c0: 61 6e 67 65 20 61 6e 64 20 73 63 68 65 64 75 6c ange and schedul
10d0: 65 20 74 68 65 20 72 65 73 75 6c 74 69 6e 67 20 e the resulting
10e0: 66 72 61 67 6d 65 6e 74 73 0a 09 09 23 20 66 6f fragments...# fo
10f0: 72 20 66 75 72 74 68 65 72 20 69 6e 73 70 65 63 r further inspec
1100: 74 69 6f 6e 2e 20 52 65 6d 65 6d 62 65 72 20 74 tion. Remember t
1110: 68 65 20 6e 75 6d 62 65 72 20 6f 66 0a 09 09 23 he number of...#
1120: 20 64 65 70 65 6e 64 65 6e 63 69 65 73 20 63 75 dependencies cu
1130: 74 20 62 65 66 6f 72 65 20 77 65 20 72 65 6d 6f t before we remo
1140: 76 65 20 74 68 65 6d 20 66 72 6f 6d 0a 09 09 23 ve them from...#
1150: 20 63 6f 6e 73 69 64 65 72 61 74 69 6f 6e 2c 20 consideration,
1160: 66 6f 72 20 64 6f 63 75 6d 65 6e 74 61 74 69 6f for documentatio
1170: 6e 20 6c 61 74 65 72 2e 0a 0a 09 09 73 65 74 20 n later.....set
1180: 62 72 65 61 6b 73 28 24 62 65 73 74 29 20 24 63 breaks($best) $c
1190: 72 6f 73 73 28 24 62 65 73 74 29 0a 0a 09 09 6c ross($best)....l
11a0: 6f 67 20 77 72 69 74 65 20 36 20 63 73 65 74 73 og write 6 csets
11b0: 20 22 42 65 73 74 20 62 72 65 61 6b 20 40 20 24 "Best break @ $
11c0: 62 65 73 74 2c 20 63 75 74 73 20 5b 6e 73 70 20 best, cuts [nsp
11d0: 24 63 72 6f 73 73 28 24 62 65 73 74 29 20 64 65 $cross($best) de
11e0: 70 65 6e 64 65 6e 63 79 20 64 65 70 65 6e 64 65 pendency depende
11f0: 6e 63 69 65 73 5d 22 0a 0a 09 09 23 20 4e 6f 74 ncies]"....# Not
1200: 65 3a 20 54 68 65 20 76 61 6c 75 65 20 6f 66 20 e: The value of
1210: 62 65 73 74 20 69 73 20 61 6e 20 61 62 6f 6c 75 best is an abolu
1220: 74 65 20 6c 6f 63 61 74 69 6f 6e 20 69 6e 0a 09 te location in..
1230: 09 23 20 6d 79 72 65 76 69 73 69 6f 6e 73 2e 20 .# myrevisions.
1240: 55 73 65 20 74 68 65 20 73 74 61 72 74 20 6f 66 Use the start of
1250: 20 63 75 72 72 65 6e 74 20 74 6f 20 6d 61 6b 65 current to make
1260: 20 69 74 20 61 6e 0a 09 09 23 20 69 6e 64 65 78 it an...# index
1270: 20 61 62 73 6f 6c 75 74 65 20 74 6f 20 63 75 72 absolute to cur
1280: 72 65 6e 74 2e 0a 0a 09 09 73 65 74 20 62 72 65 rent.....set bre
1290: 6c 20 5b 65 78 70 72 20 7b 24 62 65 73 74 20 2d l [expr {$best -
12a0: 20 5b 6c 69 6e 64 65 78 20 24 63 75 72 72 65 6e [lindex $curren
12b0: 74 20 30 5d 7d 5d 0a 09 09 73 65 74 20 62 6e 65 t 0]}]...set bne
12c0: 78 74 20 24 62 72 65 6c 20 3b 20 69 6e 63 72 20 xt $brel ; incr
12d0: 62 6e 65 78 74 0a 09 09 73 65 74 20 66 72 61 67 bnext...set frag
12e0: 62 65 66 6f 72 65 20 5b 6c 72 61 6e 67 65 20 24 before [lrange $
12f0: 63 75 72 72 65 6e 74 20 30 20 24 62 72 65 6c 5d current 0 $brel]
1300: 0a 09 09 73 65 74 20 66 72 61 67 61 66 74 65 72 ...set fragafter
1310: 20 20 5b 6c 72 61 6e 67 65 20 24 63 75 72 72 65 [lrange $curre
1320: 6e 74 20 24 62 6e 65 78 74 20 65 6e 64 5d 0a 0a nt $bnext end]..
1330: 09 09 6c 6f 67 20 77 72 69 74 65 20 36 20 63 73 ..log write 6 cs
1340: 65 74 73 20 22 4e 65 77 20 70 69 65 63 65 73 20 ets "New pieces
1350: 20 5b 50 52 20 24 66 72 61 67 62 65 66 6f 72 65 [PR $fragbefore
1360: 5d 20 5b 50 52 20 24 66 72 61 67 61 66 74 65 72 ] [PR $fragafter
1370: 5d 22 0a 0a 09 09 69 66 20 7b 21 5b 6c 6c 65 6e ]"....if {![llen
1380: 67 74 68 20 24 66 72 61 67 62 65 66 6f 72 65 5d gth $fragbefore]
1390: 7d 20 7b 0a 09 09 20 20 20 20 74 72 6f 75 62 6c } {... troubl
13a0: 65 20 69 6e 74 65 72 6e 61 6c 20 22 54 72 69 65 e internal "Trie
13b0: 64 20 74 6f 20 73 70 6c 69 74 20 6f 66 66 20 61 d to split off a
13c0: 20 7a 65 72 6f 2d 6c 65 6e 67 74 68 20 66 72 61 zero-length fra
13d0: 67 6d 65 6e 74 20 61 74 20 74 68 65 20 62 65 67 gment at the beg
13e0: 69 6e 6e 69 6e 67 22 0a 09 09 7d 0a 09 09 69 66 inning"...}...if
13f0: 20 7b 21 5b 6c 6c 65 6e 67 74 68 20 24 66 72 61 {![llength $fra
1400: 67 61 66 74 65 72 5d 7d 20 7b 0a 09 09 20 20 20 gafter]} {...
1410: 20 74 72 6f 75 62 6c 65 20 69 6e 74 65 72 6e 61 trouble interna
1420: 6c 20 22 54 72 69 65 64 20 74 6f 20 73 70 6c 69 l "Tried to spli
1430: 74 20 6f 66 66 20 61 20 7a 65 72 6f 2d 6c 65 6e t off a zero-len
1440: 67 74 68 20 66 72 61 67 6d 65 6e 74 20 61 74 20 gth fragment at
1450: 74 68 65 20 65 6e 64 22 0a 09 09 7d 0a 0a 09 09 the end"...}....
1460: 6c 61 70 70 65 6e 64 20 70 65 6e 64 69 6e 67 20 lappend pending
1470: 24 66 72 61 67 62 65 66 6f 72 65 20 24 66 72 61 $fragbefore $fra
1480: 67 61 66 74 65 72 0a 09 09 43 75 74 41 74 20 24 gafter...CutAt $
1490: 62 65 73 74 0a 09 20 20 20 20 7d 0a 0a 09 20 20 best.. }...
14a0: 20 20 69 6e 63 72 20 61 74 0a 09 7d 0a 0a 09 6c incr at..}...l
14b0: 6f 67 20 77 72 69 74 65 20 36 20 63 73 65 74 73 og write 6 csets
14c0: 20 22 2e 20 2e 20 2e 2e 20 2e 2e 2e 20 2e 2e 2e ". . .. ... ...
14d0: 2e 2e 20 2e 2e 2e 2e 2e 2e 2e 2e 20 2e 2e 2e 2e .. ........ ....
14e0: 2e 2e 2e 2e 2e 2e 2e 2e 2e 22 0a 0a 09 23 20 43 ........."...# C
14f0: 72 65 61 74 65 20 63 68 61 6e 67 65 73 65 74 73 reate changesets
1500: 20 66 6f 72 20 74 68 65 20 66 72 61 67 6d 65 6e for the fragmen
1510: 74 73 2c 20 72 65 75 73 69 6e 67 20 74 68 65 20 ts, reusing the
1520: 63 75 72 72 65 6e 74 20 6f 6e 65 0a 09 23 20 66 current one..# f
1530: 6f 72 20 74 68 65 20 66 69 72 73 74 20 66 72 61 or the first fra
1540: 67 6d 65 6e 74 2e 20 57 65 20 73 6f 72 74 20 74 gment. We sort t
1550: 68 65 6d 20 69 6e 20 6f 72 64 65 72 20 74 6f 20 hem in order to
1560: 61 6c 6c 6f 77 0a 09 23 20 63 68 65 63 6b 69 6e allow..# checkin
1570: 67 20 66 6f 72 20 67 61 70 73 20 61 6e 64 20 6e g for gaps and n
1580: 69 63 65 20 6d 65 73 73 61 67 65 73 2e 0a 0a 09 ice messages....
1590: 73 65 74 20 66 72 61 67 6d 65 6e 74 73 20 5b 6c set fragments [l
15a0: 73 6f 72 74 20 2d 69 6e 64 65 78 20 30 20 2d 69 sort -index 0 -i
15b0: 6e 74 65 67 65 72 20 24 66 72 61 67 6d 65 6e 74 nteger $fragment
15c0: 73 5d 0a 0a 09 23 70 75 74 73 20 5c 74 2e 5b 6a s]...#puts \t.[j
15d0: 6f 69 6e 20 5b 50 52 73 20 24 66 72 61 67 6d 65 oin [PRs $fragme
15e0: 6e 74 73 5d 20 2e 5c 6e 5c 74 2e 5d 2e 0a 0a 09 nts] .\n\t.]....
15f0: 42 6f 72 64 65 72 20 5b 6c 69 6e 64 65 78 20 24 Border [lindex $
1600: 66 72 61 67 6d 65 6e 74 73 20 30 5d 20 66 69 72 fragments 0] fir
1610: 73 74 73 20 66 69 72 73 74 65 0a 0a 09 69 66 20 sts firste...if
1620: 7b 24 66 69 72 73 74 73 20 21 3d 20 30 7d 20 7b {$firsts != 0} {
1630: 0a 09 20 20 20 20 74 72 6f 75 62 6c 65 20 69 6e .. trouble in
1640: 74 65 72 6e 61 6c 20 22 42 61 64 20 66 72 61 67 ternal "Bad frag
1650: 6d 65 6e 74 20 73 74 61 72 74 20 40 20 24 66 69 ment start @ $fi
1660: 72 73 74 73 2c 20 67 61 70 2c 20 6f 72 20 62 65 rsts, gap, or be
1670: 66 6f 72 65 20 62 65 67 69 6e 6e 69 6e 67 20 6f fore beginning o
1680: 66 20 74 68 65 20 72 61 6e 67 65 22 0a 09 7d 0a f the range"..}.
1690: 0a 09 73 65 74 20 6c 61 73 74 65 20 24 66 69 72 ..set laste $fir
16a0: 73 74 65 0a 09 66 6f 72 65 61 63 68 20 66 72 61 ste..foreach fra
16b0: 67 6d 65 6e 74 20 5b 6c 72 61 6e 67 65 20 24 66 gment [lrange $f
16c0: 72 61 67 6d 65 6e 74 73 20 31 20 65 6e 64 5d 20 ragments 1 end]
16d0: 7b 0a 09 20 20 20 20 42 6f 72 64 65 72 20 24 66 {.. Border $f
16e0: 72 61 67 6d 65 6e 74 20 73 20 65 0a 09 20 20 20 ragment s e..
16f0: 20 69 66 20 7b 24 6c 61 73 74 65 20 21 3d 20 28 if {$laste != (
1700: 24 73 20 2d 20 31 29 7d 20 7b 0a 09 09 74 72 6f $s - 1)} {...tro
1710: 75 62 6c 65 20 69 6e 74 65 72 6e 61 6c 20 22 42 uble internal "B
1720: 61 64 20 66 72 61 67 6d 65 6e 74 20 62 6f 72 64 ad fragment bord
1730: 65 72 20 3c 24 6c 61 73 74 65 20 7c 20 24 73 3e er <$laste | $s>
1740: 2c 20 67 61 70 20 6f 72 20 6f 76 65 72 6c 61 70 , gap or overlap
1750: 22 0a 09 20 20 20 20 7d 0a 0a 09 20 20 20 20 73 ".. }... s
1760: 65 74 20 6e 65 77 20 5b 24 74 79 70 65 20 25 41 et new [$type %A
1770: 55 54 4f 25 20 24 6d 79 70 72 6f 6a 65 63 74 20 UTO% $myproject
1780: 24 6d 79 74 79 70 65 20 24 6d 79 73 72 63 69 64 $mytype $mysrcid
1790: 20 5b 6c 72 61 6e 67 65 20 24 6d 79 72 65 76 69 [lrange $myrevi
17a0: 73 69 6f 6e 73 20 24 73 20 24 65 5d 5d 0a 0a 20 sions $s $e]]..
17b0: 20 20 20 20 20 20 20 20 20 20 20 6c 6f 67 20 77 log w
17c0: 72 69 74 65 20 34 20 63 73 65 74 73 20 22 42 72 rite 4 csets "Br
17d0: 65 61 6b 69 6e 67 20 3c 24 6d 79 69 64 3e 20 40 eaking <$myid> @
17e0: 20 24 6c 61 73 74 65 2c 20 6e 65 77 20 3c 5b 24 $laste, new <[$
17f0: 6e 65 77 20 69 64 5d 3e 2c 20 63 75 74 74 69 6e new id]>, cuttin
1800: 67 20 24 62 72 65 61 6b 73 28 24 6c 61 73 74 65 g $breaks($laste
1810: 29 22 0a 0a 09 20 20 20 20 73 65 74 20 6c 61 73 )"... set las
1820: 74 65 20 24 65 0a 09 7d 0a 0a 09 69 66 20 7b 24 te $e..}...if {$
1830: 6c 61 73 74 65 20 21 3d 20 28 5b 6c 6c 65 6e 67 laste != ([lleng
1840: 74 68 20 24 6d 79 72 65 76 69 73 69 6f 6e 73 5d th $myrevisions]
1850: 2d 31 29 7d 20 7b 0a 09 20 20 20 20 74 72 6f 75 -1)} {.. trou
1860: 62 6c 65 20 69 6e 74 65 72 6e 61 6c 20 22 42 61 ble internal "Ba
1870: 64 20 66 72 61 67 6d 65 6e 74 20 65 6e 64 20 40 d fragment end @
1880: 20 24 6c 61 73 74 65 2c 20 67 61 70 2c 20 6f 72 $laste, gap, or
1890: 20 62 65 79 6f 6e 64 20 65 6e 64 20 6f 66 20 74 beyond end of t
18a0: 68 65 20 72 61 6e 67 65 22 0a 09 7d 0a 0a 09 23 he range"..}...#
18b0: 20 50 75 74 20 74 68 65 20 66 69 72 73 74 20 66 Put the first f
18c0: 72 61 67 6d 65 6e 74 20 69 6e 74 6f 20 74 68 65 ragment into the
18d0: 20 63 75 72 72 65 6e 74 20 63 68 61 6e 67 65 73 current changes
18e0: 65 74 2e 0a 09 73 65 74 20 6d 79 72 65 76 69 73 et...set myrevis
18f0: 69 6f 6e 73 20 5b 6c 72 61 6e 67 65 20 24 6d 79 ions [lrange $my
1900: 72 65 76 69 73 69 6f 6e 73 20 30 20 24 66 69 72 revisions 0 $fir
1910: 73 74 65 5d 0a 0a 09 72 65 74 75 72 6e 20 31 0a ste]...return 1.
1920: 20 20 20 20 7d 0a 0a 20 20 20 20 6d 65 74 68 6f }.. metho
1930: 64 20 70 65 72 73 69 73 74 20 7b 7d 20 7b 0a 09 d persist {} {..
1940: 73 65 74 20 74 69 64 20 24 6d 79 63 73 74 79 70 set tid $mycstyp
1950: 65 28 24 6d 79 74 79 70 65 29 0a 09 73 65 74 20 e($mytype)..set
1960: 70 69 64 20 5b 24 6d 79 70 72 6f 6a 65 63 74 20 pid [$myproject
1970: 69 64 5d 0a 09 73 65 74 20 70 6f 73 20 30 0a 0a id]..set pos 0..
1980: 09 73 74 61 74 65 20 74 72 61 6e 73 61 63 74 69 .state transacti
1990: 6f 6e 20 7b 0a 09 20 20 20 20 73 74 61 74 65 20 on {.. state
19a0: 72 75 6e 20 7b 0a 09 09 49 4e 53 45 52 54 20 49 run {...INSERT I
19b0: 4e 54 4f 20 63 68 61 6e 67 65 73 65 74 20 28 63 NTO changeset (c
19c0: 69 64 2c 20 20 20 70 69 64 2c 20 20 74 79 70 65 id, pid, type
19d0: 2c 20 73 72 63 29 0a 09 09 56 41 4c 55 45 53 20 , src)...VALUES
19e0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 (
19f0: 24 6d 79 69 64 2c 20 24 70 69 64 2c 20 24 74 69 $myid, $pid, $ti
1a00: 64 2c 20 24 6d 79 73 72 63 69 64 29 3b 0a 09 20 d, $mysrcid);..
1a10: 20 20 20 7d 0a 0a 09 20 20 20 20 66 6f 72 65 61 }... forea
1a20: 63 68 20 72 69 64 20 24 6d 79 72 65 76 69 73 69 ch rid $myrevisi
1a30: 6f 6e 73 20 7b 0a 09 09 73 74 61 74 65 20 72 75 ons {...state ru
1a40: 6e 20 7b 0a 09 09 20 20 20 20 49 4e 53 45 52 54 n {... INSERT
1a50: 20 49 4e 54 4f 20 63 73 72 65 76 69 73 69 6f 6e INTO csrevision
1a60: 20 28 63 69 64 2c 20 20 20 70 6f 73 2c 20 20 72 (cid, pos, r
1a70: 69 64 29 0a 09 09 20 20 20 20 56 41 4c 55 45 53 id)... VALUES
1a80: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1a90: 20 28 24 6d 79 69 64 2c 20 24 70 6f 73 2c 20 24 ($myid, $pos, $
1aa0: 72 69 64 29 3b 0a 09 09 7d 0a 09 09 69 6e 63 72 rid);...}...incr
1ab0: 20 70 6f 73 0a 09 20 20 20 20 7d 0a 09 7d 0a 09 pos.. }..}..
1ac0: 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 return. }..
1ad0: 20 20 23 20 23 20 23 23 20 23 23 23 20 23 23 23 # # ## ### ###
1ae0: 23 23 20 23 23 23 23 23 23 23 23 20 23 23 23 23 ## ######## ####
1af0: 23 23 23 23 23 23 23 23 23 0a 20 20 20 20 23 23 #########. ##
1b00: 20 53 74 61 74 65 0a 0a 20 20 20 20 76 61 72 69 State.. vari
1b10: 61 62 6c 65 20 6d 79 69 64 20 20 20 20 20 20 20 able myid
1b20: 20 3b 20 23 20 49 64 20 6f 66 20 74 68 65 20 63 ; # Id of the c
1b30: 73 65 74 20 66 6f 72 20 74 68 65 20 70 65 72 73 set for the pers
1b40: 69 73 74 65 6e 74 20 73 74 61 74 65 2e 0a 20 20 istent state..
1b50: 20 20 76 61 72 69 61 62 6c 65 20 6d 79 70 72 6f variable mypro
1b60: 6a 65 63 74 20 20 20 3b 20 23 20 52 65 66 65 72 ject ; # Refer
1b70: 65 6e 63 65 20 6f 66 20 74 68 65 20 70 72 6f 6a ence of the proj
1b80: 65 63 74 20 6f 62 6a 65 63 74 20 74 68 65 20 63 ect object the c
1b90: 68 61 6e 67 65 73 65 74 20 62 65 6c 6f 6e 67 73 hangeset belongs
1ba0: 20 74 6f 2e 0a 20 20 20 20 76 61 72 69 61 62 6c to.. variabl
1bb0: 65 20 6d 79 74 79 70 65 20 20 20 20 20 20 3b 20 e mytype ;
1bc0: 23 20 72 65 76 20 6f 72 20 73 79 6d 2c 20 77 68 # rev or sym, wh
1bd0: 65 72 65 20 74 68 65 20 63 73 65 74 20 6f 72 69 ere the cset ori
1be0: 67 69 6e 61 74 65 64 20 66 72 6f 6d 2e 0a 20 20 ginated from..
1bf0: 20 20 76 61 72 69 61 62 6c 65 20 6d 79 73 72 63 variable mysrc
1c00: 69 64 20 20 20 20 20 3b 20 23 20 69 64 20 6f 66 id ; # id of
1c10: 20 74 68 65 20 6d 65 74 61 64 61 74 61 20 6f 72 the metadata or
1c20: 20 73 79 6d 62 6f 6c 20 74 68 65 20 63 73 65 74 symbol the cset
1c30: 20 69 73 20 62 61 73 65 64 20 6f 6e 2e 0a 20 20 is based on..
1c40: 20 20 76 61 72 69 61 62 6c 65 20 6d 79 72 65 76 variable myrev
1c50: 69 73 69 6f 6e 73 20 3b 20 23 20 4c 69 73 74 20 isions ; # List
1c60: 6f 66 20 74 68 65 20 66 69 6c 65 20 6c 65 76 65 of the file leve
1c70: 6c 20 72 65 76 69 73 69 6f 6e 73 20 69 6e 20 74 l revisions in t
1c80: 68 65 20 63 73 65 74 2e 0a 0a 20 20 20 20 23 20 he cset... #
1c90: 23 20 23 23 20 23 23 23 20 23 23 23 23 23 20 23 # ## ### ##### #
1ca0: 23 23 23 23 23 23 23 20 23 23 23 23 23 23 23 23 ####### ########
1cb0: 23 23 23 23 23 0a 20 20 20 20 23 23 20 49 6e 74 #####. ## Int
1cc0: 65 72 6e 61 6c 20 6d 65 74 68 6f 64 73 0a 0a 20 ernal methods..
1cd0: 20 20 20 74 79 70 65 76 61 72 69 61 62 6c 65 20 typevariable
1ce0: 6d 79 63 6f 75 6e 74 65 72 20 20 20 20 20 20 20 mycounter
1cf0: 20 30 20 3b 20 23 20 49 64 20 63 6f 75 6e 74 65 0 ; # Id counte
1d00: 72 20 66 6f 72 20 63 73 65 74 73 2e 0a 20 20 20 r for csets..
1d10: 20 74 79 70 65 76 61 72 69 61 62 6c 65 20 6d 79 typevariable my
1d20: 63 73 74 79 70 65 20 2d 61 72 72 61 79 20 7b 7d cstype -array {}
1d30: 20 3b 20 23 20 4d 61 70 20 63 73 74 79 70 65 73 ; # Map cstypes
1d40: 20 74 6f 20 70 65 72 73 69 73 74 65 6e 74 20 69 to persistent i
1d50: 64 73 2e 0a 0a 20 20 20 20 74 79 70 65 6d 65 74 ds... typemet
1d60: 68 6f 64 20 67 65 74 63 73 74 79 70 65 73 20 7b hod getcstypes {
1d70: 7d 20 7b 0a 09 66 6f 72 65 61 63 68 20 7b 74 69 } {..foreach {ti
1d80: 64 20 6e 61 6d 65 7d 20 5b 73 74 61 74 65 20 72 d name} [state r
1d90: 75 6e 20 7b 0a 09 20 20 20 20 53 45 4c 45 43 54 un {.. SELECT
1da0: 20 74 69 64 2c 20 6e 61 6d 65 20 46 52 4f 4d 20 tid, name FROM
1db0: 63 73 74 79 70 65 3b 0a 09 7d 5d 20 7b 20 73 65 cstype;..}] { se
1dc0: 74 20 6d 79 63 73 74 79 70 65 28 24 6e 61 6d 65 t mycstype($name
1dd0: 29 20 24 74 69 64 20 7d 0a 09 72 65 74 75 72 6e ) $tid }..return
1de0: 0a 20 20 20 20 7d 0a 0a 20 20 20 20 70 72 6f 63 . }.. proc
1df0: 20 50 75 6c 6c 49 6e 74 65 72 6e 61 6c 44 65 70 PullInternalDep
1e00: 65 6e 64 65 6e 63 69 65 73 20 7b 64 76 20 72 65 endencies {dv re
1e10: 76 69 73 69 6f 6e 73 7d 20 7b 0a 09 75 70 76 61 visions} {..upva
1e20: 72 20 31 20 24 64 76 20 64 65 70 65 6e 64 65 6e r 1 $dv dependen
1e30: 63 69 65 73 0a 09 73 65 74 20 74 68 65 73 65 74 cies..set theset
1e40: 20 28 27 5b 6a 6f 69 6e 20 24 72 65 76 69 73 69 ('[join $revisi
1e50: 6f 6e 73 20 7b 27 2c 27 7d 5d 27 29 0a 0a 09 66 ons {','}]')...f
1e60: 6f 72 65 61 63 68 20 7b 72 69 64 20 63 68 69 6c oreach {rid chil
1e70: 64 7d 20 5b 73 74 61 74 65 20 72 75 6e 20 22 0a d} [state run ".
1e80: 20 20 20 2d 2d 20 50 72 69 6d 61 72 79 20 63 68 -- Primary ch
1e90: 69 6c 64 72 65 6e 0a 09 20 20 20 20 53 45 4c 45 ildren.. SELE
1ea0: 43 54 20 52 2e 72 69 64 2c 20 52 2e 63 68 69 6c CT R.rid, R.chil
1eb0: 64 0a 09 20 20 20 20 46 52 4f 4d 20 20 20 72 65 d.. FROM re
1ec0: 76 69 73 69 6f 6e 20 52 0a 09 20 20 20 20 57 48 vision R.. WH
1ed0: 45 52 45 20 20 52 2e 72 69 64 20 20 20 49 4e 20 ERE R.rid IN
1ee0: 24 74 68 65 73 65 74 0a 09 20 20 20 20 41 4e 44 $theset.. AND
1ef0: 20 20 20 20 52 2e 63 68 69 6c 64 20 49 53 20 4e R.child IS N
1f00: 4f 54 20 4e 55 4c 4c 0a 09 20 20 20 20 41 4e 44 OT NULL.. AND
1f10: 20 20 20 20 52 2e 63 68 69 6c 64 20 49 4e 20 24 R.child IN $
1f20: 74 68 65 73 65 74 0a 20 20 20 20 55 4e 49 4f 4e theset. UNION
1f30: 0a 20 20 20 20 2d 2d 20 54 72 61 6e 73 69 74 69 . -- Transiti
1f40: 6f 6e 20 4e 54 44 42 20 74 6f 20 74 72 75 6e 6b on NTDB to trunk
1f50: 0a 09 20 20 20 20 53 45 4c 45 43 54 20 52 2e 72 .. SELECT R.r
1f60: 69 64 2c 20 52 2e 64 62 63 68 69 6c 64 0a 09 20 id, R.dbchild..
1f70: 20 20 20 46 52 4f 4d 20 20 20 72 65 76 69 73 69 FROM revisi
1f80: 6f 6e 20 52 0a 09 20 20 20 20 57 48 45 52 45 20 on R.. WHERE
1f90: 20 52 2e 72 69 64 20 20 20 49 4e 20 24 74 68 65 R.rid IN $the
1fa0: 73 65 74 0a 09 20 20 20 20 41 4e 44 20 20 20 20 set.. AND
1fb0: 52 2e 64 62 63 68 69 6c 64 20 49 53 20 4e 4f 54 R.dbchild IS NOT
1fc0: 20 4e 55 4c 4c 0a 09 20 20 20 20 41 4e 44 20 20 NULL.. AND
1fd0: 20 20 52 2e 64 62 63 68 69 6c 64 20 49 4e 20 24 R.dbchild IN $
1fe0: 74 68 65 73 65 74 0a 20 20 20 20 55 4e 49 4f 4e theset. UNION
1ff0: 0a 20 20 20 20 2d 2d 20 53 65 63 6f 6e 64 61 72 . -- Secondar
2000: 79 20 28 62 72 61 6e 63 68 29 20 63 68 69 6c 64 y (branch) child
2010: 72 65 6e 0a 09 20 20 20 20 53 45 4c 45 43 54 20 ren.. SELECT
2020: 52 2e 72 69 64 2c 20 42 2e 62 72 69 64 0a 09 20 R.rid, B.brid..
2030: 20 20 20 46 52 4f 4d 20 20 20 72 65 76 69 73 69 FROM revisi
2040: 6f 6e 20 52 2c 20 72 65 76 69 73 69 6f 6e 62 72 on R, revisionbr
2050: 61 6e 63 68 63 68 69 6c 64 72 65 6e 20 42 0a 09 anchchildren B..
2060: 20 20 20 20 57 48 45 52 45 20 20 52 2e 72 69 64 WHERE R.rid
2070: 20 20 20 49 4e 20 24 74 68 65 73 65 74 0a 09 20 IN $theset..
2080: 20 20 20 41 4e 44 20 20 20 20 52 2e 72 69 64 20 AND R.rid
2090: 3d 20 42 2e 72 69 64 0a 09 20 20 20 20 41 4e 44 = B.rid.. AND
20a0: 20 20 20 20 42 2e 62 72 69 64 20 49 4e 20 24 74 B.brid IN $t
20b0: 68 65 73 65 74 0a 09 22 5d 20 7b 0a 09 20 20 20 heset.."] {..
20c0: 20 23 20 43 6f 6e 73 69 64 65 72 20 6d 6f 76 69 # Consider movi
20d0: 6e 67 20 74 68 69 73 20 74 6f 20 74 68 65 20 69 ng this to the i
20e0: 6e 74 65 67 72 69 74 79 20 6d 6f 64 75 6c 65 2e ntegrity module.
20f0: 0a 09 20 20 20 20 69 66 20 7b 24 72 69 64 20 3d .. if {$rid =
2100: 3d 20 24 63 68 69 6c 64 7d 20 7b 0a 09 09 74 72 = $child} {...tr
2110: 6f 75 62 6c 65 20 69 6e 74 65 72 6e 61 6c 20 22 ouble internal "
2120: 52 65 76 69 73 69 6f 6e 20 24 72 69 64 20 64 65 Revision $rid de
2130: 70 65 6e 64 73 20 6f 6e 20 69 74 73 65 6c 66 2e pends on itself.
2140: 22 0a 09 20 20 20 20 7d 0a 09 20 20 20 20 73 65 ".. }.. se
2150: 74 20 64 65 70 65 6e 64 65 6e 63 69 65 73 28 24 t dependencies($
2160: 72 69 64 29 20 24 63 68 69 6c 64 0a 09 7d 0a 20 rid) $child..}.
2170: 20 20 20 7d 0a 0a 20 20 20 20 70 72 6f 63 20 49 }.. proc I
2180: 6e 69 74 69 61 6c 69 7a 65 42 72 65 61 6b 53 74 nitializeBreakSt
2190: 61 74 65 20 7b 72 65 76 69 73 69 6f 6e 73 7d 20 ate {revisions}
21a0: 7b 0a 09 75 70 76 61 72 20 31 20 70 6f 73 20 70 {..upvar 1 pos p
21b0: 6f 73 20 63 72 6f 73 73 20 63 72 6f 73 73 20 72 os cross cross r
21c0: 61 6e 67 65 20 72 61 6e 67 65 20 64 65 70 63 20 ange range depc
21d0: 64 65 70 63 20 64 65 6c 74 61 20 64 65 6c 74 61 depc delta delta
21e0: 20 5c 0a 09 20 20 20 20 64 65 70 65 6e 64 65 6e \.. dependen
21f0: 63 69 65 73 20 64 65 70 65 6e 64 65 6e 63 69 65 cies dependencie
2200: 73 0a 0a 09 23 20 46 69 72 73 74 20 77 65 20 63 s...# First we c
2210: 72 65 61 74 65 20 61 20 6d 61 70 20 6f 66 20 70 reate a map of p
2220: 6f 73 69 74 69 6f 6e 73 20 74 6f 20 6d 61 6b 65 ositions to make
2230: 20 69 74 20 65 61 73 69 65 72 20 74 6f 0a 09 23 it easier to..#
2240: 20 64 65 74 65 72 6d 69 6e 65 20 77 68 65 74 68 determine wheth
2250: 65 72 20 61 20 64 65 70 65 6e 64 65 6e 63 79 20 er a dependency
2260: 63 72 6f 73 73 65 73 20 61 20 70 61 72 74 69 63 crosses a partic
2270: 75 6c 61 72 20 69 6e 64 65 78 2e 0a 0a 09 61 72 ular index....ar
2280: 72 61 79 20 73 65 74 20 70 6f 73 20 20 20 7b 7d ray set pos {}
2290: 0a 09 61 72 72 61 79 20 73 65 74 20 63 72 6f 73 ..array set cros
22a0: 73 20 7b 7d 0a 09 61 72 72 61 79 20 73 65 74 20 s {}..array set
22b0: 64 65 70 63 20 20 7b 7d 0a 09 73 65 74 20 72 61 depc {}..set ra
22c0: 6e 67 65 20 20 20 20 20 20 20 7b 7d 0a 09 73 65 nge {}..se
22d0: 74 20 6e 20 30 0a 09 66 6f 72 65 61 63 68 20 72 t n 0..foreach r
22e0: 65 76 20 24 72 65 76 69 73 69 6f 6e 73 20 7b 20 ev $revisions {
22f0: 0a 09 20 20 20 20 6c 61 70 70 65 6e 64 20 72 61 .. lappend ra
2300: 6e 67 65 20 24 6e 0a 09 20 20 20 20 73 65 74 20 nge $n.. set
2310: 70 6f 73 28 24 72 65 76 29 20 24 6e 0a 09 20 20 pos($rev) $n..
2320: 20 20 73 65 74 20 63 72 6f 73 73 28 24 6e 29 20 set cross($n)
2330: 30 0a 09 20 20 20 20 69 6e 63 72 20 6e 0a 09 7d 0.. incr n..}
2340: 0a 0a 09 23 20 53 65 63 6f 6e 64 6c 79 20 77 65 ...# Secondly we
2350: 20 63 6f 75 6e 74 20 74 68 65 20 63 72 6f 73 73 count the cross
2360: 69 6e 67 73 20 70 65 72 20 70 6f 73 69 74 69 6f ings per positio
2370: 6e 2c 20 62 79 20 69 74 65 72 61 74 69 6e 67 0a n, by iterating.
2380: 09 23 20 6f 76 65 72 20 74 68 65 20 72 65 63 6f .# over the reco
2390: 72 64 65 64 20 69 6e 74 65 72 6e 61 6c 20 64 65 rded internal de
23a0: 70 65 6e 64 65 6e 63 69 65 73 2e 0a 0a 09 23 20 pendencies....#
23b0: 4e 6f 74 65 3a 20 49 66 20 74 68 65 20 74 69 6d Note: If the tim
23c0: 65 73 74 61 6d 70 73 20 61 72 65 20 62 61 64 6c estamps are badl
23d0: 79 20 6f 75 74 20 6f 66 20 6f 72 64 65 72 20 69 y out of order i
23e0: 74 20 69 73 0a 09 23 20 20 20 20 20 20 20 70 6f t is..# po
23f0: 73 73 69 62 6c 65 20 74 6f 20 68 61 76 65 20 61 ssible to have a
2400: 20 62 61 63 6b 77 61 72 64 20 73 75 63 63 65 73 backward succes
2410: 73 6f 72 20 64 65 70 65 6e 64 65 6e 63 79 2c 0a sor dependency,.
2420: 09 23 20 20 20 20 20 20 20 69 2e 65 2e 20 77 69 .# i.e. wi
2430: 74 68 20 73 74 61 72 74 20 3e 20 65 6e 64 2e 20 th start > end.
2440: 57 65 20 6d 61 79 20 68 61 76 65 20 74 6f 20 73 We may have to s
2450: 77 61 70 20 74 68 65 20 69 6e 64 69 63 65 73 0a wap the indices.
2460: 09 23 20 20 20 20 20 20 20 74 6f 20 65 6e 73 75 .# to ensu
2470: 72 65 20 74 68 61 74 20 74 68 65 20 66 6f 6c 6c re that the foll
2480: 6f 77 69 6e 67 20 6c 6f 6f 70 20 72 75 6e 73 20 owing loop runs
2490: 63 6f 72 72 65 63 74 6c 79 2e 0a 09 23 0a 09 23 correctly...#..#
24a0: 20 4e 6f 74 65 20 32 3a 20 73 74 61 72 74 20 3d Note 2: start =
24b0: 3d 20 65 6e 64 20 69 73 20 6e 6f 74 20 70 6f 73 = end is not pos
24c0: 73 69 62 6c 65 2e 20 49 74 20 69 6e 64 69 63 61 sible. It indica
24d0: 74 65 73 20 61 0a 09 23 20 20 20 20 20 20 20 20 tes a..#
24e0: 20 73 65 6c 66 2d 64 65 70 65 6e 64 65 6e 63 79 self-dependency
24f0: 20 64 75 65 20 74 6f 20 74 68 65 20 75 6e 69 71 due to the uniq
2500: 75 65 6e 65 73 73 20 6f 66 20 70 6f 73 69 74 69 ueness of positi
2510: 6f 6e 73 2c 0a 09 23 20 20 20 20 20 20 20 20 20 ons,..#
2520: 61 6e 64 20 74 68 61 74 20 69 73 20 73 6f 6d 65 and that is some
2530: 74 68 69 6e 67 20 77 65 20 68 61 76 65 20 72 75 thing we have ru
2540: 6c 65 64 20 6f 75 74 20 61 6c 72 65 61 64 79 2c led out already,
2550: 20 73 65 65 0a 09 23 20 20 20 20 20 20 20 20 20 see..#
2560: 50 75 6c 6c 49 6e 74 65 72 6e 61 6c 44 65 70 65 PullInternalDepe
2570: 6e 64 65 6e 63 69 65 73 2e 0a 0a 09 66 6f 72 65 ndencies....fore
2580: 61 63 68 20 7b 72 69 64 20 63 68 69 6c 64 7d 20 ach {rid child}
2590: 5b 61 72 72 61 79 20 67 65 74 20 64 65 70 65 6e [array get depen
25a0: 64 65 6e 63 69 65 73 5d 20 7b 0a 09 20 20 20 20 dencies] {..
25b0: 73 65 74 20 64 6b 65 79 20 20 20 20 5b 6c 69 73 set dkey [lis
25c0: 74 20 24 72 69 64 20 24 63 68 69 6c 64 5d 0a 09 t $rid $child]..
25d0: 20 20 20 20 73 65 74 20 73 74 61 72 74 20 20 20 set start
25e0: 24 70 6f 73 28 24 72 69 64 29 0a 09 20 20 20 20 $pos($rid)..
25f0: 73 65 74 20 65 6e 64 20 20 20 20 20 24 70 6f 73 set end $pos
2600: 28 24 63 68 69 6c 64 29 0a 09 20 20 20 20 73 65 ($child).. se
2610: 74 20 63 72 6f 73 73 65 73 20 7b 7d 0a 0a 09 20 t crosses {}...
2620: 20 20 20 69 66 20 7b 24 73 74 61 72 74 20 3e 20 if {$start >
2630: 24 65 6e 64 7d 20 7b 0a 09 09 77 68 69 6c 65 20 $end} {...while
2640: 7b 24 65 6e 64 20 3c 20 24 73 74 61 72 74 7d 20 {$end < $start}
2650: 7b 0a 09 09 20 20 20 20 6c 61 70 70 65 6e 64 20 {... lappend
2660: 63 72 6f 73 73 65 73 20 24 65 6e 64 0a 09 09 20 crosses $end...
2670: 20 20 20 69 6e 63 72 20 63 72 6f 73 73 28 24 65 incr cross($e
2680: 6e 64 29 0a 09 09 20 20 20 20 69 6e 63 72 20 65 nd)... incr e
2690: 6e 64 0a 09 09 7d 0a 09 20 20 20 20 7d 20 65 6c nd...}.. } el
26a0: 73 65 20 7b 0a 09 09 77 68 69 6c 65 20 7b 24 73 se {...while {$s
26b0: 74 61 72 74 20 3c 20 24 65 6e 64 7d 20 7b 0a 09 tart < $end} {..
26c0: 09 20 20 20 20 6c 61 70 70 65 6e 64 20 63 72 6f . lappend cro
26d0: 73 73 65 73 20 24 73 74 61 72 74 0a 09 09 20 20 sses $start...
26e0: 20 20 69 6e 63 72 20 63 72 6f 73 73 28 24 73 74 incr cross($st
26f0: 61 72 74 29 0a 09 09 20 20 20 20 69 6e 63 72 20 art)... incr
2700: 73 74 61 72 74 0a 09 09 7d 0a 09 20 20 20 20 7d start...}.. }
2710: 0a 09 20 20 20 20 73 65 74 20 64 65 70 63 28 24 .. set depc($
2720: 64 6b 65 79 29 20 24 63 72 6f 73 73 65 73 0a 09 dkey) $crosses..
2730: 7d 0a 0a 09 49 6e 69 74 69 61 6c 69 7a 65 44 65 }...InitializeDe
2740: 6c 74 61 73 20 24 72 65 76 69 73 69 6f 6e 73 0a ltas $revisions.
2750: 09 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 .return. }..
2760: 20 20 20 70 72 6f 63 20 49 6e 69 74 69 61 6c 69 proc Initiali
2770: 7a 65 44 65 6c 74 61 73 20 7b 72 65 76 69 73 69 zeDeltas {revisi
2780: 6f 6e 73 7d 20 7b 0a 09 75 70 76 61 72 20 31 20 ons} {..upvar 1
2790: 64 65 6c 74 61 20 64 65 6c 74 61 0a 0a 09 23 20 delta delta...#
27a0: 50 75 6c 6c 20 74 68 65 20 74 69 6d 65 73 74 61 Pull the timesta
27b0: 6d 70 73 20 66 6f 72 20 61 6c 6c 20 72 65 76 69 mps for all revi
27c0: 73 69 6f 6e 73 20 69 6e 20 74 68 65 20 63 68 61 sions in the cha
27d0: 6e 67 65 73 65 74 73 20 61 6e 64 0a 09 23 20 63 ngesets and..# c
27e0: 6f 6d 70 75 74 65 20 74 68 65 69 72 20 64 65 6c ompute their del
27f0: 74 61 73 20 66 6f 72 20 75 73 65 20 62 79 20 74 tas for use by t
2800: 68 65 20 62 72 65 61 6b 20 66 69 6e 64 65 72 2e he break finder.
2810: 0a 0a 09 61 72 72 61 79 20 73 65 74 20 64 65 6c ...array set del
2820: 74 61 20 7b 7d 0a 09 61 72 72 61 79 20 73 65 74 ta {}..array set
2830: 20 73 74 61 6d 70 20 7b 7d 0a 0a 09 73 65 74 20 stamp {}...set
2840: 74 68 65 73 65 74 20 28 27 5b 6a 6f 69 6e 20 24 theset ('[join $
2850: 72 65 76 69 73 69 6f 6e 73 20 7b 27 2c 27 7d 5d revisions {','}]
2860: 27 29 0a 09 66 6f 72 65 61 63 68 20 7b 72 69 64 ')..foreach {rid
2870: 20 74 69 6d 65 7d 20 5b 73 74 61 74 65 20 72 75 time} [state ru
2880: 6e 20 22 0a 09 20 20 20 20 53 45 4c 45 43 54 20 n ".. SELECT
2890: 52 2e 72 69 64 2c 20 52 2e 64 61 74 65 0a 09 20 R.rid, R.date..
28a0: 20 20 20 46 52 4f 4d 20 72 65 76 69 73 69 6f 6e FROM revision
28b0: 20 52 0a 09 20 20 20 20 57 48 45 52 45 20 52 2e R.. WHERE R.
28c0: 72 69 64 20 49 4e 20 24 74 68 65 73 65 74 0a 09 rid IN $theset..
28d0: 22 5d 20 7b 0a 09 20 20 20 20 73 65 74 20 73 74 "] {.. set st
28e0: 61 6d 70 28 24 72 69 64 29 20 24 74 69 6d 65 0a amp($rid) $time.
28f0: 09 7d 0a 0a 09 73 65 74 20 6e 20 30 0a 09 66 6f .}...set n 0..fo
2900: 72 65 61 63 68 20 72 69 64 20 5b 6c 72 61 6e 67 reach rid [lrang
2910: 65 20 24 72 65 76 69 73 69 6f 6e 73 20 30 20 65 e $revisions 0 e
2920: 6e 64 2d 31 5d 20 72 6e 65 78 74 20 5b 6c 72 61 nd-1] rnext [lra
2930: 6e 67 65 20 24 72 65 76 69 73 69 6f 6e 73 20 31 nge $revisions 1
2940: 20 65 6e 64 5d 20 7b 0a 09 20 20 20 20 73 65 74 end] {.. set
2950: 20 64 65 6c 74 61 28 24 6e 29 20 5b 65 78 70 72 delta($n) [expr
2960: 20 7b 24 73 74 61 6d 70 28 24 72 6e 65 78 74 29 {$stamp($rnext)
2970: 20 2d 20 24 73 74 61 6d 70 28 24 72 69 64 29 7d - $stamp($rid)}
2980: 5d 0a 09 20 20 20 20 69 6e 63 72 20 6e 0a 09 7d ].. incr n..}
2990: 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a ..return. }..
29a0: 20 20 20 20 70 72 6f 63 20 46 69 6e 64 42 65 73 proc FindBes
29b0: 74 42 72 65 61 6b 20 7b 72 61 6e 67 65 7d 20 7b tBreak {range} {
29c0: 0a 09 75 70 76 61 72 20 31 20 63 72 6f 73 73 20 ..upvar 1 cross
29d0: 63 72 6f 73 73 20 64 65 6c 74 61 20 64 65 6c 74 cross delta delt
29e0: 61 0a 0a 09 23 20 44 65 74 65 72 6d 69 6e 65 20 a...# Determine
29f0: 74 68 65 20 62 65 73 74 20 62 72 65 61 6b 20 6c the best break l
2a00: 6f 63 61 74 69 6f 6e 20 69 6e 20 74 68 65 20 67 ocation in the g
2a10: 69 76 65 6e 20 72 61 6e 67 65 20 6f 66 0a 09 23 iven range of..#
2a20: 20 70 6f 73 69 74 69 6f 6e 73 2e 20 46 69 72 73 positions. Firs
2a30: 74 20 77 65 20 6c 6f 6f 6b 20 66 6f 72 20 74 68 t we look for th
2a40: 65 20 6c 6f 63 61 74 69 6f 6e 73 20 77 69 74 68 e locations with
2a50: 20 74 68 65 20 6d 61 78 69 6d 61 6c 0a 09 23 20 the maximal..#
2a60: 6e 75 6d 62 65 72 20 6f 66 20 63 72 6f 73 73 69 number of crossi
2a70: 6e 67 73 2e 20 49 66 20 74 68 65 72 65 20 61 72 ngs. If there ar
2a80: 65 20 73 65 76 65 72 61 6c 20 77 65 20 6c 6f 6f e several we loo
2a90: 6b 20 66 6f 72 20 74 68 65 0a 09 23 20 73 68 6f k for the..# sho
2aa0: 72 74 65 73 74 20 74 69 6d 65 20 69 6e 74 65 72 rtest time inter
2ab0: 76 61 6c 20 61 6d 6f 6e 67 20 74 68 65 6d 2e 20 val among them.
2ac0: 49 66 20 77 65 20 73 74 69 6c 6c 20 68 61 76 65 If we still have
2ad0: 20 6d 75 6c 74 69 70 6c 65 0a 09 23 20 70 6f 73 multiple..# pos
2ae0: 73 69 62 69 6c 69 74 69 65 73 20 61 66 74 65 72 sibilities after
2af0: 20 74 68 61 74 20 77 65 20 73 65 6c 65 63 74 20 that we select
2b00: 74 68 65 20 65 61 72 6c 69 65 73 74 20 6c 6f 63 the earliest loc
2b10: 61 74 69 6f 6e 0a 09 23 20 61 6d 6f 6e 67 20 74 ation..# among t
2b20: 68 65 73 65 2e 0a 0a 09 23 20 4e 6f 74 65 3a 20 hese....# Note:
2b30: 49 66 20 74 68 65 20 6d 61 78 69 6d 61 6c 20 6e If the maximal n
2b40: 75 6d 62 65 72 20 6f 66 20 63 72 6f 73 73 69 6e umber of crossin
2b50: 67 73 20 69 73 20 30 20 74 68 65 6e 20 74 68 65 gs is 0 then the
2b60: 20 72 61 6e 67 65 0a 09 23 20 20 20 20 20 20 20 range..#
2b70: 68 61 73 20 6e 6f 20 69 6e 74 65 72 6e 61 6c 20 has no internal
2b80: 64 65 70 65 6e 64 65 6e 63 69 65 73 2c 20 61 6e dependencies, an
2b90: 64 20 6e 6f 20 62 72 65 61 6b 20 6c 6f 63 61 74 d no break locat
2ba0: 69 6f 6e 20 61 74 0a 09 23 20 20 20 20 20 20 20 ion at..#
2bb0: 61 6c 6c 2e 20 54 68 69 73 20 70 6f 73 73 69 62 all. This possib
2bc0: 69 6c 69 74 79 20 69 73 20 73 69 67 6e 61 6c 65 ility is signale
2bd0: 64 20 76 69 61 20 72 65 73 75 6c 74 20 2d 31 2e d via result -1.
2be0: 0a 0a 09 23 20 4e 6f 74 65 3a 20 41 20 72 61 6e ...# Note: A ran
2bf0: 67 65 20 6f 66 20 6c 65 6e 67 74 68 20 31 20 6f ge of length 1 o
2c00: 72 20 6c 65 73 73 20 63 61 6e 6e 6f 74 20 68 61 r less cannot ha
2c10: 76 65 20 69 6e 74 65 72 6e 61 6c 0a 09 23 20 20 ve internal..#
2c20: 20 20 20 20 20 64 65 70 65 6e 64 65 6e 63 69 65 dependencie
2c30: 73 2c 20 61 73 20 74 68 61 74 20 6e 65 65 64 73 s, as that needs
2c40: 20 61 74 20 6c 65 61 73 74 20 74 77 6f 20 72 65 at least two re
2c50: 76 69 73 69 6f 6e 73 20 69 6e 0a 09 23 20 20 20 visions in..#
2c60: 20 20 20 20 74 68 65 20 72 61 6e 67 65 2e 0a 0a the range...
2c70: 09 69 66 20 7b 5b 6c 6c 65 6e 67 74 68 20 24 72 .if {[llength $r
2c80: 61 6e 67 65 5d 20 3c 20 32 7d 20 7b 20 72 65 74 ange] < 2} { ret
2c90: 75 72 6e 20 2d 31 20 7d 0a 0a 09 73 65 74 20 6d urn -1 }...set m
2ca0: 61 78 20 2d 31 0a 09 73 65 74 20 62 65 73 74 20 ax -1..set best
2cb0: 7b 7d 0a 0a 09 66 6f 72 65 61 63 68 20 6c 6f 63 {}...foreach loc
2cc0: 61 74 69 6f 6e 20 24 72 61 6e 67 65 20 7b 0a 09 ation $range {..
2cd0: 20 20 20 20 73 65 74 20 63 72 6f 73 73 69 6e 67 set crossing
2ce0: 73 20 24 63 72 6f 73 73 28 24 6c 6f 63 61 74 69 s $cross($locati
2cf0: 6f 6e 29 0a 09 20 20 20 20 69 66 20 7b 24 63 72 on).. if {$cr
2d00: 6f 73 73 69 6e 67 73 20 3e 20 24 6d 61 78 7d 20 ossings > $max}
2d10: 7b 0a 09 09 73 65 74 20 6d 61 78 20 20 24 63 72 {...set max $cr
2d20: 6f 73 73 69 6e 67 73 0a 09 09 73 65 74 20 62 65 ossings...set be
2d30: 73 74 20 5b 6c 69 73 74 20 24 6c 6f 63 61 74 69 st [list $locati
2d40: 6f 6e 5d 0a 09 09 63 6f 6e 74 69 6e 75 65 0a 09 on]...continue..
2d50: 20 20 20 20 7d 20 65 6c 73 65 69 66 20 7b 24 63 } elseif {$c
2d60: 72 6f 73 73 69 6e 67 73 20 3d 3d 20 24 6d 61 78 rossings == $max
2d70: 7d 20 7b 0a 09 09 6c 61 70 70 65 6e 64 20 62 65 } {...lappend be
2d80: 73 74 20 24 6c 6f 63 61 74 69 6f 6e 0a 09 20 20 st $location..
2d90: 20 20 7d 0a 09 7d 0a 0a 09 69 66 20 7b 24 6d 61 }..}...if {$ma
2da0: 78 20 3d 3d 20 30 7d 20 20 20 20 20 20 20 20 20 x == 0}
2db0: 20 20 20 7b 20 72 65 74 75 72 6e 20 2d 31 20 7d { return -1 }
2dc0: 0a 09 69 66 20 7b 5b 6c 6c 65 6e 67 74 68 20 24 ..if {[llength $
2dd0: 62 65 73 74 5d 20 3d 3d 20 31 7d 20 7b 20 72 65 best] == 1} { re
2de0: 74 75 72 6e 20 5b 6c 69 6e 64 65 78 20 24 62 65 turn [lindex $be
2df0: 73 74 20 30 5d 20 7d 0a 0a 09 73 65 74 20 6c 6f st 0] }...set lo
2e00: 63 61 74 69 6f 6e 73 20 24 62 65 73 74 0a 09 73 cations $best..s
2e10: 65 74 20 62 65 73 74 20 7b 7d 0a 09 73 65 74 20 et best {}..set
2e20: 6d 69 6e 20 2d 31 0a 0a 09 66 6f 72 65 61 63 68 min -1...foreach
2e30: 20 6c 6f 63 61 74 69 6f 6e 20 24 6c 6f 63 61 74 location $locat
2e40: 69 6f 6e 73 20 7b 0a 09 20 20 20 20 73 65 74 20 ions {.. set
2e50: 69 6e 74 65 72 76 61 6c 20 24 64 65 6c 74 61 28 interval $delta(
2e60: 24 6c 6f 63 61 74 69 6f 6e 29 0a 09 20 20 20 20 $location)..
2e70: 69 66 20 7b 28 24 6d 69 6e 20 3c 20 30 29 20 7c if {($min < 0) |
2e80: 7c 20 28 24 69 6e 74 65 72 76 61 6c 20 3c 20 24 | ($interval < $
2e90: 6d 69 6e 29 7d 20 7b 0a 09 09 73 65 74 20 6d 69 min)} {...set mi
2ea0: 6e 20 20 24 69 6e 74 65 72 76 61 6c 0a 09 09 73 n $interval...s
2eb0: 65 74 20 62 65 73 74 20 5b 6c 69 73 74 20 24 6c et best [list $l
2ec0: 6f 63 61 74 69 6f 6e 5d 0a 09 20 20 20 20 7d 20 ocation].. }
2ed0: 65 6c 73 65 69 66 20 7b 24 69 6e 74 65 72 76 61 elseif {$interva
2ee0: 6c 20 3d 3d 20 24 6d 69 6e 7d 20 7b 0a 09 09 6c l == $min} {...l
2ef0: 61 70 70 65 6e 64 20 62 65 73 74 20 24 6c 6f 63 append best $loc
2f00: 61 74 69 6f 6e 0a 09 20 20 20 20 7d 0a 09 7d 0a ation.. }..}.
2f10: 0a 09 69 66 20 7b 5b 6c 6c 65 6e 67 74 68 20 24 ..if {[llength $
2f20: 62 65 73 74 5d 20 3d 3d 20 31 7d 20 7b 20 72 65 best] == 1} { re
2f30: 74 75 72 6e 20 5b 6c 69 6e 64 65 78 20 24 62 65 turn [lindex $be
2f40: 73 74 20 30 5d 20 7d 0a 0a 09 72 65 74 75 72 6e st 0] }...return
2f50: 20 5b 6c 69 6e 64 65 78 20 5b 6c 73 6f 72 74 20 [lindex [lsort
2f60: 2d 69 6e 74 65 67 65 72 20 2d 69 6e 63 72 65 61 -integer -increa
2f70: 73 69 6e 67 20 24 62 65 73 74 5d 20 30 5d 0a 20 sing $best] 0].
2f80: 20 20 20 7d 0a 0a 20 20 20 20 70 72 6f 63 20 43 }.. proc C
2f90: 75 74 41 74 20 7b 6c 6f 63 61 74 69 6f 6e 7d 20 utAt {location}
2fa0: 7b 0a 09 75 70 76 61 72 20 31 20 63 72 6f 73 73 {..upvar 1 cross
2fb0: 20 63 72 6f 73 73 20 64 65 70 63 20 64 65 70 63 cross depc depc
2fc0: 0a 0a 09 23 20 49 74 20 77 61 73 20 64 65 63 69 ...# It was deci
2fd0: 64 65 64 20 74 6f 20 73 70 6c 69 74 20 74 68 65 ded to split the
2fe0: 20 63 68 61 6e 67 65 73 65 74 20 61 74 20 74 68 changeset at th
2ff0: 65 20 67 69 76 65 6e 0a 09 23 20 6c 6f 63 61 74 e given..# locat
3000: 69 6f 6e 2e 20 54 68 69 73 20 63 75 74 73 20 61 ion. This cuts a
3010: 20 6e 75 6d 62 65 72 20 6f 66 20 64 65 70 65 6e number of depen
3020: 64 65 6e 63 69 65 73 2e 20 48 65 72 65 20 77 65 dencies. Here we
3030: 20 75 70 64 61 74 65 0a 09 23 20 74 68 65 20 63 update..# the c
3040: 72 6f 73 73 20 69 6e 66 6f 72 6d 61 74 69 6f 6e ross information
3050: 20 73 6f 20 74 68 61 74 20 74 68 65 20 62 72 65 so that the bre
3060: 61 6b 20 66 69 6e 64 65 72 20 68 61 73 20 61 63 ak finder has ac
3070: 63 75 72 61 74 65 0a 09 23 20 64 61 74 61 20 77 curate..# data w
3080: 68 65 6e 20 77 65 20 6c 6f 6f 6b 20 61 74 20 74 hen we look at t
3090: 68 65 20 67 65 6e 65 72 61 74 65 64 20 66 72 61 he generated fra
30a0: 67 6d 65 6e 74 73 2e 0a 0a 09 73 65 74 20 73 69 gments....set si
30b0: 78 20 5b 6c 6f 67 20 76 69 73 69 62 6c 65 3f 20 x [log visible?
30c0: 36 5d 0a 0a 09 66 6f 72 65 61 63 68 20 7b 64 65 6]...foreach {de
30d0: 70 20 72 61 6e 67 65 7d 20 5b 61 72 72 61 79 20 p range} [array
30e0: 67 65 74 20 64 65 70 63 5d 20 7b 0a 09 20 20 20 get depc] {..
30f0: 20 23 20 43 68 65 63 6b 20 61 6c 6c 20 64 65 70 # Check all dep
3100: 65 6e 64 65 6e 63 69 65 73 20 73 74 69 6c 6c 20 endencies still
3110: 6b 6e 6f 77 6e 2c 20 74 61 6b 65 20 74 68 65 69 known, take thei
3120: 72 20 72 61 6e 67 65 20 61 6e 64 0a 09 20 20 20 r range and..
3130: 20 23 20 73 65 65 20 69 66 20 74 68 65 20 62 72 # see if the br
3140: 65 61 6b 20 6c 6f 63 61 74 69 6f 6e 20 66 61 6c eak location fal
3150: 6c 73 20 77 69 74 68 69 6e 2e 0a 0a 09 20 20 20 ls within....
3160: 20 42 6f 72 64 65 72 20 24 72 61 6e 67 65 20 73 Border $range s
3170: 20 65 0a 09 20 20 20 20 69 66 20 7b 24 6c 6f 63 e.. if {$loc
3180: 61 74 69 6f 6e 20 3c 20 24 73 7d 20 63 6f 6e 74 ation < $s} cont
3190: 69 6e 75 65 20 3b 20 23 20 62 72 65 61 6b 20 62 inue ; # break b
31a0: 65 66 6f 72 65 20 72 61 6e 67 65 2c 20 69 67 6e efore range, ign
31b0: 6f 72 65 0a 09 20 20 20 20 69 66 20 7b 24 6c 6f ore.. if {$lo
31c0: 63 61 74 69 6f 6e 20 3e 20 24 65 7d 20 63 6f 6e cation > $e} con
31d0: 74 69 6e 75 65 20 3b 20 23 20 62 72 65 61 6b 20 tinue ; # break
31e0: 61 66 74 65 72 20 72 61 6e 67 65 2c 20 69 67 6e after range, ign
31f0: 6f 72 65 2e 0a 0a 09 20 20 20 20 23 20 54 68 69 ore.... # Thi
3200: 73 20 64 65 70 65 6e 64 65 6e 63 79 20 63 72 6f s dependency cro
3210: 73 73 65 73 20 74 68 65 20 62 72 65 61 6b 20 6c sses the break l
3220: 6f 63 61 74 69 6f 6e 2e 20 57 65 20 72 65 6d 6f ocation. We remo
3230: 76 65 20 69 74 0a 09 20 20 20 20 23 20 66 72 6f ve it.. # fro
3240: 6d 20 74 68 65 20 63 72 6f 73 73 69 6e 67 73 20 m the crossings
3250: 63 6f 75 6e 74 65 72 73 2c 20 61 6e 64 20 74 68 counters, and th
3260: 65 6e 20 61 6c 73 6f 20 66 72 6f 6d 20 74 68 65 en also from the
3270: 20 73 65 74 0a 09 20 20 20 20 23 20 6f 66 20 6b set.. # of k
3280: 6e 6f 77 6e 20 64 65 70 65 6e 64 65 6e 63 69 65 nown dependencie
3290: 73 2c 20 61 73 20 77 65 20 61 72 65 20 64 6f 6e s, as we are don
32a0: 65 20 77 69 74 68 20 69 74 2e 0a 0a 09 20 20 20 e with it....
32b0: 20 66 6f 72 65 61 63 68 20 6c 6f 63 20 24 64 65 foreach loc $de
32c0: 70 63 28 24 64 65 70 29 20 7b 20 69 6e 63 72 20 pc($dep) { incr
32d0: 63 72 6f 73 73 28 24 6c 6f 63 29 20 2d 31 20 7d cross($loc) -1 }
32e0: 0a 09 20 20 20 20 75 6e 73 65 74 20 64 65 70 63 .. unset depc
32f0: 28 24 64 65 70 29 0a 0a 09 20 20 20 20 69 66 20 ($dep)... if
3300: 7b 21 24 73 69 78 7d 20 63 6f 6e 74 69 6e 75 65 {!$six} continue
3310: 0a 0a 09 20 20 20 20 73 74 72 75 63 74 3a 3a 6c ... struct::l
3320: 69 73 74 20 61 73 73 69 67 6e 20 24 64 65 70 20 ist assign $dep
3330: 70 61 72 65 6e 74 20 63 68 69 6c 64 0a 09 20 20 parent child..
3340: 20 20 6c 6f 67 20 77 72 69 74 65 20 36 20 63 73 log write 6 cs
3350: 65 74 73 20 22 42 72 6f 6b 65 20 64 65 70 65 6e ets "Broke depen
3360: 64 65 6e 63 79 20 5b 50 44 20 24 70 61 72 65 6e dency [PD $paren
3370: 74 5d 20 2d 2d 3e 20 5b 50 44 20 24 63 68 69 6c t] --> [PD $chil
3380: 64 5d 22 0a 09 7d 0a 0a 09 72 65 74 75 72 6e 0a d]"..}...return.
3390: 20 20 20 20 7d 0a 0a 20 20 20 20 23 20 50 72 69 }.. # Pri
33a0: 6e 74 20 69 64 65 6e 74 69 66 79 69 6e 67 20 64 nt identifying d
33b0: 61 74 61 20 66 6f 72 20 61 20 72 65 76 69 73 69 ata for a revisi
33c0: 6f 6e 20 28 70 72 6f 6a 65 63 74 2c 20 66 69 6c on (project, fil
33d0: 65 2c 20 64 6f 74 74 65 64 20 72 65 76 0a 20 20 e, dotted rev.
33e0: 20 20 23 20 6e 75 6d 62 65 72 29 2c 20 66 6f 72 # number), for
33f0: 20 68 69 67 68 20 76 65 72 62 6f 73 69 74 79 20 high verbosity
3400: 6c 6f 67 20 6f 75 74 70 75 74 2e 0a 0a 20 20 20 log output...
3410: 20 70 72 6f 63 20 50 44 20 7b 69 64 7d 20 7b 0a proc PD {id} {.
3420: 09 66 6f 72 65 61 63 68 20 7b 70 20 66 20 72 7d .foreach {p f r}
3430: 20 5b 73 74 61 74 65 20 72 75 6e 20 7b 0a 09 09 [state run {...
3440: 53 45 4c 45 43 54 20 50 2e 6e 61 6d 65 20 2c 20 SELECT P.name ,
3450: 46 2e 6e 61 6d 65 2c 20 52 2e 72 65 76 0a 09 09 F.name, R.rev...
3460: 46 52 4f 4d 20 72 65 76 69 73 69 6f 6e 20 52 2c FROM revision R,
3470: 20 66 69 6c 65 20 46 2c 20 70 72 6f 6a 65 63 74 file F, project
3480: 20 50 0a 09 09 57 48 45 52 45 20 52 2e 72 69 64 P...WHERE R.rid
3490: 20 3d 20 24 69 64 0a 09 09 41 4e 44 20 20 20 52 = $id...AND R
34a0: 2e 66 69 64 20 3d 20 46 2e 66 69 64 0a 09 09 41 .fid = F.fid...A
34b0: 4e 44 20 20 20 46 2e 70 69 64 20 3d 20 50 2e 70 ND F.pid = P.p
34c0: 69 64 0a 09 7d 5d 20 62 72 65 61 6b 0a 09 72 65 id..}] break..re
34d0: 74 75 72 6e 20 22 27 24 70 20 3a 20 24 66 2f 24 turn "'$p : $f/$
34e0: 72 27 22 0a 20 20 20 20 7d 0a 0a 20 20 20 20 23 r'". }.. #
34f0: 20 50 72 69 6e 74 69 6e 67 20 6f 6e 65 20 6f 72 Printing one or
3500: 20 6d 6f 72 65 20 72 61 6e 67 65 73 2c 20 66 6f more ranges, fo
3510: 72 6d 61 74 74 65 64 2c 20 61 6e 64 20 6f 6e 6c rmatted, and onl
3520: 79 20 74 68 65 69 72 20 62 6f 72 64 65 72 20 74 y their border t
3530: 6f 0a 20 20 20 20 23 20 6b 65 65 70 20 74 68 65 o. # keep the
3540: 20 73 74 72 69 6e 67 73 20 73 68 6f 72 74 2e 0a strings short..
3550: 0a 20 20 20 20 70 72 6f 63 20 50 52 73 20 7b 72 . proc PRs {r
3560: 61 6e 67 65 73 7d 20 7b 0a 09 72 65 74 75 72 6e anges} {..return
3570: 20 5b 73 74 72 75 63 74 3a 3a 6c 69 73 74 20 6d [struct::list m
3580: 61 70 20 24 72 61 6e 67 65 73 20 5b 6d 79 70 72 ap $ranges [mypr
3590: 6f 63 20 50 52 5d 5d 0a 20 20 20 20 7d 0a 0a 20 oc PR]]. }..
35a0: 20 20 20 70 72 6f 63 20 50 52 20 7b 72 61 6e 67 proc PR {rang
35b0: 65 7d 20 7b 0a 09 42 6f 72 64 65 72 20 24 72 61 e} {..Border $ra
35c0: 6e 67 65 20 73 20 65 0a 09 72 65 74 75 72 6e 20 nge s e..return
35d0: 3c 24 7b 73 7d 2e 2e 2e 24 7b 65 7d 3e 0a 20 20 <${s}...${e}>.
35e0: 20 20 7d 0a 0a 20 20 20 20 70 72 6f 63 20 42 6f }.. proc Bo
35f0: 72 64 65 72 20 7b 72 61 6e 67 65 20 73 76 20 65 rder {range sv e
3600: 76 7d 20 7b 0a 09 75 70 76 61 72 20 31 20 24 73 v} {..upvar 1 $s
3610: 76 20 73 20 24 65 76 20 65 0a 09 73 65 74 20 73 v s $ev e..set s
3620: 20 5b 6c 69 6e 64 65 78 20 24 72 61 6e 67 65 20 [lindex $range
3630: 30 5d 0a 09 73 65 74 20 65 20 5b 6c 69 6e 64 65 0]..set e [linde
3640: 78 20 24 72 61 6e 67 65 20 65 6e 64 5d 0a 09 72 x $range end]..r
3650: 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 eturn. }..
3660: 20 23 20 23 20 23 23 20 23 23 23 20 23 23 23 23 # # ## ### ####
3670: 23 20 23 23 23 23 23 23 23 23 20 23 23 23 23 23 # ######## #####
3680: 23 23 23 23 23 23 23 23 0a 0a 20 20 20 20 74 79 ########.. ty
3690: 70 65 76 61 72 69 61 62 6c 65 20 6d 79 63 68 61 pevariable mycha
36a0: 6e 67 65 73 65 74 73 20 7b 7d 20 3b 20 23 20 4c ngesets {} ; # L
36b0: 69 73 74 20 6f 66 20 61 6c 6c 20 6b 6e 6f 77 6e ist of all known
36c0: 20 63 68 61 6e 67 65 73 65 74 73 2e 0a 0a 20 20 changesets...
36d0: 20 20 74 79 70 65 6d 65 74 68 6f 64 20 61 6c 6c typemethod all
36e0: 20 7b 7d 20 7b 0a 09 72 65 74 75 72 6e 20 24 6d {} {..return $m
36f0: 79 63 68 61 6e 67 65 73 65 74 73 0a 20 20 20 20 ychangesets.
3700: 7d 0a 0a 20 20 20 20 23 20 23 20 23 23 20 23 23 }.. # # ## ##
3710: 23 20 23 23 23 23 23 20 23 23 23 23 23 23 23 23 # ##### ########
3720: 20 23 23 23 23 23 23 23 23 23 23 23 23 23 0a 20 #############.
3730: 20 20 20 23 23 20 43 6f 6e 66 69 67 75 72 61 74 ## Configurat
3740: 69 6f 6e 0a 0a 20 20 20 20 70 72 61 67 6d 61 20 ion.. pragma
3750: 2d 68 61 73 74 79 70 65 69 6e 66 6f 20 20 20 20 -hastypeinfo
3760: 6e 6f 20 20 3b 20 23 20 6e 6f 20 74 79 70 65 20 no ; # no type
3770: 69 6e 74 72 6f 73 70 65 63 74 69 6f 6e 0a 20 20 introspection.
3780: 20 20 70 72 61 67 6d 61 20 2d 68 61 73 69 6e 66 pragma -hasinf
3790: 6f 20 20 20 20 20 20 20 20 6e 6f 20 20 3b 20 23 o no ; #
37a0: 20 6e 6f 20 6f 62 6a 65 63 74 20 69 6e 74 72 6f no object intro
37b0: 73 70 65 63 74 69 6f 6e 0a 20 20 20 20 70 72 61 spection. pra
37c0: 67 6d 61 20 2d 73 69 6d 70 6c 65 64 69 73 70 61 gma -simpledispa
37d0: 74 63 68 20 79 65 73 20 3b 20 23 20 73 69 6d 70 tch yes ; # simp
37e0: 6c 65 20 66 61 73 74 20 64 69 73 70 61 74 63 68 le fast dispatch
37f0: 0a 0a 20 20 20 20 23 20 23 20 23 23 20 23 23 23 .. # # ## ###
3800: 20 23 23 23 23 23 20 23 23 23 23 23 23 23 23 20 ##### ########
3810: 23 23 23 23 23 23 23 23 23 23 23 23 23 0a 7d 0a #############.}.
3820: 0a 6e 61 6d 65 73 70 61 63 65 20 65 76 61 6c 20 .namespace eval
3830: 3a 3a 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d ::vc::fossil::im
3840: 70 6f 72 74 3a 3a 63 76 73 3a 3a 70 72 6f 6a 65 port::cvs::proje
3850: 63 74 20 7b 0a 20 20 20 20 6e 61 6d 65 73 70 61 ct {. namespa
3860: 63 65 20 65 78 70 6f 72 74 20 72 65 76 0a 20 20 ce export rev.
3870: 20 20 6e 61 6d 65 73 70 61 63 65 20 65 76 61 6c namespace eval
3880: 20 72 65 76 20 7b 0a 09 6e 61 6d 65 73 70 61 63 rev {..namespac
3890: 65 20 69 6d 70 6f 72 74 20 3a 3a 76 63 3a 3a 66 e import ::vc::f
38a0: 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 ossil::import::c
38b0: 76 73 3a 3a 73 74 61 74 65 0a 09 6e 61 6d 65 73 vs::state..names
38c0: 70 61 63 65 20 69 6d 70 6f 72 74 20 3a 3a 76 63 pace import ::vc
38d0: 3a 3a 74 6f 6f 6c 73 3a 3a 6d 69 73 63 3a 3a 2a ::tools::misc::*
38e0: 0a 09 6e 61 6d 65 73 70 61 63 65 20 69 6d 70 6f ..namespace impo
38f0: 72 74 20 3a 3a 76 63 3a 3a 74 6f 6f 6c 73 3a 3a rt ::vc::tools::
3900: 74 72 6f 75 62 6c 65 0a 09 6e 61 6d 65 73 70 61 trouble..namespa
3910: 63 65 20 69 6d 70 6f 72 74 20 3a 3a 76 63 3a 3a ce import ::vc::
3920: 74 6f 6f 6c 73 3a 3a 6c 6f 67 0a 09 6c 6f 67 20 tools::log..log
3930: 72 65 67 69 73 74 65 72 20 63 73 65 74 73 0a 20 register csets.
3940: 20 20 20 7d 0a 7d 0a 0a 23 20 23 20 23 23 20 23 }.}..# # ## #
3950: 23 23 20 23 23 23 23 23 20 23 23 23 23 23 23 23 ## ##### #######
3960: 23 20 23 23 23 23 23 23 23 23 23 23 23 23 23 20 # #############
3970: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
3980: 23 23 23 23 23 0a 23 23 20 52 65 61 64 79 0a 0a #####.## Ready..
3990: 70 61 63 6b 61 67 65 20 70 72 6f 76 69 64 65 20 package provide
39a0: 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f vc::fossil::impo
39b0: 72 74 3a 3a 63 76 73 3a 3a 70 72 6f 6a 65 63 74 rt::cvs::project
39c0: 3a 3a 72 65 76 20 31 2e 30 0a 72 65 74 75 72 6e ::rev 1.0.return
39d0: 0a .