org.eclipse.jgit.api.Git.notesAdd()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(1.9k)|赞(0)|评价(0)|浏览(140)

本文整理了Java中org.eclipse.jgit.api.Git.notesAdd()方法的一些代码示例,展示了Git.notesAdd()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Git.notesAdd()方法的具体详情如下:
包路径:org.eclipse.jgit.api.Git
类名称:Git
方法名:notesAdd

Git.notesAdd介绍

[英]Return a command to add notes to an object
[中]返回向对象添加注释的命令

代码示例

代码示例来源:origin: centic9/jgit-cookbook

git.notesAdd().setMessage("some note message").setObjectId(commit).call();
System.out.println("Added Note to commit " + commit);

代码示例来源:origin: centic9/jgit-cookbook

git.notesAdd().setMessage("some note message").setObjectId(commit).call();
System.out.println("Added Note to commit " + commit);

代码示例来源:origin: org.apereo.cas/cas-mgmt-support-version-control

/**
 * Creates a note to a commit.
 *
 * @param com  - the RevObject fo the commit
 * @param note - the note text.
 * @throws GitAPIException - failed.
 */
public void addNote(final RevObject com, final String note) throws GitAPIException {
  git.notesAdd()
    .setObjectId(com)
    .setMessage(note)
    .call();
}

代码示例来源:origin: org.walkmod/junit4git

@Override
 public void write(String str) {
  try (Git git = updater.open()) {
   RevWalk walk = new RevWalk(git.getRepository());
   RevCommit commit = walk.parseCommit(updater.getBaseObjectId(git));
   git.notesAdd().setNotesRef(GIT_NOTES_REF)
       .setObjectId(commit)
       .setMessage(str).call();
  } catch (Exception e) {
   log.error("Error writing Tests Report in the Git Notes", e);
   throw new RuntimeException("Error from the GitNotesWriter", e);
  }
 }
}

代码示例来源:origin: jenkinsci/git-client-plugin

/** {@inheritDoc} */
@Override
public void addNote(String note, String namespace) throws GitException {
  try (Repository repo = getRepository()) {
    ObjectId head = repo.resolve(HEAD); // commit to put a note on
    AddNoteCommand cmd = git(repo).notesAdd();
    cmd.setMessage(normalizeNote(note));
    cmd.setNotesRef(qualifyNotesNamespace(namespace));
    try (ObjectReader or = repo.newObjectReader();
       RevWalk walk = new RevWalk(or)) {
      cmd.setObjectId(walk.parseAny(head));
      cmd.call();
    }
  } catch (GitAPIException | IOException e) {
    throw new GitException(e);
  }
}

相关文章