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


Java AddCommand.setUpdate方法代码示例

本文整理汇总了Java中org.eclipse.jgit.api.AddCommand.setUpdate方法的典型用法代码示例。如果您正苦于以下问题:Java AddCommand.setUpdate方法的具体用法?Java AddCommand.setUpdate怎么用?Java AddCommand.setUpdate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.jgit.api.AddCommand的用法示例。


在下文中一共展示了AddCommand.setUpdate方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addFiles

import org.eclipse.jgit.api.AddCommand; //导入方法依赖的package包/类
/**
 * Adds the files returned from {@link #filePatternGetter} and then calls {@link #updateFiles(List)}
 */
public final void addFiles() {
    try {
        AddCommand addCmd = git.getOrThrow().add();
        // insure add command will add newly staged files
        addCmd.setUpdate(false);

        // add files
        List<String> files = filePatternGetter.get();
        files.forEach(addCmd::addFilepattern);

        addCmd.call();

        updateFiles(files);
    } catch (GitAPIException e) {
        handleGitAPIException(e);
    }
}
 
开发者ID:JordanMartinez,项目名称:JGitFX,代码行数:21,代码来源:AddMenuItem.java

示例2: createMember

import org.eclipse.jgit.api.AddCommand; //导入方法依赖的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

示例3: addFiles

import org.eclipse.jgit.api.AddCommand; //导入方法依赖的package包/类
/**
 * Add (stage) files to the index.
 * @param git the git repository
 * @param relativePaths the relative paths of the files to add
 * @param excludeNewFiles if true, any untracked files in {@code relativePaths} will not be added (they won't
 *                        become "tracked" at the end of the call).
 * @throws GitAPIException
 */
public static void addFiles(Git git, List<String> relativePaths, boolean excludeNewFiles) throws GitAPIException {
    AddCommand adder = git.add();
    adder.setUpdate(excludeNewFiles);
    relativePaths.forEach(adder::addFilepattern);
    adder.call();
}
 
开发者ID:JordanMartinez,项目名称:JGitFX,代码行数:15,代码来源:GitHelper.java


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