forked from mirrors/jj
Transaction: rename as_repo_mut() to mut_repo()
I think the `as_` prefix of `as_repo_mut()` makes it sound like it returns a view of the `Transaction`, but the `MutableRepo` is actually a part of it. Also, the convention seems to be to put the `mut_` in the name first if the function returns a name with a matching name (like `MutableRepo` does).
This commit is contained in:
parent
7ea0c6a868
commit
82c683bf63
2 changed files with 4 additions and 4 deletions
|
@ -484,7 +484,7 @@ pub fn evolve(
|
|||
// Resolving divergence can creates new orphans but not vice versa, so resolve
|
||||
// divergence first.
|
||||
let divergent_changes: Vec<_> = tx
|
||||
.as_repo_mut()
|
||||
.mut_repo()
|
||||
.evolution()
|
||||
.state
|
||||
.non_obsoletes_by_changeid
|
||||
|
@ -503,7 +503,7 @@ pub fn evolve(
|
|||
// Dom't reuse the state from above, since the divergence-resolution may have
|
||||
// created new orphans, or resolved existing orphans.
|
||||
let orphans: HashSet<Commit> = tx
|
||||
.as_repo_mut()
|
||||
.mut_repo()
|
||||
.evolution()
|
||||
.state
|
||||
.orphan_commits
|
||||
|
@ -533,7 +533,7 @@ pub fn evolve(
|
|||
let old_parents = orphan.parents();
|
||||
let mut new_parents = vec![];
|
||||
let mut ambiguous_new_parents = false;
|
||||
let evolution = tx.as_repo_mut().evolution();
|
||||
let evolution = tx.mut_repo().evolution();
|
||||
for old_parent in &old_parents {
|
||||
let new_parent_candidates = evolution.new_parent(old_parent.id());
|
||||
if new_parent_candidates.len() > 1 {
|
||||
|
|
|
@ -56,7 +56,7 @@ impl<'r> Transaction<'r> {
|
|||
self.repo.as_ref().unwrap().as_repo_ref()
|
||||
}
|
||||
|
||||
pub fn as_repo_mut(&mut self) -> &mut MutableRepo<'r> {
|
||||
pub fn mut_repo(&mut self) -> &mut MutableRepo<'r> {
|
||||
Arc::get_mut(self.repo.as_mut().unwrap()).unwrap()
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue