Details
Details
- Reviewers
pulkit - Group Reviewers
hg-reviewers - Commits
- rHGb1b6d0cad455: largefile: use `parentchange` markcommitted
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Branch
- default
- Lint
No Linters Available - Unit
No Unit Test Coverage
pulkit |
hg-reviewers |
No Linters Available |
No Unit Test Coverage |
Path | Packages | |||
---|---|---|---|---|
M | hgext/largefiles/lfutil.py (4 lines) |
Commit | Parents | Author | Summary | Date |
---|---|---|---|---|
1afd2fce87e3 | 8305ede5837e | Pierre-Yves David | Jul 8 2021, 4:04 PM |
lfdirstate.add(lfile) | lfdirstate.add(lfile) | ||||
elif state == b'?': | elif state == b'?': | ||||
lfdirstate.drop(lfile) | lfdirstate.drop(lfile) | ||||
def markcommitted(orig, ctx, node): | def markcommitted(orig, ctx, node): | ||||
repo = ctx.repo() | repo = ctx.repo() | ||||
with ctx._repo.dirstate.parentchange(): | lfdirstate = openlfdirstate(repo.ui, repo) | ||||
with lfdirstate.parentchange(): | |||||
orig(node) | orig(node) | ||||
# ATTENTION: "ctx.files()" may differ from "repo[node].files()" | # ATTENTION: "ctx.files()" may differ from "repo[node].files()" | ||||
# because files coming from the 2nd parent are omitted in the latter. | # because files coming from the 2nd parent are omitted in the latter. | ||||
# | # | ||||
# The former should be used to get targets of "synclfdirstate", | # The former should be used to get targets of "synclfdirstate", | ||||
# because such files: | # because such files: | ||||
# - are marked as "a" by "patch.patch()" (e.g. via transplant), and | # - are marked as "a" by "patch.patch()" (e.g. via transplant), and | ||||
# - have to be marked as "n" after commit, but | # - have to be marked as "n" after commit, but | ||||
# - aren't listed in "repo[node].files()" | # - aren't listed in "repo[node].files()" | ||||
lfdirstate = openlfdirstate(repo.ui, repo) | |||||
for f in ctx.files(): | for f in ctx.files(): | ||||
lfile = splitstandin(f) | lfile = splitstandin(f) | ||||
if lfile is not None: | if lfile is not None: | ||||
synclfdirstate(repo, lfdirstate, lfile, False) | synclfdirstate(repo, lfdirstate, lfile, False) | ||||
lfdirstate.write() | lfdirstate.write() | ||||
# As part of committing, copy all of the largefiles into the cache. | # As part of committing, copy all of the largefiles into the cache. | ||||
# | # |