當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript nodegit.Clone類代碼示例

本文整理匯總了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;未經允許,請勿轉載。