Skip to content

Commit

Permalink
Merge branch 'main' into cm/cleanup-ansi
Browse files Browse the repository at this point in the history
  • Loading branch information
chris-believer authored May 9, 2024
2 parents e551890 + 1a96798 commit 3fb07e8
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 28 deletions.
4 changes: 2 additions & 2 deletions birdie/src-tauri/src/repo/revert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ impl Task for RevertFilesOp {
bail!("no files provided");
}

let remote_branch = self.repo_status.read().remote_branch.clone();
let mut args: Vec<&str> = vec!["checkout", &remote_branch, "--"];
let branch = self.repo_status.read().branch.clone();
let mut args: Vec<&str> = vec!["checkout", &branch, "--"];

for file in &self.files {
args.push(file);
Expand Down
29 changes: 24 additions & 5 deletions friendshipper/src-tauri/src/repo/operations/pull.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,15 +122,34 @@ impl Task for PullOp {

status_op.execute().await?;
}
} else {
// If we're not on a Quick Submit branch, update the status and check for conflicts.
let status_op = StatusOp {
repo_status: self.repo_status.clone(),
app_config: self.app_config.clone(),
git_client: self.git_client.clone(),
aws_client: self.aws_client.clone(),
storage: self.storage.clone(),
skip_fetch: true,
skip_dll_check: false,
};

status_op.execute().await?;

let repo_status = self.repo_status.read();
if !repo_status.conflicts.is_empty() {
bail!("Conflicts detected, cannot pull. See Diagnostics.");
}
}

// Check repo status to see if we need to pull at all.
//
// Note that we do NOT check to see if there are upstream conflicts. Typically this shouldn't be an issue since most
// content creators will be using Quick Submit to submit changes, and checking for conflicts after switching over from
// a Quick Submit branch will always yield false positives, as the commits from the f11r branch will almost always have
// a different SHA since there will likely have been other changes that have gone in since the submitter synced.
// Since we pull using a rebase, the local commits will be safely merged with the upstream ones and essentially dissapear.
// Note that we do NOT check to see if there are upstream conflicts if this is a Quick Submit branch. Typically
// this shouldn't be an issue since most content creators will be using Quick Submit to submit changes, and checking for
// conflicts after switching over from a Quick Submit branch will always yield false positives, as the commits from the
// f11r branch will almost always have a different SHA since there will likely have been other changes that have gone in
// since the submitter synced. Since we pull using a rebase, the local commits will be safely merged with the upstream ones
// and essentially disappear.
{
let repo_status = self.repo_status.read();
if repo_status.commits_behind == 0 {
Expand Down
4 changes: 2 additions & 2 deletions friendshipper/src-tauri/src/repo/operations/revert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ impl Task for RevertFilesOp {
bail!("no files provided");
}

let remote_branch = self.repo_status.read().remote_branch.clone();
let mut args: Vec<&str> = vec!["checkout", &remote_branch, "--"];
let branch = self.repo_status.read().branch.clone();
let mut args: Vec<&str> = vec!["checkout", &branch, "--"];

for file in &self.files {
args.push(file);
Expand Down
49 changes: 32 additions & 17 deletions friendshipper/src/routes/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
DarkMode,
Modal,
Sidebar,
SidebarDropdownItem,
SidebarDropdownWrapper,
SidebarGroup,
SidebarItem,
Expand Down Expand Up @@ -88,12 +87,14 @@
let latest = '';
let updateAvailable = false;
$: conflictsDetected = $repoStatus?.conflicts && $repoStatus?.conflicts.length > 0;
const spanClass = 'flex-1 ml-3 whitespace-nowrap';
const sidebarSubItemClass = 'my-1 pl-8 text-sm text-primary-400 dark:text-primary-400';
const sidebarSubItemClass = 'mx-2 my-1 text-sm text-primary-400 dark:text-primary-400';
const sidebarSubItemInactiveClass =
'flex items-center justify-between my-1 px-2 py-1 text-base font-normal rounded-lg text-primary-400 dark:text-primary-400 bg-secondary-700 dark:bg-space-900 hover:bg-secondary-800 dark:hover:bg-space-950';
'flex items-center justify-between mx-2 my-1 px-2 py-1 text-base font-normal rounded-lg text-primary-400 dark:text-primary-400 bg-secondary-800 dark:bg-space-950 hover:bg-secondary-700 dark:hover:bg-space-900';
const sidebarSubItemActiveClass =
'flex items-center justify-between my-1 px-2 py-1 text-base font-normal bg-secondary-800 dark:bg-space-950 rounded-lg text-primary-400 dark:text-primary-400 hover:bg-secondary-800 dark:hover:bg-space-950';
'flex items-center justify-between mx-2 my-1 px-2 py-1 text-base font-normal bg-secondary-700 dark:bg-space-900 rounded-lg text-primary-400 dark:text-primary-400 hover:bg-secondary-700 dark:hover:bg-space-900';
$: activeUrl = $page.url.pathname;
Expand Down Expand Up @@ -516,7 +517,7 @@
<SidebarDropdownWrapper
label="Source"
class="group/item text-primary-400 dark:text-primary-400 hover:bg-secondary-800 dark:hover:bg-space-950 rounded-lg"
ulClass="py-1"
ulClass="my-2 rounded-lg py-1 bg-secondary-800 dark:bg-space-950"
>
<svelte:fragment slot="icon">
<CodeBranchSolid
Expand All @@ -538,14 +539,26 @@
active={activeUrl === '/source/submit'}
>
<svelte:fragment slot="subtext">
<span
class="items-center px-2 ms-3 text-sm font-medium text-white rounded-full {$allModifiedFiles.length >
0
? 'bg-primary-600 dark:bg-primary-600'
: 'bg-gray-500 dark:bg-gray-500'}"
>
{$allModifiedFiles.length}
</span>
<div class="flex w-full gap-1 pl-2 ms-3 items-center justify-end">
<span
class="items-center px-2 text-sm font-medium text-white rounded-full {$allModifiedFiles.length >
0
? 'bg-primary-600 dark:bg-primary-600'
: 'bg-gray-500 dark:bg-gray-500'}"
>
{$allModifiedFiles.length}
</span>
{#if conflictsDetected}
<span
class="items-center px-2 text-sm font-medium text-white rounded-full {$allModifiedFiles.length >
0
? 'bg-red-700 dark:bg-red-700'
: 'bg-gray-500 dark:bg-gray-500'}"
>
{$repoStatus?.conflicts.length}
</span>
{/if}
</div>
</svelte:fragment>
</SidebarItem>
<SidebarItem
Expand Down Expand Up @@ -589,7 +602,7 @@
<SidebarDropdownWrapper
label="Ludos"
class="group/item text-primary-400 dark:text-primary-400 hover:bg-secondary-800 dark:hover:bg-space-950 rounded-lg"
ulClass="py-1"
ulClass="my-2 rounded-lg py-1 bg-secondary-800 dark:bg-space-950"
>
<svelte:fragment slot="icon">
<DatabaseSolid
Expand All @@ -602,9 +615,10 @@
<svelte:fragment slot="arrowdown">
<ChevronDownSolid class="h-3 w-3 text-white" />
</svelte:fragment>
<SidebarDropdownItem
<SidebarItem
label="Storage"
activeClass={sidebarSubItemActiveClass}
nonActiveClass={sidebarSubItemInactiveClass}
class={sidebarSubItemClass}
href="/ludos/objects"
active={activeUrl === '/ludos/objects'}
Expand All @@ -614,7 +628,7 @@
<SidebarDropdownWrapper
label="System"
class="group/item text-primary-400 dark:text-primary-400 hover:bg-secondary-800 dark:hover:bg-space-950 rounded-lg"
ulClass="py-1"
ulClass="my-2 rounded-lg py-1 bg-secondary-800 dark:bg-space-950"
>
<svelte:fragment slot="icon">
<ComputerSpeakerSolid
Expand All @@ -627,9 +641,10 @@
<svelte:fragment slot="arrowdown">
<ChevronDownSolid class="h-3 w-3 text-white" />
</svelte:fragment>
<SidebarDropdownItem
<SidebarItem
label="Logs"
activeClass={sidebarSubItemActiveClass}
nonActiveClass={sidebarSubItemInactiveClass}
class={sidebarSubItemClass}
href="/system/logs"
active={activeUrl === '/system/logs'}
Expand Down
2 changes: 1 addition & 1 deletion friendshipper/src/routes/source/diagnostics/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
repoStatusCheck = CheckStatus.Success;
if ($repoStatus?.conflictsUpstream) {
if ($repoStatus?.conflictUpstream) {
mergeConflictCheck = CheckStatus.Failure;
} else {
mergeConflictCheck = CheckStatus.Success;
Expand Down
11 changes: 10 additions & 1 deletion friendshipper/src/routes/source/history/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
let inAsyncOperation = false;
let asyncModalText = '';
$: conflictsDetected = $repoStatus?.conflicts && $repoStatus.conflicts.length > 0;
const refresh = async () => {
loading = true;
repoStatus.set(await getRepoStatus());
Expand Down Expand Up @@ -191,12 +193,19 @@
<Button
size="xs"
color="primary"
disabled={inAsyncOperation}
disabled={inAsyncOperation || conflictsDetected}
on:click={async () => handleSyncClicked()}
>
<RotateOutline class="w-3 h-3 mr-2" />
Sync
</Button>
{#if conflictsDetected}
<Tooltip
class="ml-2 w-36 text-sm text-primary-400 bg-secondary-800 dark:bg-space-950"
placement="bottom"
>Conflicts detected!
</Tooltip>
{/if}
<Button
size="xs"
color="primary"
Expand Down

0 comments on commit 3fb07e8

Please sign in to comment.