Commit graph

26 commits

Author SHA1 Message Date
Yuya Nishihara
bd3d9309ff cli: add convenient methods to print hint or warning with default headings
The lowercase "warning: " is unified to "Warning: " as it is the jj's
convention afaik.

The _default() suffix could be dropped from these methods, but it's probably
better to break the existing codebase for the moment. Otherwise, the caller
might do writeln!(ui.warning(), "Warning: ..").
2024-03-26 00:28:27 +09:00
Yuya Nishihara
2e91146d67 cli: highlight "Error: " headings 2024-03-26 00:28:27 +09:00
Yuya Nishihara
1ebe751c42 cli: highlight "Warning: " and "warning: " headings 2024-03-26 00:28:27 +09:00
Yuya Nishihara
78ce9eae65 cli: highlight "Hint: " heading
The existing .hint() method is renamed to .hint_no_heading() to clarify that
it's not the default choice to print a hint. I'll add .hint_default() later,
which will be the shorthand for .hint_with_heading("Hint: ").
2024-03-26 00:28:27 +09:00
Martin von Zweigbergk
e51878f4fd cli: show timestamp in local timezone and without millis and offset
As discussed in #2900, the milliseconds are rarely useful, and it can
be confusing with different timezones because it makes harder to
compare timestamps.

I added an environment variable to control the timestamp in a
cross-platform way. I didn't document because it exists only for tests
(like `JJ_RANDOMNESS_SEED`).

Closes #2900
2024-03-20 07:54:08 -07:00
Yuya Nishihara
a224d0f172 repo_path: show more detailed error if filesystem path failed to parse
This should address both use cases:
 1. If from_relative_path() is directly called, the error says ".." shouldn't
    be included in the (normalized) relative path.
 2. If parse_fs_path() is used, the error message contains paths relative to
    cwd. #3216
2024-03-09 11:01:43 +09:00
dploch
b4c4d91190 cli_util: support multiple cli arguments for ui.default-command 2024-03-07 09:34:18 -05:00
Yuya Nishihara
7ce25f8408 cli: add --tool=<name> option to diff/merge editing commands
I didn't add e2e tests to all commands, but the added tests should cover
diff_editor/diff_selector/merge_editor() calls.

Closes #2575
2024-03-04 01:33:43 +09:00
Yuya Nishihara
601b75c556 tests: move strip_last_line() to common module 2024-03-01 08:51:06 +09:00
Yuya Nishihara
8d0414549b cli: unblock "jj git init --colocate" in existing Git repo directory
I'm not sure what's the conclusion in #2747, but I don't think there is a
disagreement on allowing --colocate to import existing Git repo.
2024-02-28 09:03:16 +09:00
Alexis (Poliorcetics) Bourget
0fc5005b8a cli: rename --verbose to --debug to better fit what it does 2024-02-18 18:45:48 +01:00
Yuya Nishihara
3e72c43970 cli: suggest "jj git init" if workspace looks like a plain git repo 2024-02-08 00:34:55 +09:00
jyn
d66fcf2ca0 compile integration tests as a single binary
this greatly speeds up the time to run all tests, at the cost of slightly larger recompile times for individual tests.

this unfortunately adds the requirement that all tests are listed in `runner.rs` for the crate.
to avoid forgetting, i've added a new test that ensures the directory is in sync with the file.

 ## benchmarks

before this change, recompiling all tests took 32-50 seconds and running a single test took 3.5 seconds:

```
; hyperfine 'touch lib/src/lib.rs && cargo t --test test_working_copy'
  Time (mean ± σ):      3.543 s ±  0.168 s    [User: 2.597 s, System: 1.262 s]
  Range (min … max):    3.400 s …  3.847 s    10 runs
```

after this change, recompiling all tests take 4 seconds:
```
;  hyperfine 'touch lib/src/lib.rs ; cargo t --test runner --no-run'
  Time (mean ± σ):      4.055 s ±  0.123 s    [User: 3.591 s, System: 1.593 s]
  Range (min … max):    3.804 s …  4.159 s    10 runs
```
and running a single test takes about the same:
```
; hyperfine 'touch lib/src/lib.rs && cargo t --test runner -- test_working_copy'
  Time (mean ± σ):      4.129 s ±  0.120 s    [User: 3.636 s, System: 1.593 s]
  Range (min … max):    3.933 s …  4.346 s    10 runs
```

about 1.4 seconds of that is the time for the runner, of which .4 is the time for the linker. so
there may be room for further improving the times.
2024-02-06 18:19:41 -08:00
Martin von Zweigbergk
9feffa54c8 cli: include command to set config in hint about default command
When the user doesn't have a configured default command, we show a
hint saying to set `ui.default-command`. I think the user is very
likely to want to set that in the user-wide config, so let's include
the command in the hint.
2024-02-06 11:06:52 -08:00
Ilya Grigoriev
8a4b3966a6 test_global_opts: make test_version just a bit nicer when it fails 2024-02-02 23:19:25 -08:00
Ilya Grigoriev
42e6132771 test_global_opts: extract --version to its own test 2024-02-02 23:19:25 -08:00
Yuya Nishihara
ca322b761a cli: print source chain of internal error in a similar way to anyhow
Multi-line output should be easier to follow than lengthy line separated by
colon.
2024-02-01 16:59:44 +09:00
Yuya Nishihara
941e53802f cli: error out early if -R path is invalid
It should be better to handle invalid -R path globally. The error message is
a bit worse, but I think it's still okay.

This helps to load temporary config from the cwd-relative path. If the command
processing continued with an invalid -R path, the temporary config would have
to be explicitly discarded.
2023-12-24 00:20:38 +09:00
Yuya Nishihara
7a3e72415c cli: send status messages to stderr, specify stdout/stderr explicitly
Many of &mut UI can be changed to immutable borrows, but I'm not gonna
update them in this patch.
2023-10-11 19:24:01 +09:00
Yuya Nishihara
58acc1d111 tests: replace jj_cmd_success() involving mutation to allow stderr output 2023-10-11 19:24:01 +09:00
Martin von Zweigbergk
ce933507df release: release version 0.10.0
Thanks to everyone who's contributed!
2023-10-04 16:45:45 -07:00
Ilya Grigoriev
33087bcd90 cli docs: document that --config-toml can be repeated 2023-09-14 18:09:27 -07:00
Oscar Bonilla
31f71f29bf Enable wrapping help in clap 2023-08-22 22:24:03 -07:00
Benjamin Brittain
313670d3c2 Fixed missing quote in "jj config set" help 2023-08-16 14:57:48 -04:00
Ben Saunders
e563d60e64 Update docs and errors to use XDG config path 2023-08-11 13:21:44 -07:00
Martin von Zweigbergk
0075174308 tests: move tests/ under cli/ so they're run again
Thanks to @ilyagr for noticing that they should be moved.
2023-08-05 06:18:59 +00:00
Renamed from tests/test_global_opts.rs (Browse further)