comparison hgext/convert/cvsps.py @ 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 8bea01a65391
children 49355875c805
comparison
equal deleted inserted replaced
7592:75ad51257c82 7593:9811cc670c51
189 189
190 cmd = [util.shellquote(arg) for arg in cmd] 190 cmd = [util.shellquote(arg) for arg in cmd]
191 ui.note(_("running %s\n") % (' '.join(cmd))) 191 ui.note(_("running %s\n") % (' '.join(cmd)))
192 ui.debug(_("prefix=%r directory=%r root=%r\n") % (prefix, directory, root)) 192 ui.debug(_("prefix=%r directory=%r root=%r\n") % (prefix, directory, root))
193 193
194 for line in util.popen(' '.join(cmd)): 194 pfp = util.popen(' '.join(cmd))
195 peek = pfp.readline()
196 while True:
197 line = peek
198 if line == '':
199 break
200 peek = pfp.readline()
195 if line.endswith('\n'): 201 if line.endswith('\n'):
196 line = line[:-1] 202 line = line[:-1]
197 #ui.debug('state=%d line=%r\n' % (state, line)) 203 #ui.debug('state=%d line=%r\n' % (state, line))
198 204
199 if state == 0: 205 if state == 0:
310 m = re_70.match(line) 316 m = re_70.match(line)
311 if m: 317 if m:
312 e.branches = [tuple([int(y) for y in x.strip().split('.')]) 318 e.branches = [tuple([int(y) for y in x.strip().split('.')])
313 for x in m.group(1).split(';')] 319 for x in m.group(1).split(';')]
314 state = 8 320 state = 8
315 elif re_31.match(line): 321 elif re_31.match(line) and re_50.match(peek):
316 state = 5 322 state = 5
317 store = True 323 store = True
318 elif re_32.match(line): 324 elif re_32.match(line):
319 state = 0 325 state = 0
320 store = True 326 store = True