Artifact 00c265ebb6c2bf602a2ea5eb0db4be65bdd914b9:
File
tools/cvs2fossil/lib/c2f_cyclebreaker.tcl
part of check-in
[f284847134]
- Reworked the dot export internals a bit to be more general regarding labeling and attribute writing. Updated the cycle breaker to define proper labels.
by
aku on
2007-11-22 07:22:38.
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 20 0a 0a 73 6e 69 74 3a 3a 74 79 ##.## ..snit::ty
0640: 70 65 20 3a 3a 76 63 3a 3a 66 6f 73 73 69 6c 3a pe ::vc::fossil:
0650: 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 63 79 :import::cvs::cy
0660: 63 6c 65 62 72 65 61 6b 65 72 20 7b 0a 20 20 20 clebreaker {.
0670: 20 23 20 23 20 23 23 20 23 23 23 20 23 23 23 23 # # ## ### ####
0680: 23 20 23 23 23 23 23 23 23 23 20 23 23 23 23 23 # ######## #####
0690: 23 23 23 23 23 23 23 23 0a 20 20 20 20 23 23 20 ########. ##
06a0: 50 75 62 6c 69 63 20 41 50 49 0a 0a 20 20 20 20 Public API..
06b0: 74 79 70 65 6d 65 74 68 6f 64 20 70 72 65 63 6d typemethod precm
06c0: 64 20 7b 63 6d 64 7d 20 7b 0a 09 3a 3a 76 61 72 d {cmd} {..::var
06d0: 69 61 62 6c 65 20 6d 79 70 72 65 63 6d 64 20 24 iable myprecmd $
06e0: 63 6d 64 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 cmd..return.
06f0: 7d 0a 0a 20 20 20 20 74 79 70 65 6d 65 74 68 6f }.. typemetho
0700: 64 20 73 61 76 65 63 6d 64 20 7b 63 6d 64 7d 20 d savecmd {cmd}
0710: 7b 0a 09 3a 3a 76 61 72 69 61 62 6c 65 20 6d 79 {..::variable my
0720: 73 61 76 65 63 6d 64 20 24 63 6d 64 0a 09 72 65 savecmd $cmd..re
0730: 74 75 72 6e 0a 20 20 20 20 7d 0a 20 0a 20 20 20 turn. }. .
0740: 20 74 79 70 65 6d 65 74 68 6f 64 20 62 72 65 61 typemethod brea
0750: 6b 63 6d 64 20 7b 63 6d 64 7d 20 7b 0a 09 3a 3a kcmd {cmd} {..::
0760: 76 61 72 69 61 62 6c 65 20 6d 79 62 72 65 61 6b variable mybreak
0770: 63 6d 64 20 24 63 6d 64 0a 09 72 65 74 75 72 6e cmd $cmd..return
0780: 0a 20 20 20 20 7d 0a 0a 20 20 20 20 23 20 23 20 . }.. # #
0790: 23 23 20 23 23 23 20 23 23 23 23 23 20 23 23 23 ## ### ##### ###
07a0: 23 23 23 23 23 20 23 23 23 23 23 23 23 23 23 23 ##### ##########
07b0: 23 23 23 0a 0a 20 20 20 20 74 79 70 65 6d 65 74 ###.. typemet
07c0: 68 6f 64 20 64 6f 74 73 74 6f 20 7b 70 61 74 68 hod dotsto {path
07d0: 7d 20 7b 0a 09 3a 3a 76 61 72 69 61 62 6c 65 20 } {..::variable
07e0: 6d 79 64 6f 74 64 65 73 74 69 6e 61 74 69 6f 6e mydotdestination
07f0: 20 24 70 61 74 68 0a 09 72 65 74 75 72 6e 0a 20 $path..return.
0800: 20 20 20 7d 0a 0a 20 20 20 20 74 79 70 65 6d 65 }.. typeme
0810: 74 68 6f 64 20 64 6f 74 20 7b 6c 61 62 65 6c 20 thod dot {label
0820: 63 68 61 6e 67 65 73 65 74 73 7d 20 7b 0a 09 3a changesets} {..:
0830: 3a 76 61 72 69 61 62 6c 65 20 6d 79 64 6f 74 70 :variable mydotp
0840: 72 65 66 69 78 20 24 6c 61 62 65 6c 0a 09 3a 3a refix $label..::
0850: 76 61 72 69 61 62 6c 65 20 6d 79 64 6f 74 69 64 variable mydotid
0860: 20 20 20 20 20 30 0a 0a 09 73 65 74 20 64 67 20 0...set dg
0870: 5b 53 65 74 75 70 20 24 63 68 61 6e 67 65 73 65 [Setup $changese
0880: 74 73 20 30 5d 0a 09 4d 61 72 6b 20 24 64 67 0a ts 0]..Mark $dg.
0890: 09 24 64 67 20 64 65 73 74 72 6f 79 0a 09 72 65 .$dg destroy..re
08a0: 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 turn. }..
08b0: 23 20 23 20 23 23 20 23 23 23 20 23 23 23 23 23 # # ## ### #####
08c0: 20 23 23 23 23 23 23 23 23 20 23 23 23 23 23 23 ######## ######
08d0: 23 23 23 23 23 23 23 0a 0a 20 20 20 20 74 79 70 #######.. typ
08e0: 65 6d 65 74 68 6f 64 20 72 75 6e 20 7b 6c 61 62 emethod run {lab
08f0: 65 6c 20 63 68 61 6e 67 65 73 65 74 63 6d 64 7d el changesetcmd}
0900: 20 7b 0a 09 3a 3a 76 61 72 69 61 62 6c 65 20 6d {..::variable m
0910: 79 61 74 20 20 20 20 20 20 20 20 30 0a 09 3a 3a yat 0..::
0920: 76 61 72 69 61 62 6c 65 20 6d 79 64 6f 74 70 72 variable mydotpr
0930: 65 66 69 78 20 24 6c 61 62 65 6c 0a 09 3a 3a 76 efix $label..::v
0940: 61 72 69 61 62 6c 65 20 6d 79 64 6f 74 69 64 20 ariable mydotid
0950: 20 20 20 20 30 0a 0a 09 23 20 57 65 20 63 72 65 0...# We cre
0960: 61 74 65 20 61 20 67 72 61 70 68 20 6f 66 20 74 ate a graph of t
0970: 68 65 20 72 65 76 69 73 69 6f 6e 20 63 68 61 6e he revision chan
0980: 67 65 73 65 74 73 2c 20 75 73 69 6e 67 20 74 68 gesets, using th
0990: 65 20 66 69 6c 65 0a 09 23 20 6c 65 76 65 6c 20 e file..# level
09a0: 64 65 70 65 6e 64 65 6e 63 69 65 73 20 74 6f 20 dependencies to
09b0: 63 6f 6e 73 74 72 75 63 74 20 61 20 66 69 72 73 construct a firs
09c0: 74 20 61 70 70 72 6f 78 69 6d 61 74 69 6f 6e 20 t approximation
09d0: 6f 66 20 74 68 65 0a 09 23 20 64 65 70 65 6e 64 of the..# depend
09e0: 65 6e 63 69 65 73 20 61 74 20 74 68 65 20 70 72 encies at the pr
09f0: 6f 6a 65 63 74 20 6c 65 76 65 6c 2e 20 54 68 65 oject level. The
0a00: 6e 20 77 65 20 6c 6f 6f 6b 20 66 6f 72 20 63 79 n we look for cy
0a10: 63 6c 65 73 0a 09 23 20 69 6e 20 74 68 61 74 20 cles..# in that
0a20: 67 72 61 70 68 20 61 6e 64 20 62 72 65 61 6b 20 graph and break
0a30: 74 68 65 6d 2e 0a 0a 09 23 20 31 2e 20 43 72 65 them....# 1. Cre
0a40: 61 74 65 20 6e 6f 64 65 73 20 66 6f 72 20 61 6c ate nodes for al
0a50: 6c 20 72 65 6c 65 76 61 6e 74 20 63 68 61 6e 67 l relevant chang
0a60: 65 73 65 74 73 20 61 6e 64 20 61 20 6d 61 70 70 esets and a mapp
0a70: 69 6e 67 0a 09 23 20 20 20 20 66 72 6f 6d 20 74 ing..# from t
0a80: 68 65 20 72 65 76 69 73 69 6f 6e 73 20 74 6f 20 he revisions to
0a90: 74 68 65 69 72 20 63 68 61 6e 67 65 73 65 74 73 their changesets
0aa0: 2f 6e 6f 64 65 73 2e 0a 0a 09 73 65 74 20 63 68 /nodes....set ch
0ab0: 61 6e 67 65 73 65 74 73 20 5b 75 70 6c 65 76 65 angesets [upleve
0ac0: 6c 20 23 30 20 24 63 68 61 6e 67 65 73 65 74 63 l #0 $changesetc
0ad0: 6d 64 5d 0a 09 73 65 74 20 64 67 20 5b 53 65 74 md]..set dg [Set
0ae0: 75 70 20 24 63 68 61 6e 67 65 73 65 74 73 5d 0a up $changesets].
0af0: 0a 09 23 20 33 2e 20 4c 61 73 74 6c 79 20 77 65 ..# 3. Lastly we
0b00: 20 69 74 65 72 61 74 65 20 74 68 65 20 67 72 61 iterate the gra
0b10: 70 68 20 74 6f 70 6f 6c 6f 67 69 63 61 6c 6c 79 ph topologically
0b20: 2e 20 57 65 20 6d 61 72 6b 20 6f 66 66 0a 09 23 . We mark off..#
0b30: 20 20 20 20 74 68 65 20 6e 6f 64 65 73 20 77 68 the nodes wh
0b40: 69 63 68 20 68 61 76 65 20 6e 6f 20 70 72 65 64 ich have no pred
0b50: 65 63 65 73 73 6f 72 73 2c 20 69 6e 20 6f 72 64 ecessors, in ord
0b60: 65 72 20 66 72 6f 6d 0a 09 23 20 20 20 20 6f 6c er from..# ol
0b70: 64 65 73 74 20 74 6f 20 79 6f 75 6e 67 65 73 74 dest to youngest
0b80: 2c 20 73 61 76 69 6e 67 20 61 6e 64 20 72 65 6d , saving and rem
0b90: 6f 76 69 6e 67 20 64 65 70 65 6e 64 65 6e 63 69 oving dependenci
0ba0: 65 73 2e 20 49 66 0a 09 23 20 20 20 20 77 65 20 es. If..# we
0bb0: 66 69 6e 64 20 6e 6f 20 6e 6f 64 65 73 20 77 69 find no nodes wi
0bc0: 74 68 6f 75 74 20 70 72 65 64 65 63 65 73 73 6f thout predecesso
0bd0: 72 73 20 77 65 20 68 61 76 65 20 61 20 63 79 63 rs we have a cyc
0be0: 6c 65 2c 0a 09 23 20 20 20 20 61 6e 64 20 77 6f le,..# and wo
0bf0: 72 6b 20 6f 6e 20 62 72 65 61 6b 69 6e 67 20 69 rk on breaking i
0c00: 74 2e 0a 0a 09 6c 6f 67 20 77 72 69 74 65 20 33 t....log write 3
0c10: 20 63 79 63 6c 65 62 72 65 61 6b 65 72 20 7b 4e cyclebreaker {N
0c20: 6f 77 20 73 6f 72 74 69 6e 67 20 74 68 65 20 63 ow sorting the c
0c30: 68 61 6e 67 65 73 65 74 73 2c 20 62 72 65 61 6b hangesets, break
0c40: 69 6e 67 20 63 79 63 6c 65 73 7d 0a 0a 09 49 6e ing cycles}...In
0c50: 69 74 69 61 6c 69 7a 65 43 61 6e 64 69 64 61 74 itializeCandidat
0c60: 65 73 20 24 64 67 0a 09 77 68 69 6c 65 20 7b 31 es $dg..while {1
0c70: 7d 20 7b 0a 09 20 20 20 20 77 68 69 6c 65 20 7b } {.. while {
0c80: 5b 57 69 74 68 6f 75 74 50 72 65 64 65 63 65 73 [WithoutPredeces
0c90: 73 6f 72 20 24 64 67 20 6e 5d 7d 20 7b 0a 09 09 sor $dg n]} {...
0ca0: 50 72 6f 63 65 73 73 65 64 48 6f 6f 6b 20 24 6e ProcessedHook $n
0cb0: 20 24 6d 79 61 74 0a 09 09 24 64 67 20 6e 6f 64 $myat...$dg nod
0cc0: 65 20 64 65 6c 65 74 65 20 24 6e 0a 09 09 69 6e e delete $n...in
0cd0: 63 72 20 6d 79 61 74 0a 09 09 53 68 6f 77 50 65 cr myat...ShowPe
0ce0: 6e 64 69 6e 67 4e 6f 64 65 73 0a 09 20 20 20 20 ndingNodes..
0cf0: 7d 0a 0a 09 20 20 20 20 69 66 20 7b 21 5b 6c 6c }... if {![ll
0d00: 65 6e 67 74 68 20 5b 64 67 20 6e 6f 64 65 73 5d ength [dg nodes]
0d10: 5d 7d 20 62 72 65 61 6b 0a 0a 09 20 20 20 20 42 ]} break... B
0d20: 72 65 61 6b 43 79 63 6c 65 48 6f 6f 6b 20 20 20 reakCycleHook
0d30: 20 20 20 20 24 64 67 0a 09 20 20 20 20 49 6e 69 $dg.. Ini
0d40: 74 69 61 6c 69 7a 65 43 61 6e 64 69 64 61 74 65 tializeCandidate
0d50: 73 20 24 64 67 0a 09 7d 0a 0a 09 24 64 67 20 64 s $dg..}...$dg d
0d60: 65 73 74 72 6f 79 0a 0a 09 6c 6f 67 20 77 72 69 estroy...log wri
0d70: 74 65 20 33 20 63 79 63 6c 65 62 72 65 61 6b 65 te 3 cyclebreake
0d80: 72 20 44 6f 6e 65 2e 0a 09 43 6c 65 61 72 48 6f r Done...ClearHo
0d90: 6f 6b 73 0a 0a 09 23 20 52 65 72 65 61 64 20 74 oks...# Reread t
0da0: 68 65 20 67 72 61 70 68 20 61 6e 64 20 64 75 6d he graph and dum
0db0: 70 20 69 74 73 20 66 69 6e 61 6c 20 66 6f 72 6d p its final form
0dc0: 2c 20 69 66 20 67 72 61 70 68 20 65 78 70 6f 72 , if graph expor
0dd0: 74 0a 09 23 20 77 61 73 20 61 63 74 69 76 61 74 t..# was activat
0de0: 65 64 2e 0a 0a 09 3a 3a 76 61 72 69 61 62 6c 65 ed....::variable
0df0: 20 6d 79 64 6f 74 64 65 73 74 69 6e 61 74 69 6f mydotdestinatio
0e00: 6e 0a 09 69 66 20 7b 24 6d 79 64 6f 74 64 65 73 n..if {$mydotdes
0e10: 74 69 6e 61 74 69 6f 6e 20 65 71 20 22 22 7d 20 tination eq ""}
0e20: 72 65 74 75 72 6e 0a 0a 09 73 65 74 20 20 20 64 return...set d
0e30: 67 20 5b 53 65 74 75 70 20 5b 75 70 6c 65 76 65 g [Setup [upleve
0e40: 6c 20 23 30 20 24 63 68 61 6e 67 65 73 65 74 63 l #0 $changesetc
0e50: 6d 64 5d 20 30 5d 0a 09 4d 61 72 6b 20 24 64 67 md] 0]..Mark $dg
0e60: 20 2d 64 6f 6e 65 0a 09 24 64 67 20 64 65 73 74 -done..$dg dest
0e70: 72 6f 79 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 roy..return.
0e80: 7d 0a 0a 20 20 20 20 23 20 23 20 23 23 20 23 23 }.. # # ## ##
0e90: 23 20 23 23 23 23 23 20 23 23 23 23 23 23 23 23 # ##### ########
0ea0: 20 23 23 23 23 23 23 23 23 23 23 23 23 23 0a 0a #############..
0eb0: 20 20 20 20 74 79 70 65 6d 65 74 68 6f 64 20 62 typemethod b
0ec0: 72 65 61 6b 20 7b 67 72 61 70 68 7d 20 7b 0a 09 reak {graph} {..
0ed0: 42 72 65 61 6b 43 79 63 6c 65 20 24 67 72 61 70 BreakCycle $grap
0ee0: 68 20 5b 46 69 6e 64 43 79 63 6c 65 20 24 67 72 h [FindCycle $gr
0ef0: 61 70 68 5d 0a 09 72 65 74 75 72 6e 0a 20 20 20 aph]..return.
0f00: 20 7d 0a 0a 20 20 20 20 74 79 70 65 6d 65 74 68 }.. typemeth
0f10: 6f 64 20 72 65 70 6c 61 63 65 20 7b 67 72 61 70 od replace {grap
0f20: 68 20 6e 20 72 65 70 6c 61 63 65 6d 65 6e 74 73 h n replacements
0f30: 7d 20 7b 0a 09 52 65 70 6c 61 63 65 20 24 67 72 } {..Replace $gr
0f40: 61 70 68 20 24 6e 20 24 72 65 70 6c 61 63 65 6d aph $n $replacem
0f50: 65 6e 74 73 0a 09 72 65 74 75 72 6e 0a 20 20 20 ents..return.
0f60: 20 7d 0a 0a 20 20 20 20 23 20 23 20 23 23 20 23 }.. # # ## #
0f70: 23 23 20 23 23 23 23 23 20 23 23 23 23 23 23 23 ## ##### #######
0f80: 23 20 23 23 23 23 23 23 23 23 23 23 23 23 23 0a # #############.
0f90: 20 20 20 20 23 23 20 49 6e 74 65 72 6e 61 6c 20 ## Internal
0fa0: 6d 65 74 68 6f 64 73 0a 0a 20 20 20 20 70 72 6f methods.. pro
0fb0: 63 20 53 65 74 75 70 20 7b 63 68 61 6e 67 65 73 c Setup {changes
0fc0: 65 74 73 20 7b 6c 6f 67 20 31 7d 7d 20 7b 0a 09 ets {log 1}} {..
0fd0: 69 66 20 7b 24 6c 6f 67 7d 20 7b 0a 09 20 20 20 if {$log} {..
0fe0: 20 6c 6f 67 20 77 72 69 74 65 20 33 20 63 79 63 log write 3 cyc
0ff0: 6c 65 62 72 65 61 6b 65 72 20 22 43 72 65 61 74 lebreaker "Creat
1000: 69 6e 67 20 63 68 61 6e 67 65 73 65 74 20 67 72 ing changeset gr
1010: 61 70 68 2c 20 66 69 6c 6c 69 6e 67 20 77 69 74 aph, filling wit
1020: 68 20 6e 6f 64 65 73 22 0a 09 20 20 20 20 6c 6f h nodes".. lo
1030: 67 20 77 72 69 74 65 20 33 20 63 79 63 6c 65 62 g write 3 cycleb
1040: 72 65 61 6b 65 72 20 22 41 64 64 69 6e 67 20 5b reaker "Adding [
1050: 6e 73 70 20 5b 6c 6c 65 6e 67 74 68 20 24 63 68 nsp [llength $ch
1060: 61 6e 67 65 73 65 74 73 5d 20 6e 6f 64 65 5d 22 angesets] node]"
1070: 0a 09 7d 0a 0a 09 73 65 74 20 64 67 20 5b 73 74 ..}...set dg [st
1080: 72 75 63 74 3a 3a 67 72 61 70 68 20 64 67 5d 0a ruct::graph dg].
1090: 0a 09 66 6f 72 65 61 63 68 20 63 73 65 74 20 24 ..foreach cset $
10a0: 63 68 61 6e 67 65 73 65 74 73 20 7b 0a 09 20 20 changesets {..
10b0: 20 20 24 64 67 20 6e 6f 64 65 20 69 6e 73 65 72 $dg node inser
10c0: 74 20 24 63 73 65 74 0a 09 20 20 20 20 24 64 67 t $cset.. $dg
10d0: 20 6e 6f 64 65 20 73 65 74 20 20 20 20 24 63 73 node set $cs
10e0: 65 74 20 74 69 6d 65 72 61 6e 67 65 20 5b 24 63 et timerange [$c
10f0: 73 65 74 20 74 69 6d 65 72 61 6e 67 65 5d 0a 09 set timerange]..
1100: 20 20 20 20 24 64 67 20 6e 6f 64 65 20 73 65 74 $dg node set
1110: 20 20 20 20 24 63 73 65 74 20 6c 61 62 65 6c 20 $cset label
1120: 20 20 20 20 5b 49 44 20 24 63 73 65 74 5d 0a 09 [ID $cset]..
1130: 7d 0a 0a 09 23 20 32 2e 20 46 69 6e 64 20 66 6f }...# 2. Find fo
1140: 72 20 61 6c 6c 20 72 65 6c 65 76 61 6e 74 20 63 r all relevant c
1150: 68 61 6e 67 65 73 65 74 20 74 68 65 69 72 20 72 hangeset their r
1160: 65 76 69 73 69 6f 6e 73 20 61 6e 64 20 74 68 65 evisions and the
1170: 69 72 0a 09 23 20 20 20 20 64 65 70 65 6e 64 65 ir..# depende
1180: 6e 63 69 65 73 2e 20 4d 61 70 20 74 68 65 20 6c ncies. Map the l
1190: 61 74 74 65 72 20 62 61 63 6b 20 74 6f 20 63 68 atter back to ch
11a0: 61 6e 67 65 73 65 74 73 20 61 6e 64 0a 09 23 20 angesets and..#
11b0: 20 20 20 63 6f 6e 73 74 72 75 63 74 20 74 68 65 construct the
11c0: 20 63 6f 72 72 65 73 70 6f 6e 64 69 6e 67 20 61 corresponding a
11d0: 72 63 73 2e 0a 0a 09 69 66 20 7b 24 6c 6f 67 7d rcs....if {$log}
11e0: 20 7b 0a 09 20 20 20 20 6c 6f 67 20 77 72 69 74 {.. log writ
11f0: 65 20 33 20 63 79 63 6c 65 62 72 65 61 6b 65 72 e 3 cyclebreaker
1200: 20 7b 53 65 74 74 69 6e 67 20 75 70 20 6e 6f 64 {Setting up nod
1210: 65 20 64 65 70 65 6e 64 65 6e 63 69 65 73 7d 0a e dependencies}.
1220: 09 7d 0a 0a 09 66 6f 72 65 61 63 68 20 63 73 65 .}...foreach cse
1230: 74 20 24 63 68 61 6e 67 65 73 65 74 73 20 7b 0a t $changesets {.
1240: 09 20 20 20 20 66 6f 72 65 61 63 68 20 73 75 63 . foreach suc
1250: 63 20 5b 24 63 73 65 74 20 73 75 63 63 65 73 73 c [$cset success
1260: 6f 72 73 5d 20 7b 0a 09 09 23 20 43 68 61 6e 67 ors] {...# Chang
1270: 65 73 65 74 73 20 6d 61 79 20 68 61 76 65 20 64 esets may have d
1280: 65 70 65 6e 64 65 6e 63 69 65 73 20 6f 75 74 73 ependencies outs
1290: 69 64 65 20 6f 66 20 74 68 65 0a 09 09 23 20 63 ide of the...# c
12a0: 68 6f 73 65 6e 20 73 65 74 2e 20 54 68 65 73 65 hosen set. These
12b0: 20 61 72 65 20 69 67 6e 6f 72 65 64 0a 09 09 69 are ignored...i
12c0: 66 20 7b 21 5b 24 64 67 20 6e 6f 64 65 20 65 78 f {![$dg node ex
12d0: 69 73 74 73 20 24 73 75 63 63 5d 7d 20 63 6f 6e ists $succ]} con
12e0: 74 69 6e 75 65 0a 09 09 24 64 67 20 61 72 63 20 tinue...$dg arc
12f0: 69 6e 73 65 72 74 20 24 63 73 65 74 20 24 73 75 insert $cset $su
1300: 63 63 0a 09 20 20 20 20 7d 0a 09 7d 0a 0a 09 23 cc.. }..}...#
1310: 20 52 75 6e 20 74 68 65 20 75 73 65 72 20 68 6f Run the user ho
1320: 6f 6b 20 74 6f 20 6d 61 6e 69 70 75 6c 61 74 65 ok to manipulate
1330: 20 74 68 65 20 67 72 61 70 68 20 62 65 66 6f 72 the graph befor
1340: 65 0a 09 23 20 63 6f 6e 73 75 6d 6d 61 74 69 6f e..# consummatio
1350: 6e 2e 0a 0a 09 69 66 20 7b 24 6c 6f 67 7d 20 7b n....if {$log} {
1360: 20 4d 61 72 6b 20 24 64 67 20 2d 73 74 61 72 74 Mark $dg -start
1370: 20 7d 0a 09 50 72 65 48 6f 6f 6b 20 24 64 67 0a }..PreHook $dg.
1380: 09 72 65 74 75 72 6e 20 20 24 64 67 0a 20 20 20 .return $dg.
1390: 20 7d 0a 0a 20 20 20 20 23 20 49 6e 73 74 65 61 }.. # Instea
13a0: 64 20 6f 66 20 73 65 61 72 63 68 69 6e 67 20 74 d of searching t
13b0: 68 65 20 77 68 6f 6c 65 20 67 72 61 70 68 20 66 he whole graph f
13c0: 6f 72 20 74 68 65 20 64 65 67 72 65 65 2d 30 20 or the degree-0
13d0: 6e 6f 64 65 73 20 69 6e 0a 20 20 20 20 23 20 65 nodes in. # e
13e0: 61 63 68 20 69 74 65 72 61 74 69 6f 6e 20 77 65 ach iteration we
13f0: 20 63 6f 6d 70 75 74 65 20 74 68 65 20 6c 69 73 compute the lis
1400: 74 20 6f 6e 63 65 20 74 6f 20 73 74 61 72 74 2c t once to start,
1410: 20 61 6e 64 20 74 68 65 6e 20 6f 6e 6c 79 0a 20 and then only.
1420: 20 20 20 23 20 75 70 64 61 74 65 20 69 74 20 69 # update it i
1430: 6e 63 72 65 6d 65 6e 74 61 6c 6c 79 20 62 61 73 ncrementally bas
1440: 65 64 20 6f 6e 20 74 68 65 20 6f 75 74 67 6f 69 ed on the outgoi
1450: 6e 67 20 6e 65 69 67 68 62 6f 75 72 73 20 6f 66 ng neighbours of
1460: 20 74 68 65 0a 20 20 20 20 23 20 6e 6f 64 65 20 the. # node
1470: 63 68 6f 73 65 6e 20 66 6f 72 20 63 6f 6d 6d 69 chosen for commi
1480: 74 2e 0a 0a 20 20 20 20 70 72 6f 63 20 49 6e 69 t... proc Ini
1490: 74 69 61 6c 69 7a 65 43 61 6e 64 69 64 61 74 65 tializeCandidate
14a0: 73 20 7b 64 67 7d 20 7b 0a 09 23 20 62 6f 74 74 s {dg} {..# bott
14b0: 6f 6d 20 3d 20 6c 69 73 74 20 28 6c 69 73 74 20 om = list (list
14c0: 28 6e 6f 64 65 2c 20 72 61 6e 67 65 20 6d 69 6e (node, range min
14d0: 2c 20 72 61 6e 67 65 20 6d 61 78 29 29 0a 09 3a , range max))..:
14e0: 3a 76 61 72 69 61 62 6c 65 20 6d 79 62 6f 74 74 :variable mybott
14f0: 6f 6d 0a 09 66 6f 72 65 61 63 68 20 6e 20 5b 24 om..foreach n [$
1500: 64 67 20 6e 6f 64 65 73 5d 20 7b 0a 09 20 20 20 dg nodes] {..
1510: 20 69 66 20 7b 5b 24 64 67 20 6e 6f 64 65 20 64 if {[$dg node d
1520: 65 67 72 65 65 20 2d 69 6e 20 24 6e 5d 7d 20 63 egree -in $n]} c
1530: 6f 6e 74 69 6e 75 65 0a 09 20 20 20 20 6c 61 70 ontinue.. lap
1540: 70 65 6e 64 20 6d 79 62 6f 74 74 6f 6d 20 5b 6c pend mybottom [l
1550: 69 6e 73 65 72 74 20 5b 24 64 67 20 6e 6f 64 65 insert [$dg node
1560: 20 67 65 74 20 24 6e 20 74 69 6d 65 72 61 6e 67 get $n timerang
1570: 65 5d 20 30 20 24 6e 5d 0a 09 7d 0a 09 73 65 74 e] 0 $n]..}..set
1580: 20 6d 79 62 6f 74 74 6f 6d 20 5b 6c 73 6f 72 74 mybottom [lsort
1590: 20 2d 69 6e 64 65 78 20 31 20 2d 69 6e 74 65 67 -index 1 -integ
15a0: 65 72 20 5b 6c 73 6f 72 74 20 2d 69 6e 64 65 78 er [lsort -index
15b0: 20 32 20 2d 69 6e 74 65 67 65 72 20 24 6d 79 62 2 -integer $myb
15c0: 6f 74 74 6f 6d 5d 5d 0a 09 53 68 6f 77 50 65 6e ottom]]..ShowPen
15d0: 64 69 6e 67 4e 6f 64 65 73 0a 09 72 65 74 75 72 dingNodes..retur
15e0: 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 70 72 6f n. }.. pro
15f0: 63 20 57 69 74 68 6f 75 74 50 72 65 64 65 63 65 c WithoutPredece
1600: 73 73 6f 72 20 7b 64 67 20 6e 76 7d 20 7b 0a 09 ssor {dg nv} {..
1610: 3a 3a 76 61 72 69 61 62 6c 65 20 6d 79 62 6f 74 ::variable mybot
1620: 74 6f 6d 0a 0a 09 75 70 76 61 72 20 31 20 24 6e tom...upvar 1 $n
1630: 76 20 6e 0a 09 69 66 20 7b 21 5b 6c 6c 65 6e 67 v n..if {![lleng
1640: 74 68 20 24 6d 79 62 6f 74 74 6f 6d 5d 7d 20 7b th $mybottom]} {
1650: 20 72 65 74 75 72 6e 20 30 20 7d 0a 0a 09 73 65 return 0 }...se
1660: 74 20 6e 20 5b 6c 69 6e 64 65 78 20 5b 6c 69 6e t n [lindex [lin
1670: 64 65 78 20 24 6d 79 62 6f 74 74 6f 6d 20 30 5d dex $mybottom 0]
1680: 20 30 5d 0a 09 73 65 74 20 6d 79 62 6f 74 74 6f 0]..set mybotto
1690: 6d 20 5b 6c 72 61 6e 67 65 20 24 6d 79 62 6f 74 m [lrange $mybot
16a0: 74 6f 6d 20 31 20 65 6e 64 5d 0a 09 73 65 74 20 tom 1 end]..set
16b0: 63 68 61 6e 67 65 64 20 30 0a 0a 09 23 20 55 70 changed 0...# Up
16c0: 64 61 74 65 20 6c 69 73 74 20 6f 66 20 6e 6f 64 date list of nod
16d0: 65 73 20 77 69 74 68 6f 75 74 20 70 72 65 64 65 es without prede
16e0: 63 65 73 73 6f 72 2c 20 62 61 73 65 64 20 6f 6e cessor, based on
16f0: 20 74 68 65 0a 09 23 20 6f 75 74 67 6f 69 6e 67 the..# outgoing
1700: 20 6e 65 69 67 68 62 6f 75 72 73 20 6f 66 20 74 neighbours of t
1710: 68 65 20 63 68 6f 73 65 6e 20 6e 6f 64 65 2e 20 he chosen node.
1720: 54 68 69 73 20 73 68 6f 75 6c 64 20 62 65 0a 09 This should be..
1730: 23 20 66 61 73 74 65 72 20 74 68 61 6e 20 69 74 # faster than it
1740: 65 72 61 74 69 6e 67 20 6f 66 20 74 68 65 20 77 erating of the w
1750: 68 6f 6c 65 20 73 65 74 20 6f 66 20 6e 6f 64 65 hole set of node
1760: 73 2c 20 66 69 6e 64 69 6e 67 20 61 6c 6c 0a 09 s, finding all..
1770: 23 20 77 69 74 68 6f 75 74 20 70 72 65 64 65 63 # without predec
1780: 65 73 73 6f 72 73 2c 20 73 6f 72 74 69 6e 67 20 essors, sorting
1790: 74 68 65 6d 20 62 79 20 74 69 6d 65 2c 20 65 74 them by time, et
17a0: 63 2e 20 70 70 2e 0a 09 66 6f 72 65 61 63 68 20 c. pp...foreach
17b0: 6f 75 74 20 5b 24 64 67 20 6e 6f 64 65 73 20 2d out [$dg nodes -
17c0: 6f 75 74 20 24 6e 5d 20 7b 0a 09 20 20 20 20 69 out $n] {.. i
17d0: 66 20 7b 5b 24 64 67 20 6e 6f 64 65 20 64 65 67 f {[$dg node deg
17e0: 72 65 65 20 2d 69 6e 20 24 6f 75 74 5d 20 3e 20 ree -in $out] >
17f0: 31 7d 20 63 6f 6e 74 69 6e 75 65 0a 09 20 20 20 1} continue..
1800: 20 23 20 44 65 67 72 65 65 2d 31 20 6e 65 69 67 # Degree-1 neig
1810: 68 62 6f 75 72 2c 20 77 69 6c 6c 20 68 61 76 65 hbour, will have
1820: 20 6e 6f 20 70 72 65 64 65 63 65 73 73 6f 72 73 no predecessors
1830: 20 61 66 74 65 72 20 74 68 65 0a 09 20 20 20 20 after the..
1840: 23 20 72 65 6d 6f 76 61 6c 20 6f 66 20 6e 2e 20 # removal of n.
1850: 50 75 74 20 6f 6e 20 74 68 65 20 6c 69 73 74 2e Put on the list.
1860: 0a 09 20 20 20 20 6c 61 70 70 65 6e 64 20 6d 79 .. lappend my
1870: 62 6f 74 74 6f 6d 20 5b 6c 69 6e 73 65 72 74 20 bottom [linsert
1880: 5b 24 64 67 20 6e 6f 64 65 20 67 65 74 20 24 6f [$dg node get $o
1890: 75 74 20 74 69 6d 65 72 61 6e 67 65 5d 20 30 20 ut timerange] 0
18a0: 24 6f 75 74 5d 0a 09 20 20 20 20 73 65 74 20 63 $out].. set c
18b0: 68 61 6e 67 65 64 20 31 0a 09 7d 0a 09 69 66 20 hanged 1..}..if
18c0: 7b 24 63 68 61 6e 67 65 64 7d 20 7b 0a 09 20 20 {$changed} {..
18d0: 20 20 73 65 74 20 6d 79 62 6f 74 74 6f 6d 20 5b set mybottom [
18e0: 6c 73 6f 72 74 20 2d 69 6e 64 65 78 20 31 20 2d lsort -index 1 -
18f0: 69 6e 74 65 67 65 72 20 5b 6c 73 6f 72 74 20 2d integer [lsort -
1900: 69 6e 64 65 78 20 32 20 2d 69 6e 74 65 67 65 72 index 2 -integer
1910: 20 24 6d 79 62 6f 74 74 6f 6d 5d 5d 0a 09 7d 0a $mybottom]]..}.
1920: 0a 09 23 20 57 65 20 64 6f 20 6e 6f 74 20 64 65 ..# We do not de
1930: 6c 65 74 65 20 74 68 65 20 6e 6f 64 65 20 69 6d lete the node im
1940: 6d 65 64 69 61 74 65 6c 79 2c 20 74 6f 20 61 6c mediately, to al
1950: 6c 6f 77 20 74 68 65 20 53 61 76 65 0a 09 23 20 low the Save..#
1960: 70 72 6f 63 65 64 75 72 65 20 74 6f 20 73 61 76 procedure to sav
1970: 65 20 74 68 65 20 64 65 70 65 6e 64 65 6e 63 69 e the dependenci
1980: 65 73 20 61 73 20 77 65 6c 6c 20 28 65 6e 63 6f es as well (enco
1990: 64 65 64 20 69 6e 20 74 68 65 0a 09 23 20 61 72 ded in the..# ar
19a0: 63 73 29 2e 0a 09 72 65 74 75 72 6e 20 31 0a 20 cs)...return 1.
19b0: 20 20 20 7d 0a 0a 20 20 20 20 70 72 6f 63 20 53 }.. proc S
19c0: 68 6f 77 50 65 6e 64 69 6e 67 4e 6f 64 65 73 20 howPendingNodes
19d0: 7b 7d 20 7b 0a 09 69 66 20 7b 5b 6c 6f 67 20 76 {} {..if {[log v
19e0: 65 72 62 6f 73 69 74 79 3f 5d 20 3c 20 31 30 7d erbosity?] < 10}
19f0: 20 72 65 74 75 72 6e 0a 09 3a 3a 76 61 72 69 61 return..::varia
1a00: 62 6c 65 20 6d 79 62 6f 74 74 6f 6d 0a 09 6c 6f ble mybottom..lo
1a10: 67 20 77 72 69 74 65 20 31 30 20 63 79 63 6c 65 g write 10 cycle
1a20: 62 72 65 61 6b 65 72 20 5c 0a 09 20 20 20 20 22 breaker \.. "
1a30: 50 65 6e 64 69 6e 67 3a 20 5b 73 74 72 75 63 74 Pending: [struct
1a40: 3a 3a 6c 69 73 74 20 6d 61 70 20 24 6d 79 62 6f ::list map $mybo
1a50: 74 74 6f 6d 20 5b 6d 79 70 72 6f 63 20 46 6f 72 ttom [myproc For
1a60: 6d 61 74 50 65 6e 64 69 6e 67 49 74 65 6d 5d 5d matPendingItem]]
1a70: 22 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a "..return. }.
1a80: 0a 20 20 20 20 70 72 6f 63 20 46 6f 72 6d 61 74 . proc Format
1a90: 50 65 6e 64 69 6e 67 49 74 65 6d 20 7b 69 74 65 PendingItem {ite
1aa0: 6d 7d 20 7b 20 6c 72 65 70 6c 61 63 65 20 24 69 m} { lreplace $i
1ab0: 74 65 6d 20 30 20 30 20 3c 5b 5b 6c 69 6e 64 65 tem 0 0 <[[linde
1ac0: 78 20 24 69 74 65 6d 20 30 5d 20 69 64 5d 3e 20 x $item 0] id]>
1ad0: 7d 0a 0a 20 20 20 20 70 72 6f 63 20 46 69 6e 64 }.. proc Find
1ae0: 43 79 63 6c 65 20 7b 64 67 7d 20 7b 0a 09 23 20 Cycle {dg} {..#
1af0: 54 68 69 73 20 70 72 6f 63 65 64 75 72 65 20 69 This procedure i
1b00: 73 20 72 75 6e 20 69 66 20 61 6e 64 20 6f 6e 6c s run if and onl
1b10: 79 20 74 68 65 20 67 72 61 70 68 20 69 73 20 6e y the graph is n
1b20: 6f 74 20 65 6d 70 74 79 20 61 6e 64 0a 09 23 20 ot empty and..#
1b30: 61 6c 6c 20 6e 6f 64 65 73 20 68 61 76 65 20 70 all nodes have p
1b40: 72 65 64 65 63 65 73 73 6f 72 73 2e 20 54 68 69 redecessors. Thi
1b50: 73 20 6d 65 61 6e 73 20 74 68 61 74 20 65 61 63 s means that eac
1b60: 68 20 6e 6f 64 65 20 69 73 0a 09 23 20 65 69 74 h node is..# eit
1b70: 68 65 72 20 70 61 72 74 20 6f 66 20 61 20 63 79 her part of a cy
1b80: 63 6c 65 20 6f 72 20 28 69 6e 64 69 72 65 63 74 cle or (indirect
1b90: 6c 79 29 20 64 65 70 65 6e 64 69 6e 67 20 6f 6e ly) depending on
1ba0: 20 61 20 6e 6f 64 65 0a 09 23 20 69 6e 20 61 20 a node..# in a
1bb0: 63 79 63 6c 65 2e 20 57 65 20 63 61 6e 20 73 74 cycle. We can st
1bc0: 61 72 74 20 61 74 20 61 6e 20 61 72 62 69 74 72 art at an arbitr
1bd0: 61 72 79 20 6e 6f 64 65 2c 20 66 6f 6c 6c 6f 77 ary node, follow
1be0: 20 69 74 73 0a 09 23 20 69 6e 63 6f 6d 69 6e 67 its..# incoming
1bf0: 20 65 64 67 65 73 20 74 6f 20 69 74 73 20 70 72 edges to its pr
1c00: 65 64 65 63 65 73 73 6f 72 73 20 75 6e 74 69 6c edecessors until
1c10: 20 77 65 20 73 65 65 20 61 20 6e 6f 64 65 20 61 we see a node a
1c20: 0a 09 23 20 73 65 63 6f 6e 64 20 74 69 6d 65 2e ..# second time.
1c30: 20 54 68 61 74 20 6e 6f 64 65 20 63 6c 6f 73 65 That node close
1c40: 73 20 74 68 65 20 63 79 63 6c 65 20 61 6e 64 20 s the cycle and
1c50: 74 68 65 20 62 65 67 69 6e 6e 69 6e 67 20 69 73 the beginning is
1c60: 0a 09 23 20 69 74 73 20 66 69 72 73 74 20 6f 63 ..# its first oc
1c70: 63 75 72 65 6e 63 65 2e 20 4e 6f 74 65 20 74 68 curence. Note th
1c80: 61 74 20 77 65 20 63 61 6e 20 63 68 6f 6f 73 65 at we can choose
1c90: 20 61 6e 20 61 72 62 69 74 72 61 72 79 0a 09 23 an arbitrary..#
1ca0: 20 70 72 65 64 65 63 65 73 73 6f 72 20 6f 66 20 predecessor of
1cb0: 65 61 63 68 20 6e 6f 64 65 20 61 73 20 77 65 6c each node as wel
1cc0: 6c 2c 20 77 65 20 64 6f 20 6e 6f 74 20 68 61 76 l, we do not hav
1cd0: 65 20 74 6f 20 73 65 61 72 63 68 2e 0a 0a 09 23 e to search....#
1ce0: 20 57 65 20 72 65 63 6f 72 64 20 66 6f 72 20 65 We record for e
1cf0: 61 63 68 20 6e 6f 64 65 20 74 68 65 20 69 6e 64 ach node the ind
1d00: 65 78 20 6f 66 20 74 68 65 20 66 69 72 73 74 20 ex of the first
1d10: 61 70 70 65 61 72 61 6e 63 65 20 69 6e 0a 09 23 appearance in..#
1d20: 20 74 68 65 20 70 61 74 68 2c 20 6d 61 6b 69 6e the path, makin
1d30: 67 20 69 74 20 65 61 73 79 20 61 74 20 74 68 65 g it easy at the
1d40: 20 65 6e 64 20 74 6f 20 63 75 74 20 74 68 65 20 end to cut the
1d50: 63 79 63 6c 65 20 66 72 6f 6d 0a 09 23 20 69 74 cycle from..# it
1d60: 2e 0a 0a 09 23 20 43 68 6f 6f 73 65 20 61 72 62 ....# Choose arb
1d70: 69 74 72 61 72 79 20 6e 6f 64 65 20 74 6f 20 73 itrary node to s
1d80: 74 61 72 74 20 6f 75 72 20 73 65 61 72 63 68 20 tart our search
1d90: 61 74 2e 0a 09 73 65 74 20 73 74 61 72 74 20 5b at...set start [
1da0: 6c 69 6e 64 65 78 20 5b 24 64 67 20 6e 6f 64 65 lindex [$dg node
1db0: 73 5d 20 30 5d 0a 0a 09 23 20 49 6e 69 74 69 61 s] 0]...# Initia
1dc0: 6c 69 7a 65 20 73 74 61 74 65 2c 20 70 61 74 68 lize state, path
1dd0: 20 6f 66 20 73 65 65 6e 20 6e 6f 64 65 73 2c 20 of seen nodes,
1de0: 61 6e 64 20 77 68 65 6e 20 73 65 65 6e 2e 0a 09 and when seen...
1df0: 73 65 74 20 20 20 20 20 20 20 70 61 74 68 20 7b set path {
1e00: 7d 0a 09 61 72 72 61 79 20 73 65 74 20 73 65 65 }..array set see
1e10: 6e 20 7b 7d 0a 0a 09 77 68 69 6c 65 20 7b 31 7d n {}...while {1}
1e20: 20 7b 0a 09 20 20 20 20 23 20 53 74 6f 70 20 73 {.. # Stop s
1e30: 65 61 72 63 68 69 6e 67 20 77 68 65 6e 20 77 65 earching when we
1e40: 20 68 61 76 65 20 73 65 65 6e 20 74 68 65 20 63 have seen the c
1e50: 75 72 72 65 6e 74 20 6e 6f 64 65 0a 09 20 20 20 urrent node..
1e60: 20 23 20 61 6c 72 65 61 64 79 2c 20 74 68 65 20 # already, the
1e70: 63 69 72 63 6c 65 20 68 61 73 20 62 65 65 6e 20 circle has been
1e80: 63 6c 6f 73 65 64 2e 0a 09 20 20 20 20 69 66 20 closed... if
1e90: 7b 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 73 65 {[info exists se
1ea0: 65 6e 28 24 73 74 61 72 74 29 5d 7d 20 62 72 65 en($start)]} bre
1eb0: 61 6b 0a 09 20 20 20 20 6c 61 70 70 65 6e 64 20 ak.. lappend
1ec0: 70 61 74 68 20 24 73 74 61 72 74 0a 09 20 20 20 path $start..
1ed0: 20 73 65 74 20 73 65 65 6e 28 24 73 74 61 72 74 set seen($start
1ee0: 29 20 5b 65 78 70 72 20 7b 5b 6c 6c 65 6e 67 74 ) [expr {[llengt
1ef0: 68 20 24 70 61 74 68 5d 2d 31 7d 5d 0a 09 20 20 h $path]-1}]..
1f00: 20 20 23 20 43 68 6f 6f 73 65 20 61 72 62 69 74 # Choose arbit
1f10: 72 61 72 79 20 70 72 65 64 65 63 65 73 73 6f 72 rary predecessor
1f20: 0a 09 20 20 20 20 73 65 74 20 73 74 61 72 74 20 .. set start
1f30: 5b 6c 69 6e 64 65 78 20 5b 24 64 67 20 6e 6f 64 [lindex [$dg nod
1f40: 65 73 20 2d 69 6e 20 24 73 74 61 72 74 5d 20 30 es -in $start] 0
1f50: 5d 0a 09 7d 0a 0a 09 72 65 74 75 72 6e 20 5b 73 ]..}...return [s
1f60: 74 72 75 63 74 3a 3a 6c 69 73 74 20 72 65 76 65 truct::list reve
1f70: 72 73 65 20 5b 6c 72 61 6e 67 65 20 24 70 61 74 rse [lrange $pat
1f80: 68 20 24 73 65 65 6e 28 24 73 74 61 72 74 29 20 h $seen($start)
1f90: 65 6e 64 5d 5d 0a 20 20 20 20 7d 0a 0a 20 20 20 end]]. }..
1fa0: 20 70 72 6f 63 20 49 44 20 7b 63 73 65 74 7d 20 proc ID {cset}
1fb0: 7b 20 72 65 74 75 72 6e 20 22 3c 5b 24 63 73 65 { return "<[$cse
1fc0: 74 20 69 64 5d 3e 22 20 7d 0a 0a 20 20 20 20 70 t id]>" }.. p
1fd0: 72 6f 63 20 42 72 65 61 6b 43 79 63 6c 65 20 7b roc BreakCycle {
1fe0: 64 67 20 63 79 63 6c 65 7d 20 7b 0a 09 23 20 54 dg cycle} {..# T
1ff0: 68 65 20 63 79 63 6c 65 20 77 65 20 68 61 76 65 he cycle we have
2000: 20 67 6f 74 74 65 6e 20 69 73 20 62 72 6f 6b 65 gotten is broke
2010: 6e 20 62 79 20 62 72 65 61 6b 69 6e 67 20 61 70 n by breaking ap
2020: 61 72 74 20 6f 6e 65 20 6f 72 0a 09 23 20 6d 6f art one or..# mo
2030: 72 65 20 6f 66 20 74 68 65 20 63 68 61 6e 67 65 re of the change
2040: 73 65 74 73 20 69 6e 20 74 68 65 20 63 79 63 6c sets in the cycl
2050: 65 2e 20 54 68 69 73 20 63 61 75 73 65 73 20 75 e. This causes u
2060: 73 20 74 6f 0a 09 23 20 63 72 65 61 74 65 20 6f s to..# create o
2070: 6e 65 20 6f 72 20 6d 6f 72 65 20 63 68 61 6e 67 ne or more chang
2080: 65 73 65 74 73 20 77 68 69 63 68 20 61 72 65 20 esets which are
2090: 74 6f 20 62 65 20 63 6f 6d 6d 69 74 74 65 64 2c to be committed,
20a0: 0a 09 23 20 61 64 64 65 64 20 74 6f 20 74 68 65 ..# added to the
20b0: 20 67 72 61 70 68 2c 20 65 74 63 2e 20 70 70 2e graph, etc. pp.
20c0: 0a 0a 09 73 65 74 20 63 70 72 69 6e 74 20 5b 6a ...set cprint [j
20d0: 6f 69 6e 20 5b 73 74 72 75 63 74 3a 3a 6c 69 73 oin [struct::lis
20e0: 74 20 6d 61 70 20 24 63 79 63 6c 65 20 5b 6d 79 t map $cycle [my
20f0: 70 72 6f 63 20 49 44 5d 5d 20 7b 20 7d 5d 0a 0a proc ID]] { }]..
2100: 09 6c 61 70 70 65 6e 64 20 63 79 63 6c 65 20 5b .lappend cycle [
2110: 6c 69 6e 64 65 78 20 24 63 79 63 6c 65 20 30 5d lindex $cycle 0]
2120: 20 5b 6c 69 6e 64 65 78 20 24 63 79 63 6c 65 20 [lindex $cycle
2130: 31 5d 0a 09 73 65 74 20 62 65 73 74 6c 69 6e 6b 1]..set bestlink
2140: 20 7b 7d 0a 09 73 65 74 20 62 65 73 74 6e 6f 64 {}..set bestnod
2150: 65 20 7b 7d 0a 0a 09 66 6f 72 65 61 63 68 20 5c e {}...foreach \
2160: 0a 09 20 20 20 20 70 72 65 76 20 5b 6c 72 61 6e .. prev [lran
2170: 67 65 20 24 63 79 63 6c 65 20 30 20 65 6e 64 2d ge $cycle 0 end-
2180: 32 5d 20 5c 0a 09 20 20 20 20 63 73 65 74 20 5b 2] \.. cset [
2190: 6c 72 61 6e 67 65 20 24 63 79 63 6c 65 20 31 20 lrange $cycle 1
21a0: 65 6e 64 2d 31 5d 20 5c 0a 09 20 20 20 20 6e 65 end-1] \.. ne
21b0: 78 74 20 5b 6c 72 61 6e 67 65 20 24 63 79 63 6c xt [lrange $cycl
21c0: 65 20 32 20 65 6e 64 5d 20 7b 0a 0a 09 09 23 20 e 2 end] {....#
21d0: 45 61 63 68 20 74 72 69 70 6c 65 20 50 52 45 56 Each triple PREV
21e0: 20 2d 3e 20 43 53 45 54 20 2d 3e 20 4e 45 58 54 -> CSET -> NEXT
21f0: 20 6f 66 20 63 68 61 6e 67 65 73 65 74 73 2c 20 of changesets,
2200: 61 0a 09 09 23 20 27 6c 69 6e 6b 27 20 69 6e 20 a...# 'link' in
2210: 74 68 65 20 63 79 63 6c 65 2c 20 69 73 20 61 6e the cycle, is an
2220: 61 6c 79 73 65 64 20 61 6e 64 20 74 68 65 20 62 alysed and the b
2230: 65 73 74 0a 09 09 23 20 6c 6f 63 61 74 69 6f 6e est...# location
2240: 20 77 68 65 72 65 20 74 6f 20 61 74 20 6c 65 61 where to at lea
2250: 73 74 20 77 65 61 6b 65 6e 20 74 68 65 20 63 79 st weaken the cy
2260: 63 6c 65 20 69 73 0a 09 09 23 20 63 68 6f 73 65 cle is...# chose
2270: 6e 20 66 6f 72 20 66 75 72 74 68 65 72 20 70 72 n for further pr
2280: 6f 63 65 73 73 69 6e 67 2e 0a 0a 09 09 73 65 74 ocessing.....set
2290: 20 6c 69 6e 6b 20 5b 70 72 6f 6a 65 63 74 3a 3a link [project::
22a0: 72 65 76 6c 69 6e 6b 20 25 41 55 54 4f 25 20 24 revlink %AUTO% $
22b0: 70 72 65 76 20 24 63 73 65 74 20 24 6e 65 78 74 prev $cset $next
22c0: 5d 0a 09 09 69 66 20 7b 24 62 65 73 74 6c 69 6e ]...if {$bestlin
22d0: 6b 20 65 71 20 22 22 7d 20 7b 0a 09 09 20 20 20 k eq ""} {...
22e0: 20 73 65 74 20 62 65 73 74 6c 69 6e 6b 20 24 6c set bestlink $l
22f0: 69 6e 6b 0a 09 09 20 20 20 20 73 65 74 20 62 65 ink... set be
2300: 73 74 6e 6f 64 65 20 24 63 73 65 74 0a 09 09 7d stnode $cset...}
2310: 20 65 6c 73 65 69 66 20 7b 5b 24 6c 69 6e 6b 20 elseif {[$link
2320: 62 65 74 74 65 72 74 68 61 6e 20 24 62 65 73 74 betterthan $best
2330: 6c 69 6e 6b 5d 7d 20 7b 0a 09 09 20 20 20 20 24 link]} {... $
2340: 62 65 73 74 6c 69 6e 6b 20 64 65 73 74 72 6f 79 bestlink destroy
2350: 0a 09 09 20 20 20 20 73 65 74 20 62 65 73 74 6c ... set bestl
2360: 69 6e 6b 20 24 6c 69 6e 6b 0a 09 09 20 20 20 20 ink $link...
2370: 73 65 74 20 62 65 73 74 6e 6f 64 65 20 24 63 73 set bestnode $cs
2380: 65 74 0a 09 09 7d 20 65 6c 73 65 20 7b 0a 09 09 et...} else {...
2390: 20 20 20 20 24 6c 69 6e 6b 20 64 65 73 74 72 6f $link destro
23a0: 79 0a 09 09 7d 0a 09 20 20 20 20 7d 0a 0a 09 6c y...}.. }...l
23b0: 6f 67 20 77 72 69 74 65 20 35 20 63 79 63 6c 65 og write 5 cycle
23c0: 62 72 65 61 6b 65 72 20 22 42 72 65 61 6b 69 6e breaker "Breakin
23d0: 67 20 63 79 63 6c 65 20 28 24 63 70 72 69 6e 74 g cycle ($cprint
23e0: 29 20 62 79 20 73 70 6c 69 74 74 69 6e 67 20 63 ) by splitting c
23f0: 68 61 6e 67 65 73 65 74 20 3c 5b 24 62 65 73 74 hangeset <[$best
2400: 6e 6f 64 65 20 69 64 5d 3e 22 0a 09 73 65 74 20 node id]>"..set
2410: 49 44 20 5b 24 62 65 73 74 6e 6f 64 65 20 69 64 ID [$bestnode id
2420: 5d 0a 09 4d 61 72 6b 20 24 64 67 20 2d 24 7b 49 ]..Mark $dg -${I
2430: 44 7d 2d 62 65 66 6f 72 65 0a 0a 09 73 65 74 20 D}-before...set
2440: 6e 65 77 63 73 65 74 73 20 5b 24 62 65 73 74 6c newcsets [$bestl
2450: 69 6e 6b 20 62 72 65 61 6b 5d 0a 09 24 62 65 73 ink break]..$bes
2460: 74 6c 69 6e 6b 20 64 65 73 74 72 6f 79 0a 0a 20 tlink destroy..
2470: 20 20 20 20 20 20 20 23 20 41 74 20 74 68 69 73 # At this
2480: 20 70 6f 69 6e 74 20 74 68 65 20 6f 6c 64 20 63 point the old c
2490: 68 61 6e 67 65 73 65 74 20 28 42 45 53 54 4e 4f hangeset (BESTNO
24a0: 44 45 29 20 69 73 20 67 6f 6e 65 0a 20 20 20 20 DE) is gone.
24b0: 20 20 20 20 23 20 61 6c 72 65 61 64 79 2e 20 57 # already. W
24c0: 65 20 72 65 6d 6f 76 65 20 69 74 20 66 72 6f 6d e remove it from
24d0: 20 74 68 65 20 67 72 61 70 68 20 61 73 20 77 65 the graph as we
24e0: 6c 6c 20 61 6e 64 20 74 68 65 6e 20 65 6e 74 65 ll and then ente
24f0: 72 0a 20 20 20 20 20 20 20 20 23 20 74 68 65 20 r. # the
2500: 66 72 61 67 6d 65 6e 74 73 20 67 65 6e 65 72 61 fragments genera
2510: 74 65 64 20 66 6f 72 20 69 74 2e 0a 0a 09 52 65 ted for it....Re
2520: 70 6c 61 63 65 20 24 64 67 20 24 62 65 73 74 6e place $dg $bestn
2530: 6f 64 65 20 24 6e 65 77 63 73 65 74 73 0a 0a 09 ode $newcsets...
2540: 4d 61 72 6b 20 24 64 67 20 2d 24 7b 49 44 7d 2d Mark $dg -${ID}-
2550: 61 66 74 65 72 0a 09 72 65 74 75 72 6e 0a 20 20 after..return.
2560: 20 20 7d 0a 0a 20 20 20 20 23 20 54 4f 44 4f 3a }.. # TODO:
2570: 20 54 68 69 73 20 73 68 6f 75 6c 64 20 62 65 20 This should be
2580: 61 20 67 72 61 70 68 20 6d 65 74 68 6f 64 2e 0a a graph method..
2590: 20 20 20 20 70 72 6f 63 20 48 61 73 41 72 63 20 proc HasArc
25a0: 7b 64 67 20 61 20 62 7d 20 7b 0a 09 23 38 2e 35 {dg a b} {..#8.5
25b0: 3a 20 72 65 74 75 72 6e 20 5b 65 78 70 72 20 7b : return [expr {
25c0: 24 62 20 69 6e 20 5b 24 64 67 20 6e 6f 64 65 73 $b in [$dg nodes
25d0: 20 2d 6f 75 74 20 24 61 5d 7d 5d 0a 09 69 66 20 -out $a]}]..if
25e0: 7b 5b 6c 73 65 61 72 63 68 20 2d 65 78 61 63 74 {[lsearch -exact
25f0: 20 5b 24 64 67 20 6e 6f 64 65 73 20 2d 6f 75 74 [$dg nodes -out
2600: 20 24 61 5d 20 24 62 5d 20 3c 20 30 7d 20 7b 20 $a] $b] < 0} {
2610: 72 65 74 75 72 6e 20 30 20 7d 0a 09 72 65 74 75 return 0 }..retu
2620: 72 6e 20 31 0a 20 20 20 20 7d 0a 0a 20 20 20 20 rn 1. }..
2630: 70 72 6f 63 20 4d 61 72 6b 20 7b 64 67 20 7b 73 proc Mark {dg {s
2640: 75 66 66 69 78 20 7b 7d 7d 7d 20 7b 0a 09 3a 3a uffix {}}} {..::
2650: 76 61 72 69 61 62 6c 65 20 6d 79 64 6f 74 64 65 variable mydotde
2660: 73 74 69 6e 61 74 69 6f 6e 0a 09 69 66 20 7b 24 stination..if {$
2670: 6d 79 64 6f 74 64 65 73 74 69 6e 61 74 69 6f 6e mydotdestination
2680: 20 65 71 20 22 22 7d 20 72 65 74 75 72 6e 0a 09 eq ""} return..
2690: 3a 3a 76 61 72 69 61 62 6c 65 20 6d 79 64 6f 74 ::variable mydot
26a0: 70 72 65 66 69 78 0a 09 3a 3a 76 61 72 69 61 62 prefix..::variab
26b0: 6c 65 20 6d 79 64 6f 74 69 64 0a 09 73 65 74 20 le mydotid..set
26c0: 66 6e 61 6d 65 20 24 6d 79 64 6f 74 64 65 73 74 fname $mydotdest
26d0: 69 6e 61 74 69 6f 6e 2f 24 7b 6d 79 64 6f 74 70 ination/${mydotp
26e0: 72 65 66 69 78 7d 24 7b 6d 79 64 6f 74 69 64 7d refix}${mydotid}
26f0: 24 7b 73 75 66 66 69 78 7d 2e 64 6f 74 0a 09 66 ${suffix}.dot..f
2700: 69 6c 65 20 6d 6b 64 69 72 20 5b 66 69 6c 65 20 ile mkdir [file
2710: 64 69 72 6e 61 6d 65 20 24 66 6e 61 6d 65 5d 0a dirname $fname].
2720: 09 64 6f 74 20 77 72 69 74 65 20 24 64 67 20 24 .dot write $dg $
2730: 6d 79 64 6f 74 70 72 65 66 69 78 24 73 75 66 66 mydotprefix$suff
2740: 69 78 20 24 66 6e 61 6d 65 0a 09 69 6e 63 72 20 ix $fname..incr
2750: 6d 79 64 6f 74 69 64 0a 0a 09 6c 6f 67 20 77 72 mydotid...log wr
2760: 69 74 65 20 35 20 63 79 63 6c 65 62 72 65 61 6b ite 5 cyclebreak
2770: 65 72 20 22 2e 64 6f 74 20 65 78 70 6f 72 74 20 er ".dot export
2780: 24 66 6e 61 6d 65 22 0a 09 72 65 74 75 72 6e 0a $fname"..return.
2790: 20 20 20 20 7d 0a 0a 20 20 20 20 70 72 6f 63 20 }.. proc
27a0: 52 65 70 6c 61 63 65 20 7b 64 67 20 6e 20 72 65 Replace {dg n re
27b0: 70 6c 61 63 65 6d 65 6e 74 73 7d 20 7b 0a 09 23 placements} {..#
27c0: 20 4e 4f 54 45 2e 20 57 65 20 68 61 76 65 20 74 NOTE. We have t
27d0: 6f 20 67 65 74 20 74 68 65 20 6c 69 73 74 20 6f o get the list o
27e0: 66 20 69 6e 63 6f 6d 69 6e 67 20 6e 65 69 67 68 f incoming neigh
27f0: 62 6f 75 72 73 20 61 6e 64 0a 09 23 20 72 65 63 bours and..# rec
2800: 6f 6d 70 75 74 65 20 74 68 65 69 72 20 73 75 63 ompute their suc
2810: 63 65 73 73 6f 72 73 20 61 66 74 65 72 20 74 68 cessors after th
2820: 65 20 6e 65 77 20 6e 6f 64 65 73 20 68 61 76 65 e new nodes have
2830: 20 62 65 65 6e 0a 09 23 20 69 6e 73 65 72 74 65 been..# inserte
2840: 64 2e 20 54 68 65 69 72 20 6f 75 74 67 6f 69 6e d. Their outgoin
2850: 67 20 61 72 63 73 20 77 69 6c 6c 20 6e 6f 77 20 g arcs will now
2860: 67 6f 20 74 6f 20 6f 6e 65 20 6f 72 20 62 6f 74 go to one or bot
2870: 68 20 6f 66 0a 09 23 20 74 68 65 20 6e 65 77 20 h of..# the new
2880: 6e 6f 64 65 73 2c 20 61 6e 64 20 6e 6f 74 20 72 nodes, and not r
2890: 65 64 6f 69 6e 67 20 74 68 65 6d 20 6d 61 79 20 edoing them may
28a0: 63 61 75 73 65 20 75 73 20 74 6f 20 66 6f 72 67 cause us to forg
28b0: 65 74 0a 09 23 20 63 69 72 63 6c 65 73 2c 20 6c et..# circles, l
28c0: 65 61 76 69 6e 67 20 74 68 65 6d 20 69 6e 2c 20 eaving them in,
28d0: 75 6e 62 72 6f 6b 65 6e 2e 0a 0a 09 73 65 74 20 unbroken....set
28e0: 70 72 65 20 5b 24 64 67 20 6e 6f 64 65 73 20 2d pre [$dg nodes -
28f0: 69 6e 20 24 6e 5d 0a 0a 20 20 20 20 20 20 20 20 in $n]..
2900: 24 64 67 20 6e 6f 64 65 20 64 65 6c 65 74 65 20 $dg node delete
2910: 24 6e 0a 0a 09 66 6f 72 65 61 63 68 20 63 73 65 $n...foreach cse
2920: 74 20 24 72 65 70 6c 61 63 65 6d 65 6e 74 73 20 t $replacements
2930: 7b 0a 09 20 20 20 20 24 64 67 20 6e 6f 64 65 20 {.. $dg node
2940: 69 6e 73 65 72 74 20 24 63 73 65 74 0a 09 20 20 insert $cset..
2950: 20 20 24 64 67 20 6e 6f 64 65 20 73 65 74 20 20 $dg node set
2960: 20 20 24 63 73 65 74 20 74 69 6d 65 72 61 6e 67 $cset timerang
2970: 65 20 5b 24 63 73 65 74 20 74 69 6d 65 72 61 6e e [$cset timeran
2980: 67 65 5d 0a 09 7d 0a 0a 09 66 6f 72 65 61 63 68 ge]..}...foreach
2990: 20 63 73 65 74 20 24 72 65 70 6c 61 63 65 6d 65 cset $replaceme
29a0: 6e 74 73 20 7b 0a 09 20 20 20 20 66 6f 72 65 61 nts {.. forea
29b0: 63 68 20 73 75 63 63 20 5b 24 63 73 65 74 20 73 ch succ [$cset s
29c0: 75 63 63 65 73 73 6f 72 73 5d 20 7b 0a 09 09 23 uccessors] {...#
29d0: 20 54 68 65 20 6e 65 77 20 63 68 61 6e 67 65 73 The new changes
29e0: 65 74 73 20 6d 61 79 20 68 61 76 65 20 64 65 70 ets may have dep
29f0: 65 6e 64 65 6e 63 69 65 73 20 6f 75 74 73 69 64 endencies outsid
2a00: 65 20 6f 66 0a 09 09 23 20 74 68 65 20 63 68 6f e of...# the cho
2a10: 73 65 6e 20 73 65 74 2e 20 54 68 65 73 65 20 61 sen set. These a
2a20: 72 65 20 69 67 6e 6f 72 65 64 0a 09 09 69 66 20 re ignored...if
2a30: 7b 21 5b 24 64 67 20 6e 6f 64 65 20 65 78 69 73 {![$dg node exis
2a40: 74 73 20 24 73 75 63 63 5d 7d 20 63 6f 6e 74 69 ts $succ]} conti
2a50: 6e 75 65 0a 09 09 24 64 67 20 61 72 63 20 69 6e nue...$dg arc in
2a60: 73 65 72 74 20 24 63 73 65 74 20 24 73 75 63 63 sert $cset $succ
2a70: 0a 09 20 20 20 20 7d 0a 09 7d 0a 09 66 6f 72 65 .. }..}..fore
2a80: 61 63 68 20 63 73 65 74 20 24 70 72 65 20 7b 0a ach cset $pre {.
2a90: 09 20 20 20 20 66 6f 72 65 61 63 68 20 73 75 63 . foreach suc
2aa0: 63 20 5b 24 63 73 65 74 20 73 75 63 63 65 73 73 c [$cset success
2ab0: 6f 72 73 5d 20 7b 0a 09 09 23 20 4e 6f 74 65 20 ors] {...# Note
2ac0: 74 68 61 74 20 74 68 65 20 61 72 63 20 6d 61 79 that the arc may
2ad0: 20 61 6c 72 65 61 64 79 20 65 78 69 73 74 20 69 already exist i
2ae0: 6e 20 74 68 65 20 67 72 61 70 68 2e 20 49 66 0a n the graph. If.
2af0: 09 09 23 20 73 6f 20 69 67 6e 6f 72 65 20 69 74 ..# so ignore it
2b00: 2e 20 54 68 65 20 6e 65 77 20 63 68 61 6e 67 65 . The new change
2b10: 73 65 74 73 20 6d 61 79 20 68 61 76 65 0a 09 09 sets may have...
2b20: 23 20 64 65 70 65 6e 64 65 6e 63 69 65 73 20 6f # dependencies o
2b30: 75 74 73 69 64 65 20 6f 66 20 74 68 65 20 63 68 utside of the ch
2b40: 6f 73 65 6e 20 73 65 74 2e 20 54 68 65 73 65 20 osen set. These
2b50: 61 72 65 0a 09 09 23 20 69 67 6e 6f 72 65 64 0a are...# ignored.
2b60: 09 09 69 66 20 7b 21 5b 24 64 67 20 6e 6f 64 65 ..if {![$dg node
2b70: 20 65 78 69 73 74 73 20 24 73 75 63 63 5d 7d 20 exists $succ]}
2b80: 63 6f 6e 74 69 6e 75 65 0a 09 09 69 66 20 7b 5b continue...if {[
2b90: 48 61 73 41 72 63 20 24 64 67 20 24 63 73 65 74 HasArc $dg $cset
2ba0: 20 24 73 75 63 63 5d 7d 20 63 6f 6e 74 69 6e 75 $succ]} continu
2bb0: 65 3b 23 20 54 4f 44 4f 20 73 68 6f 75 6c 64 20 e;# TODO should
2bc0: 62 65 20 67 72 61 70 68 20 6d 65 74 68 6f 64 2e be graph method.
2bd0: 0a 09 09 24 64 67 20 61 72 63 20 69 6e 73 65 72 ...$dg arc inser
2be0: 74 20 24 63 73 65 74 20 24 73 75 63 63 0a 09 20 t $cset $succ..
2bf0: 20 20 20 7d 0a 09 7d 0a 0a 09 72 65 74 75 72 6e }..}...return
2c00: 0a 20 20 20 20 7d 0a 0a 20 20 20 20 23 20 23 20 . }.. # #
2c10: 23 23 20 23 23 23 20 23 23 23 23 23 20 23 23 23 ## ### ##### ###
2c20: 23 23 23 23 23 20 23 23 23 23 23 23 23 23 23 23 ##### ##########
2c30: 23 23 23 0a 20 20 20 20 23 23 20 43 61 6c 6c 62 ###. ## Callb
2c40: 61 63 6b 20 69 6e 76 6f 6b 61 74 69 6f 6e 20 2e ack invokation .
2c50: 2e 2e 0a 0a 20 20 20 20 70 72 6f 63 20 50 72 65 .... proc Pre
2c60: 48 6f 6f 6b 20 7b 67 72 61 70 68 7d 20 7b 0a 09 Hook {graph} {..
2c70: 23 20 47 69 76 65 20 74 68 65 20 75 73 65 72 20 # Give the user
2c80: 6f 66 20 74 68 65 20 63 79 63 6c 65 20 62 72 65 of the cycle bre
2c90: 61 6b 65 72 20 74 68 65 20 6f 70 70 6f 72 74 75 aker the opportu
2ca0: 6e 69 74 79 20 74 6f 20 77 6f 72 6b 0a 09 23 20 nity to work..#
2cb0: 77 69 74 68 20 74 68 65 20 67 72 61 70 68 20 62 with the graph b
2cc0: 65 74 77 65 65 6e 20 73 65 74 75 70 20 61 6e 64 etween setup and
2cd0: 20 63 6f 6e 73 75 6d 6d 61 74 69 6f 6e 2e 0a 0a consummation...
2ce0: 09 3a 3a 76 61 72 69 61 62 6c 65 20 6d 79 70 72 .::variable mypr
2cf0: 65 63 6d 64 0a 09 69 66 20 7b 21 5b 6c 6c 65 6e ecmd..if {![llen
2d00: 67 74 68 20 24 6d 79 70 72 65 63 6d 64 5d 7d 20 gth $myprecmd]}
2d10: 72 65 74 75 72 6e 0a 0a 09 75 70 6c 65 76 65 6c return...uplevel
2d20: 20 23 30 20 5b 6c 69 6e 73 65 72 74 20 24 6d 79 #0 [linsert $my
2d30: 70 72 65 63 6d 64 20 65 6e 64 20 24 67 72 61 70 precmd end $grap
2d40: 68 5d 0a 09 4d 61 72 6b 20 24 67 72 61 70 68 20 h]..Mark $graph
2d50: 2d 70 72 65 2d 64 6f 6e 65 0a 09 72 65 74 75 72 -pre-done..retur
2d60: 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 70 72 6f n. }.. pro
2d70: 63 20 50 72 6f 63 65 73 73 65 64 48 6f 6f 6b 20 c ProcessedHook
2d80: 7b 63 73 65 74 20 70 6f 73 7d 20 7b 0a 09 23 20 {cset pos} {..#
2d90: 47 69 76 65 20 74 68 65 20 75 73 65 72 20 6f 66 Give the user of
2da0: 20 74 68 65 20 63 79 63 6c 65 20 62 72 65 61 6b the cycle break
2db0: 65 72 20 74 68 65 20 6f 70 70 6f 72 74 75 6e 69 er the opportuni
2dc0: 74 79 20 74 6f 20 77 6f 72 6b 0a 09 23 20 77 69 ty to work..# wi
2dd0: 74 68 20 74 68 65 20 63 68 61 6e 67 65 73 65 74 th the changeset
2de0: 20 62 65 66 6f 72 65 20 69 74 20 69 73 20 72 65 before it is re
2df0: 6d 6f 76 65 64 20 66 72 6f 6d 20 74 68 65 20 67 moved from the g
2e00: 72 61 70 68 2e 0a 0a 09 3a 3a 76 61 72 69 61 62 raph....::variab
2e10: 6c 65 20 6d 79 73 61 76 65 63 6d 64 0a 09 69 66 le mysavecmd..if
2e20: 20 7b 21 5b 6c 6c 65 6e 67 74 68 20 24 6d 79 73 {![llength $mys
2e30: 61 76 65 63 6d 64 5d 7d 20 72 65 74 75 72 6e 0a avecmd]} return.
2e40: 0a 09 75 70 6c 65 76 65 6c 20 23 30 20 5b 6c 69 ..uplevel #0 [li
2e50: 6e 73 65 72 74 20 24 6d 79 73 61 76 65 63 6d 64 nsert $mysavecmd
2e60: 20 65 6e 64 20 24 70 6f 73 20 24 63 73 65 74 5d end $pos $cset]
2e70: 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a ..return. }..
2e80: 20 20 20 20 70 72 6f 63 20 42 72 65 61 6b 43 79 proc BreakCy
2e90: 63 6c 65 48 6f 6f 6b 20 7b 67 72 61 70 68 7d 20 cleHook {graph}
2ea0: 7b 0a 09 23 20 43 61 6c 6c 20 6f 75 74 20 74 6f {..# Call out to
2eb0: 20 74 68 65 20 63 68 6f 73 65 6e 20 61 6c 67 6f the chosen algo
2ec0: 72 69 74 68 6d 20 66 6f 72 20 63 79 63 6c 65 20 rithm for cycle
2ed0: 62 72 65 61 6b 69 6e 67 2e 20 46 69 6e 64 69 6e breaking. Findin
2ee0: 67 0a 09 23 20 61 20 63 79 63 6c 65 20 69 66 20 g..# a cycle if
2ef0: 6e 6f 20 62 72 65 61 6b 65 72 20 77 61 73 20 63 no breaker was c
2f00: 68 6f 73 65 6e 20 69 73 20 61 6e 20 65 72 72 6f hosen is an erro
2f10: 72 2e 0a 0a 09 3a 3a 76 61 72 69 61 62 6c 65 20 r....::variable
2f20: 6d 79 62 72 65 61 6b 63 6d 64 0a 09 69 66 20 7b mybreakcmd..if {
2f30: 21 5b 6c 6c 65 6e 67 74 68 20 24 6d 79 62 72 65 ![llength $mybre
2f40: 61 6b 63 6d 64 5d 7d 20 7b 0a 09 20 20 20 20 74 akcmd]} {.. t
2f50: 72 6f 75 62 6c 65 20 66 61 74 61 6c 20 22 46 6f rouble fatal "Fo
2f60: 75 6e 64 20 61 20 63 79 63 6c 65 2c 20 65 78 70 und a cycle, exp
2f70: 65 63 74 69 6e 67 20 6e 6f 6e 65 2e 22 0a 09 20 ecting none."..
2f80: 20 20 20 65 78 69 74 20 31 0a 09 7d 0a 0a 09 75 exit 1..}...u
2f90: 70 6c 65 76 65 6c 20 23 30 20 5b 6c 69 6e 73 65 plevel #0 [linse
2fa0: 72 74 20 24 6d 79 62 72 65 61 6b 63 6d 64 20 65 rt $mybreakcmd e
2fb0: 6e 64 20 24 67 72 61 70 68 5d 0a 09 72 65 74 75 nd $graph]..retu
2fc0: 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 70 72 rn. }.. pr
2fd0: 6f 63 20 43 6c 65 61 72 48 6f 6f 6b 73 20 7b 7d oc ClearHooks {}
2fe0: 20 7b 0a 09 3a 3a 76 61 72 69 61 62 6c 65 20 6d {..::variable m
2ff0: 79 70 72 65 63 6d 64 20 20 20 7b 7d 0a 09 3a 3a yprecmd {}..::
3000: 76 61 72 69 61 62 6c 65 20 6d 79 73 61 76 65 63 variable mysavec
3010: 6d 64 20 20 7b 7d 0a 09 3a 3a 76 61 72 69 61 62 md {}..::variab
3020: 6c 65 20 6d 79 62 72 65 61 6b 63 6d 64 20 7b 7d le mybreakcmd {}
3030: 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a ..return. }..
3040: 20 20 20 20 23 20 23 20 23 23 20 23 23 23 20 23 # # ## ### #
3050: 23 23 23 23 20 23 23 23 23 23 23 23 23 20 23 23 #### ######## ##
3060: 23 23 23 23 23 23 23 23 23 23 23 0a 0a 20 20 20 ###########..
3070: 20 74 79 70 65 76 61 72 69 61 62 6c 65 20 6d 79 typevariable my
3080: 61 74 20 20 20 20 20 20 30 20 3b 20 23 20 43 6f at 0 ; # Co
3090: 75 6e 74 65 72 20 66 6f 72 20 63 6f 6d 6d 69 74 unter for commit
30a0: 20 69 64 73 20 66 6f 72 20 74 68 65 0a 09 09 09 ids for the....
30b0: 20 20 20 20 20 20 20 23 20 63 68 61 6e 67 65 73 # changes
30c0: 65 74 73 2e 0a 20 20 20 20 74 79 70 65 76 61 72 ets.. typevar
30d0: 69 61 62 6c 65 20 6d 79 62 6f 74 74 6f 6d 20 7b iable mybottom {
30e0: 7d 20 3b 20 23 20 4c 69 73 74 20 6f 66 20 74 68 } ; # List of th
30f0: 65 20 63 61 6e 64 69 64 61 74 65 20 6e 6f 64 65 e candidate node
3100: 73 20 66 6f 72 0a 09 09 09 20 20 20 20 20 20 20 s for....
3110: 23 20 63 6f 6d 6d 69 74 74 69 6e 67 2e 0a 0a 20 # committing...
3120: 20 20 20 74 79 70 65 76 61 72 69 61 62 6c 65 20 typevariable
3130: 6d 79 70 72 65 63 6d 64 20 20 20 7b 7d 20 3b 20 myprecmd {} ;
3140: 23 20 43 61 6c 6c 62 61 63 6b 2c 20 63 68 61 6e # Callback, chan
3150: 67 65 20 67 72 61 70 68 20 62 65 66 6f 72 65 20 ge graph before
3160: 77 61 6c 6b 2e 0a 20 20 20 20 74 79 70 65 76 61 walk.. typeva
3170: 72 69 61 62 6c 65 20 6d 79 73 61 76 65 63 6d 64 riable mysavecmd
3180: 20 20 7b 7d 20 3b 20 23 20 43 61 6c 6c 62 61 63 {} ; # Callbac
3190: 6b 2c 20 66 6f 72 20 65 61 63 68 20 70 72 6f 63 k, for each proc
31a0: 65 73 73 65 64 20 6e 6f 64 65 2e 0a 20 20 20 20 essed node..
31b0: 74 79 70 65 76 61 72 69 61 62 6c 65 20 6d 79 62 typevariable myb
31c0: 72 65 61 6b 63 6d 64 20 7b 7d 20 3b 20 23 20 43 reakcmd {} ; # C
31d0: 61 6c 6c 62 61 63 6b 2c 20 66 6f 72 20 65 61 63 allback, for eac
31e0: 68 20 66 6f 75 6e 64 20 63 79 63 6c 65 2e 0a 0a h found cycle...
31f0: 20 20 20 20 74 79 70 65 76 61 72 69 61 62 6c 65 typevariable
3200: 20 6d 79 64 6f 74 64 65 73 74 69 6e 61 74 69 6f mydotdestinatio
3210: 6e 20 7b 7d 20 3b 20 23 20 44 65 73 74 69 6e 61 n {} ; # Destina
3220: 74 69 6f 6e 20 64 69 72 65 63 74 6f 72 79 20 66 tion directory f
3230: 6f 72 20 74 68 65 0a 09 09 09 09 20 20 20 20 20 or the.....
3240: 20 20 23 20 67 65 6e 65 72 61 74 65 64 20 2e 64 # generated .d
3250: 6f 74 20 66 69 6c 65 73 2e 0a 20 20 20 20 74 79 ot files.. ty
3260: 70 65 76 61 72 69 61 62 6c 65 20 6d 79 64 6f 74 pevariable mydot
3270: 70 72 65 66 69 78 20 20 20 20 20 20 7b 7d 20 3b prefix {} ;
3280: 20 23 20 50 72 65 66 69 78 20 66 6f 72 20 64 6f # Prefix for do
3290: 74 20 66 69 6c 65 73 20 77 68 65 6e 0a 09 09 09 t files when....
32a0: 09 20 20 20 20 20 20 20 23 20 65 78 70 6f 72 74 . # export
32b0: 69 6e 67 20 74 68 65 20 67 72 61 70 68 73 2e 0a ing the graphs..
32c0: 20 20 20 20 74 79 70 65 76 61 72 69 61 62 6c 65 typevariable
32d0: 20 6d 79 64 6f 74 69 64 20 20 20 20 20 20 20 20 mydotid
32e0: 20 20 20 30 20 3b 20 23 20 43 6f 75 6e 74 65 72 0 ; # Counter
32f0: 20 66 6f 72 20 64 6f 74 20 66 69 6c 65 20 6e 61 for dot file na
3300: 6d 65 0a 09 09 09 09 20 20 20 20 20 20 20 23 20 me..... #
3310: 67 65 6e 65 72 61 74 69 6f 6e 2e 0a 0a 20 20 20 generation...
3320: 20 23 20 23 20 23 23 20 23 23 23 20 23 23 23 23 # # ## ### ####
3330: 23 20 23 23 23 23 23 23 23 23 20 23 23 23 23 23 # ######## #####
3340: 23 23 23 23 23 23 23 23 0a 20 20 20 20 23 23 20 ########. ##
3350: 43 6f 6e 66 69 67 75 72 61 74 69 6f 6e 0a 0a 20 Configuration..
3360: 20 20 20 70 72 61 67 6d 61 20 2d 68 61 73 69 6e pragma -hasin
3370: 73 74 61 6e 63 65 73 20 20 20 6e 6f 20 3b 20 23 stances no ; #
3380: 20 73 69 6e 67 6c 65 74 6f 6e 0a 20 20 20 20 70 singleton. p
3390: 72 61 67 6d 61 20 2d 68 61 73 74 79 70 65 69 6e ragma -hastypein
33a0: 66 6f 20 20 20 20 6e 6f 20 3b 20 23 20 6e 6f 20 fo no ; # no
33b0: 69 6e 74 72 6f 73 70 65 63 74 69 6f 6e 0a 20 20 introspection.
33c0: 20 20 70 72 61 67 6d 61 20 2d 68 61 73 74 79 70 pragma -hastyp
33d0: 65 64 65 73 74 72 6f 79 20 6e 6f 20 3b 20 23 20 edestroy no ; #
33e0: 69 6d 6d 6f 72 74 61 6c 0a 0a 20 20 20 20 23 20 immortal.. #
33f0: 23 20 23 23 20 23 23 23 20 23 23 23 23 23 20 23 # ## ### ##### #
3400: 23 23 23 23 23 23 23 20 23 23 23 23 23 23 23 23 ####### ########
3410: 23 23 23 23 23 0a 7d 0a 0a 6e 61 6d 65 73 70 61 #####.}..namespa
3420: 63 65 20 65 76 61 6c 20 3a 3a 76 63 3a 3a 66 6f ce eval ::vc::fo
3430: 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 ssil::import::cv
3440: 73 20 7b 0a 20 20 20 20 6e 61 6d 65 73 70 61 63 s {. namespac
3450: 65 20 65 78 70 6f 72 74 20 63 79 63 6c 65 62 72 e export cyclebr
3460: 65 61 6b 65 72 0a 20 20 20 20 6e 61 6d 65 73 70 eaker. namesp
3470: 61 63 65 20 65 76 61 6c 20 63 79 63 6c 65 62 72 ace eval cyclebr
3480: 65 61 6b 65 72 20 7b 0a 09 6e 61 6d 65 73 70 61 eaker {..namespa
3490: 63 65 20 65 76 61 6c 20 70 72 6f 6a 65 63 74 20 ce eval project
34a0: 7b 0a 09 20 20 20 20 6e 61 6d 65 73 70 61 63 65 {.. namespace
34b0: 20 69 6d 70 6f 72 74 20 3a 3a 76 63 3a 3a 66 6f import ::vc::fo
34c0: 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 ssil::import::cv
34d0: 73 3a 3a 70 72 6f 6a 65 63 74 3a 3a 72 65 76 0a s::project::rev.
34e0: 09 20 20 20 20 6e 61 6d 65 73 70 61 63 65 20 69 . namespace i
34f0: 6d 70 6f 72 74 20 3a 3a 76 63 3a 3a 66 6f 73 73 mport ::vc::foss
3500: 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a il::import::cvs:
3510: 3a 70 72 6f 6a 65 63 74 3a 3a 72 65 76 6c 69 6e :project::revlin
3520: 6b 0a 09 7d 0a 09 6e 61 6d 65 73 70 61 63 65 20 k..}..namespace
3530: 69 6d 70 6f 72 74 20 3a 3a 76 63 3a 3a 74 6f 6f import ::vc::too
3540: 6c 73 3a 3a 6d 69 73 63 3a 3a 2a 0a 09 6e 61 6d ls::misc::*..nam
3550: 65 73 70 61 63 65 20 69 6d 70 6f 72 74 20 3a 3a espace import ::
3560: 76 63 3a 3a 74 6f 6f 6c 73 3a 3a 6c 6f 67 0a 09 vc::tools::log..
3570: 6e 61 6d 65 73 70 61 63 65 20 69 6d 70 6f 72 74 namespace import
3580: 20 3a 3a 76 63 3a 3a 74 6f 6f 6c 73 3a 3a 74 72 ::vc::tools::tr
3590: 6f 75 62 6c 65 0a 09 6e 61 6d 65 73 70 61 63 65 ouble..namespace
35a0: 20 69 6d 70 6f 72 74 20 3a 3a 76 63 3a 3a 74 6f import ::vc::to
35b0: 6f 6c 73 3a 3a 64 6f 74 0a 09 6c 6f 67 20 72 65 ols::dot..log re
35c0: 67 69 73 74 65 72 20 63 79 63 6c 65 62 72 65 61 gister cyclebrea
35d0: 6b 65 72 0a 20 20 20 20 7d 0a 7d 0a 0a 23 20 23 ker. }.}..# #
35e0: 20 23 23 20 23 23 23 20 23 23 23 23 23 20 23 23 ## ### ##### ##
35f0: 23 23 23 23 23 23 20 23 23 23 23 23 23 23 23 23 ###### #########
3600: 23 23 23 23 20 23 23 23 23 23 23 23 23 23 23 23 #### ###########
3610: 23 23 23 23 23 23 23 23 23 23 0a 23 23 20 52 65 ##########.## Re
3620: 61 64 79 0a 0a 70 61 63 6b 61 67 65 20 70 72 6f ady..package pro
3630: 76 69 64 65 20 76 63 3a 3a 66 6f 73 73 69 6c 3a vide vc::fossil:
3640: 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 63 79 :import::cvs::cy
3650: 63 6c 65 62 72 65 61 6b 65 72 20 31 2e 30 0a 72 clebreaker 1.0.r
3660: 65 74 75 72 6e 0a eturn.