tests/filtertmp.py
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
Fri, 19 Mar 2010 22:52:38 +0100
branchstable
changeset 10745 d94832c4a31d
parent 10469 b26c4a89a143
permissions -rwxr-xr-x
patch: try harder to find the file to patch on file creation (issue2041) accept the following patch header: first line: foo/a.orig second line: foo/a

#!/usr/bin/env python
#
# This used to be a simple sed call like:
#
#  $ sed "s:$HGTMP:*HGTMP*:"
#
# But $HGTMP has ':' under Windows which breaks the sed call.
#
import sys, os

input = sys.stdin.read()
input = input.replace(os.sep, '/')
hgtmp = os.environ['HGTMP'].replace(os.sep, '/')
input = input.replace(hgtmp, '$HGTMP')
sys.stdout.write(input)