Hex Artifact Content
Not logged in

Artifact 6387ad3ed8bce115fa53c0bfeeac27419c18e5c9:

File tools/cvs2fossil/lib/c2f_cyclebreaker.tcl part of check-in [b679ca3356] - Code cleanup. Removed trailing whitespace across the board. by aku on 2007-11-25 07:54:09.

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 73 65 74 20 6d 79 62 6f  $n]..}..set mybo
1da0: 74 74 6f 6d 20 5b 6c 73 6f 72 74 20 2d 69 6e 64  ttom [lsort -ind
1db0: 65 78 20 31 20 2d 69 6e 74 65 67 65 72 20 5b 6c  ex 1 -integer [l
1dc0: 73 6f 72 74 20 2d 69 6e 64 65 78 20 32 20 2d 69  sort -index 2 -i
1dd0: 6e 74 65 67 65 72 20 24 6d 79 62 6f 74 74 6f 6d  nteger $mybottom
1de0: 5d 5d 0a 09 53 68 6f 77 50 65 6e 64 69 6e 67 4e  ]]..ShowPendingN
1df0: 6f 64 65 73 0a 09 72 65 74 75 72 6e 0a 20 20 20  odes..return.   
1e00: 20 7d 0a 0a 20 20 20 20 70 72 6f 63 20 57 69 74   }..    proc Wit
1e10: 68 6f 75 74 50 72 65 64 65 63 65 73 73 6f 72 20  houtPredecessor 
1e20: 7b 64 67 20 6e 76 7d 20 7b 0a 09 3a 3a 76 61 72  {dg nv} {..::var
1e30: 69 61 62 6c 65 20 6d 79 62 6f 74 74 6f 6d 0a 0a  iable mybottom..
1e40: 09 75 70 76 61 72 20 31 20 24 6e 76 20 6e 0a 09  .upvar 1 $nv n..
1e50: 69 66 20 7b 21 5b 6c 6c 65 6e 67 74 68 20 24 6d  if {![llength $m
1e60: 79 62 6f 74 74 6f 6d 5d 7d 20 7b 20 72 65 74 75  ybottom]} { retu
1e70: 72 6e 20 30 20 7d 0a 0a 09 73 65 74 20 6e 20 5b  rn 0 }...set n [
1e80: 6c 69 6e 64 65 78 20 5b 6c 69 6e 64 65 78 20 24  lindex [lindex $
1e90: 6d 79 62 6f 74 74 6f 6d 20 30 5d 20 30 5d 0a 09  mybottom 0] 0]..
1ea0: 73 65 74 20 6d 79 62 6f 74 74 6f 6d 20 5b 6c 72  set mybottom [lr
1eb0: 61 6e 67 65 20 24 6d 79 62 6f 74 74 6f 6d 20 31  ange $mybottom 1
1ec0: 20 65 6e 64 5d 0a 09 73 65 74 20 63 68 61 6e 67   end]..set chang
1ed0: 65 64 20 30 0a 0a 09 23 20 55 70 64 61 74 65 20  ed 0...# Update 
1ee0: 6c 69 73 74 20 6f 66 20 6e 6f 64 65 73 20 77 69  list of nodes wi
1ef0: 74 68 6f 75 74 20 70 72 65 64 65 63 65 73 73 6f  thout predecesso
1f00: 72 2c 20 62 61 73 65 64 20 6f 6e 20 74 68 65 0a  r, based on the.
1f10: 09 23 20 6f 75 74 67 6f 69 6e 67 20 6e 65 69 67  .# outgoing neig
1f20: 68 62 6f 75 72 73 20 6f 66 20 74 68 65 20 63 68  hbours of the ch
1f30: 6f 73 65 6e 20 6e 6f 64 65 2e 20 54 68 69 73 20  osen node. This 
1f40: 73 68 6f 75 6c 64 20 62 65 0a 09 23 20 66 61 73  should be..# fas
1f50: 74 65 72 20 74 68 61 6e 20 69 74 65 72 61 74 69  ter than iterati
1f60: 6e 67 20 6f 66 20 74 68 65 20 77 68 6f 6c 65 20  ng of the whole 
1f70: 73 65 74 20 6f 66 20 6e 6f 64 65 73 2c 20 66 69  set of nodes, fi
1f80: 6e 64 69 6e 67 20 61 6c 6c 0a 09 23 20 77 69 74  nding all..# wit
1f90: 68 6f 75 74 20 70 72 65 64 65 63 65 73 73 6f 72  hout predecessor
1fa0: 73 2c 20 73 6f 72 74 69 6e 67 20 74 68 65 6d 20  s, sorting them 
1fb0: 62 79 20 74 69 6d 65 2c 20 65 74 63 2e 20 70 70  by time, etc. pp
1fc0: 2e 0a 09 66 6f 72 65 61 63 68 20 6f 75 74 20 5b  ...foreach out [
1fd0: 24 64 67 20 6e 6f 64 65 73 20 2d 6f 75 74 20 24  $dg nodes -out $
1fe0: 6e 5d 20 7b 0a 09 20 20 20 20 69 66 20 7b 5b 24  n] {..    if {[$
1ff0: 64 67 20 6e 6f 64 65 20 64 65 67 72 65 65 20 2d  dg node degree -
2000: 69 6e 20 24 6f 75 74 5d 20 3e 20 31 7d 20 63 6f  in $out] > 1} co
2010: 6e 74 69 6e 75 65 0a 09 20 20 20 20 23 20 44 65  ntinue..    # De
2020: 67 72 65 65 2d 31 20 6e 65 69 67 68 62 6f 75 72  gree-1 neighbour
2030: 2c 20 77 69 6c 6c 20 68 61 76 65 20 6e 6f 20 70  , will have no p
2040: 72 65 64 65 63 65 73 73 6f 72 73 20 61 66 74 65  redecessors afte
2050: 72 20 74 68 65 0a 09 20 20 20 20 23 20 72 65 6d  r the..    # rem
2060: 6f 76 61 6c 20 6f 66 20 6e 2e 20 50 75 74 20 6f  oval of n. Put o
2070: 6e 20 74 68 65 20 6c 69 73 74 2e 0a 09 20 20 20  n the list...   
2080: 20 6c 61 70 70 65 6e 64 20 6d 79 62 6f 74 74 6f   lappend mybotto
2090: 6d 20 5b 6c 69 6e 73 65 72 74 20 5b 24 64 67 20  m [linsert [$dg 
20a0: 6e 6f 64 65 20 67 65 74 20 24 6f 75 74 20 74 69  node get $out ti
20b0: 6d 65 72 61 6e 67 65 5d 20 30 20 24 6f 75 74 5d  merange] 0 $out]
20c0: 0a 09 20 20 20 20 73 65 74 20 63 68 61 6e 67 65  ..    set change
20d0: 64 20 31 0a 09 7d 0a 09 69 66 20 7b 24 63 68 61  d 1..}..if {$cha
20e0: 6e 67 65 64 7d 20 7b 0a 09 20 20 20 20 73 65 74  nged} {..    set
20f0: 20 6d 79 62 6f 74 74 6f 6d 20 5b 6c 73 6f 72 74   mybottom [lsort
2100: 20 2d 69 6e 64 65 78 20 31 20 2d 69 6e 74 65 67   -index 1 -integ
2110: 65 72 20 5b 6c 73 6f 72 74 20 2d 69 6e 64 65 78  er [lsort -index
2120: 20 32 20 2d 69 6e 74 65 67 65 72 20 24 6d 79 62   2 -integer $myb
2130: 6f 74 74 6f 6d 5d 5d 0a 09 7d 0a 0a 09 23 20 57  ottom]]..}...# W
2140: 65 20 64 6f 20 6e 6f 74 20 64 65 6c 65 74 65 20  e do not delete 
2150: 74 68 65 20 6e 6f 64 65 20 69 6d 6d 65 64 69 61  the node immedia
2160: 74 65 6c 79 2c 20 74 6f 20 61 6c 6c 6f 77 20 74  tely, to allow t
2170: 68 65 20 53 61 76 65 0a 09 23 20 70 72 6f 63 65  he Save..# proce
2180: 64 75 72 65 20 74 6f 20 73 61 76 65 20 74 68 65  dure to save the
2190: 20 64 65 70 65 6e 64 65 6e 63 69 65 73 20 61 73   dependencies as
21a0: 20 77 65 6c 6c 20 28 65 6e 63 6f 64 65 64 20 69   well (encoded i
21b0: 6e 20 74 68 65 0a 09 23 20 61 72 63 73 29 2e 0a  n the..# arcs)..
21c0: 09 72 65 74 75 72 6e 20 31 0a 20 20 20 20 7d 0a  .return 1.    }.
21d0: 0a 20 20 20 20 70 72 6f 63 20 53 68 6f 77 50 65  .    proc ShowPe
21e0: 6e 64 69 6e 67 4e 6f 64 65 73 20 7b 7d 20 7b 0a  ndingNodes {} {.
21f0: 09 69 66 20 7b 5b 6c 6f 67 20 76 65 72 62 6f 73  .if {[log verbos
2200: 69 74 79 3f 5d 20 3c 20 31 30 7d 20 72 65 74 75  ity?] < 10} retu
2210: 72 6e 0a 09 3a 3a 76 61 72 69 61 62 6c 65 20 6d  rn..::variable m
2220: 79 62 6f 74 74 6f 6d 0a 09 6c 6f 67 20 77 72 69  ybottom..log wri
2230: 74 65 20 31 30 20 63 79 63 6c 65 62 72 65 61 6b  te 10 cyclebreak
2240: 65 72 20 5c 0a 09 20 20 20 20 22 50 65 6e 64 69  er \..    "Pendi
2250: 6e 67 3a 20 5b 73 74 72 75 63 74 3a 3a 6c 69 73  ng: [struct::lis
2260: 74 20 6d 61 70 20 24 6d 79 62 6f 74 74 6f 6d 20  t map $mybottom 
2270: 5b 6d 79 70 72 6f 63 20 46 6f 72 6d 61 74 50 65  [myproc FormatPe
2280: 6e 64 69 6e 67 49 74 65 6d 5d 5d 22 0a 09 72 65  ndingItem]]"..re
2290: 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20  turn.    }..    
22a0: 70 72 6f 63 20 46 6f 72 6d 61 74 50 65 6e 64 69  proc FormatPendi
22b0: 6e 67 49 74 65 6d 20 7b 69 74 65 6d 7d 20 7b 20  ngItem {item} { 
22c0: 6c 72 65 70 6c 61 63 65 20 24 69 74 65 6d 20 30  lreplace $item 0
22d0: 20 30 20 5b 5b 6c 69 6e 64 65 78 20 24 69 74 65   0 [[lindex $ite
22e0: 6d 20 30 5d 20 73 74 72 5d 20 7d 0a 0a 20 20 20  m 0] str] }..   
22f0: 20 70 72 6f 63 20 46 69 6e 64 43 79 63 6c 65 20   proc FindCycle 
2300: 7b 64 67 7d 20 7b 0a 09 23 20 54 68 69 73 20 70  {dg} {..# This p
2310: 72 6f 63 65 64 75 72 65 20 69 73 20 72 75 6e 20  rocedure is run 
2320: 69 66 20 61 6e 64 20 6f 6e 6c 79 20 74 68 65 20  if and only the 
2330: 67 72 61 70 68 20 69 73 20 6e 6f 74 20 65 6d 70  graph is not emp
2340: 74 79 20 61 6e 64 0a 09 23 20 61 6c 6c 20 6e 6f  ty and..# all no
2350: 64 65 73 20 68 61 76 65 20 70 72 65 64 65 63 65  des have predece
2360: 73 73 6f 72 73 2e 20 54 68 69 73 20 6d 65 61 6e  ssors. This mean
2370: 73 20 74 68 61 74 20 65 61 63 68 20 6e 6f 64 65  s that each node
2380: 20 69 73 0a 09 23 20 65 69 74 68 65 72 20 70 61   is..# either pa
2390: 72 74 20 6f 66 20 61 20 63 79 63 6c 65 20 6f 72  rt of a cycle or
23a0: 20 28 69 6e 64 69 72 65 63 74 6c 79 29 20 64 65   (indirectly) de
23b0: 70 65 6e 64 69 6e 67 20 6f 6e 20 61 20 6e 6f 64  pending on a nod
23c0: 65 0a 09 23 20 69 6e 20 61 20 63 79 63 6c 65 2e  e..# in a cycle.
23d0: 20 57 65 20 63 61 6e 20 73 74 61 72 74 20 61 74   We can start at
23e0: 20 61 6e 20 61 72 62 69 74 72 61 72 79 20 6e 6f   an arbitrary no
23f0: 64 65 2c 20 66 6f 6c 6c 6f 77 20 69 74 73 0a 09  de, follow its..
2400: 23 20 69 6e 63 6f 6d 69 6e 67 20 65 64 67 65 73  # incoming edges
2410: 20 74 6f 20 69 74 73 20 70 72 65 64 65 63 65 73   to its predeces
2420: 73 6f 72 73 20 75 6e 74 69 6c 20 77 65 20 73 65  sors until we se
2430: 65 20 61 20 6e 6f 64 65 20 61 0a 09 23 20 73 65  e a node a..# se
2440: 63 6f 6e 64 20 74 69 6d 65 2e 20 54 68 61 74 20  cond time. That 
2450: 6e 6f 64 65 20 63 6c 6f 73 65 73 20 74 68 65 20  node closes the 
2460: 63 79 63 6c 65 20 61 6e 64 20 74 68 65 20 62 65  cycle and the be
2470: 67 69 6e 6e 69 6e 67 20 69 73 0a 09 23 20 69 74  ginning is..# it
2480: 73 20 66 69 72 73 74 20 6f 63 63 75 72 65 6e 63  s first occurenc
2490: 65 2e 20 4e 6f 74 65 20 74 68 61 74 20 77 65 20  e. Note that we 
24a0: 63 61 6e 20 63 68 6f 6f 73 65 20 61 6e 20 61 72  can choose an ar
24b0: 62 69 74 72 61 72 79 0a 09 23 20 70 72 65 64 65  bitrary..# prede
24c0: 63 65 73 73 6f 72 20 6f 66 20 65 61 63 68 20 6e  cessor of each n
24d0: 6f 64 65 20 61 73 20 77 65 6c 6c 2c 20 77 65 20  ode as well, we 
24e0: 64 6f 20 6e 6f 74 20 68 61 76 65 20 74 6f 20 73  do not have to s
24f0: 65 61 72 63 68 2e 0a 0a 09 23 20 57 65 20 72 65  earch....# We re
2500: 63 6f 72 64 20 66 6f 72 20 65 61 63 68 20 6e 6f  cord for each no
2510: 64 65 20 74 68 65 20 69 6e 64 65 78 20 6f 66 20  de the index of 
2520: 74 68 65 20 66 69 72 73 74 20 61 70 70 65 61 72  the first appear
2530: 61 6e 63 65 20 69 6e 0a 09 23 20 74 68 65 20 70  ance in..# the p
2540: 61 74 68 2c 20 6d 61 6b 69 6e 67 20 69 74 20 65  ath, making it e
2550: 61 73 79 20 61 74 20 74 68 65 20 65 6e 64 20 74  asy at the end t
2560: 6f 20 63 75 74 20 74 68 65 20 63 79 63 6c 65 20  o cut the cycle 
2570: 66 72 6f 6d 0a 09 23 20 69 74 2e 0a 0a 09 23 20  from..# it....# 
2580: 43 68 6f 6f 73 65 20 61 72 62 69 74 72 61 72 79  Choose arbitrary
2590: 20 6e 6f 64 65 20 74 6f 20 73 74 61 72 74 20 6f   node to start o
25a0: 75 72 20 73 65 61 72 63 68 20 61 74 2e 0a 09 73  ur search at...s
25b0: 65 74 20 73 74 61 72 74 20 5b 6c 69 6e 64 65 78  et start [lindex
25c0: 20 5b 24 64 67 20 6e 6f 64 65 73 5d 20 30 5d 0a   [$dg nodes] 0].
25d0: 0a 09 23 20 49 6e 69 74 69 61 6c 69 7a 65 20 73  ..# Initialize s
25e0: 74 61 74 65 2c 20 70 61 74 68 20 6f 66 20 73 65  tate, path of se
25f0: 65 6e 20 6e 6f 64 65 73 2c 20 61 6e 64 20 77 68  en nodes, and wh
2600: 65 6e 20 73 65 65 6e 2e 0a 09 73 65 74 20 20 20  en seen...set   
2610: 20 20 20 20 70 61 74 68 20 7b 7d 0a 09 61 72 72      path {}..arr
2620: 61 79 20 73 65 74 20 73 65 65 6e 20 7b 7d 0a 0a  ay set seen {}..
2630: 09 77 68 69 6c 65 20 7b 31 7d 20 7b 0a 09 20 20  .while {1} {..  
2640: 20 20 23 20 53 74 6f 70 20 73 65 61 72 63 68 69    # Stop searchi
2650: 6e 67 20 77 68 65 6e 20 77 65 20 68 61 76 65 20  ng when we have 
2660: 73 65 65 6e 20 74 68 65 20 63 75 72 72 65 6e 74  seen the current
2670: 20 6e 6f 64 65 0a 09 20 20 20 20 23 20 61 6c 72   node..    # alr
2680: 65 61 64 79 2c 20 74 68 65 20 63 69 72 63 6c 65  eady, the circle
2690: 20 68 61 73 20 62 65 65 6e 20 63 6c 6f 73 65 64   has been closed
26a0: 2e 0a 09 20 20 20 20 69 66 20 7b 5b 69 6e 66 6f  ...    if {[info
26b0: 20 65 78 69 73 74 73 20 73 65 65 6e 28 24 73 74   exists seen($st
26c0: 61 72 74 29 5d 7d 20 62 72 65 61 6b 0a 09 20 20  art)]} break..  
26d0: 20 20 6c 61 70 70 65 6e 64 20 70 61 74 68 20 24    lappend path $
26e0: 73 74 61 72 74 0a 09 20 20 20 20 73 65 74 20 73  start..    set s
26f0: 65 65 6e 28 24 73 74 61 72 74 29 20 5b 65 78 70  een($start) [exp
2700: 72 20 7b 5b 6c 6c 65 6e 67 74 68 20 24 70 61 74  r {[llength $pat
2710: 68 5d 2d 31 7d 5d 0a 09 20 20 20 20 23 20 43 68  h]-1}]..    # Ch
2720: 6f 6f 73 65 20 61 72 62 69 74 72 61 72 79 20 70  oose arbitrary p
2730: 72 65 64 65 63 65 73 73 6f 72 0a 09 20 20 20 20  redecessor..    
2740: 73 65 74 20 73 74 61 72 74 20 5b 6c 69 6e 64 65  set start [linde
2750: 78 20 5b 24 64 67 20 6e 6f 64 65 73 20 2d 69 6e  x [$dg nodes -in
2760: 20 24 73 74 61 72 74 5d 20 30 5d 0a 09 7d 0a 0a   $start] 0]..}..
2770: 09 72 65 74 75 72 6e 20 5b 73 74 72 75 63 74 3a  .return [struct:
2780: 3a 6c 69 73 74 20 72 65 76 65 72 73 65 20 5b 6c  :list reverse [l
2790: 72 61 6e 67 65 20 24 70 61 74 68 20 24 73 65 65  range $path $see
27a0: 6e 28 24 73 74 61 72 74 29 20 65 6e 64 5d 5d 0a  n($start) end]].
27b0: 20 20 20 20 7d 0a 0a 20 20 20 20 70 72 6f 63 20      }..    proc 
27c0: 42 72 65 61 6b 53 65 67 6d 65 6e 74 20 7b 64 67  BreakSegment {dg
27d0: 20 70 61 74 68 20 6c 61 62 65 6c 7d 20 7b 0a 09   path label} {..
27e0: 23 20 54 68 65 20 70 61 74 68 2c 20 75 73 75 61  # The path, usua
27f0: 6c 6c 79 20 61 20 63 79 63 6c 65 2c 20 77 65 20  lly a cycle, we 
2800: 68 61 76 65 20 67 6f 74 74 65 6e 20 69 73 20 62  have gotten is b
2810: 72 6f 6b 65 6e 20 62 79 0a 09 23 20 62 72 65 61  roken by..# brea
2820: 6b 69 6e 67 20 61 70 61 72 74 20 6f 6e 65 20 6f  king apart one o
2830: 72 20 6d 6f 72 65 20 6f 66 20 74 68 65 20 63 68  r more of the ch
2840: 61 6e 67 65 73 65 74 73 20 69 6e 20 74 68 65 0a  angesets in the.
2850: 09 23 20 63 79 63 6c 65 2e 20 54 68 69 73 20 63  .# cycle. This c
2860: 61 75 73 65 73 20 75 73 20 74 6f 20 63 72 65 61  auses us to crea
2870: 74 65 20 6f 6e 65 20 6f 72 20 6d 6f 72 65 20 63  te one or more c
2880: 68 61 6e 67 65 73 65 74 73 20 77 68 69 63 68 0a  hangesets which.
2890: 09 23 20 61 72 65 20 74 6f 20 62 65 20 63 6f 6d  .# are to be com
28a0: 6d 69 74 74 65 64 2c 20 61 64 64 65 64 20 74 6f  mitted, added to
28b0: 20 74 68 65 20 67 72 61 70 68 2c 20 65 74 63 2e   the graph, etc.
28c0: 20 70 70 2e 0a 0a 09 73 65 74 20 62 65 73 74 6c   pp....set bestl
28d0: 69 6e 6b 20 7b 7d 0a 09 73 65 74 20 62 65 73 74  ink {}..set best
28e0: 6e 6f 64 65 20 7b 7d 0a 0a 09 66 6f 72 65 61 63  node {}...foreac
28f0: 68 20 5c 0a 09 20 20 20 20 70 72 65 76 20 5b 6c  h \..    prev [l
2900: 72 61 6e 67 65 20 24 70 61 74 68 20 30 20 65 6e  range $path 0 en
2910: 64 2d 32 5d 20 5c 0a 09 20 20 20 20 63 73 65 74  d-2] \..    cset
2920: 20 5b 6c 72 61 6e 67 65 20 24 70 61 74 68 20 31   [lrange $path 1
2930: 20 65 6e 64 2d 31 5d 20 5c 0a 09 20 20 20 20 6e   end-1] \..    n
2940: 65 78 74 20 5b 6c 72 61 6e 67 65 20 24 70 61 74  ext [lrange $pat
2950: 68 20 32 20 65 6e 64 5d 20 7b 0a 0a 09 09 23 20  h 2 end] {....# 
2960: 45 61 63 68 20 74 72 69 70 6c 65 20 50 52 45 56  Each triple PREV
2970: 20 2d 3e 20 43 53 45 54 20 2d 3e 20 4e 45 58 54   -> CSET -> NEXT
2980: 20 6f 66 20 63 68 61 6e 67 65 73 65 74 73 2c 20   of changesets, 
2990: 61 0a 09 09 23 20 27 6c 69 6e 6b 27 20 69 6e 20  a...# 'link' in 
29a0: 74 68 65 20 63 79 63 6c 65 2c 20 69 73 20 61 6e  the cycle, is an
29b0: 61 6c 79 73 65 64 20 61 6e 64 20 74 68 65 20 62  alysed and the b
29c0: 65 73 74 0a 09 09 23 20 6c 6f 63 61 74 69 6f 6e  est...# location
29d0: 20 77 68 65 72 65 20 74 6f 20 61 74 20 6c 65 61   where to at lea
29e0: 73 74 20 77 65 61 6b 65 6e 20 74 68 65 20 63 79  st weaken the cy
29f0: 63 6c 65 20 69 73 0a 09 09 23 20 63 68 6f 73 65  cle is...# chose
2a00: 6e 20 66 6f 72 20 66 75 72 74 68 65 72 20 70 72  n for further pr
2a10: 6f 63 65 73 73 69 6e 67 2e 0a 0a 09 09 73 65 74  ocessing.....set
2a20: 20 6c 69 6e 6b 20 5b 70 72 6f 6a 65 63 74 3a 3a   link [project::
2a30: 72 65 76 6c 69 6e 6b 20 25 41 55 54 4f 25 20 24  revlink %AUTO% $
2a40: 70 72 65 76 20 24 63 73 65 74 20 24 6e 65 78 74  prev $cset $next
2a50: 5d 0a 09 09 69 66 20 7b 24 62 65 73 74 6c 69 6e  ]...if {$bestlin
2a60: 6b 20 65 71 20 22 22 7d 20 7b 0a 09 09 20 20 20  k eq ""} {...   
2a70: 20 73 65 74 20 62 65 73 74 6c 69 6e 6b 20 24 6c   set bestlink $l
2a80: 69 6e 6b 0a 09 09 20 20 20 20 73 65 74 20 62 65  ink...    set be
2a90: 73 74 6e 6f 64 65 20 24 63 73 65 74 0a 09 09 7d  stnode $cset...}
2aa0: 20 65 6c 73 65 69 66 20 7b 5b 24 6c 69 6e 6b 20   elseif {[$link 
2ab0: 62 65 74 74 65 72 74 68 61 6e 20 24 62 65 73 74  betterthan $best
2ac0: 6c 69 6e 6b 5d 7d 20 7b 0a 09 09 20 20 20 20 24  link]} {...    $
2ad0: 62 65 73 74 6c 69 6e 6b 20 64 65 73 74 72 6f 79  bestlink destroy
2ae0: 0a 09 09 20 20 20 20 73 65 74 20 62 65 73 74 6c  ...    set bestl
2af0: 69 6e 6b 20 24 6c 69 6e 6b 0a 09 09 20 20 20 20  ink $link...    
2b00: 73 65 74 20 62 65 73 74 6e 6f 64 65 20 24 63 73  set bestnode $cs
2b10: 65 74 0a 09 09 7d 20 65 6c 73 65 20 7b 0a 09 09  et...} else {...
2b20: 20 20 20 20 24 6c 69 6e 6b 20 64 65 73 74 72 6f      $link destro
2b30: 79 0a 09 09 7d 0a 09 20 20 20 20 7d 0a 0a 09 6c  y...}..    }...l
2b40: 6f 67 20 77 72 69 74 65 20 35 20 63 79 63 6c 65  og write 5 cycle
2b50: 62 72 65 61 6b 65 72 20 22 42 72 65 61 6b 69 6e  breaker "Breakin
2b60: 67 20 24 6c 61 62 65 6c 20 62 79 20 73 70 6c 69  g $label by spli
2b70: 74 74 69 6e 67 20 63 68 61 6e 67 65 73 65 74 20  tting changeset 
2b80: 5b 24 62 65 73 74 6e 6f 64 65 20 73 74 72 5d 22  [$bestnode str]"
2b90: 0a 09 73 65 74 20 49 44 20 5b 24 62 65 73 74 6e  ..set ID [$bestn
2ba0: 6f 64 65 20 69 64 5d 0a 09 4d 61 72 6b 20 24 64  ode id]..Mark $d
2bb0: 67 20 2d 24 7b 49 44 7d 2d 62 65 66 6f 72 65 0a  g -${ID}-before.
2bc0: 0a 09 73 65 74 20 6e 65 77 63 73 65 74 73 20 5b  ..set newcsets [
2bd0: 24 62 65 73 74 6c 69 6e 6b 20 62 72 65 61 6b 5d  $bestlink break]
2be0: 0a 09 24 62 65 73 74 6c 69 6e 6b 20 64 65 73 74  ..$bestlink dest
2bf0: 72 6f 79 0a 0a 20 20 20 20 20 20 20 20 23 20 41  roy..        # A
2c00: 74 20 74 68 69 73 20 70 6f 69 6e 74 20 74 68 65  t this point the
2c10: 20 6f 6c 64 20 63 68 61 6e 67 65 73 65 74 20 28   old changeset (
2c20: 42 45 53 54 4e 4f 44 45 29 20 69 73 20 67 6f 6e  BESTNODE) is gon
2c30: 65 0a 20 20 20 20 20 20 20 20 23 20 61 6c 72 65  e.        # alre
2c40: 61 64 79 2e 20 57 65 20 72 65 6d 6f 76 65 20 69  ady. We remove i
2c50: 74 20 66 72 6f 6d 20 74 68 65 20 67 72 61 70 68  t from the graph
2c60: 20 61 73 20 77 65 6c 6c 20 61 6e 64 20 74 68 65   as well and the
2c70: 6e 20 65 6e 74 65 72 0a 20 20 20 20 20 20 20 20  n enter.        
2c80: 23 20 74 68 65 20 66 72 61 67 6d 65 6e 74 73 20  # the fragments 
2c90: 67 65 6e 65 72 61 74 65 64 20 66 6f 72 20 69 74  generated for it
2ca0: 2e 0a 0a 09 52 65 70 6c 61 63 65 20 24 64 67 20  ....Replace $dg 
2cb0: 24 62 65 73 74 6e 6f 64 65 20 24 6e 65 77 63 73  $bestnode $newcs
2cc0: 65 74 73 0a 0a 09 4d 61 72 6b 20 24 64 67 20 2d  ets...Mark $dg -
2cd0: 24 7b 49 44 7d 2d 61 66 74 65 72 0a 09 72 65 74  ${ID}-after..ret
2ce0: 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 23  urn.    }..    #
2cf0: 20 54 4f 44 4f 3a 20 54 68 69 73 20 73 68 6f 75   TODO: This shou
2d00: 6c 64 20 62 65 20 61 20 67 72 61 70 68 20 6d 65  ld be a graph me
2d10: 74 68 6f 64 2e 0a 20 20 20 20 70 72 6f 63 20 48  thod..    proc H
2d20: 61 73 41 72 63 20 7b 64 67 20 61 20 62 7d 20 7b  asArc {dg a b} {
2d30: 0a 09 23 38 2e 35 3a 20 72 65 74 75 72 6e 20 5b  ..#8.5: return [
2d40: 65 78 70 72 20 7b 24 62 20 69 6e 20 5b 24 64 67  expr {$b in [$dg
2d50: 20 6e 6f 64 65 73 20 2d 6f 75 74 20 24 61 5d 7d   nodes -out $a]}
2d60: 5d 0a 09 69 66 20 7b 5b 6c 73 65 61 72 63 68 20  ]..if {[lsearch 
2d70: 2d 65 78 61 63 74 20 5b 24 64 67 20 6e 6f 64 65  -exact [$dg node
2d80: 73 20 2d 6f 75 74 20 24 61 5d 20 24 62 5d 20 3c  s -out $a] $b] <
2d90: 20 30 7d 20 7b 20 72 65 74 75 72 6e 20 30 20 7d   0} { return 0 }
2da0: 0a 09 72 65 74 75 72 6e 20 31 0a 20 20 20 20 7d  ..return 1.    }
2db0: 0a 0a 20 20 20 20 70 72 6f 63 20 4d 61 72 6b 20  ..    proc Mark 
2dc0: 7b 64 67 20 7b 73 75 66 66 69 78 20 7b 7d 7d 20  {dg {suffix {}} 
2dd0: 7b 73 75 62 67 72 61 70 68 20 7b 7d 7d 7d 20 7b  {subgraph {}}} {
2de0: 0a 09 3a 3a 76 61 72 69 61 62 6c 65 20 6d 79 64  ..::variable myd
2df0: 6f 74 64 65 73 74 69 6e 61 74 69 6f 6e 0a 09 69  otdestination..i
2e00: 66 20 7b 24 6d 79 64 6f 74 64 65 73 74 69 6e 61  f {$mydotdestina
2e10: 74 69 6f 6e 20 65 71 20 22 22 7d 20 72 65 74 75  tion eq ""} retu
2e20: 72 6e 0a 09 3a 3a 76 61 72 69 61 62 6c 65 20 6d  rn..::variable m
2e30: 79 64 6f 74 70 72 65 66 69 78 0a 09 3a 3a 76 61  ydotprefix..::va
2e40: 72 69 61 62 6c 65 20 6d 79 64 6f 74 69 64 0a 09  riable mydotid..
2e50: 73 65 74 20 66 6e 61 6d 65 20 24 6d 79 64 6f 74  set fname $mydot
2e60: 64 65 73 74 69 6e 61 74 69 6f 6e 2f 24 7b 6d 79  destination/${my
2e70: 64 6f 74 70 72 65 66 69 78 7d 24 7b 6d 79 64 6f  dotprefix}${mydo
2e80: 74 69 64 7d 24 7b 73 75 66 66 69 78 7d 2e 64 6f  tid}${suffix}.do
2e90: 74 0a 09 66 69 6c 65 20 6d 6b 64 69 72 20 5b 66  t..file mkdir [f
2ea0: 69 6c 65 20 64 69 72 6e 61 6d 65 20 24 66 6e 61  ile dirname $fna
2eb0: 6d 65 5d 0a 09 64 6f 74 20 77 72 69 74 65 20 24  me]..dot write $
2ec0: 64 67 20 24 6d 79 64 6f 74 70 72 65 66 69 78 24  dg $mydotprefix$
2ed0: 73 75 66 66 69 78 20 24 66 6e 61 6d 65 20 24 73  suffix $fname $s
2ee0: 75 62 67 72 61 70 68 0a 09 69 6e 63 72 20 6d 79  ubgraph..incr my
2ef0: 64 6f 74 69 64 0a 0a 09 6c 6f 67 20 77 72 69 74  dotid...log writ
2f00: 65 20 35 20 63 79 63 6c 65 62 72 65 61 6b 65 72  e 5 cyclebreaker
2f10: 20 22 2e 64 6f 74 20 65 78 70 6f 72 74 20 24 66   ".dot export $f
2f20: 6e 61 6d 65 22 0a 09 72 65 74 75 72 6e 0a 20 20  name"..return.  
2f30: 20 20 7d 0a 0a 20 20 20 20 70 72 6f 63 20 52 65    }..    proc Re
2f40: 70 6c 61 63 65 20 7b 64 67 20 6e 20 72 65 70 6c  place {dg n repl
2f50: 61 63 65 6d 65 6e 74 73 7d 20 7b 0a 09 23 20 4e  acements} {..# N
2f60: 4f 54 45 2e 20 57 65 20 68 61 76 65 20 74 6f 20  OTE. We have to 
2f70: 67 65 74 20 74 68 65 20 6c 69 73 74 20 6f 66 20  get the list of 
2f80: 69 6e 63 6f 6d 69 6e 67 20 6e 65 69 67 68 62 6f  incoming neighbo
2f90: 75 72 73 20 61 6e 64 0a 09 23 20 72 65 63 6f 6d  urs and..# recom
2fa0: 70 75 74 65 20 74 68 65 69 72 20 73 75 63 63 65  pute their succe
2fb0: 73 73 6f 72 73 20 61 66 74 65 72 20 74 68 65 20  ssors after the 
2fc0: 6e 65 77 20 6e 6f 64 65 73 20 68 61 76 65 20 62  new nodes have b
2fd0: 65 65 6e 0a 09 23 20 69 6e 73 65 72 74 65 64 2e  een..# inserted.
2fe0: 20 54 68 65 69 72 20 6f 75 74 67 6f 69 6e 67 20   Their outgoing 
2ff0: 61 72 63 73 20 77 69 6c 6c 20 6e 6f 77 20 67 6f  arcs will now go
3000: 20 74 6f 20 6f 6e 65 20 6f 72 20 62 6f 74 68 20   to one or both 
3010: 6f 66 0a 09 23 20 74 68 65 20 6e 65 77 20 6e 6f  of..# the new no
3020: 64 65 73 2c 20 61 6e 64 20 6e 6f 74 20 72 65 64  des, and not red
3030: 6f 69 6e 67 20 74 68 65 6d 20 6d 61 79 20 63 61  oing them may ca
3040: 75 73 65 20 75 73 20 74 6f 20 66 6f 72 67 65 74  use us to forget
3050: 0a 09 23 20 63 69 72 63 6c 65 73 2c 20 6c 65 61  ..# circles, lea
3060: 76 69 6e 67 20 74 68 65 6d 20 69 6e 2c 20 75 6e  ving them in, un
3070: 62 72 6f 6b 65 6e 2e 0a 0a 09 73 65 74 20 70 72  broken....set pr
3080: 65 20 5b 24 64 67 20 6e 6f 64 65 73 20 2d 69 6e  e [$dg nodes -in
3090: 20 24 6e 5d 0a 0a 20 20 20 20 20 20 20 20 24 64   $n]..        $d
30a0: 67 20 6e 6f 64 65 20 64 65 6c 65 74 65 20 24 6e  g node delete $n
30b0: 0a 0a 09 66 6f 72 65 61 63 68 20 63 73 65 74 20  ...foreach cset 
30c0: 24 72 65 70 6c 61 63 65 6d 65 6e 74 73 20 7b 0a  $replacements {.
30d0: 09 20 20 20 20 73 65 74 20 74 72 20 5b 24 63 73  .    set tr [$cs
30e0: 65 74 20 74 69 6d 65 72 61 6e 67 65 5d 0a 09 20  et timerange].. 
30f0: 20 20 20 24 64 67 20 6e 6f 64 65 20 69 6e 73 65     $dg node inse
3100: 72 74 20 24 63 73 65 74 0a 09 20 20 20 20 24 64  rt $cset..    $d
3110: 67 20 6e 6f 64 65 20 73 65 74 20 20 20 20 24 63  g node set    $c
3120: 73 65 74 20 74 69 6d 65 72 61 6e 67 65 20 24 74  set timerange $t
3130: 72 0a 09 20 20 20 20 24 64 67 20 6e 6f 64 65 20  r..    $dg node 
3140: 73 65 74 20 20 20 20 24 63 73 65 74 20 6c 61 62  set    $cset lab
3150: 65 6c 20 20 20 20 20 22 5b 24 63 73 65 74 20 73  el     "[$cset s
3160: 74 72 5d 5c 5c 6e 5b 6a 6f 69 6e 20 5b 73 74 72  tr]\\n[join [str
3170: 75 63 74 3a 3a 6c 69 73 74 20 6d 61 70 20 24 74  uct::list map $t
3180: 72 20 7b 3a 3a 63 6c 6f 63 6b 20 66 6f 72 6d 61  r {::clock forma
3190: 74 7d 5d 20 22 5c 5c 6e 22 5d 22 0a 09 20 20 20  t}] "\\n"]"..   
31a0: 20 24 64 67 20 6e 6f 64 65 20 73 65 74 20 20 20   $dg node set   
31b0: 20 24 63 73 65 74 20 5f 5f 69 64 5f 5f 20 20 20   $cset __id__   
31c0: 20 5b 24 63 73 65 74 20 69 64 5d 0a 09 20 20 20   [$cset id]..   
31d0: 20 24 64 67 20 6e 6f 64 65 20 73 65 74 20 20 20   $dg node set   
31e0: 20 24 63 73 65 74 20 73 68 61 70 65 20 20 20 20   $cset shape    
31f0: 20 5b 65 78 70 72 20 7b 5b 24 63 73 65 74 20 62   [expr {[$cset b
3200: 79 73 79 6d 62 6f 6c 5d 0a 09 09 09 09 09 09 20  ysymbol]....... 
3210: 20 20 3f 20 22 65 6c 6c 69 70 73 65 22 0a 09 09    ? "ellipse"...
3220: 09 09 09 09 20 20 20 3a 20 22 62 6f 78 22 7d 5d  ....   : "box"}]
3230: 0a 09 7d 0a 0a 09 66 6f 72 65 61 63 68 20 63 73  ..}...foreach cs
3240: 65 74 20 24 72 65 70 6c 61 63 65 6d 65 6e 74 73  et $replacements
3250: 20 7b 0a 09 20 20 20 20 66 6f 72 65 61 63 68 20   {..    foreach 
3260: 73 75 63 63 20 5b 24 63 73 65 74 20 73 75 63 63  succ [$cset succ
3270: 65 73 73 6f 72 73 5d 20 7b 0a 09 09 23 20 54 68  essors] {...# Th
3280: 65 20 6e 65 77 20 63 68 61 6e 67 65 73 65 74 73  e new changesets
3290: 20 6d 61 79 20 68 61 76 65 20 64 65 70 65 6e 64   may have depend
32a0: 65 6e 63 69 65 73 20 6f 75 74 73 69 64 65 20 6f  encies outside o
32b0: 66 0a 09 09 23 20 74 68 65 20 63 68 6f 73 65 6e  f...# the chosen
32c0: 20 73 65 74 2e 20 54 68 65 73 65 20 61 72 65 20   set. These are 
32d0: 69 67 6e 6f 72 65 64 0a 09 09 69 66 20 7b 21 5b  ignored...if {![
32e0: 24 64 67 20 6e 6f 64 65 20 65 78 69 73 74 73 20  $dg node exists 
32f0: 24 73 75 63 63 5d 7d 20 63 6f 6e 74 69 6e 75 65  $succ]} continue
3300: 0a 09 09 24 64 67 20 61 72 63 20 69 6e 73 65 72  ...$dg arc inser
3310: 74 20 24 63 73 65 74 20 24 73 75 63 63 0a 09 09  t $cset $succ...
3320: 69 66 20 7b 24 73 75 63 63 20 65 71 20 24 63 73  if {$succ eq $cs
3330: 65 74 7d 20 7b 0a 09 09 20 20 20 20 74 72 6f 75  et} {...    trou
3340: 62 6c 65 20 69 6e 74 65 72 6e 61 6c 20 22 53 65  ble internal "Se
3350: 6c 66 2d 72 65 66 65 72 65 6e 63 69 6e 67 20 63  lf-referencing c
3360: 68 61 6e 67 65 73 65 74 20 5b 24 63 73 65 74 20  hangeset [$cset 
3370: 73 74 72 5d 22 0a 09 09 7d 0a 09 20 20 20 20 7d  str]"...}..    }
3380: 0a 09 7d 0a 09 66 6f 72 65 61 63 68 20 63 73 65  ..}..foreach cse
3390: 74 20 24 70 72 65 20 7b 0a 09 20 20 20 20 66 6f  t $pre {..    fo
33a0: 72 65 61 63 68 20 73 75 63 63 20 5b 24 63 73 65  reach succ [$cse
33b0: 74 20 73 75 63 63 65 73 73 6f 72 73 5d 20 7b 0a  t successors] {.
33c0: 09 09 23 20 4e 6f 74 65 20 74 68 61 74 20 74 68  ..# Note that th
33d0: 65 20 61 72 63 20 6d 61 79 20 61 6c 72 65 61 64  e arc may alread
33e0: 79 20 65 78 69 73 74 20 69 6e 20 74 68 65 20 67  y exist in the g
33f0: 72 61 70 68 2e 20 49 66 0a 09 09 23 20 73 6f 20  raph. If...# so 
3400: 69 67 6e 6f 72 65 20 69 74 2e 20 54 68 65 20 6e  ignore it. The n
3410: 65 77 20 63 68 61 6e 67 65 73 65 74 73 20 6d 61  ew changesets ma
3420: 79 20 68 61 76 65 0a 09 09 23 20 64 65 70 65 6e  y have...# depen
3430: 64 65 6e 63 69 65 73 20 6f 75 74 73 69 64 65 20  dencies outside 
3440: 6f 66 20 74 68 65 20 63 68 6f 73 65 6e 20 73 65  of the chosen se
3450: 74 2e 20 54 68 65 73 65 20 61 72 65 0a 09 09 23  t. These are...#
3460: 20 69 67 6e 6f 72 65 64 0a 09 09 69 66 20 7b 21   ignored...if {!
3470: 5b 24 64 67 20 6e 6f 64 65 20 65 78 69 73 74 73  [$dg node exists
3480: 20 24 73 75 63 63 5d 7d 20 63 6f 6e 74 69 6e 75   $succ]} continu
3490: 65 0a 09 09 69 66 20 7b 5b 48 61 73 41 72 63 20  e...if {[HasArc 
34a0: 24 64 67 20 24 63 73 65 74 20 24 73 75 63 63 5d  $dg $cset $succ]
34b0: 7d 20 63 6f 6e 74 69 6e 75 65 3b 23 20 54 4f 44  } continue;# TOD
34c0: 4f 20 73 68 6f 75 6c 64 20 62 65 20 67 72 61 70  O should be grap
34d0: 68 20 6d 65 74 68 6f 64 2e 0a 09 09 24 64 67 20  h method....$dg 
34e0: 61 72 63 20 69 6e 73 65 72 74 20 24 63 73 65 74  arc insert $cset
34f0: 20 24 73 75 63 63 0a 09 20 20 20 20 7d 0a 09 7d   $succ..    }..}
3500: 0a 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a  ...return.    }.
3510: 0a 20 20 20 20 23 20 23 20 23 23 20 23 23 23 20  .    # # ## ### 
3520: 23 23 23 23 23 20 23 23 23 23 23 23 23 23 20 23  ##### ######## #
3530: 23 23 23 23 23 23 23 23 23 23 23 23 0a 20 20 20  ############.   
3540: 20 23 23 20 43 61 6c 6c 62 61 63 6b 20 69 6e 76   ## Callback inv
3550: 6f 6b 61 74 69 6f 6e 20 2e 2e 2e 0a 0a 20 20 20  okation .....   
3560: 20 70 72 6f 63 20 50 72 65 48 6f 6f 6b 20 7b 67   proc PreHook {g
3570: 72 61 70 68 7d 20 7b 0a 09 23 20 47 69 76 65 20  raph} {..# Give 
3580: 74 68 65 20 75 73 65 72 20 6f 66 20 74 68 65 20  the user of the 
3590: 63 79 63 6c 65 20 62 72 65 61 6b 65 72 20 74 68  cycle breaker th
35a0: 65 20 6f 70 70 6f 72 74 75 6e 69 74 79 20 74 6f  e opportunity to
35b0: 20 77 6f 72 6b 0a 09 23 20 77 69 74 68 20 74 68   work..# with th
35c0: 65 20 67 72 61 70 68 20 62 65 74 77 65 65 6e 20  e graph between 
35d0: 73 65 74 75 70 20 61 6e 64 20 63 6f 6e 73 75 6d  setup and consum
35e0: 6d 61 74 69 6f 6e 2e 0a 0a 09 3a 3a 76 61 72 69  mation....::vari
35f0: 61 62 6c 65 20 6d 79 70 72 65 63 6d 64 0a 09 69  able myprecmd..i
3600: 66 20 7b 21 5b 6c 6c 65 6e 67 74 68 20 24 6d 79  f {![llength $my
3610: 70 72 65 63 6d 64 5d 7d 20 72 65 74 75 72 6e 0a  precmd]} return.
3620: 0a 09 75 70 6c 65 76 65 6c 20 23 30 20 5b 6c 69  ..uplevel #0 [li
3630: 6e 73 65 72 74 20 24 6d 79 70 72 65 63 6d 64 20  nsert $myprecmd 
3640: 65 6e 64 20 24 67 72 61 70 68 5d 0a 09 4d 61 72  end $graph]..Mar
3650: 6b 20 24 67 72 61 70 68 20 2d 70 72 65 2d 64 6f  k $graph -pre-do
3660: 6e 65 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 7d  ne..return.    }
3670: 0a 0a 20 20 20 20 70 72 6f 63 20 50 72 6f 63 65  ..    proc Proce
3680: 73 73 65 64 48 6f 6f 6b 20 7b 64 67 20 63 73 65  ssedHook {dg cse
3690: 74 20 70 6f 73 7d 20 7b 0a 09 23 20 47 69 76 65  t pos} {..# Give
36a0: 20 74 68 65 20 75 73 65 72 20 6f 66 20 74 68 65   the user of the
36b0: 20 63 79 63 6c 65 20 62 72 65 61 6b 65 72 20 74   cycle breaker t
36c0: 68 65 20 6f 70 70 6f 72 74 75 6e 69 74 79 20 74  he opportunity t
36d0: 6f 20 77 6f 72 6b 0a 09 23 20 77 69 74 68 20 74  o work..# with t
36e0: 68 65 20 63 68 61 6e 67 65 73 65 74 20 62 65 66  he changeset bef
36f0: 6f 72 65 20 69 74 20 69 73 20 72 65 6d 6f 76 65  ore it is remove
3700: 64 20 66 72 6f 6d 20 74 68 65 20 67 72 61 70 68  d from the graph
3710: 2e 0a 0a 09 3a 3a 76 61 72 69 61 62 6c 65 20 6d  ....::variable m
3720: 79 73 61 76 65 63 6d 64 0a 09 69 66 20 7b 21 5b  ysavecmd..if {![
3730: 6c 6c 65 6e 67 74 68 20 24 6d 79 73 61 76 65 63  llength $mysavec
3740: 6d 64 5d 7d 20 72 65 74 75 72 6e 0a 0a 09 75 70  md]} return...up
3750: 6c 65 76 65 6c 20 23 30 20 5b 6c 69 6e 73 65 72  level #0 [linser
3760: 74 20 24 6d 79 73 61 76 65 63 6d 64 20 65 6e 64  t $mysavecmd end
3770: 20 24 64 67 20 24 70 6f 73 20 24 63 73 65 74 5d   $dg $pos $cset]
3780: 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a  ..return.    }..
3790: 20 20 20 20 70 72 6f 63 20 42 72 65 61 6b 43 79      proc BreakCy
37a0: 63 6c 65 48 6f 6f 6b 20 7b 67 72 61 70 68 7d 20  cleHook {graph} 
37b0: 7b 0a 09 23 20 43 61 6c 6c 20 6f 75 74 20 74 6f  {..# Call out to
37c0: 20 74 68 65 20 63 68 6f 73 65 6e 20 61 6c 67 6f   the chosen algo
37d0: 72 69 74 68 6d 20 66 6f 72 20 63 79 63 6c 65 20  rithm for cycle 
37e0: 62 72 65 61 6b 69 6e 67 2e 20 46 69 6e 64 69 6e  breaking. Findin
37f0: 67 0a 09 23 20 61 20 63 79 63 6c 65 20 69 66 20  g..# a cycle if 
3800: 6e 6f 20 62 72 65 61 6b 65 72 20 77 61 73 20 63  no breaker was c
3810: 68 6f 73 65 6e 20 69 73 20 61 6e 20 65 72 72 6f  hosen is an erro
3820: 72 2e 0a 0a 09 3a 3a 76 61 72 69 61 62 6c 65 20  r....::variable 
3830: 6d 79 62 72 65 61 6b 63 6d 64 0a 09 69 66 20 7b  mybreakcmd..if {
3840: 21 5b 6c 6c 65 6e 67 74 68 20 24 6d 79 62 72 65  ![llength $mybre
3850: 61 6b 63 6d 64 5d 7d 20 7b 0a 09 20 20 20 20 74  akcmd]} {..    t
3860: 72 6f 75 62 6c 65 20 66 61 74 61 6c 20 22 46 6f  rouble fatal "Fo
3870: 75 6e 64 20 61 20 63 79 63 6c 65 2c 20 65 78 70  und a cycle, exp
3880: 65 63 74 69 6e 67 20 6e 6f 6e 65 2e 22 0a 09 20  ecting none.".. 
3890: 20 20 20 65 78 69 74 20 31 0a 09 7d 0a 0a 09 75     exit 1..}...u
38a0: 70 6c 65 76 65 6c 20 23 30 20 5b 6c 69 6e 73 65  plevel #0 [linse
38b0: 72 74 20 24 6d 79 62 72 65 61 6b 63 6d 64 20 65  rt $mybreakcmd e
38c0: 6e 64 20 24 67 72 61 70 68 5d 0a 09 72 65 74 75  nd $graph]..retu
38d0: 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 70 72  rn.    }..    pr
38e0: 6f 63 20 43 6c 65 61 72 48 6f 6f 6b 73 20 7b 7d  oc ClearHooks {}
38f0: 20 7b 0a 09 3a 3a 76 61 72 69 61 62 6c 65 20 6d   {..::variable m
3900: 79 70 72 65 63 6d 64 20 20 20 7b 7d 0a 09 3a 3a  yprecmd   {}..::
3910: 76 61 72 69 61 62 6c 65 20 6d 79 73 61 76 65 63  variable mysavec
3920: 6d 64 20 20 7b 7d 0a 09 3a 3a 76 61 72 69 61 62  md  {}..::variab
3930: 6c 65 20 6d 79 62 72 65 61 6b 63 6d 64 20 7b 7d  le mybreakcmd {}
3940: 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a  ..return.    }..
3950: 20 20 20 20 23 20 23 20 23 23 20 23 23 23 20 23      # # ## ### #
3960: 23 23 23 23 20 23 23 23 23 23 23 23 23 20 23 23  #### ######## ##
3970: 23 23 23 23 23 23 23 23 23 23 23 0a 0a 20 20 20  ###########..   
3980: 20 70 72 6f 63 20 4d 61 72 6b 57 61 74 63 68 20   proc MarkWatch 
3990: 7b 67 72 61 70 68 7d 20 7b 0a 09 3a 3a 76 61 72  {graph} {..::var
39a0: 69 61 62 6c 65 20 6d 79 77 61 74 63 68 69 64 73  iable mywatchids
39b0: 0a 09 73 65 74 20 77 61 74 63 68 65 64 20 5b 57  ..set watched [W
39c0: 61 74 63 68 65 64 20 24 67 72 61 70 68 20 24 6d  atched $graph $m
39d0: 79 77 61 74 63 68 69 64 73 5d 0a 09 69 66 20 7b  ywatchids]..if {
39e0: 21 5b 6c 6c 65 6e 67 74 68 20 24 77 61 74 63 68  ![llength $watch
39f0: 65 64 5d 7d 20 72 65 74 75 72 6e 0a 09 73 65 74  ed]} return..set
3a00: 20 6e 65 69 67 68 62 6f 75 72 73 20 5b 65 76 61   neighbours [eva
3a10: 6c 20 5b 6c 69 6e 73 65 72 74 20 24 77 61 74 63  l [linsert $watc
3a20: 68 65 64 20 30 20 24 67 72 61 70 68 20 6e 6f 64  hed 0 $graph nod
3a30: 65 73 20 2d 61 64 6a 5d 5d 0a 09 23 66 6f 72 65  es -adj]]..#fore
3a40: 61 63 68 20 6e 20 24 6e 65 69 67 68 62 6f 75 72  ach n $neighbour
3a50: 73 20 7b 20 6c 6f 67 20 77 72 69 74 65 20 36 20  s { log write 6 
3a60: 63 79 63 6c 65 62 72 65 61 6b 65 72 20 22 4e 65  cyclebreaker "Ne
3a70: 69 67 68 62 6f 72 20 5b 24 6e 20 69 64 5d 20 3d  ighbor [$n id] =
3a80: 3e 20 24 6e 22 20 7d 0a 09 4d 61 72 6b 20 24 67  > $n" }..Mark $g
3a90: 72 61 70 68 20 77 61 74 63 68 65 64 20 5b 63 6f  raph watched [co
3aa0: 6e 63 61 74 20 24 77 61 74 63 68 65 64 20 24 6e  ncat $watched $n
3ab0: 65 69 67 68 62 6f 75 72 73 5d 0a 09 72 65 74 75  eighbours]..retu
3ac0: 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 70 72  rn.    }..    pr
3ad0: 6f 63 20 57 61 74 63 68 65 64 20 7b 67 72 61 70  oc Watched {grap
3ae0: 68 20 77 61 74 63 68 69 64 73 7d 20 7b 0a 09 73  h watchids} {..s
3af0: 65 74 20 72 65 73 20 7b 7d 0a 09 66 6f 72 65 61  et res {}..forea
3b00: 63 68 20 69 64 20 24 77 61 74 63 68 69 64 73 20  ch id $watchids 
3b10: 7b 0a 09 20 20 20 20 73 65 74 20 6e 6c 20 5b 24  {..    set nl [$
3b20: 67 72 61 70 68 20 6e 6f 64 65 73 20 2d 6b 65 79  graph nodes -key
3b30: 20 5f 5f 69 64 5f 5f 20 2d 76 61 6c 75 65 20 24   __id__ -value $
3b40: 69 64 5d 0a 09 20 20 20 20 69 66 20 7b 21 5b 6c  id]..    if {![l
3b50: 6c 65 6e 67 74 68 20 24 6e 6c 5d 7d 20 63 6f 6e  length $nl]} con
3b60: 74 69 6e 75 65 0a 09 20 20 20 20 6c 61 70 70 65  tinue..    lappe
3b70: 6e 64 20 72 65 73 20 24 6e 6c 0a 09 20 20 20 20  nd res $nl..    
3b80: 23 6c 6f 67 20 77 72 69 74 65 20 36 20 62 72 65  #log write 6 bre
3b90: 61 6b 72 63 79 63 6c 65 20 22 57 61 74 63 68 69  akrcycle "Watchi
3ba0: 6e 67 20 24 69 64 20 3d 3e 20 24 6e 6c 22 0a 09  ng $id => $nl"..
3bb0: 20 20 20 20 24 67 72 61 70 68 20 6e 6f 64 65 20      $graph node 
3bc0: 73 65 74 20 24 6e 6c 20 66 6f 6e 74 63 6f 6c 6f  set $nl fontcolo
3bd0: 72 20 72 65 64 0a 09 7d 0a 09 72 65 74 75 72 6e  r red..}..return
3be0: 20 24 72 65 73 0a 20 20 20 20 7d 0a 0a 20 20 20   $res.    }..   
3bf0: 20 23 20 23 20 23 23 20 23 23 23 20 23 23 23 23   # # ## ### ####
3c00: 23 20 23 23 23 23 23 23 23 23 20 23 23 23 23 23  # ######## #####
3c10: 23 23 23 23 23 23 23 23 0a 0a 0a 20 20 20 20 74  ########...    t
3c20: 79 70 65 76 61 72 69 61 62 6c 65 20 6d 79 61 74  ypevariable myat
3c30: 20 20 20 20 20 20 30 20 3b 20 23 20 43 6f 75 6e        0 ; # Coun
3c40: 74 65 72 20 66 6f 72 20 63 6f 6d 6d 69 74 20 69  ter for commit i
3c50: 64 73 20 66 6f 72 20 74 68 65 0a 09 09 09 20 20  ds for the....  
3c60: 20 20 20 20 20 23 20 63 68 61 6e 67 65 73 65 74       # changeset
3c70: 73 2e 0a 20 20 20 20 74 79 70 65 76 61 72 69 61  s..    typevaria
3c80: 62 6c 65 20 6d 79 62 6f 74 74 6f 6d 20 7b 7d 20  ble mybottom {} 
3c90: 3b 20 23 20 4c 69 73 74 20 6f 66 20 74 68 65 20  ; # List of the 
3ca0: 63 61 6e 64 69 64 61 74 65 20 6e 6f 64 65 73 20  candidate nodes 
3cb0: 66 6f 72 0a 09 09 09 20 20 20 20 20 20 20 23 20  for....       # 
3cc0: 63 6f 6d 6d 69 74 74 69 6e 67 2e 0a 0a 20 20 20  committing...   
3cd0: 20 74 79 70 65 76 61 72 69 61 62 6c 65 20 6d 79   typevariable my
3ce0: 70 72 65 63 6d 64 20 20 20 7b 7d 20 3b 20 23 20  precmd   {} ; # 
3cf0: 43 61 6c 6c 62 61 63 6b 2c 20 63 68 61 6e 67 65  Callback, change
3d00: 20 67 72 61 70 68 20 62 65 66 6f 72 65 20 77 61   graph before wa
3d10: 6c 6b 2e 0a 20 20 20 20 74 79 70 65 76 61 72 69  lk..    typevari
3d20: 61 62 6c 65 20 6d 79 73 61 76 65 63 6d 64 20 20  able mysavecmd  
3d30: 7b 7d 20 3b 20 23 20 43 61 6c 6c 62 61 63 6b 2c  {} ; # Callback,
3d40: 20 66 6f 72 20 65 61 63 68 20 70 72 6f 63 65 73   for each proces
3d50: 73 65 64 20 6e 6f 64 65 2e 0a 20 20 20 20 74 79  sed node..    ty
3d60: 70 65 76 61 72 69 61 62 6c 65 20 6d 79 62 72 65  pevariable mybre
3d70: 61 6b 63 6d 64 20 7b 7d 20 3b 20 23 20 43 61 6c  akcmd {} ; # Cal
3d80: 6c 62 61 63 6b 2c 20 66 6f 72 20 65 61 63 68 20  lback, for each 
3d90: 66 6f 75 6e 64 20 63 79 63 6c 65 2e 0a 0a 20 20  found cycle...  
3da0: 20 20 74 79 70 65 76 61 72 69 61 62 6c 65 20 6d    typevariable m
3db0: 79 64 6f 74 64 65 73 74 69 6e 61 74 69 6f 6e 20  ydotdestination 
3dc0: 7b 7d 20 3b 20 23 20 44 65 73 74 69 6e 61 74 69  {} ; # Destinati
3dd0: 6f 6e 20 64 69 72 65 63 74 6f 72 79 20 66 6f 72  on directory for
3de0: 20 74 68 65 0a 09 09 09 09 20 20 20 20 20 20 20   the.....       
3df0: 23 20 67 65 6e 65 72 61 74 65 64 20 2e 64 6f 74  # generated .dot
3e00: 20 66 69 6c 65 73 2e 0a 20 20 20 20 74 79 70 65   files..    type
3e10: 76 61 72 69 61 62 6c 65 20 6d 79 64 6f 74 70 72  variable mydotpr
3e20: 65 66 69 78 20 20 20 20 20 20 7b 7d 20 3b 20 23  efix      {} ; #
3e30: 20 50 72 65 66 69 78 20 66 6f 72 20 64 6f 74 20   Prefix for dot 
3e40: 66 69 6c 65 73 20 77 68 65 6e 0a 09 09 09 09 20  files when..... 
3e50: 20 20 20 20 20 20 23 20 65 78 70 6f 72 74 69 6e        # exportin
3e60: 67 20 74 68 65 20 67 72 61 70 68 73 2e 0a 20 20  g the graphs..  
3e70: 20 20 74 79 70 65 76 61 72 69 61 62 6c 65 20 6d    typevariable m
3e80: 79 64 6f 74 69 64 20 20 20 20 20 20 20 20 20 20  ydotid          
3e90: 20 30 20 3b 20 23 20 43 6f 75 6e 74 65 72 20 66   0 ; # Counter f
3ea0: 6f 72 20 64 6f 74 20 66 69 6c 65 20 6e 61 6d 65  or dot file name
3eb0: 0a 09 09 09 09 20 20 20 20 20 20 20 23 20 67 65  .....       # ge
3ec0: 6e 65 72 61 74 69 6f 6e 2e 0a 20 20 20 20 74 79  neration..    ty
3ed0: 70 65 76 61 72 69 61 62 6c 65 20 6d 79 77 61 74  pevariable mywat
3ee0: 63 68 69 64 73 20 20 20 20 20 20 20 7b 7d 20 3b  chids       {} ;
3ef0: 20 23 20 43 68 61 6e 67 65 73 65 74 73 20 74 6f   # Changesets to
3f00: 20 77 61 74 63 68 20 74 68 65 0a 09 09 09 09 20   watch the..... 
3f10: 20 20 20 20 20 20 23 20 6e 65 69 67 68 62 6f 75        # neighbou
3f20: 72 68 6f 6f 64 20 6f 66 2e 0a 0a 20 20 20 20 23  rhood of...    #
3f30: 20 23 20 23 23 20 23 23 23 20 23 23 23 23 23 20   # ## ### ##### 
3f40: 23 23 23 23 23 23 23 23 20 23 23 23 23 23 23 23  ######## #######
3f50: 23 23 23 23 23 23 0a 20 20 20 20 23 23 20 43 6f  ######.    ## Co
3f60: 6e 66 69 67 75 72 61 74 69 6f 6e 0a 0a 20 20 20  nfiguration..   
3f70: 20 70 72 61 67 6d 61 20 2d 68 61 73 69 6e 73 74   pragma -hasinst
3f80: 61 6e 63 65 73 20 20 20 6e 6f 20 3b 20 23 20 73  ances   no ; # s
3f90: 69 6e 67 6c 65 74 6f 6e 0a 20 20 20 20 70 72 61  ingleton.    pra
3fa0: 67 6d 61 20 2d 68 61 73 74 79 70 65 69 6e 66 6f  gma -hastypeinfo
3fb0: 20 20 20 20 6e 6f 20 3b 20 23 20 6e 6f 20 69 6e      no ; # no in
3fc0: 74 72 6f 73 70 65 63 74 69 6f 6e 0a 20 20 20 20  trospection.    
3fd0: 70 72 61 67 6d 61 20 2d 68 61 73 74 79 70 65 64  pragma -hastyped
3fe0: 65 73 74 72 6f 79 20 6e 6f 20 3b 20 23 20 69 6d  estroy no ; # im
3ff0: 6d 6f 72 74 61 6c 0a 0a 20 20 20 20 23 20 23 20  mortal..    # # 
4000: 23 23 20 23 23 23 20 23 23 23 23 23 20 23 23 23  ## ### ##### ###
4010: 23 23 23 23 23 20 23 23 23 23 23 23 23 23 23 23  ##### ##########
4020: 23 23 23 0a 7d 0a 0a 6e 61 6d 65 73 70 61 63 65  ###.}..namespace
4030: 20 65 76 61 6c 20 3a 3a 76 63 3a 3a 66 6f 73 73   eval ::vc::foss
4040: 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 20  il::import::cvs 
4050: 7b 0a 20 20 20 20 6e 61 6d 65 73 70 61 63 65 20  {.    namespace 
4060: 65 78 70 6f 72 74 20 63 79 63 6c 65 62 72 65 61  export cyclebrea
4070: 6b 65 72 0a 20 20 20 20 6e 61 6d 65 73 70 61 63  ker.    namespac
4080: 65 20 65 76 61 6c 20 63 79 63 6c 65 62 72 65 61  e eval cyclebrea
4090: 6b 65 72 20 7b 0a 09 6e 61 6d 65 73 70 61 63 65  ker {..namespace
40a0: 20 65 76 61 6c 20 70 72 6f 6a 65 63 74 20 7b 0a   eval project {.
40b0: 09 20 20 20 20 6e 61 6d 65 73 70 61 63 65 20 69  .    namespace i
40c0: 6d 70 6f 72 74 20 3a 3a 76 63 3a 3a 66 6f 73 73  mport ::vc::foss
40d0: 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a  il::import::cvs:
40e0: 3a 70 72 6f 6a 65 63 74 3a 3a 72 65 76 0a 09 20  :project::rev.. 
40f0: 20 20 20 6e 61 6d 65 73 70 61 63 65 20 69 6d 70     namespace imp
4100: 6f 72 74 20 3a 3a 76 63 3a 3a 66 6f 73 73 69 6c  ort ::vc::fossil
4110: 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 70  ::import::cvs::p
4120: 72 6f 6a 65 63 74 3a 3a 72 65 76 6c 69 6e 6b 0a  roject::revlink.
4130: 09 7d 0a 09 6e 61 6d 65 73 70 61 63 65 20 69 6d  .}..namespace im
4140: 70 6f 72 74 20 3a 3a 76 63 3a 3a 74 6f 6f 6c 73  port ::vc::tools
4150: 3a 3a 6d 69 73 63 3a 3a 2a 0a 09 6e 61 6d 65 73  ::misc::*..names
4160: 70 61 63 65 20 69 6d 70 6f 72 74 20 3a 3a 76 63  pace import ::vc
4170: 3a 3a 74 6f 6f 6c 73 3a 3a 6c 6f 67 0a 09 6e 61  ::tools::log..na
4180: 6d 65 73 70 61 63 65 20 69 6d 70 6f 72 74 20 3a  mespace import :
4190: 3a 76 63 3a 3a 74 6f 6f 6c 73 3a 3a 74 72 6f 75  :vc::tools::trou
41a0: 62 6c 65 0a 09 6e 61 6d 65 73 70 61 63 65 20 69  ble..namespace i
41b0: 6d 70 6f 72 74 20 3a 3a 76 63 3a 3a 74 6f 6f 6c  mport ::vc::tool
41c0: 73 3a 3a 64 6f 74 0a 09 6c 6f 67 20 72 65 67 69  s::dot..log regi
41d0: 73 74 65 72 20 63 79 63 6c 65 62 72 65 61 6b 65  ster cyclebreake
41e0: 72 0a 20 20 20 20 7d 0a 7d 0a 0a 23 20 23 20 23  r.    }.}..# # #
41f0: 23 20 23 23 23 20 23 23 23 23 23 20 23 23 23 23  # ### ##### ####
4200: 23 23 23 23 20 23 23 23 23 23 23 23 23 23 23 23  #### ###########
4210: 23 23 20 23 23 23 23 23 23 23 23 23 23 23 23 23  ## #############
4220: 23 23 23 23 23 23 23 23 0a 23 23 20 52 65 61 64  ########.## Read
4230: 79 0a 0a 70 61 63 6b 61 67 65 20 70 72 6f 76 69  y..package provi
4240: 64 65 20 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69  de vc::fossil::i
4250: 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 63 79 63 6c  mport::cvs::cycl
4260: 65 62 72 65 61 6b 65 72 20 31 2e 30 0a 72 65 74  ebreaker 1.0.ret
4270: 75 72 6e 0a                                      urn.