git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[RFC 2/4] gitk: Add diff-diff support

From
Steffen Prohaska <prohaska@zib.de>
Date
Dec 15, 2007, 16:51 UTC
Message-ID
<1197737505599-git-send-email-prohaska@zib.de>
In-Reply-To
<1197737505128-git-send-email-prohaska@zib.de>
---
 gitk-git/gitk |   46 ++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 46 insertions(+), 0 deletions(-)
diff --git a/gitk-git/gitk b/gitk-git/gitk
index 1da0b0a..ca121e4 100644
--- a/gitk-git/gitk
+++ b/gitk-git/gitk
@@ -1019,6 +1019,8 @@ proc makewindow {} {
 	-command {diffvssel 0}
     $rowctxmenu add command -label "Diff selected -> this" \
 	-command {diffvssel 1}
+    $rowctxmenu add command -label "Diff Diff selected -> this" \
+	-command {diffdiffvssel 1}
     $rowctxmenu add command -label "Make patch" -command mkpatch
     $rowctxmenu add command -label "Create tag" -command mktag
     $rowctxmenu add command -label "Write commit to file" -command writecommit
@@ -6010,6 +6012,50 @@ proc doseldiff {oldid newid} {
     startdiff [list $oldid $newid]
 }
 
+proc diffdiffvssel {dirn} {
+    global rowmenuid selectedline displayorder
+
+    if {![info exists selectedline]} return
+    if {$dirn} {
+	set oldid [lindex $displayorder $selectedline]
+	set newid $rowmenuid
+    } else {
+	set oldid $rowmenuid
+	set newid [lindex $displayorder $selectedline]
+    }
+    addtohistory [list doseldiffdiff $oldid $newid]
+    doseldiffdiff $oldid $newid
+}
+
+proc doseldiffdiff {oldid newid} {
+    global ctext
+    global commitinfo
+
+    $ctext conf -state normal
+    clear_ctext
+    init_flist "Top"
+    $ctext insert end "From Commit "
+    $ctext insert end $oldid link0
+    setlink $oldid link0
+    $ctext insert end "\n     "
+    $ctext insert end [lindex $commitinfo($oldid) 0]
+    $ctext insert end "\n\nTo Commit   "
+    $ctext insert end $newid link1
+    setlink $newid link1
+    $ctext insert end "\n     "
+    $ctext insert end [lindex $commitinfo($newid) 0]
+    $ctext insert end "\n"
+    $ctext insert end "\n"
+    $ctext conf -state disabled
+    $ctext tag remove found 1.0 end
+
+    set diff [exec git diff-diff $oldid $newid]
+    $ctext conf -state normal
+    $ctext insert end "\n"
+    $ctext insert end $diff
+    $ctext conf -state disabled
+}
+
 proc mkpatch {} {
     global rowmenuid currentid commitinfo patchtop patchnum
 
-- 
1.5.4.rc0.37.geff3a-dirty
Previous: Steffen ProhaskaNext: Steffen Prohaska
Message 2 of 8 in “[RFC 1/4] Add diff-diff, which compares the diffs of two commits”
  1. Steffen ProhaskaDec 15, 2007
  2. 2/4 gitk: Add diff-diff supportSteffen Prohaska, Dec 15, 2007
  3. 3/4 gitk: Refactor getblobdiffline to split off adddifflineSteffen Prohaska, Dec 15, 2007
  4. 4/4 gitk: Use adddiffline to nicely format diff-diffSteffen Prohaska, Dec 15, 2007
  5. Johannes SchindelinDec 15, 2007
  6. Björn SteinbrinkDec 15, 2007
  7. Steffen ProhaskaDec 15, 2007
  8. Junio C HamanoDec 15, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.