Fossil SCM

Extended the RCS parser to handle extended (aka new) phrases coming after the regular data of a revision, in the revision tree.

aku 2007-10-19 07:22 trunk
Commit 294156a36f7e4b6b6c1a3aef8ffc6400c6b7df5a
--- tools/cvs2fossil/lib/rcsparser.tcl
+++ tools/cvs2fossil/lib/rcsparser.tcl
@@ -119,17 +119,39 @@
119119
}
120120
121121
# # ## ### ##### ######## #############
122122
123123
proc Deltas {} {
124
- while {[OptionalNumber -> rev]} {
124
+ set ok [OptionalNumber -> rev]
125
+ while {$ok} {
125126
Date -> d
126127
Author -> a
127128
State -> s
128129
Branches -> b
129130
NextRev -> n
130131
Call def $rev $d $a $s $n $b
132
+
133
+ # Check if this is followed by a revision number or the
134
+ # literal 'desc'. If neither we consume whatever is there
135
+ # until the next semicolon, as it has to be a 'new
136
+ # phrase'. Otherwise, for a revision number we loop back
137
+ # and consume that revision, and lastly for 'desc' we stop
138
+ # completely as this signals the end of the revision tree
139
+ # and the beginning of the deltas.
140
+
141
+ while {1} {
142
+ set ok [OptionalNumber -> rev]
143
+ if {$ok} break
144
+
145
+ if {[LiteralPeek desc]} {
146
+ set ok 0
147
+ break
148
+ }
149
+
150
+ Anything -> dummy
151
+ Semicolon
152
+ }
131153
}
132154
Call defdone
133155
return
134156
}
135157
@@ -237,10 +259,22 @@
237259
if {!$ok} { return 0 }
238260
239261
SkipOver match
240262
return 1
241263
}
264
+
265
+ proc LiteralPeek {name} {
266
+ ::variable mydata
267
+ ::variable mypos
268
+
269
+ set pattern "\\A\\s*$name\\s*"
270
+ set ok [regexp -start $mypos -indices -- $pattern $mydata match]
271
+ if {!$ok} { return 0 }
272
+
273
+ # NO - SkipOver match - Only looking ahead here.
274
+ return 1
275
+ }
242276
243277
proc RequiredNumber {_ v} {
244278
upvar 1 $v value
245279
::variable mydata
246280
::variable mypos
247281
--- tools/cvs2fossil/lib/rcsparser.tcl
+++ tools/cvs2fossil/lib/rcsparser.tcl
@@ -119,17 +119,39 @@
119 }
120
121 # # ## ### ##### ######## #############
122
123 proc Deltas {} {
124 while {[OptionalNumber -> rev]} {
 
125 Date -> d
126 Author -> a
127 State -> s
128 Branches -> b
129 NextRev -> n
130 Call def $rev $d $a $s $n $b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
131 }
132 Call defdone
133 return
134 }
135
@@ -237,10 +259,22 @@
237 if {!$ok} { return 0 }
238
239 SkipOver match
240 return 1
241 }
 
 
 
 
 
 
 
 
 
 
 
 
242
243 proc RequiredNumber {_ v} {
244 upvar 1 $v value
245 ::variable mydata
246 ::variable mypos
247
--- tools/cvs2fossil/lib/rcsparser.tcl
+++ tools/cvs2fossil/lib/rcsparser.tcl
@@ -119,17 +119,39 @@
119 }
120
121 # # ## ### ##### ######## #############
122
123 proc Deltas {} {
124 set ok [OptionalNumber -> rev]
125 while {$ok} {
126 Date -> d
127 Author -> a
128 State -> s
129 Branches -> b
130 NextRev -> n
131 Call def $rev $d $a $s $n $b
132
133 # Check if this is followed by a revision number or the
134 # literal 'desc'. If neither we consume whatever is there
135 # until the next semicolon, as it has to be a 'new
136 # phrase'. Otherwise, for a revision number we loop back
137 # and consume that revision, and lastly for 'desc' we stop
138 # completely as this signals the end of the revision tree
139 # and the beginning of the deltas.
140
141 while {1} {
142 set ok [OptionalNumber -> rev]
143 if {$ok} break
144
145 if {[LiteralPeek desc]} {
146 set ok 0
147 break
148 }
149
150 Anything -> dummy
151 Semicolon
152 }
153 }
154 Call defdone
155 return
156 }
157
@@ -237,10 +259,22 @@
259 if {!$ok} { return 0 }
260
261 SkipOver match
262 return 1
263 }
264
265 proc LiteralPeek {name} {
266 ::variable mydata
267 ::variable mypos
268
269 set pattern "\\A\\s*$name\\s*"
270 set ok [regexp -start $mypos -indices -- $pattern $mydata match]
271 if {!$ok} { return 0 }
272
273 # NO - SkipOver match - Only looking ahead here.
274 return 1
275 }
276
277 proc RequiredNumber {_ v} {
278 upvar 1 $v value
279 ::variable mydata
280 ::variable mypos
281

Keyboard Shortcuts

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