ok/jj
1
0
Fork 0
forked from mirrors/jj
jj/lib/tests
Martin von Zweigbergk 96f5ca47d4 repo: add method for tranforming descendants, use in rebase_descendants()
There are several existing commands that would benefit from an API
that makes it easier to rewrite a whole graph of commits while
transforming them in some way.

`jj squash` is one example. When squashing into an ancestor, that
command currently rewrites the ancestor, then rebases descendants, and
then rewrites the rewritten source commit. It would be better to
rewrite the source commit (and any descendants) only once.

Another example is the future `jj fix`. That command will want to
rewrite a graph while updating the trees. There's currently no good
API for that; you have to manually iterate over descendants and
rewrite them.

This patch adds a new `MutableRepo::transform_descendants()` method
that takes a callback which gets a `CommitRewriter` passed to it. The
callback can then decide to change the parents, the tree, etc. The
callback is also free to leave the commit in place or to abandon it.

I updated the regular `rebase_descendants()` to use the new function
in order to exercise it. I hope we can replace all of the
`rebase_descendant_*()` flavors later.

I added a `replace_parent()` method that was a bit useful for the test
case. It could easily be hard-coded in the test case instead, but I
think the method will be useful for `jj git sync` and similar in the
future.
2024-04-18 21:06:52 -07:00
..
runner.rs repo: add method for tranforming descendants, use in rebase_descendants() 2024-04-18 21:06:52 -07:00
test_bad_locking.rs
test_commit_builder.rs object_id: make ObjectId constructors non-trait methods 2024-01-05 23:36:57 +09:00
test_commit_concurrent.rs op_store: add a virtual root operation, similar to root commit 2024-01-14 10:15:14 -08:00
test_conflicts.rs test_conflicts and test_resolve_command: use indoc! to indent conflict markers in tests 2024-03-22 23:27:25 -07:00
test_default_revset_graph_iterator.rs index: reorganize revset_graph_iterator as private module of default_index 2024-03-14 10:07:19 +09:00
test_diff_summary.rs
test_git.rs git: on fetch, pin visible untracked remote refs 2024-04-14 11:38:21 +09:00
test_git_backend.rs git_backend: on gc(), remove unreachable no-gc refs and compact them 2024-01-27 10:18:11 +09:00
test_gpg.rs gpg_signing: handle early termination of gpg command in verify path 2024-03-03 18:35:10 +09:00
test_id_prefix.rs
test_index.rs index: turn CompositeIndex into transparent reference type 2024-03-11 17:24:10 +09:00
test_init.rs
test_load_repo.rs
test_local_working_copy.rs working_copy: implement symlinks on windows with a helper function 2024-03-05 15:16:38 +08:00
test_local_working_copy_concurrent.rs
test_local_working_copy_sparse.rs
test_merge_trees.rs rewrite: pass just IDs of new parents into rewrite::rebase*() 2024-04-17 06:13:54 -07:00
test_merged_tree.rs clippy: new nightly fixes 2024-02-10 16:06:28 -08:00
test_mut_repo.rs repo: delete record_rewritten_commit() 2024-03-25 06:53:14 -07:00
test_operations.rs operation: add shorthand for .store_operation().metadata 2024-02-25 09:00:56 +09:00
test_refs.rs
test_revset.rs revset: migrate file() predicate to be based on FilesetExpression 2024-04-06 23:59:54 +09:00
test_rewrite.rs rewrite: pass CommitRewriter into rebase_commit_with_options() 2024-04-18 08:08:51 -07:00
test_rewrite_transform.rs repo: add method for tranforming descendants, use in rebase_descendants() 2024-04-18 21:06:52 -07:00
test_signing.rs
test_ssh_signing.rs sign: Add SSH backend tests 2024-02-20 00:02:08 +00:00
test_view.rs view: drop tracking of public heads 2024-01-13 22:23:57 -08:00
test_workspace.rs working_copy: add Send supertrait 2024-02-17 15:13:25 +08:00