Hex Artifact Content
Not logged in

Artifact 9de68fa960f50394190ff490c3e53d782264f020:

File tools/cvs2fossil/lib/c2f_pbreakacycle.tcl part of check-in [f637d42206] - Updated my notes regarding memory usage. Converted more locations to incremental query processing via 'state foreachrow', now throughout the importer. by aku on 2008-02-24 18:01:40.

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 58 2e 20 54 68 69 73 20 69 73 20 74 68 65  s X. This is the
0210: 20 66 69 6e 61 6c 20 70 61 73 73 20 66 6f 72 20   final pass for 
0220: 62 72 65 61 6b 69 6e 67 20 63 68 61 6e 67 65 73  breaking changes
0230: 65 74 20 64 65 70 65 6e 64 65 6e 63 79 0a 23 23  et dependency.##
0240: 20 63 79 63 6c 65 73 2e 20 54 68 65 20 70 72 65   cycles. The pre
0250: 76 69 6f 75 73 20 62 72 65 61 6b 65 72 20 70 61  vious breaker pa
0260: 73 73 65 73 20 28 37 20 61 6e 64 20 39 29 20 62  sses (7 and 9) b
0270: 72 6f 6b 65 20 63 79 63 6c 65 73 20 63 6f 76 65  roke cycles cove
0280: 72 69 6e 67 0a 23 23 20 72 65 76 69 73 69 6f 6e  ring.## revision
0290: 20 61 6e 64 20 73 79 6d 62 6f 6c 20 63 68 61 6e   and symbol chan
02a0: 67 65 73 65 74 73 2c 20 72 65 73 70 65 63 74 69  gesets, respecti
02b0: 76 65 6c 79 2e 20 54 68 69 73 20 70 61 73 73 20  vely. This pass 
02c0: 6e 6f 77 20 62 72 65 61 6b 73 0a 23 23 20 61 6e  now breaks.## an
02d0: 79 20 72 65 6d 61 69 6e 69 6e 67 20 63 79 63 6c  y remaining cycl
02e0: 65 73 2c 20 65 61 63 68 20 6f 66 20 77 68 69 63  es, each of whic
02f0: 68 20 68 61 73 20 74 6f 20 63 6f 6e 74 61 69 6e  h has to contain
0300: 20 61 74 20 6c 65 61 73 74 20 6f 6e 65 0a 23 23   at least one.##
0310: 20 72 65 76 69 73 69 6f 6e 20 61 6e 64 20 61 74   revision and at
0320: 20 6c 65 61 73 74 20 6f 6e 65 20 73 79 6d 62 6f   least one symbo
0330: 6c 20 63 68 61 6e 67 65 73 65 74 2e 0a 0a 23 20  l changeset...# 
0340: 23 20 23 23 20 23 23 23 20 23 23 23 23 23 20 23  # ## ### ##### #
0350: 23 23 23 23 23 23 23 20 23 23 23 23 23 23 23 23  ####### ########
0360: 23 23 23 23 23 20 23 23 23 23 23 23 23 23 23 23  ##### ##########
0370: 23 23 23 23 23 23 23 23 23 23 23 0a 23 23 20 52  ###########.## R
0380: 65 71 75 69 72 65 6d 65 6e 74 73 0a 0a 70 61 63  equirements..pac
0390: 6b 61 67 65 20 72 65 71 75 69 72 65 20 54 63 6c  kage require Tcl
03a0: 20 38 2e 34 20 20 20 20 20 20 20 20 20 20 20 20   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 3b 20 23 20 52 65 71 75 69         ; # Requi
03d0: 72 65 64 20 72 75 6e 74 69 6d 65 2e 0a 70 61 63  red runtime..pac
03e0: 6b 61 67 65 20 72 65 71 75 69 72 65 20 73 6e 69  kage require sni
03f0: 74 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20  t               
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 3b 20 23 20 4f 4f 20 73 79         ; # OO sy
0420: 73 74 65 6d 2e 0a 70 61 63 6b 61 67 65 20 72 65  stem..package re
0430: 71 75 69 72 65 20 73 74 72 75 63 74 3a 3a 6c 69  quire struct::li
0440: 73 74 20 20 20 20 20 20 20 20 20 20 20 20 20 20  st              
0450: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
0460: 3b 20 23 20 48 69 67 68 65 72 20 6f 72 64 65 72  ; # Higher order
0470: 20 6c 69 73 74 20 6f 70 65 72 61 74 69 6f 6e 73   list operations
0480: 2e 0a 70 61 63 6b 61 67 65 20 72 65 71 75 69 72  ..package requir
0490: 65 20 73 74 72 75 63 74 3a 3a 73 65 74 20 20 20  e 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 3b 20 23 20              ; # 
04c0: 53 65 74 20 6f 70 65 72 61 74 69 6f 6e 73 2e 0a  Set operations..
04d0: 70 61 63 6b 61 67 65 20 72 65 71 75 69 72 65 20  package require 
04e0: 76 63 3a 3a 74 6f 6f 6c 73 3a 3a 6d 69 73 63 20  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 3b 20 23 20 4d 69            ; # Mi
0510: 6e 2c 20 6d 61 78 2e 0a 70 61 63 6b 61 67 65 20  n, max..package 
0520: 72 65 71 75 69 72 65 20 76 63 3a 3a 74 6f 6f 6c  require vc::tool
0530: 73 3a 3a 6c 6f 67 20 20 20 20 20 20 20 20 20 20  s::log          
0540: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
0550: 20 20 3b 20 23 20 55 73 65 72 20 66 65 65 64 62    ; # User feedb
0560: 61 63 6b 2e 0a 70 61 63 6b 61 67 65 20 72 65 71  ack..package req
0570: 75 69 72 65 20 76 63 3a 3a 74 6f 6f 6c 73 3a 3a  uire vc::tools::
0580: 74 72 6f 75 62 6c 65 20 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 3b                 ;
05a0: 20 23 20 45 72 72 6f 72 20 72 65 70 6f 72 74 69   # Error reporti
05b0: 6e 67 2e 0a 70 61 63 6b 61 67 65 20 72 65 71 75  ng..package requ
05c0: 69 72 65 20 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a  ire vc::fossil::
05d0: 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 72 65 70  import::cvs::rep
05e0: 6f 73 69 74 6f 72 79 20 20 20 20 20 20 20 3b 20  ository       ; 
05f0: 23 20 52 65 70 6f 73 69 74 6f 72 79 20 6d 61 6e  # Repository man
0600: 61 67 65 6d 65 6e 74 2e 0a 70 61 63 6b 61 67 65  agement..package
0610: 20 72 65 71 75 69 72 65 20 76 63 3a 3a 66 6f 73   require vc::fos
0620: 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73  sil::import::cvs
0630: 3a 3a 63 79 63 6c 65 62 72 65 61 6b 65 72 20 20  ::cyclebreaker  
0640: 20 20 20 3b 20 23 20 42 72 65 61 6b 69 6e 67 20     ; # Breaking 
0650: 64 65 70 65 6e 64 65 6e 63 79 20 63 79 63 6c 65  dependency cycle
0660: 73 2e 0a 70 61 63 6b 61 67 65 20 72 65 71 75 69  s..package requi
0670: 72 65 20 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69  re vc::fossil::i
0680: 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 73 74 61 74  mport::cvs::stat
0690: 65 20 20 20 20 20 20 20 20 20 20 20 20 3b 20 23  e            ; #
06a0: 20 53 74 61 74 65 20 73 74 6f 72 61 67 65 2e 0a   State storage..
06b0: 70 61 63 6b 61 67 65 20 72 65 71 75 69 72 65 20  package require 
06c0: 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f  vc::fossil::impo
06d0: 72 74 3a 3a 63 76 73 3a 3a 69 6e 74 65 67 72 69  rt::cvs::integri
06e0: 74 79 20 20 20 20 20 20 20 20 3b 20 23 20 53 74  ty        ; # St
06f0: 61 74 65 20 69 6e 74 65 67 72 69 74 79 20 63 68  ate integrity ch
0700: 65 63 6b 73 2e 0a 70 61 63 6b 61 67 65 20 72 65  ecks..package re
0710: 71 75 69 72 65 20 76 63 3a 3a 66 6f 73 73 69 6c  quire vc::fossil
0720: 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 70  ::import::cvs::p
0730: 72 6f 6a 65 63 74 3a 3a 72 65 76 20 20 20 20 20  roject::rev     
0740: 3b 20 23 20 50 72 6f 6a 65 63 74 20 6c 65 76 65  ; # Project leve
0750: 6c 20 63 68 61 6e 67 65 73 65 74 73 0a 0a 23 20  l changesets..# 
0760: 23 20 23 23 20 23 23 23 20 23 23 23 23 23 20 23  # ## ### ##### #
0770: 23 23 23 23 23 23 23 20 23 23 23 23 23 23 23 23  ####### ########
0780: 23 23 23 23 23 20 23 23 23 23 23 23 23 23 23 23  ##### ##########
0790: 23 23 23 23 23 23 23 23 23 23 23 0a 23 23 20 52  ###########.## R
07a0: 65 67 69 73 74 65 72 20 74 68 65 20 70 61 73 73  egister the pass
07b0: 20 77 69 74 68 20 74 68 65 20 6d 61 6e 61 67 65   with the manage
07c0: 6d 65 6e 74 0a 0a 76 63 3a 3a 66 6f 73 73 69 6c  ment..vc::fossil
07d0: 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 70  ::import::cvs::p
07e0: 61 73 73 20 64 65 66 69 6e 65 20 5c 0a 20 20 20  ass define \.   
07f0: 20 42 72 65 61 6b 41 6c 6c 43 73 65 74 43 79 63   BreakAllCsetCyc
0800: 6c 65 73 20 5c 0a 20 20 20 20 7b 42 72 65 61 6b  les \.    {Break
0810: 20 52 65 6d 61 69 6e 69 6e 67 20 43 68 61 6e 67   Remaining Chang
0820: 65 53 65 74 20 44 65 70 65 6e 64 65 6e 63 79 20  eSet Dependency 
0830: 43 79 63 6c 65 73 7d 20 5c 0a 20 20 20 20 3a 3a  Cycles} \.    ::
0840: 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f  vc::fossil::impo
0850: 72 74 3a 3a 63 76 73 3a 3a 70 61 73 73 3a 3a 62  rt::cvs::pass::b
0860: 72 65 61 6b 61 63 79 63 6c 65 0a 0a 23 20 23 20  reakacycle..# # 
0870: 23 23 20 23 23 23 20 23 23 23 23 23 20 23 23 23  ## ### ##### ###
0880: 23 23 23 23 23 20 23 23 23 23 23 23 23 23 23 23  ##### ##########
0890: 23 23 23 20 23 23 23 23 23 23 23 23 23 23 23 23  ### ############
08a0: 23 23 23 23 23 23 23 23 23 0a 23 23 0a 0a 73 6e  #########.##..sn
08b0: 69 74 3a 3a 74 79 70 65 20 3a 3a 76 63 3a 3a 66  it::type ::vc::f
08c0: 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63  ossil::import::c
08d0: 76 73 3a 3a 70 61 73 73 3a 3a 62 72 65 61 6b 61  vs::pass::breaka
08e0: 63 79 63 6c 65 20 7b 0a 20 20 20 20 23 20 23 20  cycle {.    # # 
08f0: 23 23 20 23 23 23 20 23 23 23 23 23 20 23 23 23  ## ### ##### ###
0900: 23 23 23 23 23 20 23 23 23 23 23 23 23 23 23 23  ##### ##########
0910: 23 23 23 0a 20 20 20 20 23 23 20 50 75 62 6c 69  ###.    ## Publi
0920: 63 20 41 50 49 0a 0a 20 20 20 20 74 79 70 65 6d  c API..    typem
0930: 65 74 68 6f 64 20 73 65 74 75 70 20 7b 7d 20 7b  ethod setup {} {
0940: 0a 09 23 20 44 65 66 69 6e 65 20 74 68 65 20 6e  ..# Define the n
0950: 61 6d 65 73 20 61 6e 64 20 73 74 72 75 63 74 75  ames and structu
0960: 72 65 20 6f 66 20 74 68 65 20 70 65 72 73 69 73  re of the persis
0970: 74 65 6e 74 20 73 74 61 74 65 20 6f 66 0a 09 23  tent state of..#
0980: 20 74 68 69 73 20 70 61 73 73 2e 0a 0a 09 73 74   this pass....st
0990: 61 74 65 20 75 73 65 20 72 65 76 69 73 69 6f 6e  ate use revision
09a0: 0a 09 73 74 61 74 65 20 75 73 65 20 74 61 67 0a  ..state use tag.
09b0: 09 73 74 61 74 65 20 75 73 65 20 62 72 61 6e 63  .state use branc
09c0: 68 0a 09 73 74 61 74 65 20 75 73 65 20 73 79 6d  h..state use sym
09d0: 62 6f 6c 0a 09 73 74 61 74 65 20 75 73 65 20 63  bol..state use c
09e0: 68 61 6e 67 65 73 65 74 0a 09 73 74 61 74 65 20  hangeset..state 
09f0: 75 73 65 20 63 73 69 74 65 6d 0a 09 73 74 61 74  use csitem..stat
0a00: 65 20 75 73 65 20 63 73 73 75 63 63 65 73 73 6f  e use cssuccesso
0a10: 72 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a  r..return.    }.
0a20: 0a 20 20 20 20 74 79 70 65 6d 65 74 68 6f 64 20  .    typemethod 
0a30: 6c 6f 61 64 20 7b 7d 20 7b 0a 09 23 20 50 61 73  load {} {..# Pas
0a40: 73 20 6d 61 6e 61 67 65 72 20 69 6e 74 65 72 66  s manager interf
0a50: 61 63 65 2e 20 45 78 65 63 75 74 65 64 20 74 6f  ace. Executed to
0a60: 20 6c 6f 61 64 20 64 61 74 61 20 63 6f 6d 70 75   load data compu
0a70: 74 65 64 20 62 79 0a 09 23 20 74 68 69 73 20 70  ted by..# this p
0a80: 61 73 73 20 69 6e 74 6f 20 6d 65 6d 6f 72 79 20  ass into memory 
0a90: 77 68 65 6e 20 74 68 69 73 20 70 61 73 73 20 69  when this pass i
0aa0: 73 20 73 6b 69 70 70 65 64 20 69 6e 73 74 65 61  s skipped instea
0ab0: 64 20 6f 66 0a 09 23 20 65 78 65 63 75 74 65 64  d of..# executed
0ac0: 2e 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a  ...return.    }.
0ad0: 0a 20 20 20 20 74 79 70 65 6d 65 74 68 6f 64 20  .    typemethod 
0ae0: 72 75 6e 20 7b 7d 20 7b 0a 09 23 20 50 61 73 73  run {} {..# Pass
0af0: 20 6d 61 6e 61 67 65 72 20 69 6e 74 65 72 66 61   manager interfa
0b00: 63 65 2e 20 45 78 65 63 75 74 65 64 20 74 6f 20  ce. Executed to 
0b10: 70 65 72 66 6f 72 6d 20 74 68 65 0a 09 23 20 66  perform the..# f
0b20: 75 6e 63 74 69 6f 6e 61 6c 69 74 79 20 6f 66 20  unctionality of 
0b30: 74 68 65 20 70 61 73 73 2e 0a 0a 09 73 65 74 20  the pass....set 
0b40: 6c 65 6e 20 5b 73 74 72 69 6e 67 20 6c 65 6e 67  len [string leng
0b50: 74 68 20 5b 70 72 6f 6a 65 63 74 3a 3a 72 65 76  th [project::rev
0b60: 20 6e 75 6d 5d 5d 0a 09 73 65 74 20 6d 79 61 74   num]]..set myat
0b70: 66 6d 74 20 25 24 7b 6c 65 6e 7d 73 0a 09 69 6e  fmt %${len}s..in
0b80: 63 72 20 6c 65 6e 20 31 32 0a 09 73 65 74 20 6d  cr len 12..set m
0b90: 79 63 73 66 6d 74 20 25 24 7b 6c 65 6e 7d 73 0a  ycsfmt %${len}s.
0ba0: 0a 09 63 79 63 6c 65 62 72 65 61 6b 65 72 20 70  ..cyclebreaker p
0bb0: 72 65 63 6d 64 20 20 20 5b 6d 79 70 72 6f 63 20  recmd   [myproc 
0bc0: 42 72 65 61 6b 42 61 63 6b 77 61 72 64 5d 0a 09  BreakBackward]..
0bd0: 63 79 63 6c 65 62 72 65 61 6b 65 72 20 73 61 76  cyclebreaker sav
0be0: 65 63 6d 64 20 20 5b 6d 79 70 72 6f 63 20 4b 65  ecmd  [myproc Ke
0bf0: 65 70 4f 72 64 65 72 5d 0a 0a 09 73 74 61 74 65  epOrder]...state
0c00: 20 74 72 61 6e 73 61 63 74 69 6f 6e 20 7b 0a 09   transaction {..
0c10: 20 20 20 20 4c 6f 61 64 43 6f 6d 6d 69 74 4f 72      LoadCommitOr
0c20: 64 65 72 0a 09 20 20 20 20 63 79 63 6c 65 62 72  der..    cyclebr
0c30: 65 61 6b 65 72 20 72 75 6e 20 62 72 65 61 6b 2d  eaker run break-
0c40: 61 6c 6c 20 5b 6d 79 70 72 6f 63 20 43 68 61 6e  all [myproc Chan
0c50: 67 65 73 65 74 73 5d 0a 09 7d 0a 0a 09 72 65 70  gesets]..}...rep
0c60: 6f 73 69 74 6f 72 79 20 70 72 69 6e 74 63 73 65  ository printcse
0c70: 74 73 74 61 74 69 73 74 69 63 73 0a 09 69 6e 74  tstatistics..int
0c80: 65 67 72 69 74 79 20 63 68 61 6e 67 65 73 65 74  egrity changeset
0c90: 73 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a  s..return.    }.
0ca0: 0a 20 20 20 20 74 79 70 65 6d 65 74 68 6f 64 20  .    typemethod 
0cb0: 64 69 73 63 61 72 64 20 7b 7d 20 7b 0a 09 23 20  discard {} {..# 
0cc0: 50 61 73 73 20 6d 61 6e 61 67 65 72 20 69 6e 74  Pass manager int
0cd0: 65 72 66 61 63 65 2e 20 45 78 65 63 75 74 65 64  erface. Executed
0ce0: 20 66 6f 72 20 61 6c 6c 20 70 61 73 73 65 73 20   for all passes 
0cf0: 61 66 74 65 72 20 74 68 65 0a 09 23 20 72 75 6e  after the..# run
0d00: 20 70 61 73 73 65 73 2c 20 74 6f 20 72 65 6d 6f   passes, to remo
0d10: 76 65 20 61 6c 6c 20 64 61 74 61 20 6f 66 20 74  ve all data of t
0d20: 68 69 73 20 70 61 73 73 20 66 72 6f 6d 20 74 68  his pass from th
0d30: 65 20 73 74 61 74 65 2c 0a 09 23 20 61 73 20 62  e state,..# as b
0d40: 65 69 6e 67 20 6f 75 74 20 6f 66 20 64 61 74 65  eing out of date
0d50: 2e 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a  ...return.    }.
0d60: 0a 20 20 20 20 23 20 23 20 23 23 20 23 23 23 20  .    # # ## ### 
0d70: 23 23 23 23 23 20 23 23 23 23 23 23 23 23 20 23  ##### ######## #
0d80: 23 23 23 23 23 23 23 23 23 23 23 23 0a 20 20 20  ############.   
0d90: 20 23 23 20 49 6e 74 65 72 6e 61 6c 20 6d 65 74   ## Internal met
0da0: 68 6f 64 73 0a 0a 20 20 20 20 70 72 6f 63 20 43  hods..    proc C
0db0: 68 61 6e 67 65 73 65 74 73 20 7b 7d 20 7b 0a 09  hangesets {} {..
0dc0: 6c 6f 67 20 77 72 69 74 65 20 32 20 62 72 65 61  log write 2 brea
0dd0: 6b 72 63 79 63 6c 65 20 7b 53 65 6c 65 63 74 69  krcycle {Selecti
0de0: 6e 67 20 61 6c 6c 20 63 68 61 6e 67 65 73 65 74  ng all changeset
0df0: 73 7d 0a 09 72 65 74 75 72 6e 20 5b 70 72 6f 6a  s}..return [proj
0e00: 65 63 74 3a 3a 72 65 76 20 61 6c 6c 5d 0a 20 20  ect::rev all].  
0e10: 20 20 7d 0a 0a 20 20 20 20 70 72 6f 63 20 4c 6f    }..    proc Lo
0e20: 61 64 43 6f 6d 6d 69 74 4f 72 64 65 72 20 7b 7d  adCommitOrder {}
0e30: 20 7b 0a 09 3a 3a 76 61 72 69 61 62 6c 65 20 6d   {..::variable m
0e40: 79 63 73 65 74 0a 09 3a 3a 76 61 72 69 61 62 6c  ycset..::variabl
0e50: 65 20 6d 79 72 65 76 69 73 69 6f 6e 63 68 61 6e  e myrevisionchan
0e60: 67 65 73 65 74 73 0a 0a 09 6c 6f 67 20 77 72 69  gesets...log wri
0e70: 74 65 20 32 20 62 72 65 61 6b 61 63 79 63 6c 65  te 2 breakacycle
0e80: 20 7b 4c 6f 61 64 69 6e 67 20 72 65 76 69 73 69   {Loading revisi
0e90: 6f 6e 20 63 6f 6d 6d 69 74 20 6f 72 64 65 72 7d  on commit order}
0ea0: 0a 0a 09 73 65 74 20 6e 20 30 0a 09 73 74 61 74  ...set n 0..stat
0eb0: 65 20 74 72 61 6e 73 61 63 74 69 6f 6e 20 7b 0a  e transaction {.
0ec0: 09 20 20 20 20 73 74 61 74 65 20 66 6f 72 65 61  .    state forea
0ed0: 63 68 72 6f 77 20 7b 0a 09 09 53 45 4c 45 43 54  chrow {...SELECT
0ee0: 20 63 69 64 2c 20 70 6f 73 20 46 52 4f 4d 20 63   cid, pos FROM c
0ef0: 73 6f 72 64 65 72 0a 09 20 20 20 20 7d 20 7b 0a  sorder..    } {.
0f00: 09 09 6c 6f 67 20 70 72 6f 67 72 65 73 73 20 32  ..log progress 2
0f10: 20 62 72 65 61 6b 61 63 79 63 6c 65 20 24 6e 20   breakacycle $n 
0f20: 7b 7d 0a 09 09 73 65 74 20 63 73 65 74 20 5b 70  {}...set cset [p
0f30: 72 6f 6a 65 63 74 3a 3a 72 65 76 20 6f 66 20 24  roject::rev of $
0f40: 63 69 64 5d 0a 09 09 24 63 73 65 74 20 73 65 74  cid]...$cset set
0f50: 70 6f 73 20 24 70 6f 73 0a 09 09 73 65 74 20 6d  pos $pos...set m
0f60: 79 63 73 65 74 28 24 70 6f 73 29 20 24 63 73 65  ycset($pos) $cse
0f70: 74 0a 09 09 6c 61 70 70 65 6e 64 20 6d 79 72 65  t...lappend myre
0f80: 76 69 73 69 6f 6e 63 68 61 6e 67 65 73 65 74 73  visionchangesets
0f90: 20 24 63 73 65 74 0a 09 09 69 6e 63 72 20 6e 0a   $cset...incr n.
0fa0: 09 20 20 20 20 7d 0a 09 7d 0a 09 72 65 74 75 72  .    }..}..retur
0fb0: 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 23 20 23  n.    }..    # #
0fc0: 20 23 23 20 23 23 23 20 23 23 23 23 23 20 23 23   ## ### ##### ##
0fd0: 23 23 23 23 23 23 20 23 23 23 23 23 23 23 23 23  ###### #########
0fe0: 23 23 23 23 0a 0a 20 20 20 20 70 72 6f 63 20 42  ####..    proc B
0ff0: 72 65 61 6b 42 61 63 6b 77 61 72 64 20 7b 67 72  reakBackward {gr
1000: 61 70 68 7d 20 7b 0a 09 23 20 57 65 20 67 6f 20  aph} {..# We go 
1010: 6f 76 65 72 20 61 6c 6c 20 62 72 61 6e 63 68 20  over all branch 
1020: 63 68 61 6e 67 65 73 65 74 73 2c 20 69 2e 65 2e  changesets, i.e.
1030: 20 74 68 65 20 63 68 61 6e 67 65 73 65 74 73 0a   the changesets.
1040: 09 23 20 63 72 65 61 74 65 64 20 62 79 20 74 68  .# created by th
1050: 65 20 73 79 6d 62 6f 6c 73 20 77 68 69 63 68 20  e symbols which 
1060: 61 72 65 20 74 72 61 6e 73 6c 61 74 65 64 20 61  are translated a
1070: 73 20 62 72 61 6e 63 68 65 73 2c 20 61 6e 64 0a  s branches, and.
1080: 09 23 20 62 72 65 61 6b 20 61 6e 79 20 77 68 69  .# break any whi
1090: 63 68 20 61 72 65 20 27 62 61 63 6b 77 61 72 64  ch are 'backward
10a0: 27 2c 20 77 68 69 63 68 20 6d 65 61 6e 73 20 74  ', which means t
10b0: 68 61 74 20 74 68 65 79 20 68 61 76 65 0a 09 23  hat they have..#
10c0: 20 61 74 20 6c 65 61 73 74 20 6f 6e 65 20 69 6e   at least one in
10d0: 63 6f 6d 69 6e 67 20 72 65 76 69 73 69 6f 6e 20  coming revision 
10e0: 63 68 61 6e 67 65 73 65 74 20 77 68 69 63 68 20  changeset which 
10f0: 69 73 20 63 6f 6d 6d 69 74 74 65 64 0a 09 23 20  is committed..# 
1100: 61 66 74 65 72 20 61 74 20 6c 65 61 73 74 20 6f  after at least o
1110: 6e 65 20 6f 66 20 74 68 65 20 6f 75 74 67 6f 69  ne of the outgoi
1120: 6e 67 20 72 65 76 69 73 69 6f 6e 20 63 68 61 6e  ng revision chan
1130: 67 65 73 65 74 73 2c 20 70 65 72 0a 09 23 20 74  gesets, per..# t
1140: 68 65 20 6f 72 64 65 72 20 63 6f 6d 70 75 74 65  he order compute
1150: 64 20 69 6e 20 70 61 73 73 20 36 2e 20 49 6e 20  d in pass 6. In 
1160: 22 63 76 73 32 73 76 6e 22 20 74 68 69 73 20 69  "cvs2svn" this i
1170: 73 20 63 61 6c 6c 65 64 0a 09 23 20 22 72 65 74  s called..# "ret
1180: 72 6f 67 72 61 64 65 22 2e 0a 0a 09 73 65 74 20  rograde"....set 
1190: 6e 20 30 0a 09 73 65 74 20 6d 61 78 20 5b 6c 6c  n 0..set max [ll
11a0: 65 6e 67 74 68 20 5b 24 67 72 61 70 68 20 6e 6f  ength [$graph no
11b0: 64 65 73 5d 5d 0a 09 66 6f 72 65 61 63 68 20 63  des]]..foreach c
11c0: 73 65 74 20 5b 24 67 72 61 70 68 20 6e 6f 64 65  set [$graph node
11d0: 73 5d 20 7b 0a 09 20 20 20 20 6c 6f 67 20 70 72  s] {..    log pr
11e0: 6f 67 72 65 73 73 20 32 20 62 72 65 61 6b 61 63  ogress 2 breakac
11f0: 79 63 6c 65 20 24 6e 20 24 6d 61 78 20 3b 20 69  ycle $n $max ; i
1200: 6e 63 72 20 6e 0a 09 20 20 20 20 69 66 20 7b 21  ncr n..    if {!
1210: 5b 24 63 73 65 74 20 69 73 62 72 61 6e 63 68 5d  [$cset isbranch]
1220: 7d 20 63 6f 6e 74 69 6e 75 65 0a 09 20 20 20 20  } continue..    
1230: 43 68 65 63 6b 41 6e 64 42 72 65 61 6b 42 61 63  CheckAndBreakBac
1240: 6b 77 61 72 64 20 24 67 72 61 70 68 20 24 63 73  kward $graph $cs
1250: 65 74 0a 09 7d 0a 09 72 65 74 75 72 6e 0a 20 20  et..}..return.  
1260: 20 20 7d 0a 0a 20 20 20 20 70 72 6f 63 20 43 68    }..    proc Ch
1270: 65 63 6b 41 6e 64 42 72 65 61 6b 42 61 63 6b 77  eckAndBreakBackw
1280: 61 72 64 20 7b 67 72 61 70 68 20 63 73 65 74 7d  ard {graph cset}
1290: 20 7b 0a 09 77 68 69 6c 65 20 7b 5b 49 73 42 61   {..while {[IsBa
12a0: 63 6b 77 61 72 64 20 24 67 72 61 70 68 20 24 63  ckward $graph $c
12b0: 73 65 74 5d 7d 20 7b 0a 09 20 20 20 20 23 20 4b  set]} {..    # K
12c0: 6e 6f 77 69 6e 67 20 74 68 61 74 20 74 68 65 20  nowing that the 
12d0: 62 72 61 6e 63 68 20 63 68 61 6e 67 65 73 65 74  branch changeset
12e0: 20 69 73 20 62 61 63 6b 77 61 72 64 20 77 65 20   is backward we 
12f0: 6e 6f 77 0a 09 20 20 20 20 23 20 6c 6f 6f 6b 20  now..    # look 
1300: 61 74 20 74 68 65 20 69 6e 64 69 76 69 64 75 61  at the individua
1310: 6c 20 62 72 61 6e 63 68 65 73 20 69 6e 20 74 68  l branches in th
1320: 65 20 63 68 61 6e 67 65 73 65 74 20 61 6e 64 0a  e changeset and.
1330: 09 20 20 20 20 23 20 64 65 74 65 72 6d 69 6e 65  .    # determine
1340: 20 77 68 69 63 68 20 6f 66 20 74 68 65 6d 20 61   which of them a
1350: 72 65 20 72 65 73 70 6f 6e 73 69 62 6c 65 20 66  re responsible f
1360: 6f 72 20 74 68 65 0a 09 20 20 20 20 23 20 6f 76  or the..    # ov
1370: 65 72 6c 61 70 2e 20 54 68 69 73 20 61 6c 6c 6f  erlap. This allo
1380: 77 73 20 75 73 20 74 6f 20 73 70 6c 69 74 20 74  ws us to split t
1390: 68 65 6d 20 69 6e 74 6f 20 74 77 6f 20 73 65 74  hem into two set
13a0: 73 2c 20 6f 6e 65 0a 09 20 20 20 20 23 20 6f 66  s, one..    # of
13b0: 20 6e 6f 6e 2d 6f 76 65 72 6c 61 70 70 69 6e 67   non-overlapping
13c0: 20 62 72 61 6e 63 68 65 73 2c 20 61 6e 64 20 6f   branches, and o
13d0: 66 20 6f 76 65 72 6c 61 70 70 69 6e 67 0a 09 20  f overlapping.. 
13e0: 20 20 20 23 20 6f 6e 65 73 2e 20 45 61 63 68 20     # ones. Each 
13f0: 73 65 74 20 69 6e 64 75 63 65 73 20 61 20 6e 65  set induces a ne
1400: 77 20 63 68 61 6e 67 65 73 65 74 2c 20 61 6e 64  w changeset, and
1410: 20 74 68 65 20 73 65 63 6f 6e 64 0a 09 20 20 20   the second..   
1420: 20 23 20 6f 6e 65 20 6d 61 79 20 73 74 69 6c 6c   # one may still
1430: 20 62 65 20 62 61 63 6b 77 61 72 64 20 61 6e 64   be backward and
1440: 20 69 6e 20 6e 65 65 64 20 6f 66 20 66 75 72 74   in need of furt
1450: 68 65 72 0a 09 20 20 20 20 23 20 73 70 6c 69 74  her..    # split
1460: 74 69 6e 67 2e 20 48 65 6e 63 65 20 74 68 65 20  ting. Hence the 
1470: 6c 6f 6f 70 69 6e 67 2e 0a 0a 09 20 20 20 20 23  looping....    #
1480: 20 54 68 65 20 62 6f 72 64 65 72 20 75 73 65 64   The border used
1490: 20 66 6f 72 20 74 68 65 20 73 70 6c 69 74 20 69   for the split i
14a0: 73 20 74 68 65 20 6d 69 6e 69 6d 61 6c 20 63 6f  s the minimal co
14b0: 6d 6d 69 74 0a 09 20 20 20 20 23 20 70 6f 73 69  mmit..    # posi
14c0: 74 69 6f 6e 20 61 6d 6f 6e 67 20 74 68 65 20 6d  tion among the m
14d0: 69 6e 69 6d 61 6c 20 73 75 63 65 73 73 6f 72 20  inimal sucessor 
14e0: 63 6f 6d 6d 69 74 20 70 6f 73 69 74 69 6f 6e 73  commit positions
14f0: 20 66 6f 72 0a 09 20 20 20 20 23 20 74 68 65 20   for..    # the 
1500: 62 72 61 6e 63 68 65 73 20 69 6e 20 74 68 65 20  branches in the 
1510: 63 68 61 6e 67 65 73 65 74 2e 20 20 57 65 20 73  changeset.  We s
1520: 6f 72 74 20 74 68 65 20 66 69 6c 65 20 6c 65 76  ort the file lev
1530: 65 6c 0a 09 20 20 20 20 23 20 69 74 65 6d 73 20  el..    # items 
1540: 62 61 73 65 64 20 6f 6e 20 74 68 65 72 65 20 74  based on there t
1550: 68 65 79 20 73 69 74 20 72 65 6c 61 74 69 76 65  hey sit relative
1560: 20 74 6f 20 74 68 65 20 62 6f 72 64 65 72 0a 09   to the border..
1570: 20 20 20 20 23 20 69 6e 74 6f 20 62 65 66 6f 72      # into befor
1580: 65 20 61 6e 64 20 61 66 74 65 72 20 74 68 65 20  e and after the 
1590: 62 6f 72 64 65 72 2e 20 41 73 20 74 68 65 20 62  border. As the b
15a0: 72 61 6e 63 68 65 73 20 63 61 6e 6e 6f 74 0a 09  ranches cannot..
15b0: 20 20 20 20 23 20 62 65 20 62 61 63 6b 77 61 72      # be backwar
15c0: 64 20 61 74 20 66 69 6c 65 20 6c 65 76 65 6c 20  d at file level 
15d0: 74 68 6f 73 20 62 65 66 6f 72 65 20 74 68 65 20  thos before the 
15e0: 62 6f 72 64 65 72 20 63 61 6e 6e 6f 74 0a 09 20  border cannot.. 
15f0: 20 20 20 23 20 67 65 6e 65 72 61 74 65 20 61 20     # generate a 
1600: 62 61 63 6b 77 61 72 64 20 73 79 6d 62 6f 6c 20  backward symbol 
1610: 63 68 61 6e 67 65 73 65 74 2c 20 68 6f 77 65 76  changeset, howev
1620: 65 72 20 74 68 65 0a 09 20 20 20 20 23 20 62 72  er the..    # br
1630: 61 6e 63 68 65 73 20 61 66 74 65 72 20 6d 61 79  anches after may
1640: 20 63 6f 6e 73 74 69 74 75 74 65 20 61 6e 6f 74   constitute anot
1650: 68 65 72 20 62 61 63 6b 77 61 72 64 20 62 72 61  her backward bra
1660: 6e 63 68 0a 09 20 20 20 20 23 20 77 69 74 68 20  nch..    # with 
1670: 61 20 6e 65 77 20 62 6f 72 64 65 72 2e 0a 0a 09  a new border....
1680: 20 20 20 20 23 20 6c 69 6d 69 74 73 20 3a 20 64      # limits : d
1690: 69 63 74 20 28 72 65 76 69 73 69 6f 6e 20 2d 3e  ict (revision ->
16a0: 20 6c 69 73 74 20 28 6d 61 78 20 70 72 65 64 65   list (max prede
16b0: 63 65 73 73 6f 72 20 63 6f 6d 6d 69 74 2c 20 6d  cessor commit, m
16c0: 69 6e 20 73 75 63 65 73 73 6f 72 20 63 6f 6d 6d  in sucessor comm
16d0: 69 74 29 29 0a 0a 09 20 20 20 20 43 6f 6d 70 75  it))...    Compu
16e0: 74 65 4c 69 6d 69 74 73 20 24 63 73 65 74 20 6c  teLimits $cset l
16f0: 69 6d 69 74 73 20 62 6f 72 64 65 72 0a 0a 09 20  imits border... 
1700: 20 20 20 6c 6f 67 20 77 72 69 74 65 20 35 20 62     log write 5 b
1710: 72 65 61 6b 61 63 79 63 6c 65 20 22 42 72 65 61  reakacycle "Brea
1720: 6b 69 6e 67 20 62 61 63 6b 77 61 72 64 20 63 68  king backward ch
1730: 61 6e 67 65 73 65 74 20 5b 24 63 73 65 74 20 73  angeset [$cset s
1740: 74 72 5d 20 75 73 69 6e 67 20 63 6f 6d 6d 69 74  tr] using commit
1750: 20 70 6f 73 69 74 69 6f 6e 20 24 62 6f 72 64 65   position $borde
1760: 72 20 61 73 20 62 6f 72 64 65 72 22 0a 0a 09 20  r as border"... 
1770: 20 20 20 53 70 6c 69 74 49 74 65 6d 73 20 24 6c     SplitItems $l
1780: 69 6d 69 74 73 20 24 62 6f 72 64 65 72 20 6e 6f  imits $border no
1790: 72 6d 61 6c 69 74 65 6d 73 20 62 61 63 6b 77 61  rmalitems backwa
17a0: 72 64 69 74 65 6d 73 0a 0a 09 20 20 20 20 73 65  rditems...    se
17b0: 74 20 72 65 70 6c 61 63 65 6d 65 6e 74 73 20 5b  t replacements [
17c0: 70 72 6f 6a 65 63 74 3a 3a 72 65 76 20 73 70 6c  project::rev spl
17d0: 69 74 20 24 63 73 65 74 20 24 6e 6f 72 6d 61 6c  it $cset $normal
17e0: 69 74 65 6d 73 20 24 62 61 63 6b 77 61 72 64 69  items $backwardi
17f0: 74 65 6d 73 5d 0a 09 20 20 20 20 63 79 63 6c 65  tems]..    cycle
1800: 62 72 65 61 6b 65 72 20 72 65 70 6c 61 63 65 20  breaker replace 
1810: 24 67 72 61 70 68 20 24 63 73 65 74 20 24 72 65  $graph $cset $re
1820: 70 6c 61 63 65 6d 65 6e 74 73 0a 0a 09 20 20 20  placements...   
1830: 20 23 20 41 74 20 6c 61 73 74 20 77 65 20 63 68   # At last we ch
1840: 65 63 6b 20 74 68 61 74 20 74 68 65 20 6e 6f 72  eck that the nor
1850: 6d 61 6c 20 66 72 61 6d 65 6e 74 20 69 73 20 69  mal frament is i
1860: 6e 64 65 65 64 20 6e 6f 74 0a 09 20 20 20 20 23  ndeed not..    #
1870: 20 62 61 63 6b 77 61 72 64 2c 20 61 6e 64 20 69   backward, and i
1880: 74 65 72 61 74 65 20 6f 76 65 72 20 74 68 65 20  terate over the 
1890: 70 6f 73 73 69 62 6c 79 20 73 74 69 6c 6c 20 62  possibly still b
18a0: 61 63 6b 77 61 72 64 0a 09 20 20 20 20 23 20 73  ackward..    # s
18b0: 65 63 6f 6e 64 20 66 72 61 67 6d 65 6e 74 2e 0a  econd fragment..
18c0: 0a 09 20 20 20 20 73 74 72 75 63 74 3a 3a 6c 69  ..    struct::li
18d0: 73 74 20 61 73 73 69 67 6e 20 24 72 65 70 6c 61  st assign $repla
18e0: 63 65 6d 65 6e 74 73 20 6e 6f 72 6d 61 6c 20 62  cements normal b
18f0: 61 63 6b 77 61 72 64 0a 09 20 20 20 20 69 6e 74  ackward..    int
1900: 65 67 72 69 74 79 20 61 73 73 65 72 74 20 7b 0a  egrity assert {.
1910: 09 09 21 5b 49 73 42 61 63 6b 77 61 72 64 20 24  ..![IsBackward $
1920: 67 72 61 70 68 20 24 6e 6f 72 6d 61 6c 5d 0a 09  graph $normal]..
1930: 20 20 20 20 7d 20 7b 54 68 65 20 6e 6f 72 6d 61      } {The norma
1940: 6c 20 66 72 61 67 6d 65 6e 74 20 69 73 20 75 6e  l fragment is un
1950: 65 78 70 65 63 74 65 64 6c 79 20 62 61 63 6b 77  expectedly backw
1960: 61 72 64 7d 0a 0a 09 20 20 20 20 73 65 74 20 63  ard}...    set c
1970: 73 65 74 20 24 62 61 63 6b 77 61 72 64 0a 09 7d  set $backward..}
1980: 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a  ..return.    }..
1990: 20 20 20 20 70 72 6f 63 20 49 73 42 61 63 6b 77      proc IsBackw
19a0: 61 72 64 20 7b 64 67 20 63 73 65 74 7d 20 7b 0a  ard {dg cset} {.
19b0: 09 23 20 41 20 62 72 61 6e 63 68 20 69 73 20 22  .# A branch is "
19c0: 62 61 63 6b 77 61 72 64 22 20 69 66 20 69 74 20  backward" if it 
19d0: 68 61 73 20 61 74 20 6c 65 61 73 74 20 6f 6e 65  has at least one
19e0: 20 69 6e 63 6f 6d 69 6e 67 0a 09 23 20 72 65 76   incoming..# rev
19f0: 69 73 69 6f 6e 20 63 68 61 6e 67 65 73 65 74 20  ision changeset 
1a00: 77 68 69 63 68 20 69 73 20 63 6f 6d 6d 69 74 74  which is committ
1a10: 65 64 20 61 66 74 65 72 20 61 74 20 6c 65 61 73  ed after at leas
1a20: 74 20 6f 6e 65 20 6f 66 0a 09 23 20 74 68 65 20  t one of..# the 
1a30: 6f 75 74 67 6f 69 6e 67 20 72 65 76 69 73 69 6f  outgoing revisio
1a40: 6e 20 63 68 61 6e 67 65 73 65 74 73 2c 20 70 65  n changesets, pe
1a50: 72 20 74 68 65 20 6f 72 64 65 72 20 63 6f 6d 70  r the order comp
1a60: 75 74 65 64 20 62 79 0a 09 23 20 70 61 73 73 20  uted by..# pass 
1a70: 36 2e 0a 0a 09 23 20 52 65 70 68 72 61 73 65 64  6....# Rephrased
1a80: 2c 20 74 68 65 20 6d 61 78 69 6d 61 6c 20 63 6f  , the maximal co
1a90: 6d 6d 69 74 20 70 6f 73 69 74 69 6f 6e 20 66 6f  mmit position fo
1aa0: 75 6e 64 20 61 6d 6f 6e 67 20 74 68 65 0a 09 23  und among the..#
1ab0: 20 69 6e 63 6f 6d 69 6e 67 20 72 65 76 69 73 69   incoming revisi
1ac0: 6f 6e 20 63 68 61 6e 67 65 73 65 74 73 20 69 73  on changesets is
1ad0: 20 6c 61 72 67 65 72 20 74 68 61 6e 20 74 68 65   larger than the
1ae0: 20 6d 69 6e 69 6d 61 6c 0a 09 23 20 63 6f 6d 6d   minimal..# comm
1af0: 69 74 20 70 6f 73 69 74 69 6f 6e 20 66 6f 75 6e  it position foun
1b00: 64 20 61 6d 6f 6e 67 20 74 68 65 20 6f 75 74 67  d among the outg
1b10: 6f 69 6e 67 20 72 65 76 69 73 69 6f 6e 0a 09 23  oing revision..#
1b20: 20 63 68 61 6e 67 65 73 65 74 73 2e 20 41 73 73   changesets. Ass
1b30: 75 6d 69 6e 67 20 74 68 61 74 20 77 65 20 68 61  uming that we ha
1b40: 76 65 20 62 6f 74 68 20 69 6e 63 6f 6d 69 6e 67  ve both incoming
1b50: 20 61 6e 64 20 6f 75 74 67 6f 69 6e 67 0a 09 23   and 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 20 66 6f 72 20 74 68 65 20 62 72 61  sets for the bra
1b80: 6e 63 68 2e 0a 0a 09 23 20 54 68 65 20 68 65 6c  nch....# The hel
1b90: 70 65 72 20 22 50 6f 73 69 74 69 6f 6e 73 22 20  per "Positions" 
1ba0: 63 6f 6d 70 75 74 65 73 20 74 68 65 20 73 65 74  computes the set
1bb0: 20 6f 66 20 63 6f 6d 6d 69 74 20 70 6f 73 69 74   of commit posit
1bc0: 69 6f 6e 73 0a 09 23 20 66 6f 72 20 61 20 73 65  ions..# for a se
1bd0: 74 20 6f 66 20 63 68 61 6e 67 65 73 65 74 73 2c  t of changesets,
1be0: 20 77 68 69 63 68 20 63 61 6e 20 62 65 20 61 20   which can be a 
1bf0: 6d 69 78 20 6f 66 20 72 65 76 69 73 69 6f 6e 20  mix of revision 
1c00: 61 6e 64 0a 09 23 20 73 79 6d 62 6f 6c 20 63 68  and..# symbol ch
1c10: 61 6e 67 65 73 65 74 73 2e 0a 0a 09 73 65 74 20  angesets....set 
1c20: 70 72 65 64 65 63 65 73 73 6f 72 73 20 5b 50 6f  predecessors [Po
1c30: 73 69 74 69 6f 6e 73 20 5b 24 64 67 20 6e 6f 64  sitions [$dg nod
1c40: 65 73 20 2d 69 6e 20 20 24 63 73 65 74 5d 5d 0a  es -in  $cset]].
1c50: 09 73 65 74 20 73 75 63 63 65 73 73 6f 72 73 20  .set successors 
1c60: 20 20 5b 50 6f 73 69 74 69 6f 6e 73 20 5b 24 64    [Positions [$d
1c70: 67 20 6e 6f 64 65 73 20 2d 6f 75 74 20 24 63 73  g nodes -out $cs
1c80: 65 74 5d 5d 0a 0a 09 72 65 74 75 72 6e 20 5b 65  et]]...return [e
1c90: 78 70 72 20 7b 0a 09 09 20 20 20 20 20 20 5b 6c  xpr {...      [l
1ca0: 6c 65 6e 67 74 68 20 24 70 72 65 64 65 63 65 73  length $predeces
1cb0: 73 6f 72 73 5d 20 26 26 0a 09 09 20 20 20 20 20  sors] &&...     
1cc0: 20 5b 6c 6c 65 6e 67 74 68 20 24 73 75 63 63 65   [llength $succe
1cd0: 73 73 6f 72 73 5d 20 20 20 26 26 0a 09 09 20 20  ssors]   &&...  
1ce0: 20 20 20 20 28 5b 6d 61 78 20 24 70 72 65 64 65      ([max $prede
1cf0: 63 65 73 73 6f 72 73 5d 20 3e 3d 20 5b 6d 69 6e  cessors] >= [min
1d00: 20 24 73 75 63 63 65 73 73 6f 72 73 5d 29 0a 09   $successors])..
1d10: 09 20 20 7d 5d 0a 20 20 20 20 7d 0a 0a 20 20 20  .  }].    }..   
1d20: 20 70 72 6f 63 20 50 6f 73 69 74 69 6f 6e 73 20   proc Positions 
1d30: 7b 63 68 61 6e 67 65 73 65 74 73 7d 20 7b 0a 09  {changesets} {..
1d40: 23 20 54 6f 20 63 6f 6d 70 75 74 65 20 74 68 65  # To compute the
1d50: 20 73 65 74 20 6f 66 20 63 6f 6d 6d 69 74 20 70   set of commit p
1d60: 6f 73 69 74 69 6f 6e 73 20 66 72 6f 6d 20 74 68  ositions from th
1d70: 65 20 73 65 74 20 6f 66 0a 09 23 20 63 68 61 6e  e set of..# chan
1d80: 67 65 73 65 74 73 20 77 65 20 66 69 72 73 74 20  gesets we first 
1d90: 6d 61 70 20 65 61 63 68 20 63 68 61 6e 67 65 73  map each changes
1da0: 65 74 20 74 6f 20 69 74 73 20 70 6f 73 69 74 69  et to its positi
1db0: 6f 6e 20 28 2a 29 0a 09 23 20 61 6e 64 20 74 68  on (*)..# and th
1dc0: 65 6e 20 66 69 6c 74 65 72 20 6f 75 74 20 74 68  en filter out th
1dd0: 65 20 69 6e 76 61 6c 69 64 20 72 65 73 70 6f 6e  e invalid respon
1de0: 73 65 73 20 28 74 68 65 20 65 6d 70 74 79 20 73  ses (the empty s
1df0: 74 72 69 6e 67 29 0a 09 23 20 72 65 74 75 72 6e  tring)..# return
1e00: 65 64 20 62 79 20 74 68 65 20 73 79 6d 62 6f 6c  ed by the symbol
1e10: 20 63 68 61 6e 67 65 73 65 74 73 2e 0a 09 23 0a   changesets...#.
1e20: 09 23 20 28 2a 29 20 54 68 69 73 20 64 61 74 61  .# (*) This data
1e30: 20 77 61 73 20 6c 6f 61 64 65 64 20 69 6e 74 6f   was loaded into
1e40: 20 6d 65 6d 6f 72 79 20 65 61 72 6c 69 72 20 69   memory earlir i
1e50: 6e 20 74 68 65 20 70 61 73 73 2c 20 62 79 0a 09  n the pass, by..
1e60: 23 20 20 20 20 20 4c 6f 61 64 43 6f 6d 6d 69 74  #     LoadCommit
1e70: 4f 72 64 65 72 2e 0a 0a 09 72 65 74 75 72 6e 20  Order....return 
1e80: 5b 73 74 72 75 63 74 3a 3a 6c 69 73 74 20 66 69  [struct::list fi
1e90: 6c 74 65 72 20 5b 73 74 72 75 63 74 3a 3a 6c 69  lter [struct::li
1ea0: 73 74 20 6d 61 70 20 24 63 68 61 6e 67 65 73 65  st map $changese
1eb0: 74 73 20 5c 0a 09 09 09 09 09 20 5b 6d 79 70 72  ts \...... [mypr
1ec0: 6f 63 20 54 6f 50 6f 73 69 74 69 6f 6e 5d 5d 20  oc ToPosition]] 
1ed0: 5c 0a 09 09 20 20 20 20 5b 6d 79 70 72 6f 63 20  \...    [myproc 
1ee0: 56 61 6c 69 64 50 6f 73 69 74 69 6f 6e 5d 5d 0a  ValidPosition]].
1ef0: 20 20 20 20 7d 0a 0a 20 20 20 20 70 72 6f 63 20      }..    proc 
1f00: 54 6f 50 6f 73 69 74 69 6f 6e 20 20 20 20 7b 63  ToPosition    {c
1f10: 73 65 74 7d 20 7b 20 24 63 73 65 74 20 70 6f 73  set} { $cset pos
1f20: 20 7d 0a 20 20 20 20 70 72 6f 63 20 56 61 6c 69   }.    proc Vali
1f30: 64 50 6f 73 69 74 69 6f 6e 20 7b 70 6f 73 7d 20  dPosition {pos} 
1f40: 20 7b 20 65 78 70 72 20 7b 24 70 6f 73 20 6e 65   { expr {$pos ne
1f50: 20 22 22 7d 20 7d 0a 0a 20 20 20 20 70 72 6f 63   ""} }..    proc
1f60: 20 43 6f 6d 70 75 74 65 4c 69 6d 69 74 73 20 7b   ComputeLimits {
1f70: 63 73 65 74 20 6c 76 20 62 76 7d 20 7b 0a 09 75  cset lv bv} {..u
1f80: 70 76 61 72 20 31 20 24 6c 76 20 74 68 65 6c 69  pvar 1 $lv theli
1f90: 6d 69 74 73 20 24 62 76 20 62 6f 72 64 65 72 0a  mits $bv border.
1fa0: 0a 09 23 20 49 6e 64 69 76 69 64 75 61 6c 20 62  ..# Individual b
1fb0: 72 61 6e 63 68 65 73 20 6d 61 79 20 6e 6f 74 20  ranches may not 
1fc0: 68 61 76 65 20 72 65 76 69 73 69 6f 6e 20 63 68  have revision ch
1fd0: 61 6e 67 65 73 65 74 73 20 77 68 69 63 68 0a 09  angesets which..
1fe0: 23 20 61 72 65 20 74 68 65 69 72 20 70 72 65 64  # are their pred
1ff0: 65 63 65 73 73 6f 72 73 20 61 6e 64 2f 6f 72 20  ecessors and/or 
2000: 73 75 63 63 65 73 73 6f 72 73 2c 20 6c 65 61 76  successors, leav
2010: 69 6e 67 20 74 68 65 20 6c 69 6d 69 74 73 0a 09  ing the limits..
2020: 23 20 70 61 72 74 69 61 6c 6c 79 20 6f 72 20 63  # partially or c
2030: 6f 6d 70 6c 65 74 65 6c 79 20 75 6e 64 65 66 69  ompletely undefi
2040: 6e 65 64 2e 20 54 6f 20 6f 76 65 72 63 6f 6d 65  ned. To overcome
2050: 20 74 68 69 73 0a 09 23 20 69 6e 69 74 69 61 6c   this..# initial
2060: 69 7a 65 20 62 6f 75 6e 64 61 72 69 65 73 20 66  ize boundaries f
2070: 6f 72 20 61 6c 6c 20 69 74 65 6d 73 20 77 69 74  or all items wit
2080: 68 20 70 72 6f 70 65 72 20 64 65 66 61 75 6c 74  h proper default
2090: 73 20 28 2d 31 0a 09 23 20 66 6f 72 20 6d 61 78  s (-1..# for max
20a0: 2c 20 7b 7d 20 66 6f 72 20 6d 69 6e 2c 20 72 65  , {} for min, re
20b0: 70 72 65 73 65 6e 74 69 6e 67 20 2b 69 6e 66 69  presenting +infi
20c0: 6e 69 74 79 29 2e 0a 0a 09 61 72 72 61 79 20 73  nity)....array s
20d0: 65 74 20 6d 61 78 70 61 20 7b 7d 0a 09 61 72 72  et maxpa {}..arr
20e0: 61 79 20 73 65 74 20 6d 69 6e 73 61 20 7b 7d 0a  ay set minsa {}.
20f0: 09 66 6f 72 65 61 63 68 20 69 74 65 6d 20 5b 24  .foreach item [$
2100: 63 73 65 74 20 69 74 65 6d 73 5d 20 7b 0a 09 20  cset items] {.. 
2110: 20 20 20 73 65 74 20 6d 61 78 70 61 28 24 69 74     set maxpa($it
2120: 65 6d 29 20 2d 31 0a 09 20 20 20 20 73 65 74 20  em) -1..    set 
2130: 6d 69 6e 73 61 28 24 69 74 65 6d 29 20 7b 7d 0a  minsa($item) {}.
2140: 09 7d 0a 0a 09 23 20 47 65 74 20 74 68 65 20 6c  .}...# Get the l
2150: 69 6d 69 74 73 20 66 72 6f 6d 20 74 68 65 20 64  imits from the d
2160: 61 74 61 62 61 73 65 2c 20 66 6f 72 20 74 68 65  atabase, for the
2170: 20 69 74 65 6d 73 20 77 68 69 63 68 0a 09 23 20   items which..# 
2180: 61 63 74 75 61 6c 6c 79 20 68 61 76 65 20 73 75  actually have su
2190: 63 68 2c 20 61 6e 64 20 6d 65 72 67 65 20 74 68  ch, and merge th
21a0: 65 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 77 69  e information wi
21b0: 74 68 20 74 68 65 0a 09 23 20 64 65 66 61 75 6c  th the..# defaul
21c0: 74 73 2e 0a 0a 09 73 74 72 75 63 74 3a 3a 6c 69  ts....struct::li
21d0: 73 74 20 61 73 73 69 67 6e 20 5b 24 63 73 65 74  st assign [$cset
21e0: 20 6c 69 6d 69 74 73 5d 20 6d 61 78 70 64 69 63   limits] maxpdic
21f0: 74 20 6d 69 6e 73 64 69 63 74 0a 0a 09 61 72 72  t minsdict...arr
2200: 61 79 20 73 65 74 20 6d 61 78 70 61 20 24 6d 61  ay set maxpa $ma
2210: 78 70 64 69 63 74 0a 09 61 72 72 61 79 20 73 65  xpdict..array se
2220: 74 20 6d 69 6e 73 61 20 24 6d 69 6e 73 64 69 63  t minsa $minsdic
2230: 74 0a 0a 09 23 20 43 68 65 63 6b 20 74 68 61 74  t...# Check that
2240: 20 74 68 65 20 6f 72 64 65 72 69 6e 67 20 61 74   the ordering at
2250: 20 74 68 65 20 66 69 6c 65 20 6c 65 76 65 6c 20   the file level 
2260: 69 73 20 63 6f 72 72 65 63 74 2e 20 57 65 0a 09  is correct. We..
2270: 23 20 63 61 6e 6e 6f 74 20 68 61 76 65 20 62 61  # cannot have ba
2280: 63 6b 77 61 72 64 20 6f 72 64 65 72 69 6e 67 20  ckward ordering 
2290: 70 65 72 20 62 72 61 6e 63 68 2c 20 6f 72 20 73  per branch, or s
22a0: 6f 6d 65 74 68 69 6e 67 20 69 73 0a 09 23 20 77  omething is..# w
22b0: 72 6f 6e 67 2e 0a 0a 09 66 6f 72 65 61 63 68 20  rong....foreach 
22c0: 69 74 65 6d 20 5b 61 72 72 61 79 20 6e 61 6d 65  item [array name
22d0: 73 20 6c 69 6d 69 74 73 5d 20 7b 0a 09 20 20 20  s limits] {..   
22e0: 20 73 65 74 20 6d 69 6e 73 20 24 6d 69 6e 73 61   set mins $minsa
22f0: 28 24 69 74 65 6d 29 0a 09 20 20 20 20 73 65 74  ($item)..    set
2300: 20 6d 61 78 70 20 24 6d 61 78 70 28 24 69 74 65   maxp $maxp($ite
2310: 6d 29 0a 09 20 20 20 20 23 20 4e 6f 74 65 20 74  m)..    # Note t
2320: 68 61 74 20 66 6f 72 20 74 68 65 20 6d 69 6e 20  hat for the min 
2330: 73 75 63 63 65 73 73 6f 72 20 70 6f 73 69 74 69  successor positi
2340: 6f 6e 20 22 22 20 72 65 70 72 65 73 65 6e 74 73  on "" represents
2350: 0a 09 20 20 20 20 23 20 2b 69 6e 66 69 6e 69 74  ..    # +infinit
2360: 79 0a 09 20 20 20 20 69 6e 74 65 67 72 69 74 79  y..    integrity
2370: 20 61 73 73 65 72 74 20 7b 0a 09 09 28 24 6d 69   assert {...($mi
2380: 6e 73 20 65 71 20 22 22 29 20 7c 7c 20 28 24 6d  ns eq "") || ($m
2390: 61 78 70 20 3c 20 24 6d 69 6e 73 29 20 0a 09 20  axp < $mins) .. 
23a0: 20 20 20 7d 20 7b 49 74 65 6d 20 3c 24 69 74 65     } {Item <$ite
23b0: 6d 3e 20 69 73 20 62 61 63 6b 77 61 72 64 20 61  m> is backward a
23c0: 74 20 66 69 6c 65 20 6c 65 76 65 6c 20 28 24 6d  t file level ($m
23d0: 61 78 70 20 3e 3d 20 24 6d 69 6e 73 29 7d 0a 09  axp >= $mins)}..
23e0: 7d 0a 0a 09 23 20 53 61 76 65 20 74 68 65 20 6c  }...# Save the l
23f0: 69 6d 69 74 73 20 66 6f 72 20 74 68 65 20 73 70  imits for the sp
2400: 6c 69 74 74 65 72 2c 20 61 6e 64 20 63 6f 6d 70  litter, and comp
2410: 75 74 65 20 74 68 65 20 62 6f 72 64 65 72 20 61  ute the border a
2420: 74 0a 09 23 20 77 68 69 63 68 20 74 6f 20 73 70  t..# which to sp
2430: 6c 69 74 20 61 73 20 74 68 65 20 6d 69 6e 69 6d  lit as the minim
2440: 75 6d 20 6f 66 20 61 6c 6c 20 6d 69 6e 69 6d 61  um of all minima
2450: 6c 20 73 75 63 63 65 73 73 6f 72 0a 09 23 20 70  l successor..# p
2460: 6f 73 69 74 69 6f 6e 73 2e 0a 0a 09 23 20 43 6f  ositions....# Co
2470: 6d 70 75 74 65 20 74 68 65 20 62 6f 72 64 65 72  mpute the border
2480: 20 61 74 20 77 68 69 63 68 20 74 6f 20 73 70 6c   at which to spl
2490: 69 74 20 61 73 20 74 68 65 20 6d 69 6e 69 6d 75  it as the minimu
24a0: 6d 20 6f 66 20 61 6c 6c 0a 09 23 20 6d 69 6e 69  m of all..# mini
24b0: 6d 61 6c 20 73 75 63 63 65 73 73 6f 72 20 70 6f  mal successor po
24c0: 73 69 74 69 6f 6e 73 2e 20 42 79 20 75 73 69 6e  sitions. By usin
24d0: 67 20 74 68 65 20 64 61 74 61 62 61 73 65 20 69  g the database i
24e0: 6e 66 6f 20 77 65 0a 09 23 20 61 75 74 6f 6d 61  nfo we..# automa
24f0: 74 69 63 61 6c 6c 79 2f 69 6d 70 6c 69 63 69 74  tically/implicit
2500: 6c 79 20 66 69 6c 74 65 72 20 6f 75 74 20 61 6e  ly filter out an
2510: 79 74 68 69 6e 67 20 77 69 74 68 6f 75 74 20 61  ything without a
2520: 20 6d 69 6e 0a 09 23 20 73 75 63 63 65 73 73 6f   min..# successo
2530: 72 2e 20 46 75 72 74 68 65 72 20 74 68 65 20 64  r. Further the d
2540: 61 74 61 20 67 6f 69 6e 67 20 69 6e 74 6f 20 74  ata going into t
2550: 68 65 20 63 6f 6d 70 61 72 69 73 6f 6e 20 77 69  he comparison wi
2560: 74 68 0a 09 23 20 74 68 65 20 62 6f 72 64 65 72  th..# the border
2570: 20 69 73 20 70 75 74 20 74 6f 67 65 74 68 65 72   is put together
2580: 2e 0a 0a 09 73 65 74 20 62 6f 72 64 65 72 20 20  ....set border  
2590: 20 20 5b 6d 69 6e 20 5b 56 61 6c 75 65 73 20 24    [min [Values $
25a0: 6d 69 6e 73 64 69 63 74 5d 5d 0a 09 73 65 74 20  minsdict]]..set 
25b0: 74 68 65 6c 69 6d 69 74 73 20 5b 61 72 72 61 79  thelimits [array
25c0: 20 67 65 74 20 6d 61 78 70 61 5d 0a 09 72 65 74   get maxpa]..ret
25d0: 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 70  urn.    }..    p
25e0: 72 6f 63 20 56 61 6c 75 65 73 20 7b 64 69 63 74  roc Values {dict
25f0: 7d 20 7b 0a 09 73 65 74 20 72 65 73 20 7b 7d 0a  } {..set res {}.
2600: 09 66 6f 72 65 61 63 68 20 7b 6b 20 76 7d 20 24  .foreach {k v} $
2610: 64 69 63 74 20 7b 20 6c 61 70 70 65 6e 64 20 72  dict { lappend r
2620: 65 73 20 24 76 20 7d 0a 09 72 65 74 75 72 6e 20  es $v }..return 
2630: 24 72 65 73 0a 20 20 20 20 7d 0a 0a 20 20 20 20  $res.    }..    
2640: 70 72 6f 63 20 53 70 6c 69 74 49 74 65 6d 73 20  proc SplitItems 
2650: 7b 6c 69 6d 69 74 73 20 62 6f 72 64 65 72 20 6e  {limits border n
2660: 76 20 62 76 7d 20 7b 0a 09 75 70 76 61 72 20 31  v bv} {..upvar 1
2670: 20 24 6e 76 20 6e 6f 72 6d 61 6c 69 74 65 6d 73   $nv normalitems
2680: 20 24 62 76 20 62 61 63 6b 77 61 72 64 69 74 65   $bv backwardite
2690: 6d 73 0a 0a 09 73 65 74 20 6e 6f 72 6d 61 6c 69  ms...set normali
26a0: 74 65 6d 73 20 20 20 7b 7d 0a 09 73 65 74 20 62  tems   {}..set b
26b0: 61 63 6b 77 61 72 64 69 74 65 6d 73 20 7b 7d 0a  ackwarditems {}.
26c0: 0a 09 66 6f 72 65 61 63 68 20 7b 69 74 65 6d 20  ..foreach {item 
26d0: 6d 61 78 70 7d 20 24 6c 69 6d 69 74 73 20 7b 0a  maxp} $limits {.
26e0: 09 20 20 20 20 69 66 20 7b 24 6d 61 78 70 20 3e  .    if {$maxp >
26f0: 3d 20 24 62 6f 72 64 65 72 7d 20 7b 0a 09 09 6c  = $border} {...l
2700: 61 70 70 65 6e 64 20 62 61 63 6b 77 61 72 64 69  append backwardi
2710: 74 65 6d 73 20 24 69 74 65 6d 0a 09 20 20 20 20  tems $item..    
2720: 7d 20 65 6c 73 65 20 7b 0a 09 09 6c 61 70 70 65  } else {...lappe
2730: 6e 64 20 6e 6f 72 6d 61 6c 69 74 65 6d 73 20 20  nd normalitems  
2740: 20 24 69 74 65 6d 0a 09 20 20 20 20 7d 0a 09 7d   $item..    }..}
2750: 0a 0a 09 69 6e 74 65 67 72 69 74 79 20 61 73 73  ...integrity ass
2760: 65 72 74 20 7b 5b 6c 6c 65 6e 67 74 68 20 24 6e  ert {[llength $n
2770: 6f 72 6d 61 6c 69 74 65 6d 73 5d 7d 20 20 20 7b  ormalitems]}   {
2780: 53 65 74 20 6f 66 20 6e 6f 72 6d 61 6c 20 69 74  Set of normal it
2790: 65 6d 73 20 69 73 20 65 6d 70 74 79 7d 0a 09 69  ems is empty}..i
27a0: 6e 74 65 67 72 69 74 79 20 61 73 73 65 72 74 20  ntegrity assert 
27b0: 7b 5b 6c 6c 65 6e 67 74 68 20 24 62 61 63 6b 77  {[llength $backw
27c0: 61 72 64 69 74 65 6d 73 5d 7d 20 7b 53 65 74 20  arditems]} {Set 
27d0: 6f 66 20 62 61 63 6b 77 61 72 64 20 69 74 65 6d  of backward item
27e0: 73 20 69 73 20 65 6d 70 74 79 7d 0a 09 72 65 74  s is empty}..ret
27f0: 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 23  urn.    }..    #
2800: 20 23 20 23 23 20 23 23 23 20 23 23 23 23 23 20   # ## ### ##### 
2810: 23 23 23 23 23 23 23 23 20 23 23 23 23 23 23 23  ######## #######
2820: 23 23 23 23 23 23 0a 0a 20 20 20 20 70 72 6f 63  ######..    proc
2830: 20 4b 65 65 70 4f 72 64 65 72 20 7b 67 72 61 70   KeepOrder {grap
2840: 68 20 61 74 20 63 73 65 74 7d 20 7b 0a 09 3a 3a  h at cset} {..::
2850: 76 61 72 69 61 62 6c 65 20 6d 79 61 74 66 6d 74  variable myatfmt
2860: 0a 09 3a 3a 76 61 72 69 61 62 6c 65 20 6d 79 63  ..::variable myc
2870: 73 66 6d 74 0a 0a 09 73 65 74 20 63 69 64 20 5b  sfmt...set cid [
2880: 24 63 73 65 74 20 69 64 5d 0a 0a 09 6c 6f 67 20  $cset id]...log 
2890: 77 72 69 74 65 20 38 20 62 72 65 61 6b 61 63 79  write 8 breakacy
28a0: 63 6c 65 20 22 43 68 61 6e 67 65 73 65 74 20 40  cle "Changeset @
28b0: 20 5b 66 6f 72 6d 61 74 20 24 6d 79 61 74 66 6d   [format $myatfm
28c0: 74 20 24 61 74 5d 3a 20 5b 66 6f 72 6d 61 74 20  t $at]: [format 
28d0: 24 6d 79 63 73 66 6d 74 20 5b 24 63 73 65 74 20  $mycsfmt [$cset 
28e0: 73 74 72 5d 5d 20 3c 3c 5b 46 6f 72 6d 61 74 54  str]] <<[FormatT
28f0: 52 20 24 67 72 61 70 68 20 24 63 73 65 74 5d 3e  R $graph $cset]>
2900: 3e 22 0a 0a 09 23 20 57 65 20 73 65 65 20 68 65  >"...# We see he
2910: 72 65 20 61 20 6d 69 78 74 75 72 65 20 6f 66 20  re a mixture of 
2920: 73 79 6d 62 6f 6c 20 61 6e 64 20 72 65 76 69 73  symbol and revis
2930: 69 6f 6e 20 63 68 61 6e 67 65 73 65 74 73 2e 0a  ion changesets..
2940: 09 23 20 54 68 65 20 73 79 6d 62 6f 6c 20 63 68  .# The symbol ch
2950: 61 6e 67 65 73 65 74 73 20 61 72 65 20 69 67 6e  angesets are ign
2960: 6f 72 65 64 20 61 73 20 69 72 72 65 6c 65 76 61  ored as irreleva
2970: 6e 74 2e 0a 0a 09 69 66 20 7b 5b 24 63 73 65 74  nt....if {[$cset
2980: 20 70 6f 73 5d 20 65 71 20 22 22 7d 20 72 65 74   pos] eq ""} ret
2990: 75 72 6e 0a 0a 09 23 20 46 6f 72 20 74 68 65 20  urn...# For the 
29a0: 72 65 76 69 73 69 6f 6e 20 63 68 61 6e 67 65 73  revision changes
29b0: 65 74 73 20 77 65 20 61 72 65 20 73 75 72 65 20  ets we are sure 
29c0: 74 68 61 74 20 74 68 65 79 20 61 72 65 0a 09 23  that they are..#
29d0: 20 63 6f 6e 73 75 6d 65 64 20 69 6e 20 74 68 65   consumed in the
29e0: 20 73 61 6d 65 20 6f 72 64 65 72 20 61 73 20 67   same order as g
29f0: 65 6e 65 72 61 74 65 64 20 62 79 20 70 61 73 73  enerated by pass
2a00: 20 37 0a 09 23 20 28 52 65 76 54 6f 70 6f 6c 6f   7..# (RevTopolo
2a10: 67 69 63 61 6c 53 6f 72 74 29 2e 20 50 65 72 20  gicalSort). Per 
2a20: 74 68 65 20 63 6f 64 65 20 69 6e 20 63 76 73 32  the code in cvs2
2a30: 73 76 6e 2e 0a 0a 09 23 20 54 68 69 73 20 77 6f  svn....# This wo
2a40: 72 6b 73 20 69 66 20 61 6e 64 20 6f 6e 6c 79 20  rks if and only 
2a50: 69 66 20 6e 6f 6e 65 20 6f 66 20 74 68 65 20 73  if none of the s
2a60: 79 6d 62 6f 6c 20 63 68 61 6e 67 65 73 65 74 73  ymbol changesets
2a70: 20 61 72 65 0a 09 23 20 22 62 61 63 6b 77 61 72   are..# "backwar
2a80: 64 73 22 2c 20 68 65 6e 63 65 20 6f 75 72 20 62  ds", hence our b
2a90: 72 65 61 6b 69 6e 67 20 6f 66 20 74 68 65 20 62  reaking of the b
2aa0: 61 63 6b 77 61 72 64 20 63 68 61 6e 67 65 73 65  ackward changese
2ab0: 74 73 0a 09 23 20 66 69 72 73 74 2c 20 69 6e 20  ts..# first, in 
2ac0: 74 68 65 20 70 72 65 2d 68 6f 6f 6b 2e 0a 0a 09  the pre-hook....
2ad0: 23 20 4e 6f 74 65 20 74 68 61 74 20 74 61 68 20  # Note that tah 
2ae0: 63 68 61 6e 67 65 73 65 74 73 20 63 61 6e 6e 6f  changesets canno
2af0: 74 20 62 65 20 62 61 63 6b 77 61 72 64 20 61 73  t be backward as
2b00: 20 74 68 65 79 20 64 6f 6e 27 74 0a 09 23 20 68   they don't..# h
2b10: 61 76 65 20 73 75 63 63 65 73 73 6f 72 73 20 61  ave successors a
2b20: 74 20 61 6c 6c 2e 0a 0a 09 23 20 41 6e 20 69 6e  t all....# An in
2b30: 74 65 72 65 73 74 69 6e 67 20 74 68 69 6e 67 20  teresting thing 
2b40: 49 4d 48 4f 2c 20 69 73 20 74 68 61 74 20 61 66  IMHO, is that af
2b50: 74 65 72 20 62 72 65 61 6b 69 6e 67 20 74 68 65  ter breaking the
2b60: 0a 09 23 20 62 61 63 6b 77 61 72 64 20 73 79 6d  ..# backward sym
2b70: 62 6f 6c 20 63 68 61 6e 67 65 73 65 74 73 20 77  bol changesets w
2b80: 65 20 73 68 6f 75 6c 64 20 6e 6f 74 20 68 61 76  e should not hav
2b90: 65 20 61 6e 79 20 63 69 72 63 6c 65 73 0a 09 23  e any circles..#
2ba0: 20 61 6e 79 20 6c 6f 6e 67 65 72 2e 20 45 61 63   any longer. Eac
2bb0: 68 20 63 69 72 63 6c 65 20 77 68 69 63 68 20 77  h circle which w
2bc0: 6f 75 6c 64 20 73 74 69 6c 6c 20 62 65 20 70 72  ould still be pr
2bd0: 65 73 65 6e 74 20 68 61 73 20 74 6f 0a 09 23 20  esent has to..# 
2be0: 69 6e 76 6f 6c 76 65 20 61 20 62 61 63 6b 77 61  involve a backwa
2bf0: 72 64 20 73 79 6d 62 6f 6c 2c 20 61 6e 64 20 77  rd symbol, and w
2c00: 65 20 73 70 6c 69 74 20 74 68 65 6d 20 61 6c 6c  e split them all
2c10: 2c 20 73 6f 20 74 68 65 72 65 0a 09 23 20 63 61  , so there..# ca
2c20: 6e 27 74 20 62 65 20 61 20 63 69 72 63 6c 65 2e  n't be a circle.
2c30: 2e 0a 0a 09 23 20 50 72 6f 6f 66 3a 0a 09 23 20  ....# Proof:..# 
2c40: 4c 65 74 20 75 73 20 61 73 73 75 6d 65 20 77 65  Let us assume we
2c50: 20 74 68 61 74 20 68 61 76 65 20 61 20 63 69 72   that have a cir
2c60: 63 6c 65 0a 09 23 20 09 43 3a 20 52 31 20 2d 3e  cle..# .C: R1 ->
2c70: 20 2e 2e 2e 20 2d 3e 20 52 78 20 2d 3e 20 53 20   ... -> Rx -> S 
2c80: 2d 3e 20 52 79 20 2d 3e 20 2e 2e 2e 20 2d 3e 20  -> Ry -> ... -> 
2c90: 52 6e 20 2d 3e 20 52 31 0a 09 23 20 4c 65 74 20  Rn -> R1..# Let 
2ca0: 75 73 20 66 75 72 74 68 65 72 20 61 73 73 75 6d  us further assum
2cb0: 65 20 74 68 61 74 20 74 68 65 20 73 79 6d 62 6f  e that the symbo
2cc0: 6c 20 63 68 61 6e 67 65 73 65 74 20 53 20 69 6e  l changeset S in
2cd0: 20 74 68 61 74 0a 09 23 20 63 69 72 63 6c 65 20   that..# circle 
2ce0: 69 73 20 6e 6f 74 20 62 61 63 6b 77 61 72 64 2e  is not backward.
2cf0: 20 54 68 61 74 20 6d 65 61 6e 73 20 4f 52 44 28   That means ORD(
2d00: 52 78 29 20 3c 20 4f 52 44 28 52 79 29 2e 20 20  Rx) < ORD(Ry).  
2d10: 54 68 65 0a 09 23 20 65 61 72 6c 69 65 72 20 74  The..# earlier t
2d20: 6f 70 6f 6c 6f 67 69 63 61 6c 20 73 6f 72 74 69  opological sorti
2d30: 6e 67 20 77 69 74 68 6f 75 74 20 73 79 6d 62 6f  ng without symbo
2d40: 6c 73 20 6e 6f 77 20 66 6f 72 63 65 73 20 74 68  ls now forces th
2d50: 69 73 0a 09 23 20 72 65 6c 61 74 69 6f 6e 73 68  is..# relationsh
2d60: 69 70 20 74 68 72 6f 75 67 68 20 74 6f 20 62 65  ip through to be
2d70: 20 4f 52 44 28 52 78 29 20 3c 20 4f 52 44 28 52   ORD(Rx) < ORD(R
2d80: 31 29 20 3c 20 4f 52 44 28 52 78 29 2e 20 20 57  1) < ORD(Rx).  W
2d90: 65 0a 09 23 20 68 61 76 65 20 72 65 61 63 68 65  e..# have reache
2da0: 64 20 61 6e 20 69 6d 70 6f 73 73 69 62 69 6c 69  d an impossibili
2db0: 74 79 2c 20 61 20 70 61 72 61 64 6f 78 2e 20 4f  ty, a paradox. O
2dc0: 75 72 20 69 6e 69 74 69 61 6c 0a 09 23 20 61 73  ur initial..# as
2dd0: 73 75 6d 70 74 69 6f 6e 20 6f 66 20 53 20 6e 6f  sumption of S no
2de0: 74 20 62 65 69 6e 67 20 62 61 63 6b 77 61 72 64  t being backward
2df0: 20 63 61 6e 6e 6f 74 20 68 6f 6c 64 2e 0a 09 23   cannot hold...#
2e00: 0a 09 23 20 41 6c 74 65 72 6e 61 74 65 2c 20 64  ..# Alternate, d
2e10: 69 72 65 63 74 2c 20 72 65 61 73 6f 6e 69 6e 67  irect, reasoning
2e20: 3a 20 57 69 74 68 6f 75 74 20 53 20 74 68 65 20  : Without S the 
2e30: 63 68 61 69 6e 20 6f 66 0a 09 23 20 64 65 70 65  chain of..# depe
2e40: 6e 64 65 6e 63 69 65 73 20 69 73 20 52 79 20 2d  ndencies is Ry -
2e50: 3e 20 2e 2e 20 2d 3e 20 52 31 20 2d 3e 20 2e 2e  > .. -> R1 -> ..
2e60: 20 2d 3e 20 52 78 2c 20 74 68 65 72 65 66 6f 72   -> Rx, therefor
2e70: 65 0a 09 23 20 4f 52 44 28 52 79 29 20 3c 20 4f  e..# ORD(Ry) < O
2e80: 52 44 28 52 78 29 20 68 6f 6c 64 73 2c 20 61 6e  RD(Rx) holds, an
2e90: 64 20 74 68 69 73 20 6d 65 61 6e 73 20 53 20 69  d this means S i
2ea0: 73 20 62 61 63 6b 77 61 72 64 2e 0a 0a 09 73 74  s backward....st
2eb0: 72 75 63 74 3a 3a 73 65 74 20 65 78 63 6c 75 64  ruct::set exclud
2ec0: 65 20 6d 79 72 65 76 69 73 69 6f 6e 63 68 61 6e  e myrevisionchan
2ed0: 67 65 73 65 74 73 20 24 63 73 65 74 0a 0a 09 3a  gesets $cset...:
2ee0: 3a 76 61 72 69 61 62 6c 65 20 6d 79 6c 61 73 74  :variable mylast
2ef0: 70 6f 73 0a 09 73 65 74 20 6e 65 77 20 5b 24 63  pos..set new [$c
2f00: 73 65 74 20 70 6f 73 5d 0a 0a 09 69 66 20 7b 24  set pos]...if {$
2f10: 6e 65 77 20 21 3d 20 28 24 6d 79 6c 61 73 74 70  new != ($mylastp
2f20: 6f 73 20 2b 20 31 29 7d 20 7b 0a 09 20 20 20 20  os + 1)} {..    
2f30: 69 66 20 7b 24 6d 79 6c 61 73 74 70 6f 73 20 3c  if {$mylastpos <
2f40: 20 30 7d 20 7b 0a 09 09 73 65 74 20 6f 6c 64 20   0} {...set old 
2f50: 22 3c 4e 4f 4e 45 3e 22 0a 09 20 20 20 20 7d 20  "<NONE>"..    } 
2f60: 65 6c 73 65 20 7b 0a 09 09 3a 3a 76 61 72 69 61  else {...::varia
2f70: 62 6c 65 20 6d 79 63 73 65 74 0a 09 09 73 65 74  ble mycset...set
2f80: 20 6f 6c 64 20 5b 24 6d 79 63 73 65 74 28 24 6d   old [$mycset($m
2f90: 79 6c 61 73 74 70 6f 73 29 20 73 74 72 5d 40 24  ylastpos) str]@$
2fa0: 6d 79 6c 61 73 74 70 6f 73 0a 09 20 20 20 20 7d  mylastpos..    }
2fb0: 0a 0a 09 20 20 20 20 23 69 6e 74 65 67 72 69 74  ...    #integrit
2fc0: 79 20 61 73 73 65 72 74 20 30 20 7b 4f 72 64 65  y assert 0 {Orde
2fd0: 72 69 6e 67 20 6f 66 20 72 65 76 69 73 69 6f 6e  ring of revision
2fe0: 20 63 68 61 6e 67 65 73 65 74 73 20 76 69 6f 6c   changesets viol
2ff0: 61 74 65 64 2c 20 5b 24 63 73 65 74 20 73 74 72  ated, [$cset str
3000: 5d 40 24 6e 65 77 20 69 73 20 6e 6f 74 20 69 6d  ]@$new is not im
3010: 6d 65 64 69 61 74 65 6c 79 20 61 66 74 65 72 20  mediately after 
3020: 24 6f 6c 64 7d 0a 09 20 20 20 20 6c 6f 67 20 77  $old}..    log w
3030: 72 69 74 65 20 32 20 62 72 65 61 6b 61 63 79 63  rite 2 breakacyc
3040: 6c 65 20 7b 4f 72 64 65 72 69 6e 67 20 6f 66 20  le {Ordering of 
3050: 72 65 76 69 73 69 6f 6e 20 63 68 61 6e 67 65 73  revision changes
3060: 65 74 73 20 76 69 6f 6c 61 74 65 64 2c 20 5b 24  ets violated, [$
3070: 63 73 65 74 20 73 74 72 5d 40 24 6e 65 77 20 69  cset str]@$new i
3080: 73 20 6e 6f 74 20 69 6d 6d 65 64 69 61 74 65 6c  s not immediatel
3090: 79 20 61 66 74 65 72 20 24 6f 6c 64 7d 0a 09 7d  y after $old}..}
30a0: 0a 0a 09 73 65 74 20 6d 79 6c 61 73 74 70 6f 73  ...set mylastpos
30b0: 20 24 6e 65 77 0a 09 72 65 74 75 72 6e 0a 20 20   $new..return.  
30c0: 20 20 7d 0a 0a 20 20 20 20 70 72 6f 63 20 46 6f    }..    proc Fo
30d0: 72 6d 61 74 54 52 20 7b 67 72 61 70 68 20 63 73  rmatTR {graph cs
30e0: 65 74 7d 20 7b 0a 09 72 65 74 75 72 6e 20 5b 6a  et} {..return [j
30f0: 6f 69 6e 20 5b 73 74 72 75 63 74 3a 3a 6c 69 73  oin [struct::lis
3100: 74 20 6d 61 70 20 5b 24 67 72 61 70 68 20 6e 6f  t map [$graph no
3110: 64 65 20 73 65 74 20 24 63 73 65 74 20 74 69 6d  de set $cset tim
3120: 65 72 61 6e 67 65 5d 20 7b 63 6c 6f 63 6b 20 66  erange] {clock f
3130: 6f 72 6d 61 74 7d 5d 20 7b 20 2d 2d 20 7d 5d 0a  ormat}] { -- }].
3140: 20 20 20 20 7d 0a 0a 20 20 20 20 74 79 70 65 76      }..    typev
3150: 61 72 69 61 62 6c 65 20 6d 79 6c 61 73 74 70 6f  ariable mylastpo
3160: 73 20 20 20 20 20 20 20 20 20 20 20 20 2d 31 20  s            -1 
3170: 3b 20 23 20 50 6f 73 69 74 69 6f 6e 20 6f 66 20  ; # Position of 
3180: 6c 61 73 74 20 72 65 76 69 73 69 6f 6e 20 63 68  last revision ch
3190: 61 6e 67 65 73 65 74 20 73 61 76 65 64 2e 0a 20  angeset saved.. 
31a0: 20 20 20 74 79 70 65 76 61 72 69 61 62 6c 65 20     typevariable 
31b0: 6d 79 72 65 76 69 73 69 6f 6e 63 68 61 6e 67 65  myrevisionchange
31c0: 73 65 74 73 20 7b 7d 20 3b 20 23 20 53 65 74 20  sets {} ; # Set 
31d0: 6f 66 20 72 65 76 69 73 69 6f 6e 20 63 68 61 6e  of revision chan
31e0: 67 65 73 65 74 73 0a 0a 20 20 20 20 74 79 70 65  gesets..    type
31f0: 76 61 72 69 61 62 6c 65 20 6d 79 61 74 66 6d 74  variable myatfmt
3200: 20 3b 20 23 20 46 6f 72 6d 61 74 20 66 6f 72 20   ; # Format for 
3210: 6c 6f 67 20 6f 75 74 70 75 74 20 74 6f 20 67 61  log output to ga
3220: 69 6e 20 62 65 74 74 65 72 20 61 6c 69 67 6e 6d  in better alignm
3230: 65 6e 74 20 6f 66 20 74 68 65 20 76 61 72 69 6f  ent of the vario
3240: 75 73 20 63 6f 6c 75 6d 6e 73 2e 0a 20 20 20 20  us columns..    
3250: 74 79 70 65 76 61 72 69 61 62 6c 65 20 6d 79 63  typevariable myc
3260: 73 66 6d 74 20 3b 20 23 20 44 69 74 74 6f 20 66  sfmt ; # Ditto f
3270: 6f 72 20 74 68 65 20 63 68 61 6e 67 65 73 65 74  or the changeset
3280: 73 2e 0a 0a 20 20 20 20 23 20 23 20 23 23 20 23  s...    # # ## #
3290: 23 23 20 23 23 23 23 23 20 23 23 23 23 23 23 23  ## ##### #######
32a0: 23 20 23 23 23 23 23 23 23 23 23 23 23 23 23 0a  # #############.
32b0: 0a 20 20 20 20 74 79 70 65 76 61 72 69 61 62 6c  .    typevariabl
32c0: 65 20 6d 79 63 73 65 74 20 2d 61 72 72 61 79 20  e mycset -array 
32d0: 7b 7d 20 3b 20 23 20 4d 61 70 20 66 72 6f 6d 20  {} ; # Map from 
32e0: 63 6f 6d 6d 69 74 20 70 6f 73 69 74 69 6f 6e 73  commit positions
32f0: 20 74 6f 20 74 68 65 0a 09 09 09 09 20 20 20 20   to the.....    
3300: 23 20 63 68 61 6e 67 65 73 65 74 20 28 6f 62 6a  # changeset (obj
3310: 65 63 74 20 72 65 66 29 20 61 74 20 74 68 61 74  ect ref) at that
3320: 0a 09 09 09 09 20 20 20 20 23 20 70 6f 73 69 74  .....    # posit
3330: 69 6f 6e 2e 0a 0a 20 20 20 20 23 20 23 20 23 23  ion...    # # ##
3340: 20 23 23 23 20 23 23 23 23 23 20 23 23 23 23 23   ### ##### #####
3350: 23 23 23 20 23 23 23 23 23 23 23 23 23 23 23 23  ### ############
3360: 23 0a 20 20 20 20 23 23 20 43 6f 6e 66 69 67 75  #.    ## Configu
3370: 72 61 74 69 6f 6e 0a 0a 20 20 20 20 70 72 61 67  ration..    prag
3380: 6d 61 20 2d 68 61 73 69 6e 73 74 61 6e 63 65 73  ma -hasinstances
3390: 20 20 20 6e 6f 20 3b 20 23 20 73 69 6e 67 6c 65     no ; # single
33a0: 74 6f 6e 0a 20 20 20 20 70 72 61 67 6d 61 20 2d  ton.    pragma -
33b0: 68 61 73 74 79 70 65 69 6e 66 6f 20 20 20 20 6e  hastypeinfo    n
33c0: 6f 20 3b 20 23 20 6e 6f 20 69 6e 74 72 6f 73 70  o ; # no introsp
33d0: 65 63 74 69 6f 6e 0a 20 20 20 20 70 72 61 67 6d  ection.    pragm
33e0: 61 20 2d 68 61 73 74 79 70 65 64 65 73 74 72 6f  a -hastypedestro
33f0: 79 20 6e 6f 20 3b 20 23 20 69 6d 6d 6f 72 74 61  y no ; # immorta
3400: 6c 0a 0a 20 20 20 20 23 20 23 20 23 23 20 23 23  l..    # # ## ##
3410: 23 20 23 23 23 23 23 20 23 23 23 23 23 23 23 23  # ##### ########
3420: 20 23 23 23 23 23 23 23 23 23 23 23 23 23 0a 7d   #############.}
3430: 0a 0a 6e 61 6d 65 73 70 61 63 65 20 65 76 61 6c  ..namespace eval
3440: 20 3a 3a 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69   ::vc::fossil::i
3450: 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 70 61 73 73  mport::cvs::pass
3460: 20 7b 0a 20 20 20 20 6e 61 6d 65 73 70 61 63 65   {.    namespace
3470: 20 65 78 70 6f 72 74 20 62 72 65 61 6b 61 63 79   export breakacy
3480: 63 6c 65 0a 20 20 20 20 6e 61 6d 65 73 70 61 63  cle.    namespac
3490: 65 20 65 76 61 6c 20 62 72 65 61 6b 61 63 79 63  e eval breakacyc
34a0: 6c 65 20 7b 0a 09 6e 61 6d 65 73 70 61 63 65 20  le {..namespace 
34b0: 69 6d 70 6f 72 74 20 3a 3a 76 63 3a 3a 66 6f 73  import ::vc::fos
34c0: 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73  sil::import::cvs
34d0: 3a 3a 63 79 63 6c 65 62 72 65 61 6b 65 72 0a 09  ::cyclebreaker..
34e0: 6e 61 6d 65 73 70 61 63 65 20 69 6d 70 6f 72 74  namespace import
34f0: 20 3a 3a 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69   ::vc::fossil::i
3500: 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 72 65 70 6f  mport::cvs::repo
3510: 73 69 74 6f 72 79 0a 09 6e 61 6d 65 73 70 61 63  sitory..namespac
3520: 65 20 69 6d 70 6f 72 74 20 3a 3a 76 63 3a 3a 66  e import ::vc::f
3530: 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63  ossil::import::c
3540: 76 73 3a 3a 73 74 61 74 65 0a 09 6e 61 6d 65 73  vs::state..names
3550: 70 61 63 65 20 69 6d 70 6f 72 74 20 3a 3a 76 63  pace import ::vc
3560: 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 74  ::fossil::import
3570: 3a 3a 63 76 73 3a 3a 69 6e 74 65 67 72 69 74 79  ::cvs::integrity
3580: 0a 09 6e 61 6d 65 73 70 61 63 65 20 65 76 61 6c  ..namespace eval
3590: 20 70 72 6f 6a 65 63 74 20 7b 0a 09 20 20 20 20   project {..    
35a0: 6e 61 6d 65 73 70 61 63 65 20 69 6d 70 6f 72 74  namespace import
35b0: 20 3a 3a 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69   ::vc::fossil::i
35c0: 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 70 72 6f 6a  mport::cvs::proj
35d0: 65 63 74 3a 3a 72 65 76 0a 09 7d 0a 09 6e 61 6d  ect::rev..}..nam
35e0: 65 73 70 61 63 65 20 69 6d 70 6f 72 74 20 3a 3a  espace import ::
35f0: 76 63 3a 3a 74 6f 6f 6c 73 3a 3a 6d 69 73 63 3a  vc::tools::misc:
3600: 3a 2a 0a 09 6e 61 6d 65 73 70 61 63 65 20 69 6d  :*..namespace im
3610: 70 6f 72 74 20 3a 3a 76 63 3a 3a 74 6f 6f 6c 73  port ::vc::tools
3620: 3a 3a 74 72 6f 75 62 6c 65 0a 09 6e 61 6d 65 73  ::trouble..names
3630: 70 61 63 65 20 69 6d 70 6f 72 74 20 3a 3a 76 63  pace import ::vc
3640: 3a 3a 74 6f 6f 6c 73 3a 3a 6c 6f 67 0a 09 6c 6f  ::tools::log..lo
3650: 67 20 72 65 67 69 73 74 65 72 20 62 72 65 61 6b  g register break
3660: 61 63 79 63 6c 65 0a 20 20 20 20 7d 0a 7d 0a 0a  acycle.    }.}..
3670: 23 20 23 20 23 23 20 23 23 23 20 23 23 23 23 23  # # ## ### #####
3680: 20 23 23 23 23 23 23 23 23 20 23 23 23 23 23 23   ######## ######
3690: 23 23 23 23 23 23 23 20 23 23 23 23 23 23 23 23  ####### ########
36a0: 23 23 23 23 23 23 23 23 23 23 23 23 23 0a 23 23  #############.##
36b0: 20 52 65 61 64 79 0a 0a 70 61 63 6b 61 67 65 20   Ready..package 
36c0: 70 72 6f 76 69 64 65 20 76 63 3a 3a 66 6f 73 73  provide vc::foss
36d0: 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a  il::import::cvs:
36e0: 3a 70 61 73 73 3a 3a 62 72 65 61 6b 61 63 79 63  :pass::breakacyc
36f0: 6c 65 20 31 2e 30 0a 72 65 74 75 72 6e 0a        le 1.0.return.