1662 # caching against the next repo.status call |
1662 # caching against the next repo.status call |
1663 mm, aa, dd = repo.status(patchparent, top)[:3] |
1663 mm, aa, dd = repo.status(patchparent, top)[:3] |
1664 changes = repo.changelog.read(top) |
1664 changes = repo.changelog.read(top) |
1665 man = repo.manifestlog[changes[0]].read() |
1665 man = repo.manifestlog[changes[0]].read() |
1666 aaa = aa[:] |
1666 aaa = aa[:] |
1667 matchfn = scmutil.match(repo[None], pats, opts) |
1667 match1 = scmutil.match(repo[None], pats, opts) |
1668 # in short mode, we only diff the files included in the |
1668 # in short mode, we only diff the files included in the |
1669 # patch already plus specified files |
1669 # patch already plus specified files |
1670 if opts.get('short'): |
1670 if opts.get('short'): |
1671 # if amending a patch, we start with existing |
1671 # if amending a patch, we start with existing |
1672 # files plus specified files - unfiltered |
1672 # files plus specified files - unfiltered |
1673 match = scmutil.matchfiles(repo, mm + aa + dd + matchfn.files()) |
1673 match = scmutil.matchfiles(repo, mm + aa + dd + match1.files()) |
1674 # filter with include/exclude options |
1674 # filter with include/exclude options |
1675 matchfn = scmutil.match(repo[None], opts=opts) |
1675 match1 = scmutil.match(repo[None], opts=opts) |
1676 else: |
1676 else: |
1677 match = scmutil.matchall(repo) |
1677 match = scmutil.matchall(repo) |
1678 m, a, r, d = repo.status(match=match)[:4] |
1678 m, a, r, d = repo.status(match=match)[:4] |
1679 mm = set(mm) |
1679 mm = set(mm) |
1680 aa = set(aa) |
1680 aa = set(aa) |
1711 m = list(mm) |
1711 m = list(mm) |
1712 r = list(dd) |
1712 r = list(dd) |
1713 a = list(aa) |
1713 a = list(aa) |
1714 |
1714 |
1715 # create 'match' that includes the files to be recommitted. |
1715 # create 'match' that includes the files to be recommitted. |
1716 # apply matchfn via repo.status to ensure correct case handling. |
1716 # apply match1 via repo.status to ensure correct case handling. |
1717 cm, ca, cr, cd = repo.status(patchparent, match=matchfn)[:4] |
1717 cm, ca, cr, cd = repo.status(patchparent, match=match1)[:4] |
1718 allmatches = set(cm + ca + cr + cd) |
1718 allmatches = set(cm + ca + cr + cd) |
1719 refreshchanges = [x.intersection(allmatches) for x in (mm, aa, dd)] |
1719 refreshchanges = [x.intersection(allmatches) for x in (mm, aa, dd)] |
1720 |
1720 |
1721 files = set(inclsubs) |
1721 files = set(inclsubs) |
1722 for x in refreshchanges: |
1722 for x in refreshchanges: |
1762 repo.dirstate.remove(f) |
1762 repo.dirstate.remove(f) |
1763 # if the patch excludes a modified file, mark that |
1763 # if the patch excludes a modified file, mark that |
1764 # file with mtime=0 so status can see it. |
1764 # file with mtime=0 so status can see it. |
1765 mm = [] |
1765 mm = [] |
1766 for i in xrange(len(m) - 1, -1, -1): |
1766 for i in xrange(len(m) - 1, -1, -1): |
1767 if not matchfn(m[i]): |
1767 if not match1(m[i]): |
1768 mm.append(m[i]) |
1768 mm.append(m[i]) |
1769 del m[i] |
1769 del m[i] |
1770 for f in m: |
1770 for f in m: |
1771 repo.dirstate.normal(f) |
1771 repo.dirstate.normal(f) |
1772 for f in mm: |
1772 for f in mm: |