Examples of RemoteConfig


Examples of org.eclipse.jgit.transport.RemoteConfig

    // create other repository
    Repository db2 = createWorkRepository();

    // setup the first repository
    final StoredConfig config = db.getConfig();
    RemoteConfig remoteConfig = new RemoteConfig(config, "test");
    URIish uri = new URIish(db2.getDirectory().toURI().toURL());
    remoteConfig.addURI(uri);
    remoteConfig.update(config);
    config.save();

    Git git1 = new Git(db);
    // create some refs via commits and tag
    RevCommit commit = git1.commit().setMessage("initial commit").call();
View Full Code Here

Examples of org.eclipse.jgit.transport.RemoteConfig

    RefUpdate trackingBranchRefUpdate = db.updateRef(trackingBranch);
    trackingBranchRefUpdate.setNewObjectId(commit1.getId());
    trackingBranchRefUpdate.update();

    final StoredConfig config = db.getConfig();
    RemoteConfig remoteConfig = new RemoteConfig(config, remote);
    URIish uri = new URIish(db2.getDirectory().toURI().toURL());
    remoteConfig.addURI(uri);
    remoteConfig.addFetchRefSpec(new RefSpec("+refs/heads/*:refs/remotes/"
        + remote + "/*"));
    remoteConfig.update(config);
    config.save();


    RevCommit commit2 = git.commit().setMessage("Commit to push").call();

View Full Code Here

Examples of org.eclipse.jgit.transport.RemoteConfig

  public void testPushRefUpdate() throws Exception {
    Git git = new Git(db);
    Git git2 = new Git(createBareRepository());

    final StoredConfig config = git.getRepository().getConfig();
    RemoteConfig remoteConfig = new RemoteConfig(config, "test");
    URIish uri = new URIish(git2.getRepository().getDirectory().toURI()
        .toURL());
    remoteConfig.addURI(uri);
    remoteConfig.addPushRefSpec(new RefSpec("+refs/heads/*:refs/heads/*"));
    remoteConfig.update(config);
    config.save();

    writeTrashFile("f", "content of f");
    git.add().addFilepattern("f").call();
    RevCommit commit = git.commit().setMessage("adding f").call();
View Full Code Here

Examples of org.eclipse.jgit.transport.RemoteConfig

  public void testPushWithRefSpecFromConfig() throws Exception {
    Git git = new Git(db);
    Git git2 = new Git(createBareRepository());

    final StoredConfig config = git.getRepository().getConfig();
    RemoteConfig remoteConfig = new RemoteConfig(config, "test");
    URIish uri = new URIish(git2.getRepository().getDirectory().toURI()
        .toURL());
    remoteConfig.addURI(uri);
    remoteConfig.addPushRefSpec(new RefSpec("HEAD:refs/heads/newbranch"));
    remoteConfig.update(config);
    config.save();

    writeTrashFile("f", "content of f");
    git.add().addFilepattern("f").call();
    RevCommit commit = git.commit().setMessage("adding f").call();
View Full Code Here

Examples of org.eclipse.jgit.transport.RemoteConfig

  public void testPushWithoutPushRefSpec() throws Exception {
    Git git = new Git(db);
    Git git2 = new Git(createBareRepository());

    final StoredConfig config = git.getRepository().getConfig();
    RemoteConfig remoteConfig = new RemoteConfig(config, "test");
    URIish uri = new URIish(git2.getRepository().getDirectory().toURI()
        .toURL());
    remoteConfig.addURI(uri);
    remoteConfig.addFetchRefSpec(new RefSpec(
        "+refs/heads/*:refs/remotes/origin/*"));
    remoteConfig.update(config);
    config.save();

    writeTrashFile("f", "content of f");
    git.add().addFilepattern("f").call();
    RevCommit commit = git.commit().setMessage("adding f").call();
View Full Code Here

Examples of org.eclipse.jgit.transport.RemoteConfig

    // create other repository
    Repository db2 = createWorkRepository();

    // setup the first repository
    final StoredConfig config = db.getConfig();
    RemoteConfig remoteConfig = new RemoteConfig(config, "test");
    URIish uri = new URIish(db2.getDirectory().toURI().toURL());
    remoteConfig.addURI(uri);
    remoteConfig.update(config);
    config.save();

    Git git1 = new Git(db);
    Git git2 = new Git(db2);
View Full Code Here

Examples of org.eclipse.jgit.transport.RemoteConfig

    Repository remoteRepository = createWorkRepository();
    remoteGit = new Git(remoteRepository);

    // setup the first repository to fetch from the second repository
    final StoredConfig config = db.getConfig();
    RemoteConfig remoteConfig = new RemoteConfig(config, "test");
    URIish uri = new URIish(remoteRepository.getDirectory().toURI().toURL());
    remoteConfig.addURI(uri);
    remoteConfig.update(config);
    config.save();
  }
View Full Code Here

Examples of org.eclipse.jgit.transport.RemoteConfig

  }

  private void saveRemote(final URIish uri) throws URISyntaxException,
      IOException {
    final StoredConfig dstcfg = dst.getConfig();
    final RemoteConfig rc = new RemoteConfig(dstcfg, remoteName);
    rc.addURI(uri);
    rc.addFetchRefSpec(new RefSpec().setForceUpdate(true)
        .setSourceDestination(Constants.R_HEADS + "*", //$NON-NLS-1$
            Constants.R_REMOTES + remoteName + "/*")); //$NON-NLS-1$
    rc.update(dstcfg);
    dstcfg.save();
  }
View Full Code Here

Examples of org.eclipse.jgit.transport.RemoteConfig

    Repository db2 = createWorkRepository();
    Git git2 = new Git(db2);

    // setup the second repository to fetch from the first repository
    final StoredConfig config = db2.getConfig();
    RemoteConfig remoteConfig = new RemoteConfig(config, "origin");
    URIish uri = new URIish(db.getDirectory().toURI().toURL());
    remoteConfig.addURI(uri);
    remoteConfig.update(config);
    config.save();

    // fetch from first repository
    RefSpec spec = new RefSpec("+refs/heads/*:refs/remotes/origin/*");
    git2.fetch().setRemote("origin").setRefSpecs(spec).call();
 
View Full Code Here

Examples of org.eclipse.jgit.transport.RemoteConfig

    assertEquals(new RefSpec("+refs/heads/*:refs/heads/*"),
        fetchRefSpec(git2.getRepository()));
  }

  public static RefSpec fetchRefSpec(Repository r) throws URISyntaxException {
    RemoteConfig remoteConfig =
        new RemoteConfig(r.getConfig(), Constants.DEFAULT_REMOTE_NAME);
    return remoteConfig.getFetchRefSpecs().get(0);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.