Fossil

Check-in [d011e0b0]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Added classes to track the state of a workspace, and of the whole revision import.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: d011e0b008825cf251cd50888d9cbcbc8778b261
User & Date: aku 2008-02-04 06:01:45
Context
2008-02-04
06:02
Moved the really large log output during revision import (log message, and command) to very high log levels. check-in: e7138d7f user: aku tags: trunk
06:01
Added classes to track the state of a workspace, and of the whole revision import. check-in: d011e0b0 user: aku tags: trunk
06:00
Added note of an idea taken over by Mark Janssen. check-in: 4e02d677 user: aku tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Added tools/cvs2fossil/lib/c2f_ristate.tcl.





















































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
## -*- tcl -*-
# # ## ### ##### ######## ############# #####################
## Copyright (c) 2008 Andreas Kupries.
#
# This software is licensed as described in the file LICENSE, which
# you should have received as part of this distribution.
#
# This software consists of voluntary contributions made by many
# individuals.  For exact contribution history, see the revision
# history and logs, available at http://fossil-scm.hwaci.com/fossil
# # ## ### ##### ######## ############# #####################

## Track the state of revision import. Essentially maps lines of
## developments to their workspace state.

# # ## ### ##### ######## ############# #####################
## Requirements

package require Tcl 8.4                               ; # Required runtime.
package require snit                                  ; # OO system.
package require struct::list                          ; # List assignment
package require vc::fossil::import::cvs::wsstate      ; # Workspace state
package require vc::fossil::import::cvs::integrity    ; # State integrity checks.
package require vc::tools::log                        ; # User feedback.
package require vc::tools::trouble                    ; # Error reporting.

# # ## ### ##### ######## ############# #####################
##

snit::type ::vc::fossil::import::cvs::ristate {
    # # ## ### ##### ######## #############
    ## Public API

    constructor {} {
	# Start with an empty state
	return
    }

    method new {lod {parentlod {}}} {
	# Create the workspace state for a line of development
	# (LOD). If a parent LOD is specified let the new state
	# inherit the current state of the parent.

	log write 8 ristate {Open workspace state for LOD "$lod"}

	integrity assert {
	    ![info exists mystate($lod)]
	} {Trying to override existing state for lod "$lod"}

	set wss [wsstate ${selfns}::%AUTO% $lod]
	set mystate($lod) $wss

	if {$parentlod ne ""} {
	    log write 8 ristate {Inheriting from workspace state for LOD "$parentlod"}

	    integrity assert {
		[info exists mystate($parentlod)]
	    } {Trying to inherit from undefined lod "$parentlod"}

	    set pwss $mystate($parentlod)

	    $wss add   [$pwss get]
	    $wss defid [$pwss getid]
	}

	return $wss
    }

    method get {lod} { return $mystate($lod) }
    method has {lod} { return [info exists mystate($lod)] }

    method names {} { return [array names mystate] }

    # # ## ### ##### ######## #############
    ## State

    variable mystate -array {} ; # Map from lines of development
				 # (identified by name) to their
				 # workspace state.

    # # ## ### ##### ######## #############
    ## Configuration

    pragma -hastypeinfo    no  ; # no type introspection
    pragma -hasinfo        no  ; # no object introspection
    pragma -hastypemethods no  ; # type is not relevant.

    # # ## ### ##### ######## #############
}

namespace eval ::vc::fossil::import::cvs {
    namespace export ristate
    namespace eval ristate {
	namespace import ::vc::fossil::import::cvs::wsstate
	namespace import ::vc::fossil::import::cvs::integrity
	namespace import ::vc::tools::trouble
	namespace import ::vc::tools::log
	log register ristate
    }
}

# # ## ### ##### ######## ############# #####################
## Ready

package provide vc::fossil::import::cvs::ristate 1.0
return

Added tools/cvs2fossil/lib/c2f_wsstate.tcl.











































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
## -*- tcl -*-
# # ## ### ##### ######## ############# #####################
## Copyright (c) 2008 Andreas Kupries.
#
# This software is licensed as described in the file LICENSE, which
# you should have received as part of this distribution.
#
# This software consists of voluntary contributions made by many
# individuals.  For exact contribution history, see the revision
# history and logs, available at http://fossil-scm.hwaci.com/fossil
# # ## ### ##### ######## ############# #####################

## Track the state of a cvs workspace as changesets are committed to
## it. Nothing actually happens in the filesystem, this is completely
## virtual.

# # ## ### ##### ######## ############# #####################
## Requirements

package require Tcl 8.4                             ; # Required runtime.
package require snit                                ; # OO system.
package require struct::list                        ; # List assignment

# # ## ### ##### ######## ############# #####################
##

snit::type ::vc::fossil::import::cvs::wsstate {
    # # ## ### ##### ######## #############
    ## Public API

    constructor {lod} {
	# Start with an empty state
	set myname $lod
	return
    }

    method name {} { return $myname }

    method add {revisioninfo} {
	# revisioninfo = list (rid path label ...) /triples

	# Overwrite all changed files (identified by path) with the
	# new revisions. This keeps all unchanged files.

	# BUG / TODO for FIX: Have to recognize dead files, to remove
	# them. We need the per-file revision optype for this.

	foreach {rid path label} $revisioninfo {
	    set mystate($path) [list $rid $label]
	}
	return
    }

    method get {} {
	set res {}
	foreach path [lsort -dict [array names mystate]] {
	    struct::list assign $mystate($path) rid label
	    lappend res $rid $path $label
	}
	return $res
    }

    method defid {id} {
	set myid $id
	return
    }

    method getid {} { return $myid }

    # # ## ### ##### ######## #############
    ## State

    variable myname {}         ; # Name of the LOD the workspace is
				 # for.
    variable myid   {}         ; # Record id of the fossil manifest
				 # associated with the current state.
    variable mystate -array {} ; # Map from paths to the recordid of
				 # the file revision behind it, and
				 # the associated label for logging.

    # # ## ### ##### ######## #############
    ## Configuration

    pragma -hastypeinfo    no  ; # no type introspection
    pragma -hasinfo        no  ; # no object introspection
    pragma -hastypemethods no  ; # type is not relevant.

    # # ## ### ##### ######## #############
}

namespace eval ::vc::fossil::import::cvs {
    namespace export wsstate
    namespace eval wsstate {
    }
}

# # ## ### ##### ######## ############# #####################
## Ready

package provide vc::fossil::import::cvs::wsstate 1.0
return

Changes to tools/cvs2fossil/lib/pkgIndex.tcl.

29
30
31
32
33
34
35

36

37
38
39
40
41
42
package ifneeded vc::fossil::import::cvs::cyclebreaker      1.0 [list source [file join $dir c2f_cyclebreaker.tcl]]
package ifneeded vc::fossil::import::cvs::project           1.0 [list source [file join $dir c2f_project.tcl]]
package ifneeded vc::fossil::import::cvs::project::rev      1.0 [list source [file join $dir c2f_prev.tcl]]
package ifneeded vc::fossil::import::cvs::project::revlink  1.0 [list source [file join $dir c2f_prevlink.tcl]]
package ifneeded vc::fossil::import::cvs::project::sym      1.0 [list source [file join $dir c2f_psym.tcl]]
package ifneeded vc::fossil::import::cvs::project::trunk    1.0 [list source [file join $dir c2f_ptrunk.tcl]]
package ifneeded vc::fossil::import::cvs::repository        1.0 [list source [file join $dir c2f_repository.tcl]]

package ifneeded vc::fossil::import::cvs::state             1.0 [list source [file join $dir c2f_state.tcl]]

package ifneeded vc::rcs::parser                            1.0 [list source [file join $dir rcsparser.tcl]]
package ifneeded vc::tools::dot                             1.0 [list source [file join $dir dot.tcl]]
package ifneeded vc::tools::id                              1.0 [list source [file join $dir id.tcl]]
package ifneeded vc::tools::log                             1.0 [list source [file join $dir log.tcl]]
package ifneeded vc::tools::misc                            1.0 [list source [file join $dir misc.tcl]]
package ifneeded vc::tools::trouble                         1.0 [list source [file join $dir trouble.tcl]]







>

>






29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package ifneeded vc::fossil::import::cvs::cyclebreaker      1.0 [list source [file join $dir c2f_cyclebreaker.tcl]]
package ifneeded vc::fossil::import::cvs::project           1.0 [list source [file join $dir c2f_project.tcl]]
package ifneeded vc::fossil::import::cvs::project::rev      1.0 [list source [file join $dir c2f_prev.tcl]]
package ifneeded vc::fossil::import::cvs::project::revlink  1.0 [list source [file join $dir c2f_prevlink.tcl]]
package ifneeded vc::fossil::import::cvs::project::sym      1.0 [list source [file join $dir c2f_psym.tcl]]
package ifneeded vc::fossil::import::cvs::project::trunk    1.0 [list source [file join $dir c2f_ptrunk.tcl]]
package ifneeded vc::fossil::import::cvs::repository        1.0 [list source [file join $dir c2f_repository.tcl]]
package ifneeded vc::fossil::import::cvs::ristate           1.0 [list source [file join $dir c2f_ristate.tcl]]
package ifneeded vc::fossil::import::cvs::state             1.0 [list source [file join $dir c2f_state.tcl]]
package ifneeded vc::fossil::import::cvs::wsstate           1.0 [list source [file join $dir c2f_wsstate.tcl]]
package ifneeded vc::rcs::parser                            1.0 [list source [file join $dir rcsparser.tcl]]
package ifneeded vc::tools::dot                             1.0 [list source [file join $dir dot.tcl]]
package ifneeded vc::tools::id                              1.0 [list source [file join $dir id.tcl]]
package ifneeded vc::tools::log                             1.0 [list source [file join $dir log.tcl]]
package ifneeded vc::tools::misc                            1.0 [list source [file join $dir misc.tcl]]
package ifneeded vc::tools::trouble                         1.0 [list source [file join $dir trouble.tcl]]