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


TypeScript Reference.nameToId方法代碼示例

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


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

示例1: clearBranchElement

  .then(function(branchList) {
    let count = 0;
    clearBranchElement();
    for (let i = 0; i < branchList.length; i++) {
      //console.log(branchList[i].name() + "!!!!");
      let bp = branchList[i].name().split("/");
      Git.Reference.nameToId(repository, branchList[i].name()).then(function(oid) {
        // Use oid
        //console.log(oid + "  TTTTTTTT");
        if (branchList[i].isRemote()) {
          remoteName[bp[bp.length-1]] = oid;
        } else {
          branchCommit.push(branchList[i]);
          console.log(bp[bp.length - 1] + "--------" + oid.tostrS());
          if (oid.tostrS() in bname) {
            bname[oid.tostrS()].push(branchList[i]);
          } else {
            bname[oid.tostrS()] = [branchList[i]];
          }
        }
      }, function(err) {
        console.log(err + "?????????");
      });
      if (branchList[i].isRemote()) {
        if (localBranches.indexOf(bp[bp.length - 1]) < 0) {
          displayBranch(bp[bp.length - 1], "branch-dropdown", "checkoutRemoteBranch(this)");
        }
      } else {
        localBranches.push(bp[bp.length - 1]);
        displayBranch(bp[bp.length - 1], "branch-dropdown", "checkoutLocalBranch(this)");
      }

    }
  })
開發者ID:ElliotWhiley,項目名稱:VisualGit,代碼行數:34,代碼來源:repo.ts

示例2: clearBranchElement

      .then(function (branchList) {
        let count = 0;
        clearBranchElement();
        //for each branch
        for (let i = 0; i < branchList.length; i++) {
          console.log("branch name: " + branchList[i].name());
          //get simplified name
          let bp = branchList[i].name().split("/")[branchList[i].name().split("/").length - 1];

          Git.Reference.nameToId(repository, branchList[i].name()).then(function (oid) {
            // Use oid
            console.log("old id " + oid);
            if (branchList[i].isRemote()) {
              // for remote branches add oid and branch name to remote branches map
              remoteName[bp] = oid;
            } else {
              //add branch name to the branch list
              branchCommit.push(branchList[i]);
              console.log(bp + " adding to end of " + oid.tostrS());
              if (oid.tostrS() in bname) {
                bname[oid.tostrS()].push(branchList[i]);
              } else {
                bname[oid.tostrS()] = [branchList[i]];
              }
            }
          }, function (err) {
            console.log("repo.ts, line 273, could not find referenced branch" + err);
          });
          if (branchList[i].isRemote()) {
            if (localBranches.indexOf(bp) < 0) {
              displayBranch(bp, "branch-dropdown", "checkoutRemoteBranch(this)");
            }
          } else {
            localBranches.push(bp);
            displayBranch(bp, "branch-dropdown", "checkoutLocalBranch(this)");
          }

        }
      })
開發者ID:cchampernowne,項目名稱:project-seed,代碼行數:39,代碼來源:repo.ts

示例3: addAllAndCommit

export async function addAllAndCommit(path: string,
                                      user: string,
                                      commitMessage: string,
                                      initial: boolean): Promise<void> {
  Log.info(`git commit -a -m "${commitMessage}"`);

  let repo: NodeGitRepository = await nodegit.Repository.open(path);
  let index = await repo.openIndex();
  await index.addAll();
  await index.write();
  let oid = await index.writeTree();

  var author = nodegit.Signature.now(user, user);
  var committer = nodegit.Signature.now(user, user);

  if (initial)
    return await repo.createCommit(HEAD, author, committer, commitMessage, oid, []);

  let head = await nodegit.Reference.nameToId(repo, HEAD);
  let parent = await repo.getCommit(head);

  return await repo.createCommit(HEAD, author, committer, commitMessage, oid, [parent]);
}
開發者ID:NohSeho,項目名稱:oh-my-github-1,代碼行數:23,代碼來源:nodegit_util.ts

示例4:

 .then(repo => Git.Reference.nameToId(repo, reference))
開發者ID:github,項目名稱:ohnogit,代碼行數:1,代碼來源:repository.ts


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