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


TypeScript nodegit.Reference类代码示例

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


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

 .then(function (repo) {
   Git.Reference.list(repo).then(function (array) {
     if (array.includes("refs/remotes/origin/" + name)) {
       a.innerHTML += "<img src='./assets/remote-branch.png' width='20' height='20' align='right' title='Remote'>";
       isRemote = 1
     }
   })
 })
开发者ID:cchampernowne,项目名称:project-seed,代码行数:8,代码来源:repo.ts

示例3: 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

示例4: 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

示例5:

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


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