Package org.eclipse.jgit.transport

Examples of org.eclipse.jgit.transport.RefSpec


    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();
View Full Code Here


    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");
View Full Code Here

    Git git2 = new Git(db2);

    // push master (with a new commit) to the remote
    git1.commit().setMessage("initial commit").call();

    RefSpec spec = new RefSpec("refs/heads/*:refs/heads/*");
    git1.push().setRemote("test").setRefSpecs(spec).call();

    // create an unrelated ref and a commit on our remote
    git2.branchCreate().setName("refs/heads/other").call();
    git2.checkout().setName("refs/heads/other").call();
View Full Code Here

  @Test
  public void fetchShouldAutoFollowTagForFetchedObjects() throws Exception {
    remoteGit.commit().setMessage("commit").call();
    Ref tagRef = remoteGit.tag().setName("foo").call();
    remoteGit.commit().setMessage("commit2").call();
    RefSpec spec = new RefSpec("refs/heads/*:refs/remotes/origin/*");
    git.fetch().setRemote("test").setRefSpecs(spec)
        .setTagOpt(TagOpt.AUTO_FOLLOW).call();
    assertEquals(tagRef.getObjectId(), db.resolve("foo"));
  }
View Full Code Here

  public void fetchShouldNotFetchTagsFromOtherBranches() throws Exception {
    remoteGit.commit().setMessage("commit").call();
    remoteGit.checkout().setName("other").setCreateBranch(true).call();
    remoteGit.commit().setMessage("commit2").call();
    remoteGit.tag().setName("foo").call();
    RefSpec spec = new RefSpec(
        "refs/heads/master:refs/remotes/origin/master");
    git.fetch().setRemote("test").setRefSpecs(spec)
        .setTagOpt(TagOpt.AUTO_FOLLOW).call();
    assertNull(db.resolve("foo"));
  }
View Full Code Here

    final String tagName = "foo";
    remoteGit.commit().setMessage("commit").call();
    Ref tagRef = remoteGit.tag().setName(tagName).call();
    ObjectId originalId = tagRef.getObjectId();

    RefSpec spec = new RefSpec("refs/heads/*:refs/remotes/origin/*");
    git.fetch().setRemote("test").setRefSpecs(spec)
        .setTagOpt(TagOpt.AUTO_FOLLOW).call();
    assertEquals(originalId, db.resolve(tagName));

    remoteGit.commit().setMessage("commit 2").call();
View Full Code Here

  public void fetchWithExplicitTagsShouldUpdateLocal() throws Exception {
    final String tagName = "foo";
    remoteGit.commit().setMessage("commit").call();
    Ref tagRef1 = remoteGit.tag().setName(tagName).call();

    RefSpec spec = new RefSpec("refs/heads/*:refs/remotes/origin/*");
    git.fetch().setRemote("test").setRefSpecs(spec)
        .setTagOpt(TagOpt.AUTO_FOLLOW).call();
    assertEquals(tagRef1.getObjectId(), db.resolve(tagName));

    remoteGit.commit().setMessage("commit 2").call();
View Full Code Here

  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

    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();
    return db2;
  }
View Full Code Here

            .getConfig()
            .getString(ConfigConstants.CONFIG_BRANCH_SECTION,
                "test", ConfigConstants.CONFIG_KEY_MERGE));
    assertEquals(2, git2.branchList().setListMode(ListMode.REMOTE).call()
        .size());
    assertEquals(new RefSpec("+refs/heads/*:refs/remotes/origin/*"),
        fetchRefSpec(git2.getRepository()));
  }
 
View Full Code Here

TOP

Related Classes of org.eclipse.jgit.transport.RefSpec

Copyright © 2018 www.massapicom. 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.