Patchwork D11105: largefile: use parentchange during mergerecordupdates

login
register
mail settings
Submitter phabricator
Date July 18, 2021, 9:53 p.m.
Message ID <differential-rev-PHID-DREV-irotmbhye5btmz6empbc-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/49419/
State Superseded
Headers show

Comments

phabricator - July 18, 2021, 9:53 p.m.
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This match what core is doing around recordupdates.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

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
@@ -650,12 +650,15 @@ 
 def mergerecordupdates(orig, repo, actions, branchmerge, getfiledata):
     if MERGE_ACTION_LARGEFILE_MARK_REMOVED in actions:
         lfdirstate = lfutil.openlfdirstate(repo.ui, repo)
-        for lfile, args, msg in actions[MERGE_ACTION_LARGEFILE_MARK_REMOVED]:
-            # this should be executed before 'orig', to execute 'remove'
-            # before all other actions
-            repo.dirstate.remove(lfile)
-            # make sure lfile doesn't get synclfdirstate'd as normal
-            lfdirstate.add(lfile)
+        with lfdirstate.parentchange():
+            for lfile, args, msg in actions[
+                MERGE_ACTION_LARGEFILE_MARK_REMOVED
+            ]:
+                # this should be executed before 'orig', to execute 'remove'
+                # before all other actions
+                repo.dirstate.remove(lfile)
+                # make sure lfile doesn't get synclfdirstate'd as normal
+                lfdirstate.add(lfile)
         lfdirstate.write()
 
     return orig(repo, actions, branchmerge, getfiledata)
@@ -667,7 +670,7 @@ 
 def overridefilemerge(
     origfn, premerge, repo, wctx, mynode, orig, fcd, fco, fca, labels=None
 ):
-    if not lfutil.isstandin(orig) or fcd.isabsent() or fco.isabsent():
+    f not lfutil.isstandin(orig) or fcd.isabsent() or fco.isabsent():
         return origfn(
             premerge, repo, wctx, mynode, orig, fcd, fco, fca, labels=labels
         )