Page MenuHomePhabricator

fix: allow tools to use :linerange, but also run if a file is unchanged
ClosedPublic

Authored by hooper on Mon, Aug 12, 7:40 PM.

Details

Summary

The definition of "unchanged" here is subtle, because pure deletion diff hunks
are ignored. That means this is different from using the --whole flag. This
change allows you to configure, for example, a code formatter that:

  1. Formats specific line ranges if specified via flags
  2. Does not format the entire file when there are no line ranges provided
  3. Performs some other kind of formatting regardless of provided line ranges

This sounds a little far fetched, but it is meant to address a specific corner
case encountered in Google's use of the fix extension. The default behavior is
kept because it exists to prevent mistakes that could erase uncommitted
changes.

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

hooper created this revision.Mon, Aug 12, 7:40 PM
hooper updated this revision to Diff 16181.Tue, Aug 13, 6:21 PM
This revision was not accepted when it landed; it landed in state Needs Review.
This revision was automatically updated to reflect the committed changes.