changeset 50142:308aff0243ae

large-files: also open the context in the subdirstate
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 20 Feb 2023 17:16:52 +0100
parents 42288fa03322
children ec3631290eb7
files hgext/largefiles/overrides.py
diffstat 1 files changed, 21 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/largefiles/overrides.py	Wed Feb 22 00:23:06 2023 +0100
+++ b/hgext/largefiles/overrides.py	Mon Feb 20 17:16:52 2023 +0100
@@ -334,6 +334,27 @@
         self._sub_dirstate = pre
 
 
+@eh.wrapfunction(dirstate.dirstate, b'running_status')
+@contextlib.contextmanager
+def running_status(orig, self, repo):
+    pre = sub_dirstate = getattr(self, '_sub_dirstate', None)
+    try:
+        lfd = getattr(self, '_large_file_dirstate', False)
+        if sub_dirstate is None and not lfd:
+            sub_dirstate = lfutil.openlfdirstate(repo.ui, repo)
+            self._sub_dirstate = sub_dirstate
+        if not lfd:
+            assert self._sub_dirstate is not None
+        with orig(self, repo):
+            if sub_dirstate is None:
+                yield
+            else:
+                with sub_dirstate.running_status(repo):
+                    yield
+    finally:
+        self._sub_dirstate = pre
+
+
 @eh.wrapfunction(subrepo.hgsubrepo, b'status')
 def overridestatusfn(orig, repo, rev2, **opts):
     with lfstatus(repo._repo):