This is an archive of the discontinued Mercurial Phabricator instance.

sparse: add --sparse option to hg diff
ClosedPublic

Authored by mbthomas on Sep 22 2017, 10:39 AM.
Tags
None
Subscribers

Details

Reviewers
durham
Group Reviewers
Restricted Project
Commits
rFBHGXb4df4123d0e9: sparse: add --sparse option to hg diff
Summary

Add a --sparse option to hg diff which filters the diff to include only files
that are part of the sparse profile.

When files are moved or copied across the sparse profile boundary, they will
show as added or removed (for moves) in the diff. This is the same behaviour
as hg diff --root.

Test Plan

Expand tests/test-sparse-diff.t

Diff Detail

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

Event Timeline

mbthomas created this revision.Sep 22 2017, 10:39 AM
Herald added a reviewer: Restricted Project. · View Herald TranscriptSep 22 2017, 10:39 AM
durham accepted this revision.Sep 22 2017, 12:51 PM
durham added a subscriber: durham.

I'm not sure how I feel about this showing add/delete for changes that cross the sparse boundary. But as long as it's an opt-in option, I'm fine with experimenting with it.

What was the motivation for this diff? Just out of curiousity

hgext3rd/sparse.py
371

When wrapping something for the duration of just this function call, you should use try/finally and put an extensions.unwrapfunction in the finally clause. That way we aren't depending on the process dying to clean this up.

This revision is now accepted and ready to land.Sep 22 2017, 12:51 PM
mbthomas updated this revision to Diff 2031.Sep 22 2017, 1:31 PM

I'm not sure how I feel about this showing add/delete for changes that cross the sparse boundary. But as long as it's an opt-in option, I'm fine with experimenting with it.

This is the same way hg --root behaves so I think it's reasonable.

This revision was automatically updated to reflect the committed changes.