Examples of RawText


Examples of org.eclipse.jgit.diff.RawText

        return Collections.emptyList();
    } else
      data2 = new byte[0];

    return new HistogramDiff().diff(comparator, //
        data1.length > 0 ? new RawText(data1) : EMPTY_TEXT, //
        data2.length > 0 ? new RawText(data2) : EMPTY_TEXT);
  }
View Full Code Here

Examples of org.eclipse.jgit.diff.RawText

        return Collections.emptyList();
    } else
      data2 = new byte[0];

    return new HistogramDiff().diff(comparator, //
        data1.length > 0 ? new RawText(data1) : EMPTY_TEXT, //
        data2.length > 0 ? new RawText(data2) : EMPTY_TEXT);
  }
View Full Code Here

Examples of org.eclipse.jgit.diff.RawText

  private ApplyResult init(final String name, final boolean preExists,
      final boolean postExists) throws Exception {
    Git git = new Git(db);

    if (preExists) {
      a = new RawText(readFile(name + "_PreImage"));
      write(new File(db.getDirectory().getParent(), name),
          a.getString(0, a.size(), false));

      git.add().addFilepattern(name).call();
      git.commit().setMessage("PreImage").call();
    }

    if (postExists)
      b = new RawText(readFile(name + "_PostImage"));

    return git
        .apply()
        .setPatch(getTestResource(name + ".patch")).call();
  }
View Full Code Here

Examples of org.eclipse.jgit.diff.RawText

    return r;
  }

  void loadText(ObjectReader reader) throws IOException {
    ObjectLoader ldr = reader.open(sourceBlob, Constants.OBJ_BLOB);
    sourceText = new RawText(ldr.getCachedBytes(Integer.MAX_VALUE));
  }
View Full Code Here

Examples of org.eclipse.jgit.diff.RawText

      List<String> seqName, String charsetName) throws IOException {
    String lastConflictingName = null; // is set to non-null whenever we are
    // in a conflict
    boolean threeWayMerge = (res.getSequences().size() == 3);
    for (MergeChunk chunk : res) {
      RawText seq = res.getSequences().get(chunk.getSequenceIndex());
      if (lastConflictingName != null
          && chunk.getConflictState() != ConflictState.NEXT_CONFLICTING_RANGE) {
        // found the end of an conflict
        out.write((">>>>>>> " + lastConflictingName + "\n").getBytes(charsetName)); //$NON-NLS-1$ //$NON-NLS-2$
        lastConflictingName = null;
      }
      if (chunk.getConflictState() == ConflictState.FIRST_CONFLICTING_RANGE) {
        // found the start of an conflict
        out.write(("<<<<<<< " + seqName.get(chunk.getSequenceIndex()) + //$NON-NLS-1$
            "\n").getBytes(charsetName)); //$NON-NLS-1$
        lastConflictingName = seqName.get(chunk.getSequenceIndex());
      } else if (chunk.getConflictState() == ConflictState.NEXT_CONFLICTING_RANGE) {
        // found another conflicting chunk

        /*
         * In case of a non-three-way merge I'll add the name of the
         * conflicting chunk behind the equal signs. I also append the
         * name of the last conflicting chunk after the ending
         * greater-than signs. If somebody knows a better notation to
         * present non-three-way merges - feel free to correct here.
         */
        lastConflictingName = seqName.get(chunk.getSequenceIndex());
        out.write((threeWayMerge ? "=======\n" : "======= " //$NON-NLS-1$ //$NON-NLS-2$
            + lastConflictingName + "\n").getBytes(charsetName)); //$NON-NLS-1$
      }
      // the lines with conflict-metadata are written. Now write the chunk
      for (int i = chunk.getBegin(); i < chunk.getEnd(); i++) {
        seq.writeLine(out, i);
        out.write('\n');
      }
    }
    // one possible leftover: if the merge result ended with a conflict we
    // have to close the last conflict here
View Full Code Here

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

      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 (db.getFS().isFile(inTree))
            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(), reader);
    RawText ourText = ours == null ? RawText.EMPTY_TEXT : getRawText(
        ours.getEntryObjectId(), reader);
    RawText theirsText = theirs == null ? RawText.EMPTY_TEXT : getRawText(
        theirs.getEntryObjectId(), reader);
    return (mergeAlgorithm.merge(RawTextComparator.DEFAULT, baseText,
        ourText, theirsText));
  }
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.