* [PATCH] Button added to performs a GUI diff (inline)
@ 2007-09-08 3:01 Unknown, Pierre Marc Dumuid
2007-09-08 23:34 ` Johannes Schindelin
0 siblings, 1 reply; 2+ messages in thread
From: Unknown, Pierre Marc Dumuid @ 2007-09-08 3:01 UTC (permalink / raw)
To: git; +Cc: pierre.dumuid
>From bd43cca7aa88282455b6bbe6e2f9d8134da1029c Mon Sep 17 00:00:00 2001
From: Pierre Marc Dumuid <pierre.dumuid@adelaide.edu.au>
Date: Sat, 8 Sep 2007 00:32:10 +0930
Subject: [PATCH] Button added to performs a GUI diff
Signed-off-by: Pierre Marc Dumuid <pierre.dumuid@adelaide.edu.au>
---
gitk | 46 +++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 45 insertions(+), 1 deletions(-)
diff --git a/gitk b/gitk
index 300fdce..b8b0b2e 100755
--- a/gitk
+++ b/gitk
@@ -737,7 +737,9 @@ proc makewindow {} {
-command changediffdisp -variable diffelide -value {1 0}
label .bleft.mid.labeldiffcontext -text " Lines of context: " \
-font $uifont
- pack .bleft.mid.diff .bleft.mid.old .bleft.mid.new -side left
+ button .bleft.top.guidiff -text "GUI diff" -command doguidiff \
+ -font $uifont
+ pack .bleft.mid.diff .bleft.mid.old .bleft.mid.new .bleft.top.guidiff -side left
spinbox .bleft.mid.diffcontext -width 5 -font $textfont \
-from 1 -increment 1 -to 10000000 \
-validate all -validatecommand "diffcontextvalidate %P" \
@@ -5332,6 +5334,48 @@ proc incrsearch {name ix op} {
}
}
+proc doguidiff {} {
+ global cflist sha1string
+
+ set taglist [$cflist tag ranges highlight]
+ set from [lindex $taglist 0]
+ set to [lindex $taglist 1]
+
+ set fname [$cflist get $from $to]
+
+ if {[catch {set merge_tool [exec git-config merge.tool]} err]} {
+ error_popup "Sorry, 'merge.tool' not defined in git-config"
+ return
+ }
+
+ if {[catch {exec git cat-file -p $sha1string^:$fname > .gitk_diffolder} err]
+ || [catch {exec git cat-file -p $sha1string:$fname > .gitk_diffnewer} err]} {
+ error_popup "Invalid file selected for comparison"
+ return
+ }
+
+ switch -regexp $merge_tool {
+ "kdiff3" {
+ exec kdiff3 --L1 "$fname (Older)" --L2 "$fname (Newer)" .gitk_diffolder .gitk_diffnewer &
+ }
+ "meld|opendiff|vimdiff|xxdiff" {
+ exec $merge_tool .gitk_diffolder .gitk_diffnewer &
+ }
+ "tkdiff" {
+ exec $merge_tool -L "$fname (Older)" -L "$fname (Newer)" .gitk_diffolder .gitk_diffnewer &
+ }
+ "vimdiff" {
+ exec $merge_tool .gitk_diffolder .gitk_diffnewer
+ }
+ "emerge" {
+ exec emacs -f emerge-files-command .gitk_diffolder .gitk_diffnewer &
+ }
+ default {
+ show_error {} "No merge.tool defined."
+ }
+ }
+}
+
proc dosearch {} {
global sstring ctext searchstring searchdirn
--
1.5.2.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Button added to performs a GUI diff (inline)
2007-09-08 3:01 [PATCH] Button added to performs a GUI diff (inline) Unknown, Pierre Marc Dumuid
@ 2007-09-08 23:34 ` Johannes Schindelin
0 siblings, 0 replies; 2+ messages in thread
From: Johannes Schindelin @ 2007-09-08 23:34 UTC (permalink / raw)
To: pierre.dumuid; +Cc: git
Hi,
On Sat, 8 Sep 2007, Pierre Marc Dumuid wrote:
> From bd43cca7aa88282455b6bbe6e2f9d8134da1029c Mon Sep 17 00:00:00 2001
> From: Pierre Marc Dumuid <pierre.dumuid@adelaide.edu.au>
> Date: Sat, 8 Sep 2007 00:32:10 +0930
> Subject: [PATCH] Button added to performs a GUI diff
Almost! Just make sure that you are sending this patch with the correct
Sender and put the Subject: line as subject of your mail.
And then describe in more detail what the patch does (This commit adds a
button to gitk to easily look at diffs between a commit and its first
parent. It uses the GUI tool selected in merge.tool to visualize the
diff, erroring out if none was specified.)
> + if {[catch {exec git cat-file -p $sha1string^:$fname > .gitk_diffolder} err]
> + || [catch {exec git cat-file -p $sha1string:$fname > .gitk_diffnewer} err]} {
> + error_popup "Invalid file selected for comparison"
> + return
> + }
I think I found a solution for removing the temporary files: man n after.
Ciao,
Dscho
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-09-09 8:44 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-09-08 3:01 [PATCH] Button added to performs a GUI diff (inline) Unknown, Pierre Marc Dumuid
2007-09-08 23:34 ` Johannes Schindelin
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).