mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2025-01-01 14:04:57 +03:00
remove unused project_flush_and_push
This commit is contained in:
parent
1875d86e7a
commit
217efbc932
@ -1,9 +0,0 @@
|
||||
import { invoke } from './ipc';
|
||||
|
||||
export async function syncToCloud(projectId: string | undefined) {
|
||||
try {
|
||||
if (projectId) await invoke<void>('project_flush_and_push', { id: projectId });
|
||||
} catch (err: any) {
|
||||
console.error(err);
|
||||
}
|
||||
}
|
@ -1,19 +1,15 @@
|
||||
<script lang="ts">
|
||||
import { Project } from '$lib/backend/projects';
|
||||
import { syncToCloud } from '$lib/backend/sync';
|
||||
import Tag from '$lib/components/Tag.svelte';
|
||||
import TimeAgo from '$lib/components/TimeAgo.svelte';
|
||||
import { GitHubService } from '$lib/github/service';
|
||||
import { getContext } from '$lib/utils/context';
|
||||
import { BaseBranchService } from '$lib/vbranches/baseBranch';
|
||||
|
||||
const project = getContext(Project);
|
||||
const githubService = getContext(GitHubService);
|
||||
const baseBranchService = getContext(BaseBranchService);
|
||||
const baseBranch = baseBranchService.base;
|
||||
|
||||
$: baseServiceBusy$ = baseBranchService.busy$;
|
||||
$: cloudEnabled = project.api?.sync || false;
|
||||
</script>
|
||||
|
||||
<Tag
|
||||
@ -27,7 +23,6 @@
|
||||
on:mousedown={async (e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
if (cloudEnabled) syncToCloud(project.id); // don't wait for this
|
||||
await baseBranchService.fetchFromTarget('modal');
|
||||
if (githubService.isEnabled) {
|
||||
await githubService.reload();
|
||||
|
@ -1,6 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { Project } from '$lib/backend/projects';
|
||||
import { syncToCloud } from '$lib/backend/sync';
|
||||
import { BranchService } from '$lib/branches/service';
|
||||
import History from '$lib/components/History.svelte';
|
||||
import Navigation from '$lib/components/Navigation.svelte';
|
||||
@ -10,13 +9,11 @@
|
||||
import ProjectSettingsMenuAction from '$lib/components/ProjectSettingsMenuAction.svelte';
|
||||
import { SETTINGS, type Settings } from '$lib/settings/userSettings';
|
||||
import { getContextStoreBySymbol } from '$lib/utils/context';
|
||||
import * as hotkeys from '$lib/utils/hotkeys';
|
||||
import { unsubscribe } from '$lib/utils/unsubscribe';
|
||||
import { BaseBranchService, NoDefaultTarget } from '$lib/vbranches/baseBranch';
|
||||
import { BranchController } from '$lib/vbranches/branchController';
|
||||
import { BaseBranch } from '$lib/vbranches/types';
|
||||
import { VirtualBranchService } from '$lib/vbranches/virtualBranch';
|
||||
import { onDestroy, onMount, setContext } from 'svelte';
|
||||
import { onDestroy, setContext } from 'svelte';
|
||||
import type { LayoutData } from './$types';
|
||||
|
||||
export let data: LayoutData;
|
||||
@ -61,15 +58,6 @@
|
||||
if (intervalId) clearInterval(intervalId);
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
const cloudSyncSubscription = hotkeys.on(
|
||||
'Meta+Shift+S',
|
||||
async () => await syncToCloud(projectId)
|
||||
);
|
||||
|
||||
return unsubscribe(cloudSyncSubscription);
|
||||
});
|
||||
|
||||
onDestroy(() => clearFetchInterval());
|
||||
</script>
|
||||
|
||||
|
@ -1,14 +1,9 @@
|
||||
use anyhow::Context;
|
||||
use gitbutler_core::{
|
||||
gb_repository, git, project_repository,
|
||||
projects::{self, ProjectId},
|
||||
users,
|
||||
};
|
||||
use gitbutler_core::{git, projects::ProjectId};
|
||||
use tauri::Manager;
|
||||
use tracing::instrument;
|
||||
|
||||
use crate::app;
|
||||
use crate::error::Error;
|
||||
use crate::{app, watcher};
|
||||
|
||||
#[tauri::command(async)]
|
||||
#[instrument(skip(handle), err(Debug))]
|
||||
@ -117,35 +112,3 @@ pub async fn git_get_global_config(
|
||||
let result = app::App::git_get_global_config(key)?;
|
||||
Ok(result)
|
||||
}
|
||||
|
||||
#[tauri::command(async)]
|
||||
#[instrument(skip(handle), err(Debug))]
|
||||
pub async fn project_flush_and_push(handle: tauri::AppHandle, id: ProjectId) -> Result<(), Error> {
|
||||
let users = handle.state::<users::Controller>().inner().clone();
|
||||
let projects = handle.state::<projects::Controller>().inner().clone();
|
||||
let local_data_dir = handle
|
||||
.path_resolver()
|
||||
.app_data_dir()
|
||||
.context("failed to get app data dir")?;
|
||||
|
||||
let project = projects.get(&id).context("failed to get project")?;
|
||||
let user = users.get_user()?;
|
||||
let project_repository =
|
||||
project_repository::Repository::open(&project).map_err(Error::from_error_with_context)?;
|
||||
let gb_repo =
|
||||
gb_repository::Repository::open(&local_data_dir, &project_repository, user.as_ref())
|
||||
.context("failed to open repository")?;
|
||||
|
||||
if let Some(current_session) = gb_repo
|
||||
.get_current_session()
|
||||
.context("failed to get current session")?
|
||||
{
|
||||
let watcher = handle.state::<watcher::Watchers>();
|
||||
watcher
|
||||
.post(gitbutler_watcher::Action::Flush(id, current_session))
|
||||
.await
|
||||
.context("failed to post flush event")?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
@ -177,7 +177,6 @@ fn main() {
|
||||
commands::mark_resolved,
|
||||
commands::git_set_global_config,
|
||||
commands::git_get_global_config,
|
||||
commands::project_flush_and_push,
|
||||
commands::git_test_push,
|
||||
commands::git_test_fetch,
|
||||
commands::git_index_size,
|
||||
|
Loading…
Reference in New Issue
Block a user