From cb7c7a648955f9238dc2554221a5e96b7120cb68 Mon Sep 17 00:00:00 2001 From: Yuya Nishihara Date: Mon, 3 Mar 2014 19:41:23 +0900 Subject: [PATCH] localrepo: add hook point to invalidate everything on each command-server run MQ extension will wrap this function to invalidate its state. repo.invalidate cannot be wrapped for this purpose because qpush obtains repo.lock in the middle of the operation, triggering repo.invalidate. Also, it seems wrong to obtain lock earlier because mq data is non-store parts. --- mercurial/commandserver.py | 3 +-- mercurial/localrepo.py | 7 +++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/mercurial/commandserver.py b/mercurial/commandserver.py index a1596f81a2..663f3c6157 100644 --- a/mercurial/commandserver.py +++ b/mercurial/commandserver.py @@ -188,8 +188,7 @@ class server(object): repoui = self.repoui.__class__(self.repoui) repoui.copy = copiedui.copy # redo copy protection self.repo.ui = self.repo.dirstate._ui = repoui - self.repo.invalidate() - self.repo.invalidatedirstate() + self.repo.invalidateall() req = dispatch.request(args[:], copiedui, self.repo, self.cin, self.cout, self.cerr) diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py index 8e115c84e2..90d05dea54 100644 --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -993,6 +993,13 @@ class localrepository(object): pass self.invalidatecaches() + def invalidateall(self): + '''Fully invalidates both store and non-store parts, causing the + subsequent operation to reread any outside changes.''' + # extension should hook this to invalidate its caches + self.invalidate() + self.invalidatedirstate() + def _lock(self, vfs, lockname, wait, releasefn, acquirefn, desc): try: l = lockmod.lock(vfs, lockname, 0, releasefn, desc=desc)