##// END OF EJS Templates
tests: unify test-eol-hook
Matt Mackall -
r12423:10c3385f default
parent child Browse files
Show More
@@ -1,47 +1,63 b''
1 #!/bin/sh
1 Test the EOL hook
2
3 cat > $HGRCPATH <<EOF
4 [diff]
5 git = True
6 EOF
7
2
8 hg init main
3 $ cat > $HGRCPATH <<EOF
9 cat > main/.hg/hgrc <<EOF
4 > [diff]
10 [extensions]
5 > git = True
11 eol =
6 > EOF
7 $ hg init main
8 $ cat > main/.hg/hgrc <<EOF
9 > [extensions]
10 > eol =
11 >
12 > [hooks]
13 > pretxnchangegroup = python:hgext.eol.hook
14 > EOF
15 $ hg clone main fork
16 updating to branch default
17 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
18 $ cd fork
12
19
13 [hooks]
20 Create repo
14 pretxnchangegroup = python:hgext.eol.hook
21 $ cat > .hgeol <<EOF
15 EOF
22 > [patterns]
16
23 > mixed.txt = BIN
17 hg clone main fork
24 > **.txt = native
25 > EOF
26 $ hg add .hgeol
27 $ hg commit -m 'Commit .hgeol'
18
28
19 cd fork
29 $ printf "first\nsecond\nthird\n" > a.txt
20 cat > .hgeol <<EOF
30 $ hg add a.txt
21 [patterns]
31 $ hg commit -m 'LF a.txt'
22 mixed.txt = BIN
32 $ hg push ../main
23 **.txt = native
33 pushing to ../main
24 EOF
34 searching for changes
25
35 adding changesets
26 hg add .hgeol
36 adding manifests
27 hg commit -m 'Commit .hgeol'
37 adding file changes
38 added 2 changesets with 2 changes to 2 files
28
39
29 printf "first\nsecond\nthird\n" > a.txt
40 $ printf "first\r\nsecond\r\nthird\n" > a.txt
30 hg add a.txt
41 $ hg commit -m 'CRLF a.txt'
31 echo "% hg commit (LF a.txt)"
42 $ hg push ../main
32 hg commit -m 'LF a.txt'
43 pushing to ../main
33 echo "% hg push"
44 searching for changes
34 hg push ../main
45 adding changesets
46 adding manifests
47 adding file changes
48 added 1 changesets with 1 changes to 1 files
49 error: pretxnchangegroup hook failed: a.txt should not have CRLF line endings
50 transaction abort!
51 rollback completed
52 abort: a.txt should not have CRLF line endings
53 [255]
35
54
36 printf "first\r\nsecond\r\nthird\n" > a.txt
55 $ printf "first\nsecond\nthird\n" > a.txt
37 echo "% hg commit (CRLF a.txt)"
56 $ hg commit -m 'LF a.txt (fixed)'
38 hg commit -m 'CRLF a.txt'
57 $ hg push ../main
39 echo "% hg push"
58 pushing to ../main
40 hg push ../main
59 searching for changes
41
60 adding changesets
42
61 adding manifests
43 echo "% hg commit (LF a.txt)"
62 adding file changes
44 printf "first\nsecond\nthird\n" > a.txt
63 added 2 changesets with 2 changes to 1 files
45 hg commit -m 'LF a.txt (fixed)'
46 echo "% hg push"
47 hg push ../main
1 NO CONTENT: file was removed
NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now