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

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

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

Git.notesList介绍

[英]Return a command to list all notes
[中]返回命令以列出所有注释

代码示例

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

public static void main(String[] args) throws IOException, GitAPIException {
    try (Repository repository = CookbookHelper.openJGitCookbookRepository()) {
      try (Git git = new Git(repository)) {
        List<Note> call = git.notesList().call();
        System.out.println("Listing " + call.size() + " notes");
        for (Note note : call) {
          System.out.println("Note: " + note + " " + note.getName() + " " + note.getData().getName() + "\nContent: ");

          // displaying the contents of the note is done via a simple blob-read
          ObjectLoader loader = repository.open(note.getData());
          loader.copyTo(System.out);
        }
      }
    }
  }
}

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

public static void main(String[] args) throws IOException, GitAPIException {
    try (Repository repository = CookbookHelper.openJGitCookbookRepository()) {
      try (Git git = new Git(repository)) {
        List<Note> call = git.notesList().call();
        System.out.println("Listing " + call.size() + " notes");
        for (Note note : call) {
          System.out.println("Note: " + note + " " + note.getName() + " " + note.getData().getName() + "\nContent: ");

          // displaying the contents of the note is done via a simple blob-read
          ObjectLoader loader = repository.open(note.getData());
          loader.copyTo(System.out);
        }
      }
    }
  }
}

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

System.out.println("Added Note to commit " + commit);
List<Note> call = git.notesList().call();
System.out.println("Listing " + call.size() + " notes");
for(Note note : call) {

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

System.out.println("Added Note to commit " + commit);
List<Note> call = git.notesList().call();
System.out.println("Listing " + call.size() + " notes");
for(Note note : call) {

代码示例来源:origin: google/git-appraise-eclipse

/**
 * Retrieves all the reviews in the current project's repository by commit hash.
 */
public Map<String, Review> listReviews() throws GitClientException {
 // Get the most up-to-date list of reviews.
 syncCommentsAndReviews();
 Map<String, Review> reviews = new LinkedHashMap<>();
 Git git = new Git(repo);
 try {
  ListNotesCommand cmd = git.notesList();
  cmd.setNotesRef(REVIEWS_REF);
  List<Note> notes = cmd.call();
  for (Note note : notes) {
   String rawNoteDataStr = noteToString(repo, note);
   Review latest = extractLatestReviewFromNotes(rawNoteDataStr);
   if (latest != null) {
    reviews.put(note.getName(), latest);
   }
  }
 } catch (Exception e) {
  throw new GitClientException(e);
 } finally {
  git.close();
 }
 return reviews;
}

相关文章