Fossil SCM

fossil-scm / tools / cvs2fossil / lib / c2f_pimportcsets.tcl
Blame History Raw 134 lines
1
## -*- tcl -*-
2
# # ## ### ##### ######## ############# #####################
3
## Copyright (c) 2008 Andreas Kupries.
4
#
5
# This software is licensed as described in the file LICENSE, which
6
# you should have received as part of this distribution.
7
#
8
# This software consists of voluntary contributions made by many
9
# individuals. For exact contribution history, see the revision
10
# history and logs, available at http://fossil-scm.hwaci.com/fossil
11
# # ## ### ##### ######## ############# #####################
12
13
## Pass XIII. This is the second of the backend passes. It imports the
14
## changesets constructed by the previous passes into one or more
15
## fossil repositories, one per project.
16
17
# # ## ### ##### ######## ############# #####################
18
## Requirements
19
20
package require Tcl 8.4 ; # Required runtime.
21
package require snit ; # OO system.
22
package require vc::tools::log ; # User feedback.
23
package require vc::fossil::import::cvs::repository ; # Repository management.
24
package require vc::fossil::import::cvs::state ; # State storage.
25
package require vc::fossil::import::cvs::fossil ; # Access to fossil repositories.
26
package require vc::fossil::import::cvs::ristate ; # Import state (revisions)
27
28
# # ## ### ##### ######## ############# #####################
29
## Register the pass with the management
30
31
vc::fossil::import::cvs::pass define \
32
ImportCSets \
33
{Import the changesets into fossil repositories} \
34
::vc::fossil::import::cvs::pass::importcsets
35
36
# # ## ### ##### ######## ############# #####################
37
##
38
39
snit::type ::vc::fossil::import::cvs::pass::importcsets {
40
# # ## ### ##### ######## #############
41
## Public API
42
43
typemethod setup {} {
44
# Define the names and structure of the persistent state of
45
# this pass.
46
47
state use project
48
state use file
49
state use revision
50
state use meta
51
state use author
52
state use cmessage
53
state use symbol
54
state use space
55
state use revuuid
56
return
57
}
58
59
typemethod load {} {
60
# Pass manager interface. Executed to load data computed by
61
# this pass into memory when this pass is skipped instead of
62
# executed.
63
return
64
}
65
66
typemethod run {} {
67
# Pass manager interface. Executed to perform the
68
# functionality of the pass.
69
70
foreach project [repository projects] {
71
log write 1 importcsets {Importing project "[$project base]"}
72
73
set pid [$project id]
74
set fossil [fossil %AUTO%]
75
struct::list assign [state run {
76
SELECT repository, workspace
77
FROM space
78
WHERE pid = $pid
79
}] r w
80
$fossil load $r $w
81
82
set rstate [ristate %AUTO%]
83
84
state transaction {
85
# Layer II: Changesets
86
foreach {cset date} [$project changesetsinorder] {
87
$cset pushto $fossil $date $rstate
88
}
89
}
90
91
$rstate destroy
92
$fossil destroy
93
}
94
return
95
}
96
97
typemethod discard {} {
98
# Pass manager interface. Executed for all passes after the
99
# run passes, to remove all data of this pass from the state,
100
# as being out of date.
101
return
102
}
103
104
# # ## ### ##### ######## #############
105
## Internal methods
106
107
# # ## ### ##### ######## #############
108
## Configuration
109
110
pragma -hasinstances no ; # singleton
111
pragma -hastypeinfo no ; # no introspection
112
pragma -hastypedestroy no ; # immortal
113
114
# # ## ### ##### ######## #############
115
}
116
117
namespace eval ::vc::fossil::import::cvs::pass {
118
namespace export importcsets
119
namespace eval importcsets {
120
namespace import ::vc::fossil::import::cvs::repository
121
namespace import ::vc::fossil::import::cvs::state
122
namespace import ::vc::fossil::import::cvs::fossil
123
namespace import ::vc::fossil::import::cvs::ristate
124
namespace import ::vc::tools::log
125
log register importcsets
126
}
127
}
128
129
# # ## ### ##### ######## ############# #####################
130
## Ready
131
132
package provide vc::fossil::import::cvs::pass::importcsets 1.0
133
return
134

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button