Page MenuHomePhabricator

sparse: get data for excluded files from working copy parent

Authored by mbthomas on Sep 22 2017, 6:43 AM.



When commands like 'diff' request the contents of files from a workingfilectx,
normally this is satisfied by reading from disk. For files outside the sparse
checkout this doesn't work, so instead we must return the content from the
working copy parent.

Test Plan


Diff Detail

rFBHGX Facebook Mercurial Extensions
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

mbthomas created this revision.Sep 22 2017, 6:43 AM
Herald added a reviewer: Restricted Project. · View Herald TranscriptSep 22 2017, 6:43 AM
ryanmce accepted this revision.Sep 22 2017, 8:26 AM
ryanmce added a subscriber: ryanmce.

The change looks good to me. It would be informative to comment on the test what the error was before this change.

I think it might be worth some follow-ups for the weird edge cases we talked about: a sparse-excluded filename being in the working copy -- should we warn in this case? Diff against it with a warning? Diff against the "real" one with a warning?

However, this is clearly better than what we have now and we should get it in, and perhaps into the upstream sparse as well.

This revision is now accepted and ready to land.Sep 22 2017, 8:26 AM

Files in the working copy that alias sparse-excluded files are completely ignored by other commands (for example, they don't even show up in hg status), so I think ignoring here is fine, too.

I'm about to push a change that refactors this in preparation for my next diff. This is just to clean it up a bit.

durham accepted this revision.Sep 22 2017, 6:39 PM
durham added a subscriber: durham.

Hmm, seems a bit odd for the wctx to kinda lie about the data in the working copy. But the diff behavior is clearly better than it was before. Guess we'll see.

This revision was automatically updated to reflect the committed changes.