git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] gitk: add "Hightlight commit name" menu entry

From
RGRaphaël Gallais-Pou <rgallaispou@gmail.com>
Date
Mar 19, 2024, 19:45 UTC
Message-ID
<e47f9df1-be1f-45aa-9308-dfbc2124f29c@gmail.com>
In-Reply-To
<20240130085308.5440-1-rgallaispou@gmail.com>
Hi,

Gentle ping since I haven't received any reviews or comment on this patch. :)

Do you guys actually take patches for the gitk tool ? I feel like there is not much features added on this.

Regards, Raphaël

Le 30/01/2024 à 09:53, Raphael Gallais-Pou a écrit :
Show 66 quoted lines
> When working with diverged branches, some patches can appear several times
> on different branches without having the need to merge those branches.
> On the other hand you may have to port a specific patch on another
> branch you are working on. The search with a SHA1 cannot be applied here
> since they would differ.
> 
> This patch adds an entry in the main context menu to highlight every
> instance of a commit.
> 
> Signed-off-by: Raphael Gallais-Pou <rgallaispou@gmail.com>
> ---
>   gitk-git/gitk | 23 ++++++++++++++++++++---
>   1 file changed, 20 insertions(+), 3 deletions(-)
> 
> diff --git a/gitk-git/gitk b/gitk-git/gitk
> index 7a087f123d..4b15230a16 100755
> --- a/gitk-git/gitk
> +++ b/gitk-git/gitk
> @@ -2672,6 +2672,7 @@ proc makewindow {} {
>           {mc "Make patch" command mkpatch}
>           {mc "Create tag" command mktag}
>           {mc "Copy commit reference" command copyreference}
> +	{mc "Highlight commit name" command highlightcommitname}
>           {mc "Write commit to file" command writecommit}
>           {mc "Create new branch" command mkbranch}
>           {mc "Cherry-pick this commit" command cherrypick}
> @@ -9002,13 +9003,13 @@ proc rowmenu {x y id} {
>       if {$id ne $nullid && $id ne $nullid2} {
>           set menu $rowctxmenu
>           if {$mainhead ne {}} {
> -            $menu entryconfigure 8 -label [mc "Reset %s branch to here" $mainhead] -state normal
> +            $menu entryconfigure 9 -label [mc "Reset %s branch to here" $mainhead] -state normal
>           } else {
> -            $menu entryconfigure 8 -label [mc "Detached head: can't reset" $mainhead] -state disabled
> +            $menu entryconfigure 9 -label [mc "Detached head: can't reset" $mainhead] -state disabled
>           }
> -        $menu entryconfigure 10 -state $mstate
>           $menu entryconfigure 11 -state $mstate
>           $menu entryconfigure 12 -state $mstate
> +        $menu entryconfigure 13 -state $mstate
>       } else {
>           set menu $fakerowmenu
>       }
> @@ -9481,6 +9482,22 @@ proc copyreference {} {
>       clipboard append $reference
>   }
>   
> +proc highlightcommitname {} {
> +    global rowmenuid autosellen findstring gdttype
> +
> +    set format "%s"
> +    set cmd [list git show -s --pretty=format:$format --date=short]
> +    if {$autosellen < 40} {
> +        lappend cmd --abbrev=$autosellen
> +    }
> +    set reference [eval exec $cmd $rowmenuid]
> +    set findstring $reference
> +    set gdttype [mc "containing:"]
> +
> +    clipboard clear
> +    clipboard append $reference
> +}
> +
>   proc writecommit {} {
>       global rowmenuid wrcomtop commitinfo wrcomcmd NS
>   
Previous: Raphael Gallais-PouNext: Marc Branchaud
Message 2 of 6 in “gitk: add "Hightlight commit name" menu entry”
  1. gitk: add "Hightlight commit name" menu entryRaphael Gallais-Pou, Jan 30, 2024
  2. Raphaël Gallais-PouMar 19, 2024
  3. Marc BranchaudMar 21, 2024
  4. Raphaël Gallais-PouMar 23, 2024
  5. Marc BranchaudMar 25, 2024
  6. Junio C HamanoMar 25, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.