Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor MutRepo to make DescendantRebaser private (pt 1) #2737

Merged
merged 4 commits into from
Dec 25, 2023

Conversation

ilyagr
Copy link
Contributor

@ilyagr ilyagr commented Dec 23, 2023

After this PR, the soon-to-be-internal APIs are used only in tests. The second part of this will be #2738.

The goal is to be able to more freely refactor DescendantRebaser after this. The new public API is not necessarily final or perfect, but should already be more manageable.

Checklist

If applicable:

  • I have updated CHANGELOG.md
  • I have updated the documentation (README.md, docs/, demos/)
  • I have updated the config schema (cli/src/config-schema.json)
  • I have added tests to cover my changes

@ilyagr ilyagr force-pushed the rm-descreb-api-pt1 branch 2 times, most recently from 9d63232 to d27cceb Compare December 23, 2023 04:49
@ilyagr ilyagr marked this pull request as ready for review December 23, 2023 04:51
@ilyagr ilyagr force-pushed the rm-descreb-api-pt1 branch from d27cceb to 0671d5e Compare December 23, 2023 04:52
lib/src/commit_builder.rs Show resolved Hide resolved
lib/src/repo.rs Outdated Show resolved Hide resolved
lib/src/rewrite.rs Outdated Show resolved Hide resolved
The implementation of `CommitBuilder::write` is tightly bound to the MutRepo,
so only MutRepo should construct CommitBuilder-s.
After this, the internal function is only used in tests.
At some point, I tried `new_commit` instead of `rewrite_commit` in the split
command. That seemed to work, but messed up the dates in a subtle way.

This commit should prevents repeats of this mistake and emphasize the
importance of the author dates being preserved.
@ilyagr ilyagr force-pushed the rm-descreb-api-pt1 branch 2 times, most recently from e82d7bc to 8a10afa Compare December 24, 2023 01:45
lib/src/repo.rs Show resolved Hide resolved
lib/src/rewrite.rs Outdated Show resolved Hide resolved
lib/src/repo.rs Outdated Show resolved Hide resolved
lib/src/rewrite.rs Outdated Show resolved Hide resolved
This requires creating a new public API as a substitute. I took the opportunity
to also add some comments to the
`MutRepo::record_rewritten_commit`/`record_abandoned_commit` functions.

I imade the simplest possible addition to the API; it is not a very elegant
one. Eventually, the entire `record_rewritten_commit` API should probably be
refactored again.

I also added some comments explaining what these functions do.
@ilyagr ilyagr force-pushed the rm-descreb-api-pt1 branch from 8a10afa to 8e8bcaf Compare December 25, 2023 02:24
@ilyagr
Copy link
Contributor Author

ilyagr commented Dec 25, 2023

I'll merge this and mark next PR as ready. We can clean anything up there or in follow-ups if necessary.

@ilyagr ilyagr merged commit 1fb9df2 into jj-vcs:main Dec 25, 2023
15 checks passed
@ilyagr ilyagr deleted the rm-descreb-api-pt1 branch December 25, 2023 03:25
ilyagr added a commit that referenced this pull request Jan 2, 2024
…mmits

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]: #2737 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants