Matt Stark
3f0a49dafe
Ensure you never drop the working commit with --skip-empty
...
See #2766 for discussions
2024-01-04 13:33:24 +11:00
Matt Stark
a4aed2391f
Rewrite instead of abandoning empty commits.
...
Fixes #2760
Given the tree:
```
A-B-C
\
B2
```
And the command `jj rebase -s B -d B2`
We were previously marking B as abandoned, despite the comment stating that we were marking it as being succeeded by B2. This resulted in a call to `rewrite(rewrites={}, abandoned={B})` instead of `rewrite(rewrites={B=>B2}, abandoned={})`, which then made the new parent of `C` into `A` instead of `B2`
2024-01-04 13:33:24 +11:00
Martin von Zweigbergk
5450e6c9ba
release: release version 0.13.0
...
Thanks to everyone who's contributed!
2024-01-03 18:05:30 -08:00
Yuya Nishihara
614b289ff5
docs: reorder and partially rewrite remote branches section to reflect changes
...
The <branch name>@<remote name> explanation is moved to the top because
otherwise it's uneasy to introduce a "tracking" concept.
2024-01-04 10:57:27 +09:00
dependabot[bot]
f71dc9e34a
cargo: bump the cargo-dependencies group with 1 update
...
Bumps the cargo-dependencies group with 1 update: [clap_complete](https://github.com/clap-rs/clap ).
Updates `clap_complete` from 4.4.5 to 4.4.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_complete-v4.4.5...clap_complete-v4.4.6 )
---
updated-dependencies:
- dependency-name: clap_complete
dependency-type: direct:production
update-type: version-update:semver-patch
dependency-group: cargo-dependencies
...
Signed-off-by: dependabot[bot] <support@github.com>
2024-01-03 16:02:07 +00:00
Philip Metzger
a6e1bc8309
docs: Add branch tracking to branches.md.
...
This tries to explain Jujutsu's branch tracking for a newcomer.
It is based on it's design doc in `docs/design/tracking-branches.md`.
2024-01-02 22:14:01 +01:00
dependabot[bot]
15cca8a3f1
cargo: bump the cargo-dependencies group with 6 updates
...
Bumps the cargo-dependencies group with 6 updates:
| Package | From | To |
| --- | --- | --- |
| [anyhow](https://github.com/dtolnay/anyhow ) | `1.0.78` | `1.0.79` |
| [async-trait](https://github.com/dtolnay/async-trait ) | `0.1.76` | `0.1.77` |
| [ref-cast](https://github.com/dtolnay/ref-cast ) | `1.0.21` | `1.0.22` |
| [serde](https://github.com/serde-rs/serde ) | `1.0.193` | `1.0.194` |
| [serde_json](https://github.com/serde-rs/json ) | `1.0.109` | `1.0.110` |
| [thiserror](https://github.com/dtolnay/thiserror ) | `1.0.53` | `1.0.56` |
Updates `anyhow` from 1.0.78 to 1.0.79
- [Release notes](https://github.com/dtolnay/anyhow/releases )
- [Commits](https://github.com/dtolnay/anyhow/compare/1.0.78...1.0.79 )
Updates `async-trait` from 0.1.76 to 0.1.77
- [Release notes](https://github.com/dtolnay/async-trait/releases )
- [Commits](https://github.com/dtolnay/async-trait/commits )
Updates `ref-cast` from 1.0.21 to 1.0.22
- [Release notes](https://github.com/dtolnay/ref-cast/releases )
- [Commits](https://github.com/dtolnay/ref-cast/compare/1.0.21...1.0.22 )
Updates `serde` from 1.0.193 to 1.0.194
- [Release notes](https://github.com/serde-rs/serde/releases )
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.193...v1.0.194 )
Updates `serde_json` from 1.0.109 to 1.0.110
- [Release notes](https://github.com/serde-rs/json/releases )
- [Commits](https://github.com/serde-rs/json/compare/v1.0.109...v1.0.110 )
Updates `thiserror` from 1.0.53 to 1.0.56
- [Release notes](https://github.com/dtolnay/thiserror/releases )
- [Commits](https://github.com/dtolnay/thiserror/compare/1.0.53...1.0.56 )
---
updated-dependencies:
- dependency-name: anyhow
dependency-type: direct:production
update-type: version-update:semver-patch
dependency-group: cargo-dependencies
- dependency-name: async-trait
dependency-type: direct:production
update-type: version-update:semver-patch
dependency-group: cargo-dependencies
- dependency-name: ref-cast
dependency-type: direct:production
update-type: version-update:semver-patch
dependency-group: cargo-dependencies
- dependency-name: serde
dependency-type: direct:production
update-type: version-update:semver-patch
dependency-group: cargo-dependencies
- dependency-name: serde_json
dependency-type: direct:production
update-type: version-update:semver-patch
dependency-group: cargo-dependencies
- dependency-name: thiserror
dependency-type: direct:production
update-type: version-update:semver-patch
dependency-group: cargo-dependencies
...
Signed-off-by: dependabot[bot] <support@github.com>
2024-01-02 10:53:56 -06:00
Ilya Grigoriev
6edaa97517
DescendantRebaser: change rebased()
method to into_map()
that consumes the rebaser
...
This prevents a clone and does not affect the public API, as suggested
in https://github.com/martinvonz/jj/pull/2738#discussion_r1438903463 .
2024-01-01 21:55:18 -08:00
Ilya Grigoriev
ddec3f91b2
lib: mild refactoring made possible by previous commit
...
Inline `create_descendant_commits`, move some functionality of
`DescendantRebaser::rebase_next` to `rebase_all`, a seemingly more logical
location.
2024-01-01 18:51:36 -08:00
Ilya Grigoriev
277b81ff6f
lib: make DescendantRebaser
-related APIs private.
...
Finally, there are no test uses of these APIs. `DescendantRebaser` is made
`pub(crate)`, since it is used by `MutRepo`. Other functions are made private.
2024-01-01 18:51:36 -08:00
Ilya Grigoriev
45cd0bf11b
test_rewrite.rs: stop using DescendantRebaser when testing EmptyBehavior
...
This completes the process of removing DescendantRebaser-related APIs from
tests. It requires creating some new test utils and a new
`rebase_descendants_with_option_return_map`.
2024-01-01 18:51:36 -08:00
Ilya Grigoriev
7cef879ef6
lib repo.rs
& rewrite.rs
: Move clearing of rewritten/abandoned commits
...
This commit is a little out of place in this sequence, but
it seems to make more sense for MutRepo to own these maps.
@yuja [pointed out] that any tests written using `create_descendant_rebaser` now
need to do this cleanup, but there are no longer any such tests after the
previous commits and a follow-up commit removes `create_descendant_rebaser`
entirely.
[pointed out]: https://github.com/martinvonz/jj/pull/2737#discussion_r1435754370
2024-01-01 18:51:36 -08:00
Ilya Grigoriev
4461d61254
test_rewrite: test branches of descendants of divergent commits
...
A TODO left over from a previous PR
2024-01-01 18:51:36 -08:00
Ilya Grigoriev
b2abba07e9
tests: (mostly) stop using soon-to-be-private DescendantRebaser-related APIs
...
This removes uses of `DescendantRebaser::new` or
`MutRepo::create_descendant_rebaser` from most tests. The exceptions are the
tests having to do with abandoning empty commits on rebase, since adjusting
those is a bit more elaborate (see follow-up commits).
2024-01-01 18:51:36 -08:00
Yuya Nishihara
3eafca65ea
op_walk: add support for op_id+ (children) operator
...
A possible use case is when doing some archaeology around a certain operation.
The current implementation is quadratic if + is repeated. Suppose op_id is
usually close to the current op heads, I think it'll practically work better
than building a reverse lookup table.
2024-01-02 10:30:08 +09:00
Yuya Nishihara
ab299a6af5
op_walk: reimplement prefix lookup by using walk_ancestors() and HexPrefix
...
Perhaps, OpStore should provide prefix resolution method, but let's think
that later.
2024-01-02 10:30:08 +09:00
Yuya Nishihara
c53748d732
op_walk: allow walk_ancestors() from more than one head operations
2024-01-02 10:30:08 +09:00
Yuya Nishihara
51691ea22c
tests: add lib tests for op id resolution, migrate some from cli
...
CLI testing is slow and harder to set up crafted environment.
2024-01-02 10:30:08 +09:00
Philip Metzger
c2973fdf9a
FAQ: Describe how to integrate with Gerrit.
...
This question is mildly popular on Discord so it's finally time to have an answer.
We should do something better in the future but the current solution is good enough for today.
cc @thoughtpolice
2024-01-01 21:08:19 +01:00
Yuya Nishihara
dad890b960
operation: make parent_ids() return slice instead of Vec reference
2024-01-02 02:47:41 +09:00
dependabot[bot]
5ff9376466
cargo: bump the cargo-dependencies group with 4 updates
...
Bumps the cargo-dependencies group with 4 updates: [anyhow](https://github.com/dtolnay/anyhow ), [async-trait](https://github.com/dtolnay/async-trait ), [serde_json](https://github.com/serde-rs/json ) and [thiserror](https://github.com/dtolnay/thiserror ).
Updates `anyhow` from 1.0.77 to 1.0.78
- [Release notes](https://github.com/dtolnay/anyhow/releases )
- [Commits](https://github.com/dtolnay/anyhow/compare/1.0.77...1.0.78 )
Updates `async-trait` from 0.1.75 to 0.1.76
- [Release notes](https://github.com/dtolnay/async-trait/releases )
- [Commits](https://github.com/dtolnay/async-trait/compare/0.1.75...0.1.76 )
Updates `serde_json` from 1.0.108 to 1.0.109
- [Release notes](https://github.com/serde-rs/json/releases )
- [Commits](https://github.com/serde-rs/json/compare/v1.0.108...v1.0.109 )
Updates `thiserror` from 1.0.52 to 1.0.53
- [Release notes](https://github.com/dtolnay/thiserror/releases )
- [Commits](https://github.com/dtolnay/thiserror/compare/1.0.52...1.0.53 )
---
updated-dependencies:
- dependency-name: anyhow
dependency-type: direct:production
update-type: version-update:semver-patch
dependency-group: cargo-dependencies
- dependency-name: async-trait
dependency-type: direct:production
update-type: version-update:semver-patch
dependency-group: cargo-dependencies
- dependency-name: serde_json
dependency-type: direct:production
update-type: version-update:semver-patch
dependency-group: cargo-dependencies
- dependency-name: thiserror
dependency-type: direct:production
update-type: version-update:semver-patch
dependency-group: cargo-dependencies
...
Signed-off-by: dependabot[bot] <support@github.com>
2024-01-01 09:04:48 -08:00
Yuya Nishihara
c9b581589c
op_walk: simplify arguments passed to high-level "opset" query functions
2024-01-01 10:22:23 +09:00
Yuya Nishihara
26b5f38f45
op_walk: move "opset" query functions from jj_cli
2024-01-01 10:22:23 +09:00
Yuya Nishihara
e4460d5386
op_walk: add error types for fake "opset" expression
...
This removes CommandError dependency from these resolution functions. We might
want to refactor the error types again if we introduce a real "opset" evaluator.
The error message for unresolved op heads now includes "@" instead of the whole
expression.
2024-01-01 10:22:23 +09:00
Yuya Nishihara
94fc32ab47
op_walk: extract walk_ancestors() to new module
...
I'm going to extract fake "opset" resolution functions there, and I think
walk_ancestors() belongs to the same category.
2024-01-01 10:22:23 +09:00
Yuya Nishihara
6dd936f72f
op_heads: let caller decide resolve_op_heads() error type
...
The resolver callback usually returns wider error type, which I don't think
is a variant of OpHeadResolutionError.
To help type inference, resolver's error type is E, not E1 where E: From<E1>.
2024-01-01 10:22:23 +09:00
Martin von Zweigbergk
0d02724341
cli: read files concurrently when diffing
...
Same reasoning as in the previous patch - this should help
high-latency backends.
2023-12-29 13:37:13 -08:00
Martin von Zweigbergk
90744fb770
working copy: read files ahead when updating
...
If the commit backend has high latency, it can make a big difference
to read files concurrently. This patch updates the working copy code
to do that in the update code (when reading files from the backend to
write to the working copy). Because our backend at Google reads files
from a local daemon process that already does a lot of prefetching,
this patch doesn't actually help us. I think it's still the right
thing to do for backends that don't do the same kind of
prefetching. It speeds up `jj sparse set --add` by >10x when I disable
the prefetching in our daemon (our `Backend::concurrency()` is 100).
2023-12-29 13:37:13 -08:00
dependabot[bot]
f0f57d438e
cargo: bump the cargo-dependencies group with 1 update
...
Bumps the cargo-dependencies group with 1 update: [clap](https://github.com/clap-rs/clap ).
Updates `clap` from 4.4.11 to 4.4.12
- [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.4.11...v4.4.12 )
---
updated-dependencies:
- dependency-name: clap
dependency-type: direct:production
update-type: version-update:semver-patch
dependency-group: cargo-dependencies
...
Signed-off-by: dependabot[bot] <support@github.com>
2023-12-29 10:39:36 -06:00
Yuya Nishihara
60c5e86fe1
cli: add missing copyright header to cli/src/commands/*.rs
2023-12-29 22:06:50 +09:00
Yuya Nishihara
f9e9058b9b
index: show bad operation id if commit lookup failed during reindexing
...
My jj repo contains such head commits, and "jj debug reindex" fails. To address
this problem, we'll probably need to implement GC, and the user will discard
operations before the first bad op id.
2023-12-29 13:05:58 +09:00
Yuya Nishihara
43e016a7d1
index: add explicit reindexing method that can propagate error
2023-12-29 13:05:58 +09:00
Yuya Nishihara
ab1c8656a4
index: rename private index_at_operation methods, reorder arguments
...
I'm going to add a public method that rebuilds index, and its return type will
be different. I also added "build_" because "index" could be misinterpreted
as noun.
The method arguments are reordered to follow the public IndexStore interface.
2023-12-29 13:05:58 +09:00
Yuya Nishihara
3abe6be384
index: propagate DefaultIndexStore::init/reinit() errors
2023-12-29 13:05:58 +09:00
Yuya Nishihara
955f6e356a
repo: add error propagation path to IndexStore initialization and loading
...
The error types are shared with the commit store backend. We could add per-store
error types, but it's unlikely that the caller needs to discriminate them.
2023-12-29 13:05:58 +09:00
Yuya Nishihara
bb73cd491f
clenaup: don't use debug format to embed ObjectId in error message
...
Also fixed typo, s/a/an/.
2023-12-29 13:05:58 +09:00
Martin von Zweigbergk
d06764eb7c
op heads: remove now-unused methods for adding/removing op heads
2023-12-28 09:17:42 -08:00
Martin von Zweigbergk
65a6aa61db
op heads: replace last use of remove_op_head() by update_op_heads()
2023-12-28 09:17:42 -08:00
Martin von Zweigbergk
76516bb46b
op heads: inline handle_ancestor_ops()
...
This gets us closer to being able to use the new `update_op_heads()`
function here (without calling it multiple times).
2023-12-28 09:17:42 -08:00
Martin von Zweigbergk
4221c7cf5c
op heads: remove handle_ancestor_ops() from trait
...
I think the idea behind `handle_ancestor_ops()` was to let our backend
at Google delegate the work to the server, which could then avoid
walking ancestors. However, we're now thinking that we're going to
make our server resolve divergent operations on its own instead, so
the client will never see more than one op head, unless it manually
creates the second op head itself (e.g. because the user ran two
concurrent commands). In those cases it should be fine to do the
walk. So let's simplify the trait by removing the function.
2023-12-28 09:17:42 -08:00
Martin von Zweigbergk
f969f4b0b0
op heads: remove lifetime from OpHeadsStoreLock
2023-12-28 09:17:42 -08:00
Martin von Zweigbergk
c304777a35
op heads: remove promote_new_op()
...
`OpHeadsStoreLock::promote_new_op()` doesn't add much over the new
`update_op_heads()`, so let's switch to the latter.
2023-12-28 09:17:42 -08:00
Martin von Zweigbergk
b8e45d196f
op heads: add a new trait method combining add and remove of op heads
...
Consider how one would implment the current `OpHeadsStore` interface
for a cloud-based backend. After `OpHeadsStore::add_op_head()` is
called, the set of op heads temporarily contains two heads (typically)
until `OpHeadsStore::remove_op_head()` is called. That's not invalid,
but it's annoying to have to deal with that state more than
necessary. Also, it's unnecessarily inefficient to send the addition
and removal of op heads as separate RPCs. This patch therefore adds a
`update_op_heads()` method that takes a list of old heads to remove
and a single new head to add. Coming patches will start migrating to
that method.
2023-12-28 09:17:42 -08:00
Martin von Zweigbergk
8137975785
op heads: drop support for old location/format
...
We move `.jj/repo/op_heads/*` into `.jj/repo/op_heads/heads/*` almost
a year ago, in commits 90a66ec262
and 37ba17589d
. We said we would
drop support for it in 0.9+. I think we said that before we started
doing monthly releases, but I we're still past the goal of 6 months
(which is what I think we were aiming for).
2023-12-28 09:17:42 -08:00
dependabot[bot]
49165d33ec
cargo: bump the cargo-dependencies group with 2 updates
...
Bumps the cargo-dependencies group with 2 updates: [clap_complete](https://github.com/clap-rs/clap ) and [tempfile](https://github.com/Stebalien/tempfile ).
Updates `clap_complete` from 4.4.4 to 4.4.5
- [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.4.4...clap_complete-v4.4.5 )
Updates `tempfile` from 3.8.1 to 3.9.0
- [Changelog](https://github.com/Stebalien/tempfile/blob/master/CHANGELOG.md )
- [Commits](https://github.com/Stebalien/tempfile/compare/v3.8.1...v3.9.0 )
---
updated-dependencies:
- dependency-name: clap_complete
dependency-type: direct:production
update-type: version-update:semver-patch
dependency-group: cargo-dependencies
- dependency-name: tempfile
dependency-type: direct:production
update-type: version-update:semver-minor
dependency-group: cargo-dependencies
...
Signed-off-by: dependabot[bot] <support@github.com>
2023-12-28 15:18:08 +00:00
dependabot[bot]
34668f135a
cargo: bump the cargo-dependencies group with 2 updates
...
Bumps the cargo-dependencies group with 2 updates: [anyhow](https://github.com/dtolnay/anyhow ) and [crossterm](https://github.com/crossterm-rs/crossterm ).
Updates `anyhow` from 1.0.76 to 1.0.77
- [Release notes](https://github.com/dtolnay/anyhow/releases )
- [Commits](https://github.com/dtolnay/anyhow/compare/1.0.76...1.0.77 )
Updates `crossterm` from 0.26.1 to 0.27.0
- [Release notes](https://github.com/crossterm-rs/crossterm/releases )
- [Changelog](https://github.com/crossterm-rs/crossterm/blob/master/CHANGELOG.md )
- [Commits](https://github.com/crossterm-rs/crossterm/compare/0.26.1...0.27.0 )
---
updated-dependencies:
- dependency-name: anyhow
dependency-type: direct:production
update-type: version-update:semver-patch
dependency-group: cargo-dependencies
- dependency-name: crossterm
dependency-type: direct:production
update-type: version-update:semver-minor
dependency-group: cargo-dependencies
...
Signed-off-by: dependabot[bot] <support@github.com>
2023-12-27 10:59:20 -06:00
Waleed Khan
88cc4daad3
merge_tools: upgrade to scm-record
v0.2.0
...
To get the fix at https://github.com/arxanas/git-branchless/pull/1013 "fix(record): don't add new files with no selected contents".
2023-12-26 19:25:02 -08:00
dependabot[bot]
2b2f647f1b
cargo: bump the cargo-dependencies group with 1 update
...
Bumps the cargo-dependencies group with 1 update: [thiserror](https://github.com/dtolnay/thiserror ).
Updates `thiserror` from 1.0.51 to 1.0.52
- [Release notes](https://github.com/dtolnay/thiserror/releases )
- [Commits](https://github.com/dtolnay/thiserror/compare/1.0.51...1.0.52 )
---
updated-dependencies:
- dependency-name: thiserror
dependency-type: direct:production
update-type: version-update:semver-patch
dependency-group: cargo-dependencies
...
Signed-off-by: dependabot[bot] <support@github.com>
2023-12-26 07:56:00 -08:00
dependabot[bot]
cc67294ef2
cargo: bump the cargo-dependencies group with 1 update
...
Bumps the cargo-dependencies group with 1 update: [futures](https://github.com/rust-lang/futures-rs ).
Updates `futures` from 0.3.29 to 0.3.30
- [Release notes](https://github.com/rust-lang/futures-rs/releases )
- [Changelog](https://github.com/rust-lang/futures-rs/blob/master/CHANGELOG.md )
- [Commits](https://github.com/rust-lang/futures-rs/compare/0.3.29...0.3.30 )
---
updated-dependencies:
- dependency-name: futures
dependency-type: direct:production
update-type: version-update:semver-patch
dependency-group: cargo-dependencies
...
Signed-off-by: dependabot[bot] <support@github.com>
2023-12-26 01:04:00 +09:00
Yuya Nishihara
dde42b9c05
index: rename resolve_prefix() to resolve_commit_id_prefix()
...
I'll probably add change id lookup methods to CompositeIndex. The Index trait
won't gain resolve_change_id_prefix(), but I also renamed its resolve_prefix()
for consistency.
2023-12-26 01:03:10 +09:00