Package org.eclipse.jgit.revwalk

Examples of org.eclipse.jgit.revwalk.RevObject


  public void testObjectInNewPack() throws IncorrectObjectTypeException,
      IOException {
    // Create a new object in a new pack, and test that it is present.
    //
    final Repository eden = createBareRepository();
    final RevObject o1 = writeBlob(eden, "o1");
    pack(eden, o1);
    assertEquals(o1.name(), parse(o1).name());
  }
View Full Code Here


    // Create an object and pack it. Then remove that pack and put the
    // object into a different pack file, with some other object. We
    // still should be able to access the objects.
    //
    final Repository eden = createBareRepository();
    final RevObject o1 = writeBlob(eden, "o1");
    final File[] out1 = pack(eden, o1);
    assertEquals(o1.name(), parse(o1).name());

    final RevObject o2 = writeBlob(eden, "o2");
    pack(eden, o2, o1);

    // Force close, and then delete, the old pack.
    //
    whackCache();
    delete(out1);

    // Now here is the interesting thing. Will git figure the new
    // object exists in the new pack, and not the old one.
    //
    assertEquals(o2.name(), parse(o2).name());
    assertEquals(o1.name(), parse(o1).name());
  }
View Full Code Here

  public void testObjectMovedWithinPack()
      throws IncorrectObjectTypeException, IOException {
    // Create an object and pack it.
    //
    final Repository eden = createBareRepository();
    final RevObject o1 = writeBlob(eden, "o1");
    final File[] out1 = pack(eden, o1);
    assertEquals(o1.name(), parse(o1).name());

    // Force close the old pack.
    //
    whackCache();

    // Now overwrite the old pack in place. This method of creating a
    // different pack under the same file name is partially broken. We
    // should also have a different file name because the list of objects
    // within the pack has been modified.
    //
    final RevObject o2 = writeBlob(eden, "o2");
    final PackWriter pw = new PackWriter(eden);
    pw.addObject(o2);
    pw.addObject(o1);
    write(out1, pw);
    pw.release();

    // Try the old name, then the new name. The old name should cause the
    // pack to reload when it opens and the index and pack mismatch.
    //
    assertEquals(o1.name(), parse(o1).name());
    assertEquals(o2.name(), parse(o2).name());
  }
View Full Code Here

    // Create an object and pack it. Then remove that pack and put the
    // object into a different pack file, with some other object. We
    // still should be able to access the objects.
    //
    final Repository eden = createBareRepository();
    final RevObject o1 = writeBlob(eden, "o1");
    final File[] out1 = pack(eden, o1);
    assertEquals(o1.name(), parse(o1).name());

    final ObjectLoader load1 = db.open(o1, Constants.OBJ_BLOB);
    assertNotNull(load1);

    final RevObject o2 = writeBlob(eden, "o2");
    pack(eden, o2, o1);

    // Force close, and then delete, the old pack.
    //
    whackCache();
View Full Code Here

      }

      Map<ObjectId, String> result =
        new LinkedHashMap<ObjectId, String>(revs.size());
      for (ObjectId id : revs) {
        RevObject o = walk.parseAny(id);
        if (o instanceof NameRevCommit) {
          NameRevCommit c = (NameRevCommit) o;
          if (c.tip != null)
            result.put(id, simplify(c.format().toString()));
        } else {
View Full Code Here

  private void addRef(Ref ref, Map<ObjectId, String> nonCommits,
      FIFORevQueue pending) throws IOException {
    if (ref.getObjectId() == null)
      return;
    RevObject o = walk.parseAny(ref.getObjectId());
    while (o instanceof RevTag) {
      RevTag t = (RevTag) o;
      nonCommits.put(o, ref.getName());
      o = t.getObject();
      walk.parseHeaders(o);
View Full Code Here

  }

  private int minCommitTime() throws IOException {
    int min = Integer.MAX_VALUE;
    for (ObjectId id : revs) {
      RevObject o = walk.parseAny(id);
      while (o instanceof RevTag) {
        o = ((RevTag) o).getObject();
        walk.parseHeaders(o);
      }
      if (o instanceof RevCommit) {
View Full Code Here

      PackReverseIndex rev = src.getReverseIdx(ctx);
      DfsObjectRepresentation rep = new DfsObjectRepresentation(src);
      for (ObjectIdWithOffset id : want) {
        int type = src.getObjectType(ctx, id.offset);
        RevObject obj = rw.lookupAny(id, type);
        if (obj.has(added))
          continue;

        pm.update(1);
        pw.addObject(obj);
        obj.add(added);

        src.representation(rep, id.offset, ctx, rev);
        if (rep.getFormat() != PACK_DELTA)
          continue;

        RevObject base = rw.lookupAny(rep.getDeltaBase(), type);
        if (!base.has(added) && !base.has(isBase)) {
          baseObjects.add(base);
          base.add(isBase);
        }
      }
    }
    for (RevObject obj : baseObjects) {
      if (!obj.has(added)) {
View Full Code Here

    PackIndex srcIdx = src.getPackIndex(ctx);
    List<ObjectIdWithOffset> want = new BlockList<ObjectIdWithOffset>(
        (int) srcIdx.getObjectCount());
    SCAN: for (PackIndex.MutableEntry ent : srcIdx) {
      ObjectId id = ent.toObjectId();
      RevObject obj = rw.lookupOrNull(id);
      if (obj != null && (obj.has(added) || obj.has(isBase)))
        continue;
      for (PackWriter.ObjectIdSet e : exclude)
        if (e.contains(id))
          continue SCAN;
      want.add(new ObjectIdWithOffset(id, ent.getOffset()));
View Full Code Here

      show(c);
    }
    if (walk instanceof ObjectWalk) {
      final ObjectWalk ow = (ObjectWalk) walk;
      for (;;) {
        final RevObject obj = ow.nextObject();
        if (obj == null)
          break;
        show(ow, obj);
      }
    }
View Full Code Here

TOP

Related Classes of org.eclipse.jgit.revwalk.RevObject

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.