From 4d5ff2f888b740b3a7b63f5d9bdfdc3b91585740 Mon Sep 17 00:00:00 2001 From: Caleb Owens Date: Tue, 16 Jul 2024 11:58:45 +0200 Subject: [PATCH] Rename RemoteBranch -> Branch --- app/src/lib/branch/BranchPreviewHeader.svelte | 4 ++-- app/src/lib/branches/service.ts | 4 ++-- app/src/lib/branches/types.ts | 6 +++--- app/src/lib/components/RemoteBranchPreview.svelte | 4 ++-- app/src/lib/stores/remoteBranches.ts | 6 +++--- app/src/lib/vbranches/types.ts | 6 +++--- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/app/src/lib/branch/BranchPreviewHeader.svelte b/app/src/lib/branch/BranchPreviewHeader.svelte index 868550f7e..843db0618 100644 --- a/app/src/lib/branch/BranchPreviewHeader.svelte +++ b/app/src/lib/branch/BranchPreviewHeader.svelte @@ -10,10 +10,10 @@ import { BranchController } from '$lib/vbranches/branchController'; import type { BaseBranch } from '$lib/baseBranch/baseBranch'; import type { PullRequest } from '$lib/gitHost/interface/types'; - import type { RemoteBranch } from '$lib/vbranches/types'; + import type { Branch } from '$lib/vbranches/types'; import { goto } from '$app/navigation'; - export let branch: RemoteBranch; + export let branch: Branch; export let base: BaseBranch | undefined | null; export let pr: PullRequest | undefined; diff --git a/app/src/lib/branches/service.ts b/app/src/lib/branches/service.ts index 18d69c917..6cbfa8b9d 100644 --- a/app/src/lib/branches/service.ts +++ b/app/src/lib/branches/service.ts @@ -4,7 +4,7 @@ import { derived, readable, writable, type Readable } from 'svelte/store'; import type { GitHostListingService } from '$lib/gitHost/interface/gitHostListingService'; import type { PullRequest } from '$lib/gitHost/interface/types'; import type { RemoteBranchService } from '$lib/stores/remoteBranches'; -import type { VirtualBranch, RemoteBranch } from '$lib/vbranches/types'; +import type { VirtualBranch, Branch } from '$lib/vbranches/types'; import type { VirtualBranchService } from '$lib/vbranches/virtualBranch'; export const [getBranchServiceStore, createBranchServiceStore] = buildContextStore< @@ -36,7 +36,7 @@ export class BranchService { function mergeBranchesAndPrs( vbranches: VirtualBranch[] | undefined, pullRequests: PullRequest[] | undefined, - remoteBranches: RemoteBranch[] | undefined + remoteBranches: Branch[] | undefined ): CombinedBranch[] { const contributions: CombinedBranch[] = []; diff --git a/app/src/lib/branches/types.ts b/app/src/lib/branches/types.ts index d0513cc12..cef6d5c0a 100644 --- a/app/src/lib/branches/types.ts +++ b/app/src/lib/branches/types.ts @@ -1,9 +1,9 @@ import type { PullRequest } from '$lib/gitHost/interface/types'; -import type { Author, VirtualBranch, RemoteBranch } from '$lib/vbranches/types'; +import type { Author, VirtualBranch, Branch } from '$lib/vbranches/types'; export class CombinedBranch { pr?: PullRequest; - remoteBranch?: RemoteBranch; + remoteBranch?: Branch; vbranch?: VirtualBranch; constructor({ @@ -12,7 +12,7 @@ export class CombinedBranch { pr }: { vbranch?: VirtualBranch; - remoteBranch?: RemoteBranch; + remoteBranch?: Branch; pr?: PullRequest; }) { this.vbranch = vbranch; diff --git a/app/src/lib/components/RemoteBranchPreview.svelte b/app/src/lib/components/RemoteBranchPreview.svelte index 65aefdbb5..78e1c94eb 100644 --- a/app/src/lib/components/RemoteBranchPreview.svelte +++ b/app/src/lib/components/RemoteBranchPreview.svelte @@ -10,14 +10,14 @@ import { RemoteBranchService } from '$lib/stores/remoteBranches'; import { getContext, getContextStore, getContextStoreBySymbol } from '$lib/utils/context'; import { FileIdSelection } from '$lib/vbranches/fileIdSelection'; - import { type RemoteBranch } from '$lib/vbranches/types'; + import { type Branch } from '$lib/vbranches/types'; import lscache from 'lscache'; import { marked } from 'marked'; import { onMount, setContext } from 'svelte'; import { writable } from 'svelte/store'; import type { PullRequest } from '$lib/gitHost/interface/types'; - export let branch: RemoteBranch; + export let branch: Branch; export let pr: PullRequest | undefined; const project = getContext(Project); diff --git a/app/src/lib/stores/remoteBranches.ts b/app/src/lib/stores/remoteBranches.ts index 8190a6585..06d7d7255 100644 --- a/app/src/lib/stores/remoteBranches.ts +++ b/app/src/lib/stores/remoteBranches.ts @@ -1,11 +1,11 @@ import { invoke } from '$lib/backend/ipc'; -import { RemoteBranch, RemoteBranchData } from '$lib/vbranches/types'; +import { Branch, RemoteBranchData } from '$lib/vbranches/types'; import { plainToInstance } from 'class-transformer'; import { writable } from 'svelte/store'; import type { ProjectMetrics } from '$lib/metrics/projectMetrics'; export class RemoteBranchService { - readonly branches = writable([], () => { + readonly branches = writable([], () => { this.refresh(); }); error = writable(); @@ -18,7 +18,7 @@ export class RemoteBranchService { async refresh() { try { const remoteBranches = plainToInstance( - RemoteBranch, + Branch, await invoke('list_remote_branches', { projectId: this.projectId }) ); this.projectMetrics?.setMetric('normal_branch_count', remoteBranches.length); diff --git a/app/src/lib/vbranches/types.ts b/app/src/lib/vbranches/types.ts index 90c05a7a8..dba59f4f0 100644 --- a/app/src/lib/vbranches/types.ts +++ b/app/src/lib/vbranches/types.ts @@ -109,8 +109,8 @@ export class VirtualBranch { description!: string; head!: string; order!: number; - @Type(() => RemoteBranch) - upstream?: RemoteBranch; + @Type(() => Branch) + upstream?: Branch; upstreamData?: RemoteBranchData; upstreamName?: string; conflicted!: boolean; @@ -324,7 +324,7 @@ export interface Author { isBot?: boolean; } -export class RemoteBranch { +export class Branch { sha!: string; name!: string; upstream?: string;