ok/jj
1
0
Fork 0
forked from mirrors/jj
Commit graph

2244 commits

Author SHA1 Message Date
Martin von Zweigbergk
1b4992e11c tests: create new file for tests of commit template
An important part of the `jj log` output is the commit template. I
suspect we'll have many more tests for that, so let's move it to a
separate file. The main `test_log_command.rs` can focus on which
commits to display.
2023-01-08 12:32:31 -08:00
Ilya Grigoriev
a5d77a27e8 cargo +nightly clippy --fix --workspace with today's nightly 2023-01-07 15:29:19 -08:00
Ilya Grigoriev
a022beedd7 jj status: show same output as jj resolve --list for conflicts
Screnshot: https://user-images.githubusercontent.com/4123047/211169647-773b2e08-dade-4aa4-9a60-f3a3e7c08084.png
2023-01-07 15:29:19 -08:00
Ilya Grigoriev
fc9795e902 jj resolve --list: make output colorful
The description is usually in yellow, which looks nice and neutral. If the
conflict has more than 2 sides or has special files, that's marked in red.
2023-01-07 15:29:19 -08:00
Ilya Grigoriev
89de9aeae1 jj resolve --list: Replace separator with \t
The `:` was a bit noisy. With upcoming color support, it seems unnecessary.

This should also be a little better for any tools that want to parse the
output.

Finally, `insta` also seems to want to rewrite test snapshots to be shorter.
They seem equivalent.
2023-01-07 15:29:19 -08:00
Ilya Grigoriev
e32342a6c4 jj op log: Show durations with relative timestamps
Before, the humanized versions of start and end times often were identical.
2023-01-07 12:08:00 -08:00
Ilya Grigoriev
a48b4855be Have jj op log obey ui.relative-timestamps option 2023-01-07 12:08:00 -08:00
Ilya Grigoriev
c5563115a4 Consolidate and extract timestamp display functions in one file
The functionality for absolute timestamps was duplicated. A
function for displaying relative timestamps will be needed in
the next commit.
2023-01-07 12:08:00 -08:00
Ilya Grigoriev
d5430a9258 resolve --list: account for deletions of special files
This will match `jj`'s behavior of being unable to resolve such conflicts or to
show readable diffs for them, in the pre-#978 state.


This is a fixup of 621293d7c6.
2023-01-06 23:36:14 -08:00
Martin von Zweigbergk
4aeb4f6e2a tests: drop no-longer-needed filtering of change ID
Our change IDs are now predictable in tests.
2023-01-06 23:03:58 -08:00
Yuya Nishihara
ea96ea3ffe cli: load configs from .jj/repo/config.toml
Since per-repo config may contain CLI settings, it must be visible to CLI.
Therefore, UserSettings::with_repo() -> RepoSettings isn't used, and its
implementation is nullified by this commit.

#616
2023-01-07 11:33:12 +09:00
Yuya Nishihara
810789a830 workspace: extract WorkspaceLoader to resolve paths without loading 2023-01-07 11:33:12 +09:00
Yuya Nishihara
6addfb0198 cli: migrate --config-toml processing, make UserSettings immutable
It's unclear whether parse_args() or its caller should update LayeredConfigs.
--config-toml is processed by callee to apply --color early. -R/--repository
will be processed by caller since it will instantiate WorkspaceLoader.
Maybe --config-toml can be removed from EarlyArgs, and handle_early_args()
just updates ui state based on --color argument?
2023-01-07 11:33:12 +09:00
Yuya Nishihara
39d5ce97ad cli: initialize ui with merged config containing defaults and envs
Since CliRunner knows both defaults and envs, it makes sense to feed them
to initialize ui.
2023-01-07 11:33:12 +09:00
Yuya Nishihara
3557622b09 cli: introduce struct that stores unmerged configs
Thinking of config precedence, we'll probably need to store "base" (default +
env_base + user) config and "override" (env_overrides + --config-toml) config
separately to support repo config. Suppose env_overrides() is a temporary
value, it's better to override any file-derived values with $JJ_ env.
2023-01-07 11:33:12 +09:00
Yuya Nishihara
47e2e4d220 cli: extract function that reads user config without merging
The next commit will add a struct that keeps umerged configs, which will be
used to insert repo config between user and override configs.
2023-01-07 11:33:12 +09:00
Yuya Nishihara
b3c792f7bf cli: resolve command alias without using UserSettings, use config::Config
For the same reason as the previous commit. -R/--repository can't be parsed
until the real command name gets available.
2023-01-07 11:33:12 +09:00
Yuya Nishihara
d0d92a0e06 cli: initialize Ui without using UserSettings, use config::Config
UserSettings will be instantiated after both user and repo configs are
loaded. We might want to add a wrapper for CLI settings, but I have no idea
how that should be structured. Let's use bare config::Config until then.
2023-01-07 11:33:12 +09:00
Yuya Nishihara
3c99852ebd tests: add basic config precedence test 2023-01-07 11:33:12 +09:00
dependabot[bot]
0bc52d4386 cargo: bump glob from 0.3.0 to 0.3.1
Bumps [glob](https://github.com/rust-lang/glob) from 0.3.0 to 0.3.1.
- [Release notes](https://github.com/rust-lang/glob/releases)
- [Commits](https://github.com/rust-lang/glob/compare/0.3.0...0.3.1)

---
updated-dependencies:
- dependency-name: glob
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-06 07:53:02 -08:00
dependabot[bot]
f2cba66029 github: bump actions/upload-artifact from 3.1.1 to 3.1.2
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 3.1.1 to 3.1.2.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](83fd05a356...0b7f8abb15)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-06 07:52:03 -08:00
Ilya Grigoriev
621293d7c6 jj resolve --list: Add descriptions of conflict complexity
The descriptions focus on adds, not the deletions. The deletions are used
to compute the number of deleted files that must be sides of the conflict.
2023-01-05 10:59:14 -08:00
Ilya Grigoriev
1f39ffce01 Rename print_conflicted_{files=>paths} 2023-01-05 10:59:14 -08:00
dependabot[bot]
6a6724fd87 github: bump actions/checkout from 3.2.0 to 3.3.0
Bumps [actions/checkout](https://github.com/actions/checkout) from 3.2.0 to 3.3.0.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](755da8c3cf...ac59398561)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-05 15:33:10 +00:00
David Barnett
6da1ecfba0 Add pkg-config to required Linux dependencies
Without it, cargo started erroring out for me after #970 saying it
couldn't find openssl without pkg-config being installed.
2023-01-05 08:01:34 -06:00
Ilya Grigoriev
5ecac4fc44 jj resolve: List remaining conflicts (if any) on success
This can be prevented by the new `--quiet` option.
2023-01-04 21:48:33 -08:00
Ilya Grigoriev
b8ba78b996 Extract resolve_list from cmd_resolve, tests, minor refactoring
This is all in preparation for follow-up commit, which will change
some of the new tests. The extracted function will be further expanded
later.
2023-01-04 21:48:33 -08:00
Yuya Nishihara
42a044b7c7 cli: move ui.settings() to CommandHelper, disown UserSettings from Ui
Still UserSettings is cloned to WorkspaceCommandHelper, but I think this is
slightly better since CommandHelper and WorkspaceCommandHelper are scoped
based on call stack. Perhaps, UserSettings can be shared by Arc or immutable
reference.
2023-01-05 14:33:10 +09:00
Yuya Nishihara
71102a7d4a cli: pass CommandHelper in to branch/rebase helper functions
This prepares for migration from ui.settings() to command.settings(). We could
instead add workspace_command.settings(), but I'm not sure which would be less
bad. Anyway, these functions live in command layer, so taking CommandHelper
makes sense.
2023-01-05 14:33:10 +09:00
Yuya Nishihara
d8d015613c cli: include pager command args in warning message
"No such file or directory" is useless without a command name.
2023-01-05 14:33:10 +09:00
Yuya Nishihara
cfac7468d8 cli: store resolved pager command in Ui
ui.settings() will be removed.
2023-01-05 14:33:10 +09:00
Yuya Nishihara
825d00e62a cli: pass UserSettings in to expand_args() and parse_args(), update in place
This is a temporary workaround. I think UserSettings can be constructed after
user, repo, and --config-toml values are all set. parse_args() will probably
return config::Config or its wrapper instead of mutating UserSettings.
2023-01-05 14:33:10 +09:00
Yuya Nishihara
d7911ff279 cli: move ui.cwd() to CommandHelper
I'm going to remove owned UserSettings from Ui so that UserSettings can be
instantiated after both user and repo configs are loaded. ui.cwd() belongs
to the same category (random environment stuff), and Ui doesn't depend on it,
so let's remove it first from Ui.

I'm not pretty sure if CommandHelper and WorkspaceCommandHelper should be
a permanent home for cwd and settings, but it works for now as CommandHelper
is immutable.
2023-01-05 14:33:10 +09:00
Yuya Nishihara
42fa8bc20a cli: pass UserSettings in to edit_description() instead of Ui
It might be better to proxy editor handling thorough Ui (to do some I/O
adjustment?), but right now, edit_description() doesn't need Ui.
2023-01-05 07:56:03 +09:00
Yuya Nishihara
69bfaf8b76 cli: pass UserSettings in to update_working_copy() explicitly 2023-01-05 07:56:03 +09:00
Yuya Nishihara
4b1008271b cli: pass UserSettings in to load_revset_aliases() explicitly 2023-01-05 07:56:03 +09:00
Yuya Nishihara
20bed8f80e cli: pass UserSettings in to merge_tools::get_*_from_settings() explicitly
editor_name_from_settings() needs &mut Ui to show hint, but we're lucky that
the caller has a clone of UserSettings. This is one reason I want to remove
ui.settings(). A function taking (&mut Ui, &UserSettings) sounds reasonable,
but we can't pass in (&mut ui, ui.settings()) to it.
2023-01-05 07:56:03 +09:00
Yuya Nishihara
7232dac7e9 cli: pass UserSettings in to diff_util::diff_formats_for*()
This and the subsequent patches prepare for the removal of ui.settings().
Ui will be a consumer of UserSettings (or config::Config) to make it clear
that Ui can be constructed before UserSettings is fully set up.
2023-01-05 07:56:03 +09:00
Yuya Nishihara
d99c299ee0 cli: set StoreFactories directly by CommandHelper::new() 2023-01-05 07:56:03 +09:00
Yuya Nishihara
f89f91a18b cli: instantiate CommandHelper by caller of parse_args()
parse_args() doesn't know all parameters needed to set up CommandHelper,
and we have to set StoreFactories later. That's okay for now, but I'm going
to add more parameters derived from CliRunner.
2023-01-05 07:56:03 +09:00
Yuya Nishihara
d48d080c4b cli: extract first half of parse_args() to new function
The next commit will move CommandHelper construction to the caller of
parse_args(). Without this change, parse_args() would have to return a tuple
of 3 elements, which seemed a bit too much.
2023-01-05 07:56:03 +09:00
Yuya Nishihara
ca73e39ead cli: for ColorChoice, implement fmt::Display instead of ToString
And inline {choice}.
2023-01-05 07:56:03 +09:00
dependabot[bot]
46c5e354eb cargo: bump insta from 1.23.0 to 1.24.1
Bumps [insta](https://github.com/mitsuhiko/insta) from 1.23.0 to 1.24.1.
- [Release notes](https://github.com/mitsuhiko/insta/releases)
- [Changelog](https://github.com/mitsuhiko/insta/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mitsuhiko/insta/compare/1.23.0...1.24.1)

---
updated-dependencies:
- dependency-name: insta
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-04 09:30:57 -08:00
Ilya Grigoriev
b293d72dfd Put timestamp config for tests into debug namespace 2023-01-03 23:02:46 -08:00
Ilya Grigoriev
30d98974bb Make change ids in tests repeatable
This will be needed to test functionality for showing shortest
unique prefix for commit and change ids. As a bonus, this also
allows us to test log output with change ids.

As another bonus, this will prevent occasional CI failures like
https://github.com/martinvonz/jj/actions/runs/3817554687/jobs/6493881468.
2023-01-03 23:02:46 -08:00
Ilya Grigoriev
44d443a63b Move the old new_change_id function next to the tests
In the following commit, we replace it everywhere else.
2023-01-03 23:02:46 -08:00
Ilya Grigoriev
bd234c13c5 Fix the RNG seed in tests 2023-01-03 23:02:46 -08:00
Ilya Grigoriev
89e268c9d9 Rearrange a few lines in TestEnvironment's jj_cmd.
Moves all the config that depends on the command
number next to each other.
2023-01-03 23:02:46 -08:00
Ilya Grigoriev
79aaf117ea Put an RNG in user settings with configurable seed
Some hijinx are utilized to make it possible to generate
random values using an immutable `&UserSettings` reference.
2023-01-03 23:02:46 -08:00
Ilya Grigoriev
e8b21c5ce0 Change with_toml_strings to incorporate_toml_string
It makes more sense for this function to change `self`.
2023-01-03 23:02:46 -08:00