Artifact 9cab4d3dc8a948ffadc9435677a6ddaaea61debd:
File
tools/cvs2fossil/lib/c2f_ristate.tcl
part of check-in
[c9270189c2]
- Added tracking of file removal in changesets.
by
aku on
2008-02-05 15:52:35.
Also file
tools/cvs2fossil/lib/c2f_ristate.tcl
part of check-in
[6b78df3861]
- Merge in changes from Andreas's branch.
by
drh on
2008-02-08 21:52:21.
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 38 20 41 6e 64 72 65 61 73 20 4b 75 70 72 69 08 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 54 72 61 ########..## Tra
0200: 63 6b 20 74 68 65 20 73 74 61 74 65 20 6f 66 20 ck the state of
0210: 72 65 76 69 73 69 6f 6e 20 69 6d 70 6f 72 74 2e revision import.
0220: 20 45 73 73 65 6e 74 69 61 6c 6c 79 20 6d 61 70 Essentially map
0230: 73 20 6c 69 6e 65 73 20 6f 66 0a 23 23 20 64 65 s lines of.## de
0240: 76 65 6c 6f 70 6d 65 6e 74 73 20 74 6f 20 74 68 velopments to th
0250: 65 69 72 20 77 6f 72 6b 73 70 61 63 65 20 73 74 eir workspace st
0260: 61 74 65 2e 0a 0a 23 20 23 20 23 23 20 23 23 23 ate...# # ## ###
0270: 20 23 23 23 23 23 20 23 23 23 23 23 23 23 23 20 ##### ########
0280: 23 23 23 23 23 23 23 23 23 23 23 23 23 20 23 23 ############# ##
0290: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
02a0: 23 23 23 0a 23 23 20 52 65 71 75 69 72 65 6d 65 ###.## Requireme
02b0: 6e 74 73 0a 0a 70 61 63 6b 61 67 65 20 72 65 71 nts..package req
02c0: 75 69 72 65 20 54 63 6c 20 38 2e 34 20 20 20 20 uire Tcl 8.4
02d0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
02e0: 20 20 20 20 20 20 20 20 20 20 20 3b 20 23 20 52 ; # R
02f0: 65 71 75 69 72 65 64 20 72 75 6e 74 69 6d 65 2e equired runtime.
0300: 0a 70 61 63 6b 61 67 65 20 72 65 71 75 69 72 65 .package require
0310: 20 73 6e 69 74 20 20 20 20 20 20 20 20 20 20 20 snit
0320: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0330: 20 20 20 20 20 20 20 3b 20 23 20 4f 4f 20 73 79 ; # OO sy
0340: 73 74 65 6d 2e 0a 70 61 63 6b 61 67 65 20 72 65 stem..package re
0350: 71 75 69 72 65 20 73 74 72 75 63 74 3a 3a 6c 69 quire struct::li
0360: 73 74 20 20 20 20 20 20 20 20 20 20 20 20 20 20 st
0370: 20 20 20 20 20 20 20 20 20 20 20 20 3b 20 23 20 ; #
0380: 4c 69 73 74 20 61 73 73 69 67 6e 6d 65 6e 74 0a List assignment.
0390: 70 61 63 6b 61 67 65 20 72 65 71 75 69 72 65 20 package require
03a0: 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f vc::fossil::impo
03b0: 72 74 3a 3a 63 76 73 3a 3a 77 73 73 74 61 74 65 rt::cvs::wsstate
03c0: 20 20 20 20 20 20 3b 20 23 20 57 6f 72 6b 73 70 ; # Worksp
03d0: 61 63 65 20 73 74 61 74 65 0a 70 61 63 6b 61 67 ace state.packag
03e0: 65 20 72 65 71 75 69 72 65 20 76 63 3a 3a 66 6f e require vc::fo
03f0: 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 ssil::import::cv
0400: 73 3a 3a 69 6e 74 65 67 72 69 74 79 20 20 20 20 s::integrity
0410: 3b 20 23 20 53 74 61 74 65 20 69 6e 74 65 67 72 ; # State integr
0420: 69 74 79 20 63 68 65 63 6b 73 2e 0a 70 61 63 6b ity checks..pack
0430: 61 67 65 20 72 65 71 75 69 72 65 20 76 63 3a 3a age require vc::
0440: 74 6f 6f 6c 73 3a 3a 6c 6f 67 20 20 20 20 20 20 tools::log
0450: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0460: 20 20 3b 20 23 20 55 73 65 72 20 66 65 65 64 62 ; # User feedb
0470: 61 63 6b 2e 0a 70 61 63 6b 61 67 65 20 72 65 71 ack..package req
0480: 75 69 72 65 20 76 63 3a 3a 74 6f 6f 6c 73 3a 3a uire vc::tools::
0490: 74 72 6f 75 62 6c 65 20 20 20 20 20 20 20 20 20 trouble
04a0: 20 20 20 20 20 20 20 20 20 20 20 3b 20 23 20 45 ; # E
04b0: 72 72 6f 72 20 72 65 70 6f 72 74 69 6e 67 2e 0a rror reporting..
04c0: 0a 23 20 23 20 23 23 20 23 23 23 20 23 23 23 23 .# # ## ### ####
04d0: 23 20 23 23 23 23 23 23 23 23 20 23 23 23 23 23 # ######## #####
04e0: 23 23 23 23 23 23 23 23 20 23 23 23 23 23 23 23 ######## #######
04f0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 0a 23 ##############.#
0500: 23 0a 0a 73 6e 69 74 3a 3a 74 79 70 65 20 3a 3a #..snit::type ::
0510: 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f vc::fossil::impo
0520: 72 74 3a 3a 63 76 73 3a 3a 72 69 73 74 61 74 65 rt::cvs::ristate
0530: 20 7b 0a 20 20 20 20 23 20 23 20 23 23 20 23 23 {. # # ## ##
0540: 23 20 23 23 23 23 23 20 23 23 23 23 23 23 23 23 # ##### ########
0550: 20 23 23 23 23 23 23 23 23 23 23 23 23 23 0a 20 #############.
0560: 20 20 20 23 23 20 50 75 62 6c 69 63 20 41 50 49 ## Public API
0570: 0a 0a 20 20 20 20 63 6f 6e 73 74 72 75 63 74 6f .. constructo
0580: 72 20 7b 7d 20 7b 0a 09 23 20 53 74 61 72 74 20 r {} {..# Start
0590: 77 69 74 68 20 61 6e 20 65 6d 70 74 79 20 73 74 with an empty st
05a0: 61 74 65 0a 09 72 65 74 75 72 6e 0a 20 20 20 20 ate..return.
05b0: 7d 0a 0a 20 20 20 20 6d 65 74 68 6f 64 20 6e 65 }.. method ne
05c0: 77 20 7b 6c 6f 64 20 7b 70 61 72 65 6e 74 6c 6f w {lod {parentlo
05d0: 64 20 7b 7d 7d 7d 20 7b 0a 09 23 20 43 72 65 61 d {}}} {..# Crea
05e0: 74 65 20 74 68 65 20 77 6f 72 6b 73 70 61 63 65 te the workspace
05f0: 20 73 74 61 74 65 20 66 6f 72 20 61 20 6c 69 6e state for a lin
0600: 65 20 6f 66 20 64 65 76 65 6c 6f 70 6d 65 6e 74 e of development
0610: 0a 09 23 20 28 4c 4f 44 29 2e 20 49 66 20 61 20 ..# (LOD). If a
0620: 70 61 72 65 6e 74 20 4c 4f 44 20 69 73 20 73 70 parent LOD is sp
0630: 65 63 69 66 69 65 64 20 6c 65 74 20 74 68 65 20 ecified let the
0640: 6e 65 77 20 73 74 61 74 65 0a 09 23 20 69 6e 68 new state..# inh
0650: 65 72 69 74 20 74 68 65 20 63 75 72 72 65 6e 74 erit the current
0660: 20 73 74 61 74 65 20 6f 66 20 74 68 65 20 70 61 state of the pa
0670: 72 65 6e 74 2e 0a 0a 09 6c 6f 67 20 77 72 69 74 rent....log writ
0680: 65 20 38 20 72 69 73 74 61 74 65 20 7b 4f 70 65 e 8 ristate {Ope
0690: 6e 20 77 6f 72 6b 73 70 61 63 65 20 73 74 61 74 n workspace stat
06a0: 65 20 66 6f 72 20 4c 4f 44 20 22 24 6c 6f 64 22 e for LOD "$lod"
06b0: 7d 0a 0a 09 69 6e 74 65 67 72 69 74 79 20 61 73 }...integrity as
06c0: 73 65 72 74 20 7b 0a 09 20 20 20 20 21 5b 69 6e sert {.. ![in
06d0: 66 6f 20 65 78 69 73 74 73 20 6d 79 73 74 61 74 fo exists mystat
06e0: 65 28 24 6c 6f 64 29 5d 0a 09 7d 20 7b 54 72 79 e($lod)]..} {Try
06f0: 69 6e 67 20 74 6f 20 6f 76 65 72 72 69 64 65 20 ing to override
0700: 65 78 69 73 74 69 6e 67 20 73 74 61 74 65 20 66 existing state f
0710: 6f 72 20 6c 6f 64 20 22 24 6c 6f 64 22 7d 0a 0a or lod "$lod"}..
0720: 09 73 65 74 20 77 73 73 20 5b 77 73 73 74 61 74 .set wss [wsstat
0730: 65 20 24 7b 73 65 6c 66 6e 73 7d 3a 3a 25 41 55 e ${selfns}::%AU
0740: 54 4f 25 20 24 6c 6f 64 5d 0a 09 73 65 74 20 6d TO% $lod]..set m
0750: 79 73 74 61 74 65 28 24 6c 6f 64 29 20 24 77 73 ystate($lod) $ws
0760: 73 0a 0a 09 69 66 20 7b 24 70 61 72 65 6e 74 6c s...if {$parentl
0770: 6f 64 20 6e 65 20 22 22 7d 20 7b 0a 09 20 20 20 od ne ""} {..
0780: 20 6c 6f 67 20 77 72 69 74 65 20 38 20 72 69 73 log write 8 ris
0790: 74 61 74 65 20 7b 49 6e 68 65 72 69 74 69 6e 67 tate {Inheriting
07a0: 20 66 72 6f 6d 20 77 6f 72 6b 73 70 61 63 65 20 from workspace
07b0: 73 74 61 74 65 20 66 6f 72 20 4c 4f 44 20 22 24 state for LOD "$
07c0: 70 61 72 65 6e 74 6c 6f 64 22 7d 0a 0a 09 20 20 parentlod"}...
07d0: 20 20 69 6e 74 65 67 72 69 74 79 20 61 73 73 65 integrity asse
07e0: 72 74 20 7b 0a 09 09 5b 69 6e 66 6f 20 65 78 69 rt {...[info exi
07f0: 73 74 73 20 6d 79 73 74 61 74 65 28 24 70 61 72 sts mystate($par
0800: 65 6e 74 6c 6f 64 29 5d 0a 09 20 20 20 20 7d 20 entlod)].. }
0810: 7b 54 72 79 69 6e 67 20 74 6f 20 69 6e 68 65 72 {Trying to inher
0820: 69 74 20 66 72 6f 6d 20 75 6e 64 65 66 69 6e 65 it from undefine
0830: 64 20 6c 6f 64 20 22 24 70 61 72 65 6e 74 6c 6f d lod "$parentlo
0840: 64 22 7d 0a 0a 09 20 20 20 20 73 65 74 20 70 77 d"}... set pw
0850: 73 73 20 24 6d 79 73 74 61 74 65 28 24 70 61 72 ss $mystate($par
0860: 65 6e 74 6c 6f 64 29 0a 0a 09 20 20 20 20 24 77 entlod)... $w
0870: 73 73 20 64 65 66 73 74 61 74 65 20 5b 24 70 77 ss defstate [$pw
0880: 73 73 20 67 65 74 73 74 61 74 65 5d 0a 09 20 20 ss getstate]..
0890: 20 20 24 77 73 73 20 64 65 66 69 64 20 20 20 20 $wss defid
08a0: 5b 24 70 77 73 73 20 67 65 74 69 64 5d 0a 09 7d [$pwss getid]..}
08b0: 0a 0a 09 72 65 74 75 72 6e 20 24 77 73 73 0a 20 ...return $wss.
08c0: 20 20 20 7d 0a 0a 20 20 20 20 6d 65 74 68 6f 64 }.. method
08d0: 20 67 65 74 20 7b 6c 6f 64 7d 20 7b 20 72 65 74 get {lod} { ret
08e0: 75 72 6e 20 24 6d 79 73 74 61 74 65 28 24 6c 6f urn $mystate($lo
08f0: 64 29 20 7d 0a 20 20 20 20 6d 65 74 68 6f 64 20 d) }. method
0900: 68 61 73 20 7b 6c 6f 64 7d 20 7b 20 72 65 74 75 has {lod} { retu
0910: 72 6e 20 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 rn [info exists
0920: 6d 79 73 74 61 74 65 28 24 6c 6f 64 29 5d 20 7d mystate($lod)] }
0930: 0a 0a 20 20 20 20 6d 65 74 68 6f 64 20 6e 61 6d .. method nam
0940: 65 73 20 7b 7d 20 7b 20 72 65 74 75 72 6e 20 5b es {} { return [
0950: 61 72 72 61 79 20 6e 61 6d 65 73 20 6d 79 73 74 array names myst
0960: 61 74 65 5d 20 7d 0a 0a 20 20 20 20 23 20 23 20 ate] }.. # #
0970: 23 23 20 23 23 23 20 23 23 23 23 23 20 23 23 23 ## ### ##### ###
0980: 23 23 23 23 23 20 23 23 23 23 23 23 23 23 23 23 ##### ##########
0990: 23 23 23 0a 20 20 20 20 23 23 20 53 74 61 74 65 ###. ## State
09a0: 0a 0a 20 20 20 20 76 61 72 69 61 62 6c 65 20 6d .. variable m
09b0: 79 73 74 61 74 65 20 2d 61 72 72 61 79 20 7b 7d ystate -array {}
09c0: 20 3b 20 23 20 4d 61 70 20 66 72 6f 6d 20 6c 69 ; # Map from li
09d0: 6e 65 73 20 6f 66 20 64 65 76 65 6c 6f 70 6d 65 nes of developme
09e0: 6e 74 0a 09 09 09 09 20 23 20 28 69 64 65 6e 74 nt..... # (ident
09f0: 69 66 69 65 64 20 62 79 20 6e 61 6d 65 29 20 74 ified by name) t
0a00: 6f 20 74 68 65 69 72 0a 09 09 09 09 20 23 20 77 o their..... # w
0a10: 6f 72 6b 73 70 61 63 65 20 73 74 61 74 65 2e 0a orkspace state..
0a20: 0a 20 20 20 20 23 20 23 20 23 23 20 23 23 23 20 . # # ## ###
0a30: 23 23 23 23 23 20 23 23 23 23 23 23 23 23 20 23 ##### ######## #
0a40: 23 23 23 23 23 23 23 23 23 23 23 23 0a 20 20 20 ############.
0a50: 20 23 23 20 43 6f 6e 66 69 67 75 72 61 74 69 6f ## Configuratio
0a60: 6e 0a 0a 20 20 20 20 70 72 61 67 6d 61 20 2d 68 n.. pragma -h
0a70: 61 73 74 79 70 65 69 6e 66 6f 20 20 20 20 6e 6f astypeinfo no
0a80: 20 20 3b 20 23 20 6e 6f 20 74 79 70 65 20 69 6e ; # no type in
0a90: 74 72 6f 73 70 65 63 74 69 6f 6e 0a 20 20 20 20 trospection.
0aa0: 70 72 61 67 6d 61 20 2d 68 61 73 69 6e 66 6f 20 pragma -hasinfo
0ab0: 20 20 20 20 20 20 20 6e 6f 20 20 3b 20 23 20 6e no ; # n
0ac0: 6f 20 6f 62 6a 65 63 74 20 69 6e 74 72 6f 73 70 o object introsp
0ad0: 65 63 74 69 6f 6e 0a 20 20 20 20 70 72 61 67 6d ection. pragm
0ae0: 61 20 2d 68 61 73 74 79 70 65 6d 65 74 68 6f 64 a -hastypemethod
0af0: 73 20 6e 6f 20 20 3b 20 23 20 74 79 70 65 20 69 s no ; # type i
0b00: 73 20 6e 6f 74 20 72 65 6c 65 76 61 6e 74 2e 0a s not relevant..
0b10: 0a 20 20 20 20 23 20 23 20 23 23 20 23 23 23 20 . # # ## ###
0b20: 23 23 23 23 23 20 23 23 23 23 23 23 23 23 20 23 ##### ######## #
0b30: 23 23 23 23 23 23 23 23 23 23 23 23 0a 7d 0a 0a ############.}..
0b40: 6e 61 6d 65 73 70 61 63 65 20 65 76 61 6c 20 3a namespace eval :
0b50: 3a 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 :vc::fossil::imp
0b60: 6f 72 74 3a 3a 63 76 73 20 7b 0a 20 20 20 20 6e ort::cvs {. n
0b70: 61 6d 65 73 70 61 63 65 20 65 78 70 6f 72 74 20 amespace export
0b80: 72 69 73 74 61 74 65 0a 20 20 20 20 6e 61 6d 65 ristate. name
0b90: 73 70 61 63 65 20 65 76 61 6c 20 72 69 73 74 61 space eval rista
0ba0: 74 65 20 7b 0a 09 6e 61 6d 65 73 70 61 63 65 20 te {..namespace
0bb0: 69 6d 70 6f 72 74 20 3a 3a 76 63 3a 3a 66 6f 73 import ::vc::fos
0bc0: 73 69 6c 3a 3a 69 6d 70 6f 72 74 3a 3a 63 76 73 sil::import::cvs
0bd0: 3a 3a 77 73 73 74 61 74 65 0a 09 6e 61 6d 65 73 ::wsstate..names
0be0: 70 61 63 65 20 69 6d 70 6f 72 74 20 3a 3a 76 63 pace import ::vc
0bf0: 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d 70 6f 72 74 ::fossil::import
0c00: 3a 3a 63 76 73 3a 3a 69 6e 74 65 67 72 69 74 79 ::cvs::integrity
0c10: 0a 09 6e 61 6d 65 73 70 61 63 65 20 69 6d 70 6f ..namespace impo
0c20: 72 74 20 3a 3a 76 63 3a 3a 74 6f 6f 6c 73 3a 3a rt ::vc::tools::
0c30: 74 72 6f 75 62 6c 65 0a 09 6e 61 6d 65 73 70 61 trouble..namespa
0c40: 63 65 20 69 6d 70 6f 72 74 20 3a 3a 76 63 3a 3a ce import ::vc::
0c50: 74 6f 6f 6c 73 3a 3a 6c 6f 67 0a 09 6c 6f 67 20 tools::log..log
0c60: 72 65 67 69 73 74 65 72 20 72 69 73 74 61 74 65 register ristate
0c70: 0a 20 20 20 20 7d 0a 7d 0a 0a 23 20 23 20 23 23 . }.}..# # ##
0c80: 20 23 23 23 20 23 23 23 23 23 20 23 23 23 23 23 ### ##### #####
0c90: 23 23 23 20 23 23 23 23 23 23 23 23 23 23 23 23 ### ############
0ca0: 23 20 23 23 23 23 23 23 23 23 23 23 23 23 23 23 # ##############
0cb0: 23 23 23 23 23 23 23 0a 23 23 20 52 65 61 64 79 #######.## Ready
0cc0: 0a 0a 70 61 63 6b 61 67 65 20 70 72 6f 76 69 64 ..package provid
0cd0: 65 20 76 63 3a 3a 66 6f 73 73 69 6c 3a 3a 69 6d e vc::fossil::im
0ce0: 70 6f 72 74 3a 3a 63 76 73 3a 3a 72 69 73 74 61 port::cvs::rista
0cf0: 74 65 20 31 2e 30 0a 72 65 74 75 72 6e 0a te 1.0.return.