tests/printrepr.py
author Brodie Rao <me+hg@dackz.net>
Sun, 25 Oct 2009 02:53:33 +0200
changeset 9642 7d17794f08a9
parent 8448 0eb8c4df61bd
child 10263 25e572394f5c
permissions -rwxr-xr-x
diffstat: with --git, mark binary files with Bin Normally, diffs without any text insertions or deletions are reported as having 0 lines changed by stock diffstat. Compatibility is preserved with stock diffstat in this case, but when using --git, binary files are marked with Bin as a means of clarification. git diff --stat does something similar, though it also includes the old and new file sizes.

#!/usr/bin/env python
#
# Copyright 2009 Matt Mackall <mpm@selenic.com> and others
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2, incorporated herein by reference.

"""prints repr(sys.stdin) but preserves newlines in input"""

import sys
print repr(sys.stdin.read())[1:-1].replace('\\n', '\n'),