largefiles: rely on main scoping for writing dirstate in `markcommitted`
authorPierre-Yves David <pierre-yves.david@octobus.net>
Sun, 05 Feb 2023 12:09:52 +0100
changeset 50050 22cd517bc6b0
parent 50049 088ee6adfb09
child 50051 9409f2946f16
largefiles: rely on main scoping for writing dirstate in `markcommitted` Yeah, cleaner code.
hgext/largefiles/lfutil.py
--- a/hgext/largefiles/lfutil.py	Sun Feb 05 12:05:23 2023 +0100
+++ b/hgext/largefiles/lfutil.py	Sun Feb 05 12:09:52 2023 +0100
@@ -601,8 +601,7 @@
 def markcommitted(orig, ctx, node):
     repo = ctx.repo()
 
-    lfdirstate = openlfdirstate(repo.ui, repo)
-    with lfdirstate.changing_parents(repo):
+    with repo.dirstate.changing_parents(repo):
         orig(node)
 
         # ATTENTION: "ctx.files()" may differ from "repo[node].files()"
@@ -614,11 +613,11 @@
         # - have to be marked as "n" after commit, but
         # - aren't listed in "repo[node].files()"
 
+        lfdirstate = openlfdirstate(repo.ui, repo)
         for f in ctx.files():
             lfile = splitstandin(f)
             if lfile is not None:
                 synclfdirstate(repo, lfdirstate, lfile, False)
-    lfdirstate.write(repo.currenttransaction())
 
     # As part of committing, copy all of the largefiles into the cache.
     #