##// END OF EJS Templates
patch: fix iterhunks() with trailing binary file removal...
Patrick Mezard -
r6179:36ab165a default
parent child Browse files
Show More
@@ -890,6 +890,9 b' def iterhunks(ui, fp, sourcefile=None):'
890 context = None
890 context = None
891 lr = linereader(fp)
891 lr = linereader(fp)
892 dopatch = True
892 dopatch = True
893 # gitworkdone is True if a git operation (copy, rename, ...) was
894 # performed already for the current file. Useful when the file
895 # section may have no hunk.
893 gitworkdone = False
896 gitworkdone = False
894
897
895 while True:
898 while True:
@@ -938,8 +941,8 b' def iterhunks(ui, fp, sourcefile=None):'
938 changed[gp.path] = (gp.op, gp)
941 changed[gp.path] = (gp.op, gp)
939 # else error?
942 # else error?
940 # copy/rename + modify should modify target, not source
943 # copy/rename + modify should modify target, not source
941 if changed.get(bfile[2:], (None, None))[0] in ('COPY',
944 gitop = changed.get(bfile[2:], (None, None))[0]
942 'RENAME'):
945 if gitop in ('COPY', 'DELETE', 'RENAME'):
943 afile = bfile
946 afile = bfile
944 gitworkdone = True
947 gitworkdone = True
945 newfile = True
948 newfile = True
@@ -207,3 +207,21 b' do'
207 done
207 done
208 cd ..
208 cd ..
209
209
210 # Test importing a patch ending with a binary file removal
211 echo % test trailing binary removal
212 hg init binaryremoval
213 cd binaryremoval
214 echo a > a
215 python -c "file('b', 'wb').write('a\x00b')"
216 hg ci -Am addall
217 hg rm a
218 hg rm b
219 hg st
220 hg ci -m remove
221 hg export --git . > remove.diff
222 cat remove.diff | grep git
223 hg up -C 0
224 hg import remove.diff
225 hg manifest
226 cd ..
227
@@ -223,3 +223,12 b' c'
223 % c2 file
223 % c2 file
224 c
224 c
225 % d file
225 % d file
226 % test trailing binary removal
227 adding a
228 adding b
229 R a
230 R b
231 diff --git a/a b/a
232 diff --git a/b b/b
233 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
234 applying remove.diff
General Comments 0
You need to be logged in to leave comments. Login now