From: Raphael Gallais-Pou <rgallaispou@gmail.com>
To: git@vger.kernel.org, David Aguilar <davvid@gmail.com>,
Junio C Hamano <gitster@pobox.com>,
Denton Liu <liu.denton@gmail.com>,
Paul Mackerras <paulus@ozlabs.org>,
Beat Bolli <dev+git@drbeat.li>
Subject: [PATCH] gitk: add "Hightlight commit name" menu entry
Date: Tue, 30 Jan 2024 09:53:08 +0100 [thread overview]
Message-ID: <20240130085308.5440-1-rgallaispou@gmail.com> (raw)
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
--
2.43.0
next reply other threads:[~2024-01-30 8:53 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-30 8:53 Raphael Gallais-Pou [this message]
2024-03-19 19:45 ` [PATCH] gitk: add "Hightlight commit name" menu entry Raphaël Gallais-Pou
2024-03-21 15:51 ` Marc Branchaud
2024-03-23 9:45 ` Raphaël Gallais-Pou
2024-03-25 12:52 ` Marc Branchaud
2024-03-25 18:56 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240130085308.5440-1-rgallaispou@gmail.com \
--to=rgallaispou@gmail.com \
--cc=davvid@gmail.com \
--cc=dev+git@drbeat.li \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=liu.denton@gmail.com \
--cc=paulus@ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).