24 Commits

Author SHA1 Message Date
Chris Emerson
fc377f3fb0 Add a new get_modified_lines() API to get only the new
changed lines from rustfmting.

Squashed commit of the following:

commit e90f9da64bbdb640b8c9ee61c3ad395617d8b4da
Author: Chris Emerson <github@mail.nosreme.org>
Date:   Sat Jan 20 20:10:16 2018 +0000

    Fix tests after merging with master.

commit c3af0042769fe459b0c9c94a0934605ea4b40e40
Merge: 03868583 e0e3e222
Author: Chris Emerson <github@mail.nosreme.org>
Date:   Sat Jan 20 17:45:05 2018 +0000

    Merge remote-tracking branch 'origin/master' into HEAD

commit 03868583f8555aae30bdfb5839a82afd3704f4cb
Author: Chris Emerson <github@mail.nosreme.org>
Date:   Mon Nov 20 01:57:56 2017 +0000

    Fix some warnings.

commit 162b13463e44c782394d418db5ca5710931beb7a
Author: Chris Emerson <github@mail.nosreme.org>
Date:   Mon Nov 20 01:48:02 2017 +0000

    Remove unneeded import.

commit 20cce3cbfd0f386d92b80bf4c7b83ab4d78a73e7
Merge: 81e98147 fa794f58
Author: Chris Emerson <github@mail.nosreme.org>
Date:   Mon Nov 20 01:07:17 2017 +0000

    Merge branch 'master' into difflines_mode

commit 81e981472ceb3a0938d6f050edf8dcd5ebff8e33
Author: Chris Emerson <github@mail.nosreme.org>
Date:   Mon Nov 20 01:02:50 2017 +0000

    Add a simple "modified lines" test.

commit 018390ced3523ca9fdd5384a6c1004cdb99174a9
Author: Chris Emerson <github@mail.nosreme.org>
Date:   Thu Nov 2 23:06:21 2017 +0000

    Update test output.

commit 7909f4986ed21999aff7b3d075332e686ac464ff
Author: Chris Emerson <github@mail.nosreme.org>
Date:   Thu Nov 2 23:03:22 2017 +0000

    Rerun rustfmt.

commit 6275f1a8da52db1df36c4b7432996cdbb94ca463
Merge: 7a66d286 175c0c6f
Author: Chris Emerson <github@mail.nosreme.org>
Date:   Thu Nov 2 21:40:29 2017 +0000

    Merge remote-tracking branch 'origin/master' into difflines_mode

commit 7a66d2866432c430b046938bb37bf5efc03fa9da
Author: Chris Emerson <github@mail.nosreme.org>
Date:   Thu Nov 2 21:36:40 2017 +0000

    WIP: Add a separate API to get changed lines.
    Currently calls format_input() and adjusts the output.

commit c8163a923c7d9ae42fd8078cd9b2b51c6f73e36e
Author: Chris Emerson <github@mail.nosreme.org>
Date:   Fri Oct 27 22:53:33 2017 +0100

    Remove "modified" from the documentation again.

commit 94041fa115a6f428afe40e01d41bf2fe603f70bb
Merge: acaa3c7c 2adf7eec
Author: Chris Emerson <github@mail.nosreme.org>
Date:   Fri Oct 27 22:47:05 2017 +0100

    Merge branch 'master' into difflines_mode

commit acaa3c7ce446297cd3fe5c9610763629a2d8537c
Author: Chris Emerson <github@mail.nosreme.org>
Date:   Tue Oct 24 23:34:14 2017 +0100

    Update the Modified write mode to use `out` instead of just prinln!().

    This means we can test it more easily, so do so.

commit 9f1bbca1f3c12d933ea823918cc548e69b438b1e
Author: Chris Emerson <github@mail.nosreme.org>
Date:   Tue Oct 24 23:11:55 2017 +0100

    Add "Modified" to the various lists of modes.

commit e12f023756cf3daf202dcaa02bd6492b0d2a0455
Author: Chris Emerson <github@mail.nosreme.org>
Date:   Tue Oct 24 22:57:33 2017 +0100

    Rerun cargo fmt.

commit 0f8a43630fa1548e95dcb1c0933708f9c11ae135
Author: Chris Emerson <github@mail.nosreme.org>
Date:   Tue Oct 24 22:46:26 2017 +0100

    Add `line_number_orig` to instances of `Mismatch` in tests.

commit d432a7061f74dbc159584f08470c64985a4b41d9
Author: Chris Emerson <github@mail.nosreme.org>
Date:   Tue Oct 24 22:41:40 2017 +0100

    Add a `line_number_orig` field to `Mismatch` to track the pre-format line number.
    Use that for the write-mode=modified output.

commit bdb7d1d23f02f7b8f18e7073a65be88ff94cdbb3
Author: Chris Emerson <github@mail.nosreme.org>
Date:   Tue Oct 24 22:35:50 2017 +0100

    First basic --write-mode=modified implementation.

commit ea1433dae0c32879a31182c11be08b1bf53fbf31
Author: Chris Emerson <github@mail.nosreme.org>
Date:   Fri Oct 20 00:04:16 2017 +0100

    WIP on new "modified" mode.

commit 27ee9483cf937a11a0e115f54de0afcc3f9ceb44
Merge: e48dd81a 2a84352d
Author: Chris Emerson <github@mail.nosreme.org>
Date:   Tue Oct 24 21:56:44 2017 +0100

    Merge remote-tracking branch 'jc/diff_zero_context' into difflines_mode
2018-01-20 20:23:25 +00:00
David Alber
9f5f9d2250 Consolidating the logic for printing output 2018-01-11 08:02:57 -08:00
David Alber
85ccb98469 Adding test to verify code block idempotency in Configurations.md 2018-01-04 00:01:18 -08:00
Seiichi Uchida
3ebe054362 Replace into() on &str with to_owned() 2017-12-08 13:07:42 +09:00
Utkarsh Kukreti
d44d4a3fbc Add test for trailing newline in diff.
Credits to @afshinm for most of the code.
2017-11-17 20:46:17 +05:30
clippered
794a215b27 rename to use_colored_tty; used match as well 2017-11-13 20:18:05 +11:00
clippered
d2f2f25463 add cli option for color 2017-11-13 20:18:03 +11:00
Chris Emerson
2a84352d1d Run rustfmt on the new changes. 2017-10-19 23:32:27 +01:00
Chris Emerson
f9bcb58eb3 Add a couple of special cases which fix the zero-context diff case. 2017-10-19 23:14:20 +01:00
Chris Emerson
6c1c81bbce Add a test for two nearby chunks (with context). 2017-10-19 23:03:27 +01:00
Chris Emerson
6282c970cf Add a failing test of zero context. 2017-10-19 20:55:20 +01:00
Chris Emerson
88f02975a1 Add a simple passing test for diffs. 2017-10-19 20:50:55 +01:00
topecongiro
831db35a83 Move isatty() to utils.rs 2017-08-15 16:49:02 +09:00
topecongiro
6fd291981e Sort imports in alphabetical and consistent order 2017-07-13 18:42:14 +09:00
Nick Cameron
1f512948a0 Reformat source code using new defaults 2017-06-13 14:41:49 +12:00
Nick Cameron
5305bc8436 test fallout 2017-03-28 11:25:59 +13:00
Nick Cameron
5fb1140688 fallout - source reformatting 2017-03-28 11:14:47 +13:00
Kamal Marhubi
05882314f5 Check term supports colour before printing fancy diffs
For a terminal like DUMB, we were still attempting to print colourful
diffs, which failed with a `NotSupported` error.

Fixes #1140
2016-08-26 17:08:47 -04:00
Kamal Marhubi
9759068e62 print_diff: Don't print color codes if output is not a tty
On unix, `term::stdout()` just reads the `TERM` environment variable to
decide what features are available. It does not check if the output file
descriptor is in fact a tty. This resulted in printing escape codes when
redirecting output.
2016-05-31 15:15:33 +02:00
Nick Cameron
d0720a00a1 Fall back to basic stdout if we can't unwrap a fancy terminal (#995)
fixes #978
2016-05-17 23:25:57 +02:00
Sinh Pham
122fc4bc65 Fixed #700, use default color for titles and context in write-mode=diff 2016-01-01 09:14:39 -08:00
Utkarsh Kukreti
15e6b7d335 Add tests for #606. 2015-12-28 17:23:34 +05:30
Nick Cameron
617eed353c Changes to rustfmt source 2015-09-26 18:29:48 +12:00
Sinh Pham
e7a5f9327e Add diff write mode https://github.com/nrc/rustfmt/issues/261 2015-09-10 18:30:07 -04:00