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


TypeScript nodegit.Clone類代碼示例

本文整理匯總了TypeScript中nodegit.Clone的典型用法代碼示例。如果您正苦於以下問題:TypeScript Clone類的具體用法?TypeScript Clone怎麽用?TypeScript Clone使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Clone類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: rateLimit

 promises.push((async () => {
   const dir = path.join('repos', ghRepo.name);
   let repo: nodegit.Repository;
   if (existsSync(dir)) {
     repo = await nodegit.Repository.open(dir);
   } else {
     await rateLimit(100);
     repo = await nodegit.Clone.clone(ghRepo.clone_url, dir, undefined);
   }
   let skipThisElement = false;
   if (opts.branchToFix !== 'master') {
     let ref = undefined;
     try {
       ref = await repo.getBranch(`refs/remotes/origin/${opts.branchToFix}`);
     } catch (_) {
       skipThisElement = true;
     }
     if (ref) {
       const commit = await repo.getReferenceCommit(ref);
       const branch =
           await nodegit.Branch.create(repo, opts.branchToFix, commit, 1);
       await repo.checkoutBranch(branch);
     }
   }
   if (skipThisElement) {
     return undefined;
   }
   return new ElementRepo({repo, dir, ghRepo, analyzer: null});
 })());
開發者ID:TimvdLippe,項目名稱:tedium,代碼行數:29,代碼來源:tedium.ts

示例2: downloadFunc

function downloadFunc(cloneURL, localPath) {
  let fullLocalPath = require("path").join(__dirname, localPath);
  let options = {};

  displayModal("Cloning Repository...");

  options = {
    fetchOpts: {
      callbacks: {
        certificateCheck: function() { return 1; },
        credentials: function() {
          return cred;
        }
      }
    }
  };

  console.log("cloning into " + fullLocalPath);
  let repository = Git.Clone.clone(cloneURL, fullLocalPath, options)
  .then(function(repository) {
    console.log("Repo successfully cloned");
    updateModalText("Clone Successful, repository saved under: " + fullLocalPath);
    addCommand("git clone " + cloneURL + " " + localPath);
    repoFullPath = fullLocalPath;
    repoLocalPath = localPath;
    refreshAll(repository);
  },
  function(err) {
    updateModalText("Clone Failed - " + err);
    console.log(err); // TODO show error on screen
  });
}
開發者ID:ElliotWhiley,項目名稱:VisualGit,代碼行數:32,代碼來源:repo.ts

示例3: downloadFunc

function downloadFunc(cloneURL, fullLocalPath) {
  console.log("Path of cloning repo: " + fullLocalPath);

  let progressDiv = document.getElementById("cloneProgressDiv");
  progressDiv.style.visibility = "visible";

  let options = {};

  options = {
    fetchOpts: {
      callbacks: {
        certificateCheck: function () {
          return 1;
        },
        credentials: function () {
          return Git.Cred.userpassPlaintextNew(getUsernameTemp(), getPasswordTemp());
        },
        transferProgress: function (data) {
          let bytesRatio = data.receivedObjects() / data.totalObjects();
          updateProgressBar(bytesRatio);
        }
      }
    }
  };

  console.log("cloning into " + fullLocalPath);
  let repository = Git.Clone.clone(cloneURL, fullLocalPath, options)
    .then(function (repository) {
      progressDiv.style.visibility = 'collapse';
      updateProgressBar(0);
      console.log("Repo successfully cloned");
      document.getElementById('spinner').style.display = 'block';
      refreshAll(repository);
      updateModalText("Clone Successful, repository saved under: " + fullLocalPath);
      addCommand("git clone " + cloneURL + " " + fullLocalPath);
      repoFullPath = fullLocalPath;
      repoLocalPath = fullLocalPath;
      document.getElementById('spinner').style.display = 'block';
      refreshAll(repository);
      switchToMainPanel();
    },
      function (err) {
        updateModalText("Clone Failed - " + err);
        console.log("repo.ts, line 64, failed to clone repo: " + err); // TODO show error on screen
        switchToAddRepositoryPanel();
      });
}
開發者ID:cchampernowne,項目名稱:project-seed,代碼行數:47,代碼來源:repo.ts

示例4:

 () => nodegit.Clone.clone(ghRepo.clone_url, dir, null));
開發者ID:BruceZu,項目名稱:tedium,代碼行數:1,代碼來源:tedium.ts


注:本文中的nodegit.Clone類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。