Commit Graph

344 Commits (master)

Author SHA1 Message Date
Wilfred Hughes 723e3dbd0e Roll version 2022-12-19 00:20:42 +07:00
Michel Alexandre Salim 08041e5793
Add `cargo binstall` metadata
Right now `cargo binstall` cannot find the pre-compiled `difftastic`
assets:

```
~
❯ cargo binstall difftastic
 INFO resolve: Resolving package: 'difftastic'
 WARN resolve: The package will be installed from source (with cargo)
Do you wish to continue? yes/[no]
? no
 WARN Installation cancelled

~ took 18s
❯ cargo binstall difftastic --pkg-url="{ repo }/releases/download/{ version }/difft-{ target }.{ archive-format }"
 INFO resolve: Resolving package: 'difftastic'
 WARN resolve: The package will be downloaded from github.com
 INFO resolve: This will install the following binaries:
 INFO resolve:   - difft (difft -> /home/michel/.cargo/bin/difft-v0.38.0)
 INFO resolve: And create (or update) the following symlinks:
 INFO resolve:   - difft (/home/michel/.cargo/bin/difft -> difft-v0.38.0)
Do you wish to continue? yes/[no]
? yes
 INFO install: Installing binaries...
 INFO Done in 9.277840305s
```

Adding this `pkg-url` override to `Cargo.toml` allows `binstall` to find
the pre-compiled archives:

```
~
❯ cargo binstall --manifest-path ~/src/github/Wilfred/difftastic/Cargo.toml difftastic
 INFO resolve: Resolving package: 'difftastic'
 INFO resolve: difftastic v0.38.0 is already installed, use --force to override
 INFO Done in 5.327886ms

~
❯ cargo binstall --manifest-path ~/src/github/Wilfred/difftastic/Cargo.toml difftastic --force
 INFO resolve: Resolving package: 'difftastic'
 WARN resolve: The package will be downloaded from github.com
 INFO resolve: This will install the following binaries:
 INFO resolve:   - difft (difft -> /home/michel/.cargo/bin/difft-v0.38.0)
 INFO resolve: And create (or update) the following symlinks:
 INFO resolve:   - difft (/home/michel/.cargo/bin/difft -> difft-v0.38.0)
Do you wish to continue? yes/[no]
? yes
 INFO install: Installing binaries...
 INFO Done in 5.484314255s
```

Signed-off-by: Michel Alexandre Salim <michel@michel-slm.name>
2022-11-23 14:01:25 +07:00
Wilfred Hughes 8e190677e7 Roll version 2022-11-14 00:30:56 +07:00
Wilfred Hughes 0603b9fb23 Include LICENSE in crates.io source files
Closes #423
2022-11-13 00:13:47 +07:00
Wilfred Hughes b662a2220b Apply upstream tree_magic_mini patch to fix blank line crash
Fixes #378
2022-10-31 00:54:24 +07:00
Wilfred Hughes e91878fb32 0.37 is now released 2022-10-14 16:10:27 +07:00
Wilfred Hughes 9e7c92eb57 Bump tree-sitter version 2022-10-09 14:59:30 +07:00
Wilfred Hughes dd0c78fefa Remove setting that can be overridden with an environment variable 2022-10-09 11:25:57 +07:00
QuarticCat d48ee2dfdb
Use a faster stack impl 2022-09-28 04:08:42 +07:00
QuarticCat 06b46e9355
Enable thin-LTO 2022-09-28 00:24:18 +07:00
Wilfred Hughes 17ec5de754 Next release should be 0.37 2022-09-18 15:07:31 +07:00
Wilfred Hughes 88222e83c4 Prepare for patch release with fixed Windows build 2022-09-17 23:55:00 +07:00
Wilfred Hughes d5ae17d3d5 Roll version following release 2022-09-17 20:18:59 +07:00
Wilfred Hughes e15244c8f6 Roll version 2022-09-02 18:24:08 +07:00
Wilfred Hughes a04f867557 Fix terminal width detection
This was previously fixed in
cb900c3463 (see commit message), but
broken in #341.

Instead, use both term_size and terminal_size, to maximise our chances
that we can detect the width. Also comment the code with the relevant
terminal_size issue.

Fixes #346
2022-09-02 11:07:48 +07:00
Wilfred Hughes 1d1d883a9b Roll version 2022-08-27 23:00:33 +07:00
Wilfred Hughes aca46af40f Don't specify +whole-archive before rust 1.61 2022-08-27 17:51:54 +07:00
rhysd f201b9e225 Use `terminal_size` crate instead of `term_size` crate
since `term_size` has stopped maintenance 2 years ago.
2022-08-23 10:36:54 +07:00
Wilfred Hughes f3420df1ca Roll version 2022-08-21 22:05:04 +07:00
Wilfred Hughes 6ce0717447 Note the newer rustc requirement 2022-08-12 12:39:00 +07:00
Wilfred Hughes 0c03187b96 Roll version 2022-08-07 18:16:16 +07:00
Wilfred Hughes 3e320bb1cb Bump version number 2022-07-12 00:12:21 +07:00
Wilfred Hughes c745de51b0 Roll version 2022-07-04 20:05:31 +07:00
lilydjwg c72626808f use unicode-width to align CJK characters 2022-06-26 21:51:26 +07:00
Wilfred Hughes e48c27cfb9 Next release will be 0.30 2022-06-13 16:51:16 +07:00
Wilfred Hughes 17f98a7f4d Next release will be 0.29.1 2022-06-13 16:49:55 +07:00
Wilfred Hughes ae42762a6d Fix mimalloc perf regression in 57a4b6d6ce
It looks like we were allocating large buffers for wu-diff, and
mimalloc performance is much worse for this case in the new version.

This reverts performance back to that 0.28 for large files,
such as the example in #297.
2022-06-13 02:02:01 +07:00
Wilfred Hughes dd80e58640 Roll version 2022-06-09 10:12:46 +07:00
Wilfred Hughes 39be777a13 Prefer a complete sentence 2022-05-29 09:57:54 +07:00
Wilfred Hughes 43a03d2939 Tweak slogan to clarify that difftastic understands structure
"Understands syntax" is sometimes confused with syntax highlighting.
2022-05-23 23:39:15 +07:00
Wilfred Hughes df927eb713 Update pretty_assertions 2022-05-23 22:31:08 +07:00
Wilfred Hughes 1d4293864b Prefer a bump allocator for graph vertices
This reduces instruction counts by around 14%.
2022-05-23 09:38:13 +07:00
Xuanwo aee75d0bf4
feat: Improve binary content guess
Signed-off-by: Xuanwo <github@xuanwo.io>
2022-05-03 15:04:41 +07:00
Wilfred Hughes d9ef270d27 Make include patterns stricter
This slightly reduces the size of the crate uploaded to crates.io.
2022-04-29 17:31:28 +07:00
Wilfred Hughes 77fb9cd179 Roll version 2022-04-29 16:52:45 +07:00
Wilfred Hughes dd31fd3a2b Wrap help messages according to the terminal width 2022-04-26 22:38:23 +07:00
Wilfred Hughes ee0f1ee7f2 Diff files in directories in parallel 2022-04-24 20:17:47 +07:00
Wilfred Hughes e67ca22fc6 Roll version 2022-04-18 09:36:30 +07:00
Wilfred Hughes 2284a2366e Update owo-colors 2022-04-14 22:12:56 +07:00
Wilfred Hughes 5bd8c01385 Update build deps 2022-04-14 22:12:49 +07:00
Wilfred Hughes 1d5b4e0055 Update mimalloc 2022-04-14 22:04:43 +07:00
Wilfred Hughes e45dc8f2ba Update to latest tree-sitter 2022-04-14 22:01:10 +07:00
Wilfred Hughes 279e4d72a9 Update to latest clap 2022-04-14 21:57:20 +07:00
Wilfred Hughes 92b3c6e932 Use clap's built-in env var feature
Fixes #239
2022-04-12 23:57:20 +07:00
Wilfred Hughes db9ab874d8 Roll version 2022-04-10 16:00:31 +07:00
Wilfred Hughes 2a28bf6d54 Roll version to exercise release again 2022-04-10 15:39:25 +07:00
Wilfred Hughes 18126be646 Next release will be 0.26.2 2022-04-10 12:41:22 +07:00
Wilfred Hughes 10cd0d45b0 Next release will be 0.26.1 2022-04-10 12:25:54 +07:00
Wilfred Hughes 3c6db050dc Roll version 2022-04-09 19:01:54 +07:00
Wilfred Hughes bef93e9626 Roll version 2022-03-31 09:47:58 +07:00
Wilfred Hughes d36224229e Downgrade rpds to last Rust 2018 version
This will allow difftastic to build on earlier rust versions, and is
also a ~2% instruction count reduction on slow_before.rs.
2022-03-28 22:23:42 +07:00
Wilfred Hughes bacefe5a58 Roll version 2022-03-26 16:02:51 +07:00
Wilfred Hughes 9435798c9c Next release will be 0.24 2022-03-19 10:27:04 +07:00
Wilfred Hughes 06ffa0267a Next release will be a patch release with a single crash fix 2022-03-19 10:24:30 +07:00
Wilfred Hughes b5187d98d0 Roll version 2022-03-17 22:22:42 +07:00
Wilfred Hughes 6d9dc8322f Tweak motto 2022-03-13 22:14:03 +07:00
Wilfred Hughes dad463daf5 Use Myers' diff everywhere
The diff crate has a great ergonomic API, but it doesn't implement
Myers' algorithm and performs badly on large inputs.

https://github.com/utkarshkukreti/diff.rs/issues/1

Now that we have a wrapper wu_diff that provides a similar API,
replace the remaining call sites to diff::slice(). These are
relatively cold, so this is a small performance improvement (1%
instruction reduction).
2022-03-12 12:29:34 +07:00
Wilfred Hughes afb1b369f4 Switch to wu-diff for textual diffing
In #153 a user reported difftastic never terminated on a 140,000
file. This was due to the diff crate using a very large amount of time
and memory.

The diff crate does not use Myers' algorithm, which has a
divide-and-conquer approach using snakes:

https://blog.jcoglan.com/2017/03/22/myers-diff-in-linear-space-theory/

wu-diff does implement Myer's algorithm and performs much better on
these large files.
2022-03-10 23:12:25 +07:00
Wilfred Hughes a3a2bfb317 Roll version 2022-03-10 00:13:26 +07:00
Wilfred Hughes 00c7d73bdf Version bump tree-sitter 2022-03-05 11:03:28 +07:00
Wilfred Hughes 2640f78f2f Version bump radix-heap 2022-03-05 10:59:50 +07:00
Wilfred Hughes 2d4ec0a4be Bump minimum Rust version to 1.56 for rpds support 2022-03-05 10:42:52 +07:00
Wilfred Hughes 4b674d4b8e Use rpds rather than im for persistent data types
rpds is actively maintained and it's even a significant performance
win in my testing (40% time reduction on slow_before.rs).
2022-03-04 21:47:05 +07:00
Wilfred Hughes cb0f1f3fe5 Roll version 2022-02-28 09:26:26 +07:00
Wilfred Hughes d8e8e12bf8 Roll version 2022-02-20 16:50:05 +07:00
Wilfred Hughes 82890923cd Track entering/leaving parents explicitly
This produces significantly better diffs, and fixes some cases that
were outright wrong before.

Fixes #30
2022-02-20 12:43:52 +07:00
Wilfred Hughes 3c1c5649f4 Ensure --color is still respected
This was broken in the port to owo_colors. owo_colors does not have a
global override: the override function only affects if_supports_color.
2022-02-13 16:54:57 +07:00
Wilfred Hughes 6004855206 Port to owo_colors
This library is faster and actively maintained.

Closes #107
2022-02-13 15:13:40 +07:00
Wilfred Hughes d9ec560f0d Roll version 2022-02-07 23:14:55 +07:00
Wilfred Hughes e2832dabb3 Set a maximum size on syntactic diffing, and use line diffing otherwise
Fixes #82
2022-02-06 16:38:55 +07:00
Wilfred Hughes 0eba3ecabe Update to the latest tree-sitter version
This is also a minor performance improvement (e.g. saves 1.3% time on
typing_old/new.ml or 3% on elisp_before/after.el).
2022-01-31 22:37:05 +07:00
Wilfred Hughes 4d3fac20d9 Next release will be 0.19 2022-01-30 22:58:22 +07:00
Wilfred Hughes 8f6b269492 Tag a 0.18.1 release 2022-01-30 22:56:19 +07:00
Wilfred Hughes 409f7aae75 Roll version 2022-01-30 18:03:45 +07:00
Wilfred Hughes ebd923acbe Use project and author information from Cargo.toml
Prevents duplication.
2022-01-29 15:38:44 +07:00
Wilfred Hughes 5a2e0379aa Update to clap 3 2022-01-29 11:01:36 +07:00
Wilfred Hughes 69dbad35ad Roll version 2022-01-25 22:32:18 +07:00
Wilfred Hughes a2dc0b5109 Roll version 2022-01-22 19:03:58 +07:00
Wilfred Hughes b270156e48 Update tree-sitter version
This is a small perf win (30ms runtime on my machine) due to faster
tree_sitter::Query creation.
2022-01-15 18:13:53 +07:00
Wilfred Hughes a11e3081b2 Roll version 2022-01-06 01:00:48 +07:00
Wilfred Hughes 667a42d57b Downgrade to tree-sitter 0.20.0
0.20.1 has a performance regression, which seems to particularly
affect Elixir parsing:
https://github.com/tree-sitter/tree-sitter/issues/1510
2021-12-29 14:59:12 +07:00
Wilfred Hughes 0cf68ef847 Roll version 2021-12-27 18:28:15 +07:00
Wilfred Hughes cb900c3463 Revert to term_size
Git invokes difftastic and then pipes stdout to less, but stderr still
goes to the terminal. term_size queries both stdout and stderr, so it
can still find the terminal width in this situation.

Previously, we'd always use a width of 80 when invoked by git.

terminal_size discussion:
https://github.com/eminence/terminal-size/issues/23

term_size does claim to support Windows, and #71 was not fixed by
changing libraries, so this seems reasonable.
2021-12-19 12:48:52 +07:00
Wilfred Hughes 6f1baae23e Prefer terminal_width crate so we support more platforms
term_width is unmaintained and does not support Windows.

Fixes #71
2021-12-07 23:24:13 +07:00
Wilfred Hughes 4948f59855 Roll version 2021-12-04 23:56:42 +07:00
Wilfred Hughes fa17058f80 Bump libc version 2021-11-24 23:55:16 +07:00
Wilfred Hughes 7d1bf1e5f4 Update to latest tree-sitter 2021-11-24 23:29:41 +07:00
Wilfred Hughes 19feab9045 Change entry point to be main.rs
Now that we've removed criterion, a binary-only crate is better, as we
get more unused function warnings.
2021-11-21 11:45:48 +07:00
Wilfred Hughes 7fdbaff6fe Update build dependencies 2021-11-19 23:29:17 +07:00
Wilfred Hughes 7f6b8174d5 Update pretty_assertions and use consistently 2021-11-19 23:27:41 +07:00
Wilfred Hughes 9079567695 Update radix-heap
Upstream has had some optimisations and it saves 7% in instructions
executed for slow_before/slow_after.rs according to `perf stat`.
2021-11-19 23:20:37 +07:00
Wilfred Hughes e8f45d91b8 Roll version 2021-11-19 00:49:14 +07:00
Wilfred Hughes a87882c0a3 Increase required rust version
radix-heap uses macros for built-in arguments, which was added in Rust
1.54:
https://github.com/rust-lang/rust/blob/master/RELEASES.md#version-1540-2021-07-29
2021-10-30 12:46:42 +07:00
Wilfred Hughes c0cd13bd9b Pin Rust version to 1.46
Specify the minimum Rust version in cargo.toml, exercise this version in CI,
and document it in the manual.

We require 1.46 for bitflags, which is a dependency of clap.

Fixes #51
2021-10-29 00:20:07 +07:00
Wilfred Hughes 86724658c0 Update radix-heap version
This avoids us depending on an old version of ordered_float, which has
a security advisory: https://rustsec.org/advisories/RUSTSEC-2020-0082

It also slightly reduces the number of dependencies of difftastic.
2021-10-28 00:51:37 +07:00
Wilfred Hughes 44b025fdc5 Roll version 2021-10-18 22:42:17 +07:00
Wilfred Hughes 3df7bb57e1 Add basic syntax highlighting for keywords and operators
Helps with #32
2021-10-03 15:23:27 +07:00
Wilfred Hughes c92007e5b3 Remove criterion
I've found the numbers pretty noisy on my laptop, and `perf stat` is a
nice way of testing full size files for performance.
2021-10-02 22:00:12 +07:00
Wilfred Hughes 08c68de229 Run `cargo upgrade` 2021-09-26 23:09:20 +07:00
Wilfred Hughes 62b030195e Upgrade to latest treesitter 2021-09-26 23:05:09 +07:00
Wilfred Hughes ec37c5bef1 Add full Mercurial extdiff support 2021-09-26 21:23:22 +07:00
Wilfred Hughes 48efe9d7c4 Roll version 2021-09-24 23:40:07 +07:00
Wilfred Hughes bc4f54da65 Set benchmark path to keep `cargo package` happy 2021-09-22 22:40:53 +07:00
Wilfred Hughes 5991efdcc7 Build tree-sitter parsers in parallel 2021-09-22 22:02:07 +07:00
Wilfred Hughes 8baa083fbf Make debug symbols explicit for release, for easy toggling 2021-09-19 22:47:58 +07:00
Wilfred Hughes d89521e7a3 Improve benchmark name 2021-09-14 22:47:54 +07:00
Wilfred Hughes d5b5f09257 Enable html_reports to silence the crierion warning 2021-09-14 22:42:23 +07:00
Wilfred Hughes f1c59dcfba Add a basic benchmark for the parser 2021-09-14 22:24:25 +07:00
Wilfred Hughes 1e7a39dbbf Make include patterns stricter
Previously we'd match any directory *src, which matched a range of
unwanted files in manual/ and vendor/
2021-09-14 00:45:04 +07:00
Wilfred Hughes d1c5c9d937 Set homepage, keywords and categories in Cargo.toml 2021-09-14 00:41:38 +07:00
Wilfred Hughes 31572a83a9 Roll version following release 2021-09-14 00:34:38 +07:00
Wilfred Hughes ea3cb7737a Use a radix heap to speed up Dijkstra implementation 2021-09-12 22:04:15 +07:00
Wilfred Hughes 6222987872 Move to mimalloc
This produces a small (~10% less runtime) improvement on larger files,
as difftastic spends a lot of time allocating.
2021-09-12 20:14:44 +07:00
Wilfred Hughes 0f042fb160 Roll version 2021-09-05 11:23:00 +07:00
Wilfred Hughes 86a330c44e Add debug logging and log stats on shortest path found 2021-09-04 10:46:51 +07:00
Wilfred Hughes cc93976969 Handle SIGPIPE
Based on the sample code in
https://stackoverflow.com/a/65760807/509706

Closes #28
2021-08-29 16:50:05 +07:00
Wilfred Hughes 763b9d2d17 Roll version 2021-08-24 01:07:07 +07:00
Wilfred Hughes 3123544bed Use an explicit version for cc 2021-08-24 01:04:38 +07:00
Wilfred Hughes efcb02c56c Configure vendor/ for packaging 2021-08-24 01:02:32 +07:00
Wilfred Hughes 001a36a7e3 Define regexp parsers in code rather than TOML 2021-08-21 19:13:01 +07:00
Wilfred Hughes c80ce0d024 Use vendored tree-sitter-rust 2021-08-15 16:50:43 +07:00
Wilfred Hughes e7a6c3b11e Initial tree-sitter prototype 2021-08-15 16:16:48 +07:00
Wilfred Hughes 3ae0b7df84 Allow RHS to be arbitrarily long in a pager
If stdout is not a TTY, assume it's a pager and don't truncate the
RHS.
2021-08-08 17:35:31 +07:00
Wilfred Hughes da63704675 Roll version 2021-07-28 00:04:47 +07:00
Wilfred Hughes 6d5704aed9 Only compile the newline regexp once 2021-07-25 12:56:02 +07:00
Wilfred Hughes 928584676a Only highlight individual comment words for comments that are similar 2021-07-24 17:01:30 +07:00
Wilfred Hughes b81312e88b Roll version 2021-07-22 00:09:13 +07:00
Wilfred Hughes aa87085b95 Remove unused dependency 2021-07-17 15:35:43 +07:00
Wilfred Hughes 4c79267602 Roll version 2021-07-13 23:27:17 +07:00
Wilfred Hughes 9e821956a5 Roll version 2021-07-07 22:25:03 +07:00
Wilfred Hughes 64bfc73a6c Roll version for next release 2021-07-04 11:42:59 +07:00
Wilfred Hughes 78483d7480 More package metadata 2021-07-03 23:14:22 +07:00
Wilfred Hughes cf2b5d762a Bump version for initial release 2021-07-03 23:09:11 +07:00
Wilfred Hughes a38b20d5a6 Prefer rustc-hash for faster hashing
This is hot when profiling.
2021-07-03 15:42:23 +07:00
Wilfred Hughes 3b033c1438 Embed syntax.toml in binary 2021-06-20 16:32:22 +07:00
Wilfred Hughes 48c31ec0ec Read a language block from syntax.toml 2021-06-01 23:57:08 +07:00
Wilfred Hughes cb75585679 Basic .toml language description 2021-05-31 23:10:49 +07:00
Wilfred Hughes ca1aca1021 Use arena allocation for Syntax 2021-05-23 17:39:54 +07:00
Wilfred Hughes f13ee634ad Bump dependencies 2021-03-07 13:02:31 +07:00
Wilfred Hughes 26a3ee36a6 Use pretty assertions 2019-11-18 12:03:33 +07:00
Wilfred Hughes aac9bd8a6f Update to Rust 2018 2019-11-18 12:02:08 +07:00
dependabot[bot] 5a92de425d Bump colored from 1.6.1 to 1.7.0
Bumps [colored](https://github.com/mackwic/colored) from 1.6.1 to 1.7.0.
- [Release notes](https://github.com/mackwic/colored/releases)
- [Changelog](https://github.com/mackwic/colored/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mackwic/colored/compare/v1.6.1...v1.7.0)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-01-27 20:39:57 +07:00
Wilfred Hughes 71bc6a53c4 Pad to the terminal width if the files are narrower 2018-12-31 17:53:07 +07:00
Wilfred Hughes 958033924a Initial proof of concept 2018-12-29 15:29:42 +07:00