feat(desktop): manage project branches (#2212)

This commit is contained in:
thomaspblock
2026-07-21 10:16:02 +02:00
committed by GitHub
parent 4de3e04119
commit b2c38c775b
17 changed files with 1160 additions and 8 deletions

View File

@@ -1,6 +1,7 @@
import type {
ProjectLocalRepository,
ProjectLocalRepoSnapshot,
ProjectRepoBranchResult,
ProjectRepoCloneResult,
ProjectRepoDiff,
ProjectRepoMergeResult,
@@ -96,6 +97,12 @@ type RawProjectRepoPullResult = {
message: string;
};
type RawProjectRepoBranchResult = {
branch: string;
commit: string;
message: string;
};
type RawProjectRepoDiffFile = {
path: string;
additions: number;
@@ -426,6 +433,38 @@ export async function cloneProjectRepository(input: {
});
}
export async function createProjectRemoteBranch(input: {
cloneUrl: string;
sourceBranch: string;
expectedCommit: string;
newBranch: string;
}): Promise<ProjectRepoBranchResult> {
return invokeTauri<RawProjectRepoBranchResult>(
"create_project_remote_branch",
{
cloneUrl: input.cloneUrl,
sourceBranch: input.sourceBranch,
expectedCommit: input.expectedCommit,
newBranch: input.newBranch,
},
);
}
export async function deleteProjectRemoteBranch(input: {
cloneUrl: string;
branch: string;
expectedCommit: string;
}): Promise<ProjectRepoBranchResult> {
return invokeTauri<RawProjectRepoBranchResult>(
"delete_project_remote_branch",
{
cloneUrl: input.cloneUrl,
branch: input.branch,
expectedCommit: input.expectedCommit,
},
);
}
type RawProjectRepoMergeResult = {
message: string;
merge_commit: string;

View File

@@ -93,6 +93,12 @@ export type ProjectRepoCloneResult = {
message: string;
};
export type ProjectRepoBranchResult = {
branch: string;
commit: string;
message: string;
};
export type ProjectRepoMergeResult = {
message: string;
mergeCommit: string;

View File

@@ -190,6 +190,7 @@ export type UserStatusLookup = Record<string, UserStatus | null>;
export type {
ProjectLocalRepository,
ProjectLocalRepoSnapshot,
ProjectRepoBranchResult,
ProjectRepoCommit,
ProjectRepoContributor,
ProjectRepoCloneResult,