fix checkout

pull/4791/head
filip mertens 5 months ago
parent 82f70f8a84
commit d95bfe1797
  1. 6
      apps/remix-ide/src/app/files/dgitProvider.ts
  2. 2
      libs/remix-ui/git/src/components/buttons/sourceControlBase.tsx
  3. 8
      libs/remix-ui/git/src/components/panels/branches/branchdifferences.tsx
  4. 2
      libs/remix-ui/git/src/components/panels/branches/localbranchdetails.tsx
  5. 3
      libs/remix-ui/git/src/components/panels/branches/remotebranchedetails.tsx
  6. 5
      libs/remix-ui/git/src/components/panels/commands/pushpull.tsx
  7. 10
      libs/remix-ui/git/src/components/panels/remoteselect.tsx
  8. 26
      libs/remix-ui/git/src/lib/listeners.ts
  9. 20
      libs/remix-ui/workspace/src/lib/actions/workspace.ts

@ -19,7 +19,7 @@ import { Octokit, App } from "octokit"
import { OctokitResponse } from '@octokit/types'
import { Endpoints } from "@octokit/types"
import { IndexedDBStorage } from './filesystems/indexedDB'
import { GitHubUser, branch, commitChange, remote, pagedCommits, remoteCommitsInputType, cloneInputType, fetchInputType, pullInputType, pushInputType, currentBranchInput, branchInputType, addInput, rmInput, resolveRefInput, readBlobInput, repositoriesInput, commitInput, branchDifference, compareBranchesInput, initInput, userEmails } from '@remix-ui/git'
import { GitHubUser, branch, commitChange, remote, pagedCommits, remoteCommitsInputType, cloneInputType, fetchInputType, pullInputType, pushInputType, currentBranchInput, branchInputType, addInput, rmInput, resolveRefInput, readBlobInput, repositoriesInput, commitInput, branchDifference, compareBranchesInput, initInput, userEmails, checkoutInput } from '@remix-ui/git'
import { LibraryProfile, StatusEvents } from '@remixproject/plugin-utils'
import { ITerminal } from '@remixproject/plugin-api/src/lib/terminal'
@ -211,7 +211,7 @@ class DGitProvider extends Plugin {
}
}
async checkout(cmd, refresh = true) {
async checkout(cmd: checkoutInput): Promise<void> {
if ((Registry.getInstance().get('platform').api.isDesktop())) {
await this.call('isogit', 'checkout', cmd)
@ -243,7 +243,7 @@ class DGitProvider extends Plugin {
}
}
}
if (refresh) {
if (cmd.refresh) {
setTimeout(async () => {
await this.call('fileManager', 'refresh')
}, 1000)

@ -70,7 +70,7 @@ export const SourceControlBase = (props: SourceControlButtonsProps) => {
}, [])
useEffect(() => {
console.log('context', context.defaultRemote, context.currentBranch)
if (!props.branch) {
setBranch(context.currentBranch)
}

@ -13,18 +13,10 @@ export const BranchDifferences = (props: BrancheDetailsProps) => {
const { branch, showSummary } = props;
const context = React.useContext(gitPluginContext)
useEffect(() => {
console.log('GET BRANCH DIFF', branch)
}, [])
const getRemote = (): remote | null => {
return context.upstream ? context.upstream : context.defaultRemote ? context.defaultRemote : null
}
useEffect(() => {
console.log('BRANCH DIFF', context.branchDifferences)
}, [context.branchDifferences])
const commitsAhead = (remote: remote) => {
if (!remote) return [];
return context.branchDifferences[`${remote.name}/${branch.name}`]?.uniqueHeadCommits || [];

@ -25,7 +25,7 @@ export const LocalBranchDetails = (props: BrancheDetailsProps) => {
useEffect(() => {
if (activePanel === "0") {
console.log('GET BRANCH COMMITS', branch)
if (lastPageNumber === 0)
actions.getBranchCommits(branch, 1)
actions.getBranchDifferences(branch, null, context)

@ -24,7 +24,7 @@ export const RemoteBranchDetails = (props: BrancheDetailsProps) => {
useEffect(() => {
if (activePanel === "0") {
console.log('GET BRANCH COMMITS', branch)
if (lastPageNumber === 0)
actions.getBranchCommits(branch, 1)
}
@ -33,7 +33,6 @@ export const RemoteBranchDetails = (props: BrancheDetailsProps) => {
useEffect(() => {
let hasNextPage = false
let lastPageNumber = 0
console.log('BRANCH COMMITS', context.remoteBranchCommits)
context.remoteBranchCommits && Object.entries(context.remoteBranchCommits).map(([key, value]) => {
if (key == branch.name) {
value.map((page, index) => {

@ -91,8 +91,7 @@ export const PushPull = () => {
}
useEffect(() => {
console.log('context branches', context.branches)
// map context.repositories to options
const localBranches = context.branches && context.branches.length > 0 && context.branches
.filter(branch => !branch.remote)
.map(repo => {
@ -111,7 +110,7 @@ export const PushPull = () => {
}, [context.branches])
useEffect(() => {
console.log('context', context.remotes)
// map context.repositories to options
const options = context.remotes && context.remotes.length > 0 && context.remotes
.map(repo => {

@ -18,16 +18,6 @@ export const Remoteselect = (props: RemoteSelectProps) => {
const actions = React.useContext(gitActionsContext)
const [activePanel, setActivePanel] = useState<string>("");
useEffect(() => {
if (activePanel === "0") {
console.log('fetching', remote)
}
}, [activePanel])
useEffect(() => {
console.log('remote branches', context.branches)
}, [context.branches])
return (
<>
<Accordion activeKey={activePanel} defaultActiveKey="">

@ -49,13 +49,6 @@ export const setCallBacks = (viewPlugin: Plugin, gitDispatcher: React.Dispatch<g
})
});
plugin.on('dgitApi', 'checkout', async () => {
//await synTimerStart();
})
plugin.on('dgitApi', 'branch', async () => {
//await synTimerStart();
})
plugin.on("fileManager", "fileAdded", async (e) => {
loadFileQueue.enqueue(async () => {
loadFiles()
@ -99,7 +92,17 @@ export const setCallBacks = (viewPlugin: Plugin, gitDispatcher: React.Dispatch<g
});
plugin.on('dgitApi', 'checkout', async () => {
console.log('checkout callback')
loadFileQueue.enqueue(async () => {
gitlog()
})
loadFileQueue.enqueue(async () => {
getBranches()
})
gitDispatch(setLog({
message: "Checkout",
type: "success"
}))
})
plugin.on('dgitApi', 'init', async () => {
loadFileQueue.enqueue(async () => {
@ -126,6 +129,13 @@ export const setCallBacks = (viewPlugin: Plugin, gitDispatcher: React.Dispatch<g
}))
})
plugin.on('dgitApi', 'branch', async () => {
console.log('branch callback')
loadFileQueue.enqueue(async () => {
gitlog()
})
loadFileQueue.enqueue(async () => {
getBranches()
})
gitDispatch(setLog({
message: "Created Branch",
type: "success"

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

Loading…
Cancel
Save