##// 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 536 status.deleted + status.unknown)
537 537 wctx.repo()._fsmonitorstate.set(clock, hashignore, notefiles)
538 538
539 def makedirstate(cls):
540 class fsmonitordirstate(cls):
539 def makedirstate(repo, dirstate):
540 class fsmonitordirstate(dirstate.__class__):
541 541 def _fsmonitorinit(self, fsmonitorstate, watchmanclient):
542 542 # _fsmonitordisable is used in paranoid mode
543 543 self._fsmonitordisable = False
@@ -558,14 +558,14 b' def makedirstate(cls):'
558 558 self._fsmonitorstate.invalidate()
559 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 564 def wrapdirstate(orig, self):
564 565 ds = orig(self)
565 566 # only override the dirstate when Watchman is available for the repo
566 567 if util.safehasattr(self, '_fsmonitorstate'):
567 ds.__class__ = makedirstate(ds.__class__)
568 ds._fsmonitorinit(self._fsmonitorstate, self._watchmanclient)
568 makedirstate(self, ds)
569 569 return ds
570 570
571 571 def extsetup(ui):
@@ -701,8 +701,8 b' def reposetup(ui, repo):'
701 701 # at this point since fsmonitorstate wasn't present, repo.dirstate is
702 702 # not a fsmonitordirstate
703 703 dirstate = repo.dirstate
704 dirstate.__class__ = makedirstate(dirstate.__class__)
705 dirstate._fsmonitorinit(fsmonitorstate, client)
704 makedirstate(repo, dirstate)
705
706 706 # invalidate property cache, but keep filecache which contains the
707 707 # wrapped dirstate object
708 708 del repo.unfiltered().__dict__['dirstate']
General Comments 0
You need to be logged in to leave comments. Login now