[ANNOUNCE] mtkdiff-20050514 (integrated w/ gitk)

Tejun Heo htejun at gmail.com
Wed Aug 31 21:59:34 BST 2011


 Hello, guys.

 This is mtkdiff-20050514.  I've modified gitk to invoke gitkdiff on
double click and right click.  If you double click on a commit mtkdiff
will show the commit.  If you right click on a commit while another
one is selected, mtkdiff will show the difference between the two
commits (as in bk revtool).  Also, I've modified gitk & gitkdiff to
show commit SHA1 in the info text when a commit is selected.

 The tarball can be found at

 http://home-tj.org/mtkdiff/files/mtkdiff-20050514.tar.gz

 Patch of the gitk changes follow.  (gitk-0.9 vs. the modified version)

 Thanks.

--- gitk-0.9	2005-05-14 11:57:02.000000000 +0900
+++ gitk	2005-05-14 11:57:04.000000000 +0900
@@ -175,6 +175,8 @@ proc makewindow {} {
     pack .ctop -side top -fill both -expand 1
 
     bindall <1> {selcanvline %x %y}
+    bindall <Double-1> {canvdclick %x %y}
+    bindall <3> {canvrclick %x %y}
     bindall <B1-Motion> {selcanvline %x %y}
     bindall <ButtonRelease-4> "allcanvs yview scroll -5 u"
     bindall <ButtonRelease-5> "allcanvs yview scroll 5 u"
@@ -473,7 +475,7 @@ proc drawgraph {start} {
     }
 }
 
-proc selcanvline {x y} {
+proc coordtoline {x, y} {
     global canv canvy0 ctext linespc selectedline
     global lineid linehtag linentag linedtag
     set ymax [lindex [$canv cget -scrollregion] 3]
@@ -483,8 +485,38 @@ proc selcanvline {x y} {
     if {$l < 0} {
 	set l 0
     }
-    if {[info exists selectedline] && $selectedline == $l} return
-    selectline $l
+    if {[info exists selectedline] && $selectedline == $l} {
+	return -1
+    }
+    return $l
+}
+
+proc selcanvline {x y} {
+    set l [coordtoline $x, $y]
+    if {$l >= 0} {
+	selectline $l
+    }
+}
+
+proc canvdclick {x y} {
+    global lineid selectedline
+    selcanvline $x $y
+    if {[info exists selectedline]} {
+	exec gitkdiff -r $lineid($selectedline) &
+    }
+}
+
+proc canvrclick {x y} {
+    global selectedline lineid
+
+    if {[info exists selectedline]} {
+	set l [coordtoline $x, $y]
+	if {$selectedline != $l} {
+	    exec gitkdiff -r $lineid($selectedline) -r $lineid($l) &
+	}
+    } else {
+	selcanvline $x $y
+    }
 }
 
 proc selectline {l} {
@@ -521,6 +553,7 @@ proc selectline {l} {
     $ctext conf -state normal
     $ctext delete 0.0 end
     set info $commitinfo($id)
+    $ctext insert end "Commit: $id\n"
     $ctext insert end "Author: [lindex $info 1]  [lindex $info 2]\n"
     $ctext insert end "Committer: [lindex $info 3]  [lindex $info 4]\n"
     $ctext insert end "\n"
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html



More information about the git-announce mailing list