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

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

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

Git.stashDrop介绍

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

代码示例

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

@Signature
public Memory stashDrop(ArrayMemory settings) throws GitAPIException {
  StashDropCommand command = getWrappedObject().stashDrop();
  if (settings != null) {
    command.setAll(settings.valueOfIndex("all").toBoolean());
    Memory stashRef = settings.valueOfIndex("stashRef");
    if (stashRef.isNotNull()) {
      command.setStashRef(stashRef.toInteger());
    }
  }
  return GitUtils.valueOf(command.call());
}

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

ObjectId call = git.stashDrop().setStashRef(0).call();
System.out.println("StashDrop returned: " + call);

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

ObjectId call = git.stashDrop().setStashRef(0).call();
System.out.println("StashDrop returned: " + call);

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

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

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

public static void dropStash(Path repositoryDirectory, String stashId){
  Git git = null;
  try {
    git = Git.open(repositoryDirectory.toFile());
    int stashIndex = 0;
    Collection<RevCommit> stashes = git.stashList().call();
    for (RevCommit stash : stashes) {
      if (stash.getFullMessage().equals(stashId)) {
        git.stashDrop().setStashRef(stashIndex).call();
        log.debug("Stash <" + stashId + ">  has been dropped on <" + repositoryDirectory + ">");
      }
      stashIndex++;
    }
  } catch (IOException | GitAPIException e) {
    throw new GitException("Failed to apply then drop stash", e);
  } finally {
    close(git);
  }
}

代码示例来源: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: alien4cloud/alien4cloud

public static void applyStashThenDrop(Path repositoryDirectory, String stashId) {
  Git git = null;
  try {
    git = Git.open(repositoryDirectory.toFile());
    int stashIndex = 0;
    Collection<RevCommit> stashes = git.stashList().call();
    for (RevCommit stash : stashes) {
      if (stash.getFullMessage().equals(stashId)) {
        git.stashApply().setStashRef(stash.getName()).call();
        git.stashDrop().setStashRef(stashIndex).call();
        log.debug("Stash <" + stashId + ">  applied/dropped on <" + repositoryDirectory + ">");
        break;
      }
      stashIndex++;
    }
  } catch (IOException | GitAPIException e) {
    throw new GitException("Failed to apply then drop stash", e);
  } finally {
    close(git);
  }
}

相关文章