author | Pierre-Yves David <pierre-yves.david@octobus.net> |
Fri, 02 Dec 2022 05:10:05 +0100 | |
changeset 49724 | f3b685d9e899 |
parent 48876 | 42d2b31cee0b |
permissions | -rw-r--r-- |
12419 | 1 |
Test EOL extension |
11249
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
2 |
|
13519
43b3b761d9d1
tests: don't overwrite HGRCPATH
Martin Geisler <mg@aragost.com>
parents:
13505
diff
changeset
|
3 |
$ cat >> $HGRCPATH <<EOF |
12419 | 4 |
> [diff] |
5 |
> git = True |
|
6 |
> EOF |
|
7 |
||
8 |
Set up helpers |
|
11249
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
9 |
|
38330
ae3f17a87b28
py3: remove b'' from output of test-eol.t
Yuya Nishihara <yuya@tcha.org>
parents:
36030
diff
changeset
|
10 |
$ cat > switch-eol.py <<'EOF' |
33955
efa6a420ba57
tests: update test-eol to pass our import checker
Augie Fackler <raf@durin42.com>
parents:
33721
diff
changeset
|
11 |
> import os |
12419 | 12 |
> import sys |
13 |
> try: |
|
33955
efa6a420ba57
tests: update test-eol to pass our import checker
Augie Fackler <raf@durin42.com>
parents:
33721
diff
changeset
|
14 |
> import msvcrt |
12419 | 15 |
> msvcrt.setmode(sys.stdin.fileno(), os.O_BINARY) |
16 |
> msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY) |
|
17 |
> except ImportError: |
|
18 |
> pass |
|
38330
ae3f17a87b28
py3: remove b'' from output of test-eol.t
Yuya Nishihara <yuya@tcha.org>
parents:
36030
diff
changeset
|
19 |
> eolmap = {b'\n': '\\n', b'\r\n': '\\r\\n'} |
36030
b85b0bbed6de
py3: replace file() with open() in test-eol.t
Pulkit Goyal <7895pulkit@gmail.com>
parents:
33955
diff
changeset
|
20 |
> (old, new) = sys.argv[1] == 'LF' and (b'\n', b'\r\n') or (b'\r\n', b'\n') |
38330
ae3f17a87b28
py3: remove b'' from output of test-eol.t
Yuya Nishihara <yuya@tcha.org>
parents:
36030
diff
changeset
|
21 |
> print("%% switching encoding from '%s' to '%s'" |
ae3f17a87b28
py3: remove b'' from output of test-eol.t
Yuya Nishihara <yuya@tcha.org>
parents:
36030
diff
changeset
|
22 |
> % (eolmap[old], eolmap[new])) |
12419 | 23 |
> for path in sys.argv[2:]: |
36030
b85b0bbed6de
py3: replace file() with open() in test-eol.t
Pulkit Goyal <7895pulkit@gmail.com>
parents:
33955
diff
changeset
|
24 |
> data = open(path, 'rb').read() |
12419 | 25 |
> data = data.replace(old, new) |
36030
b85b0bbed6de
py3: replace file() with open() in test-eol.t
Pulkit Goyal <7895pulkit@gmail.com>
parents:
33955
diff
changeset
|
26 |
> open(path, 'wb').write(data) |
12419 | 27 |
> EOF |
11249
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
28 |
|
12419 | 29 |
$ seteol () { |
30 |
> if [ $1 = "LF" ]; then |
|
31 |
> EOL='\n' |
|
32 |
> else |
|
33 |
> EOL='\r\n' |
|
34 |
> fi |
|
35 |
> } |
|
11249
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
36 |
|
12419 | 37 |
$ makerepo () { |
38 |
> seteol $1 |
|
39 |
> echo "% setup $1 repository" |
|
40 |
> hg init repo |
|
41 |
> cd repo |
|
42 |
> cat > .hgeol <<EOF |
|
43 |
> [repository] |
|
44 |
> native = $1 |
|
45 |
> [patterns] |
|
46 |
> mixed.txt = BIN |
|
47 |
> **.txt = native |
|
48 |
> EOF |
|
49 |
> printf "first${EOL}second${EOL}third${EOL}" > a.txt |
|
50 |
> hg commit --addremove -m 'checkin' |
|
51 |
> echo |
|
52 |
> cd .. |
|
53 |
> } |
|
11249
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
54 |
|
12419 | 55 |
$ dotest () { |
56 |
> seteol $1 |
|
57 |
> echo "% hg clone repo repo-$1" |
|
58 |
> hg clone --noupdate repo repo-$1 |
|
59 |
> cd repo-$1 |
|
60 |
> cat > .hg/hgrc <<EOF |
|
61 |
> [extensions] |
|
62 |
> eol = |
|
63 |
> [eol] |
|
64 |
> native = $1 |
|
65 |
> EOF |
|
66 |
> hg update |
|
12943
7439ea4146f8
tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents:
12419
diff
changeset
|
67 |
> echo '% a.txt' |
7439ea4146f8
tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents:
12419
diff
changeset
|
68 |
> cat a.txt |
12419 | 69 |
> 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
|
70 |
> hg cat a.txt |
12419 | 71 |
> 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
|
72 |
> echo '% a.txt' |
7439ea4146f8
tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents:
12419
diff
changeset
|
73 |
> cat a.txt |
7439ea4146f8
tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents:
12419
diff
changeset
|
74 |
> hg diff |
39707
5abc47d4ca6b
tests: quote PYTHON usage
Matt Harbison <matt_harbison@yahoo.com>
parents:
38330
diff
changeset
|
75 |
> "$PYTHON" ../switch-eol.py $1 a.txt |
12419 | 76 |
> 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
|
77 |
> hg diff |
12419 | 78 |
> echo "% reverting back to $1 format" |
79 |
> 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
|
80 |
> cat a.txt |
12419 | 81 |
> printf "first\r\nsecond\n" > mixed.txt |
82 |
> hg add mixed.txt |
|
83 |
> echo "% hg commit of inconsistent .txt file marked as binary (should work)" |
|
84 |
> hg commit -m 'binary file' |
|
85 |
> echo "% hg commit of inconsistent .txt file marked as native (should fail)" |
|
86 |
> printf "first\nsecond\r\nthird\nfourth\r\n" > a.txt |
|
87 |
> hg commit -m 'inconsistent file' |
|
88 |
> echo "% hg commit --config eol.only-consistent=False (should work)" |
|
89 |
> hg commit --config eol.only-consistent=False -m 'inconsistent file' |
|
90 |
> echo "% hg commit of binary .txt file marked as native (binary files always okay)" |
|
91 |
> printf "first${EOL}\0${EOL}third${EOL}" > a.txt |
|
92 |
> hg commit -m 'binary file' |
|
93 |
> cd .. |
|
94 |
> rm -r repo-$1 |
|
95 |
> } |
|
11249
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
96 |
|
12419 | 97 |
$ makemixedrepo () { |
98 |
> echo |
|
99 |
> echo "# setup $1 repository" |
|
100 |
> hg init mixed |
|
101 |
> cd mixed |
|
102 |
> printf "foo\r\nbar\r\nbaz\r\n" > win.txt |
|
103 |
> printf "foo\nbar\nbaz\n" > unix.txt |
|
104 |
> #printf "foo\r\nbar\nbaz\r\n" > mixed.txt |
|
105 |
> hg commit --addremove -m 'created mixed files' |
|
106 |
> echo "# setting repository-native EOLs to $1" |
|
107 |
> cat > .hgeol <<EOF |
|
108 |
> [repository] |
|
109 |
> native = $1 |
|
110 |
> [patterns] |
|
111 |
> **.txt = native |
|
112 |
> EOF |
|
113 |
> hg commit --addremove -m 'added .hgeol' |
|
114 |
> cd .. |
|
115 |
> } |
|
11249
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
116 |
|
12419 | 117 |
$ testmixed () { |
118 |
> echo |
|
119 |
> echo "% hg clone mixed mixed-$1" |
|
120 |
> hg clone mixed mixed-$1 |
|
121 |
> cd mixed-$1 |
|
122 |
> echo '% hg status (eol extension not yet activated)' |
|
123 |
> hg status |
|
124 |
> cat > .hg/hgrc <<EOF |
|
125 |
> [extensions] |
|
126 |
> eol = |
|
127 |
> [eol] |
|
128 |
> native = $1 |
|
129 |
> EOF |
|
130 |
> echo '% hg status (eol activated)' |
|
131 |
> hg status |
|
132 |
> echo '% hg commit' |
|
133 |
> hg commit -m 'synchronized EOLs' |
|
134 |
> echo '% hg status' |
|
135 |
> hg status |
|
136 |
> cd .. |
|
137 |
> rm -r mixed-$1 |
|
138 |
> } |
|
11249
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
139 |
|
12419 | 140 |
Basic tests |
11249
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
141 |
|
12419 | 142 |
$ makerepo LF |
143 |
% setup LF repository |
|
144 |
adding .hgeol |
|
145 |
adding a.txt |
|
146 |
||
147 |
$ dotest LF |
|
148 |
% hg clone repo repo-LF |
|
149 |
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
|
150 |
% a.txt |
12419 | 151 |
first |
152 |
second |
|
153 |
third |
|
154 |
% hg cat a.txt |
|
155 |
first |
|
156 |
second |
|
157 |
third |
|
12943
7439ea4146f8
tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents:
12419
diff
changeset
|
158 |
% a.txt |
12419 | 159 |
first |
160 |
second |
|
161 |
third |
|
162 |
fourth |
|
163 |
diff --git a/a.txt b/a.txt |
|
164 |
--- a/a.txt |
|
165 |
+++ b/a.txt |
|
166 |
@@ -1,3 +1,4 @@ |
|
167 |
first |
|
168 |
second |
|
169 |
third |
|
170 |
+fourth |
|
171 |
% switching encoding from '\n' to '\r\n' |
|
172 |
% hg diff only reports a single changed line: |
|
173 |
diff --git a/a.txt b/a.txt |
|
174 |
--- a/a.txt |
|
175 |
+++ b/a.txt |
|
176 |
@@ -1,3 +1,4 @@ |
|
177 |
first |
|
178 |
second |
|
179 |
third |
|
180 |
+fourth |
|
181 |
% reverting back to LF format |
|
182 |
first |
|
183 |
second |
|
184 |
third |
|
185 |
% hg commit of inconsistent .txt file marked as binary (should work) |
|
186 |
% hg commit of inconsistent .txt file marked as native (should fail) |
|
187 |
abort: inconsistent newline style in a.txt |
|
188 |
||
189 |
% hg commit --config eol.only-consistent=False (should work) |
|
190 |
% hg commit of binary .txt file marked as native (binary files always okay) |
|
191 |
$ dotest CRLF |
|
192 |
% hg clone repo repo-CRLF |
|
193 |
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
|
194 |
% a.txt |
7439ea4146f8
tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents:
12419
diff
changeset
|
195 |
first\r (esc) |
7439ea4146f8
tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents:
12419
diff
changeset
|
196 |
second\r (esc) |
7439ea4146f8
tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents:
12419
diff
changeset
|
197 |
third\r (esc) |
12419 | 198 |
% hg cat a.txt |
199 |
first |
|
200 |
second |
|
201 |
third |
|
12943
7439ea4146f8
tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents:
12419
diff
changeset
|
202 |
% a.txt |
7439ea4146f8
tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents:
12419
diff
changeset
|
203 |
first\r (esc) |
7439ea4146f8
tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents:
12419
diff
changeset
|
204 |
second\r (esc) |
7439ea4146f8
tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents:
12419
diff
changeset
|
205 |
third\r (esc) |
7439ea4146f8
tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents:
12419
diff
changeset
|
206 |
fourth\r (esc) |
12419 | 207 |
diff --git a/a.txt b/a.txt |
208 |
--- a/a.txt |
|
209 |
+++ b/a.txt |
|
210 |
@@ -1,3 +1,4 @@ |
|
211 |
first |
|
212 |
second |
|
213 |
third |
|
214 |
+fourth |
|
215 |
% switching encoding from '\r\n' to '\n' |
|
216 |
% hg diff only reports a single changed line: |
|
217 |
diff --git a/a.txt b/a.txt |
|
218 |
--- a/a.txt |
|
219 |
+++ b/a.txt |
|
220 |
@@ -1,3 +1,4 @@ |
|
221 |
first |
|
222 |
second |
|
223 |
third |
|
224 |
+fourth |
|
225 |
% 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
|
226 |
first\r (esc) |
7439ea4146f8
tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents:
12419
diff
changeset
|
227 |
second\r (esc) |
7439ea4146f8
tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents:
12419
diff
changeset
|
228 |
third\r (esc) |
12419 | 229 |
% hg commit of inconsistent .txt file marked as binary (should work) |
230 |
% hg commit of inconsistent .txt file marked as native (should fail) |
|
231 |
abort: inconsistent newline style in a.txt |
|
232 |
||
233 |
% hg commit --config eol.only-consistent=False (should work) |
|
234 |
% hg commit of binary .txt file marked as native (binary files always okay) |
|
235 |
$ rm -r repo |
|
236 |
$ makerepo CRLF |
|
237 |
% setup CRLF repository |
|
238 |
adding .hgeol |
|
239 |
adding a.txt |
|
240 |
||
241 |
$ dotest LF |
|
242 |
% hg clone repo repo-LF |
|
243 |
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
|
244 |
% a.txt |
12419 | 245 |
first |
246 |
second |
|
247 |
third |
|
248 |
% 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
|
249 |
first\r (esc) |
7439ea4146f8
tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents:
12419
diff
changeset
|
250 |
second\r (esc) |
7439ea4146f8
tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents:
12419
diff
changeset
|
251 |
third\r (esc) |
7439ea4146f8
tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents:
12419
diff
changeset
|
252 |
% a.txt |
12419 | 253 |
first |
254 |
second |
|
255 |
third |
|
256 |
fourth |
|
257 |
diff --git a/a.txt b/a.txt |
|
258 |
--- a/a.txt |
|
259 |
+++ b/a.txt |
|
260 |
@@ -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
|
261 |
first\r (esc) |
7439ea4146f8
tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents:
12419
diff
changeset
|
262 |
second\r (esc) |
7439ea4146f8
tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents:
12419
diff
changeset
|
263 |
third\r (esc) |
7439ea4146f8
tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents:
12419
diff
changeset
|
264 |
+fourth\r (esc) |
12419 | 265 |
% switching encoding from '\n' to '\r\n' |
266 |
% hg diff only reports a single changed line: |
|
267 |
diff --git a/a.txt b/a.txt |
|
268 |
--- a/a.txt |
|
269 |
+++ b/a.txt |
|
270 |
@@ -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
|
271 |
first\r (esc) |
7439ea4146f8
tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents:
12419
diff
changeset
|
272 |
second\r (esc) |
7439ea4146f8
tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents:
12419
diff
changeset
|
273 |
third\r (esc) |
7439ea4146f8
tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents:
12419
diff
changeset
|
274 |
+fourth\r (esc) |
12419 | 275 |
% reverting back to LF format |
276 |
first |
|
277 |
second |
|
278 |
third |
|
279 |
% hg commit of inconsistent .txt file marked as binary (should work) |
|
280 |
% hg commit of inconsistent .txt file marked as native (should fail) |
|
281 |
abort: inconsistent newline style in a.txt |
|
282 |
||
283 |
% hg commit --config eol.only-consistent=False (should work) |
|
284 |
% hg commit of binary .txt file marked as native (binary files always okay) |
|
285 |
$ dotest CRLF |
|
286 |
% hg clone repo repo-CRLF |
|
287 |
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
|
288 |
% a.txt |
7439ea4146f8
tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents:
12419
diff
changeset
|
289 |
first\r (esc) |
7439ea4146f8
tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents:
12419
diff
changeset
|
290 |
second\r (esc) |
7439ea4146f8
tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents:
12419
diff
changeset
|
291 |
third\r (esc) |
12419 | 292 |
% 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
|
293 |
first\r (esc) |
7439ea4146f8
tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents:
12419
diff
changeset
|
294 |
second\r (esc) |
7439ea4146f8
tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents:
12419
diff
changeset
|
295 |
third\r (esc) |
7439ea4146f8
tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents:
12419
diff
changeset
|
296 |
% a.txt |
7439ea4146f8
tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents:
12419
diff
changeset
|
297 |
first\r (esc) |
7439ea4146f8
tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents:
12419
diff
changeset
|
298 |
second\r (esc) |
7439ea4146f8
tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents:
12419
diff
changeset
|
299 |
third\r (esc) |
7439ea4146f8
tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents:
12419
diff
changeset
|
300 |
fourth\r (esc) |
12419 | 301 |
diff --git a/a.txt b/a.txt |
302 |
--- a/a.txt |
|
303 |
+++ b/a.txt |
|
304 |
@@ -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
|
305 |
first\r (esc) |
7439ea4146f8
tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents:
12419
diff
changeset
|
306 |
second\r (esc) |
7439ea4146f8
tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents:
12419
diff
changeset
|
307 |
third\r (esc) |
7439ea4146f8
tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents:
12419
diff
changeset
|
308 |
+fourth\r (esc) |
12419 | 309 |
% switching encoding from '\r\n' to '\n' |
310 |
% hg diff only reports a single changed line: |
|
311 |
diff --git a/a.txt b/a.txt |
|
312 |
--- a/a.txt |
|
313 |
+++ b/a.txt |
|
314 |
@@ -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
|
315 |
first\r (esc) |
7439ea4146f8
tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents:
12419
diff
changeset
|
316 |
second\r (esc) |
7439ea4146f8
tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents:
12419
diff
changeset
|
317 |
third\r (esc) |
7439ea4146f8
tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents:
12419
diff
changeset
|
318 |
+fourth\r (esc) |
12419 | 319 |
% 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
|
320 |
first\r (esc) |
7439ea4146f8
tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents:
12419
diff
changeset
|
321 |
second\r (esc) |
7439ea4146f8
tests: use (esc) instead of other kinds of string escaping
Mads Kiilerich <mads@kiilerich.com>
parents:
12419
diff
changeset
|
322 |
third\r (esc) |
12419 | 323 |
% hg commit of inconsistent .txt file marked as binary (should work) |
324 |
% hg commit of inconsistent .txt file marked as native (should fail) |
|
325 |
abort: inconsistent newline style in a.txt |
|
326 |
||
327 |
% hg commit --config eol.only-consistent=False (should work) |
|
328 |
% hg commit of binary .txt file marked as native (binary files always okay) |
|
329 |
$ rm -r repo |
|
11249
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
330 |
|
12419 | 331 |
Mixed tests |
11249
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
332 |
|
12419 | 333 |
$ makemixedrepo LF |
334 |
||
335 |
# setup LF repository |
|
336 |
adding unix.txt |
|
337 |
adding win.txt |
|
338 |
# setting repository-native EOLs to LF |
|
339 |
adding .hgeol |
|
340 |
$ testmixed LF |
|
341 |
||
342 |
% hg clone mixed mixed-LF |
|
343 |
updating to branch default |
|
344 |
3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
345 |
% hg status (eol extension not yet activated) |
|
346 |
% hg status (eol activated) |
|
347 |
M win.txt |
|
348 |
% hg commit |
|
349 |
% hg status |
|
350 |
$ testmixed CRLF |
|
351 |
||
352 |
% hg clone mixed mixed-CRLF |
|
353 |
updating to branch default |
|
354 |
3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
355 |
% hg status (eol extension not yet activated) |
|
356 |
% hg status (eol activated) |
|
357 |
M win.txt |
|
358 |
% hg commit |
|
359 |
% hg status |
|
360 |
$ rm -r mixed |
|
361 |
$ makemixedrepo CRLF |
|
362 |
||
363 |
# setup CRLF repository |
|
364 |
adding unix.txt |
|
365 |
adding win.txt |
|
366 |
# setting repository-native EOLs to CRLF |
|
367 |
adding .hgeol |
|
368 |
$ testmixed LF |
|
369 |
||
370 |
% hg clone mixed mixed-LF |
|
371 |
updating to branch default |
|
372 |
3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
373 |
% hg status (eol extension not yet activated) |
|
374 |
% hg status (eol activated) |
|
375 |
M unix.txt |
|
376 |
% hg commit |
|
377 |
% hg status |
|
378 |
$ testmixed CRLF |
|
379 |
||
380 |
% hg clone mixed mixed-CRLF |
|
381 |
updating to branch default |
|
382 |
3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
383 |
% hg status (eol extension not yet activated) |
|
384 |
% hg status (eol activated) |
|
385 |
M unix.txt |
|
386 |
% hg commit |
|
387 |
% hg status |
|
388 |
$ rm -r mixed |
|
13475
c7bef25ca393
eol: handle LockUnavailable error (issue2569)
Martin Geisler <mg@aragost.com>
parents:
12943
diff
changeset
|
389 |
|
16986
79902f7e27df
tests: convert some hghave unix-permissions to #if
Mads Kiilerich <mads@kiilerich.com>
parents:
16913
diff
changeset
|
390 |
$ echo '[extensions]' >> $HGRCPATH |
79902f7e27df
tests: convert some hghave unix-permissions to #if
Mads Kiilerich <mads@kiilerich.com>
parents:
16913
diff
changeset
|
391 |
$ echo 'eol =' >> $HGRCPATH |
79902f7e27df
tests: convert some hghave unix-permissions to #if
Mads Kiilerich <mads@kiilerich.com>
parents:
16913
diff
changeset
|
392 |
|
79902f7e27df
tests: convert some hghave unix-permissions to #if
Mads Kiilerich <mads@kiilerich.com>
parents:
16913
diff
changeset
|
393 |
#if unix-permissions |
79902f7e27df
tests: convert some hghave unix-permissions to #if
Mads Kiilerich <mads@kiilerich.com>
parents:
16913
diff
changeset
|
394 |
|
13475
c7bef25ca393
eol: handle LockUnavailable error (issue2569)
Martin Geisler <mg@aragost.com>
parents:
12943
diff
changeset
|
395 |
Test issue2569 -- eol extension takes write lock on reading: |
c7bef25ca393
eol: handle LockUnavailable error (issue2569)
Martin Geisler <mg@aragost.com>
parents:
12943
diff
changeset
|
396 |
|
c7bef25ca393
eol: handle LockUnavailable error (issue2569)
Martin Geisler <mg@aragost.com>
parents:
12943
diff
changeset
|
397 |
$ hg init repo |
c7bef25ca393
eol: handle LockUnavailable error (issue2569)
Martin Geisler <mg@aragost.com>
parents:
12943
diff
changeset
|
398 |
$ cd repo |
c7bef25ca393
eol: handle LockUnavailable error (issue2569)
Martin Geisler <mg@aragost.com>
parents:
12943
diff
changeset
|
399 |
$ touch .hgeol |
c7bef25ca393
eol: handle LockUnavailable error (issue2569)
Martin Geisler <mg@aragost.com>
parents:
12943
diff
changeset
|
400 |
$ hg status |
c7bef25ca393
eol: handle LockUnavailable error (issue2569)
Martin Geisler <mg@aragost.com>
parents:
12943
diff
changeset
|
401 |
? .hgeol |
c7bef25ca393
eol: handle LockUnavailable error (issue2569)
Martin Geisler <mg@aragost.com>
parents:
12943
diff
changeset
|
402 |
$ chmod -R -w .hg |
c7bef25ca393
eol: handle LockUnavailable error (issue2569)
Martin Geisler <mg@aragost.com>
parents:
12943
diff
changeset
|
403 |
$ sleep 1 |
c7bef25ca393
eol: handle LockUnavailable error (issue2569)
Martin Geisler <mg@aragost.com>
parents:
12943
diff
changeset
|
404 |
$ touch .hgeol |
c7bef25ca393
eol: handle LockUnavailable error (issue2569)
Martin Geisler <mg@aragost.com>
parents:
12943
diff
changeset
|
405 |
$ hg status --traceback |
c7bef25ca393
eol: handle LockUnavailable error (issue2569)
Martin Geisler <mg@aragost.com>
parents:
12943
diff
changeset
|
406 |
? .hgeol |
13621
c0b0b00f0279
tests: fix permission issue trying to remove test directory
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
13505
diff
changeset
|
407 |
$ chmod -R u+w .hg |
13503
5007ff32f356
eol: test win32text compatible encode/decode filters
Martin Geisler <mg@aragost.com>
parents:
13475
diff
changeset
|
408 |
$ cd .. |
5007ff32f356
eol: test win32text compatible encode/decode filters
Martin Geisler <mg@aragost.com>
parents:
13475
diff
changeset
|
409 |
|
16986
79902f7e27df
tests: convert some hghave unix-permissions to #if
Mads Kiilerich <mads@kiilerich.com>
parents:
16913
diff
changeset
|
410 |
#endif |
79902f7e27df
tests: convert some hghave unix-permissions to #if
Mads Kiilerich <mads@kiilerich.com>
parents:
16913
diff
changeset
|
411 |
|
13503
5007ff32f356
eol: test win32text compatible encode/decode filters
Martin Geisler <mg@aragost.com>
parents:
13475
diff
changeset
|
412 |
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
|
413 |
|
23172
e955549cd045
tests: write hgrc of more than two lines by using shell heredoc
Yuya Nishihara <yuya@tcha.org>
parents:
23068
diff
changeset
|
414 |
$ cat <<EOF >> $HGRCPATH |
e955549cd045
tests: write hgrc of more than two lines by using shell heredoc
Yuya Nishihara <yuya@tcha.org>
parents:
23068
diff
changeset
|
415 |
> [encode] |
e955549cd045
tests: write hgrc of more than two lines by using shell heredoc
Yuya Nishihara <yuya@tcha.org>
parents:
23068
diff
changeset
|
416 |
> **.txt = cleverencode: |
e955549cd045
tests: write hgrc of more than two lines by using shell heredoc
Yuya Nishihara <yuya@tcha.org>
parents:
23068
diff
changeset
|
417 |
> [decode] |
e955549cd045
tests: write hgrc of more than two lines by using shell heredoc
Yuya Nishihara <yuya@tcha.org>
parents:
23068
diff
changeset
|
418 |
> **.txt = cleverdecode: |
e955549cd045
tests: write hgrc of more than two lines by using shell heredoc
Yuya Nishihara <yuya@tcha.org>
parents:
23068
diff
changeset
|
419 |
> EOF |
13503
5007ff32f356
eol: test win32text compatible encode/decode filters
Martin Geisler <mg@aragost.com>
parents:
13475
diff
changeset
|
420 |
|
5007ff32f356
eol: test win32text compatible encode/decode filters
Martin Geisler <mg@aragost.com>
parents:
13475
diff
changeset
|
421 |
$ hg init win32compat |
5007ff32f356
eol: test win32text compatible encode/decode filters
Martin Geisler <mg@aragost.com>
parents:
13475
diff
changeset
|
422 |
$ cd win32compat |
5007ff32f356
eol: test win32text compatible encode/decode filters
Martin Geisler <mg@aragost.com>
parents:
13475
diff
changeset
|
423 |
$ 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
|
424 |
$ printf "foo\nbar\nbaz\n" > unix.txt |
5007ff32f356
eol: test win32text compatible encode/decode filters
Martin Geisler <mg@aragost.com>
parents:
13475
diff
changeset
|
425 |
$ hg add |
5007ff32f356
eol: test win32text compatible encode/decode filters
Martin Geisler <mg@aragost.com>
parents:
13475
diff
changeset
|
426 |
adding unix.txt |
5007ff32f356
eol: test win32text compatible encode/decode filters
Martin Geisler <mg@aragost.com>
parents:
13475
diff
changeset
|
427 |
adding win.txt |
5007ff32f356
eol: test win32text compatible encode/decode filters
Martin Geisler <mg@aragost.com>
parents:
13475
diff
changeset
|
428 |
$ hg commit -m checkin |
5007ff32f356
eol: test win32text compatible encode/decode filters
Martin Geisler <mg@aragost.com>
parents:
13475
diff
changeset
|
429 |
|
5007ff32f356
eol: test win32text compatible encode/decode filters
Martin Geisler <mg@aragost.com>
parents:
13475
diff
changeset
|
430 |
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
|
431 |
|
5007ff32f356
eol: test win32text compatible encode/decode filters
Martin Geisler <mg@aragost.com>
parents:
13475
diff
changeset
|
432 |
$ hg cat win.txt |
5007ff32f356
eol: test win32text compatible encode/decode filters
Martin Geisler <mg@aragost.com>
parents:
13475
diff
changeset
|
433 |
foo |
5007ff32f356
eol: test win32text compatible encode/decode filters
Martin Geisler <mg@aragost.com>
parents:
13475
diff
changeset
|
434 |
bar |
5007ff32f356
eol: test win32text compatible encode/decode filters
Martin Geisler <mg@aragost.com>
parents:
13475
diff
changeset
|
435 |
baz |
5007ff32f356
eol: test win32text compatible encode/decode filters
Martin Geisler <mg@aragost.com>
parents:
13475
diff
changeset
|
436 |
$ hg cat unix.txt |
5007ff32f356
eol: test win32text compatible encode/decode filters
Martin Geisler <mg@aragost.com>
parents:
13475
diff
changeset
|
437 |
foo |
5007ff32f356
eol: test win32text compatible encode/decode filters
Martin Geisler <mg@aragost.com>
parents:
13475
diff
changeset
|
438 |
bar |
5007ff32f356
eol: test win32text compatible encode/decode filters
Martin Geisler <mg@aragost.com>
parents:
13475
diff
changeset
|
439 |
baz |
13505
9b617c56eb65
eol: do not abort on parse error
Martin Geisler <mg@aragost.com>
parents:
13504
diff
changeset
|
440 |
|
9b617c56eb65
eol: do not abort on parse error
Martin Geisler <mg@aragost.com>
parents:
13504
diff
changeset
|
441 |
Test handling of a broken .hgeol file: |
9b617c56eb65
eol: do not abort on parse error
Martin Geisler <mg@aragost.com>
parents:
13504
diff
changeset
|
442 |
|
9b617c56eb65
eol: do not abort on parse error
Martin Geisler <mg@aragost.com>
parents:
13504
diff
changeset
|
443 |
$ touch .hgeol |
9b617c56eb65
eol: do not abort on parse error
Martin Geisler <mg@aragost.com>
parents:
13504
diff
changeset
|
444 |
$ hg add .hgeol |
9b617c56eb65
eol: do not abort on parse error
Martin Geisler <mg@aragost.com>
parents:
13504
diff
changeset
|
445 |
$ hg commit -m 'clean version' |
9b617c56eb65
eol: do not abort on parse error
Martin Geisler <mg@aragost.com>
parents:
13504
diff
changeset
|
446 |
$ echo "bad" > .hgeol |
9b617c56eb65
eol: do not abort on parse error
Martin Geisler <mg@aragost.com>
parents:
13504
diff
changeset
|
447 |
$ hg status |
9b617c56eb65
eol: do not abort on parse error
Martin Geisler <mg@aragost.com>
parents:
13504
diff
changeset
|
448 |
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
|
449 |
M .hgeol |
9b617c56eb65
eol: do not abort on parse error
Martin Geisler <mg@aragost.com>
parents:
13504
diff
changeset
|
450 |
$ hg revert .hgeol |
9b617c56eb65
eol: do not abort on parse error
Martin Geisler <mg@aragost.com>
parents:
13504
diff
changeset
|
451 |
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
|
452 |
$ hg status |
9b617c56eb65
eol: do not abort on parse error
Martin Geisler <mg@aragost.com>
parents:
13504
diff
changeset
|
453 |
? .hgeol.orig |
14854
23c2d7d25329
eol: eol.only-consistent can now be specified in .hgeol
Stepan Koltsov <stepancheg@yandex-team.ru>
parents:
13623
diff
changeset
|
454 |
|
23c2d7d25329
eol: eol.only-consistent can now be specified in .hgeol
Stepan Koltsov <stepancheg@yandex-team.ru>
parents:
13623
diff
changeset
|
455 |
Test eol.only-consistent can be specified in .hgeol |
23c2d7d25329
eol: eol.only-consistent can now be specified in .hgeol
Stepan Koltsov <stepancheg@yandex-team.ru>
parents:
13623
diff
changeset
|
456 |
|
23c2d7d25329
eol: eol.only-consistent can now be specified in .hgeol
Stepan Koltsov <stepancheg@yandex-team.ru>
parents:
13623
diff
changeset
|
457 |
$ cd $TESTTMP |
23c2d7d25329
eol: eol.only-consistent can now be specified in .hgeol
Stepan Koltsov <stepancheg@yandex-team.ru>
parents:
13623
diff
changeset
|
458 |
$ hg init only-consistent |
23c2d7d25329
eol: eol.only-consistent can now be specified in .hgeol
Stepan Koltsov <stepancheg@yandex-team.ru>
parents:
13623
diff
changeset
|
459 |
$ cd only-consistent |
23c2d7d25329
eol: eol.only-consistent can now be specified in .hgeol
Stepan Koltsov <stepancheg@yandex-team.ru>
parents:
13623
diff
changeset
|
460 |
$ printf "first\nsecond\r\n" > a.txt |
23c2d7d25329
eol: eol.only-consistent can now be specified in .hgeol
Stepan Koltsov <stepancheg@yandex-team.ru>
parents:
13623
diff
changeset
|
461 |
$ hg add a.txt |
23c2d7d25329
eol: eol.only-consistent can now be specified in .hgeol
Stepan Koltsov <stepancheg@yandex-team.ru>
parents:
13623
diff
changeset
|
462 |
$ cat > .hgeol << EOF |
23c2d7d25329
eol: eol.only-consistent can now be specified in .hgeol
Stepan Koltsov <stepancheg@yandex-team.ru>
parents:
13623
diff
changeset
|
463 |
> [eol] |
23c2d7d25329
eol: eol.only-consistent can now be specified in .hgeol
Stepan Koltsov <stepancheg@yandex-team.ru>
parents:
13623
diff
changeset
|
464 |
> only-consistent = True |
23c2d7d25329
eol: eol.only-consistent can now be specified in .hgeol
Stepan Koltsov <stepancheg@yandex-team.ru>
parents:
13623
diff
changeset
|
465 |
> EOF |
23c2d7d25329
eol: eol.only-consistent can now be specified in .hgeol
Stepan Koltsov <stepancheg@yandex-team.ru>
parents:
13623
diff
changeset
|
466 |
$ hg commit -m 'inconsistent' |
23c2d7d25329
eol: eol.only-consistent can now be specified in .hgeol
Stepan Koltsov <stepancheg@yandex-team.ru>
parents:
13623
diff
changeset
|
467 |
abort: inconsistent newline style in a.txt |
23c2d7d25329
eol: eol.only-consistent can now be specified in .hgeol
Stepan Koltsov <stepancheg@yandex-team.ru>
parents:
13623
diff
changeset
|
468 |
|
23c2d7d25329
eol: eol.only-consistent can now be specified in .hgeol
Stepan Koltsov <stepancheg@yandex-team.ru>
parents:
13623
diff
changeset
|
469 |
[255] |
23c2d7d25329
eol: eol.only-consistent can now be specified in .hgeol
Stepan Koltsov <stepancheg@yandex-team.ru>
parents:
13623
diff
changeset
|
470 |
$ cat > .hgeol << EOF |
23c2d7d25329
eol: eol.only-consistent can now be specified in .hgeol
Stepan Koltsov <stepancheg@yandex-team.ru>
parents:
13623
diff
changeset
|
471 |
> [eol] |
23c2d7d25329
eol: eol.only-consistent can now be specified in .hgeol
Stepan Koltsov <stepancheg@yandex-team.ru>
parents:
13623
diff
changeset
|
472 |
> only-consistent = False |
23c2d7d25329
eol: eol.only-consistent can now be specified in .hgeol
Stepan Koltsov <stepancheg@yandex-team.ru>
parents:
13623
diff
changeset
|
473 |
> EOF |
23c2d7d25329
eol: eol.only-consistent can now be specified in .hgeol
Stepan Koltsov <stepancheg@yandex-team.ru>
parents:
13623
diff
changeset
|
474 |
$ hg commit -m 'consistent' |
23c2d7d25329
eol: eol.only-consistent can now be specified in .hgeol
Stepan Koltsov <stepancheg@yandex-team.ru>
parents:
13623
diff
changeset
|
475 |
|
31099
b44ab288358e
subrepo: run the repo decoders when archiving
Matt Harbison <matt_harbison@yahoo.com>
parents:
23172
diff
changeset
|
476 |
$ hg init subrepo |
b44ab288358e
subrepo: run the repo decoders when archiving
Matt Harbison <matt_harbison@yahoo.com>
parents:
23172
diff
changeset
|
477 |
$ hg -R subrepo pull -qu . |
b44ab288358e
subrepo: run the repo decoders when archiving
Matt Harbison <matt_harbison@yahoo.com>
parents:
23172
diff
changeset
|
478 |
$ echo "subrepo = subrepo" > .hgsub |
b44ab288358e
subrepo: run the repo decoders when archiving
Matt Harbison <matt_harbison@yahoo.com>
parents:
23172
diff
changeset
|
479 |
$ hg ci -Am "add subrepo" |
b44ab288358e
subrepo: run the repo decoders when archiving
Matt Harbison <matt_harbison@yahoo.com>
parents:
23172
diff
changeset
|
480 |
adding .hgeol |
b44ab288358e
subrepo: run the repo decoders when archiving
Matt Harbison <matt_harbison@yahoo.com>
parents:
23172
diff
changeset
|
481 |
adding .hgsub |
b44ab288358e
subrepo: run the repo decoders when archiving
Matt Harbison <matt_harbison@yahoo.com>
parents:
23172
diff
changeset
|
482 |
$ hg archive -S ../archive |
b44ab288358e
subrepo: run the repo decoders when archiving
Matt Harbison <matt_harbison@yahoo.com>
parents:
23172
diff
changeset
|
483 |
$ find ../archive/* | sort |
b44ab288358e
subrepo: run the repo decoders when archiving
Matt Harbison <matt_harbison@yahoo.com>
parents:
23172
diff
changeset
|
484 |
../archive/a.txt |
b44ab288358e
subrepo: run the repo decoders when archiving
Matt Harbison <matt_harbison@yahoo.com>
parents:
23172
diff
changeset
|
485 |
../archive/subrepo |
b44ab288358e
subrepo: run the repo decoders when archiving
Matt Harbison <matt_harbison@yahoo.com>
parents:
23172
diff
changeset
|
486 |
../archive/subrepo/a.txt |
b44ab288358e
subrepo: run the repo decoders when archiving
Matt Harbison <matt_harbison@yahoo.com>
parents:
23172
diff
changeset
|
487 |
$ cat ../archive/a.txt ../archive/subrepo/a.txt |
b44ab288358e
subrepo: run the repo decoders when archiving
Matt Harbison <matt_harbison@yahoo.com>
parents:
23172
diff
changeset
|
488 |
first\r (esc) |
b44ab288358e
subrepo: run the repo decoders when archiving
Matt Harbison <matt_harbison@yahoo.com>
parents:
23172
diff
changeset
|
489 |
second\r (esc) |
b44ab288358e
subrepo: run the repo decoders when archiving
Matt Harbison <matt_harbison@yahoo.com>
parents:
23172
diff
changeset
|
490 |
first\r (esc) |
b44ab288358e
subrepo: run the repo decoders when archiving
Matt Harbison <matt_harbison@yahoo.com>
parents:
23172
diff
changeset
|
491 |
second\r (esc) |
14855
f33579435378
eol: fix missing trailing newlines in comitted files
Stepan Koltsov <stepancheg@yandex-team.ru>
parents:
14854
diff
changeset
|
492 |
|
f33579435378
eol: fix missing trailing newlines in comitted files
Stepan Koltsov <stepancheg@yandex-team.ru>
parents:
14854
diff
changeset
|
493 |
Test trailing newline |
f33579435378
eol: fix missing trailing newlines in comitted files
Stepan Koltsov <stepancheg@yandex-team.ru>
parents:
14854
diff
changeset
|
494 |
|
f33579435378
eol: fix missing trailing newlines in comitted files
Stepan Koltsov <stepancheg@yandex-team.ru>
parents:
14854
diff
changeset
|
495 |
$ cat >> $HGRCPATH <<EOF |
f33579435378
eol: fix missing trailing newlines in comitted files
Stepan Koltsov <stepancheg@yandex-team.ru>
parents:
14854
diff
changeset
|
496 |
> [extensions] |
f33579435378
eol: fix missing trailing newlines in comitted files
Stepan Koltsov <stepancheg@yandex-team.ru>
parents:
14854
diff
changeset
|
497 |
> eol= |
f33579435378
eol: fix missing trailing newlines in comitted files
Stepan Koltsov <stepancheg@yandex-team.ru>
parents:
14854
diff
changeset
|
498 |
> EOF |
f33579435378
eol: fix missing trailing newlines in comitted files
Stepan Koltsov <stepancheg@yandex-team.ru>
parents:
14854
diff
changeset
|
499 |
|
f33579435378
eol: fix missing trailing newlines in comitted files
Stepan Koltsov <stepancheg@yandex-team.ru>
parents:
14854
diff
changeset
|
500 |
setup repository |
f33579435378
eol: fix missing trailing newlines in comitted files
Stepan Koltsov <stepancheg@yandex-team.ru>
parents:
14854
diff
changeset
|
501 |
|
f33579435378
eol: fix missing trailing newlines in comitted files
Stepan Koltsov <stepancheg@yandex-team.ru>
parents:
14854
diff
changeset
|
502 |
$ cd $TESTTMP |
f33579435378
eol: fix missing trailing newlines in comitted files
Stepan Koltsov <stepancheg@yandex-team.ru>
parents:
14854
diff
changeset
|
503 |
$ hg init trailing |
f33579435378
eol: fix missing trailing newlines in comitted files
Stepan Koltsov <stepancheg@yandex-team.ru>
parents:
14854
diff
changeset
|
504 |
$ cd trailing |
f33579435378
eol: fix missing trailing newlines in comitted files
Stepan Koltsov <stepancheg@yandex-team.ru>
parents:
14854
diff
changeset
|
505 |
$ cat > .hgeol <<EOF |
f33579435378
eol: fix missing trailing newlines in comitted files
Stepan Koltsov <stepancheg@yandex-team.ru>
parents:
14854
diff
changeset
|
506 |
> [patterns] |
f33579435378
eol: fix missing trailing newlines in comitted files
Stepan Koltsov <stepancheg@yandex-team.ru>
parents:
14854
diff
changeset
|
507 |
> **.txt = native |
f33579435378
eol: fix missing trailing newlines in comitted files
Stepan Koltsov <stepancheg@yandex-team.ru>
parents:
14854
diff
changeset
|
508 |
> [eol] |
f33579435378
eol: fix missing trailing newlines in comitted files
Stepan Koltsov <stepancheg@yandex-team.ru>
parents:
14854
diff
changeset
|
509 |
> fix-trailing-newline = False |
f33579435378
eol: fix missing trailing newlines in comitted files
Stepan Koltsov <stepancheg@yandex-team.ru>
parents:
14854
diff
changeset
|
510 |
> EOF |
f33579435378
eol: fix missing trailing newlines in comitted files
Stepan Koltsov <stepancheg@yandex-team.ru>
parents:
14854
diff
changeset
|
511 |
|
f33579435378
eol: fix missing trailing newlines in comitted files
Stepan Koltsov <stepancheg@yandex-team.ru>
parents:
14854
diff
changeset
|
512 |
add text without trailing newline |
f33579435378
eol: fix missing trailing newlines in comitted files
Stepan Koltsov <stepancheg@yandex-team.ru>
parents:
14854
diff
changeset
|
513 |
|
f33579435378
eol: fix missing trailing newlines in comitted files
Stepan Koltsov <stepancheg@yandex-team.ru>
parents:
14854
diff
changeset
|
514 |
$ printf "first\nsecond" > a.txt |
f33579435378
eol: fix missing trailing newlines in comitted files
Stepan Koltsov <stepancheg@yandex-team.ru>
parents:
14854
diff
changeset
|
515 |
$ hg commit --addremove -m 'checking in' |
f33579435378
eol: fix missing trailing newlines in comitted files
Stepan Koltsov <stepancheg@yandex-team.ru>
parents:
14854
diff
changeset
|
516 |
adding .hgeol |
f33579435378
eol: fix missing trailing newlines in comitted files
Stepan Koltsov <stepancheg@yandex-team.ru>
parents:
14854
diff
changeset
|
517 |
adding a.txt |
f33579435378
eol: fix missing trailing newlines in comitted files
Stepan Koltsov <stepancheg@yandex-team.ru>
parents:
14854
diff
changeset
|
518 |
$ rm a.txt |
f33579435378
eol: fix missing trailing newlines in comitted files
Stepan Koltsov <stepancheg@yandex-team.ru>
parents:
14854
diff
changeset
|
519 |
$ hg update -C -q |
f33579435378
eol: fix missing trailing newlines in comitted files
Stepan Koltsov <stepancheg@yandex-team.ru>
parents:
14854
diff
changeset
|
520 |
$ cat a.txt |
f33579435378
eol: fix missing trailing newlines in comitted files
Stepan Koltsov <stepancheg@yandex-team.ru>
parents:
14854
diff
changeset
|
521 |
first |
f33579435378
eol: fix missing trailing newlines in comitted files
Stepan Koltsov <stepancheg@yandex-team.ru>
parents:
14854
diff
changeset
|
522 |
second (no-eol) |
f33579435378
eol: fix missing trailing newlines in comitted files
Stepan Koltsov <stepancheg@yandex-team.ru>
parents:
14854
diff
changeset
|
523 |
|
f33579435378
eol: fix missing trailing newlines in comitted files
Stepan Koltsov <stepancheg@yandex-team.ru>
parents:
14854
diff
changeset
|
524 |
$ cat > .hgeol <<EOF |
f33579435378
eol: fix missing trailing newlines in comitted files
Stepan Koltsov <stepancheg@yandex-team.ru>
parents:
14854
diff
changeset
|
525 |
> [patterns] |
f33579435378
eol: fix missing trailing newlines in comitted files
Stepan Koltsov <stepancheg@yandex-team.ru>
parents:
14854
diff
changeset
|
526 |
> **.txt = native |
f33579435378
eol: fix missing trailing newlines in comitted files
Stepan Koltsov <stepancheg@yandex-team.ru>
parents:
14854
diff
changeset
|
527 |
> [eol] |
f33579435378
eol: fix missing trailing newlines in comitted files
Stepan Koltsov <stepancheg@yandex-team.ru>
parents:
14854
diff
changeset
|
528 |
> fix-trailing-newline = True |
f33579435378
eol: fix missing trailing newlines in comitted files
Stepan Koltsov <stepancheg@yandex-team.ru>
parents:
14854
diff
changeset
|
529 |
> EOF |
f33579435378
eol: fix missing trailing newlines in comitted files
Stepan Koltsov <stepancheg@yandex-team.ru>
parents:
14854
diff
changeset
|
530 |
$ printf "third\nfourth" > a.txt |
f33579435378
eol: fix missing trailing newlines in comitted files
Stepan Koltsov <stepancheg@yandex-team.ru>
parents:
14854
diff
changeset
|
531 |
$ hg commit -m 'checking in with newline fix' |
f33579435378
eol: fix missing trailing newlines in comitted files
Stepan Koltsov <stepancheg@yandex-team.ru>
parents:
14854
diff
changeset
|
532 |
$ rm a.txt |
f33579435378
eol: fix missing trailing newlines in comitted files
Stepan Koltsov <stepancheg@yandex-team.ru>
parents:
14854
diff
changeset
|
533 |
$ hg update -C -q |
f33579435378
eol: fix missing trailing newlines in comitted files
Stepan Koltsov <stepancheg@yandex-team.ru>
parents:
14854
diff
changeset
|
534 |
$ cat a.txt |
f33579435378
eol: fix missing trailing newlines in comitted files
Stepan Koltsov <stepancheg@yandex-team.ru>
parents:
14854
diff
changeset
|
535 |
third |
f33579435378
eol: fix missing trailing newlines in comitted files
Stepan Koltsov <stepancheg@yandex-team.ru>
parents:
14854
diff
changeset
|
536 |
fourth |
f33579435378
eol: fix missing trailing newlines in comitted files
Stepan Koltsov <stepancheg@yandex-team.ru>
parents:
14854
diff
changeset
|
537 |
|
f33579435378
eol: fix missing trailing newlines in comitted files
Stepan Koltsov <stepancheg@yandex-team.ru>
parents:
14854
diff
changeset
|
538 |
append a line without trailing newline |
f33579435378
eol: fix missing trailing newlines in comitted files
Stepan Koltsov <stepancheg@yandex-team.ru>
parents:
14854
diff
changeset
|
539 |
|
f33579435378
eol: fix missing trailing newlines in comitted files
Stepan Koltsov <stepancheg@yandex-team.ru>
parents:
14854
diff
changeset
|
540 |
$ printf "fifth" >> a.txt |
f33579435378
eol: fix missing trailing newlines in comitted files
Stepan Koltsov <stepancheg@yandex-team.ru>
parents:
14854
diff
changeset
|
541 |
$ hg commit -m 'adding another line line' |
f33579435378
eol: fix missing trailing newlines in comitted files
Stepan Koltsov <stepancheg@yandex-team.ru>
parents:
14854
diff
changeset
|
542 |
$ rm a.txt |
f33579435378
eol: fix missing trailing newlines in comitted files
Stepan Koltsov <stepancheg@yandex-team.ru>
parents:
14854
diff
changeset
|
543 |
$ hg update -C -q |
f33579435378
eol: fix missing trailing newlines in comitted files
Stepan Koltsov <stepancheg@yandex-team.ru>
parents:
14854
diff
changeset
|
544 |
$ cat a.txt |
f33579435378
eol: fix missing trailing newlines in comitted files
Stepan Koltsov <stepancheg@yandex-team.ru>
parents:
14854
diff
changeset
|
545 |
third |
f33579435378
eol: fix missing trailing newlines in comitted files
Stepan Koltsov <stepancheg@yandex-team.ru>
parents:
14854
diff
changeset
|
546 |
fourth |
f33579435378
eol: fix missing trailing newlines in comitted files
Stepan Koltsov <stepancheg@yandex-team.ru>
parents:
14854
diff
changeset
|
547 |
fifth |
f33579435378
eol: fix missing trailing newlines in comitted files
Stepan Koltsov <stepancheg@yandex-team.ru>
parents:
14854
diff
changeset
|
548 |
|
23068
fb3e63c603e8
eol: fix crash when handling removed files
Mads Kiilerich <madski@unity3d.com>
parents:
16986
diff
changeset
|
549 |
amend of changesets with renamed/deleted files expose new code paths |
fb3e63c603e8
eol: fix crash when handling removed files
Mads Kiilerich <madski@unity3d.com>
parents:
16986
diff
changeset
|
550 |
|
fb3e63c603e8
eol: fix crash when handling removed files
Mads Kiilerich <madski@unity3d.com>
parents:
16986
diff
changeset
|
551 |
$ hg mv a.txt b.txt |
fb3e63c603e8
eol: fix crash when handling removed files
Mads Kiilerich <madski@unity3d.com>
parents:
16986
diff
changeset
|
552 |
$ hg ci --amend -q |
fb3e63c603e8
eol: fix crash when handling removed files
Mads Kiilerich <madski@unity3d.com>
parents:
16986
diff
changeset
|
553 |
$ hg diff -c. |
fb3e63c603e8
eol: fix crash when handling removed files
Mads Kiilerich <madski@unity3d.com>
parents:
16986
diff
changeset
|
554 |
diff --git a/a.txt b/b.txt |
fb3e63c603e8
eol: fix crash when handling removed files
Mads Kiilerich <madski@unity3d.com>
parents:
16986
diff
changeset
|
555 |
rename from a.txt |
fb3e63c603e8
eol: fix crash when handling removed files
Mads Kiilerich <madski@unity3d.com>
parents:
16986
diff
changeset
|
556 |
rename to b.txt |
fb3e63c603e8
eol: fix crash when handling removed files
Mads Kiilerich <madski@unity3d.com>
parents:
16986
diff
changeset
|
557 |
--- a/a.txt |
fb3e63c603e8
eol: fix crash when handling removed files
Mads Kiilerich <madski@unity3d.com>
parents:
16986
diff
changeset
|
558 |
+++ b/b.txt |
fb3e63c603e8
eol: fix crash when handling removed files
Mads Kiilerich <madski@unity3d.com>
parents:
16986
diff
changeset
|
559 |
@@ -1,2 +1,3 @@ |
fb3e63c603e8
eol: fix crash when handling removed files
Mads Kiilerich <madski@unity3d.com>
parents:
16986
diff
changeset
|
560 |
third |
fb3e63c603e8
eol: fix crash when handling removed files
Mads Kiilerich <madski@unity3d.com>
parents:
16986
diff
changeset
|
561 |
fourth |
fb3e63c603e8
eol: fix crash when handling removed files
Mads Kiilerich <madski@unity3d.com>
parents:
16986
diff
changeset
|
562 |
+fifth |
fb3e63c603e8
eol: fix crash when handling removed files
Mads Kiilerich <madski@unity3d.com>
parents:
16986
diff
changeset
|
563 |
|
16913
f2719b387380
tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents:
15443
diff
changeset
|
564 |
$ cd .. |