--- a/hgext/largefiles/overrides.py Thu Jan 26 17:44:27 2023 +0100
+++ b/hgext/largefiles/overrides.py Wed Feb 15 10:46:46 2023 +0100
@@ -8,6 +8,7 @@
'''Overridden Mercurial commands and functions for the largefiles extension'''
+import contextlib
import copy
import os
@@ -21,6 +22,7 @@
archival,
cmdutil,
copies as copiesmod,
+ dirstate,
error,
exchange,
extensions,
@@ -311,6 +313,27 @@
)
+@eh.wrapfunction(dirstate.dirstate, b'_changing')
+@contextlib.contextmanager
+def _changing(orig, self, repo, change_type):
+ 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, change_type):
+ if sub_dirstate is None:
+ yield
+ else:
+ with sub_dirstate._changing(repo, change_type):
+ yield
+ finally:
+ self._sub_dirstate = pre
+
+
@eh.wrapfunction(subrepo.hgsubrepo, b'status')
def overridestatusfn(orig, repo, rev2, **opts):
with lfstatus(repo._repo):