Fossil SCM

Broke static dependency cycle repository <- project <- file <- repository, now using dynamic/runtime object references instead. This allows us to keep the nice and readable format for our files, code is readable too.

aku 2007-10-06 22:06 trunk
Commit 84871722547960bf0dee1f6402dd62dadc177bc8
--- tools/cvs2fossil/lib/c2f_file.tcl
+++ tools/cvs2fossil/lib/c2f_file.tcl
@@ -16,11 +16,10 @@
1616
# # ## ### ##### ######## ############# #####################
1717
## Requirements
1818
1919
package require Tcl 8.4 ; # Required runtime.
2020
package require snit ; # OO system.
21
-package require vc::fossil::import::cvs::repository ; # Repository management.
2221
2322
# # ## ### ##### ######## ############# #####################
2423
##
2524
2625
snit::type ::vc::fossil::import::cvs::file {
@@ -95,18 +94,18 @@
9594
method setcomment {c} {# ignore}
9695
method setdesc {d} {# ignore}
9796
9897
method def {rev date author state next branches} {
9998
set myrev($rev) [list $date $author $state $next $branches]
100
- repository author $author
99
+ $myproject author $author
101100
return
102101
}
103102
104103
method extend {rev commitmsg deltarange} {
105104
set cm [string trim $commitmsg]
106105
lappend myrev($rev) $cm $deltarange
107
- repository cmessage $cm
106
+ $myproject cmessage $cm
108107
return
109108
}
110109
111110
# # ## ### ##### ######## #############
112111
## State
@@ -128,15 +127,12 @@
128127
# # ## ### ##### ######## #############
129128
}
130129
131130
namespace eval ::vc::fossil::import::cvs {
132131
namespace export file
133
- namespace eval file {
134
- namespace import ::vc::fossil::import::cvs::repository
135
- }
136132
}
137133
138134
# # ## ### ##### ######## ############# #####################
139135
## Ready
140136
141137
package provide vc::fossil::import::cvs::file 1.0
142138
return
143139
--- tools/cvs2fossil/lib/c2f_file.tcl
+++ tools/cvs2fossil/lib/c2f_file.tcl
@@ -16,11 +16,10 @@
16 # # ## ### ##### ######## ############# #####################
17 ## Requirements
18
19 package require Tcl 8.4 ; # Required runtime.
20 package require snit ; # OO system.
21 package require vc::fossil::import::cvs::repository ; # Repository management.
22
23 # # ## ### ##### ######## ############# #####################
24 ##
25
26 snit::type ::vc::fossil::import::cvs::file {
@@ -95,18 +94,18 @@
95 method setcomment {c} {# ignore}
96 method setdesc {d} {# ignore}
97
98 method def {rev date author state next branches} {
99 set myrev($rev) [list $date $author $state $next $branches]
100 repository author $author
101 return
102 }
103
104 method extend {rev commitmsg deltarange} {
105 set cm [string trim $commitmsg]
106 lappend myrev($rev) $cm $deltarange
107 repository cmessage $cm
108 return
109 }
110
111 # # ## ### ##### ######## #############
112 ## State
@@ -128,15 +127,12 @@
128 # # ## ### ##### ######## #############
129 }
130
131 namespace eval ::vc::fossil::import::cvs {
132 namespace export file
133 namespace eval file {
134 namespace import ::vc::fossil::import::cvs::repository
135 }
136 }
137
138 # # ## ### ##### ######## ############# #####################
139 ## Ready
140
141 package provide vc::fossil::import::cvs::file 1.0
142 return
143
--- tools/cvs2fossil/lib/c2f_file.tcl
+++ tools/cvs2fossil/lib/c2f_file.tcl
@@ -16,11 +16,10 @@
16 # # ## ### ##### ######## ############# #####################
17 ## Requirements
18
19 package require Tcl 8.4 ; # Required runtime.
20 package require snit ; # OO system.
 
21
22 # # ## ### ##### ######## ############# #####################
23 ##
24
25 snit::type ::vc::fossil::import::cvs::file {
@@ -95,18 +94,18 @@
94 method setcomment {c} {# ignore}
95 method setdesc {d} {# ignore}
96
97 method def {rev date author state next branches} {
98 set myrev($rev) [list $date $author $state $next $branches]
99 $myproject author $author
100 return
101 }
102
103 method extend {rev commitmsg deltarange} {
104 set cm [string trim $commitmsg]
105 lappend myrev($rev) $cm $deltarange
106 $myproject cmessage $cm
107 return
108 }
109
110 # # ## ### ##### ######## #############
111 ## State
@@ -128,15 +127,12 @@
127 # # ## ### ##### ######## #############
128 }
129
130 namespace eval ::vc::fossil::import::cvs {
131 namespace export file
 
 
 
132 }
133
134 # # ## ### ##### ######## ############# #####################
135 ## Ready
136
137 package provide vc::fossil::import::cvs::file 1.0
138 return
139
--- tools/cvs2fossil/lib/c2f_project.tcl
+++ tools/cvs2fossil/lib/c2f_project.tcl
@@ -25,12 +25,13 @@
2525
2626
snit::type ::vc::fossil::import::cvs::project {
2727
# # ## ### ##### ######## #############
2828
## Public API
2929
30
- constructor {path} {
31
- set mybase $path
30
+ constructor {path r} {
31
+ set mybase $path
32
+ set myrepository $r
3233
return
3334
}
3435
3536
method base {} { return $mybase }
3637
@@ -50,10 +51,13 @@
5051
5152
method files {} {
5253
# TODO: Loading from state
5354
return [TheFiles]
5455
}
56
+
57
+ delegate method author to myrepository
58
+ delegate method cmessage to myrepository
5559
5660
# pass I persistence
5761
method persist {} {
5862
state transaction {
5963
# Project data first. Required so that we have its id
@@ -93,10 +97,11 @@
9397
## State
9498
9599
variable mybase {} ; # Project directory
96100
variable myfiles -array {} ; # Maps rcs archive to their user files.
97101
variable myfobj {} ; # File objects for the rcs archives
102
+ variable myrepository {} ; # Repository the prject belongs to.
98103
99104
# # ## ### ##### ######## #############
100105
## Internal methods
101106
102107
proc TheFiles {} {
@@ -120,11 +125,10 @@
120125
## Configuration
121126
122127
pragma -hastypeinfo no ; # no type introspection
123128
pragma -hasinfo no ; # no object introspection
124129
pragma -hastypemethods no ; # type is not relevant.
125
- pragma -simpledispatch yes ; # simple fast dispatch
126130
127131
# # ## ### ##### ######## #############
128132
}
129133
130134
namespace eval ::vc::fossil::import::cvs {
131135
--- tools/cvs2fossil/lib/c2f_project.tcl
+++ tools/cvs2fossil/lib/c2f_project.tcl
@@ -25,12 +25,13 @@
25
26 snit::type ::vc::fossil::import::cvs::project {
27 # # ## ### ##### ######## #############
28 ## Public API
29
30 constructor {path} {
31 set mybase $path
 
32 return
33 }
34
35 method base {} { return $mybase }
36
@@ -50,10 +51,13 @@
50
51 method files {} {
52 # TODO: Loading from state
53 return [TheFiles]
54 }
 
 
 
55
56 # pass I persistence
57 method persist {} {
58 state transaction {
59 # Project data first. Required so that we have its id
@@ -93,10 +97,11 @@
93 ## State
94
95 variable mybase {} ; # Project directory
96 variable myfiles -array {} ; # Maps rcs archive to their user files.
97 variable myfobj {} ; # File objects for the rcs archives
 
98
99 # # ## ### ##### ######## #############
100 ## Internal methods
101
102 proc TheFiles {} {
@@ -120,11 +125,10 @@
120 ## Configuration
121
122 pragma -hastypeinfo no ; # no type introspection
123 pragma -hasinfo no ; # no object introspection
124 pragma -hastypemethods no ; # type is not relevant.
125 pragma -simpledispatch yes ; # simple fast dispatch
126
127 # # ## ### ##### ######## #############
128 }
129
130 namespace eval ::vc::fossil::import::cvs {
131
--- tools/cvs2fossil/lib/c2f_project.tcl
+++ tools/cvs2fossil/lib/c2f_project.tcl
@@ -25,12 +25,13 @@
25
26 snit::type ::vc::fossil::import::cvs::project {
27 # # ## ### ##### ######## #############
28 ## Public API
29
30 constructor {path r} {
31 set mybase $path
32 set myrepository $r
33 return
34 }
35
36 method base {} { return $mybase }
37
@@ -50,10 +51,13 @@
51
52 method files {} {
53 # TODO: Loading from state
54 return [TheFiles]
55 }
56
57 delegate method author to myrepository
58 delegate method cmessage to myrepository
59
60 # pass I persistence
61 method persist {} {
62 state transaction {
63 # Project data first. Required so that we have its id
@@ -93,10 +97,11 @@
97 ## State
98
99 variable mybase {} ; # Project directory
100 variable myfiles -array {} ; # Maps rcs archive to their user files.
101 variable myfobj {} ; # File objects for the rcs archives
102 variable myrepository {} ; # Repository the prject belongs to.
103
104 # # ## ### ##### ######## #############
105 ## Internal methods
106
107 proc TheFiles {} {
@@ -120,11 +125,10 @@
125 ## Configuration
126
127 pragma -hastypeinfo no ; # no type introspection
128 pragma -hasinfo no ; # no object introspection
129 pragma -hastypemethods no ; # type is not relevant.
 
130
131 # # ## ### ##### ######## #############
132 }
133
134 namespace eval ::vc::fossil::import::cvs {
135
--- tools/cvs2fossil/lib/c2f_repository.tcl
+++ tools/cvs2fossil/lib/c2f_repository.tcl
@@ -19,13 +19,13 @@
1919
2020
package require Tcl 8.4 ; # Required runtime.
2121
package require snit ; # OO system.
2222
package require vc::tools::trouble ; # Error reporting.
2323
package require vc::tools::log ; # User feedback.
24
-package require vc::tools::misc ; # Text formatting
25
-# CVS Projects later (see bottom) to handle circular dependency in 'file'.
26
-package require vc::fossil::import::cvs::state ; # State storage
24
+package require vc::tools::misc ; # Text formatting.
25
+package require vc::fossil::import::cvs::project ; # CVS projects.
26
+package require vc::fossil::import::cvs::state ; # State storage.
2727
package require struct::list ; # List operations.
2828
package require fileutil ; # File operations.
2929
3030
# # ## ### ##### ######## ############# #####################
3131
##
@@ -194,28 +194,28 @@
194194
}
195195
return 1
196196
}
197197
198198
proc TheProjects {} {
199
- upvar 1 myprojects myprojects myprojpaths myprojpaths mybase mybase
199
+ upvar 1 myprojects myprojects myprojpaths myprojpaths mybase mybase type type
200200
201201
if {![llength $myprojects]} {
202202
set myprojects [EmptyProjects $myprojpaths]
203203
}
204204
return $myprojects
205205
}
206206
207207
proc EmptyProjects {projpaths} {
208
- upvar 1 mybase mybase
208
+ upvar 1 mybase mybase type type
209209
set res {}
210210
if {[llength $projpaths]} {
211211
foreach pp $projpaths {
212
- lappend res [project %AUTO% $pp]
212
+ lappend res [project %AUTO% $pp $type]
213213
}
214214
} else {
215215
# Base is the single project.
216
- lappend res [project %AUTO% ""]
216
+ lappend res [project %AUTO% "" $type]
217217
}
218218
return $res
219219
}
220220
221221
proc SaveAuthors {} {
@@ -254,25 +254,19 @@
254254
# # ## ### ##### ######## #############
255255
}
256256
257257
namespace eval ::vc::fossil::import::cvs {
258258
namespace export repository
259
-}
260
-
261
-# CVS projects here to handle circular dependency
262
-# repository <- project <- file <- repository
263
-
264
-package require vc::fossil::import::cvs::project
265
-
266
-namespace eval ::vc::fossil::import::cvs::repository {
267
- namespace import ::vc::fossil::import::cvs::project
268
- namespace import ::vc::fossil::import::cvs::state
269
- namespace import ::vc::tools::misc::*
270
- namespace import ::vc::tools::trouble
271
- namespace import ::vc::tools::log
272
- log register repository
259
+ namespace eval repository {
260
+ namespace import ::vc::fossil::import::cvs::project
261
+ namespace import ::vc::fossil::import::cvs::state
262
+ namespace import ::vc::tools::misc::*
263
+ namespace import ::vc::tools::trouble
264
+ namespace import ::vc::tools::log
265
+ log register repository
266
+ }
273267
}
274268
275269
# # ## ### ##### ######## ############# #####################
276270
## Ready
277271
278272
return
279273
--- tools/cvs2fossil/lib/c2f_repository.tcl
+++ tools/cvs2fossil/lib/c2f_repository.tcl
@@ -19,13 +19,13 @@
19
20 package require Tcl 8.4 ; # Required runtime.
21 package require snit ; # OO system.
22 package require vc::tools::trouble ; # Error reporting.
23 package require vc::tools::log ; # User feedback.
24 package require vc::tools::misc ; # Text formatting
25 # CVS Projects later (see bottom) to handle circular dependency in 'file'.
26 package require vc::fossil::import::cvs::state ; # State storage
27 package require struct::list ; # List operations.
28 package require fileutil ; # File operations.
29
30 # # ## ### ##### ######## ############# #####################
31 ##
@@ -194,28 +194,28 @@
194 }
195 return 1
196 }
197
198 proc TheProjects {} {
199 upvar 1 myprojects myprojects myprojpaths myprojpaths mybase mybase
200
201 if {![llength $myprojects]} {
202 set myprojects [EmptyProjects $myprojpaths]
203 }
204 return $myprojects
205 }
206
207 proc EmptyProjects {projpaths} {
208 upvar 1 mybase mybase
209 set res {}
210 if {[llength $projpaths]} {
211 foreach pp $projpaths {
212 lappend res [project %AUTO% $pp]
213 }
214 } else {
215 # Base is the single project.
216 lappend res [project %AUTO% ""]
217 }
218 return $res
219 }
220
221 proc SaveAuthors {} {
@@ -254,25 +254,19 @@
254 # # ## ### ##### ######## #############
255 }
256
257 namespace eval ::vc::fossil::import::cvs {
258 namespace export repository
259 }
260
261 # CVS projects here to handle circular dependency
262 # repository <- project <- file <- repository
263
264 package require vc::fossil::import::cvs::project
265
266 namespace eval ::vc::fossil::import::cvs::repository {
267 namespace import ::vc::fossil::import::cvs::project
268 namespace import ::vc::fossil::import::cvs::state
269 namespace import ::vc::tools::misc::*
270 namespace import ::vc::tools::trouble
271 namespace import ::vc::tools::log
272 log register repository
273 }
274
275 # # ## ### ##### ######## ############# #####################
276 ## Ready
277
278 return
279
--- tools/cvs2fossil/lib/c2f_repository.tcl
+++ tools/cvs2fossil/lib/c2f_repository.tcl
@@ -19,13 +19,13 @@
19
20 package require Tcl 8.4 ; # Required runtime.
21 package require snit ; # OO system.
22 package require vc::tools::trouble ; # Error reporting.
23 package require vc::tools::log ; # User feedback.
24 package require vc::tools::misc ; # Text formatting.
25 package require vc::fossil::import::cvs::project ; # CVS projects.
26 package require vc::fossil::import::cvs::state ; # State storage.
27 package require struct::list ; # List operations.
28 package require fileutil ; # File operations.
29
30 # # ## ### ##### ######## ############# #####################
31 ##
@@ -194,28 +194,28 @@
194 }
195 return 1
196 }
197
198 proc TheProjects {} {
199 upvar 1 myprojects myprojects myprojpaths myprojpaths mybase mybase type type
200
201 if {![llength $myprojects]} {
202 set myprojects [EmptyProjects $myprojpaths]
203 }
204 return $myprojects
205 }
206
207 proc EmptyProjects {projpaths} {
208 upvar 1 mybase mybase type type
209 set res {}
210 if {[llength $projpaths]} {
211 foreach pp $projpaths {
212 lappend res [project %AUTO% $pp $type]
213 }
214 } else {
215 # Base is the single project.
216 lappend res [project %AUTO% "" $type]
217 }
218 return $res
219 }
220
221 proc SaveAuthors {} {
@@ -254,25 +254,19 @@
254 # # ## ### ##### ######## #############
255 }
256
257 namespace eval ::vc::fossil::import::cvs {
258 namespace export repository
259 namespace eval repository {
260 namespace import ::vc::fossil::import::cvs::project
261 namespace import ::vc::fossil::import::cvs::state
262 namespace import ::vc::tools::misc::*
263 namespace import ::vc::tools::trouble
264 namespace import ::vc::tools::log
265 log register repository
266 }
 
 
 
 
 
 
267 }
268
269 # # ## ### ##### ######## ############# #####################
270 ## Ready
271
272 return
273

Keyboard Shortcuts

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