Package org.eclipse.jgit.lib

Examples of org.eclipse.jgit.lib.MutableObjectId


  @Test
  public void testReadACK_Invalid3() {
    String s = "ACK fcfcfb1fd94829c1a1704f894fc111d14770d34e neverhappen";
    init("003d" + s + "\n");
    try {
      in.readACK(new MutableObjectId());
      fail("incorrectly accepted unsupported ACK status");
    } catch (IOException e) {
      assertEquals("Expected ACK/NAK, got: " + s, e.getMessage());
    }
  }
View Full Code Here


  @Test
  public void testReadACK_Invalid4() {
    init("0000");
    try {
      in.readACK(new MutableObjectId());
      fail("incorrectly accepted no ACK/NAK");
    } catch (IOException e) {
      assertEquals("Expected ACK/NAK, found EOF", e.getMessage());
    }
  }
View Full Code Here

  @Test
  public void testReadACK_ERR() throws IOException {
    init("001aERR want is not valid\n");
    try {
      in.readACK(new MutableObjectId());
      fail("incorrectly accepted ERR");
    } catch (PackProtocolException e) {
      assertEquals("want is not valid", e.getMessage());
    }
  }
View Full Code Here

    assertEquals(data2, map.get(a));
    assertEquals(b, map.get(data1));
    assertFalse("no b", map.contains(b));
    assertFalse("no data2", map.contains(data2));

    MutableObjectId id = new MutableObjectId();
    for (int p = 42; p > 0; p--) {
      id.setByte(1, p);
      map.set(id, data1);
    }

    for (int p = 42; p > 0; p--) {
      id.setByte(1, p);
      assertTrue("contains " + id, map.contains(id));
    }

    RevCommit n = commitNoteMap(map);
    map = NoteMap.read(reader, n);
View Full Code Here

  }

  @Test
  public void testLeafSplitsWhenFull() throws Exception {
    RevBlob data1 = tr.blob("data1");
    MutableObjectId idBuf = new MutableObjectId();

    RevCommit r = tr.commit() //
        .add(data1.name(), data1) //
        .create();
    tr.parseBody(r);

    NoteMap map = NoteMap.read(reader, r);
    for (int i = 0; i < 254; i++) {
      idBuf.setByte(Constants.OBJECT_ID_LENGTH - 1, i);
      map.set(idBuf, data1);
    }

    RevCommit n = commitNoteMap(map);
    TreeWalk tw = new TreeWalk(reader);
    tw.reset(n.getTree());
    while (tw.next())
      assertFalse("no fan-out subtree", tw.isSubtree());

    for (int i = 254; i < 256; i++) {
      idBuf.setByte(Constants.OBJECT_ID_LENGTH - 1, i);
      map.set(idBuf, data1);
    }
    idBuf.setByte(Constants.OBJECT_ID_LENGTH - 2, 1);
    map.set(idBuf, data1);
    n = commitNoteMap(map);

    // The 00 bucket is fully split.
    String path = fanout(38, idBuf.name());
    tw = TreeWalk.forPath(reader, path, n.getTree());
    assertNotNull("has " + path, tw);

    // The other bucket is not.
    path = fanout(2, data1.name());
View Full Code Here

    return p;
  }

  public CanonicalTreeParser createSubtreeIterator(final ObjectReader reader)
      throws IncorrectObjectTypeException, IOException {
    return createSubtreeIterator(reader, new MutableObjectId());
  }
View Full Code Here

    assertNull(b.set(id(0x11), null, null));
    assertNull(b.getNote(id(0x11), null));
  }

  private static AnyObjectId id(int first) {
    MutableObjectId id = new MutableObjectId();
    id.setByte(1, first);
    return id;
  }
View Full Code Here

    return line.toString();
  }

  private void negotiate(final ProgressMonitor monitor) throws IOException,
      CancelledException {
    final MutableObjectId ackId = new MutableObjectId();
    int resultsPending = 0;
    int havesSent = 0;
    int havesSinceLastContinue = 0;
    boolean receivedContinue = false;
    boolean receivedAck = false;
View Full Code Here

   *            be released by the caller when the walker is no longer
   *            required.
   */
  public RevWalk(ObjectReader or) {
    reader = or;
    idBuffer = new MutableObjectId();
    objects = new ObjectIdOwnerMap<RevObject>();
    roots = new ArrayList<RevCommit>();
    queue = new DateRevQueue();
    pending = new StartGenerator(this);
    sorting = EnumSet.of(RevSort.NONE);
View Full Code Here

  void parseCanonical(final RevWalk walk, final byte[] raw)
      throws IOException {
    if (!walk.shallowCommitsInitialized)
      walk.initializeShallowCommits();

    final MutableObjectId idBuffer = walk.idBuffer;
    idBuffer.fromString(raw, 5);
    tree = walk.lookupTree(idBuffer);

    int ptr = 46;
    if (parents == null) {
      RevCommit[] pList = new RevCommit[1];
      int nParents = 0;
      for (;;) {
        if (raw[ptr] != 'p')
          break;
        idBuffer.fromString(raw, ptr + 7);
        final RevCommit p = walk.lookupCommit(idBuffer);
        if (nParents == 0)
          pList[nParents++] = p;
        else if (nParents == 1) {
          pList = new RevCommit[] { pList[0], p };
View Full Code Here

TOP

Related Classes of org.eclipse.jgit.lib.MutableObjectId

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.