Patchwork D11144: largefile: adjust the dirstate post update within a `parentchange` context

login
register
mail settings
Submitter phabricator
Date July 19, 2021, 10:43 a.m.
Message ID <differential-rev-PHID-DREV-x7bq3qxejatioxint7af-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/49458/
State Superseded
Headers show

Comments

phabricator - July 19, 2021, 10:43 a.m.
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This is doing an update, so this seems more appropriate. No other change have been made, but the next changeset will :-)

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D11144

AFFECTED FILES
  hgext/largefiles/overrides.py

CHANGE DETAILS




To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py
--- a/hgext/largefiles/overrides.py
+++ b/hgext/largefiles/overrides.py
@@ -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