@matheusbsbs / matheus-bagliano / commits / ffe15297b0
Fork 0

gitk: New option to hide remote refs

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 makes gitk ignore remote refs entirely, so they don't take up space in the display. Wished-for-by: Thell Fowler <tbfowler4@gmail.com> Signed-off-by: Thomas Rast <trast@student.ethz.ch> Signed-off-by: Paul Mackerras <paulus@samba.org>

Thomas Rast committed Aug 3, 2009 at 23:53 UTC ffe15297b031814c5cda5d82a6555683c8e80dcc
1 file changed +15 -3
gitk
+15 -3
@@ -1677,6 +1677,7 @@ proc readrefs {} {
1677 global tagids idtags headids idheads tagobjid
1678 global otherrefids idotherrefs mainhead mainheadid
1679 global selecthead selectheadid
1680 + global hideremotes
1681
1682 foreach v {tagids idtags headids idheads otherrefids idotherrefs} {
1683 catch {unset $v}
@@ -1689,7 +1690,7 @@ proc readrefs {} {
1690 if {![string match "refs/*" $ref]} continue
1691 set name [string range $ref 5 end]
1692 if {[string match "remotes/*" $name]} {
1692 - if {![string match "*/HEAD" $name]} {
1693 + if {![string match "*/HEAD" $name] && !$hideremotes} {
1694 set headids($name) $id
1695 lappend idheads($id) $name
1696 }
@@ -2520,6 +2521,7 @@ proc savestuff {w} {
2521 global cmitmode wrapcomment datetimeformat limitdiffs
2522 global colors bgcolor fgcolor diffcolors diffcontext selectbgcolor
2523 global autoselect extdifftool perfile_attrs markbgcolor
2524 + global hideremotes
2525
2526 if {$stuffsaved} return
2527 if {![winfo viewable .]} return
@@ -2539,6 +2541,7 @@ proc savestuff {w} {
2541 puts $f [list set wrapcomment $wrapcomment]
2542 puts $f [list set autoselect $autoselect]
2543 puts $f [list set showneartags $showneartags]
2544 + puts $f [list set hideremotes $hideremotes]
2545 puts $f [list set showlocalchanges $showlocalchanges]
2546 puts $f [list set datetimeformat $datetimeformat]
2547 puts $f [list set limitdiffs $limitdiffs]
@@ -10383,6 +10386,7 @@ proc doprefs {} {
10386 global oldprefs prefstop showneartags showlocalchanges
10387 global bgcolor fgcolor ctext diffcolors selectbgcolor markbgcolor
10388 global tabstop limitdiffs autoselect extdifftool perfile_attrs
10389 + global hideremotes
10390
10391 set top .gitkprefs
10392 set prefstop $top
@@ -10391,7 +10395,7 @@ proc doprefs {} {
10395 return
10396 }
10397 foreach v {maxwidth maxgraphpct showneartags showlocalchanges \
10394 - limitdiffs tabstop perfile_attrs} {
10398 + limitdiffs tabstop perfile_attrs hideremotes} {
10399 set oldprefs($v) [set $v]
10400 }
10401 toplevel $top
@@ -10423,6 +10427,9 @@ proc doprefs {} {
10427 checkbutton $top.ntag -text [mc "Display nearby tags"] \
10428 -font optionfont -variable showneartags
10429 grid x $top.ntag -sticky w
10430 + checkbutton $top.hideremotes -text [mc "Hide remote refs"] \
10431 + -font optionfont -variable hideremotes
10432 + grid x $top.hideremotes -sticky w
10433 checkbutton $top.ldiff -text [mc "Limit diffs to listed paths"] \
10434 -font optionfont -variable limitdiffs
10435 grid x $top.ldiff -sticky w
@@ -10547,7 +10554,7 @@ proc prefscan {} {
10554 global oldprefs prefstop
10555
10556 foreach v {maxwidth maxgraphpct showneartags showlocalchanges \
10550 - limitdiffs tabstop perfile_attrs} {
10557 + limitdiffs tabstop perfile_attrs hideremotes} {
10558 global $v
10559 set $v $oldprefs($v)
10560 }
@@ -10561,6 +10568,7 @@ proc prefsok {} {
10568 global oldprefs prefstop showneartags showlocalchanges
10569 global fontpref mainfont textfont uifont
10570 global limitdiffs treediffs perfile_attrs
10571 + global hideremotes
10572
10573 catch {destroy $prefstop}
10574 unset prefstop
@@ -10606,6 +10614,9 @@ proc prefsok {} {
10614 $limitdiffs != $oldprefs(limitdiffs)} {
10615 reselectline
10616 }
10617 + if {$hideremotes != $oldprefs(hideremotes)} {
10618 + rereadrefs
10619 + }
10620 }
10621
10622 proc formatdate {d} {
@@ -11011,6 +11022,7 @@ set mingaplen 100
11022 set cmitmode "patch"
11023 set wrapcomment "none"
11024 set showneartags 1
11025 +set hideremotes 0
11026 set maxrefs 20
11027 set maxlinelen 200
11028 set showlocalchanges 1