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

1111 commits

Author SHA1 Message Date
Yuya Nishihara
2e075f7de0 tests: for unit tests, simply generate unique ChangeId starting from 1
It's u128 just because Index::serialize() expects a 16-byte ChangeId. It
could be u32 with padding, but using u128 saved typing.
2023-01-14 14:37:45 +09:00
dependabot[bot]
eff903634c cargo: bump prost-build from 0.11.5 to 0.11.6
Bumps [prost-build](https://github.com/tokio-rs/prost) from 0.11.5 to 0.11.6.
- [Release notes](https://github.com/tokio-rs/prost/releases)
- [Commits](https://github.com/tokio-rs/prost/compare/v0.11.5...v0.11.6)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-13 21:24:02 +00:00
dependabot[bot]
e6cdd69d83 cargo: bump pest_derive from 2.5.2 to 2.5.3
Bumps [pest_derive](https://github.com/pest-parser/pest) from 2.5.2 to 2.5.3.
- [Release notes](https://github.com/pest-parser/pest/releases)
- [Commits](https://github.com/pest-parser/pest/compare/v2.5.2...v2.5.3)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-13 07:41:55 -08:00
dependabot[bot]
a1591477bb cargo: bump pest from 2.5.2 to 2.5.3
Bumps [pest](https://github.com/pest-parser/pest) from 2.5.2 to 2.5.3.
- [Release notes](https://github.com/pest-parser/pest/releases)
- [Commits](https://github.com/pest-parser/pest/compare/v2.5.2...v2.5.3)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-12 09:28:52 -08:00
dependabot[bot]
c4f0f3cfc7 cargo: bump prost from 0.11.5 to 0.11.6
Bumps [prost](https://github.com/tokio-rs/prost) from 0.11.5 to 0.11.6.
- [Release notes](https://github.com/tokio-rs/prost/releases)
- [Commits](https://github.com/tokio-rs/prost/compare/v0.11.5...v0.11.6)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-12 09:28:25 -08:00
dependabot[bot]
eeac6632a2 cargo: bump git2 from 0.15.0 to 0.16.0
Bumps [git2](https://github.com/rust-lang/git2-rs) from 0.15.0 to 0.16.0.
- [Release notes](https://github.com/rust-lang/git2-rs/releases)
- [Commits](https://github.com/rust-lang/git2-rs/compare/git2-curl-0.15.0...git2-curl-0.16.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-12 09:28:02 -08:00
dependabot[bot]
9c0ad817ff cargo: bump zstd from 0.12.1+zstd.1.5.2 to 0.12.2+zstd.1.5.2
Bumps [zstd](https://github.com/gyscos/zstd-rs) from 0.12.1+zstd.1.5.2 to 0.12.2+zstd.1.5.2.
- [Release notes](https://github.com/gyscos/zstd-rs/releases)
- [Commits](https://github.com/gyscos/zstd-rs/commits)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-12 09:26:50 -08:00
Yuya Nishihara
40a9f75441 workspace: do not look up ancestor paths by Workspace::load()
I don't think Workspace::load() should be permissive in that regard.
WorkspaceLoader could provide such function, but I feel it's more like
CLI business. CLI can also look for parent '.git' directory to suggest
'jj init --git-repo=..' if needed.
2023-01-10 23:31:26 +09:00
dependabot[bot]
1df1603b0b cargo: bump regex from 1.7.0 to 1.7.1
Bumps [regex](https://github.com/rust-lang/regex) from 1.7.0 to 1.7.1.
- [Release notes](https://github.com/rust-lang/regex/releases)
- [Changelog](https://github.com/rust-lang/regex/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/regex/compare/1.7.0...1.7.1)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-09 08:54:02 -08:00
dependabot[bot]
b85e4e136f cargo: bump insta from 1.24.1 to 1.26.0
Bumps [insta](https://github.com/mitsuhiko/insta) from 1.24.1 to 1.26.0.
- [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.24.1...1.26.0)

---
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-09 08:53:09 -08:00
Ilya Grigoriev
a5d77a27e8 cargo +nightly clippy --fix --workspace with today's nightly 2023-01-07 15:29:19 -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
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
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
Ilya Grigoriev
95637e252c Fix minor bug in UserSettings
The timestamp couldn't be set with `--config-toml 'user.timestamp=...'`.
2023-01-03 23:02:46 -08: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
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
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
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
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
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
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
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
Yuya Nishihara
587e42d65d backend: deduplicate id type declarations by using declarative macro 2022-12-23 23:52:03 +09:00
Yuya Nishihara
b07c0db56b backend: deduplicate id type impls by using declarative macro
It's unlikely we'll need to customize these impls per type, so let's ensure
that these newtypes have identical implementations. This commit also adds
from_hex() to FileId, SymlinkId, and ConflictId.
2022-12-23 23:52:03 +09:00
Yuya Nishihara
36020a2bbf revset: parse hg/git-like '^' postfix operator and show hint 2022-12-23 00:38:29 +09:00
Yuya Nishihara
7cd01b27a7 revset: parse hg-like '-'/'+' infix operators and show hint
Suggested by @arxanas.

Actually, it's easier to support these infix ops than erroring out, but I
don't want to make revset syntax more cryptic. "x- y" can't be handled by
this rule because "x-" is parsed as a parents expression.
2022-12-23 00:38:29 +09:00
Benjamin Saunders
aaa175eca7 lib: replace protobuf crate with prost 2022-12-22 07:04:35 -08:00
Yuya Nishihara
986649623d commit_builder: relax type of description parameter
The next commit will introduce a newtype for -m/--message argument which
can be converted Into<String>.

Since CommitBuilder is a thin wrapper, code bloat caused by generic parameters
wouldn't matter. I have another set of commits that makes all builder methods
accept Into/IntoIterator, which will remove some of .clone() calls from tests.
2022-12-22 14:59:03 +09:00