diff tests/test-eol-hook.t @ 13616:e6f93ca9ce86

eol: make the hook check all new heads, not only tip (issue2666) Report and test by Antoine Pitrou <solipsis@pitrou.net>
author Patrick Mezard <pmezard@gmail.com>
date Sun, 13 Mar 2011 15:07:44 +0100
parents 686dec753b52
children 9cb1a42cd4b3
line wrap: on
line diff
--- a/tests/test-eol-hook.t	Sun Mar 13 15:07:44 2011 +0100
+++ b/tests/test-eol-hook.t	Sun Mar 13 15:07:44 2011 +0100
@@ -81,3 +81,38 @@
   adding manifests
   adding file changes
   added 2 changesets with 2 changes to 1 files
+
+  $ printf "first\r\nsecond" > b.txt
+  $ hg add b.txt
+  $ hg commit -m 'CRLF b.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: b.txt should not have CRLF line endings
+  transaction abort!
+  rollback completed
+  abort: b.txt should not have CRLF line endings
+  [255]
+
+  $ hg up -r -2
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ printf "some\nother\nfile" > c.txt
+  $ hg add c.txt
+  $ hg commit -m "LF c.txt, b.txt doesn't exist here"
+  created new head
+  $ hg push -f ../main
+  pushing to ../main
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 2 changesets with 2 changes to 2 files (+1 heads)
+  error: pretxnchangegroup hook failed: b.txt should not have CRLF line endings
+  transaction abort!
+  rollback completed
+  abort: b.txt should not have CRLF line endings
+  [255]