当前位置: 首页>>代码示例>>Java>>正文


Java CommitCommand.setCommitter方法代码示例

本文整理汇总了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();
}
 
开发者ID:Verigreen,项目名称:verigreen,代码行数:17,代码来源:JGitOperator.java

示例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();
    });
}
 
开发者ID:liveoak-io,项目名称:liveoak,代码行数:20,代码来源:GitHelper.java

示例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);
	}
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:12,代码来源:AbstractGitTest.java

示例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));
}
 
开发者ID:liveoak-io,项目名称:liveoak,代码行数:41,代码来源:CommitsResource.java

示例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);
    }
}
 
开发者ID:jenkinsci,项目名称:git-client-plugin,代码行数:14,代码来源:JGitAPIImpl.java


注:本文中的org.eclipse.jgit.api.CommitCommand.setCommitter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。