forked from mirrors/jj
view: inline checkout()
into remaining few callers
This commit is contained in:
parent
9b275a406c
commit
f294df6e8e
3 changed files with 7 additions and 8 deletions
|
@ -40,11 +40,6 @@ impl View {
|
|||
}
|
||||
}
|
||||
|
||||
// TODO: Delete this function
|
||||
pub fn checkout(&self) -> &CommitId {
|
||||
self.get_checkout(&WorkspaceId::default()).unwrap()
|
||||
}
|
||||
|
||||
pub fn checkouts(&self) -> &HashMap<WorkspaceId, CommitId> {
|
||||
&self.data.checkouts
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use jujutsu_lib::op_store::WorkspaceId;
|
||||
use jujutsu_lib::settings::UserSettings;
|
||||
use jujutsu_lib::testutils;
|
||||
use jujutsu_lib::workspace::Workspace;
|
||||
|
@ -73,7 +74,7 @@ fn test_init_no_config_set(use_git: bool) {
|
|||
let settings = UserSettings::from_config(config::Config::new());
|
||||
let test_workspace = testutils::init_workspace(&settings, use_git);
|
||||
let repo = &test_workspace.repo;
|
||||
let checkout_id = repo.view().checkout();
|
||||
let checkout_id = repo.view().get_checkout(&WorkspaceId::default()).unwrap();
|
||||
let checkout_commit = repo.store().get_commit(checkout_id).unwrap();
|
||||
assert_eq!(
|
||||
checkout_commit.author().name,
|
||||
|
@ -100,7 +101,8 @@ fn test_init_checkout(use_git: bool) {
|
|||
let settings = testutils::user_settings();
|
||||
let test_workspace = testutils::init_workspace(&settings, use_git);
|
||||
let repo = &test_workspace.repo;
|
||||
let checkout_commit = repo.store().get_commit(repo.view().checkout()).unwrap();
|
||||
let checkout_id = repo.view().get_checkout(&WorkspaceId::default()).unwrap();
|
||||
let checkout_commit = repo.store().get_commit(checkout_id).unwrap();
|
||||
assert_eq!(checkout_commit.tree().id(), repo.store().empty_tree_id());
|
||||
assert_eq!(checkout_commit.store_commit().parents, vec![]);
|
||||
assert_eq!(checkout_commit.predecessors(), vec![]);
|
||||
|
|
|
@ -21,6 +21,7 @@ use std::sync::Arc;
|
|||
use itertools::Itertools;
|
||||
use jujutsu_lib::backend::{Conflict, ConflictPart, TreeValue};
|
||||
use jujutsu_lib::commit_builder::CommitBuilder;
|
||||
use jujutsu_lib::op_store::WorkspaceId;
|
||||
use jujutsu_lib::repo::ReadonlyRepo;
|
||||
use jujutsu_lib::repo_path::{RepoPath, RepoPathComponent};
|
||||
use jujutsu_lib::settings::UserSettings;
|
||||
|
@ -40,7 +41,8 @@ fn test_root(use_git: bool) {
|
|||
let mut locked_wc = wc.start_mutation();
|
||||
let new_tree_id = locked_wc.write_tree();
|
||||
locked_wc.discard();
|
||||
let checkout_commit = repo.store().get_commit(repo.view().checkout()).unwrap();
|
||||
let checkout_id = repo.view().get_checkout(&WorkspaceId::default()).unwrap();
|
||||
let checkout_commit = repo.store().get_commit(checkout_id).unwrap();
|
||||
assert_eq!(&new_tree_id, checkout_commit.tree().id());
|
||||
assert_eq!(&new_tree_id, repo.store().empty_tree_id());
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue