Yuya Nishihara
f34f764b9f
cli: migrate custom command augmentation and parse_args() to CliRunner
...
CommandHelper is passed by move because custom-backend/main.rs mutates it.
This will be addressed by the next commit.
2023-01-04 15:48:38 +09:00
Yuya Nishihara
9296ae6eb4
cli: add builder type that handles CLI initialization and teardown
...
parse_args() will probably become more involved to deal with --config-toml,
-R, and repository configs. This builder will hopefully allow us to move
things around without changing the high-level interface.
2023-01-04 15:48:38 +09:00
David Barnett
406be5e043
Add "jj debug config-schema" command to output JSON schema
...
Extends TOML/JSON schema changes from #966 to allow jj to output the
schema directly. Context in #879 .
2023-01-03 22:02:25 -06:00
Martin von Zweigbergk
635f5a5cb8
build: don't use vendored OpenSSL by default
...
I added support for using a vendored OpenSSL in dbadbd68c0
. That was
in order to get the musl binary to work. However, it shouldn't be
needed on most platforms, and we've had a few reports of issues caused
by it. Let's disable it by default and enable it specifically when
building the musl binary instead.
2023-01-03 18:57:38 -08:00
Yuya Nishihara
9763a4d689
cli: move --verbose handling to parse_args(), enable it in custom examples
2023-01-04 11:56:53 +09:00
Yuya Nishihara
dbcfb00d2c
cli: extract thin wrapper for tracing initialization
...
I'm going to add a high-level abstraction to hide details of the CLI startup,
but a low-level wrapper like this would still be useful.
2023-01-04 11:56:53 +09:00
Ruben Slabbert
dc26d4db17
fix: update cargo install command in readme to specify jujutsu crate
2023-01-03 16:13:23 -08:00
David Barnett
01e656efbe
Define config TOML/JSON schema
...
Can be used with tools like taplo-lsp to show hints & validation in
editors/IDEs. Won't apply automatically to config files until it's
submitted to schemastore.org, but in the meantime it can be used via a
schema directive
(https://taplo.tamasfe.dev/configuration/directives.html#the-schema-directive )
or other manual config mechanism.
Context in #879 .
2023-01-02 20:26:28 -06:00
Waleed Khan
af55d17a25
git_backend: propagate various errors
...
I needed this in the course of debugging an error. Before this commit, the error looked like this:
```
Error: Unexpected error from backend: Object not found
```
After this commit, it looks like this:
```
Error: Unexpected error from backend: Object with CommitId 8f59646bc9bb6bb44b5624f1248f4a708f37003c not found: object not found - no match for id (8f59646bc9bb6bb44b5624f1248f4a708f37003c); class=Odb (9); code=NotFound (-3)
```
2023-01-02 12:28:51 -06:00
Waleed Khan
9f8d78c57d
working_copy: propagate error source for SourceNotFound
errors
...
Might as well while I'm here.
2023-01-02 12:28:51 -06:00
Waleed Khan
e299963fae
backend: remove PartialEq
/Eq
implementations
...
As soon as we start tracking the `#[source]` for error variants, we won't be able to rely on the presence of `Eq` implementations.
2023-01-02 12:28:51 -06:00
Waleed Khan
67cb20611e
cli_util: fix typo in From<BackendError>
...
This error message was confusing because I thought the error was coming directly from the store, not via the backend.
2023-01-02 12:28:51 -06:00
Waleed Khan
456be4cc73
backend: create BackendError::InvalidHashLength
...
Strictly speaking, we could rely on e.g. `git2::Oid::from_str` to produce an error, but I figure that having an explicit error for a mismatching hash length might demystify some error condition in the future, since commit IDs and change IDs and potentially other backends' IDs may have different lengths, so this could flag a mismatch earlier/more obviously.
2023-01-02 12:28:51 -06:00
Waleed Khan
7f8a196ab2
backend: create ObjectId
trait
...
This lets us operate over various kinds of objects polymorphically (e.g. call `.hex()` on any kind of object hash).
2023-01-02 12:28:51 -06:00
Ilya Grigoriev
9974d67da2
Test jj log
for divergent commits
...
It turns out we did not have tests that would catch `jj log` failing
to mark divergent commits.
2023-01-02 00:08:55 -08:00
Ilya Grigoriev
265fa7f7c7
cargo +nightly clippy --fix --workspace
2023-01-02 00:08:55 -08:00
Yuya Nishihara
6586a756c1
cli: inline create_ui(), use ? to handle config error
2023-01-02 14:14:50 +09:00
Yuya Nishihara
1b45c5fe8e
cli: use ui.reset() to process --config-toml arguments
...
This should also fix handling of --config-toml 'colors...'. Before, the color
table wouldn't be updated without mode change.
2023-01-02 14:14:50 +09:00
Yuya Nishihara
fa68a21bd1
cli: create default ui, then reconfigure with loaded user settings
...
This function will probably be used to apply settings loaded from
.jj/repo/config.toml.
2023-01-02 14:14:50 +09:00
Yuya Nishihara
da95ae65be
cli: extract Ui::new() that creates ui with default config
...
Since ui object is needed to report read_config() error, it makes sense to
create ui first without fallible user configuration. Ui::for_terminal() will
be replaced with this function and ui.reset(read_config()?).
Default::default() is also added to silence clippy. If we prefer, Ui::new()
can be replaced with Ui::default().
2023-01-02 14:14:50 +09:00
Philip Metzger
48356817ba
[Docs]: Add some more documentation on how to work with github.
...
The document roughly describes some workflows, which help new users
to start with github.
2023-01-01 16:36:09 +01:00
Martin von Zweigbergk
d6fcf4c7b2
repo: load correct OpHeadsStore
depending on repo's type
...
We forgot to actually call `StoreFactories::load_op_heads_store()` to
load the right type of `OpHeadsStore` depending on the contents of
`.jj/repo/op_heads/type`. That shouldn't have any effect yet since we
only have one type so far, and there are no out-of-tree types yet
either (clearly, since they would not work).
2022-12-31 01:22:29 -08:00
Waleed Khan
cf8c2b0717
cli_util: fix typo
2022-12-31 02:57:26 -06:00
dependabot[bot]
f05c6fc6fd
cargo: bump once_cell from 1.16.0 to 1.17.0
...
Bumps [once_cell](https://github.com/matklad/once_cell ) from 1.16.0 to 1.17.0.
- [Release notes](https://github.com/matklad/once_cell/releases )
- [Changelog](https://github.com/matklad/once_cell/blob/master/CHANGELOG.md )
- [Commits](https://github.com/matklad/once_cell/compare/v1.16.0...v1.17.0 )
---
updated-dependencies:
- dependency-name: once_cell
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-12-30 09:38:30 -08:00
dependabot[bot]
d7c335d6b2
cargo: bump predicates from 2.1.4 to 2.1.5
...
Bumps [predicates](https://github.com/assert-rs/predicates-rs ) from 2.1.4 to 2.1.5.
- [Release notes](https://github.com/assert-rs/predicates-rs/releases )
- [Changelog](https://github.com/assert-rs/predicates-rs/blob/master/CHANGELOG.md )
- [Commits](https://github.com/assert-rs/predicates-rs/compare/v2.1.4...v2.1.5 )
---
updated-dependencies:
- dependency-name: predicates
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-12-30 09:38:14 -08:00
Augie Fackler
f64d8f45ae
Commands: Alias commit to ci for cvs/mercurial/svn compatability
...
As far as I can tell it won't hurt anyone to have this alias exist, but will
help those of us with old muscle memory.
2022-12-30 09:26:55 -05:00
Yuya Nishihara
b3fa9e5b6c
matchers: rename Dirs to RepoPathTree as it no longer represents directory
2022-12-30 14:15:27 +09:00
Yuya Nishihara
4f875ff9b7
matchers: leverage Dirs tree to test prefix matches, no .to_vec() in loop
...
No special case for prefix.is_root() is needed since the root entry can
also be flagged as a file.
2022-12-30 14:15:27 +09:00
Yuya Nishihara
996ac22921
matchers: simplify FilesMatcher::new() to take slice of paths
2022-12-30 14:15:27 +09:00
Yuya Nishihara
c7eaee3d86
matchers: remove redundant files set from FilesMatcher, use Dirs
2022-12-30 14:15:27 +09:00
Yuya Nishihara
2fb0363c03
matchers: add method to create visit sets from Dirs, remove separate getters
...
We might also want to eliminate .collect()/clone() here, but that's not
considered yet.
2022-12-30 14:15:27 +09:00
Yuya Nishihara
ba632e6ef6
matchers: build tree of Dirs so prefix match works out of the box
...
A file entry is represented as a Dirs of is_file flag set. This might seem
odd at this point, but allows us to remove special case from PrefixMatcher.
PrefixMatcher::new(&[RepoPath::root()]) will set is_file to the root entry.
2022-12-30 14:15:27 +09:00
dependabot[bot]
37fa7c39d4
cargo: bump whoami from 1.2.3 to 1.3.0
...
Bumps [whoami](https://github.com/ardaku/whoami ) from 1.2.3 to 1.3.0.
- [Release notes](https://github.com/ardaku/whoami/releases )
- [Changelog](https://github.com/ardaku/whoami/blob/stable/CHANGELOG.md )
- [Commits](https://github.com/ardaku/whoami/compare/v1.2.3...v1.3.0 )
---
updated-dependencies:
- dependency-name: whoami
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-12-29 07:39:59 -08:00
David Barnett
e824c491bf
Add a "config" command with "get" and "list" subcommands
...
Partially fixes #531 .
2022-12-27 16:59:20 -06:00
dependabot[bot]
9bf5f1c430
cargo: bump serde from 1.0.151 to 1.0.152
...
Bumps [serde](https://github.com/serde-rs/serde ) from 1.0.151 to 1.0.152.
- [Release notes](https://github.com/serde-rs/serde/releases )
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.151...v1.0.152 )
---
updated-dependencies:
- dependency-name: serde
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-12-27 14:18:35 -08:00
Martin von Zweigbergk
d86ba708a3
repo: add MutableRepo::rewrite_commit()
returning CommitBuilder
...
Same reasoning as the previous commit.
2022-12-26 23:30:52 -08:00
Martin von Zweigbergk
812ef97adb
repo: add MutableRepo::new_commit()
returning CommitBuilder
...
Since `CommitBuilder` now has a reference to `MutableRepo`, it's
convenient to create instances of it by calling a method on
`MutableRepo`.
2022-12-26 23:30:52 -08:00
Martin von Zweigbergk
f3208f59c4
store: propagate error from Backend::write_commit()
2022-12-26 23:30:52 -08:00
Martin von Zweigbergk
f1d7bbe508
testutils: create a function for writing a random commit to MutableRepo
...
We already have `create_random_commit()`, which returns a
`CommitBuilder`. Most callers directly write that to a
`MutableRepo`. That currently returns a `Commit`, but I'm about to
make it propagate errors from the backend. That would add an
`unwrap()` to this sequence, making it longer. Let's create a simple
helper for these callers to simplify this common pattern.
2022-12-26 23:30:52 -08:00
Martin von Zweigbergk
49b2f3b6ca
commit_builder: keep MutableRepo reference
...
When you're done with the `CommitBuilder`, you're going to have to
call `write_to_repo()`, passing it a mutable `MutableRepo`
reference. It's a bit simpler to pass that reference when we create
the `CommitBuilder` instead, so that's what this patch does.
A drawback of passing in the mutable reference when we create the
builder is that we can't have multiple unfinished `CommitBuilder`
instance live at the same time. We don't have any such use cases yet,
and it's not hard to work around them, so I think this change is worth
it.
2022-12-26 23:30:52 -08:00
dependabot[bot]
70a6798d76
cargo: bump pest_derive from 2.5.1 to 2.5.2
...
Bumps [pest_derive](https://github.com/pest-parser/pest ) from 2.5.1 to 2.5.2.
- [Release notes](https://github.com/pest-parser/pest/releases )
- [Commits](https://github.com/pest-parser/pest/compare/v2.5.1...v2.5.2 )
---
updated-dependencies:
- dependency-name: pest_derive
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-12-26 15:20:38 +00:00
Yuya Nishihara
d89619c9c6
git: diff refs to export without building dummy view
2022-12-25 00:11:14 +09:00
Martin von Zweigbergk
5cb3807b26
colors: move defaults from source to file
2022-12-24 07:07:37 -08:00
Martin von Zweigbergk
6514ab2e3a
cli: when config is invalid, use default config
...
When we fail to read the user's config, it seems obviously better to
use the default config than to not use it. It doesn't matter yet, but
it will matter when I've moved color configs out of `formatter.rs` and
into a `.toml` file. Without this change, we'd lose the default
coloring of the error message for config errors.
2022-12-24 07:07:37 -08:00
Martin von Zweigbergk
462f696e4e
config: add a README to explain that the config files are not installed
2022-12-24 07:07:37 -08:00
Martin von Zweigbergk
b22a6db7e7
config: move default merge-tool config into config/ directory
...
I'm about to add more default configs, so it will be good to collect
them in one directory.
2022-12-24 07:07:37 -08:00
dependabot[bot]
db0a524f7b
cargo: bump clap_complete from 4.0.6 to 4.0.7
...
Bumps [clap_complete](https://github.com/clap-rs/clap ) from 4.0.6 to 4.0.7.
- [Release notes](https://github.com/clap-rs/clap/releases )
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md )
- [Commits](https://github.com/clap-rs/clap/compare/clap_complete-v4.0.6...clap_complete-v4.0.7 )
---
updated-dependencies:
- dependency-name: clap_complete
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-12-23 23:31:08 +00:00
dependabot[bot]
72ed6676bb
cargo: bump clap from 4.0.30 to 4.0.32
...
Bumps [clap](https://github.com/clap-rs/clap ) from 4.0.30 to 4.0.32.
- [Release notes](https://github.com/clap-rs/clap/releases )
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md )
- [Commits](https://github.com/clap-rs/clap/compare/v4.0.30...v4.0.32 )
---
updated-dependencies:
- dependency-name: clap
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-12-23 15:18:36 -08:00
dependabot[bot]
77b7884464
cargo: bump clap_mangen from 0.2.5 to 0.2.6
...
Bumps [clap_mangen](https://github.com/clap-rs/clap ) from 0.2.5 to 0.2.6.
- [Release notes](https://github.com/clap-rs/clap/releases )
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md )
- [Commits](https://github.com/clap-rs/clap/compare/clap_mangen-v0.2.5...clap_mangen-v0.2.6 )
---
updated-dependencies:
- dependency-name: clap_mangen
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-12-23 09:25:15 -08:00
dependabot[bot]
481f87abd3
cargo: bump pest from 2.5.1 to 2.5.2
...
Bumps [pest](https://github.com/pest-parser/pest ) from 2.5.1 to 2.5.2.
- [Release notes](https://github.com/pest-parser/pest/releases )
- [Commits](https://github.com/pest-parser/pest/compare/v2.5.1...v2.5.2 )
---
updated-dependencies:
- dependency-name: pest
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-12-23 09:24:57 -08:00