git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / mirror / code / Atom feed
* PATCH to add a button to perform a meld on the current file
@ 2007-09-07  4:46 Pierre Marc Dumuid
  2007-09-07 11:25 ` Johannes Schindelin
  0 siblings, 1 reply; 2+ messages in thread
From: Pierre Marc Dumuid @ 2007-09-07  4:46 UTC (permalink / raw)
  To: git

[-- Attachment #1: Type: text/plain, Size: 308 bytes --]

Here's a dodgy [not that good] patch to perform a GUI comparison on a file.
It is dodgy because it assumes cogito is installed, and you want to use 
meld, and it doesn't remove the temporary files.

Not expecting this to go into main branch, but I find it handy for my 
own purposes nether-the-less.

Pierre

[-- Attachment #2: gitk_addGUIdiff01.patch --]
[-- Type: text/x-patch, Size: 1166 bytes --]

--- /usr/bin/gitk	2007-08-06 07:55:41.000000000 +0930
+++ /home/pmdumuid/bin/gitkpmd	2007-09-07 14:09:28.000000000 +0930
@@ -609,7 +609,9 @@
 	-command changediffdisp -variable diffelide -value {0 1}
     radiobutton .bleft.mid.new -text "New version" \
 	-command changediffdisp -variable diffelide -value {1 0}
-    pack .bleft.mid.diff .bleft.mid.old .bleft.mid.new -side left
+    button .bleft.top.meld -text "GUI diff" -command doguidiff \
+	-font $uifont
+    pack .bleft.mid.diff .bleft.mid.old .bleft.mid.new .bleft.top.meld -side left
     set ctext .bleft.ctext
     text $ctext -background $bgcolor -foreground $fgcolor \
 	-state disabled -font $textfont \
@@ -4564,6 +4566,19 @@
     }
 }
 
+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]
+    exec cg-admin-cat -r $sha1string^ $fname > .gitk_diffolder
+    exec cg-admin-cat -r $sha1string $fname > .gitk_diffnewer
+    exec meld .gitk_diffolder .gitk_diffnewer &
+}
+
 proc dosearch {} {
     global sstring ctext searchstring searchdirn
 

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: PATCH to add a button to perform a meld on the current file
  2007-09-07  4:46 PATCH to add a button to perform a meld on the current file Pierre Marc Dumuid
@ 2007-09-07 11:25 ` Johannes Schindelin
  0 siblings, 0 replies; 2+ messages in thread
From: Johannes Schindelin @ 2007-09-07 11:25 UTC (permalink / raw)
  To: Pierre Marc Dumuid; +Cc: git

Hi,

On Fri, 7 Sep 2007, Pierre Marc Dumuid wrote:

> Here's a dodgy [not that good] patch to perform a GUI comparison on a 
> file. It is dodgy because it assumes cogito is installed, and you want 
> to use meld, and it doesn't remove the temporary files.

cogito is phased out.

> Not expecting this to go into main branch, but I find it handy for my 
> own purposes nether-the-less.

Just in case you want to get it in, here are some comments (made harder by 
the fact that you did not follow Documentation/SubmittingPatches)...

> --- /usr/bin/gitk	2007-08-06 07:55:41.000000000 +0930
> +++ /home/pmdumuid/bin/gitkpmd	2007-09-07 14:09:28.000000000 +0930

You might want to consider using format-patch next time ;-)

> @@ -4564,6 +4566,19 @@
>      }
>  }
>  
> +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]
> +    exec cg-admin-cat -r $sha1string^ $fname > .gitk_diffolder
> +    exec cg-admin-cat -r $sha1string $fname > .gitk_diffnewer

This can be be achieved by "git cat-file -t blob $sha1string^:$fname", and 
likewise for $sha1string.

+    exec meld .gitk_diffolder .gitk_diffnewer &
+}

Hmm.  If you allow it to block, you might have more chances to clean up 
the temporary files...

Also, it would be nice to have it configurable which tool you use, a la 
git-mergetool.

Ciao,
Dscho
 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-09-07 11:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-09-07  4:46 PATCH to add a button to perform a meld on the current file Pierre Marc Dumuid
2007-09-07 11:25 ` Johannes Schindelin

Code repositories for project(s) associated with this 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).