Slightly older version of master from https://github.com/j6t/gitk

gitk: Add user preference to hide custom references #1

open opened by ilyagr.bsky.social targeting test from pr/16

External tools such as Jujutsu may add many references that are of no interest to the user. This preference hides them.

The non-custom refs are those that pass git's default decoration filter (see set_default_decoration_filter).

The preference is off by default, maintaining current behavior.

Signed-off-by: Ori Avtalion ori@avtalion.name

Labels

None yet.

Participants 1
AT URI
at://did:plc:jp6rly3c67o3zlwarw2ttafu/sh.tangled.repo.pull/3lvhz3l64ku22
+40 -41
Interdiff #1 #2
+40 -41
gitk
··· 1939 1939 set tagids($name) $id 1940 1940 lappend idtags($id) $name 1941 1941 } else { 1942 - if [is_other_ref_visible $name] { 1943 - set otherrefids($name) $id 1944 - lappend idotherrefs($id) $name 1945 - } 1942 + set otherrefids($name) $id 1943 + lappend idotherrefs($id) $name 1946 1944 } 1947 1945 } 1948 1946 catch {close $refd} ··· 2035 2033 set tagids($name) $id 2036 2034 lappend idtags($id) $name 2037 2035 } else { 2038 - set otherrefids($name) $id 2039 - lappend idotherrefs($id) $name 2036 + if [is_other_ref_visible $name] { 2037 + set otherrefids($name) $id 2038 + lappend idotherrefs($id) $name 2039 + } 2040 2040 } 2041 2041 } 2042 2042 catch {close $refd} ··· 11651 11651 -variable hideremotes 11652 11652 grid x $page.hideremotes -sticky w 11653 11653 11654 + ttk::entry $page.refstohide -textvariable refstohide 11655 + ttk::frame $page.refstohidef 11656 + ttk::label $page.refstohidef.l -text [mc "Refs to hide (space-separated)" ] 11657 + pack $page.refstohidef.l -side left 11658 + pack configure $page.refstohidef.l -padx 10 11659 + grid x $page.refstohidef $page.refstohide -sticky ew 11660 + 11654 11661 ttk::checkbutton $page.autocopy -text [mc "Copy commit ID to clipboard"] \ 11655 11662 -variable autocopy 11656 11663 grid x $page.autocopy -sticky w ··· 11698 11705 global NS maxwidth maxgraphpct showneartags showlocalchanges 11699 11706 global tabstop wrapcomment wrapdefault limitdiffs 11700 11707 global autocopy autoselect autosellen extdifftool perfile_attrs 11701 - global hideremotes refstohide want_ttk have_ttk maxrefs web_browser 11708 + global hideremotes want_ttk have_ttk maxrefs web_browser 11702 11709 11703 11710 set page [create_prefs_page $notebook.general] 11704 11711 ··· 11719 11726 -variable hideremotes 11720 11727 grid x $page.hideremotes -sticky w 11721 11728 11722 - ${NS}::entry $page.refstohide -textvariable refstohide 11723 - ${NS}::frame $page.refstohidef 11724 - ${NS}::label $page.refstohidef.l -text [mc "Refs to hide (space-separated)" ] 11725 - pack $page.refstohidef.l -side left 11726 - pack configure $page.refstohidef.l -padx 10 11727 - grid x $page.refstohidef $page.refstohide -sticky ew 11728 - 11729 11729 ${NS}::checkbutton $page.autocopy -text [mc "Copy commit ID to clipboard"] \ 11730 11730 -variable autocopy 11731 11731 grid x $page.autocopy -sticky w ··· 11872 11872 global oldprefs prefstop showneartags showlocalchanges 11873 11873 global uicolor bgcolor fgcolor ctext diffcolors selectbgcolor markbgcolor 11874 11874 global tabstop limitdiffs autoselect autosellen extdifftool perfile_attrs 11875 - global hideremotes refstohide want_ttk have_ttk wrapcomment wrapdefault 11875 + global hideremotes want_ttk have_ttk wrapcomment wrapdefault 11876 11876 11877 11877 set top .gitkprefs 11878 11878 set prefstop $top ··· 11881 11881 return 11882 11882 } 11883 11883 foreach v {maxwidth maxgraphpct showneartags showlocalchanges \ 11884 - limitdiffs tabstop perfile_attrs hideremotes refstohide \ 11885 - want_ttk wrapcomment wrapdefault} { 11884 + limitdiffs tabstop perfile_attrs hideremotes want_ttk wrapcomment wrapdefault} { 11886 11885 set oldprefs($v) [set $v] 11887 11886 } 11888 11887 ttk_toplevel $top ··· 11993 11992 $limitdiffs != $oldprefs(limitdiffs)} { 11994 11993 reselectline 11995 11994 } 11996 - if {$hideremotes != $oldprefs(hideremotes)} { 11995 + if {$hideremotes != $oldprefs(hideremotes) || $refstohide != $oldprefs(refstohide)} { 11997 11996 rereadrefs 11998 11997 } 11999 11998 if {$wrapcomment != $oldprefs(wrapcomment)} { ··· 12008 12007 global oldprefs prefstop 12009 12008 12010 12009 foreach v {maxwidth maxgraphpct showneartags showlocalchanges \ 12011 - limitdiffs tabstop perfile_attrs hideremotes refstohide \ 12012 - want_ttk wrapcomment wrapdefault} { 12010 + limitdiffs tabstop perfile_attrs hideremotes want_ttk wrapcomment wrapdefault} { 12013 12011 global $v 12014 12012 set $v $oldprefs($v) 12015 12013 } ··· 12023 12021 global oldprefs prefstop showneartags showlocalchanges 12024 12022 global fontpref mainfont textfont uifont 12025 12023 global limitdiffs treediffs perfile_attrs 12026 - global hideremotes refstohide wrapcomment wrapdefault 12024 + global hideremotes wrapcomment wrapdefault 12027 12025 global ctext 12028 12026 12029 12027 catch {destroy $prefstop} ··· 12070 12068 $limitdiffs != $oldprefs(limitdiffs)} { 12071 12069 reselectline 12072 12070 } 12073 - if {$hideremotes != $oldprefs(hideremotes) || $refstohide != $oldprefs(refstohide)} { 12071 + if {$hideremotes != $oldprefs(hideremotes)} { 12074 12072 rereadrefs 12075 12073 } 12076 12074 if {$wrapcomment != $oldprefs(wrapcomment)} { ··· 12371 12369 return $tcl_enc 12372 12370 } 12373 12371 12372 + proc is_other_ref_visible {ref} { 12373 + global refstohide 12374 + 12375 + if {$refstohide eq {}} { 12376 + return 1 12377 + } 12378 + 12379 + foreach pat [split $refstohide " "] { 12380 + if {$pat eq {}} continue 12381 + if {[string match $pat $ref]} { 12382 + return 0 12383 + } 12384 + } 12385 + 12386 + return 1 12387 + } 12388 + 12374 12389 ## For msgcat loading, first locate the installation location. 12375 12390 if { [info exists ::env(GITK_MSGSDIR)] } { 12376 12391 ## Msgsdir was manually set in the environment. ··· 12447 12462 return $tcl_enc 12448 12463 } 12449 12464 12450 - proc is_other_ref_visible {ref} { 12451 - global refstohide 12452 - 12453 - if {$refstohide eq {}} { 12454 - return 1 12455 - } 12456 - 12457 - foreach pat [split $refstohide " "] { 12458 - if {$pat eq {}} continue 12459 - if {[string match $pat $ref]} { 12460 - return 0 12461 - } 12462 - } 12463 - 12464 - return 1 12465 - } 12466 - 12467 12465 ## For msgcat loading, first locate the installation location. 12468 12466 if { [info exists ::env(GITK_MSGSDIR)] } { 12469 12467 ## Msgsdir was manually set in the environment. ··· 12495 12493 set wrapdefault "none" 12496 12494 set showneartags 1 12497 12495 set hideremotes 0 12496 + set refstohide "" 12498 12497 set sortrefsbytype 1 12499 12498 set maxrefs 20 12500 12499 set visiblerefs {"master"} ··· 12567 12566 set wrapdefault "none" 12568 12567 set showneartags 1 12569 12568 set hideremotes 0 12570 - set refstohide "" 12571 12569 set maxrefs 20 12572 12570 set visiblerefs {"master"} 12573 12571 set maxlinelen 200 ··· 12639 12637 mergecolors 12640 12638 perfile_attrs 12641 12639 reflinecolor 12640 + refstohide 12642 12641 remotebgcolor 12643 12642 selectbgcolor 12644 12643 showlocalchanges ··· 12674 12673 mainfont textfont uifont tabstop findmergefiles maxgraphpct maxwidth 12675 12674 cmitmode wrapcomment wrapdefault autocopy autoselect autosellen 12676 12675 showneartags maxrefs visiblerefs 12677 - hideremotes refstohide showlocalchanges datetimeformat limitdiffs uicolor want_ttk 12676 + hideremotes showlocalchanges datetimeformat limitdiffs uicolor want_ttk 12678 12677 bgcolor fgcolor uifgcolor uifgdisabledcolor colors diffcolors mergecolors 12679 12678 markbgcolor diffcontext selectbgcolor foundbgcolor currentsearchhitbgcolor 12680 12679 extdifftool perfile_attrs headbgcolor headfgcolor headoutlinecolor

History

4 rounds 0 comments
sign up or login to add to the discussion
1 commit
expand
gitk: Add user preference to hide specific references
merge conflicts detected
expand
  • gitk:11696
expand 0 comments
1 commit
expand
fix merge conflicts
expand 0 comments
1 commit
expand
gitk: Add user preference to hide specific references
expand 0 comments
1 commit
expand
gitk: Add user preference to hide custom references
expand 0 comments