Fossil SCM

Continued work on pass II, skeleton of it completed by adding outline of code for persistence.

aku 2007-10-06 21:19 trunk
Commit 6d1811d61ed770880dd6940b6323e71c1fa09f8a
--- tools/cvs2fossil/lib/c2f_file.tcl
+++ tools/cvs2fossil/lib/c2f_file.tcl
@@ -35,20 +35,23 @@
3535
method path {} { return $mypath }
3636
3737
# # ## ### ##### ######## #############
3838
## Methods required for the class to be a sink of the rcs parser
3939
40
- method begin {} {}
41
- method sethead {h} {}
42
- method setprincipalbranch {b} {}
43
- method setsymbols {dict} {}
44
- method setcomment {c} {}
40
+ method begin {} {}
41
+ method done {} {}
4542
method admindone {} {}
46
- method def {rev date author state next branches} {}
47
- method setdesc {d} {}
43
+
44
+ method sethead {h} {}
45
+ method setprincipalbranch {b} {}
46
+
47
+ method setsymbols {dict} {}
48
+ method setcomment {c} {}
49
+ method setdesc {d} {}
50
+
51
+ method def {rev date author state next branches} {}
4852
method extend {rev commitmsg deltarange} {}
49
- method done {} {}
5053
5154
#method begin {} {puts begin}
5255
#method sethead {h} {puts head=$h}
5356
#method setprincipalbranch {b} {puts pb=$b}
5457
#method setsymbols {dict} {puts symbols=$dict}
@@ -57,10 +60,17 @@
5760
#method def {rev date author state next branches} {puts "def $rev $date $author $state $next $branches"}
5861
#method setdesc {d} {puts desc=$d}
5962
#method extend {rev commitmsg deltarange} {puts "extend $commitmsg $deltarange"}
6063
#method done {} {puts done}
6164
65
+
66
+ # # ## ### ##### ######## #############
67
+ ## Persistence (pass II)
68
+
69
+ method persist {} {
70
+ }
71
+
6272
# # ## ### ##### ######## #############
6373
## State
6474
6575
variable mypath {} ; # Path of rcs archive
6676
variable myproject {} ; # Project object the file belongs to.
6777
--- tools/cvs2fossil/lib/c2f_file.tcl
+++ tools/cvs2fossil/lib/c2f_file.tcl
@@ -35,20 +35,23 @@
35 method path {} { return $mypath }
36
37 # # ## ### ##### ######## #############
38 ## Methods required for the class to be a sink of the rcs parser
39
40 method begin {} {}
41 method sethead {h} {}
42 method setprincipalbranch {b} {}
43 method setsymbols {dict} {}
44 method setcomment {c} {}
45 method admindone {} {}
46 method def {rev date author state next branches} {}
47 method setdesc {d} {}
 
 
 
 
 
 
 
48 method extend {rev commitmsg deltarange} {}
49 method done {} {}
50
51 #method begin {} {puts begin}
52 #method sethead {h} {puts head=$h}
53 #method setprincipalbranch {b} {puts pb=$b}
54 #method setsymbols {dict} {puts symbols=$dict}
@@ -57,10 +60,17 @@
57 #method def {rev date author state next branches} {puts "def $rev $date $author $state $next $branches"}
58 #method setdesc {d} {puts desc=$d}
59 #method extend {rev commitmsg deltarange} {puts "extend $commitmsg $deltarange"}
60 #method done {} {puts done}
61
 
 
 
 
 
 
 
62 # # ## ### ##### ######## #############
63 ## State
64
65 variable mypath {} ; # Path of rcs archive
66 variable myproject {} ; # Project object the file belongs to.
67
--- tools/cvs2fossil/lib/c2f_file.tcl
+++ tools/cvs2fossil/lib/c2f_file.tcl
@@ -35,20 +35,23 @@
35 method path {} { return $mypath }
36
37 # # ## ### ##### ######## #############
38 ## Methods required for the class to be a sink of the rcs parser
39
40 method begin {} {}
41 method done {} {}
 
 
 
42 method admindone {} {}
43
44 method sethead {h} {}
45 method setprincipalbranch {b} {}
46
47 method setsymbols {dict} {}
48 method setcomment {c} {}
49 method setdesc {d} {}
50
51 method def {rev date author state next branches} {}
52 method extend {rev commitmsg deltarange} {}
 
53
54 #method begin {} {puts begin}
55 #method sethead {h} {puts head=$h}
56 #method setprincipalbranch {b} {puts pb=$b}
57 #method setsymbols {dict} {puts symbols=$dict}
@@ -57,10 +60,17 @@
60 #method def {rev date author state next branches} {puts "def $rev $date $author $state $next $branches"}
61 #method setdesc {d} {puts desc=$d}
62 #method extend {rev commitmsg deltarange} {puts "extend $commitmsg $deltarange"}
63 #method done {} {puts done}
64
65
66 # # ## ### ##### ######## #############
67 ## Persistence (pass II)
68
69 method persist {} {
70 }
71
72 # # ## ### ##### ######## #############
73 ## State
74
75 variable mypath {} ; # Path of rcs archive
76 variable myproject {} ; # Project object the file belongs to.
77
--- tools/cvs2fossil/lib/c2f_project.tcl
+++ tools/cvs2fossil/lib/c2f_project.tcl
@@ -48,17 +48,14 @@
4848
return [lsort -dict [array names myfiles]]
4949
}
5050
5151
method files {} {
5252
# TODO: Loading from state
53
- set res {}
54
- foreach f [lsort -dict [array names myfiles]] {
55
- lappend res [file %AUTO% $f $self]
56
- }
57
- return $res
53
+ return [TheFiles]
5854
}
5955
56
+ # pass I persistence
6057
method persist {} {
6158
state transaction {
6259
# Project data first. Required so that we have its id
6360
# ready for the files.
6461
@@ -78,19 +75,51 @@
7875
}
7976
}
8077
}
8178
return
8279
}
80
+
81
+ # pass II persistence
82
+ method persistrev {} {
83
+ state transaction {
84
+ # TODO: per project persistence (symbols, meta data)
85
+ foreach f [TheFiles] {
86
+ $f persist
87
+ }
88
+ }
89
+ return
90
+ }
8391
8492
# # ## ### ##### ######## #############
8593
## State
8694
8795
variable mybase {} ; # Project directory
8896
variable myfiles -array {} ; # Maps rcs archive to their user files.
97
+ variable myfobj {} ; # File objects for the rcs archives
8998
9099
# # ## ### ##### ######## #############
91100
## Internal methods
101
+
102
+ proc TheFiles {} {
103
+ upvar 1 myfiles myfiles myfobj myfobj self self
104
+ if {![llength $myfobj]} {
105
+ set myfobj [EmptyFiles myfiles]
106
+ }
107
+ return $myfobj
108
+ }
109
+
110
+ proc EmptyFiles {fv} {
111
+ upvar 1 $fv myfiles self self
112
+ set res {}
113
+ foreach f [lsort -dict [array names myfiles]] {
114
+ lappend res [file %AUTO% $f $self]
115
+ }
116
+ return $res
117
+ }
118
+
119
+ # # ## ### ##### ######## #############
120
+ ## Configuration
92121
93122
pragma -hastypeinfo no ; # no type introspection
94123
pragma -hasinfo no ; # no object introspection
95124
pragma -hastypemethods no ; # type is not relevant.
96125
pragma -simpledispatch yes ; # simple fast dispatch
97126
--- tools/cvs2fossil/lib/c2f_project.tcl
+++ tools/cvs2fossil/lib/c2f_project.tcl
@@ -48,17 +48,14 @@
48 return [lsort -dict [array names myfiles]]
49 }
50
51 method files {} {
52 # TODO: Loading from state
53 set res {}
54 foreach f [lsort -dict [array names myfiles]] {
55 lappend res [file %AUTO% $f $self]
56 }
57 return $res
58 }
59
 
60 method persist {} {
61 state transaction {
62 # Project data first. Required so that we have its id
63 # ready for the files.
64
@@ -78,19 +75,51 @@
78 }
79 }
80 }
81 return
82 }
 
 
 
 
 
 
 
 
 
 
 
83
84 # # ## ### ##### ######## #############
85 ## State
86
87 variable mybase {} ; # Project directory
88 variable myfiles -array {} ; # Maps rcs archive to their user files.
 
89
90 # # ## ### ##### ######## #############
91 ## Internal methods
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
92
93 pragma -hastypeinfo no ; # no type introspection
94 pragma -hasinfo no ; # no object introspection
95 pragma -hastypemethods no ; # type is not relevant.
96 pragma -simpledispatch yes ; # simple fast dispatch
97
--- tools/cvs2fossil/lib/c2f_project.tcl
+++ tools/cvs2fossil/lib/c2f_project.tcl
@@ -48,17 +48,14 @@
48 return [lsort -dict [array names myfiles]]
49 }
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
60 # ready for the files.
61
@@ -78,19 +75,51 @@
75 }
76 }
77 }
78 return
79 }
80
81 # pass II persistence
82 method persistrev {} {
83 state transaction {
84 # TODO: per project persistence (symbols, meta data)
85 foreach f [TheFiles] {
86 $f persist
87 }
88 }
89 return
90 }
91
92 # # ## ### ##### ######## #############
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 {} {
103 upvar 1 myfiles myfiles myfobj myfobj self self
104 if {![llength $myfobj]} {
105 set myfobj [EmptyFiles myfiles]
106 }
107 return $myfobj
108 }
109
110 proc EmptyFiles {fv} {
111 upvar 1 $fv myfiles self self
112 set res {}
113 foreach f [lsort -dict [array names myfiles]] {
114 lappend res [file %AUTO% $f $self]
115 }
116 return $res
117 }
118
119 # # ## ### ##### ######## #############
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
--- tools/cvs2fossil/lib/c2f_repository.tcl
+++ tools/cvs2fossil/lib/c2f_repository.tcl
@@ -71,10 +71,11 @@
7171
}
7272
}
7373
return
7474
}
7575
76
+ # pass I results
7677
typemethod printstatistics {} {
7778
set prlist [TheProjects]
7879
set npr [llength $prlist]
7980
8081
log write 2 repository "Scanned [nsp $npr project]"
@@ -115,14 +116,31 @@
115116
# Keep reduced set of projects.
116117
set projects $keep
117118
return
118119
}
119120
121
+ # pass I persistence
120122
typemethod persist {} {
121123
state transaction {
122124
foreach p [TheProjects] { $p persist }
123125
}
126
+ return
127
+ }
128
+
129
+ # pass II results
130
+ typemethod printrevstatistics {} {
131
+ log write 2 repository "Scanned ..."
132
+ # number of revisions, symbols, repository wide, per project ...
133
+ return
134
+ }
135
+
136
+ # pass II persistence
137
+ typemethod persistrev {} {
138
+ state transaction {
139
+ # TODO: per repository persistence (authors, commit messages)
140
+ foreach p [TheProjects] { $p persistrev }
141
+ }
124142
return
125143
}
126144
127145
# # ## ### ##### ######## #############
128146
## State
129147
--- tools/cvs2fossil/lib/c2f_repository.tcl
+++ tools/cvs2fossil/lib/c2f_repository.tcl
@@ -71,10 +71,11 @@
71 }
72 }
73 return
74 }
75
 
76 typemethod printstatistics {} {
77 set prlist [TheProjects]
78 set npr [llength $prlist]
79
80 log write 2 repository "Scanned [nsp $npr project]"
@@ -115,14 +116,31 @@
115 # Keep reduced set of projects.
116 set projects $keep
117 return
118 }
119
 
120 typemethod persist {} {
121 state transaction {
122 foreach p [TheProjects] { $p persist }
123 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
124 return
125 }
126
127 # # ## ### ##### ######## #############
128 ## State
129
--- tools/cvs2fossil/lib/c2f_repository.tcl
+++ tools/cvs2fossil/lib/c2f_repository.tcl
@@ -71,10 +71,11 @@
71 }
72 }
73 return
74 }
75
76 # pass I results
77 typemethod printstatistics {} {
78 set prlist [TheProjects]
79 set npr [llength $prlist]
80
81 log write 2 repository "Scanned [nsp $npr project]"
@@ -115,14 +116,31 @@
116 # Keep reduced set of projects.
117 set projects $keep
118 return
119 }
120
121 # pass I persistence
122 typemethod persist {} {
123 state transaction {
124 foreach p [TheProjects] { $p persist }
125 }
126 return
127 }
128
129 # pass II results
130 typemethod printrevstatistics {} {
131 log write 2 repository "Scanned ..."
132 # number of revisions, symbols, repository wide, per project ...
133 return
134 }
135
136 # pass II persistence
137 typemethod persistrev {} {
138 state transaction {
139 # TODO: per repository persistence (authors, commit messages)
140 foreach p [TheProjects] { $p persistrev }
141 }
142 return
143 }
144
145 # # ## ### ##### ######## #############
146 ## State
147

Keyboard Shortcuts

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