Examples of Hunk


Examples of com.cloudbees.diff.Hunk

    {
        if (patch.hunks.length != 1)
        {
            return false;
        }
        Hunk hunk = patch.hunks[0];
        if (hunk.baseStart != 0 || hunk.baseCount != 0 || hunk.modifiedStart != 1 || hunk.modifiedCount != originalFile.size())
        {
            return false;
        }
View Full Code Here

Examples of com.cloudbees.diff.Hunk

     * Reads binary diff hunk.
     */
    private void readBinaryPatchContent(SinglePatch patch) throws PatchException, IOException
    {
        List<Hunk> hunks = new ArrayList<Hunk>();
        Hunk hunk = new Hunk();
        for (; ; )
        {
            String line = readPatchLine();
            if (line == null || line.startsWith("Index:") || line.length() == 0)
            {
View Full Code Here

Examples of com.cloudbees.diff.Hunk

     * Reads normal diff hunks.
     */
    private void readNormalPatchContent(SinglePatch patch) throws IOException, PatchException
    {
        List<Hunk> hunks = new ArrayList<Hunk>();
        Hunk hunk = null;
        Matcher m;
        for (; ; )
        {
            String line = readPatchLine();
            if (line == null || line.startsWith("Index:"))
            {
                unreadPatchLine();
                break;
            }
            if ((m = normalAddRangePattern.matcher(line)).matches())
            {
                hunk = new Hunk();
                hunks.add(hunk);
                parseNormalRange(hunk, m);
            }
            else if ((m = normalChangeRangePattern.matcher(line)).matches())
            {
                hunk = new Hunk();
                hunks.add(hunk);
                parseNormalRange(hunk, m);
            }
            else if ((m = normalDeleteRangePattern.matcher(line)).matches())
            {
                hunk = new Hunk();
                hunks.add(hunk);
                parseNormalRange(hunk, m);
            }
            else
            {
View Full Code Here

Examples of com.cloudbees.diff.Hunk

        {
            computeTargetPath(base, modified, patch);
        }

        List<Hunk> hunks = new ArrayList<Hunk>();
        Hunk hunk = null;

        int lineCount = -1;
        for (; ; )
        {
            String line = readPatchLine();
            if (line == null || line.length() == 0 || line.startsWith("Index:"))
            {
                unreadPatchLine();
                break;
            }
            else if (line.startsWith("***************"))
            {
                hunk = new Hunk();
                parseContextRange(hunk, readPatchLine());
                hunks.add(hunk);
            }
            else if (line.startsWith("--- "))
            {
View Full Code Here

Examples of com.cloudbees.diff.Hunk

        patch.hunks = unifiedHunks;
    }

    private Hunk convertContextToUnified(Hunk hunk) throws PatchException
    {
        Hunk unifiedHunk = new Hunk();
        unifiedHunk.baseStart = hunk.baseStart;
        unifiedHunk.modifiedStart = hunk.modifiedStart;
        int split = -1;
        for (int i = 0; i < hunk.lines.size(); i++)
        {
View Full Code Here

Examples of com.cloudbees.diff.Hunk

        {
            computeTargetPath(base, modified, patch);
        }

        List<Hunk> hunks = new ArrayList<Hunk>();
        Hunk hunk = null;

        for (; ; )
        {
            String line = readPatchLine();
            if (line == null || line.length() == 0 || line.startsWith("Index:"))
            {
                unreadPatchLine();
                break;
            }
            char c = line.charAt(0);
            if (c == '@')
            {
                hunk = new Hunk();
                parseRange(hunk, line);
                hunks.add(hunk);
            }
            else if (c == ' ' || c == '+' || c == '-')
            {
View Full Code Here

Examples of org.eclipse.compare.internal.core.patch.Hunk

   */
  public static IHunk createHunk(int start, String[] lines) {
    int type = getHunkType(lines);
    int oldLength = getHunkLength(lines, true);
    int newLength = getHunkLength(lines, false);
    return new Hunk(null, type, start, oldLength, start, newLength, lines);
  }
View Full Code Here

Examples of org.eclipse.compare.internal.core.patch.Hunk

  private static void reorder(IHunk[] hunks) {
    Arrays.sort(hunks, new HunkComparator());
    int shift = 0;
    for (int i = 0; i < hunks.length; i++) {
      Hunk hunk = (Hunk) hunks[i];
      int start = hunk.getStart(false) + shift;
      hunk.setStart(start, true);
      shift += hunk.getLength(true) - hunk.getLength(false);
    }
  }
View Full Code Here

Examples of org.eclipse.compare.internal.core.patch.Hunk

  static class HunkComparator implements Comparator {
    public int compare(Object arg0, Object arg1) {
      if ((arg0 != null && arg0 instanceof Hunk)
          && (arg1 != null && arg1 instanceof Hunk)) {
        Hunk hunk0 = (Hunk) arg0;
        Hunk hunk1 = (Hunk) arg1;
        int shift = hunk0.getStart(true) - hunk1.getStart(true);
        return shift;
      }
      return 0;
    }
View Full Code Here

Examples of org.eclipse.jface.internal.text.revisions.Hunk

    fRanges= null; // mark for recomputation
    for (Iterator regions= fChangeRegions.iterator(); regions.hasNext();) {
      ChangeRegion region= (ChangeRegion) regions.next();
      region.clearDiff();
      for (int i= 0; i < hunks.length; i++) {
        Hunk hunk= hunks[i];
        region.adjustTo(hunk);
      }
    }
  }
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.