856 except IOError: |
854 except IOError: |
857 fp = cStringIO.StringIO(fp.read()) |
855 fp = cStringIO.StringIO(fp.read()) |
858 |
856 |
859 (dopatch, gitpatches) = readgitpatch(fp, firstline) |
857 (dopatch, gitpatches) = readgitpatch(fp, firstline) |
860 for gp in gitpatches: |
858 for gp in gitpatches: |
861 if gp.copymod: |
859 if gp.op in ('COPY', 'RENAME'): |
862 copyfile(gp.oldpath, gp.path, basedir=cwd) |
860 copyfile(gp.oldpath, gp.path, basedir=cwd) |
863 |
861 |
864 fp.seek(pos) |
862 fp.seek(pos) |
865 |
863 |
866 return fp, dopatch, gitpatches |
864 return fp, dopatch, gitpatches |
1028 if cwd: |
1026 if cwd: |
1029 cfiles = [util.pathto(repo.root, cwd, f) for f in patches.keys()] |
1027 cfiles = [util.pathto(repo.root, cwd, f) for f in patches.keys()] |
1030 for f in patches: |
1028 for f in patches: |
1031 ctype, gp = patches[f] |
1029 ctype, gp = patches[f] |
1032 if ctype == 'RENAME': |
1030 if ctype == 'RENAME': |
1033 copies.append((gp.oldpath, gp.path, gp.copymod)) |
1031 copies.append((gp.oldpath, gp.path)) |
1034 removes[gp.oldpath] = 1 |
1032 removes[gp.oldpath] = 1 |
1035 elif ctype == 'COPY': |
1033 elif ctype == 'COPY': |
1036 copies.append((gp.oldpath, gp.path, gp.copymod)) |
1034 copies.append((gp.oldpath, gp.path)) |
1037 elif ctype == 'DELETE': |
1035 elif ctype == 'DELETE': |
1038 removes[gp.path] = 1 |
1036 removes[gp.path] = 1 |
1039 for src, dst, after in copies: |
1037 for src, dst in copies: |
1040 if not after: |
|
1041 copyfile(src, dst, repo.root) |
|
1042 repo.copy(src, dst) |
1038 repo.copy(src, dst) |
1043 removes = removes.keys() |
1039 removes = removes.keys() |
1044 if removes: |
1040 if removes: |
1045 removes.sort() |
1041 removes.sort() |
1046 repo.remove(removes, True) |
1042 repo.remove(removes, True) |