diff --git a/packages/ui/src/routes/[projectId]/components/BranchFiles.svelte b/packages/ui/src/routes/[projectId]/components/BranchFiles.svelte new file mode 100644 index 000000000..c284fcca3 --- /dev/null +++ b/packages/ui/src/routes/[projectId]/components/BranchFiles.svelte @@ -0,0 +1,72 @@ + + +{#if branch.conflicted} +
+ {#if branch.files.some((f) => f.conflicted)} + This virtual branch conflicts with upstream changes. Please resolve all conflicts and commit + before you can continue. + {:else} + Please commit your resolved conflicts to continue. + {/if} +
+{/if} + +
+ {#if branch.files.length > 0} +
+ + {#each sortLikeFileTree(branch.files) as file (file.id)} + { + setExpandedWithCache(file, e.detail); + }} + /> + {/each} +
+ {/if} + {#if branch.files.length == 0} + {#if branch.commits.length == 0} +
+

Nothing on this branch yet.

+ {#if !readonly} + +

Get some work done, then throw some files my way!

+ {/if} +
+ {:else} + +
+ No uncommitted changes on this branch +
+ {/if} + {/if} +
diff --git a/packages/ui/src/routes/[projectId]/components/BranchHeader.svelte b/packages/ui/src/routes/[projectId]/components/BranchHeader.svelte new file mode 100644 index 000000000..e3fb2e620 --- /dev/null +++ b/packages/ui/src/routes/[projectId]/components/BranchHeader.svelte @@ -0,0 +1,86 @@ + + +
+
+ {#if !readonly} +
+ +
+ {/if} + +
+
+ {#if !readonly} +
+ popupMenu.openByElement(meatballButton, branch.id)} + /> +
+ {/if} +
+
+ + diff --git a/packages/ui/src/routes/[projectId]/components/BranchLane.svelte b/packages/ui/src/routes/[projectId]/components/BranchLane.svelte index dc8fdfa66..4a4771a5c 100644 --- a/packages/ui/src/routes/[projectId]/components/BranchLane.svelte +++ b/packages/ui/src/routes/[projectId]/components/BranchLane.svelte @@ -1,55 +1,42 @@ + +{#if integratedCommits.length > 0} +
+
+ +
+
+ +
+ + integrated to {base?.branchName} + +
+ + {#each integratedCommits as commit (commit.id)} +
+
+
+
+ +
+ {/each} +
+
+{/if} diff --git a/packages/ui/src/routes/[projectId]/components/LocalCommits.svelte b/packages/ui/src/routes/[projectId]/components/LocalCommits.svelte new file mode 100644 index 000000000..19d9460fc --- /dev/null +++ b/packages/ui/src/routes/[projectId]/components/LocalCommits.svelte @@ -0,0 +1,159 @@ + + +{#if localCommits.length > 0 || (branch.upstream && branch.upstream.commits.length > 0)} +
+
+ +
+
+
+
+ local +
+ {#if githubContext && !prPromise} + { + push()?.finally(() => { + if (e.detail.with_pr) createPr(); + }); + }} + /> + {:else} + + {/if} +
+ + {#each localCommits as commit (commit.id)} +
+ {#if commit.id === headCommit?.id} +
+
+ +
+ {:else} +
+
+
+ {/if} +
+ + + + +
+
+ {/each} +
+
+{/if} diff --git a/packages/ui/src/routes/[projectId]/components/RemoteCommits.svelte b/packages/ui/src/routes/[projectId]/components/RemoteCommits.svelte new file mode 100644 index 000000000..9283d222d --- /dev/null +++ b/packages/ui/src/routes/[projectId]/components/RemoteCommits.svelte @@ -0,0 +1,157 @@ + + +{#if remoteCommits.length > 0} +
+
+ +
+
+ +
+ {#if branch.upstream} +
+ + {branch.upstream.name.split('refs/remotes/')[1]} + + {#await prPromise then pr} + {#if githubContext && pr} + + + + + + {:else if githubContext} + + {/if} + {/await} +
+ {/if} +
+ + {#each remoteCommits as commit (commit.id)} +
+ {#if commit.id === headCommit?.id} +
+
+ +
+ {:else} +
+
+
+ {/if} + +
+ + + + +
+
+ {/each} +
+
+{/if} diff --git a/packages/ui/src/routes/[projectId]/components/UpstreamCommits.svelte b/packages/ui/src/routes/[projectId]/components/UpstreamCommits.svelte new file mode 100644 index 000000000..3c414ec6c --- /dev/null +++ b/packages/ui/src/routes/[projectId]/components/UpstreamCommits.svelte @@ -0,0 +1,72 @@ + + +{#if upstream} +
+
+
+ {upstream.commits.length} + upstream {upstream.commits.length > 1 ? 'commits' : 'commit'} +
+ +
+
+ {#if upstreamCommitsShown} +
+ {#each upstream.commits as commit (commit.id)} +
+ +
+ {/each} +
+ {#if branchCount > 1} +
+ You have {branchCount} active branches. To merge upstream work, we will unapply all other + branches. +
+ {/if} + +
+
+ {/if} +{/if} diff --git a/packages/ui/src/routes/[projectId]/stashed/[branchId]/+page.svelte b/packages/ui/src/routes/[projectId]/stashed/[branchId]/+page.svelte index c9a5625a6..8217fc2d5 100644 --- a/packages/ui/src/routes/[projectId]/stashed/[branchId]/+page.svelte +++ b/packages/ui/src/routes/[projectId]/stashed/[branchId]/+page.svelte @@ -2,9 +2,16 @@ import type { PageData } from './$types'; import { page } from '$app/stores'; import BranchLane from '../../components/BranchLane.svelte'; + import Button from '$lib/components/Button.svelte'; + import IconButton from '$lib/components/IconButton.svelte'; + import type { Branch } from '$lib/vbranches/types'; + import Modal from '$lib/components/Modal.svelte'; export let data: PageData; + let applyConflictedModal: Modal; + let deleteBranchModal: Modal; + $: projectId = data.projectId; $: user$ = data.user$; $: githubContext$ = data.githubContext$; @@ -18,6 +25,14 @@ $: branches$ = vbranchService.branches$; $: error$ = vbranchService.branchesError$; $: branch = $branches$?.find((b) => b.id == $page.params.branchId); + + function applyBranch(branch: Branch) { + if (!branch.baseCurrent) { + applyConflictedModal.show(branch); + } else { + branchController.applyBranch(branch.id); + } + }
@@ -26,6 +41,24 @@ {:else if !$branches$}

Loading...

{:else if branch} + {#await branch.isMergeable then isMergeable} + {#if isMergeable} + + {/if} + {/await} + deleteBranchModal.show(branch)} + /> Branch no longer exists

{/if}
+ + + Merge conflicts +

Applying this branch will introduce merge conflicts.

+ + + + +
+ + + Delete branch +
+ Deleting {item.name} cannot be undone. +
+ + + + +