{"thread":{"id":"9827","subject":"[PATCH] Button added to performs a GUI diff (inline)","startedAt":"2007-09-08T03:01:26Z","lastAt":"2007-09-08T23:34:35Z","messageCount":2,"participants":["Unknown","Johannes Schindelin"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"52970","messageId":"200709081231.26894.pmdumuid@pezdell","threadId":"9827","inReplyTo":null,"subject":"[PATCH] Button added to performs a GUI diff (inline)","fromName":"Unknown","fromEmail":"unknown@unknown.invalid","sentAt":"2007-09-08T03:01:26Z","receivedAt":"2007-09-08T03:01:26Z","isPatch":true,"sender":{"key":"unknown@unknown.invalid","avatar":null},"body":">From bd43cca7aa88282455b6bbe6e2f9d8134da1029c Mon Sep 17 00:00:00 2001\nFrom: Pierre Marc Dumuid <pierre.dumuid@adelaide.edu.au>\nDate: Sat, 8 Sep 2007 00:32:10 +0930\nSubject: [PATCH] Button added to performs a GUI diff\n\nSigned-off-by: Pierre Marc Dumuid <pierre.dumuid@adelaide.edu.au>\n---\n gitk |   46 +++++++++++++++++++++++++++++++++++++++++++++-\n 1 files changed, 45 insertions(+), 1 deletions(-)\n\ndiff --git a/gitk b/gitk\nindex 300fdce..b8b0b2e 100755\n--- a/gitk\n+++ b/gitk\n@@ -737,7 +737,9 @@ proc makewindow {} {\n \t-command changediffdisp -variable diffelide -value {1 0}\n     label .bleft.mid.labeldiffcontext -text \"      Lines of context: \" \\\n \t-font $uifont\n-    pack .bleft.mid.diff .bleft.mid.old .bleft.mid.new -side left\n+    button .bleft.top.guidiff -text \"GUI diff\" -command doguidiff \\\n+\t-font $uifont\n+    pack .bleft.mid.diff .bleft.mid.old .bleft.mid.new .bleft.top.guidiff -side left\n     spinbox .bleft.mid.diffcontext -width 5 -font $textfont \\\n \t-from 1 -increment 1 -to 10000000 \\\n \t-validate all -validatecommand \"diffcontextvalidate %P\" \\\n@@ -5332,6 +5334,48 @@ proc incrsearch {name ix op} {\n     }\n }\n \n+proc doguidiff {} {\n+    global cflist sha1string\n+\n+    set taglist [$cflist tag ranges highlight]\n+    set from [lindex $taglist 0]\n+    set to [lindex $taglist 1]\n+\n+    set fname [$cflist get $from $to]\n+\n+    if {[catch {set merge_tool [exec git-config merge.tool]} err]} {\n+\terror_popup \"Sorry, 'merge.tool' not defined in git-config\"\n+\treturn\n+    }\n+\n+    if {[catch {exec git cat-file -p $sha1string^:$fname > .gitk_diffolder} err] \n+\t|| [catch {exec git cat-file -p $sha1string:$fname > .gitk_diffnewer} err]} {\n+\terror_popup \"Invalid file selected for comparison\"\n+\treturn\n+    }\n+\n+    switch -regexp $merge_tool {\n+\t\"kdiff3\" {\n+\t    exec kdiff3 --L1 \"$fname (Older)\" --L2 \"$fname (Newer)\" .gitk_diffolder .gitk_diffnewer  &\n+\t}\n+\t\"meld|opendiff|vimdiff|xxdiff\" {\n+\t    exec $merge_tool .gitk_diffolder .gitk_diffnewer &\n+\t}\n+\t\"tkdiff\" {\n+\t    exec $merge_tool -L \"$fname (Older)\" -L \"$fname (Newer)\" .gitk_diffolder .gitk_diffnewer &\n+\t}\n+\t\"vimdiff\" {\n+\t    exec $merge_tool .gitk_diffolder .gitk_diffnewer \n+\t}\n+\t\"emerge\" {\n+\t    exec emacs -f emerge-files-command .gitk_diffolder .gitk_diffnewer &\n+\t}\n+\tdefault {\n+\t    show_error {} \"No merge.tool defined.\"\n+\t}\n+    }\n+} \n+\n proc dosearch {} {\n     global sstring ctext searchstring searchdirn\n \n-- \n1.5.2.4\n"},{"id":"53016","messageId":"Pine.LNX.4.64.0709090031260.28586@racer.site","threadId":"9827","inReplyTo":"200709081231.26894.pmdumuid@pezdell","subject":"Re: [PATCH] Button added to performs a GUI diff (inline)","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-09-08T23:34:35Z","receivedAt":"2007-09-08T23:34:35Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Sat, 8 Sep 2007, Pierre Marc Dumuid wrote:\n\n> From bd43cca7aa88282455b6bbe6e2f9d8134da1029c Mon Sep 17 00:00:00 2001\n> From: Pierre Marc Dumuid <pierre.dumuid@adelaide.edu.au>\n> Date: Sat, 8 Sep 2007 00:32:10 +0930\n> Subject: [PATCH] Button added to performs a GUI diff\n\nAlmost!  Just make sure that you are sending this patch with the correct \nSender and put the Subject: line as subject of your mail.\n\nAnd then describe in more detail what the patch does (This commit adds a \nbutton to gitk to easily look at diffs between a commit and its first \nparent.  It uses the GUI tool selected in merge.tool to visualize the \ndiff, erroring out if none was specified.)\n\n> +    if {[catch {exec git cat-file -p $sha1string^:$fname > .gitk_diffolder} err] \n> +\t|| [catch {exec git cat-file -p $sha1string:$fname > .gitk_diffnewer} err]} {\n> +\terror_popup \"Invalid file selected for comparison\"\n> +\treturn\n> +    }\n\nI think I found a solution for removing the temporary files: man n after.\n\nCiao,\nDscho\n"}]}