Fossil SCM
Extended the RCS parser to handle extended (aka new) phrases coming after the regular data of a revision, in the revision tree.
Commit
294156a36f7e4b6b6c1a3aef8ffc6400c6b7df5a
Parent
cfe4b269ac5ef7e…
1 file changed
+35
-1
+35
-1
| --- tools/cvs2fossil/lib/rcsparser.tcl | ||
| +++ tools/cvs2fossil/lib/rcsparser.tcl | ||
| @@ -119,17 +119,39 @@ | ||
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | # # ## ### ##### ######## ############# |
| 122 | 122 | |
| 123 | 123 | proc Deltas {} { |
| 124 | - while {[OptionalNumber -> rev]} { | |
| 124 | + set ok [OptionalNumber -> rev] | |
| 125 | + while {$ok} { | |
| 125 | 126 | Date -> d |
| 126 | 127 | Author -> a |
| 127 | 128 | State -> s |
| 128 | 129 | Branches -> b |
| 129 | 130 | NextRev -> n |
| 130 | 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 | + } | |
| 131 | 153 | } |
| 132 | 154 | Call defdone |
| 133 | 155 | return |
| 134 | 156 | } |
| 135 | 157 | |
| @@ -237,10 +259,22 @@ | ||
| 237 | 259 | if {!$ok} { return 0 } |
| 238 | 260 | |
| 239 | 261 | SkipOver match |
| 240 | 262 | return 1 |
| 241 | 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 | + } | |
| 242 | 276 | |
| 243 | 277 | proc RequiredNumber {_ v} { |
| 244 | 278 | upvar 1 $v value |
| 245 | 279 | ::variable mydata |
| 246 | 280 | ::variable mypos |
| 247 | 281 |
| --- 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 |