Java Code Examples for org.eclipse.jgit.revwalk.RevCommit#getShortMessage()
The following examples show how to use
org.eclipse.jgit.revwalk.RevCommit#getShortMessage() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GitRepo.java From spring-cloud-release-tools with Apache License 2.0 | 6 votes |
void revert(String message) { try (Git git = this.gitFactory.open(file(this.basedir))) { RevCommit commit = git.log().setMaxCount(1).call().iterator().next(); String shortMessage = commit.getShortMessage(); String id = commit.getId().getName(); if (!shortMessage.contains("Update SNAPSHOT to ")) { throw new IllegalStateException( "Won't revert the commit with id [" + id + "] " + "and message [" + shortMessage + "]. Only commit that updated " + "snapshot to another version can be reverted"); } log.debug("The commit to be reverted is [{}]", commit); git.revert().include(commit).call(); git.commit().setAmend(true).setMessage(message).call(); printLog(git); } catch (Exception e) { throw new IllegalStateException(e); } }
Example 2
Source File: RepositoryResource.java From fabric8-forge with Apache License 2.0 | 6 votes |
public CommitInfo createCommitInfo(RevCommit entry) { final Date date = GitUtils.getCommitDate(entry); PersonIdent authorIdent = entry.getAuthorIdent(); String author = null; String name = null; String email = null; String avatarUrl = null; if (authorIdent != null) { author = authorIdent.getName(); name = authorIdent.getName(); email = authorIdent.getEmailAddress(); // lets try default the avatar if (Strings.isNotBlank(email)) { avatarUrl = getAvatarUrl(email); } } boolean merge = entry.getParentCount() > 1; String shortMessage = entry.getShortMessage(); String sha = entry.getName(); return new CommitInfo(sha, author, name, email, avatarUrl, date, merge, shortMessage); }
Example 3
Source File: OldGitNotebookRepo.java From zeppelin with Apache License 2.0 | 6 votes |
@Override public Revision checkpoint(String pattern, String commitMessage, AuthenticationInfo subject) { Revision revision = Revision.EMPTY; try { List<DiffEntry> gitDiff = git.diff().call(); if (!gitDiff.isEmpty()) { LOG.debug("Changes found for pattern '{}': {}", pattern, gitDiff); DirCache added = git.add().addFilepattern(pattern).call(); LOG.debug("{} changes are about to be commited", added.getEntryCount()); RevCommit commit = git.commit().setMessage(commitMessage).call(); revision = new Revision(commit.getName(), commit.getShortMessage(), commit.getCommitTime()); } else { LOG.debug("No changes found {}", pattern); } } catch (GitAPIException e) { LOG.error("Failed to add+commit {} to Git", pattern, e); } return revision; }
Example 4
Source File: GitNotebookRepo.java From zeppelin with Apache License 2.0 | 6 votes |
@Override public Revision checkpoint(String noteId, String notePath, String commitMessage, AuthenticationInfo subject) throws IOException { String noteFileName = buildNoteFileName(noteId, notePath); Revision revision = Revision.EMPTY; try { List<DiffEntry> gitDiff = git.diff().call(); boolean modified = gitDiff.parallelStream().anyMatch(diffEntry -> diffEntry.getNewPath().equals(noteFileName)); if (modified) { LOGGER.debug("Changes found for pattern '{}': {}", noteFileName, gitDiff); DirCache added = git.add().addFilepattern(noteFileName).call(); LOGGER.debug("{} changes are about to be commited", added.getEntryCount()); RevCommit commit = git.commit().setMessage(commitMessage).call(); revision = new Revision(commit.getName(), commit.getShortMessage(), commit.getCommitTime()); } else { LOGGER.debug("No changes found {}", noteFileName); } } catch (GitAPIException e) { LOGGER.error("Failed to add+commit {} to Git", noteFileName, e); } return revision; }
Example 5
Source File: SimpleCommit.java From spring-cloud-release-tools with Apache License 2.0 | 5 votes |
SimpleCommit(RevCommit revCommit) { this(revCommit.abbreviate(8).name(), revCommit.name(), revCommit.getShortMessage(), revCommit.getFullMessage(), revCommit.getAuthorIdent().getName(), revCommit.getAuthorIdent().getEmailAddress(), revCommit.getCommitterIdent().getName(), revCommit.getCommitterIdent().getEmailAddress(), revCommit.getParentCount() > 1); }
Example 6
Source File: GitRepository.java From APDE with GNU General Public License v2.0 | 5 votes |
public static String ellipsizeCommitMessage(RevCommit commit, int truncateAt) { String shortMessage = commit.getShortMessage(); return truncateAt > 0 ? (shortMessage.length() > truncateAt ? shortMessage.substring(0, Math.min(truncateAt, shortMessage.length())) + "…" : shortMessage) : commit.getFullMessage(); }
Example 7
Source File: CommitUtils.java From ParallelGit with Apache License 2.0 | 4 votes |
@Nonnull public static String getDefaultCommitName(RevCommit commit) { return commit.getId().abbreviate(7).name() + " " + commit.getShortMessage(); }
Example 8
Source File: CommitUtils.java From ParallelGit with Apache License 2.0 | 4 votes |
@Nonnull public static String getDefaultCommitName(RevCommit commit) { return commit.getId().abbreviate(7).name() + " " + commit.getShortMessage(); }