Commit graph

27 commits

Author SHA1 Message Date
Martin von Zweigbergk
980ac17d36 bisect: add missing closing backtick, make tests pass on Windows
This removes the dependencies on `true`, `false`, and `test`
executables, which are often not available on Windows.
2025-12-19 04:18:46 +00:00
David Higgs
29979e0c32 tests: exercise util exec when the program crashes 2025-12-12 02:55:55 +00:00
Kaiyi Li
0328e0e86b cli: simplify jj fix child process handling
* `Some(x).unwrap()` is not necessary.
* Add a new test to ensure that we handle the fix child process IO
  without deadlock. The new test introduces byte mode to fake-formatter
  which pipe the stdin contents to stdout byte by byte in a streaming
  fashion. The test contents are 512KB, which is larger than page size,
  can trigger the blocking read behavior, and doesn't make the test the
  slowest.
2025-11-25 15:54:00 +00:00
Kaiyi Li
70ddaf8c6f fix: change fake-formatter to not emit ending LF
If the original file doesn't end with LF, the output file won't end with
LF.
2025-11-25 15:54:00 +00:00
David Higgs
4140f9499c tests: exercise more bisect behaviors
Some checks are pending
binaries / Build binary artifacts (push) Waiting to run
website / prerelease-docs-build-deploy (ubuntu-24.04) (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
2025-11-01 23:17:31 +00:00
Benjamin Brittain
94ad20f00e fake-formatter: remove unused clap::arg import
Some checks are pending
binaries / Build binary artifacts (push) Waiting to run
website / prerelease-docs-build-deploy (ubuntu-24.04) (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
2025-10-20 02:02:38 +00:00
Martin von Zweigbergk
c15cc344de cli: add jj bisect run command
This adds a command that automatically bisects a range of commits
using a specified command. By not having the interactive kind
(e.g. `jj bisect good/bad/skip/reset`), we avoid - for now at least -
having to decide where to store the state. The user can still achieve
interactive bisection by passing their shell as the bisection command.

Closes #2987.
2025-09-04 14:30:52 +00:00
Scott Taylor
c5b0b0b68f revset: insert HeadsRange in Ancestors for nested range/filter
This allows evaluating ancestors/ranges involving filters significantly
faster. For instance, naively evaluating `::mine()` requires reading
every commit in the repo to check `mine()` on each commit, then finding
the ancestors of that set. This optimization rewrites `::mine()` to
`::heads(mine())`, since `heads(mine())` can be evaluated more
efficiently by only reading commits until the first successful match.

If someone is unaware of how revsets are implemented, this case can come
up pretty easily, such as by including `~mine()` in `immutable_heads()`
to make other people's commits immutable. In my local `jj` repo, this
optimization reduces the runtime of `jj log` with `~mine()` in
`immutable_heads()` from about 800ms down to about 50ms.

Benchmark results on Git repo:

```
::(v1.0.0..v2.40.0)     55.5% faster
author(peff)..          96.8% faster
```
2025-08-02 01:40:23 +00:00
Austin Seipp
ba24140f1d cli, lib: move to Rust 2024 language edition
This applies a `cargo fmt` and fixes clippy lints to keep the build
properly working.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
2025-07-28 17:05:41 +00:00
Martin von Zweigbergk
6f36cde1fb testing: update stale revset names in bench-revsets-git.txt 2025-07-21 18:14:40 +00:00
Eyvind Bernhardsen
94f28e95b5 diff: Run external diff tools in their temp dir
The name of the temporary directory that is created when running
external diff tools can add significant noise to a diff if the tool
displays paths prominently.

Change the behaviour so that we chdir to the temporary directory before
running the tool, with a setting to revert to the previous behaviour.

Closes #5801
2025-05-12 21:34:19 +00:00
Ilya Grigoriev
acaedc3382 cleanup: enable unused_trait_names clippy lint and run clippy --fix 2025-03-16 00:35:56 +00:00
Scott Taylor
542d09c6a9 merge_tools: add "$marker_length" variable
Git supports passing the conflict marker length to merge drivers using
"%L". It would be useful if we also had a way to pass the marker length
to merge tools, since it would allow Git merge drivers to be used with
`jj resolve` in more cases. Without this variable, any merge tool that
parses or generates conflict markers could fail on files which require
conflict markers longer than 7 characters.

https://git-scm.com/docs/gitattributes#_defining_a_custom_merge_driver
2024-12-23 08:42:10 -06:00
Samuel Tardieu
46e2723464 style: inline variables into format strings 2024-10-04 22:29:13 +02:00
Martin von Zweigbergk
1aa2aec141 bookmarks: update some leftover uses of the word "branch" 2024-09-11 19:19:31 -07:00
Matt Kulukundis
8ead72e99f formatting only: switch to Item level import ganularity 2024-08-22 14:52:54 -04:00
Danny Hooper
8fe2274584 fake-formatter: add --uppercase and --append formatting behaviors
This allows tests to easily distinguish the effects of multiple formatters that
could be applied during a single `jj fix` command, which is helpful for testing
the feature for configuring multiple formatters on potentially overlapping
filesets.

Uppercase is a counterpart to lowercase. Append exposes the number of changes
and their order of execution in the file content, which provides a terse way of
writing test expectations.
2024-07-25 13:40:18 -05:00
Scott Taylor
b27ff28956 cli: skip formatting instructions if not required
`tx.format_commit_summary()` can be expensive because it needs to build
an IdPrefixContext now, so it's best to avoid formatting instruction
messages unless they are actually required.
2024-07-09 20:24:14 -05:00
Matt Kulukundis
aaa99e6dc7 diff: add a file-by-file variant for external diff tools 2024-07-03 20:09:17 -04:00
mlcui
3bca159b1a fake-editor: replace expectpath with dump-path
This allows us to assert the expected path in the test itself, rather
than in the fake editor.
2024-07-02 11:15:44 +10:00
Danny Hooper
1ece76d128 cli: add a fake code formatter tool for testing 2024-06-04 14:28:21 -05:00
Yuya Nishihara
8b32a8a916 revset: add support for file(kind:pattern) syntax
There are no more callers of parse_function_argument_to_string(), so it's
removed. This function was a thin wrapper of literal parser, and can be
easily reintroduced if needed.
2024-04-07 19:43:29 +09:00
Yuya Nishihara
50363419fb revset: substitute '~(::x)' to 'x..'
Suppose we have an alias 'immutable()' = '::immutable_heads()', user can
express (visible) mutable set as '~immutable()'. 'immutable_heads()..' can
terminate early, but a generic difference 'all() & ~immutable()' can't.
2024-03-17 14:50:48 +09:00
Yuya Nishihara
9207314173 revset: add substitution rule for "::x & ~(::y-)"
Suppose the generation value is usually small, it should be faster to do
bounded range look up first 'y-', then walk ancestors with the unwanted set
'y-..x'.
2024-03-17 14:50:48 +09:00
Yuya Nishihara
f21c078249 revset: ad-hoc optimization for range queries containing unwanted wanted heads
In my linux stable mirror, this makes the default log revset evaluation super
fast. immutable_heads(), if configured properly, includes many historical
branch heads which are also the visible heads.

revsets/immutable_heads()..
---------------------------
0     12.27     117.1±0.77m
3      1.00       9.5±0.08m
2024-02-22 23:26:29 +09:00
Ilya Grigoriev
e743ba78b0 fake_diff_editor: Allow specifying extra arguments to be ignored 2023-08-21 20:19:15 -07:00
Austin Seipp
48fa821e60 cli: move src/ directory to new cli/ directory
Summary: In preparation for unifying all workspace dependencies across all
crates, let's go ahead and move the jj-cli crate into its own new directory.
This will also be a nicer and more uniform layout as we add new `jj-*` crates.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
Change-Id: Icf94e7ae5f290dc8e181215727b38ada
2023-08-04 19:00:42 -05:00