mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-12-01 12:26:02 +03:00
Replace &BranchId to BranchId
This commit is contained in:
parent
0db12b5115
commit
faa476875d
@ -119,7 +119,7 @@ impl Project {
|
||||
|
||||
let branch_tree_id = branch_tree_builder.write()?;
|
||||
branches_tree_builder.insert(
|
||||
&branch.id.to_string(),
|
||||
branch.id.to_string(),
|
||||
branch_tree_id,
|
||||
FileMode::Tree.into(),
|
||||
)?;
|
||||
|
@ -54,7 +54,7 @@ impl Controller {
|
||||
pub async fn create_commit(
|
||||
&self,
|
||||
project_id: ProjectId,
|
||||
branch_id: &BranchId,
|
||||
branch_id: BranchId,
|
||||
message: &str,
|
||||
ownership: Option<&BranchOwnershipClaims>,
|
||||
run_hooks: bool,
|
||||
@ -78,7 +78,7 @@ impl Controller {
|
||||
pub async fn can_apply_virtual_branch(
|
||||
&self,
|
||||
project_id: ProjectId,
|
||||
branch_id: &BranchId,
|
||||
branch_id: BranchId,
|
||||
) -> Result<bool, Error> {
|
||||
self.inner(project_id)
|
||||
.await
|
||||
@ -156,7 +156,7 @@ impl Controller {
|
||||
pub async fn integrate_upstream_commits(
|
||||
&self,
|
||||
project_id: ProjectId,
|
||||
branch_id: &BranchId,
|
||||
branch_id: BranchId,
|
||||
) -> Result<(), Error> {
|
||||
self.inner(project_id)
|
||||
.await
|
||||
@ -184,7 +184,7 @@ impl Controller {
|
||||
pub async fn delete_virtual_branch(
|
||||
&self,
|
||||
project_id: ProjectId,
|
||||
branch_id: &BranchId,
|
||||
branch_id: BranchId,
|
||||
) -> Result<(), Error> {
|
||||
self.inner(project_id)
|
||||
.await
|
||||
@ -195,7 +195,7 @@ impl Controller {
|
||||
pub async fn apply_virtual_branch(
|
||||
&self,
|
||||
project_id: ProjectId,
|
||||
branch_id: &BranchId,
|
||||
branch_id: BranchId,
|
||||
) -> Result<(), Error> {
|
||||
self.inner(project_id)
|
||||
.await
|
||||
@ -228,7 +228,7 @@ impl Controller {
|
||||
pub async fn amend(
|
||||
&self,
|
||||
project_id: ProjectId,
|
||||
branch_id: &BranchId,
|
||||
branch_id: BranchId,
|
||||
commit_oid: git::Oid,
|
||||
ownership: &BranchOwnershipClaims,
|
||||
) -> Result<git::Oid, Error> {
|
||||
@ -241,7 +241,7 @@ impl Controller {
|
||||
pub async fn move_commit_file(
|
||||
&self,
|
||||
project_id: ProjectId,
|
||||
branch_id: &BranchId,
|
||||
branch_id: BranchId,
|
||||
from_commit_oid: git::Oid,
|
||||
to_commit_oid: git::Oid,
|
||||
ownership: &BranchOwnershipClaims,
|
||||
@ -261,7 +261,7 @@ impl Controller {
|
||||
pub async fn undo_commit(
|
||||
&self,
|
||||
project_id: ProjectId,
|
||||
branch_id: &BranchId,
|
||||
branch_id: BranchId,
|
||||
commit_oid: git::Oid,
|
||||
) -> Result<(), Error> {
|
||||
self.inner(project_id)
|
||||
@ -273,7 +273,7 @@ impl Controller {
|
||||
pub async fn insert_blank_commit(
|
||||
&self,
|
||||
project_id: ProjectId,
|
||||
branch_id: &BranchId,
|
||||
branch_id: BranchId,
|
||||
commit_oid: git::Oid,
|
||||
offset: i32,
|
||||
) -> Result<(), Error> {
|
||||
@ -286,7 +286,7 @@ impl Controller {
|
||||
pub async fn reorder_commit(
|
||||
&self,
|
||||
project_id: ProjectId,
|
||||
branch_id: &BranchId,
|
||||
branch_id: BranchId,
|
||||
commit_oid: git::Oid,
|
||||
offset: i32,
|
||||
) -> Result<(), Error> {
|
||||
@ -299,7 +299,7 @@ impl Controller {
|
||||
pub async fn reset_virtual_branch(
|
||||
&self,
|
||||
project_id: ProjectId,
|
||||
branch_id: &BranchId,
|
||||
branch_id: BranchId,
|
||||
target_commit_oid: git::Oid,
|
||||
) -> Result<(), Error> {
|
||||
self.inner(project_id)
|
||||
@ -311,7 +311,7 @@ impl Controller {
|
||||
pub async fn unapply_virtual_branch(
|
||||
&self,
|
||||
project_id: ProjectId,
|
||||
branch_id: &BranchId,
|
||||
branch_id: BranchId,
|
||||
) -> Result<(), Error> {
|
||||
self.inner(project_id)
|
||||
.await
|
||||
@ -322,7 +322,7 @@ impl Controller {
|
||||
pub async fn push_virtual_branch(
|
||||
&self,
|
||||
project_id: ProjectId,
|
||||
branch_id: &BranchId,
|
||||
branch_id: BranchId,
|
||||
with_force: bool,
|
||||
askpass: Option<Option<BranchId>>,
|
||||
) -> Result<(), Error> {
|
||||
@ -335,7 +335,7 @@ impl Controller {
|
||||
pub async fn cherry_pick(
|
||||
&self,
|
||||
project_id: ProjectId,
|
||||
branch_id: &BranchId,
|
||||
branch_id: BranchId,
|
||||
commit_oid: git::Oid,
|
||||
) -> Result<Option<git::Oid>, Error> {
|
||||
self.inner(project_id)
|
||||
@ -366,7 +366,7 @@ impl Controller {
|
||||
pub async fn squash(
|
||||
&self,
|
||||
project_id: ProjectId,
|
||||
branch_id: &BranchId,
|
||||
branch_id: BranchId,
|
||||
commit_oid: git::Oid,
|
||||
) -> Result<(), Error> {
|
||||
self.inner(project_id)
|
||||
@ -378,7 +378,7 @@ impl Controller {
|
||||
pub async fn update_commit_message(
|
||||
&self,
|
||||
project_id: ProjectId,
|
||||
branch_id: &BranchId,
|
||||
branch_id: BranchId,
|
||||
commit_oid: git::Oid,
|
||||
message: &str,
|
||||
) -> Result<(), Error> {
|
||||
@ -402,7 +402,7 @@ impl Controller {
|
||||
pub async fn move_commit(
|
||||
&self,
|
||||
project_id: ProjectId,
|
||||
target_branch_id: &BranchId,
|
||||
target_branch_id: BranchId,
|
||||
commit_oid: git::Oid,
|
||||
) -> Result<(), Error> {
|
||||
self.inner(project_id)
|
||||
@ -438,7 +438,7 @@ impl ControllerInner {
|
||||
pub async fn create_commit(
|
||||
&self,
|
||||
project_id: ProjectId,
|
||||
branch_id: &BranchId,
|
||||
branch_id: BranchId,
|
||||
message: &str,
|
||||
ownership: Option<&BranchOwnershipClaims>,
|
||||
run_hooks: bool,
|
||||
@ -483,7 +483,7 @@ impl ControllerInner {
|
||||
pub fn can_apply_virtual_branch(
|
||||
&self,
|
||||
project_id: ProjectId,
|
||||
branch_id: &BranchId,
|
||||
branch_id: BranchId,
|
||||
) -> Result<bool, Error> {
|
||||
let project = self.projects.get(project_id)?;
|
||||
let project_repository = project_repository::Repository::open(&project)?;
|
||||
@ -573,7 +573,7 @@ impl ControllerInner {
|
||||
pub async fn integrate_upstream_commits(
|
||||
&self,
|
||||
project_id: ProjectId,
|
||||
branch_id: &BranchId,
|
||||
branch_id: BranchId,
|
||||
) -> Result<(), Error> {
|
||||
let _permit = self.semaphore.acquire().await;
|
||||
|
||||
@ -613,7 +613,7 @@ impl ControllerInner {
|
||||
pub async fn delete_virtual_branch(
|
||||
&self,
|
||||
project_id: ProjectId,
|
||||
branch_id: &BranchId,
|
||||
branch_id: BranchId,
|
||||
) -> Result<(), Error> {
|
||||
let _permit = self.semaphore.acquire().await;
|
||||
|
||||
@ -625,7 +625,7 @@ impl ControllerInner {
|
||||
pub async fn apply_virtual_branch(
|
||||
&self,
|
||||
project_id: ProjectId,
|
||||
branch_id: &BranchId,
|
||||
branch_id: BranchId,
|
||||
) -> Result<(), Error> {
|
||||
let _permit = self.semaphore.acquire().await;
|
||||
|
||||
@ -667,7 +667,7 @@ impl ControllerInner {
|
||||
pub async fn amend(
|
||||
&self,
|
||||
project_id: ProjectId,
|
||||
branch_id: &BranchId,
|
||||
branch_id: BranchId,
|
||||
commit_oid: git::Oid,
|
||||
ownership: &BranchOwnershipClaims,
|
||||
) -> Result<git::Oid, Error> {
|
||||
@ -684,7 +684,7 @@ impl ControllerInner {
|
||||
pub async fn move_commit_file(
|
||||
&self,
|
||||
project_id: ProjectId,
|
||||
branch_id: &BranchId,
|
||||
branch_id: BranchId,
|
||||
from_commit_oid: git::Oid,
|
||||
to_commit_oid: git::Oid,
|
||||
ownership: &BranchOwnershipClaims,
|
||||
@ -709,7 +709,7 @@ impl ControllerInner {
|
||||
pub async fn undo_commit(
|
||||
&self,
|
||||
project_id: ProjectId,
|
||||
branch_id: &BranchId,
|
||||
branch_id: BranchId,
|
||||
commit_oid: git::Oid,
|
||||
) -> Result<(), Error> {
|
||||
let _permit = self.semaphore.acquire().await;
|
||||
@ -725,7 +725,7 @@ impl ControllerInner {
|
||||
pub async fn insert_blank_commit(
|
||||
&self,
|
||||
project_id: ProjectId,
|
||||
branch_id: &BranchId,
|
||||
branch_id: BranchId,
|
||||
commit_oid: git::Oid,
|
||||
offset: i32,
|
||||
) -> Result<(), Error> {
|
||||
@ -743,7 +743,7 @@ impl ControllerInner {
|
||||
pub async fn reorder_commit(
|
||||
&self,
|
||||
project_id: ProjectId,
|
||||
branch_id: &BranchId,
|
||||
branch_id: BranchId,
|
||||
commit_oid: git::Oid,
|
||||
offset: i32,
|
||||
) -> Result<(), Error> {
|
||||
@ -761,7 +761,7 @@ impl ControllerInner {
|
||||
pub async fn reset_virtual_branch(
|
||||
&self,
|
||||
project_id: ProjectId,
|
||||
branch_id: &BranchId,
|
||||
branch_id: BranchId,
|
||||
target_commit_oid: git::Oid,
|
||||
) -> Result<(), Error> {
|
||||
let _permit = self.semaphore.acquire().await;
|
||||
@ -778,7 +778,7 @@ impl ControllerInner {
|
||||
pub async fn unapply_virtual_branch(
|
||||
&self,
|
||||
project_id: ProjectId,
|
||||
branch_id: &BranchId,
|
||||
branch_id: BranchId,
|
||||
) -> Result<(), Error> {
|
||||
let _permit = self.semaphore.acquire().await;
|
||||
|
||||
@ -791,17 +791,16 @@ impl ControllerInner {
|
||||
pub async fn push_virtual_branch(
|
||||
&self,
|
||||
project_id: ProjectId,
|
||||
branch_id: &BranchId,
|
||||
branch_id: BranchId,
|
||||
with_force: bool,
|
||||
askpass: Option<Option<BranchId>>,
|
||||
) -> Result<(), Error> {
|
||||
let _permit = self.semaphore.acquire().await;
|
||||
let helper = self.helper.clone();
|
||||
let branch_id = *branch_id;
|
||||
self.with_verify_branch_async(project_id, move |project_repository, _| {
|
||||
Ok(super::push(
|
||||
project_repository,
|
||||
&branch_id,
|
||||
branch_id,
|
||||
with_force,
|
||||
&helper,
|
||||
askpass,
|
||||
@ -814,7 +813,7 @@ impl ControllerInner {
|
||||
pub async fn cherry_pick(
|
||||
&self,
|
||||
project_id: ProjectId,
|
||||
branch_id: &BranchId,
|
||||
branch_id: BranchId,
|
||||
commit_oid: git::Oid,
|
||||
) -> Result<Option<git::Oid>, Error> {
|
||||
let _permit = self.semaphore.acquire().await;
|
||||
@ -849,7 +848,7 @@ impl ControllerInner {
|
||||
pub async fn squash(
|
||||
&self,
|
||||
project_id: ProjectId,
|
||||
branch_id: &BranchId,
|
||||
branch_id: BranchId,
|
||||
commit_oid: git::Oid,
|
||||
) -> Result<(), Error> {
|
||||
let _permit = self.semaphore.acquire().await;
|
||||
@ -865,7 +864,7 @@ impl ControllerInner {
|
||||
pub async fn update_commit_message(
|
||||
&self,
|
||||
project_id: ProjectId,
|
||||
branch_id: &BranchId,
|
||||
branch_id: BranchId,
|
||||
commit_oid: git::Oid,
|
||||
message: &str,
|
||||
) -> Result<(), Error> {
|
||||
@ -945,7 +944,7 @@ impl ControllerInner {
|
||||
pub async fn move_commit(
|
||||
&self,
|
||||
project_id: ProjectId,
|
||||
target_branch_id: &BranchId,
|
||||
target_branch_id: BranchId,
|
||||
commit_oid: git::Oid,
|
||||
) -> Result<(), Error> {
|
||||
let _permit = self.semaphore.acquire().await;
|
||||
|
@ -88,11 +88,11 @@ impl VirtualBranchesHandle {
|
||||
/// Gets the state of the given virtual branch.
|
||||
///
|
||||
/// Errors if the file cannot be read or written.
|
||||
pub fn get_branch(&self, id: &BranchId) -> Result<Branch, crate::reader::Error> {
|
||||
pub fn get_branch(&self, id: BranchId) -> Result<Branch, crate::reader::Error> {
|
||||
let virtual_branches = self.read_file()?;
|
||||
virtual_branches
|
||||
.branches
|
||||
.get(id)
|
||||
.get(&id)
|
||||
.cloned()
|
||||
.ok_or(crate::reader::Error::NotFound)
|
||||
}
|
||||
|
@ -215,7 +215,7 @@ pub fn normalize_branch_name(name: &str) -> String {
|
||||
|
||||
pub fn apply_branch(
|
||||
project_repository: &project_repository::Repository,
|
||||
branch_id: &BranchId,
|
||||
branch_id: BranchId,
|
||||
user: Option<&users::User>,
|
||||
) -> Result<(), errors::ApplyBranchError> {
|
||||
if project_repository.is_resolving() {
|
||||
@ -235,7 +235,7 @@ pub fn apply_branch(
|
||||
Err(reader::Error::NotFound) => Err(errors::ApplyBranchError::BranchNotFound(
|
||||
errors::BranchNotFound {
|
||||
project_id: project_repository.project().id,
|
||||
branch_id: *branch_id,
|
||||
branch_id: branch_id,
|
||||
},
|
||||
)),
|
||||
Err(error) => Err(errors::ApplyBranchError::Other(error.into())),
|
||||
@ -444,7 +444,7 @@ pub fn apply_branch(
|
||||
.context("failed to merge trees")?;
|
||||
|
||||
if merge_index.has_conflicts() {
|
||||
return Err(errors::ApplyBranchError::BranchConflicts(*branch_id));
|
||||
return Err(errors::ApplyBranchError::BranchConflicts(branch_id));
|
||||
}
|
||||
|
||||
// apply the branch
|
||||
@ -610,7 +610,7 @@ pub fn reset_files(
|
||||
// to unapply a branch, we need to write the current tree out, then remove those file changes from the wd
|
||||
pub fn unapply_branch(
|
||||
project_repository: &project_repository::Repository,
|
||||
branch_id: &BranchId,
|
||||
branch_id: BranchId,
|
||||
) -> Result<Option<branch::Branch>, errors::UnapplyBranchError> {
|
||||
let vb_state = project_repository.project().virtual_branches();
|
||||
|
||||
@ -620,7 +620,7 @@ pub fn unapply_branch(
|
||||
reader::Error::NotFound => {
|
||||
errors::UnapplyBranchError::BranchNotFound(errors::BranchNotFound {
|
||||
project_id: project_repository.project().id,
|
||||
branch_id: *branch_id,
|
||||
branch_id: branch_id,
|
||||
})
|
||||
}
|
||||
error => errors::UnapplyBranchError::Other(error.into()),
|
||||
@ -704,7 +704,7 @@ pub fn unapply_branch(
|
||||
// then check that out into the working directory
|
||||
let final_tree = applied_statuses
|
||||
.into_iter()
|
||||
.filter(|(branch, _)| &branch.id != branch_id)
|
||||
.filter(|(branch, _)| branch.id != branch_id)
|
||||
.fold(
|
||||
target_commit.tree().context("failed to get target tree"),
|
||||
|final_tree, status| {
|
||||
@ -1159,7 +1159,7 @@ pub fn create_virtual_branch(
|
||||
///
|
||||
pub fn integrate_upstream_commits(
|
||||
project_repository: &project_repository::Repository,
|
||||
branch_id: &BranchId,
|
||||
branch_id: BranchId,
|
||||
user: Option<&users::User>,
|
||||
) -> Result<(), anyhow::Error> {
|
||||
conflicts::is_conflicting::<&Path>(project_repository, None)?;
|
||||
@ -1363,7 +1363,7 @@ pub fn update_branch(
|
||||
) -> Result<branch::Branch, errors::UpdateBranchError> {
|
||||
let vb_state = project_repository.project().virtual_branches();
|
||||
let mut branch = vb_state
|
||||
.get_branch(&branch_update.id)
|
||||
.get_branch(branch_update.id)
|
||||
.map_err(|error| match error {
|
||||
reader::Error::NotFound => {
|
||||
errors::UpdateBranchError::BranchNotFound(errors::BranchNotFound {
|
||||
@ -1449,7 +1449,7 @@ pub fn update_branch(
|
||||
|
||||
pub fn delete_branch(
|
||||
project_repository: &project_repository::Repository,
|
||||
branch_id: &BranchId,
|
||||
branch_id: BranchId,
|
||||
) -> Result<(), Error> {
|
||||
let vb_state = project_repository.project().virtual_branches();
|
||||
let branch = match vb_state.get_branch(branch_id) {
|
||||
@ -1986,7 +1986,7 @@ fn virtual_hunks_into_virtual_files(
|
||||
// reset virtual branch to a specific commit
|
||||
pub fn reset_branch(
|
||||
project_repository: &project_repository::Repository,
|
||||
branch_id: &BranchId,
|
||||
branch_id: BranchId,
|
||||
target_commit_oid: git::Oid,
|
||||
) -> Result<(), errors::ResetBranchError> {
|
||||
let vb_state = project_repository.project().virtual_branches();
|
||||
@ -1997,7 +1997,7 @@ pub fn reset_branch(
|
||||
Ok(branch) => Ok(branch),
|
||||
Err(reader::Error::NotFound) => Err(errors::ResetBranchError::BranchNotFound(
|
||||
errors::BranchNotFound {
|
||||
branch_id: *branch_id,
|
||||
branch_id: branch_id,
|
||||
project_id: project_repository.project().id,
|
||||
},
|
||||
)),
|
||||
@ -2262,7 +2262,7 @@ fn _print_tree(repo: &git2::Repository, tree: &git2::Tree) -> Result<()> {
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn commit(
|
||||
project_repository: &project_repository::Repository,
|
||||
branch_id: &BranchId,
|
||||
branch_id: BranchId,
|
||||
message: &str,
|
||||
ownership: Option<&branch::BranchOwnershipClaims>,
|
||||
user: Option<&users::User>,
|
||||
@ -2301,11 +2301,11 @@ pub fn commit(
|
||||
|
||||
let (ref mut branch, files) = statuses
|
||||
.into_iter()
|
||||
.find(|(branch, _)| branch.id == *branch_id)
|
||||
.find(|(branch, _)| branch.id == branch_id)
|
||||
.ok_or_else(|| {
|
||||
errors::CommitError::BranchNotFound(errors::BranchNotFound {
|
||||
project_id: project_repository.project().id,
|
||||
branch_id: *branch_id,
|
||||
branch_id: branch_id,
|
||||
})
|
||||
})?;
|
||||
|
||||
@ -2397,7 +2397,7 @@ pub fn commit(
|
||||
|
||||
pub fn push(
|
||||
project_repository: &project_repository::Repository,
|
||||
branch_id: &BranchId,
|
||||
branch_id: BranchId,
|
||||
with_force: bool,
|
||||
credentials: &git::credentials::Helper,
|
||||
askpass: Option<Option<BranchId>>,
|
||||
@ -2409,7 +2409,7 @@ pub fn push(
|
||||
.map_err(|error| match error {
|
||||
reader::Error::NotFound => errors::PushError::BranchNotFound(errors::BranchNotFound {
|
||||
project_id: project_repository.project().id,
|
||||
branch_id: *branch_id,
|
||||
branch_id: branch_id,
|
||||
}),
|
||||
error => errors::PushError::Other(error.into()),
|
||||
})?;
|
||||
@ -2589,7 +2589,7 @@ pub fn is_remote_branch_mergeable(
|
||||
|
||||
pub fn is_virtual_branch_mergeable(
|
||||
project_repository: &project_repository::Repository,
|
||||
branch_id: &BranchId,
|
||||
branch_id: BranchId,
|
||||
) -> Result<bool, errors::IsVirtualBranchMergeable> {
|
||||
let vb_state = project_repository.project().virtual_branches();
|
||||
let branch = match vb_state.get_branch(branch_id) {
|
||||
@ -2597,7 +2597,7 @@ pub fn is_virtual_branch_mergeable(
|
||||
Err(reader::Error::NotFound) => Err(errors::IsVirtualBranchMergeable::BranchNotFound(
|
||||
errors::BranchNotFound {
|
||||
project_id: project_repository.project().id,
|
||||
branch_id: *branch_id,
|
||||
branch_id: branch_id,
|
||||
},
|
||||
)),
|
||||
Err(error) => Err(errors::IsVirtualBranchMergeable::Other(error.into())),
|
||||
@ -2660,7 +2660,7 @@ pub fn is_virtual_branch_mergeable(
|
||||
// then added to the "to" commit and everything above that rebased again.
|
||||
pub fn move_commit_file(
|
||||
project_repository: &project_repository::Repository,
|
||||
branch_id: &BranchId,
|
||||
branch_id: BranchId,
|
||||
from_commit_oid: git::Oid,
|
||||
to_commit_oid: git::Oid,
|
||||
target_ownership: &BranchOwnershipClaims,
|
||||
@ -2920,7 +2920,7 @@ pub fn move_commit_file(
|
||||
// and the respective branch head is updated
|
||||
pub fn amend(
|
||||
project_repository: &project_repository::Repository,
|
||||
branch_id: &BranchId,
|
||||
branch_id: BranchId,
|
||||
commit_oid: git::Oid,
|
||||
target_ownership: &BranchOwnershipClaims,
|
||||
) -> Result<git::Oid, errors::VirtualBranchError> {
|
||||
@ -2938,11 +2938,11 @@ pub fn amend(
|
||||
.list_branches()
|
||||
.context("failed to read virtual branches")?;
|
||||
|
||||
if !all_branches.iter().any(|b| b.id == *branch_id) {
|
||||
if !all_branches.iter().any(|b| b.id == branch_id) {
|
||||
return Err(errors::VirtualBranchError::BranchNotFound(
|
||||
errors::BranchNotFound {
|
||||
project_id: project_repository.project().id,
|
||||
branch_id: *branch_id,
|
||||
branch_id: branch_id,
|
||||
},
|
||||
));
|
||||
}
|
||||
@ -2952,11 +2952,11 @@ pub fn amend(
|
||||
.filter(|b| b.applied)
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
if !applied_branches.iter().any(|b| b.id == *branch_id) {
|
||||
if !applied_branches.iter().any(|b| b.id == branch_id) {
|
||||
return Err(errors::VirtualBranchError::BranchNotFound(
|
||||
errors::BranchNotFound {
|
||||
project_id: project_repository.project().id,
|
||||
branch_id: *branch_id,
|
||||
branch_id: branch_id,
|
||||
},
|
||||
));
|
||||
}
|
||||
@ -2975,11 +2975,11 @@ pub fn amend(
|
||||
|
||||
let (ref mut target_branch, target_status) = applied_statuses
|
||||
.iter_mut()
|
||||
.find(|(b, _)| b.id == *branch_id)
|
||||
.find(|(b, _)| b.id == branch_id)
|
||||
.ok_or_else(|| {
|
||||
errors::VirtualBranchError::BranchNotFound(errors::BranchNotFound {
|
||||
project_id: project_repository.project().id,
|
||||
branch_id: *branch_id,
|
||||
branch_id: branch_id,
|
||||
})
|
||||
})?;
|
||||
|
||||
@ -3103,7 +3103,7 @@ pub fn amend(
|
||||
// rewrites the branch head to the new head commit
|
||||
pub fn reorder_commit(
|
||||
project_repository: &project_repository::Repository,
|
||||
branch_id: &BranchId,
|
||||
branch_id: BranchId,
|
||||
commit_oid: git::Oid,
|
||||
offset: i32,
|
||||
) -> Result<(), errors::VirtualBranchError> {
|
||||
@ -3115,7 +3115,7 @@ pub fn reorder_commit(
|
||||
Ok(branch) => Ok(branch),
|
||||
Err(reader::Error::NotFound) => Err(errors::VirtualBranchError::BranchNotFound(
|
||||
errors::BranchNotFound {
|
||||
branch_id: *branch_id,
|
||||
branch_id: branch_id,
|
||||
project_id: project_repository.project().id,
|
||||
},
|
||||
)),
|
||||
@ -3203,7 +3203,7 @@ pub fn reorder_commit(
|
||||
// return the oid of the new head commit of the branch with the inserted blank commit
|
||||
pub fn insert_blank_commit(
|
||||
project_repository: &project_repository::Repository,
|
||||
branch_id: &BranchId,
|
||||
branch_id: BranchId,
|
||||
commit_oid: git::Oid,
|
||||
user: Option<&users::User>,
|
||||
offset: i32,
|
||||
@ -3214,7 +3214,7 @@ pub fn insert_blank_commit(
|
||||
Ok(branch) => Ok(branch),
|
||||
Err(reader::Error::NotFound) => Err(errors::VirtualBranchError::BranchNotFound(
|
||||
errors::BranchNotFound {
|
||||
branch_id: *branch_id,
|
||||
branch_id: branch_id,
|
||||
project_id: project_repository.project().id,
|
||||
},
|
||||
)),
|
||||
@ -3272,7 +3272,7 @@ pub fn insert_blank_commit(
|
||||
// if successful, it will update the branch head to the new head commit
|
||||
pub fn undo_commit(
|
||||
project_repository: &project_repository::Repository,
|
||||
branch_id: &BranchId,
|
||||
branch_id: BranchId,
|
||||
commit_oid: git::Oid,
|
||||
) -> Result<(), errors::VirtualBranchError> {
|
||||
let vb_state = project_repository.project().virtual_branches();
|
||||
@ -3281,7 +3281,7 @@ pub fn undo_commit(
|
||||
Ok(branch) => Ok(branch),
|
||||
Err(reader::Error::NotFound) => Err(errors::VirtualBranchError::BranchNotFound(
|
||||
errors::BranchNotFound {
|
||||
branch_id: *branch_id,
|
||||
branch_id: branch_id,
|
||||
project_id: project_repository.project().id,
|
||||
},
|
||||
)),
|
||||
@ -3428,7 +3428,7 @@ fn cherry_rebase_group(
|
||||
|
||||
pub fn cherry_pick(
|
||||
project_repository: &project_repository::Repository,
|
||||
branch_id: &BranchId,
|
||||
branch_id: BranchId,
|
||||
target_commit_oid: git::Oid,
|
||||
) -> Result<Option<git::Oid>, errors::CherryPickError> {
|
||||
if conflicts::is_conflicting::<&Path>(project_repository, None)? {
|
||||
@ -3483,7 +3483,7 @@ pub fn cherry_pick(
|
||||
|
||||
let branch_files = applied_statuses
|
||||
.iter()
|
||||
.find(|(b, _)| b.id == *branch_id)
|
||||
.find(|(b, _)| b.id == branch_id)
|
||||
.map(|(_, f)| f)
|
||||
.context("branch status not found")?;
|
||||
|
||||
@ -3526,7 +3526,7 @@ pub fn cherry_pick(
|
||||
.filter(|(b, _)| b.id != branch.id)
|
||||
.map(|(b, _)| b)
|
||||
{
|
||||
unapply_branch(project_repository, &other_branch.id).context("failed to unapply branch")?;
|
||||
unapply_branch(project_repository, other_branch.id).context("failed to unapply branch")?;
|
||||
}
|
||||
|
||||
let commit_oid = if cherrypick_index.has_conflicts() {
|
||||
@ -3611,7 +3611,7 @@ pub fn cherry_pick(
|
||||
/// squashes a commit from a virtual branch into it's parent.
|
||||
pub fn squash(
|
||||
project_repository: &project_repository::Repository,
|
||||
branch_id: &BranchId,
|
||||
branch_id: BranchId,
|
||||
commit_oid: git::Oid,
|
||||
) -> Result<(), errors::SquashError> {
|
||||
if conflicts::is_conflicting::<&Path>(project_repository, None)? {
|
||||
@ -3630,7 +3630,7 @@ pub fn squash(
|
||||
reader::Error::NotFound => {
|
||||
errors::SquashError::BranchNotFound(errors::BranchNotFound {
|
||||
project_id: project_repository.project().id,
|
||||
branch_id: *branch_id,
|
||||
branch_id: branch_id,
|
||||
})
|
||||
}
|
||||
error => errors::SquashError::Other(error.into()),
|
||||
@ -3735,7 +3735,7 @@ pub fn squash(
|
||||
// changes a commit message for commit_oid, rebases everything above it, updates branch head if successful
|
||||
pub fn update_commit_message(
|
||||
project_repository: &project_repository::Repository,
|
||||
branch_id: &BranchId,
|
||||
branch_id: BranchId,
|
||||
commit_oid: git::Oid,
|
||||
message: &str,
|
||||
) -> Result<(), errors::UpdateCommitMessageError> {
|
||||
@ -3760,7 +3760,7 @@ pub fn update_commit_message(
|
||||
reader::Error::NotFound => {
|
||||
errors::UpdateCommitMessageError::BranchNotFound(errors::BranchNotFound {
|
||||
project_id: project_repository.project().id,
|
||||
branch_id: *branch_id,
|
||||
branch_id: branch_id,
|
||||
})
|
||||
}
|
||||
error => errors::UpdateCommitMessageError::Other(error.into()),
|
||||
@ -3849,7 +3849,7 @@ pub fn update_commit_message(
|
||||
/// moves commit from the branch it's in to the top of the target branch
|
||||
pub fn move_commit(
|
||||
project_repository: &project_repository::Repository,
|
||||
target_branch_id: &BranchId,
|
||||
target_branch_id: BranchId,
|
||||
commit_oid: git::Oid,
|
||||
user: Option<&users::User>,
|
||||
) -> Result<(), errors::MoveCommitError> {
|
||||
@ -3870,11 +3870,11 @@ pub fn move_commit(
|
||||
.filter(|b| b.applied)
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
if !applied_branches.iter().any(|b| b.id == *target_branch_id) {
|
||||
if !applied_branches.iter().any(|b| b.id == target_branch_id) {
|
||||
return Err(errors::MoveCommitError::BranchNotFound(
|
||||
errors::BranchNotFound {
|
||||
project_id: project_repository.project().id,
|
||||
branch_id: *target_branch_id,
|
||||
branch_id: target_branch_id,
|
||||
},
|
||||
));
|
||||
}
|
||||
@ -3968,7 +3968,7 @@ pub fn move_commit(
|
||||
reader::Error::NotFound => {
|
||||
errors::MoveCommitError::BranchNotFound(errors::BranchNotFound {
|
||||
project_id: project_repository.project().id,
|
||||
branch_id: *target_branch_id,
|
||||
branch_id: target_branch_id,
|
||||
})
|
||||
}
|
||||
error => errors::MoveCommitError::Other(error.into()),
|
||||
@ -4148,7 +4148,7 @@ pub fn create_virtual_branch_from_branch(
|
||||
|
||||
project_repository.add_branch_reference(&branch)?;
|
||||
|
||||
match apply_branch(project_repository, &branch.id, user) {
|
||||
match apply_branch(project_repository, branch.id, user) {
|
||||
Ok(()) => Ok(branch.id),
|
||||
Err(errors::ApplyBranchError::BranchConflicts(_)) => {
|
||||
// if branch conflicts with the workspace, it's ok. keep it unapplied
|
||||
|
@ -41,12 +41,12 @@ async fn forcepush_allowed() {
|
||||
// create commit
|
||||
fs::write(repository.path().join("file.txt"), "content").unwrap();
|
||||
let commit_id = controller
|
||||
.create_commit(*project_id, &branch_id, "commit one", None, false)
|
||||
.create_commit(*project_id, branch_id, "commit one", None, false)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
controller
|
||||
.push_virtual_branch(*project_id, &branch_id, false, None)
|
||||
.push_virtual_branch(*project_id, branch_id, false, None)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -55,7 +55,7 @@ async fn forcepush_allowed() {
|
||||
fs::write(repository.path().join("file2.txt"), "content2").unwrap();
|
||||
let to_amend: branch::BranchOwnershipClaims = "file2.txt:1-2".parse().unwrap();
|
||||
controller
|
||||
.amend(*project_id, &branch_id, commit_id, &to_amend)
|
||||
.amend(*project_id, branch_id, commit_id, &to_amend)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -106,12 +106,12 @@ async fn forcepush_forbidden() {
|
||||
// create commit
|
||||
fs::write(repository.path().join("file.txt"), "content").unwrap();
|
||||
let commit_oid = controller
|
||||
.create_commit(*project_id, &branch_id, "commit one", None, false)
|
||||
.create_commit(*project_id, branch_id, "commit one", None, false)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
controller
|
||||
.push_virtual_branch(*project_id, &branch_id, false, None)
|
||||
.push_virtual_branch(*project_id, branch_id, false, None)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -120,7 +120,7 @@ async fn forcepush_forbidden() {
|
||||
let to_amend: branch::BranchOwnershipClaims = "file2.txt:1-2".parse().unwrap();
|
||||
assert!(matches!(
|
||||
controller
|
||||
.amend(*project_id, &branch_id, commit_oid, &to_amend)
|
||||
.amend(*project_id, branch_id, commit_oid, &to_amend)
|
||||
.await
|
||||
.unwrap_err()
|
||||
.downcast_ref(),
|
||||
@ -151,7 +151,7 @@ async fn non_locked_hunk() {
|
||||
// create commit
|
||||
fs::write(repository.path().join("file.txt"), "content").unwrap();
|
||||
let commit_oid = controller
|
||||
.create_commit(*project_id, &branch_id, "commit one", None, false)
|
||||
.create_commit(*project_id, branch_id, "commit one", None, false)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -172,7 +172,7 @@ async fn non_locked_hunk() {
|
||||
fs::write(repository.path().join("file2.txt"), "content2").unwrap();
|
||||
let to_amend: branch::BranchOwnershipClaims = "file2.txt:1-2".parse().unwrap();
|
||||
controller
|
||||
.amend(*project_id, &branch_id, commit_oid, &to_amend)
|
||||
.amend(*project_id, branch_id, commit_oid, &to_amend)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -212,7 +212,7 @@ async fn locked_hunk() {
|
||||
// create commit
|
||||
fs::write(repository.path().join("file.txt"), "content").unwrap();
|
||||
let commit_oid = controller
|
||||
.create_commit(*project_id, &branch_id, "commit one", None, false)
|
||||
.create_commit(*project_id, branch_id, "commit one", None, false)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -237,7 +237,7 @@ async fn locked_hunk() {
|
||||
fs::write(repository.path().join("file.txt"), "more content").unwrap();
|
||||
let to_amend: branch::BranchOwnershipClaims = "file.txt:1-2".parse().unwrap();
|
||||
controller
|
||||
.amend(*project_id, &branch_id, commit_oid, &to_amend)
|
||||
.amend(*project_id, branch_id, commit_oid, &to_amend)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -282,7 +282,7 @@ async fn non_existing_ownership() {
|
||||
// create commit
|
||||
fs::write(repository.path().join("file.txt"), "content").unwrap();
|
||||
let commit_oid = controller
|
||||
.create_commit(*project_id, &branch_id, "commit one", None, false)
|
||||
.create_commit(*project_id, branch_id, "commit one", None, false)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -303,7 +303,7 @@ async fn non_existing_ownership() {
|
||||
let to_amend: branch::BranchOwnershipClaims = "file2.txt:1-2".parse().unwrap();
|
||||
assert!(matches!(
|
||||
controller
|
||||
.amend(*project_id, &branch_id, commit_oid, &to_amend)
|
||||
.amend(*project_id, branch_id, commit_oid, &to_amend)
|
||||
.await
|
||||
.unwrap_err()
|
||||
.downcast_ref(),
|
||||
|
@ -26,7 +26,7 @@ async fn deltect_conflict() {
|
||||
|
||||
// unapply first vbranch
|
||||
controller
|
||||
.unapply_virtual_branch(*project_id, &branch1_id)
|
||||
.unapply_virtual_branch(*project_id, branch1_id)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -42,13 +42,13 @@ async fn deltect_conflict() {
|
||||
{
|
||||
// it should not be possible to apply the first branch
|
||||
assert!(!controller
|
||||
.can_apply_virtual_branch(*project_id, &branch1_id)
|
||||
.can_apply_virtual_branch(*project_id, branch1_id)
|
||||
.await
|
||||
.unwrap());
|
||||
|
||||
assert!(matches!(
|
||||
controller
|
||||
.apply_virtual_branch(*project_id, &branch1_id)
|
||||
.apply_virtual_branch(*project_id, branch1_id)
|
||||
.await
|
||||
.unwrap_err()
|
||||
.downcast_ref(),
|
||||
@ -91,7 +91,7 @@ async fn rebase_commit() {
|
||||
fs::write(repository.path().join("another_file.txt"), "virtual").unwrap();
|
||||
|
||||
controller
|
||||
.create_commit(*project_id, &branch1_id, "virtual commit", None, false)
|
||||
.create_commit(*project_id, branch1_id, "virtual commit", None, false)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -108,7 +108,7 @@ async fn rebase_commit() {
|
||||
{
|
||||
// unapply first vbranch
|
||||
controller
|
||||
.unapply_virtual_branch(*project_id, &branch1_id)
|
||||
.unapply_virtual_branch(*project_id, branch1_id)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -155,7 +155,7 @@ async fn rebase_commit() {
|
||||
{
|
||||
// apply first vbranch again
|
||||
controller
|
||||
.apply_virtual_branch(*project_id, &branch1_id)
|
||||
.apply_virtual_branch(*project_id, branch1_id)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -224,7 +224,7 @@ async fn rebase_work() {
|
||||
{
|
||||
// unapply first vbranch
|
||||
controller
|
||||
.unapply_virtual_branch(*project_id, &branch1_id)
|
||||
.unapply_virtual_branch(*project_id, branch1_id)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -259,7 +259,7 @@ async fn rebase_work() {
|
||||
{
|
||||
// apply first vbranch again
|
||||
controller
|
||||
.apply_virtual_branch(*project_id, &branch1_id)
|
||||
.apply_virtual_branch(*project_id, branch1_id)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
|
@ -26,7 +26,7 @@ mod cleanly {
|
||||
let commit_one = {
|
||||
fs::write(repository.path().join("file.txt"), "content").unwrap();
|
||||
controller
|
||||
.create_commit(*project_id, &branch_id, "commit", None, false)
|
||||
.create_commit(*project_id, branch_id, "commit", None, false)
|
||||
.await
|
||||
.unwrap()
|
||||
};
|
||||
@ -34,18 +34,18 @@ mod cleanly {
|
||||
let commit_two = {
|
||||
fs::write(repository.path().join("file.txt"), "content two").unwrap();
|
||||
controller
|
||||
.create_commit(*project_id, &branch_id, "commit", None, false)
|
||||
.create_commit(*project_id, branch_id, "commit", None, false)
|
||||
.await
|
||||
.unwrap()
|
||||
};
|
||||
|
||||
controller
|
||||
.push_virtual_branch(*project_id, &branch_id, false, None)
|
||||
.push_virtual_branch(*project_id, branch_id, false, None)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
controller
|
||||
.reset_virtual_branch(*project_id, &branch_id, commit_one)
|
||||
.reset_virtual_branch(*project_id, branch_id, commit_one)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -57,7 +57,7 @@ mod cleanly {
|
||||
);
|
||||
|
||||
let cherry_picked_commit_oid = controller
|
||||
.cherry_pick(*project_id, &branch_id, commit_two)
|
||||
.cherry_pick(*project_id, branch_id, commit_two)
|
||||
.await
|
||||
.unwrap();
|
||||
assert!(cherry_picked_commit_oid.is_some());
|
||||
@ -98,7 +98,7 @@ mod cleanly {
|
||||
let commit_one = {
|
||||
fs::write(repository.path().join("file.txt"), "content").unwrap();
|
||||
controller
|
||||
.create_commit(*project_id, &branch_id, "commit", None, false)
|
||||
.create_commit(*project_id, branch_id, "commit", None, false)
|
||||
.await
|
||||
.unwrap()
|
||||
};
|
||||
@ -106,18 +106,18 @@ mod cleanly {
|
||||
let commit_two = {
|
||||
fs::write(repository.path().join("file_two.txt"), "content two").unwrap();
|
||||
controller
|
||||
.create_commit(*project_id, &branch_id, "commit", None, false)
|
||||
.create_commit(*project_id, branch_id, "commit", None, false)
|
||||
.await
|
||||
.unwrap()
|
||||
};
|
||||
|
||||
controller
|
||||
.push_virtual_branch(*project_id, &branch_id, false, None)
|
||||
.push_virtual_branch(*project_id, branch_id, false, None)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
controller
|
||||
.reset_virtual_branch(*project_id, &branch_id, commit_one)
|
||||
.reset_virtual_branch(*project_id, branch_id, commit_one)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -135,7 +135,7 @@ mod cleanly {
|
||||
.unwrap();
|
||||
|
||||
let cherry_picked_commit_oid = controller
|
||||
.cherry_pick(*project_id, &branch_two_id, commit_two)
|
||||
.cherry_pick(*project_id, branch_two_id, commit_two)
|
||||
.await
|
||||
.unwrap();
|
||||
assert!(cherry_picked_commit_oid.is_some());
|
||||
@ -181,7 +181,7 @@ mod cleanly {
|
||||
let commit_one_oid = {
|
||||
fs::write(repository.path().join("file.txt"), "content").unwrap();
|
||||
controller
|
||||
.create_commit(*project_id, &branch_id, "commit", None, false)
|
||||
.create_commit(*project_id, branch_id, "commit", None, false)
|
||||
.await
|
||||
.unwrap()
|
||||
};
|
||||
@ -189,7 +189,7 @@ mod cleanly {
|
||||
{
|
||||
fs::write(repository.path().join("file_two.txt"), "content two").unwrap();
|
||||
controller
|
||||
.create_commit(*project_id, &branch_id, "commit", None, false)
|
||||
.create_commit(*project_id, branch_id, "commit", None, false)
|
||||
.await
|
||||
.unwrap()
|
||||
};
|
||||
@ -197,24 +197,24 @@ mod cleanly {
|
||||
let commit_three_oid = {
|
||||
fs::write(repository.path().join("file_three.txt"), "content three").unwrap();
|
||||
controller
|
||||
.create_commit(*project_id, &branch_id, "commit", None, false)
|
||||
.create_commit(*project_id, branch_id, "commit", None, false)
|
||||
.await
|
||||
.unwrap()
|
||||
};
|
||||
|
||||
controller
|
||||
.reset_virtual_branch(*project_id, &branch_id, commit_one_oid)
|
||||
.reset_virtual_branch(*project_id, branch_id, commit_one_oid)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
controller
|
||||
.unapply_virtual_branch(*project_id, &branch_id)
|
||||
.unapply_virtual_branch(*project_id, branch_id)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
assert!(matches!(
|
||||
controller
|
||||
.cherry_pick(*project_id, &branch_id, commit_three_oid)
|
||||
.cherry_pick(*project_id, branch_id, commit_three_oid)
|
||||
.await
|
||||
.unwrap_err()
|
||||
.downcast_ref(),
|
||||
@ -249,7 +249,7 @@ mod with_conflicts {
|
||||
let commit_one = {
|
||||
fs::write(repository.path().join("file.txt"), "content").unwrap();
|
||||
controller
|
||||
.create_commit(*project_id, &branch_id, "commit one", None, false)
|
||||
.create_commit(*project_id, branch_id, "commit one", None, false)
|
||||
.await
|
||||
.unwrap()
|
||||
};
|
||||
@ -257,7 +257,7 @@ mod with_conflicts {
|
||||
{
|
||||
fs::write(repository.path().join("file_two.txt"), "content two").unwrap();
|
||||
controller
|
||||
.create_commit(*project_id, &branch_id, "commit two", None, false)
|
||||
.create_commit(*project_id, branch_id, "commit two", None, false)
|
||||
.await
|
||||
.unwrap()
|
||||
};
|
||||
@ -265,18 +265,18 @@ mod with_conflicts {
|
||||
let commit_three = {
|
||||
fs::write(repository.path().join("file_three.txt"), "content three").unwrap();
|
||||
controller
|
||||
.create_commit(*project_id, &branch_id, "commit three", None, false)
|
||||
.create_commit(*project_id, branch_id, "commit three", None, false)
|
||||
.await
|
||||
.unwrap()
|
||||
};
|
||||
|
||||
controller
|
||||
.push_virtual_branch(*project_id, &branch_id, false, None)
|
||||
.push_virtual_branch(*project_id, branch_id, false, None)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
controller
|
||||
.reset_virtual_branch(*project_id, &branch_id, commit_one)
|
||||
.reset_virtual_branch(*project_id, branch_id, commit_one)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -294,7 +294,7 @@ mod with_conflicts {
|
||||
{
|
||||
// cherry picking leads to conflict
|
||||
let cherry_picked_commit_oid = controller
|
||||
.cherry_pick(*project_id, &branch_id, commit_three)
|
||||
.cherry_pick(*project_id, branch_id, commit_three)
|
||||
.await
|
||||
.unwrap();
|
||||
assert!(cherry_picked_commit_oid.is_none());
|
||||
@ -318,7 +318,7 @@ mod with_conflicts {
|
||||
// conflict can be resolved
|
||||
fs::write(repository.path().join("file_three.txt"), "resolved").unwrap();
|
||||
let commited_oid = controller
|
||||
.create_commit(*project_id, &branch_id, "resolution", None, false)
|
||||
.create_commit(*project_id, branch_id, "resolution", None, false)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -370,13 +370,13 @@ mod with_conflicts {
|
||||
fs::write(repository.path().join("file.txt"), "conflict").unwrap();
|
||||
|
||||
controller
|
||||
.unapply_virtual_branch(*project_id, &branch_id)
|
||||
.unapply_virtual_branch(*project_id, branch_id)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
assert!(matches!(
|
||||
controller
|
||||
.cherry_pick(*project_id, &branch_id, commit_oid)
|
||||
.cherry_pick(*project_id, branch_id, commit_oid)
|
||||
.await
|
||||
.unwrap_err()
|
||||
.downcast_ref(),
|
||||
|
@ -36,7 +36,7 @@ async fn should_lock_updated_hunks() {
|
||||
}
|
||||
|
||||
controller
|
||||
.create_commit(*project_id, &branch_id, "test", None, false)
|
||||
.create_commit(*project_id, branch_id, "test", None, false)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -95,11 +95,11 @@ async fn should_not_lock_disjointed_hunks() {
|
||||
}
|
||||
|
||||
controller
|
||||
.create_commit(*project_id, &branch_id, "test commit", None, false)
|
||||
.create_commit(*project_id, branch_id, "test commit", None, false)
|
||||
.await
|
||||
.unwrap();
|
||||
controller
|
||||
.push_virtual_branch(*project_id, &branch_id, false, None)
|
||||
.push_virtual_branch(*project_id, branch_id, false, None)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -196,7 +196,7 @@ async fn should_reset_into_same_branch() {
|
||||
write_file(repository, "file.txt", &lines);
|
||||
|
||||
controller
|
||||
.create_commit(*project_id, &branch_2_id, "commit to branch 2", None, false)
|
||||
.create_commit(*project_id, branch_2_id, "commit to branch 2", None, false)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -219,7 +219,7 @@ async fn should_reset_into_same_branch() {
|
||||
.unwrap();
|
||||
|
||||
controller
|
||||
.reset_virtual_branch(*project_id, &branch_2_id, base_branch.base_sha)
|
||||
.reset_virtual_branch(*project_id, branch_2_id, base_branch.base_sha)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -256,7 +256,7 @@ async fn should_double_lock() {
|
||||
write_file(repository, "file.txt", &lines);
|
||||
|
||||
let commit_1 = controller
|
||||
.create_commit(*project_id, &branch_id, "commit 1", None, false)
|
||||
.create_commit(*project_id, branch_id, "commit 1", None, false)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -264,7 +264,7 @@ async fn should_double_lock() {
|
||||
write_file(repository, "file.txt", &lines);
|
||||
|
||||
let commit_2 = controller
|
||||
.create_commit(*project_id, &branch_id, "commit 2", None, false)
|
||||
.create_commit(*project_id, branch_id, "commit 2", None, false)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
|
@ -24,11 +24,11 @@ async fn integration() {
|
||||
|
||||
std::fs::write(repository.path().join("file.txt"), "first\n").unwrap();
|
||||
controller
|
||||
.create_commit(*project_id, &branch_id, "first", None, false)
|
||||
.create_commit(*project_id, branch_id, "first", None, false)
|
||||
.await
|
||||
.unwrap();
|
||||
controller
|
||||
.push_virtual_branch(*project_id, &branch_id, false, None)
|
||||
.push_virtual_branch(*project_id, branch_id, false, None)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -44,7 +44,7 @@ async fn integration() {
|
||||
let name = branch.upstream.unwrap().name;
|
||||
|
||||
controller
|
||||
.delete_virtual_branch(*project_id, &branch_id)
|
||||
.delete_virtual_branch(*project_id, branch_id)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -62,7 +62,7 @@ async fn integration() {
|
||||
std::fs::write(repository.path().join("file.txt"), "first\nsecond").unwrap();
|
||||
|
||||
controller
|
||||
.create_commit(*project_id, &branch_id, "second", None, false)
|
||||
.create_commit(*project_id, branch_id, "second", None, false)
|
||||
.await
|
||||
.unwrap();
|
||||
}
|
||||
@ -79,7 +79,7 @@ async fn integration() {
|
||||
{
|
||||
// merge branch into master
|
||||
controller
|
||||
.push_virtual_branch(*project_id, &branch_id, false, None)
|
||||
.push_virtual_branch(*project_id, branch_id, false, None)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -251,7 +251,7 @@ async fn conflicts_with_commited() {
|
||||
assert_eq!(branches.len(), 1);
|
||||
|
||||
controller
|
||||
.create_commit(*project_id, &branches[0].id, "hej", None, false)
|
||||
.create_commit(*project_id, branches[0].id, "hej", None, false)
|
||||
.await
|
||||
.unwrap();
|
||||
};
|
||||
|
@ -20,7 +20,7 @@ async fn should_unapply_diff() {
|
||||
let (branches, _) = controller.list_virtual_branches(*project_id).await.unwrap();
|
||||
|
||||
controller
|
||||
.delete_virtual_branch(*project_id, &branches[0].id)
|
||||
.delete_virtual_branch(*project_id, branches[0].id)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -62,7 +62,7 @@ async fn should_remove_reference() {
|
||||
.unwrap();
|
||||
|
||||
controller
|
||||
.delete_virtual_branch(*project_id, &id)
|
||||
.delete_virtual_branch(*project_id, id)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
|
@ -22,7 +22,7 @@ async fn insert_blank_commit_down() {
|
||||
// create commit
|
||||
fs::write(repository.path().join("file.txt"), "content").unwrap();
|
||||
let _commit1_id = controller
|
||||
.create_commit(*project_id, &branch_id, "commit one", None, false)
|
||||
.create_commit(*project_id, branch_id, "commit one", None, false)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -30,19 +30,19 @@ async fn insert_blank_commit_down() {
|
||||
fs::write(repository.path().join("file2.txt"), "content2").unwrap();
|
||||
fs::write(repository.path().join("file3.txt"), "content3").unwrap();
|
||||
let commit2_id = controller
|
||||
.create_commit(*project_id, &branch_id, "commit two", None, false)
|
||||
.create_commit(*project_id, branch_id, "commit two", None, false)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
// create commit
|
||||
fs::write(repository.path().join("file4.txt"), "content4").unwrap();
|
||||
let _commit3_id = controller
|
||||
.create_commit(*project_id, &branch_id, "commit three", None, false)
|
||||
.create_commit(*project_id, branch_id, "commit three", None, false)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
controller
|
||||
.insert_blank_commit(*project_id, &branch_id, commit2_id, 1)
|
||||
.insert_blank_commit(*project_id, branch_id, commit2_id, 1)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -94,7 +94,7 @@ async fn insert_blank_commit_up() {
|
||||
// create commit
|
||||
fs::write(repository.path().join("file.txt"), "content").unwrap();
|
||||
let _commit1_id = controller
|
||||
.create_commit(*project_id, &branch_id, "commit one", None, false)
|
||||
.create_commit(*project_id, branch_id, "commit one", None, false)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -102,19 +102,19 @@ async fn insert_blank_commit_up() {
|
||||
fs::write(repository.path().join("file2.txt"), "content2").unwrap();
|
||||
fs::write(repository.path().join("file3.txt"), "content3").unwrap();
|
||||
let commit2_id = controller
|
||||
.create_commit(*project_id, &branch_id, "commit two", None, false)
|
||||
.create_commit(*project_id, branch_id, "commit two", None, false)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
// create commit
|
||||
fs::write(repository.path().join("file4.txt"), "content4").unwrap();
|
||||
let _commit3_id = controller
|
||||
.create_commit(*project_id, &branch_id, "commit three", None, false)
|
||||
.create_commit(*project_id, branch_id, "commit three", None, false)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
controller
|
||||
.insert_blank_commit(*project_id, &branch_id, commit2_id, -1)
|
||||
.insert_blank_commit(*project_id, branch_id, commit2_id, -1)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
|
@ -130,7 +130,7 @@ async fn resolve_conflict_flow() {
|
||||
{
|
||||
// when we apply conflicted branch, it has conflict
|
||||
controller
|
||||
.apply_virtual_branch(*project_id, &branch1_id)
|
||||
.apply_virtual_branch(*project_id, branch1_id)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -151,7 +151,7 @@ async fn resolve_conflict_flow() {
|
||||
// can't commit conflicts
|
||||
assert!(matches!(
|
||||
controller
|
||||
.create_commit(*project_id, &branch1_id, "commit conflicts", None, false)
|
||||
.create_commit(*project_id, branch1_id, "commit conflicts", None, false)
|
||||
.await
|
||||
.unwrap_err()
|
||||
.downcast_ref(),
|
||||
@ -163,7 +163,7 @@ async fn resolve_conflict_flow() {
|
||||
// fixing the conflict removes conflicted mark
|
||||
fs::write(repository.path().join("file.txt"), "resolved").unwrap();
|
||||
let commit_oid = controller
|
||||
.create_commit(*project_id, &branch1_id, "resolution", None, false)
|
||||
.create_commit(*project_id, branch1_id, "resolution", None, false)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
|
@ -22,7 +22,7 @@ async fn move_file_down() {
|
||||
// create commit
|
||||
fs::write(repository.path().join("file.txt"), "content").unwrap();
|
||||
let commit1_id = controller
|
||||
.create_commit(*project_id, &branch_id, "commit one", None, false)
|
||||
.create_commit(*project_id, branch_id, "commit one", None, false)
|
||||
.await
|
||||
.unwrap();
|
||||
let commit1 = repository.find_commit(commit1_id).unwrap();
|
||||
@ -31,7 +31,7 @@ async fn move_file_down() {
|
||||
fs::write(repository.path().join("file2.txt"), "content2").unwrap();
|
||||
fs::write(repository.path().join("file3.txt"), "content3").unwrap();
|
||||
let commit2_id = controller
|
||||
.create_commit(*project_id, &branch_id, "commit two", None, false)
|
||||
.create_commit(*project_id, branch_id, "commit two", None, false)
|
||||
.await
|
||||
.unwrap();
|
||||
let commit2 = repository.find_commit(commit2_id).unwrap();
|
||||
@ -39,7 +39,7 @@ async fn move_file_down() {
|
||||
// amend another hunk
|
||||
let to_amend: branch::BranchOwnershipClaims = "file2.txt:1-2".parse().unwrap();
|
||||
controller
|
||||
.move_commit_file(*project_id, &branch_id, commit2_id, commit1_id, &to_amend)
|
||||
.move_commit_file(*project_id, branch_id, commit2_id, commit1_id, &to_amend)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -87,21 +87,21 @@ async fn move_file_up() {
|
||||
fs::write(repository.path().join("file.txt"), "content").unwrap();
|
||||
fs::write(repository.path().join("file2.txt"), "content2").unwrap();
|
||||
let commit1_id = controller
|
||||
.create_commit(*project_id, &branch_id, "commit one", None, false)
|
||||
.create_commit(*project_id, branch_id, "commit one", None, false)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
// create commit
|
||||
fs::write(repository.path().join("file3.txt"), "content3").unwrap();
|
||||
let commit2_id = controller
|
||||
.create_commit(*project_id, &branch_id, "commit two", None, false)
|
||||
.create_commit(*project_id, branch_id, "commit two", None, false)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
// amend another hunk
|
||||
let to_amend: branch::BranchOwnershipClaims = "file2.txt:1-2".parse().unwrap();
|
||||
controller
|
||||
.move_commit_file(*project_id, &branch_id, commit1_id, commit2_id, &to_amend)
|
||||
.move_commit_file(*project_id, branch_id, commit1_id, commit2_id, &to_amend)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -145,7 +145,7 @@ async fn move_file_up_overlapping_hunks() {
|
||||
// create bottom commit
|
||||
fs::write(repository.path().join("file.txt"), "content").unwrap();
|
||||
let _commit1_id = controller
|
||||
.create_commit(*project_id, &branch_id, "commit one", None, false)
|
||||
.create_commit(*project_id, branch_id, "commit one", None, false)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -153,7 +153,7 @@ async fn move_file_up_overlapping_hunks() {
|
||||
fs::write(repository.path().join("file2.txt"), "content2\ncontent2a\n").unwrap();
|
||||
fs::write(repository.path().join("file3.txt"), "content3").unwrap();
|
||||
let commit2_id = controller
|
||||
.create_commit(*project_id, &branch_id, "commit two", None, false)
|
||||
.create_commit(*project_id, branch_id, "commit two", None, false)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -165,21 +165,21 @@ async fn move_file_up_overlapping_hunks() {
|
||||
.unwrap();
|
||||
fs::write(repository.path().join("file4.txt"), "content4").unwrap();
|
||||
let commit3_id = controller
|
||||
.create_commit(*project_id, &branch_id, "commit three", None, false)
|
||||
.create_commit(*project_id, branch_id, "commit three", None, false)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
// create top commit
|
||||
fs::write(repository.path().join("file5.txt"), "content5").unwrap();
|
||||
let _commit4_id = controller
|
||||
.create_commit(*project_id, &branch_id, "commit four", None, false)
|
||||
.create_commit(*project_id, branch_id, "commit four", None, false)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
// move one line from middle commit two up to middle commit one
|
||||
let to_amend: branch::BranchOwnershipClaims = "file2.txt:1-6".parse().unwrap();
|
||||
controller
|
||||
.move_commit_file(*project_id, &branch_id, commit2_id, commit3_id, &to_amend)
|
||||
.move_commit_file(*project_id, branch_id, commit2_id, commit3_id, &to_amend)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
|
@ -29,7 +29,7 @@ async fn no_diffs() {
|
||||
let source_branch_id = branches[0].id;
|
||||
|
||||
let commit_oid = controller
|
||||
.create_commit(*project_id, &source_branch_id, "commit", None, false)
|
||||
.create_commit(*project_id, source_branch_id, "commit", None, false)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -39,7 +39,7 @@ async fn no_diffs() {
|
||||
.unwrap();
|
||||
|
||||
controller
|
||||
.move_commit(*project_id, &target_branch_id, commit_oid)
|
||||
.move_commit(*project_id, target_branch_id, commit_oid)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -89,7 +89,7 @@ async fn diffs_on_source_branch() {
|
||||
let source_branch_id = branches[0].id;
|
||||
|
||||
let commit_oid = controller
|
||||
.create_commit(*project_id, &source_branch_id, "commit", None, false)
|
||||
.create_commit(*project_id, source_branch_id, "commit", None, false)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -105,7 +105,7 @@ async fn diffs_on_source_branch() {
|
||||
.unwrap();
|
||||
|
||||
controller
|
||||
.move_commit(*project_id, &target_branch_id, commit_oid)
|
||||
.move_commit(*project_id, target_branch_id, commit_oid)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -155,7 +155,7 @@ async fn diffs_on_target_branch() {
|
||||
let source_branch_id = branches[0].id;
|
||||
|
||||
let commit_oid = controller
|
||||
.create_commit(*project_id, &source_branch_id, "commit", None, false)
|
||||
.create_commit(*project_id, source_branch_id, "commit", None, false)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -177,7 +177,7 @@ async fn diffs_on_target_branch() {
|
||||
.unwrap();
|
||||
|
||||
controller
|
||||
.move_commit(*project_id, &target_branch_id, commit_oid)
|
||||
.move_commit(*project_id, target_branch_id, commit_oid)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -227,7 +227,7 @@ async fn locked_hunks_on_source_branch() {
|
||||
let source_branch_id = branches[0].id;
|
||||
|
||||
let commit_oid = controller
|
||||
.create_commit(*project_id, &source_branch_id, "commit", None, false)
|
||||
.create_commit(*project_id, source_branch_id, "commit", None, false)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -240,7 +240,7 @@ async fn locked_hunks_on_source_branch() {
|
||||
|
||||
assert!(matches!(
|
||||
controller
|
||||
.move_commit(*project_id, &target_branch_id, commit_oid)
|
||||
.move_commit(*project_id, target_branch_id, commit_oid)
|
||||
.await
|
||||
.unwrap_err()
|
||||
.downcast_ref(),
|
||||
@ -270,7 +270,7 @@ async fn no_commit() {
|
||||
let source_branch_id = branches[0].id;
|
||||
|
||||
controller
|
||||
.create_commit(*project_id, &source_branch_id, "commit", None, false)
|
||||
.create_commit(*project_id, source_branch_id, "commit", None, false)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -283,7 +283,7 @@ async fn no_commit() {
|
||||
controller
|
||||
.move_commit(
|
||||
*project_id,
|
||||
&target_branch_id,
|
||||
target_branch_id,
|
||||
git::Oid::from_str("a99c95cca7a60f1a2180c2f86fb18af97333c192").unwrap()
|
||||
)
|
||||
.await
|
||||
@ -315,13 +315,13 @@ async fn no_branch() {
|
||||
let source_branch_id = branches[0].id;
|
||||
|
||||
let commit_oid = controller
|
||||
.create_commit(*project_id, &source_branch_id, "commit", None, false)
|
||||
.create_commit(*project_id, source_branch_id, "commit", None, false)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
assert!(matches!(
|
||||
controller
|
||||
.move_commit(*project_id, &BranchId::generate(), commit_oid)
|
||||
.move_commit(*project_id, BranchId::generate(), commit_oid)
|
||||
.await
|
||||
.unwrap_err()
|
||||
.downcast_ref(),
|
||||
|
@ -32,7 +32,7 @@ async fn workdir_vbranch_restore() -> anyhow::Result<()> {
|
||||
controller
|
||||
.create_commit(
|
||||
*project_id,
|
||||
&branch_id,
|
||||
branch_id,
|
||||
"first commit",
|
||||
None,
|
||||
false, /* run hook */
|
||||
@ -77,7 +77,7 @@ async fn basic_oplog() -> anyhow::Result<()> {
|
||||
// create commit
|
||||
fs::write(repository.path().join("file.txt"), "content")?;
|
||||
let _commit1_id = controller
|
||||
.create_commit(*project_id, &branch_id, "commit one", None, false)
|
||||
.create_commit(*project_id, branch_id, "commit one", None, false)
|
||||
.await?;
|
||||
|
||||
// dont store large files
|
||||
@ -93,7 +93,7 @@ async fn basic_oplog() -> anyhow::Result<()> {
|
||||
fs::write(repository.path().join("file2.txt"), "content2")?;
|
||||
fs::write(repository.path().join("file3.txt"), "content3")?;
|
||||
let commit2_id = controller
|
||||
.create_commit(*project_id, &branch_id, "commit two", None, false)
|
||||
.create_commit(*project_id, branch_id, "commit two", None, false)
|
||||
.await?;
|
||||
|
||||
// Create conflict state
|
||||
@ -112,7 +112,7 @@ async fn basic_oplog() -> anyhow::Result<()> {
|
||||
|
||||
fs::write(repository.path().join("file4.txt"), "content4")?;
|
||||
let _commit3_id = controller
|
||||
.create_commit(*project_id, &branch_id, "commit three", None, false)
|
||||
.create_commit(*project_id, branch_id, "commit three", None, false)
|
||||
.await?;
|
||||
|
||||
let branch = controller
|
||||
@ -229,7 +229,7 @@ async fn restores_gitbutler_integration() -> anyhow::Result<()> {
|
||||
// create commit
|
||||
fs::write(repository.path().join("file.txt"), "content")?;
|
||||
let _commit1_id = controller
|
||||
.create_commit(*project_id, &branch_id, "commit one", None, false)
|
||||
.create_commit(*project_id, branch_id, "commit one", None, false)
|
||||
.await?;
|
||||
|
||||
let repo = git2::Repository::open(&project.path)?;
|
||||
@ -244,7 +244,7 @@ async fn restores_gitbutler_integration() -> anyhow::Result<()> {
|
||||
// create second commit
|
||||
fs::write(repository.path().join("file.txt"), "changed content")?;
|
||||
let _commit2_id = controller
|
||||
.create_commit(*project_id, &branch_id, "commit two", None, false)
|
||||
.create_commit(*project_id, branch_id, "commit two", None, false)
|
||||
.await?;
|
||||
|
||||
// check the integration commit changed
|
||||
|
@ -238,11 +238,11 @@ mod push_virtual_branch {
|
||||
fs::write(repository.path().join("file.txt"), "content").unwrap();
|
||||
|
||||
controller
|
||||
.create_commit(*project_id, &branch1_id, "test", None, false)
|
||||
.create_commit(*project_id, branch1_id, "test", None, false)
|
||||
.await
|
||||
.unwrap();
|
||||
controller
|
||||
.push_virtual_branch(*project_id, &branch1_id, false, None)
|
||||
.push_virtual_branch(*project_id, branch1_id, false, None)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -291,11 +291,11 @@ mod push_virtual_branch {
|
||||
.unwrap();
|
||||
fs::write(repository.path().join("file.txt"), "content").unwrap();
|
||||
controller
|
||||
.create_commit(*project_id, &branch1_id, "test", None, false)
|
||||
.create_commit(*project_id, branch1_id, "test", None, false)
|
||||
.await
|
||||
.unwrap();
|
||||
controller
|
||||
.push_virtual_branch(*project_id, &branch1_id, false, None)
|
||||
.push_virtual_branch(*project_id, branch1_id, false, None)
|
||||
.await
|
||||
.unwrap();
|
||||
branch1_id
|
||||
@ -328,11 +328,11 @@ mod push_virtual_branch {
|
||||
.unwrap();
|
||||
fs::write(repository.path().join("file.txt"), "updated content").unwrap();
|
||||
controller
|
||||
.create_commit(*project_id, &branch2_id, "test", None, false)
|
||||
.create_commit(*project_id, branch2_id, "test", None, false)
|
||||
.await
|
||||
.unwrap();
|
||||
controller
|
||||
.push_virtual_branch(*project_id, &branch2_id, false, None)
|
||||
.push_virtual_branch(*project_id, branch2_id, false, None)
|
||||
.await
|
||||
.unwrap();
|
||||
branch2_id
|
||||
|
@ -22,7 +22,7 @@ async fn reorder_commit_down() {
|
||||
// create commit
|
||||
fs::write(repository.path().join("file.txt"), "content").unwrap();
|
||||
let _commit1_id = controller
|
||||
.create_commit(*project_id, &branch_id, "commit one", None, false)
|
||||
.create_commit(*project_id, branch_id, "commit one", None, false)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -30,12 +30,12 @@ async fn reorder_commit_down() {
|
||||
fs::write(repository.path().join("file2.txt"), "content2").unwrap();
|
||||
fs::write(repository.path().join("file3.txt"), "content3").unwrap();
|
||||
let commit2_id = controller
|
||||
.create_commit(*project_id, &branch_id, "commit two", None, false)
|
||||
.create_commit(*project_id, branch_id, "commit two", None, false)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
controller
|
||||
.reorder_commit(*project_id, &branch_id, commit2_id, 1)
|
||||
.reorder_commit(*project_id, branch_id, commit2_id, 1)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -83,7 +83,7 @@ async fn reorder_commit_up() {
|
||||
// create commit
|
||||
fs::write(repository.path().join("file.txt"), "content").unwrap();
|
||||
let commit1_id = controller
|
||||
.create_commit(*project_id, &branch_id, "commit one", None, false)
|
||||
.create_commit(*project_id, branch_id, "commit one", None, false)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -91,12 +91,12 @@ async fn reorder_commit_up() {
|
||||
fs::write(repository.path().join("file2.txt"), "content2").unwrap();
|
||||
fs::write(repository.path().join("file3.txt"), "content3").unwrap();
|
||||
let _commit2_id = controller
|
||||
.create_commit(*project_id, &branch_id, "commit two", None, false)
|
||||
.create_commit(*project_id, branch_id, "commit two", None, false)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
controller
|
||||
.reorder_commit(*project_id, &branch_id, commit1_id, -1)
|
||||
.reorder_commit(*project_id, branch_id, commit1_id, -1)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
|
@ -28,7 +28,7 @@ async fn to_head() {
|
||||
|
||||
// commit changes
|
||||
let oid = controller
|
||||
.create_commit(*project_id, &branch1_id, "commit", None, false)
|
||||
.create_commit(*project_id, branch1_id, "commit", None, false)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -49,7 +49,7 @@ async fn to_head() {
|
||||
{
|
||||
// reset changes to head
|
||||
controller
|
||||
.reset_virtual_branch(*project_id, &branch1_id, oid)
|
||||
.reset_virtual_branch(*project_id, branch1_id, oid)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -90,7 +90,7 @@ async fn to_target() {
|
||||
|
||||
// commit changes
|
||||
let oid = controller
|
||||
.create_commit(*project_id, &branch1_id, "commit", None, false)
|
||||
.create_commit(*project_id, branch1_id, "commit", None, false)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -109,7 +109,7 @@ async fn to_target() {
|
||||
{
|
||||
// reset changes to head
|
||||
controller
|
||||
.reset_virtual_branch(*project_id, &branch1_id, base_branch.base_sha)
|
||||
.reset_virtual_branch(*project_id, branch1_id, base_branch.base_sha)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -150,7 +150,7 @@ async fn to_commit() {
|
||||
fs::write(repository.path().join("file.txt"), "content").unwrap();
|
||||
|
||||
let oid = controller
|
||||
.create_commit(*project_id, &branch1_id, "commit", None, false)
|
||||
.create_commit(*project_id, branch1_id, "commit", None, false)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -173,7 +173,7 @@ async fn to_commit() {
|
||||
fs::write(repository.path().join("file.txt"), "more content").unwrap();
|
||||
|
||||
let second_commit_oid = controller
|
||||
.create_commit(*project_id, &branch1_id, "commit", None, false)
|
||||
.create_commit(*project_id, branch1_id, "commit", None, false)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -193,7 +193,7 @@ async fn to_commit() {
|
||||
{
|
||||
// reset changes to the first commit
|
||||
controller
|
||||
.reset_virtual_branch(*project_id, &branch1_id, first_commit_oid)
|
||||
.reset_virtual_branch(*project_id, branch1_id, first_commit_oid)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -234,7 +234,7 @@ async fn to_non_existing() {
|
||||
|
||||
// commit changes
|
||||
let oid = controller
|
||||
.create_commit(*project_id, &branch1_id, "commit", None, false)
|
||||
.create_commit(*project_id, branch1_id, "commit", None, false)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -256,7 +256,7 @@ async fn to_non_existing() {
|
||||
controller
|
||||
.reset_virtual_branch(
|
||||
*project_id,
|
||||
&branch1_id,
|
||||
branch1_id,
|
||||
"fe14df8c66b73c6276f7bb26102ad91da680afcb".parse().unwrap()
|
||||
)
|
||||
.await
|
||||
|
@ -38,7 +38,7 @@ async fn unapplying_selected_branch_selects_anther() {
|
||||
assert!(!b2.selected_for_changes);
|
||||
|
||||
controller
|
||||
.unapply_virtual_branch(*project_id, &b_id)
|
||||
.unapply_virtual_branch(*project_id, b_id)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -88,7 +88,7 @@ async fn deleting_selected_branch_selects_anther() {
|
||||
assert!(!b2.selected_for_changes);
|
||||
|
||||
controller
|
||||
.delete_virtual_branch(*project_id, &b_id)
|
||||
.delete_virtual_branch(*project_id, b_id)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -290,7 +290,7 @@ async fn unapply_virtual_branch_should_reset_selected_for_changes() {
|
||||
assert!(b1.selected_for_changes);
|
||||
|
||||
controller
|
||||
.unapply_virtual_branch(*project_id, &b1_id)
|
||||
.unapply_virtual_branch(*project_id, b1_id)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -360,11 +360,11 @@ async fn applying_first_branch() {
|
||||
assert_eq!(branches.len(), 1);
|
||||
|
||||
controller
|
||||
.unapply_virtual_branch(*project_id, &branches[0].id)
|
||||
.unapply_virtual_branch(*project_id, branches[0].id)
|
||||
.await
|
||||
.unwrap();
|
||||
controller
|
||||
.apply_virtual_branch(*project_id, &branches[0].id)
|
||||
.apply_virtual_branch(*project_id, branches[0].id)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
|
@ -71,7 +71,7 @@ mod go_back_to_integration {
|
||||
|
||||
std::fs::write(repository.path().join("another file.txt"), "content").unwrap();
|
||||
controller
|
||||
.create_commit(*project_id, &vbranch_id, "one", None, false)
|
||||
.create_commit(*project_id, vbranch_id, "one", None, false)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
|
@ -22,7 +22,7 @@ async fn head() {
|
||||
{
|
||||
fs::write(repository.path().join("file one.txt"), "").unwrap();
|
||||
controller
|
||||
.create_commit(*project_id, &branch_id, "commit one", None, false)
|
||||
.create_commit(*project_id, branch_id, "commit one", None, false)
|
||||
.await
|
||||
.unwrap()
|
||||
};
|
||||
@ -30,7 +30,7 @@ async fn head() {
|
||||
{
|
||||
fs::write(repository.path().join("file two.txt"), "").unwrap();
|
||||
controller
|
||||
.create_commit(*project_id, &branch_id, "commit two", None, false)
|
||||
.create_commit(*project_id, branch_id, "commit two", None, false)
|
||||
.await
|
||||
.unwrap()
|
||||
};
|
||||
@ -38,7 +38,7 @@ async fn head() {
|
||||
{
|
||||
fs::write(repository.path().join("file three.txt"), "").unwrap();
|
||||
controller
|
||||
.create_commit(*project_id, &branch_id, "commit three", None, false)
|
||||
.create_commit(*project_id, branch_id, "commit three", None, false)
|
||||
.await
|
||||
.unwrap()
|
||||
};
|
||||
@ -46,13 +46,13 @@ async fn head() {
|
||||
let commit_four_oid = {
|
||||
fs::write(repository.path().join("file four.txt"), "").unwrap();
|
||||
controller
|
||||
.create_commit(*project_id, &branch_id, "commit four", None, false)
|
||||
.create_commit(*project_id, branch_id, "commit four", None, false)
|
||||
.await
|
||||
.unwrap()
|
||||
};
|
||||
|
||||
controller
|
||||
.squash(*project_id, &branch_id, commit_four_oid)
|
||||
.squash(*project_id, branch_id, commit_four_oid)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -98,7 +98,7 @@ async fn middle() {
|
||||
{
|
||||
fs::write(repository.path().join("file one.txt"), "").unwrap();
|
||||
controller
|
||||
.create_commit(*project_id, &branch_id, "commit one", None, false)
|
||||
.create_commit(*project_id, branch_id, "commit one", None, false)
|
||||
.await
|
||||
.unwrap()
|
||||
};
|
||||
@ -106,7 +106,7 @@ async fn middle() {
|
||||
let commit_two_oid = {
|
||||
fs::write(repository.path().join("file two.txt"), "").unwrap();
|
||||
controller
|
||||
.create_commit(*project_id, &branch_id, "commit two", None, false)
|
||||
.create_commit(*project_id, branch_id, "commit two", None, false)
|
||||
.await
|
||||
.unwrap()
|
||||
};
|
||||
@ -114,7 +114,7 @@ async fn middle() {
|
||||
{
|
||||
fs::write(repository.path().join("file three.txt"), "").unwrap();
|
||||
controller
|
||||
.create_commit(*project_id, &branch_id, "commit three", None, false)
|
||||
.create_commit(*project_id, branch_id, "commit three", None, false)
|
||||
.await
|
||||
.unwrap()
|
||||
};
|
||||
@ -122,13 +122,13 @@ async fn middle() {
|
||||
{
|
||||
fs::write(repository.path().join("file four.txt"), "").unwrap();
|
||||
controller
|
||||
.create_commit(*project_id, &branch_id, "commit four", None, false)
|
||||
.create_commit(*project_id, branch_id, "commit four", None, false)
|
||||
.await
|
||||
.unwrap()
|
||||
};
|
||||
|
||||
controller
|
||||
.squash(*project_id, &branch_id, commit_two_oid)
|
||||
.squash(*project_id, branch_id, commit_two_oid)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -184,20 +184,20 @@ async fn forcepush_allowed() {
|
||||
{
|
||||
fs::write(repository.path().join("file one.txt"), "").unwrap();
|
||||
controller
|
||||
.create_commit(*project_id, &branch_id, "commit one", None, false)
|
||||
.create_commit(*project_id, branch_id, "commit one", None, false)
|
||||
.await
|
||||
.unwrap()
|
||||
};
|
||||
|
||||
controller
|
||||
.push_virtual_branch(*project_id, &branch_id, false, None)
|
||||
.push_virtual_branch(*project_id, branch_id, false, None)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
let commit_two_oid = {
|
||||
fs::write(repository.path().join("file two.txt"), "").unwrap();
|
||||
controller
|
||||
.create_commit(*project_id, &branch_id, "commit two", None, false)
|
||||
.create_commit(*project_id, branch_id, "commit two", None, false)
|
||||
.await
|
||||
.unwrap()
|
||||
};
|
||||
@ -205,7 +205,7 @@ async fn forcepush_allowed() {
|
||||
{
|
||||
fs::write(repository.path().join("file three.txt"), "").unwrap();
|
||||
controller
|
||||
.create_commit(*project_id, &branch_id, "commit three", None, false)
|
||||
.create_commit(*project_id, branch_id, "commit three", None, false)
|
||||
.await
|
||||
.unwrap()
|
||||
};
|
||||
@ -213,13 +213,13 @@ async fn forcepush_allowed() {
|
||||
{
|
||||
fs::write(repository.path().join("file four.txt"), "").unwrap();
|
||||
controller
|
||||
.create_commit(*project_id, &branch_id, "commit four", None, false)
|
||||
.create_commit(*project_id, branch_id, "commit four", None, false)
|
||||
.await
|
||||
.unwrap()
|
||||
};
|
||||
|
||||
controller
|
||||
.squash(*project_id, &branch_id, commit_two_oid)
|
||||
.squash(*project_id, branch_id, commit_two_oid)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -267,13 +267,13 @@ async fn forcepush_forbidden() {
|
||||
{
|
||||
fs::write(repository.path().join("file one.txt"), "").unwrap();
|
||||
controller
|
||||
.create_commit(*project_id, &branch_id, "commit one", None, false)
|
||||
.create_commit(*project_id, branch_id, "commit one", None, false)
|
||||
.await
|
||||
.unwrap()
|
||||
};
|
||||
|
||||
controller
|
||||
.push_virtual_branch(*project_id, &branch_id, false, None)
|
||||
.push_virtual_branch(*project_id, branch_id, false, None)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -289,7 +289,7 @@ async fn forcepush_forbidden() {
|
||||
let commit_two_oid = {
|
||||
fs::write(repository.path().join("file two.txt"), "").unwrap();
|
||||
controller
|
||||
.create_commit(*project_id, &branch_id, "commit two", None, false)
|
||||
.create_commit(*project_id, branch_id, "commit two", None, false)
|
||||
.await
|
||||
.unwrap()
|
||||
};
|
||||
@ -297,7 +297,7 @@ async fn forcepush_forbidden() {
|
||||
{
|
||||
fs::write(repository.path().join("file three.txt"), "").unwrap();
|
||||
controller
|
||||
.create_commit(*project_id, &branch_id, "commit three", None, false)
|
||||
.create_commit(*project_id, branch_id, "commit three", None, false)
|
||||
.await
|
||||
.unwrap()
|
||||
};
|
||||
@ -305,14 +305,14 @@ async fn forcepush_forbidden() {
|
||||
{
|
||||
fs::write(repository.path().join("file four.txt"), "").unwrap();
|
||||
controller
|
||||
.create_commit(*project_id, &branch_id, "commit four", None, false)
|
||||
.create_commit(*project_id, branch_id, "commit four", None, false)
|
||||
.await
|
||||
.unwrap()
|
||||
};
|
||||
|
||||
assert!(matches!(
|
||||
controller
|
||||
.squash(*project_id, &branch_id, commit_two_oid)
|
||||
.squash(*project_id, branch_id, commit_two_oid)
|
||||
.await
|
||||
.unwrap_err()
|
||||
.downcast_ref(),
|
||||
@ -342,14 +342,14 @@ async fn root() {
|
||||
let commit_one_oid = {
|
||||
fs::write(repository.path().join("file one.txt"), "").unwrap();
|
||||
controller
|
||||
.create_commit(*project_id, &branch_id, "commit one", None, false)
|
||||
.create_commit(*project_id, branch_id, "commit one", None, false)
|
||||
.await
|
||||
.unwrap()
|
||||
};
|
||||
|
||||
assert!(matches!(
|
||||
controller
|
||||
.squash(*project_id, &branch_id, commit_one_oid)
|
||||
.squash(*project_id, branch_id, commit_one_oid)
|
||||
.await
|
||||
.unwrap_err()
|
||||
.downcast_ref(),
|
||||
|
@ -20,7 +20,7 @@ async fn unapply_with_data() {
|
||||
assert_eq!(branches.len(), 1);
|
||||
|
||||
controller
|
||||
.unapply_virtual_branch(*project_id, &branches[0].id)
|
||||
.unapply_virtual_branch(*project_id, branches[0].id)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -70,7 +70,7 @@ async fn conflicting() {
|
||||
);
|
||||
|
||||
controller
|
||||
.unapply_virtual_branch(*project_id, &branches[0].id)
|
||||
.unapply_virtual_branch(*project_id, branches[0].id)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -101,7 +101,7 @@ async fn conflicting() {
|
||||
{
|
||||
// apply branch, it should conflict
|
||||
controller
|
||||
.apply_virtual_branch(*project_id, &branch_id)
|
||||
.apply_virtual_branch(*project_id, branch_id)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -125,7 +125,7 @@ async fn conflicting() {
|
||||
|
||||
{
|
||||
controller
|
||||
.unapply_virtual_branch(*project_id, &branch_id)
|
||||
.unapply_virtual_branch(*project_id, branch_id)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -174,7 +174,7 @@ async fn delete_if_empty() {
|
||||
assert_eq!(branches.len(), 1);
|
||||
|
||||
controller
|
||||
.unapply_virtual_branch(*project_id, &branches[0].id)
|
||||
.unapply_virtual_branch(*project_id, branches[0].id)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
|
@ -29,7 +29,7 @@ async fn should_unapply_with_commits() {
|
||||
)
|
||||
.unwrap();
|
||||
controller
|
||||
.create_commit(*project_id, &branch_id, "test", None, false)
|
||||
.create_commit(*project_id, branch_id, "test", None, false)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
|
@ -22,7 +22,7 @@ async fn undo_commit_simple() {
|
||||
// create commit
|
||||
fs::write(repository.path().join("file.txt"), "content").unwrap();
|
||||
let _commit1_id = controller
|
||||
.create_commit(*project_id, &branch_id, "commit one", None, false)
|
||||
.create_commit(*project_id, branch_id, "commit one", None, false)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -30,19 +30,19 @@ async fn undo_commit_simple() {
|
||||
fs::write(repository.path().join("file2.txt"), "content2").unwrap();
|
||||
fs::write(repository.path().join("file3.txt"), "content3").unwrap();
|
||||
let commit2_id = controller
|
||||
.create_commit(*project_id, &branch_id, "commit two", None, false)
|
||||
.create_commit(*project_id, branch_id, "commit two", None, false)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
// create commit
|
||||
fs::write(repository.path().join("file4.txt"), "content4").unwrap();
|
||||
let _commit3_id = controller
|
||||
.create_commit(*project_id, &branch_id, "commit three", None, false)
|
||||
.create_commit(*project_id, branch_id, "commit three", None, false)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
controller
|
||||
.undo_commit(*project_id, &branch_id, commit2_id)
|
||||
.undo_commit(*project_id, branch_id, commit2_id)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
|
@ -37,7 +37,7 @@ mod unapplied_branch {
|
||||
|
||||
fs::write(repository.path().join("file.txt"), "conflict").unwrap();
|
||||
controller
|
||||
.unapply_virtual_branch(*project_id, &branch_id)
|
||||
.unapply_virtual_branch(*project_id, branch_id)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -58,7 +58,7 @@ mod unapplied_branch {
|
||||
assert_eq!(branches[0].files.len(), 1);
|
||||
assert_eq!(branches[0].commits.len(), 0);
|
||||
assert!(!controller
|
||||
.can_apply_virtual_branch(*project_id, &branch_id)
|
||||
.can_apply_virtual_branch(*project_id, branch_id)
|
||||
.await
|
||||
.unwrap());
|
||||
}
|
||||
@ -66,7 +66,7 @@ mod unapplied_branch {
|
||||
{
|
||||
// applying the branch should produce conflict markers
|
||||
controller
|
||||
.apply_virtual_branch(*project_id, &branch_id)
|
||||
.apply_virtual_branch(*project_id, branch_id)
|
||||
.await
|
||||
.unwrap();
|
||||
let (branches, _) = controller.list_virtual_branches(*project_id).await.unwrap();
|
||||
@ -118,12 +118,12 @@ mod unapplied_branch {
|
||||
|
||||
fs::write(repository.path().join("file.txt"), "conflict").unwrap();
|
||||
controller
|
||||
.create_commit(*project_id, &branch_id, "conflicting commit", None, false)
|
||||
.create_commit(*project_id, branch_id, "conflicting commit", None, false)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
controller
|
||||
.unapply_virtual_branch(*project_id, &branch_id)
|
||||
.unapply_virtual_branch(*project_id, branch_id)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -144,7 +144,7 @@ mod unapplied_branch {
|
||||
assert_eq!(branches[0].files.len(), 0);
|
||||
assert_eq!(branches[0].commits.len(), 1);
|
||||
assert!(!controller
|
||||
.can_apply_virtual_branch(*project_id, &branch_id)
|
||||
.can_apply_virtual_branch(*project_id, branch_id)
|
||||
.await
|
||||
.unwrap());
|
||||
}
|
||||
@ -152,7 +152,7 @@ mod unapplied_branch {
|
||||
{
|
||||
// applying the branch should produce conflict markers
|
||||
controller
|
||||
.apply_virtual_branch(*project_id, &branch_id)
|
||||
.apply_virtual_branch(*project_id, branch_id)
|
||||
.await
|
||||
.unwrap();
|
||||
let (branches, _) = controller.list_virtual_branches(*project_id).await.unwrap();
|
||||
@ -204,17 +204,17 @@ mod unapplied_branch {
|
||||
|
||||
fs::write(repository.path().join("file.txt"), "conflict").unwrap();
|
||||
controller
|
||||
.create_commit(*project_id, &branch_id, "conflicting commit", None, false)
|
||||
.create_commit(*project_id, branch_id, "conflicting commit", None, false)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
controller
|
||||
.push_virtual_branch(*project_id, &branch_id, false, None)
|
||||
.push_virtual_branch(*project_id, branch_id, false, None)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
controller
|
||||
.unapply_virtual_branch(*project_id, &branch_id)
|
||||
.unapply_virtual_branch(*project_id, branch_id)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -235,7 +235,7 @@ mod unapplied_branch {
|
||||
assert_eq!(branches[0].files.len(), 0);
|
||||
assert_eq!(branches[0].commits.len(), 1);
|
||||
assert!(!controller
|
||||
.can_apply_virtual_branch(*project_id, &branch_id)
|
||||
.can_apply_virtual_branch(*project_id, branch_id)
|
||||
.await
|
||||
.unwrap());
|
||||
}
|
||||
@ -243,7 +243,7 @@ mod unapplied_branch {
|
||||
{
|
||||
// applying the branch should produce conflict markers
|
||||
controller
|
||||
.apply_virtual_branch(*project_id, &branch_id)
|
||||
.apply_virtual_branch(*project_id, branch_id)
|
||||
.await
|
||||
.unwrap();
|
||||
let (branches, _) = controller.list_virtual_branches(*project_id).await.unwrap();
|
||||
@ -295,14 +295,14 @@ mod unapplied_branch {
|
||||
|
||||
fs::write(repository.path().join("file.txt"), "conflict").unwrap();
|
||||
controller
|
||||
.create_commit(*project_id, &branch_id, "conflicting commit", None, false)
|
||||
.create_commit(*project_id, branch_id, "conflicting commit", None, false)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
fs::write(repository.path().join("file.txt"), "fix conflict").unwrap();
|
||||
|
||||
controller
|
||||
.unapply_virtual_branch(*project_id, &branch_id)
|
||||
.unapply_virtual_branch(*project_id, branch_id)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -323,7 +323,7 @@ mod unapplied_branch {
|
||||
assert_eq!(branches[0].files.len(), 1);
|
||||
assert_eq!(branches[0].commits.len(), 1);
|
||||
assert!(!controller
|
||||
.can_apply_virtual_branch(*project_id, &branch_id)
|
||||
.can_apply_virtual_branch(*project_id, branch_id)
|
||||
.await
|
||||
.unwrap()); // TODO: should be true
|
||||
}
|
||||
@ -331,7 +331,7 @@ mod unapplied_branch {
|
||||
{
|
||||
// applying the branch should produce conflict markers
|
||||
controller
|
||||
.apply_virtual_branch(*project_id, &branch_id)
|
||||
.apply_virtual_branch(*project_id, branch_id)
|
||||
.await
|
||||
.unwrap();
|
||||
let (branches, _) = controller.list_virtual_branches(*project_id).await.unwrap();
|
||||
@ -383,14 +383,14 @@ mod unapplied_branch {
|
||||
|
||||
fs::write(repository.path().join("file.txt"), "conflict").unwrap();
|
||||
controller
|
||||
.create_commit(*project_id, &branch_id, "conflicting commit", None, false)
|
||||
.create_commit(*project_id, branch_id, "conflicting commit", None, false)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
fs::write(repository.path().join("file.txt"), "fix conflict").unwrap();
|
||||
|
||||
controller
|
||||
.unapply_virtual_branch(*project_id, &branch_id)
|
||||
.unapply_virtual_branch(*project_id, branch_id)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -411,7 +411,7 @@ mod unapplied_branch {
|
||||
assert_eq!(branches[0].commits.len(), 1);
|
||||
assert_eq!(branches[0].files.len(), 1);
|
||||
assert!(!controller
|
||||
.can_apply_virtual_branch(*project_id, &branch_id)
|
||||
.can_apply_virtual_branch(*project_id, branch_id)
|
||||
.await
|
||||
.unwrap());
|
||||
}
|
||||
@ -419,7 +419,7 @@ mod unapplied_branch {
|
||||
{
|
||||
// applying the branch should produce conflict markers
|
||||
controller
|
||||
.apply_virtual_branch(*project_id, &branch_id)
|
||||
.apply_virtual_branch(*project_id, branch_id)
|
||||
.await
|
||||
.unwrap();
|
||||
let (branches, _) = controller.list_virtual_branches(*project_id).await.unwrap();
|
||||
@ -473,7 +473,7 @@ mod unapplied_branch {
|
||||
controller
|
||||
.create_commit(
|
||||
*project_id,
|
||||
&branch_id,
|
||||
branch_id,
|
||||
"non conflicting commit",
|
||||
None,
|
||||
false,
|
||||
@ -484,7 +484,7 @@ mod unapplied_branch {
|
||||
fs::write(repository.path().join("file2.txt"), "still no conflicts").unwrap();
|
||||
|
||||
controller
|
||||
.unapply_virtual_branch(*project_id, &branch_id)
|
||||
.unapply_virtual_branch(*project_id, branch_id)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -506,7 +506,7 @@ mod unapplied_branch {
|
||||
assert_eq!(branches[0].commits.len(), 1);
|
||||
assert!(branches[0].upstream.is_none());
|
||||
assert!(controller
|
||||
.can_apply_virtual_branch(*project_id, &branch_id)
|
||||
.can_apply_virtual_branch(*project_id, branch_id)
|
||||
.await
|
||||
.unwrap());
|
||||
}
|
||||
@ -514,7 +514,7 @@ mod unapplied_branch {
|
||||
{
|
||||
// applying the branch should produce conflict markers
|
||||
controller
|
||||
.apply_virtual_branch(*project_id, &branch_id)
|
||||
.apply_virtual_branch(*project_id, branch_id)
|
||||
.await
|
||||
.unwrap();
|
||||
let (branches, _) = controller.list_virtual_branches(*project_id).await.unwrap();
|
||||
@ -561,7 +561,7 @@ mod unapplied_branch {
|
||||
|
||||
fs::write(repository.path().join("file.txt"), "second").unwrap();
|
||||
controller
|
||||
.create_commit(*project_id, &branch_id, "second", None, false)
|
||||
.create_commit(*project_id, branch_id, "second", None, false)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -569,7 +569,7 @@ mod unapplied_branch {
|
||||
fs::write(repository.path().join("file2.txt"), "other").unwrap();
|
||||
|
||||
controller
|
||||
.push_virtual_branch(*project_id, &branch_id, false, None)
|
||||
.push_virtual_branch(*project_id, branch_id, false, None)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -589,7 +589,7 @@ mod unapplied_branch {
|
||||
}
|
||||
|
||||
controller
|
||||
.unapply_virtual_branch(*project_id, &branch_id)
|
||||
.unapply_virtual_branch(*project_id, branch_id)
|
||||
.await
|
||||
.unwrap();
|
||||
branch_id
|
||||
@ -610,7 +610,7 @@ mod unapplied_branch {
|
||||
assert_eq!(branches[0].commits.len(), 0);
|
||||
assert!(branches[0].upstream.is_none());
|
||||
assert!(controller
|
||||
.can_apply_virtual_branch(*project_id, &branch_id)
|
||||
.can_apply_virtual_branch(*project_id, branch_id)
|
||||
.await
|
||||
.unwrap());
|
||||
}
|
||||
@ -618,7 +618,7 @@ mod unapplied_branch {
|
||||
{
|
||||
// applying the branch should produce conflict markers
|
||||
controller
|
||||
.apply_virtual_branch(*project_id, &branch_id)
|
||||
.apply_virtual_branch(*project_id, branch_id)
|
||||
.await
|
||||
.unwrap();
|
||||
let (branches, _) = controller.list_virtual_branches(*project_id).await.unwrap();
|
||||
@ -674,12 +674,12 @@ mod unapplied_branch {
|
||||
fs::write(repository.path().join("file.txt"), "second").unwrap();
|
||||
|
||||
controller
|
||||
.create_commit(*project_id, &branch_id, "second", None, false)
|
||||
.create_commit(*project_id, branch_id, "second", None, false)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
controller
|
||||
.unapply_virtual_branch(*project_id, &branch_id)
|
||||
.unapply_virtual_branch(*project_id, branch_id)
|
||||
.await
|
||||
.unwrap();
|
||||
};
|
||||
@ -728,17 +728,17 @@ mod unapplied_branch {
|
||||
// open pr
|
||||
fs::write(repository.path().join("file2.txt"), "new file").unwrap();
|
||||
controller
|
||||
.create_commit(*project_id, &branch_id, "second", None, false)
|
||||
.create_commit(*project_id, branch_id, "second", None, false)
|
||||
.await
|
||||
.unwrap();
|
||||
controller
|
||||
.push_virtual_branch(*project_id, &branch_id, false, None)
|
||||
.push_virtual_branch(*project_id, branch_id, false, None)
|
||||
.await
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
controller
|
||||
.unapply_virtual_branch(*project_id, &branch_id)
|
||||
.unapply_virtual_branch(*project_id, branch_id)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -819,7 +819,7 @@ mod applied_branch {
|
||||
assert_eq!(branches[0].files.len(), 1);
|
||||
assert_eq!(branches[0].commits.len(), 0);
|
||||
assert!(!controller
|
||||
.can_apply_virtual_branch(*project_id, &branch_id)
|
||||
.can_apply_virtual_branch(*project_id, branch_id)
|
||||
.await
|
||||
.unwrap());
|
||||
}
|
||||
@ -827,7 +827,7 @@ mod applied_branch {
|
||||
{
|
||||
// applying the branch should produce conflict markers
|
||||
controller
|
||||
.apply_virtual_branch(*project_id, &branch_id)
|
||||
.apply_virtual_branch(*project_id, branch_id)
|
||||
.await
|
||||
.unwrap();
|
||||
let (branches, _) = controller.list_virtual_branches(*project_id).await.unwrap();
|
||||
@ -879,7 +879,7 @@ mod applied_branch {
|
||||
|
||||
fs::write(repository.path().join("file.txt"), "conflict").unwrap();
|
||||
controller
|
||||
.create_commit(*project_id, &branch_id, "conflicting commit", None, false)
|
||||
.create_commit(*project_id, branch_id, "conflicting commit", None, false)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -900,7 +900,7 @@ mod applied_branch {
|
||||
assert_eq!(branches[0].files.len(), 0);
|
||||
assert_eq!(branches[0].commits.len(), 1);
|
||||
assert!(!controller
|
||||
.can_apply_virtual_branch(*project_id, &branch_id)
|
||||
.can_apply_virtual_branch(*project_id, branch_id)
|
||||
.await
|
||||
.unwrap());
|
||||
}
|
||||
@ -908,7 +908,7 @@ mod applied_branch {
|
||||
{
|
||||
// applying the branch should produce conflict markers
|
||||
controller
|
||||
.apply_virtual_branch(*project_id, &branch_id)
|
||||
.apply_virtual_branch(*project_id, branch_id)
|
||||
.await
|
||||
.unwrap();
|
||||
let (branches, _) = controller.list_virtual_branches(*project_id).await.unwrap();
|
||||
@ -960,12 +960,12 @@ mod applied_branch {
|
||||
|
||||
fs::write(repository.path().join("file.txt"), "conflict").unwrap();
|
||||
controller
|
||||
.create_commit(*project_id, &branch_id, "conflicting commit", None, false)
|
||||
.create_commit(*project_id, branch_id, "conflicting commit", None, false)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
controller
|
||||
.push_virtual_branch(*project_id, &branch_id, false, None)
|
||||
.push_virtual_branch(*project_id, branch_id, false, None)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -986,7 +986,7 @@ mod applied_branch {
|
||||
assert_eq!(branches[0].files.len(), 0);
|
||||
assert_eq!(branches[0].commits.len(), 1);
|
||||
assert!(!controller
|
||||
.can_apply_virtual_branch(*project_id, &branch_id)
|
||||
.can_apply_virtual_branch(*project_id, branch_id)
|
||||
.await
|
||||
.unwrap());
|
||||
}
|
||||
@ -994,7 +994,7 @@ mod applied_branch {
|
||||
{
|
||||
// applying the branch should produce conflict markers
|
||||
controller
|
||||
.apply_virtual_branch(*project_id, &branch_id)
|
||||
.apply_virtual_branch(*project_id, branch_id)
|
||||
.await
|
||||
.unwrap();
|
||||
let (branches, _) = controller.list_virtual_branches(*project_id).await.unwrap();
|
||||
@ -1046,7 +1046,7 @@ mod applied_branch {
|
||||
|
||||
fs::write(repository.path().join("file.txt"), "conflict").unwrap();
|
||||
controller
|
||||
.create_commit(*project_id, &branch_id, "conflicting commit", None, false)
|
||||
.create_commit(*project_id, branch_id, "conflicting commit", None, false)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -1069,7 +1069,7 @@ mod applied_branch {
|
||||
assert_eq!(branches[0].files.len(), 1);
|
||||
assert_eq!(branches[0].commits.len(), 1);
|
||||
assert!(!controller
|
||||
.can_apply_virtual_branch(*project_id, &branch_id)
|
||||
.can_apply_virtual_branch(*project_id, branch_id)
|
||||
.await
|
||||
.unwrap()); // TODO: should be true
|
||||
}
|
||||
@ -1077,7 +1077,7 @@ mod applied_branch {
|
||||
{
|
||||
// applying the branch should produce conflict markers
|
||||
controller
|
||||
.apply_virtual_branch(*project_id, &branch_id)
|
||||
.apply_virtual_branch(*project_id, branch_id)
|
||||
.await
|
||||
.unwrap();
|
||||
let (branches, _) = controller.list_virtual_branches(*project_id).await.unwrap();
|
||||
@ -1129,7 +1129,7 @@ mod applied_branch {
|
||||
|
||||
fs::write(repository.path().join("file.txt"), "conflict").unwrap();
|
||||
controller
|
||||
.create_commit(*project_id, &branch_id, "conflicting commit", None, false)
|
||||
.create_commit(*project_id, branch_id, "conflicting commit", None, false)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -1152,7 +1152,7 @@ mod applied_branch {
|
||||
assert_eq!(branches[0].commits.len(), 1); // TODO: should be 2
|
||||
assert_eq!(branches[0].files.len(), 1);
|
||||
assert!(!controller
|
||||
.can_apply_virtual_branch(*project_id, &branch_id)
|
||||
.can_apply_virtual_branch(*project_id, branch_id)
|
||||
.await
|
||||
.unwrap()); // TODO: should be true
|
||||
}
|
||||
@ -1160,7 +1160,7 @@ mod applied_branch {
|
||||
{
|
||||
// applying the branch should produce conflict markers
|
||||
controller
|
||||
.apply_virtual_branch(*project_id, &branch_id)
|
||||
.apply_virtual_branch(*project_id, branch_id)
|
||||
.await
|
||||
.unwrap();
|
||||
let (branches, _) = controller.list_virtual_branches(*project_id).await.unwrap();
|
||||
@ -1224,11 +1224,11 @@ mod applied_branch {
|
||||
fs::write(repository.path().join("file2.txt"), "no conflict").unwrap();
|
||||
|
||||
controller
|
||||
.create_commit(*project_id, &branch_id, "no conflicts", None, false)
|
||||
.create_commit(*project_id, branch_id, "no conflicts", None, false)
|
||||
.await
|
||||
.unwrap();
|
||||
controller
|
||||
.push_virtual_branch(*project_id, &branch_id, false, None)
|
||||
.push_virtual_branch(*project_id, branch_id, false, None)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -1255,7 +1255,7 @@ mod applied_branch {
|
||||
assert!(!branches[0].commits[0].is_remote);
|
||||
assert!(!branches[0].commits[0].is_integrated);
|
||||
assert!(controller
|
||||
.can_apply_virtual_branch(*project_id, &branch_id)
|
||||
.can_apply_virtual_branch(*project_id, branch_id)
|
||||
.await
|
||||
.unwrap());
|
||||
}
|
||||
@ -1295,11 +1295,11 @@ mod applied_branch {
|
||||
fs::write(repository.path().join("file2.txt"), "no conflict").unwrap();
|
||||
|
||||
controller
|
||||
.create_commit(*project_id, &branch_id, "no conflicts", None, false)
|
||||
.create_commit(*project_id, branch_id, "no conflicts", None, false)
|
||||
.await
|
||||
.unwrap();
|
||||
controller
|
||||
.push_virtual_branch(*project_id, &branch_id, false, None)
|
||||
.push_virtual_branch(*project_id, branch_id, false, None)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -1336,7 +1336,7 @@ mod applied_branch {
|
||||
assert!(branches[0].commits[1].is_remote);
|
||||
assert!(!branches[0].commits[1].is_integrated);
|
||||
assert!(controller
|
||||
.can_apply_virtual_branch(*project_id, &branch_id)
|
||||
.can_apply_virtual_branch(*project_id, branch_id)
|
||||
.await
|
||||
.unwrap());
|
||||
}
|
||||
@ -1376,7 +1376,7 @@ mod applied_branch {
|
||||
fs::write(repository.path().join("file2.txt"), "no conflict").unwrap();
|
||||
|
||||
controller
|
||||
.create_commit(*project_id, &branch_id, "no conflicts", None, false)
|
||||
.create_commit(*project_id, branch_id, "no conflicts", None, false)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -1399,14 +1399,14 @@ mod applied_branch {
|
||||
assert_eq!(branches[0].files.len(), 1);
|
||||
assert_eq!(branches[0].commits.len(), 1);
|
||||
assert!(controller
|
||||
.can_apply_virtual_branch(*project_id, &branch_id)
|
||||
.can_apply_virtual_branch(*project_id, branch_id)
|
||||
.await
|
||||
.unwrap());
|
||||
}
|
||||
|
||||
{
|
||||
controller
|
||||
.apply_virtual_branch(*project_id, &branch_id)
|
||||
.apply_virtual_branch(*project_id, branch_id)
|
||||
.await
|
||||
.unwrap();
|
||||
let (branches, _) = controller.list_virtual_branches(*project_id).await.unwrap();
|
||||
@ -1458,11 +1458,11 @@ mod applied_branch {
|
||||
fs::write(repository.path().join("file.txt"), "second").unwrap();
|
||||
|
||||
controller
|
||||
.create_commit(*project_id, &branch_id, "second", None, false)
|
||||
.create_commit(*project_id, branch_id, "second", None, false)
|
||||
.await
|
||||
.unwrap();
|
||||
controller
|
||||
.push_virtual_branch(*project_id, &branch_id, false, None)
|
||||
.push_virtual_branch(*project_id, branch_id, false, None)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -1500,7 +1500,7 @@ mod applied_branch {
|
||||
assert_eq!(branches[0].files.len(), 1);
|
||||
assert_eq!(branches[0].commits.len(), 0);
|
||||
assert!(controller
|
||||
.can_apply_virtual_branch(*project_id, &branch_id)
|
||||
.can_apply_virtual_branch(*project_id, branch_id)
|
||||
.await
|
||||
.unwrap());
|
||||
}
|
||||
@ -1508,7 +1508,7 @@ mod applied_branch {
|
||||
{
|
||||
// applying the branch should produce conflict markers
|
||||
controller
|
||||
.apply_virtual_branch(*project_id, &branch_id)
|
||||
.apply_virtual_branch(*project_id, branch_id)
|
||||
.await
|
||||
.unwrap();
|
||||
let (branches, _) = controller.list_virtual_branches(*project_id).await.unwrap();
|
||||
@ -1576,7 +1576,7 @@ mod applied_branch {
|
||||
.unwrap();
|
||||
|
||||
controller
|
||||
.create_commit(*project_id, &branch_id, "fourth", None, false)
|
||||
.create_commit(*project_id, branch_id, "fourth", None, false)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -1585,7 +1585,7 @@ mod applied_branch {
|
||||
|
||||
// push the branch
|
||||
controller
|
||||
.push_virtual_branch(*project_id, &branch_id, false, None)
|
||||
.push_virtual_branch(*project_id, branch_id, false, None)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -1624,7 +1624,7 @@ mod applied_branch {
|
||||
|
||||
{
|
||||
controller
|
||||
.apply_virtual_branch(*project_id, &branch_id)
|
||||
.apply_virtual_branch(*project_id, branch_id)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -1676,7 +1676,7 @@ mod applied_branch {
|
||||
fs::write(repository.path().join("file.txt"), "first").unwrap();
|
||||
|
||||
controller
|
||||
.create_commit(*project_id, &branch_id, "first", None, false)
|
||||
.create_commit(*project_id, branch_id, "first", None, false)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -1684,7 +1684,7 @@ mod applied_branch {
|
||||
};
|
||||
|
||||
controller
|
||||
.push_virtual_branch(*project_id, &branch_id, false, None)
|
||||
.push_virtual_branch(*project_id, branch_id, false, None)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -1720,7 +1720,7 @@ mod applied_branch {
|
||||
|
||||
{
|
||||
controller
|
||||
.apply_virtual_branch(*project_id, &branch_id)
|
||||
.apply_virtual_branch(*project_id, branch_id)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -1758,7 +1758,7 @@ mod applied_branch {
|
||||
fs::write(repository.path().join("file.txt"), "first").unwrap();
|
||||
|
||||
controller
|
||||
.create_commit(*project_id, &branch_id, "first", None, false)
|
||||
.create_commit(*project_id, branch_id, "first", None, false)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -1766,7 +1766,7 @@ mod applied_branch {
|
||||
};
|
||||
|
||||
controller
|
||||
.push_virtual_branch(*project_id, &branch_id, false, None)
|
||||
.push_virtual_branch(*project_id, branch_id, false, None)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -1802,7 +1802,7 @@ mod applied_branch {
|
||||
|
||||
{
|
||||
controller
|
||||
.apply_virtual_branch(*project_id, &branch_id)
|
||||
.apply_virtual_branch(*project_id, branch_id)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -1850,7 +1850,7 @@ mod applied_branch {
|
||||
fs::write(repository.path().join("file.txt"), "second").unwrap();
|
||||
|
||||
controller
|
||||
.create_commit(*project_id, &branch_id, "second", None, false)
|
||||
.create_commit(*project_id, branch_id, "second", None, false)
|
||||
.await
|
||||
.unwrap();
|
||||
};
|
||||
@ -1899,11 +1899,11 @@ mod applied_branch {
|
||||
// open pr
|
||||
fs::write(repository.path().join("file2.txt"), "new file").unwrap();
|
||||
controller
|
||||
.create_commit(*project_id, &branch_id, "second", None, false)
|
||||
.create_commit(*project_id, branch_id, "second", None, false)
|
||||
.await
|
||||
.unwrap();
|
||||
controller
|
||||
.push_virtual_branch(*project_id, &branch_id, false, None)
|
||||
.push_virtual_branch(*project_id, branch_id, false, None)
|
||||
.await
|
||||
.unwrap();
|
||||
}
|
||||
@ -1960,7 +1960,7 @@ mod applied_branch {
|
||||
|
||||
fs::write(repository.path().join("file-3.txt"), "three").unwrap();
|
||||
controller
|
||||
.create_commit(*project_id, &branch_1_id, "third", None, false)
|
||||
.create_commit(*project_id, branch_1_id, "third", None, false)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -1978,12 +1978,12 @@ mod applied_branch {
|
||||
fs::write(repository.path().join("file-4.txt"), "four").unwrap();
|
||||
|
||||
controller
|
||||
.create_commit(*project_id, &branch_2_id, "fourth", None, false)
|
||||
.create_commit(*project_id, branch_2_id, "fourth", None, false)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
controller
|
||||
.push_virtual_branch(*project_id, &branch_2_id, false, None)
|
||||
.push_virtual_branch(*project_id, branch_2_id, false, None)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
|
@ -22,7 +22,7 @@ async fn head() {
|
||||
{
|
||||
fs::write(repository.path().join("file one.txt"), "").unwrap();
|
||||
controller
|
||||
.create_commit(*project_id, &branch_id, "commit one", None, false)
|
||||
.create_commit(*project_id, branch_id, "commit one", None, false)
|
||||
.await
|
||||
.unwrap()
|
||||
};
|
||||
@ -30,7 +30,7 @@ async fn head() {
|
||||
{
|
||||
fs::write(repository.path().join("file two.txt"), "").unwrap();
|
||||
controller
|
||||
.create_commit(*project_id, &branch_id, "commit two", None, false)
|
||||
.create_commit(*project_id, branch_id, "commit two", None, false)
|
||||
.await
|
||||
.unwrap()
|
||||
};
|
||||
@ -38,7 +38,7 @@ async fn head() {
|
||||
let commit_three_oid = {
|
||||
fs::write(repository.path().join("file three.txt"), "").unwrap();
|
||||
controller
|
||||
.create_commit(*project_id, &branch_id, "commit three", None, false)
|
||||
.create_commit(*project_id, branch_id, "commit three", None, false)
|
||||
.await
|
||||
.unwrap()
|
||||
};
|
||||
@ -48,7 +48,7 @@ async fn head() {
|
||||
controller
|
||||
.update_commit_message(
|
||||
*project_id,
|
||||
&branch_id,
|
||||
branch_id,
|
||||
commit_three_oid,
|
||||
"commit three updated",
|
||||
)
|
||||
@ -105,7 +105,7 @@ async fn middle() {
|
||||
{
|
||||
fs::write(repository.path().join("file one.txt"), "").unwrap();
|
||||
controller
|
||||
.create_commit(*project_id, &branch_id, "commit one", None, false)
|
||||
.create_commit(*project_id, branch_id, "commit one", None, false)
|
||||
.await
|
||||
.unwrap()
|
||||
};
|
||||
@ -113,7 +113,7 @@ async fn middle() {
|
||||
let commit_two_oid = {
|
||||
fs::write(repository.path().join("file two.txt"), "").unwrap();
|
||||
controller
|
||||
.create_commit(*project_id, &branch_id, "commit two", None, false)
|
||||
.create_commit(*project_id, branch_id, "commit two", None, false)
|
||||
.await
|
||||
.unwrap()
|
||||
};
|
||||
@ -121,18 +121,13 @@ async fn middle() {
|
||||
{
|
||||
fs::write(repository.path().join("file three.txt"), "").unwrap();
|
||||
controller
|
||||
.create_commit(*project_id, &branch_id, "commit three", None, false)
|
||||
.create_commit(*project_id, branch_id, "commit three", None, false)
|
||||
.await
|
||||
.unwrap()
|
||||
};
|
||||
|
||||
controller
|
||||
.update_commit_message(
|
||||
*project_id,
|
||||
&branch_id,
|
||||
commit_two_oid,
|
||||
"commit two updated",
|
||||
)
|
||||
.update_commit_message(*project_id, branch_id, commit_two_oid, "commit two updated")
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -188,23 +183,18 @@ async fn forcepush_allowed() {
|
||||
let commit_one_oid = {
|
||||
fs::write(repository.path().join("file one.txt"), "").unwrap();
|
||||
controller
|
||||
.create_commit(*project_id, &branch_id, "commit one", None, false)
|
||||
.create_commit(*project_id, branch_id, "commit one", None, false)
|
||||
.await
|
||||
.unwrap()
|
||||
};
|
||||
|
||||
controller
|
||||
.push_virtual_branch(*project_id, &branch_id, false, None)
|
||||
.push_virtual_branch(*project_id, branch_id, false, None)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
controller
|
||||
.update_commit_message(
|
||||
*project_id,
|
||||
&branch_id,
|
||||
commit_one_oid,
|
||||
"commit one updated",
|
||||
)
|
||||
.update_commit_message(*project_id, branch_id, commit_one_oid, "commit one updated")
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -258,24 +248,19 @@ async fn forcepush_forbidden() {
|
||||
let commit_one_oid = {
|
||||
fs::write(repository.path().join("file one.txt"), "").unwrap();
|
||||
controller
|
||||
.create_commit(*project_id, &branch_id, "commit one", None, false)
|
||||
.create_commit(*project_id, branch_id, "commit one", None, false)
|
||||
.await
|
||||
.unwrap()
|
||||
};
|
||||
|
||||
controller
|
||||
.push_virtual_branch(*project_id, &branch_id, false, None)
|
||||
.push_virtual_branch(*project_id, branch_id, false, None)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
assert!(matches!(
|
||||
controller
|
||||
.update_commit_message(
|
||||
*project_id,
|
||||
&branch_id,
|
||||
commit_one_oid,
|
||||
"commit one updated",
|
||||
)
|
||||
.update_commit_message(*project_id, branch_id, commit_one_oid, "commit one updated",)
|
||||
.await
|
||||
.unwrap_err()
|
||||
.downcast_ref(),
|
||||
@ -305,7 +290,7 @@ async fn root() {
|
||||
let commit_one_oid = {
|
||||
fs::write(repository.path().join("file one.txt"), "").unwrap();
|
||||
controller
|
||||
.create_commit(*project_id, &branch_id, "commit one", None, false)
|
||||
.create_commit(*project_id, branch_id, "commit one", None, false)
|
||||
.await
|
||||
.unwrap()
|
||||
};
|
||||
@ -313,7 +298,7 @@ async fn root() {
|
||||
{
|
||||
fs::write(repository.path().join("file two.txt"), "").unwrap();
|
||||
controller
|
||||
.create_commit(*project_id, &branch_id, "commit two", None, false)
|
||||
.create_commit(*project_id, branch_id, "commit two", None, false)
|
||||
.await
|
||||
.unwrap()
|
||||
};
|
||||
@ -321,18 +306,13 @@ async fn root() {
|
||||
{
|
||||
fs::write(repository.path().join("file three.txt"), "").unwrap();
|
||||
controller
|
||||
.create_commit(*project_id, &branch_id, "commit three", None, false)
|
||||
.create_commit(*project_id, branch_id, "commit three", None, false)
|
||||
.await
|
||||
.unwrap()
|
||||
};
|
||||
|
||||
controller
|
||||
.update_commit_message(
|
||||
*project_id,
|
||||
&branch_id,
|
||||
commit_one_oid,
|
||||
"commit one updated",
|
||||
)
|
||||
.update_commit_message(*project_id, branch_id, commit_one_oid, "commit one updated")
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -378,14 +358,14 @@ async fn empty() {
|
||||
let commit_one_oid = {
|
||||
fs::write(repository.path().join("file one.txt"), "").unwrap();
|
||||
controller
|
||||
.create_commit(*project_id, &branch_id, "commit one", None, false)
|
||||
.create_commit(*project_id, branch_id, "commit one", None, false)
|
||||
.await
|
||||
.unwrap()
|
||||
};
|
||||
|
||||
assert!(matches!(
|
||||
controller
|
||||
.update_commit_message(*project_id, &branch_id, commit_one_oid, "",)
|
||||
.update_commit_message(*project_id, branch_id, commit_one_oid, "",)
|
||||
.await
|
||||
.unwrap_err()
|
||||
.downcast_ref(),
|
||||
|
@ -23,7 +23,7 @@ async fn detect_upstream_commits() {
|
||||
// create first commit
|
||||
fs::write(repository.path().join("file.txt"), "content").unwrap();
|
||||
controller
|
||||
.create_commit(*project_id, &branch1_id, "commit", None, false)
|
||||
.create_commit(*project_id, branch1_id, "commit", None, false)
|
||||
.await
|
||||
.unwrap()
|
||||
};
|
||||
@ -32,14 +32,14 @@ async fn detect_upstream_commits() {
|
||||
// create second commit
|
||||
fs::write(repository.path().join("file.txt"), "content2").unwrap();
|
||||
controller
|
||||
.create_commit(*project_id, &branch1_id, "commit", None, false)
|
||||
.create_commit(*project_id, branch1_id, "commit", None, false)
|
||||
.await
|
||||
.unwrap()
|
||||
};
|
||||
|
||||
// push
|
||||
controller
|
||||
.push_virtual_branch(*project_id, &branch1_id, false, None)
|
||||
.push_virtual_branch(*project_id, branch1_id, false, None)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -47,7 +47,7 @@ async fn detect_upstream_commits() {
|
||||
// create third commit
|
||||
fs::write(repository.path().join("file.txt"), "content3").unwrap();
|
||||
controller
|
||||
.create_commit(*project_id, &branch1_id, "commit", None, false)
|
||||
.create_commit(*project_id, branch1_id, "commit", None, false)
|
||||
.await
|
||||
.unwrap()
|
||||
};
|
||||
@ -90,7 +90,7 @@ async fn detect_integrated_commits() {
|
||||
// create first commit
|
||||
fs::write(repository.path().join("file.txt"), "content").unwrap();
|
||||
controller
|
||||
.create_commit(*project_id, &branch1_id, "commit", None, false)
|
||||
.create_commit(*project_id, branch1_id, "commit", None, false)
|
||||
.await
|
||||
.unwrap()
|
||||
};
|
||||
@ -99,14 +99,14 @@ async fn detect_integrated_commits() {
|
||||
// create second commit
|
||||
fs::write(repository.path().join("file.txt"), "content2").unwrap();
|
||||
controller
|
||||
.create_commit(*project_id, &branch1_id, "commit", None, false)
|
||||
.create_commit(*project_id, branch1_id, "commit", None, false)
|
||||
.await
|
||||
.unwrap()
|
||||
};
|
||||
|
||||
// push
|
||||
controller
|
||||
.push_virtual_branch(*project_id, &branch1_id, false, None)
|
||||
.push_virtual_branch(*project_id, branch1_id, false, None)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -128,7 +128,7 @@ async fn detect_integrated_commits() {
|
||||
// create third commit
|
||||
fs::write(repository.path().join("file.txt"), "content3").unwrap();
|
||||
controller
|
||||
.create_commit(*project_id, &branch1_id, "commit", None, false)
|
||||
.create_commit(*project_id, branch1_id, "commit", None, false)
|
||||
.await
|
||||
.unwrap()
|
||||
};
|
||||
|
@ -61,7 +61,7 @@ fn commit_on_branch_then_change_file_then_get_status() -> Result<()> {
|
||||
// commit
|
||||
commit(
|
||||
project_repository,
|
||||
&branch1_id,
|
||||
branch1_id,
|
||||
"test commit",
|
||||
None,
|
||||
None,
|
||||
@ -159,7 +159,7 @@ fn track_binary_files() -> Result<()> {
|
||||
// commit
|
||||
commit(
|
||||
project_repository,
|
||||
&branch1_id,
|
||||
branch1_id,
|
||||
"test commit",
|
||||
None,
|
||||
None,
|
||||
@ -190,7 +190,7 @@ fn track_binary_files() -> Result<()> {
|
||||
// commit
|
||||
commit(
|
||||
project_repository,
|
||||
&branch1_id,
|
||||
branch1_id,
|
||||
"test commit",
|
||||
None,
|
||||
None,
|
||||
@ -230,7 +230,7 @@ fn create_branch_with_ownership() -> Result<()> {
|
||||
virtual_branches::get_status_by_branch(project_repository, None).expect("failed to get status");
|
||||
|
||||
let vb_state = project_repository.project().virtual_branches();
|
||||
let branch0 = vb_state.get_branch(&branch0.id).unwrap();
|
||||
let branch0 = vb_state.get_branch(branch0.id).unwrap();
|
||||
|
||||
let branch1 = create_virtual_branch(
|
||||
project_repository,
|
||||
@ -470,12 +470,12 @@ fn move_hunks_multiple_sources() -> Result<()> {
|
||||
)?;
|
||||
|
||||
let vb_state = project.virtual_branches();
|
||||
let mut branch2 = vb_state.get_branch(&branch2_id)?;
|
||||
let mut branch2 = vb_state.get_branch(branch2_id)?;
|
||||
branch2.ownership = BranchOwnershipClaims {
|
||||
claims: vec!["test.txt:1-5".parse()?],
|
||||
};
|
||||
vb_state.set_branch(branch2.clone())?;
|
||||
let mut branch1 = vb_state.get_branch(&branch1_id)?;
|
||||
let mut branch1 = vb_state.get_branch(branch1_id)?;
|
||||
branch1.ownership = BranchOwnershipClaims {
|
||||
claims: vec!["test.txt:11-15".parse()?],
|
||||
};
|
||||
@ -846,7 +846,7 @@ fn merge_vbranch_upstream_clean_rebase() -> Result<()> {
|
||||
assert_eq!(branch1.commits.len(), 1);
|
||||
// assert_eq!(branch1.upstream.as_ref().unwrap().commits.len(), 1);
|
||||
|
||||
integrate_upstream_commits(project_repository, &branch1.id, None)?;
|
||||
integrate_upstream_commits(project_repository, branch1.id, None)?;
|
||||
|
||||
let (branches, _) = virtual_branches::list_virtual_branches(project_repository)?;
|
||||
let branch1 = &branches[0];
|
||||
@ -972,7 +972,7 @@ async fn merge_vbranch_upstream_conflict() -> Result<()> {
|
||||
assert_eq!(branch1.commits.len(), 1);
|
||||
// assert_eq!(branch1.upstream.as_ref().unwrap().commits.len(), 1);
|
||||
|
||||
integrate_upstream_commits(project_repository, &branch1.id, None)?;
|
||||
integrate_upstream_commits(project_repository, branch1.id, None)?;
|
||||
|
||||
let (branches, _) = virtual_branches::list_virtual_branches(project_repository)?;
|
||||
let branch1 = &branches[0];
|
||||
@ -1000,7 +1000,7 @@ async fn merge_vbranch_upstream_conflict() -> Result<()> {
|
||||
// commit the merge resolution
|
||||
commit(
|
||||
project_repository,
|
||||
&branch1.id,
|
||||
branch1.id,
|
||||
"fix merge conflict",
|
||||
None,
|
||||
None,
|
||||
@ -1123,7 +1123,7 @@ fn unapply_branch() -> Result<()> {
|
||||
assert_eq!(branch.files.len(), 1);
|
||||
assert!(branch.active);
|
||||
|
||||
virtual_branches::unapply_branch(project_repository, &branch1_id)?;
|
||||
virtual_branches::unapply_branch(project_repository, branch1_id)?;
|
||||
|
||||
let contents = std::fs::read(Path::new(&project.path).join(file_path))?;
|
||||
assert_eq!("line1\nline2\nline3\nline4\n", String::from_utf8(contents)?);
|
||||
@ -1135,7 +1135,7 @@ fn unapply_branch() -> Result<()> {
|
||||
assert_eq!(branch.files.len(), 1);
|
||||
assert!(!branch.active);
|
||||
|
||||
apply_branch(project_repository, &branch1_id, None)?;
|
||||
apply_branch(project_repository, branch1_id, None)?;
|
||||
let contents = std::fs::read(Path::new(&project.path).join(file_path))?;
|
||||
assert_eq!(
|
||||
"line1\nline2\nline3\nline4\nbranch1\n",
|
||||
@ -1199,20 +1199,20 @@ fn apply_unapply_added_deleted_files() -> Result<()> {
|
||||
},
|
||||
)?;
|
||||
|
||||
virtual_branches::unapply_branch(project_repository, &branch2_id)?;
|
||||
virtual_branches::unapply_branch(project_repository, branch2_id)?;
|
||||
// check that file2 is back
|
||||
let contents = std::fs::read(Path::new(&project.path).join(file_path2))?;
|
||||
assert_eq!("file2\n", String::from_utf8(contents)?);
|
||||
|
||||
virtual_branches::unapply_branch(project_repository, &branch3_id)?;
|
||||
virtual_branches::unapply_branch(project_repository, branch3_id)?;
|
||||
// check that file3 is gone
|
||||
assert!(!Path::new(&project.path).join(file_path3).exists());
|
||||
|
||||
apply_branch(project_repository, &branch2_id, None)?;
|
||||
apply_branch(project_repository, branch2_id, None)?;
|
||||
// check that file2 is gone
|
||||
assert!(!Path::new(&project.path).join(file_path2).exists());
|
||||
|
||||
apply_branch(project_repository, &branch3_id, None)?;
|
||||
apply_branch(project_repository, branch3_id, None)?;
|
||||
// check that file3 is back
|
||||
let contents = std::fs::read(Path::new(&project.path).join(file_path3))?;
|
||||
assert_eq!("file3\n", String::from_utf8(contents)?);
|
||||
@ -1264,8 +1264,8 @@ fn detect_mergeable_branch() -> Result<()> {
|
||||
.expect("failed to update branch");
|
||||
|
||||
// unapply both branches and create some conflicting ones
|
||||
virtual_branches::unapply_branch(project_repository, &branch1_id)?;
|
||||
virtual_branches::unapply_branch(project_repository, &branch2_id)?;
|
||||
virtual_branches::unapply_branch(project_repository, branch1_id)?;
|
||||
virtual_branches::unapply_branch(project_repository, branch2_id)?;
|
||||
|
||||
project_repository
|
||||
.git_repository
|
||||
@ -1345,7 +1345,7 @@ fn detect_mergeable_branch() -> Result<()> {
|
||||
|
||||
let vb_state = project.virtual_branches();
|
||||
|
||||
let mut branch4 = vb_state.get_branch(&branch4_id)?;
|
||||
let mut branch4 = vb_state.get_branch(branch4_id)?;
|
||||
branch4.ownership = BranchOwnershipClaims {
|
||||
claims: vec!["test2.txt:1-6".parse()?],
|
||||
};
|
||||
@ -1356,11 +1356,11 @@ fn detect_mergeable_branch() -> Result<()> {
|
||||
|
||||
let branch1 = &branches.iter().find(|b| b.id == branch1_id).unwrap();
|
||||
assert!(!branch1.active);
|
||||
assert!(!is_virtual_branch_mergeable(project_repository, &branch1.id).unwrap());
|
||||
assert!(!is_virtual_branch_mergeable(project_repository, branch1.id).unwrap());
|
||||
|
||||
let branch2 = &branches.iter().find(|b| b.id == branch2_id).unwrap();
|
||||
assert!(!branch2.active);
|
||||
assert!(is_virtual_branch_mergeable(project_repository, &branch2.id).unwrap());
|
||||
assert!(is_virtual_branch_mergeable(project_repository, branch2.id).unwrap());
|
||||
|
||||
let remotes = list_remote_branches(project_repository).expect("failed to list remotes");
|
||||
let _remote1 = &remotes
|
||||
@ -1497,7 +1497,7 @@ fn upstream_integrated_vbranch() -> Result<()> {
|
||||
// create a new virtual branch from the remote branch
|
||||
commit(
|
||||
project_repository,
|
||||
&branch1_id,
|
||||
branch1_id,
|
||||
"integrated commit",
|
||||
None,
|
||||
None,
|
||||
@ -1505,7 +1505,7 @@ fn upstream_integrated_vbranch() -> Result<()> {
|
||||
)?;
|
||||
commit(
|
||||
project_repository,
|
||||
&branch2_id,
|
||||
branch2_id,
|
||||
"non-integrated commit",
|
||||
None,
|
||||
None,
|
||||
@ -1565,7 +1565,7 @@ fn commit_same_hunk_twice() -> Result<()> {
|
||||
// commit
|
||||
commit(
|
||||
project_repository,
|
||||
&branch1_id,
|
||||
branch1_id,
|
||||
"first commit to test.txt",
|
||||
None,
|
||||
None,
|
||||
@ -1600,7 +1600,7 @@ fn commit_same_hunk_twice() -> Result<()> {
|
||||
|
||||
commit(
|
||||
project_repository,
|
||||
&branch1_id,
|
||||
branch1_id,
|
||||
"second commit to test.txt",
|
||||
None,
|
||||
None,
|
||||
@ -1658,7 +1658,7 @@ fn commit_same_file_twice() -> Result<()> {
|
||||
// commit
|
||||
commit(
|
||||
project_repository,
|
||||
&branch1_id,
|
||||
branch1_id,
|
||||
"first commit to test.txt",
|
||||
None,
|
||||
None,
|
||||
@ -1693,7 +1693,7 @@ fn commit_same_file_twice() -> Result<()> {
|
||||
|
||||
commit(
|
||||
project_repository,
|
||||
&branch1_id,
|
||||
branch1_id,
|
||||
"second commit to test.txt",
|
||||
None,
|
||||
None,
|
||||
@ -1751,7 +1751,7 @@ fn commit_partial_by_hunk() -> Result<()> {
|
||||
// commit
|
||||
commit(
|
||||
project_repository,
|
||||
&branch1_id,
|
||||
branch1_id,
|
||||
"first commit to test.txt",
|
||||
Some(&"test.txt:1-6".parse::<BranchOwnershipClaims>().unwrap()),
|
||||
None,
|
||||
@ -1769,7 +1769,7 @@ fn commit_partial_by_hunk() -> Result<()> {
|
||||
|
||||
commit(
|
||||
project_repository,
|
||||
&branch1_id,
|
||||
branch1_id,
|
||||
"second commit to test.txt",
|
||||
Some(&"test.txt:16-22".parse::<BranchOwnershipClaims>().unwrap()),
|
||||
None,
|
||||
@ -1827,7 +1827,7 @@ fn commit_partial_by_file() -> Result<()> {
|
||||
// commit
|
||||
commit(
|
||||
project_repository,
|
||||
&branch1_id,
|
||||
branch1_id,
|
||||
"branch1 commit",
|
||||
None,
|
||||
None,
|
||||
@ -1894,7 +1894,7 @@ fn commit_add_and_delete_files() -> Result<()> {
|
||||
// commit
|
||||
commit(
|
||||
project_repository,
|
||||
&branch1_id,
|
||||
branch1_id,
|
||||
"branch1 commit",
|
||||
None,
|
||||
None,
|
||||
@ -1959,7 +1959,7 @@ fn commit_executable_and_symlinks() -> Result<()> {
|
||||
// commit
|
||||
commit(
|
||||
project_repository,
|
||||
&branch1_id,
|
||||
branch1_id,
|
||||
"branch1 commit",
|
||||
None,
|
||||
None,
|
||||
@ -2136,7 +2136,7 @@ fn pre_commit_hook_rejection() -> Result<()> {
|
||||
|
||||
let res = commit(
|
||||
project_repository,
|
||||
&branch1_id,
|
||||
branch1_id,
|
||||
"test commit",
|
||||
None,
|
||||
None,
|
||||
@ -2200,7 +2200,7 @@ fn post_commit_hook() -> Result<()> {
|
||||
|
||||
commit(
|
||||
project_repository,
|
||||
&branch1_id,
|
||||
branch1_id,
|
||||
"test commit",
|
||||
None,
|
||||
None,
|
||||
@ -2248,7 +2248,7 @@ fn commit_msg_hook_rejection() -> Result<()> {
|
||||
|
||||
let res = commit(
|
||||
project_repository,
|
||||
&branch1_id,
|
||||
branch1_id,
|
||||
"test commit",
|
||||
None,
|
||||
None,
|
||||
|
@ -29,7 +29,7 @@ pub mod commands {
|
||||
) -> Result<git::Oid, Error> {
|
||||
let oid = handle
|
||||
.state::<Controller>()
|
||||
.create_commit(project_id, &branch, message, ownership.as_ref(), run_hooks)
|
||||
.create_commit(project_id, branch, message, ownership.as_ref(), run_hooks)
|
||||
.await?;
|
||||
emit_vbranches(&handle, project_id).await;
|
||||
Ok(oid)
|
||||
@ -93,7 +93,7 @@ pub mod commands {
|
||||
) -> Result<(), Error> {
|
||||
handle
|
||||
.state::<Controller>()
|
||||
.integrate_upstream_commits(project_id, &branch)
|
||||
.integrate_upstream_commits(project_id, branch)
|
||||
.await?;
|
||||
emit_vbranches(&handle, project_id).await;
|
||||
Ok(())
|
||||
@ -184,7 +184,7 @@ pub mod commands {
|
||||
) -> Result<(), Error> {
|
||||
handle
|
||||
.state::<Controller>()
|
||||
.delete_virtual_branch(project_id, &branch_id)
|
||||
.delete_virtual_branch(project_id, branch_id)
|
||||
.await?;
|
||||
emit_vbranches(&handle, project_id).await;
|
||||
Ok(())
|
||||
@ -199,7 +199,7 @@ pub mod commands {
|
||||
) -> Result<(), Error> {
|
||||
handle
|
||||
.state::<Controller>()
|
||||
.apply_virtual_branch(project_id, &branch)
|
||||
.apply_virtual_branch(project_id, branch)
|
||||
.await?;
|
||||
emit_vbranches(&handle, project_id).await;
|
||||
Ok(())
|
||||
@ -214,7 +214,7 @@ pub mod commands {
|
||||
) -> Result<(), Error> {
|
||||
handle
|
||||
.state::<Controller>()
|
||||
.unapply_virtual_branch(project_id, &branch)
|
||||
.unapply_virtual_branch(project_id, branch)
|
||||
.await?;
|
||||
emit_vbranches(&handle, project_id).await;
|
||||
Ok(())
|
||||
@ -265,7 +265,7 @@ pub mod commands {
|
||||
) -> Result<(), Error> {
|
||||
handle
|
||||
.state::<Controller>()
|
||||
.push_virtual_branch(project_id, &branch_id, with_force, Some(Some(branch_id)))
|
||||
.push_virtual_branch(project_id, branch_id, with_force, Some(Some(branch_id)))
|
||||
.await
|
||||
.map_err(|err| err.context(Code::Unknown))?;
|
||||
emit_vbranches(&handle, project_id).await;
|
||||
@ -281,7 +281,7 @@ pub mod commands {
|
||||
) -> Result<bool, Error> {
|
||||
handle
|
||||
.state::<Controller>()
|
||||
.can_apply_virtual_branch(project_id, &branch_id)
|
||||
.can_apply_virtual_branch(project_id, branch_id)
|
||||
.await
|
||||
.map_err(Into::into)
|
||||
}
|
||||
@ -323,7 +323,7 @@ pub mod commands {
|
||||
) -> Result<(), Error> {
|
||||
handle
|
||||
.state::<Controller>()
|
||||
.reset_virtual_branch(project_id, &branch_id, target_commit_oid)
|
||||
.reset_virtual_branch(project_id, branch_id, target_commit_oid)
|
||||
.await?;
|
||||
emit_vbranches(&handle, project_id).await;
|
||||
Ok(())
|
||||
@ -339,7 +339,7 @@ pub mod commands {
|
||||
) -> Result<Option<git::Oid>, Error> {
|
||||
let oid = handle
|
||||
.state::<Controller>()
|
||||
.cherry_pick(project_id, &branch_id, target_commit_oid)
|
||||
.cherry_pick(project_id, branch_id, target_commit_oid)
|
||||
.await?;
|
||||
emit_vbranches(&handle, project_id).await;
|
||||
Ok(oid)
|
||||
@ -356,7 +356,7 @@ pub mod commands {
|
||||
) -> Result<git::Oid, Error> {
|
||||
let oid = handle
|
||||
.state::<Controller>()
|
||||
.amend(project_id, &branch_id, commit_oid, &ownership)
|
||||
.amend(project_id, branch_id, commit_oid, &ownership)
|
||||
.await?;
|
||||
emit_vbranches(&handle, project_id).await;
|
||||
Ok(oid)
|
||||
@ -376,7 +376,7 @@ pub mod commands {
|
||||
.state::<Controller>()
|
||||
.move_commit_file(
|
||||
project_id,
|
||||
&branch_id,
|
||||
branch_id,
|
||||
from_commit_oid,
|
||||
to_commit_oid,
|
||||
&ownership,
|
||||
@ -396,7 +396,7 @@ pub mod commands {
|
||||
) -> Result<(), Error> {
|
||||
handle
|
||||
.state::<Controller>()
|
||||
.undo_commit(project_id, &branch_id, commit_oid)
|
||||
.undo_commit(project_id, branch_id, commit_oid)
|
||||
.await?;
|
||||
emit_vbranches(&handle, project_id).await;
|
||||
Ok(())
|
||||
@ -413,7 +413,7 @@ pub mod commands {
|
||||
) -> Result<(), Error> {
|
||||
handle
|
||||
.state::<Controller>()
|
||||
.insert_blank_commit(project_id, &branch_id, commit_oid, offset)
|
||||
.insert_blank_commit(project_id, branch_id, commit_oid, offset)
|
||||
.await?;
|
||||
emit_vbranches(&handle, project_id).await;
|
||||
Ok(())
|
||||
@ -430,7 +430,7 @@ pub mod commands {
|
||||
) -> Result<(), Error> {
|
||||
handle
|
||||
.state::<Controller>()
|
||||
.reorder_commit(project_id, &branch_id, commit_oid, offset)
|
||||
.reorder_commit(project_id, branch_id, commit_oid, offset)
|
||||
.await?;
|
||||
emit_vbranches(&handle, project_id).await;
|
||||
Ok(())
|
||||
@ -477,7 +477,7 @@ pub mod commands {
|
||||
) -> Result<(), Error> {
|
||||
handle
|
||||
.state::<Controller>()
|
||||
.squash(project_id, &branch_id, target_commit_oid)
|
||||
.squash(project_id, branch_id, target_commit_oid)
|
||||
.await?;
|
||||
emit_vbranches(&handle, project_id).await;
|
||||
Ok(())
|
||||
@ -511,7 +511,7 @@ pub mod commands {
|
||||
) -> Result<(), Error> {
|
||||
handle
|
||||
.state::<Controller>()
|
||||
.move_commit(project_id, &target_branch_id, commit_oid)
|
||||
.move_commit(project_id, target_branch_id, commit_oid)
|
||||
.await?;
|
||||
emit_vbranches(&handle, project_id).await;
|
||||
Ok(())
|
||||
@ -528,7 +528,7 @@ pub mod commands {
|
||||
) -> Result<(), Error> {
|
||||
handle
|
||||
.state::<Controller>()
|
||||
.update_commit_message(project_id, &branch_id, commit_oid, message)
|
||||
.update_commit_message(project_id, branch_id, commit_oid, message)
|
||||
.await?;
|
||||
emit_vbranches(&handle, project_id).await;
|
||||
Ok(())
|
||||
|
Loading…
Reference in New Issue
Block a user