store: propagate error from Backend::write_commit()

This commit is contained in:
Martin von Zweigbergk 2022-12-23 21:09:19 -08:00 committed by Martin von Zweigbergk
parent f1d7bbe508
commit f3208f59c4
19 changed files with 258 additions and 147 deletions

View File

@ -44,7 +44,7 @@ fn run(ui: &mut Ui) -> Result<(), CommandError> {
let mut tx = workspace_command.start_transaction("Frobnicate");
let new_commit = CommitBuilder::for_rewrite_from(tx.mut_repo(), ui.settings(), &commit)
.set_description("Frobnicated!")
.write();
.write()?;
workspace_command.finish_transaction(ui, tx)?;
writeln!(
ui,

View File

@ -15,7 +15,7 @@
use uuid::Uuid;
use crate::backend;
use crate::backend::{ChangeId, CommitId, Signature, TreeId};
use crate::backend::{BackendResult, ChangeId, CommitId, Signature, TreeId};
use crate::commit::Commit;
use crate::repo::MutableRepo;
use crate::settings::UserSettings;
@ -119,18 +119,18 @@ impl CommitBuilder<'_> {
self
}
pub fn write(self) -> Commit {
pub fn write(self) -> BackendResult<Commit> {
let mut rewrite_source_id = None;
if let Some(rewrite_source) = self.rewrite_source {
if *rewrite_source.change_id() == self.commit.change_id {
rewrite_source_id.replace(rewrite_source.id().clone());
}
}
let commit = self.mut_repo.write_commit(self.commit);
let commit = self.mut_repo.write_commit(self.commit)?;
if let Some(rewrite_source_id) = rewrite_source_id {
self.mut_repo
.record_rewritten_commit(rewrite_source_id, commit.id().clone())
}
commit
Ok(commit)
}
}

View File

@ -24,7 +24,7 @@ use once_cell::sync::OnceCell;
use thiserror::Error;
use self::dirty_cell::DirtyCell;
use crate::backend::{Backend, BackendError, ChangeId, CommitId};
use crate::backend::{Backend, BackendError, BackendResult, ChangeId, CommitId};
use crate::commit::Commit;
use crate::commit_builder::CommitBuilder;
use crate::dag_walk::topo_order_reverse;
@ -617,10 +617,10 @@ impl MutableRepo {
(self.index, self.view.into_inner())
}
pub fn write_commit(&mut self, commit: backend::Commit) -> Commit {
let commit = self.store().write_commit(commit);
pub fn write_commit(&mut self, commit: backend::Commit) -> BackendResult<Commit> {
let commit = self.store().write_commit(commit)?;
self.add_head(&commit);
commit
Ok(commit)
}
/// Record a commit as having been rewritten in this transaction. This
@ -705,7 +705,7 @@ impl MutableRepo {
workspace_id: WorkspaceId,
settings: &UserSettings,
commit: &Commit,
) -> Commit {
) -> BackendResult<Commit> {
self.leave_commit(&workspace_id);
let wc_commit = CommitBuilder::for_new_commit(
self,
@ -713,10 +713,10 @@ impl MutableRepo {
vec![commit.id().clone()],
commit.tree_id().clone(),
)
.write();
.write()?;
self.set_wc_commit(workspace_id, wc_commit.id().clone())
.unwrap();
wc_commit
Ok(wc_commit)
}
pub fn edit(

View File

@ -16,7 +16,7 @@ use std::collections::{HashMap, HashSet};
use itertools::{process_results, Itertools};
use crate::backend::{BackendError, CommitId};
use crate::backend::{BackendError, BackendResult, CommitId};
use crate::commit::Commit;
use crate::commit_builder::CommitBuilder;
use crate::dag_walk;
@ -60,7 +60,7 @@ pub fn rebase_commit(
mut_repo: &mut MutableRepo,
old_commit: &Commit,
new_parents: &[Commit],
) -> Commit {
) -> BackendResult<Commit> {
let old_parents = old_commit.parents();
let old_parent_trees = old_parents
.iter()
@ -94,7 +94,7 @@ pub fn back_out_commit(
mut_repo: &mut MutableRepo,
old_commit: &Commit,
new_parents: &[Commit],
) -> Commit {
) -> BackendResult<Commit> {
let old_base_tree = merge_commit_trees(mut_repo.as_repo_ref(), &old_commit.parents());
let new_base_tree = merge_commit_trees(mut_repo.as_repo_ref(), new_parents);
// TODO: pass in labels for the merge parts
@ -357,7 +357,7 @@ impl<'settings, 'repo> DescendantRebaser<'settings, 'repo> {
vec![new_commit.id().clone()],
new_commit.tree_id().clone(),
)
.write()
.write()?
};
for workspace_id in workspaces_to_update.into_iter() {
self.mut_repo.edit(workspace_id, &new_wc_commit).unwrap();
@ -412,7 +412,8 @@ impl<'settings, 'repo> DescendantRebaser<'settings, 'repo> {
.map(|new_parent_id| self.mut_repo.store().get_commit(new_parent_id)),
|iter| iter.collect_vec(),
)?;
let new_commit = rebase_commit(self.settings, self.mut_repo, &old_commit, &new_parents);
let new_commit =
rebase_commit(self.settings, self.mut_repo, &old_commit, &new_parents)?;
self.rebased
.insert(old_commit_id.clone(), new_commit.id().clone());
self.update_references(old_commit_id, vec![new_commit.id().clone()], true)?;

View File

@ -82,16 +82,16 @@ impl Store {
Ok(data)
}
pub fn write_commit(self: &Arc<Self>, commit: backend::Commit) -> Commit {
pub fn write_commit(self: &Arc<Self>, commit: backend::Commit) -> BackendResult<Commit> {
assert!(!commit.parents.is_empty());
let commit_id = self.backend.write_commit(&commit).unwrap();
let commit_id = self.backend.write_commit(&commit)?;
let data = Arc::new(commit);
{
let mut write_locked_cache = self.commit_cache.write().unwrap();
write_locked_cache.insert(commit_id.clone(), data.clone());
}
Commit::new(self.clone(), commit_id, data)
Ok(Commit::new(self.clone(), commit_id, data))
}
pub fn get_tree(self: &Arc<Self>, dir: &RepoPath, id: &TreeId) -> BackendResult<Tree> {

View File

@ -19,7 +19,7 @@ use std::sync::Arc;
use thiserror::Error;
use crate::backend::Backend;
use crate::backend::{Backend, BackendError};
use crate::git_backend::GitBackend;
use crate::local_backend::LocalBackend;
use crate::op_heads_store::OpHeadsStore;
@ -36,6 +36,8 @@ pub enum WorkspaceInitError {
#[error("Repo path could not be interpreted as Unicode text")]
NonUnicodePath,
#[error(transparent)]
BackendError(#[from] BackendError),
#[error(transparent)]
Path(#[from] PathError),
}
@ -90,7 +92,7 @@ fn init_working_copy(
workspace_id.clone(),
user_settings,
&repo.store().root_commit(),
);
)?;
let repo = tx.commit();
let working_copy = WorkingCopy::init(

View File

@ -101,7 +101,8 @@ fn test_bad_locking_children(use_git: bool) {
let mut tx = repo.start_transaction(&settings, "test");
let initial = create_random_commit(tx.mut_repo(), &settings)
.set_parents(vec![repo.store().root_commit_id().clone()])
.write();
.write()
.unwrap();
tx.commit();
// Simulate a write of a commit that happens on one machine
@ -117,7 +118,8 @@ fn test_bad_locking_children(use_git: bool) {
let mut machine1_tx = machine1_repo.start_transaction(&settings, "test");
let child1 = create_random_commit(machine1_tx.mut_repo(), &settings)
.set_parents(vec![initial.id().clone()])
.write();
.write()
.unwrap();
machine1_tx.commit();
// Simulate a write of a commit that happens on another machine
@ -133,7 +135,8 @@ fn test_bad_locking_children(use_git: bool) {
let mut machine2_tx = machine2_repo.start_transaction(&settings, "test");
let child2 = create_random_commit(machine2_tx.mut_repo(), &settings)
.set_parents(vec![initial.id().clone()])
.write();
.write()
.unwrap();
machine2_tx.commit();
// Simulate that the distributed file system now has received the changes from
@ -172,7 +175,8 @@ fn test_bad_locking_interrupted(use_git: bool) {
let mut tx = repo.start_transaction(&settings, "test");
let initial = create_random_commit(tx.mut_repo(), &settings)
.set_parents(vec![repo.store().root_commit_id().clone()])
.write();
.write()
.unwrap();
let repo = tx.commit();
// Simulate a crash that resulted in the old op-head left in place. We simulate
@ -185,7 +189,8 @@ fn test_bad_locking_interrupted(use_git: bool) {
let mut tx = repo.start_transaction(&settings, "test");
create_random_commit(tx.mut_repo(), &settings)
.set_parents(vec![initial.id().clone()])
.write();
.write()
.unwrap();
let op_id = tx.commit().operation().id().clone();
copy_directory(backup_path.path(), &op_heads_dir);

View File

@ -45,7 +45,8 @@ fn test_initial(use_git: bool) {
vec![store.root_commit_id().clone()],
tree.id().clone(),
)
.write();
.write()
.unwrap();
tx.commit();
assert_eq!(commit.parents(), vec![store.root_commit()]);
@ -93,7 +94,8 @@ fn test_rewrite(use_git: bool) {
vec![store.root_commit_id().clone()],
initial_tree.id().clone(),
)
.write();
.write()
.unwrap();
let repo = tx.commit();
let rewritten_tree = testutils::create_tree(
@ -116,7 +118,8 @@ fn test_rewrite(use_git: bool) {
let rewritten_commit =
CommitBuilder::for_rewrite_from(tx.mut_repo(), &rewrite_settings, &initial_commit)
.set_tree(rewritten_tree.id().clone())
.write();
.write()
.unwrap();
tx.mut_repo().rebase_descendants(&settings).unwrap();
tx.commit();
assert_eq!(rewritten_commit.parents(), vec![store.root_commit()]);
@ -174,7 +177,8 @@ fn test_rewrite_update_missing_user(use_git: bool) {
vec![repo.store().root_commit_id().clone()],
repo.store().empty_tree_id().clone(),
)
.write();
.write()
.unwrap();
assert_eq!(initial_commit.author().name, "(no name configured)");
assert_eq!(initial_commit.author().email, "(no email configured)");
assert_eq!(initial_commit.committer().name, "(no name configured)");
@ -189,7 +193,9 @@ fn test_rewrite_update_missing_user(use_git: bool) {
.unwrap();
let settings = UserSettings::from_config(config);
let rewritten_commit =
CommitBuilder::for_rewrite_from(tx.mut_repo(), &settings, &initial_commit).write();
CommitBuilder::for_rewrite_from(tx.mut_repo(), &settings, &initial_commit)
.write()
.unwrap();
assert_eq!(rewritten_commit.author().name, "Configured User");
assert_eq!(
@ -226,13 +232,16 @@ fn test_commit_builder_descendants(use_git: bool) {
vec![store.root_commit_id().clone()],
store.empty_tree_id().clone(),
)
.write();
.write()
.unwrap();
let mut rebaser = tx.mut_repo().create_descendant_rebaser(&settings);
assert!(rebaser.rebase_next().unwrap().is_none());
// Test with for_rewrite_from()
let mut tx = repo.start_transaction(&settings, "test");
let commit4 = CommitBuilder::for_rewrite_from(tx.mut_repo(), &settings, &commit2).write();
let commit4 = CommitBuilder::for_rewrite_from(tx.mut_repo(), &settings, &commit2)
.write()
.unwrap();
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());
@ -241,7 +250,8 @@ fn test_commit_builder_descendants(use_git: bool) {
let mut tx = repo.start_transaction(&settings, "test");
CommitBuilder::for_rewrite_from(tx.mut_repo(), &settings, &commit2)
.generate_new_change_id()
.write();
.write()
.unwrap();
let mut rebaser = tx.mut_repo().create_descendant_rebaser(&settings);
assert!(rebaser.rebase_next().unwrap().is_none());
}

View File

@ -178,7 +178,8 @@ fn test_import_refs_reimport() {
let mut tx = repo.start_transaction(&settings, "test");
let commit6 = create_random_commit(tx.mut_repo(), &settings)
.set_parents(vec![jj_id(&commit2)])
.write();
.write()
.unwrap();
tx.mut_repo().set_local_branch(
"feature2".to_string(),
RefTarget::Normal(commit6.id().clone()),
@ -460,7 +461,8 @@ fn test_export_refs_branch_changed() {
let new_commit = create_random_commit(mut_repo, &test_data.settings)
.set_parents(vec![jj_id(&commit)])
.write();
.write()
.unwrap();
mut_repo.set_local_branch(
"main".to_string(),
RefTarget::Normal(new_commit.id().clone()),
@ -500,7 +502,8 @@ fn test_export_refs_current_branch_changed() {
let new_commit = create_random_commit(mut_repo, &test_data.settings)
.set_parents(vec![jj_id(&commit1)])
.write();
.write()
.unwrap();
mut_repo.set_local_branch(
"main".to_string(),
RefTarget::Normal(new_commit.id().clone()),
@ -1106,7 +1109,8 @@ fn set_up_push_repos(settings: &UserSettings, temp_dir: &TempDir) -> PushTestSet
let mut tx = jj_repo.start_transaction(settings, "test");
let new_commit = create_random_commit(tx.mut_repo(), settings)
.set_parents(vec![jj_id(&initial_git_commit)])
.write();
.write()
.unwrap();
let jj_repo = tx.commit();
PushTestSetup {
source_repo_dir,

View File

@ -331,7 +331,9 @@ fn test_index_commits_incremental(use_git: bool) {
let root_commit = repo.store().root_commit();
let mut tx = repo.start_transaction(&settings, "test");
let commit_a = child_commit(tx.mut_repo(), &settings, &root_commit).write();
let commit_a = child_commit(tx.mut_repo(), &settings, &root_commit)
.write()
.unwrap();
let repo = tx.commit();
let index = repo.index();
@ -339,8 +341,12 @@ fn test_index_commits_incremental(use_git: bool) {
assert_eq!(index.num_commits(), 1 + 1);
let mut tx = repo.start_transaction(&settings, "test");
let commit_b = child_commit(tx.mut_repo(), &settings, &commit_a).write();
let commit_c = child_commit(tx.mut_repo(), &settings, &commit_b).write();
let commit_b = child_commit(tx.mut_repo(), &settings, &commit_a)
.write()
.unwrap();
let commit_c = child_commit(tx.mut_repo(), &settings, &commit_b)
.write()
.unwrap();
tx.commit();
let repo = ReadonlyRepo::load_at_head(&settings, repo.repo_path(), &StoreFactories::default())
@ -378,7 +384,9 @@ fn test_index_commits_incremental_empty_transaction(use_git: bool) {
let root_commit = repo.store().root_commit();
let mut tx = repo.start_transaction(&settings, "test");
let commit_a = child_commit(tx.mut_repo(), &settings, &root_commit).write();
let commit_a = child_commit(tx.mut_repo(), &settings, &root_commit)
.write()
.unwrap();
let repo = tx.commit();
let index = repo.index();
@ -420,7 +428,9 @@ fn test_index_commits_incremental_already_indexed(use_git: bool) {
let root_commit = repo.store().root_commit();
let mut tx = repo.start_transaction(&settings, "test");
let commit_a = child_commit(tx.mut_repo(), &settings, &root_commit).write();
let commit_a = child_commit(tx.mut_repo(), &settings, &root_commit)
.write()
.unwrap();
let repo = tx.commit();
assert!(repo.index().has_id(commit_a.id()));

View File

@ -579,7 +579,8 @@ fn test_simplify_conflict_after_resolving_parent(use_git: bool) {
vec![repo.store().root_commit_id().clone()],
tree_a.id().clone(),
)
.write();
.write()
.unwrap();
let tree_b = testutils::create_tree(repo, &[(&path, "Abc\ndef\nghi\n")]);
let commit_b = CommitBuilder::for_new_commit(
tx.mut_repo(),
@ -587,7 +588,8 @@ fn test_simplify_conflict_after_resolving_parent(use_git: bool) {
vec![commit_a.id().clone()],
tree_b.id().clone(),
)
.write();
.write()
.unwrap();
let tree_c = testutils::create_tree(repo, &[(&path, "Abc\ndef\nGhi\n")]);
let commit_c = CommitBuilder::for_new_commit(
tx.mut_repo(),
@ -595,7 +597,8 @@ fn test_simplify_conflict_after_resolving_parent(use_git: bool) {
vec![commit_b.id().clone()],
tree_c.id().clone(),
)
.write();
.write()
.unwrap();
let tree_d = testutils::create_tree(repo, &[(&path, "abC\ndef\nghi\n")]);
let commit_d = CommitBuilder::for_new_commit(
tx.mut_repo(),
@ -603,10 +606,12 @@ fn test_simplify_conflict_after_resolving_parent(use_git: bool) {
vec![commit_a.id().clone()],
tree_d.id().clone(),
)
.write();
.write()
.unwrap();
let commit_b2 = rebase_commit(&settings, tx.mut_repo(), &commit_b, &[commit_d]);
let commit_c2 = rebase_commit(&settings, tx.mut_repo(), &commit_c, &[commit_b2.clone()]);
let commit_b2 = rebase_commit(&settings, tx.mut_repo(), &commit_b, &[commit_d]).unwrap();
let commit_c2 =
rebase_commit(&settings, tx.mut_repo(), &commit_c, &[commit_b2.clone()]).unwrap();
// Test the setup: Both B and C should have conflicts.
assert_matches!(
@ -622,8 +627,9 @@ fn test_simplify_conflict_after_resolving_parent(use_git: bool) {
let tree_b3 = testutils::create_tree(repo, &[(&path, "AbC\ndef\nghi\n")]);
let commit_b3 = CommitBuilder::for_rewrite_from(tx.mut_repo(), &settings, &commit_b2)
.set_tree(tree_b3.id().clone())
.write();
let commit_c3 = rebase_commit(&settings, tx.mut_repo(), &commit_c2, &[commit_b3]);
.write()
.unwrap();
let commit_c3 = rebase_commit(&settings, tx.mut_repo(), &commit_c2, &[commit_b3]).unwrap();
tx.mut_repo().rebase_descendants(&settings).unwrap();
let repo = tx.commit();

View File

@ -55,7 +55,8 @@ fn test_checkout(use_git: bool) {
let ws_id = WorkspaceId::default();
let actual_checkout = tx
.mut_repo()
.check_out(ws_id.clone(), &settings, &requested_checkout);
.check_out(ws_id.clone(), &settings, &requested_checkout)
.unwrap();
assert_eq!(actual_checkout.tree_id(), requested_checkout.tree_id());
assert_eq!(actual_checkout.parents().len(), 1);
assert_eq!(actual_checkout.parents()[0].id(), requested_checkout.id());
@ -107,7 +108,8 @@ fn test_checkout_previous_empty(use_git: bool) {
vec![repo.store().root_commit_id().clone()],
repo.store().empty_tree_id().clone(),
)
.write();
.write()
.unwrap();
let ws_id = WorkspaceId::default();
mut_repo.edit(ws_id.clone(), &old_checkout).unwrap();
let repo = tx.commit();
@ -138,7 +140,8 @@ fn test_checkout_previous_empty_with_description(use_git: bool) {
repo.store().empty_tree_id().clone(),
)
.set_description("not empty")
.write();
.write()
.unwrap();
let ws_id = WorkspaceId::default();
mut_repo.edit(ws_id.clone(), &old_checkout).unwrap();
let repo = tx.commit();
@ -168,14 +171,16 @@ fn test_checkout_previous_empty_non_head(use_git: bool) {
vec![repo.store().root_commit_id().clone()],
repo.store().empty_tree_id().clone(),
)
.write();
.write()
.unwrap();
let old_child = CommitBuilder::for_new_commit(
mut_repo,
&settings,
vec![old_checkout.id().clone()],
old_checkout.tree_id().clone(),
)
.write();
.write()
.unwrap();
let ws_id = WorkspaceId::default();
mut_repo.edit(ws_id.clone(), &old_checkout).unwrap();
let repo = tx.commit();
@ -298,10 +303,12 @@ fn test_add_head_not_immediate_child(use_git: bool) {
let rewritten = create_random_commit(tx.mut_repo(), &settings)
.set_change_id(initial.change_id().clone())
.set_predecessors(vec![initial.id().clone()])
.write();
.write()
.unwrap();
let child = create_random_commit(tx.mut_repo(), &settings)
.set_parents(vec![rewritten.id().clone()])
.write();
.write()
.unwrap();
drop(tx);
let index_stats = repo.index().stats();

View File

@ -139,7 +139,8 @@ fn test_isolation(use_git: bool) {
let mut tx = repo.start_transaction(&settings, "test");
let initial = create_random_commit(tx.mut_repo(), &settings)
.set_parents(vec![repo.store().root_commit_id().clone()])
.write();
.write()
.unwrap();
let repo = tx.commit();
let mut tx1 = repo.start_transaction(&settings, "transaction 1");
@ -153,11 +154,13 @@ fn test_isolation(use_git: bool) {
let rewrite1 = CommitBuilder::for_rewrite_from(mut_repo1, &settings, &initial)
.set_description("rewrite1")
.write();
.write()
.unwrap();
mut_repo1.rebase_descendants(&settings).unwrap();
let rewrite2 = CommitBuilder::for_rewrite_from(mut_repo2, &settings, &initial)
.set_description("rewrite2")
.write();
.write()
.unwrap();
mut_repo2.rebase_descendants(&settings).unwrap();
// Neither transaction has committed yet, so each transaction sees its own

View File

@ -72,7 +72,8 @@ fn test_resolve_symbol_commit_id() {
.set_description(format!("test {i}"))
.set_author(signature.clone())
.set_committer(signature.clone())
.write();
.write()
.unwrap();
commits.push(commit);
}
let repo = tx.commit();
@ -752,16 +753,20 @@ fn test_evaluate_expression_children(use_git: bool) {
let commit1 = write_random_commit(mut_repo, &settings);
let commit2 = create_random_commit(mut_repo, &settings)
.set_parents(vec![commit1.id().clone()])
.write();
.write()
.unwrap();
let commit3 = create_random_commit(mut_repo, &settings)
.set_parents(vec![commit2.id().clone()])
.write();
.write()
.unwrap();
let commit4 = create_random_commit(mut_repo, &settings)
.set_parents(vec![commit1.id().clone()])
.write();
.write()
.unwrap();
let commit5 = create_random_commit(mut_repo, &settings)
.set_parents(vec![commit3.id().clone(), commit4.id().clone()])
.write();
.write()
.unwrap();
// Can find children of the root commit
assert_eq!(
@ -1093,16 +1098,20 @@ fn test_evaluate_expression_descendants(use_git: bool) {
let commit1 = write_random_commit(mut_repo, &settings);
let commit2 = create_random_commit(mut_repo, &settings)
.set_parents(vec![commit1.id().clone()])
.write();
.write()
.unwrap();
let commit3 = create_random_commit(mut_repo, &settings)
.set_parents(vec![commit2.id().clone()])
.write();
.write()
.unwrap();
let commit4 = create_random_commit(mut_repo, &settings)
.set_parents(vec![commit1.id().clone()])
.write();
.write()
.unwrap();
let commit5 = create_random_commit(mut_repo, &settings)
.set_parents(vec![commit3.id().clone(), commit4.id().clone()])
.write();
.write()
.unwrap();
// The descendants of the root commit are all the commits in the repo
assert_eq!(
@ -1504,15 +1513,18 @@ fn test_evaluate_expression_description(use_git: bool) {
let commit1 = create_random_commit(mut_repo, &settings)
.set_description("commit 1")
.write();
.write()
.unwrap();
let commit2 = create_random_commit(mut_repo, &settings)
.set_parents(vec![commit1.id().clone()])
.set_description("commit 2")
.write();
.write()
.unwrap();
let commit3 = create_random_commit(mut_repo, &settings)
.set_parents(vec![commit2.id().clone()])
.set_description("commit 3")
.write();
.write()
.unwrap();
// Can find multiple matches
assert_eq!(
@ -1558,7 +1570,8 @@ fn test_evaluate_expression_author(use_git: bool) {
email: "email1".to_string(),
timestamp: timestamp.clone(),
})
.write();
.write()
.unwrap();
let commit2 = create_random_commit(mut_repo, &settings)
.set_parents(vec![commit1.id().clone()])
.set_author(Signature {
@ -1566,7 +1579,8 @@ fn test_evaluate_expression_author(use_git: bool) {
email: "email2".to_string(),
timestamp: timestamp.clone(),
})
.write();
.write()
.unwrap();
let commit3 = create_random_commit(mut_repo, &settings)
.set_parents(vec![commit2.id().clone()])
.set_author(Signature {
@ -1574,7 +1588,8 @@ fn test_evaluate_expression_author(use_git: bool) {
email: "email3".to_string(),
timestamp,
})
.write();
.write()
.unwrap();
// Can find multiple matches
assert_eq!(
@ -1629,7 +1644,8 @@ fn test_evaluate_expression_committer(use_git: bool) {
email: "email1".to_string(),
timestamp: timestamp.clone(),
})
.write();
.write()
.unwrap();
let commit2 = create_random_commit(mut_repo, &settings)
.set_parents(vec![commit1.id().clone()])
.set_committer(Signature {
@ -1637,7 +1653,8 @@ fn test_evaluate_expression_committer(use_git: bool) {
email: "email2".to_string(),
timestamp: timestamp.clone(),
})
.write();
.write()
.unwrap();
let commit3 = create_random_commit(mut_repo, &settings)
.set_parents(vec![commit2.id().clone()])
.set_committer(Signature {
@ -1645,7 +1662,8 @@ fn test_evaluate_expression_committer(use_git: bool) {
email: "email3".to_string(),
timestamp,
})
.write();
.write()
.unwrap();
// Can find multiple matches
assert_eq!(
@ -1915,28 +1933,32 @@ fn test_filter_by_diff(use_git: bool) {
vec![repo.store().root_commit_id().clone()],
tree1.id().clone(),
)
.write();
.write()
.unwrap();
let commit2 = CommitBuilder::for_new_commit(
mut_repo,
&settings,
vec![commit1.id().clone()],
tree2.id().clone(),
)
.write();
.write()
.unwrap();
let commit3 = CommitBuilder::for_new_commit(
mut_repo,
&settings,
vec![commit2.id().clone()],
tree3.id().clone(),
)
.write();
.write()
.unwrap();
let commit4 = CommitBuilder::for_new_commit(
mut_repo,
&settings,
vec![commit3.id().clone()],
tree3.id().clone(),
)
.write();
.write()
.unwrap();
// matcher API:
let resolve = |file_path: &RepoPath| -> Vec<CommitId> {

View File

@ -796,7 +796,8 @@ fn test_rebase_descendants_repeated(use_git: bool) {
let commit_b2 = CommitBuilder::for_rewrite_from(tx.mut_repo(), &settings, &commit_b)
.set_description("b2")
.write();
.write()
.unwrap();
let mut rebaser = tx.mut_repo().create_descendant_rebaser(&settings);
let commit_c2 = assert_rebased(rebaser.rebase_next().unwrap(), &commit_c, &[&commit_b2]);
assert!(rebaser.rebase_next().unwrap().is_none());
@ -817,7 +818,8 @@ fn test_rebase_descendants_repeated(use_git: bool) {
// Now mark B3 as rewritten from B2 and rebase descendants again.
let commit_b3 = CommitBuilder::for_rewrite_from(tx.mut_repo(), &settings, &commit_b2)
.set_description("b3")
.write();
.write()
.unwrap();
let mut rebaser = tx.mut_repo().create_descendant_rebaser(&settings);
let commit_c3 = assert_rebased(rebaser.rebase_next().unwrap(), &commit_c2, &[&commit_b3]);
assert!(rebaser.rebase_next().unwrap().is_none());
@ -856,7 +858,8 @@ fn test_rebase_descendants_contents(use_git: bool) {
vec![repo.store().root_commit_id().clone()],
tree1.id().clone(),
)
.write();
.write()
.unwrap();
let path2 = RepoPath::from_internal_string("file2");
let tree2 = testutils::create_tree(repo, &[(&path2, "content")]);
let commit_b = CommitBuilder::for_new_commit(
@ -865,7 +868,8 @@ fn test_rebase_descendants_contents(use_git: bool) {
vec![commit_a.id().clone()],
tree2.id().clone(),
)
.write();
.write()
.unwrap();
let path3 = RepoPath::from_internal_string("file3");
let tree3 = testutils::create_tree(repo, &[(&path3, "content")]);
let commit_c = CommitBuilder::for_new_commit(
@ -874,7 +878,8 @@ fn test_rebase_descendants_contents(use_git: bool) {
vec![commit_b.id().clone()],
tree3.id().clone(),
)
.write();
.write()
.unwrap();
let path4 = RepoPath::from_internal_string("file4");
let tree4 = testutils::create_tree(repo, &[(&path4, "content")]);
let commit_d = CommitBuilder::for_new_commit(
@ -883,7 +888,8 @@ fn test_rebase_descendants_contents(use_git: bool) {
vec![commit_a.id().clone()],
tree4.id().clone(),
)
.write();
.write()
.unwrap();
let mut rebaser = DescendantRebaser::new(
&settings,
@ -936,7 +942,9 @@ fn test_rebase_descendants_basic_branch_update() {
let repo = tx.commit();
let mut tx = repo.start_transaction(&settings, "test");
let commit_b2 = CommitBuilder::for_rewrite_from(tx.mut_repo(), &settings, &commit_b).write();
let commit_b2 = CommitBuilder::for_rewrite_from(tx.mut_repo(), &settings, &commit_b)
.write()
.unwrap();
tx.mut_repo().rebase_descendants(&settings).unwrap();
assert_eq!(
tx.mut_repo().get_local_branch("main"),
@ -975,8 +983,12 @@ fn test_rebase_descendants_branch_move_two_steps() {
let repo = tx.commit();
let mut tx = repo.start_transaction(&settings, "test");
let commit_b2 = CommitBuilder::for_rewrite_from(tx.mut_repo(), &settings, &commit_b).write();
let commit_c2 = CommitBuilder::for_rewrite_from(tx.mut_repo(), &settings, &commit_c).write();
let commit_b2 = CommitBuilder::for_rewrite_from(tx.mut_repo(), &settings, &commit_b)
.write()
.unwrap();
let commit_c2 = CommitBuilder::for_rewrite_from(tx.mut_repo(), &settings, &commit_c)
.write()
.unwrap();
tx.mut_repo().rebase_descendants(&settings).unwrap();
let heads = tx.mut_repo().view().heads();
assert_eq!(heads.len(), 1);
@ -1020,7 +1032,9 @@ fn test_rebase_descendants_basic_branch_update_with_non_local_branch() {
let repo = tx.commit();
let mut tx = repo.start_transaction(&settings, "test");
let commit_b2 = CommitBuilder::for_rewrite_from(tx.mut_repo(), &settings, &commit_b).write();
let commit_b2 = CommitBuilder::for_rewrite_from(tx.mut_repo(), &settings, &commit_b)
.write()
.unwrap();
tx.mut_repo().rebase_descendants(&settings).unwrap();
assert_eq!(
tx.mut_repo().get_local_branch("main"),
@ -1101,15 +1115,19 @@ fn test_rebase_descendants_update_branches_after_divergent_rewrite() {
let repo = tx.commit();
let mut tx = repo.start_transaction(&settings, "test");
let commit_b2 = CommitBuilder::for_rewrite_from(tx.mut_repo(), &settings, &commit_b).write();
let commit_b2 = CommitBuilder::for_rewrite_from(tx.mut_repo(), &settings, &commit_b)
.write()
.unwrap();
// Different description so they're not the same commit
let commit_b3 = CommitBuilder::for_rewrite_from(tx.mut_repo(), &settings, &commit_b)
.set_description("different")
.write();
.write()
.unwrap();
// Different description so they're not the same commit
let commit_b4 = CommitBuilder::for_rewrite_from(tx.mut_repo(), &settings, &commit_b)
.set_description("more different")
.write();
.write()
.unwrap();
tx.mut_repo().rebase_descendants(&settings).unwrap();
assert_eq!(
tx.mut_repo().get_local_branch("main"),
@ -1157,16 +1175,22 @@ fn test_rebase_descendants_rewrite_updates_branch_conflict() {
let repo = tx.commit();
let mut tx = repo.start_transaction(&settings, "test");
let commit_a2 = CommitBuilder::for_rewrite_from(tx.mut_repo(), &settings, &commit_a).write();
let commit_a2 = CommitBuilder::for_rewrite_from(tx.mut_repo(), &settings, &commit_a)
.write()
.unwrap();
// Different description so they're not the same commit
let commit_a3 = CommitBuilder::for_rewrite_from(tx.mut_repo(), &settings, &commit_a)
.set_description("different")
.write();
let commit_b2 = CommitBuilder::for_rewrite_from(tx.mut_repo(), &settings, &commit_b).write();
.write()
.unwrap();
let commit_b2 = CommitBuilder::for_rewrite_from(tx.mut_repo(), &settings, &commit_b)
.write()
.unwrap();
// Different description so they're not the same commit
let commit_b3 = CommitBuilder::for_rewrite_from(tx.mut_repo(), &settings, &commit_b)
.set_description("different")
.write();
.write()
.unwrap();
tx.mut_repo().rebase_descendants(&settings).unwrap();
assert_eq!(
tx.mut_repo().get_local_branch("main"),
@ -1222,7 +1246,8 @@ fn test_rebase_descendants_rewrite_resolves_branch_conflict() {
let mut tx = repo.start_transaction(&settings, "test");
let commit_b2 = CommitBuilder::for_rewrite_from(tx.mut_repo(), &settings, &commit_b)
.set_parents(vec![commit_c.id().clone()])
.write();
.write()
.unwrap();
tx.mut_repo().rebase_descendants(&settings).unwrap();
assert_eq!(
tx.mut_repo().get_local_branch("main"),
@ -1282,7 +1307,8 @@ fn test_rebase_descendants_update_checkout(use_git: bool) {
let commit_a = write_random_commit(tx.mut_repo(), &settings);
let commit_b = create_random_commit(tx.mut_repo(), &settings)
.set_parents(vec![commit_a.id().clone()])
.write();
.write()
.unwrap();
let ws1_id = WorkspaceId::new("ws1".to_string());
let ws2_id = WorkspaceId::new("ws2".to_string());
let ws3_id = WorkspaceId::new("ws3".to_string());
@ -1300,7 +1326,8 @@ fn test_rebase_descendants_update_checkout(use_git: bool) {
let mut tx = repo.start_transaction(&settings, "test");
let commit_c = CommitBuilder::for_rewrite_from(tx.mut_repo(), &settings, &commit_b)
.set_description("C")
.write();
.write()
.unwrap();
tx.mut_repo().rebase_descendants(&settings).unwrap();
let repo = tx.commit();
@ -1328,7 +1355,8 @@ fn test_rebase_descendants_update_checkout_abandoned(use_git: bool) {
let commit_a = write_random_commit(tx.mut_repo(), &settings);
let commit_b = create_random_commit(tx.mut_repo(), &settings)
.set_parents(vec![commit_a.id().clone()])
.write();
.write()
.unwrap();
let ws1_id = WorkspaceId::new("ws1".to_string());
let ws2_id = WorkspaceId::new("ws2".to_string());
let ws3_id = WorkspaceId::new("ws3".to_string());
@ -1381,13 +1409,16 @@ fn test_rebase_descendants_update_checkout_abandoned_merge(use_git: bool) {
let commit_a = write_random_commit(tx.mut_repo(), &settings);
let commit_b = create_random_commit(tx.mut_repo(), &settings)
.set_parents(vec![commit_a.id().clone()])
.write();
.write()
.unwrap();
let commit_c = create_random_commit(tx.mut_repo(), &settings)
.set_parents(vec![commit_a.id().clone()])
.write();
.write()
.unwrap();
let commit_d = create_random_commit(tx.mut_repo(), &settings)
.set_parents(vec![commit_b.id().clone(), commit_c.id().clone()])
.write();
.write()
.unwrap();
let workspace_id = WorkspaceId::default();
tx.mut_repo()
.set_wc_commit(workspace_id.clone(), commit_d.id().clone())

View File

@ -463,13 +463,15 @@ fn test_merge_views_divergent() {
let mut tx1 = repo.start_transaction(&settings, "test");
let commit_a2 = CommitBuilder::for_rewrite_from(tx1.mut_repo(), &settings, &commit_a)
.set_description("A2")
.write();
.write()
.unwrap();
tx1.mut_repo().rebase_descendants(&settings).unwrap();
let mut tx2 = repo.start_transaction(&settings, "test");
let commit_a3 = CommitBuilder::for_rewrite_from(tx2.mut_repo(), &settings, &commit_a)
.set_description("A3")
.write();
.write()
.unwrap();
tx2.mut_repo().rebase_descendants(&settings).unwrap();
let repo = commit_transactions(&settings, vec![tx1, tx2]);
@ -496,12 +498,14 @@ fn test_merge_views_child_on_rewritten(child_first: bool) {
let mut tx1 = repo.start_transaction(&settings, "test");
let commit_b = create_random_commit(tx1.mut_repo(), &settings)
.set_parents(vec![commit_a.id().clone()])
.write();
.write()
.unwrap();
let mut tx2 = repo.start_transaction(&settings, "test");
let commit_a2 = CommitBuilder::for_rewrite_from(tx2.mut_repo(), &settings, &commit_a)
.set_description("A2")
.write();
.write()
.unwrap();
tx2.mut_repo().rebase_descendants(&settings).unwrap();
let repo = if child_first {
@ -535,19 +539,22 @@ fn test_merge_views_child_on_rewritten_divergent(on_rewritten: bool, child_first
let commit_a2 = write_random_commit(tx.mut_repo(), &settings);
let commit_a3 = create_random_commit(tx.mut_repo(), &settings)
.set_change_id(commit_a2.change_id().clone())
.write();
.write()
.unwrap();
let repo = tx.commit();
let mut tx1 = repo.start_transaction(&settings, "test");
let parent = if on_rewritten { &commit_a2 } else { &commit_a3 };
let commit_b = create_random_commit(tx1.mut_repo(), &settings)
.set_parents(vec![parent.id().clone()])
.write();
.write()
.unwrap();
let mut tx2 = repo.start_transaction(&settings, "test");
let commit_a4 = CommitBuilder::for_rewrite_from(tx2.mut_repo(), &settings, &commit_a2)
.set_description("A4")
.write();
.write()
.unwrap();
tx2.mut_repo().rebase_descendants(&settings).unwrap();
let repo = if child_first {
@ -586,13 +593,15 @@ fn test_merge_views_child_on_abandoned(child_first: bool) {
let commit_a = write_random_commit(tx.mut_repo(), &settings);
let commit_b = create_random_commit(tx.mut_repo(), &settings)
.set_parents(vec![commit_a.id().clone()])
.write();
.write()
.unwrap();
let repo = tx.commit();
let mut tx1 = repo.start_transaction(&settings, "test");
let commit_c = create_random_commit(tx1.mut_repo(), &settings)
.set_parents(vec![commit_b.id().clone()])
.write();
.write()
.unwrap();
let mut tx2 = repo.start_transaction(&settings, "test");
tx2.mut_repo()

View File

@ -225,7 +225,7 @@ pub fn create_random_commit<'repo>(
}
pub fn write_random_commit(mut_repo: &mut MutableRepo, settings: &UserSettings) -> Commit {
create_random_commit(mut_repo, settings).write()
create_random_commit(mut_repo, settings).write().unwrap()
}
pub fn write_working_copy_file(workspace_root: &Path, path: &RepoPath, contents: &str) {
@ -263,6 +263,7 @@ impl<'settings, 'repo> CommitGraphBuilder<'settings, 'repo> {
create_random_commit(self.mut_repo, self.settings)
.set_parents(parent_ids)
.write()
.unwrap()
}
}

View File

@ -444,7 +444,7 @@ impl WorkspaceCommandHelper {
.store()
.get_commit(new_git_head.as_ref().unwrap())?;
tx.mut_repo()
.check_out(workspace_id, &self.settings, &new_checkout);
.check_out(workspace_id, &self.settings, &new_checkout)?;
// The working copy was presumably updated by the git command that updated HEAD,
// so we just need to reset our working copy state to it without updating
// working copy files.
@ -746,7 +746,7 @@ impl WorkspaceCommandHelper {
let mut_repo = tx.mut_repo();
let commit = CommitBuilder::for_rewrite_from(mut_repo, &self.settings, &wc_commit)
.set_tree(new_tree_id)
.write();
.write()?;
mut_repo
.set_wc_commit(workspace_id, commit.id().clone())
.unwrap();

View File

@ -1140,7 +1140,7 @@ fn cmd_init(ui: &mut Ui, command: &CommandHelper, args: &InitArgs) -> Result<(),
workspace_command.workspace_id(),
ui.settings(),
&git_head_commit,
);
)?;
}
if tx.mut_repo().has_changes() {
workspace_command.finish_transaction(ui, tx)?;
@ -1189,7 +1189,7 @@ fn cmd_checkout(
target.tree_id().clone(),
)
.set_description(&args.message);
let new_commit = commit_builder.write();
let new_commit = commit_builder.write()?;
tx.mut_repo().edit(workspace_id, &new_commit).unwrap();
workspace_command.finish_transaction(ui, tx)?;
Ok(())
@ -1248,7 +1248,7 @@ Make sure they're ignored, then try again.",
}
CommitBuilder::for_rewrite_from(tx.mut_repo(), ui.settings(), &wc_commit)
.set_tree(new_tree_id)
.write();
.write()?;
let num_rebased = tx.mut_repo().rebase_descendants(ui.settings())?;
if num_rebased > 0 {
writeln!(ui, "Rebased {num_rebased} descendant commits")?;
@ -1889,7 +1889,7 @@ fn cmd_describe(
workspace_command.start_transaction(&format!("describe commit {}", commit.id().hex()));
CommitBuilder::for_rewrite_from(tx.mut_repo(), ui.settings(), &commit)
.set_description(description)
.write();
.write()?;
workspace_command.finish_transaction(ui, tx)?;
}
Ok(())
@ -1914,7 +1914,7 @@ fn cmd_commit(ui: &mut Ui, command: &CommandHelper, args: &CommitArgs) -> Result
edit_description(ui, workspace_command.repo(), &template)?
};
commit_builder = commit_builder.set_description(description);
let new_commit = commit_builder.write();
let new_commit = commit_builder.write()?;
let workspace_ids = tx
.mut_repo()
.view()
@ -1926,7 +1926,7 @@ fn cmd_commit(ui: &mut Ui, command: &CommandHelper, args: &CommitArgs) -> Result
vec![new_commit.id().clone()],
new_commit.tree_id().clone(),
)
.write();
.write()?;
for workspace_id in workspace_ids {
tx.mut_repo().edit(workspace_id, &new_checkout).unwrap();
}
@ -1947,7 +1947,7 @@ fn cmd_duplicate(
let mut_repo = tx.mut_repo();
let new_commit = CommitBuilder::for_rewrite_from(mut_repo, ui.settings(), &predecessor)
.generate_new_change_id()
.write();
.write()?;
ui.write("Created: ")?;
write_commit_summary(
ui.stdout_formatter().as_mut(),
@ -2040,7 +2040,7 @@ fn cmd_new(ui: &mut Ui, command: &CommandHelper, args: &NewArgs) -> Result<(), C
merged_tree.id().clone(),
)
.set_description(&args.message)
.write();
.write()?;
let workspace_id = workspace_command.workspace_id();
tx.mut_repo().edit(workspace_id, &new_commit).unwrap();
workspace_command.finish_transaction(ui, tx)?;
@ -2131,7 +2131,7 @@ from the source will be moved into the destination.
} else {
CommitBuilder::for_rewrite_from(mut_repo, ui.settings(), &source)
.set_tree(new_source_tree_id)
.write();
.write()?;
}
if repo.index().is_ancestor(source.id(), destination.id()) {
// If we're moving changes to a descendant, first rebase descendants onto the
@ -2155,7 +2155,7 @@ from the source will be moved into the destination.
CommitBuilder::for_rewrite_from(mut_repo, ui.settings(), &destination)
.set_tree(new_destination_tree_id)
.set_description(description)
.write();
.write()?;
workspace_command.finish_transaction(ui, tx)?;
Ok(())
}
@ -2210,14 +2210,14 @@ from the source will be moved into the parent.
.set_tree(new_parent_tree_id)
.set_predecessors(vec![parent.id().clone(), commit.id().clone()])
.set_description(description)
.write();
.write()?;
if abandon_child {
mut_repo.record_abandoned_commit(commit.id().clone());
} else {
// Commit the remainder on top of the new parent commit.
CommitBuilder::for_rewrite_from(mut_repo, ui.settings(), &commit)
.set_parents(vec![new_parent.id().clone()])
.write();
.write()?;
}
workspace_command.finish_transaction(ui, tx)?;
Ok(())
@ -2275,16 +2275,16 @@ aborted.
CommitBuilder::for_rewrite_from(tx.mut_repo(), ui.settings(), &commit)
.set_parents(parent.parent_ids().to_vec())
.set_description(description)
.write();
.write()?;
} else {
let new_parent = CommitBuilder::for_rewrite_from(tx.mut_repo(), ui.settings(), parent)
.set_tree(new_parent_tree_id)
.set_predecessors(vec![parent.id().clone(), commit.id().clone()])
.write();
.write()?;
// Commit the new child on top of the new parent.
CommitBuilder::for_rewrite_from(tx.mut_repo(), ui.settings(), &commit)
.set_parents(vec![new_parent.id().clone()])
.write();
.write()?;
}
workspace_command.finish_transaction(ui, tx)?;
Ok(())
@ -2339,7 +2339,7 @@ fn cmd_resolve(
let new_tree_id = workspace_command.run_mergetool(ui, &commit.tree(), repo_path)?;
CommitBuilder::for_rewrite_from(tx.mut_repo(), ui.settings(), &commit)
.set_tree(new_tree_id)
.write();
.write()?;
workspace_command.finish_transaction(ui, tx)
}
@ -2386,7 +2386,7 @@ fn cmd_restore(
let mut_repo = tx.mut_repo();
let new_commit = CommitBuilder::for_rewrite_from(mut_repo, ui.settings(), &to_commit)
.set_tree(tree_id)
.write();
.write()?;
ui.write("Created ")?;
write_commit_summary(
ui.stdout_formatter().as_mut(),
@ -2449,7 +2449,7 @@ don't make any changes, then the operation will be aborted.",
let mut_repo = tx.mut_repo();
let new_commit = CommitBuilder::for_rewrite_from(mut_repo, ui.settings(), &target_commit)
.set_tree(tree_id)
.write();
.write()?;
ui.write("Created ")?;
write_commit_summary(
ui.stdout_formatter().as_mut(),
@ -2561,7 +2561,7 @@ don't make any changes, then the operation will be aborted.
let first_commit = CommitBuilder::for_rewrite_from(tx.mut_repo(), ui.settings(), &commit)
.set_tree(tree_id)
.set_description(first_description)
.write();
.write()?;
let second_template = description_template_for_cmd_split(
&workspace_command,
"Enter commit description for the second part (child).",
@ -2575,7 +2575,7 @@ don't make any changes, then the operation will be aborted.
.set_tree(commit.tree_id().clone())
.generate_new_change_id()
.set_description(second_description)
.write();
.write()?;
let mut rebaser = DescendantRebaser::new(
ui.settings(),
tx.mut_repo(),
@ -2660,7 +2660,7 @@ fn rebase_branch(
{
let root_commit = root_result?;
workspace_command.check_rewriteable(&root_commit)?;
rebase_commit(ui.settings(), tx.mut_repo(), &root_commit, new_parents);
rebase_commit(ui.settings(), tx.mut_repo(), &root_commit, new_parents)?;
num_rebased += 1;
}
num_rebased += tx.mut_repo().rebase_descendants(ui.settings())?;
@ -2682,7 +2682,7 @@ fn rebase_descendants(
"rebase commit {} and descendants",
old_commit.id().hex()
));
rebase_commit(ui.settings(), tx.mut_repo(), &old_commit, new_parents);
rebase_commit(ui.settings(), tx.mut_repo(), &old_commit, new_parents)?;
let num_rebased = tx.mut_repo().rebase_descendants(ui.settings())? + 1;
writeln!(ui, "Rebased {num_rebased} commits")?;
workspace_command.finish_transaction(ui, tx)?;
@ -2700,7 +2700,7 @@ fn rebase_revision(
check_rebase_destinations(workspace_command, new_parents, &old_commit)?;
let mut tx =
workspace_command.start_transaction(&format!("rebase commit {}", old_commit.id().hex()));
rebase_commit(ui.settings(), tx.mut_repo(), &old_commit, new_parents);
rebase_commit(ui.settings(), tx.mut_repo(), &old_commit, new_parents)?;
// Manually rebase children because we don't want to rebase them onto the
// rewritten commit. (But we still want to record the commit as rewritten so
// branches and the working copy get updated to the rewritten commit.)
@ -2751,7 +2751,7 @@ fn rebase_revision(
tx.mut_repo(),
&child_commit,
&new_child_parents,
);
)?;
num_rebased_descendants += 1;
}
num_rebased_descendants += tx.mut_repo().rebase_descendants(ui.settings())?;
@ -2803,7 +2803,7 @@ fn cmd_backout(
"back out commit {}",
commit_to_back_out.id().hex()
));
back_out_commit(ui.settings(), tx.mut_repo(), &commit_to_back_out, &parents);
back_out_commit(ui.settings(), tx.mut_repo(), &commit_to_back_out, &parents)?;
workspace_command.finish_transaction(ui, tx)?;
Ok(())
@ -3402,7 +3402,7 @@ fn cmd_workspace_add(
new_workspace_command.workspace_id(),
ui.settings(),
&new_wc_commit,
);
)?;
new_workspace_command.finish_transaction(ui, tx)?;
Ok(())
}
@ -3751,7 +3751,7 @@ fn cmd_git_clone(
workspace_command.workspace_id(),
ui.settings(),
&commit,
);
)?;
}
workspace_command.finish_transaction(ui, checkout_tx)?;
}