本文整理汇总了TypeScript中@elastic/nodegit.Clone类的典型用法代码示例。如果您正苦于以下问题:TypeScript Clone类的具体用法?TypeScript Clone怎么用?TypeScript Clone使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Clone类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: rimraf
rimraf(p, error => {
Git.Clone.clone(url, p, {
fetchOpts: {
callbacks: {
certificateCheck: () => 0,
},
},
}).then(repo => {
resolve(repo);
});
});
开发者ID:elastic,项目名称:kibana,代码行数:11,代码来源:git_operations.ts
示例2: before
before(async () => {
const tmpRepo = path.join(serverOptions.repoPath, 'tmp');
await prepareProject(tmpRepo);
await Git.Clone.clone(`file://${tmpRepo}`, path.join(serverOptions.repoPath, repoUri), {
bare: 1,
fetchOpts: {
callbacks: {
certificateCheck: () => 0,
},
},
});
});
开发者ID:elastic,项目名称:kibana,代码行数:12,代码来源:lsp_service.ts
示例3: rimraf
rimraf(path, error => {
console.log(`begin to import ${url} to ${path}`);
Git.Clone.clone(url, path, {
fetchOpts: {
callbacks: {
certificateCheck: () => 0,
},
},
}).then(repo => {
console.log(`import ${url} done`);
resolve(repo);
});
});
开发者ID:elastic,项目名称:kibana,代码行数:13,代码来源:test_repo_manager.ts
示例4: rimraf
rimraf(p, error => {
Git.Clone.clone(url, p, opts).then(repo => {
resolve(repo);
});
});
开发者ID:elastic,项目名称:kibana,代码行数:5,代码来源:lsp_indexer.ts
示例5: doClone
private async doClone(
repo: Repository,
localPath: string,
handler?: CloneProgressHandler,
keyFile?: string
) {
try {
const cbs: RemoteCallbacks = {
transferProgress: {
// Make the progress update less frequent to avoid too many
// concurrently update of git status in elasticsearch.
throttle: 1000,
callback: (stats: any) => {
if (handler) {
const progress =
(100 * (stats.receivedObjects() + stats.indexedObjects())) /
(stats.totalObjects() * 2);
const cloneProgress = {
isCloned: false,
receivedObjects: stats.receivedObjects(),
indexedObjects: stats.indexedObjects(),
totalObjects: stats.totalObjects(),
localObjects: stats.localObjects(),
totalDeltas: stats.totalDeltas(),
indexedDeltas: stats.indexedDeltas(),
receivedBytes: stats.receivedBytes(),
};
handler(progress, cloneProgress);
}
},
} as any,
credentials: this.credentialFunc(keyFile),
};
// Ignore cert check on testing environment.
if (!this.enableGitCertCheck) {
cbs.certificateCheck = () => {
// Ignore cert check failures.
return 0;
};
}
const gitRepo = await Git.Clone.clone(repo.url, localPath, {
bare: 1,
fetchOpts: {
callbacks: cbs,
},
});
const headCommit = await gitRepo.getHeadCommit();
const headRevision = headCommit.sha();
const currentBranch = await gitRepo.getCurrentBranch();
const currentBranchName = currentBranch.shorthand();
this.log.info(
`Clone repository from ${
repo.url
} done with head revision ${headRevision} and default branch ${currentBranchName}`
);
return {
uri: repo.uri,
repo: {
...repo,
defaultBranch: currentBranchName,
revision: headRevision,
},
};
} catch (error) {
if (error.message && error.message.startsWith(SSH_AUTH_ERROR.message)) {
throw SSH_AUTH_ERROR;
} else {
const msg = `Clone repository from ${repo.url} error.`;
this.log.error(msg);
this.log.error(error);
throw new Error(error.message);
}
}
}
开发者ID:elastic,项目名称:kibana,代码行数:74,代码来源:repository_service.ts
注:本文中的@elastic/nodegit.Clone类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论