mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-11-28 22:03:30 +03:00
rename fetch_from_target to fetch_from_remotes
This commit is contained in:
parent
1645073d92
commit
6d1ed8474c
@ -347,7 +347,7 @@
|
||||
toasts.error('Failed to merge pull request');
|
||||
} finally {
|
||||
isMerging = false;
|
||||
baseBranchService.fetchFromTarget();
|
||||
baseBranchService.fetchFromRemotes();
|
||||
branchService.reloadVirtualBranches();
|
||||
updateDetailsAndChecks();
|
||||
}
|
||||
|
@ -23,7 +23,7 @@
|
||||
on:mousedown={async (e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
await baseBranchService.fetchFromTarget('modal');
|
||||
await baseBranchService.fetchFromRemotes('modal');
|
||||
if (githubService.isEnabled) {
|
||||
await githubService.reload();
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ export function mockTauri() {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (cmd === 'fetch_from_target') {
|
||||
if (cmd === 'fetch_from_remotes') {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -63,12 +63,12 @@ export class BaseBranchService {
|
||||
[this.base, this.error] = observableToStore(this.base$, this.reload$);
|
||||
}
|
||||
|
||||
async fetchFromTarget(action: string | undefined = undefined) {
|
||||
async fetchFromRemotes(action: string | undefined = undefined) {
|
||||
this.busy$.next(true);
|
||||
try {
|
||||
// Note that we expect the back end to emit new fetches event, and therefore
|
||||
// trigger a base branch reload. It feels a bit awkward and should be improved.
|
||||
await invoke<void>('fetch_from_target', {
|
||||
await invoke<void>('fetch_from_remotes', {
|
||||
projectId: this.projectId,
|
||||
action: action || 'auto'
|
||||
});
|
||||
@ -94,7 +94,7 @@ export class BaseBranchService {
|
||||
branch,
|
||||
pushRemote
|
||||
});
|
||||
await this.fetchFromTarget();
|
||||
await this.fetchFromRemotes();
|
||||
}
|
||||
|
||||
reload() {
|
||||
|
@ -54,10 +54,10 @@
|
||||
$: if (projectId) setupFetchInterval();
|
||||
|
||||
function setupFetchInterval() {
|
||||
baseBranchService.fetchFromTarget();
|
||||
baseBranchService.fetchFromRemotes();
|
||||
clearFetchInterval();
|
||||
const intervalMs = 15 * 60 * 1000; // 15 minutes
|
||||
intervalId = setInterval(async () => await baseBranchService.fetchFromTarget(), intervalMs);
|
||||
intervalId = setInterval(async () => await baseBranchService.fetchFromRemotes(), intervalMs);
|
||||
}
|
||||
|
||||
function clearFetchInterval() {
|
||||
|
@ -388,14 +388,14 @@ impl Controller {
|
||||
.await
|
||||
}
|
||||
|
||||
pub async fn fetch_from_target(
|
||||
pub async fn fetch_from_remotes(
|
||||
&self,
|
||||
project_id: &ProjectId,
|
||||
askpass: Option<String>,
|
||||
) -> Result<BaseBranch, Error> {
|
||||
self.inner(project_id)
|
||||
.await
|
||||
.fetch_from_target(project_id, askpass)
|
||||
.fetch_from_remotes(project_id, askpass)
|
||||
.await
|
||||
}
|
||||
|
||||
@ -880,7 +880,7 @@ impl ControllerInner {
|
||||
})
|
||||
}
|
||||
|
||||
pub async fn fetch_from_target(
|
||||
pub async fn fetch_from_remotes(
|
||||
&self,
|
||||
project_id: &ProjectId,
|
||||
askpass: Option<String>,
|
||||
|
@ -103,7 +103,7 @@ async fn integration() {
|
||||
{
|
||||
// should mark commits as integrated
|
||||
controller
|
||||
.fetch_from_target(project_id, None)
|
||||
.fetch_from_remotes(project_id, None)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
|
@ -17,7 +17,7 @@ async fn should_update_last_fetched() {
|
||||
assert!(before_fetch.last_fetched_ms.is_none());
|
||||
|
||||
let fetch = controller
|
||||
.fetch_from_target(project_id, None)
|
||||
.fetch_from_remotes(project_id, None)
|
||||
.await
|
||||
.unwrap();
|
||||
assert!(fetch.last_fetched_ms.is_some());
|
||||
@ -27,7 +27,7 @@ async fn should_update_last_fetched() {
|
||||
assert_eq!(fetch.last_fetched_ms, after_fetch.last_fetched_ms);
|
||||
|
||||
let second_fetch = controller
|
||||
.fetch_from_target(project_id, None)
|
||||
.fetch_from_remotes(project_id, None)
|
||||
.await
|
||||
.unwrap();
|
||||
assert!(second_fetch.last_fetched_ms.is_some());
|
@ -56,7 +56,7 @@ mod cherry_pick;
|
||||
mod create_commit;
|
||||
mod create_virtual_branch_from_branch;
|
||||
mod delete_virtual_branch;
|
||||
mod fetch_from_target;
|
||||
mod fetch_from_remotes;
|
||||
mod init;
|
||||
mod insert_blank_commit;
|
||||
mod move_commit_file;
|
||||
|
@ -200,7 +200,7 @@ fn main() {
|
||||
virtual_branches::commands::list_remote_branches,
|
||||
virtual_branches::commands::get_remote_branch_data,
|
||||
virtual_branches::commands::squash_branch_commit,
|
||||
virtual_branches::commands::fetch_from_target,
|
||||
virtual_branches::commands::fetch_from_remotes,
|
||||
virtual_branches::commands::move_commit,
|
||||
undo::list_snapshots,
|
||||
undo::restore_snapshot,
|
||||
|
@ -485,14 +485,14 @@ pub mod commands {
|
||||
|
||||
#[tauri::command(async)]
|
||||
#[instrument(skip(handle), err(Debug))]
|
||||
pub async fn fetch_from_target(
|
||||
pub async fn fetch_from_remotes(
|
||||
handle: tauri::AppHandle,
|
||||
project_id: ProjectId,
|
||||
action: Option<String>,
|
||||
) -> Result<BaseBranch, Error> {
|
||||
let base_branch = handle
|
||||
.state::<Controller>()
|
||||
.fetch_from_target(
|
||||
.fetch_from_remotes(
|
||||
&project_id,
|
||||
Some(action.unwrap_or_else(|| "unknown".to_string())),
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user