Skip to content

Commit

Permalink
[Code] upgrade nodegit, set max returned commits results
Browse files Browse the repository at this point in the history
  • Loading branch information
spacedragon committed Mar 27, 2019
1 parent a2e7045 commit 9d32d64
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 47 deletions.
2 changes: 1 addition & 1 deletion x-pack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@
"@elastic/lsp-extension": "^0.1.1",
"@elastic/node-crypto": "0.1.2",
"@elastic/numeral": "2.3.2",
"@elastic/nodegit": "0.24.0-alpha.10",
"@elastic/nodegit": "0.25.0-alpha.10",
"@kbn/babel-preset": "1.0.0",
"@kbn/es-query": "1.0.0",
"@kbn/i18n": "1.0.0",
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/code/public/components/main/content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ class CodeContent extends React.PureComponent<Props> {
return (
<CommitHistoryContainer>
<InfiniteScroll
initialLoad={true}
initialLoad={false}
loadMore={() => !loadingCommits && this.props.fetchMoreCommits(repoUri)}
hasMore={!loadingCommits && hasMoreCommits}
useWindow={false}
Expand Down
5 changes: 5 additions & 0 deletions x-pack/plugins/code/public/reducers/file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
fetchFileFailed,
FetchFileResponse,
fetchFileSuccess,
fetchMoreCommits,
fetchRepoBranchesSuccess,
fetchRepoCommitsSuccess,
fetchRepoTree,
Expand Down Expand Up @@ -160,6 +161,10 @@ export const file = handleActions(
draft.commits = action.payload;
draft.loadingCommits = false;
}),
[String(fetchMoreCommits)]: (state: FileState, action: any) =>
produce<FileState>(state, draft => {
draft.loadingCommits = true;
}),
[String(fetchRepoBranchesSuccess)]: (state: FileState, action: any) =>
produce<FileState>(state, (draft: FileState) => {
const references = action.payload as ReferenceInfo[];
Expand Down
6 changes: 3 additions & 3 deletions x-pack/plugins/code/server/routes/file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,9 @@ export function fileRoute(server: hapi.Server, options: ServerOptions) {
walk.push(commit.id());
let commits: Commit[];
if (path) {
// magic number 1000: how many commits at the most to iterate in order to find the commits contains the path
const results = await walk.fileHistoryWalk(path, 10000);
commits = results.slice(0, count).map(result => result.commit);
// magic number 10000: how many commits at the most to iterate in order to find the commits contains the path
const results = await walk.fileHistoryWalk(path, count, 10000);
commits = results.map(result => result.commit);
} else {
walk.push(commit.id());
commits = await walk.getCommits(count);
Expand Down
51 changes: 9 additions & 42 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -902,16 +902,13 @@
resolved "https://registry.yarnpkg.com/@elastic/node-crypto/-/node-crypto-0.1.2.tgz#c18ac282f635e88f041cc1555d806e492ca8f3b1"
integrity sha1-wYrCgvY16I8EHMFVXYBuSSyo87E=

"@elastic/[email protected]":
version "0.24.0-alpha.10"
resolved "https://registry.yarnpkg.com/@elastic/nodegit/-/nodegit-0.24.0-alpha.10.tgz#aff30d245a9155620b08af494643efcd12c39313"
integrity sha512-9vQRbl/jOqRb20AceYdcwzYBNFxsh7pWAeKMfHJmLTRqTxCjvvFeOpIFW1FLAe56zj6Qd04xrE8OWE9Htxvn2Q==
dependencies:
babel-cli "^6.7.7"
babel-preset-es2015 "^6.6.0"
combyne "~0.8.1"
"@elastic/[email protected]":
version "0.25.0-alpha.10"
resolved "https://registry.yarnpkg.com/@elastic/nodegit/-/nodegit-0.25.0-alpha.10.tgz#2f1234cbc2ac391f2762c7763049afa34a4e9fbb"
integrity sha512-+fcnXtcFQTpjKn2mGySlXtkfB86dU1j2yfw+RYkuNwN3/o/3gSa142bzVxIGYZFP+Tki5fB+AJQI5l6Um0f8YA==
dependencies:
fs-extra "^7.0.0"
js-beautify "~1.5.10"
json5 "^2.1.0"
lodash "^4.17.11"
nan "^2.11.1"
node-gyp "^3.8.0"
Expand All @@ -920,7 +917,6 @@
ramda "^0.25.0"
request-promise-native "^1.0.5"
tar-fs "^1.16.3"
walk "^2.3.9"

"@elastic/[email protected]":
version "2.3.2"
Expand Down Expand Up @@ -4025,7 +4021,7 @@ [email protected]:
resolved "https://registry.yarnpkg.com/b64/-/b64-4.0.0.tgz#c37f587f0a383c7019e821120e8c3f58f0d22772"
integrity sha512-EhmUQodKB0sdzPPrbIWbGqA5cQeTWxYrAgNeeT1rLZWtD3tbNTnphz8J4vkXI3cPgBNlXBjzEbzDzq0Nwi4f9A==

babel-cli@^6.26.0, babel-cli@^6.7.7:
babel-cli@^6.26.0:
version "6.26.0"
resolved "https://registry.yarnpkg.com/babel-cli/-/babel-cli-6.26.0.tgz#502ab54874d7db88ad00b887a06383ce03d002f1"
integrity sha1-UCq1SHTX24itALiHoGODzgPQAvE=
Expand Down Expand Up @@ -4953,7 +4949,7 @@ babel-preset-env@^1.7.0:
invariant "^2.2.2"
semver "^5.3.0"

babel-preset-es2015@^6.24.1, babel-preset-es2015@^6.6.0:
babel-preset-es2015@^6.24.1:
version "6.24.1"
resolved "https://registry.yarnpkg.com/babel-preset-es2015/-/babel-preset-es2015-6.24.1.tgz#d44050d6bc2c9feea702aaf38d727a0210538939"
integrity sha1-1EBQ1rwsn+6nAqrzjXJ6AhBTiTk=
Expand Down Expand Up @@ -6879,11 +6875,6 @@ combokeys@^3.0.0:
resolved "https://registry.yarnpkg.com/combokeys/-/combokeys-3.0.0.tgz#955c59a3959af40d26846ab6fc3c682448e7572e"
integrity sha1-lVxZo5Wa9A0mhGq2/DxoJEjnVy4=

combyne@~0.8.1:
version "0.8.1"
resolved "https://registry.yarnpkg.com/combyne/-/combyne-0.8.1.tgz#589de47045d57156dc1ece185d64c389dccb47d8"
integrity sha1-WJ3kcEXVcVbcHs4YXWTDidzLR9g=

[email protected]:
version "0.6.1"
resolved "https://registry.yarnpkg.com/commander/-/commander-0.6.1.tgz#fa68a14f6a945d54dbbe50d8cdb3320e9e3b1a06"
Expand Down Expand Up @@ -7064,14 +7055,6 @@ config-chain@^1.1.11:
ini "^1.3.4"
proto-list "~1.2.1"

config-chain@~1.1.5:
version "1.1.12"
resolved "https://registry.yarnpkg.com/config-chain/-/config-chain-1.1.12.tgz#0fde8d091200eb5e808caf25fe618c02f48e4efa"
integrity sha512-a1eOIcu8+7lUInge4Rpf/n4Krkf3Dd9lqhljRzII1/Zno/kRtUWnznPO3jOKBmTEktkt3fkxisUcivoj0ebzoA==
dependencies:
ini "^1.3.4"
proto-list "~1.2.1"

configstore@^1.0.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/configstore/-/configstore-1.4.0.tgz#c35781d0501d268c25c54b8b17f6240e8a4fb021"
Expand Down Expand Up @@ -14541,15 +14524,6 @@ js-base64@^2.1.9:
resolved "https://registry.yarnpkg.com/js-base64/-/js-base64-2.4.3.tgz#2e545ec2b0f2957f41356510205214e98fad6582"
integrity sha512-H7ErYLM34CvDMto3GbD6xD0JLUGYXR3QTcH6B/tr4Hi/QpSThnCsIp+Sy5FRTw3B0d6py4HcNkW7nO/wdtGWEw==

js-beautify@~1.5.10:
version "1.5.10"
resolved "https://registry.yarnpkg.com/js-beautify/-/js-beautify-1.5.10.tgz#4d95371702699344a516ca26bf59f0a27bb75719"
integrity sha1-TZU3FwJpk0SlFsomv1nwonu3Vxk=
dependencies:
config-chain "~1.1.5"
mkdirp "~0.5.0"
nopt "~3.0.1"

js-levenshtein@^1.1.3:
version "1.1.3"
resolved "https://registry.yarnpkg.com/js-levenshtein/-/js-levenshtein-1.1.3.tgz#3ef627df48ec8cf24bacf05c0f184ff30ef413c5"
Expand Down Expand Up @@ -17278,7 +17252,7 @@ nodemailer@^4.6.4:
resolved "https://registry.yarnpkg.com/nodemailer/-/nodemailer-4.6.4.tgz#f0d72d0c6a6ec5f4369fa8f4bf5127a31baa2014"
integrity sha512-SD4uuX7NMzZ5f5m1XHDd13J4UC3SmdJk8DsmU1g6Nrs5h3x9LcXr6EBPZIqXRJ3LrF7RdklzGhZRF/TuylTcLg==

"nopt@2 || 3", [email protected], nopt@~3.0.1, nopt@~3.0.6:
"nopt@2 || 3", [email protected], nopt@~3.0.6:
version "3.0.6"
resolved "https://registry.yarnpkg.com/nopt/-/nopt-3.0.6.tgz#c6465dbf08abcd4db359317f79ac68a646b28ff9"
integrity sha1-xkZdvwirzU2zWTF/eaxopkayj/k=
Expand Down Expand Up @@ -25248,13 +25222,6 @@ [email protected]:
dependencies:
foreachasync "^3.0.0"

walk@^2.3.9:
version "2.3.14"
resolved "https://registry.yarnpkg.com/walk/-/walk-2.3.14.tgz#60ec8631cfd23276ae1e7363ce11d626452e1ef3"
integrity sha512-5skcWAUmySj6hkBdH6B6+3ddMjVQYH5Qy9QGbPmN8kVmLteXk+yVXg+yfk1nbX30EYakahLrr8iPcCxJQSCBeg==
dependencies:
foreachasync "^3.0.0"

walker@~1.0.5:
version "1.0.7"
resolved "https://registry.yarnpkg.com/walker/-/walker-1.0.7.tgz#2f7f9b8fd10d677262b18a884e28d19618e028fb"
Expand Down

0 comments on commit 9d32d64

Please sign in to comment.