Hex Artifact Content
Not logged in

Artifact 642a0a9f2ef133a04a8456b733336b4bc87303cc:

File tools/cvs2fossil/lib/c2f_pbreakacycle.tcl part of check-in [8c6488ded2] - Continued work on the integrity checks for changesets. Moved callers out of transactions. Two checks are already tripping on bad changesets made by InitCSets (pass 5). by aku on 2007-11-27 04:26:56.

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 09 7d 0a   Changesets]..}.
0c20: 0a 09 72 65 70 6f 73 69 74 6f 72 79 20 70 72 69  ..repository pri
0c30: 6e 74 63 73 65 74 73 74 61 74 69 73 74 69 63 73  ntcsetstatistics
0c40: 0a 09 69 6e 74 65 67 72 69 74 79 20 63 68 61 6e  ..integrity chan
0c50: 67 65 73 65 74 73 0a 09 72 65 74 75 72 6e 0a 20  gesets..return. 
0c60: 20 20 20 7d 0a 0a 20 20 20 20 74 79 70 65 6d 65     }..    typeme
0c70: 74 68 6f 64 20 64 69 73 63 61 72 64 20 7b 7d 20  thod discard {} 
0c80: 7b 0a 09 23 20 50 61 73 73 20 6d 61 6e 61 67 65  {..# Pass manage
0c90: 72 20 69 6e 74 65 72 66 61 63 65 2e 20 45 78 65  r interface. Exe
0ca0: 63 75 74 65 64 20 66 6f 72 20 61 6c 6c 20 70 61  cuted for all pa
0cb0: 73 73 65 73 20 61 66 74 65 72 20 74 68 65 0a 09  sses after the..
0cc0: 23 20 72 75 6e 20 70 61 73 73 65 73 2c 20 74 6f  # run passes, to
0cd0: 20 72 65 6d 6f 76 65 20 61 6c 6c 20 64 61 74 61   remove all data
0ce0: 20 6f 66 20 74 68 69 73 20 70 61 73 73 20 66 72   of this pass fr
0cf0: 6f 6d 20 74 68 65 20 73 74 61 74 65 2c 0a 09 23  om the state,..#
0d00: 20 61 73 20 62 65 69 6e 67 20 6f 75 74 20 6f 66   as being out of
0d10: 20 64 61 74 65 2e 0a 09 72 65 74 75 72 6e 0a 20   date...return. 
0d20: 20 20 20 7d 0a 0a 20 20 20 20 23 20 23 20 23 23     }..    # # ##
0d30: 20 23 23 23 20 23 23 23 23 23 20 23 23 23 23 23   ### ##### #####
0d40: 23 23 23 20 23 23 23 23 23 23 23 23 23 23 23 23  ### ############
0d50: 23 0a 20 20 20 20 23 23 20 49 6e 74 65 72 6e 61  #.    ## Interna
0d60: 6c 20 6d 65 74 68 6f 64 73 0a 0a 20 20 20 20 70  l methods..    p
0d70: 72 6f 63 20 43 68 61 6e 67 65 73 65 74 73 20 7b  roc Changesets {
0d80: 7d 20 7b 20 70 72 6f 6a 65 63 74 3a 3a 72 65 76  } { project::rev
0d90: 20 61 6c 6c 20 7d 0a 0a 20 20 20 20 70 72 6f 63   all }..    proc
0da0: 20 4c 6f 61 64 43 6f 6d 6d 69 74 4f 72 64 65 72   LoadCommitOrder
0db0: 20 7b 7d 20 7b 0a 09 3a 3a 76 61 72 69 61 62 6c   {} {..::variabl
0dc0: 65 20 6d 79 63 73 65 74 0a 09 3a 3a 76 61 72 69  e mycset..::vari
0dd0: 61 62 6c 65 20 6d 79 72 65 76 69 73 69 6f 6e 63  able myrevisionc
0de0: 68 61 6e 67 65 73 65 74 73 0a 0a 09 73 74 61 74  hangesets...stat
0df0: 65 20 74 72 61 6e 73 61 63 74 69 6f 6e 20 7b 0a  e transaction {.
0e00: 09 20 20 20 20 66 6f 72 65 61 63 68 20 7b 63 69  .    foreach {ci
0e10: 64 20 70 6f 73 7d 20 5b 73 74 61 74 65 20 72 75  d pos} [state ru
0e20: 6e 20 7b 20 53 45 4c 45 43 54 20 63 69 64 2c 20  n { SELECT cid, 
0e30: 70 6f 73 20 46 52 4f 4d 20 63 73 6f 72 64 65 72  pos FROM csorder
0e40: 20 7d 5d 20 7b 0a 09 09 73 65 74 20 63 73 65 74   }] {...set cset
0e50: 20 5b 70 72 6f 6a 65 63 74 3a 3a 72 65 76 20 6f   [project::rev o
0e60: 66 20 24 63 69 64 5d 0a 09 09 24 63 73 65 74 20  f $cid]...$cset 
0e70: 73 65 74 70 6f 73 20 24 70 6f 73 0a 09 09 73 65  setpos $pos...se
0e80: 74 20 6d 79 63 73 65 74 28 24 70 6f 73 29 20 24  t mycset($pos) $
0e90: 63 73 65 74 0a 09 09 6c 61 70 70 65 6e 64 20 6d  cset...lappend m
0ea0: 79 72 65 76 69 73 69 6f 6e 63 68 61 6e 67 65 73  yrevisionchanges
0eb0: 65 74 73 20 24 63 73 65 74 0a 09 20 20 20 20 7d  ets $cset..    }
0ec0: 0a 09 20 20 20 20 23 20 52 65 6d 6f 76 65 20 74  ..    # Remove t
0ed0: 68 65 20 6f 72 64 65 72 20 69 6e 66 6f 72 6d 61  he order informa
0ee0: 74 69 6f 6e 20 6e 6f 77 20 74 68 61 74 20 77 65  tion now that we
0ef0: 20 68 61 76 65 20 69 74 20 69 6e 0a 09 20 20 20   have it in..   
0f00: 20 23 20 6d 65 6d 6f 72 79 2c 20 73 6f 20 74 68   # memory, so th
0f10: 61 74 20 77 65 20 63 61 6e 20 73 61 76 65 20 69  at we can save i
0f20: 74 20 6f 6e 63 65 20 6d 6f 72 65 2c 20 66 6f 72  t once more, for
0f30: 20 61 6c 6c 0a 09 20 20 20 20 23 20 63 68 61 6e   all..    # chan
0f40: 67 65 73 65 74 73 2c 20 77 68 69 6c 65 20 62 72  gesets, while br
0f50: 65 61 6b 69 6e 67 20 74 68 65 20 72 65 6d 61 69  eaking the remai
0f60: 6e 69 6e 67 20 63 79 63 6c 65 73 2e 0a 09 20 20  ning cycles...  
0f70: 20 20 73 74 61 74 65 20 72 75 6e 20 7b 20 44 45    state run { DE
0f80: 4c 45 54 45 20 46 52 4f 4d 20 63 73 6f 72 64 65  LETE FROM csorde
0f90: 72 20 7d 0a 09 7d 0a 09 72 65 74 75 72 6e 0a 20  r }..}..return. 
0fa0: 20 20 20 7d 0a 0a 20 20 20 20 23 20 23 20 23 23     }..    # # ##
0fb0: 20 23 23 23 20 23 23 23 23 23 20 23 23 23 23 23   ### ##### #####
0fc0: 23 23 23 20 23 23 23 23 23 23 23 23 23 23 23 23  ### ############
0fd0: 23 0a 0a 20 20 20 20 70 72 6f 63 20 42 72 65 61  #..    proc Brea
0fe0: 6b 42 61 63 6b 77 61 72 64 42 72 61 6e 63 68 65  kBackwardBranche
0ff0: 73 20 7b 67 72 61 70 68 7d 20 7b 0a 09 23 20 57  s {graph} {..# W
1000: 65 20 67 6f 20 6f 76 65 72 20 61 6c 6c 20 62 72  e go over all br
1010: 61 6e 63 68 20 63 68 61 6e 67 65 73 65 74 73 2c  anch changesets,
1020: 20 69 2e 65 2e 20 74 68 65 20 63 68 61 6e 67 65   i.e. the change
1030: 73 65 74 73 0a 09 23 20 63 72 65 61 74 65 64 20  sets..# created 
1040: 62 79 20 74 68 65 20 73 79 6d 62 6f 6c 73 20 77  by the symbols w
1050: 68 69 63 68 20 61 72 65 20 74 72 61 6e 73 6c 61  hich are transla
1060: 74 65 64 20 61 73 20 62 72 61 6e 63 68 65 73 2c  ted as branches,
1070: 20 61 6e 64 0a 09 23 20 62 72 65 61 6b 20 61 6e   and..# break an
1080: 79 20 77 68 69 63 68 20 61 72 65 20 27 62 61 63  y which are 'bac
1090: 6b 77 61 72 64 27 2c 20 77 68 69 63 68 20 6d 65  kward', which me
10a0: 61 6e 73 20 74 68 61 74 20 74 68 65 79 20 68 61  ans that they ha
10b0: 76 65 0a 09 23 20 61 74 20 6c 65 61 73 74 20 6f  ve..# at least o
10c0: 6e 65 20 69 6e 63 6f 6d 69 6e 67 20 72 65 76 69  ne incoming revi
10d0: 73 69 6f 6e 20 63 68 61 6e 67 65 73 65 74 20 77  sion changeset w
10e0: 68 69 63 68 20 69 73 20 63 6f 6d 6d 69 74 74 65  hich is committe
10f0: 64 0a 09 23 20 61 66 74 65 72 20 61 74 20 6c 65  d..# after at le
1100: 61 73 74 20 6f 6e 65 20 6f 66 20 74 68 65 20 6f  ast one of the o
1110: 75 74 67 6f 69 6e 67 20 72 65 76 69 73 69 6f 6e  utgoing revision
1120: 20 63 68 61 6e 67 65 73 65 74 73 2c 20 70 65 72   changesets, per
1130: 0a 09 23 20 74 68 65 20 6f 72 64 65 72 20 63 6f  ..# the order co
1140: 6d 70 75 74 65 64 20 69 6e 20 70 61 73 73 20 36  mputed in pass 6
1150: 2e 20 49 6e 20 22 63 76 73 32 73 76 6e 22 20 74  . In "cvs2svn" t
1160: 68 69 73 20 69 73 20 63 61 6c 6c 65 64 0a 09 23  his is called..#
1170: 20 22 72 65 74 72 6f 67 72 61 64 65 22 2e 0a 0a   "retrograde"...
1180: 09 23 20 4e 4f 54 45 3a 20 57 65 20 6d 69 67 68  .# NOTE: We migh
1190: 74 20 62 65 20 61 62 6c 65 20 74 6f 20 75 73 65  t be able to use
11a0: 20 6f 75 72 20 6b 6e 6f 77 6c 65 64 67 65 20 74   our knowledge t
11b0: 68 61 74 20 77 65 20 61 72 65 0a 09 23 20 6c 6f  hat we are..# lo
11c0: 6f 6b 69 6e 67 20 61 74 20 61 6c 6c 20 63 68 61  oking at all cha
11d0: 6e 67 65 73 65 74 73 20 74 6f 20 63 72 65 61 74  ngesets to creat
11e0: 65 20 61 20 73 71 6c 20 77 68 69 63 68 20 73 65  e a sql which se
11f0: 6c 65 63 74 73 20 61 6c 6c 0a 09 23 20 74 68 65  lects all..# the
1200: 20 62 72 61 6e 63 68 20 63 68 61 6e 67 65 73 65   branch changese
1210: 74 73 20 66 72 6f 6d 20 74 68 65 20 73 74 61 74  ts from the stat
1220: 65 20 69 6e 20 6f 6e 65 20 67 6f 20 69 6e 73 74  e in one go inst
1230: 65 61 64 20 6f 66 0a 09 23 20 68 61 76 69 6e 67  ead of..# having
1240: 20 74 6f 20 63 68 65 63 6b 20 65 61 63 68 20 63   to check each c
1250: 68 61 6e 67 65 73 65 74 20 73 65 70 61 72 61 74  hangeset separat
1260: 65 6c 79 2e 20 43 6f 6e 73 69 64 65 72 20 74 68  ely. Consider th
1270: 69 73 0a 09 23 20 6c 61 74 65 72 2c 20 67 65 74  is..# later, get
1280: 20 74 68 65 20 70 61 73 73 20 77 6f 72 6b 69 6e   the pass workin
1290: 67 20 66 69 72 73 74 2e 0a 09 23 0a 09 23 20 4e  g first...#..# N
12a0: 4f 54 45 20 32 3a 20 4d 69 67 68 74 20 77 65 20  OTE 2: Might we 
12b0: 65 76 65 6e 20 62 65 20 61 62 6c 65 20 74 6f 20  even be able to 
12c0: 73 65 6c 65 63 74 20 74 68 65 20 62 61 63 6b 77  select the backw
12d0: 61 72 64 20 62 72 61 6e 63 68 0a 09 23 20 63 68  ard branch..# ch
12e0: 61 6e 67 65 73 65 74 73 20 74 6f 6f 20 3f 0a 0a  angesets too ?..
12f0: 09 66 6f 72 65 61 63 68 20 63 73 65 74 20 5b 24  .foreach cset [$
1300: 67 72 61 70 68 20 6e 6f 64 65 73 5d 20 7b 0a 09  graph nodes] {..
1310: 20 20 20 20 69 66 20 7b 21 5b 24 63 73 65 74 20      if {![$cset 
1320: 69 73 62 72 61 6e 63 68 5d 7d 20 63 6f 6e 74 69  isbranch]} conti
1330: 6e 75 65 0a 09 20 20 20 20 43 68 65 63 6b 41 6e  nue..    CheckAn
1340: 64 42 72 65 61 6b 42 61 63 6b 77 61 72 64 42 72  dBreakBackwardBr
1350: 61 6e 63 68 20 24 67 72 61 70 68 20 24 63 73 65  anch $graph $cse
1360: 74 0a 09 7d 0a 09 72 65 74 75 72 6e 0a 20 20 20  t..}..return.   
1370: 20 7d 0a 0a 20 20 20 20 70 72 6f 63 20 43 68 65   }..    proc Che
1380: 63 6b 41 6e 64 42 72 65 61 6b 42 61 63 6b 77 61  ckAndBreakBackwa
1390: 72 64 42 72 61 6e 63 68 20 7b 67 72 61 70 68 20  rdBranch {graph 
13a0: 63 73 65 74 7d 20 7b 0a 09 77 68 69 6c 65 20 7b  cset} {..while {
13b0: 5b 49 73 41 42 61 63 6b 77 61 72 64 42 72 61 6e  [IsABackwardBran
13c0: 63 68 20 24 67 72 61 70 68 20 24 63 73 65 74 5d  ch $graph $cset]
13d0: 7d 20 7b 0a 09 20 20 20 20 6c 6f 67 20 77 72 69  } {..    log wri
13e0: 74 65 20 35 20 62 72 65 61 6b 61 63 79 63 6c 65  te 5 breakacycle
13f0: 20 22 42 72 65 61 6b 69 6e 67 20 62 61 63 6b 77   "Breaking backw
1400: 61 72 64 20 62 72 61 6e 63 68 20 63 68 61 6e 67  ard branch chang
1410: 65 73 65 74 20 5b 24 63 73 65 74 20 73 74 72 5d  eset [$cset str]
1420: 22 0a 0a 09 20 20 20 20 23 20 4b 6e 6f 77 69 6e  "...    # Knowin
1430: 67 20 74 68 61 74 20 74 68 65 20 62 72 61 6e 63  g that the branc
1440: 68 20 69 73 20 62 61 63 6b 77 61 72 64 20 77 65  h is backward we
1450: 20 6e 6f 77 20 6c 6f 6f 6b 20 61 74 20 74 68 65   now look at the
1460: 0a 09 20 20 20 20 23 20 69 6e 64 69 76 69 64 75  ..    # individu
1470: 61 6c 20 72 65 76 69 73 69 6f 6e 73 20 69 6e 20  al revisions in 
1480: 74 68 65 20 63 68 61 6e 67 65 73 65 74 20 61 6e  the changeset an
1490: 64 20 64 65 74 65 72 6d 69 6e 65 0a 09 20 20 20  d determine..   
14a0: 20 23 20 77 68 69 63 68 20 6f 66 20 74 68 65 6d   # which of them
14b0: 20 61 72 65 20 72 65 73 70 6f 6e 73 69 62 6c 65   are responsible
14c0: 20 66 6f 72 20 74 68 65 20 6f 76 65 72 6c 61 70   for the overlap
14d0: 2e 20 54 68 69 73 0a 09 20 20 20 20 23 20 61 6c  . This..    # al
14e0: 6c 6f 77 73 20 75 73 20 74 6f 20 73 70 6c 69 74  lows us to split
14f0: 20 74 68 65 6d 20 69 6e 74 6f 20 74 77 6f 20 73   them into two s
1500: 65 74 73 2c 20 6f 6e 65 20 6f 66 0a 09 20 20 20  ets, one of..   
1510: 20 23 20 6e 6f 6e 2d 6f 76 65 72 6c 61 70 70 69   # non-overlappi
1520: 6e 67 20 72 65 76 69 73 69 6f 6e 73 2c 20 61 6e  ng revisions, an
1530: 64 20 6f 66 20 6f 76 65 72 6c 61 70 70 69 6e 67  d of overlapping
1540: 20 6f 6e 65 73 2e 20 45 61 63 68 0a 09 20 20 20   ones. Each..   
1550: 20 23 20 69 6e 64 75 63 65 73 20 61 20 6e 65 77   # induces a new
1560: 20 63 68 61 6e 67 65 73 65 74 2c 20 61 6e 64 20   changeset, and 
1570: 74 68 65 20 73 65 63 6f 6e 64 20 6d 61 79 20 73  the second may s
1580: 74 69 6c 6c 20 62 65 0a 09 20 20 20 20 23 20 62  till be..    # b
1590: 61 63 6b 77 61 72 64 20 61 6e 64 20 6e 65 65 64  ackward and need
15a0: 20 66 75 72 74 68 65 72 20 73 70 6c 69 74 74 69   further splitti
15b0: 6e 67 2e 20 48 65 6e 63 65 20 74 68 65 20 6c 6f  ng. Hence the lo
15c0: 6f 70 69 6e 67 2e 0a 09 20 20 20 20 23 0a 09 20  oping...    #.. 
15d0: 20 20 20 23 20 54 68 65 20 62 6f 72 64 65 72 20     # The border 
15e0: 75 73 65 64 20 66 6f 72 20 74 68 65 20 73 70 6c  used for the spl
15f0: 69 74 20 69 73 20 74 68 65 20 6d 69 6e 69 6d 61  it is the minima
1600: 6c 20 63 6f 6d 6d 69 74 0a 09 20 20 20 20 23 20  l commit..    # 
1610: 70 6f 73 69 74 69 6f 6e 20 61 6d 6f 6e 67 20 74  position among t
1620: 68 65 20 6d 69 6e 69 6d 61 6c 20 73 75 63 65 73  he minimal suces
1630: 73 6f 72 20 63 6f 6d 6d 69 74 20 70 6f 73 69 74  sor commit posit
1640: 69 6f 6e 73 20 66 6f 72 0a 09 20 20 20 20 23 20  ions for..    # 
1650: 74 68 65 20 72 65 76 69 73 69 6f 6e 73 20 69 6e  the revisions in
1660: 20 74 68 65 20 63 68 61 6e 67 65 73 65 74 2e 0a   the changeset..
1670: 0a 09 20 20 20 20 23 20 4e 6f 74 65 20 74 68 61  ..    # Note tha
1680: 74 20 69 6e 64 69 76 69 64 75 61 6c 20 72 65 76  t individual rev
1690: 69 73 69 6f 6e 73 20 6d 61 79 20 6e 6f 74 20 68  isions may not h
16a0: 61 76 65 20 72 65 76 69 73 69 6f 6e 0a 09 20 20  ave revision..  
16b0: 20 20 23 20 63 68 61 6e 67 65 73 65 74 73 20 61    # changesets a
16c0: 72 65 20 70 72 65 64 65 63 65 73 73 6f 72 73 20  re predecessors 
16d0: 61 6e 64 2f 6f 72 20 73 75 63 63 65 73 73 6f 72  and/or successor
16e0: 73 2c 20 6c 65 61 76 69 6e 67 0a 09 20 20 20 20  s, leaving..    
16f0: 23 20 74 68 65 20 6c 69 6d 69 74 73 20 70 61 72  # the limits par
1700: 74 69 61 6c 6c 79 20 6f 72 20 63 6f 6d 70 6c 65  tially or comple
1710: 74 65 6c 79 20 75 6e 64 65 66 69 6e 65 64 2e 0a  tely undefined..
1720: 0a 09 20 20 20 20 23 20 6c 69 6d 69 74 73 20 3a  ..    # limits :
1730: 20 64 69 63 74 20 28 72 65 76 69 73 69 6f 6e 20   dict (revision 
1740: 2d 3e 20 6c 69 73 74 20 28 6d 61 78 20 70 72 65  -> list (max pre
1750: 64 65 63 65 73 73 6f 72 20 63 6f 6d 6d 69 74 2c  decessor commit,
1760: 20 6d 69 6e 20 73 75 63 65 73 73 6f 72 20 63 6f   min sucessor co
1770: 6d 6d 69 74 29 29 0a 0a 09 20 20 20 20 43 6f 6d  mmit))...    Com
1780: 70 75 74 65 4c 69 6d 69 74 73 20 24 63 73 65 74  puteLimits $cset
1790: 20 6c 69 6d 69 74 73 20 62 6f 72 64 65 72 0a 0a   limits border..
17a0: 09 20 20 20 20 6c 6f 67 20 77 72 69 74 65 20 36  .    log write 6
17b0: 20 62 72 65 61 6b 61 63 79 63 6c 65 20 22 55 73   breakacycle "Us
17c0: 69 6e 67 20 63 6f 6d 6d 69 74 20 70 6f 73 69 74  ing commit posit
17d0: 69 6f 6e 20 24 62 6f 72 64 65 72 20 61 73 20 62  ion $border as b
17e0: 6f 72 64 65 72 22 0a 0a 09 20 20 20 20 23 20 54  order"...    # T
17f0: 68 65 6e 20 77 65 20 73 6f 72 74 20 74 68 65 20  hen we sort the 
1800: 66 69 6c 65 20 6c 65 76 65 6c 20 69 74 65 6d 73  file level items
1810: 20 62 61 73 65 64 20 6f 6e 20 74 68 65 72 65 20   based on there 
1820: 74 68 65 79 0a 09 20 20 20 20 23 20 73 69 74 20  they..    # sit 
1830: 72 65 6c 61 74 69 76 65 20 74 6f 20 74 68 65 20  relative to the 
1840: 62 6f 72 64 65 72 20 69 6e 74 6f 20 62 65 66 6f  border into befo
1850: 72 65 20 61 6e 64 20 61 66 74 65 72 20 74 68 65  re and after the
1860: 0a 09 20 20 20 20 23 20 62 6f 72 64 65 72 2e 0a  ..    # border..
1870: 0a 09 20 20 20 20 53 70 6c 69 74 52 65 76 69 73  ..    SplitRevis
1880: 69 6f 6e 73 20 24 6c 69 6d 69 74 73 20 24 62 6f  ions $limits $bo
1890: 72 64 65 72 20 6e 6f 72 6d 61 6c 72 65 76 69 73  rder normalrevis
18a0: 69 6f 6e 73 20 62 61 63 6b 77 61 72 64 72 65 76  ions backwardrev
18b0: 69 73 69 6f 6e 73 0a 0a 09 20 20 20 20 73 65 74  isions...    set
18c0: 20 72 65 70 6c 61 63 65 6d 65 6e 74 73 20 5b 70   replacements [p
18d0: 72 6f 6a 65 63 74 3a 3a 72 65 76 20 73 70 6c 69  roject::rev spli
18e0: 74 20 24 63 73 65 74 20 24 6e 6f 72 6d 61 6c 72  t $cset $normalr
18f0: 65 76 69 73 69 6f 6e 73 20 24 62 61 63 6b 77 61  evisions $backwa
1900: 72 64 72 65 76 69 73 69 6f 6e 73 5d 0a 09 20 20  rdrevisions]..  
1910: 20 20 63 79 63 6c 65 62 72 65 61 6b 65 72 20 72    cyclebreaker r
1920: 65 70 6c 61 63 65 20 24 67 72 61 70 68 20 24 63  eplace $graph $c
1930: 73 65 74 20 24 72 65 70 6c 61 63 65 6d 65 6e 74  set $replacement
1940: 73 0a 0a 09 20 20 20 20 23 20 41 74 20 6c 61 73  s...    # At las
1950: 74 20 63 68 65 63 6b 20 74 68 61 74 20 74 68 65  t check that the
1960: 20 6e 6f 72 6d 61 6c 20 66 72 61 6d 65 6e 74 20   normal frament 
1970: 69 73 20 69 6e 64 65 65 64 20 6e 6f 74 0a 09 20  is indeed not.. 
1980: 20 20 20 23 20 62 61 63 6b 77 61 72 64 2c 20 61     # backward, a
1990: 6e 64 20 69 74 65 72 61 74 65 20 6f 76 65 72 20  nd iterate over 
19a0: 74 68 65 20 70 6f 73 73 69 62 6c 79 20 73 74 69  the possibly sti
19b0: 6c 6c 20 62 61 63 6b 77 61 72 64 0a 09 20 20 20  ll backward..   
19c0: 20 23 20 73 65 63 6f 6e 64 20 66 72 61 67 6d 65   # second fragme
19d0: 6e 74 2e 0a 0a 09 20 20 20 20 73 74 72 75 63 74  nt....    struct
19e0: 3a 3a 6c 69 73 74 20 61 73 73 69 67 6e 20 24 72  ::list assign $r
19f0: 65 70 6c 61 63 65 6d 65 6e 74 73 20 6e 6f 72 6d  eplacements norm
1a00: 61 6c 20 62 61 63 6b 77 61 72 64 0a 09 20 20 20  al backward..   
1a10: 20 69 66 20 7b 5b 49 73 41 42 61 63 6b 77 61 72   if {[IsABackwar
1a20: 64 42 72 61 6e 63 68 20 24 67 72 61 70 68 20 24  dBranch $graph $
1a30: 6e 6f 72 6d 61 6c 5d 7d 20 7b 20 74 72 6f 75 62  normal]} { troub
1a40: 6c 65 20 69 6e 74 65 72 6e 61 6c 20 22 54 68 65  le internal "The
1a50: 20 6e 6f 72 6d 61 6c 20 66 72 61 67 6d 65 6e 74   normal fragment
1a60: 20 69 73 20 75 6e 65 78 70 65 63 74 65 64 6c 79   is unexpectedly
1a70: 20 61 20 62 61 63 6b 77 61 72 64 20 62 72 61 6e   a backward bran
1a80: 63 68 22 20 7d 0a 0a 09 20 20 20 20 73 65 74 20  ch" }...    set 
1a90: 63 73 65 74 20 24 62 61 63 6b 77 61 72 64 0a 09  cset $backward..
1aa0: 7d 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a  }..return.    }.
1ab0: 0a 20 20 20 20 70 72 6f 63 20 49 73 41 42 61 63  .    proc IsABac
1ac0: 6b 77 61 72 64 42 72 61 6e 63 68 20 7b 64 67 20  kwardBranch {dg 
1ad0: 63 73 65 74 7d 20 7b 0a 09 23 20 41 20 62 72 61  cset} {..# A bra
1ae0: 6e 63 68 20 69 73 20 22 62 61 63 6b 77 61 72 64  nch is "backward
1af0: 22 20 69 66 20 69 74 20 68 61 73 20 61 74 20 6c  " if it has at l
1b00: 65 61 73 74 20 6f 6e 65 20 69 6e 63 6f 6d 69 6e  east one incomin
1b10: 67 0a 09 23 20 72 65 76 69 73 69 6f 6e 20 63 68  g..# revision ch
1b20: 61 6e 67 65 73 65 74 20 77 68 69 63 68 20 69 73  angeset which is
1b30: 20 63 6f 6d 6d 69 74 74 65 64 20 61 66 74 65 72   committed after
1b40: 20 61 74 20 6c 65 61 73 74 20 6f 6e 65 20 6f 66   at least one of
1b50: 0a 09 23 20 74 68 65 20 6f 75 74 67 6f 69 6e 67  ..# the outgoing
1b60: 20 72 65 76 69 73 69 6f 6e 20 63 68 61 6e 67 65   revision change
1b70: 73 65 74 73 2c 20 70 65 72 20 74 68 65 20 6f 72  sets, per the or
1b80: 64 65 72 20 63 6f 6d 70 75 74 65 64 20 69 6e 0a  der computed in.
1b90: 09 23 20 70 61 73 73 20 36 2e 0a 0a 09 23 20 52  .# pass 6....# R
1ba0: 65 70 68 72 61 73 65 64 2c 20 74 68 65 20 6d 61  ephrased, the ma
1bb0: 78 69 6d 61 6c 20 63 6f 6d 6d 69 74 20 70 6f 73  ximal commit pos
1bc0: 69 74 69 6f 6e 20 66 6f 75 6e 64 20 61 6d 6f 6e  ition found amon
1bd0: 67 20 74 68 65 0a 09 23 20 69 6e 63 6f 6d 69 6e  g the..# incomin
1be0: 67 20 72 65 76 69 73 69 6f 6e 20 63 68 61 6e 67  g revision chang
1bf0: 65 73 65 74 73 20 69 73 20 6c 61 72 67 65 72 20  esets is larger 
1c00: 74 68 61 6e 20 74 68 65 20 6d 69 6e 69 6d 61 6c  than the minimal
1c10: 0a 09 23 20 63 6f 6d 6d 69 74 20 70 6f 73 69 74  ..# commit posit
1c20: 69 6f 6e 20 66 6f 75 6e 64 20 61 6d 6f 6e 67 20  ion found among 
1c30: 74 68 65 20 6f 75 74 67 6f 69 6e 67 20 72 65 76  the outgoing rev
1c40: 69 73 69 6f 6e 0a 09 23 20 63 68 61 6e 67 65 73  ision..# changes
1c50: 65 74 73 2e 20 41 73 73 75 6d 69 6e 67 20 74 68  ets. Assuming th
1c60: 61 74 20 77 65 20 68 61 76 65 20 62 6f 74 68 20  at we have both 
1c70: 69 6e 63 6f 6d 69 6e 67 20 61 6e 64 20 6f 75 74  incoming and out
1c80: 67 6f 69 6e 67 0a 09 23 20 72 65 76 69 73 69 6f  going..# revisio
1c90: 6e 20 63 68 61 6e 67 65 73 65 74 73 2e 0a 0a 09  n changesets....
1ca0: 23 20 54 68 65 20 68 65 6c 70 65 72 20 22 50 6f  # The helper "Po
1cb0: 73 69 74 69 6f 6e 73 22 20 63 6f 6d 70 75 74 65  sitions" compute
1cc0: 73 20 74 68 65 20 73 65 74 20 6f 66 20 63 6f 6d  s the set of com
1cd0: 6d 69 74 20 70 6f 73 69 74 69 6f 6e 73 0a 09 23  mit positions..#
1ce0: 20 66 6f 72 20 61 20 73 65 74 20 6f 66 20 63 68   for a set of ch
1cf0: 61 6e 67 65 73 65 74 73 2c 20 77 68 69 63 68 20  angesets, which 
1d00: 63 61 6e 20 62 65 20 61 20 6d 69 78 20 6f 66 20  can be a mix of 
1d10: 72 65 76 69 73 69 6f 6e 20 61 6e 64 0a 09 23 20  revision and..# 
1d20: 73 79 6d 62 6f 6c 20 63 68 61 6e 67 65 73 65 74  symbol changeset
1d30: 73 2e 0a 0a 09 73 65 74 20 70 72 65 64 65 63 65  s....set predece
1d40: 73 73 6f 72 73 20 5b 50 6f 73 69 74 69 6f 6e 73  ssors [Positions
1d50: 20 5b 24 64 67 20 6e 6f 64 65 73 20 2d 69 6e 20   [$dg nodes -in 
1d60: 20 24 63 73 65 74 5d 5d 0a 09 73 65 74 20 73 75   $cset]]..set su
1d70: 63 63 65 73 73 6f 72 73 20 20 20 5b 50 6f 73 69  ccessors   [Posi
1d80: 74 69 6f 6e 73 20 5b 24 64 67 20 6e 6f 64 65 73  tions [$dg nodes
1d90: 20 2d 6f 75 74 20 24 63 73 65 74 5d 5d 0a 0a 09   -out $cset]]...
1da0: 72 65 74 75 72 6e 20 5b 65 78 70 72 20 7b 0a 09  return [expr {..
1db0: 09 20 20 20 20 20 20 5b 6c 6c 65 6e 67 74 68 20  .      [llength 
1dc0: 24 70 72 65 64 65 63 65 73 73 6f 72 73 5d 20 26  $predecessors] &
1dd0: 26 0a 09 09 20 20 20 20 20 20 5b 6c 6c 65 6e 67  &...      [lleng
1de0: 74 68 20 24 73 75 63 63 65 73 73 6f 72 73 5d 20  th $successors] 
1df0: 20 20 26 26 0a 09 09 20 20 20 20 20 20 28 5b 6d    &&...      ([m
1e00: 61 78 20 24 70 72 65 64 65 63 65 73 73 6f 72 73  ax $predecessors
1e10: 5d 20 3e 3d 20 5b 6d 69 6e 20 24 73 75 63 63 65  ] >= [min $succe
1e20: 73 73 6f 72 73 5d 29 0a 09 09 20 20 7d 5d 0a 20  ssors])...  }]. 
1e30: 20 20 20 7d 0a 0a 20 20 20 20 70 72 6f 63 20 50     }..    proc P
1e40: 6f 73 69 74 69 6f 6e 73 20 7b 63 68 61 6e 67 65  ositions {change
1e50: 73 65 74 73 7d 20 7b 0a 09 23 20 54 6f 20 63 6f  sets} {..# To co
1e60: 6d 70 75 74 65 20 74 68 65 20 73 65 74 20 6f 66  mpute the set of
1e70: 20 63 6f 6d 6d 69 74 20 70 6f 73 69 74 69 6f 6e   commit position
1e80: 73 20 66 72 6f 6d 20 74 68 65 20 73 65 74 20 6f  s from the set o
1e90: 66 0a 09 23 20 63 68 61 6e 67 65 73 65 74 73 20  f..# changesets 
1ea0: 77 65 20 66 69 72 73 74 20 6d 61 70 20 65 61 63  we first map eac
1eb0: 68 20 63 68 61 6e 67 65 73 65 74 20 74 6f 20 69  h changeset to i
1ec0: 74 73 20 70 6f 73 69 74 69 6f 6e 20 28 2a 29 0a  ts position (*).
1ed0: 09 23 20 61 6e 64 20 74 68 65 6e 20 66 69 6c 74  .# and then filt
1ee0: 65 72 20 6f 75 74 20 74 68 65 20 69 6e 76 61 6c  er out the inval
1ef0: 69 64 20 72 65 73 70 6f 6e 73 65 73 20 28 74 68  id responses (th
1f00: 65 20 65 6d 70 74 79 20 73 74 72 69 6e 67 29 0a  e empty string).
1f10: 09 23 20 72 65 74 75 72 6e 65 64 20 62 79 20 74  .# returned by t
1f20: 68 65 20 73 79 6d 62 6f 6c 20 63 68 61 6e 67 65  he symbol change
1f30: 73 65 74 73 2e 0a 09 23 0a 09 23 20 28 2a 29 20  sets...#..# (*) 
1f40: 54 68 69 73 20 64 61 74 61 20 77 61 73 20 6c 6f  This data was lo
1f50: 61 64 65 64 20 69 6e 74 6f 20 6d 65 6d 6f 72 79  aded into memory
1f60: 20 65 61 72 6c 69 72 20 69 6e 20 74 68 65 20 70   earlir in the p
1f70: 61 73 73 2c 20 62 79 0a 09 23 20 20 20 20 20 4c  ass, by..#     L
1f80: 6f 61 64 43 6f 6d 6d 69 74 4f 72 64 65 72 2e 0a  oadCommitOrder..
1f90: 0a 09 72 65 74 75 72 6e 20 5b 73 74 72 75 63 74  ..return [struct
1fa0: 3a 3a 6c 69 73 74 20 66 69 6c 74 65 72 20 5b 73  ::list filter [s
1fb0: 74 72 75 63 74 3a 3a 6c 69 73 74 20 6d 61 70 20  truct::list map 
1fc0: 24 63 68 61 6e 67 65 73 65 74 73 20 5c 0a 09 09  $changesets \...
1fd0: 09 09 09 20 5b 6d 79 70 72 6f 63 20 54 6f 50 6f  ... [myproc ToPo
1fe0: 73 69 74 69 6f 6e 5d 5d 20 5c 0a 09 09 20 20 20  sition]] \...   
1ff0: 20 5b 6d 79 70 72 6f 63 20 56 61 6c 69 64 50 6f   [myproc ValidPo
2000: 73 69 74 69 6f 6e 5d 5d 0a 20 20 20 20 7d 0a 0a  sition]].    }..
2010: 20 20 20 20 70 72 6f 63 20 54 6f 50 6f 73 69 74      proc ToPosit
2020: 69 6f 6e 20 20 20 20 7b 63 73 65 74 7d 20 7b 20  ion    {cset} { 
2030: 24 63 73 65 74 20 70 6f 73 20 7d 0a 20 20 20 20  $cset pos }.    
2040: 70 72 6f 63 20 56 61 6c 69 64 50 6f 73 69 74 69  proc ValidPositi
2050: 6f 6e 20 7b 70 6f 73 7d 20 20 7b 20 65 78 70 72  on {pos}  { expr
2060: 20 7b 24 70 6f 73 20 6e 65 20 22 22 7d 20 7d 0a   {$pos ne ""} }.
2070: 0a 20 20 20 20 70 72 6f 63 20 43 6f 6d 70 75 74  .    proc Comput
2080: 65 4c 69 6d 69 74 73 20 7b 63 73 65 74 20 6c 76  eLimits {cset lv
2090: 20 62 76 7d 20 7b 0a 09 75 70 76 61 72 20 31 20   bv} {..upvar 1 
20a0: 24 6c 76 20 74 68 65 6c 69 6d 69 74 73 20 24 62  $lv thelimits $b
20b0: 76 20 62 6f 72 64 65 72 0a 0a 09 23 20 49 6e 69  v border...# Ini
20c0: 74 69 61 6c 69 7a 65 20 74 68 65 20 62 6f 75 6e  tialize the boun
20d0: 64 61 72 69 65 73 20 66 6f 72 20 61 6c 6c 20 72  daries for all r
20e0: 65 76 69 73 69 6f 6e 73 2e 0a 0a 09 61 72 72 61  evisions....arra
20f0: 79 20 73 65 74 20 6c 69 6d 69 74 73 20 7b 7d 0a  y set limits {}.
2100: 09 66 6f 72 65 61 63 68 20 72 65 76 69 73 69 6f  .foreach revisio
2110: 6e 20 5b 24 63 73 65 74 20 72 65 76 69 73 69 6f  n [$cset revisio
2120: 6e 73 5d 20 7b 0a 09 20 20 20 20 73 65 74 20 6c  ns] {..    set l
2130: 69 6d 69 74 73 28 24 72 65 76 69 73 69 6f 6e 29  imits($revision)
2140: 20 7b 30 20 7b 7d 7d 0a 09 7d 0a 0a 09 23 20 43   {0 {}}..}...# C
2150: 6f 6d 70 75 74 65 20 61 6e 64 20 73 74 6f 72 65  ompute and store
2160: 20 74 68 65 20 6d 61 78 69 6d 61 6c 20 70 72 65   the maximal pre
2170: 64 65 63 65 73 73 6f 72 73 20 70 65 72 20 72 65  decessors per re
2180: 76 69 73 69 6f 6e 0a 0a 09 66 6f 72 65 61 63 68  vision...foreach
2190: 20 7b 72 65 76 69 73 69 6f 6e 20 63 73 65 74 73   {revision csets
21a0: 7d 20 5b 24 63 73 65 74 20 70 72 65 64 65 63 65  } [$cset predece
21b0: 73 73 6f 72 6d 61 70 5d 20 7b 0a 09 20 20 20 20  ssormap] {..    
21c0: 73 65 74 20 73 20 5b 50 6f 73 69 74 69 6f 6e 73  set s [Positions
21d0: 20 24 63 73 65 74 73 5d 0a 09 20 20 20 20 69 66   $csets]..    if
21e0: 20 7b 21 5b 6c 6c 65 6e 67 74 68 20 24 73 5d 7d   {![llength $s]}
21f0: 20 63 6f 6e 74 69 6e 75 65 0a 09 20 20 20 20 73   continue..    s
2200: 65 74 20 6c 69 6d 69 74 73 28 24 72 65 76 69 73  et limits($revis
2210: 69 6f 6e 29 20 5b 6c 72 65 70 6c 61 63 65 20 24  ion) [lreplace $
2220: 6c 69 6d 69 74 73 28 24 72 65 76 69 73 69 6f 6e  limits($revision
2230: 29 20 30 20 30 20 5b 6d 61 78 20 24 73 5d 5d 0a  ) 0 0 [max $s]].
2240: 09 7d 0a 0a 09 23 20 43 6f 6d 70 75 74 65 20 61  .}...# Compute a
2250: 6e 64 20 73 74 6f 72 65 20 74 68 65 20 6d 69 6e  nd store the min
2260: 69 6d 61 6c 20 73 75 63 63 65 73 73 6f 72 73 20  imal successors 
2270: 70 65 72 20 72 65 76 69 73 69 6f 6e 0a 0a 09 66  per revision...f
2280: 6f 72 65 61 63 68 20 7b 72 65 76 69 73 69 6f 6e  oreach {revision
2290: 20 63 73 65 74 73 7d 20 5b 24 63 73 65 74 20 73   csets} [$cset s
22a0: 75 63 63 65 73 73 6f 72 6d 61 70 5d 20 7b 0a 09  uccessormap] {..
22b0: 20 20 20 20 73 65 74 20 73 20 5b 50 6f 73 69 74      set s [Posit
22c0: 69 6f 6e 73 20 24 63 73 65 74 73 5d 0a 09 20 20  ions $csets]..  
22d0: 20 20 69 66 20 7b 21 5b 6c 6c 65 6e 67 74 68 20    if {![llength 
22e0: 24 73 5d 7d 20 63 6f 6e 74 69 6e 75 65 0a 09 20  $s]} continue.. 
22f0: 20 20 20 73 65 74 20 6c 69 6d 69 74 73 28 24 72     set limits($r
2300: 65 76 69 73 69 6f 6e 29 20 5b 6c 72 65 70 6c 61  evision) [lrepla
2310: 63 65 20 24 6c 69 6d 69 74 73 28 24 72 65 76 69  ce $limits($revi
2320: 73 69 6f 6e 29 20 31 20 31 20 5b 6d 69 6e 20 24  sion) 1 1 [min $
2330: 73 5d 5d 0a 09 7d 0a 0a 09 23 20 43 68 65 63 6b  s]]..}...# Check
2340: 20 74 68 61 74 20 74 68 65 20 6f 72 64 65 72 69   that the orderi
2350: 6e 67 20 61 74 20 74 68 65 20 66 69 6c 65 20 6c  ng at the file l
2360: 65 76 65 6c 20 69 73 20 63 6f 72 72 65 63 74 2e  evel is correct.
2370: 20 57 65 0a 09 23 20 63 61 6e 6e 6f 74 20 68 61   We..# cannot ha
2380: 76 65 20 62 61 63 6b 77 61 72 64 20 6f 72 64 65  ve backward orde
2390: 72 69 6e 67 20 70 65 72 20 72 65 76 69 73 69 6f  ring per revisio
23a0: 6e 2c 20 6f 72 20 73 6f 6d 65 74 68 69 6e 67 20  n, or something 
23b0: 69 73 0a 09 23 20 77 72 6f 6e 67 2e 0a 0a 09 66  is..# wrong....f
23c0: 6f 72 65 61 63 68 20 72 65 76 69 73 69 6f 6e 20  oreach revision 
23d0: 5b 61 72 72 61 79 20 6e 61 6d 65 73 20 6c 69 6d  [array names lim
23e0: 69 74 73 5d 20 7b 0a 09 20 20 20 20 73 74 72 75  its] {..    stru
23f0: 63 74 3a 3a 6c 69 73 74 20 61 73 73 69 67 6e 20  ct::list assign 
2400: 24 6c 69 6d 69 74 73 28 24 72 65 76 69 73 69 6f  $limits($revisio
2410: 6e 29 20 6d 61 78 70 20 6d 69 6e 73 0a 09 20 20  n) maxp mins..  
2420: 20 20 23 20 48 61 6e 64 6c 65 20 6d 69 6e 20 73    # Handle min s
2430: 75 63 63 65 73 73 6f 72 20 70 6f 73 69 74 69 6f  uccessor positio
2440: 6e 20 22 22 20 61 73 20 72 65 70 72 65 73 65 6e  n "" as represen
2450: 74 69 6e 67 20 69 6e 66 69 6e 69 74 79 0a 09 20  ting infinity.. 
2460: 20 20 20 69 66 20 7b 24 6d 69 6e 73 20 65 71 20     if {$mins eq 
2470: 22 22 7d 20 63 6f 6e 74 69 6e 75 65 0a 09 20 20  ""} continue..  
2480: 20 20 69 66 20 7b 24 6d 61 78 70 20 3c 20 24 6d    if {$maxp < $m
2490: 69 6e 73 7d 20 63 6f 6e 74 69 6e 75 65 0a 0a 09  ins} continue...
24a0: 20 20 20 20 74 72 6f 75 62 6c 65 20 69 6e 74 65      trouble inte
24b0: 72 6e 61 6c 20 22 42 72 61 6e 63 68 20 72 65 76  rnal "Branch rev
24c0: 69 73 69 6f 6e 20 24 72 65 76 69 73 69 6f 6e 20  ision $revision 
24d0: 69 73 20 62 61 63 6b 77 61 72 64 20 61 74 20 66  is backward at f
24e0: 69 6c 65 20 6c 65 76 65 6c 20 28 24 6d 61 78 70  ile level ($maxp
24f0: 20 3e 3d 20 24 6d 69 6e 73 29 22 0a 09 7d 0a 0a   >= $mins)"..}..
2500: 09 23 20 53 61 76 65 20 74 68 65 20 6c 69 6d 69  .# Save the limi
2510: 74 73 20 66 6f 72 20 74 68 65 20 73 70 6c 69 74  ts for the split
2520: 74 65 72 2c 20 61 6e 64 20 63 6f 6d 70 75 74 65  ter, and compute
2530: 20 74 68 65 20 62 6f 72 64 65 72 20 61 74 0a 09   the border at..
2540: 23 20 77 68 69 63 68 20 74 6f 20 73 70 6c 69 74  # which to split
2550: 20 61 73 20 74 68 65 20 6d 69 6e 69 6d 75 6d 20   as the minimum 
2560: 6f 66 20 61 6c 6c 20 6d 69 6e 69 6d 61 6c 20 73  of all minimal s
2570: 75 63 63 65 73 73 6f 72 0a 09 23 20 70 6f 73 69  uccessor..# posi
2580: 74 69 6f 6e 73 2e 0a 0a 09 73 65 74 20 74 68 65  tions....set the
2590: 6c 69 6d 69 74 73 20 5b 61 72 72 61 79 20 67 65  limits [array ge
25a0: 74 20 6c 69 6d 69 74 73 5d 0a 09 73 65 74 20 62  t limits]..set b
25b0: 6f 72 64 65 72 20 5b 6d 69 6e 20 5b 73 74 72 75  order [min [stru
25c0: 63 74 3a 3a 6c 69 73 74 20 66 69 6c 74 65 72 20  ct::list filter 
25d0: 5b 73 74 72 75 63 74 3a 3a 6c 69 73 74 20 6d 61  [struct::list ma
25e0: 70 20 5b 56 61 6c 75 65 73 20 24 74 68 65 6c 69  p [Values $theli
25f0: 6d 69 74 73 5d 20 5c 0a 09 09 09 09 09 09 20 20  mits] \.......  
2600: 5b 6d 79 70 72 6f 63 20 4d 69 6e 53 75 63 63 65  [myproc MinSucce
2610: 73 73 6f 72 50 6f 73 69 74 69 6f 6e 5d 5d 20 5c  ssorPosition]] \
2620: 0a 09 09 09 20 20 20 20 20 5b 6d 79 70 72 6f 63  ....     [myproc
2630: 20 56 61 6c 69 64 50 6f 73 69 74 69 6f 6e 5d 5d   ValidPosition]]
2640: 5d 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a  ]..return.    }.
2650: 0a 20 20 20 20 70 72 6f 63 20 56 61 6c 75 65 73  .    proc Values
2660: 20 7b 64 69 63 74 7d 20 7b 0a 09 73 65 74 20 72   {dict} {..set r
2670: 65 73 20 7b 7d 0a 09 66 6f 72 65 61 63 68 20 7b  es {}..foreach {
2680: 6b 20 76 7d 20 24 64 69 63 74 20 7b 20 6c 61 70  k v} $dict { lap
2690: 70 65 6e 64 20 72 65 73 20 24 76 20 7d 0a 09 72  pend res $v }..r
26a0: 65 74 75 72 6e 20 24 72 65 73 0a 20 20 20 20 7d  eturn $res.    }
26b0: 0a 0a 20 20 20 20 70 72 6f 63 20 4d 69 6e 53 75  ..    proc MinSu
26c0: 63 63 65 73 73 6f 72 50 6f 73 69 74 69 6f 6e 20  ccessorPosition 
26d0: 7b 69 74 65 6d 7d 20 7b 20 6c 69 6e 64 65 78 20  {item} { lindex 
26e0: 24 69 74 65 6d 20 31 20 7d 0a 0a 20 20 20 20 70  $item 1 }..    p
26f0: 72 6f 63 20 53 70 6c 69 74 52 65 76 69 73 69 6f  roc SplitRevisio
2700: 6e 73 20 7b 6c 69 6d 69 74 73 20 62 6f 72 64 65  ns {limits borde
2710: 72 20 6e 76 20 62 76 7d 20 7b 0a 09 75 70 76 61  r nv bv} {..upva
2720: 72 20 31 20 24 6e 76 20 6e 6f 72 6d 61 6c 72 65  r 1 $nv normalre
2730: 76 69 73 69 6f 6e 73 20 24 62 76 20 62 61 63 6b  visions $bv back
2740: 77 61 72 64 72 65 76 69 73 69 6f 6e 73 0a 0a 09  wardrevisions...
2750: 73 65 74 20 6e 6f 72 6d 61 6c 72 65 76 69 73 69  set normalrevisi
2760: 6f 6e 73 20 20 20 7b 7d 0a 09 73 65 74 20 62 61  ons   {}..set ba
2770: 63 6b 77 61 72 64 72 65 76 69 73 69 6f 6e 73 20  ckwardrevisions 
2780: 7b 7d 0a 0a 09 66 6f 72 65 61 63 68 20 7b 72 65  {}...foreach {re
2790: 76 20 76 7d 20 24 6c 69 6d 69 74 73 20 7b 0a 09  v v} $limits {..
27a0: 20 20 20 20 73 74 72 75 63 74 3a 3a 6c 69 73 74      struct::list
27b0: 20 61 73 73 69 67 6e 20 24 76 20 6d 61 78 70 20   assign $v maxp 
27c0: 6d 69 6e 73 0a 09 20 20 20 20 69 66 20 7b 24 6d  mins..    if {$m
27d0: 61 78 70 20 3e 3d 20 24 62 6f 72 64 65 72 7d 20  axp >= $border} 
27e0: 7b 0a 09 09 6c 61 70 70 65 6e 64 20 62 61 63 6b  {...lappend back
27f0: 77 61 72 64 72 65 76 69 73 69 6f 6e 73 20 20 24  wardrevisions  $
2800: 72 65 76 0a 09 20 20 20 20 7d 20 65 6c 73 65 20  rev..    } else 
2810: 7b 0a 09 09 6c 61 70 70 65 6e 64 20 6e 6f 72 6d  {...lappend norm
2820: 61 6c 72 65 76 69 73 69 6f 6e 73 20 24 72 65 76  alrevisions $rev
2830: 0a 09 20 20 20 20 7d 0a 09 7d 0a 0a 09 69 66 20  ..    }..}...if 
2840: 7b 21 5b 6c 6c 65 6e 67 74 68 20 24 6e 6f 72 6d  {![llength $norm
2850: 61 6c 72 65 76 69 73 69 6f 6e 73 5d 7d 20 20 20  alrevisions]}   
2860: 7b 20 74 72 6f 75 62 6c 65 20 69 6e 74 65 72 6e  { trouble intern
2870: 61 6c 20 22 53 65 74 20 6f 66 20 6e 6f 72 6d 61  al "Set of norma
2880: 6c 20 72 65 76 69 73 69 6f 6e 73 20 69 73 20 65  l revisions is e
2890: 6d 70 74 79 22 20 7d 0a 09 69 66 20 7b 21 5b 6c  mpty" }..if {![l
28a0: 6c 65 6e 67 74 68 20 24 62 61 63 6b 77 61 72 64  length $backward
28b0: 72 65 76 69 73 69 6f 6e 73 5d 7d 20 7b 20 74 72  revisions]} { tr
28c0: 6f 75 62 6c 65 20 69 6e 74 65 72 6e 61 6c 20 22  ouble internal "
28d0: 53 65 74 20 6f 66 20 62 61 63 6b 77 61 72 64 20  Set of backward 
28e0: 72 65 76 69 73 69 6f 6e 73 20 69 73 20 65 6d 70  revisions is emp
28f0: 74 79 22 20 7d 0a 09 72 65 74 75 72 6e 0a 20 20  ty" }..return.  
2900: 20 20 7d 0a 0a 0a 20 20 20 20 23 20 23 20 23 23    }...    # # ##
2910: 20 23 23 23 20 23 23 23 23 23 20 23 23 23 23 23   ### ##### #####
2920: 23 23 23 20 23 23 23 23 23 23 23 23 23 23 23 23  ### ############
2930: 23 0a 0a 20 20 20 20 70 72 6f 63 20 4b 65 65 70  #..    proc Keep
2940: 4f 72 64 65 72 20 7b 67 72 61 70 68 20 61 74 20  Order {graph at 
2950: 63 73 65 74 7d 20 7b 0a 09 73 65 74 20 63 69 64  cset} {..set cid
2960: 20 5b 24 63 73 65 74 20 69 64 5d 0a 0a 09 6c 6f   [$cset id]...lo
2970: 67 20 77 72 69 74 65 20 34 20 62 72 65 61 6b 61  g write 4 breaka
2980: 63 79 63 6c 65 20 22 43 68 61 6e 67 65 73 65 74  cycle "Changeset
2990: 20 40 20 5b 66 6f 72 6d 61 74 20 24 6d 79 61 74   @ [format $myat
29a0: 66 6d 74 20 24 61 74 5d 3a 20 5b 66 6f 72 6d 61  fmt $at]: [forma
29b0: 74 20 24 6d 79 63 73 66 6d 74 20 5b 24 63 73 65  t $mycsfmt [$cse
29c0: 74 20 73 74 72 5d 5d 20 3c 3c 5b 46 6f 72 6d 61  t str]] <<[Forma
29d0: 74 54 52 20 24 67 72 61 70 68 20 24 63 73 65 74  tTR $graph $cset
29e0: 5d 3e 3e 22 0a 0a 09 23 20 57 65 20 73 65 65 20  ]>>"...# We see 
29f0: 68 65 72 65 20 61 20 6d 69 78 74 75 72 65 20 6f  here a mixture o
2a00: 66 20 73 79 6d 62 6f 6c 20 61 6e 64 20 72 65 76  f symbol and rev
2a10: 69 73 69 6f 6e 20 63 68 61 6e 67 65 73 65 74 73  ision changesets
2a20: 2e 0a 09 23 20 54 68 65 20 73 79 6d 62 6f 6c 20  ...# The symbol 
2a30: 63 68 61 6e 67 65 73 65 74 73 20 61 72 65 20 69  changesets are i
2a40: 67 6e 6f 72 65 64 20 61 73 20 69 72 72 65 6c 65  gnored as irrele
2a50: 76 61 6e 74 2e 0a 0a 09 69 66 20 7b 5b 24 63 73  vant....if {[$cs
2a60: 65 74 20 70 6f 73 5d 20 65 71 20 22 22 7d 20 72  et pos] eq ""} r
2a70: 65 74 75 72 6e 0a 0a 09 23 20 46 6f 72 20 74 68  eturn...# For th
2a80: 65 20 72 65 76 69 73 69 6f 6e 20 63 68 61 6e 67  e revision chang
2a90: 65 73 65 74 73 20 77 65 20 61 72 65 20 73 75 72  esets we are sur
2aa0: 65 20 74 68 61 74 20 74 68 65 79 20 61 72 65 0a  e that they are.
2ab0: 09 23 20 63 6f 6e 73 75 6d 65 64 20 69 6e 20 74  .# consumed in t
2ac0: 68 65 20 73 61 6d 65 20 6f 72 64 65 72 20 61 73  he same order as
2ad0: 20 67 65 6e 65 72 61 74 65 64 20 62 79 20 70 61   generated by pa
2ae0: 73 73 20 37 0a 09 23 20 28 52 65 76 54 6f 70 6f  ss 7..# (RevTopo
2af0: 6c 6f 67 69 63 61 6c 53 6f 72 74 29 2e 20 50 65  logicalSort). Pe
2b00: 72 20 74 68 65 20 63 6f 64 65 20 69 6e 20 63 76  r the code in cv
2b10: 73 32 73 76 6e 2e 0a 0a 09 23 20 4e 4f 54 45 3a  s2svn....# NOTE:
2b20: 20 49 20 63 61 6e 6e 6f 74 20 73 65 65 20 74 68   I cannot see th
2b30: 61 74 2e 20 41 73 73 75 6d 65 20 63 73 20 41 20  at. Assume cs A 
2b40: 61 6e 64 20 63 73 20 42 2c 20 6e 6f 74 20 64 65  and cs B, not de
2b50: 70 65 6e 64 65 6e 74 0a 09 23 20 20 20 20 20 20  pendent..#      
2b60: 20 6f 6e 20 65 61 63 68 20 6f 74 68 65 72 20 69   on each other i
2b70: 6e 20 74 68 65 20 73 65 74 20 6f 66 20 72 65 76  n the set of rev
2b80: 69 73 69 6f 6e 73 2c 20 6e 6f 77 20 42 20 61 66  isions, now B af
2b90: 74 65 72 20 41 0a 09 23 20 20 20 20 20 20 20 73  ter A..#       s
2ba0: 69 6d 70 6c 79 20 6d 65 61 6e 73 20 74 68 61 74  imply means that
2bb0: 20 42 20 68 61 73 20 61 20 6c 61 74 65 72 20 74   B has a later t
2bc0: 69 6d 65 20 6f 72 20 64 65 70 65 6e 64 73 20 6f  ime or depends o
2bd0: 6e 0a 09 23 20 20 20 20 20 20 20 73 6f 6d 65 74  n..#       somet
2be0: 68 69 6e 67 20 77 69 74 20 61 20 6c 61 74 65 72  hing wit a later
2bf0: 20 74 69 6d 65 20 74 68 61 6e 20 41 2e 20 49 6e   time than A. In
2c00: 20 74 68 65 20 66 75 6c 6c 20 67 72 61 70 68 20   the full graph 
2c10: 41 0a 09 23 20 20 20 20 20 20 20 6d 61 79 20 6e  A..#       may n
2c20: 6f 77 20 68 61 76 65 20 64 65 70 65 6e 64 65 6e  ow have dependen
2c30: 63 69 65 73 20 77 68 69 63 68 20 73 68 69 66 74  cies which shift
2c40: 20 69 74 20 61 66 74 65 72 20 42 2c 0a 09 23 20   it after B,..# 
2c50: 20 20 20 20 20 20 76 69 6f 6c 61 74 69 6e 67 20        violating 
2c60: 74 68 65 20 61 62 6f 76 65 20 61 73 73 75 6d 70  the above assump
2c70: 74 69 6f 6e 2e 0a 09 23 0a 09 23 20 57 65 6c 6c  tion...#..# Well
2c80: 2c 20 69 74 20 73 65 65 6d 73 20 74 6f 20 77 6f  , it seems to wo
2c90: 72 6b 20 69 66 20 49 20 64 6f 20 6e 6f 74 20 6d  rk if I do not m
2ca0: 61 6b 65 20 74 68 65 20 4e 54 44 42 20 72 6f 6f  ake the NTDB roo
2cb0: 74 20 61 0a 09 23 20 73 75 63 63 65 73 73 6f 72  t a..# successor
2cc0: 20 6f 66 20 74 68 65 20 72 65 67 75 6c 61 72 20   of the regular 
2cd0: 72 6f 6f 74 2e 20 44 6f 69 6e 67 20 73 6f 20 73  root. Doing so s
2ce0: 65 65 6d 73 20 74 6f 20 74 61 6e 67 6c 65 20 74  eems to tangle t
2cf0: 68 65 0a 09 23 20 63 68 61 6e 67 65 73 65 74 73  he..# changesets
2d00: 20 69 6e 74 6f 20 61 20 6b 6e 6f 74 73 20 72 65   into a knots re
2d10: 67 61 72 64 69 6e 67 20 74 69 6d 65 20 76 73 20  garding time vs 
2d20: 64 65 70 65 6e 64 65 6e 63 69 65 73 20 61 6e 64  dependencies and
2d30: 0a 09 23 20 74 72 69 67 67 65 72 20 73 75 63 68  ..# trigger such
2d40: 20 73 68 69 66 74 73 2e 20 4b 65 65 70 69 6e 67   shifts. Keeping
2d50: 20 74 68 65 73 65 20 74 77 6f 20 72 6f 6f 74 73   these two roots
2d60: 20 73 65 70 61 72 61 74 65 20 4f 54 4f 48 0a 09   separate OTOH..
2d70: 23 20 64 69 73 61 70 70 65 61 72 73 20 74 68 65  # disappears the
2d80: 20 74 61 6e 67 6c 65 2e 20 53 6f 2c 20 66 6f 72   tangle. So, for
2d90: 20 6e 6f 77 20 49 20 61 63 63 65 70 74 20 74 68   now I accept th
2da0: 61 74 2c 20 61 6e 64 20 66 6f 72 0a 09 23 20 70  at, and for..# p
2db0: 61 72 61 6e 6f 69 61 20 49 20 61 64 64 20 63 6f  aranoia I add co
2dc0: 64 65 20 77 68 69 63 68 20 63 68 65 63 6b 73 20  de which checks 
2dd0: 74 68 69 73 20 61 73 73 75 6d 70 74 69 6f 6e 2e  this assumption.
2de0: 0a 0a 09 73 74 72 75 63 74 3a 3a 73 65 74 20 65  ...struct::set e
2df0: 78 63 6c 75 64 65 20 6d 79 72 65 76 69 73 69 6f  xclude myrevisio
2e00: 6e 63 68 61 6e 67 65 73 65 74 73 20 24 63 73 65  nchangesets $cse
2e10: 74 0a 0a 09 3a 3a 76 61 72 69 61 62 6c 65 20 6d  t...::variable m
2e20: 79 6c 61 73 74 70 6f 73 0a 09 73 65 74 20 6e 65  ylastpos..set ne
2e30: 77 20 5b 24 63 73 65 74 20 70 6f 73 5d 0a 0a 09  w [$cset pos]...
2e40: 69 66 20 7b 24 6e 65 77 20 21 3d 20 28 24 6d 79  if {$new != ($my
2e50: 6c 61 73 74 70 6f 73 20 2b 20 31 29 7d 20 7b 0a  lastpos + 1)} {.
2e60: 09 20 20 20 20 69 66 20 7b 24 6d 79 6c 61 73 74  .    if {$mylast
2e70: 70 6f 73 20 3c 20 30 7d 20 7b 0a 09 09 73 65 74  pos < 0} {...set
2e80: 20 6f 6c 64 20 22 3c 4e 4f 4e 45 3e 22 0a 09 20   old "<NONE>".. 
2e90: 20 20 20 7d 20 65 6c 73 65 20 7b 0a 09 09 3a 3a     } else {...::
2ea0: 76 61 72 69 61 62 6c 65 20 6d 79 63 73 65 74 0a  variable mycset.
2eb0: 09 09 73 65 74 20 6f 6c 64 20 5b 24 6d 79 63 73  ..set old [$mycs
2ec0: 65 74 28 24 6d 79 6c 61 73 74 70 6f 73 29 20 73  et($mylastpos) s
2ed0: 74 72 5d 40 24 6d 79 6c 61 73 74 70 6f 73 0a 09  tr]@$mylastpos..
2ee0: 20 20 20 20 7d 0a 0a 09 20 20 20 20 74 72 6f 75      }...    trou
2ef0: 62 6c 65 20 69 6e 74 65 72 6e 61 6c 20 22 4f 72  ble internal "Or
2f00: 64 65 72 69 6e 67 20 6f 66 20 72 65 76 69 73 69  dering of revisi
2f10: 6f 6e 20 63 68 61 6e 67 65 73 65 74 73 20 76 69  on changesets vi
2f20: 6f 6c 61 74 65 64 2c 20 5b 24 63 73 65 74 20 73  olated, [$cset s
2f30: 74 72 5d 40 24 6e 65 77 20 69 73 20 6e 6f 74 20  tr]@$new is not 
2f40: 69 6d 6d 65 64 69 61 74 65 6c 79 20 61 66 74 65  immediately afte
2f50: 72 20 24 6f 6c 64 22 0a 09 7d 0a 0a 09 73 65 74  r $old"..}...set
2f60: 20 6d 79 6c 61 73 74 70 6f 73 20 24 6e 65 77 0a   mylastpos $new.
2f70: 09 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20  .return.    }.. 
2f80: 20 20 20 70 72 6f 63 20 46 6f 72 6d 61 74 54 52     proc FormatTR
2f90: 20 7b 67 72 61 70 68 20 63 73 65 74 7d 20 7b 0a   {graph cset} {.
2fa0: 09 72 65 74 75 72 6e 20 5b 6a 6f 69 6e 20 5b 73  .return [join [s
2fb0: 74 72 75 63 74 3a 3a 6c 69 73 74 20 6d 61 70 20  truct::list map 
2fc0: 5b 24 67 72 61 70 68 20 6e 6f 64 65 20 73 65 74  [$graph node set
2fd0: 20 24 63 73 65 74 20 74 69 6d 65 72 61 6e 67 65   $cset timerange
2fe0: 5d 20 7b 63 6c 6f 63 6b 20 66 6f 72 6d 61 74 7d  ] {clock format}
2ff0: 5d 20 7b 20 2d 2d 20 7d 5d 0a 20 20 20 20 7d 0a  ] { -- }].    }.
3000: 0a 20 20 20 20 74 79 70 65 76 61 72 69 61 62 6c  .    typevariabl
3010: 65 20 6d 79 6c 61 73 74 70 6f 73 20 20 20 20 20  e mylastpos     
3020: 20 20 20 20 20 20 20 2d 31 20 3b 20 23 20 50 6f         -1 ; # Po
3030: 73 69 74 69 6f 6e 20 6f 66 20 6c 61 73 74 20 72  sition of last r
3040: 65 76 69 73 69 6f 6e 20 63 68 61 6e 67 65 73 65  evision changese
3050: 74 20 73 61 76 65 64 2e 0a 20 20 20 20 74 79 70  t saved..    typ
3060: 65 76 61 72 69 61 62 6c 65 20 6d 79 72 65 76 69  evariable myrevi
3070: 73 69 6f 6e 63 68 61 6e 67 65 73 65 74 73 20 7b  sionchangesets {
3080: 7d 20 3b 20 23 20 53 65 74 20 6f 66 20 72 65 76  } ; # Set of rev
3090: 69 73 69 6f 6e 20 63 68 61 6e 67 65 73 65 74 73  ision changesets
30a0: 0a 0a 20 20 20 20 74 79 70 65 76 61 72 69 61 62  ..    typevariab
30b0: 6c 65 20 6d 79 61 74 66 6d 74 20 3b 20 23 20 46  le myatfmt ; # F
30c0: 6f 72 6d 61 74 20 66 6f 72 20 6c 6f 67 20 6f 75  ormat for log ou
30d0: 74 70 75 74 20 74 6f 20 67 61 69 6e 20 62 65 74  tput to gain bet
30e0: 74 65 72 20 61 6c 69 67 6e 6d 65 6e 74 20 6f 66  ter alignment of
30f0: 20 74 68 65 20 76 61 72 69 6f 75 73 20 63 6f 6c   the various col
3100: 75 6d 6e 73 2e 0a 20 20 20 20 74 79 70 65 76 61  umns..    typeva
3110: 72 69 61 62 6c 65 20 6d 79 63 73 66 6d 74 20 3b  riable mycsfmt ;
3120: 20 23 20 44 69 74 74 6f 20 66 6f 72 20 74 68 65   # Ditto for the
3130: 20 63 68 61 6e 67 65 73 65 74 73 2e 0a 0a 20 20   changesets...  
3140: 20 20 23 20 23 20 23 23 20 23 23 23 20 23 23 23    # # ## ### ###
3150: 23 23 20 23 23 23 23 23 23 23 23 20 23 23 23 23  ## ######## ####
3160: 23 23 23 23 23 23 23 23 23 0a 0a 20 20 20 20 70  #########..    p
3170: 72 6f 63 20 42 72 65 61 6b 43 79 63 6c 65 20 7b  roc BreakCycle {
3180: 67 72 61 70 68 7d 20 7b 0a 09 23 20 49 6e 20 74  graph} {..# In t
3190: 68 69 73 20 70 61 73 73 20 74 68 65 20 63 79 63  his pass the cyc
31a0: 6c 65 20 62 72 65 61 6b 69 6e 67 20 63 61 6e 20  le breaking can 
31b0: 62 65 20 6d 61 64 65 20 61 20 62 69 74 20 6d 6f  be made a bit mo
31c0: 72 65 0a 09 23 20 74 61 72 67 65 74 65 64 2c 20  re..# targeted, 
31d0: 68 65 6e 63 65 20 74 68 69 73 20 63 75 73 74 6f  hence this custo
31e0: 6d 20 63 61 6c 6c 62 61 63 6b 2e 0a 09 23 0a 09  m callback...#..
31f0: 23 20 46 69 72 73 74 20 77 65 20 75 73 65 20 74  # First we use t
3200: 68 65 20 64 61 74 61 20 72 65 6d 65 6d 62 65 72  he data remember
3210: 65 64 20 62 79 20 27 53 61 76 65 4f 72 64 65 72  ed by 'SaveOrder
3220: 27 2c 20 61 62 6f 75 74 20 74 68 65 0a 09 23 20  ', about the..# 
3230: 6c 61 73 74 20 63 6f 6d 6d 69 74 20 70 6f 73 69  last commit posi
3240: 74 69 6f 6e 20 69 74 20 68 61 6e 64 6c 65 64 2c  tion it handled,
3250: 20 74 6f 20 64 65 64 75 63 65 20 74 68 65 20 6e   to deduce the n
3260: 65 78 74 20 72 65 76 69 73 69 6f 6e 0a 09 23 20  ext revision..# 
3270: 63 68 61 6e 67 65 73 65 74 20 69 74 20 77 6f 75  changeset it wou
3280: 6c 64 20 65 6e 63 6f 75 6e 74 65 72 2e 20 54 68  ld encounter. Th
3290: 65 6e 20 77 65 20 6c 6f 6f 6b 20 66 6f 72 20 74  en we look for t
32a0: 68 65 20 73 68 6f 72 74 65 73 74 0a 09 23 20 70  he shortest..# p
32b0: 72 65 64 65 63 65 73 73 6f 72 20 70 61 74 68 20  redecessor path 
32c0: 66 72 6f 6d 20 69 74 20 74 6f 20 61 6c 6c 20 6f  from it to all o
32d0: 74 68 65 72 20 72 65 76 69 73 69 6f 6e 20 63 68  ther revision ch
32e0: 61 6e 67 65 73 65 74 73 0a 09 23 20 61 6e 64 20  angesets..# and 
32f0: 62 72 65 61 6b 20 74 68 69 73 20 70 61 74 68 2e  break this path.
3300: 20 57 69 74 68 6f 75 74 20 73 75 63 68 20 61 20   Without such a 
3310: 70 61 74 68 20 77 65 20 66 61 6c 6c 20 62 61 63  path we fall bac
3320: 6b 20 74 6f 20 74 68 65 0a 09 23 20 67 65 6e 65  k to the..# gene
3330: 72 69 63 20 63 79 63 6c 65 20 62 72 65 61 6b 65  ric cycle breake
3340: 72 2e 0a 0a 09 3a 3a 76 61 72 69 61 62 6c 65 20  r....::variable 
3350: 6d 79 6c 61 73 74 70 6f 73 0a 09 3a 3a 76 61 72  mylastpos..::var
3360: 69 61 62 6c 65 20 6d 79 63 73 65 74 0a 09 3a 3a  iable mycset..::
3370: 76 61 72 69 61 62 6c 65 20 6d 79 72 65 76 69 73  variable myrevis
3380: 69 6f 6e 63 68 61 6e 67 65 73 65 74 73 0a 0a 09  ionchangesets...
3390: 73 65 74 20 6e 65 78 74 70 6f 73 20 5b 65 78 70  set nextpos [exp
33a0: 72 20 7b 24 6d 79 6c 61 73 74 70 6f 73 20 2b 20  r {$mylastpos + 
33b0: 31 7d 5d 0a 09 73 65 74 20 6e 65 78 74 20 20 20  1}]..set next   
33c0: 20 24 6d 79 63 73 65 74 28 24 6e 65 78 74 70 6f   $mycset($nextpo
33d0: 73 29 0a 0a 09 70 75 74 73 20 22 2a 2a 20 4c 61  s)...puts "** La
33e0: 73 74 3a 20 24 6d 79 6c 61 73 74 70 6f 73 20 3d  st: $mylastpos =
33f0: 20 5b 24 6d 79 63 73 65 74 28 24 6d 79 6c 61 73   [$mycset($mylas
3400: 74 70 6f 73 29 20 73 74 72 5d 20 40 20 5b 24 6d  tpos) str] @ [$m
3410: 79 63 73 65 74 28 24 6d 79 6c 61 73 74 70 6f 73  ycset($mylastpos
3420: 29 20 70 6f 73 5d 22 0a 09 70 75 74 73 20 22 2a  ) pos]"..puts "*
3430: 2a 20 4e 65 78 74 3a 20 24 6e 65 78 74 70 6f 73  * Next: $nextpos
3440: 20 3d 20 5b 24 6e 65 78 74 20 73 74 72 5d 20 40   = [$next str] @
3450: 20 5b 24 6e 65 78 74 20 70 6f 73 5d 22 0a 0a 09   [$next pos]"...
3460: 73 65 74 20 70 61 74 68 20 5b 53 65 61 72 63 68  set path [Search
3470: 46 6f 72 50 61 74 68 20 24 67 72 61 70 68 20 24  ForPath $graph $
3480: 6e 65 78 74 20 24 6d 79 72 65 76 69 73 69 6f 6e  next $myrevision
3490: 63 68 61 6e 67 65 73 65 74 73 5d 0a 09 69 66 20  changesets]..if 
34a0: 7b 5b 6c 6c 65 6e 67 74 68 20 24 70 61 74 68 5d  {[llength $path]
34b0: 7d 20 7b 0a 09 20 20 20 20 63 79 63 6c 65 62 72  } {..    cyclebr
34c0: 65 61 6b 65 72 20 62 72 65 61 6b 2d 73 65 67 6d  eaker break-segm
34d0: 65 6e 74 20 24 67 72 61 70 68 20 24 70 61 74 68  ent $graph $path
34e0: 0a 09 20 20 20 20 72 65 74 75 72 6e 0a 09 7d 0a  ..    return..}.
34f0: 0a 09 23 20 57 65 20 77 65 72 65 20 75 6e 61 62  ..# We were unab
3500: 6c 65 20 74 6f 20 66 69 6e 64 20 61 6e 20 6f 72  le to find an or
3510: 64 65 72 65 64 20 63 68 61 6e 67 65 73 65 74 20  dered changeset 
3520: 69 6e 20 74 68 65 20 72 65 61 63 68 61 62 6c 65  in the reachable
3530: 0a 09 23 20 70 72 65 64 65 63 65 73 73 6f 72 73  ..# predecessors
3540: 2c 20 66 61 6c 6c 20 62 61 63 6b 20 74 6f 20 74  , fall back to t
3550: 68 65 20 67 65 6e 65 72 69 63 20 63 6f 64 65 20  he generic code 
3560: 66 6f 72 20 62 72 65 61 6b 69 6e 67 20 74 68 65  for breaking the
3570: 0a 09 23 20 66 6f 75 6e 64 20 63 79 63 6c 65 2e  ..# found cycle.
3580: 0a 0a 09 63 79 63 6c 65 62 72 65 61 6b 65 72 20  ...cyclebreaker 
3590: 62 72 65 61 6b 20 24 67 72 61 70 68 0a 20 20 20  break $graph.   
35a0: 20 7d 0a 0a 20 20 20 20 70 72 6f 63 20 53 65 61   }..    proc Sea
35b0: 72 63 68 46 6f 72 50 61 74 68 20 7b 67 72 61 70  rchForPath {grap
35c0: 68 20 6e 20 73 74 6f 70 6e 6f 64 65 73 7d 20 7b  h n stopnodes} {
35d0: 0a 09 23 20 53 65 61 72 63 68 20 66 6f 72 20 70  ..# Search for p
35e0: 61 74 68 73 20 74 6f 20 70 72 65 72 65 71 75 69  aths to prerequi
35f0: 73 69 74 65 73 20 6f 66 20 4e 2e 0a 09 23 0a 09  sites of N...#..
3600: 23 20 54 72 79 20 74 6f 20 66 69 6e 64 20 74 68  # Try to find th
3610: 65 20 73 68 6f 72 74 65 73 74 20 64 65 70 65 6e  e shortest depen
3620: 64 65 6e 63 79 20 70 61 74 68 20 74 68 61 74 20  dency path that 
3630: 63 61 75 73 65 73 20 74 68 65 0a 09 23 20 63 68  causes the..# ch
3640: 61 6e 67 65 73 65 74 20 4e 20 74 6f 20 64 65 70  angeset N to dep
3650: 65 6e 64 20 28 64 69 72 65 63 74 6c 79 20 6f 72  end (directly or
3660: 20 69 6e 64 69 72 65 63 74 6c 79 29 20 6f 6e 20   indirectly) on 
3670: 6f 6e 65 20 6f 66 20 74 68 65 0a 09 23 20 63 68  one of the..# ch
3680: 61 6e 67 65 73 65 74 73 20 63 6f 6e 74 61 69 6e  angesets contain
3690: 65 64 20 69 6e 20 53 54 4f 50 4e 4f 44 45 53 2e  ed in STOPNODES.
36a0: 0a 09 23 0a 09 23 20 57 65 20 63 6f 6e 73 69 64  ..#..# We consid
36b0: 65 72 20 64 69 72 65 63 74 20 61 6e 64 20 69 6e  er direct and in
36c0: 64 69 72 65 63 74 20 64 65 70 65 6e 64 65 6e 63  direct dependenc
36d0: 69 65 73 20 69 6e 20 74 68 65 20 73 65 6e 73 65  ies in the sense
36e0: 0a 09 23 20 74 68 61 74 20 74 68 65 20 63 68 61  ..# that the cha
36f0: 6e 67 65 73 65 74 20 63 61 6e 20 62 65 20 72 65  ngeset can be re
3700: 61 63 68 65 64 20 62 79 20 66 6f 6c 6c 6f 77 69  ached by followi
3710: 6e 67 20 61 20 63 68 61 69 6e 20 6f 66 0a 09 23  ng a chain of..#
3720: 20 70 72 65 64 65 63 65 73 73 6f 72 20 6e 6f 64   predecessor nod
3730: 65 73 2e 0a 09 23 0a 09 23 20 57 68 65 6e 20 6f  es...#..# When o
3740: 6e 65 20 6f 66 20 74 68 65 20 63 73 65 74 73 20  ne of the csets 
3750: 69 6e 20 53 54 4f 50 4e 4f 44 45 53 20 69 73 20  in STOPNODES is 
3760: 66 6f 75 6e 64 2c 20 77 65 20 74 65 72 6d 69 6e  found, we termin
3770: 61 74 65 0a 09 23 20 74 68 65 20 73 65 61 72 63  ate..# the searc
3780: 68 20 61 6e 64 20 72 65 74 75 72 6e 20 74 68 65  h and return the
3790: 20 70 61 74 68 20 66 72 6f 6d 20 74 68 61 74 20   path from that 
37a0: 63 73 65 74 20 74 6f 20 4e 2e 20 20 49 66 20 6e  cset to N.  If n
37b0: 6f 0a 09 23 20 70 61 74 68 20 69 73 20 66 6f 75  o..# path is fou
37c0: 6e 64 20 74 6f 20 61 20 6e 6f 64 65 20 69 6e 20  nd to a node in 
37d0: 53 54 4f 50 5f 53 45 54 2c 20 77 65 20 72 65 74  STOP_SET, we ret
37e0: 75 72 6e 20 74 68 65 20 65 6d 70 74 79 0a 09 23  urn the empty..#
37f0: 20 6c 69 73 74 2f 70 61 74 68 2e 0a 0a 09 23 20   list/path....# 
3800: 54 68 69 73 20 69 73 20 69 6e 20 65 73 73 65 6e  This is in essen
3810: 63 65 20 61 20 6d 75 6c 74 69 2d 64 65 73 74 69  ce a multi-desti
3820: 6e 61 74 69 6f 6e 20 44 69 6a 6b 73 74 72 61 20  nation Dijkstra 
3830: 73 74 61 72 74 69 6e 67 20 61 74 0a 09 23 20 4e  starting at..# N
3840: 20 77 68 69 63 68 20 73 74 6f 70 73 20 77 68 65   which stops whe
3850: 6e 20 6f 6e 65 20 6f 66 20 74 68 65 20 64 65 73  n one of the des
3860: 74 69 6e 61 74 69 6f 6e 73 20 69 6e 20 53 54 4f  tinations in STO
3870: 50 4e 4f 44 45 53 20 68 61 73 0a 09 23 20 62 65  PNODES has..# be
3880: 65 6e 20 72 65 61 63 68 65 64 2c 20 74 72 61 76  en reached, trav
3890: 65 72 73 69 6e 67 20 74 68 65 20 70 72 65 64 65  ersing the prede
38a0: 63 65 73 73 6f 72 20 61 72 63 73 2e 0a 0a 09 23  cessor arcs....#
38b0: 20 52 45 41 43 48 41 42 4c 45 20 3a 3a 20 61 72   REACHABLE :: ar
38c0: 72 61 79 20 28 4e 4f 44 45 20 2d 3e 20 6c 69 73  ray (NODE -> lis
38d0: 74 20 28 53 54 45 50 53 2c 20 50 52 45 56 49 4f  t (STEPS, PREVIO
38e0: 55 53 29 29 0a 09 23 0a 09 23 20 53 65 6d 61 6e  US))..#..# Seman
38f0: 74 69 63 73 3a 20 4e 4f 44 45 20 63 61 6e 20 62  tics: NODE can b
3900: 65 20 72 65 61 63 68 65 64 20 66 72 6f 6d 20 4e  e reached from N
3910: 20 69 6e 20 53 54 45 50 53 20 73 74 65 70 73 2c   in STEPS steps,
3920: 20 61 6e 64 0a 09 23 20 50 52 45 56 49 4f 55 53   and..# PREVIOUS
3930: 20 69 73 20 74 68 65 20 70 72 65 76 69 6f 75 73   is the previous
3940: 20 6e 6f 64 65 20 69 6e 20 74 68 65 20 70 61 74   node in the pat
3950: 68 20 77 68 69 63 68 20 72 65 61 63 68 65 64 20  h which reached 
3960: 69 74 2c 0a 09 23 20 61 6c 6c 6f 77 69 6e 67 20  it,..# allowing 
3970: 75 73 20 61 74 20 74 68 65 20 65 6e 64 20 74 6f  us at the end to
3980: 20 63 6f 6e 73 74 72 75 63 74 20 74 68 65 20 66   construct the f
3990: 75 6c 6c 20 70 61 74 68 20 62 79 0a 09 23 20 66  ull path by..# f
39a0: 6f 6c 6c 6f 77 69 6e 67 20 74 68 65 73 65 20 62  ollowing these b
39b0: 61 63 6b 6c 69 6e 6b 73 20 66 72 6f 6d 20 74 68  acklinks from th
39c0: 65 20 66 6f 75 6e 64 20 64 65 73 74 69 6e 61 74  e found destinat
39d0: 69 6f 6e 2e 20 4e 20 69 73 0a 09 23 20 6f 6e 6c  ion. N is..# onl
39e0: 79 20 69 6e 63 6c 75 64 65 64 20 61 73 20 61 20  y included as a 
39f0: 6b 65 79 20 69 66 20 74 68 65 72 65 20 69 73 20  key if there is 
3a00: 61 20 6c 6f 6f 70 20 6c 65 61 64 69 6e 67 20 62  a loop leading b
3a10: 61 63 6b 20 74 6f 0a 09 23 20 69 74 2e 0a 0a 09  ack to..# it....
3a20: 23 20 50 45 4e 44 49 4e 47 20 3a 3a 20 6c 69 73  # PENDING :: lis
3a30: 74 20 28 6c 69 73 74 20 28 4e 4f 44 45 2c 20 53  t (list (NODE, S
3a40: 54 45 50 53 29 29 0a 09 23 0a 09 23 20 53 65 6d  TEPS))..#..# Sem
3a50: 61 6e 74 69 63 73 3a 20 41 20 6c 69 73 74 20 6f  antics: A list o
3a60: 66 20 70 6f 73 73 69 62 69 6c 69 74 69 65 73 20  f possibilities 
3a70: 74 68 61 74 20 73 74 69 6c 6c 20 68 61 76 65 20  that still have 
3a80: 74 6f 20 62 65 0a 09 23 20 69 6e 76 65 73 74 69  to be..# investi
3a90: 67 61 74 65 64 2c 20 77 68 65 72 65 20 53 54 45  gated, where STE
3aa0: 50 53 20 69 73 20 74 68 65 20 6e 75 6d 62 65 72  PS is the number
3ab0: 20 6f 66 20 73 74 65 70 73 20 74 6f 20 67 65 74   of steps to get
3ac0: 20 74 6f 0a 09 23 20 4e 4f 44 45 2e 0a 0a 09 61   to..# NODE....a
3ad0: 72 72 61 79 20 73 65 74 20 72 65 61 63 68 61 62  rray set reachab
3ae0: 6c 65 20 7b 7d 0a 09 73 65 74 20 70 65 6e 64 69  le {}..set pendi
3af0: 6e 67 20 5b 6c 69 73 74 20 5b 6c 69 73 74 20 24  ng [list [list $
3b00: 6e 20 30 5d 5d 0a 09 73 65 74 20 61 74 20 30 0a  n 0]]..set at 0.
3b10: 0a 09 70 75 74 73 20 22 2a 2a 20 53 65 61 72 63  ..puts "** Searc
3b20: 68 69 6e 67 20 73 68 6f 72 74 65 73 74 20 70 61  hing shortest pa
3b30: 74 68 20 2e 2e 2e 22 0a 0a 09 77 68 69 6c 65 20  th ..."...while 
3b40: 7b 24 61 74 20 3c 20 5b 6c 6c 65 6e 67 74 68 20  {$at < [llength 
3b50: 24 70 65 6e 64 69 6e 67 5d 7d 20 7b 0a 09 20 20  $pending]} {..  
3b60: 20 20 73 74 72 75 63 74 3a 3a 6c 69 73 74 20 61    struct::list a
3b70: 73 73 69 67 6e 20 5b 6c 69 6e 64 65 78 20 24 70  ssign [lindex $p
3b80: 65 6e 64 69 6e 67 20 24 61 74 5d 20 63 75 72 72  ending $at] curr
3b90: 65 6e 74 20 73 74 65 70 73 0a 0a 09 20 20 20 20  ent steps...    
3ba0: 23 70 75 74 73 20 22 2a 2a 20 5b 6c 69 6e 64 65  #puts "** [linde
3bb0: 78 20 24 70 65 6e 64 69 6e 67 20 24 61 74 5d 20  x $pending $at] 
3bc0: 2a 2a 20 5b 24 63 75 72 72 65 6e 74 20 73 74 72  ** [$current str
3bd0: 5d 20 2a 2a 22 0a 09 20 20 20 20 69 6e 63 72 20  ] **"..    incr 
3be0: 61 74 0a 0a 09 20 20 20 20 23 20 50 72 6f 63 65  at...    # Proce
3bf0: 73 73 20 74 68 65 20 70 6f 73 73 69 62 69 6c 69  ss the possibili
3c00: 74 79 2e 20 54 68 69 73 20 69 73 20 61 20 62 72  ty. This is a br
3c10: 65 61 64 74 68 2d 66 69 72 73 74 20 74 72 61 76  eadth-first trav
3c20: 65 72 73 61 6c 2e 0a 09 20 20 20 20 69 6e 63 72  ersal...    incr
3c30: 20 73 74 65 70 73 0a 09 20 20 20 20 66 6f 72 65   steps..    fore
3c40: 61 63 68 20 70 72 65 20 5b 24 67 72 61 70 68 20  ach pre [$graph 
3c50: 6e 6f 64 65 73 20 2d 69 6e 20 24 63 75 72 72 65  nodes -in $curre
3c60: 6e 74 5d 20 7b 0a 09 20 20 20 20 20 20 20 20 23  nt] {..        #
3c70: 20 53 69 6e 63 65 20 74 68 65 20 73 65 61 72 63   Since the searc
3c80: 68 20 69 73 20 62 72 65 61 64 74 68 2d 66 69 72  h is breadth-fir
3c90: 73 74 2c 20 77 65 20 6f 6e 6c 79 20 68 61 76 65  st, we only have
3ca0: 20 74 6f 20 23 0a 09 20 20 20 20 20 20 20 20 23   to #..        #
3cb0: 20 73 65 74 20 6e 6f 64 65 73 20 74 68 61 74 20   set nodes that 
3cc0: 64 6f 6e 27 74 20 61 6c 72 65 61 64 79 20 65 78  don't already ex
3cd0: 69 73 74 2e 20 49 66 20 74 68 65 79 20 64 6f 20  ist. If they do 
3ce0: 74 68 65 79 0a 09 20 20 20 20 20 20 20 20 23 20  they..        # 
3cf0: 68 61 76 65 20 62 65 65 6e 20 72 65 61 63 68 65  have been reache
3d00: 64 20 61 6c 72 65 61 64 79 20 6f 6e 20 61 20 73  d already on a s
3d10: 68 6f 72 74 65 72 20 70 61 74 68 2e 0a 0a 09 09  horter path.....
3d20: 69 66 20 7b 5b 69 6e 66 6f 20 65 78 69 73 74 73  if {[info exists
3d30: 20 72 65 61 63 68 61 62 6c 65 28 24 70 72 65 29   reachable($pre)
3d40: 5d 7d 20 63 6f 6e 74 69 6e 75 65 0a 0a 09 09 73  ]} continue....s
3d50: 65 74 20 72 65 61 63 68 61 62 6c 65 28 24 70 72  et reachable($pr
3d60: 65 29 20 5b 6c 69 73 74 20 24 73 74 65 70 73 20  e) [list $steps 
3d70: 24 63 75 72 72 65 6e 74 5d 0a 09 09 6c 61 70 70  $current]...lapp
3d80: 65 6e 64 20 70 65 6e 64 69 6e 67 20 5b 6c 69 73  end pending [lis
3d90: 74 20 24 70 72 65 20 24 73 74 65 70 73 5d 0a 0a  t $pre $steps]..
3da0: 09 09 23 20 43 6f 6e 74 69 6e 75 65 20 74 68 65  ..# Continue the
3db0: 20 73 65 61 72 63 68 20 77 68 69 6c 65 20 68 61   search while ha
3dc0: 76 65 20 6e 6f 74 20 72 65 61 63 68 65 64 20 61  ve not reached a
3dd0: 6e 79 20 6f 66 0a 09 09 23 20 6f 75 72 20 64 65  ny of...# our de
3de0: 73 74 69 6e 61 74 69 6f 6e 73 3f 0a 09 09 69 66  stinations?...if
3df0: 20 7b 21 5b 73 74 72 75 63 74 3a 3a 73 65 74 20   {![struct::set 
3e00: 63 6f 6e 74 61 69 6e 20 24 70 72 65 20 24 73 74  contain $pre $st
3e10: 6f 70 6e 6f 64 65 73 5d 7d 20 63 6f 6e 74 69 6e  opnodes]} contin
3e20: 75 65 0a 0a 09 09 23 20 57 65 20 68 61 76 65 20  ue....# We have 
3e30: 61 72 72 69 76 65 64 2c 20 50 52 45 20 69 73 20  arrived, PRE is 
3e40: 6f 6e 65 20 6f 66 20 74 68 65 20 64 65 73 74 69  one of the desti
3e50: 6e 61 74 69 6f 6e 3b 20 6e 6f 77 0a 09 09 23 20  nation; now...# 
3e60: 63 6f 6e 73 74 72 75 63 74 20 61 6e 64 20 72 65  construct and re
3e70: 74 75 72 6e 20 74 68 65 20 70 61 74 68 20 74 6f  turn the path to
3e80: 20 69 74 20 66 72 6f 6d 20 4e 20 62 79 0a 09 09   it from N by...
3e90: 23 20 66 6f 6c 6c 6f 77 69 6e 67 20 74 68 65 20  # following the 
3ea0: 62 61 63 6b 6c 69 6e 6b 73 20 69 6e 20 74 68 65  backlinks in the
3eb0: 20 73 65 61 72 63 68 20 73 74 61 74 65 2e 0a 09   search state...
3ec0: 09 73 65 74 20 70 61 74 68 20 5b 6c 69 73 74 20  .set path [list 
3ed0: 24 70 72 65 5d 0a 09 09 77 68 69 6c 65 20 7b 31  $pre]...while {1
3ee0: 7d 20 7b 0a 09 09 20 20 20 20 73 65 74 20 70 72  } {...    set pr
3ef0: 65 20 5b 6c 69 6e 64 65 78 20 24 72 65 61 63 68  e [lindex $reach
3f00: 61 62 6c 65 28 24 70 72 65 29 20 31 5d 0a 09 09  able($pre) 1]...
3f10: 20 20 20 20 69 66 20 7b 24 70 72 65 20 65 71 20      if {$pre eq 
3f20: 24 6e 7d 20 62 72 65 61 6b 0a 09 09 20 20 20 20  $n} break...    
3f30: 6c 61 70 70 65 6e 64 20 70 61 74 68 20 24 70 72  lappend path $pr
3f40: 65 0a 09 09 7d 0a 09 09 6c 61 70 70 65 6e 64 20  e...}...lappend 
3f50: 70 61 74 68 20 24 6e 0a 0a 09 09 70 75 74 73 20  path $n....puts 
3f60: 22 2a 2a 20 53 65 61 72 63 68 69 6e 67 20 73 68  "** Searching sh
3f70: 6f 72 74 65 73 74 20 70 61 74 68 20 2e 2e 2e 20  ortest path ... 
3f80: 46 6f 75 6e 64 20 28 5b 70 72 6f 6a 65 63 74 20  Found ([project 
3f90: 72 65 76 20 73 74 72 6c 69 73 74 20 24 70 61 74  rev strlist $pat
3fa0: 68 5d 29 22 0a 09 09 72 65 74 75 72 6e 20 24 70  h])"...return $p
3fb0: 61 74 68 0a 09 20 20 20 20 7d 0a 09 7d 0a 0a 09  ath..    }..}...
3fc0: 70 75 74 73 20 22 2a 2a 20 53 65 61 72 63 68 69  puts "** Searchi
3fd0: 6e 67 20 73 68 6f 72 74 65 73 74 20 70 61 74 68  ng shortest path
3fe0: 20 2e 2e 2e 20 4e 6f 74 20 66 6f 75 6e 64 22 0a   ... Not found".
3ff0: 0a 09 23 20 4e 6f 20 70 61 74 68 20 66 6f 75 6e  ..# No path foun
4000: 64 2e 0a 09 72 65 74 75 72 6e 20 7b 7d 0a 20 20  d...return {}.  
4010: 20 20 7d 0a 0a 20 20 20 20 23 20 23 20 23 23 20    }..    # # ## 
4020: 23 23 23 20 23 23 23 23 23 20 23 23 23 23 23 23  ### ##### ######
4030: 23 23 20 23 23 23 23 23 23 23 23 23 23 23 23 23  ## #############
4040: 0a 0a 20 20 20 20 74 79 70 65 76 61 72 69 61 62  ..    typevariab
4050: 6c 65 20 6d 79 63 73 65 74 20 2d 61 72 72 61 79  le mycset -array
4060: 20 7b 7d 20 3b 20 23 20 4d 61 70 20 66 72 6f 6d   {} ; # Map from
4070: 20 63 6f 6d 6d 69 74 20 70 6f 73 69 74 69 6f 6e   commit position
4080: 73 20 74 6f 20 74 68 65 0a 09 09 09 09 20 20 20  s to the.....   
4090: 20 23 20 63 68 61 6e 67 65 73 65 74 20 28 6f 62   # changeset (ob
40a0: 6a 65 63 74 20 72 65 66 29 20 61 74 20 74 68 61  ject ref) at tha
40b0: 74 0a 09 09 09 09 20 20 20 20 23 20 70 6f 73 69  t.....    # posi
40c0: 74 69 6f 6e 2e 0a 0a 20 20 20 20 23 20 23 20 23  tion...    # # #
40d0: 23 20 23 23 23 20 23 23 23 23 23 20 23 23 23 23  # ### ##### ####
40e0: 23 23 23 23 20 23 23 23 23 23 23 23 23 23 23 23  #### ###########
40f0: 23 23 0a 20 20 20 20 23 23 20 43 6f 6e 66 69 67  ##.    ## Config
4100: 75 72 61 74 69 6f 6e 0a 0a 20 20 20 20 70 72 61  uration..    pra
4110: 67 6d 61 20 2d 68 61 73 69 6e 73 74 61 6e 63 65  gma -hasinstance
4120: 73 20 20 20 6e 6f 20 3b 20 23 20 73 69 6e 67 6c  s   no ; # singl
4130: 65 74 6f 6e 0a 20 20 20 20 70 72 61 67 6d 61 20  eton.    pragma 
4140: 2d 68 61 73 74 79 70 65 69 6e 66 6f 20 20 20 20  -hastypeinfo    
4150: 6e 6f 20 3b 20 23 20 6e 6f 20 69 6e 74 72 6f 73  no ; # no intros
4160: 70 65 63 74 69 6f 6e 0a 20 20 20 20 70 72 61 67  pection.    prag
4170: 6d 61 20 2d 68 61 73 74 79 70 65 64 65 73 74 72  ma -hastypedestr
4180: 6f 79 20 6e 6f 20 3b 20 23 20 69 6d 6d 6f 72 74  oy no ; # immort
4190: 61 6c 0a 0a 20 20 20 20 23 20 23 20 23 23 20 23  al..    # # ## #
41a0: 23 23 20 23 23 23 23 23 20 23 23 23 23 23 23 23  ## ##### #######
41b0: 23 20 23 23 23 23 23 23 23 23 23 23 23 23 23 0a  # #############.
41c0: 7d 0a 0a 6e 61 6d 65 73 70 61 63 65 20 65 76 61  }..namespace eva
41d0: 6c 20 3a 3a 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a  l ::vc::fossil::
41e0: 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 70 61 73  import::cvs::pas
41f0: 73 20 7b 0a 20 20 20 20 6e 61 6d 65 73 70 61 63  s {.    namespac
4200: 65 20 65 78 70 6f 72 74 20 62 72 65 61 6b 61 63  e export breakac
4210: 79 63 6c 65 0a 20 20 20 20 6e 61 6d 65 73 70 61  ycle.    namespa
4220: 63 65 20 65 76 61 6c 20 62 72 65 61 6b 61 63 79  ce eval breakacy
4230: 63 6c 65 20 7b 0a 09 6e 61 6d 65 73 70 61 63 65  cle {..namespace
4240: 20 69 6d 70 6f 72 74 20 3a 3a 76 63 3a 3a 66 6f   import ::vc::fo
4250: 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76  ssil::import::cv
4260: 73 3a 3a 63 79 63 6c 65 62 72 65 61 6b 65 72 0a  s::cyclebreaker.
4270: 09 6e 61 6d 65 73 70 61 63 65 20 69 6d 70 6f 72  .namespace impor
4280: 74 20 3a 3a 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a  t ::vc::fossil::
4290: 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 72 65 70  import::cvs::rep
42a0: 6f 73 69 74 6f 72 79 0a 09 6e 61 6d 65 73 70 61  ository..namespa
42b0: 63 65 20 69 6d 70 6f 72 74 20 3a 3a 76 63 3a 3a  ce import ::vc::
42c0: 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a  fossil::import::
42d0: 63 76 73 3a 3a 73 74 61 74 65 0a 09 6e 61 6d 65  cvs::state..name
42e0: 73 70 61 63 65 20 69 6d 70 6f 72 74 20 3a 3a 76  space import ::v
42f0: 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72  c::fossil::impor
4300: 74 3a 3a 63 76 73 3a 3a 69 6e 74 65 67 72 69 74  t::cvs::integrit
4310: 79 0a 09 6e 61 6d 65 73 70 61 63 65 20 65 76 61  y..namespace eva
4320: 6c 20 70 72 6f 6a 65 63 74 20 7b 0a 09 20 20 20  l project {..   
4330: 20 6e 61 6d 65 73 70 61 63 65 20 69 6d 70 6f 72   namespace impor
4340: 74 20 3a 3a 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a  t ::vc::fossil::
4350: 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 70 72 6f  import::cvs::pro
4360: 6a 65 63 74 3a 3a 72 65 76 0a 09 7d 0a 09 6e 61  ject::rev..}..na
4370: 6d 65 73 70 61 63 65 20 69 6d 70 6f 72 74 20 3a  mespace import :
4380: 3a 76 63 3a 3a 74 6f 6f 6c 73 3a 3a 6d 69 73 63  :vc::tools::misc
4390: 3a 3a 2a 0a 09 6e 61 6d 65 73 70 61 63 65 20 69  ::*..namespace i
43a0: 6d 70 6f 72 74 20 3a 3a 76 63 3a 3a 74 6f 6f 6c  mport ::vc::tool
43b0: 73 3a 3a 74 72 6f 75 62 6c 65 0a 09 6e 61 6d 65  s::trouble..name
43c0: 73 70 61 63 65 20 69 6d 70 6f 72 74 20 3a 3a 76  space import ::v
43d0: 63 3a 3a 74 6f 6f 6c 73 3a 3a 6c 6f 67 0a 09 6c  c::tools::log..l
43e0: 6f 67 20 72 65 67 69 73 74 65 72 20 62 72 65 61  og register brea
43f0: 6b 61 63 79 63 6c 65 0a 20 20 20 20 7d 0a 7d 0a  kacycle.    }.}.
4400: 0a 23 20 23 20 23 23 20 23 23 23 20 23 23 23 23  .# # ## ### ####
4410: 23 20 23 23 23 23 23 23 23 23 20 23 23 23 23 23  # ######## #####
4420: 23 23 23 23 23 23 23 23 20 23 23 23 23 23 23 23  ######## #######
4430: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 0a 23  ##############.#
4440: 23 20 52 65 61 64 79 0a 0a 70 61 63 6b 61 67 65  # Ready..package
4450: 20 70 72 6f 76 69 64 65 20 76 63 3a 3a 66 6f 73   provide vc::fos
4460: 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73  sil::import::cvs
4470: 3a 3a 70 61 73 73 3a 3a 62 72 65 61 6b 61 63 79  ::pass::breakacy
4480: 63 6c 65 20 31 2e 30 0a 72 65 74 75 72 6e 0a     cle 1.0.return.