Fossil

Check-in [d9fc75e5]
Login

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

Overview
Comment:Created new pass for the import of files and changesets. Uses the new file method and fossil accessor class to handle the file import. Changeset -> manifest conversion is _not_ covered yet.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:d9fc75e58714bc3006917ddd5383d7224761b734
User & Date: aku 2007-12-05 07:57:50
Context
2007-12-05
07:58
Bugfix. Translation implies encoding, not the reverse. This caused problems when parsing files with mixed-mode line-endings. The generated char offsets and lengths were off. Found during expansion. check-in: 6f1c4424 user: aku tags: trunk
07:57
Created new pass for the import of files and changesets. Uses the new file method and fossil accessor class to handle the file import. Changeset -> manifest conversion is _not_ covered yet. check-in: d9fc75e5 user: aku tags: trunk
07:55
Extended file handling with main logic to import an archive into fossil. Main parts are determining the various orders for expansion and import, and expanding all revisions in an archive into full texts, iteratively applying the stored deltas. check-in: e100314e user: aku tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Added tools/cvs2fossil/lib/c2f_pimport.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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
## -*- tcl -*-
# # ## ### ##### ######## ############# #####################
## Copyright (c) 2007 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
# # ## ### ##### ######## ############# #####################

## Pass XII. This is the first of the backend passes. It imports the
## changesets constructed by the previous passes, and all file
## revisions they refer to into one or more fossil repositories, one
## per project.

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

package require Tcl 8.4                                   ; # Required runtime.
package require snit                                      ; # OO system.
package require vc::tools::log                            ; # User feedback.
package require vc::fossil::import::cvs::repository       ; # Repository management.
package require vc::fossil::import::cvs::state            ; # State storage.
package require vc::fossil::import::cvs::fossil           ; # Access to fossil repositories.

# # ## ### ##### ######## ############# #####################
## Register the pass with the management

vc::fossil::import::cvs::pass define \
    Import \
    {Import the changesets and file revisions into fossil repositories} \
    ::vc::fossil::import::cvs::pass::import

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

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

    typemethod setup {} {
	# Define the names and structure of the persistent state of
	# this pass.

	state use project
	state use file
	state use revision

	# This data is actually transient, confined to this pass. We
	# use the state storage only to keep the RAM usage low.
	state extend revuuid {
	    rid   INTEGER NOT NULL  REFERENCES revision UNIQUE,
	    uuid  INTEGER NOT NULL  -- fossil id of the revision
	    --                         unique within the project
	}

	# This information is truly non-transient, needed by the next
	# pass adding the tags.

	state extend csuuid {
	    cid   INTEGER NOT NULL  REFERENCES changeset UNIQUE,
	    uuid  INTEGER NOT NULL  -- fossil id of the changeset
	    --                         unique within the project
	}
	return
    }

    typemethod load {} {
	# Pass manager interface. Executed to load data computed by
	# this pass into memory when this pass is skipped instead of
	# executed.
	return
    }

    typemethod run {} {
	# Pass manager interface. Executed to perform the
	# functionality of the pass.

	foreach project [repository projects] {
	    log write 1 import {Importing project "[$project base]"}

	    set fossil [fossil %AUTO%]

	    state transaction {
		foreach file [$project files] {
		    set path [$file path]
		    log write 2 import {Importing file "$path"}
		    $file pushto $fossil
		}

		# TODO: Generate manifests for the changesets in the
		#       project and import them. This needs
		#       topological traversal. And the creation of
		#       empty helper baselines for stuff like the root
		#       of ntdb and such.
	    }

	    # At last copy the temporary repository file to its final
	    # destination and release the associated memory.

	    $fossil finalize [$project base].fsl
	}

	# This does not live beyond the pass. We use the state for the
	# data despite its transient nature to keep the memory
	# requirements down.
	#state discard revuuid
	return
    }

    typemethod discard {} {
	# Pass manager interface. Executed for all passes after the
	# run passes, to remove all data of this pass from the state,
	# as being out of date.
	return
    }

    # # ## ### ##### ######## #############
    ## Internal methods

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

    pragma -hasinstances   no ; # singleton
    pragma -hastypeinfo    no ; # no introspection
    pragma -hastypedestroy no ; # immortal

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

namespace eval ::vc::fossil::import::cvs::pass {
    namespace export import
    namespace eval import {
	namespace import ::vc::fossil::import::cvs::repository
	namespace import ::vc::fossil::import::cvs::state
	namespace import ::vc::fossil::import::cvs::fossil
	namespace import ::vc::tools::log
	log register import
    }
}

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

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

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

37
38
39
40
41
42
43

44
45
46
47
48
49
50
package require vc::fossil::import::cvs::pass::initcsets   ; # Init'ialize C'hange'Sets
package require vc::fossil::import::cvs::pass::csetdeps    ; # C'hange'Set Dep'endencies
package require vc::fossil::import::cvs::pass::breakrcycle ; # Break' R'evision Cycle's
package require vc::fossil::import::cvs::pass::rtopsort    ; # R'evision Top'ological Sort'
package require vc::fossil::import::cvs::pass::breakscycle ; # Break' S'ymbol Cycle's
package require vc::fossil::import::cvs::pass::breakacycle ; # Break' A'll Cycle's
package require vc::fossil::import::cvs::pass::atopsort    ; # A'll Top'ological Sort'


# # ## ### ##### ######## ############# #####################
## Support for passes etc.

package require vc::fossil::import::cvs::option ; # Cmd line parsing & database
package require vc::fossil::import::cvs::pass   ; # Pass management
package require vc::tools::log                  ; # User feedback







>







37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package require vc::fossil::import::cvs::pass::initcsets   ; # Init'ialize C'hange'Sets
package require vc::fossil::import::cvs::pass::csetdeps    ; # C'hange'Set Dep'endencies
package require vc::fossil::import::cvs::pass::breakrcycle ; # Break' R'evision Cycle's
package require vc::fossil::import::cvs::pass::rtopsort    ; # R'evision Top'ological Sort'
package require vc::fossil::import::cvs::pass::breakscycle ; # Break' S'ymbol Cycle's
package require vc::fossil::import::cvs::pass::breakacycle ; # Break' A'll Cycle's
package require vc::fossil::import::cvs::pass::atopsort    ; # A'll Top'ological Sort'
package require vc::fossil::import::cvs::pass::import      ; # Import' Files and Changesets

# # ## ### ##### ######## ############# #####################
## Support for passes etc.

package require vc::fossil::import::cvs::option ; # Cmd line parsing & database
package require vc::fossil::import::cvs::pass   ; # Pass management
package require vc::tools::log                  ; # User feedback

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

20
21
22
23
24
25
26

27
28
29
30
31
32
33
package ifneeded vc::fossil::import::cvs::pass::initcsets   1.0 [list source [file join $dir c2f_pinitcsets.tcl]]
package ifneeded vc::fossil::import::cvs::pass::csetdeps    1.0 [list source [file join $dir c2f_pcsetdeps.tcl]]
package ifneeded vc::fossil::import::cvs::pass::breakrcycle 1.0 [list source [file join $dir c2f_pbreakrcycle.tcl]]
package ifneeded vc::fossil::import::cvs::pass::rtopsort    1.0 [list source [file join $dir c2f_prtopsort.tcl]]
package ifneeded vc::fossil::import::cvs::pass::breakscycle 1.0 [list source [file join $dir c2f_pbreakscycle.tcl]]
package ifneeded vc::fossil::import::cvs::pass::breakacycle 1.0 [list source [file join $dir c2f_pbreakacycle.tcl]]
package ifneeded vc::fossil::import::cvs::pass::atopsort    1.0 [list source [file join $dir c2f_patopsort.tcl]]

package ifneeded vc::fossil::import::cvs::gtcore            1.0 [list source [file join $dir c2f_gtcore.tcl]]
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::lodmgr   1.0 [list source [file join $dir c2f_plodmgr.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]]







>







20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package ifneeded vc::fossil::import::cvs::pass::initcsets   1.0 [list source [file join $dir c2f_pinitcsets.tcl]]
package ifneeded vc::fossil::import::cvs::pass::csetdeps    1.0 [list source [file join $dir c2f_pcsetdeps.tcl]]
package ifneeded vc::fossil::import::cvs::pass::breakrcycle 1.0 [list source [file join $dir c2f_pbreakrcycle.tcl]]
package ifneeded vc::fossil::import::cvs::pass::rtopsort    1.0 [list source [file join $dir c2f_prtopsort.tcl]]
package ifneeded vc::fossil::import::cvs::pass::breakscycle 1.0 [list source [file join $dir c2f_pbreakscycle.tcl]]
package ifneeded vc::fossil::import::cvs::pass::breakacycle 1.0 [list source [file join $dir c2f_pbreakacycle.tcl]]
package ifneeded vc::fossil::import::cvs::pass::atopsort    1.0 [list source [file join $dir c2f_patopsort.tcl]]
package ifneeded vc::fossil::import::cvs::pass::import      1.0 [list source [file join $dir c2f_pimport.tcl]]
package ifneeded vc::fossil::import::cvs::gtcore            1.0 [list source [file join $dir c2f_gtcore.tcl]]
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::lodmgr   1.0 [list source [file join $dir c2f_plodmgr.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]]