+
- {#if uniqueRemotes(remoteBranches).length > 1}
- Create branches on remote:
-
- {/if}
+ {#if uniqueRemotes(remoteBranches).length > 1}
+
+ {/if}
- {/if}
- {:catch}
-
-
- We got an error trying to list your remote branches
+ {#if $activeBranches && targetChangeDisabled}
+
+
+ You have {$activeBranches.length === 1
+ ? '1 active branch'
+ : `${$activeBranches.length} active branches`} in your workspace. Please clear the workspace
+ before switching the base branch.
- {/await}
- {/if}
-
- {#if $activeBranches && targetChangeDisabled}
-
-
- You have {$activeBranches.length === 1
- ? '1 active branch'
- : `${$activeBranches.length} active branches`} in your workspace. Please clear the workspace
- before switching the base branch.
-
-
- {/if}
-
-
-
-
-
+ {:else}
+
+ {/if}
+
+
+ {/if}
+{:catch}
+
+ We got an error trying to list your remote branches
+
+{/await}
diff --git a/app/src/lib/components/Board.svelte b/app/src/lib/components/Board.svelte
index ec6b670ab..da7ac680f 100644
--- a/app/src/lib/components/Board.svelte
+++ b/app/src/lib/components/Board.svelte
@@ -26,7 +26,6 @@
let dragHandle: any;
let clone: any;
- let isSwitching = false;
{#if $activeBranchesError}
diff --git a/app/src/lib/components/ProjectSetupTarget.svelte b/app/src/lib/components/ProjectSetupTarget.svelte
index 2aedfea04..14fb8e877 100644
--- a/app/src/lib/components/ProjectSetupTarget.svelte
+++ b/app/src/lib/components/ProjectSetupTarget.svelte
@@ -36,35 +36,38 @@
let loading = false;
let selectedBranch = getBestBranch(remoteBranches);
- function getBestBranch(branches: { name: string; }[]): { name: string } {
- // Function to calculate the rank of a branch
- // eslint-disable-next-line func-style
- const calculateRank = (branch: string): number => {
- if (branch === 'upstream/main' || branch === 'upstream/master') {
- return 100; // Highest preference
- }
- if (branch === 'origin/main' || branch === 'origin/master') {
- return 90;
- }
- if (branch.startsWith('origin')) {
- return 80;
- }
- if (branch.endsWith('master') || branch.endsWith('main')) {
- return 70;
- }
- return 10; // Least preference
- };
+ function getBestBranch(branches: { name: string }[]): { name: string } {
+ // Function to calculate the rank of a branch
+ // eslint-disable-next-line func-style
+ const calculateRank = (branch: string): number => {
+ if (branch === 'upstream/main' || branch === 'upstream/master') {
+ return 100; // Highest preference
+ }
+ if (branch === 'origin/main' || branch === 'origin/master') {
+ return 90;
+ }
+ if (branch.startsWith('origin')) {
+ return 80;
+ }
+ if (branch.endsWith('master') || branch.endsWith('main')) {
+ return 70;
+ }
+ return 10; // Least preference
+ };
- // Sort the branches based on their rank
- branches.sort((a, b) => calculateRank(b.name) - calculateRank(a.name));
+ // Sort the branches based on their rank
+ branches.sort((a, b) => calculateRank(b.name) - calculateRank(a.name));
- // Return the branch with the highest rank
- return branches[0];
+ // Return the branch with the highest rank
+ return branches[0];
}
// split all the branches by the first '/' and gather the unique remote names
// then turn remotes into an array of objects with a 'name' and 'value' key
- let remotes = Array.from(new Set(remoteBranches.map((b) => b.name.split('/')[0]))).map((r) => ({ name: r, value: r }));
+ let remotes = Array.from(new Set(remoteBranches.map((b) => b.name.split('/')[0]))).map((r) => ({
+ name: r,
+ value: r
+ }));
let selectedRemote = remotes[0];
// if there's an 'origin', select it by default
@@ -95,8 +98,8 @@
{#if remotes.length > 1}
- You have branches from multiple remotes. If you want to specify a push target for
- creating branches that is different from your production branch, change it here.
+ You have branches from multiple remotes. If you want to specify a push target for creating
+ branches that is different from your production branch, change it here.