Mercurial > hg
comparison mercurial/context.py @ 32812:add613cddcb6
workingctx: factor out post-status dirstate fixup
We want to allow extensions to be able to add code to run inside the wlock.
author | Siddharth Agarwal <sid0@fb.com> |
---|---|
date | Mon, 12 Jun 2017 13:54:59 -0700 |
parents | 448fc659a430 |
children | 6d73b7ff8f92 |
comparison
equal
deleted
inserted
replaced
32811:ff02bb5979c1 | 32812:add613cddcb6 |
---|---|
1736 # missing file matches a directory, etc, but we don't need to | 1736 # missing file matches a directory, etc, but we don't need to |
1737 # bother with that: if f has made it to this point, we're sure | 1737 # bother with that: if f has made it to this point, we're sure |
1738 # it's in the dirstate. | 1738 # it's in the dirstate. |
1739 deleted.append(f) | 1739 deleted.append(f) |
1740 | 1740 |
1741 # update dirstate for files that are actually clean | 1741 return modified, deleted, fixup |
1742 | |
1743 def _poststatusfixup(self, fixup): | |
1744 """update dirstate for files that are actually clean""" | |
1742 if fixup: | 1745 if fixup: |
1743 try: | 1746 try: |
1744 oldid = self._repo.dirstate.identity() | 1747 oldid = self._repo.dirstate.identity() |
1745 | 1748 |
1746 # updating the dirstate is optional | 1749 # updating the dirstate is optional |
1765 # caching (see also issue5584 for detail) | 1768 # caching (see also issue5584 for detail) |
1766 self._repo.ui.debug('skip updating dirstate: ' | 1769 self._repo.ui.debug('skip updating dirstate: ' |
1767 'identity mismatch\n') | 1770 'identity mismatch\n') |
1768 except error.LockError: | 1771 except error.LockError: |
1769 pass | 1772 pass |
1770 return modified, deleted, fixup | |
1771 | 1773 |
1772 def _dirstatestatus(self, match=None, ignored=False, clean=False, | 1774 def _dirstatestatus(self, match=None, ignored=False, clean=False, |
1773 unknown=False): | 1775 unknown=False): |
1774 '''Gets the status from the dirstate -- internal use only.''' | 1776 '''Gets the status from the dirstate -- internal use only.''' |
1775 listignored, listclean, listunknown = ignored, clean, unknown | 1777 listignored, listclean, listunknown = ignored, clean, unknown |
1779 subrepos = sorted(self.substate) | 1781 subrepos = sorted(self.substate) |
1780 cmp, s = self._repo.dirstate.status(match, subrepos, listignored, | 1782 cmp, s = self._repo.dirstate.status(match, subrepos, listignored, |
1781 listclean, listunknown) | 1783 listclean, listunknown) |
1782 | 1784 |
1783 # check for any possibly clean files | 1785 # check for any possibly clean files |
1786 fixup = [] | |
1784 if cmp: | 1787 if cmp: |
1785 modified2, deleted2, fixup = self._checklookup(cmp) | 1788 modified2, deleted2, fixup = self._checklookup(cmp) |
1786 s.modified.extend(modified2) | 1789 s.modified.extend(modified2) |
1787 s.deleted.extend(deleted2) | 1790 s.deleted.extend(deleted2) |
1788 | 1791 |
1789 # update dirstate for files that are actually clean | |
1790 if fixup and listclean: | 1792 if fixup and listclean: |
1791 s.clean.extend(fixup) | 1793 s.clean.extend(fixup) |
1794 | |
1795 self._poststatusfixup(fixup) | |
1792 | 1796 |
1793 if match.always(): | 1797 if match.always(): |
1794 # cache for performance | 1798 # cache for performance |
1795 if s.unknown or s.ignored or s.clean: | 1799 if s.unknown or s.ignored or s.clean: |
1796 # "_status" is cached with list*=False in the normal route | 1800 # "_status" is cached with list*=False in the normal route |