Package com.cloudbees.diff

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


     * 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

     * 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

        {
            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

        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

        {
            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

TOP

Related Classes of com.cloudbees.diff.Hunk

Copyright © 2018 www.massapicom. 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.