{"thread":{"id":"37080","subject":"[PATCH] gitk: add keybinding to switch to parent commit","startedAt":"2014-07-08T20:45:35Z","lastAt":"2014-07-08T20:45:35Z","messageCount":1,"participants":["Max Kirillov"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"245554","messageId":"1404852335-27731-1-git-send-email-max@max630.net","threadId":"37080","inReplyTo":null,"subject":"[PATCH] gitk: add keybinding to switch to parent commit","fromName":"Max Kirillov","fromEmail":"max@max630.net","sentAt":"2014-07-08T20:45:35Z","receivedAt":"2014-07-08T20:45:35Z","isPatch":true,"sender":{"key":"max@max630.net","avatar":"https://avatars.githubusercontent.com/u/381560?v=4"},"body":"Signed-off-by: Max Kirillov <max@max630.net>\n---\nHi.\n\nI was missing this one. Actually the most needed is go to first\nparent, though the second also may be useful.\n gitk | 12 ++++++++++++\n 1 file changed, 12 insertions(+)\n\ndiff --git a/gitk b/gitk\nindex 41e5071..de35fe4 100755\n--- a/gitk\n+++ b/gitk\n@@ -2594,6 +2594,9 @@ proc makewindow {} {\n     bind $ctext $ctxbut {pop_diff_menu %W %X %Y %x %y}\n     bind $ctext <Button-1> {focus %W}\n     bind $ctext <<Selection>> rehighlight_search_results\n+    for {set i 1} {$i<10} {incr i} {\n+\tbind . <$M1B-Key-$i> [list go_to_parent $i]\n+    }\n \n     set maincursor [. cget -cursor]\n     set textcursor [$ctext cget -cursor]\n@@ -3016,6 +3019,7 @@ proc keys {} {\n [mc \"<Down>, n, j\tMove down one commit\"]\n [mc \"<Left>, z, h\tGo back in history list\"]\n [mc \"<Right>, x, l\tGo forward in history list\"]\n+[mc \"<%s-n>\tGo to n-th parent of current commit in history list\" $M1T]\n [mc \"<PageUp>\tMove up one page in commit list\"]\n [mc \"<PageDown>\tMove down one page in commit list\"]\n [mc \"<%s-Home>\tScroll to top of commit list\" $M1T]\n@@ -7494,6 +7498,14 @@ proc goforw {} {\n     }\n }\n \n+proc go_to_parent {i} {\n+    global parents curview targetid\n+    set ps $parents($curview,$targetid)\n+    if {[llength $ps] >= $i} {\n+\tselbyid [lindex $ps [expr $i - 1]]\n+    }\n+}\n+\n proc gettree {id} {\n     global treefilelist treeidlist diffids diffmergeid treepending\n     global nullid nullid2\n-- \n2.0.0.526.g5318336\n"}]}