##// END OF EJS Templates
Merge with stable
Patrick Mezard -
r12577:05210e95 merge default
parent child Browse files
Show More
@@ -1184,7 +1184,9 b' def _applydiff(ui, fp, patcher, copyfn, '
1184 gp.path = pathstrip(gp.path, strip - 1)[1]
1184 gp.path = pathstrip(gp.path, strip - 1)[1]
1185 if gp.oldpath:
1185 if gp.oldpath:
1186 gp.oldpath = pathstrip(gp.oldpath, strip - 1)[1]
1186 gp.oldpath = pathstrip(gp.oldpath, strip - 1)[1]
1187 if gp.op in ('COPY', 'RENAME'):
1187 # Binary patches really overwrite target files, copying them
1188 # will just make it fails with "target file exists"
1189 if gp.op in ('COPY', 'RENAME') and not gp.binary:
1188 copyfn(gp.oldpath, gp.path, cwd)
1190 copyfn(gp.oldpath, gp.path, cwd)
1189 changed[gp.path] = gp
1191 changed[gp.path] = gp
1190 else:
1192 else:
@@ -1530,6 +1532,9 b' def trydiff(repo, revs, ctx1, ctx2, modi'
1530 header.append('new file mode %s\n' % mode)
1532 header.append('new file mode %s\n' % mode)
1531 elif ctx2.flags(f):
1533 elif ctx2.flags(f):
1532 losedatafn(f)
1534 losedatafn(f)
1535 # In theory, if tn was copied or renamed we should check
1536 # if the source is binary too but the copy record already
1537 # forces git mode.
1533 if util.binary(tn):
1538 if util.binary(tn):
1534 if opts.git:
1539 if opts.git:
1535 dodiff = 'binary'
1540 dodiff = 'binary'
@@ -1549,7 +1554,7 b' def trydiff(repo, revs, ctx1, ctx2, modi'
1549 else:
1554 else:
1550 header.append('deleted file mode %s\n' %
1555 header.append('deleted file mode %s\n' %
1551 gitmode[man1.flags(f)])
1556 gitmode[man1.flags(f)])
1552 elif not to:
1557 elif not to or util.binary(to):
1553 # regular diffs cannot represent empty file deletion
1558 # regular diffs cannot represent empty file deletion
1554 losedatafn(f)
1559 losedatafn(f)
1555 else:
1560 else:
@@ -7,10 +7,13 b''
7 $ hg init repo
7 $ hg init repo
8 $ cd repo
8 $ cd repo
9
9
10
11
10 make a combination of new, changed and deleted file
12 make a combination of new, changed and deleted file
11
13
12 $ echo regular > regular
14 $ echo regular > regular
13 $ echo rmregular > rmregular
15 $ echo rmregular > rmregular
16 $ python -c "file('bintoregular', 'wb').write('\0')"
14 $ touch rmempty
17 $ touch rmempty
15 $ echo exec > exec
18 $ echo exec > exec
16 $ chmod +x exec
19 $ chmod +x exec
@@ -23,6 +26,7 b' make a combination of new, changed and d'
23 $ python -c "file('rmbinary', 'wb').write('\0')"
26 $ python -c "file('rmbinary', 'wb').write('\0')"
24 $ hg ci -Am addfiles
27 $ hg ci -Am addfiles
25 adding binary
28 adding binary
29 adding bintoregular
26 adding exec
30 adding exec
27 adding regular
31 adding regular
28 adding rmbinary
32 adding rmbinary
@@ -38,6 +42,7 b' make a combination of new, changed and d'
38 $ rm rmregular
42 $ rm rmregular
39 $ echo exec >> exec
43 $ echo exec >> exec
40 $ echo newexec > newexec
44 $ echo newexec > newexec
45 $ echo bintoregular > bintoregular
41 $ chmod +x newexec
46 $ chmod +x newexec
42 $ rm rmexec
47 $ rm rmexec
43 $ chmod +x setexec
48 $ chmod +x setexec
@@ -58,40 +63,42 b' make a combination of new, changed and d'
58 git=no: regular diff for all files
63 git=no: regular diff for all files
59
64
60 $ hg autodiff --git=no
65 $ hg autodiff --git=no
61 diff -r b3f053cd7c7f binary
66 diff -r a66d19b9302d binary
62 Binary file binary has changed
67 Binary file binary has changed
63 diff -r b3f053cd7c7f exec
68 diff -r a66d19b9302d bintoregular
69 Binary file bintoregular has changed
70 diff -r a66d19b9302d exec
64 --- a/exec
71 --- a/exec
65 +++ b/exec
72 +++ b/exec
66 @@ -1,1 +1,2 @@
73 @@ -1,1 +1,2 @@
67 exec
74 exec
68 +exec
75 +exec
69 diff -r b3f053cd7c7f newbinary
76 diff -r a66d19b9302d newbinary
70 Binary file newbinary has changed
77 Binary file newbinary has changed
71 diff -r b3f053cd7c7f newexec
78 diff -r a66d19b9302d newexec
72 --- /dev/null
79 --- /dev/null
73 +++ b/newexec
80 +++ b/newexec
74 @@ -0,0 +1,1 @@
81 @@ -0,0 +1,1 @@
75 +newexec
82 +newexec
76 diff -r b3f053cd7c7f newregular
83 diff -r a66d19b9302d newregular
77 --- /dev/null
84 --- /dev/null
78 +++ b/newregular
85 +++ b/newregular
79 @@ -0,0 +1,1 @@
86 @@ -0,0 +1,1 @@
80 +newregular
87 +newregular
81 diff -r b3f053cd7c7f regular
88 diff -r a66d19b9302d regular
82 --- a/regular
89 --- a/regular
83 +++ b/regular
90 +++ b/regular
84 @@ -1,1 +1,2 @@
91 @@ -1,1 +1,2 @@
85 regular
92 regular
86 +regular
93 +regular
87 diff -r b3f053cd7c7f rmbinary
94 diff -r a66d19b9302d rmbinary
88 Binary file rmbinary has changed
95 Binary file rmbinary has changed
89 diff -r b3f053cd7c7f rmexec
96 diff -r a66d19b9302d rmexec
90 --- a/rmexec
97 --- a/rmexec
91 +++ /dev/null
98 +++ /dev/null
92 @@ -1,1 +0,0 @@
99 @@ -1,1 +0,0 @@
93 -rmexec
100 -rmexec
94 diff -r b3f053cd7c7f rmregular
101 diff -r a66d19b9302d rmregular
95 --- a/rmregular
102 --- a/rmregular
96 +++ /dev/null
103 +++ /dev/null
97 @@ -1,1 +0,0 @@
104 @@ -1,1 +0,0 @@
@@ -107,41 +114,39 b' git=yes: git diff for single regular fil'
107 regular
114 regular
108 +regular
115 +regular
109
116
110 git=auto: regular diff for regular files and removals
117 git=auto: regular diff for regular files and non-binary removals
111
118
112 $ hg autodiff --git=auto regular newregular rmregular rmbinary rmexec
119 $ hg autodiff --git=auto regular newregular rmregular rmexec
113 diff -r b3f053cd7c7f newregular
120 diff -r a66d19b9302d newregular
114 --- /dev/null
121 --- /dev/null
115 +++ b/newregular
122 +++ b/newregular
116 @@ -0,0 +1,1 @@
123 @@ -0,0 +1,1 @@
117 +newregular
124 +newregular
118 diff -r b3f053cd7c7f regular
125 diff -r a66d19b9302d regular
119 --- a/regular
126 --- a/regular
120 +++ b/regular
127 +++ b/regular
121 @@ -1,1 +1,2 @@
128 @@ -1,1 +1,2 @@
122 regular
129 regular
123 +regular
130 +regular
124 diff -r b3f053cd7c7f rmbinary
131 diff -r a66d19b9302d rmexec
125 Binary file rmbinary has changed
126 diff -r b3f053cd7c7f rmexec
127 --- a/rmexec
132 --- a/rmexec
128 +++ /dev/null
133 +++ /dev/null
129 @@ -1,1 +0,0 @@
134 @@ -1,1 +0,0 @@
130 -rmexec
135 -rmexec
131 diff -r b3f053cd7c7f rmregular
136 diff -r a66d19b9302d rmregular
132 --- a/rmregular
137 --- a/rmregular
133 +++ /dev/null
138 +++ /dev/null
134 @@ -1,1 +0,0 @@
139 @@ -1,1 +0,0 @@
135 -rmregular
140 -rmregular
136
141
137 $ for f in exec newexec setexec unsetexec binary newbinary newempty rmempty; do
142 $ for f in exec newexec setexec unsetexec binary newbinary newempty rmempty rmbinary bintoregular; do
138 > echo
143 > echo
139 > echo '% git=auto: git diff for' $f
144 > echo '% git=auto: git diff for' $f
140 > hg autodiff --git=auto $f
145 > hg autodiff --git=auto $f
141 > done
146 > done
142
147
143 % git=auto: git diff for exec
148 % git=auto: git diff for exec
144 diff -r b3f053cd7c7f exec
149 diff -r a66d19b9302d exec
145 --- a/exec
150 --- a/exec
146 +++ b/exec
151 +++ b/exec
147 @@ -1,1 +1,2 @@
152 @@ -1,1 +1,2 @@
@@ -191,51 +196,68 b' git=auto: regular diff for regular files'
191 diff --git a/rmempty b/rmempty
196 diff --git a/rmempty b/rmempty
192 deleted file mode 100644
197 deleted file mode 100644
193
198
199 % git=auto: git diff for rmbinary
200 diff --git a/rmbinary b/rmbinary
201 deleted file mode 100644
202 Binary file rmbinary has changed
203
204 % git=auto: git diff for bintoregular
205 diff --git a/bintoregular b/bintoregular
206 index f76dd238ade08917e6712764a16a22005a50573d..9c42f2b6427d8bf034b7bc23986152dc01bfd3ab
207 GIT binary patch
208 literal 13
209 Uc$`bh%qz(+N=+}#Ni5<5043uE82|tP
210
211
194 git=warn: regular diff with data loss warnings
212 git=warn: regular diff with data loss warnings
195
213
196 $ hg autodiff --git=warn
214 $ hg autodiff --git=warn
197 diff -r b3f053cd7c7f binary
215 diff -r a66d19b9302d binary
198 Binary file binary has changed
216 Binary file binary has changed
199 diff -r b3f053cd7c7f exec
217 diff -r a66d19b9302d bintoregular
218 Binary file bintoregular has changed
219 diff -r a66d19b9302d exec
200 --- a/exec
220 --- a/exec
201 +++ b/exec
221 +++ b/exec
202 @@ -1,1 +1,2 @@
222 @@ -1,1 +1,2 @@
203 exec
223 exec
204 +exec
224 +exec
205 diff -r b3f053cd7c7f newbinary
225 diff -r a66d19b9302d newbinary
206 Binary file newbinary has changed
226 Binary file newbinary has changed
207 diff -r b3f053cd7c7f newexec
227 diff -r a66d19b9302d newexec
208 --- /dev/null
228 --- /dev/null
209 +++ b/newexec
229 +++ b/newexec
210 @@ -0,0 +1,1 @@
230 @@ -0,0 +1,1 @@
211 +newexec
231 +newexec
212 diff -r b3f053cd7c7f newregular
232 diff -r a66d19b9302d newregular
213 --- /dev/null
233 --- /dev/null
214 +++ b/newregular
234 +++ b/newregular
215 @@ -0,0 +1,1 @@
235 @@ -0,0 +1,1 @@
216 +newregular
236 +newregular
217 diff -r b3f053cd7c7f regular
237 diff -r a66d19b9302d regular
218 --- a/regular
238 --- a/regular
219 +++ b/regular
239 +++ b/regular
220 @@ -1,1 +1,2 @@
240 @@ -1,1 +1,2 @@
221 regular
241 regular
222 +regular
242 +regular
223 diff -r b3f053cd7c7f rmbinary
243 diff -r a66d19b9302d rmbinary
224 Binary file rmbinary has changed
244 Binary file rmbinary has changed
225 diff -r b3f053cd7c7f rmexec
245 diff -r a66d19b9302d rmexec
226 --- a/rmexec
246 --- a/rmexec
227 +++ /dev/null
247 +++ /dev/null
228 @@ -1,1 +0,0 @@
248 @@ -1,1 +0,0 @@
229 -rmexec
249 -rmexec
230 diff -r b3f053cd7c7f rmregular
250 diff -r a66d19b9302d rmregular
231 --- a/rmregular
251 --- a/rmregular
232 +++ /dev/null
252 +++ /dev/null
233 @@ -1,1 +0,0 @@
253 @@ -1,1 +0,0 @@
234 -rmregular
254 -rmregular
235 data lost for: binary
255 data lost for: binary
256 data lost for: bintoregular
236 data lost for: newbinary
257 data lost for: newbinary
237 data lost for: newempty
258 data lost for: newempty
238 data lost for: newexec
259 data lost for: newexec
260 data lost for: rmbinary
239 data lost for: rmempty
261 data lost for: rmempty
240 data lost for: setexec
262 data lost for: setexec
241 data lost for: unsetexec
263 data lost for: unsetexec
@@ -249,7 +271,7 b' git=abort: fail on execute bit change'
249 git=abort: succeed on regular file
271 git=abort: succeed on regular file
250
272
251 $ hg autodiff --git=abort regular
273 $ hg autodiff --git=abort regular
252 diff -r b3f053cd7c7f regular
274 diff -r a66d19b9302d regular
253 --- a/regular
275 --- a/regular
254 +++ b/regular
276 +++ b/regular
255 @@ -1,1 +1,2 @@
277 @@ -1,1 +1,2 @@
@@ -335,3 +335,24 b' Copy then modify the original file:'
335 $ cat foo3
335 $ cat foo3
336 foo
336 foo
337
337
338 Move text file and patch as binary
339
340 $ echo a > text2
341 $ hg ci -Am0
342 adding text2
343 $ hg import -d "1000000 0" -m rename-as-binary - <<"EOF"
344 > diff --git a/text2 b/binary2
345 > rename from text2
346 > rename to binary2
347 > index 78981922613b2afb6025042ff6bd878ac1994e85..10efcb362e9f3b3420fcfbfc0e37f3dc16e29757
348 > GIT binary patch
349 > literal 5
350 > Mc$`b*O5$Pw00T?_*Z=?k
351 >
352 > EOF
353 applying patch from stdin
354 $ python $TESTDIR/printrepr.py < binary2
355 a
356 b
357 \x00
358 $ hg st --copies --change . abort: unknown revision '.echo'!
General Comments 0
You need to be logged in to leave comments. Login now