Hex Artifact Content
Not logged in

Artifact 94ee2e3a5d6909a3c06f8ed17083809ace949992:

File tools/cvs2fossil/lib/c2f_pbreakscycle.tcl part of check-in [258366a37a] - Added skeleton files for pass 7, the breaking of dependency cycles over symbol-based changesets. by aku on 2007-11-15 07:17:07.

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 56 49 49 2e 20 54 68 69 73 20 70 61 73 73  s VII. This pass
0210: 20 67 6f 65 73 20 6f 76 65 72 20 74 68 65 20 73   goes over the s
0220: 65 74 20 6f 66 20 73 79 6d 62 6f 6c 20 62 61 73  et of symbol bas
0230: 65 64 20 63 68 61 6e 67 65 73 65 74 73 0a 23 23  ed changesets.##
0240: 20 61 6e 64 20 62 72 65 61 6b 73 20 61 6c 6c 20   and breaks all 
0250: 64 65 70 65 6e 64 65 6e 63 79 20 63 79 63 6c 65  dependency cycle
0260: 73 20 74 68 65 79 20 6d 61 79 20 62 65 20 69 6e  s they may be in
0270: 2e 20 57 65 20 6e 65 65 64 20 61 0a 23 23 20 64  . We need a.## d
0280: 65 70 65 6e 64 65 6e 63 79 20 74 72 65 65 2e 0a  ependency tree..
0290: 0a 23 20 23 20 23 23 20 23 23 23 20 23 23 23 23  .# # ## ### ####
02a0: 23 20 23 23 23 23 23 23 23 23 20 23 23 23 23 23  # ######## #####
02b0: 23 23 23 23 23 23 23 23 20 23 23 23 23 23 23 23  ######## #######
02c0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 0a 23  ##############.#
02d0: 23 20 52 65 71 75 69 72 65 6d 65 6e 74 73 0a 0a  # Requirements..
02e0: 70 61 63 6b 61 67 65 20 72 65 71 75 69 72 65 20  package require 
02f0: 54 63 6c 20 38 2e 34 20 20 20 20 20 20 20 20 20  Tcl 8.4         
0300: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
0310: 20 20 20 20 20 20 20 20 20 20 3b 20 23 20 52 65            ; # Re
0320: 71 75 69 72 65 64 20 72 75 6e 74 69 6d 65 2e 0a  quired runtime..
0330: 70 61 63 6b 61 67 65 20 72 65 71 75 69 72 65 20  package require 
0340: 73 6e 69 74 20 20 20 20 20 20 20 20 20 20 20 20  snit            
0350: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
0360: 20 20 20 20 20 20 20 20 20 20 3b 20 23 20 4f 4f            ; # OO
0370: 20 73 79 73 74 65 6d 2e 0a 70 61 63 6b 61 67 65   system..package
0380: 20 72 65 71 75 69 72 65 20 76 63 3a 3a 74 6f 6f   require vc::too
0390: 6c 73 3a 3a 6c 6f 67 20 20 20 20 20 20 20 20 20  ls::log         
03a0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
03b0: 20 20 20 3b 20 23 20 55 73 65 72 20 66 65 65 64     ; # User feed
03c0: 62 61 63 6b 2e 0a 70 61 63 6b 61 67 65 20 72 65  back..package re
03d0: 71 75 69 72 65 20 76 63 3a 3a 66 6f 73 73 69 6c  quire vc::fossil
03e0: 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 73  ::import::cvs::s
03f0: 74 61 74 65 20 20 20 20 20 20 20 20 20 20 20 20  tate            
0400: 3b 20 23 20 53 74 61 74 65 20 73 74 6f 72 61 67  ; # State storag
0410: 65 2e 0a 0a 23 20 23 20 23 23 20 23 23 23 20 23  e...# # ## ### #
0420: 23 23 23 23 20 23 23 23 23 23 23 23 23 20 23 23  #### ######## ##
0430: 23 23 23 23 23 23 23 23 23 23 23 20 23 23 23 23  ########### ####
0440: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23  ################
0450: 23 0a 23 23 20 52 65 67 69 73 74 65 72 20 74 68  #.## Register th
0460: 65 20 70 61 73 73 20 77 69 74 68 20 74 68 65 20  e pass with the 
0470: 6d 61 6e 61 67 65 6d 65 6e 74 0a 0a 76 63 3a 3a  management..vc::
0480: 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a  fossil::import::
0490: 63 76 73 3a 3a 70 61 73 73 20 64 65 66 69 6e 65  cvs::pass define
04a0: 20 5c 0a 20 20 20 20 42 72 65 61 6b 53 79 6d 43   \.    BreakSymC
04b0: 73 65 74 43 79 63 6c 65 73 20 5c 0a 20 20 20 20  setCycles \.    
04c0: 7b 42 72 65 61 6b 20 53 79 6d 62 6f 6c 20 43 68  {Break Symbol Ch
04d0: 61 6e 67 65 53 65 74 20 44 65 70 65 6e 64 65 6e  angeSet Dependen
04e0: 63 79 20 43 79 63 6c 65 73 7d 20 5c 0a 20 20 20  cy Cycles} \.   
04f0: 20 3a 3a 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69   ::vc::fossil::i
0500: 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 70 61 73 73  mport::cvs::pass
0510: 3a 3a 62 72 65 61 6b 73 63 79 63 6c 65 0a 0a 23  ::breakscycle..#
0520: 20 23 20 23 23 20 23 23 23 20 23 23 23 23 23 20   # ## ### ##### 
0530: 23 23 23 23 23 23 23 23 20 23 23 23 23 23 23 23  ######## #######
0540: 23 23 23 23 23 23 20 23 23 23 23 23 23 23 23 23  ###### #########
0550: 23 23 23 23 23 23 23 23 23 23 23 23 0a 23 23 20  ############.## 
0560: 0a 0a 73 6e 69 74 3a 3a 74 79 70 65 20 3a 3a 76  ..snit::type ::v
0570: 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72  c::fossil::impor
0580: 74 3a 3a 63 76 73 3a 3a 70 61 73 73 3a 3a 62 72  t::cvs::pass::br
0590: 65 61 6b 73 63 79 63 6c 65 20 7b 0a 20 20 20 20  eakscycle {.    
05a0: 23 20 23 20 23 23 20 23 23 23 20 23 23 23 23 23  # # ## ### #####
05b0: 20 23 23 23 23 23 23 23 23 20 23 23 23 23 23 23   ######## ######
05c0: 23 23 23 23 23 23 23 0a 20 20 20 20 23 23 20 50  #######.    ## P
05d0: 75 62 6c 69 63 20 41 50 49 0a 0a 20 20 20 20 74  ublic API..    t
05e0: 79 70 65 6d 65 74 68 6f 64 20 73 65 74 75 70 20  ypemethod setup 
05f0: 7b 7d 20 7b 0a 09 23 20 44 65 66 69 6e 65 20 74  {} {..# Define t
0600: 68 65 20 6e 61 6d 65 73 20 61 6e 64 20 73 74 72  he names and str
0610: 75 63 74 75 72 65 20 6f 66 20 74 68 65 20 70 65  ucture of the pe
0620: 72 73 69 73 74 65 6e 74 20 73 74 61 74 65 20 6f  rsistent state o
0630: 66 0a 09 23 20 74 68 69 73 20 70 61 73 73 2e 0a  f..# this pass..
0640: 09 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20  .return.    }.. 
0650: 20 20 20 74 79 70 65 6d 65 74 68 6f 64 20 6c 6f     typemethod lo
0660: 61 64 20 7b 7d 20 7b 0a 09 23 20 50 61 73 73 20  ad {} {..# Pass 
0670: 6d 61 6e 61 67 65 72 20 69 6e 74 65 72 66 61 63  manager interfac
0680: 65 2e 20 45 78 65 63 75 74 65 64 20 74 6f 20 6c  e. Executed to l
0690: 6f 61 64 20 64 61 74 61 20 63 6f 6d 70 75 74 65  oad data compute
06a0: 64 20 62 79 0a 09 23 20 74 68 69 73 20 70 61 73  d by..# this pas
06b0: 73 20 69 6e 74 6f 20 6d 65 6d 6f 72 79 20 77 68  s into memory wh
06c0: 65 6e 20 74 68 69 73 20 70 61 73 73 20 69 73 20  en this pass is 
06d0: 73 6b 69 70 70 65 64 20 69 6e 73 74 65 61 64 20  skipped instead 
06e0: 6f 66 0a 09 23 20 65 78 65 63 75 74 65 64 2e 0a  of..# executed..
06f0: 09 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20  .return.    }.. 
0700: 20 20 20 74 79 70 65 6d 65 74 68 6f 64 20 72 75     typemethod ru
0710: 6e 20 7b 7d 20 7b 0a 09 23 20 50 61 73 73 20 6d  n {} {..# Pass m
0720: 61 6e 61 67 65 72 20 69 6e 74 65 72 66 61 63 65  anager interface
0730: 2e 20 45 78 65 63 75 74 65 64 20 74 6f 20 70 65  . Executed to pe
0740: 72 66 6f 72 6d 20 74 68 65 0a 09 23 20 66 75 6e  rform the..# fun
0750: 63 74 69 6f 6e 61 6c 69 74 79 20 6f 66 20 74 68  ctionality of th
0760: 65 20 70 61 73 73 2e 0a 09 72 65 74 75 72 6e 0a  e pass...return.
0770: 20 20 20 20 7d 0a 0a 20 20 20 20 74 79 70 65 6d      }..    typem
0780: 65 74 68 6f 64 20 64 69 73 63 61 72 64 20 7b 7d  ethod discard {}
0790: 20 7b 0a 09 23 20 50 61 73 73 20 6d 61 6e 61 67   {..# Pass manag
07a0: 65 72 20 69 6e 74 65 72 66 61 63 65 2e 20 45 78  er interface. Ex
07b0: 65 63 75 74 65 64 20 66 6f 72 20 61 6c 6c 20 70  ecuted for all p
07c0: 61 73 73 65 73 20 61 66 74 65 72 20 74 68 65 0a  asses after the.
07d0: 09 23 20 72 75 6e 20 70 61 73 73 65 73 2c 20 74  .# run passes, t
07e0: 6f 20 72 65 6d 6f 76 65 20 61 6c 6c 20 64 61 74  o remove all dat
07f0: 61 20 6f 66 20 74 68 69 73 20 70 61 73 73 20 66  a of this pass f
0800: 72 6f 6d 20 74 68 65 20 73 74 61 74 65 2c 0a 09  rom the state,..
0810: 23 20 61 73 20 62 65 69 6e 67 20 6f 75 74 20 6f  # as being out o
0820: 66 20 64 61 74 65 2e 0a 09 72 65 74 75 72 6e 0a  f date...return.
0830: 20 20 20 20 7d 0a 0a 20 20 20 20 23 20 23 20 23      }..    # # #
0840: 23 20 23 23 23 20 23 23 23 23 23 20 23 23 23 23  # ### ##### ####
0850: 23 23 23 23 20 23 23 23 23 23 23 23 23 23 23 23  #### ###########
0860: 23 23 0a 20 20 20 20 23 23 20 49 6e 74 65 72 6e  ##.    ## Intern
0870: 61 6c 20 6d 65 74 68 6f 64 73 0a 0a 20 20 20 20  al methods..    
0880: 23 20 23 20 23 23 20 23 23 23 20 23 23 23 23 23  # # ## ### #####
0890: 20 23 23 23 23 23 23 23 23 20 23 23 23 23 23 23   ######## ######
08a0: 23 23 23 23 23 23 23 0a 20 20 20 20 23 23 20 43  #######.    ## C
08b0: 6f 6e 66 69 67 75 72 61 74 69 6f 6e 0a 0a 20 20  onfiguration..  
08c0: 20 20 70 72 61 67 6d 61 20 2d 68 61 73 69 6e 73    pragma -hasins
08d0: 74 61 6e 63 65 73 20 20 20 6e 6f 20 3b 20 23 20  tances   no ; # 
08e0: 73 69 6e 67 6c 65 74 6f 6e 0a 20 20 20 20 70 72  singleton.    pr
08f0: 61 67 6d 61 20 2d 68 61 73 74 79 70 65 69 6e 66  agma -hastypeinf
0900: 6f 20 20 20 20 6e 6f 20 3b 20 23 20 6e 6f 20 69  o    no ; # no i
0910: 6e 74 72 6f 73 70 65 63 74 69 6f 6e 0a 20 20 20  ntrospection.   
0920: 20 70 72 61 67 6d 61 20 2d 68 61 73 74 79 70 65   pragma -hastype
0930: 64 65 73 74 72 6f 79 20 6e 6f 20 3b 20 23 20 69  destroy no ; # i
0940: 6d 6d 6f 72 74 61 6c 0a 0a 20 20 20 20 23 20 23  mmortal..    # #
0950: 20 23 23 20 23 23 23 20 23 23 23 23 23 20 23 23   ## ### ##### ##
0960: 23 23 23 23 23 23 20 23 23 23 23 23 23 23 23 23  ###### #########
0970: 23 23 23 23 0a 7d 0a 0a 6e 61 6d 65 73 70 61 63  ####.}..namespac
0980: 65 20 65 76 61 6c 20 3a 3a 76 63 3a 3a 66 6f 73  e eval ::vc::fos
0990: 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73  sil::import::cvs
09a0: 3a 3a 70 61 73 73 20 7b 0a 20 20 20 20 6e 61 6d  ::pass {.    nam
09b0: 65 73 70 61 63 65 20 65 78 70 6f 72 74 20 62 72  espace export br
09c0: 65 61 6b 73 63 79 63 6c 65 0a 20 20 20 20 6e 61  eakscycle.    na
09d0: 6d 65 73 70 61 63 65 20 65 76 61 6c 20 62 72 65  mespace eval bre
09e0: 61 6b 73 63 79 63 6c 65 20 7b 0a 09 6e 61 6d 65  akscycle {..name
09f0: 73 70 61 63 65 20 69 6d 70 6f 72 74 20 3a 3a 76  space import ::v
0a00: 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72  c::fossil::impor
0a10: 74 3a 3a 63 76 73 3a 3a 73 74 61 74 65 0a 09 6e  t::cvs::state..n
0a20: 61 6d 65 73 70 61 63 65 20 69 6d 70 6f 72 74 20  amespace import 
0a30: 3a 3a 76 63 3a 3a 74 6f 6f 6c 73 3a 3a 6c 6f 67  ::vc::tools::log
0a40: 0a 09 6c 6f 67 20 72 65 67 69 73 74 65 72 20 62  ..log register b
0a50: 72 65 61 6b 73 63 79 63 6c 65 0a 20 20 20 20 7d  reakscycle.    }
0a60: 0a 7d 0a 0a 23 20 23 20 23 23 20 23 23 23 20 23  .}..# # ## ### #
0a70: 23 23 23 23 20 23 23 23 23 23 23 23 23 20 23 23  #### ######## ##
0a80: 23 23 23 23 23 23 23 23 23 23 23 20 23 23 23 23  ########### ####
0a90: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23  ################
0aa0: 23 0a 23 23 20 52 65 61 64 79 0a 0a 70 61 63 6b  #.## Ready..pack
0ab0: 61 67 65 20 70 72 6f 76 69 64 65 20 76 63 3a 3a  age provide vc::
0ac0: 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a  fossil::import::
0ad0: 63 76 73 3a 3a 70 61 73 73 3a 3a 62 72 65 61 6b  cvs::pass::break
0ae0: 73 63 79 63 6c 65 20 31 2e 30 0a 72 65 74 75 72  scycle 1.0.retur
0af0: 6e 0a                                            n.