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