Java 类org.eclipse.jgit.api.RemoteSetUrlCommand 实例源码

项目:app-runner    文件:BackupService.java   
public static BackupService prepare(File localDir, URIish remoteUri) throws GitAPIException, IOException {
    Git local;
    try {
        local = Git.open(localDir);
    } catch (RepositoryNotFoundException e) {
        log.info("Initialising " + fullPath(localDir) + " as a git repo for backup purposes");
        local = Git.init().setDirectory(localDir).setBare(false).call();
    }
    log.info("Setting backup URL to " + remoteUri);
    if (local.remoteList().call().stream().anyMatch(remoteConfig -> remoteConfig.getName().equals("origin"))) {
        RemoteSetUrlCommand remoteSetUrlCommand = local.remoteSetUrl();
        remoteSetUrlCommand.setName("origin");
        remoteSetUrlCommand.setUri(remoteUri);
        remoteSetUrlCommand.call();
    } else {
        RemoteAddCommand remoteAddCommand = local.remoteAdd();
        remoteAddCommand.setName("origin");
        remoteAddCommand.setUri(remoteUri);
        remoteAddCommand.call();
    }

    URL inputUrl = BackupService.class.getResource("/dataDirGitIgnore.txt");
    FileUtils.copyURLToFile(inputUrl, new File(localDir, ".gitignore"));

    return new BackupService(local, remoteUri.toString());
}
项目:spring-cloud-release-tools    文件:GitTestUtils.java   
public static void setOriginOnProjectToTmp(File origin, File project)
        throws GitAPIException, MalformedURLException {
    try(Git git = openGitProject(project)) {
        RemoteRemoveCommand remove = git.remoteRemove();
        remove.setName("origin");
        remove.call();
        RemoteSetUrlCommand command = git.remoteSetUrl();
        command.setUri(new URIish(origin.toURI().toURL()));
        command.setName("origin");
        command.setPush(true);
        command.call();
    }
}
项目:spring-cloud-release-tools    文件:GitTestUtils.java   
public static void setOriginOnProjectToTmp(File origin, File project)
        throws GitAPIException, MalformedURLException {
    try(Git git = openGitProject(project)) {
        RemoteRemoveCommand remove = git.remoteRemove();
        remove.setName("origin");
        remove.call();
        RemoteSetUrlCommand command = git.remoteSetUrl();
        command.setUri(new URIish(origin.toURI().toURL()));
        command.setName("origin");
        command.setPush(true);
        command.call();
    }
}
项目:github-bucket    文件:Config.java   
default RemoteSetUrlCommand configure(RemoteSetUrlCommand cmd, URIish uri, boolean push) {
    return cmd;
}
项目:github-bucket    文件:Config.java   
default RemoteSetUrlCommand configure(RemoteSetUrlCommand cmd, SyncableRepository repo, boolean push) {
    return configure(cmd, repo.getUri(), push);
}