Hex Artifact Content
Not logged in

Artifact 949289215bcc70d65dbc5816a03f8794fa07b93d:

File tools/cvs2fossil/lib/c2f_pbreakacycle.tcl part of check-in [bf83201c7f] - Outline for more integrity checks, focusing on the changesets. by aku on 2007-11-27 02:37:51.

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 69 6e 74 65 67 72  ort::cvs::integr
06e0: 69 74 79 20 20 20 20 20 20 20 20 3b 20 23 20 53  ity        ; # S
06f0: 74 61 74 65 20 69 6e 74 65 67 72 69 74 79 20 63  tate integrity c
0700: 68 65 63 6b 73 2e 0a 70 61 63 6b 61 67 65 20 72  hecks..package r
0710: 65 71 75 69 72 65 20 76 63 3a 3a 66 6f 73 73 69  equire vc::fossi
0720: 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a  l::import::cvs::
0730: 70 72 6f 6a 65 63 74 3a 3a 72 65 76 20 20 20 20  project::rev    
0740: 20 3b 20 23 20 50 72 6f 6a 65 63 74 20 6c 65 76   ; # Project lev
0750: 65 6c 20 63 68 61 6e 67 65 73 65 74 73 0a 0a 23  el changesets..#
0760: 20 23 20 23 23 20 23 23 23 20 23 23 23 23 23 20   # ## ### ##### 
0770: 23 23 23 23 23 23 23 23 20 23 23 23 23 23 23 23  ######## #######
0780: 23 23 23 23 23 23 20 23 23 23 23 23 23 23 23 23  ###### #########
0790: 23 23 23 23 23 23 23 23 23 23 23 23 0a 23 23 20  ############.## 
07a0: 52 65 67 69 73 74 65 72 20 74 68 65 20 70 61 73  Register the pas
07b0: 73 20 77 69 74 68 20 74 68 65 20 6d 61 6e 61 67  s with the manag
07c0: 65 6d 65 6e 74 0a 0a 76 63 3a 3a 66 6f 73 73 69  ement..vc::fossi
07d0: 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a  l::import::cvs::
07e0: 70 61 73 73 20 64 65 66 69 6e 65 20 5c 0a 20 20  pass define \.  
07f0: 20 20 42 72 65 61 6b 41 6c 6c 43 73 65 74 43 79    BreakAllCsetCy
0800: 63 6c 65 73 20 5c 0a 20 20 20 20 7b 42 72 65 61  cles \.    {Brea
0810: 6b 20 52 65 6d 61 69 6e 69 6e 67 20 43 68 61 6e  k Remaining Chan
0820: 67 65 53 65 74 20 44 65 70 65 6e 64 65 6e 63 79  geSet Dependency
0830: 20 43 79 63 6c 65 73 7d 20 5c 0a 20 20 20 20 3a   Cycles} \.    :
0840: 3a 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70  :vc::fossil::imp
0850: 6f 72 74 3a 3a 63 76 73 3a 3a 70 61 73 73 3a 3a  ort::cvs::pass::
0860: 62 72 65 61 6b 61 63 79 63 6c 65 0a 0a 23 20 23  breakacycle..# #
0870: 20 23 23 20 23 23 23 20 23 23 23 23 23 20 23 23   ## ### ##### ##
0880: 23 23 23 23 23 23 20 23 23 23 23 23 23 23 23 23  ###### #########
0890: 23 23 23 23 20 23 23 23 23 23 23 23 23 23 23 23  #### ###########
08a0: 23 23 23 23 23 23 23 23 23 23 0a 23 23 0a 0a 73  ##########.##..s
08b0: 6e 69 74 3a 3a 74 79 70 65 20 3a 3a 76 63 3a 3a  nit::type ::vc::
08c0: 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a  fossil::import::
08d0: 63 76 73 3a 3a 70 61 73 73 3a 3a 62 72 65 61 6b  cvs::pass::break
08e0: 61 63 79 63 6c 65 20 7b 0a 20 20 20 20 23 20 23  acycle {.    # #
08f0: 20 23 23 20 23 23 23 20 23 23 23 23 23 20 23 23   ## ### ##### ##
0900: 23 23 23 23 23 23 20 23 23 23 23 23 23 23 23 23  ###### #########
0910: 23 23 23 23 0a 20 20 20 20 23 23 20 50 75 62 6c  ####.    ## Publ
0920: 69 63 20 41 50 49 0a 0a 20 20 20 20 74 79 70 65  ic API..    type
0930: 6d 65 74 68 6f 64 20 73 65 74 75 70 20 7b 7d 20  method setup {} 
0940: 7b 0a 09 23 20 44 65 66 69 6e 65 20 74 68 65 20  {..# Define the 
0950: 6e 61 6d 65 73 20 61 6e 64 20 73 74 72 75 63 74  names and struct
0960: 75 72 65 20 6f 66 20 74 68 65 20 70 65 72 73 69  ure of the persi
0970: 73 74 65 6e 74 20 73 74 61 74 65 20 6f 66 0a 09  stent state of..
0980: 23 20 74 68 69 73 20 70 61 73 73 2e 0a 0a 09 73  # this pass....s
0990: 74 61 74 65 20 72 65 61 64 69 6e 67 20 63 73 6f  tate reading cso
09a0: 72 64 65 72 0a 09 72 65 74 75 72 6e 0a 20 20 20  rder..return.   
09b0: 20 7d 0a 0a 20 20 20 20 74 79 70 65 6d 65 74 68   }..    typemeth
09c0: 6f 64 20 6c 6f 61 64 20 7b 7d 20 7b 0a 09 23 20  od load {} {..# 
09d0: 50 61 73 73 20 6d 61 6e 61 67 65 72 20 69 6e 74  Pass manager int
09e0: 65 72 66 61 63 65 2e 20 45 78 65 63 75 74 65 64  erface. Executed
09f0: 20 74 6f 20 6c 6f 61 64 20 64 61 74 61 20 63 6f   to load data co
0a00: 6d 70 75 74 65 64 20 62 79 0a 09 23 20 74 68 69  mputed by..# thi
0a10: 73 20 70 61 73 73 20 69 6e 74 6f 20 6d 65 6d 6f  s pass into memo
0a20: 72 79 20 77 68 65 6e 20 74 68 69 73 20 70 61 73  ry when this pas
0a30: 73 20 69 73 20 73 6b 69 70 70 65 64 20 69 6e 73  s is skipped ins
0a40: 74 65 61 64 20 6f 66 0a 09 23 20 65 78 65 63 75  tead of..# execu
0a50: 74 65 64 2e 0a 09 72 65 74 75 72 6e 0a 20 20 20  ted...return.   
0a60: 20 7d 0a 0a 20 20 20 20 74 79 70 65 6d 65 74 68   }..    typemeth
0a70: 6f 64 20 72 75 6e 20 7b 7d 20 7b 0a 09 23 20 50  od run {} {..# P
0a80: 61 73 73 20 6d 61 6e 61 67 65 72 20 69 6e 74 65  ass manager inte
0a90: 72 66 61 63 65 2e 20 45 78 65 63 75 74 65 64 20  rface. Executed 
0aa0: 74 6f 20 70 65 72 66 6f 72 6d 20 74 68 65 0a 09  to perform the..
0ab0: 23 20 66 75 6e 63 74 69 6f 6e 61 6c 69 74 79 20  # functionality 
0ac0: 6f 66 20 74 68 65 20 70 61 73 73 2e 0a 0a 09 73  of the pass....s
0ad0: 65 74 20 6c 65 6e 20 5b 73 74 72 69 6e 67 20 6c  et len [string l
0ae0: 65 6e 67 74 68 20 5b 70 72 6f 6a 65 63 74 3a 3a  ength [project::
0af0: 72 65 76 20 6e 75 6d 5d 5d 0a 09 73 65 74 20 6d  rev num]]..set m
0b00: 79 61 74 66 6d 74 20 25 24 7b 6c 65 6e 7d 73 0a  yatfmt %${len}s.
0b10: 09 69 6e 63 72 20 6c 65 6e 20 36 0a 09 73 65 74  .incr len 6..set
0b20: 20 6d 79 63 73 66 6d 74 20 25 24 7b 6c 65 6e 7d   mycsfmt %${len}
0b30: 73 0a 0a 09 63 79 63 6c 65 62 72 65 61 6b 65 72  s...cyclebreaker
0b40: 20 70 72 65 63 6d 64 20 20 20 5b 6d 79 70 72 6f   precmd   [mypro
0b50: 63 20 42 72 65 61 6b 42 61 63 6b 77 61 72 64 42  c BreakBackwardB
0b60: 72 61 6e 63 68 65 73 5d 0a 09 63 79 63 6c 65 62  ranches]..cycleb
0b70: 72 65 61 6b 65 72 20 73 61 76 65 63 6d 64 20 20  reaker savecmd  
0b80: 5b 6d 79 70 72 6f 63 20 4b 65 65 70 4f 72 64 65  [myproc KeepOrde
0b90: 72 5d 0a 09 63 79 63 6c 65 62 72 65 61 6b 65 72  r]..cyclebreaker
0ba0: 20 62 72 65 61 6b 63 6d 64 20 5b 6d 79 70 72 6f   breakcmd [mypro
0bb0: 63 20 42 72 65 61 6b 43 79 63 6c 65 5d 0a 0a 09  c BreakCycle]...
0bc0: 73 74 61 74 65 20 74 72 61 6e 73 61 63 74 69 6f  state transactio
0bd0: 6e 20 7b 0a 09 20 20 20 20 4c 6f 61 64 43 6f 6d  n {..    LoadCom
0be0: 6d 69 74 4f 72 64 65 72 0a 09 20 20 20 20 63 79  mitOrder..    cy
0bf0: 63 6c 65 62 72 65 61 6b 65 72 20 72 75 6e 20 62  clebreaker run b
0c00: 72 65 61 6b 2d 61 6c 6c 20 5b 6d 79 70 72 6f 63  reak-all [myproc
0c10: 20 43 68 61 6e 67 65 73 65 74 73 5d 0a 0a 09 20   Changesets]... 
0c20: 20 20 20 72 65 70 6f 73 69 74 6f 72 79 20 70 72     repository pr
0c30: 69 6e 74 63 73 65 74 73 74 61 74 69 73 74 69 63  intcsetstatistic
0c40: 73 0a 09 20 20 20 20 69 6e 74 65 67 72 69 74 79  s..    integrity
0c50: 20 63 68 61 6e 67 65 73 65 74 73 0a 09 7d 0a 09   changesets..}..
0c60: 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20  return.    }..  
0c70: 20 20 74 79 70 65 6d 65 74 68 6f 64 20 64 69 73    typemethod dis
0c80: 63 61 72 64 20 7b 7d 20 7b 0a 09 23 20 50 61 73  card {} {..# Pas
0c90: 73 20 6d 61 6e 61 67 65 72 20 69 6e 74 65 72 66  s manager interf
0ca0: 61 63 65 2e 20 45 78 65 63 75 74 65 64 20 66 6f  ace. Executed fo
0cb0: 72 20 61 6c 6c 20 70 61 73 73 65 73 20 61 66 74  r all passes aft
0cc0: 65 72 20 74 68 65 0a 09 23 20 72 75 6e 20 70 61  er the..# run pa
0cd0: 73 73 65 73 2c 20 74 6f 20 72 65 6d 6f 76 65 20  sses, to remove 
0ce0: 61 6c 6c 20 64 61 74 61 20 6f 66 20 74 68 69 73  all data of this
0cf0: 20 70 61 73 73 20 66 72 6f 6d 20 74 68 65 20 73   pass from the s
0d00: 74 61 74 65 2c 0a 09 23 20 61 73 20 62 65 69 6e  tate,..# as bein
0d10: 67 20 6f 75 74 20 6f 66 20 64 61 74 65 2e 0a 09  g out of date...
0d20: 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20  return.    }..  
0d30: 20 20 23 20 23 20 23 23 20 23 23 23 20 23 23 23    # # ## ### ###
0d40: 23 23 20 23 23 23 23 23 23 23 23 20 23 23 23 23  ## ######## ####
0d50: 23 23 23 23 23 23 23 23 23 0a 20 20 20 20 23 23  #########.    ##
0d60: 20 49 6e 74 65 72 6e 61 6c 20 6d 65 74 68 6f 64   Internal method
0d70: 73 0a 0a 20 20 20 20 70 72 6f 63 20 43 68 61 6e  s..    proc Chan
0d80: 67 65 73 65 74 73 20 7b 7d 20 7b 20 70 72 6f 6a  gesets {} { proj
0d90: 65 63 74 3a 3a 72 65 76 20 61 6c 6c 20 7d 0a 0a  ect::rev all }..
0da0: 20 20 20 20 70 72 6f 63 20 4c 6f 61 64 43 6f 6d      proc LoadCom
0db0: 6d 69 74 4f 72 64 65 72 20 7b 7d 20 7b 0a 09 3a  mitOrder {} {..:
0dc0: 3a 76 61 72 69 61 62 6c 65 20 6d 79 63 73 65 74  :variable mycset
0dd0: 0a 09 3a 3a 76 61 72 69 61 62 6c 65 20 6d 79 72  ..::variable myr
0de0: 65 76 69 73 69 6f 6e 63 68 61 6e 67 65 73 65 74  evisionchangeset
0df0: 73 0a 0a 09 73 74 61 74 65 20 74 72 61 6e 73 61  s...state transa
0e00: 63 74 69 6f 6e 20 7b 0a 09 20 20 20 20 66 6f 72  ction {..    for
0e10: 65 61 63 68 20 7b 63 69 64 20 70 6f 73 7d 20 5b  each {cid pos} [
0e20: 73 74 61 74 65 20 72 75 6e 20 7b 20 53 45 4c 45  state run { SELE
0e30: 43 54 20 63 69 64 2c 20 70 6f 73 20 46 52 4f 4d  CT cid, pos FROM
0e40: 20 63 73 6f 72 64 65 72 20 7d 5d 20 7b 0a 09 09   csorder }] {...
0e50: 73 65 74 20 63 73 65 74 20 5b 70 72 6f 6a 65 63  set cset [projec
0e60: 74 3a 3a 72 65 76 20 6f 66 20 24 63 69 64 5d 0a  t::rev of $cid].
0e70: 09 09 24 63 73 65 74 20 73 65 74 70 6f 73 20 24  ..$cset setpos $
0e80: 70 6f 73 0a 09 09 73 65 74 20 6d 79 63 73 65 74  pos...set mycset
0e90: 28 24 70 6f 73 29 20 24 63 73 65 74 0a 09 09 6c  ($pos) $cset...l
0ea0: 61 70 70 65 6e 64 20 6d 79 72 65 76 69 73 69 6f  append myrevisio
0eb0: 6e 63 68 61 6e 67 65 73 65 74 73 20 24 63 73 65  nchangesets $cse
0ec0: 74 0a 09 20 20 20 20 7d 0a 09 20 20 20 20 23 20  t..    }..    # 
0ed0: 52 65 6d 6f 76 65 20 74 68 65 20 6f 72 64 65 72  Remove the order
0ee0: 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 6e 6f 77   information now
0ef0: 20 74 68 61 74 20 77 65 20 68 61 76 65 20 69 74   that we have it
0f00: 20 69 6e 0a 09 20 20 20 20 23 20 6d 65 6d 6f 72   in..    # memor
0f10: 79 2c 20 73 6f 20 74 68 61 74 20 77 65 20 63 61  y, so that we ca
0f20: 6e 20 73 61 76 65 20 69 74 20 6f 6e 63 65 20 6d  n save it once m
0f30: 6f 72 65 2c 20 66 6f 72 20 61 6c 6c 0a 09 20 20  ore, for all..  
0f40: 20 20 23 20 63 68 61 6e 67 65 73 65 74 73 2c 20    # changesets, 
0f50: 77 68 69 6c 65 20 62 72 65 61 6b 69 6e 67 20 74  while breaking t
0f60: 68 65 20 72 65 6d 61 69 6e 69 6e 67 20 63 79 63  he remaining cyc
0f70: 6c 65 73 2e 0a 09 20 20 20 20 73 74 61 74 65 20  les...    state 
0f80: 72 75 6e 20 7b 20 44 45 4c 45 54 45 20 46 52 4f  run { DELETE FRO
0f90: 4d 20 63 73 6f 72 64 65 72 20 7d 0a 09 7d 0a 09  M csorder }..}..
0fa0: 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20  return.    }..  
0fb0: 20 20 23 20 23 20 23 23 20 23 23 23 20 23 23 23    # # ## ### ###
0fc0: 23 23 20 23 23 23 23 23 23 23 23 20 23 23 23 23  ## ######## ####
0fd0: 23 23 23 23 23 23 23 23 23 0a 0a 20 20 20 20 70  #########..    p
0fe0: 72 6f 63 20 42 72 65 61 6b 42 61 63 6b 77 61 72  roc BreakBackwar
0ff0: 64 42 72 61 6e 63 68 65 73 20 7b 67 72 61 70 68  dBranches {graph
1000: 7d 20 7b 0a 09 23 20 57 65 20 67 6f 20 6f 76 65  } {..# We go ove
1010: 72 20 61 6c 6c 20 62 72 61 6e 63 68 20 63 68 61  r all branch cha
1020: 6e 67 65 73 65 74 73 2c 20 69 2e 65 2e 20 74 68  ngesets, i.e. th
1030: 65 20 63 68 61 6e 67 65 73 65 74 73 0a 09 23 20  e changesets..# 
1040: 63 72 65 61 74 65 64 20 62 79 20 74 68 65 20 73  created by the s
1050: 79 6d 62 6f 6c 73 20 77 68 69 63 68 20 61 72 65  ymbols which are
1060: 20 74 72 61 6e 73 6c 61 74 65 64 20 61 73 20 62   translated as b
1070: 72 61 6e 63 68 65 73 2c 20 61 6e 64 0a 09 23 20  ranches, and..# 
1080: 62 72 65 61 6b 20 61 6e 79 20 77 68 69 63 68 20  break any which 
1090: 61 72 65 20 27 62 61 63 6b 77 61 72 64 27 2c 20  are 'backward', 
10a0: 77 68 69 63 68 20 6d 65 61 6e 73 20 74 68 61 74  which means that
10b0: 20 74 68 65 79 20 68 61 76 65 0a 09 23 20 61 74   they have..# at
10c0: 20 6c 65 61 73 74 20 6f 6e 65 20 69 6e 63 6f 6d   least one incom
10d0: 69 6e 67 20 72 65 76 69 73 69 6f 6e 20 63 68 61  ing revision cha
10e0: 6e 67 65 73 65 74 20 77 68 69 63 68 20 69 73 20  ngeset which is 
10f0: 63 6f 6d 6d 69 74 74 65 64 0a 09 23 20 61 66 74  committed..# aft
1100: 65 72 20 61 74 20 6c 65 61 73 74 20 6f 6e 65 20  er at least one 
1110: 6f 66 20 74 68 65 20 6f 75 74 67 6f 69 6e 67 20  of the outgoing 
1120: 72 65 76 69 73 69 6f 6e 20 63 68 61 6e 67 65 73  revision changes
1130: 65 74 73 2c 20 70 65 72 0a 09 23 20 74 68 65 20  ets, per..# the 
1140: 6f 72 64 65 72 20 63 6f 6d 70 75 74 65 64 20 69  order computed i
1150: 6e 20 70 61 73 73 20 36 2e 20 49 6e 20 22 63 76  n pass 6. In "cv
1160: 73 32 73 76 6e 22 20 74 68 69 73 20 69 73 20 63  s2svn" this is c
1170: 61 6c 6c 65 64 0a 09 23 20 22 72 65 74 72 6f 67  alled..# "retrog
1180: 72 61 64 65 22 2e 0a 0a 09 23 20 4e 4f 54 45 3a  rade"....# NOTE:
1190: 20 57 65 20 6d 69 67 68 74 20 62 65 20 61 62 6c   We might be abl
11a0: 65 20 74 6f 20 75 73 65 20 6f 75 72 20 6b 6e 6f  e to use our kno
11b0: 77 6c 65 64 67 65 20 74 68 61 74 20 77 65 20 61  wledge that we a
11c0: 72 65 0a 09 23 20 6c 6f 6f 6b 69 6e 67 20 61 74  re..# looking at
11d0: 20 61 6c 6c 20 63 68 61 6e 67 65 73 65 74 73 20   all changesets 
11e0: 74 6f 20 63 72 65 61 74 65 20 61 20 73 71 6c 20  to create a sql 
11f0: 77 68 69 63 68 20 73 65 6c 65 63 74 73 20 61 6c  which selects al
1200: 6c 0a 09 23 20 74 68 65 20 62 72 61 6e 63 68 20  l..# the branch 
1210: 63 68 61 6e 67 65 73 65 74 73 20 66 72 6f 6d 20  changesets from 
1220: 74 68 65 20 73 74 61 74 65 20 69 6e 20 6f 6e 65  the state in one
1230: 20 67 6f 20 69 6e 73 74 65 61 64 20 6f 66 0a 09   go instead of..
1240: 23 20 68 61 76 69 6e 67 20 74 6f 20 63 68 65 63  # having to chec
1250: 6b 20 65 61 63 68 20 63 68 61 6e 67 65 73 65 74  k each changeset
1260: 20 73 65 70 61 72 61 74 65 6c 79 2e 20 43 6f 6e   separately. Con
1270: 73 69 64 65 72 20 74 68 69 73 0a 09 23 20 6c 61  sider this..# la
1280: 74 65 72 2c 20 67 65 74 20 74 68 65 20 70 61 73  ter, get the pas
1290: 73 20 77 6f 72 6b 69 6e 67 20 66 69 72 73 74 2e  s working first.
12a0: 0a 09 23 0a 09 23 20 4e 4f 54 45 20 32 3a 20 4d  ..#..# NOTE 2: M
12b0: 69 67 68 74 20 77 65 20 65 76 65 6e 20 62 65 20  ight we even be 
12c0: 61 62 6c 65 20 74 6f 20 73 65 6c 65 63 74 20 74  able to select t
12d0: 68 65 20 62 61 63 6b 77 61 72 64 20 62 72 61 6e  he backward bran
12e0: 63 68 0a 09 23 20 63 68 61 6e 67 65 73 65 74 73  ch..# changesets
12f0: 20 74 6f 6f 20 3f 0a 0a 09 66 6f 72 65 61 63 68   too ?...foreach
1300: 20 63 73 65 74 20 5b 24 67 72 61 70 68 20 6e 6f   cset [$graph no
1310: 64 65 73 5d 20 7b 0a 09 20 20 20 20 69 66 20 7b  des] {..    if {
1320: 21 5b 24 63 73 65 74 20 69 73 62 72 61 6e 63 68  ![$cset isbranch
1330: 5d 7d 20 63 6f 6e 74 69 6e 75 65 0a 09 20 20 20  ]} continue..   
1340: 20 43 68 65 63 6b 41 6e 64 42 72 65 61 6b 42 61   CheckAndBreakBa
1350: 63 6b 77 61 72 64 42 72 61 6e 63 68 20 24 67 72  ckwardBranch $gr
1360: 61 70 68 20 24 63 73 65 74 0a 09 7d 0a 09 72 65  aph $cset..}..re
1370: 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20  turn.    }..    
1380: 70 72 6f 63 20 43 68 65 63 6b 41 6e 64 42 72 65  proc CheckAndBre
1390: 61 6b 42 61 63 6b 77 61 72 64 42 72 61 6e 63 68  akBackwardBranch
13a0: 20 7b 67 72 61 70 68 20 63 73 65 74 7d 20 7b 0a   {graph cset} {.
13b0: 09 77 68 69 6c 65 20 7b 5b 49 73 41 42 61 63 6b  .while {[IsABack
13c0: 77 61 72 64 42 72 61 6e 63 68 20 24 67 72 61 70  wardBranch $grap
13d0: 68 20 24 63 73 65 74 5d 7d 20 7b 0a 09 20 20 20  h $cset]} {..   
13e0: 20 6c 6f 67 20 77 72 69 74 65 20 35 20 62 72 65   log write 5 bre
13f0: 61 6b 61 63 79 63 6c 65 20 22 42 72 65 61 6b 69  akacycle "Breaki
1400: 6e 67 20 62 61 63 6b 77 61 72 64 20 62 72 61 6e  ng backward bran
1410: 63 68 20 63 68 61 6e 67 65 73 65 74 20 5b 24 63  ch changeset [$c
1420: 73 65 74 20 73 74 72 5d 22 0a 0a 09 20 20 20 20  set str]"...    
1430: 23 20 4b 6e 6f 77 69 6e 67 20 74 68 61 74 20 74  # Knowing that t
1440: 68 65 20 62 72 61 6e 63 68 20 69 73 20 62 61 63  he branch is bac
1450: 6b 77 61 72 64 20 77 65 20 6e 6f 77 20 6c 6f 6f  kward we now loo
1460: 6b 20 61 74 20 74 68 65 0a 09 20 20 20 20 23 20  k at the..    # 
1470: 69 6e 64 69 76 69 64 75 61 6c 20 72 65 76 69 73  individual revis
1480: 69 6f 6e 73 20 69 6e 20 74 68 65 20 63 68 61 6e  ions in the chan
1490: 67 65 73 65 74 20 61 6e 64 20 64 65 74 65 72 6d  geset and determ
14a0: 69 6e 65 0a 09 20 20 20 20 23 20 77 68 69 63 68  ine..    # which
14b0: 20 6f 66 20 74 68 65 6d 20 61 72 65 20 72 65 73   of them are res
14c0: 70 6f 6e 73 69 62 6c 65 20 66 6f 72 20 74 68 65  ponsible for the
14d0: 20 6f 76 65 72 6c 61 70 2e 20 54 68 69 73 0a 09   overlap. This..
14e0: 20 20 20 20 23 20 61 6c 6c 6f 77 73 20 75 73 20      # allows us 
14f0: 74 6f 20 73 70 6c 69 74 20 74 68 65 6d 20 69 6e  to split them in
1500: 74 6f 20 74 77 6f 20 73 65 74 73 2c 20 6f 6e 65  to two sets, one
1510: 20 6f 66 0a 09 20 20 20 20 23 20 6e 6f 6e 2d 6f   of..    # non-o
1520: 76 65 72 6c 61 70 70 69 6e 67 20 72 65 76 69 73  verlapping revis
1530: 69 6f 6e 73 2c 20 61 6e 64 20 6f 66 20 6f 76 65  ions, and of ove
1540: 72 6c 61 70 70 69 6e 67 20 6f 6e 65 73 2e 20 45  rlapping ones. E
1550: 61 63 68 0a 09 20 20 20 20 23 20 69 6e 64 75 63  ach..    # induc
1560: 65 73 20 61 20 6e 65 77 20 63 68 61 6e 67 65 73  es a new changes
1570: 65 74 2c 20 61 6e 64 20 74 68 65 20 73 65 63 6f  et, and the seco
1580: 6e 64 20 6d 61 79 20 73 74 69 6c 6c 20 62 65 0a  nd may still be.
1590: 09 20 20 20 20 23 20 62 61 63 6b 77 61 72 64 20  .    # backward 
15a0: 61 6e 64 20 6e 65 65 64 20 66 75 72 74 68 65 72  and need further
15b0: 20 73 70 6c 69 74 74 69 6e 67 2e 20 48 65 6e 63   splitting. Henc
15c0: 65 20 74 68 65 20 6c 6f 6f 70 69 6e 67 2e 0a 09  e the looping...
15d0: 20 20 20 20 23 0a 09 20 20 20 20 23 20 54 68 65      #..    # The
15e0: 20 62 6f 72 64 65 72 20 75 73 65 64 20 66 6f 72   border used for
15f0: 20 74 68 65 20 73 70 6c 69 74 20 69 73 20 74 68   the split is th
1600: 65 20 6d 69 6e 69 6d 61 6c 20 63 6f 6d 6d 69 74  e minimal commit
1610: 0a 09 20 20 20 20 23 20 70 6f 73 69 74 69 6f 6e  ..    # position
1620: 20 61 6d 6f 6e 67 20 74 68 65 20 6d 69 6e 69 6d   among the minim
1630: 61 6c 20 73 75 63 65 73 73 6f 72 20 63 6f 6d 6d  al sucessor comm
1640: 69 74 20 70 6f 73 69 74 69 6f 6e 73 20 66 6f 72  it positions for
1650: 0a 09 20 20 20 20 23 20 74 68 65 20 72 65 76 69  ..    # the revi
1660: 73 69 6f 6e 73 20 69 6e 20 74 68 65 20 63 68 61  sions in the cha
1670: 6e 67 65 73 65 74 2e 0a 0a 09 20 20 20 20 23 20  ngeset....    # 
1680: 4e 6f 74 65 20 74 68 61 74 20 69 6e 64 69 76 69  Note that indivi
1690: 64 75 61 6c 20 72 65 76 69 73 69 6f 6e 73 20 6d  dual revisions m
16a0: 61 79 20 6e 6f 74 20 68 61 76 65 20 72 65 76 69  ay not have revi
16b0: 73 69 6f 6e 0a 09 20 20 20 20 23 20 63 68 61 6e  sion..    # chan
16c0: 67 65 73 65 74 73 20 61 72 65 20 70 72 65 64 65  gesets are prede
16d0: 63 65 73 73 6f 72 73 20 61 6e 64 2f 6f 72 20 73  cessors and/or s
16e0: 75 63 63 65 73 73 6f 72 73 2c 20 6c 65 61 76 69  uccessors, leavi
16f0: 6e 67 0a 09 20 20 20 20 23 20 74 68 65 20 6c 69  ng..    # the li
1700: 6d 69 74 73 20 70 61 72 74 69 61 6c 6c 79 20 6f  mits partially o
1710: 72 20 63 6f 6d 70 6c 65 74 65 6c 79 20 75 6e 64  r completely und
1720: 65 66 69 6e 65 64 2e 0a 0a 09 20 20 20 20 23 20  efined....    # 
1730: 6c 69 6d 69 74 73 20 3a 20 64 69 63 74 20 28 72  limits : dict (r
1740: 65 76 69 73 69 6f 6e 20 2d 3e 20 6c 69 73 74 20  evision -> list 
1750: 28 6d 61 78 20 70 72 65 64 65 63 65 73 73 6f 72  (max predecessor
1760: 20 63 6f 6d 6d 69 74 2c 20 6d 69 6e 20 73 75 63   commit, min suc
1770: 65 73 73 6f 72 20 63 6f 6d 6d 69 74 29 29 0a 0a  essor commit))..
1780: 09 20 20 20 20 43 6f 6d 70 75 74 65 4c 69 6d 69  .    ComputeLimi
1790: 74 73 20 24 63 73 65 74 20 6c 69 6d 69 74 73 20  ts $cset limits 
17a0: 62 6f 72 64 65 72 0a 0a 09 20 20 20 20 6c 6f 67  border...    log
17b0: 20 77 72 69 74 65 20 36 20 62 72 65 61 6b 61 63   write 6 breakac
17c0: 79 63 6c 65 20 22 55 73 69 6e 67 20 63 6f 6d 6d  ycle "Using comm
17d0: 69 74 20 70 6f 73 69 74 69 6f 6e 20 24 62 6f 72  it position $bor
17e0: 64 65 72 20 61 73 20 62 6f 72 64 65 72 22 0a 0a  der as border"..
17f0: 09 20 20 20 20 23 20 54 68 65 6e 20 77 65 20 73  .    # Then we s
1800: 6f 72 74 20 74 68 65 20 66 69 6c 65 20 6c 65 76  ort the file lev
1810: 65 6c 20 69 74 65 6d 73 20 62 61 73 65 64 20 6f  el items based o
1820: 6e 20 74 68 65 72 65 20 74 68 65 79 0a 09 20 20  n there they..  
1830: 20 20 23 20 73 69 74 20 72 65 6c 61 74 69 76 65    # sit relative
1840: 20 74 6f 20 74 68 65 20 62 6f 72 64 65 72 20 69   to the border i
1850: 6e 74 6f 20 62 65 66 6f 72 65 20 61 6e 64 20 61  nto before and a
1860: 66 74 65 72 20 74 68 65 0a 09 20 20 20 20 23 20  fter the..    # 
1870: 62 6f 72 64 65 72 2e 0a 0a 09 20 20 20 20 53 70  border....    Sp
1880: 6c 69 74 52 65 76 69 73 69 6f 6e 73 20 24 6c 69  litRevisions $li
1890: 6d 69 74 73 20 24 62 6f 72 64 65 72 20 6e 6f 72  mits $border nor
18a0: 6d 61 6c 72 65 76 69 73 69 6f 6e 73 20 62 61 63  malrevisions bac
18b0: 6b 77 61 72 64 72 65 76 69 73 69 6f 6e 73 0a 0a  kwardrevisions..
18c0: 09 20 20 20 20 73 65 74 20 72 65 70 6c 61 63 65  .    set replace
18d0: 6d 65 6e 74 73 20 5b 70 72 6f 6a 65 63 74 3a 3a  ments [project::
18e0: 72 65 76 20 73 70 6c 69 74 20 24 63 73 65 74 20  rev split $cset 
18f0: 24 6e 6f 72 6d 61 6c 72 65 76 69 73 69 6f 6e 73  $normalrevisions
1900: 20 24 62 61 63 6b 77 61 72 64 72 65 76 69 73 69   $backwardrevisi
1910: 6f 6e 73 5d 0a 09 20 20 20 20 63 79 63 6c 65 62  ons]..    cycleb
1920: 72 65 61 6b 65 72 20 72 65 70 6c 61 63 65 20 24  reaker replace $
1930: 67 72 61 70 68 20 24 63 73 65 74 20 24 72 65 70  graph $cset $rep
1940: 6c 61 63 65 6d 65 6e 74 73 0a 0a 09 20 20 20 20  lacements...    
1950: 23 20 41 74 20 6c 61 73 74 20 63 68 65 63 6b 20  # At last check 
1960: 74 68 61 74 20 74 68 65 20 6e 6f 72 6d 61 6c 20  that the normal 
1970: 66 72 61 6d 65 6e 74 20 69 73 20 69 6e 64 65 65  frament is indee
1980: 64 20 6e 6f 74 0a 09 20 20 20 20 23 20 62 61 63  d not..    # bac
1990: 6b 77 61 72 64 2c 20 61 6e 64 20 69 74 65 72 61  kward, and itera
19a0: 74 65 20 6f 76 65 72 20 74 68 65 20 70 6f 73 73  te over the poss
19b0: 69 62 6c 79 20 73 74 69 6c 6c 20 62 61 63 6b 77  ibly still backw
19c0: 61 72 64 0a 09 20 20 20 20 23 20 73 65 63 6f 6e  ard..    # secon
19d0: 64 20 66 72 61 67 6d 65 6e 74 2e 0a 0a 09 20 20  d fragment....  
19e0: 20 20 73 74 72 75 63 74 3a 3a 6c 69 73 74 20 61    struct::list a
19f0: 73 73 69 67 6e 20 24 72 65 70 6c 61 63 65 6d 65  ssign $replaceme
1a00: 6e 74 73 20 6e 6f 72 6d 61 6c 20 62 61 63 6b 77  nts normal backw
1a10: 61 72 64 0a 09 20 20 20 20 69 66 20 7b 5b 49 73  ard..    if {[Is
1a20: 41 42 61 63 6b 77 61 72 64 42 72 61 6e 63 68 20  ABackwardBranch 
1a30: 24 67 72 61 70 68 20 24 6e 6f 72 6d 61 6c 5d 7d  $graph $normal]}
1a40: 20 7b 20 74 72 6f 75 62 6c 65 20 69 6e 74 65 72   { trouble inter
1a50: 6e 61 6c 20 22 54 68 65 20 6e 6f 72 6d 61 6c 20  nal "The normal 
1a60: 66 72 61 67 6d 65 6e 74 20 69 73 20 75 6e 65 78  fragment is unex
1a70: 70 65 63 74 65 64 6c 79 20 61 20 62 61 63 6b 77  pectedly a backw
1a80: 61 72 64 20 62 72 61 6e 63 68 22 20 7d 0a 0a 09  ard branch" }...
1a90: 20 20 20 20 73 65 74 20 63 73 65 74 20 24 62 61      set cset $ba
1aa0: 63 6b 77 61 72 64 0a 09 7d 0a 09 72 65 74 75 72  ckward..}..retur
1ab0: 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 70 72 6f  n.    }..    pro
1ac0: 63 20 49 73 41 42 61 63 6b 77 61 72 64 42 72 61  c IsABackwardBra
1ad0: 6e 63 68 20 7b 64 67 20 63 73 65 74 7d 20 7b 0a  nch {dg cset} {.
1ae0: 09 23 20 41 20 62 72 61 6e 63 68 20 69 73 20 22  .# A branch is "
1af0: 62 61 63 6b 77 61 72 64 22 20 69 66 20 69 74 20  backward" if it 
1b00: 68 61 73 20 61 74 20 6c 65 61 73 74 20 6f 6e 65  has at least one
1b10: 20 69 6e 63 6f 6d 69 6e 67 0a 09 23 20 72 65 76   incoming..# rev
1b20: 69 73 69 6f 6e 20 63 68 61 6e 67 65 73 65 74 20  ision changeset 
1b30: 77 68 69 63 68 20 69 73 20 63 6f 6d 6d 69 74 74  which is committ
1b40: 65 64 20 61 66 74 65 72 20 61 74 20 6c 65 61 73  ed after at leas
1b50: 74 20 6f 6e 65 20 6f 66 0a 09 23 20 74 68 65 20  t one of..# the 
1b60: 6f 75 74 67 6f 69 6e 67 20 72 65 76 69 73 69 6f  outgoing revisio
1b70: 6e 20 63 68 61 6e 67 65 73 65 74 73 2c 20 70 65  n changesets, pe
1b80: 72 20 74 68 65 20 6f 72 64 65 72 20 63 6f 6d 70  r the order comp
1b90: 75 74 65 64 20 69 6e 0a 09 23 20 70 61 73 73 20  uted in..# pass 
1ba0: 36 2e 0a 0a 09 23 20 52 65 70 68 72 61 73 65 64  6....# Rephrased
1bb0: 2c 20 74 68 65 20 6d 61 78 69 6d 61 6c 20 63 6f  , the maximal co
1bc0: 6d 6d 69 74 20 70 6f 73 69 74 69 6f 6e 20 66 6f  mmit position fo
1bd0: 75 6e 64 20 61 6d 6f 6e 67 20 74 68 65 0a 09 23  und among the..#
1be0: 20 69 6e 63 6f 6d 69 6e 67 20 72 65 76 69 73 69   incoming revisi
1bf0: 6f 6e 20 63 68 61 6e 67 65 73 65 74 73 20 69 73  on changesets is
1c00: 20 6c 61 72 67 65 72 20 74 68 61 6e 20 74 68 65   larger than the
1c10: 20 6d 69 6e 69 6d 61 6c 0a 09 23 20 63 6f 6d 6d   minimal..# comm
1c20: 69 74 20 70 6f 73 69 74 69 6f 6e 20 66 6f 75 6e  it position foun
1c30: 64 20 61 6d 6f 6e 67 20 74 68 65 20 6f 75 74 67  d among the outg
1c40: 6f 69 6e 67 20 72 65 76 69 73 69 6f 6e 0a 09 23  oing revision..#
1c50: 20 63 68 61 6e 67 65 73 65 74 73 2e 20 41 73 73   changesets. Ass
1c60: 75 6d 69 6e 67 20 74 68 61 74 20 77 65 20 68 61  uming that we ha
1c70: 76 65 20 62 6f 74 68 20 69 6e 63 6f 6d 69 6e 67  ve both incoming
1c80: 20 61 6e 64 20 6f 75 74 67 6f 69 6e 67 0a 09 23   and outgoing..#
1c90: 20 72 65 76 69 73 69 6f 6e 20 63 68 61 6e 67 65   revision change
1ca0: 73 65 74 73 2e 0a 0a 09 23 20 54 68 65 20 68 65  sets....# The he
1cb0: 6c 70 65 72 20 22 50 6f 73 69 74 69 6f 6e 73 22  lper "Positions"
1cc0: 20 63 6f 6d 70 75 74 65 73 20 74 68 65 20 73 65   computes the se
1cd0: 74 20 6f 66 20 63 6f 6d 6d 69 74 20 70 6f 73 69  t of commit posi
1ce0: 74 69 6f 6e 73 0a 09 23 20 66 6f 72 20 61 20 73  tions..# for a s
1cf0: 65 74 20 6f 66 20 63 68 61 6e 67 65 73 65 74 73  et of changesets
1d00: 2c 20 77 68 69 63 68 20 63 61 6e 20 62 65 20 61  , which can be a
1d10: 20 6d 69 78 20 6f 66 20 72 65 76 69 73 69 6f 6e   mix of revision
1d20: 20 61 6e 64 0a 09 23 20 73 79 6d 62 6f 6c 20 63   and..# symbol c
1d30: 68 61 6e 67 65 73 65 74 73 2e 0a 0a 09 73 65 74  hangesets....set
1d40: 20 70 72 65 64 65 63 65 73 73 6f 72 73 20 5b 50   predecessors [P
1d50: 6f 73 69 74 69 6f 6e 73 20 5b 24 64 67 20 6e 6f  ositions [$dg no
1d60: 64 65 73 20 2d 69 6e 20 20 24 63 73 65 74 5d 5d  des -in  $cset]]
1d70: 0a 09 73 65 74 20 73 75 63 63 65 73 73 6f 72 73  ..set successors
1d80: 20 20 20 5b 50 6f 73 69 74 69 6f 6e 73 20 5b 24     [Positions [$
1d90: 64 67 20 6e 6f 64 65 73 20 2d 6f 75 74 20 24 63  dg nodes -out $c
1da0: 73 65 74 5d 5d 0a 0a 09 72 65 74 75 72 6e 20 5b  set]]...return [
1db0: 65 78 70 72 20 7b 0a 09 09 20 20 20 20 20 20 5b  expr {...      [
1dc0: 6c 6c 65 6e 67 74 68 20 24 70 72 65 64 65 63 65  llength $predece
1dd0: 73 73 6f 72 73 5d 20 26 26 0a 09 09 20 20 20 20  ssors] &&...    
1de0: 20 20 5b 6c 6c 65 6e 67 74 68 20 24 73 75 63 63    [llength $succ
1df0: 65 73 73 6f 72 73 5d 20 20 20 26 26 0a 09 09 20  essors]   &&... 
1e00: 20 20 20 20 20 28 5b 6d 61 78 20 24 70 72 65 64       ([max $pred
1e10: 65 63 65 73 73 6f 72 73 5d 20 3e 3d 20 5b 6d 69  ecessors] >= [mi
1e20: 6e 20 24 73 75 63 63 65 73 73 6f 72 73 5d 29 0a  n $successors]).
1e30: 09 09 20 20 7d 5d 0a 20 20 20 20 7d 0a 0a 20 20  ..  }].    }..  
1e40: 20 20 70 72 6f 63 20 50 6f 73 69 74 69 6f 6e 73    proc Positions
1e50: 20 7b 63 68 61 6e 67 65 73 65 74 73 7d 20 7b 0a   {changesets} {.
1e60: 09 23 20 54 6f 20 63 6f 6d 70 75 74 65 20 74 68  .# To compute th
1e70: 65 20 73 65 74 20 6f 66 20 63 6f 6d 6d 69 74 20  e set of commit 
1e80: 70 6f 73 69 74 69 6f 6e 73 20 66 72 6f 6d 20 74  positions from t
1e90: 68 65 20 73 65 74 20 6f 66 0a 09 23 20 63 68 61  he set of..# cha
1ea0: 6e 67 65 73 65 74 73 20 77 65 20 66 69 72 73 74  ngesets we first
1eb0: 20 6d 61 70 20 65 61 63 68 20 63 68 61 6e 67 65   map each change
1ec0: 73 65 74 20 74 6f 20 69 74 73 20 70 6f 73 69 74  set to its posit
1ed0: 69 6f 6e 20 28 2a 29 0a 09 23 20 61 6e 64 20 74  ion (*)..# and t
1ee0: 68 65 6e 20 66 69 6c 74 65 72 20 6f 75 74 20 74  hen filter out t
1ef0: 68 65 20 69 6e 76 61 6c 69 64 20 72 65 73 70 6f  he invalid respo
1f00: 6e 73 65 73 20 28 74 68 65 20 65 6d 70 74 79 20  nses (the empty 
1f10: 73 74 72 69 6e 67 29 0a 09 23 20 72 65 74 75 72  string)..# retur
1f20: 6e 65 64 20 62 79 20 74 68 65 20 73 79 6d 62 6f  ned by the symbo
1f30: 6c 20 63 68 61 6e 67 65 73 65 74 73 2e 0a 09 23  l changesets...#
1f40: 0a 09 23 20 28 2a 29 20 54 68 69 73 20 64 61 74  ..# (*) This dat
1f50: 61 20 77 61 73 20 6c 6f 61 64 65 64 20 69 6e 74  a was loaded int
1f60: 6f 20 6d 65 6d 6f 72 79 20 65 61 72 6c 69 72 20  o memory earlir 
1f70: 69 6e 20 74 68 65 20 70 61 73 73 2c 20 62 79 0a  in the pass, by.
1f80: 09 23 20 20 20 20 20 4c 6f 61 64 43 6f 6d 6d 69  .#     LoadCommi
1f90: 74 4f 72 64 65 72 2e 0a 0a 09 72 65 74 75 72 6e  tOrder....return
1fa0: 20 5b 73 74 72 75 63 74 3a 3a 6c 69 73 74 20 66   [struct::list f
1fb0: 69 6c 74 65 72 20 5b 73 74 72 75 63 74 3a 3a 6c  ilter [struct::l
1fc0: 69 73 74 20 6d 61 70 20 24 63 68 61 6e 67 65 73  ist map $changes
1fd0: 65 74 73 20 5c 0a 09 09 09 09 09 20 5b 6d 79 70  ets \...... [myp
1fe0: 72 6f 63 20 54 6f 50 6f 73 69 74 69 6f 6e 5d 5d  roc ToPosition]]
1ff0: 20 5c 0a 09 09 20 20 20 20 5b 6d 79 70 72 6f 63   \...    [myproc
2000: 20 56 61 6c 69 64 50 6f 73 69 74 69 6f 6e 5d 5d   ValidPosition]]
2010: 0a 20 20 20 20 7d 0a 0a 20 20 20 20 70 72 6f 63  .    }..    proc
2020: 20 54 6f 50 6f 73 69 74 69 6f 6e 20 20 20 20 7b   ToPosition    {
2030: 63 73 65 74 7d 20 7b 20 24 63 73 65 74 20 70 6f  cset} { $cset po
2040: 73 20 7d 0a 20 20 20 20 70 72 6f 63 20 56 61 6c  s }.    proc Val
2050: 69 64 50 6f 73 69 74 69 6f 6e 20 7b 70 6f 73 7d  idPosition {pos}
2060: 20 20 7b 20 65 78 70 72 20 7b 24 70 6f 73 20 6e    { expr {$pos n
2070: 65 20 22 22 7d 20 7d 0a 0a 20 20 20 20 70 72 6f  e ""} }..    pro
2080: 63 20 43 6f 6d 70 75 74 65 4c 69 6d 69 74 73 20  c ComputeLimits 
2090: 7b 63 73 65 74 20 6c 76 20 62 76 7d 20 7b 0a 09  {cset lv bv} {..
20a0: 75 70 76 61 72 20 31 20 24 6c 76 20 74 68 65 6c  upvar 1 $lv thel
20b0: 69 6d 69 74 73 20 24 62 76 20 62 6f 72 64 65 72  imits $bv border
20c0: 0a 0a 09 23 20 49 6e 69 74 69 61 6c 69 7a 65 20  ...# Initialize 
20d0: 74 68 65 20 62 6f 75 6e 64 61 72 69 65 73 20 66  the boundaries f
20e0: 6f 72 20 61 6c 6c 20 72 65 76 69 73 69 6f 6e 73  or all revisions
20f0: 2e 0a 0a 09 61 72 72 61 79 20 73 65 74 20 6c 69  ....array set li
2100: 6d 69 74 73 20 7b 7d 0a 09 66 6f 72 65 61 63 68  mits {}..foreach
2110: 20 72 65 76 69 73 69 6f 6e 20 5b 24 63 73 65 74   revision [$cset
2120: 20 72 65 76 69 73 69 6f 6e 73 5d 20 7b 0a 09 20   revisions] {.. 
2130: 20 20 20 73 65 74 20 6c 69 6d 69 74 73 28 24 72     set limits($r
2140: 65 76 69 73 69 6f 6e 29 20 7b 30 20 7b 7d 7d 0a  evision) {0 {}}.
2150: 09 7d 0a 0a 09 23 20 43 6f 6d 70 75 74 65 20 61  .}...# Compute a
2160: 6e 64 20 73 74 6f 72 65 20 74 68 65 20 6d 61 78  nd store the max
2170: 69 6d 61 6c 20 70 72 65 64 65 63 65 73 73 6f 72  imal predecessor
2180: 73 20 70 65 72 20 72 65 76 69 73 69 6f 6e 0a 0a  s per revision..
2190: 09 66 6f 72 65 61 63 68 20 7b 72 65 76 69 73 69  .foreach {revisi
21a0: 6f 6e 20 63 73 65 74 73 7d 20 5b 24 63 73 65 74  on csets} [$cset
21b0: 20 70 72 65 64 65 63 65 73 73 6f 72 6d 61 70 5d   predecessormap]
21c0: 20 7b 0a 09 20 20 20 20 73 65 74 20 73 20 5b 50   {..    set s [P
21d0: 6f 73 69 74 69 6f 6e 73 20 24 63 73 65 74 73 5d  ositions $csets]
21e0: 0a 09 20 20 20 20 69 66 20 7b 21 5b 6c 6c 65 6e  ..    if {![llen
21f0: 67 74 68 20 24 73 5d 7d 20 63 6f 6e 74 69 6e 75  gth $s]} continu
2200: 65 0a 09 20 20 20 20 73 65 74 20 6c 69 6d 69 74  e..    set limit
2210: 73 28 24 72 65 76 69 73 69 6f 6e 29 20 5b 6c 72  s($revision) [lr
2220: 65 70 6c 61 63 65 20 24 6c 69 6d 69 74 73 28 24  eplace $limits($
2230: 72 65 76 69 73 69 6f 6e 29 20 30 20 30 20 5b 6d  revision) 0 0 [m
2240: 61 78 20 24 73 5d 5d 0a 09 7d 0a 0a 09 23 20 43  ax $s]]..}...# C
2250: 6f 6d 70 75 74 65 20 61 6e 64 20 73 74 6f 72 65  ompute and store
2260: 20 74 68 65 20 6d 69 6e 69 6d 61 6c 20 73 75 63   the minimal suc
2270: 63 65 73 73 6f 72 73 20 70 65 72 20 72 65 76 69  cessors per revi
2280: 73 69 6f 6e 0a 0a 09 66 6f 72 65 61 63 68 20 7b  sion...foreach {
2290: 72 65 76 69 73 69 6f 6e 20 63 73 65 74 73 7d 20  revision csets} 
22a0: 5b 24 63 73 65 74 20 73 75 63 63 65 73 73 6f 72  [$cset successor
22b0: 6d 61 70 5d 20 7b 0a 09 20 20 20 20 73 65 74 20  map] {..    set 
22c0: 73 20 5b 50 6f 73 69 74 69 6f 6e 73 20 24 63 73  s [Positions $cs
22d0: 65 74 73 5d 0a 09 20 20 20 20 69 66 20 7b 21 5b  ets]..    if {![
22e0: 6c 6c 65 6e 67 74 68 20 24 73 5d 7d 20 63 6f 6e  llength $s]} con
22f0: 74 69 6e 75 65 0a 09 20 20 20 20 73 65 74 20 6c  tinue..    set l
2300: 69 6d 69 74 73 28 24 72 65 76 69 73 69 6f 6e 29  imits($revision)
2310: 20 5b 6c 72 65 70 6c 61 63 65 20 24 6c 69 6d 69   [lreplace $limi
2320: 74 73 28 24 72 65 76 69 73 69 6f 6e 29 20 31 20  ts($revision) 1 
2330: 31 20 5b 6d 69 6e 20 24 73 5d 5d 0a 09 7d 0a 0a  1 [min $s]]..}..
2340: 09 23 20 43 68 65 63 6b 20 74 68 61 74 20 74 68  .# Check that th
2350: 65 20 6f 72 64 65 72 69 6e 67 20 61 74 20 74 68  e ordering at th
2360: 65 20 66 69 6c 65 20 6c 65 76 65 6c 20 69 73 20  e file level is 
2370: 63 6f 72 72 65 63 74 2e 20 57 65 0a 09 23 20 63  correct. We..# c
2380: 61 6e 6e 6f 74 20 68 61 76 65 20 62 61 63 6b 77  annot have backw
2390: 61 72 64 20 6f 72 64 65 72 69 6e 67 20 70 65 72  ard ordering per
23a0: 20 72 65 76 69 73 69 6f 6e 2c 20 6f 72 20 73 6f   revision, or so
23b0: 6d 65 74 68 69 6e 67 20 69 73 0a 09 23 20 77 72  mething is..# wr
23c0: 6f 6e 67 2e 0a 0a 09 66 6f 72 65 61 63 68 20 72  ong....foreach r
23d0: 65 76 69 73 69 6f 6e 20 5b 61 72 72 61 79 20 6e  evision [array n
23e0: 61 6d 65 73 20 6c 69 6d 69 74 73 5d 20 7b 0a 09  ames limits] {..
23f0: 20 20 20 20 73 74 72 75 63 74 3a 3a 6c 69 73 74      struct::list
2400: 20 61 73 73 69 67 6e 20 24 6c 69 6d 69 74 73 28   assign $limits(
2410: 24 72 65 76 69 73 69 6f 6e 29 20 6d 61 78 70 20  $revision) maxp 
2420: 6d 69 6e 73 0a 09 20 20 20 20 23 20 48 61 6e 64  mins..    # Hand
2430: 6c 65 20 6d 69 6e 20 73 75 63 63 65 73 73 6f 72  le min successor
2440: 20 70 6f 73 69 74 69 6f 6e 20 22 22 20 61 73 20   position "" as 
2450: 72 65 70 72 65 73 65 6e 74 69 6e 67 20 69 6e 66  representing inf
2460: 69 6e 69 74 79 0a 09 20 20 20 20 69 66 20 7b 24  inity..    if {$
2470: 6d 69 6e 73 20 65 71 20 22 22 7d 20 63 6f 6e 74  mins eq ""} cont
2480: 69 6e 75 65 0a 09 20 20 20 20 69 66 20 7b 24 6d  inue..    if {$m
2490: 61 78 70 20 3c 20 24 6d 69 6e 73 7d 20 63 6f 6e  axp < $mins} con
24a0: 74 69 6e 75 65 0a 0a 09 20 20 20 20 74 72 6f 75  tinue...    trou
24b0: 62 6c 65 20 69 6e 74 65 72 6e 61 6c 20 22 42 72  ble internal "Br
24c0: 61 6e 63 68 20 72 65 76 69 73 69 6f 6e 20 24 72  anch revision $r
24d0: 65 76 69 73 69 6f 6e 20 69 73 20 62 61 63 6b 77  evision is backw
24e0: 61 72 64 20 61 74 20 66 69 6c 65 20 6c 65 76 65  ard at file leve
24f0: 6c 20 28 24 6d 61 78 70 20 3e 3d 20 24 6d 69 6e  l ($maxp >= $min
2500: 73 29 22 0a 09 7d 0a 0a 09 23 20 53 61 76 65 20  s)"..}...# Save 
2510: 74 68 65 20 6c 69 6d 69 74 73 20 66 6f 72 20 74  the limits for t
2520: 68 65 20 73 70 6c 69 74 74 65 72 2c 20 61 6e 64  he splitter, and
2530: 20 63 6f 6d 70 75 74 65 20 74 68 65 20 62 6f 72   compute the bor
2540: 64 65 72 20 61 74 0a 09 23 20 77 68 69 63 68 20  der at..# which 
2550: 74 6f 20 73 70 6c 69 74 20 61 73 20 74 68 65 20  to split as the 
2560: 6d 69 6e 69 6d 75 6d 20 6f 66 20 61 6c 6c 20 6d  minimum of all m
2570: 69 6e 69 6d 61 6c 20 73 75 63 63 65 73 73 6f 72  inimal successor
2580: 0a 09 23 20 70 6f 73 69 74 69 6f 6e 73 2e 0a 0a  ..# positions...
2590: 09 73 65 74 20 74 68 65 6c 69 6d 69 74 73 20 5b  .set thelimits [
25a0: 61 72 72 61 79 20 67 65 74 20 6c 69 6d 69 74 73  array get limits
25b0: 5d 0a 09 73 65 74 20 62 6f 72 64 65 72 20 5b 6d  ]..set border [m
25c0: 69 6e 20 5b 73 74 72 75 63 74 3a 3a 6c 69 73 74  in [struct::list
25d0: 20 66 69 6c 74 65 72 20 5b 73 74 72 75 63 74 3a   filter [struct:
25e0: 3a 6c 69 73 74 20 6d 61 70 20 5b 56 61 6c 75 65  :list map [Value
25f0: 73 20 24 74 68 65 6c 69 6d 69 74 73 5d 20 5c 0a  s $thelimits] \.
2600: 09 09 09 09 09 09 20 20 5b 6d 79 70 72 6f 63 20  ......  [myproc 
2610: 4d 69 6e 53 75 63 63 65 73 73 6f 72 50 6f 73 69  MinSuccessorPosi
2620: 74 69 6f 6e 5d 5d 20 5c 0a 09 09 09 20 20 20 20  tion]] \....    
2630: 20 5b 6d 79 70 72 6f 63 20 56 61 6c 69 64 50 6f   [myproc ValidPo
2640: 73 69 74 69 6f 6e 5d 5d 5d 0a 09 72 65 74 75 72  sition]]]..retur
2650: 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 70 72 6f  n.    }..    pro
2660: 63 20 56 61 6c 75 65 73 20 7b 64 69 63 74 7d 20  c Values {dict} 
2670: 7b 0a 09 73 65 74 20 72 65 73 20 7b 7d 0a 09 66  {..set res {}..f
2680: 6f 72 65 61 63 68 20 7b 6b 20 76 7d 20 24 64 69  oreach {k v} $di
2690: 63 74 20 7b 20 6c 61 70 70 65 6e 64 20 72 65 73  ct { lappend res
26a0: 20 24 76 20 7d 0a 09 72 65 74 75 72 6e 20 24 72   $v }..return $r
26b0: 65 73 0a 20 20 20 20 7d 0a 0a 20 20 20 20 70 72  es.    }..    pr
26c0: 6f 63 20 4d 69 6e 53 75 63 63 65 73 73 6f 72 50  oc MinSuccessorP
26d0: 6f 73 69 74 69 6f 6e 20 7b 69 74 65 6d 7d 20 7b  osition {item} {
26e0: 20 6c 69 6e 64 65 78 20 24 69 74 65 6d 20 31 20   lindex $item 1 
26f0: 7d 0a 0a 20 20 20 20 70 72 6f 63 20 53 70 6c 69  }..    proc Spli
2700: 74 52 65 76 69 73 69 6f 6e 73 20 7b 6c 69 6d 69  tRevisions {limi
2710: 74 73 20 62 6f 72 64 65 72 20 6e 76 20 62 76 7d  ts border nv bv}
2720: 20 7b 0a 09 75 70 76 61 72 20 31 20 24 6e 76 20   {..upvar 1 $nv 
2730: 6e 6f 72 6d 61 6c 72 65 76 69 73 69 6f 6e 73 20  normalrevisions 
2740: 24 62 76 20 62 61 63 6b 77 61 72 64 72 65 76 69  $bv backwardrevi
2750: 73 69 6f 6e 73 0a 0a 09 73 65 74 20 6e 6f 72 6d  sions...set norm
2760: 61 6c 72 65 76 69 73 69 6f 6e 73 20 20 20 7b 7d  alrevisions   {}
2770: 0a 09 73 65 74 20 62 61 63 6b 77 61 72 64 72 65  ..set backwardre
2780: 76 69 73 69 6f 6e 73 20 7b 7d 0a 0a 09 66 6f 72  visions {}...for
2790: 65 61 63 68 20 7b 72 65 76 20 76 7d 20 24 6c 69  each {rev v} $li
27a0: 6d 69 74 73 20 7b 0a 09 20 20 20 20 73 74 72 75  mits {..    stru
27b0: 63 74 3a 3a 6c 69 73 74 20 61 73 73 69 67 6e 20  ct::list assign 
27c0: 24 76 20 6d 61 78 70 20 6d 69 6e 73 0a 09 20 20  $v maxp mins..  
27d0: 20 20 69 66 20 7b 24 6d 61 78 70 20 3e 3d 20 24    if {$maxp >= $
27e0: 62 6f 72 64 65 72 7d 20 7b 0a 09 09 6c 61 70 70  border} {...lapp
27f0: 65 6e 64 20 62 61 63 6b 77 61 72 64 72 65 76 69  end backwardrevi
2800: 73 69 6f 6e 73 20 20 24 72 65 76 0a 09 20 20 20  sions  $rev..   
2810: 20 7d 20 65 6c 73 65 20 7b 0a 09 09 6c 61 70 70   } else {...lapp
2820: 65 6e 64 20 6e 6f 72 6d 61 6c 72 65 76 69 73 69  end normalrevisi
2830: 6f 6e 73 20 24 72 65 76 0a 09 20 20 20 20 7d 0a  ons $rev..    }.
2840: 09 7d 0a 0a 09 69 66 20 7b 21 5b 6c 6c 65 6e 67  .}...if {![lleng
2850: 74 68 20 24 6e 6f 72 6d 61 6c 72 65 76 69 73 69  th $normalrevisi
2860: 6f 6e 73 5d 7d 20 20 20 7b 20 74 72 6f 75 62 6c  ons]}   { troubl
2870: 65 20 69 6e 74 65 72 6e 61 6c 20 22 53 65 74 20  e internal "Set 
2880: 6f 66 20 6e 6f 72 6d 61 6c 20 72 65 76 69 73 69  of normal revisi
2890: 6f 6e 73 20 69 73 20 65 6d 70 74 79 22 20 7d 0a  ons is empty" }.
28a0: 09 69 66 20 7b 21 5b 6c 6c 65 6e 67 74 68 20 24  .if {![llength $
28b0: 62 61 63 6b 77 61 72 64 72 65 76 69 73 69 6f 6e  backwardrevision
28c0: 73 5d 7d 20 7b 20 74 72 6f 75 62 6c 65 20 69 6e  s]} { trouble in
28d0: 74 65 72 6e 61 6c 20 22 53 65 74 20 6f 66 20 62  ternal "Set of b
28e0: 61 63 6b 77 61 72 64 20 72 65 76 69 73 69 6f 6e  ackward revision
28f0: 73 20 69 73 20 65 6d 70 74 79 22 20 7d 0a 09 72  s is empty" }..r
2900: 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 0a 20 20  eturn.    }...  
2910: 20 20 23 20 23 20 23 23 20 23 23 23 20 23 23 23    # # ## ### ###
2920: 23 23 20 23 23 23 23 23 23 23 23 20 23 23 23 23  ## ######## ####
2930: 23 23 23 23 23 23 23 23 23 0a 0a 20 20 20 20 70  #########..    p
2940: 72 6f 63 20 4b 65 65 70 4f 72 64 65 72 20 7b 67  roc KeepOrder {g
2950: 72 61 70 68 20 61 74 20 63 73 65 74 7d 20 7b 0a  raph at cset} {.
2960: 09 73 65 74 20 63 69 64 20 5b 24 63 73 65 74 20  .set cid [$cset 
2970: 69 64 5d 0a 0a 09 6c 6f 67 20 77 72 69 74 65 20  id]...log write 
2980: 34 20 62 72 65 61 6b 61 63 79 63 6c 65 20 22 43  4 breakacycle "C
2990: 68 61 6e 67 65 73 65 74 20 40 20 5b 66 6f 72 6d  hangeset @ [form
29a0: 61 74 20 24 6d 79 61 74 66 6d 74 20 24 61 74 5d  at $myatfmt $at]
29b0: 3a 20 5b 66 6f 72 6d 61 74 20 24 6d 79 63 73 66  : [format $mycsf
29c0: 6d 74 20 5b 24 63 73 65 74 20 73 74 72 5d 5d 20  mt [$cset str]] 
29d0: 3c 3c 5b 46 6f 72 6d 61 74 54 52 20 24 67 72 61  <<[FormatTR $gra
29e0: 70 68 20 24 63 73 65 74 5d 3e 3e 22 0a 0a 09 23  ph $cset]>>"...#
29f0: 20 57 65 20 73 65 65 20 68 65 72 65 20 61 20 6d   We see here a m
2a00: 69 78 74 75 72 65 20 6f 66 20 73 79 6d 62 6f 6c  ixture of symbol
2a10: 20 61 6e 64 20 72 65 76 69 73 69 6f 6e 20 63 68   and revision ch
2a20: 61 6e 67 65 73 65 74 73 2e 0a 09 23 20 54 68 65  angesets...# The
2a30: 20 73 79 6d 62 6f 6c 20 63 68 61 6e 67 65 73 65   symbol changese
2a40: 74 73 20 61 72 65 20 69 67 6e 6f 72 65 64 20 61  ts are ignored a
2a50: 73 20 69 72 72 65 6c 65 76 61 6e 74 2e 0a 0a 09  s irrelevant....
2a60: 69 66 20 7b 5b 24 63 73 65 74 20 70 6f 73 5d 20  if {[$cset pos] 
2a70: 65 71 20 22 22 7d 20 72 65 74 75 72 6e 0a 0a 09  eq ""} return...
2a80: 23 20 46 6f 72 20 74 68 65 20 72 65 76 69 73 69  # For the revisi
2a90: 6f 6e 20 63 68 61 6e 67 65 73 65 74 73 20 77 65  on changesets we
2aa0: 20 61 72 65 20 73 75 72 65 20 74 68 61 74 20 74   are sure that t
2ab0: 68 65 79 20 61 72 65 0a 09 23 20 63 6f 6e 73 75  hey are..# consu
2ac0: 6d 65 64 20 69 6e 20 74 68 65 20 73 61 6d 65 20  med in the same 
2ad0: 6f 72 64 65 72 20 61 73 20 67 65 6e 65 72 61 74  order as generat
2ae0: 65 64 20 62 79 20 70 61 73 73 20 37 0a 09 23 20  ed by pass 7..# 
2af0: 28 52 65 76 54 6f 70 6f 6c 6f 67 69 63 61 6c 53  (RevTopologicalS
2b00: 6f 72 74 29 2e 20 50 65 72 20 74 68 65 20 63 6f  ort). Per the co
2b10: 64 65 20 69 6e 20 63 76 73 32 73 76 6e 2e 0a 0a  de in cvs2svn...
2b20: 09 23 20 4e 4f 54 45 3a 20 49 20 63 61 6e 6e 6f  .# NOTE: I canno
2b30: 74 20 73 65 65 20 74 68 61 74 2e 20 41 73 73 75  t see that. Assu
2b40: 6d 65 20 63 73 20 41 20 61 6e 64 20 63 73 20 42  me cs A and cs B
2b50: 2c 20 6e 6f 74 20 64 65 70 65 6e 64 65 6e 74 0a  , not dependent.
2b60: 09 23 20 20 20 20 20 20 20 6f 6e 20 65 61 63 68  .#       on each
2b70: 20 6f 74 68 65 72 20 69 6e 20 74 68 65 20 73 65   other in the se
2b80: 74 20 6f 66 20 72 65 76 69 73 69 6f 6e 73 2c 20  t of revisions, 
2b90: 6e 6f 77 20 42 20 61 66 74 65 72 20 41 0a 09 23  now B after A..#
2ba0: 20 20 20 20 20 20 20 73 69 6d 70 6c 79 20 6d 65         simply me
2bb0: 61 6e 73 20 74 68 61 74 20 42 20 68 61 73 20 61  ans that B has a
2bc0: 20 6c 61 74 65 72 20 74 69 6d 65 20 6f 72 20 64   later time or d
2bd0: 65 70 65 6e 64 73 20 6f 6e 0a 09 23 20 20 20 20  epends on..#    
2be0: 20 20 20 73 6f 6d 65 74 68 69 6e 67 20 77 69 74     something wit
2bf0: 20 61 20 6c 61 74 65 72 20 74 69 6d 65 20 74 68   a later time th
2c00: 61 6e 20 41 2e 20 49 6e 20 74 68 65 20 66 75 6c  an A. In the ful
2c10: 6c 20 67 72 61 70 68 20 41 0a 09 23 20 20 20 20  l graph A..#    
2c20: 20 20 20 6d 61 79 20 6e 6f 77 20 68 61 76 65 20     may now have 
2c30: 64 65 70 65 6e 64 65 6e 63 69 65 73 20 77 68 69  dependencies whi
2c40: 63 68 20 73 68 69 66 74 20 69 74 20 61 66 74 65  ch shift it afte
2c50: 72 20 42 2c 0a 09 23 20 20 20 20 20 20 20 76 69  r B,..#       vi
2c60: 6f 6c 61 74 69 6e 67 20 74 68 65 20 61 62 6f 76  olating the abov
2c70: 65 20 61 73 73 75 6d 70 74 69 6f 6e 2e 0a 09 23  e assumption...#
2c80: 0a 09 23 20 57 65 6c 6c 2c 20 69 74 20 73 65 65  ..# Well, it see
2c90: 6d 73 20 74 6f 20 77 6f 72 6b 20 69 66 20 49 20  ms to work if I 
2ca0: 64 6f 20 6e 6f 74 20 6d 61 6b 65 20 74 68 65 20  do not make the 
2cb0: 4e 54 44 42 20 72 6f 6f 74 20 61 0a 09 23 20 73  NTDB root a..# s
2cc0: 75 63 63 65 73 73 6f 72 20 6f 66 20 74 68 65 20  uccessor of the 
2cd0: 72 65 67 75 6c 61 72 20 72 6f 6f 74 2e 20 44 6f  regular root. Do
2ce0: 69 6e 67 20 73 6f 20 73 65 65 6d 73 20 74 6f 20  ing so seems to 
2cf0: 74 61 6e 67 6c 65 20 74 68 65 0a 09 23 20 63 68  tangle the..# ch
2d00: 61 6e 67 65 73 65 74 73 20 69 6e 74 6f 20 61 20  angesets into a 
2d10: 6b 6e 6f 74 73 20 72 65 67 61 72 64 69 6e 67 20  knots regarding 
2d20: 74 69 6d 65 20 76 73 20 64 65 70 65 6e 64 65 6e  time vs dependen
2d30: 63 69 65 73 20 61 6e 64 0a 09 23 20 74 72 69 67  cies and..# trig
2d40: 67 65 72 20 73 75 63 68 20 73 68 69 66 74 73 2e  ger such shifts.
2d50: 20 4b 65 65 70 69 6e 67 20 74 68 65 73 65 20 74   Keeping these t
2d60: 77 6f 20 72 6f 6f 74 73 20 73 65 70 61 72 61 74  wo roots separat
2d70: 65 20 4f 54 4f 48 0a 09 23 20 64 69 73 61 70 70  e OTOH..# disapp
2d80: 65 61 72 73 20 74 68 65 20 74 61 6e 67 6c 65 2e  ears the tangle.
2d90: 20 53 6f 2c 20 66 6f 72 20 6e 6f 77 20 49 20 61   So, for now I a
2da0: 63 63 65 70 74 20 74 68 61 74 2c 20 61 6e 64 20  ccept that, and 
2db0: 66 6f 72 0a 09 23 20 70 61 72 61 6e 6f 69 61 20  for..# paranoia 
2dc0: 49 20 61 64 64 20 63 6f 64 65 20 77 68 69 63 68  I add code which
2dd0: 20 63 68 65 63 6b 73 20 74 68 69 73 20 61 73 73   checks this ass
2de0: 75 6d 70 74 69 6f 6e 2e 0a 0a 09 73 74 72 75 63  umption....struc
2df0: 74 3a 3a 73 65 74 20 65 78 63 6c 75 64 65 20 6d  t::set exclude m
2e00: 79 72 65 76 69 73 69 6f 6e 63 68 61 6e 67 65 73  yrevisionchanges
2e10: 65 74 73 20 24 63 73 65 74 0a 0a 09 3a 3a 76 61  ets $cset...::va
2e20: 72 69 61 62 6c 65 20 6d 79 6c 61 73 74 70 6f 73  riable mylastpos
2e30: 0a 09 73 65 74 20 6e 65 77 20 5b 24 63 73 65 74  ..set new [$cset
2e40: 20 70 6f 73 5d 0a 0a 09 69 66 20 7b 24 6e 65 77   pos]...if {$new
2e50: 20 21 3d 20 28 24 6d 79 6c 61 73 74 70 6f 73 20   != ($mylastpos 
2e60: 2b 20 31 29 7d 20 7b 0a 09 20 20 20 20 69 66 20  + 1)} {..    if 
2e70: 7b 24 6d 79 6c 61 73 74 70 6f 73 20 3c 20 30 7d  {$mylastpos < 0}
2e80: 20 7b 0a 09 09 73 65 74 20 6f 6c 64 20 22 3c 4e   {...set old "<N
2e90: 4f 4e 45 3e 22 0a 09 20 20 20 20 7d 20 65 6c 73  ONE>"..    } els
2ea0: 65 20 7b 0a 09 09 3a 3a 76 61 72 69 61 62 6c 65  e {...::variable
2eb0: 20 6d 79 63 73 65 74 0a 09 09 73 65 74 20 6f 6c   mycset...set ol
2ec0: 64 20 5b 24 6d 79 63 73 65 74 28 24 6d 79 6c 61  d [$mycset($myla
2ed0: 73 74 70 6f 73 29 20 73 74 72 5d 40 24 6d 79 6c  stpos) str]@$myl
2ee0: 61 73 74 70 6f 73 0a 09 20 20 20 20 7d 0a 0a 09  astpos..    }...
2ef0: 20 20 20 20 74 72 6f 75 62 6c 65 20 69 6e 74 65      trouble inte
2f00: 72 6e 61 6c 20 22 4f 72 64 65 72 69 6e 67 20 6f  rnal "Ordering o
2f10: 66 20 72 65 76 69 73 69 6f 6e 20 63 68 61 6e 67  f revision chang
2f20: 65 73 65 74 73 20 76 69 6f 6c 61 74 65 64 2c 20  esets violated, 
2f30: 5b 24 63 73 65 74 20 73 74 72 5d 40 24 6e 65 77  [$cset str]@$new
2f40: 20 69 73 20 6e 6f 74 20 69 6d 6d 65 64 69 61 74   is not immediat
2f50: 65 6c 79 20 61 66 74 65 72 20 24 6f 6c 64 22 0a  ely after $old".
2f60: 09 7d 0a 0a 09 73 65 74 20 6d 79 6c 61 73 74 70  .}...set mylastp
2f70: 6f 73 20 24 6e 65 77 0a 09 72 65 74 75 72 6e 0a  os $new..return.
2f80: 20 20 20 20 7d 0a 0a 20 20 20 20 70 72 6f 63 20      }..    proc 
2f90: 46 6f 72 6d 61 74 54 52 20 7b 67 72 61 70 68 20  FormatTR {graph 
2fa0: 63 73 65 74 7d 20 7b 0a 09 72 65 74 75 72 6e 20  cset} {..return 
2fb0: 5b 6a 6f 69 6e 20 5b 73 74 72 75 63 74 3a 3a 6c  [join [struct::l
2fc0: 69 73 74 20 6d 61 70 20 5b 24 67 72 61 70 68 20  ist map [$graph 
2fd0: 6e 6f 64 65 20 73 65 74 20 24 63 73 65 74 20 74  node set $cset t
2fe0: 69 6d 65 72 61 6e 67 65 5d 20 7b 63 6c 6f 63 6b  imerange] {clock
2ff0: 20 66 6f 72 6d 61 74 7d 5d 20 7b 20 2d 2d 20 7d   format}] { -- }
3000: 5d 0a 20 20 20 20 7d 0a 0a 20 20 20 20 74 79 70  ].    }..    typ
3010: 65 76 61 72 69 61 62 6c 65 20 6d 79 6c 61 73 74  evariable mylast
3020: 70 6f 73 20 20 20 20 20 20 20 20 20 20 20 20 2d  pos            -
3030: 31 20 3b 20 23 20 50 6f 73 69 74 69 6f 6e 20 6f  1 ; # Position o
3040: 66 20 6c 61 73 74 20 72 65 76 69 73 69 6f 6e 20  f last revision 
3050: 63 68 61 6e 67 65 73 65 74 20 73 61 76 65 64 2e  changeset saved.
3060: 0a 20 20 20 20 74 79 70 65 76 61 72 69 61 62 6c  .    typevariabl
3070: 65 20 6d 79 72 65 76 69 73 69 6f 6e 63 68 61 6e  e myrevisionchan
3080: 67 65 73 65 74 73 20 7b 7d 20 3b 20 23 20 53 65  gesets {} ; # Se
3090: 74 20 6f 66 20 72 65 76 69 73 69 6f 6e 20 63 68  t of revision ch
30a0: 61 6e 67 65 73 65 74 73 0a 0a 20 20 20 20 74 79  angesets..    ty
30b0: 70 65 76 61 72 69 61 62 6c 65 20 6d 79 61 74 66  pevariable myatf
30c0: 6d 74 20 3b 20 23 20 46 6f 72 6d 61 74 20 66 6f  mt ; # Format fo
30d0: 72 20 6c 6f 67 20 6f 75 74 70 75 74 20 74 6f 20  r log output to 
30e0: 67 61 69 6e 20 62 65 74 74 65 72 20 61 6c 69 67  gain better alig
30f0: 6e 6d 65 6e 74 20 6f 66 20 74 68 65 20 76 61 72  nment of the var
3100: 69 6f 75 73 20 63 6f 6c 75 6d 6e 73 2e 0a 20 20  ious columns..  
3110: 20 20 74 79 70 65 76 61 72 69 61 62 6c 65 20 6d    typevariable m
3120: 79 63 73 66 6d 74 20 3b 20 23 20 44 69 74 74 6f  ycsfmt ; # Ditto
3130: 20 66 6f 72 20 74 68 65 20 63 68 61 6e 67 65 73   for the changes
3140: 65 74 73 2e 0a 0a 20 20 20 20 23 20 23 20 23 23  ets...    # # ##
3150: 20 23 23 23 20 23 23 23 23 23 20 23 23 23 23 23   ### ##### #####
3160: 23 23 23 20 23 23 23 23 23 23 23 23 23 23 23 23  ### ############
3170: 23 0a 0a 20 20 20 20 70 72 6f 63 20 42 72 65 61  #..    proc Brea
3180: 6b 43 79 63 6c 65 20 7b 67 72 61 70 68 7d 20 7b  kCycle {graph} {
3190: 0a 09 23 20 49 6e 20 74 68 69 73 20 70 61 73 73  ..# In this pass
31a0: 20 74 68 65 20 63 79 63 6c 65 20 62 72 65 61 6b   the cycle break
31b0: 69 6e 67 20 63 61 6e 20 62 65 20 6d 61 64 65 20  ing can be made 
31c0: 61 20 62 69 74 20 6d 6f 72 65 0a 09 23 20 74 61  a bit more..# ta
31d0: 72 67 65 74 65 64 2c 20 68 65 6e 63 65 20 74 68  rgeted, hence th
31e0: 69 73 20 63 75 73 74 6f 6d 20 63 61 6c 6c 62 61  is custom callba
31f0: 63 6b 2e 0a 09 23 0a 09 23 20 46 69 72 73 74 20  ck...#..# First 
3200: 77 65 20 75 73 65 20 74 68 65 20 64 61 74 61 20  we use the data 
3210: 72 65 6d 65 6d 62 65 72 65 64 20 62 79 20 27 53  remembered by 'S
3220: 61 76 65 4f 72 64 65 72 27 2c 20 61 62 6f 75 74  aveOrder', about
3230: 20 74 68 65 0a 09 23 20 6c 61 73 74 20 63 6f 6d   the..# last com
3240: 6d 69 74 20 70 6f 73 69 74 69 6f 6e 20 69 74 20  mit position it 
3250: 68 61 6e 64 6c 65 64 2c 20 74 6f 20 64 65 64 75  handled, to dedu
3260: 63 65 20 74 68 65 20 6e 65 78 74 20 72 65 76 69  ce the next revi
3270: 73 69 6f 6e 0a 09 23 20 63 68 61 6e 67 65 73 65  sion..# changese
3280: 74 20 69 74 20 77 6f 75 6c 64 20 65 6e 63 6f 75  t it would encou
3290: 6e 74 65 72 2e 20 54 68 65 6e 20 77 65 20 6c 6f  nter. Then we lo
32a0: 6f 6b 20 66 6f 72 20 74 68 65 20 73 68 6f 72 74  ok for the short
32b0: 65 73 74 0a 09 23 20 70 72 65 64 65 63 65 73 73  est..# predecess
32c0: 6f 72 20 70 61 74 68 20 66 72 6f 6d 20 69 74 20  or path from it 
32d0: 74 6f 20 61 6c 6c 20 6f 74 68 65 72 20 72 65 76  to all other rev
32e0: 69 73 69 6f 6e 20 63 68 61 6e 67 65 73 65 74 73  ision changesets
32f0: 0a 09 23 20 61 6e 64 20 62 72 65 61 6b 20 74 68  ..# and break th
3300: 69 73 20 70 61 74 68 2e 20 57 69 74 68 6f 75 74  is path. Without
3310: 20 73 75 63 68 20 61 20 70 61 74 68 20 77 65 20   such a path we 
3320: 66 61 6c 6c 20 62 61 63 6b 20 74 6f 20 74 68 65  fall back to the
3330: 0a 09 23 20 67 65 6e 65 72 69 63 20 63 79 63 6c  ..# generic cycl
3340: 65 20 62 72 65 61 6b 65 72 2e 0a 0a 09 3a 3a 76  e breaker....::v
3350: 61 72 69 61 62 6c 65 20 6d 79 6c 61 73 74 70 6f  ariable mylastpo
3360: 73 0a 09 3a 3a 76 61 72 69 61 62 6c 65 20 6d 79  s..::variable my
3370: 63 73 65 74 0a 09 3a 3a 76 61 72 69 61 62 6c 65  cset..::variable
3380: 20 6d 79 72 65 76 69 73 69 6f 6e 63 68 61 6e 67   myrevisionchang
3390: 65 73 65 74 73 0a 0a 09 73 65 74 20 6e 65 78 74  esets...set next
33a0: 70 6f 73 20 5b 65 78 70 72 20 7b 24 6d 79 6c 61  pos [expr {$myla
33b0: 73 74 70 6f 73 20 2b 20 31 7d 5d 0a 09 73 65 74  stpos + 1}]..set
33c0: 20 6e 65 78 74 20 20 20 20 24 6d 79 63 73 65 74   next    $mycset
33d0: 28 24 6e 65 78 74 70 6f 73 29 0a 0a 09 70 75 74  ($nextpos)...put
33e0: 73 20 22 2a 2a 20 4c 61 73 74 3a 20 24 6d 79 6c  s "** Last: $myl
33f0: 61 73 74 70 6f 73 20 3d 20 5b 24 6d 79 63 73 65  astpos = [$mycse
3400: 74 28 24 6d 79 6c 61 73 74 70 6f 73 29 20 73 74  t($mylastpos) st
3410: 72 5d 20 40 20 5b 24 6d 79 63 73 65 74 28 24 6d  r] @ [$mycset($m
3420: 79 6c 61 73 74 70 6f 73 29 20 70 6f 73 5d 22 0a  ylastpos) pos]".
3430: 09 70 75 74 73 20 22 2a 2a 20 4e 65 78 74 3a 20  .puts "** Next: 
3440: 24 6e 65 78 74 70 6f 73 20 3d 20 5b 24 6e 65 78  $nextpos = [$nex
3450: 74 20 73 74 72 5d 20 40 20 5b 24 6e 65 78 74 20  t str] @ [$next 
3460: 70 6f 73 5d 22 0a 0a 09 73 65 74 20 70 61 74 68  pos]"...set path
3470: 20 5b 53 65 61 72 63 68 46 6f 72 50 61 74 68 20   [SearchForPath 
3480: 24 67 72 61 70 68 20 24 6e 65 78 74 20 24 6d 79  $graph $next $my
3490: 72 65 76 69 73 69 6f 6e 63 68 61 6e 67 65 73 65  revisionchangese
34a0: 74 73 5d 0a 09 69 66 20 7b 5b 6c 6c 65 6e 67 74  ts]..if {[llengt
34b0: 68 20 24 70 61 74 68 5d 7d 20 7b 0a 09 20 20 20  h $path]} {..   
34c0: 20 63 79 63 6c 65 62 72 65 61 6b 65 72 20 62 72   cyclebreaker br
34d0: 65 61 6b 2d 73 65 67 6d 65 6e 74 20 24 67 72 61  eak-segment $gra
34e0: 70 68 20 24 70 61 74 68 0a 09 20 20 20 20 72 65  ph $path..    re
34f0: 74 75 72 6e 0a 09 7d 0a 0a 09 23 20 57 65 20 77  turn..}...# We w
3500: 65 72 65 20 75 6e 61 62 6c 65 20 74 6f 20 66 69  ere unable to fi
3510: 6e 64 20 61 6e 20 6f 72 64 65 72 65 64 20 63 68  nd an ordered ch
3520: 61 6e 67 65 73 65 74 20 69 6e 20 74 68 65 20 72  angeset in the r
3530: 65 61 63 68 61 62 6c 65 0a 09 23 20 70 72 65 64  eachable..# pred
3540: 65 63 65 73 73 6f 72 73 2c 20 66 61 6c 6c 20 62  ecessors, fall b
3550: 61 63 6b 20 74 6f 20 74 68 65 20 67 65 6e 65 72  ack to the gener
3560: 69 63 20 63 6f 64 65 20 66 6f 72 20 62 72 65 61  ic code for brea
3570: 6b 69 6e 67 20 74 68 65 0a 09 23 20 66 6f 75 6e  king the..# foun
3580: 64 20 63 79 63 6c 65 2e 0a 0a 09 63 79 63 6c 65  d cycle....cycle
3590: 62 72 65 61 6b 65 72 20 62 72 65 61 6b 20 24 67  breaker break $g
35a0: 72 61 70 68 0a 20 20 20 20 7d 0a 0a 20 20 20 20  raph.    }..    
35b0: 70 72 6f 63 20 53 65 61 72 63 68 46 6f 72 50 61  proc SearchForPa
35c0: 74 68 20 7b 67 72 61 70 68 20 6e 20 73 74 6f 70  th {graph n stop
35d0: 6e 6f 64 65 73 7d 20 7b 0a 09 23 20 53 65 61 72  nodes} {..# Sear
35e0: 63 68 20 66 6f 72 20 70 61 74 68 73 20 74 6f 20  ch for paths to 
35f0: 70 72 65 72 65 71 75 69 73 69 74 65 73 20 6f 66  prerequisites of
3600: 20 4e 2e 0a 09 23 0a 09 23 20 54 72 79 20 74 6f   N...#..# Try to
3610: 20 66 69 6e 64 20 74 68 65 20 73 68 6f 72 74 65   find the shorte
3620: 73 74 20 64 65 70 65 6e 64 65 6e 63 79 20 70 61  st dependency pa
3630: 74 68 20 74 68 61 74 20 63 61 75 73 65 73 20 74  th that causes t
3640: 68 65 0a 09 23 20 63 68 61 6e 67 65 73 65 74 20  he..# changeset 
3650: 4e 20 74 6f 20 64 65 70 65 6e 64 20 28 64 69 72  N to depend (dir
3660: 65 63 74 6c 79 20 6f 72 20 69 6e 64 69 72 65 63  ectly or indirec
3670: 74 6c 79 29 20 6f 6e 20 6f 6e 65 20 6f 66 20 74  tly) on one of t
3680: 68 65 0a 09 23 20 63 68 61 6e 67 65 73 65 74 73  he..# changesets
3690: 20 63 6f 6e 74 61 69 6e 65 64 20 69 6e 20 53 54   contained in ST
36a0: 4f 50 4e 4f 44 45 53 2e 0a 09 23 0a 09 23 20 57  OPNODES...#..# W
36b0: 65 20 63 6f 6e 73 69 64 65 72 20 64 69 72 65 63  e consider direc
36c0: 74 20 61 6e 64 20 69 6e 64 69 72 65 63 74 20 64  t and indirect d
36d0: 65 70 65 6e 64 65 6e 63 69 65 73 20 69 6e 20 74  ependencies in t
36e0: 68 65 20 73 65 6e 73 65 0a 09 23 20 74 68 61 74  he sense..# that
36f0: 20 74 68 65 20 63 68 61 6e 67 65 73 65 74 20 63   the changeset c
3700: 61 6e 20 62 65 20 72 65 61 63 68 65 64 20 62 79  an be reached by
3710: 20 66 6f 6c 6c 6f 77 69 6e 67 20 61 20 63 68 61   following a cha
3720: 69 6e 20 6f 66 0a 09 23 20 70 72 65 64 65 63 65  in of..# predece
3730: 73 73 6f 72 20 6e 6f 64 65 73 2e 0a 09 23 0a 09  ssor nodes...#..
3740: 23 20 57 68 65 6e 20 6f 6e 65 20 6f 66 20 74 68  # When one of th
3750: 65 20 63 73 65 74 73 20 69 6e 20 53 54 4f 50 4e  e csets in STOPN
3760: 4f 44 45 53 20 69 73 20 66 6f 75 6e 64 2c 20 77  ODES is found, w
3770: 65 20 74 65 72 6d 69 6e 61 74 65 0a 09 23 20 74  e terminate..# t
3780: 68 65 20 73 65 61 72 63 68 20 61 6e 64 20 72 65  he search and re
3790: 74 75 72 6e 20 74 68 65 20 70 61 74 68 20 66 72  turn the path fr
37a0: 6f 6d 20 74 68 61 74 20 63 73 65 74 20 74 6f 20  om that cset to 
37b0: 4e 2e 20 20 49 66 20 6e 6f 0a 09 23 20 70 61 74  N.  If no..# pat
37c0: 68 20 69 73 20 66 6f 75 6e 64 20 74 6f 20 61 20  h is found to a 
37d0: 6e 6f 64 65 20 69 6e 20 53 54 4f 50 5f 53 45 54  node in STOP_SET
37e0: 2c 20 77 65 20 72 65 74 75 72 6e 20 74 68 65 20  , we return the 
37f0: 65 6d 70 74 79 0a 09 23 20 6c 69 73 74 2f 70 61  empty..# list/pa
3800: 74 68 2e 0a 0a 09 23 20 54 68 69 73 20 69 73 20  th....# This is 
3810: 69 6e 20 65 73 73 65 6e 63 65 20 61 20 6d 75 6c  in essence a mul
3820: 74 69 2d 64 65 73 74 69 6e 61 74 69 6f 6e 20 44  ti-destination D
3830: 69 6a 6b 73 74 72 61 20 73 74 61 72 74 69 6e 67  ijkstra starting
3840: 20 61 74 0a 09 23 20 4e 20 77 68 69 63 68 20 73   at..# N which s
3850: 74 6f 70 73 20 77 68 65 6e 20 6f 6e 65 20 6f 66  tops when one of
3860: 20 74 68 65 20 64 65 73 74 69 6e 61 74 69 6f 6e   the destination
3870: 73 20 69 6e 20 53 54 4f 50 4e 4f 44 45 53 20 68  s in STOPNODES h
3880: 61 73 0a 09 23 20 62 65 65 6e 20 72 65 61 63 68  as..# been reach
3890: 65 64 2c 20 74 72 61 76 65 72 73 69 6e 67 20 74  ed, traversing t
38a0: 68 65 20 70 72 65 64 65 63 65 73 73 6f 72 20 61  he predecessor a
38b0: 72 63 73 2e 0a 0a 09 23 20 52 45 41 43 48 41 42  rcs....# REACHAB
38c0: 4c 45 20 3a 3a 20 61 72 72 61 79 20 28 4e 4f 44  LE :: array (NOD
38d0: 45 20 2d 3e 20 6c 69 73 74 20 28 53 54 45 50 53  E -> list (STEPS
38e0: 2c 20 50 52 45 56 49 4f 55 53 29 29 0a 09 23 0a  , PREVIOUS))..#.
38f0: 09 23 20 53 65 6d 61 6e 74 69 63 73 3a 20 4e 4f  .# Semantics: NO
3900: 44 45 20 63 61 6e 20 62 65 20 72 65 61 63 68 65  DE can be reache
3910: 64 20 66 72 6f 6d 20 4e 20 69 6e 20 53 54 45 50  d from N in STEP
3920: 53 20 73 74 65 70 73 2c 20 61 6e 64 0a 09 23 20  S steps, and..# 
3930: 50 52 45 56 49 4f 55 53 20 69 73 20 74 68 65 20  PREVIOUS is the 
3940: 70 72 65 76 69 6f 75 73 20 6e 6f 64 65 20 69 6e  previous node in
3950: 20 74 68 65 20 70 61 74 68 20 77 68 69 63 68 20   the path which 
3960: 72 65 61 63 68 65 64 20 69 74 2c 0a 09 23 20 61  reached it,..# a
3970: 6c 6c 6f 77 69 6e 67 20 75 73 20 61 74 20 74 68  llowing us at th
3980: 65 20 65 6e 64 20 74 6f 20 63 6f 6e 73 74 72 75  e end to constru
3990: 63 74 20 74 68 65 20 66 75 6c 6c 20 70 61 74 68  ct the full path
39a0: 20 62 79 0a 09 23 20 66 6f 6c 6c 6f 77 69 6e 67   by..# following
39b0: 20 74 68 65 73 65 20 62 61 63 6b 6c 69 6e 6b 73   these backlinks
39c0: 20 66 72 6f 6d 20 74 68 65 20 66 6f 75 6e 64 20   from the found 
39d0: 64 65 73 74 69 6e 61 74 69 6f 6e 2e 20 4e 20 69  destination. N i
39e0: 73 0a 09 23 20 6f 6e 6c 79 20 69 6e 63 6c 75 64  s..# only includ
39f0: 65 64 20 61 73 20 61 20 6b 65 79 20 69 66 20 74  ed as a key if t
3a00: 68 65 72 65 20 69 73 20 61 20 6c 6f 6f 70 20 6c  here is a loop l
3a10: 65 61 64 69 6e 67 20 62 61 63 6b 20 74 6f 0a 09  eading back to..
3a20: 23 20 69 74 2e 0a 0a 09 23 20 50 45 4e 44 49 4e  # it....# PENDIN
3a30: 47 20 3a 3a 20 6c 69 73 74 20 28 6c 69 73 74 20  G :: list (list 
3a40: 28 4e 4f 44 45 2c 20 53 54 45 50 53 29 29 0a 09  (NODE, STEPS))..
3a50: 23 0a 09 23 20 53 65 6d 61 6e 74 69 63 73 3a 20  #..# Semantics: 
3a60: 41 20 6c 69 73 74 20 6f 66 20 70 6f 73 73 69 62  A list of possib
3a70: 69 6c 69 74 69 65 73 20 74 68 61 74 20 73 74 69  ilities that sti
3a80: 6c 6c 20 68 61 76 65 20 74 6f 20 62 65 0a 09 23  ll have to be..#
3a90: 20 69 6e 76 65 73 74 69 67 61 74 65 64 2c 20 77   investigated, w
3aa0: 68 65 72 65 20 53 54 45 50 53 20 69 73 20 74 68  here STEPS is th
3ab0: 65 20 6e 75 6d 62 65 72 20 6f 66 20 73 74 65 70  e number of step
3ac0: 73 20 74 6f 20 67 65 74 20 74 6f 0a 09 23 20 4e  s to get to..# N
3ad0: 4f 44 45 2e 0a 0a 09 61 72 72 61 79 20 73 65 74  ODE....array set
3ae0: 20 72 65 61 63 68 61 62 6c 65 20 7b 7d 0a 09 73   reachable {}..s
3af0: 65 74 20 70 65 6e 64 69 6e 67 20 5b 6c 69 73 74  et pending [list
3b00: 20 5b 6c 69 73 74 20 24 6e 20 30 5d 5d 0a 09 73   [list $n 0]]..s
3b10: 65 74 20 61 74 20 30 0a 0a 09 70 75 74 73 20 22  et at 0...puts "
3b20: 2a 2a 20 53 65 61 72 63 68 69 6e 67 20 73 68 6f  ** Searching sho
3b30: 72 74 65 73 74 20 70 61 74 68 20 2e 2e 2e 22 0a  rtest path ...".
3b40: 0a 09 77 68 69 6c 65 20 7b 24 61 74 20 3c 20 5b  ..while {$at < [
3b50: 6c 6c 65 6e 67 74 68 20 24 70 65 6e 64 69 6e 67  llength $pending
3b60: 5d 7d 20 7b 0a 09 20 20 20 20 73 74 72 75 63 74  ]} {..    struct
3b70: 3a 3a 6c 69 73 74 20 61 73 73 69 67 6e 20 5b 6c  ::list assign [l
3b80: 69 6e 64 65 78 20 24 70 65 6e 64 69 6e 67 20 24  index $pending $
3b90: 61 74 5d 20 63 75 72 72 65 6e 74 20 73 74 65 70  at] current step
3ba0: 73 0a 0a 09 20 20 20 20 23 70 75 74 73 20 22 2a  s...    #puts "*
3bb0: 2a 20 5b 6c 69 6e 64 65 78 20 24 70 65 6e 64 69  * [lindex $pendi
3bc0: 6e 67 20 24 61 74 5d 20 2a 2a 20 5b 24 63 75 72  ng $at] ** [$cur
3bd0: 72 65 6e 74 20 73 74 72 5d 20 2a 2a 22 0a 09 20  rent str] **".. 
3be0: 20 20 20 69 6e 63 72 20 61 74 0a 0a 09 20 20 20     incr at...   
3bf0: 20 23 20 50 72 6f 63 65 73 73 20 74 68 65 20 70   # Process the p
3c00: 6f 73 73 69 62 69 6c 69 74 79 2e 20 54 68 69 73  ossibility. This
3c10: 20 69 73 20 61 20 62 72 65 61 64 74 68 2d 66 69   is a breadth-fi
3c20: 72 73 74 20 74 72 61 76 65 72 73 61 6c 2e 0a 09  rst traversal...
3c30: 20 20 20 20 69 6e 63 72 20 73 74 65 70 73 0a 09      incr steps..
3c40: 20 20 20 20 66 6f 72 65 61 63 68 20 70 72 65 20      foreach pre 
3c50: 5b 24 67 72 61 70 68 20 6e 6f 64 65 73 20 2d 69  [$graph nodes -i
3c60: 6e 20 24 63 75 72 72 65 6e 74 5d 20 7b 0a 09 20  n $current] {.. 
3c70: 20 20 20 20 20 20 20 23 20 53 69 6e 63 65 20 74         # Since t
3c80: 68 65 20 73 65 61 72 63 68 20 69 73 20 62 72 65  he search is bre
3c90: 61 64 74 68 2d 66 69 72 73 74 2c 20 77 65 20 6f  adth-first, we o
3ca0: 6e 6c 79 20 68 61 76 65 20 74 6f 20 23 0a 09 20  nly have to #.. 
3cb0: 20 20 20 20 20 20 20 23 20 73 65 74 20 6e 6f 64         # set nod
3cc0: 65 73 20 74 68 61 74 20 64 6f 6e 27 74 20 61 6c  es that don't al
3cd0: 72 65 61 64 79 20 65 78 69 73 74 2e 20 49 66 20  ready exist. If 
3ce0: 74 68 65 79 20 64 6f 20 74 68 65 79 0a 09 20 20  they do they..  
3cf0: 20 20 20 20 20 20 23 20 68 61 76 65 20 62 65 65        # have bee
3d00: 6e 20 72 65 61 63 68 65 64 20 61 6c 72 65 61 64  n reached alread
3d10: 79 20 6f 6e 20 61 20 73 68 6f 72 74 65 72 20 70  y on a shorter p
3d20: 61 74 68 2e 0a 0a 09 09 69 66 20 7b 5b 69 6e 66  ath.....if {[inf
3d30: 6f 20 65 78 69 73 74 73 20 72 65 61 63 68 61 62  o exists reachab
3d40: 6c 65 28 24 70 72 65 29 5d 7d 20 63 6f 6e 74 69  le($pre)]} conti
3d50: 6e 75 65 0a 0a 09 09 73 65 74 20 72 65 61 63 68  nue....set reach
3d60: 61 62 6c 65 28 24 70 72 65 29 20 5b 6c 69 73 74  able($pre) [list
3d70: 20 24 73 74 65 70 73 20 24 63 75 72 72 65 6e 74   $steps $current
3d80: 5d 0a 09 09 6c 61 70 70 65 6e 64 20 70 65 6e 64  ]...lappend pend
3d90: 69 6e 67 20 5b 6c 69 73 74 20 24 70 72 65 20 24  ing [list $pre $
3da0: 73 74 65 70 73 5d 0a 0a 09 09 23 20 43 6f 6e 74  steps]....# Cont
3db0: 69 6e 75 65 20 74 68 65 20 73 65 61 72 63 68 20  inue the search 
3dc0: 77 68 69 6c 65 20 68 61 76 65 20 6e 6f 74 20 72  while have not r
3dd0: 65 61 63 68 65 64 20 61 6e 79 20 6f 66 0a 09 09  eached any of...
3de0: 23 20 6f 75 72 20 64 65 73 74 69 6e 61 74 69 6f  # our destinatio
3df0: 6e 73 3f 0a 09 09 69 66 20 7b 21 5b 73 74 72 75  ns?...if {![stru
3e00: 63 74 3a 3a 73 65 74 20 63 6f 6e 74 61 69 6e 20  ct::set contain 
3e10: 24 70 72 65 20 24 73 74 6f 70 6e 6f 64 65 73 5d  $pre $stopnodes]
3e20: 7d 20 63 6f 6e 74 69 6e 75 65 0a 0a 09 09 23 20  } continue....# 
3e30: 57 65 20 68 61 76 65 20 61 72 72 69 76 65 64 2c  We have arrived,
3e40: 20 50 52 45 20 69 73 20 6f 6e 65 20 6f 66 20 74   PRE is one of t
3e50: 68 65 20 64 65 73 74 69 6e 61 74 69 6f 6e 3b 20  he destination; 
3e60: 6e 6f 77 0a 09 09 23 20 63 6f 6e 73 74 72 75 63  now...# construc
3e70: 74 20 61 6e 64 20 72 65 74 75 72 6e 20 74 68 65  t and return the
3e80: 20 70 61 74 68 20 74 6f 20 69 74 20 66 72 6f 6d   path to it from
3e90: 20 4e 20 62 79 0a 09 09 23 20 66 6f 6c 6c 6f 77   N by...# follow
3ea0: 69 6e 67 20 74 68 65 20 62 61 63 6b 6c 69 6e 6b  ing the backlink
3eb0: 73 20 69 6e 20 74 68 65 20 73 65 61 72 63 68 20  s in the search 
3ec0: 73 74 61 74 65 2e 0a 09 09 73 65 74 20 70 61 74  state....set pat
3ed0: 68 20 5b 6c 69 73 74 20 24 70 72 65 5d 0a 09 09  h [list $pre]...
3ee0: 77 68 69 6c 65 20 7b 31 7d 20 7b 0a 09 09 20 20  while {1} {...  
3ef0: 20 20 73 65 74 20 70 72 65 20 5b 6c 69 6e 64 65    set pre [linde
3f00: 78 20 24 72 65 61 63 68 61 62 6c 65 28 24 70 72  x $reachable($pr
3f10: 65 29 20 31 5d 0a 09 09 20 20 20 20 69 66 20 7b  e) 1]...    if {
3f20: 24 70 72 65 20 65 71 20 24 6e 7d 20 62 72 65 61  $pre eq $n} brea
3f30: 6b 0a 09 09 20 20 20 20 6c 61 70 70 65 6e 64 20  k...    lappend 
3f40: 70 61 74 68 20 24 70 72 65 0a 09 09 7d 0a 09 09  path $pre...}...
3f50: 6c 61 70 70 65 6e 64 20 70 61 74 68 20 24 6e 0a  lappend path $n.
3f60: 0a 09 09 70 75 74 73 20 22 2a 2a 20 53 65 61 72  ...puts "** Sear
3f70: 63 68 69 6e 67 20 73 68 6f 72 74 65 73 74 20 70  ching shortest p
3f80: 61 74 68 20 2e 2e 2e 20 46 6f 75 6e 64 20 28 5b  ath ... Found ([
3f90: 70 72 6f 6a 65 63 74 20 72 65 76 20 73 74 72 6c  project rev strl
3fa0: 69 73 74 20 24 70 61 74 68 5d 29 22 0a 09 09 72  ist $path])"...r
3fb0: 65 74 75 72 6e 20 24 70 61 74 68 0a 09 20 20 20  eturn $path..   
3fc0: 20 7d 0a 09 7d 0a 0a 09 70 75 74 73 20 22 2a 2a   }..}...puts "**
3fd0: 20 53 65 61 72 63 68 69 6e 67 20 73 68 6f 72 74   Searching short
3fe0: 65 73 74 20 70 61 74 68 20 2e 2e 2e 20 4e 6f 74  est path ... Not
3ff0: 20 66 6f 75 6e 64 22 0a 0a 09 23 20 4e 6f 20 70   found"...# No p
4000: 61 74 68 20 66 6f 75 6e 64 2e 0a 09 72 65 74 75  ath found...retu
4010: 72 6e 20 7b 7d 0a 20 20 20 20 7d 0a 0a 20 20 20  rn {}.    }..   
4020: 20 23 20 23 20 23 23 20 23 23 23 20 23 23 23 23   # # ## ### ####
4030: 23 20 23 23 23 23 23 23 23 23 20 23 23 23 23 23  # ######## #####
4040: 23 23 23 23 23 23 23 23 0a 0a 20 20 20 20 74 79  ########..    ty
4050: 70 65 76 61 72 69 61 62 6c 65 20 6d 79 63 73 65  pevariable mycse
4060: 74 20 2d 61 72 72 61 79 20 7b 7d 20 3b 20 23 20  t -array {} ; # 
4070: 4d 61 70 20 66 72 6f 6d 20 63 6f 6d 6d 69 74 20  Map from commit 
4080: 70 6f 73 69 74 69 6f 6e 73 20 74 6f 20 74 68 65  positions to the
4090: 0a 09 09 09 09 20 20 20 20 23 20 63 68 61 6e 67  .....    # chang
40a0: 65 73 65 74 20 28 6f 62 6a 65 63 74 20 72 65 66  eset (object ref
40b0: 29 20 61 74 20 74 68 61 74 0a 09 09 09 09 20 20  ) at that.....  
40c0: 20 20 23 20 70 6f 73 69 74 69 6f 6e 2e 0a 0a 20    # position... 
40d0: 20 20 20 23 20 23 20 23 23 20 23 23 23 20 23 23     # # ## ### ##
40e0: 23 23 23 20 23 23 23 23 23 23 23 23 20 23 23 23  ### ######## ###
40f0: 23 23 23 23 23 23 23 23 23 23 0a 20 20 20 20 23  ##########.    #
4100: 23 20 43 6f 6e 66 69 67 75 72 61 74 69 6f 6e 0a  # Configuration.
4110: 0a 20 20 20 20 70 72 61 67 6d 61 20 2d 68 61 73  .    pragma -has
4120: 69 6e 73 74 61 6e 63 65 73 20 20 20 6e 6f 20 3b  instances   no ;
4130: 20 23 20 73 69 6e 67 6c 65 74 6f 6e 0a 20 20 20   # singleton.   
4140: 20 70 72 61 67 6d 61 20 2d 68 61 73 74 79 70 65   pragma -hastype
4150: 69 6e 66 6f 20 20 20 20 6e 6f 20 3b 20 23 20 6e  info    no ; # n
4160: 6f 20 69 6e 74 72 6f 73 70 65 63 74 69 6f 6e 0a  o introspection.
4170: 20 20 20 20 70 72 61 67 6d 61 20 2d 68 61 73 74      pragma -hast
4180: 79 70 65 64 65 73 74 72 6f 79 20 6e 6f 20 3b 20  ypedestroy no ; 
4190: 23 20 69 6d 6d 6f 72 74 61 6c 0a 0a 20 20 20 20  # immortal..    
41a0: 23 20 23 20 23 23 20 23 23 23 20 23 23 23 23 23  # # ## ### #####
41b0: 20 23 23 23 23 23 23 23 23 20 23 23 23 23 23 23   ######## ######
41c0: 23 23 23 23 23 23 23 0a 7d 0a 0a 6e 61 6d 65 73  #######.}..names
41d0: 70 61 63 65 20 65 76 61 6c 20 3a 3a 76 63 3a 3a  pace eval ::vc::
41e0: 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a  fossil::import::
41f0: 63 76 73 3a 3a 70 61 73 73 20 7b 0a 20 20 20 20  cvs::pass {.    
4200: 6e 61 6d 65 73 70 61 63 65 20 65 78 70 6f 72 74  namespace export
4210: 20 62 72 65 61 6b 61 63 79 63 6c 65 0a 20 20 20   breakacycle.   
4220: 20 6e 61 6d 65 73 70 61 63 65 20 65 76 61 6c 20   namespace eval 
4230: 62 72 65 61 6b 61 63 79 63 6c 65 20 7b 0a 09 6e  breakacycle {..n
4240: 61 6d 65 73 70 61 63 65 20 69 6d 70 6f 72 74 20  amespace import 
4250: 3a 3a 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d  ::vc::fossil::im
4260: 70 6f 72 74 3a 3a 63 76 73 3a 3a 63 79 63 6c 65  port::cvs::cycle
4270: 62 72 65 61 6b 65 72 0a 09 6e 61 6d 65 73 70 61  breaker..namespa
4280: 63 65 20 69 6d 70 6f 72 74 20 3a 3a 76 63 3a 3a  ce import ::vc::
4290: 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a  fossil::import::
42a0: 63 76 73 3a 3a 72 65 70 6f 73 69 74 6f 72 79 0a  cvs::repository.
42b0: 09 6e 61 6d 65 73 70 61 63 65 20 69 6d 70 6f 72  .namespace impor
42c0: 74 20 3a 3a 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a  t ::vc::fossil::
42d0: 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 73 74 61  import::cvs::sta
42e0: 74 65 0a 09 6e 61 6d 65 73 70 61 63 65 20 69 6d  te..namespace im
42f0: 70 6f 72 74 20 3a 3a 76 63 3a 3a 66 6f 73 73 69  port ::vc::fossi
4300: 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a  l::import::cvs::
4310: 69 6e 74 65 67 72 69 74 79 0a 09 6e 61 6d 65 73  integrity..names
4320: 70 61 63 65 20 65 76 61 6c 20 70 72 6f 6a 65 63  pace eval projec
4330: 74 20 7b 0a 09 20 20 20 20 6e 61 6d 65 73 70 61  t {..    namespa
4340: 63 65 20 69 6d 70 6f 72 74 20 3a 3a 76 63 3a 3a  ce import ::vc::
4350: 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a  fossil::import::
4360: 63 76 73 3a 3a 70 72 6f 6a 65 63 74 3a 3a 72 65  cvs::project::re
4370: 76 0a 09 7d 0a 09 6e 61 6d 65 73 70 61 63 65 20  v..}..namespace 
4380: 69 6d 70 6f 72 74 20 3a 3a 76 63 3a 3a 74 6f 6f  import ::vc::too
4390: 6c 73 3a 3a 6d 69 73 63 3a 3a 2a 0a 09 6e 61 6d  ls::misc::*..nam
43a0: 65 73 70 61 63 65 20 69 6d 70 6f 72 74 20 3a 3a  espace import ::
43b0: 76 63 3a 3a 74 6f 6f 6c 73 3a 3a 74 72 6f 75 62  vc::tools::troub
43c0: 6c 65 0a 09 6e 61 6d 65 73 70 61 63 65 20 69 6d  le..namespace im
43d0: 70 6f 72 74 20 3a 3a 76 63 3a 3a 74 6f 6f 6c 73  port ::vc::tools
43e0: 3a 3a 6c 6f 67 0a 09 6c 6f 67 20 72 65 67 69 73  ::log..log regis
43f0: 74 65 72 20 62 72 65 61 6b 61 63 79 63 6c 65 0a  ter breakacycle.
4400: 20 20 20 20 7d 0a 7d 0a 0a 23 20 23 20 23 23 20      }.}..# # ## 
4410: 23 23 23 20 23 23 23 23 23 20 23 23 23 23 23 23  ### ##### ######
4420: 23 23 20 23 23 23 23 23 23 23 23 23 23 23 23 23  ## #############
4430: 20 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23   ###############
4440: 23 23 23 23 23 23 0a 23 23 20 52 65 61 64 79 0a  ######.## Ready.
4450: 0a 70 61 63 6b 61 67 65 20 70 72 6f 76 69 64 65  .package provide
4460: 20 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70   vc::fossil::imp
4470: 6f 72 74 3a 3a 63 76 73 3a 3a 70 61 73 73 3a 3a  ort::cvs::pass::
4480: 62 72 65 61 6b 61 63 79 63 6c 65 20 31 2e 30 0a  breakacycle 1.0.
4490: 72 65 74 75 72 6e 0a                             return.