Mercurial > hg
comparison hgext/largefiles/lfutil.py @ 50050:22cd517bc6b0
largefiles: rely on main scoping for writing dirstate in `markcommitted`
Yeah, cleaner code.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Sun, 05 Feb 2023 12:09:52 +0100 |
parents | 0b4a6912292e |
children | 9b49809eb612 |
comparison
equal
deleted
inserted
replaced
50049:088ee6adfb09 | 50050:22cd517bc6b0 |
---|---|
599 | 599 |
600 | 600 |
601 def markcommitted(orig, ctx, node): | 601 def markcommitted(orig, ctx, node): |
602 repo = ctx.repo() | 602 repo = ctx.repo() |
603 | 603 |
604 lfdirstate = openlfdirstate(repo.ui, repo) | 604 with repo.dirstate.changing_parents(repo): |
605 with lfdirstate.changing_parents(repo): | |
606 orig(node) | 605 orig(node) |
607 | 606 |
608 # ATTENTION: "ctx.files()" may differ from "repo[node].files()" | 607 # ATTENTION: "ctx.files()" may differ from "repo[node].files()" |
609 # because files coming from the 2nd parent are omitted in the latter. | 608 # because files coming from the 2nd parent are omitted in the latter. |
610 # | 609 # |
612 # because such files: | 611 # because such files: |
613 # - are marked as "a" by "patch.patch()" (e.g. via transplant), and | 612 # - are marked as "a" by "patch.patch()" (e.g. via transplant), and |
614 # - have to be marked as "n" after commit, but | 613 # - have to be marked as "n" after commit, but |
615 # - aren't listed in "repo[node].files()" | 614 # - aren't listed in "repo[node].files()" |
616 | 615 |
616 lfdirstate = openlfdirstate(repo.ui, repo) | |
617 for f in ctx.files(): | 617 for f in ctx.files(): |
618 lfile = splitstandin(f) | 618 lfile = splitstandin(f) |
619 if lfile is not None: | 619 if lfile is not None: |
620 synclfdirstate(repo, lfdirstate, lfile, False) | 620 synclfdirstate(repo, lfdirstate, lfile, False) |
621 lfdirstate.write(repo.currenttransaction()) | |
622 | 621 |
623 # As part of committing, copy all of the largefiles into the cache. | 622 # As part of committing, copy all of the largefiles into the cache. |
624 # | 623 # |
625 # Using "node" instead of "ctx" implies additional "repo[node]" | 624 # Using "node" instead of "ctx" implies additional "repo[node]" |
626 # lookup while copyalltostore(), but can omit redundant check for | 625 # lookup while copyalltostore(), but can omit redundant check for |