Check-in [294156a36f]
Not logged in
Overview

SHA1 Hash:294156a36f7e4b6b6c1a3aef8ffc6400c6b7df5a
Date: 2007-10-19 07:22:44
User: aku
Comment:Extended the RCS parser to handle extended (aka new) phrases coming after the regular data of a revision, in the revision tree.
Timelines: ancestors | descendants | both | trunk
Other Links: files | ZIP archive | manifest

Tags And Properties
Changes
[hide diffs]

Modified tools/cvs2fossil/lib/rcsparser.tcl from [fe220d9710] to [b7e70320c9].

@@ -119,17 +119,39 @@
     }
 
     # # ## ### ##### ######## #############
 
     proc Deltas {} {
-	while {[OptionalNumber -> rev]} {
+	set ok [OptionalNumber -> rev]
+	while {$ok} {
 	    Date     -> d
 	    Author   -> a
 	    State    -> s
 	    Branches -> b
 	    NextRev  -> n
 	    Call def $rev $d $a $s $n $b
+
+	    # Check if this is followed by a revision number or the
+	    # literal 'desc'. If neither we consume whatever is there
+	    # until the next semicolon, as it has to be a 'new
+	    # phrase'. Otherwise, for a revision number we loop back
+	    # and consume that revision, and lastly for 'desc' we stop
+	    # completely as this signals the end of the revision tree
+	    # and the beginning of the deltas.
+
+	    while {1} {
+		set ok [OptionalNumber -> rev]
+		if {$ok} break
+
+		if {[LiteralPeek desc]} {
+		    set ok 0
+		    break
+		}
+
+		Anything -> dummy
+		Semicolon
+	    }
 	}
 	Call defdone
 	return
     }
 
@@ -235,10 +257,22 @@
 	set pattern "\\A\\s*$name\\s*"
 	set ok [regexp -start $mypos -indices -- $pattern $mydata match]
 	if {!$ok} { return 0 }
 
 	SkipOver match
+	return 1
+    }
+
+    proc LiteralPeek {name} {
+	::variable mydata
+	::variable mypos
+
+	set pattern "\\A\\s*$name\\s*"
+	set ok [regexp -start $mypos -indices -- $pattern $mydata match]
+	if {!$ok} { return 0 }
+
+	# NO - SkipOver match - Only looking ahead here.
 	return 1
     }
 
     proc RequiredNumber {_ v} {
 	upvar 1 $v value