ok/jj
1
0
Fork 0
forked from mirrors/jj

view: rewrite set_branch() callers in tests, remove the method

I'm going to reorganize the underlying data structure, and set_branch() won't
be as simple as it is now.
This commit is contained in:
Yuya Nishihara 2023-10-06 01:49:16 +09:00
parent 7e7735e6b5
commit d840610bad
3 changed files with 2 additions and 16 deletions

View file

@ -983,10 +983,6 @@ impl MutableRepo {
self.view.with_ref(|v| v.get_branch(name).cloned())
}
pub fn set_branch(&mut self, name: String, target: BranchTarget) {
self.view_mut().set_branch(name, target);
}
pub fn remove_branch(&mut self, name: &str) {
self.view_mut().remove_branch(name);
}

View file

@ -152,10 +152,6 @@ impl View {
self.data.branches.get(name)
}
pub fn set_branch(&mut self, name: String, target: BranchTarget) {
self.data.branches.insert(name, target);
}
pub fn remove_branch(&mut self, name: &str) {
self.data.branches.remove(name);
}

View file

@ -26,7 +26,7 @@ use jj_lib::commit::Commit;
use jj_lib::git;
use jj_lib::git_backend::GitBackend;
use jj_lib::index::{HexPrefix, PrefixResolution};
use jj_lib::op_store::{BranchTarget, RefTarget, WorkspaceId};
use jj_lib::op_store::{RefTarget, WorkspaceId};
use jj_lib::repo::Repo;
use jj_lib::repo_path::RepoPath;
use jj_lib::revset::{
@ -2869,13 +2869,7 @@ fn test_no_such_revision_suggestion() {
let commit = write_random_commit(mut_repo, &settings);
for branch_name in ["foo", "bar", "baz"] {
mut_repo.set_branch(
branch_name.to_string(),
BranchTarget {
local_target: RefTarget::normal(commit.id().clone()),
remote_targets: Default::default(),
},
);
mut_repo.set_local_branch_target(branch_name, RefTarget::normal(commit.id().clone()));
}
assert_matches!(resolve_symbol(mut_repo, "bar"), Ok(_));