mirror of
https://github.com/facebook/sapling.git
synced 2025-01-08 22:56:44 +03:00
fsmonitor: move warnings into filesystem layer
Summary: Now that the post dirstate handlers are largely unused, let's move the fsmonitor state warning into the fsmonitor filesystem. This also allows us to remove the temporary _newid variable that was used to allow post-transaction detection of if the transaction happened. Reviewed By: quark-zju Differential Revision: D18259479 fbshipit-source-id: da88638d34a80480bbeba8b1531d523785d72c30
This commit is contained in:
parent
bca361cd3c
commit
d663a9dbdf
@ -945,14 +945,20 @@ class fsmonitorfilesystem(filesystem.physicalfilesystem):
|
|||||||
# skip it here.
|
# skip it here.
|
||||||
if isfullstatus and not istreestate:
|
if isfullstatus and not istreestate:
|
||||||
self._updatefsmonitorstate(changed, startclock)
|
self._updatefsmonitorstate(changed, startclock)
|
||||||
|
|
||||||
self._newid = newdirstate.identity()
|
|
||||||
else:
|
else:
|
||||||
|
if freshinstance:
|
||||||
|
repo.ui.write_err(
|
||||||
|
_(
|
||||||
|
"warning: failed to update watchman state because dirstate has been changed by other processes\n"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
repo.ui.write_err(dirstatemod.slowstatuswarning)
|
||||||
|
|
||||||
# in this case, writing changes out breaks
|
# in this case, writing changes out breaks
|
||||||
# consistency, because .hg/dirstate was
|
# consistency, because .hg/dirstate was
|
||||||
# already changed simultaneously after last
|
# already changed simultaneously after last
|
||||||
# caching (see also issue5584 for detail)
|
# caching (see also issue5584 for detail)
|
||||||
repo.ui.debug("skip marking lookups clean: identity mismatch\n")
|
repo.ui.debug("skip updating dirstate: identity mismatch\n")
|
||||||
except error.LockError:
|
except error.LockError:
|
||||||
if freshinstance:
|
if freshinstance:
|
||||||
repo.ui.write_err(
|
repo.ui.write_err(
|
||||||
|
@ -1073,19 +1073,7 @@ class dirstate(object):
|
|||||||
|
|
||||||
with self._repo.wlock(freshinstance):
|
with self._repo.wlock(freshinstance):
|
||||||
identity = self._repo.dirstate.identity()
|
identity = self._repo.dirstate.identity()
|
||||||
fsnewid = self._repo.dirstate._fs._newid
|
if identity == oldid:
|
||||||
if (
|
|
||||||
identity == oldid
|
|
||||||
or
|
|
||||||
# It's possible that the filesystem changed the dirstate
|
|
||||||
# when it marked lookup files as clean. If the current
|
|
||||||
# identity also matches the id of the
|
|
||||||
# post-lookup-cleaning identity, that is ok too.
|
|
||||||
# This nastiness will disappear in a future diff when
|
|
||||||
# the poststatusfixup logic moves into the filesystem
|
|
||||||
# layer.
|
|
||||||
(fsnewid is not None and identity == fsnewid)
|
|
||||||
):
|
|
||||||
if poststatusbefore:
|
if poststatusbefore:
|
||||||
for ps in poststatusbefore:
|
for ps in poststatusbefore:
|
||||||
ps(wctx, status)
|
ps(wctx, status)
|
||||||
@ -1102,22 +1090,6 @@ class dirstate(object):
|
|||||||
if poststatusafter:
|
if poststatusafter:
|
||||||
for ps in poststatusafter:
|
for ps in poststatusafter:
|
||||||
ps(wctx, status)
|
ps(wctx, status)
|
||||||
else:
|
|
||||||
if freshinstance:
|
|
||||||
ui.write_err(
|
|
||||||
_(
|
|
||||||
"warning: failed to update watchman state because dirstate has been changed by other processes\n"
|
|
||||||
)
|
|
||||||
)
|
|
||||||
ui.write_err(slowstatuswarning)
|
|
||||||
|
|
||||||
# in this case, writing changes out breaks
|
|
||||||
# consistency, because .hg/dirstate was
|
|
||||||
# already changed simultaneously after last
|
|
||||||
# caching (see also issue5584 for detail)
|
|
||||||
self._repo.ui.debug(
|
|
||||||
"skip updating dirstate: " "identity mismatch\n"
|
|
||||||
)
|
|
||||||
except error.LockError:
|
except error.LockError:
|
||||||
if freshinstance:
|
if freshinstance:
|
||||||
ui.write_err(
|
ui.write_err(
|
||||||
|
@ -45,13 +45,6 @@ class physicalfilesystem(object):
|
|||||||
self.ftolog = self.mtolog
|
self.ftolog = self.mtolog
|
||||||
self.cleanlookups = []
|
self.cleanlookups = []
|
||||||
|
|
||||||
# Temporary variable used to communicate the post-lookup dirstate
|
|
||||||
# identity to the higher level postdsstatus functions, so they can
|
|
||||||
# determine if the dirstate changing was caused by this process or by an
|
|
||||||
# external process. This will be deleted in a future diff, once the
|
|
||||||
# higher level postdsstatus logic moves down into this layer.
|
|
||||||
self._newid = None
|
|
||||||
|
|
||||||
def _ischanged(self, fn, st, lookups):
|
def _ischanged(self, fn, st, lookups):
|
||||||
try:
|
try:
|
||||||
t = self.dirstate._map[fn]
|
t = self.dirstate._map[fn]
|
||||||
@ -437,8 +430,6 @@ class physicalfilesystem(object):
|
|||||||
# This is a no-op if dirstate is not dirty.
|
# This is a no-op if dirstate is not dirty.
|
||||||
tr = repo.currenttransaction()
|
tr = repo.currenttransaction()
|
||||||
newdirstate.write(tr)
|
newdirstate.write(tr)
|
||||||
|
|
||||||
self._newid = newdirstate.identity()
|
|
||||||
else:
|
else:
|
||||||
# in this case, writing changes out breaks
|
# in this case, writing changes out breaks
|
||||||
# consistency, because .hg/dirstate was
|
# consistency, because .hg/dirstate was
|
||||||
|
@ -156,7 +156,7 @@ treated differently in _checklookup() according to runtime platform.
|
|||||||
|
|
||||||
#if fsmonitor
|
#if fsmonitor
|
||||||
$ hg status --config extensions.dirstaterace=$TESTTMP/dirstaterace.py --debug -X path:e
|
$ hg status --config extensions.dirstaterace=$TESTTMP/dirstaterace.py --debug -X path:e
|
||||||
skip marking lookups clean: identity mismatch
|
skip updating dirstate: identity mismatch
|
||||||
#else
|
#else
|
||||||
$ hg status --config extensions.dirstaterace=$TESTTMP/dirstaterace.py --debug -X path:e
|
$ hg status --config extensions.dirstaterace=$TESTTMP/dirstaterace.py --debug -X path:e
|
||||||
skip marking lookups clean: identity mismatch
|
skip marking lookups clean: identity mismatch
|
||||||
|
Loading…
Reference in New Issue
Block a user