comparison tests/test-git-export.t @ 12193:927e1a677267

tests: unify test-git-*
author Adrian Buehlmann <adrian@cadifra.com>
date Fri, 03 Sep 2010 14:29:28 +0200
parents tests/test-git-export@6c82beaaa11a
children db0340f4b507
comparison
equal deleted inserted replaced
12192:968e9057ab8a 12193:927e1a677267
1 $ hg init
2 $ echo start > start
3 $ hg ci -Amstart
4 adding start
5
6 New file:
7
8 $ echo new > new
9 $ hg ci -Amnew
10 adding new
11 $ hg diff --git -r 0
12 diff --git a/new b/new
13 new file mode 100644
14 --- /dev/null
15 +++ b/new
16 @@ -0,0 +1,1 @@
17 +new
18
19 Copy:
20
21 $ hg cp new copy
22 $ hg ci -mcopy
23 $ hg diff --git -r 1:tip
24 diff --git a/new b/copy
25 copy from new
26 copy to copy
27
28 Rename:
29
30 $ hg mv copy rename
31 $ hg ci -mrename
32 $ hg diff --git -r 2:tip
33 diff --git a/copy b/rename
34 rename from copy
35 rename to rename
36
37 Delete:
38
39 $ hg rm rename
40 $ hg ci -mdelete
41 $ hg diff --git -r 3:tip
42 diff --git a/rename b/rename
43 deleted file mode 100644
44 --- a/rename
45 +++ /dev/null
46 @@ -1,1 +0,0 @@
47 -new
48
49 $ cat > src <<EOF
50 > 1
51 > 2
52 > 3
53 > 4
54 > 5
55 > EOF
56 $ hg ci -Amsrc
57 adding src
58
59 chmod 644:
60
61 $ chmod +x src
62 $ hg ci -munexec
63 $ hg diff --git -r 5:tip
64 diff --git a/src b/src
65 old mode 100644
66 new mode 100755
67
68 Rename+mod+chmod:
69
70 $ hg mv src dst
71 $ chmod -x dst
72 $ echo a >> dst
73 $ hg ci -mrenamemod
74 $ hg diff --git -r 6:tip
75 diff --git a/src b/dst
76 old mode 100755
77 new mode 100644
78 rename from src
79 rename to dst
80 --- a/src
81 +++ b/dst
82 @@ -3,3 +3,4 @@
83 3
84 4
85 5
86 +a
87
88 Nonexistent in tip+chmod:
89
90 $ hg diff --git -r 5:6
91 diff --git a/src b/src
92 old mode 100644
93 new mode 100755
94
95 Binary diff:
96
97 $ cp $TESTDIR/binfile.bin .
98 $ hg add binfile.bin
99 $ hg diff --git > b.diff
100 $ cat b.diff
101 diff --git a/binfile.bin b/binfile.bin
102 new file mode 100644
103 index 0000000000000000000000000000000000000000..37ba3d1c6f17137d9c5f5776fa040caf5fe73ff9
104 GIT binary patch
105 literal 593
106 zc$@)I0<QguP)<h;3K|Lk000e1NJLTq000mG000mO0ssI2kdbIM00009a7bBm000XU
107 z000XU0RWnu7ytkO2XskIMF-Uh9TW;VpMjwv0005-Nkl<ZD9@FWPs=e;7{<>W$NUkd
108 zX$nnYLt$-$V!?uy+1V%`z&Eh=ah|duER<4|QWhju3gb^nF*8iYobxWG-qqXl=2~5M
109 z*IoDB)sG^CfNuoBmqLTVU^<;@nwHP!1wrWd`{(mHo6VNXWtyh{alzqmsH*yYzpvLT
110 zLdY<T=ks|woh-`&01!ej#(xbV1f|pI*=%;d-%F*E*X#ZH`4I%6SS+$EJDE&ct=8po
111 ziN#{?_j|kD%Cd|oiqds`xm@;oJ-^?NG3Gdqrs?5u*zI;{nogxsx~^|Fn^Y?Gdc6<;
112 zfMJ+iF1J`LMx&A2?dEwNW8ClebzPTbIh{@$hS6*`kH@1d%Lo7fA#}N1)oN7`gm$~V
113 z+wDx#)OFqMcE{s!JN0-xhG8ItAjVkJwEcb`3WWlJfU2r?;Pd%dmR+q@mSri5q9_W-
114 zaR2~ECX?B2w+zELozC0s*6Z~|QG^f{3I#<`?)Q7U-JZ|q5W;9Q8i_=pBuSzunx=U;
115 z9C)5jBoYw9^?EHyQl(M}1OlQcCX>lXB*ODN003Z&P17_@)3Pi=i0wb04<W?v-u}7K
116 zXmmQA+wDgE!qR9o8jr`%=ab_&uh(l?R=r;Tjiqon91I2-hIu?57~@*4h7h9uORK#=
117 fQItJW-{SoTm)8|5##k|m00000NkvXXu0mjf{mKw4
118
119
120 Import binary diff:
121
122 $ hg revert binfile.bin
123 $ rm binfile.bin
124 $ hg import -mfoo b.diff
125 applying b.diff
126 $ cmp binfile.bin $TESTDIR/binfile.bin
127
128 Rename binary file:
129
130 $ hg mv binfile.bin renamed.bin
131 $ hg diff --git
132 diff --git a/binfile.bin b/renamed.bin
133 rename from binfile.bin
134 rename to renamed.bin
135
136 Diff across many revisions:
137
138 $ hg mv dst dst2
139 $ hg ci -m 'mv dst dst2'
140
141 $ echo >> start
142 $ hg ci -m 'change start'
143
144 $ hg revert -r -2 start
145 $ hg mv dst2 dst3
146 $ hg ci -m 'mv dst2 dst3; revert start'
147
148 $ hg diff --git -r 9:11
149 diff --git a/dst2 b/dst3
150 rename from dst2
151 rename to dst3
152
153 Reversed:
154
155 $ hg diff --git -r 11:9
156 diff --git a/dst3 b/dst2
157 rename from dst3
158 rename to dst2
159
160
161 $ echo a >> foo
162 $ hg add foo
163 $ hg ci -m 'add foo'
164 $ echo b >> foo
165 $ hg ci -m 'change foo'
166 $ hg mv foo bar
167 $ hg ci -m 'mv foo bar'
168 $ echo c >> bar
169 $ hg ci -m 'change bar'
170
171 File created before r1 and renamed before r2:
172
173 $ hg diff --git -r -3:-1
174 diff --git a/foo b/bar
175 rename from foo
176 rename to bar
177 --- a/foo
178 +++ b/bar
179 @@ -1,2 +1,3 @@
180 a
181 b
182 +c
183
184 Reversed:
185
186 $ hg diff --git -r -1:-3
187 diff --git a/bar b/foo
188 rename from bar
189 rename to foo
190 --- a/bar
191 +++ b/foo
192 @@ -1,3 +1,2 @@
193 a
194 b
195 -c
196
197 File created in r1 and renamed before r2:
198
199 $ hg diff --git -r -4:-1
200 diff --git a/foo b/bar
201 rename from foo
202 rename to bar
203 --- a/foo
204 +++ b/bar
205 @@ -1,1 +1,3 @@
206 a
207 +b
208 +c
209
210 Reversed:
211
212 $ hg diff --git -r -1:-4
213 diff --git a/bar b/foo
214 rename from bar
215 rename to foo
216 --- a/bar
217 +++ b/foo
218 @@ -1,3 +1,1 @@
219 a
220 -b
221 -c
222
223 File created after r1 and renamed before r2:
224
225 $ hg diff --git -r -5:-1
226 diff --git a/bar b/bar
227 new file mode 100644
228 --- /dev/null
229 +++ b/bar
230 @@ -0,0 +1,3 @@
231 +a
232 +b
233 +c
234
235 Reversed:
236
237 $ hg diff --git -r -1:-5
238 diff --git a/bar b/bar
239 deleted file mode 100644
240 --- a/bar
241 +++ /dev/null
242 @@ -1,3 +0,0 @@
243 -a
244 -b
245 -c
246
247
248 Comparing with the working dir:
249
250 $ echo >> start
251 $ hg ci -m 'change start again'
252
253 $ echo > created
254 $ hg add created
255 $ hg ci -m 'add created'
256
257 $ hg mv created created2
258 $ hg ci -m 'mv created created2'
259
260 $ hg mv created2 created3
261
262 There's a copy in the working dir:
263
264 $ hg diff --git
265 diff --git a/created2 b/created3
266 rename from created2
267 rename to created3
268
269 There's another copy between the original rev and the wd:
270
271 $ hg diff --git -r -2
272 diff --git a/created b/created3
273 rename from created
274 rename to created3
275
276 The source of the copy was created after the original rev:
277
278 $ hg diff --git -r -3
279 diff --git a/created3 b/created3
280 new file mode 100644
281 --- /dev/null
282 +++ b/created3
283 @@ -0,0 +1,1 @@
284 +
285 $ hg ci -m 'mv created2 created3'
286
287
288 $ echo > brand-new
289 $ hg add brand-new
290 $ hg ci -m 'add brand-new'
291 $ hg mv brand-new brand-new2
292
293 Created in parent of wd; renamed in the wd:
294
295 $ hg diff --git
296 diff --git a/brand-new b/brand-new2
297 rename from brand-new
298 rename to brand-new2
299
300 Created between r1 and parent of wd; renamed in the wd:
301
302 $ hg diff --git -r -2
303 diff --git a/brand-new2 b/brand-new2
304 new file mode 100644
305 --- /dev/null
306 +++ b/brand-new2
307 @@ -0,0 +1,1 @@
308 +
309 $ hg ci -m 'mv brand-new brand-new2'
310
311 One file is copied to many destinations and removed:
312
313 $ hg cp brand-new2 brand-new3
314 $ hg mv brand-new2 brand-new3-2
315 $ hg ci -m 'multiple renames/copies'
316 $ hg diff --git -r -2 -r -1
317 diff --git a/brand-new2 b/brand-new3
318 rename from brand-new2
319 rename to brand-new3
320 diff --git a/brand-new2 b/brand-new3-2
321 copy from brand-new2
322 copy to brand-new3-2
323
324 Reversed:
325
326 $ hg diff --git -r -1 -r -2
327 diff --git a/brand-new3 b/brand-new2
328 rename from brand-new3
329 rename to brand-new2
330 diff --git a/brand-new3-2 b/brand-new3-2
331 deleted file mode 100644
332 --- a/brand-new3-2
333 +++ /dev/null
334 @@ -1,1 +0,0 @@
335 -
336
337 There should be a trailing TAB if there are spaces in the file name:
338
339 $ echo foo > 'with spaces'
340 $ hg add 'with spaces'
341 $ hg diff --git
342 diff --git a/with spaces b/with spaces
343 new file mode 100644
344 --- /dev/null
345 +++ b/with spaces
346 @@ -0,0 +1,1 @@
347 +foo
348 $ hg ci -m 'add filename with spaces'
349