tests/filtercr.py
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
Mon, 10 Sep 2012 23:44:24 +0200
changeset 17472 965fbe04fd96
parent 13141 6cfe17c19ba2
permissions -rwxr-xr-x
amend: wrap all commit operations in a single transaction This allows proper recovery of an interrupted amend process. No changes are made to the logic besides: - indent operations into a single try-except clause, - some comment and code wrapping to 80 chars, - strip logic should not be contained in the transaction and is extracted from the main code.

#!/usr/bin/env python

# Filter output by the progress extension to make it readable in tests

import sys, re

for line in sys.stdin:
    line = re.sub(r'\r+[^\n]', lambda m: '\n' + m.group()[-1:], line)
    sys.stdout.write(line)
print