Examples of EditList


Examples of org.eclipse.jgit.diff.EditList

    List<S> sequences = new ArrayList<S>(3);
    sequences.add(base);
    sequences.add(ours);
    sequences.add(theirs);
    MergeResult<S> result = new MergeResult<S>(sequences);
    EditList oursEdits = diffAlg.diff(cmp, base, ours);
    Iterator<Edit> baseToOurs = oursEdits.iterator();
    EditList theirsEdits = diffAlg.diff(cmp, base, theirs);
    Iterator<Edit> baseToTheirs = theirsEdits.iterator();
    int current = 0; // points to the next line (first line is 0) of base
                     // which was not handled yet
    Edit oursEdit = nextEdit(baseToOurs);
    Edit theirsEdit = nextEdit(baseToTheirs);
View Full Code Here

Examples of org.eclipse.jgit.diff.EditList

    return reverseBinaryHunk;
  }

  /** @return a list describing the content edits performed on this file. */
  public EditList toEditList() {
    final EditList r = new EditList();
    for (final HunkHeader hunk : hunks)
      r.addAll(hunk.toEditList());
    return r;
  }
View Full Code Here

Examples of org.eclipse.jgit.diff.EditList

  }

  /** @return a list describing the content edits performed within the hunk. */
  public EditList toEditList() {
    if (editList == null) {
      editList = new EditList();
      final byte[] buf = file.buf;
      int c = nextLF(buf, startOffset);
      int oLine = old.startLine;
      int nLine = newStartLine;
      Edit in = null;
View Full Code Here

Examples of org.eclipse.jgit.diff.EditList

    return split(next, n);
  }

  private boolean split(Candidate parent, Candidate source)
      throws IOException {
    EditList editList = diffAlgorithm.diff(textComparator,
        parent.sourceText, source.sourceText);
    if (editList.isEmpty()) {
      // Ignoring whitespace (or some other special comparator) can
      // cause non-identical blobs to have an empty edit list. In
      // a case like this push the parent alone.
      parent.regionList = source.regionList;
      push(parent);
View Full Code Here

Examples of org.eclipse.jgit.diff.EditList

        p.sourceBlob = ids[pIdx];
      } else {
        continue;
      }

      EditList editList;
      if (n instanceof ReverseCandidate
          && p.sourceBlob.equals(n.sourceBlob)) {
        // This special case happens on ReverseCandidate forks.
        p.sourceText = n.sourceText;
        editList = new EditList(0);
      } else {
        p.loadText(reader);
        editList = diffAlgorithm.diff(textComparator,
            p.sourceText, n.sourceText);
      }

      if (editList.isEmpty()) {
        // Ignoring whitespace (or some other special comparator) can
        // cause non-identical blobs to have an empty edit list. In
        // a case like this push the parent alone.
        if (n instanceof ReverseCandidate) {
          parents[pIdx] = p;
View Full Code Here

Examples of org.eclipse.jgit.diff.EditList

    sequences.add(theirs);
    MergeResult<S> result = new MergeResult<S>(sequences);

    if (ours.size() == 0) {
      if (theirs.size() != 0) {
        EditList theirsEdits = diffAlg.diff(cmp, base, theirs);
        if (!theirsEdits.isEmpty()) {
          // we deleted, they modified -> Let their complete content
          // conflict with empty text
          result.add(1, 0, 0, ConflictState.FIRST_CONFLICTING_RANGE);
          result.add(2, 0, theirs.size(),
              ConflictState.NEXT_CONFLICTING_RANGE);
        } else
          // we deleted, they didn't modify -> Let our deletion win
          result.add(1, 0, 0, ConflictState.NO_CONFLICT);
      } else
        // we and they deleted -> return a single chunk of nothing
        result.add(1, 0, 0, ConflictState.NO_CONFLICT);
      return result;
    } else if (theirs.size() == 0) {
      EditList oursEdits = diffAlg.diff(cmp, base, ours);
      if (!oursEdits.isEmpty()) {
        // we modified, they deleted -> Let our complete content
        // conflict with empty text
        result.add(1, 0, ours.size(),
            ConflictState.FIRST_CONFLICTING_RANGE);
        result.add(2, 0, 0, ConflictState.NEXT_CONFLICTING_RANGE);
      } else
        // they deleted, we didn't modify -> Let their deletion win
        result.add(2, 0, 0, ConflictState.NO_CONFLICT);
      return result;
    }

    EditList oursEdits = diffAlg.diff(cmp, base, ours);
    Iterator<Edit> baseToOurs = oursEdits.iterator();
    EditList theirsEdits = diffAlg.diff(cmp, base, theirs);
    Iterator<Edit> baseToTheirs = theirsEdits.iterator();
    int current = 0; // points to the next line (first line is 0) of base
                     // which was not handled yet
    Edit oursEdit = nextEdit(baseToOurs);
    Edit theirsEdit = nextEdit(baseToTheirs);
View Full Code Here

Examples of org.eclipse.jgit.diff.EditList

  @Test
  public void testHunkHeader() throws IOException {
    final Patch p = parseTestPatchFile("testGetText_BothISO88591.patch");
    final FileHeader fh = p.getFiles().get(0);

    final EditList list0 = fh.getHunks().get(0).toEditList();
    assertEquals(1, list0.size());
    assertEquals(new Edit(4 - 1, 5 - 1, 4 - 1, 5 - 1), list0.get(0));

    final EditList list1 = fh.getHunks().get(1).toEditList();
    assertEquals(1, list1.size());
    assertEquals(new Edit(16 - 1, 17 - 1, 16 - 1, 17 - 1), list1.get(0));
  }
View Full Code Here

Examples of org.eclipse.jgit.diff.EditList

  @Test
  public void testFileHeader() throws IOException {
    final Patch p = parseTestPatchFile("testGetText_BothISO88591.patch");
    final FileHeader fh = p.getFiles().get(0);
    final EditList e = fh.toEditList();
    assertEquals(2, e.size());
    assertEquals(new Edit(4 - 1, 5 - 1, 4 - 1, 5 - 1), e.get(0));
    assertEquals(new Edit(16 - 1, 17 - 1, 16 - 1, 17 - 1), e.get(1));
  }
View Full Code Here

Examples of org.eclipse.jgit.diff.EditList

  @Test
  public void testTypes() throws IOException {
    final Patch p = parseTestPatchFile("testEditList_Types.patch");
    final FileHeader fh = p.getFiles().get(0);
    final EditList e = fh.toEditList();
    assertEquals(3, e.size());
    assertEquals(new Edit(3 - 1, 3 - 1, 3 - 1, 4 - 1), e.get(0));
    assertEquals(new Edit(17 - 1, 19 - 1, 18 - 1, 18 - 1), e.get(1));
    assertEquals(new Edit(23 - 1, 25 - 1, 22 - 1, 28 - 1), e.get(2));
  }
View Full Code Here

Examples of org.eclipse.jgit.diff.EditList

    return reverseBinaryHunk;
  }

  /** @return a list describing the content edits performed on this file. */
  public EditList toEditList() {
    final EditList r = new EditList();
    for (final HunkHeader hunk : hunks)
      r.addAll(hunk.toEditList());
    return r;
  }
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.