Artifact be1a345cb264d10b3b66296d8e4058d24c0cc6f8:
File
tools/cvs2fossil/lib/c2f_cyclebreaker.tcl
part of check-in
[3e18606b5c]
- Bugfix: Sort pending nodes fully deterministic, and moved to separate helper command. Tweaked log output.
by
aku on
2007-11-27 09:05:45.
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 54 68 69 ########..## Thi
0200: 73 20 66 69 6c 65 20 70 72 6f 76 69 64 65 73 20 s file provides
0210: 61 20 68 65 6c 70 65 72 20 70 61 63 6b 61 67 65 a helper package
0220: 20 66 6f 72 20 74 68 65 20 70 61 73 73 65 73 20 for the passes
0230: 36 20 61 6e 64 20 37 20 77 68 69 63 68 0a 23 23 6 and 7 which.##
0240: 20 63 6f 6e 74 61 69 6e 73 20 74 68 65 20 63 6f contains the co
0250: 6d 6d 6f 6e 20 63 6f 64 65 20 6f 66 20 74 68 65 mmon code of the
0260: 20 63 79 63 6c 65 20 62 72 65 61 6b 69 6e 67 20 cycle breaking
0270: 61 6c 67 6f 72 69 74 68 6d 2e 0a 0a 23 20 23 20 algorithm...# #
0280: 23 23 20 23 23 23 20 23 23 23 23 23 20 23 23 23 ## ### ##### ###
0290: 23 23 23 23 23 20 23 23 23 23 23 23 23 23 23 23 ##### ##########
02a0: 23 23 23 20 23 23 23 23 23 23 23 23 23 23 23 23 ### ############
02b0: 23 23 23 23 23 23 23 23 23 0a 23 23 20 52 65 71 #########.## Req
02c0: 75 69 72 65 6d 65 6e 74 73 0a 0a 70 61 63 6b 61 uirements..packa
02d0: 67 65 20 72 65 71 75 69 72 65 20 54 63 6c 20 38 ge require Tcl 8
02e0: 2e 34 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .4
02f0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0300: 20 20 20 20 20 3b 20 23 20 52 65 71 75 69 72 65 ; # Require
0310: 64 20 72 75 6e 74 69 6d 65 2e 0a 70 61 63 6b 61 d runtime..packa
0320: 67 65 20 72 65 71 75 69 72 65 20 73 6e 69 74 20 ge require snit
0330: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0340: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0350: 20 20 20 20 20 3b 20 23 20 4f 4f 20 73 79 73 74 ; # OO syst
0360: 65 6d 2e 0a 70 61 63 6b 61 67 65 20 72 65 71 75 em..package requ
0370: 69 72 65 20 73 74 72 75 63 74 3a 3a 67 72 61 70 ire struct::grap
0380: 68 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 h
0390: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 3b 20 ;
03a0: 23 20 47 72 61 70 68 20 68 61 6e 64 6c 69 6e 67 # Graph handling
03b0: 2e 0a 70 61 63 6b 61 67 65 20 72 65 71 75 69 72 ..package requir
03c0: 65 20 73 74 72 75 63 74 3a 3a 6c 69 73 74 20 20 e struct::list
03d0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
03e0: 20 20 20 20 20 20 20 20 20 20 20 20 3b 20 23 20 ; #
03f0: 48 69 67 68 65 72 20 6f 72 64 65 72 20 6c 69 73 Higher order lis
0400: 74 20 6f 70 65 72 61 74 69 6f 6e 73 2e 0a 70 61 t operations..pa
0410: 63 6b 61 67 65 20 72 65 71 75 69 72 65 20 76 63 ckage require vc
0420: 3a 3a 74 6f 6f 6c 73 3a 3a 64 6f 74 20 20 20 20 ::tools::dot
0430: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0440: 20 20 20 20 20 20 20 20 3b 20 23 20 55 73 65 72 ; # User
0450: 20 66 65 65 64 62 61 63 6b 2e 20 44 4f 54 20 65 feedback. DOT e
0460: 78 70 6f 72 74 2e 0a 70 61 63 6b 61 67 65 20 72 xport..package r
0470: 65 71 75 69 72 65 20 76 63 3a 3a 74 6f 6f 6c 73 equire vc::tools
0480: 3a 3a 6c 6f 67 20 20 20 20 20 20 20 20 20 20 20 ::log
0490: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
04a0: 20 3b 20 23 20 55 73 65 72 20 66 65 65 64 62 61 ; # User feedba
04b0: 63 6b 2e 0a 70 61 63 6b 61 67 65 20 72 65 71 75 ck..package requ
04c0: 69 72 65 20 76 63 3a 3a 74 6f 6f 6c 73 3a 3a 74 ire vc::tools::t
04d0: 72 6f 75 62 6c 65 20 20 20 20 20 20 20 20 20 20 rouble
04e0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 3b 20 ;
04f0: 23 20 45 72 72 6f 72 20 72 65 70 6f 72 74 69 6e # Error reportin
0500: 67 2e 0a 70 61 63 6b 61 67 65 20 72 65 71 75 69 g..package requi
0510: 72 65 20 76 63 3a 3a 74 6f 6f 6c 73 3a 3a 6d 69 re vc::tools::mi
0520: 73 63 20 20 20 20 20 20 20 20 20 20 20 20 20 20 sc
0530: 20 20 20 20 20 20 20 20 20 20 20 20 20 3b 20 23 ; #
0540: 20 54 65 78 74 20 66 6f 72 6d 61 74 74 69 6e 67 Text formatting
0550: 2e 0a 70 61 63 6b 61 67 65 20 72 65 71 75 69 72 ..package requir
0560: 65 20 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d e vc::fossil::im
0570: 70 6f 72 74 3a 3a 63 76 73 3a 3a 70 72 6f 6a 65 port::cvs::proje
0580: 63 74 3a 3a 72 65 76 20 20 20 20 20 3b 20 23 20 ct::rev ; #
0590: 50 72 6f 6a 65 63 74 20 6c 65 76 65 6c 20 63 68 Project level ch
05a0: 61 6e 67 65 73 65 74 73 0a 70 61 63 6b 61 67 65 angesets.package
05b0: 20 72 65 71 75 69 72 65 20 76 63 3a 3a 66 6f 73 require vc::fos
05c0: 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 sil::import::cvs
05d0: 3a 3a 70 72 6f 6a 65 63 74 3a 3a 72 65 76 6c 69 ::project::revli
05e0: 6e 6b 20 3b 20 23 20 43 79 63 6c 65 20 6c 69 6e nk ; # Cycle lin
05f0: 6b 73 2e 0a 0a 23 20 23 20 23 23 20 23 23 23 20 ks...# # ## ###
0600: 23 23 23 23 23 20 23 23 23 23 23 23 23 23 20 23 ##### ######## #
0610: 23 23 23 23 23 23 23 23 23 23 23 23 20 23 23 23 ############ ###
0620: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
0630: 23 23 0a 23 23 0a 0a 73 6e 69 74 3a 3a 74 79 70 ##.##..snit::typ
0640: 65 20 3a 3a 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a e ::vc::fossil::
0650: 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 63 79 63 import::cvs::cyc
0660: 6c 65 62 72 65 61 6b 65 72 20 7b 0a 20 20 20 20 lebreaker {.
0670: 23 20 23 20 23 23 20 23 23 23 20 23 23 23 23 23 # # ## ### #####
0680: 20 23 23 23 23 23 23 23 23 20 23 23 23 23 23 23 ######## ######
0690: 23 23 23 23 23 23 23 0a 20 20 20 20 23 23 20 50 #######. ## P
06a0: 75 62 6c 69 63 20 41 50 49 0a 0a 20 20 20 20 74 ublic API.. t
06b0: 79 70 65 6d 65 74 68 6f 64 20 70 72 65 63 6d 64 ypemethod precmd
06c0: 20 7b 63 6d 64 7d 20 7b 0a 09 3a 3a 76 61 72 69 {cmd} {..::vari
06d0: 61 62 6c 65 20 6d 79 70 72 65 63 6d 64 20 24 63 able myprecmd $c
06e0: 6d 64 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 7d md..return. }
06f0: 0a 0a 20 20 20 20 74 79 70 65 6d 65 74 68 6f 64 .. typemethod
0700: 20 73 61 76 65 63 6d 64 20 7b 63 6d 64 7d 20 7b savecmd {cmd} {
0710: 0a 09 3a 3a 76 61 72 69 61 62 6c 65 20 6d 79 73 ..::variable mys
0720: 61 76 65 63 6d 64 20 24 63 6d 64 0a 09 72 65 74 avecmd $cmd..ret
0730: 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 74 urn. }.. t
0740: 79 70 65 6d 65 74 68 6f 64 20 62 72 65 61 6b 63 ypemethod breakc
0750: 6d 64 20 7b 63 6d 64 7d 20 7b 0a 09 3a 3a 76 61 md {cmd} {..::va
0760: 72 69 61 62 6c 65 20 6d 79 62 72 65 61 6b 63 6d riable mybreakcm
0770: 64 20 24 63 6d 64 0a 09 72 65 74 75 72 6e 0a 20 d $cmd..return.
0780: 20 20 20 7d 0a 0a 20 20 20 20 23 20 23 20 23 23 }.. # # ##
0790: 20 23 23 23 20 23 23 23 23 23 20 23 23 23 23 23 ### ##### #####
07a0: 23 23 23 20 23 23 23 23 23 23 23 23 23 23 23 23 ### ############
07b0: 23 0a 0a 20 20 20 20 74 79 70 65 6d 65 74 68 6f #.. typemetho
07c0: 64 20 64 6f 74 73 74 6f 20 7b 70 61 74 68 7d 20 d dotsto {path}
07d0: 7b 0a 09 3a 3a 76 61 72 69 61 62 6c 65 20 6d 79 {..::variable my
07e0: 64 6f 74 64 65 73 74 69 6e 61 74 69 6f 6e 20 24 dotdestination $
07f0: 70 61 74 68 0a 09 72 65 74 75 72 6e 0a 20 20 20 path..return.
0800: 20 7d 0a 0a 20 20 20 20 74 79 70 65 6d 65 74 68 }.. typemeth
0810: 6f 64 20 77 61 74 63 68 20 7b 69 64 7d 20 7b 0a od watch {id} {.
0820: 09 3a 3a 76 61 72 69 61 62 6c 65 20 6d 79 77 61 .::variable mywa
0830: 74 63 68 69 64 73 0a 09 6c 61 70 70 65 6e 64 20 tchids..lappend
0840: 6d 79 77 61 74 63 68 69 64 73 20 24 69 64 0a 20 mywatchids $id.
0850: 20 20 20 7d 0a 0a 20 20 20 20 74 79 70 65 6d 65 }.. typeme
0860: 74 68 6f 64 20 64 6f 74 20 7b 6c 61 62 65 6c 20 thod dot {label
0870: 63 68 61 6e 67 65 73 65 74 73 7d 20 7b 0a 09 3a changesets} {..:
0880: 3a 76 61 72 69 61 62 6c 65 20 6d 79 64 6f 74 70 :variable mydotp
0890: 72 65 66 69 78 20 24 6c 61 62 65 6c 0a 09 3a 3a refix $label..::
08a0: 76 61 72 69 61 62 6c 65 20 6d 79 64 6f 74 69 64 variable mydotid
08b0: 20 20 20 20 20 30 0a 0a 09 73 65 74 20 64 67 20 0...set dg
08c0: 5b 53 65 74 75 70 20 24 63 68 61 6e 67 65 73 65 [Setup $changese
08d0: 74 73 20 30 5d 0a 09 4d 61 72 6b 20 24 64 67 0a ts 0]..Mark $dg.
08e0: 09 24 64 67 20 64 65 73 74 72 6f 79 0a 09 72 65 .$dg destroy..re
08f0: 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 turn. }..
0900: 74 79 70 65 6d 65 74 68 6f 64 20 6d 61 72 6b 20 typemethod mark
0910: 7b 67 72 61 70 68 20 73 75 66 66 69 78 20 7b 73 {graph suffix {s
0920: 75 62 67 72 61 70 68 20 7b 7d 7d 7d 20 7b 0a 09 ubgraph {}}} {..
0930: 4d 61 72 6b 20 24 67 72 61 70 68 20 24 73 75 66 Mark $graph $suf
0940: 66 69 78 20 24 73 75 62 67 72 61 70 68 0a 09 72 fix $subgraph..r
0950: 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 eturn. }..
0960: 20 23 20 23 20 23 23 20 23 23 23 20 23 23 23 23 # # ## ### ####
0970: 23 20 23 23 23 23 23 23 23 23 20 23 23 23 23 23 # ######## #####
0980: 23 23 23 23 23 23 23 23 0a 0a 20 20 20 20 74 79 ########.. ty
0990: 70 65 6d 65 74 68 6f 64 20 72 75 6e 20 7b 6c 61 pemethod run {la
09a0: 62 65 6c 20 63 68 61 6e 67 65 73 65 74 63 6d 64 bel changesetcmd
09b0: 7d 20 7b 0a 09 3a 3a 76 61 72 69 61 62 6c 65 20 } {..::variable
09c0: 6d 79 61 74 20 20 20 20 20 20 20 20 30 0a 09 3a myat 0..:
09d0: 3a 76 61 72 69 61 62 6c 65 20 6d 79 64 6f 74 70 :variable mydotp
09e0: 72 65 66 69 78 20 24 6c 61 62 65 6c 0a 09 3a 3a refix $label..::
09f0: 76 61 72 69 61 62 6c 65 20 6d 79 64 6f 74 69 64 variable mydotid
0a00: 20 20 20 20 20 30 0a 0a 09 23 20 57 65 20 63 72 0...# We cr
0a10: 65 61 74 65 20 61 20 67 72 61 70 68 20 6f 66 20 eate a graph of
0a20: 74 68 65 20 72 65 76 69 73 69 6f 6e 20 63 68 61 the revision cha
0a30: 6e 67 65 73 65 74 73 2c 20 75 73 69 6e 67 20 74 ngesets, using t
0a40: 68 65 20 66 69 6c 65 0a 09 23 20 6c 65 76 65 6c he file..# level
0a50: 20 64 65 70 65 6e 64 65 6e 63 69 65 73 20 74 6f dependencies to
0a60: 20 63 6f 6e 73 74 72 75 63 74 20 61 20 66 69 72 construct a fir
0a70: 73 74 20 61 70 70 72 6f 78 69 6d 61 74 69 6f 6e st approximation
0a80: 20 6f 66 20 74 68 65 0a 09 23 20 64 65 70 65 6e of the..# depen
0a90: 64 65 6e 63 69 65 73 20 61 74 20 74 68 65 20 70 dencies at the p
0aa0: 72 6f 6a 65 63 74 20 6c 65 76 65 6c 2e 20 54 68 roject level. Th
0ab0: 65 6e 20 77 65 20 6c 6f 6f 6b 20 66 6f 72 20 63 en we look for c
0ac0: 79 63 6c 65 73 0a 09 23 20 69 6e 20 74 68 61 74 ycles..# in that
0ad0: 20 67 72 61 70 68 20 61 6e 64 20 62 72 65 61 6b graph and break
0ae0: 20 74 68 65 6d 2e 0a 0a 09 23 20 31 2e 20 43 72 them....# 1. Cr
0af0: 65 61 74 65 20 6e 6f 64 65 73 20 66 6f 72 20 61 eate nodes for a
0b00: 6c 6c 20 72 65 6c 65 76 61 6e 74 20 63 68 61 6e ll relevant chan
0b10: 67 65 73 65 74 73 20 61 6e 64 20 61 20 6d 61 70 gesets and a map
0b20: 70 69 6e 67 0a 09 23 20 20 20 20 66 72 6f 6d 20 ping..# from
0b30: 74 68 65 20 72 65 76 69 73 69 6f 6e 73 20 74 6f the revisions to
0b40: 20 74 68 65 69 72 20 63 68 61 6e 67 65 73 65 74 their changeset
0b50: 73 2f 6e 6f 64 65 73 2e 0a 0a 09 73 65 74 20 63 s/nodes....set c
0b60: 68 61 6e 67 65 73 65 74 73 20 5b 75 70 6c 65 76 hangesets [uplev
0b70: 65 6c 20 23 30 20 24 63 68 61 6e 67 65 73 65 74 el #0 $changeset
0b80: 63 6d 64 5d 0a 09 73 65 74 20 64 67 20 5b 53 65 cmd]..set dg [Se
0b90: 74 75 70 20 24 63 68 61 6e 67 65 73 65 74 73 5d tup $changesets]
0ba0: 0a 0a 09 23 20 33 2e 20 4c 61 73 74 6c 79 20 77 ...# 3. Lastly w
0bb0: 65 20 69 74 65 72 61 74 65 20 74 68 65 20 67 72 e iterate the gr
0bc0: 61 70 68 20 74 6f 70 6f 6c 6f 67 69 63 61 6c 6c aph topologicall
0bd0: 79 2e 20 57 65 20 6d 61 72 6b 20 6f 66 66 0a 09 y. We mark off..
0be0: 23 20 20 20 20 74 68 65 20 6e 6f 64 65 73 20 77 # the nodes w
0bf0: 68 69 63 68 20 68 61 76 65 20 6e 6f 20 70 72 65 hich have no pre
0c00: 64 65 63 65 73 73 6f 72 73 2c 20 69 6e 20 6f 72 decessors, in or
0c10: 64 65 72 20 66 72 6f 6d 0a 09 23 20 20 20 20 6f der from..# o
0c20: 6c 64 65 73 74 20 74 6f 20 79 6f 75 6e 67 65 73 ldest to younges
0c30: 74 2c 20 73 61 76 69 6e 67 20 61 6e 64 20 72 65 t, saving and re
0c40: 6d 6f 76 69 6e 67 20 64 65 70 65 6e 64 65 6e 63 moving dependenc
0c50: 69 65 73 2e 20 49 66 0a 09 23 20 20 20 20 77 65 ies. If..# we
0c60: 20 66 69 6e 64 20 6e 6f 20 6e 6f 64 65 73 20 77 find no nodes w
0c70: 69 74 68 6f 75 74 20 70 72 65 64 65 63 65 73 73 ithout predecess
0c80: 6f 72 73 20 77 65 20 68 61 76 65 20 61 20 63 79 ors we have a cy
0c90: 63 6c 65 2c 0a 09 23 20 20 20 20 61 6e 64 20 77 cle,..# and w
0ca0: 6f 72 6b 20 6f 6e 20 62 72 65 61 6b 69 6e 67 20 ork on breaking
0cb0: 69 74 2e 0a 0a 09 6c 6f 67 20 77 72 69 74 65 20 it....log write
0cc0: 33 20 63 79 63 6c 65 62 72 65 61 6b 65 72 20 7b 3 cyclebreaker {
0cd0: 54 72 61 76 65 72 73 65 20 63 68 61 6e 67 65 73 Traverse changes
0ce0: 65 74 73 7d 0a 0a 09 49 6e 69 74 69 61 6c 69 7a ets}...Initializ
0cf0: 65 43 61 6e 64 69 64 61 74 65 73 20 24 64 67 0a eCandidates $dg.
0d00: 09 77 68 69 6c 65 20 7b 31 7d 20 7b 0a 09 20 20 .while {1} {..
0d10: 20 20 77 68 69 6c 65 20 7b 5b 57 69 74 68 6f 75 while {[Withou
0d20: 74 50 72 65 64 65 63 65 73 73 6f 72 20 24 64 67 tPredecessor $dg
0d30: 20 6e 5d 7d 20 7b 0a 09 09 4d 61 72 6b 57 61 74 n]} {...MarkWat
0d40: 63 68 20 24 64 67 0a 09 09 50 72 6f 63 65 73 73 ch $dg...Process
0d50: 65 64 48 6f 6f 6b 20 24 64 67 20 24 6e 20 24 6d edHook $dg $n $m
0d60: 79 61 74 0a 09 09 24 64 67 20 6e 6f 64 65 20 64 yat...$dg node d
0d70: 65 6c 65 74 65 20 24 6e 0a 09 09 69 6e 63 72 20 elete $n...incr
0d80: 6d 79 61 74 0a 09 09 53 68 6f 77 50 65 6e 64 69 myat...ShowPendi
0d90: 6e 67 4e 6f 64 65 73 0a 09 20 20 20 20 7d 0a 0a ngNodes.. }..
0da0: 09 20 20 20 20 69 66 20 7b 21 5b 6c 6c 65 6e 67 . if {![lleng
0db0: 74 68 20 5b 64 67 20 6e 6f 64 65 73 5d 5d 7d 20 th [dg nodes]]}
0dc0: 62 72 65 61 6b 0a 0a 09 20 20 20 20 42 72 65 61 break... Brea
0dd0: 6b 43 79 63 6c 65 48 6f 6f 6b 20 20 20 20 20 20 kCycleHook
0de0: 20 24 64 67 0a 09 20 20 20 20 49 6e 69 74 69 61 $dg.. Initia
0df0: 6c 69 7a 65 43 61 6e 64 69 64 61 74 65 73 20 24 lizeCandidates $
0e00: 64 67 0a 09 20 20 20 20 4d 61 72 6b 57 61 74 63 dg.. MarkWatc
0e10: 68 20 20 20 20 20 20 20 20 20 20 20 20 24 64 67 h $dg
0e20: 0a 09 7d 0a 0a 09 24 64 67 20 64 65 73 74 72 6f ..}...$dg destro
0e30: 79 0a 0a 09 6c 6f 67 20 77 72 69 74 65 20 33 20 y...log write 3
0e40: 63 79 63 6c 65 62 72 65 61 6b 65 72 20 44 6f 6e cyclebreaker Don
0e50: 65 2e 0a 09 43 6c 65 61 72 48 6f 6f 6b 73 0a 0a e...ClearHooks..
0e60: 09 23 20 52 65 72 65 61 64 20 74 68 65 20 67 72 .# Reread the gr
0e70: 61 70 68 20 61 6e 64 20 64 75 6d 70 20 69 74 73 aph and dump its
0e80: 20 66 69 6e 61 6c 20 66 6f 72 6d 2c 20 69 66 20 final form, if
0e90: 67 72 61 70 68 20 65 78 70 6f 72 74 0a 09 23 20 graph export..#
0ea0: 77 61 73 20 61 63 74 69 76 61 74 65 64 2e 0a 0a was activated...
0eb0: 09 3a 3a 76 61 72 69 61 62 6c 65 20 6d 79 64 6f .::variable mydo
0ec0: 74 64 65 73 74 69 6e 61 74 69 6f 6e 0a 09 69 66 tdestination..if
0ed0: 20 7b 24 6d 79 64 6f 74 64 65 73 74 69 6e 61 74 {$mydotdestinat
0ee0: 69 6f 6e 20 65 71 20 22 22 7d 20 72 65 74 75 72 ion eq ""} retur
0ef0: 6e 0a 0a 09 73 65 74 20 20 20 64 67 20 5b 53 65 n...set dg [Se
0f00: 74 75 70 20 5b 75 70 6c 65 76 65 6c 20 23 30 20 tup [uplevel #0
0f10: 24 63 68 61 6e 67 65 73 65 74 63 6d 64 5d 20 30 $changesetcmd] 0
0f20: 5d 0a 09 4d 61 72 6b 20 24 64 67 20 2d 64 6f 6e ]..Mark $dg -don
0f30: 65 0a 09 24 64 67 20 64 65 73 74 72 6f 79 0a 09 e..$dg destroy..
0f40: 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 return. }..
0f50: 20 20 23 20 23 20 23 23 20 23 23 23 20 23 23 23 # # ## ### ###
0f60: 23 23 20 23 23 23 23 23 23 23 23 20 23 23 23 23 ## ######## ####
0f70: 23 23 23 23 23 23 23 23 23 0a 0a 20 20 20 20 74 #########.. t
0f80: 79 70 65 6d 65 74 68 6f 64 20 62 72 65 61 6b 2d ypemethod break-
0f90: 73 65 67 6d 65 6e 74 20 7b 67 72 61 70 68 7d 20 segment {graph}
0fa0: 7b 0a 09 42 72 65 61 6b 53 65 67 6d 65 6e 74 20 {..BreakSegment
0fb0: 24 67 72 61 70 68 20 24 70 61 74 68 20 22 73 65 $graph $path "se
0fc0: 67 6d 65 6e 74 20 28 5b 70 72 6f 6a 65 63 74 3a gment ([project:
0fd0: 3a 72 65 76 20 73 74 72 6c 69 73 74 20 24 70 61 :rev strlist $pa
0fe0: 74 68 5d 29 22 0a 09 72 65 74 75 72 6e 0a 20 20 th])"..return.
0ff0: 20 20 7d 0a 0a 20 20 20 20 74 79 70 65 6d 65 74 }.. typemet
1000: 68 6f 64 20 62 72 65 61 6b 20 7b 67 72 61 70 68 hod break {graph
1010: 7d 20 7b 0a 09 73 65 74 20 63 79 63 6c 65 20 5b } {..set cycle [
1020: 46 69 6e 64 43 79 63 6c 65 20 24 67 72 61 70 68 FindCycle $graph
1030: 5d 0a 09 73 65 74 20 6c 61 62 65 6c 20 22 63 79 ]..set label "cy
1040: 63 6c 65 20 28 5b 70 72 6f 6a 65 63 74 3a 3a 72 cle ([project::r
1050: 65 76 20 73 74 72 6c 69 73 74 20 24 63 79 63 6c ev strlist $cycl
1060: 65 5d 29 22 0a 0a 09 23 20 4e 4f 54 45 3a 20 63 e])"...# NOTE: c
1070: 76 73 32 73 76 6e 20 75 73 65 73 20 74 68 65 20 vs2svn uses the
1080: 73 65 71 75 65 6e 63 65 20 22 65 6e 64 2d 31 2c sequence "end-1,
1090: 20 63 79 63 6c 65 2c 20 30 22 20 74 6f 20 63 72 cycle, 0" to cr
10a0: 65 61 74 65 0a 09 23 20 20 20 20 20 20 20 74 68 eate..# th
10b0: 65 20 70 61 74 68 20 66 72 6f 6d 20 74 68 65 20 e path from the
10c0: 63 79 63 6c 65 2e 20 54 68 65 20 6f 6e 6c 79 20 cycle. The only
10d0: 65 66 66 65 63 74 20 49 20 63 61 6e 20 73 65 65 effect I can see
10e0: 20 69 73 0a 09 23 20 20 20 20 20 20 20 74 68 61 is..# tha
10f0: 74 20 74 68 69 73 20 63 61 75 73 65 73 20 74 68 t this causes th
1100: 65 20 6c 69 6e 6b 2d 74 72 69 70 6c 65 73 20 74 e link-triples t
1110: 6f 20 62 65 20 67 65 6e 65 72 61 74 65 64 20 69 o be generated i
1120: 6e 20 61 0a 09 23 20 20 20 20 20 20 20 73 69 67 n a..# sig
1130: 68 74 6c 79 20 64 69 66 66 65 72 65 6e 74 20 6f htly different o
1140: 72 64 65 72 2c 20 69 2e 65 2e 20 6f 6e 65 20 6c rder, i.e. one l
1150: 69 6e 6b 20 72 6f 74 61 74 65 64 20 74 6f 20 74 ink rotated to t
1160: 68 65 0a 09 23 20 20 20 20 20 20 20 72 69 67 68 he..# righ
1170: 74 2e 20 54 68 69 73 20 73 68 6f 75 6c 64 20 68 t. This should h
1180: 61 76 65 20 6e 6f 20 65 66 66 65 63 74 20 6f 6e ave no effect on
1190: 20 74 68 65 20 73 65 61 72 63 68 20 66 6f 72 0a the search for.
11a0: 09 23 20 20 20 20 20 20 20 74 68 65 20 62 65 73 .# the bes
11b0: 74 20 6f 66 20 61 6c 6c 2e 0a 0a 09 6c 61 70 70 t of all....lapp
11c0: 65 6e 64 20 63 79 63 6c 65 20 5b 6c 69 6e 64 65 end cycle [linde
11d0: 78 20 24 63 79 63 6c 65 20 30 5d 20 5b 6c 69 6e x $cycle 0] [lin
11e0: 64 65 78 20 24 63 79 63 6c 65 20 31 5d 0a 09 42 dex $cycle 1]..B
11f0: 72 65 61 6b 53 65 67 6d 65 6e 74 20 24 67 72 61 reakSegment $gra
1200: 70 68 20 24 63 79 63 6c 65 20 24 6c 61 62 65 6c ph $cycle $label
1210: 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a ..return. }..
1220: 20 20 20 20 74 79 70 65 6d 65 74 68 6f 64 20 72 typemethod r
1230: 65 70 6c 61 63 65 20 7b 67 72 61 70 68 20 6e 20 eplace {graph n
1240: 72 65 70 6c 61 63 65 6d 65 6e 74 73 7d 20 7b 0a replacements} {.
1250: 09 52 65 70 6c 61 63 65 20 24 67 72 61 70 68 20 .Replace $graph
1260: 24 6e 20 24 72 65 70 6c 61 63 65 6d 65 6e 74 73 $n $replacements
1270: 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a ..return. }..
1280: 20 20 20 20 23 20 23 20 23 23 20 23 23 23 20 23 # # ## ### #
1290: 23 23 23 23 20 23 23 23 23 23 23 23 23 20 23 23 #### ######## ##
12a0: 23 23 23 23 23 23 23 23 23 23 23 0a 20 20 20 20 ###########.
12b0: 23 23 20 49 6e 74 65 72 6e 61 6c 20 6d 65 74 68 ## Internal meth
12c0: 6f 64 73 0a 0a 20 20 20 20 70 72 6f 63 20 53 65 ods.. proc Se
12d0: 74 75 70 20 7b 63 68 61 6e 67 65 73 65 74 73 20 tup {changesets
12e0: 7b 6c 6f 67 20 31 7d 7d 20 7b 0a 09 69 66 20 7b {log 1}} {..if {
12f0: 24 6c 6f 67 7d 20 7b 0a 09 20 20 20 20 6c 6f 67 $log} {.. log
1300: 20 77 72 69 74 65 20 33 20 63 79 63 6c 65 62 72 write 3 cyclebr
1310: 65 61 6b 65 72 20 22 43 72 65 61 74 69 6e 67 20 eaker "Creating
1320: 67 72 61 70 68 20 6f 66 20 63 68 61 6e 67 65 73 graph of changes
1330: 65 74 73 22 0a 09 7d 0a 0a 09 73 65 74 20 64 67 ets"..}...set dg
1340: 20 5b 73 74 72 75 63 74 3a 3a 67 72 61 70 68 20 [struct::graph
1350: 64 67 5d 0a 0a 09 66 6f 72 65 61 63 68 20 63 73 dg]...foreach cs
1360: 65 74 20 24 63 68 61 6e 67 65 73 65 74 73 20 7b et $changesets {
1370: 0a 09 20 20 20 20 73 65 74 20 74 72 20 5b 24 63 .. set tr [$c
1380: 73 65 74 20 74 69 6d 65 72 61 6e 67 65 5d 0a 09 set timerange]..
1390: 20 20 20 20 24 64 67 20 6e 6f 64 65 20 69 6e 73 $dg node ins
13a0: 65 72 74 20 24 63 73 65 74 0a 09 20 20 20 20 24 ert $cset.. $
13b0: 64 67 20 6e 6f 64 65 20 73 65 74 20 20 20 20 24 dg node set $
13c0: 63 73 65 74 20 74 69 6d 65 72 61 6e 67 65 20 24 cset timerange $
13d0: 74 72 0a 09 20 20 20 20 24 64 67 20 6e 6f 64 65 tr.. $dg node
13e0: 20 73 65 74 20 20 20 20 24 63 73 65 74 20 6c 61 set $cset la
13f0: 62 65 6c 20 20 20 20 20 22 5b 24 63 73 65 74 20 bel "[$cset
1400: 73 74 72 5d 5c 5c 6e 5b 6a 6f 69 6e 20 5b 73 74 str]\\n[join [st
1410: 72 75 63 74 3a 3a 6c 69 73 74 20 6d 61 70 20 24 ruct::list map $
1420: 74 72 20 7b 3a 3a 63 6c 6f 63 6b 20 66 6f 72 6d tr {::clock form
1430: 61 74 7d 5d 20 22 5c 5c 6e 22 5d 22 0a 09 20 20 at}] "\\n"]"..
1440: 20 20 24 64 67 20 6e 6f 64 65 20 73 65 74 20 20 $dg node set
1450: 20 20 24 63 73 65 74 20 5f 5f 69 64 5f 5f 20 20 $cset __id__
1460: 20 20 5b 24 63 73 65 74 20 69 64 5d 0a 09 20 20 [$cset id]..
1470: 20 20 24 64 67 20 6e 6f 64 65 20 73 65 74 20 20 $dg node set
1480: 20 20 24 63 73 65 74 20 73 68 61 70 65 20 20 20 $cset shape
1490: 20 20 5b 65 78 70 72 20 7b 5b 24 63 73 65 74 20 [expr {[$cset
14a0: 62 79 73 79 6d 62 6f 6c 5d 0a 09 09 09 09 09 09 bysymbol].......
14b0: 20 20 20 3f 20 22 65 6c 6c 69 70 73 65 22 0a 09 ? "ellipse"..
14c0: 09 09 09 09 09 20 20 20 3a 20 22 62 6f 78 22 7d ..... : "box"}
14d0: 5d 0a 09 7d 0a 0a 09 69 66 20 7b 24 6c 6f 67 7d ]..}...if {$log}
14e0: 20 7b 0a 09 20 20 20 20 6c 6f 67 20 77 72 69 74 {.. log writ
14f0: 65 20 33 20 63 79 63 6c 65 62 72 65 61 6b 65 72 e 3 cyclebreaker
1500: 20 22 48 61 73 20 5b 6e 73 70 20 5b 6c 6c 65 6e "Has [nsp [llen
1510: 67 74 68 20 24 63 68 61 6e 67 65 73 65 74 73 5d gth $changesets]
1520: 20 63 68 61 6e 67 65 73 65 74 5d 22 0a 09 7d 0a changeset]"..}.
1530: 0a 09 23 20 32 2e 20 46 69 6e 64 20 66 6f 72 20 ..# 2. Find for
1540: 61 6c 6c 20 72 65 6c 65 76 61 6e 74 20 63 68 61 all relevant cha
1550: 6e 67 65 73 65 74 20 74 68 65 69 72 20 72 65 76 ngeset their rev
1560: 69 73 69 6f 6e 73 20 61 6e 64 20 74 68 65 69 72 isions and their
1570: 0a 09 23 20 20 20 20 64 65 70 65 6e 64 65 6e 63 ..# dependenc
1580: 69 65 73 2e 20 4d 61 70 20 74 68 65 20 6c 61 74 ies. Map the lat
1590: 74 65 72 20 62 61 63 6b 20 74 6f 20 63 68 61 6e ter back to chan
15a0: 67 65 73 65 74 73 20 61 6e 64 0a 09 23 20 20 20 gesets and..#
15b0: 20 63 6f 6e 73 74 72 75 63 74 20 74 68 65 20 63 construct the c
15c0: 6f 72 72 65 73 70 6f 6e 64 69 6e 67 20 61 72 63 orresponding arc
15d0: 73 2e 0a 0a 09 66 6f 72 65 61 63 68 20 63 73 65 s....foreach cse
15e0: 74 20 24 63 68 61 6e 67 65 73 65 74 73 20 7b 0a t $changesets {.
15f0: 09 20 20 20 20 66 6f 72 65 61 63 68 20 73 75 63 . foreach suc
1600: 63 20 5b 24 63 73 65 74 20 73 75 63 63 65 73 73 c [$cset success
1610: 6f 72 73 5d 20 7b 0a 09 09 23 20 43 68 61 6e 67 ors] {...# Chang
1620: 65 73 65 74 73 20 6d 61 79 20 68 61 76 65 20 64 esets may have d
1630: 65 70 65 6e 64 65 6e 63 69 65 73 20 6f 75 74 73 ependencies outs
1640: 69 64 65 20 6f 66 20 74 68 65 0a 09 09 23 20 63 ide of the...# c
1650: 68 6f 73 65 6e 20 73 65 74 2e 20 54 68 65 73 65 hosen set. These
1660: 20 61 72 65 20 69 67 6e 6f 72 65 64 0a 09 09 69 are ignored...i
1670: 66 20 7b 21 5b 24 64 67 20 6e 6f 64 65 20 65 78 f {![$dg node ex
1680: 69 73 74 73 20 24 73 75 63 63 5d 7d 20 63 6f 6e ists $succ]} con
1690: 74 69 6e 75 65 0a 09 09 24 64 67 20 61 72 63 20 tinue...$dg arc
16a0: 69 6e 73 65 72 74 20 24 63 73 65 74 20 24 73 75 insert $cset $su
16b0: 63 63 0a 0a 09 09 23 20 43 68 65 63 6b 20 66 6f cc....# Check fo
16c0: 72 20 63 68 61 6e 67 65 73 65 74 73 20 72 65 66 r changesets ref
16d0: 65 72 65 6e 63 69 6e 67 20 74 68 65 6d 73 65 6c erencing themsel
16e0: 76 65 73 2e 20 53 75 63 68 20 61 0a 09 09 23 20 ves. Such a...#
16f0: 6c 6f 6f 70 20 73 68 6f 77 73 20 74 68 61 74 20 loop shows that
1700: 74 68 65 20 63 68 61 6e 67 65 73 65 74 20 69 6e the changeset in
1710: 20 71 75 65 73 74 69 6f 6e 20 68 61 73 0a 09 09 question has...
1720: 23 20 69 6e 74 65 72 6e 61 6c 20 64 65 70 65 6e # internal depen
1730: 64 65 6e 63 69 65 73 2e 20 53 6f 6d 65 74 68 69 dencies. Somethi
1740: 6e 67 20 77 68 69 63 68 20 69 73 20 73 75 70 70 ng which is supp
1750: 6f 73 65 64 0a 09 09 23 20 74 6f 20 62 65 20 6e osed...# to be n
1760: 6f 74 20 70 6f 73 73 69 62 6c 65 2c 20 61 73 20 ot possible, as
1770: 70 61 73 73 20 35 20 28 49 6e 69 74 43 73 65 74 pass 5 (InitCset
1780: 73 29 20 74 61 6b 65 73 20 63 61 72 65 0a 09 09 s) takes care...
1790: 23 20 74 6f 20 74 72 61 6e 73 66 6f 72 6d 20 69 # to transform i
17a0: 6e 74 65 72 6e 61 6c 20 69 6e 74 6f 20 65 78 74 nternal into ext
17b0: 65 72 6e 61 6c 20 64 65 70 65 6e 64 65 6e 63 69 ernal dependenci
17c0: 65 73 20 62 79 0a 09 09 23 20 62 72 65 61 6b 69 es by...# breaki
17d0: 6e 67 20 74 68 65 20 72 65 6c 65 76 61 6e 74 20 ng the relevant
17e0: 63 68 61 6e 67 65 73 65 74 73 20 61 70 61 72 74 changesets apart
17f0: 2e 20 53 6f 20 68 61 76 69 6e 67 0a 09 09 23 20 . So having...#
1800: 6f 6e 65 20 69 6e 64 69 63 61 74 65 73 20 62 69 one indicates bi
1810: 67 20 74 72 6f 75 62 6c 65 20 69 6e 20 70 61 73 g trouble in pas
1820: 73 20 35 2e 20 57 65 20 72 65 70 6f 72 74 20 74 s 5. We report t
1830: 68 65 6d 0a 09 09 23 20 61 6e 64 20 64 75 6d 70 hem...# and dump
1840: 20 69 6e 74 65 72 6e 61 6c 20 73 74 72 75 63 74 internal struct
1850: 75 72 65 73 20 74 6f 20 6d 61 6b 65 20 69 74 20 ures to make it
1860: 65 61 73 69 65 72 20 74 6f 0a 09 09 23 20 74 72 easier to...# tr
1870: 61 63 65 20 74 68 65 20 6c 69 6e 6b 73 20 63 61 ace the links ca
1880: 75 73 69 6e 67 20 74 68 65 20 70 72 6f 62 6c 65 using the proble
1890: 6d 2e 0a 09 09 69 66 20 7b 24 73 75 63 63 20 65 m....if {$succ e
18a0: 71 20 24 63 73 65 74 7d 20 7b 0a 09 09 20 20 20 q $cset} {...
18b0: 20 74 72 6f 75 62 6c 65 20 66 61 74 61 6c 20 22 trouble fatal "
18c0: 53 65 6c 66 2d 72 65 66 65 72 65 6e 63 69 6e 67 Self-referencing
18d0: 20 63 68 61 6e 67 65 73 65 74 20 5b 24 63 73 65 changeset [$cse
18e0: 74 20 73 74 72 5d 22 0a 09 09 20 20 20 20 6c 6f t str]"... lo
18f0: 67 20 77 72 69 74 65 20 32 20 63 79 63 6c 65 62 g write 2 cycleb
1900: 72 65 61 6b 65 72 20 22 4c 4f 4f 50 20 63 68 61 reaker "LOOP cha
1910: 6e 67 65 73 65 74 20 5b 24 63 73 65 74 20 73 74 ngeset [$cset st
1920: 72 5d 20 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f r] _____________
1930: 5f 5f 5f 5f 5f 22 0a 09 09 20 20 20 20 61 72 72 _____"... arr
1940: 61 79 20 73 65 74 20 6e 6d 61 70 20 5b 24 63 73 ay set nmap [$cs
1950: 65 74 20 6e 65 78 74 6d 61 70 5d 0a 09 09 20 20 et nextmap]...
1960: 20 20 66 6f 72 65 61 63 68 20 72 20 5b 6c 73 6f foreach r [lso
1970: 72 74 20 2d 64 69 63 74 20 5b 61 72 72 61 79 20 rt -dict [array
1980: 6e 61 6d 65 73 20 6e 6d 61 70 5d 5d 20 7b 0a 09 names nmap]] {..
1990: 09 09 66 6f 72 65 61 63 68 20 73 75 63 63 72 65 ..foreach succre
19a0: 76 20 24 6e 6d 61 70 28 24 72 29 20 7b 0a 09 09 v $nmap($r) {...
19b0: 09 20 20 20 20 6c 6f 67 20 77 72 69 74 65 20 32 . log write 2
19c0: 20 63 79 63 6c 65 62 72 65 61 6b 65 72 20 5c 0a cyclebreaker \.
19d0: 09 09 09 09 22 4c 4f 4f 50 20 2a 20 72 65 76 20 ...."LOOP * rev
19e0: 3c 24 72 3e 20 2d 2d 3e 20 72 65 76 20 3c 24 73 <$r> --> rev <$s
19f0: 75 63 63 72 65 76 3e 20 2d 2d 3e 20 63 73 20 5b uccrev> --> cs [
1a00: 70 72 6f 6a 65 63 74 3a 3a 72 65 76 20 73 74 72 project::rev str
1a10: 6c 69 73 74 20 5b 70 72 6f 6a 65 63 74 3a 3a 72 list [project::r
1a20: 65 76 20 6f 66 72 65 76 20 24 73 75 63 63 72 65 ev ofrev $succre
1a30: 76 5d 5d 22 0a 09 09 09 7d 0a 09 09 20 20 20 20 v]]"....}...
1a40: 7d 0a 09 09 7d 0a 09 20 20 20 20 7d 0a 09 7d 0a }...}.. }..}.
1a50: 0a 09 69 66 20 7b 24 6c 6f 67 7d 20 7b 0a 09 20 ..if {$log} {..
1a60: 20 20 20 6c 6f 67 20 77 72 69 74 65 20 33 20 63 log write 3 c
1a70: 79 63 6c 65 62 72 65 61 6b 65 72 20 22 48 61 73 yclebreaker "Has
1a80: 20 5b 6e 73 70 20 5b 6c 6c 65 6e 67 74 68 20 5b [nsp [llength [
1a90: 24 64 67 20 61 72 63 73 5d 5d 20 64 65 70 65 6e $dg arcs]] depen
1aa0: 64 65 6e 63 79 20 64 65 70 65 6e 64 65 6e 63 69 dency dependenci
1ab0: 65 73 5d 22 0a 09 7d 0a 0a 09 23 20 52 75 6e 20 es]"..}...# Run
1ac0: 74 68 65 20 75 73 65 72 20 68 6f 6f 6b 20 74 6f the user hook to
1ad0: 20 6d 61 6e 69 70 75 6c 61 74 65 20 74 68 65 20 manipulate the
1ae0: 67 72 61 70 68 20 62 65 66 6f 72 65 0a 09 23 20 graph before..#
1af0: 63 6f 6e 73 75 6d 6d 61 74 69 6f 6e 2e 0a 0a 09 consummation....
1b00: 69 66 20 7b 24 6c 6f 67 7d 20 7b 20 4d 61 72 6b if {$log} { Mark
1b10: 20 24 64 67 20 2d 73 74 61 72 74 20 7d 0a 09 4d $dg -start }..M
1b20: 61 72 6b 57 61 74 63 68 20 24 64 67 0a 09 50 72 arkWatch $dg..Pr
1b30: 65 48 6f 6f 6b 20 20 20 24 64 67 0a 09 4d 61 72 eHook $dg..Mar
1b40: 6b 57 61 74 63 68 20 24 64 67 0a 0a 09 23 20 54 kWatch $dg...# T
1b50: 68 69 73 20 6b 69 6c 6c 73 20 74 68 65 20 61 70 his kills the ap
1b60: 70 6c 69 63 61 74 69 6f 6e 20 69 66 20 6c 6f 6f plication if loo
1b70: 70 73 20 28 73 65 65 20 61 62 6f 76 65 29 20 77 ps (see above) w
1b80: 65 72 65 20 66 6f 75 6e 64 2e 0a 09 74 72 6f 75 ere found...trou
1b90: 62 6c 65 20 61 62 6f 72 74 3f 0a 09 72 65 74 75 ble abort?..retu
1ba0: 72 6e 20 20 24 64 67 0a 20 20 20 20 7d 0a 0a 20 rn $dg. }..
1bb0: 20 20 20 23 20 49 6e 73 74 65 61 64 20 6f 66 20 # Instead of
1bc0: 73 65 61 72 63 68 69 6e 67 20 74 68 65 20 77 68 searching the wh
1bd0: 6f 6c 65 20 67 72 61 70 68 20 66 6f 72 20 74 68 ole graph for th
1be0: 65 20 64 65 67 72 65 65 2d 30 20 6e 6f 64 65 73 e degree-0 nodes
1bf0: 20 69 6e 0a 20 20 20 20 23 20 65 61 63 68 20 69 in. # each i
1c00: 74 65 72 61 74 69 6f 6e 20 77 65 20 63 6f 6d 70 teration we comp
1c10: 75 74 65 20 74 68 65 20 6c 69 73 74 20 6f 6e 63 ute the list onc
1c20: 65 20 74 6f 20 73 74 61 72 74 2c 20 61 6e 64 20 e to start, and
1c30: 74 68 65 6e 20 6f 6e 6c 79 0a 20 20 20 20 23 20 then only. #
1c40: 75 70 64 61 74 65 20 69 74 20 69 6e 63 72 65 6d update it increm
1c50: 65 6e 74 61 6c 6c 79 20 62 61 73 65 64 20 6f 6e entally based on
1c60: 20 74 68 65 20 6f 75 74 67 6f 69 6e 67 20 6e 65 the outgoing ne
1c70: 69 67 68 62 6f 75 72 73 20 6f 66 20 74 68 65 0a ighbours of the.
1c80: 20 20 20 20 23 20 6e 6f 64 65 20 63 68 6f 73 65 # node chose
1c90: 6e 20 66 6f 72 20 63 6f 6d 6d 69 74 2e 0a 0a 20 n for commit...
1ca0: 20 20 20 70 72 6f 63 20 49 6e 69 74 69 61 6c 69 proc Initiali
1cb0: 7a 65 43 61 6e 64 69 64 61 74 65 73 20 7b 64 67 zeCandidates {dg
1cc0: 7d 20 7b 0a 09 23 20 62 6f 74 74 6f 6d 20 3d 20 } {..# bottom =
1cd0: 6c 69 73 74 20 28 6c 69 73 74 20 28 6e 6f 64 65 list (list (node
1ce0: 2c 20 72 61 6e 67 65 20 6d 69 6e 2c 20 72 61 6e , range min, ran
1cf0: 67 65 20 6d 61 78 29 29 0a 09 3a 3a 76 61 72 69 ge max))..::vari
1d00: 61 62 6c 65 20 6d 79 62 6f 74 74 6f 6d 0a 09 66 able mybottom..f
1d10: 6f 72 65 61 63 68 20 6e 20 5b 24 64 67 20 6e 6f oreach n [$dg no
1d20: 64 65 73 5d 20 7b 0a 09 20 20 20 20 69 66 20 7b des] {.. if {
1d30: 5b 24 64 67 20 6e 6f 64 65 20 64 65 67 72 65 65 [$dg node degree
1d40: 20 2d 69 6e 20 24 6e 5d 7d 20 63 6f 6e 74 69 6e -in $n]} contin
1d50: 75 65 0a 09 20 20 20 20 6c 61 70 70 65 6e 64 20 ue.. lappend
1d60: 6d 79 62 6f 74 74 6f 6d 20 5b 6c 69 6e 73 65 72 mybottom [linser
1d70: 74 20 5b 24 64 67 20 6e 6f 64 65 20 67 65 74 20 t [$dg node get
1d80: 24 6e 20 74 69 6d 65 72 61 6e 67 65 5d 20 30 20 $n timerange] 0
1d90: 24 6e 5d 0a 09 7d 0a 09 53 63 68 65 64 75 6c 65 $n]..}..Schedule
1da0: 43 61 6e 64 69 64 61 74 65 73 0a 09 53 68 6f 77 Candidates..Show
1db0: 50 65 6e 64 69 6e 67 4e 6f 64 65 73 0a 09 72 65 PendingNodes..re
1dc0: 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 turn. }..
1dd0: 70 72 6f 63 20 57 69 74 68 6f 75 74 50 72 65 64 proc WithoutPred
1de0: 65 63 65 73 73 6f 72 20 7b 64 67 20 6e 76 7d 20 ecessor {dg nv}
1df0: 7b 0a 09 3a 3a 76 61 72 69 61 62 6c 65 20 6d 79 {..::variable my
1e00: 62 6f 74 74 6f 6d 0a 0a 09 75 70 76 61 72 20 31 bottom...upvar 1
1e10: 20 24 6e 76 20 6e 0a 09 69 66 20 7b 21 5b 6c 6c $nv n..if {![ll
1e20: 65 6e 67 74 68 20 24 6d 79 62 6f 74 74 6f 6d 5d ength $mybottom]
1e30: 7d 20 7b 20 72 65 74 75 72 6e 20 30 20 7d 0a 0a } { return 0 }..
1e40: 09 73 65 74 20 6e 20 5b 6c 69 6e 64 65 78 20 5b .set n [lindex [
1e50: 6c 69 6e 64 65 78 20 24 6d 79 62 6f 74 74 6f 6d lindex $mybottom
1e60: 20 30 5d 20 30 5d 0a 09 73 65 74 20 6d 79 62 6f 0] 0]..set mybo
1e70: 74 74 6f 6d 20 5b 6c 72 61 6e 67 65 20 24 6d 79 ttom [lrange $my
1e80: 62 6f 74 74 6f 6d 20 31 20 65 6e 64 5d 0a 09 73 bottom 1 end]..s
1e90: 65 74 20 63 68 61 6e 67 65 64 20 30 0a 0a 09 23 et changed 0...#
1ea0: 20 55 70 64 61 74 65 20 6c 69 73 74 20 6f 66 20 Update list of
1eb0: 6e 6f 64 65 73 20 77 69 74 68 6f 75 74 20 70 72 nodes without pr
1ec0: 65 64 65 63 65 73 73 6f 72 2c 20 62 61 73 65 64 edecessor, based
1ed0: 20 6f 6e 20 74 68 65 0a 09 23 20 6f 75 74 67 6f on the..# outgo
1ee0: 69 6e 67 20 6e 65 69 67 68 62 6f 75 72 73 20 6f ing neighbours o
1ef0: 66 20 74 68 65 20 63 68 6f 73 65 6e 20 6e 6f 64 f the chosen nod
1f00: 65 2e 20 54 68 69 73 20 73 68 6f 75 6c 64 20 62 e. This should b
1f10: 65 0a 09 23 20 66 61 73 74 65 72 20 74 68 61 6e e..# faster than
1f20: 20 69 74 65 72 61 74 69 6e 67 20 6f 66 20 74 68 iterating of th
1f30: 65 20 77 68 6f 6c 65 20 73 65 74 20 6f 66 20 6e e whole set of n
1f40: 6f 64 65 73 2c 20 66 69 6e 64 69 6e 67 20 61 6c odes, finding al
1f50: 6c 0a 09 23 20 77 69 74 68 6f 75 74 20 70 72 65 l..# without pre
1f60: 64 65 63 65 73 73 6f 72 73 2c 20 73 6f 72 74 69 decessors, sorti
1f70: 6e 67 20 74 68 65 6d 20 62 79 20 74 69 6d 65 2c ng them by time,
1f80: 20 65 74 63 2e 20 70 70 2e 0a 09 66 6f 72 65 61 etc. pp...forea
1f90: 63 68 20 6f 75 74 20 5b 24 64 67 20 6e 6f 64 65 ch out [$dg node
1fa0: 73 20 2d 6f 75 74 20 24 6e 5d 20 7b 0a 09 20 20 s -out $n] {..
1fb0: 20 20 69 66 20 7b 5b 24 64 67 20 6e 6f 64 65 20 if {[$dg node
1fc0: 64 65 67 72 65 65 20 2d 69 6e 20 24 6f 75 74 5d degree -in $out]
1fd0: 20 3e 20 31 7d 20 63 6f 6e 74 69 6e 75 65 0a 09 > 1} continue..
1fe0: 20 20 20 20 23 20 44 65 67 72 65 65 2d 31 20 6e # Degree-1 n
1ff0: 65 69 67 68 62 6f 75 72 2c 20 77 69 6c 6c 20 68 eighbour, will h
2000: 61 76 65 20 6e 6f 20 70 72 65 64 65 63 65 73 73 ave no predecess
2010: 6f 72 73 20 61 66 74 65 72 20 74 68 65 0a 09 20 ors after the..
2020: 20 20 20 23 20 72 65 6d 6f 76 61 6c 20 6f 66 20 # removal of
2030: 6e 2e 20 50 75 74 20 6f 6e 20 74 68 65 20 6c 69 n. Put on the li
2040: 73 74 2e 0a 09 20 20 20 20 6c 61 70 70 65 6e 64 st... lappend
2050: 20 6d 79 62 6f 74 74 6f 6d 20 5b 6c 69 6e 73 65 mybottom [linse
2060: 72 74 20 5b 24 64 67 20 6e 6f 64 65 20 67 65 74 rt [$dg node get
2070: 20 24 6f 75 74 20 74 69 6d 65 72 61 6e 67 65 5d $out timerange]
2080: 20 30 20 24 6f 75 74 5d 0a 09 20 20 20 20 73 65 0 $out].. se
2090: 74 20 63 68 61 6e 67 65 64 20 31 0a 09 7d 0a 09 t changed 1..}..
20a0: 69 66 20 7b 24 63 68 61 6e 67 65 64 7d 20 7b 0a if {$changed} {.
20b0: 09 20 20 20 20 53 63 68 65 64 75 6c 65 43 61 6e . ScheduleCan
20c0: 64 69 64 61 74 65 73 0a 09 7d 0a 0a 09 23 20 57 didates..}...# W
20d0: 65 20 64 6f 20 6e 6f 74 20 64 65 6c 65 74 65 20 e do not delete
20e0: 74 68 65 20 6e 6f 64 65 20 69 6d 6d 65 64 69 61 the node immedia
20f0: 74 65 6c 79 2c 20 74 6f 20 61 6c 6c 6f 77 20 74 tely, to allow t
2100: 68 65 20 53 61 76 65 0a 09 23 20 70 72 6f 63 65 he Save..# proce
2110: 64 75 72 65 20 74 6f 20 73 61 76 65 20 74 68 65 dure to save the
2120: 20 64 65 70 65 6e 64 65 6e 63 69 65 73 20 61 73 dependencies as
2130: 20 77 65 6c 6c 20 28 65 6e 63 6f 64 65 64 20 69 well (encoded i
2140: 6e 20 74 68 65 0a 09 23 20 61 72 63 73 29 2e 0a n the..# arcs)..
2150: 09 72 65 74 75 72 6e 20 31 0a 20 20 20 20 7d 0a .return 1. }.
2160: 0a 20 20 20 20 70 72 6f 63 20 53 63 68 65 64 75 . proc Schedu
2170: 6c 65 43 61 6e 64 69 64 61 74 65 73 20 7b 7d 20 leCandidates {}
2180: 7b 0a 09 3a 3a 76 61 72 69 61 62 6c 65 20 6d 79 {..::variable my
2190: 62 6f 74 74 6f 6d 0a 09 73 65 74 20 6d 79 62 6f bottom..set mybo
21a0: 74 74 6f 6d 20 5b 6c 73 6f 72 74 20 2d 69 6e 64 ttom [lsort -ind
21b0: 65 78 20 31 20 2d 69 6e 74 65 67 65 72 20 5b 6c ex 1 -integer [l
21c0: 73 6f 72 74 20 2d 69 6e 64 65 78 20 32 20 2d 69 sort -index 2 -i
21d0: 6e 74 65 67 65 72 20 5b 6c 73 6f 72 74 20 2d 69 nteger [lsort -i
21e0: 6e 64 65 78 20 30 20 2d 64 69 63 74 20 24 6d 79 ndex 0 -dict $my
21f0: 62 6f 74 74 6f 6d 5d 5d 5d 0a 09 72 65 74 75 72 bottom]]]..retur
2200: 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 70 72 6f n. }.. pro
2210: 63 20 53 68 6f 77 50 65 6e 64 69 6e 67 4e 6f 64 c ShowPendingNod
2220: 65 73 20 7b 7d 20 7b 0a 09 69 66 20 7b 5b 6c 6f es {} {..if {[lo
2230: 67 20 76 65 72 62 6f 73 69 74 79 3f 5d 20 3c 20 g verbosity?] <
2240: 31 30 7d 20 72 65 74 75 72 6e 0a 09 3a 3a 76 61 10} return..::va
2250: 72 69 61 62 6c 65 20 6d 79 62 6f 74 74 6f 6d 0a riable mybottom.
2260: 09 6c 6f 67 20 77 72 69 74 65 20 31 30 20 63 79 .log write 10 cy
2270: 63 6c 65 62 72 65 61 6b 65 72 20 22 50 65 6e 64 clebreaker "Pend
2280: 69 6e 67 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e ing.............
2290: 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e ................
22a0: 2e 2e 22 0a 09 66 6f 72 65 61 63 68 20 69 74 65 .."..foreach ite
22b0: 6d 20 5b 73 74 72 75 63 74 3a 3a 6c 69 73 74 20 m [struct::list
22c0: 6d 61 70 20 24 6d 79 62 6f 74 74 6f 6d 20 5b 6d map $mybottom [m
22d0: 79 70 72 6f 63 20 46 6f 72 6d 61 74 50 65 6e 64 yproc FormatPend
22e0: 69 6e 67 49 74 65 6d 5d 5d 20 7b 0a 09 20 20 20 ingItem]] {..
22f0: 20 6c 6f 67 20 77 72 69 74 65 20 31 30 20 63 79 log write 10 cy
2300: 63 6c 65 62 72 65 61 6b 65 72 20 22 50 65 6e 64 clebreaker "Pend
2310: 69 6e 67 3a 20 20 20 20 20 24 69 74 65 6d 22 0a ing: $item".
2320: 09 7d 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 7d .}..return. }
2330: 0a 0a 20 20 20 20 70 72 6f 63 20 46 6f 72 6d 61 .. proc Forma
2340: 74 50 65 6e 64 69 6e 67 49 74 65 6d 20 7b 69 74 tPendingItem {it
2350: 65 6d 7d 20 7b 0a 09 6a 6f 69 6e 20 5b 6c 69 73 em} {..join [lis
2360: 74 20 5b 5b 6c 69 6e 64 65 78 20 24 69 74 65 6d t [[lindex $item
2370: 20 30 5d 20 73 74 72 5d 20 5b 63 6c 6f 63 6b 20 0] str] [clock
2380: 66 6f 72 6d 61 74 20 5b 6c 69 6e 64 65 78 20 24 format [lindex $
2390: 69 74 65 6d 20 31 5d 5d 20 5b 63 6c 6f 63 6b 20 item 1]] [clock
23a0: 66 6f 72 6d 61 74 20 5b 6c 69 6e 64 65 78 20 24 format [lindex $
23b0: 69 74 65 6d 20 32 5d 5d 5d 0a 20 20 20 20 7d 0a item 2]]]. }.
23c0: 0a 20 20 20 20 70 72 6f 63 20 46 69 6e 64 43 79 . proc FindCy
23d0: 63 6c 65 20 7b 64 67 7d 20 7b 0a 09 23 20 54 68 cle {dg} {..# Th
23e0: 69 73 20 70 72 6f 63 65 64 75 72 65 20 69 73 20 is procedure is
23f0: 72 75 6e 20 69 66 20 61 6e 64 20 6f 6e 6c 79 20 run if and only
2400: 74 68 65 20 67 72 61 70 68 20 69 73 20 6e 6f 74 the graph is not
2410: 20 65 6d 70 74 79 20 61 6e 64 0a 09 23 20 61 6c empty and..# al
2420: 6c 20 6e 6f 64 65 73 20 68 61 76 65 20 70 72 65 l nodes have pre
2430: 64 65 63 65 73 73 6f 72 73 2e 20 54 68 69 73 20 decessors. This
2440: 6d 65 61 6e 73 20 74 68 61 74 20 65 61 63 68 20 means that each
2450: 6e 6f 64 65 20 69 73 0a 09 23 20 65 69 74 68 65 node is..# eithe
2460: 72 20 70 61 72 74 20 6f 66 20 61 20 63 79 63 6c r part of a cycl
2470: 65 20 6f 72 20 28 69 6e 64 69 72 65 63 74 6c 79 e or (indirectly
2480: 29 20 64 65 70 65 6e 64 69 6e 67 20 6f 6e 20 61 ) depending on a
2490: 20 6e 6f 64 65 0a 09 23 20 69 6e 20 61 20 63 79 node..# in a cy
24a0: 63 6c 65 2e 20 57 65 20 63 61 6e 20 73 74 61 72 cle. We can star
24b0: 74 20 61 74 20 61 6e 20 61 72 62 69 74 72 61 72 t at an arbitrar
24c0: 79 20 6e 6f 64 65 2c 20 66 6f 6c 6c 6f 77 20 69 y node, follow i
24d0: 74 73 0a 09 23 20 69 6e 63 6f 6d 69 6e 67 20 65 ts..# incoming e
24e0: 64 67 65 73 20 74 6f 20 69 74 73 20 70 72 65 64 dges to its pred
24f0: 65 63 65 73 73 6f 72 73 20 75 6e 74 69 6c 20 77 ecessors until w
2500: 65 20 73 65 65 20 61 20 6e 6f 64 65 20 61 0a 09 e see a node a..
2510: 23 20 73 65 63 6f 6e 64 20 74 69 6d 65 2e 20 54 # second time. T
2520: 68 61 74 20 6e 6f 64 65 20 63 6c 6f 73 65 73 20 hat node closes
2530: 74 68 65 20 63 79 63 6c 65 20 61 6e 64 20 74 68 the cycle and th
2540: 65 20 62 65 67 69 6e 6e 69 6e 67 20 69 73 0a 09 e beginning is..
2550: 23 20 69 74 73 20 66 69 72 73 74 20 6f 63 63 75 # its first occu
2560: 72 65 6e 63 65 2e 20 4e 6f 74 65 20 74 68 61 74 rence. Note that
2570: 20 77 65 20 63 61 6e 20 63 68 6f 6f 73 65 20 61 we can choose a
2580: 6e 20 61 72 62 69 74 72 61 72 79 0a 09 23 20 70 n arbitrary..# p
2590: 72 65 64 65 63 65 73 73 6f 72 20 6f 66 20 65 61 redecessor of ea
25a0: 63 68 20 6e 6f 64 65 20 61 73 20 77 65 6c 6c 2c ch node as well,
25b0: 20 77 65 20 64 6f 20 6e 6f 74 20 68 61 76 65 20 we do not have
25c0: 74 6f 20 73 65 61 72 63 68 2e 0a 0a 09 23 20 57 to search....# W
25d0: 65 20 72 65 63 6f 72 64 20 66 6f 72 20 65 61 63 e record for eac
25e0: 68 20 6e 6f 64 65 20 74 68 65 20 69 6e 64 65 78 h node the index
25f0: 20 6f 66 20 74 68 65 20 66 69 72 73 74 20 61 70 of the first ap
2600: 70 65 61 72 61 6e 63 65 20 69 6e 0a 09 23 20 74 pearance in..# t
2610: 68 65 20 70 61 74 68 2c 20 6d 61 6b 69 6e 67 20 he path, making
2620: 69 74 20 65 61 73 79 20 61 74 20 74 68 65 20 65 it easy at the e
2630: 6e 64 20 74 6f 20 63 75 74 20 74 68 65 20 63 79 nd to cut the cy
2640: 63 6c 65 20 66 72 6f 6d 0a 09 23 20 69 74 2e 0a cle from..# it..
2650: 0a 09 23 20 43 68 6f 6f 73 65 20 61 72 62 69 74 ..# Choose arbit
2660: 72 61 72 79 20 6e 6f 64 65 20 74 6f 20 73 74 61 rary node to sta
2670: 72 74 20 6f 75 72 20 73 65 61 72 63 68 20 61 74 rt our search at
2680: 2e 0a 09 73 65 74 20 73 74 61 72 74 20 5b 6c 69 ...set start [li
2690: 6e 64 65 78 20 5b 24 64 67 20 6e 6f 64 65 73 5d ndex [$dg nodes]
26a0: 20 30 5d 0a 0a 09 23 20 49 6e 69 74 69 61 6c 69 0]...# Initiali
26b0: 7a 65 20 73 74 61 74 65 2c 20 70 61 74 68 20 6f ze state, path o
26c0: 66 20 73 65 65 6e 20 6e 6f 64 65 73 2c 20 61 6e f seen nodes, an
26d0: 64 20 77 68 65 6e 20 73 65 65 6e 2e 0a 09 73 65 d when seen...se
26e0: 74 20 20 20 20 20 20 20 70 61 74 68 20 7b 7d 0a t path {}.
26f0: 09 61 72 72 61 79 20 73 65 74 20 73 65 65 6e 20 .array set seen
2700: 7b 7d 0a 0a 09 77 68 69 6c 65 20 7b 31 7d 20 7b {}...while {1} {
2710: 0a 09 20 20 20 20 23 20 53 74 6f 70 20 73 65 61 .. # Stop sea
2720: 72 63 68 69 6e 67 20 77 68 65 6e 20 77 65 20 68 rching when we h
2730: 61 76 65 20 73 65 65 6e 20 74 68 65 20 63 75 72 ave seen the cur
2740: 72 65 6e 74 20 6e 6f 64 65 0a 09 20 20 20 20 23 rent node.. #
2750: 20 61 6c 72 65 61 64 79 2c 20 74 68 65 20 63 69 already, the ci
2760: 72 63 6c 65 20 68 61 73 20 62 65 65 6e 20 63 6c rcle has been cl
2770: 6f 73 65 64 2e 0a 09 20 20 20 20 69 66 20 7b 5b osed... if {[
2780: 69 6e 66 6f 20 65 78 69 73 74 73 20 73 65 65 6e info exists seen
2790: 28 24 73 74 61 72 74 29 5d 7d 20 62 72 65 61 6b ($start)]} break
27a0: 0a 09 20 20 20 20 6c 61 70 70 65 6e 64 20 70 61 .. lappend pa
27b0: 74 68 20 24 73 74 61 72 74 0a 09 20 20 20 20 73 th $start.. s
27c0: 65 74 20 73 65 65 6e 28 24 73 74 61 72 74 29 20 et seen($start)
27d0: 5b 65 78 70 72 20 7b 5b 6c 6c 65 6e 67 74 68 20 [expr {[llength
27e0: 24 70 61 74 68 5d 2d 31 7d 5d 0a 09 20 20 20 20 $path]-1}]..
27f0: 23 20 43 68 6f 6f 73 65 20 61 72 62 69 74 72 61 # Choose arbitra
2800: 72 79 20 70 72 65 64 65 63 65 73 73 6f 72 0a 09 ry predecessor..
2810: 20 20 20 20 73 65 74 20 73 74 61 72 74 20 5b 6c set start [l
2820: 69 6e 64 65 78 20 5b 24 64 67 20 6e 6f 64 65 73 index [$dg nodes
2830: 20 2d 69 6e 20 24 73 74 61 72 74 5d 20 30 5d 0a -in $start] 0].
2840: 09 7d 0a 0a 09 72 65 74 75 72 6e 20 5b 73 74 72 .}...return [str
2850: 75 63 74 3a 3a 6c 69 73 74 20 72 65 76 65 72 73 uct::list revers
2860: 65 20 5b 6c 72 61 6e 67 65 20 24 70 61 74 68 20 e [lrange $path
2870: 24 73 65 65 6e 28 24 73 74 61 72 74 29 20 65 6e $seen($start) en
2880: 64 5d 5d 0a 20 20 20 20 7d 0a 0a 20 20 20 20 70 d]]. }.. p
2890: 72 6f 63 20 42 72 65 61 6b 53 65 67 6d 65 6e 74 roc BreakSegment
28a0: 20 7b 64 67 20 70 61 74 68 20 6c 61 62 65 6c 7d {dg path label}
28b0: 20 7b 0a 09 23 20 54 68 65 20 70 61 74 68 2c 20 {..# The path,
28c0: 75 73 75 61 6c 6c 79 20 61 20 63 79 63 6c 65 2c usually a cycle,
28d0: 20 77 65 20 68 61 76 65 20 67 6f 74 74 65 6e 20 we have gotten
28e0: 69 73 20 62 72 6f 6b 65 6e 20 62 79 0a 09 23 20 is broken by..#
28f0: 62 72 65 61 6b 69 6e 67 20 61 70 61 72 74 20 6f breaking apart o
2900: 6e 65 20 6f 72 20 6d 6f 72 65 20 6f 66 20 74 68 ne or more of th
2910: 65 20 63 68 61 6e 67 65 73 65 74 73 20 69 6e 20 e changesets in
2920: 74 68 65 0a 09 23 20 63 79 63 6c 65 2e 20 54 68 the..# cycle. Th
2930: 69 73 20 63 61 75 73 65 73 20 75 73 20 74 6f 20 is causes us to
2940: 63 72 65 61 74 65 20 6f 6e 65 20 6f 72 20 6d 6f create one or mo
2950: 72 65 20 63 68 61 6e 67 65 73 65 74 73 20 77 68 re changesets wh
2960: 69 63 68 0a 09 23 20 61 72 65 20 74 6f 20 62 65 ich..# are to be
2970: 20 63 6f 6d 6d 69 74 74 65 64 2c 20 61 64 64 65 committed, adde
2980: 64 20 74 6f 20 74 68 65 20 67 72 61 70 68 2c 20 d to the graph,
2990: 65 74 63 2e 20 70 70 2e 0a 0a 09 73 65 74 20 62 etc. pp....set b
29a0: 65 73 74 6c 69 6e 6b 20 7b 7d 0a 09 73 65 74 20 estlink {}..set
29b0: 62 65 73 74 6e 6f 64 65 20 7b 7d 0a 0a 09 66 6f bestnode {}...fo
29c0: 72 65 61 63 68 20 5c 0a 09 20 20 20 20 70 72 65 reach \.. pre
29d0: 76 20 5b 6c 72 61 6e 67 65 20 24 70 61 74 68 20 v [lrange $path
29e0: 30 20 65 6e 64 2d 32 5d 20 5c 0a 09 20 20 20 20 0 end-2] \..
29f0: 63 73 65 74 20 5b 6c 72 61 6e 67 65 20 24 70 61 cset [lrange $pa
2a00: 74 68 20 31 20 65 6e 64 2d 31 5d 20 5c 0a 09 20 th 1 end-1] \..
2a10: 20 20 20 6e 65 78 74 20 5b 6c 72 61 6e 67 65 20 next [lrange
2a20: 24 70 61 74 68 20 32 20 65 6e 64 5d 20 7b 0a 0a $path 2 end] {..
2a30: 09 09 23 20 45 61 63 68 20 74 72 69 70 6c 65 20 ..# Each triple
2a40: 50 52 45 56 20 2d 3e 20 43 53 45 54 20 2d 3e 20 PREV -> CSET ->
2a50: 4e 45 58 54 20 6f 66 20 63 68 61 6e 67 65 73 65 NEXT of changese
2a60: 74 73 2c 20 61 0a 09 09 23 20 27 6c 69 6e 6b 27 ts, a...# 'link'
2a70: 20 69 6e 20 74 68 65 20 63 79 63 6c 65 2c 20 69 in the cycle, i
2a80: 73 20 61 6e 61 6c 79 73 65 64 20 61 6e 64 20 74 s analysed and t
2a90: 68 65 20 62 65 73 74 0a 09 09 23 20 6c 6f 63 61 he best...# loca
2aa0: 74 69 6f 6e 20 77 68 65 72 65 20 74 6f 20 61 74 tion where to at
2ab0: 20 6c 65 61 73 74 20 77 65 61 6b 65 6e 20 74 68 least weaken th
2ac0: 65 20 63 79 63 6c 65 20 69 73 0a 09 09 23 20 63 e cycle is...# c
2ad0: 68 6f 73 65 6e 20 66 6f 72 20 66 75 72 74 68 65 hosen for furthe
2ae0: 72 20 70 72 6f 63 65 73 73 69 6e 67 2e 0a 0a 09 r processing....
2af0: 09 73 65 74 20 6c 69 6e 6b 20 5b 70 72 6f 6a 65 .set link [proje
2b00: 63 74 3a 3a 72 65 76 6c 69 6e 6b 20 25 41 55 54 ct::revlink %AUT
2b10: 4f 25 20 24 70 72 65 76 20 24 63 73 65 74 20 24 O% $prev $cset $
2b20: 6e 65 78 74 5d 0a 09 09 69 66 20 7b 24 62 65 73 next]...if {$bes
2b30: 74 6c 69 6e 6b 20 65 71 20 22 22 7d 20 7b 0a 09 tlink eq ""} {..
2b40: 09 20 20 20 20 73 65 74 20 62 65 73 74 6c 69 6e . set bestlin
2b50: 6b 20 24 6c 69 6e 6b 0a 09 09 20 20 20 20 73 65 k $link... se
2b60: 74 20 62 65 73 74 6e 6f 64 65 20 24 63 73 65 74 t bestnode $cset
2b70: 0a 09 09 7d 20 65 6c 73 65 69 66 20 7b 5b 24 6c ...} elseif {[$l
2b80: 69 6e 6b 20 62 65 74 74 65 72 74 68 61 6e 20 24 ink betterthan $
2b90: 62 65 73 74 6c 69 6e 6b 5d 7d 20 7b 0a 09 09 20 bestlink]} {...
2ba0: 20 20 20 24 62 65 73 74 6c 69 6e 6b 20 64 65 73 $bestlink des
2bb0: 74 72 6f 79 0a 09 09 20 20 20 20 73 65 74 20 62 troy... set b
2bc0: 65 73 74 6c 69 6e 6b 20 24 6c 69 6e 6b 0a 09 09 estlink $link...
2bd0: 20 20 20 20 73 65 74 20 62 65 73 74 6e 6f 64 65 set bestnode
2be0: 20 24 63 73 65 74 0a 09 09 7d 20 65 6c 73 65 20 $cset...} else
2bf0: 7b 0a 09 09 20 20 20 20 24 6c 69 6e 6b 20 64 65 {... $link de
2c00: 73 74 72 6f 79 0a 09 09 7d 0a 09 20 20 20 20 7d stroy...}.. }
2c10: 0a 0a 09 6c 6f 67 20 77 72 69 74 65 20 35 20 63 ...log write 5 c
2c20: 79 63 6c 65 62 72 65 61 6b 65 72 20 22 42 72 65 yclebreaker "Bre
2c30: 61 6b 69 6e 67 20 24 6c 61 62 65 6c 20 62 79 20 aking $label by
2c40: 73 70 6c 69 74 74 69 6e 67 20 63 68 61 6e 67 65 splitting change
2c50: 73 65 74 20 5b 24 62 65 73 74 6e 6f 64 65 20 73 set [$bestnode s
2c60: 74 72 5d 22 0a 09 73 65 74 20 49 44 20 5b 24 62 tr]"..set ID [$b
2c70: 65 73 74 6e 6f 64 65 20 69 64 5d 0a 09 4d 61 72 estnode id]..Mar
2c80: 6b 20 24 64 67 20 2d 24 7b 49 44 7d 2d 62 65 66 k $dg -${ID}-bef
2c90: 6f 72 65 0a 0a 09 73 65 74 20 6e 65 77 63 73 65 ore...set newcse
2ca0: 74 73 20 5b 24 62 65 73 74 6c 69 6e 6b 20 62 72 ts [$bestlink br
2cb0: 65 61 6b 5d 0a 09 24 62 65 73 74 6c 69 6e 6b 20 eak]..$bestlink
2cc0: 64 65 73 74 72 6f 79 0a 0a 20 20 20 20 20 20 20 destroy..
2cd0: 20 23 20 41 74 20 74 68 69 73 20 70 6f 69 6e 74 # At this point
2ce0: 20 74 68 65 20 6f 6c 64 20 63 68 61 6e 67 65 73 the old changes
2cf0: 65 74 20 28 42 45 53 54 4e 4f 44 45 29 20 69 73 et (BESTNODE) is
2d00: 20 67 6f 6e 65 0a 20 20 20 20 20 20 20 20 23 20 gone. #
2d10: 61 6c 72 65 61 64 79 2e 20 57 65 20 72 65 6d 6f already. We remo
2d20: 76 65 20 69 74 20 66 72 6f 6d 20 74 68 65 20 67 ve it from the g
2d30: 72 61 70 68 20 61 73 20 77 65 6c 6c 20 61 6e 64 raph as well and
2d40: 20 74 68 65 6e 20 65 6e 74 65 72 0a 20 20 20 20 then enter.
2d50: 20 20 20 20 23 20 74 68 65 20 66 72 61 67 6d 65 # the fragme
2d60: 6e 74 73 20 67 65 6e 65 72 61 74 65 64 20 66 6f nts generated fo
2d70: 72 20 69 74 2e 0a 0a 09 52 65 70 6c 61 63 65 20 r it....Replace
2d80: 24 64 67 20 24 62 65 73 74 6e 6f 64 65 20 24 6e $dg $bestnode $n
2d90: 65 77 63 73 65 74 73 0a 0a 09 4d 61 72 6b 20 24 ewcsets...Mark $
2da0: 64 67 20 2d 24 7b 49 44 7d 2d 61 66 74 65 72 0a dg -${ID}-after.
2db0: 09 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 .return. }..
2dc0: 20 20 20 23 20 54 4f 44 4f 3a 20 54 68 69 73 20 # TODO: This
2dd0: 73 68 6f 75 6c 64 20 62 65 20 61 20 67 72 61 70 should be a grap
2de0: 68 20 6d 65 74 68 6f 64 2e 0a 20 20 20 20 70 72 h method.. pr
2df0: 6f 63 20 48 61 73 41 72 63 20 7b 64 67 20 61 20 oc HasArc {dg a
2e00: 62 7d 20 7b 0a 09 23 38 2e 35 3a 20 72 65 74 75 b} {..#8.5: retu
2e10: 72 6e 20 5b 65 78 70 72 20 7b 24 62 20 69 6e 20 rn [expr {$b in
2e20: 5b 24 64 67 20 6e 6f 64 65 73 20 2d 6f 75 74 20 [$dg nodes -out
2e30: 24 61 5d 7d 5d 0a 09 69 66 20 7b 5b 6c 73 65 61 $a]}]..if {[lsea
2e40: 72 63 68 20 2d 65 78 61 63 74 20 5b 24 64 67 20 rch -exact [$dg
2e50: 6e 6f 64 65 73 20 2d 6f 75 74 20 24 61 5d 20 24 nodes -out $a] $
2e60: 62 5d 20 3c 20 30 7d 20 7b 20 72 65 74 75 72 6e b] < 0} { return
2e70: 20 30 20 7d 0a 09 72 65 74 75 72 6e 20 31 0a 20 0 }..return 1.
2e80: 20 20 20 7d 0a 0a 20 20 20 20 70 72 6f 63 20 4d }.. proc M
2e90: 61 72 6b 20 7b 64 67 20 7b 73 75 66 66 69 78 20 ark {dg {suffix
2ea0: 7b 7d 7d 20 7b 73 75 62 67 72 61 70 68 20 7b 7d {}} {subgraph {}
2eb0: 7d 7d 20 7b 0a 09 3a 3a 76 61 72 69 61 62 6c 65 }} {..::variable
2ec0: 20 6d 79 64 6f 74 64 65 73 74 69 6e 61 74 69 6f mydotdestinatio
2ed0: 6e 0a 09 69 66 20 7b 24 6d 79 64 6f 74 64 65 73 n..if {$mydotdes
2ee0: 74 69 6e 61 74 69 6f 6e 20 65 71 20 22 22 7d 20 tination eq ""}
2ef0: 72 65 74 75 72 6e 0a 09 3a 3a 76 61 72 69 61 62 return..::variab
2f00: 6c 65 20 6d 79 64 6f 74 70 72 65 66 69 78 0a 09 le mydotprefix..
2f10: 3a 3a 76 61 72 69 61 62 6c 65 20 6d 79 64 6f 74 ::variable mydot
2f20: 69 64 0a 09 73 65 74 20 66 6e 61 6d 65 20 24 6d id..set fname $m
2f30: 79 64 6f 74 64 65 73 74 69 6e 61 74 69 6f 6e 2f ydotdestination/
2f40: 24 7b 6d 79 64 6f 74 70 72 65 66 69 78 7d 24 7b ${mydotprefix}${
2f50: 6d 79 64 6f 74 69 64 7d 24 7b 73 75 66 66 69 78 mydotid}${suffix
2f60: 7d 2e 64 6f 74 0a 09 66 69 6c 65 20 6d 6b 64 69 }.dot..file mkdi
2f70: 72 20 5b 66 69 6c 65 20 64 69 72 6e 61 6d 65 20 r [file dirname
2f80: 24 66 6e 61 6d 65 5d 0a 09 64 6f 74 20 77 72 69 $fname]..dot wri
2f90: 74 65 20 24 64 67 20 24 6d 79 64 6f 74 70 72 65 te $dg $mydotpre
2fa0: 66 69 78 24 73 75 66 66 69 78 20 24 66 6e 61 6d fix$suffix $fnam
2fb0: 65 20 24 73 75 62 67 72 61 70 68 0a 09 69 6e 63 e $subgraph..inc
2fc0: 72 20 6d 79 64 6f 74 69 64 0a 0a 09 6c 6f 67 20 r mydotid...log
2fd0: 77 72 69 74 65 20 35 20 63 79 63 6c 65 62 72 65 write 5 cyclebre
2fe0: 61 6b 65 72 20 22 2e 64 6f 74 20 65 78 70 6f 72 aker ".dot expor
2ff0: 74 20 24 66 6e 61 6d 65 22 0a 09 72 65 74 75 72 t $fname"..retur
3000: 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 70 72 6f n. }.. pro
3010: 63 20 52 65 70 6c 61 63 65 20 7b 64 67 20 6e 20 c Replace {dg n
3020: 72 65 70 6c 61 63 65 6d 65 6e 74 73 7d 20 7b 0a replacements} {.
3030: 09 23 20 4e 4f 54 45 2e 20 57 65 20 68 61 76 65 .# NOTE. We have
3040: 20 74 6f 20 67 65 74 20 74 68 65 20 6c 69 73 74 to get the list
3050: 20 6f 66 20 69 6e 63 6f 6d 69 6e 67 20 6e 65 69 of incoming nei
3060: 67 68 62 6f 75 72 73 20 61 6e 64 0a 09 23 20 72 ghbours and..# r
3070: 65 63 6f 6d 70 75 74 65 20 74 68 65 69 72 20 73 ecompute their s
3080: 75 63 63 65 73 73 6f 72 73 20 61 66 74 65 72 20 uccessors after
3090: 74 68 65 20 6e 65 77 20 6e 6f 64 65 73 20 68 61 the new nodes ha
30a0: 76 65 20 62 65 65 6e 0a 09 23 20 69 6e 73 65 72 ve been..# inser
30b0: 74 65 64 2e 20 54 68 65 69 72 20 6f 75 74 67 6f ted. Their outgo
30c0: 69 6e 67 20 61 72 63 73 20 77 69 6c 6c 20 6e 6f ing arcs will no
30d0: 77 20 67 6f 20 74 6f 20 6f 6e 65 20 6f 72 20 62 w go to one or b
30e0: 6f 74 68 20 6f 66 0a 09 23 20 74 68 65 20 6e 65 oth of..# the ne
30f0: 77 20 6e 6f 64 65 73 2c 20 61 6e 64 20 6e 6f 74 w nodes, and not
3100: 20 72 65 64 6f 69 6e 67 20 74 68 65 6d 20 6d 61 redoing them ma
3110: 79 20 63 61 75 73 65 20 75 73 20 74 6f 20 66 6f y cause us to fo
3120: 72 67 65 74 0a 09 23 20 63 69 72 63 6c 65 73 2c rget..# circles,
3130: 20 6c 65 61 76 69 6e 67 20 74 68 65 6d 20 69 6e leaving them in
3140: 2c 20 75 6e 62 72 6f 6b 65 6e 2e 0a 0a 09 73 65 , unbroken....se
3150: 74 20 70 72 65 20 5b 24 64 67 20 6e 6f 64 65 73 t pre [$dg nodes
3160: 20 2d 69 6e 20 24 6e 5d 0a 0a 20 20 20 20 20 20 -in $n]..
3170: 20 20 24 64 67 20 6e 6f 64 65 20 64 65 6c 65 74 $dg node delet
3180: 65 20 24 6e 0a 0a 09 66 6f 72 65 61 63 68 20 63 e $n...foreach c
3190: 73 65 74 20 24 72 65 70 6c 61 63 65 6d 65 6e 74 set $replacement
31a0: 73 20 7b 0a 09 20 20 20 20 73 65 74 20 74 72 20 s {.. set tr
31b0: 5b 24 63 73 65 74 20 74 69 6d 65 72 61 6e 67 65 [$cset timerange
31c0: 5d 0a 09 20 20 20 20 24 64 67 20 6e 6f 64 65 20 ].. $dg node
31d0: 69 6e 73 65 72 74 20 24 63 73 65 74 0a 09 20 20 insert $cset..
31e0: 20 20 24 64 67 20 6e 6f 64 65 20 73 65 74 20 20 $dg node set
31f0: 20 20 24 63 73 65 74 20 74 69 6d 65 72 61 6e 67 $cset timerang
3200: 65 20 24 74 72 0a 09 20 20 20 20 24 64 67 20 6e e $tr.. $dg n
3210: 6f 64 65 20 73 65 74 20 20 20 20 24 63 73 65 74 ode set $cset
3220: 20 6c 61 62 65 6c 20 20 20 20 20 22 5b 24 63 73 label "[$cs
3230: 65 74 20 73 74 72 5d 5c 5c 6e 5b 6a 6f 69 6e 20 et str]\\n[join
3240: 5b 73 74 72 75 63 74 3a 3a 6c 69 73 74 20 6d 61 [struct::list ma
3250: 70 20 24 74 72 20 7b 3a 3a 63 6c 6f 63 6b 20 66 p $tr {::clock f
3260: 6f 72 6d 61 74 7d 5d 20 22 5c 5c 6e 22 5d 22 0a ormat}] "\\n"]".
3270: 09 20 20 20 20 24 64 67 20 6e 6f 64 65 20 73 65 . $dg node se
3280: 74 20 20 20 20 24 63 73 65 74 20 5f 5f 69 64 5f t $cset __id_
3290: 5f 20 20 20 20 5b 24 63 73 65 74 20 69 64 5d 0a _ [$cset id].
32a0: 09 20 20 20 20 24 64 67 20 6e 6f 64 65 20 73 65 . $dg node se
32b0: 74 20 20 20 20 24 63 73 65 74 20 73 68 61 70 65 t $cset shape
32c0: 20 20 20 20 20 5b 65 78 70 72 20 7b 5b 24 63 73 [expr {[$cs
32d0: 65 74 20 62 79 73 79 6d 62 6f 6c 5d 0a 09 09 09 et bysymbol]....
32e0: 09 09 09 20 20 20 3f 20 22 65 6c 6c 69 70 73 65 ... ? "ellipse
32f0: 22 0a 09 09 09 09 09 09 20 20 20 3a 20 22 62 6f "....... : "bo
3300: 78 22 7d 5d 0a 09 7d 0a 0a 09 66 6f 72 65 61 63 x"}]..}...foreac
3310: 68 20 63 73 65 74 20 24 72 65 70 6c 61 63 65 6d h cset $replacem
3320: 65 6e 74 73 20 7b 0a 09 20 20 20 20 66 6f 72 65 ents {.. fore
3330: 61 63 68 20 73 75 63 63 20 5b 24 63 73 65 74 20 ach succ [$cset
3340: 73 75 63 63 65 73 73 6f 72 73 5d 20 7b 0a 09 09 successors] {...
3350: 23 20 54 68 65 20 6e 65 77 20 63 68 61 6e 67 65 # The new change
3360: 73 65 74 73 20 6d 61 79 20 68 61 76 65 20 64 65 sets may have de
3370: 70 65 6e 64 65 6e 63 69 65 73 20 6f 75 74 73 69 pendencies outsi
3380: 64 65 20 6f 66 0a 09 09 23 20 74 68 65 20 63 68 de of...# the ch
3390: 6f 73 65 6e 20 73 65 74 2e 20 54 68 65 73 65 20 osen set. These
33a0: 61 72 65 20 69 67 6e 6f 72 65 64 0a 09 09 69 66 are ignored...if
33b0: 20 7b 21 5b 24 64 67 20 6e 6f 64 65 20 65 78 69 {![$dg node exi
33c0: 73 74 73 20 24 73 75 63 63 5d 7d 20 63 6f 6e 74 sts $succ]} cont
33d0: 69 6e 75 65 0a 09 09 24 64 67 20 61 72 63 20 69 inue...$dg arc i
33e0: 6e 73 65 72 74 20 24 63 73 65 74 20 24 73 75 63 nsert $cset $suc
33f0: 63 0a 09 09 69 66 20 7b 24 73 75 63 63 20 65 71 c...if {$succ eq
3400: 20 24 63 73 65 74 7d 20 7b 0a 09 09 20 20 20 20 $cset} {...
3410: 74 72 6f 75 62 6c 65 20 69 6e 74 65 72 6e 61 6c trouble internal
3420: 20 22 53 65 6c 66 2d 72 65 66 65 72 65 6e 63 69 "Self-referenci
3430: 6e 67 20 63 68 61 6e 67 65 73 65 74 20 5b 24 63 ng changeset [$c
3440: 73 65 74 20 73 74 72 5d 22 0a 09 09 7d 0a 09 20 set str]"...}..
3450: 20 20 20 7d 0a 09 7d 0a 09 66 6f 72 65 61 63 68 }..}..foreach
3460: 20 63 73 65 74 20 24 70 72 65 20 7b 0a 09 20 20 cset $pre {..
3470: 20 20 66 6f 72 65 61 63 68 20 73 75 63 63 20 5b foreach succ [
3480: 24 63 73 65 74 20 73 75 63 63 65 73 73 6f 72 73 $cset successors
3490: 5d 20 7b 0a 09 09 23 20 4e 6f 74 65 20 74 68 61 ] {...# Note tha
34a0: 74 20 74 68 65 20 61 72 63 20 6d 61 79 20 61 6c t the arc may al
34b0: 72 65 61 64 79 20 65 78 69 73 74 20 69 6e 20 74 ready exist in t
34c0: 68 65 20 67 72 61 70 68 2e 20 49 66 0a 09 09 23 he graph. If...#
34d0: 20 73 6f 20 69 67 6e 6f 72 65 20 69 74 2e 20 54 so ignore it. T
34e0: 68 65 20 6e 65 77 20 63 68 61 6e 67 65 73 65 74 he new changeset
34f0: 73 20 6d 61 79 20 68 61 76 65 0a 09 09 23 20 64 s may have...# d
3500: 65 70 65 6e 64 65 6e 63 69 65 73 20 6f 75 74 73 ependencies outs
3510: 69 64 65 20 6f 66 20 74 68 65 20 63 68 6f 73 65 ide of the chose
3520: 6e 20 73 65 74 2e 20 54 68 65 73 65 20 61 72 65 n set. These are
3530: 0a 09 09 23 20 69 67 6e 6f 72 65 64 0a 09 09 69 ...# ignored...i
3540: 66 20 7b 21 5b 24 64 67 20 6e 6f 64 65 20 65 78 f {![$dg node ex
3550: 69 73 74 73 20 24 73 75 63 63 5d 7d 20 63 6f 6e ists $succ]} con
3560: 74 69 6e 75 65 0a 09 09 69 66 20 7b 5b 48 61 73 tinue...if {[Has
3570: 41 72 63 20 24 64 67 20 24 63 73 65 74 20 24 73 Arc $dg $cset $s
3580: 75 63 63 5d 7d 20 63 6f 6e 74 69 6e 75 65 3b 23 ucc]} continue;#
3590: 20 54 4f 44 4f 20 73 68 6f 75 6c 64 20 62 65 20 TODO should be
35a0: 67 72 61 70 68 20 6d 65 74 68 6f 64 2e 0a 09 09 graph method....
35b0: 24 64 67 20 61 72 63 20 69 6e 73 65 72 74 20 24 $dg arc insert $
35c0: 63 73 65 74 20 24 73 75 63 63 0a 09 20 20 20 20 cset $succ..
35d0: 7d 0a 09 7d 0a 0a 09 72 65 74 75 72 6e 0a 20 20 }..}...return.
35e0: 20 20 7d 0a 0a 20 20 20 20 23 20 23 20 23 23 20 }.. # # ##
35f0: 23 23 23 20 23 23 23 23 23 20 23 23 23 23 23 23 ### ##### ######
3600: 23 23 20 23 23 23 23 23 23 23 23 23 23 23 23 23 ## #############
3610: 0a 20 20 20 20 23 23 20 43 61 6c 6c 62 61 63 6b . ## Callback
3620: 20 69 6e 76 6f 6b 61 74 69 6f 6e 20 2e 2e 2e 0a invokation ....
3630: 0a 20 20 20 20 70 72 6f 63 20 50 72 65 48 6f 6f . proc PreHoo
3640: 6b 20 7b 67 72 61 70 68 7d 20 7b 0a 09 23 20 47 k {graph} {..# G
3650: 69 76 65 20 74 68 65 20 75 73 65 72 20 6f 66 20 ive the user of
3660: 74 68 65 20 63 79 63 6c 65 20 62 72 65 61 6b 65 the cycle breake
3670: 72 20 74 68 65 20 6f 70 70 6f 72 74 75 6e 69 74 r the opportunit
3680: 79 20 74 6f 20 77 6f 72 6b 0a 09 23 20 77 69 74 y to work..# wit
3690: 68 20 74 68 65 20 67 72 61 70 68 20 62 65 74 77 h the graph betw
36a0: 65 65 6e 20 73 65 74 75 70 20 61 6e 64 20 63 6f een setup and co
36b0: 6e 73 75 6d 6d 61 74 69 6f 6e 2e 0a 0a 09 3a 3a nsummation....::
36c0: 76 61 72 69 61 62 6c 65 20 6d 79 70 72 65 63 6d variable myprecm
36d0: 64 0a 09 69 66 20 7b 21 5b 6c 6c 65 6e 67 74 68 d..if {![llength
36e0: 20 24 6d 79 70 72 65 63 6d 64 5d 7d 20 72 65 74 $myprecmd]} ret
36f0: 75 72 6e 0a 0a 09 75 70 6c 65 76 65 6c 20 23 30 urn...uplevel #0
3700: 20 5b 6c 69 6e 73 65 72 74 20 24 6d 79 70 72 65 [linsert $mypre
3710: 63 6d 64 20 65 6e 64 20 24 67 72 61 70 68 5d 0a cmd end $graph].
3720: 09 4d 61 72 6b 20 24 67 72 61 70 68 20 2d 70 72 .Mark $graph -pr
3730: 65 2d 64 6f 6e 65 0a 09 72 65 74 75 72 6e 0a 20 e-done..return.
3740: 20 20 20 7d 0a 0a 20 20 20 20 70 72 6f 63 20 50 }.. proc P
3750: 72 6f 63 65 73 73 65 64 48 6f 6f 6b 20 7b 64 67 rocessedHook {dg
3760: 20 63 73 65 74 20 70 6f 73 7d 20 7b 0a 09 23 20 cset pos} {..#
3770: 47 69 76 65 20 74 68 65 20 75 73 65 72 20 6f 66 Give the user of
3780: 20 74 68 65 20 63 79 63 6c 65 20 62 72 65 61 6b the cycle break
3790: 65 72 20 74 68 65 20 6f 70 70 6f 72 74 75 6e 69 er the opportuni
37a0: 74 79 20 74 6f 20 77 6f 72 6b 0a 09 23 20 77 69 ty to work..# wi
37b0: 74 68 20 74 68 65 20 63 68 61 6e 67 65 73 65 74 th the changeset
37c0: 20 62 65 66 6f 72 65 20 69 74 20 69 73 20 72 65 before it is re
37d0: 6d 6f 76 65 64 20 66 72 6f 6d 20 74 68 65 20 67 moved from the g
37e0: 72 61 70 68 2e 0a 0a 09 3a 3a 76 61 72 69 61 62 raph....::variab
37f0: 6c 65 20 6d 79 73 61 76 65 63 6d 64 0a 09 69 66 le mysavecmd..if
3800: 20 7b 21 5b 6c 6c 65 6e 67 74 68 20 24 6d 79 73 {![llength $mys
3810: 61 76 65 63 6d 64 5d 7d 20 72 65 74 75 72 6e 0a avecmd]} return.
3820: 0a 09 75 70 6c 65 76 65 6c 20 23 30 20 5b 6c 69 ..uplevel #0 [li
3830: 6e 73 65 72 74 20 24 6d 79 73 61 76 65 63 6d 64 nsert $mysavecmd
3840: 20 65 6e 64 20 24 64 67 20 24 70 6f 73 20 24 63 end $dg $pos $c
3850: 73 65 74 5d 0a 09 72 65 74 75 72 6e 0a 20 20 20 set]..return.
3860: 20 7d 0a 0a 20 20 20 20 70 72 6f 63 20 42 72 65 }.. proc Bre
3870: 61 6b 43 79 63 6c 65 48 6f 6f 6b 20 7b 67 72 61 akCycleHook {gra
3880: 70 68 7d 20 7b 0a 09 23 20 43 61 6c 6c 20 6f 75 ph} {..# Call ou
3890: 74 20 74 6f 20 74 68 65 20 63 68 6f 73 65 6e 20 t to the chosen
38a0: 61 6c 67 6f 72 69 74 68 6d 20 66 6f 72 20 63 79 algorithm for cy
38b0: 63 6c 65 20 62 72 65 61 6b 69 6e 67 2e 20 46 69 cle breaking. Fi
38c0: 6e 64 69 6e 67 0a 09 23 20 61 20 63 79 63 6c 65 nding..# a cycle
38d0: 20 69 66 20 6e 6f 20 62 72 65 61 6b 65 72 20 77 if no breaker w
38e0: 61 73 20 63 68 6f 73 65 6e 20 69 73 20 61 6e 20 as chosen is an
38f0: 65 72 72 6f 72 2e 0a 0a 09 3a 3a 76 61 72 69 61 error....::varia
3900: 62 6c 65 20 6d 79 62 72 65 61 6b 63 6d 64 0a 09 ble mybreakcmd..
3910: 69 66 20 7b 21 5b 6c 6c 65 6e 67 74 68 20 24 6d if {![llength $m
3920: 79 62 72 65 61 6b 63 6d 64 5d 7d 20 7b 0a 09 20 ybreakcmd]} {..
3930: 20 20 20 74 72 6f 75 62 6c 65 20 66 61 74 61 6c trouble fatal
3940: 20 22 46 6f 75 6e 64 20 61 20 63 79 63 6c 65 2c "Found a cycle,
3950: 20 65 78 70 65 63 74 69 6e 67 20 6e 6f 6e 65 2e expecting none.
3960: 22 0a 09 20 20 20 20 65 78 69 74 20 31 0a 09 7d ".. exit 1..}
3970: 0a 0a 09 75 70 6c 65 76 65 6c 20 23 30 20 5b 6c ...uplevel #0 [l
3980: 69 6e 73 65 72 74 20 24 6d 79 62 72 65 61 6b 63 insert $mybreakc
3990: 6d 64 20 65 6e 64 20 24 67 72 61 70 68 5d 0a 09 md end $graph]..
39a0: 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 return. }..
39b0: 20 20 70 72 6f 63 20 43 6c 65 61 72 48 6f 6f 6b proc ClearHook
39c0: 73 20 7b 7d 20 7b 0a 09 3a 3a 76 61 72 69 61 62 s {} {..::variab
39d0: 6c 65 20 6d 79 70 72 65 63 6d 64 20 20 20 7b 7d le myprecmd {}
39e0: 0a 09 3a 3a 76 61 72 69 61 62 6c 65 20 6d 79 73 ..::variable mys
39f0: 61 76 65 63 6d 64 20 20 7b 7d 0a 09 3a 3a 76 61 avecmd {}..::va
3a00: 72 69 61 62 6c 65 20 6d 79 62 72 65 61 6b 63 6d riable mybreakcm
3a10: 64 20 7b 7d 0a 09 72 65 74 75 72 6e 0a 20 20 20 d {}..return.
3a20: 20 7d 0a 0a 20 20 20 20 23 20 23 20 23 23 20 23 }.. # # ## #
3a30: 23 23 20 23 23 23 23 23 20 23 23 23 23 23 23 23 ## ##### #######
3a40: 23 20 23 23 23 23 23 23 23 23 23 23 23 23 23 0a # #############.
3a50: 0a 20 20 20 20 70 72 6f 63 20 4d 61 72 6b 57 61 . proc MarkWa
3a60: 74 63 68 20 7b 67 72 61 70 68 7d 20 7b 0a 09 3a tch {graph} {..:
3a70: 3a 76 61 72 69 61 62 6c 65 20 6d 79 77 61 74 63 :variable mywatc
3a80: 68 69 64 73 0a 09 73 65 74 20 77 61 74 63 68 65 hids..set watche
3a90: 64 20 5b 57 61 74 63 68 65 64 20 24 67 72 61 70 d [Watched $grap
3aa0: 68 20 24 6d 79 77 61 74 63 68 69 64 73 5d 0a 09 h $mywatchids]..
3ab0: 69 66 20 7b 21 5b 6c 6c 65 6e 67 74 68 20 24 77 if {![llength $w
3ac0: 61 74 63 68 65 64 5d 7d 20 72 65 74 75 72 6e 0a atched]} return.
3ad0: 09 73 65 74 20 6e 65 69 67 68 62 6f 75 72 73 20 .set neighbours
3ae0: 5b 65 76 61 6c 20 5b 6c 69 6e 73 65 72 74 20 24 [eval [linsert $
3af0: 77 61 74 63 68 65 64 20 30 20 24 67 72 61 70 68 watched 0 $graph
3b00: 20 6e 6f 64 65 73 20 2d 61 64 6a 5d 5d 0a 09 23 nodes -adj]]..#
3b10: 66 6f 72 65 61 63 68 20 6e 20 24 6e 65 69 67 68 foreach n $neigh
3b20: 62 6f 75 72 73 20 7b 20 6c 6f 67 20 77 72 69 74 bours { log writ
3b30: 65 20 36 20 63 79 63 6c 65 62 72 65 61 6b 65 72 e 6 cyclebreaker
3b40: 20 22 4e 65 69 67 68 62 6f 72 20 5b 24 6e 20 69 "Neighbor [$n i
3b50: 64 5d 20 3d 3e 20 24 6e 22 20 7d 0a 09 4d 61 72 d] => $n" }..Mar
3b60: 6b 20 24 67 72 61 70 68 20 77 61 74 63 68 65 64 k $graph watched
3b70: 20 5b 63 6f 6e 63 61 74 20 24 77 61 74 63 68 65 [concat $watche
3b80: 64 20 24 6e 65 69 67 68 62 6f 75 72 73 5d 0a 09 d $neighbours]..
3b90: 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 return. }..
3ba0: 20 20 70 72 6f 63 20 57 61 74 63 68 65 64 20 7b proc Watched {
3bb0: 67 72 61 70 68 20 77 61 74 63 68 69 64 73 7d 20 graph watchids}
3bc0: 7b 0a 09 73 65 74 20 72 65 73 20 7b 7d 0a 09 66 {..set res {}..f
3bd0: 6f 72 65 61 63 68 20 69 64 20 24 77 61 74 63 68 oreach id $watch
3be0: 69 64 73 20 7b 0a 09 20 20 20 20 73 65 74 20 6e ids {.. set n
3bf0: 6c 20 5b 24 67 72 61 70 68 20 6e 6f 64 65 73 20 l [$graph nodes
3c00: 2d 6b 65 79 20 5f 5f 69 64 5f 5f 20 2d 76 61 6c -key __id__ -val
3c10: 75 65 20 24 69 64 5d 0a 09 20 20 20 20 69 66 20 ue $id].. if
3c20: 7b 21 5b 6c 6c 65 6e 67 74 68 20 24 6e 6c 5d 7d {![llength $nl]}
3c30: 20 63 6f 6e 74 69 6e 75 65 0a 09 20 20 20 20 6c continue.. l
3c40: 61 70 70 65 6e 64 20 72 65 73 20 24 6e 6c 0a 09 append res $nl..
3c50: 20 20 20 20 23 6c 6f 67 20 77 72 69 74 65 20 36 #log write 6
3c60: 20 62 72 65 61 6b 72 63 79 63 6c 65 20 22 57 61 breakrcycle "Wa
3c70: 74 63 68 69 6e 67 20 24 69 64 20 3d 3e 20 24 6e tching $id => $n
3c80: 6c 22 0a 09 20 20 20 20 24 67 72 61 70 68 20 6e l".. $graph n
3c90: 6f 64 65 20 73 65 74 20 24 6e 6c 20 66 6f 6e 74 ode set $nl font
3ca0: 63 6f 6c 6f 72 20 72 65 64 0a 09 7d 0a 09 72 65 color red..}..re
3cb0: 74 75 72 6e 20 24 72 65 73 0a 20 20 20 20 7d 0a turn $res. }.
3cc0: 0a 20 20 20 20 23 20 23 20 23 23 20 23 23 23 20 . # # ## ###
3cd0: 23 23 23 23 23 20 23 23 23 23 23 23 23 23 20 23 ##### ######## #
3ce0: 23 23 23 23 23 23 23 23 23 23 23 23 0a 0a 0a 20 ############...
3cf0: 20 20 20 74 79 70 65 76 61 72 69 61 62 6c 65 20 typevariable
3d00: 6d 79 61 74 20 20 20 20 20 20 30 20 3b 20 23 20 myat 0 ; #
3d10: 43 6f 75 6e 74 65 72 20 66 6f 72 20 63 6f 6d 6d Counter for comm
3d20: 69 74 20 69 64 73 20 66 6f 72 20 74 68 65 0a 09 it ids for the..
3d30: 09 09 20 20 20 20 20 20 20 23 20 63 68 61 6e 67 .. # chang
3d40: 65 73 65 74 73 2e 0a 20 20 20 20 74 79 70 65 76 esets.. typev
3d50: 61 72 69 61 62 6c 65 20 6d 79 62 6f 74 74 6f 6d ariable mybottom
3d60: 20 7b 7d 20 3b 20 23 20 4c 69 73 74 20 6f 66 20 {} ; # List of
3d70: 74 68 65 20 63 61 6e 64 69 64 61 74 65 20 6e 6f the candidate no
3d80: 64 65 73 20 66 6f 72 0a 09 09 09 20 20 20 20 20 des for....
3d90: 20 20 23 20 63 6f 6d 6d 69 74 74 69 6e 67 2e 0a # committing..
3da0: 0a 20 20 20 20 74 79 70 65 76 61 72 69 61 62 6c . typevariabl
3db0: 65 20 6d 79 70 72 65 63 6d 64 20 20 20 7b 7d 20 e myprecmd {}
3dc0: 3b 20 23 20 43 61 6c 6c 62 61 63 6b 2c 20 63 68 ; # Callback, ch
3dd0: 61 6e 67 65 20 67 72 61 70 68 20 62 65 66 6f 72 ange graph befor
3de0: 65 20 77 61 6c 6b 2e 0a 20 20 20 20 74 79 70 65 e walk.. type
3df0: 76 61 72 69 61 62 6c 65 20 6d 79 73 61 76 65 63 variable mysavec
3e00: 6d 64 20 20 7b 7d 20 3b 20 23 20 43 61 6c 6c 62 md {} ; # Callb
3e10: 61 63 6b 2c 20 66 6f 72 20 65 61 63 68 20 70 72 ack, for each pr
3e20: 6f 63 65 73 73 65 64 20 6e 6f 64 65 2e 0a 20 20 ocessed node..
3e30: 20 20 74 79 70 65 76 61 72 69 61 62 6c 65 20 6d typevariable m
3e40: 79 62 72 65 61 6b 63 6d 64 20 7b 7d 20 3b 20 23 ybreakcmd {} ; #
3e50: 20 43 61 6c 6c 62 61 63 6b 2c 20 66 6f 72 20 65 Callback, for e
3e60: 61 63 68 20 66 6f 75 6e 64 20 63 79 63 6c 65 2e ach found cycle.
3e70: 0a 0a 20 20 20 20 74 79 70 65 76 61 72 69 61 62 .. typevariab
3e80: 6c 65 20 6d 79 64 6f 74 64 65 73 74 69 6e 61 74 le mydotdestinat
3e90: 69 6f 6e 20 7b 7d 20 3b 20 23 20 44 65 73 74 69 ion {} ; # Desti
3ea0: 6e 61 74 69 6f 6e 20 64 69 72 65 63 74 6f 72 79 nation directory
3eb0: 20 66 6f 72 20 74 68 65 0a 09 09 09 09 20 20 20 for the.....
3ec0: 20 20 20 20 23 20 67 65 6e 65 72 61 74 65 64 20 # generated
3ed0: 2e 64 6f 74 20 66 69 6c 65 73 2e 0a 20 20 20 20 .dot files..
3ee0: 74 79 70 65 76 61 72 69 61 62 6c 65 20 6d 79 64 typevariable myd
3ef0: 6f 74 70 72 65 66 69 78 20 20 20 20 20 20 7b 7d otprefix {}
3f00: 20 3b 20 23 20 50 72 65 66 69 78 20 66 6f 72 20 ; # Prefix for
3f10: 64 6f 74 20 66 69 6c 65 73 20 77 68 65 6e 0a 09 dot files when..
3f20: 09 09 09 20 20 20 20 20 20 20 23 20 65 78 70 6f ... # expo
3f30: 72 74 69 6e 67 20 74 68 65 20 67 72 61 70 68 73 rting the graphs
3f40: 2e 0a 20 20 20 20 74 79 70 65 76 61 72 69 61 62 .. typevariab
3f50: 6c 65 20 6d 79 64 6f 74 69 64 20 20 20 20 20 20 le mydotid
3f60: 20 20 20 20 20 30 20 3b 20 23 20 43 6f 75 6e 74 0 ; # Count
3f70: 65 72 20 66 6f 72 20 64 6f 74 20 66 69 6c 65 20 er for dot file
3f80: 6e 61 6d 65 0a 09 09 09 09 20 20 20 20 20 20 20 name.....
3f90: 23 20 67 65 6e 65 72 61 74 69 6f 6e 2e 0a 20 20 # generation..
3fa0: 20 20 74 79 70 65 76 61 72 69 61 62 6c 65 20 6d typevariable m
3fb0: 79 77 61 74 63 68 69 64 73 20 20 20 20 20 20 20 ywatchids
3fc0: 7b 7d 20 3b 20 23 20 43 68 61 6e 67 65 73 65 74 {} ; # Changeset
3fd0: 73 20 74 6f 20 77 61 74 63 68 20 74 68 65 0a 09 s to watch the..
3fe0: 09 09 09 20 20 20 20 20 20 20 23 20 6e 65 69 67 ... # neig
3ff0: 68 62 6f 75 72 68 6f 6f 64 20 6f 66 2e 0a 0a 20 hbourhood of...
4000: 20 20 20 23 20 23 20 23 23 20 23 23 23 20 23 23 # # ## ### ##
4010: 23 23 23 20 23 23 23 23 23 23 23 23 20 23 23 23 ### ######## ###
4020: 23 23 23 23 23 23 23 23 23 23 0a 20 20 20 20 23 ##########. #
4030: 23 20 43 6f 6e 66 69 67 75 72 61 74 69 6f 6e 0a # Configuration.
4040: 0a 20 20 20 20 70 72 61 67 6d 61 20 2d 68 61 73 . pragma -has
4050: 69 6e 73 74 61 6e 63 65 73 20 20 20 6e 6f 20 3b instances no ;
4060: 20 23 20 73 69 6e 67 6c 65 74 6f 6e 0a 20 20 20 # singleton.
4070: 20 70 72 61 67 6d 61 20 2d 68 61 73 74 79 70 65 pragma -hastype
4080: 69 6e 66 6f 20 20 20 20 6e 6f 20 3b 20 23 20 6e info no ; # n
4090: 6f 20 69 6e 74 72 6f 73 70 65 63 74 69 6f 6e 0a o introspection.
40a0: 20 20 20 20 70 72 61 67 6d 61 20 2d 68 61 73 74 pragma -hast
40b0: 79 70 65 64 65 73 74 72 6f 79 20 6e 6f 20 3b 20 ypedestroy no ;
40c0: 23 20 69 6d 6d 6f 72 74 61 6c 0a 0a 20 20 20 20 # immortal..
40d0: 23 20 23 20 23 23 20 23 23 23 20 23 23 23 23 23 # # ## ### #####
40e0: 20 23 23 23 23 23 23 23 23 20 23 23 23 23 23 23 ######## ######
40f0: 23 23 23 23 23 23 23 0a 7d 0a 0a 6e 61 6d 65 73 #######.}..names
4100: 70 61 63 65 20 65 76 61 6c 20 3a 3a 76 63 3a 3a pace eval ::vc::
4110: 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a fossil::import::
4120: 63 76 73 20 7b 0a 20 20 20 20 6e 61 6d 65 73 70 cvs {. namesp
4130: 61 63 65 20 65 78 70 6f 72 74 20 63 79 63 6c 65 ace export cycle
4140: 62 72 65 61 6b 65 72 0a 20 20 20 20 6e 61 6d 65 breaker. name
4150: 73 70 61 63 65 20 65 76 61 6c 20 63 79 63 6c 65 space eval cycle
4160: 62 72 65 61 6b 65 72 20 7b 0a 09 6e 61 6d 65 73 breaker {..names
4170: 70 61 63 65 20 65 76 61 6c 20 70 72 6f 6a 65 63 pace eval projec
4180: 74 20 7b 0a 09 20 20 20 20 6e 61 6d 65 73 70 61 t {.. namespa
4190: 63 65 20 69 6d 70 6f 72 74 20 3a 3a 76 63 3a 3a ce import ::vc::
41a0: 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a fossil::import::
41b0: 63 76 73 3a 3a 70 72 6f 6a 65 63 74 3a 3a 72 65 cvs::project::re
41c0: 76 0a 09 20 20 20 20 6e 61 6d 65 73 70 61 63 65 v.. namespace
41d0: 20 69 6d 70 6f 72 74 20 3a 3a 76 63 3a 3a 66 6f import ::vc::fo
41e0: 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 ssil::import::cv
41f0: 73 3a 3a 70 72 6f 6a 65 63 74 3a 3a 72 65 76 6c s::project::revl
4200: 69 6e 6b 0a 09 7d 0a 09 6e 61 6d 65 73 70 61 63 ink..}..namespac
4210: 65 20 69 6d 70 6f 72 74 20 3a 3a 76 63 3a 3a 74 e import ::vc::t
4220: 6f 6f 6c 73 3a 3a 6d 69 73 63 3a 3a 2a 0a 09 6e ools::misc::*..n
4230: 61 6d 65 73 70 61 63 65 20 69 6d 70 6f 72 74 20 amespace import
4240: 3a 3a 76 63 3a 3a 74 6f 6f 6c 73 3a 3a 6c 6f 67 ::vc::tools::log
4250: 0a 09 6e 61 6d 65 73 70 61 63 65 20 69 6d 70 6f ..namespace impo
4260: 72 74 20 3a 3a 76 63 3a 3a 74 6f 6f 6c 73 3a 3a rt ::vc::tools::
4270: 74 72 6f 75 62 6c 65 0a 09 6e 61 6d 65 73 70 61 trouble..namespa
4280: 63 65 20 69 6d 70 6f 72 74 20 3a 3a 76 63 3a 3a ce import ::vc::
4290: 74 6f 6f 6c 73 3a 3a 64 6f 74 0a 09 6c 6f 67 20 tools::dot..log
42a0: 72 65 67 69 73 74 65 72 20 63 79 63 6c 65 62 72 register cyclebr
42b0: 65 61 6b 65 72 0a 20 20 20 20 7d 0a 7d 0a 0a 23 eaker. }.}..#
42c0: 20 23 20 23 23 20 23 23 23 20 23 23 23 23 23 20 # ## ### #####
42d0: 23 23 23 23 23 23 23 23 20 23 23 23 23 23 23 23 ######## #######
42e0: 23 23 23 23 23 23 20 23 23 23 23 23 23 23 23 23 ###### #########
42f0: 23 23 23 23 23 23 23 23 23 23 23 23 0a 23 23 20 ############.##
4300: 52 65 61 64 79 0a 0a 70 61 63 6b 61 67 65 20 70 Ready..package p
4310: 72 6f 76 69 64 65 20 76 63 3a 3a 66 6f 73 73 69 rovide vc::fossi
4320: 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a l::import::cvs::
4330: 63 79 63 6c 65 62 72 65 61 6b 65 72 20 31 2e 30 cyclebreaker 1.0
4340: 0a 72 65 74 75 72 6e 0a .return.