# HG changeset patch # User Matt Mackall # Date 1285526492 18000 # Node ID 10c3385fa89eff4d5dc67ba8c57d7663116c2f6a # Parent 4263359f7eacee33b6373ce84af0c5a613622998 tests: unify test-eol-hook diff -r 4263359f7eac -r 10c3385fa89e tests/test-eol-hook --- a/tests/test-eol-hook Sun Sep 26 13:41:32 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ -#!/bin/sh - -cat > $HGRCPATH < main/.hg/hgrc < .hgeol < a.txt -hg add a.txt -echo "% hg commit (LF a.txt)" -hg commit -m 'LF a.txt' -echo "% hg push" -hg push ../main - -printf "first\r\nsecond\r\nthird\n" > a.txt -echo "% hg commit (CRLF a.txt)" -hg commit -m 'CRLF a.txt' -echo "% hg push" -hg push ../main - - -echo "% hg commit (LF a.txt)" -printf "first\nsecond\nthird\n" > a.txt -hg commit -m 'LF a.txt (fixed)' -echo "% hg push" -hg push ../main diff -r 4263359f7eac -r 10c3385fa89e tests/test-eol-hook.out --- a/tests/test-eol-hook.out Sun Sep 26 13:41:32 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -updating to branch default -0 files updated, 0 files merged, 0 files removed, 0 files unresolved -% hg commit (LF a.txt) -% hg push -pushing to ../main -searching for changes -adding changesets -adding manifests -adding file changes -added 2 changesets with 2 changes to 2 files -% hg commit (CRLF a.txt) -% hg push -pushing to ../main -searching for changes -adding changesets -adding manifests -adding file changes -added 1 changesets with 1 changes to 1 files -error: pretxnchangegroup hook failed: a.txt should not have CRLF line endings -transaction abort! -rollback completed -abort: a.txt should not have CRLF line endings -% hg commit (LF a.txt) -% hg push -pushing to ../main -searching for changes -adding changesets -adding manifests -adding file changes -added 2 changesets with 2 changes to 1 files diff -r 4263359f7eac -r 10c3385fa89e tests/test-eol-hook.t --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-eol-hook.t Sun Sep 26 13:41:32 2010 -0500 @@ -0,0 +1,63 @@ +Test the EOL hook + + $ cat > $HGRCPATH < [diff] + > git = True + > EOF + $ hg init main + $ cat > main/.hg/hgrc < [extensions] + > eol = + > + > [hooks] + > pretxnchangegroup = python:hgext.eol.hook + > EOF + $ hg clone main fork + updating to branch default + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ cd fork + +Create repo + $ cat > .hgeol < [patterns] + > mixed.txt = BIN + > **.txt = native + > EOF + $ hg add .hgeol + $ hg commit -m 'Commit .hgeol' + + $ printf "first\nsecond\nthird\n" > a.txt + $ hg add a.txt + $ hg commit -m 'LF a.txt' + $ hg push ../main + pushing to ../main + searching for changes + adding changesets + adding manifests + adding file changes + added 2 changesets with 2 changes to 2 files + + $ printf "first\r\nsecond\r\nthird\n" > a.txt + $ hg commit -m 'CRLF a.txt' + $ hg push ../main + pushing to ../main + searching for changes + adding changesets + adding manifests + adding file changes + added 1 changesets with 1 changes to 1 files + error: pretxnchangegroup hook failed: a.txt should not have CRLF line endings + transaction abort! + rollback completed + abort: a.txt should not have CRLF line endings + [255] + + $ printf "first\nsecond\nthird\n" > a.txt + $ hg commit -m 'LF a.txt (fixed)' + $ hg push ../main + pushing to ../main + searching for changes + adding changesets + adding manifests + adding file changes + added 2 changesets with 2 changes to 1 files