changeset 50325:2761ce777fc4 stable

hooks: invalidate the repo after the hooks Since the hooks may have changed the repository content it seems safer to invalidate it. The invalidation is "soft", the data are kept around and few work will be needed to restore them if nothing actually changed.
author Arseniy Alekseyev <aalekseyev@janestreet.com>
date Thu, 23 Mar 2023 11:36:25 +0000
parents e6532a7336d0
children f14864fffdca
files mercurial/hook.py
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/hook.py	Thu Mar 23 21:18:54 2023 +0000
+++ b/mercurial/hook.py	Thu Mar 23 11:36:25 2023 +0000
@@ -191,6 +191,11 @@
         cwd = encoding.getcwd()
     r = ui.system(cmd, environ=env, cwd=cwd, blockedtag=b'exthook-%s' % (name,))
 
+    if repo is not None and repo.currentwlock() is None:
+        repo.invalidatedirstate()
+    if repo is not None and repo.currentlock() is None:
+        repo.invalidate()
+
     duration = util.timer() - starttime
     ui.log(
         b'exthook',