Package org.eclipse.jgit.lib

Examples of org.eclipse.jgit.lib.Repository.resolve()


    fetchResult = fetchFromBundle(newRepo, bundle);
    advertisedRef = fetchResult.getAdvertisedRef("refs/heads/cc");
    assertEquals(db.resolve("c").name(), advertisedRef.getObjectId().name());
    assertEquals(db.resolve("c").name(), newRepo.resolve("refs/heads/cc")
        .name());
    assertNull(newRepo.resolve("refs/heads/c"));
    assertNull(newRepo.resolve("refs/heads/a")); // still unknown

    try {
      // Check that we actually needed the first bundle
      Repository newRepo2 = createBareRepository();
View Full Code Here


    advertisedRef = fetchResult.getAdvertisedRef("refs/heads/cc");
    assertEquals(db.resolve("c").name(), advertisedRef.getObjectId().name());
    assertEquals(db.resolve("c").name(), newRepo.resolve("refs/heads/cc")
        .name());
    assertNull(newRepo.resolve("refs/heads/c"));
    assertNull(newRepo.resolve("refs/heads/a")); // still unknown

    try {
      // Check that we actually needed the first bundle
      Repository newRepo2 = createBareRepository();
      fetchResult = fetchFromBundle(newRepo2, bundle);
View Full Code Here

    assertFalse(new File(db.getDirectory(), "logs/refs/heads/b").exists());

    // Create new Repository instance, to reread caches and make sure our
    // assumptions are persistent.
    Repository ndb = new FileRepository(db.getDirectory());
    assertEquals(rb2, ndb.resolve("refs/heads/new/name"));
    assertNull(ndb.resolve("refs/heads/b"));
  }

  public void tryRenameWhenLocked(String toLock, String fromName,
      String toName, String headPointsTo) throws IOException {
View Full Code Here

    // Create new Repository instance, to reread caches and make sure our
    // assumptions are persistent.
    Repository ndb = new FileRepository(db.getDirectory());
    assertEquals(rb2, ndb.resolve("refs/heads/new/name"));
    assertNull(ndb.resolve("refs/heads/b"));
  }

  public void tryRenameWhenLocked(String toLock, String fromName,
      String toName, String headPointsTo) throws IOException {
    // setup
View Full Code Here

        final String[] parts = line.split(";", 2);
        final String sha = parts[0];
        final String version = parts[1];

        final String tag = MessageFormat.format(releaseConvention.getTagFormat(), version);
        if (repo.resolve(tag) != null) {
            log.info("Deleting tag: " + tag);
            git.tagDelete().setTags(tag).call();
        }

        git.reset().setMode(ResetCommand.ResetType.HARD).setRef(sha).call();
View Full Code Here

  public ObjectId getHead() throws IOException {
    Repository subRepo = getRepository();
    if (subRepo == null)
      return null;
    try {
      return subRepo.resolve(Constants.HEAD);
    } finally {
      subRepo.close();
    }
  }
View Full Code Here

    Repository subRepo = generator.getRepository();
    if (subRepo == null)
      return new SubmoduleStatus(SubmoduleStatusType.UNINITIALIZED, path,
          id);

    ObjectId headId = subRepo.resolve(Constants.HEAD);

    // Report uninitialized if no HEAD commit in submodule repository
    if (headId == null)
      return new SubmoduleStatus(SubmoduleStatusType.UNINITIALIZED, path,
          id, headId);
View Full Code Here

    if (submoduleRepo == null)
      return zeroid;

    final ObjectId head;
    try {
      head = submoduleRepo.resolve(Constants.HEAD);
    } catch (IOException exception) {
      return zeroid;
    } finally {
      submoduleRepo.close();
    }
View Full Code Here

   * @return object id of HEAD reference
   * @throws IOException
   */
  public ObjectId getHead() throws IOException {
    Repository subRepo = getRepository();
    return subRepo != null ? subRepo.resolve(Constants.HEAD) : null;
  }

  /**
   * Get ref that HEAD points to in the current submodule's repository
   *
 
View Full Code Here

    public static void main(String[] args) throws IOException, InvalidRemoteException, TransportException, GitAPIException {
        Repository repository = cloneRepository();

        System.out.println("Having repository: " + repository.getDirectory() + " with head: " +
                repository.getRef(Constants.HEAD) + "/" + repository.resolve("HEAD") + "/" +
                repository.resolve("refs/heads/master"));

        // TODO: why do we get null here for HEAD?!? See also
// http://stackoverflow.com/questions/17979660/jgit-pull-noheadexception
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.