[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: cvs2svn.py fails converting repository with the attached file

From: Greg Stein <gstein_at_lyra.org>
Date: 2003-06-27 03:23:26 CEST

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.

> 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() :-)

Something like:

  semi, author, sym = self.ts.mget(3)
  if sym != 'author':
    raise RCSExpected(sym, 'author')
  if semi != ';':
    ### some comment goes here about how broken the file is that we're
    ### reading, but we'll be Nice People and give it a shot.
    author = author + ' ' + semi
    semi = self.ts.get()
    if semi != ';':
      raise RCSExpected(semi, ';')
  
  # Parse state
  ...

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri Jun 27 03:18:48 2003

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.