##// END OF EJS Templates
hgk: add context menu visual diff action...
Patrick Mezard -
r5394:0ad0e973 default
parent child Browse files
Show More
@@ -399,6 +399,7 b' proc makewindow {} {'
399 399 global entries sha1entry sha1string sha1but
400 400 global maincursor textcursor curtextcursor
401 401 global rowctxmenu gaudydiff mergemax
402 global hgvdiff
402 403
403 404 menu .bar
404 405 .bar add cascade -label "File" -menu .bar.file
@@ -602,6 +603,12 b' proc makewindow {} {'
602 603 $rowctxmenu add command -label "Make patch" -command mkpatch
603 604 $rowctxmenu add command -label "Create tag" -command mktag
604 605 $rowctxmenu add command -label "Write commit to file" -command writecommit
606 if { $hgvdiff ne "" } {
607 $rowctxmenu add command -label "Visual diff with parent" \
608 -command {vdiff 1}
609 $rowctxmenu add command -label "Visual diff with selected" \
610 -command {vdiff 0}
611 }
605 612 }
606 613
607 614 # when we make a key binding for the toplevel, make sure
@@ -3373,7 +3380,7 b' proc mstime {} {'
3373 3380 }
3374 3381
3375 3382 proc rowmenu {x y id} {
3376 global rowctxmenu idline selectedline rowmenuid
3383 global rowctxmenu idline selectedline rowmenuid hgvdiff
3377 3384
3378 3385 if {![info exists selectedline] || $idline($id) eq $selectedline} {
3379 3386 set state disabled
@@ -3383,6 +3390,9 b' proc rowmenu {x y id} {'
3383 3390 $rowctxmenu entryconfigure 0 -state $state
3384 3391 $rowctxmenu entryconfigure 1 -state $state
3385 3392 $rowctxmenu entryconfigure 2 -state $state
3393 if { $hgvdiff ne "" } {
3394 $rowctxmenu entryconfigure 6 -state $state
3395 }
3386 3396 set rowmenuid $id
3387 3397 tk_popup $rowctxmenu $x $y
3388 3398 }
@@ -3695,6 +3705,26 b' proc rereadrefs {} {'
3695 3705 }
3696 3706 }
3697 3707
3708 proc vdiff {withparent} {
3709 global env rowmenuid selectedline lineid
3710
3711 if {![info exists rowmenuid]} return
3712 set curid $rowmenuid
3713
3714 if {$withparent} {
3715 set parents [exec $env(HG) --config ui.report_untrusted=false parents --rev $curid --template "{node}\n"]
3716 set firstparent [lindex [split $parents "\n"] 0]
3717 set otherid $firstparent
3718 } else {
3719 if {![info exists selectedline]} return
3720 set otherid $lineid($selectedline)
3721 }
3722 set range "$otherid:$curid"
3723 if {[catch {exec $env(HG) --config ui.report_untrusted=false vdiff -r $range} err]} {
3724 # Ignore errors, this is just visualization
3725 }
3726 }
3727
3698 3728 proc showtag {tag isnew} {
3699 3729 global ctext cflist tagcontents tagids linknum
3700 3730
@@ -3774,6 +3804,9 b' set stopped 0'
3774 3804 set redisplaying 0
3775 3805 set stuffsaved 0
3776 3806 set patchnum 0
3807
3808 array set config [getconfig]
3809 set hgvdiff $config(vdiff)
3777 3810 setcoords
3778 3811 makewindow
3779 3812 readrefs
General Comments 0
You need to be logged in to leave comments. Login now