Examples of RawText


Examples of org.eclipse.jgit.diff.RawText

   * @throws IOException
   *             the repository cannot be read.
   */
  public static BlameResult create(BlameGenerator gen) throws IOException {
    String path = gen.getResultPath();
    RawText contents = gen.getResultContents();
    if (contents == null) {
      gen.release();
      return null;
    }
    return new BlameResult(gen, path, contents);
View Full Code Here

Examples of org.eclipse.jgit.diff.RawText

  private static MergeAlgorithm mergeAlgorithm = new MergeAlgorithm();
 
  public static MergeResult merge(String base, String child, String parent) {
    // Jgit Merge
    org.eclipse.jgit.merge.MergeResult<RawText> jgitMergeResult =
        mergeAlgorithm.merge(RawTextComparator.DEFAULT, new RawText(base.getBytes()),
            new RawText(child.getBytes()), new RawText(parent.getBytes()));

    return formatMerge(jgitMergeResult);
  }
View Full Code Here

Examples of org.eclipse.jgit.diff.RawText

    List<MergeChunk> mergeChunks = Lists.newArrayList();
    MergeChunk currentMergeChunk = null;
    StringBuilder fileContent = new StringBuilder();
    int conflictIndex = 0;
    for (org.eclipse.jgit.merge.MergeChunk chunk : results) {
      RawText seq = results.getSequences().get(chunk.getSequenceIndex());
      String chunkContent = seq.getString(chunk.getBegin(), chunk.getEnd(), false);

      if (chunk.getConflictState() == ConflictState.NO_CONFLICT
          || chunk.getConflictState() == ConflictState.FIRST_CONFLICTING_RANGE) {
        if (currentMergeChunk != null) {
          mergeChunks.add(currentMergeChunk);
View Full Code Here

Examples of org.eclipse.jgit.diff.RawText

    Text aText =
        aCommit != null ? Text.forCommit(db, reader, aCommit) : Text.EMPTY;
    Text bText = Text.forCommit(db, reader, bCommit);

    byte[] rawHdr = hdr.toString().getBytes("UTF-8");
    RawText aRawText = new RawText(aText.getContent());
    RawText bRawText = new RawText(bText.getContent());
    EditList edits = new HistogramDiff().diff(cmp, aRawText, bRawText);
    FileHeader fh = new FileHeader(rawHdr, edits, PatchType.UNIFIED);
    return new PatchListEntry(fh, edits);
  }
View Full Code Here

Examples of org.eclipse.jgit.diff.RawText

        }

        if (RawText.isBinary(raw))
          continue;

        RawText txt = new RawText(raw);
        int[] lines = new int[txt.size()];
        int cnt = 0;
        HashSet<Line> u = new HashSet<Line>();
        for (int i = 0; i < txt.size(); i++) {
          if (u.add(new Line(txt, i)))
            lines[cnt++] = i;
        }

        fileCnt++;
View Full Code Here

Examples of org.eclipse.jgit.diff.RawText

      outw.print(label);
      outw.print(")"); //$NON-NLS-1$
    }
    outw.println(":"); //$NON-NLS-1$
    try {
      RawText rawText = new RawText(argWalk.getObjectReader()
          .open(blobId).getCachedBytes(Integer.MAX_VALUE));
      for (int i = 0; i < rawText.size(); i++) {
        outw.print("    "); //$NON-NLS-1$
        outw.println(rawText.getString(i));
      }
    } catch (LargeObjectException e) {
      outw.println(MessageFormat.format(
          CLIText.get().noteObjectTooLargeToPrint, blobId.name()));
    }
View Full Code Here

Examples of org.eclipse.jgit.diff.RawText

          if (0 <= entry)
            generator.push(null, dc.getEntry(entry).getObjectId());

          File inTree = new File(db.getWorkTree(), file);
          if (inTree.isFile())
            generator.push(null, new RawText(inTree));
        }
      }

      blame = BlameResult.create(generator);
      begin = 0;
View Full Code Here

Examples of org.eclipse.jgit.diff.RawText

    if (!re.startsWith("^")) //$NON-NLS-1$
      re = ".*" + re; //$NON-NLS-1$
    if (!re.endsWith("$")) //$NON-NLS-1$
      re = re + ".*"; //$NON-NLS-1$
    Pattern p = Pattern.compile(re);
    RawText text = blame.getResultContents();
    for (int line = b; line < text.size(); line++) {
      if (p.matcher(text.getString(line)).matches())
        return line;
    }
    return b;
  }
View Full Code Here

Examples of org.eclipse.jgit.diff.RawText

   * @throws IOException
   */
  private MergeResult<RawText> contentMerge(CanonicalTreeParser base,
      CanonicalTreeParser ours, CanonicalTreeParser theirs)
      throws IOException {
    RawText baseText = base == null ? RawText.EMPTY_TEXT : getRawText(
        base.getEntryObjectId(), db);
    RawText ourText = ours == null ? RawText.EMPTY_TEXT : getRawText(
        ours.getEntryObjectId(), db);
    RawText theirsText = theirs == null ? RawText.EMPTY_TEXT : getRawText(
        theirs.getEntryObjectId(), db);
    return (mergeAlgorithm.merge(RawTextComparator.DEFAULT, baseText,
        ourText, theirsText));
  }
View Full Code Here

Examples of org.eclipse.jgit.diff.RawText

  }

  private static RawText getRawText(ObjectId id, Repository db)
      throws IOException {
    if (id.equals(ObjectId.zeroId()))
      return new RawText(new byte[] {});
    return new RawText(db.open(id, Constants.OBJ_BLOB).getCachedBytes());
  }
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.