def reposetup(ui, repo) -> None: if repo.local(): repo.journal = journalstorage(repo) repo._wlockfreeprefix.add("namejournal") dirstate, cached = localrepo.isfilecached(repo, "dirstate") if cached: # already instantiated dirstate isn't yet marked as # "journal"-ing, even though repo.dirstate() was already # wrapped by own wrapdirstate() _setupdirstate(repo, dirstate)
def reposetup(ui, repo): # We don't work with largefiles or inotify exts = extensions.enabled() for ext in _blacklist: if ext in exts: ui.warn( _( "The fsmonitor extension is incompatible with the %s " "extension and has been disabled.\n" ) % ext ) return # We only work with local repositories if not repo.local(): return # For Eden-backed repositories the eden extension already handles optimizing # dirstate operations. Let the eden extension manage the dirstate in this case. if "eden" in repo.requirements: return # Check if fsmonitor is explicitly disabled for this repository fsmonitorstate = state.state(repo) if fsmonitorstate.mode == "off": return try: watchmanclient.createclientforrepo(repo) except Exception as ex: _handleunavailable(ui, fsmonitorstate, ex) return repo._fsmonitorstate = fsmonitorstate dirstate, cached = localrepo.isfilecached(repo, "dirstate") if cached: # at this point since fsmonitorstate wasn't present, # repo.dirstate is not a fsmonitordirstate makedirstate(repo, dirstate) class fsmonitorrepo(repo.__class__): def status(self, *args, **kwargs): orig = super(fsmonitorrepo, self).status return overridestatus(orig, self, *args, **kwargs) repo.__class__ = fsmonitorrepo