On Thu, Jun 26, 2003 at 06:23:26PM -0700, Greg Stein wrote:
> On Thu, Jun 26, 2003 at 01:15:49PM -0400, mark benedetto king wrote:
> >...
> > +++ tools/cvs2svn/rcsparse/common.py	Thu Jun 26 13:10:43 2003
> > @@ -153,11 +153,16 @@
> >        timestamp = compat.timegm(tuple(date_fields))
> >  
> >        # Parse author
> > -      semi, author, sym = self.ts.mget(3)
> > +      sym = self.ts.get()
> 
> We can optimistically grab all three tokens. If 'semi' is not a semicolon,
> then we can assume it is a second part for the author, append them, and grab
> another token looking for the semicolon.
> 
But my name is Mark Benedetto King. :-)
> >        if sym != 'author':
> >          raise RCSExpected(sym, 'author')
> > -      if semi != ';':
> > -        raise RCSExpected(semi, ';')
> > +      author = ''
> > +      while 1:
> > +        token = self.ts.get()
> > +        if token == ';':
> > +          break
> > +        author = author + token + ' '
> > +      author = author[:-1]
> 
> I would favor an assumption of a single extra token for the author, rather
> than an unbounded loop. Note that these loops are quite sensitive to
> performance, too. That was the whole purpose for introducing .mget() :-)
> 
I thought about that too; error messages like "unexpected EOF" aren't
very useful, when the real problem was corruption 10% into the file.
However, I noticed that the next few lines to parse the 'state' had
an unbounded loop of their own, so I figured, "when in Rome..."
--ben
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri Jun 27 16:48:17 2003