gitk
created pr with
71.1
added 71.2
1: 4a4a512 ! 1: 2441e19 gitk: Add user preference to hide specific references
changed status to
closed
cmds
checkout latest patchset:
ssh pr.pico.sh print 71 | git am -3checkout any patchset in a patch request:
ssh pr.pico.sh print 71.[rev] | git am -3add changes to patch request:
git format-patch main --stdout | ssh pr.pico.sh pr add 71set PR to open (enables RSS notifications):
ssh pr.pico.sh pr open 71set PR to draft (stops RSS notifications):
ssh pr.pico.sh pr draft 71
Patchset
71.2
gitk: Add user preference to hide specific references
Ori Avtalion
2025-05-21T17:12:35ZExternal tools such as Jujutsu may add many references that are of no interest to the user. This preference allows hiding them. Signed-off-by: Ori Avtalion <ori@avtalion.name>
Semantic diff summary
0 added,
0 modified,
0 signature changed,
0 removed
across 0 analyzed files
(1 file skipped: unsupported file type)
+38
-9
gitk
#
| ... | ... | @@ -1939,8 +1939,10 @@ proc readrefs {} { | |
| 1939 | 1939 | set tagids($name) $id | |
| 1940 | 1940 | lappend idtags($id) $name | |
| 1941 | 1941 | } else { | |
| 1942 | - | set otherrefids($name) $id | |
| 1943 | - | lappend idotherrefs($id) $name | |
| 1942 | + | if [is_other_ref_visible $name] { | |
| 1943 | + | set otherrefids($name) $id | |
| 1944 | + | lappend idotherrefs($id) $name | |
| 1945 | + | } | |
| 1944 | 1946 | } | |
| 1945 | 1947 | } | |
| 1946 | 1948 | catch {close $refd} |
| ... | ... | @@ -11696,7 +11698,7 @@ proc prefspage_general {notebook} { | |
| 11696 | 11698 | global NS maxwidth maxgraphpct showneartags showlocalchanges | |
| 11697 | 11699 | global tabstop wrapcomment wrapdefault limitdiffs | |
| 11698 | 11700 | global autocopy autoselect autosellen extdifftool perfile_attrs | |
| 11699 | - | global hideremotes want_ttk have_ttk maxrefs web_browser | |
| 11701 | + | global hideremotes refstohide want_ttk have_ttk maxrefs web_browser | |
| 11700 | 11702 | ||
| 11701 | 11703 | set page [create_prefs_page $notebook.general] | |
| 11702 | 11704 |
| ... | ... | @@ -11717,6 +11719,13 @@ proc prefspage_general {notebook} { | |
| 11717 | 11719 | -variable hideremotes | |
| 11718 | 11720 | grid x $page.hideremotes -sticky w | |
| 11719 | 11721 | ||
| 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 | + | ||
| 11720 | 11729 | ${NS}::checkbutton $page.autocopy -text [mc "Copy commit ID to clipboard"] \ | |
| 11721 | 11730 | -variable autocopy | |
| 11722 | 11731 | grid x $page.autocopy -sticky w |
| ... | ... | @@ -11863,7 +11872,7 @@ proc doprefs {} { | |
| 11863 | 11872 | global oldprefs prefstop showneartags showlocalchanges | |
| 11864 | 11873 | global uicolor bgcolor fgcolor ctext diffcolors selectbgcolor markbgcolor | |
| 11865 | 11874 | global tabstop limitdiffs autoselect autosellen extdifftool perfile_attrs | |
| 11866 | - | global hideremotes want_ttk have_ttk wrapcomment wrapdefault | |
| 11875 | + | global hideremotes refstohide want_ttk have_ttk wrapcomment wrapdefault | |
| 11867 | 11876 | ||
| 11868 | 11877 | set top .gitkprefs | |
| 11869 | 11878 | set prefstop $top |
| ... | ... | @@ -11872,7 +11881,8 @@ proc doprefs {} { | |
| 11872 | 11881 | return | |
| 11873 | 11882 | } | |
| 11874 | 11883 | foreach v {maxwidth maxgraphpct showneartags showlocalchanges \ | |
| 11875 | - | limitdiffs tabstop perfile_attrs hideremotes want_ttk wrapcomment wrapdefault} { | |
| 11884 | + | limitdiffs tabstop perfile_attrs hideremotes refstohide \ | |
| 11885 | + | want_ttk wrapcomment wrapdefault} { | |
| 11876 | 11886 | set oldprefs($v) [set $v] | |
| 11877 | 11887 | } | |
| 11878 | 11888 | ttk_toplevel $top |
| ... | ... | @@ -11998,7 +12008,8 @@ proc prefscan {} { | |
| 11998 | 12008 | global oldprefs prefstop | |
| 11999 | 12009 | ||
| 12000 | 12010 | foreach v {maxwidth maxgraphpct showneartags showlocalchanges \ | |
| 12001 | - | limitdiffs tabstop perfile_attrs hideremotes want_ttk wrapcomment wrapdefault} { | |
| 12011 | + | limitdiffs tabstop perfile_attrs hideremotes refstohide \ | |
| 12012 | + | want_ttk wrapcomment wrapdefault} { | |
| 12002 | 12013 | global $v | |
| 12003 | 12014 | set $v $oldprefs($v) | |
| 12004 | 12015 | } |
| ... | ... | @@ -12012,7 +12023,7 @@ proc prefsok {} { | |
| 12012 | 12023 | global oldprefs prefstop showneartags showlocalchanges | |
| 12013 | 12024 | global fontpref mainfont textfont uifont | |
| 12014 | 12025 | global limitdiffs treediffs perfile_attrs | |
| 12015 | - | global hideremotes wrapcomment wrapdefault | |
| 12026 | + | global hideremotes refstohide wrapcomment wrapdefault | |
| 12016 | 12027 | global ctext | |
| 12017 | 12028 | ||
| 12018 | 12029 | catch {destroy $prefstop} |
| ... | ... | @@ -12059,7 +12070,7 @@ proc prefsok {} { | |
| 12059 | 12070 | $limitdiffs != $oldprefs(limitdiffs)} { | |
| 12060 | 12071 | reselectline | |
| 12061 | 12072 | } | |
| 12062 | - | if {$hideremotes != $oldprefs(hideremotes)} { | |
| 12073 | + | if {$hideremotes != $oldprefs(hideremotes) || $refstohide != $oldprefs(refstohide)} { | |
| 12063 | 12074 | rereadrefs | |
| 12064 | 12075 | } | |
| 12065 | 12076 | if {$wrapcomment != $oldprefs(wrapcomment)} { |
| ... | ... | @@ -12436,6 +12447,23 @@ proc get_path_encoding {path} { | |
| 12436 | 12447 | return $tcl_enc | |
| 12437 | 12448 | } | |
| 12438 | 12449 | ||
| 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 | + | ||
| 12439 | 12467 | ## For msgcat loading, first locate the installation location. | |
| 12440 | 12468 | if { [info exists ::env(GITK_MSGSDIR)] } { | |
| 12441 | 12469 | ## Msgsdir was manually set in the environment. |
| ... | ... | @@ -12645,7 +12674,7 @@ set config_variables { | |
| 12645 | 12674 | mainfont textfont uifont tabstop findmergefiles maxgraphpct maxwidth | |
| 12646 | 12675 | cmitmode wrapcomment wrapdefault autocopy autoselect autosellen | |
| 12647 | 12676 | showneartags maxrefs visiblerefs | |
| 12648 | - | hideremotes showlocalchanges datetimeformat limitdiffs uicolor want_ttk | |
| 12677 | + | hideremotes refstohide showlocalchanges datetimeformat limitdiffs uicolor want_ttk | |
| 12649 | 12678 | bgcolor fgcolor uifgcolor uifgdisabledcolor colors diffcolors mergecolors | |
| 12650 | 12679 | markbgcolor diffcontext selectbgcolor foundbgcolor currentsearchhitbgcolor | |
| 12651 | 12680 | extdifftool perfile_attrs headbgcolor headfgcolor headoutlinecolor |