pull/4791/head
filip mertens 5 months ago
parent d95bfe1797
commit 9c850f7bbe
  1. 14
      apps/remix-ide-e2e/src/tests/plugin_api.ts
  2. 1
      apps/remix-ide/src/app/udapp/run-tab.js
  3. 2
      libs/remix-ui/editor/src/lib/remix-ui-editor.tsx
  4. 8
      libs/remix-ui/git/src/components/buttons/commitmessage.tsx
  5. 2
      libs/remix-ui/git/src/components/buttons/sourceControlBase.tsx
  6. 4
      libs/remix-ui/git/src/components/buttons/sourcecontrolbuttons.tsx
  7. 2
      libs/remix-ui/git/src/components/github/devicecode.tsx
  8. 2
      libs/remix-ui/git/src/components/github/repositoryselect.tsx
  9. 4
      libs/remix-ui/git/src/components/gitui.tsx
  10. 4
      libs/remix-ui/git/src/components/panels/branches.tsx
  11. 1
      libs/remix-ui/git/src/components/panels/branches/localbranchdetails.tsx
  12. 2
      libs/remix-ui/git/src/components/panels/branches/remotebranchedetails.tsx
  13. 1
      libs/remix-ui/git/src/components/panels/commands/merge.tsx
  14. 1
      libs/remix-ui/git/src/components/panels/commands/pushpull.tsx
  15. 1
      libs/remix-ui/git/src/components/panels/commits.tsx
  16. 2
      libs/remix-ui/git/src/components/panels/commits/commitdetails.tsx
  17. 2
      libs/remix-ui/git/src/components/panels/commits/commitdetailsitem.tsx
  18. 1
      libs/remix-ui/git/src/components/panels/githubcredentials.tsx
  19. 4
      libs/remix-ui/git/src/components/panels/remotes.tsx
  20. 6
      libs/remix-ui/git/src/components/panels/remotesimport.tsx
  21. 4
      libs/remix-ui/git/src/components/panels/sourcecontrol/sourcecontrolitem.tsx
  22. 8
      libs/remix-ui/git/src/components/panels/sourcontrol.tsx
  23. 24
      libs/remix-ui/git/src/lib/gitactions.ts
  24. 8
      libs/remix-ui/git/src/lib/listeners.ts
  25. 1
      libs/remix-ui/git/src/lib/pluginActions.ts
  26. 1
      libs/remix-ui/git/src/state/gitreducer.tsx

@ -319,24 +319,24 @@ module.exports = {
// DGIT // DGIT
'Should have changes on new workspace #group3': async function (browser: NightwatchBrowser) { 'Should have changes on new workspace #group3': async function (browser: NightwatchBrowser) {
await clickAndCheckLog(browser, 'filePanel:createWorkspace', null, null, 'dgit') await clickAndCheckLog(browser, 'filePanel:createWorkspace', null, null, 'dgit')
await clickAndCheckLog(browser, 'dGitProvider:status', [[".prettierrc.json",0,2,0], ["README.txt",0,2,0],["contracts/1_Storage.sol",0,2,0],["contracts/2_Owner.sol",0,2,0],["contracts/3_Ballot.sol",0,2,0],["scripts/deploy_with_ethers.ts",0,2,0],["scripts/deploy_with_web3.ts",0,2,0],["scripts/ethers-lib.ts",0,2,0],["scripts/web3-lib.ts",0,2,0],["tests/Ballot_test.sol",0,2,0],["tests/storage.test.js",0,2,0]], null, null) await clickAndCheckLog(browser, 'dgitApi:status', [[".prettierrc.json",0,2,0], ["README.txt",0,2,0],["contracts/1_Storage.sol",0,2,0],["contracts/2_Owner.sol",0,2,0],["contracts/3_Ballot.sol",0,2,0],["scripts/deploy_with_ethers.ts",0,2,0],["scripts/deploy_with_web3.ts",0,2,0],["scripts/ethers-lib.ts",0,2,0],["scripts/web3-lib.ts",0,2,0],["tests/Ballot_test.sol",0,2,0],["tests/storage.test.js",0,2,0]], null, null)
}, },
'Should stage contract #group3': async function (browser: NightwatchBrowser) { 'Should stage contract #group3': async function (browser: NightwatchBrowser) {
await clickAndCheckLog(browser, 'dGitProvider:add', null, null, { await clickAndCheckLog(browser, 'dgitApi:add', null, null, {
filepath: 'contracts/1_Storage.sol' filepath: 'contracts/1_Storage.sol'
}) })
await clickAndCheckLog(browser, 'dGitProvider:status', [[".prettierrc.json",0,2,0],["README.txt",0,2,0],["contracts/1_Storage.sol",0,2,2],["contracts/2_Owner.sol",0,2,0],["contracts/3_Ballot.sol",0,2,0],["scripts/deploy_with_ethers.ts",0,2,0],["scripts/deploy_with_web3.ts",0,2,0],["scripts/ethers-lib.ts",0,2,0],["scripts/web3-lib.ts",0,2,0],["tests/Ballot_test.sol",0,2,0],["tests/storage.test.js",0,2,0]], null, null) await clickAndCheckLog(browser, 'dgitApi:status', [[".prettierrc.json",0,2,0],["README.txt",0,2,0],["contracts/1_Storage.sol",0,2,2],["contracts/2_Owner.sol",0,2,0],["contracts/3_Ballot.sol",0,2,0],["scripts/deploy_with_ethers.ts",0,2,0],["scripts/deploy_with_web3.ts",0,2,0],["scripts/ethers-lib.ts",0,2,0],["scripts/web3-lib.ts",0,2,0],["tests/Ballot_test.sol",0,2,0],["tests/storage.test.js",0,2,0]], null, null)
}, },
'Should commit changes #group3': async function (browser: NightwatchBrowser) { 'Should commit changes #group3': async function (browser: NightwatchBrowser) {
await clickAndCheckLog(browser, 'dGitProvider:commit', null, null, { author: { name: 'Remix', email: 'Remix' }, message: 'commit-message' }) await clickAndCheckLog(browser, 'dgitApi:commit', null, null, { author: { name: 'Remix', email: 'Remix' }, message: 'commit-message' })
await clickAndCheckLog(browser, 'dGitProvider:log', 'commit-message', null, null) await clickAndCheckLog(browser, 'dgitApi:log', 'commit-message', null, null)
}, },
'Should have git log #group3': async function (browser: NightwatchBrowser) { 'Should have git log #group3': async function (browser: NightwatchBrowser) {
await clickAndCheckLog(browser, 'dGitProvider:log', 'commit-message', null, null) await clickAndCheckLog(browser, 'dgitApi:log', 'commit-message', null, null)
}, },
'Should have branches #group3': async function (browser: NightwatchBrowser) { 'Should have branches #group3': async function (browser: NightwatchBrowser) {
await clickAndCheckLog(browser, 'dGitProvider:branches', [{ name: 'main' }], null, null) await clickAndCheckLog(browser, 'dgitApi:branches', [{ name: 'main' }], null, null)
}, },
// resolver // resolver
'Should resolve url #group4': async function (browser: NightwatchBrowser) { 'Should resolve url #group4': async function (browser: NightwatchBrowser) {

@ -161,7 +161,6 @@ export class RunTab extends ViewPlugin {
await addProvider(position, name, displayName, true, false, false) await addProvider(position, name, displayName, true, false, false)
} }
const registerInjectedProvider = async (event) => { const registerInjectedProvider = async (event) => {
console.log('registerInjectedProvider', event)
const name = 'injected-' + event.detail.info.name const name = 'injected-' + event.detail.info.name
const displayName = 'Injected Provider - ' + event.detail.info.name const displayName = 'Injected Provider - ' + event.detail.info.name
await this.engine.register([new InjectedProviderDefault(event.detail.provider, name)]) await this.engine.register([new InjectedProviderDefault(event.detail.provider, name)])

@ -644,13 +644,11 @@ export const EditorUI = (props: EditorUIProps) => {
} }
function handleDiffEditorDidMount(editor: any) { function handleDiffEditorDidMount(editor: any) {
console.log('diff editor mounted')
diffEditorRef.current = editor diffEditorRef.current = editor
setReducerListener() setReducerListener()
} }
function handleEditorDidMount(editor) { function handleEditorDidMount(editor) {
console.log('editor mounted')
editorRef.current = editor editorRef.current = editor
defineAndSetTheme(monacoRef.current) defineAndSetTheme(monacoRef.current)
setReducerListener() setReducerListener()

@ -24,12 +24,6 @@ export const CommitMessage = () => {
setMessage({ value: e.currentTarget.value }) setMessage({ value: e.currentTarget.value })
} }
useEffect(() => {
if (context.fileStatusResult) {
console.log(context.staged.length + ' staged')
}
}, [context.fileStatusResult])
const commit = async() => { const commit = async() => {
if (context.staged.length === 0 && context.allchangesnotstaged.length == 0) return if (context.staged.length === 0 && context.allchangesnotstaged.length == 0) return
if (context.staged.length === 0) if (context.staged.length === 0)
@ -92,7 +86,7 @@ export const CommitMessage = () => {
} }
const setButtonStateValues = () => { const setButtonStateValues = () => {
console.log('setButtonStateValues', context)
if (!commitNotAllowed() || context.allchangesnotstaged.length > 0 || context.staged.length > 0){ if (!commitNotAllowed() || context.allchangesnotstaged.length > 0 || context.staged.length > 0){
if (context.allchangesnotstaged.length == 0 && context.staged.length == 0 && message.value === "" && publishEnabled()){ if (context.allchangesnotstaged.length == 0 && context.staged.length == 0 && message.value === "" && publishEnabled()){
setButtonState(buttonStateValues.PublishBranch) setButtonState(buttonStateValues.PublishBranch)

@ -32,7 +32,7 @@ export const SourceControlBase = (props: SourceControlButtonsProps) => {
const [commitsBehind, setCommitsBehind] = useState<ReadCommitResult[]>([]) const [commitsBehind, setCommitsBehind] = useState<ReadCommitResult[]>([])
useEffect(() => { useEffect(() => {
//console.log('BRANCH DIFF SourceControlButtons',branch, remote, context.branchDifferences, context.currentBranch)
setDefaultRemote() setDefaultRemote()
if (remote && branch && context.branchDifferences && context.branchDifferences[`${remote.name}/${branch.name}`]) { if (remote && branch && context.branchDifferences && context.branchDifferences[`${remote.name}/${branch.name}`]) {
setCommitsAhead(context.branchDifferences[`${remote.name}/${branch.name}`]?.uniqueHeadCommits) setCommitsAhead(context.branchDifferences[`${remote.name}/${branch.name}`]?.uniqueHeadCommits)

@ -16,10 +16,6 @@ export const SourceControlButtons = () => {
const [branch, setBranch] = useState<branch>(syncState.branch) const [branch, setBranch] = useState<branch>(syncState.branch)
const [remote, setRemote] = useState<remote>(syncState.remote) const [remote, setRemote] = useState<remote>(syncState.remote)
useEffect(() => {
console.log('SC BUTTONS', branch, remote)
}, [])
const getRemote = () => { const getRemote = () => {
return remote ? remote : context.upstream ? context.upstream : context.defaultRemote ? context.defaultRemote : null return remote ? remote : context.upstream ? context.upstream : context.defaultRemote ? context.defaultRemote : null
} }

@ -31,7 +31,6 @@ export const GetDeviceCode = () => {
// convert response to json // convert response to json
const githubrespone = await response.data; const githubrespone = await response.data;
console.log('json', githubrespone)
setGitHubResponse(githubrespone) setGitHubResponse(githubrespone)
} }
@ -54,7 +53,6 @@ export const GetDeviceCode = () => {
// convert response to json // convert response to json
const response = await accestokenresponse.data; const response = await accestokenresponse.data;
console.log('json2', response)
if (response.error) { if (response.error) {

@ -57,7 +57,7 @@ const RepositorySelect = (props: RepositorySelectProps) => {
setShow(true) setShow(true)
setLoading(true) setLoading(true)
setRepoOptions([]) setRepoOptions([])
console.log(await actions.repositories()) await actions.repositories()
} catch (e) { } catch (e) {
// do nothing // do nothing
} }

@ -66,7 +66,7 @@ export const GitUI = (props: IGitUi) => {
setCallBacks(plugin, gitDispatch, loaderDispatch) setCallBacks(plugin, gitDispatch, loaderDispatch)
setPlugin(plugin, gitDispatch, loaderDispatch) setPlugin(plugin, gitDispatch, loaderDispatch)
loaderDispatch({ type: 'plugin', payload: true }) loaderDispatch({ type: 'plugin', payload: true })
//console.log(props)
}, [appLoaded]) }, [appLoaded])
useEffect(() => { useEffect(() => {
@ -76,7 +76,7 @@ export const GitUI = (props: IGitUi) => {
const username = await plugin.call('settings', 'get', 'settings/github-user-name') const username = await plugin.call('settings', 'get', 'settings/github-user-name')
const email = await plugin.call('settings', 'get', 'settings/github-email') const email = await plugin.call('settings', 'get', 'settings/github-email')
const token = await plugin.call('settings', 'get', 'settings/gist-access-token') const token = await plugin.call('settings', 'get', 'settings/gist-access-token')
//console.log('gitState', gitState, username, email, token)
setSetup(!(username && email)) setSetup(!(username && email))
} }
checkconfig() checkconfig()

@ -24,10 +24,6 @@ export const Branches = () => {
} }
}; };
useEffect(() => {
console.log("branches", context.branches)
}, [context.branches])
return ( return (
<> <>
<div className="pt-1"> <div className="pt-1">

@ -40,7 +40,6 @@ export const LocalBranchDetails = (props: BrancheDetailsProps) => {
} }
const loadNextPage = () => { const loadNextPage = () => {
console.log('LOAD NEXT PAGE', lastPageNumber + 1)
actions.getBranchCommits(branch, lastPageNumber + 1) actions.getBranchCommits(branch, lastPageNumber + 1)
} }

@ -54,7 +54,6 @@ export const RemoteBranchDetails = (props: BrancheDetailsProps) => {
} }
const loadNextPage = () => { const loadNextPage = () => {
console.log('LOAD NEXT PAGE', lastPageNumber + 1)
actions.getBranchCommits(branch, lastPageNumber + 1) actions.getBranchCommits(branch, lastPageNumber + 1)
} }
@ -70,7 +69,6 @@ export const RemoteBranchDetails = (props: BrancheDetailsProps) => {
const getCommitChanges = async (commit: ReadCommitResult) => { const getCommitChanges = async (commit: ReadCommitResult) => {
const changes = await actions.getCommitChanges(commit.oid, commit.commit.parent[0], branch, branch.remote) const changes = await actions.getCommitChanges(commit.oid, commit.commit.parent[0], branch, branch.remote)
console.log('CHANGES', changes)
if (!changes) { if (!changes) {
// try to fetch the data // try to fetch the data
//await actions.fetch(branch.remote.name, branch.name,null,20, true, false, true) //await actions.fetch(branch.remote.name, branch.name,null,20, true, false, true)

@ -16,7 +16,6 @@ export const Merge = () => {
}, [context.currentBranch]) }, [context.currentBranch])
const onLocalBranchChange = (value: any) => { const onLocalBranchChange = (value: any) => {
console.log('onLocalBranchChange', value)
setLocalBranch(value) setLocalBranch(value)
} }

@ -47,7 +47,6 @@ export const PushPull = () => {
} }
const push = async () => { const push = async () => {
console.log('PUSH', context.upstream, localBranch, remoteBranch, force)
await actions.push({ await actions.push({
remote: context.upstream, remote: context.upstream,
ref: { ref: {

@ -24,7 +24,6 @@ export const Commits = () => {
}; };
const loadNextPage = () => { const loadNextPage = () => {
console.log('LOAD NEXT PAGE', context.commits.length)
//actions.fetch(null, context.currentBranch.name, null, 5, true, true) //actions.fetch(null, context.currentBranch.name, null, 5, true, true)
actions.fetch({ actions.fetch({
remote: null, remote: null,

@ -22,7 +22,6 @@ export const CommitDetails = (props: CommitDetailsProps) => {
useEffect(() => { useEffect(() => {
if (activePanel === "0") { if (activePanel === "0") {
console.log(context)
getCommitChanges(commit) getCommitChanges(commit)
} }
}, [activePanel]) }, [activePanel])
@ -41,7 +40,6 @@ export const CommitDetails = (props: CommitDetailsProps) => {
} }
const openFileOnRemote = (file: string, hash: string) => { const openFileOnRemote = (file: string, hash: string) => {
console.log("open file on remote", file, hash, getRemote() ? `${getRemote().name}/${branch.name}/commit/${hash}/${file}` : "")
if (!getRemote()) return if (!getRemote()) return
window.open(`${getRemote() ? `${getRemote().url}/blob/${hash}/${file}` : ""}`, "_blank") window.open(`${getRemote() ? `${getRemote().url}/blob/${hash}/${file}` : ""}`, "_blank")
} }

@ -17,9 +17,7 @@ export const CommitDetailsItems = (props: CCommitDetailsItemsProps) => {
const pluginActions = React.useContext(pluginActionsContext) const pluginActions = React.useContext(pluginActionsContext)
const openChanges = async (change: commitChange) => { const openChanges = async (change: commitChange) => {
console.log("open changes", change);
await actions.diff(change) await actions.diff(change)
console.log("open changes", change);
await pluginActions.openDiff(change) await pluginActions.openDiff(change)
} }

@ -43,7 +43,6 @@ export const GitHubCredentials = () => {
async function refresh() { async function refresh() {
const credentials = await pluginactions.getGitHubCredentialsFromLocalStorage() const credentials = await pluginactions.getGitHubCredentialsFromLocalStorage()
if (!credentials) return if (!credentials) return
console.log('credentials', credentials)
setGithubToken(credentials.token || '') setGithubToken(credentials.token || '')
setGithubUsername(credentials.username || '') setGithubUsername(credentials.username || '')
setGithubEmail(credentials.email || '') setGithubEmail(credentials.email || '')

@ -24,10 +24,6 @@ export const Remotes = () => {
}) })
} }
useEffect(() => {
console.log('SHOW REMOTES', context.remotes)
}, [context.remotes])
return ( return (
<> <>

@ -37,7 +37,7 @@ export const RemotesImport = () => {
setShow(true) setShow(true)
setLoading(true) setLoading(true)
setRepoOptions([]) setRepoOptions([])
console.log(await actions.repositories()) await actions.repositories()
} catch (e) { } catch (e) {
// do nothing // do nothing
} }
@ -47,10 +47,6 @@ export const RemotesImport = () => {
setRepo(repo) setRepo(repo)
} }
useEffect(() => {
console.log('OTIONS', repoOtions)
},[repoOtions])
const addRemote = async () => { const addRemote = async () => {
try { try {
actions.addRemote({ actions.addRemote({

@ -18,8 +18,6 @@ export const SourceControlItem = (props: SourceControlItemProps) => {
const pluginActions = React.useContext(pluginActionsContext) const pluginActions = React.useContext(pluginActionsContext)
async function fileClick(file: fileStatusResult) { async function fileClick(file: fileStatusResult) {
console.log(file)
//let status = fileservice.getFileStatusForFile(file.filename || "");
if (file.statusNames && file.statusNames.indexOf("modified") !== -1) { if (file.statusNames && file.statusNames.indexOf("modified") !== -1) {
const headHash = await actions.resolveRef("HEAD") const headHash = await actions.resolveRef("HEAD")
const change: commitChange = { const change: commitChange = {
@ -31,8 +29,6 @@ export const SourceControlItem = (props: SourceControlItemProps) => {
} }
await actions.diff(change) await actions.diff(change)
await pluginActions.openDiff(change) await pluginActions.openDiff(change)
console.log("diff", change)
} else { } else {
await pluginActions.openFile(file.filename) await pluginActions.openFile(file.filename)
//await client.call('fileManager', 'open', file.filename) //await client.call('fileManager', 'open', file.filename)

@ -12,21 +12,13 @@ export const SourceControl = () => {
useEffect(() => { useEffect(() => {
if (context.fileStatusResult) { if (context.fileStatusResult) {
console.log(context)
const total = context.allchangesnotstaged.length const total = context.allchangesnotstaged.length
const badges = total + context.staged.length const badges = total + context.staged.length
pluginactions.statusChanged(badges) pluginactions.statusChanged(badges)
//console.log("allchangesnotstaged", context.allchangesnotstaged, context.fileStatusResult)
setShow((context.deleted.length > 0 || context.staged.length > 0 || context.untracked.length > 0 || context.modified.length > 0)) setShow((context.deleted.length > 0 || context.staged.length > 0 || context.untracked.length > 0 || context.modified.length > 0))
} }
}, [context.fileStatusResult, context.modified, context.allchangesnotstaged, context.untracked, context.deleted]) }, [context.fileStatusResult, context.modified, context.allchangesnotstaged, context.untracked, context.deleted])
useEffect(() => {
if (context.commits) {
console.log("SC commits", context.localCommitCount, context.currentBranch)
}
}, [context.localCommitCount, context.currentBranch])
function RenderGroups() { function RenderGroups() {
const groups: sourceControlGroup[] = [{ name: 'Staged', group: context.staged }, { name: 'Changes', group: context.allchangesnotstaged }] const groups: sourceControlGroup[] = [{ name: 'Staged', group: context.staged }, { name: 'Changes', group: context.allchangesnotstaged }]
return (<> return (<>

@ -1,18 +1,12 @@
import { ViewPlugin } from "@remixproject/engine-web";
import { ReadBlobResult, ReadCommitResult } from "isomorphic-git"; import { ReadBlobResult, ReadCommitResult } from "isomorphic-git";
import React from "react"; import React from "react";
import { fileStatus, fileStatusMerge, setRemoteBranchCommits, resetRemoteBranchCommits, setBranches, setCanCommit, setCommitChanges, setCommits, setCurrentBranch, setGitHubUser, setLoading, setRemoteBranches, setRemotes, setRepos, setUpstream, setLocalBranchCommits, setBranchDifferences, setRemoteAsDefault, setScopes, setLog, clearLog, setUserEmails } from "../state/gitpayload"; import { fileStatus, fileStatusMerge, setRemoteBranchCommits, resetRemoteBranchCommits, setBranches, setCanCommit, setCommitChanges, setCommits, setCurrentBranch, setGitHubUser, setLoading, setRemoteBranches, setRemotes, setRepos, setUpstream, setLocalBranchCommits, setBranchDifferences, setRemoteAsDefault, setScopes, setLog, clearLog, setUserEmails } from "../state/gitpayload";
import { GitHubUser, branch, commitChange, gitActionDispatch, statusMatrixType, gitState, branchDifference, remote, gitLog, fileStatusResult, customGitApi, IGitApi, cloneInputType, fetchInputType, pullInputType, pushInputType, checkoutInput, rmInput, addInput, repository, userEmails } from '../types'; import { GitHubUser, branch, commitChange, gitActionDispatch, statusMatrixType, gitState, branchDifference, remote, gitLog, fileStatusResult, customGitApi, IGitApi, cloneInputType, fetchInputType, pullInputType, pushInputType, checkoutInput, rmInput, addInput, repository, userEmails } from '../types';
import { removeSlash } from "../utils"; import { removeSlash } from "../utils";
import { disableCallBacks, enableCallBacks } from "./listeners"; import { disableCallBacks, enableCallBacks } from "./listeners";
import { AlertModal, ModalTypes } from "@remix-ui/app"; import { ModalTypes } from "@remix-ui/app";
import { gitActions, gitActionsContext } from "../state/context";
import { gitPluginContext } from "../components/gitui";
import { setFileDecorators } from "./pluginActions"; import { setFileDecorators } from "./pluginActions";
import { IDgitSystem, IRemixApi, RemixApi } from "@remixproject/plugin-api";
import { Plugin } from "@remixproject/engine"; import { Plugin } from "@remixproject/engine";
import { AnyMxRecord } from "dns";
import { StatusEvents } from "@remixproject/plugin-utils";
import { CustomRemixApi } from "@remix-api"; import { CustomRemixApi } from "@remix-api";
export const fileStatuses = [ export const fileStatuses = [
@ -73,12 +67,10 @@ export const getFileStatusMatrix = async (filepaths: string[]) => {
fileStatusResult.map((m) => { fileStatusResult.map((m) => {
statusmatrix.map((sm) => { statusmatrix.map((sm) => {
if (JSON.stringify(sm.status) === JSON.stringify(m.status)) { if (JSON.stringify(sm.status) === JSON.stringify(m.status)) {
//Utils.log(m, sm);
m.statusNames = sm.matrix; m.statusNames = sm.matrix;
} }
}); });
}); });
//console.log(fileStatusResult);
if (!filepaths) { if (!filepaths) {
dispatch(fileStatus(fileStatusResult)) dispatch(fileStatus(fileStatusResult))
} else { } else {
@ -95,7 +87,7 @@ export const getCommits = async () => {
"log", "log",
{ ref: "HEAD" } { ref: "HEAD" }
); );
console.log('commits :>>', commits)
return commits; return commits;
} catch (e) { } catch (e) {
return []; return [];
@ -198,7 +190,6 @@ export const commit = async (message: string = "") => {
export const addall = async (files: fileStatusResult[]) => { export const addall = async (files: fileStatusResult[]) => {
try { try {
console.log('addall', files.map(f => removeSlash(f.filename)))
const filesToAdd = files.map(f => removeSlash(f.filename)) const filesToAdd = files.map(f => removeSlash(f.filename))
try { try {
add({ filepath: filesToAdd }) add({ filepath: filesToAdd })
@ -379,7 +370,6 @@ const parseError = async (e: any) => {
cancelLabel: 'Close', cancelLabel: 'Close',
type: ModalTypes.confirm type: ModalTypes.confirm
}) })
console.log(result)
} }
// if message contains 404 Not Found, show repo not found // if message contains 404 Not Found, show repo not found
else if (e.message.includes('404')) { else if (e.message.includes('404')) {
@ -648,8 +638,6 @@ export const diff = async (commitChange: commitChange) => {
} }
export const getCommitChanges = async (oid1: string, oid2: string, branch?: branch, remote?: remote) => { export const getCommitChanges = async (oid1: string, oid2: string, branch?: branch, remote?: remote) => {
console.log(oid1, oid2, branch, remote)
try { try {
let log let log
try { try {
@ -700,13 +688,11 @@ async function getRepoDetails(url: string) {
export const fetchBranch = async (branch: branch, page: number) => { export const fetchBranch = async (branch: branch, page: number) => {
if (!branch.remote || !branch.remote.url) return if (!branch.remote || !branch.remote.url) return
const token = await tokenWarning(); const token = await tokenWarning();
console.log('fetch', branch)
if (page == 1) { if (page == 1) {
dispatch(resetRemoteBranchCommits({ branch })) dispatch(resetRemoteBranchCommits({ branch }))
} }
const { owner, repo } = await getRepoDetails(branch.remote.url); const { owner, repo } = await getRepoDetails(branch.remote.url);
const rc = await plugin.call('dgitApi', 'remotecommits', { token, owner: owner, repo: repo, branch: branch.name, length, page }); const rc = await plugin.call('dgitApi', 'remotecommits', { token, owner: owner, repo: repo, branch: branch.name, length, page });
console.log(rc, 'remote commits from octokit')
dispatch(setRemoteBranchCommits({ branch, commits: rc })) dispatch(setRemoteBranchCommits({ branch, commits: rc }))
return return
} }
@ -724,7 +710,7 @@ export const getBranchDifferences = async (branch: branch, remote: remote, state
} }
if (!remote) return if (!remote) return
try { try {
console.log('compare', branch, remote)
const branchDifference: branchDifference = await plugin.call('dgitApi', 'compareBranches', { const branchDifference: branchDifference = await plugin.call('dgitApi', 'compareBranches', {
branch, branch,
remote remote
@ -737,7 +723,7 @@ export const getBranchDifferences = async (branch: branch, remote: remote, state
branchDifference: branchDifference branchDifference: branchDifference
})) }))
} catch (e) { } catch (e) {
console.log(e) // do nothing
} }
} }
@ -745,12 +731,10 @@ export const getBranchCommits = async (branch: branch, page: number) => {
dispatch(setLoading(true)) dispatch(setLoading(true))
await disableCallBacks() await disableCallBacks()
try { try {
console.log(branch)
if (!branch.remote) { if (!branch.remote) {
const commits: ReadCommitResult[] = await plugin.call('dgitApi', 'log', { const commits: ReadCommitResult[] = await plugin.call('dgitApi', 'log', {
ref: branch.name, ref: branch.name,
}) })
console.log(commits)
dispatch(setLocalBranchCommits({ branch, commits })) dispatch(setLocalBranchCommits({ branch, commits }))
} else { } else {
await fetchBranch(branch, page) await fetchBranch(branch, page)

@ -43,7 +43,6 @@ export const setCallBacks = (viewPlugin: Plugin, gitDispatcher: React.Dispatch<g
setPlugin(viewPlugin, gitDispatcher) setPlugin(viewPlugin, gitDispatcher)
plugin.on("fileManager", "fileSaved", async (file: string) => { plugin.on("fileManager", "fileSaved", async (file: string) => {
//console.log(file)
loadFileQueue.enqueue(async () => { loadFileQueue.enqueue(async () => {
loadFiles() loadFiles()
}) })
@ -60,7 +59,6 @@ export const setCallBacks = (viewPlugin: Plugin, gitDispatcher: React.Dispatch<g
}); });
plugin.on("fileManager", "currentFileChanged", async (e) => { plugin.on("fileManager", "currentFileChanged", async (e) => {
//console.log('current file change', e)
//await synTimerStart(); //await synTimerStart();
}); });
@ -92,7 +90,6 @@ export const setCallBacks = (viewPlugin: Plugin, gitDispatcher: React.Dispatch<g
}); });
plugin.on('dgitApi', 'checkout', async () => { plugin.on('dgitApi', 'checkout', async () => {
console.log('checkout callback')
loadFileQueue.enqueue(async () => { loadFileQueue.enqueue(async () => {
gitlog() gitlog()
}) })
@ -129,7 +126,6 @@ export const setCallBacks = (viewPlugin: Plugin, gitDispatcher: React.Dispatch<g
})) }))
}) })
plugin.on('dgitApi', 'branch', async () => { plugin.on('dgitApi', 'branch', async () => {
console.log('branch callback')
loadFileQueue.enqueue(async () => { loadFileQueue.enqueue(async () => {
gitlog() gitlog()
}) })
@ -158,11 +154,9 @@ export const setCallBacks = (viewPlugin: Plugin, gitDispatcher: React.Dispatch<g
}) })
plugin.on('config', 'configChanged', async () => { plugin.on('config', 'configChanged', async () => {
//console.log('config changed')
await getGitConfig() await getGitConfig()
}) })
plugin.on('settings', 'configChanged', async () => { plugin.on('settings', 'configChanged', async () => {
//console.log('settings changed')
await getGitConfig() await getGitConfig()
}) })
@ -183,7 +177,6 @@ export const getGitConfig = async () => {
export const loadFiles = async (filepaths: string[] = null) => { export const loadFiles = async (filepaths: string[] = null) => {
try { try {
const branch = await plugin.call('dgitApi', "currentbranch") const branch = await plugin.call('dgitApi', "currentbranch")
//console.log('load files', branch)
if (branch) { if (branch) {
await getFileStatusMatrix(filepaths); await getFileStatusMatrix(filepaths);
} else { } else {
@ -191,7 +184,6 @@ export const loadFiles = async (filepaths: string[] = null) => {
statusChanged(0) statusChanged(0)
} }
} catch (e) { } catch (e) {
// TODO: handle error
console.error(e); console.error(e);
} }
} }

@ -29,7 +29,6 @@ export const openFile = async (path: string) => {
} }
export const openDiff = async (change: commitChange) => { export const openDiff = async (change: commitChange) => {
console.log('openDiff', change)
if (!plugin) return if (!plugin) return
plugin.call('fileManager', 'diff', change) plugin.call('fileManager', 'diff', change)
} }

@ -4,7 +4,6 @@ import { branch, commitChange, defaultGitState, fileStatusResult, gitState, setR
import { Actions } from "./actions" import { Actions } from "./actions"
export const gitReducer = (state: gitState = defaultGitState, action: Actions): gitState => { export const gitReducer = (state: gitState = defaultGitState, action: Actions): gitState => {
///console.log(action, state)
switch (action.type) { switch (action.type) {
case 'FILE_STATUS': case 'FILE_STATUS':

Loading…
Cancel
Save