forked from mirrors/jj
testutils: create a function for writing a random commit to MutableRepo
We already have `create_random_commit()`, which returns a `CommitBuilder`. Most callers directly write that to a `MutableRepo`. That currently returns a `Commit`, but I'm about to make it propagate errors from the backend. That would add an `unwrap()` to this sequence, making it longer. Let's create a simple helper for these callers to simplify this common pattern.
This commit is contained in:
parent
49b2f3b6ca
commit
f1d7bbe508
12 changed files with 125 additions and 121 deletions
|
@ -18,7 +18,7 @@ use std::thread;
|
|||
use jujutsu_lib::dag_walk;
|
||||
use jujutsu_lib::repo::{ReadonlyRepo, StoreFactories};
|
||||
use test_case::test_case;
|
||||
use testutils::{create_random_commit, TestWorkspace};
|
||||
use testutils::{write_random_commit, TestWorkspace};
|
||||
|
||||
fn count_non_merge_operations(repo: &ReadonlyRepo) -> usize {
|
||||
let op_store = repo.op_store();
|
||||
|
@ -54,7 +54,7 @@ fn test_commit_parallel(use_git: bool) {
|
|||
let repo = repo.clone();
|
||||
let handle = thread::spawn(move || {
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
create_random_commit(tx.mut_repo(), &settings).write();
|
||||
write_random_commit(tx.mut_repo(), &settings);
|
||||
tx.commit();
|
||||
});
|
||||
threads.push(handle);
|
||||
|
@ -90,7 +90,7 @@ fn test_commit_parallel_instances(use_git: bool) {
|
|||
.unwrap();
|
||||
let handle = thread::spawn(move || {
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
create_random_commit(tx.mut_repo(), &settings).write();
|
||||
write_random_commit(tx.mut_repo(), &settings);
|
||||
tx.commit();
|
||||
});
|
||||
threads.push(handle);
|
||||
|
|
|
@ -27,7 +27,7 @@ use jujutsu_lib::repo::ReadonlyRepo;
|
|||
use jujutsu_lib::settings::UserSettings;
|
||||
use maplit::{btreemap, hashset};
|
||||
use tempfile::TempDir;
|
||||
use testutils::{create_random_commit, TestRepo};
|
||||
use testutils::{create_random_commit, write_random_commit, TestRepo};
|
||||
|
||||
fn empty_git_commit<'r>(
|
||||
git_repo: &'r git2::Repository,
|
||||
|
@ -536,7 +536,7 @@ fn test_export_refs_unborn_git_branch() {
|
|||
mut_repo.rebase_descendants(&test_data.settings).unwrap();
|
||||
assert_eq!(git::export_refs(mut_repo, &git_repo), Ok(vec![]));
|
||||
|
||||
let new_commit = create_random_commit(mut_repo, &test_data.settings).write();
|
||||
let new_commit = write_random_commit(mut_repo, &test_data.settings);
|
||||
mut_repo.set_local_branch(
|
||||
"main".to_string(),
|
||||
RefTarget::Normal(new_commit.id().clone()),
|
||||
|
@ -572,9 +572,9 @@ fn test_export_import_sequence() {
|
|||
.repo
|
||||
.start_transaction(&test_data.settings, "test");
|
||||
let mut_repo = tx.mut_repo();
|
||||
let commit_a = create_random_commit(mut_repo, &test_data.settings).write();
|
||||
let commit_b = create_random_commit(mut_repo, &test_data.settings).write();
|
||||
let commit_c = create_random_commit(mut_repo, &test_data.settings).write();
|
||||
let commit_a = write_random_commit(mut_repo, &test_data.settings);
|
||||
let commit_b = write_random_commit(mut_repo, &test_data.settings);
|
||||
let commit_c = write_random_commit(mut_repo, &test_data.settings);
|
||||
|
||||
// Import the branch pointing to A
|
||||
git_repo
|
||||
|
@ -622,9 +622,9 @@ fn test_export_conflicts() {
|
|||
.repo
|
||||
.start_transaction(&test_data.settings, "test");
|
||||
let mut_repo = tx.mut_repo();
|
||||
let commit_a = create_random_commit(mut_repo, &test_data.settings).write();
|
||||
let commit_b = create_random_commit(mut_repo, &test_data.settings).write();
|
||||
let commit_c = create_random_commit(mut_repo, &test_data.settings).write();
|
||||
let commit_a = write_random_commit(mut_repo, &test_data.settings);
|
||||
let commit_b = write_random_commit(mut_repo, &test_data.settings);
|
||||
let commit_c = write_random_commit(mut_repo, &test_data.settings);
|
||||
mut_repo.set_local_branch("main".to_string(), RefTarget::Normal(commit_a.id().clone()));
|
||||
mut_repo.set_local_branch(
|
||||
"feature".to_string(),
|
||||
|
@ -670,7 +670,7 @@ fn test_export_partial_failure() {
|
|||
.repo
|
||||
.start_transaction(&test_data.settings, "test");
|
||||
let mut_repo = tx.mut_repo();
|
||||
let commit_a = create_random_commit(mut_repo, &test_data.settings).write();
|
||||
let commit_a = write_random_commit(mut_repo, &test_data.settings);
|
||||
let target = RefTarget::Normal(commit_a.id().clone());
|
||||
// Empty string is disallowed by Git
|
||||
mut_repo.set_local_branch("".to_string(), target.clone());
|
||||
|
@ -723,9 +723,9 @@ fn test_export_reexport_transitions() {
|
|||
.repo
|
||||
.start_transaction(&test_data.settings, "test");
|
||||
let mut_repo = tx.mut_repo();
|
||||
let commit_a = create_random_commit(mut_repo, &test_data.settings).write();
|
||||
let commit_b = create_random_commit(mut_repo, &test_data.settings).write();
|
||||
let commit_c = create_random_commit(mut_repo, &test_data.settings).write();
|
||||
let commit_a = write_random_commit(mut_repo, &test_data.settings);
|
||||
let commit_b = write_random_commit(mut_repo, &test_data.settings);
|
||||
let commit_c = write_random_commit(mut_repo, &test_data.settings);
|
||||
// Create a few branches whose names indicate how they change in jj in git. The
|
||||
// first letter represents the branch's target in the last export. The second
|
||||
// letter represents the branch's target in jj. The third letter represents the
|
||||
|
@ -1229,7 +1229,7 @@ fn test_push_updates_not_fast_forward() {
|
|||
let temp_dir = testutils::new_temp_dir();
|
||||
let mut setup = set_up_push_repos(&settings, &temp_dir);
|
||||
let mut tx = setup.jj_repo.start_transaction(&settings, "test");
|
||||
let new_commit = create_random_commit(tx.mut_repo(), &settings).write();
|
||||
let new_commit = write_random_commit(tx.mut_repo(), &settings);
|
||||
setup.jj_repo = tx.commit();
|
||||
let result = git::push_updates(
|
||||
&setup.jj_repo.store().git_repo().unwrap(),
|
||||
|
@ -1250,7 +1250,7 @@ fn test_push_updates_not_fast_forward_with_force() {
|
|||
let temp_dir = testutils::new_temp_dir();
|
||||
let mut setup = set_up_push_repos(&settings, &temp_dir);
|
||||
let mut tx = setup.jj_repo.start_transaction(&settings, "test");
|
||||
let new_commit = create_random_commit(tx.mut_repo(), &settings).write();
|
||||
let new_commit = write_random_commit(tx.mut_repo(), &settings);
|
||||
setup.jj_repo = tx.commit();
|
||||
let result = git::push_updates(
|
||||
&setup.jj_repo.store().git_repo().unwrap(),
|
||||
|
|
|
@ -21,7 +21,7 @@ use jujutsu_lib::index::IndexRef;
|
|||
use jujutsu_lib::repo::{MutableRepo, ReadonlyRepo, StoreFactories};
|
||||
use jujutsu_lib::settings::UserSettings;
|
||||
use test_case::test_case;
|
||||
use testutils::{create_random_commit, CommitGraphBuilder, TestRepo};
|
||||
use testutils::{create_random_commit, write_random_commit, CommitGraphBuilder, TestRepo};
|
||||
|
||||
#[must_use]
|
||||
fn child_commit<'repo>(
|
||||
|
@ -439,7 +439,7 @@ fn create_n_commits(
|
|||
) -> Arc<ReadonlyRepo> {
|
||||
let mut tx = repo.start_transaction(settings, "test");
|
||||
for _ in 0..num_commits {
|
||||
create_random_commit(tx.mut_repo(), settings).write();
|
||||
write_random_commit(tx.mut_repo(), settings);
|
||||
}
|
||||
tx.commit()
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ use jujutsu_lib::op_store::WorkspaceId;
|
|||
use jujutsu_lib::settings::UserSettings;
|
||||
use jujutsu_lib::workspace::Workspace;
|
||||
use test_case::test_case;
|
||||
use testutils::{create_random_commit, TestWorkspace};
|
||||
use testutils::{write_random_commit, TestWorkspace};
|
||||
|
||||
fn canonicalize(input: &Path) -> (PathBuf, PathBuf) {
|
||||
let uncanonical = input.join("..").join(input.file_name().unwrap());
|
||||
|
@ -38,7 +38,7 @@ fn test_init_local() {
|
|||
|
||||
// Just test that we can write a commit to the store
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
create_random_commit(tx.mut_repo(), &settings).write();
|
||||
write_random_commit(tx.mut_repo(), &settings);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -53,7 +53,7 @@ fn test_init_internal_git() {
|
|||
|
||||
// Just test that we ca write a commit to the store
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
create_random_commit(tx.mut_repo(), &settings).write();
|
||||
write_random_commit(tx.mut_repo(), &settings);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -75,7 +75,7 @@ fn test_init_external_git() {
|
|||
|
||||
// Just test that we can write a commit to the store
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
create_random_commit(tx.mut_repo(), &settings).write();
|
||||
write_random_commit(tx.mut_repo(), &settings);
|
||||
}
|
||||
|
||||
#[test_case(false ; "local backend")]
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
use jujutsu_lib::repo::{RepoLoader, StoreFactories};
|
||||
use test_case::test_case;
|
||||
use testutils::{create_random_commit, TestRepo};
|
||||
use testutils::{write_random_commit, TestRepo};
|
||||
|
||||
#[test_case(false ; "local backend")]
|
||||
#[test_case(true ; "git backend")]
|
||||
|
@ -24,7 +24,7 @@ fn test_load_at_operation(use_git: bool) {
|
|||
let repo = &test_repo.repo;
|
||||
|
||||
let mut tx = repo.start_transaction(&settings, "add commit");
|
||||
let commit = create_random_commit(tx.mut_repo(), &settings).write();
|
||||
let commit = write_random_commit(tx.mut_repo(), &settings);
|
||||
let repo = tx.commit();
|
||||
|
||||
let mut tx = repo.start_transaction(&settings, "remove commit");
|
||||
|
|
|
@ -16,7 +16,9 @@ use jujutsu_lib::commit_builder::CommitBuilder;
|
|||
use jujutsu_lib::op_store::{RefTarget, WorkspaceId};
|
||||
use maplit::hashset;
|
||||
use test_case::test_case;
|
||||
use testutils::{assert_rebased, create_random_commit, CommitGraphBuilder, TestRepo};
|
||||
use testutils::{
|
||||
assert_rebased, create_random_commit, write_random_commit, CommitGraphBuilder, TestRepo,
|
||||
};
|
||||
|
||||
#[test_case(false ; "local backend")]
|
||||
#[test_case(true ; "git backend")]
|
||||
|
@ -27,7 +29,7 @@ fn test_edit(use_git: bool) {
|
|||
let repo = &test_repo.repo;
|
||||
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let wc_commit = create_random_commit(tx.mut_repo(), &settings).write();
|
||||
let wc_commit = write_random_commit(tx.mut_repo(), &settings);
|
||||
let repo = tx.commit();
|
||||
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
|
@ -46,7 +48,7 @@ fn test_checkout(use_git: bool) {
|
|||
let repo = &test_repo.repo;
|
||||
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let requested_checkout = create_random_commit(tx.mut_repo(), &settings).write();
|
||||
let requested_checkout = write_random_commit(tx.mut_repo(), &settings);
|
||||
let repo = tx.commit();
|
||||
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
|
@ -75,14 +77,14 @@ fn test_checkout_previous_not_empty(use_git: bool) {
|
|||
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut_repo = tx.mut_repo();
|
||||
let old_checkout = create_random_commit(mut_repo, &settings).write();
|
||||
let old_checkout = write_random_commit(mut_repo, &settings);
|
||||
let ws_id = WorkspaceId::default();
|
||||
mut_repo.edit(ws_id.clone(), &old_checkout).unwrap();
|
||||
let repo = tx.commit();
|
||||
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut_repo = tx.mut_repo();
|
||||
let new_checkout = create_random_commit(mut_repo, &settings).write();
|
||||
let new_checkout = write_random_commit(mut_repo, &settings);
|
||||
mut_repo.edit(ws_id, &new_checkout).unwrap();
|
||||
mut_repo.rebase_descendants(&settings).unwrap();
|
||||
assert!(mut_repo.view().heads().contains(old_checkout.id()));
|
||||
|
@ -112,7 +114,7 @@ fn test_checkout_previous_empty(use_git: bool) {
|
|||
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut_repo = tx.mut_repo();
|
||||
let new_wc_commit = create_random_commit(mut_repo, &settings).write();
|
||||
let new_wc_commit = write_random_commit(mut_repo, &settings);
|
||||
mut_repo.edit(ws_id, &new_wc_commit).unwrap();
|
||||
mut_repo.rebase_descendants(&settings).unwrap();
|
||||
assert!(!mut_repo.view().heads().contains(old_checkout.id()));
|
||||
|
@ -143,7 +145,7 @@ fn test_checkout_previous_empty_with_description(use_git: bool) {
|
|||
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut_repo = tx.mut_repo();
|
||||
let new_checkout = create_random_commit(mut_repo, &settings).write();
|
||||
let new_checkout = write_random_commit(mut_repo, &settings);
|
||||
mut_repo.edit(ws_id, &new_checkout).unwrap();
|
||||
mut_repo.rebase_descendants(&settings).unwrap();
|
||||
assert!(mut_repo.view().heads().contains(old_checkout.id()));
|
||||
|
@ -180,7 +182,7 @@ fn test_checkout_previous_empty_non_head(use_git: bool) {
|
|||
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut_repo = tx.mut_repo();
|
||||
let new_checkout = create_random_commit(mut_repo, &settings).write();
|
||||
let new_checkout = write_random_commit(mut_repo, &settings);
|
||||
mut_repo.edit(ws_id, &new_checkout).unwrap();
|
||||
mut_repo.rebase_descendants(&settings).unwrap();
|
||||
assert_eq!(
|
||||
|
@ -199,7 +201,7 @@ fn test_edit_initial(use_git: bool) {
|
|||
let repo = &test_repo.repo;
|
||||
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let checkout = create_random_commit(tx.mut_repo(), &settings).write();
|
||||
let checkout = write_random_commit(tx.mut_repo(), &settings);
|
||||
let repo = tx.commit();
|
||||
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
|
@ -224,7 +226,7 @@ fn test_add_head_success(use_git: bool) {
|
|||
// Create a commit outside of the repo by using a temporary transaction. Then
|
||||
// add that as a head.
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let new_commit = create_random_commit(tx.mut_repo(), &settings).write();
|
||||
let new_commit = write_random_commit(tx.mut_repo(), &settings);
|
||||
drop(tx);
|
||||
|
||||
let index_stats = repo.index().stats();
|
||||
|
@ -287,7 +289,7 @@ fn test_add_head_not_immediate_child(use_git: bool) {
|
|||
let repo = &test_repo.repo;
|
||||
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let initial = create_random_commit(tx.mut_repo(), &settings).write();
|
||||
let initial = write_random_commit(tx.mut_repo(), &settings);
|
||||
let repo = tx.commit();
|
||||
|
||||
// Create some commit outside of the repo by using a temporary transaction. Then
|
||||
|
@ -373,7 +375,7 @@ fn test_add_public_head(use_git: bool) {
|
|||
let repo = &test_repo.repo;
|
||||
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let commit1 = create_random_commit(tx.mut_repo(), &settings).write();
|
||||
let commit1 = write_random_commit(tx.mut_repo(), &settings);
|
||||
let repo = tx.commit();
|
||||
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
|
@ -421,7 +423,7 @@ fn test_remove_public_head(use_git: bool) {
|
|||
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut_repo = tx.mut_repo();
|
||||
let commit1 = create_random_commit(mut_repo, &settings).write();
|
||||
let commit1 = write_random_commit(mut_repo, &settings);
|
||||
mut_repo.add_public_head(&commit1);
|
||||
let repo = tx.commit();
|
||||
|
||||
|
@ -446,8 +448,8 @@ fn test_has_changed(use_git: bool) {
|
|||
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut_repo = tx.mut_repo();
|
||||
let commit1 = create_random_commit(mut_repo, &settings).write();
|
||||
let commit2 = create_random_commit(mut_repo, &settings).write();
|
||||
let commit1 = write_random_commit(mut_repo, &settings);
|
||||
let commit2 = write_random_commit(mut_repo, &settings);
|
||||
mut_repo.remove_head(commit2.id());
|
||||
mut_repo.add_public_head(&commit1);
|
||||
let ws_id = WorkspaceId::default();
|
||||
|
@ -610,7 +612,7 @@ fn test_rename_remote(use_git: bool) {
|
|||
let repo = &test_repo.repo;
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut_repo = tx.mut_repo();
|
||||
let commit = create_random_commit(mut_repo, &settings).write();
|
||||
let commit = write_random_commit(mut_repo, &settings);
|
||||
let target = RefTarget::Normal(commit.id().clone());
|
||||
mut_repo.set_remote_branch("main".to_string(), "origin".to_string(), target.clone());
|
||||
mut_repo.rename_remote("origin", "upstream");
|
||||
|
|
|
@ -18,7 +18,7 @@ use jujutsu_lib::backend::CommitId;
|
|||
use jujutsu_lib::commit_builder::CommitBuilder;
|
||||
use jujutsu_lib::repo::RepoRef;
|
||||
use test_case::test_case;
|
||||
use testutils::{create_random_commit, TestRepo};
|
||||
use testutils::{create_random_commit, write_random_commit, TestRepo};
|
||||
|
||||
fn list_dir(dir: &Path) -> Vec<String> {
|
||||
std::fs::read_dir(dir)
|
||||
|
@ -40,7 +40,7 @@ fn test_unpublished_operation(use_git: bool) {
|
|||
assert_eq!(list_dir(&op_heads_dir), vec![repo.op_id().hex()]);
|
||||
|
||||
let mut tx1 = repo.start_transaction(&settings, "transaction 1");
|
||||
create_random_commit(tx1.mut_repo(), &settings).write();
|
||||
write_random_commit(tx1.mut_repo(), &settings);
|
||||
let unpublished_op = tx1.write();
|
||||
let op_id1 = unpublished_op.operation().id().clone();
|
||||
assert_ne!(op_id1, op_id0);
|
||||
|
@ -63,14 +63,14 @@ fn test_consecutive_operations(use_git: bool) {
|
|||
assert_eq!(list_dir(&op_heads_dir), vec![repo.op_id().hex()]);
|
||||
|
||||
let mut tx1 = repo.start_transaction(&settings, "transaction 1");
|
||||
create_random_commit(tx1.mut_repo(), &settings).write();
|
||||
write_random_commit(tx1.mut_repo(), &settings);
|
||||
let op_id1 = tx1.commit().operation().id().clone();
|
||||
assert_ne!(op_id1, op_id0);
|
||||
assert_eq!(list_dir(&op_heads_dir), vec![op_id1.hex()]);
|
||||
|
||||
let repo = repo.reload_at_head(&settings).unwrap();
|
||||
let mut tx2 = repo.start_transaction(&settings, "transaction 2");
|
||||
create_random_commit(tx2.mut_repo(), &settings).write();
|
||||
write_random_commit(tx2.mut_repo(), &settings);
|
||||
let op_id2 = tx2.commit().operation().id().clone();
|
||||
assert_ne!(op_id2, op_id0);
|
||||
assert_ne!(op_id2, op_id1);
|
||||
|
@ -96,7 +96,7 @@ fn test_concurrent_operations(use_git: bool) {
|
|||
assert_eq!(list_dir(&op_heads_dir), vec![repo.op_id().hex()]);
|
||||
|
||||
let mut tx1 = repo.start_transaction(&settings, "transaction 1");
|
||||
create_random_commit(tx1.mut_repo(), &settings).write();
|
||||
write_random_commit(tx1.mut_repo(), &settings);
|
||||
let op_id1 = tx1.commit().operation().id().clone();
|
||||
assert_ne!(op_id1, op_id0);
|
||||
assert_eq!(list_dir(&op_heads_dir), vec![op_id1.hex()]);
|
||||
|
@ -104,7 +104,7 @@ fn test_concurrent_operations(use_git: bool) {
|
|||
// After both transactions have committed, we should have two op-heads on disk,
|
||||
// since they were run in parallel.
|
||||
let mut tx2 = repo.start_transaction(&settings, "transaction 2");
|
||||
create_random_commit(tx2.mut_repo(), &settings).write();
|
||||
write_random_commit(tx2.mut_repo(), &settings);
|
||||
let op_id2 = tx2.commit().operation().id().clone();
|
||||
assert_ne!(op_id2, op_id0);
|
||||
assert_ne!(op_id2, op_id1);
|
||||
|
|
|
@ -27,7 +27,9 @@ use jujutsu_lib::revset::{
|
|||
};
|
||||
use jujutsu_lib::workspace::Workspace;
|
||||
use test_case::test_case;
|
||||
use testutils::{create_random_commit, CommitGraphBuilder, TestRepo, TestWorkspace};
|
||||
use testutils::{
|
||||
create_random_commit, write_random_commit, CommitGraphBuilder, TestRepo, TestWorkspace,
|
||||
};
|
||||
|
||||
#[test_case(false ; "local backend")]
|
||||
#[test_case(true ; "git backend")]
|
||||
|
@ -288,8 +290,8 @@ fn test_resolve_symbol_checkout(use_git: bool) {
|
|||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut_repo = tx.mut_repo();
|
||||
|
||||
let commit1 = create_random_commit(mut_repo, &settings).write();
|
||||
let commit2 = create_random_commit(mut_repo, &settings).write();
|
||||
let commit1 = write_random_commit(mut_repo, &settings);
|
||||
let commit2 = write_random_commit(mut_repo, &settings);
|
||||
|
||||
let ws1 = WorkspaceId::new("ws1".to_string());
|
||||
let ws2 = WorkspaceId::new("ws2".to_string());
|
||||
|
@ -340,11 +342,11 @@ fn test_resolve_symbol_git_refs() {
|
|||
let mut_repo = tx.mut_repo();
|
||||
|
||||
// Create some commits and refs to work with and so the repo is not empty
|
||||
let commit1 = create_random_commit(mut_repo, &settings).write();
|
||||
let commit2 = create_random_commit(mut_repo, &settings).write();
|
||||
let commit3 = create_random_commit(mut_repo, &settings).write();
|
||||
let commit4 = create_random_commit(mut_repo, &settings).write();
|
||||
let commit5 = create_random_commit(mut_repo, &settings).write();
|
||||
let commit1 = write_random_commit(mut_repo, &settings);
|
||||
let commit2 = write_random_commit(mut_repo, &settings);
|
||||
let commit3 = write_random_commit(mut_repo, &settings);
|
||||
let commit4 = write_random_commit(mut_repo, &settings);
|
||||
let commit5 = write_random_commit(mut_repo, &settings);
|
||||
mut_repo.set_git_ref(
|
||||
"refs/heads/branch1".to_string(),
|
||||
RefTarget::Normal(commit1.id().clone()),
|
||||
|
@ -502,7 +504,7 @@ fn test_evaluate_expression_root_and_checkout(use_git: bool) {
|
|||
let mut_repo = tx.mut_repo();
|
||||
|
||||
let root_commit = repo.store().root_commit();
|
||||
let commit1 = create_random_commit(mut_repo, &settings).write();
|
||||
let commit1 = write_random_commit(mut_repo, &settings);
|
||||
|
||||
// Can find the root commit
|
||||
assert_eq!(
|
||||
|
@ -747,7 +749,7 @@ fn test_evaluate_expression_children(use_git: bool) {
|
|||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut_repo = tx.mut_repo();
|
||||
|
||||
let commit1 = create_random_commit(mut_repo, &settings).write();
|
||||
let commit1 = write_random_commit(mut_repo, &settings);
|
||||
let commit2 = create_random_commit(mut_repo, &settings)
|
||||
.set_parents(vec![commit1.id().clone()])
|
||||
.write();
|
||||
|
@ -1088,7 +1090,7 @@ fn test_evaluate_expression_descendants(use_git: bool) {
|
|||
let mut_repo = tx.mut_repo();
|
||||
|
||||
let root_commit_id = repo.store().root_commit_id().clone();
|
||||
let commit1 = create_random_commit(mut_repo, &settings).write();
|
||||
let commit1 = write_random_commit(mut_repo, &settings);
|
||||
let commit2 = create_random_commit(mut_repo, &settings)
|
||||
.set_parents(vec![commit1.id().clone()])
|
||||
.write();
|
||||
|
@ -1227,10 +1229,10 @@ fn test_evaluate_expression_git_refs(use_git: bool) {
|
|||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut_repo = tx.mut_repo();
|
||||
|
||||
let commit1 = create_random_commit(mut_repo, &settings).write();
|
||||
let commit2 = create_random_commit(mut_repo, &settings).write();
|
||||
let commit3 = create_random_commit(mut_repo, &settings).write();
|
||||
let commit4 = create_random_commit(mut_repo, &settings).write();
|
||||
let commit1 = write_random_commit(mut_repo, &settings);
|
||||
let commit2 = write_random_commit(mut_repo, &settings);
|
||||
let commit3 = write_random_commit(mut_repo, &settings);
|
||||
let commit4 = write_random_commit(mut_repo, &settings);
|
||||
|
||||
// Can get git refs when there are none
|
||||
assert_eq!(
|
||||
|
@ -1296,7 +1298,7 @@ fn test_evaluate_expression_git_head(use_git: bool) {
|
|||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut_repo = tx.mut_repo();
|
||||
|
||||
let commit1 = create_random_commit(mut_repo, &settings).write();
|
||||
let commit1 = write_random_commit(mut_repo, &settings);
|
||||
|
||||
// Can get git head when it's not set
|
||||
assert_eq!(
|
||||
|
@ -1320,10 +1322,10 @@ fn test_evaluate_expression_branches(use_git: bool) {
|
|||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut_repo = tx.mut_repo();
|
||||
|
||||
let commit1 = create_random_commit(mut_repo, &settings).write();
|
||||
let commit2 = create_random_commit(mut_repo, &settings).write();
|
||||
let commit3 = create_random_commit(mut_repo, &settings).write();
|
||||
let commit4 = create_random_commit(mut_repo, &settings).write();
|
||||
let commit1 = write_random_commit(mut_repo, &settings);
|
||||
let commit2 = write_random_commit(mut_repo, &settings);
|
||||
let commit3 = write_random_commit(mut_repo, &settings);
|
||||
let commit4 = write_random_commit(mut_repo, &settings);
|
||||
|
||||
// Can get branches when there are none
|
||||
assert_eq!(
|
||||
|
@ -1389,10 +1391,10 @@ fn test_evaluate_expression_remote_branches(use_git: bool) {
|
|||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut_repo = tx.mut_repo();
|
||||
|
||||
let commit1 = create_random_commit(mut_repo, &settings).write();
|
||||
let commit2 = create_random_commit(mut_repo, &settings).write();
|
||||
let commit3 = create_random_commit(mut_repo, &settings).write();
|
||||
let commit4 = create_random_commit(mut_repo, &settings).write();
|
||||
let commit1 = write_random_commit(mut_repo, &settings);
|
||||
let commit2 = write_random_commit(mut_repo, &settings);
|
||||
let commit3 = write_random_commit(mut_repo, &settings);
|
||||
let commit4 = write_random_commit(mut_repo, &settings);
|
||||
|
||||
// Can get branches when there are none
|
||||
assert_eq!(
|
||||
|
|
|
@ -18,7 +18,9 @@ use jujutsu_lib::repo_path::RepoPath;
|
|||
use jujutsu_lib::rewrite::DescendantRebaser;
|
||||
use maplit::{hashmap, hashset};
|
||||
use test_case::test_case;
|
||||
use testutils::{assert_rebased, create_random_commit, CommitGraphBuilder, TestRepo};
|
||||
use testutils::{
|
||||
assert_rebased, create_random_commit, write_random_commit, CommitGraphBuilder, TestRepo,
|
||||
};
|
||||
|
||||
#[test_case(false ; "local backend")]
|
||||
#[test_case(true ; "git backend")]
|
||||
|
@ -1277,7 +1279,7 @@ fn test_rebase_descendants_update_checkout(use_git: bool) {
|
|||
// |/
|
||||
// A
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let commit_a = create_random_commit(tx.mut_repo(), &settings).write();
|
||||
let commit_a = write_random_commit(tx.mut_repo(), &settings);
|
||||
let commit_b = create_random_commit(tx.mut_repo(), &settings)
|
||||
.set_parents(vec![commit_a.id().clone()])
|
||||
.write();
|
||||
|
@ -1323,7 +1325,7 @@ fn test_rebase_descendants_update_checkout_abandoned(use_git: bool) {
|
|||
// |
|
||||
// A
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let commit_a = create_random_commit(tx.mut_repo(), &settings).write();
|
||||
let commit_a = write_random_commit(tx.mut_repo(), &settings);
|
||||
let commit_b = create_random_commit(tx.mut_repo(), &settings)
|
||||
.set_parents(vec![commit_a.id().clone()])
|
||||
.write();
|
||||
|
@ -1376,7 +1378,7 @@ fn test_rebase_descendants_update_checkout_abandoned_merge(use_git: bool) {
|
|||
// |/
|
||||
// A
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let commit_a = create_random_commit(tx.mut_repo(), &settings).write();
|
||||
let commit_a = write_random_commit(tx.mut_repo(), &settings);
|
||||
let commit_b = create_random_commit(tx.mut_repo(), &settings)
|
||||
.set_parents(vec![commit_a.id().clone()])
|
||||
.write();
|
||||
|
|
|
@ -21,7 +21,7 @@ use jujutsu_lib::settings::UserSettings;
|
|||
use jujutsu_lib::transaction::Transaction;
|
||||
use maplit::{btreemap, hashset};
|
||||
use test_case::test_case;
|
||||
use testutils::{create_random_commit, CommitGraphBuilder, TestRepo};
|
||||
use testutils::{create_random_commit, write_random_commit, CommitGraphBuilder, TestRepo};
|
||||
|
||||
#[test_case(false ; "local backend")]
|
||||
#[test_case(true ; "git backend")]
|
||||
|
@ -89,14 +89,14 @@ fn test_merge_views_heads() {
|
|||
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut_repo = tx.mut_repo();
|
||||
let head_unchanged = create_random_commit(mut_repo, &settings).write();
|
||||
let head_remove_tx1 = create_random_commit(mut_repo, &settings).write();
|
||||
let head_remove_tx2 = create_random_commit(mut_repo, &settings).write();
|
||||
let public_head_unchanged = create_random_commit(mut_repo, &settings).write();
|
||||
let head_unchanged = write_random_commit(mut_repo, &settings);
|
||||
let head_remove_tx1 = write_random_commit(mut_repo, &settings);
|
||||
let head_remove_tx2 = write_random_commit(mut_repo, &settings);
|
||||
let public_head_unchanged = write_random_commit(mut_repo, &settings);
|
||||
mut_repo.add_public_head(&public_head_unchanged);
|
||||
let public_head_remove_tx1 = create_random_commit(mut_repo, &settings).write();
|
||||
let public_head_remove_tx1 = write_random_commit(mut_repo, &settings);
|
||||
mut_repo.add_public_head(&public_head_remove_tx1);
|
||||
let public_head_remove_tx2 = create_random_commit(mut_repo, &settings).write();
|
||||
let public_head_remove_tx2 = write_random_commit(mut_repo, &settings);
|
||||
mut_repo.add_public_head(&public_head_remove_tx2);
|
||||
let repo = tx.commit();
|
||||
|
||||
|
@ -104,8 +104,8 @@ fn test_merge_views_heads() {
|
|||
tx1.mut_repo().remove_head(head_remove_tx1.id());
|
||||
tx1.mut_repo()
|
||||
.remove_public_head(public_head_remove_tx1.id());
|
||||
let head_add_tx1 = create_random_commit(tx1.mut_repo(), &settings).write();
|
||||
let public_head_add_tx1 = create_random_commit(tx1.mut_repo(), &settings).write();
|
||||
let head_add_tx1 = write_random_commit(tx1.mut_repo(), &settings);
|
||||
let public_head_add_tx1 = write_random_commit(tx1.mut_repo(), &settings);
|
||||
tx1.mut_repo().add_public_head(&public_head_add_tx1);
|
||||
tx1.commit();
|
||||
|
||||
|
@ -113,8 +113,8 @@ fn test_merge_views_heads() {
|
|||
tx2.mut_repo().remove_head(head_remove_tx2.id());
|
||||
tx2.mut_repo()
|
||||
.remove_public_head(public_head_remove_tx2.id());
|
||||
let head_add_tx2 = create_random_commit(tx2.mut_repo(), &settings).write();
|
||||
let public_head_add_tx2 = create_random_commit(tx2.mut_repo(), &settings).write();
|
||||
let head_add_tx2 = write_random_commit(tx2.mut_repo(), &settings);
|
||||
let public_head_add_tx2 = write_random_commit(tx2.mut_repo(), &settings);
|
||||
tx2.mut_repo().add_public_head(&public_head_add_tx2);
|
||||
tx2.commit();
|
||||
|
||||
|
@ -155,9 +155,9 @@ fn test_merge_views_checkout() {
|
|||
// Workspace 6 gets added in tx1.
|
||||
// Workspace 7 gets added in tx2.
|
||||
let mut initial_tx = repo.start_transaction(&settings, "test");
|
||||
let commit1 = create_random_commit(initial_tx.mut_repo(), &settings).write();
|
||||
let commit2 = create_random_commit(initial_tx.mut_repo(), &settings).write();
|
||||
let commit3 = create_random_commit(initial_tx.mut_repo(), &settings).write();
|
||||
let commit1 = write_random_commit(initial_tx.mut_repo(), &settings);
|
||||
let commit2 = write_random_commit(initial_tx.mut_repo(), &settings);
|
||||
let commit3 = write_random_commit(initial_tx.mut_repo(), &settings);
|
||||
let ws1_id = WorkspaceId::new("ws1".to_string());
|
||||
let ws2_id = WorkspaceId::new("ws2".to_string());
|
||||
let ws3_id = WorkspaceId::new("ws3".to_string());
|
||||
|
@ -245,10 +245,10 @@ fn test_merge_views_branches() {
|
|||
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut_repo = tx.mut_repo();
|
||||
let main_branch_local_tx0 = create_random_commit(mut_repo, &settings).write();
|
||||
let main_branch_origin_tx0 = create_random_commit(mut_repo, &settings).write();
|
||||
let main_branch_origin_tx1 = create_random_commit(mut_repo, &settings).write();
|
||||
let main_branch_alternate_tx0 = create_random_commit(mut_repo, &settings).write();
|
||||
let main_branch_local_tx0 = write_random_commit(mut_repo, &settings);
|
||||
let main_branch_origin_tx0 = write_random_commit(mut_repo, &settings);
|
||||
let main_branch_origin_tx1 = write_random_commit(mut_repo, &settings);
|
||||
let main_branch_alternate_tx0 = write_random_commit(mut_repo, &settings);
|
||||
mut_repo.set_local_branch(
|
||||
"main".to_string(),
|
||||
RefTarget::Normal(main_branch_local_tx0.id().clone()),
|
||||
|
@ -263,7 +263,7 @@ fn test_merge_views_branches() {
|
|||
"alternate".to_string(),
|
||||
RefTarget::Normal(main_branch_alternate_tx0.id().clone()),
|
||||
);
|
||||
let feature_branch_local_tx0 = create_random_commit(mut_repo, &settings).write();
|
||||
let feature_branch_local_tx0 = write_random_commit(mut_repo, &settings);
|
||||
mut_repo.set_git_ref(
|
||||
"feature".to_string(),
|
||||
RefTarget::Normal(feature_branch_local_tx0.id().clone()),
|
||||
|
@ -271,7 +271,7 @@ fn test_merge_views_branches() {
|
|||
let repo = tx.commit();
|
||||
|
||||
let mut tx1 = repo.start_transaction(&settings, "test");
|
||||
let main_branch_local_tx1 = create_random_commit(tx1.mut_repo(), &settings).write();
|
||||
let main_branch_local_tx1 = write_random_commit(tx1.mut_repo(), &settings);
|
||||
tx1.mut_repo().set_local_branch(
|
||||
"main".to_string(),
|
||||
RefTarget::Normal(main_branch_local_tx1.id().clone()),
|
||||
|
@ -281,7 +281,7 @@ fn test_merge_views_branches() {
|
|||
"origin".to_string(),
|
||||
RefTarget::Normal(main_branch_origin_tx1.id().clone()),
|
||||
);
|
||||
let feature_branch_tx1 = create_random_commit(tx1.mut_repo(), &settings).write();
|
||||
let feature_branch_tx1 = write_random_commit(tx1.mut_repo(), &settings);
|
||||
tx1.mut_repo().set_local_branch(
|
||||
"feature".to_string(),
|
||||
RefTarget::Normal(feature_branch_tx1.id().clone()),
|
||||
|
@ -289,7 +289,7 @@ fn test_merge_views_branches() {
|
|||
tx1.commit();
|
||||
|
||||
let mut tx2 = repo.start_transaction(&settings, "test");
|
||||
let main_branch_local_tx2 = create_random_commit(tx2.mut_repo(), &settings).write();
|
||||
let main_branch_local_tx2 = write_random_commit(tx2.mut_repo(), &settings);
|
||||
tx2.mut_repo().set_local_branch(
|
||||
"main".to_string(),
|
||||
RefTarget::Normal(main_branch_local_tx2.id().clone()),
|
||||
|
@ -338,23 +338,23 @@ fn test_merge_views_tags() {
|
|||
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut_repo = tx.mut_repo();
|
||||
let v1_tx0 = create_random_commit(mut_repo, &settings).write();
|
||||
let v1_tx0 = write_random_commit(mut_repo, &settings);
|
||||
mut_repo.set_tag("v1.0".to_string(), RefTarget::Normal(v1_tx0.id().clone()));
|
||||
let v2_tx0 = create_random_commit(mut_repo, &settings).write();
|
||||
let v2_tx0 = write_random_commit(mut_repo, &settings);
|
||||
mut_repo.set_tag("v2.0".to_string(), RefTarget::Normal(v2_tx0.id().clone()));
|
||||
let repo = tx.commit();
|
||||
|
||||
let mut tx1 = repo.start_transaction(&settings, "test");
|
||||
let v1_tx1 = create_random_commit(tx1.mut_repo(), &settings).write();
|
||||
let v1_tx1 = write_random_commit(tx1.mut_repo(), &settings);
|
||||
tx1.mut_repo()
|
||||
.set_tag("v1.0".to_string(), RefTarget::Normal(v1_tx1.id().clone()));
|
||||
let v2_tx1 = create_random_commit(tx1.mut_repo(), &settings).write();
|
||||
let v2_tx1 = write_random_commit(tx1.mut_repo(), &settings);
|
||||
tx1.mut_repo()
|
||||
.set_tag("v2.0".to_string(), RefTarget::Normal(v2_tx1.id().clone()));
|
||||
tx1.commit();
|
||||
|
||||
let mut tx2 = repo.start_transaction(&settings, "test");
|
||||
let v1_tx2 = create_random_commit(tx2.mut_repo(), &settings).write();
|
||||
let v1_tx2 = write_random_commit(tx2.mut_repo(), &settings);
|
||||
tx2.mut_repo()
|
||||
.set_tag("v1.0".to_string(), RefTarget::Normal(v1_tx2.id().clone()));
|
||||
tx2.commit();
|
||||
|
@ -384,12 +384,12 @@ fn test_merge_views_git_refs() {
|
|||
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut_repo = tx.mut_repo();
|
||||
let main_branch_tx0 = create_random_commit(mut_repo, &settings).write();
|
||||
let main_branch_tx0 = write_random_commit(mut_repo, &settings);
|
||||
mut_repo.set_git_ref(
|
||||
"refs/heads/main".to_string(),
|
||||
RefTarget::Normal(main_branch_tx0.id().clone()),
|
||||
);
|
||||
let feature_branch_tx0 = create_random_commit(mut_repo, &settings).write();
|
||||
let feature_branch_tx0 = write_random_commit(mut_repo, &settings);
|
||||
mut_repo.set_git_ref(
|
||||
"refs/heads/feature".to_string(),
|
||||
RefTarget::Normal(feature_branch_tx0.id().clone()),
|
||||
|
@ -397,12 +397,12 @@ fn test_merge_views_git_refs() {
|
|||
let repo = tx.commit();
|
||||
|
||||
let mut tx1 = repo.start_transaction(&settings, "test");
|
||||
let main_branch_tx1 = create_random_commit(tx1.mut_repo(), &settings).write();
|
||||
let main_branch_tx1 = write_random_commit(tx1.mut_repo(), &settings);
|
||||
tx1.mut_repo().set_git_ref(
|
||||
"refs/heads/main".to_string(),
|
||||
RefTarget::Normal(main_branch_tx1.id().clone()),
|
||||
);
|
||||
let feature_branch_tx1 = create_random_commit(tx1.mut_repo(), &settings).write();
|
||||
let feature_branch_tx1 = write_random_commit(tx1.mut_repo(), &settings);
|
||||
tx1.mut_repo().set_git_ref(
|
||||
"refs/heads/feature".to_string(),
|
||||
RefTarget::Normal(feature_branch_tx1.id().clone()),
|
||||
|
@ -410,7 +410,7 @@ fn test_merge_views_git_refs() {
|
|||
tx1.commit();
|
||||
|
||||
let mut tx2 = repo.start_transaction(&settings, "test");
|
||||
let main_branch_tx2 = create_random_commit(tx2.mut_repo(), &settings).write();
|
||||
let main_branch_tx2 = write_random_commit(tx2.mut_repo(), &settings);
|
||||
tx2.mut_repo().set_git_ref(
|
||||
"refs/heads/main".to_string(),
|
||||
RefTarget::Normal(main_branch_tx2.id().clone()),
|
||||
|
@ -457,7 +457,7 @@ fn test_merge_views_divergent() {
|
|||
let test_repo = TestRepo::init(false);
|
||||
|
||||
let mut tx = test_repo.repo.start_transaction(&settings, "test");
|
||||
let commit_a = create_random_commit(tx.mut_repo(), &settings).write();
|
||||
let commit_a = write_random_commit(tx.mut_repo(), &settings);
|
||||
let repo = tx.commit();
|
||||
|
||||
let mut tx1 = repo.start_transaction(&settings, "test");
|
||||
|
@ -490,7 +490,7 @@ fn test_merge_views_child_on_rewritten(child_first: bool) {
|
|||
let test_repo = TestRepo::init(false);
|
||||
|
||||
let mut tx = test_repo.repo.start_transaction(&settings, "test");
|
||||
let commit_a = create_random_commit(tx.mut_repo(), &settings).write();
|
||||
let commit_a = write_random_commit(tx.mut_repo(), &settings);
|
||||
let repo = tx.commit();
|
||||
|
||||
let mut tx1 = repo.start_transaction(&settings, "test");
|
||||
|
@ -532,7 +532,7 @@ fn test_merge_views_child_on_rewritten_divergent(on_rewritten: bool, child_first
|
|||
let test_repo = TestRepo::init(false);
|
||||
|
||||
let mut tx = test_repo.repo.start_transaction(&settings, "test");
|
||||
let commit_a2 = create_random_commit(tx.mut_repo(), &settings).write();
|
||||
let commit_a2 = write_random_commit(tx.mut_repo(), &settings);
|
||||
let commit_a3 = create_random_commit(tx.mut_repo(), &settings)
|
||||
.set_change_id(commit_a2.change_id().clone())
|
||||
.write();
|
||||
|
@ -583,7 +583,7 @@ fn test_merge_views_child_on_abandoned(child_first: bool) {
|
|||
let test_repo = TestRepo::init(false);
|
||||
|
||||
let mut tx = test_repo.repo.start_transaction(&settings, "test");
|
||||
let commit_a = create_random_commit(tx.mut_repo(), &settings).write();
|
||||
let commit_a = write_random_commit(tx.mut_repo(), &settings);
|
||||
let commit_b = create_random_commit(tx.mut_repo(), &settings)
|
||||
.set_parents(vec![commit_a.id().clone()])
|
||||
.write();
|
||||
|
|
|
@ -32,7 +32,7 @@ use jujutsu_lib::settings::UserSettings;
|
|||
use jujutsu_lib::tree_builder::TreeBuilder;
|
||||
use jujutsu_lib::working_copy::WorkingCopy;
|
||||
use test_case::test_case;
|
||||
use testutils::{create_random_commit, TestWorkspace};
|
||||
use testutils::{write_random_commit, TestWorkspace};
|
||||
|
||||
#[test_case(false ; "local backend")]
|
||||
#[test_case(true ; "git backend")]
|
||||
|
@ -164,10 +164,7 @@ fn test_checkout_file_transitions(use_git: bool) {
|
|||
}
|
||||
Kind::GitSubmodule => {
|
||||
let mut tx = repo.start_transaction(settings, "test");
|
||||
let id = create_random_commit(tx.mut_repo(), settings)
|
||||
.write()
|
||||
.id()
|
||||
.clone();
|
||||
let id = write_random_commit(tx.mut_repo(), settings).id().clone();
|
||||
tx.commit();
|
||||
TreeValue::GitSubmodule(id)
|
||||
}
|
||||
|
@ -691,10 +688,7 @@ fn test_gitsubmodule() {
|
|||
);
|
||||
|
||||
let mut tx = repo.start_transaction(&settings, "create submodule commit");
|
||||
let submodule_id = create_random_commit(tx.mut_repo(), &settings)
|
||||
.write()
|
||||
.id()
|
||||
.clone();
|
||||
let submodule_id = write_random_commit(tx.mut_repo(), &settings).id().clone();
|
||||
tx.commit();
|
||||
|
||||
tree_builder.set(
|
||||
|
|
|
@ -224,6 +224,10 @@ pub fn create_random_commit<'repo>(
|
|||
.set_description(format!("random commit {number}"))
|
||||
}
|
||||
|
||||
pub fn write_random_commit(mut_repo: &mut MutableRepo, settings: &UserSettings) -> Commit {
|
||||
create_random_commit(mut_repo, settings).write()
|
||||
}
|
||||
|
||||
pub fn write_working_copy_file(workspace_root: &Path, path: &RepoPath, contents: &str) {
|
||||
let mut file = OpenOptions::new()
|
||||
.write(true)
|
||||
|
@ -248,7 +252,7 @@ impl<'settings, 'repo> CommitGraphBuilder<'settings, 'repo> {
|
|||
}
|
||||
|
||||
pub fn initial_commit(&mut self) -> Commit {
|
||||
create_random_commit(self.mut_repo, self.settings).write()
|
||||
write_random_commit(self.mut_repo, self.settings)
|
||||
}
|
||||
|
||||
pub fn commit_with_parents(&mut self, parents: &[&Commit]) -> Commit {
|
||||
|
|
Loading…
Reference in a new issue