This is an archive of the discontinued Mercurial Phabricator instance.

merge: make applyupdates() not mutate mresult argument
ClosedPublic

Authored by martinvonz on Jun 1 2021, 6:46 PM.

Details

Summary

We have an extension at work that overrides merge.applyupdates() to
make it skip some writes and instead instruct the virtual filesystem
we use to get a different version. That override doesn't work
correctly when doing hg co -m and there's a modified file in the
dirstate that's deleted in the destination. That's because
applyupdates() mutates its mresult argument and our extension had
passed in a modified copied of mresult to the overridden function,
which resulted in the mutation not having any effect. This patch fixes
that by letting the caller (i.e. merge._update()) update mresult
with the extra actions instead. Besides fixing our internal extension,
that seems cleaner to me anyway (better to not mutate mresult only
in some cases and we can skip some of the logic if we're not going to
update the dirstate anyway).

Diff Detail

Repository
rHG Mercurial
Branch
default
Lint
No Linters Available
Unit
No Unit Test Coverage

Event Timeline

martinvonz created this revision.Jun 1 2021, 6:46 PM
pulkit accepted this revision.Jun 4 2021, 5:58 AM
This revision is now accepted and ready to land.Jun 4 2021, 5:58 AM
This revision was automatically updated to reflect the committed changes.