annotate tests/test-eol.t @ 14050:9e8a9d45945c stable

subrepo: handle svn tracked/unknown directory collisions This happens more often than expected. Say you have an svn subrepository with python code. Python would have generated unknown .pyc files. Now, you rebase this setup on a revision where a directory containing python code does not exist. Subversion is first asked to remove this directory when updating, but will not because it contains untracked items. Then it will have to bring back the directory after the merge but will fail because it now collides with an untracked directory. Using --force is not very elegant and only works with svn >= 1.5 but the only alternative I can think of is to write our own purge command for subversion.
author Patrick Mezard <pmezard@gmail.com>
date Fri, 04 Mar 2011 14:00:49 +0100
parents c0b0b00f0279
children 0e217d479c16
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
12419
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
1 Test EOL extension
11249
0bb67503ad4b eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
2
12419
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
3 $ cat > $HGRCPATH <<EOF
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
4 > [diff]
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
5 > git = True
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
6 > EOF
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
7
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
8 Set up helpers
11249
0bb67503ad4b eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
9
12419
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
10 $ cat > switch-eol.py <<EOF
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
11 > import sys
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
12 > try:
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
13 > import os, msvcrt
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
14 > msvcrt.setmode(sys.stdin.fileno(), os.O_BINARY)
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
15 > msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
16 > except ImportError:
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
17 > pass
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
18 > (old, new) = sys.argv[1] == 'LF' and ('\n', '\r\n') or ('\r\n', '\n')
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
19 > print "%% switching encoding from %r to %r" % (old, new)
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
20 > for path in sys.argv[2:]:
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
21 > data = file(path, 'rb').read()
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
22 > data = data.replace(old, new)
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
23 > file(path, 'wb').write(data)
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
24 > EOF
11249
0bb67503ad4b eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
25
12419
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
26 $ seteol () {
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
27 > if [ $1 = "LF" ]; then
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
28 > EOL='\n'
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
29 > else
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
30 > EOL='\r\n'
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
31 > fi
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
32 > }
11249
0bb67503ad4b eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
33
12419
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
34 $ makerepo () {
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
35 > seteol $1
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
36 > echo "% setup $1 repository"
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
37 > hg init repo
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
38 > cd repo
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
39 > cat > .hgeol <<EOF
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
40 > [repository]
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
41 > native = $1
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
42 > [patterns]
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
43 > mixed.txt = BIN
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
44 > **.txt = native
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
45 > EOF
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
46 > printf "first${EOL}second${EOL}third${EOL}" > a.txt
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
47 > hg commit --addremove -m 'checkin'
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
48 > echo
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
49 > cd ..
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
50 > }
11249
0bb67503ad4b eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
51
12419
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
52 $ dotest () {
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
53 > seteol $1
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
54 > echo "% hg clone repo repo-$1"
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
55 > hg clone --noupdate repo repo-$1
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
56 > cd repo-$1
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
57 > cat > .hg/hgrc <<EOF
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
58 > [extensions]
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
59 > eol =
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
60 > [eol]
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
61 > native = $1
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
62 > EOF
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
63 > hg update
12943
7439ea4146f8 tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents: 12419
diff changeset
64 > echo '% a.txt'
7439ea4146f8 tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents: 12419
diff changeset
65 > cat a.txt
12419
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
66 > echo '% hg cat a.txt'
12943
7439ea4146f8 tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents: 12419
diff changeset
67 > hg cat a.txt
12419
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
68 > printf "fourth${EOL}" >> a.txt
12943
7439ea4146f8 tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents: 12419
diff changeset
69 > echo '% a.txt'
7439ea4146f8 tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents: 12419
diff changeset
70 > cat a.txt
7439ea4146f8 tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents: 12419
diff changeset
71 > hg diff
12419
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
72 > python ../switch-eol.py $1 a.txt
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
73 > echo '% hg diff only reports a single changed line:'
12943
7439ea4146f8 tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents: 12419
diff changeset
74 > hg diff
12419
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
75 > echo "% reverting back to $1 format"
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
76 > hg revert a.txt
12943
7439ea4146f8 tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents: 12419
diff changeset
77 > cat a.txt
12419
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
78 > printf "first\r\nsecond\n" > mixed.txt
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
79 > hg add mixed.txt
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
80 > echo "% hg commit of inconsistent .txt file marked as binary (should work)"
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
81 > hg commit -m 'binary file'
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
82 > echo "% hg commit of inconsistent .txt file marked as native (should fail)"
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
83 > printf "first\nsecond\r\nthird\nfourth\r\n" > a.txt
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
84 > hg commit -m 'inconsistent file'
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
85 > echo "% hg commit --config eol.only-consistent=False (should work)"
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
86 > hg commit --config eol.only-consistent=False -m 'inconsistent file'
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
87 > echo "% hg commit of binary .txt file marked as native (binary files always okay)"
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
88 > printf "first${EOL}\0${EOL}third${EOL}" > a.txt
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
89 > hg commit -m 'binary file'
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
90 > cd ..
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
91 > rm -r repo-$1
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
92 > }
11249
0bb67503ad4b eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
93
12419
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
94 $ makemixedrepo () {
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
95 > echo
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
96 > echo "# setup $1 repository"
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
97 > hg init mixed
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
98 > cd mixed
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
99 > printf "foo\r\nbar\r\nbaz\r\n" > win.txt
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
100 > printf "foo\nbar\nbaz\n" > unix.txt
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
101 > #printf "foo\r\nbar\nbaz\r\n" > mixed.txt
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
102 > hg commit --addremove -m 'created mixed files'
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
103 > echo "# setting repository-native EOLs to $1"
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
104 > cat > .hgeol <<EOF
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
105 > [repository]
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
106 > native = $1
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
107 > [patterns]
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
108 > **.txt = native
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
109 > EOF
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
110 > hg commit --addremove -m 'added .hgeol'
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
111 > cd ..
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
112 > }
11249
0bb67503ad4b eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
113
12419
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
114 $ testmixed () {
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
115 > echo
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
116 > echo "% hg clone mixed mixed-$1"
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
117 > hg clone mixed mixed-$1
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
118 > cd mixed-$1
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
119 > echo '% hg status (eol extension not yet activated)'
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
120 > hg status
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
121 > cat > .hg/hgrc <<EOF
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
122 > [extensions]
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
123 > eol =
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
124 > [eol]
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
125 > native = $1
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
126 > EOF
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
127 > echo '% hg status (eol activated)'
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
128 > hg status
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
129 > echo '% hg commit'
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
130 > hg commit -m 'synchronized EOLs'
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
131 > echo '% hg status'
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
132 > hg status
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
133 > cd ..
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
134 > rm -r mixed-$1
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
135 > }
11249
0bb67503ad4b eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
136
12419
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
137 Basic tests
11249
0bb67503ad4b eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
138
12419
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
139 $ makerepo LF
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
140 % setup LF repository
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
141 adding .hgeol
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
142 adding a.txt
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
143
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
144 $ dotest LF
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
145 % hg clone repo repo-LF
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
146 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
12943
7439ea4146f8 tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents: 12419
diff changeset
147 % a.txt
12419
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
148 first
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
149 second
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
150 third
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
151 % hg cat a.txt
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
152 first
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
153 second
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
154 third
12943
7439ea4146f8 tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents: 12419
diff changeset
155 % a.txt
12419
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
156 first
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
157 second
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
158 third
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
159 fourth
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
160 diff --git a/a.txt b/a.txt
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
161 --- a/a.txt
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
162 +++ b/a.txt
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
163 @@ -1,3 +1,4 @@
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
164 first
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
165 second
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
166 third
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
167 +fourth
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
168 % switching encoding from '\n' to '\r\n'
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
169 % hg diff only reports a single changed line:
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
170 diff --git a/a.txt b/a.txt
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
171 --- a/a.txt
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
172 +++ b/a.txt
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
173 @@ -1,3 +1,4 @@
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
174 first
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
175 second
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
176 third
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
177 +fourth
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
178 % reverting back to LF format
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
179 first
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
180 second
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
181 third
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
182 % hg commit of inconsistent .txt file marked as binary (should work)
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
183 % hg commit of inconsistent .txt file marked as native (should fail)
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
184 abort: inconsistent newline style in a.txt
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
185
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
186 % hg commit --config eol.only-consistent=False (should work)
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
187 % hg commit of binary .txt file marked as native (binary files always okay)
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
188 $ dotest CRLF
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
189 % hg clone repo repo-CRLF
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
190 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
12943
7439ea4146f8 tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents: 12419
diff changeset
191 % a.txt
7439ea4146f8 tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents: 12419
diff changeset
192 first\r (esc)
7439ea4146f8 tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents: 12419
diff changeset
193 second\r (esc)
7439ea4146f8 tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents: 12419
diff changeset
194 third\r (esc)
12419
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
195 % hg cat a.txt
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
196 first
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
197 second
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
198 third
12943
7439ea4146f8 tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents: 12419
diff changeset
199 % a.txt
7439ea4146f8 tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents: 12419
diff changeset
200 first\r (esc)
7439ea4146f8 tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents: 12419
diff changeset
201 second\r (esc)
7439ea4146f8 tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents: 12419
diff changeset
202 third\r (esc)
7439ea4146f8 tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents: 12419
diff changeset
203 fourth\r (esc)
12419
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
204 diff --git a/a.txt b/a.txt
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
205 --- a/a.txt
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
206 +++ b/a.txt
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
207 @@ -1,3 +1,4 @@
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
208 first
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
209 second
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
210 third
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
211 +fourth
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
212 % switching encoding from '\r\n' to '\n'
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
213 % hg diff only reports a single changed line:
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
214 diff --git a/a.txt b/a.txt
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
215 --- a/a.txt
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
216 +++ b/a.txt
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
217 @@ -1,3 +1,4 @@
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
218 first
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
219 second
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
220 third
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
221 +fourth
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
222 % reverting back to CRLF format
12943
7439ea4146f8 tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents: 12419
diff changeset
223 first\r (esc)
7439ea4146f8 tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents: 12419
diff changeset
224 second\r (esc)
7439ea4146f8 tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents: 12419
diff changeset
225 third\r (esc)
12419
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
226 % hg commit of inconsistent .txt file marked as binary (should work)
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
227 % hg commit of inconsistent .txt file marked as native (should fail)
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
228 abort: inconsistent newline style in a.txt
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
229
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
230 % hg commit --config eol.only-consistent=False (should work)
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
231 % hg commit of binary .txt file marked as native (binary files always okay)
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
232 $ rm -r repo
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
233 $ makerepo CRLF
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
234 % setup CRLF repository
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
235 adding .hgeol
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
236 adding a.txt
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
237
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
238 $ dotest LF
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
239 % hg clone repo repo-LF
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
240 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
12943
7439ea4146f8 tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents: 12419
diff changeset
241 % a.txt
12419
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
242 first
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
243 second
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
244 third
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
245 % hg cat a.txt
12943
7439ea4146f8 tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents: 12419
diff changeset
246 first\r (esc)
7439ea4146f8 tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents: 12419
diff changeset
247 second\r (esc)
7439ea4146f8 tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents: 12419
diff changeset
248 third\r (esc)
7439ea4146f8 tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents: 12419
diff changeset
249 % a.txt
12419
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
250 first
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
251 second
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
252 third
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
253 fourth
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
254 diff --git a/a.txt b/a.txt
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
255 --- a/a.txt
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
256 +++ b/a.txt
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
257 @@ -1,3 +1,4 @@
12943
7439ea4146f8 tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents: 12419
diff changeset
258 first\r (esc)
7439ea4146f8 tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents: 12419
diff changeset
259 second\r (esc)
7439ea4146f8 tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents: 12419
diff changeset
260 third\r (esc)
7439ea4146f8 tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents: 12419
diff changeset
261 +fourth\r (esc)
12419
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
262 % switching encoding from '\n' to '\r\n'
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
263 % hg diff only reports a single changed line:
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
264 diff --git a/a.txt b/a.txt
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
265 --- a/a.txt
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
266 +++ b/a.txt
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
267 @@ -1,3 +1,4 @@
12943
7439ea4146f8 tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents: 12419
diff changeset
268 first\r (esc)
7439ea4146f8 tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents: 12419
diff changeset
269 second\r (esc)
7439ea4146f8 tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents: 12419
diff changeset
270 third\r (esc)
7439ea4146f8 tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents: 12419
diff changeset
271 +fourth\r (esc)
12419
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
272 % reverting back to LF format
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
273 first
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
274 second
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
275 third
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
276 % hg commit of inconsistent .txt file marked as binary (should work)
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
277 % hg commit of inconsistent .txt file marked as native (should fail)
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
278 abort: inconsistent newline style in a.txt
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
279
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
280 % hg commit --config eol.only-consistent=False (should work)
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
281 % hg commit of binary .txt file marked as native (binary files always okay)
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
282 $ dotest CRLF
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
283 % hg clone repo repo-CRLF
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
284 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
12943
7439ea4146f8 tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents: 12419
diff changeset
285 % a.txt
7439ea4146f8 tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents: 12419
diff changeset
286 first\r (esc)
7439ea4146f8 tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents: 12419
diff changeset
287 second\r (esc)
7439ea4146f8 tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents: 12419
diff changeset
288 third\r (esc)
12419
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
289 % hg cat a.txt
12943
7439ea4146f8 tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents: 12419
diff changeset
290 first\r (esc)
7439ea4146f8 tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents: 12419
diff changeset
291 second\r (esc)
7439ea4146f8 tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents: 12419
diff changeset
292 third\r (esc)
7439ea4146f8 tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents: 12419
diff changeset
293 % a.txt
7439ea4146f8 tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents: 12419
diff changeset
294 first\r (esc)
7439ea4146f8 tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents: 12419
diff changeset
295 second\r (esc)
7439ea4146f8 tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents: 12419
diff changeset
296 third\r (esc)
7439ea4146f8 tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents: 12419
diff changeset
297 fourth\r (esc)
12419
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
298 diff --git a/a.txt b/a.txt
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
299 --- a/a.txt
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
300 +++ b/a.txt
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
301 @@ -1,3 +1,4 @@
12943
7439ea4146f8 tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents: 12419
diff changeset
302 first\r (esc)
7439ea4146f8 tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents: 12419
diff changeset
303 second\r (esc)
7439ea4146f8 tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents: 12419
diff changeset
304 third\r (esc)
7439ea4146f8 tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents: 12419
diff changeset
305 +fourth\r (esc)
12419
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
306 % switching encoding from '\r\n' to '\n'
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
307 % hg diff only reports a single changed line:
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
308 diff --git a/a.txt b/a.txt
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
309 --- a/a.txt
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
310 +++ b/a.txt
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
311 @@ -1,3 +1,4 @@
12943
7439ea4146f8 tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents: 12419
diff changeset
312 first\r (esc)
7439ea4146f8 tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents: 12419
diff changeset
313 second\r (esc)
7439ea4146f8 tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents: 12419
diff changeset
314 third\r (esc)
7439ea4146f8 tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents: 12419
diff changeset
315 +fourth\r (esc)
12419
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
316 % reverting back to CRLF format
12943
7439ea4146f8 tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents: 12419
diff changeset
317 first\r (esc)
7439ea4146f8 tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents: 12419
diff changeset
318 second\r (esc)
7439ea4146f8 tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents: 12419
diff changeset
319 third\r (esc)
12419
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
320 % hg commit of inconsistent .txt file marked as binary (should work)
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
321 % hg commit of inconsistent .txt file marked as native (should fail)
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
322 abort: inconsistent newline style in a.txt
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
323
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
324 % hg commit --config eol.only-consistent=False (should work)
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
325 % hg commit of binary .txt file marked as native (binary files always okay)
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
326 $ rm -r repo
11249
0bb67503ad4b eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
327
12419
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
328 Mixed tests
11249
0bb67503ad4b eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
329
12419
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
330 $ makemixedrepo LF
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
331
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
332 # setup LF repository
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
333 adding unix.txt
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
334 adding win.txt
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
335 # setting repository-native EOLs to LF
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
336 adding .hgeol
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
337 $ testmixed LF
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
338
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
339 % hg clone mixed mixed-LF
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
340 updating to branch default
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
341 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
342 % hg status (eol extension not yet activated)
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
343 % hg status (eol activated)
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
344 M win.txt
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
345 % hg commit
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
346 % hg status
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
347 $ testmixed CRLF
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
348
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
349 % hg clone mixed mixed-CRLF
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
350 updating to branch default
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
351 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
352 % hg status (eol extension not yet activated)
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
353 % hg status (eol activated)
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
354 M win.txt
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
355 % hg commit
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
356 % hg status
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
357 $ rm -r mixed
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
358 $ makemixedrepo CRLF
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
359
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
360 # setup CRLF repository
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
361 adding unix.txt
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
362 adding win.txt
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
363 # setting repository-native EOLs to CRLF
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
364 adding .hgeol
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
365 $ testmixed LF
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
366
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
367 % hg clone mixed mixed-LF
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
368 updating to branch default
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
369 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
370 % hg status (eol extension not yet activated)
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
371 % hg status (eol activated)
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
372 M unix.txt
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
373 % hg commit
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
374 % hg status
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
375 $ testmixed CRLF
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
376
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
377 % hg clone mixed mixed-CRLF
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
378 updating to branch default
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
379 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
380 % hg status (eol extension not yet activated)
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
381 % hg status (eol activated)
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
382 M unix.txt
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
383 % hg commit
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
384 % hg status
f6a91fcd189a tests: unify test-eol
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
385 $ rm -r mixed
13475
c7bef25ca393 eol: handle LockUnavailable error (issue2569)
Martin Geisler <mg@aragost.com>
parents: 12943
diff changeset
386
c7bef25ca393 eol: handle LockUnavailable error (issue2569)
Martin Geisler <mg@aragost.com>
parents: 12943
diff changeset
387 Test issue2569 -- eol extension takes write lock on reading:
c7bef25ca393 eol: handle LockUnavailable error (issue2569)
Martin Geisler <mg@aragost.com>
parents: 12943
diff changeset
388
c7bef25ca393 eol: handle LockUnavailable error (issue2569)
Martin Geisler <mg@aragost.com>
parents: 12943
diff changeset
389 $ echo '[extensions]' >> $HGRCPATH
c7bef25ca393 eol: handle LockUnavailable error (issue2569)
Martin Geisler <mg@aragost.com>
parents: 12943
diff changeset
390 $ echo 'eol =' >> $HGRCPATH
c7bef25ca393 eol: handle LockUnavailable error (issue2569)
Martin Geisler <mg@aragost.com>
parents: 12943
diff changeset
391 $ hg init repo
c7bef25ca393 eol: handle LockUnavailable error (issue2569)
Martin Geisler <mg@aragost.com>
parents: 12943
diff changeset
392 $ cd repo
c7bef25ca393 eol: handle LockUnavailable error (issue2569)
Martin Geisler <mg@aragost.com>
parents: 12943
diff changeset
393 $ touch .hgeol
c7bef25ca393 eol: handle LockUnavailable error (issue2569)
Martin Geisler <mg@aragost.com>
parents: 12943
diff changeset
394 $ hg status
c7bef25ca393 eol: handle LockUnavailable error (issue2569)
Martin Geisler <mg@aragost.com>
parents: 12943
diff changeset
395 ? .hgeol
c7bef25ca393 eol: handle LockUnavailable error (issue2569)
Martin Geisler <mg@aragost.com>
parents: 12943
diff changeset
396 $ chmod -R -w .hg
c7bef25ca393 eol: handle LockUnavailable error (issue2569)
Martin Geisler <mg@aragost.com>
parents: 12943
diff changeset
397 $ sleep 1
c7bef25ca393 eol: handle LockUnavailable error (issue2569)
Martin Geisler <mg@aragost.com>
parents: 12943
diff changeset
398 $ touch .hgeol
c7bef25ca393 eol: handle LockUnavailable error (issue2569)
Martin Geisler <mg@aragost.com>
parents: 12943
diff changeset
399 $ hg status --traceback
c7bef25ca393 eol: handle LockUnavailable error (issue2569)
Martin Geisler <mg@aragost.com>
parents: 12943
diff changeset
400 ? .hgeol
13621
c0b0b00f0279 tests: fix permission issue trying to remove test directory
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 13505
diff changeset
401 $ chmod -R u+w .hg
13503
5007ff32f356 eol: test win32text compatible encode/decode filters
Martin Geisler <mg@aragost.com>
parents: 13475
diff changeset
402 $ cd ..
5007ff32f356 eol: test win32text compatible encode/decode filters
Martin Geisler <mg@aragost.com>
parents: 13475
diff changeset
403
5007ff32f356 eol: test win32text compatible encode/decode filters
Martin Geisler <mg@aragost.com>
parents: 13475
diff changeset
404 Test cleverencode: and cleverdecode: aliases for win32text extension
5007ff32f356 eol: test win32text compatible encode/decode filters
Martin Geisler <mg@aragost.com>
parents: 13475
diff changeset
405
5007ff32f356 eol: test win32text compatible encode/decode filters
Martin Geisler <mg@aragost.com>
parents: 13475
diff changeset
406 $ echo '[encode]' >> $HGRCPATH
13504
85840c4ae2ad eol: fix test typos introduced in 5007ff32f356
Martin Geisler <mg@aragost.com>
parents: 13503
diff changeset
407 $ echo '**.txt = cleverencode:' >> $HGRCPATH
13503
5007ff32f356 eol: test win32text compatible encode/decode filters
Martin Geisler <mg@aragost.com>
parents: 13475
diff changeset
408 $ echo '[decode]' >> $HGRCPATH
13504
85840c4ae2ad eol: fix test typos introduced in 5007ff32f356
Martin Geisler <mg@aragost.com>
parents: 13503
diff changeset
409 $ echo '**.txt = cleverdecode:' >> $HGRCPATH
13503
5007ff32f356 eol: test win32text compatible encode/decode filters
Martin Geisler <mg@aragost.com>
parents: 13475
diff changeset
410
5007ff32f356 eol: test win32text compatible encode/decode filters
Martin Geisler <mg@aragost.com>
parents: 13475
diff changeset
411 $ hg init win32compat
5007ff32f356 eol: test win32text compatible encode/decode filters
Martin Geisler <mg@aragost.com>
parents: 13475
diff changeset
412 $ cd win32compat
5007ff32f356 eol: test win32text compatible encode/decode filters
Martin Geisler <mg@aragost.com>
parents: 13475
diff changeset
413 $ printf "foo\r\nbar\r\nbaz\r\n" > win.txt
5007ff32f356 eol: test win32text compatible encode/decode filters
Martin Geisler <mg@aragost.com>
parents: 13475
diff changeset
414 $ printf "foo\nbar\nbaz\n" > unix.txt
5007ff32f356 eol: test win32text compatible encode/decode filters
Martin Geisler <mg@aragost.com>
parents: 13475
diff changeset
415 $ hg add
5007ff32f356 eol: test win32text compatible encode/decode filters
Martin Geisler <mg@aragost.com>
parents: 13475
diff changeset
416 adding unix.txt
5007ff32f356 eol: test win32text compatible encode/decode filters
Martin Geisler <mg@aragost.com>
parents: 13475
diff changeset
417 adding win.txt
5007ff32f356 eol: test win32text compatible encode/decode filters
Martin Geisler <mg@aragost.com>
parents: 13475
diff changeset
418 $ hg commit -m checkin
5007ff32f356 eol: test win32text compatible encode/decode filters
Martin Geisler <mg@aragost.com>
parents: 13475
diff changeset
419
5007ff32f356 eol: test win32text compatible encode/decode filters
Martin Geisler <mg@aragost.com>
parents: 13475
diff changeset
420 Check that both files have LF line-endings in the repository:
5007ff32f356 eol: test win32text compatible encode/decode filters
Martin Geisler <mg@aragost.com>
parents: 13475
diff changeset
421
5007ff32f356 eol: test win32text compatible encode/decode filters
Martin Geisler <mg@aragost.com>
parents: 13475
diff changeset
422 $ hg cat win.txt
5007ff32f356 eol: test win32text compatible encode/decode filters
Martin Geisler <mg@aragost.com>
parents: 13475
diff changeset
423 foo
5007ff32f356 eol: test win32text compatible encode/decode filters
Martin Geisler <mg@aragost.com>
parents: 13475
diff changeset
424 bar
5007ff32f356 eol: test win32text compatible encode/decode filters
Martin Geisler <mg@aragost.com>
parents: 13475
diff changeset
425 baz
5007ff32f356 eol: test win32text compatible encode/decode filters
Martin Geisler <mg@aragost.com>
parents: 13475
diff changeset
426 $ hg cat unix.txt
5007ff32f356 eol: test win32text compatible encode/decode filters
Martin Geisler <mg@aragost.com>
parents: 13475
diff changeset
427 foo
5007ff32f356 eol: test win32text compatible encode/decode filters
Martin Geisler <mg@aragost.com>
parents: 13475
diff changeset
428 bar
5007ff32f356 eol: test win32text compatible encode/decode filters
Martin Geisler <mg@aragost.com>
parents: 13475
diff changeset
429 baz
13505
9b617c56eb65 eol: do not abort on parse error
Martin Geisler <mg@aragost.com>
parents: 13504
diff changeset
430
9b617c56eb65 eol: do not abort on parse error
Martin Geisler <mg@aragost.com>
parents: 13504
diff changeset
431 Test handling of a broken .hgeol file:
9b617c56eb65 eol: do not abort on parse error
Martin Geisler <mg@aragost.com>
parents: 13504
diff changeset
432
9b617c56eb65 eol: do not abort on parse error
Martin Geisler <mg@aragost.com>
parents: 13504
diff changeset
433 $ touch .hgeol
9b617c56eb65 eol: do not abort on parse error
Martin Geisler <mg@aragost.com>
parents: 13504
diff changeset
434 $ hg add .hgeol
9b617c56eb65 eol: do not abort on parse error
Martin Geisler <mg@aragost.com>
parents: 13504
diff changeset
435 $ hg commit -m 'clean version'
9b617c56eb65 eol: do not abort on parse error
Martin Geisler <mg@aragost.com>
parents: 13504
diff changeset
436 $ echo "bad" > .hgeol
9b617c56eb65 eol: do not abort on parse error
Martin Geisler <mg@aragost.com>
parents: 13504
diff changeset
437 $ hg status
9b617c56eb65 eol: do not abort on parse error
Martin Geisler <mg@aragost.com>
parents: 13504
diff changeset
438 warning: ignoring .hgeol file due to parse error at .hgeol:1: bad
9b617c56eb65 eol: do not abort on parse error
Martin Geisler <mg@aragost.com>
parents: 13504
diff changeset
439 M .hgeol
9b617c56eb65 eol: do not abort on parse error
Martin Geisler <mg@aragost.com>
parents: 13504
diff changeset
440 $ hg revert .hgeol
9b617c56eb65 eol: do not abort on parse error
Martin Geisler <mg@aragost.com>
parents: 13504
diff changeset
441 warning: ignoring .hgeol file due to parse error at .hgeol:1: bad
9b617c56eb65 eol: do not abort on parse error
Martin Geisler <mg@aragost.com>
parents: 13504
diff changeset
442 $ hg status
9b617c56eb65 eol: do not abort on parse error
Martin Geisler <mg@aragost.com>
parents: 13504
diff changeset
443 ? .hgeol.orig