Fossil SCM

fossil-scm / tools / cvs2fossil / lib / c2f_pimportfinal.tcl
Blame History Raw 123 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 XIV. This is the third and last of the backend passes. It
14
## finalizes the fossil repositories we have constructed in the
15
## previous import passes.
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
27
# # ## ### ##### ######## ############# #####################
28
## Register the pass with the management
29
30
vc::fossil::import::cvs::pass define \
31
ImportFinal \
32
{Finalize the import into fossil repositories} \
33
::vc::fossil::import::cvs::pass::importfinal
34
35
# # ## ### ##### ######## ############# #####################
36
##
37
38
snit::type ::vc::fossil::import::cvs::pass::importfinal {
39
# # ## ### ##### ######## #############
40
## Public API
41
42
typemethod setup {} {
43
# Define the names and structure of the persistent state of
44
# this pass.
45
46
state use space
47
return
48
}
49
50
typemethod load {} {
51
# Pass manager interface. Executed to load data computed by
52
# this pass into memory when this pass is skipped instead of
53
# executed.
54
return
55
}
56
57
typemethod run {} {
58
# Pass manager interface. Executed to perform the
59
# functionality of the pass.
60
61
foreach project [repository projects] {
62
log write 1 importfinal {Finalize project "[$project base]"}
63
64
set pid [$project id]
65
set fossil [fossil %AUTO%]
66
struct::list assign [state run {
67
SELECT repository, workspace
68
FROM space
69
WHERE pid = $pid
70
}] r w
71
$fossil load $r $w
72
73
# At last copy the temporary repository file to its final
74
# destination and release the associated memory.
75
76
set destination [$project base]
77
if {$destination eq ""} {
78
set destination [file tail [repository base?]]
79
}
80
append destination .fsl
81
82
$fossil finalize $destination ; # implies destroy
83
}
84
return
85
}
86
87
typemethod discard {} {
88
# Pass manager interface. Executed for all passes after the
89
# run passes, to remove all data of this pass from the state,
90
# as being out of date.
91
return
92
}
93
94
# # ## ### ##### ######## #############
95
## Internal methods
96
97
# # ## ### ##### ######## #############
98
## Configuration
99
100
pragma -hasinstances no ; # singleton
101
pragma -hastypeinfo no ; # no introspection
102
pragma -hastypedestroy no ; # immortal
103
104
# # ## ### ##### ######## #############
105
}
106
107
namespace eval ::vc::fossil::import::cvs::pass {
108
namespace export importfinal
109
namespace eval importfinal {
110
namespace import ::vc::fossil::import::cvs::repository
111
namespace import ::vc::fossil::import::cvs::state
112
namespace import ::vc::fossil::import::cvs::fossil
113
namespace import ::vc::tools::log
114
log register importfinal
115
}
116
}
117
118
# # ## ### ##### ######## ############# #####################
119
## Ready
120
121
package provide vc::fossil::import::cvs::pass::importfinal 1.0
122
return
123

Keyboard Shortcuts

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