|
|
@ -643,8 +643,6 @@ export const diff = async (commitChange: commitChange) => { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
/* |
|
|
|
const fullfilename = args; // $(args[0].currentTarget).data('file')
|
|
|
|
const fullfilename = args; // $(args[0].currentTarget).data('file')
|
|
|
|
try { |
|
|
|
try { |
|
|
@ -706,23 +704,58 @@ export const fetchBranch = async (branch: branch) => { |
|
|
|
remote: branch.remote.remote, |
|
|
|
remote: branch.remote.remote, |
|
|
|
depth: 10 |
|
|
|
depth: 10 |
|
|
|
}) |
|
|
|
}) |
|
|
|
const commits: ReadCommitResult[] = await plugin.call('dGitProvider', 'log', { |
|
|
|
const remoteCommits: ReadCommitResult[] = await plugin.call('dGitProvider', 'log', { |
|
|
|
ref: r.fetchHead |
|
|
|
ref: r.fetchHead |
|
|
|
}) |
|
|
|
}) |
|
|
|
console.log(r, commits) |
|
|
|
console.log(r, remoteCommits) |
|
|
|
dispatch(setBranchCommits({ branch, commits })) |
|
|
|
let localCommits: ReadCommitResult[] = [] |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
localCommits = await plugin.call('dGitProvider', 'log', { |
|
|
|
|
|
|
|
ref: branch.name, |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
console.log(r, localCommits) |
|
|
|
|
|
|
|
} catch (e) { } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const remoteCommitsThatAreNotLocal: ReadCommitResult[] = remoteCommits.filter((commit) => { |
|
|
|
|
|
|
|
return !localCommits.find((localCommit) => localCommit.oid === commit.oid) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
console.log(remoteCommitsThatAreNotLocal) |
|
|
|
|
|
|
|
const mergeCommits = remoteCommitsThatAreNotLocal.map((commit) => { |
|
|
|
|
|
|
|
return { |
|
|
|
|
|
|
|
...commit, |
|
|
|
|
|
|
|
remote: true |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}).concat(localCommits.map((commit) => { |
|
|
|
|
|
|
|
return { |
|
|
|
|
|
|
|
...commit, |
|
|
|
|
|
|
|
remote: false |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
)) |
|
|
|
|
|
|
|
// sort by date
|
|
|
|
|
|
|
|
mergeCommits.sort((a, b) => { |
|
|
|
|
|
|
|
return new Date(b.commit.committer.timestamp).getTime() - new Date(a.commit.committer.timestamp).getTime() |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
console.log(mergeCommits) |
|
|
|
|
|
|
|
//console.log(r, commits)
|
|
|
|
|
|
|
|
dispatch(setBranchCommits({ branch, commits: mergeCommits })) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
export const getBranchCommits = async (branch: branch) => { |
|
|
|
export const getBranchCommits = async (branch: branch) => { |
|
|
|
try { |
|
|
|
try { |
|
|
|
console.log(branch) |
|
|
|
console.log(branch) |
|
|
|
|
|
|
|
if (!branch.remote) { |
|
|
|
const commits: ReadCommitResult[] = await plugin.call('dGitProvider', 'log', { |
|
|
|
const commits: ReadCommitResult[] = await plugin.call('dGitProvider', 'log', { |
|
|
|
ref: branch.name, |
|
|
|
ref: branch.name, |
|
|
|
}) |
|
|
|
}) |
|
|
|
console.log(commits) |
|
|
|
console.log(commits) |
|
|
|
dispatch(setBranchCommits({ branch, commits })) |
|
|
|
dispatch(setBranchCommits({ branch, commits })) |
|
|
|
|
|
|
|
} else { |
|
|
|
await fetchBranch(branch) |
|
|
|
await fetchBranch(branch) |
|
|
|
return commits |
|
|
|
} |
|
|
|
} catch (e) { |
|
|
|
} catch (e) { |
|
|
|
console.log(e) |
|
|
|
console.log(e) |
|
|
|
await fetchBranch(branch) |
|
|
|
await fetchBranch(branch) |
|
|
|