Package org.eclipse.jgit.lib

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


    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


    reader.close();
    assertEquals(
        "The first line of .gitmodules file should be as expected",
        "[submodule \"foo\"]", content);
    // The gitlink should be the same as remote head sha1
    String gitlink = localDb.resolve(Constants.HEAD + ":foo").name();
    String remote = defaultDb.resolve(Constants.HEAD).name();
    assertEquals("The gitlink should be the same as remote head",
        remote, gitlink);
  }
View Full Code Here

      .setDirectory(directory)
      .setURI(remoteDb.getDirectory().toURI().toString())
      .call()
      .getRepository();
    // The gitlink should be the same as oldCommitId
    String gitlink = localDb.resolve(Constants.HEAD + ":foo").name();
    assertEquals("The gitlink is same as remote head",
        oldCommitId.name(), gitlink);
  }

  @Test
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

    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

    SubmoduleWalk generator = SubmoduleWalk.forIndex(db);
    assertTrue(generator.next());
    Repository subRepo = generator.getRepository();
    addRepoToClose(subRepo);
    assertNotNull(subRepo);
    assertEquals(commit, subRepo.resolve(Constants.HEAD));
  }

  @Test
  public void repositoryWithUnconfiguredSubmodule() throws IOException,
      GitAPIException {
View Full Code Here

    JSONObject toPut = requestInfo.getJSONRequest();
    RevWalk walk = new RevWalk(db);
    try {
      String tagName = toPut.getString(ProtocolConstants.KEY_NAME);
      String commitId = toPut.getString(GitConstants.KEY_TAG_COMMIT);
      ObjectId objectId = db.resolve(commitId);
      RevCommit revCommit = walk.lookupCommit(objectId);

      Ref ref = tag(git, revCommit, tagName);
      URI cloneLocation = BaseToCloneConverter.getCloneLocation(getURI(request), BaseToCloneConverter.TAG_LIST);
      Tag tag = new Tag(cloneLocation, db, ref);
View Full Code Here

            if (commitsSize == 0) {
              newChildren.put(branch);
            } else {
              LogCommand lc = git.log();
              String branchName = branch.getString(ProtocolConstants.KEY_ID);
              ObjectId toObjectId = db.resolve(branchName);
              Ref toRefId = db.getRef(branchName);
              if (toObjectId == null) {
                String msg = NLS.bind("No ref or commit found: {0}", branchName);
                return new ServerStatus(IStatus.ERROR, HttpServletResponse.SC_NOT_FOUND, msg, null);
              }
View Full Code Here

          children.put(tag.toJSON());
        } else {
          // add info about commits if requested
          LogCommand lc = git.log();
          String toCommitName = tag.getRevCommitName();
          ObjectId toCommitId = db.resolve(toCommitName);
          Ref toCommitRef = db.getRef(toCommitName);
          toCommitId = getCommitObjectId(db, toCommitId);
          lc.add(toCommitId);
          lc.setMaxCount(this.commitsSize);
          Iterable<RevCommit> commits = lc.call();
View Full Code Here

        String ReviewReqAuthorName = requestObject.optString(GitConstants.KEY_REVIEW_REQ_AUTHOR_NAME);
        String ReviewMessage = requestObject.optString(GitConstants.KEY_REVIEW_REQ_MESSAGE);
        return sendNotification(request, response, db, reviewReqLogin, ReviewReqCommit, reviewReqUrl, ReviewReqAuthorName, ReviewMessage);
      }

      ObjectId refId = db.resolve(gitSegment);
      if (refId == null || !Constants.HEAD.equals(gitSegment)) {
        String msg = NLS.bind("Commit failed. Ref must be HEAD and is {0}", gitSegment);
        return statusHandler.handleRequest(request, response, new ServerStatus(IStatus.ERROR, HttpServletResponse.SC_BAD_REQUEST, msg, null));
      }
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.