# HG changeset patch # User Christian Ebert # Date 1349977585 -7200 # Node ID 689f8b6b711c4415998dee93372ec492abc25f47 # Parent 2d9daef1e473005960545bda37456171866643d3# Parent cdabdd17f980e0290f93682d843759fa3ccc5db0 Merge with stable diff -r 2d9daef1e473 -r 689f8b6b711c tests/run-tests.py --- a/tests/run-tests.py Wed Oct 10 11:31:01 2012 +0200 +++ b/tests/run-tests.py Thu Oct 11 19:46:25 2012 +0200 @@ -283,21 +283,6 @@ shutil.copy(src, dst) os.remove(src) -def splitnewlines(text): - '''like str.splitlines, but only split on newlines. - keep line endings.''' - i = 0 - lines = [] - while True: - n = text.find('\n', i) - if n == -1: - last = text[i:] - if last: - lines.append(last) - return lines - lines.append(text[i:n + 1]) - i = n + 1 - def parsehghaveoutput(lines): '''Parse hghave log lines. Return tuple of lists (missing, failed): @@ -690,8 +675,7 @@ lout, lcmd = l.split(salt, 1) if lout: - if lcmd: - # output block had no trailing newline, clean up + if not lout.endswith('\n'): lout += ' (no-eol)\n' # find the expected output at the current position @@ -762,7 +746,7 @@ for s, r in replacements: output = re.sub(s, r, output) - return ret, splitnewlines(output) + return ret, output.splitlines(True) def runone(options, test): '''tristate output: @@ -925,7 +909,7 @@ refout = None # to match "out is None" elif os.path.exists(ref): f = open(ref, "r") - refout = list(splitnewlines(f.read())) + refout = f.read().splitlines(True) f.close() else: refout = []