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

[PATCH] gitk: add keybinding to switch to parent commit

From
Max Kirillov <max@max630.net>
Date
Jul 8, 2014, 20:45 UTC
Message-ID
<1404852335-27731-1-git-send-email-max@max630.net>
Signed-off-by: Max Kirillov <max@max630.net>
---
Hi.
I was missing this one. Actually the most needed is go to first
parent, though the second also may be useful.
 gitk | 12 ++++++++++++
 1 file changed, 12 insertions(+)
diff --git a/gitk b/gitk
index 41e5071..de35fe4 100755
--- a/gitk
+++ b/gitk
@@ -2594,6 +2594,9 @@ proc makewindow {} {
     bind $ctext $ctxbut {pop_diff_menu %W %X %Y %x %y}
     bind $ctext <Button-1> {focus %W}
     bind $ctext <<Selection>> rehighlight_search_results
+    for {set i 1} {$i<10} {incr i} {
+	bind . <$M1B-Key-$i> [list go_to_parent $i]
+    }
 
     set maincursor [. cget -cursor]
     set textcursor [$ctext cget -cursor]
@@ -3016,6 +3019,7 @@ proc keys {} {
 [mc "<Down>, n, j	Move down one commit"]
 [mc "<Left>, z, h	Go back in history list"]
 [mc "<Right>, x, l	Go forward in history list"]
+[mc "<%s-n>	Go to n-th parent of current commit in history list" $M1T]
 [mc "<PageUp>	Move up one page in commit list"]
 [mc "<PageDown>	Move down one page in commit list"]
 [mc "<%s-Home>	Scroll to top of commit list" $M1T]
@@ -7494,6 +7498,14 @@ proc goforw {} {
     }
 }
 
+proc go_to_parent {i} {
+    global parents curview targetid
+    set ps $parents($curview,$targetid)
+    if {[llength $ps] >= $i} {
+	selbyid [lindex $ps [expr $i - 1]]
+    }
+}
+
 proc gettree {id} {
     global treefilelist treeidlist diffids diffmergeid treepending
     global nullid nullid2
-- 
2.0.0.526.g5318336
Message 1 of 1 in “gitk: add keybinding to switch to parent commit”
  1. gitk: add keybinding to switch to parent commitMax Kirillov, Jul 8, 2014

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.