#!/bin/sh cat > $HGRCPATH < switch-eol.py < .hgeol < a.txt hg commit --addremove -m 'checkin' echo cd .. } dotest () { seteol $1 echo "% hg clone repo repo-$1" hg clone --noupdate repo repo-$1 cd repo-$1 cat > .hg/hgrc <> a.txt echo '% printrepr.py a.txt' python $TESTDIR/printrepr.py < a.txt hg diff | python $TESTDIR/printrepr.py python ../switch-eol.py $1 a.txt echo '% hg diff only reports a single changed line:' hg diff | python $TESTDIR/printrepr.py echo "% reverting back to $1 format" hg revert a.txt python $TESTDIR/printrepr.py < a.txt printf "first\r\nsecond\n" > mixed.txt hg add mixed.txt echo "% hg commit of inconsistent .txt file marked as binary (should work)" hg commit -m 'binary file' echo "% hg commit of inconsistent .txt file marked as native (should fail)" printf "first\nsecond\r\nthird\nfourth\r\n" > a.txt hg commit -m 'inconsistent file' echo "% hg commit --config eol.only-consistent=False (should work)" hg commit --config eol.only-consistent=False -m 'inconsistent file' echo "% hg commit of binary .txt file marked as native (binary files always okay)" printf "first${EOL}\0${EOL}third${EOL}" > a.txt hg commit -m 'binary file' cd .. rm -r repo-$1 } makerepo LF dotest LF dotest CRLF rm -r repo makerepo CRLF dotest LF dotest CRLF rm -r repo makemixedrepo () { echo echo "# setup $1 repository" hg init mixed cd mixed printf "foo\r\nbar\r\nbaz\r\n" > win.txt printf "foo\nbar\nbaz\n" > unix.txt #printf "foo\r\nbar\nbaz\r\n" > mixed.txt hg commit --addremove -m 'created mixed files' echo "# setting repository-native EOLs to $1" cat > .hgeol < .hg/hgrc <