Show More
@@ -1738,7 +1738,10 b' class workingctx(committablectx):' | |||||
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() | |
@@ -1767,7 +1770,6 b' class workingctx(committablectx):' | |||||
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): | |
@@ -1781,15 +1783,17 b' class workingctx(committablectx):' | |||||
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) | |
1792 |
|
1794 | |||
|
1795 | self._poststatusfixup(fixup) | |||
|
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: |
@@ -2,7 +2,7 b'' | |||||
2 | # specified by '[fakedirstatewritetime] fakenow', only when |
|
2 | # specified by '[fakedirstatewritetime] fakenow', only when | |
3 | # 'dirstate.write()' is invoked via functions below: |
|
3 | # 'dirstate.write()' is invoked via functions below: | |
4 | # |
|
4 | # | |
5 |
# - 'workingctx._ |
|
5 | # - 'workingctx._poststatusfixup()' (= 'repo.status()') | |
6 | # - 'committablectx.markcommitted()' |
|
6 | # - 'committablectx.markcommitted()' | |
7 |
|
7 | |||
8 | from __future__ import absolute_import |
|
8 | from __future__ import absolute_import | |
@@ -55,16 +55,16 b' def fakewrite(ui, func):' | |||||
55 | parsers.pack_dirstate = orig_pack_dirstate |
|
55 | parsers.pack_dirstate = orig_pack_dirstate | |
56 | dirstate._getfsnow = orig_dirstate_getfsnow |
|
56 | dirstate._getfsnow = orig_dirstate_getfsnow | |
57 |
|
57 | |||
58 |
def _ |
|
58 | def _poststatusfixup(orig, workingctx, fixup): | |
59 | ui = workingctx.repo().ui |
|
59 | ui = workingctx.repo().ui | |
60 |
return fakewrite(ui, lambda : orig(workingctx, fi |
|
60 | return fakewrite(ui, lambda : orig(workingctx, fixup)) | |
61 |
|
61 | |||
62 | def markcommitted(orig, committablectx, node): |
|
62 | def markcommitted(orig, committablectx, node): | |
63 | ui = committablectx.repo().ui |
|
63 | ui = committablectx.repo().ui | |
64 | return fakewrite(ui, lambda : orig(committablectx, node)) |
|
64 | return fakewrite(ui, lambda : orig(committablectx, node)) | |
65 |
|
65 | |||
66 | def extsetup(ui): |
|
66 | def extsetup(ui): | |
67 |
extensions.wrapfunction(context.workingctx, '_ |
|
67 | extensions.wrapfunction(context.workingctx, '_poststatusfixup', | |
68 |
_ |
|
68 | _poststatusfixup) | |
69 | extensions.wrapfunction(context.committablectx, 'markcommitted', |
|
69 | extensions.wrapfunction(context.committablectx, 'markcommitted', | |
70 | markcommitted) |
|
70 | markcommitted) |
@@ -101,7 +101,7 b' anyway.' | |||||
101 |
|
101 | |||
102 | Test that dirstate changes aren't written out at the end of "hg |
|
102 | Test that dirstate changes aren't written out at the end of "hg | |
103 | status", if .hg/dirstate is already changed simultaneously before |
|
103 | status", if .hg/dirstate is already changed simultaneously before | |
104 |
acquisition of wlock in workingctx._ |
|
104 | acquisition of wlock in workingctx._poststatusfixup(). | |
105 |
|
105 | |||
106 | This avoidance is important to keep consistency of dirstate in race |
|
106 | This avoidance is important to keep consistency of dirstate in race | |
107 | condition (see issue5584 for detail). |
|
107 | condition (see issue5584 for detail). |
General Comments 0
You need to be logged in to leave comments.
Login now