##// END OF EJS Templates
workingctx: factor out post-status dirstate fixup...
Siddharth Agarwal -
r32812:add613cd default
parent child Browse files
Show More
@@ -1738,7 +1738,10 b' class workingctx(committablectx):'
1738 1738 # it's in the dirstate.
1739 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 1745 if fixup:
1743 1746 try:
1744 1747 oldid = self._repo.dirstate.identity()
@@ -1767,7 +1770,6 b' class workingctx(committablectx):'
1767 1770 'identity mismatch\n')
1768 1771 except error.LockError:
1769 1772 pass
1770 return modified, deleted, fixup
1771 1773
1772 1774 def _dirstatestatus(self, match=None, ignored=False, clean=False,
1773 1775 unknown=False):
@@ -1781,15 +1783,17 b' class workingctx(committablectx):'
1781 1783 listclean, listunknown)
1782 1784
1783 1785 # check for any possibly clean files
1786 fixup = []
1784 1787 if cmp:
1785 1788 modified2, deleted2, fixup = self._checklookup(cmp)
1786 1789 s.modified.extend(modified2)
1787 1790 s.deleted.extend(deleted2)
1788 1791
1789 # update dirstate for files that are actually clean
1790 1792 if fixup and listclean:
1791 1793 s.clean.extend(fixup)
1792 1794
1795 self._poststatusfixup(fixup)
1796
1793 1797 if match.always():
1794 1798 # cache for performance
1795 1799 if s.unknown or s.ignored or s.clean:
@@ -2,7 +2,7 b''
2 2 # specified by '[fakedirstatewritetime] fakenow', only when
3 3 # 'dirstate.write()' is invoked via functions below:
4 4 #
5 # - 'workingctx._checklookup()' (= 'repo.status()')
5 # - 'workingctx._poststatusfixup()' (= 'repo.status()')
6 6 # - 'committablectx.markcommitted()'
7 7
8 8 from __future__ import absolute_import
@@ -55,16 +55,16 b' def fakewrite(ui, func):'
55 55 parsers.pack_dirstate = orig_pack_dirstate
56 56 dirstate._getfsnow = orig_dirstate_getfsnow
57 57
58 def _checklookup(orig, workingctx, files):
58 def _poststatusfixup(orig, workingctx, fixup):
59 59 ui = workingctx.repo().ui
60 return fakewrite(ui, lambda : orig(workingctx, files))
60 return fakewrite(ui, lambda : orig(workingctx, fixup))
61 61
62 62 def markcommitted(orig, committablectx, node):
63 63 ui = committablectx.repo().ui
64 64 return fakewrite(ui, lambda : orig(committablectx, node))
65 65
66 66 def extsetup(ui):
67 extensions.wrapfunction(context.workingctx, '_checklookup',
68 _checklookup)
67 extensions.wrapfunction(context.workingctx, '_poststatusfixup',
68 _poststatusfixup)
69 69 extensions.wrapfunction(context.committablectx, 'markcommitted',
70 70 markcommitted)
@@ -101,7 +101,7 b' anyway.'
101 101
102 102 Test that dirstate changes aren't written out at the end of "hg
103 103 status", if .hg/dirstate is already changed simultaneously before
104 acquisition of wlock in workingctx._checklookup().
104 acquisition of wlock in workingctx._poststatusfixup().
105 105
106 106 This avoidance is important to keep consistency of dirstate in race
107 107 condition (see issue5584 for detail).
General Comments 0
You need to be logged in to leave comments. Login now