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

3585 commits

Author SHA1 Message Date
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
b3691e93fb cli_util: don't clone arguments when resolving default command 2023-07-06 11:39:16 +02:00
Martin von Zweigbergk
1094109dfb cli_util: avoid cloning args when resolving aliases 2023-07-06 11:39:16 +02: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
Martin von Zweigbergk
c93cbbee50 cli: remove author field from clap command
I'm not the only author, and it doesn't seem very useful to display
that information anyway (if it even appear anywhere).
2023-07-06 10:56:45 +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]
cf81de0484 cargo: bump clap from 4.3.10 to 4.3.11
Bumps [clap](https://github.com/clap-rs/clap) from 4.3.10 to 4.3.11.
- [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.3.10...v4.3.11)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-07-05 20:44:31 +00:00
dependabot[bot]
fc6a6f8e98 cargo: bump toml_edit from 0.19.11 to 0.19.12
Bumps [toml_edit](https://github.com/toml-rs/toml) from 0.19.11 to 0.19.12.
- [Commits](https://github.com/toml-rs/toml/compare/v0.19.11...v0.19.12)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-07-05 22:32:08 +02:00
dependabot[bot]
a5f62787a8 cargo: bump clap_complete from 4.3.1 to 4.3.2
Bumps [clap_complete](https://github.com/clap-rs/clap) from 4.3.1 to 4.3.2.
- [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.3.1...clap_complete-v4.3.2)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-07-05 22:30:10 +02: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
Martin von Zweigbergk
fa25c3bd40 github: tell Dependabot to group all deps when possible
This should reduce the number of PRs to review, and the number of
uninteresting commits in the repo history.
2023-07-05 21:37:22 +02:00
Martin von Zweigbergk
a9bbe40bb7 cargo: remove regex dev-dep duplicated from regular deps 2023-07-05 18:02:15 +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
dependabot[bot]
8b2b8d04cc cargo: bump serde from 1.0.165 to 1.0.166
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.165 to 1.0.166.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.165...v1.0.166)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-07-05 12:14:28 +00:00
Ilya Grigoriev
3d3c405e19 Fix cargo deny error
Ran `cargo update -p hermit-abi`.

See https://github.com/martinvonz/jj/actions/runs/5458721445/jobs/9934077589?pr=1790
2023-07-04 15:45:30 -07:00
Ilya Grigoriev
8645153946 undo: preserve git-tracking refs in colocated repos by default 2023-07-03 12:28:06 -07:00
Ilya Grigoriev
001db5a978 undo: optimization for restoring/preserving remote branches on undo 2023-07-03 12:28:06 -07:00
Ilya Grigoriev
63fe67bf74 undo: options to preserve git refs and/or remote-tracking branches on undo or restore 2023-07-03 12:28:06 -07:00
Ilya Grigoriev
e684010a68 test_git_import_export: no-op change to a test 2023-07-03 12:28:06 -07:00
Ilya Grigoriev
89651465d3 test_undo: three versions of the git_push_undo test
The original test is copied from @martinvonz 's [PR draft] (thanks!).

The three versions show differences in behavior due to import/export
of remote-tracking branches, and due to repo being colocated.

The former is relevant for [the discussion] of whether `jj git export` should
export remote-tracking branches. The latter will change in a follow-up commit.

Outstanding TODO: check if we have similar tests for undoing `fetch`

[PR draft]: https://github.com/martinvonz/jj/pull/1541
[the discussion]: https://github.com/martinvonz/jj/pull/1739
2023-07-03 12:28:06 -07:00
Ilya Grigoriev
51d61b6a20 test utilities: advance_test_rng_seed_to_multiple_of function 2023-07-03 12:28:06 -07: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]
706df8c2b5 cargo: bump serde from 1.0.164 to 1.0.165
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.164 to 1.0.165.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.164...v1.0.165)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-07-04 00:47:33 +09: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
Waleed Khan
4030a4fa81 docs: remove linebreak in installation command 2023-07-03 10:43:29 -05:00
Yuya Nishihara
d3c031b277 tests: add helper method to capture both stdout/stderr outputs
This pattern is common, and should have a shorthand so that we can easily
add warning messages.
2023-07-03 22:03:05 +09:00
Yuya Nishihara
cefbeba776 cli: add revset filter to "branch list"
Typical query would be something like -r 'mine()' or -r 'branches()' to
exclude remote-only branches #1136.

The query matches against local targets only. This means there's no way to
select deleted/forgotten branches by -r option. If we add a default revset
configuration, we'll need some way to turn the default off.
2023-07-02 14:39:45 +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
dependabot[bot]
0eddf7c80d cargo: bump clap from 4.3.9 to 4.3.10
Bumps [clap](https://github.com/clap-rs/clap) from 4.3.9 to 4.3.10.
- [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.3.9...v4.3.10)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-30 22:51:58 -07:00
Ilya Grigoriev
335e86d8e7 test_branch_command: use bare repositories
Otherwise, those tests cannot use `jj git push`. This is an issue with a test
in the next commit, and I don't want people to copy these tests and be surprised.
2023-06-30 21:29:24 -07:00
Ilya Grigoriev
333c348fb9 branch forget & delete: report if forgot/deleted multiple branches 2023-06-30 21:29:24 -07:00