Mercurial > hg > mercurial-source
diff hgext/fsmonitor/__init__.py @ 33598:15e85dded933
fsmonitor: write state with wlock held and dirstate unchanged (issue5581)
This means that the state will not be written if:
(1) either the wlock can't be obtained
(2) something else came along and changed the dirstate while we were in the
middle of a status run.
author | Siddharth Agarwal <sid0@fb.com> |
---|---|
date | Mon, 12 Jun 2017 15:34:31 -0700 |
parents | de09138bf0f5 |
children | 8bb4c69c4000 |
line wrap: on
line diff
--- a/hgext/fsmonitor/__init__.py +++ b/hgext/fsmonitor/__init__.py @@ -485,17 +485,14 @@ else: stateunknown = listunknown + if updatestate: + ps = poststatus(startclock) + self.addpostdsstatus(ps) + r = orig(node1, node2, match, listignored, listclean, stateunknown, listsubrepos) modified, added, removed, deleted, unknown, ignored, clean = r - if updatestate: - notefiles = modified + added + removed + deleted + unknown - self._fsmonitorstate.set( - self._fsmonitorstate.getlastclock() or startclock, - _hashignore(self.dirstate._ignore), - notefiles) - if not listunknown: unknown = [] @@ -528,6 +525,17 @@ return scmutil.status( modified, added, removed, deleted, unknown, ignored, clean) +class poststatus(object): + def __init__(self, startclock): + self._startclock = startclock + + def __call__(self, wctx, status): + clock = wctx.repo()._fsmonitorstate.getlastclock() or self._startclock + hashignore = _hashignore(wctx.repo().dirstate._ignore) + notefiles = (status.modified + status.added + status.removed + + status.deleted + status.unknown) + wctx.repo()._fsmonitorstate.set(clock, hashignore, notefiles) + def makedirstate(cls): class fsmonitordirstate(cls): def _fsmonitorinit(self, fsmonitorstate, watchmanclient):