1188 changes=c, opts=self.diffopts()) |
1188 changes=c, opts=self.diffopts()) |
1189 for chunk in chunks: |
1189 for chunk in chunks: |
1190 patchf.write(chunk) |
1190 patchf.write(chunk) |
1191 |
1191 |
1192 try: |
1192 try: |
1193 copies = {} |
|
1194 for dst in a: |
|
1195 src = repo.dirstate.copied(dst) |
|
1196 # during qfold, the source file for copies may |
|
1197 # be removed. Treat this as a simple add. |
|
1198 if src is not None and src in repo.dirstate: |
|
1199 copies.setdefault(src, []).append(dst) |
|
1200 repo.dirstate.add(dst) |
|
1201 # remember the copies between patchparent and tip |
|
1202 # this may be slow, so don't do it if we're not tracking copies |
|
1203 if self.diffopts().git: |
1193 if self.diffopts().git: |
|
1194 copies = {} |
|
1195 for dst in a: |
|
1196 src = repo.dirstate.copied(dst) |
|
1197 # during qfold, the source file for copies may |
|
1198 # be removed. Treat this as a simple add. |
|
1199 if src is not None and src in repo.dirstate: |
|
1200 copies.setdefault(src, []).append(dst) |
|
1201 repo.dirstate.add(dst) |
|
1202 # remember the copies between patchparent and tip |
1204 for dst in aaa: |
1203 for dst in aaa: |
1205 f = repo.file(dst) |
1204 f = repo.file(dst) |
1206 src = f.renamed(man[dst]) |
1205 src = f.renamed(man[dst]) |
1207 if src: |
1206 if src: |
1208 copies.setdefault(src[0], []).extend(copies.get(dst, [])) |
1207 copies.setdefault(src[0], []).extend(copies.get(dst, [])) |
1209 if dst in a: |
1208 if dst in a: |
1210 copies[src[0]].append(dst) |
1209 copies[src[0]].append(dst) |
1211 # we can't copy a file created by the patch itself |
1210 # we can't copy a file created by the patch itself |
1212 if dst in copies: |
1211 if dst in copies: |
1213 del copies[dst] |
1212 del copies[dst] |
1214 for src, dsts in copies.iteritems(): |
1213 for src, dsts in copies.iteritems(): |
1215 for dst in dsts: |
1214 for dst in dsts: |
1216 repo.dirstate.copy(src, dst) |
1215 repo.dirstate.copy(src, dst) |
|
1216 else: |
|
1217 for dst in a: |
|
1218 repo.dirstate.add(dst) |
|
1219 # Drop useless copy information |
|
1220 for f in list(repo.dirstate.copies()): |
|
1221 repo.dirstate.copy(None, f) |
1217 for f in r: |
1222 for f in r: |
1218 repo.dirstate.remove(f) |
1223 repo.dirstate.remove(f) |
1219 # if the patch excludes a modified file, mark that |
1224 # if the patch excludes a modified file, mark that |
1220 # file with mtime=0 so status can see it. |
1225 # file with mtime=0 so status can see it. |
1221 mm = [] |
1226 mm = [] |