首页 > 解决方案 > 如何使用 javahg 从远程 Mercurial 存储库获取传入的更改?

问题描述

我正在尝试编写一个示例程序,该程序使用 javahg 来获取有关项目存储库的信息。我在 Windows 客户端上运行,远程存储库在 Linux 服务器上。但是,当我尝试获取传入的更改时,它会挂起或给我一个空包。

class Mercurial {

static void main(String[] args) {
    def projectDir = 'c:/my-workbench/my-project'

    RepositoryConfiguration repoConfig = new RepositoryConfiguration()
    repoConfig.hgBin = 'c:/Program Files/TortoiseHg/hg.exe'
    repoConfig.sshBin = 'c:/opt/putty/plink.exe'

    repoConfig.hgrcPath = null 
    //repoConfig.hgrcPath = 'c:/users/david/mercurial.ini' //nothing changes

    def localRepo = Repository.open(repoConfig, new File(projectDir))

    IncomingCommand incoming = IncomingCommand.on(localRepo)

    //this is the content of the HGRC file in the .hg folder
    def remoteRepoURL = 'ssh://hg@9.9.9.9/my-project')

    def bundle = incoming.execute(remoteRepoURL)
}

相反,如果我克隆远程存储库,一切都很好,所以配置应该是正确的。

    BaseRepository br = BaseRepository.clone(repoConfig, new File('c:/temp/local'), remoteRepoURL)

如何从远程存储库获取传入的更改?

标签: mercurialjavahg

解决方案


推荐阅读