Mercurial > hg
view tests/filtercr.py @ 16331:900767dfa80d stable
tests: fix portability of sed usage in test-mq
on some platform (Mac OS X and Solaris, at least), to insert new text
line, sed function 'i' should be followed by:
- backslash('\'),
- new-line,
- text to be inserted and
- new-line
GNU sed on Linux can recognize both previous and new ones as same
modification request.
in addition to it, this patch avoids to use '-i' option for sed,
because it is not so portable, as noted in WritingTests wiki page.
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Sun, 01 Apr 2012 18:18:48 +0900 |
parents | 6cfe17c19ba2 |
children |
line wrap: on
line source
#!/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