當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。