comparison hgext/largefiles/lfutil.py @ 47656:b1b6d0cad455

largefile: use `parentchange` markcommitted Differential Revision: https://phab.mercurial-scm.org/D11112
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Thu, 08 Jul 2021 22:04:31 +0200
parents f16958beb27b
children 034979d24c7b
comparison
equal deleted inserted replaced
47655:0ab58b1f228f 47656:b1b6d0cad455
572 572
573 573
574 def markcommitted(orig, ctx, node): 574 def markcommitted(orig, ctx, node):
575 repo = ctx.repo() 575 repo = ctx.repo()
576 576
577 with ctx._repo.dirstate.parentchange(): 577 lfdirstate = openlfdirstate(repo.ui, repo)
578 with lfdirstate.parentchange():
578 orig(node) 579 orig(node)
579 580
580 # ATTENTION: "ctx.files()" may differ from "repo[node].files()" 581 # ATTENTION: "ctx.files()" may differ from "repo[node].files()"
581 # because files coming from the 2nd parent are omitted in the latter. 582 # because files coming from the 2nd parent are omitted in the latter.
582 # 583 #
584 # because such files: 585 # because such files:
585 # - are marked as "a" by "patch.patch()" (e.g. via transplant), and 586 # - are marked as "a" by "patch.patch()" (e.g. via transplant), and
586 # - have to be marked as "n" after commit, but 587 # - have to be marked as "n" after commit, but
587 # - aren't listed in "repo[node].files()" 588 # - aren't listed in "repo[node].files()"
588 589
589 lfdirstate = openlfdirstate(repo.ui, repo)
590 for f in ctx.files(): 590 for f in ctx.files():
591 lfile = splitstandin(f) 591 lfile = splitstandin(f)
592 if lfile is not None: 592 if lfile is not None:
593 synclfdirstate(repo, lfdirstate, lfile, False) 593 synclfdirstate(repo, lfdirstate, lfile, False)
594 lfdirstate.write() 594 lfdirstate.write()