Yuya Nishihara
c0ce88003e
config: introduce our ConfigGetError type
...
Since most callers don't need to handle loading/parsing errors, it's probably
better to add a separate error type for "get" operations. The other uses of
ConfigError will be migrated later.
Since ConfigGetError can preserve the source name/path information, this patch
also removes some ad-hock error handling codes.
2024-12-06 10:52:10 +09:00
Yuya Nishihara
c3a8fb9f37
cli: config get: break method chaining for ease of error type migration
...
.get_value() doesn't do type casting, so a Type error wouldn't occur.
2024-12-06 10:52:10 +09:00
Yuya Nishihara
ba739b2f76
config: move ConfigResultExt from settings module
...
As the name suggests, this helper should be in the config module.
2024-12-06 10:52:10 +09:00
Yuya Nishihara
aa4f48c7b7
config: wrap per-layer table access API
...
The added function is not "get_table(name) -> Result<Table, Error>" because
callers need to know whether the value was missing or shadowed by non-table
value. We just don't have this problem in template/revset-aliases because these
tables are top-level items.
2024-12-06 10:52:10 +09:00
Shane Sveller
5553baf540
cli: git push: describe private commits that would fail push
2024-12-04 13:12:30 -06:00
Martin von Zweigbergk
7618b52b79
cli: consider "JJ:" lines as comments also when not followed by space
...
We currently ignore lines prefixed with "JJ: " (including the space)
in commit messages and in the list of sparse paths from `jj sparse
edit`. I think I included the trailing space in the prefix simply
because that's how we render comments line we insert before we ask the
user to edit the file. However, as #5004 says, Git doesn't require a
space after their "#" prefix. Neither does Mercurial after their "HG:"
prefix. So let's follow their lead and not require the trailing
space. Seems useful especially for people who have their editor
configured to strip trailing spaces.
2024-12-04 10:40:56 -08:00
Scott Taylor
fa7d9c09fc
merge_tools: add merge-conflict-exit-codes option
...
binaries / Build binary artifacts (push) Waiting to run
nix / flake check (push) Waiting to run
build / build (, macos-13) (push) Waiting to run
build / build (, macos-14) (push) Waiting to run
build / build (, ubuntu-latest) (push) Waiting to run
build / build (, windows-latest) (push) Waiting to run
build / build (--all-features, ubuntu-latest) (push) Waiting to run
build / Build jj-lib without Git support (push) Waiting to run
build / Check protos (push) Waiting to run
build / Check formatting (push) Waiting to run
build / Check that MkDocs can build the docs (push) Waiting to run
build / Check that MkDocs can build the docs with latest Python and uv (push) Waiting to run
build / cargo-deny (advisories) (push) Waiting to run
build / cargo-deny (bans licenses sources) (push) Waiting to run
build / Clippy check (push) Waiting to run
Codespell / Codespell (push) Waiting to run
website / prerelease-docs-build-deploy (ubuntu-latest) (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
Some Git merge drivers can partially resolve conflicts, leaving some
conflict markers in the output file. In that case, they exit with a code
between 1 and 127 to indicate that there was a conflict remaining in the
file (since Git uses a shell to run the merge drivers, and shells often
use exit codes above 127 for special meanings such as exiting due to a
signal):
https://git-scm.com/docs/gitattributes#_defining_a_custom_merge_driver
We should support this convention as well, since it will allow many Git
merge drivers to be used with Jujutsu, but we don't run our merge tools
through a shell, so there is no reason to treat exit codes 1 through 127
specially. Instead, we let the user specify which exact exit codes
should indicate conflicts. This is also better for cross-platform
support, since Windows may use different exit codes than Linux for
instance.
2024-12-03 20:08:31 -06:00
Yuya Nishihara
4134511cfa
cli: migrate remainder of Config::get() to StackedConfig::get()
2024-12-04 10:33:22 +09:00
Yuya Nishihara
548f85d62d
formatter: migrate tests to be using StackedConfig
2024-12-04 10:33:22 +09:00
Yuya Nishihara
d6efd12bc8
completion: remove redundant rebuild of default config
2024-12-04 10:33:22 +09:00
Yuya Nishihara
c4eaef6dfc
completion: migrate to UserSettings API
...
config::Config will soon be replaced with StackedConfig, and UserSettings
provides more convenient methods than StackedConfig.
2024-12-04 10:33:22 +09:00
Yuya Nishihara
0a0f8c5116
config: remove unneeded Result wrapping from resolved_config_values()
2024-12-04 10:33:22 +09:00
Yuya Nishihara
23b24120fb
config: migrate resolved_config_values() to new getter API
...
When I wrote the original lookup function, I didn't notice that the root config
value could be accessed as &config.cache without cloning. That's the only reason
I added split_safe_prefix().
2024-12-04 10:33:22 +09:00
Yuya Nishihara
b0c7d0a7e2
cli: duplicate: parse -rREV option properly
...
Since "jj duplicate" interface is now quite similar to "jj rebase", it's
annoying that "-r" isn't parsed properly.
2024-12-04 08:38:44 +09:00
Remo Senekowitsch
a9d4886997
completion: teach absorb and bookmark move about revisions
...
These were simply forgotten in dd6479f104
2024-12-04 00:33:01 +01:00
Martin von Zweigbergk
4e125b6c2f
cli: move ci
alias to config file
...
binaries / Build binary artifacts (push) Waiting to run
nix / flake check (push) Waiting to run
build / build (, macos-13) (push) Waiting to run
build / build (, macos-14) (push) Waiting to run
build / build (, ubuntu-latest) (push) Waiting to run
build / build (, windows-latest) (push) Waiting to run
build / build (--all-features, ubuntu-latest) (push) Waiting to run
build / Build jj-lib without Git support (push) Waiting to run
build / Check protos (push) Waiting to run
build / Check formatting (push) Waiting to run
build / Check that MkDocs can build the docs (push) Waiting to run
build / Check that MkDocs can build the docs with latest Python and uv (push) Waiting to run
build / cargo-deny (advisories) (push) Waiting to run
build / cargo-deny (bans licenses sources) (push) Waiting to run
build / Clippy check (push) Waiting to run
Codespell / Codespell (push) Waiting to run
website / prerelease-docs-build-deploy (ubuntu-latest) (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
I would like to delete this alias altogether. By moving it to the
config to start with, users can start overriding it themselves, as
`commit` or whatever they prefer.
2024-12-03 10:37:54 -08:00
Yuya Nishihara
5db4f0bca0
cli: make jj desc
and jj st
aliases visible again
...
This backs out commit fd271d39ad
"cli: make `jj desc` and `jj st` aliases
hidden."
As we discussed in https://github.com/martinvonz/jj/pull/4811 , completion of
flags doesn't work for hidden aliases.
2024-12-03 23:10:24 +09:00
Yuya Nishihara
94c6d6eaff
cli: leverage new settings.get(path) in merge-tools lookup
...
We no longer need to clone the entire table to get around the path expression
syntax of the config crate.
2024-12-03 09:42:47 +09:00
Yuya Nishihara
13ccd92766
settings: do not store "debug.randomness-seed" in stringified form
...
While this is a debug option, it doesn't make sense to store an integer value
as a string. We can parse the environment variable instead. The variable is
temporarily parsed into i64 because i64 is the integer type of TOML.
toml_edit::Value doesn't implement any other integer conversion functions.
2024-12-03 09:42:47 +09:00
Yuya Nishihara
3890e426e5
settings: migrate get() to StackedConfig, rename .stacked_config to .config
...
The goal is to remove dependency on config::Config and replace the underlying
table type to toml_edit::Table. Other StackedConfig::merge() users will be
migrated in the next batch.
2024-12-03 09:42:47 +09:00
Yuya Nishihara
5946ef3880
settings: forward .get_table(key) to underlying config object
...
This will help migrate away from config::Config. We'll probably need a better
abstraction to preserve error source indication, but let's leave that for now.
.get_table() isn't forwarded to .get::<T>() because ConfigTable won't implement
Deserialize if we migrate to toml_edit.
2024-12-03 09:42:47 +09:00
Yuya Nishihara
ba07c3bc54
config: reexport table and value types
...
These types will be replaced with toml_edit::Table and ::Value respectively.
2024-12-03 09:42:47 +09:00
Ilya Grigoriev
1f554e801f
cli util gc
: document the fact that evolution log limits gc
...
This is a followup to the discussion in
https://github.com/martinvonz/jj/pull/4953#discussion_r1855328098
2024-12-02 09:09:57 -08:00
Remo Senekowitsch
a8c35db43d
completion: suggest file paths incrementally
...
binaries / Build binary artifacts (push) Waiting to run
nix / flake check (push) Waiting to run
build / build (, macos-13) (push) Waiting to run
build / build (, macos-14) (push) Waiting to run
build / build (, ubuntu-latest) (push) Waiting to run
build / build (, windows-latest) (push) Waiting to run
build / build (--all-features, ubuntu-latest) (push) Waiting to run
build / Build jj-lib without Git support (push) Waiting to run
build / Check protos (push) Waiting to run
build / Check formatting (push) Waiting to run
build / Check that MkDocs can build the docs (push) Waiting to run
build / Check that MkDocs can build the docs with latest Python and uv (push) Waiting to run
build / cargo-deny (advisories) (push) Waiting to run
build / cargo-deny (bans licenses sources) (push) Waiting to run
build / Clippy check (push) Waiting to run
Codespell / Codespell (push) Waiting to run
website / prerelease-docs-build-deploy (ubuntu-latest) (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
If there are multiple files in a subdirectory that are candidates for
completion, only complete the common directory prefix to reduce the number of
completion candidates shown at once.
This matches the normal shell completion of file paths.
2024-12-01 11:06:36 +01:00
Yuya Nishihara
36e83ed260
cli: move get_new_config_file_path() to commands::config
...
There aren't any other callers internally, and it is a thin wrapper around
ConfigEnv functions which can be easily implemented.
2024-11-30 10:01:35 +09:00
Yuya Nishihara
e1cd1a00e6
config: update comment about new config file creation
...
Spotted while updating get_new_config_file_path() callers. "jj config path"
isn't a command to create new config file.
2024-11-30 10:01:35 +09:00
Yuya Nishihara
da01734639
settings: own StackedConfig by UserSettings, migrate tests to use config layer
...
UserSettings::get_*() will be changed to look up a merged value from
StackedConfig, not from a merged config::Value. This will help migrate away
from the config crate.
Not all tests are ported to ConfigLayer::parse() because it seemed a bit odd
to format!() a TOML document and parse it to build a table of configuration
variables.
2024-11-30 10:01:05 +09:00
Ilya Grigoriev
1b96d27b66
cli git fetch: clarify the error for invalid branch names/globs
...
Create a clearer error when a branch name contains `*`.
Slightly clarify the error message for `?` in branch name/glob.
2024-11-29 11:27:05 -08:00
Ilya Grigoriev
d3a51cebb7
docs: add example glob to jj help git fetch
...
I tried to clarify the text a bit as well.
2024-11-29 11:27:05 -08:00
Remo Senekowitsch
5fcc549eab
completion: teach commands about files
...
binaries / Build binary artifacts (push) Waiting to run
nix / flake check (push) Waiting to run
build / build (, macos-13) (push) Waiting to run
build / build (, macos-14) (push) Waiting to run
build / build (, ubuntu-latest) (push) Waiting to run
build / build (, windows-latest) (push) Waiting to run
build / build (--all-features, ubuntu-latest) (push) Waiting to run
build / Build jj-lib without Git support (push) Waiting to run
build / Check protos (push) Waiting to run
build / Check formatting (push) Waiting to run
build / Check that MkDocs can build the docs (push) Waiting to run
build / Check that MkDocs can build the docs with latest Python and uv (push) Waiting to run
build / cargo-deny (advisories) (push) Waiting to run
build / cargo-deny (bans licenses sources) (push) Waiting to run
build / Clippy check (push) Waiting to run
Codespell / Codespell (push) Waiting to run
website / prerelease-docs-build-deploy (ubuntu-latest) (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
This is heavily based on Benjamin Tan's fish completions:
https://gist.github.com/bnjmnt4n/9f47082b8b6e6ed2b2a805a1516090c8
Some differences include:
- The end of a `--from`, `--to` ranges is also considered.
- `jj log` is not completed (yet). It has a different `--revisions` argument
that requires some special handling.
2024-11-28 15:34:39 +01:00
Martin von Zweigbergk
409be2e1c4
store: make get_tree()
functions take owned repo path
...
The function needs an owned value, so we might as well pass it one and
avoid a few clone calls.
2024-11-27 18:53:28 -08:00
Yuya Nishihara
bf17067861
config: replace LayeredConfigs with StackedConfig
...
binaries / Build binary artifacts (push) Waiting to run
nix / flake check (push) Waiting to run
build / build (, macos-13) (push) Waiting to run
build / build (, macos-14) (push) Waiting to run
build / build (, ubuntu-latest) (push) Waiting to run
build / build (, windows-latest) (push) Waiting to run
build / build (--all-features, ubuntu-latest) (push) Waiting to run
build / Build jj-lib without Git support (push) Waiting to run
build / Check protos (push) Waiting to run
build / Check formatting (push) Waiting to run
build / Check that MkDocs can build the docs (push) Waiting to run
build / Check that MkDocs can build the docs with latest Python and uv (push) Waiting to run
build / cargo-deny (advisories) (push) Waiting to run
build / cargo-deny (bans licenses sources) (push) Waiting to run
build / Clippy check (push) Waiting to run
Codespell / Codespell (push) Waiting to run
website / prerelease-docs-build-deploy (ubuntu-latest) (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
Parsed --config-toml args are simply appended because the caller knows there
should be no preloaded CommandArg layers.
2024-11-28 08:45:48 +09:00
Yuya Nishihara
08b1ebe934
config: extract remainder of LayeredConfigs methods to free functions
2024-11-28 08:45:48 +09:00
Yuya Nishihara
a890e1a7f8
config: move read_user/repo_config() methods to ConfigEnv
2024-11-28 08:45:48 +09:00
Yuya Nishihara
1d485b75b6
config: manage repo config path by ConfigEnv
...
This will help migrate LayeredConfigs methods to ConfigEnv.
2024-11-28 08:45:48 +09:00
Yuya Nishihara
6ec3fcc359
cli: fix typo in config path not found error
2024-11-28 08:45:48 +09:00
Remo Senekowitsch
92adf896b9
completion: include bookmarks and tags in revisions
2024-11-27 18:46:04 +01:00
Remo Senekowitsch
faa4fff621
completion: allow calling jj multiple times
2024-11-27 18:46:04 +01:00
Yuya Nishihara
3186d91a65
config: rename ConfigEnv methods to clarify the intent
...
We'll add existing/new_repo_config_path() methods.
2024-11-27 07:49:22 +09:00
Yuya Nishihara
39063f18ff
config: make ConfigEnv public, replace global functions
2024-11-27 07:49:22 +09:00
Yuya Nishihara
724928028b
config: make ConfigEnv methods not consume self
...
ConfigEnv will be owned by CommandHelper, and some of the LayeredConfigs
methods will be moved there.
2024-11-27 07:49:22 +09:00
Yuya Nishihara
99c790f55c
config: extract user path resolution from ConfigEnv
...
The idea is that ConfigEnv will be a public interface that helps load/create
config file. The path doesn't have to be resolved multiple times.
2024-11-27 07:49:22 +09:00
Yuya Nishihara
34ef4d8587
config: inline check() function in test cases
...
It becomes hard to maintain because the next patch will change the function
signature.
2024-11-27 07:49:22 +09:00
Scott Taylor
7f57866332
merge_tools: allow setting conflict marker style per-tool
...
binaries / Build binary artifacts (push) Waiting to run
nix / flake check (push) Waiting to run
build / build (, macos-13) (push) Waiting to run
build / build (, macos-14) (push) Waiting to run
build / build (, ubuntu-latest) (push) Waiting to run
build / build (, windows-latest) (push) Waiting to run
build / build (--all-features, ubuntu-latest) (push) Waiting to run
build / Build jj-lib without Git support (push) Waiting to run
build / Check protos (push) Waiting to run
build / Check formatting (push) Waiting to run
build / Check that MkDocs can build the docs (push) Waiting to run
build / Check that MkDocs can build the docs with latest Python and uv (push) Waiting to run
build / cargo-deny (advisories) (push) Waiting to run
build / cargo-deny (bans licenses sources) (push) Waiting to run
build / Clippy check (push) Waiting to run
Codespell / Codespell (push) Waiting to run
website / prerelease-docs-build-deploy (ubuntu-latest) (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
I left the "merge-tool-edits-conflict-markers" option unchanged,
since removing it would likely break some existing configurations. It
also seems like it could be useful to have a merge tool use the default
conflict markers instead of requiring the conflict marker style to
always be set for the merge tool (e.g. if a merge tool allows the user
to manually edit the conflicts).
2024-11-26 09:05:17 -06:00
Yuya Nishihara
e029e8d5db
config: rename AnnotatedValue::path to ::name
...
The field name "path" was confusing because we'll probably add a source file
path to AnnotatedValue.
2024-11-26 18:17:52 +09:00
Yuya Nishihara
14798d3f50
config: add doc comment to AnnotatedValue
2024-11-26 18:17:52 +09:00
Yuya Nishihara
0b23bbb3bb
config: move resolved_config_values() to free function
...
This will help replace cli LayeredConfigs with new StackedConfig. I originally
considered moving this function to jj-lib, but the current API is very specific
to the CLI use case, and wouldn't be reused for building a merged sub table. We
might instead want to extract some bits as a library function.
2024-11-26 18:17:52 +09:00
Yuya Nishihara
0df1ac65b5
cli: call resolved_config_values() directly from cmd_config_list()
...
There's only one caller, and it will become accessible through
command.settings().
2024-11-26 18:17:52 +09:00
Benjamin Tan
ee37409c5e
cli: simplify-parents: add default revsets.simplify-parents
config
...
binaries / Build binary artifacts (push) Waiting to run
nix / flake check (push) Waiting to run
build / build (, macos-13) (push) Waiting to run
build / build (, macos-14) (push) Waiting to run
build / build (, ubuntu-latest) (push) Waiting to run
build / build (, windows-latest) (push) Waiting to run
build / build (--all-features, ubuntu-latest) (push) Waiting to run
build / Build jj-lib without Git support (push) Waiting to run
build / Check protos (push) Waiting to run
build / Check formatting (push) Waiting to run
build / Check that MkDocs can build the docs (push) Waiting to run
build / Check that MkDocs can build the docs with latest Python and uv (push) Waiting to run
build / cargo-deny (advisories) (push) Waiting to run
build / cargo-deny (bans licenses sources) (push) Waiting to run
build / Clippy check (push) Waiting to run
Codespell / Codespell (push) Waiting to run
website / prerelease-docs-build-deploy (ubuntu-latest) (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
This adds a new `revsets.simplify-parents` configuration option (similar
to `revsets.fix`) which serves as the default revset for `jj
simplify-parents` if no `--source` or `--revisions` arguments are
provided.
2024-11-26 13:19:25 +08:00
Nathanael Huffman
f6210aa99d
cli: Fix error message grammar and associated tests
2024-11-25 18:22:33 -06:00