Package org.eclipse.jgit.lib

Examples of org.eclipse.jgit.lib.RefUpdate.update()


    rup.setNewObjectId(initialCommit.getId());
    rup.forceUpdate();
    rup = localRepository.updateRef(Constants.HEAD);
    rup.link("refs/heads/master");
    rup.setNewObjectId(initialCommit.getId());
    rup.update();
    return localGit;
  }

  @Test
  public void testCreateAndList() throws Exception {
View Full Code Here


  @Test
  public void testCreateFromLightweightTag() throws Exception {
    RefUpdate rup = db.updateRef("refs/tags/V10");
    rup.setNewObjectId(initialCommit);
    rup.setExpectedOldObjectId(ObjectId.zeroId());
    rup.update();

    Ref branch = git.branchCreate().setName("FromLightweightTag")
        .setStartPoint("refs/tags/V10").call();
    assertEquals(initialCommit.getId(), branch.getObjectId());
View Full Code Here

    if (notesCommit != null)
      refUpdate.setExpectedOldObjectId(notesCommit);
    else
      refUpdate.setExpectedOldObjectId(ObjectId.zeroId());
    refUpdate.setNewObjectId(commit);
    refUpdate.update(walk);
  }

  /**
   * @param notesRef
   *            the ref to read notes from. Note, the default value of
View Full Code Here

    if (notesCommit != null)
      refUpdate.setExpectedOldObjectId(notesCommit);
    else
      refUpdate.setExpectedOldObjectId(ObjectId.zeroId());
    refUpdate.setNewObjectId(commit);
    refUpdate.update(walk);
  }

  /**
   * @param notesRef
   *            the ref to read notes from. Note, the default value of
View Full Code Here

  public void testNoCacheObjectIdSubclass() throws IOException {
    final String newRef = "refs/heads/abc";
    final RefUpdate ru = updateRef(newRef);
    final SubclassedId newid = new SubclassedId(ru.getNewObjectId());
    ru.setNewObjectId(newid);
    Result update = ru.update();
    assertEquals(Result.NEW, update);
    final Ref r = db.getAllRefs().get(newRef);
    assertNotNull(r);
    assertEquals(newRef, r.getName());
    assertNotNull(r.getObjectId());
View Full Code Here

  @Test
  public void testNewNamespaceConflictWithLoosePrefixNameExists()
      throws IOException {
    final String newRef = "refs/heads/z";
    final RefUpdate ru = updateRef(newRef);
    Result update = ru.update();
    assertEquals(Result.NEW, update);
    // end setup
    final String newRef2 = "refs/heads/z/a";
    final RefUpdate ru2 = updateRef(newRef2);
    Result update2 = ru2.update();
View Full Code Here

    Result update = ru.update();
    assertEquals(Result.NEW, update);
    // end setup
    final String newRef2 = "refs/heads/z/a";
    final RefUpdate ru2 = updateRef(newRef2);
    Result update2 = ru2.update();
    assertEquals(Result.LOCK_FAILURE, update2);
    assertEquals(1, db.getReflogReader("refs/heads/z").getReverseEntries().size());
    assertEquals(0, db.getReflogReader("HEAD").getReverseEntries().size());
  }
View Full Code Here

  @Test
  public void testNewNamespaceConflictWithPackedPrefixNameExists()
      throws IOException {
    final String newRef = "refs/heads/master/x";
    final RefUpdate ru = updateRef(newRef);
    Result update = ru.update();
    assertEquals(Result.LOCK_FAILURE, update);
    assertNull(db.getReflogReader("refs/heads/master/x"));
    assertEquals(0, db.getReflogReader("HEAD").getReverseEntries().size());
  }
View Full Code Here

  @Test
  public void testNewNamespaceConflictWithLoosePrefixOfExisting()
      throws IOException {
    final String newRef = "refs/heads/z/a";
    final RefUpdate ru = updateRef(newRef);
    Result update = ru.update();
    assertEquals(Result.NEW, update);
    // end setup
    final String newRef2 = "refs/heads/z";
    final RefUpdate ru2 = updateRef(newRef2);
    Result update2 = ru2.update();
View Full Code Here

    Result update = ru.update();
    assertEquals(Result.NEW, update);
    // end setup
    final String newRef2 = "refs/heads/z";
    final RefUpdate ru2 = updateRef(newRef2);
    Result update2 = ru2.update();
    assertEquals(Result.LOCK_FAILURE, update2);
    assertEquals(1, db.getReflogReader("refs/heads/z/a").getReverseEntries().size());
    assertNull(db.getReflogReader("refs/heads/z"));
    assertEquals(0, db.getReflogReader("HEAD").getReverseEntries().size());
  }
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.