# HG changeset patch # User Patrick Mezard # Date 1305755293 -7200 # Node ID f8932d54008851a230eb80bfb5e348ec775d709c # Parent baf2807b9a7d17568f45f1dd40155b76b2053e96 patch: handle binary copies as regular ones This introduces a performance regression for large files, as they will be copied just to be clobbered afterwards since binary patching does not use deltas. But it simplifies the code and the previous optimization will be reintroduced later in a better way. diff -r baf2807b9a7d -r f8932d540088 mercurial/patch.py --- a/mercurial/patch.py Wed May 18 23:48:13 2011 +0200 +++ b/mercurial/patch.py Wed May 18 23:48:13 2011 +0200 @@ -923,7 +923,7 @@ self.hunk = ['GIT binary patch\n'] def createfile(self): - return self.gitpatch.op in ('ADD', 'RENAME', 'COPY') + return self.gitpatch.op == 'ADD' def rmfile(self): return self.gitpatch.op == 'DELETE' @@ -1209,9 +1209,7 @@ gp.path = pathstrip(gp.path, strip - 1)[1] if gp.oldpath: gp.oldpath = pathstrip(gp.oldpath, strip - 1)[1] - # Binary patches really overwrite target files, copying them - # will just make it fails with "target file exists" - if gp.op in ('COPY', 'RENAME') and not gp.binary: + if gp.op in ('COPY', 'RENAME'): backend.copy(gp.oldpath, gp.path) changed[gp.path] = gp else: