Fossil SCM
Get the --tk option working with the new --tcl format.
Commit
63610f3f2733b6c3b2d8fba03a7885cd81844c057bf5218b5b47e15587376977
Parent
e933d5d731b7369…
2 files changed
+72
-55
+2
-1
+72
-55
| --- src/diff.tcl | ||
| +++ src/diff.tcl | ||
| @@ -70,68 +70,85 @@ | ||
| 70 | 70 | close $in |
| 71 | 71 | } |
| 72 | 72 | set N [llength $difftxt] |
| 73 | 73 | set ii 0 |
| 74 | 74 | set nDiffs 0 |
| 75 | + set n1 0 | |
| 76 | + set n2 0 | |
| 75 | 77 | array set widths {txt 0 ln 0 mkr 0} |
| 76 | 78 | while {[set line [getLine $difftxt $N ii]] != -1} { |
| 77 | - set fn2 {} | |
| 78 | - if {![regexp {^=+ (.*?) =+ versus =+ (.*?) =+$} $line all fn fn2] | |
| 79 | - && ![regexp {^=+ (.*?) =+$} $line all fn] | |
| 80 | - } { | |
| 81 | - continue | |
| 82 | - } | |
| 83 | - set errMsg "" | |
| 84 | - set line [getLine $difftxt $N ii] | |
| 85 | - if {[string compare -length 6 $line "<table"] | |
| 86 | - && ![regexp {<p[^>]*>(.+)} $line - errMsg]} { | |
| 87 | - continue | |
| 88 | - } | |
| 89 | 79 | incr nDiffs |
| 90 | - set idx [expr {$nDiffs > 1 ? [.txtA index end] : "1.0"}] | |
| 91 | - .wfiles.lb insert end $fn | |
| 92 | - | |
| 93 | - foreach c [cols] { | |
| 94 | - if {$nDiffs > 1} { | |
| 95 | - $c insert end \n - | |
| 96 | - } | |
| 97 | - if {[colType $c] eq "txt"} { | |
| 98 | - $c insert end $fn\n fn | |
| 99 | - if {$fn2!=""} {set fn $fn2} | |
| 100 | - } else { | |
| 101 | - $c insert end \n fn | |
| 102 | - } | |
| 103 | - $c insert end \n - | |
| 104 | - | |
| 105 | - if {$errMsg ne ""} continue | |
| 106 | - while {[getLine $difftxt $N ii] ne "<pre>"} continue | |
| 107 | - set type [colType $c] | |
| 108 | - set str {} | |
| 109 | - while {[set line [getLine $difftxt $N ii]] ne "</pre>"} { | |
| 110 | - set len [string length [dehtml $line]] | |
| 111 | - if {$len > $widths($type)} { | |
| 112 | - set widths($type) $len | |
| 113 | - } | |
| 114 | - append str $line\n | |
| 115 | - } | |
| 116 | - | |
| 117 | - set re {<span class="diff([a-z]+)">([^<]*)</span>} | |
| 118 | - # Use \r as separator since it can't appear in the diff output (it gets | |
| 119 | - # converted to a space). | |
| 120 | - set str [regsub -all $re $str "\r\\1\r\\2\r"] | |
| 121 | - foreach {pre class mid} [split $str \r] { | |
| 122 | - if {$class ne ""} { | |
| 123 | - $c insert end [dehtml $pre] - [dehtml $mid] [list $class -] | |
| 124 | - } else { | |
| 125 | - $c insert end [dehtml $pre] - | |
| 126 | - } | |
| 127 | - } | |
| 128 | - } | |
| 129 | - | |
| 130 | - if {$errMsg ne ""} { | |
| 131 | - foreach c {.txtA .txtB} {$c insert end [string trim $errMsg] err} | |
| 132 | - foreach c [cols] {$c insert end \n -} | |
| 80 | + switch -- [lindex $line 0] { | |
| 81 | + FILE { | |
| 82 | + .lnA insert end \n fn \n - | |
| 83 | + .txtA insert end [lindex $line 1] fn \n - | |
| 84 | + .mkr insert end \n fn \n - | |
| 85 | + .lnB insert end \n fn \n - | |
| 86 | + .txtB insert end [lindex $line 2] fn \n - | |
| 87 | + set n1 0 | |
| 88 | + set n2 0 | |
| 89 | + } | |
| 90 | + SKIP { | |
| 91 | + set n [lindex $line 1] | |
| 92 | + incr n1 $n | |
| 93 | + incr n2 $n | |
| 94 | + } | |
| 95 | + COM { | |
| 96 | + set x [lindex $line 1] | |
| 97 | + incr n1 | |
| 98 | + incr n2 | |
| 99 | + .lnA insert end $n1\n - | |
| 100 | + .txtA insert end $x\n - | |
| 101 | + .mkr insert end \n - | |
| 102 | + .lnB insert end $n2\n - | |
| 103 | + .txtB insert end $x\n - | |
| 104 | + } | |
| 105 | + INS { | |
| 106 | + set x [lindex $line 1] | |
| 107 | + incr n2 | |
| 108 | + .lnA insert end \n - | |
| 109 | + .txtA insert end \n - | |
| 110 | + .mkr insert end >\n - | |
| 111 | + .lnB insert end $n2\n - | |
| 112 | + .txtB insert end $x add \n - | |
| 113 | + } | |
| 114 | + DEL { | |
| 115 | + set x [lindex $line 1] | |
| 116 | + incr n1 | |
| 117 | + .lnA insert end $n1\n - | |
| 118 | + .txtA insert end $x rm \n - | |
| 119 | + .mkr insert end <\n - | |
| 120 | + .lnB insert end \n - | |
| 121 | + .txtB insert end \n - | |
| 122 | + } | |
| 123 | + EDIT { | |
| 124 | + incr n1 | |
| 125 | + incr n2 | |
| 126 | + .lnA insert end $n1\n - | |
| 127 | + .lnB insert end $n2\n - | |
| 128 | + .mkr insert end |\n - | |
| 129 | + set nn [llength $line] | |
| 130 | + for {set i 1} {$i<$nn} {incr i 3} { | |
| 131 | + set x [lindex $line $i] | |
| 132 | + if {$x ne ""} { | |
| 133 | + .txtA insert end $x - | |
| 134 | + .txtB insert end $x - | |
| 135 | + } | |
| 136 | + if {$i+2<$nn} { | |
| 137 | + .txtA insert end [lindex $line [expr {$i+1}]] chng | |
| 138 | + .txtB insert end [lindex $line [expr {$i+2}]] chng | |
| 139 | + } | |
| 140 | + } | |
| 141 | + .txtA insert end \n - | |
| 142 | + .txtB insert end \n - | |
| 143 | + } | |
| 144 | + "" { | |
| 145 | + incr nDiffs -1 | |
| 146 | + } | |
| 147 | + default { | |
| 148 | + error "bad diff source line: $line" | |
| 149 | + } | |
| 133 | 150 | } |
| 134 | 151 | } |
| 135 | 152 | |
| 136 | 153 | foreach c [cols] { |
| 137 | 154 | set type [colType $c] |
| 138 | 155 |
| --- src/diff.tcl | |
| +++ src/diff.tcl | |
| @@ -70,68 +70,85 @@ | |
| 70 | close $in |
| 71 | } |
| 72 | set N [llength $difftxt] |
| 73 | set ii 0 |
| 74 | set nDiffs 0 |
| 75 | array set widths {txt 0 ln 0 mkr 0} |
| 76 | while {[set line [getLine $difftxt $N ii]] != -1} { |
| 77 | set fn2 {} |
| 78 | if {![regexp {^=+ (.*?) =+ versus =+ (.*?) =+$} $line all fn fn2] |
| 79 | && ![regexp {^=+ (.*?) =+$} $line all fn] |
| 80 | } { |
| 81 | continue |
| 82 | } |
| 83 | set errMsg "" |
| 84 | set line [getLine $difftxt $N ii] |
| 85 | if {[string compare -length 6 $line "<table"] |
| 86 | && ![regexp {<p[^>]*>(.+)} $line - errMsg]} { |
| 87 | continue |
| 88 | } |
| 89 | incr nDiffs |
| 90 | set idx [expr {$nDiffs > 1 ? [.txtA index end] : "1.0"}] |
| 91 | .wfiles.lb insert end $fn |
| 92 | |
| 93 | foreach c [cols] { |
| 94 | if {$nDiffs > 1} { |
| 95 | $c insert end \n - |
| 96 | } |
| 97 | if {[colType $c] eq "txt"} { |
| 98 | $c insert end $fn\n fn |
| 99 | if {$fn2!=""} {set fn $fn2} |
| 100 | } else { |
| 101 | $c insert end \n fn |
| 102 | } |
| 103 | $c insert end \n - |
| 104 | |
| 105 | if {$errMsg ne ""} continue |
| 106 | while {[getLine $difftxt $N ii] ne "<pre>"} continue |
| 107 | set type [colType $c] |
| 108 | set str {} |
| 109 | while {[set line [getLine $difftxt $N ii]] ne "</pre>"} { |
| 110 | set len [string length [dehtml $line]] |
| 111 | if {$len > $widths($type)} { |
| 112 | set widths($type) $len |
| 113 | } |
| 114 | append str $line\n |
| 115 | } |
| 116 | |
| 117 | set re {<span class="diff([a-z]+)">([^<]*)</span>} |
| 118 | # Use \r as separator since it can't appear in the diff output (it gets |
| 119 | # converted to a space). |
| 120 | set str [regsub -all $re $str "\r\\1\r\\2\r"] |
| 121 | foreach {pre class mid} [split $str \r] { |
| 122 | if {$class ne ""} { |
| 123 | $c insert end [dehtml $pre] - [dehtml $mid] [list $class -] |
| 124 | } else { |
| 125 | $c insert end [dehtml $pre] - |
| 126 | } |
| 127 | } |
| 128 | } |
| 129 | |
| 130 | if {$errMsg ne ""} { |
| 131 | foreach c {.txtA .txtB} {$c insert end [string trim $errMsg] err} |
| 132 | foreach c [cols] {$c insert end \n -} |
| 133 | } |
| 134 | } |
| 135 | |
| 136 | foreach c [cols] { |
| 137 | set type [colType $c] |
| 138 |
| --- src/diff.tcl | |
| +++ src/diff.tcl | |
| @@ -70,68 +70,85 @@ | |
| 70 | close $in |
| 71 | } |
| 72 | set N [llength $difftxt] |
| 73 | set ii 0 |
| 74 | set nDiffs 0 |
| 75 | set n1 0 |
| 76 | set n2 0 |
| 77 | array set widths {txt 0 ln 0 mkr 0} |
| 78 | while {[set line [getLine $difftxt $N ii]] != -1} { |
| 79 | incr nDiffs |
| 80 | switch -- [lindex $line 0] { |
| 81 | FILE { |
| 82 | .lnA insert end \n fn \n - |
| 83 | .txtA insert end [lindex $line 1] fn \n - |
| 84 | .mkr insert end \n fn \n - |
| 85 | .lnB insert end \n fn \n - |
| 86 | .txtB insert end [lindex $line 2] fn \n - |
| 87 | set n1 0 |
| 88 | set n2 0 |
| 89 | } |
| 90 | SKIP { |
| 91 | set n [lindex $line 1] |
| 92 | incr n1 $n |
| 93 | incr n2 $n |
| 94 | } |
| 95 | COM { |
| 96 | set x [lindex $line 1] |
| 97 | incr n1 |
| 98 | incr n2 |
| 99 | .lnA insert end $n1\n - |
| 100 | .txtA insert end $x\n - |
| 101 | .mkr insert end \n - |
| 102 | .lnB insert end $n2\n - |
| 103 | .txtB insert end $x\n - |
| 104 | } |
| 105 | INS { |
| 106 | set x [lindex $line 1] |
| 107 | incr n2 |
| 108 | .lnA insert end \n - |
| 109 | .txtA insert end \n - |
| 110 | .mkr insert end >\n - |
| 111 | .lnB insert end $n2\n - |
| 112 | .txtB insert end $x add \n - |
| 113 | } |
| 114 | DEL { |
| 115 | set x [lindex $line 1] |
| 116 | incr n1 |
| 117 | .lnA insert end $n1\n - |
| 118 | .txtA insert end $x rm \n - |
| 119 | .mkr insert end <\n - |
| 120 | .lnB insert end \n - |
| 121 | .txtB insert end \n - |
| 122 | } |
| 123 | EDIT { |
| 124 | incr n1 |
| 125 | incr n2 |
| 126 | .lnA insert end $n1\n - |
| 127 | .lnB insert end $n2\n - |
| 128 | .mkr insert end |\n - |
| 129 | set nn [llength $line] |
| 130 | for {set i 1} {$i<$nn} {incr i 3} { |
| 131 | set x [lindex $line $i] |
| 132 | if {$x ne ""} { |
| 133 | .txtA insert end $x - |
| 134 | .txtB insert end $x - |
| 135 | } |
| 136 | if {$i+2<$nn} { |
| 137 | .txtA insert end [lindex $line [expr {$i+1}]] chng |
| 138 | .txtB insert end [lindex $line [expr {$i+2}]] chng |
| 139 | } |
| 140 | } |
| 141 | .txtA insert end \n - |
| 142 | .txtB insert end \n - |
| 143 | } |
| 144 | "" { |
| 145 | incr nDiffs -1 |
| 146 | } |
| 147 | default { |
| 148 | error "bad diff source line: $line" |
| 149 | } |
| 150 | } |
| 151 | } |
| 152 | |
| 153 | foreach c [cols] { |
| 154 | set type [colType $c] |
| 155 |
+2
-1
| --- src/diffcmd.c | ||
| +++ src/diffcmd.c | ||
| @@ -937,12 +937,13 @@ | ||
| 937 | 937 | Blob script; |
| 938 | 938 | const char *zTempFile = 0; |
| 939 | 939 | char *zCmd; |
| 940 | 940 | const char *zTclsh; |
| 941 | 941 | blob_zero(&script); |
| 942 | - blob_appendf(&script, "set fossilcmd {| \"%/\" %s --html -y -i -v", | |
| 942 | + blob_appendf(&script, "set fossilcmd {| \"%/\" %s -tcl -i -v", | |
| 943 | 943 | g.nameOfExe, zSubCmd); |
| 944 | + find_option("tcl",0,0); | |
| 944 | 945 | find_option("html",0,0); |
| 945 | 946 | find_option("side-by-side","y",0); |
| 946 | 947 | find_option("internal","i",0); |
| 947 | 948 | find_option("verbose","v",0); |
| 948 | 949 | zTclsh = find_option("tclsh",0,1); |
| 949 | 950 |
| --- src/diffcmd.c | |
| +++ src/diffcmd.c | |
| @@ -937,12 +937,13 @@ | |
| 937 | Blob script; |
| 938 | const char *zTempFile = 0; |
| 939 | char *zCmd; |
| 940 | const char *zTclsh; |
| 941 | blob_zero(&script); |
| 942 | blob_appendf(&script, "set fossilcmd {| \"%/\" %s --html -y -i -v", |
| 943 | g.nameOfExe, zSubCmd); |
| 944 | find_option("html",0,0); |
| 945 | find_option("side-by-side","y",0); |
| 946 | find_option("internal","i",0); |
| 947 | find_option("verbose","v",0); |
| 948 | zTclsh = find_option("tclsh",0,1); |
| 949 |
| --- src/diffcmd.c | |
| +++ src/diffcmd.c | |
| @@ -937,12 +937,13 @@ | |
| 937 | Blob script; |
| 938 | const char *zTempFile = 0; |
| 939 | char *zCmd; |
| 940 | const char *zTclsh; |
| 941 | blob_zero(&script); |
| 942 | blob_appendf(&script, "set fossilcmd {| \"%/\" %s -tcl -i -v", |
| 943 | g.nameOfExe, zSubCmd); |
| 944 | find_option("tcl",0,0); |
| 945 | find_option("html",0,0); |
| 946 | find_option("side-by-side","y",0); |
| 947 | find_option("internal","i",0); |
| 948 | find_option("verbose","v",0); |
| 949 | zTclsh = find_option("tclsh",0,1); |
| 950 |