git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gitk: new option to hide remote refs
@ 2009-08-03 21:53 Thomas Rast
  2009-08-04  6:28 ` Junio C Hamano
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Thomas Rast @ 2009-08-03 21:53 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: Thell Fowler, git

In repositories with lots of remotes, looking at the history in gitk
can be borderline insane with all the red labels for remote refs.
Introduce a new option in the preferences that hides them.

Wished-for-by: Thell Fowler <tbfowler4@gmail.com>
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
---

I hope the IRC-to-mail matching worked out right.  I needed this too,
for a repo where I deploy for testing directly through git (with
hooks) -- to several machines, resulting in a forest of remote labels.


 gitk |   18 +++++++++++++++---
 1 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/gitk b/gitk
index 4604c83..aabebac 100755
--- a/gitk
+++ b/gitk
@@ -1677,6 +1677,7 @@ proc readrefs {} {
     global tagids idtags headids idheads tagobjid
     global otherrefids idotherrefs mainhead mainheadid
     global selecthead selectheadid
+    global hideremotes
 
     foreach v {tagids idtags headids idheads otherrefids idotherrefs} {
 	catch {unset $v}
@@ -1689,7 +1690,7 @@ proc readrefs {} {
 	if {![string match "refs/*" $ref]} continue
 	set name [string range $ref 5 end]
 	if {[string match "remotes/*" $name]} {
-	    if {![string match "*/HEAD" $name]} {
+	    if {![string match "*/HEAD" $name] && !$hideremotes} {
 		set headids($name) $id
 		lappend idheads($id) $name
 	    }
@@ -2520,6 +2521,7 @@ proc savestuff {w} {
     global cmitmode wrapcomment datetimeformat limitdiffs
     global colors bgcolor fgcolor diffcolors diffcontext selectbgcolor
     global autoselect extdifftool perfile_attrs markbgcolor
+    global hideremotes
 
     if {$stuffsaved} return
     if {![winfo viewable .]} return
@@ -2539,6 +2541,7 @@ proc savestuff {w} {
 	puts $f [list set wrapcomment $wrapcomment]
 	puts $f [list set autoselect $autoselect]
 	puts $f [list set showneartags $showneartags]
+	puts $f [list set hideremotes $hideremotes]
 	puts $f [list set showlocalchanges $showlocalchanges]
 	puts $f [list set datetimeformat $datetimeformat]
 	puts $f [list set limitdiffs $limitdiffs]
@@ -10383,6 +10386,7 @@ proc doprefs {} {
     global oldprefs prefstop showneartags showlocalchanges
     global bgcolor fgcolor ctext diffcolors selectbgcolor markbgcolor
     global tabstop limitdiffs autoselect extdifftool perfile_attrs
+    global hideremotes
 
     set top .gitkprefs
     set prefstop $top
@@ -10391,7 +10395,7 @@ proc doprefs {} {
 	return
     }
     foreach v {maxwidth maxgraphpct showneartags showlocalchanges \
-		   limitdiffs tabstop perfile_attrs} {
+		   limitdiffs tabstop perfile_attrs hideremotes} {
 	set oldprefs($v) [set $v]
     }
     toplevel $top
@@ -10423,6 +10427,9 @@ proc doprefs {} {
     checkbutton $top.ntag -text [mc "Display nearby tags"] \
 	-font optionfont -variable showneartags
     grid x $top.ntag -sticky w
+    checkbutton $top.hideremotes -text [mc "Hide remote refs"] \
+	-font optionfont -variable hideremotes
+    grid x $top.hideremotes -sticky w
     checkbutton $top.ldiff -text [mc "Limit diffs to listed paths"] \
 	-font optionfont -variable limitdiffs
     grid x $top.ldiff -sticky w
@@ -10547,7 +10554,7 @@ proc prefscan {} {
     global oldprefs prefstop
 
     foreach v {maxwidth maxgraphpct showneartags showlocalchanges \
-		   limitdiffs tabstop perfile_attrs} {
+		   limitdiffs tabstop perfile_attrs hideremotes} {
 	global $v
 	set $v $oldprefs($v)
     }
@@ -10561,6 +10568,7 @@ proc prefsok {} {
     global oldprefs prefstop showneartags showlocalchanges
     global fontpref mainfont textfont uifont
     global limitdiffs treediffs perfile_attrs
+    global hideremotes
 
     catch {destroy $prefstop}
     unset prefstop
@@ -10606,6 +10614,9 @@ proc prefsok {} {
 	  $limitdiffs != $oldprefs(limitdiffs)} {
 	reselectline
     }
+    if {$hideremotes != $oldprefs(hideremotes)} {
+	rereadrefs
+    }
 }
 
 proc formatdate {d} {
@@ -11011,6 +11022,7 @@ set mingaplen 100
 set cmitmode "patch"
 set wrapcomment "none"
 set showneartags 1
+set hideremotes 0
 set maxrefs 20
 set maxlinelen 200
 set showlocalchanges 1
-- 
1.6.4.249.gea1ec

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

* Re: [PATCH] gitk: new option to hide remote refs
  2009-08-03 21:53 [PATCH] gitk: new option to hide remote refs Thomas Rast
@ 2009-08-04  6:28 ` Junio C Hamano
  2009-08-04  9:08   ` Thomas Rast
  2009-08-10  0:14 ` Thell Fowler
  2009-08-13 11:53 ` Paul Mackerras
  2 siblings, 1 reply; 6+ messages in thread
From: Junio C Hamano @ 2009-08-04  6:28 UTC (permalink / raw)
  To: Thomas Rast; +Cc: Paul Mackerras, Thell Fowler, git

Thomas Rast <trast@student.ethz.ch> writes:

> @@ -1689,7 +1690,7 @@ proc readrefs {} {
>  	if {![string match "refs/*" $ref]} continue
>  	set name [string range $ref 5 end]
>  	if {[string match "remotes/*" $name]} {
> -	    if {![string match "*/HEAD" $name]} {
> +	    if {![string match "*/HEAD" $name] && !$hideremotes} {
>  		set headids($name) $id
>  		lappend idheads($id) $name
>  	    }

Hmm, I wonder if it would be more useful to extend this by using $skiprefs
pattern instead, like so:

>  	if {![string match "refs/*" $ref]} continue
>  	set name [string range $ref 5 end]
+	if {$skiprefs != "" && [string match $skiprefs $name]} continue
>  	if {[string match "remotes/*" $name]} {
> 	    if {![string match "*/HEAD" $name]} {
	...

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

* Re: [PATCH] gitk: new option to hide remote refs
  2009-08-04  6:28 ` Junio C Hamano
@ 2009-08-04  9:08   ` Thomas Rast
  2009-08-04  9:44     ` Santi Béjar
  0 siblings, 1 reply; 6+ messages in thread
From: Thomas Rast @ 2009-08-04  9:08 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Paul Mackerras, Thell Fowler, git

Junio C Hamano wrote:
> Thomas Rast <trast@student.ethz.ch> writes:
> 
> > -	    if {![string match "*/HEAD" $name]} {
> > +	    if {![string match "*/HEAD" $name] && !$hideremotes} {
> 
> Hmm, I wonder if it would be more useful to extend this by using $skiprefs
> pattern instead, like so:
[...]
> +	if {$skiprefs != "" && [string match $skiprefs $name]} continue

Shortly after sending the patch, I had another idea: how about an
option to only show refs that were given on the command line, if any?
That way 'gitk --branches' or 'gitk HEAD' would hide the whole remotes
mess (and of course also all other refs in the process).  I think I
might be able to voodoo enough Tk to implement this.

-- 
Thomas Rast
trast@{inf,student}.ethz.ch

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

* Re: [PATCH] gitk: new option to hide remote refs
  2009-08-04  9:08   ` Thomas Rast
@ 2009-08-04  9:44     ` Santi Béjar
  0 siblings, 0 replies; 6+ messages in thread
From: Santi Béjar @ 2009-08-04  9:44 UTC (permalink / raw)
  To: Thomas Rast; +Cc: Junio C Hamano, Paul Mackerras, Thell Fowler, git

2009/8/4 Thomas Rast <trast@student.ethz.ch>:
> Junio C Hamano wrote:
>> Thomas Rast <trast@student.ethz.ch> writes:
>>
>> > -       if {![string match "*/HEAD" $name]} {
>> > +       if {![string match "*/HEAD" $name] && !$hideremotes} {
>>
>> Hmm, I wonder if it would be more useful to extend this by using $skiprefs
>> pattern instead, like so:
> [...]
>> +     if {$skiprefs != "" && [string match $skiprefs $name]} continue
>
> Shortly after sending the patch, I had another idea: how about an
> option to only show refs that were given on the command line, if any?
> That way 'gitk --branches' or 'gitk HEAD' would hide the whole remotes
> mess (and of course also all other refs in the process).  I think I
> might be able to voodoo enough Tk to implement this.

Another possibility could be to have just an indication that the
commit has branches and/or tags pointing to it. Maybe just as it is
now but without the branch/tag name.

To mimic the current UI it could be:

o-<|-|_| Commit summary

with:

 o the current circle
 <| a yellow triangle
 |_| a green square

and then if you click on them you could get the current view, or a
list of branches/tags in the lower panel.

my 2 cents,
Santi

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

* Re: [PATCH] gitk: new option to hide remote refs
  2009-08-03 21:53 [PATCH] gitk: new option to hide remote refs Thomas Rast
  2009-08-04  6:28 ` Junio C Hamano
@ 2009-08-10  0:14 ` Thell Fowler
  2009-08-13 11:53 ` Paul Mackerras
  2 siblings, 0 replies; 6+ messages in thread
From: Thell Fowler @ 2009-08-10  0:14 UTC (permalink / raw)
  To: Thomas Rast; +Cc: Paul Mackerras, git

Thomas Rast (trast@student.ethz.ch) wrote on Aug 3, 2009:

> In repositories with lots of remotes, looking at the history in gitk
> can be borderline insane with all the red labels for remote refs.
> Introduce a new option in the preferences that hides them.

Thanks for doing this!  It definitely is saving the sanity and is working 
great!

-- 
Thell

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

* Re: [PATCH] gitk: new option to hide remote refs
  2009-08-03 21:53 [PATCH] gitk: new option to hide remote refs Thomas Rast
  2009-08-04  6:28 ` Junio C Hamano
  2009-08-10  0:14 ` Thell Fowler
@ 2009-08-13 11:53 ` Paul Mackerras
  2 siblings, 0 replies; 6+ messages in thread
From: Paul Mackerras @ 2009-08-13 11:53 UTC (permalink / raw)
  To: Thomas Rast; +Cc: Thell Fowler, git

Thomas Rast writes:

> In repositories with lots of remotes, looking at the history in gitk
> can be borderline insane with all the red labels for remote refs.
> Introduce a new option in the preferences that hides them.

Thanks, applied.  I modified the patch description slightly since the
patched gitk doesn't just hide the remote refs, it ignores them
completely ("hide" implies to me that gitk still knows about them but
chooses not to show them).

Paul.

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

end of thread, other threads:[~2009-08-13 11:55 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-03 21:53 [PATCH] gitk: new option to hide remote refs Thomas Rast
2009-08-04  6:28 ` Junio C Hamano
2009-08-04  9:08   ` Thomas Rast
2009-08-04  9:44     ` Santi Béjar
2009-08-10  0:14 ` Thell Fowler
2009-08-13 11:53 ` Paul Mackerras

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 NNTP newsgroup(s).