Eskil

Check-in [ee752fcf8e]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Corrected right side numbering when parsing patch. [288be8f321]
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: ee752fcf8eb2046faa1bf0bbfe5a5fa3321bd690
User & Date: peter 2016-07-29 10:56:26.714
Context
2016-07-29
11:04
Updated change log with recent changes. check-in: ef18116e0d user: peter tags: trunk
10:56
Corrected right side numbering when parsing patch. [288be8f321] check-in: ee752fcf8e user: peter tags: trunk
10:38
Tidying tests check-in: 1125c540c5 user: peter tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/eskil.tcl.
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
        # We are in a -u style diff
        if {$state eq "both"} {
            if {![regexp {^[\s+-]} $line]} continue
            set sig [string trim [string index $line 0]]
            set str [string range $line 1 end]
            if {$sig eq ""} {
                lappend leftLines [list $leftLine "" $str]
                lappend rightLines [list $leftLine "" $str]
                incr leftLine
                incr rightLine
            } elseif {$sig eq "-"} {
                lappend leftLines [list $leftLine "-" $str]
                incr leftLine
            } else {
                lappend rightLines [list $leftLine "+" $str]
                incr rightLine
            }
            continue
        }
    }
    if {$state != "none"} {
        displayOnePatch $top $leftLines $rightLines $leftLine $rightLine







|






|







1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
        # We are in a -u style diff
        if {$state eq "both"} {
            if {![regexp {^[\s+-]} $line]} continue
            set sig [string trim [string index $line 0]]
            set str [string range $line 1 end]
            if {$sig eq ""} {
                lappend leftLines [list $leftLine "" $str]
                lappend rightLines [list $rightLine "" $str]
                incr leftLine
                incr rightLine
            } elseif {$sig eq "-"} {
                lappend leftLines [list $leftLine "-" $str]
                incr leftLine
            } else {
                lappend rightLines [list $rightLine "+" $str]
                incr rightLine
            }
            continue
        }
    }
    if {$state != "none"} {
        displayOnePatch $top $leftLines $rightLines $leftLine $rightLine
Changes to tests/patch.test.
1
2
3
4
5
6
7
8
9
10
11
12







13





14
15
16
17
18
19
20
21

22



23
24
25
26


















27
28
29
30
31
32
33
#------------------------------------------------------------*- tcl -*-
# Tests for patch file parsing functions
#----------------------------------------------------------------------

# Overload exec during these tests
set ::eskil(gurka,patchFile) ""
set ::eskil(gurka,patchData) ""
stub update args {}
stub getFullPatch {top} {
    return $::testpatch
}
stub displayOnePatch {top leftLines rightLines leftLine rightLine} {







}





stub emptyLine {top n {highlight 1}} {
    incr ::_patchfiles
}
stub insertLine {top n line text {tag {equal}} {linetag {}}} {
}
stub addChange {top n tag line1 n1 line2 n2} {}

proc _PatchInit {} {

    set ::_patchfiles 0




}
test patch-1.1 {
    Xxx


















} -body {
    _PatchInit
    set ::testpatch {
Index: vhdl/tb/tb_system.bhv
===================================================================
--- vhdl/tb/tb_system.bhv	(revision 320)
+++ vhdl/tb/tb_system.bhv	(working copy)












>
>
>
>
>
>
>
|
>
>
>
>
>

|






>
|
>
>
>
|
|


>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#------------------------------------------------------------*- tcl -*-
# Tests for patch file parsing functions
#----------------------------------------------------------------------

# Overload exec during these tests
set ::eskil(gurka,patchFile) ""
set ::eskil(gurka,patchData) ""
stub update args {}
stub getFullPatch {top} {
    return $::testpatch
}
stub displayOnePatch {top leftLines rightLines leftLine rightLine} {
    # Line per patch
    lappend ::_patchfiles(pll) $leftLine
    lappend ::_patchfiles(prl) $rightLine
    # All lines
    foreach l $leftLines {
        lassign $l lline lmode lstr
        lappend ::_patchfiles(ll) $lline
    }
    foreach l $rightLines {
        lassign $l lline lmode lstr
        lappend ::_patchfiles(rl) $lline
    }
}
stub emptyLine {top n {highlight 1}} {
    incr ::_patchfiles(e)
}
stub insertLine {top n line text {tag {equal}} {linetag {}}} {
}
stub addChange {top n tag line1 n1 line2 n2} {}

proc _PatchInit {} {
    set ::_patchfiles(e) 0
    set ::_patchfiles(pll) {}
    set ::_patchfiles(prl) {}
    set ::_patchfiles(ll) {}
    set ::_patchfiles(rl) {}
}

test patch-1.1 {
    Xxx
} -body {
    _PatchInit
    set ::testpatch [string trim {
--- foo.txt	2016-07-10 21:53:36.671932638 -0700
+++ bar.txt	2016-07-10 21:53:54.739860205 -0700
@@ -1 +1,2 @@
+0
 1
@@ -5 +8,9 @@
+0
 1
    }]
    displayPatch gurka
    concat $_patchfiles(ll) $_patchfiles(rl)
} -result {1 5 1 2 8 9}

test patch-1.2 {
    Xxx
} -body {
    _PatchInit
    set ::testpatch {
Index: vhdl/tb/tb_system.bhv
===================================================================
--- vhdl/tb/tb_system.bhv	(revision 320)
+++ vhdl/tb/tb_system.bhv	(working copy)
128
129
130
131
132
133
134
135
136
+                      variable TcDFHeader     : out TcDFH_T);
   
   procedure TcAddrCalc(PresentAddr : in integer;
                        AccWidth    : in DynamicSize_T;

    }
    displayPatch gurka
    set ::_patchfiles
} -result {6}







|

162
163
164
165
166
167
168
169
170
+                      variable TcDFHeader     : out TcDFH_T);
   
   procedure TcAddrCalc(PresentAddr : in integer;
                        AccWidth    : in DynamicSize_T;

    }
    displayPatch gurka
    set ::_patchfiles(e)
} -result {6}