本文整理汇总了Java中org.eclipse.jgit.api.CommitCommand.setCommitter方法的典型用法代码示例。如果您正苦于以下问题:Java CommitCommand.setCommitter方法的具体用法?Java CommitCommand.setCommitter怎么用?Java CommitCommand.setCommitter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jgit.api.CommitCommand
的用法示例。
在下文中一共展示了CommitCommand.setCommitter方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: commit
import org.eclipse.jgit.api.CommitCommand; //导入方法依赖的package包/类
@Override
public String commit(String author, String email, String message) {
RevCommit revCommit = null;
CommitCommand command = _git.commit();
command.setCommitter(author, email);
command.setMessage(message);
command.setAll(true);
try {
revCommit = command.call();
} catch (Throwable e) {
throw new RuntimeException("Failed to commit", e);
}
return revCommit.getId().getName();
}
示例2: addAllAndCommit
import org.eclipse.jgit.api.CommitCommand; //导入方法依赖的package包/类
static void addAllAndCommit(Git git, UserProfile user, String commitMsg) throws GitAPIException {
AddCommand addCommand = git.add()
.addFilepattern(".")
.addFilepattern("application.json");
CommitCommand commitCmd = git.commit();
if (user != null && user.name() != null && user.email() != null) {
commitCmd.setCommitter(user.name(), user.email());
}
if (commitMsg != null) {
commitCmd.setMessage(commitMsg);
}
GitHandler.commit(() -> {
addCommand.call();
return commitCmd.call();
});
}
示例3: commit
import org.eclipse.jgit.api.CommitCommand; //导入方法依赖的package包/类
protected void commit(String comment) {
CommitCommand ci = git.commit();
ci.setMessage(comment);
ci.setAuthor(user);
ci.setCommitter(user);
try {
ci.call();
} catch (GitAPIException e) {
throw new RuntimeException(e);
}
}
示例4: createMember
import org.eclipse.jgit.api.CommitCommand; //导入方法依赖的package包/类
@Override
public void createMember(RequestContext ctx, ResourceState state, Responder responder) throws Exception {
String commitMsg = state.getPropertyAsString("msg");
Boolean includeUntracked = state.getPropertyAsBoolean("include-untracked");
if (includeUntracked == null) {
// Default to include all untracked files
includeUntracked = Boolean.TRUE;
}
// Add changed files to staging ready for commit
AddCommand addCmd = parent.git().add().addFilepattern(".");
if (!includeUntracked) {
// This will prevent new files from being added to the index, and therefore the commit
addCmd.setUpdate(true);
}
// Commit staged changes
RevCommit commit;
CommitCommand commitCmd = parent.git().commit();
if (ctx.securityContext() != null) {
UserProfile user = ctx.securityContext().getUser();
if (user != null && user.name() != null && user.email() != null) {
commitCmd.setCommitter(user.name(), user.email());
}
}
if (commitMsg != null) {
commitCmd.setMessage(commitMsg);
}
commit = GitHandler.commit(() -> {
addCmd.call();
return commitCmd.call();
});
responder.resourceCreated(new GitCommitResource(this, commit));
}
示例5: commit
import org.eclipse.jgit.api.CommitCommand; //导入方法依赖的package包/类
/** {@inheritDoc} */
public void commit(String message) throws GitException {
try (Repository repo = getRepository()) {
CommitCommand cmd = git(repo).commit().setMessage(message);
if (author!=null)
cmd.setAuthor(author);
if (committer!=null)
cmd.setCommitter(new PersonIdent(committer,new Date()));
cmd.call();
} catch (GitAPIException e) {
throw new GitException(e);
}
}