This is an archive of the discontinued Mercurial Phabricator instance.

overlayworkingctx: fix exception in metadata-only inmemory merges (issue5960)
ClosedPublic

Authored by spectral on Aug 15 2018, 8:52 PM.

Details

Summary

If there was a metadata-only mutation, such as +x or -x on a file, we would
create a cache entry with None for data, and this would cause problems later on
when some code tried to run fctx.data() or similar, and was expecting a string.

My original fix for this involved passing data=self._wrappedctx[path].data() in
setflags(), but this version seems slightly better - this way, if we ever call
write() and then call setflags(), we don't destroy the data that we wrote that's
in the cache. I haven't verified that other fields aren't destroyed, such as
date or flags :)

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

spectral created this revision.Aug 15 2018, 8:52 PM
spectral updated this revision to Diff 10365.Aug 15 2018, 9:01 PM
phillco accepted this revision.Aug 15 2018, 9:39 PM

lgtm

pulkit accepted this revision.Aug 16 2018, 9:17 AM
pulkit added a subscriber: pulkit.

Thanks @phillco for the review.

This revision was automatically updated to reflect the committed changes.