【问题标题】:Is there a way to test if anyone pushed to the remote repo using JGit from local repo?有没有办法测试是否有人使用 JGit 从本地仓库推送到远程仓库?
【发布时间】:2014-04-06 00:24:20
【问题描述】:

我正在用 Java 设计一个用户界面,并且我正在尝试制作我自己的 buildbot 之类的东西。所以为此我想在 JGit 中创建一个类似于 buildbot 的 gitpoller 的函数。有可能吗?

【问题讨论】:

    标签: java jgit buildbot


    【解决方案1】:

    是的,这是可能的。您可以使用 FetchCommand,然后检查 FetchResult。像这样的:

    Repository repository = FileRepositoryBuilder.create(gitDir);
    Git git = Git.wrap(repository);
    FetchResult result = git.fetch().call();
    for (TrackingRefUpdate refUpdate : result.getTrackingRefUpdates()) {
        // ...
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-02-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-04-25
      • 2018-12-05
      • 2011-07-08
      相关资源
      最近更新 更多