Examples of EditList


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

    List<Sequence> sequences = new ArrayList<Sequence>(3);
    sequences.add(base);
    sequences.add(ours);
    sequences.add(theirs);
    MergeResult result = new MergeResult(sequences);
    EditList oursEdits = new MyersDiff(base, ours).getEdits();
    Iterator<Edit> baseToOurs = oursEdits.iterator();
    EditList theirsEdits = new MyersDiff(base, theirs).getEdits();
    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

          if (tw.getFileMode(0).getObjectType() == Constants.OBJ_BLOB)
            oldImage = openBlob(0);
          else
            oldImage = new byte[0];

          EditList edits = new MyersDiff(new RawText(oldImage),
              new RawText(openBlob(1))).getEdits();
          for (Edit e : edits)
            addedLines += e.getEndB() - e.getBeginB();
        }
View Full Code Here

Examples of org.eclipse.jgit.diff.EditList

public class EditListTest extends TestCase {
  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

  }

  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

  }

  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

Examples of org.eclipse.jgit.diff.EditList

     */
    private String getDiffinGitFormat(String string1, String string2) throws IOException {
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        RawText rt1 = new RawText(string1.getBytes());
        RawText rt2 = new RawText(string2.getBytes());
        EditList diffList = new EditList();
        diffList.addAll(new HistogramDiff().diff(RawTextComparator.DEFAULT, rt1, rt2));
        new DiffFormatter(out).format(diffList, rt1, rt2);
        return out.toString();
    }
View Full Code Here

Examples of org.eclipse.jgit.diff.EditList

    public void updateRange(Integer lineA, Integer lineB) {
        if (editList == null) {
            return;
        }

        EditList newEditList = new EditList();

        for (Edit edit: editList) {
            if (lineA != null) {
                if ((lineA >= edit.getBeginA() - context) && (lineA <= edit.getEndA() + context)) {
                    newEditList.add(edit);
                }
            }

            if (lineB != null) {
                if ((lineB >= edit.getBeginB() - context) && (lineB <= edit.getEndB() + context)) {
                    newEditList.add(edit);
                }
            }
        }

        editList = newEditList;
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.