largefiles: rely on main scoping for writing dirstate in `mergeupdate`
authorPierre-Yves David <pierre-yves.david@octobus.net>
Sun, 05 Feb 2023 12:05:23 +0100
changeset 50049 088ee6adfb09
parent 50048 c3c8ac540513
child 50050 22cd517bc6b0
largefiles: rely on main scoping for writing dirstate in `mergeupdate` Yeah, cleaner code.
hgext/largefiles/overrides.py
--- a/hgext/largefiles/overrides.py	Sat Feb 04 16:54:46 2023 +0100
+++ b/hgext/largefiles/overrides.py	Sun Feb 05 12:05:23 2023 +0100
@@ -1830,7 +1830,8 @@
             raise error.ProgrammingError(
                 b'largefiles is not compatible with in-memory merge'
             )
-        with lfdirstate.changing_parents(repo):
+        with repo.dirstate.changing_parents(repo):
+            lfdirstate = lfutil.openlfdirstate(repo.ui, repo)
             result = orig(repo, node, branchmerge, force, *args, **kwargs)
 
             newstandins = lfutil.getstandinsstate(repo)
@@ -1840,7 +1841,6 @@
             # all the ones that didn't change as clean
             for lfile in oldclean.difference(filelist):
                 lfdirstate.update_file(lfile, p1_tracked=True, wc_tracked=True)
-            lfdirstate.write(repo.currenttransaction())
 
             if branchmerge or force or partial:
                 filelist.extend(s.deleted + s.removed)