##// 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
2
3 cat > $HGRCPATH <<EOF
4 [diff]
5 git = True
6 EOF
1 Test the EOL hook
7 2
8 hg init main
9 cat > main/.hg/hgrc <<EOF
10 [extensions]
11 eol =
3 $ cat > $HGRCPATH <<EOF
4 > [diff]
5 > git = True
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]
14 pretxnchangegroup = python:hgext.eol.hook
15 EOF
16
17 hg clone main fork
20 Create repo
21 $ cat > .hgeol <<EOF
22 > [patterns]
23 > mixed.txt = BIN
24 > **.txt = native
25 > EOF
26 $ hg add .hgeol
27 $ hg commit -m 'Commit .hgeol'
18 28
19 cd fork
20 cat > .hgeol <<EOF
21 [patterns]
22 mixed.txt = BIN
23 **.txt = native
24 EOF
25
26 hg add .hgeol
27 hg commit -m 'Commit .hgeol'
29 $ printf "first\nsecond\nthird\n" > a.txt
30 $ hg add a.txt
31 $ hg commit -m 'LF a.txt'
32 $ hg push ../main
33 pushing to ../main
34 searching for changes
35 adding changesets
36 adding manifests
37 adding file changes
38 added 2 changesets with 2 changes to 2 files
28 39
29 printf "first\nsecond\nthird\n" > a.txt
30 hg add a.txt
31 echo "% hg commit (LF a.txt)"
32 hg commit -m 'LF a.txt'
33 echo "% hg push"
34 hg push ../main
40 $ printf "first\r\nsecond\r\nthird\n" > a.txt
41 $ hg commit -m 'CRLF a.txt'
42 $ hg push ../main
43 pushing to ../main
44 searching for changes
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
37 echo "% hg commit (CRLF a.txt)"
38 hg commit -m 'CRLF a.txt'
39 echo "% hg push"
40 hg push ../main
41
42
43 echo "% hg commit (LF a.txt)"
44 printf "first\nsecond\nthird\n" > a.txt
45 hg commit -m 'LF a.txt (fixed)'
46 echo "% hg push"
47 hg push ../main
55 $ printf "first\nsecond\nthird\n" > a.txt
56 $ hg commit -m 'LF a.txt (fixed)'
57 $ hg push ../main
58 pushing to ../main
59 searching for changes
60 adding changesets
61 adding manifests
62 adding file changes
63 added 2 changesets with 2 changes to 1 files
1 NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now