Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Changes In Branch tk-diff-viewer Excluding Merge-Ins
This is equivalent to a diff from 1860c6d6de to f2035f27f1
2015-01-03
| ||
19:58 | Update the built-in SQLite to the Jan 3 beta for 3.8.8. ... (check-in: ab3fed40ec user: drh tags: trunk) | |
2014-12-30
| ||
21:13 | Revert makefile change accidentally commited ... (Closed-Leaf check-in: f2035f27f1 user: baruch tags: tk-diff-viewer) | |
21:04 | Bring tk diff viewer branch up to date ... (check-in: 42436cef32 user: baruch tags: tk-diff-viewer) | |
2014-12-25
| ||
08:20 | Fix comment explaining JS graph generation ... (check-in: 1860c6d6de user: baruch tags: trunk) | |
2014-12-23
| ||
12:20 | Use a "disjoint" timeline for the display of ancestor and descendent graphs. ... (check-in: 4f2f04495c user: drh tags: trunk) | |
Changes to src/diff.tcl.
︙ | ︙ | |||
157 158 159 160 161 162 163 164 165 166 167 168 169 170 | if {$range eq "" || [lindex [.txtA yview] 1] == 1} { viewDiff fn.first } else { viewDiff [lindex $range 0] } } } proc xvis {col} { set view [$col xview] return [expr {[lindex $view 1]-[lindex $view 0]}] } proc scroll-x {args} { | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 | if {$range eq "" || [lindex [.txtA yview] 1] == 1} { viewDiff fn.first } else { viewDiff [lindex $range 0] } } } proc prev_next_diff { prev_next } { set range [.txtA tag nextrange active 1.0 end] if {$prev_next eq "prev"} { set idx0 [lindex $range 0] if {$idx0 eq ""} {set idx0 end} if {[.txtA compare $idx0 > @0,[winfo height .txtA]]} { set idx0 [.txtA index @0,[winfo height .txtA]] } set idx "" foreach tag [list add rm chng fn] { foreach w [list .txtA .txtB] { lassign [$w tag prevrange $tag $idx0 1.0] a b if { $idx eq "" || ($a ne "" && [$w compare $a > $idx]) } { set idx $a set idx_end $b set tagB $tag set wB $w } } } if {$idx ne ""} { while 1 { lassign [$wB tag prevrange $tagB $idx 1.0] a b if {$b ne "" && [$wB compare $b == "$idx - 1 l lineend"]} { set idx $a } else { break } } } } else { set idx0 [lindex $range 1] if { $idx0 eq "" } { set idx0 1.0 } if { [.txtA compare $idx0 < @0,0] } { set idx0 [.txtA index @0,0] } set idx "" foreach tag [list add rm chng fn] { foreach w [list .txtA .txtB] { lassign [$w tag nextrange $tag $idx0 end] a b if { $idx eq "" || ($a ne "" && [$w compare $a < $idx]) } { set idx $a set idx_end $b set tagB $tag set wB $w } } } if { $idx ne "" } { while 1 { lassign [$wB tag nextrange $tagB $idx_end end] a b if { $a ne "" && [$wB compare $a == "$idx_end + 1 l linestart"] } { set idx_end $b } else { break } } } } if { $idx eq "" } { bell return } set idx [.txtA index "$idx linestart"] if { $tagB ne "fn" } { set idx_end [.txtA index "$idx_end +1l linestart"] } .txtA tag remove active 1.0 end .txtA tag add active $idx $idx_end .txtA tag configure active -borderwidth 2 -relief raised\ -background #eeeeee -foreground black if { $tagB ne "fn" } { .txtA tag lower active } else { .txtA tag raise active } .txtA see 1.0 .txtA see $idx } proc searchText {} { set rangeA [.txtA tag nextrange search 1.0 end] set rangeB [.txtB tag nextrange search 1.0 end] set idx0 [lindex $rangeA 1] if { $idx0 eq "" } { set idx0 [lindex $rangeB 1] } if { $idx0 eq "" } { set idx0 1.0 } set word [.bb.search get] if { [.txtA compare $idx0 < @0,0] } { set idx0 [.txtA index @0,0] } if { [info exists ::this_does_not_find] } { if { $::this_does_not_find eq [list $idx0 $word] } { set idx0 1.0 } unset ::this_does_not_find } set idx "" foreach w [list .txtA .txtB] { foreach regexp [list 0 1] { switch $regexp { 0 { set rexFlag "-exact" } 1 { set rexFlag "-regexp" } } set err [catch { $w search -nocase $rexFlag -count count $word $idx0 end } idx_i] if {!$err && $idx_i ne "" && ($idx eq "" || [$w compare $idx_i < $idx])} { set idx $idx_i set countB $count set wB $w } } } .txtA tag remove search 1.0 end .txtB tag remove search 1.0 end if { $idx eq "" } { bell set ::this_does_not_find [list $idx0 $word] return } set idx_end [$wB index "$idx + $countB c"] $wB tag add search $idx $idx_end $wB tag configure search -borderwidth 2 -relief raised\ -background orange -foreground black $wB tag raise search $wB see 1.0 $wB see $idx } proc reopen { action } { if { ![regexp {[|]\s*(.*)} $::fossilcmd {} cmdList] } { return } set f [lindex $cmdList 0] set args_with_arg \ [list binary branch context c diff-binary from r to W width] set skip_args [list html internal i side-by-side y tk] lassign "" argsDict files for { set i 2 } { $i < [llength $cmdList] } { incr i } { if { [string match "-*" [lindex $cmdList $i]] } { set n [string trimleft [lindex $cmdList $i] "-"] if { $n in $args_with_arg } { dict set argsDict $n [lindex $cmdList $i+1] incr i } elseif { $n ni $skip_args } { dict set argsDict $n 1 } } else { lappend files [lindex $cmdList $i] } } switch $action { togglewhitespace { if { [dict exists $argsDict w] || [dict exists $argsDict ignore-all-space] } { dict unset argsDict w dict unset argsDict ignore-all-space } else { dict set argsDict w 1 } } onefile { set range [.txtA tag nextrange fn "@0,0" "@0,[winfo height .txtA] +1l"] if { $range eq "" } { return } set file [string trim [.txtA get {*}$range]] set files [list $file] regexp -line {local-root:\s+(.*)} [exec $f info] {} dir cd $dir } allfiles { set files "" } prev - next { set widget [focus] if { $widget eq ".txtA" } { set from_to from if { ![dict exists $argsDict from] } { dict set argsDict from current } } elseif { $widget eq ".txtB" } { set from_to to if { ![dict exists $argsDict to] } { dict set argsDict to ckout } } else { tk_messageBox -message "Click on one of the panes to select it" return } lassign "" parent child current tag set err [catch { exec $f info [dict get $argsDict $from_to] } info] if { $err } { if { [dict get $argsDict $from_to] eq "ckout" } { set err [catch { exec $f info } info] if { !$err } { regexp {checkout:\s+(\S+)} $info {} parent } } else { bell return } } else { regexp {uuid:\s+(\S+)\s+(\S+)} $info {} current date regexp {parent:\s+(\S+)} $info {} parent regexp {child:\s+(\S+)} $info {} child } if { [llength $files] == 1 } { set file [lindex $files 0] set err [catch { exec $f finfo -b -limit 100 $file } info] if { $err } { bell return } if { $current eq "" } { if { $action eq "prev" } { regexp {^\S+} $info tag } } else { set current [string range $current 0 9] set prev "" set found 0 foreach line [split $info \n] { regexp {(\S+)\s+(\S+)} $line {} currentL dateL if { $found } { set tag $currentL break } elseif { $currentL eq $current || $dateL < $date } { if { $action eq "next" } { set tag $prev break } set found 1 } set prev $currentL } } } else { if { $action eq "prev" } { set tag $parent } else { set tag $child } } if { $tag eq "" && $action eq "prev" } { bell return } if { $tag ne "" } { dict set argsDict $from_to $tag } else { dict unset argsDict $from_to } if { $from_to eq "to" && ![dict exists $argsDict from] } { dict set argsDict from current } } } set f_args "" dict for "n v" $argsDict { if { $n in $args_with_arg } { lappend f_args -$n $v } else { lappend f_args -$n } } lappend f_args {*}$files # note: trying to put two contiguous "-" gives an error exec $f diff -tk {*}$f_args & exit } proc fossil_ui {} { if { ![regexp {[|]\s*(.*)} $::fossilcmd {} cmdList] } { return } set f [lindex $cmdList 0] exec $f ui & } proc searchToggle {} { set err [catch { pack info .bb.search }] if { $err } { pack .bb.search -side left -padx 5 -after .bb.files tk::TabToWindow .bb.search } else { .txtA tag remove search 1.0 end .txtB tag remove search 1.0 end pack forget .bb.search focus . } } proc xvis {col} { set view [$col xview] return [expr {[lindex $view 1]-[lindex $view 0]}] } proc scroll-x {args} { |
︙ | ︙ | |||
312 313 314 315 316 317 318 | ::ttk::scrollbar .sby -command {.txtA yview} -orient vertical ::ttk::scrollbar .sbxA -command {.txtA xview} -orient horizontal ::ttk::scrollbar .sbxB -command {.txtB xview} -orient horizontal frame .spacer if {[readDiffs $fossilcmd] == 0} { tk_messageBox -type ok -title $CFG(TITLE) -message "No changes" | | | 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 | ::ttk::scrollbar .sby -command {.txtA yview} -orient vertical ::ttk::scrollbar .sbxA -command {.txtA xview} -orient horizontal ::ttk::scrollbar .sbxB -command {.txtB xview} -orient horizontal frame .spacer if {[readDiffs $fossilcmd] == 0} { tk_messageBox -type ok -title $CFG(TITLE) -message "No changes" #exit } update idletasks proc saveDiff {} { set fn [tk_getSaveFile] if {$fn==""} return set out [open $fn wb] |
︙ | ︙ | |||
355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 | .mkr config -state normal set clt [.mkr search -all < 1.0 end] set cgt [.mkr search -all > 1.0 end] foreach c $clt {.mkr replace $c "$c +1 chars" >} foreach c $cgt {.mkr replace $c "$c +1 chars" <} .mkr config -state disabled } ::ttk::button .bb.quit -text {Quit} -command exit ::ttk::button .bb.invert -text {Invert} -command invertDiff ::ttk::button .bb.save -text {Save As...} -command saveDiff pack .bb.quit .bb.invert -side left if {$fossilcmd!=""} {pack .bb.save -side left} pack .bb.files -side left grid rowconfigure . 1 -weight 1 grid columnconfigure . 1 -weight 1 grid columnconfigure . 4 -weight 1 | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 | .mkr config -state normal set clt [.mkr search -all < 1.0 end] set cgt [.mkr search -all > 1.0 end] foreach c $clt {.mkr replace $c "$c +1 chars" >} foreach c $cgt {.mkr replace $c "$c +1 chars" <} .mkr config -state disabled } proc bind_key_do { cmd } { if { [focus] eq ".bb.search" } { return -code continue } uplevel #0 $cmd return -code break } ::ttk::menubutton .bb.actions -text "Actions" -menu .bb.actions.m menu .bb.actions.m -tearoff 0 .bb.actions.m add command -label "Go to previous diff" -acc "p" -command "prev_next_diff prev" .bb.actions.m add command -label "Go to next diff" -acc "n" -command "prev_next_diff next" .bb.actions.m add separator .bb.actions.m add command -label "Search" -acc "f" -command "searchToggle;" .bb.actions.m add command -label "Toggle whitespace" -acc "w" -command "reopen togglewhitespace" .bb.actions.m add separator .bb.actions.m add command -label "View one file" -acc "1" -command "reopen onefile" .bb.actions.m add command -label "View all files" -acc "a" -command "reopen allfiles" .bb.actions.m add separator .bb.actions.m add command -label "Older version" -acc "Shift-P" -command "reopen prev" .bb.actions.m add command -label "Newer version" -acc "Shift-N" -command "reopen next" .bb.actions.m add command -label "Fossil ui" -acc "u" -command "fossil_ui" ::ttk::button .bb.quit -text {Quit} -command exit ::ttk::button .bb.invert -text {Invert} -command invertDiff ::ttk::button .bb.save -text {Save As...} -command saveDiff ::ttk::entry .bb.search -width 12 bind .bb.search <Return> "searchText; break" bind .bb.search <Escape> "searchToggle; break" bind . <Key-f> [list bind_key_do "searchToggle"] bind . <Key-w> [list bind_key_do "reopen togglewhitespace"] bind . <Key-1> [list bind_key_do "reopen onefile"] bind . <Key-a> [list bind_key_do "reopen allfiles"] bind . <Key-P> [list bind_key_do "reopen prev"] bind . <Key-N> [list bind_key_do "reopen next"] bind . <Key-u> [list bind_key_do "fossil_ui"] lassign [list "(current)" "(ckout)"] from to if { [regexp {[|]\s*(.*)} $::fossilcmd {} cmdList] } { set f [lindex $cmdList 0] if { [regexp {([-][-]?from|-r)\s+(\S+)} [join $cmdList " "] {} {} from] } { set err [catch { exec $f info $from } info] if { !$err } { regexp {uuid:\s+(\S+)\s+(\S+)\s+(\S+)} $info {} from date time set from "\[[string range $from 0 9]\] $date $time" } } if { [regexp {([-][-]?to)\s+(\S+)} [join $cmdList " "] {} {} to] } { set err [catch { exec $f info $to } info] if { !$err } { regexp {uuid:\s+(\S+)\s+(\S+)\s+(\S+)} $info {} to date time set to "\[[string range $to 0 9]\] $date $time" } } } ttk::label .bb.from -text $from ttk::label .bb.to -text $to pack .bb.from -side left -padx "2 25" pack .bb.quit .bb.invert -side left if {$fossilcmd!=""} {pack .bb.save -side left} pack .bb.files -side left pack .bb.actions -side left pack .bb.to -side left -padx "25 2" grid rowconfigure . 1 -weight 1 grid columnconfigure . 1 -weight 1 grid columnconfigure . 4 -weight 1 grid .bb -row 0 -columnspan 7 eval grid [cols] -row 1 -sticky nsew grid .sby -row 1 -column 5 -sticky ns grid .sbxA -row 2 -columnspan 2 -sticky ew grid .spacer -row 2 -column 2 grid .sbxB -row 2 -column 3 -columnspan 2 -sticky ew .spacer config -height [winfo height .sbxA] wm deiconify . } eval $prog |