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

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

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

Git.reflog介绍

[英]Return a command object to execute a reflog command
[中]返回命令对象以执行reflog命令

代码示例

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

@Signature
public Memory reflog(Memory ref) throws GitAPIException {
  ReflogCommand command = getWrappedObject().reflog();
  if (ref.isNotNull()) {
    command.setRef(ref.toString());
  }
  Collection<ReflogEntry> call = command.call();
  return GitUtils.valueOfReflogEntries(call);
}

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

private static void listReflog(Repository repository, Ref ref) throws GitAPIException {
    /*
     * Ref head = repository.getRef(ref.getName());
     * RevWalk walk = new RevWalk(repository);
     * RevCommit commit = walk.parseCommit(head.getObjectId());
     */

    try (Git git = new Git(repository)) {
      Collection<ReflogEntry> call = git.reflog().setRef(ref.getName()).call();
      for (ReflogEntry reflog : call) {
        System.out.println("Reflog: " + reflog);
      }
    }
  }
}

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

private static void listReflog(Repository repository, Ref ref) throws GitAPIException {
    /*
     * Ref head = repository.getRef(ref.getName());
     * RevWalk walk = new RevWalk(repository);
     * RevCommit commit = walk.parseCommit(head.getObjectId());
     */

    try (Git git = new Git(repository)) {
      Collection<ReflogEntry> call = git.reflog().setRef(ref.getName()).call();
      for (ReflogEntry reflog : call) {
        System.out.println("Reflog: " + reflog);
      }
    }
  }
}

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

public Object[] getElements(Object inputElement) {
  if (inputElement instanceof ReflogInput) {
    ReflogInput input = (ReflogInput) inputElement;
    ReflogCommand command = new Git(input.repository).reflog();
    command.setRef(input.ref);
    try {
      return command.call().toArray();
    } catch (Exception e) {
      Activator.logError("Error running reflog command", e); //$NON-NLS-1$
    }
  }
  return new Object[0];
}

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

@Override
protected void run() throws Exception {
  ReflogCommand cmd = new Git(db).reflog();
  if (ref != null)
    cmd.setRef(ref);
  Collection<ReflogEntry> entries = cmd.call();
  int i = 0;
  for (ReflogEntry entry : entries) {
    outw.println(toString(entry, i++));
  }
}

相关文章