org.eclipse.jgit.api.Git.stashCreate()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(4.9k)|赞(0)|评价(0)|浏览(154)

本文整理了Java中org.eclipse.jgit.api.Git.stashCreate()方法的一些代码示例,展示了Git.stashCreate()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Git.stashCreate()方法的具体详情如下:
包路径:org.eclipse.jgit.api.Git
类名称:Git
方法名:stashCreate

Git.stashCreate介绍

[英]Return a command object used to create a stashed commit
[中]返回用于创建隐藏提交的命令对象

代码示例

代码示例来源:origin: jphp-group/jphp

@Signature
public Memory stashCreate(ArrayMemory settings) throws GitAPIException {
  StashCreateCommand command = getWrappedObject().stashCreate();
  if (settings != null) {
    command.setIncludeUntracked(settings.valueOfIndex("includeUntracked").toBoolean());
    Memory indexMessage = settings.valueOfIndex("indexMessage");
    if (indexMessage.isNotNull()) {
      command.setIndexMessage(indexMessage.toString());
    }
    Memory ref = settings.valueOfIndex("ref");
    if (ref.isNotNull()) {
      command.setRef(ref.toString());
    }
    Memory workingDirectoryMessage = settings.valueOfIndex("workingDirectoryMessage");
    if (workingDirectoryMessage.isNotNull()) {
      command.setWorkingDirectoryMessage(workingDirectoryMessage.toString());
    }
  }
  return GitUtils.valueOf(command.call());
}

代码示例来源:origin: centic9/jgit-cookbook

RevCommit stash = git.stashCreate()
    .call();
stash = git.stashCreate()
    .call();

代码示例来源:origin: centic9/jgit-cookbook

RevCommit stash = git.stashCreate()
    .call();
stash = git.stashCreate()
    .call();

代码示例来源:origin: org.eclipse.jgit/org.eclipse.jgit

private void autoStash() throws GitAPIException, IOException {
  if (repo.getConfig().getBoolean(ConfigConstants.CONFIG_REBASE_SECTION,
      ConfigConstants.CONFIG_KEY_AUTOSTASH, false)) {
    String message = MessageFormat.format(
            AUTOSTASH_MSG,
            Repository
                .shortenRefName(getHeadName(getHead())));
    RevCommit stashCommit = Git.wrap(repo).stashCreate().setRef(null)
        .setWorkingDirectoryMessage(
            message)
        .call();
    if (stashCommit != null) {
      FileUtils.mkdir(rebaseState.getDir());
      rebaseState.createFile(AUTOSTASH, stashCommit.getName());
    }
  }
}

代码示例来源:origin: org.jboss.forge.addon/git-impl

@Override
public void stashCreate(final Git repo) throws GitAPIException
{
 repo.stashCreate().call();
}

代码示例来源:origin: org.apereo.cas/cas-mgmt-support-version-control

private void createStashIfNeeded() throws GitAPIException {
  if (!git.status().call().isClean()) {
    git.stashCreate().call();
  }
}

代码示例来源:origin: alien4cloud/alien4cloud

public static void stash(Path repositoryDirectory, String stashId) {
  Git git = null;
  try {
    log.debug("Stashing change from <" + repositoryDirectory + "> to stash <" + stashId + ">");
    git = Git.open(repositoryDirectory.toFile());
    Collection<RevCommit> stashes = git.stashList().call();
    int stashIndex = 0;
    for (RevCommit stash : stashes) {
      if (stash.getFullMessage().equals(stashId)) {
        git.stashDrop().setStashRef(stashIndex).call();
        log.warn("Stash <" + stashId + "> was already existing in <" + repositoryDirectory + ">. It has been deleted.");
        break;
      }
      stashIndex++;
    }
    git.stashCreate().setIncludeUntracked(true).setWorkingDirectoryMessage(stashId).call();
  } catch (IOException | GitAPIException e) {
    throw new GitException("Failed to stash data", e);
  } finally {
    close(git);
  }
}

代码示例来源:origin: io.hawt/hawtio-git

git.stashCreate().setPerson(personIdent).setWorkingDirectoryMessage("Stash before a write").setRef("HEAD").call();

代码示例来源:origin: io.fabric8.forge/fabric8-forge-core

git.stashCreate().setPerson(personIdent).setWorkingDirectoryMessage("Stash before a write").setRef("HEAD").call();
} catch (Throwable e) {
  LOG.error("Failed to stash changes: " + e, e);

代码示例来源:origin: berlam/github-bucket

private void autoStash() throws GitAPIException, IOException {
  if (repo.getConfig().getBoolean(ConfigConstants.CONFIG_REBASE_SECTION,
      ConfigConstants.CONFIG_KEY_AUTOSTASH, false)) {
    String message = MessageFormat.format(
            AUTOSTASH_MSG,
            Repository
                .shortenRefName(getHeadName(getHead())));
    RevCommit stashCommit = Git.wrap(repo).stashCreate().setRef(null)
        .setWorkingDirectoryMessage(
            message)
        .call();
    if (stashCommit != null) {
      FileUtils.mkdir(rebaseState.getDir());
      rebaseState.createFile(AUTOSTASH, stashCommit.getName());
    }
  }
}

代码示例来源:origin: sonia.jgit/org.eclipse.jgit

private void autoStash() throws GitAPIException, IOException {
  if (repo.getConfig().getBoolean(ConfigConstants.CONFIG_REBASE_SECTION,
      ConfigConstants.CONFIG_KEY_AUTOSTASH, false)) {
    String message = MessageFormat.format(
            AUTOSTASH_MSG,
            Repository
                .shortenRefName(getHeadName(getHead())));
    RevCommit stashCommit = Git.wrap(repo).stashCreate().setRef(null)
        .setWorkingDirectoryMessage(
            message)
        .call();
    if (stashCommit != null) {
      FileUtils.mkdir(rebaseState.getDir());
      rebaseState.createFile(AUTOSTASH, stashCommit.getName());
    }
  }
}

代码示例来源:origin: io.fabric8.forge/fabric8-forge-core

git.stashCreate().setPerson(personIdent).setWorkingDirectoryMessage("Stash before a write").setRef("HEAD").call();
} catch (Throwable e) {
  LOG.error("Failed to stash changes: " + e, e);

代码示例来源:origin: org.openmrs.maven.plugins/openmrs-sdk-maven-plugin

stash = git.stashCreate().call();
gitHelper.addRemoteUpstream(git, path);
pullFromRemoteUpstream(git, stash, newBranch, userBranch);

相关文章