|
|
@ -65,7 +65,7 @@ export const setUpstreamRemote = async (remote: remote) => { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
export const getFileStatusMatrix = async (filepaths: string[]) => { |
|
|
|
export const getFileStatusMatrix = async (filepaths: string[]) => { |
|
|
|
console.log('getFileStatusMatrix', filepaths) |
|
|
|
|
|
|
|
dispatch(setLoading(true)) |
|
|
|
dispatch(setLoading(true)) |
|
|
|
const fileStatusResult = await statusMatrix(filepaths); |
|
|
|
const fileStatusResult = await statusMatrix(filepaths); |
|
|
|
fileStatusResult.map((m) => { |
|
|
|
fileStatusResult.map((m) => { |
|
|
@ -81,7 +81,7 @@ export const getFileStatusMatrix = async (filepaths: string[]) => { |
|
|
|
dispatch(fileStatusMerge(fileStatusResult)) |
|
|
|
dispatch(fileStatusMerge(fileStatusResult)) |
|
|
|
setFileDecorators(fileStatusResult) |
|
|
|
setFileDecorators(fileStatusResult) |
|
|
|
} |
|
|
|
} |
|
|
|
console.log('getFileStatusMatrix end') |
|
|
|
|
|
|
|
dispatch(setLoading(false)) |
|
|
|
dispatch(setLoading(false)) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -93,7 +93,7 @@ export const getCommits = async (depth: number) => { |
|
|
|
"log", |
|
|
|
"log", |
|
|
|
{ ref: "HEAD", depth: depth } |
|
|
|
{ ref: "HEAD", depth: depth } |
|
|
|
); |
|
|
|
); |
|
|
|
console.log('commits', commits) |
|
|
|
|
|
|
|
return commits; |
|
|
|
return commits; |
|
|
|
} catch (e) { |
|
|
|
} catch (e) { |
|
|
|
return []; |
|
|
|
return []; |
|
|
@ -101,7 +101,7 @@ export const getCommits = async (depth: number) => { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
export const gitlog = async (depth: number) => { |
|
|
|
export const gitlog = async (depth: number) => { |
|
|
|
console.log('gitlog start') |
|
|
|
|
|
|
|
let commits = [] |
|
|
|
let commits = [] |
|
|
|
try { |
|
|
|
try { |
|
|
|
commits = await getCommits(depth) |
|
|
|
commits = await getCommits(depth) |
|
|
@ -110,7 +110,7 @@ export const gitlog = async (depth: number) => { |
|
|
|
dispatch(setCommits(commits)) |
|
|
|
dispatch(setCommits(commits)) |
|
|
|
await showCurrentBranch() |
|
|
|
await showCurrentBranch() |
|
|
|
dispatch(setLoading(false)) |
|
|
|
dispatch(setLoading(false)) |
|
|
|
console.log('gitlog end') |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
export const setStateGitLogCount = async (count: number) => { |
|
|
|
export const setStateGitLogCount = async (count: number) => { |
|
|
@ -533,7 +533,7 @@ export const remoteBranches = async (owner: string, repo: string) => { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
export const remoteCommits = async (url: string, branch: string, length: number) => { |
|
|
|
export const remoteCommits = async (url: string, branch: string, length: number) => { |
|
|
|
console.log('get remote commits') |
|
|
|
|
|
|
|
const urlParts = url.split("/"); |
|
|
|
const urlParts = url.split("/"); |
|
|
|
|
|
|
|
|
|
|
|
// check if it's github
|
|
|
|
// check if it's github
|
|
|
@ -680,9 +680,9 @@ export const loadGitHubUserFromToken = async () => { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
export const statusMatrix = async (filepaths: string[]) => { |
|
|
|
export const statusMatrix = async (filepaths: string[]) => { |
|
|
|
console.log('calling status') |
|
|
|
|
|
|
|
const matrix = await plugin.call('dgitApi', 'status', { ref: "HEAD", filepaths: filepaths || ['.']}); |
|
|
|
const matrix = await plugin.call('dgitApi', 'status', { ref: "HEAD", filepaths: filepaths || ['.']}); |
|
|
|
console.log('calling status end') |
|
|
|
|
|
|
|
const result = (matrix || []).map((x) => { |
|
|
|
const result = (matrix || []).map((x) => { |
|
|
|
return { |
|
|
|
return { |
|
|
|
filename: `/${x.shift()}`, |
|
|
|
filename: `/${x.shift()}`, |
|
|
@ -745,7 +745,7 @@ 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('getCommitChanges', oid1, oid2, branch, remote) |
|
|
|
|
|
|
|
try { |
|
|
|
try { |
|
|
|
let log |
|
|
|
let log |
|
|
|
try { |
|
|
|
try { |
|
|
@ -758,7 +758,7 @@ export const getCommitChanges = async (oid1: string, oid2: string, branch?: bran |
|
|
|
console.log(e, 'log error') |
|
|
|
console.log(e, 'log error') |
|
|
|
} |
|
|
|
} |
|
|
|
if (log) { |
|
|
|
if (log) { |
|
|
|
console.log('log', log) |
|
|
|
|
|
|
|
const foundCommit = log.find((commit: ReadCommitResult) => commit.oid === oid2) |
|
|
|
const foundCommit = log.find((commit: ReadCommitResult) => commit.oid === oid2) |
|
|
|
if (!foundCommit && remote) { |
|
|
|
if (!foundCommit && remote) { |
|
|
|
|
|
|
|
|
|
|
@ -795,7 +795,7 @@ async function getRepoDetails(url: string) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
export const fetchBranch = async (branch: branch, page: number) => { |
|
|
|
export const fetchBranch = async (branch: branch, page: number) => { |
|
|
|
console.log('fetch branch') |
|
|
|
|
|
|
|
if (!branch.remote || !branch.remote.url) return |
|
|
|
if (!branch.remote || !branch.remote.url) return |
|
|
|
const token = await tokenWarning(); |
|
|
|
const token = await tokenWarning(); |
|
|
|
if (page == 1) { |
|
|
|
if (page == 1) { |
|
|
@ -815,7 +815,7 @@ export const fetchBranch = async (branch: branch, page: number) => { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
export const getBranchDifferences = async (branch: branch, remote: remote, state: gitState) => { |
|
|
|
export const getBranchDifferences = async (branch: branch, remote: remote, state: gitState) => { |
|
|
|
console.log('get branch diff') |
|
|
|
|
|
|
|
if (!remote && state) { |
|
|
|
if (!remote && state) { |
|
|
|
if (state.defaultRemote) { |
|
|
|
if (state.defaultRemote) { |
|
|
|
remote = state.defaultRemote |
|
|
|
remote = state.defaultRemote |
|
|
|