Hex Artifact Content
Not logged in

Artifact 108eb140ec4f858b5d12d616419e7f3d106e45a5:

File tools/cvs2fossil/lib/c2f_prtopsort.tcl part of check-in [00bf8c198e] - The performance was still not satisfying, even with faster recomputing of successors. Doing it multiple times (Building the graph in each breaker and sort passes) eats time. Caching in memory blows the memory. Chosen solution: Cache this information in the database.

Created a new pass 'CsetDeps' which is run between 'InitCsets' and 'BreakRevCsetCycles' (i.e. changeset creation and first breaker pass). It computes the changeset dependencies from the file-level dependencies once and saves the result in the state, in the new table 'cssuccessor'. Now the breaker and sort passes can get the information quickly, with virtually no effort. The dependencies are recomputed incrementally when a changeset is split by one of the breaker passes, for its fragments and its predecessors.

The loop check is now trivial, and integrated into the successor computation, with the heavy lifting for the detailed analysis and reporting moved down into the type-dependent SQL queries. The relevant new method is 'loops'. Now that the loop check is incremental the pass based checks have been removed from the integrity module, and the option '--loopcheck' has been eliminated. For paranoia the graph setup and modification code got its loop check reinstated as an assert, redusing the changeset report code.

Renumbered the breaker and sort passes. A number of places, like graph setup and traversal, loading of changesets, etc. got feedback indicators to show their progress.

The selection of revision and symbol changesets for the associated breaker passes was a bit on the slow side. We now keep changeset lists sorted by type (during loading or general construction) and access them directly.

by aku on 2007-12-02 20:04: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 56 49 49 49 2e 20 54 68 69 73 20 70 61 73  s VIII. This pas
0210: 73 20 67 6f 65 73 20 6f 76 65 72 20 74 68 65 20  s goes over the 
0220: 73 65 74 20 6f 66 20 72 65 76 69 73 69 6f 6e 20  set of revision 
0230: 62 61 73 65 64 20 63 68 61 6e 67 65 73 65 74 73  based changesets
0240: 0a 23 23 20 61 6e 64 20 73 6f 72 74 73 20 74 68  .## and sorts th
0250: 65 6d 20 74 6f 70 6f 6c 6f 67 69 63 61 6c 6c 79  em topologically
0260: 2e 20 49 74 20 61 73 73 75 6d 65 73 20 74 68 61  . It assumes tha
0270: 74 20 74 68 65 72 65 20 61 72 65 20 6e 6f 20 63  t there are no c
0280: 79 63 6c 65 73 0a 23 23 20 77 68 69 63 68 20 63  ycles.## which c
0290: 6f 75 6c 64 20 69 6d 70 65 64 65 20 69 74 2c 20  ould impede it, 
02a0: 61 6e 79 20 68 61 76 69 6e 67 20 62 65 65 6e 20  any having been 
02b0: 62 72 6f 6b 65 6e 20 62 79 20 74 68 65 20 70 72  broken by the pr
02c0: 65 76 69 6f 75 73 20 70 61 73 73 2c 0a 23 23 20  evious pass,.## 
02d0: 61 6e 64 20 61 62 6f 72 74 73 20 69 66 20 74 68  and aborts if th
02e0: 61 74 20 63 6f 6e 64 69 74 69 6f 6e 20 64 6f 65  at condition doe
02f0: 73 6e 27 74 20 68 6f 6c 64 2e 0a 0a 23 20 23 20  sn't hold...# # 
0300: 23 23 20 23 23 23 20 23 23 23 23 23 20 23 23 23  ## ### ##### ###
0310: 23 23 23 23 23 20 23 23 23 23 23 23 23 23 23 23  ##### ##########
0320: 23 23 23 20 23 23 23 23 23 23 23 23 23 23 23 23  ### ############
0330: 23 23 23 23 23 23 23 23 23 0a 23 23 20 52 65 71  #########.## Req
0340: 75 69 72 65 6d 65 6e 74 73 0a 0a 70 61 63 6b 61  uirements..packa
0350: 67 65 20 72 65 71 75 69 72 65 20 54 63 6c 20 38  ge require Tcl 8
0360: 2e 34 20 20 20 20 20 20 20 20 20 20 20 20 20 20  .4              
0370: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
0380: 20 20 20 20 20 3b 20 23 20 52 65 71 75 69 72 65       ; # Require
0390: 64 20 72 75 6e 74 69 6d 65 2e 0a 70 61 63 6b 61  d runtime..packa
03a0: 67 65 20 72 65 71 75 69 72 65 20 73 6e 69 74 20  ge require snit 
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 20 20 20 20 20 20 20 20                  
03d0: 20 20 20 20 20 3b 20 23 20 4f 4f 20 73 79 73 74       ; # OO syst
03e0: 65 6d 2e 0a 70 61 63 6b 61 67 65 20 72 65 71 75  em..package requ
03f0: 69 72 65 20 73 74 72 75 63 74 3a 3a 6c 69 73 74  ire struct::list
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 20 20 20 20 20 20 3b 20                ; 
0420: 23 20 48 69 67 68 65 72 20 6f 72 64 65 72 20 6c  # Higher order l
0430: 69 73 74 20 6f 70 65 72 61 74 69 6f 6e 73 2e 0a  ist operations..
0440: 70 61 63 6b 61 67 65 20 72 65 71 75 69 72 65 20  package require 
0450: 76 63 3a 3a 74 6f 6f 6c 73 3a 3a 6c 6f 67 20 20  vc::tools::log  
0460: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
0470: 20 20 20 20 20 20 20 20 20 20 3b 20 23 20 55 73            ; # Us
0480: 65 72 20 66 65 65 64 62 61 63 6b 2e 0a 70 61 63  er feedback..pac
0490: 6b 61 67 65 20 72 65 71 75 69 72 65 20 76 63 3a  kage require vc:
04a0: 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a  :fossil::import:
04b0: 3a 63 76 73 3a 3a 63 79 63 6c 65 62 72 65 61 6b  :cvs::cyclebreak
04c0: 65 72 20 20 20 20 20 3b 20 23 20 42 72 65 61 6b  er     ; # Break
04d0: 69 6e 67 20 64 65 70 65 6e 64 65 6e 63 79 20 63  ing dependency c
04e0: 79 63 6c 65 73 2e 0a 70 61 63 6b 61 67 65 20 72  ycles..package r
04f0: 65 71 75 69 72 65 20 76 63 3a 3a 66 6f 73 73 69  equire vc::fossi
0500: 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a  l::import::cvs::
0510: 73 74 61 74 65 20 20 20 20 20 20 20 20 20 20 20  state           
0520: 20 3b 20 23 20 53 74 61 74 65 20 73 74 6f 72 61   ; # State stora
0530: 67 65 2e 0a 70 61 63 6b 61 67 65 20 72 65 71 75  ge..package requ
0540: 69 72 65 20 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a  ire vc::fossil::
0550: 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 70 72 6f  import::cvs::pro
0560: 6a 65 63 74 3a 3a 72 65 76 20 20 20 20 20 3b 20  ject::rev     ; 
0570: 23 20 50 72 6f 6a 65 63 74 20 6c 65 76 65 6c 20  # Project level 
0580: 63 68 61 6e 67 65 73 65 74 73 0a 0a 23 20 23 20  changesets..# # 
0590: 23 23 20 23 23 23 20 23 23 23 23 23 20 23 23 23  ## ### ##### ###
05a0: 23 23 23 23 23 20 23 23 23 23 23 23 23 23 23 23  ##### ##########
05b0: 23 23 23 20 23 23 23 23 23 23 23 23 23 23 23 23  ### ############
05c0: 23 23 23 23 23 23 23 23 23 0a 23 23 20 52 65 67  #########.## Reg
05d0: 69 73 74 65 72 20 74 68 65 20 70 61 73 73 20 77  ister the pass w
05e0: 69 74 68 20 74 68 65 20 6d 61 6e 61 67 65 6d 65  ith the manageme
05f0: 6e 74 0a 0a 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a  nt..vc::fossil::
0600: 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 70 61 73  import::cvs::pas
0610: 73 20 64 65 66 69 6e 65 20 5c 0a 20 20 20 20 52  s define \.    R
0620: 65 76 54 6f 70 6f 6c 6f 67 69 63 61 6c 53 6f 72  evTopologicalSor
0630: 74 20 5c 0a 20 20 20 20 7b 54 6f 70 6f 6c 6f 67  t \.    {Topolog
0640: 69 63 61 6c 6c 79 20 53 6f 72 74 20 52 65 76 69  ically Sort Revi
0650: 73 69 6f 6e 20 43 68 61 6e 67 65 53 65 74 73 7d  sion ChangeSets}
0660: 20 5c 0a 20 20 20 20 3a 3a 76 63 3a 3a 66 6f 73   \.    ::vc::fos
0670: 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73  sil::import::cvs
0680: 3a 3a 70 61 73 73 3a 3a 72 74 6f 70 73 6f 72 74  ::pass::rtopsort
0690: 0a 0a 23 20 23 20 23 23 20 23 23 23 20 23 23 23  ..# # ## ### ###
06a0: 23 23 20 23 23 23 23 23 23 23 23 20 23 23 23 23  ## ######## ####
06b0: 23 23 23 23 23 23 23 23 23 20 23 23 23 23 23 23  ######### ######
06c0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 0a  ###############.
06d0: 23 23 0a 0a 73 6e 69 74 3a 3a 74 79 70 65 20 3a  ##..snit::type :
06e0: 3a 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70  :vc::fossil::imp
06f0: 6f 72 74 3a 3a 63 76 73 3a 3a 70 61 73 73 3a 3a  ort::cvs::pass::
0700: 72 74 6f 70 73 6f 72 74 20 7b 0a 20 20 20 20 23  rtopsort {.    #
0710: 20 23 20 23 23 20 23 23 23 20 23 23 23 23 23 20   # ## ### ##### 
0720: 23 23 23 23 23 23 23 23 20 23 23 23 23 23 23 23  ######## #######
0730: 23 23 23 23 23 23 0a 20 20 20 20 23 23 20 50 75  ######.    ## Pu
0740: 62 6c 69 63 20 41 50 49 0a 0a 20 20 20 20 74 79  blic API..    ty
0750: 70 65 6d 65 74 68 6f 64 20 73 65 74 75 70 20 7b  pemethod setup {
0760: 7d 20 7b 0a 09 23 20 44 65 66 69 6e 65 20 74 68  } {..# Define th
0770: 65 20 6e 61 6d 65 73 20 61 6e 64 20 73 74 72 75  e names and stru
0780: 63 74 75 72 65 20 6f 66 20 74 68 65 20 70 65 72  cture of the per
0790: 73 69 73 74 65 6e 74 20 73 74 61 74 65 20 6f 66  sistent state of
07a0: 0a 09 23 20 74 68 69 73 20 70 61 73 73 2e 0a 0a  ..# this pass...
07b0: 09 73 74 61 74 65 20 72 65 61 64 69 6e 67 20 72  .state reading r
07c0: 65 76 69 73 69 6f 6e 0a 09 73 74 61 74 65 20 72  evision..state r
07d0: 65 61 64 69 6e 67 20 63 68 61 6e 67 65 73 65 74  eading changeset
07e0: 0a 09 73 74 61 74 65 20 72 65 61 64 69 6e 67 20  ..state reading 
07f0: 63 73 69 74 65 6d 0a 0a 09 73 74 61 74 65 20 77  csitem...state w
0800: 72 69 74 69 6e 67 20 63 73 6f 72 64 65 72 20 7b  riting csorder {
0810: 0a 09 20 20 20 20 2d 2d 20 43 6f 6d 6d 69 74 20  ..    -- Commit 
0820: 6f 72 64 65 72 20 6f 66 20 74 68 65 20 72 65 76  order of the rev
0830: 69 73 69 6f 6e 20 63 68 61 6e 67 65 73 65 74 73  ision changesets
0840: 20 62 61 73 65 64 20 6f 6e 20 74 68 65 69 72 0a   based on their.
0850: 09 20 20 20 20 2d 2d 20 64 65 70 65 6e 64 65 6e  .    -- dependen
0860: 63 69 65 73 0a 0a 09 20 20 20 20 63 69 64 20 49  cies...    cid I
0870: 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55 4c 4c  NTEGER  NOT NULL
0880: 20 20 52 45 46 45 52 45 4e 43 45 53 20 63 68 61    REFERENCES cha
0890: 6e 67 65 73 65 74 2c 0a 09 20 20 20 20 70 6f 73  ngeset,..    pos
08a0: 20 49 4e 54 45 47 45 52 20 20 4e 4f 54 20 4e 55   INTEGER  NOT NU
08b0: 4c 4c 2c 0a 09 20 20 20 20 55 4e 49 51 55 45 20  LL,..    UNIQUE 
08c0: 28 63 69 64 29 2c 0a 09 20 20 20 20 55 4e 49 51  (cid),..    UNIQ
08d0: 55 45 20 28 70 6f 73 29 0a 09 7d 0a 09 72 65 74  UE (pos)..}..ret
08e0: 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 74  urn.    }..    t
08f0: 79 70 65 6d 65 74 68 6f 64 20 6c 6f 61 64 20 7b  ypemethod load {
0900: 7d 20 7b 0a 09 23 20 50 61 73 73 20 6d 61 6e 61  } {..# Pass mana
0910: 67 65 72 20 69 6e 74 65 72 66 61 63 65 2e 20 45  ger interface. E
0920: 78 65 63 75 74 65 64 20 74 6f 20 6c 6f 61 64 20  xecuted to load 
0930: 64 61 74 61 20 63 6f 6d 70 75 74 65 64 20 62 79  data computed by
0940: 0a 09 23 20 74 68 69 73 20 70 61 73 73 20 69 6e  ..# this pass in
0950: 74 6f 20 6d 65 6d 6f 72 79 20 77 68 65 6e 20 74  to memory when t
0960: 68 69 73 20 70 61 73 73 20 69 73 20 73 6b 69 70  his pass is skip
0970: 70 65 64 20 69 6e 73 74 65 61 64 20 6f 66 0a 09  ped instead of..
0980: 23 20 65 78 65 63 75 74 65 64 2e 0a 0a 09 73 74  # executed....st
0990: 61 74 65 20 72 65 61 64 69 6e 67 20 63 68 61 6e  ate reading chan
09a0: 67 65 73 65 74 0a 09 70 72 6f 6a 65 63 74 3a 3a  geset..project::
09b0: 72 65 76 20 6c 6f 61 64 63 6f 75 6e 74 65 72 0a  rev loadcounter.
09c0: 09 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20  .return.    }.. 
09d0: 20 20 20 74 79 70 65 6d 65 74 68 6f 64 20 72 75     typemethod ru
09e0: 6e 20 7b 7d 20 7b 0a 09 23 20 50 61 73 73 20 6d  n {} {..# Pass m
09f0: 61 6e 61 67 65 72 20 69 6e 74 65 72 66 61 63 65  anager interface
0a00: 2e 20 45 78 65 63 75 74 65 64 20 74 6f 20 70 65  . Executed to pe
0a10: 72 66 6f 72 6d 20 74 68 65 0a 09 23 20 66 75 6e  rform the..# fun
0a20: 63 74 69 6f 6e 61 6c 69 74 79 20 6f 66 20 74 68  ctionality of th
0a30: 65 20 70 61 73 73 2e 0a 0a 09 73 65 74 20 6c 65  e pass....set le
0a40: 6e 20 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68  n [string length
0a50: 20 5b 70 72 6f 6a 65 63 74 3a 3a 72 65 76 20 6e   [project::rev n
0a60: 75 6d 5d 5d 0a 09 73 65 74 20 6d 79 61 74 66 6d  um]]..set myatfm
0a70: 74 20 25 24 7b 6c 65 6e 7d 73 0a 09 69 6e 63 72  t %${len}s..incr
0a80: 20 6c 65 6e 20 31 32 0a 09 73 65 74 20 6d 79 63   len 12..set myc
0a90: 73 66 6d 74 20 25 24 7b 6c 65 6e 7d 73 0a 0a 09  sfmt %${len}s...
0aa0: 63 79 63 6c 65 62 72 65 61 6b 65 72 20 73 61 76  cyclebreaker sav
0ab0: 65 63 6d 64 20 20 5b 6d 79 70 72 6f 63 20 53 61  ecmd  [myproc Sa
0ac0: 76 65 4f 72 64 65 72 5d 0a 0a 09 73 74 61 74 65  veOrder]...state
0ad0: 20 74 72 61 6e 73 61 63 74 69 6f 6e 20 7b 0a 09   transaction {..
0ae0: 20 20 20 20 63 79 63 6c 65 62 72 65 61 6b 65 72      cyclebreaker
0af0: 20 72 75 6e 20 74 73 6f 72 74 2d 72 65 76 20 5b   run tsort-rev [
0b00: 6d 79 70 72 6f 63 20 43 68 61 6e 67 65 73 65 74  myproc Changeset
0b10: 73 5d 0a 09 7d 0a 09 72 65 74 75 72 6e 0a 20 20  s]..}..return.  
0b20: 20 20 7d 0a 0a 20 20 20 20 74 79 70 65 6d 65 74    }..    typemet
0b30: 68 6f 64 20 64 69 73 63 61 72 64 20 7b 7d 20 7b  hod discard {} {
0b40: 0a 09 23 20 50 61 73 73 20 6d 61 6e 61 67 65 72  ..# Pass manager
0b50: 20 69 6e 74 65 72 66 61 63 65 2e 20 45 78 65 63   interface. Exec
0b60: 75 74 65 64 20 66 6f 72 20 61 6c 6c 20 70 61 73  uted for all pas
0b70: 73 65 73 20 61 66 74 65 72 20 74 68 65 0a 09 23  ses after the..#
0b80: 20 72 75 6e 20 70 61 73 73 65 73 2c 20 74 6f 20   run passes, to 
0b90: 72 65 6d 6f 76 65 20 61 6c 6c 20 64 61 74 61 20  remove all data 
0ba0: 6f 66 20 74 68 69 73 20 70 61 73 73 20 66 72 6f  of this pass fro
0bb0: 6d 20 74 68 65 20 73 74 61 74 65 2c 0a 09 23 20  m the state,..# 
0bc0: 61 73 20 62 65 69 6e 67 20 6f 75 74 20 6f 66 20  as being out of 
0bd0: 64 61 74 65 2e 0a 0a 09 73 74 61 74 65 20 64 69  date....state di
0be0: 73 63 61 72 64 20 63 73 6f 72 64 65 72 0a 09 72  scard csorder..r
0bf0: 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20  eturn.    }..   
0c00: 20 23 20 23 20 23 23 20 23 23 23 20 23 23 23 23   # # ## ### ####
0c10: 23 20 23 23 23 23 23 23 23 23 20 23 23 23 23 23  # ######## #####
0c20: 23 23 23 23 23 23 23 23 0a 20 20 20 20 23 23 20  ########.    ## 
0c30: 49 6e 74 65 72 6e 61 6c 20 6d 65 74 68 6f 64 73  Internal methods
0c40: 0a 0a 20 20 20 20 70 72 6f 63 20 43 68 61 6e 67  ..    proc Chang
0c50: 65 73 65 74 73 20 7b 7d 20 7b 0a 09 6c 6f 67 20  esets {} {..log 
0c60: 77 72 69 74 65 20 32 20 62 72 65 61 6b 73 63 79  write 2 breakscy
0c70: 63 6c 65 20 7b 53 65 6c 65 63 74 69 6e 67 20 74  cle {Selecting t
0c80: 68 65 20 72 65 76 69 73 69 6f 6e 20 63 68 61 6e  he revision chan
0c90: 67 65 73 65 74 73 7d 0a 09 72 65 74 75 72 6e 20  gesets}..return 
0ca0: 5b 70 72 6f 6a 65 63 74 3a 3a 72 65 76 20 72 65  [project::rev re
0cb0: 76 5d 0a 20 20 20 20 7d 0a 0a 20 20 20 20 70 72  v].    }..    pr
0cc0: 6f 63 20 53 61 76 65 4f 72 64 65 72 20 7b 67 72  oc SaveOrder {gr
0cd0: 61 70 68 20 61 74 20 63 73 65 74 7d 20 7b 0a 09  aph at cset} {..
0ce0: 3a 3a 76 61 72 69 61 62 6c 65 20 6d 79 61 74 66  ::variable myatf
0cf0: 6d 74 0a 09 3a 3a 76 61 72 69 61 62 6c 65 20 6d  mt..::variable m
0d00: 79 63 73 66 6d 74 0a 0a 09 73 65 74 20 63 69 64  ycsfmt...set cid
0d10: 20 5b 24 63 73 65 74 20 69 64 5d 0a 0a 09 6c 6f   [$cset id]...lo
0d20: 67 20 77 72 69 74 65 20 34 20 72 74 6f 70 73 6f  g write 4 rtopso
0d30: 72 74 20 22 43 68 61 6e 67 65 73 65 74 20 40 20  rt "Changeset @ 
0d40: 5b 66 6f 72 6d 61 74 20 24 6d 79 61 74 66 6d 74  [format $myatfmt
0d50: 20 24 61 74 5d 3a 20 5b 66 6f 72 6d 61 74 20 24   $at]: [format $
0d60: 6d 79 63 73 66 6d 74 20 5b 24 63 73 65 74 20 73  mycsfmt [$cset s
0d70: 74 72 5d 5d 20 3c 3c 5b 46 6f 72 6d 61 74 54 52  tr]] <<[FormatTR
0d80: 20 24 67 72 61 70 68 20 24 63 73 65 74 5d 3e 3e   $graph $cset]>>
0d90: 22 0a 09 73 74 61 74 65 20 72 75 6e 20 7b 0a 09  "..state run {..
0da0: 20 20 20 20 49 4e 53 45 52 54 20 49 4e 54 4f 20      INSERT INTO 
0db0: 63 73 6f 72 64 65 72 20 28 63 69 64 2c 20 20 70  csorder (cid,  p
0dc0: 6f 73 29 0a 09 20 20 20 20 56 41 4c 55 45 53 20  os)..    VALUES 
0dd0: 20 20 20 20 20 20 20 20 20 20 20 20 20 28 24 63               ($c
0de0: 69 64 2c 20 24 61 74 29 0a 09 7d 0a 09 72 65 74  id, $at)..}..ret
0df0: 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 70  urn.    }..    p
0e00: 72 6f 63 20 46 6f 72 6d 61 74 54 52 20 7b 67 72  roc FormatTR {gr
0e10: 61 70 68 20 63 73 65 74 7d 20 7b 0a 09 72 65 74  aph cset} {..ret
0e20: 75 72 6e 20 5b 6a 6f 69 6e 20 5b 73 74 72 75 63  urn [join [struc
0e30: 74 3a 3a 6c 69 73 74 20 6d 61 70 20 5b 24 67 72  t::list map [$gr
0e40: 61 70 68 20 6e 6f 64 65 20 73 65 74 20 24 63 73  aph node set $cs
0e50: 65 74 20 74 69 6d 65 72 61 6e 67 65 5d 20 7b 63  et timerange] {c
0e60: 6c 6f 63 6b 20 66 6f 72 6d 61 74 7d 5d 20 7b 20  lock format}] { 
0e70: 2d 2d 20 7d 5d 0a 20 20 20 20 7d 0a 0a 20 20 20  -- }].    }..   
0e80: 20 74 79 70 65 76 61 72 69 61 62 6c 65 20 6d 79   typevariable my
0e90: 61 74 66 6d 74 20 3b 20 23 20 46 6f 72 6d 61 74  atfmt ; # Format
0ea0: 20 66 6f 72 20 6c 6f 67 20 6f 75 74 70 75 74 20   for log output 
0eb0: 74 6f 20 67 61 69 6e 20 62 65 74 74 65 72 20 61  to gain better a
0ec0: 6c 69 67 6e 6d 65 6e 74 20 6f 66 20 74 68 65 20  lignment of the 
0ed0: 76 61 72 69 6f 75 73 20 63 6f 6c 75 6d 6e 73 2e  various columns.
0ee0: 0a 20 20 20 20 74 79 70 65 76 61 72 69 61 62 6c  .    typevariabl
0ef0: 65 20 6d 79 63 73 66 6d 74 20 3b 20 23 20 44 69  e mycsfmt ; # Di
0f00: 74 74 6f 20 66 6f 72 20 74 68 65 20 63 68 61 6e  tto for the chan
0f10: 67 65 73 65 74 73 2e 0a 0a 20 20 20 20 23 20 23  gesets...    # #
0f20: 20 23 23 20 23 23 23 20 23 23 23 23 23 20 23 23   ## ### ##### ##
0f30: 23 23 23 23 23 23 20 23 23 23 23 23 23 23 23 23  ###### #########
0f40: 23 23 23 23 0a 20 20 20 20 23 23 20 43 6f 6e 66  ####.    ## Conf
0f50: 69 67 75 72 61 74 69 6f 6e 0a 0a 20 20 20 20 70  iguration..    p
0f60: 72 61 67 6d 61 20 2d 68 61 73 69 6e 73 74 61 6e  ragma -hasinstan
0f70: 63 65 73 20 20 20 6e 6f 20 3b 20 23 20 73 69 6e  ces   no ; # sin
0f80: 67 6c 65 74 6f 6e 0a 20 20 20 20 70 72 61 67 6d  gleton.    pragm
0f90: 61 20 2d 68 61 73 74 79 70 65 69 6e 66 6f 20 20  a -hastypeinfo  
0fa0: 20 20 6e 6f 20 3b 20 23 20 6e 6f 20 69 6e 74 72    no ; # no intr
0fb0: 6f 73 70 65 63 74 69 6f 6e 0a 20 20 20 20 70 72  ospection.    pr
0fc0: 61 67 6d 61 20 2d 68 61 73 74 79 70 65 64 65 73  agma -hastypedes
0fd0: 74 72 6f 79 20 6e 6f 20 3b 20 23 20 69 6d 6d 6f  troy no ; # immo
0fe0: 72 74 61 6c 0a 0a 20 20 20 20 23 20 23 20 23 23  rtal..    # # ##
0ff0: 20 23 23 23 20 23 23 23 23 23 20 23 23 23 23 23   ### ##### #####
1000: 23 23 23 20 23 23 23 23 23 23 23 23 23 23 23 23  ### ############
1010: 23 0a 7d 0a 0a 6e 61 6d 65 73 70 61 63 65 20 65  #.}..namespace e
1020: 76 61 6c 20 3a 3a 76 63 3a 3a 66 6f 73 73 69 6c  val ::vc::fossil
1030: 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 70  ::import::cvs::p
1040: 61 73 73 20 7b 0a 20 20 20 20 6e 61 6d 65 73 70  ass {.    namesp
1050: 61 63 65 20 65 78 70 6f 72 74 20 72 74 6f 70 73  ace export rtops
1060: 6f 72 74 0a 20 20 20 20 6e 61 6d 65 73 70 61 63  ort.    namespac
1070: 65 20 65 76 61 6c 20 72 74 6f 70 73 6f 72 74 20  e eval rtopsort 
1080: 7b 0a 09 6e 61 6d 65 73 70 61 63 65 20 69 6d 70  {..namespace imp
1090: 6f 72 74 20 3a 3a 76 63 3a 3a 66 6f 73 73 69 6c  ort ::vc::fossil
10a0: 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 63  ::import::cvs::c
10b0: 79 63 6c 65 62 72 65 61 6b 65 72 0a 09 6e 61 6d  yclebreaker..nam
10c0: 65 73 70 61 63 65 20 69 6d 70 6f 72 74 20 3a 3a  espace import ::
10d0: 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f  vc::fossil::impo
10e0: 72 74 3a 3a 63 76 73 3a 3a 73 74 61 74 65 0a 09  rt::cvs::state..
10f0: 6e 61 6d 65 73 70 61 63 65 20 65 76 61 6c 20 70  namespace eval p
1100: 72 6f 6a 65 63 74 20 7b 0a 09 20 20 20 20 6e 61  roject {..    na
1110: 6d 65 73 70 61 63 65 20 69 6d 70 6f 72 74 20 3a  mespace import :
1120: 3a 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70  :vc::fossil::imp
1130: 6f 72 74 3a 3a 63 76 73 3a 3a 70 72 6f 6a 65 63  ort::cvs::projec
1140: 74 3a 3a 72 65 76 0a 09 7d 0a 09 6e 61 6d 65 73  t::rev..}..names
1150: 70 61 63 65 20 69 6d 70 6f 72 74 20 3a 3a 76 63  pace import ::vc
1160: 3a 3a 74 6f 6f 6c 73 3a 3a 6c 6f 67 0a 09 6c 6f  ::tools::log..lo
1170: 67 20 72 65 67 69 73 74 65 72 20 72 74 6f 70 73  g register rtops
1180: 6f 72 74 0a 20 20 20 20 7d 0a 7d 0a 0a 23 20 23  ort.    }.}..# #
1190: 20 23 23 20 23 23 23 20 23 23 23 23 23 20 23 23   ## ### ##### ##
11a0: 23 23 23 23 23 23 20 23 23 23 23 23 23 23 23 23  ###### #########
11b0: 23 23 23 23 20 23 23 23 23 23 23 23 23 23 23 23  #### ###########
11c0: 23 23 23 23 23 23 23 23 23 23 0a 23 23 20 52 65  ##########.## Re
11d0: 61 64 79 0a 0a 70 61 63 6b 61 67 65 20 70 72 6f  ady..package pro
11e0: 76 69 64 65 20 76 63 3a 3a 66 6f 73 73 69 6c 3a  vide vc::fossil:
11f0: 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 70 61  :import::cvs::pa
1200: 73 73 3a 3a 72 74 6f 70 73 6f 72 74 20 31 2e 30  ss::rtopsort 1.0
1210: 0a 72 65 74 75 72 6e 0a                          .return.