Hex Artifact Content
Not logged in

Artifact 91fadc851ab9ffe18f31881afe107adaf9e146a4:

File tools/cvs2fossil/lib/c2f_file.tcl part of check-in [47d52d1efd] - Added convenience method for assertions and used it in place of the existing if/trouble internal constructions. Changed API of 'log write' so that we can defer substituation of the message to when the write actually happen, and converted all places which would be hit by double-substitution. The remaining 'log write' calls will be converted incrementally. by aku on 2007-11-28 05:39:49.

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 46 69 6c  ########..## Fil
0200: 65 2c 20 70 61 72 74 20 6f 66 20 61 20 70 72 6f  e, part of a pro
0210: 6a 65 63 74 2c 20 70 61 72 74 20 6f 66 20 61 20  ject, part of a 
0220: 43 56 53 20 72 65 70 6f 73 69 74 6f 72 79 2e 20  CVS repository. 
0230: 4d 75 6c 74 69 70 6c 65 0a 23 23 20 69 6e 73 74  Multiple.## inst
0240: 61 6e 63 65 73 20 61 72 65 20 70 6f 73 73 69 62  ances are possib
0250: 6c 65 2e 0a 0a 23 20 23 20 23 23 20 23 23 23 20  le...# # ## ### 
0260: 23 23 23 23 23 20 23 23 23 23 23 23 23 23 20 23  ##### ######## #
0270: 23 23 23 23 23 23 23 23 23 23 23 23 20 23 23 23  ############ ###
0280: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23  ################
0290: 23 23 0a 23 23 20 52 65 71 75 69 72 65 6d 65 6e  ##.## Requiremen
02a0: 74 73 0a 0a 70 61 63 6b 61 67 65 20 72 65 71 75  ts..package requ
02b0: 69 72 65 20 54 63 6c 20 38 2e 34 20 20 20 20 20  ire Tcl 8.4     
02c0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
02d0: 20 20 20 20 20 20 20 20 3b 20 23 20 52 65 71 75          ; # Requ
02e0: 69 72 65 64 20 72 75 6e 74 69 6d 65 2e 0a 70 61  ired runtime..pa
02f0: 63 6b 61 67 65 20 72 65 71 75 69 72 65 20 73 6e  ckage require sn
0300: 69 74 20 20 20 20 20 20 20 20 20 20 20 20 20 20  it              
0310: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
0320: 20 20 3b 20 23 20 4f 4f 20 73 79 73 74 65 6d 2e    ; # OO system.
0330: 0a 70 61 63 6b 61 67 65 20 72 65 71 75 69 72 65  .package require
0340: 20 73 74 72 75 63 74 3a 3a 73 65 74 20 20 20 20   struct::set    
0350: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
0360: 20 20 20 20 20 3b 20 23 20 53 65 74 20 6f 70 65       ; # Set ope
0370: 72 61 74 69 6f 6e 73 2e 0a 70 61 63 6b 61 67 65  rations..package
0380: 20 72 65 71 75 69 72 65 20 76 63 3a 3a 66 6f 73   require vc::fos
0390: 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73  sil::import::cvs
03a0: 3a 3a 66 69 6c 65 3a 3a 72 65 76 20 20 3b 20 23  ::file::rev  ; #
03b0: 20 43 56 53 20 70 65 72 20 66 69 6c 65 20 72 65   CVS per file re
03c0: 76 69 73 69 6f 6e 73 2e 0a 70 61 63 6b 61 67 65  visions..package
03d0: 20 72 65 71 75 69 72 65 20 76 63 3a 3a 66 6f 73   require vc::fos
03e0: 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73  sil::import::cvs
03f0: 3a 3a 66 69 6c 65 3a 3a 73 79 6d 20 20 3b 20 23  ::file::sym  ; #
0400: 20 43 56 53 20 70 65 72 20 66 69 6c 65 20 73 79   CVS per file sy
0410: 6d 62 6f 6c 73 2e 0a 70 61 63 6b 61 67 65 20 72  mbols..package r
0420: 65 71 75 69 72 65 20 76 63 3a 3a 66 6f 73 73 69  equire vc::fossi
0430: 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a  l::import::cvs::
0440: 73 74 61 74 65 20 20 20 20 20 20 3b 20 23 20 53  state      ; # S
0450: 74 61 74 65 20 73 74 6f 72 61 67 65 2e 0a 70 61  tate storage..pa
0460: 63 6b 61 67 65 20 72 65 71 75 69 72 65 20 76 63  ckage require vc
0470: 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 74  ::fossil::import
0480: 3a 3a 63 76 73 3a 3a 69 6e 74 65 67 72 69 74 79  ::cvs::integrity
0490: 20 20 3b 20 23 20 53 74 61 74 65 20 69 6e 74 65    ; # State inte
04a0: 67 72 69 74 79 20 63 68 65 63 6b 73 2e 0a 70 61  grity checks..pa
04b0: 63 6b 61 67 65 20 72 65 71 75 69 72 65 20 76 63  ckage require vc
04c0: 3a 3a 74 6f 6f 6c 73 3a 3a 74 72 6f 75 62 6c 65  ::tools::trouble
04d0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
04e0: 20 20 3b 20 23 20 45 72 72 6f 72 20 72 65 70 6f    ; # Error repo
04f0: 72 74 69 6e 67 2e 0a 70 61 63 6b 61 67 65 20 72  rting..package r
0500: 65 71 75 69 72 65 20 76 63 3a 3a 74 6f 6f 6c 73  equire vc::tools
0510: 3a 3a 6c 6f 67 20 20 20 20 20 20 20 20 20 20 20  ::log           
0520: 20 20 20 20 20 20 20 20 20 20 20 3b 20 23 20 55             ; # U
0530: 73 65 72 20 66 65 65 64 62 61 63 6b 0a 70 61 63  ser feedback.pac
0540: 6b 61 67 65 20 72 65 71 75 69 72 65 20 76 63 3a  kage require vc:
0550: 3a 74 6f 6f 6c 73 3a 3a 6d 69 73 63 20 20 20 20  :tools::misc    
0560: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
0570: 20 3b 20 23 20 54 65 78 74 20 66 6f 72 6d 61 74   ; # Text format
0580: 74 69 6e 67 0a 0a 23 20 23 20 23 23 20 23 23 23  ting..# # ## ###
0590: 20 23 23 23 23 23 20 23 23 23 23 23 23 23 23 20   ##### ######## 
05a0: 23 23 23 23 23 23 23 23 23 23 23 23 23 20 23 23  ############# ##
05b0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23  ################
05c0: 23 23 23 0a 23 23 0a 0a 73 6e 69 74 3a 3a 74 79  ###.##..snit::ty
05d0: 70 65 20 3a 3a 76 63 3a 3a 66 6f 73 73 69 6c 3a  pe ::vc::fossil:
05e0: 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a 66 69  :import::cvs::fi
05f0: 6c 65 20 7b 0a 20 20 20 20 23 20 23 20 23 23 20  le {.    # # ## 
0600: 23 23 23 20 23 23 23 23 23 20 23 23 23 23 23 23  ### ##### ######
0610: 23 23 20 23 23 23 23 23 23 23 23 23 23 23 23 23  ## #############
0620: 0a 20 20 20 20 23 23 20 50 75 62 6c 69 63 20 41  .    ## Public A
0630: 50 49 0a 0a 20 20 20 20 63 6f 6e 73 74 72 75 63  PI..    construc
0640: 74 6f 72 20 7b 69 64 20 70 61 74 68 20 75 73 72  tor {id path usr
0650: 70 61 74 68 20 65 78 65 63 75 74 61 62 6c 65 20  path executable 
0660: 70 72 6f 6a 65 63 74 7d 20 7b 0a 09 73 65 74 20  project} {..set 
0670: 6d 79 69 64 20 20 20 20 20 20 20 20 20 24 69 64  myid         $id
0680: 0a 09 73 65 74 20 6d 79 70 61 74 68 20 20 20 20  ..set mypath    
0690: 20 20 20 24 70 61 74 68 0a 09 73 65 74 20 6d 79     $path..set my
06a0: 75 73 72 70 61 74 68 20 20 20 20 24 75 73 72 70  usrpath    $usrp
06b0: 61 74 68 0a 09 73 65 74 20 6d 79 65 78 65 63 75  ath..set myexecu
06c0: 74 61 62 6c 65 20 24 65 78 65 63 75 74 61 62 6c  table $executabl
06d0: 65 0a 09 73 65 74 20 6d 79 70 72 6f 6a 65 63 74  e..set myproject
06e0: 20 20 20 20 24 70 72 6f 6a 65 63 74 0a 09 73 65      $project..se
06f0: 74 20 6d 79 74 72 75 6e 6b 20 20 20 20 20 20 5b  t mytrunk      [
0700: 24 6d 79 70 72 6f 6a 65 63 74 20 74 72 75 6e 6b  $myproject trunk
0710: 5d 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a  ]..return.    }.
0720: 0a 20 20 20 20 6d 65 74 68 6f 64 20 73 65 74 69  .    method seti
0730: 64 20 7b 69 64 7d 20 7b 0a 09 69 6e 74 65 67 72  d {id} {..integr
0740: 69 74 79 20 61 73 73 65 72 74 20 7b 24 6d 79 69  ity assert {$myi
0750: 64 20 65 71 20 22 22 7d 20 7b 46 69 6c 65 20 27  d eq ""} {File '
0760: 24 6d 79 70 61 74 68 27 20 61 6c 72 65 61 64 79  $mypath' already
0770: 20 68 61 73 20 61 6e 20 69 64 2c 20 27 24 6d 79   has an id, '$my
0780: 69 64 27 7d 0a 09 73 65 74 20 6d 79 69 64 20 24  id'}..set myid $
0790: 69 64 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 7d  id..return.    }
07a0: 0a 0a 20 20 20 20 6d 65 74 68 6f 64 20 69 64 20  ..    method id 
07b0: 20 20 20 20 20 7b 7d 20 7b 20 72 65 74 75 72 6e       {} { return
07c0: 20 24 6d 79 69 64 20 7d 0a 20 20 20 20 6d 65 74   $myid }.    met
07d0: 68 6f 64 20 70 61 74 68 20 20 20 20 7b 7d 20 7b  hod path    {} {
07e0: 20 72 65 74 75 72 6e 20 24 6d 79 70 61 74 68 20   return $mypath 
07f0: 7d 0a 20 20 20 20 6d 65 74 68 6f 64 20 75 73 72  }.    method usr
0800: 70 61 74 68 20 7b 7d 20 7b 20 72 65 74 75 72 6e  path {} { return
0810: 20 24 6d 79 75 73 72 70 61 74 68 20 7d 0a 20 20   $myusrpath }.  
0820: 20 20 6d 65 74 68 6f 64 20 70 72 6f 6a 65 63 74    method project
0830: 20 7b 7d 20 7b 20 72 65 74 75 72 6e 20 24 6d 79   {} { return $my
0840: 70 72 6f 6a 65 63 74 20 7d 0a 0a 20 20 20 20 64  project }..    d
0850: 65 6c 65 67 61 74 65 20 6d 65 74 68 6f 64 20 63  elegate method c
0860: 6f 6d 6d 69 74 6d 65 73 73 61 67 65 6f 66 20 74  ommitmessageof t
0870: 6f 20 6d 79 70 72 6f 6a 65 63 74 0a 0a 20 20 20  o myproject..   
0880: 20 23 20 23 20 23 23 20 23 23 23 20 23 23 23 23   # # ## ### ####
0890: 23 20 23 23 23 23 23 23 23 23 20 23 23 23 23 23  # ######## #####
08a0: 23 23 23 23 23 23 23 23 0a 20 20 20 20 23 23 20  ########.    ## 
08b0: 4d 65 74 68 6f 64 73 20 72 65 71 75 69 72 65 64  Methods required
08c0: 20 66 6f 72 20 74 68 65 20 63 6c 61 73 73 20 74   for the class t
08d0: 6f 20 62 65 20 61 20 73 69 6e 6b 20 6f 66 20 74  o be a sink of t
08e0: 68 65 20 72 63 73 20 70 61 72 73 65 72 0a 0a 20  he rcs parser.. 
08f0: 20 20 20 23 6d 65 74 68 6f 64 20 62 65 67 69 6e     #method begin
0900: 20 7b 7d 20 7b 70 75 74 73 20 62 65 67 69 6e 7d   {} {puts begin}
0910: 0a 20 20 20 20 23 6d 65 74 68 6f 64 20 73 65 74  .    #method set
0920: 68 65 61 64 20 7b 68 7d 20 7b 70 75 74 73 20 68  head {h} {puts h
0930: 65 61 64 3d 24 68 7d 0a 20 20 20 20 23 6d 65 74  ead=$h}.    #met
0940: 68 6f 64 20 73 65 74 70 72 69 6e 63 69 70 61 6c  hod setprincipal
0950: 62 72 61 6e 63 68 20 7b 62 7d 20 7b 70 75 74 73  branch {b} {puts
0960: 20 70 62 3d 24 62 7d 0a 20 20 20 20 23 6d 65 74   pb=$b}.    #met
0970: 68 6f 64 20 64 65 66 74 61 67 20 7b 73 20 72 7d  hod deftag {s r}
0980: 20 7b 70 75 74 73 20 24 73 3d 24 72 7d 0a 20 20   {puts $s=$r}.  
0990: 20 20 23 6d 65 74 68 6f 64 20 73 65 74 63 6f 6d    #method setcom
09a0: 6d 65 6e 74 20 7b 63 7d 20 7b 70 75 74 73 20 63  ment {c} {puts c
09b0: 6f 6d 6d 65 6e 74 3d 24 63 7d 0a 20 20 20 20 23  omment=$c}.    #
09c0: 6d 65 74 68 6f 64 20 61 64 6d 69 6e 64 6f 6e 65  method admindone
09d0: 20 7b 7d 20 7b 70 75 74 73 20 61 64 6d 69 6e 64   {} {puts admind
09e0: 6f 6e 65 7d 0a 20 20 20 20 23 6d 65 74 68 6f 64  one}.    #method
09f0: 20 64 65 66 20 7b 72 65 76 20 64 61 74 65 20 61   def {rev date a
0a00: 75 74 68 6f 72 20 73 74 61 74 65 20 6e 65 78 74  uthor state next
0a10: 20 62 72 61 6e 63 68 65 73 7d 20 7b 70 75 74 73   branches} {puts
0a20: 20 22 64 65 66 20 24 72 65 76 20 24 64 61 74 65   "def $rev $date
0a30: 20 24 61 75 74 68 6f 72 20 24 73 74 61 74 65 20   $author $state 
0a40: 24 6e 65 78 74 20 24 62 72 61 6e 63 68 65 73 22  $next $branches"
0a50: 7d 0a 20 20 20 20 23 6d 65 74 68 6f 64 20 64 65  }.    #method de
0a60: 66 64 6f 6e 65 20 7b 7d 20 7b 70 75 74 73 20 64  fdone {} {puts d
0a70: 65 66 2d 64 6f 6e 65 7d 0a 20 20 20 20 23 6d 65  ef-done}.    #me
0a80: 74 68 6f 64 20 73 65 74 64 65 73 63 20 7b 64 7d  thod setdesc {d}
0a90: 20 7b 70 75 74 73 20 64 65 73 63 3d 24 64 7d 0a   {puts desc=$d}.
0aa0: 20 20 20 20 23 6d 65 74 68 6f 64 20 65 78 74 65      #method exte
0ab0: 6e 64 20 7b 72 65 76 20 63 6f 6d 6d 69 74 6d 73  nd {rev commitms
0ac0: 67 20 64 65 6c 74 61 72 61 6e 67 65 7d 20 7b 70  g deltarange} {p
0ad0: 75 74 73 20 22 65 78 74 65 6e 64 20 24 63 6f 6d  uts "extend $com
0ae0: 6d 69 74 6d 73 67 20 24 64 65 6c 74 61 72 61 6e  mitmsg $deltaran
0af0: 67 65 22 7d 0a 20 20 20 20 23 6d 65 74 68 6f 64  ge"}.    #method
0b00: 20 64 6f 6e 65 20 7b 7d 20 7b 70 75 74 73 20 64   done {} {puts d
0b10: 6f 6e 65 7d 0a 0a 20 20 20 20 23 20 23 20 23 23  one}..    # # ##
0b20: 20 23 23 23 20 23 23 23 23 23 20 23 23 23 23 23   ### ##### #####
0b30: 23 23 23 20 23 23 23 23 23 23 23 23 23 23 23 23  ### ############
0b40: 23 0a 20 20 20 20 23 23 20 50 65 72 73 69 73 74  #.    ## Persist
0b50: 65 6e 63 65 20 28 70 61 73 73 20 49 49 29 0a 0a  ence (pass II)..
0b60: 20 20 20 20 6d 65 74 68 6f 64 20 70 65 72 73 69      method persi
0b70: 73 74 20 7b 7d 20 7b 0a 09 23 20 46 69 72 73 74  st {} {..# First
0b80: 20 63 6f 6c 6c 65 63 74 20 74 68 65 20 72 65 61   collect the rea
0b90: 63 68 61 62 6c 65 20 72 65 76 69 73 69 6f 6e 73  chable revisions
0ba0: 20 61 6e 64 20 73 79 6d 62 6f 6c 73 2c 20 74 68   and symbols, th
0bb0: 65 6e 0a 09 23 20 61 73 73 69 67 6e 20 69 64 27  en..# assign id'
0bc0: 73 20 74 6f 20 61 6c 6c 2e 20 54 68 65 79 20 61  s to all. They a
0bd0: 72 65 20 73 6f 72 74 65 64 20 73 6f 20 74 68 61  re sorted so tha
0be0: 74 20 77 65 20 77 69 6c 6c 20 68 61 76 65 20 69  t we will have i
0bf0: 64 73 0a 09 23 20 77 68 69 63 68 20 73 6f 72 74  ds..# which sort
0c00: 20 69 6e 20 6f 72 64 65 72 20 6f 66 20 63 72 65   in order of cre
0c10: 61 74 69 6f 6e 2e 20 54 68 65 6e 20 77 65 20 63  ation. Then we c
0c20: 61 6e 20 73 61 76 65 20 74 68 65 6d 2e 20 54 68  an save them. Th
0c30: 69 73 0a 09 23 20 69 73 20 64 6f 6e 65 20 62 6f  is..# is done bo
0c40: 74 74 6f 6d 20 75 70 2e 20 52 65 76 69 73 69 6f  ttom up. Revisio
0c50: 6e 73 2c 20 74 68 65 6e 20 73 79 6d 62 6f 6c 73  ns, then symbols
0c60: 2e 20 5f 5f 4e 4f 54 45 5f 5f 20 54 68 69 73 0a  . __NOTE__ This.
0c70: 09 23 20 77 6f 72 6b 73 20 6f 6e 6c 79 20 62 65  .# works only be
0c80: 63 61 75 73 65 20 73 71 6c 69 74 65 20 69 73 20  cause sqlite is 
0c90: 6e 6f 74 20 63 68 65 63 6b 69 6e 67 20 66 6f 72  not checking for
0ca0: 65 69 67 6e 20 6b 65 79 0a 09 23 20 72 65 66 65  eign key..# refe
0cb0: 72 65 6e 63 65 73 20 64 75 72 69 6e 67 20 69 6e  rences during in
0cc0: 73 65 72 74 2e 20 54 68 69 73 20 61 6c 6c 6f 77  sert. This allow
0cd0: 73 20 74 6f 20 68 61 76 65 20 64 61 6e 67 6c 69  s to have dangli
0ce0: 6e 67 0a 09 23 20 72 65 66 65 72 65 6e 63 65 73  ng..# references
0cf0: 20 77 68 69 63 68 20 61 72 65 20 66 69 78 65 64   which are fixed
0d00: 20 6c 61 74 65 72 2e 20 54 68 65 20 6c 6f 6e 67   later. The long
0d10: 65 73 74 20 64 61 6e 67 6c 69 6e 67 0a 09 23 20  est dangling..# 
0d20: 72 65 66 65 72 65 6e 63 65 73 20 61 72 65 20 66  references are f
0d30: 6f 72 20 74 68 65 20 70 72 6f 6a 65 63 74 20 6c  or the project l
0d40: 65 76 65 6c 20 73 79 6d 62 6f 6c 73 2c 20 74 68  evel symbols, th
0d50: 65 73 65 20 77 65 20 64 6f 0a 09 23 20 6e 6f 74  ese we do..# not
0d60: 20 73 61 76 65 20 68 65 72 65 2c 20 62 75 74 20   save here, but 
0d70: 61 74 20 74 68 65 20 65 6e 64 20 6f 66 20 74 68  at the end of th
0d80: 65 20 70 61 73 73 2e 20 57 68 61 74 20 77 65 20  e pass. What we 
0d90: 6e 65 65 64 20 61 72 65 0a 09 23 20 74 68 65 20  need are..# the 
0da0: 69 64 73 2c 20 68 65 6e 63 65 20 74 68 65 20 74  ids, hence the t
0db0: 77 6f 20 70 68 61 73 65 73 2e 0a 0a 09 73 74 72  wo phases....str
0dc0: 75 63 74 3a 3a 6c 69 73 74 20 61 73 73 69 67 6e  uct::list assign
0dd0: 20 5b 24 73 65 6c 66 20 41 63 74 69 76 65 5d 20   [$self Active] 
0de0: 72 65 76 69 73 69 6f 6e 73 20 73 79 6d 62 6f 6c  revisions symbol
0df0: 73 0a 09 66 6f 72 65 61 63 68 20 72 65 76 20 24  s..foreach rev $
0e00: 72 65 76 69 73 69 6f 6e 73 20 7b 20 24 72 65 76  revisions { $rev
0e10: 20 64 65 66 69 64 20 7d 0a 09 66 6f 72 65 61 63   defid }..foreac
0e20: 68 20 73 79 6d 20 24 73 79 6d 62 6f 6c 73 20 20  h sym $symbols  
0e30: 20 7b 20 24 73 79 6d 20 64 65 66 69 64 20 7d 0a   { $sym defid }.
0e40: 0a 09 73 74 61 74 65 20 74 72 61 6e 73 61 63 74  ..state transact
0e50: 69 6f 6e 20 7b 0a 09 20 20 20 20 66 6f 72 65 61  ion {..    forea
0e60: 63 68 20 72 65 76 20 24 72 65 76 69 73 69 6f 6e  ch rev $revision
0e70: 73 20 7b 20 24 72 65 76 20 70 65 72 73 69 73 74  s { $rev persist
0e80: 20 7d 0a 09 20 20 20 20 66 6f 72 65 61 63 68 20   }..    foreach 
0e90: 73 79 6d 20 24 73 79 6d 62 6f 6c 73 20 20 20 7b  sym $symbols   {
0ea0: 20 24 73 79 6d 20 70 65 72 73 69 73 74 20 7d 0a   $sym persist }.
0eb0: 09 7d 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 7d  .}..return.    }
0ec0: 0a 0a 20 20 20 20 6d 65 74 68 6f 64 20 64 72 6f  ..    method dro
0ed0: 70 20 7b 7d 20 7b 0a 09 66 6f 72 65 61 63 68 20  p {} {..foreach 
0ee0: 7b 5f 20 72 65 76 7d 20 20 20 20 5b 61 72 72 61  {_ rev}    [arra
0ef0: 79 20 67 65 74 20 6d 79 72 65 76 5d 20 20 20 20  y get myrev]    
0f00: 20 20 7b 20 24 72 65 76 20 64 65 73 74 72 6f 79    { $rev destroy
0f10: 20 7d 0a 09 66 6f 72 65 61 63 68 20 7b 5f 20 62   }..foreach {_ b
0f20: 72 61 6e 63 68 7d 20 5b 61 72 72 61 79 20 67 65  ranch} [array ge
0f30: 74 20 6d 79 62 72 61 6e 63 68 65 73 5d 20 7b 20  t mybranches] { 
0f40: 24 62 72 61 6e 63 68 20 64 65 73 74 72 6f 79 20  $branch destroy 
0f50: 7d 0a 09 66 6f 72 65 61 63 68 20 7b 5f 20 74 61  }..foreach {_ ta
0f60: 67 6c 69 73 74 7d 20 5b 61 72 72 61 79 20 67 65  glist} [array ge
0f70: 74 20 6d 79 74 61 67 73 5d 20 7b 0a 09 20 20 20  t mytags] {..   
0f80: 20 66 6f 72 65 61 63 68 20 74 61 67 20 24 74 61   foreach tag $ta
0f90: 67 6c 69 73 74 20 7b 20 24 74 61 67 20 64 65 73  glist { $tag des
0fa0: 74 72 6f 79 20 7d 0a 09 7d 0a 09 72 65 74 75 72  troy }..}..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 20 20 20 20 23 23 20 49 6d 70 6c  ####.    ## Impl
0ff0: 65 6d 65 6e 74 20 74 68 65 20 73 69 6e 6b 0a 0a  ement the sink..
1000: 20 20 20 20 6d 65 74 68 6f 64 20 62 65 67 69 6e      method begin
1010: 20 7b 7d 20 7b 23 69 67 6e 6f 72 65 7d 0a 0a 20   {} {#ignore}.. 
1020: 20 20 20 6d 65 74 68 6f 64 20 73 65 74 68 65 61     method sethea
1030: 64 20 7b 72 65 76 6e 72 7d 20 7b 0a 09 73 65 74  d {revnr} {..set
1040: 20 6d 79 68 65 61 64 72 65 76 6e 72 20 24 72 65   myheadrevnr $re
1050: 76 6e 72 0a 09 72 65 74 75 72 6e 0a 20 20 20 20  vnr..return.    
1060: 7d 0a 0a 20 20 20 20 6d 65 74 68 6f 64 20 73 65  }..    method se
1070: 74 70 72 69 6e 63 69 70 61 6c 62 72 61 6e 63 68  tprincipalbranch
1080: 20 7b 62 72 61 6e 63 68 6e 72 7d 20 7b 0a 09 73   {branchnr} {..s
1090: 65 74 20 6d 79 70 72 69 6e 63 69 70 61 6c 20 24  et myprincipal $
10a0: 62 72 61 6e 63 68 6e 72 0a 09 72 65 74 75 72 6e  branchnr..return
10b0: 0a 20 20 20 20 7d 0a 0a 20 20 20 20 6d 65 74 68  .    }..    meth
10c0: 6f 64 20 64 65 66 74 61 67 20 7b 6e 61 6d 65 20  od deftag {name 
10d0: 72 65 76 6e 72 7d 20 7b 0a 09 23 20 46 55 54 55  revnr} {..# FUTU
10e0: 52 45 3a 20 50 65 72 66 6f 72 6d 20 73 79 6d 62  RE: Perform symb
10f0: 6f 6c 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f  ol transformatio
1100: 6e 20 68 65 72 65 2e 0a 0a 09 69 66 20 7b 5b 73  n here....if {[s
1110: 74 72 75 63 74 3a 3a 73 65 74 20 63 6f 6e 74 61  truct::set conta
1120: 69 6e 73 20 24 6d 79 73 79 6d 62 6f 6c 73 20 24  ins $mysymbols $
1130: 6e 61 6d 65 5d 7d 20 7b 0a 09 20 20 20 20 74 72  name]} {..    tr
1140: 6f 75 62 6c 65 20 66 61 74 61 6c 20 22 4d 75 6c  ouble fatal "Mul
1150: 74 69 70 6c 65 20 64 65 66 69 6e 69 74 69 6f 6e  tiple definition
1160: 73 20 6f 66 20 74 68 65 20 73 79 6d 62 6f 6c 20  s of the symbol 
1170: 27 24 6e 61 6d 65 27 20 69 6e 20 27 24 6d 79 70  '$name' in '$myp
1180: 61 74 68 27 22 0a 09 20 20 20 20 72 65 74 75 72  ath'"..    retur
1190: 6e 0a 09 7d 0a 0a 09 73 74 72 75 63 74 3a 3a 73  n..}...struct::s
11a0: 65 74 20 61 64 64 20 6d 79 73 79 6d 62 6f 6c 73  et add mysymbols
11b0: 20 24 6e 61 6d 65 0a 0a 09 69 66 20 7b 5b 72 65   $name...if {[re
11c0: 76 20 69 73 62 72 61 6e 63 68 72 65 76 6e 72 20  v isbranchrevnr 
11d0: 24 72 65 76 6e 72 20 2d 3e 20 62 72 61 6e 63 68  $revnr -> branch
11e0: 6e 72 5d 7d 20 7b 0a 09 20 20 20 20 24 73 65 6c  nr]} {..    $sel
11f0: 66 20 41 64 64 42 72 61 6e 63 68 20 24 6e 61 6d  f AddBranch $nam
1200: 65 20 24 62 72 61 6e 63 68 6e 72 0a 09 7d 20 65  e $branchnr..} e
1210: 6c 73 65 20 7b 0a 09 20 20 20 20 24 73 65 6c 66  lse {..    $self
1220: 20 41 64 64 54 61 67 20 24 6e 61 6d 65 20 24 72   AddTag $name $r
1230: 65 76 6e 72 0a 09 7d 0a 09 72 65 74 75 72 6e 0a  evnr..}..return.
1240: 20 20 20 20 7d 0a 0a 20 20 20 20 6d 65 74 68 6f      }..    metho
1250: 64 20 73 65 74 63 6f 6d 6d 65 6e 74 20 7b 63 7d  d setcomment {c}
1260: 20 7b 23 20 69 67 6e 6f 72 65 7d 0a 0a 20 20 20   {# ignore}..   
1270: 20 6d 65 74 68 6f 64 20 61 64 6d 69 6e 64 6f 6e   method admindon
1280: 65 20 7b 7d 20 7b 0a 09 23 20 57 65 20 64 6f 20  e {} {..# We do 
1290: 6e 6f 74 68 69 6e 67 20 61 74 20 74 68 65 20 62  nothing at the b
12a0: 6f 75 6e 64 61 72 79 20 6f 66 20 61 64 6d 69 6e  oundary of admin
12b0: 20 61 6e 64 20 72 65 76 69 73 69 6f 6e 20 64 61   and revision da
12c0: 74 61 0a 20 20 20 20 7d 0a 0a 20 20 20 20 6d 65  ta.    }..    me
12d0: 74 68 6f 64 20 64 65 66 20 7b 72 65 76 6e 72 20  thod def {revnr 
12e0: 64 61 74 65 20 61 75 74 68 6f 72 20 73 74 61 74  date author stat
12f0: 65 20 6e 65 78 74 20 62 72 61 6e 63 68 65 73 7d  e next branches}
1300: 20 7b 0a 09 24 73 65 6c 66 20 52 65 63 6f 72 64   {..$self Record
1310: 42 72 61 6e 63 68 43 6f 6d 6d 69 74 73 20 24 62  BranchCommits $b
1320: 72 61 6e 63 68 65 73 0a 0a 09 69 66 20 7b 5b 69  ranches...if {[i
1330: 6e 66 6f 20 65 78 69 73 74 73 20 6d 79 72 65 76  nfo exists myrev
1340: 28 24 72 65 76 6e 72 29 5d 7d 20 7b 0a 09 20 20  ($revnr)]} {..  
1350: 20 20 74 72 6f 75 62 6c 65 20 66 61 74 61 6c 20    trouble fatal 
1360: 22 46 69 6c 65 20 24 6d 79 70 61 74 68 20 63 6f  "File $mypath co
1370: 6e 74 61 69 6e 73 20 64 75 70 6c 69 63 61 74 65  ntains duplicate
1380: 20 64 65 66 69 6e 69 74 69 6f 6e 73 20 66 6f 72   definitions for
1390: 20 72 65 76 69 73 69 6f 6e 20 24 72 65 76 6e 72   revision $revnr
13a0: 2e 22 0a 09 20 20 20 20 72 65 74 75 72 6e 0a 09  ."..    return..
13b0: 7d 0a 0a 09 73 65 74 20 6d 79 61 69 64 28 24 72  }...set myaid($r
13c0: 65 76 6e 72 29 20 5b 24 6d 79 70 72 6f 6a 65 63  evnr) [$myprojec
13d0: 74 20 64 65 66 61 75 74 68 6f 72 20 24 61 75 74  t defauthor $aut
13e0: 68 6f 72 5d 0a 09 73 65 74 20 6d 79 72 65 76 28  hor]..set myrev(
13f0: 24 72 65 76 6e 72 29 20 5b 72 65 76 20 25 41 55  $revnr) [rev %AU
1400: 54 4f 25 20 24 72 65 76 6e 72 20 24 64 61 74 65  TO% $revnr $date
1410: 20 24 73 74 61 74 65 20 24 73 65 6c 66 5d 0a 0a   $state $self]..
1420: 09 24 73 65 6c 66 20 52 65 63 6f 72 64 42 61 73  .$self RecordBas
1430: 69 63 44 65 70 65 6e 64 65 6e 63 69 65 73 20 24  icDependencies $
1440: 72 65 76 6e 72 20 24 6e 65 78 74 0a 09 72 65 74  revnr $next..ret
1450: 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 6d  urn.    }..    m
1460: 65 74 68 6f 64 20 64 65 66 64 6f 6e 65 20 7b 7d  ethod defdone {}
1470: 20 7b 0a 09 23 20 54 68 69 73 20 69 73 20 61 6c   {..# This is al
1480: 6c 20 64 6f 6e 65 20 61 66 74 65 72 20 74 68 65  l done after the
1490: 20 72 65 76 69 73 69 6f 6e 20 74 72 65 65 20 68   revision tree h
14a0: 61 73 20 62 65 65 6e 20 65 78 74 72 61 63 74 65  as been extracte
14b0: 64 0a 09 23 20 66 72 6f 6d 20 74 68 65 20 66 69  d..# from the fi
14c0: 6c 65 2c 20 62 65 66 6f 72 65 20 74 68 65 20 63  le, before the c
14d0: 6f 6d 6d 69 74 20 6d 65 73 61 67 65 73 20 61 6e  ommit mesages an
14e0: 64 20 64 65 6c 74 61 20 74 65 78 74 73 20 61 72  d delta texts ar
14f0: 65 0a 09 23 20 70 72 6f 63 65 73 73 65 64 2e 0a  e..# processed..
1500: 0a 09 24 73 65 6c 66 20 50 72 6f 63 65 73 73 50  ..$self ProcessP
1510: 72 69 6d 61 72 79 44 65 70 65 6e 64 65 6e 63 69  rimaryDependenci
1520: 65 73 0a 09 24 73 65 6c 66 20 50 72 6f 63 65 73  es..$self Proces
1530: 73 42 72 61 6e 63 68 44 65 70 65 6e 64 65 6e 63  sBranchDependenc
1540: 69 65 73 0a 09 24 73 65 6c 66 20 53 6f 72 74 42  ies..$self SortB
1550: 72 61 6e 63 68 65 73 0a 09 24 73 65 6c 66 20 50  ranches..$self P
1560: 72 6f 63 65 73 73 54 61 67 44 65 70 65 6e 64 65  rocessTagDepende
1570: 6e 63 69 65 73 0a 09 24 73 65 6c 66 20 44 65 74  ncies..$self Det
1580: 65 72 6d 69 6e 65 54 68 65 52 6f 6f 74 52 65 76  ermineTheRootRev
1590: 69 73 69 6f 6e 0a 09 72 65 74 75 72 6e 0a 20 20  ision..return.  
15a0: 20 20 7d 0a 0a 20 20 20 20 6d 65 74 68 6f 64 20    }..    method 
15b0: 73 65 74 64 65 73 63 20 7b 64 7d 20 7b 23 20 69  setdesc {d} {# i
15c0: 67 6e 6f 72 65 7d 0a 0a 20 20 20 20 6d 65 74 68  gnore}..    meth
15d0: 6f 64 20 65 78 74 65 6e 64 20 7b 72 65 76 6e 72  od extend {revnr
15e0: 20 63 6f 6d 6d 69 74 6d 73 67 20 74 65 78 74 72   commitmsg textr
15f0: 61 6e 67 65 7d 20 7b 0a 09 73 65 74 20 63 6d 69  ange} {..set cmi
1600: 64 20 5b 24 6d 79 70 72 6f 6a 65 63 74 20 64 65  d [$myproject de
1610: 66 63 6d 65 73 73 61 67 65 20 5b 73 74 72 69 6e  fcmessage [strin
1620: 67 20 74 72 69 6d 20 24 63 6f 6d 6d 69 74 6d 73  g trim $commitms
1630: 67 5d 5d 0a 0a 09 73 65 74 20 72 65 76 20 24 6d  g]]...set rev $m
1640: 79 72 65 76 28 24 72 65 76 6e 72 29 0a 0a 09 69  yrev($revnr)...i
1650: 66 20 7b 5b 24 72 65 76 20 68 61 73 6d 65 74 61  f {[$rev hasmeta
1660: 5d 7d 20 7b 0a 09 20 20 20 20 23 20 41 70 70 61  ]} {..    # Appa
1670: 72 65 6e 74 6c 79 20 72 65 70 6f 73 69 74 6f 72  rently repositor
1680: 69 65 73 20 65 78 69 73 74 20 69 6e 20 77 68 69  ies exist in whi
1690: 63 68 20 74 68 65 20 64 65 6c 74 61 20 64 61 74  ch the delta dat
16a0: 61 0a 09 20 20 20 20 23 20 66 6f 72 20 72 65 76  a..    # for rev
16b0: 69 73 69 6f 6e 20 31 2e 31 20 69 73 20 70 72 6f  ision 1.1 is pro
16c0: 76 69 64 65 64 20 73 65 76 65 72 61 6c 20 74 69  vided several ti
16d0: 6d 65 73 2c 20 61 74 20 6c 65 61 73 74 0a 09 20  mes, at least.. 
16e0: 20 20 20 23 20 74 77 69 63 65 2e 20 54 68 65 20     # twice. The 
16f0: 61 63 74 75 61 6c 20 63 61 75 73 65 20 6f 66 20  actual cause of 
1700: 74 68 69 73 20 64 75 70 6c 69 63 61 74 69 6f 6e  this duplication
1710: 20 69 73 20 6e 6f 74 0a 09 20 20 20 20 23 20 6b   is not..    # k
1720: 6e 6f 77 6e 2e 20 53 70 65 63 75 6c 61 74 69 6f  nown. Speculatio
1730: 6e 20 63 65 6e 74 65 72 73 20 6f 6e 20 52 43 53  n centers on RCS
1740: 2f 43 56 53 20 62 75 67 73 2c 20 6f 72 20 66 72  /CVS bugs, or fr
1750: 6f 6d 0a 09 20 20 20 20 23 20 6d 61 6e 75 61 6c  om..    # manual
1760: 20 65 64 69 74 73 20 6f 66 20 74 68 65 20 72 65   edits of the re
1770: 70 6f 73 69 74 6f 72 79 20 77 68 69 63 68 20 62  pository which b
1780: 6f 72 6b 65 64 20 74 68 65 0a 09 20 20 20 20 23  orked the..    #
1790: 20 69 6e 74 65 72 6e 61 6c 73 2e 20 57 68 61 74   internals. What
17a0: 65 76 65 72 20 74 68 65 20 63 61 75 73 65 2c 20  ever the cause, 
17b0: 74 65 73 74 69 6e 67 20 73 68 6f 77 65 64 20 74  testing showed t
17c0: 68 61 74 20 62 6f 74 68 0a 09 20 20 20 20 23 20  hat both..    # 
17d0: 63 76 73 20 61 6e 64 20 72 63 73 20 75 73 65 20  cvs and rcs use 
17e0: 74 68 65 20 66 69 72 73 74 20 64 65 66 69 6e 69  the first defini
17f0: 74 69 6f 6e 20 77 68 65 6e 20 70 65 72 66 6f 72  tion when perfor
1800: 6d 69 6e 67 20 61 0a 09 20 20 20 20 23 20 63 68  ming a..    # ch
1810: 65 63 6b 6f 75 74 2c 20 61 6e 64 20 77 65 20 66  eckout, and we f
1820: 6f 6c 6c 6f 77 20 74 68 65 69 72 20 6c 65 61 64  ollow their lead
1830: 2e 20 53 69 64 65 20 6e 6f 74 65 73 3a 20 27 63  . Side notes: 'c
1840: 76 73 0a 09 20 20 20 20 23 20 6c 6f 67 27 20 66  vs..    # log' f
1850: 61 69 6c 73 20 6f 6e 20 73 75 63 68 20 61 20 66  ails on such a f
1860: 69 6c 65 2c 20 61 6e 64 20 27 63 76 73 20 72 6c  ile, and 'cvs rl
1870: 6f 67 27 20 70 72 69 6e 74 73 20 74 68 65 20 6c  og' prints the l
1880: 6f 67 0a 09 20 20 20 20 23 20 6d 65 73 73 61 67  og..    # messag
1890: 65 20 66 72 6f 6d 20 74 68 65 20 66 69 72 73 74  e from the first
18a0: 20 64 65 6c 74 61 2c 20 69 67 6e 6f 72 69 6e 67   delta, ignoring
18b0: 20 74 68 65 20 73 65 63 6f 6e 64 2e 0a 0a 09 20   the second.... 
18c0: 20 20 20 6c 6f 67 20 77 72 69 74 65 20 31 20 66     log write 1 f
18d0: 69 6c 65 20 22 49 6e 20 66 69 6c 65 20 24 6d 79  ile "In file $my
18e0: 70 61 74 68 20 3a 20 44 75 70 6c 69 63 61 74 65  path : Duplicate
18f0: 20 64 65 6c 74 61 20 64 61 74 61 20 66 6f 72 20   delta data for 
1900: 72 65 76 69 73 69 6f 6e 20 24 72 65 76 6e 72 22  revision $revnr"
1910: 0a 09 20 20 20 20 6c 6f 67 20 77 72 69 74 65 20  ..    log write 
1920: 31 20 66 69 6c 65 20 22 49 67 6e 6f 72 69 6e 67  1 file "Ignoring
1930: 20 74 68 65 20 64 75 70 6c 69 63 61 74 65 22 0a   the duplicate".
1940: 09 20 20 20 20 72 65 74 75 72 6e 0a 09 7d 0a 0a  .    return..}..
1950: 09 23 20 44 65 74 65 72 6d 69 6e 65 20 74 68 65  .# Determine the
1960: 20 6c 69 6e 65 20 6f 66 20 64 65 76 65 6c 6f 70   line of develop
1970: 6d 65 6e 74 20 66 6f 72 20 74 68 65 20 72 65 76  ment for the rev
1980: 69 73 69 6f 6e 20 28 70 72 6f 6a 65 63 74 0a 09  ision (project..
1990: 23 20 6c 65 76 65 6c 29 2e 20 54 68 69 73 20 67  # level). This g
19a0: 69 76 65 73 20 75 73 20 74 68 65 20 62 72 61 6e  ives us the bran
19b0: 63 68 69 64 20 74 6f 6f 2c 20 72 65 71 75 69 72  chid too, requir
19c0: 65 64 20 66 6f 72 20 74 68 65 0a 09 23 20 6d 65  ed for the..# me
19d0: 74 61 20 64 61 74 61 20 67 72 6f 75 70 20 74 68  ta data group th
19e0: 65 20 72 65 76 69 73 69 6f 6e 20 69 73 20 69 6e  e revision is in
19f0: 2e 20 28 4e 6f 74 65 3a 20 42 79 20 70 75 74 74  . (Note: By putt
1a00: 69 6e 67 20 62 6f 74 68 0a 09 23 20 62 72 61 6e  ing both..# bran
1a10: 63 68 2f 6c 6f 64 20 61 6e 64 20 70 72 6f 6a 65  ch/lod and proje
1a20: 63 74 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 69  ct information i
1a30: 6e 74 6f 20 74 68 65 20 67 72 6f 75 70 20 77 65  nto the group we
1a40: 20 65 6e 73 75 72 65 0a 09 23 20 74 68 61 74 20   ensure..# that 
1a50: 61 6e 79 20 63 72 6f 73 73 2d 70 72 6f 6a 65 63  any cross-projec
1a60: 74 20 61 6e 64 20 63 72 6f 73 73 2d 62 72 61 6e  t and cross-bran
1a70: 63 68 20 63 6f 6d 6d 69 74 73 20 61 72 65 0a 09  ch commits are..
1a80: 23 20 73 65 70 61 72 61 74 65 64 20 69 6e 74 6f  # separated into
1a90: 20 6d 75 6c 74 69 70 6c 65 20 63 6f 6d 6d 69 74   multiple commit
1aa0: 73 2c 20 6f 6e 65 20 69 6e 20 65 61 63 68 20 6f  s, one in each o
1ab0: 66 20 74 68 65 20 70 72 6f 6a 65 63 74 73 0a 09  f the projects..
1ac0: 23 20 61 6e 64 2f 6f 72 20 62 72 61 6e 63 68 65  # and/or branche
1ad0: 73 29 2e 0a 0a 09 73 65 74 20 6c 6f 64 20 5b 24  s)....set lod [$
1ae0: 73 65 6c 66 20 47 65 74 4c 4f 44 20 24 72 65 76  self GetLOD $rev
1af0: 6e 72 5d 0a 0a 09 24 72 65 76 20 73 65 74 6d 65  nr]...$rev setme
1b00: 74 61 20 5b 24 6d 79 70 72 6f 6a 65 63 74 20 64  ta [$myproject d
1b10: 65 66 6d 65 74 61 20 5b 24 6c 6f 64 20 69 64 5d  efmeta [$lod id]
1b20: 20 24 6d 79 61 69 64 28 24 72 65 76 6e 72 29 20   $myaid($revnr) 
1b30: 24 63 6d 69 64 5d 0a 09 24 72 65 76 20 73 65 74  $cmid]..$rev set
1b40: 74 65 78 74 20 24 74 65 78 74 72 61 6e 67 65 0a  text $textrange.
1b50: 09 24 72 65 76 20 73 65 74 6c 6f 64 20 20 24 6c  .$rev setlod  $l
1b60: 6f 64 0a 0a 09 23 20 49 66 20 74 68 69 73 20 69  od...# If this i
1b70: 73 20 72 65 76 69 73 69 6f 6e 20 31 2e 31 2c 20  s revision 1.1, 
1b80: 77 65 20 68 61 76 65 20 74 6f 20 64 65 74 65 72  we have to deter
1b90: 6d 69 6e 65 20 77 68 65 74 68 65 72 20 74 68 65  mine whether the
1ba0: 0a 09 23 20 66 69 6c 65 20 73 65 65 6d 73 20 74  ..# file seems t
1bb0: 6f 20 68 61 76 65 20 62 65 65 6e 20 63 72 65 61  o have been crea
1bc0: 74 65 64 20 74 68 72 6f 75 67 68 20 27 63 76 73  ted through 'cvs
1bd0: 20 61 64 64 27 20 69 6e 73 74 65 61 64 20 6f 66   add' instead of
1be0: 0a 09 23 20 27 63 76 73 20 69 6d 70 6f 72 74 27  ..# 'cvs import'
1bf0: 2e 20 54 68 69 73 20 63 61 6e 20 62 65 20 64 6f  . This can be do
1c00: 6e 65 20 62 79 20 6c 6f 6f 6b 69 6e 67 20 61 74  ne by looking at
1c10: 20 74 68 65 20 75 6e 2d 0a 09 23 20 61 64 75 6c   the un-..# adul
1c20: 74 65 72 61 74 65 64 20 63 6f 6d 6d 69 74 20 6d  terated commit m
1c30: 65 73 73 61 67 65 2c 20 61 73 20 43 56 53 20 75  essage, as CVS u
1c40: 73 65 73 20 61 20 68 61 72 64 77 69 72 65 64 20  ses a hardwired 
1c50: 6d 61 67 69 63 0a 09 23 20 6d 65 73 73 61 67 65  magic..# message
1c60: 20 66 6f 72 20 74 68 65 20 6c 61 74 74 65 72 2c   for the latter,
1c70: 20 69 2e 65 2e 20 22 49 6e 69 74 69 61 6c 20 72   i.e. "Initial r
1c80: 65 76 69 73 69 6f 6e 5c 6e 22 2c 20 6e 6f 0a 09  evision\n", no..
1c90: 23 20 70 65 72 69 6f 64 2e 20 20 28 54 68 69 73  # period.  (This
1ca0: 20 66 61 63 74 20 61 6c 73 6f 20 68 65 6c 70 73   fact also helps
1cb0: 20 75 73 20 77 68 65 6e 20 74 68 65 20 74 69 6d   us when the tim
1cc0: 65 20 63 6f 6d 65 73 20 74 6f 0a 09 23 20 64 65  e comes to..# de
1cd0: 74 65 72 6d 69 6e 65 20 77 68 65 74 68 65 72 20  termine whether 
1ce0: 74 68 69 73 20 66 69 6c 65 20 6d 69 67 68 74 20  this file might 
1cf0: 68 61 76 65 20 68 61 64 20 61 20 64 65 66 61 75  have had a defau
1d00: 6c 74 20 62 72 61 6e 63 68 0a 09 23 20 69 6e 20  lt branch..# in 
1d10: 74 68 65 20 70 61 73 74 2e 29 0a 0a 09 69 66 20  the past.)...if 
1d20: 7b 24 72 65 76 6e 72 20 65 71 20 22 31 2e 31 22  {$revnr eq "1.1"
1d30: 7d 20 7b 0a 09 20 20 20 20 73 65 74 20 6d 79 69  } {..    set myi
1d40: 6d 70 6f 72 74 65 64 20 5b 65 78 70 72 20 7b 24  mported [expr {$
1d50: 63 6f 6d 6d 69 74 6d 73 67 20 65 71 20 22 49 6e  commitmsg eq "In
1d60: 69 74 69 61 6c 20 72 65 76 69 73 69 6f 6e 5c 6e  itial revision\n
1d70: 22 7d 5d 0a 09 7d 0a 0a 09 23 20 48 65 72 65 20  "}]..}...# Here 
1d80: 77 65 20 61 6c 73 6f 20 6b 65 65 70 20 74 72 61  we also keep tra
1d90: 63 6b 20 6f 66 20 74 68 65 20 6f 72 64 65 72 20  ck of the order 
1da0: 69 6e 20 77 68 69 63 68 20 74 68 65 20 72 65 76  in which the rev
1db0: 69 73 69 6f 6e 73 0a 09 23 20 77 65 72 65 20 61  isions..# were a
1dc0: 64 64 65 64 20 74 6f 20 74 68 65 20 66 69 6c 65  dded to the file
1dd0: 2e 0a 0a 09 6c 61 70 70 65 6e 64 20 6d 79 72 65  ....lappend myre
1de0: 76 69 73 69 6f 6e 73 20 24 72 65 76 0a 09 72 65  visions $rev..re
1df0: 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20  turn.    }..    
1e00: 6d 65 74 68 6f 64 20 64 6f 6e 65 20 7b 7d 20 7b  method done {} {
1e10: 0a 09 23 20 43 6f 6d 70 6c 65 74 65 20 74 68 65  ..# Complete the
1e20: 20 72 65 76 69 73 69 6f 6e 73 2c 20 62 72 61 6e   revisions, bran
1e30: 63 68 65 73 2c 20 61 6e 64 20 74 61 67 73 2e 20  ches, and tags. 
1e40: 54 68 69 73 20 69 6e 63 6c 75 64 65 73 0a 09 23  This includes..#
1e50: 20 6c 6f 6f 6b 69 6e 67 20 66 6f 72 20 61 20 6e   looking for a n
1e60: 6f 6e 2d 74 72 75 6e 6b 20 64 65 66 61 75 6c 74  on-trunk default
1e70: 20 62 72 61 6e 63 68 2c 20 6d 61 72 6b 69 6e 67   branch, marking
1e80: 20 69 74 73 20 6d 65 6d 62 65 72 73 0a 09 23 20   its members..# 
1e90: 61 6e 64 20 6c 69 6e 6b 69 6e 67 20 74 68 65 6d  and linking them
1ea0: 20 69 6e 74 6f 20 74 68 65 20 74 72 75 6e 6b 2c   into the trunk,
1eb0: 20 70 6f 73 73 69 62 6c 79 20 65 78 63 6c 75 64   possibly exclud
1ec0: 69 6e 67 0a 09 23 20 6e 6f 6e 2d 74 72 75 6e 6b  ing..# non-trunk
1ed0: 20 64 61 74 61 2c 20 61 6e 64 20 63 6f 6c 6c 65   data, and colle
1ee0: 63 74 69 6e 67 20 61 67 67 72 65 67 61 74 65 20  cting aggregate 
1ef0: 73 79 6d 62 6f 6c 20 73 74 61 74 69 73 74 69 63  symbol statistic
1f00: 73 2e 0a 0a 09 24 73 65 6c 66 20 44 65 74 65 72  s....$self Deter
1f10: 6d 69 6e 65 52 65 76 69 73 69 6f 6e 4f 70 65 72  mineRevisionOper
1f20: 61 74 69 6f 6e 73 0a 09 24 73 65 6c 66 20 44 65  ations..$self De
1f30: 74 65 72 6d 69 6e 65 4c 69 6e 65 73 4f 66 44 65  termineLinesOfDe
1f40: 76 65 6c 6f 70 6d 65 6e 74 0a 09 24 73 65 6c 66  velopment..$self
1f50: 20 48 61 6e 64 6c 65 4e 6f 6e 54 72 75 6e 6b 44   HandleNonTrunkD
1f60: 65 66 61 75 6c 74 42 72 61 6e 63 68 0a 09 24 73  efaultBranch..$s
1f70: 65 6c 66 20 52 65 6d 6f 76 65 49 72 72 65 6c 65  elf RemoveIrrele
1f80: 76 61 6e 74 44 65 6c 65 74 69 6f 6e 73 0a 09 24  vantDeletions..$
1f90: 73 65 6c 66 20 52 65 6d 6f 76 65 49 6e 69 74 69  self RemoveIniti
1fa0: 61 6c 42 72 61 6e 63 68 44 65 6c 65 74 69 6f 6e  alBranchDeletion
1fb0: 73 0a 0a 09 69 66 20 7b 5b 24 6d 79 70 72 6f 6a  s...if {[$myproj
1fc0: 65 63 74 20 74 72 75 6e 6b 6f 6e 6c 79 5d 7d 20  ect trunkonly]} 
1fd0: 7b 0a 09 20 20 20 20 24 73 65 6c 66 20 45 78 63  {..    $self Exc
1fe0: 6c 75 64 65 4e 6f 6e 54 72 75 6e 6b 49 6e 66 6f  ludeNonTrunkInfo
1ff0: 72 6d 61 74 69 6f 6e 0a 09 7d 0a 0a 09 24 73 65  rmation..}...$se
2000: 6c 66 20 41 67 67 72 65 67 61 74 65 53 79 6d 62  lf AggregateSymb
2010: 6f 6c 44 61 74 61 0a 09 72 65 74 75 72 6e 0a 20  olData..return. 
2020: 20 20 20 7d 0a 0a 20 20 20 20 23 20 23 20 23 23     }..    # # ##
2030: 20 23 23 23 20 23 23 23 23 23 20 23 23 23 23 23   ### ##### #####
2040: 23 23 23 20 23 23 23 23 23 23 23 23 23 23 23 23  ### ############
2050: 23 0a 20 20 20 20 23 23 20 53 74 61 74 65 0a 0a  #.    ## State..
2060: 20 20 20 20 76 61 72 69 61 62 6c 65 20 6d 79 69      variable myi
2070: 64 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7b  d              {
2080: 7d 20 3b 20 23 20 46 69 6c 65 20 69 64 20 69 6e  } ; # File id in
2090: 20 74 68 65 20 70 65 72 73 69 73 74 65 6e 74 20   the persistent 
20a0: 73 74 61 74 65 2e 0a 20 20 20 20 76 61 72 69 61  state..    varia
20b0: 62 6c 65 20 6d 79 70 61 74 68 20 20 20 20 20 20  ble mypath      
20c0: 20 20 20 20 20 20 7b 7d 20 3b 20 23 20 50 61 74        {} ; # Pat
20d0: 68 20 6f 66 20 74 68 65 20 66 69 6c 65 27 73 20  h of the file's 
20e0: 72 63 73 20 61 72 63 68 69 76 65 2e 0a 20 20 20  rcs archive..   
20f0: 20 76 61 72 69 61 62 6c 65 20 6d 79 75 73 72 70   variable myusrp
2100: 61 74 68 20 20 20 20 20 20 20 20 20 7b 7d 20 3b  ath         {} ;
2110: 20 23 20 50 61 74 68 20 6f 66 20 74 68 65 20 66   # Path of the f
2120: 69 6c 65 20 61 73 20 73 65 65 6e 20 62 79 20 75  ile as seen by u
2130: 73 65 72 73 2e 0a 20 20 20 20 76 61 72 69 61 62  sers..    variab
2140: 6c 65 20 6d 79 65 78 65 63 75 74 61 62 6c 65 20  le myexecutable 
2150: 20 20 20 20 20 30 20 20 3b 20 23 20 42 6f 6f 6c       0  ; # Bool
2160: 65 61 6e 20 66 6c 61 67 20 27 66 69 6c 65 20 65  ean flag 'file e
2170: 78 65 63 75 74 61 62 6c 65 27 2e 0a 20 20 20 20  xecutable'..    
2180: 76 61 72 69 61 62 6c 65 20 6d 79 70 72 6f 6a 65  variable myproje
2190: 63 74 20 20 20 20 20 20 20 20 20 7b 7d 20 3b 20  ct         {} ; 
21a0: 23 20 52 65 66 65 72 65 6e 63 65 20 74 6f 20 74  # Reference to t
21b0: 68 65 20 70 72 6f 6a 65 63 74 20 6f 62 6a 65 63  he project objec
21c0: 74 0a 09 09 09 09 20 20 20 20 23 20 74 68 65 20  t.....    # the 
21d0: 66 69 6c 65 20 62 65 6c 6f 6e 67 73 20 74 6f 2e  file belongs to.
21e0: 0a 20 20 20 20 76 61 72 69 61 62 6c 65 20 6d 79  .    variable my
21f0: 72 65 76 20 2d 61 72 72 61 79 20 20 20 20 20 20  rev -array      
2200: 7b 7d 20 3b 20 23 20 4d 61 70 73 20 72 65 76 69  {} ; # Maps revi
2210: 73 69 6f 6e 20 6e 75 6d 62 65 72 20 74 6f 20 74  sion number to t
2220: 68 65 0a 09 09 09 09 20 20 20 20 23 20 61 73 73  he.....    # ass
2230: 6f 63 69 61 74 65 64 20 72 65 76 69 73 69 6f 6e  ociated revision
2240: 20 6f 62 6a 65 63 74 2e 0a 20 20 20 20 76 61 72   object..    var
2250: 69 61 62 6c 65 20 6d 79 72 65 76 69 73 69 6f 6e  iable myrevision
2260: 73 20 20 20 20 20 20 20 7b 7d 20 3b 20 23 20 53  s       {} ; # S
2270: 61 6d 65 20 61 73 20 6d 79 72 65 76 2c 20 62 75  ame as myrev, bu
2280: 74 20 61 20 6c 69 73 74 2c 0a 09 09 09 09 20 20  t a list,.....  
2290: 20 20 23 20 67 69 76 69 6e 67 20 75 73 20 74 68    # giving us th
22a0: 65 20 6f 72 64 65 72 20 6f 66 0a 09 09 09 09 20  e order of..... 
22b0: 20 20 20 23 20 72 65 76 69 73 69 6f 6e 73 2e 0a     # revisions..
22c0: 20 20 20 20 76 61 72 69 61 62 6c 65 20 6d 79 61      variable mya
22d0: 69 64 20 20 20 20 20 20 2d 61 72 72 61 79 20 7b  id      -array {
22e0: 7d 20 3b 20 23 20 4d 61 70 20 72 65 76 69 73 69  } ; # Map revisi
22f0: 6f 6e 20 6e 75 6d 62 65 72 73 20 74 6f 20 74 68  on numbers to th
2300: 65 20 69 64 0a 09 09 09 09 20 20 20 20 23 20 6f  e id.....    # o
2310: 66 20 74 68 65 20 61 75 74 68 6f 72 20 77 68 6f  f the author who
2320: 20 63 6f 6d 6d 69 74 74 65 64 0a 09 09 09 09 20   committed..... 
2330: 20 20 20 23 20 69 74 2e 20 54 68 69 73 20 69 73     # it. This is
2340: 20 6c 61 74 65 72 20 61 67 67 72 65 67 61 74 65   later aggregate
2350: 64 0a 09 09 09 09 20 20 20 20 23 20 77 69 74 68  d.....    # with
2360: 20 63 6f 6d 6d 69 74 20 6d 65 73 73 61 67 65 2c   commit message,
2370: 20 62 72 61 6e 63 68 20 6e 61 6d 65 0a 09 09 09   branch name....
2380: 09 20 20 20 20 23 20 61 6e 64 20 70 72 6f 6a 65  .    # and proje
2390: 63 74 20 69 64 20 66 6f 72 20 61 20 6d 65 74 61  ct id for a meta
23a0: 20 69 64 2e 0a 20 20 20 20 76 61 72 69 61 62 6c   id..    variabl
23b0: 65 20 6d 79 68 65 61 64 72 65 76 6e 72 20 20 20  e myheadrevnr   
23c0: 20 20 20 20 7b 7d 20 3b 20 23 20 48 65 61 64 20      {} ; # Head 
23d0: 72 65 76 69 73 69 6f 6e 20 28 72 65 76 69 73 69  revision (revisi
23e0: 6f 6e 20 6e 75 6d 62 65 72 29 0a 20 20 20 20 76  on number).    v
23f0: 61 72 69 61 62 6c 65 20 6d 79 70 72 69 6e 63 69  ariable myprinci
2400: 70 61 6c 20 20 20 20 20 20 20 7b 7d 20 3b 20 23  pal       {} ; #
2410: 20 50 72 69 6e 63 69 70 61 6c 20 62 72 61 6e 63   Principal branc
2420: 68 20 28 62 72 61 6e 63 68 20 6e 75 6d 62 65 72  h (branch number
2430: 29 2e 0a 09 09 09 09 20 20 20 20 23 20 43 6f 6e  )......    # Con
2440: 74 72 61 72 79 20 74 6f 20 74 68 65 20 6e 61 6d  trary to the nam
2450: 65 20 74 68 69 73 20 69 73 20 74 68 65 0a 09 09  e this is the...
2460: 09 09 20 20 20 20 23 20 64 65 66 61 75 6c 74 20  ..    # default 
2470: 62 72 61 6e 63 68 2e 0a 20 20 20 20 76 61 72 69  branch..    vari
2480: 61 62 6c 65 20 6d 79 64 65 70 65 6e 64 65 6e 63  able mydependenc
2490: 69 65 73 20 20 20 20 7b 7d 20 3b 20 23 20 44 69  ies    {} ; # Di
24a0: 63 74 69 6f 6e 61 72 79 20 70 61 72 65 6e 74 20  ctionary parent 
24b0: 2d 3e 20 63 68 69 6c 64 2c 0a 09 09 09 09 20 20  -> child,.....  
24c0: 20 20 23 20 72 65 63 6f 72 64 73 20 70 72 69 6d    # records prim
24d0: 61 72 79 20 64 65 70 65 6e 64 65 6e 63 69 65 73  ary dependencies
24e0: 2e 0a 20 20 20 20 76 61 72 69 61 62 6c 65 20 6d  ..    variable m
24f0: 79 69 6d 70 6f 72 74 65 64 20 20 20 20 20 20 20  yimported       
2500: 20 30 20 20 3b 20 23 20 42 6f 6f 6c 65 61 6e 20   0  ; # Boolean 
2510: 66 6c 61 67 2e 20 53 65 74 20 69 66 20 61 6e 64  flag. Set if and
2520: 20 6f 6e 6c 79 20 69 66 0a 09 09 09 09 20 20 20   only if.....   
2530: 20 23 20 72 65 76 20 31 2e 31 20 6f 66 20 74 68   # rev 1.1 of th
2540: 65 20 66 69 6c 65 20 73 65 65 6d 69 6e 67 6c 79  e file seemingly
2550: 0a 09 09 09 09 20 20 20 20 23 20 77 61 73 20 69  .....    # was i
2560: 6d 70 6f 72 74 65 64 20 69 6e 73 74 65 61 64 20  mported instead 
2570: 6f 66 20 61 64 64 65 64 0a 09 09 09 09 20 20 20  of added.....   
2580: 20 23 20 6e 6f 72 6d 61 6c 6c 79 2e 0a 20 20 20   # normally..   
2590: 20 76 61 72 69 61 62 6c 65 20 6d 79 72 6f 6f 74   variable myroot
25a0: 20 20 20 20 20 20 20 20 20 20 20 20 7b 7d 20 3b              {} ;
25b0: 20 23 20 52 65 66 65 72 65 6e 63 65 20 74 6f 20   # Reference to 
25c0: 74 68 65 20 72 65 76 69 73 69 6f 6e 20 6f 62 6a  the revision obj
25d0: 65 63 74 0a 09 09 09 09 20 20 20 20 23 20 68 6f  ect.....    # ho
25e0: 6c 64 69 6e 67 20 74 68 65 20 72 6f 6f 74 20 72  lding the root r
25f0: 65 76 69 73 69 6f 6e 2e 20 20 49 74 73 0a 09 09  evision.  Its...
2600: 09 09 20 20 20 20 23 20 6e 75 6d 62 65 72 20 75  ..    # number u
2610: 73 75 61 6c 6c 79 20 69 73 20 27 31 2e 31 27 2e  sually is '1.1'.
2620: 20 43 61 6e 20 62 65 0a 09 09 09 09 20 20 20 20   Can be.....    
2630: 23 20 61 20 64 69 66 66 65 72 65 6e 74 20 6e 75  # a different nu
2640: 6d 62 65 72 2c 20 62 65 63 61 75 73 65 20 6f 66  mber, because of
2650: 0a 09 09 09 09 20 20 20 20 23 20 67 61 70 73 20  .....    # gaps 
2660: 63 72 65 61 74 65 64 20 76 69 61 20 27 63 76 73  created via 'cvs
2670: 61 64 6d 69 6e 20 2d 6f 27 2e 0a 20 20 20 20 76  admin -o'..    v
2680: 61 72 69 61 62 6c 65 20 6d 79 62 72 61 6e 63 68  ariable mybranch
2690: 65 73 20 2d 61 72 72 61 79 20 7b 7d 20 3b 20 23  es -array {} ; #
26a0: 20 4d 61 70 73 20 62 72 61 6e 63 68 20 6e 75 6d   Maps branch num
26b0: 62 65 72 20 74 6f 20 74 68 65 20 73 79 6d 62 6f  ber to the symbo
26c0: 6c 0a 09 09 09 09 20 20 20 20 23 20 6f 62 6a 65  l.....    # obje
26d0: 63 74 20 68 61 6e 64 6c 69 6e 67 20 74 68 65 20  ct handling the 
26e0: 62 72 61 6e 63 68 2e 0a 20 20 20 20 76 61 72 69  branch..    vari
26f0: 61 62 6c 65 20 6d 79 74 61 67 73 20 20 20 20 20  able mytags     
2700: 2d 61 72 72 61 79 20 7b 7d 20 3b 20 23 20 4d 61  -array {} ; # Ma
2710: 70 73 20 72 65 76 69 73 69 6f 6e 20 6e 75 6d 62  ps revision numb
2720: 65 72 20 74 6f 20 74 68 65 20 6c 69 73 74 0a 09  er to the list..
2730: 09 09 09 20 20 20 20 23 20 6f 66 20 73 79 6d 62  ...    # of symb
2740: 6f 6c 20 6f 62 6a 65 63 74 73 20 66 6f 72 20 74  ol objects for t
2750: 68 65 20 74 61 67 73 0a 09 09 09 09 20 20 20 20  he tags.....    
2760: 23 20 61 73 73 6f 63 69 61 74 65 64 20 77 69 74  # associated wit
2770: 68 20 74 68 65 20 72 65 76 69 73 69 6f 6e 2e 0a  h the revision..
2780: 20 20 20 20 76 61 72 69 61 62 6c 65 20 6d 79 73      variable mys
2790: 79 6d 62 6f 6c 73 20 20 20 20 20 20 20 20 20 7b  ymbols         {
27a0: 7d 20 3b 20 23 20 53 65 74 20 6f 66 20 74 68 65  } ; # Set of the
27b0: 20 73 79 6d 62 6f 6c 20 6e 61 6d 65 73 20 66 6f   symbol names fo
27c0: 75 6e 64 20 69 6e 0a 09 09 09 09 20 20 20 20 23  und in.....    #
27d0: 20 74 68 69 73 20 66 69 6c 65 2e 0a 0a 20 20 20   this file...   
27e0: 20 76 61 72 69 61 62 6c 65 20 6d 79 62 72 61 6e   variable mybran
27f0: 63 68 63 6e 74 20 30 20 3b 20 23 20 43 6f 75 6e  chcnt 0 ; # Coun
2800: 74 65 72 20 66 6f 72 20 62 72 61 6e 63 68 65 73  ter for branches
2810: 2c 20 74 6f 20 72 65 63 6f 72 64 20 74 68 65 69  , to record thei
2820: 72 0a 09 09 09 20 20 20 20 20 23 20 6f 72 64 65  r....     # orde
2830: 72 20 6f 66 20 64 65 66 69 6e 69 74 69 6f 6e 2e  r of definition.
2840: 20 54 68 69 73 20 61 6c 73 6f 20 64 65 66 69 6e   This also defin
2850: 65 73 0a 09 09 09 20 20 20 20 20 23 20 74 68 65  es....     # the
2860: 69 72 20 6f 72 64 65 72 20 6f 66 20 63 72 65 61  ir order of crea
2870: 74 69 6f 6e 2c 20 77 68 69 63 68 20 69 73 20 74  tion, which is t
2880: 68 65 0a 09 09 09 20 20 20 20 20 23 20 72 65 76  he....     # rev
2890: 65 72 73 65 20 6f 66 20 64 65 66 69 6e 69 74 69  erse of definiti
28a0: 6f 6e 2e 20 20 49 2e 65 2e 20 61 20 73 6d 61 6c  on.  I.e. a smal
28b0: 6c 65 72 0a 09 09 09 20 20 20 20 20 23 20 6e 75  ler....     # nu
28c0: 6d 62 65 72 20 6d 65 61 6e 73 20 27 44 65 66 69  mber means 'Defi
28d0: 6e 65 64 20 65 61 72 6c 69 65 72 27 2c 20 6d 65  ned earlier', me
28e0: 61 6e 73 0a 09 09 09 20 20 20 20 20 23 20 27 43  ans....     # 'C
28f0: 72 65 61 74 65 64 20 6c 61 74 65 72 27 2e 0a 0a  reated later'...
2900: 20 20 20 20 76 61 72 69 61 62 6c 65 20 6d 79 74      variable myt
2910: 72 75 6e 6b 20 7b 7d 20 3b 20 23 20 44 69 72 65  runk {} ; # Dire
2920: 63 74 20 72 65 66 65 72 65 6e 63 65 20 74 6f 20  ct reference to 
2930: 6d 79 70 72 6f 6a 65 63 74 20 2d 3e 20 74 72 75  myproject -> tru
2940: 6e 6b 2e 0a 20 20 20 20 76 61 72 69 61 62 6c 65  nk..    variable
2950: 20 6d 79 72 6f 6f 74 73 20 7b 7d 20 3b 20 23 20   myroots {} ; # 
2960: 4c 69 73 74 20 6f 66 20 72 6f 6f 74 73 20 69 6e  List of roots in
2970: 20 74 68 65 20 66 6f 72 65 73 74 20 6f 66 0a 09   the forest of..
2980: 09 09 20 20 23 20 6c 6f 64 27 73 2e 20 4f 62 6a  ..  # lod's. Obj
2990: 65 63 74 20 72 65 66 65 72 65 6e 63 65 73 20 74  ect references t
29a0: 6f 20 72 65 76 69 73 69 6f 6e 73 20 61 6e 64 0a  o revisions and.
29b0: 09 09 09 20 20 23 20 62 72 61 6e 63 68 65 73 2e  ...  # branches.
29c0: 20 54 68 65 20 6c 61 74 74 65 72 20 63 61 6e 20   The latter can 
29d0: 61 70 70 65 61 72 20 77 68 65 6e 20 74 68 65 79  appear when they
29e0: 0a 09 09 09 20 20 23 20 61 72 65 20 73 65 76 65  ....  # are seve
29f0: 72 65 64 20 66 72 6f 6d 20 74 68 65 69 72 20 70  red from their p
2a00: 61 72 65 6e 74 2e 0a 0a 20 20 20 20 23 20 23 20  arent...    # # 
2a10: 23 23 20 23 23 23 20 23 23 23 23 23 20 23 23 23  ## ### ##### ###
2a20: 23 23 23 23 23 20 23 23 23 23 23 23 23 23 23 23  ##### ##########
2a30: 23 23 23 0a 20 20 20 20 23 23 20 49 6e 74 65 72  ###.    ## Inter
2a40: 6e 61 6c 20 6d 65 74 68 6f 64 73 0a 0a 20 20 20  nal methods..   
2a50: 20 6d 65 74 68 6f 64 20 52 65 63 6f 72 64 42 72   method RecordBr
2a60: 61 6e 63 68 43 6f 6d 6d 69 74 73 20 7b 62 72 61  anchCommits {bra
2a70: 6e 63 68 65 73 7d 20 7b 0a 09 66 6f 72 65 61 63  nches} {..foreac
2a80: 68 20 62 72 61 6e 63 68 72 65 76 6e 72 20 24 62  h branchrevnr $b
2a90: 72 61 6e 63 68 65 73 20 7b 0a 09 20 20 20 20 69  ranches {..    i
2aa0: 66 20 7b 5b 63 61 74 63 68 20 7b 0a 09 09 73 65  f {[catch {...se
2ab0: 74 20 62 72 61 6e 63 68 20 5b 24 73 65 6c 66 20  t branch [$self 
2ac0: 52 65 76 32 42 72 61 6e 63 68 20 24 62 72 61 6e  Rev2Branch $bran
2ad0: 63 68 72 65 76 6e 72 5d 0a 09 20 20 20 20 7d 5d  chrevnr]..    }]
2ae0: 7d 20 7b 0a 09 09 73 65 74 20 62 72 61 6e 63 68  } {...set branch
2af0: 20 5b 24 73 65 6c 66 20 41 64 64 55 6e 6c 61 62   [$self AddUnlab
2b00: 65 6c 65 64 42 72 61 6e 63 68 20 5b 72 65 76 20  eledBranch [rev 
2b10: 32 62 72 61 6e 63 68 6e 72 20 24 62 72 61 6e 63  2branchnr $branc
2b20: 68 72 65 76 6e 72 5d 5d 0a 09 20 20 20 20 7d 0a  hrevnr]]..    }.
2b30: 0a 09 20 20 20 20 23 20 52 65 63 6f 72 64 20 74  ..    # Record t
2b40: 68 65 20 63 6f 6d 6d 69 74 2c 20 6a 75 73 74 20  he commit, just 
2b50: 61 73 20 72 65 76 69 73 69 6f 6e 20 6e 75 6d 62  as revision numb
2b60: 65 72 20 66 6f 72 0a 09 20 20 20 20 23 20 6e 6f  er for..    # no
2b70: 77 2e 20 50 72 6f 63 65 73 42 72 61 6e 63 68 44  w. ProcesBranchD
2b80: 65 70 65 6e 64 65 6e 63 69 65 73 20 77 69 6c 6c  ependencies will
2b90: 20 65 78 74 65 6e 64 20 74 68 61 74 20 69 74 6f   extend that ito
2ba0: 20 61 0a 09 20 20 20 20 23 20 70 72 6f 70 65 72   a..    # proper
2bb0: 20 6f 62 6a 65 63 74 20 72 65 66 65 72 65 6e 63   object referenc
2bc0: 65 2e 0a 0a 09 20 20 20 20 24 62 72 61 6e 63 68  e....    $branch
2bd0: 20 73 65 74 63 68 69 6c 64 72 65 76 6e 72 20 24   setchildrevnr $
2be0: 62 72 61 6e 63 68 72 65 76 6e 72 0a 09 7d 0a 09  branchrevnr..}..
2bf0: 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20  return.    }..  
2c00: 20 20 6d 65 74 68 6f 64 20 52 65 76 32 42 72 61    method Rev2Bra
2c10: 6e 63 68 20 7b 72 65 76 6e 72 7d 20 7b 0a 20 20  nch {revnr} {.  
2c20: 20 20 20 20 20 20 69 6e 74 65 67 72 69 74 79 20        integrity 
2c30: 61 73 73 65 72 74 20 7b 21 5b 72 65 76 20 69 73  assert {![rev is
2c40: 74 72 75 6e 6b 72 65 76 6e 72 20 24 72 65 76 6e  trunkrevnr $revn
2c50: 72 5d 7d 20 7b 45 78 70 65 63 74 65 64 20 61 20  r]} {Expected a 
2c60: 62 72 61 6e 63 68 20 72 65 76 69 73 69 6f 6e 20  branch revision 
2c70: 6e 75 6d 62 65 72 7d 0a 09 72 65 74 75 72 6e 20  number}..return 
2c80: 24 6d 79 62 72 61 6e 63 68 65 73 28 5b 72 65 76  $mybranches([rev
2c90: 20 32 62 72 61 6e 63 68 6e 72 20 24 72 65 76 6e   2branchnr $revn
2ca0: 72 5d 29 0a 20 20 20 20 7d 0a 0a 20 20 20 20 6d  r]).    }..    m
2cb0: 65 74 68 6f 64 20 41 64 64 55 6e 6c 61 62 65 6c  ethod AddUnlabel
2cc0: 65 64 42 72 61 6e 63 68 20 7b 62 72 61 6e 63 68  edBranch {branch
2cd0: 6e 72 7d 20 7b 0a 09 72 65 74 75 72 6e 20 5b 24  nr} {..return [$
2ce0: 73 65 6c 66 20 41 64 64 42 72 61 6e 63 68 20 75  self AddBranch u
2cf0: 6e 6c 61 62 65 6c 65 64 2d 24 62 72 61 6e 63 68  nlabeled-$branch
2d00: 6e 72 20 24 62 72 61 6e 63 68 6e 72 5d 0a 20 20  nr $branchnr].  
2d10: 20 20 7d 0a 0a 20 20 20 20 6d 65 74 68 6f 64 20    }..    method 
2d20: 41 64 64 42 72 61 6e 63 68 20 7b 6e 61 6d 65 20  AddBranch {name 
2d30: 62 72 61 6e 63 68 6e 72 7d 20 7b 0a 09 69 66 20  branchnr} {..if 
2d40: 7b 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 6d 79  {[info exists my
2d50: 62 72 61 6e 63 68 65 73 28 24 62 72 61 6e 63 68  branches($branch
2d60: 6e 72 29 5d 7d 20 7b 0a 09 20 20 20 20 6c 6f 67  nr)]} {..    log
2d70: 20 77 72 69 74 65 20 31 20 66 69 6c 65 20 22 49   write 1 file "I
2d80: 6e 20 27 24 6d 79 70 61 74 68 27 3a 20 42 72 61  n '$mypath': Bra
2d90: 6e 63 68 20 27 24 62 72 61 6e 63 68 6e 72 27 20  nch '$branchnr' 
2da0: 6e 61 6d 65 64 20 27 5b 24 6d 79 62 72 61 6e 63  named '[$mybranc
2db0: 68 65 73 28 24 62 72 61 6e 63 68 6e 72 29 20 6e  hes($branchnr) n
2dc0: 61 6d 65 5d 27 22 0a 09 20 20 20 20 6c 6f 67 20  ame]'"..    log 
2dd0: 77 72 69 74 65 20 31 20 66 69 6c 65 20 22 43 61  write 1 file "Ca
2de0: 6e 6e 6f 74 20 68 61 76 65 20 73 65 63 6f 6e 64  nnot have second
2df0: 20 6e 61 6d 65 20 27 24 6e 61 6d 65 27 2c 20 69   name '$name', i
2e00: 67 6e 6f 72 69 6e 67 20 69 74 22 0a 09 20 20 20  gnoring it"..   
2e10: 20 72 65 74 75 72 6e 0a 09 7d 0a 09 73 65 74 20   return..}..set 
2e20: 62 72 61 6e 63 68 20 5b 73 79 6d 20 25 41 55 54  branch [sym %AUT
2e30: 4f 25 20 62 72 61 6e 63 68 20 24 62 72 61 6e 63  O% branch $branc
2e40: 68 6e 72 20 5b 24 6d 79 70 72 6f 6a 65 63 74 20  hnr [$myproject 
2e50: 67 65 74 73 79 6d 62 6f 6c 20 24 6e 61 6d 65 5d  getsymbol $name]
2e60: 20 24 73 65 6c 66 5d 0a 09 24 62 72 61 6e 63 68   $self]..$branch
2e70: 20 73 65 74 70 6f 73 69 74 69 6f 6e 20 5b 69 6e   setposition [in
2e80: 63 72 20 6d 79 62 72 61 6e 63 68 63 6e 74 5d 0a  cr mybranchcnt].
2e90: 09 73 65 74 20 6d 79 62 72 61 6e 63 68 65 73 28  .set mybranches(
2ea0: 24 62 72 61 6e 63 68 6e 72 29 20 24 62 72 61 6e  $branchnr) $bran
2eb0: 63 68 0a 09 72 65 74 75 72 6e 20 24 62 72 61 6e  ch..return $bran
2ec0: 63 68 0a 20 20 20 20 7d 0a 0a 20 20 20 20 6d 65  ch.    }..    me
2ed0: 74 68 6f 64 20 41 64 64 54 61 67 20 7b 6e 61 6d  thod AddTag {nam
2ee0: 65 20 72 65 76 6e 72 7d 20 7b 0a 09 73 65 74 20  e revnr} {..set 
2ef0: 74 61 67 20 5b 73 79 6d 20 25 41 55 54 4f 25 20  tag [sym %AUTO% 
2f00: 74 61 67 20 24 72 65 76 6e 72 20 5b 24 6d 79 70  tag $revnr [$myp
2f10: 72 6f 6a 65 63 74 20 67 65 74 73 79 6d 62 6f 6c  roject getsymbol
2f20: 20 24 6e 61 6d 65 5d 20 24 73 65 6c 66 5d 0a 09   $name] $self]..
2f30: 6c 61 70 70 65 6e 64 20 6d 79 74 61 67 73 28 24  lappend mytags($
2f40: 72 65 76 6e 72 29 20 24 74 61 67 0a 09 72 65 74  revnr) $tag..ret
2f50: 75 72 6e 20 24 74 61 67 0a 20 20 20 20 7d 0a 0a  urn $tag.    }..
2f60: 20 20 20 20 6d 65 74 68 6f 64 20 52 65 63 6f 72      method Recor
2f70: 64 42 61 73 69 63 44 65 70 65 6e 64 65 6e 63 69  dBasicDependenci
2f80: 65 73 20 7b 72 65 76 6e 72 20 6e 65 78 74 7d 20  es {revnr next} 
2f90: 7b 0a 09 23 20 48 61 6e 64 6c 65 20 74 68 65 20  {..# Handle the 
2fa0: 72 65 76 69 73 69 6f 6e 20 64 65 70 65 6e 64 65  revision depende
2fb0: 6e 63 69 65 73 2e 20 52 65 63 6f 72 64 20 74 68  ncies. Record th
2fc0: 65 6d 20 66 6f 72 20 6e 6f 77 2c 20 64 6f 0a 09  em for now, do..
2fd0: 23 20 6e 6f 74 68 69 6e 67 20 77 69 74 68 20 74  # nothing with t
2fe0: 68 65 6d 20 79 65 74 2e 0a 0a 09 23 20 4f 6e 20  hem yet....# On 
2ff0: 74 68 65 20 74 72 75 6e 6b 20 74 68 65 20 27 6e  the trunk the 'n
3000: 65 78 74 27 20 66 69 65 6c 64 20 70 6f 69 6e 74  ext' field point
3010: 73 20 74 6f 20 74 68 65 20 70 72 65 76 69 6f 75  s to the previou
3020: 73 0a 09 23 20 72 65 76 69 73 69 6f 6e 2c 20 69  s..# revision, i
3030: 2e 65 2e 20 74 68 65 20 5f 70 61 72 65 6e 74 5f  .e. the _parent_
3040: 20 6f 66 20 74 68 65 20 63 75 72 72 65 6e 74 20   of the current 
3050: 6f 6e 65 2e 20 45 78 61 6d 70 6c 65 3a 0a 09 23  one. Example:..#
3060: 20 31 2e 36 27 73 20 6e 65 78 74 20 69 73 20 31   1.6's next is 1
3070: 2e 35 20 28 6d 6f 64 75 6c 6f 20 63 76 73 20 61  .5 (modulo cvs a
3080: 64 6d 69 6e 20 2d 6f 29 2e 0a 0a 09 23 20 43 6f  dmin -o)....# Co
3090: 6e 74 72 61 72 69 6c 79 20 6f 6e 20 61 20 62 72  ntrarily on a br
30a0: 61 6e 63 68 20 74 68 65 20 27 6e 65 78 74 27 20  anch the 'next' 
30b0: 66 69 65 6c 64 20 70 6f 69 6e 74 73 20 74 6f 20  field points to 
30c0: 74 68 65 0a 09 23 20 70 72 69 6d 61 72 79 20 5f  the..# primary _
30d0: 63 68 69 6c 64 5f 20 6f 66 20 74 68 65 20 63 75  child_ of the cu
30e0: 72 72 65 6e 74 20 72 65 76 69 73 69 6f 6e 2e 20  rrent revision. 
30f0: 41 73 20 65 78 61 6d 70 6c 65 2c 0a 09 23 20 31  As example,..# 1
3100: 2e 31 2e 33 2e 32 27 73 20 27 6e 65 78 74 27 20  .1.3.2's 'next' 
3110: 77 69 6c 6c 20 62 65 20 31 2e 31 2e 33 2e 33 2e  will be 1.1.3.3.
3120: 0a 0a 09 23 20 54 68 65 20 27 6e 65 78 74 27 20  ...# The 'next' 
3130: 66 69 65 6c 64 20 61 63 74 75 61 6c 6c 79 20 61  field actually a
3140: 6c 77 61 79 73 20 72 65 66 65 72 73 20 74 6f 20  lways refers to 
3150: 74 68 65 20 72 65 76 69 73 69 6f 6e 0a 09 23 20  the revision..# 
3160: 63 6f 6e 74 61 69 6e 69 6e 67 20 74 68 65 20 64  containing the d
3170: 65 6c 74 61 20 6e 65 65 64 65 64 20 74 6f 20 72  elta needed to r
3180: 65 74 72 69 65 76 65 20 74 68 61 74 20 72 65 76  etrieve that rev
3190: 69 73 69 6f 6e 2e 0a 0a 09 23 20 54 68 65 20 64  ision....# The d
31a0: 65 70 65 6e 64 65 6e 63 69 65 73 20 6e 65 65 64  ependencies need
31b0: 65 64 20 68 65 72 65 20 61 72 65 20 74 68 65 20  ed here are the 
31c0: 6c 6f 67 69 63 61 6c 20 73 74 72 75 63 74 75 72  logical structur
31d0: 65 2c 0a 09 23 20 70 61 72 65 6e 74 2f 63 68 69  e,..# parent/chi
31e0: 6c 64 2c 20 61 6e 64 20 6e 6f 74 20 74 68 65 20  ld, and not the 
31f0: 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 64  implementation d
3200: 65 70 65 6e 64 65 6e 74 20 64 65 6c 74 61 0a 09  ependent delta..
3210: 23 20 70 6f 69 6e 74 65 72 73 2e 0a 0a 09 69 66  # pointers....if
3220: 20 7b 24 6e 65 78 74 20 65 71 20 22 22 7d 20 72   {$next eq ""} r
3230: 65 74 75 72 6e 0a 09 23 20 20 20 20 20 20 20 20  eturn..#        
3240: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
3250: 20 20 70 61 72 65 6e 74 20 2d 3e 20 63 68 69 6c    parent -> chil
3260: 64 0a 09 69 66 20 7b 5b 72 65 76 20 69 73 74 72  d..if {[rev istr
3270: 75 6e 6b 72 65 76 6e 72 20 24 72 65 76 6e 72 5d  unkrevnr $revnr]
3280: 7d 20 7b 0a 09 20 20 20 20 6c 61 70 70 65 6e 64  } {..    lappend
3290: 20 6d 79 64 65 70 65 6e 64 65 6e 63 69 65 73 20   mydependencies 
32a0: 24 6e 65 78 74 20 24 72 65 76 6e 72 0a 09 7d 20  $next $revnr..} 
32b0: 65 6c 73 65 20 7b 0a 09 20 20 20 20 6c 61 70 70  else {..    lapp
32c0: 65 6e 64 20 6d 79 64 65 70 65 6e 64 65 6e 63 69  end mydependenci
32d0: 65 73 20 24 72 65 76 6e 72 20 24 6e 65 78 74 0a  es $revnr $next.
32e0: 09 7d 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 7d  .}..return.    }
32f0: 0a 0a 20 20 20 20 6d 65 74 68 6f 64 20 50 72 6f  ..    method Pro
3300: 63 65 73 73 50 72 69 6d 61 72 79 44 65 70 65 6e  cessPrimaryDepen
3310: 64 65 6e 63 69 65 73 20 7b 7d 20 7b 0a 09 66 6f  dencies {} {..fo
3320: 72 65 61 63 68 20 7b 70 61 72 65 6e 74 72 65 76  reach {parentrev
3330: 6e 72 20 63 68 69 6c 64 72 65 76 6e 72 7d 20 24  nr childrevnr} $
3340: 6d 79 64 65 70 65 6e 64 65 6e 63 69 65 73 20 7b  mydependencies {
3350: 0a 09 20 20 20 20 73 65 74 20 70 61 72 65 6e 74  ..    set parent
3360: 20 24 6d 79 72 65 76 28 24 70 61 72 65 6e 74 72   $myrev($parentr
3370: 65 76 6e 72 29 0a 09 20 20 20 20 73 65 74 20 63  evnr)..    set c
3380: 68 69 6c 64 20 20 24 6d 79 72 65 76 28 24 63 68  hild  $myrev($ch
3390: 69 6c 64 72 65 76 6e 72 29 0a 09 20 20 20 20 24  ildrevnr)..    $
33a0: 70 61 72 65 6e 74 20 73 65 74 63 68 69 6c 64 20  parent setchild 
33b0: 24 63 68 69 6c 64 0a 09 20 20 20 20 24 63 68 69  $child..    $chi
33c0: 6c 64 20 73 65 74 70 61 72 65 6e 74 20 24 70 61  ld setparent $pa
33d0: 72 65 6e 74 0a 09 7d 0a 09 72 65 74 75 72 6e 0a  rent..}..return.
33e0: 20 20 20 20 7d 0a 0a 20 20 20 20 6d 65 74 68 6f      }..    metho
33f0: 64 20 50 72 6f 63 65 73 73 42 72 61 6e 63 68 44  d ProcessBranchD
3400: 65 70 65 6e 64 65 6e 63 69 65 73 20 7b 7d 20 7b  ependencies {} {
3410: 0a 09 66 6f 72 65 61 63 68 20 7b 62 72 61 6e 63  ..foreach {branc
3420: 68 6e 72 20 62 72 61 6e 63 68 7d 20 5b 61 72 72  hnr branch} [arr
3430: 61 79 20 67 65 74 20 6d 79 62 72 61 6e 63 68 65  ay get mybranche
3440: 73 5d 20 7b 0a 09 20 20 20 20 73 65 74 20 72 65  s] {..    set re
3450: 76 6e 72 20 5b 24 62 72 61 6e 63 68 20 70 61 72  vnr [$branch par
3460: 65 6e 74 72 65 76 6e 72 5d 0a 0a 09 20 20 20 20  entrevnr]...    
3470: 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 73 74  if {![info exist
3480: 73 20 6d 79 72 65 76 28 24 72 65 76 6e 72 29 5d  s myrev($revnr)]
3490: 7d 20 7b 0a 09 09 6c 6f 67 20 77 72 69 74 65 20  } {...log write 
34a0: 31 20 66 69 6c 65 20 22 49 6e 20 27 24 6d 79 70  1 file "In '$myp
34b0: 61 74 68 27 3a 20 54 68 65 20 62 72 61 6e 63 68  ath': The branch
34c0: 20 27 5b 24 62 72 61 6e 63 68 20 6e 61 6d 65 5d   '[$branch name]
34d0: 27 20 72 65 66 65 72 65 6e 63 65 73 22 0a 09 09  ' references"...
34e0: 6c 6f 67 20 77 72 69 74 65 20 31 20 66 69 6c 65  log write 1 file
34f0: 20 22 74 68 65 20 62 6f 67 75 73 20 72 65 76 69   "the bogus revi
3500: 73 69 6f 6e 20 27 24 72 65 76 6e 72 27 20 61 6e  sion '$revnr' an
3510: 64 20 77 69 6c 6c 20 62 65 20 69 67 6e 6f 72 65  d will be ignore
3520: 64 2e 22 0a 09 09 24 62 72 61 6e 63 68 20 64 65  d."...$branch de
3530: 73 74 72 6f 79 0a 09 09 75 6e 73 65 74 20 6d 79  stroy...unset my
3540: 62 72 61 6e 63 68 65 73 28 24 62 72 61 6e 63 68  branches($branch
3550: 6e 72 29 0a 09 20 20 20 20 7d 20 65 6c 73 65 20  nr)..    } else 
3560: 7b 0a 09 09 73 65 74 20 72 65 76 20 24 6d 79 72  {...set rev $myr
3570: 65 76 28 24 72 65 76 6e 72 29 0a 09 09 24 72 65  ev($revnr)...$re
3580: 76 20 61 64 64 62 72 61 6e 63 68 20 24 62 72 61  v addbranch $bra
3590: 6e 63 68 0a 09 09 24 62 72 61 6e 63 68 20 73 65  nch...$branch se
35a0: 74 70 61 72 65 6e 74 20 24 72 65 76 0a 0a 09 09  tparent $rev....
35b0: 23 20 49 66 20 72 65 76 69 73 69 6f 6e 73 20 77  # If revisions w
35c0: 65 72 65 20 63 6f 6d 6d 69 74 74 65 64 20 6f 6e  ere committed on
35d0: 20 74 68 65 20 62 72 61 6e 63 68 20 77 65 20 73   the branch we s
35e0: 74 6f 72 65 20 61 0a 09 09 23 20 72 65 66 65 72  tore a...# refer
35f0: 65 6e 63 65 20 74 6f 20 74 68 65 20 62 72 61 6e  ence to the bran
3600: 63 68 20 74 68 65 72 65 2c 20 61 6e 64 20 66 75  ch there, and fu
3610: 72 74 68 65 72 20 64 65 63 6c 61 72 65 0a 09 09  rther declare...
3620: 23 20 74 68 65 20 66 69 72 73 74 20 63 68 69 6c  # the first chil
3630: 64 27 73 20 70 61 72 65 6e 74 20 74 6f 20 62 65  d's parent to be
3640: 20 62 72 61 6e 63 68 27 73 20 70 61 72 65 6e 74   branch's parent
3650: 2c 20 61 6e 64 0a 09 09 23 20 6c 69 73 74 20 74  , and...# list t
3660: 68 69 73 20 63 68 69 6c 64 20 69 6e 20 74 68 65  his child in the
3670: 20 70 61 72 65 6e 74 20 72 65 76 69 73 69 6f 6e   parent revision
3680: 2e 0a 0a 09 09 69 66 20 7b 5b 24 62 72 61 6e 63  .....if {[$branc
3690: 68 20 68 61 73 63 68 69 6c 64 72 65 76 5d 7d 20  h haschildrev]} 
36a0: 7b 0a 09 09 20 20 20 20 73 65 74 20 63 68 69 6c  {...    set chil
36b0: 64 72 65 76 6e 72 20 5b 24 62 72 61 6e 63 68 20  drevnr [$branch 
36c0: 63 68 69 6c 64 72 65 76 6e 72 5d 0a 09 09 20 20  childrevnr]...  
36d0: 20 20 73 65 74 20 63 68 69 6c 64 20 24 6d 79 72    set child $myr
36e0: 65 76 28 24 63 68 69 6c 64 72 65 76 6e 72 29 0a  ev($childrevnr).
36f0: 09 09 20 20 20 20 24 62 72 61 6e 63 68 20 73 65  ..    $branch se
3700: 74 63 68 69 6c 64 20 24 63 68 69 6c 64 0a 0a 09  tchild $child...
3710: 09 20 20 20 20 24 63 68 69 6c 64 20 73 65 74 70  .    $child setp
3720: 61 72 65 6e 74 62 72 61 6e 63 68 20 24 62 72 61  arentbranch $bra
3730: 6e 63 68 0a 09 09 20 20 20 20 24 63 68 69 6c 64  nch...    $child
3740: 20 73 65 74 70 61 72 65 6e 74 20 20 20 20 20 20   setparent      
3750: 20 24 72 65 76 0a 09 09 20 20 20 20 24 72 65 76   $rev...    $rev
3760: 20 61 64 64 63 68 69 6c 64 6f 6e 62 72 61 6e 63   addchildonbranc
3770: 68 20 24 63 68 69 6c 64 0a 09 09 7d 0a 09 20 20  h $child...}..  
3780: 20 20 7d 0a 09 7d 0a 09 72 65 74 75 72 6e 0a 20    }..}..return. 
3790: 20 20 20 7d 0a 0a 20 20 20 20 6d 65 74 68 6f 64     }..    method
37a0: 20 53 6f 72 74 42 72 61 6e 63 68 65 73 20 7b 7d   SortBranches {}
37b0: 20 7b 0a 09 66 6f 72 65 61 63 68 20 7b 72 65 76   {..foreach {rev
37c0: 6e 72 20 72 65 76 7d 20 5b 61 72 72 61 79 20 67  nr rev} [array g
37d0: 65 74 20 6d 79 72 65 76 5d 20 7b 20 24 72 65 76  et myrev] { $rev
37e0: 20 73 6f 72 74 62 72 61 6e 63 68 65 73 20 7d 0a   sortbranches }.
37f0: 09 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20  .return.    }.. 
3800: 20 20 20 6d 65 74 68 6f 64 20 50 72 6f 63 65 73     method Proces
3810: 73 54 61 67 44 65 70 65 6e 64 65 6e 63 69 65 73  sTagDependencies
3820: 20 7b 7d 20 7b 0a 09 66 6f 72 65 61 63 68 20 7b   {} {..foreach {
3830: 72 65 76 6e 72 20 74 61 67 6c 69 73 74 7d 20 5b  revnr taglist} [
3840: 61 72 72 61 79 20 67 65 74 20 6d 79 74 61 67 73  array get mytags
3850: 5d 20 7b 0a 09 20 20 20 20 69 66 20 7b 21 5b 69  ] {..    if {![i
3860: 6e 66 6f 20 65 78 69 73 74 73 20 6d 79 72 65 76  nfo exists myrev
3870: 28 24 72 65 76 6e 72 29 5d 7d 20 7b 0a 09 09 73  ($revnr)]} {...s
3880: 65 74 20 6e 20 5b 6c 6c 65 6e 67 74 68 20 24 74  et n [llength $t
3890: 61 67 6c 69 73 74 5d 0a 09 09 6c 6f 67 20 77 72  aglist]...log wr
38a0: 69 74 65 20 31 20 66 69 6c 65 20 22 49 6e 20 27  ite 1 file "In '
38b0: 24 6d 79 70 61 74 68 27 3a 20 54 68 65 20 66 6f  $mypath': The fo
38c0: 6c 6c 6f 77 69 6e 67 20 5b 6e 73 70 20 24 6e 20  llowing [nsp $n 
38d0: 74 61 67 5d 20 72 65 66 65 72 65 6e 63 65 22 0a  tag] reference".
38e0: 09 09 6c 6f 67 20 77 72 69 74 65 20 31 20 66 69  ..log write 1 fi
38f0: 6c 65 20 22 74 68 65 20 62 6f 67 75 73 20 72 65  le "the bogus re
3900: 76 69 73 69 6f 6e 20 27 24 72 65 76 6e 72 27 20  vision '$revnr' 
3910: 61 6e 64 20 77 69 6c 6c 20 62 65 20 69 67 6e 6f  and will be igno
3920: 72 65 64 2e 22 0a 09 09 66 6f 72 65 61 63 68 20  red."...foreach 
3930: 74 61 67 20 24 74 61 67 6c 69 73 74 20 7b 0a 09  tag $taglist {..
3940: 09 20 20 20 20 6c 6f 67 20 77 72 69 74 65 20 31  .    log write 1
3950: 20 66 69 6c 65 20 22 20 20 20 20 5b 24 74 61 67   file "    [$tag
3960: 20 6e 61 6d 65 5d 22 0a 09 09 20 20 20 20 24 74   name]"...    $t
3970: 61 67 20 64 65 73 74 72 6f 79 0a 09 09 7d 0a 09  ag destroy...}..
3980: 09 75 6e 73 65 74 20 6d 79 74 61 67 73 28 24 72  .unset mytags($r
3990: 65 76 6e 72 29 0a 09 20 20 20 20 7d 20 65 6c 73  evnr)..    } els
39a0: 65 20 7b 0a 09 09 73 65 74 20 72 65 76 20 24 6d  e {...set rev $m
39b0: 79 72 65 76 28 24 72 65 76 6e 72 29 0a 09 09 66  yrev($revnr)...f
39c0: 6f 72 65 61 63 68 20 74 61 67 20 24 74 61 67 6c  oreach tag $tagl
39d0: 69 73 74 20 7b 0a 09 09 20 20 20 20 24 72 65 76  ist {...    $rev
39e0: 20 61 64 64 74 61 67 20 20 20 20 24 74 61 67 0a   addtag    $tag.
39f0: 09 09 20 20 20 20 24 74 61 67 20 73 65 74 74 61  ..    $tag setta
3a00: 67 72 65 76 20 24 72 65 76 0a 09 09 7d 0a 09 20  grev $rev...}.. 
3a10: 20 20 20 7d 0a 09 7d 0a 09 72 65 74 75 72 6e 0a     }..}..return.
3a20: 20 20 20 20 7d 0a 0a 20 20 20 20 6d 65 74 68 6f      }..    metho
3a30: 64 20 44 65 74 65 72 6d 69 6e 65 54 68 65 52 6f  d DetermineTheRo
3a40: 6f 74 52 65 76 69 73 69 6f 6e 20 7b 7d 20 7b 0a  otRevision {} {.
3a50: 09 23 20 54 68 65 20 72 6f 6f 74 20 69 73 20 74  .# The root is t
3a60: 68 65 20 6f 6e 65 20 72 65 76 69 73 69 6f 6e 20  he one revision 
3a70: 77 68 69 63 68 20 68 61 73 20 6e 6f 20 70 61 72  which has no par
3a80: 65 6e 74 2e 20 42 79 0a 09 23 20 63 68 65 63 6b  ent. By..# check
3a90: 69 6e 67 20 61 6c 6c 20 72 65 76 69 73 69 6f 6e  ing all revision
3aa0: 73 20 77 65 20 65 6e 73 75 72 65 20 74 68 61 74  s we ensure that
3ab0: 20 77 65 20 63 61 6e 20 64 65 74 65 63 74 20 61   we can detect a
3ac0: 6e 64 0a 09 23 20 72 65 70 6f 72 74 20 74 68 65  nd..# report the
3ad0: 20 63 61 73 65 20 6f 66 20 6d 75 6c 74 69 70 6c   case of multipl
3ae0: 65 20 72 6f 6f 74 73 2e 20 57 69 74 68 6f 75 74  e roots. Without
3af0: 20 74 68 61 74 20 77 65 20 63 6f 75 6c 64 0a 09   that we could..
3b00: 23 20 73 69 6d 70 6c 79 20 74 61 6b 65 20 6f 6e  # simply take on
3b10: 65 20 72 65 76 69 73 69 6f 6e 20 61 6e 64 20 66  e revision and f
3b20: 6f 6c 6c 6f 77 20 74 68 65 20 70 61 72 65 6e 74  ollow the parent
3b30: 20 6c 69 6e 6b 73 20 74 6f 0a 09 23 20 74 68 65   links to..# the
3b40: 69 72 20 72 6f 6f 74 20 28 73 69 63 21 29 2e 0a  ir root (sic!)..
3b50: 0a 09 66 6f 72 65 61 63 68 20 7b 72 65 76 6e 72  ..foreach {revnr
3b60: 20 72 65 76 7d 20 5b 61 72 72 61 79 20 67 65 74   rev} [array get
3b70: 20 6d 79 72 65 76 5d 20 7b 0a 09 20 20 20 20 69   myrev] {..    i
3b80: 66 20 7b 5b 24 72 65 76 20 68 61 73 70 61 72 65  f {[$rev haspare
3b90: 6e 74 5d 7d 20 63 6f 6e 74 69 6e 75 65 0a 09 20  nt]} continue.. 
3ba0: 20 20 20 69 6e 74 65 67 72 69 74 79 20 61 73 73     integrity ass
3bb0: 65 72 74 20 7b 24 6d 79 72 6f 6f 74 20 65 71 20  ert {$myroot eq 
3bc0: 22 22 7d 20 7b 4d 75 6c 74 69 70 6c 65 20 72 6f  ""} {Multiple ro
3bd0: 6f 74 20 72 65 76 69 73 69 6f 6e 73 20 66 6f 75  ot revisions fou
3be0: 6e 64 7d 0a 09 20 20 20 20 73 65 74 20 6d 79 72  nd}..    set myr
3bf0: 6f 6f 74 20 24 72 65 76 0a 09 7d 0a 0a 09 23 20  oot $rev..}...# 
3c00: 49 6e 20 74 68 65 20 66 75 74 75 72 65 20 77 65  In the future we
3c10: 20 61 6c 73 6f 20 6e 65 65 64 20 61 20 6c 69 73   also need a lis
3c20: 74 2c 20 61 73 20 62 72 61 6e 63 68 65 73 20 63  t, as branches c
3c30: 61 6e 20 62 65 63 6f 6d 65 0a 09 23 20 73 65 76  an become..# sev
3c40: 65 72 65 64 20 66 72 6f 6d 20 74 68 65 69 72 20  ered from their 
3c50: 70 61 72 65 6e 74 2c 20 6d 61 6b 69 6e 67 20 74  parent, making t
3c60: 68 65 6d 20 74 68 65 69 72 20 6f 77 6e 20 72 6f  hem their own ro
3c70: 6f 74 2e 0a 09 73 65 74 20 6d 79 72 6f 6f 74 73  ot...set myroots
3c80: 20 5b 6c 69 73 74 20 24 6d 79 72 6f 6f 74 5d 0a   [list $myroot].
3c90: 09 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20  .return.    }.. 
3ca0: 20 20 20 6d 65 74 68 6f 64 20 44 65 74 65 72 6d     method Determ
3cb0: 69 6e 65 52 65 76 69 73 69 6f 6e 4f 70 65 72 61  ineRevisionOpera
3cc0: 74 69 6f 6e 73 20 7b 7d 20 7b 0a 09 66 6f 72 65  tions {} {..fore
3cd0: 61 63 68 20 72 65 76 20 24 6d 79 72 65 76 69 73  ach rev $myrevis
3ce0: 69 6f 6e 73 20 7b 20 24 72 65 76 20 64 65 74 65  ions { $rev dete
3cf0: 72 6d 69 6e 65 6f 70 65 72 61 74 69 6f 6e 20 7d  rmineoperation }
3d00: 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a  ..return.    }..
3d10: 20 20 20 20 6d 65 74 68 6f 64 20 44 65 74 65 72      method Deter
3d20: 6d 69 6e 65 4c 69 6e 65 73 4f 66 44 65 76 65 6c  mineLinesOfDevel
3d30: 6f 70 6d 65 6e 74 20 7b 7d 20 7b 0a 09 23 20 46  opment {} {..# F
3d40: 6f 72 20 72 65 76 69 73 69 6f 6e 73 20 74 68 69  or revisions thi
3d50: 73 20 68 61 73 20 62 65 65 6e 20 64 6f 6e 65 20  s has been done 
3d60: 61 6c 72 65 61 64 79 2c 20 69 6e 20 27 65 78 74  already, in 'ext
3d70: 65 6e 64 27 2e 20 4e 6f 77 0a 09 23 20 77 65 20  end'. Now..# we 
3d80: 64 6f 20 74 68 69 73 20 66 6f 72 20 74 68 65 20  do this for the 
3d90: 62 72 61 6e 63 68 65 73 20 61 6e 64 20 74 61 67  branches and tag
3da0: 73 2e 0a 0a 09 66 6f 72 65 61 63 68 20 7b 5f 20  s....foreach {_ 
3db0: 62 72 61 6e 63 68 7d 20 5b 61 72 72 61 79 20 67  branch} [array g
3dc0: 65 74 20 6d 79 62 72 61 6e 63 68 65 73 5d 20 7b  et mybranches] {
3dd0: 0a 09 20 20 20 20 24 62 72 61 6e 63 68 20 73 65  ..    $branch se
3de0: 74 6c 6f 64 20 5b 24 73 65 6c 66 20 47 65 74 4c  tlod [$self GetL
3df0: 4f 44 20 5b 24 62 72 61 6e 63 68 20 70 61 72 65  OD [$branch pare
3e00: 6e 74 72 65 76 6e 72 5d 5d 0a 09 7d 0a 0a 09 66  ntrevnr]]..}...f
3e10: 6f 72 65 61 63 68 20 7b 5f 20 74 61 67 6c 69 73  oreach {_ taglis
3e20: 74 7d 20 5b 61 72 72 61 79 20 67 65 74 20 6d 79  t} [array get my
3e30: 74 61 67 73 5d 20 7b 0a 09 20 20 20 20 66 6f 72  tags] {..    for
3e40: 65 61 63 68 20 74 61 67 20 24 74 61 67 6c 69 73  each tag $taglis
3e50: 74 20 7b 0a 09 09 24 74 61 67 20 73 65 74 6c 6f  t {...$tag setlo
3e60: 64 20 5b 24 73 65 6c 66 20 47 65 74 4c 4f 44 20  d [$self GetLOD 
3e70: 5b 24 74 61 67 20 74 61 67 72 65 76 6e 72 5d 5d  [$tag tagrevnr]]
3e80: 0a 09 20 20 20 20 7d 0a 09 7d 0a 09 72 65 74 75  ..    }..}..retu
3e90: 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 6d 65  rn.    }..    me
3ea0: 74 68 6f 64 20 47 65 74 4c 4f 44 20 7b 72 65 76  thod GetLOD {rev
3eb0: 6e 72 7d 20 7b 0a 09 69 66 20 7b 5b 72 65 76 20  nr} {..if {[rev 
3ec0: 69 73 74 72 75 6e 6b 72 65 76 6e 72 20 24 72 65  istrunkrevnr $re
3ed0: 76 6e 72 5d 7d 20 7b 0a 09 20 20 20 20 72 65 74  vnr]} {..    ret
3ee0: 75 72 6e 20 24 6d 79 74 72 75 6e 6b 0a 09 7d 20  urn $mytrunk..} 
3ef0: 65 6c 73 65 20 7b 0a 09 20 20 20 20 72 65 74 75  else {..    retu
3f00: 72 6e 20 5b 24 73 65 6c 66 20 52 65 76 32 42 72  rn [$self Rev2Br
3f10: 61 6e 63 68 20 24 72 65 76 6e 72 5d 0a 09 7d 0a  anch $revnr]..}.
3f20: 20 20 20 20 7d 0a 0a 20 20 20 20 6d 65 74 68 6f      }..    metho
3f30: 64 20 48 61 6e 64 6c 65 4e 6f 6e 54 72 75 6e 6b  d HandleNonTrunk
3f40: 44 65 66 61 75 6c 74 42 72 61 6e 63 68 20 7b 7d  DefaultBranch {}
3f50: 20 7b 0a 09 73 65 74 20 72 65 76 6c 69 73 74 20   {..set revlist 
3f60: 5b 24 73 65 6c 66 20 4e 6f 6e 54 72 75 6e 6b 44  [$self NonTrunkD
3f70: 65 66 61 75 6c 74 52 65 76 69 73 69 6f 6e 73 5d  efaultRevisions]
3f80: 0a 09 69 66 20 7b 21 5b 6c 6c 65 6e 67 74 68 20  ..if {![llength 
3f90: 24 72 65 76 6c 69 73 74 5d 7d 20 72 65 74 75 72  $revlist]} retur
3fa0: 6e 0a 0a 09 24 73 65 6c 66 20 41 64 6a 75 73 74  n...$self Adjust
3fb0: 4e 6f 6e 54 72 75 6e 6b 44 65 66 61 75 6c 74 42  NonTrunkDefaultB
3fc0: 72 61 6e 63 68 20 24 72 65 76 6c 69 73 74 0a 09  ranch $revlist..
3fd0: 24 73 65 6c 66 20 43 68 65 63 6b 4c 4f 44 73 0a  $self CheckLODs.
3fe0: 09 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20  .return.    }.. 
3ff0: 20 20 20 6d 65 74 68 6f 64 20 4e 6f 6e 54 72 75     method NonTru
4000: 6e 6b 44 65 66 61 75 6c 74 52 65 76 69 73 69 6f  nkDefaultRevisio
4010: 6e 73 20 7b 7d 20 7b 0a 09 23 20 46 72 6f 6d 20  ns {} {..# From 
4020: 63 76 73 32 73 76 6e 20 74 68 65 20 66 6f 6c 6c  cvs2svn the foll
4030: 6f 77 69 6e 67 20 65 78 70 6c 61 6e 61 74 69 6f  owing explanatio
4040: 6e 20 28 77 69 74 68 20 6d 6f 64 69 66 69 63 61  n (with modifica
4050: 74 69 6f 6e 73 0a 09 23 20 66 6f 72 20 6f 75 72  tions..# for our
4060: 20 61 6c 67 6f 72 69 74 68 6d 29 3a 0a 0a 09 23   algorithm):...#
4070: 20 44 65 74 65 72 6d 69 6e 65 20 77 68 65 74 68   Determine wheth
4080: 65 72 20 74 68 65 72 65 20 61 72 65 20 61 6e 79  er there are any
4090: 20 6e 6f 6e 2d 74 72 75 6e 6b 20 64 65 66 61 75   non-trunk defau
40a0: 6c 74 20 62 72 61 6e 63 68 0a 09 23 20 72 65 76  lt branch..# rev
40b0: 69 73 69 6f 6e 73 2e 0a 0a 09 23 20 49 66 20 61  isions....# If a
40c0: 20 6e 6f 6e 2d 74 72 75 6e 6b 20 64 65 66 61 75   non-trunk defau
40d0: 6c 74 20 62 72 61 6e 63 68 20 69 73 20 64 65 74  lt branch is det
40e0: 65 72 6d 69 6e 65 64 20 74 6f 20 68 61 76 65 20  ermined to have 
40f0: 65 78 69 73 74 65 64 2c 0a 09 23 20 72 65 74 75  existed,..# retu
4100: 72 6e 20 61 20 6c 69 73 74 20 6f 66 20 6f 62 6a  rn a list of obj
4110: 65 63 74 73 20 66 6f 72 20 61 6c 6c 20 72 65 76  ects for all rev
4120: 69 73 69 6f 6e 73 20 74 68 61 74 20 77 65 72 65  isions that were
4130: 20 6f 6e 63 65 0a 09 23 20 6e 6f 6e 2d 74 72 75   once..# non-tru
4140: 6e 6b 20 64 65 66 61 75 6c 74 20 72 65 76 69 73  nk default revis
4150: 69 6f 6e 73 2c 20 69 6e 20 64 65 70 65 6e 64 65  ions, in depende
4160: 6e 63 79 20 6f 72 64 65 72 20 28 69 2e 65 2e 20  ncy order (i.e. 
4170: 72 6f 6f 74 0a 09 23 20 66 69 72 73 74 29 2e 0a  root..# first)..
4180: 0a 09 23 20 54 68 65 72 65 20 61 72 65 20 74 77  ..# There are tw
4190: 6f 20 63 61 73 65 73 20 74 6f 20 68 61 6e 64 6c  o cases to handl
41a0: 65 3a 0a 0a 09 23 20 4f 6e 65 20 63 61 73 65 20  e:...# One case 
41b0: 69 73 20 73 69 6d 70 6c 65 2e 20 20 54 68 65 20  is simple.  The 
41c0: 52 43 53 20 66 69 6c 65 20 6c 69 73 74 73 20 61  RCS file lists a
41d0: 20 64 65 66 61 75 6c 74 20 62 72 61 6e 63 68 0a   default branch.
41e0: 09 23 20 65 78 70 6c 69 63 69 74 6c 79 20 69 6e  .# explicitly in
41f0: 20 69 74 73 20 68 65 61 64 65 72 2c 20 73 75 63   its header, suc
4200: 68 20 61 73 20 27 31 2e 31 2e 31 27 2e 20 20 49  h as '1.1.1'.  I
4210: 6e 20 74 68 69 73 20 63 61 73 65 2c 20 77 65 0a  n this case, we.
4220: 09 23 20 6b 6e 6f 77 20 74 68 61 74 20 65 76 65  .# know that eve
4230: 72 79 20 72 65 76 69 73 69 6f 6e 20 6f 6e 20 74  ry revision on t
4240: 68 65 20 76 65 6e 64 6f 72 20 62 72 61 6e 63 68  he vendor branch
4250: 20 69 73 20 74 6f 20 62 65 0a 09 23 20 74 72 65   is to be..# tre
4260: 61 74 65 64 20 61 73 20 68 65 61 64 20 6f 66 20  ated as head of 
4270: 74 72 75 6e 6b 20 61 74 20 74 68 61 74 20 70 6f  trunk at that po
4280: 69 6e 74 20 69 6e 20 74 69 6d 65 2e 0a 0a 09 23  int in time....#
4290: 20 42 75 74 20 74 68 65 72 65 27 73 20 61 6c 73   But there's als
42a0: 6f 20 61 20 64 65 67 65 6e 65 72 61 74 65 20 63  o a degenerate c
42b0: 61 73 65 2e 20 20 54 68 65 20 52 43 53 20 66 69  ase.  The RCS fi
42c0: 6c 65 20 64 6f 65 73 20 6e 6f 74 0a 09 23 20 63  le does not..# c
42d0: 75 72 72 65 6e 74 6c 79 20 68 61 76 65 20 61 20  urrently have a 
42e0: 64 65 66 61 75 6c 74 20 62 72 61 6e 63 68 2c 20  default branch, 
42f0: 79 65 74 20 77 65 20 63 61 6e 20 64 65 64 75 63  yet we can deduc
4300: 65 20 74 68 61 74 20 66 6f 72 0a 09 23 20 73 6f  e that for..# so
4310: 6d 65 20 70 65 72 69 6f 64 20 69 6e 20 74 68 65  me period in the
4320: 20 70 61 73 74 20 69 74 20 70 72 6f 62 61 62 6c   past it probabl
4330: 79 20 2a 64 69 64 2a 20 68 61 76 65 20 6f 6e 65  y *did* have one
4340: 2e 20 20 46 6f 72 0a 09 23 20 65 78 61 6d 70 6c  .  For..# exampl
4350: 65 2c 20 74 68 65 20 66 69 6c 65 20 68 61 73 20  e, the file has 
4360: 76 65 6e 64 6f 72 20 72 65 76 69 73 69 6f 6e 73  vendor revisions
4370: 20 31 2e 31 2e 31 2e 31 20 2d 3e 20 31 2e 31 2e   1.1.1.1 -> 1.1.
4380: 31 2e 39 36 2c 0a 09 23 20 61 6c 6c 20 6f 66 20  1.96,..# all of 
4390: 77 68 69 63 68 20 61 72 65 20 64 61 74 65 64 20  which are dated 
43a0: 62 65 66 6f 72 65 20 31 2e 32 2c 20 61 6e 64 20  before 1.2, and 
43b0: 74 68 65 6e 20 69 74 20 68 61 73 20 31 2e 31 2e  then it has 1.1.
43c0: 31 2e 39 37 0a 09 23 20 2d 3e 20 31 2e 31 2e 31  1.97..# -> 1.1.1
43d0: 2e 31 30 30 20 64 61 74 65 64 20 61 66 74 65 72  .100 dated after
43e0: 20 31 2e 32 2e 20 20 49 6e 20 74 68 69 73 20 63   1.2.  In this c
43f0: 61 73 65 2c 20 77 65 20 73 68 6f 75 6c 64 0a 09  ase, we should..
4400: 23 20 72 65 63 6f 72 64 20 31 2e 31 2e 31 2e 39  # record 1.1.1.9
4410: 36 20 61 73 20 74 68 65 20 6c 61 73 74 20 76 65  6 as the last ve
4420: 6e 64 6f 72 20 72 65 76 69 73 69 6f 6e 20 74 6f  ndor revision to
4430: 20 68 61 76 65 20 62 65 65 6e 20 74 68 65 0a 09   have been the..
4440: 23 20 68 65 61 64 20 6f 66 20 74 68 65 20 64 65  # head of the de
4450: 66 61 75 6c 74 20 62 72 61 6e 63 68 2e 0a 0a 09  fault branch....
4460: 69 66 20 7b 24 6d 79 70 72 69 6e 63 69 70 61 6c  if {$myprincipal
4470: 20 6e 65 20 22 22 7d 20 7b 0a 09 20 20 20 20 23   ne ""} {..    #
4480: 20 54 68 65 72 65 20 69 73 20 73 74 69 6c 6c 20   There is still 
4490: 61 20 64 65 66 61 75 6c 74 20 62 72 61 6e 63 68  a default branch
44a0: 3b 20 74 68 61 74 20 6d 65 61 6e 73 20 74 68 61  ; that means tha
44b0: 74 20 61 6c 6c 0a 09 20 20 20 20 23 20 72 65 76  t all..    # rev
44c0: 69 73 69 6f 6e 73 20 6f 6e 20 74 68 61 74 20 62  isions on that b
44d0: 72 61 6e 63 68 20 67 65 74 20 6d 61 72 6b 65 64  ranch get marked
44e0: 2e 0a 0a 09 20 20 20 20 6c 6f 67 20 77 72 69 74  ....    log writ
44f0: 65 20 35 20 66 69 6c 65 20 22 46 6f 75 6e 64 20  e 5 file "Found 
4500: 65 78 70 6c 69 63 69 74 6c 79 20 6d 61 72 6b 65  explicitly marke
4510: 64 20 4e 54 44 42 22 0a 0a 09 20 20 20 20 73 65  d NTDB"...    se
4520: 74 20 72 6e 65 78 74 20 5b 24 6d 79 72 6f 6f 74  t rnext [$myroot
4530: 20 63 68 69 6c 64 5d 0a 09 20 20 20 20 69 66 20   child]..    if 
4540: 7b 24 72 6e 65 78 74 20 6e 65 20 22 22 7d 20 7b  {$rnext ne ""} {
4550: 0a 09 09 74 72 6f 75 62 6c 65 20 66 61 74 61 6c  ...trouble fatal
4560: 20 22 46 69 6c 65 20 77 69 74 68 20 64 65 66 61   "File with defa
4570: 75 6c 74 20 62 72 61 6e 63 68 20 24 6d 79 70 72  ult branch $mypr
4580: 69 6e 63 69 70 61 6c 20 61 6c 73 6f 20 68 61 73  incipal also has
4590: 20 72 65 76 69 73 69 6f 6e 20 5b 24 72 6e 65 78   revision [$rnex
45a0: 74 20 72 65 76 6e 72 5d 22 0a 09 09 72 65 74 75  t revnr]"...retu
45b0: 72 6e 0a 09 20 20 20 20 7d 0a 0a 09 20 20 20 20  rn..    }...    
45c0: 73 65 74 20 72 65 76 20 5b 24 6d 79 62 72 61 6e  set rev [$mybran
45d0: 63 68 65 73 28 24 6d 79 70 72 69 6e 63 69 70 61  ches($myprincipa
45e0: 6c 29 20 63 68 69 6c 64 5d 0a 09 20 20 20 20 73  l) child]..    s
45f0: 65 74 20 72 65 73 20 7b 7d 0a 0a 09 20 20 20 20  et res {}...    
4600: 77 68 69 6c 65 20 7b 24 72 65 76 20 6e 65 20 22  while {$rev ne "
4610: 22 7d 20 7b 0a 09 09 6c 61 70 70 65 6e 64 20 72  "} {...lappend r
4620: 65 73 20 24 72 65 76 0a 09 09 73 65 74 20 72 65  es $rev...set re
4630: 76 20 5b 24 72 65 76 20 63 68 69 6c 64 5d 0a 09  v [$rev child]..
4640: 20 20 20 20 7d 0a 0a 09 20 20 20 20 72 65 74 75      }...    retu
4650: 72 6e 20 24 72 65 73 0a 0a 09 7d 20 65 6c 73 65  rn $res...} else
4660: 69 66 20 7b 24 6d 79 69 6d 70 6f 72 74 65 64 7d  if {$myimported}
4670: 20 7b 0a 09 20 20 20 20 23 20 4e 6f 20 64 65 66   {..    # No def
4680: 61 75 6c 74 20 62 72 61 6e 63 68 2c 20 62 75 74  ault branch, but
4690: 20 74 68 65 20 66 69 6c 65 20 61 70 70 65 61 72   the file appear
46a0: 73 20 74 6f 20 68 61 76 65 20 62 65 65 6e 0a 09  s to have been..
46b0: 20 20 20 20 23 20 69 6d 70 6f 72 74 65 64 2e 20      # imported. 
46c0: 20 53 6f 20 6f 75 72 20 65 64 75 63 61 74 65 64   So our educated
46d0: 20 67 75 65 73 73 20 69 73 20 74 68 61 74 20 61   guess is that a
46e0: 6c 6c 20 72 65 76 69 73 69 6f 6e 73 0a 09 20 20  ll revisions..  
46f0: 20 20 23 20 6f 6e 20 74 68 65 20 27 31 2e 31 2e    # on the '1.1.
4700: 31 27 20 62 72 61 6e 63 68 20 77 69 74 68 20 74  1' branch with t
4710: 69 6d 65 73 74 61 6d 70 73 20 70 72 69 6f 72 20  imestamps prior 
4720: 74 6f 20 74 68 65 0a 09 20 20 20 20 23 20 74 69  to the..    # ti
4730: 6d 65 73 74 61 6d 70 20 6f 66 20 27 31 2e 32 27  mestamp of '1.2'
4740: 20 77 65 72 65 20 6e 6f 6e 2d 74 72 75 6e 6b 20   were non-trunk 
4750: 64 65 66 61 75 6c 74 20 62 72 61 6e 63 68 0a 09  default branch..
4760: 20 20 20 20 23 20 72 65 76 69 73 69 6f 6e 73 2e      # revisions.
4770: 0a 0a 09 20 20 20 20 23 20 54 68 69 73 20 72 65  ...    # This re
4780: 61 6c 6c 79 20 6f 6e 6c 79 20 70 72 6f 63 65 73  ally only proces
4790: 73 65 73 20 73 74 61 6e 64 61 72 64 20 27 31 2e  ses standard '1.
47a0: 31 2e 31 2e 2a 27 2d 73 74 79 6c 65 0a 09 20 20  1.1.*'-style..  
47b0: 20 20 23 20 76 65 6e 64 6f 72 20 72 65 76 69 73    # vendor revis
47c0: 69 6f 6e 73 2e 20 20 4f 6e 65 20 63 6f 75 6c 64  ions.  One could
47d0: 20 63 6f 6e 63 65 69 76 61 62 6c 79 20 68 61 76   conceivably hav
47e0: 65 20 61 20 66 69 6c 65 0a 09 20 20 20 20 23 20  e a file..    # 
47f0: 77 68 6f 73 65 20 64 65 66 61 75 6c 74 20 62 72  whose default br
4800: 61 6e 63 68 20 69 73 20 31 2e 31 2e 33 20 6f 72  anch is 1.1.3 or
4810: 20 77 68 61 74 65 76 65 72 2c 20 6f 72 20 77 61   whatever, or wa
4820: 73 20 74 68 61 74 0a 09 20 20 20 20 23 20 61 74  s that..    # at
4830: 20 73 6f 6d 65 20 70 6f 69 6e 74 20 69 6e 20 74   some point in t
4840: 69 6d 65 2c 20 77 69 74 68 20 76 65 6e 64 6f 72  ime, with vendor
4850: 20 72 65 76 69 73 69 6f 6e 73 20 31 2e 31 2e 33   revisions 1.1.3
4860: 2e 31 2c 0a 09 20 20 20 20 23 20 31 2e 31 2e 33  .1,..    # 1.1.3
4870: 2e 32 2c 20 65 74 63 2e 20 20 42 75 74 20 77 69  .2, etc.  But wi
4880: 74 68 20 74 68 65 20 64 65 66 61 75 6c 74 20 62  th the default b
4890: 72 61 6e 63 68 20 67 6f 6e 65 20 6e 6f 77 2c 0a  ranch gone now,.
48a0: 09 20 20 20 20 23 20 77 65 27 64 20 68 61 76 65  .    # we'd have
48b0: 20 6e 6f 20 62 61 73 69 73 20 66 6f 72 20 61 73   no basis for as
48c0: 73 75 6d 69 6e 67 20 74 68 61 74 20 74 68 65 20  suming that the 
48d0: 6e 6f 6e 2d 73 74 61 6e 64 61 72 64 0a 09 20 20  non-standard..  
48e0: 20 20 23 20 76 65 6e 64 6f 72 20 62 72 61 6e 63    # vendor branc
48f0: 68 20 68 61 64 20 65 76 65 72 20 62 65 65 6e 20  h had ever been 
4900: 74 68 65 20 64 65 66 61 75 6c 74 20 62 72 61 6e  the default bran
4910: 63 68 20 61 6e 79 77 61 79 2e 0a 0a 09 20 20 20  ch anyway....   
4920: 20 23 20 4e 6f 74 65 20 74 68 61 74 20 77 65 20   # Note that we 
4930: 72 65 6c 79 20 6f 6e 20 63 6f 6d 70 61 72 69 73  rely on comparis
4940: 6f 6e 73 20 62 65 74 77 65 65 6e 20 74 68 65 20  ons between the 
4950: 74 69 6d 65 73 74 61 6d 70 73 0a 09 20 20 20 20  timestamps..    
4960: 23 20 6f 66 20 74 68 65 20 72 65 76 69 73 69 6f  # of the revisio
4970: 6e 73 20 6f 6e 20 74 68 65 20 76 65 6e 64 6f 72  ns on the vendor
4980: 20 62 72 61 6e 63 68 20 61 6e 64 20 74 68 61 74   branch and that
4990: 20 6f 66 0a 09 20 20 20 20 23 20 72 65 76 69 73   of..    # revis
49a0: 69 6f 6e 20 31 2e 32 2c 20 65 76 65 6e 20 74 68  ion 1.2, even th
49b0: 6f 75 67 68 20 74 68 65 20 74 69 6d 65 73 74 61  ough the timesta
49c0: 6d 70 73 20 6d 69 67 68 74 20 62 65 0a 09 20 20  mps might be..  
49d0: 20 20 23 20 69 6e 63 6f 72 72 65 63 74 20 64 75    # incorrect du
49e0: 65 20 74 6f 20 63 6c 6f 63 6b 20 73 6b 65 77 2e  e to clock skew.
49f0: 20 20 57 65 20 63 6f 75 6c 64 20 64 6f 20 61 20    We could do a 
4a00: 73 6c 69 67 68 74 6c 79 0a 09 20 20 20 20 23 20  slightly..    # 
4a10: 62 65 74 74 65 72 20 6a 6f 62 20 69 66 20 77 65  better job if we
4a20: 20 75 73 65 64 20 74 68 65 20 63 68 61 6e 67 65   used the change
4a30: 73 65 74 20 74 69 6d 65 73 74 61 6d 70 73 2c 20  set timestamps, 
4a40: 61 73 20 69 74 20 69 73 0a 09 20 20 20 20 23 20  as it is..    # 
4a50: 70 6f 73 73 69 62 6c 65 20 74 68 61 74 20 74 68  possible that th
4a60: 65 20 64 65 70 65 6e 64 65 6e 63 69 65 73 20 74  e dependencies t
4a70: 68 61 74 20 77 65 6e 74 20 69 6e 74 6f 0a 09 20  hat went into.. 
4a80: 20 20 20 23 20 64 65 74 65 72 6d 69 6e 69 6e 67     # determining
4a90: 20 74 68 6f 73 65 20 74 69 6d 65 73 74 61 6d 70   those timestamp
4aa0: 73 20 61 72 65 20 6d 6f 72 65 20 61 63 63 75 72  s are more accur
4ab0: 61 74 65 2e 20 20 42 75 74 0a 09 20 20 20 20 23  ate.  But..    #
4ac0: 20 74 68 61 74 20 77 6f 75 6c 64 20 72 65 71 75   that would requ
4ad0: 69 72 65 20 61 6e 20 65 78 74 72 61 20 70 61 73  ire an extra pas
4ae0: 73 20 6f 72 20 74 77 6f 2e 0a 0a 09 20 20 20 20  s or two....    
4af0: 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 73 74  if {![info exist
4b00: 73 20 6d 79 62 72 61 6e 63 68 65 73 28 31 2e 31  s mybranches(1.1
4b10: 2e 31 29 5d 7d 20 7b 20 72 65 74 75 72 6e 20 7b  .1)]} { return {
4b20: 7d 20 7d 0a 0a 09 20 20 20 20 6c 6f 67 20 77 72  } }...    log wr
4b30: 69 74 65 20 35 20 66 69 6c 65 20 22 44 65 64 75  ite 5 file "Dedu
4b40: 63 65 64 20 65 78 69 73 74 65 6e 63 65 20 6f 66  ced existence of
4b50: 20 4e 54 44 42 22 0a 0a 09 20 20 20 20 73 65 74   NTDB"...    set
4b60: 20 72 65 76 20 20 5b 24 6d 79 62 72 61 6e 63 68   rev  [$mybranch
4b70: 65 73 28 31 2e 31 2e 31 29 20 63 68 69 6c 64 5d  es(1.1.1) child]
4b80: 0a 09 20 20 20 20 73 65 74 20 72 65 73 20 20 7b  ..    set res  {
4b90: 7d 0a 09 20 20 20 20 73 65 74 20 73 74 6f 70 20  }..    set stop 
4ba0: 5b 24 6d 79 72 6f 6f 74 20 63 68 69 6c 64 5d 0a  [$myroot child].
4bb0: 0a 09 20 20 20 20 69 66 20 7b 24 73 74 6f 70 20  ..    if {$stop 
4bc0: 65 71 20 22 22 7d 20 7b 0a 09 09 23 20 47 65 74  eq ""} {...# Get
4bd0: 20 65 76 65 72 79 74 68 69 6e 67 20 6f 6e 20 74   everything on t
4be0: 68 65 20 62 72 61 6e 63 68 0a 09 09 77 68 69 6c  he branch...whil
4bf0: 65 20 7b 24 72 65 76 20 6e 65 20 22 22 7d 20 7b  e {$rev ne ""} {
4c00: 0a 09 09 20 20 20 20 6c 61 70 70 65 6e 64 20 72  ...    lappend r
4c10: 65 73 20 24 72 65 76 0a 09 09 20 20 20 20 73 65  es $rev...    se
4c20: 74 20 72 65 76 20 5b 24 72 65 76 20 63 68 69 6c  t rev [$rev chil
4c30: 64 5d 0a 09 09 7d 0a 09 20 20 20 20 7d 20 65 6c  d]...}..    } el
4c40: 73 65 20 7b 0a 09 09 23 20 43 6f 6c 6c 65 63 74  se {...# Collect
4c50: 20 65 76 65 72 79 74 68 69 6e 67 20 6f 6e 20 74   everything on t
4c60: 68 65 20 62 72 61 6e 63 68 20 77 68 69 63 68 20  he branch which 
4c70: 73 65 65 6d 73 20 74 6f 20 68 61 76 65 0a 09 09  seems to have...
4c80: 23 20 62 65 65 6e 20 63 6f 6d 6d 69 74 74 65 64  # been committed
4c90: 20 62 65 66 6f 72 65 20 74 68 65 20 66 69 72 73   before the firs
4ca0: 74 20 70 72 69 6d 61 72 79 20 63 68 69 6c 64 20  t primary child 
4cb0: 6f 66 20 74 68 65 0a 09 09 23 20 72 6f 6f 74 20  of the...# root 
4cc0: 72 65 76 69 73 69 6f 6e 2e 0a 09 09 73 65 74 20  revision....set 
4cd0: 73 74 6f 70 64 61 74 65 20 5b 24 73 74 6f 70 20  stopdate [$stop 
4ce0: 64 61 74 65 5d 0a 09 09 77 68 69 6c 65 20 7b 24  date]...while {$
4cf0: 72 65 76 20 6e 65 20 22 22 7d 20 7b 0a 09 09 20  rev ne ""} {... 
4d00: 20 20 20 69 66 20 7b 5b 24 72 65 76 20 64 61 74     if {[$rev dat
4d10: 65 5d 20 3e 3d 20 24 73 74 6f 70 64 61 74 65 7d  e] >= $stopdate}
4d20: 20 62 72 65 61 6b 0a 09 09 20 20 20 20 6c 61 70   break...    lap
4d30: 70 65 6e 64 20 72 65 73 20 24 72 65 76 0a 09 09  pend res $rev...
4d40: 20 20 20 20 73 65 74 20 72 65 76 20 5b 24 72 65      set rev [$re
4d50: 76 20 63 68 69 6c 64 5d 0a 09 09 7d 0a 09 20 20  v child]...}..  
4d60: 20 20 7d 0a 0a 09 20 20 20 20 72 65 74 75 72 6e    }...    return
4d70: 20 24 72 65 73 0a 0a 09 7d 20 65 6c 73 65 20 7b   $res...} else {
4d80: 0a 09 20 20 20 20 72 65 74 75 72 6e 20 7b 7d 0a  ..    return {}.
4d90: 09 7d 0a 20 20 20 20 7d 0a 0a 20 20 20 20 23 20  .}.    }..    # 
4da0: 47 65 6e 65 72 61 6c 20 6e 6f 74 65 3a 20 49 6e  General note: In
4db0: 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 6d   the following m
4dc0: 65 74 68 6f 64 73 20 77 65 20 6f 6e 6c 79 20 6d  ethods we only m
4dd0: 6f 64 69 66 79 20 74 68 65 20 6c 69 6e 6b 73 0a  odify the links.
4de0: 20 20 20 20 23 20 62 65 74 77 65 65 6e 20 72 65      # between re
4df0: 76 69 73 69 6f 6e 73 20 61 6e 64 20 73 79 6d 62  visions and symb
4e00: 6f 6c 73 20 74 6f 20 72 65 73 74 72 75 63 74 75  ols to restructu
4e10: 72 65 20 74 68 65 20 72 65 76 69 73 69 6f 6e 0a  re the revision.
4e20: 20 20 20 20 23 20 74 72 65 65 2e 20 57 65 20 64      # tree. We d
4e30: 6f 20 5f 5f 6e 6f 74 5f 5f 20 64 65 73 74 72 6f  o __not__ destro
4e40: 79 20 74 68 65 20 6f 62 6a 65 63 74 73 2e 20 47  y the objects. G
4e50: 69 76 65 6e 20 74 68 65 20 63 6f 6d 70 6c 65 78  iven the complex
4e60: 20 6c 69 6e 6b 73 0a 20 20 20 20 23 20 47 43 20   links.    # GC 
4e70: 69 73 20 64 69 66 66 69 63 75 6c 74 20 61 74 20  is difficult at 
4e80: 74 68 69 73 20 6c 65 76 65 6c 2e 20 49 74 20 69  this level. It i
4e90: 73 20 6d 75 63 68 20 65 61 73 69 65 72 20 74 6f  s much easier to
4ea0: 20 64 72 6f 70 0a 20 20 20 20 23 20 65 76 65 72   drop.    # ever
4eb0: 79 74 68 69 6e 67 20 77 68 65 6e 20 77 65 20 77  ything when we w
4ec0: 65 20 61 72 65 20 64 6f 6e 65 2e 20 54 68 69 73  e are done. This
4ed0: 20 68 61 70 70 65 6e 73 20 69 6e 20 27 64 72 6f   happens in 'dro
4ee0: 70 27 2c 20 75 73 69 6e 67 0a 20 20 20 20 23 20  p', using.    # 
4ef0: 74 68 65 20 73 74 61 74 65 20 76 61 72 69 61 62  the state variab
4f00: 6c 65 20 27 6d 79 72 65 76 27 2c 20 27 6d 79 62  le 'myrev', 'myb
4f10: 72 61 6e 63 68 65 73 27 2c 20 61 6e 64 20 27 6d  ranches', and 'm
4f20: 79 74 61 67 73 27 2e 20 57 68 61 74 20 77 65 0a  ytags'. What we.
4f30: 20 20 20 20 23 20 68 61 76 65 20 74 6f 20 70 65      # have to pe
4f40: 72 73 69 73 74 2c 20 70 65 72 66 6f 72 6d 65 64  rsist, performed
4f50: 20 62 79 20 27 70 65 72 73 69 73 74 27 2c 20 77   by 'persist', w
4f60: 65 20 6b 6e 6f 77 20 77 69 6c 6c 20 62 65 0a 20  e know will be. 
4f70: 20 20 20 23 20 72 65 61 63 68 61 62 6c 65 20 74     # reachable t
4f80: 68 72 6f 75 67 68 20 74 68 65 20 72 65 76 69 73  hrough the revis
4f90: 69 6f 6e 73 20 6c 69 73 74 65 64 20 69 6e 20 27  ions listed in '
4fa0: 6d 79 72 6f 6f 74 73 27 20 61 6e 64 20 74 68 65  myroots' and the
4fb0: 69 72 0a 20 20 20 20 23 20 63 68 69 6c 64 72 65  ir.    # childre
4fc0: 6e 20 61 6e 64 20 73 79 6d 62 6f 6c 73 2e 0a 0a  n and symbols...
4fd0: 20 20 20 20 6d 65 74 68 6f 64 20 41 64 6a 75 73      method Adjus
4fe0: 74 4e 6f 6e 54 72 75 6e 6b 44 65 66 61 75 6c 74  tNonTrunkDefault
4ff0: 42 72 61 6e 63 68 20 7b 72 65 76 6c 69 73 74 7d  Branch {revlist}
5000: 20 7b 0a 09 73 65 74 20 73 74 6f 70 20 5b 24 6d   {..set stop [$m
5010: 79 72 6f 6f 74 20 63 68 69 6c 64 5d 20 3b 23 20  yroot child] ;# 
5020: 72 65 76 20 27 31 2e 32 27 0a 0a 09 6c 6f 67 20  rev '1.2'...log 
5030: 77 72 69 74 65 20 35 20 66 69 6c 65 20 22 41 64  write 5 file "Ad
5040: 6a 75 73 74 69 6e 67 20 4e 54 44 42 20 63 6f 6e  justing NTDB con
5050: 74 61 69 6e 69 6e 67 20 5b 6e 73 70 20 5b 6c 6c  taining [nsp [ll
5060: 65 6e 67 74 68 20 24 72 65 76 6c 69 73 74 5d 20  ength $revlist] 
5070: 72 65 76 69 73 69 6f 6e 5d 22 0a 0a 09 23 20 46  revision]"...# F
5080: 72 6f 6d 20 63 76 73 32 73 76 6e 20 74 68 65 20  rom cvs2svn the 
5090: 66 6f 6c 6c 6f 77 69 6e 67 20 65 78 70 6c 61 6e  following explan
50a0: 61 74 69 6f 6e 20 28 77 69 74 68 20 6d 6f 64 69  ation (with modi
50b0: 66 69 63 61 74 69 6f 6e 73 0a 09 23 20 66 6f 72  fications..# for
50c0: 20 6f 75 72 20 61 6c 67 6f 72 69 74 68 6d 29 3a   our algorithm):
50d0: 0a 0a 09 23 20 41 64 6a 75 73 74 20 74 68 65 20  ...# Adjust the 
50e0: 6e 6f 6e 2d 74 72 75 6e 6b 20 64 65 66 61 75 6c  non-trunk defaul
50f0: 74 20 62 72 61 6e 63 68 20 72 65 76 69 73 69 6f  t branch revisio
5100: 6e 73 20 66 6f 75 6e 64 20 69 6e 20 74 68 65 0a  ns found in the.
5110: 09 23 20 27 72 65 76 6c 69 73 74 27 2e 0a 0a 09  .# 'revlist'....
5120: 23 20 27 6d 79 69 6d 70 6f 72 74 65 64 27 20 69  # 'myimported' i
5130: 73 20 61 20 62 6f 6f 6c 65 61 6e 20 66 6c 61 67  s a boolean flag
5140: 20 69 6e 64 69 63 61 74 69 6e 67 20 77 68 65 74   indicating whet
5150: 68 65 72 20 74 68 69 73 20 66 69 6c 65 0a 09 23  her this file..#
5160: 20 61 70 70 65 61 72 73 20 74 6f 20 68 61 76 65   appears to have
5170: 20 62 65 65 6e 20 69 6d 70 6f 72 74 65 64 2c 20   been imported, 
5180: 77 68 69 63 68 20 61 6c 73 6f 20 6d 65 61 6e 73  which also means
5190: 20 74 68 61 74 0a 09 23 20 72 65 76 69 73 69 6f   that..# revisio
51a0: 6e 20 31 2e 31 20 68 61 73 20 61 20 67 65 6e 65  n 1.1 has a gene
51b0: 72 61 74 65 64 20 6c 6f 67 20 6d 65 73 73 61 67  rated log messag
51c0: 65 20 74 68 61 74 20 6e 65 65 64 20 6e 6f 74 20  e that need not 
51d0: 62 65 0a 09 23 20 70 72 65 73 65 72 76 65 64 2e  be..# preserved.
51e0: 20 20 27 72 65 76 6c 69 73 74 27 20 69 73 20 61    'revlist' is a
51f0: 20 6c 69 73 74 20 6f 66 20 6f 62 6a 65 63 74 20   list of object 
5200: 72 65 66 65 72 65 6e 63 65 73 20 66 6f 72 20 74  references for t
5210: 68 65 0a 09 23 20 72 65 76 69 73 69 6f 6e 73 20  he..# revisions 
5220: 74 68 61 74 20 68 61 76 65 20 62 65 65 6e 20 64  that have been d
5230: 65 74 65 72 6d 69 6e 65 64 20 74 6f 20 62 65 20  etermined to be 
5240: 6e 6f 6e 2d 74 72 75 6e 6b 20 64 65 66 61 75 6c  non-trunk defaul
5250: 74 0a 09 23 20 62 72 61 6e 63 68 20 72 65 76 69  t..# branch revi
5260: 73 69 6f 6e 73 2e 0a 0a 09 23 20 4e 6f 74 65 20  sions....# Note 
5270: 74 68 61 74 20 74 68 65 20 66 69 72 73 74 20 72  that the first r
5280: 65 76 69 73 69 6f 6e 20 6f 6e 20 74 68 65 20 64  evision on the d
5290: 65 66 61 75 6c 74 20 62 72 61 6e 63 68 20 69 73  efault branch is
52a0: 0a 09 23 20 68 61 6e 64 6c 65 64 20 73 74 72 61  ..# handled stra
52b0: 6e 67 65 6c 79 20 62 79 20 43 56 53 2e 20 20 49  ngely by CVS.  I
52c0: 66 20 61 20 66 69 6c 65 20 69 73 20 69 6d 70 6f  f a file is impo
52d0: 72 74 65 64 20 28 61 73 20 6f 70 70 6f 73 65 64  rted (as opposed
52e0: 0a 09 23 20 74 6f 20 62 65 69 6e 67 20 61 64 64  ..# to being add
52f0: 65 64 29 2c 20 43 56 53 20 63 72 65 61 74 65 73  ed), CVS creates
5300: 20 61 20 31 2e 31 20 72 65 76 69 73 69 6f 6e 2c   a 1.1 revision,
5310: 20 74 68 65 6e 20 63 72 65 61 74 65 73 20 61 0a   then creates a.
5320: 09 23 20 76 65 6e 64 6f 72 20 62 72 61 6e 63 68  .# vendor branch
5330: 20 31 2e 31 2e 31 20 62 61 73 65 64 20 6f 6e 20   1.1.1 based on 
5340: 31 2e 31 2c 20 74 68 65 6e 20 63 72 65 61 74 65  1.1, then create
5350: 73 20 61 20 31 2e 31 2e 31 2e 31 0a 09 23 20 72  s a 1.1.1.1..# r
5360: 65 76 69 73 69 6f 6e 20 74 68 61 74 20 69 73 20  evision that is 
5370: 69 64 65 6e 74 69 63 61 6c 20 74 6f 20 74 68 65  identical to the
5380: 20 31 2e 31 20 72 65 76 69 73 69 6f 6e 20 28 69   1.1 revision (i
5390: 2e 65 2e 2c 20 69 74 73 0a 09 23 20 64 65 6c 74  .e., its..# delt
53a0: 61 74 65 78 74 20 69 73 20 65 6d 70 74 79 29 2e  atext is empty).
53b0: 20 20 54 68 65 20 6c 6f 67 20 6d 65 73 73 61 67    The log messag
53c0: 65 20 74 68 61 74 20 74 68 65 20 75 73 65 72 20  e that the user 
53d0: 74 79 70 65 64 0a 09 23 20 77 68 65 6e 20 69 6d  typed..# when im
53e0: 70 6f 72 74 69 6e 67 20 69 73 20 73 74 6f 72 65  porting is store
53f0: 64 20 77 69 74 68 20 74 68 65 20 31 2e 31 2e 31  d with the 1.1.1
5400: 2e 31 20 72 65 76 69 73 69 6f 6e 2e 20 20 54 68  .1 revision.  Th
5410: 65 20 31 2e 31 0a 09 23 20 72 65 76 69 73 69 6f  e 1.1..# revisio
5420: 6e 20 61 6c 77 61 79 73 20 63 6f 6e 74 61 69 6e  n always contain
5430: 73 20 61 20 73 74 61 6e 64 61 72 64 2c 20 67 65  s a standard, ge
5440: 6e 65 72 61 74 65 64 20 6c 6f 67 20 6d 65 73 73  nerated log mess
5450: 61 67 65 2c 0a 09 23 20 27 49 6e 69 74 69 61 6c  age,..# 'Initial
5460: 20 72 65 76 69 73 69 6f 6e 5c 6e 27 2e 0a 0a 09   revision\n'....
5470: 23 20 57 68 65 6e 20 77 65 20 64 65 74 65 63 74  # When we detect
5480: 20 61 20 73 74 72 61 69 67 68 74 66 6f 72 77 61   a straightforwa
5490: 72 64 20 69 6d 70 6f 72 74 20 6c 69 6b 65 20 74  rd import like t
54a0: 68 69 73 2c 20 77 65 20 77 61 6e 74 0a 09 23 20  his, we want..# 
54b0: 74 6f 20 68 61 6e 64 6c 65 20 69 74 20 62 79 20  to handle it by 
54c0: 64 65 6c 65 74 69 6e 67 20 74 68 65 20 31 2e 31  deleting the 1.1
54d0: 20 72 65 76 69 73 69 6f 6e 20 28 77 68 69 63 68   revision (which
54e0: 20 64 6f 65 73 6e 27 74 0a 09 23 20 63 6f 6e 74   doesn't..# cont
54f0: 61 69 6e 20 61 6e 79 20 75 73 65 66 75 6c 20 69  ain any useful i
5500: 6e 66 6f 72 6d 61 74 69 6f 6e 29 20 61 6e 64 20  nformation) and 
5510: 6d 61 6b 69 6e 67 20 31 2e 31 2e 31 2e 31 20 69  making 1.1.1.1 i
5520: 6e 74 6f 20 61 6e 0a 09 23 20 69 6e 64 65 70 65  nto an..# indepe
5530: 6e 64 65 6e 74 20 72 6f 6f 74 20 69 6e 20 74 68  ndent root in th
5540: 65 20 66 69 6c 65 27 73 20 64 65 70 65 6e 64 65  e file's depende
5550: 6e 63 79 20 74 72 65 65 2e 20 20 49 6e 20 53 56  ncy tree.  In SV
5560: 4e 2c 0a 09 23 20 31 2e 31 2e 31 2e 31 20 77 69  N,..# 1.1.1.1 wi
5570: 6c 6c 20 62 65 20 61 64 64 65 64 20 64 69 72 65  ll be added dire
5580: 63 74 6c 79 20 74 6f 20 74 68 65 20 76 65 6e 64  ctly to the vend
5590: 6f 72 20 62 72 61 6e 63 68 20 77 69 74 68 20 69  or branch with i
55a0: 74 73 0a 09 23 20 69 6e 69 74 69 61 6c 20 63 6f  ts..# initial co
55b0: 6e 74 65 6e 74 2e 20 20 54 68 65 6e 20 69 6e 20  ntent.  Then in 
55c0: 61 20 73 70 65 63 69 61 6c 20 27 70 6f 73 74 2d  a special 'post-
55d0: 63 6f 6d 6d 69 74 27 2c 20 74 68 65 0a 09 23 20  commit', the..# 
55e0: 31 2e 31 2e 31 2e 31 20 72 65 76 69 73 69 6f 6e  1.1.1.1 revision
55f0: 20 69 73 20 63 6f 70 69 65 64 20 62 61 63 6b 20   is copied back 
5600: 74 6f 20 74 72 75 6e 6b 2e 0a 0a 09 23 20 49 66  to trunk....# If
5610: 20 74 68 65 20 75 73 65 72 20 69 6d 70 6f 72 74   the user import
5620: 73 20 61 67 61 69 6e 20 74 6f 20 74 68 65 20 73  s again to the s
5630: 61 6d 65 20 76 65 6e 64 6f 72 20 62 72 61 6e 63  ame vendor branc
5640: 68 2c 20 74 68 65 6e 20 43 56 53 0a 09 23 20 63  h, then CVS..# c
5650: 72 65 61 74 65 73 20 72 65 76 69 73 69 6f 6e 73  reates revisions
5660: 20 31 2e 31 2e 31 2e 32 2c 20 31 2e 31 2e 31 2e   1.1.1.2, 1.1.1.
5670: 33 2c 20 65 74 63 2e 20 6f 6e 20 74 68 65 20 76  3, etc. on the v
5680: 65 6e 64 6f 72 20 62 72 61 6e 63 68 2c 0a 09 23  endor branch,..#
5690: 20 2a 77 69 74 68 6f 75 74 2a 20 63 6f 75 6e 74   *without* count
56a0: 65 72 70 61 72 74 73 20 69 6e 20 74 72 75 6e 6b  erparts in trunk
56b0: 20 28 65 76 65 6e 20 74 68 6f 75 67 68 20 74 68   (even though th
56c0: 65 73 65 20 72 65 76 69 73 69 6f 6e 73 0a 09 23  ese revisions..#
56d0: 20 65 66 66 65 63 74 69 76 65 6c 79 20 70 6c 61   effectively pla
56e0: 79 20 74 68 65 20 72 6f 6c 65 20 6f 66 20 74 72  y the role of tr
56f0: 75 6e 6b 20 72 65 76 69 73 69 6f 6e 73 29 2e 20  unk revisions). 
5700: 20 53 6f 20 61 66 74 65 72 20 77 65 20 61 64 64   So after we add
5710: 0a 09 23 20 73 75 63 68 20 72 65 76 69 73 69 6f  ..# such revisio
5720: 6e 73 20 74 6f 20 74 68 65 20 76 65 6e 64 6f 72  ns to the vendor
5730: 20 62 72 61 6e 63 68 2c 20 77 65 20 61 6c 73 6f   branch, we also
5740: 20 63 6f 70 79 20 74 68 65 6d 20 62 61 63 6b 20   copy them back 
5750: 74 6f 0a 09 23 20 74 72 75 6e 6b 20 69 6e 20 70  to..# trunk in p
5760: 6f 73 74 2d 63 6f 6d 6d 69 74 73 2e 0a 0a 09 23  ost-commits....#
5770: 20 57 65 20 6d 61 72 6b 20 74 68 65 20 72 65 76   We mark the rev
5780: 69 73 69 6f 6e 73 20 66 6f 75 6e 64 20 69 6e 20  isions found in 
5790: 27 72 65 76 6c 69 73 74 27 20 61 73 20 64 65 66  'revlist' as def
57a0: 61 75 6c 74 20 62 72 61 6e 63 68 0a 09 23 20 72  ault branch..# r
57b0: 65 76 69 73 69 6f 6e 73 2e 20 20 41 6c 73 6f 2c  evisions.  Also,
57c0: 20 69 66 20 74 68 65 20 72 6f 6f 74 20 72 65 76   if the root rev
57d0: 69 73 69 6f 6e 20 68 61 73 20 61 20 70 72 69 6d  ision has a prim
57e0: 61 72 79 20 63 68 69 6c 64 0a 09 23 20 77 65 20  ary child..# we 
57f0: 73 65 74 20 74 68 61 74 20 72 65 76 69 73 69 6f  set that revisio
5800: 6e 20 74 6f 20 64 65 70 65 6e 64 20 6f 6e 20 74  n to depend on t
5810: 68 65 20 6c 61 73 74 20 6e 6f 6e 2d 74 72 75 6e  he last non-trun
5820: 6b 20 64 65 66 61 75 6c 74 0a 09 23 20 62 72 61  k default..# bra
5830: 6e 63 68 20 72 65 76 69 73 69 6f 6e 20 61 6e 64  nch revision and
5840: 20 70 6f 73 73 69 62 6c 79 20 61 64 6a 75 73 74   possibly adjust
5850: 20 69 74 73 20 74 79 70 65 20 61 63 63 6f 72 64   its type accord
5860: 69 6e 67 6c 79 2e 0a 0a 09 73 65 74 20 66 69 72  ingly....set fir
5870: 73 74 20 5b 6c 69 6e 64 65 78 20 24 72 65 76 6c  st [lindex $revl
5880: 69 73 74 20 30 5d 0a 0a 09 6c 6f 67 20 77 72 69  ist 0]...log wri
5890: 74 65 20 36 20 66 69 6c 65 20 22 3c 5b 24 66 69  te 6 file "<[$fi
58a0: 72 73 74 20 72 65 76 6e 72 5d 3e 20 5b 65 78 70  rst revnr]> [exp
58b0: 72 20 7b 24 6d 79 69 6d 70 6f 72 74 65 64 20 3f  r {$myimported ?
58c0: 20 22 69 6d 70 6f 72 74 65 64 22 20 3a 20 22 6e   "imported" : "n
58d0: 6f 74 20 69 6d 70 6f 72 74 65 64 22 7d 5d 2c 20  ot imported"}], 
58e0: 5b 24 66 69 72 73 74 20 6f 70 65 72 61 74 69 6f  [$first operatio
58f0: 6e 5d 2c 20 5b 65 78 70 72 20 7b 5b 24 66 69 72  n], [expr {[$fir
5900: 73 74 20 68 61 73 74 65 78 74 5d 20 3f 20 22 68  st hastext] ? "h
5910: 61 73 20 74 65 78 74 22 20 3a 20 22 6e 6f 20 74  as text" : "no t
5920: 65 78 74 22 7d 5d 22 0a 0a 09 69 66 20 7b 24 6d  ext"}]"...if {$m
5930: 79 69 6d 70 6f 72 74 65 64 20 26 26 0a 09 20 20  yimported &&..  
5940: 20 20 5b 24 66 69 72 73 74 20 72 65 76 6e 72 5d    [$first revnr]
5950: 20 65 71 20 22 31 2e 31 2e 31 2e 31 22 20 26 26   eq "1.1.1.1" &&
5960: 0a 09 20 20 20 20 5b 24 66 69 72 73 74 20 6f 70  ..    [$first op
5970: 65 72 61 74 69 6f 6e 5d 20 65 71 20 22 63 68 61  eration] eq "cha
5980: 6e 67 65 22 20 26 26 0a 09 20 20 20 20 21 5b 24  nge" &&..    ![$
5990: 66 69 72 73 74 20 68 61 73 74 65 78 74 5d 7d 20  first hastext]} 
59a0: 7b 0a 0a 09 20 20 20 20 73 65 74 20 72 65 76 31  {...    set rev1
59b0: 31 20 5b 24 66 69 72 73 74 20 70 61 72 65 6e 74  1 [$first parent
59c0: 5d 20 3b 20 23 20 41 73 73 65 72 74 3a 20 53 68  ] ; # Assert: Sh
59d0: 6f 75 6c 64 20 62 65 20 6d 79 72 6f 6f 74 2e 0a  ould be myroot..
59e0: 09 20 20 20 20 6c 6f 67 20 77 72 69 74 65 20 33  .    log write 3
59f0: 20 66 69 6c 65 20 22 52 65 6d 6f 76 69 6e 67 20   file "Removing 
5a00: 69 72 72 65 6c 65 76 61 6e 74 20 72 65 76 69 73  irrelevant revis
5a10: 69 6f 6e 20 5b 24 72 65 76 31 31 20 72 65 76 6e  ion [$rev11 revn
5a20: 72 5d 22 0a 0a 09 20 20 20 20 23 20 43 75 74 20  r]"...    # Cut 
5a30: 6f 75 74 20 74 68 65 20 6f 6c 64 20 6d 79 72 6f  out the old myro
5a40: 6f 74 20 72 65 76 69 73 69 6f 6e 2e 0a 0a 09 20  ot revision.... 
5a50: 20 20 20 6c 64 65 6c 65 74 65 20 6d 79 72 6f 6f     ldelete myroo
5a60: 74 73 20 24 72 65 76 31 31 20 3b 20 23 20 4e 6f  ts $rev11 ; # No
5a70: 74 20 61 20 72 6f 6f 74 20 61 6e 79 20 6c 6f 6e  t a root any lon
5a80: 67 65 72 2e 0a 0a 09 20 20 20 20 24 66 69 72 73  ger....    $firs
5a90: 74 20 63 75 74 66 72 6f 6d 70 61 72 65 6e 74 20  t cutfromparent 
5aa0: 3b 20 23 20 53 65 76 65 72 20 72 65 76 69 73 69  ; # Sever revisi
5ab0: 6f 6e 20 66 72 6f 6d 20 70 61 72 65 6e 74 20 72  on from parent r
5ac0: 65 76 69 73 69 6f 6e 2e 0a 09 20 20 20 20 69 66  evision...    if
5ad0: 20 7b 24 73 74 6f 70 20 6e 65 20 22 22 7d 20 7b   {$stop ne ""} {
5ae0: 0a 09 09 24 73 74 6f 70 20 63 75 74 66 72 6f 6d  ...$stop cutfrom
5af0: 70 61 72 65 6e 74 0a 09 09 6c 61 70 70 65 6e 64  parent...lappend
5b00: 20 6d 79 72 6f 6f 74 73 20 24 73 74 6f 70 20 3b   myroots $stop ;
5b10: 20 23 20 4e 65 77 20 72 6f 6f 74 2c 20 61 66 74   # New root, aft
5b20: 65 72 20 76 65 6e 64 6f 72 20 62 72 61 6e 63 68  er vendor branch
5b30: 0a 09 20 20 20 20 7d 0a 0a 09 20 20 20 20 23 20  ..    }...    # 
5b40: 43 75 74 20 6f 75 74 20 74 68 65 20 76 65 6e 64  Cut out the vend
5b50: 6f 72 20 62 72 61 6e 63 68 20 73 79 6d 62 6f 6c  or branch symbol
5b60: 0a 0a 09 20 20 20 20 73 65 74 20 76 65 6e 64 6f  ...    set vendo
5b70: 72 20 5b 24 66 69 72 73 74 20 70 61 72 65 6e 74  r [$first parent
5b80: 62 72 61 6e 63 68 5d 0a 09 20 20 20 20 69 6e 74  branch]..    int
5b90: 65 67 72 69 74 79 20 61 73 73 65 72 74 20 7b 24  egrity assert {$
5ba0: 76 65 6e 64 6f 72 20 6e 65 20 22 22 7d 20 7b 46  vendor ne ""} {F
5bb0: 69 72 73 74 20 4e 54 44 42 20 72 65 76 69 73 69  irst NTDB revisi
5bc0: 6f 6e 20 68 61 73 20 6e 6f 20 62 72 61 6e 63 68  on has no branch
5bd0: 7d 0a 09 20 20 20 20 69 66 20 7b 5b 24 76 65 6e  }..    if {[$ven
5be0: 64 6f 72 20 70 61 72 65 6e 74 5d 20 65 71 20 24  dor parent] eq $
5bf0: 72 65 76 31 31 7d 20 7b 0a 09 09 24 72 65 76 31  rev11} {...$rev1
5c00: 31 20 72 65 6d 6f 76 65 62 72 61 6e 63 68 20 20  1 removebranch  
5c10: 20 20 20 20 20 20 24 76 65 6e 64 6f 72 0a 09 09        $vendor...
5c20: 24 72 65 76 31 31 20 72 65 6d 6f 76 65 63 68 69  $rev11 removechi
5c30: 6c 64 6f 6e 62 72 61 6e 63 68 20 24 66 69 72 73  ldonbranch $firs
5c40: 74 0a 09 09 24 76 65 6e 64 6f 72 20 63 75 74 63  t...$vendor cutc
5c50: 68 69 6c 64 0a 09 09 24 66 69 72 73 74 20 63 75  hild...$first cu
5c60: 74 66 72 6f 6d 70 61 72 65 6e 74 62 72 61 6e 63  tfromparentbranc
5c70: 68 0a 09 09 6c 61 70 70 65 6e 64 20 6d 79 72 6f  h...lappend myro
5c80: 6f 74 73 20 24 66 69 72 73 74 0a 09 20 20 20 20  ots $first..    
5c90: 7d 0a 0a 09 20 20 20 20 23 20 43 68 61 6e 67 65  }...    # Change
5ca0: 20 74 68 65 20 74 79 70 65 20 6f 66 20 66 69 72   the type of fir
5cb0: 73 74 20 28 74 79 70 69 63 61 6c 6c 79 20 66 72  st (typically fr
5cc0: 6f 6d 20 43 68 61 6e 67 65 20 74 6f 20 41 64 64  om Change to Add
5cd0: 29 3a 0a 09 20 20 20 20 24 66 69 72 73 74 20 72  ):..    $first r
5ce0: 65 74 79 70 65 20 61 64 64 0a 0a 09 20 20 20 20  etype add...    
5cf0: 23 20 4d 6f 76 65 20 61 6e 79 20 74 61 67 73 20  # Move any tags 
5d00: 61 6e 64 20 62 72 61 6e 63 68 65 73 20 66 72 6f  and branches fro
5d10: 6d 20 74 68 65 20 6f 6c 64 20 74 6f 20 74 68 65  m the old to the
5d20: 20 6e 65 77 20 72 6f 6f 74 2e 0a 09 20 20 20 20   new root...    
5d30: 24 72 65 76 31 31 20 6d 6f 76 65 73 79 6d 62 6f  $rev11 movesymbo
5d40: 6c 73 74 6f 20 24 66 69 72 73 74 0a 09 7d 0a 0a  lsto $first..}..
5d50: 09 23 20 4d 61 72 6b 20 61 6c 6c 20 74 68 65 20  .# Mark all the 
5d60: 73 70 65 63 69 61 6c 20 72 65 76 69 73 69 6f 6e  special revision
5d70: 73 20 61 73 20 73 75 63 68 0a 09 66 6f 72 65 61  s as such..forea
5d80: 63 68 20 72 65 76 20 24 72 65 76 6c 69 73 74 20  ch rev $revlist 
5d90: 7b 0a 09 20 20 20 20 6c 6f 67 20 77 72 69 74 65  {..    log write
5da0: 20 33 20 66 69 6c 65 20 22 52 65 76 69 73 69 6f   3 file "Revisio
5db0: 6e 20 6f 6e 20 64 65 66 61 75 6c 74 20 62 72 61  n on default bra
5dc0: 6e 63 68 3a 20 5b 24 72 65 76 20 72 65 76 6e 72  nch: [$rev revnr
5dd0: 5d 22 0a 09 20 20 20 20 24 72 65 76 20 73 65 74  ]"..    $rev set
5de0: 6f 6e 64 65 66 61 75 6c 74 62 72 61 6e 63 68 20  ondefaultbranch 
5df0: 31 0a 09 7d 0a 0a 09 69 66 20 7b 24 73 74 6f 70  1..}...if {$stop
5e00: 20 6e 65 20 22 22 7d 20 7b 0a 09 20 20 20 20 23   ne ""} {..    #
5e10: 20 52 65 76 69 73 69 6f 6e 20 31 2e 32 20 6c 6f   Revision 1.2 lo
5e20: 67 69 63 61 6c 6c 79 20 66 6f 6c 6c 6f 77 73 20  gically follows 
5e30: 74 68 65 20 69 6d 70 6f 72 74 65 64 20 72 65 76  the imported rev
5e40: 69 73 69 6f 6e 73 2c 0a 09 20 20 20 20 23 20 6e  isions,..    # n
5e50: 6f 74 20 31 2e 31 2e 20 20 41 63 63 6f 72 64 69  ot 1.1.  Accordi
5e60: 6e 67 6c 79 2c 20 63 6f 6e 6e 65 63 74 20 69 74  ngly, connect it
5e70: 20 74 6f 20 74 68 65 20 6c 61 73 74 20 4e 54 44   to the last NTD
5e80: 42 52 20 61 6e 64 0a 09 20 20 20 20 23 20 70 6f  BR and..    # po
5e90: 73 73 69 62 6c 79 20 63 68 61 6e 67 65 20 69 74  ssibly change it
5ea0: 73 20 74 79 70 65 2e 0a 0a 09 20 20 20 20 73 65  s type....    se
5eb0: 74 20 6c 61 73 74 20 5b 6c 69 6e 64 65 78 20 24  t last [lindex $
5ec0: 72 65 76 6c 69 73 74 20 65 6e 64 5d 0a 09 20 20  revlist end]..  
5ed0: 20 20 24 73 74 6f 70 20 73 65 74 64 65 66 61 75    $stop setdefau
5ee0: 6c 74 62 72 61 6e 63 68 70 61 72 65 6e 74 20 24  ltbranchparent $
5ef0: 6c 61 73 74 20 3b 20 23 20 52 65 74 79 70 65 73  last ; # Retypes
5f00: 20 74 68 65 20 72 65 76 69 73 69 6f 6e 20 74 6f   the revision to
5f10: 6f 2e 0a 09 20 20 20 20 24 6c 61 73 74 20 73 65  o...    $last se
5f20: 74 64 65 66 61 75 6c 74 62 72 61 6e 63 68 63 68  tdefaultbranchch
5f30: 69 6c 64 20 20 24 73 74 6f 70 0a 09 7d 0a 09 72  ild  $stop..}..r
5f40: 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20  eturn.    }..   
5f50: 20 6d 65 74 68 6f 64 20 43 68 65 63 6b 4c 4f 44   method CheckLOD
5f60: 73 20 7b 7d 20 7b 0a 09 66 6f 72 65 61 63 68 20  s {} {..foreach 
5f70: 7b 5f 20 62 72 61 6e 63 68 7d 20 20 5b 61 72 72  {_ branch}  [arr
5f80: 61 79 20 67 65 74 20 6d 79 62 72 61 6e 63 68 65  ay get mybranche
5f90: 73 5d 20 7b 20 24 62 72 61 6e 63 68 20 63 68 65  s] { $branch che
5fa0: 63 6b 6c 6f 64 20 7d 0a 09 66 6f 72 65 61 63 68  cklod }..foreach
5fb0: 20 7b 5f 20 74 61 67 6c 69 73 74 7d 20 5b 61 72   {_ taglist} [ar
5fc0: 72 61 79 20 67 65 74 20 6d 79 74 61 67 73 5d 20  ray get mytags] 
5fd0: 7b 0a 09 20 20 20 20 66 6f 72 65 61 63 68 20 74  {..    foreach t
5fe0: 61 67 20 24 74 61 67 6c 69 73 74 20 7b 20 24 74  ag $taglist { $t
5ff0: 61 67 20 63 68 65 63 6b 6c 6f 64 20 7d 0a 09 7d  ag checklod }..}
6000: 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a  ..return.    }..
6010: 20 20 20 20 6d 65 74 68 6f 64 20 52 65 6d 6f 76      method Remov
6020: 65 49 72 72 65 6c 65 76 61 6e 74 44 65 6c 65 74  eIrrelevantDelet
6030: 69 6f 6e 73 20 7b 7d 20 7b 0a 09 23 20 46 72 6f  ions {} {..# Fro
6040: 6d 20 63 76 73 32 73 76 6e 3a 20 49 66 20 61 20  m cvs2svn: If a 
6050: 66 69 6c 65 20 69 73 20 61 64 64 65 64 20 6f 6e  file is added on
6060: 20 61 20 62 72 61 6e 63 68 2c 20 74 68 65 6e 20   a branch, then 
6070: 61 20 74 72 75 6e 6b 0a 09 23 20 72 65 76 69 73  a trunk..# revis
6080: 69 6f 6e 20 69 73 20 61 64 64 65 64 20 61 74 20  ion is added at 
6090: 74 68 65 20 73 61 6d 65 20 74 69 6d 65 20 69 6e  the same time in
60a0: 20 74 68 65 20 27 44 65 61 64 27 20 73 74 61 74   the 'Dead' stat
60b0: 65 2e 0a 09 23 20 54 68 69 73 20 72 65 76 69 73  e...# This revis
60c0: 69 6f 6e 20 64 6f 65 73 6e 27 74 20 64 6f 20 61  ion doesn't do a
60d0: 6e 79 74 68 69 6e 67 20 75 73 65 66 75 6c 2c 20  nything useful, 
60e0: 73 6f 20 64 65 6c 65 74 65 20 69 74 2e 0a 0a 09  so delete it....
60f0: 66 6f 72 65 61 63 68 20 72 6f 6f 74 20 24 6d 79  foreach root $my
6100: 72 6f 6f 74 73 20 7b 0a 09 20 20 20 20 69 66 20  roots {..    if 
6110: 7b 5b 24 72 6f 6f 74 20 69 73 6e 65 65 64 65 64  {[$root isneeded
6120: 5d 7d 20 63 6f 6e 74 69 6e 75 65 0a 09 20 20 20  ]} continue..   
6130: 20 6c 6f 67 20 77 72 69 74 65 20 32 20 66 69 6c   log write 2 fil
6140: 65 20 22 52 65 6d 6f 76 69 6e 67 20 75 6e 6e 65  e "Removing unne
6150: 63 65 73 73 61 72 79 20 64 65 61 64 20 72 65 76  cessary dead rev
6160: 69 73 69 6f 6e 20 5b 24 72 6f 6f 74 20 72 65 76  ision [$root rev
6170: 6e 72 5d 22 0a 0a 09 20 20 20 20 23 20 52 65 6d  nr]"...    # Rem
6180: 6f 76 65 20 61 73 20 72 6f 6f 74 2c 20 6d 61 6b  ove as root, mak
6190: 65 20 69 74 73 20 63 68 69 6c 64 20 6e 65 77 20  e its child new 
61a0: 72 6f 6f 74 20 61 66 74 65 72 0a 09 20 20 20 20  root after..    
61b0: 23 20 64 69 73 63 6f 6e 6e 65 63 74 69 6e 67 20  # disconnecting 
61c0: 69 74 20 66 72 6f 6d 20 74 68 65 20 72 65 76 69  it from the revi
61d0: 73 69 6f 6e 20 6a 75 73 74 20 67 6f 69 6e 67 20  sion just going 
61e0: 61 77 61 79 2e 0a 0a 09 20 20 20 20 6c 64 65 6c  away....    ldel
61f0: 65 74 65 20 6d 79 72 6f 6f 74 73 20 24 72 6f 6f  ete myroots $roo
6200: 74 0a 09 20 20 20 20 69 66 20 7b 5b 24 72 6f 6f  t..    if {[$roo
6210: 74 20 68 61 73 63 68 69 6c 64 5d 7d 20 7b 0a 09  t haschild]} {..
6220: 09 73 65 74 20 63 68 69 6c 64 20 5b 24 72 6f 6f  .set child [$roo
6230: 74 20 63 68 69 6c 64 5d 0a 09 09 24 63 68 69 6c  t child]...$chil
6240: 64 20 63 75 74 66 72 6f 6d 70 61 72 65 6e 74 0a  d cutfromparent.
6250: 09 09 6c 61 70 70 65 6e 64 20 6d 79 72 6f 6f 74  ..lappend myroot
6260: 73 20 24 63 68 69 6c 64 0a 09 20 20 20 20 7d 0a  s $child..    }.
6270: 0a 09 20 20 20 20 23 20 43 75 74 20 6f 75 74 20  ..    # Cut out 
6280: 74 68 65 20 62 72 61 6e 63 68 65 73 20 73 70 61  the branches spa
6290: 77 6e 65 64 20 62 79 20 74 68 65 20 72 65 76 69  wned by the revi
62a0: 73 69 6f 6e 20 74 6f 20 62 65 0a 09 20 20 20 20  sion to be..    
62b0: 23 20 64 65 6c 65 74 65 64 2e 20 49 66 20 74 68  # deleted. If th
62c0: 65 20 62 72 61 6e 63 68 20 68 61 73 20 72 65 76  e branch has rev
62d0: 69 73 69 6f 6e 73 20 74 68 65 79 20 73 68 6f 75  isions they shou
62e0: 6c 64 20 61 6c 72 65 61 64 79 0a 09 20 20 20 20  ld already..    
62f0: 23 20 75 73 65 20 6f 70 65 72 61 74 69 6f 6e 20  # use operation 
6300: 27 61 64 64 27 2c 20 6e 6f 20 6e 65 65 64 20 74  'add', no need t
6310: 6f 20 63 68 61 6e 67 65 20 74 68 61 74 2e 20 54  o change that. T
6320: 68 65 20 66 69 72 73 74 0a 09 20 20 20 20 23 20  he first..    # 
6330: 72 65 76 69 73 69 6f 6e 20 6f 6e 20 65 61 63 68  revision on each
6340: 20 62 72 61 6e 63 68 20 62 65 63 6f 6d 65 73 20   branch becomes 
6350: 61 20 6e 65 77 20 61 6e 64 20 64 69 73 63 6f 6e  a new and discon
6360: 6e 65 63 74 65 64 0a 09 20 20 20 20 23 20 72 6f  nected..    # ro
6370: 6f 74 2e 0a 0a 09 20 20 20 20 66 6f 72 65 61 63  ot....    foreac
6380: 68 20 62 72 61 6e 63 68 20 5b 24 72 6f 6f 74 20  h branch [$root 
6390: 62 72 61 6e 63 68 65 73 5d 20 7b 0a 09 09 69 66  branches] {...if
63a0: 20 7b 21 5b 24 62 72 61 6e 63 68 20 68 61 73 63   {![$branch hasc
63b0: 68 69 6c 64 5d 7d 20 63 6f 6e 74 69 6e 75 65 0a  hild]} continue.
63c0: 09 09 73 65 74 20 66 69 72 73 74 20 5b 24 62 72  ..set first [$br
63d0: 61 6e 63 68 20 63 68 69 6c 64 5d 0a 09 09 24 66  anch child]...$f
63e0: 69 72 73 74 20 63 75 74 66 72 6f 6d 70 61 72 65  irst cutfrompare
63f0: 6e 74 62 72 61 6e 63 68 0a 09 09 24 66 69 72 73  ntbranch...$firs
6400: 74 20 63 75 74 66 72 6f 6d 70 61 72 65 6e 74 0a  t cutfromparent.
6410: 09 09 24 62 72 61 6e 63 68 20 63 75 74 63 68 69  ..$branch cutchi
6420: 6c 64 0a 09 09 6c 61 70 70 65 6e 64 20 6d 79 72  ld...lappend myr
6430: 6f 6f 74 73 20 24 66 69 72 73 74 0a 09 20 20 20  oots $first..   
6440: 20 7d 0a 09 20 20 20 20 24 72 6f 6f 74 20 72 65   }..    $root re
6450: 6d 6f 76 65 61 6c 6c 62 72 61 6e 63 68 65 73 0a  moveallbranches.
6460: 0a 09 20 20 20 20 23 20 54 61 67 67 69 6e 67 20  ..    # Tagging 
6470: 61 20 64 65 61 64 20 72 65 76 69 73 69 6f 6e 20  a dead revision 
6480: 64 6f 65 73 6e 27 74 20 64 6f 20 61 6e 79 74 68  doesn't do anyth
6490: 69 6e 67 2c 20 73 6f 20 72 65 6d 6f 76 65 0a 09  ing, so remove..
64a0: 20 20 20 20 23 20 61 6e 79 20 74 61 67 73 20 74      # any tags t
64b0: 68 61 74 20 77 65 72 65 20 73 65 74 20 6f 6e 20  hat were set on 
64c0: 69 74 2e 0a 0a 09 20 20 20 20 24 72 6f 6f 74 20  it....    $root 
64d0: 72 65 6d 6f 76 65 61 6c 6c 74 61 67 73 0a 0a 09  removealltags...
64e0: 20 20 20 20 23 20 54 68 69 73 20 63 61 6e 20 6f      # This can o
64f0: 6e 6c 79 20 68 61 70 70 65 6e 20 6f 6e 63 65 20  nly happen once 
6500: 70 65 72 20 66 69 6c 65 2c 20 61 6e 64 20 77 65  per file, and we
6510: 20 6d 69 67 68 74 20 68 61 76 65 0a 09 20 20 20   might have..   
6520: 20 23 20 6a 75 73 74 20 63 68 61 6e 67 65 64 20   # just changed 
6530: 6d 79 72 6f 6f 74 73 2c 20 73 6f 20 65 6e 64 20  myroots, so end 
6540: 74 68 65 20 6c 6f 6f 70 0a 09 20 20 20 20 62 72  the loop..    br
6550: 65 61 6b 0a 09 7d 0a 09 72 65 74 75 72 6e 0a 20  eak..}..return. 
6560: 20 20 20 7d 0a 0a 20 20 20 20 6d 65 74 68 6f 64     }..    method
6570: 20 52 65 6d 6f 76 65 49 6e 69 74 69 61 6c 42 72   RemoveInitialBr
6580: 61 6e 63 68 44 65 6c 65 74 69 6f 6e 73 20 7b 7d  anchDeletions {}
6590: 20 7b 0a 09 23 20 46 72 6f 6d 20 63 76 73 32 73   {..# From cvs2s
65a0: 76 6e 3a 20 49 66 20 74 68 65 20 66 69 72 73 74  vn: If the first
65b0: 20 72 65 76 69 73 69 6f 6e 20 6f 6e 20 61 20 62   revision on a b
65c0: 72 61 6e 63 68 20 69 73 20 61 6e 0a 09 23 20 75  ranch is an..# u
65d0: 6e 6e 65 63 65 73 73 61 72 79 20 64 65 6c 65 74  nnecessary delet
65e0: 65 2c 20 72 65 6d 6f 76 65 20 69 74 2e 0a 09 23  e, remove it...#
65f0: 0a 09 23 20 49 66 20 61 20 66 69 6c 65 20 69 73  ..# If a file is
6600: 20 61 64 64 65 64 20 6f 6e 20 61 20 62 72 61 6e   added on a bran
6610: 63 68 20 28 77 68 65 74 68 65 72 20 6f 72 20 6e  ch (whether or n
6620: 6f 74 20 69 74 20 61 6c 72 65 61 64 79 0a 09 23  ot it already..#
6630: 20 65 78 69 73 74 65 64 20 6f 6e 20 74 72 75 6e   existed on trun
6640: 6b 29 2c 20 74 68 65 6e 20 6e 65 77 20 76 65 72  k), then new ver
6650: 73 69 6f 6e 73 20 6f 66 20 43 56 53 20 61 64 64  sions of CVS add
6660: 20 61 20 66 69 72 73 74 0a 09 23 20 62 72 61 6e   a first..# bran
6670: 63 68 20 72 65 76 69 73 69 6f 6e 20 69 6e 20 74  ch revision in t
6680: 68 65 20 27 64 65 61 64 27 20 73 74 61 74 65 20  he 'dead' state 
6690: 28 74 6f 20 69 6e 64 69 63 61 74 65 20 74 68 61  (to indicate tha
66a0: 74 20 74 68 65 0a 09 23 20 66 69 6c 65 20 64 69  t the..# file di
66b0: 64 20 6e 6f 74 20 65 78 69 73 74 20 6f 6e 20 74  d not exist on t
66c0: 68 65 20 62 72 61 6e 63 68 20 77 68 65 6e 20 74  he branch when t
66d0: 68 65 20 62 72 61 6e 63 68 20 77 61 73 0a 09 23  he branch was..#
66e0: 20 63 72 65 61 74 65 64 29 20 66 6f 6c 6c 6f 77   created) follow
66f0: 65 64 20 62 79 20 74 68 65 20 73 65 63 6f 6e 64  ed by the second
6700: 20 62 72 61 6e 63 68 20 72 65 76 69 73 69 6f 6e   branch revision
6710: 2c 20 77 68 69 63 68 20 69 73 20 61 6e 0a 09 23  , which is an..#
6720: 20 61 64 64 2e 20 20 57 68 65 6e 20 77 65 20 65   add.  When we e
6730: 6e 63 6f 75 6e 74 65 72 20 74 68 69 73 20 73 69  ncounter this si
6740: 74 75 61 74 69 6f 6e 2c 20 77 65 20 73 65 76 65  tuation, we seve
6750: 72 20 74 68 65 20 62 72 61 6e 63 68 0a 09 23 20  r the branch..# 
6760: 66 72 6f 6d 20 74 72 75 6e 6b 20 61 6e 64 20 64  from trunk and d
6770: 65 6c 65 74 65 20 74 68 65 20 66 69 72 73 74 20  elete the first 
6780: 62 72 61 6e 63 68 20 72 65 76 69 73 69 6f 6e 2e  branch revision.
6790: 0a 0a 09 23 20 41 74 20 74 68 69 73 20 70 6f 69  ...# At this poi
67a0: 6e 74 20 77 65 20 6d 61 79 20 68 61 76 65 20 61  nt we may have a
67b0: 6c 72 65 61 64 79 20 6d 75 6c 74 69 70 6c 65 20  lready multiple 
67c0: 72 6f 6f 74 73 20 69 6e 20 6d 79 72 6f 6f 74 73  roots in myroots
67d0: 2c 0a 09 23 20 77 65 20 68 61 76 65 20 74 6f 20  ,..# we have to 
67e0: 70 72 6f 63 65 73 73 20 74 68 65 6d 20 61 6c 6c  process them all
67f0: 2e 0a 0a 09 66 6f 72 65 61 63 68 20 72 6f 6f 74  ....foreach root
6800: 20 5b 24 73 65 6c 66 20 4c 69 6e 65 73 4f 66 44   [$self LinesOfD
6810: 65 76 65 6c 6f 70 6d 65 6e 74 5d 20 7b 0a 09 20  evelopment] {.. 
6820: 20 20 20 69 66 20 7b 5b 24 72 6f 6f 74 20 69 73     if {[$root is
6830: 6e 65 65 64 65 64 62 72 61 6e 63 68 64 65 6c 5d  neededbranchdel]
6840: 7d 20 63 6f 6e 74 69 6e 75 65 0a 09 20 20 20 20  } continue..    
6850: 6c 6f 67 20 77 72 69 74 65 20 32 20 66 69 6c 65  log write 2 file
6860: 20 22 52 65 6d 6f 76 69 6e 67 20 75 6e 6e 65 63   "Removing unnec
6870: 65 73 73 61 72 79 20 69 6e 69 74 69 61 6c 20 62  essary initial b
6880: 72 61 6e 63 68 20 64 65 6c 65 74 65 20 5b 24 72  ranch delete [$r
6890: 6f 6f 74 20 72 65 76 6e 72 5d 22 0a 0a 09 20 20  oot revnr]"...  
68a0: 20 20 73 65 74 20 62 72 61 6e 63 68 20 5b 24 72    set branch [$r
68b0: 6f 6f 74 20 70 61 72 65 6e 74 62 72 61 6e 63 68  oot parentbranch
68c0: 5d 0a 09 20 20 20 20 73 65 74 20 70 61 72 65 6e  ]..    set paren
68d0: 74 20 5b 24 72 6f 6f 74 20 70 61 72 65 6e 74 5d  t [$root parent]
68e0: 0a 09 20 20 20 20 73 65 74 20 63 68 69 6c 64 20  ..    set child 
68f0: 20 5b 24 72 6f 6f 74 20 63 68 69 6c 64 5d 0a 0a   [$root child]..
6900: 09 20 20 20 20 6c 64 65 6c 65 74 65 20 6d 79 72  .    ldelete myr
6910: 6f 6f 74 73 20 24 72 6f 6f 74 0a 09 20 20 20 20  oots $root..    
6920: 6c 61 70 70 65 6e 64 20 6d 79 72 6f 6f 74 73 20  lappend myroots 
6930: 24 63 68 69 6c 64 0a 0a 09 20 20 20 20 24 62 72  $child...    $br
6940: 61 6e 63 68 20 63 75 74 63 68 69 6c 64 0a 09 20  anch cutchild.. 
6950: 20 20 20 24 63 68 69 6c 64 20 20 63 75 74 66 72     $child  cutfr
6960: 6f 6d 70 61 72 65 6e 74 0a 0a 09 20 20 20 20 24  omparent...    $
6970: 70 61 72 65 6e 74 20 72 65 6d 6f 76 65 62 72 61  parent removebra
6980: 6e 63 68 20 20 20 20 20 20 20 20 24 62 72 61 6e  nch        $bran
6990: 63 68 0a 09 20 20 20 20 24 70 61 72 65 6e 74 20  ch..    $parent 
69a0: 72 65 6d 6f 76 65 63 68 69 6c 64 6f 6e 62 72 61  removechildonbra
69b0: 6e 63 68 20 24 72 6f 6f 74 0a 09 7d 0a 09 72 65  nch $root..}..re
69c0: 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20  turn.    }..    
69d0: 6d 65 74 68 6f 64 20 4c 69 6e 65 73 4f 66 44 65  method LinesOfDe
69e0: 76 65 6c 6f 70 6d 65 6e 74 20 7b 7d 20 7b 0a 09  velopment {} {..
69f0: 23 20 44 65 74 65 72 6d 69 6e 65 20 61 6c 6c 20  # Determine all 
6a00: 6c 69 6e 65 73 20 6f 66 20 64 65 76 65 6c 6f 70  lines of develop
6a10: 6d 65 6e 74 20 66 6f 72 20 74 68 65 20 66 69 6c  ment for the fil
6a20: 65 2e 20 54 68 69 73 20 61 72 65 0a 09 23 20 74  e. This are..# t
6a30: 68 65 20 6b 6e 6f 77 6e 20 72 6f 6f 74 73 2c 20  he known roots, 
6a40: 61 6e 64 20 74 68 65 20 72 6f 6f 74 20 6f 66 20  and the root of 
6a50: 61 6c 6c 20 62 72 61 6e 63 68 65 73 20 66 6f 75  all branches fou
6a60: 6e 64 20 6f 6e 20 74 68 65 0a 09 23 20 6c 69 6e  nd on the..# lin
6a70: 65 20 6f 66 20 70 72 69 6d 61 72 79 20 63 68 69  e of primary chi
6a80: 6c 64 72 65 6e 2e 0a 0a 09 73 65 74 20 6c 6f 64  ldren....set lod
6a90: 72 6f 6f 74 73 20 7b 7d 0a 09 66 6f 72 65 61 63  roots {}..foreac
6aa0: 68 20 72 6f 6f 74 20 24 6d 79 72 6f 6f 74 73 20  h root $myroots 
6ab0: 7b 0a 09 20 20 20 20 24 73 65 6c 66 20 41 64 64  {..    $self Add
6ac0: 42 72 61 6e 63 68 65 64 4c 69 6e 65 73 4f 66 44  BranchedLinesOfD
6ad0: 65 76 65 6c 6f 70 6d 65 6e 74 20 6c 6f 64 72 6f  evelopment lodro
6ae0: 6f 74 73 20 24 72 6f 6f 74 0a 09 20 20 20 20 6c  ots $root..    l
6af0: 61 70 70 65 6e 64 20 6c 6f 64 72 6f 6f 74 73 20  append lodroots 
6b00: 24 72 6f 6f 74 0a 09 7d 0a 09 72 65 74 75 72 6e  $root..}..return
6b10: 20 24 6c 6f 64 72 6f 6f 74 73 0a 20 20 20 20 7d   $lodroots.    }
6b20: 0a 0a 20 20 20 20 6d 65 74 68 6f 64 20 41 64 64  ..    method Add
6b30: 42 72 61 6e 63 68 65 64 4c 69 6e 65 73 4f 66 44  BranchedLinesOfD
6b40: 65 76 65 6c 6f 70 6d 65 6e 74 20 7b 6c 76 20 72  evelopment {lv r
6b50: 6f 6f 74 7d 20 7b 0a 09 75 70 76 61 72 20 31 20  oot} {..upvar 1 
6b60: 24 6c 76 20 6c 6f 64 72 6f 6f 74 73 0a 09 77 68  $lv lodroots..wh
6b70: 69 6c 65 20 7b 24 72 6f 6f 74 20 6e 65 20 22 22  ile {$root ne ""
6b80: 7d 20 7b 0a 09 20 20 20 20 66 6f 72 65 61 63 68  } {..    foreach
6b90: 20 62 72 61 6e 63 68 20 5b 24 72 6f 6f 74 20 62   branch [$root b
6ba0: 72 61 6e 63 68 65 73 5d 20 7b 0a 09 09 69 66 20  ranches] {...if 
6bb0: 7b 21 5b 24 62 72 61 6e 63 68 20 68 61 73 63 68  {![$branch hasch
6bc0: 69 6c 64 5d 7d 20 63 6f 6e 74 69 6e 75 65 0a 09  ild]} continue..
6bd0: 09 73 65 74 20 63 68 69 6c 64 20 5b 24 62 72 61  .set child [$bra
6be0: 6e 63 68 20 63 68 69 6c 64 5d 0a 09 09 23 20 52  nch child]...# R
6bf0: 65 63 75 72 73 65 20 69 6e 74 6f 20 74 68 65 20  ecurse into the 
6c00: 62 72 61 6e 63 68 20 66 6f 72 20 64 65 65 70 65  branch for deepe
6c10: 72 20 62 72 61 6e 63 68 65 73 2e 0a 09 09 24 73  r branches....$s
6c20: 65 6c 66 20 41 64 64 42 72 61 6e 63 68 65 64 4c  elf AddBranchedL
6c30: 69 6e 65 73 4f 66 44 65 76 65 6c 6f 70 6d 65 6e  inesOfDevelopmen
6c40: 74 20 6c 6f 64 72 6f 6f 74 73 20 24 63 68 69 6c  t lodroots $chil
6c50: 64 0a 09 09 6c 61 70 70 65 6e 64 20 6c 6f 64 72  d...lappend lodr
6c60: 6f 6f 74 73 20 24 63 68 69 6c 64 0a 09 20 20 20  oots $child..   
6c70: 20 7d 0a 09 20 20 20 20 73 65 74 20 72 6f 6f 74   }..    set root
6c80: 20 5b 24 72 6f 6f 74 20 63 68 69 6c 64 5d 0a 09   [$root child]..
6c90: 7d 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a  }..return.    }.
6ca0: 0a 20 20 20 20 6d 65 74 68 6f 64 20 45 78 63 6c  .    method Excl
6cb0: 75 64 65 4e 6f 6e 54 72 75 6e 6b 49 6e 66 6f 72  udeNonTrunkInfor
6cc0: 6d 61 74 69 6f 6e 20 7b 7d 20 7b 0a 09 23 20 52  mation {} {..# R
6cd0: 65 6d 6f 76 65 20 61 6c 6c 20 6e 6f 6e 2d 74 72  emove all non-tr
6ce0: 75 6e 6b 20 62 72 61 6e 63 68 65 73 2c 20 72 65  unk branches, re
6cf0: 76 69 73 69 6f 6e 73 2c 20 61 6e 64 20 74 61 67  visions, and tag
6d00: 73 2e 20 57 65 20 64 6f 0a 09 23 20 6b 65 65 70  s. We do..# keep
6d10: 20 74 68 65 20 74 61 67 73 20 77 68 69 63 68 20   the tags which 
6d20: 61 72 65 20 6f 6e 20 74 68 65 20 74 72 75 6e 6b  are on the trunk
6d30: 2e 0a 0a 09 73 65 74 20 6e 74 64 62 72 6f 6f 74  ....set ntdbroot
6d40: 20 22 22 0a 09 66 6f 72 65 61 63 68 20 72 6f 6f   ""..foreach roo
6d50: 74 20 5b 24 73 65 6c 66 20 4c 69 6e 65 73 4f 66  t [$self LinesOf
6d60: 44 65 76 65 6c 6f 70 6d 65 6e 74 5d 20 7b 0a 09  Development] {..
6d70: 20 20 20 20 23 20 4e 6f 74 65 3a 20 48 65 72 65      # Note: Here
6d80: 20 74 68 65 20 6f 72 64 65 72 20 6f 66 20 74 68   the order of th
6d90: 65 20 72 6f 6f 74 73 20 69 73 20 69 6d 70 6f 72  e roots is impor
6da0: 74 61 6e 74 2c 0a 09 20 20 20 20 23 20 69 2e 65  tant,..    # i.e
6db0: 2e 20 74 68 61 74 20 77 65 20 67 65 74 20 74 68  . that we get th
6dc0: 65 6d 20 69 6e 20 64 65 70 74 68 20 66 69 72 73  em in depth firs
6dd0: 74 20 6f 72 64 65 72 2e 20 54 68 69 73 20 65 6e  t order. This en
6de0: 73 75 72 65 73 0a 09 20 20 20 20 23 20 74 68 61  sures..    # tha
6df0: 74 20 74 68 65 20 72 65 6d 6f 76 61 6c 20 6f 66  t the removal of
6e00: 20 61 20 62 72 61 6e 63 68 20 68 61 70 70 65 6e   a branch happen
6e10: 73 20 6f 6e 6c 79 20 61 66 74 65 72 20 74 68 65  s only after the
6e20: 0a 09 20 20 20 20 23 20 62 72 61 6e 63 68 65 73  ..    # branches
6e30: 20 73 70 61 77 6e 65 64 20 66 72 6f 6d 20 69 74   spawned from it
6e40: 20 77 65 72 65 20 72 65 6d 6f 76 65 64 2e 20 4f   were removed. O
6e50: 74 68 65 72 77 69 73 65 20 74 68 65 0a 09 20 20  therwise the..  
6e60: 20 20 23 20 73 79 73 74 65 6d 20 6d 69 67 68 74    # system might
6e70: 20 74 72 79 20 74 6f 20 61 63 63 65 73 73 20 64   try to access d
6e80: 65 6c 65 74 65 64 20 6f 62 6a 65 63 74 73 2e 0a  eleted objects..
6e90: 0a 09 20 20 20 20 23 20 44 6f 20 6e 6f 74 20 65  ..    # Do not e
6ea0: 78 63 6c 75 64 65 20 74 68 65 20 74 72 75 6e 6b  xclude the trunk
6eb0: 2e 0a 09 20 20 20 20 69 66 20 7b 5b 5b 24 72 6f  ...    if {[[$ro
6ec0: 6f 74 20 6c 6f 64 5d 20 69 73 74 72 75 6e 6b 5d  ot lod] istrunk]
6ed0: 7d 20 63 6f 6e 74 69 6e 75 65 0a 09 20 20 20 20  } continue..    
6ee0: 24 73 65 6c 66 20 45 78 63 6c 75 64 65 42 72 61  $self ExcludeBra
6ef0: 6e 63 68 20 24 72 6f 6f 74 20 6e 74 64 62 72 6f  nch $root ntdbro
6f00: 6f 74 0a 09 7d 0a 0a 09 69 66 20 7b 24 6e 74 64  ot..}...if {$ntd
6f10: 62 72 6f 6f 74 20 6e 65 20 22 22 7d 20 7b 0a 09  broot ne ""} {..
6f20: 20 20 20 20 24 73 65 6c 66 20 47 72 61 66 74 4e      $self GraftN
6f30: 54 44 42 32 54 72 75 6e 6b 20 24 6e 74 64 62 72  TDB2Trunk $ntdbr
6f40: 6f 6f 74 0a 09 7d 0a 09 72 65 74 75 72 6e 0a 20  oot..}..return. 
6f50: 20 20 20 7d 0a 0a 20 20 20 20 6d 65 74 68 6f 64     }..    method
6f60: 20 45 78 63 6c 75 64 65 42 72 61 6e 63 68 20 7b   ExcludeBranch {
6f70: 72 6f 6f 74 20 6e 76 7d 20 7b 0a 09 23 20 45 78  root nv} {..# Ex
6f80: 63 6c 75 64 65 20 74 68 65 20 62 72 61 6e 63 68  clude the branch
6f90: 2f 6c 6f 64 20 73 74 61 72 74 69 6e 67 20 61 74  /lod starting at
6fa0: 20 72 6f 6f 74 2c 20 61 20 72 65 76 69 73 69 6f   root, a revisio
6fb0: 6e 2e 0a 09 23 0a 09 23 20 49 66 20 74 68 65 20  n...#..# If the 
6fc0: 4c 4f 44 20 73 74 61 72 74 73 20 77 69 74 68 20  LOD starts with 
6fd0: 6e 6f 6e 2d 74 72 75 6e 6b 20 64 65 66 61 75 6c  non-trunk defaul
6fe0: 74 20 62 72 61 6e 63 68 20 72 65 76 69 73 69 6f  t branch revisio
6ff0: 6e 73 2c 0a 09 23 20 77 65 20 6c 65 61 76 65 20  ns,..# we leave 
7000: 74 68 65 6d 20 69 6e 20 70 6c 61 63 65 20 61 6e  them in place an
7010: 64 20 64 6f 20 6e 6f 74 20 64 65 6c 65 74 65 20  d do not delete 
7020: 74 68 65 20 62 72 61 6e 63 68 2e 20 49 6e 20 74  the branch. In t
7030: 68 61 74 0a 09 23 20 63 61 73 65 20 74 68 65 20  hat..# case the 
7040: 63 6f 6d 6d 61 6e 64 20 73 65 74 73 20 74 68 65  command sets the
7050: 20 76 61 72 69 61 62 6c 65 20 69 6e 20 4e 56 20   variable in NV 
7060: 73 6f 20 74 68 61 74 20 77 65 20 63 61 6e 0a 09  so that we can..
7070: 23 20 6c 61 74 65 72 20 72 65 77 6f 72 6b 20 74  # later rework t
7080: 68 65 73 65 20 72 65 76 69 73 6f 6e 73 20 74 6f  hese revisons to
7090: 20 62 65 20 70 75 72 65 6c 79 20 74 72 75 6e 6b   be purely trunk
70a0: 2e 0a 0a 09 69 66 20 7b 5b 24 72 6f 6f 74 20 69  ....if {[$root i
70b0: 73 6f 6e 64 65 66 61 75 6c 74 62 72 61 6e 63 68  sondefaultbranch
70c0: 5d 7d 20 7b 0a 09 20 20 20 20 23 20 48 61 6e 64  ]} {..    # Hand
70d0: 6c 69 6e 67 20 61 20 4e 54 44 42 2e 20 54 68 69  ling a NTDB. Thi
70e0: 73 20 62 72 61 6e 63 68 20 6d 61 79 20 63 6f 6e  s branch may con
70f0: 73 69 73 74 73 20 6e 6f 74 20 6f 6e 6c 79 20 6f  sists not only o
7100: 66 0a 09 20 20 20 20 23 20 4e 54 44 42 20 72 65  f..    # NTDB re
7110: 76 69 73 69 6f 6e 73 2c 20 62 75 74 20 61 6c 73  visions, but als
7120: 6f 20 73 6f 6d 65 20 6e 6f 6e 2d 4e 54 44 42 2e  o some non-NTDB.
7130: 20 54 68 65 20 6c 61 74 74 65 72 20 61 72 65 0a   The latter are.
7140: 09 20 20 20 20 23 20 74 72 75 6c 79 20 6f 6e 20  .    # truly on 
7150: 61 20 62 72 61 6e 63 68 20 61 6e 64 20 68 61 76  a branch and hav
7160: 65 20 74 6f 20 62 65 20 65 78 63 6c 75 64 65 64  e to be excluded
7170: 2e 20 54 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 0a  . The following.
7180: 09 20 20 20 20 23 20 6c 6f 6f 70 20 64 65 74 65  .    # loop dete
7190: 72 6d 69 6e 65 73 20 69 66 20 74 68 65 72 65 20  rmines if there 
71a0: 61 72 65 20 73 75 63 68 20 72 65 76 69 73 69 6f  are such revisio
71b0: 6e 73 2e 0a 0a 09 20 20 20 20 75 70 76 61 72 20  ns....    upvar 
71c0: 31 20 24 6e 76 20 6e 74 64 62 72 6f 6f 74 0a 09  1 $nv ntdbroot..
71d0: 20 20 20 20 73 65 74 20 6e 74 64 62 72 6f 6f 74      set ntdbroot
71e0: 20 24 72 6f 6f 74 0a 09 20 20 20 20 24 72 6f 6f   $root..    $roo
71f0: 74 20 63 75 74 66 72 6f 6d 70 61 72 65 6e 74 62  t cutfromparentb
7200: 72 61 6e 63 68 0a 0a 09 20 20 20 20 73 65 74 20  ranch...    set 
7210: 72 65 76 20 24 72 6f 6f 74 0a 09 20 20 20 20 77  rev $root..    w
7220: 68 69 6c 65 20 7b 24 72 65 76 20 6e 65 20 22 22  hile {$rev ne ""
7230: 7d 20 7b 0a 09 09 24 72 65 76 20 72 65 6d 6f 76  } {...$rev remov
7240: 65 61 6c 6c 62 72 61 6e 63 68 65 73 0a 09 09 23  eallbranches...#
7250: 20 53 65 65 20 6e 6f 74 65 20 5b 78 5d 2e 0a 0a   See note [x]...
7260: 09 09 69 66 20 7b 5b 24 72 65 76 20 69 73 6f 6e  ..if {[$rev ison
7270: 64 65 66 61 75 6c 74 62 72 61 6e 63 68 5d 7d 20  defaultbranch]} 
7280: 7b 0a 09 09 20 20 20 20 73 65 74 20 72 65 76 20  {...    set rev 
7290: 5b 24 72 65 76 20 63 68 69 6c 64 5d 0a 09 09 7d  [$rev child]...}
72a0: 20 65 6c 73 65 20 7b 0a 09 09 20 20 20 20 62 72   else {...    br
72b0: 65 61 6b 0a 09 09 7d 0a 09 20 20 20 20 7d 0a 0a  eak...}..    }..
72c0: 09 20 20 20 20 23 20 72 65 76 20 6e 6f 77 20 63  .    # rev now c
72d0: 6f 6e 74 61 69 6e 73 20 74 68 65 20 66 69 72 73  ontains the firs
72e0: 74 20 6e 6f 6e 2d 4e 54 44 42 20 72 65 76 69 73  t non-NTDB revis
72f0: 69 6f 6e 20 61 66 74 65 72 20 74 68 65 0a 09 20  ion after the.. 
7300: 20 20 20 23 20 4e 54 44 42 2c 20 6f 72 20 69 73     # NTDB, or is
7310: 20 65 6d 70 74 79 20 69 66 20 74 68 65 72 65 20   empty if there 
7320: 69 73 20 6e 6f 20 73 75 63 68 2e 20 49 66 20 77  is no such. If w
7330: 65 20 68 61 76 65 20 73 6f 6d 65 0a 09 20 20 20  e have some..   
7340: 20 23 20 74 68 65 79 20 68 61 76 65 20 74 6f 20   # they have to 
7350: 72 65 6d 6f 76 65 64 2e 0a 0a 09 20 20 20 20 69  removed....    i
7360: 66 20 7b 24 72 65 76 20 6e 65 20 22 22 7d 20 20  f {$rev ne ""}  
7370: 7b 0a 09 09 73 65 74 20 6c 61 73 74 6e 74 64 62  {...set lastntdb
7380: 20 5b 24 72 65 76 20 70 61 72 65 6e 74 5d 0a 09   [$rev parent]..
7390: 09 24 6c 61 73 74 6e 74 64 62 20 63 75 74 66 72  .$lastntdb cutfr
73a0: 6f 6d 63 68 69 6c 64 0a 09 09 77 68 69 6c 65 20  omchild...while 
73b0: 7b 24 72 65 76 20 6e 65 20 22 22 7d 20 7b 0a 09  {$rev ne ""} {..
73c0: 09 20 20 20 20 24 72 65 76 20 72 65 6d 6f 76 65  .    $rev remove
73d0: 61 6c 6c 74 61 67 73 0a 09 09 20 20 20 20 24 72  alltags...    $r
73e0: 65 76 20 72 65 6d 6f 76 65 61 6c 6c 62 72 61 6e  ev removeallbran
73f0: 63 68 65 73 0a 09 09 20 20 20 20 23 20 4e 6f 74  ches...    # Not
7400: 65 20 5b 78 5d 3a 20 57 65 20 6d 61 79 20 73 74  e [x]: We may st
7410: 69 6c 6c 20 68 61 76 65 20 68 61 64 20 62 72 61  ill have had bra
7420: 6e 63 68 65 73 20 6f 6e 20 74 68 65 0a 09 09 20  nches on the... 
7430: 20 20 20 23 20 72 65 76 69 73 69 6f 6e 2e 20 42     # revision. B
7440: 72 61 6e 63 68 65 73 20 77 69 74 68 6f 75 74 20  ranches without 
7450: 72 65 76 69 73 69 6f 6e 73 20 63 6f 6d 6d 69 74  revisions commit
7460: 74 65 64 0a 09 09 20 20 20 20 23 20 6f 6e 20 74  ted...    # on t
7470: 68 65 6d 20 64 6f 20 6e 6f 74 20 73 68 6f 77 20  hem do not show 
7480: 75 70 20 69 6e 20 74 68 65 20 6c 69 73 74 20 6f  up in the list o
7490: 66 20 72 6f 6f 74 73 20 61 6b 61 0a 09 09 20 20  f roots aka...  
74a0: 20 20 23 20 6c 69 6e 65 73 20 6f 66 20 64 65 76    # lines of dev
74b0: 65 6c 6f 70 6d 65 6e 74 2e 0a 09 09 20 20 20 20  elopment....    
74c0: 73 65 74 20 72 65 76 20 5b 24 72 65 76 20 63 68  set rev [$rev ch
74d0: 69 6c 64 5d 0a 09 09 7d 0a 09 20 20 20 20 7d 0a  ild]...}..    }.
74e0: 09 20 20 20 20 72 65 74 75 72 6e 0a 09 7d 0a 0a  .    return..}..
74f0: 09 23 20 4e 6f 20 4e 54 44 42 20 73 74 75 66 66  .# No NTDB stuff
7500: 20 74 6f 20 64 65 61 6c 20 77 69 74 68 2e 20 46   to deal with. F
7510: 69 72 73 74 20 64 65 6c 65 74 65 20 74 68 65 20  irst delete the 
7520: 62 72 61 6e 63 68 20 6f 62 6a 65 63 74 0a 09 23  branch object..#
7530: 20 69 74 73 65 6c 66 2c 20 61 66 74 65 72 20 63   itself, after c
7540: 75 74 74 69 6e 67 20 61 6c 6c 20 74 68 65 20 76  utting all the v
7550: 61 72 69 6f 75 73 20 63 6f 6e 6e 65 63 74 69 6f  arious connectio
7560: 6e 73 2e 0a 0a 09 73 65 74 20 62 72 61 6e 63 68  ns....set branch
7570: 20 5b 24 72 6f 6f 74 20 70 61 72 65 6e 74 62 72   [$root parentbr
7580: 61 6e 63 68 5d 0a 09 69 66 20 7b 24 62 72 61 6e  anch]..if {$bran
7590: 63 68 20 6e 65 20 22 22 7d 20 7b 0a 09 20 20 20  ch ne ""} {..   
75a0: 20 73 65 74 20 62 72 61 6e 63 68 70 61 72 65 6e   set branchparen
75b0: 74 20 5b 24 62 72 61 6e 63 68 20 70 61 72 65 6e  t [$branch paren
75c0: 74 5d 0a 09 20 20 20 20 24 62 72 61 6e 63 68 70  t]..    $branchp
75d0: 61 72 65 6e 74 20 72 65 6d 6f 76 65 62 72 61 6e  arent removebran
75e0: 63 68 20 20 20 20 20 20 20 20 24 62 72 61 6e 63  ch        $branc
75f0: 68 0a 09 20 20 20 20 24 62 72 61 6e 63 68 70 61  h..    $branchpa
7600: 72 65 6e 74 20 72 65 6d 6f 76 65 63 68 69 6c 64  rent removechild
7610: 6f 6e 62 72 61 6e 63 68 20 24 72 6f 6f 74 0a 09  onbranch $root..
7620: 7d 0a 0a 09 23 20 54 68 65 20 72 6f 6f 74 20 69  }...# The root i
7630: 73 20 6e 6f 20 73 75 63 68 20 61 6e 79 20 6c 6f  s no such any lo
7640: 6e 67 65 72 20 65 69 74 68 65 72 2e 0a 09 6c 64  nger either...ld
7650: 65 6c 65 74 65 20 6d 79 72 6f 6f 74 73 20 24 72  elete myroots $r
7660: 6f 6f 74 0a 0a 09 23 20 4e 6f 77 20 67 6f 20 74  oot...# Now go t
7670: 68 72 6f 75 67 68 20 74 68 65 20 6c 69 6e 65 20  hrough the line 
7680: 61 6e 64 20 72 65 6d 6f 76 65 20 61 6c 6c 20 69  and remove all i
7690: 74 73 20 72 65 76 69 73 69 6f 6e 73 2e 0a 0a 09  ts revisions....
76a0: 77 68 69 6c 65 20 7b 24 72 6f 6f 74 20 6e 65 20  while {$root ne 
76b0: 22 22 7d 20 7b 0a 09 20 20 20 20 24 72 6f 6f 74  ""} {..    $root
76c0: 20 72 65 6d 6f 76 65 61 6c 6c 74 61 67 73 0a 09   removealltags..
76d0: 20 20 20 20 24 72 6f 6f 74 20 72 65 6d 6f 76 65      $root remove
76e0: 61 6c 6c 62 72 61 6e 63 68 65 73 0a 09 20 20 20  allbranches..   
76f0: 20 23 20 4e 6f 74 65 3a 20 53 65 65 20 74 68 65   # Note: See the
7700: 20 6e 6f 74 65 20 5b 78 5d 2e 0a 0a 09 20 20 20   note [x]....   
7710: 20 23 20 46 72 6f 6d 20 63 76 73 32 73 76 6e 3a   # From cvs2svn:
7720: 20 49 66 20 74 68 69 73 20 69 73 20 74 68 65 20   If this is the 
7730: 6c 61 73 74 20 64 65 66 61 75 6c 74 20 72 65 76  last default rev
7740: 69 73 69 6f 6e 20 6f 6e 20 61 0a 09 20 20 20 20  ision on a..    
7750: 23 20 6e 6f 6e 2d 74 72 75 6e 6b 20 64 65 66 61  # non-trunk defa
7760: 75 6c 74 20 62 72 61 6e 63 68 20 66 6f 6c 6c 6f  ult branch follo
7770: 77 65 64 20 62 79 20 61 20 31 2e 32 20 72 65 76  wed by a 1.2 rev
7780: 69 73 69 6f 6e 2c 0a 09 20 20 20 20 23 20 74 68  ision,..    # th
7790: 65 6e 20 74 68 65 20 31 2e 32 20 72 65 76 69 73  en the 1.2 revis
77a0: 69 6f 6e 20 64 65 70 65 6e 64 73 20 6f 6e 20 74  ion depends on t
77b0: 68 69 73 20 6f 6e 65 2e 20 20 46 49 58 4d 45 3a  his one.  FIXME:
77c0: 20 49 74 20 69 73 0a 09 20 20 20 20 23 20 71 75   It is..    # qu
77d0: 65 73 74 69 6f 6e 61 62 6c 65 20 77 68 65 74 68  estionable wheth
77e0: 65 72 20 74 68 69 73 20 68 61 6e 64 6c 69 6e 67  er this handling
77f0: 20 69 73 20 63 6f 72 72 65 63 74 2c 20 73 69 6e   is correct, sin
7800: 63 65 20 74 68 65 0a 09 20 20 20 20 23 20 6e 6f  ce the..    # no
7810: 6e 2d 74 72 75 6e 6b 20 64 65 66 61 75 6c 74 20  n-trunk default 
7820: 62 72 61 6e 63 68 20 72 65 76 69 73 69 6f 6e 73  branch revisions
7830: 20 61 66 66 65 63 74 20 74 72 75 6e 6b 20 61 6e   affect trunk an
7840: 64 0a 09 20 20 20 20 23 20 73 68 6f 75 6c 64 20  d..    # should 
7850: 74 68 65 72 65 66 6f 72 65 20 6e 6f 74 20 6a 75  therefore not ju
7860: 73 74 20 62 65 20 64 69 73 63 61 72 64 65 64 20  st be discarded 
7870: 65 76 65 6e 20 69 66 0a 09 20 20 20 20 23 20 2d  even if..    # -
7880: 2d 74 72 75 6e 6b 2d 6f 6e 6c 79 2e 0a 0a 09 20  -trunk-only.... 
7890: 20 20 20 69 66 20 7b 5b 24 72 6f 6f 74 20 68 61     if {[$root ha
78a0: 73 64 65 66 61 75 6c 74 62 72 61 6e 63 68 63 68  sdefaultbranchch
78b0: 69 6c 64 5d 7d 20 7b 0a 09 09 73 65 74 20 6e 74  ild]} {...set nt
78c0: 64 62 63 68 69 6c 64 20 5b 24 72 6f 6f 74 20 64  dbchild [$root d
78d0: 65 66 61 75 6c 74 62 72 61 6e 63 68 63 68 69 6c  efaultbranchchil
78e0: 64 5d 0a 09 09 69 6e 74 65 67 72 69 74 79 20 61  d]...integrity a
78f0: 73 73 65 72 74 20 7b 0a 09 09 20 20 20 20 5b 24  ssert {...    [$
7900: 6e 74 64 62 63 68 69 6c 64 20 64 65 66 61 75 6c  ntdbchild defaul
7910: 74 62 72 61 6e 63 68 70 61 72 65 6e 74 5d 20 65  tbranchparent] e
7920: 71 20 24 6e 74 64 62 63 68 69 6c 64 0a 09 09 7d  q $ntdbchild...}
7930: 20 7b 6e 74 64 62 20 2d 20 74 72 75 6e 6b 20 6c   {ntdb - trunk l
7940: 69 6e 6b 61 67 65 20 62 72 6f 6b 65 6e 7d 0a 09  inkage broken}..
7950: 09 24 6e 74 64 62 63 68 69 6c 64 20 63 75 74 64  .$ntdbchild cutd
7960: 65 66 61 75 6c 74 62 72 61 6e 63 68 70 61 72 65  efaultbranchpare
7970: 6e 74 0a 09 09 69 66 20 7b 5b 24 6e 74 64 62 63  nt...if {[$ntdbc
7980: 68 69 6c 64 20 68 61 73 70 61 72 65 6e 74 5d 7d  hild hasparent]}
7990: 20 7b 0a 09 09 20 20 20 20 6c 61 70 70 65 6e 64   {...    lappend
79a0: 20 6d 79 72 6f 6f 74 73 20 5b 24 6e 74 64 62 63   myroots [$ntdbc
79b0: 68 69 6c 64 20 70 61 72 65 6e 74 5d 0a 09 09 7d  hild parent]...}
79c0: 0a 09 20 20 20 20 7d 0a 0a 09 20 20 20 20 73 65  ..    }...    se
79d0: 74 20 72 6f 6f 74 20 5b 24 72 6f 6f 74 20 63 68  t root [$root ch
79e0: 69 6c 64 5d 0a 09 7d 0a 0a 09 72 65 74 75 72 6e  ild]..}...return
79f0: 0a 20 20 20 20 7d 0a 0a 20 20 20 20 6d 65 74 68  .    }..    meth
7a00: 6f 64 20 47 72 61 66 74 4e 54 44 42 32 54 72 75  od GraftNTDB2Tru
7a10: 6e 6b 20 7b 72 6f 6f 74 7d 20 7b 0a 09 23 20 57  nk {root} {..# W
7a20: 65 20 63 61 6e 20 6e 6f 77 20 67 72 61 66 74 20  e can now graft 
7a30: 74 68 65 20 6e 6f 6e 2d 74 72 75 6e 6b 20 64 65  the non-trunk de
7a40: 66 61 75 6c 74 20 62 72 61 6e 63 68 20 72 65 76  fault branch rev
7a50: 69 73 69 6f 6e 73 20 74 6f 0a 09 23 20 74 72 75  isions to..# tru
7a60: 6e 6b 2e 20 54 68 65 79 20 73 68 6f 75 6c 64 20  nk. They should 
7a70: 61 6c 72 65 61 64 79 20 62 65 20 61 6c 6f 6e 65  already be alone
7a80: 20 6f 6e 20 61 20 43 56 53 42 72 61 6e 63 68 2d   on a CVSBranch-
7a90: 6c 65 73 73 0a 09 23 20 62 72 61 6e 63 68 2e 0a  less..# branch..
7aa0: 0a 09 69 6e 74 65 67 72 69 74 79 20 61 73 73 65  ..integrity asse
7ab0: 72 74 20 7b 21 5b 24 72 6f 6f 74 20 68 61 73 70  rt {![$root hasp
7ac0: 61 72 65 6e 74 62 72 61 6e 63 68 5d 7d 20 7b 4e  arentbranch]} {N
7ad0: 54 44 42 20 72 6f 6f 74 20 73 74 69 6c 6c 20 68  TDB root still h
7ae0: 61 73 20 69 74 73 20 62 72 61 6e 63 68 20 73 79  as its branch sy
7af0: 6d 62 6f 6c 7d 0a 09 69 6e 74 65 67 72 69 74 79  mbol}..integrity
7b00: 20 61 73 73 65 72 74 20 7b 21 5b 24 72 6f 6f 74   assert {![$root
7b10: 20 68 61 73 62 72 61 6e 63 68 65 73 5d 7d 20 20   hasbranches]}  
7b20: 20 20 20 7b 4e 54 44 42 20 72 6f 6f 74 20 73 74     {NTDB root st
7b30: 69 6c 6c 20 68 61 73 20 73 70 61 77 6e 65 64 20  ill has spawned 
7b40: 62 72 61 6e 63 68 65 73 7d 0a 0a 09 73 65 74 20  branches}...set 
7b50: 6c 61 73 74 20 24 72 6f 6f 74 0a 09 77 68 69 6c  last $root..whil
7b60: 65 20 7b 5b 24 6c 61 73 74 20 68 61 73 63 68 69  e {[$last haschi
7b70: 6c 64 5d 7d 20 7b 73 65 74 20 6c 61 73 74 20 5b  ld]} {set last [
7b80: 24 6c 61 73 74 20 63 68 69 6c 64 5d 7d 0a 0a 09  $last child]}...
7b90: 69 66 20 7b 5b 24 6c 61 73 74 20 68 61 73 64 65  if {[$last hasde
7ba0: 66 61 75 6c 74 62 72 61 6e 63 68 63 68 69 6c 64  faultbranchchild
7bb0: 5d 7d 20 7b 0a 0a 09 20 20 20 20 73 65 74 20 72  ]} {...    set r
7bc0: 65 76 31 32 20 5b 24 6c 61 73 74 20 64 65 66 61  ev12 [$last defa
7bd0: 75 6c 74 62 72 61 6e 63 68 63 68 69 6c 64 5d 0a  ultbranchchild].
7be0: 09 20 20 20 20 24 72 65 76 31 32 20 63 75 74 64  .    $rev12 cutd
7bf0: 65 66 61 75 6c 74 62 72 61 6e 63 68 70 61 72 65  efaultbranchpare
7c00: 6e 74 0a 09 20 20 20 20 24 6c 61 73 74 20 20 63  nt..    $last  c
7c10: 75 74 64 65 66 61 75 6c 74 62 72 61 6e 63 68 63  utdefaultbranchc
7c20: 68 69 6c 64 0a 0a 09 20 20 20 20 24 72 65 76 31  hild...    $rev1
7c30: 32 20 63 68 61 6e 67 65 70 61 72 65 6e 74 20 24  2 changeparent $
7c40: 6c 61 73 74 0a 09 20 20 20 20 24 6c 61 73 74 20  last..    $last 
7c50: 20 63 68 61 6e 67 65 63 68 69 6c 64 20 24 72 65   changechild $re
7c60: 76 31 32 0a 0a 09 20 20 20 20 6c 64 65 6c 65 74  v12...    ldelet
7c70: 65 20 6d 79 72 6f 6f 74 73 20 24 72 65 76 31 32  e myroots $rev12
7c80: 0a 0a 09 20 20 20 20 23 20 4e 6f 74 65 20 61 6e  ...    # Note an
7c90: 64 20 72 65 6d 65 6d 62 65 72 20 74 68 61 74 20  d remember that 
7ca0: 74 68 65 20 74 79 70 65 20 6f 66 20 72 65 76 31  the type of rev1
7cb0: 32 20 77 61 73 20 61 6c 72 65 61 64 79 0a 09 20  2 was already.. 
7cc0: 20 20 20 23 20 61 64 6a 75 73 74 65 64 20 62 79     # adjusted by
7cd0: 20 41 64 6a 75 73 74 4e 6f 6e 54 72 75 6e 6b 44   AdjustNonTrunkD
7ce0: 65 66 61 75 6c 74 42 72 61 6e 63 68 2c 20 73 6f  efaultBranch, so
7cf0: 20 77 65 20 64 6f 6e 27 74 0a 09 20 20 20 20 23   we don't..    #
7d00: 20 68 61 76 65 20 74 6f 20 63 68 61 6e 67 65 20   have to change 
7d10: 69 74 73 20 74 79 70 65 20 68 65 72 65 2e 0a 09  its type here...
7d20: 7d 0a 0a 09 77 68 69 6c 65 20 7b 24 72 6f 6f 74  }...while {$root
7d30: 20 6e 65 20 22 22 7d 20 7b 0a 09 20 20 20 20 24   ne ""} {..    $
7d40: 72 6f 6f 74 20 73 65 74 6f 6e 64 65 66 61 75 6c  root setondefaul
7d50: 74 62 72 61 6e 63 68 20 30 0a 09 20 20 20 20 24  tbranch 0..    $
7d60: 72 6f 6f 74 20 73 65 74 6c 6f 64 20 24 6d 79 74  root setlod $myt
7d70: 72 75 6e 6b 0a 09 20 20 20 20 66 6f 72 65 61 63  runk..    foreac
7d80: 68 20 74 61 67 20 5b 24 72 6f 6f 74 20 74 61 67  h tag [$root tag
7d90: 73 5d 20 7b 0a 09 09 24 74 61 67 20 73 65 74 6c  s] {...$tag setl
7da0: 6f 64 20 24 6d 79 74 72 75 6e 6b 0a 09 20 20 20  od $mytrunk..   
7db0: 20 7d 0a 09 20 20 20 20 73 65 74 20 72 6f 6f 74   }..    set root
7dc0: 20 5b 24 72 6f 6f 74 20 63 68 69 6c 64 5d 0a 09   [$root child]..
7dd0: 7d 0a 0a 20 20 20 20 20 20 20 20 72 65 74 75 72  }..        retur
7de0: 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 6d 65 74  n.    }..    met
7df0: 68 6f 64 20 41 63 74 69 76 65 20 7b 7d 20 7b 0a  hod Active {} {.
7e00: 09 73 65 74 20 72 65 76 69 73 69 6f 6e 73 20 7b  .set revisions {
7e10: 7d 0a 09 73 65 74 20 73 79 6d 62 6f 6c 73 20 20  }..set symbols  
7e20: 20 7b 7d 0a 0a 09 66 6f 72 65 61 63 68 20 72 6f   {}...foreach ro
7e30: 6f 74 20 5b 24 73 65 6c 66 20 4c 69 6e 65 73 4f  ot [$self LinesO
7e40: 66 44 65 76 65 6c 6f 70 6d 65 6e 74 5d 20 7b 0a  fDevelopment] {.
7e50: 09 20 20 20 20 69 66 20 7b 5b 24 72 6f 6f 74 20  .    if {[$root 
7e60: 68 61 73 70 61 72 65 6e 74 62 72 61 6e 63 68 5d  hasparentbranch]
7e70: 7d 20 7b 20 6c 61 70 70 65 6e 64 20 73 79 6d 62  } { lappend symb
7e80: 6f 6c 73 20 5b 24 72 6f 6f 74 20 70 61 72 65 6e  ols [$root paren
7e90: 74 62 72 61 6e 63 68 5d 20 7d 0a 09 20 20 20 20  tbranch] }..    
7ea0: 77 68 69 6c 65 20 7b 24 72 6f 6f 74 20 6e 65 20  while {$root ne 
7eb0: 22 22 7d 20 7b 0a 09 09 6c 61 70 70 65 6e 64 20  ""} {...lappend 
7ec0: 72 65 76 69 73 69 6f 6e 73 20 24 72 6f 6f 74 0a  revisions $root.
7ed0: 09 09 66 6f 72 65 61 63 68 20 74 61 67 20 20 20  ..foreach tag   
7ee0: 20 5b 24 72 6f 6f 74 20 74 61 67 73 5d 20 20 20   [$root tags]   
7ef0: 20 20 7b 20 6c 61 70 70 65 6e 64 20 73 79 6d 62    { lappend symb
7f00: 6f 6c 73 20 24 74 61 67 20 20 20 20 7d 0a 09 09  ols $tag    }...
7f10: 66 6f 72 65 61 63 68 20 62 72 61 6e 63 68 20 5b  foreach branch [
7f20: 24 72 6f 6f 74 20 62 72 61 6e 63 68 65 73 5d 20  $root branches] 
7f30: 7b 20 6c 61 70 70 65 6e 64 20 73 79 6d 62 6f 6c  { lappend symbol
7f40: 73 20 24 62 72 61 6e 63 68 20 7d 0a 09 09 73 65  s $branch }...se
7f50: 74 20 6c 6f 64 20 5b 24 72 6f 6f 74 20 6c 6f 64  t lod [$root lod
7f60: 5d 0a 09 09 69 66 20 7b 21 5b 24 6c 6f 64 20 69  ]...if {![$lod i
7f70: 73 74 72 75 6e 6b 5d 7d 20 7b 20 6c 61 70 70 65  strunk]} { lappe
7f80: 6e 64 20 73 79 6d 62 6f 6c 73 20 24 6c 6f 64 20  nd symbols $lod 
7f90: 7d 0a 09 09 73 65 74 20 72 6f 6f 74 20 5b 24 72  }...set root [$r
7fa0: 6f 6f 74 20 63 68 69 6c 64 5d 0a 09 20 20 20 20  oot child]..    
7fb0: 7d 0a 09 7d 0a 0a 09 72 65 74 75 72 6e 20 5b 6c  }..}...return [l
7fc0: 69 73 74 20 5b 6c 73 6f 72 74 20 2d 75 6e 69 71  ist [lsort -uniq
7fd0: 75 65 20 2d 64 69 63 74 20 24 72 65 76 69 73 69  ue -dict $revisi
7fe0: 6f 6e 73 5d 20 5b 6c 73 6f 72 74 20 2d 75 6e 69  ons] [lsort -uni
7ff0: 71 75 65 20 2d 64 69 63 74 20 24 73 79 6d 62 6f  que -dict $symbo
8000: 6c 73 5d 5d 0a 20 20 20 20 7d 0a 0a 0a 20 20 20  ls]].    }...   
8010: 20 6d 65 74 68 6f 64 20 41 67 67 72 65 67 61 74   method Aggregat
8020: 65 53 79 6d 62 6f 6c 44 61 74 61 20 7b 7d 20 7b  eSymbolData {} {
8030: 0a 09 23 20 4e 6f 77 20 74 68 61 74 20 74 68 65  ..# Now that the
8040: 20 65 78 61 63 74 20 73 65 74 20 6f 66 20 72 65   exact set of re
8050: 76 69 73 69 6f 6e 73 20 28 61 6e 64 20 74 68 72  visions (and thr
8060: 6f 75 67 68 20 74 68 61 74 0a 09 23 20 62 72 61  ough that..# bra
8070: 6e 63 68 65 73 20 61 6e 64 20 74 61 67 73 29 20  nches and tags) 
8080: 69 73 20 6b 6e 6f 77 6e 20 77 65 20 63 61 6e 20  is known we can 
8090: 75 70 64 61 74 65 20 74 68 65 20 61 67 67 72 65  update the aggre
80a0: 67 61 74 65 0a 09 23 20 73 79 6d 62 6f 6c 20 73  gate..# symbol s
80b0: 74 61 74 69 73 74 69 63 73 2e 0a 0a 09 66 6f 72  tatistics....for
80c0: 65 61 63 68 20 72 6f 6f 74 20 5b 24 73 65 6c 66  each root [$self
80d0: 20 4c 69 6e 65 73 4f 66 44 65 76 65 6c 6f 70 6d   LinesOfDevelopm
80e0: 65 6e 74 5d 20 7b 0a 09 20 20 20 20 73 65 74 20  ent] {..    set 
80f0: 6c 6f 64 20 5b 24 72 6f 6f 74 20 6c 6f 64 5d 0a  lod [$root lod].
8100: 0a 09 20 20 20 20 23 20 4e 6f 74 65 3a 20 49 66  ..    # Note: If
8110: 20 74 68 65 20 4c 4f 44 20 69 73 20 74 68 65 20   the LOD is the 
8120: 74 72 75 6e 6b 20 74 68 65 20 63 6f 75 6e 74 2a  trunk the count*
8130: 2c 20 65 74 63 2e 20 6d 65 74 68 6f 64 73 0a 09  , etc. methods..
8140: 20 20 20 20 23 20 77 69 6c 6c 20 64 6f 20 6e 6f      # will do no
8150: 74 68 69 6e 67 2c 20 61 73 20 69 74 20 69 73 20  thing, as it is 
8160: 61 6c 77 61 79 73 20 70 72 65 73 65 6e 74 20 28  always present (
8170: 63 61 6e 6e 6f 74 20 62 65 0a 09 20 20 20 20 23  cannot be..    #
8180: 20 65 78 63 6c 75 64 65 64 29 2c 20 61 6e 64 20   excluded), and 
8190: 69 73 20 61 6c 77 61 79 73 20 61 20 62 72 61 6e  is always a bran
81a0: 63 68 20 74 6f 6f 2e 0a 0a 09 20 20 20 20 23 20  ch too....    # 
81b0: 4c 69 6e 65 73 20 6f 66 20 64 65 76 65 6c 6f 70  Lines of develop
81c0: 6d 65 6e 74 20 63 6f 75 6e 74 20 61 73 20 62 72  ment count as br
81d0: 61 6e 63 68 65 73 20 61 6e 64 20 68 61 76 65 20  anches and have 
81e0: 61 20 63 6f 6d 6d 69 74 0a 09 20 20 20 20 23 20  a commit..    # 
81f0: 6f 6e 20 74 68 65 6d 20 28 72 6f 6f 74 29 2e 20  on them (root). 
8200: 49 66 20 74 68 65 79 20 61 72 65 20 73 74 69 6c  If they are stil
8210: 6c 20 61 74 74 61 63 68 65 64 20 74 6f 20 61 20  l attached to a 
8220: 74 72 65 65 20 77 65 0a 09 20 20 20 20 23 20 68  tree we..    # h
8230: 61 76 65 20 74 6f 20 63 6f 6d 70 75 74 65 20 61  ave to compute a
8240: 6e 64 20 72 65 67 69 73 74 65 72 20 70 6f 73 73  nd register poss
8250: 69 62 6c 65 20 70 61 72 65 6e 74 73 2e 0a 0a 09  ible parents....
8260: 20 20 20 20 24 6c 6f 64 20 63 6f 75 6e 74 61 73      $lod countas
8270: 62 72 61 6e 63 68 0a 09 20 20 20 20 24 6c 6f 64  branch..    $lod
8280: 20 63 6f 75 6e 74 61 63 6f 6d 6d 69 74 0a 0a 09   countacommit...
8290: 20 20 20 20 69 66 20 7b 5b 24 72 6f 6f 74 20 68      if {[$root h
82a0: 61 73 70 61 72 65 6e 74 62 72 61 6e 63 68 5d 7d  asparentbranch]}
82b0: 20 7b 0a 09 09 23 20 4e 6f 74 65 20 6c 6f 64 20   {...# Note lod 
82c0: 3d 3d 20 5b 24 72 6f 6f 74 20 70 61 72 65 6e 74  == [$root parent
82d0: 62 72 61 6e 63 68 5d 0a 09 09 24 6c 6f 64 20 70  branch]...$lod p
82e0: 6f 73 73 69 62 6c 65 70 61 72 65 6e 74 73 0a 09  ossibleparents..
82f0: 20 20 20 20 7d 20 65 6c 73 65 69 66 20 7b 21 5b      } elseif {![
8300: 24 6c 6f 64 20 69 73 74 72 75 6e 6b 5d 20 26 26  $lod istrunk] &&
8310: 20 5b 24 72 6f 6f 74 20 69 73 6f 6e 64 65 66 61   [$root isondefa
8320: 75 6c 74 62 72 61 6e 63 68 5d 7d 20 7b 0a 09 09  ultbranch]} {...
8330: 23 20 54 68 69 73 20 69 73 20 74 68 65 20 72 6f  # This is the ro
8340: 6f 74 20 72 65 76 69 73 69 6f 6e 20 6f 66 20 61  ot revision of a
8350: 20 64 65 74 61 63 68 65 64 20 4e 54 44 42 2e 20   detached NTDB. 
8360: 57 65 0a 09 09 23 20 68 61 76 65 20 74 6f 20 6d  We...# have to m
8370: 61 6e 75 61 6c 6c 79 20 73 65 74 20 74 68 65 20  anually set the 
8380: 6f 6e 6c 79 20 70 6f 73 73 69 62 6c 65 20 70 61  only possible pa
8390: 72 65 6e 74 20 66 6f 72 0a 09 09 23 20 74 68 69  rent for...# thi
83a0: 73 20 4c 4f 44 2c 20 74 68 65 20 74 72 75 6e 6b  s LOD, the trunk
83b0: 20 69 74 73 65 6c 66 2e 0a 0a 09 09 5b 24 6c 6f   itself.....[$lo
83c0: 64 20 73 79 6d 62 6f 6c 5d 20 70 6f 73 73 69 62  d symbol] possib
83d0: 6c 65 70 61 72 65 6e 74 20 24 6d 79 74 72 75 6e  leparent $mytrun
83e0: 6b 0a 09 20 20 20 20 7d 0a 0a 09 20 20 20 20 23  k..    }...    #
83f0: 20 46 6f 72 20 74 68 65 20 72 65 76 69 73 69 6f   For the revisio
8400: 6e 73 20 69 6e 20 74 68 65 20 6c 69 6e 65 20 77  ns in the line w
8410: 65 20 72 65 67 69 73 74 65 72 20 74 68 65 69 72  e register their
8420: 20 62 72 61 6e 63 68 65 73 0a 09 20 20 20 20 23   branches..    #
8430: 20 61 6e 64 20 74 61 67 73 20 61 73 20 62 6c 6f   and tags as blo
8440: 63 6b 65 72 73 20 66 6f 72 20 74 68 65 20 6c 6f  ckers for the lo
8450: 64 2c 20 61 6e 64 20 75 70 64 61 74 65 20 74 68  d, and update th
8460: 65 20 74 79 70 65 0a 09 20 20 20 20 23 20 63 6f  e type..    # co
8470: 75 6e 74 65 72 73 20 61 73 20 77 65 6c 6c 2e 20  unters as well. 
8480: 41 73 20 62 72 61 6e 63 68 20 73 79 6d 62 6f 6c  As branch symbol
8490: 73 20 77 69 74 68 6f 75 74 20 63 6f 6d 6d 69 74  s without commit
84a0: 73 20 6f 6e 0a 09 20 20 20 20 23 20 74 68 65 6d  s on..    # them
84b0: 20 61 72 65 20 6e 6f 74 20 6c 69 73 74 65 64 20   are not listed 
84c0: 61 73 20 6c 69 6e 65 73 20 6f 66 20 64 65 76 65  as lines of deve
84d0: 6c 6f 70 6d 65 6e 74 2c 20 77 65 20 68 61 76 65  lopment, we have
84e0: 20 74 6f 0a 09 20 20 20 20 23 20 63 6f 75 6e 74   to..    # count
84f0: 20 74 68 65 6d 20 68 65 72 65 20 61 73 20 77 65   them here as we
8500: 6c 6c 2c 20 61 73 20 70 6c 61 69 6e 20 62 72 61  ll, as plain bra
8510: 6e 63 68 65 73 2e 20 41 74 20 6c 61 73 74 20 77  nches. At last w
8520: 65 0a 09 20 20 20 20 23 20 68 61 76 65 20 74 6f  e..    # have to
8530: 20 63 6f 6d 70 75 74 65 20 61 6e 64 20 72 65 67   compute and reg
8540: 69 73 74 65 72 20 74 68 65 20 70 6f 73 73 69 62  ister the possib
8550: 6c 65 20 70 61 72 65 6e 74 73 20 6f 66 20 74 68  le parents of th
8560: 65 0a 09 20 20 20 20 23 20 74 61 67 73 2c 20 69  e..    # tags, i
8570: 6e 20 63 61 73 65 20 74 68 65 79 20 61 72 65 20  n case they are 
8580: 6c 61 74 65 72 20 63 6f 6e 76 65 72 74 65 64 20  later converted 
8590: 61 73 20 62 72 61 6e 63 68 65 73 2e 0a 0a 09 20  as branches.... 
85a0: 20 20 20 77 68 69 6c 65 20 7b 24 72 6f 6f 74 20     while {$root 
85b0: 6e 65 20 22 22 7d 20 7b 0a 09 09 66 6f 72 65 61  ne ""} {...forea
85c0: 63 68 20 62 72 61 6e 63 68 20 5b 24 72 6f 6f 74  ch branch [$root
85d0: 20 62 72 61 6e 63 68 65 73 5d 20 7b 0a 09 09 20   branches] {... 
85e0: 20 20 20 24 6c 6f 64 20 62 6c 6f 63 6b 65 64 62     $lod blockedb
85f0: 79 20 24 62 72 61 6e 63 68 0a 09 09 20 20 20 20  y $branch...    
8600: 24 62 72 61 6e 63 68 20 70 6f 73 73 69 62 6c 65  $branch possible
8610: 70 61 72 65 6e 74 73 0a 09 09 20 20 20 20 69 66  parents...    if
8620: 20 7b 5b 24 62 72 61 6e 63 68 20 68 61 73 63 68   {[$branch hasch
8630: 69 6c 64 5d 7d 20 63 6f 6e 74 69 6e 75 65 0a 09  ild]} continue..
8640: 09 20 20 20 20 24 62 72 61 6e 63 68 20 63 6f 75  .    $branch cou
8650: 6e 74 61 73 62 72 61 6e 63 68 0a 09 09 7d 0a 0a  ntasbranch...}..
8660: 09 09 66 6f 72 65 61 63 68 20 74 61 67 20 5b 24  ..foreach tag [$
8670: 72 6f 6f 74 20 74 61 67 73 5d 20 7b 0a 09 09 20  root tags] {... 
8680: 20 20 20 24 6c 6f 64 20 62 6c 6f 63 6b 65 64 62     $lod blockedb
8690: 79 20 24 74 61 67 0a 09 09 20 20 20 20 24 74 61  y $tag...    $ta
86a0: 67 20 70 6f 73 73 69 62 6c 65 70 61 72 65 6e 74  g possibleparent
86b0: 73 0a 09 09 20 20 20 20 24 74 61 67 20 63 6f 75  s...    $tag cou
86c0: 6e 74 61 73 74 61 67 0a 09 09 7d 0a 0a 09 09 73  ntastag...}....s
86d0: 65 74 20 72 6f 6f 74 20 5b 24 72 6f 6f 74 20 63  et root [$root c
86e0: 68 69 6c 64 5d 0a 09 20 20 20 20 7d 0a 09 7d 0a  hild]..    }..}.
86f0: 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a  ..return.    }..
8700: 20 20 20 20 23 20 23 20 23 23 20 23 23 23 20 23      # # ## ### #
8710: 23 23 23 23 20 23 23 23 23 23 23 23 23 20 23 23  #### ######## ##
8720: 23 23 23 23 23 23 23 23 23 23 23 0a 20 20 20 20  ###########.    
8730: 23 23 20 43 6f 6e 66 69 67 75 72 61 74 69 6f 6e  ## Configuration
8740: 0a 0a 20 20 20 20 70 72 61 67 6d 61 20 2d 68 61  ..    pragma -ha
8750: 73 74 79 70 65 69 6e 66 6f 20 20 20 20 6e 6f 20  stypeinfo    no 
8760: 20 3b 20 23 20 6e 6f 20 74 79 70 65 20 69 6e 74   ; # no type int
8770: 72 6f 73 70 65 63 74 69 6f 6e 0a 20 20 20 20 70  rospection.    p
8780: 72 61 67 6d 61 20 2d 68 61 73 69 6e 66 6f 20 20  ragma -hasinfo  
8790: 20 20 20 20 20 20 6e 6f 20 20 3b 20 23 20 6e 6f        no  ; # no
87a0: 20 6f 62 6a 65 63 74 20 69 6e 74 72 6f 73 70 65   object introspe
87b0: 63 74 69 6f 6e 0a 20 20 20 20 70 72 61 67 6d 61  ction.    pragma
87c0: 20 2d 68 61 73 74 79 70 65 6d 65 74 68 6f 64 73   -hastypemethods
87d0: 20 6e 6f 20 20 3b 20 23 20 74 79 70 65 20 69 73   no  ; # type is
87e0: 20 6e 6f 74 20 72 65 6c 65 76 61 6e 74 2e 0a 0a   not relevant...
87f0: 20 20 20 20 23 20 23 20 23 23 20 23 23 23 20 23      # # ## ### #
8800: 23 23 23 23 20 23 23 23 23 23 23 23 23 20 23 23  #### ######## ##
8810: 23 23 23 23 23 23 23 23 23 23 23 0a 7d 0a 0a 6e  ###########.}..n
8820: 61 6d 65 73 70 61 63 65 20 65 76 61 6c 20 3a 3a  amespace eval ::
8830: 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f  vc::fossil::impo
8840: 72 74 3a 3a 63 76 73 20 7b 0a 20 20 20 20 6e 61  rt::cvs {.    na
8850: 6d 65 73 70 61 63 65 20 65 78 70 6f 72 74 20 66  mespace export f
8860: 69 6c 65 0a 20 20 20 20 6e 61 6d 65 73 70 61 63  ile.    namespac
8870: 65 20 65 76 61 6c 20 66 69 6c 65 20 7b 0a 09 23  e eval file {..#
8880: 20 49 6d 70 6f 72 74 20 6e 6f 74 20 72 65 71 75   Import not requ
8890: 69 72 65 64 2c 20 61 6c 72 65 61 64 79 20 61 20  ired, already a 
88a0: 63 68 69 6c 64 20 6e 61 6d 65 73 70 61 63 65 2e  child namespace.
88b0: 0a 09 23 20 6e 61 6d 65 73 70 61 63 65 20 69 6d  ..# namespace im
88c0: 70 6f 72 74 20 3a 3a 76 63 3a 3a 66 6f 73 73 69  port ::vc::fossi
88d0: 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a 3a  l::import::cvs::
88e0: 66 69 6c 65 3a 3a 72 65 76 0a 09 23 20 6e 61 6d  file::rev..# nam
88f0: 65 73 70 61 63 65 20 69 6d 70 6f 72 74 20 3a 3a  espace import ::
8900: 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f  vc::fossil::impo
8910: 72 74 3a 3a 63 76 73 3a 3a 66 69 6c 65 3a 3a 73  rt::cvs::file::s
8920: 79 6d 0a 09 6e 61 6d 65 73 70 61 63 65 20 69 6d  ym..namespace im
8930: 70 6f 72 74 20 3a 3a 76 63 3a 3a 74 6f 6f 6c 73  port ::vc::tools
8940: 3a 3a 6d 69 73 63 3a 3a 2a 0a 09 6e 61 6d 65 73  ::misc::*..names
8950: 70 61 63 65 20 69 6d 70 6f 72 74 20 3a 3a 76 63  pace import ::vc
8960: 3a 3a 74 6f 6f 6c 73 3a 3a 74 72 6f 75 62 6c 65  ::tools::trouble
8970: 0a 09 6e 61 6d 65 73 70 61 63 65 20 69 6d 70 6f  ..namespace impo
8980: 72 74 20 3a 3a 76 63 3a 3a 74 6f 6f 6c 73 3a 3a  rt ::vc::tools::
8990: 6c 6f 67 0a 09 6e 61 6d 65 73 70 61 63 65 20 69  log..namespace i
89a0: 6d 70 6f 72 74 20 3a 3a 76 63 3a 3a 66 6f 73 73  mport ::vc::foss
89b0: 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 3a  il::import::cvs:
89c0: 3a 73 74 61 74 65 0a 09 6e 61 6d 65 73 70 61 63  :state..namespac
89d0: 65 20 69 6d 70 6f 72 74 20 3a 3a 76 63 3a 3a 66  e import ::vc::f
89e0: 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63  ossil::import::c
89f0: 76 73 3a 3a 69 6e 74 65 67 72 69 74 79 0a 20 20  vs::integrity.  
8a00: 20 20 7d 0a 7d 0a 0a 23 20 23 20 23 23 20 23 23    }.}..# # ## ##
8a10: 23 20 23 23 23 23 23 20 23 23 23 23 23 23 23 23  # ##### ########
8a20: 20 23 23 23 23 23 23 23 23 23 23 23 23 23 20 23   ############# #
8a30: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23  ################
8a40: 23 23 23 23 0a 23 23 20 52 65 61 64 79 0a 0a 70  ####.## Ready..p
8a50: 61 63 6b 61 67 65 20 70 72 6f 76 69 64 65 20 76  ackage provide v
8a60: 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72  c::fossil::impor
8a70: 74 3a 3a 63 76 73 3a 3a 66 69 6c 65 20 31 2e 30  t::cvs::file 1.0
8a80: 0a 72 65 74 75 72 6e 0a                          .return.