Yuya Nishihara
5346bd734f
git_backend: translate io::Error of read_conflict() to ReadObject error
...
This is the last place in Git backend where io::Error is magically converted
to BackendError::Other.
2023-07-06 20:48:46 +09:00
Yuya Nishihara
4e4ca46998
git_backend: wrap TableStoreError to preserve source error object
2023-07-06 20:48:46 +09:00
Yuya Nishihara
cf8a0466c4
backend: introduce error types specific to init/load phases
...
Errors that may occur while loading backend would vary per backends, and
it's unlikely that these errors could be mapped to BackendError variants
other than BackendError::Other. So let's extract Other(_) of that kind as
a separate type to clarify there would be no other error variants.
Perhaps, Backend/Error will be renamed to CommitBackend/Error or
CommitStore/Error?, whereas I think BackendInit/LoadError can be shared
among store factories.
2023-07-06 20:48:46 +09:00
Yuya Nishihara
e1e75daa8e
backend: make BackendError::Other preserve source error object
2023-07-06 20:48:46 +09:00
Martin von Zweigbergk
99226bb96d
tree: simplify diff iterator by leveraging Tree::value()
...
This is much simpler and I was slightly surprised that it doesn't have
much impact on performance. I tried `jj --ignore-working-copy diff -s
--from root --to v5.15` in the Linux kernel repo, and there was
perhaps a 1.5% slowdown (508 ms -> 515 ms). In more normal cases (like
diffing a single commit against its parent), I couldn't measure any
difference at all.
2023-07-06 11:21:21 +02:00
Yuya Nishihara
5b78fe75b1
git_backend: propagate load() error to caller
...
#1794
2023-07-06 12:43:49 +09:00
Yuya Nishihara
84060d750b
git_backend: propagate init_internal() error to caller
2023-07-06 12:43:49 +09:00
Yuya Nishihara
2db4c906ad
git_backend: attach file path to initialization error
2023-07-06 12:43:49 +09:00
Yuya Nishihara
31bb68486e
git_backend: insert error type specific to backend initialization
...
This helps to map initialization error to BackendError without too general
From impl. I don't think io::Error (or our PathError) should be automatically
translated to BackendError::Other because BackendError has more specific
variants depending on context. If the error is specific to initialization,
it makes sense to translate it to Other variant.
2023-07-06 12:43:49 +09:00
Yuya Nishihara
a09a406817
git_backend: leverage std::fs::read/write() helpers
2023-07-06 12:43:49 +09:00
Yuya Nishihara
6d6b87f4b0
file_util: move PathError and its helper trait from repo module
...
It's generally useful in order to attach context to io::Error.
2023-07-06 12:43:49 +09:00
dependabot[bot]
a7408d8bc9
cargo: bump smallvec from 1.10.0 to 1.11.0
...
Bumps [smallvec](https://github.com/servo/rust-smallvec ) from 1.10.0 to 1.11.0.
- [Release notes](https://github.com/servo/rust-smallvec/releases )
- [Commits](https://github.com/servo/rust-smallvec/compare/v1.10.0...v1.11.0 )
---
updated-dependencies:
- dependency-name: smallvec
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
2023-07-05 22:29:49 +02:00
dependabot[bot]
0e4ef1c8d5
cargo: bump serde_json from 1.0.99 to 1.0.100
...
Bumps [serde_json](https://github.com/serde-rs/json ) from 1.0.99 to 1.0.100.
- [Release notes](https://github.com/serde-rs/json/releases )
- [Commits](https://github.com/serde-rs/json/compare/v1.0.99...v1.0.100 )
---
updated-dependencies:
- dependency-name: serde_json
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2023-07-05 15:57:54 +00:00
dependabot[bot]
aea8d1b8e7
cargo: bump regex from 1.8.4 to 1.9.0
...
Bumps [regex](https://github.com/rust-lang/regex ) from 1.8.4 to 1.9.0.
- [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.8.4...1.9.0 )
---
updated-dependencies:
- dependency-name: regex
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
2023-07-05 15:45:28 +00:00
dependabot[bot]
33ccd13caa
cargo: bump thiserror from 1.0.40 to 1.0.41
...
Bumps [thiserror](https://github.com/dtolnay/thiserror ) from 1.0.40 to 1.0.41.
- [Release notes](https://github.com/dtolnay/thiserror/releases )
- [Commits](https://github.com/dtolnay/thiserror/compare/1.0.40...1.0.41 )
---
updated-dependencies:
- dependency-name: thiserror
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2023-07-05 15:34:28 +00:00
dependabot[bot]
6208cdff2a
cargo: bump rustix from 0.38.2 to 0.38.3
...
Bumps [rustix](https://github.com/bytecodealliance/rustix ) from 0.38.2 to 0.38.3.
- [Release notes](https://github.com/bytecodealliance/rustix/releases )
- [Commits](https://github.com/bytecodealliance/rustix/compare/v0.38.2...v0.38.3 )
---
updated-dependencies:
- dependency-name: rustix
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2023-07-05 15:24:13 +00:00
Martin von Zweigbergk
651a3cbe15
rewrite: delete TODOs about labels for each term in a conflict
...
I don't think we'll want to record a label for each term, because such
labels would get stale, and it seems hard to make them make sense
after transferring a remote to another repo. I think we'll probably
want to infer labels on demand instead (#1176 ).
2023-07-05 16:50:27 +02:00
Ilya Grigoriev
597a74d51b
git fetch: limit export of deleted refs to provided globs
2023-07-03 11:01:22 -07:00
Ilya Grigoriev
371e7f46e2
git fetch: do a git export
of deleted branches before fetch
2023-07-03 11:01:22 -07:00
Ilya Grigoriev
fde3c3f581
git.rs: create export_some_refs
2023-07-03 11:01:22 -07:00
Ilya Grigoriev
a50cfec008
lib/git.rs: inline functions used only once, rename others
...
I now believe that jj will need to store git-tracking refs for both local and
remote-tracking branches of the git repo for the long term. See
https://github.com/martinvonz/jj/issues/1666#issuecomment-1597806451
More refactoring will likely happen when that bug is fixed.
2023-07-03 11:01:22 -07:00
Ilya Grigoriev
59b354992a
git export: export deletion of forgotten remote-tracking branches
2023-07-03 11:01:22 -07:00
Ilya Grigoriev
b6a9423f38
git export: (almost) no-op refactor to export_refs
to use RefName
...
This follows 3779b45
, but in this case the refactor makes the logic more
complicated. The main goal here is to prepare for the next commit.
2023-07-03 11:01:22 -07:00
dependabot[bot]
88736c7017
cargo: bump rustix from 0.38.0 to 0.38.2
...
Bumps [rustix](https://github.com/bytecodealliance/rustix ) from 0.38.0 to 0.38.2.
- [Release notes](https://github.com/bytecodealliance/rustix/releases )
- [Commits](https://github.com/bytecodealliance/rustix/compare/v0.38.0...v0.38.2 )
---
updated-dependencies:
- dependency-name: rustix
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2023-07-04 00:46:57 +09:00
Yuya Nishihara
061fbeb2f8
op_store: make RefTarget return removes/adds as slice, .clone() as needed
2023-07-02 14:39:45 +09:00
Waleed Khan
d1453a0c7c
cleanup: fix clippy lint
2023-07-01 18:10:32 -07:00
Yuya Nishihara
915f76f4d9
git: use RegexSet in place of concatenating multiple glob patterns
...
Perhaps, this would handle patterns like ["a(b", "c)"] better. It might not
be correct to error out on "(", but should be better than building wrong
regexp pattern "a(b|c)".
2023-07-02 09:49:07 +09:00
Yuya Nishihara
a07574a233
git: pass RefName enum to git_ref_filter callback
...
I think it's slightly better to compare each ref fragment than building
"refs/remotes/{remote}/{branch}" pattern to be matched.
2023-07-02 09:49:07 +09:00
Yuya Nishihara
da3c03206c
tree: remove useless pinning of Tree object
...
Since Tree is Unpin, Pin<Box<Tree>> can be moved and it's basically the same
as Box<Tree>. I heard using Box<T> still violates strict aliasing rule, but
Pin wouldn't give any additional guarantee.
https://morestina.net/blog/1868/self-referential-types-for-fun-and-profit
2023-07-01 17:56:00 +09:00
Martin von Zweigbergk
f32b67ac3d
tree: leverage Conflict::flatten()
etc
2023-06-30 14:43:58 +02:00
Martin von Zweigbergk
07dbc9fb0d
conflicts: add flatten()
for flattening nested conflicts
2023-06-30 14:43:58 +02:00
Martin von Zweigbergk
183021f559
conflicts: add try_map()
for Result
2023-06-30 14:43:58 +02:00
Martin von Zweigbergk
24c0190f74
conflicts: rename try_map()
to maybe_map()
...
I'm going to add a `Result` version and it makes more sense to call
that `try_map()`.
2023-06-30 14:43:58 +02:00
Martin von Zweigbergk
83fefa9a3b
conflicts: add a map()
, use in extract_as_single_hunk()
...
Now that we've replaced `MergeHunk` by a `Conflict`, it makes sense to
convert the input `Conflict<FileId>` by mapping each term. Unlike
`Option::map()` I made `Conflict::map()` take a reference `self`,
because it's not uncommon to want to map the same conflict multiple
times. I'm going to use that for producing a
`Conflict<Option<TreeValue>>` from a `Conflict<Tree>` and a set of
paths.
2023-06-30 14:43:58 +02:00
Martin von Zweigbergk
6bd13382f4
backend: add a function for setting or removing a tree entry
2023-06-30 14:43:58 +02:00
Martin von Zweigbergk
c0ffce781e
store: cache tree on write and return it
...
This matches what we do when writing commits.
2023-06-30 14:12:36 +02:00
Martin von Zweigbergk
b297c0c0d8
rewrite: propagate errors from merge_trees()
2023-06-30 14:12:36 +02:00
Martin von Zweigbergk
134efabcef
test_merge_trees: make merge_trees()
wrapper's signature match original
2023-06-30 14:12:36 +02:00
Kevin Liao
eac90fd113
Update init_external to return an error instead of unwrapping
2023-06-29 10:03:13 -07:00
dependabot[bot]
00d8cd740d
cargo: bump num_cpus from 1.15.0 to 1.16.0
...
Bumps [num_cpus](https://github.com/seanmonstar/num_cpus ) from 1.15.0 to 1.16.0.
- [Release notes](https://github.com/seanmonstar/num_cpus/releases )
- [Changelog](https://github.com/seanmonstar/num_cpus/blob/master/CHANGELOG.md )
- [Commits](https://github.com/seanmonstar/num_cpus/compare/v1.15.0...v1.16.0 )
---
updated-dependencies:
- dependency-name: num_cpus
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
2023-06-29 18:49:48 +02:00
Yuya Nishihara
7ad6357c10
revset: add union_all(...) helper to concatenate multiple -rREV options
2023-06-29 19:33:32 +09:00
dependabot[bot]
db87cb2c39
cargo: bump rustix from 0.37.20 to 0.38.0
...
Bumps [rustix](https://github.com/bytecodealliance/rustix ) from 0.37.20 to 0.38.0.
- [Release notes](https://github.com/bytecodealliance/rustix/releases )
- [Commits](https://github.com/bytecodealliance/rustix/compare/v0.37.20...v0.38.0 )
---
updated-dependencies:
- dependency-name: rustix
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
2023-06-28 22:16:49 +02:00
Yuya Nishihara
3779b45b94
git: use type-safe RefName enum extensively in import_some_refs()
...
I was thinking of adding GitRefName newtype, but the RefName type can serve
the same role.
2023-06-28 23:11:08 +09:00
Yuya Nishihara
1d9552406b
git: leverage parse_git_ref() to test reference kind
2023-06-28 23:11:08 +09:00
Martin von Zweigbergk
779b8ba318
files: replace uses of MergeHunk
by Conflict<ContentHunk>
...
Since `Conflict`s can represent the resolved state, so
`Conflict<ContentHunk>` can represent the states that we use
`MergeHunk` for. `MergeHunk` does force the user to handle the
resolved case, which may be useful. I suppose one could use the same
argument for making `Conflict` an enum, i.e. if we think that
`MergeHunk`'s two variants are beneficial, then we should consider
making `Conflict` an enum with those two variants.
2023-06-28 06:51:37 +02:00
Martin von Zweigbergk
c625e9352d
files: make MergeHunk::Conflict
be a Conflict<ContentHunk>
...
The `ConflictHunk` type doesn't add anything over
`Conflict<ContentHunk>`.
2023-06-27 21:06:32 +02:00
Martin von Zweigbergk
35e4d5f205
conflicts: add take()
, returning the removes and adds Vec
s
2023-06-27 21:06:32 +02:00
Martin von Zweigbergk
b1f2e80349
files: add a newtype around Vec<u8>
for content hunks
...
It's useful to have a more readable `Debug` format for `Vec<u8>`
(`"foo"` is better than `[102, 111, 111]`). It might also make types
in function signatures and elsewhere more readable.
2023-06-27 21:06:32 +02:00
Martin von Zweigbergk
b3946be414
conflicts: avoid unnecessary cloning of conflict content
2023-06-27 21:06:32 +02:00
Glen Choo
7afaa2487b
git: add .gitmodules parser
...
This only parses the fields relevant to us, i.e.:
- name: the stable identifier of the submodule
- path: the path to the submodule in the current commit
- url: the remote we can clone the submodule from
The full list of .gitmodules fields can be found at
https://git-scm.com/docs/gitmodules .
2023-06-27 10:07:00 -07:00