|
|
@ -779,6 +779,7 @@ const refreshBranches = async () => { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
export const switchBranch = async (branch: branch) => { |
|
|
|
export const switchBranch = async (branch: branch) => { |
|
|
|
|
|
|
|
console.log('switch', branch) |
|
|
|
await plugin.call('fileManager', 'closeAllFiles') |
|
|
|
await plugin.call('fileManager', 'closeAllFiles') |
|
|
|
const localChanges = await hasLocalChanges() |
|
|
|
const localChanges = await hasLocalChanges() |
|
|
|
|
|
|
|
|
|
|
@ -793,8 +794,8 @@ export const switchBranch = async (branch: branch) => { |
|
|
|
okLabel: 'Force Checkout', |
|
|
|
okLabel: 'Force Checkout', |
|
|
|
okFn: async () => { |
|
|
|
okFn: async () => { |
|
|
|
dispatch(cloneRepositoryRequest()) |
|
|
|
dispatch(cloneRepositoryRequest()) |
|
|
|
plugin |
|
|
|
dgitPlugin |
|
|
|
.call('dgitApi', 'checkout', { ref: branch, force: true }, false) |
|
|
|
.call('dgitApi', 'checkout', { ref: branch.name, force: true, refresh: false }) |
|
|
|
.then(async () => { |
|
|
|
.then(async () => { |
|
|
|
await fetchWorkspaceDirectory(ROOT_PATH) |
|
|
|
await fetchWorkspaceDirectory(ROOT_PATH) |
|
|
|
dispatch(setCurrentWorkspaceCurrentBranch(branch)) |
|
|
|
dispatch(setCurrentWorkspaceCurrentBranch(branch)) |
|
|
@ -811,8 +812,8 @@ export const switchBranch = async (branch: branch) => { |
|
|
|
plugin.call('notification', 'modal', cloneModal) |
|
|
|
plugin.call('notification', 'modal', cloneModal) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
dispatch(cloneRepositoryRequest()) |
|
|
|
dispatch(cloneRepositoryRequest()) |
|
|
|
plugin |
|
|
|
dgitPlugin |
|
|
|
.call('dgitApi', 'checkout', { ref: branch, force: true }, false) |
|
|
|
.call('dgitApi', 'checkout', { ref: branch.name, force: true, refresh: false }) |
|
|
|
.then(async () => { |
|
|
|
.then(async () => { |
|
|
|
await fetchWorkspaceDirectory(ROOT_PATH) |
|
|
|
await fetchWorkspaceDirectory(ROOT_PATH) |
|
|
|
dispatch(setCurrentWorkspaceCurrentBranch(branch)) |
|
|
|
dispatch(setCurrentWorkspaceCurrentBranch(branch)) |
|
|
@ -898,9 +899,9 @@ export const checkoutRemoteBranch = async (branch: branch) => { |
|
|
|
okLabel: 'Force Checkout', |
|
|
|
okLabel: 'Force Checkout', |
|
|
|
okFn: async () => { |
|
|
|
okFn: async () => { |
|
|
|
dispatch(cloneRepositoryRequest()) |
|
|
|
dispatch(cloneRepositoryRequest()) |
|
|
|
plugin |
|
|
|
dgitPlugin |
|
|
|
.call('dgitApi', 'checkout', { |
|
|
|
.call('dgitApi', 'checkout', { |
|
|
|
ref: branch, |
|
|
|
ref: branch.name, |
|
|
|
force: true, |
|
|
|
force: true, |
|
|
|
}) |
|
|
|
}) |
|
|
|
.then(async () => { |
|
|
|
.then(async () => { |
|
|
@ -924,11 +925,12 @@ export const checkoutRemoteBranch = async (branch: branch) => { |
|
|
|
plugin.call('notification', 'modal', cloneModal) |
|
|
|
plugin.call('notification', 'modal', cloneModal) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
dispatch(cloneRepositoryRequest()) |
|
|
|
dispatch(cloneRepositoryRequest()) |
|
|
|
plugin |
|
|
|
dgitPlugin |
|
|
|
.call('dgitApi', 'checkout',{ |
|
|
|
.call('dgitApi', 'checkout',{ |
|
|
|
ref: branch, |
|
|
|
ref: branch.name, |
|
|
|
force: true, |
|
|
|
force: true, |
|
|
|
}, false) |
|
|
|
refresh: false, |
|
|
|
|
|
|
|
}) |
|
|
|
.then(async () => { |
|
|
|
.then(async () => { |
|
|
|
await fetchWorkspaceDirectory(ROOT_PATH) |
|
|
|
await fetchWorkspaceDirectory(ROOT_PATH) |
|
|
|
dispatch(setCurrentWorkspaceCurrentBranch(branch)) |
|
|
|
dispatch(setCurrentWorkspaceCurrentBranch(branch)) |
|
|
|