Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Working on fourway |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
a608e481447e2eb5191447b12067749a |
User & Date: | peter 2018-05-12 22:46:11.721 |
Context
2018-05-12
| ||
23:28 | Fourway work. check-in: d0b5e344e7 user: peter tags: trunk | |
22:46 | Working on fourway check-in: a608e48144 user: peter tags: trunk | |
22:22 | Fixed bug in Fossil handling. Rev -1 did not work. check-in: f6025faa97 user: peter tags: trunk | |
Changes
Changes to src/eskil.tcl.
︙ | ︙ | |||
2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 | # Change color settings proc applyColor {} { global dirdiff foreach top $::eskil(diffWindows) { if {$top eq ".clipdiff"} continue if {$top != ".dirdiff"} { foreach item {wLine1 wDiff1 wLine2 wDiff2} { if {![info exists ::widgets($top,$item)]} continue set w $::widgets($top,$item) $w tag configure equal -foreground $::Pref(colorequal) \ -background $::Pref(bgequal) | > | 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 | # Change color settings proc applyColor {} { global dirdiff foreach top $::eskil(diffWindows) { if {$top eq ".clipdiff"} continue if {[string match .fourway* $top]} continue if {$top != ".dirdiff"} { foreach item {wLine1 wDiff1 wLine2 wDiff2} { if {![info exists ::widgets($top,$item)]} continue set w $::widgets($top,$item) $w tag configure equal -foreground $::Pref(colorequal) \ -background $::Pref(bgequal) |
︙ | ︙ | |||
3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 | menu $top.m.mt $top.m.mt add command -label "New Diff Window" -underline 0 \ -command [list makeDiffWin $top] $top.m.mt add command -label "Directory Diff" -underline 0 \ -command makeDirDiffWin $top.m.mt add command -label "Clip Diff" -underline 0 \ -command makeClipDiffWin $top.m.mt add command -label "Table Diff" -underline 0 \ -command [list makeDiffWin $top -table] $top.m.mt add command -label "Merge" -underline 0 \ -command [list makeMergeWin $top] -state disabled $top.m.mt add command -label "Edit Mode" -underline 0 \ -command [list allowEdit $top] -state disabled $top.m.mt add command -label "Paste Patch" -underline 0 \ | > > | 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 | menu $top.m.mt $top.m.mt add command -label "New Diff Window" -underline 0 \ -command [list makeDiffWin $top] $top.m.mt add command -label "Directory Diff" -underline 0 \ -command makeDirDiffWin $top.m.mt add command -label "Clip Diff" -underline 0 \ -command makeClipDiffWin $top.m.mt add command -label "Fourway Diff" -underline 0 \ -command makeFourWayWin $top.m.mt add command -label "Table Diff" -underline 0 \ -command [list makeDiffWin $top -table] $top.m.mt add command -label "Merge" -underline 0 \ -command [list makeMergeWin $top] -state disabled $top.m.mt add command -label "Edit Mode" -underline 0 \ -command [list allowEdit $top] -state disabled $top.m.mt add command -label "Paste Patch" -underline 0 \ |
︙ | ︙ |
Changes to src/fourway.tcl.
︙ | ︙ | |||
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 | # Top level dialog, for doing fourway diff snit::widget FourWay { hulltype toplevel widgetclass Toplevel variable fields variable files variable revs constructor {args} { eskilRegisterToplevel $win wm title $win "Four Way Diff" wm protocol $win WM_DELETE_WINDOW "cleanupAndExit $win" $hull configure -padx 3 -pady 3 menu $win.m $hull configure -menu $win.m $win.m add cascade -menu $win.m.mf -label "File" -underline 0 menu $win.m.mf $win.m.mf add command -label "Close" -underline 0 \ -command [list cleanupAndExit $win] $win.m.mf add separator $win.m.mf add command -label "Quit" -underline 0 \ -command [list cleanupAndExit all] # Four files, with optional revision set fields {base1 change1 base2 change2} ttk::label $win.l1 -text "Base 1" ttk::label $win.l2 -text "Changed 1" ttk::label $win.l3 -text "Base 2" ttk::label $win.l4 -text "Changed 2" | > > > > > > | 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 | # Top level dialog, for doing fourway diff snit::widget FourWay { hulltype toplevel widgetclass Toplevel variable fields variable files variable revs variable doingLine1 variable doingLine2 constructor {args} { eskilRegisterToplevel $win wm title $win "Four Way Diff" wm protocol $win WM_DELETE_WINDOW "cleanupAndExit $win" $hull configure -padx 3 -pady 3 menu $win.m $hull configure -menu $win.m $win.m add cascade -menu $win.m.mf -label "File" -underline 0 menu $win.m.mf $win.m.mf add command -label "Close" -underline 0 \ -command [list cleanupAndExit $win] $win.m.mf add separator $win.m.mf add command -label "Quit" -underline 0 \ -command [list cleanupAndExit all] if {$::eskil(debug) == 1} { AddDebugMenu $win } # Four files, with optional revision set fields {base1 change1 base2 change2} ttk::label $win.l1 -text "Base 1" ttk::label $win.l2 -text "Changed 1" ttk::label $win.l3 -text "Base 2" ttk::label $win.l4 -text "Changed 2" |
︙ | ︙ | |||
146 147 148 149 150 151 152 | -parent $win] if {$apa != ""} { set files($field) $apa } } method doFourWayDiff {} { | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 | -parent $win] if {$apa != ""} { set files($field) $apa } } method doFourWayDiff {} { # Copy to local vars to be able to replace with defaults and parsed foreach field $fields { set filename($field) $files($field) set rev($field) $revs($field) } # Fill in defaults, if revisions are given for empty files foreach {from to} $fields { if {$filename($to) eq "" && $revs($to) ne ""} { set filename($to) $files($from) } if {$filename($from) eq "" && $revs($from) ne ""} { set filename($from) $files($to) } } # Remember originals for display, they might be replaced below foreach field $fields { set origfile($field) $filename($field) set origrev($field) $rev($field) } # Figure out any revisions foreach field $fields { # TODO: Move this to helper function in rev.tcl if {$rev($field) ne ""} { set revtype($field) [detectRevSystem $filename($field)] if {$revtype($field) eq ""} { # TODO error set rev($field) "" continue } set revList [list $rev($field)] set revList [eskil::rev::$revtype($field)::ParseRevs \ $filename($field) $revList] if {[llength $revList] == 0} { # TODO error set rev($field) "" } else { set rev($field) [lindex $revList 0] } } # Still a revision? if {$rev($field) ne ""} { set filename($field) [tmpFile] eskil::rev::$revtype($field)::get $origfile($field) \ $filename($field) $rev($field) } } # Handle at least base options set opts $::Pref(ignore) if {$::Pref(nocase)} {lappend opts -nocase} if {$::Pref(noempty)} {lappend opts -noempty} if {$::Pref(pivot) > 0} {lappend opts -pivot $::Pref(pivot)} # Do compare of files, to generate patches foreach side {1 2} { set differr [catch {DiffUtil::diffFiles {*}$opts \ $filename(base$side) $filename(change$side)} diffres] if {$differr != 0} { # TODO error return } set outfile($side) [tmpFile] set ch [open $outfile($side) w] foreach str {From To} field "base$side change$side" { set line "$str $origfile($field)" if {$rev($field) ne ""} { append line " Revision $rev($field)" if {$origrev($field) ne $rev($field)} { append line " ($origrev($field))" } } puts $ch $line } puts $ch [string repeat "-" 78] if {[llength $diffres] == 0} { } set doingLine1 1 set doingLine2 1 set ch1 [open $filename(base$side)] set ch2 [open $filename(change$side)] set t 0 foreach i $diffres { lassign $i line1 n1 line2 n2 $self doText $ch $ch1 $ch2 $n1 $n2 $line1 $line2 } $self doText $ch $ch1 $ch2 0 0 0 0 close $ch1 close $ch2 close $ch } # Now run a diff window with the patch files set top [newDiff $outfile(1) $outfile(2)] } # See dotext in eskil.tcl for more info since this is similar method doText {ch ch1 ch2 n1 n2 line1 line2} { if {$n1 == 0 && $n2 == 0} { # All blocks have been processed. Continue until end of file. # TBD context return } set limit 3 if {($line1 - $doingLine1 < (2 * $limit + 2))} { set limit -1 } # Fill in context before change block if {$doingLine1 == 1} { set allowStartFill 0 } else { set allowStartFill 1 } set t 0 while {$doingLine1 < $line1} { gets $ch1 apa gets $ch2 bepa if {$limit < 0 || ($t < $limit && $allowStartFill) || \ ($line1 - $doingLine1) <= $limit} { # Both sides are supposed to be equal, use one of them puts $ch " $apa" } elseif {$t == $limit && $allowStartFill} { # TBD empty instead? puts $ch [string repeat "-" 78] } incr doingLine1 incr doingLine2 incr t } # Output diff for {set t 0} {$t < $n1} {incr t} { gets $ch1 apa puts $ch "- $apa" incr doingLine1 } for {set t 0} {$t < $n2} {incr t} { gets $ch2 apa puts $ch "+ $apa" incr doingLine2 } } } proc makeFourWayWin {} { set t 1 set top .fourway$t while {[winfo exists $top]} { incr t set top .fourway$t } FourWay $top } |