tests/filtercr.py
author Greg Ward <greg@gerg.ca>
Wed, 14 Sep 2011 22:28:27 -0400
changeset 15101 a21ccf4412d5
parent 13141 6cfe17c19ba2
permissions -rwxr-xr-x
share: allow trailing newline on .hg/sharedpath. This is extremely handy for those occasional circumstances where you need to edit .hg/sharedpath manually, since modern Unix text editors make it surprisingly difficult to create a text file with no trailing newline.

#!/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