Search in sources :

Example 1 with PatchSetInfo

use of com.google.gerrit.entities.PatchSetInfo in project gerrit by GerritCodeReview.

the class TestChanges method incrementPatchSet.

public static void incrementPatchSet(Change change) {
    PatchSet.Id curr = change.currentPatchSetId();
    PatchSetInfo ps = new PatchSetInfo(PatchSet.id(change.getId(), curr != null ? curr.get() + 1 : 1));
    ps.setSubject("Change subject");
    change.setCurrentPatchSet(ps);
}
Also used : PatchSet(com.google.gerrit.entities.PatchSet) PatchSetInfo(com.google.gerrit.entities.PatchSetInfo)

Example 2 with PatchSetInfo

use of com.google.gerrit.entities.PatchSetInfo in project gerrit by GerritCodeReview.

the class PatchSetInfoFactory method get.

public PatchSetInfo get(Project.NameKey project, PatchSet patchSet) throws PatchSetInfoNotAvailableException {
    try (Repository repo = repoManager.openRepository(project);
        RevWalk rw = new RevWalk(repo)) {
        RevCommit src = rw.parseCommit(patchSet.commitId());
        PatchSetInfo info = get(rw, src, patchSet.id());
        info.setParents(toParentInfos(src.getParents(), rw));
        return info;
    } catch (IOException | StorageException e) {
        throw new PatchSetInfoNotAvailableException(e);
    }
}
Also used : Repository(org.eclipse.jgit.lib.Repository) IOException(java.io.IOException) RevWalk(org.eclipse.jgit.revwalk.RevWalk) StorageException(com.google.gerrit.exceptions.StorageException) RevCommit(org.eclipse.jgit.revwalk.RevCommit) PatchSetInfo(com.google.gerrit.entities.PatchSetInfo)

Example 3 with PatchSetInfo

use of com.google.gerrit.entities.PatchSetInfo in project gerrit by GerritCodeReview.

the class PatchSetInfoFactory method get.

public PatchSetInfo get(RevWalk rw, RevCommit src, PatchSet.Id psi) throws IOException {
    rw.parseBody(src);
    PatchSetInfo info = new PatchSetInfo(psi);
    info.setSubject(src.getShortMessage());
    info.setMessage(src.getFullMessage());
    info.setAuthor(emails.toUserIdentity(src.getAuthorIdent()));
    info.setCommitter(emails.toUserIdentity(src.getCommitterIdent()));
    info.setCommitId(src);
    return info;
}
Also used : PatchSetInfo(com.google.gerrit.entities.PatchSetInfo)

Aggregations

PatchSetInfo (com.google.gerrit.entities.PatchSetInfo)3 PatchSet (com.google.gerrit.entities.PatchSet)1 StorageException (com.google.gerrit.exceptions.StorageException)1 IOException (java.io.IOException)1 Repository (org.eclipse.jgit.lib.Repository)1 RevCommit (org.eclipse.jgit.revwalk.RevCommit)1 RevWalk (org.eclipse.jgit.revwalk.RevWalk)1