Show More
@@ -440,7 +440,11 b' class fsbackend(abstractbackend):' | |||||
440 | util.setflags(self._join(fname), False, True) |
|
440 | util.setflags(self._join(fname), False, True) | |
441 |
|
441 | |||
442 | def unlink(self, fname): |
|
442 | def unlink(self, fname): | |
443 | os.unlink(self._join(fname)) |
|
443 | try: | |
|
444 | util.unlinkpath(self._join(fname)) | |||
|
445 | except OSError, inst: | |||
|
446 | if inst.errno != errno.ENOENT: | |||
|
447 | raise | |||
444 |
|
448 | |||
445 | def writerej(self, fname, failed, total, lines): |
|
449 | def writerej(self, fname, failed, total, lines): | |
446 | fname = fname + ".rej" |
|
450 | fname = fname + ".rej" | |
@@ -1217,14 +1221,23 b' def _applydiff(ui, fp, patcher, backend,' | |||||
1217 | rejects += current_file.close() |
|
1221 | rejects += current_file.close() | |
1218 |
|
1222 | |||
1219 | # Handle mode changes without hunk |
|
1223 | # Handle mode changes without hunk | |
|
1224 | removed = set() | |||
1220 | for gp in changed.itervalues(): |
|
1225 | for gp in changed.itervalues(): | |
1221 |
if not gp |
|
1226 | if not gp: | |
|
1227 | continue | |||
|
1228 | if gp.op == 'DELETE': | |||
|
1229 | removed.add(gp.path) | |||
1222 | continue |
|
1230 | continue | |
1223 | if gp.op == 'ADD' and not backend.exists(gp.path): |
|
1231 | if gp.op == 'RENAME': | |
1224 | # Added files without content have no hunk and must be created |
|
1232 | removed.add(gp.oldpath) | |
1225 | backend.writelines(gp.path, [], gp.mode) |
|
1233 | if gp.mode: | |
1226 | else: |
|
1234 | if gp.op == 'ADD' and not backend.exists(gp.path): | |
1227 | backend.setmode(gp.path, gp.mode[0], gp.mode[1]) |
|
1235 | # Added files without content have no hunk and must be created | |
|
1236 | backend.writelines(gp.path, [], gp.mode) | |||
|
1237 | else: | |||
|
1238 | backend.setmode(gp.path, gp.mode[0], gp.mode[1]) | |||
|
1239 | for path in sorted(removed): | |||
|
1240 | backend.unlink(path) | |||
1228 |
|
1241 | |||
1229 | if rejects: |
|
1242 | if rejects: | |
1230 | return -1 |
|
1243 | return -1 | |
@@ -1256,7 +1269,7 b' def _updatedir(ui, repo, patches, simila' | |||||
1256 | for src, dst in copies: |
|
1269 | for src, dst in copies: | |
1257 | scmutil.dirstatecopy(ui, repo, wctx, src, dst, cwd=cwd) |
|
1270 | scmutil.dirstatecopy(ui, repo, wctx, src, dst, cwd=cwd) | |
1258 | if (not similarity) and removes: |
|
1271 | if (not similarity) and removes: | |
1259 |
wctx.remove(sorted(removes) |
|
1272 | wctx.remove(sorted(removes)) | |
1260 |
|
1273 | |||
1261 | scmutil.addremove(repo, cfiles, similarity=similarity) |
|
1274 | scmutil.addremove(repo, cfiles, similarity=similarity) | |
1262 | files = patches.keys() |
|
1275 | files = patches.keys() |
General Comments 0
You need to be logged in to leave comments.
Login now