当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript nodegit.Branch类代码示例

本文整理汇总了TypeScript中nodegit.Branch的典型用法代码示例。如果您正苦于以下问题:TypeScript Branch类的具体用法?TypeScript Branch怎么用?TypeScript Branch使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Branch类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: checkoutNewBranch

/**
 * Creates a branch with the given name on the given repo.
 *
 * returns a promise of the nodegit Branch object for the new branch.
 */
async function checkoutNewBranch(
    repo: nodegit.Repository, branchName: string): Promise<void> {
  const commit = await repo.getHeadCommit();
  const branch =
      await nodegit.Branch.create(repo, branchName, commit, false);
  return repo.checkoutBranch(branch);
}
开发者ID:BruceZu,项目名称:tedium,代码行数:12,代码来源:tedium.ts

示例3:

let result = Git.Attr.addMacro(repo, "name", "values");

Git.Attr.cacheFlush(repo);

Git.Attr.get(repo, 1, "path", "name").then((string) => {
    // Use string
});

const array = Git.Attr.getMany(repo, 1, "path", 1, "names");

result = Git.Attr.value("attr");

const blameOptions = new Git.BlameOptions();

Git.Branch.lookup(repo, "branch_name", Git.Branch.BRANCH.LOCAL).then((reference) => {
    // Use reference
});

repo.getCommit("0123456789abcdef0123456789abcdef").then((commit) => {
  const sig = Git.Signature.now('John Doe', 'jd@example.com');
  const newCommit: Promise<Git.Oid> = commit.amend('ref', sig, sig, 'utf8', 'message', tree);
});

const signature = Git.Signature.now("name", "email");
signature.name();
signature.email();
signature.when();

repo.createBlobFromBuffer(Buffer.from("test")).then((oid: Git.Oid) => oid.cpy());
开发者ID:CNBoland,项目名称:DefinitelyTyped,代码行数:29,代码来源:nodegit-tests.ts

示例4:

 .then(branch => Git.Branch.upstream(branch))
开发者ID:github,项目名称:ohnogit,代码行数:1,代码来源:repository.ts

示例5:

 .then(function(commit) {
   console.log("3.0");
   return Git.Branch.create(repos, bn, commit, 0);
 })
开发者ID:ElliotWhiley,项目名称:VisualGit,代码行数:4,代码来源:repo.ts


注:本文中的nodegit.Branch类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。