Mercurial > hg-stable
changeset 7593:9811cc670c51
cvsps: cvs log loop uses lookahead to avoid misleading text
Changes cvsps.py's cvs log reader to use a one-line lookahead, so
that possibly misleading log messages can be disambiguated. In
particular I have past committers who used cvs log's 28-character
row of hyphens within commit messages; this throws cvsps and disrupts
conversion. The only alternative in this case is to edit the cvs
,v file by hand, which bloodies mercurial's "don't change history"
principle.
author | David Champion <dgc@uchicago.edu> |
---|---|
date | Sun, 04 Jan 2009 01:43:12 -0600 |
parents | 75ad51257c82 |
children | a204547790bc |
files | hgext/convert/cvsps.py |
diffstat | 1 files changed, 8 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/convert/cvsps.py Sun Jan 04 18:44:39 2009 +0100 +++ b/hgext/convert/cvsps.py Sun Jan 04 01:43:12 2009 -0600 @@ -191,7 +191,13 @@ ui.note(_("running %s\n") % (' '.join(cmd))) ui.debug(_("prefix=%r directory=%r root=%r\n") % (prefix, directory, root)) - for line in util.popen(' '.join(cmd)): + pfp = util.popen(' '.join(cmd)) + peek = pfp.readline() + while True: + line = peek + if line == '': + break + peek = pfp.readline() if line.endswith('\n'): line = line[:-1] #ui.debug('state=%d line=%r\n' % (state, line)) @@ -312,7 +318,7 @@ e.branches = [tuple([int(y) for y in x.strip().split('.')]) for x in m.group(1).split(';')] state = 8 - elif re_31.match(line): + elif re_31.match(line) and re_50.match(peek): state = 5 store = True elif re_32.match(line):