forked from mirrors/jj
Make CommitBuilder constructors private to the library crate
The implementation of `CommitBuilder::write` is tightly bound to the MutRepo, so only MutRepo should construct CommitBuilder-s.
This commit is contained in:
parent
6b862c6f23
commit
cde8ea8985
2 changed files with 6 additions and 2 deletions
|
@ -32,7 +32,8 @@ pub struct CommitBuilder<'repo> {
|
|||
}
|
||||
|
||||
impl CommitBuilder<'_> {
|
||||
pub fn for_new_commit<'repo>(
|
||||
// Use MutRepo::new_commit() instead
|
||||
pub(crate) fn for_new_commit<'repo>(
|
||||
mut_repo: &'repo mut MutableRepo,
|
||||
settings: &UserSettings,
|
||||
parents: Vec<CommitId>,
|
||||
|
@ -61,7 +62,8 @@ impl CommitBuilder<'_> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn for_rewrite_from<'repo>(
|
||||
// Use MutRepo::rewrite_commit() instead
|
||||
pub(crate) fn for_rewrite_from<'repo>(
|
||||
mut_repo: &'repo mut MutableRepo,
|
||||
settings: &UserSettings,
|
||||
predecessor: &Commit,
|
||||
|
|
|
@ -796,6 +796,8 @@ impl MutableRepo {
|
|||
predecessor: &Commit,
|
||||
) -> CommitBuilder {
|
||||
CommitBuilder::for_rewrite_from(self, settings, predecessor)
|
||||
// CommitBuilder::write will record the rewrite in
|
||||
// `self.rewritten_commits`
|
||||
}
|
||||
|
||||
pub fn write_commit(
|
||||
|
|
Loading…
Reference in a new issue