changeset 47702:0149d17da91b

largefile: adjust the dirstate post update within a `parentchange` context This is doing an update, so this seems more appropriate. No other change have been made, but the next changeset will :-) Differential Revision: https://phab.mercurial-scm.org/D11144
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 19 Jul 2021 00:05:47 +0200
parents 0e87c90f1cd5
children 7d2f0e14da4c
files hgext/largefiles/overrides.py
diffstat 1 files changed, 14 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/largefiles/overrides.py	Fri Jul 16 14:06:32 2021 +0200
+++ b/hgext/largefiles/overrides.py	Mon Jul 19 00:05:47 2021 +0200
@@ -1796,23 +1796,24 @@
             raise error.ProgrammingError(
                 b'largefiles is not compatible with in-memory merge'
             )
-        result = orig(repo, node, branchmerge, force, *args, **kwargs)
+        with lfdirstate.parentchange():
+            result = orig(repo, node, branchmerge, force, *args, **kwargs)
 
-        newstandins = lfutil.getstandinsstate(repo)
-        filelist = lfutil.getlfilestoupdate(oldstandins, newstandins)
+            newstandins = lfutil.getstandinsstate(repo)
+            filelist = lfutil.getlfilestoupdate(oldstandins, newstandins)
 
-        # to avoid leaving all largefiles as dirty and thus rehash them, mark
-        # all the ones that didn't change as clean
-        for lfile in oldclean.difference(filelist):
-            lfdirstate.normal(lfile)
-        lfdirstate.write()
+            # to avoid leaving all largefiles as dirty and thus rehash them, mark
+            # all the ones that didn't change as clean
+            for lfile in oldclean.difference(filelist):
+                lfdirstate.normal(lfile)
+            lfdirstate.write()
 
-        if branchmerge or force or partial:
-            filelist.extend(s.deleted + s.removed)
+            if branchmerge or force or partial:
+                filelist.extend(s.deleted + s.removed)
 
-        lfcommands.updatelfiles(
-            repo.ui, repo, filelist=filelist, normallookup=partial
-        )
+            lfcommands.updatelfiles(
+                repo.ui, repo, filelist=filelist, normallookup=partial
+            )
 
         return result