forked from mirrors/jj
operations: make hostname and username configurable
We currently get the hostname and username from the `whoami` crate. We do that in lib crate, without giving the caller a way to override them. That seems wrong since it might be used in a server and performing operations on behalf of some other user. This commit makes the hostname and username configurable, so the calling crate can pass them in. If they have not been passed in, we still default to the values from the `whoami` crate.
This commit is contained in:
parent
12b2218a04
commit
9502d84872
23 changed files with 295 additions and 218 deletions
|
@ -54,6 +54,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
that is generally more convenient, and it reduces the risk of creating
|
||||
divergent commits.
|
||||
|
||||
* The username and hostname that appear in the operation log are now
|
||||
configurable via config options `operation.username` and `operation.hostname`.
|
||||
|
||||
### Fixed bugs
|
||||
|
||||
* (#463) A bug in the export of branches to Git caused spurious conflicted
|
||||
|
|
|
@ -137,7 +137,7 @@ impl ReadonlyRepo {
|
|||
let op_heads_path = repo_path.join("op_heads");
|
||||
fs::create_dir(&op_heads_path).context(&op_heads_path)?;
|
||||
let operation_metadata =
|
||||
crate::transaction::create_op_metadata("initialize repo".to_string());
|
||||
crate::transaction::create_op_metadata(user_settings, "initialize repo".to_string());
|
||||
let (op_heads_store, init_op) =
|
||||
OpHeadsStore::init(op_heads_path, &op_store, &root_view, operation_metadata);
|
||||
let op_heads_store = Arc::new(op_heads_store);
|
||||
|
@ -228,9 +228,13 @@ impl ReadonlyRepo {
|
|||
&self.settings
|
||||
}
|
||||
|
||||
pub fn start_transaction(self: &Arc<ReadonlyRepo>, description: &str) -> Transaction {
|
||||
pub fn start_transaction(
|
||||
self: &Arc<ReadonlyRepo>,
|
||||
user_settings: &UserSettings,
|
||||
description: &str,
|
||||
) -> Transaction {
|
||||
let mut_repo = MutableRepo::new(self.clone(), self.index().clone(), &self.view);
|
||||
Transaction::new(mut_repo, description)
|
||||
Transaction::new(mut_repo, user_settings, description)
|
||||
}
|
||||
|
||||
pub fn reload_at_head(
|
||||
|
@ -268,7 +272,7 @@ pub struct UnresolvedHeadRepo {
|
|||
impl UnresolvedHeadRepo {
|
||||
pub fn resolve(self, user_settings: &UserSettings) -> Result<Arc<ReadonlyRepo>, BackendError> {
|
||||
let base_repo = self.repo_loader.load_at(&self.op_heads[0]);
|
||||
let mut tx = base_repo.start_transaction("resolve concurrent operations");
|
||||
let mut tx = base_repo.start_transaction(user_settings, "resolve concurrent operations");
|
||||
for other_op_head in self.op_heads.into_iter().skip(1) {
|
||||
tx.merge_operation(other_op_head);
|
||||
tx.mut_repo().rebase_descendants(user_settings)?;
|
||||
|
|
|
@ -88,6 +88,18 @@ impl UserSettings {
|
|||
"(no email configured)"
|
||||
}
|
||||
|
||||
pub fn operation_hostname(&self) -> String {
|
||||
self.config
|
||||
.get_string("operation.hostname")
|
||||
.unwrap_or_else(|_| whoami::hostname())
|
||||
}
|
||||
|
||||
pub fn operation_username(&self) -> String {
|
||||
self.config
|
||||
.get_string("operation.username")
|
||||
.unwrap_or_else(|_| whoami::username())
|
||||
}
|
||||
|
||||
pub fn push_branch_prefix(&self) -> String {
|
||||
self.config
|
||||
.get_string("push.branch-prefix")
|
||||
|
|
|
@ -21,6 +21,7 @@ use crate::op_store;
|
|||
use crate::op_store::OperationMetadata;
|
||||
use crate::operation::Operation;
|
||||
use crate::repo::{MutableRepo, ReadonlyRepo, RepoLoader};
|
||||
use crate::settings::UserSettings;
|
||||
use crate::view::View;
|
||||
|
||||
pub struct Transaction {
|
||||
|
@ -30,9 +31,13 @@ pub struct Transaction {
|
|||
}
|
||||
|
||||
impl Transaction {
|
||||
pub fn new(mut_repo: MutableRepo, description: &str) -> Transaction {
|
||||
pub fn new(
|
||||
mut_repo: MutableRepo,
|
||||
user_settings: &UserSettings,
|
||||
description: &str,
|
||||
) -> Transaction {
|
||||
let parent_ops = vec![mut_repo.base_repo().operation().clone()];
|
||||
let op_metadata = create_op_metadata(description.to_string());
|
||||
let op_metadata = create_op_metadata(user_settings, description.to_string());
|
||||
Transaction {
|
||||
repo: Some(mut_repo),
|
||||
parent_ops,
|
||||
|
@ -113,11 +118,11 @@ impl Transaction {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn create_op_metadata(description: String) -> OperationMetadata {
|
||||
pub fn create_op_metadata(user_settings: &UserSettings, description: String) -> OperationMetadata {
|
||||
let start_time = Timestamp::now();
|
||||
let end_time = start_time.clone();
|
||||
let hostname = whoami::hostname();
|
||||
let username = whoami::username();
|
||||
let hostname = user_settings.operation_hostname();
|
||||
let username = user_settings.operation_username();
|
||||
OperationMetadata {
|
||||
start_time,
|
||||
end_time,
|
||||
|
|
|
@ -80,7 +80,10 @@ fn init_working_copy(
|
|||
let working_copy_state_path = jj_dir.join("working_copy");
|
||||
std::fs::create_dir(&working_copy_state_path).context(&working_copy_state_path)?;
|
||||
|
||||
let mut tx = repo.start_transaction(&format!("add workspace '{}'", workspace_id.as_str()));
|
||||
let mut tx = repo.start_transaction(
|
||||
user_settings,
|
||||
&format!("add workspace '{}'", workspace_id.as_str()),
|
||||
);
|
||||
tx.mut_repo().check_out(
|
||||
workspace_id.clone(),
|
||||
user_settings,
|
||||
|
|
|
@ -98,7 +98,7 @@ fn test_bad_locking_children(use_git: bool) {
|
|||
let repo = &test_workspace.repo;
|
||||
let workspace_root = test_workspace.workspace.workspace_root();
|
||||
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let initial = create_random_commit(&settings, repo)
|
||||
.set_parents(vec![repo.store().root_commit_id().clone()])
|
||||
.write_to_repo(tx.mut_repo());
|
||||
|
@ -118,7 +118,7 @@ fn test_bad_locking_children(use_git: bool) {
|
|||
.load_at_head()
|
||||
.resolve(&settings)
|
||||
.unwrap();
|
||||
let mut machine1_tx = machine1_repo.start_transaction("test");
|
||||
let mut machine1_tx = machine1_repo.start_transaction(&settings, "test");
|
||||
let child1 = create_random_commit(&settings, &machine1_repo)
|
||||
.set_parents(vec![initial.id().clone()])
|
||||
.write_to_repo(machine1_tx.mut_repo());
|
||||
|
@ -138,7 +138,7 @@ fn test_bad_locking_children(use_git: bool) {
|
|||
.load_at_head()
|
||||
.resolve(&settings)
|
||||
.unwrap();
|
||||
let mut machine2_tx = machine2_repo.start_transaction("test");
|
||||
let mut machine2_tx = machine2_repo.start_transaction(&settings, "test");
|
||||
let child2 = create_random_commit(&settings, &machine2_repo)
|
||||
.set_parents(vec![initial.id().clone()])
|
||||
.write_to_repo(machine2_tx.mut_repo());
|
||||
|
@ -177,7 +177,7 @@ fn test_bad_locking_interrupted(use_git: bool) {
|
|||
let test_workspace = TestWorkspace::init(&settings, use_git);
|
||||
let repo = &test_workspace.repo;
|
||||
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let initial = create_random_commit(&settings, repo)
|
||||
.set_parents(vec![repo.store().root_commit_id().clone()])
|
||||
.write_to_repo(tx.mut_repo());
|
||||
|
@ -190,7 +190,7 @@ fn test_bad_locking_interrupted(use_git: bool) {
|
|||
let op_heads_dir = repo.repo_path().join("op_heads");
|
||||
let backup_path = testutils::new_temp_dir();
|
||||
copy_directory(&op_heads_dir, backup_path.path());
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
create_random_commit(&settings, &repo)
|
||||
.set_parents(vec![initial.id().clone()])
|
||||
.write_to_repo(tx.mut_repo());
|
||||
|
|
|
@ -38,7 +38,7 @@ fn test_initial(use_git: bool) {
|
|||
],
|
||||
);
|
||||
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let commit = CommitBuilder::for_new_commit(
|
||||
&settings,
|
||||
vec![store.root_commit_id().clone()],
|
||||
|
@ -85,7 +85,7 @@ fn test_rewrite(use_git: bool) {
|
|||
],
|
||||
);
|
||||
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let initial_commit = CommitBuilder::for_new_commit(
|
||||
&settings,
|
||||
vec![store.root_commit_id().clone()],
|
||||
|
@ -110,7 +110,7 @@ fn test_rewrite(use_git: bool) {
|
|||
.build()
|
||||
.unwrap();
|
||||
let rewrite_settings = UserSettings::from_config(config);
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let rewritten_commit = CommitBuilder::for_rewrite_from(&rewrite_settings, &initial_commit)
|
||||
.set_tree(rewritten_tree.id().clone())
|
||||
.write_to_repo(tx.mut_repo());
|
||||
|
@ -164,7 +164,7 @@ fn test_rewrite_update_missing_user(use_git: bool) {
|
|||
let test_repo = TestRepo::init(use_git);
|
||||
let repo = &test_repo.repo;
|
||||
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&missing_user_settings, "test");
|
||||
let initial_commit = CommitBuilder::for_new_commit(
|
||||
&missing_user_settings,
|
||||
vec![repo.store().root_commit_id().clone()],
|
||||
|
@ -207,7 +207,7 @@ fn test_commit_builder_descendants(use_git: bool) {
|
|||
let repo = &test_repo.repo;
|
||||
let store = repo.store().clone();
|
||||
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut graph_builder = CommitGraphBuilder::new(&settings, tx.mut_repo());
|
||||
let commit1 = graph_builder.initial_commit();
|
||||
let commit2 = graph_builder.commit_with_parents(&[&commit1]);
|
||||
|
@ -215,7 +215,7 @@ fn test_commit_builder_descendants(use_git: bool) {
|
|||
let repo = tx.commit();
|
||||
|
||||
// Test with for_new_commit()
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
CommitBuilder::for_new_commit(
|
||||
&settings,
|
||||
vec![store.root_commit_id().clone()],
|
||||
|
@ -226,14 +226,14 @@ fn test_commit_builder_descendants(use_git: bool) {
|
|||
assert!(rebaser.rebase_next().unwrap().is_none());
|
||||
|
||||
// Test with for_rewrite_from()
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let commit4 = CommitBuilder::for_rewrite_from(&settings, &commit2).write_to_repo(tx.mut_repo());
|
||||
let mut rebaser = tx.mut_repo().create_descendant_rebaser(&settings);
|
||||
assert_rebased(rebaser.rebase_next().unwrap(), &commit3, &[&commit4]);
|
||||
assert!(rebaser.rebase_next().unwrap().is_none());
|
||||
|
||||
// Test with for_rewrite_from() but new change id
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
CommitBuilder::for_rewrite_from(&settings, &commit2)
|
||||
.generate_new_change_id()
|
||||
.write_to_repo(tx.mut_repo());
|
||||
|
|
|
@ -53,7 +53,7 @@ fn test_commit_parallel(use_git: bool) {
|
|||
let settings = settings.clone();
|
||||
let repo = repo.clone();
|
||||
let handle = thread::spawn(move || {
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
create_random_commit(&settings, &repo).write_to_repo(tx.mut_repo());
|
||||
tx.commit();
|
||||
});
|
||||
|
@ -89,7 +89,7 @@ fn test_commit_parallel_instances(use_git: bool) {
|
|||
ReadonlyRepo::load_at_head(&settings, repo.repo_path(), &BackendFactories::default())
|
||||
.unwrap();
|
||||
let handle = thread::spawn(move || {
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
create_random_commit(&settings, &repo).write_to_repo(tx.mut_repo());
|
||||
tx.commit();
|
||||
});
|
||||
|
|
|
@ -77,7 +77,7 @@ fn test_import_refs() {
|
|||
git_repo.set_head("refs/heads/main").unwrap();
|
||||
|
||||
let git_repo = repo.store().git_repo().unwrap();
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
git::import_refs(tx.mut_repo(), &git_repo).unwrap();
|
||||
tx.mut_repo().rebase_descendants(&settings).unwrap();
|
||||
let repo = tx.commit();
|
||||
|
@ -163,7 +163,7 @@ fn test_import_refs_reimport() {
|
|||
.reference("refs/tags/my-gpg-key", pgp_key_oid, false, "")
|
||||
.unwrap();
|
||||
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
git::import_refs(tx.mut_repo(), &git_repo).unwrap();
|
||||
tx.mut_repo().rebase_descendants(&settings).unwrap();
|
||||
let repo = tx.commit();
|
||||
|
@ -174,7 +174,7 @@ fn test_import_refs_reimport() {
|
|||
let commit5 = empty_git_commit(&git_repo, "refs/heads/feature2", &[&commit2]);
|
||||
|
||||
// Also modify feature2 on the jj side
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let commit6 = create_random_commit(&settings, &repo)
|
||||
.set_parents(vec![jj_id(&commit2)])
|
||||
.write_to_repo(tx.mut_repo());
|
||||
|
@ -184,7 +184,7 @@ fn test_import_refs_reimport() {
|
|||
);
|
||||
let repo = tx.commit();
|
||||
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
git::import_refs(tx.mut_repo(), &git_repo).unwrap();
|
||||
tx.mut_repo().rebase_descendants(&settings).unwrap();
|
||||
let repo = tx.commit();
|
||||
|
@ -248,7 +248,7 @@ fn test_import_refs_reimport_head_removed() {
|
|||
let git_repo = repo.store().git_repo().unwrap();
|
||||
|
||||
let commit = empty_git_commit(&git_repo, "refs/heads/main", &[]);
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
git::import_refs(tx.mut_repo(), &git_repo).unwrap();
|
||||
tx.mut_repo().rebase_descendants(&settings).unwrap();
|
||||
let commit_id = jj_id(&commit);
|
||||
|
@ -274,7 +274,7 @@ fn test_import_refs_reimport_git_head_counts() {
|
|||
let commit = empty_git_commit(&git_repo, "refs/heads/main", &[]);
|
||||
git_repo.set_head_detached(commit.id()).unwrap();
|
||||
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
git::import_refs(tx.mut_repo(), &git_repo).unwrap();
|
||||
tx.mut_repo().rebase_descendants(&settings).unwrap();
|
||||
|
||||
|
@ -300,7 +300,7 @@ fn test_import_refs_reimport_all_from_root_removed() {
|
|||
let git_repo = repo.store().git_repo().unwrap();
|
||||
|
||||
let commit = empty_git_commit(&git_repo, "refs/heads/main", &[]);
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
git::import_refs(tx.mut_repo(), &git_repo).unwrap();
|
||||
tx.mut_repo().rebase_descendants(&settings).unwrap();
|
||||
// Test the setup
|
||||
|
@ -362,7 +362,9 @@ impl GitRepoData {
|
|||
fn test_import_refs_empty_git_repo() {
|
||||
let test_data = GitRepoData::create();
|
||||
let heads_before = test_data.repo.view().heads().clone();
|
||||
let mut tx = test_data.repo.start_transaction("test");
|
||||
let mut tx = test_data
|
||||
.repo
|
||||
.start_transaction(&test_data.settings, "test");
|
||||
git::import_refs(tx.mut_repo(), &test_data.git_repo).unwrap();
|
||||
tx.mut_repo()
|
||||
.rebase_descendants(&test_data.settings)
|
||||
|
@ -389,7 +391,9 @@ fn test_import_refs_detached_head() {
|
|||
.unwrap();
|
||||
test_data.git_repo.set_head_detached(commit1.id()).unwrap();
|
||||
|
||||
let mut tx = test_data.repo.start_transaction("test");
|
||||
let mut tx = test_data
|
||||
.repo
|
||||
.start_transaction(&test_data.settings, "test");
|
||||
git::import_refs(tx.mut_repo(), &test_data.git_repo).unwrap();
|
||||
tx.mut_repo()
|
||||
.rebase_descendants(&test_data.settings)
|
||||
|
@ -410,7 +414,9 @@ fn test_export_refs_no_detach() {
|
|||
let git_repo = test_data.git_repo;
|
||||
let commit1 = empty_git_commit(&git_repo, "refs/heads/main", &[]);
|
||||
git_repo.set_head("refs/heads/main").unwrap();
|
||||
let mut tx = test_data.repo.start_transaction("test");
|
||||
let mut tx = test_data
|
||||
.repo
|
||||
.start_transaction(&test_data.settings, "test");
|
||||
let mut_repo = tx.mut_repo();
|
||||
git::import_refs(mut_repo, &git_repo).unwrap();
|
||||
mut_repo.rebase_descendants(&test_data.settings).unwrap();
|
||||
|
@ -436,7 +442,9 @@ fn test_export_refs_no_op() {
|
|||
let commit1 = empty_git_commit(&git_repo, "refs/heads/main", &[]);
|
||||
git_repo.set_head("refs/heads/main").unwrap();
|
||||
|
||||
let mut tx = test_data.repo.start_transaction("test");
|
||||
let mut tx = test_data
|
||||
.repo
|
||||
.start_transaction(&test_data.settings, "test");
|
||||
let mut_repo = tx.mut_repo();
|
||||
git::import_refs(mut_repo, &git_repo).unwrap();
|
||||
mut_repo.rebase_descendants(&test_data.settings).unwrap();
|
||||
|
@ -470,7 +478,9 @@ fn test_export_refs_branch_changed() {
|
|||
.unwrap();
|
||||
git_repo.set_head("refs/heads/feature").unwrap();
|
||||
|
||||
let mut tx = test_data.repo.start_transaction("test");
|
||||
let mut tx = test_data
|
||||
.repo
|
||||
.start_transaction(&test_data.settings, "test");
|
||||
let mut_repo = tx.mut_repo();
|
||||
git::import_refs(mut_repo, &git_repo).unwrap();
|
||||
mut_repo.rebase_descendants(&test_data.settings).unwrap();
|
||||
|
@ -511,7 +521,9 @@ fn test_export_refs_current_branch_changed() {
|
|||
let git_repo = test_data.git_repo;
|
||||
let commit1 = empty_git_commit(&git_repo, "refs/heads/main", &[]);
|
||||
git_repo.set_head("refs/heads/main").unwrap();
|
||||
let mut tx = test_data.repo.start_transaction("test");
|
||||
let mut tx = test_data
|
||||
.repo
|
||||
.start_transaction(&test_data.settings, "test");
|
||||
let mut_repo = tx.mut_repo();
|
||||
git::import_refs(mut_repo, &git_repo).unwrap();
|
||||
mut_repo.rebase_descendants(&test_data.settings).unwrap();
|
||||
|
@ -547,7 +559,9 @@ fn test_export_refs_unborn_git_branch() {
|
|||
let test_data = GitRepoData::create();
|
||||
let git_repo = test_data.git_repo;
|
||||
git_repo.set_head("refs/heads/main").unwrap();
|
||||
let mut tx = test_data.repo.start_transaction("test");
|
||||
let mut tx = test_data
|
||||
.repo
|
||||
.start_transaction(&test_data.settings, "test");
|
||||
let mut_repo = tx.mut_repo();
|
||||
git::import_refs(mut_repo, &git_repo).unwrap();
|
||||
mut_repo.rebase_descendants(&test_data.settings).unwrap();
|
||||
|
@ -586,7 +600,9 @@ fn test_export_import_sequence() {
|
|||
// conflict.
|
||||
let test_data = GitRepoData::create();
|
||||
let git_repo = test_data.git_repo;
|
||||
let mut tx = test_data.repo.start_transaction("test");
|
||||
let mut tx = test_data
|
||||
.repo
|
||||
.start_transaction(&test_data.settings, "test");
|
||||
let mut_repo = tx.mut_repo();
|
||||
let commit_a =
|
||||
create_random_commit(&test_data.settings, &test_data.repo).write_to_repo(mut_repo);
|
||||
|
@ -637,7 +653,9 @@ fn test_export_conflicts() {
|
|||
// We skip export of conflicted branches
|
||||
let test_data = GitRepoData::create();
|
||||
let git_repo = test_data.git_repo;
|
||||
let mut tx = test_data.repo.start_transaction("test");
|
||||
let mut tx = test_data
|
||||
.repo
|
||||
.start_transaction(&test_data.settings, "test");
|
||||
let mut_repo = tx.mut_repo();
|
||||
let commit_a =
|
||||
create_random_commit(&test_data.settings, &test_data.repo).write_to_repo(mut_repo);
|
||||
|
@ -703,7 +721,9 @@ fn test_init() {
|
|||
fn test_fetch_empty_repo() {
|
||||
let test_data = GitRepoData::create();
|
||||
|
||||
let mut tx = test_data.repo.start_transaction("test");
|
||||
let mut tx = test_data
|
||||
.repo
|
||||
.start_transaction(&test_data.settings, "test");
|
||||
let default_branch = git::fetch(
|
||||
tx.mut_repo(),
|
||||
&test_data.git_repo,
|
||||
|
@ -722,7 +742,9 @@ fn test_fetch_initial_commit() {
|
|||
let test_data = GitRepoData::create();
|
||||
let initial_git_commit = empty_git_commit(&test_data.origin_repo, "refs/heads/main", &[]);
|
||||
|
||||
let mut tx = test_data.repo.start_transaction("test");
|
||||
let mut tx = test_data
|
||||
.repo
|
||||
.start_transaction(&test_data.settings, "test");
|
||||
let default_branch = git::fetch(
|
||||
tx.mut_repo(),
|
||||
&test_data.git_repo,
|
||||
|
@ -759,7 +781,9 @@ fn test_fetch_success() {
|
|||
let mut test_data = GitRepoData::create();
|
||||
let initial_git_commit = empty_git_commit(&test_data.origin_repo, "refs/heads/main", &[]);
|
||||
|
||||
let mut tx = test_data.repo.start_transaction("test");
|
||||
let mut tx = test_data
|
||||
.repo
|
||||
.start_transaction(&test_data.settings, "test");
|
||||
git::fetch(
|
||||
tx.mut_repo(),
|
||||
&test_data.git_repo,
|
||||
|
@ -776,7 +800,9 @@ fn test_fetch_success() {
|
|||
&[&initial_git_commit],
|
||||
);
|
||||
|
||||
let mut tx = test_data.repo.start_transaction("test");
|
||||
let mut tx = test_data
|
||||
.repo
|
||||
.start_transaction(&test_data.settings, "test");
|
||||
let default_branch = git::fetch(
|
||||
tx.mut_repo(),
|
||||
&test_data.git_repo,
|
||||
|
@ -813,7 +839,9 @@ fn test_fetch_prune_deleted_ref() {
|
|||
let test_data = GitRepoData::create();
|
||||
empty_git_commit(&test_data.git_repo, "refs/heads/main", &[]);
|
||||
|
||||
let mut tx = test_data.repo.start_transaction("test");
|
||||
let mut tx = test_data
|
||||
.repo
|
||||
.start_transaction(&test_data.settings, "test");
|
||||
git::fetch(
|
||||
tx.mut_repo(),
|
||||
&test_data.git_repo,
|
||||
|
@ -846,7 +874,9 @@ fn test_fetch_no_default_branch() {
|
|||
let test_data = GitRepoData::create();
|
||||
let initial_git_commit = empty_git_commit(&test_data.origin_repo, "refs/heads/main", &[]);
|
||||
|
||||
let mut tx = test_data.repo.start_transaction("test");
|
||||
let mut tx = test_data
|
||||
.repo
|
||||
.start_transaction(&test_data.settings, "test");
|
||||
git::fetch(
|
||||
tx.mut_repo(),
|
||||
&test_data.git_repo,
|
||||
|
@ -883,7 +913,9 @@ fn test_fetch_no_default_branch() {
|
|||
fn test_fetch_no_such_remote() {
|
||||
let test_data = GitRepoData::create();
|
||||
|
||||
let mut tx = test_data.repo.start_transaction("test");
|
||||
let mut tx = test_data
|
||||
.repo
|
||||
.start_transaction(&test_data.settings, "test");
|
||||
let result = git::fetch(
|
||||
tx.mut_repo(),
|
||||
&test_data.git_repo,
|
||||
|
@ -911,7 +943,7 @@ fn set_up_push_repos(settings: &UserSettings, temp_dir: &TempDir) -> PushTestSet
|
|||
Box::new(GitBackend::init_external(store_path, &clone_repo_dir))
|
||||
})
|
||||
.unwrap();
|
||||
let mut tx = jj_repo.start_transaction("test");
|
||||
let mut tx = jj_repo.start_transaction(settings, "test");
|
||||
let new_commit = create_random_commit(settings, &jj_repo)
|
||||
.set_parents(vec![jj_id(&initial_git_commit)])
|
||||
.write_to_repo(tx.mut_repo());
|
||||
|
@ -1036,7 +1068,7 @@ fn test_push_updates_not_fast_forward() {
|
|||
let settings = testutils::user_settings();
|
||||
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("test");
|
||||
let mut tx = setup.jj_repo.start_transaction(&settings, "test");
|
||||
let new_commit = create_random_commit(&settings, &setup.jj_repo).write_to_repo(tx.mut_repo());
|
||||
setup.jj_repo = tx.commit();
|
||||
let result = git::push_updates(
|
||||
|
@ -1057,7 +1089,7 @@ fn test_push_updates_not_fast_forward_with_force() {
|
|||
let settings = testutils::user_settings();
|
||||
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("test");
|
||||
let mut tx = setup.jj_repo.start_transaction(&settings, "test");
|
||||
let new_commit = create_random_commit(&settings, &setup.jj_repo).write_to_repo(tx.mut_repo());
|
||||
setup.jj_repo = tx.commit();
|
||||
let result = git::push_updates(
|
||||
|
|
|
@ -76,7 +76,7 @@ fn test_index_commits_standard_cases(use_git: bool) {
|
|||
// o root
|
||||
|
||||
let root_commit_id = repo.store().root_commit_id();
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut graph_builder = CommitGraphBuilder::new(&settings, tx.mut_repo());
|
||||
let commit_a = graph_builder.initial_commit();
|
||||
let commit_b = graph_builder.commit_with_parents(&[&commit_a]);
|
||||
|
@ -134,7 +134,7 @@ fn test_index_commits_criss_cross(use_git: bool) {
|
|||
// Create a long chain of criss-crossed merges. If they were traversed without
|
||||
// keeping track of visited nodes, it would be 2^50 visits, so if this test
|
||||
// finishes in reasonable time, we know that we don't do a naive traversal.
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut graph_builder = CommitGraphBuilder::new(&settings, tx.mut_repo());
|
||||
let mut left_commits = vec![graph_builder.initial_commit()];
|
||||
let mut right_commits = vec![graph_builder.initial_commit()];
|
||||
|
@ -238,14 +238,14 @@ fn test_index_commits_previous_operations(use_git: bool) {
|
|||
// |/
|
||||
// o root
|
||||
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut graph_builder = CommitGraphBuilder::new(&settings, tx.mut_repo());
|
||||
let commit_a = graph_builder.initial_commit();
|
||||
let commit_b = graph_builder.commit_with_parents(&[&commit_a]);
|
||||
let commit_c = graph_builder.commit_with_parents(&[&commit_b]);
|
||||
let repo = tx.commit();
|
||||
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
tx.mut_repo().remove_head(commit_c.id());
|
||||
let repo = tx.commit();
|
||||
|
||||
|
@ -289,7 +289,7 @@ fn test_index_commits_incremental(use_git: bool) {
|
|||
// o root
|
||||
|
||||
let root_commit = repo.store().root_commit();
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let commit_a = child_commit(&settings, repo, &root_commit).write_to_repo(tx.mut_repo());
|
||||
let repo = tx.commit();
|
||||
|
||||
|
@ -297,7 +297,7 @@ fn test_index_commits_incremental(use_git: bool) {
|
|||
// There should be the root commit, plus 1 more
|
||||
assert_eq!(index.num_commits(), 1 + 1);
|
||||
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let commit_b = child_commit(&settings, &repo, &commit_a).write_to_repo(tx.mut_repo());
|
||||
let commit_c = child_commit(&settings, &repo, &commit_b).write_to_repo(tx.mut_repo());
|
||||
tx.commit();
|
||||
|
@ -337,7 +337,7 @@ fn test_index_commits_incremental_empty_transaction(use_git: bool) {
|
|||
// o root
|
||||
|
||||
let root_commit = repo.store().root_commit();
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let commit_a = child_commit(&settings, repo, &root_commit).write_to_repo(tx.mut_repo());
|
||||
let repo = tx.commit();
|
||||
|
||||
|
@ -345,7 +345,7 @@ fn test_index_commits_incremental_empty_transaction(use_git: bool) {
|
|||
// There should be the root commit, plus 1 more
|
||||
assert_eq!(index.num_commits(), 1 + 1);
|
||||
|
||||
repo.start_transaction("test").commit();
|
||||
repo.start_transaction(&settings, "test").commit();
|
||||
|
||||
let repo =
|
||||
ReadonlyRepo::load_at_head(&settings, repo.repo_path(), &BackendFactories::default())
|
||||
|
@ -380,13 +380,13 @@ fn test_index_commits_incremental_already_indexed(use_git: bool) {
|
|||
// o root
|
||||
|
||||
let root_commit = repo.store().root_commit();
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let commit_a = child_commit(&settings, repo, &root_commit).write_to_repo(tx.mut_repo());
|
||||
let repo = tx.commit();
|
||||
|
||||
assert!(repo.index().has_id(commit_a.id()));
|
||||
assert_eq!(repo.index().num_commits(), 1 + 1);
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut_repo = tx.mut_repo();
|
||||
mut_repo.add_head(&commit_a);
|
||||
assert_eq!(mut_repo.index().num_commits(), 1 + 1);
|
||||
|
@ -398,7 +398,7 @@ fn create_n_commits(
|
|||
repo: &Arc<ReadonlyRepo>,
|
||||
num_commits: i32,
|
||||
) -> Arc<ReadonlyRepo> {
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(settings, "test");
|
||||
for _ in 0..num_commits {
|
||||
create_random_commit(settings, repo).write_to_repo(tx.mut_repo());
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ fn test_init_local() {
|
|||
assert_eq!(workspace.workspace_root(), &canonical);
|
||||
|
||||
// Just test that we can write a commit to the store
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
create_random_commit(&settings, &repo).write_to_repo(tx.mut_repo());
|
||||
}
|
||||
|
||||
|
@ -52,7 +52,7 @@ fn test_init_internal_git() {
|
|||
assert_eq!(workspace.workspace_root(), &canonical);
|
||||
|
||||
// Just test that we ca write a commit to the store
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
create_random_commit(&settings, &repo).write_to_repo(tx.mut_repo());
|
||||
}
|
||||
|
||||
|
@ -74,7 +74,7 @@ fn test_init_external_git() {
|
|||
assert_eq!(workspace.workspace_root(), &canonical.join("jj"));
|
||||
|
||||
// Just test that we can write a commit to the store
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
create_random_commit(&settings, &repo).write_to_repo(tx.mut_repo());
|
||||
}
|
||||
|
||||
|
|
|
@ -23,11 +23,11 @@ fn test_load_at_operation(use_git: bool) {
|
|||
let test_repo = TestRepo::init(use_git);
|
||||
let repo = &test_repo.repo;
|
||||
|
||||
let mut tx = repo.start_transaction("add commit");
|
||||
let mut tx = repo.start_transaction(&settings, "add commit");
|
||||
let commit = create_random_commit(&settings, repo).write_to_repo(tx.mut_repo());
|
||||
let repo = tx.commit();
|
||||
|
||||
let mut tx = repo.start_transaction("remove commit");
|
||||
let mut tx = repo.start_transaction(&settings, "remove commit");
|
||||
tx.mut_repo().remove_head(commit.id());
|
||||
tx.commit();
|
||||
|
||||
|
|
|
@ -571,7 +571,7 @@ fn test_simplify_conflict_after_resolving_parent(use_git: bool) {
|
|||
// rebase C2 (the rebased C) onto the resolved conflict. C3 should not have
|
||||
// a conflict since it changed an unrelated line.
|
||||
let path = RepoPath::from_internal_string("dir/file");
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let tree_a = testutils::create_tree(repo, &[(&path, "abc\ndef\nghi\n")]);
|
||||
let commit_a = CommitBuilder::for_new_commit(
|
||||
&settings,
|
||||
|
|
|
@ -26,11 +26,11 @@ fn test_edit(use_git: bool) {
|
|||
let test_repo = TestRepo::init(use_git);
|
||||
let repo = &test_repo.repo;
|
||||
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let wc_commit = create_random_commit(&settings, repo).write_to_repo(tx.mut_repo());
|
||||
let repo = tx.commit();
|
||||
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let ws_id = WorkspaceId::default();
|
||||
tx.mut_repo().edit(ws_id.clone(), &wc_commit).unwrap();
|
||||
let repo = tx.commit();
|
||||
|
@ -45,11 +45,11 @@ fn test_checkout(use_git: bool) {
|
|||
let test_repo = TestRepo::init(use_git);
|
||||
let repo = &test_repo.repo;
|
||||
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let requested_checkout = create_random_commit(&settings, repo).write_to_repo(tx.mut_repo());
|
||||
let repo = tx.commit();
|
||||
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let ws_id = WorkspaceId::default();
|
||||
let actual_checkout = tx
|
||||
.mut_repo()
|
||||
|
@ -73,14 +73,14 @@ fn test_checkout_previous_not_empty(use_git: bool) {
|
|||
let test_repo = TestRepo::init(use_git);
|
||||
let repo = &test_repo.repo;
|
||||
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut_repo = tx.mut_repo();
|
||||
let old_checkout = create_random_commit(&settings, repo).write_to_repo(mut_repo);
|
||||
let ws_id = WorkspaceId::default();
|
||||
mut_repo.edit(ws_id.clone(), &old_checkout).unwrap();
|
||||
let repo = tx.commit();
|
||||
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut_repo = tx.mut_repo();
|
||||
let new_checkout = create_random_commit(&settings, &repo).write_to_repo(mut_repo);
|
||||
mut_repo.edit(ws_id, &new_checkout).unwrap();
|
||||
|
@ -97,7 +97,7 @@ fn test_checkout_previous_empty(use_git: bool) {
|
|||
let test_repo = TestRepo::init(use_git);
|
||||
let repo = &test_repo.repo;
|
||||
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut_repo = tx.mut_repo();
|
||||
let old_checkout = CommitBuilder::for_new_commit(
|
||||
&settings,
|
||||
|
@ -109,7 +109,7 @@ fn test_checkout_previous_empty(use_git: bool) {
|
|||
mut_repo.edit(ws_id.clone(), &old_checkout).unwrap();
|
||||
let repo = tx.commit();
|
||||
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut_repo = tx.mut_repo();
|
||||
let new_wc_commit = create_random_commit(&settings, &repo).write_to_repo(mut_repo);
|
||||
mut_repo.edit(ws_id, &new_wc_commit).unwrap();
|
||||
|
@ -126,7 +126,7 @@ fn test_checkout_previous_empty_with_description(use_git: bool) {
|
|||
let test_repo = TestRepo::init(use_git);
|
||||
let repo = &test_repo.repo;
|
||||
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut_repo = tx.mut_repo();
|
||||
let old_checkout = CommitBuilder::for_new_commit(
|
||||
&settings,
|
||||
|
@ -139,7 +139,7 @@ fn test_checkout_previous_empty_with_description(use_git: bool) {
|
|||
mut_repo.edit(ws_id.clone(), &old_checkout).unwrap();
|
||||
let repo = tx.commit();
|
||||
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut_repo = tx.mut_repo();
|
||||
let new_checkout = create_random_commit(&settings, &repo).write_to_repo(mut_repo);
|
||||
mut_repo.edit(ws_id, &new_checkout).unwrap();
|
||||
|
@ -156,7 +156,7 @@ fn test_checkout_previous_empty_non_head(use_git: bool) {
|
|||
let test_repo = TestRepo::init(use_git);
|
||||
let repo = &test_repo.repo;
|
||||
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut_repo = tx.mut_repo();
|
||||
let old_checkout = CommitBuilder::for_new_commit(
|
||||
&settings,
|
||||
|
@ -174,7 +174,7 @@ fn test_checkout_previous_empty_non_head(use_git: bool) {
|
|||
mut_repo.edit(ws_id.clone(), &old_checkout).unwrap();
|
||||
let repo = tx.commit();
|
||||
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut_repo = tx.mut_repo();
|
||||
let new_checkout = create_random_commit(&settings, &repo).write_to_repo(mut_repo);
|
||||
mut_repo.edit(ws_id, &new_checkout).unwrap();
|
||||
|
@ -194,11 +194,11 @@ fn test_edit_initial(use_git: bool) {
|
|||
let test_repo = TestRepo::init(use_git);
|
||||
let repo = &test_repo.repo;
|
||||
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let checkout = create_random_commit(&settings, repo).write_to_repo(tx.mut_repo());
|
||||
let repo = tx.commit();
|
||||
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let workspace_id = WorkspaceId::new("new-workspace".to_string());
|
||||
tx.mut_repo().edit(workspace_id.clone(), &checkout).unwrap();
|
||||
let repo = tx.commit();
|
||||
|
@ -219,7 +219,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("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let new_commit = create_random_commit(&settings, repo).write_to_repo(tx.mut_repo());
|
||||
drop(tx);
|
||||
|
||||
|
@ -227,7 +227,7 @@ fn test_add_head_success(use_git: bool) {
|
|||
assert_eq!(index_stats.num_heads, 1);
|
||||
assert_eq!(index_stats.num_commits, 1);
|
||||
assert_eq!(index_stats.max_generation_number, 0);
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut_repo = tx.mut_repo();
|
||||
assert!(!mut_repo.view().heads().contains(new_commit.id()));
|
||||
assert!(!mut_repo.index().has_id(new_commit.id()));
|
||||
|
@ -252,7 +252,7 @@ fn test_add_head_ancestor(use_git: bool) {
|
|||
let test_repo = TestRepo::init(use_git);
|
||||
let repo = &test_repo.repo;
|
||||
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut graph_builder = CommitGraphBuilder::new(&settings, tx.mut_repo());
|
||||
let commit1 = graph_builder.initial_commit();
|
||||
let commit2 = graph_builder.commit_with_parents(&[&commit1]);
|
||||
|
@ -263,7 +263,7 @@ fn test_add_head_ancestor(use_git: bool) {
|
|||
assert_eq!(index_stats.num_heads, 1);
|
||||
assert_eq!(index_stats.num_commits, 4);
|
||||
assert_eq!(index_stats.max_generation_number, 3);
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut_repo = tx.mut_repo();
|
||||
mut_repo.add_head(&commit1);
|
||||
assert!(!mut_repo.view().heads().contains(commit1.id()));
|
||||
|
@ -282,13 +282,13 @@ fn test_add_head_not_immediate_child(use_git: bool) {
|
|||
let test_repo = TestRepo::init(use_git);
|
||||
let repo = &test_repo.repo;
|
||||
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let initial = create_random_commit(&settings, repo).write_to_repo(tx.mut_repo());
|
||||
let repo = tx.commit();
|
||||
|
||||
// Create some commit outside of the repo by using a temporary transaction. Then
|
||||
// add one of them as a head.
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let rewritten = create_random_commit(&settings, &repo)
|
||||
.set_change_id(initial.change_id().clone())
|
||||
.set_predecessors(vec![initial.id().clone()])
|
||||
|
@ -302,7 +302,7 @@ fn test_add_head_not_immediate_child(use_git: bool) {
|
|||
assert_eq!(index_stats.num_heads, 1);
|
||||
assert_eq!(index_stats.num_commits, 2);
|
||||
assert_eq!(index_stats.max_generation_number, 1);
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut_repo = tx.mut_repo();
|
||||
mut_repo.add_head(&child);
|
||||
assert!(mut_repo.view().heads().contains(initial.id()));
|
||||
|
@ -331,14 +331,14 @@ fn test_remove_head(use_git: bool) {
|
|||
let test_repo = TestRepo::init(use_git);
|
||||
let repo = &test_repo.repo;
|
||||
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut graph_builder = CommitGraphBuilder::new(&settings, tx.mut_repo());
|
||||
let commit1 = graph_builder.initial_commit();
|
||||
let commit2 = graph_builder.commit_with_parents(&[&commit1]);
|
||||
let commit3 = graph_builder.commit_with_parents(&[&commit2]);
|
||||
let repo = tx.commit();
|
||||
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut_repo = tx.mut_repo();
|
||||
assert!(mut_repo.view().heads().contains(commit3.id()));
|
||||
mut_repo.remove_head(commit3.id());
|
||||
|
@ -368,11 +368,11 @@ fn test_add_public_head(use_git: bool) {
|
|||
let test_repo = TestRepo::init(use_git);
|
||||
let repo = &test_repo.repo;
|
||||
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let commit1 = create_random_commit(&settings, repo).write_to_repo(tx.mut_repo());
|
||||
let repo = tx.commit();
|
||||
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut_repo = tx.mut_repo();
|
||||
assert!(!mut_repo.view().public_heads().contains(commit1.id()));
|
||||
mut_repo.add_public_head(&commit1);
|
||||
|
@ -390,14 +390,14 @@ fn test_add_public_head_ancestor(use_git: bool) {
|
|||
let test_repo = TestRepo::init(use_git);
|
||||
let repo = &test_repo.repo;
|
||||
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut graph_builder = CommitGraphBuilder::new(&settings, tx.mut_repo());
|
||||
let commit1 = graph_builder.initial_commit();
|
||||
let commit2 = graph_builder.commit_with_parents(&[&commit1]);
|
||||
tx.mut_repo().add_public_head(&commit2);
|
||||
let repo = tx.commit();
|
||||
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut_repo = tx.mut_repo();
|
||||
assert!(!mut_repo.view().public_heads().contains(commit1.id()));
|
||||
mut_repo.add_public_head(&commit1);
|
||||
|
@ -415,13 +415,13 @@ fn test_remove_public_head(use_git: bool) {
|
|||
let test_repo = TestRepo::init(use_git);
|
||||
let repo = &test_repo.repo;
|
||||
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut_repo = tx.mut_repo();
|
||||
let commit1 = create_random_commit(&settings, repo).write_to_repo(mut_repo);
|
||||
mut_repo.add_public_head(&commit1);
|
||||
let repo = tx.commit();
|
||||
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut_repo = tx.mut_repo();
|
||||
assert!(mut_repo.view().public_heads().contains(commit1.id()));
|
||||
mut_repo.remove_public_head(commit1.id());
|
||||
|
@ -440,7 +440,7 @@ fn test_has_changed(use_git: bool) {
|
|||
let test_repo = TestRepo::init(use_git);
|
||||
let repo = &test_repo.repo;
|
||||
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut_repo = tx.mut_repo();
|
||||
let commit1 = create_random_commit(&settings, repo).write_to_repo(mut_repo);
|
||||
let commit2 = create_random_commit(&settings, repo).write_to_repo(mut_repo);
|
||||
|
@ -461,7 +461,7 @@ fn test_has_changed(use_git: bool) {
|
|||
assert_eq!(repo.view().heads(), &hashset! {commit1.id().clone()});
|
||||
assert_eq!(repo.view().public_heads(), &hashset! {commit1.id().clone()});
|
||||
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut_repo = tx.mut_repo();
|
||||
|
||||
mut_repo.add_public_head(&commit1);
|
||||
|
@ -534,7 +534,7 @@ fn test_rebase_descendants_simple(use_git: bool) {
|
|||
let test_repo = TestRepo::init(use_git);
|
||||
let repo = &test_repo.repo;
|
||||
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut graph_builder = CommitGraphBuilder::new(&settings, tx.mut_repo());
|
||||
let commit1 = graph_builder.initial_commit();
|
||||
let commit2 = graph_builder.commit_with_parents(&[&commit1]);
|
||||
|
@ -543,7 +543,7 @@ fn test_rebase_descendants_simple(use_git: bool) {
|
|||
let commit5 = graph_builder.commit_with_parents(&[&commit4]);
|
||||
let repo = tx.commit();
|
||||
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut_repo = tx.mut_repo();
|
||||
let mut graph_builder = CommitGraphBuilder::new(&settings, mut_repo);
|
||||
let commit6 = graph_builder.commit_with_parents(&[&commit1]);
|
||||
|
@ -572,14 +572,14 @@ fn test_rebase_descendants_conflicting_rewrite(use_git: bool) {
|
|||
let test_repo = TestRepo::init(use_git);
|
||||
let repo = &test_repo.repo;
|
||||
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut graph_builder = CommitGraphBuilder::new(&settings, tx.mut_repo());
|
||||
let commit1 = graph_builder.initial_commit();
|
||||
let commit2 = graph_builder.commit_with_parents(&[&commit1]);
|
||||
let _commit3 = graph_builder.commit_with_parents(&[&commit2]);
|
||||
let repo = tx.commit();
|
||||
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut_repo = tx.mut_repo();
|
||||
let mut graph_builder = CommitGraphBuilder::new(&settings, mut_repo);
|
||||
let commit4 = graph_builder.commit_with_parents(&[&commit1]);
|
||||
|
@ -604,7 +604,7 @@ fn test_rename_remote(use_git: bool) {
|
|||
let settings = testutils::user_settings();
|
||||
let test_repo = TestRepo::init(use_git);
|
||||
let repo = &test_repo.repo;
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut_repo = tx.mut_repo();
|
||||
let commit = create_random_commit(&settings, repo).write_to_repo(mut_repo);
|
||||
let target = RefTarget::Normal(commit.id().clone());
|
||||
|
|
|
@ -39,7 +39,7 @@ fn test_unpublished_operation(use_git: bool) {
|
|||
let op_id0 = repo.op_id().clone();
|
||||
assert_eq!(list_dir(&op_heads_dir), vec![repo.op_id().hex()]);
|
||||
|
||||
let mut tx1 = repo.start_transaction("transaction 1");
|
||||
let mut tx1 = repo.start_transaction(&settings, "transaction 1");
|
||||
create_random_commit(&settings, repo).write_to_repo(tx1.mut_repo());
|
||||
let unpublished_op = tx1.write();
|
||||
let op_id1 = unpublished_op.operation().id().clone();
|
||||
|
@ -62,14 +62,14 @@ fn test_consecutive_operations(use_git: bool) {
|
|||
let op_id0 = repo.op_id().clone();
|
||||
assert_eq!(list_dir(&op_heads_dir), vec![repo.op_id().hex()]);
|
||||
|
||||
let mut tx1 = repo.start_transaction("transaction 1");
|
||||
let mut tx1 = repo.start_transaction(&settings, "transaction 1");
|
||||
create_random_commit(&settings, repo).write_to_repo(tx1.mut_repo());
|
||||
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("transaction 2");
|
||||
let mut tx2 = repo.start_transaction(&settings, "transaction 2");
|
||||
create_random_commit(&settings, &repo).write_to_repo(tx2.mut_repo());
|
||||
let op_id2 = tx2.commit().operation().id().clone();
|
||||
assert_ne!(op_id2, op_id0);
|
||||
|
@ -95,7 +95,7 @@ fn test_concurrent_operations(use_git: bool) {
|
|||
let op_id0 = repo.op_id().clone();
|
||||
assert_eq!(list_dir(&op_heads_dir), vec![repo.op_id().hex()]);
|
||||
|
||||
let mut tx1 = repo.start_transaction("transaction 1");
|
||||
let mut tx1 = repo.start_transaction(&settings, "transaction 1");
|
||||
create_random_commit(&settings, repo).write_to_repo(tx1.mut_repo());
|
||||
let op_id1 = tx1.commit().operation().id().clone();
|
||||
assert_ne!(op_id1, op_id0);
|
||||
|
@ -103,7 +103,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("transaction 2");
|
||||
let mut tx2 = repo.start_transaction(&settings, "transaction 2");
|
||||
create_random_commit(&settings, repo).write_to_repo(tx2.mut_repo());
|
||||
let op_id2 = tx2.commit().operation().id().clone();
|
||||
assert_ne!(op_id2, op_id0);
|
||||
|
@ -136,15 +136,15 @@ fn test_isolation(use_git: bool) {
|
|||
let test_repo = TestRepo::init(use_git);
|
||||
let repo = &test_repo.repo;
|
||||
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let initial = create_random_commit(&settings, repo)
|
||||
.set_parents(vec![repo.store().root_commit_id().clone()])
|
||||
.write_to_repo(tx.mut_repo());
|
||||
let repo = tx.commit();
|
||||
|
||||
let mut tx1 = repo.start_transaction("transaction 1");
|
||||
let mut tx1 = repo.start_transaction(&settings, "transaction 1");
|
||||
let mut_repo1 = tx1.mut_repo();
|
||||
let mut tx2 = repo.start_transaction("transaction 2");
|
||||
let mut tx2 = repo.start_transaction(&settings, "transaction 2");
|
||||
let mut_repo2 = tx2.mut_repo();
|
||||
|
||||
assert_heads(repo.as_repo_ref(), vec![initial.id()]);
|
||||
|
|
|
@ -30,7 +30,7 @@ fn test_merge_ref_targets() {
|
|||
// | 2
|
||||
// |/
|
||||
// 1
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut graph_builder = CommitGraphBuilder::new(&settings, tx.mut_repo());
|
||||
let commit1 = graph_builder.initial_commit();
|
||||
let commit2 = graph_builder.commit_with_parents(&[&commit1]);
|
||||
|
|
|
@ -47,7 +47,7 @@ fn test_resolve_symbol_commit_id() {
|
|||
let test_repo = TestRepo::init(true);
|
||||
let repo = &test_repo.repo;
|
||||
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut_repo = tx.mut_repo();
|
||||
let signature = Signature {
|
||||
name: "test".to_string(),
|
||||
|
@ -142,6 +142,7 @@ fn test_resolve_symbol_commit_id() {
|
|||
|
||||
#[test]
|
||||
fn test_resolve_symbol_change_id() {
|
||||
let settings = testutils::user_settings();
|
||||
// Test only with git so we can get predictable change ids
|
||||
let test_repo = TestRepo::init(true);
|
||||
let repo = &test_repo.repo;
|
||||
|
@ -177,7 +178,7 @@ fn test_resolve_symbol_change_id() {
|
|||
git_commit_ids.push(git_commit_id);
|
||||
}
|
||||
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
git::import_refs(tx.mut_repo(), &git_repo).unwrap();
|
||||
let repo = tx.commit();
|
||||
|
||||
|
@ -260,7 +261,7 @@ fn test_resolve_symbol_checkout(use_git: bool) {
|
|||
let test_repo = TestRepo::init(use_git);
|
||||
let repo = &test_repo.repo;
|
||||
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut_repo = tx.mut_repo();
|
||||
|
||||
let commit1 = create_random_commit(&settings, repo).write_to_repo(mut_repo);
|
||||
|
@ -311,7 +312,7 @@ fn test_resolve_symbol_git_refs() {
|
|||
let test_repo = TestRepo::init(true);
|
||||
let repo = &test_repo.repo;
|
||||
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut_repo = tx.mut_repo();
|
||||
|
||||
// Create some commits and refs to work with and so the repo is not empty
|
||||
|
@ -472,7 +473,7 @@ fn test_evaluate_expression_root_and_checkout(use_git: bool) {
|
|||
let test_workspace = TestWorkspace::init(&settings, use_git);
|
||||
let repo = &test_workspace.repo;
|
||||
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut_repo = tx.mut_repo();
|
||||
|
||||
let root_commit = repo.store().root_commit();
|
||||
|
@ -507,7 +508,7 @@ fn test_evaluate_expression_heads(use_git: bool) {
|
|||
let repo = &test_repo.repo;
|
||||
|
||||
let root_commit = repo.store().root_commit();
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut_repo = tx.mut_repo();
|
||||
let mut graph_builder = CommitGraphBuilder::new(&settings, mut_repo);
|
||||
let commit1 = graph_builder.initial_commit();
|
||||
|
@ -569,7 +570,7 @@ fn test_evaluate_expression_roots(use_git: bool) {
|
|||
let repo = &test_repo.repo;
|
||||
|
||||
let root_commit = repo.store().root_commit();
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut_repo = tx.mut_repo();
|
||||
let mut graph_builder = CommitGraphBuilder::new(&settings, mut_repo);
|
||||
let commit1 = graph_builder.initial_commit();
|
||||
|
@ -631,7 +632,7 @@ fn test_evaluate_expression_parents(use_git: bool) {
|
|||
let repo = &test_workspace.repo;
|
||||
|
||||
let root_commit = repo.store().root_commit();
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut_repo = tx.mut_repo();
|
||||
let mut graph_builder = CommitGraphBuilder::new(&settings, mut_repo);
|
||||
let commit1 = graph_builder.initial_commit();
|
||||
|
@ -698,7 +699,7 @@ fn test_evaluate_expression_children(use_git: bool) {
|
|||
let test_repo = TestRepo::init(use_git);
|
||||
let repo = &test_repo.repo;
|
||||
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut_repo = tx.mut_repo();
|
||||
|
||||
let commit1 = create_random_commit(&settings, repo).write_to_repo(mut_repo);
|
||||
|
@ -753,7 +754,7 @@ fn test_evaluate_expression_ancestors(use_git: bool) {
|
|||
let repo = &test_repo.repo;
|
||||
|
||||
let root_commit = repo.store().root_commit();
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut_repo = tx.mut_repo();
|
||||
let mut graph_builder = CommitGraphBuilder::new(&settings, mut_repo);
|
||||
let commit1 = graph_builder.initial_commit();
|
||||
|
@ -788,7 +789,7 @@ fn test_evaluate_expression_range(use_git: bool) {
|
|||
let test_repo = TestRepo::init(use_git);
|
||||
let repo = &test_repo.repo;
|
||||
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut_repo = tx.mut_repo();
|
||||
let mut graph_builder = CommitGraphBuilder::new(&settings, mut_repo);
|
||||
let commit1 = graph_builder.initial_commit();
|
||||
|
@ -852,7 +853,7 @@ fn test_evaluate_expression_dag_range(use_git: bool) {
|
|||
let repo = &test_repo.repo;
|
||||
|
||||
let root_commit_id = repo.store().root_commit_id().clone();
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut_repo = tx.mut_repo();
|
||||
let mut graph_builder = CommitGraphBuilder::new(&settings, mut_repo);
|
||||
let commit1 = graph_builder.initial_commit();
|
||||
|
@ -922,7 +923,7 @@ fn test_evaluate_expression_connected(use_git: bool) {
|
|||
let repo = &test_repo.repo;
|
||||
|
||||
let root_commit_id = repo.store().root_commit_id().clone();
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut_repo = tx.mut_repo();
|
||||
let mut graph_builder = CommitGraphBuilder::new(&settings, mut_repo);
|
||||
let commit1 = graph_builder.initial_commit();
|
||||
|
@ -1001,7 +1002,7 @@ fn test_evaluate_expression_descendants(use_git: bool) {
|
|||
let test_repo = TestRepo::init(use_git);
|
||||
let repo = &test_repo.repo;
|
||||
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut_repo = tx.mut_repo();
|
||||
|
||||
let root_commit_id = repo.store().root_commit_id().clone();
|
||||
|
@ -1060,7 +1061,7 @@ fn test_evaluate_expression_all(use_git: bool) {
|
|||
let test_repo = TestRepo::init(use_git);
|
||||
let repo = &test_repo.repo;
|
||||
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut_repo = tx.mut_repo();
|
||||
let root_commit_id = repo.store().root_commit_id().clone();
|
||||
let mut graph_builder = CommitGraphBuilder::new(&settings, mut_repo);
|
||||
|
@ -1088,7 +1089,7 @@ fn test_evaluate_expression_visible_heads(use_git: bool) {
|
|||
let test_repo = TestRepo::init(use_git);
|
||||
let repo = &test_repo.repo;
|
||||
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut_repo = tx.mut_repo();
|
||||
let mut graph_builder = CommitGraphBuilder::new(&settings, mut_repo);
|
||||
let commit1 = graph_builder.initial_commit();
|
||||
|
@ -1109,7 +1110,7 @@ fn test_evaluate_expression_public_heads(use_git: bool) {
|
|||
let repo = &test_repo.repo;
|
||||
|
||||
let root_commit = repo.store().root_commit();
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut_repo = tx.mut_repo();
|
||||
let mut graph_builder = CommitGraphBuilder::new(&settings, mut_repo);
|
||||
let commit1 = graph_builder.initial_commit();
|
||||
|
@ -1141,7 +1142,7 @@ fn test_evaluate_expression_git_refs(use_git: bool) {
|
|||
let test_repo = TestRepo::init(use_git);
|
||||
let repo = &test_repo.repo;
|
||||
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut_repo = tx.mut_repo();
|
||||
|
||||
let commit1 = create_random_commit(&settings, repo).write_to_repo(mut_repo);
|
||||
|
@ -1210,7 +1211,7 @@ fn test_evaluate_expression_git_head(use_git: bool) {
|
|||
let test_repo = TestRepo::init(use_git);
|
||||
let repo = &test_repo.repo;
|
||||
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut_repo = tx.mut_repo();
|
||||
|
||||
let commit1 = create_random_commit(&settings, repo).write_to_repo(mut_repo);
|
||||
|
@ -1234,7 +1235,7 @@ fn test_evaluate_expression_branches(use_git: bool) {
|
|||
let test_repo = TestRepo::init(use_git);
|
||||
let repo = &test_repo.repo;
|
||||
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut_repo = tx.mut_repo();
|
||||
|
||||
let commit1 = create_random_commit(&settings, repo).write_to_repo(mut_repo);
|
||||
|
@ -1303,7 +1304,7 @@ fn test_evaluate_expression_remote_branches(use_git: bool) {
|
|||
let test_repo = TestRepo::init(use_git);
|
||||
let repo = &test_repo.repo;
|
||||
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut_repo = tx.mut_repo();
|
||||
|
||||
let commit1 = create_random_commit(&settings, repo).write_to_repo(mut_repo);
|
||||
|
@ -1383,7 +1384,7 @@ fn test_evaluate_expression_merges(use_git: bool) {
|
|||
let test_repo = TestRepo::init(use_git);
|
||||
let repo = &test_repo.repo;
|
||||
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut_repo = tx.mut_repo();
|
||||
let mut graph_builder = CommitGraphBuilder::new(&settings, mut_repo);
|
||||
let commit1 = graph_builder.initial_commit();
|
||||
|
@ -1414,7 +1415,7 @@ fn test_evaluate_expression_description(use_git: bool) {
|
|||
let test_repo = TestRepo::init(use_git);
|
||||
let repo = &test_repo.repo;
|
||||
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut_repo = tx.mut_repo();
|
||||
|
||||
let commit1 = create_random_commit(&settings, repo)
|
||||
|
@ -1460,7 +1461,7 @@ fn test_evaluate_expression_author(use_git: bool) {
|
|||
let test_repo = TestRepo::init(use_git);
|
||||
let repo = &test_repo.repo;
|
||||
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut_repo = tx.mut_repo();
|
||||
|
||||
let timestamp = Timestamp {
|
||||
|
@ -1523,7 +1524,7 @@ fn test_evaluate_expression_committer(use_git: bool) {
|
|||
let test_repo = TestRepo::init(use_git);
|
||||
let repo = &test_repo.repo;
|
||||
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut_repo = tx.mut_repo();
|
||||
|
||||
let timestamp = Timestamp {
|
||||
|
@ -1587,7 +1588,7 @@ fn test_evaluate_expression_union(use_git: bool) {
|
|||
let repo = &test_repo.repo;
|
||||
|
||||
let root_commit = repo.store().root_commit();
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut_repo = tx.mut_repo();
|
||||
let mut graph_builder = CommitGraphBuilder::new(&settings, mut_repo);
|
||||
let commit1 = graph_builder.initial_commit();
|
||||
|
@ -1660,7 +1661,7 @@ fn test_evaluate_expression_intersection(use_git: bool) {
|
|||
let repo = &test_repo.repo;
|
||||
|
||||
let root_commit = repo.store().root_commit();
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut_repo = tx.mut_repo();
|
||||
let mut graph_builder = CommitGraphBuilder::new(&settings, mut_repo);
|
||||
let commit1 = graph_builder.initial_commit();
|
||||
|
@ -1700,7 +1701,7 @@ fn test_evaluate_expression_difference(use_git: bool) {
|
|||
let repo = &test_repo.repo;
|
||||
|
||||
let root_commit = repo.store().root_commit();
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut_repo = tx.mut_repo();
|
||||
let mut graph_builder = CommitGraphBuilder::new(&settings, mut_repo);
|
||||
let commit1 = graph_builder.initial_commit();
|
||||
|
@ -1773,7 +1774,7 @@ fn test_filter_by_diff(use_git: bool) {
|
|||
let test_workspace = TestWorkspace::init(&settings, use_git);
|
||||
let repo = &test_workspace.repo;
|
||||
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut_repo = tx.mut_repo();
|
||||
|
||||
let added_clean_clean = RepoPath::from_internal_string("added_clean_clean");
|
||||
|
|
|
@ -33,7 +33,7 @@ fn test_graph_iterator_linearized(skip_transitive_edges: bool) {
|
|||
// A ~
|
||||
// |
|
||||
// root
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut graph_builder = CommitGraphBuilder::new(&settings, tx.mut_repo());
|
||||
let commit_a = graph_builder.initial_commit();
|
||||
let commit_b = graph_builder.commit_with_parents(&[&commit_a]);
|
||||
|
@ -77,7 +77,7 @@ fn test_graph_iterator_virtual_octopus(skip_transitive_edges: bool) {
|
|||
// A B C A B C
|
||||
// \|/ ~ ~ ~
|
||||
// root
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut graph_builder = CommitGraphBuilder::new(&settings, tx.mut_repo());
|
||||
let commit_a = graph_builder.initial_commit();
|
||||
let commit_b = graph_builder.initial_commit();
|
||||
|
@ -140,7 +140,7 @@ fn test_graph_iterator_simple_fork(skip_transitive_edges: bool) {
|
|||
// A
|
||||
// |
|
||||
// root
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut graph_builder = CommitGraphBuilder::new(&settings, tx.mut_repo());
|
||||
let commit_a = graph_builder.initial_commit();
|
||||
let commit_b = graph_builder.commit_with_parents(&[&commit_a]);
|
||||
|
@ -186,7 +186,7 @@ fn test_graph_iterator_multiple_missing(skip_transitive_edges: bool) {
|
|||
// a B c ~
|
||||
// \|/
|
||||
// root
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut graph_builder = CommitGraphBuilder::new(&settings, tx.mut_repo());
|
||||
let commit_a = graph_builder.initial_commit();
|
||||
let commit_b = graph_builder.initial_commit();
|
||||
|
@ -243,7 +243,7 @@ fn test_graph_iterator_edge_to_ancestor(skip_transitive_edges: bool) {
|
|||
// a
|
||||
// |
|
||||
// root
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut graph_builder = CommitGraphBuilder::new(&settings, tx.mut_repo());
|
||||
let commit_a = graph_builder.initial_commit();
|
||||
let commit_b = graph_builder.initial_commit();
|
||||
|
@ -312,7 +312,7 @@ fn test_graph_iterator_edge_escapes_from_(skip_transitive_edges: bool) {
|
|||
// A
|
||||
// |
|
||||
// root
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut graph_builder = CommitGraphBuilder::new(&settings, tx.mut_repo());
|
||||
let commit_a = graph_builder.initial_commit();
|
||||
let commit_b = graph_builder.commit_with_parents(&[&commit_a]);
|
||||
|
@ -403,7 +403,7 @@ fn test_reverse_graph_iterator() {
|
|||
// A
|
||||
// |
|
||||
// root
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut graph_builder = CommitGraphBuilder::new(&settings, tx.mut_repo());
|
||||
let commit_a = graph_builder.initial_commit();
|
||||
let commit_b = graph_builder.commit_with_parents(&[&commit_a]);
|
||||
|
|
|
@ -36,7 +36,7 @@ fn test_rebase_descendants_sideways(use_git: bool) {
|
|||
// | B
|
||||
// |/
|
||||
// A
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut graph_builder = CommitGraphBuilder::new(&settings, tx.mut_repo());
|
||||
let commit_a = graph_builder.initial_commit();
|
||||
let commit_b = graph_builder.commit_with_parents(&[&commit_a]);
|
||||
|
@ -92,7 +92,7 @@ fn test_rebase_descendants_forward(use_git: bool) {
|
|||
// |/
|
||||
// B
|
||||
// A
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut graph_builder = CommitGraphBuilder::new(&settings, tx.mut_repo());
|
||||
let commit_a = graph_builder.initial_commit();
|
||||
let commit_b = graph_builder.commit_with_parents(&[&commit_a]);
|
||||
|
@ -146,7 +146,7 @@ fn test_rebase_descendants_reorder(use_git: bool) {
|
|||
// |/
|
||||
// B
|
||||
// A
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut graph_builder = CommitGraphBuilder::new(&settings, tx.mut_repo());
|
||||
let commit_a = graph_builder.initial_commit();
|
||||
let commit_b = graph_builder.commit_with_parents(&[&commit_a]);
|
||||
|
@ -193,7 +193,7 @@ fn test_rebase_descendants_backward(use_git: bool) {
|
|||
// C
|
||||
// B
|
||||
// A
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut graph_builder = CommitGraphBuilder::new(&settings, tx.mut_repo());
|
||||
let commit_a = graph_builder.initial_commit();
|
||||
let commit_b = graph_builder.commit_with_parents(&[&commit_a]);
|
||||
|
@ -235,7 +235,7 @@ fn test_rebase_descendants_chain_becomes_branchy(use_git: bool) {
|
|||
// B E
|
||||
// |/
|
||||
// A
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut graph_builder = CommitGraphBuilder::new(&settings, tx.mut_repo());
|
||||
let commit_a = graph_builder.initial_commit();
|
||||
let commit_b = graph_builder.commit_with_parents(&[&commit_a]);
|
||||
|
@ -283,7 +283,7 @@ fn test_rebase_descendants_internal_merge(use_git: bool) {
|
|||
// | B
|
||||
// |/
|
||||
// A
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut graph_builder = CommitGraphBuilder::new(&settings, tx.mut_repo());
|
||||
let commit_a = graph_builder.initial_commit();
|
||||
let commit_b = graph_builder.commit_with_parents(&[&commit_a]);
|
||||
|
@ -334,7 +334,7 @@ fn test_rebase_descendants_external_merge(use_git: bool) {
|
|||
// | B
|
||||
// |/
|
||||
// A
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut graph_builder = CommitGraphBuilder::new(&settings, tx.mut_repo());
|
||||
let commit_a = graph_builder.initial_commit();
|
||||
let commit_b = graph_builder.commit_with_parents(&[&commit_a]);
|
||||
|
@ -381,7 +381,7 @@ fn test_rebase_descendants_abandon(use_git: bool) {
|
|||
// |/
|
||||
// B
|
||||
// A
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut graph_builder = CommitGraphBuilder::new(&settings, tx.mut_repo());
|
||||
let commit_a = graph_builder.initial_commit();
|
||||
let commit_b = graph_builder.commit_with_parents(&[&commit_a]);
|
||||
|
@ -423,7 +423,7 @@ fn test_rebase_descendants_abandon_no_descendants(use_git: bool) {
|
|||
// C
|
||||
// B
|
||||
// A
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut graph_builder = CommitGraphBuilder::new(&settings, tx.mut_repo());
|
||||
let commit_a = graph_builder.initial_commit();
|
||||
let commit_b = graph_builder.commit_with_parents(&[&commit_a]);
|
||||
|
@ -461,7 +461,7 @@ fn test_rebase_descendants_abandon_and_replace(use_git: bool) {
|
|||
// E B
|
||||
// |/
|
||||
// A
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut graph_builder = CommitGraphBuilder::new(&settings, tx.mut_repo());
|
||||
let commit_a = graph_builder.initial_commit();
|
||||
let commit_b = graph_builder.commit_with_parents(&[&commit_a]);
|
||||
|
@ -500,7 +500,7 @@ fn test_rebase_descendants_abandon_degenerate_merge(use_git: bool) {
|
|||
// B C
|
||||
// |/
|
||||
// A
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut graph_builder = CommitGraphBuilder::new(&settings, tx.mut_repo());
|
||||
let commit_a = graph_builder.initial_commit();
|
||||
let commit_b = graph_builder.commit_with_parents(&[&commit_a]);
|
||||
|
@ -540,7 +540,7 @@ fn test_rebase_descendants_abandon_widen_merge(use_git: bool) {
|
|||
// B C D
|
||||
// \|/
|
||||
// A
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut graph_builder = CommitGraphBuilder::new(&settings, tx.mut_repo());
|
||||
let commit_a = graph_builder.initial_commit();
|
||||
let commit_b = graph_builder.commit_with_parents(&[&commit_a]);
|
||||
|
@ -584,7 +584,7 @@ fn test_rebase_descendants_multiple_sideways(use_git: bool) {
|
|||
// | |/
|
||||
// |/
|
||||
// A
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut graph_builder = CommitGraphBuilder::new(&settings, tx.mut_repo());
|
||||
let commit_a = graph_builder.initial_commit();
|
||||
let commit_b = graph_builder.commit_with_parents(&[&commit_a]);
|
||||
|
@ -630,7 +630,7 @@ fn test_rebase_descendants_multiple_swap(use_git: bool) {
|
|||
// B D
|
||||
// |/
|
||||
// A
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut graph_builder = CommitGraphBuilder::new(&settings, tx.mut_repo());
|
||||
let commit_a = graph_builder.initial_commit();
|
||||
let commit_b = graph_builder.commit_with_parents(&[&commit_a]);
|
||||
|
@ -673,7 +673,7 @@ fn test_rebase_descendants_multiple_no_descendants(use_git: bool) {
|
|||
// B C
|
||||
// |/
|
||||
// A
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut graph_builder = CommitGraphBuilder::new(&settings, tx.mut_repo());
|
||||
let commit_a = graph_builder.initial_commit();
|
||||
let commit_b = graph_builder.commit_with_parents(&[&commit_a]);
|
||||
|
@ -727,7 +727,7 @@ fn test_rebase_descendants_divergent_rewrite(use_git: bool) {
|
|||
// | B2
|
||||
// |/
|
||||
// A
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut graph_builder = CommitGraphBuilder::new(&settings, tx.mut_repo());
|
||||
let commit_a = graph_builder.initial_commit();
|
||||
let commit_b = graph_builder.commit_with_parents(&[&commit_a]);
|
||||
|
@ -786,7 +786,7 @@ fn test_rebase_descendants_repeated(use_git: bool) {
|
|||
// | B2
|
||||
// |/
|
||||
// A
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut graph_builder = CommitGraphBuilder::new(&settings, tx.mut_repo());
|
||||
let commit_a = graph_builder.initial_commit();
|
||||
let commit_b = graph_builder.commit_with_parents(&[&commit_a]);
|
||||
|
@ -845,7 +845,7 @@ fn test_rebase_descendants_contents(use_git: bool) {
|
|||
// | B
|
||||
// |/
|
||||
// A
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let path1 = RepoPath::from_internal_string("file1");
|
||||
let tree1 = testutils::create_tree(repo, &[(&path1, "content")]);
|
||||
let commit_a = CommitBuilder::for_new_commit(
|
||||
|
@ -912,7 +912,7 @@ fn test_rebase_descendants_basic_branch_update() {
|
|||
// B main B2 main
|
||||
// | => |
|
||||
// A A
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut graph_builder = CommitGraphBuilder::new(&settings, tx.mut_repo());
|
||||
let commit_a = graph_builder.initial_commit();
|
||||
let commit_b = graph_builder.commit_with_parents(&[&commit_a]);
|
||||
|
@ -920,7 +920,7 @@ fn test_rebase_descendants_basic_branch_update() {
|
|||
.set_local_branch("main".to_string(), RefTarget::Normal(commit_b.id().clone()));
|
||||
let repo = tx.commit();
|
||||
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let commit_b2 =
|
||||
CommitBuilder::for_rewrite_from(&settings, &commit_b).write_to_repo(tx.mut_repo());
|
||||
tx.mut_repo().rebase_descendants(&settings).unwrap();
|
||||
|
@ -951,7 +951,7 @@ fn test_rebase_descendants_branch_move_two_steps() {
|
|||
// B B2 B2
|
||||
// |/ |
|
||||
// A A
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut graph_builder = CommitGraphBuilder::new(&settings, tx.mut_repo());
|
||||
let commit_a = graph_builder.initial_commit();
|
||||
let commit_b = graph_builder.commit_with_parents(&[&commit_a]);
|
||||
|
@ -960,7 +960,7 @@ fn test_rebase_descendants_branch_move_two_steps() {
|
|||
.set_local_branch("main".to_string(), RefTarget::Normal(commit_c.id().clone()));
|
||||
let repo = tx.commit();
|
||||
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let commit_b2 =
|
||||
CommitBuilder::for_rewrite_from(&settings, &commit_b).write_to_repo(tx.mut_repo());
|
||||
let commit_c2 =
|
||||
|
@ -992,7 +992,7 @@ fn test_rebase_descendants_basic_branch_update_with_non_local_branch() {
|
|||
// B main main@origin v1 | B main@origin v1
|
||||
// | => |/
|
||||
// A A
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut graph_builder = CommitGraphBuilder::new(&settings, tx.mut_repo());
|
||||
let commit_a = graph_builder.initial_commit();
|
||||
let commit_b = graph_builder.commit_with_parents(&[&commit_a]);
|
||||
|
@ -1007,7 +1007,7 @@ fn test_rebase_descendants_basic_branch_update_with_non_local_branch() {
|
|||
.set_tag("v1".to_string(), RefTarget::Normal(commit_b.id().clone()));
|
||||
let repo = tx.commit();
|
||||
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let commit_b2 =
|
||||
CommitBuilder::for_rewrite_from(&settings, &commit_b).write_to_repo(tx.mut_repo());
|
||||
tx.mut_repo().rebase_descendants(&settings).unwrap();
|
||||
|
@ -1045,7 +1045,7 @@ fn test_rebase_descendants_update_branch_after_abandon() {
|
|||
// B main
|
||||
// | => A main
|
||||
// A
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut graph_builder = CommitGraphBuilder::new(&settings, tx.mut_repo());
|
||||
let commit_a = graph_builder.initial_commit();
|
||||
let commit_b = graph_builder.commit_with_parents(&[&commit_a]);
|
||||
|
@ -1053,7 +1053,7 @@ fn test_rebase_descendants_update_branch_after_abandon() {
|
|||
.set_local_branch("main".to_string(), RefTarget::Normal(commit_b.id().clone()));
|
||||
let repo = tx.commit();
|
||||
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
tx.mut_repo().record_abandoned_commit(commit_b.id().clone());
|
||||
tx.mut_repo().rebase_descendants(&settings).unwrap();
|
||||
assert_eq!(
|
||||
|
@ -1081,7 +1081,7 @@ fn test_rebase_descendants_update_branches_after_divergent_rewrite() {
|
|||
// B main |/B2 main?
|
||||
// | => |/
|
||||
// A A
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut graph_builder = CommitGraphBuilder::new(&settings, tx.mut_repo());
|
||||
let commit_a = graph_builder.initial_commit();
|
||||
let commit_b = graph_builder.commit_with_parents(&[&commit_a]);
|
||||
|
@ -1089,7 +1089,7 @@ fn test_rebase_descendants_update_branches_after_divergent_rewrite() {
|
|||
.set_local_branch("main".to_string(), RefTarget::Normal(commit_b.id().clone()));
|
||||
let repo = tx.commit();
|
||||
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let commit_b2 =
|
||||
CommitBuilder::for_rewrite_from(&settings, &commit_b).write_to_repo(tx.mut_repo());
|
||||
// Different description so they're not the same commit
|
||||
|
@ -1132,7 +1132,7 @@ fn test_rebase_descendants_rewrite_updates_branch_conflict() {
|
|||
// Branch "main" is a conflict removing commit A and adding commits B and C.
|
||||
// A gets rewritten as A2 and A3. B gets rewritten as B2 and B2. The branch
|
||||
// should become a conflict removing A and B, and adding B2, B3, C.
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut graph_builder = CommitGraphBuilder::new(&settings, tx.mut_repo());
|
||||
let commit_a = graph_builder.initial_commit();
|
||||
let commit_b = graph_builder.initial_commit();
|
||||
|
@ -1146,7 +1146,7 @@ fn test_rebase_descendants_rewrite_updates_branch_conflict() {
|
|||
);
|
||||
let repo = tx.commit();
|
||||
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let commit_a2 =
|
||||
CommitBuilder::for_rewrite_from(&settings, &commit_a).write_to_repo(tx.mut_repo());
|
||||
// Different description so they're not the same commit
|
||||
|
@ -1197,7 +1197,7 @@ fn test_rebase_descendants_rewrite_resolves_branch_conflict() {
|
|||
// would result in a conflict removing A and adding B2 and C. However, since C
|
||||
// is a descendant of A, and B2 is a descendant of C, the conflict gets
|
||||
// resolved to B2.
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut graph_builder = CommitGraphBuilder::new(&settings, tx.mut_repo());
|
||||
let commit_a = graph_builder.initial_commit();
|
||||
let commit_b = graph_builder.commit_with_parents(&[&commit_a]);
|
||||
|
@ -1211,7 +1211,7 @@ fn test_rebase_descendants_rewrite_resolves_branch_conflict() {
|
|||
);
|
||||
let repo = tx.commit();
|
||||
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let commit_b2 = CommitBuilder::for_rewrite_from(&settings, &commit_b)
|
||||
.set_parents(vec![commit_c.id().clone()])
|
||||
.write_to_repo(tx.mut_repo());
|
||||
|
@ -1238,7 +1238,7 @@ fn test_rebase_descendants_branch_delete_modify_abandon() {
|
|||
// leaves the branch pointing to "-A+B". We now abandon B. That should
|
||||
// result in the branch pointing to "-A+A=0", so the branch should
|
||||
// be deleted.
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut graph_builder = CommitGraphBuilder::new(&settings, tx.mut_repo());
|
||||
let commit_a = graph_builder.initial_commit();
|
||||
let commit_b = graph_builder.commit_with_parents(&[&commit_a]);
|
||||
|
@ -1251,7 +1251,7 @@ fn test_rebase_descendants_branch_delete_modify_abandon() {
|
|||
);
|
||||
let repo = tx.commit();
|
||||
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
tx.mut_repo().record_abandoned_commit(commit_b.id().clone());
|
||||
tx.mut_repo().rebase_descendants(&settings).unwrap();
|
||||
assert_eq!(tx.mut_repo().get_local_branch("main"), None);
|
||||
|
@ -1270,7 +1270,7 @@ fn test_rebase_descendants_update_checkout(use_git: bool) {
|
|||
// C B
|
||||
// |/
|
||||
// A
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let commit_a = create_random_commit(&settings, repo).write_to_repo(tx.mut_repo());
|
||||
let commit_b = create_random_commit(&settings, repo)
|
||||
.set_parents(vec![commit_a.id().clone()])
|
||||
|
@ -1289,7 +1289,7 @@ fn test_rebase_descendants_update_checkout(use_git: bool) {
|
|||
.unwrap();
|
||||
let repo = tx.commit();
|
||||
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let commit_c = CommitBuilder::for_rewrite_from(&settings, &commit_b)
|
||||
.set_description("C".to_string())
|
||||
.write_to_repo(tx.mut_repo());
|
||||
|
@ -1316,7 +1316,7 @@ fn test_rebase_descendants_update_checkout_abandoned(use_git: bool) {
|
|||
// B
|
||||
// |
|
||||
// A
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let commit_a = create_random_commit(&settings, repo).write_to_repo(tx.mut_repo());
|
||||
let commit_b = create_random_commit(&settings, repo)
|
||||
.set_parents(vec![commit_a.id().clone()])
|
||||
|
@ -1335,7 +1335,7 @@ fn test_rebase_descendants_update_checkout_abandoned(use_git: bool) {
|
|||
.unwrap();
|
||||
let repo = tx.commit();
|
||||
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
tx.mut_repo().record_abandoned_commit(commit_b.id().clone());
|
||||
tx.mut_repo().rebase_descendants(&settings).unwrap();
|
||||
let repo = tx.commit();
|
||||
|
@ -1369,7 +1369,7 @@ fn test_rebase_descendants_update_checkout_abandoned_merge(use_git: bool) {
|
|||
// B C
|
||||
// |/
|
||||
// A
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let commit_a = create_random_commit(&settings, repo).write_to_repo(tx.mut_repo());
|
||||
let commit_b = create_random_commit(&settings, repo)
|
||||
.set_parents(vec![commit_a.id().clone()])
|
||||
|
@ -1386,7 +1386,7 @@ fn test_rebase_descendants_update_checkout_abandoned_merge(use_git: bool) {
|
|||
.unwrap();
|
||||
let repo = tx.commit();
|
||||
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
tx.mut_repo().record_abandoned_commit(commit_d.id().clone());
|
||||
tx.mut_repo().rebase_descendants(&settings).unwrap();
|
||||
let repo = tx.commit();
|
||||
|
|
|
@ -45,7 +45,7 @@ fn test_heads_fork(use_git: bool) {
|
|||
let settings = testutils::user_settings();
|
||||
let test_repo = TestRepo::init(use_git);
|
||||
let repo = &test_repo.repo;
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
|
||||
let mut graph_builder = CommitGraphBuilder::new(&settings, tx.mut_repo());
|
||||
let initial = graph_builder.initial_commit();
|
||||
|
@ -68,7 +68,7 @@ fn test_heads_merge(use_git: bool) {
|
|||
let settings = testutils::user_settings();
|
||||
let test_repo = TestRepo::init(use_git);
|
||||
let repo = &test_repo.repo;
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
|
||||
let mut graph_builder = CommitGraphBuilder::new(&settings, tx.mut_repo());
|
||||
let initial = graph_builder.initial_commit();
|
||||
|
@ -87,7 +87,7 @@ fn test_merge_views_heads() {
|
|||
let test_repo = TestRepo::init(false);
|
||||
let repo = &test_repo.repo;
|
||||
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut_repo = tx.mut_repo();
|
||||
let head_unchanged = create_random_commit(&settings, repo).write_to_repo(mut_repo);
|
||||
let head_remove_tx1 = create_random_commit(&settings, repo).write_to_repo(mut_repo);
|
||||
|
@ -100,7 +100,7 @@ fn test_merge_views_heads() {
|
|||
mut_repo.add_public_head(&public_head_remove_tx2);
|
||||
let repo = tx.commit();
|
||||
|
||||
let mut tx1 = repo.start_transaction("test");
|
||||
let mut tx1 = repo.start_transaction(&settings, "test");
|
||||
tx1.mut_repo().remove_head(head_remove_tx1.id());
|
||||
tx1.mut_repo()
|
||||
.remove_public_head(public_head_remove_tx1.id());
|
||||
|
@ -109,7 +109,7 @@ fn test_merge_views_heads() {
|
|||
tx1.mut_repo().add_public_head(&public_head_add_tx1);
|
||||
tx1.commit();
|
||||
|
||||
let mut tx2 = repo.start_transaction("test");
|
||||
let mut tx2 = repo.start_transaction(&settings, "test");
|
||||
tx2.mut_repo().remove_head(head_remove_tx2.id());
|
||||
tx2.mut_repo()
|
||||
.remove_public_head(public_head_remove_tx2.id());
|
||||
|
@ -154,7 +154,7 @@ fn test_merge_views_checkout() {
|
|||
// Workspace 5 gets deleted in tx2 and modified in tx1.
|
||||
// Workspace 6 gets added in tx1.
|
||||
// Workspace 7 gets added in tx2.
|
||||
let mut initial_tx = repo.start_transaction("test");
|
||||
let mut initial_tx = repo.start_transaction(&settings, "test");
|
||||
let commit1 = create_random_commit(&settings, repo).write_to_repo(initial_tx.mut_repo());
|
||||
let commit2 = create_random_commit(&settings, repo).write_to_repo(initial_tx.mut_repo());
|
||||
let commit3 = create_random_commit(&settings, repo).write_to_repo(initial_tx.mut_repo());
|
||||
|
@ -187,7 +187,7 @@ fn test_merge_views_checkout() {
|
|||
.unwrap();
|
||||
let repo = initial_tx.commit();
|
||||
|
||||
let mut tx1 = repo.start_transaction("test");
|
||||
let mut tx1 = repo.start_transaction(&settings, "test");
|
||||
tx1.mut_repo()
|
||||
.set_wc_commit(ws1_id.clone(), commit2.id().clone())
|
||||
.unwrap();
|
||||
|
@ -203,7 +203,7 @@ fn test_merge_views_checkout() {
|
|||
.unwrap();
|
||||
tx1.commit();
|
||||
|
||||
let mut tx2 = repo.start_transaction("test");
|
||||
let mut tx2 = repo.start_transaction(&settings, "test");
|
||||
tx2.mut_repo()
|
||||
.set_wc_commit(ws1_id.clone(), commit3.id().clone())
|
||||
.unwrap();
|
||||
|
@ -243,7 +243,7 @@ fn test_merge_views_branches() {
|
|||
let test_repo = TestRepo::init(false);
|
||||
let repo = &test_repo.repo;
|
||||
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut_repo = tx.mut_repo();
|
||||
let main_branch_local_tx0 = create_random_commit(&settings, repo).write_to_repo(mut_repo);
|
||||
let main_branch_origin_tx0 = create_random_commit(&settings, repo).write_to_repo(mut_repo);
|
||||
|
@ -270,7 +270,7 @@ fn test_merge_views_branches() {
|
|||
);
|
||||
let repo = tx.commit();
|
||||
|
||||
let mut tx1 = repo.start_transaction("test");
|
||||
let mut tx1 = repo.start_transaction(&settings, "test");
|
||||
let main_branch_local_tx1 =
|
||||
create_random_commit(&settings, &repo).write_to_repo(tx1.mut_repo());
|
||||
tx1.mut_repo().set_local_branch(
|
||||
|
@ -289,7 +289,7 @@ fn test_merge_views_branches() {
|
|||
);
|
||||
tx1.commit();
|
||||
|
||||
let mut tx2 = repo.start_transaction("test");
|
||||
let mut tx2 = repo.start_transaction(&settings, "test");
|
||||
let main_branch_local_tx2 =
|
||||
create_random_commit(&settings, &repo).write_to_repo(tx2.mut_repo());
|
||||
tx2.mut_repo().set_local_branch(
|
||||
|
@ -338,7 +338,7 @@ fn test_merge_views_tags() {
|
|||
let test_repo = TestRepo::init(false);
|
||||
let repo = &test_repo.repo;
|
||||
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut_repo = tx.mut_repo();
|
||||
let v1_tx0 = create_random_commit(&settings, repo).write_to_repo(mut_repo);
|
||||
mut_repo.set_tag("v1.0".to_string(), RefTarget::Normal(v1_tx0.id().clone()));
|
||||
|
@ -346,7 +346,7 @@ fn test_merge_views_tags() {
|
|||
mut_repo.set_tag("v2.0".to_string(), RefTarget::Normal(v2_tx0.id().clone()));
|
||||
let repo = tx.commit();
|
||||
|
||||
let mut tx1 = repo.start_transaction("test");
|
||||
let mut tx1 = repo.start_transaction(&settings, "test");
|
||||
let v1_tx1 = create_random_commit(&settings, &repo).write_to_repo(tx1.mut_repo());
|
||||
tx1.mut_repo()
|
||||
.set_tag("v1.0".to_string(), RefTarget::Normal(v1_tx1.id().clone()));
|
||||
|
@ -355,7 +355,7 @@ fn test_merge_views_tags() {
|
|||
.set_tag("v2.0".to_string(), RefTarget::Normal(v2_tx1.id().clone()));
|
||||
tx1.commit();
|
||||
|
||||
let mut tx2 = repo.start_transaction("test");
|
||||
let mut tx2 = repo.start_transaction(&settings, "test");
|
||||
let v1_tx2 = create_random_commit(&settings, &repo).write_to_repo(tx2.mut_repo());
|
||||
tx2.mut_repo()
|
||||
.set_tag("v1.0".to_string(), RefTarget::Normal(v1_tx2.id().clone()));
|
||||
|
@ -384,7 +384,7 @@ fn test_merge_views_git_refs() {
|
|||
let test_repo = TestRepo::init(false);
|
||||
let repo = &test_repo.repo;
|
||||
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut_repo = tx.mut_repo();
|
||||
let main_branch_tx0 = create_random_commit(&settings, repo).write_to_repo(mut_repo);
|
||||
mut_repo.set_git_ref(
|
||||
|
@ -398,7 +398,7 @@ fn test_merge_views_git_refs() {
|
|||
);
|
||||
let repo = tx.commit();
|
||||
|
||||
let mut tx1 = repo.start_transaction("test");
|
||||
let mut tx1 = repo.start_transaction(&settings, "test");
|
||||
let main_branch_tx1 = create_random_commit(&settings, &repo).write_to_repo(tx1.mut_repo());
|
||||
tx1.mut_repo().set_git_ref(
|
||||
"refs/heads/main".to_string(),
|
||||
|
@ -411,7 +411,7 @@ fn test_merge_views_git_refs() {
|
|||
);
|
||||
tx1.commit();
|
||||
|
||||
let mut tx2 = repo.start_transaction("test");
|
||||
let mut tx2 = repo.start_transaction(&settings, "test");
|
||||
let main_branch_tx2 = create_random_commit(&settings, &repo).write_to_repo(tx2.mut_repo());
|
||||
tx2.mut_repo().set_git_ref(
|
||||
"refs/heads/main".to_string(),
|
||||
|
@ -459,16 +459,16 @@ fn test_merge_views_child_on_rewritten(child_first: bool) {
|
|||
let settings = testutils::user_settings();
|
||||
let test_repo = TestRepo::init(false);
|
||||
|
||||
let mut tx = test_repo.repo.start_transaction("test");
|
||||
let mut tx = test_repo.repo.start_transaction(&settings, "test");
|
||||
let commit_a = create_random_commit(&settings, &test_repo.repo).write_to_repo(tx.mut_repo());
|
||||
let repo = tx.commit();
|
||||
|
||||
let mut tx1 = repo.start_transaction("test");
|
||||
let mut tx1 = repo.start_transaction(&settings, "test");
|
||||
let commit_b = create_random_commit(&settings, &repo)
|
||||
.set_parents(vec![commit_a.id().clone()])
|
||||
.write_to_repo(tx1.mut_repo());
|
||||
|
||||
let mut tx2 = repo.start_transaction("test");
|
||||
let mut tx2 = repo.start_transaction(&settings, "test");
|
||||
let commit_a2 = CommitBuilder::for_rewrite_from(&settings, &commit_a)
|
||||
.set_description("A2".to_string())
|
||||
.write_to_repo(tx2.mut_repo());
|
||||
|
@ -501,20 +501,20 @@ fn test_merge_views_child_on_rewritten_divergent(on_rewritten: bool, child_first
|
|||
let settings = testutils::user_settings();
|
||||
let test_repo = TestRepo::init(false);
|
||||
|
||||
let mut tx = test_repo.repo.start_transaction("test");
|
||||
let mut tx = test_repo.repo.start_transaction(&settings, "test");
|
||||
let commit_a2 = create_random_commit(&settings, &test_repo.repo).write_to_repo(tx.mut_repo());
|
||||
let commit_a3 = create_random_commit(&settings, &test_repo.repo)
|
||||
.set_change_id(commit_a2.change_id().clone())
|
||||
.write_to_repo(tx.mut_repo());
|
||||
let repo = tx.commit();
|
||||
|
||||
let mut tx1 = repo.start_transaction("test");
|
||||
let mut tx1 = repo.start_transaction(&settings, "test");
|
||||
let parent = if on_rewritten { &commit_a2 } else { &commit_a3 };
|
||||
let commit_b = create_random_commit(&settings, &repo)
|
||||
.set_parents(vec![parent.id().clone()])
|
||||
.write_to_repo(tx1.mut_repo());
|
||||
|
||||
let mut tx2 = repo.start_transaction("test");
|
||||
let mut tx2 = repo.start_transaction(&settings, "test");
|
||||
let commit_a4 = CommitBuilder::for_rewrite_from(&settings, &commit_a2)
|
||||
.set_description("A4".to_string())
|
||||
.write_to_repo(tx2.mut_repo());
|
||||
|
@ -552,19 +552,19 @@ fn test_merge_views_child_on_abandoned(child_first: bool) {
|
|||
let settings = testutils::user_settings();
|
||||
let test_repo = TestRepo::init(false);
|
||||
|
||||
let mut tx = test_repo.repo.start_transaction("test");
|
||||
let mut tx = test_repo.repo.start_transaction(&settings, "test");
|
||||
let commit_a = create_random_commit(&settings, &test_repo.repo).write_to_repo(tx.mut_repo());
|
||||
let commit_b = create_random_commit(&settings, &test_repo.repo)
|
||||
.set_parents(vec![commit_a.id().clone()])
|
||||
.write_to_repo(tx.mut_repo());
|
||||
let repo = tx.commit();
|
||||
|
||||
let mut tx1 = repo.start_transaction("test");
|
||||
let mut tx1 = repo.start_transaction(&settings, "test");
|
||||
let commit_c = create_random_commit(&settings, &repo)
|
||||
.set_parents(vec![commit_b.id().clone()])
|
||||
.write_to_repo(tx1.mut_repo());
|
||||
|
||||
let mut tx2 = repo.start_transaction("test");
|
||||
let mut tx2 = repo.start_transaction(&settings, "test");
|
||||
tx2.mut_repo()
|
||||
.record_abandoned_commit(commit_b.id().clone());
|
||||
tx2.mut_repo().rebase_descendants(&settings).unwrap();
|
||||
|
|
|
@ -163,7 +163,7 @@ fn test_checkout_file_transitions(use_git: bool) {
|
|||
TreeValue::Tree(id)
|
||||
}
|
||||
Kind::GitSubmodule => {
|
||||
let mut tx = repo.start_transaction("test");
|
||||
let mut tx = repo.start_transaction(settings, "test");
|
||||
let id = create_random_commit(settings, repo)
|
||||
.write_to_repo(tx.mut_repo())
|
||||
.id()
|
||||
|
|
|
@ -717,7 +717,9 @@ impl WorkspaceCommandHelper {
|
|||
}
|
||||
let new_tree_id = locked_wc.snapshot(base_ignores)?;
|
||||
if new_tree_id != *wc_commit.tree_id() {
|
||||
let mut tx = self.repo.start_transaction("commit working copy");
|
||||
let mut tx = self
|
||||
.repo
|
||||
.start_transaction(&self.settings, "commit working copy");
|
||||
let mut_repo = tx.mut_repo();
|
||||
let commit = CommitBuilder::for_rewrite_from(&self.settings, &wc_commit)
|
||||
.set_tree(new_tree_id)
|
||||
|
@ -797,7 +799,7 @@ impl WorkspaceCommandHelper {
|
|||
}
|
||||
|
||||
pub fn start_transaction(&self, description: &str) -> Transaction {
|
||||
let mut tx = self.repo.start_transaction(description);
|
||||
let mut tx = self.repo.start_transaction(&self.settings, description);
|
||||
// TODO: Either do better shell-escaping here or store the values in some list
|
||||
// type (which we currently don't have).
|
||||
let shell_escape = |arg: &String| {
|
||||
|
|
|
@ -89,6 +89,21 @@ fn test_op_log() {
|
|||
"###);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_op_log_configurable() {
|
||||
let test_env = TestEnvironment::default();
|
||||
test_env.add_config(
|
||||
br#"operation.hostname = "my-hostname"
|
||||
operation.username = "my-username"
|
||||
"#,
|
||||
);
|
||||
test_env.jj_cmd_success(test_env.env_root(), &["init", "repo", "--git"]);
|
||||
let repo_path = test_env.env_root().join("repo");
|
||||
|
||||
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "log"]);
|
||||
assert!(stdout.contains("my-username@my-hostname"));
|
||||
}
|
||||
|
||||
fn get_log_output(test_env: &TestEnvironment, repo_path: &Path, op_id: &str) -> String {
|
||||
test_env.jj_cmd_success(
|
||||
repo_path,
|
||||
|
|
Loading…
Reference in a new issue