• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript nodegit.Clone类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript nodegit.Cred类代码示例发布时间:2022-05-25
下一篇:
TypeScript nodegit.Branch类代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap