Hex Artifact Content
Not logged in

Artifact 6aba1b2f014f72973bfde19a83526186adaf3b71:

File tools/cvs2fossil/lib/c2f_pbreakacycle.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 50 61 73  ########..## Pas
0200: 73 20 49 58 2e 20 54 68 69 73 20 69 73 20 74 68  s IX. This is th
0210: 65 20 66 69 6e 61 6c 20 70 61 73 73 20 66 6f 72  e final pass for
0220: 20 62 72 65 61 6b 69 6e 67 20 63 68 61 6e 67 65   breaking change
0230: 73 65 74 20 64 65 70 65 6e 64 65 6e 63 79 0a 23  set dependency.#
0240: 23 20 63 79 63 6c 65 73 2e 20 54 68 65 20 70 72  # cycles. The pr
0250: 65 76 69 6f 75 73 20 62 72 65 61 6b 65 72 20 70  evious breaker p
0260: 61 73 73 65 73 20 28 36 20 61 6e 64 20 38 29 20  asses (6 and 8) 
0270: 62 72 6f 6b 65 20 63 79 63 6c 65 73 20 63 6f 76  broke cycles cov
0280: 65 72 69 6e 67 0a 23 23 20 72 65 76 69 73 69 6f  ering.## revisio
0290: 6e 20 61 6e 64 20 73 79 6d 62 6f 6c 20 63 68 61  n and symbol cha
02a0: 6e 67 65 73 65 74 73 2c 20 72 65 73 70 65 63 74  ngesets, respect
02b0: 69 76 65 6c 79 2e 20 54 68 69 73 20 70 61 73 73  ively. This pass
02c0: 20 6e 6f 77 20 62 72 65 61 6b 73 0a 23 23 20 61   now breaks.## a
02d0: 6e 79 20 72 65 6d 61 69 6e 69 6e 67 20 63 79 63  ny remaining cyc
02e0: 6c 65 73 2c 20 65 61 63 68 20 6f 66 20 77 68 69  les, each of whi
02f0: 63 68 20 68 61 73 20 74 6f 20 63 6f 6e 74 61 69  ch has to contai
0300: 6e 20 61 74 20 6c 65 61 73 74 20 6f 6e 65 0a 23  n at least one.#
0310: 23 20 72 65 76 69 73 69 6f 6e 20 61 6e 64 20 61  # revision and a
0320: 74 20 6c 65 61 73 74 20 6f 6e 65 20 73 79 6d 62  t least one symb
0330: 6f 6c 20 63 68 61 6e 67 65 73 65 74 2e 0a 0a 23  ol changeset...#
0340: 20 23 20 23 23 20 23 23 23 20 23 23 23 23 23 20   # ## ### ##### 
0350: 23 23 23 23 23 23 23 23 20 23 23 23 23 23 23 23  ######## #######
0360: 23 23 23 23 23 23 20 23 23 23 23 23 23 23 23 23  ###### #########
0370: 23 23 23 23 23 23 23 23 23 23 23 23 0a 23 23 20  ############.## 
0380: 52 65 71 75 69 72 65 6d 65 6e 74 73 0a 0a 70 61  Requirements..pa
0390: 63 6b 61 67 65 20 72 65 71 75 69 72 65 20 54 63  ckage require Tc
03a0: 6c 20 38 2e 34 20 20 20 20 20 20 20 20 20 20 20  l 8.4           
03b0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
03c0: 20 20 20 20 20 20 20 20 3b 20 23 20 52 65 71 75          ; # Requ
03d0: 69 72 65 64 20 72 75 6e 74 69 6d 65 2e 0a 70 61  ired runtime..pa
03e0: 63 6b 61 67 65 20 72 65 71 75 69 72 65 20 73 6e  ckage require sn
03f0: 69 74 20 20 20 20 20 20 20 20 20 20 20 20 20 20  it              
0400: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
0410: 20 20 20 20 20 20 20 20 3b 20 23 20 4f 4f 20 73          ; # OO s
0420: 79 73 74 65 6d 2e 0a 70 61 63 6b 61 67 65 20 72  ystem..package r
0430: 65 71 75 69 72 65 20 73 74 72 75 63 74 3a 3a 6c  equire struct::l
0440: 69 73 74 20 20 20 20 20 20 20 20 20 20 20 20 20  ist             
0450: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
0460: 20 3b 20 23 20 48 69 67 68 65 72 20 6f 72 64 65   ; # Higher orde
0470: 72 20 6c 69 73 74 20 6f 70 65 72 61 74 69 6f 6e  r list operation
0480: 73 2e 0a 70 61 63 6b 61 67 65 20 72 65 71 75 69  s..package requi
0490: 72 65 20 73 74 72 75 63 74 3a 3a 73 65 74 20 20  re struct::set  
04a0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
04b0: 20 20 20 20 20 20 20 20 20 20 20 20 20 3b 20 23               ; #
04c0: 20 53 65 74 20 6f 70 65 72 61 74 69 6f 6e 73 2e   Set operations.
04d0: 0a 70 61 63 6b 61 67 65 20 72 65 71 75 69 72 65  .package require
04e0: 20 76 63 3a 3a 74 6f 6f 6c 73 3a 3a 6d 69 73 63   vc::tools::misc
04f0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
0500: 20 20 20 20 20 20 20 20 20 20 20 3b 20 23 20 4d             ; # M
0510: 69 6e 2c 20 6d 61 78 2e 0a 70 61 63 6b 61 67 65  in, max..package
0520: 20 72 65 71 75 69 72 65 20 76 63 3a 3a 74 6f 6f   require vc::too
0530: 6c 73 3a 3a 6c 6f 67 20 20 20 20 20 20 20 20 20  ls::log         
0540: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
0550: 20 20 20 3b 20 23 20 55 73 65 72 20 66 65 65 64     ; # User feed
0560: 62 61 63 6b 2e 0a 70 61 63 6b 61 67 65 20 72 65  back..package re
0570: 71 75 69 72 65 20 76 63 3a 3a 74 6f 6f 6c 73 3a  quire vc::tools:
0580: 3a 74 72 6f 75 62 6c 65 20 20 20 20 20 20 20 20  :trouble        
0590: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
05a0: 3b 20 23 20 45 72 72 6f 72 20 72 65 70 6f 72 74  ; # Error report
05b0: 69 6e 67 2e 0a 70 61 63 6b 61 67 65 20 72 65 71  ing..package req
05c0: 75 69 72 65 20 76 63 3a 3a 66 6f 73 73 69 6c 3a  uire vc::fossil:
05d0: 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 72 65  :import::cvs::re
05e0: 70 6f 73 69 74 6f 72 79 20 20 20 20 20 20 20 3b  pository       ;
05f0: 20 23 20 52 65 70 6f 73 69 74 6f 72 79 20 6d 61   # Repository ma
0600: 6e 61 67 65 6d 65 6e 74 2e 0a 70 61 63 6b 61 67  nagement..packag
0610: 65 20 72 65 71 75 69 72 65 20 76 63 3a 3a 66 6f  e require vc::fo
0620: 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76  ssil::import::cv
0630: 73 3a 3a 63 79 63 6c 65 62 72 65 61 6b 65 72 20  s::cyclebreaker 
0640: 20 20 20 20 3b 20 23 20 42 72 65 61 6b 69 6e 67      ; # Breaking
0650: 20 64 65 70 65 6e 64 65 6e 63 79 20 63 79 63 6c   dependency cycl
0660: 65 73 2e 0a 70 61 63 6b 61 67 65 20 72 65 71 75  es..package requ
0670: 69 72 65 20 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a  ire vc::fossil::
0680: 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 73 74 61  import::cvs::sta
0690: 74 65 20 20 20 20 20 20 20 20 20 20 20 20 3b 20  te            ; 
06a0: 23 20 53 74 61 74 65 20 73 74 6f 72 61 67 65 2e  # State storage.
06b0: 0a 70 61 63 6b 61 67 65 20 72 65 71 75 69 72 65  .package require
06c0: 20 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70   vc::fossil::imp
06d0: 6f 72 74 3a 3a 63 76 73 3a 3a 70 72 6f 6a 65 63  ort::cvs::projec
06e0: 74 3a 3a 72 65 76 20 20 20 20 20 3b 20 23 20 50  t::rev     ; # P
06f0: 72 6f 6a 65 63 74 20 6c 65 76 65 6c 20 63 68 61  roject level cha
0700: 6e 67 65 73 65 74 73 0a 0a 23 20 23 20 23 23 20  ngesets..# # ## 
0710: 23 23 23 20 23 23 23 23 23 20 23 23 23 23 23 23  ### ##### ######
0720: 23 23 20 23 23 23 23 23 23 23 23 23 23 23 23 23  ## #############
0730: 20 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23   ###############
0740: 23 23 23 23 23 23 0a 23 23 20 52 65 67 69 73 74  ######.## Regist
0750: 65 72 20 74 68 65 20 70 61 73 73 20 77 69 74 68  er the pass with
0760: 20 74 68 65 20 6d 61 6e 61 67 65 6d 65 6e 74 0a   the management.
0770: 0a 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70  .vc::fossil::imp
0780: 6f 72 74 3a 3a 63 76 73 3a 3a 70 61 73 73 20 64  ort::cvs::pass d
0790: 65 66 69 6e 65 20 5c 0a 20 20 20 20 42 72 65 61  efine \.    Brea
07a0: 6b 41 6c 6c 43 73 65 74 43 79 63 6c 65 73 20 5c  kAllCsetCycles \
07b0: 0a 20 20 20 20 7b 42 72 65 61 6b 20 52 65 6d 61  .    {Break Rema
07c0: 69 6e 69 6e 67 20 43 68 61 6e 67 65 53 65 74 20  ining ChangeSet 
07d0: 44 65 70 65 6e 64 65 6e 63 79 20 43 79 63 6c 65  Dependency Cycle
07e0: 73 7d 20 5c 0a 20 20 20 20 3a 3a 76 63 3a 3a 66  s} \.    ::vc::f
07f0: 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63  ossil::import::c
0800: 76 73 3a 3a 70 61 73 73 3a 3a 62 72 65 61 6b 61  vs::pass::breaka
0810: 63 79 63 6c 65 0a 0a 23 20 23 20 23 23 20 23 23  cycle..# # ## ##
0820: 23 20 23 23 23 23 23 20 23 23 23 23 23 23 23 23  # ##### ########
0830: 20 23 23 23 23 23 23 23 23 23 23 23 23 23 20 23   ############# #
0840: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23  ################
0850: 23 23 23 23 0a 23 23 0a 0a 73 6e 69 74 3a 3a 74  ####.##..snit::t
0860: 79 70 65 20 3a 3a 76 63 3a 3a 66 6f 73 73 69 6c  ype ::vc::fossil
0870: 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 70  ::import::cvs::p
0880: 61 73 73 3a 3a 62 72 65 61 6b 61 63 79 63 6c 65  ass::breakacycle
0890: 20 7b 0a 20 20 20 20 23 20 23 20 23 23 20 23 23   {.    # # ## ##
08a0: 23 20 23 23 23 23 23 20 23 23 23 23 23 23 23 23  # ##### ########
08b0: 20 23 23 23 23 23 23 23 23 23 23 23 23 23 0a 20   #############. 
08c0: 20 20 20 23 23 20 50 75 62 6c 69 63 20 41 50 49     ## Public API
08d0: 0a 0a 20 20 20 20 74 79 70 65 6d 65 74 68 6f 64  ..    typemethod
08e0: 20 73 65 74 75 70 20 7b 7d 20 7b 0a 09 23 20 44   setup {} {..# D
08f0: 65 66 69 6e 65 20 74 68 65 20 6e 61 6d 65 73 20  efine the names 
0900: 61 6e 64 20 73 74 72 75 63 74 75 72 65 20 6f 66  and structure of
0910: 20 74 68 65 20 70 65 72 73 69 73 74 65 6e 74 20   the persistent 
0920: 73 74 61 74 65 20 6f 66 0a 09 23 20 74 68 69 73  state of..# this
0930: 20 70 61 73 73 2e 0a 0a 09 73 74 61 74 65 20 72   pass....state r
0940: 65 61 64 69 6e 67 20 63 73 6f 72 64 65 72 0a 09  eading csorder..
0950: 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20  return.    }..  
0960: 20 20 74 79 70 65 6d 65 74 68 6f 64 20 6c 6f 61    typemethod loa
0970: 64 20 7b 7d 20 7b 0a 09 23 20 50 61 73 73 20 6d  d {} {..# Pass m
0980: 61 6e 61 67 65 72 20 69 6e 74 65 72 66 61 63 65  anager interface
0990: 2e 20 45 78 65 63 75 74 65 64 20 74 6f 20 6c 6f  . Executed to lo
09a0: 61 64 20 64 61 74 61 20 63 6f 6d 70 75 74 65 64  ad data computed
09b0: 20 62 79 0a 09 23 20 74 68 69 73 20 70 61 73 73   by..# this pass
09c0: 20 69 6e 74 6f 20 6d 65 6d 6f 72 79 20 77 68 65   into memory whe
09d0: 6e 20 74 68 69 73 20 70 61 73 73 20 69 73 20 73  n this pass is s
09e0: 6b 69 70 70 65 64 20 69 6e 73 74 65 61 64 20 6f  kipped instead o
09f0: 66 0a 09 23 20 65 78 65 63 75 74 65 64 2e 0a 09  f..# executed...
0a00: 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20  return.    }..  
0a10: 20 20 74 79 70 65 6d 65 74 68 6f 64 20 72 75 6e    typemethod run
0a20: 20 7b 7d 20 7b 0a 09 23 20 50 61 73 73 20 6d 61   {} {..# Pass ma
0a30: 6e 61 67 65 72 20 69 6e 74 65 72 66 61 63 65 2e  nager interface.
0a40: 20 45 78 65 63 75 74 65 64 20 74 6f 20 70 65 72   Executed to per
0a50: 66 6f 72 6d 20 74 68 65 0a 09 23 20 66 75 6e 63  form the..# func
0a60: 74 69 6f 6e 61 6c 69 74 79 20 6f 66 20 74 68 65  tionality of the
0a70: 20 70 61 73 73 2e 0a 0a 09 73 65 74 20 6c 65 6e   pass....set len
0a80: 20 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20   [string length 
0a90: 5b 70 72 6f 6a 65 63 74 3a 3a 72 65 76 20 6e 75  [project::rev nu
0aa0: 6d 5d 5d 0a 09 73 65 74 20 6d 79 61 74 66 6d 74  m]]..set myatfmt
0ab0: 20 25 24 7b 6c 65 6e 7d 73 0a 09 69 6e 63 72 20   %${len}s..incr 
0ac0: 6c 65 6e 20 36 0a 09 73 65 74 20 6d 79 63 73 66  len 6..set mycsf
0ad0: 6d 74 20 25 24 7b 6c 65 6e 7d 73 0a 0a 09 63 79  mt %${len}s...cy
0ae0: 63 6c 65 62 72 65 61 6b 65 72 20 70 72 65 63 6d  clebreaker precm
0af0: 64 20 20 20 5b 6d 79 70 72 6f 63 20 42 72 65 61  d   [myproc Brea
0b00: 6b 42 61 63 6b 77 61 72 64 42 72 61 6e 63 68 65  kBackwardBranche
0b10: 73 5d 0a 09 63 79 63 6c 65 62 72 65 61 6b 65 72  s]..cyclebreaker
0b20: 20 73 61 76 65 63 6d 64 20 20 5b 6d 79 70 72 6f   savecmd  [mypro
0b30: 63 20 4b 65 65 70 4f 72 64 65 72 5d 0a 09 63 79  c KeepOrder]..cy
0b40: 63 6c 65 62 72 65 61 6b 65 72 20 62 72 65 61 6b  clebreaker break
0b50: 63 6d 64 20 5b 6d 79 70 72 6f 63 20 42 72 65 61  cmd [myproc Brea
0b60: 6b 43 79 63 6c 65 5d 0a 0a 09 73 74 61 74 65 20  kCycle]...state 
0b70: 74 72 61 6e 73 61 63 74 69 6f 6e 20 7b 0a 09 20  transaction {.. 
0b80: 20 20 20 4c 6f 61 64 43 6f 6d 6d 69 74 4f 72 64     LoadCommitOrd
0b90: 65 72 0a 09 20 20 20 20 63 79 63 6c 65 62 72 65  er..    cyclebre
0ba0: 61 6b 65 72 20 72 75 6e 20 62 72 65 61 6b 2d 61  aker run break-a
0bb0: 6c 6c 20 5b 6d 79 70 72 6f 63 20 43 68 61 6e 67  ll [myproc Chang
0bc0: 65 73 65 74 73 5d 0a 09 7d 0a 0a 09 72 65 70 6f  esets]..}...repo
0bd0: 73 69 74 6f 72 79 20 70 72 69 6e 74 63 73 65 74  sitory printcset
0be0: 73 74 61 74 69 73 74 69 63 73 0a 09 72 65 74 75  statistics..retu
0bf0: 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 74 79  rn.    }..    ty
0c00: 70 65 6d 65 74 68 6f 64 20 64 69 73 63 61 72 64  pemethod discard
0c10: 20 7b 7d 20 7b 0a 09 23 20 50 61 73 73 20 6d 61   {} {..# Pass ma
0c20: 6e 61 67 65 72 20 69 6e 74 65 72 66 61 63 65 2e  nager interface.
0c30: 20 45 78 65 63 75 74 65 64 20 66 6f 72 20 61 6c   Executed for al
0c40: 6c 20 70 61 73 73 65 73 20 61 66 74 65 72 20 74  l passes after t
0c50: 68 65 0a 09 23 20 72 75 6e 20 70 61 73 73 65 73  he..# run passes
0c60: 2c 20 74 6f 20 72 65 6d 6f 76 65 20 61 6c 6c 20  , to remove all 
0c70: 64 61 74 61 20 6f 66 20 74 68 69 73 20 70 61 73  data of this pas
0c80: 73 20 66 72 6f 6d 20 74 68 65 20 73 74 61 74 65  s from the state
0c90: 2c 0a 09 23 20 61 73 20 62 65 69 6e 67 20 6f 75  ,..# as being ou
0ca0: 74 20 6f 66 20 64 61 74 65 2e 0a 09 72 65 74 75  t of date...retu
0cb0: 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 23 20  rn.    }..    # 
0cc0: 23 20 23 23 20 23 23 23 20 23 23 23 23 23 20 23  # ## ### ##### #
0cd0: 23 23 23 23 23 23 23 20 23 23 23 23 23 23 23 23  ####### ########
0ce0: 23 23 23 23 23 0a 20 20 20 20 23 23 20 49 6e 74  #####.    ## Int
0cf0: 65 72 6e 61 6c 20 6d 65 74 68 6f 64 73 0a 0a 20  ernal methods.. 
0d00: 20 20 20 70 72 6f 63 20 43 68 61 6e 67 65 73 65     proc Changese
0d10: 74 73 20 7b 7d 20 7b 20 70 72 6f 6a 65 63 74 3a  ts {} { project:
0d20: 3a 72 65 76 20 61 6c 6c 20 7d 0a 0a 20 20 20 20  :rev all }..    
0d30: 70 72 6f 63 20 4c 6f 61 64 43 6f 6d 6d 69 74 4f  proc LoadCommitO
0d40: 72 64 65 72 20 7b 7d 20 7b 0a 09 3a 3a 76 61 72  rder {} {..::var
0d50: 69 61 62 6c 65 20 6d 79 63 73 65 74 0a 09 3a 3a  iable mycset..::
0d60: 76 61 72 69 61 62 6c 65 20 6d 79 72 65 76 69 73  variable myrevis
0d70: 69 6f 6e 63 68 61 6e 67 65 73 65 74 73 0a 0a 09  ionchangesets...
0d80: 73 74 61 74 65 20 74 72 61 6e 73 61 63 74 69 6f  state transactio
0d90: 6e 20 7b 0a 09 20 20 20 20 66 6f 72 65 61 63 68  n {..    foreach
0da0: 20 7b 63 69 64 20 70 6f 73 7d 20 5b 73 74 61 74   {cid pos} [stat
0db0: 65 20 72 75 6e 20 7b 20 53 45 4c 45 43 54 20 63  e run { SELECT c
0dc0: 69 64 2c 20 70 6f 73 20 46 52 4f 4d 20 63 73 6f  id, pos FROM cso
0dd0: 72 64 65 72 20 7d 5d 20 7b 0a 09 09 73 65 74 20  rder }] {...set 
0de0: 63 73 65 74 20 5b 70 72 6f 6a 65 63 74 3a 3a 72  cset [project::r
0df0: 65 76 20 6f 66 20 24 63 69 64 5d 0a 09 09 24 63  ev of $cid]...$c
0e00: 73 65 74 20 73 65 74 70 6f 73 20 24 70 6f 73 0a  set setpos $pos.
0e10: 09 09 73 65 74 20 6d 79 63 73 65 74 28 24 70 6f  ..set mycset($po
0e20: 73 29 20 24 63 73 65 74 0a 09 09 6c 61 70 70 65  s) $cset...lappe
0e30: 6e 64 20 6d 79 72 65 76 69 73 69 6f 6e 63 68 61  nd myrevisioncha
0e40: 6e 67 65 73 65 74 73 20 24 63 73 65 74 0a 09 20  ngesets $cset.. 
0e50: 20 20 20 7d 0a 09 20 20 20 20 23 20 52 65 6d 6f     }..    # Remo
0e60: 76 65 20 74 68 65 20 6f 72 64 65 72 20 69 6e 66  ve the order inf
0e70: 6f 72 6d 61 74 69 6f 6e 20 6e 6f 77 20 74 68 61  ormation now tha
0e80: 74 20 77 65 20 68 61 76 65 20 69 74 20 69 6e 0a  t we have it in.
0e90: 09 20 20 20 20 23 20 6d 65 6d 6f 72 79 2c 20 73  .    # memory, s
0ea0: 6f 20 74 68 61 74 20 77 65 20 63 61 6e 20 73 61  o that we can sa
0eb0: 76 65 20 69 74 20 6f 6e 63 65 20 6d 6f 72 65 2c  ve it once more,
0ec0: 20 66 6f 72 20 61 6c 6c 0a 09 20 20 20 20 23 20   for all..    # 
0ed0: 63 68 61 6e 67 65 73 65 74 73 2c 20 77 68 69 6c  changesets, whil
0ee0: 65 20 62 72 65 61 6b 69 6e 67 20 74 68 65 20 72  e breaking the r
0ef0: 65 6d 61 69 6e 69 6e 67 20 63 79 63 6c 65 73 2e  emaining cycles.
0f00: 0a 09 20 20 20 20 73 74 61 74 65 20 72 75 6e 20  ..    state run 
0f10: 7b 20 44 45 4c 45 54 45 20 46 52 4f 4d 20 63 73  { DELETE FROM cs
0f20: 6f 72 64 65 72 20 7d 0a 09 7d 0a 09 72 65 74 75  order }..}..retu
0f30: 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 23 20  rn.    }..    # 
0f40: 23 20 23 23 20 23 23 23 20 23 23 23 23 23 20 23  # ## ### ##### #
0f50: 23 23 23 23 23 23 23 20 23 23 23 23 23 23 23 23  ####### ########
0f60: 23 23 23 23 23 0a 0a 20 20 20 20 70 72 6f 63 20  #####..    proc 
0f70: 42 72 65 61 6b 42 61 63 6b 77 61 72 64 42 72 61  BreakBackwardBra
0f80: 6e 63 68 65 73 20 7b 67 72 61 70 68 7d 20 7b 0a  nches {graph} {.
0f90: 09 23 20 57 65 20 67 6f 20 6f 76 65 72 20 61 6c  .# We go over al
0fa0: 6c 20 62 72 61 6e 63 68 20 63 68 61 6e 67 65 73  l branch changes
0fb0: 65 74 73 2c 20 69 2e 65 2e 20 74 68 65 20 63 68  ets, i.e. the ch
0fc0: 61 6e 67 65 73 65 74 73 0a 09 23 20 63 72 65 61  angesets..# crea
0fd0: 74 65 64 20 62 79 20 74 68 65 20 73 79 6d 62 6f  ted by the symbo
0fe0: 6c 73 20 77 68 69 63 68 20 61 72 65 20 74 72 61  ls which are tra
0ff0: 6e 73 6c 61 74 65 64 20 61 73 20 62 72 61 6e 63  nslated as branc
1000: 68 65 73 2c 20 61 6e 64 0a 09 23 20 62 72 65 61  hes, and..# brea
1010: 6b 20 61 6e 79 20 77 68 69 63 68 20 61 72 65 20  k any which are 
1020: 27 62 61 63 6b 77 61 72 64 27 2c 20 77 68 69 63  'backward', whic
1030: 68 20 6d 65 61 6e 73 20 74 68 61 74 20 74 68 65  h means that the
1040: 79 20 68 61 76 65 0a 09 23 20 61 74 20 6c 65 61  y have..# at lea
1050: 73 74 20 6f 6e 65 20 69 6e 63 6f 6d 69 6e 67 20  st one incoming 
1060: 72 65 76 69 73 69 6f 6e 20 63 68 61 6e 67 65 73  revision changes
1070: 65 74 20 77 68 69 63 68 20 69 73 20 63 6f 6d 6d  et which is comm
1080: 69 74 74 65 64 0a 09 23 20 61 66 74 65 72 20 61  itted..# after a
1090: 74 20 6c 65 61 73 74 20 6f 6e 65 20 6f 66 20 74  t least one of t
10a0: 68 65 20 6f 75 74 67 6f 69 6e 67 20 72 65 76 69  he outgoing revi
10b0: 73 69 6f 6e 20 63 68 61 6e 67 65 73 65 74 73 2c  sion changesets,
10c0: 20 70 65 72 0a 09 23 20 74 68 65 20 6f 72 64 65   per..# the orde
10d0: 72 20 63 6f 6d 70 75 74 65 64 20 69 6e 20 70 61  r computed in pa
10e0: 73 73 20 36 2e 20 49 6e 20 22 63 76 73 32 73 76  ss 6. In "cvs2sv
10f0: 6e 22 20 74 68 69 73 20 69 73 20 63 61 6c 6c 65  n" this is calle
1100: 64 0a 09 23 20 22 72 65 74 72 6f 67 72 61 64 65  d..# "retrograde
1110: 22 2e 0a 0a 09 23 20 4e 4f 54 45 3a 20 57 65 20  "....# NOTE: We 
1120: 6d 69 67 68 74 20 62 65 20 61 62 6c 65 20 74 6f  might be able to
1130: 20 75 73 65 20 6f 75 72 20 6b 6e 6f 77 6c 65 64   use our knowled
1140: 67 65 20 74 68 61 74 20 77 65 20 61 72 65 0a 09  ge that we are..
1150: 23 20 6c 6f 6f 6b 69 6e 67 20 61 74 20 61 6c 6c  # looking at all
1160: 20 63 68 61 6e 67 65 73 65 74 73 20 74 6f 20 63   changesets to c
1170: 72 65 61 74 65 20 61 20 73 71 6c 20 77 68 69 63  reate a sql whic
1180: 68 20 73 65 6c 65 63 74 73 20 61 6c 6c 0a 09 23  h selects all..#
1190: 20 74 68 65 20 62 72 61 6e 63 68 20 63 68 61 6e   the branch chan
11a0: 67 65 73 65 74 73 20 66 72 6f 6d 20 74 68 65 20  gesets from the 
11b0: 73 74 61 74 65 20 69 6e 20 6f 6e 65 20 67 6f 20  state in one go 
11c0: 69 6e 73 74 65 61 64 20 6f 66 0a 09 23 20 68 61  instead of..# ha
11d0: 76 69 6e 67 20 74 6f 20 63 68 65 63 6b 20 65 61  ving to check ea
11e0: 63 68 20 63 68 61 6e 67 65 73 65 74 20 73 65 70  ch changeset sep
11f0: 61 72 61 74 65 6c 79 2e 20 43 6f 6e 73 69 64 65  arately. Conside
1200: 72 20 74 68 69 73 0a 09 23 20 6c 61 74 65 72 2c  r this..# later,
1210: 20 67 65 74 20 74 68 65 20 70 61 73 73 20 77 6f   get the pass wo
1220: 72 6b 69 6e 67 20 66 69 72 73 74 2e 0a 09 23 0a  rking first...#.
1230: 09 23 20 4e 4f 54 45 20 32 3a 20 4d 69 67 68 74  .# NOTE 2: Might
1240: 20 77 65 20 65 76 65 6e 20 62 65 20 61 62 6c 65   we even be able
1250: 20 74 6f 20 73 65 6c 65 63 74 20 74 68 65 20 62   to select the b
1260: 61 63 6b 77 61 72 64 20 62 72 61 6e 63 68 0a 09  ackward branch..
1270: 23 20 63 68 61 6e 67 65 73 65 74 73 20 74 6f 6f  # changesets too
1280: 20 3f 0a 0a 09 66 6f 72 65 61 63 68 20 63 73 65   ?...foreach cse
1290: 74 20 5b 24 67 72 61 70 68 20 6e 6f 64 65 73 5d  t [$graph nodes]
12a0: 20 7b 0a 09 20 20 20 20 69 66 20 7b 21 5b 24 63   {..    if {![$c
12b0: 73 65 74 20 69 73 62 72 61 6e 63 68 5d 7d 20 63  set isbranch]} c
12c0: 6f 6e 74 69 6e 75 65 0a 09 20 20 20 20 43 68 65  ontinue..    Che
12d0: 63 6b 41 6e 64 42 72 65 61 6b 42 61 63 6b 77 61  ckAndBreakBackwa
12e0: 72 64 42 72 61 6e 63 68 20 24 67 72 61 70 68 20  rdBranch $graph 
12f0: 24 63 73 65 74 0a 09 7d 0a 09 72 65 74 75 72 6e  $cset..}..return
1300: 0a 20 20 20 20 7d 0a 0a 20 20 20 20 70 72 6f 63  .    }..    proc
1310: 20 43 68 65 63 6b 41 6e 64 42 72 65 61 6b 42 61   CheckAndBreakBa
1320: 63 6b 77 61 72 64 42 72 61 6e 63 68 20 7b 67 72  ckwardBranch {gr
1330: 61 70 68 20 63 73 65 74 7d 20 7b 0a 09 77 68 69  aph cset} {..whi
1340: 6c 65 20 7b 5b 49 73 41 42 61 63 6b 77 61 72 64  le {[IsABackward
1350: 42 72 61 6e 63 68 20 24 67 72 61 70 68 20 24 63  Branch $graph $c
1360: 73 65 74 5d 7d 20 7b 0a 09 20 20 20 20 6c 6f 67  set]} {..    log
1370: 20 77 72 69 74 65 20 35 20 62 72 65 61 6b 61 63   write 5 breakac
1380: 79 63 6c 65 20 22 42 72 65 61 6b 69 6e 67 20 62  ycle "Breaking b
1390: 61 63 6b 77 61 72 64 20 62 72 61 6e 63 68 20 63  ackward branch c
13a0: 68 61 6e 67 65 73 65 74 20 5b 24 63 73 65 74 20  hangeset [$cset 
13b0: 73 74 72 5d 22 0a 0a 09 20 20 20 20 23 20 4b 6e  str]"...    # Kn
13c0: 6f 77 69 6e 67 20 74 68 61 74 20 74 68 65 20 62  owing that the b
13d0: 72 61 6e 63 68 20 69 73 20 62 61 63 6b 77 61 72  ranch is backwar
13e0: 64 20 77 65 20 6e 6f 77 20 6c 6f 6f 6b 20 61 74  d we now look at
13f0: 20 74 68 65 0a 09 20 20 20 20 23 20 69 6e 64 69   the..    # indi
1400: 76 69 64 75 61 6c 20 72 65 76 69 73 69 6f 6e 73  vidual revisions
1410: 20 69 6e 20 74 68 65 20 63 68 61 6e 67 65 73 65   in the changese
1420: 74 20 61 6e 64 20 64 65 74 65 72 6d 69 6e 65 0a  t and determine.
1430: 09 20 20 20 20 23 20 77 68 69 63 68 20 6f 66 20  .    # which of 
1440: 74 68 65 6d 20 61 72 65 20 72 65 73 70 6f 6e 73  them are respons
1450: 69 62 6c 65 20 66 6f 72 20 74 68 65 20 6f 76 65  ible for the ove
1460: 72 6c 61 70 2e 20 54 68 69 73 0a 09 20 20 20 20  rlap. This..    
1470: 23 20 61 6c 6c 6f 77 73 20 75 73 20 74 6f 20 73  # allows us to s
1480: 70 6c 69 74 20 74 68 65 6d 20 69 6e 74 6f 20 74  plit them into t
1490: 77 6f 20 73 65 74 73 2c 20 6f 6e 65 20 6f 66 0a  wo sets, one of.
14a0: 09 20 20 20 20 23 20 6e 6f 6e 2d 6f 76 65 72 6c  .    # non-overl
14b0: 61 70 70 69 6e 67 20 72 65 76 69 73 69 6f 6e 73  apping revisions
14c0: 2c 20 61 6e 64 20 6f 66 20 6f 76 65 72 6c 61 70  , and of overlap
14d0: 70 69 6e 67 20 6f 6e 65 73 2e 20 45 61 63 68 0a  ping ones. Each.
14e0: 09 20 20 20 20 23 20 69 6e 64 75 63 65 73 20 61  .    # induces a
14f0: 20 6e 65 77 20 63 68 61 6e 67 65 73 65 74 2c 20   new changeset, 
1500: 61 6e 64 20 74 68 65 20 73 65 63 6f 6e 64 20 6d  and the second m
1510: 61 79 20 73 74 69 6c 6c 20 62 65 0a 09 20 20 20  ay still be..   
1520: 20 23 20 62 61 63 6b 77 61 72 64 20 61 6e 64 20   # backward and 
1530: 6e 65 65 64 20 66 75 72 74 68 65 72 20 73 70 6c  need further spl
1540: 69 74 74 69 6e 67 2e 20 48 65 6e 63 65 20 74 68  itting. Hence th
1550: 65 20 6c 6f 6f 70 69 6e 67 2e 0a 09 20 20 20 20  e looping...    
1560: 23 0a 09 20 20 20 20 23 20 54 68 65 20 62 6f 72  #..    # The bor
1570: 64 65 72 20 75 73 65 64 20 66 6f 72 20 74 68 65  der used for the
1580: 20 73 70 6c 69 74 20 69 73 20 74 68 65 20 6d 69   split is the mi
1590: 6e 69 6d 61 6c 20 63 6f 6d 6d 69 74 0a 09 20 20  nimal commit..  
15a0: 20 20 23 20 70 6f 73 69 74 69 6f 6e 20 61 6d 6f    # position amo
15b0: 6e 67 20 74 68 65 20 6d 69 6e 69 6d 61 6c 20 73  ng the minimal s
15c0: 75 63 65 73 73 6f 72 20 63 6f 6d 6d 69 74 20 70  ucessor commit p
15d0: 6f 73 69 74 69 6f 6e 73 20 66 6f 72 0a 09 20 20  ositions for..  
15e0: 20 20 23 20 74 68 65 20 72 65 76 69 73 69 6f 6e    # the revision
15f0: 73 20 69 6e 20 74 68 65 20 63 68 61 6e 67 65 73  s in the changes
1600: 65 74 2e 0a 0a 09 20 20 20 20 23 20 4e 6f 74 65  et....    # Note
1610: 20 74 68 61 74 20 69 6e 64 69 76 69 64 75 61 6c   that individual
1620: 20 72 65 76 69 73 69 6f 6e 73 20 6d 61 79 20 6e   revisions may n
1630: 6f 74 20 68 61 76 65 20 72 65 76 69 73 69 6f 6e  ot have revision
1640: 0a 09 20 20 20 20 23 20 63 68 61 6e 67 65 73 65  ..    # changese
1650: 74 73 20 61 72 65 20 70 72 65 64 65 63 65 73 73  ts are predecess
1660: 6f 72 73 20 61 6e 64 2f 6f 72 20 73 75 63 63 65  ors and/or succe
1670: 73 73 6f 72 73 2c 20 6c 65 61 76 69 6e 67 0a 09  ssors, leaving..
1680: 20 20 20 20 23 20 74 68 65 20 6c 69 6d 69 74 73      # the limits
1690: 20 70 61 72 74 69 61 6c 6c 79 20 6f 72 20 63 6f   partially or co
16a0: 6d 70 6c 65 74 65 6c 79 20 75 6e 64 65 66 69 6e  mpletely undefin
16b0: 65 64 2e 0a 0a 09 20 20 20 20 23 20 6c 69 6d 69  ed....    # limi
16c0: 74 73 20 3a 20 64 69 63 74 20 28 72 65 76 69 73  ts : dict (revis
16d0: 69 6f 6e 20 2d 3e 20 6c 69 73 74 20 28 6d 61 78  ion -> list (max
16e0: 20 70 72 65 64 65 63 65 73 73 6f 72 20 63 6f 6d   predecessor com
16f0: 6d 69 74 2c 20 6d 69 6e 20 73 75 63 65 73 73 6f  mit, min sucesso
1700: 72 20 63 6f 6d 6d 69 74 29 29 0a 0a 09 20 20 20  r commit))...   
1710: 20 43 6f 6d 70 75 74 65 4c 69 6d 69 74 73 20 24   ComputeLimits $
1720: 63 73 65 74 20 6c 69 6d 69 74 73 20 62 6f 72 64  cset limits bord
1730: 65 72 0a 0a 09 20 20 20 20 6c 6f 67 20 77 72 69  er...    log wri
1740: 74 65 20 36 20 62 72 65 61 6b 61 63 79 63 6c 65  te 6 breakacycle
1750: 20 22 55 73 69 6e 67 20 63 6f 6d 6d 69 74 20 70   "Using commit p
1760: 6f 73 69 74 69 6f 6e 20 24 62 6f 72 64 65 72 20  osition $border 
1770: 61 73 20 62 6f 72 64 65 72 22 0a 0a 09 20 20 20  as border"...   
1780: 20 23 20 54 68 65 6e 20 77 65 20 73 6f 72 74 20   # Then we sort 
1790: 74 68 65 20 66 69 6c 65 20 6c 65 76 65 6c 20 69  the file level i
17a0: 74 65 6d 73 20 62 61 73 65 64 20 6f 6e 20 74 68  tems based on th
17b0: 65 72 65 20 74 68 65 79 0a 09 20 20 20 20 23 20  ere they..    # 
17c0: 73 69 74 20 72 65 6c 61 74 69 76 65 20 74 6f 20  sit relative to 
17d0: 74 68 65 20 62 6f 72 64 65 72 20 69 6e 74 6f 20  the border into 
17e0: 62 65 66 6f 72 65 20 61 6e 64 20 61 66 74 65 72  before and after
17f0: 20 74 68 65 0a 09 20 20 20 20 23 20 62 6f 72 64   the..    # bord
1800: 65 72 2e 0a 0a 09 20 20 20 20 53 70 6c 69 74 52  er....    SplitR
1810: 65 76 69 73 69 6f 6e 73 20 24 6c 69 6d 69 74 73  evisions $limits
1820: 20 24 62 6f 72 64 65 72 20 6e 6f 72 6d 61 6c 72   $border normalr
1830: 65 76 69 73 69 6f 6e 73 20 62 61 63 6b 77 61 72  evisions backwar
1840: 64 72 65 76 69 73 69 6f 6e 73 0a 0a 09 20 20 20  drevisions...   
1850: 20 73 65 74 20 72 65 70 6c 61 63 65 6d 65 6e 74   set replacement
1860: 73 20 5b 70 72 6f 6a 65 63 74 3a 3a 72 65 76 20  s [project::rev 
1870: 73 70 6c 69 74 20 24 63 73 65 74 20 24 6e 6f 72  split $cset $nor
1880: 6d 61 6c 72 65 76 69 73 69 6f 6e 73 20 24 62 61  malrevisions $ba
1890: 63 6b 77 61 72 64 72 65 76 69 73 69 6f 6e 73 5d  ckwardrevisions]
18a0: 0a 09 20 20 20 20 63 79 63 6c 65 62 72 65 61 6b  ..    cyclebreak
18b0: 65 72 20 72 65 70 6c 61 63 65 20 24 67 72 61 70  er replace $grap
18c0: 68 20 24 63 73 65 74 20 24 72 65 70 6c 61 63 65  h $cset $replace
18d0: 6d 65 6e 74 73 0a 0a 09 20 20 20 20 23 20 41 74  ments...    # At
18e0: 20 6c 61 73 74 20 63 68 65 63 6b 20 74 68 61 74   last check that
18f0: 20 74 68 65 20 6e 6f 72 6d 61 6c 20 66 72 61 6d   the normal fram
1900: 65 6e 74 20 69 73 20 69 6e 64 65 65 64 20 6e 6f  ent is indeed no
1910: 74 0a 09 20 20 20 20 23 20 62 61 63 6b 77 61 72  t..    # backwar
1920: 64 2c 20 61 6e 64 20 69 74 65 72 61 74 65 20 6f  d, and iterate o
1930: 76 65 72 20 74 68 65 20 70 6f 73 73 69 62 6c 79  ver the possibly
1940: 20 73 74 69 6c 6c 20 62 61 63 6b 77 61 72 64 0a   still backward.
1950: 09 20 20 20 20 23 20 73 65 63 6f 6e 64 20 66 72  .    # second fr
1960: 61 67 6d 65 6e 74 2e 0a 0a 09 20 20 20 20 73 74  agment....    st
1970: 72 75 63 74 3a 3a 6c 69 73 74 20 61 73 73 69 67  ruct::list assig
1980: 6e 20 24 72 65 70 6c 61 63 65 6d 65 6e 74 73 20  n $replacements 
1990: 6e 6f 72 6d 61 6c 20 62 61 63 6b 77 61 72 64 0a  normal backward.
19a0: 09 20 20 20 20 69 66 20 7b 5b 49 73 41 42 61 63  .    if {[IsABac
19b0: 6b 77 61 72 64 42 72 61 6e 63 68 20 24 67 72 61  kwardBranch $gra
19c0: 70 68 20 24 6e 6f 72 6d 61 6c 5d 7d 20 7b 20 74  ph $normal]} { t
19d0: 72 6f 75 62 6c 65 20 69 6e 74 65 72 6e 61 6c 20  rouble internal 
19e0: 22 54 68 65 20 6e 6f 72 6d 61 6c 20 66 72 61 67  "The normal frag
19f0: 6d 65 6e 74 20 69 73 20 75 6e 65 78 70 65 63 74  ment is unexpect
1a00: 65 64 6c 79 20 61 20 62 61 63 6b 77 61 72 64 20  edly a backward 
1a10: 62 72 61 6e 63 68 22 20 7d 0a 0a 09 20 20 20 20  branch" }...    
1a20: 73 65 74 20 63 73 65 74 20 24 62 61 63 6b 77 61  set cset $backwa
1a30: 72 64 0a 09 7d 0a 09 72 65 74 75 72 6e 0a 20 20  rd..}..return.  
1a40: 20 20 7d 0a 0a 20 20 20 20 70 72 6f 63 20 49 73    }..    proc Is
1a50: 41 42 61 63 6b 77 61 72 64 42 72 61 6e 63 68 20  ABackwardBranch 
1a60: 7b 64 67 20 63 73 65 74 7d 20 7b 0a 09 23 20 41  {dg cset} {..# A
1a70: 20 62 72 61 6e 63 68 20 69 73 20 22 62 61 63 6b   branch is "back
1a80: 77 61 72 64 22 20 69 66 20 69 74 20 68 61 73 20  ward" if it has 
1a90: 61 74 20 6c 65 61 73 74 20 6f 6e 65 20 69 6e 63  at least one inc
1aa0: 6f 6d 69 6e 67 0a 09 23 20 72 65 76 69 73 69 6f  oming..# revisio
1ab0: 6e 20 63 68 61 6e 67 65 73 65 74 20 77 68 69 63  n changeset whic
1ac0: 68 20 69 73 20 63 6f 6d 6d 69 74 74 65 64 20 61  h is committed a
1ad0: 66 74 65 72 20 61 74 20 6c 65 61 73 74 20 6f 6e  fter at least on
1ae0: 65 20 6f 66 0a 09 23 20 74 68 65 20 6f 75 74 67  e of..# the outg
1af0: 6f 69 6e 67 20 72 65 76 69 73 69 6f 6e 20 63 68  oing revision ch
1b00: 61 6e 67 65 73 65 74 73 2c 20 70 65 72 20 74 68  angesets, per th
1b10: 65 20 6f 72 64 65 72 20 63 6f 6d 70 75 74 65 64  e order computed
1b20: 20 69 6e 0a 09 23 20 70 61 73 73 20 36 2e 0a 0a   in..# pass 6...
1b30: 09 23 20 52 65 70 68 72 61 73 65 64 2c 20 74 68  .# Rephrased, th
1b40: 65 20 6d 61 78 69 6d 61 6c 20 63 6f 6d 6d 69 74  e maximal commit
1b50: 20 70 6f 73 69 74 69 6f 6e 20 66 6f 75 6e 64 20   position found 
1b60: 61 6d 6f 6e 67 20 74 68 65 0a 09 23 20 69 6e 63  among the..# inc
1b70: 6f 6d 69 6e 67 20 72 65 76 69 73 69 6f 6e 20 63  oming revision c
1b80: 68 61 6e 67 65 73 65 74 73 20 69 73 20 6c 61 72  hangesets is lar
1b90: 67 65 72 20 74 68 61 6e 20 74 68 65 20 6d 69 6e  ger than the min
1ba0: 69 6d 61 6c 0a 09 23 20 63 6f 6d 6d 69 74 20 70  imal..# commit p
1bb0: 6f 73 69 74 69 6f 6e 20 66 6f 75 6e 64 20 61 6d  osition found am
1bc0: 6f 6e 67 20 74 68 65 20 6f 75 74 67 6f 69 6e 67  ong the outgoing
1bd0: 20 72 65 76 69 73 69 6f 6e 0a 09 23 20 63 68 61   revision..# cha
1be0: 6e 67 65 73 65 74 73 2e 20 41 73 73 75 6d 69 6e  ngesets. Assumin
1bf0: 67 20 74 68 61 74 20 77 65 20 68 61 76 65 20 62  g that we have b
1c00: 6f 74 68 20 69 6e 63 6f 6d 69 6e 67 20 61 6e 64  oth incoming and
1c10: 20 6f 75 74 67 6f 69 6e 67 0a 09 23 20 72 65 76   outgoing..# rev
1c20: 69 73 69 6f 6e 20 63 68 61 6e 67 65 73 65 74 73  ision changesets
1c30: 2e 0a 0a 09 23 20 54 68 65 20 68 65 6c 70 65 72  ....# The helper
1c40: 20 22 50 6f 73 69 74 69 6f 6e 73 22 20 63 6f 6d   "Positions" com
1c50: 70 75 74 65 73 20 74 68 65 20 73 65 74 20 6f 66  putes the set of
1c60: 20 63 6f 6d 6d 69 74 20 70 6f 73 69 74 69 6f 6e   commit position
1c70: 73 0a 09 23 20 66 6f 72 20 61 20 73 65 74 20 6f  s..# for a set o
1c80: 66 20 63 68 61 6e 67 65 73 65 74 73 2c 20 77 68  f changesets, wh
1c90: 69 63 68 20 63 61 6e 20 62 65 20 61 20 6d 69 78  ich can be a mix
1ca0: 20 6f 66 20 72 65 76 69 73 69 6f 6e 20 61 6e 64   of revision and
1cb0: 0a 09 23 20 73 79 6d 62 6f 6c 20 63 68 61 6e 67  ..# symbol chang
1cc0: 65 73 65 74 73 2e 0a 0a 09 73 65 74 20 70 72 65  esets....set pre
1cd0: 64 65 63 65 73 73 6f 72 73 20 5b 50 6f 73 69 74  decessors [Posit
1ce0: 69 6f 6e 73 20 5b 24 64 67 20 6e 6f 64 65 73 20  ions [$dg nodes 
1cf0: 2d 69 6e 20 20 24 63 73 65 74 5d 5d 0a 09 73 65  -in  $cset]]..se
1d00: 74 20 73 75 63 63 65 73 73 6f 72 73 20 20 20 5b  t successors   [
1d10: 50 6f 73 69 74 69 6f 6e 73 20 5b 24 64 67 20 6e  Positions [$dg n
1d20: 6f 64 65 73 20 2d 6f 75 74 20 24 63 73 65 74 5d  odes -out $cset]
1d30: 5d 0a 0a 09 72 65 74 75 72 6e 20 5b 65 78 70 72  ]...return [expr
1d40: 20 7b 0a 09 09 20 20 20 20 20 20 5b 6c 6c 65 6e   {...      [llen
1d50: 67 74 68 20 24 70 72 65 64 65 63 65 73 73 6f 72  gth $predecessor
1d60: 73 5d 20 26 26 0a 09 09 20 20 20 20 20 20 5b 6c  s] &&...      [l
1d70: 6c 65 6e 67 74 68 20 24 73 75 63 63 65 73 73 6f  length $successo
1d80: 72 73 5d 20 20 20 26 26 0a 09 09 20 20 20 20 20  rs]   &&...     
1d90: 20 28 5b 6d 61 78 20 24 70 72 65 64 65 63 65 73   ([max $predeces
1da0: 73 6f 72 73 5d 20 3e 3d 20 5b 6d 69 6e 20 24 73  sors] >= [min $s
1db0: 75 63 63 65 73 73 6f 72 73 5d 29 0a 09 09 20 20  uccessors])...  
1dc0: 7d 5d 0a 20 20 20 20 7d 0a 0a 20 20 20 20 70 72  }].    }..    pr
1dd0: 6f 63 20 50 6f 73 69 74 69 6f 6e 73 20 7b 63 68  oc Positions {ch
1de0: 61 6e 67 65 73 65 74 73 7d 20 7b 0a 09 23 20 54  angesets} {..# T
1df0: 6f 20 63 6f 6d 70 75 74 65 20 74 68 65 20 73 65  o compute the se
1e00: 74 20 6f 66 20 63 6f 6d 6d 69 74 20 70 6f 73 69  t of commit posi
1e10: 74 69 6f 6e 73 20 66 72 6f 6d 20 74 68 65 20 73  tions from the s
1e20: 65 74 20 6f 66 0a 09 23 20 63 68 61 6e 67 65 73  et of..# changes
1e30: 65 74 73 20 77 65 20 66 69 72 73 74 20 6d 61 70  ets we first map
1e40: 20 65 61 63 68 20 63 68 61 6e 67 65 73 65 74 20   each changeset 
1e50: 74 6f 20 69 74 73 20 70 6f 73 69 74 69 6f 6e 20  to its position 
1e60: 28 2a 29 0a 09 23 20 61 6e 64 20 74 68 65 6e 20  (*)..# and then 
1e70: 66 69 6c 74 65 72 20 6f 75 74 20 74 68 65 20 69  filter out the i
1e80: 6e 76 61 6c 69 64 20 72 65 73 70 6f 6e 73 65 73  nvalid responses
1e90: 20 28 74 68 65 20 65 6d 70 74 79 20 73 74 72 69   (the empty stri
1ea0: 6e 67 29 0a 09 23 20 72 65 74 75 72 6e 65 64 20  ng)..# returned 
1eb0: 62 79 20 74 68 65 20 73 79 6d 62 6f 6c 20 63 68  by the symbol ch
1ec0: 61 6e 67 65 73 65 74 73 2e 0a 09 23 0a 09 23 20  angesets...#..# 
1ed0: 28 2a 29 20 54 68 69 73 20 64 61 74 61 20 77 61  (*) This data wa
1ee0: 73 20 6c 6f 61 64 65 64 20 69 6e 74 6f 20 6d 65  s loaded into me
1ef0: 6d 6f 72 79 20 65 61 72 6c 69 72 20 69 6e 20 74  mory earlir in t
1f00: 68 65 20 70 61 73 73 2c 20 62 79 0a 09 23 20 20  he pass, by..#  
1f10: 20 20 20 4c 6f 61 64 43 6f 6d 6d 69 74 4f 72 64     LoadCommitOrd
1f20: 65 72 2e 0a 0a 09 72 65 74 75 72 6e 20 5b 73 74  er....return [st
1f30: 72 75 63 74 3a 3a 6c 69 73 74 20 66 69 6c 74 65  ruct::list filte
1f40: 72 20 5b 73 74 72 75 63 74 3a 3a 6c 69 73 74 20  r [struct::list 
1f50: 6d 61 70 20 24 63 68 61 6e 67 65 73 65 74 73 20  map $changesets 
1f60: 5c 0a 09 09 09 09 09 20 5b 6d 79 70 72 6f 63 20  \...... [myproc 
1f70: 54 6f 50 6f 73 69 74 69 6f 6e 5d 5d 20 5c 0a 09  ToPosition]] \..
1f80: 09 20 20 20 20 5b 6d 79 70 72 6f 63 20 56 61 6c  .    [myproc Val
1f90: 69 64 50 6f 73 69 74 69 6f 6e 5d 5d 0a 20 20 20  idPosition]].   
1fa0: 20 7d 0a 0a 20 20 20 20 70 72 6f 63 20 54 6f 50   }..    proc ToP
1fb0: 6f 73 69 74 69 6f 6e 20 20 20 20 7b 63 73 65 74  osition    {cset
1fc0: 7d 20 7b 20 24 63 73 65 74 20 70 6f 73 20 7d 0a  } { $cset pos }.
1fd0: 20 20 20 20 70 72 6f 63 20 56 61 6c 69 64 50 6f      proc ValidPo
1fe0: 73 69 74 69 6f 6e 20 7b 70 6f 73 7d 20 20 7b 20  sition {pos}  { 
1ff0: 65 78 70 72 20 7b 24 70 6f 73 20 6e 65 20 22 22  expr {$pos ne ""
2000: 7d 20 7d 0a 0a 20 20 20 20 70 72 6f 63 20 43 6f  } }..    proc Co
2010: 6d 70 75 74 65 4c 69 6d 69 74 73 20 7b 63 73 65  mputeLimits {cse
2020: 74 20 6c 76 20 62 76 7d 20 7b 0a 09 75 70 76 61  t lv bv} {..upva
2030: 72 20 31 20 24 6c 76 20 74 68 65 6c 69 6d 69 74  r 1 $lv thelimit
2040: 73 20 24 62 76 20 62 6f 72 64 65 72 0a 0a 09 23  s $bv border...#
2050: 20 49 6e 69 74 69 61 6c 69 7a 65 20 74 68 65 20   Initialize the 
2060: 62 6f 75 6e 64 61 72 69 65 73 20 66 6f 72 20 61  boundaries for a
2070: 6c 6c 20 72 65 76 69 73 69 6f 6e 73 2e 0a 0a 09  ll revisions....
2080: 61 72 72 61 79 20 73 65 74 20 6c 69 6d 69 74 73  array set limits
2090: 20 7b 7d 0a 09 66 6f 72 65 61 63 68 20 72 65 76   {}..foreach rev
20a0: 69 73 69 6f 6e 20 5b 24 63 73 65 74 20 72 65 76  ision [$cset rev
20b0: 69 73 69 6f 6e 73 5d 20 7b 0a 09 20 20 20 20 73  isions] {..    s
20c0: 65 74 20 6c 69 6d 69 74 73 28 24 72 65 76 69 73  et limits($revis
20d0: 69 6f 6e 29 20 7b 30 20 7b 7d 7d 0a 09 7d 0a 0a  ion) {0 {}}..}..
20e0: 09 23 20 43 6f 6d 70 75 74 65 20 61 6e 64 20 73  .# Compute and s
20f0: 74 6f 72 65 20 74 68 65 20 6d 61 78 69 6d 61 6c  tore the maximal
2100: 20 70 72 65 64 65 63 65 73 73 6f 72 73 20 70 65   predecessors pe
2110: 72 20 72 65 76 69 73 69 6f 6e 0a 0a 09 66 6f 72  r revision...for
2120: 65 61 63 68 20 7b 72 65 76 69 73 69 6f 6e 20 63  each {revision c
2130: 73 65 74 73 7d 20 5b 24 63 73 65 74 20 70 72 65  sets} [$cset pre
2140: 64 65 63 65 73 73 6f 72 6d 61 70 5d 20 7b 0a 09  decessormap] {..
2150: 20 20 20 20 73 65 74 20 73 20 5b 50 6f 73 69 74      set s [Posit
2160: 69 6f 6e 73 20 24 63 73 65 74 73 5d 0a 09 20 20  ions $csets]..  
2170: 20 20 69 66 20 7b 21 5b 6c 6c 65 6e 67 74 68 20    if {![llength 
2180: 24 73 5d 7d 20 63 6f 6e 74 69 6e 75 65 0a 09 20  $s]} continue.. 
2190: 20 20 20 73 65 74 20 6c 69 6d 69 74 73 28 24 72     set limits($r
21a0: 65 76 69 73 69 6f 6e 29 20 5b 6c 72 65 70 6c 61  evision) [lrepla
21b0: 63 65 20 24 6c 69 6d 69 74 73 28 24 72 65 76 69  ce $limits($revi
21c0: 73 69 6f 6e 29 20 30 20 30 20 5b 6d 61 78 20 24  sion) 0 0 [max $
21d0: 73 5d 5d 0a 09 7d 0a 0a 09 23 20 43 6f 6d 70 75  s]]..}...# Compu
21e0: 74 65 20 61 6e 64 20 73 74 6f 72 65 20 74 68 65  te and store the
21f0: 20 6d 69 6e 69 6d 61 6c 20 73 75 63 63 65 73 73   minimal success
2200: 6f 72 73 20 70 65 72 20 72 65 76 69 73 69 6f 6e  ors per revision
2210: 0a 0a 09 66 6f 72 65 61 63 68 20 7b 72 65 76 69  ...foreach {revi
2220: 73 69 6f 6e 20 63 73 65 74 73 7d 20 5b 24 63 73  sion csets} [$cs
2230: 65 74 20 73 75 63 63 65 73 73 6f 72 6d 61 70 5d  et successormap]
2240: 20 7b 0a 09 20 20 20 20 73 65 74 20 73 20 5b 50   {..    set s [P
2250: 6f 73 69 74 69 6f 6e 73 20 24 63 73 65 74 73 5d  ositions $csets]
2260: 0a 09 20 20 20 20 69 66 20 7b 21 5b 6c 6c 65 6e  ..    if {![llen
2270: 67 74 68 20 24 73 5d 7d 20 63 6f 6e 74 69 6e 75  gth $s]} continu
2280: 65 0a 09 20 20 20 20 73 65 74 20 6c 69 6d 69 74  e..    set limit
2290: 73 28 24 72 65 76 69 73 69 6f 6e 29 20 5b 6c 72  s($revision) [lr
22a0: 65 70 6c 61 63 65 20 24 6c 69 6d 69 74 73 28 24  eplace $limits($
22b0: 72 65 76 69 73 69 6f 6e 29 20 31 20 31 20 5b 6d  revision) 1 1 [m
22c0: 69 6e 20 24 73 5d 5d 0a 09 7d 0a 0a 09 23 20 43  in $s]]..}...# C
22d0: 68 65 63 6b 20 74 68 61 74 20 74 68 65 20 6f 72  heck that the or
22e0: 64 65 72 69 6e 67 20 61 74 20 74 68 65 20 66 69  dering at the fi
22f0: 6c 65 20 6c 65 76 65 6c 20 69 73 20 63 6f 72 72  le level is corr
2300: 65 63 74 2e 20 57 65 0a 09 23 20 63 61 6e 6e 6f  ect. We..# canno
2310: 74 20 68 61 76 65 20 62 61 63 6b 77 61 72 64 20  t have backward 
2320: 6f 72 64 65 72 69 6e 67 20 70 65 72 20 72 65 76  ordering per rev
2330: 69 73 69 6f 6e 2c 20 6f 72 20 73 6f 6d 65 74 68  ision, or someth
2340: 69 6e 67 20 69 73 0a 09 23 20 77 72 6f 6e 67 2e  ing is..# wrong.
2350: 0a 0a 09 66 6f 72 65 61 63 68 20 72 65 76 69 73  ...foreach revis
2360: 69 6f 6e 20 5b 61 72 72 61 79 20 6e 61 6d 65 73  ion [array names
2370: 20 6c 69 6d 69 74 73 5d 20 7b 0a 09 20 20 20 20   limits] {..    
2380: 73 74 72 75 63 74 3a 3a 6c 69 73 74 20 61 73 73  struct::list ass
2390: 69 67 6e 20 24 6c 69 6d 69 74 73 28 24 72 65 76  ign $limits($rev
23a0: 69 73 69 6f 6e 29 20 6d 61 78 70 20 6d 69 6e 73  ision) maxp mins
23b0: 0a 09 20 20 20 20 23 20 48 61 6e 64 6c 65 20 6d  ..    # Handle m
23c0: 69 6e 20 73 75 63 63 65 73 73 6f 72 20 70 6f 73  in successor pos
23d0: 69 74 69 6f 6e 20 22 22 20 61 73 20 72 65 70 72  ition "" as repr
23e0: 65 73 65 6e 74 69 6e 67 20 69 6e 66 69 6e 69 74  esenting infinit
23f0: 79 0a 09 20 20 20 20 69 66 20 7b 24 6d 69 6e 73  y..    if {$mins
2400: 20 65 71 20 22 22 7d 20 63 6f 6e 74 69 6e 75 65   eq ""} continue
2410: 0a 09 20 20 20 20 69 66 20 7b 24 6d 61 78 70 20  ..    if {$maxp 
2420: 3c 20 24 6d 69 6e 73 7d 20 63 6f 6e 74 69 6e 75  < $mins} continu
2430: 65 0a 0a 09 20 20 20 20 74 72 6f 75 62 6c 65 20  e...    trouble 
2440: 69 6e 74 65 72 6e 61 6c 20 22 42 72 61 6e 63 68  internal "Branch
2450: 20 72 65 76 69 73 69 6f 6e 20 24 72 65 76 69 73   revision $revis
2460: 69 6f 6e 20 69 73 20 62 61 63 6b 77 61 72 64 20  ion is backward 
2470: 61 74 20 66 69 6c 65 20 6c 65 76 65 6c 20 28 24  at file level ($
2480: 6d 61 78 70 20 3e 3d 20 24 6d 69 6e 73 29 22 0a  maxp >= $mins)".
2490: 09 7d 0a 0a 09 23 20 53 61 76 65 20 74 68 65 20  .}...# Save the 
24a0: 6c 69 6d 69 74 73 20 66 6f 72 20 74 68 65 20 73  limits for the s
24b0: 70 6c 69 74 74 65 72 2c 20 61 6e 64 20 63 6f 6d  plitter, and com
24c0: 70 75 74 65 20 74 68 65 20 62 6f 72 64 65 72 20  pute the border 
24d0: 61 74 0a 09 23 20 77 68 69 63 68 20 74 6f 20 73  at..# which to s
24e0: 70 6c 69 74 20 61 73 20 74 68 65 20 6d 69 6e 69  plit as the mini
24f0: 6d 75 6d 20 6f 66 20 61 6c 6c 20 6d 69 6e 69 6d  mum of all minim
2500: 61 6c 20 73 75 63 63 65 73 73 6f 72 0a 09 23 20  al successor..# 
2510: 70 6f 73 69 74 69 6f 6e 73 2e 0a 0a 09 73 65 74  positions....set
2520: 20 74 68 65 6c 69 6d 69 74 73 20 5b 61 72 72 61   thelimits [arra
2530: 79 20 67 65 74 20 6c 69 6d 69 74 73 5d 0a 09 73  y get limits]..s
2540: 65 74 20 62 6f 72 64 65 72 20 5b 6d 69 6e 20 5b  et border [min [
2550: 73 74 72 75 63 74 3a 3a 6c 69 73 74 20 66 69 6c  struct::list fil
2560: 74 65 72 20 5b 73 74 72 75 63 74 3a 3a 6c 69 73  ter [struct::lis
2570: 74 20 6d 61 70 20 5b 56 61 6c 75 65 73 20 24 74  t map [Values $t
2580: 68 65 6c 69 6d 69 74 73 5d 20 5c 0a 09 09 09 09  helimits] \.....
2590: 09 09 20 20 5b 6d 79 70 72 6f 63 20 4d 69 6e 53  ..  [myproc MinS
25a0: 75 63 63 65 73 73 6f 72 50 6f 73 69 74 69 6f 6e  uccessorPosition
25b0: 5d 5d 20 5c 0a 09 09 09 20 20 20 20 20 5b 6d 79  ]] \....     [my
25c0: 70 72 6f 63 20 56 61 6c 69 64 50 6f 73 69 74 69  proc ValidPositi
25d0: 6f 6e 5d 5d 5d 0a 09 72 65 74 75 72 6e 0a 20 20  on]]]..return.  
25e0: 20 20 7d 0a 0a 20 20 20 20 70 72 6f 63 20 56 61    }..    proc Va
25f0: 6c 75 65 73 20 7b 64 69 63 74 7d 20 7b 0a 09 73  lues {dict} {..s
2600: 65 74 20 72 65 73 20 7b 7d 0a 09 66 6f 72 65 61  et res {}..forea
2610: 63 68 20 7b 6b 20 76 7d 20 24 64 69 63 74 20 7b  ch {k v} $dict {
2620: 20 6c 61 70 70 65 6e 64 20 72 65 73 20 24 76 20   lappend res $v 
2630: 7d 0a 09 72 65 74 75 72 6e 20 24 72 65 73 0a 20  }..return $res. 
2640: 20 20 20 7d 0a 0a 20 20 20 20 70 72 6f 63 20 4d     }..    proc M
2650: 69 6e 53 75 63 63 65 73 73 6f 72 50 6f 73 69 74  inSuccessorPosit
2660: 69 6f 6e 20 7b 69 74 65 6d 7d 20 7b 20 6c 69 6e  ion {item} { lin
2670: 64 65 78 20 24 69 74 65 6d 20 31 20 7d 0a 0a 20  dex $item 1 }.. 
2680: 20 20 20 70 72 6f 63 20 53 70 6c 69 74 52 65 76     proc SplitRev
2690: 69 73 69 6f 6e 73 20 7b 6c 69 6d 69 74 73 20 62  isions {limits b
26a0: 6f 72 64 65 72 20 6e 76 20 62 76 7d 20 7b 0a 09  order nv bv} {..
26b0: 75 70 76 61 72 20 31 20 24 6e 76 20 6e 6f 72 6d  upvar 1 $nv norm
26c0: 61 6c 72 65 76 69 73 69 6f 6e 73 20 24 62 76 20  alrevisions $bv 
26d0: 62 61 63 6b 77 61 72 64 72 65 76 69 73 69 6f 6e  backwardrevision
26e0: 73 0a 0a 09 73 65 74 20 6e 6f 72 6d 61 6c 72 65  s...set normalre
26f0: 76 69 73 69 6f 6e 73 20 20 20 7b 7d 0a 09 73 65  visions   {}..se
2700: 74 20 62 61 63 6b 77 61 72 64 72 65 76 69 73 69  t backwardrevisi
2710: 6f 6e 73 20 7b 7d 0a 0a 09 66 6f 72 65 61 63 68  ons {}...foreach
2720: 20 7b 72 65 76 20 76 7d 20 24 6c 69 6d 69 74 73   {rev v} $limits
2730: 20 7b 0a 09 20 20 20 20 73 74 72 75 63 74 3a 3a   {..    struct::
2740: 6c 69 73 74 20 61 73 73 69 67 6e 20 24 76 20 6d  list assign $v m
2750: 61 78 70 20 6d 69 6e 73 0a 09 20 20 20 20 69 66  axp mins..    if
2760: 20 7b 24 6d 61 78 70 20 3e 3d 20 24 62 6f 72 64   {$maxp >= $bord
2770: 65 72 7d 20 7b 0a 09 09 6c 61 70 70 65 6e 64 20  er} {...lappend 
2780: 62 61 63 6b 77 61 72 64 72 65 76 69 73 69 6f 6e  backwardrevision
2790: 73 20 20 24 72 65 76 0a 09 20 20 20 20 7d 20 65  s  $rev..    } e
27a0: 6c 73 65 20 7b 0a 09 09 6c 61 70 70 65 6e 64 20  lse {...lappend 
27b0: 6e 6f 72 6d 61 6c 72 65 76 69 73 69 6f 6e 73 20  normalrevisions 
27c0: 24 72 65 76 0a 09 20 20 20 20 7d 0a 09 7d 0a 0a  $rev..    }..}..
27d0: 09 69 66 20 7b 21 5b 6c 6c 65 6e 67 74 68 20 24  .if {![llength $
27e0: 6e 6f 72 6d 61 6c 72 65 76 69 73 69 6f 6e 73 5d  normalrevisions]
27f0: 7d 20 20 20 7b 20 74 72 6f 75 62 6c 65 20 69 6e  }   { trouble in
2800: 74 65 72 6e 61 6c 20 22 53 65 74 20 6f 66 20 6e  ternal "Set of n
2810: 6f 72 6d 61 6c 20 72 65 76 69 73 69 6f 6e 73 20  ormal revisions 
2820: 69 73 20 65 6d 70 74 79 22 20 7d 0a 09 69 66 20  is empty" }..if 
2830: 7b 21 5b 6c 6c 65 6e 67 74 68 20 24 62 61 63 6b  {![llength $back
2840: 77 61 72 64 72 65 76 69 73 69 6f 6e 73 5d 7d 20  wardrevisions]} 
2850: 7b 20 74 72 6f 75 62 6c 65 20 69 6e 74 65 72 6e  { trouble intern
2860: 61 6c 20 22 53 65 74 20 6f 66 20 62 61 63 6b 77  al "Set of backw
2870: 61 72 64 20 72 65 76 69 73 69 6f 6e 73 20 69 73  ard revisions is
2880: 20 65 6d 70 74 79 22 20 7d 0a 09 72 65 74 75 72   empty" }..retur
2890: 6e 0a 20 20 20 20 7d 0a 0a 0a 20 20 20 20 23 20  n.    }...    # 
28a0: 23 20 23 23 20 23 23 23 20 23 23 23 23 23 20 23  # ## ### ##### #
28b0: 23 23 23 23 23 23 23 20 23 23 23 23 23 23 23 23  ####### ########
28c0: 23 23 23 23 23 0a 0a 20 20 20 20 70 72 6f 63 20  #####..    proc 
28d0: 4b 65 65 70 4f 72 64 65 72 20 7b 67 72 61 70 68  KeepOrder {graph
28e0: 20 61 74 20 63 73 65 74 7d 20 7b 0a 09 73 65 74   at cset} {..set
28f0: 20 63 69 64 20 5b 24 63 73 65 74 20 69 64 5d 0a   cid [$cset id].
2900: 0a 09 6c 6f 67 20 77 72 69 74 65 20 34 20 62 72  ..log write 4 br
2910: 65 61 6b 61 63 79 63 6c 65 20 22 43 68 61 6e 67  eakacycle "Chang
2920: 65 73 65 74 20 40 20 5b 66 6f 72 6d 61 74 20 24  eset @ [format $
2930: 6d 79 61 74 66 6d 74 20 24 61 74 5d 3a 20 5b 66  myatfmt $at]: [f
2940: 6f 72 6d 61 74 20 24 6d 79 63 73 66 6d 74 20 5b  ormat $mycsfmt [
2950: 24 63 73 65 74 20 73 74 72 5d 5d 20 3c 3c 5b 46  $cset str]] <<[F
2960: 6f 72 6d 61 74 54 52 20 24 67 72 61 70 68 20 24  ormatTR $graph $
2970: 63 73 65 74 5d 3e 3e 22 0a 0a 09 23 20 57 65 20  cset]>>"...# We 
2980: 73 65 65 20 68 65 72 65 20 61 20 6d 69 78 74 75  see here a mixtu
2990: 72 65 20 6f 66 20 73 79 6d 62 6f 6c 20 61 6e 64  re of symbol and
29a0: 20 72 65 76 69 73 69 6f 6e 20 63 68 61 6e 67 65   revision change
29b0: 73 65 74 73 2e 0a 09 23 20 54 68 65 20 73 79 6d  sets...# The sym
29c0: 62 6f 6c 20 63 68 61 6e 67 65 73 65 74 73 20 61  bol changesets a
29d0: 72 65 20 69 67 6e 6f 72 65 64 20 61 73 20 69 72  re ignored as ir
29e0: 72 65 6c 65 76 61 6e 74 2e 0a 0a 09 69 66 20 7b  relevant....if {
29f0: 5b 24 63 73 65 74 20 70 6f 73 5d 20 65 71 20 22  [$cset pos] eq "
2a00: 22 7d 20 72 65 74 75 72 6e 0a 0a 09 23 20 46 6f  "} return...# Fo
2a10: 72 20 74 68 65 20 72 65 76 69 73 69 6f 6e 20 63  r the revision c
2a20: 68 61 6e 67 65 73 65 74 73 20 77 65 20 61 72 65  hangesets we are
2a30: 20 73 75 72 65 20 74 68 61 74 20 74 68 65 79 20   sure that they 
2a40: 61 72 65 0a 09 23 20 63 6f 6e 73 75 6d 65 64 20  are..# consumed 
2a50: 69 6e 20 74 68 65 20 73 61 6d 65 20 6f 72 64 65  in the same orde
2a60: 72 20 61 73 20 67 65 6e 65 72 61 74 65 64 20 62  r as generated b
2a70: 79 20 70 61 73 73 20 37 0a 09 23 20 28 52 65 76  y pass 7..# (Rev
2a80: 54 6f 70 6f 6c 6f 67 69 63 61 6c 53 6f 72 74 29  TopologicalSort)
2a90: 2e 20 50 65 72 20 74 68 65 20 63 6f 64 65 20 69  . Per the code i
2aa0: 6e 20 63 76 73 32 73 76 6e 2e 0a 0a 09 23 20 4e  n cvs2svn....# N
2ab0: 4f 54 45 3a 20 49 20 63 61 6e 6e 6f 74 20 73 65  OTE: I cannot se
2ac0: 65 20 74 68 61 74 2e 20 41 73 73 75 6d 65 20 63  e that. Assume c
2ad0: 73 20 41 20 61 6e 64 20 63 73 20 42 2c 20 6e 6f  s A and cs B, no
2ae0: 74 20 64 65 70 65 6e 64 65 6e 74 0a 09 23 20 20  t dependent..#  
2af0: 20 20 20 20 20 6f 6e 20 65 61 63 68 20 6f 74 68       on each oth
2b00: 65 72 20 69 6e 20 74 68 65 20 73 65 74 20 6f 66  er in the set of
2b10: 20 72 65 76 69 73 69 6f 6e 73 2c 20 6e 6f 77 20   revisions, now 
2b20: 42 20 61 66 74 65 72 20 41 0a 09 23 20 20 20 20  B after A..#    
2b30: 20 20 20 73 69 6d 70 6c 79 20 6d 65 61 6e 73 20     simply means 
2b40: 74 68 61 74 20 42 20 68 61 73 20 61 20 6c 61 74  that B has a lat
2b50: 65 72 20 74 69 6d 65 20 6f 72 20 64 65 70 65 6e  er time or depen
2b60: 64 73 20 6f 6e 0a 09 23 20 20 20 20 20 20 20 73  ds on..#       s
2b70: 6f 6d 65 74 68 69 6e 67 20 77 69 74 20 61 20 6c  omething wit a l
2b80: 61 74 65 72 20 74 69 6d 65 20 74 68 61 6e 20 41  ater time than A
2b90: 2e 20 49 6e 20 74 68 65 20 66 75 6c 6c 20 67 72  . In the full gr
2ba0: 61 70 68 20 41 0a 09 23 20 20 20 20 20 20 20 6d  aph A..#       m
2bb0: 61 79 20 6e 6f 77 20 68 61 76 65 20 64 65 70 65  ay now have depe
2bc0: 6e 64 65 6e 63 69 65 73 20 77 68 69 63 68 20 73  ndencies which s
2bd0: 68 69 66 74 20 69 74 20 61 66 74 65 72 20 42 2c  hift it after B,
2be0: 0a 09 23 20 20 20 20 20 20 20 76 69 6f 6c 61 74  ..#       violat
2bf0: 69 6e 67 20 74 68 65 20 61 62 6f 76 65 20 61 73  ing the above as
2c00: 73 75 6d 70 74 69 6f 6e 2e 0a 09 23 0a 09 23 20  sumption...#..# 
2c10: 57 65 6c 6c 2c 20 69 74 20 73 65 65 6d 73 20 74  Well, it seems t
2c20: 6f 20 77 6f 72 6b 20 69 66 20 49 20 64 6f 20 6e  o work if I do n
2c30: 6f 74 20 6d 61 6b 65 20 74 68 65 20 4e 54 44 42  ot make the NTDB
2c40: 20 72 6f 6f 74 20 61 0a 09 23 20 73 75 63 63 65   root a..# succe
2c50: 73 73 6f 72 20 6f 66 20 74 68 65 20 72 65 67 75  ssor of the regu
2c60: 6c 61 72 20 72 6f 6f 74 2e 20 44 6f 69 6e 67 20  lar root. Doing 
2c70: 73 6f 20 73 65 65 6d 73 20 74 6f 20 74 61 6e 67  so seems to tang
2c80: 6c 65 20 74 68 65 0a 09 23 20 63 68 61 6e 67 65  le the..# change
2c90: 73 65 74 73 20 69 6e 74 6f 20 61 20 6b 6e 6f 74  sets into a knot
2ca0: 73 20 72 65 67 61 72 64 69 6e 67 20 74 69 6d 65  s regarding time
2cb0: 20 76 73 20 64 65 70 65 6e 64 65 6e 63 69 65 73   vs dependencies
2cc0: 20 61 6e 64 0a 09 23 20 74 72 69 67 67 65 72 20   and..# trigger 
2cd0: 73 75 63 68 20 73 68 69 66 74 73 2e 20 4b 65 65  such shifts. Kee
2ce0: 70 69 6e 67 20 74 68 65 73 65 20 74 77 6f 20 72  ping these two r
2cf0: 6f 6f 74 73 20 73 65 70 61 72 61 74 65 20 4f 54  oots separate OT
2d00: 4f 48 0a 09 23 20 64 69 73 61 70 70 65 61 72 73  OH..# disappears
2d10: 20 74 68 65 20 74 61 6e 67 6c 65 2e 20 53 6f 2c   the tangle. So,
2d20: 20 66 6f 72 20 6e 6f 77 20 49 20 61 63 63 65 70   for now I accep
2d30: 74 20 74 68 61 74 2c 20 61 6e 64 20 66 6f 72 0a  t that, and for.
2d40: 09 23 20 70 61 72 61 6e 6f 69 61 20 49 20 61 64  .# paranoia I ad
2d50: 64 20 63 6f 64 65 20 77 68 69 63 68 20 63 68 65  d code which che
2d60: 63 6b 73 20 74 68 69 73 20 61 73 73 75 6d 70 74  cks this assumpt
2d70: 69 6f 6e 2e 0a 0a 09 73 74 72 75 63 74 3a 3a 73  ion....struct::s
2d80: 65 74 20 65 78 63 6c 75 64 65 20 6d 79 72 65 76  et exclude myrev
2d90: 69 73 69 6f 6e 63 68 61 6e 67 65 73 65 74 73 20  isionchangesets 
2da0: 24 63 73 65 74 0a 0a 09 3a 3a 76 61 72 69 61 62  $cset...::variab
2db0: 6c 65 20 6d 79 6c 61 73 74 70 6f 73 0a 09 73 65  le mylastpos..se
2dc0: 74 20 6e 65 77 20 5b 24 63 73 65 74 20 70 6f 73  t new [$cset pos
2dd0: 5d 0a 0a 09 69 66 20 7b 24 6e 65 77 20 21 3d 20  ]...if {$new != 
2de0: 28 24 6d 79 6c 61 73 74 70 6f 73 20 2b 20 31 29  ($mylastpos + 1)
2df0: 7d 20 7b 0a 09 20 20 20 20 69 66 20 7b 24 6d 79  } {..    if {$my
2e00: 6c 61 73 74 70 6f 73 20 3c 20 30 7d 20 7b 0a 09  lastpos < 0} {..
2e10: 09 73 65 74 20 6f 6c 64 20 22 3c 4e 4f 4e 45 3e  .set old "<NONE>
2e20: 22 0a 09 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a  "..    } else {.
2e30: 09 09 3a 3a 76 61 72 69 61 62 6c 65 20 6d 79 63  ..::variable myc
2e40: 73 65 74 0a 09 09 73 65 74 20 6f 6c 64 20 5b 24  set...set old [$
2e50: 6d 79 63 73 65 74 28 24 6d 79 6c 61 73 74 70 6f  mycset($mylastpo
2e60: 73 29 20 73 74 72 5d 40 24 6d 79 6c 61 73 74 70  s) str]@$mylastp
2e70: 6f 73 0a 09 20 20 20 20 7d 0a 0a 09 20 20 20 20  os..    }...    
2e80: 74 72 6f 75 62 6c 65 20 69 6e 74 65 72 6e 61 6c  trouble internal
2e90: 20 22 4f 72 64 65 72 69 6e 67 20 6f 66 20 72 65   "Ordering of re
2ea0: 76 69 73 69 6f 6e 20 63 68 61 6e 67 65 73 65 74  vision changeset
2eb0: 73 20 76 69 6f 6c 61 74 65 64 2c 20 5b 24 63 73  s violated, [$cs
2ec0: 65 74 20 73 74 72 5d 40 24 6e 65 77 20 69 73 20  et str]@$new is 
2ed0: 6e 6f 74 20 69 6d 6d 65 64 69 61 74 65 6c 79 20  not immediately 
2ee0: 61 66 74 65 72 20 24 6f 6c 64 22 0a 09 7d 0a 0a  after $old"..}..
2ef0: 09 73 65 74 20 6d 79 6c 61 73 74 70 6f 73 20 24  .set mylastpos $
2f00: 6e 65 77 0a 09 72 65 74 75 72 6e 0a 20 20 20 20  new..return.    
2f10: 7d 0a 0a 20 20 20 20 70 72 6f 63 20 46 6f 72 6d  }..    proc Form
2f20: 61 74 54 52 20 7b 67 72 61 70 68 20 63 73 65 74  atTR {graph cset
2f30: 7d 20 7b 0a 09 72 65 74 75 72 6e 20 5b 6a 6f 69  } {..return [joi
2f40: 6e 20 5b 73 74 72 75 63 74 3a 3a 6c 69 73 74 20  n [struct::list 
2f50: 6d 61 70 20 5b 24 67 72 61 70 68 20 6e 6f 64 65  map [$graph node
2f60: 20 73 65 74 20 24 63 73 65 74 20 74 69 6d 65 72   set $cset timer
2f70: 61 6e 67 65 5d 20 7b 63 6c 6f 63 6b 20 66 6f 72  ange] {clock for
2f80: 6d 61 74 7d 5d 20 7b 20 2d 2d 20 7d 5d 0a 20 20  mat}] { -- }].  
2f90: 20 20 7d 0a 0a 20 20 20 20 74 79 70 65 76 61 72    }..    typevar
2fa0: 69 61 62 6c 65 20 6d 79 6c 61 73 74 70 6f 73 20  iable mylastpos 
2fb0: 20 20 20 20 20 20 20 20 20 20 20 2d 31 20 3b 20             -1 ; 
2fc0: 23 20 50 6f 73 69 74 69 6f 6e 20 6f 66 20 6c 61  # Position of la
2fd0: 73 74 20 72 65 76 69 73 69 6f 6e 20 63 68 61 6e  st revision chan
2fe0: 67 65 73 65 74 20 73 61 76 65 64 2e 0a 20 20 20  geset saved..   
2ff0: 20 74 79 70 65 76 61 72 69 61 62 6c 65 20 6d 79   typevariable my
3000: 72 65 76 69 73 69 6f 6e 63 68 61 6e 67 65 73 65  revisionchangese
3010: 74 73 20 7b 7d 20 3b 20 23 20 53 65 74 20 6f 66  ts {} ; # Set of
3020: 20 72 65 76 69 73 69 6f 6e 20 63 68 61 6e 67 65   revision change
3030: 73 65 74 73 0a 0a 20 20 20 20 74 79 70 65 76 61  sets..    typeva
3040: 72 69 61 62 6c 65 20 6d 79 61 74 66 6d 74 20 3b  riable myatfmt ;
3050: 20 23 20 46 6f 72 6d 61 74 20 66 6f 72 20 6c 6f   # Format for lo
3060: 67 20 6f 75 74 70 75 74 20 74 6f 20 67 61 69 6e  g output to gain
3070: 20 62 65 74 74 65 72 20 61 6c 69 67 6e 6d 65 6e   better alignmen
3080: 74 20 6f 66 20 74 68 65 20 76 61 72 69 6f 75 73  t of the various
3090: 20 63 6f 6c 75 6d 6e 73 2e 0a 20 20 20 20 74 79   columns..    ty
30a0: 70 65 76 61 72 69 61 62 6c 65 20 6d 79 63 73 66  pevariable mycsf
30b0: 6d 74 20 3b 20 23 20 44 69 74 74 6f 20 66 6f 72  mt ; # Ditto for
30c0: 20 74 68 65 20 63 68 61 6e 67 65 73 65 74 73 2e   the changesets.
30d0: 0a 0a 20 20 20 20 23 20 23 20 23 23 20 23 23 23  ..    # # ## ###
30e0: 20 23 23 23 23 23 20 23 23 23 23 23 23 23 23 20   ##### ######## 
30f0: 23 23 23 23 23 23 23 23 23 23 23 23 23 0a 0a 20  #############.. 
3100: 20 20 20 70 72 6f 63 20 42 72 65 61 6b 43 79 63     proc BreakCyc
3110: 6c 65 20 7b 67 72 61 70 68 7d 20 7b 0a 09 23 20  le {graph} {..# 
3120: 49 6e 20 74 68 69 73 20 70 61 73 73 20 74 68 65  In this pass the
3130: 20 63 79 63 6c 65 20 62 72 65 61 6b 69 6e 67 20   cycle breaking 
3140: 63 61 6e 20 62 65 20 6d 61 64 65 20 61 20 62 69  can be made a bi
3150: 74 20 6d 6f 72 65 0a 09 23 20 74 61 72 67 65 74  t more..# target
3160: 65 64 2c 20 68 65 6e 63 65 20 74 68 69 73 20 63  ed, hence this c
3170: 75 73 74 6f 6d 20 63 61 6c 6c 62 61 63 6b 2e 0a  ustom callback..
3180: 09 23 0a 09 23 20 46 69 72 73 74 20 77 65 20 75  .#..# First we u
3190: 73 65 20 74 68 65 20 64 61 74 61 20 72 65 6d 65  se the data reme
31a0: 6d 62 65 72 65 64 20 62 79 20 27 53 61 76 65 4f  mbered by 'SaveO
31b0: 72 64 65 72 27 2c 20 61 62 6f 75 74 20 74 68 65  rder', about the
31c0: 0a 09 23 20 6c 61 73 74 20 63 6f 6d 6d 69 74 20  ..# last commit 
31d0: 70 6f 73 69 74 69 6f 6e 20 69 74 20 68 61 6e 64  position it hand
31e0: 6c 65 64 2c 20 74 6f 20 64 65 64 75 63 65 20 74  led, to deduce t
31f0: 68 65 20 6e 65 78 74 20 72 65 76 69 73 69 6f 6e  he next revision
3200: 0a 09 23 20 63 68 61 6e 67 65 73 65 74 20 69 74  ..# changeset it
3210: 20 77 6f 75 6c 64 20 65 6e 63 6f 75 6e 74 65 72   would encounter
3220: 2e 20 54 68 65 6e 20 77 65 20 6c 6f 6f 6b 20 66  . Then we look f
3230: 6f 72 20 74 68 65 20 73 68 6f 72 74 65 73 74 0a  or the shortest.
3240: 09 23 20 70 72 65 64 65 63 65 73 73 6f 72 20 70  .# predecessor p
3250: 61 74 68 20 66 72 6f 6d 20 69 74 20 74 6f 20 61  ath from it to a
3260: 6c 6c 20 6f 74 68 65 72 20 72 65 76 69 73 69 6f  ll other revisio
3270: 6e 20 63 68 61 6e 67 65 73 65 74 73 0a 09 23 20  n changesets..# 
3280: 61 6e 64 20 62 72 65 61 6b 20 74 68 69 73 20 70  and break this p
3290: 61 74 68 2e 20 57 69 74 68 6f 75 74 20 73 75 63  ath. Without suc
32a0: 68 20 61 20 70 61 74 68 20 77 65 20 66 61 6c 6c  h a path we fall
32b0: 20 62 61 63 6b 20 74 6f 20 74 68 65 0a 09 23 20   back to the..# 
32c0: 67 65 6e 65 72 69 63 20 63 79 63 6c 65 20 62 72  generic cycle br
32d0: 65 61 6b 65 72 2e 0a 0a 09 3a 3a 76 61 72 69 61  eaker....::varia
32e0: 62 6c 65 20 6d 79 6c 61 73 74 70 6f 73 0a 09 3a  ble mylastpos..:
32f0: 3a 76 61 72 69 61 62 6c 65 20 6d 79 63 73 65 74  :variable mycset
3300: 0a 09 3a 3a 76 61 72 69 61 62 6c 65 20 6d 79 72  ..::variable myr
3310: 65 76 69 73 69 6f 6e 63 68 61 6e 67 65 73 65 74  evisionchangeset
3320: 73 0a 0a 09 73 65 74 20 6e 65 78 74 70 6f 73 20  s...set nextpos 
3330: 5b 65 78 70 72 20 7b 24 6d 79 6c 61 73 74 70 6f  [expr {$mylastpo
3340: 73 20 2b 20 31 7d 5d 0a 09 73 65 74 20 6e 65 78  s + 1}]..set nex
3350: 74 20 20 20 20 24 6d 79 63 73 65 74 28 24 6e 65  t    $mycset($ne
3360: 78 74 70 6f 73 29 0a 0a 09 70 75 74 73 20 22 2a  xtpos)...puts "*
3370: 2a 20 4c 61 73 74 3a 20 24 6d 79 6c 61 73 74 70  * Last: $mylastp
3380: 6f 73 20 3d 20 5b 24 6d 79 63 73 65 74 28 24 6d  os = [$mycset($m
3390: 79 6c 61 73 74 70 6f 73 29 20 73 74 72 5d 20 40  ylastpos) str] @
33a0: 20 5b 24 6d 79 63 73 65 74 28 24 6d 79 6c 61 73   [$mycset($mylas
33b0: 74 70 6f 73 29 20 70 6f 73 5d 22 0a 09 70 75 74  tpos) pos]"..put
33c0: 73 20 22 2a 2a 20 4e 65 78 74 3a 20 24 6e 65 78  s "** Next: $nex
33d0: 74 70 6f 73 20 3d 20 5b 24 6e 65 78 74 20 73 74  tpos = [$next st
33e0: 72 5d 20 40 20 5b 24 6e 65 78 74 20 70 6f 73 5d  r] @ [$next pos]
33f0: 22 0a 0a 09 73 65 74 20 70 61 74 68 20 5b 53 65  "...set path [Se
3400: 61 72 63 68 46 6f 72 50 61 74 68 20 24 67 72 61  archForPath $gra
3410: 70 68 20 24 6e 65 78 74 20 24 6d 79 72 65 76 69  ph $next $myrevi
3420: 73 69 6f 6e 63 68 61 6e 67 65 73 65 74 73 5d 0a  sionchangesets].
3430: 09 69 66 20 7b 5b 6c 6c 65 6e 67 74 68 20 24 70  .if {[llength $p
3440: 61 74 68 5d 7d 20 7b 0a 09 20 20 20 20 63 79 63  ath]} {..    cyc
3450: 6c 65 62 72 65 61 6b 65 72 20 62 72 65 61 6b 2d  lebreaker break-
3460: 73 65 67 6d 65 6e 74 20 24 67 72 61 70 68 20 24  segment $graph $
3470: 70 61 74 68 0a 09 20 20 20 20 72 65 74 75 72 6e  path..    return
3480: 0a 09 7d 0a 0a 09 23 20 57 65 20 77 65 72 65 20  ..}...# We were 
3490: 75 6e 61 62 6c 65 20 74 6f 20 66 69 6e 64 20 61  unable to find a
34a0: 6e 20 6f 72 64 65 72 65 64 20 63 68 61 6e 67 65  n ordered change
34b0: 73 65 74 20 69 6e 20 74 68 65 20 72 65 61 63 68  set in the reach
34c0: 61 62 6c 65 0a 09 23 20 70 72 65 64 65 63 65 73  able..# predeces
34d0: 73 6f 72 73 2c 20 66 61 6c 6c 20 62 61 63 6b 20  sors, fall back 
34e0: 74 6f 20 74 68 65 20 67 65 6e 65 72 69 63 20 63  to the generic c
34f0: 6f 64 65 20 66 6f 72 20 62 72 65 61 6b 69 6e 67  ode for breaking
3500: 20 74 68 65 0a 09 23 20 66 6f 75 6e 64 20 63 79   the..# found cy
3510: 63 6c 65 2e 0a 0a 09 63 79 63 6c 65 62 72 65 61  cle....cyclebrea
3520: 6b 65 72 20 62 72 65 61 6b 20 24 67 72 61 70 68  ker break $graph
3530: 0a 20 20 20 20 7d 0a 0a 20 20 20 20 70 72 6f 63  .    }..    proc
3540: 20 53 65 61 72 63 68 46 6f 72 50 61 74 68 20 7b   SearchForPath {
3550: 67 72 61 70 68 20 6e 20 73 74 6f 70 6e 6f 64 65  graph n stopnode
3560: 73 7d 20 7b 0a 09 23 20 53 65 61 72 63 68 20 66  s} {..# Search f
3570: 6f 72 20 70 61 74 68 73 20 74 6f 20 70 72 65 72  or paths to prer
3580: 65 71 75 69 73 69 74 65 73 20 6f 66 20 4e 2e 0a  equisites of N..
3590: 09 23 0a 09 23 20 54 72 79 20 74 6f 20 66 69 6e  .#..# Try to fin
35a0: 64 20 74 68 65 20 73 68 6f 72 74 65 73 74 20 64  d the shortest d
35b0: 65 70 65 6e 64 65 6e 63 79 20 70 61 74 68 20 74  ependency path t
35c0: 68 61 74 20 63 61 75 73 65 73 20 74 68 65 0a 09  hat causes the..
35d0: 23 20 63 68 61 6e 67 65 73 65 74 20 4e 20 74 6f  # changeset N to
35e0: 20 64 65 70 65 6e 64 20 28 64 69 72 65 63 74 6c   depend (directl
35f0: 79 20 6f 72 20 69 6e 64 69 72 65 63 74 6c 79 29  y or indirectly)
3600: 20 6f 6e 20 6f 6e 65 20 6f 66 20 74 68 65 0a 09   on one of the..
3610: 23 20 63 68 61 6e 67 65 73 65 74 73 20 63 6f 6e  # changesets con
3620: 74 61 69 6e 65 64 20 69 6e 20 53 54 4f 50 4e 4f  tained in STOPNO
3630: 44 45 53 2e 0a 09 23 0a 09 23 20 57 65 20 63 6f  DES...#..# We co
3640: 6e 73 69 64 65 72 20 64 69 72 65 63 74 20 61 6e  nsider direct an
3650: 64 20 69 6e 64 69 72 65 63 74 20 64 65 70 65 6e  d indirect depen
3660: 64 65 6e 63 69 65 73 20 69 6e 20 74 68 65 20 73  dencies in the s
3670: 65 6e 73 65 0a 09 23 20 74 68 61 74 20 74 68 65  ense..# that the
3680: 20 63 68 61 6e 67 65 73 65 74 20 63 61 6e 20 62   changeset can b
3690: 65 20 72 65 61 63 68 65 64 20 62 79 20 66 6f 6c  e reached by fol
36a0: 6c 6f 77 69 6e 67 20 61 20 63 68 61 69 6e 20 6f  lowing a chain o
36b0: 66 0a 09 23 20 70 72 65 64 65 63 65 73 73 6f 72  f..# predecessor
36c0: 20 6e 6f 64 65 73 2e 0a 09 23 0a 09 23 20 57 68   nodes...#..# Wh
36d0: 65 6e 20 6f 6e 65 20 6f 66 20 74 68 65 20 63 73  en one of the cs
36e0: 65 74 73 20 69 6e 20 53 54 4f 50 4e 4f 44 45 53  ets in STOPNODES
36f0: 20 69 73 20 66 6f 75 6e 64 2c 20 77 65 20 74 65   is found, we te
3700: 72 6d 69 6e 61 74 65 0a 09 23 20 74 68 65 20 73  rminate..# the s
3710: 65 61 72 63 68 20 61 6e 64 20 72 65 74 75 72 6e  earch and return
3720: 20 74 68 65 20 70 61 74 68 20 66 72 6f 6d 20 74   the path from t
3730: 68 61 74 20 63 73 65 74 20 74 6f 20 4e 2e 20 20  hat cset to N.  
3740: 49 66 20 6e 6f 0a 09 23 20 70 61 74 68 20 69 73  If no..# path is
3750: 20 66 6f 75 6e 64 20 74 6f 20 61 20 6e 6f 64 65   found to a node
3760: 20 69 6e 20 53 54 4f 50 5f 53 45 54 2c 20 77 65   in STOP_SET, we
3770: 20 72 65 74 75 72 6e 20 74 68 65 20 65 6d 70 74   return the empt
3780: 79 0a 09 23 20 6c 69 73 74 2f 70 61 74 68 2e 0a  y..# list/path..
3790: 0a 09 23 20 54 68 69 73 20 69 73 20 69 6e 20 65  ..# This is in e
37a0: 73 73 65 6e 63 65 20 61 20 6d 75 6c 74 69 2d 64  ssence a multi-d
37b0: 65 73 74 69 6e 61 74 69 6f 6e 20 44 69 6a 6b 73  estination Dijks
37c0: 74 72 61 20 73 74 61 72 74 69 6e 67 20 61 74 0a  tra starting at.
37d0: 09 23 20 4e 20 77 68 69 63 68 20 73 74 6f 70 73  .# N which stops
37e0: 20 77 68 65 6e 20 6f 6e 65 20 6f 66 20 74 68 65   when one of the
37f0: 20 64 65 73 74 69 6e 61 74 69 6f 6e 73 20 69 6e   destinations in
3800: 20 53 54 4f 50 4e 4f 44 45 53 20 68 61 73 0a 09   STOPNODES has..
3810: 23 20 62 65 65 6e 20 72 65 61 63 68 65 64 2c 20  # been reached, 
3820: 74 72 61 76 65 72 73 69 6e 67 20 74 68 65 20 70  traversing the p
3830: 72 65 64 65 63 65 73 73 6f 72 20 61 72 63 73 2e  redecessor arcs.
3840: 0a 0a 09 23 20 52 45 41 43 48 41 42 4c 45 20 3a  ...# REACHABLE :
3850: 3a 20 61 72 72 61 79 20 28 4e 4f 44 45 20 2d 3e  : array (NODE ->
3860: 20 6c 69 73 74 20 28 53 54 45 50 53 2c 20 50 52   list (STEPS, PR
3870: 45 56 49 4f 55 53 29 29 0a 09 23 0a 09 23 20 53  EVIOUS))..#..# S
3880: 65 6d 61 6e 74 69 63 73 3a 20 4e 4f 44 45 20 63  emantics: NODE c
3890: 61 6e 20 62 65 20 72 65 61 63 68 65 64 20 66 72  an be reached fr
38a0: 6f 6d 20 4e 20 69 6e 20 53 54 45 50 53 20 73 74  om N in STEPS st
38b0: 65 70 73 2c 20 61 6e 64 0a 09 23 20 50 52 45 56  eps, and..# PREV
38c0: 49 4f 55 53 20 69 73 20 74 68 65 20 70 72 65 76  IOUS is the prev
38d0: 69 6f 75 73 20 6e 6f 64 65 20 69 6e 20 74 68 65  ious node in the
38e0: 20 70 61 74 68 20 77 68 69 63 68 20 72 65 61 63   path which reac
38f0: 68 65 64 20 69 74 2c 0a 09 23 20 61 6c 6c 6f 77  hed it,..# allow
3900: 69 6e 67 20 75 73 20 61 74 20 74 68 65 20 65 6e  ing us at the en
3910: 64 20 74 6f 20 63 6f 6e 73 74 72 75 63 74 20 74  d to construct t
3920: 68 65 20 66 75 6c 6c 20 70 61 74 68 20 62 79 0a  he full path by.
3930: 09 23 20 66 6f 6c 6c 6f 77 69 6e 67 20 74 68 65  .# following the
3940: 73 65 20 62 61 63 6b 6c 69 6e 6b 73 20 66 72 6f  se backlinks fro
3950: 6d 20 74 68 65 20 66 6f 75 6e 64 20 64 65 73 74  m the found dest
3960: 69 6e 61 74 69 6f 6e 2e 20 4e 20 69 73 0a 09 23  ination. N is..#
3970: 20 6f 6e 6c 79 20 69 6e 63 6c 75 64 65 64 20 61   only included a
3980: 73 20 61 20 6b 65 79 20 69 66 20 74 68 65 72 65  s a key if there
3990: 20 69 73 20 61 20 6c 6f 6f 70 20 6c 65 61 64 69   is a loop leadi
39a0: 6e 67 20 62 61 63 6b 20 74 6f 0a 09 23 20 69 74  ng back to..# it
39b0: 2e 0a 0a 09 23 20 50 45 4e 44 49 4e 47 20 3a 3a  ....# PENDING ::
39c0: 20 6c 69 73 74 20 28 6c 69 73 74 20 28 4e 4f 44   list (list (NOD
39d0: 45 2c 20 53 54 45 50 53 29 29 0a 09 23 0a 09 23  E, STEPS))..#..#
39e0: 20 53 65 6d 61 6e 74 69 63 73 3a 20 41 20 6c 69   Semantics: A li
39f0: 73 74 20 6f 66 20 70 6f 73 73 69 62 69 6c 69 74  st of possibilit
3a00: 69 65 73 20 74 68 61 74 20 73 74 69 6c 6c 20 68  ies that still h
3a10: 61 76 65 20 74 6f 20 62 65 0a 09 23 20 69 6e 76  ave to be..# inv
3a20: 65 73 74 69 67 61 74 65 64 2c 20 77 68 65 72 65  estigated, where
3a30: 20 53 54 45 50 53 20 69 73 20 74 68 65 20 6e 75   STEPS is the nu
3a40: 6d 62 65 72 20 6f 66 20 73 74 65 70 73 20 74 6f  mber of steps to
3a50: 20 67 65 74 20 74 6f 0a 09 23 20 4e 4f 44 45 2e   get to..# NODE.
3a60: 0a 0a 09 61 72 72 61 79 20 73 65 74 20 72 65 61  ...array set rea
3a70: 63 68 61 62 6c 65 20 7b 7d 0a 09 73 65 74 20 70  chable {}..set p
3a80: 65 6e 64 69 6e 67 20 5b 6c 69 73 74 20 5b 6c 69  ending [list [li
3a90: 73 74 20 24 6e 20 30 5d 5d 0a 09 73 65 74 20 61  st $n 0]]..set a
3aa0: 74 20 30 0a 0a 09 70 75 74 73 20 22 2a 2a 20 53  t 0...puts "** S
3ab0: 65 61 72 63 68 69 6e 67 20 73 68 6f 72 74 65 73  earching shortes
3ac0: 74 20 70 61 74 68 20 2e 2e 2e 22 0a 0a 09 77 68  t path ..."...wh
3ad0: 69 6c 65 20 7b 24 61 74 20 3c 20 5b 6c 6c 65 6e  ile {$at < [llen
3ae0: 67 74 68 20 24 70 65 6e 64 69 6e 67 5d 7d 20 7b  gth $pending]} {
3af0: 0a 09 20 20 20 20 73 74 72 75 63 74 3a 3a 6c 69  ..    struct::li
3b00: 73 74 20 61 73 73 69 67 6e 20 5b 6c 69 6e 64 65  st assign [linde
3b10: 78 20 24 70 65 6e 64 69 6e 67 20 24 61 74 5d 20  x $pending $at] 
3b20: 63 75 72 72 65 6e 74 20 73 74 65 70 73 0a 0a 09  current steps...
3b30: 20 20 20 20 23 70 75 74 73 20 22 2a 2a 20 5b 6c      #puts "** [l
3b40: 69 6e 64 65 78 20 24 70 65 6e 64 69 6e 67 20 24  index $pending $
3b50: 61 74 5d 20 2a 2a 20 5b 24 63 75 72 72 65 6e 74  at] ** [$current
3b60: 20 73 74 72 5d 20 2a 2a 22 0a 09 20 20 20 20 69   str] **"..    i
3b70: 6e 63 72 20 61 74 0a 0a 09 20 20 20 20 23 20 50  ncr at...    # P
3b80: 72 6f 63 65 73 73 20 74 68 65 20 70 6f 73 73 69  rocess the possi
3b90: 62 69 6c 69 74 79 2e 20 54 68 69 73 20 69 73 20  bility. This is 
3ba0: 61 20 62 72 65 61 64 74 68 2d 66 69 72 73 74 20  a breadth-first 
3bb0: 74 72 61 76 65 72 73 61 6c 2e 0a 09 20 20 20 20  traversal...    
3bc0: 69 6e 63 72 20 73 74 65 70 73 0a 09 20 20 20 20  incr steps..    
3bd0: 66 6f 72 65 61 63 68 20 70 72 65 20 5b 24 67 72  foreach pre [$gr
3be0: 61 70 68 20 6e 6f 64 65 73 20 2d 69 6e 20 24 63  aph nodes -in $c
3bf0: 75 72 72 65 6e 74 5d 20 7b 0a 09 20 20 20 20 20  urrent] {..     
3c00: 20 20 20 23 20 53 69 6e 63 65 20 74 68 65 20 73     # Since the s
3c10: 65 61 72 63 68 20 69 73 20 62 72 65 61 64 74 68  earch is breadth
3c20: 2d 66 69 72 73 74 2c 20 77 65 20 6f 6e 6c 79 20  -first, we only 
3c30: 68 61 76 65 20 74 6f 20 23 0a 09 20 20 20 20 20  have to #..     
3c40: 20 20 20 23 20 73 65 74 20 6e 6f 64 65 73 20 74     # set nodes t
3c50: 68 61 74 20 64 6f 6e 27 74 20 61 6c 72 65 61 64  hat don't alread
3c60: 79 20 65 78 69 73 74 2e 20 49 66 20 74 68 65 79  y exist. If they
3c70: 20 64 6f 20 74 68 65 79 0a 09 20 20 20 20 20 20   do they..      
3c80: 20 20 23 20 68 61 76 65 20 62 65 65 6e 20 72 65    # have been re
3c90: 61 63 68 65 64 20 61 6c 72 65 61 64 79 20 6f 6e  ached already on
3ca0: 20 61 20 73 68 6f 72 74 65 72 20 70 61 74 68 2e   a shorter path.
3cb0: 0a 0a 09 09 69 66 20 7b 5b 69 6e 66 6f 20 65 78  ....if {[info ex
3cc0: 69 73 74 73 20 72 65 61 63 68 61 62 6c 65 28 24  ists reachable($
3cd0: 70 72 65 29 5d 7d 20 63 6f 6e 74 69 6e 75 65 0a  pre)]} continue.
3ce0: 0a 09 09 73 65 74 20 72 65 61 63 68 61 62 6c 65  ...set reachable
3cf0: 28 24 70 72 65 29 20 5b 6c 69 73 74 20 24 73 74  ($pre) [list $st
3d00: 65 70 73 20 24 63 75 72 72 65 6e 74 5d 0a 09 09  eps $current]...
3d10: 6c 61 70 70 65 6e 64 20 70 65 6e 64 69 6e 67 20  lappend pending 
3d20: 5b 6c 69 73 74 20 24 70 72 65 20 24 73 74 65 70  [list $pre $step
3d30: 73 5d 0a 0a 09 09 23 20 43 6f 6e 74 69 6e 75 65  s]....# Continue
3d40: 20 74 68 65 20 73 65 61 72 63 68 20 77 68 69 6c   the search whil
3d50: 65 20 68 61 76 65 20 6e 6f 74 20 72 65 61 63 68  e have not reach
3d60: 65 64 20 61 6e 79 20 6f 66 0a 09 09 23 20 6f 75  ed any of...# ou
3d70: 72 20 64 65 73 74 69 6e 61 74 69 6f 6e 73 3f 0a  r destinations?.
3d80: 09 09 69 66 20 7b 21 5b 73 74 72 75 63 74 3a 3a  ..if {![struct::
3d90: 73 65 74 20 63 6f 6e 74 61 69 6e 20 24 70 72 65  set contain $pre
3da0: 20 24 73 74 6f 70 6e 6f 64 65 73 5d 7d 20 63 6f   $stopnodes]} co
3db0: 6e 74 69 6e 75 65 0a 0a 09 09 23 20 57 65 20 68  ntinue....# We h
3dc0: 61 76 65 20 61 72 72 69 76 65 64 2c 20 50 52 45  ave arrived, PRE
3dd0: 20 69 73 20 6f 6e 65 20 6f 66 20 74 68 65 20 64   is one of the d
3de0: 65 73 74 69 6e 61 74 69 6f 6e 3b 20 6e 6f 77 0a  estination; now.
3df0: 09 09 23 20 63 6f 6e 73 74 72 75 63 74 20 61 6e  ..# construct an
3e00: 64 20 72 65 74 75 72 6e 20 74 68 65 20 70 61 74  d return the pat
3e10: 68 20 74 6f 20 69 74 20 66 72 6f 6d 20 4e 20 62  h to it from N b
3e20: 79 0a 09 09 23 20 66 6f 6c 6c 6f 77 69 6e 67 20  y...# following 
3e30: 74 68 65 20 62 61 63 6b 6c 69 6e 6b 73 20 69 6e  the backlinks in
3e40: 20 74 68 65 20 73 65 61 72 63 68 20 73 74 61 74   the search stat
3e50: 65 2e 0a 09 09 73 65 74 20 70 61 74 68 20 5b 6c  e....set path [l
3e60: 69 73 74 20 24 70 72 65 5d 0a 09 09 77 68 69 6c  ist $pre]...whil
3e70: 65 20 7b 31 7d 20 7b 0a 09 09 20 20 20 20 73 65  e {1} {...    se
3e80: 74 20 70 72 65 20 5b 6c 69 6e 64 65 78 20 24 72  t pre [lindex $r
3e90: 65 61 63 68 61 62 6c 65 28 24 70 72 65 29 20 31  eachable($pre) 1
3ea0: 5d 0a 09 09 20 20 20 20 69 66 20 7b 24 70 72 65  ]...    if {$pre
3eb0: 20 65 71 20 24 6e 7d 20 62 72 65 61 6b 0a 09 09   eq $n} break...
3ec0: 20 20 20 20 6c 61 70 70 65 6e 64 20 70 61 74 68      lappend path
3ed0: 20 24 70 72 65 0a 09 09 7d 0a 09 09 6c 61 70 70   $pre...}...lapp
3ee0: 65 6e 64 20 70 61 74 68 20 24 6e 0a 0a 09 09 70  end path $n....p
3ef0: 75 74 73 20 22 2a 2a 20 53 65 61 72 63 68 69 6e  uts "** Searchin
3f00: 67 20 73 68 6f 72 74 65 73 74 20 70 61 74 68 20  g shortest path 
3f10: 2e 2e 2e 20 46 6f 75 6e 64 20 28 5b 70 72 6f 6a  ... Found ([proj
3f20: 65 63 74 20 72 65 76 20 73 74 72 6c 69 73 74 20  ect rev strlist 
3f30: 24 70 61 74 68 5d 29 22 0a 09 09 72 65 74 75 72  $path])"...retur
3f40: 6e 20 24 70 61 74 68 0a 09 20 20 20 20 7d 0a 09  n $path..    }..
3f50: 7d 0a 0a 09 70 75 74 73 20 22 2a 2a 20 53 65 61  }...puts "** Sea
3f60: 72 63 68 69 6e 67 20 73 68 6f 72 74 65 73 74 20  rching shortest 
3f70: 70 61 74 68 20 2e 2e 2e 20 4e 6f 74 20 66 6f 75  path ... Not fou
3f80: 6e 64 22 0a 0a 09 23 20 4e 6f 20 70 61 74 68 20  nd"...# No path 
3f90: 66 6f 75 6e 64 2e 0a 09 72 65 74 75 72 6e 20 7b  found...return {
3fa0: 7d 0a 20 20 20 20 7d 0a 0a 20 20 20 20 23 20 23  }.    }..    # #
3fb0: 20 23 23 20 23 23 23 20 23 23 23 23 23 20 23 23   ## ### ##### ##
3fc0: 23 23 23 23 23 23 20 23 23 23 23 23 23 23 23 23  ###### #########
3fd0: 23 23 23 23 0a 0a 20 20 20 20 74 79 70 65 76 61  ####..    typeva
3fe0: 72 69 61 62 6c 65 20 6d 79 63 73 65 74 20 2d 61  riable mycset -a
3ff0: 72 72 61 79 20 7b 7d 20 3b 20 23 20 4d 61 70 20  rray {} ; # Map 
4000: 66 72 6f 6d 20 63 6f 6d 6d 69 74 20 70 6f 73 69  from commit posi
4010: 74 69 6f 6e 73 20 74 6f 20 74 68 65 0a 09 09 09  tions to the....
4020: 09 20 20 20 20 23 20 63 68 61 6e 67 65 73 65 74  .    # changeset
4030: 20 28 6f 62 6a 65 63 74 20 72 65 66 29 20 61 74   (object ref) at
4040: 20 74 68 61 74 0a 09 09 09 09 20 20 20 20 23 20   that.....    # 
4050: 70 6f 73 69 74 69 6f 6e 2e 0a 0a 20 20 20 20 23  position...    #
4060: 20 23 20 23 23 20 23 23 23 20 23 23 23 23 23 20   # ## ### ##### 
4070: 23 23 23 23 23 23 23 23 20 23 23 23 23 23 23 23  ######## #######
4080: 23 23 23 23 23 23 0a 20 20 20 20 23 23 20 43 6f  ######.    ## Co
4090: 6e 66 69 67 75 72 61 74 69 6f 6e 0a 0a 20 20 20  nfiguration..   
40a0: 20 70 72 61 67 6d 61 20 2d 68 61 73 69 6e 73 74   pragma -hasinst
40b0: 61 6e 63 65 73 20 20 20 6e 6f 20 3b 20 23 20 73  ances   no ; # s
40c0: 69 6e 67 6c 65 74 6f 6e 0a 20 20 20 20 70 72 61  ingleton.    pra
40d0: 67 6d 61 20 2d 68 61 73 74 79 70 65 69 6e 66 6f  gma -hastypeinfo
40e0: 20 20 20 20 6e 6f 20 3b 20 23 20 6e 6f 20 69 6e      no ; # no in
40f0: 74 72 6f 73 70 65 63 74 69 6f 6e 0a 20 20 20 20  trospection.    
4100: 70 72 61 67 6d 61 20 2d 68 61 73 74 79 70 65 64  pragma -hastyped
4110: 65 73 74 72 6f 79 20 6e 6f 20 3b 20 23 20 69 6d  estroy no ; # im
4120: 6d 6f 72 74 61 6c 0a 0a 20 20 20 20 23 20 23 20  mortal..    # # 
4130: 23 23 20 23 23 23 20 23 23 23 23 23 20 23 23 23  ## ### ##### ###
4140: 23 23 23 23 23 20 23 23 23 23 23 23 23 23 23 23  ##### ##########
4150: 23 23 23 0a 7d 0a 0a 6e 61 6d 65 73 70 61 63 65  ###.}..namespace
4160: 20 65 76 61 6c 20 3a 3a 76 63 3a 3a 66 6f 73 73   eval ::vc::foss
4170: 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a  il::import::cvs:
4180: 3a 70 61 73 73 20 7b 0a 20 20 20 20 6e 61 6d 65  :pass {.    name
4190: 73 70 61 63 65 20 65 78 70 6f 72 74 20 62 72 65  space export bre
41a0: 61 6b 61 63 79 63 6c 65 0a 20 20 20 20 6e 61 6d  akacycle.    nam
41b0: 65 73 70 61 63 65 20 65 76 61 6c 20 62 72 65 61  espace eval brea
41c0: 6b 61 63 79 63 6c 65 20 7b 0a 09 6e 61 6d 65 73  kacycle {..names
41d0: 70 61 63 65 20 69 6d 70 6f 72 74 20 3a 3a 76 63  pace import ::vc
41e0: 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 74  ::fossil::import
41f0: 3a 3a 63 76 73 3a 3a 63 79 63 6c 65 62 72 65 61  ::cvs::cyclebrea
4200: 6b 65 72 0a 09 6e 61 6d 65 73 70 61 63 65 20 69  ker..namespace i
4210: 6d 70 6f 72 74 20 3a 3a 76 63 3a 3a 66 6f 73 73  mport ::vc::foss
4220: 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a  il::import::cvs:
4230: 3a 72 65 70 6f 73 69 74 6f 72 79 0a 09 6e 61 6d  :repository..nam
4240: 65 73 70 61 63 65 20 69 6d 70 6f 72 74 20 3a 3a  espace import ::
4250: 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f  vc::fossil::impo
4260: 72 74 3a 3a 63 76 73 3a 3a 73 74 61 74 65 0a 09  rt::cvs::state..
4270: 6e 61 6d 65 73 70 61 63 65 20 65 76 61 6c 20 70  namespace eval p
4280: 72 6f 6a 65 63 74 20 7b 0a 09 20 20 20 20 6e 61  roject {..    na
4290: 6d 65 73 70 61 63 65 20 69 6d 70 6f 72 74 20 3a  mespace import :
42a0: 3a 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70  :vc::fossil::imp
42b0: 6f 72 74 3a 3a 63 76 73 3a 3a 70 72 6f 6a 65 63  ort::cvs::projec
42c0: 74 3a 3a 72 65 76 0a 09 7d 0a 09 6e 61 6d 65 73  t::rev..}..names
42d0: 70 61 63 65 20 69 6d 70 6f 72 74 20 3a 3a 76 63  pace import ::vc
42e0: 3a 3a 74 6f 6f 6c 73 3a 3a 6d 69 73 63 3a 3a 2a  ::tools::misc::*
42f0: 0a 09 6e 61 6d 65 73 70 61 63 65 20 69 6d 70 6f  ..namespace impo
4300: 72 74 20 3a 3a 76 63 3a 3a 74 6f 6f 6c 73 3a 3a  rt ::vc::tools::
4310: 74 72 6f 75 62 6c 65 0a 09 6e 61 6d 65 73 70 61  trouble..namespa
4320: 63 65 20 69 6d 70 6f 72 74 20 3a 3a 76 63 3a 3a  ce import ::vc::
4330: 74 6f 6f 6c 73 3a 3a 6c 6f 67 0a 09 6c 6f 67 20  tools::log..log 
4340: 72 65 67 69 73 74 65 72 20 62 72 65 61 6b 61 63  register breakac
4350: 79 63 6c 65 0a 20 20 20 20 7d 0a 7d 0a 0a 23 20  ycle.    }.}..# 
4360: 23 20 23 23 20 23 23 23 20 23 23 23 23 23 20 23  # ## ### ##### #
4370: 23 23 23 23 23 23 23 20 23 23 23 23 23 23 23 23  ####### ########
4380: 23 23 23 23 23 20 23 23 23 23 23 23 23 23 23 23  ##### ##########
4390: 23 23 23 23 23 23 23 23 23 23 23 0a 23 23 20 52  ###########.## R
43a0: 65 61 64 79 0a 0a 70 61 63 6b 61 67 65 20 70 72  eady..package pr
43b0: 6f 76 69 64 65 20 76 63 3a 3a 66 6f 73 73 69 6c  ovide vc::fossil
43c0: 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 70  ::import::cvs::p
43d0: 61 73 73 3a 3a 62 72 65 61 6b 61 63 79 63 6c 65  ass::breakacycle
43e0: 20 31 2e 30 0a 72 65 74 75 72 6e 0a               1.0.return.