tests/test-mactext
branchstable
changeset 12795 3cb0559e44d0
parent 12793 469850088fc1
parent 12794 6bf8d48bec8e
child 12796 bc69ba99e34b
equal deleted inserted replaced
12793:469850088fc1 12795:3cb0559e44d0
     1 #!/bin/sh
       
     2 
       
     3 cat > unix2mac.py <<EOF
       
     4 import sys
       
     5 
       
     6 for path in sys.argv[1:]:
       
     7     data = file(path, 'rb').read()
       
     8     data = data.replace('\n', '\r')
       
     9     file(path, 'wb').write(data)
       
    10 EOF
       
    11 
       
    12 cat > print.py <<EOF
       
    13 import sys
       
    14 print(sys.stdin.read().replace('\n', '<LF>').replace('\r', '<CR>').replace('\0', '<NUL>'))
       
    15 EOF
       
    16 
       
    17 hg init
       
    18 echo '[hooks]' >> .hg/hgrc
       
    19 echo 'pretxncommit.cr = python:hgext.win32text.forbidcr' >> .hg/hgrc
       
    20 echo 'pretxnchangegroup.cr = python:hgext.win32text.forbidcr' >> .hg/hgrc
       
    21 cat .hg/hgrc
       
    22 echo
       
    23 
       
    24 echo hello > f
       
    25 hg add f
       
    26 hg ci -m 1
       
    27 echo
       
    28 
       
    29 python unix2mac.py f
       
    30 hg ci -m 2
       
    31 hg cat f | python print.py
       
    32 cat f | python print.py