From 202fcd13e97cda86ef6ebd02e8fdc4114f2be6ef Mon Sep 17 00:00:00 2001 From: Mattias Granlund Date: Tue, 19 Nov 2024 11:33:57 +0000 Subject: [PATCH] Drop RemoteBranch in favor of RemoteBranchData - redundant data structure and api removed - served same purpose as `find_git_branches` --- .../src/lib/branch/BranchPreviewHeader.svelte | 6 +- apps/desktop/src/lib/branches/gitBranch.ts | 11 +-- .../src/lib/components/BranchPreview.svelte | 39 ++------- .../desktop/src/lib/pr/PullRequestCard.svelte | 21 ++++- apps/desktop/src/lib/vbranches/types.ts | 22 ++--- .../[projectId]/branch/[...name]/+page.svelte | 6 +- .../gitbutler-branch-actions/src/actions.rs | 9 +- crates/gitbutler-branch-actions/src/lib.rs | 11 ++- crates/gitbutler-branch-actions/src/remote.rs | 87 ++++--------------- .../gitbutler-branch-actions/src/virtual.rs | 8 +- crates/gitbutler-tauri/src/main.rs | 1 - .../gitbutler-tauri/src/virtual_branches.rs | 19 +--- 12 files changed, 66 insertions(+), 174 deletions(-) diff --git a/apps/desktop/src/lib/branch/BranchPreviewHeader.svelte b/apps/desktop/src/lib/branch/BranchPreviewHeader.svelte index 55c9eae307..36ea69dc62 100644 --- a/apps/desktop/src/lib/branch/BranchPreviewHeader.svelte +++ b/apps/desktop/src/lib/branch/BranchPreviewHeader.svelte @@ -12,11 +12,11 @@ import Modal from '@gitbutler/ui/Modal.svelte'; import Tooltip from '@gitbutler/ui/Tooltip.svelte'; import type { PullRequest } from '$lib/forge/interface/types'; - import type { Branch } from '$lib/vbranches/types'; + import type { BranchData } from '$lib/vbranches/types'; import { goto } from '$app/navigation'; - export let localBranch: Branch | undefined; - export let remoteBranch: Branch | undefined; + export let localBranch: BranchData | undefined; + export let remoteBranch: BranchData | undefined; export let pr: PullRequest | undefined; $: branch = remoteBranch || localBranch!; diff --git a/apps/desktop/src/lib/branches/gitBranch.ts b/apps/desktop/src/lib/branches/gitBranch.ts index 68a98c2ff2..036ef08279 100644 --- a/apps/desktop/src/lib/branches/gitBranch.ts +++ b/apps/desktop/src/lib/branches/gitBranch.ts @@ -1,21 +1,14 @@ import { invoke } from '$lib/backend/ipc'; -import { Branch, BranchData } from '$lib/vbranches/types'; +import { BranchData } from '$lib/vbranches/types'; import { plainToInstance } from 'class-transformer'; export class GitBranchService { constructor(private projectId: string) {} async findBranches(name: string) { - return plainToInstance( - Branch, - await invoke('find_git_branches', { projectId: this.projectId, branchName: name }) - ); - } - - async getRemoteBranchData(refname: string): Promise { return plainToInstance( BranchData, - await invoke('get_remote_branch_data', { projectId: this.projectId, refname }) + await invoke('find_git_branches', { projectId: this.projectId, branchName: name }) ); } } diff --git a/apps/desktop/src/lib/components/BranchPreview.svelte b/apps/desktop/src/lib/components/BranchPreview.svelte index 018386c614..1c10375ecb 100644 --- a/apps/desktop/src/lib/components/BranchPreview.svelte +++ b/apps/desktop/src/lib/components/BranchPreview.svelte @@ -1,7 +1,6 @@