Examples of AbbreviatedObjectId


Examples of org.eclipse.jgit.lib.AbbreviatedObjectId

      return EMPTY;

    if (isBinary(entry.getPath(side)))
      return BINARY;

    AbbreviatedObjectId id = entry.getId(side);
    if (!id.isComplete()) {
      Collection<ObjectId> ids = reader.resolve(id);
      if (ids.size() == 1) {
        id = AbbreviatedObjectId.fromObjectId(ids.iterator().next());
        switch (side) {
        case OLD:
          entry.oldId = id;
          break;
        case NEW:
          entry.newId = id;
          break;
        }
      } else if (ids.size() == 0)
        throw new MissingObjectException(id, Constants.OBJ_BLOB);
      else
        throw new AmbiguousObjectException(id, ids);
    }

    try {
      ObjectLoader ldr = source.open(side, entry);
      return ldr.getBytes(binaryFileThreshold);

    } catch (LargeObjectException.ExceedsLimit overLimit) {
      return BINARY;

    } catch (LargeObjectException.ExceedsByteArrayLimit overLimit) {
      return BINARY;

    } catch (LargeObjectException.OutOfMemory tooBig) {
      return BINARY;

    } catch (LargeObjectException tooBig) {
      tooBig.setObjectId(id.toObjectId());
      throw tooBig;
    }
  }
View Full Code Here

Examples of org.eclipse.jgit.lib.AbbreviatedObjectId

      return EMPTY;

    if (isBinary(entry.getPath(side)))
      return BINARY;

    AbbreviatedObjectId id = entry.getId(side);
    if (!id.isComplete()) {
      Collection<ObjectId> ids = reader.resolve(id);
      if (ids.size() == 1) {
        id = AbbreviatedObjectId.fromObjectId(ids.iterator().next());
        switch (side) {
        case OLD:
          entry.oldId = id;
          break;
        case NEW:
          entry.newId = id;
          break;
        }
      } else if (ids.size() == 0)
        throw new MissingObjectException(id, Constants.OBJ_BLOB);
      else
        throw new AmbiguousObjectException(id, ids);
    }

    try {
      ObjectLoader ldr = source.open(side, entry);
      return ldr.getBytes(binaryFileThreshold);

    } catch (LargeObjectException.ExceedsLimit overLimit) {
      return BINARY;

    } catch (LargeObjectException.ExceedsByteArrayLimit overLimit) {
      return BINARY;

    } catch (LargeObjectException.OutOfMemory tooBig) {
      return BINARY;

    } catch (LargeObjectException tooBig) {
      tooBig.setObjectId(id.toObjectId());
      throw tooBig;
    }
  }
View Full Code Here

Examples of org.eclipse.jgit.lib.AbbreviatedObjectId

    return root;
  }

  private void load(ObjectId rootTree) throws MissingObjectException,
      IncorrectObjectTypeException, CorruptObjectException, IOException {
    AbbreviatedObjectId none = AbbreviatedObjectId.fromString("");
    root = NoteParser.parse(none, rootTree, reader);
  }
View Full Code Here

Examples of org.eclipse.jgit.lib.AbbreviatedObjectId

  }

  private void warnMalformedMessage(RevCommit c) {
    ObjectReader reader = rp.getRevWalk().getObjectReader();
    if (65 < c.getShortMessage().length()) {
      AbbreviatedObjectId id;
      try {
        id = reader.abbreviate(c);
      } catch (IOException err) {
        id = c.abbreviate(6);
      }
      addMessage("(W) " + id.name() //
          + ": commit subject >65 characters; use shorter first paragraph");
    }

    int longLineCnt = 0, nonEmptyCnt = 0;
    for (String line : c.getFullMessage().split("\n")) {
      if (!line.trim().isEmpty()) {
        nonEmptyCnt++;
      }
      if (70 < line.length()) {
        longLineCnt++;
      }
    }

    if (0 < longLineCnt && 33 < longLineCnt * 100 / nonEmptyCnt) {
      AbbreviatedObjectId id;
      try {
        id = reader.abbreviate(c);
      } catch (IOException err) {
        id = c.abbreviate(6);
      }
      addMessage("(W) " + id.name() //
          + ": commit message lines >70 characters; manually wrap lines");
    }
  }
View Full Code Here

Examples of org.eclipse.jgit.lib.AbbreviatedObjectId

    long files = 0;
    int commits = 0;
    int minN = Integer.MAX_VALUE;
    int maxN = 0;

    AbbreviatedObjectId startId;
    ObjectReader or = db.newObjectReader();
    try {
      final MutableObjectId id = new MutableObjectId();
      RevWalk rw = new RevWalk(or);
      TreeWalk tw = new TreeWalk(or);
      tw.setFilter(TreeFilter.ANY_DIFF);
      tw.setRecursive(true);

      ObjectId start = db.resolve(Constants.HEAD);
      startId = or.abbreviate(start);
      rw.markStart(rw.parseCommit(start));
      for (;;) {
        final RevCommit c = rw.next();
        if (c == null)
          break;
        commits++;
        if (c.getParentCount() != 1)
          continue;

        RevCommit p = c.getParent(0);
        rw.parseHeaders(p);
        tw.reset(p.getTree(), c.getTree());
        while (tw.next()) {
          if (!isFile(tw, 0) || !isFile(tw, 1))
            continue;

          byte[] raw0;
          try {
            tw.getObjectId(id, 0);
            raw0 = or.open(id).getCachedBytes(textLimit * 1024);
          } catch (LargeObjectException tooBig) {
            continue;
          }
          if (RawText.isBinary(raw0))
            continue;

          byte[] raw1;
          try {
            tw.getObjectId(id, 1);
            raw1 = or.open(id).getCachedBytes(textLimit * 1024);
          } catch (LargeObjectException tooBig) {
            continue;
          }
          if (RawText.isBinary(raw1))
            continue;

          RawText txt0 = new RawText(raw0);
          RawText txt1 = new RawText(raw1);

          minN = Math.min(minN, txt0.size() + txt1.size());
          maxN = Math.max(maxN, txt0.size() + txt1.size());

          for (Test test : all)
            testOne(test, txt0, txt1);
          files++;
        }
        if (count > 0 && files > count)
          break;
      }
    } finally {
      or.release();
    }

    Collections.sort(all, new Comparator<Test>() {
      public int compare(Test a, Test b) {
        int cmp = Long.signum(a.runningTimeNanos - b.runningTimeNanos);
        if (cmp == 0)
          cmp = a.algorithm.name.compareTo(b.algorithm.name);
        return cmp;
      }
    });

    if (db.getDirectory() != null) {
      String name = db.getDirectory().getName();
      File parent = db.getDirectory().getParentFile();
      if (name.equals(Constants.DOT_GIT) && parent != null)
        name = parent.getName();
      outw.println(name + ": start at " + startId.name());
    }

    outw.format("  %12d files,     %8d commits\n", valueOf(files),
        valueOf(commits));
    outw.format("  N=%10d min lines, %8d max lines\n", valueOf(minN),
View Full Code Here

Examples of org.eclipse.jgit.lib.AbbreviatedObjectId

      return EMPTY;

    if (isBinary(entry.getPath(side)))
      return BINARY;

    AbbreviatedObjectId id = entry.getId(side);
    if (!id.isComplete()) {
      Collection<ObjectId> ids = reader.resolve(id);
      if (ids.size() == 1) {
        id = AbbreviatedObjectId.fromObjectId(ids.iterator().next());
        switch (side) {
        case OLD:
          entry.oldId = id;
          break;
        case NEW:
          entry.newId = id;
          break;
        }
      } else if (ids.size() == 0)
        throw new MissingObjectException(id, Constants.OBJ_BLOB);
      else
        throw new AmbiguousObjectException(id, ids);
    }

    try {
      ObjectLoader ldr = source.open(side, entry);
      return ldr.getBytes(binaryFileThreshold);

    } catch (LargeObjectException.ExceedsLimit overLimit) {
      return BINARY;

    } catch (LargeObjectException.ExceedsByteArrayLimit overLimit) {
      return BINARY;

    } catch (LargeObjectException.OutOfMemory tooBig) {
      return BINARY;

    } catch (LargeObjectException tooBig) {
      tooBig.setObjectId(id.toObjectId());
      throw tooBig;
    }
  }
View Full Code Here

Examples of org.eclipse.jgit.lib.AbbreviatedObjectId

      if (!m.merge(new AnyObjectId[] { oursId, theirsId }))
        throw new NotesMergeConflictException(baseList, oursList,
            theirsList);
      resultTreeId = m.getResultTreeId();
    }
    AbbreviatedObjectId none = AbbreviatedObjectId.fromString("");
    return NoteParser.parse(none, resultTreeId, reader).nonNotes;
  }
View Full Code Here

Examples of org.eclipse.jgit.lib.AbbreviatedObjectId

      return treeId;
    }

    private InMemoryNoteBucket load(AnyObjectId prefix, ObjectReader or)
        throws IOException {
      AbbreviatedObjectId p = prefix.abbreviate(prefixLen + 2);
      InMemoryNoteBucket self = NoteParser.parse(p, treeId, or);
      table[cell(prefix)] = self;
      return self;
    }
View Full Code Here

Examples of org.eclipse.jgit.lib.AbbreviatedObjectId

    return root;
  }

  private void load(ObjectId rootTree) throws MissingObjectException,
      IncorrectObjectTypeException, CorruptObjectException, IOException {
    AbbreviatedObjectId none = AbbreviatedObjectId.fromString("");
    root = NoteParser.parse(none, rootTree, reader);
  }
View Full Code Here

Examples of org.eclipse.jgit.lib.AbbreviatedObjectId

    count = 0;
    final ObjectReader reader = walker.getObjectReader();
    for (DiffEntry diff : diffs) {
      if (!isFileDiff(diff))
        continue;
      final AbbreviatedObjectId oldId = diff.getOldId();
      if (oldId == null)
        continue;
      include(commit, diff, BlobUtils.diff(reader, oldId.toObjectId(),
          diff.getNewId().toObjectId()));
      if (count >= total)
        break;
    }
    return count >= total ? true : include(false);
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.