hgext/largefiles/overrides.py
changeset 50029 28dfb2df4ab9
parent 50027 0b4a6912292e
child 50048 c3c8ac540513
--- a/hgext/largefiles/overrides.py	Sun Feb 05 15:38:23 2023 +0100
+++ b/hgext/largefiles/overrides.py	Wed Feb 15 11:51:58 2023 +0100
@@ -1545,11 +1545,19 @@
 
 
 @eh.wrapfunction(scmutil, b'addremove')
-def scmutiladdremove(orig, repo, matcher, prefix, uipathfn, opts=None):
+def scmutiladdremove(
+    orig,
+    repo,
+    matcher,
+    prefix,
+    uipathfn,
+    opts=None,
+    open_tr=None,
+):
     if opts is None:
         opts = {}
     if not lfutil.islfilesrepo(repo):
-        return orig(repo, matcher, prefix, uipathfn, opts)
+        return orig(repo, matcher, prefix, uipathfn, opts, open_tr=open_tr)
     # Get the list of missing largefiles so we can remove them
     lfdirstate = lfutil.openlfdirstate(repo.ui, repo)
     unsure, s, mtime_boundary = lfdirstate.status(
@@ -1560,6 +1568,10 @@
         unknown=False,
     )
 
+    # open the transaction and changing_files context
+    if open_tr is not None:
+        open_tr()
+
     # Call into the normal remove code, but the removing of the standin, we want
     # to have handled by original addremove.  Monkey patching here makes sure
     # we don't remove the standin in the largefiles code, preventing a very
@@ -1592,7 +1604,8 @@
     # function to take care of the rest.  Make sure it doesn't do anything with
     # largefiles by passing a matcher that will ignore them.
     matcher = composenormalfilematcher(matcher, repo[None].manifest(), added)
-    return orig(repo, matcher, prefix, uipathfn, opts)
+
+    return orig(repo, matcher, prefix, uipathfn, opts, open_tr=open_tr)
 
 
 # Calling purge with --all will cause the largefiles to be deleted.