Fossil SCM

Got rid of the explicit revision tree and rephrased the trunk processing to use a loop which is more self-explanatory. Started to add in code needed when we process the branches as well, currently they will have now effect.

aku 2007-09-20 07:14 trunk
Commit cbbf9a7575ae82dec05c2e5dda09d79e7c48f9b0
+79 -94
--- tools/lib/cvs.tcl
+++ tools/lib/cvs.tcl
@@ -11,11 +11,10 @@
1111
package require vc::tools::trouble ; # Error handling
1212
package require vc::cvs::cmd ; # Access to cvs application.
1313
package require vc::cvs::ws::files ; # Scan CVS repository for relevant files.
1414
package require vc::cvs::ws::timeline ; # Manage timeline of all changes.
1515
package require vc::cvs::ws::csets ; # Manage the changesets found in the timeline
16
-package require struct::tree
1716
1817
namespace eval ::vc::cvs::ws {
1918
vc::tools::log::system cvs
2019
namespace import ::vc::tools::log::write
2120
namespace import ::vc::rcs::parser::process
@@ -29,17 +28,19 @@
2928
3029
# vc::cvs::ws::configure key value - Configure the subsystem.
3130
# vc::cvs::ws::check src mv - Check if src is a CVS repository directory.
3231
# vc::cvs::ws::begin src - Start new workspace and return the top-
3332
# most directory co'd files are put into.
34
-# vc::cvs::ws::ncsets ?-import? - Retrieve number of csets (all/to import)
33
+# vc::cvs::ws::ncsets - Retrieve total number of csets
34
+# vc::cvs::ws::nimportable - Retrieve number of importable csets
3535
# vc::cvs::ws::foreach csvar script - Run the script for each changeset, the
3636
# id of the current changeset stored in
3737
# the variable named by csvar.
3838
# vc::cvs::ws::done - Close workspace and delete it.
3939
# vc::cvs::ws::isadmin path - Check if path is an admin file of CVS
4040
# vc::cvs::ws::checkout id - Have workspace contain the changeset id.
41
+# vc::cvs::ws::get id - Retrieve data of a changeset.
4142
#
4243
# Configuration keys:
4344
#
4445
# -project path - Sub directory under 'src' to limit the import to.
4546
@@ -77,13 +78,11 @@
7778
if {![check $src msg]} { return -code error $msg }
7879
7980
DefBase $src
8081
MakeTimeline [ScanArchives [files::find [RootPath]]]
8182
MakeChangesets
82
-
83
- # OLD api calls ... TODO rework for more structure ...
84
- rtree ; # Build revision tree (trunk only right now).
83
+ ProcessBranches
8584
8685
return [MakeWorkspace]
8786
}
8887
8988
proc ::vc::cvs::ws::done {} {
@@ -91,41 +90,54 @@
9190
file delete -force $workspace
9291
return
9392
}
9493
9594
proc ::vc::cvs::ws::foreach {cv script} {
96
- # OLD api ... TODO inline
97
- uplevel 1 [list ::vc::cvs::ws::foreach_cset $cv 0 $script]
95
+ variable importable
96
+ upvar 1 $cv c
97
+
98
+ ::foreach c [lsort -integer -increasing $importable] {
99
+ set code [catch {uplevel 1 $script} res]
100
+
101
+ # 0 - ok, 1 - error, 2 - return, 3 - break, 4 - continue
102
+ switch -- $code {
103
+ 0 {}
104
+ 1 { return -errorcode $::errorCode -errorinfo $::errorInfo -code error $res }
105
+ 2 {}
106
+ 3 { return }
107
+ 4 {}
108
+ default { return -code $code $result }
109
+ }
110
+ }
111
+ return
98112
}
99113
100114
proc ::vc::cvs::ws::ncsets {args} {
101
- variable ntrunk
102
-
103
- if {[llength $args] > 1} {
104
- return -code error "wrong#args: Expected ?-import?"
105
- } elseif {[llength $args] == 1} {
106
- if {[set k [lindex $args 0]] ne "-import"} {
107
- return -code "Unknown switch $k, expected -import"
108
- } else {
109
- return $ntrunk
110
- }
111
- }
112
-
113115
return [csets::num]
114116
}
117
+
118
+proc ::vc::cvs::ws::nimportable {args} {
119
+ variable importable
120
+ return [llength $importable]
121
+}
115122
116123
proc ::vc::cvs::ws::isadmin {path} {
117124
# Check if path is a CVS admin file.
118125
if {[string match CVS/* $path]} {return 1}
119126
if {[string match */CVS/* $path]} {return 1}
120127
return 0
121128
}
122129
130
+proc ::vc::cvs::ws::parentOf {id} { csets::parentOf $id }
131
+
123132
proc ::vc::cvs::ws::checkout {id} {
124133
variable workspace
125134
cd $workspace
126135
136
+ # TODO: Hide the direct access to the data structures behind
137
+ # TODO: accessors for date, cmsg, removed, added, changed, and
138
+ # TODO: author
127139
array set cs [csets::get $id]
128140
129141
write 1 cvs "@ $cs(date)"
130142
::foreach l [split [string trim $cs(cmsg)] \n] {
131143
write 1 cvs "| $l"
@@ -264,81 +276,52 @@
264276
265277
# Building the revision tree from the changesets.
266278
# Limitation: Currently only trunk csets is handled.
267279
# Limitation: Dead files are not removed, i.e. no 'R' actions right now.
268280
269
-proc ::vc::cvs::ws::rtree {} {
270
- variable rtree {}
271
- variable ntrunk 0
272
-
273
- write 0 cvs "Extracting the trunk"
274
-
275
- set rtree [struct::tree ::vc::cvs::ws::RT]
276
- $rtree rename root 0 ; # Root is first changeset, always.
277
- set trunk 0
278
- set ntrunk 1 ; # Root is on the trunk.
279
- set b 0 ; # No branch csets found yet.
280
-
281
- # Extracting the trunk is easy, simply by looking at the involved
282
- # version numbers.
283
-
284
- for {set c 1} {$c < [csets::num]} {incr c} {
285
- array set cs [csets::get $c]
286
- # Ignore branch changes, just count them for the statistics.
287
- if {$cs(lastd) != 2} {
288
- incr b
289
- continue
290
- }
291
-
292
- # Trunk revision, connect to, and update the head.
293
- $rtree insert $trunk end $c
294
- set trunk $c
295
- incr ntrunk
296
- }
297
-
298
- write 0 cvs "Processed $ntrunk trunk [expr {($ntrunk == 1) ? "changeset" : "changesets"}]"
299
- write 0 cvs "Ignored $b branch [expr {($b == 1) ? "changeset" : "changesets"}]"
300
- return
301
-}
302
-
303
-namespace eval ::vc::cvs::ws {
304
- # Tree holding trunk and branch information (struct::tree).
305
- # Node names are cset id's.
306
-
307
- variable rtree {}
308
- variable ntrunk 0
309
-}
310
-
311
-proc ::vc::cvs::ws::foreach_cset {cv node script} {
312
- upvar 1 $cv c
313
- variable rtree
314
-
315
- set c $node
316
- while {1} {
317
- set code [catch {uplevel 1 $script} res]
318
-
319
- # 0 - ok, 1 - error, 2 - return, 3 - break, 4 - continue
320
- switch -- $code {
321
- 0 {}
322
- 1 { return -errorcode $::errorCode -errorinfo $::errorInfo -code error $res }
323
- 2 {}
324
- 3 { return }
325
- 4 {}
326
- default {
327
- return -code $code $result
328
- }
329
- }
330
-
331
- # Stop on reaching the head.
332
- if {![llength [$rtree children $c]]} break
333
-
334
- #puts <[$rtree children $c]>
335
-
336
- # Go to next child in trunk (leftmost).
337
- set c [lindex [$rtree children $c] 0]
338
- }
339
- return
281
+proc ::vc::cvs::ws::ProcessBranches {} {
282
+ variable importable
283
+
284
+ write 0 cvs "Organizing the changesets into branches"
285
+
286
+ set remainder [ProcessTrunk]
287
+ # TODO: Processing non-trunk branches
288
+
289
+
290
+ # Status information ...
291
+ set nr [llength $remainder]
292
+ set ni [llength $importable]
293
+ set fmt %[string length [csets::num]]s
294
+
295
+ write 0 cvs "Unprocessed: [format $fmt $nr] [SIPL $nr changeset] (Will be ignored)"
296
+ write 0 cvs "To import: [format $fmt $ni] [SIPL $ni changeset]"
297
+ return
298
+}
299
+
300
+proc ::vc::cvs::ws::ProcessTrunk {} {
301
+ variable importable
302
+
303
+ write 0 cvs "Processing the trunk changesets"
304
+
305
+ set remainder {}
306
+ set t 0
307
+ set n [csets::num]
308
+ set parent {}
309
+
310
+ for {set c 0} {$c < $n} {incr c} {
311
+ if {[csets::isTrunk $c]} {
312
+ csets::setParentOf $c $parent
313
+ set parent $c
314
+ incr t
315
+ lappend importable $c
316
+ } else {
317
+ lappend remainder $c
318
+ }
319
+ }
320
+
321
+ write 0 cvs "Found [NSIPL $t {trunk changeset}], [NSIPL [llength $remainder] {branch changeset}]"
322
+ return $remainder
340323
}
341324
342325
proc ::vc::cvs::ws::Checkout {f r} {
343326
variable base
344327
variable project
@@ -401,17 +384,19 @@
401384
}
402385
403386
# -----------------------------------------------------------------------------
404387
405388
namespace eval ::vc::cvs::ws {
406
- variable base {} ; # Toplevel repository directory
407
- variable project {} ; # Sub directory to limit the import to.
408
- variable workspace {} ; # Directory to checkout changesets to.
389
+ variable base {} ; # Toplevel repository directory
390
+ variable project {} ; # Sub directory to limit the import to.
391
+ variable workspace {} ; # Directory to checkout changesets to.
392
+ variable importable {} ; # List of the csets which can be imported.
409393
410
- namespace export configure begin done foreach ncsets checkout
394
+ namespace export configure begin done foreach ncsets nimportable checkout
395
+ namespace export parentOf
411396
}
412397
413398
# -----------------------------------------------------------------------------
414399
# Ready
415400
416401
package provide vc::cvs::ws 1.0
417402
return
418403
--- tools/lib/cvs.tcl
+++ tools/lib/cvs.tcl
@@ -11,11 +11,10 @@
11 package require vc::tools::trouble ; # Error handling
12 package require vc::cvs::cmd ; # Access to cvs application.
13 package require vc::cvs::ws::files ; # Scan CVS repository for relevant files.
14 package require vc::cvs::ws::timeline ; # Manage timeline of all changes.
15 package require vc::cvs::ws::csets ; # Manage the changesets found in the timeline
16 package require struct::tree
17
18 namespace eval ::vc::cvs::ws {
19 vc::tools::log::system cvs
20 namespace import ::vc::tools::log::write
21 namespace import ::vc::rcs::parser::process
@@ -29,17 +28,19 @@
29
30 # vc::cvs::ws::configure key value - Configure the subsystem.
31 # vc::cvs::ws::check src mv - Check if src is a CVS repository directory.
32 # vc::cvs::ws::begin src - Start new workspace and return the top-
33 # most directory co'd files are put into.
34 # vc::cvs::ws::ncsets ?-import? - Retrieve number of csets (all/to import)
 
35 # vc::cvs::ws::foreach csvar script - Run the script for each changeset, the
36 # id of the current changeset stored in
37 # the variable named by csvar.
38 # vc::cvs::ws::done - Close workspace and delete it.
39 # vc::cvs::ws::isadmin path - Check if path is an admin file of CVS
40 # vc::cvs::ws::checkout id - Have workspace contain the changeset id.
 
41 #
42 # Configuration keys:
43 #
44 # -project path - Sub directory under 'src' to limit the import to.
45
@@ -77,13 +78,11 @@
77 if {![check $src msg]} { return -code error $msg }
78
79 DefBase $src
80 MakeTimeline [ScanArchives [files::find [RootPath]]]
81 MakeChangesets
82
83 # OLD api calls ... TODO rework for more structure ...
84 rtree ; # Build revision tree (trunk only right now).
85
86 return [MakeWorkspace]
87 }
88
89 proc ::vc::cvs::ws::done {} {
@@ -91,41 +90,54 @@
91 file delete -force $workspace
92 return
93 }
94
95 proc ::vc::cvs::ws::foreach {cv script} {
96 # OLD api ... TODO inline
97 uplevel 1 [list ::vc::cvs::ws::foreach_cset $cv 0 $script]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
98 }
99
100 proc ::vc::cvs::ws::ncsets {args} {
101 variable ntrunk
102
103 if {[llength $args] > 1} {
104 return -code error "wrong#args: Expected ?-import?"
105 } elseif {[llength $args] == 1} {
106 if {[set k [lindex $args 0]] ne "-import"} {
107 return -code "Unknown switch $k, expected -import"
108 } else {
109 return $ntrunk
110 }
111 }
112
113 return [csets::num]
114 }
 
 
 
 
 
115
116 proc ::vc::cvs::ws::isadmin {path} {
117 # Check if path is a CVS admin file.
118 if {[string match CVS/* $path]} {return 1}
119 if {[string match */CVS/* $path]} {return 1}
120 return 0
121 }
122
 
 
123 proc ::vc::cvs::ws::checkout {id} {
124 variable workspace
125 cd $workspace
126
 
 
 
127 array set cs [csets::get $id]
128
129 write 1 cvs "@ $cs(date)"
130 ::foreach l [split [string trim $cs(cmsg)] \n] {
131 write 1 cvs "| $l"
@@ -264,81 +276,52 @@
264
265 # Building the revision tree from the changesets.
266 # Limitation: Currently only trunk csets is handled.
267 # Limitation: Dead files are not removed, i.e. no 'R' actions right now.
268
269 proc ::vc::cvs::ws::rtree {} {
270 variable rtree {}
271 variable ntrunk 0
272
273 write 0 cvs "Extracting the trunk"
274
275 set rtree [struct::tree ::vc::cvs::ws::RT]
276 $rtree rename root 0 ; # Root is first changeset, always.
277 set trunk 0
278 set ntrunk 1 ; # Root is on the trunk.
279 set b 0 ; # No branch csets found yet.
280
281 # Extracting the trunk is easy, simply by looking at the involved
282 # version numbers.
283
284 for {set c 1} {$c < [csets::num]} {incr c} {
285 array set cs [csets::get $c]
286 # Ignore branch changes, just count them for the statistics.
287 if {$cs(lastd) != 2} {
288 incr b
289 continue
290 }
291
292 # Trunk revision, connect to, and update the head.
293 $rtree insert $trunk end $c
294 set trunk $c
295 incr ntrunk
296 }
297
298 write 0 cvs "Processed $ntrunk trunk [expr {($ntrunk == 1) ? "changeset" : "changesets"}]"
299 write 0 cvs "Ignored $b branch [expr {($b == 1) ? "changeset" : "changesets"}]"
300 return
301 }
302
303 namespace eval ::vc::cvs::ws {
304 # Tree holding trunk and branch information (struct::tree).
305 # Node names are cset id's.
306
307 variable rtree {}
308 variable ntrunk 0
309 }
310
311 proc ::vc::cvs::ws::foreach_cset {cv node script} {
312 upvar 1 $cv c
313 variable rtree
314
315 set c $node
316 while {1} {
317 set code [catch {uplevel 1 $script} res]
318
319 # 0 - ok, 1 - error, 2 - return, 3 - break, 4 - continue
320 switch -- $code {
321 0 {}
322 1 { return -errorcode $::errorCode -errorinfo $::errorInfo -code error $res }
323 2 {}
324 3 { return }
325 4 {}
326 default {
327 return -code $code $result
328 }
329 }
330
331 # Stop on reaching the head.
332 if {![llength [$rtree children $c]]} break
333
334 #puts <[$rtree children $c]>
335
336 # Go to next child in trunk (leftmost).
337 set c [lindex [$rtree children $c] 0]
338 }
339 return
340 }
341
342 proc ::vc::cvs::ws::Checkout {f r} {
343 variable base
344 variable project
@@ -401,17 +384,19 @@
401 }
402
403 # -----------------------------------------------------------------------------
404
405 namespace eval ::vc::cvs::ws {
406 variable base {} ; # Toplevel repository directory
407 variable project {} ; # Sub directory to limit the import to.
408 variable workspace {} ; # Directory to checkout changesets to.
 
409
410 namespace export configure begin done foreach ncsets checkout
 
411 }
412
413 # -----------------------------------------------------------------------------
414 # Ready
415
416 package provide vc::cvs::ws 1.0
417 return
418
--- tools/lib/cvs.tcl
+++ tools/lib/cvs.tcl
@@ -11,11 +11,10 @@
11 package require vc::tools::trouble ; # Error handling
12 package require vc::cvs::cmd ; # Access to cvs application.
13 package require vc::cvs::ws::files ; # Scan CVS repository for relevant files.
14 package require vc::cvs::ws::timeline ; # Manage timeline of all changes.
15 package require vc::cvs::ws::csets ; # Manage the changesets found in the timeline
 
16
17 namespace eval ::vc::cvs::ws {
18 vc::tools::log::system cvs
19 namespace import ::vc::tools::log::write
20 namespace import ::vc::rcs::parser::process
@@ -29,17 +28,19 @@
28
29 # vc::cvs::ws::configure key value - Configure the subsystem.
30 # vc::cvs::ws::check src mv - Check if src is a CVS repository directory.
31 # vc::cvs::ws::begin src - Start new workspace and return the top-
32 # most directory co'd files are put into.
33 # vc::cvs::ws::ncsets - Retrieve total number of csets
34 # vc::cvs::ws::nimportable - Retrieve number of importable csets
35 # vc::cvs::ws::foreach csvar script - Run the script for each changeset, the
36 # id of the current changeset stored in
37 # the variable named by csvar.
38 # vc::cvs::ws::done - Close workspace and delete it.
39 # vc::cvs::ws::isadmin path - Check if path is an admin file of CVS
40 # vc::cvs::ws::checkout id - Have workspace contain the changeset id.
41 # vc::cvs::ws::get id - Retrieve data of a changeset.
42 #
43 # Configuration keys:
44 #
45 # -project path - Sub directory under 'src' to limit the import to.
46
@@ -77,13 +78,11 @@
78 if {![check $src msg]} { return -code error $msg }
79
80 DefBase $src
81 MakeTimeline [ScanArchives [files::find [RootPath]]]
82 MakeChangesets
83 ProcessBranches
 
 
84
85 return [MakeWorkspace]
86 }
87
88 proc ::vc::cvs::ws::done {} {
@@ -91,41 +90,54 @@
90 file delete -force $workspace
91 return
92 }
93
94 proc ::vc::cvs::ws::foreach {cv script} {
95 variable importable
96 upvar 1 $cv c
97
98 ::foreach c [lsort -integer -increasing $importable] {
99 set code [catch {uplevel 1 $script} res]
100
101 # 0 - ok, 1 - error, 2 - return, 3 - break, 4 - continue
102 switch -- $code {
103 0 {}
104 1 { return -errorcode $::errorCode -errorinfo $::errorInfo -code error $res }
105 2 {}
106 3 { return }
107 4 {}
108 default { return -code $code $result }
109 }
110 }
111 return
112 }
113
114 proc ::vc::cvs::ws::ncsets {args} {
 
 
 
 
 
 
 
 
 
 
 
 
115 return [csets::num]
116 }
117
118 proc ::vc::cvs::ws::nimportable {args} {
119 variable importable
120 return [llength $importable]
121 }
122
123 proc ::vc::cvs::ws::isadmin {path} {
124 # Check if path is a CVS admin file.
125 if {[string match CVS/* $path]} {return 1}
126 if {[string match */CVS/* $path]} {return 1}
127 return 0
128 }
129
130 proc ::vc::cvs::ws::parentOf {id} { csets::parentOf $id }
131
132 proc ::vc::cvs::ws::checkout {id} {
133 variable workspace
134 cd $workspace
135
136 # TODO: Hide the direct access to the data structures behind
137 # TODO: accessors for date, cmsg, removed, added, changed, and
138 # TODO: author
139 array set cs [csets::get $id]
140
141 write 1 cvs "@ $cs(date)"
142 ::foreach l [split [string trim $cs(cmsg)] \n] {
143 write 1 cvs "| $l"
@@ -264,81 +276,52 @@
276
277 # Building the revision tree from the changesets.
278 # Limitation: Currently only trunk csets is handled.
279 # Limitation: Dead files are not removed, i.e. no 'R' actions right now.
280
281 proc ::vc::cvs::ws::ProcessBranches {} {
282 variable importable
283
284 write 0 cvs "Organizing the changesets into branches"
285
286 set remainder [ProcessTrunk]
287 # TODO: Processing non-trunk branches
288
289
290 # Status information ...
291 set nr [llength $remainder]
292 set ni [llength $importable]
293 set fmt %[string length [csets::num]]s
294
295 write 0 cvs "Unprocessed: [format $fmt $nr] [SIPL $nr changeset] (Will be ignored)"
296 write 0 cvs "To import: [format $fmt $ni] [SIPL $ni changeset]"
297 return
298 }
299
300 proc ::vc::cvs::ws::ProcessTrunk {} {
301 variable importable
302
303 write 0 cvs "Processing the trunk changesets"
304
305 set remainder {}
306 set t 0
307 set n [csets::num]
308 set parent {}
309
310 for {set c 0} {$c < $n} {incr c} {
311 if {[csets::isTrunk $c]} {
312 csets::setParentOf $c $parent
313 set parent $c
314 incr t
315 lappend importable $c
316 } else {
317 lappend remainder $c
318 }
319 }
320
321 write 0 cvs "Found [NSIPL $t {trunk changeset}], [NSIPL [llength $remainder] {branch changeset}]"
322 return $remainder
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
323 }
324
325 proc ::vc::cvs::ws::Checkout {f r} {
326 variable base
327 variable project
@@ -401,17 +384,19 @@
384 }
385
386 # -----------------------------------------------------------------------------
387
388 namespace eval ::vc::cvs::ws {
389 variable base {} ; # Toplevel repository directory
390 variable project {} ; # Sub directory to limit the import to.
391 variable workspace {} ; # Directory to checkout changesets to.
392 variable importable {} ; # List of the csets which can be imported.
393
394 namespace export configure begin done foreach ncsets nimportable checkout
395 namespace export parentOf
396 }
397
398 # -----------------------------------------------------------------------------
399 # Ready
400
401 package provide vc::cvs::ws 1.0
402 return
403
--- tools/lib/cvs_csets.tcl
+++ tools/lib/cvs_csets.tcl
@@ -20,10 +20,11 @@
2020
2121
# -----------------------------------------------------------------------------
2222
# API Implementation
2323
2424
proc ::vc::cvs::ws::csets::init {} {
25
+ variable ncs 0
2526
Current::Clear
2627
return
2728
}
2829
2930
proc ::vc::cvs::ws::csets::add {date file revision operation author cmsg} {
@@ -48,10 +49,28 @@
4849
4950
proc ::vc::cvs::ws::csets::num {} {
5051
variable csets
5152
return [array size csets]
5253
}
54
+
55
+proc ::vc::cvs::ws::csets::isTrunk {id} {
56
+ variable csets
57
+ array set cs $csets($id)
58
+ return [expr {$cs(lastd) == 2}]
59
+}
60
+
61
+proc ::vc::cvs::ws::csets::setParentOf {id parent} {
62
+ variable csets
63
+ lappend csets($id) parent $parent
64
+ return
65
+}
66
+
67
+proc ::vc::cvs::ws::csets::parentOf {id} {
68
+ variable csets
69
+ array set cs $csets($id)
70
+ return $cs(parent)
71
+}
5372
5473
# -----------------------------------------------------------------------------
5574
# Internal helper commands: Changeset inspection and construction.
5675
5776
proc ::vc::cvs::ws::csets::Save {data} {
@@ -196,13 +215,13 @@
196215
variable changed {} ; # file -> revision of modified files.
197216
variable files
198217
array set files {} ; # file -> revision
199218
}
200219
201
- namespace export init add done get num
220
+ namespace export init add done get num isTrunk setParentOf parentOf
202221
}
203222
204223
# -----------------------------------------------------------------------------
205224
# Ready
206225
207226
package provide vc::cvs::ws::csets 1.0
208227
return
209228
--- tools/lib/cvs_csets.tcl
+++ tools/lib/cvs_csets.tcl
@@ -20,10 +20,11 @@
20
21 # -----------------------------------------------------------------------------
22 # API Implementation
23
24 proc ::vc::cvs::ws::csets::init {} {
 
25 Current::Clear
26 return
27 }
28
29 proc ::vc::cvs::ws::csets::add {date file revision operation author cmsg} {
@@ -48,10 +49,28 @@
48
49 proc ::vc::cvs::ws::csets::num {} {
50 variable csets
51 return [array size csets]
52 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
54 # -----------------------------------------------------------------------------
55 # Internal helper commands: Changeset inspection and construction.
56
57 proc ::vc::cvs::ws::csets::Save {data} {
@@ -196,13 +215,13 @@
196 variable changed {} ; # file -> revision of modified files.
197 variable files
198 array set files {} ; # file -> revision
199 }
200
201 namespace export init add done get num
202 }
203
204 # -----------------------------------------------------------------------------
205 # Ready
206
207 package provide vc::cvs::ws::csets 1.0
208 return
209
--- tools/lib/cvs_csets.tcl
+++ tools/lib/cvs_csets.tcl
@@ -20,10 +20,11 @@
20
21 # -----------------------------------------------------------------------------
22 # API Implementation
23
24 proc ::vc::cvs::ws::csets::init {} {
25 variable ncs 0
26 Current::Clear
27 return
28 }
29
30 proc ::vc::cvs::ws::csets::add {date file revision operation author cmsg} {
@@ -48,10 +49,28 @@
49
50 proc ::vc::cvs::ws::csets::num {} {
51 variable csets
52 return [array size csets]
53 }
54
55 proc ::vc::cvs::ws::csets::isTrunk {id} {
56 variable csets
57 array set cs $csets($id)
58 return [expr {$cs(lastd) == 2}]
59 }
60
61 proc ::vc::cvs::ws::csets::setParentOf {id parent} {
62 variable csets
63 lappend csets($id) parent $parent
64 return
65 }
66
67 proc ::vc::cvs::ws::csets::parentOf {id} {
68 variable csets
69 array set cs $csets($id)
70 return $cs(parent)
71 }
72
73 # -----------------------------------------------------------------------------
74 # Internal helper commands: Changeset inspection and construction.
75
76 proc ::vc::cvs::ws::csets::Save {data} {
@@ -196,13 +215,13 @@
215 variable changed {} ; # file -> revision of modified files.
216 variable files
217 array set files {} ; # file -> revision
218 }
219
220 namespace export init add done get num isTrunk setParentOf parentOf
221 }
222
223 # -----------------------------------------------------------------------------
224 # Ready
225
226 package provide vc::cvs::ws::csets 1.0
227 return
228
--- tools/lib/fossil.tcl
+++ tools/lib/fossil.tcl
@@ -19,10 +19,11 @@
1919
# API
2020
2121
# vc::fossil::ws::configure key value - Configure the subsystem.
2222
# vc::fossil::ws::begin src - Start new workspace for directory
2323
# vc::fossil::ws::done dst - Close workspace and copy to destination.
24
+# vc::fossil::ws::setup uuid - Move workspace to an older revision.
2425
# vc::fossil::ws::commit cset usr time msg - Look for changes and commit as new revision.
2526
2627
# Configuration keys:
2728
#
2829
# -nosign bool default 0 (= sign imported changesets)
@@ -80,10 +81,19 @@
8081
variable rp
8182
file rename -force $rp $destination
8283
set rp {}
8384
return
8485
}
86
+
87
+proc ::vc::fossil::ws::setup {uuid} {
88
+ variable lastuuid
89
+ if {$uuid eq $lastuuid} return
90
+ write 1 fossil "=> goto $uuid"
91
+ dova update $uuid
92
+ set lastuuid $uuid
93
+ return
94
+}
8595
8696
proc ::vc::fossil::ws::commit {cset user timestamp message} {
8797
variable lastuuid
8898
variable base
8999
@@ -209,13 +219,13 @@
209219
210220
variable base {} ; # Workspace directory
211221
variable rp {} ; # Repository the package works on.
212222
variable lastuuid {} ; # Uuid of last imported changeset.
213223
214
- namespace export configure begin done commit
224
+ namespace export configure begin done setup commit
215225
}
216226
217227
# -----------------------------------------------------------------------------
218228
# Ready
219229
220230
package provide vc::fossil::ws 1.0
221231
return
222232
--- tools/lib/fossil.tcl
+++ tools/lib/fossil.tcl
@@ -19,10 +19,11 @@
19 # API
20
21 # vc::fossil::ws::configure key value - Configure the subsystem.
22 # vc::fossil::ws::begin src - Start new workspace for directory
23 # vc::fossil::ws::done dst - Close workspace and copy to destination.
 
24 # vc::fossil::ws::commit cset usr time msg - Look for changes and commit as new revision.
25
26 # Configuration keys:
27 #
28 # -nosign bool default 0 (= sign imported changesets)
@@ -80,10 +81,19 @@
80 variable rp
81 file rename -force $rp $destination
82 set rp {}
83 return
84 }
 
 
 
 
 
 
 
 
 
85
86 proc ::vc::fossil::ws::commit {cset user timestamp message} {
87 variable lastuuid
88 variable base
89
@@ -209,13 +219,13 @@
209
210 variable base {} ; # Workspace directory
211 variable rp {} ; # Repository the package works on.
212 variable lastuuid {} ; # Uuid of last imported changeset.
213
214 namespace export configure begin done commit
215 }
216
217 # -----------------------------------------------------------------------------
218 # Ready
219
220 package provide vc::fossil::ws 1.0
221 return
222
--- tools/lib/fossil.tcl
+++ tools/lib/fossil.tcl
@@ -19,10 +19,11 @@
19 # API
20
21 # vc::fossil::ws::configure key value - Configure the subsystem.
22 # vc::fossil::ws::begin src - Start new workspace for directory
23 # vc::fossil::ws::done dst - Close workspace and copy to destination.
24 # vc::fossil::ws::setup uuid - Move workspace to an older revision.
25 # vc::fossil::ws::commit cset usr time msg - Look for changes and commit as new revision.
26
27 # Configuration keys:
28 #
29 # -nosign bool default 0 (= sign imported changesets)
@@ -80,10 +81,19 @@
81 variable rp
82 file rename -force $rp $destination
83 set rp {}
84 return
85 }
86
87 proc ::vc::fossil::ws::setup {uuid} {
88 variable lastuuid
89 if {$uuid eq $lastuuid} return
90 write 1 fossil "=> goto $uuid"
91 dova update $uuid
92 set lastuuid $uuid
93 return
94 }
95
96 proc ::vc::fossil::ws::commit {cset user timestamp message} {
97 variable lastuuid
98 variable base
99
@@ -209,13 +219,13 @@
219
220 variable base {} ; # Workspace directory
221 variable rp {} ; # Repository the package works on.
222 variable lastuuid {} ; # Uuid of last imported changeset.
223
224 namespace export configure begin done setup commit
225 }
226
227 # -----------------------------------------------------------------------------
228 # Ready
229
230 package provide vc::fossil::ws 1.0
231 return
232
--- tools/lib/importcvs.tcl
+++ tools/lib/importcvs.tcl
@@ -60,18 +60,18 @@
6060
6161
# Import the CVS repository found at directory 'src' into the new
6262
# fossil repository at 'dst'.
6363
6464
proc ::vc::fossil::import::cvs::run {src dst} {
65
- #B map::set {} {}
65
+ map::set {} {}
6666
6767
set src [file normalize $src]
6868
set dst [file normalize $dst]
6969
7070
set ws [cvs::begin $src]
7171
fossil::begin $ws
72
- stats::setup [cvs::ncsets -import] [cvs::ncsets]
72
+ stats::setup [cvs::nimportable] [cvs::ncsets]
7373
7474
cvs::foreach cset {
7575
Import1 $cset
7676
}
7777
@@ -95,11 +95,11 @@
9595
stats::csend $seconds
9696
return
9797
}
9898
9999
proc ::vc::fossil::import::cvs::ImportCS {cset} {
100
- #B fossil::setup [map::get [cvs::parentOf $cset]]
100
+ fossil::setup [map::get [cvs::parentOf $cset]]
101101
lassign [cvs::checkout $cset] user timestamp message
102102
lassign [fossil::commit $cset $user $timestamp $message] uuid ad rm ch
103103
write 2 import "== +${ad}-${rm}*${ch}"
104104
map::set $cset $uuid
105105
return
106106
--- tools/lib/importcvs.tcl
+++ tools/lib/importcvs.tcl
@@ -60,18 +60,18 @@
60
61 # Import the CVS repository found at directory 'src' into the new
62 # fossil repository at 'dst'.
63
64 proc ::vc::fossil::import::cvs::run {src dst} {
65 #B map::set {} {}
66
67 set src [file normalize $src]
68 set dst [file normalize $dst]
69
70 set ws [cvs::begin $src]
71 fossil::begin $ws
72 stats::setup [cvs::ncsets -import] [cvs::ncsets]
73
74 cvs::foreach cset {
75 Import1 $cset
76 }
77
@@ -95,11 +95,11 @@
95 stats::csend $seconds
96 return
97 }
98
99 proc ::vc::fossil::import::cvs::ImportCS {cset} {
100 #B fossil::setup [map::get [cvs::parentOf $cset]]
101 lassign [cvs::checkout $cset] user timestamp message
102 lassign [fossil::commit $cset $user $timestamp $message] uuid ad rm ch
103 write 2 import "== +${ad}-${rm}*${ch}"
104 map::set $cset $uuid
105 return
106
--- tools/lib/importcvs.tcl
+++ tools/lib/importcvs.tcl
@@ -60,18 +60,18 @@
60
61 # Import the CVS repository found at directory 'src' into the new
62 # fossil repository at 'dst'.
63
64 proc ::vc::fossil::import::cvs::run {src dst} {
65 map::set {} {}
66
67 set src [file normalize $src]
68 set dst [file normalize $dst]
69
70 set ws [cvs::begin $src]
71 fossil::begin $ws
72 stats::setup [cvs::nimportable] [cvs::ncsets]
73
74 cvs::foreach cset {
75 Import1 $cset
76 }
77
@@ -95,11 +95,11 @@
95 stats::csend $seconds
96 return
97 }
98
99 proc ::vc::fossil::import::cvs::ImportCS {cset} {
100 fossil::setup [map::get [cvs::parentOf $cset]]
101 lassign [cvs::checkout $cset] user timestamp message
102 lassign [fossil::commit $cset $user $timestamp $message] uuid ad rm ch
103 write 2 import "== +${ad}-${rm}*${ch}"
104 map::set $cset $uuid
105 return
106

Keyboard Shortcuts

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