987 # mm, dd, aa, aa2, uu = repo.status(tip, patchparent)[:5] |
987 # mm, dd, aa, aa2, uu = repo.status(tip, patchparent)[:5] |
988 # but we do it backwards to take advantage of manifest/chlog |
988 # but we do it backwards to take advantage of manifest/chlog |
989 # caching against the next repo.status call |
989 # caching against the next repo.status call |
990 # |
990 # |
991 mm, aa, dd, aa2, uu = repo.status(patchparent, tip)[:5] |
991 mm, aa, dd, aa2, uu = repo.status(patchparent, tip)[:5] |
|
992 changes = repo.changelog.read(tip) |
|
993 man = repo.manifest.read(changes[0]) |
|
994 aaa = aa[:] |
992 if opts.get('short'): |
995 if opts.get('short'): |
993 filelist = mm + aa + dd |
996 filelist = mm + aa + dd |
994 else: |
997 else: |
995 filelist = None |
998 filelist = None |
996 m, a, r, d, u = repo.status(files=filelist)[:5] |
999 m, a, r, d, u = repo.status(files=filelist)[:5] |
1029 patch.diff(repo, patchparent, files=filelist, match=matchfn, |
1032 patch.diff(repo, patchparent, files=filelist, match=matchfn, |
1030 fp=patchf, changes=(m, a, r, [], u), |
1033 fp=patchf, changes=(m, a, r, [], u), |
1031 opts=self.diffopts()) |
1034 opts=self.diffopts()) |
1032 patchf.close() |
1035 patchf.close() |
1033 |
1036 |
1034 changes = repo.changelog.read(tip) |
|
1035 repo.dirstate.setparents(*cparents) |
1037 repo.dirstate.setparents(*cparents) |
1036 copies = [(f, repo.dirstate.copied(f)) for f in a] |
1038 copies = {} |
|
1039 for dst in a: |
|
1040 src = repo.dirstate.copied(dst) |
|
1041 if src is None: |
|
1042 continue |
|
1043 copies.setdefault(src, []).append(dst) |
1037 repo.dirstate.update(a, 'a') |
1044 repo.dirstate.update(a, 'a') |
1038 for dst, src in copies: |
1045 # remember the copies between patchparent and tip |
1039 repo.dirstate.copy(src, dst) |
1046 # this may be slow, so don't do it if we're not tracking copies |
|
1047 if self.diffopts().git: |
|
1048 for dst in aaa: |
|
1049 f = repo.file(dst) |
|
1050 src = f.renamed(man[dst]) |
|
1051 if src: |
|
1052 copies[src[0]] = copies.get(dst, []) |
|
1053 if dst in a: |
|
1054 copies[src[0]].append(dst) |
|
1055 # we can't copy a file created by the patch itself |
|
1056 if dst in copies: |
|
1057 del copies[dst] |
|
1058 for src, dsts in copies.iteritems(): |
|
1059 for dst in dsts: |
|
1060 repo.dirstate.copy(src, dst) |
1040 repo.dirstate.update(r, 'r') |
1061 repo.dirstate.update(r, 'r') |
1041 # if the patch excludes a modified file, mark that file with mtime=0 |
1062 # if the patch excludes a modified file, mark that file with mtime=0 |
1042 # so status can see it. |
1063 # so status can see it. |
1043 mm = [] |
1064 mm = [] |
1044 for i in xrange(len(m)-1, -1, -1): |
1065 for i in xrange(len(m)-1, -1, -1): |