Examples of RawText


Examples of org.eclipse.jgit.diff.RawText

   * @throws IOException
   *             the repository cannot be read.
   */
  public BlameGenerator push(String description, byte[] contents)
      throws IOException {
    return push(description, new RawText(contents));
  }
View Full Code Here

Examples of org.eclipse.jgit.diff.RawText

    if (ldr.getType() == OBJ_BLOB) {
      if (description == null)
        description = JGitText.get().blameNotCommittedYet;
      BlobCandidate c = new BlobCandidate(description, resultPath);
      c.sourceBlob = id.toObjectId();
      c.sourceText = new RawText(ldr.getCachedBytes(Integer.MAX_VALUE));
      c.regionList = new Region(0, 0, c.sourceText.size());
      remaining = c.sourceText.size();
      push(c);
      return this;
    }
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

            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++;
        }
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));
        lastConflictingName = null;
      }
      if (chunk.getConflictState() == ConflictState.FIRST_CONFLICTING_RANGE) {
        // found the start of an conflict
        out.write(("<<<<<<< " + seqName.get(chunk.getSequenceIndex()) +
            "\n").getBytes(charsetName));
        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" : "======= "
            + lastConflictingName + "\n").getBytes(charsetName));
      }
      // 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

  private boolean contentMerge(CanonicalTreeParser base,
      CanonicalTreeParser ours, CanonicalTreeParser theirs)
      throws FileNotFoundException, IllegalStateException, IOException {
    MergeFormatter fmt = new MergeFormatter();

    RawText baseText = base == null ? RawText.EMPTY_TEXT : getRawText(
        base.getEntryObjectId(), db);

    // do the merge
    MergeResult<RawText> result = mergeAlgorithm.merge(
        RawTextComparator.DEFAULT, baseText,
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

Examples of org.eclipse.jgit.diff.RawText

  private boolean contentMerge(CanonicalTreeParser base,
      CanonicalTreeParser ours, CanonicalTreeParser theirs)
      throws FileNotFoundException, IllegalStateException, IOException {
    MergeFormatter fmt = new MergeFormatter();

    RawText baseText = base == null ? RawText.EMPTY_TEXT : getRawText(
        base.getEntryObjectId(), db);

    // do the merge
    MergeResult<RawText> result = mergeAlgorithm.merge(
        RawTextComparator.DEFAULT, baseText,
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

Examples of org.eclipse.jgit.diff.RawText

      }
      BlameCommand blameCommand = new BlameCommand(repository);
      blameCommand.setFilePath(blobPath);
      blameCommand.setStartCommit(object);
      BlameResult blameResult = blameCommand.call();
      RawText rawText = blameResult.getResultContents();
      int length = rawText.size();
      for (int i = 0; i < length; i++) {
        RevCommit commit = blameResult.getSourceCommit(i);
        AnnotatedLine line = new AnnotatedLine(commit, i + 1, rawText.getString(i));
        lines.add(line);
      }
    } catch (Throwable t) {
      LOGGER.error(MessageFormat.format("failed to generate blame for {0} {1}!", blobPath, objectId), t);
    }
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.