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