comparison mercurial/context.py @ 32652:9929af2b09b4

merge with stable
author Augie Fackler <augie@google.com>
date Sat, 03 Jun 2017 16:33:28 -0400
parents 1df98fc923d4 c850f0ed54c1
children a722c8e17363
comparison
equal deleted inserted replaced
32650:783394c0c978 32652:9929af2b09b4
1732 return sane 1732 return sane
1733 1733
1734 def _checklookup(self, files): 1734 def _checklookup(self, files):
1735 # check for any possibly clean files 1735 # check for any possibly clean files
1736 if not files: 1736 if not files:
1737 return [], [] 1737 return [], [], []
1738 1738
1739 modified = [] 1739 modified = []
1740 deleted = []
1740 fixup = [] 1741 fixup = []
1741 pctx = self._parents[0] 1742 pctx = self._parents[0]
1742 # do a full compare of any files that might have changed 1743 # do a full compare of any files that might have changed
1743 for f in sorted(files): 1744 for f in sorted(files):
1744 if (f not in pctx or self.flags(f) != pctx.flags(f) 1745 try:
1745 or pctx[f].cmp(self[f])): 1746 # This will return True for a file that got replaced by a
1746 modified.append(f) 1747 # directory in the interim, but fixing that is pretty hard.
1747 else: 1748 if (f not in pctx or self.flags(f) != pctx.flags(f)
1748 fixup.append(f) 1749 or pctx[f].cmp(self[f])):
1750 modified.append(f)
1751 else:
1752 fixup.append(f)
1753 except (IOError, OSError):
1754 # A file become inaccessible in between? Mark it as deleted,
1755 # matching dirstate behavior (issue5584).
1756 # The dirstate has more complex behavior around whether a
1757 # missing file matches a directory, etc, but we don't need to
1758 # bother with that: if f has made it to this point, we're sure
1759 # it's in the dirstate.
1760 deleted.append(f)
1749 1761
1750 # update dirstate for files that are actually clean 1762 # update dirstate for files that are actually clean
1751 if fixup: 1763 if fixup:
1752 try: 1764 try:
1753 # updating the dirstate is optional 1765 # updating the dirstate is optional
1763 # after this block from doing so for subsequent 1775 # after this block from doing so for subsequent
1764 # changing files 1776 # changing files
1765 self._repo.dirstate.write(self._repo.currenttransaction()) 1777 self._repo.dirstate.write(self._repo.currenttransaction())
1766 except error.LockError: 1778 except error.LockError:
1767 pass 1779 pass
1768 return modified, fixup 1780 return modified, deleted, fixup
1769 1781
1770 def _dirstatestatus(self, match=None, ignored=False, clean=False, 1782 def _dirstatestatus(self, match=None, ignored=False, clean=False,
1771 unknown=False): 1783 unknown=False):
1772 '''Gets the status from the dirstate -- internal use only.''' 1784 '''Gets the status from the dirstate -- internal use only.'''
1773 listignored, listclean, listunknown = ignored, clean, unknown 1785 listignored, listclean, listunknown = ignored, clean, unknown
1778 cmp, s = self._repo.dirstate.status(match, subrepos, listignored, 1790 cmp, s = self._repo.dirstate.status(match, subrepos, listignored,
1779 listclean, listunknown) 1791 listclean, listunknown)
1780 1792
1781 # check for any possibly clean files 1793 # check for any possibly clean files
1782 if cmp: 1794 if cmp:
1783 modified2, fixup = self._checklookup(cmp) 1795 modified2, deleted2, fixup = self._checklookup(cmp)
1784 s.modified.extend(modified2) 1796 s.modified.extend(modified2)
1797 s.deleted.extend(deleted2)
1785 1798
1786 # update dirstate for files that are actually clean 1799 # update dirstate for files that are actually clean
1787 if fixup and listclean: 1800 if fixup and listclean:
1788 s.clean.extend(fixup) 1801 s.clean.extend(fixup)
1789 1802