##// END OF EJS Templates
fsmonitor: centralize setup procedures for dirstate
FUJIWARA Katsunori -
r33386:5a9b4370 default
parent child Browse files
Show More
@@ -536,8 +536,8 b' class poststatus(object):'
536 status.deleted + status.unknown)
536 status.deleted + status.unknown)
537 wctx.repo()._fsmonitorstate.set(clock, hashignore, notefiles)
537 wctx.repo()._fsmonitorstate.set(clock, hashignore, notefiles)
538
538
539 def makedirstate(cls):
539 def makedirstate(repo, dirstate):
540 class fsmonitordirstate(cls):
540 class fsmonitordirstate(dirstate.__class__):
541 def _fsmonitorinit(self, fsmonitorstate, watchmanclient):
541 def _fsmonitorinit(self, fsmonitorstate, watchmanclient):
542 # _fsmonitordisable is used in paranoid mode
542 # _fsmonitordisable is used in paranoid mode
543 self._fsmonitordisable = False
543 self._fsmonitordisable = False
@@ -558,14 +558,14 b' def makedirstate(cls):'
558 self._fsmonitorstate.invalidate()
558 self._fsmonitorstate.invalidate()
559 return super(fsmonitordirstate, self).invalidate(*args, **kwargs)
559 return super(fsmonitordirstate, self).invalidate(*args, **kwargs)
560
560
561 return fsmonitordirstate
561 dirstate.__class__ = fsmonitordirstate
562 dirstate._fsmonitorinit(repo._fsmonitorstate, repo._watchmanclient)
562
563
563 def wrapdirstate(orig, self):
564 def wrapdirstate(orig, self):
564 ds = orig(self)
565 ds = orig(self)
565 # only override the dirstate when Watchman is available for the repo
566 # only override the dirstate when Watchman is available for the repo
566 if util.safehasattr(self, '_fsmonitorstate'):
567 if util.safehasattr(self, '_fsmonitorstate'):
567 ds.__class__ = makedirstate(ds.__class__)
568 makedirstate(self, ds)
568 ds._fsmonitorinit(self._fsmonitorstate, self._watchmanclient)
569 return ds
569 return ds
570
570
571 def extsetup(ui):
571 def extsetup(ui):
@@ -701,8 +701,8 b' def reposetup(ui, repo):'
701 # at this point since fsmonitorstate wasn't present, repo.dirstate is
701 # at this point since fsmonitorstate wasn't present, repo.dirstate is
702 # not a fsmonitordirstate
702 # not a fsmonitordirstate
703 dirstate = repo.dirstate
703 dirstate = repo.dirstate
704 dirstate.__class__ = makedirstate(dirstate.__class__)
704 makedirstate(repo, dirstate)
705 dirstate._fsmonitorinit(fsmonitorstate, client)
705
706 # invalidate property cache, but keep filecache which contains the
706 # invalidate property cache, but keep filecache which contains the
707 # wrapped dirstate object
707 # wrapped dirstate object
708 del repo.unfiltered().__dict__['dirstate']
708 del repo.unfiltered().__dict__['dirstate']
General Comments 0
You need to be logged in to leave comments. Login now