Hex Artifact Content
Not logged in

Artifact 2eea5c9c1805c64e46bb3df3c9fd271b96e21cba:

File tools/cvs2fossil/lib/c2f_pbreakacycle.tcl part of check-in [1ea319fb67] - Another helper, textual, write changeset data to stdout. by aku on 2007-11-25 07:44:24.

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 20 0a 0a 73 6e 69 74 3a 3a  ####.## ..snit::
0860: 74 79 70 65 20 3a 3a 76 63 3a 3a 66 6f 73 73 69  type ::vc::fossi
0870: 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a  l::import::cvs::
0880: 70 61 73 73 3a 3a 62 72 65 61 6b 61 63 79 63 6c  pass::breakacycl
0890: 65 20 7b 0a 20 20 20 20 23 20 23 20 23 23 20 23  e {.    # # ## #
08a0: 23 23 20 23 23 23 23 23 20 23 23 23 23 23 23 23  ## ##### #######
08b0: 23 20 23 23 23 23 23 23 23 23 23 23 23 23 23 0a  # #############.
08c0: 20 20 20 20 23 23 20 50 75 62 6c 69 63 20 41 50      ## Public AP
08d0: 49 0a 0a 20 20 20 20 74 79 70 65 6d 65 74 68 6f  I..    typemetho
08e0: 64 20 73 65 74 75 70 20 7b 7d 20 7b 0a 09 23 20  d setup {} {..# 
08f0: 44 65 66 69 6e 65 20 74 68 65 20 6e 61 6d 65 73  Define the names
0900: 20 61 6e 64 20 73 74 72 75 63 74 75 72 65 20 6f   and structure o
0910: 66 20 74 68 65 20 70 65 72 73 69 73 74 65 6e 74  f the persistent
0920: 20 73 74 61 74 65 20 6f 66 0a 09 23 20 74 68 69   state of..# thi
0930: 73 20 70 61 73 73 2e 0a 0a 09 73 74 61 74 65 20  s pass....state 
0940: 72 65 61 64 69 6e 67 20 63 73 6f 72 64 65 72 0a  reading csorder.
0950: 09 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20  .return.    }.. 
0960: 20 20 20 74 79 70 65 6d 65 74 68 6f 64 20 6c 6f     typemethod lo
0970: 61 64 20 7b 7d 20 7b 0a 09 23 20 50 61 73 73 20  ad {} {..# Pass 
0980: 6d 61 6e 61 67 65 72 20 69 6e 74 65 72 66 61 63  manager interfac
0990: 65 2e 20 45 78 65 63 75 74 65 64 20 74 6f 20 6c  e. Executed to l
09a0: 6f 61 64 20 64 61 74 61 20 63 6f 6d 70 75 74 65  oad data compute
09b0: 64 20 62 79 0a 09 23 20 74 68 69 73 20 70 61 73  d by..# this pas
09c0: 73 20 69 6e 74 6f 20 6d 65 6d 6f 72 79 20 77 68  s into memory wh
09d0: 65 6e 20 74 68 69 73 20 70 61 73 73 20 69 73 20  en this pass is 
09e0: 73 6b 69 70 70 65 64 20 69 6e 73 74 65 61 64 20  skipped instead 
09f0: 6f 66 0a 09 23 20 65 78 65 63 75 74 65 64 2e 0a  of..# executed..
0a00: 09 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20  .return.    }.. 
0a10: 20 20 20 74 79 70 65 6d 65 74 68 6f 64 20 72 75     typemethod ru
0a20: 6e 20 7b 7d 20 7b 0a 09 23 20 50 61 73 73 20 6d  n {} {..# Pass m
0a30: 61 6e 61 67 65 72 20 69 6e 74 65 72 66 61 63 65  anager interface
0a40: 2e 20 45 78 65 63 75 74 65 64 20 74 6f 20 70 65  . Executed to pe
0a50: 72 66 6f 72 6d 20 74 68 65 0a 09 23 20 66 75 6e  rform the..# fun
0a60: 63 74 69 6f 6e 61 6c 69 74 79 20 6f 66 20 74 68  ctionality of th
0a70: 65 20 70 61 73 73 2e 0a 0a 09 73 65 74 20 6c 65  e pass....set le
0a80: 6e 20 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68  n [string length
0a90: 20 5b 70 72 6f 6a 65 63 74 3a 3a 72 65 76 20 6e   [project::rev n
0aa0: 75 6d 5d 5d 0a 09 73 65 74 20 6d 79 61 74 66 6d  um]]..set myatfm
0ab0: 74 20 25 24 7b 6c 65 6e 7d 73 0a 09 69 6e 63 72  t %${len}s..incr
0ac0: 20 6c 65 6e 20 36 0a 09 73 65 74 20 6d 79 63 73   len 6..set mycs
0ad0: 66 6d 74 20 25 24 7b 6c 65 6e 7d 73 0a 0a 09 63  fmt %${len}s...c
0ae0: 79 63 6c 65 62 72 65 61 6b 65 72 20 70 72 65 63  yclebreaker prec
0af0: 6d 64 20 20 20 5b 6d 79 70 72 6f 63 20 42 72 65  md   [myproc Bre
0b00: 61 6b 42 61 63 6b 77 61 72 64 42 72 61 6e 63 68  akBackwardBranch
0b10: 65 73 5d 0a 09 63 79 63 6c 65 62 72 65 61 6b 65  es]..cyclebreake
0b20: 72 20 73 61 76 65 63 6d 64 20 20 5b 6d 79 70 72  r savecmd  [mypr
0b30: 6f 63 20 4b 65 65 70 4f 72 64 65 72 5d 0a 09 63  oc KeepOrder]..c
0b40: 79 63 6c 65 62 72 65 61 6b 65 72 20 62 72 65 61  yclebreaker brea
0b50: 6b 63 6d 64 20 5b 6d 79 70 72 6f 63 20 42 72 65  kcmd [myproc Bre
0b60: 61 6b 43 79 63 6c 65 5d 0a 0a 09 73 74 61 74 65  akCycle]...state
0b70: 20 74 72 61 6e 73 61 63 74 69 6f 6e 20 7b 0a 09   transaction {..
0b80: 20 20 20 20 4c 6f 61 64 43 6f 6d 6d 69 74 4f 72      LoadCommitOr
0b90: 64 65 72 0a 09 20 20 20 20 63 79 63 6c 65 62 72  der..    cyclebr
0ba0: 65 61 6b 65 72 20 72 75 6e 20 62 72 65 61 6b 2d  eaker run break-
0bb0: 61 6c 6c 20 5b 6d 79 70 72 6f 63 20 43 68 61 6e  all [myproc Chan
0bc0: 67 65 73 65 74 73 5d 0a 09 7d 0a 0a 09 72 65 70  gesets]..}...rep
0bd0: 6f 73 69 74 6f 72 79 20 70 72 69 6e 74 63 73 65  ository printcse
0be0: 74 73 74 61 74 69 73 74 69 63 73 0a 09 72 65 74  tstatistics..ret
0bf0: 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 74  urn.    }..    t
0c00: 79 70 65 6d 65 74 68 6f 64 20 64 69 73 63 61 72  ypemethod discar
0c10: 64 20 7b 7d 20 7b 0a 09 23 20 50 61 73 73 20 6d  d {} {..# Pass m
0c20: 61 6e 61 67 65 72 20 69 6e 74 65 72 66 61 63 65  anager interface
0c30: 2e 20 45 78 65 63 75 74 65 64 20 66 6f 72 20 61  . Executed for a
0c40: 6c 6c 20 70 61 73 73 65 73 20 61 66 74 65 72 20  ll passes after 
0c50: 74 68 65 0a 09 23 20 72 75 6e 20 70 61 73 73 65  the..# run passe
0c60: 73 2c 20 74 6f 20 72 65 6d 6f 76 65 20 61 6c 6c  s, to remove all
0c70: 20 64 61 74 61 20 6f 66 20 74 68 69 73 20 70 61   data of this pa
0c80: 73 73 20 66 72 6f 6d 20 74 68 65 20 73 74 61 74  ss from the stat
0c90: 65 2c 0a 09 23 20 61 73 20 62 65 69 6e 67 20 6f  e,..# as being o
0ca0: 75 74 20 6f 66 20 64 61 74 65 2e 0a 09 72 65 74  ut of date...ret
0cb0: 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 23  urn.    }..    #
0cc0: 20 23 20 23 23 20 23 23 23 20 23 23 23 23 23 20   # ## ### ##### 
0cd0: 23 23 23 23 23 23 23 23 20 23 23 23 23 23 23 23  ######## #######
0ce0: 23 23 23 23 23 23 0a 20 20 20 20 23 23 20 49 6e  ######.    ## In
0cf0: 74 65 72 6e 61 6c 20 6d 65 74 68 6f 64 73 0a 0a  ternal methods..
0d00: 20 20 20 20 70 72 6f 63 20 43 68 61 6e 67 65 73      proc Changes
0d10: 65 74 73 20 7b 7d 20 7b 20 70 72 6f 6a 65 63 74  ets {} { project
0d20: 3a 3a 72 65 76 20 61 6c 6c 20 7d 0a 0a 20 20 20  ::rev all }..   
0d30: 20 70 72 6f 63 20 4c 6f 61 64 43 6f 6d 6d 69 74   proc LoadCommit
0d40: 4f 72 64 65 72 20 7b 7d 20 7b 0a 09 3a 3a 76 61  Order {} {..::va
0d50: 72 69 61 62 6c 65 20 6d 79 63 73 65 74 0a 09 3a  riable mycset..:
0d60: 3a 76 61 72 69 61 62 6c 65 20 6d 79 72 65 76 69  :variable myrevi
0d70: 73 69 6f 6e 63 68 61 6e 67 65 73 65 74 73 0a 0a  sionchangesets..
0d80: 09 73 74 61 74 65 20 74 72 61 6e 73 61 63 74 69  .state transacti
0d90: 6f 6e 20 7b 0a 09 20 20 20 20 66 6f 72 65 61 63  on {..    foreac
0da0: 68 20 7b 63 69 64 20 70 6f 73 7d 20 5b 73 74 61  h {cid pos} [sta
0db0: 74 65 20 72 75 6e 20 7b 20 53 45 4c 45 43 54 20  te run { SELECT 
0dc0: 63 69 64 2c 20 70 6f 73 20 46 52 4f 4d 20 63 73  cid, pos FROM cs
0dd0: 6f 72 64 65 72 20 7d 5d 20 7b 0a 09 09 73 65 74  order }] {...set
0de0: 20 63 73 65 74 20 5b 70 72 6f 6a 65 63 74 3a 3a   cset [project::
0df0: 72 65 76 20 6f 66 20 24 63 69 64 5d 0a 09 09 24  rev of $cid]...$
0e00: 63 73 65 74 20 73 65 74 70 6f 73 20 24 70 6f 73  cset setpos $pos
0e10: 0a 09 09 73 65 74 20 6d 79 63 73 65 74 28 24 70  ...set mycset($p
0e20: 6f 73 29 20 24 63 73 65 74 0a 09 09 6c 61 70 70  os) $cset...lapp
0e30: 65 6e 64 20 6d 79 72 65 76 69 73 69 6f 6e 63 68  end myrevisionch
0e40: 61 6e 67 65 73 65 74 73 20 24 63 73 65 74 0a 09  angesets $cset..
0e50: 20 20 20 20 7d 0a 09 20 20 20 20 23 20 52 65 6d      }..    # Rem
0e60: 6f 76 65 20 74 68 65 20 6f 72 64 65 72 20 69 6e  ove the order in
0e70: 66 6f 72 6d 61 74 69 6f 6e 20 6e 6f 77 20 74 68  formation now th
0e80: 61 74 20 77 65 20 68 61 76 65 20 69 74 20 69 6e  at we have it in
0e90: 0a 09 20 20 20 20 23 20 6d 65 6d 6f 72 79 2c 20  ..    # memory, 
0ea0: 73 6f 20 74 68 61 74 20 77 65 20 63 61 6e 20 73  so that we can s
0eb0: 61 76 65 20 69 74 20 6f 6e 63 65 20 6d 6f 72 65  ave it once more
0ec0: 2c 20 66 6f 72 20 61 6c 6c 0a 09 20 20 20 20 23  , for all..    #
0ed0: 20 63 68 61 6e 67 65 73 65 74 73 2c 20 77 68 69   changesets, whi
0ee0: 6c 65 20 62 72 65 61 6b 69 6e 67 20 74 68 65 20  le breaking the 
0ef0: 72 65 6d 61 69 6e 69 6e 67 20 63 79 63 6c 65 73  remaining cycles
0f00: 2e 0a 09 20 20 20 20 73 74 61 74 65 20 72 75 6e  ...    state run
0f10: 20 7b 20 44 45 4c 45 54 45 20 46 52 4f 4d 20 63   { DELETE FROM c
0f20: 73 6f 72 64 65 72 20 7d 0a 09 7d 0a 09 72 65 74  sorder }..}..ret
0f30: 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 23  urn.    }..    #
0f40: 20 23 20 23 23 20 23 23 23 20 23 23 23 23 23 20   # ## ### ##### 
0f50: 23 23 23 23 23 23 23 23 20 23 23 23 23 23 23 23  ######## #######
0f60: 23 23 23 23 23 23 0a 0a 20 20 20 20 70 72 6f 63  ######..    proc
0f70: 20 42 72 65 61 6b 42 61 63 6b 77 61 72 64 42 72   BreakBackwardBr
0f80: 61 6e 63 68 65 73 20 7b 67 72 61 70 68 7d 20 7b  anches {graph} {
0f90: 0a 09 23 20 57 65 20 67 6f 20 6f 76 65 72 20 61  ..# We go over a
0fa0: 6c 6c 20 62 72 61 6e 63 68 20 63 68 61 6e 67 65  ll branch change
0fb0: 73 65 74 73 2c 20 69 2e 65 2e 20 74 68 65 20 63  sets, i.e. the c
0fc0: 68 61 6e 67 65 73 65 74 73 0a 09 23 20 63 72 65  hangesets..# cre
0fd0: 61 74 65 64 20 62 79 20 74 68 65 20 73 79 6d 62  ated by the symb
0fe0: 6f 6c 73 20 77 68 69 63 68 20 61 72 65 20 74 72  ols which are tr
0ff0: 61 6e 73 6c 61 74 65 64 20 61 73 20 62 72 61 6e  anslated as bran
1000: 63 68 65 73 2c 20 61 6e 64 0a 09 23 20 62 72 65  ches, and..# bre
1010: 61 6b 20 61 6e 79 20 77 68 69 63 68 20 61 72 65  ak any which are
1020: 20 27 62 61 63 6b 77 61 72 64 27 2c 20 77 68 69   'backward', whi
1030: 63 68 20 6d 65 61 6e 73 20 74 68 61 74 20 74 68  ch means that th
1040: 65 79 20 68 61 76 65 0a 09 23 20 61 74 20 6c 65  ey have..# at le
1050: 61 73 74 20 6f 6e 65 20 69 6e 63 6f 6d 69 6e 67  ast one incoming
1060: 20 72 65 76 69 73 69 6f 6e 20 63 68 61 6e 67 65   revision change
1070: 73 65 74 20 77 68 69 63 68 20 69 73 20 63 6f 6d  set which is com
1080: 6d 69 74 74 65 64 0a 09 23 20 61 66 74 65 72 20  mitted..# after 
1090: 61 74 20 6c 65 61 73 74 20 6f 6e 65 20 6f 66 20  at least one of 
10a0: 74 68 65 20 6f 75 74 67 6f 69 6e 67 20 72 65 76  the outgoing rev
10b0: 69 73 69 6f 6e 20 63 68 61 6e 67 65 73 65 74 73  ision changesets
10c0: 2c 20 70 65 72 0a 09 23 20 74 68 65 20 6f 72 64  , per..# the ord
10d0: 65 72 20 63 6f 6d 70 75 74 65 64 20 69 6e 20 70  er computed in p
10e0: 61 73 73 20 36 2e 20 49 6e 20 22 63 76 73 32 73  ass 6. In "cvs2s
10f0: 76 6e 22 20 74 68 69 73 20 69 73 20 63 61 6c 6c  vn" this is call
1100: 65 64 0a 09 23 20 22 72 65 74 72 6f 67 72 61 64  ed..# "retrograd
1110: 65 22 2e 0a 0a 09 23 20 4e 4f 54 45 3a 20 57 65  e"....# NOTE: We
1120: 20 6d 69 67 68 74 20 62 65 20 61 62 6c 65 20 74   might be able t
1130: 6f 20 75 73 65 20 6f 75 72 20 6b 6e 6f 77 6c 65  o use our knowle
1140: 64 67 65 20 74 68 61 74 20 77 65 20 61 72 65 0a  dge that we are.
1150: 09 23 20 6c 6f 6f 6b 69 6e 67 20 61 74 20 61 6c  .# looking at al
1160: 6c 20 63 68 61 6e 67 65 73 65 74 73 20 74 6f 20  l changesets to 
1170: 63 72 65 61 74 65 20 61 20 73 71 6c 20 77 68 69  create a sql whi
1180: 63 68 20 73 65 6c 65 63 74 73 20 61 6c 6c 0a 09  ch selects all..
1190: 23 20 74 68 65 20 62 72 61 6e 63 68 20 63 68 61  # the branch cha
11a0: 6e 67 65 73 65 74 73 20 66 72 6f 6d 20 74 68 65  ngesets from the
11b0: 20 73 74 61 74 65 20 69 6e 20 6f 6e 65 20 67 6f   state in one go
11c0: 20 69 6e 73 74 65 61 64 20 6f 66 0a 09 23 20 68   instead of..# h
11d0: 61 76 69 6e 67 20 74 6f 20 63 68 65 63 6b 20 65  aving to check e
11e0: 61 63 68 20 63 68 61 6e 67 65 73 65 74 20 73 65  ach changeset se
11f0: 70 61 72 61 74 65 6c 79 2e 20 43 6f 6e 73 69 64  parately. Consid
1200: 65 72 20 74 68 69 73 0a 09 23 20 6c 61 74 65 72  er this..# later
1210: 2c 20 67 65 74 20 74 68 65 20 70 61 73 73 20 77  , get the pass w
1220: 6f 72 6b 69 6e 67 20 66 69 72 73 74 2e 0a 09 23  orking first...#
1230: 0a 09 23 20 4e 4f 54 45 20 32 3a 20 4d 69 67 68  ..# NOTE 2: Migh
1240: 74 20 77 65 20 65 76 65 6e 20 62 65 20 61 62 6c  t we even be abl
1250: 65 20 74 6f 20 73 65 6c 65 63 74 20 74 68 65 20  e to select the 
1260: 62 61 63 6b 77 61 72 64 20 62 72 61 6e 63 68 0a  backward branch.
1270: 09 23 20 63 68 61 6e 67 65 73 65 74 73 20 74 6f  .# changesets to
1280: 6f 20 3f 0a 0a 09 66 6f 72 65 61 63 68 20 63 73  o ?...foreach cs
1290: 65 74 20 5b 24 67 72 61 70 68 20 6e 6f 64 65 73  et [$graph nodes
12a0: 5d 20 7b 0a 09 20 20 20 20 69 66 20 7b 21 5b 24  ] {..    if {![$
12b0: 63 73 65 74 20 69 73 62 72 61 6e 63 68 5d 7d 20  cset isbranch]} 
12c0: 63 6f 6e 74 69 6e 75 65 0a 09 20 20 20 20 43 68  continue..    Ch
12d0: 65 63 6b 41 6e 64 42 72 65 61 6b 42 61 63 6b 77  eckAndBreakBackw
12e0: 61 72 64 42 72 61 6e 63 68 20 24 67 72 61 70 68  ardBranch $graph
12f0: 20 24 63 73 65 74 0a 09 7d 0a 09 72 65 74 75 72   $cset..}..retur
1300: 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 70 72 6f  n.    }..    pro
1310: 63 20 43 68 65 63 6b 41 6e 64 42 72 65 61 6b 42  c CheckAndBreakB
1320: 61 63 6b 77 61 72 64 42 72 61 6e 63 68 20 7b 67  ackwardBranch {g
1330: 72 61 70 68 20 63 73 65 74 7d 20 7b 0a 09 77 68  raph cset} {..wh
1340: 69 6c 65 20 7b 5b 49 73 41 42 61 63 6b 77 61 72  ile {[IsABackwar
1350: 64 42 72 61 6e 63 68 20 24 67 72 61 70 68 20 24  dBranch $graph $
1360: 63 73 65 74 5d 7d 20 7b 0a 09 20 20 20 20 6c 6f  cset]} {..    lo
1370: 67 20 77 72 69 74 65 20 35 20 62 72 65 61 6b 61  g write 5 breaka
1380: 63 79 63 6c 65 20 22 42 72 65 61 6b 69 6e 67 20  cycle "Breaking 
1390: 62 61 63 6b 77 61 72 64 20 62 72 61 6e 63 68 20  backward branch 
13a0: 63 68 61 6e 67 65 73 65 74 20 5b 24 63 73 65 74  changeset [$cset
13b0: 20 73 74 72 5d 22 0a 0a 09 20 20 20 20 23 20 4b   str]"...    # K
13c0: 6e 6f 77 69 6e 67 20 74 68 61 74 20 74 68 65 20  nowing that the 
13d0: 62 72 61 6e 63 68 20 69 73 20 62 61 63 6b 77 61  branch is backwa
13e0: 72 64 20 77 65 20 6e 6f 77 20 6c 6f 6f 6b 20 61  rd we now look a
13f0: 74 20 74 68 65 0a 09 20 20 20 20 23 20 69 6e 64  t the..    # ind
1400: 69 76 69 64 75 61 6c 20 72 65 76 69 73 69 6f 6e  ividual revision
1410: 73 20 69 6e 20 74 68 65 20 63 68 61 6e 67 65 73  s in the changes
1420: 65 74 20 61 6e 64 20 64 65 74 65 72 6d 69 6e 65  et and determine
1430: 0a 09 20 20 20 20 23 20 77 68 69 63 68 20 6f 66  ..    # which of
1440: 20 74 68 65 6d 20 61 72 65 20 72 65 73 70 6f 6e   them are respon
1450: 73 69 62 6c 65 20 66 6f 72 20 74 68 65 20 6f 76  sible for the ov
1460: 65 72 6c 61 70 2e 20 54 68 69 73 0a 09 20 20 20  erlap. This..   
1470: 20 23 20 61 6c 6c 6f 77 73 20 75 73 20 74 6f 20   # allows us to 
1480: 73 70 6c 69 74 20 74 68 65 6d 20 69 6e 74 6f 20  split them into 
1490: 74 77 6f 20 73 65 74 73 2c 20 6f 6e 65 20 6f 66  two sets, one of
14a0: 0a 09 20 20 20 20 23 20 6e 6f 6e 2d 6f 76 65 72  ..    # non-over
14b0: 6c 61 70 70 69 6e 67 20 72 65 76 69 73 69 6f 6e  lapping revision
14c0: 73 2c 20 61 6e 64 20 6f 66 20 6f 76 65 72 6c 61  s, and of overla
14d0: 70 70 69 6e 67 20 6f 6e 65 73 2e 20 45 61 63 68  pping ones. Each
14e0: 0a 09 20 20 20 20 23 20 69 6e 64 75 63 65 73 20  ..    # induces 
14f0: 61 20 6e 65 77 20 63 68 61 6e 67 65 73 65 74 2c  a new changeset,
1500: 20 61 6e 64 20 74 68 65 20 73 65 63 6f 6e 64 20   and the second 
1510: 6d 61 79 20 73 74 69 6c 6c 20 62 65 0a 09 20 20  may still be..  
1520: 20 20 23 20 62 61 63 6b 77 61 72 64 20 61 6e 64    # backward and
1530: 20 6e 65 65 64 20 66 75 72 74 68 65 72 20 73 70   need further sp
1540: 6c 69 74 74 69 6e 67 2e 20 48 65 6e 63 65 20 74  litting. Hence t
1550: 68 65 20 6c 6f 6f 70 69 6e 67 2e 0a 09 20 20 20  he looping...   
1560: 20 23 0a 09 20 20 20 20 23 20 54 68 65 20 62 6f   #..    # The bo
1570: 72 64 65 72 20 75 73 65 64 20 66 6f 72 20 74 68  rder used for th
1580: 65 20 73 70 6c 69 74 20 69 73 20 74 68 65 20 6d  e split is the m
1590: 69 6e 69 6d 61 6c 20 63 6f 6d 6d 69 74 0a 09 20  inimal commit.. 
15a0: 20 20 20 23 20 70 6f 73 69 74 69 6f 6e 20 61 6d     # position am
15b0: 6f 6e 67 20 74 68 65 20 6d 69 6e 69 6d 61 6c 20  ong the minimal 
15c0: 73 75 63 65 73 73 6f 72 20 63 6f 6d 6d 69 74 20  sucessor commit 
15d0: 70 6f 73 69 74 69 6f 6e 73 20 66 6f 72 0a 09 20  positions for.. 
15e0: 20 20 20 23 20 74 68 65 20 72 65 76 69 73 69 6f     # the revisio
15f0: 6e 73 20 69 6e 20 74 68 65 20 63 68 61 6e 67 65  ns in the change
1600: 73 65 74 2e 0a 0a 09 20 20 20 20 23 20 4e 6f 74  set....    # Not
1610: 65 20 74 68 61 74 20 69 6e 64 69 76 69 64 75 61  e that individua
1620: 6c 20 72 65 76 69 73 69 6f 6e 73 20 6d 61 79 20  l revisions may 
1630: 6e 6f 74 20 68 61 76 65 20 72 65 76 69 73 69 6f  not have revisio
1640: 6e 0a 09 20 20 20 20 23 20 63 68 61 6e 67 65 73  n..    # changes
1650: 65 74 73 20 61 72 65 20 70 72 65 64 65 63 65 73  ets are predeces
1660: 73 6f 72 73 20 61 6e 64 2f 6f 72 20 73 75 63 63  sors and/or succ
1670: 65 73 73 6f 72 73 2c 20 6c 65 61 76 69 6e 67 0a  essors, leaving.
1680: 09 20 20 20 20 23 20 74 68 65 20 6c 69 6d 69 74  .    # the limit
1690: 73 20 70 61 72 74 69 61 6c 6c 79 20 6f 72 20 63  s partially or c
16a0: 6f 6d 70 6c 65 74 65 6c 79 20 75 6e 64 65 66 69  ompletely undefi
16b0: 6e 65 64 2e 0a 0a 09 20 20 20 20 23 20 6c 69 6d  ned....    # lim
16c0: 69 74 73 20 3a 20 64 69 63 74 20 28 72 65 76 69  its : dict (revi
16d0: 73 69 6f 6e 20 2d 3e 20 6c 69 73 74 20 28 6d 61  sion -> list (ma
16e0: 78 20 70 72 65 64 65 63 65 73 73 6f 72 20 63 6f  x predecessor co
16f0: 6d 6d 69 74 2c 20 6d 69 6e 20 73 75 63 65 73 73  mmit, min sucess
1700: 6f 72 20 63 6f 6d 6d 69 74 29 29 0a 0a 09 20 20  or commit))...  
1710: 20 20 43 6f 6d 70 75 74 65 4c 69 6d 69 74 73 20    ComputeLimits 
1720: 24 63 73 65 74 20 6c 69 6d 69 74 73 20 62 6f 72  $cset limits bor
1730: 64 65 72 0a 0a 09 20 20 20 20 6c 6f 67 20 77 72  der...    log wr
1740: 69 74 65 20 36 20 62 72 65 61 6b 61 63 79 63 6c  ite 6 breakacycl
1750: 65 20 22 55 73 69 6e 67 20 63 6f 6d 6d 69 74 20  e "Using commit 
1760: 70 6f 73 69 74 69 6f 6e 20 24 62 6f 72 64 65 72  position $border
1770: 20 61 73 20 62 6f 72 64 65 72 22 0a 0a 09 20 20   as border"...  
1780: 20 20 23 20 54 68 65 6e 20 77 65 20 73 6f 72 74    # Then we sort
1790: 20 74 68 65 20 66 69 6c 65 20 6c 65 76 65 6c 20   the file level 
17a0: 69 74 65 6d 73 20 62 61 73 65 64 20 6f 6e 20 74  items based on t
17b0: 68 65 72 65 20 74 68 65 79 0a 09 20 20 20 20 23  here they..    #
17c0: 20 73 69 74 20 72 65 6c 61 74 69 76 65 20 74 6f   sit relative to
17d0: 20 74 68 65 20 62 6f 72 64 65 72 20 69 6e 74 6f   the border into
17e0: 20 62 65 66 6f 72 65 20 61 6e 64 20 61 66 74 65   before and afte
17f0: 72 20 74 68 65 0a 09 20 20 20 20 23 20 62 6f 72  r the..    # bor
1800: 64 65 72 2e 0a 0a 09 20 20 20 20 53 70 6c 69 74  der....    Split
1810: 52 65 76 69 73 69 6f 6e 73 20 24 6c 69 6d 69 74  Revisions $limit
1820: 73 20 24 62 6f 72 64 65 72 20 6e 6f 72 6d 61 6c  s $border normal
1830: 72 65 76 69 73 69 6f 6e 73 20 62 61 63 6b 77 61  revisions backwa
1840: 72 64 72 65 76 69 73 69 6f 6e 73 0a 0a 09 20 20  rdrevisions...  
1850: 20 20 73 65 74 20 72 65 70 6c 61 63 65 6d 65 6e    set replacemen
1860: 74 73 20 5b 70 72 6f 6a 65 63 74 3a 3a 72 65 76  ts [project::rev
1870: 20 73 70 6c 69 74 20 24 63 73 65 74 20 24 6e 6f   split $cset $no
1880: 72 6d 61 6c 72 65 76 69 73 69 6f 6e 73 20 24 62  rmalrevisions $b
1890: 61 63 6b 77 61 72 64 72 65 76 69 73 69 6f 6e 73  ackwardrevisions
18a0: 5d 0a 09 20 20 20 20 63 79 63 6c 65 62 72 65 61  ]..    cyclebrea
18b0: 6b 65 72 20 72 65 70 6c 61 63 65 20 24 67 72 61  ker replace $gra
18c0: 70 68 20 24 63 73 65 74 20 24 72 65 70 6c 61 63  ph $cset $replac
18d0: 65 6d 65 6e 74 73 0a 0a 09 20 20 20 20 23 20 41  ements...    # A
18e0: 74 20 6c 61 73 74 20 63 68 65 63 6b 20 74 68 61  t last check tha
18f0: 74 20 74 68 65 20 6e 6f 72 6d 61 6c 20 66 72 61  t the normal fra
1900: 6d 65 6e 74 20 69 73 20 69 6e 64 65 65 64 20 6e  ment is indeed n
1910: 6f 74 0a 09 20 20 20 20 23 20 62 61 63 6b 77 61  ot..    # backwa
1920: 72 64 2c 20 61 6e 64 20 69 74 65 72 61 74 65 20  rd, and iterate 
1930: 6f 76 65 72 20 74 68 65 20 70 6f 73 73 69 62 6c  over the possibl
1940: 79 20 73 74 69 6c 6c 20 62 61 63 6b 77 61 72 64  y still backward
1950: 0a 09 20 20 20 20 23 20 73 65 63 6f 6e 64 20 66  ..    # second f
1960: 72 61 67 6d 65 6e 74 2e 0a 0a 09 20 20 20 20 73  ragment....    s
1970: 74 72 75 63 74 3a 3a 6c 69 73 74 20 61 73 73 69  truct::list assi
1980: 67 6e 20 24 72 65 70 6c 61 63 65 6d 65 6e 74 73  gn $replacements
1990: 20 6e 6f 72 6d 61 6c 20 62 61 63 6b 77 61 72 64   normal backward
19a0: 0a 09 20 20 20 20 69 66 20 7b 5b 49 73 41 42 61  ..    if {[IsABa
19b0: 63 6b 77 61 72 64 42 72 61 6e 63 68 20 24 67 72  ckwardBranch $gr
19c0: 61 70 68 20 24 6e 6f 72 6d 61 6c 5d 7d 20 7b 20  aph $normal]} { 
19d0: 74 72 6f 75 62 6c 65 20 69 6e 74 65 72 6e 61 6c  trouble internal
19e0: 20 22 54 68 65 20 6e 6f 72 6d 61 6c 20 66 72 61   "The normal fra
19f0: 67 6d 65 6e 74 20 69 73 20 75 6e 65 78 70 65 63  gment is unexpec
1a00: 74 65 64 6c 79 20 61 20 62 61 63 6b 77 61 72 64  tedly a backward
1a10: 20 62 72 61 6e 63 68 22 20 7d 0a 0a 09 20 20 20   branch" }...   
1a20: 20 73 65 74 20 63 73 65 74 20 24 62 61 63 6b 77   set cset $backw
1a30: 61 72 64 0a 09 7d 0a 09 72 65 74 75 72 6e 0a 20  ard..}..return. 
1a40: 20 20 20 7d 0a 0a 20 20 20 20 70 72 6f 63 20 49     }..    proc I
1a50: 73 41 42 61 63 6b 77 61 72 64 42 72 61 6e 63 68  sABackwardBranch
1a60: 20 7b 64 67 20 63 73 65 74 7d 20 7b 0a 09 23 20   {dg cset} {..# 
1a70: 41 20 62 72 61 6e 63 68 20 69 73 20 22 62 61 63  A branch is "bac
1a80: 6b 77 61 72 64 22 20 69 66 20 69 74 20 68 61 73  kward" if it has
1a90: 20 61 74 20 6c 65 61 73 74 20 6f 6e 65 20 69 6e   at least one in
1aa0: 63 6f 6d 69 6e 67 0a 09 23 20 72 65 76 69 73 69  coming..# revisi
1ab0: 6f 6e 20 63 68 61 6e 67 65 73 65 74 20 77 68 69  on changeset whi
1ac0: 63 68 20 69 73 20 63 6f 6d 6d 69 74 74 65 64 20  ch is committed 
1ad0: 61 66 74 65 72 20 61 74 20 6c 65 61 73 74 20 6f  after at least o
1ae0: 6e 65 20 6f 66 0a 09 23 20 74 68 65 20 6f 75 74  ne of..# the out
1af0: 67 6f 69 6e 67 20 72 65 76 69 73 69 6f 6e 20 63  going revision c
1b00: 68 61 6e 67 65 73 65 74 73 2c 20 70 65 72 20 74  hangesets, per t
1b10: 68 65 20 6f 72 64 65 72 20 63 6f 6d 70 75 74 65  he order compute
1b20: 64 20 69 6e 0a 09 23 20 70 61 73 73 20 36 2e 0a  d in..# pass 6..
1b30: 0a 09 23 20 52 65 70 68 72 61 73 65 64 2c 20 74  ..# Rephrased, t
1b40: 68 65 20 6d 61 78 69 6d 61 6c 20 63 6f 6d 6d 69  he maximal commi
1b50: 74 20 70 6f 73 69 74 69 6f 6e 20 66 6f 75 6e 64  t position found
1b60: 20 61 6d 6f 6e 67 20 74 68 65 0a 09 23 20 69 6e   among the..# in
1b70: 63 6f 6d 69 6e 67 20 72 65 76 69 73 69 6f 6e 20  coming revision 
1b80: 63 68 61 6e 67 65 73 65 74 73 20 69 73 20 6c 61  changesets is la
1b90: 72 67 65 72 20 74 68 61 6e 20 74 68 65 20 6d 69  rger than the mi
1ba0: 6e 69 6d 61 6c 0a 09 23 20 63 6f 6d 6d 69 74 20  nimal..# commit 
1bb0: 70 6f 73 69 74 69 6f 6e 20 66 6f 75 6e 64 20 61  position found a
1bc0: 6d 6f 6e 67 20 74 68 65 20 6f 75 74 67 6f 69 6e  mong the outgoin
1bd0: 67 20 72 65 76 69 73 69 6f 6e 0a 09 23 20 63 68  g revision..# ch
1be0: 61 6e 67 65 73 65 74 73 2e 20 41 73 73 75 6d 69  angesets. Assumi
1bf0: 6e 67 20 74 68 61 74 20 77 65 20 68 61 76 65 20  ng that we have 
1c00: 62 6f 74 68 20 69 6e 63 6f 6d 69 6e 67 20 61 6e  both incoming an
1c10: 64 20 6f 75 74 67 6f 69 6e 67 0a 09 23 20 72 65  d outgoing..# re
1c20: 76 69 73 69 6f 6e 20 63 68 61 6e 67 65 73 65 74  vision changeset
1c30: 73 2e 0a 0a 09 23 20 54 68 65 20 68 65 6c 70 65  s....# The helpe
1c40: 72 20 22 50 6f 73 69 74 69 6f 6e 73 22 20 63 6f  r "Positions" co
1c50: 6d 70 75 74 65 73 20 74 68 65 20 73 65 74 20 6f  mputes the set o
1c60: 66 20 63 6f 6d 6d 69 74 20 70 6f 73 69 74 69 6f  f commit positio
1c70: 6e 73 0a 09 23 20 66 6f 72 20 61 20 73 65 74 20  ns..# for a set 
1c80: 6f 66 20 63 68 61 6e 67 65 73 65 74 73 2c 20 77  of changesets, w
1c90: 68 69 63 68 20 63 61 6e 20 62 65 20 61 20 6d 69  hich can be a mi
1ca0: 78 20 6f 66 20 72 65 76 69 73 69 6f 6e 20 61 6e  x of revision an
1cb0: 64 0a 09 23 20 73 79 6d 62 6f 6c 20 63 68 61 6e  d..# symbol chan
1cc0: 67 65 73 65 74 73 2e 0a 0a 09 73 65 74 20 70 72  gesets....set pr
1cd0: 65 64 65 63 65 73 73 6f 72 73 20 5b 50 6f 73 69  edecessors [Posi
1ce0: 74 69 6f 6e 73 20 5b 24 64 67 20 6e 6f 64 65 73  tions [$dg nodes
1cf0: 20 2d 69 6e 20 20 24 63 73 65 74 5d 5d 0a 09 73   -in  $cset]]..s
1d00: 65 74 20 73 75 63 63 65 73 73 6f 72 73 20 20 20  et successors   
1d10: 5b 50 6f 73 69 74 69 6f 6e 73 20 5b 24 64 67 20  [Positions [$dg 
1d20: 6e 6f 64 65 73 20 2d 6f 75 74 20 24 63 73 65 74  nodes -out $cset
1d30: 5d 5d 0a 0a 09 72 65 74 75 72 6e 20 5b 65 78 70  ]]...return [exp
1d40: 72 20 7b 0a 09 09 20 20 20 20 20 20 5b 6c 6c 65  r {...      [lle
1d50: 6e 67 74 68 20 24 70 72 65 64 65 63 65 73 73 6f  ngth $predecesso
1d60: 72 73 5d 20 26 26 0a 09 09 20 20 20 20 20 20 5b  rs] &&...      [
1d70: 6c 6c 65 6e 67 74 68 20 24 73 75 63 63 65 73 73  llength $success
1d80: 6f 72 73 5d 20 20 20 26 26 0a 09 09 20 20 20 20  ors]   &&...    
1d90: 20 20 28 5b 6d 61 78 20 24 70 72 65 64 65 63 65    ([max $predece
1da0: 73 73 6f 72 73 5d 20 3e 3d 20 5b 6d 69 6e 20 24  ssors] >= [min $
1db0: 73 75 63 63 65 73 73 6f 72 73 5d 29 0a 09 09 20  successors])... 
1dc0: 20 7d 5d 0a 20 20 20 20 7d 0a 0a 20 20 20 20 70   }].    }..    p
1dd0: 72 6f 63 20 50 6f 73 69 74 69 6f 6e 73 20 7b 63  roc Positions {c
1de0: 68 61 6e 67 65 73 65 74 73 7d 20 7b 0a 09 23 20  hangesets} {..# 
1df0: 54 6f 20 63 6f 6d 70 75 74 65 20 74 68 65 20 73  To compute the s
1e00: 65 74 20 6f 66 20 63 6f 6d 6d 69 74 20 70 6f 73  et of commit pos
1e10: 69 74 69 6f 6e 73 20 66 72 6f 6d 20 74 68 65 20  itions from the 
1e20: 73 65 74 20 6f 66 0a 09 23 20 63 68 61 6e 67 65  set of..# change
1e30: 73 65 74 73 20 77 65 20 66 69 72 73 74 20 6d 61  sets we first ma
1e40: 70 20 65 61 63 68 20 63 68 61 6e 67 65 73 65 74  p each changeset
1e50: 20 74 6f 20 69 74 73 20 70 6f 73 69 74 69 6f 6e   to its position
1e60: 20 28 2a 29 0a 09 23 20 61 6e 64 20 74 68 65 6e   (*)..# and then
1e70: 20 66 69 6c 74 65 72 20 6f 75 74 20 74 68 65 20   filter out the 
1e80: 69 6e 76 61 6c 69 64 20 72 65 73 70 6f 6e 73 65  invalid response
1e90: 73 20 28 74 68 65 20 65 6d 70 74 79 20 73 74 72  s (the empty str
1ea0: 69 6e 67 29 0a 09 23 20 72 65 74 75 72 6e 65 64  ing)..# returned
1eb0: 20 62 79 20 74 68 65 20 73 79 6d 62 6f 6c 20 63   by the symbol c
1ec0: 68 61 6e 67 65 73 65 74 73 2e 0a 09 23 0a 09 23  hangesets...#..#
1ed0: 20 28 2a 29 20 54 68 69 73 20 64 61 74 61 20 77   (*) This data w
1ee0: 61 73 20 6c 6f 61 64 65 64 20 69 6e 74 6f 20 6d  as loaded into m
1ef0: 65 6d 6f 72 79 20 65 61 72 6c 69 72 20 69 6e 20  emory earlir in 
1f00: 74 68 65 20 70 61 73 73 2c 20 62 79 0a 09 23 20  the pass, by..# 
1f10: 20 20 20 20 4c 6f 61 64 43 6f 6d 6d 69 74 4f 72      LoadCommitOr
1f20: 64 65 72 2e 0a 0a 09 72 65 74 75 72 6e 20 5b 73  der....return [s
1f30: 74 72 75 63 74 3a 3a 6c 69 73 74 20 66 69 6c 74  truct::list filt
1f40: 65 72 20 5b 73 74 72 75 63 74 3a 3a 6c 69 73 74  er [struct::list
1f50: 20 6d 61 70 20 24 63 68 61 6e 67 65 73 65 74 73   map $changesets
1f60: 20 5c 0a 09 09 09 09 09 20 5b 6d 79 70 72 6f 63   \...... [myproc
1f70: 20 54 6f 50 6f 73 69 74 69 6f 6e 5d 5d 20 5c 0a   ToPosition]] \.
1f80: 09 09 20 20 20 20 5b 6d 79 70 72 6f 63 20 56 61  ..    [myproc Va
1f90: 6c 69 64 50 6f 73 69 74 69 6f 6e 5d 5d 0a 20 20  lidPosition]].  
1fa0: 20 20 7d 0a 0a 20 20 20 20 70 72 6f 63 20 54 6f    }..    proc To
1fb0: 50 6f 73 69 74 69 6f 6e 20 20 20 20 7b 63 73 65  Position    {cse
1fc0: 74 7d 20 7b 20 24 63 73 65 74 20 70 6f 73 20 7d  t} { $cset pos }
1fd0: 0a 20 20 20 20 70 72 6f 63 20 56 61 6c 69 64 50  .    proc ValidP
1fe0: 6f 73 69 74 69 6f 6e 20 7b 70 6f 73 7d 20 20 7b  osition {pos}  {
1ff0: 20 65 78 70 72 20 7b 24 70 6f 73 20 6e 65 20 22   expr {$pos ne "
2000: 22 7d 20 7d 0a 0a 20 20 20 20 70 72 6f 63 20 43  "} }..    proc C
2010: 6f 6d 70 75 74 65 4c 69 6d 69 74 73 20 7b 63 73  omputeLimits {cs
2020: 65 74 20 6c 76 20 62 76 7d 20 7b 0a 09 75 70 76  et lv bv} {..upv
2030: 61 72 20 31 20 24 6c 76 20 74 68 65 6c 69 6d 69  ar 1 $lv thelimi
2040: 74 73 20 24 62 76 20 62 6f 72 64 65 72 0a 0a 09  ts $bv border...
2050: 23 20 49 6e 69 74 69 61 6c 69 7a 65 20 74 68 65  # Initialize the
2060: 20 62 6f 75 6e 64 61 72 69 65 73 20 66 6f 72 20   boundaries for 
2070: 61 6c 6c 20 72 65 76 69 73 69 6f 6e 73 2e 0a 0a  all revisions...
2080: 09 61 72 72 61 79 20 73 65 74 20 6c 69 6d 69 74  .array set limit
2090: 73 20 7b 7d 0a 09 66 6f 72 65 61 63 68 20 72 65  s {}..foreach re
20a0: 76 69 73 69 6f 6e 20 5b 24 63 73 65 74 20 72 65  vision [$cset re
20b0: 76 69 73 69 6f 6e 73 5d 20 7b 0a 09 20 20 20 20  visions] {..    
20c0: 73 65 74 20 6c 69 6d 69 74 73 28 24 72 65 76 69  set limits($revi
20d0: 73 69 6f 6e 29 20 7b 30 20 7b 7d 7d 0a 09 7d 0a  sion) {0 {}}..}.
20e0: 0a 09 23 20 43 6f 6d 70 75 74 65 20 61 6e 64 20  ..# Compute and 
20f0: 73 74 6f 72 65 20 74 68 65 20 6d 61 78 69 6d 61  store the maxima
2100: 6c 20 70 72 65 64 65 63 65 73 73 6f 72 73 20 70  l predecessors p
2110: 65 72 20 72 65 76 69 73 69 6f 6e 0a 0a 09 66 6f  er revision...fo
2120: 72 65 61 63 68 20 7b 72 65 76 69 73 69 6f 6e 20  reach {revision 
2130: 63 73 65 74 73 7d 20 5b 24 63 73 65 74 20 70 72  csets} [$cset pr
2140: 65 64 65 63 65 73 73 6f 72 6d 61 70 5d 20 7b 0a  edecessormap] {.
2150: 09 20 20 20 20 73 65 74 20 73 20 5b 50 6f 73 69  .    set s [Posi
2160: 74 69 6f 6e 73 20 24 63 73 65 74 73 5d 0a 09 20  tions $csets].. 
2170: 20 20 20 69 66 20 7b 21 5b 6c 6c 65 6e 67 74 68     if {![llength
2180: 20 24 73 5d 7d 20 63 6f 6e 74 69 6e 75 65 0a 09   $s]} continue..
2190: 20 20 20 20 73 65 74 20 6c 69 6d 69 74 73 28 24      set limits($
21a0: 72 65 76 69 73 69 6f 6e 29 20 5b 6c 72 65 70 6c  revision) [lrepl
21b0: 61 63 65 20 24 6c 69 6d 69 74 73 28 24 72 65 76  ace $limits($rev
21c0: 69 73 69 6f 6e 29 20 30 20 30 20 5b 6d 61 78 20  ision) 0 0 [max 
21d0: 24 73 5d 5d 0a 09 7d 0a 0a 09 23 20 43 6f 6d 70  $s]]..}...# Comp
21e0: 75 74 65 20 61 6e 64 20 73 74 6f 72 65 20 74 68  ute and store th
21f0: 65 20 6d 69 6e 69 6d 61 6c 20 73 75 63 63 65 73  e minimal succes
2200: 73 6f 72 73 20 70 65 72 20 72 65 76 69 73 69 6f  sors per revisio
2210: 6e 0a 0a 09 66 6f 72 65 61 63 68 20 7b 72 65 76  n...foreach {rev
2220: 69 73 69 6f 6e 20 63 73 65 74 73 7d 20 5b 24 63  ision csets} [$c
2230: 73 65 74 20 73 75 63 63 65 73 73 6f 72 6d 61 70  set successormap
2240: 5d 20 7b 0a 09 20 20 20 20 73 65 74 20 73 20 5b  ] {..    set s [
2250: 50 6f 73 69 74 69 6f 6e 73 20 24 63 73 65 74 73  Positions $csets
2260: 5d 0a 09 20 20 20 20 69 66 20 7b 21 5b 6c 6c 65  ]..    if {![lle
2270: 6e 67 74 68 20 24 73 5d 7d 20 63 6f 6e 74 69 6e  ngth $s]} contin
2280: 75 65 0a 09 20 20 20 20 73 65 74 20 6c 69 6d 69  ue..    set limi
2290: 74 73 28 24 72 65 76 69 73 69 6f 6e 29 20 5b 6c  ts($revision) [l
22a0: 72 65 70 6c 61 63 65 20 24 6c 69 6d 69 74 73 28  replace $limits(
22b0: 24 72 65 76 69 73 69 6f 6e 29 20 31 20 31 20 5b  $revision) 1 1 [
22c0: 6d 69 6e 20 24 73 5d 5d 0a 09 7d 0a 0a 09 23 20  min $s]]..}...# 
22d0: 43 68 65 63 6b 20 74 68 61 74 20 74 68 65 20 6f  Check that the o
22e0: 72 64 65 72 69 6e 67 20 61 74 20 74 68 65 20 66  rdering at the f
22f0: 69 6c 65 20 6c 65 76 65 6c 20 69 73 20 63 6f 72  ile level is cor
2300: 72 65 63 74 2e 20 57 65 0a 09 23 20 63 61 6e 6e  rect. We..# cann
2310: 6f 74 20 68 61 76 65 20 62 61 63 6b 77 61 72 64  ot have backward
2320: 20 6f 72 64 65 72 69 6e 67 20 70 65 72 20 72 65   ordering per re
2330: 76 69 73 69 6f 6e 2c 20 6f 72 20 73 6f 6d 65 74  vision, or somet
2340: 68 69 6e 67 20 69 73 0a 09 23 20 77 72 6f 6e 67  hing is..# wrong
2350: 2e 0a 0a 09 66 6f 72 65 61 63 68 20 72 65 76 69  ....foreach revi
2360: 73 69 6f 6e 20 5b 61 72 72 61 79 20 6e 61 6d 65  sion [array name
2370: 73 20 6c 69 6d 69 74 73 5d 20 7b 0a 09 20 20 20  s limits] {..   
2380: 20 73 74 72 75 63 74 3a 3a 6c 69 73 74 20 61 73   struct::list as
2390: 73 69 67 6e 20 24 6c 69 6d 69 74 73 28 24 72 65  sign $limits($re
23a0: 76 69 73 69 6f 6e 29 20 6d 61 78 70 20 6d 69 6e  vision) maxp min
23b0: 73 0a 09 20 20 20 20 23 20 48 61 6e 64 6c 65 20  s..    # Handle 
23c0: 6d 69 6e 20 73 75 63 63 65 73 73 6f 72 20 70 6f  min successor po
23d0: 73 69 74 69 6f 6e 20 22 22 20 61 73 20 72 65 70  sition "" as rep
23e0: 72 65 73 65 6e 74 69 6e 67 20 69 6e 66 69 6e 69  resenting infini
23f0: 74 79 0a 09 20 20 20 20 69 66 20 7b 24 6d 69 6e  ty..    if {$min
2400: 73 20 65 71 20 22 22 7d 20 63 6f 6e 74 69 6e 75  s eq ""} continu
2410: 65 0a 09 20 20 20 20 69 66 20 7b 24 6d 61 78 70  e..    if {$maxp
2420: 20 3c 20 24 6d 69 6e 73 7d 20 63 6f 6e 74 69 6e   < $mins} contin
2430: 75 65 0a 0a 09 20 20 20 20 74 72 6f 75 62 6c 65  ue...    trouble
2440: 20 69 6e 74 65 72 6e 61 6c 20 22 42 72 61 6e 63   internal "Branc
2450: 68 20 72 65 76 69 73 69 6f 6e 20 24 72 65 76 69  h revision $revi
2460: 73 69 6f 6e 20 69 73 20 62 61 63 6b 77 61 72 64  sion is backward
2470: 20 61 74 20 66 69 6c 65 20 6c 65 76 65 6c 20 28   at file level (
2480: 24 6d 61 78 70 20 3e 3d 20 24 6d 69 6e 73 29 22  $maxp >= $mins)"
2490: 0a 09 7d 0a 0a 09 23 20 53 61 76 65 20 74 68 65  ..}...# Save the
24a0: 20 6c 69 6d 69 74 73 20 66 6f 72 20 74 68 65 20   limits for the 
24b0: 73 70 6c 69 74 74 65 72 2c 20 61 6e 64 20 63 6f  splitter, and co
24c0: 6d 70 75 74 65 20 74 68 65 20 62 6f 72 64 65 72  mpute the border
24d0: 20 61 74 0a 09 23 20 77 68 69 63 68 20 74 6f 20   at..# which to 
24e0: 73 70 6c 69 74 20 61 73 20 74 68 65 20 6d 69 6e  split as the min
24f0: 69 6d 75 6d 20 6f 66 20 61 6c 6c 20 6d 69 6e 69  imum of all mini
2500: 6d 61 6c 20 73 75 63 63 65 73 73 6f 72 0a 09 23  mal successor..#
2510: 20 70 6f 73 69 74 69 6f 6e 73 2e 0a 0a 09 73 65   positions....se
2520: 74 20 74 68 65 6c 69 6d 69 74 73 20 5b 61 72 72  t thelimits [arr
2530: 61 79 20 67 65 74 20 6c 69 6d 69 74 73 5d 0a 09  ay get limits]..
2540: 73 65 74 20 62 6f 72 64 65 72 20 5b 6d 69 6e 20  set border [min 
2550: 5b 73 74 72 75 63 74 3a 3a 6c 69 73 74 20 66 69  [struct::list fi
2560: 6c 74 65 72 20 5b 73 74 72 75 63 74 3a 3a 6c 69  lter [struct::li
2570: 73 74 20 6d 61 70 20 5b 56 61 6c 75 65 73 20 24  st map [Values $
2580: 74 68 65 6c 69 6d 69 74 73 5d 20 5c 0a 09 09 09  thelimits] \....
2590: 09 09 09 20 20 5b 6d 79 70 72 6f 63 20 4d 69 6e  ...  [myproc Min
25a0: 53 75 63 63 65 73 73 6f 72 50 6f 73 69 74 69 6f  SuccessorPositio
25b0: 6e 5d 5d 20 5c 0a 09 09 09 20 20 20 20 20 5b 6d  n]] \....     [m
25c0: 79 70 72 6f 63 20 56 61 6c 69 64 50 6f 73 69 74  yproc ValidPosit
25d0: 69 6f 6e 5d 5d 5d 0a 09 72 65 74 75 72 6e 0a 20  ion]]]..return. 
25e0: 20 20 20 7d 0a 0a 20 20 20 20 70 72 6f 63 20 56     }..    proc V
25f0: 61 6c 75 65 73 20 7b 64 69 63 74 7d 20 7b 0a 09  alues {dict} {..
2600: 73 65 74 20 72 65 73 20 7b 7d 0a 09 66 6f 72 65  set res {}..fore
2610: 61 63 68 20 7b 6b 20 76 7d 20 24 64 69 63 74 20  ach {k v} $dict 
2620: 7b 20 6c 61 70 70 65 6e 64 20 72 65 73 20 24 76  { lappend res $v
2630: 20 7d 0a 09 72 65 74 75 72 6e 20 24 72 65 73 0a   }..return $res.
2640: 20 20 20 20 7d 0a 0a 20 20 20 20 70 72 6f 63 20      }..    proc 
2650: 4d 69 6e 53 75 63 63 65 73 73 6f 72 50 6f 73 69  MinSuccessorPosi
2660: 74 69 6f 6e 20 7b 69 74 65 6d 7d 20 7b 20 6c 69  tion {item} { li
2670: 6e 64 65 78 20 24 69 74 65 6d 20 31 20 7d 0a 0a  ndex $item 1 }..
2680: 20 20 20 20 70 72 6f 63 20 53 70 6c 69 74 52 65      proc SplitRe
2690: 76 69 73 69 6f 6e 73 20 7b 6c 69 6d 69 74 73 20  visions {limits 
26a0: 62 6f 72 64 65 72 20 6e 76 20 62 76 7d 20 7b 0a  border nv bv} {.
26b0: 09 75 70 76 61 72 20 31 20 24 6e 76 20 6e 6f 72  .upvar 1 $nv nor
26c0: 6d 61 6c 72 65 76 69 73 69 6f 6e 73 20 24 62 76  malrevisions $bv
26d0: 20 62 61 63 6b 77 61 72 64 72 65 76 69 73 69 6f   backwardrevisio
26e0: 6e 73 0a 0a 09 73 65 74 20 6e 6f 72 6d 61 6c 72  ns...set normalr
26f0: 65 76 69 73 69 6f 6e 73 20 20 20 7b 7d 0a 09 73  evisions   {}..s
2700: 65 74 20 62 61 63 6b 77 61 72 64 72 65 76 69 73  et backwardrevis
2710: 69 6f 6e 73 20 7b 7d 0a 0a 09 66 6f 72 65 61 63  ions {}...foreac
2720: 68 20 7b 72 65 76 20 76 7d 20 24 6c 69 6d 69 74  h {rev v} $limit
2730: 73 20 7b 0a 09 20 20 20 20 73 74 72 75 63 74 3a  s {..    struct:
2740: 3a 6c 69 73 74 20 61 73 73 69 67 6e 20 24 76 20  :list assign $v 
2750: 6d 61 78 70 20 6d 69 6e 73 0a 09 20 20 20 20 69  maxp mins..    i
2760: 66 20 7b 24 6d 61 78 70 20 3e 3d 20 24 62 6f 72  f {$maxp >= $bor
2770: 64 65 72 7d 20 7b 0a 09 09 6c 61 70 70 65 6e 64  der} {...lappend
2780: 20 62 61 63 6b 77 61 72 64 72 65 76 69 73 69 6f   backwardrevisio
2790: 6e 73 20 20 24 72 65 76 0a 09 20 20 20 20 7d 20  ns  $rev..    } 
27a0: 65 6c 73 65 20 7b 0a 09 09 6c 61 70 70 65 6e 64  else {...lappend
27b0: 20 6e 6f 72 6d 61 6c 72 65 76 69 73 69 6f 6e 73   normalrevisions
27c0: 20 24 72 65 76 0a 09 20 20 20 20 7d 0a 09 7d 0a   $rev..    }..}.
27d0: 0a 09 69 66 20 7b 21 5b 6c 6c 65 6e 67 74 68 20  ..if {![llength 
27e0: 24 6e 6f 72 6d 61 6c 72 65 76 69 73 69 6f 6e 73  $normalrevisions
27f0: 5d 7d 20 20 20 7b 20 74 72 6f 75 62 6c 65 20 69  ]}   { trouble i
2800: 6e 74 65 72 6e 61 6c 20 22 53 65 74 20 6f 66 20  nternal "Set of 
2810: 6e 6f 72 6d 61 6c 20 72 65 76 69 73 69 6f 6e 73  normal revisions
2820: 20 69 73 20 65 6d 70 74 79 22 20 7d 0a 09 69 66   is empty" }..if
2830: 20 7b 21 5b 6c 6c 65 6e 67 74 68 20 24 62 61 63   {![llength $bac
2840: 6b 77 61 72 64 72 65 76 69 73 69 6f 6e 73 5d 7d  kwardrevisions]}
2850: 20 7b 20 74 72 6f 75 62 6c 65 20 69 6e 74 65 72   { trouble inter
2860: 6e 61 6c 20 22 53 65 74 20 6f 66 20 62 61 63 6b  nal "Set of back
2870: 77 61 72 64 20 72 65 76 69 73 69 6f 6e 73 20 69  ward revisions i
2880: 73 20 65 6d 70 74 79 22 20 7d 0a 09 72 65 74 75  s empty" }..retu
2890: 72 6e 0a 20 20 20 20 7d 0a 0a 0a 20 20 20 20 23  rn.    }...    #
28a0: 20 23 20 23 23 20 23 23 23 20 23 23 23 23 23 20   # ## ### ##### 
28b0: 23 23 23 23 23 23 23 23 20 23 23 23 23 23 23 23  ######## #######
28c0: 23 23 23 23 23 23 0a 0a 20 20 20 20 70 72 6f 63  ######..    proc
28d0: 20 4b 65 65 70 4f 72 64 65 72 20 7b 67 72 61 70   KeepOrder {grap
28e0: 68 20 61 74 20 63 73 65 74 7d 20 7b 0a 09 73 65  h at cset} {..se
28f0: 74 20 63 69 64 20 5b 24 63 73 65 74 20 69 64 5d  t cid [$cset id]
2900: 0a 0a 09 6c 6f 67 20 77 72 69 74 65 20 34 20 62  ...log write 4 b
2910: 72 65 61 6b 61 63 79 63 6c 65 20 22 43 68 61 6e  reakacycle "Chan
2920: 67 65 73 65 74 20 40 20 5b 66 6f 72 6d 61 74 20  geset @ [format 
2930: 24 6d 79 61 74 66 6d 74 20 24 61 74 5d 3a 20 5b  $myatfmt $at]: [
2940: 66 6f 72 6d 61 74 20 24 6d 79 63 73 66 6d 74 20  format $mycsfmt 
2950: 5b 24 63 73 65 74 20 73 74 72 5d 5d 20 3c 3c 5b  [$cset str]] <<[
2960: 46 6f 72 6d 61 74 54 52 20 24 67 72 61 70 68 20  FormatTR $graph 
2970: 24 63 73 65 74 5d 3e 3e 22 0a 0a 09 23 20 57 65  $cset]>>"...# We
2980: 20 73 65 65 20 68 65 72 65 20 61 20 6d 69 78 74   see here a mixt
2990: 75 72 65 20 6f 66 20 73 79 6d 62 6f 6c 20 61 6e  ure of symbol an
29a0: 64 20 72 65 76 69 73 69 6f 6e 20 63 68 61 6e 67  d revision chang
29b0: 65 73 65 74 73 2e 0a 09 23 20 54 68 65 20 73 79  esets...# The sy
29c0: 6d 62 6f 6c 20 63 68 61 6e 67 65 73 65 74 73 20  mbol changesets 
29d0: 61 72 65 20 69 67 6e 6f 72 65 64 20 61 73 20 69  are ignored as i
29e0: 72 72 65 6c 65 76 61 6e 74 2e 0a 0a 09 69 66 20  rrelevant....if 
29f0: 7b 5b 24 63 73 65 74 20 70 6f 73 5d 20 65 71 20  {[$cset pos] eq 
2a00: 22 22 7d 20 72 65 74 75 72 6e 0a 0a 09 23 20 46  ""} return...# F
2a10: 6f 72 20 74 68 65 20 72 65 76 69 73 69 6f 6e 20  or the revision 
2a20: 63 68 61 6e 67 65 73 65 74 73 20 77 65 20 61 72  changesets we ar
2a30: 65 20 73 75 72 65 20 74 68 61 74 20 74 68 65 79  e sure that they
2a40: 20 61 72 65 0a 09 23 20 63 6f 6e 73 75 6d 65 64   are..# consumed
2a50: 20 69 6e 20 74 68 65 20 73 61 6d 65 20 6f 72 64   in the same ord
2a60: 65 72 20 61 73 20 67 65 6e 65 72 61 74 65 64 20  er as generated 
2a70: 62 79 20 70 61 73 73 20 37 0a 09 23 20 28 52 65  by pass 7..# (Re
2a80: 76 54 6f 70 6f 6c 6f 67 69 63 61 6c 53 6f 72 74  vTopologicalSort
2a90: 29 2e 20 50 65 72 20 74 68 65 20 63 6f 64 65 20  ). Per the code 
2aa0: 69 6e 20 63 76 73 32 73 76 6e 2e 0a 0a 09 23 20  in cvs2svn....# 
2ab0: 4e 4f 54 45 3a 20 49 20 63 61 6e 6e 6f 74 20 73  NOTE: I cannot s
2ac0: 65 65 20 74 68 61 74 2e 20 41 73 73 75 6d 65 20  ee that. Assume 
2ad0: 63 73 20 41 20 61 6e 64 20 63 73 20 42 2c 20 6e  cs A and cs B, n
2ae0: 6f 74 20 64 65 70 65 6e 64 65 6e 74 0a 09 23 20  ot dependent..# 
2af0: 20 20 20 20 20 20 6f 6e 20 65 61 63 68 20 6f 74        on each ot
2b00: 68 65 72 20 69 6e 20 74 68 65 20 73 65 74 20 6f  her in the set o
2b10: 66 20 72 65 76 69 73 69 6f 6e 73 2c 20 6e 6f 77  f revisions, now
2b20: 20 42 20 61 66 74 65 72 20 41 0a 09 23 20 20 20   B after A..#   
2b30: 20 20 20 20 73 69 6d 70 6c 79 20 6d 65 61 6e 73      simply means
2b40: 20 74 68 61 74 20 42 20 68 61 73 20 61 20 6c 61   that B has a la
2b50: 74 65 72 20 74 69 6d 65 20 6f 72 20 64 65 70 65  ter time or depe
2b60: 6e 64 73 20 6f 6e 0a 09 23 20 20 20 20 20 20 20  nds on..#       
2b70: 73 6f 6d 65 74 68 69 6e 67 20 77 69 74 20 61 20  something wit a 
2b80: 6c 61 74 65 72 20 74 69 6d 65 20 74 68 61 6e 20  later time than 
2b90: 41 2e 20 49 6e 20 74 68 65 20 66 75 6c 6c 20 67  A. In the full g
2ba0: 72 61 70 68 20 41 0a 09 23 20 20 20 20 20 20 20  raph A..#       
2bb0: 6d 61 79 20 6e 6f 77 20 68 61 76 65 20 64 65 70  may now have dep
2bc0: 65 6e 64 65 6e 63 69 65 73 20 77 68 69 63 68 20  endencies which 
2bd0: 73 68 69 66 74 20 69 74 20 61 66 74 65 72 20 42  shift it after B
2be0: 2c 0a 09 23 20 20 20 20 20 20 20 76 69 6f 6c 61  ,..#       viola
2bf0: 74 69 6e 67 20 74 68 65 20 61 62 6f 76 65 20 61  ting the above a
2c00: 73 73 75 6d 70 74 69 6f 6e 2e 0a 09 23 0a 09 23  ssumption...#..#
2c10: 20 57 65 6c 6c 2c 20 69 74 20 73 65 65 6d 73 20   Well, it seems 
2c20: 74 6f 20 77 6f 72 6b 20 69 66 20 49 20 64 6f 20  to work if I do 
2c30: 6e 6f 74 20 6d 61 6b 65 20 74 68 65 20 4e 54 44  not make the NTD
2c40: 42 20 72 6f 6f 74 20 61 0a 09 23 20 73 75 63 63  B root a..# succ
2c50: 65 73 73 6f 72 20 6f 66 20 74 68 65 20 72 65 67  essor of the reg
2c60: 75 6c 61 72 20 72 6f 6f 74 2e 20 44 6f 69 6e 67  ular root. Doing
2c70: 20 73 6f 20 73 65 65 6d 73 20 74 6f 20 74 61 6e   so seems to tan
2c80: 67 6c 65 20 74 68 65 0a 09 23 20 63 68 61 6e 67  gle the..# chang
2c90: 65 73 65 74 73 20 69 6e 74 6f 20 61 20 6b 6e 6f  esets into a kno
2ca0: 74 73 20 72 65 67 61 72 64 69 6e 67 20 74 69 6d  ts regarding tim
2cb0: 65 20 76 73 20 64 65 70 65 6e 64 65 6e 63 69 65  e vs dependencie
2cc0: 73 20 61 6e 64 0a 09 23 20 74 72 69 67 67 65 72  s and..# trigger
2cd0: 20 73 75 63 68 20 73 68 69 66 74 73 2e 20 4b 65   such shifts. Ke
2ce0: 65 70 69 6e 67 20 74 68 65 73 65 20 74 77 6f 20  eping these two 
2cf0: 72 6f 6f 74 73 20 73 65 70 61 72 61 74 65 20 4f  roots separate O
2d00: 54 4f 48 0a 09 23 20 64 69 73 61 70 70 65 61 72  TOH..# disappear
2d10: 73 20 74 68 65 20 74 61 6e 67 6c 65 2e 20 53 6f  s the tangle. So
2d20: 2c 20 66 6f 72 20 6e 6f 77 20 49 20 61 63 63 65  , for now I acce
2d30: 70 74 20 74 68 61 74 2c 20 61 6e 64 20 66 6f 72  pt that, and for
2d40: 0a 09 23 20 70 61 72 61 6e 6f 69 61 20 49 20 61  ..# paranoia I a
2d50: 64 64 20 63 6f 64 65 20 77 68 69 63 68 20 63 68  dd code which ch
2d60: 65 63 6b 73 20 74 68 69 73 20 61 73 73 75 6d 70  ecks this assump
2d70: 74 69 6f 6e 2e 0a 0a 09 73 74 72 75 63 74 3a 3a  tion....struct::
2d80: 73 65 74 20 65 78 63 6c 75 64 65 20 6d 79 72 65  set exclude myre
2d90: 76 69 73 69 6f 6e 63 68 61 6e 67 65 73 65 74 73  visionchangesets
2da0: 20 24 63 73 65 74 0a 0a 09 3a 3a 76 61 72 69 61   $cset...::varia
2db0: 62 6c 65 20 6d 79 6c 61 73 74 70 6f 73 0a 09 73  ble mylastpos..s
2dc0: 65 74 20 6e 65 77 20 5b 24 63 73 65 74 20 70 6f  et new [$cset po
2dd0: 73 5d 0a 0a 09 69 66 20 7b 24 6e 65 77 20 21 3d  s]...if {$new !=
2de0: 20 28 24 6d 79 6c 61 73 74 70 6f 73 20 2b 20 31   ($mylastpos + 1
2df0: 29 7d 20 7b 0a 09 20 20 20 20 69 66 20 7b 24 6d  )} {..    if {$m
2e00: 79 6c 61 73 74 70 6f 73 20 3c 20 30 7d 20 7b 0a  ylastpos < 0} {.
2e10: 09 09 73 65 74 20 6f 6c 64 20 22 3c 4e 4f 4e 45  ..set old "<NONE
2e20: 3e 22 0a 09 20 20 20 20 7d 20 65 6c 73 65 20 7b  >"..    } else {
2e30: 0a 09 09 3a 3a 76 61 72 69 61 62 6c 65 20 6d 79  ...::variable my
2e40: 63 73 65 74 0a 09 09 73 65 74 20 6f 6c 64 20 5b  cset...set old [
2e50: 24 6d 79 63 73 65 74 28 24 6d 79 6c 61 73 74 70  $mycset($mylastp
2e60: 6f 73 29 20 73 74 72 5d 40 24 6d 79 6c 61 73 74  os) str]@$mylast
2e70: 70 6f 73 0a 09 20 20 20 20 7d 0a 0a 09 20 20 20  pos..    }...   
2e80: 20 74 72 6f 75 62 6c 65 20 69 6e 74 65 72 6e 61   trouble interna
2e90: 6c 20 22 4f 72 64 65 72 69 6e 67 20 6f 66 20 72  l "Ordering of r
2ea0: 65 76 69 73 69 6f 6e 20 63 68 61 6e 67 65 73 65  evision changese
2eb0: 74 73 20 76 69 6f 6c 61 74 65 64 2c 20 5b 24 63  ts violated, [$c
2ec0: 73 65 74 20 73 74 72 5d 40 24 6e 65 77 20 69 73  set str]@$new is
2ed0: 20 6e 6f 74 20 69 6d 6d 65 64 69 61 74 65 6c 79   not immediately
2ee0: 20 61 66 74 65 72 20 24 6f 6c 64 22 0a 09 7d 0a   after $old"..}.
2ef0: 0a 09 73 65 74 20 6d 79 6c 61 73 74 70 6f 73 20  ..set mylastpos 
2f00: 24 6e 65 77 0a 09 72 65 74 75 72 6e 0a 20 20 20  $new..return.   
2f10: 20 7d 0a 0a 20 20 20 20 70 72 6f 63 20 46 6f 72   }..    proc For
2f20: 6d 61 74 54 52 20 7b 67 72 61 70 68 20 63 73 65  matTR {graph cse
2f30: 74 7d 20 7b 0a 09 72 65 74 75 72 6e 20 5b 6a 6f  t} {..return [jo
2f40: 69 6e 20 5b 73 74 72 75 63 74 3a 3a 6c 69 73 74  in [struct::list
2f50: 20 6d 61 70 20 5b 24 67 72 61 70 68 20 6e 6f 64   map [$graph nod
2f60: 65 20 73 65 74 20 24 63 73 65 74 20 74 69 6d 65  e set $cset time
2f70: 72 61 6e 67 65 5d 20 7b 63 6c 6f 63 6b 20 66 6f  range] {clock fo
2f80: 72 6d 61 74 7d 5d 20 7b 20 2d 2d 20 7d 5d 0a 20  rmat}] { -- }]. 
2f90: 20 20 20 7d 0a 0a 20 20 20 20 74 79 70 65 76 61     }..    typeva
2fa0: 72 69 61 62 6c 65 20 6d 79 6c 61 73 74 70 6f 73  riable mylastpos
2fb0: 20 20 20 20 20 20 20 20 20 20 20 20 2d 31 20 3b              -1 ;
2fc0: 20 23 20 50 6f 73 69 74 69 6f 6e 20 6f 66 20 6c   # Position of l
2fd0: 61 73 74 20 72 65 76 69 73 69 6f 6e 20 63 68 61  ast revision cha
2fe0: 6e 67 65 73 65 74 20 73 61 76 65 64 2e 0a 20 20  ngeset saved..  
2ff0: 20 20 74 79 70 65 76 61 72 69 61 62 6c 65 20 6d    typevariable m
3000: 79 72 65 76 69 73 69 6f 6e 63 68 61 6e 67 65 73  yrevisionchanges
3010: 65 74 73 20 7b 7d 20 3b 20 23 20 53 65 74 20 6f  ets {} ; # Set o
3020: 66 20 72 65 76 69 73 69 6f 6e 20 63 68 61 6e 67  f revision chang
3030: 65 73 65 74 73 0a 0a 20 20 20 20 74 79 70 65 76  esets..    typev
3040: 61 72 69 61 62 6c 65 20 6d 79 61 74 66 6d 74 20  ariable myatfmt 
3050: 3b 20 23 20 46 6f 72 6d 61 74 20 66 6f 72 20 6c  ; # Format for l
3060: 6f 67 20 6f 75 74 70 75 74 20 74 6f 20 67 61 69  og output to gai
3070: 6e 20 62 65 74 74 65 72 20 61 6c 69 67 6e 6d 65  n better alignme
3080: 6e 74 20 6f 66 20 74 68 65 20 76 61 72 69 6f 75  nt of the variou
3090: 73 20 63 6f 6c 75 6d 6e 73 2e 0a 20 20 20 20 74  s columns..    t
30a0: 79 70 65 76 61 72 69 61 62 6c 65 20 6d 79 63 73  ypevariable mycs
30b0: 66 6d 74 20 3b 20 23 20 44 69 74 74 6f 20 66 6f  fmt ; # Ditto fo
30c0: 72 20 74 68 65 20 63 68 61 6e 67 65 73 65 74 73  r the changesets
30d0: 2e 0a 0a 20 20 20 20 23 20 23 20 23 23 20 23 23  ...    # # ## ##
30e0: 23 20 23 23 23 23 23 20 23 23 23 23 23 23 23 23  # ##### ########
30f0: 20 23 23 23 23 23 23 23 23 23 23 23 23 23 0a 0a   #############..
3100: 20 20 20 20 70 72 6f 63 20 42 72 65 61 6b 43 79      proc BreakCy
3110: 63 6c 65 20 7b 67 72 61 70 68 7d 20 7b 0a 09 23  cle {graph} {..#
3120: 20 49 6e 20 74 68 69 73 20 70 61 73 73 20 74 68   In this pass th
3130: 65 20 63 79 63 6c 65 20 62 72 65 61 6b 69 6e 67  e cycle breaking
3140: 20 63 61 6e 20 62 65 20 6d 61 64 65 20 61 20 62   can be made a b
3150: 69 74 20 6d 6f 72 65 0a 09 23 20 74 61 72 67 65  it more..# targe
3160: 74 65 64 2c 20 68 65 6e 63 65 20 74 68 69 73 20  ted, hence this 
3170: 63 75 73 74 6f 6d 20 63 61 6c 6c 62 61 63 6b 2e  custom callback.
3180: 0a 09 23 0a 09 23 20 46 69 72 73 74 20 77 65 20  ..#..# First we 
3190: 75 73 65 20 74 68 65 20 64 61 74 61 20 72 65 6d  use the data rem
31a0: 65 6d 62 65 72 65 64 20 62 79 20 27 53 61 76 65  embered by 'Save
31b0: 4f 72 64 65 72 27 2c 20 61 62 6f 75 74 20 74 68  Order', about th
31c0: 65 0a 09 23 20 6c 61 73 74 20 63 6f 6d 6d 69 74  e..# last commit
31d0: 20 70 6f 73 69 74 69 6f 6e 20 69 74 20 68 61 6e   position it han
31e0: 64 6c 65 64 2c 20 74 6f 20 64 65 64 75 63 65 20  dled, to deduce 
31f0: 74 68 65 20 6e 65 78 74 20 72 65 76 69 73 69 6f  the next revisio
3200: 6e 0a 09 23 20 63 68 61 6e 67 65 73 65 74 20 69  n..# changeset i
3210: 74 20 77 6f 75 6c 64 20 65 6e 63 6f 75 6e 74 65  t would encounte
3220: 72 2e 20 54 68 65 6e 20 77 65 20 6c 6f 6f 6b 20  r. Then we look 
3230: 66 6f 72 20 74 68 65 20 73 68 6f 72 74 65 73 74  for the shortest
3240: 0a 09 23 20 70 72 65 64 65 63 65 73 73 6f 72 20  ..# predecessor 
3250: 70 61 74 68 20 66 72 6f 6d 20 69 74 20 74 6f 20  path from it to 
3260: 61 6c 6c 20 6f 74 68 65 72 20 72 65 76 69 73 69  all other revisi
3270: 6f 6e 20 63 68 61 6e 67 65 73 65 74 73 0a 09 23  on changesets..#
3280: 20 61 6e 64 20 62 72 65 61 6b 20 74 68 69 73 20   and break this 
3290: 70 61 74 68 2e 20 57 69 74 68 6f 75 74 20 73 75  path. Without su
32a0: 63 68 20 61 20 70 61 74 68 20 77 65 20 66 61 6c  ch a path we fal
32b0: 6c 20 62 61 63 6b 20 74 6f 20 74 68 65 0a 09 23  l back to the..#
32c0: 20 67 65 6e 65 72 69 63 20 63 79 63 6c 65 20 62   generic cycle b
32d0: 72 65 61 6b 65 72 2e 0a 0a 09 3a 3a 76 61 72 69  reaker....::vari
32e0: 61 62 6c 65 20 6d 79 6c 61 73 74 70 6f 73 0a 09  able mylastpos..
32f0: 3a 3a 76 61 72 69 61 62 6c 65 20 6d 79 63 73 65  ::variable mycse
3300: 74 0a 09 3a 3a 76 61 72 69 61 62 6c 65 20 6d 79  t..::variable my
3310: 72 65 76 69 73 69 6f 6e 63 68 61 6e 67 65 73 65  revisionchangese
3320: 74 73 0a 0a 09 73 65 74 20 6e 65 78 74 70 6f 73  ts...set nextpos
3330: 20 5b 65 78 70 72 20 7b 24 6d 79 6c 61 73 74 70   [expr {$mylastp
3340: 6f 73 20 2b 20 31 7d 5d 0a 09 73 65 74 20 6e 65  os + 1}]..set ne
3350: 78 74 20 20 20 20 24 6d 79 63 73 65 74 28 24 6e  xt    $mycset($n
3360: 65 78 74 70 6f 73 29 0a 0a 09 70 75 74 73 20 22  extpos)...puts "
3370: 2a 2a 20 4c 61 73 74 3a 20 24 6d 79 6c 61 73 74  ** Last: $mylast
3380: 70 6f 73 20 3d 20 5b 24 6d 79 63 73 65 74 28 24  pos = [$mycset($
3390: 6d 79 6c 61 73 74 70 6f 73 29 20 73 74 72 5d 20  mylastpos) str] 
33a0: 40 20 5b 24 6d 79 63 73 65 74 28 24 6d 79 6c 61  @ [$mycset($myla
33b0: 73 74 70 6f 73 29 20 70 6f 73 5d 22 0a 09 70 75  stpos) pos]"..pu
33c0: 74 73 20 22 2a 2a 20 4e 65 78 74 3a 20 24 6e 65  ts "** Next: $ne
33d0: 78 74 70 6f 73 20 3d 20 5b 24 6e 65 78 74 20 73  xtpos = [$next s
33e0: 74 72 5d 20 40 20 5b 24 6e 65 78 74 20 70 6f 73  tr] @ [$next pos
33f0: 5d 22 0a 0a 09 73 65 74 20 70 61 74 68 20 5b 53  ]"...set path [S
3400: 65 61 72 63 68 46 6f 72 50 61 74 68 20 24 67 72  earchForPath $gr
3410: 61 70 68 20 24 6e 65 78 74 20 24 6d 79 72 65 76  aph $next $myrev
3420: 69 73 69 6f 6e 63 68 61 6e 67 65 73 65 74 73 5d  isionchangesets]
3430: 0a 09 69 66 20 7b 5b 6c 6c 65 6e 67 74 68 20 24  ..if {[llength $
3440: 70 61 74 68 5d 7d 20 7b 0a 09 20 20 20 20 63 79  path]} {..    cy
3450: 63 6c 65 62 72 65 61 6b 65 72 20 62 72 65 61 6b  clebreaker break
3460: 2d 73 65 67 6d 65 6e 74 20 24 67 72 61 70 68 20  -segment $graph 
3470: 24 70 61 74 68 0a 09 20 20 20 20 72 65 74 75 72  $path..    retur
3480: 6e 0a 09 7d 0a 0a 09 23 20 57 65 20 77 65 72 65  n..}...# We were
3490: 20 75 6e 61 62 6c 65 20 74 6f 20 66 69 6e 64 20   unable to find 
34a0: 61 6e 20 6f 72 64 65 72 65 64 20 63 68 61 6e 67  an ordered chang
34b0: 65 73 65 74 20 69 6e 20 74 68 65 20 72 65 61 63  eset in the reac
34c0: 68 61 62 6c 65 0a 09 23 20 70 72 65 64 65 63 65  hable..# predece
34d0: 73 73 6f 72 73 2c 20 66 61 6c 6c 20 62 61 63 6b  ssors, fall back
34e0: 20 74 6f 20 74 68 65 20 67 65 6e 65 72 69 63 20   to the generic 
34f0: 63 6f 64 65 20 66 6f 72 20 62 72 65 61 6b 69 6e  code for breakin
3500: 67 20 74 68 65 0a 09 23 20 66 6f 75 6e 64 20 63  g the..# found c
3510: 79 63 6c 65 2e 0a 0a 09 63 79 63 6c 65 62 72 65  ycle....cyclebre
3520: 61 6b 65 72 20 62 72 65 61 6b 20 24 67 72 61 70  aker break $grap
3530: 68 0a 20 20 20 20 7d 0a 0a 20 20 20 20 70 72 6f  h.    }..    pro
3540: 63 20 53 65 61 72 63 68 46 6f 72 50 61 74 68 20  c SearchForPath 
3550: 7b 67 72 61 70 68 20 6e 20 73 74 6f 70 6e 6f 64  {graph n stopnod
3560: 65 73 7d 20 7b 0a 09 23 20 53 65 61 72 63 68 20  es} {..# Search 
3570: 66 6f 72 20 70 61 74 68 73 20 74 6f 20 70 72 65  for paths to pre
3580: 72 65 71 75 69 73 69 74 65 73 20 6f 66 20 4e 2e  requisites of N.
3590: 0a 09 23 0a 09 23 20 54 72 79 20 74 6f 20 66 69  ..#..# Try to fi
35a0: 6e 64 20 74 68 65 20 73 68 6f 72 74 65 73 74 20  nd the shortest 
35b0: 64 65 70 65 6e 64 65 6e 63 79 20 70 61 74 68 20  dependency path 
35c0: 74 68 61 74 20 63 61 75 73 65 73 20 74 68 65 0a  that causes the.
35d0: 09 23 20 63 68 61 6e 67 65 73 65 74 20 4e 20 74  .# changeset N t
35e0: 6f 20 64 65 70 65 6e 64 20 28 64 69 72 65 63 74  o depend (direct
35f0: 6c 79 20 6f 72 20 69 6e 64 69 72 65 63 74 6c 79  ly or indirectly
3600: 29 20 6f 6e 20 6f 6e 65 20 6f 66 20 74 68 65 0a  ) on one of the.
3610: 09 23 20 63 68 61 6e 67 65 73 65 74 73 20 63 6f  .# changesets co
3620: 6e 74 61 69 6e 65 64 20 69 6e 20 53 54 4f 50 4e  ntained in STOPN
3630: 4f 44 45 53 2e 0a 09 23 0a 09 23 20 57 65 20 63  ODES...#..# We c
3640: 6f 6e 73 69 64 65 72 20 64 69 72 65 63 74 20 61  onsider direct a
3650: 6e 64 20 69 6e 64 69 72 65 63 74 20 64 65 70 65  nd indirect depe
3660: 6e 64 65 6e 63 69 65 73 20 69 6e 20 74 68 65 20  ndencies in the 
3670: 73 65 6e 73 65 0a 09 23 20 74 68 61 74 20 74 68  sense..# that th
3680: 65 20 63 68 61 6e 67 65 73 65 74 20 63 61 6e 20  e changeset can 
3690: 62 65 20 72 65 61 63 68 65 64 20 62 79 20 66 6f  be reached by fo
36a0: 6c 6c 6f 77 69 6e 67 20 61 20 63 68 61 69 6e 20  llowing a chain 
36b0: 6f 66 0a 09 23 20 70 72 65 64 65 63 65 73 73 6f  of..# predecesso
36c0: 72 20 6e 6f 64 65 73 2e 0a 09 23 0a 09 23 20 57  r nodes...#..# W
36d0: 68 65 6e 20 6f 6e 65 20 6f 66 20 74 68 65 20 63  hen one of the c
36e0: 73 65 74 73 20 69 6e 20 53 54 4f 50 4e 4f 44 45  sets in STOPNODE
36f0: 53 20 69 73 20 66 6f 75 6e 64 2c 20 77 65 20 74  S is found, we t
3700: 65 72 6d 69 6e 61 74 65 0a 09 23 20 74 68 65 20  erminate..# the 
3710: 73 65 61 72 63 68 20 61 6e 64 20 72 65 74 75 72  search and retur
3720: 6e 20 74 68 65 20 70 61 74 68 20 66 72 6f 6d 20  n the path from 
3730: 74 68 61 74 20 63 73 65 74 20 74 6f 20 4e 2e 20  that cset to N. 
3740: 20 49 66 20 6e 6f 0a 09 23 20 70 61 74 68 20 69   If no..# path i
3750: 73 20 66 6f 75 6e 64 20 74 6f 20 61 20 6e 6f 64  s found to a nod
3760: 65 20 69 6e 20 53 54 4f 50 5f 53 45 54 2c 20 77  e in STOP_SET, w
3770: 65 20 72 65 74 75 72 6e 20 74 68 65 20 65 6d 70  e return the emp
3780: 74 79 0a 09 23 20 6c 69 73 74 2f 70 61 74 68 2e  ty..# list/path.
3790: 0a 0a 09 23 20 54 68 69 73 20 69 73 20 69 6e 20  ...# This is in 
37a0: 65 73 73 65 6e 63 65 20 61 20 6d 75 6c 74 69 2d  essence a multi-
37b0: 64 65 73 74 69 6e 61 74 69 6f 6e 20 44 69 6a 6b  destination Dijk
37c0: 73 74 72 61 20 73 74 61 72 74 69 6e 67 20 61 74  stra starting at
37d0: 0a 09 23 20 4e 20 77 68 69 63 68 20 73 74 6f 70  ..# N which stop
37e0: 73 20 77 68 65 6e 20 6f 6e 65 20 6f 66 20 74 68  s when one of th
37f0: 65 20 64 65 73 74 69 6e 61 74 69 6f 6e 73 20 69  e destinations i
3800: 6e 20 53 54 4f 50 4e 4f 44 45 53 20 68 61 73 0a  n STOPNODES has.
3810: 09 23 20 62 65 65 6e 20 72 65 61 63 68 65 64 2c  .# been reached,
3820: 20 74 72 61 76 65 72 73 69 6e 67 20 74 68 65 20   traversing the 
3830: 70 72 65 64 65 63 65 73 73 6f 72 20 61 72 63 73  predecessor arcs
3840: 2e 0a 0a 09 23 20 52 45 41 43 48 41 42 4c 45 20  ....# REACHABLE 
3850: 3a 3a 20 61 72 72 61 79 20 28 4e 4f 44 45 20 2d  :: array (NODE -
3860: 3e 20 6c 69 73 74 20 28 53 54 45 50 53 2c 20 50  > list (STEPS, P
3870: 52 45 56 49 4f 55 53 29 29 0a 09 23 0a 09 23 20  REVIOUS))..#..# 
3880: 53 65 6d 61 6e 74 69 63 73 3a 20 4e 4f 44 45 20  Semantics: NODE 
3890: 63 61 6e 20 62 65 20 72 65 61 63 68 65 64 20 66  can be reached f
38a0: 72 6f 6d 20 4e 20 69 6e 20 53 54 45 50 53 20 73  rom N in STEPS s
38b0: 74 65 70 73 2c 20 61 6e 64 0a 09 23 20 50 52 45  teps, and..# PRE
38c0: 56 49 4f 55 53 20 69 73 20 74 68 65 20 70 72 65  VIOUS is the pre
38d0: 76 69 6f 75 73 20 6e 6f 64 65 20 69 6e 20 74 68  vious node in th
38e0: 65 20 70 61 74 68 20 77 68 69 63 68 20 72 65 61  e path which rea
38f0: 63 68 65 64 20 69 74 2c 0a 09 23 20 61 6c 6c 6f  ched it,..# allo
3900: 77 69 6e 67 20 75 73 20 61 74 20 74 68 65 20 65  wing us at the e
3910: 6e 64 20 74 6f 20 63 6f 6e 73 74 72 75 63 74 20  nd to construct 
3920: 74 68 65 20 66 75 6c 6c 20 70 61 74 68 20 62 79  the full path by
3930: 0a 09 23 20 66 6f 6c 6c 6f 77 69 6e 67 20 74 68  ..# following th
3940: 65 73 65 20 62 61 63 6b 6c 69 6e 6b 73 20 66 72  ese backlinks fr
3950: 6f 6d 20 74 68 65 20 66 6f 75 6e 64 20 64 65 73  om the found des
3960: 74 69 6e 61 74 69 6f 6e 2e 20 4e 20 69 73 0a 09  tination. N is..
3970: 23 20 6f 6e 6c 79 20 69 6e 63 6c 75 64 65 64 20  # only included 
3980: 61 73 20 61 20 6b 65 79 20 69 66 20 74 68 65 72  as a key if ther
3990: 65 20 69 73 20 61 20 6c 6f 6f 70 20 6c 65 61 64  e is a loop lead
39a0: 69 6e 67 20 62 61 63 6b 20 74 6f 0a 09 23 20 69  ing back to..# i
39b0: 74 2e 0a 0a 09 23 20 50 45 4e 44 49 4e 47 20 3a  t....# PENDING :
39c0: 3a 20 6c 69 73 74 20 28 6c 69 73 74 20 28 4e 4f  : list (list (NO
39d0: 44 45 2c 20 53 54 45 50 53 29 29 0a 09 23 0a 09  DE, STEPS))..#..
39e0: 23 20 53 65 6d 61 6e 74 69 63 73 3a 20 41 20 6c  # Semantics: A l
39f0: 69 73 74 20 6f 66 20 70 6f 73 73 69 62 69 6c 69  ist of possibili
3a00: 74 69 65 73 20 74 68 61 74 20 73 74 69 6c 6c 20  ties that still 
3a10: 68 61 76 65 20 74 6f 20 62 65 0a 09 23 20 69 6e  have to be..# in
3a20: 76 65 73 74 69 67 61 74 65 64 2c 20 77 68 65 72  vestigated, wher
3a30: 65 20 53 54 45 50 53 20 69 73 20 74 68 65 20 6e  e STEPS is the n
3a40: 75 6d 62 65 72 20 6f 66 20 73 74 65 70 73 20 74  umber of steps t
3a50: 6f 20 67 65 74 20 74 6f 0a 09 23 20 4e 4f 44 45  o get to..# NODE
3a60: 2e 0a 0a 09 61 72 72 61 79 20 73 65 74 20 72 65  ....array set re
3a70: 61 63 68 61 62 6c 65 20 7b 7d 0a 09 73 65 74 20  achable {}..set 
3a80: 70 65 6e 64 69 6e 67 20 5b 6c 69 73 74 20 5b 6c  pending [list [l
3a90: 69 73 74 20 24 6e 20 30 5d 5d 0a 09 73 65 74 20  ist $n 0]]..set 
3aa0: 61 74 20 30 0a 0a 09 70 75 74 73 20 22 2a 2a 20  at 0...puts "** 
3ab0: 53 65 61 72 63 68 69 6e 67 20 73 68 6f 72 74 65  Searching shorte
3ac0: 73 74 20 70 61 74 68 20 2e 2e 2e 22 0a 0a 09 77  st path ..."...w
3ad0: 68 69 6c 65 20 7b 24 61 74 20 3c 20 5b 6c 6c 65  hile {$at < [lle
3ae0: 6e 67 74 68 20 24 70 65 6e 64 69 6e 67 5d 7d 20  ngth $pending]} 
3af0: 7b 0a 09 20 20 20 20 73 74 72 75 63 74 3a 3a 6c  {..    struct::l
3b00: 69 73 74 20 61 73 73 69 67 6e 20 5b 6c 69 6e 64  ist assign [lind
3b10: 65 78 20 24 70 65 6e 64 69 6e 67 20 24 61 74 5d  ex $pending $at]
3b20: 20 63 75 72 72 65 6e 74 20 73 74 65 70 73 0a 0a   current steps..
3b30: 09 20 20 20 20 23 70 75 74 73 20 22 2a 2a 20 5b  .    #puts "** [
3b40: 6c 69 6e 64 65 78 20 24 70 65 6e 64 69 6e 67 20  lindex $pending 
3b50: 24 61 74 5d 20 2a 2a 20 5b 24 63 75 72 72 65 6e  $at] ** [$curren
3b60: 74 20 73 74 72 5d 20 2a 2a 22 0a 09 20 20 20 20  t str] **"..    
3b70: 69 6e 63 72 20 61 74 0a 0a 09 20 20 20 20 23 20  incr at...    # 
3b80: 50 72 6f 63 65 73 73 20 74 68 65 20 70 6f 73 73  Process the poss
3b90: 69 62 69 6c 69 74 79 2e 20 54 68 69 73 20 69 73  ibility. This is
3ba0: 20 61 20 62 72 65 61 64 74 68 2d 66 69 72 73 74   a breadth-first
3bb0: 20 74 72 61 76 65 72 73 61 6c 2e 0a 09 20 20 20   traversal...   
3bc0: 20 69 6e 63 72 20 73 74 65 70 73 0a 09 20 20 20   incr steps..   
3bd0: 20 66 6f 72 65 61 63 68 20 70 72 65 20 5b 24 67   foreach pre [$g
3be0: 72 61 70 68 20 6e 6f 64 65 73 20 2d 69 6e 20 24  raph nodes -in $
3bf0: 63 75 72 72 65 6e 74 5d 20 7b 0a 09 20 20 20 20  current] {..    
3c00: 20 20 20 20 23 20 53 69 6e 63 65 20 74 68 65 20      # Since the 
3c10: 73 65 61 72 63 68 20 69 73 20 62 72 65 61 64 74  search is breadt
3c20: 68 2d 66 69 72 73 74 2c 20 77 65 20 6f 6e 6c 79  h-first, we only
3c30: 20 68 61 76 65 20 74 6f 20 23 0a 09 20 20 20 20   have to #..    
3c40: 20 20 20 20 23 20 73 65 74 20 6e 6f 64 65 73 20      # set nodes 
3c50: 74 68 61 74 20 64 6f 6e 27 74 20 61 6c 72 65 61  that don't alrea
3c60: 64 79 20 65 78 69 73 74 2e 20 49 66 20 74 68 65  dy exist. If the
3c70: 79 20 64 6f 20 74 68 65 79 0a 09 20 20 20 20 20  y do they..     
3c80: 20 20 20 23 20 68 61 76 65 20 62 65 65 6e 20 72     # have been r
3c90: 65 61 63 68 65 64 20 61 6c 72 65 61 64 79 20 6f  eached already o
3ca0: 6e 20 61 20 73 68 6f 72 74 65 72 20 70 61 74 68  n a shorter path
3cb0: 2e 0a 0a 09 09 69 66 20 7b 5b 69 6e 66 6f 20 65  .....if {[info e
3cc0: 78 69 73 74 73 20 72 65 61 63 68 61 62 6c 65 28  xists reachable(
3cd0: 24 70 72 65 29 5d 7d 20 63 6f 6e 74 69 6e 75 65  $pre)]} continue
3ce0: 0a 0a 09 09 73 65 74 20 72 65 61 63 68 61 62 6c  ....set reachabl
3cf0: 65 28 24 70 72 65 29 20 5b 6c 69 73 74 20 24 73  e($pre) [list $s
3d00: 74 65 70 73 20 24 63 75 72 72 65 6e 74 5d 0a 09  teps $current]..
3d10: 09 6c 61 70 70 65 6e 64 20 70 65 6e 64 69 6e 67  .lappend pending
3d20: 20 5b 6c 69 73 74 20 24 70 72 65 20 24 73 74 65   [list $pre $ste
3d30: 70 73 5d 0a 0a 09 09 23 20 43 6f 6e 74 69 6e 75  ps]....# Continu
3d40: 65 20 74 68 65 20 73 65 61 72 63 68 20 77 68 69  e the search whi
3d50: 6c 65 20 68 61 76 65 20 6e 6f 74 20 72 65 61 63  le have not reac
3d60: 68 65 64 20 61 6e 79 20 6f 66 0a 09 09 23 20 6f  hed any of...# o
3d70: 75 72 20 64 65 73 74 69 6e 61 74 69 6f 6e 73 3f  ur destinations?
3d80: 0a 09 09 69 66 20 7b 21 5b 73 74 72 75 63 74 3a  ...if {![struct:
3d90: 3a 73 65 74 20 63 6f 6e 74 61 69 6e 20 24 70 72  :set contain $pr
3da0: 65 20 24 73 74 6f 70 6e 6f 64 65 73 5d 7d 20 63  e $stopnodes]} c
3db0: 6f 6e 74 69 6e 75 65 0a 0a 09 09 23 20 57 65 20  ontinue....# We 
3dc0: 68 61 76 65 20 61 72 72 69 76 65 64 2c 20 50 52  have arrived, PR
3dd0: 45 20 69 73 20 6f 6e 65 20 6f 66 20 74 68 65 20  E is one of the 
3de0: 64 65 73 74 69 6e 61 74 69 6f 6e 3b 20 6e 6f 77  destination; now
3df0: 0a 09 09 23 20 63 6f 6e 73 74 72 75 63 74 20 61  ...# construct a
3e00: 6e 64 20 72 65 74 75 72 6e 20 74 68 65 20 70 61  nd return the pa
3e10: 74 68 20 74 6f 20 69 74 20 66 72 6f 6d 20 4e 20  th to it from N 
3e20: 62 79 0a 09 09 23 20 66 6f 6c 6c 6f 77 69 6e 67  by...# following
3e30: 20 74 68 65 20 62 61 63 6b 6c 69 6e 6b 73 20 69   the backlinks i
3e40: 6e 20 74 68 65 20 73 65 61 72 63 68 20 73 74 61  n the search sta
3e50: 74 65 2e 0a 09 09 73 65 74 20 70 61 74 68 20 5b  te....set path [
3e60: 6c 69 73 74 20 24 70 72 65 5d 0a 09 09 77 68 69  list $pre]...whi
3e70: 6c 65 20 7b 31 7d 20 7b 0a 09 09 20 20 20 20 73  le {1} {...    s
3e80: 65 74 20 70 72 65 20 5b 6c 69 6e 64 65 78 20 24  et pre [lindex $
3e90: 72 65 61 63 68 61 62 6c 65 28 24 70 72 65 29 20  reachable($pre) 
3ea0: 31 5d 0a 09 09 20 20 20 20 69 66 20 7b 24 70 72  1]...    if {$pr
3eb0: 65 20 65 71 20 24 6e 7d 20 62 72 65 61 6b 0a 09  e eq $n} break..
3ec0: 09 20 20 20 20 6c 61 70 70 65 6e 64 20 70 61 74  .    lappend pat
3ed0: 68 20 24 70 72 65 0a 09 09 7d 0a 09 09 6c 61 70  h $pre...}...lap
3ee0: 70 65 6e 64 20 70 61 74 68 20 24 6e 0a 0a 09 09  pend path $n....
3ef0: 70 75 74 73 20 22 2a 2a 20 53 65 61 72 63 68 69  puts "** Searchi
3f00: 6e 67 20 73 68 6f 72 74 65 73 74 20 70 61 74 68  ng shortest path
3f10: 20 2e 2e 2e 20 46 6f 75 6e 64 20 28 5b 70 72 6f   ... Found ([pro
3f20: 6a 65 63 74 20 72 65 76 20 73 74 72 6c 69 73 74  ject rev strlist
3f30: 20 24 70 61 74 68 5d 29 22 0a 09 09 72 65 74 75   $path])"...retu
3f40: 72 6e 20 24 70 61 74 68 0a 09 20 20 20 20 7d 0a  rn $path..    }.
3f50: 09 7d 0a 0a 09 70 75 74 73 20 22 2a 2a 20 53 65  .}...puts "** Se
3f60: 61 72 63 68 69 6e 67 20 73 68 6f 72 74 65 73 74  arching shortest
3f70: 20 70 61 74 68 20 2e 2e 2e 20 4e 6f 74 20 66 6f   path ... Not fo
3f80: 75 6e 64 22 0a 0a 09 23 20 4e 6f 20 70 61 74 68  und"...# No path
3f90: 20 66 6f 75 6e 64 2e 0a 09 72 65 74 75 72 6e 20   found...return 
3fa0: 7b 7d 0a 20 20 20 20 7d 0a 0a 20 20 20 20 23 20  {}.    }..    # 
3fb0: 23 20 23 23 20 23 23 23 20 23 23 23 23 23 20 23  # ## ### ##### #
3fc0: 23 23 23 23 23 23 23 20 23 23 23 23 23 23 23 23  ####### ########
3fd0: 23 23 23 23 23 0a 0a 20 20 20 20 74 79 70 65 76  #####..    typev
3fe0: 61 72 69 61 62 6c 65 20 6d 79 63 73 65 74 20 2d  ariable mycset -
3ff0: 61 72 72 61 79 20 7b 7d 20 3b 20 23 20 4d 61 70  array {} ; # Map
4000: 20 66 72 6f 6d 20 63 6f 6d 6d 69 74 20 70 6f 73   from commit pos
4010: 69 74 69 6f 6e 73 20 74 6f 20 74 68 65 0a 09 09  itions to the...
4020: 09 09 20 20 20 20 23 20 63 68 61 6e 67 65 73 65  ..    # changese
4030: 74 20 28 6f 62 6a 65 63 74 20 72 65 66 29 20 61  t (object ref) a
4040: 74 20 74 68 61 74 0a 09 09 09 09 20 20 20 20 23  t that.....    #
4050: 20 70 6f 73 69 74 69 6f 6e 2e 0a 0a 20 20 20 20   position...    
4060: 23 20 23 20 23 23 20 23 23 23 20 23 23 23 23 23  # # ## ### #####
4070: 20 23 23 23 23 23 23 23 23 20 23 23 23 23 23 23   ######## ######
4080: 23 23 23 23 23 23 23 0a 20 20 20 20 23 23 20 43  #######.    ## C
4090: 6f 6e 66 69 67 75 72 61 74 69 6f 6e 0a 0a 20 20  onfiguration..  
40a0: 20 20 70 72 61 67 6d 61 20 2d 68 61 73 69 6e 73    pragma -hasins
40b0: 74 61 6e 63 65 73 20 20 20 6e 6f 20 3b 20 23 20  tances   no ; # 
40c0: 73 69 6e 67 6c 65 74 6f 6e 0a 20 20 20 20 70 72  singleton.    pr
40d0: 61 67 6d 61 20 2d 68 61 73 74 79 70 65 69 6e 66  agma -hastypeinf
40e0: 6f 20 20 20 20 6e 6f 20 3b 20 23 20 6e 6f 20 69  o    no ; # no i
40f0: 6e 74 72 6f 73 70 65 63 74 69 6f 6e 0a 20 20 20  ntrospection.   
4100: 20 70 72 61 67 6d 61 20 2d 68 61 73 74 79 70 65   pragma -hastype
4110: 64 65 73 74 72 6f 79 20 6e 6f 20 3b 20 23 20 69  destroy no ; # i
4120: 6d 6d 6f 72 74 61 6c 0a 0a 20 20 20 20 23 20 23  mmortal..    # #
4130: 20 23 23 20 23 23 23 20 23 23 23 23 23 20 23 23   ## ### ##### ##
4140: 23 23 23 23 23 23 20 23 23 23 23 23 23 23 23 23  ###### #########
4150: 23 23 23 23 0a 7d 0a 0a 6e 61 6d 65 73 70 61 63  ####.}..namespac
4160: 65 20 65 76 61 6c 20 3a 3a 76 63 3a 3a 66 6f 73  e eval ::vc::fos
4170: 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73  sil::import::cvs
4180: 3a 3a 70 61 73 73 20 7b 0a 20 20 20 20 6e 61 6d  ::pass {.    nam
4190: 65 73 70 61 63 65 20 65 78 70 6f 72 74 20 62 72  espace export br
41a0: 65 61 6b 61 63 79 63 6c 65 0a 20 20 20 20 6e 61  eakacycle.    na
41b0: 6d 65 73 70 61 63 65 20 65 76 61 6c 20 62 72 65  mespace eval bre
41c0: 61 6b 61 63 79 63 6c 65 20 7b 0a 09 6e 61 6d 65  akacycle {..name
41d0: 73 70 61 63 65 20 69 6d 70 6f 72 74 20 3a 3a 76  space import ::v
41e0: 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72  c::fossil::impor
41f0: 74 3a 3a 63 76 73 3a 3a 63 79 63 6c 65 62 72 65  t::cvs::cyclebre
4200: 61 6b 65 72 0a 09 6e 61 6d 65 73 70 61 63 65 20  aker..namespace 
4210: 69 6d 70 6f 72 74 20 3a 3a 76 63 3a 3a 66 6f 73  import ::vc::fos
4220: 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73  sil::import::cvs
4230: 3a 3a 72 65 70 6f 73 69 74 6f 72 79 0a 09 6e 61  ::repository..na
4240: 6d 65 73 70 61 63 65 20 69 6d 70 6f 72 74 20 3a  mespace import :
4250: 3a 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70  :vc::fossil::imp
4260: 6f 72 74 3a 3a 63 76 73 3a 3a 73 74 61 74 65 0a  ort::cvs::state.
4270: 09 6e 61 6d 65 73 70 61 63 65 20 65 76 61 6c 20  .namespace eval 
4280: 70 72 6f 6a 65 63 74 20 7b 0a 09 20 20 20 20 6e  project {..    n
4290: 61 6d 65 73 70 61 63 65 20 69 6d 70 6f 72 74 20  amespace import 
42a0: 3a 3a 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d  ::vc::fossil::im
42b0: 70 6f 72 74 3a 3a 63 76 73 3a 3a 70 72 6f 6a 65  port::cvs::proje
42c0: 63 74 3a 3a 72 65 76 0a 09 7d 0a 09 6e 61 6d 65  ct::rev..}..name
42d0: 73 70 61 63 65 20 69 6d 70 6f 72 74 20 3a 3a 76  space import ::v
42e0: 63 3a 3a 74 6f 6f 6c 73 3a 3a 6d 69 73 63 3a 3a  c::tools::misc::
42f0: 2a 0a 09 6e 61 6d 65 73 70 61 63 65 20 69 6d 70  *..namespace imp
4300: 6f 72 74 20 3a 3a 76 63 3a 3a 74 6f 6f 6c 73 3a  ort ::vc::tools:
4310: 3a 74 72 6f 75 62 6c 65 0a 09 6e 61 6d 65 73 70  :trouble..namesp
4320: 61 63 65 20 69 6d 70 6f 72 74 20 3a 3a 76 63 3a  ace import ::vc:
4330: 3a 74 6f 6f 6c 73 3a 3a 6c 6f 67 0a 09 6c 6f 67  :tools::log..log
4340: 20 72 65 67 69 73 74 65 72 20 62 72 65 61 6b 61   register breaka
4350: 63 79 63 6c 65 0a 20 20 20 20 7d 0a 7d 0a 0a 23  cycle.    }.}..#
4360: 20 23 20 23 23 20 23 23 23 20 23 23 23 23 23 20   # ## ### ##### 
4370: 23 23 23 23 23 23 23 23 20 23 23 23 23 23 23 23  ######## #######
4380: 23 23 23 23 23 23 20 23 23 23 23 23 23 23 23 23  ###### #########
4390: 23 23 23 23 23 23 23 23 23 23 23 23 0a 23 23 20  ############.## 
43a0: 52 65 61 64 79 0a 0a 70 61 63 6b 61 67 65 20 70  Ready..package p
43b0: 72 6f 76 69 64 65 20 76 63 3a 3a 66 6f 73 73 69  rovide vc::fossi
43c0: 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a  l::import::cvs::
43d0: 70 61 73 73 3a 3a 62 72 65 61 6b 61 63 79 63 6c  pass::breakacycl
43e0: 65 20 31 2e 30 0a 72 65 74 75 72 6e 0a           e 1.0.return.