Package org.eclipse.jgit.transport

Examples of org.eclipse.jgit.transport.RemoteConfig.update()


    Git localGit = new Git(localRepository);
    StoredConfig config = localRepository.getConfig();
    RemoteConfig rc = new RemoteConfig(config, "origin");
    rc.addURI(new URIish(remoteRepository.getDirectory().getAbsolutePath()));
    rc.addFetchRefSpec(new RefSpec("+refs/heads/*:refs/remotes/origin/*"));
    rc.update(config);
    config.save();
    FetchResult res = localGit.fetch().setRemote("origin").call();
    assertFalse(res.getTrackingRefUpdates().isEmpty());
    rup = localRepository.updateRef("refs/heads/master");
    rup.setNewObjectId(initialCommit.getId());
View Full Code Here


    // 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

    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

    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

    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

    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

    // 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

    // 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();
  }

  @Test
  public void testFetch() throws JGitInternalException, IOException,
View Full Code Here

    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();
  }

  private FetchResult runFetch() throws URISyntaxException, IOException {
    final Transport tn = Transport.open(db, remoteName);
View Full Code Here

    // 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

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.