Example usage for org.eclipse.jgit.notes Note name

List of usage examples for org.eclipse.jgit.notes Note name

Introduction

In this page you can find the example usage for org.eclipse.jgit.notes Note name.

Prototype

public final String name() 

Source Link

Document

name.

Usage

From source file:com.google.gerrit.server.notedb.CommentsInNotesUtil.java

License:Apache License

public static NoteMap parseCommentsFromNotes(Repository repo, String refName, RevWalk walk, Change.Id changeId,
        Multimap<RevId, PatchLineComment> comments, Status status) throws IOException, ConfigInvalidException {
    Ref ref = repo.getRefDatabase().exactRef(refName);
    if (ref == null) {
        return null;
    }//from  w ww . j  a  va  2 s.  c o  m

    ObjectReader reader = walk.getObjectReader();
    RevCommit commit = walk.parseCommit(ref.getObjectId());
    NoteMap noteMap = NoteMap.read(reader, commit);

    for (Note note : noteMap) {
        byte[] bytes = reader.open(note.getData(), OBJ_BLOB).getCachedBytes(MAX_NOTE_SZ);
        List<PatchLineComment> result = parseNote(bytes, changeId, status);
        if (result == null || result.isEmpty()) {
            continue;
        }
        comments.putAll(new RevId(note.name()), result);
    }
    return noteMap;
}

From source file:com.google.gerrit.server.notedb.RevisionNoteMap.java

License:Apache License

static RevisionNoteMap parse(ChangeNoteUtil noteUtil, Change.Id changeId, ObjectReader reader, NoteMap noteMap,
        boolean draftsOnly) throws ConfigInvalidException, IOException {
    Map<RevId, RevisionNote> result = new HashMap<>();
    for (Note note : noteMap) {
        RevisionNote rn = new RevisionNote(noteUtil, changeId, reader, note.getData(), draftsOnly);
        result.put(new RevId(note.name()), rn);
    }//w ww. ja va2 s . c  om
    return new RevisionNoteMap(noteMap, ImmutableMap.copyOf(result));
}